@salesforce/design-system-react 11.0.0-rc.1 → 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 (248) hide show
  1. package/README.md +10 -2
  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/builder-header/nav-dropdown.cjs.map +1 -1
  6. package/dist/cjs/components/builder-header/nav-link.cjs.map +1 -1
  7. package/dist/cjs/components/builder-header/toolbar.cjs.map +1 -1
  8. package/dist/cjs/components/button/index.cjs.map +1 -1
  9. package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
  10. package/dist/cjs/components/checkbox/index.cjs.map +1 -1
  11. package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
  12. package/dist/cjs/components/combobox/combobox.cjs +1 -1
  13. package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
  14. package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
  15. package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
  16. package/dist/cjs/components/date-picker/index.cjs.map +1 -1
  17. package/dist/cjs/components/files/file.cjs.map +1 -1
  18. package/dist/cjs/components/icon/index.cjs.map +1 -1
  19. package/dist/cjs/components/icon/input-icon/index.cjs.map +1 -1
  20. package/dist/cjs/components/icon-settings/index.cjs.map +1 -1
  21. package/dist/cjs/components/input/index.cjs.map +1 -1
  22. package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
  23. package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
  24. package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
  25. package/dist/cjs/components/modal/index.cjs.map +1 -1
  26. package/dist/cjs/components/panel/filtering/group.cjs.map +1 -1
  27. package/dist/cjs/components/pill/index.cjs.map +1 -1
  28. package/dist/cjs/components/popover/edit-dialog.cjs.map +1 -1
  29. package/dist/cjs/components/popover/popover.cjs.map +1 -1
  30. package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
  31. package/dist/cjs/components/progress-ring/index.cjs.map +1 -1
  32. package/dist/cjs/components/radio/index.cjs.map +1 -1
  33. package/dist/cjs/components/radio-group/check-props.cjs.map +1 -1
  34. package/dist/cjs/components/radio-group/index.cjs.map +1 -1
  35. package/dist/cjs/components/scoped-notification/index.cjs.map +1 -1
  36. package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
  37. package/dist/cjs/components/slider/index.cjs.map +1 -1
  38. package/dist/cjs/components/split-view/header.cjs.map +1 -1
  39. package/dist/cjs/components/tabs/index.cjs.map +1 -1
  40. package/dist/cjs/components/tabs/panel.cjs.map +1 -1
  41. package/dist/cjs/components/textarea/index.cjs +1 -1
  42. package/dist/cjs/components/textarea/index.cjs.map +1 -1
  43. package/dist/cjs/components/tooltip/index.cjs.map +1 -1
  44. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  45. package/dist/cjs/components/trial-bar/button.cjs.map +1 -1
  46. package/dist/cjs/components/trial-bar/dropdown.cjs.map +1 -1
  47. package/dist/cjs/components/utilities/menu-list/item-label.cjs.map +1 -1
  48. package/dist/cjs/utilities/get-component-doc.cjs +1 -1
  49. package/dist/cjs/utilities/get-component-doc.cjs.map +1 -1
  50. package/dist/cjs/utilities/warning/children-as-trigger.cjs +1 -1
  51. package/dist/cjs/utilities/warning/children-as-trigger.cjs.map +1 -1
  52. package/dist/cjs/utilities/warning/deprecated-property-value.cjs +1 -1
  53. package/dist/cjs/utilities/warning/deprecated-property-value.cjs.map +1 -1
  54. package/dist/cjs/utilities/warning/deprecated-property.cjs +1 -1
  55. package/dist/cjs/utilities/warning/deprecated-property.cjs.map +1 -1
  56. package/dist/cjs/utilities/warning/removal-version.cjs +2 -0
  57. package/dist/cjs/utilities/warning/removal-version.cjs.map +1 -0
  58. package/dist/es/components/accordion/index.js +7 -3
  59. package/dist/es/components/accordion/index.js.map +1 -1
  60. package/dist/es/components/accordion/panel.js.map +1 -1
  61. package/dist/es/components/builder-header/nav-dropdown.js.map +1 -1
  62. package/dist/es/components/builder-header/nav-link.js.map +1 -1
  63. package/dist/es/components/builder-header/toolbar.js.map +1 -1
  64. package/dist/es/components/button/index.js.map +1 -1
  65. package/dist/es/components/button-stateful/index.js.map +1 -1
  66. package/dist/es/components/checkbox/index.js.map +1 -1
  67. package/dist/es/components/color-picker/color-picker.js.map +1 -1
  68. package/dist/es/components/combobox/combobox.js +4 -2
  69. package/dist/es/components/combobox/combobox.js.map +1 -1
  70. package/dist/es/components/date-picker/date-picker.js +1 -1
  71. package/dist/es/components/date-picker/date-picker.js.map +1 -1
  72. package/dist/es/components/date-picker/index.js.map +1 -1
  73. package/dist/es/components/files/file.js.map +1 -1
  74. package/dist/es/components/icon/index.js.map +1 -1
  75. package/dist/es/components/icon/input-icon/index.js.map +1 -1
  76. package/dist/es/components/icon-settings/index.js.map +1 -1
  77. package/dist/es/components/input/index.js.map +1 -1
  78. package/dist/es/components/input/private/inner-input.js.map +1 -1
  79. package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
  80. package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
  81. package/dist/es/components/modal/index.js.map +1 -1
  82. package/dist/es/components/panel/filtering/group.js.map +1 -1
  83. package/dist/es/components/pill/index.js.map +1 -1
  84. package/dist/es/components/popover/edit-dialog.js.map +1 -1
  85. package/dist/es/components/popover/popover.js.map +1 -1
  86. package/dist/es/components/progress-indicator/index.js.map +1 -1
  87. package/dist/es/components/progress-ring/index.js.map +1 -1
  88. package/dist/es/components/radio/index.js.map +1 -1
  89. package/dist/es/components/radio-group/check-props.js.map +1 -1
  90. package/dist/es/components/radio-group/index.js.map +1 -1
  91. package/dist/es/components/scoped-notification/index.js.map +1 -1
  92. package/dist/es/components/setup-assistant/step.js.map +1 -1
  93. package/dist/es/components/slider/index.js.map +1 -1
  94. package/dist/es/components/split-view/header.js.map +1 -1
  95. package/dist/es/components/tabs/index.js.map +1 -1
  96. package/dist/es/components/tabs/panel.js.map +1 -1
  97. package/dist/es/components/textarea/index.js +29 -44
  98. package/dist/es/components/textarea/index.js.map +1 -1
  99. package/dist/es/components/tooltip/index.js.map +1 -1
  100. package/dist/es/components/tree/tree.js.map +1 -1
  101. package/dist/es/components/trial-bar/button.js.map +1 -1
  102. package/dist/es/components/trial-bar/dropdown.js.map +1 -1
  103. package/dist/es/components/utilities/menu-list/item-label.js.map +1 -1
  104. package/dist/es/utilities/get-component-doc.js +6 -6
  105. package/dist/es/utilities/get-component-doc.js.map +1 -1
  106. package/dist/es/utilities/warning/children-as-trigger.js +9 -8
  107. package/dist/es/utilities/warning/children-as-trigger.js.map +1 -1
  108. package/dist/es/utilities/warning/deprecated-property-value.js +11 -10
  109. package/dist/es/utilities/warning/deprecated-property-value.js.map +1 -1
  110. package/dist/es/utilities/warning/deprecated-property.js +9 -8
  111. package/dist/es/utilities/warning/deprecated-property.js.map +1 -1
  112. package/dist/es/utilities/warning/removal-version.js +6 -0
  113. package/dist/es/utilities/warning/removal-version.js.map +1 -0
  114. package/dist/llms/components/accordion.md +267 -0
  115. package/dist/llms/components/alert.md +228 -0
  116. package/dist/llms/components/avatar.md +167 -0
  117. package/dist/llms/components/badge.md +153 -0
  118. package/dist/llms/components/breadcrumb.md +148 -0
  119. package/dist/llms/components/builder-header.examples.md +239 -0
  120. package/dist/llms/components/builder-header.md +736 -0
  121. package/dist/llms/components/button-group.md +167 -0
  122. package/dist/llms/components/button-stateful.md +246 -0
  123. package/dist/llms/components/button.md +661 -0
  124. package/dist/llms/components/card.md +368 -0
  125. package/dist/llms/components/carousel.md +365 -0
  126. package/dist/llms/components/checkbox.md +887 -0
  127. package/dist/llms/components/color-picker.md +591 -0
  128. package/dist/llms/components/combobox.examples.md +802 -0
  129. package/dist/llms/components/combobox.md +929 -0
  130. package/dist/llms/components/date-picker.md +546 -0
  131. package/dist/llms/components/docked-composer.md +173 -0
  132. package/dist/llms/components/dynamic-icon.md +226 -0
  133. package/dist/llms/components/expandable-section.md +198 -0
  134. package/dist/llms/components/files.md +337 -0
  135. package/dist/llms/components/filter.md +775 -0
  136. package/dist/llms/components/icon-settings.md +301 -0
  137. package/dist/llms/components/icon.md +1040 -0
  138. package/dist/llms/components/input.md +746 -0
  139. package/dist/llms/components/media-object.md +125 -0
  140. package/dist/llms/components/menu-dropdown.md +732 -0
  141. package/dist/llms/components/modal.md +504 -0
  142. package/dist/llms/components/page-header.md +282 -0
  143. package/dist/llms/components/panel.md +256 -0
  144. package/dist/llms/components/pill-container.md +218 -0
  145. package/dist/llms/components/pill.md +266 -0
  146. package/dist/llms/components/popover.md +600 -0
  147. package/dist/llms/components/portal-settings.md +371 -0
  148. package/dist/llms/components/progress-bar.md +175 -0
  149. package/dist/llms/components/progress-indicator.md +399 -0
  150. package/dist/llms/components/progress-ring.md +146 -0
  151. package/dist/llms/components/radio-button-group.md +285 -0
  152. package/dist/llms/components/radio-group.md +242 -0
  153. package/dist/llms/components/radio.md +269 -0
  154. package/dist/llms/components/scoped-notification.md +156 -0
  155. package/dist/llms/components/setup-assistant.md +398 -0
  156. package/dist/llms/components/simple-data-table.examples.md +2773 -0
  157. package/dist/llms/components/simple-data-table.md +919 -0
  158. package/dist/llms/components/slider.md +217 -0
  159. package/dist/llms/components/spinner.md +232 -0
  160. package/dist/llms/components/split-view.md +350 -0
  161. package/dist/llms/components/tabs.md +311 -0
  162. package/dist/llms/components/textarea.md +331 -0
  163. package/dist/llms/components/toast.md +267 -0
  164. package/dist/llms/components/tooltip.md +470 -0
  165. package/dist/llms/components/tree.md +1011 -0
  166. package/dist/llms/components/trial-bar.md +383 -0
  167. package/dist/llms/components/vertical-navigation.md +196 -0
  168. package/dist/llms/components/visual-picker.md +362 -0
  169. package/dist/llms/components/welcome-mat.md +885 -0
  170. package/dist/llms/docs/migration-v11.md +471 -0
  171. package/dist/llms/llms-full.txt +6874 -0
  172. package/dist/llms/llms.txt +133 -0
  173. package/dist/llms/rules.md +36 -0
  174. package/dist/types/components/accordion/index.d.ts.map +1 -1
  175. package/dist/types/components/accordion/panel.d.ts +7 -7
  176. package/dist/types/components/builder-header/nav-dropdown.d.ts +1 -0
  177. package/dist/types/components/builder-header/nav-dropdown.d.ts.map +1 -1
  178. package/dist/types/components/builder-header/nav-link.d.ts +0 -1
  179. package/dist/types/components/builder-header/nav-link.d.ts.map +1 -1
  180. package/dist/types/components/builder-header/toolbar.d.ts +0 -1
  181. package/dist/types/components/builder-header/toolbar.d.ts.map +1 -1
  182. package/dist/types/components/button/index.d.ts +6 -3
  183. package/dist/types/components/button/index.d.ts.map +1 -1
  184. package/dist/types/components/button-stateful/index.d.ts +4 -1
  185. package/dist/types/components/button-stateful/index.d.ts.map +1 -1
  186. package/dist/types/components/checkbox/index.d.ts +19 -5
  187. package/dist/types/components/checkbox/index.d.ts.map +1 -1
  188. package/dist/types/components/color-picker/color-picker.d.ts +6 -4
  189. package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
  190. package/dist/types/components/color-picker/types.d.ts +2 -2
  191. package/dist/types/components/combobox/combobox.d.ts +22 -0
  192. package/dist/types/components/combobox/combobox.d.ts.map +1 -1
  193. package/dist/types/components/date-picker/date-picker.d.ts +16 -4
  194. package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
  195. package/dist/types/components/date-picker/index.d.ts +2 -6
  196. package/dist/types/components/date-picker/index.d.ts.map +1 -1
  197. package/dist/types/components/files/file.d.ts +1 -1
  198. package/dist/types/components/icon/index.d.ts +1 -0
  199. package/dist/types/components/icon/index.d.ts.map +1 -1
  200. package/dist/types/components/icon/input-icon/index.d.ts +3 -0
  201. package/dist/types/components/icon/input-icon/index.d.ts.map +1 -1
  202. package/dist/types/components/icon-settings/index.d.ts.map +1 -1
  203. package/dist/types/components/input/index.d.ts +2 -1
  204. package/dist/types/components/input/index.d.ts.map +1 -1
  205. package/dist/types/components/menu-dropdown/button-trigger.d.ts +5 -0
  206. package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
  207. package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +4 -0
  208. package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
  209. package/dist/types/components/modal/index.d.ts +5 -5
  210. package/dist/types/components/page-header/types.d.ts +3 -0
  211. package/dist/types/components/page-header/types.d.ts.map +1 -1
  212. package/dist/types/components/panel/filtering/group.d.ts +2 -0
  213. package/dist/types/components/panel/filtering/group.d.ts.map +1 -1
  214. package/dist/types/components/pill/index.d.ts +1 -0
  215. package/dist/types/components/pill/index.d.ts.map +1 -1
  216. package/dist/types/components/popover/edit-dialog.d.ts +1 -3
  217. package/dist/types/components/popover/edit-dialog.d.ts.map +1 -1
  218. package/dist/types/components/popover/popover.d.ts +1 -0
  219. package/dist/types/components/popover/popover.d.ts.map +1 -1
  220. package/dist/types/components/progress-indicator/index.d.ts +1 -0
  221. package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
  222. package/dist/types/components/progress-ring/index.d.ts +1 -0
  223. package/dist/types/components/progress-ring/index.d.ts.map +1 -1
  224. package/dist/types/components/radio/index.d.ts +2 -2
  225. package/dist/types/components/radio/index.d.ts.map +1 -1
  226. package/dist/types/components/radio-group/index.d.ts +2 -0
  227. package/dist/types/components/radio-group/index.d.ts.map +1 -1
  228. package/dist/types/components/scoped-notification/index.d.ts +1 -0
  229. package/dist/types/components/scoped-notification/index.d.ts.map +1 -1
  230. package/dist/types/components/setup-assistant/step.d.ts +0 -1
  231. package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
  232. package/dist/types/components/simple-data-table/types.d.ts +1 -0
  233. package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
  234. package/dist/types/components/slider/index.d.ts +4 -2
  235. package/dist/types/components/slider/index.d.ts.map +1 -1
  236. package/dist/types/components/tabs/index.d.ts +1 -0
  237. package/dist/types/components/tabs/index.d.ts.map +1 -1
  238. package/dist/types/components/tabs/panel.d.ts +2 -1
  239. package/dist/types/components/tabs/panel.d.ts.map +1 -1
  240. package/dist/types/components/textarea/index.d.ts +9 -40
  241. package/dist/types/components/textarea/index.d.ts.map +1 -1
  242. package/dist/types/components/tooltip/index.d.ts +5 -0
  243. package/dist/types/components/tooltip/index.d.ts.map +1 -1
  244. package/dist/types/components/tree/tree.d.ts +5 -0
  245. package/dist/types/components/tree/tree.d.ts.map +1 -1
  246. package/dist/types/components/utilities/menu-list/item-label.d.ts +12 -0
  247. package/dist/types/components/utilities/menu-list/item-label.d.ts.map +1 -1
  248. package/package.json +8 -5
@@ -1 +1 @@
1
- {"version":3,"file":"children-as-trigger.cjs","names":[],"sources":["../../../../utilities/warning/children-as-trigger.ts"],"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 import/no-mutable-exports */\n\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\n\n// Warns once per component when its trigger is passed as `children` instead of `trigger`.\nlet childrenAsTrigger: (\n\tcontrol: string,\n\tusesChildrenAsTrigger: boolean,\n\tcomment?: string\n) => void = function childrenAsTriggerFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tchildrenAsTrigger = function childrenAsTriggerFunction(\n\t\tcontrol,\n\t\tusesChildrenAsTrigger,\n\t\tcomment\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tif (usesChildrenAsTrigger && !hasWarned[control]) {\n\t\t\t/* eslint-disable max-len */\n\t\t\twarning(\n\t\t\t\tfalse,\n\t\t\t\t`[Design System React] Passing the trigger of ${control} as \\`children\\` is deprecated and will be removed in the next major version. Use \\`trigger\\` instead: an element, whose props ${control} merges with its own, or a function that receives ${control}'s trigger props.${additionalComment}`\n\t\t\t);\n\t\t\t/* eslint-enable max-len */\n\t\t\thasWarned[control] = true;\n\t\t}\n\t};\n}\n\nexport default childrenAsTrigger;\n"],"mappings":"qIASA,IAAI,EAIQ,UAAqC,CAAC,EAElD,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAY,EAAA,gBAAgB,EAElC,EAAoB,SACnB,EACA,EACA,EACC,CACD,IAAM,EAAoB,EAAU,IAAI,IAAY,GAChD,GAAyB,CAAC,EAAU,MAEvC,EAAA,EAAA,QAAA,CACC,GACA,gDAAgD,EAAQ,iIAAiI,EAAQ,oDAAoD,EAAQ,mBAAmB,GACjR,EAEA,EAAU,GAAW,GAEvB,CACD,CAEA,IAAA,EAAe"}
1
+ {"version":3,"file":"children-as-trigger.cjs","names":[],"sources":["../../../../utilities/warning/children-as-trigger.ts"],"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 import/no-mutable-exports */\n\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\nimport { REMOVAL_VERSION } from './removal-version';\n\n// Warns once per component when its trigger is passed as `children` instead of `trigger`.\nlet childrenAsTrigger: (\n\tcontrol: string,\n\tusesChildrenAsTrigger: boolean,\n\tcomment?: string\n) => void = function childrenAsTriggerFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tchildrenAsTrigger = function childrenAsTriggerFunction(\n\t\tcontrol,\n\t\tusesChildrenAsTrigger,\n\t\tcomment\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tif (usesChildrenAsTrigger && !hasWarned[control]) {\n\t\t\t/* eslint-disable max-len */\n\t\t\twarning(\n\t\t\t\tfalse,\n\t\t\t\t`[Design System React] Passing the trigger of ${control} as \\`children\\` is deprecated and will be removed in ${REMOVAL_VERSION}. Use \\`trigger\\` instead: an element, whose props ${control} merges with its own, or a function that receives ${control}'s trigger props.${additionalComment}`\n\t\t\t);\n\t\t\t/* eslint-enable max-len */\n\t\t\thasWarned[control] = true;\n\t\t}\n\t};\n}\n\nexport default childrenAsTrigger;\n"],"mappings":"wKAUA,IAAI,EAIQ,UAAqC,CAAC,EAElD,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAY,EAAA,gBAAgB,EAElC,EAAoB,SACnB,EACA,EACA,EACC,CACD,IAAM,EAAoB,EAAU,IAAI,IAAY,GAChD,GAAyB,CAAC,EAAU,MAEvC,EAAA,EAAA,QAAA,CACC,GACA,gDAAgD,EAAQ,wDAAwD,EAAA,gBAAgB,qDAAqD,EAAQ,oDAAoD,EAAQ,mBAAmB,GAC7Q,EAEA,EAAU,GAAW,GAEvB,CACD,CAEA,IAAA,EAAe"}
@@ -1,2 +1,2 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./warned-registry.cjs");let n=require("warning");n=e.__toESM(n,1);var r=function(){};if(process.env.NODE_ENV!==`production`){let e=t.createWarnedMap();r=function(t,{propAsString:r,propValue:i,deprecatedPropValue:a,replacementPropAsString:o,replacementPropAsValue:s,log:c},l){let u=l?` ${l}`:``,d=t+r+a,f=i===a,p=a&&o&&s?` Replace \`${r}="${a}"\` with \`${o}="${s}"\`.`:``;if(!e[d]){let i=`[Design System React] The value of \`${a}\`, for prop \`${r}\` will be removed in the next major version of ${t}. Please update your props.${p}${u}`;f&&c?c({message:i}):(0,n.default)(!f,i),e[d]=f}}}var i=r;exports.default=i;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./warned-registry.cjs"),n=require("./removal-version.cjs");let r=require("warning");r=e.__toESM(r,1);var i=function(){};if(process.env.NODE_ENV!==`production`){let e=t.createWarnedMap();i=function(t,{propAsString:i,propValue:a,deprecatedPropValue:o,replacementPropAsString:s,replacementPropAsValue:c,log:l},u){let d=u?` ${u}`:``,f=t+i+o,p=a===o,m=o&&s&&c?` Replace \`${i}="${o}"\` with \`${s}="${c}"\`.`:``;if(!e[f]){let a=`[Design System React] The value of \`${o}\`, for prop \`${i}\` will be removed from ${t} in ${n.REMOVAL_VERSION}. Please update your props.${m}${d}`;p&&l?l({message:a}):(0,r.default)(!p,a),e[f]=p}}}var a=i;exports.default=a;
2
2
  //# sourceMappingURL=deprecated-property-value.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-property-value.cjs","names":[],"sources":["../../../../utilities/warning/deprecated-property-value.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\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\n// This function will deliver an error message to the browser console about the future of a removal and moving of a property's valid value to another prop. This makes the most sense to be used with `oneOf` prop types.\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\n\nlet deprecated = function deprecatedFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tdeprecated = function deprecatedFunction(\n\t\tcontrol,\n\t\t{\n\t\t\tpropAsString, // key name of prop being warned about\n\t\t\tpropValue, // actual value of prop being warned about\n\t\t\tdeprecatedPropValue, // value that is being deprecated\n\t\t\treplacementPropAsString, // prop that value is being moved to\n\t\t\treplacementPropAsValue, // value that should be used in new prop\n\t\t\tlog, // log function that will disable console warning and pipe to another function log({ message })\n\t\t},\n\t\tcomment\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tconst warnOnFirstOccurrenceKey =\n\t\t\tcontrol + propAsString + deprecatedPropValue;\n\t\tconst triggerWarning = propValue === deprecatedPropValue;\n\t\tconst replacementSentence =\n\t\t\tdeprecatedPropValue && replacementPropAsString && replacementPropAsValue\n\t\t\t\t? ` Replace \\`${propAsString}=\"${deprecatedPropValue}\"\\` with \\`${replacementPropAsString}=\"${replacementPropAsValue}\"\\`.`\n\t\t\t\t: '';\n\n\t\tif (!hasWarned[warnOnFirstOccurrenceKey]) {\n\t\t\tconst message = `[Design System React] The value of \\`${deprecatedPropValue}\\`, for prop \\`${propAsString}\\` will be removed in the next major version of ${control}. Please update your props.${replacementSentence}${additionalComment}`;\n\n\t\t\tif (triggerWarning && log) {\n\t\t\t\tlog({ message });\n\t\t\t} else {\n\t\t\t\twarning(\n\t\t\t\t\t!triggerWarning, // false value triggers warning\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\t\t\t// store global flag to limit warnings to first issue\n\t\t\thasWarned[warnOnFirstOccurrenceKey] = triggerWarning;\n\t\t}\n\t};\n}\n\nexport default deprecated;\n"],"mappings":"qIAUA,IAAI,EAAa,UAA8B,CAAC,EAEhD,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAY,EAAA,gBAAgB,EAElC,EAAa,SACZ,EACA,CACC,eACA,YACA,sBACA,0BACA,yBACA,OAED,EACC,CACD,IAAM,EAAoB,EAAU,IAAI,IAAY,GAC9C,EACL,EAAU,EAAe,EACpB,EAAiB,IAAc,EAC/B,EACL,GAAuB,GAA2B,EAC/C,cAAc,EAAa,IAAI,EAAoB,aAAa,EAAwB,IAAI,EAAuB,MACnH,GAEJ,GAAI,CAAC,EAAU,GAA2B,CACzC,IAAM,EAAU,wCAAwC,EAAoB,iBAAiB,EAAa,kDAAkD,EAAQ,6BAA6B,IAAsB,IAEnN,GAAkB,EACrB,EAAI,CAAE,SAAQ,CAAC,GAEf,EAAA,EAAA,QAAA,CACC,CAAC,EACD,CACD,EAGD,EAAU,GAA4B,CACvC,CACD,CACD,CAEA,IAAA,EAAe"}
