@hyvor/design 2.0.0-beta.1 → 2.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 (54) hide show
  1. package/README.md +9 -0
  2. package/dist/cloud/HyvorBar/BarProducts/BarProducts.svelte +1 -4
  3. package/dist/cloud/HyvorBar/BarUpdatesList.svelte +1 -3
  4. package/dist/cloud/HyvorBar/HyvorBar.svelte +0 -2
  5. package/dist/cloud/HyvorBar/bar.d.ts +1 -1
  6. package/dist/cloud/OrganizationMembers/OrganizationMembersSearch.svelte +1 -4
  7. package/dist/cloud/ResourceCreator/Accordian.svelte +2 -4
  8. package/dist/components/Accordion/Accordion.svelte +134 -134
  9. package/dist/components/Button/Button.svelte +2 -12
  10. package/dist/components/CodeBlock/CodeBlock.svelte +45 -28
  11. package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +2 -3
  12. package/dist/components/CodeBlock/TabbedCodeBlock.svelte +60 -64
  13. package/dist/components/CodeBlock/TabbedCodeBlock.svelte.d.ts +1 -1
  14. package/dist/components/CodeBlock/getCode.d.ts +3 -1
  15. package/dist/components/CodeBlock/getCode.js +33 -50
  16. package/dist/components/ColorPicker/ColorPicker.svelte +1 -1
  17. package/dist/components/Dark/DarkProvider.svelte +1 -1
  18. package/dist/components/DetailCard/DetailCard.svelte +43 -46
  19. package/dist/components/DetailCard/DetailCard.svelte.d.ts +1 -1
  20. package/dist/components/DetailCard/DetailCards.svelte +13 -16
  21. package/dist/components/DetailCard/DetailCards.svelte.d.ts +1 -1
  22. package/dist/components/Dropdown/DropdownContent.svelte +1 -2
  23. package/dist/components/EmojiPicker/EmojiSelector.svelte +3 -14
  24. package/dist/components/EmojiPicker/emojidata.js +3 -3
  25. package/dist/components/FileUploader/Preview/Preview.svelte +1 -1
  26. package/dist/components/FileUploader/TabUpload/TabUpload.svelte +2 -4
  27. package/dist/components/FileUploader/file-uploader.js +5 -10
  28. package/dist/components/FileUploader/helpers.js +1 -1
  29. package/dist/components/IconButton/IconButton.svelte +2 -10
  30. package/dist/components/Internationalization/LanguageToggle.svelte +2 -2
  31. package/dist/components/Internationalization/T.svelte +2 -9
  32. package/dist/components/Internationalization/i18n.js +3 -1
  33. package/dist/components/Modal/Modal.svelte +16 -12
  34. package/dist/components/TextInput/TextInput.svelte +29 -52
  35. package/dist/components/TextInput/TextInput.svelte.d.ts +5 -3
  36. package/dist/components/Textarea/Textarea.svelte +84 -98
  37. package/dist/index.css +4 -4
  38. package/dist/legacy.js +2 -2
  39. package/dist/marketing/Affiliate/Affiliate.svelte +53 -51
  40. package/dist/marketing/Container/Container.svelte +4 -5
  41. package/dist/marketing/Docs/Nav/Nav.svelte +1 -2
  42. package/dist/marketing/Footer/Footer.svelte +2 -2
  43. package/dist/marketing/Header/Header.svelte +131 -140
  44. package/dist/marketing/Header/Header.svelte.d.ts +3 -1
  45. package/dist/marketing/Header/HeaderNotification.svelte +64 -0
  46. package/dist/marketing/Header/HeaderNotification.svelte.d.ts +7 -0
  47. package/dist/marketing/cloud.d.ts +1 -0
  48. package/dist/marketing/cloud.js +15 -0
  49. package/dist/marketing/track/track.d.ts +0 -1
  50. package/dist/marketing/track/track.js +3 -6
  51. package/dist/variables.scss +1 -1
  52. package/package.json +24 -22
  53. package/dist/components/CodeBlock/hljs.scss +0 -228
  54. package/dist/components/CodeBlock/prism.scss +0 -375
