@hyvor/design 1.0.9 → 1.0.11

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.
@@ -250,7 +250,11 @@
250
250
  background-color: var(--orange-light);
251
251
  color: var(--orange-dark);
252
252
  transition: 0.2s box-shadow;
253
- --local-hover-shadow-color: color-mix(in srgb, var(--orange-light) 40%, transparent);
253
+ --local-hover-shadow-color: color-mix(
254
+ in srgb,
255
+ var(--orange-light) 40%,
256
+ transparent
257
+ );
254
258
  }
255
259
  .button.outline {
256
260
  border: 1px solid;
@@ -305,7 +309,11 @@
305
309
  border-color: var(--accent);
306
310
  color: var(--accent);
307
311
  transition: 0.2s box-shadow;
308
- --local-hover-shadow-color: color-mix(in srgb, var(--accent-light) 40%, transparent);
312
+ --local-hover-shadow-color: color-mix(
313
+ in srgb,
314
+ var(--accent-light) 40%,
315
+ transparent
316
+ );
309
317
  }
310
318
  .button.outline-fill.gray {
311
319
  background-color: var(--gray-light);
@@ -1,11 +1,12 @@
1
- declare const Checkbox: import("svelte").Component<{
2
- [key: string]: any;
1
+ interface Props {
3
2
  checked?: boolean | undefined;
4
3
  group?: (number | string)[];
5
4
  value?: string | number;
6
5
  disabled?: boolean;
7
6
  input?: HTMLInputElement;
8
- children?: import("svelte").Snippet;
9
- }, {}, "checked" | "group" | "input">;
7
+ children?: import('svelte').Snippet;
8
+ [key: string]: any;
9
+ }
10
+ declare const Checkbox: import("svelte").Component<Props, {}, "checked" | "group" | "input">;
10
11
  type Checkbox = ReturnType<typeof Checkbox>;
11
12
  export default Checkbox;
@@ -67,7 +67,8 @@
67
67
  }
68
68
  } else if (align === 'center') {
69
69
  contentWrap.style.left =
70
- Math.max(triggerRect.left + triggerRect.width / 2 - width / 2, SPACE_AROUND) + 'px';
70
+ Math.max(triggerRect.left + triggerRect.width / 2 - width / 2, SPACE_AROUND) +
71
+ 'px';
71
72
  } else if (align === 'end') {
72
73
  contentWrap.style.left = Math.max(triggerRect.right - width, SPACE_AROUND) + 'px';
73
74
  }
@@ -89,11 +90,11 @@
89
90
  }
90
91
  }
91
92
 
92
- run(() => {
93
- if (position || align) {
94
- positionWrap();
95
- }
96
- });
93
+ $effect(() => {
94
+ position;
95
+ align;
96
+ positionWrap();
97
+ })
97
98
 
98
99
  function debouncedPosition() {
99
100
  debounce(positionWrap, 10)();
@@ -109,6 +110,10 @@
109
110
  subtree: true,
110
111
  childList: true
111
112
  });
113
+
114
+ return () => {
115
+ mutationObserver.disconnect();
116
+ };
112
117
  });
113
118
 
