@atlaskit/link-picker 1.1.1 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/browser.js +39 -0
  3. package/dist/cjs/index.js +13 -0
  4. package/dist/cjs/messages.js +117 -0
  5. package/dist/cjs/transformTimeStamp.js +55 -0
  6. package/dist/cjs/types.js +5 -0
  7. package/dist/cjs/ui/announcer.js +64 -0
  8. package/dist/cjs/ui/link-picker.js +613 -0
  9. package/dist/cjs/ui/link-search-list/index.js +102 -0
  10. package/dist/cjs/ui/link-search-list/styled.js +21 -0
  11. package/dist/cjs/ui/link-search-no-results/index.js +27 -0
  12. package/dist/cjs/ui/link-search-no-results/no-results-svg/index.js +69 -0
  13. package/dist/cjs/ui/link-search-no-results/no-results-svg/styled.js +20 -0
  14. package/dist/cjs/ui/list-item/index.js +103 -0
  15. package/dist/cjs/ui/list-item/styled.js +59 -0
  16. package/dist/cjs/ui/styled.js +32 -0
  17. package/dist/cjs/ui/text-input/index.js +116 -0
  18. package/dist/cjs/ui/text-input/styled.js +25 -0
  19. package/dist/cjs/url.js +104 -0
  20. package/dist/cjs/utils.js +27 -0
  21. package/dist/cjs/version.json +5 -0
  22. package/dist/es2019/browser.js +34 -0
  23. package/dist/es2019/index.js +1 -0
  24. package/dist/es2019/messages.js +108 -0
  25. package/dist/es2019/transformTimeStamp.js +41 -0
  26. package/dist/es2019/types.js +1 -0
  27. package/dist/es2019/ui/announcer.js +38 -0
  28. package/dist/es2019/ui/link-picker.js +501 -0
  29. package/dist/es2019/ui/link-search-list/index.js +60 -0
  30. package/dist/es2019/ui/link-search-list/styled.js +13 -0
  31. package/dist/es2019/ui/link-search-no-results/index.js +10 -0
  32. package/dist/es2019/ui/link-search-no-results/no-results-svg/index.js +60 -0
  33. package/dist/es2019/ui/link-search-no-results/no-results-svg/styled.js +8 -0
  34. package/dist/es2019/ui/list-item/index.js +88 -0
  35. package/dist/es2019/ui/list-item/styled.js +65 -0
  36. package/dist/es2019/ui/styled.js +28 -0
  37. package/dist/es2019/ui/text-input/index.js +99 -0
  38. package/dist/es2019/ui/text-input/styled.js +15 -0
  39. package/dist/es2019/url.js +88 -0
  40. package/dist/es2019/utils.js +13 -0
  41. package/dist/es2019/version.json +5 -0
  42. package/dist/esm/browser.js +34 -0
  43. package/dist/esm/index.js +1 -0
  44. package/dist/esm/messages.js +108 -0
  45. package/dist/esm/transformTimeStamp.js +41 -0
  46. package/dist/esm/types.js +1 -0
  47. package/dist/esm/ui/announcer.js +51 -0
  48. package/dist/esm/ui/link-picker.js +591 -0
  49. package/dist/esm/ui/link-search-list/index.js +88 -0
  50. package/dist/esm/ui/link-search-list/styled.js +8 -0
  51. package/dist/esm/ui/link-search-no-results/index.js +14 -0
  52. package/dist/esm/ui/link-search-no-results/no-results-svg/index.js +60 -0
  53. package/dist/esm/ui/link-search-no-results/no-results-svg/styled.js +8 -0
  54. package/dist/esm/ui/list-item/index.js +90 -0
  55. package/dist/esm/ui/list-item/styled.js +37 -0
  56. package/dist/esm/ui/styled.js +16 -0
  57. package/dist/esm/ui/text-input/index.js +99 -0
  58. package/dist/esm/ui/text-input/styled.js +10 -0
  59. package/dist/esm/url.js +90 -0
  60. package/dist/esm/utils.js +13 -0
  61. package/dist/esm/version.json +5 -0
  62. package/dist/types/browser.d.ts +15 -0
  63. package/dist/types/index.d.ts +3 -0
  64. package/dist/types/messages.d.ts +107 -0
  65. package/dist/types/transformTimeStamp.d.ts +3 -0
  66. package/dist/types/types.d.ts +40 -0
  67. package/dist/types/ui/announcer.d.ts +22 -0
  68. package/dist/types/ui/link-picker.d.ts +52 -0
  69. package/dist/types/ui/link-search-list/index.d.ts +20 -0
  70. package/dist/types/ui/link-search-list/styled.d.ts +3 -0
  71. package/dist/types/ui/link-search-no-results/index.d.ts +4 -0
  72. package/dist/types/ui/link-search-no-results/no-results-svg/index.d.ts +4 -0
  73. package/dist/types/ui/link-search-no-results/no-results-svg/styled.d.ts +1 -0
  74. package/dist/types/ui/list-item/index.d.ts +17 -0
  75. package/dist/types/ui/list-item/styled.d.ts +7 -0
  76. package/dist/types/ui/styled.d.ts +4 -0
  77. package/dist/types/ui/text-input/index.d.ts +17 -0
  78. package/dist/types/ui/text-input/styled.d.ts +2 -0
  79. package/dist/types/url.d.ts +5 -0
  80. package/dist/types/utils.d.ts +3 -0
  81. package/package.json +1 -2
  82. package/report.api.md +56 -21
  83. package/example-helpers/flight-deck/_manifest.json +0 -9
  84. package/example-helpers/flight-deck/mockFDResponse.json +0 -133
  85. package/example-helpers/mock-data.ts +0 -318
  86. package/example-helpers/providers.ts +0 -39
