@hyvor/design 1.1.20 → 1.1.21-beta.1
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/Accordion/Accordion.svelte +115 -0
- package/dist/components/Accordion/Accordion.svelte.d.ts +10 -0
- package/dist/components/Button/Button.svelte +7 -1
- package/dist/components/Button/Button.svelte.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/variables.scss +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
title: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
icon?: Component;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { title, children, open = $bindable(false), icon }: Props = $props();
|
|
13
|
+
const Icon = icon;
|
|
14
|
+
|
|
15
|
+
function handleClick() {
|
|
16
|
+
open = !open;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="accordion-item">
|
|
21
|
+
<button class="accordion-header" class:open onclick={handleClick}>
|
|
22
|
+
{#if icon}
|
|
23
|
+
<span class="icon">
|
|
24
|
+
<Icon size={20} />
|
|
25
|
+
</span>
|
|
26
|
+
{/if}
|
|
27
|
+
<span class="title">{title}</span>
|
|
28
|
+
<span class="chevron" class:rotated={open}>
|
|
29
|
+
<IconCaretDownFill />
|
|
30
|
+
</span>
|
|
31
|
+
</button>
|
|
32
|
+
|
|
33
|
+
<div class="accordion-content" class:show={open}>
|
|
34
|
+
<div class="content-text">
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.accordion-item {
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
border-radius: 20px;
|
|
44
|
+
border: 1px solid var(--border);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.accordion-header {
|
|
48
|
+
width: 100%;
|
|
49
|
+
padding: 14px 20px;
|
|
50
|
+
background: none;
|
|
51
|
+
border: none;
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
align-items: center;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
border-radius: 20px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.accordion-header.open {
|
|
61
|
+
border-radius: 20px 20px 0 0;
|
|
62
|
+
background-color: var(--hover);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.title {
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
text-align: left;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.chevron {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
transition: transform 0.3s ease;
|
|
74
|
+
color: var(--text);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.chevron.rotated {
|
|
78
|
+
transform: rotate(180deg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.accordion-content {
|
|
82
|
+
height: 0;
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.accordion-content.show {
|
|
87
|
+
height: auto;
|
|
88
|
+
overflow: visible;
|
|
89
|
+
animation: slideDown 0.3s ease-out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.content-text {
|
|
93
|
+
padding: 20px;
|
|
94
|
+
color: var(--text);
|
|
95
|
+
line-height: 1.6;
|
|
96
|
+
border-top: 1px solid var(--border);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.icon {
|
|
100
|
+
display: inline-block;
|
|
101
|
+
margin-right: 10px;
|
|
102
|
+
vertical-align: middle;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@keyframes slideDown {
|
|
106
|
+
from {
|
|
107
|
+
opacity: 0;
|
|
108
|
+
transform: translateY(-10px);
|
|
109
|
+
}
|
|
110
|
+
to {
|
|
111
|
+
opacity: 1;
|
|
112
|
+
transform: translateY(0);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
icon?: Component;
|
|
7
|
+
}
|
|
8
|
+
declare const Accordion: Component<Props, {}, "open">;
|
|
9
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
10
|
+
export default Accordion;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
as?: 'button' | 'a';
|
|
9
|
-
size?: 'x-small' | 'small' | 'medium' | 'large';
|
|
9
|
+
size?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
|
|
10
10
|
color?: 'accent' | 'gray' | 'green' | 'red' | 'blue' | 'orange' | 'input';
|
|
11
11
|
block?: boolean;
|
|
12
12
|
variant?: 'fill' | 'fill-light' | 'outline' | 'invisible' | 'outline-fill';
|
|
@@ -200,6 +200,12 @@
|
|
|
200
200
|
--local-hover-shadow-size: 5px;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
.button.x-large {
|
|
204
|
+
height: 40px;
|
|
205
|
+
padding: 0 26px;
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
}
|
|
208
|
+
|
|
203
209
|
.button.fill.accent {
|
|
204
210
|
background-color: var(--accent);
|
|
205
211
|
color: var(--accent-text);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
as?: 'button' | 'a';
|
|
3
|
-
size?: 'x-small' | 'small' | 'medium' | 'large';
|
|
3
|
+
size?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
|
|
4
4
|
color?: 'accent' | 'gray' | 'green' | 'red' | 'blue' | 'orange' | 'input';
|
|
5
5
|
block?: boolean;
|
|
6
6
|
variant?: 'fill' | 'fill-light' | 'outline' | 'invisible' | 'outline-fill';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as ActionList } from './ActionList/ActionList.svelte';
|
|
2
2
|
export { default as ActionListItem } from './ActionList/ActionListItem.svelte';
|
|
3
3
|
export { default as ActionListGroup } from './ActionList/ActionListGroup.svelte';
|
|
4
|
+
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
4
5
|
export { default as Avatar } from './Avatar/Avatar.svelte';
|
|
5
6
|
export { default as AvatarStack } from './Avatar/AvatarStack.svelte';
|
|
6
7
|
export { default as Base } from './Base/Base.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as ActionList } from './ActionList/ActionList.svelte';
|
|
2
2
|
export { default as ActionListItem } from './ActionList/ActionListItem.svelte';
|
|
3
3
|
export { default as ActionListGroup } from './ActionList/ActionListGroup.svelte';
|
|
4
|
+
export { default as Accordion } from './Accordion/Accordion.svelte';
|
|
4
5
|
export { default as Avatar } from './Avatar/Avatar.svelte';
|
|
5
6
|
export { default as AvatarStack } from './Avatar/AvatarStack.svelte';
|
|
6
7
|
export { default as Base } from './Base/Base.svelte';
|
package/dist/variables.scss
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
--accent: #000;
|
|
9
9
|
--accent-light: #bdbdbd;
|
|
10
10
|
--accent-lightest: #fafafa;
|
|
11
|
+
--accent-light-mid: #818181;
|
|
11
12
|
--accent-text: #fff;
|
|
12
13
|
|
|
13
14
|
--border: #e1e1e1;
|
|
@@ -79,4 +80,4 @@ $breakpoint-xs: 320px;
|
|
|
79
80
|
$breakpoint-sm: 576px;
|
|
80
81
|
$breakpoint-md: 768px;
|
|
81
82
|
$breakpoint-lg: 992px;
|
|
82
|
-
$breakpoint-xl: 1200px;
|
|
83
|
+
$breakpoint-xl: 1200px;
|
package/package.json
CHANGED