@hyvor/design 0.0.67 → 1.0.3

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 (184) hide show
  1. package/dist/components/ActionList/ActionList.svelte +21 -13
  2. package/dist/components/ActionList/ActionList.svelte.d.ts +8 -20
  3. package/dist/components/ActionList/ActionListGroup.svelte +40 -35
  4. package/dist/components/ActionList/ActionListGroup.svelte.d.ts +8 -20
  5. package/dist/components/ActionList/ActionListItem.svelte +129 -107
  6. package/dist/components/ActionList/ActionListItem.svelte.d.ts +27 -25
  7. package/dist/components/ActionList/Selected.svelte +27 -24
  8. package/dist/components/ActionList/Selected.svelte.d.ts +6 -17
  9. package/dist/components/Avatar/Avatar.svelte +22 -19
  10. package/dist/components/Avatar/Avatar.svelte.d.ts +7 -18
  11. package/dist/components/Avatar/AvatarStack.svelte +29 -27
  12. package/dist/components/Avatar/AvatarStack.svelte.d.ts +6 -18
  13. package/dist/components/Base/Base.svelte +16 -8
  14. package/dist/components/Base/Base.svelte.d.ts +6 -18
  15. package/dist/components/Box/Box.svelte +16 -9
  16. package/dist/components/Box/Box.svelte.d.ts +7 -19
  17. package/dist/components/Button/Button.svelte +65 -47
  18. package/dist/components/Button/Button.svelte.d.ts +16 -39
  19. package/dist/components/Button/ButtonGroup.svelte +14 -6
  20. package/dist/components/Button/ButtonGroup.svelte.d.ts +5 -27
  21. package/dist/components/Callout/Callout.svelte +110 -87
  22. package/dist/components/Callout/Callout.svelte.d.ts +11 -22
  23. package/dist/components/Checkbox/Checkbox.svelte +156 -144
  24. package/dist/components/Checkbox/Checkbox.svelte.d.ts +11 -34
  25. package/dist/components/CodeBlock/CodeBlock.svelte +45 -32
  26. package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +6 -17
  27. package/dist/components/CodeBlock/getCode.js +8 -6
  28. package/dist/components/CodeBlock/hljs.scss +189 -191
  29. package/dist/components/CodeBlock/prism.scss +370 -7
  30. package/dist/components/ColorPicker/ColorPicker.svelte +75 -56
  31. package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +25 -19
  32. package/dist/components/Dark/DarkProvider.svelte +16 -14
  33. package/dist/components/Dark/DarkProvider.svelte.d.ts +16 -12
  34. package/dist/components/Dark/DarkToggle.svelte +15 -16
  35. package/dist/components/Dark/DarkToggle.svelte.d.ts +16 -12
  36. package/dist/components/Divider/Divider.svelte +23 -13
  37. package/dist/components/Divider/Divider.svelte.d.ts +9 -20
  38. package/dist/components/Dropdown/Dropdown.svelte +58 -114
  39. package/dist/components/Dropdown/Dropdown.svelte.d.ts +13 -24
  40. package/dist/components/Dropdown/DropdownContent.svelte +152 -0
  41. package/dist/components/Dropdown/DropdownContent.svelte.d.ts +12 -0
  42. package/dist/components/FormControl/Caption.svelte +18 -11
  43. package/dist/components/FormControl/Caption.svelte.d.ts +7 -19
  44. package/dist/components/FormControl/FormControl.svelte +28 -19
  45. package/dist/components/FormControl/FormControl.svelte.d.ts +6 -27
  46. package/dist/components/FormControl/InputGroup.svelte +22 -15
  47. package/dist/components/FormControl/InputGroup.svelte.d.ts +7 -19
  48. package/dist/components/FormControl/Label.svelte +15 -6
  49. package/dist/components/FormControl/Label.svelte.d.ts +6 -27
  50. package/dist/components/FormControl/Validation.svelte +30 -19
  51. package/dist/components/FormControl/Validation.svelte.d.ts +9 -21
  52. package/dist/components/HyvorBar/BarProducts.svelte +71 -0
  53. package/dist/components/HyvorBar/BarProducts.svelte.d.ts +32 -0
  54. package/dist/components/HyvorBar/BarSupport.svelte +183 -0
  55. package/dist/components/HyvorBar/BarSupport.svelte.d.ts +8 -0
  56. package/dist/components/HyvorBar/BarUpdates.svelte +68 -0
  57. package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +7 -0
  58. package/dist/components/HyvorBar/BarUpdatesList.svelte +159 -0
  59. package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +7 -0
  60. package/dist/components/HyvorBar/BarUser.svelte +72 -0
  61. package/dist/components/HyvorBar/BarUser.svelte.d.ts +5 -0
  62. package/dist/components/HyvorBar/BarUserPreview.svelte +43 -0
  63. package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +18 -0
  64. package/dist/components/HyvorBar/HyvorBar.svelte +183 -0
  65. package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +8 -0
  66. package/dist/components/HyvorBar/bar.d.ts +33 -0
  67. package/dist/components/HyvorBar/bar.js +74 -0
  68. package/dist/components/HyvorBar/img/G2.svelte +9 -0
  69. package/dist/components/HyvorBar/img/G2.svelte.d.ts +26 -0
  70. package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
  71. package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +26 -0
  72. package/dist/components/IconButton/IconButton.svelte +49 -32
  73. package/dist/components/IconButton/IconButton.svelte.d.ts +10 -33
  74. package/dist/components/IconMessage/IconMessage.svelte +157 -51
  75. package/dist/components/IconMessage/IconMessage.svelte.d.ts +19 -27
  76. package/dist/components/Internationalization/InternationalizationProvider.svelte +15 -8
  77. package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +7 -19
  78. package/dist/components/Internationalization/LanguageToggle.svelte +80 -57
  79. package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +11 -22
  80. package/dist/components/Internationalization/T.svelte +158 -114
  81. package/dist/components/Internationalization/T.svelte.d.ts +17 -15
  82. package/dist/components/Internationalization/i18n.d.ts +3 -5
  83. package/dist/components/Internationalization/i18n.js +13 -11
  84. package/dist/components/Internationalization/t.d.ts +2 -3
  85. package/dist/components/Internationalization/t.js +4 -4
  86. package/dist/components/Internationalization/types.d.ts +2 -1
  87. package/dist/components/Link/Link.svelte +68 -61
  88. package/dist/components/Link/Link.svelte.d.ts +11 -34
  89. package/dist/components/Loader/LoadButton.svelte +39 -38
  90. package/dist/components/Loader/LoadButton.svelte.d.ts +29 -42
  91. package/dist/components/Loader/Loader.svelte +121 -107
  92. package/dist/components/Loader/Loader.svelte.d.ts +15 -27
  93. package/dist/components/Modal/ConfirmModalProvider.svelte +41 -51
  94. package/dist/components/Modal/ConfirmModalProvider.svelte.d.ts +3 -14
  95. package/dist/components/Modal/Modal.svelte +202 -203
  96. package/dist/components/Modal/Modal.svelte.d.ts +31 -29
  97. package/dist/components/Modal/ModalFooter.svelte +36 -31
  98. package/dist/components/Modal/ModalFooter.svelte.d.ts +22 -18
  99. package/dist/components/Modal/confirm.d.ts +2 -2
  100. package/dist/components/Modal/confirm.js +4 -4
  101. package/dist/components/Modal/modal-types.d.ts +4 -4
  102. package/dist/components/NavLink/NavLink.svelte +94 -89
  103. package/dist/components/NavLink/NavLink.svelte.d.ts +11 -33
  104. package/dist/components/Radio/Radio.svelte +46 -35
  105. package/dist/components/Radio/Radio.svelte.d.ts +10 -33
  106. package/dist/components/Slider/Slider.svelte +129 -120
  107. package/dist/components/Slider/Slider.svelte.d.ts +24 -20
  108. package/dist/components/SplitControl/SplitControl.svelte +43 -48
  109. package/dist/components/SplitControl/SplitControl.svelte.d.ts +11 -24
  110. package/dist/components/Switch/Switch.svelte +77 -67
  111. package/dist/components/Switch/Switch.svelte.d.ts +8 -31
  112. package/dist/components/TabNav/TabNav.svelte +33 -23
  113. package/dist/components/TabNav/TabNav.svelte.d.ts +7 -19
  114. package/dist/components/TabNav/TabNavItem.svelte +65 -51
  115. package/dist/components/TabNav/TabNavItem.svelte.d.ts +10 -24
  116. package/dist/components/Table/Table.svelte +17 -7
  117. package/dist/components/Table/Table.svelte.d.ts +7 -19
  118. package/dist/components/Table/TableRow.svelte +32 -24
  119. package/dist/components/Table/TableRow.svelte.d.ts +7 -19
  120. package/dist/components/Tag/Tag.svelte +75 -49
  121. package/dist/components/Tag/Tag.svelte.d.ts +16 -39
  122. package/dist/components/Text/Text.svelte +33 -26
  123. package/dist/components/Text/Text.svelte.d.ts +10 -22
  124. package/dist/components/TextInput/TextInput.svelte +54 -33
  125. package/dist/components/TextInput/TextInput.svelte.d.ts +12 -36
  126. package/dist/components/Textarea/Textarea.svelte +68 -46
  127. package/dist/components/Textarea/Textarea.svelte.d.ts +13 -37
  128. package/dist/components/Toast/ToastIcon.svelte +55 -46
  129. package/dist/components/Toast/ToastIcon.svelte.d.ts +5 -16
  130. package/dist/components/Toast/ToastMessage.svelte +42 -41
  131. package/dist/components/Toast/ToastMessage.svelte.d.ts +5 -16
  132. package/dist/components/Toast/ToastProvider.svelte +22 -20
  133. package/dist/components/Toast/ToastProvider.svelte.d.ts +16 -12
  134. package/dist/components/Toast/cleaner.js +5 -5
  135. package/dist/components/Toast/toast.d.ts +3 -3
  136. package/dist/components/Toast/toast.js +10 -10
  137. package/dist/components/Tooltip/Tooltip.svelte +163 -148
  138. package/dist/components/Tooltip/Tooltip.svelte.d.ts +35 -23
  139. package/dist/components/directives/clickOutside.js +4 -4
  140. package/dist/components/directives/debounce.d.ts +1 -0
  141. package/dist/components/directives/debounce.js +8 -0
  142. package/dist/components/index.d.ts +1 -0
  143. package/dist/components/index.js +1 -0
  144. package/dist/index.css +31 -33
  145. package/dist/marketing/Container/Container.svelte +15 -9
  146. package/dist/marketing/Container/Container.svelte.d.ts +6 -18
  147. package/dist/marketing/Docs/Content/Content.svelte +48 -35
  148. package/dist/marketing/Docs/Content/Content.svelte.d.ts +5 -16
  149. package/dist/marketing/Docs/Content/DocsImage.svelte +67 -69
  150. package/dist/marketing/Docs/Content/DocsImage.svelte.d.ts +9 -20
  151. package/dist/marketing/Docs/Docs.svelte +28 -25
  152. package/dist/marketing/Docs/Docs.svelte.d.ts +6 -29
  153. package/dist/marketing/Docs/Nav/Nav.svelte +96 -70
  154. package/dist/marketing/Docs/Nav/Nav.svelte.d.ts +5 -16
  155. package/dist/marketing/Docs/Nav/NavCategory.svelte +39 -29
  156. package/dist/marketing/Docs/Nav/NavCategory.svelte.d.ts +8 -20
  157. package/dist/marketing/Docs/Nav/NavItem.svelte +30 -26
  158. package/dist/marketing/Docs/Nav/NavItem.svelte.d.ts +6 -18
  159. package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
  160. package/dist/marketing/Docs/Sidebar/Sidebar.svelte.d.ts +22 -19
  161. package/dist/marketing/Docs/Toc.svelte +64 -56
  162. package/dist/marketing/Docs/Toc.svelte.d.ts +3 -14
  163. package/dist/marketing/Document/Document.svelte +15 -8
  164. package/dist/marketing/Document/Document.svelte.d.ts +7 -19
  165. package/dist/marketing/Document/DocumentTitle.svelte +65 -54
  166. package/dist/marketing/Document/DocumentTitle.svelte.d.ts +9 -20
  167. package/dist/marketing/Footer/Footer.svelte +154 -145
  168. package/dist/marketing/Footer/Footer.svelte.d.ts +8 -20
  169. package/dist/marketing/Footer/FooterLinkList.svelte +31 -27
  170. package/dist/marketing/Footer/FooterLinkList.svelte.d.ts +6 -18
  171. package/dist/marketing/Header/Header.svelte +47 -37
  172. package/dist/marketing/Header/Header.svelte.d.ts +10 -22
  173. package/dist/marketing/Logo/LogoBlogs.svelte +46 -0
  174. package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +5 -0
  175. package/dist/marketing/Logo/LogoCore.svelte +46 -0
  176. package/dist/marketing/Logo/LogoCore.svelte.d.ts +5 -0
  177. package/dist/marketing/Logo/LogoFortguard.svelte +54 -0
  178. package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +5 -0
  179. package/dist/marketing/Logo/LogoTalk.svelte +32 -0
  180. package/dist/marketing/Logo/LogoTalk.svelte.d.ts +5 -0
  181. package/dist/stores/dark.d.ts +0 -1
  182. package/dist/stores/dark.js +8 -8
  183. package/dist/variables.scss +41 -48
  184. package/package.json +59 -58
