@hyvor/design 0.0.26 → 0.0.28

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.
@@ -8,7 +8,7 @@ function handleClick() {
8
8
 
9
9
  <IconButton
10
10
  on:click={handleClick}
11
- color="invisible"
11
+ variant="invisible"
12
12
  >
13
13
  {#if $dark}
14
14
  <IconMoonStarsFill size={18} />
@@ -1,11 +1,21 @@
1
1
  <script>export let size = "medium";
2
2
  export let color = "accent";
3
+ export let variant = "fill";
3
4
  export let as = "button";
5
+ const sizes = {
6
+ small: 26,
7
+ medium: 30,
8
+ large: 36
9
+ };
10
+ size = (typeof size === "number" ? size : sizes[size]) + "px";
4
11
  </script>
5
12
 
6
13
  <svelte:element
7
14
  this={as}
8
- class="button {size} {color}"
15
+ class="button {color} {variant}"
16
+
17
+ style:width={size}
18
+ style:height={size}
9
19
 
10
20
  on:keyup
11
21
  on:keydown
@@ -47,42 +57,148 @@ export let as = "button";
47
57
  box-shadow: 0 0 0 calc(var(--local-hover-shadow-size) + 1px) var(--local-hover-shadow-color);
48
58
  }
49
59
 
50
- .button.small {
51
- height: 26px;
52
- width: 26px;
53
- }
54
-
55
- .button.medium {
56
- height: 30px;
57
- width: 30px;
58
- }
59
-
60
60
  .button.large {
61
- height: 36px;
62
- width: 36px;
63
61
  --local-hover-shadow-size: 3px;
64
62
  }
65
63
 
66
- .button.accent {
64
+ .button.fill.accent {
67
65
  background-color: var(--accent);
68
66
  color: var(--accent-text);
69
67
  --local-hover-shadow-color: var(--accent-light);
70
68
  }
71
- .button.soft {
69
+ .button.fill.gray {
70
+ background-color: var(--gray-light);
71
+ color: var(--gray-dark);
72
+ --local-hover-shadow-color: color-mix(in srgb, var(--gray-light) 40%, transparent);
73
+ }
74
+ .button.fill.green {
75
+ background-color: var(--green-light);
76
+ color: var(--green-dark);
77
+ --local-hover-shadow-color: color-mix(in srgb, var(--green-light) 40%, transparent);
78
+ }
79
+ .button.fill.red {
80
+ background-color: var(--red-light);
81
+ color: var(--red-dark);
82
+ --local-hover-shadow-color: color-mix(in srgb, var(--red-light) 40%, transparent);
83
+ }
84
+ .button.fill.blue {
85
+ background-color: var(--blue-light);
86
+ color: var(--blue-dark);
87
+ --local-hover-shadow-color: color-mix(in srgb, var(--blue-light) 40%, transparent);
88
+ }
89
+ .button.fill.orange {
90
+ background-color: var(--orange-light);
91
+ color: var(--orange-dark);
92
+ --local-hover-shadow-color: color-mix(in srgb, var(--orange-light) 40%, transparent);
93
+ }
94
+ .button.outline {
95
+ border: 1px solid;
96
+ }
97
+ .button.outline.accent {
98
+ border-color: var(--accent);
99
+ color: var(--accent);
100
+ --local-hover-shadow-color: var(--accent-light);
101
+ }
102
+ .button.outline.gray {
103
+ background-color: none;
104
+ border-color: var(--gray-dark);
105
+ color: var(--gray-dark);
106
+ --local-hover-shadow-color: var(--gray-light);
107
+ }
108
+ .button.outline.green {
109
+ background-color: none;
110
+ border-color: var(--green-dark);
111
+ color: var(--green-dark);
112
+ --local-hover-shadow-color: var(--green-light);
113
+ }
114
+ .button.outline.red {
115
+ background-color: none;
116
+ border-color: var(--red-dark);
117
+ color: var(--red-dark);
118
+ --local-hover-shadow-color: var(--red-light);
119
+ }
120
+ .button.outline.blue {
121
+ background-color: none;
122
+ border-color: var(--blue-dark);
123
+ color: var(--blue-dark);
124
+ --local-hover-shadow-color: var(--blue-light);
125
+ }
126
+ .button.outline.orange {
127
+ background-color: none;
128
+ border-color: var(--orange-dark);
129
+ color: var(--orange-dark);
130
+ --local-hover-shadow-color: var(--orange-light);
131
+ }
132
+ .button.outline-fill {
133
+ border: 1px solid;
134
+ }
135
+ .button.outline-fill.accent {
72
136
  background-color: var(--accent-light);
137
+ border-color: var(--accent);
73
138
  color: var(--accent);
74
- --local-hover-shadow-color: #eee;
139
+ --local-hover-shadow-color: color-mix(in srgb, var(--accent-light) 40%, transparent);
140
+ }
141
+ .button.outline-fill.gray {
142
+ background-color: var(--gray-light);
143
+ border-color: var(--gray-dark);
144
+ color: var(--gray-dark);
145
+ --local-hover-shadow-color: var(--gray-light);
146
+ }
147
+ .button.outline-fill.green {
148
+ background-color: var(--green-light);
149
+ border-color: var(--green-dark);
150
+ color: var(--green-dark);
151
+ --local-hover-shadow-color: var(--green-light);
152
+ }
153
+ .button.outline-fill.red {
154
+ background-color: var(--red-light);
155
+ border-color: var(--red-dark);
156
+ color: var(--red-dark);
157
+ --local-hover-shadow-color: var(--red-light);
158
+ }
159
+ .button.outline-fill.blue {
160
+ background-color: var(--blue-light);
161
+ border-color: var(--blue-dark);
162
+ color: var(--blue-dark);
163
+ --local-hover-shadow-color: var(--blue-light);
164
+ }
165
+ .button.outline-fill.orange {
166
+ background-color: var(--orange-light);
167
+ border-color: var(--orange-dark);
168
+ color: var(--orange-dark);
169
+ --local-hover-shadow-color: var(--orange-light);
75
170
  }
76
171
  .button.invisible {
77
172
  background-color: transparent;
78
173
  transition: 0.2s background-color;
79
174
  }
80
- .button.invisible:hover {
175
+ .button.invisible.accent:hover {
81
176
  background-color: var(--accent-light);
82
177
  box-shadow: none !important;
178
+ color: var(--text-light);
83
179
  }
84
- .button.danger {
85
- background-color: var(--red-dark);
86
- color: var(--text-white);
87
- --local-hover-shadow-color: var(--red-light);
180
+ .button.invisible.gray:hover {
181
+ background-color: var(--gray-light);
182
+ box-shadow: none !important;
183
+ color: var(--gray-dark);
184
+ }
185
+ .button.invisible.green:hover {
186
+ background-color: var(--green-light);
187
+ box-shadow: none !important;
188
+ color: var(--green-dark);
189
+ }
190
+ .button.invisible.red:hover {
191
+ background-color: var(--red-light);
192
+ box-shadow: none !important;
193
+ color: var(--red-dark);
194
+ }
195
+ .button.invisible.blue:hover {
196
+ background-color: var(--blue-light);
197
+ box-shadow: none !important;
198
+ color: var(--blue-dark);
199
+ }
200
+ .button.invisible.orange:hover {
201
+ background-color: var(--orange-light);
202
+ box-shadow: none !important;
203
+ color: var(--orange-dark);
88
204
  }</style>
@@ -2,8 +2,9 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
- size?: "small" | "medium" | "large" | undefined;
6
- color?: "danger" | "accent" | "soft" | "invisible" | undefined;
5
+ size?: number | "small" | "medium" | "large" | undefined;
6
+ color?: "accent" | "gray" | "green" | "red" | "blue" | "orange" | undefined;
7
+ variant?: "invisible" | "fill" | "outline" | "outline-fill" | undefined;
7
8
  as?: "button" | "a" | undefined;
8
9
  };
9
10
  events: {
@@ -1,4 +1,5 @@
1
1
  <script>export let block = false;
2
+ export let full = false;
2
3
  export let padding = "medium";
3
4
  export let size = "medium";
4
5
  export let color = "var(--accent)";
@@ -31,6 +32,7 @@ padding = typeof padding === "number" ? padding : paddings[padding];
31
32
  <div
32
33
  class="loader"
33
34
  class:block
35
+ class:full
34
36
 
35
37
  style:--local-size={size + "px"}
36
38
  style:padding={block ? padding + "px" : undefined}
@@ -92,6 +94,19 @@ padding = typeof padding === "number" ? padding : paddings[padding];
92
94
  margin-top: 10px;
93
95
  }
94
96
 
97
+ .loader.full {
98
+ width: 100%;
99
+ height: 100%;
100
+ flex: 1;
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: center;
104
+ flex-direction: column;
105
+ }
106
+ .loader.full .message {
107
+ margin-top: 10px;
108
+ }
109
+
95
110
  .loader-wrap {
96
111
  display: inline-flex;
97
112
  width: var(--local-size);
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  block?: boolean | undefined;
6
+ full?: boolean | undefined;
6
7
  padding?: number | "none" | "small" | "medium" | "large" | undefined;
7
8
  size?: number | "small" | "medium" | "large" | undefined;
8
9
  color?: string | undefined;
@@ -36,7 +36,7 @@ export let closeOnEscape = true;
36
36
 
37
37
  <div class="close-wrap">
38
38
  <IconButton
39
- color="invisible"
39
+ variant="invisible"
40
40
  on:click={() => show = false}
41
41
  >
42
42
  <IconX size={25} />
@@ -40,6 +40,7 @@ let input;
40
40
  on:mouseenter
41
41
  on:mouseleave
42
42
  on:change
43
+ on:input
43
44
  />
44
45
 
45
46
  {#if $$slots.end}
@@ -91,11 +92,19 @@ input {
91
92
  background: transparent;
92
93
  padding: 0;
93
94
  margin: 0;
95
+ color: inherit;
94
96
  }
95
97
  input:focus {
96
98
  outline: none;
97
99
  }
98
100
 
101
+ .input-wrap.size-x-small {
102
+ padding: 0 15px;
103
+ height: 26px;
104
+ font-size: 12px;
105
+ --local-shadow-size: 1px;
106
+ }
107
+
99
108
  .input-wrap.size-small {
100
109
  padding: 0 15px;
101
110
  height: 30px;
@@ -3,7 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  state?: "default" | "error" | "success" | "warning" | undefined;
6
- size?: "small" | "medium" | "large" | undefined;
6
+ size?: "small" | "medium" | "large" | "x-small" | undefined;
7
7
  block?: boolean | undefined;
8
8
  value?: any;
9
9
  };
@@ -18,6 +18,7 @@ declare const __propDef: {
18
18
  mouseenter: MouseEvent;
19
19
  mouseleave: MouseEvent;
20
20
  change: Event;
21
+ input: Event;
21
22
  } & {
22
23
  [evt: string]: CustomEvent<any>;
23
24
  };
@@ -3,33 +3,62 @@ export let block = false;
3
3
  export let rows = 5;
4
4
  export let cols = 40;
5
5
  export let state = "default";
6
+ let input;
6
7
  </script>
7
8
 
8
- <textarea
9
- bind:value={value}
10
9
 
11
- on:keyup
12
- on:keydown
13
- on:keypress
14
- on:focus
15
- on:blur
16
- on:click
17
- on:mouseover
18
- on:mouseenter
19
- on:mouseleave
20
- on:change
10
+ <span class="input-wrap state-{state}"
11
+ class:block
12
+ on:click={() => input.focus()}
13
+ on:keydown={(e) => {
14
+ if (e.key === 'Enter') {
15
+ input.blur();
16
+ }
17
+ }}
18
+ role="textbox"
19
+ tabindex="0"
20
+ >
21
21
 
22
- {rows}
23
- {cols}
22
+ {#if $$slots.start}
23
+ <span class="slot start"
24
+
25
+ >
26
+ <slot name="start" />
27
+ </span>
28
+ {/if}
24
29
 
25
- {...$$restProps}
30
+ <textarea
31
+ bind:value={value}
32
+ bind:this={input}
33
+
26
34
 
27
- class:block
28
- class="state-{state}"
35
+ on:keyup
36
+ on:keydown
37
+ on:keypress
38
+ on:focus
39
+ on:blur
40
+ on:click
41
+ on:mouseover
42
+ on:mouseenter
43
+ on:mouseleave
44
+ on:change
45
+ on:input
46
+
47
+ {rows}
48
+ {cols}
49
+
50
+ {...$$restProps}
29
51
 
30
- ></textarea>
52
+ ></textarea>
53
+
54
+ {#if $$slots.end}
55
+ <span class="slot end">
56
+ <slot name="end" />
57
+ </span>
58
+ {/if}
59
+ </span>
31
60
 
32
- <style>textarea {
61
+ <style>.input-wrap {
33
62
  padding: 10px 15px;
34
63
  background-color: var(--input);
35
64
  transition: 0.2s box-shadow;
@@ -39,40 +68,73 @@ export let state = "default";
39
68
  border: none;
40
69
  transition: 0.2s box-shadow;
41
70
  max-width: 100%;
71
+ color: inherit;
72
+ display: inline-flex;
73
+ resize: vertical;
74
+ overflow: auto;
75
+ align-items: flex-start;
76
+ justify-content: center;
42
77
  --local-shadow-size: 2px;
43
78
  }
44
-
45
- textarea:focus {
79
+ .input-wrap:focus-within {
80
+ outline: 0;
46
81
  box-shadow: 0 0 0 var(--local-shadow-size) var(--accent-light);
47
82
  }
48
83
 
49
- textarea.block {
84
+ .input-wrap.block {
50
85
  display: block;
51
86
  width: 100%;
52
87
  resize: vertical;
53
88
  }
54
89
 
55
- textarea:focus-visible {
90
+ .input-wrap:focus-visible {
56
91
  outline: 0;
57
92
  }
58
93
 
59
- textarea.state-error {
94
+ .input-wrap.state-error {
60
95
  box-shadow: 0 0 0 var(--local-shadow-size) var(--red-light);
61
96
  }
62
- textarea.state-error:focus {
97
+ .input-wrap.state-error:focus-within {
63
98
  box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--red-light);
64
99
  }
65
100
 
66
- textarea.state-success {
101
+ .input-wrap.state-success {
67
102
  box-shadow: 0 0 0 2px var(--green-light);
68
103
  }
69
- textarea.state-success:focus {
104
+ .input-wrap.state-success:focus-within {
70
105
  box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--green-light);
71
106
  }
72
107
 
73
- textarea.state-warning {
108
+ .input-wrap.state-warning {
74
109
  box-shadow: 0 0 0 2px var(--orange-light);
75
110
  }
76
- textarea.state-warning:focus {
111
+ .input-wrap.state-warning:focus-within {
77
112
  box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--orange-light);
113
+ }
114
+
115
+ .input-wrap .slot {
116
+ padding: 0 10px;
117
+ }
118
+
119
+ .input-wrap .slot.start {
120
+ margin-right: 10px;
121
+ }
122
+
123
+ .input-wrap .slot.end {
124
+ margin-left: 10px;
125
+ }
126
+
127
+ .input-wrap textarea {
128
+ flex: 1;
129
+ width: 100%;
130
+ border: none;
131
+ font-family: inherit;
132
+ font-size: inherit;
133
+ background: transparent;
134
+ padding: 0;
135
+ margin: 0;
136
+ resize: none;
137
+ }
138
+ .input-wrap textarea:focus {
139
+ outline: none;
78
140
  }</style>
@@ -19,10 +19,14 @@ declare const __propDef: {
19
19
  mouseenter: MouseEvent;
20
20
  mouseleave: MouseEvent;
21
21
  change: Event;
22
+ input: Event;
22
23
  } & {
23
24
  [evt: string]: CustomEvent<any>;
24
25
  };
25
- slots: {};
26
+ slots: {
27
+ start: {};
28
+ end: {};
29
+ };
26
30
  };
27
31
  export type TextareaProps = typeof __propDef.props;
28
32
  export type TextareaEvents = typeof __propDef.events;
@@ -44,7 +44,7 @@ function handleCopy() {
44
44
  <Tooltip text={emailCopied ? "Copied!" : "Copy email"} position="top">
45
45
  <IconButton
46
46
  size="small"
47
- color="invisible"
47
+ variant="invisible"
48
48
  on:click={handleCopy}
49
49
  on:mouseleave={() => emailCopied = false}
50
50
  >
@@ -66,7 +66,7 @@ export let darkToggle = true;
66
66
  <span class="mobile-nav-wrap">
67
67
  <Dropdown align="end" width={300}>
68
68
  <IconButton
69
- color="invisible"
69
+ variant="invisible"
70
70
  slot="trigger"
71
71
  >
72
72
  <IconList size={18} />
@@ -47,7 +47,7 @@
47
47
  --hover: #fafafa;
48
48
  --link: #1d85d2;
49
49
 
50
- --input: #e6e6e6;
50
+ --input: #f3f3f3;
51
51
  --input-hover: #ccc; /* checkbox/radio */
52
52
 
53
53
  --box-shadow: 0 0 30px #0000000d;
@@ -75,6 +75,8 @@
75
75
  --link: #7cb6e1;
76
76
  --hover: #232323;
77
77
 
78
+ --input: #333;
79
+
78
80
  }
79
81
 
80
82
  $breakpoint-xs: 320px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "scripts": {