@@ -4,35 +4,46 @@
4
4
  import IconButton from '../../components/IconButton/IconButton.svelte';
5
5
  import Dropdown from '../../components/Dropdown/Dropdown.svelte';
6
6
  import IconList from '@hyvor/icons/IconList';
7
+ import HeaderNotification from './HeaderNotification.svelte';
7
8
 
8
9
  interface Props {
9
- logo: string;
10
+ product: string;
11
+ instance?: string;
12
+ logo?: string;
10
13
  name?: string;
11
14
  href?: string;
12
15
  subName?: undefined | string;
13
16
  darkToggle?: boolean;
14
17
  center?: import('svelte').Snippet;
15
18
  end?: import('svelte').Snippet;
16
- max?: boolean;
19
+ max?: boolean;
17
20
  }
18
21
 
19
22
  let {
23
+ product,
20
24
  logo,
25
+ instance = 'https://hyvor.com',
21
26
  name = 'HYVOR',
22
27
  href = '/',
23
28
  subName = undefined,
24
29
  darkToggle = true,
25
30
  center,
26
31
  end,
27
- max = false,
32
+ max = false
28
33
  }: Props = $props();
29
34
  </script>
30
35
 
31
36
  <header>
37
+ <HeaderNotification {instance} {product} />
32
38
  <Container as="nav" {max}>
33
39
  <div class="nav-start">
34
40
  <a class="nav-brand" {href}>
35
- <img src={logo} alt="Hyvor Logo" width="30" height="30" />
41
+ <img
42
+ src={logo || `${instance}/api/public/logo/${product}.svg`}
43
+ alt="{name + (subName ? ' ' + subName : '')} Logo"
44
+ width="30"
45
+ height="30"
46
+ />
36
47
  <span class="brand-product">
37
48
  <span class="brand">{name}</span>