@@ -0,0 +1,60 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+
3
+ /** @jsx jsx */
4
+ import { jsx } from '@emotion/react';
5
+ import { noResultsSVGStyles } from './styled';
6
+
7
+ var NoResultsSVG = function NoResultsSVG() {
8
+ var id = 'link-picker-ui-no-results-svg';
9
+ return jsx("svg", {
10
+ css: noResultsSVGStyles,
11
+ height: "120",
12
+ viewBox: "0 0 208 191",
13
+ fill: "none",
14
+ xmlns: "http://www.w3.org/2000/svg"
15
+ }, jsx("g", {
16
+ clipPath: "url(#".concat(id, "-a)")
17
+ }, jsx("path", {
18
+ opacity: ".3",
19
+ d: "M105.28 190.44c-.93.03-1.86.05-2.79.06-1.3.01-2.36-1.04-2.36-2.34-.01-1.27 1-2.32 2.27-2.36h.07c5.93-.03 11.95-.67 17.74-1.9a2.352 2.352 0 0 1 .98 4.6 94.236 94.236 0 0 1-15.91 1.94ZM89.77 189.649c-.13 0-.27 0-.41-.02a91.17 91.17 0 0 1-18.27-4.49 2.353 2.353 0 1 1 1.59-4.43 85.94 85.94 0 0 0 17.32 4.25c1.29.18 2.19 1.36 2.01 2.65-.15 1.16-1.12 2-2.24 2.04ZM133.08 184.98c-.99.03-1.93-.56-2.29-1.54-.45-1.22.17-2.57 1.39-3.02a87.114 87.114 0 0 0 16.01-7.87 2.35 2.35 0 1 1 2.5 3.98c-5.32 3.33-11 6.13-16.87 8.3-.25.1-.49.14-.74.15ZM60.25 180.089c-.4.01-.81-.07-1.18-.27a92.004 92.004 0 0 1-15.61-10.48 2.35 2.35 0 0 1-.31-3.31c.83-1 2.31-1.14 3.31-.31a87.13 87.13 0 0 0 14.81 9.94c1.15.61 1.58 2.03.97 3.18a2.31 2.31 0 0 1-1.99 1.25ZM35.79 161.01c-.67.02-1.35-.24-1.83-.77a91.583 91.583 0 0 1-11.11-15.17 2.353 2.353 0 1 1 4.06-2.38c3 5.13 6.55 9.97 10.54 14.39.87.96.8 2.45-.17 3.32-.43.39-.96.59-1.49.61ZM179.7 145.469c-.42.01-.86-.08-1.25-.31a2.346 2.346 0 0 1-.87-3.21 86.618 86.618 0 0 0 7.22-16.31c.4-1.24 1.73-1.91 2.96-1.51 1.24.4 1.91 1.73 1.51 2.96a91.279 91.279 0 0 1-7.62 17.19c-.41.74-1.16 1.16-1.95 1.19ZM19.3 134.749c-.96.03-1.88-.53-2.26-1.47a90.64 90.64 0 0 1-5.23-18.06 2.35 2.35 0 0 1 1.9-2.73c1.28-.23 2.5.62 2.73 1.9a87.04 87.04 0 0 0 4.96 17.13c.49 1.2-.09 2.58-1.3 3.06-.26.1-.53.16-.8.17ZM190.19 116.26a2.346 2.346 0 0 1-2.4-2.74c1-5.84 1.39-11.83 1.18-17.8l-.01-.2c-.05-1.3.97-2.39 2.27-2.43 1.3-.05 2.39.97 2.43 2.27l.01.2c.22 6.29-.2 12.6-1.25 18.76a2.345 2.345 0 0 1-2.23 1.94ZM12.82 104.36c-1.3.05-2.39-.92-2.43-2.22v-.1c-.22-6.26.19-12.54 1.23-18.66a2.36 2.36 0 0 1 2.71-1.93 2.36 2.36 0 0 1 1.93 2.71 87.974 87.974 0 0 0-1.17 17.7c.05 1.31-.97 2.45-2.27 2.5ZM190 85.05a2.35 2.35 0 0 1-2.39-1.93A86.803 86.803 0 0 0 182.63 66a2.36 2.36 0 0 1 1.29-3.07c1.2-.49 2.58.09 3.07 1.29 2.36 5.8 4.13 11.88 5.25 18.06.23 1.28-.61 2.5-1.89 2.74l-.35.03ZM17.07 73.668c-.27.01-.54-.03-.81-.11a2.347 2.347 0 0 1-1.51-2.96 91.288 91.288 0 0 1 7.6-17.2 2.355 2.355 0 0 1 3.21-.88c1.13.64 1.52 2.08.88 3.21a87.027 87.027 0 0 0-7.21 16.32c-.32.96-1.2 1.59-2.16 1.62ZM179.22 55.98a2.34 2.34 0 0 1-2.11-1.16 87.748 87.748 0 0 0-10.56-14.38c-.87-.96-.8-2.45.17-3.32.96-.87 2.45-.8 3.32.17 4.22 4.66 7.96 9.75 11.13 15.15.66 1.12.28 2.56-.84 3.22-.35.2-.73.3-1.11.32ZM31.61 46.26c-.53.02-1.07-.14-1.53-.5a2.354 2.354 0 0 1-.41-3.3 92.27 92.27 0 0 1 13.01-13.57 2.36 2.36 0 0 1 3.32.27c.84.99.72 2.47-.27 3.32a87.993 87.993 0 0 0-12.35 12.88c-.44.57-1.1.88-1.77.9ZM159.12 32.35c-.56.02-1.12-.16-1.58-.54-4.59-3.8-9.57-7.14-14.83-9.93a2.35 2.35 0 0 1-.98-3.18 2.359 2.359 0 0 1 3.18-.98 91.78 91.78 0 0 1 15.62 10.46c1 .83 1.14 2.31.31 3.31-.44.54-1.08.83-1.72.86ZM54.62 25.45c-.81.03-1.61-.36-2.08-1.1a2.35 2.35 0 0 1 .74-3.24 91.806 91.806 0 0 1 16.87-8.32c1.22-.45 2.57.17 3.02 1.39.45 1.22-.17 2.57-1.39 3.02a86.792 86.792 0 0 0-16 7.89c-.36.23-.76.35-1.16.36ZM132.16 16.979c-.29.01-.59-.03-.87-.14-5.6-2-11.43-3.42-17.33-4.23a2.353 2.353 0 0 1 .64-4.66c6.22.85 12.36 2.35 18.27 4.46 1.22.44 1.86 1.78 1.42 3.01-.33.93-1.2 1.53-2.13 1.56ZM83.36 13.78a2.352 2.352 0 0 1-.57-4.65 93.98 93.98 0 0 1 18.69-2.03 2.356 2.356 0 0 1 .1 4.71h-.07c-5.93.03-11.95.69-17.74 1.92-.14.03-.28.04-.41.05Z",
20
+ fill: "#B3BAC5"
21
+ }), jsx("path", {
22
+ opacity: ".3",
23
+ d: "M190.8 34.81a.522.522 0 0 1-.39-.56l.06-.45c.05-.29.11-.6.19-.92.3-1.15.85-2.18 1.64-3.09.79-.91 1.93-1.67 3.4-2.26l2.48-1.01c1.48-.59 2.39-1.57 2.75-2.92.13-.49.17-.99.12-1.51a3.44 3.44 0 0 0-.47-1.46c-.27-.45-.64-.86-1.13-1.22-.49-.36-1.09-.63-1.81-.82-.78-.2-1.47-.23-2.09-.09-.62.14-1.17.39-1.65.74s-.88.8-1.2 1.34c-.33.54-.57 1.12-.73 1.72-.05.18-.09.36-.12.52-.09.47-.56.75-1.02.61L187 22.26c-.36-.11-.61-.46-.57-.83.01-.12.03-.24.05-.36.06-.34.13-.66.21-.98.3-1.15.81-2.22 1.53-3.21.72-.99 1.61-1.8 2.67-2.43 1.06-.63 2.26-1.04 3.62-1.24 1.36-.2 2.84-.08 4.45.34 1.67.44 3.07 1.07 4.2 1.89 1.14.82 2.03 1.74 2.68 2.75.65 1.02 1.06 2.1 1.22 3.25.16 1.15.1 2.27-.19 3.36-.45 1.72-1.23 3.09-2.32 4.11-1.1 1.02-2.41 1.82-3.95 2.39l-2.09.79c-.59.19-1.47.58-2.2 1.38-.07.08-.37.41-.67.92-.22.38-.38.75-.49 1.07-.09.26-.37.4-.63.33l-3.72-.98Zm-3.06 5.87c.25-.95.79-1.67 1.63-2.17.84-.5 1.73-.63 2.68-.38.95.25 1.67.8 2.17 1.65.5.85.62 1.75.37 2.7-.25.95-.8 1.66-1.65 2.15-.85.48-1.75.6-2.69.35-.95-.25-1.67-.79-2.15-1.62-.49-.84-.61-1.73-.36-2.68ZM18.51 21.94a.518.518 0 0 1-.35-.58l.09-.45c.07-.29.15-.59.26-.9.38-1.13.99-2.12 1.85-2.97.85-.86 2.03-1.53 3.55-2.03l2.54-.84c1.51-.49 2.49-1.4 2.94-2.73.16-.48.24-.98.22-1.5-.01-.52-.14-1.02-.37-1.49-.23-.47-.58-.9-1.05-1.29-.46-.39-1.05-.7-1.75-.94-.76-.26-1.46-.33-2.08-.23-.63.1-1.19.31-1.69.63s-.93.74-1.29 1.26a6.16 6.16 0 0 0-.86 1.67c-.06.18-.11.35-.15.51-.12.46-.61.71-1.06.54l-3.74-1.42a.803.803 0 0 1-.51-.87c.02-.12.05-.24.08-.36.08-.33.17-.65.28-.96.38-1.13.96-2.16 1.75-3.1s1.73-1.69 2.82-2.25c1.1-.56 2.33-.89 3.69-.99 1.37-.1 2.84.11 4.41.64 1.63.55 2.99 1.27 4.07 2.17 1.08.9 1.91 1.87 2.49 2.93.58 1.06.92 2.16 1 3.32a8.52 8.52 0 0 1-.42 3.34c-.57 1.69-1.43 3-2.6 3.94-1.16.94-2.53 1.65-4.1 2.12l-2.14.64c-.6.15-1.51.48-2.29 1.23-.08.08-.4.39-.73.87-.25.37-.43.72-.56 1.03a.52.52 0 0 1-.65.29l-3.65-1.23Zm-3.45 5.65c.31-.93.9-1.62 1.77-2.06.87-.44 1.77-.51 2.7-.2.93.31 1.61.91 2.05 1.79.44.88.5 1.79.19 2.72-.31.93-.91 1.61-1.79 2.03-.88.42-1.78.48-2.71.17-.93-.31-1.61-.9-2.04-1.77-.42-.85-.48-1.75-.17-2.68ZM12.39 180.998c-.24.09-.52 0-.64-.23-.07-.13-.14-.27-.21-.41-.13-.27-.25-.56-.37-.86a7.553 7.553 0 0 1-.43-3.47c.13-1.2.62-2.47 1.49-3.81l1.45-2.25c.87-1.33 1.06-2.66.57-3.97a4.47 4.47 0 0 0-.77-1.31c-.34-.4-.74-.71-1.22-.93-.48-.22-1.02-.33-1.63-.35-.61-.01-1.26.11-1.95.37-.75.28-1.34.65-1.77 1.13-.43.47-.73.99-.92 1.55-.19.56-.26 1.16-.22 1.79.04.63.17 1.24.39 1.83.07.18.13.34.2.49a.8.8 0 0 1-.48 1.09l-3.8 1.24a.788.788 0 0 1-.94-.36c-.06-.11-.11-.22-.17-.33-.15-.31-.28-.62-.39-.92a9.594 9.594 0 0 1-.59-3.51c.02-1.23.28-2.4.79-3.52.5-1.12 1.25-2.15 2.25-3.09s2.28-1.7 3.84-2.27c1.62-.6 3.12-.89 4.52-.87 1.4.02 2.66.26 3.78.71 1.12.46 2.07 1.11 2.86 1.96.79.85 1.38 1.8 1.77 2.86.62 1.67.77 3.24.46 4.7s-.93 2.87-1.86 4.23l-1.26 1.85c-.37.5-.87 1.32-1.01 2.39-.01.11-.07.55-.02 1.13.04.44.12.83.22 1.15a.53.53 0 0 1-.33.64l-3.61 1.35Zm.87 6.56c-.34-.92-.31-1.82.09-2.72.4-.89 1.06-1.51 1.98-1.85.92-.34 1.83-.3 2.72.11.9.41 1.52 1.08 1.86 2 .34.92.3 1.82-.12 2.7-.42.88-1.09 1.49-2 1.83-.92.34-1.82.31-2.7-.09-.88-.4-1.49-1.06-1.83-1.98Z",
24
+ fill: "#C1C7D0"
25
+ }), jsx("path", {
26
+ d: "m149.36 134.209-7.15-6.93-9.63 9.95 7.15 6.93c1.83 1.77 3.11 4.02 3.71 6.49.6 2.47 1.89 4.72 3.71 6.49l29.03 28.1c4.4 4.26 11.41 4.14 15.67-.25 4.26-4.4 4.14-11.41-.25-15.67l-29.03-28.1a13.457 13.457 0 0 0-6.61-3.5 13.65 13.65 0 0 1-6.6-3.51Z",
27
+ fill: "#CFD4DB"
28
+ }), jsx("path", {
29
+ d: "M155.68 137.628c-2.37-.55-4.56-1.73-6.31-3.43l-2.18-2.11a6.92 6.92 0 0 0-9.79.16 6.92 6.92 0 0 0 .16 9.79l2.18 2.11c1.75 1.7 3 3.84 3.63 6.19 2.35-1.78 4.57-3.75 6.66-5.91 2.07-2.13 3.95-4.41 5.65-6.8Z",
30
+ fill: "#B3BAC5"
31
+ }), jsx("path", {
32
+ d: "M101.95 156.619c-15.47.25-30.11-5.54-41.22-16.3-22.95-22.21-23.54-58.95-1.33-81.9 10.76-11.11 25.21-17.37 40.67-17.63 15.47-.25 30.11 5.54 41.22 16.3 11.12 10.76 17.37 25.21 17.63 40.67.25 15.47-5.54 30.11-16.3 41.22-10.75 11.13-25.2 17.39-40.67 17.64Zm-1.65-102c-11.78.19-22.77 4.96-30.97 13.42-16.91 17.47-16.46 45.44 1.01 62.35 8.46 8.19 19.61 12.6 31.39 12.41 11.78-.19 22.77-4.96 30.97-13.42 8.19-8.46 12.6-19.61 12.41-31.39-.19-11.78-4.96-22.77-13.42-30.97-8.47-8.18-19.61-12.59-31.39-12.4Z",
33
+ fill: "url(#".concat(id, "-b)")
34
+ }), jsx("path", {
35
+ d: "m118.92 85.84-5.34-5.25c-.79-.77-2.05-.76-2.83.03l-9.79 9.97-9.97-9.79c-.79-.77-2.05-.76-2.83.03l-5.25 5.34c-.77.79-.76 2.05.03 2.83l9.97 9.79-9.79 9.97c-.77.79-.76 2.05.03 2.83l5.34 5.25c.79.77 2.05.76 2.83-.03l9.79-9.97 9.97 9.79c.79.77 2.05.76 2.83-.03l5.25-5.34c.77-.79.76-2.05-.03-2.83l-9.97-9.79 9.79-9.97c.77-.79.76-2.06-.03-2.83Z",
36
+ fill: "#C1C7D0"
37
+ })), jsx("defs", null, jsx("linearGradient", {
38
+ id: "".concat(id, "-b"),
39
+ x1: "60.062",
40
+ y1: "139.664",
41
+ x2: "141.969",
42
+ y2: "57.757",
43
+ gradientUnits: "userSpaceOnUse"
44
+ }, jsx("stop", {
45
+ offset: ".557",
46
+ stopColor: "#C1C7D0"
47
+ }), jsx("stop", {
48
+ offset: ".966",
49
+ stopColor: "#E9EBEF",
50
+ stopOpacity: ".5"
51
+ })), jsx("clipPath", {
52
+ id: "".concat(id, "-a")
53
+ }, jsx("path", {
54
+ fill: "#fff",
55
+ transform: "translate(0 .62)",
56
+ d: "M0 0h207.16v189.87H0z"
57
+ }))));
58
+ };
59
+
60
+ export default NoResultsSVG;
@@ -0,0 +1,8 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject;
4
+
5
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
6
+ import { css } from '@emotion/react';
7
+ var HEIGHT = 120;
8
+ export var noResultsSVGStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n margin: 0 auto ", "px;\n display: block;\n"])), HEIGHT, getGridSize() * 3);
@@ -0,0 +1,90 @@
1
+ /** @jsx jsx */
2
+ import { Fragment } from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import { injectIntl } from 'react-intl-next';
5
+ import { transformTimeStamp } from '../../transformTimeStamp';
6
+ import { itemNameStyles, itemIconStyles, listItemContextStyles, listItemNameStyles, composeListItemStyles, imgStyles } from './styled';
7
+
8
+ var LinkSearchListItem = function LinkSearchListItem(_ref) {
9
+ var item = _ref.item,
10
+ selected = _ref.selected,
11
+ active = _ref.active,
12
+ id = _ref.id,
13
+ role = _ref.role,
14
+ intl = _ref.intl,
15
+ onSelect = _ref.onSelect,
16
+ onMouseEnter = _ref.onMouseEnter,
17
+ onMouseLeave = _ref.onMouseLeave;
18
+
19
+ var handleSelect = function handleSelect() {
20
+ return onSelect(item.objectId);
21
+ };
22
+
23
+ var handleMouseEnter = function handleMouseEnter() {
24
+ return onMouseEnter(item.objectId);
25
+ };
26
+
27
+ var handleMouseLeave = function handleMouseLeave() {
28
+ return onMouseLeave(item.objectId);
29
+ };
30
+
31
+ var container = item.container || null;
32
+ var date = transformTimeStamp(intl, item.lastViewedDate, item.lastUpdatedDate);
33
+ return jsx("div", {
34
+ css: composeListItemStyles(active, selected),
35
+ role: role,
36
+ id: id,
37
+ "aria-selected": selected,
38
+ "data-testid": "link-search-list-item",
39
+ onMouseEnter: handleMouseEnter,
40
+ onMouseLeave: handleMouseLeave,
41
+ onClick: handleSelect
42
+ }, jsx(ListItemIcon, {
43
+ item: item,
44
+ intl: intl
45
+ }), jsx("div", {
46
+ css: itemNameStyles
47
+ }, jsx("div", {
48
+ "data-testid": "link-search-list-item-title",
49
+ css: listItemNameStyles
50
+ }, item.name), jsx("div", {
51
+ "data-testid": "link-search-list-item-subtitle",
52
+ css: listItemContextStyles
53
+ }, container, container && date && jsx(Fragment, null, "\xA0 \u2022\xA0 "), date && jsx(Fragment, null, formatDate(date)))));
54
+ };
55
+
56
+ export default injectIntl(LinkSearchListItem);
57
+
58
+ var formatDate = function formatDate(date) {
59
+ return [date.pageAction, date.dateString, date.timeSince].filter(Boolean).join(' ');
60
+ };
61
+
62
+ var ListItemIcon = function ListItemIcon(props) {
63
+ var item = props.item,
64
+ intl = props.intl;
65
+ var icon = item.icon,
66
+ iconAlt = item.iconAlt;
67
+
68
+ if (!icon) {
69
+ return null;
70
+ }
71
+
72
+ var alt = typeof iconAlt === 'string' ? iconAlt : intl.formatMessage(iconAlt);
73
+
74
+ if (typeof icon !== 'string') {
75
+ var Glyph = icon;
76
+ return jsx("span", {
77
+ css: itemIconStyles
78
+ }, jsx(Glyph, {
79
+ alt: alt
80
+ }));
81
+ }
82
+
83
+ return jsx("span", {
84
+ css: itemIconStyles
85
+ }, jsx("img", {
86
+ src: icon,
87
+ alt: alt,
88
+ css: imgStyles
89
+ }));
90
+ };
@@ -0,0 +1,37 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
4
+
5
+ import { token } from '@atlaskit/tokens';
6
+ import { css } from '@emotion/react';
7
+ import { B50, N300, N800, N20, B400 } from '@atlaskit/theme/colors';
8
+ import { gridSize } from '@atlaskit/theme/constants'; // AFP-2532 TODO: Fix automatic suppressions below
9
+ // eslint-disable-next-line @atlassian/tangerine/import/entry-points
10
+
11
+ import { fontSizeSmall, fontSize } from '@atlaskit/theme';
12
+ export var relativeFontSizeToBase16 = function relativeFontSizeToBase16(px) {
13
+ if (typeof px === 'string') {
14
+ px = parseInt(px);
15
+ }
16
+
17
+ if (isNaN(px)) {
18
+ throw new Error("Invalid font size: '".concat(px, "'"));
19
+ }
20
+
21
+ return "".concat(px / 16, "rem");
22
+ };
23
+ var listItemBaseStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n padding: ", "px ", "px;\n margin: 0 -", "px;\n cursor: pointer;\n"])), gridSize(), gridSize() * 2, gridSize() * 2);
24
+ var listItemBoxShadow = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n box-shadow: inset 2px 0px 0px ", ";\n"])), token('color.border.selected', B400));
25
+ var listItemActive = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), token('color.background.neutral.subtle.hovered', N20));
26
+ var listItemSelected = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), token('color.background.selected', B50));
27
+ export var composeListItemStyles = function composeListItemStyles() {
28
+ var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
29
+ var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
30
+ var hasShadow = active || selected;
31
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", ";\n ", ";\n ", ";\n ", ";\n "])), listItemBaseStyles, active && listItemActive, selected && listItemSelected, hasShadow && listItemBoxShadow);
32
+ };
33
+ export var itemNameStyles = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
34
+ export var listItemNameStyles = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 20px;\n"])), token('color.text', N800));
35
+ export var listItemContextStyles = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n line-height: ", "px;\n"])), token('color.text', N300), relativeFontSizeToBase16(fontSizeSmall()), fontSize());
36
+ export var itemIconStyles = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n min-width: ", "px;\n margin-top: 3px;\n margin-right: 12px;\n"])), gridSize() * 2);
37
+ export var imgStyles = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n max-width: ", "px;\n"])), gridSize() * 2);
@@ -0,0 +1,16 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
+
5
+ import { token } from '@atlaskit/tokens';
6
+ import { css } from '@emotion/react';
7
+ import { N500 } from '@atlaskit/theme/colors'; // AFP-2532 TODO: Fix automatic suppressions below
8
+ // eslint-disable-next-line @atlassian/tangerine/import/entry-points
9
+
10
+ import { typography } from '@atlaskit/theme';
11
+ import { gridSize } from '@atlaskit/theme/constants';
12
+ var LINK_PICKER_WIDTH_IN_PX = 342;
13
+ export var recentListStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n"])), LINK_PICKER_WIDTH_IN_PX);
14
+ export var containerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", "px;\n width: 100%;\n overflow: hidden;\n line-height: initial;\n box-sizing: border-box;\n"])), gridSize() * 2);
15
+ export var searchIconStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n color: ", ";\n cursor: default;\n"])), gridSize() / 2, token('color.icon', N500));
16
+ export var listTitleStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n text-transform: uppercase;\n margin-bottom: ", "px;\n"])), typography.h100(), gridSize() / 2);
@@ -0,0 +1,99 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["name", "label", "autoFocus", "onSubmit", "onRedo", "onUndo", "onChange", "onKeyDown", "onClear", "clearLabel", "error"];
4
+
5
+ /** @jsx jsx */
6
+ import { useCallback, useRef, Fragment } from 'react';
7
+ import { jsx } from '@emotion/react';
8
+ import { ErrorMessage, Field } from '@atlaskit/form';
9
+ import Tooltip from '@atlaskit/tooltip';
10
+ import Textfield from '@atlaskit/textfield';
11
+ import Selectclear from '@atlaskit/icon/glyph/select-clear';
12
+ import { isRedoEvent, isUndoEvent } from '../../utils';
13
+ import { clearTextButtonStyles, fieldStyles } from './styled';
14
+
15
+ var PanelTextInput = function PanelTextInput(props) {
16
+ var name = props.name,
17
+ label = props.label,
18
+ autoFocus = props.autoFocus,
19
+ onSubmit = props.onSubmit,
20
+ onRedo = props.onRedo,
21
+ onUndo = props.onUndo,
22
+ onChange = props.onChange,
23
+ onKeyDown = props.onKeyDown,
24
+ onClear = props.onClear,
25
+ clearLabel = props.clearLabel,
26
+ error = props.error,
27
+ restProps = _objectWithoutProperties(props, _excluded);
28
+
29
+ var inputRef = useRef(null);
30
+ var handleRef = useCallback(function (input) {
31
+ if (input) {
32
+ inputRef.current = input;
33
+
34
+ if (autoFocus) {
35
+ // Need this to prevent jumping when we render TextInput inside Portal @see ED-2992
36
+ input.focus({
37
+ preventScroll: true
38
+ });
39
+ }
40
+ }
41
+ }, [autoFocus]);
42
+ var handleChange = useCallback(function (e) {
43
+ onChange(e.currentTarget.value);
44
+ }, [onChange]);
45
+ var handleKeydown = useCallback(function (e) {
46
+ var value = e.currentTarget.value;
47
+
48
+ if (e.keyCode === 13 && onSubmit) {
49
+ e.preventDefault(); // Prevent from submitting if an editor is inside a form.
50
+
51
+ onSubmit(value);
52
+ } else if (typeof onUndo === 'function' && isUndoEvent(e)) {
53
+ e.preventDefault();
54
+ onUndo();
55
+ } else if (typeof onRedo === 'function' && isRedoEvent(e)) {
56
+ e.preventDefault();
57
+ onRedo();
58
+ }
59
+
60
+ if (onKeyDown) {
61
+ onKeyDown(e);
62
+ }
63
+ }, [onSubmit, onUndo, onRedo, onKeyDown]);
64
+ var handleClear = useCallback(function () {
65
+ if (inputRef.current && onClear) {
66
+ inputRef.current.focus();
67
+ onClear();
68
+ }
69
+ }, [onClear]);
70
+ var clearText = restProps.value !== '' && jsx(Tooltip, {
71
+ content: clearLabel
72
+ }, jsx("button", {
73
+ css: clearTextButtonStyles,
74
+ onClick: handleClear,
75
+ "data-testid": "clear-text"
76
+ }, jsx(Selectclear, {
77
+ size: "medium",
78
+ label: clearLabel || ''
79
+ })));
80
+ return jsx("div", {
81
+ css: fieldStyles
82
+ }, jsx(Field, {
83
+ label: label,
84
+ name: name
85
+ }, function (_ref) {
86
+ var fieldProps = _ref.fieldProps;
87
+ return jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
88
+ onKeyDown: handleKeydown,
89
+ onChange: handleChange,
90
+ ref: handleRef,
91
+ elemAfterInput: clearText,
92
+ isInvalid: !!error
93
+ })), error && jsx(ErrorMessage, {
94
+ testId: "link-error"
95
+ }, error));
96
+ }));
97
+ };
98
+
99
+ export default PanelTextInput;
@@ -0,0 +1,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2;
4
+
5
+ import { token } from '@atlaskit/tokens';
6
+ import { css } from '@emotion/react';
7
+ import { N500 } from '@atlaskit/theme/colors';
8
+ import { gridSize } from '@atlaskit/theme/constants';
9
+ export var clearTextButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0;\n margin-right: ", "px;\n color: ", ";\n background: transparent;\n border: none;\n cursor: pointer;\n"])), gridSize() / 2, token('color.icon.subtle', N500));
10
+ export var fieldStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n"])), gridSize() * 2);
@@ -0,0 +1,90 @@
1
+ import LinkifyIt from 'linkify-it';
2
+ var linkify = LinkifyIt();
3
+ linkify.add('sourcetree:', 'http:');
4
+ var tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
5
+ var tlds2Char = 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
6
+ tlds.push(tlds2Char);
7
+ linkify.tlds(tlds, false);
8
+ var whitelistedURLPatterns = [/^https?:\/\/[^\s]*$/im, /^ftps?:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:[^\s]*$/im, /^facetime:[^\s]*$/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im, /^foo:/im, /^#/im];
9
+
10
+ var normaliseLinkHref = function normaliseLinkHref(url) {
11
+ var match = getLinkMatch(url);
12
+ return match && match.url || null;
13
+ };
14
+
15
+ var getLinkMatch = function getLinkMatch(str) {
16
+ if (!str) {
17
+ return null;
18
+ }
19
+
20
+ var match = linkifyMatch(str);
21
+
22
+ if (!match.length) {
23
+ match = linkify.match(str);
24
+ }
25
+
26
+ return match && match.length > 0 && match[0].index === 0 && match[0].lastIndex === str.trim().length ? match[0] : null;
27
+ };
28
+
29
+ var LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
30
+
31
+ var linkifyMatch = function linkifyMatch(text) {
32
+ var matches = [];
33
+
34
+ if (!LINK_REGEXP.test(text)) {
35
+ return matches;
36
+ }
37
+
38
+ var startpos = 0;
39
+ var substr;
40
+
41
+ while (substr = text.substr(startpos)) {
42
+ var link = (substr.match(LINK_REGEXP) || [''])[0];
43
+
44
+ if (link) {
45
+ var index = substr.search(LINK_REGEXP);
46
+ var start = index >= 0 ? index + startpos : index;
47
+ var end = start + link.length;
48
+ matches.push({
49
+ index: start,
50
+ lastIndex: end,
51
+ raw: link,
52
+ url: link,
53
+ text: link,
54
+ schema: ''
55
+ });
56
+ startpos += end;
57
+ } else {
58
+ break;
59
+ }
60
+ }
61
+
62
+ return matches;
63
+ };
64
+
65
+ export var isSafeUrl = function isSafeUrl(url) {
66
+ var urlTrimmed = url.trim();
67
+
68
+ if (urlTrimmed.length === 0) {
69
+ return true;
70
+ }
71
+
72
+ return whitelistedURLPatterns.some(function (p) {
73
+ return p.test(urlTrimmed);
74
+ });
75
+ };
76
+ /**
77
+ * Adds protocol to url if needed.
78
+ */
79
+
80
+ export function normalizeUrl(url) {
81
+ if (!url) {
82
+ return '';
83
+ }
84
+
85
+ if (isSafeUrl(url)) {
86
+ return url.trim();
87
+ }
88
+
89
+ return normaliseLinkHref(url);
90
+ }
@@ -0,0 +1,13 @@
1
+ import { browser } from './browser';
2
+ var KeyZCode = 90;
3
+ var KeyYCode = 89;
4
+ export var isUndoEvent = function isUndoEvent(e) {
5
+ return e.keyCode === KeyZCode && ( // cmd + z for mac
6
+ browser.mac && e.metaKey && !e.shiftKey || // ctrl + z for non-mac
7
+ !browser.mac && e.ctrlKey);
8
+ };
9
+ export var isRedoEvent = function isRedoEvent(e) {
10
+ return (// ctrl + y for non-mac
11
+ !browser.mac && e.ctrlKey && e.keyCode === KeyYCode || browser.mac && e.metaKey && e.shiftKey && e.keyCode === KeyZCode || e.ctrlKey && e.shiftKey && e.keyCode === KeyZCode
12
+ );
13
+ };
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@atlaskit/link-picker",
3
+ "version": "1.1.4",
4
+ "sideEffects": false
5
+ }
@@ -0,0 +1,15 @@
1
+ declare const result: {
2
+ mac: boolean;
3
+ ie: boolean;
4
+ ie_version: number;
5
+ gecko: boolean;
6
+ chrome: boolean;
7
+ chrome_version: number;
8
+ android: boolean;
9
+ ios: boolean;
10
+ webkit: boolean;
11
+ safari: boolean;
12
+ supportsIntersectionObserver: boolean;
13
+ supportsResizeObserver: boolean;
14
+ };
15
+ export { result as browser };
@@ -0,0 +1,3 @@
1
+ export type { LinkPickerProps } from './ui/link-picker';
2
+ export { LinkPickerWithIntl as LinkPicker } from './ui/link-picker';
3
+ export type { LinkInputType, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, } from './types';
@@ -0,0 +1,107 @@
1
+ export declare const messages: {
2
+ placeholder: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ linkPlaceholder: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ linkTextPlaceholder: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ linkLabel: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
22
+ linkInvalid: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ linkTextLabel: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
32
+ clearText: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
37
+ clearLink: {
38
+ id: string;
39
+ defaultMessage: string;
40
+ description: string;
41
+ };
42
+ searchLinkAriaDescription: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ description: string;
46
+ };
47
+ searchLinkResults: {
48
+ id: string;
49
+ defaultMessage: string;
50
+ description: string;
51
+ };
52
+ linkAriaLabel: {
53
+ id: string;
54
+ defaultMessage: string;
55
+ description: string;
56
+ };
57
+ timeUpdated: {
58
+ id: string;
59
+ defaultMessage: string;
60
+ description: string;
61
+ };
62
+ timeViewed: {
63
+ id: string;
64
+ defaultMessage: string;
65
+ description: string;
66
+ };
67
+ timeAgo: {
68
+ id: string;
69
+ defaultMessage: string;
70
+ description: string;
71
+ };
72
+ titleRecentlyViewed: {
73
+ id: string;
74
+ defaultMessage: string;
75
+ description: string;
76
+ };
77
+ titleResults: {
78
+ id: string;
79
+ defaultMessage: string;
80
+ description: string;
81
+ };
82
+ cancelButton: {
83
+ id: string;
84
+ defaultMessage: string;
85
+ description: string;
86
+ };
87
+ insertButton: {
88
+ id: string;
89
+ defaultMessage: string;
90
+ description: string;
91
+ };
92
+ noResults: {
93
+ id: string;
94
+ defaultMessage: string;
95
+ description: string;
96
+ };
97
+ noResultsDescription: {
98
+ id: string;
99
+ defaultMessage: string;
100
+ description: string;
101
+ };
102
+ saveButton: {
103
+ id: string;
104
+ defaultMessage: string;
105
+ description: string;
106
+ };
107
+ };
@@ -0,0 +1,3 @@
1
+ import { IntlShape } from 'react-intl-next';
2
+ import { ListItemTimeStamp } from './types';
3
+ export declare const transformTimeStamp: (intl: IntlShape, lastViewedDate?: Date | undefined, lastUpdatedDate?: Date | undefined) => ListItemTimeStamp | undefined;
@@ -0,0 +1,40 @@
1
+ /// <reference types="react" />
2
+ import { MessageDescriptor } from 'react-intl-next';
3
+ export declare type LinkInputType = 'manual' | 'typeAhead';
4
+ export interface LinkSearchListItemData {
5
+ /** Unique identifiable attribute for the item */
6
+ objectId: string;
7
+ /** Name / title / display text of the link */
8
+ name: string;
9
+ /** URL of the resource being linked to */
10
+ url: string;
11
+ /** Icon to display in link result */
12
+ icon: string | React.ComponentType<{
13
+ alt: string;
14
+ }>;
15
+ /** Alt text describing the icon */
16
+ iconAlt: string | MessageDescriptor;
17
+ /** Context to display in link result */
18
+ container?: string;
19
+ /** Optional last view date to display in link result */
20
+ lastViewedDate?: Date;
21
+ /** Optional last updated date to display in link result */
22
+ lastUpdatedDate?: Date;
23
+ /** Whether the result is pre-fetched from activity provider */
24
+ prefetch?: boolean;
25
+ }
26
+ export declare type ListItemTimeStamp = {
27
+ pageAction: string;
28
+ dateString: string;
29
+ timeSince?: string | undefined;
30
+ };
31
+ export interface LinkPickerState {
32
+ /** Current query string / URL input field value */
33
+ query: string;
34
+ }
35
+ export interface ResolveResult {
36
+ data: LinkSearchListItemData[];
37
+ }
38
+ export interface LinkPickerPlugin {
39
+ resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
40
+ }
@@ -0,0 +1,22 @@
1
+ import React, { AriaAttributes, Ref } from 'react';
2
+ declare type AnnouncerProps = {
3
+ ref?: Ref<HTMLDivElement>;
4
+ /** Set 'false' for announcing only changed text
5
+ * (not announce duplicate part of string after second render),
6
+ * and 'true' for announcing all the string after each render */
7
+ ariaAtomic?: AriaAttributes['aria-atomic'];
8
+ /** Set politeness settings */
9
+ ariaLive?: AriaAttributes['aria-live'];
10
+ /** Used to describe what types of changes have occurred to an aria-live region */
11
+ ariaRelevant?: AriaAttributes['aria-relevant'];
12
+ /** Role used to set attribute role. See more details https://dequeuniversity.com/library/aria/liveregion-playground#configOptions */
13
+ role?: 'status' | 'log' | 'alert' | 'timer' | 'marquee';
14
+ /** Text message that will be announced */
15
+ text: string;
16
+ /** Debounce delay.
17
+ * Set delay (ms) to prevent announce the same string multiple times.
18
+ * It can be useful for cases when the parent component re-renders with the same announcer's text. */
19
+ delay?: number;
20
+ };
21
+ declare const _default: React.NamedExoticComponent<AnnouncerProps>;
22
+ export default _default;