@wordpress/components 33.1.1-next.v.202605131032.0 → 35.0.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 (287) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/build/autocomplete/index.cjs +5 -4
  3. package/build/autocomplete/index.cjs.map +3 -3
  4. package/build/box-control/index.cjs +0 -6
  5. package/build/box-control/index.cjs.map +2 -2
  6. package/build/box-control/utils.cjs +0 -38
  7. package/build/box-control/utils.cjs.map +3 -3
  8. package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
  9. package/build/draggable/index.cjs +101 -7
  10. package/build/draggable/index.cjs.map +3 -3
  11. package/build/form-token-field/index.cjs +41 -7
  12. package/build/form-token-field/index.cjs.map +2 -2
  13. package/build/index.cjs +0 -17
  14. package/build/index.cjs.map +2 -2
  15. package/build/notice/index.cjs +33 -35
  16. package/build/notice/index.cjs.map +2 -2
  17. package/build/popover/index.cjs +12 -0
  18. package/build/popover/index.cjs.map +2 -2
  19. package/build/tabs/styles.cjs +5 -5
  20. package/build/tabs/styles.cjs.map +2 -2
  21. package/build-module/autocomplete/index.mjs +6 -5
  22. package/build-module/autocomplete/index.mjs.map +2 -2
  23. package/build-module/box-control/index.mjs +0 -2
  24. package/build-module/box-control/index.mjs.map +2 -2
  25. package/build-module/box-control/utils.mjs +0 -27
  26. package/build-module/box-control/utils.mjs.map +2 -2
  27. package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
  28. package/build-module/draggable/index.mjs +101 -7
  29. package/build-module/draggable/index.mjs.map +3 -3
  30. package/build-module/form-token-field/index.mjs +41 -7
  31. package/build-module/form-token-field/index.mjs.map +2 -2
  32. package/build-module/index.mjs +87 -99
  33. package/build-module/index.mjs.map +2 -2
  34. package/build-module/notice/index.mjs +34 -36
  35. package/build-module/notice/index.mjs.map +2 -2
  36. package/build-module/popover/index.mjs +12 -0
  37. package/build-module/popover/index.mjs.map +2 -2
  38. package/build-module/tabs/styles.mjs +5 -5
  39. package/build-module/tabs/styles.mjs.map +2 -2
  40. package/build-style/style-rtl.css +64 -66
  41. package/build-style/style.css +64 -66
  42. package/build-types/autocomplete/index.d.ts.map +1 -1
  43. package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
  44. package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
  45. package/build-types/box-control/index.d.ts +0 -1
  46. package/build-types/box-control/index.d.ts.map +1 -1
  47. package/build-types/box-control/styles/box-control-styles.d.ts +1 -2
  48. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  49. package/build-types/box-control/utils.d.ts +0 -13
  50. package/build-types/box-control/utils.d.ts.map +1 -1
  51. package/build-types/button/stories/e2e/index.story.d.ts +1 -0
  52. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  53. package/build-types/color-picker/styles.d.ts +1 -2
  54. package/build-types/color-picker/styles.d.ts.map +1 -1
  55. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  56. package/build-types/draggable/index.d.ts.map +1 -1
  57. package/build-types/draggable/stories/index.story.d.ts +4 -5
  58. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  59. package/build-types/draggable/types.d.ts +4 -0
  60. package/build-types/draggable/types.d.ts.map +1 -1
  61. package/build-types/form-token-field/index.d.ts.map +1 -1
  62. package/build-types/icon/stories/index.story.d.ts +0 -6
  63. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  64. package/build-types/index.d.ts +1 -6
  65. package/build-types/index.d.ts.map +1 -1
  66. package/build-types/notice/index.d.ts.map +1 -1
  67. package/build-types/notice/types.d.ts +1 -2
  68. package/build-types/notice/types.d.ts.map +1 -1
  69. package/build-types/popover/index.d.ts.map +1 -1
  70. package/build-types/range-control/index.d.ts +1 -2
  71. package/build-types/range-control/index.d.ts.map +1 -1
  72. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  73. package/build-types/range-control/types.d.ts +0 -4
  74. package/build-types/range-control/types.d.ts.map +1 -1
  75. package/build-types/tab-panel/stories/index.story.d.ts +0 -6
  76. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  77. package/build-types/tabs/stories/index.story.d.ts +0 -6
  78. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  79. package/build-types/tabs/styles.d.ts.map +1 -1
  80. package/build-types/validated-form-controls/components/range-control.d.ts +1 -2
  81. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  82. package/package.json +24 -22
  83. package/src/autocomplete/index.tsx +25 -7
  84. package/src/badge/stories/e2e/index.story.tsx +21 -0
  85. package/src/box-control/index.tsx +0 -1
  86. package/src/box-control/utils.ts +0 -43
  87. package/src/button/stories/e2e/index.story.tsx +11 -0
  88. package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
  89. package/src/draggable/index.tsx +32 -10
  90. package/src/draggable/stories/index.story.tsx +11 -6
  91. package/src/draggable/style.module.scss +29 -0
  92. package/src/draggable/types.ts +4 -0
  93. package/src/form-token-field/index.tsx +84 -8
  94. package/src/form-token-field/test/index.tsx +189 -0
  95. package/src/icon/stories/index.story.tsx +2 -14
  96. package/src/index.ts +0 -6
  97. package/src/menu/test/index.tsx +9 -4
  98. package/src/modal/style.scss +2 -1
  99. package/src/notice/README.md +1 -2
  100. package/src/notice/index.tsx +57 -64
  101. package/src/notice/style.scss +49 -41
  102. package/src/notice/test/__snapshots__/index.tsx.snap +23 -23
  103. package/src/notice/test/index.tsx +5 -5
  104. package/src/notice/types.ts +1 -2
  105. package/src/popover/index.tsx +28 -0
  106. package/src/popover/test/index.tsx +138 -1
  107. package/src/range-control/stories/index.story.tsx +0 -1
  108. package/src/range-control/types.ts +0 -4
  109. package/src/style.scss +0 -1
  110. package/src/tab-panel/stories/index.story.tsx +2 -13
  111. package/src/tab-panel/style.scss +36 -14
  112. package/src/tabs/stories/index.story.tsx +2 -13
  113. package/src/tabs/styles.ts +3 -8
  114. package/build/navigation/back-button/index.cjs +0 -86
  115. package/build/navigation/back-button/index.cjs.map +0 -7
  116. package/build/navigation/constants.cjs +0 -34
  117. package/build/navigation/constants.cjs.map +0 -7
  118. package/build/navigation/context.cjs +0 -58
  119. package/build/navigation/context.cjs.map +0 -7
  120. package/build/navigation/group/context.cjs +0 -38
  121. package/build/navigation/group/context.cjs.map +0 -7
  122. package/build/navigation/group/index.cjs +0 -88
  123. package/build/navigation/group/index.cjs.map +0 -7
  124. package/build/navigation/index.cjs +0 -113
  125. package/build/navigation/index.cjs.map +0 -7
  126. package/build/navigation/item/base-content.cjs +0 -44
  127. package/build/navigation/item/base-content.cjs.map +0 -7
  128. package/build/navigation/item/base.cjs +0 -66
  129. package/build/navigation/item/base.cjs.map +0 -7
  130. package/build/navigation/item/index.cjs +0 -119
  131. package/build/navigation/item/index.cjs.map +0 -7
  132. package/build/navigation/item/use-navigation-tree-item.cjs +0 -64
  133. package/build/navigation/item/use-navigation-tree-item.cjs.map +0 -7
  134. package/build/navigation/menu/context.cjs +0 -39
  135. package/build/navigation/menu/context.cjs.map +0 -7
  136. package/build/navigation/menu/index.cjs +0 -114
  137. package/build/navigation/menu/index.cjs.map +0 -7
  138. package/build/navigation/menu/menu-title-search.cjs +0 -111
  139. package/build/navigation/menu/menu-title-search.cjs.map +0 -7
  140. package/build/navigation/menu/menu-title.cjs +0 -104
  141. package/build/navigation/menu/menu-title.cjs.map +0 -7
  142. package/build/navigation/menu/search-no-results-found.cjs +0 -48
  143. package/build/navigation/menu/search-no-results-found.cjs.map +0 -7
  144. package/build/navigation/menu/use-navigation-tree-menu.cjs +0 -51
  145. package/build/navigation/menu/use-navigation-tree-menu.cjs.map +0 -7
  146. package/build/navigation/styles/navigation-styles.cjs +0 -170
  147. package/build/navigation/styles/navigation-styles.cjs.map +0 -7
  148. package/build/navigation/types.cjs +0 -19
  149. package/build/navigation/types.cjs.map +0 -7
  150. package/build/navigation/use-create-navigation-tree.cjs +0 -103
  151. package/build/navigation/use-create-navigation-tree.cjs.map +0 -7
  152. package/build/navigation/use-navigation-tree-nodes.cjs +0 -60
  153. package/build/navigation/use-navigation-tree-nodes.cjs.map +0 -7
  154. package/build/navigation/utils.cjs +0 -45
  155. package/build/navigation/utils.cjs.map +0 -7
  156. package/build-module/navigation/back-button/index.mjs +0 -51
  157. package/build-module/navigation/back-button/index.mjs.map +0 -7
  158. package/build-module/navigation/constants.mjs +0 -8
  159. package/build-module/navigation/constants.mjs.map +0 -7
  160. package/build-module/navigation/context.mjs +0 -32
  161. package/build-module/navigation/context.mjs.map +0 -7
  162. package/build-module/navigation/group/context.mjs +0 -12
  163. package/build-module/navigation/group/context.mjs.map +0 -7
  164. package/build-module/navigation/group/index.mjs +0 -53
  165. package/build-module/navigation/group/index.mjs.map +0 -7
  166. package/build-module/navigation/index.mjs +0 -78
  167. package/build-module/navigation/index.mjs.map +0 -7
  168. package/build-module/navigation/item/base-content.mjs +0 -23
  169. package/build-module/navigation/item/base-content.mjs.map +0 -7
  170. package/build-module/navigation/item/base.mjs +0 -35
  171. package/build-module/navigation/item/base.mjs.map +0 -7
  172. package/build-module/navigation/item/index.mjs +0 -84
  173. package/build-module/navigation/item/index.mjs.map +0 -7
  174. package/build-module/navigation/item/use-navigation-tree-item.mjs +0 -39
  175. package/build-module/navigation/item/use-navigation-tree-item.mjs.map +0 -7
  176. package/build-module/navigation/menu/context.mjs +0 -13
  177. package/build-module/navigation/menu/context.mjs.map +0 -7
  178. package/build-module/navigation/menu/index.mjs +0 -79
  179. package/build-module/navigation/menu/index.mjs.map +0 -7
  180. package/build-module/navigation/menu/menu-title-search.mjs +0 -80
  181. package/build-module/navigation/menu/menu-title-search.mjs.map +0 -7
  182. package/build-module/navigation/menu/menu-title.mjs +0 -73
  183. package/build-module/navigation/menu/menu-title.mjs.map +0 -7
  184. package/build-module/navigation/menu/search-no-results-found.mjs +0 -27
  185. package/build-module/navigation/menu/search-no-results-found.mjs.map +0 -7
  186. package/build-module/navigation/menu/use-navigation-tree-menu.mjs +0 -26
  187. package/build-module/navigation/menu/use-navigation-tree-menu.mjs.map +0 -7
  188. package/build-module/navigation/styles/navigation-styles.mjs +0 -124
  189. package/build-module/navigation/styles/navigation-styles.mjs.map +0 -7
  190. package/build-module/navigation/types.mjs +0 -1
  191. package/build-module/navigation/types.mjs.map +0 -7
  192. package/build-module/navigation/use-create-navigation-tree.mjs +0 -78
  193. package/build-module/navigation/use-create-navigation-tree.mjs.map +0 -7
  194. package/build-module/navigation/use-navigation-tree-nodes.mjs +0 -35
  195. package/build-module/navigation/use-navigation-tree-nodes.mjs.map +0 -7
  196. package/build-module/navigation/utils.mjs +0 -9
  197. package/build-module/navigation/utils.mjs.map +0 -7
  198. package/build-types/navigation/back-button/index.d.ts +0 -7
  199. package/build-types/navigation/back-button/index.d.ts.map +0 -1
  200. package/build-types/navigation/constants.d.ts +0 -3
  201. package/build-types/navigation/constants.d.ts.map +0 -1
  202. package/build-types/navigation/context.d.ts +0 -4
  203. package/build-types/navigation/context.d.ts.map +0 -1
  204. package/build-types/navigation/group/context.d.ts +0 -7
  205. package/build-types/navigation/group/context.d.ts.map +0 -1
  206. package/build-types/navigation/group/index.d.ts +0 -7
  207. package/build-types/navigation/group/index.d.ts.map +0 -1
  208. package/build-types/navigation/index.d.ts +0 -46
  209. package/build-types/navigation/index.d.ts.map +0 -1
  210. package/build-types/navigation/item/base-content.d.ts +0 -3
  211. package/build-types/navigation/item/base-content.d.ts.map +0 -1
  212. package/build-types/navigation/item/base.d.ts +0 -3
  213. package/build-types/navigation/item/base.d.ts.map +0 -1
  214. package/build-types/navigation/item/index.d.ts +0 -7
  215. package/build-types/navigation/item/index.d.ts.map +0 -1
  216. package/build-types/navigation/item/use-navigation-tree-item.d.ts +0 -3
  217. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +0 -1
  218. package/build-types/navigation/menu/context.d.ts +0 -7
  219. package/build-types/navigation/menu/context.d.ts.map +0 -1
  220. package/build-types/navigation/menu/index.d.ts +0 -7
  221. package/build-types/navigation/menu/index.d.ts.map +0 -1
  222. package/build-types/navigation/menu/menu-title-search.d.ts +0 -3
  223. package/build-types/navigation/menu/menu-title-search.d.ts.map +0 -1
  224. package/build-types/navigation/menu/menu-title.d.ts +0 -3
  225. package/build-types/navigation/menu/menu-title.d.ts.map +0 -1
  226. package/build-types/navigation/menu/search-no-results-found.d.ts +0 -3
  227. package/build-types/navigation/menu/search-no-results-found.d.ts.map +0 -1
  228. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +0 -3
  229. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +0 -1
  230. package/build-types/navigation/stories/index.story.d.ts +0 -23
  231. package/build-types/navigation/stories/index.story.d.ts.map +0 -1
  232. package/build-types/navigation/stories/utils/controlled-state.d.ts +0 -7
  233. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +0 -1
  234. package/build-types/navigation/stories/utils/default.d.ts +0 -10
  235. package/build-types/navigation/stories/utils/default.d.ts.map +0 -1
  236. package/build-types/navigation/stories/utils/group.d.ts +0 -10
  237. package/build-types/navigation/stories/utils/group.d.ts.map +0 -1
  238. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +0 -10
  239. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +0 -1
  240. package/build-types/navigation/stories/utils/more-examples.d.ts +0 -10
  241. package/build-types/navigation/stories/utils/more-examples.d.ts.map +0 -1
  242. package/build-types/navigation/stories/utils/search.d.ts +0 -10
  243. package/build-types/navigation/stories/utils/search.d.ts.map +0 -1
  244. package/build-types/navigation/styles/navigation-styles.d.ts +0 -55
  245. package/build-types/navigation/styles/navigation-styles.d.ts.map +0 -1
  246. package/build-types/navigation/test/index.d.ts +0 -2
  247. package/build-types/navigation/test/index.d.ts.map +0 -1
  248. package/build-types/navigation/types.d.ts +0 -266
  249. package/build-types/navigation/types.d.ts.map +0 -1
  250. package/build-types/navigation/use-create-navigation-tree.d.ts +0 -15
  251. package/build-types/navigation/use-create-navigation-tree.d.ts.map +0 -1
  252. package/build-types/navigation/use-navigation-tree-nodes.d.ts +0 -10
  253. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +0 -1
  254. package/build-types/navigation/utils.d.ts +0 -3
  255. package/build-types/navigation/utils.d.ts.map +0 -1
  256. package/src/draggable/style.scss +0 -21
  257. package/src/navigation/README.md +0 -267
  258. package/src/navigation/back-button/index.tsx +0 -73
  259. package/src/navigation/constants.tsx +0 -2
  260. package/src/navigation/context.tsx +0 -40
  261. package/src/navigation/group/context.tsx +0 -16
  262. package/src/navigation/group/index.tsx +0 -73
  263. package/src/navigation/index.tsx +0 -152
  264. package/src/navigation/item/base-content.tsx +0 -31
  265. package/src/navigation/item/base.tsx +0 -42
  266. package/src/navigation/item/index.tsx +0 -112
  267. package/src/navigation/item/use-navigation-tree-item.tsx +0 -47
  268. package/src/navigation/menu/context.tsx +0 -20
  269. package/src/navigation/menu/index.tsx +0 -105
  270. package/src/navigation/menu/menu-title-search.tsx +0 -99
  271. package/src/navigation/menu/menu-title.tsx +0 -100
  272. package/src/navigation/menu/search-no-results-found.tsx +0 -34
  273. package/src/navigation/menu/use-navigation-tree-menu.tsx +0 -29
  274. package/src/navigation/stories/index.story.tsx +0 -62
  275. package/src/navigation/stories/style.css +0 -25
  276. package/src/navigation/stories/utils/controlled-state.tsx +0 -149
  277. package/src/navigation/stories/utils/default.tsx +0 -92
  278. package/src/navigation/stories/utils/group.tsx +0 -61
  279. package/src/navigation/stories/utils/hide-if-empty.tsx +0 -66
  280. package/src/navigation/stories/utils/more-examples.tsx +0 -162
  281. package/src/navigation/stories/utils/search.tsx +0 -91
  282. package/src/navigation/styles/navigation-styles.tsx +0 -197
  283. package/src/navigation/test/index.tsx +0 -347
  284. package/src/navigation/types.ts +0 -325
  285. package/src/navigation/use-create-navigation-tree.tsx +0 -110
  286. package/src/navigation/use-navigation-tree-nodes.tsx +0 -31
  287. package/src/navigation/utils.tsx +0 -11
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/components/src/navigation/group/context.tsx
21
- var context_exports = {};
22
- __export(context_exports, {
23
- NavigationGroupContext: () => NavigationGroupContext,
24
- useNavigationGroupContext: () => useNavigationGroupContext
25
- });
26
- module.exports = __toCommonJS(context_exports);
27
- var import_element = require("@wordpress/element");
28
- var NavigationGroupContext = (0, import_element.createContext)({
29
- group: void 0
30
- });
31
- NavigationGroupContext.displayName = "NavigationGroupContext";
32
- var useNavigationGroupContext = () => (0, import_element.useContext)(NavigationGroupContext);
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- NavigationGroupContext,
36
- useNavigationGroupContext
37
- });
38
- //# sourceMappingURL=context.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/navigation/group/context.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nexport const NavigationGroupContext = createContext({\n group: undefined\n});\nNavigationGroupContext.displayName = 'NavigationGroupContext';\nexport const useNavigationGroupContext = () => useContext(NavigationGroupContext);"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0C;AAMnC,IAAM,6BAAyB,8BAAc;AAAA,EAClD,OAAO;AACT,CAAC;AACD,uBAAuB,cAAc;AAC9B,IAAM,4BAA4B,UAAM,2BAAW,sBAAsB;",
6
- "names": []
7
- }
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/components/src/navigation/group/index.tsx
31
- var group_exports = {};
32
- __export(group_exports, {
33
- NavigationGroup: () => NavigationGroup,
34
- default: () => group_default
35
- });
36
- module.exports = __toCommonJS(group_exports);
37
- var import_clsx = __toESM(require("clsx"));
38
- var import_element = require("@wordpress/element");
39
- var import_context = require("./context.cjs");
40
- var import_navigation_styles = require("../styles/navigation-styles.cjs");
41
- var import_context2 = require("../context.cjs");
42
- var import_jsx_runtime = require("react/jsx-runtime");
43
- var uniqueId = 0;
44
- function NavigationGroup({
45
- children,
46
- className,
47
- title
48
- }) {
49
- const [groupId] = (0, import_element.useState)(`group-${++uniqueId}`);
50
- const {
51
- navigationTree: {
52
- items
53
- }
54
- } = (0, import_context2.useNavigationContext)();
55
- const context = {
56
- group: groupId
57
- };
58
- if (!Object.values(items).some((item) => item.group === groupId && item._isVisible)) {
59
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.NavigationGroupContext.Provider, {
60
- value: context,
61
- children
62
- });
63
- }
64
- const groupTitleId = `components-navigation__group-title-${groupId}`;
65
- const classes = (0, import_clsx.default)("components-navigation__group", className);
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.NavigationGroupContext.Provider, {
67
- value: context,
68
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", {
69
- className: classes,
70
- children: [title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_navigation_styles.GroupTitleUI, {
71
- className: "components-navigation__group-title",
72
- id: groupTitleId,
73
- level: 3,
74
- children: title
75
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
76
- "aria-labelledby": groupTitleId,
77
- role: "group",
78
- children
79
- })]
80
- })
81
- });
82
- }
83
- var group_default = NavigationGroup;
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- NavigationGroup
87
- });
88
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/navigation/group/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { NavigationGroupContext } from './context';\nimport { GroupTitleUI } from '../styles/navigation-styles';\nimport { useNavigationContext } from '../context';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nlet uniqueId = 0;\n\n/**\n * @deprecated Use `Navigator` instead.\n */\nexport function NavigationGroup({\n children,\n className,\n title\n}) {\n const [groupId] = useState(`group-${++uniqueId}`);\n const {\n navigationTree: {\n items\n }\n } = useNavigationContext();\n const context = {\n group: groupId\n };\n\n // Keep the children rendered to make sure invisible items are included in the navigation tree.\n if (!Object.values(items).some(item => item.group === groupId && item._isVisible)) {\n return /*#__PURE__*/_jsx(NavigationGroupContext.Provider, {\n value: context,\n children: children\n });\n }\n const groupTitleId = `components-navigation__group-title-${groupId}`;\n const classes = clsx('components-navigation__group', className);\n return /*#__PURE__*/_jsx(NavigationGroupContext.Provider, {\n value: context,\n children: /*#__PURE__*/_jsxs(\"li\", {\n className: classes,\n children: [title && /*#__PURE__*/_jsx(GroupTitleUI, {\n className: \"components-navigation__group-title\",\n id: groupTitleId,\n level: 3,\n children: title\n }), /*#__PURE__*/_jsx(\"ul\", {\n \"aria-labelledby\": groupTitleId,\n role: \"group\",\n children: children\n })]\n })\n });\n}\nexport default NavigationGroup;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAyB;AAKzB,qBAAuC;AACvC,+BAA6B;AAC7B,IAAAA,kBAAqC;AACrC,yBAA2C;AAC3C,IAAI,WAAW;AAKR,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,CAAC,OAAO,QAAI,yBAAS,SAAS,EAAE,QAAQ,EAAE;AAChD,QAAM;AAAA,IACJ,gBAAgB;AAAA,MACd;AAAA,IACF;AAAA,EACF,QAAI,sCAAqB;AACzB,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,EACT;AAGA,MAAI,CAAC,OAAO,OAAO,KAAK,EAAE,KAAK,UAAQ,KAAK,UAAU,WAAW,KAAK,UAAU,GAAG;AACjF,WAAoB,uCAAAC,KAAK,sCAAuB,UAAU;AAAA,MACxD,OAAO;AAAA,MACP;AAAA,IACF,CAAC;AAAA,EACH;AACA,QAAM,eAAe,sCAAsC,OAAO;AAClE,QAAM,cAAU,YAAAC,SAAK,gCAAgC,SAAS;AAC9D,SAAoB,uCAAAD,KAAK,sCAAuB,UAAU;AAAA,IACxD,OAAO;AAAA,IACP,UAAuB,uCAAAE,MAAM,MAAM;AAAA,MACjC,WAAW;AAAA,MACX,UAAU,CAAC,SAAsB,uCAAAF,KAAK,uCAAc;AAAA,QAClD,WAAW;AAAA,QACX,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC,GAAgB,uCAAAA,KAAK,MAAM;AAAA,QAC1B,mBAAmB;AAAA,QACnB,MAAM;AAAA,QACN;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,gBAAQ;",
6
- "names": ["import_context", "_jsx", "clsx", "_jsxs"]
7
- }
@@ -1,113 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/components/src/navigation/index.tsx
31
- var navigation_exports = {};
32
- __export(navigation_exports, {
33
- Navigation: () => Navigation,
34
- default: () => navigation_default
35
- });
36
- module.exports = __toCommonJS(navigation_exports);
37
- var import_clsx = __toESM(require("clsx"));
38
- var import_deprecated = __toESM(require("@wordpress/deprecated"));
39
- var import_element = require("@wordpress/element");
40
- var import_i18n = require("@wordpress/i18n");
41
- var import_animate = require("../animate/index.cjs");
42
- var import_constants = require("./constants.cjs");
43
- var import_context = require("./context.cjs");
44
- var import_navigation_styles = require("./styles/navigation-styles.cjs");
45
- var import_use_create_navigation_tree = require("./use-create-navigation-tree.cjs");
46
- var import_jsx_runtime = require("react/jsx-runtime");
47
- var noop = () => {
48
- };
49
- function Navigation({
50
- activeItem,
51
- activeMenu = import_constants.ROOT_MENU,
52
- children,
53
- className,
54
- onActivateMenu = noop
55
- }) {
56
- const [menu, setMenu] = (0, import_element.useState)(activeMenu);
57
- const [slideOrigin, setSlideOrigin] = (0, import_element.useState)();
58
- const navigationTree = (0, import_use_create_navigation_tree.useCreateNavigationTree)();
59
- const defaultSlideOrigin = (0, import_i18n.isRTL)() ? "right" : "left";
60
- (0, import_deprecated.default)("wp.components.Navigation (and all subcomponents)", {
61
- since: "6.8",
62
- version: "7.1",
63
- alternative: "wp.components.Navigator"
64
- });
65
- const setActiveMenu = (menuId, slideInOrigin = defaultSlideOrigin) => {
66
- if (!navigationTree.getMenu(menuId)) {
67
- return;
68
- }
69
- setSlideOrigin(slideInOrigin);
70
- setMenu(menuId);
71
- onActivateMenu(menuId);
72
- };
73
- const isMountedRef = (0, import_element.useRef)(false);
74
- (0, import_element.useEffect)(() => {
75
- if (!isMountedRef.current) {
76
- isMountedRef.current = true;
77
- }
78
- }, []);
79
- (0, import_element.useEffect)(() => {
80
- if (activeMenu !== menu) {
81
- setActiveMenu(activeMenu);
82
- }
83
- }, [activeMenu]);
84
- const context = {
85
- activeItem,
86
- activeMenu: menu,
87
- setActiveMenu,
88
- navigationTree
89
- };
90
- const classes = (0, import_clsx.default)("components-navigation", className);
91
- const animateClassName = (0, import_animate.getAnimateClassName)({
92
- type: "slide-in",
93
- origin: slideOrigin
94
- });
95
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_navigation_styles.NavigationUI, {
96
- className: classes,
97
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
98
- className: animateClassName ? (0, import_clsx.default)({
99
- [animateClassName]: isMountedRef.current && slideOrigin
100
- }) : void 0,
101
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.NavigationContext.Provider, {
102
- value: context,
103
- children
104
- })
105
- }, menu)
106
- });
107
- }
108
- var navigation_default = Navigation;
109
- // Annotate the CommonJS export names for ESM import in node:
110
- 0 && (module.exports = {
111
- Navigation
112
- });
113
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/navigation/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getAnimateClassName } from '../animate';\nimport { ROOT_MENU } from './constants';\nimport { NavigationContext } from './context';\nimport { NavigationUI } from './styles/navigation-styles';\nimport { useCreateNavigationTree } from './use-create-navigation-tree';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Render a navigation list with optional groupings and hierarchy.\n *\n * @deprecated Use `Navigator` instead.\n *\n * ```jsx\n * import {\n * __experimentalNavigation as Navigation,\n * __experimentalNavigationGroup as NavigationGroup,\n * __experimentalNavigationItem as NavigationItem,\n * __experimentalNavigationMenu as NavigationMenu,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <Navigation>\n * <NavigationMenu title=\"Home\">\n * <NavigationGroup title=\"Group 1\">\n * <NavigationItem item=\"item-1\" title=\"Item 1\" />\n * <NavigationItem item=\"item-2\" title=\"Item 2\" />\n * </NavigationGroup>\n * <NavigationGroup title=\"Group 2\">\n * <NavigationItem\n * item=\"item-3\"\n * navigateToMenu=\"category\"\n * title=\"Category\"\n * />\n * </NavigationGroup>\n * </NavigationMenu>\n *\n * <NavigationMenu\n * backButtonLabel=\"Home\"\n * menu=\"category\"\n * parentMenu=\"root\"\n * title=\"Category\"\n * >\n * <NavigationItem badge=\"1\" item=\"child-1\" title=\"Child 1\" />\n * <NavigationItem item=\"child-2\" title=\"Child 2\" />\n * </NavigationMenu>\n * </Navigation>\n * );\n * ```\n */\nexport function Navigation({\n activeItem,\n activeMenu = ROOT_MENU,\n children,\n className,\n onActivateMenu = noop\n}) {\n const [menu, setMenu] = useState(activeMenu);\n const [slideOrigin, setSlideOrigin] = useState();\n const navigationTree = useCreateNavigationTree();\n const defaultSlideOrigin = isRTL() ? 'right' : 'left';\n deprecated('wp.components.Navigation (and all subcomponents)', {\n since: '6.8',\n version: '7.1',\n alternative: 'wp.components.Navigator'\n });\n const setActiveMenu = (menuId, slideInOrigin = defaultSlideOrigin) => {\n if (!navigationTree.getMenu(menuId)) {\n return;\n }\n setSlideOrigin(slideInOrigin);\n setMenu(menuId);\n onActivateMenu(menuId);\n };\n\n // Used to prevent the sliding animation on mount\n const isMountedRef = useRef(false);\n useEffect(() => {\n if (!isMountedRef.current) {\n isMountedRef.current = true;\n }\n }, []);\n useEffect(() => {\n if (activeMenu !== menu) {\n setActiveMenu(activeMenu);\n }\n // Not adding deps for now, as it would require either a larger refactor or some questionable workarounds.\n // See https://github.com/WordPress/gutenberg/pull/41612 for context.\n }, [activeMenu]);\n const context = {\n activeItem,\n activeMenu: menu,\n setActiveMenu,\n navigationTree\n };\n const classes = clsx('components-navigation', className);\n const animateClassName = getAnimateClassName({\n type: 'slide-in',\n origin: slideOrigin\n });\n return /*#__PURE__*/_jsx(NavigationUI, {\n className: classes,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: animateClassName ? clsx({\n [animateClassName]: isMountedRef.current && slideOrigin\n }) : undefined,\n children: /*#__PURE__*/_jsx(NavigationContext.Provider, {\n value: context,\n children: children\n })\n }, menu)\n });\n}\nexport default Navigation;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAAuB;AACvB,qBAA4C;AAC5C,kBAAsB;AAKtB,qBAAoC;AACpC,uBAA0B;AAC1B,qBAAkC;AAClC,+BAA6B;AAC7B,wCAAwC;AACxC,yBAA4B;AAC5B,IAAM,OAAO,MAAM;AAAC;AA4Cb,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,iBAAiB;AACnB,GAAG;AACD,QAAM,CAAC,MAAM,OAAO,QAAI,yBAAS,UAAU;AAC3C,QAAM,CAAC,aAAa,cAAc,QAAI,yBAAS;AAC/C,QAAM,qBAAiB,2DAAwB;AAC/C,QAAM,yBAAqB,mBAAM,IAAI,UAAU;AAC/C,wBAAAA,SAAW,oDAAoD;AAAA,IAC7D,OAAO;AAAA,IACP,SAAS;AAAA,IACT,aAAa;AAAA,EACf,CAAC;AACD,QAAM,gBAAgB,CAAC,QAAQ,gBAAgB,uBAAuB;AACpE,QAAI,CAAC,eAAe,QAAQ,MAAM,GAAG;AACnC;AAAA,IACF;AACA,mBAAe,aAAa;AAC5B,YAAQ,MAAM;AACd,mBAAe,MAAM;AAAA,EACvB;AAGA,QAAM,mBAAe,uBAAO,KAAK;AACjC,gCAAU,MAAM;AACd,QAAI,CAAC,aAAa,SAAS;AACzB,mBAAa,UAAU;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,gCAAU,MAAM;AACd,QAAI,eAAe,MAAM;AACvB,oBAAc,UAAU;AAAA,IAC1B;AAAA,EAGF,GAAG,CAAC,UAAU,CAAC;AACf,QAAM,UAAU;AAAA,IACd;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,EACF;AACA,QAAM,cAAU,YAAAC,SAAK,yBAAyB,SAAS;AACvD,QAAM,uBAAmB,oCAAoB;AAAA,IAC3C,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACD,SAAoB,uCAAAC,KAAK,uCAAc;AAAA,IACrC,WAAW;AAAA,IACX,UAAuB,uCAAAA,KAAK,OAAO;AAAA,MACjC,WAAW,uBAAmB,YAAAD,SAAK;AAAA,QACjC,CAAC,gBAAgB,GAAG,aAAa,WAAW;AAAA,MAC9C,CAAC,IAAI;AAAA,MACL,UAAuB,uCAAAC,KAAK,iCAAkB,UAAU;AAAA,QACtD,OAAO;AAAA,QACP;AAAA,MACF,CAAC;AAAA,IACH,GAAG,IAAI;AAAA,EACT,CAAC;AACH;AACA,IAAO,qBAAQ;",
6
- "names": ["deprecated", "clsx", "_jsx"]
7
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/components/src/navigation/item/base-content.tsx
21
- var base_content_exports = {};
22
- __export(base_content_exports, {
23
- default: () => NavigationItemBaseContent
24
- });
25
- module.exports = __toCommonJS(base_content_exports);
26
- var import_navigation_styles = require("../styles/navigation-styles.cjs");
27
- var import_jsx_runtime = require("react/jsx-runtime");
28
- function NavigationItemBaseContent(props) {
29
- const {
30
- badge,
31
- title
32
- } = props;
33
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
34
- children: [title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_navigation_styles.ItemTitleUI, {
35
- className: "components-navigation__item-title",
36
- as: "span",
37
- children: title
38
- }), badge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_navigation_styles.ItemBadgeUI, {
39
- className: "components-navigation__item-badge",
40
- children: badge
41
- })]
42
- });
43
- }
44
- //# sourceMappingURL=base-content.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/navigation/item/base-content.tsx"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { ItemBadgeUI, ItemTitleUI } from '../styles/navigation-styles';\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function NavigationItemBaseContent(props) {\n const {\n badge,\n title\n } = props;\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [title && /*#__PURE__*/_jsx(ItemTitleUI, {\n className: \"components-navigation__item-title\",\n as: \"span\",\n children: title\n }), badge && /*#__PURE__*/_jsx(ItemBadgeUI, {\n className: \"components-navigation__item-badge\",\n children: badge\n })]\n });\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAyC;AACzC,yBAAkE;AACnD,SAAR,0BAA2C,OAAO;AACvD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,SAAoB,uCAAAA,MAAM,mBAAAC,UAAW;AAAA,IACnC,UAAU,CAAC,SAAsB,uCAAAC,KAAK,sCAAa;AAAA,MACjD,WAAW;AAAA,MACX,IAAI;AAAA,MACJ,UAAU;AAAA,IACZ,CAAC,GAAG,SAAsB,uCAAAA,KAAK,sCAAa;AAAA,MAC1C,WAAW;AAAA,MACX,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;",
6
- "names": ["_jsxs", "_Fragment", "_jsx"]
7
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/components/src/navigation/item/base.tsx
31
- var base_exports = {};
32
- __export(base_exports, {
33
- default: () => NavigationItemBase
34
- });
35
- module.exports = __toCommonJS(base_exports);
36
- var import_clsx = __toESM(require("clsx"));
37
- var import_element = require("@wordpress/element");
38
- var import_context = require("../context.cjs");
39
- var import_use_navigation_tree_item = require("./use-navigation-tree-item.cjs");
40
- var import_navigation_styles = require("../styles/navigation-styles.cjs");
41
- var import_jsx_runtime = require("react/jsx-runtime");
42
- var uniqueId = 0;
43
- function NavigationItemBase(props) {
44
- const {
45
- children,
46
- className,
47
- title,
48
- href,
49
- ...restProps
50
- } = props;
51
- const [itemId] = (0, import_element.useState)(`item-${++uniqueId}`);
52
- (0, import_use_navigation_tree_item.useNavigationTreeItem)(itemId, props);
53
- const {
54
- navigationTree
55
- } = (0, import_context.useNavigationContext)();
56
- if (!navigationTree.getItem(itemId)?._isVisible) {
57
- return null;
58
- }
59
- const classes = (0, import_clsx.default)("components-navigation__item", className);
60
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_navigation_styles.ItemBaseUI, {
61
- className: classes,
62
- ...restProps,
63
- children
64
- });
65
- }
66
- //# sourceMappingURL=base.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/navigation/item/base.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useNavigationContext } from '../context';\nimport { useNavigationTreeItem } from './use-navigation-tree-item';\nimport { ItemBaseUI } from '../styles/navigation-styles';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nlet uniqueId = 0;\nexport default function NavigationItemBase(props) {\n // Also avoid to pass the `title` and `href` props to the ItemBaseUI styled component.\n const {\n children,\n className,\n title,\n href,\n ...restProps\n } = props;\n const [itemId] = useState(`item-${++uniqueId}`);\n useNavigationTreeItem(itemId, props);\n const {\n navigationTree\n } = useNavigationContext();\n if (!navigationTree.getItem(itemId)?._isVisible) {\n return null;\n }\n const classes = clsx('components-navigation__item', className);\n return /*#__PURE__*/_jsx(ItemBaseUI, {\n className: classes,\n ...restProps,\n children: children\n });\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAyB;AAKzB,qBAAqC;AACrC,sCAAsC;AACtC,+BAA2B;AAC3B,yBAA4B;AAC5B,IAAI,WAAW;AACA,SAAR,mBAAoC,OAAO;AAEhD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,CAAC,MAAM,QAAI,yBAAS,QAAQ,EAAE,QAAQ,EAAE;AAC9C,6DAAsB,QAAQ,KAAK;AACnC,QAAM;AAAA,IACJ;AAAA,EACF,QAAI,qCAAqB;AACzB,MAAI,CAAC,eAAe,QAAQ,MAAM,GAAG,YAAY;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,cAAU,YAAAA,SAAK,+BAA+B,SAAS;AAC7D,SAAoB,uCAAAC,KAAK,qCAAY;AAAA,IACnC,WAAW;AAAA,IACX,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
6
- "names": ["clsx", "_jsx"]
7
- }
@@ -1,119 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/components/src/navigation/item/index.tsx
31
- var item_exports = {};
32
- __export(item_exports, {
33
- NavigationItem: () => NavigationItem,
34
- default: () => item_default
35
- });
36
- module.exports = __toCommonJS(item_exports);
37
- var import_clsx = __toESM(require("clsx"));
38
- var import_icons = require("@wordpress/icons");
39
- var import_i18n = require("@wordpress/i18n");
40
- var import_button = __toESM(require("../../button/index.cjs"));
41
- var import_context = require("../context.cjs");
42
- var import_navigation_styles = require("../styles/navigation-styles.cjs");
43
- var import_base_content = __toESM(require("./base-content.cjs"));
44
- var import_base = __toESM(require("./base.cjs"));
45
- var import_jsx_runtime = require("react/jsx-runtime");
46
- var noop = () => {
47
- };
48
- function NavigationItem(props) {
49
- const {
50
- badge,
51
- children,
52
- className,
53
- href,
54
- item,
55
- navigateToMenu,
56
- onClick = noop,
57
- title,
58
- icon,
59
- hideIfTargetMenuEmpty,
60
- isText,
61
- ...restProps
62
- } = props;
63
- const {
64
- activeItem,
65
- setActiveMenu,
66
- navigationTree: {
67
- isMenuEmpty
68
- }
69
- } = (0, import_context.useNavigationContext)();
70
- if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {
71
- return null;
72
- }
73
- const isActive = item && activeItem === item;
74
- const classes = (0, import_clsx.default)(className, {
75
- "is-active": isActive
76
- });
77
- const onItemClick = (event) => {
78
- if (navigateToMenu) {
79
- setActiveMenu(navigateToMenu);
80
- }
81
- onClick(event);
82
- };
83
- const navigationIcon = (0, import_i18n.isRTL)() ? import_icons.chevronLeft : import_icons.chevronRight;
84
- const baseProps = children ? props : {
85
- ...props,
86
- onClick: void 0
87
- };
88
- const itemProps = isText ? restProps : {
89
- as: import_button.default,
90
- __next40pxDefaultSize: "as" in restProps ? restProps.as === void 0 : true,
91
- href,
92
- onClick: onItemClick,
93
- "aria-current": isActive ? "page" : void 0,
94
- ...restProps
95
- };
96
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_base.default, {
97
- ...baseProps,
98
- className: classes,
99
- children: children || /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_navigation_styles.ItemUI, {
100
- ...itemProps,
101
- children: [icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_navigation_styles.ItemIconUI, {
102
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, {
103
- icon
104
- })
105
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_base_content.default, {
106
- title,
107
- badge
108
- }), navigateToMenu && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, {
109
- icon: navigationIcon
110
- })]
111
- })
112
- });
113
- }
114
- var item_default = NavigationItem;
115
- // Annotate the CommonJS export names for ESM import in node:
116
- 0 && (module.exports = {
117
- NavigationItem
118
- });
119
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/navigation/item/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, chevronLeft, chevronRight } from '@wordpress/icons';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { useNavigationContext } from '../context';\nimport { ItemUI, ItemIconUI } from '../styles/navigation-styles';\nimport NavigationItemBaseContent from './base-content';\nimport NavigationItemBase from './base';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * @deprecated Use `Navigator` instead.\n */\nexport function NavigationItem(props) {\n const {\n badge,\n children,\n className,\n href,\n item,\n navigateToMenu,\n onClick = noop,\n title,\n icon,\n hideIfTargetMenuEmpty,\n isText,\n ...restProps\n } = props;\n const {\n activeItem,\n setActiveMenu,\n navigationTree: {\n isMenuEmpty\n }\n } = useNavigationContext();\n\n // If hideIfTargetMenuEmpty prop is true\n // And the menu we are supposed to navigate to\n // Is marked as empty, then we skip rendering the item.\n if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {\n return null;\n }\n const isActive = item && activeItem === item;\n const classes = clsx(className, {\n 'is-active': isActive\n });\n const onItemClick = event => {\n if (navigateToMenu) {\n setActiveMenu(navigateToMenu);\n }\n onClick(event);\n };\n const navigationIcon = isRTL() ? chevronLeft : chevronRight;\n const baseProps = children ? props : {\n ...props,\n onClick: undefined\n };\n const itemProps = isText ? restProps : {\n as: Button,\n __next40pxDefaultSize: 'as' in restProps ? restProps.as === undefined : true,\n href,\n onClick: onItemClick,\n 'aria-current': isActive ? 'page' : undefined,\n ...restProps\n };\n return /*#__PURE__*/_jsx(NavigationItemBase, {\n ...baseProps,\n className: classes,\n children: children || /*#__PURE__*/_jsxs(ItemUI, {\n ...itemProps,\n children: [icon && /*#__PURE__*/_jsx(ItemIconUI, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: icon\n })\n }), /*#__PURE__*/_jsx(NavigationItemBaseContent, {\n title: title,\n badge: badge\n }), navigateToMenu && /*#__PURE__*/_jsx(Icon, {\n icon: navigationIcon\n })]\n })\n });\n}\nexport default NavigationItem;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,mBAAgD;AAChD,kBAAsB;AAKtB,oBAAmB;AACnB,qBAAqC;AACrC,+BAAmC;AACnC,0BAAsC;AACtC,kBAA+B;AAC/B,yBAA2C;AAC3C,IAAM,OAAO,MAAM;AAAC;AAKb,SAAS,eAAe,OAAO;AACpC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,MACd;AAAA,IACF;AAAA,EACF,QAAI,qCAAqB;AAKzB,MAAI,yBAAyB,kBAAkB,YAAY,cAAc,GAAG;AAC1E,WAAO;AAAA,EACT;AACA,QAAM,WAAW,QAAQ,eAAe;AACxC,QAAM,cAAU,YAAAA,SAAK,WAAW;AAAA,IAC9B,aAAa;AAAA,EACf,CAAC;AACD,QAAM,cAAc,WAAS;AAC3B,QAAI,gBAAgB;AAClB,oBAAc,cAAc;AAAA,IAC9B;AACA,YAAQ,KAAK;AAAA,EACf;AACA,QAAM,qBAAiB,mBAAM,IAAI,2BAAc;AAC/C,QAAM,YAAY,WAAW,QAAQ;AAAA,IACnC,GAAG;AAAA,IACH,SAAS;AAAA,EACX;AACA,QAAM,YAAY,SAAS,YAAY;AAAA,IACrC,IAAI,cAAAC;AAAA,IACJ,uBAAuB,QAAQ,YAAY,UAAU,OAAO,SAAY;AAAA,IACxE;AAAA,IACA,SAAS;AAAA,IACT,gBAAgB,WAAW,SAAS;AAAA,IACpC,GAAG;AAAA,EACL;AACA,SAAoB,uCAAAC,KAAK,YAAAC,SAAoB;AAAA,IAC3C,GAAG;AAAA,IACH,WAAW;AAAA,IACX,UAAU,YAAyB,uCAAAC,MAAM,iCAAQ;AAAA,MAC/C,GAAG;AAAA,MACH,UAAU,CAAC,QAAqB,uCAAAF,KAAK,qCAAY;AAAA,QAC/C,UAAuB,uCAAAA,KAAK,mBAAM;AAAA,UAChC;AAAA,QACF,CAAC;AAAA,MACH,CAAC,GAAgB,uCAAAA,KAAK,oBAAAG,SAA2B;AAAA,QAC/C;AAAA,QACA;AAAA,MACF,CAAC,GAAG,kBAA+B,uCAAAH,KAAK,mBAAM;AAAA,QAC5C,MAAM;AAAA,MACR,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,eAAQ;",
6
- "names": ["clsx", "Button", "_jsx", "NavigationItemBase", "_jsxs", "NavigationItemBaseContent"]
7
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/components/src/navigation/item/use-navigation-tree-item.tsx
21
- var use_navigation_tree_item_exports = {};
22
- __export(use_navigation_tree_item_exports, {
23
- useNavigationTreeItem: () => useNavigationTreeItem
24
- });
25
- module.exports = __toCommonJS(use_navigation_tree_item_exports);
26
- var import_element = require("@wordpress/element");
27
- var import_context = require("../context.cjs");
28
- var import_context2 = require("../group/context.cjs");
29
- var import_context3 = require("../menu/context.cjs");
30
- var import_utils = require("../utils.cjs");
31
- var useNavigationTreeItem = (itemId, props) => {
32
- const {
33
- activeMenu,
34
- navigationTree: {
35
- addItem,
36
- removeItem
37
- }
38
- } = (0, import_context.useNavigationContext)();
39
- const {
40
- group
41
- } = (0, import_context2.useNavigationGroupContext)();
42
- const {
43
- menu,
44
- search
45
- } = (0, import_context3.useNavigationMenuContext)();
46
- (0, import_element.useEffect)(() => {
47
- const isMenuActive = activeMenu === menu;
48
- const isItemVisible = !search || props.title !== void 0 && (0, import_utils.normalizedSearch)(props.title, search);
49
- addItem(itemId, {
50
- ...props,
51
- group,
52
- menu,
53
- _isVisible: isMenuActive && isItemVisible
54
- });
55
- return () => {
56
- removeItem(itemId);
57
- };
58
- }, [activeMenu, search]);
59
- };
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- useNavigationTreeItem
63
- });
64
- //# sourceMappingURL=use-navigation-tree-item.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/navigation/item/use-navigation-tree-item.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useNavigationContext } from '../context';\nimport { useNavigationGroupContext } from '../group/context';\nimport { useNavigationMenuContext } from '../menu/context';\nimport { normalizedSearch } from '../utils';\nexport const useNavigationTreeItem = (itemId, props) => {\n const {\n activeMenu,\n navigationTree: {\n addItem,\n removeItem\n }\n } = useNavigationContext();\n const {\n group\n } = useNavigationGroupContext();\n const {\n menu,\n search\n } = useNavigationMenuContext();\n useEffect(() => {\n const isMenuActive = activeMenu === menu;\n const isItemVisible = !search || props.title !== undefined && normalizedSearch(props.title, search);\n addItem(itemId, {\n ...props,\n group,\n menu,\n _isVisible: isMenuActive && isItemVisible\n });\n return () => {\n removeItem(itemId);\n };\n // Not adding deps for now, as it would require either a larger refactor.\n // See https://github.com/WordPress/gutenberg/pull/41639\n }, [activeMenu, search]);\n};"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAK1B,qBAAqC;AACrC,IAAAA,kBAA0C;AAC1C,IAAAA,kBAAyC;AACzC,mBAAiC;AAC1B,IAAM,wBAAwB,CAAC,QAAQ,UAAU;AACtD,QAAM;AAAA,IACJ;AAAA,IACA,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,IACF;AAAA,EACF,QAAI,qCAAqB;AACzB,QAAM;AAAA,IACJ;AAAA,EACF,QAAI,2CAA0B;AAC9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,0CAAyB;AAC7B,gCAAU,MAAM;AACd,UAAM,eAAe,eAAe;AACpC,UAAM,gBAAgB,CAAC,UAAU,MAAM,UAAU,cAAa,+BAAiB,MAAM,OAAO,MAAM;AAClG,YAAQ,QAAQ;AAAA,MACd,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,YAAY,gBAAgB;AAAA,IAC9B,CAAC;AACD,WAAO,MAAM;AACX,iBAAW,MAAM;AAAA,IACnB;AAAA,EAGF,GAAG,CAAC,YAAY,MAAM,CAAC;AACzB;",
6
- "names": ["import_context"]
7
- }