@heymantle/litho 0.0.3 → 0.0.4

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 (353) hide show
  1. package/dist/cjs/components/ActionList.js +50 -16
  2. package/dist/cjs/components/AnnouncementBar.js +10 -3
  3. package/dist/cjs/components/AppProvider.js +10 -1
  4. package/dist/cjs/components/Autocomplete.js +33 -11
  5. package/dist/cjs/components/Badge.js +2 -1
  6. package/dist/cjs/components/Banner.js +35 -31
  7. package/dist/cjs/components/Box.js +5 -3
  8. package/dist/cjs/components/Button.js +34 -12
  9. package/dist/cjs/components/Card.js +5 -45
  10. package/dist/cjs/components/Checkbox.js +16 -6
  11. package/dist/cjs/components/ChoiceList.js +7 -4
  12. package/dist/cjs/components/ColorField.js +8 -3
  13. package/dist/cjs/components/DatePicker.js +13 -8
  14. package/dist/cjs/components/DropZone.js +33 -18
  15. package/dist/cjs/components/EmptyState.js +15 -7
  16. package/dist/cjs/components/Filters.js +32 -20
  17. package/dist/cjs/components/FooterHelp.js +7 -2
  18. package/dist/cjs/components/Form.js +18 -3
  19. package/dist/cjs/components/Frame.js +40 -15
  20. package/dist/cjs/components/FrameSaveBar.js +21 -12
  21. package/dist/cjs/components/Layout.js +3 -3
  22. package/dist/cjs/components/LayoutSection.js +2 -2
  23. package/dist/cjs/components/Link.js +6 -2
  24. package/dist/cjs/components/List.js +1 -0
  25. package/dist/cjs/components/Listbox.js +9 -4
  26. package/dist/cjs/components/Modal.js +26 -17
  27. package/dist/cjs/components/Navigation.js +30 -20
  28. package/dist/cjs/components/Page.js +8 -3
  29. package/dist/cjs/components/Pagination.js +11 -4
  30. package/dist/cjs/components/Pane.js +118 -35
  31. package/dist/cjs/components/Popover.js +59 -6
  32. package/dist/cjs/components/RangeSlider.js +11 -4
  33. package/dist/cjs/components/ResourceList.js +9 -3
  34. package/dist/cjs/components/Select.js +2 -0
  35. package/dist/cjs/components/Table.js +32 -19
  36. package/dist/cjs/components/Text.js +8 -5
  37. package/dist/cjs/components/TextField.js +23 -13
  38. package/dist/cjs/components/Thumbnail.js +7 -2
  39. package/dist/cjs/components/TimePicker.js +7 -2
  40. package/dist/cjs/components/Tip.js +10 -4
  41. package/dist/cjs/components/Tooltip.js +16 -8
  42. package/dist/cjs/components/TopBar.js +17 -9
  43. package/dist/cjs/dev/verify-publish.js +37 -4
  44. package/dist/cjs/postcss.config.js +21 -0
  45. package/dist/cjs/stories/ActionList.stories.js +365 -0
  46. package/dist/cjs/stories/AnnouncementBar.stories.js +244 -0
  47. package/dist/cjs/stories/Autocomplete.stories.js +871 -0
  48. package/dist/cjs/stories/Badge.stories.js +183 -0
  49. package/dist/cjs/stories/Banner.stories.js +201 -0
  50. package/dist/cjs/stories/Box.stories.js +599 -0
  51. package/dist/cjs/stories/Button.stories.js +325 -0
  52. package/dist/cjs/stories/ButtonGroup.stories.js +404 -0
  53. package/dist/cjs/stories/Card.stories.js +278 -0
  54. package/dist/cjs/stories/Checkbox.stories.js +266 -0
  55. package/dist/cjs/stories/ChoiceList.stories.js +884 -0
  56. package/dist/cjs/stories/Collapsible.stories.js +905 -0
  57. package/dist/cjs/stories/ColorField.stories.js +883 -0
  58. package/dist/cjs/stories/ContextualSaveBar.stories.js +970 -0
  59. package/dist/cjs/stories/DatePicker.stories.js +584 -0
  60. package/dist/cjs/stories/Divider.stories.js +759 -0
  61. package/dist/cjs/stories/DropZone.stories.js +1205 -0
  62. package/dist/cjs/stories/EmptyState.stories.js +296 -0
  63. package/dist/cjs/stories/Filters.stories.js +1353 -0
  64. package/dist/cjs/stories/FooterHelp.stories.js +869 -0
  65. package/dist/cjs/stories/Form.stories.js +940 -0
  66. package/dist/cjs/stories/Grid.stories.js +1199 -0
  67. package/dist/cjs/stories/HorizontalStack.stories.js +1064 -0
  68. package/dist/cjs/stories/Icon.stories.js +596 -0
  69. package/dist/cjs/stories/Image.stories.js +883 -0
  70. package/dist/cjs/stories/InlineError.stories.js +710 -0
  71. package/dist/cjs/stories/Label.stories.js +665 -0
  72. package/dist/cjs/stories/Layout.stories.js +685 -0
  73. package/dist/cjs/stories/LayoutSection.stories.js +1267 -0
  74. package/dist/cjs/stories/Link.stories.js +423 -0
  75. package/dist/cjs/stories/List.stories.js +1031 -0
  76. package/dist/cjs/stories/Listbox.stories.js +820 -0
  77. package/dist/cjs/stories/Loading.stories.js +900 -0
  78. package/dist/cjs/stories/Modal.stories.js +363 -0
  79. package/dist/cjs/stories/Navigation.stories.js +605 -0
  80. package/dist/cjs/stories/Page.stories.js +318 -0
  81. package/dist/cjs/stories/Pagination.stories.js +438 -0
  82. package/dist/cjs/stories/Pane.stories.js +1535 -0
  83. package/dist/cjs/stories/Popover.stories.js +637 -0
  84. package/dist/cjs/stories/PopoverManager.stories.js +1225 -0
  85. package/dist/cjs/stories/ProgressBar.stories.js +506 -0
  86. package/dist/cjs/stories/RadioButton.stories.js +642 -0
  87. package/dist/cjs/stories/RadioButtonCard.stories.js +816 -0
  88. package/dist/cjs/stories/RangeSlider.stories.js +892 -0
  89. package/dist/cjs/stories/ResourceList.stories.js +1067 -0
  90. package/dist/cjs/stories/Select.stories.js +413 -0
  91. package/dist/cjs/stories/SkeletonText.stories.js +776 -0
  92. package/dist/cjs/stories/Spinner.stories.js +396 -0
  93. package/dist/cjs/stories/Table.stories.js +628 -0
  94. package/dist/cjs/stories/Tabs.stories.js +723 -0
  95. package/dist/cjs/stories/Tag.stories.js +620 -0
  96. package/dist/cjs/stories/Text.stories.js +262 -0
  97. package/dist/cjs/stories/TextField.stories.js +377 -0
  98. package/dist/cjs/stories/Thumbnail.stories.js +859 -0
  99. package/dist/cjs/stories/TimePicker.stories.js +966 -0
  100. package/dist/cjs/stories/Tip.stories.js +753 -0
  101. package/dist/cjs/stories/Tooltip.stories.js +357 -0
  102. package/dist/cjs/stories/TopBar.stories.js +155 -0
  103. package/dist/cjs/stories/VerticalStack.stories.js +1287 -0
  104. package/dist/cjs/tailwind.config.js +17 -0
  105. package/dist/cjs/utilities/transformers.js +66 -0
  106. package/dist/cjs/vite.config.js +35 -0
  107. package/dist/esm/components/ActionList.js +41 -12
  108. package/dist/esm/components/AnnouncementBar.js +3 -1
  109. package/dist/esm/components/AppProvider.js +10 -1
  110. package/dist/esm/components/Autocomplete.js +21 -4
  111. package/dist/esm/components/Badge.js +2 -2
  112. package/dist/esm/components/Banner.js +20 -21
  113. package/dist/esm/components/Box.js +5 -4
  114. package/dist/esm/components/Button.js +24 -7
  115. package/dist/esm/components/Card.js +5 -4
  116. package/dist/esm/components/Checkbox.js +6 -1
  117. package/dist/esm/components/ChoiceList.js +7 -4
  118. package/dist/esm/components/ColorField.js +1 -1
  119. package/dist/esm/components/DatePicker.js +6 -1
  120. package/dist/esm/components/DropZone.js +14 -4
  121. package/dist/esm/components/EmptyState.js +4 -1
  122. package/dist/esm/components/Filters.js +10 -3
  123. package/dist/esm/components/FooterHelp.js +1 -1
  124. package/dist/esm/components/Form.js +18 -3
  125. package/dist/esm/components/Frame.js +18 -6
  126. package/dist/esm/components/FrameSaveBar.js +10 -6
  127. package/dist/esm/components/InlineError.js +1 -1
  128. package/dist/esm/components/Layout.js +4 -4
  129. package/dist/esm/components/LayoutSection.js +2 -2
  130. package/dist/esm/components/Link.js +6 -2
  131. package/dist/esm/components/List.js +1 -0
  132. package/dist/esm/components/Listbox.js +4 -4
  133. package/dist/esm/components/Modal.js +8 -4
  134. package/dist/esm/components/Navigation.js +16 -11
  135. package/dist/esm/components/Page.js +9 -4
  136. package/dist/esm/components/Pagination.js +3 -1
  137. package/dist/esm/components/Pane.js +114 -36
  138. package/dist/esm/components/Popover.js +18 -6
  139. package/dist/esm/components/RangeSlider.js +3 -1
  140. package/dist/esm/components/ResourceList.js +2 -1
  141. package/dist/esm/components/Select.js +2 -0
  142. package/dist/esm/components/Table.js +16 -3
  143. package/dist/esm/components/Text.js +8 -6
  144. package/dist/esm/components/TextField.js +6 -1
  145. package/dist/esm/components/Thumbnail.js +1 -1
  146. package/dist/esm/components/TimePicker.js +1 -1
  147. package/dist/esm/components/Tip.js +3 -2
  148. package/dist/esm/components/Tooltip.js +4 -1
  149. package/dist/esm/components/TopBar.js +7 -4
  150. package/dist/esm/dev/verify-publish.js +37 -4
  151. package/dist/esm/postcss.config.js +6 -0
  152. package/dist/esm/stories/ActionList.stories.js +327 -0
  153. package/dist/esm/stories/AnnouncementBar.stories.js +212 -0
  154. package/dist/esm/stories/Autocomplete.stories.js +833 -0
  155. package/dist/esm/stories/Badge.stories.js +138 -0
  156. package/dist/esm/stories/Banner.stories.js +159 -0
  157. package/dist/esm/stories/Box.stories.js +558 -0
  158. package/dist/esm/stories/Button.stories.js +277 -0
  159. package/dist/esm/stories/ButtonGroup.stories.js +357 -0
  160. package/dist/esm/stories/Card.stories.js +240 -0
  161. package/dist/esm/stories/Checkbox.stories.js +219 -0
  162. package/dist/esm/stories/ChoiceList.stories.js +834 -0
  163. package/dist/esm/stories/Collapsible.stories.js +867 -0
  164. package/dist/esm/stories/ColorField.stories.js +842 -0
  165. package/dist/esm/stories/ContextualSaveBar.stories.js +938 -0
  166. package/dist/esm/stories/DatePicker.stories.js +537 -0
  167. package/dist/esm/stories/Divider.stories.js +715 -0
  168. package/dist/esm/stories/DropZone.stories.js +1161 -0
  169. package/dist/esm/stories/EmptyState.stories.js +246 -0
  170. package/dist/esm/stories/Filters.stories.js +1315 -0
  171. package/dist/esm/stories/FooterHelp.stories.js +813 -0
  172. package/dist/esm/stories/Form.stories.js +905 -0
  173. package/dist/esm/stories/Grid.stories.js +1152 -0
  174. package/dist/esm/stories/HorizontalStack.stories.js +1011 -0
  175. package/dist/esm/stories/Icon.stories.js +555 -0
  176. package/dist/esm/stories/Image.stories.js +836 -0
  177. package/dist/esm/stories/InlineError.stories.js +666 -0
  178. package/dist/esm/stories/Label.stories.js +612 -0
  179. package/dist/esm/stories/Layout.stories.js +647 -0
  180. package/dist/esm/stories/LayoutSection.stories.js +1226 -0
  181. package/dist/esm/stories/Link.stories.js +379 -0
  182. package/dist/esm/stories/List.stories.js +975 -0
  183. package/dist/esm/stories/Listbox.stories.js +776 -0
  184. package/dist/esm/stories/Loading.stories.js +850 -0
  185. package/dist/esm/stories/Modal.stories.js +322 -0
  186. package/dist/esm/stories/Navigation.stories.js +567 -0
  187. package/dist/esm/stories/Page.stories.js +276 -0
  188. package/dist/esm/stories/Pagination.stories.js +394 -0
  189. package/dist/esm/stories/Pane.stories.js +1497 -0
  190. package/dist/esm/stories/Popover.stories.js +605 -0
  191. package/dist/esm/stories/PopoverManager.stories.js +1193 -0
  192. package/dist/esm/stories/ProgressBar.stories.js +465 -0
  193. package/dist/esm/stories/RadioButton.stories.js +598 -0
  194. package/dist/esm/stories/RadioButtonCard.stories.js +772 -0
  195. package/dist/esm/stories/RangeSlider.stories.js +845 -0
  196. package/dist/esm/stories/ResourceList.stories.js +1029 -0
  197. package/dist/esm/stories/Select.stories.js +363 -0
  198. package/dist/esm/stories/SkeletonText.stories.js +717 -0
  199. package/dist/esm/stories/Spinner.stories.js +355 -0
  200. package/dist/esm/stories/Table.stories.js +584 -0
  201. package/dist/esm/stories/Tabs.stories.js +685 -0
  202. package/dist/esm/stories/Tag.stories.js +573 -0
  203. package/dist/esm/stories/Text.stories.js +217 -0
  204. package/dist/esm/stories/TextField.stories.js +332 -0
  205. package/dist/esm/stories/Thumbnail.stories.js +806 -0
  206. package/dist/esm/stories/TimePicker.stories.js +910 -0
  207. package/dist/esm/stories/Tip.stories.js +706 -0
  208. package/dist/esm/stories/Tooltip.stories.js +313 -0
  209. package/dist/esm/stories/TopBar.stories.js +114 -0
  210. package/dist/esm/stories/VerticalStack.stories.js +1240 -0
  211. package/dist/esm/tailwind.config.js +7 -0
  212. package/dist/esm/utilities/transformers.js +47 -0
  213. package/dist/esm/vite.config.js +20 -0
  214. package/dist/types/components/ActionList.d.ts +122 -0
  215. package/dist/types/components/ActionList.d.ts.map +1 -0
  216. package/dist/types/components/AnnouncementBar.d.ts +21 -0
  217. package/dist/types/components/AnnouncementBar.d.ts.map +1 -0
  218. package/dist/types/components/AppProvider.d.ts +61 -0
  219. package/dist/types/components/AppProvider.d.ts.map +1 -0
  220. package/dist/types/components/Autocomplete.d.ts +130 -0
  221. package/dist/types/components/Autocomplete.d.ts.map +1 -0
  222. package/dist/types/components/Badge.d.ts +21 -0
  223. package/dist/types/components/Badge.d.ts.map +1 -0
  224. package/dist/types/components/Banner.d.ts +78 -0
  225. package/dist/types/components/Banner.d.ts.map +1 -0
  226. package/dist/types/components/Box.d.ts +70 -0
  227. package/dist/types/components/Box.d.ts.map +1 -0
  228. package/dist/types/components/Button.d.ts +123 -0
  229. package/dist/types/components/Button.d.ts.map +1 -0
  230. package/dist/types/components/ButtonGroup.d.ts +26 -0
  231. package/dist/types/components/ButtonGroup.d.ts.map +1 -0
  232. package/dist/types/components/Card.d.ts +139 -0
  233. package/dist/types/components/Card.d.ts.map +1 -0
  234. package/dist/types/components/Checkbox.d.ts +56 -0
  235. package/dist/types/components/Checkbox.d.ts.map +1 -0
  236. package/dist/types/components/ChoiceList.d.ts +69 -0
  237. package/dist/types/components/ChoiceList.d.ts.map +1 -0
  238. package/dist/types/components/Collapsible.d.ts +17 -0
  239. package/dist/types/components/Collapsible.d.ts.map +1 -0
  240. package/dist/types/components/ColorField.d.ts +36 -0
  241. package/dist/types/components/ColorField.d.ts.map +1 -0
  242. package/dist/types/components/ContextualSaveBar.d.ts +22 -0
  243. package/dist/types/components/ContextualSaveBar.d.ts.map +1 -0
  244. package/dist/types/components/DatePicker.d.ts +66 -0
  245. package/dist/types/components/DatePicker.d.ts.map +1 -0
  246. package/dist/types/components/Divider.d.ts +21 -0
  247. package/dist/types/components/Divider.d.ts.map +1 -0
  248. package/dist/types/components/DropZone.d.ts +108 -0
  249. package/dist/types/components/DropZone.d.ts.map +1 -0
  250. package/dist/types/components/EmptyState.d.ts +52 -0
  251. package/dist/types/components/EmptyState.d.ts.map +1 -0
  252. package/dist/types/components/Filters.d.ts +166 -0
  253. package/dist/types/components/Filters.d.ts.map +1 -0
  254. package/dist/types/components/FooterHelp.d.ts +21 -0
  255. package/dist/types/components/FooterHelp.d.ts.map +1 -0
  256. package/dist/types/components/Form.d.ts +39 -0
  257. package/dist/types/components/Form.d.ts.map +1 -0
  258. package/dist/types/components/Frame.d.ts +51 -0
  259. package/dist/types/components/Frame.d.ts.map +1 -0
  260. package/dist/types/components/FrameSaveBar.d.ts +8 -0
  261. package/dist/types/components/FrameSaveBar.d.ts.map +1 -0
  262. package/dist/types/components/Grid.d.ts +39 -0
  263. package/dist/types/components/Grid.d.ts.map +1 -0
  264. package/dist/types/components/HorizontalStack.d.ts +36 -0
  265. package/dist/types/components/HorizontalStack.d.ts.map +1 -0
  266. package/dist/types/components/Icon.d.ts +43 -0
  267. package/dist/types/components/Icon.d.ts.map +1 -0
  268. package/dist/types/components/Image.d.ts +45 -0
  269. package/dist/types/components/Image.d.ts.map +1 -0
  270. package/dist/types/components/InlineError.d.ts +22 -0
  271. package/dist/types/components/InlineError.d.ts.map +1 -0
  272. package/dist/types/components/Label.d.ts +28 -0
  273. package/dist/types/components/Label.d.ts.map +1 -0
  274. package/dist/types/components/Layout.d.ts +44 -0
  275. package/dist/types/components/Layout.d.ts.map +1 -0
  276. package/dist/types/components/LayoutSection.d.ts +24 -0
  277. package/dist/types/components/LayoutSection.d.ts.map +1 -0
  278. package/dist/types/components/Link.d.ts +38 -0
  279. package/dist/types/components/Link.d.ts.map +1 -0
  280. package/dist/types/components/List.d.ts +33 -0
  281. package/dist/types/components/List.d.ts.map +1 -0
  282. package/dist/types/components/Listbox.d.ts +34 -0
  283. package/dist/types/components/Listbox.d.ts.map +1 -0
  284. package/dist/types/components/Loading.d.ts +13 -0
  285. package/dist/types/components/Loading.d.ts.map +1 -0
  286. package/dist/types/components/Modal.d.ts +75 -0
  287. package/dist/types/components/Modal.d.ts.map +1 -0
  288. package/dist/types/components/Navigation.d.ts +105 -0
  289. package/dist/types/components/Navigation.d.ts.map +1 -0
  290. package/dist/types/components/Page.d.ts +59 -0
  291. package/dist/types/components/Page.d.ts.map +1 -0
  292. package/dist/types/components/Pagination.d.ts +39 -0
  293. package/dist/types/components/Pagination.d.ts.map +1 -0
  294. package/dist/types/components/Pane.d.ts +11 -0
  295. package/dist/types/components/Pane.d.ts.map +1 -0
  296. package/dist/types/components/Popover.d.ts +56 -0
  297. package/dist/types/components/Popover.d.ts.map +1 -0
  298. package/dist/types/components/PopoverManager.d.ts +3 -0
  299. package/dist/types/components/PopoverManager.d.ts.map +1 -0
  300. package/dist/types/components/ProgressBar.d.ts +24 -0
  301. package/dist/types/components/ProgressBar.d.ts.map +1 -0
  302. package/dist/types/components/RadioButton.d.ts +39 -0
  303. package/dist/types/components/RadioButton.d.ts.map +1 -0
  304. package/dist/types/components/RadioButtonCard.d.ts +41 -0
  305. package/dist/types/components/RadioButtonCard.d.ts.map +1 -0
  306. package/dist/types/components/RangeSlider.d.ts +44 -0
  307. package/dist/types/components/RangeSlider.d.ts.map +1 -0
  308. package/dist/types/components/ResourceList.d.ts +54 -0
  309. package/dist/types/components/ResourceList.d.ts.map +1 -0
  310. package/dist/types/components/Select.d.ts +48 -0
  311. package/dist/types/components/Select.d.ts.map +1 -0
  312. package/dist/types/components/SkeletonText.d.ts +28 -0
  313. package/dist/types/components/SkeletonText.d.ts.map +1 -0
  314. package/dist/types/components/Spinner.d.ts +18 -0
  315. package/dist/types/components/Spinner.d.ts.map +1 -0
  316. package/dist/types/components/Table.d.ts +197 -0
  317. package/dist/types/components/Table.d.ts.map +1 -0
  318. package/dist/types/components/Tabs.d.ts +41 -0
  319. package/dist/types/components/Tabs.d.ts.map +1 -0
  320. package/dist/types/components/Tag.d.ts +26 -0
  321. package/dist/types/components/Tag.d.ts.map +1 -0
  322. package/dist/types/components/Text.d.ts +32 -0
  323. package/dist/types/components/Text.d.ts.map +1 -0
  324. package/dist/types/components/TextField.d.ts +109 -0
  325. package/dist/types/components/TextField.d.ts.map +1 -0
  326. package/dist/types/components/Thumbnail.d.ts +18 -0
  327. package/dist/types/components/Thumbnail.d.ts.map +1 -0
  328. package/dist/types/components/TimePicker.d.ts +3 -0
  329. package/dist/types/components/TimePicker.d.ts.map +1 -0
  330. package/dist/types/components/Tip.d.ts +23 -0
  331. package/dist/types/components/Tip.d.ts.map +1 -0
  332. package/dist/types/components/Tooltip.d.ts +84 -0
  333. package/dist/types/components/Tooltip.d.ts.map +1 -0
  334. package/dist/types/components/TopBar.d.ts +43 -0
  335. package/dist/types/components/TopBar.d.ts.map +1 -0
  336. package/dist/types/components/VerticalStack.d.ts +27 -0
  337. package/dist/types/components/VerticalStack.d.ts.map +1 -0
  338. package/dist/types/index.d.ts +62 -0
  339. package/dist/types/index.d.ts.map +1 -0
  340. package/dist/types/styles/Table.d.ts +1570 -0
  341. package/dist/types/styles/Table.d.ts.map +1 -0
  342. package/dist/types/utilities/dates.d.ts +46 -0
  343. package/dist/types/utilities/dates.d.ts.map +1 -0
  344. package/dist/types/utilities/transformers.d.ts +4 -0
  345. package/dist/types/utilities/transformers.d.ts.map +1 -0
  346. package/dist/types/utilities/useIndexResourceState.d.ts +21 -0
  347. package/dist/types/utilities/useIndexResourceState.d.ts.map +1 -0
  348. package/dist/types/utilities/useMounted.d.ts +2 -0
  349. package/dist/types/utilities/useMounted.d.ts.map +1 -0
  350. package/dist/types/utilities/useTableScrollState.d.ts +29 -0
  351. package/dist/types/utilities/useTableScrollState.d.ts.map +1 -0
  352. package/index.css +6 -0
  353. package/package.json +37 -6
