@hyvor/design 0.0.29 → 0.0.31

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.
@@ -2,12 +2,13 @@
2
2
  export let size = "medium";
3
3
  export let color = "accent";
4
4
  export let block = false;
5
+ export let variant = "fill";
5
6
  export let align = "center";
6
7
  </script>
7
8
 
8
9
  <svelte:element
9
10
  this={as}
10
- class="button {size} {color} {align}"
11
+ class="button {size} {color} {variant} {align}"
11
12
  class:block={block}
12
13
 
13
14
  on:keyup
@@ -146,12 +147,172 @@ export let align = "center";
146
147
  }
147
148
 
148
149
  /* styles */
149
- .button.accent {
150
+ /* .button.accent {
151
+ background-color: var(--accent);
152
+ color: var(--accent-text);
153
+ transition: .2s box-shadow;
154
+ --local-hover-shadow-color: var(--accent-light);
155
+ } */
156
+ .button.fill.accent {
150
157
  background-color: var(--accent);
151
158
  color: var(--accent-text);
152
159
  transition: 0.2s box-shadow;
153
160
  --local-hover-shadow-color: var(--accent-light);
154
161
  }
162
+ .button.fill.gray {
163
+ background-color: var(--gray-light);
164
+ color: var(--gray-dark);
165
+ transition: 0.2s box-shadow;
166
+ --local-hover-shadow-color: color-mix(in srgb, var(--gray-light) 40%, transparent);
167
+ }
168
+ .button.fill.green {
169
+ background-color: var(--green-light);
170
+ color: var(--green-dark);
171
+ transition: 0.2s box-shadow;
172
+ --local-hover-shadow-color: color-mix(in srgb, var(--green-light) 40%, transparent);
173
+ }
174
+ .button.fill.red {
175
+ background-color: var(--red-light);
176
+ color: var(--red-dark);
177
+ transition: 0.2s box-shadow;
178
+ --local-hover-shadow-color: color-mix(in srgb, var(--red-light) 40%, transparent);
179
+ }
180
+ .button.fill.blue {
181
+ background-color: var(--blue-light);
182
+ color: var(--blue-dark);
183
+ transition: 0.2s box-shadow;
184
+ --local-hover-shadow-color: color-mix(in srgb, var(--blue-light) 40%, transparent);
185
+ }
186
+ .button.fill.orange {
187
+ background-color: var(--orange-light);
188
+ color: var(--orange-dark);
189
+ transition: 0.2s box-shadow;
190
+ --local-hover-shadow-color: color-mix(in srgb, var(--orange-light) 40%, transparent);
191
+ }
192
+ .button.outline {
193
+ border: 1px solid;
194
+ }
195
+ .button.outline.accent {
196
+ background-color: transparent;
197
+ border-color: var(--accent);
198
+ color: var(--accent);
199
+ transition: 0.2s box-shadow;
200
+ --local-hover-shadow-color: var(--accent-light);
201
+ }
202
+ .button.outline.gray {
203
+ background-color: transparent;
204
+ border-color: var(--gray-dark);
205
+ color: var(--gray-dark);
206
+ transition: 0.2s box-shadow;
207
+ --local-hover-shadow-color: var(--gray-light);
208
+ }
209
+ .button.outline.green {
210
+ background-color: transparent;
211
+ border-color: var(--green-dark);
212
+ color: var(--green-dark);
213
+ transition: 0.2s box-shadow;
214
+ --local-hover-shadow-color: var(--green-light);
215
+ }
216
+ .button.outline.red {
217
+ background-color: transparent;
218
+ border-color: var(--red-dark);
219
+ color: var(--red-dark);
220
+ transition: 0.2s box-shadow;
221
+ --local-hover-shadow-color: var(--red-light);
222
+ }
223
+ .button.outline.blue {
224
+ background-color: transparent;
225
+ border-color: var(--blue-dark);
226
+ color: var(--blue-dark);
227
+ transition: 0.2s box-shadow;
228
+ --local-hover-shadow-color: var(--blue-light);
229
+ }
230
+ .button.outline.orange {
231
+ background-color: transparent;
232
+ border-color: var(--orange-dark);
233
+ color: var(--orange-dark);
234
+ transition: 0.2s box-shadow;
235
+ --local-hover-shadow-color: var(--orange-light);
236
+ }
237
+ .button.outline-fill {
238
+ border: 1px solid;
239
+ }
240
+ .button.outline-fill.accent {
241
+ background-color: var(--accent-light);
242
+ border-color: var(--accent);
243
+ color: var(--accent);
244
+ transition: 0.2s box-shadow;
245
+ --local-hover-shadow-color: color-mix(in srgb, var(--accent-light) 40%, transparent);
246
+ }
247
+ .button.outline-fill.gray {
248
+ background-color: var(--gray-light);
249
+ border-color: var(--gray-dark);
250
+ color: var(--gray-dark);
251
+ transition: 0.2s box-shadow;
252
+ --local-hover-shadow-color: var(--gray-light);
253
+ }
254
+ .button.outline-fill.green {
255
+ background-color: var(--green-light);
256
+ border-color: var(--green-dark);
257
+ color: var(--green-dark);
258
+ transition: 0.2s box-shadow;
259
+ --local-hover-shadow-color: var(--green-light);
260
+ }
261
+ .button.outline-fill.red {
262
+ background-color: var(--red-light);
263
+ border-color: var(--red-dark);
264
+ color: var(--red-dark);
265
+ transition: 0.2s box-shadow;
266
+ --local-hover-shadow-color: var(--red-light);
267
+ }
268
+ .button.outline-fill.blue {
269
+ background-color: var(--blue-light);
270
+ border-color: var(--blue-dark);
271
+ color: var(--blue-dark);
272
+ transition: 0.2s box-shadow;
273
+ --local-hover-shadow-color: var(--blue-light);
274
+ }
275
+ .button.outline-fill.orange {
276
+ background-color: var(--orange-light);
277
+ border-color: var(--orange-dark);
278
+ color: var(--orange-dark);
279
+ transition: 0.2s box-shadow;
280
+ --local-hover-shadow-color: var(--orange-light);
281
+ }
282
+ .button.invisible {
283
+ background-color: transparent;
284
+ transition: 0.2s background-color;
285
+ }
286
+ .button.invisible.accent:hover {
287
+ background-color: var(--accent-light);
288
+ box-shadow: none !important;
289
+ color: var(--text-light);
290
+ }
291
+ .button.invisible.gray:hover {
292
+ background-color: var(--gray-light);
293
+ box-shadow: none !important;
294
+ color: var(--gray-dark);
295
+ }
296
+ .button.invisible.green:hover {
297
+ background-color: var(--green-light);
298
+ box-shadow: none !important;
299
+ color: var(--green-dark);
300
+ }
301
+ .button.invisible.red:hover {
302
+ background-color: var(--red-light);
303
+ box-shadow: none !important;
304
+ color: var(--red-dark);
305
+ }
306
+ .button.invisible.blue:hover {
307
+ background-color: var(--blue-light);
308
+ box-shadow: none !important;
309
+ color: var(--blue-dark);
310
+ }
311
+ .button.invisible.orange:hover {
312
+ background-color: var(--orange-light);
313
+ box-shadow: none !important;
314
+ color: var(--orange-dark);
315
+ }
155
316
 
156
317
  .button.soft {
157
318
  background-color: var(--accent-light);
@@ -4,8 +4,9 @@ declare const __propDef: {
4
4
  [x: string]: any;
5
5
  as?: "button" | "a" | undefined;
6
6
  size?: "small" | "medium" | "large" | "x-small" | undefined;
7
- color?: "danger" | "accent" | "soft" | "light" | "invisible" | undefined;
7
+ color?: "accent" | "gray" | "green" | "red" | "blue" | "orange" | undefined;
8
8
  block?: boolean | undefined;
9
+ variant?: "fill" | "outline" | "invisible" | "outline-fill" | undefined;
9
10
  align?: "start" | "center" | undefined;
10
11
  };
11
12
  events: {
@@ -0,0 +1,42 @@
1
+ <script>export let color = "#000000";
2
+ export let size = 30;
3
+ let inputEl;
4
+ function handleClick() {
5
+ inputEl.click();
6
+ }
7
+ </script>
8
+
9
+ <span>
10
+ <button
11
+ style:width="{size}px"
12
+ style:height="{size}px"
13
+ style:background-color={color}
14
+ on:click={handleClick}
15
+ ></button>
16
+
17
+ <input
18
+ type="color"
19
+ bind:value={color}
20
+ bind:this={inputEl}
21
+
22
+ on:change
23
+ on:input
24
+ />
25
+ </span>
26
+
27
+ <style>
28
+ span {
29
+ position: relative;
30
+ }
31
+ button {
32
+ border-radius: 50%;
33
+ }
34
+ input {
35
+ position: absolute;
36
+ left: 100%;
37
+ bottom: 50%;
38
+ transform: translate(0, 50%);
39
+ width: 0;
40
+ opacity: 0;
41
+ }
42
+ </style>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ color?: string | undefined;
5
+ size?: number | undefined;
6
+ };
7
+ events: {
8
+ change: Event;
9
+ input: Event;
10
+ } & {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ };
15
+ export type ColorPickerProps = typeof __propDef.props;
16
+ export type ColorPickerEvents = typeof __propDef.events;
17
+ export type ColorPickerSlots = typeof __propDef.slots;
18
+ export default class ColorPicker extends SvelteComponent<ColorPickerProps, ColorPickerEvents, ColorPickerSlots> {
19
+ }
20
+ export {};
@@ -4,7 +4,7 @@ declare const __propDef: {
4
4
  [x: string]: any;
5
5
  size?: number | "small" | "medium" | "large" | undefined;
6
6
  color?: "accent" | "gray" | "green" | "red" | "blue" | "orange" | undefined;
7
- variant?: "invisible" | "fill" | "outline" | "outline-fill" | undefined;
7
+ variant?: "fill" | "outline" | "invisible" | "outline-fill" | undefined;
8
8
  as?: "button" | "a" | undefined;
9
9
  };
10
10
  events: {
@@ -9,7 +9,7 @@ export let size = "medium";
9
9
  export let state = "loading";
10
10
  export let duration = 2e3;
11
11
  $: {
12
- if (state === "success" || state === "error") {
12
+ if (duration && (state === "success" || state === "error")) {
13
13
  setTimeout(() => {
14
14
  state = "none";
15
15
  }, duration);
@@ -7,7 +7,7 @@ declare const __propDef: {
7
7
  padding?: number | "none" | "small" | "medium" | "large" | undefined;
8
8
  size?: number | "small" | "medium" | "large" | undefined;
9
9
  state?: "none" | "error" | "success" | "loading" | undefined;
10
- duration?: number | undefined;
10
+ duration?: number | null | undefined;
11
11
  color?: string | undefined;
12
12
  colorTrack?: string | undefined;
13
13
  invert?: boolean | undefined;
@@ -57,17 +57,18 @@ export let caption = "";
57
57
  padding-top: 0;
58
58
  padding-left: 15px;
59
59
  border-left: 2px solid var(--accent-light);
60
+ margin-bottom: 15px;
60
61
  }
61
62
 
62
63
  .left {
63
64
  padding: 15px;
64
65
  flex: 1;
65
- min-width: 200px;
66
66
  }
67
67
 
68
68
  .right {
69
69
  padding: 15px;
70
70
  flex: 3;
71
+ min-width: 0;
71
72
  }
72
73
 
73
74
  .caption-wrap {
@@ -65,7 +65,7 @@ let input;
65
65
  .input-wrap {
66
66
  display: inline-flex;
67
67
  align-items: center;
68
- height: 32px;
68
+ height: 30px;
69
69
  padding: 0 15px;
70
70
  border-radius: 20px;
71
71
  background: var(--input);
@@ -100,21 +100,21 @@ input:focus {
100
100
 
101
101
  .input-wrap.size-x-small {
102
102
  padding: 0 15px;
103
- height: 26px;
103
+ height: 20px;
104
104
  font-size: 12px;
105
105
  --local-shadow-size: 1px;
106
106
  }
107
107
 
108
108
  .input-wrap.size-small {
109
109
  padding: 0 15px;
110
- height: 30px;
110
+ height: 26px;
111
111
  font-size: 12px;
112
112
  --local-shadow-size: 1px;
113
113
  }
114
114
 
115
115
  .input-wrap.size-large {
116
116
  padding: 0 20px;
117
- height: 40px;
117
+ height: 36px;
118
118
  font-size: 16px;
119
119
  }
120
120
 
@@ -107,6 +107,7 @@ onMount(() => {
107
107
  padding: 8px 20px;
108
108
  border-radius: 20px;
109
109
  font-size: 14px;
110
+ z-index: 10000;
110
111
  }
111
112
 
112
113
  .tooltip:after {
@@ -10,6 +10,7 @@ export { default as ButtonGroup } from './Button/ButtonGroup.svelte';
10
10
  export { default as Callout } from './Callout/Callout.svelte';
11
11
  export { default as Checkbox } from './Checkbox/Checkbox.svelte';
12
12
  export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
13
+ export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
13
14
  export { default as DarkToggle } from './Dark/DarkToggle.svelte';
14
15
  export { default as Dropdown } from './Dropdown/Dropdown.svelte';
15
16
  export { default as Divider } from './Divider/Divider.svelte';
@@ -10,6 +10,7 @@ export { default as ButtonGroup } from './Button/ButtonGroup.svelte';
10
10
  export { default as Callout } from './Callout/Callout.svelte';
11
11
  export { default as Checkbox } from './Checkbox/Checkbox.svelte';
12
12
  export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
13
+ export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
13
14
  export { default as DarkToggle } from './Dark/DarkToggle.svelte';
14
15
  export { default as Dropdown } from './Dropdown/Dropdown.svelte';
15
16
  export { default as Divider } from './Divider/Divider.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "scripts": {
@@ -28,9 +28,9 @@
28
28
  "!dist/**/*.spec.*"
29
29
  ],
30
30
  "peerDependencies": {
31
- "svelte": "^4.0.0",
32
31
  "@sveltejs/kit": "^2.0.0",
33
- "sass": "^1.68.0"
32
+ "sass": "^1.68.0",
33
+ "svelte": "^4.0.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@sveltejs/adapter-static": "^3.0.0",
@@ -45,11 +45,11 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@fontsource/readex-pro": "^5.0.8",
48
- "highlight.js": "^11.9.0",
49
- "@hyvor/icons": "^0.0.3"
48
+ "@hyvor/icons": "^0.0.3",
49
+ "highlight.js": "^11.9.0"
50
50
  },
51
51
  "type": "module",
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  }
55
- }
55
+ }