@canonical/react-ds-global 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +72 -0
  2. package/dist/esm/lib/_work_in_progress/Announcement/styles.css +51 -47
  3. package/dist/esm/lib/_work_in_progress/CategoriesSection/common/Category/styles.css +21 -17
  4. package/dist/esm/lib/_work_in_progress/CategoriesSection/styles.css +16 -12
  5. package/dist/esm/lib/_work_in_progress/ChatSection/styles.css +22 -18
  6. package/dist/esm/lib/_work_in_progress/DescriptionSection/styles.css +14 -10
  7. package/dist/esm/lib/_work_in_progress/IconSection/styles.css +18 -14
  8. package/dist/esm/lib/_work_in_progress/Label/styles.css +36 -32
  9. package/dist/esm/lib/_work_in_progress/Link/styles.css +32 -28
  10. package/dist/esm/lib/_work_in_progress/Rule/styles.css +21 -14
  11. package/dist/esm/lib/_work_in_progress/Section/styles.css +66 -62
  12. package/dist/esm/lib/_work_in_progress/SkipLink/styles.css +35 -32
  13. package/dist/esm/lib/_work_in_progress/TSection/styles.css +26 -22
  14. package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js +4 -1
  15. package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.js.map +1 -1
  16. package/dist/esm/lib/_work_in_progress/grid/ApplicationLayout/styles.css +21 -17
  17. package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js +4 -1
  18. package/dist/esm/lib/_work_in_progress/grid/GridCard/GridCard.js.map +1 -1
  19. package/dist/esm/lib/_work_in_progress/grid/GridCard/styles.css +8 -4
  20. package/dist/esm/lib/_work_in_progress/grid/InnerGridDemo/styles.css +38 -33
  21. package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js +4 -1
  22. package/dist/esm/lib/_work_in_progress/grid/SettingsView/SettingsView.js.map +1 -1
  23. package/dist/esm/lib/_work_in_progress/grid/SettingsView/styles.css +23 -19
  24. package/dist/esm/lib/component/Accordion/common/Item/styles.css +305 -299
  25. package/dist/esm/lib/component/Accordion/styles.css +35 -31
  26. package/dist/esm/lib/component/Badge/hooks/useBadge.js +1 -1
  27. package/dist/esm/lib/component/Badge/hooks/useBadge.js.map +1 -1
  28. package/dist/esm/lib/component/Badge/styles.css +45 -41
  29. package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js +1 -1
  30. package/dist/esm/lib/component/Breadcrumbs/Breadcrumbs.js.map +1 -1
  31. package/dist/esm/lib/component/Breadcrumbs/common/Item/styles.css +69 -65
  32. package/dist/esm/lib/component/Breadcrumbs/styles.css +30 -26
  33. package/dist/esm/lib/component/Button/styles.css +293 -260
  34. package/dist/esm/lib/component/Card/common/Content/styles.css +27 -23
  35. package/dist/esm/lib/component/Card/common/Footer/styles.css +30 -26
  36. package/dist/esm/lib/component/Card/common/Header/styles.css +25 -21
  37. package/dist/esm/lib/component/Card/common/Image/styles.css +8 -4
  38. package/dist/esm/lib/component/Card/styles.css +77 -73
  39. package/dist/esm/lib/component/Chip/Chip.js.map +1 -1
  40. package/dist/esm/lib/component/Chip/styles.css +105 -101
  41. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +29 -20
  42. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -1
  43. package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js +25 -2
  44. package/dist/esm/lib/component/ContextualMenu/common/Item/Item.js.map +1 -1
  45. package/dist/esm/lib/component/ContextualMenu/common/Item/styles.css +116 -106
  46. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js +29 -9
  47. package/dist/esm/lib/component/ContextualMenu/common/SubMenu/SubMenu.js.map +1 -1
  48. package/dist/esm/lib/component/ContextualMenu/styles.css +74 -72
  49. package/dist/esm/lib/component/Icon/styles.css +24 -20
  50. package/dist/esm/lib/component/InlineCode/styles.css +19 -15
  51. package/dist/esm/lib/component/KeyboardKey/styles.css +44 -40
  52. package/dist/esm/lib/component/Popover/Popover.js.map +1 -1
  53. package/dist/esm/lib/component/Popover/styles.css +59 -52
  54. package/dist/esm/lib/component/Tabs/common/Item/styles.css +80 -76
  55. package/dist/esm/lib/component/Tabs/styles.css +36 -32
  56. package/dist/esm/lib/component/Tile/common/Content/styles.css +28 -24
  57. package/dist/esm/lib/component/Tile/common/Header/styles.css +28 -24
  58. package/dist/esm/lib/component/Tile/styles.css +31 -27
  59. package/dist/esm/lib/component/Tooltip/styles.css +213 -208
  60. package/dist/esm/lib/group/Cards/styles.css +26 -22
  61. package/dist/esm/lib/group/KeyboardKeys/styles.css +14 -10
  62. package/dist/esm/lib/hooks/useContextualMenu/index.js +1 -0
  63. package/dist/esm/lib/hooks/useContextualMenu/index.js.map +1 -1
  64. package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js +11 -0
  65. package/dist/esm/lib/hooks/useContextualMenu/isMenuSeparator.js.map +1 -0
  66. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js +54 -34
  67. package/dist/esm/lib/hooks/useContextualMenu/useContextualMenu.js.map +1 -1
  68. package/dist/esm/lib/hooks/useDisclosure/useDisclosure.js.map +1 -1
  69. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js +1 -1
  70. package/dist/esm/lib/hooks/useWindowDimensions/useWindowDimensions.js.map +1 -1
  71. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js +3 -0
  72. package/dist/esm/lib/hooks/useWindowFitment/useWindowFitment.js.map +1 -1
  73. package/dist/esm/lib/index.css +79 -0
  74. package/dist/esm/lib/pattern/Modal/Context.js +10 -0
  75. package/dist/esm/lib/pattern/Modal/Context.js.map +1 -0
  76. package/dist/esm/lib/pattern/Modal/Provider.js +103 -0
  77. package/dist/esm/lib/pattern/Modal/Provider.js.map +1 -0
  78. package/dist/esm/lib/pattern/Modal/common/Content/Content.js +15 -0
  79. package/dist/esm/lib/pattern/Modal/common/Content/Content.js.map +1 -0
  80. package/dist/esm/lib/pattern/Modal/common/Content/index.js +3 -0
  81. package/dist/esm/lib/pattern/Modal/common/Content/index.js.map +1 -0
  82. package/dist/esm/lib/pattern/Modal/common/Content/styles.css +37 -0
  83. package/dist/esm/lib/pattern/Modal/common/Content/types.js +2 -0
  84. package/dist/esm/lib/pattern/Modal/common/Content/types.js.map +1 -0
  85. package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js +16 -0
  86. package/dist/esm/lib/pattern/Modal/common/Footer/Footer.js.map +1 -0
  87. package/dist/esm/lib/pattern/Modal/common/Footer/index.js +3 -0
  88. package/dist/esm/lib/pattern/Modal/common/Footer/index.js.map +1 -0
  89. package/dist/esm/lib/pattern/Modal/common/Footer/styles.css +57 -0
  90. package/dist/esm/lib/pattern/Modal/common/Footer/types.js +2 -0
  91. package/dist/esm/lib/pattern/Modal/common/Footer/types.js.map +1 -0
  92. package/dist/esm/lib/pattern/Modal/common/Header/Header.js +27 -0
  93. package/dist/esm/lib/pattern/Modal/common/Header/Header.js.map +1 -0
  94. package/dist/esm/lib/pattern/Modal/common/Header/index.js +3 -0
  95. package/dist/esm/lib/pattern/Modal/common/Header/index.js.map +1 -0
  96. package/dist/esm/lib/pattern/Modal/common/Header/styles.css +79 -0
  97. package/dist/esm/lib/pattern/Modal/common/Header/types.js +2 -0
  98. package/dist/esm/lib/pattern/Modal/common/Header/types.js.map +1 -0
  99. package/dist/esm/lib/pattern/Modal/common/index.js +5 -0
  100. package/dist/esm/lib/pattern/Modal/common/index.js.map +1 -0
  101. package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js +11 -0
  102. package/dist/esm/lib/pattern/Modal/hooks/useModalContext.js.map +1 -0
  103. package/dist/esm/lib/pattern/Modal/hooks/useModalState.js +15 -0
  104. package/dist/esm/lib/pattern/Modal/hooks/useModalState.js.map +1 -0
  105. package/dist/esm/lib/pattern/Modal/index.js +4 -0
  106. package/dist/esm/lib/pattern/Modal/index.js.map +1 -0
  107. package/dist/esm/lib/pattern/Modal/styles.css +119 -0
  108. package/dist/esm/lib/pattern/Modal/types.js +2 -0
  109. package/dist/esm/lib/pattern/Modal/types.js.map +1 -0
  110. package/dist/esm/lib/pattern/Modal/withModal.js +102 -0
  111. package/dist/esm/lib/pattern/Modal/withModal.js.map +1 -0
  112. package/dist/esm/lib/pattern/Timeline/common/Content/styles.css +16 -12
  113. package/dist/esm/lib/pattern/Timeline/common/Event/styles.css +116 -112
  114. package/dist/esm/lib/pattern/Timeline/styles.css +16 -12
  115. package/dist/esm/lib/pattern/index.js +1 -0
  116. package/dist/esm/lib/pattern/index.js.map +1 -1
  117. package/dist/esm/lib/subcomponent/Spinner/styles.css +38 -34
  118. package/dist/types/lib/_work_in_progress/grid/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
  119. package/dist/types/lib/_work_in_progress/grid/GridCard/GridCard.d.ts.map +1 -1
  120. package/dist/types/lib/_work_in_progress/grid/SettingsView/SettingsView.d.ts.map +1 -1
  121. package/dist/types/lib/component/Badge/types.d.ts +1 -1
  122. package/dist/types/lib/component/Badge/types.d.ts.map +1 -1
  123. package/dist/types/lib/component/Breadcrumbs/types.d.ts +2 -2
  124. package/dist/types/lib/component/Breadcrumbs/types.d.ts.map +1 -1
  125. package/dist/types/lib/component/Chip/Chip.d.ts +2 -2
  126. package/dist/types/lib/component/Chip/Chip.d.ts.map +1 -1
  127. package/dist/types/lib/component/Chip/types.d.ts +10 -8
  128. package/dist/types/lib/component/Chip/types.d.ts.map +1 -1
  129. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts +4 -4
  130. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -1
  131. package/dist/types/lib/component/ContextualMenu/common/Item/Item.d.ts.map +1 -1
  132. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts +1 -1
  133. package/dist/types/lib/component/ContextualMenu/common/MenuContext.d.ts.map +1 -1
  134. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts +9 -7
  135. package/dist/types/lib/component/ContextualMenu/common/SubMenu/SubMenu.d.ts.map +1 -1
  136. package/dist/types/lib/component/ContextualMenu/types.d.ts +14 -6
  137. package/dist/types/lib/component/ContextualMenu/types.d.ts.map +1 -1
  138. package/dist/types/lib/component/Tabs/types.d.ts +2 -2
  139. package/dist/types/lib/component/Tabs/types.d.ts.map +1 -1
  140. package/dist/types/lib/hooks/useContextualMenu/index.d.ts +1 -0
  141. package/dist/types/lib/hooks/useContextualMenu/index.d.ts.map +1 -1
  142. package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts +13 -0
  143. package/dist/types/lib/hooks/useContextualMenu/isMenuSeparator.d.ts.map +1 -0
  144. package/dist/types/lib/hooks/useContextualMenu/types.d.ts +45 -15
  145. package/dist/types/lib/hooks/useContextualMenu/types.d.ts.map +1 -1
  146. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts +5 -6
  147. package/dist/types/lib/hooks/useContextualMenu/useContextualMenu.d.ts.map +1 -1
  148. package/dist/types/lib/hooks/useDisclosure/types.d.ts +7 -2
  149. package/dist/types/lib/hooks/useDisclosure/types.d.ts.map +1 -1
  150. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts +1 -1
  151. package/dist/types/lib/hooks/useDisclosure/useDisclosure.d.ts.map +1 -1
  152. package/dist/types/lib/hooks/useWindowFitment/types.d.ts +12 -3
  153. package/dist/types/lib/hooks/useWindowFitment/types.d.ts.map +1 -1
  154. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts +1 -1
  155. package/dist/types/lib/hooks/useWindowFitment/useWindowFitment.d.ts.map +1 -1
  156. package/dist/types/lib/pattern/Modal/Context.d.ts +10 -0
  157. package/dist/types/lib/pattern/Modal/Context.d.ts.map +1 -0
  158. package/dist/types/lib/pattern/Modal/Provider.d.ts +63 -0
  159. package/dist/types/lib/pattern/Modal/Provider.d.ts.map +1 -0
  160. package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts +17 -0
  161. package/dist/types/lib/pattern/Modal/common/Content/Content.d.ts.map +1 -0
  162. package/dist/types/lib/pattern/Modal/common/Content/index.d.ts +3 -0
  163. package/dist/types/lib/pattern/Modal/common/Content/index.d.ts.map +1 -0
  164. package/dist/types/lib/pattern/Modal/common/Content/types.d.ts +15 -0
  165. package/dist/types/lib/pattern/Modal/common/Content/types.d.ts.map +1 -0
  166. package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts +18 -0
  167. package/dist/types/lib/pattern/Modal/common/Footer/Footer.d.ts.map +1 -0
  168. package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts +3 -0
  169. package/dist/types/lib/pattern/Modal/common/Footer/index.d.ts.map +1 -0
  170. package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts +16 -0
  171. package/dist/types/lib/pattern/Modal/common/Footer/types.d.ts.map +1 -0
  172. package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts +24 -0
  173. package/dist/types/lib/pattern/Modal/common/Header/Header.d.ts.map +1 -0
  174. package/dist/types/lib/pattern/Modal/common/Header/index.d.ts +3 -0
  175. package/dist/types/lib/pattern/Modal/common/Header/index.d.ts.map +1 -0
  176. package/dist/types/lib/pattern/Modal/common/Header/types.d.ts +36 -0
  177. package/dist/types/lib/pattern/Modal/common/Header/types.d.ts.map +1 -0
  178. package/dist/types/lib/pattern/Modal/common/index.d.ts +4 -0
  179. package/dist/types/lib/pattern/Modal/common/index.d.ts.map +1 -0
  180. package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts +4 -0
  181. package/dist/types/lib/pattern/Modal/hooks/useModalContext.d.ts.map +1 -0
  182. package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts +10 -0
  183. package/dist/types/lib/pattern/Modal/hooks/useModalState.d.ts.map +1 -0
  184. package/dist/types/lib/pattern/Modal/index.d.ts +4 -0
  185. package/dist/types/lib/pattern/Modal/index.d.ts.map +1 -0
  186. package/dist/types/lib/pattern/Modal/types.d.ts +122 -0
  187. package/dist/types/lib/pattern/Modal/types.d.ts.map +1 -0
  188. package/dist/types/lib/pattern/Modal/withModal.d.ts +74 -0
  189. package/dist/types/lib/pattern/Modal/withModal.d.ts.map +1 -0
  190. package/dist/types/lib/pattern/index.d.ts +1 -0
  191. package/dist/types/lib/pattern/index.d.ts.map +1 -1
  192. package/package.json +28 -18
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/ContextualMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EACV,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,KAAK,QAAQ,GAAG,IAAI,CAClB,sBAAsB,EACtB,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CACxD,GAAG;IACF;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,EAAE,CAAC;IACrE,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0CAA0C;IAC1C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GACxC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/ContextualMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE/E,KAAK,QAAQ,GAAG,IAAI,CAClB,sBAAsB,EACtB,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAC/C,GAAG;IACF;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,EAAE,CAAC;IACrE,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0CAA0C;IAC1C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GACxC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
@@ -7,10 +7,10 @@ import type { LinkComponent } from "../../types/link.js";
7
7
  * `label` (visible text), `key` (identity when there is no url), and
