@hyvor/design 1.1.3 → 1.1.4
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.
- package/dist/components/Button/Button.svelte +35 -10
- package/dist/components/Button/Button.svelte.d.ts +10 -0
- package/dist/components/CodeBlock/TabbedCodeBlock.svelte +78 -0
- package/dist/components/CodeBlock/TabbedCodeBlock.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
end?: import('svelte').Snippet;
|
|
17
17
|
action?: import('svelte').Snippet;
|
|
18
18
|
[key: string]: any;
|
|
19
|
+
|
|
20
|
+
onkeyup?: (event: KeyboardEvent) => void;
|
|
21
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
22
|
+
onkeypress?: (event: KeyboardEvent) => void;
|
|
23
|
+
onfocus?: (event: FocusEvent) => void;
|
|
24
|
+
onblur?: (event: FocusEvent) => void;
|
|
25
|
+
onclick?: (event: MouseEvent) => void;
|
|
26
|
+
onmouseover?: (event: MouseEvent) => void;
|
|
27
|
+
onmouseenter?: (event: MouseEvent) => void;
|
|
28
|
+
onmouseleave?: (event: MouseEvent) => void;
|
|
29
|
+
onchange?: (event: Event) => void;
|
|
19
30
|
}
|
|
20
31
|
|
|
21
32
|
let {
|
|
@@ -30,6 +41,18 @@
|
|
|
30
41
|
children,
|
|
31
42
|
end,
|
|
32
43
|
action,
|
|
44
|
+
|
|
45
|
+
onkeyup,
|
|
46
|
+
onkeydown,
|
|
47
|
+
onkeypress,
|
|
48
|
+
onfocus,
|
|
49
|
+
onblur,
|
|
50
|
+
onclick,
|
|
51
|
+
onmouseover,
|
|
52
|
+
onmouseenter,
|
|
53
|
+
onmouseleave,
|
|
54
|
+
onchange,
|
|
55
|
+
|
|
33
56
|
...rest
|
|
34
57
|
}: Props = $props();
|
|
35
58
|
</script>
|
|
@@ -38,16 +61,18 @@
|
|
|
38
61
|
this={as}
|
|
39
62
|
class="button {size} {color} {variant} {align}"
|
|
40
63
|
class:block
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
|
|
65
|
+
onkeyup={(e: KeyboardEvent) => { bubble('keyup'); onkeyup?.(e); }}
|
|
66
|
+
onkeydown={(e: KeyboardEvent) => { bubble('keydown'); onkeydown?.(e); }}
|
|
67
|
+
onkeypress={(e: KeyboardEvent) => { bubble('keypress'); onkeypress?.(e); }}
|
|
68
|
+
onfocus={(e: FocusEvent) => { bubble('focus'); onfocus?.(e); }}
|
|
69
|
+
onblur={(e: FocusEvent) => { bubble('blur'); onblur?.(e); }}
|
|
70
|
+
onclick={(e: MouseEvent) => { bubble('click'); onclick?.(e); }}
|
|
71
|
+
onmouseover={(e: MouseEvent) => { bubble('mouseover'); onmouseover?.(e); }}
|
|
72
|
+
onmouseenter={(e: MouseEvent) => { bubble('mouseenter'); onmouseenter?.(e); }}
|
|
73
|
+
onmouseleave={(e: MouseEvent) => { bubble('mouseleave'); onmouseleave?.(e); }}
|
|
74
|
+
onchange={(e: Event) => { bubble('change'); onchange?.(e); }}
|
|
75
|
+
|
|
51
76
|
role="button"
|
|
52
77
|
tabindex="0"
|
|
53
78
|
bind:this={button}
|
|
@@ -11,6 +11,16 @@ interface Props {
|
|
|
11
11
|
end?: import('svelte').Snippet;
|
|
12
12
|
action?: import('svelte').Snippet;
|
|
13
13
|
[key: string]: any;
|
|
14
|
+
onkeyup?: (event: KeyboardEvent) => void;
|
|
15
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
16
|
+
onkeypress?: (event: KeyboardEvent) => void;
|
|
17
|
+
onfocus?: (event: FocusEvent) => void;
|
|
18
|
+
onblur?: (event: FocusEvent) => void;
|
|
19
|
+
onclick?: (event: MouseEvent) => void;
|
|
20
|
+
onmouseover?: (event: MouseEvent) => void;
|
|
21
|
+
onmouseenter?: (event: MouseEvent) => void;
|
|
22
|
+
onmouseleave?: (event: MouseEvent) => void;
|
|
23
|
+
onchange?: (event: Event) => void;
|
|
14
24
|
}
|
|
15
25
|
declare const Button: import("svelte").Component<Props, {}, "button">;
|
|
16
26
|
type Button = ReturnType<typeof Button>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import Button from "../Button/Button.svelte";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
children: Snippet;
|
|
7
|
+
tabs: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { children, tabs }: Props = $props();
|
|
11
|
+
let activeTab = $state(tabs[0]);
|
|
12
|
+
|
|
13
|
+
function activateTab(tab: string) {
|
|
14
|
+
activeTab = tab;
|
|
15
|
+
|
|
16
|
+
const pres = blocksEl.querySelectorAll("pre");
|
|
17
|
+
const tabIndex = tabs.indexOf(tab);
|
|
18
|
+
|
|
19
|
+
pres.forEach((pre, index) => {
|
|
20
|
+
if (index === tabIndex) {
|
|
21
|
+
pre.style.display = "block";
|
|
22
|
+
} else {
|
|
23
|
+
pre.style.display = "none";
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let blocksEl: HTMLDivElement;
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<div class="tabbed">
|
|
32
|
+
|
|
33
|
+
<div class="selectors">
|
|
34
|
+
{#each tabs as tab}
|
|
35
|
+
<Button
|
|
36
|
+
size="x-small"
|
|
37
|
+
color={activeTab === tab ? 'accent' : 'input'}
|
|
38
|
+
onclick={() => activateTab(tab)}
|
|
39
|
+
>{tab}</Button>
|
|
40
|
+
{/each}
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div class="blocks" bind:this={blocksEl}>
|
|
44
|
+
{@render children()}
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
|
|
51
|
+
.tabbed {
|
|
52
|
+
margin: 1.5rem 0 1rem 0;
|
|
53
|
+
position: relative
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.selectors {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 0;
|
|
60
|
+
left: 20px;
|
|
61
|
+
z-index: 1;
|
|
62
|
+
transform: translateY(-50%);
|
|
63
|
+
gap: 3px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.selectors > :global(button) {
|
|
67
|
+
border: 1px solid var(--border);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.blocks > :global(pre:not(:first-child)) {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.blocks > :global(pre) {
|
|
75
|
+
margin: 0
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
interface Props {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
tabs: string[];
|
|
5
|
+
}
|
|
6
|
+
declare const TabbedCodeBlock: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type TabbedCodeBlock = ReturnType<typeof TabbedCodeBlock>;
|
|
8
|
+
export default TabbedCodeBlock;
|
|
@@ -11,6 +11,7 @@ export { default as BoxShadowPicker } from './BoxShadowPicker/BoxShadowPicker.sv
|
|
|
11
11
|
export { default as Callout } from './Callout/Callout.svelte';
|
|
12
12
|
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
13
13
|
export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
|
|
14
|
+
export { default as TabbedCodeBlock } from './CodeBlock/TabbedCodeBlock.svelte';
|
|
14
15
|
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
15
16
|
export { default as DarkProvider } from './Dark/DarkProvider.svelte';
|
|
16
17
|
export { default as DarkToggle } from './Dark/DarkToggle.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as BoxShadowPicker } from './BoxShadowPicker/BoxShadowPicker.sv
|
|
|
11
11
|
export { default as Callout } from './Callout/Callout.svelte';
|
|
12
12
|
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
13
13
|
export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
|
|
14
|
+
export { default as TabbedCodeBlock } from './CodeBlock/TabbedCodeBlock.svelte';
|
|
14
15
|
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
15
16
|
export { default as DarkProvider } from './Dark/DarkProvider.svelte';
|
|
16
17
|
export { default as DarkToggle } from './Dark/DarkToggle.svelte';
|
package/package.json
CHANGED