@automattic/jetpack-components 0.68.1 → 0.69.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 (262) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/components/action-button/index.d.ts +25 -0
  3. package/build/components/action-button/index.js +48 -0
  4. package/build/components/action-popover/index.d.ts +6 -0
  5. package/build/components/action-popover/index.js +38 -0
  6. package/build/components/action-popover/types.d.ts +20 -0
  7. package/build/components/action-popover/types.js +1 -0
  8. package/build/components/admin-page/index.d.ts +12 -0
  9. package/build/components/admin-page/index.js +44 -0
  10. package/build/components/admin-page/types.d.ts +56 -0
  11. package/build/components/admin-page/types.js +1 -0
  12. package/build/components/admin-section/basic/index.d.ts +10 -0
  13. package/build/components/admin-section/basic/index.js +12 -0
  14. package/build/components/admin-section/hero/index.d.ts +10 -0
  15. package/build/components/admin-section/hero/index.js +12 -0
  16. package/build/components/admin-section/types.d.ts +8 -0
  17. package/build/components/admin-section/types.js +1 -0
  18. package/build/components/alert/index.d.ts +23 -0
  19. package/build/components/alert/index.js +33 -0
  20. package/build/components/automattic-byline-logo/index.d.ts +10 -0
  21. package/build/components/automattic-byline-logo/index.js +13 -0
  22. package/build/components/automattic-byline-logo/types.d.ts +15 -0
  23. package/build/components/automattic-byline-logo/types.js +1 -0
  24. package/build/components/automattic-for-agencies-logo/index.d.ts +11 -0
  25. package/build/components/automattic-for-agencies-logo/index.js +12 -0
  26. package/build/components/automattic-icon-logo/index.d.ts +13 -0
  27. package/build/components/automattic-icon-logo/index.js +13 -0
  28. package/build/components/badge/index.d.ts +19 -0
  29. package/build/components/badge/index.js +22 -0
  30. package/build/components/boost-score-bar/index.d.ts +5 -0
  31. package/build/components/boost-score-bar/index.js +35 -0
  32. package/build/components/boost-score-bar/types.d.ts +9 -0
  33. package/build/components/boost-score-bar/types.js +1 -0
  34. package/build/components/boost-score-graph/annotations-plugin.d.ts +16 -0
  35. package/build/components/boost-score-graph/annotations-plugin.js +58 -0
  36. package/build/components/boost-score-graph/background.d.ts +3 -0
  37. package/build/components/boost-score-graph/background.js +5 -0
  38. package/build/components/boost-score-graph/day-highlight-plugin.d.ts +13 -0
  39. package/build/components/boost-score-graph/day-highlight-plugin.js +69 -0
  40. package/build/components/boost-score-graph/get-date-format.d.ts +9 -0
  41. package/build/components/boost-score-graph/get-date-format.js +52 -0
  42. package/build/components/boost-score-graph/index.d.ts +44 -0
  43. package/build/components/boost-score-graph/index.js +42 -0
  44. package/build/components/boost-score-graph/tooltip.d.ts +3 -0
  45. package/build/components/boost-score-graph/tooltip.js +22 -0
  46. package/build/components/boost-score-graph/tooltips-plugin.d.ts +15 -0
  47. package/build/components/boost-score-graph/tooltips-plugin.js +78 -0
  48. package/build/components/boost-score-graph/uplot-line-chart.d.ts +27 -0
  49. package/build/components/boost-score-graph/uplot-line-chart.js +187 -0
  50. package/build/components/boost-score-graph/use-boost-score-transform.d.ts +14 -0
  51. package/build/components/boost-score-graph/use-boost-score-transform.js +26 -0
  52. package/build/components/boost-score-graph/use-resize.d.ts +9 -0
  53. package/build/components/boost-score-graph/use-resize.js +31 -0
  54. package/build/components/button/index.d.ts +10 -0
  55. package/build/components/button/index.js +45 -0
  56. package/build/components/button/types.d.ts +19 -0
  57. package/build/components/button/types.js +1 -0
  58. package/build/components/chip/index.d.ts +15 -0
  59. package/build/components/chip/index.js +16 -0
  60. package/build/components/contextual-upgrade-trigger/index.d.ts +4 -0
  61. package/build/components/contextual-upgrade-trigger/index.js +12 -0
  62. package/build/components/contextual-upgrade-trigger/types.d.ts +9 -0
  63. package/build/components/contextual-upgrade-trigger/types.js +1 -0
  64. package/build/components/copy-to-clipboard/index.d.ts +4 -0
  65. package/build/components/copy-to-clipboard/index.js +40 -0
  66. package/build/components/copy-to-clipboard/types.d.ts +6 -0
  67. package/build/components/copy-to-clipboard/types.js +1 -0
  68. package/build/components/decorative-card/index.d.ts +11 -0
  69. package/build/components/decorative-card/index.js +13 -0
  70. package/build/components/decorative-card/types.d.ts +14 -0
  71. package/build/components/decorative-card/types.js +1 -0
  72. package/build/components/dialog/index.d.ts +20 -0
  73. package/build/components/dialog/index.js +31 -0
  74. package/build/components/diff-viewer/index.d.ts +4 -0
  75. package/build/components/diff-viewer/index.js +33 -0
  76. package/build/components/diff-viewer/parse-filename.d.ts +29 -0
  77. package/build/components/diff-viewer/parse-filename.js +61 -0
  78. package/build/components/diff-viewer/parse-patch.d.ts +9 -0
  79. package/build/components/diff-viewer/parse-patch.js +148 -0
  80. package/build/components/donut-meter/index.d.ts +58 -0
  81. package/build/components/donut-meter/index.js +36 -0
  82. package/build/components/global-notices/global-notices.d.ts +11 -0
  83. package/build/components/global-notices/global-notices.js +19 -0
  84. package/build/components/global-notices/index.d.ts +3 -0
  85. package/build/components/global-notices/index.js +3 -0
  86. package/build/components/global-notices/use-global-notices.d.ts +10 -0
  87. package/build/components/global-notices/use-global-notices.js +30 -0
  88. package/build/components/gridicon/index.d.ts +14 -0
  89. package/build/components/gridicon/index.js +167 -0
  90. package/build/components/gridicon/types.d.ts +39 -0
  91. package/build/components/gridicon/types.js +1 -0
  92. package/build/components/icon-tooltip/index.d.ts +11 -0
  93. package/build/components/icon-tooltip/index.js +75 -0
  94. package/build/components/icon-tooltip/types.d.ts +69 -0
  95. package/build/components/icon-tooltip/types.js +1 -0
  96. package/build/components/icons/index.d.ts +70 -0
  97. package/build/components/icons/index.js +86 -0
  98. package/build/components/icons/types.d.ts +27 -0
  99. package/build/components/icons/types.js +1 -0
  100. package/build/components/indeterminate-progress-bar/index.d.ts +10 -0
  101. package/build/components/indeterminate-progress-bar/index.js +20 -0
  102. package/build/components/indeterminate-progress-bar/types.d.ts +6 -0
  103. package/build/components/indeterminate-progress-bar/types.js +1 -0
  104. package/build/components/jetpack-footer/index.d.ts +11 -0
  105. package/build/components/jetpack-footer/index.js +71 -0
  106. package/build/components/jetpack-footer/types.d.ts +47 -0
  107. package/build/components/jetpack-footer/types.js +1 -0
  108. package/build/components/jetpack-logo/index.d.ts +4 -0
  109. package/build/components/jetpack-logo/index.js +10 -0
  110. package/build/components/jetpack-logo/types.d.ts +7 -0
  111. package/build/components/jetpack-logo/types.js +1 -0
  112. package/build/components/jetpack-protect-logo/index.d.ts +4 -0
  113. package/build/components/jetpack-protect-logo/index.js +10 -0
  114. package/build/components/jetpack-protect-logo/types.d.ts +7 -0
  115. package/build/components/jetpack-protect-logo/types.js +1 -0
  116. package/build/components/jetpack-search-logo/index.d.ts +4 -0
  117. package/build/components/jetpack-search-logo/index.js +7 -0
  118. package/build/components/jetpack-search-logo/types.d.ts +7 -0
  119. package/build/components/jetpack-search-logo/types.js +1 -0
  120. package/build/components/jetpack-vaultpress-backup-logo/index.d.ts +4 -0
  121. package/build/components/jetpack-vaultpress-backup-logo/index.js +8 -0
  122. package/build/components/jetpack-vaultpress-backup-logo/types.d.ts +6 -0
  123. package/build/components/jetpack-vaultpress-backup-logo/types.js +1 -0
  124. package/build/components/jetpack-videopress-logo/index.d.ts +4 -0
  125. package/build/components/jetpack-videopress-logo/index.js +8 -0
  126. package/build/components/jetpack-videopress-logo/types.d.ts +6 -0
  127. package/build/components/jetpack-videopress-logo/types.js +1 -0
  128. package/build/components/layout/col/index.d.ts +10 -0
  129. package/build/components/layout/col/index.js +42 -0
  130. package/build/components/layout/container/index.d.ts +4 -0
  131. package/build/components/layout/container/index.js +30 -0
  132. package/build/components/layout/types.d.ts +58 -0
  133. package/build/components/layout/types.js +1 -0
  134. package/build/components/layout/use-breakpoint-match/index.d.ts +19 -0
  135. package/build/components/layout/use-breakpoint-match/index.js +50 -0
  136. package/build/components/loading-placeholder/index.d.ts +8 -0
  137. package/build/components/loading-placeholder/index.js +7 -0
  138. package/build/components/marked-lines/index.d.ts +4 -0
  139. package/build/components/marked-lines/index.js +50 -0
  140. package/build/components/notice/index.d.ts +29 -0
  141. package/build/components/notice/index.js +35 -0
  142. package/build/components/number-control/index.d.ts +10 -0
  143. package/build/components/number-control/index.js +16 -0
  144. package/build/components/number-format/index.d.ts +9 -0
  145. package/build/components/number-format/index.js +13 -0
  146. package/build/components/number-slider/index.d.ts +12 -0
  147. package/build/components/number-slider/index.js +43 -0
  148. package/build/components/number-slider/types.d.ts +50 -0
  149. package/build/components/number-slider/types.js +1 -0
  150. package/build/components/popover/index.d.ts +9 -0
  151. package/build/components/popover/index.js +6 -0
  152. package/build/components/pricing-card/index.d.ts +11 -0
  153. package/build/components/pricing-card/index.js +32 -0
  154. package/build/components/pricing-card/types.d.ts +51 -0
  155. package/build/components/pricing-card/types.js +1 -0
  156. package/build/components/pricing-table/index.d.ts +7 -0
  157. package/build/components/pricing-table/index.js +66 -0
  158. package/build/components/pricing-table/types.d.ts +68 -0
  159. package/build/components/pricing-table/types.js +1 -0
  160. package/build/components/product-offer/icons-card.d.ts +10 -0
  161. package/build/components/product-offer/icons-card.js +23 -0
  162. package/build/components/product-offer/index.d.ts +11 -0
  163. package/build/components/product-offer/index.js +31 -0
  164. package/build/components/product-offer/product-offer-header.d.ts +9 -0
  165. package/build/components/product-offer/product-offer-header.js +14 -0
  166. package/build/components/product-offer/types.d.ts +102 -0
  167. package/build/components/product-offer/types.js +1 -0
  168. package/build/components/product-price/index.d.ts +11 -0
  169. package/build/components/product-price/index.js +32 -0
  170. package/build/components/product-price/price.d.ts +9 -0
  171. package/build/components/product-price/price.js +19 -0
  172. package/build/components/product-price/types.d.ts +61 -0
  173. package/build/components/product-price/types.js +1 -0
  174. package/build/components/progress-bar/index.d.ts +10 -0
  175. package/build/components/progress-bar/index.js +26 -0
  176. package/build/components/progress-bar/types.d.ts +18 -0
  177. package/build/components/progress-bar/types.js +1 -0
  178. package/build/components/qr-code/index.d.ts +46 -0
  179. package/build/components/qr-code/index.js +21 -0
  180. package/build/components/radio-control/index.d.ts +24 -0
  181. package/build/components/radio-control/index.js +8 -0
  182. package/build/components/record-meter-bar/index.d.ts +62 -0
  183. package/build/components/record-meter-bar/index.js +40 -0
  184. package/build/components/spinner/index.d.ts +13 -0
  185. package/build/components/spinner/index.js +27 -0
  186. package/build/components/split-button/index.d.ts +4 -0
  187. package/build/components/split-button/index.js +8 -0
  188. package/build/components/split-button/types.d.ts +8 -0
  189. package/build/components/split-button/types.js +1 -0
  190. package/build/components/stat-card/index.d.ts +9 -0
  191. package/build/components/stat-card/index.js +27 -0
  192. package/build/components/stat-card/types.d.ts +29 -0
  193. package/build/components/stat-card/types.js +1 -0
  194. package/build/components/status/index.d.ts +8 -0
  195. package/build/components/status/index.js +18 -0
  196. package/build/components/terms-of-service/index.d.ts +5 -0
  197. package/build/components/terms-of-service/index.js +32 -0
  198. package/build/components/terms-of-service/types.d.ts +23 -0
  199. package/build/components/terms-of-service/types.js +1 -0
  200. package/build/components/testimonials/index.d.ts +3 -0
  201. package/build/components/testimonials/index.js +18 -0
  202. package/build/components/testimonials/testimonial.d.ts +4 -0
  203. package/build/components/testimonials/testimonial.js +7 -0
  204. package/build/components/testimonials/types.d.ts +13 -0
  205. package/build/components/testimonials/types.js +1 -0
  206. package/build/components/text/constants.d.ts +14 -0
  207. package/build/components/text/constants.js +29 -0
  208. package/build/components/text/index.d.ts +32 -0
  209. package/build/components/text/index.js +53 -0
  210. package/build/components/text/types.d.ts +50 -0
  211. package/build/components/text/types.js +1 -0
  212. package/build/components/theme-provider/index.d.ts +80 -0
  213. package/build/components/theme-provider/index.js +129 -0
  214. package/build/components/theme-provider/types.d.ts +23 -0
  215. package/build/components/theme-provider/types.js +1 -0
  216. package/build/components/threat-fixer-button/index.d.ts +17 -0
  217. package/build/components/threat-fixer-button/index.js +56 -0
  218. package/build/components/threat-severity-badge/index.d.ts +4 -0
  219. package/build/components/threat-severity-badge/index.js +13 -0
  220. package/build/components/threats-data-views/constants.d.ts +33 -0
  221. package/build/components/threats-data-views/constants.js +37 -0
  222. package/build/components/threats-data-views/index.d.ts +30 -0
  223. package/build/components/threats-data-views/index.js +413 -0
  224. package/build/components/threats-data-views/threats-status-toggle-group-control.d.ts +16 -0
  225. package/build/components/threats-data-views/threats-status-toggle-group-control.js +95 -0
  226. package/build/components/toggle-control/index.d.ts +21 -0
  227. package/build/components/toggle-control/index.js +21 -0
  228. package/build/components/upsell-banner/index.d.ts +14 -0
  229. package/build/components/upsell-banner/index.js +21 -0
  230. package/build/components/upsell-banner/types.d.ts +13 -0
  231. package/build/components/upsell-banner/types.js +1 -0
  232. package/build/components/zendesk-chat/constants.d.ts +1 -0
  233. package/build/components/zendesk-chat/constants.js +2 -0
  234. package/build/components/zendesk-chat/index.d.ts +3 -0
  235. package/build/components/zendesk-chat/index.js +27 -0
  236. package/build/components/zendesk-chat/types.d.ts +11 -0
  237. package/build/components/zendesk-chat/types.js +1 -0
  238. package/build/index.d.ts +67 -0
  239. package/build/index.js +81 -0
  240. package/build/lib/locale/index.d.ts +13 -0
  241. package/build/lib/locale/index.js +34 -0
  242. package/build/tools/get-product-checkout-url/index.d.ts +10 -0
  243. package/build/tools/get-product-checkout-url/index.js +22 -0
  244. package/build/tools/get-site-admin-url/index.d.ts +6 -0
  245. package/build/tools/get-site-admin-url/index.js +13 -0
  246. package/build/tools/jp-redirect/index.d.ts +20 -0
  247. package/build/tools/jp-redirect/index.js +50 -0
  248. package/build/tools/jp-redirect/types.d.ts +39 -0
  249. package/build/tools/jp-redirect/types.js +1 -0
  250. package/build/tools/pricing-utils/index.d.ts +8 -0
  251. package/build/tools/pricing-utils/index.js +9 -0
  252. package/build/tools/pricing-utils/types.d.ts +12 -0
  253. package/build/tools/pricing-utils/types.js +1 -0
  254. package/components/admin-page/index.tsx +2 -0
  255. package/components/admin-page/types.ts +5 -0
  256. package/components/boost-score-graph/uplot-line-chart.tsx +16 -1
  257. package/components/jetpack-footer/index.tsx +7 -24
  258. package/components/jetpack-footer/style.scss +5 -0
  259. package/components/jetpack-footer/types.ts +5 -0
  260. package/components/number-slider/index.tsx +8 -2
  261. package/package.json +13 -5
  262. package/tools/get-site-admin-url/index.ts +3 -0