@@ -0,0 +1,1193 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
+ }
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
25
+ function _iterable_to_array(iter) {
26
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
27
+ }
28
+ function _iterable_to_array_limit(arr, i) {
29
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
30
+ if (_i == null) return;
31
+ var _arr = [];
32
+ var _n = true;
33
+ var _d = false;
34
+ var _s, _e;
35
+ try {
36
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
37
+ _arr.push(_s.value);
38
+ if (i && _arr.length === i) break;
39
+ }
40
+ } catch (err) {
41
+ _d = true;
42
+ _e = err;
43
+ } finally{
44
+ try {
45
+ if (!_n && _i["return"] != null) _i["return"]();
46
+ } finally{
47
+ if (_d) throw _e;
48
+ }
49
+ }
50
+ return _arr;
51
+ }
52
+ function _non_iterable_rest() {
53
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
+ }
55
+ function _non_iterable_spread() {
56
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
57
+ }
58
+ function _object_spread(target) {
59
+ for(var i = 1; i < arguments.length; i++){
60
+ var source = arguments[i] != null ? arguments[i] : {};
61
+ var ownKeys = Object.keys(source);
62
+ if (typeof Object.getOwnPropertySymbols === "function") {
63
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
64
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
65
+ }));
66
+ }
67
+ ownKeys.forEach(function(key) {
68
+ _define_property(target, key, source[key]);
69
+ });
70
+ }
71
+ return target;
72
+ }
73
+ function ownKeys(object, enumerableOnly) {
74
+ var keys = Object.keys(object);
75
+ if (Object.getOwnPropertySymbols) {
76
+ var symbols = Object.getOwnPropertySymbols(object);
77
+ if (enumerableOnly) {
78
+ symbols = symbols.filter(function(sym) {
79
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
80
+ });
81
+ }
82
+ keys.push.apply(keys, symbols);
83
+ }
84
+ return keys;
85
+ }
86
+ function _object_spread_props(target, source) {
87
+ source = source != null ? source : {};
88
+ if (Object.getOwnPropertyDescriptors) {
89
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
90
+ } else {
91
+ ownKeys(Object(source)).forEach(function(key) {
92
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
93
+ });
94
+ }
95
+ return target;
96
+ }
97
+ function _sliced_to_array(arr, i) {
98
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
99
+ }
100
+ function _to_consumable_array(arr) {
101
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
102
+ }
103
+ function _unsupported_iterable_to_array(o, minLen) {
104
+ if (!o) return;
105
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
106
+ var n = Object.prototype.toString.call(o).slice(8, -1);
107
+ if (n === "Object" && o.constructor) n = o.constructor.name;
108
+ if (n === "Map" || n === "Set") return Array.from(n);
109
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
110
+ }
111
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
112
+ import { useState, useEffect } from "react";
113
+ import { transformStorySource } from "../utilities/transformers.js";
114
+ import PopoverManager from "../components/PopoverManager.js";
115
+ import Popover from "../components/Popover.js";
116
+ import Text from "../components/Text.js";
117
+ import Card from "../components/Card.js";
118
+ import Button from "../components/Button.js";
119
+ import Page from "../components/Page.js";
120
+ import VerticalStack from "../components/VerticalStack.js";
121
+ import HorizontalStack from "../components/HorizontalStack.js";
122
+ import Box from "../components/Box.js";
123
+ export default {
124
+ title: "Litho/PopoverManager",
125
+ component: PopoverManager,
126
+ parameters: {
127
+ layout: "padded",
128
+ docs: {
129
+ description: {
130
+ component: "A PopoverManager utility that manages the state of multiple popovers in an application. It provides methods to open, close, and track active popovers, ensuring proper layering and interaction management."
131
+ },
132
+ source: {
133
+ transform: transformStorySource
134
+ }
135
+ }
136
+ },
137
+ tags: [
138
+ "autodocs"
139
+ ]
140
+ };
141
+ export var BasicUsage = {
142
+ render: function() {
143
+ var _useState = _sliced_to_array(useState([]), 2), activePopovers = _useState[0], setActivePopovers = _useState[1];
144
+ var _useState1 = _sliced_to_array(useState(false), 2), popover1Active = _useState1[0], setPopover1Active = _useState1[1];
145
+ var _useState2 = _sliced_to_array(useState(false), 2), popover2Active = _useState2[0], setPopover2Active = _useState2[1];
146
+ useEffect(function() {
147
+ var handleManagerChange = function() {
148
+ setActivePopovers(_to_consumable_array(PopoverManager.activePopovers));
149
+ };
150
+ PopoverManager.on("change", handleManagerChange);
151
+ return function() {
152
+ PopoverManager.removeListener("change", handleManagerChange);
153
+ };
154
+ }, []);
155
+ var openPopover1 = function() {
156
+ PopoverManager.open("popover1");
157
+ setPopover1Active(true);
158
+ };
159
+ var closePopover1 = function() {
160
+ PopoverManager.close("popover1");
161
+ setPopover1Active(false);
162
+ };
163
+ var openPopover2 = function() {
164
+ PopoverManager.open("popover2");
165
+ setPopover2Active(true);
166
+ };
167
+ var closePopover2 = function() {
168
+ PopoverManager.close("popover2");
169
+ setPopover2Active(false);
170
+ };
171
+ var closeAll = function() {
172
+ PopoverManager.closeAll();
173
+ setPopover1Active(false);
174
+ setPopover2Active(false);
175
+ };
176
+ return /*#__PURE__*/ _jsx(Card, {
177
+ title: "PopoverManager Basic Usage",
178
+ padded: true,
179
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
180
+ gap: "8",
181
+ children: [
182
+ /*#__PURE__*/ _jsxs(VerticalStack, {
183
+ gap: "4",
184
+ children: [
185
+ /*#__PURE__*/ _jsx(Text, {
186
+ children: "The PopoverManager helps coordinate multiple popovers to prevent conflicts and manage layering. Click the buttons below to see it in action."
187
+ }),
188
+ /*#__PURE__*/ _jsxs(HorizontalStack, {
189
+ gap: "4",
190
+ children: [
191
+ /*#__PURE__*/ _jsx(Popover, {
192
+ active: popover1Active,
193
+ activator: /*#__PURE__*/ _jsx(Button, {
194
+ onClick: openPopover1,
195
+ children: "Open Popover 1"
196
+ }),
197
+ onClose: closePopover1,
198
+ children: /*#__PURE__*/ _jsx(Box, {
199
+ padding: "4",
200
+ minWidth: "200px",
201
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
202
+ gap: "2",
203
+ children: [
204
+ /*#__PURE__*/ _jsx(Text, {
205
+ variant: "headingSm",
206
+ children: "Popover 1"
207
+ }),
208
+ /*#__PURE__*/ _jsx(Text, {
209
+ children: "This is the first popover managed by PopoverManager."
210
+ }),
211
+ /*#__PURE__*/ _jsx(Button, {
212
+ size: "slim",
213
+ onClick: closePopover1,
214
+ children: "Close"
215
+ })
216
+ ]
217
+ })
218
+ })
219
+ }),
220
+ /*#__PURE__*/ _jsx(Popover, {
221
+ active: popover2Active,
222
+ activator: /*#__PURE__*/ _jsx(Button, {
223
+ onClick: openPopover2,
224
+ children: "Open Popover 2"
225
+ }),
226
+ onClose: closePopover2,
227
+ children: /*#__PURE__*/ _jsx(Box, {
228
+ padding: "4",
229
+ minWidth: "200px",
230
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
231
+ gap: "2",
232
+ children: [
233
+ /*#__PURE__*/ _jsx(Text, {
234
+ variant: "headingSm",
235
+ children: "Popover 2"
236
+ }),
237
+ /*#__PURE__*/ _jsx(Text, {
238
+ children: "This is the second popover managed by PopoverManager."
239
+ }),
240
+ /*#__PURE__*/ _jsx(Button, {
241
+ size: "slim",
242
+ onClick: closePopover2,
243
+ children: "Close"
244
+ })
245
+ ]
246
+ })
247
+ })
248
+ }),
249
+ /*#__PURE__*/ _jsx(Button, {
250
+ onClick: closeAll,
251
+ destructive: true,
252
+ children: "Close All Popovers"
253
+ })
254
+ ]
255
+ })
256
+ ]
257
+ }),
258
+ /*#__PURE__*/ _jsx(Box, {
259
+ padding: "4",
260
+ background: "subdued",
261
+ borderRadius: "default",
262
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
263
+ gap: "2",
264
+ children: [
265
+ /*#__PURE__*/ _jsx(Text, {
266
+ variant: "headingSm",
267
+ children: "PopoverManager State"
268
+ }),
269
+ /*#__PURE__*/ _jsxs(VerticalStack, {
270
+ gap: "1",
271
+ children: [
272
+ /*#__PURE__*/ _jsxs(Text, {
273
+ variant: "bodySm",
274
+ children: [
275
+ "Active Popovers: ",
276
+ activePopovers.length
277
+ ]
278
+ }),
279
+ /*#__PURE__*/ _jsxs(Text, {
280
+ variant: "bodySm",
281
+ children: [
282
+ "Popover IDs: ",
283
+ activePopovers.length > 0 ? activePopovers.join(", ") : "None"
284
+ ]
285
+ }),
286
+ /*#__PURE__*/ _jsxs(Text, {
287
+ variant: "bodySm",
288
+ children: [
289
+ "Latest Active: ",
290
+ PopoverManager.getActivePopoverId() || "None"
291
+ ]
292
+ })
293
+ ]
294
+ })
295
+ ]
296
+ })
297
+ })
298
+ ]
299
+ })
300
+ });
301
+ },
302
+ parameters: {
303
+ docs: {
304
+ description: {
305
+ story: "Basic usage of PopoverManager to coordinate multiple popovers."
306
+ }
307
+ }
308
+ }
309
+ };
310
+ export var ConflictResolution = {
311
+ render: function() {
312
+ var _useState = _sliced_to_array(useState([]), 2), activePopovers = _useState[0], setActivePopovers = _useState[1];
313
+ var _useState1 = _sliced_to_array(useState(false), 2), contextMenuActive = _useState1[0], setContextMenuActive = _useState1[1];
314
+ var _useState2 = _sliced_to_array(useState(false), 2), settingsActive = _useState2[0], setSettingsActive = _useState2[1];
315
+ var _useState3 = _sliced_to_array(useState(false), 2), helpActive = _useState3[0], setHelpActive = _useState3[1];
316
+ useEffect(function() {
317
+ var handleManagerChange = function() {
318
+ setActivePopovers(_to_consumable_array(PopoverManager.activePopovers));
319
+ };
320
+ PopoverManager.on("change", handleManagerChange);
321
+ return function() {
322
+ PopoverManager.removeListener("change", handleManagerChange);
323
+ };
324
+ }, []);
325
+ var openContextMenu = function() {
326
+ // Close other conflicting popovers first
327
+ PopoverManager.close("settings");
328
+ PopoverManager.close("help");
329
+ setSettingsActive(false);
330
+ setHelpActive(false);
331
+ PopoverManager.open("contextMenu");
332
+ setContextMenuActive(true);
333
+ };
334
+ var closeContextMenu = function() {
335
+ PopoverManager.close("contextMenu");
336
+ setContextMenuActive(false);
337
+ };
338
+ var openSettings = function() {
339
+ // Close conflicting popovers
340
+ PopoverManager.close("contextMenu");
341
+ PopoverManager.close("help");
342
+ setContextMenuActive(false);
343
+ setHelpActive(false);
344
+ PopoverManager.open("settings");
345
+ setSettingsActive(true);
346
+ };
347
+ var closeSettings = function() {
348
+ PopoverManager.close("settings");
349
+ setSettingsActive(false);
350
+ };
351
+ var openHelp = function() {
352
+ // Close conflicting popovers
353
+ PopoverManager.close("contextMenu");
354
+ PopoverManager.close("settings");
355
+ setContextMenuActive(false);
356
+ setSettingsActive(false);
357
+ PopoverManager.open("help");
358
+ setHelpActive(true);
359
+ };
360
+ var closeHelp = function() {
361
+ PopoverManager.close("help");
362
+ setHelpActive(false);
363
+ };
364
+ return /*#__PURE__*/ _jsx(Card, {
365
+ title: "Popover Conflict Resolution",
366
+ padded: true,
367
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
368
+ gap: "8",
369
+ children: [
370
+ /*#__PURE__*/ _jsxs(VerticalStack, {
371
+ gap: "4",
372
+ children: [
373
+ /*#__PURE__*/ _jsx(Text, {
374
+ children: "When multiple popovers might conflict (like context menus and settings panels), PopoverManager helps resolve conflicts by allowing controlled opening and closing."
375
+ }),
376
+ /*#__PURE__*/ _jsxs(HorizontalStack, {
377
+ gap: "4",
378
+ children: [
379
+ /*#__PURE__*/ _jsx(Popover, {
380
+ active: contextMenuActive,
381
+ activator: /*#__PURE__*/ _jsx(Button, {
382
+ onClick: openContextMenu,
383
+ children: "Context Menu"
384
+ }),
385
+ onClose: closeContextMenu,
386
+ children: /*#__PURE__*/ _jsx(Box, {
387
+ padding: "4",
388
+ minWidth: "150px",
389
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
390
+ gap: "2",
391
+ children: [
392
+ /*#__PURE__*/ _jsx(Text, {
393
+ variant: "headingSm",
394
+ children: "Context Menu"
395
+ }),
396
+ /*#__PURE__*/ _jsxs(VerticalStack, {
397
+ gap: "1",
398
+ children: [
399
+ /*#__PURE__*/ _jsx(Button, {
400
+ size: "slim",
401
+ plain: true,
402
+ textAlign: "left",
403
+ children: "Cut"
404
+ }),
405
+ /*#__PURE__*/ _jsx(Button, {
406
+ size: "slim",
407
+ plain: true,
408
+ textAlign: "left",
409
+ children: "Copy"
410
+ }),
411
+ /*#__PURE__*/ _jsx(Button, {
412
+ size: "slim",
413
+ plain: true,
414
+ textAlign: "left",
415
+ children: "Paste"
416
+ }),
417
+ /*#__PURE__*/ _jsx(Box, {
418
+ paddingBlockStart: "2",
419
+ paddingBlockEnd: "2",
420
+ children: /*#__PURE__*/ _jsx("hr", {})
421
+ }),
422
+ /*#__PURE__*/ _jsx(Button, {
423
+ size: "slim",
424
+ plain: true,
425
+ textAlign: "left",
426
+ children: "Delete"
427
+ })
428
+ ]
429
+ })
430
+ ]
431
+ })
432
+ })
433
+ }),
434
+ /*#__PURE__*/ _jsx(Popover, {
435
+ active: settingsActive,
436
+ activator: /*#__PURE__*/ _jsx(Button, {
437
+ onClick: openSettings,
438
+ children: "Settings Panel"
439
+ }),
440
+ onClose: closeSettings,
441
+ children: /*#__PURE__*/ _jsx(Box, {
442
+ padding: "4",
443
+ minWidth: "200px",
444
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
445
+ gap: "4",
446
+ children: [
447
+ /*#__PURE__*/ _jsx(Text, {
448
+ variant: "headingSm",
449
+ children: "Settings"
450
+ }),
451
+ /*#__PURE__*/ _jsxs(VerticalStack, {
452
+ gap: "4",
453
+ children: [
454
+ /*#__PURE__*/ _jsxs(HorizontalStack, {
455
+ gap: "2",
456
+ blockAlign: "center",
457
+ children: [
458
+ /*#__PURE__*/ _jsx("input", {
459
+ type: "checkbox",
460
+ defaultChecked: true
461
+ }),
462
+ /*#__PURE__*/ _jsx(Text, {
463
+ variant: "bodySm",
464
+ children: "Enable notifications"
465
+ })
466
+ ]
467
+ }),
468
+ /*#__PURE__*/ _jsxs(HorizontalStack, {
469
+ gap: "2",
470
+ blockAlign: "center",
471
+ children: [
472
+ /*#__PURE__*/ _jsx("input", {
473
+ type: "checkbox"
474
+ }),
475
+ /*#__PURE__*/ _jsx(Text, {
476
+ variant: "bodySm",
477
+ children: "Auto-save"
478
+ })
479
+ ]
480
+ }),
481
+ /*#__PURE__*/ _jsxs(VerticalStack, {
482
+ gap: "2",
483
+ children: [
484
+ /*#__PURE__*/ _jsx(Text, {
485
+ variant: "bodySm",
486
+ children: "Theme"
487
+ }),
488
+ /*#__PURE__*/ _jsx(Box, {
489
+ children: /*#__PURE__*/ _jsxs("select", {
490
+ style: {
491
+ width: "100%",
492
+ padding: "0.25rem"
493
+ },
494
+ children: [
495
+ /*#__PURE__*/ _jsx("option", {
496
+ children: "Light"
497
+ }),
498
+ /*#__PURE__*/ _jsx("option", {
499
+ children: "Dark"
500
+ }),
501
+ /*#__PURE__*/ _jsx("option", {
502
+ children: "Auto"
503
+ })
504
+ ]
505
+ })
506
+ })
507
+ ]
508
+ })
509
+ ]
510
+ })
511
+ ]
512
+ })
513
+ })
514
+ }),
515
+ /*#__PURE__*/ _jsx(Popover, {
516
+ active: helpActive,
517
+ activator: /*#__PURE__*/ _jsx(Button, {
518
+ onClick: openHelp,
519
+ children: "Help Menu"
520
+ }),
521
+ onClose: closeHelp,
522
+ children: /*#__PURE__*/ _jsx(Box, {
523
+ padding: "4",
524
+ minWidth: "180px",
525
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
526
+ gap: "2",
527
+ children: [
528
+ /*#__PURE__*/ _jsx(Text, {
529
+ variant: "headingSm",
530
+ children: "Help & Support"
531
+ }),
532
+ /*#__PURE__*/ _jsxs(VerticalStack, {
533
+ gap: "1",
534
+ children: [
535
+ /*#__PURE__*/ _jsx(Button, {
536
+ size: "slim",
537
+ plain: true,
538
+ textAlign: "left",
539
+ children: "User Guide"
540
+ }),
541
+ /*#__PURE__*/ _jsx(Button, {
542
+ size: "slim",
543
+ plain: true,
544
+ textAlign: "left",
545
+ children: "Keyboard Shortcuts"
546
+ }),
547
+ /*#__PURE__*/ _jsx(Button, {
548
+ size: "slim",
549
+ plain: true,
550
+ textAlign: "left",
551
+ children: "Contact Support"
552
+ }),
553
+ /*#__PURE__*/ _jsx(Box, {
554
+ paddingBlockStart: "2",
555
+ paddingBlockEnd: "2",
556
+ children: /*#__PURE__*/ _jsx("hr", {})
557
+ }),
558
+ /*#__PURE__*/ _jsx(Button, {
559
+ size: "slim",
560
+ plain: true,
561
+ textAlign: "left",
562
+ children: "About"
563
+ })
564
+ ]
565
+ })
566
+ ]
567
+ })
568
+ })
569
+ })
570
+ ]
571
+ }),
572
+ /*#__PURE__*/ _jsx(Text, {
573
+ variant: "bodySm",
574
+ color: "subdued",
575
+ children: "Notice how opening one popover automatically closes the others to prevent conflicts."
576
+ })
577
+ ]
578
+ }),
579
+ /*#__PURE__*/ _jsx(Box, {
580
+ padding: "4",
581
+ background: "subdued",
582
+ borderRadius: "default",
583
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
584
+ gap: "2",
585
+ children: [
586
+ /*#__PURE__*/ _jsx(Text, {
587
+ variant: "headingSm",
588
+ children: "Conflict Resolution Status"
589
+ }),
590
+ /*#__PURE__*/ _jsxs(VerticalStack, {
591
+ gap: "1",
592
+ children: [
593
+ /*#__PURE__*/ _jsxs(Text, {
594
+ variant: "bodyXs",
595
+ children: [
596
+ "Active Popover: ",
597
+ PopoverManager.getActivePopoverId() || "None"
598
+ ]
599
+ }),
600
+ /*#__PURE__*/ _jsxs(Text, {
601
+ variant: "bodyXs",
602
+ children: [
603
+ "Total Open: ",
604
+ activePopovers.length
605
+ ]
606
+ }),
607
+ /*#__PURE__*/ _jsxs(Text, {
608
+ variant: "bodyXs",
609
+ children: [
610
+ "Context Menu: ",
611
+ contextMenuActive ? "✓ Open" : "✗ Closed"
612
+ ]
613
+ }),
614
+ /*#__PURE__*/ _jsxs(Text, {
615
+ variant: "bodyXs",
616
+ children: [
617
+ "Settings Panel: ",
618
+ settingsActive ? "✓ Open" : "✗ Closed"
619
+ ]
620
+ }),
621
+ /*#__PURE__*/ _jsxs(Text, {
622
+ variant: "bodyXs",
623
+ children: [
624
+ "Help Menu: ",
625
+ helpActive ? "✓ Open" : "✗ Closed"
626
+ ]
627
+ })
628
+ ]
629
+ })
630
+ ]
631
+ })
632
+ })
633
+ ]
634
+ })
635
+ });
636
+ },
637
+ parameters: {
638
+ docs: {
639
+ description: {
640
+ story: "Demonstrates how PopoverManager resolves conflicts between competing popovers."
641
+ }
642
+ }
643
+ }
644
+ };
645
+ export var ApplicationIntegration = {
646
+ render: function() {
647
+ var _useState = _sliced_to_array(useState([]), 2), activePopovers = _useState[0], setActivePopovers = _useState[1];
648
+ var _useState1 = _sliced_to_array(useState(false), 2), userMenuActive = _useState1[0], setUserMenuActive = _useState1[1];
649
+ var _useState2 = _sliced_to_array(useState(false), 2), notificationsActive = _useState2[0], setNotificationsActive = _useState2[1];
650
+ var _useState3 = _sliced_to_array(useState(false), 2), searchActive = _useState3[0], setSearchActive = _useState3[1];
651
+ useEffect(function() {
652
+ var handleManagerChange = function() {
653
+ setActivePopovers(_to_consumable_array(PopoverManager.activePopovers));
654
+ };
655
+ PopoverManager.on("change", handleManagerChange);
656
+ return function() {
657
+ PopoverManager.removeListener("change", handleManagerChange);
658
+ };
659
+ }, []);
660
+ var toggleUserMenu = function() {
661
+ if (userMenuActive) {
662
+ PopoverManager.close("userMenu");
663
+ setUserMenuActive(false);
664
+ } else {
665
+ PopoverManager.open("userMenu");
666
+ setUserMenuActive(true);
667
+ }
668
+ };
669
+ var toggleNotifications = function() {
670
+ if (notificationsActive) {
671
+ PopoverManager.close("notifications");
672
+ setNotificationsActive(false);
673
+ } else {
674
+ PopoverManager.open("notifications");
675
+ setNotificationsActive(true);
676
+ }
677
+ };
678
+ var toggleSearch = function() {
679
+ if (searchActive) {
680
+ PopoverManager.close("search");
681
+ setSearchActive(false);
682
+ } else {
683
+ PopoverManager.open("search");
684
+ setSearchActive(true);
685
+ }
686
+ };
687
+ var closeAll = function() {
688
+ PopoverManager.closeAll();
689
+ setUserMenuActive(false);
690
+ setNotificationsActive(false);
691
+ setSearchActive(false);
692
+ };
693
+ return /*#__PURE__*/ _jsxs(Page, {
694
+ title: "Application Header",
695
+ children: [
696
+ /*#__PURE__*/ _jsx(Box, {
697
+ padding: "4",
698
+ background: "subdued",
699
+ borderRadius: "lg",
700
+ marginBlockEnd: "8",
701
+ children: /*#__PURE__*/ _jsxs(HorizontalStack, {
702
+ align: "space-between",
703
+ blockAlign: "center",
704
+ children: [
705
+ /*#__PURE__*/ _jsx(Text, {
706
+ variant: "headingLg",
707
+ children: "My Application"
708
+ }),
709
+ /*#__PURE__*/ _jsxs(HorizontalStack, {
710
+ gap: "4",
711
+ blockAlign: "center",
712
+ children: [
713
+ /*#__PURE__*/ _jsx(Popover, {
714
+ active: searchActive,
715
+ activator: /*#__PURE__*/ _jsx(Button, {
716
+ plain: true,
717
+ onClick: toggleSearch,
718
+ children: "\uD83D\uDD0D Search"
719
+ }),
720
+ onClose: function() {
721
+ PopoverManager.close("search");
722
+ setSearchActive(false);
723
+ },
724
+ children: /*#__PURE__*/ _jsx(Box, {
725
+ padding: "4",
726
+ minWidth: "300px",
727
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
728
+ gap: "4",
729
+ children: [
730
+ /*#__PURE__*/ _jsx("input", {
731
+ type: "text",
732
+ placeholder: "Search anything...",
733
+ style: {
734
+ width: "100%",
735
+ padding: "0.5rem",
736
+ border: "1px solid #ccc",
737
+ borderRadius: "4px"
738
+ }
739
+ }),
740
+ /*#__PURE__*/ _jsxs(VerticalStack, {
741
+ gap: "1",
742
+ children: [
743
+ /*#__PURE__*/ _jsx(Text, {
744
+ variant: "bodySm",
745
+ color: "subdued",
746
+ children: "Recent searches:"
747
+ }),
748
+ /*#__PURE__*/ _jsx(Button, {
749
+ size: "slim",
750
+ plain: true,
751
+ textAlign: "left",
752
+ children: "User management"
753
+ }),
754
+ /*#__PURE__*/ _jsx(Button, {
755
+ size: "slim",
756
+ plain: true,
757
+ textAlign: "left",
758
+ children: "Product catalog"
759
+ }),
760
+ /*#__PURE__*/ _jsx(Button, {
761
+ size: "slim",
762
+ plain: true,
763
+ textAlign: "left",
764
+ children: "Analytics dashboard"
765
+ })
766
+ ]
767
+ })
768
+ ]
769
+ })
770
+ })
771
+ }),
772
+ /*#__PURE__*/ _jsx(Popover, {
773
+ active: notificationsActive,
774
+ activator: /*#__PURE__*/ _jsx(Button, {
775
+ plain: true,
776
+ onClick: toggleNotifications,
777
+ children: "\uD83D\uDD14 Notifications (3)"
778
+ }),
779
+ onClose: function() {
780
+ PopoverManager.close("notifications");
781
+ setNotificationsActive(false);
782
+ },
783
+ children: /*#__PURE__*/ _jsx(Box, {
784
+ padding: "4",
785
+ minWidth: "280px",
786
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
787
+ gap: "4",
788
+ children: [
789
+ /*#__PURE__*/ _jsx(Text, {
790
+ variant: "headingSm",
791
+ children: "Notifications"
792
+ }),
793
+ /*#__PURE__*/ _jsx(VerticalStack, {
794
+ gap: "2",
795
+ children: [
796
+ {
797
+ title: "New order received",
798
+ time: "2 minutes ago",
799
+ unread: true
800
+ },
801
+ {
802
+ title: "System maintenance scheduled",
803
+ time: "1 hour ago",
804
+ unread: true
805
+ },
806
+ {
807
+ title: "Monthly report ready",
808
+ time: "3 hours ago",
809
+ unread: false
810
+ }
811
+ ].map(function(notification, index) {
812
+ return /*#__PURE__*/ _jsx(Box, {
813
+ padding: "3",
814
+ background: notification.unread ? "surface-neutral-subdued" : "surface-neutral",
815
+ borderRadius: "default",
816
+ style: {
817
+ borderLeft: notification.unread ? "3px solid #007bff" : "3px solid transparent"
818
+ },
819
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
820
+ gap: "1",
821
+ children: [
822
+ /*#__PURE__*/ _jsx(Text, {
823
+ variant: "bodySm",
824
+ fontWeight: notification.unread ? "bold" : "normal",
825
+ children: notification.title
826
+ }),
827
+ /*#__PURE__*/ _jsx(Text, {
828
+ variant: "bodyXs",
829
+ color: "subdued",
830
+ children: notification.time
831
+ })
832
+ ]
833
+ })
834
+ }, index);
835
+ })
836
+ }),
837
+ /*#__PURE__*/ _jsx(VerticalStack, {
838
+ inlineAlign: "center",
839
+ children: /*#__PURE__*/ _jsx(Button, {
840
+ size: "slim",
841
+ children: "View all notifications"
842
+ })
843
+ })
844
+ ]
845
+ })
846
+ })
847
+ }),
848
+ /*#__PURE__*/ _jsx(Popover, {
849
+ active: userMenuActive,
850
+ activator: /*#__PURE__*/ _jsx(Button, {
851
+ plain: true,
852
+ onClick: toggleUserMenu,
853
+ children: "\uD83D\uDC64 John Doe"
854
+ }),
855
+ onClose: function() {
856
+ PopoverManager.close("userMenu");
857
+ setUserMenuActive(false);
858
+ },
859
+ children: /*#__PURE__*/ _jsx(Box, {
860
+ padding: "4",
861
+ minWidth: "200px",
862
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
863
+ gap: "4",
864
+ children: [
865
+ /*#__PURE__*/ _jsxs(VerticalStack, {
866
+ gap: "2",
867
+ inlineAlign: "center",
868
+ children: [
869
+ /*#__PURE__*/ _jsx("div", {
870
+ style: {
871
+ width: "40px",
872
+ height: "40px",
873
+ borderRadius: "50%",
874
+ backgroundColor: "#007bff",
875
+ color: "white",
876
+ display: "flex",
877
+ alignItems: "center",
878
+ justifyContent: "center"
879
+ },
880
+ children: "JD"
881
+ }),
882
+ /*#__PURE__*/ _jsx(Text, {
883
+ variant: "headingSm",
884
+ children: "John Doe"
885
+ }),
886
+ /*#__PURE__*/ _jsx(Text, {
887
+ variant: "bodySm",
888
+ color: "subdued",
889
+ children: "john@example.com"
890
+ })
891
+ ]
892
+ }),
893
+ /*#__PURE__*/ _jsxs(VerticalStack, {
894
+ gap: "1",
895
+ children: [
896
+ /*#__PURE__*/ _jsx(Button, {
897
+ size: "slim",
898
+ plain: true,
899
+ textAlign: "left",
900
+ children: "Profile Settings"
901
+ }),
902
+ /*#__PURE__*/ _jsx(Button, {
903
+ size: "slim",
904
+ plain: true,
905
+ textAlign: "left",
906
+ children: "Account"
907
+ }),
908
+ /*#__PURE__*/ _jsx(Button, {
909
+ size: "slim",
910
+ plain: true,
911
+ textAlign: "left",
912
+ children: "Preferences"
913
+ }),
914
+ /*#__PURE__*/ _jsx(Box, {
915
+ paddingBlockStart: "2",
916
+ paddingBlockEnd: "2",
917
+ children: /*#__PURE__*/ _jsx("hr", {})
918
+ }),
919
+ /*#__PURE__*/ _jsx(Button, {
920
+ size: "slim",
921
+ plain: true,
922
+ textAlign: "left",
923
+ children: "Help & Support"
924
+ }),
925
+ /*#__PURE__*/ _jsx(Button, {
926
+ size: "slim",
927
+ plain: true,
928
+ textAlign: "left",
929
+ destructive: true,
930
+ children: "Sign Out"
931
+ })
932
+ ]
933
+ })
934
+ ]
935
+ })
936
+ })
937
+ })
938
+ ]
939
+ })
940
+ ]
941
+ })
942
+ }),
943
+ /*#__PURE__*/ _jsxs(Card, {
944
+ title: "PopoverManager in Real Applications",
945
+ padded: true,
946
+ children: [
947
+ /*#__PURE__*/ _jsxs(VerticalStack, {
948
+ gap: "4",
949
+ children: [
950
+ /*#__PURE__*/ _jsx(Text, {
951
+ children: "The header above demonstrates how PopoverManager works in a real application scenario, coordinating multiple interface elements like search, notifications, and user menus."
952
+ }),
953
+ /*#__PURE__*/ _jsx(HorizontalStack, {
954
+ gap: "4",
955
+ children: /*#__PURE__*/ _jsx(Button, {
956
+ onClick: closeAll,
957
+ destructive: true,
958
+ size: "slim",
959
+ children: "Close All Popovers"
960
+ })
961
+ })
962
+ ]
963
+ }),
964
+ /*#__PURE__*/ _jsx(Box, {
965
+ marginBlockStart: "8",
966
+ padding: "4",
967
+ background: "subdued",
968
+ borderRadius: "default",
969
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
970
+ gap: "2",
971
+ children: [
972
+ /*#__PURE__*/ _jsx(Text, {
973
+ variant: "headingSm",
974
+ children: "Application State"
975
+ }),
976
+ /*#__PURE__*/ _jsxs(VerticalStack, {
977
+ gap: "1",
978
+ children: [
979
+ /*#__PURE__*/ _jsxs(Text, {
980
+ variant: "bodyXs",
981
+ children: [
982
+ "Active Popovers: ",
983
+ activePopovers.join(", ") || "None"
984
+ ]
985
+ }),
986
+ /*#__PURE__*/ _jsxs(Text, {
987
+ variant: "bodyXs",
988
+ children: [
989
+ "Search: ",
990
+ searchActive ? "✓ Open" : "✗ Closed"
991
+ ]
992
+ }),
993
+ /*#__PURE__*/ _jsxs(Text, {
994
+ variant: "bodyXs",
995
+ children: [
996
+ "Notifications: ",
997
+ notificationsActive ? "✓ Open" : "✗ Closed"
998
+ ]
999
+ }),
1000
+ /*#__PURE__*/ _jsxs(Text, {
1001
+ variant: "bodyXs",
1002
+ children: [
1003
+ "User Menu: ",
1004
+ userMenuActive ? "✓ Open" : "✗ Closed"
1005
+ ]
1006
+ })
1007
+ ]
1008
+ })
1009
+ ]
1010
+ })
1011
+ })
1012
+ ]
1013
+ })
1014
+ ]
1015
+ });
1016
+ },
1017
+ parameters: {
1018
+ docs: {
1019
+ description: {
1020
+ story: "Real-world application integration showing PopoverManager coordinating header elements."
1021
+ }
1022
+ }
1023
+ }
1024
+ };
1025
+ export var EventHandling = {
1026
+ render: function() {
1027
+ var _useState = _sliced_to_array(useState([]), 2), eventLog = _useState[0], setEventLog = _useState[1];
1028
+ var _useState1 = _sliced_to_array(useState({
1029
+ popover1: false,
1030
+ popover2: false,
1031
+ popover3: false
1032
+ }), 2), popoverStates = _useState1[0], setPopoverStates = _useState1[1];
1033
+ useEffect(function() {
1034
+ var handleManagerChange = function() {
1035
+ var timestamp = new Date().toLocaleTimeString();
1036
+ var activeIds = _to_consumable_array(PopoverManager.activePopovers);
1037
+ setEventLog(function(prev) {
1038
+ return [
1039
+ "".concat(timestamp, ": Manager state changed - Active: [").concat(activeIds.join(", "), "]")
1040
+ ].concat(_to_consumable_array(prev.slice(0, 9)));
1041
+ });
1042
+ };
1043
+ PopoverManager.on("change", handleManagerChange);
1044
+ return function() {
1045
+ PopoverManager.removeListener("change", handleManagerChange);
1046
+ };
1047
+ }, []);
1048
+ var togglePopover = function(id) {
1049
+ if (popoverStates[id]) {
1050
+ PopoverManager.close(id);
1051
+ setPopoverStates(function(prev) {
1052
+ return _object_spread_props(_object_spread({}, prev), _define_property({}, id, false));
1053
+ });
1054
+ } else {
1055
+ PopoverManager.open(id);
1056
+ setPopoverStates(function(prev) {
1057
+ return _object_spread_props(_object_spread({}, prev), _define_property({}, id, true));
1058
+ });
1059
+ }
1060
+ };
1061
+ var clearEventLog = function() {
1062
+ setEventLog([]);
1063
+ };
1064
+ return /*#__PURE__*/ _jsx(Card, {
1065
+ title: "PopoverManager Event Handling",
1066
+ padded: true,
1067
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
1068
+ gap: "8",
1069
+ children: [
1070
+ /*#__PURE__*/ _jsxs(VerticalStack, {
1071
+ gap: "4",
1072
+ children: [
1073
+ /*#__PURE__*/ _jsx(Text, {
1074
+ children: "PopoverManager emits events when its state changes. This is useful for debugging and for components that need to react to popover state changes."
1075
+ }),
1076
+ /*#__PURE__*/ _jsx(HorizontalStack, {
1077
+ gap: "4",
1078
+ children: [
1079
+ 1,
1080
+ 2,
1081
+ 3
1082
+ ].map(function(num) {
1083
+ return /*#__PURE__*/ _jsx(Popover, {
1084
+ active: popoverStates["popover".concat(num)],
1085
+ activator: /*#__PURE__*/ _jsxs(Button, {
1086
+ onClick: function() {
1087
+ return togglePopover("popover".concat(num));
1088
+ },
1089
+ children: [
1090
+ "Toggle Popover ",
1091
+ num
1092
+ ]
1093
+ }),
1094
+ onClose: function() {
1095
+ PopoverManager.close("popover".concat(num));
1096
+ setPopoverStates(function(prev) {
1097
+ return _object_spread_props(_object_spread({}, prev), _define_property({}, "popover".concat(num), false));
1098
+ });
1099
+ },
1100
+ children: /*#__PURE__*/ _jsx(Box, {
1101
+ padding: "4",
1102
+ minWidth: "150px",
1103
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
1104
+ gap: "2",
1105
+ children: [
1106
+ /*#__PURE__*/ _jsxs(Text, {
1107
+ variant: "headingSm",
1108
+ children: [
1109
+ "Popover ",
1110
+ num
1111
+ ]
1112
+ }),
1113
+ /*#__PURE__*/ _jsxs(Text, {
1114
+ children: [
1115
+ "This is popover number ",
1116
+ num,
1117
+ "."
1118
+ ]
1119
+ }),
1120
+ /*#__PURE__*/ _jsx(Button, {
1121
+ size: "slim",
1122
+ onClick: function() {
1123
+ return togglePopover("popover".concat(num));
1124
+ },
1125
+ children: "Close"
1126
+ })
1127
+ ]
1128
+ })
1129
+ })
1130
+ }, num);
1131
+ })
1132
+ })
1133
+ ]
1134
+ }),
1135
+ /*#__PURE__*/ _jsx(Box, {
1136
+ padding: "4",
1137
+ background: "subdued",
1138
+ borderRadius: "default",
1139
+ children: /*#__PURE__*/ _jsxs(VerticalStack, {
1140
+ gap: "4",
1141
+ children: [
1142
+ /*#__PURE__*/ _jsxs(HorizontalStack, {
1143
+ align: "space-between",
1144
+ blockAlign: "center",
1145
+ children: [
1146
+ /*#__PURE__*/ _jsx(Text, {
1147
+ variant: "headingSm",
1148
+ children: "Event Log"
1149
+ }),
1150
+ /*#__PURE__*/ _jsx(Button, {
1151
+ size: "slim",
1152
+ onClick: clearEventLog,
1153
+ children: "Clear Log"
1154
+ })
1155
+ ]
1156
+ }),
1157
+ /*#__PURE__*/ _jsx("div", {
1158
+ style: {
1159
+ maxHeight: "200px",
1160
+ overflowY: "auto",
1161
+ backgroundColor: "#000",
1162
+ color: "#00ff00",
1163
+ padding: "0.5rem",
1164
+ borderRadius: "4px",
1165
+ fontFamily: "monospace",
1166
+ fontSize: "0.8rem"
1167
+ },
1168
+ children: eventLog.length > 0 ? eventLog.map(function(event, index) {
1169
+ return /*#__PURE__*/ _jsx("div", {
1170
+ children: event
1171
+ }, index);
1172
+ }) : /*#__PURE__*/ _jsx("div", {
1173
+ style: {
1174
+ color: "#666"
1175
+ },
1176
+ children: "No events logged yet..."
1177
+ })
1178
+ })
1179
+ ]
1180
+ })
1181
+ })
1182
+ ]
1183
+ })
1184
+ });
1185
+ },
1186
+ parameters: {
1187
+ docs: {
1188
+ description: {
1189
+ story: "Demonstrates event handling and logging capabilities of PopoverManager."
1190
+ }
1191
+ }
1192
+ }
1193
+ };