1
+ {"version":3,"file":"deprecated-property-value.cjs","names":[],"sources":["../../../../utilities/warning/deprecated-property-value.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\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\n// This function will deliver an error message to the browser console about the future of a removal and moving of a property's valid value to another prop. This makes the most sense to be used with `oneOf` prop types.\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\nimport { REMOVAL_VERSION } from './removal-version';\n\nlet deprecated = function deprecatedFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tdeprecated = function deprecatedFunction(\n\t\tcontrol,\n\t\t{\n\t\t\tpropAsString, // key name of prop being warned about\n\t\t\tpropValue, // actual value of prop being warned about\n\t\t\tdeprecatedPropValue, // value that is being deprecated\n\t\t\treplacementPropAsString, // prop that value is being moved to\n\t\t\treplacementPropAsValue, // value that should be used in new prop\n\t\t\tlog, // log function that will disable console warning and pipe to another function log({ message })\n\t\t},\n\t\tcomment\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tconst warnOnFirstOccurrenceKey =\n\t\t\tcontrol + propAsString + deprecatedPropValue;\n\t\tconst triggerWarning = propValue === deprecatedPropValue;\n\t\tconst replacementSentence =\n\t\t\tdeprecatedPropValue && replacementPropAsString && replacementPropAsValue\n\t\t\t\t? ` Replace \\`${propAsString}=\"${deprecatedPropValue}\"\\` with \\`${replacementPropAsString}=\"${replacementPropAsValue}\"\\`.`\n\t\t\t\t: '';\n\n\t\tif (!hasWarned[warnOnFirstOccurrenceKey]) {\n\t\t\tconst message = `[Design System React] The value of \\`${deprecatedPropValue}\\`, for prop \\`${propAsString}\\` will be removed from ${control} in ${REMOVAL_VERSION}. Please update your props.${replacementSentence}${additionalComment}`;\n\n\t\t\tif (triggerWarning && log) {\n\t\t\t\tlog({ message });\n\t\t\t} else {\n\t\t\t\twarning(\n\t\t\t\t\t!triggerWarning, // false value triggers warning\n\t\t\t\t\tmessage\n\t\t\t\t);\n\t\t\t}\n\t\t\t// store global flag to limit warnings to first issue\n\t\t\thasWarned[warnOnFirstOccurrenceKey] = triggerWarning;\n\t\t}\n\t};\n}\n\nexport default deprecated;\n"],"mappings":"wKAWA,IAAI,EAAa,UAA8B,CAAC,EAEhD,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAY,EAAA,gBAAgB,EAElC,EAAa,SACZ,EACA,CACC,eACA,YACA,sBACA,0BACA,yBACA,OAED,EACC,CACD,IAAM,EAAoB,EAAU,IAAI,IAAY,GAC9C,EACL,EAAU,EAAe,EACpB,EAAiB,IAAc,EAC/B,EACL,GAAuB,GAA2B,EAC/C,cAAc,EAAa,IAAI,EAAoB,aAAa,EAAwB,IAAI,EAAuB,MACnH,GAEJ,GAAI,CAAC,EAAU,GAA2B,CACzC,IAAM,EAAU,wCAAwC,EAAoB,iBAAiB,EAAa,0BAA0B,EAAQ,MAAM,EAAA,gBAAgB,6BAA6B,IAAsB,IAEjN,GAAkB,EACrB,EAAI,CAAE,SAAQ,CAAC,GAEf,EAAA,EAAA,QAAA,CACC,CAAC,EACD,CACD,EAGD,EAAU,GAA4B,CACvC,CACD,CACD,CAEA,IAAA,EAAe"}
@@ -1,2 +1,2 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./warned-registry.cjs");let n=require("warning");n=e.__toESM(n,1);var r=function(){};if(process.env.NODE_ENV!==`production`){let e=t.createWarnedMap();r=function(t,r,i,a,o,s){let c=o?` ${o}`:``,l=a?`Use \`${a}\``:``,u=a?` ${l} instead.`:``;!s&&!e[t+i]&&((0,n.default)(r===void 0,`[Design System React] \`${i}\` will be removed in the next major version of ${t}.${u}${c}`),e[t+i]=r!==void 0)}}var i=r;exports.default=i;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./warned-registry.cjs"),n=require("./removal-version.cjs");let r=require("warning");r=e.__toESM(r,1);var i=function(){};if(process.env.NODE_ENV!==`production`){let e=t.createWarnedMap();i=function(t,i,a,o,s,c){let l=s?` ${s}`:``,u=o?`Use \`${o}\``:``,d=o?` ${u} instead.`:``;!c&&!e[t+a]&&((0,r.default)(i===void 0,`[Design System React] \`${a}\` will be removed from ${t} in ${n.REMOVAL_VERSION}.${d}${l}`),e[t+a]=i!==void 0)}}var a=i;exports.default=a;
2
2
  //# sourceMappingURL=deprecated-property.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-property.cjs","names":[],"sources":["../../../../utilities/warning/deprecated-property.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\n/* eslint-disable import/no-mutable-exports */\n\n// This function will deliver an error message to the browser console about the removal of a property.\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\n\nlet deprecated = function deprecatedFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tdeprecated = function deprecatedFunction(\n\t\tcontrol,\n\t\tpropValue,\n\t\toldProp,\n\t\tnewProp,\n\t\tcomment,\n\t\tsilenceDeprecatedPropertyWarning\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tconst newProperty = newProp ? `Use \\`${newProp}\\`` : '';\n\t\tconst newPropertySentence = newProp ? ` ${newProperty} instead.` : '';\n\t\tif (!silenceDeprecatedPropertyWarning && !hasWarned[control + oldProp]) {\n\t\t\t/* eslint-disable max-len */\n\t\t\twarning(\n\t\t\t\tpropValue === undefined,\n\t\t\t\t`[Design System React] \\`${oldProp}\\` will be removed in the next major version of ${control}.${newPropertySentence}${additionalComment}`\n\t\t\t);\n\t\t\t/* eslint-enable max-len */\n\t\t\thasWarned[control + oldProp] = propValue !== undefined;\n\t\t}\n\t};\n}\n\nexport default deprecated;\n"],"mappings":"qIASA,IAAI,EAAa,UAA8B,CAAC,EAEhD,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAY,EAAA,gBAAgB,EAElC,EAAa,SACZ,EACA,EACA,EACA,EACA,EACA,EACC,CACD,IAAM,EAAoB,EAAU,IAAI,IAAY,GAC9C,EAAc,EAAU,SAAS,EAAQ,IAAM,GAC/C,EAAsB,EAAU,IAAI,EAAY,WAAa,GAC/D,CAAC,GAAoC,CAAC,EAAU,EAAU,MAE7D,EAAA,EAAA,QAAA,CACC,IAAc,IAAA,GACd,2BAA2B,EAAQ,kDAAkD,EAAQ,GAAG,IAAsB,GACvH,EAEA,EAAU,EAAU,GAAW,IAAc,IAAA,GAE/C,CACD,CAEA,IAAA,EAAe"}
