@hyvor/design 1.1.20 → 1.1.21-beta.2

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.
@@ -0,0 +1,143 @@
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
+ headerColor?: string;
11
+ textColor?: string;
12
+ openedColor?: string;
13
+ borderColor?: string;
14
+ topBorderColor?: string;
15
+ }
16
+
17
+ let {
18
+ title,
19
+ children,
20
+ open = $bindable(false),
21
+ icon,
22
+ headerColor,
23
+ textColor,
24
+ openedColor,
25
+ borderColor,
26
+ topBorderColor
27
+ }: Props = $props();
28
+
29
+ const Icon = icon;
30
+
31
+ function handleClick() {
32
+ open = !open;
33
+ }
34
+ </script>
35
+
36
+ <div
37
+ class="accordion-item"
38
+ style:--custom-border={borderColor}
39
+ style:--custom-text={textColor}
40
+ style:--custom-opened={openedColor}
41
+ style:--custom-header={headerColor}
42
+ >
43
+ <button class="accordion-header" class:open onclick={handleClick}>
44
+ {#if icon}
45
+ <span class="icon">
46
+ <Icon size={20} />
47
+ </span>
48
+ {/if}
49
+ <span class="title">{title}</span>
50
+ <span class="chevron" class:rotated={open}>
51
+ <IconCaretDownFill />
52
+ </span>
53
+ </button>
54
+
55
+ <div class="accordion-content"
56
+ class:show={open}>
57
+ <div class="content-text"
58
+ style:--custom-top-border={topBorderColor}
59
+ style:--custom-header={headerColor}
60
+ >
61
+ {@render children?.()}
62
+ </div>
63
+ </div>
64
+ </div>
65
+
66
+ <style>
67
+ .accordion-item {
68
+ overflow: hidden;
69
+ border-radius: 20px;
70
+ border: 1px solid var(--custom-border, var(--border));
71
+ }
72
+
73
+ .accordion-header {
74
+ width: 100%;
75
+ padding: 14px 20px;
76
+ background: var(--custom-header, none);
77
+ border: none;
78
+ display: flex;
79
+ justify-content: space-between;
80
+ align-items: center;
81
+ cursor: pointer;
82
+ font-size: 16px;
83
+ border-radius: 20px;
84
+ color: var(--custom-text, var(--text));
85
+ }
86
+
87
+ .accordion-header.open {
88
+ border-radius: 20px 20px 0 0;
89
+ background-color: var(--custom-opened, var(--hover));
90
+ }
91
+
92
+ .title {
93
+ font-weight: 500;
94
+ text-align: left;
95
+ }
96
+
97
+ .chevron {
98
+ display: flex;
99
+ align-items: center;
100
+ transition: transform 0.3s ease;
101
+ color: var(--custom-text, var(--text));
102
+ }
103
+
104
+ .chevron.rotated {
105
+ transform: rotate(180deg);
106
+ }
107
+
108
+ .accordion-content {
109
+ height: 0;
110
+ overflow: hidden;
111
+ }
112
+
113
+ .accordion-content.show {
114
+ height: auto;
115
+ overflow: visible;
116
+ animation: slideDown 0.3s ease-out;
117
+ }
118
+
119
+ .content-text {
120
+ padding: 20px;
121
+ color: var(--custom-text, var(--text));
122
+ line-height: 1.6;
123
+ border-top: 1px solid var(--custom-top-border, var(--border));
124
+ background: var(--custom-header, none);
125
+ }
126
+
127
+ .icon {
128
+ display: inline-block;
129
+ margin-right: 10px;
130
+ vertical-align: middle;
131
+ }
132
+
133
+ @keyframes slideDown {
134
+ from {
135
+ opacity: 0;
136
+ transform: translateY(-10px);
137
+ }
138
+ to {
139
+ opacity: 1;
140
+ transform: translateY(0);
141
+ }
142
+ }
143
+ </style>
@@ -0,0 +1,15 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ interface Props {
3
+ title: string;
4
+ children?: Snippet;
5
+ open?: boolean;
6
+ icon?: Component;
7
+ headerColor?: string;
8
+ textColor?: string;
9
+ openedColor?: string;
10
+ borderColor?: string;
11
+ topBorderColor?: string;
12
+ }
13
+ declare const Accordion: Component<Props, {}, "open">;
14
+ type Accordion = ReturnType<typeof Accordion>;
15
+ 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';
@@ -28,6 +28,34 @@
28
28
  change: string;
29
29
  }>();
30
30
 