@@ -0,0 +1,61 @@
1
+ const decompose = (path) => {
2
+ const lastSlash = path.lastIndexOf('/');
3
+ return lastSlash > -1
4
+ ? { prefix: path.slice(0, lastSlash), path: path.slice(lastSlash) }
5
+ : { prefix: '', path };
6
+ };
7
+ /**
8
+ * Parse the filename from a diff
9
+ *
10
+ * Uses a heuristic to return proper file name indicators
11
+ *
12
+ * It searches for the longest shared prefix and returns
13
+ * whatever remains after that. If the paths are identical
14
+ * it only returns a single filename as we have detected
15
+ * that the diff compares changes to only one file.
16
+ *
17
+ * An exception is made for `a/` and `b/` prefixes often
18
+ * added by `git` and other utilities to separate the left
19
+ * from the right when looking at the contents of a single
20
+ * file over time.
21
+ *
22
+ * @param {string} prev - filename of left contents
23
+ * @param {string} next - filename of right contents
24
+ *
25
+ * @return {object} - parsed filename
26
+ */
27
+ export default function (prev, next) {
28
+ // Remove 'a/' and 'b/' prefixes if present
29
+ const isLikelyPrefixed = prev.startsWith('a/') && next.startsWith('b/');
30
+ prev = isLikelyPrefixed ? prev.slice(2) : prev;
31
+ next = isLikelyPrefixed ? next.slice(2) : next;
32
+ if (prev === next) {
33
+ // Paths are identical
34
+ const { prefix, path } = decompose(prev);
35
+ return { prev: { prefix, path }, next: { prefix, path } };
36
+ }
37
+ // Find longest shared base path ending with a slash
38
+ const length = Math.max(prev.length, next.length);
39
+ for (let i = 0, slash = 0; i < length; i++) {
40
+ if (prev[i] === '/' && next[i] === '/') {
41
+ slash = i;
42
+ }
43
+ if (prev[i] !== next[i]) {
44
+ return {
45
+ prev: {
46
+ prefix: prev.slice(0, slash),
47
+ path: prev.slice(slash),
48
+ },
49
+ next: {
50
+ prefix: next.slice(0, slash),
51
+ path: next.slice(slash),
52
+ },
53
+ };
54
+ }
55
+ }
56
+ // No shared base path
57
+ return {
58
+ prev: decompose(prev),
59
+ next: decompose(next),
60
+ };
61
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Parse Patch
3
+ *
4
+ * Adapted from https://github.com/kpdecker/jsdiff/blob/master/src/patch/parse.js
5
+ *
6
+ * @param {string} uniDiff - diff string
7
+ * @return {Array} - array of parsed files
8
+ */
9
+ export default function parsePatch(uniDiff: string): any[];
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Parse Patch
3
+ *
4
+ * Adapted from https://github.com/kpdecker/jsdiff/blob/master/src/patch/parse.js
5
+ *
6
+ * @param {string} uniDiff - diff string
7
+ * @return {Array} - array of parsed files
8
+ */
9
+ export default function parsePatch(uniDiff) {
10
+ const diffstr = uniDiff.split(/\n/);
11
+ const list = [];
12
+ let i = 0;
13
+ /**
14
+ * Parse Index
15
+ */
16
+ function parseIndex() {
17
+ const index = {};
18
+ list.push(index);
19
+ // Parse diff metadata
20
+ while (i < diffstr.length) {
21
+ const line = diffstr[i];
22
+ // File header found, end parsing diff metadata
23
+ if (/^(---|\+\+\+|@@)\s/.test(line)) {
24
+ break;
25
+ }
26
+ // Diff index
27
+ const header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
28
+ if (header) {
29
+ index.index = header[1];
30
+ }
31
+ i++;
32
+ }
33
+ // Parse file headers if they are defined. Unified diff requires them, but
34
+ // there's no technical issues to have an isolated hunk without file header
35
+ parseFileHeader(index);
36
+ parseFileHeader(index);
37
+ // Parse hunks
38
+ index.hunks = [];
39
+ while (i < diffstr.length) {
40
+ const _line = diffstr[i];
41
+ if (/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(_line)) {
42
+ break;
43
+ }
44
+ else if (/^@@/.test(_line)) {
45
+ index.hunks.push(parseHunk());
46
+ }
47
+ else if (_line) {
48
+ throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
49
+ }
50
+ else {
51
+ i++;
52
+ }
53
+ }
54
+ }
55
+ /**
56
+ * Parse File Header
57
+ *
58
+ * Parses the --- and +++ headers, if none are found, no lines
59
+ * are consumed.
60
+ *
61
+ * @param {Array} index - array of parsed files
62
+ * @param {unknown} index.index - index
63
+ * @param {object[]} index.hunks - hunks
64
+ */
65
+ function parseFileHeader(index) {
66
+ const fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]);
67
+ if (fileHeader) {
68
+ const keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
69
+ const data = fileHeader[2].split('\t', 2);
70
+ let fileName = data[0].replace(/\\\\/g, '\\');
71
+ if (/^".*"$/.test(fileName)) {
72
+ fileName = fileName.substr(1, fileName.length - 2);
73
+ }
74
+ index[keyPrefix + 'FileName'] = fileName;
75
+ index[keyPrefix + 'Header'] = (data[1] || '').trim();
76
+ i++;
77
+ }
78
+ }
79
+ /**
80
+ * Parse Hunk
81
+ * This assumes that we are at the start of a hunk.
82
+ *
83
+ * @return {object} - The parsed hunk.
84
+ */
85
+ function parseHunk() {
86
+ const chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
87
+ const hunk = {
88
+ oldStart: +chunkHeader[1],
89
+ oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
90
+ newStart: +chunkHeader[3],
91
+ newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
92
+ lines: [],
93
+ };
94
+ // Unified Diff Format quirk: If the chunk size is 0,
95
+ // the first number is one lower than one would expect.
96
+ // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
97
+ if (hunk.oldLines === 0) {
98
+ hunk.oldStart += 1;
99
+ }
100
+ if (hunk.newLines === 0) {
101
+ hunk.newStart += 1;
102
+ }
103
+ let addCount = 0, removeCount = 0, _diffstr$i;
104
+ for (; i < diffstr.length &&
105
+ (removeCount < hunk.oldLines ||
106
+ addCount < hunk.newLines ||
107
+ ((_diffstr$i = diffstr[i]) !== null &&
108
+ _diffstr$i !== void 0 &&
109
+ _diffstr$i.startsWith('\\'))); i++) {
110
+ const operation = diffstr[i].length === 0 && i !== diffstr.length - 1 ? ' ' : diffstr[i][0];
111
+ if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
112
+ hunk.lines.push(diffstr[i]);
113
+ if (operation === '+') {
114
+ addCount++;
115
+ }
116
+ else if (operation === '-') {
117
+ removeCount++;
118
+ }
119
+ else if (operation === ' ') {
120
+ addCount++;
121
+ removeCount++;
122
+ }
123
+ }
124
+ else {
125
+ throw new Error(`Hunk at line ${chunkHeaderIndex + 1} contained invalid line ${diffstr[i]}`);
126
+ }
127
+ }
128
+ // Handle the empty block count case
129
+ if (!addCount && hunk.newLines === 1) {
130
+ hunk.newLines = 0;
131
+ }
132
+ if (!removeCount && hunk.oldLines === 1) {
133
+ hunk.oldLines = 0;
134
+ }
135
+ // Perform sanity checking
136
+ if (addCount !== hunk.newLines) {
137
+ throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
138
+ }
139
+ if (removeCount !== hunk.oldLines) {
140
+ throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
141
+ }
142
+ return hunk;
143
+ }
144
+ while (i < diffstr.length) {
145
+ parseIndex();
146
+ }
147
+ return list;
148
+ }
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import './style.scss';
3
+ export type DonutMeterProps = {
4
+ /**
5
+ * Total number of items for the donut meter.
6
+ */
7
+ totalCount: number;
8
+ /**
9
+ * Count for the given item
10
+ */
11
+ segmentCount: number;
12
+ /**
13
+ * Dictates the segment color of the donut meter. Defaults to 'success' and overrides useAdaptiveColors.
14
+ * Possible values:
15
+ * - 'warning': yellow donut
16
+ * - 'error': red donut
17
+ * - 'success': green donut
18
+ */
19
+ type?: string;
20
+ /**
21
+ * thickness for the chart border
22
+ * If not provided, defaults to 3.5
23
+ */
24
+ thickness?: string;
25
+ /**
26
+ * width for the full chart size
27
+ * If not provided, defaults to 64px
28
+ */
29
+ donutWidth?: string;
30
+ /**
31
+ * Localized title for meter.
32
+ * Not visible. Used for a11y support.
33
+ * If not provided, defaults to an empty string.
34
+ */
35
+ title?: string;
36
+ /**
37
+ * Localized description for meter.
38
+ * Not visible. Used for a11y support.
39
+ * If not provided, defaults to an empty string.
40
+ */
41
+ description?: string;
42
+ /**
43
+ * Changes colors according to the fullness of the meter.
44
+ */
45
+ useAdaptiveColors?: boolean;
46
+ /**
47
+ * Class name to append to the topmost container.
48
+ */
49
+ className?: string;
50
+ };
51
+ /**
52
+ * Generate record meter donut bar
53
+ *
54
+ * @param {DonutMeterProps} props - Props
55
+ * @return {React.ReactElement} - JSX element
56
+ */
57
+ declare const DonutMeter: React.FC<DonutMeterProps>;
58
+ export default DonutMeter;
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import './style.scss';
3
+ const getAdaptiveType = (percentage) => {
4
+ if (percentage < 70) {
5
+ return 'success';
6
+ }
7
+ if (percentage < 100) {
8
+ return 'warning';
9
+ }
10
+ return 'danger';
11
+ };
12
+ /**
13
+ * Generate record meter donut bar
14
+ *
15
+ * @param {DonutMeterProps} props - Props
16
+ * @return {React.ReactElement} - JSX element
17
+ */
18
+ const DonutMeter = ({ className = '', description = '', donutWidth = '64px', segmentCount, thickness = '3.5', title = '', totalCount, type, useAdaptiveColors, }) => {
19
+ const validDivisor = totalCount === 0 ? 1 : totalCount;
20
+ const percentage = (segmentCount / validDivisor) * 100;
21
+ // If we don't have a title or description, hide the meter from screen readers.
22
+ const isHidden = typeof title === 'string' &&
23
+ title.length === 0 &&
24
+ typeof description === 'string' &&
25
+ description.length === 0
26
+ ? 'true'
27
+ : 'false';
28
+ const finalClassName = `donut-meter ${className ? className + ' ' : ''}${type ? 'is-' + type + ' ' : ''} ${!type && useAdaptiveColors ? 'is-' + getAdaptiveType(percentage) + ' ' : ''}`.trim();
29
+ return (_jsx("div", { className: finalClassName, "aria-hidden": isHidden, "data-testid": "donut-meter", children: _jsxs("svg", { width: donutWidth, height: donutWidth, viewBox: "0 0 40 40", className: "donut-meter_svg", role: "img", children: [_jsx("title", { id: "donut-meter-title", children: title }), _jsx("desc", { id: "donut-meter-description", children: description }), _jsx("circle", { className: "donut-meter-hole", cx: "20" // center x value of circle
30
+ , cy: "20" // center y value of circle
31
+ , r: "15.91549430918954" // radius based on the circumference r = 100/(2π)
32
+ , fill: "transparent" }), _jsx("circle", { className: "donut-meter-ring", cx: "20", cy: "20", r: "15.91549430918954", fill: "transparent", strokeWidth: thickness, stroke: "#ebebeb" }), _jsx("circle", { className: "donut-meter-segment", cx: "20", cy: "20", r: "15.91549430918954", fill: "transparent", "transform-origin": "center" // eslint-disable-line react/no-unknown-property -- @todo Switch to transformOrigin when we use React 19.
33
+ , strokeWidth: thickness, strokeDasharray: `${percentage} ${100 - percentage}`, strokeDashoffset: "-25" // this ensures the segment begins at the bottom of the donut instead of the top
34
+ })] }) }));
35
+ };
36
+ export default DonutMeter;
@@ -0,0 +1,11 @@
1
+ export type GlobalNoticesProps = {
2
+ maxVisibleNotices?: number;
3
+ };
4
+ /**
5
+ * Renders the global notices.
6
+ *
7
+ * @param {GlobalNoticesProps} props - Component props.
8
+ *
9
+ * @return {import('react').ReactNode} The rendered notices list.
10
+ */
11
+ export declare function GlobalNotices({ maxVisibleNotices }: GlobalNoticesProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SnackbarList } from '@wordpress/components';
3
+ import styles from './styles.module.scss';
4
+ import { useGlobalNotices } from './use-global-notices.js';
5
+ /**
6
+ * Renders the global notices.
7
+ *
8
+ * @param {GlobalNoticesProps} props - Component props.
9
+ *
10
+ * @return {import('react').ReactNode} The rendered notices list.
11
+ */
12
+ export function GlobalNotices({ maxVisibleNotices = 3 }) {
13
+ const { getNotices, removeNotice } = useGlobalNotices();
14
+ const snackbarNotices = getNotices()
15
+ .filter(({ type }) => type === 'snackbar')
16
+ // Slices from the tail end of the list.
17
+ .slice(-maxVisibleNotices);
18
+ return (_jsx(SnackbarList, { notices: snackbarNotices, className: styles['global-notices'], onRemove: removeNotice }));
19
+ }
@@ -0,0 +1,3 @@
1
+ export * from './global-notices.js';
2
+ export * from './use-global-notices.js';
3
+ export { store as globalNoticesStore } from '@wordpress/notices';
@@ -0,0 +1,3 @@
1
+ export * from './global-notices.js';
2
+ export * from './use-global-notices.js';
3
+ export { store as globalNoticesStore } from '@wordpress/notices';
@@ -0,0 +1,10 @@
1
+ import { store as noticesStore } from '@wordpress/notices';
2
+ type NoticesStore = ReturnType<(typeof noticesStore)['instantiate']>;
3
+ export type TGlobalNotices = ReturnType<NoticesStore['getActions']> & ReturnType<NoticesStore['getSelectors']>;
4
+ /**
5
+ * The global notices hook.
6
+ *
7
+ * @return {TGlobalNotices} The global notices selectors and actions.
8
+ */
9
+ export declare function useGlobalNotices(): TGlobalNotices;
10
+ export {};
@@ -0,0 +1,30 @@
1
+ import { useDispatch, useSelect } from '@wordpress/data';
2
+ import { store as noticesStore } from '@wordpress/notices';
3
+ /**
4
+ * The global notices hook.
5
+ *
6
+ * @return {TGlobalNotices} The global notices selectors and actions.
7
+ */
8
+ export function useGlobalNotices() {
9
+ const actionCreators = useDispatch(noticesStore);
10
+ const notices = useSelect(select => select(noticesStore).getNotices(), []);
11
+ return {
12
+ ...actionCreators,
13
+ createNotice(status, content, options) {
14
+ return actionCreators.createNotice(status, content, { type: 'snackbar', ...options });
15
+ },
16
+ createErrorNotice(content, options) {
17
+ return actionCreators.createErrorNotice(content, { type: 'snackbar', ...options });
18
+ },
19
+ createInfoNotice(content, options) {
20
+ return actionCreators.createInfoNotice(content, { type: 'snackbar', ...options });
21
+ },
22
+ createSuccessNotice(content, options) {
23
+ return actionCreators.createSuccessNotice(content, { type: 'snackbar', ...options });
24
+ },
25
+ createWarningNotice(content, options) {
26
+ return actionCreators.createWarningNotice(content, { type: 'snackbar', ...options });
27
+ },
28
+ getNotices: () => notices,
29
+ };
30
+ }
@@ -0,0 +1,14 @@
1
+ import { Component } from 'react';
2
+ import './style.scss';
3
+ import { GridiconProps } from './types.js';
4
+ declare class Gridicon extends Component<GridiconProps> {
5
+ static defaultProps: {
6
+ 'aria-hidden': string;
7
+ focusable: string;
8
+ };
9
+ needsOffset(icon: any, size: any): boolean;
10
+ getSVGDescription(icon: any): string;
11
+ renderIcon(icon: any): import("react/jsx-runtime").JSX.Element;
12
+ render(): import("react/jsx-runtime").JSX.Element;
13
+ }
14
+ export default Gridicon;
@@ -0,0 +1,167 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* !!!
3
+ This is a fork of the Jetpack Gridicon code:
4
+ https://github.com/Automattic/jetpack/blob/f8078c2cd12ac508334da2fb08e37a92cf283c14/_inc/client/components/gridicon/index.jsx
5
+
6
+ It has been modified to work with Preact, and only includes the icons that we need.
7
+ !!! */
8
+ import { __ } from '@wordpress/i18n';
9
+ import clsx from 'clsx';
10
+ import { Component } from 'react';
11
+ import './style.scss';
12
+ class Gridicon extends Component {
13
+ static defaultProps = {
14
+ 'aria-hidden': 'false',
15
+ focusable: 'true',
16
+ };
17
+ needsOffset(icon, size) {
18
+ const iconNeedsOffset = [
19
+ 'gridicons-arrow-left',
20
+ 'gridicons-arrow-right',
21
+ 'gridicons-calendar',
22
+ 'gridicons-cart',
23
+ 'gridicons-folder',
24
+ 'gridicons-help-outline',
25
+ 'gridicons-info',
26
+ 'gridicons-info-outline',
27
+ 'gridicons-posts',
28
+ 'gridicons-star-outline',
29
+ 'gridicons-star',
30
+ ];
31
+ if (iconNeedsOffset.indexOf(icon) >= 0) {
32
+ return size % 18 === 0;
33
+ }
34
+ return false;
35
+ }
36
+ getSVGDescription(icon) {
37
+ // Enable overriding desc with falsy/truthy values.
38
+ if ('description' in this.props) {
39
+ return this.props.description;
40
+ }
41
+ switch (icon) {
42
+ default:
43
+ return '';
44
+ case 'gridicons-audio':
45
+ return __('Has audio.', 'jetpack-components');
46
+ case 'gridicons-arrow-left':
47
+ return __('Arrow left', 'jetpack-components');
48
+ case 'gridicons-arrow-right':
49
+ return __('Arrow right', 'jetpack-components');
50
+ case 'gridicons-calendar':
51
+ return __('Is an event.', 'jetpack-components');
52
+ case 'gridicons-cart':
53
+ return __('Is a product.', 'jetpack-components');
54
+ case 'chevron-down':
55
+ return __('Show filters', 'jetpack-components');
56
+ case 'gridicons-comment':
57
+ return __('Matching comment.', 'jetpack-components');
58
+ case 'gridicons-cross':
59
+ return __('Close.', 'jetpack-components');
60
+ case 'gridicons-filter':
61
+ return __('Toggle search filters.', 'jetpack-components');
62
+ case 'gridicons-folder':
63
+ return __('Category', 'jetpack-components');
64
+ case 'gridicons-help-outline':
65
+ return __('Help', 'jetpack-components');
66
+ case 'gridicons-info':
67
+ case 'gridicons-info-outline':
68
+ return __('Information.', 'jetpack-components');
69
+ case 'gridicons-image-multiple':
70
+ return __('Has multiple images.', 'jetpack-components');
71
+ case 'gridicons-image':
72
+ return __('Has an image.', 'jetpack-components');
73
+ case 'gridicons-page':
74
+ return __('Page', 'jetpack-components');
75
+ case 'gridicons-post':
76
+ return __('Post', 'jetpack-components');
77
+ case 'gridicons-jetpack-search':
78
+ case 'gridicons-search':
79
+ return __('Magnifying Glass', 'jetpack-components');
80
+ case 'gridicons-tag':
81
+ return __('Tag', 'jetpack-components');
82
+ case 'gridicons-video':
83
+ return __('Has a video.', 'jetpack-components');
84
+ }
85
+ }
86
+ renderIcon(icon) {
87
+ switch (icon) {
88
+ default:
89
+ return null;
90
+ case 'gridicons-audio':
91
+ return (_jsx("g", { children: _jsx("path", { d: "M8 4v10.184C7.686 14.072 7.353 14 7 14c-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V7h7v4.184c-.314-.112-.647-.184-1-.184-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V4H8z" }) }));
92
+ case 'gridicons-arrow-left':
93
+ return (_jsx("g", { children: _jsx("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" }) }));
94
+ case 'gridicons-arrow-right':
95
+ return (_jsx("g", { children: _jsx("path", { d: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" }) }));
96
+ case 'gridicons-block':
97
+ return (_jsx("g", { children: _jsx("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12c0-4.418 3.582-8 8-8 1.848 0 3.545.633 4.9 1.686L5.686 16.9C4.633 15.545 4 13.848 4 12zm8 8c-1.848 0-3.546-.633-4.9-1.686L18.314 7.1C19.367 8.455 20 10.152 20 12c0 4.418-3.582 8-8 8z" }) }));
98
+ case 'gridicons-calendar':
99
+ return (_jsx("g", { children: _jsx("path", { d: "M19 4h-1V2h-2v2H8V2H6v2H5c-1.105 0-2 .896-2 2v13c0 1.104.895 2 2 2h14c1.104 0 2-.896 2-2V6c0-1.104-.896-2-2-2zm0 15H5V8h14v11z" }) }));
100
+ case 'gridicons-cart':
101
+ return (_jsx("g", { children: _jsx("path", { d: "M9 20c0 1.1-.9 2-2 2s-1.99-.9-1.99-2S5.9 18 7 18s2 .9 2 2zm8-2c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm.396-5c.937 0 1.75-.65 1.952-1.566L21 5H7V4c0-1.105-.895-2-2-2H3v2h2v11c0 1.105.895 2 2 2h12c0-1.105-.895-2-2-2H7v-2h10.396z" }) }));
102
+ case 'gridicons-checkmark':
103
+ return (_jsx("g", { children: _jsx("path", { d: "M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z" }) }));
104
+ case 'gridicons-chevron-left':
105
+ return (_jsx("g", { children: _jsx("path", { d: "M16.443 7.41L15.0399 6L9.06934 12L15.0399 18L16.443 16.59L11.8855 12L16.443 7.41Z" }) }));
106
+ case 'gridicons-chevron-right':
107
+ return (_jsx("g", { children: _jsx("path", { d: "M10.2366 6L8.8335 7.41L13.391 12L8.8335 16.59L10.2366 18L16.2072 12L10.2366 6Z" }) }));
108
+ case 'gridicons-chevron-down':
109
+ return (_jsx("g", { children: _jsx("path", { d: "M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586" }) }));
110
+ case 'gridicons-comment':
111
+ return (_jsx("g", { children: _jsx("path", { d: "M3 6v9c0 1.105.895 2 2 2h9v5l5.325-3.804c1.05-.75 1.675-1.963 1.675-3.254V6c0-1.105-.895-2-2-2H5c-1.105 0-2 .895-2 2z" }) }));
112
+ case 'gridicons-computer':
113
+ return (_jsx("g", { children: _jsx("path", { d: "M20 2H4c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h6v2H7v2h10v-2h-3v-2h6c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm0 14H4V4h16v12z" }) }));
114
+ case 'gridicons-cross':
115
+ return (_jsx("g", { children: _jsx("path", { d: "M18.36 19.78L12 13.41l-6.36 6.37-1.42-1.42L10.59 12 4.22 5.64l1.42-1.42L12 10.59l6.36-6.36 1.41 1.41L13.41 12l6.36 6.36z" }) }));
116
+ case 'gridicons-filter':
117
+ return (_jsx("g", { children: _jsx("path", { d: "M10 19h4v-2h-4v2zm-4-6h12v-2H6v2zM3 5v2h18V5H3z" }) }));
118
+ case 'gridicons-folder':
119
+ return (_jsx("g", { children: _jsx("path", { d: "M18 19H6c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2h7c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2z" }) }));
120
+ case 'gridicons-help-outline':
121
+ return (_jsx("g", { children: _jsx("path", { d: "M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-1.962-2v-.528c0-.4.082-.74.246-1.017.163-.276.454-.546.87-.808.333-.21.572-.397.717-.565.146-.168.22-.36.22-.577 0-.172-.078-.308-.234-.41-.156-.1-.358-.15-.608-.15-.62 0-1.34.22-2.168.658l-.854-1.67c1.02-.58 2.084-.872 3.194-.872.913 0 1.63.202 2.15.603.52.4.78.948.78 1.64 0 .495-.116.924-.347 1.287-.23.362-.6.705-1.11 1.03-.43.278-.7.48-.807.61-.108.13-.163.282-.163.458V13h-1.885z" }) }));
122
+ case 'gridicons-image':
123
+ return (_jsx("g", { children: _jsx("path", { d: "M13 9.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5-.672 1.5-1.5 1.5-1.5-.672-1.5-1.5zM22 6v12c0 1.105-.895 2-2 2H4c-1.105 0-2-.895-2-2V6c0-1.105.895-2 2-2h16c1.105 0 2 .895 2 2zm-2 0H4v7.444L8 9l5.895 6.55 1.587-1.85c.798-.932 2.24-.932 3.037 0L20 15.426V6z" }) }));
124
+ case 'gridicons-image-multiple':
125
+ return (_jsx("g", { children: _jsx("path", { d: "M15 7.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5S17.328 9 16.5 9 15 8.328 15 7.5zM4 20h14c0 1.105-.895 2-2 2H4c-1.1 0-2-.9-2-2V8c0-1.105.895-2 2-2v14zM22 4v12c0 1.105-.895 2-2 2H8c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zM8 4v6.333L11 7l4.855 5.395.656-.73c.796-.886 2.183-.886 2.977 0l.513.57V4H8z" }) }));
126
+ case 'gridicons-info':
127
+ return (_jsx("g", { children: _jsx("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }));
128
+ case 'gridicons-info-outline':
129
+ return (_jsx("g", { children: _jsx("path", { d: "M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z" }) }));
130
+ case 'gridicons-jetpack-search':
131
+ return (_jsx("g", { children: _jsx("path", { d: "M0 9.257C0 4.15 4.151 0 9.257 0c5.105 0 9.256 4.151 9.256 9.257a9.218 9.218 0 01-2.251 6.045l.034.033h1.053L24 22.01l-1.986 1.989-6.664-6.662v-1.055l-.033-.033a9.218 9.218 0 01-6.06 2.264C4.15 18.513 0 14.362 0 9.257zm4.169 1.537h4.61V1.82l-4.61 8.973zm5.547-3.092v8.974l4.61-8.974h-4.61z" }) }));
132
+ case 'gridicons-phone':
133
+ return (_jsx("g", { children: _jsx("path", { d: "M16 2H8c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h8c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-3 19h-2v-1h2v1zm3-2H8V5h8v14z" }) }));
134
+ case 'gridicons-pages':
135
+ return (_jsx("g", { children: _jsx("path", { d: "M16 8H8V6h8v2zm0 2H8v2h8v-2zm4-6v12l-6 6H6c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zm-2 10V4H6v16h6v-4c0-1.105.895-2 2-2h4z" }) }));
136
+ case 'gridicons-posts':
137
+ return (_jsx("g", { children: _jsx("path", { d: "M16 19H3v-2h13v2zm5-10H3v2h18V9zM3 5v2h11V5H3zm14 0v2h4V5h-4zm-6 8v2h10v-2H11zm-8 0v2h5v-2H3z" }) }));
138
+ case 'gridicons-search':
139
+ return (_jsx("g", { children: _jsx("path", { d: "M21 19l-5.154-5.154C16.574 12.742 17 11.42 17 10c0-3.866-3.134-7-7-7s-7 3.134-7 7 3.134 7 7 7c1.42 0 2.742-.426 3.846-1.154L19 21l2-2zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5z" }) }));
140
+ case 'gridicons-star-outline':
141
+ return (_jsx("g", { children: _jsx("path", { d: "M12 6.308l1.176 3.167.347.936.997.042 3.374.14-2.647 2.09-.784.62.27.963.91 3.25-2.813-1.872-.83-.553-.83.552-2.814 1.87.91-3.248.27-.962-.783-.62-2.648-2.092 3.374-.14.996-.04.347-.936L12 6.308M12 2L9.418 8.953 2 9.257l5.822 4.602L5.82 21 12 16.89 18.18 21l-2.002-7.14L22 9.256l-7.418-.305L12 2z" }) }));
142
+ case 'gridicons-star':
143
+ return (_jsx("g", { children: _jsx("path", { d: "M12 2l2.582 6.953L22 9.257l-5.822 4.602L18.18 21 12 16.89 5.82 21l2.002-7.14L2 9.256l7.418-.304" }) }));
144
+ case 'gridicons-tag':
145
+ return (_jsx("g", { children: _jsx("path", { d: "M20 2.007h-7.087c-.53 0-1.04.21-1.414.586L2.592 11.5c-.78.78-.78 2.046 0 2.827l7.086 7.086c.78.78 2.046.78 2.827 0l8.906-8.906c.376-.374.587-.883.587-1.413V4.007c0-1.105-.895-2-2-2zM17.007 9c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z" }) }));
146
+ case 'gridicons-video':
147
+ return (_jsx("g", { children: _jsx("path", { d: "M20 4v2h-2V4H6v2H4V4c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2v-2h2v2h12v-2h2v2c1.105 0 2-.895 2-2V6c0-1.105-.895-2-2-2zM6 16H4v-3h2v3zm0-5H4V8h2v3zm4 4V9l4.5 3-4.5 3zm10 1h-2v-3h2v3zm0-5h-2V8h2v3z" }) }));
148
+ case 'gridicons-lock':
149
+ return (_jsxs(_Fragment, { children: [_jsx("g", { id: "lock", children: _jsx("path", { d: "M18,8h-1V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H6c-1.105,0-2,0.895-2,2v10c0,1.105,0.895,2,2,2h12c1.105,0,2-0.895,2-2V10\n\t\t\t\t\t\t\t\t\tC20,8.895,19.105,8,18,8z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M13,15.723V18h-2v-2.277c-0.595-0.346-1-0.984-1-1.723\n\t\t\t\t\t\t\t\t\tc0-1.105,0.895-2,2-2s2,0.895,2,2C14,14.738,13.595,15.376,13,15.723z" }) }), _jsx("g", { id: "Layer_1" })] }));
150
+ case 'gridicons-external':
151
+ return (_jsx("g", { children: _jsx("path", { d: "M19 13v6c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h6v2H5v12h12v-6h2zM13 3v2h4.586l-7.793 7.793 1.414 1.414L19 6.414V11h2V3h-8z" }) }));
152
+ }
153
+ }
154
+ render() {
155
+ const { size = 24, className = '' } = this.props;
156
+ const height = this.props.height || size;
157
+ const width = this.props.width || size;
158
+ const style = this.props.style || { height, width };
159
+ const icon = 'gridicons-' + this.props.icon;
160
+ const iconClass = clsx('gridicon', icon, className, {
161
+ 'needs-offset': this.needsOffset(icon, size),
162
+ });
163
+ const description = this.getSVGDescription(icon);
164
+ return (_jsxs("svg", { className: iconClass, focusable: this.props.focusable, height: height, onClick: this.props.onClick, style: style, viewBox: "0 0 24 24", width: width, xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.props['aria-hidden'], children: [description ? _jsx("desc", { children: description }) : null, this.renderIcon(icon)] }));
165
+ }
166
+ }
167
+ export default Gridicon;
@@ -0,0 +1,39 @@
1
+ import type { CSSProperties } from 'react';
2
+ export type GridiconProps = {
3
+ /**
4
+ * Icon name
5
+ */
6
+ icon: string;
7
+ /**
8
+ * HTML class name
9
+ */
10
+ className?: string;
11
+ /**
12
+ * Description for SVG for screen readers
13
+ */
14
+ description?: string;
15
+ /**
16
+ * Whether SVG is focussable
17
+ */
18
+ focusable?: boolean;
19
+ /**
20
+ * SVG height
21
+ */
22
+ height?: number;
23
+ /**
24
+ * Click handler
25
+ */
26
+ onClick?: VoidFunction;
27
+ /**
28
+ * SVG width and height
29
+ */
30
+ size?: number;
31
+ /**
32
+ * SVG style
33
+ */
34
+ style?: CSSProperties;
35
+ /**
36
+ * SVG width
37
+ */
38
+ width?: number;
39
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { IconTooltipProps } from './types.js';
3
+ import './style.scss';
4
+ /**
5
+ * Generate Icon Tooltip
6
+ *
7
+ * @param {IconTooltipProps} props - Props
8
+ * @return {React.ReactElement} - JSX element
9
+ */
10
+ declare const IconTooltip: React.FC<IconTooltipProps>;
11
+ export default IconTooltip;