@weavy/uikit-react 11.1.0 → 13.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 (256) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/README.md +3 -4
  3. package/changelog.md +57 -0
  4. package/dist/cjs/index.js +28 -6
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/types/client/WeavyClient.d.ts +8 -1
  7. package/dist/cjs/types/components/Attachment.d.ts +2 -1
  8. package/dist/cjs/types/components/Chat.d.ts +1 -1
  9. package/dist/cjs/types/components/Image.d.ts +2 -0
  10. package/dist/cjs/types/components/PdfViewer.d.ts +8 -0
  11. package/dist/cjs/types/components/Preview.d.ts +56 -0
  12. package/dist/cjs/types/contexts/MessengerContext.d.ts +1 -2
  13. package/dist/cjs/types/contexts/PreviewContext.d.ts +2 -1
  14. package/dist/cjs/types/contexts/WeavyContext.d.ts +2 -3
  15. package/dist/cjs/types/types/Chat.d.ts +1 -1
  16. package/dist/cjs/types/types/Messenger.d.ts +0 -1
  17. package/dist/cjs/types/types/types.d.ts +18 -8
  18. package/dist/cjs/types/ui/Spinner.d.ts +9 -0
  19. package/dist/cjs/types/utils/fileUtilities.d.ts +13 -1
  20. package/dist/css/weavy-chat.css +2860 -0
  21. package/dist/css/weavy-messenger.css +3217 -0
  22. package/dist/css/weavy.css +3217 -0
  23. package/dist/esm/index.js +28 -6
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/types/client/WeavyClient.d.ts +8 -1
  26. package/dist/esm/types/components/Attachment.d.ts +2 -1
  27. package/dist/esm/types/components/Chat.d.ts +1 -1
  28. package/dist/esm/types/components/Image.d.ts +2 -0
  29. package/dist/esm/types/components/PdfViewer.d.ts +8 -0
  30. package/dist/esm/types/components/Preview.d.ts +56 -0
  31. package/dist/esm/types/contexts/MessengerContext.d.ts +1 -2
  32. package/dist/esm/types/contexts/PreviewContext.d.ts +2 -1
  33. package/dist/esm/types/contexts/WeavyContext.d.ts +2 -3
  34. package/dist/esm/types/types/Chat.d.ts +1 -1
  35. package/dist/esm/types/types/Messenger.d.ts +0 -1
  36. package/dist/esm/types/types/types.d.ts +18 -8
  37. package/dist/esm/types/ui/Spinner.d.ts +9 -0
  38. package/dist/esm/types/utils/fileUtilities.d.ts +13 -1
  39. package/dist/index.d.ts +15 -9
  40. package/package.json +14 -4
  41. package/rollup.config.js +3 -3
  42. package/src/client/WeavyClient.ts +105 -24
  43. package/src/components/Attachment.tsx +8 -8
  44. package/src/components/Avatar.tsx +2 -3
  45. package/src/components/Chat.tsx +13 -17
  46. package/src/components/Conversation.tsx +23 -32
  47. package/src/components/ConversationBadge.tsx +1 -2
  48. package/src/components/ConversationForm.tsx +11 -18
  49. package/src/components/ConversationList.tsx +4 -5
  50. package/src/components/ConversationListItem.tsx +11 -13
  51. package/src/components/FileBrowser.tsx +2 -3
  52. package/src/components/Image.tsx +39 -7
  53. package/src/components/MeetingCard.tsx +7 -8
  54. package/src/components/Message.tsx +13 -14
  55. package/src/components/Messages.tsx +7 -8
  56. package/src/components/Messenger.tsx +5 -6
  57. package/src/components/NewConversation.tsx +5 -7
  58. package/src/components/PdfViewer.tsx +276 -0
  59. package/src/components/Presence.tsx +2 -2
  60. package/src/components/Preview.tsx +355 -0
  61. package/src/components/Reactions.tsx +8 -8
  62. package/src/components/SearchUsers.tsx +19 -18
  63. package/src/components/SeenBy.tsx +1 -2
  64. package/src/contexts/MessengerContext.tsx +4 -12
  65. package/src/contexts/PreviewContext.tsx +89 -17
  66. package/src/contexts/WeavyContext.tsx +15 -5
  67. package/src/hooks/useBadge.ts +2 -6
  68. package/src/hooks/useChat.ts +3 -14
  69. package/src/hooks/useConversation.ts +1 -8
  70. package/src/hooks/useConversations.ts +1 -7
  71. package/src/hooks/useFileUploader.ts +6 -8
  72. package/src/hooks/useMembers.ts +1 -7
  73. package/src/hooks/useMessages.ts +1 -7
  74. package/src/hooks/useMutateChat.ts +6 -11
  75. package/src/hooks/useMutateConversation.ts +7 -10
  76. package/src/hooks/useMutateConversationName.ts +10 -12
  77. package/src/hooks/useMutateDeleteReaction.ts +3 -8
  78. package/src/hooks/useMutateExternalBlobs.ts +6 -11
  79. package/src/hooks/useMutateMeeting.ts +6 -11
  80. package/src/hooks/useMutateMembers.ts +8 -13
  81. package/src/hooks/useMutateMessage.ts +10 -15
  82. package/src/hooks/useMutatePinned.ts +3 -8
  83. package/src/hooks/useMutateReaction.ts +6 -12
  84. package/src/hooks/useMutateRead.ts +1 -10
  85. package/src/hooks/useMutateRemoveMembers.ts +7 -12
  86. package/src/hooks/useMutateTyping.ts +6 -11
  87. package/src/hooks/usePresence.ts +4 -5
  88. package/src/hooks/useReactions.ts +0 -1
  89. package/src/hooks/useSearchUsers.ts +1 -6
  90. package/src/hooks/useUser.ts +3 -14
  91. package/src/index.ts +2 -2
  92. package/src/scss/theme/_alert.scss +73 -0
  93. package/src/scss/theme/_appbar.scss +114 -0
  94. package/src/scss/theme/_attachments.scss +74 -0
  95. package/src/scss/theme/_avatar.scss +54 -0
  96. package/src/scss/theme/_badge.scss +47 -0
  97. package/src/scss/theme/_buttons.scss +96 -0
  98. package/src/scss/theme/_card.scss +7 -0
  99. package/src/scss/theme/_checkbox.scss +56 -0
  100. package/src/scss/theme/_cm-editor.scss +42 -0
  101. package/src/scss/theme/_code-vscode-dark.scss +184 -0
  102. package/src/scss/theme/_code-vscode-light.scss +179 -0
  103. package/src/scss/theme/_code.scss +12 -0
  104. package/src/scss/theme/_colors.scss +520 -0
  105. package/src/scss/theme/_config.scss +6 -0
  106. package/src/scss/theme/_content.scss +15 -0
  107. package/src/scss/theme/_conversations.scss +91 -0
  108. package/src/scss/theme/_dropdown.scss +86 -0
  109. package/src/scss/theme/_emoji.scss +5 -0
  110. package/src/scss/theme/_filebrowser.scss +26 -0
  111. package/src/scss/theme/_files.scss +140 -0
  112. package/src/scss/theme/_icons.scss +62 -0
  113. package/src/scss/theme/_image-grid.scss +63 -0
  114. package/src/scss/theme/_inputs.scss +28 -0
  115. package/src/scss/theme/_message-editor.scss +90 -0
  116. package/src/scss/theme/_messages.scss +238 -0
  117. package/src/scss/theme/_nav.scss +52 -0
  118. package/src/scss/theme/_overlays.scss +157 -0
  119. package/src/scss/theme/_pager.scss +19 -0
  120. package/src/scss/theme/_palette.scss +165 -0
  121. package/src/scss/theme/_pane.scss +16 -0
  122. package/src/scss/theme/_panels.scss +141 -0
  123. package/src/scss/theme/_picker-list.scss +37 -0
  124. package/src/scss/theme/_preview-code.scss +5 -0
  125. package/src/scss/theme/_preview-embed.scss +38 -0
  126. package/src/scss/theme/_preview-html.scss +7 -0
  127. package/src/scss/theme/_preview-icon.scss +41 -0
  128. package/src/scss/theme/_preview-image.scss +86 -0
  129. package/src/scss/theme/_preview-media.scss +28 -0
  130. package/src/scss/theme/_preview-pdf.scss +838 -0
  131. package/src/scss/theme/_preview-text.scss +5 -0
  132. package/src/scss/theme/_preview.scss +110 -0
  133. package/src/scss/theme/_reactions.scss +58 -0
  134. package/src/scss/theme/_reboot.scss +41 -0
  135. package/src/scss/theme/_root.scss +2 -0
  136. package/src/scss/theme/_scroll.scss +55 -0
  137. package/src/scss/theme/_search.scss +68 -0
  138. package/src/scss/theme/_spinner.scss +63 -0
  139. package/src/scss/theme/_tables.scss +53 -0
  140. package/src/scss/theme/_toasts.scss +47 -0
  141. package/src/scss/theme/_turbo.scss +17 -0
  142. package/src/scss/theme/_typing.scss +26 -0
  143. package/src/scss/theme/_variables.scss +139 -0
  144. package/src/scss/theme/bootstrap/_accordion.scss +146 -0
  145. package/src/scss/theme/bootstrap/_alert.scss +71 -0
  146. package/src/scss/theme/bootstrap/_badge.scss +38 -0
  147. package/src/scss/theme/bootstrap/_breadcrumb.scss +40 -0
  148. package/src/scss/theme/bootstrap/_button-group.scss +142 -0
  149. package/src/scss/theme/bootstrap/_buttons.scss +186 -0
  150. package/src/scss/theme/bootstrap/_card.scss +234 -0
  151. package/src/scss/theme/bootstrap/_carousel.scss +229 -0
  152. package/src/scss/theme/bootstrap/_close.scss +40 -0
  153. package/src/scss/theme/bootstrap/_containers.scss +41 -0
  154. package/src/scss/theme/bootstrap/_dropdown.scss +248 -0
  155. package/src/scss/theme/bootstrap/_forms.scss +9 -0
  156. package/src/scss/theme/bootstrap/_functions.scss +302 -0
  157. package/src/scss/theme/bootstrap/_grid.scss +33 -0
  158. package/src/scss/theme/bootstrap/_helpers.scss +10 -0
  159. package/src/scss/theme/bootstrap/_images.scss +42 -0
  160. package/src/scss/theme/bootstrap/_list-group.scss +191 -0
  161. package/src/scss/theme/bootstrap/_maps.scss +54 -0
  162. package/src/scss/theme/bootstrap/_mixins.scss +43 -0
  163. package/src/scss/theme/bootstrap/_modal.scss +237 -0
  164. package/src/scss/theme/bootstrap/_nav.scss +172 -0
  165. package/src/scss/theme/bootstrap/_navbar.scss +276 -0
  166. package/src/scss/theme/bootstrap/_offcanvas.scss +143 -0
  167. package/src/scss/theme/bootstrap/_pagination.scss +109 -0
  168. package/src/scss/theme/bootstrap/_placeholders.scss +51 -0
  169. package/src/scss/theme/bootstrap/_popover.scss +196 -0
  170. package/src/scss/theme/bootstrap/_progress.scss +59 -0
  171. package/src/scss/theme/bootstrap/_reboot.scss +610 -0
  172. package/src/scss/theme/bootstrap/_root.scss +73 -0
  173. package/src/scss/theme/bootstrap/_spinners.scss +85 -0
  174. package/src/scss/theme/bootstrap/_tables.scss +164 -0
  175. package/src/scss/theme/bootstrap/_toasts.scss +70 -0
  176. package/src/scss/theme/bootstrap/_tooltip.scss +120 -0
  177. package/src/scss/theme/bootstrap/_transitions.scss +27 -0
  178. package/src/scss/theme/bootstrap/_type.scss +106 -0
  179. package/src/scss/theme/bootstrap/_utilities.scss +647 -0
  180. package/src/scss/theme/bootstrap/_variables.scss +1633 -0
  181. package/src/scss/theme/bootstrap/forms/_floating-labels.scss +74 -0
  182. package/src/scss/theme/bootstrap/forms/_form-check.scss +175 -0
  183. package/src/scss/theme/bootstrap/forms/_form-control.scss +194 -0
  184. package/src/scss/theme/bootstrap/forms/_form-range.scss +91 -0
  185. package/src/scss/theme/bootstrap/forms/_form-select.scss +71 -0
  186. package/src/scss/theme/bootstrap/forms/_form-text.scss +11 -0
  187. package/src/scss/theme/bootstrap/forms/_input-group.scss +129 -0
  188. package/src/scss/theme/bootstrap/forms/_labels.scss +36 -0
  189. package/src/scss/theme/bootstrap/forms/_validation.scss +12 -0
  190. package/src/scss/theme/bootstrap/helpers/_clearfix.scss +3 -0
  191. package/src/scss/theme/bootstrap/helpers/_color-bg.scss +10 -0
  192. package/src/scss/theme/bootstrap/helpers/_colored-links.scss +12 -0
  193. package/src/scss/theme/bootstrap/helpers/_position.scss +36 -0
  194. package/src/scss/theme/bootstrap/helpers/_ratio.scss +26 -0
  195. package/src/scss/theme/bootstrap/helpers/_stacks.scss +15 -0
  196. package/src/scss/theme/bootstrap/helpers/_stretched-link.scss +15 -0
  197. package/src/scss/theme/bootstrap/helpers/_text-truncation.scss +7 -0
  198. package/src/scss/theme/bootstrap/helpers/_visually-hidden.scss +8 -0
  199. package/src/scss/theme/bootstrap/helpers/_vr.scss +8 -0
  200. package/src/scss/theme/bootstrap/mixins/_alert.scss +15 -0
  201. package/src/scss/theme/bootstrap/mixins/_backdrop.scss +14 -0
  202. package/src/scss/theme/bootstrap/mixins/_banner.scss +9 -0
  203. package/src/scss/theme/bootstrap/mixins/_border-radius.scss +78 -0
  204. package/src/scss/theme/bootstrap/mixins/_box-shadow.scss +18 -0
  205. package/src/scss/theme/bootstrap/mixins/_breakpoints.scss +127 -0
  206. package/src/scss/theme/bootstrap/mixins/_buttons.scss +70 -0
  207. package/src/scss/theme/bootstrap/mixins/_caret.scss +64 -0
  208. package/src/scss/theme/bootstrap/mixins/_clearfix.scss +9 -0
  209. package/src/scss/theme/bootstrap/mixins/_color-scheme.scss +7 -0
  210. package/src/scss/theme/bootstrap/mixins/_container.scss +11 -0
  211. package/src/scss/theme/bootstrap/mixins/_deprecate.scss +10 -0
  212. package/src/scss/theme/bootstrap/mixins/_forms.scss +152 -0
  213. package/src/scss/theme/bootstrap/mixins/_gradients.scss +47 -0
  214. package/src/scss/theme/bootstrap/mixins/_grid.scss +151 -0
  215. package/src/scss/theme/bootstrap/mixins/_image.scss +16 -0
  216. package/src/scss/theme/bootstrap/mixins/_list-group.scss +24 -0
  217. package/src/scss/theme/bootstrap/mixins/_lists.scss +7 -0
  218. package/src/scss/theme/bootstrap/mixins/_pagination.scss +10 -0
  219. package/src/scss/theme/bootstrap/mixins/_reset-text.scss +17 -0
  220. package/src/scss/theme/bootstrap/mixins/_resize.scss +6 -0
  221. package/src/scss/theme/bootstrap/mixins/_table-variants.scss +24 -0
  222. package/src/scss/theme/bootstrap/mixins/_text-truncate.scss +8 -0
  223. package/src/scss/theme/bootstrap/mixins/_transition.scss +26 -0
  224. package/src/scss/theme/bootstrap/mixins/_utilities.scss +97 -0
  225. package/src/scss/theme/bootstrap/mixins/_visually-hidden.scss +29 -0
  226. package/src/scss/theme/bootstrap/utilities/_api.scss +47 -0
  227. package/src/scss/theme/bootstrap/vendor/_rfs.scss +354 -0
  228. package/src/scss/theme/bs/_badge.scss +20 -0
  229. package/src/scss/theme/bs/_buttons.scss +185 -0
  230. package/src/scss/theme/bs/_dropdown.scss +86 -0
  231. package/src/scss/theme/bs/_forms.scss +161 -0
  232. package/src/scss/theme/bs/_list-group.scss +73 -0
  233. package/src/scss/theme/bs/_tables.scss +46 -0
  234. package/src/scss/theme/fonts/_fontmapping-roboto.scss +129 -0
  235. package/src/scss/theme/fonts/_fontmapping-segoe-ui.scss +127 -0
  236. package/src/scss/theme/fonts/_index.scss +2 -0
  237. package/src/scss/theme/mixins/_backdrop.scss +13 -0
  238. package/src/scss/theme/mixins/_palette.scss +165 -0
  239. package/src/scss/theme/mixins/_position.scss +33 -0
  240. package/src/scss/theme/mixins/_scrollbar.scss +110 -0
  241. package/src/scss/weavy-chat.scss +32 -0
  242. package/src/scss/weavy-messenger.scss +61 -0
  243. package/src/scss/weavy.scss +2 -0
  244. package/src/types/Chat.ts +1 -1
  245. package/src/types/Messenger.ts +1 -1
  246. package/src/types/types.ts +20 -11
  247. package/src/ui/Button.tsx +3 -4
  248. package/src/ui/Dropdown.tsx +4 -5
  249. package/src/ui/Icon.tsx +75 -39
  250. package/src/ui/Overlay.tsx +2 -3
  251. package/src/ui/Spinner.tsx +18 -0
  252. package/src/utils/fileUtilities.ts +166 -72
  253. package/src/utils/scrollbarDetection.js +48 -0
  254. package/dist/cjs/types/utils/styles.d.ts +0 -17
  255. package/dist/esm/types/utils/styles.d.ts +0 -17
  256. package/src/utils/styles.ts +0 -42