@@ -0,0 +1,159 @@
1
+ <script lang="ts">
2
+ import { onMount } from 'svelte';
3
+ import Loader from '../Loader/Loader.svelte';
4
+ import ActionList from '../ActionList/ActionList.svelte';
5
+ import ActionListItem from '../ActionList/ActionListItem.svelte';
6
+ import {
7
+ barUnreadUpdates,
8
+ UnreadUpdatesTimeLocalStorage,
9
+ type BarProduct,
10
+ type BarUpdate
11
+ } from './bar.js';
12
+ import { IconBoxArrowUpRight } from '@hyvor/icons';
13
+ import Button from '../Button/Button.svelte';
14
+ import Tag from '../Tag/Tag.svelte';
15
+ import IconMessage from '../IconMessage/IconMessage.svelte';
16
+
17
+ interface Props {
18
+ instance: string;
19
+ product: BarProduct;
20
+ }
21
+
22
+ let { instance, product }: Props = $props();
23
+
24
+ let updates: BarUpdate[] = $state([]);
25
+ let loading = $state(true);
26
+ let error = $state(false);
27
+
28
+ let lastReadTime: null | number = $state(null);
29
+
30
+ function fetchUpdates() {
31
+ error = false;
32
+ lastReadTime = UnreadUpdatesTimeLocalStorage.get();
33
+ loading = true;
34
+
35
+ fetch(instance + '/api/public/updates?types=company,' + product)
36
+ .then((response) => response.json())
37
+ .then((data) => {
38
+ updates = data;
39
+
40
+ barUnreadUpdates.set(0);
41
+ // set as last read now
42
+ UnreadUpdatesTimeLocalStorage.setNow();
43
+ })
44
+ .catch(() => {
45
+ error = true;
46
+ })
47
+ .finally(() => {
48
+ loading = false;
49
+ });
50
+ }
51
+
52
+ onMount(() => {
53
+ fetchUpdates();
54
+ });
55
+ </script>
56
+
57
+ {#if loading}
58
+ <Loader padding={80} block size="small" />
59
+ {:else if error}
60
+ <IconMessage
61
+ error
62
+ cta={{
63
+ text: 'Try again',
64
+ onClick: (e) => {
65
+ e.stopPropagation();
66
+ fetchUpdates();
67
+ },
68
+ props: { color: 'input' }
69
+ }}>Failed to load updates.</IconMessage
70
+ >
71
+ {:else if updates.length === 0}
72
+ <IconMessage empty>There are no updates to show.</IconMessage>
73
+ {:else}
74
+ <div class="updates-wrap">
75
+ <ActionList>
76
+ {#each updates as update}
77
+ <a href={update.url || '#'} target="_blank" rel="noopener noreferrer">
78
+ <ActionListItem>
79
+ {#if update.type === 'company' || (lastReadTime && update.created_at > lastReadTime)}
80
+ <div class="company-update">
81
+ {#if lastReadTime && update.created_at > lastReadTime}
82
+ <Tag size="x-small" color="green">New</Tag>
83
+ {/if}
84
+ {#if update.type === 'company'}
85
+ <Tag size="x-small" color="blue">Company Update</Tag>
86
+ {/if}
87
+ </div>
88
+ {/if}
89
+ <div class="title">
90
+ {update.title}
91
+ </div>
92
+ {#snippet description()}
93
+ <div>
94
+ <div class="description">
95
+ {update.content}
96
+ </div>
97
+ <div class="date">
98
+ {new Intl.DateTimeFormat('en-US').format(new Date(update.created_at * 1000))}
99
+ </div>
100
+ </div>
101
+ {/snippet}
102
+ {#snippet end()}
103
+ <span>
104
+ {#if update.url}
105
+ <IconBoxArrowUpRight size={12} />
106
+ {/if}
107
+ </span>
108
+ {/snippet}
109
+ </ActionListItem>
110
+ </a>
111
+ {/each}
112
+ </ActionList>
113
+ </div>
114
+ {/if}
115
+
116
+ <div class="top">
117
+ <Button size="small" color="input" as="a" href={instance + '/updates'} target="_blank">
118
+ View all updates
119
+ {#snippet end()}
120
+ <IconBoxArrowUpRight size={12} />
121
+ {/snippet}
122
+ </Button>
123
+ </div>
124
+
125
+ <style>
126
+ .title {
127
+ font-weight: 600;
128
+ font-size: 16px;
129
+ }
130
+ .description {
131
+ font-size: 14px;
132
+ color: var(--text);
133
+ }
134
+ .date {
135
+ margin-top: 4px;
136
+ font-weight: normal;
137
+ }
138
+ a :global(.action-list-item) {
139
+ padding: 12px 20px;
140
+ }
141
+ .updates-wrap {
142
+ max-height: 600px;
143
+ overflow-y: auto;
144
+ padding: 10px;
145
+ }
146
+ .top {
147
+ padding: 10px 20px;
148
+ display: flex;
149
+ justify-content: center;
150
+ border-top: 1px solid var(--border);
151
+ }
152
+ .company-update {
153
+ margin-bottom: 4px;
154
+ font-weight: normal;
155
+ }
156
+ .description {
157
+ margin-top: 4px;
158
+ }
159
+ </style>
@@ -0,0 +1,7 @@
1
+ import { type BarProduct } from './bar.js';
2
+ declare const BarUpdatesList: import("svelte").Component<{
3
+ instance: string;
4
+ product: BarProduct;
5
+ }, {}, "">;
6
+ type BarUpdatesList = ReturnType<typeof BarUpdatesList>;
7
+ export default BarUpdatesList;
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import ActionList from '../ActionList/ActionList.svelte';
3
+ import ActionListItem from '../ActionList/ActionListItem.svelte';
4
+ import Dropdown from '../Dropdown/Dropdown.svelte';
5
+ import { IconBoxArrowUpRight } from '@hyvor/icons';
6
+ import { barUser } from './bar.js';
7
+ import BarUserPreview from './BarUserPreview.svelte';
8
+
9
+ interface Props {
10
+ instance: string;
11
+ }
12
+
13
+ let { instance }: Props = $props();
14
+ </script>
15
+
16
+ <div class="wrap">
17
+ <Dropdown align="end" width={325}>
18
+ {#snippet trigger()}
19
+ <button class="user-wrap">
20
+ {#if $barUser}
21
+ <img class="user-picture" src={$barUser?.picture_url} alt={$barUser?.name} />
22
+ {/if}
23
+ </button>
24
+ {/snippet}
25
+
26
+ {#snippet content()}
27
+ <ActionList>
28
+ <BarUserPreview />
29
+
30
+ <a href="{instance}/account" target="_blank">
31
+ <ActionListItem>
32
+ Manage Account
33
+ {#snippet end()}
34
+ <IconBoxArrowUpRight size={12} />
35
+ {/snippet}
36
+ </ActionListItem>
37
+ </a>
38
+ <a href="{instance}/account/logout">
39
+ <ActionListItem>Logout</ActionListItem>
40
+ </a>
41
+ </ActionList>
42
+ {/snippet}
43
+ </Dropdown>
44
+ </div>
45
+
46
+ <style>
47
+ .wrap,
48
+ .wrap :global(.dropdown),
49
+ :global(.dropdown > .trigger) {
50
+ display: inline-flex;
51
+ align-items: center;
52
+ }
53
+ .user-wrap {
54
+ display: inline-flex;
55
+ align-items: center;
56
+ margin-left: 5px;
57
+ border-radius: 50%;
58
+ width: 30px;
59
+ height: 30px;
60
+ overflow: hidden;
61
+ transition: 0.3s box-shadow;
62
+ cursor: pointer;
63
+ background-color: var(--input);
64
+ }
65
+ .user-wrap:hover {
66
+ box-shadow: 0 0 0 4px var(--input);
67
+ }
68
+ img {
69
+ width: 100%;
70
+ height: 100%;
71
+ }
72
+ </style>
@@ -0,0 +1,5 @@
1
+ declare const BarUser: import("svelte").Component<{
2
+ instance: string;
3
+ }, {}, "">;
4
+ type BarUser = ReturnType<typeof BarUser>;
5
+ export default BarUser;
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import { barUser } from './bar.js';
3
+ </script>
4
+
5
+ {#if $barUser}
6
+ <div class="preview">
7
+ <div class="left">
8
+ <img src={$barUser.picture_url} alt={$barUser.name} />
9
+ </div>
10
+ <div class="right">
11
+ <div class="username">@{$barUser.username}</div>
12
+ <div class="email">{$barUser.email}</div>
13
+ </div>
14
+ </div>
15
+ {/if}
16
+
17
+ <style>
18
+ .preview {
19
+ display: flex;
20
+ align-items: center;
21
+ padding: 8px 14px;
22
+ }
23
+ .left {
24
+ flex-shrink: 0;
25
+ margin-right: 8px;
26
+ }
27
+ img {
28
+ width: 40px;
29
+ height: 40px;
30
+ border-radius: 50%;
31
+ }
32
+ .right {
33
+ flex: 1;
34
+ line-height: 18px;
35
+ }
36
+ .username {
37
+ font-weight: 600;
38
+ }
39
+ .email {
40
+ color: var(--text-light);
41
+ font-size: 14px;
42
+ }
43
+ </style>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const BarUserPreview: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type BarUserPreview = InstanceType<typeof BarUserPreview>;
18
+ export default BarUserPreview;
@@ -0,0 +1,183 @@
1
+ <script lang="ts">
2
+ import BarUser from './BarUser.svelte';
3
+ import { onMount } from 'svelte';
4
+ import BarProducts, { PRODUCTS } from './BarProducts.svelte';
5
+ import BarSupport from './BarSupport.svelte';
6
+ import { loadBarUser, type BarConfig, type BarProduct } from './bar.js';
7
+ import BarUpdates from './BarUpdates.svelte';
8
+ import { IconCaretDownFill } from '@hyvor/icons';
9
+ import LogoTalk from '../../marketing/Logo/LogoTalk.svelte';
10
+ import LogoBlogs from '../../marketing/Logo/LogoBlogs.svelte';
11
+ import LogoCore from '../../marketing/Logo/LogoCore.svelte';
12
+
13
+ interface Props {
14
+ instance?: string;
15
+ product: BarProduct;
16
+ config?: Partial<BarConfig>;
17
+ }
18
+
19
+ let { instance = 'https://hyvor.com', product, config = {} }: Props = $props();
20
+
21
+ let mobileShow = $state(false);
22
+
23
+ const configComplete: BarConfig = {
24
+ ...{
25
+ name: null,
26
+ docs: true,
27
+ chat: true,
28
+ twitter: null,
29
+ g2: null
30
+ },
31
+ ...config
32
+ };
33
+
34
+ function handleBarClick(e: MouseEvent) {
35
+ if (mobileShow && e.target instanceof Element && e.target.closest('.dropdown .trigger')) {
36
+ return;
37
+ }
38
+ if (window.innerWidth <= 600) {
39
+ mobileShow = !mobileShow;
40
+ }
41
+ }
42
+
43
+ onMount(() => {
44
+ loadBarUser(instance, product);
45
+ });
46
+
47
+ function getLogo() {
48
+ if (product === 'talk') {
49
+ return LogoTalk;
50
+ } else if (product === 'blogs') {
51
+ return LogoBlogs;
52
+ } else {
53
+ return LogoCore;
54
+ }
55
+ }
56
+
57
+ function getName() {
58
+ if (config.name) {
59
+ return config.name;
60
+ }
61
+ return (PRODUCTS as any)[product]?.name || 'HYVOR';
62
+ }
63
+
64
+ const LogoComponent = getLogo();
65
+ </script>
66
+
67
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
68
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
69
+ <div id="bar" onclick={handleBarClick} class:mobile-show={mobileShow}>
70
+ <div class="inner hds-box">
71
+ <div class="left">
72
+ <a class="logo" href="/">
73
+ <LogoComponent size={20} />
74
+ <span class="name">
75
+ {getName()}
76
+ </span>
77
+ </a>
78
+ </div>
79
+ <div class="right">
80
+ <div class="hidden-on-mobile">
81
+ <BarSupport config={configComplete} {product} mobile={mobileShow} />
82
+ <BarProducts mobile={mobileShow} />
83
+ <BarUpdates {instance} {product} />
84
+ </div>
85
+
86
+ <div class="mobile">
87
+ <IconCaretDownFill />
88
+ </div>
89
+
90
+ <BarUser {instance} />
91
+ </div>
92
+ </div>
93
+
94
+ {#if mobileShow}
95
+ <div class="mobile-layer"></div>
96
+ {/if}
97
+ </div>
98
+
99
+ <style>
100
+ #bar {
101
+ height: 50px;
102
+ padding: 0 15px;
103
+ z-index: 100;
104
+ }
105
+ .inner {
106
+ padding: 10px 29px;
107
+ display: flex;
108
+ align-items: center;
109
+ border-top-left-radius: 0;
110
+ border-top-right-radius: 0;
111
+ height: 100%;
112
+ }
113
+ .left {
114
+ display: flex;
115
+ align-items: center;
116
+ flex: 1;
117
+ }
118
+ .logo {
119
+ display: flex;
120
+ align-items: center;
121
+ text-decoration: none;
122
+ gap: 5px;
123
+ font-weight: 600;
124
+ }
125
+ .right {
126
+ display: flex;
127
+ align-items: center;
128
+ gap: 10px;
129
+ }
130
+ .hidden-on-mobile {
131
+ display: flex;
132
+ align-items: center;
133
+ gap: 10px;
134
+ }
135
+
136
+ .mobile {
137
+ display: none;
138
+ }
139
+
140
+ @media (max-width: 600px) {
141
+ .mobile {
142
+ display: block;
143
+ }
144
+ #bar {
145
+ cursor: pointer;
146
+ }
147
+ .hidden-on-mobile {
148
+ display: none;
149
+ animation: 0.2s slideIn;
150
+ }
151
+ #bar.mobile-show .hidden-on-mobile {
152
+ display: flex;
153
+ position: fixed;
154
+ top: 60px;
155
+ z-index: 100;
156
+ left: 15px;
157
+ right: 15px;
158
+ flex-direction: column;
159
+ }
160
+ .mobile-layer {
161
+ position: fixed;
162
+ top: 0;
163
+ left: 0;
164
+ right: 0;
165
+ bottom: 0;
166
+ background: rgba(0, 0, 0, 0.5);
167
+ z-index: 99;
168
+ backdrop-filter: blur(3px);
169
+ }
170
+ #bar.mobile-show :global(button.button) {
171
+ background-color: #fff;
172
+ }
173
+ }
174
+
175
+ @keyframes slideIn {
176
+ from {
177
+ transform: translateY(-20px);
178
+ }
179
+ to {
180
+ transform: translateY(0);
181
+ }
182
+ }
183
+ </style>
@@ -0,0 +1,8 @@
1
+ import { type BarConfig, type BarProduct } from './bar.js';
2
+ declare const HyvorBar: import("svelte").Component<{
3
+ instance?: string;
4
+ product: BarProduct;
5
+ config?: Partial<BarConfig>;
6
+ }, {}, "">;
7
+ type HyvorBar = ReturnType<typeof HyvorBar>;
8
+ export default HyvorBar;
@@ -0,0 +1,33 @@
1
+ export type BarProduct = 'core' | 'talk' | 'blogs';
2
+ export interface BarConfig {
3
+ name: string | null;
4
+ docs: boolean;
5
+ chat: boolean;
6
+ twitter: string | null;
7
+ g2: string | null;
8
+ }
9
+ interface BarUser {
10
+ name: string | null;
11
+ username: string;
12
+ email: string;
13
+ picture_url: string;
14
+ }
15
+ export interface BarUpdate {
16
+ id: number;
17
+ created_at: number;
18
+ type: BarUpdateType;
19
+ title: string;
20
+ content: string;
21
+ url?: string;
22
+ }
23
+ export type BarUpdateType = 'company' | 'core' | 'talk' | 'blogs' | 'fortguard';
24
+ export declare const barUser: import("svelte/store").Writable<BarUser | null>;
25
+ export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
26
+ export declare function loadBarUser(instance: string, product: BarProduct): void;
27
+ export declare class UnreadUpdatesTimeLocalStorage {
28
+ static KEY: string;
29
+ static get(): number | null;
30
+ static set(value: string): void;
31
+ static setNow(): void;
32
+ }
33
+ export {};
@@ -0,0 +1,74 @@
1
+ import { writable } from 'svelte/store';
2
+ export const barUser = writable(null);
3
+ export const barUnreadUpdates = writable(0);
4
+ export function loadBarUser(instance, product) {
5
+ const query = new URLSearchParams();
6
+ query.set('product', product);
7
+ const lastUnreadTime = UnreadUpdatesTimeLocalStorage.get();
8
+ if (lastUnreadTime) {
9
+ query.set('last_read_updates_at', lastUnreadTime.toString());
10
+ }
11
+ fetch(instance + '/api/public/bar?' + query.toString(), {
12
+ credentials: 'include'
13
+ })
14
+ .then((response) => response.json())
15
+ .then((data) => {
16
+ barUser.set(data.user);
17
+ barUnreadUpdates.set(data.updates.unread);
18
+ if (lastUnreadTime === null) {
19
+ UnreadUpdatesTimeLocalStorage.setNow();
20
+ }
21
+ })
22
+ .catch((error) => {
23
+ console.error('Error:', error);
24
+ });
25
+ }
26
+ export class UnreadUpdatesTimeLocalStorage {
27
+ static KEY = 'unread_updates';
28
+ static get() {
29
+ const val = BarLocalStorage.get(UnreadUpdatesTimeLocalStorage.KEY);
30
+ if (val) {
31
+ return Number(val);
32
+ }
33
+ return null;
34
+ }
35
+ static set(value) {
36
+ BarLocalStorage.set(UnreadUpdatesTimeLocalStorage.KEY, value);
37
+ }
38
+ static setNow() {
39
+ UnreadUpdatesTimeLocalStorage.set(Math.floor(Date.now() / 1000).toString());
40
+ }
41
+ }
42
+ class BarLocalStorage {
43
+ static KEY = 'hyvor_bar';
44
+ static getJson() {
45
+ try {
46
+ const data = localStorage.getItem(BarLocalStorage.KEY);
47
+ if (data) {
48
+ return JSON.parse(data);
49
+ }
50
+ }
51
+ catch (e) {
52
+ console.error(e);
53
+ return null;
54
+ }
55
+ return null;
56
+ }
57
+ static get(key) {
58
+ const data = BarLocalStorage.getJson();
59
+ if (data) {
60
+ return data[key];
61
+ }
62
+ return null;
63
+ }
64
+ static set(key, value) {
65
+ try {
66
+ const data = BarLocalStorage.getJson() || {};
67
+ data[key] = value;
68
+ localStorage.setItem(BarLocalStorage.KEY, JSON.stringify(data));
69
+ }
70
+ catch (e) {
71
+ console.error(e);
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,9 @@
1
+ <svg height="12" viewBox="-36.72 -19.24 748.01 780.17" width="12" xmlns="http://www.w3.org/2000/svg"
2
+ ><g fill="#000"
3
+ ><path
4
+ d="m501.22 521c26.9 46.68 53.5 92.83 80.08 138.93-117.7 90.11-300.82 101-436.38-2.77-156-119.51-181.64-323.43-98.12-470.22 96.06-168.84 275.82-206.18 391.56-178.8-3.13 6.8-72.45 150.61-72.45 150.61s-5.48.36-8.58.42c-34.21 1.45-59.69 9.41-87 23.53a206.93 206.93 0 0 0 -109.84 159.76 201.71 201.71 0 0 0 13.68 100.29c11 26.82 26.56 50.64 47.42 70.75 32 30.88 70.08 50 114.22 56.33 41.8 6 82 .06 119.67-18.87 14.13-7.09 26.15-14.92 40.2-25.66 1.79-1.16 3.38-2.63 5.54-4.3z"
5
+ /><path
6
+ d="m501.48 111.61c-6.83-6.72-13.16-12.92-19.46-19.16-3.76-3.72-7.38-7.59-11.23-11.22-1.38-1.31-3-3.1-3-3.1s1.31-2.78 1.87-3.92c7.37-14.79 18.92-25.6 32.62-34.2a90.65 90.65 0 0 1 50.72-14.01c22.93.45 44.25 6.16 62.24 21.54 13.28 11.35 20.09 25.75 21.29 42.94 2 29-10 51.21-33.83 66.71-14 9.12-29.1 16.17-44.24 24.52-8.35 4.61-15.49 8.66-23.65 17-7.18 8.37-7.53 16.26-7.53 16.26l108.47-.14v48.31h-167.43v-4.67c-.64-23.74 2.13-46.08 13-67.64 10-19.78 25.54-34.26 44.21-45.41 14.38-8.59 29.52-15.9 43.93-24.45 8.89-5.27 15.17-13 15.12-24.21 0-9.62-7-18.17-17-20.84-23.58-6.36-47.58 3.79-60.06 25.37-1.82 3.15-3.68 6.28-6.04 10.32zm209.81 358.04-91.41-157.86h-180.89l-92 159.49h182.22l89.92 157.11z"
7
+ /></g
8
+ ></svg
9
+ >
@@ -0,0 +1,26 @@
1
+ export default G2;
2
+ type G2 = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const G2: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,11 @@
1
+ <svg
2
+ fill="#000000"
3
+ width="12"
4
+ height="12"
5
+ viewBox="0 0 24 24"
6
+ role="img"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ ><path
9
+ d="M12,17.964l5.214-1.321l2.179,6.714L12,17.964z M24,9.286h-9.179L12,0.643L9.179,9.286 H0l7.429,5.357l-2.821,8.643l7.429-5.357l4.571-3.286L24,9.286L24,9.286L24,9.286L24,9.286z"
10
+ />
11
+ </svg>
@@ -0,0 +1,26 @@
1
+ export default Trustpilot;
2
+ type Trustpilot = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Trustpilot: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }