@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
@@ -1,14 +1,21 @@
1
1
  <script lang="ts">
2
- interface Props {
2
+ import { legacyHandlers } from '../../legacy.js';
3
+ import type { Snippet } from 'svelte';
4
+ import type { HTMLInputAttributes } from 'svelte/elements';
5
+ import { createBubbler } from 'svelte/legacy';
6
+
7
+ const bubble = createBubbler();
8
+
9
+ interface Props extends HTMLInputAttributes {
3
10
  state?: 'default' | 'error' | 'success' | 'warning';
4
- size?: 'small' | 'medium' | 'large' | 'x-small';
11
+ size?: 'small' | 'medium' | 'large' | 'x-small' | any;
5
12
  block?: boolean;
6
13
  value?: any;
7
14
  input?: HTMLInputElement;
8
15
  start?: import('svelte').Snippet;
9
16
  end?: import('svelte').Snippet;
10
- select?: boolean;
11
17
  selectInput?: HTMLSelectElement;
18
+ children?: Snippet;
12
19
  [key: string]: any;
13
20
 
14
21
  onkeyup?: (event: KeyboardEvent) => void;
@@ -32,8 +39,8 @@
32
39
  input = $bindable(),
33
40
  start,
34
41
  end,
35
- select = false,
36
42
  selectInput = $bindable({} as HTMLSelectElement),
43
+ children,
37
44
 
38
45
  onkeyup,
39
46
  onkeydown,
@@ -45,9 +52,7 @@
45
52
  onmouseenter,
46
53
  onmouseleave,
47
54
  onchange,
48
- oninput,
49
-
50
- ...rest
55
+ oninput
51
56
  }: Props = $props();
52
57
  </script>
53
58
 
@@ -58,43 +63,21 @@
58
63
  </span>
59
64
  {/if}
60
65
 
61
- {#if select}
62
- <select
63
- {...rest}
64
- bind:value
65
- bind:this={selectInput}
66
- {onkeyup}
67
- {onkeydown}
68
- {onkeypress}
69
- {onfocus}
70
- {onblur}
71
- {onclick}
72
- {onmouseover}
73
- {onmouseenter}
74
- {onmouseleave}
75
- {onchange}
76
- {oninput}
77
- >
78
- {@render rest?.children()}
79
- </select>
80
- {:else}
81
- <input
82
- {...rest}
83
- bind:value
84
- bind:this={input}
85
- {onkeyup}
86
- {onkeydown}
87
- {onkeypress}
88
- {onfocus}
89
- {onblur}
90
- {onclick}
91
- {onmouseover}
92
- {onmouseenter}
93
- {onmouseleave}
94
- {onchange}
95
- {oninput}
96
- />
97
- {/if}
66
+ <input
67
+ bind:value
68
+ bind:this={input}
69
+ onkeyup={legacyHandlers(onkeyup, bubble('keyup'))}
70
+ onkeydown={legacyHandlers(onkeydown, bubble('keydown'))}
71
+ onkeypress={legacyHandlers(onkeypress, bubble('keypress'))}
72
+ onfocus={legacyHandlers(onfocus, bubble('focus'))}
73
+ onblur={legacyHandlers(onblur, bubble('blur'))}
74
+ onclick={legacyHandlers(onclick, bubble('click'))}
75
+ onmouseover={legacyHandlers(onmouseover, bubble('mouseover'))}
76
+ onmouseenter={legacyHandlers(onmouseenter, bubble('mouseenter'))}
77
+ onmouseleave={legacyHandlers(onmouseleave, bubble('mouseleave'))}
78
+ onchange={legacyHandlers(onchange, bubble('change'))}
79
+ oninput={legacyHandlers(oninput, bubble('input'))}
80
+ />
98
81
 
99
82
  {#if end}
100
83
  <span class="slot end">
@@ -136,8 +119,7 @@
136
119
  width: 100%;
137
120
  }
138
121
 
139
- input,
140
- select {
122
+ input {
141
123
  flex: 1;
142
124
  width: 100%;
143
125
  border: none;
@@ -149,15 +131,10 @@ select {
149
131
  color: inherit;
150
132
  height: 100%;
151
133
  }
152
- input:focus,
153
- select:focus {
134
+ input:focus {
154
135
  outline: none;
155
136
  }
156
137
 
157
- select {
158
- min-width: 180px;
159
- }
160
-
161
138
  .input-wrap.size-x-small {
162
139
  padding: 0 15px;
163
140
  height: 20px;
@@ -1,13 +1,15 @@
1
- interface Props {
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ interface Props extends HTMLInputAttributes {
2
4
  state?: 'default' | 'error' | 'success' | 'warning';
3
- size?: 'small' | 'medium' | 'large' | 'x-small';
5
+ size?: 'small' | 'medium' | 'large' | 'x-small' | any;
4
6
  block?: boolean;
5
7
  value?: any;
6
8
  input?: HTMLInputElement;
7
9
  start?: import('svelte').Snippet;
8
10
  end?: import('svelte').Snippet;
9
- select?: boolean;
10
11
  selectInput?: HTMLSelectElement;
12
+ children?: Snippet;
11
13
  [key: string]: any;
12
14
  onkeyup?: (event: KeyboardEvent) => void;
13
15
  onkeydown?: (event: KeyboardEvent) => void;
@@ -28,18 +28,7 @@
28
28
  }: Props = $props();
29
29
  </script>
30
30
 
31
- <span
32
- class="input-wrap state-{state}"
33
- class:block
34
- onclick={() => textarea.focus()}
35
- onkeydown={(e) => {
36
- if (e.key === 'Enter') {
37
- textarea.focus();
38
- }
39
- }}
40
- role="textbox"
41
- tabindex="0"
42
- >
31
+ <div class="textarea-container" class:block>
43
32
  {#if start}
44
33
  <span class="slot start">
45
34
  {@render start?.()}
@@ -60,6 +49,7 @@
60
49
  onmouseleave={bubble('mouseleave')}
61
50
  onchange={bubble('change')}
62
51
  oninput={bubble('input')}
52
+ class="state-{state}"
63
53
  {rows}
64
54
  {cols}
65
55
  {...rest}
@@ -70,89 +60,85 @@
70
60
  {@render end?.()}
71
61
  </span>
72
62
  {/if}
73
- </span>
74
-
75
- <style>.input-wrap {
76
- padding: 10px 15px;
77
- background-color: var(--input);
78
- transition: 0.2s box-shadow;
79
- font-family: inherit;
80
- font-size: 14px;
81
- border-radius: 20px;
82
- border: none;
83
- transition: 0.2s box-shadow;
84
- max-width: 100%;
85
- color: inherit;
86
- display: inline-flex;
87
- resize: vertical;
88
- overflow: auto;
89
- align-items: flex-start;
90
- justify-content: center;
91
- }
92
- .input-wrap:focus-within {
93
- outline: 0;
94
- box-shadow: 0 0 0 var(--local-shadow-size) var(--accent-light);
95
- }
96
- .input-wrap {
97
- --local-shadow-size: 2px;
98
- }
99
-
100
- .input-wrap.block {
101
- display: block;
102
- width: 100%;
103
- resize: vertical;
104
- }
105
-
106
- .input-wrap:focus-visible {
107
- outline: 0;
108
- }
109
-
110
- .input-wrap.state-error {
111
- box-shadow: 0 0 0 var(--local-shadow-size) var(--red-light);
112
- }
113
- .input-wrap.state-error:focus-within {
114
- box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--red-light);
115
- }
116
-
117
- .input-wrap.state-success {
118
- box-shadow: 0 0 0 2px var(--green-light);
119
- }
120
- .input-wrap.state-success:focus-within {
121
- box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--green-light);
122
- }
123
-
124
- .input-wrap.state-warning {
125
- box-shadow: 0 0 0 2px var(--orange-light);
126
- }
127
- .input-wrap.state-warning:focus-within {
128
- box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--orange-light);
129
- }
130
-
131
- .input-wrap .slot {
132
- padding: 0 10px;
133
- }
134
-
135
- .input-wrap .slot.start {
136
- margin-right: 10px;
137
- }
138
-
139
- .input-wrap .slot.end {
140
- margin-left: 10px;
141
- }
142
-
143
- .input-wrap textarea {
144
- flex: 1;
145
- width: 100%;
146
- border: none;
147
- font-family: inherit;
148
- font-size: inherit;
149
- background: transparent;
150
- padding: 0;
151
- margin: 0;
152
- }
153
- .input-wrap textarea:focus {
154
- outline: none;
155
- }
156
- .input-wrap textarea {
157
- resize: none;
158
- }</style>
63
+ </div>
64
+
65
+ <style>
66
+ .textarea-container {
67
+ position: relative;
68
+ display: inline-block;
69
+ max-width: 100%;
70
+
71
+ &.block {
72
+ display: block;
73
+ width: 100%;
74
+ }
75
+ }
76
+
77
+ textarea {
78
+ padding: 10px 15px;
79
+ background-color: var(--input);
80
+ font-family: inherit;
81
+ font-size: 14px;
82
+ border-radius: 20px;
83
+ border-bottom-right-radius: 0;
84
+ border: none;
85
+ transition: 0.2s box-shadow;
86
+ width: 100%;
87
+ color: inherit;
88
+ resize: vertical;
89
+ box-sizing: border-box;
90
+
91
+ &:focus {
92
+ outline: 0;
93
+ box-shadow: 0 0 0 var(--local-shadow-size) var(--accent-light);
94
+ }
95
+
96
+ --local-shadow-size: 2px;
97
+
98
+ &.state-error {
99
+ box-shadow: 0 0 0 var(--local-shadow-size) var(--red-light);
100
+ &:focus {
101
+ box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--red-light);
102
+ }
103
+ }
104
+
105
+ &.state-success {
106
+ box-shadow: 0 0 0 2px var(--green-light);
107
+ &:focus {
108
+ box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--green-light);
109
+ }
110
+ }
111
+
112
+ &.state-warning {
113
+ box-shadow: 0 0 0 2px var(--orange-light);
114
+ &:focus {
115
+ box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--orange-light);
116
+ }
117
+ }
118
+ }
119
+
120
+ .start ~ textarea {
121
+ padding-left: 45px;
122
+ }
123
+
124
+ .end ~ textarea {
125
+ padding-right: 45px;
126
+ }
127
+
128
+ .slot {
129
+ position: absolute;
130
+ top: 10px;
131
+ pointer-events: none;
132
+ display: flex;
133
+ align-items: center;
134
+ z-index: 1;
135
+
136
+ &.start {
137
+ left: 15px;
138
+ }
139
+
140
+ &.end {
141
+ right: 15px;
142
+ }
143
+ }
144
+ </style>
package/dist/index.css CHANGED
@@ -51,10 +51,10 @@ a {
51
51
  }
52
52
 
53
53
  .hds-container-max {
54
- width: 1400px;
55
- max-width: 100%;
56
- padding: 0 15px;
57
- margin: auto;
54
+ width: 1400px;
55
+ max-width: 100%;
56
+ padding: 0 15px;
57
+ margin: auto;
58
58
  }
59
59
 
60
60
  .hds-link {
package/dist/legacy.js CHANGED
@@ -1,8 +1,8 @@
1
- import { handlers } from "svelte/legacy";
1
+ import { handlers } from 'svelte/legacy';
2
2
  /**
3
3
  * Extends svelte4 handlers to support undefined
4
4
  */
5
5
  export function legacyHandlers(...eventHandlers) {
6
- const all = eventHandlers.filter(h => h !== undefined);
6
+ const all = eventHandlers.filter((h) => h !== undefined);
7
7
  return handlers(...all);
8
8
  }
@@ -1,23 +1,23 @@
1
1
  <script lang="ts">
2
2
  import Link from '../../components/Link/Link.svelte';
3
3
  import Modal from '../../components/Modal/Modal.svelte';
4
- import { replaceState } from '$app/navigation';
5
- import { onMount } from 'svelte';
4
+ import { replaceState } from '$app/navigation';
5
+ import { onMount } from 'svelte';
6
6
 
7
- let partner: string | null = $state(null);
8
- let showModal = $state(false);
7
+ let partner: string | null = $state(null);
8
+ let showModal = $state(false);
9
9
 
10
- onMount(() => {
11
- const params = new URLSearchParams(window.location.search);
12
- partner = params.get('partner');
10
+ onMount(() => {
11
+ const params = new URLSearchParams(window.location.search);
12
+ partner = params.get('partner');
13
13
 
14
- if (partner) {
15
- showModal = true;
16
- }
17
- });
14
+ if (partner) {
15
+ showModal = true;
16
+ }
17
+ });
18
18
 
19
- function handleConsent() {
20
- const coreUrl = `${location.protocol}//${location.hostname.split('.').slice(-2).join('.')}`;
19
+ function handleConsent() {
20
+ const coreUrl = `${location.protocol}//${location.hostname.split('.').slice(-2).join('.')}`;
21
21
 
22
22
  fetch(coreUrl + '/api/public/affiliate/placement', {
23
23
  method: 'POST',
@@ -29,47 +29,49 @@
29
29
  url: window.location.href
30
30
  }),
31
31
  credentials: 'include'
32
- }).then((response) => {
33
- if (response.ok) {
34
- console.info('Affiliate placement recorded for partner:', partner);
35
- }
36
- }).finally(() => {
37
- const url = new URL(window.location.href);
38
- url.searchParams.delete('partner');
39
- replaceState(url, {});
40
- showModal = false;
41
- });
42
- }
32
+ })
33
+ .then((response) => {
34
+ if (response.ok) {
35
+ console.info('Affiliate placement recorded for partner:', partner);
36
+ }
37
+ })
38
+ .finally(() => {
39
+ const url = new URL(window.location.href);
40
+ url.searchParams.delete('partner');
41
+ replaceState(url, {});
42
+ showModal = false;
43
+ });
44
+ }
43
45
  </script>