1
+ {"version":3,"file":"deprecated-property.cjs","names":[],"sources":["../../../../utilities/warning/deprecated-property.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\n/* eslint-disable import/no-mutable-exports */\n\n// This function will deliver an error message to the browser console about the removal of a property.\nimport warning from 'warning';\nimport { createWarnedMap } from './warned-registry';\nimport { REMOVAL_VERSION } from './removal-version';\n\nlet deprecated = function deprecatedFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tconst hasWarned = createWarnedMap();\n\n\tdeprecated = function deprecatedFunction(\n\t\tcontrol,\n\t\tpropValue,\n\t\toldProp,\n\t\tnewProp,\n\t\tcomment,\n\t\tsilenceDeprecatedPropertyWarning\n\t) {\n\t\tconst additionalComment = comment ? ` ${comment}` : '';\n\t\tconst newProperty = newProp ? `Use \\`${newProp}\\`` : '';\n\t\tconst newPropertySentence = newProp ? ` ${newProperty} instead.` : '';\n\t\tif (!silenceDeprecatedPropertyWarning && !hasWarned[control + oldProp]) {\n\t\t\t/* eslint-disable max-len */\n\t\t\twarning(\n\t\t\t\tpropValue === undefined,\n\t\t\t\t`[Design System React] \\`${oldProp}\\` will be removed from ${control} in ${REMOVAL_VERSION}.${newPropertySentence}${additionalComment}`\n\t\t\t);\n\t\t\t/* eslint-enable max-len */\n\t\t\thasWarned[control + oldProp] = propValue !== undefined;\n\t\t}\n\t};\n}\n\nexport default deprecated;\n"],"mappings":"wKAUA,IAAI,EAAa,UAA8B,CAAC,EAEhD,GAAA,QAAA,IAAA,WAA6B,aAAc,CAC1C,IAAM,EAAY,EAAA,gBAAgB,EAElC,EAAa,SACZ,EACA,EACA,EACA,EACA,EACA,EACC,CACD,IAAM,EAAoB,EAAU,IAAI,IAAY,GAC9C,EAAc,EAAU,SAAS,EAAQ,IAAM,GAC/C,EAAsB,EAAU,IAAI,EAAY,WAAa,GAC/D,CAAC,GAAoC,CAAC,EAAU,EAAU,MAE7D,EAAA,EAAA,QAAA,CACC,IAAc,IAAA,GACd,2BAA2B,EAAQ,0BAA0B,EAAQ,MAAM,EAAA,gBAAgB,GAAG,IAAsB,GACrH,EAEA,EAAU,EAAU,GAAW,IAAc,IAAA,GAE/C,CACD,CAEA,IAAA,EAAe"}
@@ -0,0 +1,2 @@
1
+ var e=`11.0.0`;exports.REMOVAL_VERSION=e;
2
+ //# sourceMappingURL=removal-version.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removal-version.cjs","names":[],"sources":["../../../../utilities/warning/removal-version.ts"],"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// The release that removes what is deprecated now. Props deprecated in the\n// 11.0.0 release candidates work only in those releases.\nexport const REMOVAL_VERSION = '11.0.0';\n"],"mappings":"AAKA,IAAa,EAAkB"}
@@ -17,9 +17,13 @@ var u = ({ children: e, className: u, id: d }) => {
17
17
  let b = n(() => {
18
18
  h(null);
19
19
  }, []), x = n((e) => {
20
- let t = m;
21
- t === null && (t = g.current.findIndex((t) => t && t.id === e.target.id)), e.key === "ArrowDown" ? (e.preventDefault(), t < _ - 1 ? h(t + 1) : h(0)) : e.key === "ArrowUp" && (e.preventDefault(), h(t > 0 ? t - 1 : _ - 1));
22
- }, [m, _]), S = n((e, t) => {
20
+ if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
21
+ e.preventDefault();
22
+ let t = g.current.indexOf(e.currentTarget);
23
+ if (t === -1) return;
24
+ let n;
25
+ n = e.key === "ArrowDown" ? t < _ - 1 ? t + 1 : 0 : t > 0 ? t - 1 : _ - 1, h(n), g.current[n]?.focus();
26
+ }, [_]), S = n((e, t) => {
23
27
  t === null ? delete g.current[e] : g.current[e] = t;
24
28
  }, []);
25
29
  return /* @__PURE__ */ l("ul", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/accordion/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\tuseEffect,\n\tuseLayoutEffect,\n\tuseCallback,\n\tuseId,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport { ACCORDION } from '../../utilities/constants';\nimport type { ChildrenOf } from '../../types/common';\nimport type { AccordionPanelProps, AccordionPanelInjectedProps } from './panel';\n\n/**\n * Props for the Accordion component\n */\nexport interface AccordionProps {\n\t/** `AccordionPanel` elements */\n\tchildren: ChildrenOf<AccordionPanelProps>;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string | number;\n}\n\n/**\n * An accordion allows a user to toggle the display of sections of content.\n * The accordion component wraps accordion panels that can be selected and expanded.\n */\nconst Accordion = ({\n\tchildren,\n\tclassName,\n\tid: propId,\n}: AccordionProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst [currButtonIndex, setCurrButtonIndex] = useState<number | null>(0);\n\tconst summaryButtonsRef = useRef<HTMLButtonElement[]>([]);\n\tconst childCount = React.Children.count(children);\n\n\t// Resync the tracked index whenever the panel count changes (e.g. a panel\n\t// is removed). Removing a panel before the focused one shifts the focused\n\t// button to an earlier index without moving DOM focus off of it, so\n\t// currButtonIndex can end up in range but pointing at the wrong button.\n\t// This has to run in a layout effect rather than during render: refs are\n\t// only reattached to their new positions during the commit that follows\n\t// this render, so summaryButtonsRef.current isn't resynced yet while the\n\t// component function is running.\n\tconst prevChildCountRef = useRef(childCount);\n\tuseLayoutEffect(() => {\n\t\tif (prevChildCountRef.current === childCount) {\n\t\t\treturn;\n\t\t}\n\t\tprevChildCountRef.current = childCount;\n\n\t\tif (currButtonIndex === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst focusedIndex = summaryButtonsRef.current.findIndex(\n\t\t\t(button) => button === document.activeElement\n\t\t);\n\n\t\tif (focusedIndex !== -1) {\n\t\t\tif (focusedIndex !== currButtonIndex) {\n\t\t\t\tsetCurrButtonIndex(focusedIndex);\n\t\t\t}\n\t\t} else if (currButtonIndex > childCount - 1) {\n\t\t\tsetCurrButtonIndex(childCount > 0 ? childCount - 1 : null);\n\t\t}\n\t}, [childCount, currButtonIndex]);\n\n\t// Focus management. Only move focus when the index changes, never on\n\t// mount, so rendering an Accordion doesn't steal focus from the page.\n\tconst prevButtonIndexRef = useRef(currButtonIndex);\n\tuseEffect(() => {\n\t\tif (prevButtonIndexRef.current === currButtonIndex) {\n\t\t\treturn;\n\t\t}\n\t\tprevButtonIndexRef.current = currButtonIndex;\n\t\tif (\n\t\t\tcurrButtonIndex !== null &&\n\t\t\tsummaryButtonsRef.current[currButtonIndex]\n\t\t) {\n\t\t\tsummaryButtonsRef.current[currButtonIndex].focus();\n\t\t}\n\t}, [currButtonIndex]);\n\n\tconst handleClickSummary = useCallback(() => {\n\t\tsetCurrButtonIndex(null);\n\t}, []);\n\n\tconst handleKeyDownSummary = useCallback(\n\t\t(e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tlet buttonIndex = currButtonIndex;\n\n\t\t\tif (buttonIndex === null) {\n\t\t\t\tbuttonIndex = summaryButtonsRef.current.findIndex(\n\t\t\t\t\t(el) => el && el.id === (e.target as HTMLElement).id\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (buttonIndex < childCount - 1) {\n\t\t\t\t\tsetCurrButtonIndex(buttonIndex + 1);\n\t\t\t\t} else {\n\t\t\t\t\tsetCurrButtonIndex(0);\n\t\t\t\t}\n\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (buttonIndex > 0) {\n\t\t\t\t\tsetCurrButtonIndex(buttonIndex - 1);\n\t\t\t\t} else {\n\t\t\t\t\tsetCurrButtonIndex(childCount - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[currButtonIndex, childCount]\n\t);\n\n\tconst addSummaryButton = useCallback(\n\t\t(index: number, button: HTMLButtonElement | null) => {\n\t\t\tif (button === null) {\n\t\t\t\tdelete summaryButtonsRef.current[index];\n\t\t\t} else {\n\t\t\t\tsummaryButtonsRef.current[index] = button;\n\t\t\t}\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<ul\n\t\t\t// @ts-expect-error name attribute on ul is non-standard but kept for compatibility\n\t\t\tname={id}\n\t\t\tclassName={classNames('slds-accordion', className as string)}\n\t\t>\n\t\t\t{React.Children.map(children, (child, index) => {\n\t\t\t\tif (React.isValidElement<AccordionPanelProps>(child)) {\n\t\t\t\t\treturn React.cloneElement<\n\t\t\t\t\t\tAccordionPanelProps & AccordionPanelInjectedProps\n\t\t\t\t\t>(child, {\n\t\t\t\t\t\trefs: {\n\t\t\t\t\t\t\tsummaryButton: (button: HTMLButtonElement | null) =>\n\t\t\t\t\t\t\t\taddSummaryButton(index, button),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonClickSummary: handleClickSummary,\n\t\t\t\t\t\tonKeyDownSummary: handleKeyDownSummary,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t})}\n\t\t</ul>\n\t);\n};\n\nAccordion.displayName = ACCORDION;\n\nexport default Accordion;\n"],"mappings":";;;;;AAiCA,IAAM,KAAa,EAClB,aACA,cACA,IAAI,QACqC;CACzC,IAAM,IAAc,EAAM,GACpB,IAAK,KAAU,GAEf,CAAC,GAAiB,KAAsB,EAAwB,CAAC,GACjE,IAAoB,EAA4B,CAAC,CAAC,GAClD,IAAa,EAAM,SAAS,MAAM,CAAQ,GAU1C,IAAoB,EAAO,CAAU;CAC3C,QAAs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B,GAAO,CAAM,EAChC;GACA,gBAAgB;GAChB,kBAAkB;EACnB,CAAC,IAEK,CACP;CACE,CAAA;AAEN;AAEA,EAAU,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/accordion/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\tuseEffect,\n\tuseLayoutEffect,\n\tuseCallback,\n\tuseId,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\nimport { ACCORDION } from '../../utilities/constants';\nimport type { ChildrenOf } from '../../types/common';\nimport type { AccordionPanelProps, AccordionPanelInjectedProps } from './panel';\n\n/**\n * Props for the Accordion component\n */\nexport interface AccordionProps {\n\t/** `AccordionPanel` elements */\n\tchildren: ChildrenOf<AccordionPanelProps>;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string | number;\n}\n\n/**\n * An accordion allows a user to toggle the display of sections of content.\n * The accordion component wraps accordion panels that can be selected and expanded.\n */\nconst Accordion = ({\n\tchildren,\n\tclassName,\n\tid: propId,\n}: AccordionProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tconst [currButtonIndex, setCurrButtonIndex] = useState<number | null>(0);\n\tconst summaryButtonsRef = useRef<HTMLButtonElement[]>([]);\n\tconst childCount = React.Children.count(children);\n\n\t// Resync the tracked index whenever the panel count changes (e.g. a panel\n\t// is removed). Removing a panel before the focused one shifts the focused\n\t// button to an earlier index without moving DOM focus off of it, so\n\t// currButtonIndex can end up in range but pointing at the wrong button.\n\t// This has to run in a layout effect rather than during render: refs are\n\t// only reattached to their new positions during the commit that follows\n\t// this render, so summaryButtonsRef.current isn't resynced yet while the\n\t// component function is running.\n\tconst prevChildCountRef = useRef(childCount);\n\tuseLayoutEffect(() => {\n\t\tif (prevChildCountRef.current === childCount) {\n\t\t\treturn;\n\t\t}\n\t\tprevChildCountRef.current = childCount;\n\n\t\tif (currButtonIndex === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst focusedIndex = summaryButtonsRef.current.findIndex(\n\t\t\t(button) => button === document.activeElement\n\t\t);\n\n\t\tif (focusedIndex !== -1) {\n\t\t\tif (focusedIndex !== currButtonIndex) {\n\t\t\t\tsetCurrButtonIndex(focusedIndex);\n\t\t\t}\n\t\t} else if (currButtonIndex > childCount - 1) {\n\t\t\tsetCurrButtonIndex(childCount > 0 ? childCount - 1 : null);\n\t\t}\n\t}, [childCount, currButtonIndex]);\n\n\t// Focus management. Only move focus when the index changes, never on\n\t// mount, so rendering an Accordion doesn't steal focus from the page.\n\tconst prevButtonIndexRef = useRef(currButtonIndex);\n\tuseEffect(() => {\n\t\tif (prevButtonIndexRef.current === currButtonIndex) {\n\t\t\treturn;\n\t\t}\n\t\tprevButtonIndexRef.current = currButtonIndex;\n\t\tif (\n\t\t\tcurrButtonIndex !== null &&\n\t\t\tsummaryButtonsRef.current[currButtonIndex]\n\t\t) {\n\t\t\tsummaryButtonsRef.current[currButtonIndex].focus();\n\t\t}\n\t}, [currButtonIndex]);\n\n\tconst handleClickSummary = useCallback(() => {\n\t\tsetCurrButtonIndex(null);\n\t}, []);\n\n\tconst handleKeyDownSummary = useCallback(\n\t\t(e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tif (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\te.preventDefault();\n\n\t\t\t// Start from the button that has the key event, not the last index\n\t\t\t// reached with the arrows: Tab or a click can move focus without\n\t\t\t// updating currButtonIndex\n\t\t\tconst buttonIndex = summaryButtonsRef.current.indexOf(e.currentTarget);\n\t\t\tif (buttonIndex === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet nextIndex;\n\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\tnextIndex = buttonIndex < childCount - 1 ? buttonIndex + 1 : 0;\n\t\t\t} else {\n\t\t\t\tnextIndex = buttonIndex > 0 ? buttonIndex - 1 : childCount - 1;\n\t\t\t}\n\n\t\t\tsetCurrButtonIndex(nextIndex);\n\t\t\t// Focus here as well: the focus effect only runs when the index\n\t\t\t// changes, and a stale index can already equal nextIndex\n\t\t\tsummaryButtonsRef.current[nextIndex]?.focus();\n\t\t},\n\t\t[childCount]\n\t);\n\n\tconst addSummaryButton = useCallback(\n\t\t(index: number, button: HTMLButtonElement | null) => {\n\t\t\tif (button === null) {\n\t\t\t\tdelete summaryButtonsRef.current[index];\n\t\t\t} else {\n\t\t\t\tsummaryButtonsRef.current[index] = button;\n\t\t\t}\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<ul\n\t\t\t// @ts-expect-error name attribute on ul is non-standard but kept for compatibility\n\t\t\tname={id}\n\t\t\tclassName={classNames('slds-accordion', className as string)}\n\t\t>\n\t\t\t{React.Children.map(children, (child, index) => {\n\t\t\t\tif (React.isValidElement<AccordionPanelProps>(child)) {\n\t\t\t\t\treturn React.cloneElement<\n\t\t\t\t\t\tAccordionPanelProps & AccordionPanelInjectedProps\n\t\t\t\t\t>(child, {\n\t\t\t\t\t\trefs: {\n\t\t\t\t\t\t\tsummaryButton: (button: HTMLButtonElement | null) =>\n\t\t\t\t\t\t\t\taddSummaryButton(index, button),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonClickSummary: handleClickSummary,\n\t\t\t\t\t\tonKeyDownSummary: handleKeyDownSummary,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t})}\n\t\t</ul>\n\t);\n};\n\nAccordion.displayName = ACCORDION;\n\nexport default Accordion;\n"],"mappings":";;;;;AAiCA,IAAM,KAAa,EAClB,aACA,cACA,IAAI,QACqC;CACzC,IAAM,IAAc,EAAM,GACpB,IAAK,KAAU,GAEf,CAAC,GAAiB,KAAsB,EAAwB,CAAC,GACjE,IAAoB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AA,EAAM,SAAS,IAAI,IAAW,GAAO,MACjC,EAAM,eAAoC,CAAK,IAC3C,EAAM,aAEX,GAAO;GACR,MAAM,EACL,gBAAgB,MACf,EAAiB,GAAO,CAAM,EAChC;GACA,gBAAgB;GAChB,kBAAkB;EACnB,CAAC,IAEK,CACP;CACE,CAAA;AAEN;AAEA,EAAU,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"panel.js","names":[],"sources":["../../../../components/accordion/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\n// Implements the [Accordion design\n// pattern](https://www.lightningdesignsystem.com/components/accordion/) in\n// React. Based on SLDS v2.3.2\n\nimport React, {\n\ttype ReactNode,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n} from 'react';\nimport classNames from 'classnames';\n\nimport Button from '../button';\n\nimport { ACCORDION_PANEL } from '../../utilities/constants';\n\nexport interface AccordionPanelProps {\n\t/**\n\t * The panel content for the Accordion component. Accordion panels should be added as <AccordionPanel />. Event handler for the accordion panels should be added to `<AccordionPanel />`. Optional `panelContentActions` component may be passed as prop. _Tested with Mocha framework and snapshot testing._\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Indicates whether item is expanded or not, which should be handled by `onTogglePanel`. _Tested with Mocha framework and snapshot testing._\n\t */\n\texpanded: boolean;\n\t/**\n\t * Id of the item belonging to this panel. _Tested with snapshot testing._\n\t */\n\tid: number | string;\n\t/**\n\t * Component that can be passed as prop to `<Panel />`. As an example, a menu dropdown could be used here to handle additional actions for each accordion panel. _Tested with Mocha framework._\n\t */\n\tpanelContentActions?: ReactNode;\n\t/**\n\t * Callback that will run whenever a panel is toggled. Function should handle state to toggle `expanded` prop. _Tested with Mocha framework._\n\t */\n\tonTogglePanel: (event: MouseEvent) => void;\n\t/**\n\t * Summary in the span element in the header of this panel. The summary is truncated and so the title element should contain the full text so that it is accessible on hover. _Tested with snapshot testing._\n\t */\n\tsummary: string | ReactNode;\n\t/**\n\t * HTML title attribute. _Tested with snapshot testing._\n\t */\n\ttitle?: string;\n}\n\n/** Props the parent `Accordion` injects for keyboard navigation. They aren't part of the public props. */\nexport interface AccordionPanelInjectedProps {\n\tonClickSummary?: () => void;\n\tonKeyDownSummary?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\trefs?: {\n\t\tsummaryButton?: (button: HTMLButtonElement | null) => void;\n\t};\n}\n\n/**\n * The panel content for the Accordion component.\n */\nconst AccordionPanel = ({\n\tchildren,\n\texpanded,\n\tid,\n\tpanelContentActions,\n\tsummary,\n\ttitle,\n\tonClickSummary,\n\tonKeyDownSummary,\n\tonTogglePanel,\n\trefs = {},\n}: AccordionPanelProps & AccordionPanelInjectedProps): React.ReactElement => (\n\t<li className=\"slds-accordion__list-item\">\n\t\t<section\n\t\t\tclassName={classNames('slds-accordion__section', {\n\t\t\t\t'slds-is-open': expanded,\n\t\t\t})}\n\t\t>\n\t\t\t<div className=\"slds-accordion__summary\">\n\t\t\t\t<h3 className=\"slds-text-heading_small slds-accordion__summary-heading slds-has-flexi-truncate\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-controls={`${id}-accordion-panel`}\n\t\t\t\t\t\taria-expanded={expanded}\n\t\t\t\t\t\tbuttonRef={refs.summaryButton}\n\t\t\t\t\t\tclassName=\"slds-button_reset slds-accordion__summary-action\"\n\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\ticonClassName=\"slds-accordion__summary-action-icon slds-button__icon slds-button__icon_left\"\n\t\t\t\t\t\ticonName=\"switch\"\n\t\t\t\t\t\tid={`${id}-accordion-button`}\n\t\t\t\t\t\tonKeyDown={onKeyDownSummary}\n\t\t\t\t\t\tonClick={(e: MouseEvent) => {\n\t\t\t\t\t\t\tif (onClickSummary) {\n\t\t\t\t\t\t\t\tonClickSummary();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonTogglePanel(e);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"slds-truncate\"\n\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\ttitle || (typeof summary === 'string' ? summary : undefined)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{summary}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</h3>\n\t\t\t\t{panelContentActions}\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\taria-hidden={!expanded}\n\t\t\t\tclassName=\"slds-accordion__content\"\n\t\t\t\tid={`${id}-accordion-panel`}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</section>\n\t</li>\n);\n\nAccordionPanel.displayName = ACCORDION_PANEL;\n\nexport default AccordionPanel as (\n\tprops: AccordionPanelProps\n) => React.ReactElement;\n"],"mappings":";;;;;;AA6DA,IAAM,KAAkB,EACvB,aACA,aACA,OACA,wBACA,YACA,UACA,mBACA,qBACA,kBACA,UAAO,CAAC,QAER,kBAAC,MAAD;CAAI,WAAU;CACb,UAAA,kBAAC,WAAD;EACC,WAAW,EAAW,2BAA2B,EAChD,gBAAgB,EACjB,CAAC;EAHF,UAAA,CAKC,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,kBAAC,MAAD;IAAI,WAAU;IACb,UAAA,kBAAC,GAAD;KACC,iBAAe,GAAG,EAAG;KACrB,iBAAe;KACf,WAAW,EAAK;KAChB,WAAU;KACV,cAAa;KACb,eAAc;KACd,UAAS;KACT,IAAI,GAAG,EAAG;KACV,WAAW;KACX,UAAU,MAAkB;MAI3B,AAHI,KACH,EAAe,GAEhB,EAAc,CAAC;KAChB;KACA,SAAQ;KAER,UAAA,kBAAC,QAAD;MACC,WAAU;MACV,OACC,MAAU,OAAO,KAAY,WAAW,IAAU,KAAA;MAGlD,UAAA;KACI,CAAA;IACC,CAAA;GACL,CAAA,GACH,CACG;EACL,CAAA,GAAA,kBAAC,OAAD;GACC,eAAa,CAAC;GACd,WAAU;GACV,IAAI,GAAG,EAAG;GAET;EACG,CAAA,CACG;;AACN,CAAA;AAGL,EAAe,cAAc"}
1
+ {"version":3,"file":"panel.js","names":[],"sources":["../../../../components/accordion/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\n// Implements the [Accordion design\n// pattern](https://www.lightningdesignsystem.com/components/accordion/) in\n// React. Based on SLDS v2.3.2\n\nimport React, {\n\ttype ReactNode,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n} from 'react';\nimport classNames from 'classnames';\n\nimport Button from '../button';\n\nimport { ACCORDION_PANEL } from '../../utilities/constants';\n\nexport interface AccordionPanelProps {\n\t/**\n\t * The panel content for the Accordion component. Accordion panels should be added as <AccordionPanel />. Event handler for the accordion panels should be added to `<AccordionPanel />`. Optional `panelContentActions` component may be passed as prop.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Indicates whether item is expanded or not, which should be handled by `onTogglePanel`.\n\t */\n\texpanded: boolean;\n\t/**\n\t * Id of the item belonging to this panel.\n\t */\n\tid: number | string;\n\t/**\n\t * Component that can be passed as prop to `<Panel />`. As an example, a menu dropdown could be used here to handle additional actions for each accordion panel.\n\t */\n\tpanelContentActions?: ReactNode;\n\t/**\n\t * Callback that will run whenever a panel is toggled. Function should handle state to toggle `expanded` prop.\n\t */\n\tonTogglePanel: (event: MouseEvent) => void;\n\t/**\n\t * Summary in the span element in the header of this panel. The summary is truncated and so the title element should contain the full text so that it is accessible on hover.\n\t */\n\tsummary: string | ReactNode;\n\t/**\n\t * HTML title attribute.\n\t */\n\ttitle?: string;\n}\n\n/** Props the parent `Accordion` injects for keyboard navigation. They aren't part of the public props. */\nexport interface AccordionPanelInjectedProps {\n\tonClickSummary?: () => void;\n\tonKeyDownSummary?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\trefs?: {\n\t\tsummaryButton?: (button: HTMLButtonElement | null) => void;\n\t};\n}\n\n/**\n * The panel content for the Accordion component.\n */\nconst AccordionPanel = ({\n\tchildren,\n\texpanded,\n\tid,\n\tpanelContentActions,\n\tsummary,\n\ttitle,\n\tonClickSummary,\n\tonKeyDownSummary,\n\tonTogglePanel,\n\trefs = {},\n}: AccordionPanelProps & AccordionPanelInjectedProps): React.ReactElement => (\n\t<li className=\"slds-accordion__list-item\">\n\t\t<section\n\t\t\tclassName={classNames('slds-accordion__section', {\n\t\t\t\t'slds-is-open': expanded,\n\t\t\t})}\n\t\t>\n\t\t\t<div className=\"slds-accordion__summary\">\n\t\t\t\t<h3 className=\"slds-text-heading_small slds-accordion__summary-heading slds-has-flexi-truncate\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-controls={`${id}-accordion-panel`}\n\t\t\t\t\t\taria-expanded={expanded}\n\t\t\t\t\t\tbuttonRef={refs.summaryButton}\n\t\t\t\t\t\tclassName=\"slds-button_reset slds-accordion__summary-action\"\n\t\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\t\ticonClassName=\"slds-accordion__summary-action-icon slds-button__icon slds-button__icon_left\"\n\t\t\t\t\t\ticonName=\"switch\"\n\t\t\t\t\t\tid={`${id}-accordion-button`}\n\t\t\t\t\t\tonKeyDown={onKeyDownSummary}\n\t\t\t\t\t\tonClick={(e: MouseEvent) => {\n\t\t\t\t\t\t\tif (onClickSummary) {\n\t\t\t\t\t\t\t\tonClickSummary();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonTogglePanel(e);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"slds-truncate\"\n\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\ttitle || (typeof summary === 'string' ? summary : undefined)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{summary}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</h3>\n\t\t\t\t{panelContentActions}\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\taria-hidden={!expanded}\n\t\t\t\tclassName=\"slds-accordion__content\"\n\t\t\t\tid={`${id}-accordion-panel`}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</section>\n\t</li>\n);\n\nAccordionPanel.displayName = ACCORDION_PANEL;\n\nexport default AccordionPanel as (\n\tprops: AccordionPanelProps\n) => React.ReactElement;\n"],"mappings":";;;;;;AA6DA,IAAM,KAAkB,EACvB,aACA,aACA,OACA,wBACA,YACA,UACA,mBACA,qBACA,kBACA,UAAO,CAAC,QAER,kBAAC,MAAD;CAAI,WAAU;CACb,UAAA,kBAAC,WAAD;EACC,WAAW,EAAW,2BAA2B,EAChD,gBAAgB,EACjB,CAAC;EAHF,UAAA,CAKC,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACC,kBAAC,MAAD;IAAI,WAAU;IACb,UAAA,kBAAC,GAAD;KACC,iBAAe,GAAG,EAAG;KACrB,iBAAe;KACf,WAAW,EAAK;KAChB,WAAU;KACV,cAAa;KACb,eAAc;KACd,UAAS;KACT,IAAI,GAAG,EAAG;KACV,WAAW;KACX,UAAU,MAAkB;MAI3B,AAHI,KACH,EAAe,GAEhB,EAAc,CAAC;KAChB;KACA,SAAQ;KAER,UAAA,kBAAC,QAAD;MACC,WAAU;MACV,OACC,MAAU,OAAO,KAAY,WAAW,IAAU,KAAA;MAGlD,UAAA;KACI,CAAA;IACC,CAAA;GACL,CAAA,GACH,CACG;EACL,CAAA,GAAA,kBAAC,OAAD;GACC,eAAa,CAAC;GACd,WAAU;GACV,IAAI,GAAG,EAAG;GAET;EACG,CAAA,CACG;;AACN,CAAA;AAGL,EAAe,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"nav-dropdown.js","names":[],"sources":["../../../../components/builder-header/nav-dropdown.tsx"],"sourcesContent":["import Button from '../button';\nimport Icon from '../icon';\nimport Dropdown from '../menu-dropdown';\nimport { type MenuDropdownBaseProps } from '../menu-dropdown/menu-dropdown';\nimport type { IconCategory } from '../../types/common';\n\nimport { BUILDER_HEADER_NAV_DROPDOWN } from '../../utilities/constants';\n\nexport interface BuilderHeaderNavDropdownProps extends Omit<\n\tMenuDropdownBaseProps,\n\t'assistiveText'\n> {\n\t/**\n\t * Assistive text for accessibility. `icon` labels the leading icon.\n\t */\n\tassistiveText?: { icon?: string } & Record<string, unknown>;\n\t/**\n\t * Category of the leading icon.\n\t */\n\ticonCategory?: IconCategory;\n\t/**\n\t * Name of the leading icon.\n\t */\n\ticonName?: string;\n\t/**\n\t * Text label shown next to the icon.\n\t */\n\tlabel?: string;\n\t/** Passed to the dropdown; the trigger is built by this component. */\n\tbuttonVariant?: 'base' | 'neutral' | 'brand' | 'destructive' | 'icon';\n}\n\n/**\n * A dropdown within the navigation section of the header.\n */\nconst BuilderHeaderNavDropdown = (props: BuilderHeaderNavDropdownProps) => {\n\t// Separate props we care about in order to pass others along passively to the dropdown component\n\tconst { iconCategory, iconName, label, assistiveText, ...rest } = props;\n\treturn (\n\t\t<Dropdown\n\t\t\t{...(rest as MenuDropdownBaseProps)}\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"slds-builder-header__item-action slds-media slds-media_center\"\n\t\t\t\t\tvariant=\"base\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"slds-media__figure\">\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 && assistiveText.icon,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcategory={iconCategory}\n\t\t\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-page slds-current-color\"\n\t\t\t\t\t\t\tname={iconName}\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"slds-media__body\">\n\t\t\t\t\t\t<span className=\"slds-truncate\" title={label}>\n\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-chevrondown slds-current-color slds-m-left_small\"\n\t\t\t\t\t\t\tname=\"chevrondown\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t}\n\t\t/>\n\t);\n};\n\nBuilderHeaderNavDropdown.displayName = BUILDER_HEADER_NAV_DROPDOWN;\nexport default BuilderHeaderNavDropdown;\n"],"mappings":";;;;;;AAmCA,IAAM,KAA4B,MAAyC;CAE1E,IAAM,EAAE,iBAAc,aAAU,UAAO,kBAAe,GAAG,MAAS;CAClE,OACC,kBAAC,GAAD;EACC,GAAK;EACL,SACC,kBAAC,GAAD;GACC,WAAU;GACV,SAAQ;GAFT,UAAA,CAIC,kBAAC,QAAD;IAAM,WAAU;IACf,UAAA,kBAAC,GAAD;KACC,eAAe,EACd,OAAO,KAAiB,EAAc,KACvC;KACA,UAAU;KACV,oBAAmB;KACnB,MAAM;KACN,MAAK;IACL,CAAA;GACI,CAAA,GACN,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACC,kBAAC,QAAD;KAAM,WAAU;KAAgB,OAAO;KACrC,UAAA;IACI,CAAA,GACN,kBAAC,GAAD;KACC,UAAS;KACT,oBAAmB;KACnB,MAAK;KACL,MAAK;IACL,CAAA,CACI;GACC,CAAA,CAAA;;CAET,CAAA;AAEH;AAEA,EAAyB,cAAc"}
1
+ {"version":3,"file":"nav-dropdown.js","names":[],"sources":["../../../../components/builder-header/nav-dropdown.tsx"],"sourcesContent":["import Button from '../button';\nimport Icon from '../icon';\nimport Dropdown from '../menu-dropdown';\nimport { type MenuDropdownBaseProps } from '../menu-dropdown/menu-dropdown';\nimport type { IconCategory } from '../../types/common';\n\nimport { BUILDER_HEADER_NAV_DROPDOWN } from '../../utilities/constants';\n\nexport interface BuilderHeaderNavDropdownProps extends Omit<\n\tMenuDropdownBaseProps,\n\t'assistiveText'\n> {\n\t/**\n\t * Assistive text for accessibility. `icon` labels the leading icon.\n\t */\n\tassistiveText?: {\n\t\t/** Label of the leading icon. */\n\t\ticon?: string;\n\t} & Record<string, unknown>;\n\t/**\n\t * Category of the leading icon.\n\t */\n\ticonCategory?: IconCategory;\n\t/**\n\t * Name of the leading icon.\n\t */\n\ticonName?: string;\n\t/**\n\t * Text label shown next to the icon.\n\t */\n\tlabel?: string;\n\t/** Passed to the dropdown; the trigger is built by this component. */\n\tbuttonVariant?: 'base' | 'neutral' | 'brand' | 'destructive' | 'icon';\n}\n\n/**\n * A dropdown within the navigation section of the header.\n */\nconst BuilderHeaderNavDropdown = (props: BuilderHeaderNavDropdownProps) => {\n\t// Separate props we care about in order to pass others along passively to the dropdown component\n\tconst { iconCategory, iconName, label, assistiveText, ...rest } = props;\n\treturn (\n\t\t<Dropdown\n\t\t\t{...(rest as MenuDropdownBaseProps)}\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"slds-builder-header__item-action slds-media slds-media_center\"\n\t\t\t\t\tvariant=\"base\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"slds-media__figure\">\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 && assistiveText.icon,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcategory={iconCategory}\n\t\t\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-page slds-current-color\"\n\t\t\t\t\t\t\tname={iconName}\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"slds-media__body\">\n\t\t\t\t\t\t<span className=\"slds-truncate\" title={label}>\n\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-chevrondown slds-current-color slds-m-left_small\"\n\t\t\t\t\t\t\tname=\"chevrondown\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t}\n\t\t/>\n\t);\n};\n\nBuilderHeaderNavDropdown.displayName = BUILDER_HEADER_NAV_DROPDOWN;\nexport default BuilderHeaderNavDropdown;\n"],"mappings":";;;;;;AAsCA,IAAM,KAA4B,MAAyC;CAE1E,IAAM,EAAE,iBAAc,aAAU,UAAO,kBAAe,GAAG,MAAS;CAClE,OACC,kBAAC,GAAD;EACC,GAAK;EACL,SACC,kBAAC,GAAD;GACC,WAAU;GACV,SAAQ;GAFT,UAAA,CAIC,kBAAC,QAAD;IAAM,WAAU;IACf,UAAA,kBAAC,GAAD;KACC,eAAe,EACd,OAAO,KAAiB,EAAc,KACvC;KACA,UAAU;KACV,oBAAmB;KACnB,MAAM;KACN,MAAK;IACL,CAAA;GACI,CAAA,GACN,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACC,kBAAC,QAAD;KAAM,WAAU;KAAgB,OAAO;KACrC,UAAA;IACI,CAAA,GACN,kBAAC,GAAD;KACC,UAAS;KACT,oBAAmB;KACnB,MAAK;KACL,MAAK;IACL,CAAA,CACI;GACC,CAAA,CAAA;;CAET,CAAA;AAEH;AAEA,EAAyB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"nav-link.js","names":[],"sources":["../../../../components/builder-header/nav-link.tsx"],"sourcesContent":["import React, { type MouseEvent } from 'react';\nimport EventUtil from '../../utilities/event';\n\nimport Icon from '../icon';\nimport type { IconCategory } from '../../types/common';\n\nimport { BUILDER_HEADER_NAV_LINK } from '../../utilities/constants';\n\nexport interface BuilderHeaderNavLinkAssistiveText {\n\t/** Used for the icon next to the link text. */\n\ticon?: string;\n}\n\nexport interface BuilderHeaderNavLinkProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `icon`: Used for the icon next to the link text.\n\t * * _Tested with snapshot testing._\n\t */\n\tassistiveText?: BuilderHeaderNavLinkAssistiveText;\n\t/**\n\t * Name of the icon category. Visit <a href=\"http://www.lightningdesignsystem.com/resources/icons\">Lightning Design System Icons</a> to reference icon categories.\n\t */\n\ticonCategory?: 'action' | 'custom' | 'doctype' | 'standard' | 'utility';\n\t/**\n\t * Name of the icon. Visit <a href=\"http://www.lightningdesignsystem.com/resources/icons\">Lightning Design System Icons</a> to reference icon names.\n\t */\n\ticonName?: string;\n\t/**\n\t * Path to the icon. This will override any global icon settings.\n\t */\n\ticonPath?: string;\n\t/**\n\t * Text for the link.\n\t */\n\tlabel?: string;\n\t/**\n\t * Triggered when the link is clicked.\n\t */\n\tonClick?: (event: MouseEvent) => void;\n}\n\nconst defaultAssistiveText: BuilderHeaderNavLinkAssistiveText = {};\n\n/**\n * A link within the navigation section of the header.\n */\nconst BuilderHeaderNavLink = (\n\tprops: BuilderHeaderNavLinkProps\n): React.ReactElement => {\n\tconst assistiveText = {\n\t\t...defaultAssistiveText,\n\t\t...props.assistiveText,\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS builder header markup uses an anchor for nav items\n\t\t<a\n\t\t\tclassName=\"slds-builder-header__item-action slds-media slds-media_center\"\n\t\t\thref=\"#\"\n\t\t\tonClick={EventUtil.trappedHandler(props.onClick)}\n\t\t>\n\t\t\t<span className=\"slds-media__figure\">\n\t\t\t\t<Icon\n\t\t\t\t\tassistiveText={{ label: assistiveText.icon }}\n\t\t\t\t\tcategory={props.iconCategory as IconCategory}\n\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-settings slds-current-color\"\n\t\t\t\t\tname={props.iconName}\n\t\t\t\t\tpath={props.iconPath}\n\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t/>\n\t\t\t</span>\n\t\t\t<span className=\"slds-media__body\">\n\t\t\t\t<span className=\"slds-truncate\" title={props.label}>\n\t\t\t\t\t{props.label}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</a>\n\t);\n};\n\nBuilderHeaderNavLink.displayName = BUILDER_HEADER_NAV_LINK;\n\nBuilderHeaderNavLink.defaultProps = {\n\tassistiveText: {},\n\ticonCategory: '' as BuilderHeaderNavLinkProps['iconCategory'],\n\ticonName: '',\n\tlabel: '',\n};\n\nexport default BuilderHeaderNavLink;\n"],"mappings":";;;;;;AA2CA,IAAM,IAA0D,CAAC,GAK3D,KACL,MACwB;CACxB,IAAM,IAAgB;EACrB,GAAG;EACH,GAAG,EAAM;CACV;CAEA,OAEC,kBAAC,KAAD;EACC,WAAU;EACV,MAAK;EACL,SAAS,EAAU,eAAe,EAAM,OAAO;EAHhD,UAAA,CAKC,kBAAC,QAAD;GAAM,WAAU;GACf,UAAA,kBAAC,GAAD;IACC,eAAe,EAAE,OAAO,EAAc,KAAK;IAC3C,UAAU,EAAM;IAChB,oBAAmB;IACnB,MAAM,EAAM;IACZ,MAAM,EAAM;IACZ,MAAK;GACL,CAAA;EACI,CAAA,GACN,kBAAC,QAAD;GAAM,WAAU;GACf,UAAA,kBAAC,QAAD;IAAM,WAAU;IAAgB,OAAO,EAAM;IAC3C,UAAA,EAAM;GACF,CAAA;EACD,CAAA,CACJ;;AAEL;AAEA,EAAqB,cAAc,GAEnC,EAAqB,eAAe;CACnC,eAAe,CAAC;CAChB,cAAc;CACd,UAAU;CACV,OAAO;AACR"}
1
+ {"version":3,"file":"nav-link.js","names":[],"sources":["../../../../components/builder-header/nav-link.tsx"],"sourcesContent":["import React, { type MouseEvent } from 'react';\nimport EventUtil from '../../utilities/event';\n\nimport Icon from '../icon';\nimport type { IconCategory } from '../../types/common';\n\nimport { BUILDER_HEADER_NAV_LINK } from '../../utilities/constants';\n\nexport interface BuilderHeaderNavLinkAssistiveText {\n\t/** Used for the icon next to the link text. */\n\ticon?: string;\n}\n\nexport interface BuilderHeaderNavLinkProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `icon`: Used for the icon next to the link text.\n\t */\n\tassistiveText?: BuilderHeaderNavLinkAssistiveText;\n\t/**\n\t * Name of the icon category. Visit <a href=\"http://www.lightningdesignsystem.com/resources/icons\">Lightning Design System Icons</a> to reference icon categories.\n\t */\n\ticonCategory?: 'action' | 'custom' | 'doctype' | 'standard' | 'utility';\n\t/**\n\t * Name of the icon. Visit <a href=\"http://www.lightningdesignsystem.com/resources/icons\">Lightning Design System Icons</a> to reference icon names.\n\t */\n\ticonName?: string;\n\t/**\n\t * Path to the icon. This will override any global icon settings.\n\t */\n\ticonPath?: string;\n\t/**\n\t * Text for the link.\n\t */\n\tlabel?: string;\n\t/**\n\t * Triggered when the link is clicked.\n\t */\n\tonClick?: (event: MouseEvent) => void;\n}\n\nconst defaultAssistiveText: BuilderHeaderNavLinkAssistiveText = {};\n\n/**\n * A link within the navigation section of the header.\n */\nconst BuilderHeaderNavLink = (\n\tprops: BuilderHeaderNavLinkProps\n): React.ReactElement => {\n\tconst assistiveText = {\n\t\t...defaultAssistiveText,\n\t\t...props.assistiveText,\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS builder header markup uses an anchor for nav items\n\t\t<a\n\t\t\tclassName=\"slds-builder-header__item-action slds-media slds-media_center\"\n\t\t\thref=\"#\"\n\t\t\tonClick={EventUtil.trappedHandler(props.onClick)}\n\t\t>\n\t\t\t<span className=\"slds-media__figure\">\n\t\t\t\t<Icon\n\t\t\t\t\tassistiveText={{ label: assistiveText.icon }}\n\t\t\t\t\tcategory={props.iconCategory as IconCategory}\n\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-settings slds-current-color\"\n\t\t\t\t\tname={props.iconName}\n\t\t\t\t\tpath={props.iconPath}\n\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t/>\n\t\t\t</span>\n\t\t\t<span className=\"slds-media__body\">\n\t\t\t\t<span className=\"slds-truncate\" title={props.label}>\n\t\t\t\t\t{props.label}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</a>\n\t);\n};\n\nBuilderHeaderNavLink.displayName = BUILDER_HEADER_NAV_LINK;\n\nBuilderHeaderNavLink.defaultProps = {\n\tassistiveText: {},\n\ticonCategory: '' as BuilderHeaderNavLinkProps['iconCategory'],\n\ticonName: '',\n\tlabel: '',\n};\n\nexport default BuilderHeaderNavLink;\n"],"mappings":";;;;;;AA0CA,IAAM,IAA0D,CAAC,GAK3D,KACL,MACwB;CACxB,IAAM,IAAgB;EACrB,GAAG;EACH,GAAG,EAAM;CACV;CAEA,OAEC,kBAAC,KAAD;EACC,WAAU;EACV,MAAK;EACL,SAAS,EAAU,eAAe,EAAM,OAAO;EAHhD,UAAA,CAKC,kBAAC,QAAD;GAAM,WAAU;GACf,UAAA,kBAAC,GAAD;IACC,eAAe,EAAE,OAAO,EAAc,KAAK;IAC3C,UAAU,EAAM;IAChB,oBAAmB;IACnB,MAAM,EAAM;IACZ,MAAM,EAAM;IACZ,MAAK;GACL,CAAA;EACI,CAAA,GACN,kBAAC,QAAD;GAAM,WAAU;GACf,UAAA,kBAAC,QAAD;IAAM,WAAU;IAAgB,OAAO,EAAM;IAC3C,UAAA,EAAM;GACF,CAAA;EACD,CAAA,CACJ;;AAEL;AAEA,EAAqB,cAAc,GAEnC,EAAqB,eAAe;CACnC,eAAe,CAAC;CAChB,cAAc;CACd,UAAU;CACV,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar.js","names":[],"sources":["../../../../components/builder-header/toolbar.tsx"],"sourcesContent":["import React, { useEffect, type ReactNode } from 'react';\n\nimport { BUILDER_HEADER_TOOLBAR } from '../../utilities/constants';\nimport isElementOfType from '../../utilities/is-element-of-type';\nimport type { ChildrenOf } from '../../types/common';\nimport ButtonGroup, { type ButtonGroupProps } from '../button-group';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\nexport interface BuilderHeaderToolbarAssistiveText {\n\t/** Used for the aria-label for the actions section of the toolbar. */\n\tactions?: string;\n}\n\nexport interface BuilderHeaderToolbarProps {\n\t/**\n\t * Content rendered in the actions section of the toolbar, such as save or undo buttons.\n\t */\n\tactions?: ReactNode;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `actions`: Used for the aria-label for the actions section of the toolbar.\n\t * * _Tested with snapshot testing._\n\t */\n\tassistiveText?: BuilderHeaderToolbarAssistiveText;\n\t/**\n\t * Provide children of the type `<ButtonGroup />` to define the structure of the toolbar section.\n\t * ```\n\t * <BuilderHeader>\n\t * <BuilderHeaderToolbar>\n\t * <ButtonGroup />\n\t * <ButtonGroup />\n\t * </BuilderHeaderToolbar>\n\t * </BuilderHeader>\n\t * ```\n\t * Other children are ignored.\n\t */\n\tchildren?: ChildrenOf<ButtonGroupProps>;\n\t/** @deprecated Use `actions` instead. */\n\tonRenderActions?: () => ReactNode;\n}\n\nconst defaultAssistiveText: BuilderHeaderToolbarAssistiveText = {\n\tactions: 'Actions',\n};\n\n/**\n * The toolbar section of the header.\n */\nconst BuilderHeaderToolbar = ({\n\tactions,\n\tassistiveText = defaultAssistiveText,\n\tchildren,\n\tonRenderActions,\n}: BuilderHeaderToolbarProps): React.ReactElement => {\n\tuseEffect(() => {\n\t\tcheckProps(BUILDER_HEADER_TOOLBAR, { onRenderActions }, componentDoc);\n\t}, [onRenderActions]);\n\n\tconst mergedAssistiveText = {\n\t\t...defaultAssistiveText,\n\t\t...assistiveText,\n\t};\n\treturn (\n\t\t<div className=\"slds-builder-toolbar\" role=\"toolbar\">\n\t\t\t{React.Children.map(children, (child) => {\n\t\t\t\tif (isElementOfType<ButtonGroupProps>(child, ButtonGroup)) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"slds-builder-toolbar__item-group\"\n\t\t\t\t\t\t\t// `label` isn't a ButtonGroup prop (ButtonGroup ignores it);\n\t\t\t\t\t\t\t// the toolbar reads it as the group's accessible name\n\t\t\t\t\t\t\taria-label={(child.props as { label?: string }).label}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{child}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t})}\n\t\t\t<div\n\t\t\t\tclassName=\"slds-builder-toolbar__actions\"\n\t\t\t\taria-label={mergedAssistiveText.actions}\n\t\t\t>\n\t\t\t\t{actions ?? onRenderActions?.()}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nBuilderHeaderToolbar.displayName = BUILDER_HEADER_TOOLBAR;\n\nexport default BuilderHeaderToolbar;\n"],"mappings":";;;;;;;;AA2CA,IAAM,IAA0D,EAC/D,SAAS,UACV,GAKM,KAAwB,EAC7B,YACA,mBAAgB,GAChB,aACA,yBACoD;CACpD,QAAgB;EACf,EAAW,GAAwB,EAAE,mBAAgB,GAAG,CAAY;CACrE,GAAG,CAAC,CAAe,CAAC;CAEpB,IAAM,IAAsB;EAC3B,GAAG;EACH,GAAG;CACJ;CACA,OACC,kBAAC,OAAD;EAAK,WAAU;EAAuB,MAAK;EAA3C,UAAA,CACE,EAAM,SAAS,IAAI,IAAW,MAC1B,EAAkC,GAAO,CAAW,IAEtD,kBAAC,OAAD;GACC,WAAU;GAGV,cAAa,EAAM,MAA6B;GAE/C,UAAA;EACG,CAAA,IAGA,IACP,GACD,kBAAC,OAAD;GACC,WAAU;GACV,cAAY,EAAoB;GAE/B,UAAA,KAAW,IAAkB;EAC1B,CAAA,CACD;;AAEP;AAEA,EAAqB,cAAc"}
1
+ {"version":3,"file":"toolbar.js","names":[],"sources":["../../../../components/builder-header/toolbar.tsx"],"sourcesContent":["import React, { useEffect, type ReactNode } from 'react';\n\nimport { BUILDER_HEADER_TOOLBAR } from '../../utilities/constants';\nimport isElementOfType from '../../utilities/is-element-of-type';\nimport type { ChildrenOf } from '../../types/common';\nimport ButtonGroup, { type ButtonGroupProps } from '../button-group';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\nexport interface BuilderHeaderToolbarAssistiveText {\n\t/** Used for the aria-label for the actions section of the toolbar. */\n\tactions?: string;\n}\n\nexport interface BuilderHeaderToolbarProps {\n\t/**\n\t * Content rendered in the actions section of the toolbar, such as save or undo buttons.\n\t */\n\tactions?: ReactNode;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `actions`: Used for the aria-label for the actions section of the toolbar.\n\t */\n\tassistiveText?: BuilderHeaderToolbarAssistiveText;\n\t/**\n\t * Provide children of the type `<ButtonGroup />` to define the structure of the toolbar section.\n\t * ```\n\t * <BuilderHeader>\n\t * <BuilderHeaderToolbar>\n\t * <ButtonGroup />\n\t * <ButtonGroup />\n\t * </BuilderHeaderToolbar>\n\t * </BuilderHeader>\n\t * ```\n\t * Other children are ignored.\n\t */\n\tchildren?: ChildrenOf<ButtonGroupProps>;\n\t/** @deprecated Use `actions` instead. */\n\tonRenderActions?: () => ReactNode;\n}\n\nconst defaultAssistiveText: BuilderHeaderToolbarAssistiveText = {\n\tactions: 'Actions',\n};\n\n/**\n * The toolbar section of the header.\n */\nconst BuilderHeaderToolbar = ({\n\tactions,\n\tassistiveText = defaultAssistiveText,\n\tchildren,\n\tonRenderActions,\n}: BuilderHeaderToolbarProps): React.ReactElement => {\n\tuseEffect(() => {\n\t\tcheckProps(BUILDER_HEADER_TOOLBAR, { onRenderActions }, componentDoc);\n\t}, [onRenderActions]);\n\n\tconst mergedAssistiveText = {\n\t\t...defaultAssistiveText,\n\t\t...assistiveText,\n\t};\n\treturn (\n\t\t<div className=\"slds-builder-toolbar\" role=\"toolbar\">\n\t\t\t{React.Children.map(children, (child) => {\n\t\t\t\tif (isElementOfType<ButtonGroupProps>(child, ButtonGroup)) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"slds-builder-toolbar__item-group\"\n\t\t\t\t\t\t\t// `label` isn't a ButtonGroup prop (ButtonGroup ignores it);\n\t\t\t\t\t\t\t// the toolbar reads it as the group's accessible name\n\t\t\t\t\t\t\taria-label={(child.props as { label?: string }).label}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{child}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t})}\n\t\t\t<div\n\t\t\t\tclassName=\"slds-builder-toolbar__actions\"\n\t\t\t\taria-label={mergedAssistiveText.actions}\n\t\t\t>\n\t\t\t\t{actions ?? onRenderActions?.()}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nBuilderHeaderToolbar.displayName = BUILDER_HEADER_TOOLBAR;\n\nexport default BuilderHeaderToolbar;\n"],"mappings":";;;;;;;;AA0CA,IAAM,IAA0D,EAC/D,SAAS,UACV,GAKM,KAAwB,EAC7B,YACA,mBAAgB,GAChB,aACA,yBACoD;CACpD,QAAgB;EACf,EAAW,GAAwB,EAAE,mBAAgB,GAAG,CAAY;CACrE,GAAG,CAAC,CAAe,CAAC;CAEpB,IAAM,IAAsB;EAC3B,GAAG;EACH,GAAG;CACJ;CACA,OACC,kBAAC,OAAD;EAAK,WAAU;EAAuB,MAAK;EAA3C,UAAA,CACE,EAAM,SAAS,IAAI,IAAW,MAC1B,EAAkC,GAAO,CAAW,IAEtD,kBAAC,OAAD;GACC,WAAU;GAGV,cAAa,EAAM,MAA6B;GAE/C,UAAA;EACG,CAAA,IAGA,IACP,GACD,kBAAC,OAAD;GACC,WAAU;GACV,cAAY,EAAoB;GAE/B,UAAA,KAAW,IAAkB;EAC1B,CAAA,CACD;;AAEP;AAEA,EAAqB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/button/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\n// Implements the [Button design pattern](https://lightningdesignsystem.com/components/buttons/) in React.\n\nimport React, {\n\tuseEffect,\n\tuseRef,\n\tforwardRef,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n\ttype ForwardedRef,\n\ttype ButtonHTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\n// These imports use the old JSX files for now until they're converted\nimport ButtonIcon from '../icon/button-icon/index.jsx';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport getDataProps from '../../utilities/get-data-props';\nimport getFormProps from '../../utilities/get-form-props';\nimport { BUTTON } from '../../utilities/constants';\nimport { checkRemovedProps } from './check-props';\nimport componentDoc from './component.json';\nimport type { IconCategory } from '../../types/common';\n\n/**\n * Button variant types\n */\nexport type ButtonVariant =\n\t| 'base'\n\t| 'link'\n\t| 'neutral'\n\t| 'brand'\n\t| 'outline-brand'\n\t| 'destructive'\n\t| 'success'\n\t| 'text-destructive'\n\t| 'icon';\n\n/**\n * Button icon variant types\n */\nexport type ButtonIconVariant =\n\t| 'bare'\n\t| 'container'\n\t| 'border'\n\t| 'border-filled'\n\t| 'brand'\n\t| 'more'\n\t| 'global-header';\n\n/**\n * Button icon size types\n */\nexport type ButtonIconSize =\n\t'xx-small' | 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Button type attribute\n */\nexport type ButtonType = 'button' | 'submit' | 'reset';\n\n/**\n * Icon position relative to label\n */\nexport type IconPosition = 'left' | 'right';\n\n/**\n * Assistive text for button\n */\nexport interface ButtonAssistiveText {\n\ticon?: string;\n}\n\n/**\n * Props shared by every Button variant. Other `<button>` attributes (`name`,\n * `value`, `role`, `autoFocus`, ...) pass through to the element.\n */\nexport interface ButtonBaseProps extends Omit<\n\tButtonHTMLAttributes<HTMLButtonElement>,\n\t'children' | 'className' | 'onClick' | 'style' | 'tabIndex' | 'title' | 'type'\n> {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ButtonAssistiveText;\n\t/** Callback for DOM reference */\n\tbuttonRef?: (ref: HTMLButtonElement | null) => void;\n\t/** Additional CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Child elements */\n\tchildren?: ReactNode;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Hint styling for icon buttons */\n\thint?: boolean;\n\t/** Icon category */\n\ticonCategory?: IconCategory;\n\t/** CSS classes for icon */\n\ticonClassName?: string | string[] | Record<string, boolean>;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Direct path to icon sprite */\n\ticonPath?: string;\n\t/** Icon position */\n\ticonPosition?: IconPosition;\n\t/** Unique identifier */\n\tid?: string;\n\t/** Inverse colors for dark backgrounds */\n\tinverse?: boolean;\n\t/** Visible button label */\n\tlabel?: ReactNode;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Click event handler */\n\tonClick?: (\n\t\tevent: MouseEvent<HTMLButtonElement>,\n\t\tdata?: { id?: string }\n\t) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/**\n\t * @deprecated `keypress` is a deprecated DOM event. Use `onKeyDown` and read\n\t * `event.key` instead. Still works, and warns.\n\t */\n\tonKeyPress?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down event handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter event handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse leave event handler */\n\tonMouseLeave?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse up event handler */\n\tonMouseUp?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/**\n\t * @deprecated Focus the button through `ref` or `buttonRef` instead. Called with the\n\t * `<button>` when `requestFocus` is set. Still works, and warns.\n\t */\n\tonRequestFocus?: (element: HTMLButtonElement) => void;\n\t/**\n\t * @deprecated Focus the button through `ref` or `buttonRef` instead. Still works, and warns.\n\t */\n\trequestFocus?: boolean;\n\t/** Stretches the button to the full width of its container (`slds-button_stretch`) */\n\tresponsive?: boolean;\n\t/** Custom inline styles */\n\tstyle?: CSSProperties;\n\t/** Tab index */\n\ttabIndex?: number;\n\t/** HTML title attribute */\n\ttitle?: string;\n\t/**\n\t * Button type attribute. Defaults to `submit` when `formAction` is set, since browsers\n\t * ignore `formAction` on other types, and to `button` otherwise.\n\t */\n\ttype?: ButtonType;\n}\n\n/**\n * Icon sizing and styling props, shared by the icon-capable variants.\n */\ninterface ButtonIconProps {\n\t/**\n\t * Icon size. With `iconVariant`, sizes the button container (`slds-button_icon-*`); otherwise sizes the SVG (`slds-button__icon_*`).\n\t * `xx-small` requires `iconVariant`, since SLDS only defines it for the button container (matches `lightning-button-icon`).\n\t */\n\ticonSize?: ButtonIconSize;\n\t/**\n\t * Icon variant. `global-header` renders the SLDS global header action button\n\t * (`slds-global-actions__item-action`); place it inside a\n\t * `slds-global-actions__item` in the global header markup.\n\t */\n\ticonVariant?: ButtonIconVariant;\n}\n\n/**\n * `variant=\"icon\"` is the icon button: it is the variant that takes `iconVariant`.\n * Other variants size the icon with `iconSize` only.\n */\nexport type ButtonProps = ButtonBaseProps &\n\t(\n\t\t| ({ /** Button variant */ variant: 'icon' } & ButtonIconProps)\n\t\t| ({\n\t\t\t\t/** Button variant */\n\t\t\t\tvariant?: Exclude<ButtonVariant, 'icon'>;\n\t\t } & Pick<ButtonIconProps, 'iconSize'> & { iconVariant?: undefined })\n\t);\n\nconst defaultAssistiveText: ButtonAssistiveText = { icon: '' };\n\n/**\n * The Button component is the Lightning Design System Button component.\n * Use for label buttons, icon buttons, or buttons with both labels and icons.\n *\n * Either a `label` or `assistiveText.icon` is required for accessibility.\n * For buttons that maintain selected/unselected states, use ButtonStateful.\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) => {\n\t\tconst {\n\t\t\tassistiveText = defaultAssistiveText,\n\t\t\tbuttonRef,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled = false,\n\t\t\thint = false,\n\t\t\ticonCategory,\n\t\t\ticonClassName,\n\t\t\ticonName,\n\t\t\ticonPath,\n\t\t\ticonPosition,\n\t\t\ticonSize = 'medium',\n\t\t\ticonVariant,\n\t\t\tid,\n\t\t\tinverse,\n\t\t\tlabel,\n\t\t\tonBlur,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonMouseUp,\n\t\t\tonRequestFocus,\n\t\t\trequestFocus,\n\t\t\tresponsive = false,\n\t\t\tstyle,\n\t\t\ttabIndex,\n\t\t\ttitle,\n\t\t\t// Removed in v11. Destructured so it never reaches the DOM;\n\t\t\t// `checkRemovedProps` warns about it.\n\t\t\ttooltip,\n\t\t\t// Injected by `ButtonGroup` into its last child for `MenuDropdown`; a\n\t\t\t// Button has no use for it, so keep it off the DOM.\n\t\t\ttriggerClassName: _triggerClassName,\n\t\t\ttype: propType,\n\t\t\tvariant = 'neutral',\n\t\t\t...restProps\n\t\t} = props as ButtonProps & {\n\t\t\ttooltip?: ReactNode;\n\t\t\ttriggerClassName?: unknown;\n\t\t};\n\t\tconst type = propType ?? (props.formAction ? 'submit' : 'button');\n\n\t\tuseEffect(() => {\n\t\t\tcheckRemovedProps(\n\t\t\t\tBUTTON,\n\t\t\t\t{ onKeyPress, onRequestFocus, requestFocus, tooltip },\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [onKeyPress, onRequestFocus, requestFocus, tooltip]);\n\n\t\tconst internalRef = useRef<HTMLButtonElement | null>(null);\n\n\t\tuseEffect(() => {\n\t\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\t\tonRequestFocus(internalRef.current);\n\t\t\t}\n\t\t}, [requestFocus, onRequestFocus]);\n\n\t\tconst getClassName = (): string => {\n\t\t\tconst isIcon = variant === 'icon';\n\t\t\tlet computedIconVariant = iconVariant;\n\t\t\tconst iconMore = iconVariant === 'more';\n\t\t\tconst iconBorder = iconVariant === 'border';\n\t\t\tconst iconGlobalHeader = iconVariant === 'global-header';\n\n\t\t\tconst showButtonVariant =\n\t\t\t\t(variant !== 'base' &&\n\t\t\t\t\t!iconVariant &&\n\t\t\t\t\t!inverse &&\n\t\t\t\t\tvariant !== 'link') ||\n\t\t\t\ticonVariant === 'bare';\n\t\t\tconst plainInverseBtn = inverse && !isIcon;\n\t\t\tconst plainInverseIcon = inverse && isIcon && !iconMore && !iconBorder;\n\t\t\tconst moreInverseIcon = inverse && iconMore;\n\t\t\tconst borderInverseIcon = inverse && iconBorder;\n\n\t\t\t// Reset to container style for the actual button CSS\n\t\t\tif (iconVariant === 'global-header') {\n\t\t\t\tcomputedIconVariant = 'container';\n\t\t\t}\n\n\t\t\treturn classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-button': variant !== 'link',\n\t\t\t\t\t[`slds-button_${variant}`]: showButtonVariant,\n\t\t\t\t\t'slds-button_inverse': plainInverseBtn,\n\t\t\t\t\t'slds-button_icon-inverse': plainInverseIcon || moreInverseIcon,\n\t\t\t\t\t'slds-button_icon-border-inverse': borderInverseIcon,\n\t\t\t\t\t[`slds-button_icon-${computedIconVariant}`]:\n\t\t\t\t\t\tcomputedIconVariant && !borderInverseIcon,\n\t\t\t\t\t'slds-global-actions__item-action': iconGlobalHeader,\n\t\t\t\t\t[`slds-button_icon-${iconSize}`]:\n\t\t\t\t\t\ticonVariant && iconSize !== 'medium',\n\t\t\t\t\t'slds-button_reset': variant === 'link',\n\t\t\t\t\t'slds-text-link': variant === 'link',\n\t\t\t\t\t'slds-button_stretch': responsive,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t);\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event, { id });\n\t\t\t}\n\t\t};\n\n\t\tconst renderIcon = (name?: string): React.ReactElement => {\n\t\t\t// SLDS has no `slds-button__icon_xx-small`; xx-small only sizes the container.\n\t\t\tconst computedIconSize =\n\t\t\t\t!iconSize || iconVariant || iconSize === 'xx-small'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: iconSize;\n\t\t\treturn (\n\t\t\t\t<ButtonIcon\n\t\t\t\t\tcategory={iconCategory || 'utility'}\n\t\t\t\t\tclassName={iconClassName as string}\n\t\t\t\t\thint={hint}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\tname={name}\n\t\t\t\t\tpath={iconPath}\n\t\t\t\t\tposition={iconPosition}\n\t\t\t\t\tsize={computedIconSize}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\tconst renderLabel = (): ReactNode => {\n\t\t\tconst iconOnly = iconName || iconPath;\n\t\t\tconst assistiveTextIcon = {\n\t\t\t\t...defaultAssistiveText,\n\t\t\t\t...assistiveText,\n\t\t\t}.icon;\n\n\t\t\treturn iconOnly && assistiveTextIcon ? (\n\t\t\t\t<span className=\"slds-assistive-text\">{assistiveTextIcon}</span>\n\t\t\t) : (\n\t\t\t\tlabel\n\t\t\t);\n\t\t};\n\n\t\tconst renderButton = (): React.ReactElement => {\n\t\t\tconst ariaProps = getAriaProps(restProps);\n\t\t\tconst dataProps = getDataProps(restProps);\n\t\t\tconst formProps = getFormProps(restProps);\n\n\t\t\treturn (\n\t\t\t\t<button\n\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonKeyDown={onKeyDown}\n\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\tonKeyPress={onKeyPress}\n\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\t\tonMouseLeave={onMouseLeave}\n\t\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\t\t\tref(node);\n\t\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (buttonRef) {\n\t\t\t\t\t\t\tbuttonRef(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttabIndex={\n\t\t\t\t\t\ttypeof tabIndex === 'string' ? parseInt(tabIndex, 10) : tabIndex\n\t\t\t\t\t}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\ttype={type}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t{...restProps}\n\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...formProps}\n\t\t\t\t>\n\t\t\t\t\t{iconPosition === 'right' ? renderLabel() : null}\n\t\t\t\t\t{iconName || iconPath ? renderIcon(iconName) : null}\n\t\t\t\t\t{iconVariant === 'more' ? (\n\t\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tname=\"down\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\tclassName={iconClassName as string}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{iconPosition === 'left' || !iconPosition ? renderLabel() : null}\n\t\t\t\t\t{children}\n\t\t\t\t</button>\n\t\t\t);\n\t\t};\n\n\t\treturn renderButton();\n\t}\n);\n\nButton.displayName = BUTTON;\n\nexport default Button;\n"],"mappings":";;;;;;;;;;;AAiMA,IAAM,IAA4C,EAAE,MAAM,GAAG,GASvD,IAAS,GACb,GAAoB,MAAyC;CAC7D,IAAM,EACL,mBAAgB,GAChB,cACA,aACA,cACA,cAAW,IACX,UAAO,IACP,iBACA,kBACA,aACA,aACA,iBACA,cAAW,UACX,gBACA,OACA,YACA,UACA,WACA,YACA,aACA,cACA,eACA,YACA,gBACA,iBACA,iBACA,cACA,mBACA,iBACA,gBAAa,IACb,UACA,aACA,UAGA,YAGA,kBAAkB,IAClB,MAAM,GACN,aAAU,WACV,GAAG,MACA,GAIE,IAAO,MAAa,EAAM,aAAa,WAAW;CAExD,QAAgB;EACf,EACC,GACA;GAAE;GAAY;GAAgB;GAAc;EAAQ,GACpD,CACD;CACD,GAAG;EAAC;EAAY;EAAgB;EAAc;CAAO,CAAC;CAEtD,IAAM,IAAc,EAAiC,IAAI;CAEzD,QAAgB;EACf,AAAI,KAAgB,KAAkB,EAAY,WACjD,EAAe,EAAY,OAAO;CAEpC,GAAG,CAAC,GAAc,CAAc,CAAC;CAEjC,IAAM,UAA6B;EAClC,IAAM,IAAS,MAAY,QACvB,IAAsB,GACpB,IAAW,MAAgB,QAC3B,IAAa,MAAgB,UAC7B,IAAmB,MAAgB,iBAEnC,IACJ,MAAY,UACZ,CAAC,KACD,CAAC,KACD,MAAY,UACb,MAAgB,QACX,IAAkB,KAAW,CAAC,GAC9B,IAAmB,KAAW,KAAU,CAAC,KAAY,CAAC,GACtD,IAAkB,KAAW,GAC7B,IAAoB,KAAW;EAOrC,OAJI,MAAgB,oBACnB,IAAsB,cAGhB,EACN;GACC,eAAe,MAAY;IAC1B,eAAe,MAAY;GAC5B,uBAAuB;GACvB,4BAA4B,KAAoB;GAChD,mCAAmC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AI;IAC3D;GACM;;CAEV,EAEO,CAAa;AACrB,CACD;AAEA,EAAO,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/button/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\n// Implements the [Button design pattern](https://lightningdesignsystem.com/components/buttons/) in React.\n\nimport React, {\n\tuseEffect,\n\tuseRef,\n\tforwardRef,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n\ttype ForwardedRef,\n\ttype ButtonHTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\n// These imports use the old JSX files for now until they're converted\nimport ButtonIcon from '../icon/button-icon/index.jsx';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport getDataProps from '../../utilities/get-data-props';\nimport getFormProps from '../../utilities/get-form-props';\nimport { BUTTON } from '../../utilities/constants';\nimport { checkRemovedProps } from './check-props';\nimport componentDoc from './component.json';\nimport type { IconCategory } from '../../types/common';\n\n/**\n * Button variant types\n */\nexport type ButtonVariant =\n\t| 'base'\n\t| 'link'\n\t| 'neutral'\n\t| 'brand'\n\t| 'outline-brand'\n\t| 'destructive'\n\t| 'success'\n\t| 'text-destructive'\n\t| 'icon';\n\n/**\n * Button icon variant types\n */\nexport type ButtonIconVariant =\n\t| 'bare'\n\t| 'container'\n\t| 'border'\n\t| 'border-filled'\n\t| 'brand'\n\t| 'more'\n\t| 'global-header';\n\n/**\n * Button icon size types\n */\nexport type ButtonIconSize =\n\t'xx-small' | 'x-small' | 'small' | 'medium' | 'large';\n\n/**\n * Button type attribute\n */\nexport type ButtonType = 'button' | 'submit' | 'reset';\n\n/**\n * Icon position relative to label\n */\nexport type IconPosition = 'left' | 'right';\n\n/**\n * Assistive text for button\n */\nexport interface ButtonAssistiveText {\n\t/** Visually hidden label of an icon-only button. Required when there is no `label`. */\n\ticon?: string;\n}\n\n/**\n * Props shared by every Button variant. Other `<button>` attributes (`name`,\n * `value`, `role`, `autoFocus`, ...) pass through to the element.\n */\nexport interface ButtonBaseProps extends Omit<\n\tButtonHTMLAttributes<HTMLButtonElement>,\n\t'children' | 'className' | 'onClick' | 'style' | 'tabIndex' | 'title' | 'type'\n> {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ButtonAssistiveText;\n\t/** Callback for DOM reference */\n\tbuttonRef?: (ref: HTMLButtonElement | null) => void;\n\t/** Additional CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Child elements */\n\tchildren?: ReactNode;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Hint styling for icon buttons */\n\thint?: boolean;\n\t/** Icon category */\n\ticonCategory?: IconCategory;\n\t/** CSS classes for icon */\n\ticonClassName?: string | string[] | Record<string, boolean>;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Direct path to icon sprite */\n\ticonPath?: string;\n\t/** Icon position */\n\ticonPosition?: IconPosition;\n\t/** Unique identifier */\n\tid?: string;\n\t/** Inverse colors for dark backgrounds */\n\tinverse?: boolean;\n\t/** Visible button label */\n\tlabel?: ReactNode;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Click event handler */\n\tonClick?: (\n\t\tevent: MouseEvent<HTMLButtonElement>,\n\t\tdata?: { id?: string }\n\t) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => 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<HTMLButtonElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down event handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter event handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse leave event handler */\n\tonMouseLeave?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse up event handler */\n\tonMouseUp?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/**\n\t * @deprecated Focus the button through `ref` or `buttonRef` instead. Called with the\n\t * `<button>` when `requestFocus` is set. Works only in the 11.0.0 release candidates, and warns.\n\t */\n\tonRequestFocus?: (element: HTMLButtonElement) => void;\n\t/**\n\t * @deprecated Focus the button through `ref` or `buttonRef` instead. Works only in the 11.0.0 release candidates, and warns.\n\t */\n\trequestFocus?: boolean;\n\t/** Stretches the button to the full width of its container (`slds-button_stretch`) */\n\tresponsive?: boolean;\n\t/** Custom inline styles */\n\tstyle?: CSSProperties;\n\t/** Tab index */\n\ttabIndex?: number;\n\t/** HTML title attribute */\n\ttitle?: string;\n\t/**\n\t * Button type attribute. Defaults to `submit` when `formAction` is set, since browsers\n\t * ignore `formAction` on other types, and to `button` otherwise.\n\t */\n\ttype?: ButtonType;\n}\n\n/**\n * Icon sizing and styling props, shared by the icon-capable variants.\n */\ninterface ButtonIconProps {\n\t/**\n\t * Icon size. With `iconVariant`, sizes the button container (`slds-button_icon-*`); otherwise sizes the SVG (`slds-button__icon_*`).\n\t * `xx-small` requires `iconVariant`, since SLDS only defines it for the button container (matches `lightning-button-icon`).\n\t */\n\ticonSize?: ButtonIconSize;\n\t/**\n\t * Icon variant. `global-header` renders the SLDS global header action button\n\t * (`slds-global-actions__item-action`); place it inside a\n\t * `slds-global-actions__item` in the global header markup.\n\t */\n\ticonVariant?: ButtonIconVariant;\n}\n\n/**\n * `variant=\"icon\"` is the icon button: it is the variant that takes `iconVariant`.\n * Other variants size the icon with `iconSize` only.\n */\nexport type ButtonProps = ButtonBaseProps &\n\t(\n\t\t| ({\n\t\t\t\t/** Button variant: an icon button. */\n\t\t\t\tvariant: 'icon';\n\t\t } & ButtonIconProps)\n\t\t| ({\n\t\t\t\t/** Button variant */\n\t\t\t\tvariant?: Exclude<ButtonVariant, 'icon'>;\n\t\t } & Pick<ButtonIconProps, 'iconSize'> & {\n\t\t\t\t\t/** Only for `variant=\"icon\"`. */\n\t\t\t\t\ticonVariant?: undefined;\n\t\t\t\t})\n\t);\n\nconst defaultAssistiveText: ButtonAssistiveText = { icon: '' };\n\n/**\n * The Button component is the Lightning Design System Button component.\n * Use for label buttons, icon buttons, or buttons with both labels and icons.\n *\n * Either a `label` or `assistiveText.icon` is required for accessibility.\n * For buttons that maintain selected/unselected states, use ButtonStateful.\n */\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) => {\n\t\tconst {\n\t\t\tassistiveText = defaultAssistiveText,\n\t\t\tbuttonRef,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdisabled = false,\n\t\t\thint = false,\n\t\t\ticonCategory,\n\t\t\ticonClassName,\n\t\t\ticonName,\n\t\t\ticonPath,\n\t\t\ticonPosition,\n\t\t\ticonSize = 'medium',\n\t\t\ticonVariant,\n\t\t\tid,\n\t\t\tinverse,\n\t\t\tlabel,\n\t\t\tonBlur,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonMouseDown,\n\t\t\tonMouseEnter,\n\t\t\tonMouseLeave,\n\t\t\tonMouseUp,\n\t\t\tonRequestFocus,\n\t\t\trequestFocus,\n\t\t\tresponsive = false,\n\t\t\tstyle,\n\t\t\ttabIndex,\n\t\t\ttitle,\n\t\t\t// Removed in v11. Destructured so it never reaches the DOM;\n\t\t\t// `checkRemovedProps` warns about it.\n\t\t\ttooltip,\n\t\t\t// Injected by `ButtonGroup` into its last child for `MenuDropdown`; a\n\t\t\t// Button has no use for it, so keep it off the DOM.\n\t\t\ttriggerClassName: _triggerClassName,\n\t\t\ttype: propType,\n\t\t\tvariant = 'neutral',\n\t\t\t...restProps\n\t\t} = props as ButtonProps & {\n\t\t\ttooltip?: ReactNode;\n\t\t\ttriggerClassName?: unknown;\n\t\t};\n\t\tconst type = propType ?? (props.formAction ? 'submit' : 'button');\n\n\t\tuseEffect(() => {\n\t\t\tcheckRemovedProps(\n\t\t\t\tBUTTON,\n\t\t\t\t{ onKeyPress, onRequestFocus, requestFocus, tooltip },\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [onKeyPress, onRequestFocus, requestFocus, tooltip]);\n\n\t\tconst internalRef = useRef<HTMLButtonElement | null>(null);\n\n\t\tuseEffect(() => {\n\t\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\t\tonRequestFocus(internalRef.current);\n\t\t\t}\n\t\t}, [requestFocus, onRequestFocus]);\n\n\t\tconst getClassName = (): string => {\n\t\t\tconst isIcon = variant === 'icon';\n\t\t\tlet computedIconVariant = iconVariant;\n\t\t\tconst iconMore = iconVariant === 'more';\n\t\t\tconst iconBorder = iconVariant === 'border';\n\t\t\tconst iconGlobalHeader = iconVariant === 'global-header';\n\n\t\t\tconst showButtonVariant =\n\t\t\t\t(variant !== 'base' &&\n\t\t\t\t\t!iconVariant &&\n\t\t\t\t\t!inverse &&\n\t\t\t\t\tvariant !== 'link') ||\n\t\t\t\ticonVariant === 'bare';\n\t\t\tconst plainInverseBtn = inverse && !isIcon;\n\t\t\tconst plainInverseIcon = inverse && isIcon && !iconMore && !iconBorder;\n\t\t\tconst moreInverseIcon = inverse && iconMore;\n\t\t\tconst borderInverseIcon = inverse && iconBorder;\n\n\t\t\t// Reset to container style for the actual button CSS\n\t\t\tif (iconVariant === 'global-header') {\n\t\t\t\tcomputedIconVariant = 'container';\n\t\t\t}\n\n\t\t\treturn classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-button': variant !== 'link',\n\t\t\t\t\t[`slds-button_${variant}`]: showButtonVariant,\n\t\t\t\t\t'slds-button_inverse': plainInverseBtn,\n\t\t\t\t\t'slds-button_icon-inverse': plainInverseIcon || moreInverseIcon,\n\t\t\t\t\t'slds-button_icon-border-inverse': borderInverseIcon,\n\t\t\t\t\t[`slds-button_icon-${computedIconVariant}`]:\n\t\t\t\t\t\tcomputedIconVariant && !borderInverseIcon,\n\t\t\t\t\t'slds-global-actions__item-action': iconGlobalHeader,\n\t\t\t\t\t[`slds-button_icon-${iconSize}`]:\n\t\t\t\t\t\ticonVariant && iconSize !== 'medium',\n\t\t\t\t\t'slds-button_reset': variant === 'link',\n\t\t\t\t\t'slds-text-link': variant === 'link',\n\t\t\t\t\t'slds-button_stretch': responsive,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t);\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n\t\t\tif (onClick) {\n\t\t\t\tonClick(event, { id });\n\t\t\t}\n\t\t};\n\n\t\tconst renderIcon = (name?: string): React.ReactElement => {\n\t\t\t// SLDS has no `slds-button__icon_xx-small`; xx-small only sizes the container.\n\t\t\tconst computedIconSize =\n\t\t\t\t!iconSize || iconVariant || iconSize === 'xx-small'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: iconSize;\n\t\t\treturn (\n\t\t\t\t<ButtonIcon\n\t\t\t\t\tcategory={iconCategory || 'utility'}\n\t\t\t\t\tclassName={iconClassName as string}\n\t\t\t\t\thint={hint}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\tname={name}\n\t\t\t\t\tpath={iconPath}\n\t\t\t\t\tposition={iconPosition}\n\t\t\t\t\tsize={computedIconSize}\n\t\t\t\t/>\n\t\t\t);\n\t\t};\n\n\t\tconst renderLabel = (): ReactNode => {\n\t\t\tconst iconOnly = iconName || iconPath;\n\t\t\tconst assistiveTextIcon = {\n\t\t\t\t...defaultAssistiveText,\n\t\t\t\t...assistiveText,\n\t\t\t}.icon;\n\n\t\t\treturn iconOnly && assistiveTextIcon ? (\n\t\t\t\t<span className=\"slds-assistive-text\">{assistiveTextIcon}</span>\n\t\t\t) : (\n\t\t\t\tlabel\n\t\t\t);\n\t\t};\n\n\t\tconst renderButton = (): React.ReactElement => {\n\t\t\tconst ariaProps = getAriaProps(restProps);\n\t\t\tconst dataProps = getDataProps(restProps);\n\t\t\tconst formProps = getFormProps(restProps);\n\n\t\t\treturn (\n\t\t\t\t<button\n\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tid={id}\n\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonKeyDown={onKeyDown}\n\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\tonKeyPress={onKeyPress}\n\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\t\tonMouseLeave={onMouseLeave}\n\t\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\tinternalRef.current = node;\n\t\t\t\t\t\tif (typeof ref === 'function') {\n\t\t\t\t\t\t\tref(node);\n\t\t\t\t\t\t} else if (ref) {\n\t\t\t\t\t\t\tref.current = node;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (buttonRef) {\n\t\t\t\t\t\t\tbuttonRef(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttabIndex={\n\t\t\t\t\t\ttypeof tabIndex === 'string' ? parseInt(tabIndex, 10) : tabIndex\n\t\t\t\t\t}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\ttype={type}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t{...restProps}\n\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...formProps}\n\t\t\t\t>\n\t\t\t\t\t{iconPosition === 'right' ? renderLabel() : null}\n\t\t\t\t\t{iconName || iconPath ? renderIcon(iconName) : null}\n\t\t\t\t\t{iconVariant === 'more' ? (\n\t\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tname=\"down\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\tclassName={iconClassName as string}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{iconPosition === 'left' || !iconPosition ? renderLabel() : null}\n\t\t\t\t\t{children}\n\t\t\t\t</button>\n\t\t\t);\n\t\t};\n\n\t\treturn renderButton();\n\t}\n);\n\nButton.displayName = BUTTON;\n\nexport default Button;\n"],"mappings":";;;;;;;;;;;AAwMA,IAAM,IAA4C,EAAE,MAAM,GAAG,GASvD,IAAS,GACb,GAAoB,MAAyC;CAC7D,IAAM,EACL,mBAAgB,GAChB,cACA,aACA,cACA,cAAW,IACX,UAAO,IACP,iBACA,kBACA,aACA,aACA,iBACA,cAAW,UACX,gBACA,OACA,YACA,UACA,WACA,YACA,aACA,cACA,eACA,YACA,gBACA,iBACA,iBACA,cACA,mBACA,iBACA,gBAAa,IACb,UACA,aACA,UAGA,YAGA,kBAAkB,IAClB,MAAM,GACN,aAAU,WACV,GAAG,MACA,GAIE,IAAO,MAAa,EAAM,aAAa,WAAW;CAExD,QAAgB;EACf,EACC,GACA;GAAE;GAAY;GAAgB;GAAc;EAAQ,GACpD,CACD;CACD,GAAG;EAAC;EAAY;EAAgB;EAAc;CAAO,CAAC;CAEtD,IAAM,IAAc,EAAiC,IAAI;CAEzD,QAAgB;EACf,AAAI,KAAgB,KAAkB,EAAY,WACjD,EAAe,EAAY,OAAO;CAEpC,GAAG,CAAC,GAAc,CAAc,CAAC;CAEjC,IAAM,UAA6B;EAClC,IAAM,IAAS,MAAY,QACvB,IAAsB,GACpB,IAAW,MAAgB,QAC3B,IAAa,MAAgB,UAC7B,IAAmB,MAAgB,iBAEnC,IACJ,MA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,EAAE,IAAI;GAElD;GACD;GACC;GACP,GAAI;GACJ,GAAI;GACJ,GAAI;GACJ,GAAI;GAnCL,UAAA;IAqCE,MAAiB,UAAU,EAAY,IAAI;IAC3C,KAAY,IAAW,GAAW,CAAQ,IAAI;IAC9C,MAAgB,SAChB,kBAAC,GAAD;KACC,UAAS;KACT,MAAK;KACL,MAAK;KACL,WAAW;IACX,CAAA,IACE;IACH,MAAiB,UAAU,CAAC,IAAe,EAAY,IAAI;IAC3D;GACM;;CAEV,EAEO,CAAa;AACrB,CACD;AAEA,EAAO,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/button-stateful/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\tuseCallback,\n\tuseEffect,\n\tuseState,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype ButtonHTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\n\nimport ButtonIcon from '../icon/button-icon';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { BUTTON_STATEFUL } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Button stateful variant types\n */\nexport type ButtonStatefulVariant =\n\t| 'base'\n\t| 'neutral'\n\t| 'brand'\n\t| 'destructive'\n\t| 'icon'\n\t| 'icon-filled'\n\t| 'inverse'\n\t| 'success'\n\t| 'text';\n\n/**\n * State configuration for stateful button\n */\nexport interface ButtonStatefulState {\n\t/** Icon component or icon name */\n\ticon?: ReactNode;\n\t/** Icon name (if not using icon prop) */\n\ticonName?: string;\n\t/** Button label */\n\tlabel?: string;\n}\n\n/**\n * Assistive text for ButtonStateful\n */\nexport interface ButtonStatefulAssistiveText {\n\t/** Text for icon */\n\ticon?: string;\n}\n\n/**\n * Click event data for ButtonStateful\n */\nexport interface ButtonStatefulClickData {\n\t/** The requested next state: the inverse of the current `isActive`. */\n\tisActive: boolean;\n}\n\nexport type ButtonStatefulClickHandler = (\n\tevent: MouseEvent<HTMLButtonElement>,\n\tdata: ButtonStatefulClickData\n) => void;\n\n/**\n * `onClick` is required unless the button is `disabled`: ButtonStateful is\n * controlled, so without it clicking does nothing.\n */\nexport type ButtonStatefulClickProps =\n\t| {\n\t\t\t/**\n\t\t\t * Called on click with the requested next state in `data.isActive`. The\n\t\t\t * rendered state only changes when `isActive` is updated. Required\n\t\t\t * unless `disabled` is set.\n\t\t\t */\n\t\t\tonClick: ButtonStatefulClickHandler;\n\t }\n\t| { disabled: true; onClick?: ButtonStatefulClickHandler };\n\ninterface ButtonStatefulBaseProps extends Omit<\n\tButtonHTMLAttributes<HTMLButtonElement>,\n\t'children' | 'className' | 'disabled' | 'onClick' | 'tabIndex' | 'type'\n> {\n\t/**\n\t * Whether the button is in its selected state. ButtonStateful is\n\t * controlled: update this prop from `onClick`, which reports the requested\n\t * next value in `data.isActive`.\n\t */\n\tisActive: boolean;\n\t/** @deprecated Use `isActive` instead. */\n\tactive?: boolean;\n\t/** Assistive text */\n\tassistiveText?: ButtonStatefulAssistiveText;\n\t/** CSS classes */\n\tclassName?: string;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Icon component */\n\ticon?: ReactNode;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Icon size */\n\ticonSize?: string;\n\t/** HTML id */\n\tid?: string;\n\t/** Blur handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/**\n\t * @deprecated `keypress` is a deprecated DOM event. Use `onKeyDown` and read\n\t * `event.key` instead. Still works, and warns.\n\t */\n\tonKeyPress?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Key up handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Stretches the button to the full width of its container (`slds-button_stretch`) */\n\tresponsive?: boolean;\n\t/** Initial/unselected state */\n\tstateOne?: ButtonStatefulState;\n\t/** Selected state */\n\tstateTwo?: ButtonStatefulState;\n\t/** Deselect/hover state */\n\tstateThree?: ButtonStatefulState;\n\t/** Tab index */\n\ttabIndex?: number;\n\t/** Button variant. `text` renders a stateful button with no border or background. */\n\tvariant?: ButtonStatefulVariant;\n}\n\n/**\n * Props for the ButtonStateful component\n */\nexport type ButtonStatefulProps = ButtonStatefulBaseProps &\n\tButtonStatefulClickProps;\n\nconst defaultAssistiveText: ButtonStatefulAssistiveText = { icon: '' };\n\nconst defaultStateOne: ButtonStatefulState = {\n\ticonName: 'add',\n\tlabel: 'Follow',\n};\nconst defaultStateTwo: ButtonStatefulState = {\n\ticonName: 'check',\n\tlabel: 'Following',\n};\nconst defaultStateThree: ButtonStatefulState = {\n\ticonName: 'close',\n\tlabel: 'Unfollow',\n};\n\n/**\n * The ButtonStateful component is a variant of the Lightning Design System Button component.\n * It is used for buttons that have a state of unselected or selected.\n */\nconst ButtonStateful = ({\n\tisActive: isActiveProp,\n\tactive,\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdisabled = false,\n\ticon,\n\ticonName,\n\ticonSize = 'medium',\n\tid,\n\tonBlur,\n\tonClick,\n\tonFocus,\n\tonKeyDown,\n\tonKeyPress,\n\tonKeyUp,\n\tonMouseDown,\n\tonMouseEnter,\n\tresponsive = false,\n\tstateOne = defaultStateOne,\n\tstateTwo = defaultStateTwo,\n\tstateThree = defaultStateThree,\n\ttabIndex,\n\tvariant,\n\t// Injected by `ButtonGroup` into its last child; keep it off the DOM.\n\ttriggerClassName: _triggerClassName,\n\t...rest\n}: ButtonStatefulProps & {\n\ttriggerClassName?: unknown;\n}): React.ReactElement => {\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tBUTTON_STATEFUL,\n\t\t\t{ active, disabled, onClick, onKeyPress },\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\t// `active` is the deprecated name; `isActive` wins when both are passed.\n\tconst isActive = !!(isActiveProp ?? active);\n\n\t// SLDS shows the hover/focus text (\"Unfollow\") on a focused selected button.\n\t// After a mouse click that would show the opposite of what was just chosen,\n\t// so mark the click with `slds-is-selected-clicked` until focus leaves.\n\t// Keyboard clicks (`detail === 0`) keep the focus text.\n\tconst [isClicked, setIsClicked] = useState(false);\n\n\tconst getClassName = useCallback(\n\t\t(active: boolean) =>\n\t\t\tclassNames(className, 'slds-button', 'slds-button_stateful', {\n\t\t\t\t'slds-button_neutral':\n\t\t\t\t\tvariant !== 'icon' &&\n\t\t\t\t\tvariant !== 'icon-filled' &&\n\t\t\t\t\tvariant !== 'success' &&\n\t\t\t\t\tvariant !== 'text',\n\t\t\t\t'slds-button_inverse': variant === 'inverse',\n\t\t\t\t'slds-button_success': variant === 'success',\n\t\t\t\t'slds-not-selected': !active,\n\t\t\t\t// SLDS uses one or the other: `:focus` on `slds-is-selected` would win\n\t\t\t\t'slds-is-selected': active && !isClicked,\n\t\t\t\t'slds-is-selected-clicked': active && isClicked,\n\t\t\t\t'slds-button_stretch': responsive,\n\t\t\t\t'slds-button_icon-border': variant === 'icon',\n\t\t\t\t'slds-button_icon-border-filled': variant === 'icon-filled',\n\t\t\t}),\n\t\t[className, variant, responsive, isClicked]\n\t);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLButtonElement>) => {\n\t\t\tsetIsClicked(e.detail > 0);\n\t\t\tonClick?.(e, { isActive: !isActive });\n\t\t},\n\t\t[onClick, isActive]\n\t);\n\n\tconst handleBlur = useCallback(\n\t\t(e: FocusEvent<HTMLButtonElement>) => {\n\t\t\tsetIsClicked(false);\n\t\t\tonBlur?.(e);\n\t\t},\n\t\t[onBlur]\n\t);\n\n\tconst defaultIconProps = {\n\t\tdisabled,\n\t\tsize: 'small' as const,\n\t\tclassName: 'slds-button__icon_stateful',\n\t};\n\n\tconst iconAssistiveText = { ...defaultAssistiveText, ...propAssistiveText }\n\t\t.icon;\n\n\t// Accept aria-* props\n\tlet ariaProps = getAriaProps(rest);\n\n\tif (variant === 'icon' || variant === 'icon-filled') {\n\t\tif (Object.keys(ariaProps).length === 0) {\n\t\t\tariaProps = { 'aria-live': 'polite' as const };\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...rest}\n\t\t\t\t{...ariaProps}\n\t\t\t\tclassName={getClassName(isActive)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={id}\n\t\t\t\tonBlur={handleBlur}\n\t\t\t\tonClick={handleClick}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t// eslint-disable-next-line local/no-deprecated -- forwards the deprecated `onKeyPress` prop until 11.0\n\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\ticon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconProps,\n\t\t\t\t\t\t\t...((icon as React.ReactElement<Record<string, unknown>>).props ||\n\t\t\t\t\t\t\t\t{}),\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={iconName}\n\t\t\t\t\t\tsize={iconSize as 'x-small' | 'small' | 'medium' | 'large'}\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{iconAssistiveText ? (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{iconAssistiveText}</span>\n\t\t\t\t) : null}\n\t\t\t</button>\n\t\t);\n\t}\n\n\tconst defaultIconPropsWithPosition = {\n\t\t...defaultIconProps,\n\t\tposition: 'left' as const,\n\t};\n\n\tif (Object.keys(ariaProps).length === 0) {\n\t\tariaProps = { 'aria-live': 'assertive' as const };\n\t}\n\n\treturn (\n\t\t<button\n\t\t\t{...rest}\n\t\t\t{...ariaProps}\n\t\t\tclassName={getClassName(isActive)}\n\t\t\tdisabled={disabled}\n\t\t\tid={id}\n\t\t\tonBlur={handleBlur}\n\t\t\tonClick={handleClick}\n\t\t\tonFocus={onFocus}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\t// eslint-disable-next-line local/no-deprecated -- forwards the deprecated `onKeyPress` prop until 11.0\n\t\t\tonKeyPress={onKeyPress}\n\t\t\tonKeyUp={onKeyUp}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\ttabIndex={tabIndex}\n\t\t\ttype=\"button\"\n\t\t>\n\t\t\t<span className=\"slds-text-not-selected\">\n\t\t\t\t{stateOne.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateOne.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateOne.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={stateOne.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateOne.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected\">\n\t\t\t\t{stateTwo.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateTwo.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateTwo.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={stateTwo.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateTwo.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected-focus\">\n\t\t\t\t{stateThree.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((\n\t\t\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>\n\t\t\t\t\t\t\t).props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={stateThree.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateThree.label}\n\t\t\t</span>\n\t\t</button>\n\t);\n};\n\nButtonStateful.displayName = BUTTON_STATEFUL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,EAAS;KACf,MAAK;KACL,UAAS;KACT,WAAU;IACV,CAAA,GAED,EAAS,KACL;;GACN,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,EAAW,OACX,EAAM,aACL,EAAW,MACX;KACC,GAAG;KACH,GACC,EAAW,KACV,SAAS,CAAC;KACZ,MAAM;IACP,CACD,IAEA,kBAAC,GAAD;KACC,MAAM,EAAW;KACjB,MAAK;KACL,UAAS;KACT,WAAU;IACV,CAAA,GAED,EAAW,KACP;;EACC;;AAEV;AAEA,EAAe,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/button-stateful/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\tuseCallback,\n\tuseEffect,\n\tuseState,\n\ttype ReactNode,\n\ttype MouseEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype ButtonHTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\n\nimport ButtonIcon from '../icon/button-icon';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { BUTTON_STATEFUL } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Button stateful variant types\n */\nexport type ButtonStatefulVariant =\n\t| 'base'\n\t| 'neutral'\n\t| 'brand'\n\t| 'destructive'\n\t| 'icon'\n\t| 'icon-filled'\n\t| 'inverse'\n\t| 'success'\n\t| 'text';\n\n/**\n * State configuration for stateful button\n */\nexport interface ButtonStatefulState {\n\t/** Icon component or icon name */\n\ticon?: ReactNode;\n\t/** Icon name (if not using icon prop) */\n\ticonName?: string;\n\t/** Button label */\n\tlabel?: string;\n}\n\n/**\n * Assistive text for ButtonStateful\n */\nexport interface ButtonStatefulAssistiveText {\n\t/** Text for icon */\n\ticon?: string;\n}\n\n/**\n * Click event data for ButtonStateful\n */\nexport interface ButtonStatefulClickData {\n\t/** The requested next state: the inverse of the current `isActive`. */\n\tisActive: boolean;\n}\n\nexport type ButtonStatefulClickHandler = (\n\tevent: MouseEvent<HTMLButtonElement>,\n\tdata: ButtonStatefulClickData\n) => void;\n\n/**\n * `onClick` is required unless the button is `disabled`: ButtonStateful is\n * controlled, so without it clicking does nothing.\n */\nexport type ButtonStatefulClickProps =\n\t| {\n\t\t\t/**\n\t\t\t * Called on click with the requested next state in `data.isActive`. The\n\t\t\t * rendered state only changes when `isActive` is updated. Required\n\t\t\t * unless `disabled` is set.\n\t\t\t */\n\t\t\tonClick: ButtonStatefulClickHandler;\n\t }\n\t| {\n\t\t\t/** Disables the button. */\n\t\t\tdisabled: true;\n\t\t\t/** Called on click. Optional while disabled. */\n\t\t\tonClick?: ButtonStatefulClickHandler;\n\t };\n\ninterface ButtonStatefulBaseProps extends Omit<\n\tButtonHTMLAttributes<HTMLButtonElement>,\n\t'children' | 'className' | 'disabled' | 'onClick' | 'tabIndex' | 'type'\n> {\n\t/**\n\t * Whether the button is in its selected state. ButtonStateful is\n\t * controlled: update this prop from `onClick`, which reports the requested\n\t * next value in `data.isActive`.\n\t */\n\tisActive: boolean;\n\t/** @deprecated Use `isActive` instead. */\n\tactive?: boolean;\n\t/** Assistive text */\n\tassistiveText?: ButtonStatefulAssistiveText;\n\t/** CSS classes */\n\tclassName?: string;\n\t/** Disabled state */\n\tdisabled?: boolean;\n\t/** Icon component */\n\ticon?: ReactNode;\n\t/** Icon name */\n\ticonName?: string;\n\t/** Icon size */\n\ticonSize?: string;\n\t/** HTML id */\n\tid?: string;\n\t/** Blur handler */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Focus handler */\n\tonFocus?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/** Key down handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => 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<HTMLButtonElement>) => void;\n\t/** Key up handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n\t/** Mouse down handler */\n\tonMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Mouse enter handler */\n\tonMouseEnter?: (event: MouseEvent<HTMLButtonElement>) => void;\n\t/** Stretches the button to the full width of its container (`slds-button_stretch`) */\n\tresponsive?: boolean;\n\t/** Initial/unselected state */\n\tstateOne?: ButtonStatefulState;\n\t/** Selected state */\n\tstateTwo?: ButtonStatefulState;\n\t/** Deselect/hover state */\n\tstateThree?: ButtonStatefulState;\n\t/** Tab index */\n\ttabIndex?: number;\n\t/** Button variant. `text` renders a stateful button with no border or background. */\n\tvariant?: ButtonStatefulVariant;\n}\n\n/**\n * Props for the ButtonStateful component\n */\nexport type ButtonStatefulProps = ButtonStatefulBaseProps &\n\tButtonStatefulClickProps;\n\nconst defaultAssistiveText: ButtonStatefulAssistiveText = { icon: '' };\n\nconst defaultStateOne: ButtonStatefulState = {\n\ticonName: 'add',\n\tlabel: 'Follow',\n};\nconst defaultStateTwo: ButtonStatefulState = {\n\ticonName: 'check',\n\tlabel: 'Following',\n};\nconst defaultStateThree: ButtonStatefulState = {\n\ticonName: 'close',\n\tlabel: 'Unfollow',\n};\n\n/**\n * The ButtonStateful component is a variant of the Lightning Design System Button component.\n * It is used for buttons that have a state of unselected or selected.\n */\nconst ButtonStateful = ({\n\tisActive: isActiveProp,\n\tactive,\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdisabled = false,\n\ticon,\n\ticonName,\n\ticonSize = 'medium',\n\tid,\n\tonBlur,\n\tonClick,\n\tonFocus,\n\tonKeyDown,\n\tonKeyPress,\n\tonKeyUp,\n\tonMouseDown,\n\tonMouseEnter,\n\tresponsive = false,\n\tstateOne = defaultStateOne,\n\tstateTwo = defaultStateTwo,\n\tstateThree = defaultStateThree,\n\ttabIndex,\n\tvariant,\n\t// Injected by `ButtonGroup` into its last child; keep it off the DOM.\n\ttriggerClassName: _triggerClassName,\n\t...rest\n}: ButtonStatefulProps & {\n\t/** Set by `ButtonGroup` on its last child. Ignored. */\n\ttriggerClassName?: unknown;\n}): React.ReactElement => {\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tBUTTON_STATEFUL,\n\t\t\t{ active, disabled, onClick, onKeyPress },\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\t// `active` is the deprecated name; `isActive` wins when both are passed.\n\tconst isActive = !!(isActiveProp ?? active);\n\n\t// SLDS shows the hover/focus text (\"Unfollow\") on a focused selected button.\n\t// After a mouse click that would show the opposite of what was just chosen,\n\t// so mark the click with `slds-is-selected-clicked` until focus leaves.\n\t// Keyboard clicks (`detail === 0`) keep the focus text.\n\tconst [isClicked, setIsClicked] = useState(false);\n\n\tconst getClassName = useCallback(\n\t\t(active: boolean) =>\n\t\t\tclassNames(className, 'slds-button', 'slds-button_stateful', {\n\t\t\t\t'slds-button_neutral':\n\t\t\t\t\tvariant !== 'icon' &&\n\t\t\t\t\tvariant !== 'icon-filled' &&\n\t\t\t\t\tvariant !== 'success' &&\n\t\t\t\t\tvariant !== 'text',\n\t\t\t\t'slds-button_inverse': variant === 'inverse',\n\t\t\t\t'slds-button_success': variant === 'success',\n\t\t\t\t'slds-not-selected': !active,\n\t\t\t\t// SLDS uses one or the other: `:focus` on `slds-is-selected` would win\n\t\t\t\t'slds-is-selected': active && !isClicked,\n\t\t\t\t'slds-is-selected-clicked': active && isClicked,\n\t\t\t\t'slds-button_stretch': responsive,\n\t\t\t\t'slds-button_icon-border': variant === 'icon',\n\t\t\t\t'slds-button_icon-border-filled': variant === 'icon-filled',\n\t\t\t}),\n\t\t[className, variant, responsive, isClicked]\n\t);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLButtonElement>) => {\n\t\t\tsetIsClicked(e.detail > 0);\n\t\t\tonClick?.(e, { isActive: !isActive });\n\t\t},\n\t\t[onClick, isActive]\n\t);\n\n\tconst handleBlur = useCallback(\n\t\t(e: FocusEvent<HTMLButtonElement>) => {\n\t\t\tsetIsClicked(false);\n\t\t\tonBlur?.(e);\n\t\t},\n\t\t[onBlur]\n\t);\n\n\tconst defaultIconProps = {\n\t\tdisabled,\n\t\tsize: 'small' as const,\n\t\tclassName: 'slds-button__icon_stateful',\n\t};\n\n\tconst iconAssistiveText = { ...defaultAssistiveText, ...propAssistiveText }\n\t\t.icon;\n\n\t// Accept aria-* props\n\tlet ariaProps = getAriaProps(rest);\n\n\tif (variant === 'icon' || variant === 'icon-filled') {\n\t\tif (Object.keys(ariaProps).length === 0) {\n\t\t\tariaProps = { 'aria-live': 'polite' as const };\n\t\t}\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...rest}\n\t\t\t\t{...ariaProps}\n\t\t\t\tclassName={getClassName(isActive)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={id}\n\t\t\t\tonBlur={handleBlur}\n\t\t\t\tonClick={handleClick}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t// eslint-disable-next-line local/no-deprecated -- forwards the deprecated `onKeyPress` prop until 11.0\n\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\tonMouseEnter={onMouseEnter}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\ttype=\"button\"\n\t\t\t>\n\t\t\t\t{icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\ticon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconProps,\n\t\t\t\t\t\t\t...((icon as React.ReactElement<Record<string, unknown>>).props ||\n\t\t\t\t\t\t\t\t{}),\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={iconName}\n\t\t\t\t\t\tsize={iconSize as 'x-small' | 'small' | 'medium' | 'large'}\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{iconAssistiveText ? (\n\t\t\t\t\t<span className=\"slds-assistive-text\">{iconAssistiveText}</span>\n\t\t\t\t) : null}\n\t\t\t</button>\n\t\t);\n\t}\n\n\tconst defaultIconPropsWithPosition = {\n\t\t...defaultIconProps,\n\t\tposition: 'left' as const,\n\t};\n\n\tif (Object.keys(ariaProps).length === 0) {\n\t\tariaProps = { 'aria-live': 'assertive' as const };\n\t}\n\n\treturn (\n\t\t<button\n\t\t\t{...rest}\n\t\t\t{...ariaProps}\n\t\t\tclassName={getClassName(isActive)}\n\t\t\tdisabled={disabled}\n\t\t\tid={id}\n\t\t\tonBlur={handleBlur}\n\t\t\tonClick={handleClick}\n\t\t\tonFocus={onFocus}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\t// eslint-disable-next-line local/no-deprecated -- forwards the deprecated `onKeyPress` prop until 11.0\n\t\t\tonKeyPress={onKeyPress}\n\t\t\tonKeyUp={onKeyUp}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\ttabIndex={tabIndex}\n\t\t\ttype=\"button\"\n\t\t>\n\t\t\t<span className=\"slds-text-not-selected\">\n\t\t\t\t{stateOne.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateOne.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateOne.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={stateOne.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateOne.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected\">\n\t\t\t\t{stateTwo.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateTwo.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((stateTwo.icon as React.ReactElement<Record<string, unknown>>)\n\t\t\t\t\t\t\t\t.props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={stateTwo.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateTwo.label}\n\t\t\t</span>\n\t\t\t<span className=\"slds-text-selected-focus\">\n\t\t\t\t{stateThree.icon ? (\n\t\t\t\t\tReact.cloneElement(\n\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...defaultIconPropsWithPosition,\n\t\t\t\t\t\t\t...((\n\t\t\t\t\t\t\t\tstateThree.icon as React.ReactElement<Record<string, unknown>>\n\t\t\t\t\t\t\t).props || {}),\n\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\tname={stateThree.iconName}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tposition=\"left\"\n\t\t\t\t\t\tclassName=\"slds-button__icon_stateful\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{stateThree.label}\n\t\t\t</span>\n\t\t</button>\n\t);\n};\n\nButtonStateful.displayName = BUTTON_STATEFUL;\n\nexport default ButtonStateful;\n"],"mappings":";;;;;;;;;AAuJA,IAAM,IAAoD,EAAE,MAAM,GAAG,GAE/D,IAAuC;CAC5C,UAAU;CACV,OAAO;AACR,GACM,IAAuC;CAC5C,UAAU;CACV,OAAO;AACR,GACM,IAAyC;CAC9C,UAAU;CACV,OAAO;AACR,GAMM,KAAkB,EACvB,UAAU,GACV,WACA,eAAe,GACf,cACA,cAAW,IACX,SACA,aACA,cAAW,UACX,OACA,WACA,YACA,YACA,cACA,eACA,YACA,gBACA,iBACA,gBAAa,IACb,cAAW,GACX,cAAW,GACX,gBAAa,GACb,aACA,YAEA,kBAAkB,GAClB,GAAG,QAIsB;CACzB,QAAgB;EACf,EACC,GACA;GAAE;GAAQ;GAAU;GAAS;EAAW,GACxC,CACD;CACD,CAAC;CAGD,IAAM,IAAW,CAAC,EAAE,KAAgB,IAM9B,CAAC,GAAW,KAAgB,EAAS,EAAK,GAE1C,IAAe,GACnB,MACA,EAAW,GAAW,eAAe,wBAAwB;EAC5D,uBACC,MAAY,UACZ,MAAY,iBACZ,MAAY,aACZ,MAAY;EACb,uBAAuB,MAAY;EACnC,uBAAuB,MAAY;EACnC,qBAAqB,CAAC;EAEtB,oBAAoB,KAAU,CAAC;EAC/B,4BAA4B,KAAU;EACtC,uBAAuB;EACvB,2BAA2B,MAAY;EACvC,kCAAkC,MAAY;CAC/C,CAAC,GACF;EAAC;EAAW;EAAS;EAAY;CAAS,CAC3C,GAEM,IAAc,GAClB,MAAqC;EAErC,AADA,EAAa,EAAE,SAAS,CAAC,GACzB,IAAU,GAAG,EAAE,UAAU,CAAC,EAAS,CAAC;CACrC,GACA,CAAC,GAAS,CAAQ,CACnB,GAEM,IAAa,GACjB,MAAqC;EAErC,AADA,EAAa,EAAK,GAClB,IAAS,CAAC;CACX,GACA,CAAC,CAAM,C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T;KACC,GAAG;KACH,GAAK,EAAS,KACZ,SAAS,CAAC;KACZ,MAAM;IACP,CACD,IAEA,kBAAC,GAAD;KACC,MAAM,EAAS;KACf,MAAK;KACL,UAAS;KACT,WAAU;IACV,CAAA,GAED,EAAS,KACL;;GACN,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,EAAW,OACX,EAAM,aACL,EAAW,MACX;KACC,GAAG;KACH,GACC,EAAW,KACV,SAAS,CAAC;KACZ,MAAM;IACP,CACD,IAEA,kBAAC,GAAD;KACC,MAAM,EAAW;KACjB,MAAK;KACL,UAAS;KACT,WAAU;IACV,CAAA,GAED,EAAW,KACP;;EACC;;AAEV;AAEA,EAAe,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/checkbox/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\tuseRef,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { CHECKBOX } from '../../utilities/constants';\nimport Icon from '../icon/index';\nimport { checkDeprecatedProps, checkRequiredProps } from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Checkbox variant types\n */\nexport type CheckboxVariant =\n\t'base' | 'toggle' | 'button-group' | 'visual-picker';\n\n/**\n * Checkbox size for visual picker\n */\nexport type CheckboxSize = 'medium' | 'large';\n\n/**\n * Assistive text for Checkbox\n */\nexport interface CheckboxAssistiveText {\n\theading?: string;\n\tlabel?: string;\n}\n\n/**\n * Labels for Checkbox\n */\nexport interface CheckboxLabels {\n\theading?: string;\n\tlabel?: string;\n\ttoggleDisabled?: string;\n\ttoggleEnabled?: string;\n}\n\n/**\n * Change event data\n */\nexport interface CheckboxChangeData {\n\tchecked: boolean;\n\tindeterminate: boolean;\n}\n\n/**\n * Called when the user toggles the checkbox, with the requested next state in\n * `data`. The rendered state only changes when `checked`/`indeterminate` are\n * updated.\n */\nexport type CheckboxChangeHandler = (\n\tevent: ChangeEvent<HTMLInputElement>,\n\tdata: CheckboxChangeData\n) => void;\n\n/**\n * Checkbox is controlled, so `onChange` is required unless the checkbox is\n * `disabled` or `readOnly`: without it, clicking the checkbox does nothing.\n */\nexport type CheckboxChangeProps =\n\t| {\n\t\t\t/**\n\t\t\t * Called when the user toggles the checkbox, with the requested next state\n\t\t\t * in `data`. The rendered state only changes when `checked`/`indeterminate`\n\t\t\t * are updated. Required unless `disabled` or `readOnly` is set.\n\t\t\t */\n\t\t\tonChange: CheckboxChangeHandler;\n\t }\n\t| { disabled: true; onChange?: CheckboxChangeHandler }\n\t| { readOnly: true; onChange?: CheckboxChangeHandler };\n\ninterface CheckboxCommonProps {\n\t/** aria-controls for related regions */\n\t'aria-controls'?: string;\n\t/** aria-describedby for descriptions */\n\t'aria-describedby'?: string;\n\t/** aria-labelledby for labels */\n\t'aria-labelledby'?: string;\n\t/** aria-owns for owned elements */\n\t'aria-owns'?: string;\n\t/** aria-required for validation */\n\t'aria-required'?: boolean;\n\t/** Assistive text for accessibility */\n\tassistiveText?: CheckboxAssistiveText;\n\t/**\n\t * Whether the checkbox is checked. Checkbox is controlled: update this prop\n\t * from `onChange`, which reports the requested value in `data.checked`.\n\t */\n\tchecked: boolean;\n\t/** Disable the checkbox */\n\tdisabled?: boolean;\n\t/** Unique ID */\n\tid?: string;\n\t/** Text labels */\n\tlabels?: CheckboxLabels;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/**\n\t * @deprecated `keypress` is a deprecated DOM event. Use `onKeyDown` and read\n\t * `event.key` instead. Still works, and warns.\n\t */\n\tonKeyPress?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/**\n\t * @deprecated Focus the checkbox through `ref`, which is forwarded to the `<input>`.\n\t * Called with the `<input>` when `requestFocus` is set. Still works, and warns.\n\t */\n\tonRequestFocus?: (element: HTMLInputElement) => void;\n\t/**\n\t * Shows the checked state without letting the user change it. The checkbox stays focusable\n\t * and is announced as read-only; clicks and Space do not toggle it or call `onChange`.\n\t */\n\treadOnly?: boolean;\n\t/**\n\t * @deprecated Focus the checkbox through `ref`, which is forwarded to the `<input>`.\n\t * Still works, and warns.\n\t */\n\trequestFocus?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** Label ID for label element */\n\tlabelId?: string;\n}\n\n/** Props of the standalone `base` and `toggle` checkboxes (not the picker variants). */\ninterface CheckboxFieldProps {\n\t/** CSS class for container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Error message */\n\terrorText?: string;\n\t/** Mark as required */\n\trequired?: boolean;\n\t/** Tab index */\n\ttabIndex?: number;\n}\n\n/** Props only the visual picker takes. */\ninterface CheckboxVisualPickerProps {\n\t/** Coverable visual picker */\n\tcoverable?: boolean;\n\t/** Vertical visual picker */\n\tvertical?: boolean;\n\t/** Visual picker figure content, rendered inside `.slds-visual-picker__figure` when not `coverable` */\n\tvisualPickerFigure?: ReactNode;\n\t/** Coverable visual picker figure content shown when selected */\n\tvisualPickerFigureSelected?: ReactNode;\n\t/** Coverable visual picker figure content shown when not selected */\n\tvisualPickerFigureNotSelected?: ReactNode;\n\t/** @deprecated Use `visualPickerFigure` instead. */\n\tonRenderVisualPicker?: () => ReactNode;\n\t/** @deprecated Use `visualPickerFigureSelected` instead. */\n\tonRenderVisualPickerSelected?: () => ReactNode;\n\t/** @deprecated Use `visualPickerFigureNotSelected` instead. */\n\tonRenderVisualPickerNotSelected?: () => ReactNode;\n\t/** Size for visual picker */\n\tsize?: CheckboxSize;\n}\n\n/** The plain checkbox, and the default. Supports every field prop. */\ninterface CheckboxBaseVariantProps\n\textends CheckboxCommonProps, CheckboxFieldProps {\n\t/** Checkbox variant */\n\tvariant?: 'base';\n\t/**\n\t * Indeterminate state (partial selection). Controlled: it is applied to the\n\t * DOM node on every change and cleared when this prop is `false` or\n\t * `undefined`. Clicking an indeterminate checkbox reports\n\t * `{ checked: true, indeterminate: false }`.\n\t */\n\tindeterminate?: boolean;\n}\n\n/** A toggle switch. A toggle is on or off, so there is no `indeterminate`. */\ninterface CheckboxToggleVariantProps\n\textends CheckboxCommonProps, CheckboxFieldProps {\n\t/** Checkbox variant */\n\tvariant: 'toggle';\n\tindeterminate?: never;\n}\n\n/**\n * A button inside a `ButtonGroup`. The group owns the container, error text and\n * tab order, so `className`, `errorText`, `required` and `tabIndex` are not accepted.\n */\ninterface CheckboxButtonGroupVariantProps extends CheckboxCommonProps {\n\t/** Checkbox variant */\n\tvariant: 'button-group';\n\t/**\n\t * Indeterminate state (partial selection). Controlled: it is applied to the\n\t * DOM node on every change and cleared when this prop is `false` or\n\t * `undefined`. Clicking an indeterminate checkbox reports\n\t * `{ checked: true, indeterminate: false }`.\n\t */\n\tindeterminate?: boolean;\n\tclassName?: never;\n\terrorText?: never;\n\trequired?: never;\n\ttabIndex?: never;\n}\n\n/**\n * An option inside a `VisualPicker`. The picker owns the container, error text\n * and tab order, so `className`, `errorText`, `required` and `tabIndex` are not accepted.\n */\ninterface CheckboxVisualPickerVariantProps\n\textends CheckboxCommonProps, CheckboxVisualPickerProps {\n\t/** Checkbox variant */\n\tvariant: 'visual-picker';\n\t/**\n\t * Indeterminate state (partial selection). Controlled: it is applied to the\n\t * DOM node on every change and cleared when this prop is `false` or\n\t * `undefined`. Clicking an indeterminate checkbox reports\n\t * `{ checked: true, indeterminate: false }`.\n\t */\n\tindeterminate?: boolean;\n\tclassName?: never;\n\terrorText?: never;\n\trequired?: never;\n\ttabIndex?: never;\n}\n\ntype CheckboxVariantProps =\n\t| CheckboxBaseVariantProps\n\t| CheckboxToggleVariantProps\n\t| CheckboxButtonGroupVariantProps\n\t| CheckboxVisualPickerVariantProps;\n\n/**\n * Props for the Checkbox component: a union on `variant`, so a prop that a\n * variant drops is a compile error instead of being ignored.\n */\nexport type CheckboxProps = CheckboxVariantProps & CheckboxChangeProps;\n\nconst defaultLabels: CheckboxLabels = {\n\ttoggleDisabled: 'Disabled',\n\ttoggleEnabled: 'Enabled',\n};\n\n/**\n * The ability to style checkboxes with CSS varies across browsers.\n * Using this component ensures checkboxes look the same everywhere.\n */\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n\tconst {\n\t\tassistiveText: assistiveTextProp,\n\t\tchecked,\n\t\t// Removed in v11 (Checkbox is controlled). Destructured so it never\n\t\t// reaches the DOM; `checkDeprecatedProps` warns about it.\n\t\tdefaultChecked,\n\t\tclassName,\n\t\tdisabled,\n\t\terrorText,\n\t\tid: propId,\n\t\tindeterminate,\n\t\tlabels: labelsProp,\n\t\tname,\n\t\tonBlur,\n\t\tonChange,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\tonRequestFocus,\n\t\treadOnly,\n\t\trequestFocus,\n\t\trequired,\n\t\trole,\n\t\ttabIndex,\n\t\tvariant = 'base',\n\t\tcoverable,\n\t\tvertical,\n\t\tvisualPickerFigure,\n\t\tvisualPickerFigureSelected,\n\t\tvisualPickerFigureNotSelected,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t\tsize = 'medium',\n\t\tlabelId,\n\t\t...restProps\n\t} = props as CheckboxCommonProps &\n\t\tPartial<CheckboxFieldProps & CheckboxVisualPickerProps> &\n\t\tCheckboxChangeProps & {\n\t\t\tindeterminate?: boolean;\n\t\t\tvariant?: CheckboxVariant;\n\t\t} & {\n\t\t\tdefaultChecked?: boolean;\n\t\t};\n\n\tconst generatedId = useId();\n\tconst internalRef = useRef<HTMLInputElement | null>(null);\n\n\tconst getId = () => propId || generatedId;\n\tconst getErrorId = () => (errorText ? `${getId()}-error-text` : undefined);\n\n\t// Merge assistive text\n\tconst assistiveText: CheckboxAssistiveText = { ...assistiveTextProp };\n\n\t// Merge labels\n\tconst labels: CheckboxLabels = {\n\t\t...defaultLabels,\n\t\t...labelsProp,\n\t};\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tCHECKBOX,\n\t\t\t{\n\t\t\t\tdefaultChecked,\n\t\t\t\tonKeyPress,\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t\tonRequestFocus,\n\t\t\t\trequestFocus,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tdefaultChecked,\n\t\tonKeyPress,\n\t\tonRequestFocus,\n\t\trequestFocus,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t]);\n\n\tuseEffect(() => {\n\t\tcheckRequiredProps(\n\t\t\tCHECKBOX,\n\t\t\t{ disabled, onChange, readOnly },\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\t// `indeterminate` only exists as a DOM property. Apply it whenever the prop\n\t// changes, including clearing it when the prop goes back to false/undefined.\n\tuseEffect(() => {\n\t\tif (internalRef.current) {\n\t\t\tinternalRef.current.indeterminate = !!indeterminate;\n\t\t}\n\t}, [indeterminate]);\n\n\t// Handle request focus\n\tuseEffect(() => {\n\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\tonRequestFocus(internalRef.current);\n\t\t}\n\t}, [requestFocus, onRequestFocus]);\n\n\tconst getAriaDescribedBy = (idArray: string[] = []): string | undefined => {\n\t\tconst describedBy = idArray\n\t\t\t.concat(restProps['aria-describedby'] || '', getErrorId() || '')\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ');\n\t\treturn describedBy || undefined;\n\t};\n\n\tconst handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\t// Read-only: skip `onChange`, so React restores the controlled `checked`. (Calling\n\t\t// `preventDefault` on the click instead conflicts with that restore and unchecks the box.)\n\t\tif (readOnly) {\n\t\t\treturn;\n\t\t}\n\t\tonChange?.(event, {\n\t\t\tchecked: indeterminate ? true : !checked,\n\t\t\tindeterminate: false,\n\t\t});\n\t\t// A click clears the DOM `indeterminate` flag natively. React restores a\n\t\t// controlled `checked` but not this property, so put the prop value back;\n\t\t// if the parent accepts the change, the effect above applies the new one.\n\t\tif (internalRef.current) {\n\t\t\tinternalRef.current.indeterminate = !!indeterminate;\n\t\t}\n\t};\n\n\tconst ariaProps = getAriaProps(restProps);\n\n\t// Common input props\n\tconst inputProps = {\n\t\tdisabled,\n\t\tchecked: !!checked,\n\t\tid: getId(),\n\t\tname,\n\t\tonBlur,\n\t\tonChange: handleChange,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\trole,\n\t\t'aria-readonly': readOnly || undefined,\n\t\trequired,\n\t\ttype: 'checkbox' as const,\n\t\t...ariaProps,\n\t};\n\n\t// Set ref\n\tconst setRef = (node: HTMLInputElement | null) => {\n\t\tinternalRef.current = node;\n\t\tif (typeof ref === 'function') {\n\t\t\tref(node);\n\t\t} else if (ref) {\n\t\t\tref.current = node;\n\t\t}\n\t};\n\n\t// Button Group Variant\n\tif (variant === 'button-group') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-button',\n\t\t\t\t\t'slds-checkbox_button',\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label className=\"slds-checkbox_button__label\" htmlFor={getId()}>\n\t\t\t\t\t<span className=\"slds-checkbox_faux\">{labels.label}</span>\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Toggle Variant\n\tif (variant === 'toggle') {\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'is-required': required,\n\t\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t\t},\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<label className=\"slds-checkbox_toggle slds-grid\" htmlFor={getId()}>\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t<span className=\"slds-form-element__label slds-m-bottom_none\">\n\t\t\t\t\t\t\t{labels.label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy([`${getId()}-desc`])}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={`${getId()}-desc`}\n\t\t\t\t\t\tclassName=\"slds-checkbox_faux_container\"\n\t\t\t\t\t\taria-live=\"assertive\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t<span className=\"slds-checkbox_on\">{labels.toggleEnabled}</span>\n\t\t\t\t\t\t<span className=\"slds-checkbox_off\">{labels.toggleDisabled}</span>\n\t\t\t\t\t</span>\n\t\t\t\t</label>\n\t\t\t\t{errorText && (\n\t\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t\t{errorText}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Visual Picker Variant\n\tif (variant === 'visual-picker') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-visual-picker',\n\t\t\t\t\t`slds-visual-picker_${size}`,\n\t\t\t\t\tvertical && 'slds-visual-picker_vertical',\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label htmlFor={getId()}>\n\t\t\t\t\t{coverable ? (\n\t\t\t\t\t\t<div className=\"slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center\">\n\t\t\t\t\t\t\t<span className=\"slds-is-selected\">\n\t\t\t\t\t\t\t\t{visualPickerFigureSelected ?? onRenderVisualPickerSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"slds-is-not-selected\">\n\t\t\t\t\t\t\t\t{visualPickerFigureNotSelected ??\n\t\t\t\t\t\t\t\t\tonRenderVisualPickerNotSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center\">\n\t\t\t\t\t\t\t{visualPickerFigure ?? onRenderVisualPicker?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!vertical && (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__body\">\n\t\t\t\t\t\t\t{labels.heading && (\n\t\t\t\t\t\t\t\t<span className=\"slds-text-heading_small\">\n\t\t\t\t\t\t\t\t\t{labels.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<span className=\"slds-text-title\">{labels.label}</span>\n\t\t\t\t\t\t\t{(assistiveText.label || assistiveText.heading) && (\n\t\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t\t{assistiveText.label || assistiveText.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!coverable && (\n\t\t\t\t\t\t<span className=\"slds-icon_container slds-visual-picker__text-check\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\tname=\"check\"\n\t\t\t\t\t\t\t\tcolorVariant=\"base\"\n\t\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Base Variant (default)\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-form-element',\n\t\t\t\t{\n\t\t\t\t\t'is-required': required,\n\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t<span className=\"slds-checkbox\">\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\ttabIndex={tabIndex}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t\t/>\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName=\"slds-checkbox__label\"\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t\tid={labelId}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t\t<span className=\"slds-form-element__label\">{labels.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</label>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t{errorText && (\n\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t{errorText}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n});\n\nCheckbox.displayName = CHECKBOX;\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;AA4PA,IAAM,KAAgC;CACrC,gBAAgB;CAChB,eAAe;AAChB,GAMM,IAAW,GAA6C,GAAO,MAAQ;CAC5E,IAAM,EACL,eAAe,GACf,YAGA,mBACA,cACA,aACA,cACA,IAAI,GACJ,kBACA,QAAQ,GACR,SACA,WACA,aACA,YACA,cACA,eACA,YACA,mBACA,aACA,iBACA,aACA,UACA,cACA,aAAU,QACV,cACA,aACA,uBACA,+BACA,kCACA,yBACA,iCACA,oCACA,UAAO,UACP,YACA,GAAG,MACA,GASE,IAAc,EAAM,GACpB,IAAc,EAAgC,IAAI,GAElD,UAAc,KAAU,GACxB,UAAoB,IAAY,GAAG,EAAM,EAAE,eAAe,KAAA,GAG1D,IAAuC,EAAE,GAAG,EAAkB,GAG9D,IAAyB;EAC9B,GAAG;EACH,GAAG;CACJ;CA2CA,AAzCA,QAAgB;EACf,EACC,GACA;GACC;GACA;GACA;GACA;GACA;GACA;GACA;EACD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Ac;OAAY,CAAA;MAE5D;;IACF;;EACF,CAAA,GACJ,KACA,kBAAC,OAAD;GAAK,WAAU;GAA0B,IAAI,EAAW;GACtD,UAAA;EACG,CAAA,CAEF;;AAEP,CAAC;AAED,EAAS,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/checkbox/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\tuseRef,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { CHECKBOX } from '../../utilities/constants';\nimport Icon from '../icon/index';\nimport { checkDeprecatedProps, checkRequiredProps } from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Checkbox variant types\n */\nexport type CheckboxVariant =\n\t'base' | 'toggle' | 'button-group' | 'visual-picker';\n\n/**\n * Checkbox size for visual picker\n */\nexport type CheckboxSize = 'medium' | 'large';\n\n/**\n * Assistive text for Checkbox\n */\nexport interface CheckboxAssistiveText {\n\t/** Visually hidden heading of the `visual-picker` variant, read when `label` is unset. */\n\theading?: string;\n\t/** Visually hidden label, for a checkbox without a visible `labels.label`. */\n\tlabel?: string;\n}\n\n/**\n * Labels for Checkbox\n */\nexport interface CheckboxLabels {\n\t/** Heading of the `visual-picker` variant. */\n\theading?: string;\n\t/** Visible label. */\n\tlabel?: string;\n\t/**\n\t * Off-state text of the `toggle` variant. Defaults to the English text `Disabled`: the state of\n\t * what the toggle controls, not of the checkbox itself.\n\t */\n\ttoggleDisabled?: string;\n\t/** On-state text of the `toggle` variant. Defaults to the English text `Enabled`. */\n\ttoggleEnabled?: string;\n}\n\n/**\n * Change event data\n */\nexport interface CheckboxChangeData {\n\tchecked: boolean;\n\tindeterminate: boolean;\n}\n\n/**\n * Called when the user toggles the checkbox, with the requested next state in\n * `data`. The rendered state only changes when `checked`/`indeterminate` are\n * updated.\n */\nexport type CheckboxChangeHandler = (\n\tevent: ChangeEvent<HTMLInputElement>,\n\tdata: CheckboxChangeData\n) => void;\n\n/**\n * Checkbox is controlled, so `onChange` is required unless the checkbox is\n * `disabled` or `readOnly`: without it, clicking the checkbox does nothing.\n */\nexport type CheckboxChangeProps =\n\t| {\n\t\t\t/**\n\t\t\t * Called when the user toggles the checkbox, with the requested next state\n\t\t\t * in `data`. The rendered state only changes when `checked`/`indeterminate`\n\t\t\t * are updated. Required unless `disabled` or `readOnly` is set.\n\t\t\t */\n\t\t\tonChange: CheckboxChangeHandler;\n\t }\n\t| {\n\t\t\t/** Disables the checkbox. */\n\t\t\tdisabled: true;\n\t\t\t/** Called on change. Optional while disabled. */\n\t\t\tonChange?: CheckboxChangeHandler;\n\t }\n\t| {\n\t\t\t/** Renders the checkbox read-only. */\n\t\t\treadOnly: true;\n\t\t\t/** Called on change. Optional while read-only. */\n\t\t\tonChange?: CheckboxChangeHandler;\n\t };\n\ninterface CheckboxCommonProps {\n\t/** aria-controls for related regions */\n\t'aria-controls'?: string;\n\t/** aria-describedby for descriptions */\n\t'aria-describedby'?: string;\n\t/** aria-labelledby for labels */\n\t'aria-labelledby'?: string;\n\t/** aria-owns for owned elements */\n\t'aria-owns'?: string;\n\t/** aria-required for validation */\n\t'aria-required'?: boolean;\n\t/** Assistive text for accessibility */\n\tassistiveText?: CheckboxAssistiveText;\n\t/**\n\t * Whether the checkbox is checked. Checkbox is controlled: update this prop\n\t * from `onChange`, which reports the requested value in `data.checked`.\n\t */\n\tchecked: boolean;\n\t/** Disable the checkbox */\n\tdisabled?: boolean;\n\t/** Unique ID */\n\tid?: string;\n\t/** Text labels */\n\tlabels?: CheckboxLabels;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLInputElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => 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<HTMLInputElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;\n\t/**\n\t * @deprecated Focus the checkbox through `ref`, which is forwarded to the `<input>`.\n\t * Called with the `<input>` when `requestFocus` is set. Works only in the 11.0.0 release candidates, and warns.\n\t */\n\tonRequestFocus?: (element: HTMLInputElement) => void;\n\t/**\n\t * Shows the checked state without letting the user change it. The checkbox stays focusable\n\t * and is announced as read-only; clicks and Space do not toggle it or call `onChange`.\n\t */\n\treadOnly?: boolean;\n\t/**\n\t * @deprecated Focus the checkbox through `ref`, which is forwarded to the `<input>`.\n\t * Works only in the 11.0.0 release candidates, and warns.\n\t */\n\trequestFocus?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** Label ID for label element */\n\tlabelId?: string;\n}\n\n/** Props of the standalone `base` and `toggle` checkboxes (not the picker variants). */\ninterface CheckboxFieldProps {\n\t/** CSS class for container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Error message */\n\terrorText?: string;\n\t/** Mark as required */\n\trequired?: boolean;\n\t/** Tab index */\n\ttabIndex?: number;\n}\n\n/** Props only the visual picker takes. */\ninterface CheckboxVisualPickerProps {\n\t/** Coverable visual picker */\n\tcoverable?: boolean;\n\t/** Vertical visual picker */\n\tvertical?: boolean;\n\t/** Visual picker figure content, rendered inside `.slds-visual-picker__figure` when not `coverable` */\n\tvisualPickerFigure?: ReactNode;\n\t/** Coverable visual picker figure content shown when selected */\n\tvisualPickerFigureSelected?: ReactNode;\n\t/** Coverable visual picker figure content shown when not selected */\n\tvisualPickerFigureNotSelected?: ReactNode;\n\t/** @deprecated Use `visualPickerFigure` instead. */\n\tonRenderVisualPicker?: () => ReactNode;\n\t/** @deprecated Use `visualPickerFigureSelected` instead. */\n\tonRenderVisualPickerSelected?: () => ReactNode;\n\t/** @deprecated Use `visualPickerFigureNotSelected` instead. */\n\tonRenderVisualPickerNotSelected?: () => ReactNode;\n\t/** Size for visual picker */\n\tsize?: CheckboxSize;\n}\n\n/** The plain checkbox, and the default. Supports every field prop. */\ninterface CheckboxBaseVariantProps\n\textends CheckboxCommonProps, CheckboxFieldProps {\n\t/** Checkbox variant */\n\tvariant?: 'base';\n\t/**\n\t * Indeterminate state (partial selection). Controlled: it is applied to the\n\t * DOM node on every change and cleared when this prop is `false` or\n\t * `undefined`. Clicking an indeterminate checkbox reports\n\t * `{ checked: true, indeterminate: false }`.\n\t */\n\tindeterminate?: boolean;\n}\n\n/** A toggle switch. A toggle is on or off, so there is no `indeterminate`. */\ninterface CheckboxToggleVariantProps\n\textends CheckboxCommonProps, CheckboxFieldProps {\n\t/** Checkbox variant */\n\tvariant: 'toggle';\n\tindeterminate?: never;\n}\n\n/**\n * A button inside a `ButtonGroup`. The group owns the container, error text and\n * tab order, so `className`, `errorText`, `required` and `tabIndex` are not accepted.\n */\ninterface CheckboxButtonGroupVariantProps extends CheckboxCommonProps {\n\t/** Checkbox variant */\n\tvariant: 'button-group';\n\t/**\n\t * Indeterminate state (partial selection). Controlled: it is applied to the\n\t * DOM node on every change and cleared when this prop is `false` or\n\t * `undefined`. Clicking an indeterminate checkbox reports\n\t * `{ checked: true, indeterminate: false }`.\n\t */\n\tindeterminate?: boolean;\n\tclassName?: never;\n\terrorText?: never;\n\trequired?: never;\n\ttabIndex?: never;\n}\n\n/**\n * An option inside a `VisualPicker`. The picker owns the container, error text\n * and tab order, so `className`, `errorText`, `required` and `tabIndex` are not accepted.\n */\ninterface CheckboxVisualPickerVariantProps\n\textends CheckboxCommonProps, CheckboxVisualPickerProps {\n\t/** Checkbox variant */\n\tvariant: 'visual-picker';\n\t/**\n\t * Indeterminate state (partial selection). Controlled: it is applied to the\n\t * DOM node on every change and cleared when this prop is `false` or\n\t * `undefined`. Clicking an indeterminate checkbox reports\n\t * `{ checked: true, indeterminate: false }`.\n\t */\n\tindeterminate?: boolean;\n\tclassName?: never;\n\terrorText?: never;\n\trequired?: never;\n\ttabIndex?: never;\n}\n\ntype CheckboxVariantProps =\n\t| CheckboxBaseVariantProps\n\t| CheckboxToggleVariantProps\n\t| CheckboxButtonGroupVariantProps\n\t| CheckboxVisualPickerVariantProps;\n\n/**\n * Props for the Checkbox component: a union on `variant`, so a prop that a\n * variant drops is a compile error instead of being ignored.\n */\nexport type CheckboxProps = CheckboxVariantProps & CheckboxChangeProps;\n\nconst defaultLabels: CheckboxLabels = {\n\ttoggleDisabled: 'Disabled',\n\ttoggleEnabled: 'Enabled',\n};\n\n/**\n * A checkbox, a toggle (`variant=\"toggle\"`) or a button-group checkbox\n * (`variant=\"button-group\"`). It is controlled: pass `checked` and update it\n * from `onChange`. It looks the same in every browser.\n */\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n\tconst {\n\t\tassistiveText: assistiveTextProp,\n\t\tchecked,\n\t\t// Removed in v11 (Checkbox is controlled). Destructured so it never\n\t\t// reaches the DOM; `checkDeprecatedProps` warns about it.\n\t\tdefaultChecked,\n\t\tclassName,\n\t\tdisabled,\n\t\terrorText,\n\t\tid: propId,\n\t\tindeterminate,\n\t\tlabels: labelsProp,\n\t\tname,\n\t\tonBlur,\n\t\tonChange,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\tonRequestFocus,\n\t\treadOnly,\n\t\trequestFocus,\n\t\trequired,\n\t\trole,\n\t\ttabIndex,\n\t\tvariant = 'base',\n\t\tcoverable,\n\t\tvertical,\n\t\tvisualPickerFigure,\n\t\tvisualPickerFigureSelected,\n\t\tvisualPickerFigureNotSelected,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t\tsize = 'medium',\n\t\tlabelId,\n\t\t...restProps\n\t} = props as CheckboxCommonProps &\n\t\tPartial<CheckboxFieldProps & CheckboxVisualPickerProps> &\n\t\tCheckboxChangeProps & {\n\t\t\tindeterminate?: boolean;\n\t\t\tvariant?: CheckboxVariant;\n\t\t} & {\n\t\t\tdefaultChecked?: boolean;\n\t\t};\n\n\tconst generatedId = useId();\n\tconst internalRef = useRef<HTMLInputElement | null>(null);\n\n\tconst getId = () => propId || generatedId;\n\tconst getErrorId = () => (errorText ? `${getId()}-error-text` : undefined);\n\n\t// Merge assistive text\n\tconst assistiveText: CheckboxAssistiveText = { ...assistiveTextProp };\n\n\t// Merge labels\n\tconst labels: CheckboxLabels = {\n\t\t...defaultLabels,\n\t\t...labelsProp,\n\t};\n\n\tuseEffect(() => {\n\t\tcheckDeprecatedProps(\n\t\t\tCHECKBOX,\n\t\t\t{\n\t\t\t\tdefaultChecked,\n\t\t\t\tonKeyPress,\n\t\t\t\tonRenderVisualPicker,\n\t\t\t\tonRenderVisualPickerSelected,\n\t\t\t\tonRenderVisualPickerNotSelected,\n\t\t\t\tonRequestFocus,\n\t\t\t\trequestFocus,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t}, [\n\t\tdefaultChecked,\n\t\tonKeyPress,\n\t\tonRequestFocus,\n\t\trequestFocus,\n\t\tonRenderVisualPicker,\n\t\tonRenderVisualPickerSelected,\n\t\tonRenderVisualPickerNotSelected,\n\t]);\n\n\tuseEffect(() => {\n\t\tcheckRequiredProps(\n\t\t\tCHECKBOX,\n\t\t\t{ disabled, onChange, readOnly },\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\t// `indeterminate` only exists as a DOM property. Apply it whenever the prop\n\t// changes, including clearing it when the prop goes back to false/undefined.\n\tuseEffect(() => {\n\t\tif (internalRef.current) {\n\t\t\tinternalRef.current.indeterminate = !!indeterminate;\n\t\t}\n\t}, [indeterminate]);\n\n\t// Handle request focus\n\tuseEffect(() => {\n\t\tif (requestFocus && onRequestFocus && internalRef.current) {\n\t\t\tonRequestFocus(internalRef.current);\n\t\t}\n\t}, [requestFocus, onRequestFocus]);\n\n\tconst getAriaDescribedBy = (idArray: string[] = []): string | undefined => {\n\t\tconst describedBy = idArray\n\t\t\t.concat(restProps['aria-describedby'] || '', getErrorId() || '')\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ');\n\t\treturn describedBy || undefined;\n\t};\n\n\tconst handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\t// Read-only: skip `onChange`, so React restores the controlled `checked`. (Calling\n\t\t// `preventDefault` on the click instead conflicts with that restore and unchecks the box.)\n\t\tif (readOnly) {\n\t\t\treturn;\n\t\t}\n\t\tonChange?.(event, {\n\t\t\tchecked: indeterminate ? true : !checked,\n\t\t\tindeterminate: false,\n\t\t});\n\t\t// A click clears the DOM `indeterminate` flag natively. React restores a\n\t\t// controlled `checked` but not this property, so put the prop value back;\n\t\t// if the parent accepts the change, the effect above applies the new one.\n\t\tif (internalRef.current) {\n\t\t\tinternalRef.current.indeterminate = !!indeterminate;\n\t\t}\n\t};\n\n\tconst ariaProps = getAriaProps(restProps);\n\n\t// Common input props\n\tconst inputProps = {\n\t\tdisabled,\n\t\tchecked: !!checked,\n\t\tid: getId(),\n\t\tname,\n\t\tonBlur,\n\t\tonChange: handleChange,\n\t\tonFocus,\n\t\tonKeyDown,\n\t\tonKeyPress,\n\t\tonKeyUp,\n\t\trole,\n\t\t'aria-readonly': readOnly || undefined,\n\t\trequired,\n\t\ttype: 'checkbox' as const,\n\t\t...ariaProps,\n\t};\n\n\t// Set ref\n\tconst setRef = (node: HTMLInputElement | null) => {\n\t\tinternalRef.current = node;\n\t\tif (typeof ref === 'function') {\n\t\t\tref(node);\n\t\t} else if (ref) {\n\t\t\tref.current = node;\n\t\t}\n\t};\n\n\t// Button Group Variant\n\tif (variant === 'button-group') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-button',\n\t\t\t\t\t'slds-checkbox_button',\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label className=\"slds-checkbox_button__label\" htmlFor={getId()}>\n\t\t\t\t\t<span className=\"slds-checkbox_faux\">{labels.label}</span>\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Toggle Variant\n\tif (variant === 'toggle') {\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'is-required': required,\n\t\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t\t},\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<label className=\"slds-checkbox_toggle slds-grid\" htmlFor={getId()}>\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t<span className=\"slds-form-element__label slds-m-bottom_none\">\n\t\t\t\t\t\t\t{labels.label}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy([`${getId()}-desc`])}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={`${getId()}-desc`}\n\t\t\t\t\t\tclassName=\"slds-checkbox_faux_container\"\n\t\t\t\t\t\taria-live=\"assertive\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t<span className=\"slds-checkbox_on\">{labels.toggleEnabled}</span>\n\t\t\t\t\t\t<span className=\"slds-checkbox_off\">{labels.toggleDisabled}</span>\n\t\t\t\t\t</span>\n\t\t\t\t</label>\n\t\t\t\t{errorText && (\n\t\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t\t{errorText}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Visual Picker Variant\n\tif (variant === 'visual-picker') {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-visual-picker',\n\t\t\t\t\t`slds-visual-picker_${size}`,\n\t\t\t\t\tvertical && 'slds-visual-picker_vertical',\n\t\t\t\t\tclassName as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\t{...inputProps}\n\t\t\t\t\tref={setRef}\n\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t/>\n\t\t\t\t<label htmlFor={getId()}>\n\t\t\t\t\t{coverable ? (\n\t\t\t\t\t\t<div className=\"slds-visual-picker__figure slds-visual-picker__icon slds-align_absolute-center\">\n\t\t\t\t\t\t\t<span className=\"slds-is-selected\">\n\t\t\t\t\t\t\t\t{visualPickerFigureSelected ?? onRenderVisualPickerSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"slds-is-not-selected\">\n\t\t\t\t\t\t\t\t{visualPickerFigureNotSelected ??\n\t\t\t\t\t\t\t\t\tonRenderVisualPickerNotSelected?.()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__figure slds-visual-picker__text slds-align_absolute-center\">\n\t\t\t\t\t\t\t{visualPickerFigure ?? onRenderVisualPicker?.()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!vertical && (\n\t\t\t\t\t\t<span className=\"slds-visual-picker__body\">\n\t\t\t\t\t\t\t{labels.heading && (\n\t\t\t\t\t\t\t\t<span className=\"slds-text-heading_small\">\n\t\t\t\t\t\t\t\t\t{labels.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<span className=\"slds-text-title\">{labels.label}</span>\n\t\t\t\t\t\t\t{(assistiveText.label || assistiveText.heading) && (\n\t\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t\t{assistiveText.label || assistiveText.heading}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{!coverable && (\n\t\t\t\t\t\t<span className=\"slds-icon_container slds-visual-picker__text-check\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\t\tname=\"check\"\n\t\t\t\t\t\t\t\tcolorVariant=\"base\"\n\t\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</label>\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Base Variant (default)\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-form-element',\n\t\t\t\t{\n\t\t\t\t\t'is-required': required,\n\t\t\t\t\t'slds-has-error': errorText,\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t<span className=\"slds-checkbox\">\n\t\t\t\t\t{required && (\n\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t*\n\t\t\t\t\t\t</abbr>\n\t\t\t\t\t)}\n\t\t\t\t\t<input\n\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\tref={setRef}\n\t\t\t\t\t\ttabIndex={tabIndex}\n\t\t\t\t\t\taria-describedby={getAriaDescribedBy()}\n\t\t\t\t\t/>\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName=\"slds-checkbox__label\"\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t\tid={labelId}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-checkbox_faux\" />\n\t\t\t\t\t\t{labels.label && (\n\t\t\t\t\t\t\t<span className=\"slds-form-element__label\">{labels.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{assistiveText.label && (\n\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">{assistiveText.label}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</label>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t{errorText && (\n\t\t\t\t<div className=\"slds-form-element__help\" id={getErrorId()}>\n\t\t\t\t\t{errorText}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n});\n\nCheckbox.displayName = CHECKBOX;\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;AA+QA,IAAM,KAAgC;CACrC,gBAAgB;CAChB,eAAe;AAChB,GAOM,IAAW,GAA6C,GAAO,MAAQ;CAC5E,IAAM,EACL,eAAe,GACf,YAGA,mBACA,cACA,aACA,cACA,IAAI,GACJ,kBACA,QAAQ,GACR,SACA,WACA,aACA,YACA,cACA,eACA,YACA,mBACA,aACA,iBACA,aACA,UACA,cACA,aAAU,QACV,cACA,aACA,uBACA,+BACA,kCACA,yBACA,iCACA,oCACA,UAAO,UACP,YACA,GAAG,MACA,GASE,IAAc,EAAM,GACpB,IAAc,EAAgC,IAAI,GAElD,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