@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
@@ -1,57 +1,52 @@
1
- <script>import Caption from "../FormControl/Caption.svelte";
2
- import Label from "../FormControl/Label.svelte";
3
- export let label = "";
4
- export let caption = "";
5
- export let column = false;
6
- export let flex = [1, 2];
7
- </script>
8
-
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import Caption from '../FormControl/Caption.svelte';
4
+ import Label from '../FormControl/Label.svelte';
9
5
 
10
- <div
11
- class="split-control"
12
- class:has-nested={$$slots.nested}
13
- class:column={column}
14
- >
6
+ interface Props {
7
+ label?: string | Snippet;
8
+ caption?: string | Snippet;
9
+ column?: boolean;
10
+ flex?: number[];
11
+ children?: Snippet;
12
+ nested?: Snippet;
13
+ }
15
14
 
16
- <div
17
- class="left"
18
- style:flex={flex[0]}
19
- >
20
-
21
- <div class="label-wrap">
22
- {#if $$slots.label}
23
- <slot name="label" />
24
- {:else}
25
- <Label>{label}</Label>
26
- {/if}
27
- </div>
15
+ const { label, caption, column = false, flex = [1, 2], children, nested }: Props = $props();
16
+ </script>
28
17
 
29
- {#if $$slots.caption || caption}
30
- <div class="caption-wrap">
31
- {#if $$slots.caption}
32
- <slot name="caption" />
33
- {:else if caption}
34
- <Caption>{caption}</Caption>
35
- {/if}
36
- </div>
37
- {/if}
38
- </div>
18
+ <div class="split-control" class:has-nested={!!nested} class:column>
19
+ <div class="left" style:flex={flex[0]}>
20
+ <div class="label-wrap">
21
+ {#if typeof label === 'string'}
22
+ <Label>{label}</Label>
23
+ {:else}
24
+ {@render label?.()}
25
+ {/if}
26
+ </div>
39
27
 
40
- {#if $$slots.default}
41
- <div
42
- class="right"
43
- style:flex={flex[1]}
44
- >
45
- <slot></slot>
46
- </div>
47
- {/if}
28
+ {#if caption}
29
+ <div class="caption-wrap">
30
+ {#if typeof caption === 'string'}
31
+ <Caption>{caption}</Caption>
32
+ {:else}
33
+ {@render caption()}
34
+ {/if}
35
+ </div>
36
+ {/if}
37
+ </div>
48
38
 
39
+ {#if children}
40
+ <div class="right" style:flex={flex[1]}>
41
+ {@render children()}
42
+ </div>
43
+ {/if}
49
44
  </div>
50
45
 
51
- {#if $$slots.nested}
52
- <div class="nested">
53
- <slot name="nested"></slot>
54
- </div>
46
+ {#if nested}
47
+ <div class="nested">
48
+ {@render nested()}
49
+ </div>
55
50
  {/if}
56
51
 
57
52
  <style>.split-control {
@@ -89,4 +84,4 @@ export let flex = [1, 2];
89
84
 
90
85
  .caption-wrap {
91
86
  margin-top: 4px;
92
- }</style>
87
+ }</style>
@@ -1,24 +1,11 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- label?: string | undefined;
5
- caption?: string | undefined;
6
- column?: boolean | undefined;
7
- flex?: number[] | undefined;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {
13
- label: {};
14
- caption: {};
15
- default: {};
16
- nested: {};
17
- };
18
- };
19
- export type SplitControlProps = typeof __propDef.props;
20
- export type SplitControlEvents = typeof __propDef.events;
21
- export type SplitControlSlots = typeof __propDef.slots;
22
- export default class SplitControl extends SvelteComponent<SplitControlProps, SplitControlEvents, SplitControlSlots> {
23
- }
24
- export {};
1
+ import type { Snippet } from 'svelte';
2
+ declare const SplitControl: import("svelte").Component<{
3
+ label?: string | Snippet;
4
+ caption?: string | Snippet;
5
+ column?: boolean;
6
+ flex?: number[];
7
+ children?: Snippet;
8
+ nested?: Snippet;
9
+ }, {}, "">;
10
+ type SplitControl = ReturnType<typeof SplitControl>;
11
+ export default SplitControl;
@@ -1,62 +1,72 @@
1
- <script>export let checked = false;
2
- export let input = {};
1
+ <script lang="ts">
2
+ import { createBubbler } from 'svelte/legacy';
3
+
4
+ const bubble = createBubbler();
5
+ interface Props {
6
+ checked?: boolean;
7
+ input?: any;
8
+ children?: import('svelte').Snippet;
9
+ [key: string]: any;
10
+ }
11
+
12
+ let {
13
+ checked = $bindable(false),
14
+ input = $bindable({} as HTMLInputElement),
15
+ children,
16
+ ...rest
17
+ }: Props = $props();
3
18
  </script>
4
19
 
5
20
  <label class="switch-wrap">
6
- <span class="switch">
7
- <input
8
- type="checkbox"
9
- bind:checked
10
- bind:this={input}
11
- {...$$restProps}
12
-
13
- on:keyup
14
- on:keydown
15
- on:keypress
16
- on:focus
17
- on:blur
18
- on:click
19
- on:mouseover
20
- on:mouseenter
21
- on:mouseleave
22
- on:change
23
- />
24
- <span class="slider"></span>
25
-
26
-
27
- </span>
28
- {#if $$slots.default}
29
- <span class="message">
30
- <slot />
31
- </span>
32
- {/if}
21
+ <span class="switch">
22
+ <input
23
+ type="checkbox"
24
+ bind:checked
25
+ bind:this={input}
26
+ {...rest}
27
+ onkeyup={bubble('keyup')}
28
+ onkeydown={bubble('keydown')}
29
+ onkeypress={bubble('keypress')}
30
+ onfocus={bubble('focus')}
31
+ onblur={bubble('blur')}
32
+ onclick={bubble('click')}
33
+ onmouseover={bubble('mouseover')}
34
+ onmouseenter={bubble('mouseenter')}
35
+ onmouseleave={bubble('mouseleave')}
36
+ onchange={bubble('change')}
37
+ />
38
+ <span class="slider"></span>
39
+ </span>
40
+ {#if children}
41
+ <span class="message">
42
+ {@render children?.()}
43
+ </span>
44
+ {/if}
33
45
  </label>
34
46
 
35
47
  <style>
48
+ .switch-wrap {
49
+ display: inline-flex;
50
+ align-items: center;
51
+ cursor: pointer;
52
+ }
36
53
 
37
- .switch-wrap {
38
- display: inline-flex;
39
- align-items: center;
40
- cursor: pointer;
41
- }
54
+ .message {
55
+ margin-left: 8px;
56
+ }
42
57
 
43
- .message {
44
- margin-left: 8px;
45
- }
58
+ .switch {
59
+ position: relative;
60
+ display: inline-block;
61
+ width: 40px;
62
+ height: 24px;
63
+ vertical-align: middle;
64
+ }
46
65
 
47
- .switch {
48
- position: relative;
49
- display: inline-block;
50
- width:40px;
51
- height:24px;
52
- vertical-align: middle;
53
- }
54
-
55
66
  input {
56
- opacity: 0;
67
+ opacity: 0;
57
68
  }
58
69
 
59
-
60
70
  .slider {
61
71
  position: absolute;
62
72
  cursor: pointer;
@@ -65,41 +75,41 @@ export let input = {};
65
75
  right: 0;
66
76
  bottom: 0;
67
77
  background-color: var(--input);
68
- transition: .2s;
78
+ transition: 0.2s;
69
79
  border-radius: 30px;
70
80
  }
71
81
 
72
- .slider:hover {
73
- box-shadow: 0 0 0 2px var(--accent-light);
74
- }
75
-
82
+ .slider:hover {
83
+ box-shadow: 0 0 0 2px var(--accent-light);
84
+ }
85
+
76
86
  .slider:before {
77
87
  position: absolute;
78
- content: "";
88
+ content: '';
79
89
  border-radius: 50%;
80
90
  background-color: var(--accent-text);
81
- transition: .1s;
82
- width:18px;
83
- height:18px;
84
- left:3px;
85
- top:3px;
86
- bottom:3px;
91
+ transition: 0.1s;
92
+ width: 18px;
93
+ height: 18px;
94
+ left: 3px;
95
+ top: 3px;
96
+ bottom: 3px;
87
97
  }
88
-
98
+
89
99
  input:checked + .slider {
90
100
  background-color: var(--accent);
91
101
  }
92
-
102
+
93
103
  input:focus-visible + .slider {
94
104
  box-shadow: 0 0 0 3px var(--accent-light);
95
105
  }
96
106
 
97
- .switch:active .slider, input:active + .slider {
98
- box-shadow: 0 0 0 3px var(--accent-light);
99
- }
100
-
107
+ .switch:active .slider,
108
+ input:active + .slider {
109
+ box-shadow: 0 0 0 3px var(--accent-light);
110
+ }
111
+
101
112
  input:checked + .slider:before {
102
113
  transform: translateX(16px);
103
114
  }
104
-
105
- </style>
115
+ </style>
@@ -1,31 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- checked?: boolean | undefined;
6
- input?: HTMLInputElement | undefined;
7
- };
8
- events: {
9
- keyup: KeyboardEvent;
10
- keydown: KeyboardEvent;
11
- keypress: KeyboardEvent;
12
- focus: FocusEvent;
13
- blur: FocusEvent;
14
- click: MouseEvent;
15
- mouseover: MouseEvent;
16
- mouseenter: MouseEvent;
17
- mouseleave: MouseEvent;
18
- change: Event;
19
- } & {
20
- [evt: string]: CustomEvent<any>;
21
- };
22
- slots: {
23
- default: {};
24
- };
25
- };
26
- export type SwitchProps = typeof __propDef.props;
27
- export type SwitchEvents = typeof __propDef.events;
28
- export type SwitchSlots = typeof __propDef.slots;
29
- export default class Switch extends SvelteComponent<SwitchProps, SwitchEvents, SwitchSlots> {
30
- }
31
- export {};
1
+ declare const Switch: import("svelte").Component<{
2
+ [key: string]: any;
3
+ checked?: boolean;
4
+ input?: any;
5
+ children?: import("svelte").Snippet;
6
+ }, {}, "checked" | "input">;
7
+ type Switch = ReturnType<typeof Switch>;
8
+ export default Switch;
@@ -1,28 +1,38 @@
1
- <script>import { onMount, setContext } from "svelte";
2
- import { writable } from "svelte/store";
3
- export let active;
4
- const activeStore = writable(active);
5
- setContext("tab-nav-active", activeStore);
6
- $:
7
- active, activeStore.set(active);
8
- onMount(() => {
9
- const unsubscribe = activeStore.subscribe((value) => {
10
- active = value;
11
- });
12
- return unsubscribe;
13
- });
1
+ <script lang="ts">
2
+ import { run } from 'svelte/legacy';
3
+
4
+ import { onMount, setContext } from 'svelte';
5
+ import { writable } from 'svelte/store';
6
+
7
+ interface Props {
8
+ active: string;
9
+ children?: import('svelte').Snippet;
10
+ [key: string]: any;
11
+ }
12
+
13
+ let { active = $bindable(), children, ...rest }: Props = $props();
14
+
15
+ const activeStore = writable(active);
16
+ setContext('tab-nav-active', activeStore);
17
+
18
+ $effect(() => {
19
+ activeStore.set(active);
20
+ });
21
+
22
+ onMount(() => {
23
+ const unsubscribe = activeStore.subscribe((value) => {
24
+ active = value;
25
+ });
26
+ return unsubscribe;
27
+ });
14
28
  </script>
15
29
 
16
- <div
17
- class="tab-nav"
18
- {...$$restProps}
19
- >
20
- <slot />
30
+ <div class="tab-nav" {...rest}>
31
+ {@render children?.()}
21
32
  </div>
22
33
 
23
-
24
34
  <style>
25
- div {
26
- display: flex;
27
- }
28
- </style>
35
+ div {
36
+ display: flex;
37
+ }
38
+ </style>
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- active: string;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type TabNavProps = typeof __propDef.props;
15
- export type TabNavEvents = typeof __propDef.events;
16
- export type TabNavSlots = typeof __propDef.slots;
17
- export default class TabNav extends SvelteComponent<TabNavProps, TabNavEvents, TabNavSlots> {
18
- }
19
- export {};
1
+ declare const TabNav: import("svelte").Component<{
2
+ [key: string]: any;
3
+ active: string;
4
+ children?: import("svelte").Snippet;
5
+ }, {}, "active">;
6
+ type TabNav = ReturnType<typeof TabNav>;
7
+ export default TabNav;
@@ -1,57 +1,71 @@
1
- <script>import { getContext } from "svelte";
2
- export let active = false;
3
- export let name;
4
- const activeStore = getContext("tab-nav-active");
5
- $:
6
- isActive = $activeStore === name || active;
7
- function handleClick() {
8
- activeStore.set(name);
9
- }
10
- </script>
1
+ <script lang="ts">
2
+ import { createBubbler, handlers } from 'svelte/legacy';
3
+
4
+ const bubble = createBubbler();
5
+ import { getContext } from 'svelte';
6
+ import type { Writable } from 'svelte/store';
7
+
8
+ interface Props {
9
+ active?: boolean;
10
+ name: string;
11
+ start?: import('svelte').Snippet;
12
+ children?: import('svelte').Snippet;
13
+ end?: import('svelte').Snippet;
14
+ [key: string]: any;
15
+ }
16
+
17
+ let { active = false, name, start, children, end, ...rest }: Props = $props();
11
18
 
12
- <button
13
- class="tab"
14
- class:active={isActive}
15
- on:click={handleClick}
16
- {...$$restProps}
19
+ const activeStore = getContext('tab-nav-active') as Writable<string>;
20
+
21
+ let isActive = $derived($activeStore === name || active);
22
+
23
+ function handleClick() {
24
+ activeStore.set(name);
25
+ }
26
+ </script>
17
27
 
18
- on:click
28
+ <button
29
+ class="tab"
30
+ class:active={isActive}
31
+ onclick={handlers(handleClick, bubble('click'))}
32
+ {...rest}
19
33
  >
20
- {#if $$slots.start}
21
- <span class="start">
22
- <slot name="start" />
23
- </span>
24
- {/if}
25
- <slot />
26
- {#if $$slots.end}
27
- <span class="end">
28
- <slot name="end" />
29
- </span>
30
- {/if}
34
+ {#if start}
35
+ <span class="start">
36
+ {@render start?.()}
37
+ </span>
38
+ {/if}
39
+ {@render children?.()}
40
+ {#if end}
41
+ <span class="end">
42
+ {@render end?.()}
43
+ </span>
44
+ {/if}
31
45
  </button>
32
46
 
33
47
  <style>
34
- .tab {
35
- position: relative;
36
- padding: 10px 15px;
37
- border-bottom: 3px solid #f1f1f1;
38
- cursor: pointer;
39
- font-weight: 600;
40
- display: flex;
41
- align-items: center;
42
- }
43
- .tab.active {
44
- border-bottom-color: var(--accent);
45
- color: var(--accent);
46
- }
47
- .start {
48
- display: inline-flex;
49
- margin-right: 7px;
50
- align-items: center;
51
- }
52
- .end {
53
- display: inline-flex;
54
- margin-left: 4px;
55
- align-items: center;
56
- }
57
- </style>
48
+ .tab {
49
+ position: relative;
50
+ padding: 10px 15px;
51
+ border-bottom: 3px solid #f1f1f1;
52
+ cursor: pointer;
53
+ font-weight: 600;
54
+ display: flex;
55
+ align-items: center;
56
+ }
57
+ .tab.active {
58
+ border-bottom-color: var(--accent);
59
+ color: var(--accent);
60
+ }
61
+ .start {
62
+ display: inline-flex;
63
+ margin-right: 7px;
64
+ align-items: center;
65
+ }
66
+ .end {
67
+ display: inline-flex;
68
+ margin-left: 4px;
69
+ align-items: center;
70
+ }
71
+ </style>
@@ -1,24 +1,10 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- active?: boolean | undefined;
6
- name: string;
7
- };
8
- events: {
9
- click: MouseEvent;
10
- } & {
11
- [evt: string]: CustomEvent<any>;
12
- };
13
- slots: {
14
- start: {};
15
- default: {};
16
- end: {};
17
- };
18
- };
19
- export type TabNavItemProps = typeof __propDef.props;
20
- export type TabNavItemEvents = typeof __propDef.events;
21
- export type TabNavItemSlots = typeof __propDef.slots;
22
- export default class TabNavItem extends SvelteComponent<TabNavItemProps, TabNavItemEvents, TabNavItemSlots> {
23
- }
24
- export {};
1
+ declare const TabNavItem: import("svelte").Component<{
2
+ [key: string]: any;
3
+ active?: boolean;
4
+ name: string;
5
+ start?: import("svelte").Snippet;
6
+ children?: import("svelte").Snippet;
7
+ end?: import("svelte").Snippet;
8
+ }, {}, "">;
9
+ type TabNavItem = ReturnType<typeof TabNavItem>;
10
+ export default TabNavItem;
@@ -1,11 +1,21 @@
1
- <script>export let columns;
2
- export let hover = false;
3
- const hoverCss = hover ? "--local-hover-color: var(--hover);" : "";
1
+ <script lang="ts">
2
+ interface Props {
3
+ columns: string;
4
+ hover?: boolean;
5
+ children?: import('svelte').Snippet;
6
+ }
7
+
8
+ let { columns, hover = false, children }: Props = $props();
9
+
10
+ const hoverCss = hover ? '--local-hover-color: var(--hover);' : '';
4
11
  </script>
5
12
 
6
- <div class="table" style="
13
+ <div
14
+ class="table"
15
+ style="
7
16
  --local-columns: {columns};
8
17
  {hoverCss}
9
- ">
10
- <slot />
11
- </div>
18
+ "
19
+ >
20
+ {@render children?.()}
21
+ </div>
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- columns: string;
5
- hover?: boolean | undefined;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type TableProps = typeof __propDef.props;
15
- export type TableEvents = typeof __propDef.events;
16
- export type TableSlots = typeof __propDef.slots;
17
- export default class Table extends SvelteComponent<TableProps, TableEvents, TableSlots> {
18
- }
19
- export {};
1
+ declare const Table: import("svelte").Component<{
2
+ columns: string;
3
+ hover?: boolean;
4
+ children?: import("svelte").Snippet;
5
+ }, {}, "">;
6
+ type Table = ReturnType<typeof Table>;
7
+ export default Table;