44
46
 
45
47
  <Modal
46
- title="Referred by {partner}"
47
- bind:show={showModal}
48
- closeOnOutsideClick={false}
49
- footer={
50
- {
51
- cancel: {
52
- text: "Do not track"
53
- },
54
- confirm: {
55
- text: "Ok, Visit Site",
56
- }
57
- }
58
- }
59
- on:confirm={handleConsent}
60
- >
61
- <div class="notice">
62
- You visited our site through our affiliate partner <strong>{partner}</strong>. To track this referral, we will place a small
63
- cookie in your browser. This cookie helps us identify which affiliate partner referred you
64
- if you sign up. It does not collect any personal data.
65
- </div>
66
- <p>
67
- You can read more in our <Link href="https://hyvor.com/privacy" target="_blank">Privacy Policy</Link>.
68
- </p>
48
+ title="Referred by {partner}"
49
+ bind:show={showModal}
50
+ closeOnOutsideClick={false}
51
+ footer={{
52
+ cancel: {
53
+ text: 'Do not track'
54
+ },
55
+ confirm: {
56
+ text: 'Ok, Visit Site'
57
+ }
58
+ }}
59
+ on:confirm={handleConsent}
60
+ >
61
+ <div class="notice">
62
+ You visited our site through our affiliate partner <strong>{partner}</strong>. To track this
63
+ referral, we will place a small cookie in your browser. This cookie helps us identify which
64
+ affiliate partner referred you if you sign up. It does not collect any personal data.
65
+ </div>
66
+ <p>
67
+ You can read more in our <Link href="https://hyvor.com/privacy" target="_blank"
68
+ >Privacy Policy</Link
69
+ >.
70
+ </p>
69
71
  </Modal>