31
+ let buttonElement: HTMLButtonElement;
32
+ let pickerTop = $state(0);
33
+ let pickerLeft = $state(0);
34
+
35
+ function updatePosition() {
36
+ if (buttonElement) {
37
+ const rect = buttonElement.getBoundingClientRect();
38
+ pickerLeft = rect.right;
39
+ pickerTop = rect.bottom;
40
+ }
41
+ }
42
+
43
+ $effect(() => {
44
+ if (show) {
45
+ updatePosition();
46
+ window.addEventListener('scroll', updatePosition, true);
47
+ window.addEventListener('resize', updatePosition);
48
+ } else {
49
+ window.removeEventListener('scroll', updatePosition, true);
50
+ window.removeEventListener('resize', updatePosition);
51
+ }
52
+
53
+ return () => {
54
+ window.removeEventListener('scroll', updatePosition, true);
55
+ window.removeEventListener('resize', updatePosition);
56
+ };
57
+ });
58
+
31
59
  function handleInput() {
32
60
  dispatch('input', color);
33
61
  oninput?.(color);
@@ -42,6 +70,7 @@
42
70
 
43
71
  <span class="color-picker">
44
72
  <button
73
+ bind:this={buttonElement}
45
74
  style:width="{size}px"
46
75
  style:height="{size}px"
47
76
  style:background-color={color}
@@ -58,6 +87,8 @@
58
87
  {#if show}
59
88
  <div
60
89
  class="color-picker-wrap"
90
+ style:top="{pickerTop}px"
91
+ style:left="{pickerLeft}px"
61
92
  use:clickOutside={{
62
93
  callback: () => handleClose()
63
94
  }}
@@ -82,9 +113,7 @@
82
113
  border: 1px solid var(--border);
83
114
  }
84
115
  div {
85
- position: absolute;
86
- left: 0;
87
- top: 100%;
116
+ position: fixed;
88
117
  width: 0;
89
118
  z-index: 1000;
90
119
  }
@@ -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';
@@ -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/index.css CHANGED
@@ -50,6 +50,13 @@ a {
50
50
  margin: auto;
51
51
  }
52
52
 
53
+ .hds-container-max {
54
+ width: 1400px;
55
+ max-width: 100%;
56
+ padding: 0 15px;
57
+ margin: auto;
58
+ }
59
+
53
60
  .hds-link {
54
61
  color: var(--link);
55
62
  text-decoration: underline;
@@ -2,18 +2,22 @@
2
2
  interface Props {
3
3
  as?: string;
4
4
  children?: import('svelte').Snippet;
5
+ max?: boolean;
5
6
  }
6
7
 
7
- let { as = 'div', children }: Props = $props();
8
+ let { as = 'div', children, max = false
9
+ }: Props = $props();
10
+
11
+ let width= max ? '1400px' : '1000px';
8
12
  </script>
9
13
 
10
- <svelte:element this={as} class="container">
14
+ <svelte:element this={as} class="container" style:width={width}>
11
15
  {@render children?.()}
12
16
  </svelte:element>
13
17
 
14
18
  <style>
15
19
  .container {
16
- width: 1000px;
20
+ /*width: 1000px;*/
17
21
  max-width: 100%;
18
22
  padding: 0 15px;
19
23
  margin: auto;
@@ -1,6 +1,7 @@
1
1
  interface Props {
2
2
  as?: string;
3
3
  children?: import('svelte').Snippet;
4
+ max?: boolean;
4
5
  }
5
6
  declare const Container: import("svelte").Component<Props, {}, "">;
6
7
  type Container = ReturnType<typeof Container>;
@@ -24,6 +24,7 @@
24
24
  center?: import('svelte').Snippet;
25
25
  affiliate?: boolean;
26
26
  recordVisit?: boolean;
27
+ max?: boolean;
27
28
  }
28
29
 
29
30
  let {
@@ -31,7 +32,8 @@
31
32
  social = $bindable({} as Record<string, string | null>),
32
33
  center,
33
34
  affiliate = true,
34
- recordVisit = true
35
+ recordVisit = true,
36
+ max = false,
35
37
  }: Props = $props();
36
38
 
37
39
  social = {
@@ -51,7 +53,7 @@
51
53
  </script>
52
54
 
53
55
  <footer>
54
- <Container>
56
+ <Container {max}>
55
57
  <div class="footer-top">
56
58
  <div class="footer-top-left">
57
59
  {#if email}
@@ -5,6 +5,7 @@ interface Props {
5
5
  center?: import('svelte').Snippet;
6
6
  affiliate?: boolean;
7
7
  recordVisit?: boolean;
8
+ max?: boolean;
8
9
  }
9
10
  declare const Footer: import("svelte").Component<Props, {}, "social">;
10
11
  type Footer = ReturnType<typeof Footer>;
@@ -13,6 +13,7 @@
13
13
  darkToggle?: boolean;
14
14
  center?: import('svelte').Snippet;
15
15
  end?: import('svelte').Snippet;
16
+ max?: boolean;
16
17
  }
17
18
 
18
19
  let {
@@ -22,12 +23,13 @@
22
23
  subName = undefined,
23
24
  darkToggle = true,
24
25
  center,
25
- end
26
+ end,
27
+ max = false,
26
28
  }: Props = $props();
27
29
  </script>
28
30
 
29
31
  <header>
30
- <Container as="nav">
32
+ <Container as="nav" {max}>
31
33
  <div class="nav-start">
32
34
  <a class="nav-brand" {href}>
33
35
  <img src={logo} alt="Hyvor Logo" width="30" height="30" />
@@ -6,6 +6,7 @@ interface Props {
6
6
  darkToggle?: boolean;
7
7
  center?: import('svelte').Snippet;
8
8
  end?: import('svelte').Snippet;
9
+ max?: boolean;
9
10
  }
10
11
  declare const Header: import("svelte").Component<Props, {}, "">;
11
12
  type Header = ReturnType<typeof Header>;
@@ -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
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "version": "1.1.20"
63
+ "version": "1.1.21-beta.2"
64
64
  }