38
49
  {#if subName}
@@ -56,25 +67,6 @@
56
67
  <DarkToggle />
57
68
  </span>
58
69
  {/if}
59
-
60
- <!-- <span class="mobile-nav-wrap">
61
- <Dropdown align="end" width={300}>
62
- <IconButton
63
- color="invisible"
64
- slot="trigger"
65
- >
66
- <IconList size={18} />
67
- </IconButton>
68
- <div slot="content" class="mobile-content">
69
- <div class="mobile-inner center">
70
- <slot name="center" />
71
- </div>
72
- <div class="mobile-inner end">
73
- <slot name="end" />
74
- </div>
75
- </div>
76
- </Dropdown>
77
- </span> -->
78
70
  </div>
79
71
 
80
72
  <span class="mobile-nav-wrap">
@@ -101,120 +93,119 @@
101
93
 
102
94
  <div class="header-space"></div>
103
95
 
104
- <style>.header-space {
105
- height: var(--header-height);
106
- }
107
-
108
- header {
109
- position: fixed;
110
- top: 0;
111
- left: 0;
112
- width: 100%;
113
- z-index: 100;
114
- background-color: var(--background, var(--accent-lightest));
115
- border-bottom: 1px solid var(--border);
116
- height: var(--header-height);
117
- display: flex;
118
- align-items: center;
119
- }
120
-
121
- header :global(nav) {
122
- display: flex;
123
- align-items: center;
124
- }
125
-
126
- .nav-brand {
127
- display: inline-block;
128
- line-height: inherit;
129
- white-space: nowrap;
130
- color: inherit;
131
- text-decoration: none;
132
- font-weight: 600;
133
- }
134
-
135
- .nav-brand img {
136
- vertical-align: middle;
137
- }
138
-
139
- .brand-product {
140
- vertical-align: middle;
141
- display: inline-flex;
142
- flex-direction: column;
143
- justify-content: center;
144
- line-height: 14px;
145
- }
146
-
147
- .brand-product .brand {
148
- font-size: 14px;
149
- }
150
-
151
- .brand-product .product {
152
- font-size: 12px;
153
- font-weight: normal;
154
- color: var(--text-light);
155
- }
156
-
157
- .nav-center {
158
- flex: 1;
159
- display: flex;
160
- align-items: center;
161
- gap: 6px;
162
- justify-content: center;
163
- }
164
-
165
- .nav-end {
166
- display: flex;
167
- align-items: center;
168
- gap: 6px;
169
- }
170
-
171
- .mobile-nav-wrap {
172
- display: none;
173
- }
174
-
175
- .dark-mobile {
176
- display: inline-flex;
177
- align-items: center;
178
- }
179
-
180
- .dark-toggle-wrap {
181
- margin-left: 8px;
182
- }
183
-
184
- @media screen and (max-width: 992px) {
185
- .nav-center {
186
- display: none;
187
- }
188
- .nav-end {
189
- display: none;
190
- }
191
- .mobile-nav-wrap {
192
- display: inline-block;
193
- }
194
- .dark-mobile {
195
- flex: 1;
196
- text-align: right;
197
- display: inline-block;
198
- }
199
- }
200
- .mobile-content,
201
- .mobile-inner {
202
- display: flex;
203
- flex-direction: column;
204
- }
205
-
206
- .mobile-content {
207
- gap: 10px;
208
- }
209
-
210
- .mobile-content :global(.button) {
211
- display: flex;
212
- }
213
-
214
- /*
215
- Scroll padding top is used to prevent the content from being hidden behind the header
216
- https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-padding-top
217
- */
218
- :global(html) {
219
- scroll-padding-top: calc(var(--header-height) + 20px);
220
- }</style>
96
+ <style>
97
+ .header-space {
98
+ height: var(--header-height);
99
+ }
100
+
101
+ header {
102
+ position: fixed;
103
+ top: 0;
104
+ left: 0;
105
+ width: 100%;
106
+ z-index: 100;
107
+ background-color: var(--background, var(--accent-lightest));
108
+ border-bottom: 1px solid var(--border);
109
+ height: var(--header-height);
110
+ display: flex;
111
+ flex-direction: column;
112
+ }
113
+
114
+ header :global(> nav) {
115
+ display: flex;
116
+ align-items: center;
117
+ flex: 1;
118
+ }
119
+ .nav-brand {
120
+ display: inline-block;
121
+ line-height: inherit;
122
+ white-space: nowrap;
123
+ color: inherit;
124
+ text-decoration: none;
125
+ font-weight: 600;
126
+ }
127
+ .nav-brand img {
128
+ vertical-align: middle;
129
+ }
130
+
131
+ .brand-product {
132
+ vertical-align: middle;
133
+ display: inline-flex;
134
+ flex-direction: column;
135
+ justify-content: center;
136
+ line-height: 14px;
137
+ }
138
+ .brand-product .brand {
139
+ font-size: 14px;
140
+ }
141
+ .brand-product .product {
142
+ font-size: 12px;
143
+ font-weight: normal;
144
+ color: var(--text-light);
145
+ }
146
+
147
+ .nav-center {
148
+ flex: 1;
149
+ display: flex;
150
+ align-items: center;
151
+ gap: 6px;
152
+ justify-content: center;
153
+ }
154
+
155
+ .nav-end {
156
+ display: flex;
157
+ align-items: center;
158
+ gap: 6px;
159
+ }
160
+
161
+ .mobile-nav-wrap {
162
+ display: none;
163
+ }
164
+
165
+ .dark-mobile {
166
+ display: inline-flex;
167
+ align-items: center;
168
+ }
169
+
170
+ .dark-toggle-wrap {
171
+ margin-left: 8px;
172
+ }
173
+
174
+ @media screen and (max-width: 992px) {
175
+ .nav-center {
176
+ display: none;
177
+ }
178
+ .nav-end {
179
+ display: none;
180
+ }
181
+ .mobile-nav-wrap {
182
+ display: inline-block;
183
+ }
184
+ .dark-mobile {
185
+ flex: 1;
186
+ text-align: right;
187
+ display: inline-block;
188
+ }
189
+ }
190
+
191
+ .mobile-content,
192
+ .mobile-inner {
193
+ display: flex;
194
+ flex-direction: column;
195
+ }
196
+ .mobile-content {
197
+ gap: 10px;
198
+ }
199
+
200
+ .mobile-content :global(.button) {
201
+ display: flex;
202
+ }
203
+
204
+ /*
205
+ Scroll padding top is used to prevent the content from being hidden behind the header
206
+ https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-padding-top
207
+ */
208
+ :global(html) {
209
+ scroll-padding-top: calc(var(--header-height) + 20px);
210
+ }
211
+ </style>
@@ -1,5 +1,7 @@
1
1
  interface Props {
2
- logo: string;
2
+ product: string;
3
+ instance?: string;
4
+ logo?: string;
3
5
  name?: string;
4
6
  href?: string;
5
7
  subName?: undefined | string;
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import { onMount } from 'svelte';
3
+ import { slide } from 'svelte/transition';
4
+ import { isCloud } from '../cloud.js';
5
+ import IconMegaphone from '@hyvor/icons/IconMegaphone';
6
+ import type { BarUpdate } from '../../cloud/HyvorBar/bar.js';
7
+
8
+ let notificationUpdate: BarUpdate | null = $state(null);
9
+
10
+ interface Props {
11
+ instance: string;
12
+ product: string;
13
+ }
14
+
15
+ let { instance, product }: Props = $props();
16
+
17
+ function set(u: BarUpdate) {
18
+ notificationUpdate = u;
19
+ document.documentElement.style.setProperty('--header-height', '85px');
20
+ }
21
+
22
+ onMount(() => {
23
+ if (!isCloud(false)) return;
24
+
25
+ fetch(instance + '/api/public/updates/notification?type=' + product)
26
+ .then((response) => response.json())
27
+ .then((data) => {
28
+ if (data.update) {
29
+ set(data.update);
30
+ }
31
+ });
32
+ });
33
+ </script>
34
+
35
+ {#if notificationUpdate}
36
+ <a
37
+ class="header-notification"
38
+ href={notificationUpdate.url}
39
+ target="_blank"
40
+ transition:slide={{ duration: 300 }}
41
+ >
42
+ <IconMegaphone size={12} />&nbsp;&nbsp;
43
+ {notificationUpdate.title}&nbsp;&nbsp;&rarr;
44
+ </a>
45
+ {/if}
46
+
47
+ <style>
48
+ .header-notification {
49
+ display: block;
50
+ background-color: var(--accent);
51
+ color: var(--accent-text);
52
+ height: 30px;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ font-size: 14px;
57
+ cursor: pointer;
58
+ font-weight: 600;
59
+ transition: opacity 0.2s;
60
+ }
61
+ .header-notification:hover {
62
+ opacity: 0.8;
63
+ }
64
+ </style>
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ instance: string;
3
+ product: string;
4
+ }
5
+ declare const HeaderNotification: import("svelte").Component<Props, {}, "">;
6
+ type HeaderNotification = ReturnType<typeof HeaderNotification>;
7
+ export default HeaderNotification;
@@ -0,0 +1 @@
1
+ export declare function isCloud(forceProd?: boolean): boolean;
@@ -0,0 +1,15 @@
1
+ export function isCloud(forceProd = true) {
2
+ if (typeof window === 'undefined') {
3
+ return false;
4
+ }
5
+ const hostname = window.location.hostname;
6
+ function isDomain(domain) {
7
+ return hostname === domain || hostname.endsWith(`.${domain}`);
8
+ }
9
+ let domains = ['hyvor.com'];
10
+ if (forceProd === false) {
11
+ domains.push('hyvor.localhost');
12
+ domains.push('hyvorstaging.com');
13
+ }
14
+ return domains.some(isDomain);
15
+ }
@@ -6,7 +6,6 @@ interface InitOptions {
6
6
  }
7
7
  declare class Track {
8
8
  private op;
9
- private isProductionDomain;
10
9
  init({ forceTrack, openPanelApiUrl, openPanelClientId, context }?: InitOptions): void;
11
10
  ready(): boolean;
12
11
  private warnNoOp;
@@ -1,12 +1,9 @@
1
1
  import { OpenPanel } from '@openpanel/web';
2
+ import { isCloud } from '../cloud.js';
2
3
  class Track {
3
4
  op;
4
- isProductionDomain() {
5
- const hostname = window.location.hostname;
6
- return hostname === 'hyvor.com' || hostname.endsWith('.hyvor.com');
7
- }
8
5
  init({ forceTrack = false, openPanelApiUrl = 'https://op.hyvor.com/api', openPanelClientId = 'b11f6143-a6b0-4fa4-a86c-3969c01dbb1d', context = {} } = {}) {
9
- if (!forceTrack && !this.isProductionDomain()) {
6
+ if (!forceTrack && !isCloud()) {
10
7
  console.log('Tracking is disabled in non-production domains.');
11
8
  return;
12
9
  }
@@ -15,7 +12,7 @@ class Track {
15
12
  clientId: openPanelClientId,
16
13
  trackScreenViews: true,
17
14
  trackOutgoingLinks: true,
18
- trackAttributes: true,
15
+ trackAttributes: true
19
16
  });
20
17
  if (Object.keys(context).length > 0) {
21
18
  this.op.setGlobalProperties(context);
@@ -8,7 +8,7 @@
8
8
  --accent: #000;
9
9
  --accent-light: #bdbdbd;
10
10
  --accent-lightest: #fafafa;
11
- --accent-light-mid: #818181;
11
+ --accent-light-mid: #818181;
12
12
  --accent-text: #fff;
13
13
 
14
14
  --border: #e1e1e1;
package/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
+ "version": "2.0.0",
3
4
  "license": "MIT",
4
5
  "private": false,
5
6
  "repository": {
@@ -16,7 +17,8 @@
16
17
  "prepublishOnly": "npm run package",
17
18
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
18
19
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
19
- "check:prettier": "prettier --check ."
20
+ "check:prettier": "prettier --check .",
21
+ "format": "prettier --write ."
20
22
  },
21
23
  "exports": {
22
24
  "./components": {
@@ -43,32 +45,32 @@
43
45
  "svelte": "^5.0.0"
44
46
  },
45
47
  "devDependencies": {
46
- "@sveltejs/adapter-static": "^3.0.0",
47
- "@sveltejs/package": "^2.3.7",
48
- "@sveltejs/vite-plugin-svelte": "^6.2.1",
49
- "prettier": "3.4.2",
50
- "prettier-plugin-svelte": "3.3.3",
51
- "publint": "^0.1.9",
52
- "svelte": "^5.0.0",
53
- "svelte-check": "^4.0.0",
54
- "tslib": "^2.4.1",
55
- "typescript": "^5.5.0",
56
- "vite": "^7.2"
48
+ "@sveltejs/adapter-static": "^3.0.10",
49
+ "@sveltejs/package": "^2.5.7",
50
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
51
+ "prettier": "3.8.1",
52
+ "prettier-plugin-svelte": "3.4.1",
53
+ "publint": "^0.3.17",
54
+ "svelte": "^5.49.1",
55
+ "svelte-check": "^4.3.6",
56
+ "tslib": "^2.8.1",
57
+ "typescript": "^5.9.3",
58
+ "vite": "^7.3"
57
59
  },
58
60
  "dependencies": {
59
- "@fontsource/readex-pro": "^5.0.8",
61
+ "@fontsource/readex-pro": "^5.2.11",
60
62
  "@hyvor/icons": "^1.1.1",
61
- "@openpanel/sdk": "^1.0.0",
62
- "@openpanel/web": "^1.0.1",
63
- "deepmerge-ts": "^5.1.0",
64
- "emojibase-data": "^16.0.3",
65
- "intl-messageformat": "^10.5.11",
66
- "svelte-awesome-color-picker": "^3.0.4",
67
- "tocbot": "^4.25.0"
63
+ "@openpanel/sdk": "^1.0.4",
64
+ "@openpanel/web": "^1.0.7",
65
+ "deepmerge-ts": "^7.1.5",
66
+ "emojibase-data": "^17.0.0",
67
+ "intl-messageformat": "^11.1.2",
68
+ "shiki": "^3.22.0",
69
+ "svelte-awesome-color-picker": "^4.1.1",
70
+ "tocbot": "^4.36.4"
68
71
  },
69
72
  "type": "module",
70
73
  "publishConfig": {
71
74
  "access": "public"
72
- },
73
- "version": "2.0.0-beta.1"
75
+ }
74
76
  }