114
119
  function slideIn(node: any) {
@@ -1,12 +1,13 @@
1
- declare const DropdownContent: import("svelte").Component<{
1
+ interface Props {
2
2
  show: boolean;
3
3
  width: number;
4
4
  relative: boolean;
5
5
  closeOnOutsideClick?: boolean;
6
- align: "start" | "center" | "end";
7
- position: "left" | "right" | "bottom" | "top";
6
+ align: 'start' | 'center' | 'end';
7
+ position: 'left' | 'right' | 'bottom' | 'top';
8
8
  trigger: HTMLElement;
9
- children?: import("svelte").Snippet;
10
- }, {}, "show">;
9
+ children?: import('svelte').Snippet;
10
+ }
11
+ declare const DropdownContent: import("svelte").Component<Props, {}, "show">;
11
12
  type DropdownContent = ReturnType<typeof DropdownContent>;
12
13
  export default DropdownContent;
@@ -95,7 +95,9 @@
95
95
  {update.content}
96
96
  </div>
97
97
  <div class="date">
98
- {new Intl.DateTimeFormat('en-US').format(new Date(update.created_at * 1000))}
98
+ {new Intl.DateTimeFormat('en-US').format(
99
+ new Date(update.created_at * 1000)
100
+ )}
99
101
  </div>
100
102
  </div>
101
103
  {/snippet}
@@ -9,6 +9,8 @@
9
9
  import LogoTalk from '../../marketing/Logo/LogoTalk.svelte';
10
10
  import LogoBlogs from '../../marketing/Logo/LogoBlogs.svelte';
11
11
  import LogoCore from '../../marketing/Logo/LogoCore.svelte';
12
+ import BarNotice from './Notice/BarNotice.svelte';
13
+ import BarLicense from './Notice/BarLicense.svelte';
12
14
 
13
15
  interface Props {
14
16
  instance?: string;
@@ -75,8 +77,11 @@
75
77
  {getName()}
76
78
  </span>
77
79
  </a>
80
+ <BarLicense name={getName()} />
78
81
  </div>
79
82
  <div class="right">
83
+ <BarNotice {instance} />
84
+
80
85
  <div class="hidden-on-mobile">
81
86
  <BarSupport config={configComplete} {product} mobile={mobileShow} />
82
87
  <BarProducts mobile={mobileShow} />
@@ -1,8 +1,9 @@
1
1
  import { type BarConfig, type BarProduct } from './bar.js';
2
- declare const HyvorBar: import("svelte").Component<{
2
+ interface Props {
3
3
  instance?: string;
4
4
  product: BarProduct;
5
5
  config?: Partial<BarConfig>;
6
- }, {}, "">;
6
+ }
7
+ declare const HyvorBar: import("svelte").Component<Props, {}, "">;
7
8
  type HyvorBar = ReturnType<typeof HyvorBar>;
8
9
  export default HyvorBar;
@@ -0,0 +1,88 @@
1
+ <script lang="ts">
2
+ import Tag from '../../Tag/Tag.svelte';
3
+ import Tooltip from '../../Tooltip/Tooltip.svelte';
4
+ import { barLicense } from '../bar.js';
5
+
6
+ let { name } = $props();
7
+
8
+ function daysDiff(unix: number) {
9
+ const date = new Date(unix * 1000);
10
+ const now = new Date();
11
+
12
+ const diffTime = date.valueOf() - now.valueOf();
13
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
14
+
15
+ return Math.max(diffDays, 1);
16
+ }
17
+
18
+ function remainingTrialDays(endsAt: number | undefined | null) {
19
+ if (!endsAt) {
20
+ return 1;
21
+ }
22
+ return daysDiff(endsAt);
23
+ }
24
+
25
+ function remainingCancelAtDAys(cancelAt: number | undefined | null) : null | number {
26
+ if (!cancelAt) {
27
+ return null;
28
+ }
29
+ return daysDiff(cancelAt);
30
+ }
31
+
32
+ let trialDays = $derived(remainingTrialDays($barLicense?.trial_ends_at));
33
+ let cancelAtDays = $derived(remainingCancelAtDAys($barLicense?.subscription?.cancel_at));
34
+ </script>
35
+
36
+ {#if $barLicense}
37
+ <a class="wrap" href="/console/billing">
38
+ {#if $barLicense.type === 'subscription'}
39
+ <Tooltip
40
+ position="bottom"
41
+ >
42
+ {#snippet tooltip()}
43
+ Your current subscription plan for {name}. Click to manage it.
44
+ {/snippet}
45
+ <Tag color="blue" size="small">
46
+ {$barLicense.subscription!.plan_readable}
47
+ {#if cancelAtDays}
48
+ (until {cancelAtDays}d)
49
+ {/if}
50
+ </Tag>
51
+ </Tooltip>
52
+ {:else if $barLicense.type === 'custom'}
53
+ <Tooltip
54
+ text="A custom license is applied to your account for {name}."
55
+ position="bottom"
56
+ >
57
+ <Tag color="green" size="small">Custom License</Tag>
58
+ </Tooltip>
59
+ {:else if $barLicense.type === 'expired'}
60
+ <Tooltip
61
+ text="Your license for {name} has expired. Please renew or upgrade to continue using the service."
62
+ position="bottom"
63
+ >
64
+ <Tag color="red" size="small">License Expired</Tag>
65
+ </Tooltip>
66
+ {:else if $barLicense.type === 'trial'}
67
+ <Tooltip
68
+ text="You are currently using a trial license for {name}. It will expire in {trialDays} day{trialDays ===
69
+ 1
70
+ ? ''
71
+ : 's'}."
72
+ position="bottom"
73
+ >
74
+ <Tag color="orange" size="small">
75
+ Trial License ({trialDays}d)
76
+ </Tag>
77
+ </Tooltip>
78
+ {/if}
79
+ </a>
80
+ {/if}
81
+
82
+ <style>
83
+ .wrap {
84
+ display: inline-flex;
85
+ align-items: center;
86
+ margin-left: 15px;
87
+ }
88
+ </style>
@@ -0,0 +1,5 @@
1
+ declare const BarLicense: import("svelte").Component<{
2
+ name: any;
3
+ }, {}, "">;
4
+ type BarLicense = ReturnType<typeof BarLicense>;
5
+ export default BarLicense;
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { barHasFailedInvoices } from '../bar.js';
3
+ import { Tag, Tooltip } from '../../index.js';
4
+ import IconExclamationCircle from '@hyvor/icons/IconExclamationCircle';
5
+
6
+ interface Props {
7
+ instance?: string;
8
+ }
9
+
10
+ let { instance = 'https://hyvor.com' }: Props = $props();
11
+ </script>
12
+
13
+ {#if $barHasFailedInvoices}
14
+ <Tooltip
15
+ text="You have an unpaid invoice. Please settle to avoid service interruption."
16
+ position="bottom"
17
+ >
18
+ <a href={instance + '/account/billing?pay-failed'}>
19
+ <Tag color="orange">
20
+ {#snippet start()}
21
+ <IconExclamationCircle size={14} />
22
+ {/snippet}
23
+ Unpaid Invoice
24
+ </Tag>
25
+ </a>
26
+ </Tooltip>
27
+ {/if}
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ instance?: string;
3
+ }
4
+ declare const BarNotice: import("svelte").Component<Props, {}, "">;
5
+ type BarNotice = ReturnType<typeof BarNotice>;
6
+ export default BarNotice;
@@ -21,8 +21,19 @@ export interface BarUpdate {
21
21
  url?: string;
22
22
  }
23
23
  export type BarUpdateType = 'company' | 'core' | 'talk' | 'blogs' | 'fortguard';
24
+ export interface BarResolvedLicense {
25
+ type: 'subscription' | 'trial' | 'custom' | 'expired';
26
+ license: Record<string, number | boolean> | null;
27
+ subscription: null | {
28
+ plan_readable: string;
29
+ cancel_at: null | number;
30
+ };
31
+ trial_ends_at: null | number;
32
+ }
24
33
  export declare const barUser: import("svelte/store").Writable<BarUser | null>;
25
34
  export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
35
+ export declare const barLicense: import("svelte/store").Writable<BarResolvedLicense | null>;
36
+ export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
26
37
  export declare function loadBarUser(instance: string, product: BarProduct): void;
27
38
  export declare class UnreadUpdatesTimeLocalStorage {
28
39
  static KEY: string;
@@ -1,6 +1,8 @@
1
1
  import { writable } from 'svelte/store';
2
2
  export const barUser = writable(null);
3
3
  export const barUnreadUpdates = writable(0);
4
+ export const barLicense = writable(null);
5
+ export const barHasFailedInvoices = writable(false);
4
6
  export function loadBarUser(instance, product) {
5
7
  const query = new URLSearchParams();
6
8
  query.set('product', product);
@@ -15,6 +17,8 @@ export function loadBarUser(instance, product) {
15
17
  .then((data) => {
16
18
  barUser.set(data.user);
17
19
  barUnreadUpdates.set(data.updates.unread);
20
+ barLicense.set(data.billing.license);
21
+ barHasFailedInvoices.set(data.billing.has_failed_invoices);
18
22
  if (lastUnreadTime === null) {
19
23
  UnreadUpdatesTimeLocalStorage.setNow();
20
24
  }
@@ -144,7 +144,11 @@
144
144
  .button.fill-light.orange {
145
145
  background-color: var(--orange-light);
146
146
  color: var(--orange-dark);
147
- --local-hover-shadow-color: color-mix(in srgb, var(--orange-light) 40%, transparent);
147
+ --local-hover-shadow-color: color-mix(
148
+ in srgb,
149
+ var(--orange-light) 40%,
150
+ transparent
151
+ );
148
152
  }
149
153
  .button.outline {
150
154
  border: 1px solid;
@@ -186,7 +190,11 @@
186
190
  background-color: var(--accent-light);
187
191
  border-color: var(--accent);
188
192
  color: var(--accent);
189
- --local-hover-shadow-color: color-mix(in srgb, var(--accent-light) 40%, transparent);
193
+ --local-hover-shadow-color: color-mix(
194
+ in srgb,
195
+ var(--accent-light) 40%,
196
+ transparent
197
+ );
190
198
  }
191
199
  .button.outline-fill.gray {
192
200
  background-color: var(--gray-light);
@@ -1,6 +1,6 @@
1
1
  import { type Component, type Snippet } from 'svelte';
2
- declare const IconMessage: Component<{
3
- size?: "small" | "medium" | "large";
2
+ interface Props {
3
+ size?: 'small' | 'medium' | 'large';
4
4
  icon?: Component;
5
5
  iconSize?: number;
6
6
  padding?: number;
@@ -14,6 +14,7 @@ declare const IconMessage: Component<{
14
14
  } | Snippet;
15
15
  children?: Snippet;
16
16
  message?: Snippet | string;
17
- }, {}, "">;
17
+ }
18
+ declare const IconMessage: Component<Props, {}, "">;
18
19
  type IconMessage = ReturnType<typeof IconMessage>;
19
20
  export default IconMessage;
@@ -83,7 +83,11 @@
83
83
  newValue = (chunks: string | string[]) => {
84
84
  const children = typeof chunks === 'string' ? chunks : chunks.join('');
85
85
  const id =
86
- key + '-' + Math.random().toString(36).substring(7) + '-' + Date.now().toString();
86
+ key +
87
+ '-' +
88
+ Math.random().toString(36).substring(7) +
89
+ '-' +
90
+ Date.now().toString();
87
91
  componentBindings.set(id, {
88
92
  component: component!,
89
93
  props: {
@@ -1,6 +1,15 @@
1
1
  import type { ComponentProps } from 'svelte';
2
2
  import Button from '../Button/Button.svelte';
3
3
  import Loader from './Loader.svelte';
4
+ interface Props {
5
+ text: string;
6
+ show: boolean;
7
+ loading: boolean;
8
+ height?: number;
9
+ divProps?: Record<string, any>;
10
+ loaderProps?: ComponentProps<typeof Loader>;
11
+ buttonProps?: ComponentProps<typeof Button>;
12
+ }
4
13
  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> {
5
14
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
15
  $$bindings?: Bindings;
@@ -14,15 +23,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
14
23
  };
15
24
  z_$$bindings?: Bindings;
16
25
  }
17
- declare const LoadButton: $$__sveltets_2_IsomorphicComponent<{
18
- text: string;
19
- show: boolean;
20
- loading: boolean;
21
- height?: number;
22
- divProps?: Record<string, any>;
23
- loaderProps?: ComponentProps<typeof Loader>;
24
- buttonProps?: ComponentProps<typeof Button>;
25
- }, {
26
+ declare const LoadButton: $$__sveltets_2_IsomorphicComponent<Props, {
26
27
  click: any;
27
28
  } & {
28
29
  [evt: string]: CustomEvent<any>;
@@ -102,7 +102,11 @@
102
102
  </div>
103
103
 
104
104
  <div class="close-wrap">
105
- <IconButton variant="invisible" on:click={handleCancel} aria-label="Close modal">
105
+ <IconButton
106
+ variant="invisible"
107
+ on:click={handleCancel}
108
+ aria-label="Close modal"
109
+ >
106
110
  <IconX size={25} />
107
111
  </IconButton>
108
112
  </div>
@@ -21,7 +21,7 @@
21
21
  size = 'medium',
22
22
  block = false,
23
23
  value = $bindable(undefined),
24
- input = $bindable({} as HTMLInputElement),
24
+ input = $bindable(),
25
25
  start,
26
26
  end,
27
27
  select = false,
@@ -1,14 +1,15 @@
1
- declare const TextInput: import("svelte").Component<{
2
- [key: string]: any;
3
- state?: "default" | "error" | "success" | "warning";
4
- size?: "small" | "medium" | "large" | "x-small";
1
+ interface Props {
2
+ state?: 'default' | 'error' | 'success' | 'warning';
3
+ size?: 'small' | 'medium' | 'large' | 'x-small';
5
4
  block?: boolean;
6
5
  value?: any;
7
6
  input?: HTMLInputElement;
8
- start?: import("svelte").Snippet;
9
- end?: import("svelte").Snippet;
7
+ start?: import('svelte').Snippet;
8
+ end?: import('svelte').Snippet;
10
9
  select?: boolean;
11
10
  selectInput?: HTMLSelectElement;
12
- }, {}, "value" | "input" | "selectInput">;
11
+ [key: string]: any;
12
+ }
13
+ declare const TextInput: import("svelte").Component<Props, {}, "value" | "input" | "selectInput">;
13
14
  type TextInput = ReturnType<typeof TextInput>;
14
15
  export default TextInput;
@@ -1,13 +1,14 @@
1
- declare const Textarea: import("svelte").Component<{
2
- [key: string]: any;
1
+ interface Props {
3
2
  value?: any;
4
3
  block?: boolean;
5
4
  rows?: number;
6
5
  cols?: number;
7
- state?: "default" | "success" | "warning" | "error";
6
+ state?: 'default' | 'success' | 'warning' | 'error';
8
7
  textarea?: HTMLTextAreaElement;
9
- start?: import("svelte").Snippet;
10
- end?: import("svelte").Snippet;
11
- }, {}, "value" | "textarea">;
8
+ start?: import('svelte').Snippet;
9
+ end?: import('svelte').Snippet;
10
+ [key: string]: any;
11
+ }
12
+ declare const Textarea: import("svelte").Component<Props, {}, "value" | "textarea">;
12
13
  type Textarea = ReturnType<typeof Textarea>;
13
14
  export default Textarea;
@@ -27,7 +27,8 @@
27
27
  }
28
28
 
29
29
  const category =
30
- (activeEl.closest('.nav-category')?.querySelector('.name') as HTMLElement)?.innerText || null;
30
+ (activeEl.closest('.nav-category')?.querySelector('.name') as HTMLElement)?.innerText ||
31
+ null;
31
32
 
32
33
  active = {
33
34
  name: activeEl.innerText,
@@ -89,7 +89,8 @@
89
89
  <a href={social.youtube} target="_blank" rel="nofollow"><IconYoutube /></a>
90
90
  {/if}
91
91
  {#if social.linkedin}
92
- <a href={social.linkedin} target="_blank" rel="nofollow"><IconLinkedin /></a>
92
+ <a href={social.linkedin} target="_blank" rel="nofollow"><IconLinkedin /></a
93
+ >
93
94
  {/if}
94
95
  </div>
95
96
  </div>
package/package.json CHANGED
@@ -7,9 +7,11 @@
7
7
  "build": "vite build && npm run package",
8
8
  "preview": "vite preview",
9
9
  "package": "svelte-kit sync && svelte-package && publint",
10
+ "package:watch": "svelte-package --watch",
10
11
  "prepublishOnly": "npm run package",
11
12
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
13
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
14
+ "check:prettier": "prettier --check ."
13
15
  },
14
16
  "exports": {
15
17
  "./components": {
@@ -35,8 +37,8 @@
35
37
  "@sveltejs/adapter-static": "^3.0.0",
36
38
  "@sveltejs/package": "^2.3.7",
37
39
  "@sveltejs/vite-plugin-svelte": "^4.0.0",
38
- "prettier": "^3.3.3",
39
- "prettier-plugin-svelte": "^3.2.7",
40
+ "prettier": "3.4.2",
41
+ "prettier-plugin-svelte": "3.3.3",
40
42
  "publint": "^0.1.9",
41
43
  "svelte": "^5.0.0",
42
44
  "svelte-check": "^4.0.0",
@@ -57,5 +59,5 @@
57
59
  "publishConfig": {
58
60
  "access": "public"
59
61
  },
60
- "version": "1.0.9"
62
+ "version": "1.0.11"
61
63
  }