@@ -0,0 +1,127 @@
1
+ // Normal
2
+ @font-face {
3
+ font-family: 'Segoe UI';
4
+ font-style: normal;
5
+ font-weight: 100;
6
+ src: local('Segoe UI Thin'), local('Segoe UI Light');
7
+ }
8
+
9
+ @font-face {
10
+ font-family: 'Segoe UI';
11
+ font-style: normal;
12
+ font-weight: 200;
13
+ src: local('Segoe UI Light');
14
+ }
15
+
16
+ @font-face {
17
+ font-family: 'Segoe UI';
18
+ font-style: normal;
19
+ font-weight: 300;
20
+ src: local('Segoe UI Semilight');
21
+ }
22
+
23
+ @font-face {
24
+ font-family: 'Segoe UI';
25
+ font-style: normal;
26
+ font-weight: 400;
27
+ src: local('Segoe UI');
28
+ }
29
+
30
+ @font-face {
31
+ font-family: 'Segoe UI';
32
+ font-style: normal;
33
+ font-weight: 500;
34
+ src: local('Segoe UI Medium'), local('Segoe UI Semibold');
35
+ }
36
+
37
+ @font-face {
38
+ font-family: 'Segoe UI';
39
+ font-style: normal;
40
+ font-weight: 600;
41
+ src: local('Segoe UI Semibold');
42
+ }
43
+
44
+ @font-face {
45
+ font-family: 'Segoe UI';
46
+ font-style: normal;
47
+ font-weight: 700;
48
+ src: local('Segoe UI Bold');
49
+ }
50
+
51
+ @font-face {
52
+ font-family: 'Segoe UI';
53
+ font-style: normal;
54
+ font-weight: 800;
55
+ src: local('Segoe UI Semiblack'), local('Segoe UI Black');
56
+ }
57
+
58
+ @font-face {
59
+ font-family: 'Segoe UI';
60
+ font-style: normal;
61
+ font-weight: 900;
62
+ src: local('Segoe UI Black');
63
+ }
64
+
65
+ // Italic
66
+ @font-face {
67
+ font-family: 'Segoe UI';
68
+ font-style: italic;
69
+ font-weight: 100;
70
+ src: local('Segoe UI Thin Italic'), local('Segoe UI Light Italic');
71
+ }
72
+
73
+ @font-face {
74
+ font-family: 'Segoe UI';
75
+ font-style: italic;
76
+ font-weight: 200;
77
+ src: local('Segoe UI Light Italic');
78
+ }
79
+
80
+ @font-face {
81
+ font-family: 'Segoe UI';
82
+ font-style: italic;
83
+ font-weight: 300;
84
+ src: local('Segoe UI Semilight Italic');
85
+ }
86
+
87
+ @font-face {
88
+ font-family: 'Segoe UI';
89
+ font-style: italic;
90
+ font-weight: 400;
91
+ src: local('Segoe UI Italic');
92
+ }
93
+
94
+ @font-face {
95
+ font-family: 'Segoe UI';
96
+ font-style: italic;
97
+ font-weight: 500;
98
+ src: local('Segoe UI Medium Italic'), local('Segoe UI Semibold Italic');
99
+ }
100
+
101
+ @font-face {
102
+ font-family: 'Segoe UI';
103
+ font-style: italic;
104
+ font-weight: 600;
105
+ src: local('Segoe UI Semibold Italic');
106
+ }
107
+
108
+ @font-face {
109
+ font-family: 'Segoe UI';
110
+ font-style: italic;
111
+ font-weight: 700;
112
+ src: local('Segoe UI Bold Italic');
113
+ }
114
+
115
+ @font-face {
116
+ font-family: 'Segoe UI';
117
+ font-style: italic;
118
+ font-weight: 800;
119
+ src: local('Segoe UI Semiblack Italic'), local('Segoe UI Black Italic');
120
+ }
121
+
122
+ @font-face {
123
+ font-family: 'Segoe UI';
124
+ font-style: italic;
125
+ font-weight: 900;
126
+ src: local('Segoe UI Black Italic');
127
+ }
@@ -0,0 +1,2 @@
1
+ @import 'fontmapping-roboto';
2
+ @import 'fontmapping-segoe-ui'; // Needed by Firefox
@@ -0,0 +1,13 @@
1
+ $enable-backdrop-filter: true !default;
2
+ $backdrop-filter: blur(.5rem) !default;
3
+
4
+ @mixin filter($backdrop-filter: $backdrop-filter) {
5
+ backface-visibility: hidden;
6
+
7
+ @if($enable-backdrop-filter) {
8
+ @supports(backdrop-filter: $backdrop-filter) {
9
+ backdrop-filter: $backdrop-filter;
10
+ @content;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,165 @@
1
+ @use "sass:map";
2
+ @use "sass:list";
3
+ @use "sass:string";
4
+ @use "sass:math";
5
+ @use "sass:color";
6
+
7
+ // RYB COLOR WHEEL
8
+ // HSL mapping based on http://computergraphics.stackexchange.com/questions/1748/function-to-convert-hsv-angle-to-ryb-angle
9
+ // Matching bootstrap and MD colors
10
+ $color-names: (
11
+ "red": null,
12
+ "deep-orange": null,
13
+ "orange": null,
14
+ "amber": null,
15
+ "yellow": null,
16
+ "lime": null,
17
+ "light-green": null,
18
+ "green": null,
19
+ "teal": null,
20
+ "cyan": null,
21
+ "light-blue": null,
22
+ "blue": null,
23
+ "indigo": null,
24
+ "deep-purple": null,
25
+ "purple": null,
26
+ "pink": null
27
+ ) !default;
28
+
29
+ // Matching MD shades
30
+ // Added 950 for dark theme compatibility
31
+ $color-shades: (
32
+ "50": 95,
33
+ "100": 90,
34
+ "200": 80,
35
+ "300": 70,
36
+ "400": 60,
37
+ "500": 50,
38
+ "600": 42,
39
+ "700": 36,
40
+ "800": 28,
41
+ "900": 22,
42
+ "950": 16
43
+ ) !default;
44
+
45
+ // color mapping
46
+ $ryb-rgb-mapping: (
47
+ (0, 0) // Red
48
+ (50, 35) // Orange
49
+ (110, 60) // Yellow
50
+ (165, 120) // Green
51
+ (210, 180) // Cyan
52
+ (285, 240) // Blue
53
+ (330, 300) // Purple
54
+ (360, 360) // Red (same as 0)
55
+ ) !default;
56
+
57
+ // saturation mapping
58
+ $hue-sat-mapping: (
59
+ (0, 85) // Red
60
+ (110, 100) // Yellow
61
+ (165, 60) // Green
62
+ (210, 88) // Cyan
63
+ (285, 97) // Blue
64
+ (330, 65) // Purple
65
+ (360, 85) // Red (same as 0)
66
+ ) !default;
67
+
68
+ @function ryb-hue($h, $reverse: false) {
69
+ $deg: $h % 360;
70
+
71
+ $from: 1;
72
+ $to: 2;
73
+
74
+ @if $reverse {
75
+ $from: 2;
76
+ $to: 1;
77
+ }
78
+
79
+ $lower: 1;
80
+ $upper: 2;
81
+
82
+ @while $deg > list.nth(list.nth($ryb-rgb-mapping, $upper), $from) {
83
+ $lower: $upper;
84
+ $upper: $upper + 1;
85
+ }
86
+
87
+ $lower-from: list.nth(list.nth($ryb-rgb-mapping, $lower), $from);
88
+ $lower-to: list.nth(list.nth($ryb-rgb-mapping, $lower), $to);
89
+ $upper-from: list.nth(list.nth($ryb-rgb-mapping, $upper), $from);
90
+ $upper-to: list.nth(list.nth($ryb-rgb-mapping, $upper), $to);
91
+
92
+ $percent: math.div(($deg - $lower-from), ($upper-from - $lower-from));
93
+ $hue: $lower-to + ($upper-to - $lower-to) * $percent;
94
+
95
+ @return $hue;
96
+ }
97
+
98
+ @function ryb-saturation($rybHue, $saturation, $reverse: false) {
99
+ $deg: $rybHue % 360;
100
+ $sat: math.clamp(0, $saturation, 100);
101
+
102
+ $index: 1;
103
+ $value: 2;
104
+
105
+ $lower: 1;
106
+ $upper: 2;
107
+
108
+ @while $deg > list.nth(list.nth($hue-sat-mapping, $upper), $index) {
109
+ $lower: $upper;
110
+ $upper: $upper + 1;
111
+ }
112
+
113
+ $lower-index: list.nth(list.nth($hue-sat-mapping, $lower), $index);
114
+ $upper-index: list.nth(list.nth($hue-sat-mapping, $upper), $index);
115
+ $lower-value: list.nth(list.nth($hue-sat-mapping, $lower), $value);
116
+ $upper-value: list.nth(list.nth($hue-sat-mapping, $upper), $value);
117
+
118
+ $percent: math.div(($deg - $lower-index), ($upper-index - $lower-index));
119
+ $interpolation: math.div(($lower-value + ($upper-value - $lower-value) * $percent), 100);
120
+
121
+ @if $reverse {
122
+ @return math.div($sat, $interpolation);
123
+ } @else {
124
+ @return $sat * $interpolation;
125
+ }
126
+
127
+ }
128
+
129
+ @function hsl-to-ryb-as-hsl($h, $s, $l) {
130
+ $hue: math.floor(ryb-hue($h));
131
+ $saturation: ryb-saturation($h, $s) * 1%;
132
+ $lightness: $l * 1%;
133
+ @return hsl($hue, $saturation, $lightness);
134
+ }
135
+
136
+ @function generate-colors($base-color) {
137
+ $h: ryb-hue(math.div(hue($base-color), 1deg), true);
138
+ $divisions: list.length($color-names);
139
+
140
+ // 33% is minimum threshold to not get all colors gray
141
+ $normalizedS: math.clamp(ryb-saturation($h, 33), math.div(saturation($base-color), 1%), ryb-saturation($h, 100));
142
+ $s: ryb-saturation($h, $normalizedS, true);
143
+
144
+ $distance: math.div(360, $divisions);
145
+
146
+ $start-offset: $h % $distance;
147
+
148
+ // Clone
149
+ $generated-colors: map.merge($color-names, ());
150
+
151
+ @for $i from 1 through $divisions {
152
+ $ih: $start-offset + ($i - 1) * $distance;
153
+ $il: map.get($color-shades, "500");
154
+ $iname: list.nth(map.keys($color-names), $i);
155
+ $icolor: hsl-to-ryb-as-hsl($ih, $s, $il);
156
+ //@debug $iname $icolor;
157
+ $generated-colors: map.set($generated-colors, $iname, $icolor);
158
+ }
159
+
160
+ @return $generated-colors;
161
+ }
162
+
163
+ @function color-shade($color, $shade, $shades: $color-shades) {
164
+ @return color.change($color, $lightness: map.get($shades, $shade) * 1%)
165
+ }
@@ -0,0 +1,33 @@
1
+ @use "../variables";
2
+
3
+ @mixin fixed-top {
4
+ position: fixed;
5
+ top: 0;
6
+ right: 0;
7
+ left: 0;
8
+ z-index: variables.$zindex-fixed;
9
+ }
10
+
11
+ @mixin fixed-bottom {
12
+ position: fixed;
13
+ right: 0;
14
+ bottom: 0;
15
+ left: 0;
16
+ z-index: variables.$zindex-fixed;
17
+ }
18
+
19
+ @mixin sticky-top {
20
+ @supports (position: sticky) {
21
+ position: sticky;
22
+ top: 0;
23
+ z-index: variables.$zindex-sticky;
24
+ }
25
+ }
26
+
27
+ @mixin sticky-bottom {
28
+ @supports (position: sticky) {
29
+ position: sticky;
30
+ bottom: 0;
31
+ z-index: variables.$zindex-sticky;
32
+ }
33
+ }
@@ -0,0 +1,110 @@
1
+ @use "../colors";
2
+
3
+ @mixin scroll-y {
4
+ overflow-y: auto;
5
+ touch-action: pan-y, pan-x;
6
+
7
+ // to enable HW acceleration and not cause repaint on scroll
8
+ // opacity needed for custom scrollbar to paint
9
+ will-change: scroll-position, opacity;
10
+ backface-visibility: hidden;
11
+
12
+ // ios momentum scrolling on iOS <= 12, cannot be used on the <body> element!
13
+ &:not(body) {
14
+ -webkit-overflow-scrolling: touch;
15
+ }
16
+
17
+ max-height: 100%;
18
+ }
19
+
20
+ @mixin scroll-x {
21
+ overflow-x: auto;
22
+ touch-action: pan-y, pan-x;
23
+
24
+ // to enable HW acceleration and not cause repaint on scroll
25
+ will-change: scroll-position, opacity;
26
+ backface-visibility: hidden;
27
+ max-width: 100%;
28
+ }
29
+
30
+ // custom scrollbar styling
31
+ @mixin custom-scrollbar {
32
+ // custom scrollbar for webkit browsers
33
+ // reference https://webkit.org/blog/363/styling-scrollbars/
34
+
35
+ &::-webkit-scrollbar {
36
+ height: .625rem;
37
+ width: .625rem;
38
+ background: transparent;
39
+ z-index: 999;
40
+ }
41
+
42
+ &::-webkit-scrollbar-track {
43
+ background: transparent;
44
+ }
45
+
46
+ &::-webkit-scrollbar-thumb {
47
+ background-color: rgba(colors.$gray-500, 0.75);
48
+ border: .125rem solid transparent;
49
+ border-radius: .5rem;
50
+ background-clip: padding-box;
51
+
52
+ &:hover {
53
+ background-color: rgba(colors.$gray-700, 0.75);
54
+ }
55
+
56
+ &:window-inactive {
57
+ background-color: rgba(colors.$gray-500, 0.5);
58
+ }
59
+ }
60
+
61
+ // custom scrollbar for firefox
62
+ scrollbar-width: thin;
63
+ scrollbar-color: rgba(colors.$gray-500, 0.75) transparent;
64
+ }
65
+
66
+ // custom scrollbar styling
67
+ @mixin thin-scrollbar {
68
+ // custom scrollbar for webkit browsers
69
+ &::-webkit-scrollbar {
70
+ height: .375rem;
71
+ width: .375rem;
72
+ background: transparent;
73
+ z-index: 999;
74
+ }
75
+
76
+ &::-webkit-scrollbar-track {
77
+ background: transparent;
78
+ }
79
+
80
+ &::-webkit-scrollbar-thumb {
81
+ background-color: rgba(colors.$gray-700, 0.75);
82
+ border: 0 solid transparent;
83
+ border-radius: 0;
84
+ background-clip: padding-box;
85
+
86
+ &:hover {
87
+ background-color: rgba(colors.$gray-500, 0.75);
88
+ }
89
+
90
+ &:window-inactive {
91
+ background-color: rgba(colors.$gray-500, 0.5);
92
+ }
93
+ }
94
+
95
+ // custom scrollbar for firefox
96
+ scrollbar-width: thin;
97
+ scrollbar-color: rgba(colors.$gray-700, 0.75) transparent;
98
+ }
99
+
100
+ @mixin scrollbar-top-padding($scrollbar-padding) {
101
+ &::-webkit-scrollbar-button:vertical:start {
102
+ height: $scrollbar-padding;
103
+ }
104
+ }
105
+
106
+ @mixin scrollbar-bottom-padding($scrollbar-padding) {
107
+ &::-webkit-scrollbar-button:vertical:end {
108
+ height: $scrollbar-padding;
109
+ }
110
+ }
@@ -0,0 +1,32 @@
1
+ // weavy reboot
2
+ @use "theme/reboot";
3
+ // weavy ui components
4
+ @use "theme/attachments";
5
+ @use "theme/avatar";
6
+ @use "theme/buttons";
7
+ @use "theme/code";
8
+ @use "theme/content";
9
+ @use "theme/dropdown";
10
+ @use "theme/emoji";
11
+ @use "theme/icons";
12
+ @use "theme/image-grid";
13
+ @use "theme/messages";
14
+ @use "theme/message-editor";
15
+ @use "theme/overlays";
16
+ @use "theme/pager";
17
+ @use "theme/pane";
18
+ @use "theme/panels";
19
+ @use "theme/picker-list";
20
+ @use "theme/preview";
21
+ @use "theme/preview-code";
22
+ @use "theme/preview-embed";
23
+ @use "theme/preview-html";
24
+ @use "theme/preview-icon";
25
+ @use "theme/preview-image";
26
+ @use "theme/preview-media";
27
+ @use "theme/preview-pdf";
28
+ @use "theme/preview-text";
29
+ @use "theme/reactions";
30
+ @use "theme/scroll";
31
+ @use "theme/spinner";
32
+ @use "theme/typing";
@@ -0,0 +1,61 @@
1
+ // weavy reboot
2
+ @use "theme/reboot";
3
+
4
+ // weavy ui components
5
+ @use "theme/appbar";
6
+ @use "theme/attachments";
7
+ @use "theme/avatar";
8
+ @use "theme/badge";
9
+ @use "theme/buttons";
10
+ @use "theme/checkbox";
11
+ @use "theme/code";
12
+ @use "theme/content";
13
+ @use "theme/conversations";
14
+ @use "theme/dropdown";
15
+ @use "theme/emoji";
16
+ @use "theme/icons";
17
+ @use "theme/image-grid";
18
+ @use "theme/inputs";
19
+ @use "theme/messages";
20
+ @use "theme/message-editor";
21
+ @use "theme/overlays";
22
+ @use "theme/pager";
23
+ @use "theme/pane";
24
+ @use "theme/panels";
25
+ @use "theme/picker-list";
26
+ @use "theme/preview";
27
+ @use "theme/preview-code";
28
+ @use "theme/preview-embed";
29
+ @use "theme/preview-html";
30
+ @use "theme/preview-icon";
31
+ @use "theme/preview-image";
32
+ @use "theme/preview-media";
33
+ @use "theme/preview-pdf";
34
+ @use "theme/preview-text";
35
+ @use "theme/reactions";
36
+ @use "theme/search";
37
+ @use "theme/scroll";
38
+ @use "theme/spinner";
39
+ @use "theme/typing";
40
+
41
+ // layout
42
+ .wy-messenger-provider {
43
+ display: flex;
44
+ min-height: 0;
45
+ min-width: 0;
46
+ flex: 1 1 0;
47
+ }
48
+
49
+ .wy-messenger-sidebar {
50
+ width: 300px;
51
+ border-right: 1px solid #ccc;
52
+ }
53
+
54
+ .wy-messenger-conversation{
55
+ overflow-anchor: none;
56
+ display: flex;
57
+ flex-direction: column;
58
+ flex: 1 1 0;
59
+ }
60
+
61
+
@@ -0,0 +1,2 @@
1
+ @use "weavy-chat";
2
+ @use "weavy-messenger";
package/src/types/Chat.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export interface ChatProps {
2
- id: string
2
+ uid: string
3
3
  }
@@ -1,3 +1,3 @@
1
1
  export interface Messenger {
2
- options?: MessengerContextOptions
2
+
3
3
  }
@@ -1,13 +1,16 @@
1
1
  interface WeavyClient {
2
2
  url: string,
3
- tokenFactory: (() => string | Promise<string>),
3
+ tokenFactoryInternal: () => Promise<string>,
4
4
  subscribe: Function,
5
5
  unsubscribe: Function,
6
+ destroy: Function,
7
+ get: (url: string, retry?: boolean) => Promise<Response>,
8
+ post: (url: string, method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", body: string | FormData, contentType?: string, retry?: boolean) => Promise<Response>
6
9
  }
7
10
 
8
11
  type WeavyClientOptions = {
9
12
  url: string,
10
- tokenFactory: (() => string | Promise<string>)
13
+ tokenFactory: (refresh: boolean) => Promise<string>
11
14
  }
12
15
 
13
16
  type WeavyContextProps = {
@@ -19,11 +22,14 @@ type WeavyContextOptions = {
19
22
  zoomAuthenticationUrl?: string,
20
23
  teamsAuthenticationUrl?: string,
21
24
  enableCloudFiles?: boolean,
22
- filebrowserUrl?: string
25
+ enableScrollbarDetection?: boolean,
26
+ filebrowserUrl?: string,
27
+ pdfWorkerUrl?: string,
28
+ pdfCMapsUrl?: string,
29
+ reactions?: string[]
23
30
  }
24
31
 
25
32
  type MessengerContextProps = {
26
- options?: MessengerContextOptions,
27
33
  selectedConversationId: null | number,
28
34
  setSelectedConversationId: Function
29
35
  };
@@ -32,11 +38,6 @@ type UserContextProps = {
32
38
  user: UserType
33
39
  };
34
40
 
35
-
36
- type MessengerContextOptions = {
37
- reactions?: string[]
38
- }
39
-
40
41
  type PreviewContextProps = {
41
42
  openPreview: Function,
42
43
  closePreview: Function
@@ -136,11 +137,19 @@ type AttachmentType = {
136
137
  size: number,
137
138
  provider: string,
138
139
  download_url: string,
139
- preview_url: string,
140
+ embed_url: string,
141
+ external_url: string,
140
142
  thumbnail_url: string,
141
- external_url: string
143
+ preview_format: PreviewFormatType,
144
+ application_url: string,
145
+ preview_url: string,
146
+ created_at: string,
147
+ created_by?: UserType,
148
+ createdById?: number
142
149
  }
143
150
 
151
+ type PreviewFormatType = "audio"|"code"|"embed"|"html"|"image"|"pdf"|"text"|"video"|"none";
152
+
144
153
  type ReactionType = {
145
154
  id: number,
146
155
  parent: MessageType,
package/src/ui/Button.tsx CHANGED
@@ -1,7 +1,6 @@
1
1
  import React, { Children } from "react";
2
2
  import Icon from "./Icon";
3
3
  import classNames from "classnames";
4
- import { prefix as wy } from "../utils/styles";
5
4
 
6
5
  type Props = {
7
6
  active?: boolean,
@@ -16,11 +15,11 @@ const Button: any = ({ active = false, type = "button", onClick, className = "",
16
15
  let singleChild: any = Children.count(children) === 1 && Children.toArray(children).pop();
17
16
 
18
17
  let buttonClassNames = classNames(
19
- wy('button'),
18
+ "wy-button",
20
19
  className,
21
20
  {
22
- [wy('active')]: active,
23
- [wy('button-icon')]: singleChild?.type === Icon.UI
21
+ "wy-active": active,
22
+ "wy-button-icon": singleChild?.type === Icon.UI
24
23
  }
25
24
  );
26
25
 
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
2
2
  import classNames from 'classnames';
3
3
  import Icon from "./Icon";
4
4
  import Button from "./Button";
5
- import { prefix as wy } from "../utils/styles";
6
5
 
7
6
  type DropdownProps = {
8
7
  directionX?: "left" | "right";
@@ -30,12 +29,12 @@ const Dropdown = ({ directionX = "right", directionY = "down", children, classNa
30
29
  }
31
30
 
32
31
  return (
33
- <span className={classNames(wy("dropdown"), { [wy("dropup")]: directionY === "up" }, className)} {...props}>
34
- <Button.UI onClick={(e: any) => handleMenuClick(e)} className={wy(classNames({ "active": visible }))}>
32
+ <span className={classNames("wy-dropdown", { "wy-dropup": directionY === "up" }, className)} {...props}>
33
+ <Button.UI onClick={(e: any) => handleMenuClick(e)} className={classNames({ "wy-active": visible })}>
35
34
  <Icon.UI name="dots-vertical" />
36
35
  </Button.UI>
37
36
 
38
- <div className={wy(classNames("dropdown-menu", { "dropdown-menu-end": directionX === "left" }))} hidden={!visible}>
37
+ <div className={classNames("wy-dropdown-menu", { "wy-dropdown-menu-end": directionX === "left" })} hidden={!visible}>
39
38
  {children}
40
39
  </div>
41
40
  </span>
@@ -50,7 +49,7 @@ type ItemProps = {
50
49
  props?: React.HTMLAttributes<HTMLDivElement>
51
50
  }
52
51
  const DropdownItem = ({ children, className = "", onClick, ...props }: ItemProps) => {
53
- return <div className={classNames(wy("dropdown-item"), className)} onClick={onClick} {...props}>{children}</div>
52
+ return <div className={classNames("wy-dropdown-item", className)} onClick={onClick} {...props}>{children}</div>
54
53
  }
55
54
 
56
55
  // Export as replacable UI component