8
8
  * `disabled`. Nested `items` are ignored (tabs cannot nest).
9
9
  */
10
- export interface TabItem extends Item {
10
+ export type TabItem = Item & {
11
11
  /** CSS class name applied to this tab's `<li>`, in addition to the base classes. */
12
12
  className?: string;
13
- }
13
+ };
14
14
  type OwnProps = {
15
15
  /**
16
16
  * The tab strip, as a root navigation `Item`. Its **direct children**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,OAAQ,SAAQ,IAAI;IACnC,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,QAAQ,GAAG;IACd;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG;IAC3B,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { default as isMenuSeparator } from "./isMenuSeparator.js";
1
2
  export * from "./types.js";
2
3
  export { default as useContextualMenu } from "./useContextualMenu.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { _Item } from "@canonical/ds-types";
2
+ import type { MenuEntry, MenuSeparator } from "./types.js";
3
+ /**
4
+ * Narrow a menu entry (raw or annotated) to a separator via its `type`
5
+ * discriminant. In the false branch the entry narrows to a `MenuItem`, so
6
+ * render code can branch between a divider and an interactive item.
7
+ *
8
+ * @param entry The menu entry to test.
9
+ * @returns Whether the entry is a separator.
10
+ */
11
+ declare const isMenuSeparator: (entry: MenuEntry | _Item<MenuEntry>) => entry is MenuSeparator | _Item<MenuSeparator>;
12
+ export default isMenuSeparator;
13
+ //# sourceMappingURL=isMenuSeparator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMenuSeparator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/isMenuSeparator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,GACnB,OAAO,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,KAClC,KAAK,IAAI,aAAa,GAAG,KAAK,CAAC,aAAa,CACA,CAAC;AAEhD,eAAe,eAAe,CAAC"}
@@ -1,18 +1,18 @@
1
- import type { _Item, Item } from "@canonical/ds-types";
2
- import type { ItemProps, MenuGroupPropsResult, MenuItemPropsResult, MenuProps, MenuPropsResult, UseNavigationTreeResult } from "@canonical/react-hooks";
1
+ import type { _DistributiveOmit, _Item, Item } from "@canonical/ds-types";
2
+ import type { ItemProps, MenuItemPropsResult, MenuProps, MenuPropsResult, UseNavigationTreeResult } from "@canonical/react-hooks";
3
3
  import type { UseDisclosureProps, UseDisclosureResult } from "../useDisclosure/index.js";
4
4
  /**
5
5
  * A menu item that may carry a right-aligned slot (e.g. a badge or keyboard
6
6
  * shortcut) in addition to the base navigation fields. The slot is an optional
7
7
  * extension that survives tree annotation.
8
8
  */
9
- export interface MenuItem extends Item {
9
+ export type MenuItem = _DistributiveOmit<Item, "items"> & {
10
10
  /** Content rendered right-aligned within the item, such as a badge or shortcut. */
11
11
  slot?: React.ReactNode;
12
12
  /** Icon rendered left of the label. */
13
13
  icon?: React.ReactNode;
14
- /** Child items — a group's items, or a future submenu's entries. */
15
- items?: MenuItem[];
14
+ /** Child entries — this item's submenu, which may itself contain separators. */
15
+ items?: MenuEntry[];
16
16
  /** CSS class name applied to this item, in addition to the base classes. */
17
17
  className?: string;
18
18
  /**
@@ -24,12 +24,41 @@ export interface MenuItem extends Item {
24
24
  Component?: React.ComponentType<{
25
25
  item: MenuItem;
26
26
  }>;
27
+ };
28
+ /**
29
+ * A non-interactive divider between menu entries, rendered as a horizontal
30
+ * rule. It is fed to the navigation tree as a PRESENTATIONAL, label-less node,
31
+ * so the shared navigation machinery (arrow keys, Home/End, type-ahead, roving
32
+ * focus) skips it without any separator awareness of its own.
33
+ */
34
+ export interface MenuSeparator {
35
+ /** Discriminant distinguishing a separator from a menu item. */
36
+ type: "separator";
37
+ /**
38
+ * Unique identity within the menu, used as the React key and the navigation
39
+ * index id. Required: a separator is a node in the navigation tree, and
40
+ * every navigation item is identified by a `key` or a `url`.
41
+ */
42
+ key: string;
43
+ /**
44
+ * Set by {@link useContextualMenu} before the tree is annotated — being
45
+ * presentational is what makes the navigation machinery skip the separator.
46
+ * Consumers never set it.
47
+ *
48
+ * Deliberately not `disabled`: that would claim this is a menu item the
49
+ * user may not choose, and a renderer would be entitled to announce it
50
+ * `aria-disabled`. A separator is not an item.
51
+ */
52
+ presentational?: true;
27
53
  }
54
+ /**
55
+ * One entry in a contextual menu's list: an actionable item or a separator.
56
+ */
57
+ export type MenuEntry = MenuItem | MenuSeparator;
28
58
  export interface UseContextualMenuProps extends Omit<UseDisclosureProps, "mode"> {
29
59
  /**
30
- * The menu tree. The root's children are groups; each group's children are
31
- * the menu items (menu -> group -> item). One level of items is supported now;
32
- * deeper nesting is reserved for submenus.
60
+ * The menu tree. The root's children are the menu entries — items and
61
+ * separators in one flat list; an item's own `items` form its submenu.
33
62
  */
34
63
  root: MenuItem;
35
64
  /** Whether arrow keys wrap at the first/last item. Defaults to false. */
@@ -37,7 +66,7 @@ export interface UseContextualMenuProps extends Omit<UseDisclosureProps, "mode">
37
66
  /** Type-ahead reset timeout in milliseconds. */
38
67
  typeAheadTimeout?: number;
39
68
  }
40
- /** Options for the menu/group ARIA prop-getters. */
69
+ /** Options for the menu ARIA prop-getter. */
41
70
  export interface MenuAriaOptions {
42
71
  /** Accessible name for the element. */
43
72
  label?: string;
@@ -48,10 +77,10 @@ export interface MenuAriaOptions {
48
77
  }
49
78
  /**
50
79
  * The contextual menu combines a click disclosure (open state, positioning,
51
- * dismissal) with a navigation tree (roving keyboard focus, type-ahead, and
52
- * cross-group arrow traversal via a `stateReducer`) and menu ARIA wiring.
80
+ * dismissal) with a navigation tree (roving keyboard focus, arrow traversal,
81
+ * type-ahead) and menu ARIA wiring.
53
82
  */
54
- export interface UseContextualMenuResult extends Pick<UseDisclosureResult, "isOpen" | "open" | "close" | "toggle" | "targetRef" | "popupRef" | "popupPositionStyle" | "popupId" | "bestPosition" | "arrowOffset">, Pick<UseNavigationTreeResult<MenuItem>, "annotatedRoot" | "index" | "highlightedItems" | "highlightItem" | "selectItem" | "getNodeStatus"> {
83
+ export interface UseContextualMenuResult extends Pick<UseDisclosureResult, "isOpen" | "open" | "close" | "toggle" | "targetRef" | "popupRef" | "popupPositionStyle" | "popupId" | "bestPosition" | "arrowOffset">, Pick<UseNavigationTreeResult<MenuEntry>, "annotatedRoot" | "index" | "highlightedItems" | "highlightItem" | "selectItem" | "getNodeStatus"> {
55
84
  /**
56
85
  * Prop-getter for the menu trigger element. Drives the disclosure (open state,
57
86
  * positioning, dismissal) and carries the menu ARIA wiring
@@ -63,9 +92,10 @@ export interface UseContextualMenuResult extends Pick<UseDisclosureResult, "isOp
63
92
  * container props (keyboard handler, ref) with the menu ARIA preset.
64
93
  */
65
94
  getMenuProps: (opts?: MenuAriaOptions) => MenuProps & MenuPropsResult;
66
- /** Prop-getter for a `role="group"` element. */
67
- getGroupProps: (opts?: MenuAriaOptions) => MenuGroupPropsResult;
68
- /** Prop-getter for a `role="menuitem"` element. */
95
+ /**
96
+ * Prop-getter for a `role="menuitem"` element. Items only — a separator is
97
+ * not interactive and receives no item props.
98
+ */
69
99
  getItemProps: (item: _Item<MenuItem>) => ItemProps & MenuItemPropsResult;
70
100
  }
71
101
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,mFAAmF;IACnF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,uCAAuC;IACvC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,oEAAoE;IACpE,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACxC,8FAA8F;IAC9F,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACxC;;;;OAIG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBACf,SAAQ,IAAI,CACR,mBAAmB,EACjB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,SAAS,GACT,cAAc,GACd,aAAa,CAChB,EACD,IAAI,CACF,uBAAuB,CAAC,QAAQ,CAAC,EAC/B,eAAe,GACf,OAAO,GACP,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,eAAe,CAClB;IACH;;;;OAIG;IACH,eAAe,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,SAAS,GAAG,eAAe,CAAC;IACtE,gDAAgD;IAChD,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,oBAAoB,CAAC;IAChE,mDAAmD;IACnD,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,SAAS,GAAG,mBAAmB,CAAC;CAC1E"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,iBAAi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mB,EACjB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,SAAS,GACT,cAAc,GACd,aAAa,CAChB,EACD,IAAI,CACF,uBAAuB,CAAC,SAAS,CAAC,EAChC,eAAe,GACf,OAAO,GACP,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,eAAe,CAClB;IACH;;;;OAIG;IACH,eAAe,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,SAAS,GAAG,eAAe,CAAC;IACtE;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,SAAS,GAAG,mBAAmB,CAAC;CAC1E"}
@@ -1,15 +1,14 @@
1
1
  import type { UseContextualMenuProps, UseContextualMenuResult } from "./types.js";
2
2
  /**
3
- * Drives a contextual menu: a click-triggered, positioned popup listing grouped
4
- * menu items with full keyboard support.
3
+ * Drives a contextual menu: a click-triggered, positioned popup listing menu
4
+ * items and separators with full keyboard support.
5
5
  *
6
6
  * Positioning, open state, outside-click and Escape dismissal come from
7
7
  * {@link useDisclosure} in `click` mode. Roving focus, type-ahead, and ARIA
8
- * wiring come from `useNavigationTree`. Vertical arrow keys cross group
9
- * boundaries through a `stateReducer`, so the shared navigation machinery stays
10
- * menu-agnostic.
8
+ * wiring come from `useNavigationTree`, unmodified: separators enter the tree
9
+ * as presentational, label-less nodes, which the tree already skips.
11
10
  *
12
- * @param root The menu tree (menu -> group -> item).
11
+ * @param root The menu tree (menu -> entries; an item's `items` is its submenu).
13
12
  * @param wrap Whether arrow keys wrap at the first/last item.
14
13
  * @param typeAheadTimeout Type-ahead reset timeout in milliseconds.
15
14
  * @param props Forwarded to the underlying disclosure (positioning, callbacks).
@@ -1 +1 @@
1
- {"version":3,"file":"useContextualMenu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/useContextualMenu.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAEV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,iBAAiB,GAAI,4CAKxB,sBAAsB,KAAG,uBAgN3B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"useContextualMenu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useContextualMenu/useContextualMenu.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAGV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AA6BpB;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,iBAAiB,GAAI,4CAKxB,sBAAsB,KAAG,uBAkM3B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -76,7 +76,12 @@ export interface DisclosureContentProps {
76
76
  export type DisableableElement = HTMLElement & {
77
77
  disabled: boolean;
78
78
  };
79
- export interface UseDisclosureResult extends UseWindowFitmentResult {
79
+ /**
80
+ * @typeParam TTarget - element type of the trigger element, forwarded to
81
+ * `useWindowFitment` so a non-`div` trigger (Popover's `<details>`) gets a
82
+ * correctly typed `targetRef` with no cast. Defaults to `HTMLElement`.
83
+ */
84
+ export interface UseDisclosureResult<TTarget extends HTMLElement = HTMLElement> extends UseWindowFitmentResult<TTarget> {
80
85
  /** Whether the disclosure is currently open. */
81
86
  isOpen: boolean;
82
87
  /** Whether the trigger is currently focused. */
@@ -88,7 +93,7 @@ export interface UseDisclosureResult extends UseWindowFitmentResult {
88
93
  /** Imperatively toggle the disclosure. */
89
94
  toggle: () => void;
90
95
  /** A ref to attach to the trigger element. */
91
- targetRef: RefObject<HTMLDivElement | null>;
96
+ targetRef: RefObject<TTarget | null>;
92
97
  /** A ref to attach to the content (popup) element. */
93
98
  popupRef: RefObject<HTMLDivElement | null>;
94
99
  /** The style object to apply to the content element. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,kBACf,SAAQ,qBAAqB,EAC3B,qBAAqB;IACvB,gEAAgE;IAChE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,iEAAiE;IACjE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,0CAA0C;IAC1C,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oDAAoD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,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,wDAAwD;IACxD,kBAAkB,EAAE,aAAa,CAAC;IAClC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,qBAAqB,CAAC;IAC5C,mDAAmD;IACnD,eAAe,EAAE,MAAM,sBAAsB,CAAC;CAC/C"}
@@ -27,6 +27,6 @@ import type { UseDisclosureProps, UseDisclosureResult } from "./types.js";
27
27
  * @param props Forwarded to the useWindowFitment hook.
28
28
  * @returns The open state, imperative controls, positioning refs and style, and prop-getters.
29
29
  */
30
- declare const useDisclosure: ({ mode, isOpen: isOpenProp, deactivateDelay, activateDelay, onEnter, onLeave, onFocus, onBlur, onShow, onHide, closeOnEscape, closeOnOutsideClick, returnFocus, ...props }: UseDisclosureProps) => UseDisclosureResult;
30
+ declare const useDisclosure: <TTarget extends HTMLElement = HTMLElement>({ mode, isOpen: isOpenProp, deactivateDelay, activateDelay, onEnter, onLeave, onFocus, onBlur, onShow, onHide, closeOnEscape, closeOnOutsideClick, returnFocus, ...props }: UseDisclosureProps) => UseDisclosureResult<TTarget>;
31
31
  export default useDisclosure;
32
32
  //# sourceMappingURL=useDisclosure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDisclosure.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/useDisclosure.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAIV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,aAAa,GAAI,4KAepB,kBAAkB,KAAG,mBAqOvB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"useDisclosure.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useDisclosure/useDisclosure.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAIV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,QAAA,MAAM,aAAa,GAAI,OAAO,SAAS,WAAW,GAAG,WAAW,EAAE,4KAe/D,kBAAkB,KAAG,mBAAmB,CAAC,OAAO,CAqOlD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -81,15 +81,24 @@ export interface WindowFitmentPlacement {
81
81
  side: WindowFitmentSide;
82
82
  align: WindowFitmentAlign;
83
83
  }
84
- export interface UseWindowFitmentResult {
84
+ /**
85
+ * @typeParam TTarget - the element type of the anchored (target) element, so a
86
+ * caller attaching `targetRef` to a non-`div` (e.g. Popover's `<details>`)
87
+ * gets a correctly typed ref instead of casting. Defaults to `HTMLElement`.
88
+ * The refs are only read via `getBoundingClientRect()`, common to every
89
+ * element, so widening the type is sound.
90
+ * @typeParam TPopup - the element type of the popup element. Defaults to
91
+ * `HTMLDivElement` (the popup surface is a `div` in every current consumer).
92
+ */
93
+ export interface UseWindowFitmentResult<TTarget extends HTMLElement = HTMLElement, TPopup extends HTMLElement = HTMLDivElement> {
85
94
  /**
86
95
  * A ref to be attached to the target element.
87
96
  */
88
- targetRef: RefObject<HTMLDivElement | null>;
97
+ targetRef: RefObject<TTarget | null>;
89
98
  /**
90
99
  * A ref to be attached to the popup element.
91
100
  */
92
- popupRef: RefObject<HTMLDivElement | null>;
101
+ popupRef: RefObject<TPopup | null>;
93
102
  /**
94
103
  * The calculated best possible position of the popup element.
95
104
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,CAAC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IG;IACH,YAAY,EAAE,sBAAsB,CAAC;IACrC,8EAA8E;IAC9E,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,gBAAgB,CAAC;CACjC"}
@@ -41,6 +41,6 @@ popupPosition?: {
41
41
  top: number;
42
42
  left: number;
43
43
  }) => ArrowOffset;
44
- declare const useWindowFitment: ({ preferredDirections, distance, gutter, maxWidth, resizeDelay, scrollDelay, onBestPositionChange, autoFit, direction: directionProp, }: UseWindowFitmentProps) => UseWindowFitmentResult;
44
+ declare const useWindowFitment: <TTarget extends HTMLElement = HTMLElement, TPopup extends HTMLElement = HTMLDivElement>({ preferredDirections, distance, gutter, maxWidth, resizeDelay, scrollDelay, onBestPositionChange, autoFit, direction: directionProp, }: UseWindowFitmentProps) => UseWindowFitmentResult<TTarget, TPopup>;
45
45
  export default useWindowFitment;
46
46
  //# sourceMappingURL=useWindowFitment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWindowFitment.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/useWindowFitment.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,WAAW,EAGX,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,iFAAiF;AACjF,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,WAAW,GACtB,OAAO,iBAAiB,GAAG,sBAAsB,KAChD,sBACmE,CAAC;AAEvE;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,sBAAsB,EACjC,KAAK,KAAK,GAAG,KAAK,KACjB,iBAiBF,CAAC;AAcF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,sBAAsB,EACjC,YAAY,OAAO,EACnB,WAAW,OAAO;AAClB;;;;;;;;GAQG;AACH,gBAAe;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAGzC,KACA,WAmBF,CAAC;AAEF,QAAA,MAAM,gBAAgB,GAAI,yIAevB,qBAAqB,KAAG,sBA6Y1B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"useWindowFitment.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/useWindowFitment.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,WAAW,EAGX,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,iFAAiF;AACjF,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,WAAW,GACtB,OAAO,iBAAiB,GAAG,sBAAsB,KAChD,sBACmE,CAAC;AAEvE;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,sBAAsB,EACjC,KAAK,KAAK,GAAG,KAAK,KACjB,iBAiBF,CAAC;AAcF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,sBAAsB,EACjC,YAAY,OAAO,EACnB,WAAW,OAAO;AAClB;;;;;;;;GAQG;AACH,gBAAe;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAGzC,KACA,WAmBF,CAAC;AAEF,QAAA,MAAM,gBAAgB,GACpB,OAAO,SAAS,WAAW,GAAG,WAAW,EACzC,MAAM,SAAS,WAAW,GAAG,cAAc,EAC3C,yIAeC,qBAAqB,KAAG,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAgZhE,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ModalContextValue } from "./types.js";
2
+ /**
3
+ * The shared modal API threaded to the composed subcomponents. There is ONE
4
+ * modal instance per dialog — the subcomponents are render-only and read this
5
+ * context rather than being handed props, so a composed `Modal.Header` names
6
+ * the dialog and closes it without the consumer wiring either by hand.
7
+ */
8
+ declare const Context: import("react").Context<ModalContextValue | null>;
9
+ export default Context;
10
+ //# sourceMappingURL=Context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/Context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;GAKG;AACH,QAAA,MAAM,OAAO,mDAAgD,CAAC;AAE9D,eAAe,OAAO,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type React from "react";
2
+ import type { ModalProps } from "./types.js";
3
+ import "./styles.css";
4
+ /**
5
+ * A modal is a focused container that sits on top of the main view, requiring
6
+ * users to interact with it before returning to that view. Its purpose is to
7
+ * capture the user's full attention for a specific, self-contained task while
8
+ * keeping their workspace visible, though inactive, behind it. The main use
9
+ * case is asking the user to confirm a decision they have already taken — for
10
+ * instance, sending a delete request.
11
+ *
12
+ * It renders a native `<dialog>` opened with `showModal()`, so the backdrop,
13
+ * focus trap, page inertness and Escape handling come from the platform rather
14
+ * than from JavaScript. The modal is self-contained: the open state lives in
15
+ * the `<dialog>` element, not in a prop, so the header's close button and
16
+ * Escape close it — and a backdrop click too, once `closeOnBackdropClick` opts
17
+ * in — without the consumer wiring anything. Opening always goes through the
18
+ * `ref` — which is required, since `showModal()` is the only way in:
19
+ * `ref.current?.showModal()` opens the modal and `ref.current?.close()`
20
+ * closes it.
21
+ *
22
+ * A native dialog opened with `showModal()` renders in the browser's top
23
+ * layer, so even under an ancestor with `overflow: hidden` the modal is not
24
+ * clipped.
25
+ *
26
+ * There are two consumption patterns, `withModal` and `Modal`. `withModal` is
27
+ * meant for static content: the call belongs at module scope, where the
28
+ * function it is handed can only see module-level values, so the modal it
29
+ * returns is the same on every render. If the modal must show data from the
30
+ * parent — for example a different `userName` depending on which user is
31
+ * selected — compose `Modal` directly and drive it through its `ref`.
32
+ * Otherwise, use `withModal`.
33
+ *
34
+ * The header's title names the dialog automatically; a modal composed without
35
+ * a header must carry its own `aria-label` (see the accessibility story in
36
+ * `withModal`).
37
+ *
38
+ * The sections are composed by the consumer: render
39
+ * `Modal.Header`, `Modal.Content` and `Modal.Footer` as children and choose
40
+ * which ones to show. Note the title is not a heading element: a modal is a
41
+ * layer on top of the page, not part of its document outline.
42
+ *
43
+ * `import { Modal } from "@canonical/react-ds-global";`
44
+ *
45
+ * @implements ds:global.pattern.modal
46
+ */
47
+ declare const Provider: {
48
+ ({ ref, closeOnBackdropClick, children, className, onClick, "aria-label": ariaLabel, ...props }: ModalProps): React.ReactElement;
49
+ Content: {
50
+ ({ children, className, ...props }: import("./common/index.js").ContentProps): React.ReactElement;
51
+ displayName: string;
52
+ };
53
+ Footer: {
54
+ ({ children, className, ...props }: import("./common/index.js").FooterProps): React.ReactElement;
55
+ displayName: string;
56
+ };
57
+ Header: {
58
+ ({ children, titleId, undismissible, dismissLabel, onDismiss, className, ...props }: import("./common/index.js").HeaderProps): React.ReactElement;
59
+ displayName: string;
60
+ };
61
+ };
62
+ export default Provider;
63
+ //# sourceMappingURL=Provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/pattern/Modal/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,QAAA,MAAM,QAAQ;qGAQX,UAAU,GAAG,KAAK,CAAC,YAAY;;;;;;;;;;;;;CAwEjC,CAAC;AAMF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type React from "react";
2
+ import type { ContentProps } from "./types.js";
3
+ import "./styles.css";
4
+ /**
5
+ * Modal.Content subcomponent
6
+ *
7
+ * The open slot holding the modal's main information. It is the only part that
8
+ * scrolls, so the header and footer stay put on long content.
9
+ *
10
+ * @implements ds:global.subcomponent.modal-content
11
+ */
12
+ declare const Content: {
13
+ ({ children, className, ...props }: ContentProps): React.ReactElement;
14
+ displayName: string;
15
+ };
16
+ export default Content;
17
+ //# sourceMappingURL=Content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Content/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAItB;;;;;;;GAOG;AACH,QAAA,MAAM,OAAO;wCAIV,YAAY,GAAG,KAAK,CAAC,YAAY;;CAOnC,CAAC;AAIF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Content } from "./Content.js";
2
+ export type * from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Content/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ type OwnProps = {
3
+ /**
4
+ * The main information the modal conveys — an open slot.
5
+ */
6
+ children?: ReactNode;
7
+ };
8
+ /**
9
+ * Props for the Modal.Content subcomponent
10
+ *
11
+ * @implements ds:global.subcomponent.modal-content
12
+ */
13
+ export type ContentProps = OwnProps & Omit<ComponentProps<"div">, keyof OwnProps>;
14
+ export {};
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Content/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,KAAK,QAAQ,GAAG;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GACjC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type React from "react";
2
+ import type { FooterProps } from "./types.js";
3
+ import "./styles.css";
4
+ /**
5
+ * Modal.Footer subcomponent
6
+ *
7
+ * Holds the modal's actions. When the modal is a confirmation or a form, these
8
+ * capture the decision; the button's modifiers must match the consequence, so a
9
+ * destructive confirmation uses a destructive button.
10
+ *
11
+ * @implements ds:global.subcomponent.modal-footer
12
+ */
13
+ declare const Footer: {
14
+ ({ children, className, ...props }: FooterProps): React.ReactElement;
15
+ displayName: string;
16
+ };
17
+ export default Footer;
18
+ //# sourceMappingURL=Footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM;wCAIT,WAAW,GAAG,KAAK,CAAC,YAAY;;CAOlC,CAAC;AAIF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Footer } from "./Footer.js";
2
+ export type * from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ type OwnProps = {
3
+ /**
4
+ * The actions that capture the user's decision — normally Buttons, with the
5
+ * affirmative one last.
6
+ */
7
+ children?: ReactNode;
8
+ };
9
+ /**
10
+ * Props for the Modal.Footer subcomponent
11
+ *
12
+ * @implements ds:global.subcomponent.modal-footer
13
+ */
14
+ export type FooterProps = OwnProps & Omit<ComponentProps<"footer">, keyof OwnProps>;
15
+ export {};
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Footer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,KAAK,QAAQ,GAAG;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAChC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type React from "react";
2
+ import type { HeaderProps } from "./types.js";
3
+ import "./styles.css";
4
+ /**
5
+ * Modal.Header subcomponent
6
+ *
7
+ * Carries the modal title and the optional dismiss control. The title describes
8
+ * what the modal is for, giving the user context on what triggered it. Both the
9
+ * title id (which names the dialog) and the dismiss wiring come from the Modal
10
+ * context, so a composed header needs no props of its own.
11
+ *
12
+ * The title is not a heading element: headings structure the page's document
13
+ * outline, and a modal opens from anywhere in it, so no heading level would be
14
+ * right everywhere. The title names the dialog through `aria-labelledby`
15
+ * instead, which is what a screen reader announces when the modal opens.
16
+ *
17
+ * @implements ds:global.subcomponent.modal-header
18
+ */
19
+ declare const Header: {
20
+ ({ children, titleId, undismissible, dismissLabel, onDismiss, className, ...props }: HeaderProps): React.ReactElement;
21
+ displayName: string;
22
+ };
23
+ export default Header;
24
+ //# sourceMappingURL=Header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,MAAM;yFAQT,WAAW,GAAG,KAAK,CAAC,YAAY;;CAsBlC,CAAC;AAIF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Header } from "./Header.js";
2
+ export type * from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ type OwnProps = {
3
+ /**
4
+ * The modal title. It tells the user what triggered the modal.
5
+ *
6
+ * The title is deliberately not a heading element: the modal is a layer on
7
+ * top of the page, not part of its document outline, so it names the dialog
8
+ * through `aria-labelledby` instead.
9
+ *
10
+ */
11
+ children?: ReactNode;
12
+ /**
13
+ * `id` set on the title element so the dialog can point its
14
+ * `aria-labelledby` at it. Defaults to the id supplied by the Modal context;
15
+ */
16
+ titleId?: string;
17
+ /**
18
+ * Hides the close button, so the visible way out is an action in the footer.
19
+ */
20
+ undismissible?: boolean;
21
+ /** Accessible name for the close button. */
22
+ dismissLabel?: string;
23
+ /**
24
+ * Called when the close button is pressed. Defaults to closing the dialog
25
+ * through the Modal's context; set it only to override that.
26
+ */
27
+ onDismiss?: () => void;
28
+ };
29
+ /**
30
+ * Props for the Modal.Header subcomponent
31
+ *
32
+ * @implements ds:global.subcomponent.modal-header
33
+ */
34
+ export type HeaderProps = OwnProps & Omit<ComponentProps<"header">, keyof OwnProps>;
35
+ export {};
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/pattern/Modal/common/Header/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,KAAK,QAAQ,GAAG;IACd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAChC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./Content/index.js";
2
+ export * from "./Footer/index.js";
3
+ export * from "./Header/index.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/pattern/Modal/common/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ModalContextValue } from "../types.js";
2
+ /** Reads the shared modal API. Throws if used outside a Modal. */
3
+ export declare const useModalContext: () => ModalContextValue;
4
+ //# sourceMappingURL=useModalContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useModalContext.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/pattern/Modal/hooks/useModalContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,kEAAkE;AAClE,eAAO,MAAM,eAAe,QAAO,iBAMlC,CAAC"}