70
72
 
71
73
  <style>
72
- .notice {
73
- line-height: 24px;
74
- }
75
- </style>
74
+ .notice {
75
+ line-height: 24px;
76
+ }
77
+ </style>
@@ -2,16 +2,15 @@
2
2
  interface Props {
3
3
  as?: string;
4
4
  children?: import('svelte').Snippet;
5
- max?: boolean;
5
+ max?: boolean;
6
6
  }
7
7
 
8
- let { as = 'div', children, max = false
9
- }: Props = $props();
8
+ let { as = 'div', children, max = false }: Props = $props();
10
9
 
11
- let width= max ? '1400px' : '1000px';
10
+ let width = max ? '1400px' : '1000px';
12
11
  </script>
13
12
 
14
- <svelte:element this={as} class="container" style:width={width}>
13
+ <svelte:element this={as} class="container" style:width>
15
14
  {@render children?.()}
16
15
  </svelte:element>
17
16
 
@@ -27,8 +27,7 @@
27
27
  }
28
28
 
29
29
  const category =
30
- (activeEl.closest('.nav-category')?.querySelector('.name') as HTMLElement)?.innerText ||
31
- null;
30
+ (activeEl.closest('.nav-category')?.querySelector('.name') as HTMLElement)?.innerText || null;
32
31
 
33
32
  active = {
34
33
  name: activeEl.innerText,
@@ -24,7 +24,7 @@
24
24
  center?: import('svelte').Snippet;
25
25
  affiliate?: boolean;
26
26
  recordVisit?: boolean;
27
- max?: boolean;
27
+ max?: boolean;
28
28
  }
29
29
 
30
30
  let {
@@ -33,7 +33,7 @@
33
33
  center,
34
34
  affiliate = true,
35
35
  recordVisit = true,
36
- max = false,
36
+ max = false
37
37
  }: Props = $props();
38
38
 
39
39
  social = {