@hyvor/design 0.0.34 → 0.0.35

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.
@@ -25,6 +25,8 @@ function handleClick() {
25
25
  }
26
26
  }}
27
27
  {...$$restProps}
28
+
29
+ on:click
28
30
  >
29
31
 
30
32
  {#if selection !== 'none'}
@@ -7,6 +7,7 @@ declare const __propDef: {
7
7
  type?: "default" | "danger" | undefined;
8
8
  };
9
9
  events: {
10
+ click: MouseEvent;
10
11
  select: CustomEvent<any>;
11
12
  } & {
12
13
  [evt: string]: CustomEvent<any>;
@@ -149,13 +149,6 @@ export let button = {};
149
149
  --local-hover-shadow-size: 5px;
150
150
  }
151
151
 
152
- /* styles */
153
- /* .button.accent {
154
- background-color: var(--accent);
155
- color: var(--accent-text);
156
- transition: .2s box-shadow;
157
- --local-hover-shadow-color: var(--accent-light);
158
- } */
159
152
  .button.fill.accent {
160
153
  background-color: var(--accent);
161
154
  color: var(--accent-text);
@@ -163,30 +156,72 @@ export let button = {};
163
156
  --local-hover-shadow-color: var(--accent-light);
164
157
  }
165
158
  .button.fill.gray {
159
+ background-color: var(--gray-dark);
160
+ color: var(--text-white);
161
+ transition: 0.2s box-shadow;
162
+ --local-hover-shadow-color: var(--gray-light);
163
+ }
164
+ .button.fill.green {
165
+ background-color: var(--green-dark);
166
+ color: var(--text-white);
167
+ transition: 0.2s box-shadow;
168
+ --local-hover-shadow-color: var(--green-light);
169
+ }
170
+ .button.fill.red {
171
+ background-color: var(--red-dark);
172
+ color: var(--text-white);
173
+ transition: 0.2s box-shadow;
174
+ --local-hover-shadow-color: var(--red-light);
175
+ }
176
+ .button.fill.blue {
177
+ background-color: var(--blue-dark);
178
+ color: var(--text-white);
179
+ transition: 0.2s box-shadow;
180
+ --local-hover-shadow-color: var(--blue-light);
181
+ }
182
+ .button.fill.orange {
183
+ background-color: var(--orange-dark);
184
+ color: var(--text-white);
185
+ transition: 0.2s box-shadow;
186
+ --local-hover-shadow-color: var(--orange-light);
187
+ }
188
+ .button.fill.input {
189
+ background-color: var(--input);
190
+ color: var(--text);
191
+ transition: 0.2s box-shadow;
192
+ --local-hover-shadow-color: var(--input-hover);
193
+ }
194
+ .button.fill-light.accent {
195
+ background-color: var(--accent-light);
196
+ color: var(--accent);
197
+ transition: 0.2s box-shadow;
198
+ --local-hover-shadow-color: var(--accent-lightest);
199
+ }
200
+ .button.fill-light.gray {
166
201
  background-color: var(--gray-light);
167
202
  color: var(--gray-dark);
168
203
  transition: 0.2s box-shadow;
169
204
  --local-hover-shadow-color: color-mix(in srgb, var(--gray-light) 40%, transparent);
170
205
  }
171
- .button.fill.green {
206
+ .button.fill-light.green {
172
207
  background-color: var(--green-light);
173
208
  color: var(--green-dark);
174
209
  transition: 0.2s box-shadow;
175
210
  --local-hover-shadow-color: color-mix(in srgb, var(--green-light) 40%, transparent);
176
211
  }
177
- .button.fill.red {
212
+ .button.fill-light.red {
178
213
  background-color: var(--red-light);
179
214
  color: var(--red-dark);
180
215
  transition: 0.2s box-shadow;
181
216
  --local-hover-shadow-color: color-mix(in srgb, var(--red-light) 40%, transparent);
182
217
  }
183
- .button.fill.blue {
218
+ .button.fill-light.blue {
184
219
  background-color: var(--blue-light);
185
220
  color: var(--blue-dark);
186
221
  transition: 0.2s box-shadow;
187
222
  --local-hover-shadow-color: color-mix(in srgb, var(--blue-light) 40%, transparent);
188
223
  }
189
- .button.fill.orange {
224
+ .button.fill-light.orange {
190
225
  background-color: var(--orange-light);
191
226
  color: var(--orange-dark);
192
227
  transition: 0.2s box-shadow;
@@ -316,19 +351,10 @@ export let button = {};
316
351
  box-shadow: none !important;
317
352
  color: var(--orange-dark);
318
353
  }
319
-
320
- .button.soft {
321
- background-color: var(--accent-light);
322
- color: var(--accent);
323
- transition: 0.2s box-shadow;
324
- --local-hover-shadow-color: #eee;
325
- }
326
-
327
- .button.light {
328
- background-color: #f5f5f5;
354
+ .button.invisible.input:hover {
355
+ background-color: var(--input);
356
+ box-shadow: none !important;
329
357
  color: var(--text);
330
- transition: 0.2s box-shadow;
331
- --local-hover-shadow-color: var(--accent-light);
332
358
  }
333
359
 
334
360
  :global(:root.dark) .button.light {
@@ -345,13 +371,6 @@ export let button = {};
345
371
  box-shadow: none !important;
346
372
  }
347
373
 
348
- .button.danger {
349
- background-color: var(--red-dark);
350
- color: var(--text-white);
351
- transition: 0.2s box-shadow;
352
- --local-hover-shadow-color: var(--red-light);
353
- }
354
-
355
374
  /*Styles for button disabled state*/
356
375
  .button[disabled] {
357
376
  cursor: not-allowed;
@@ -4,9 +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?: "accent" | "gray" | "green" | "red" | "blue" | "orange" | undefined;
7
+ color?: "input" | "accent" | "gray" | "green" | "red" | "blue" | "orange" | undefined;
8
8
  block?: boolean | undefined;
9
- variant?: "fill" | "outline" | "invisible" | "outline-fill" | undefined;
9
+ variant?: "fill" | "fill-light" | "outline" | "invisible" | "outline-fill" | undefined;
10
10
  align?: "start" | "center" | undefined;
11
11
  button?: HTMLButtonElement | HTMLAnchorElement | undefined;
12
12
  };
@@ -2,11 +2,27 @@
2
2
  import { IconX } from "@hyvor/icons";
3
3
  import IconButton from "./../IconButton/IconButton.svelte";
4
4
  import { scale } from "svelte/transition";
5
+ import { onMount, tick } from "svelte";
5
6
  export let show = false;
6
7
  export let title = "";
7
8
  export let size = "medium";
8
9
  export let closeOnOutsideClick = true;
9
10
  export let closeOnEscape = true;
11
+ let wrapEl;
12
+ let innerEl;
13
+ async function setFlex() {
14
+ await tick();
15
+ if (!wrapEl || !innerEl)
16
+ return;
17
+ if (innerEl.offsetHeight > wrapEl.offsetHeight - 60) {
18
+ wrapEl.style.alignItems = "flex-start";
19
+ } else {
20
+ wrapEl.style.alignItems = "center";
21
+ }
22
+ }
23
+ onMount(setFlex);
24
+ $:
25
+ show, setFlex();
10
26
  </script>
11
27
 
12
28
  <svelte:window on:keyup={e => {
@@ -17,7 +33,10 @@ export let closeOnEscape = true;
17
33
 
18
34
 
19
35
  {#if show}
20
- <div class="wrap">
36
+ <div
37
+ class="wrap"
38
+ bind:this={wrapEl}
39
+ >
21
40
 
22
41
  <div
23
42
  class="inner {size}"
@@ -26,6 +45,7 @@ export let closeOnEscape = true;
26
45
  callback: () => show = false
27
46
  }}
28
47
  in:scale={{duration: 100, start: 0.9, opacity: 0.9}}
48
+ bind:this={innerEl}
29
49
  >
30
50
 
31
51
  <div class="header">
@@ -77,6 +97,8 @@ export let closeOnEscape = true;
77
97
  display: flex;
78
98
  align-items: center;
79
99
  justify-content: center;
100
+ padding: 30px;
101
+ overflow: auto;
80
102
  }
81
103
 
82
104
  .inner {
@@ -85,8 +107,6 @@ export let closeOnEscape = true;
85
107
  box-shadow: var(--box-shadow);
86
108
  width: 650px;
87
109
  max-width: 100%;
88
- max-height: 100%;
89
- overflow: auto;
90
110
  position: relative;
91
111
  }
92
112
 
@@ -99,7 +119,6 @@ export let closeOnEscape = true;
99
119
 
100
120
  .header {
101
121
  padding: 20px 25px;
102
- border-bottom: 1px solid var(--box-border);
103
122
  display: flex;
104
123
  align-items: center;
105
124
  }
@@ -1,4 +1,5 @@
1
- <script>export let size = "medium";
1
+ <script>export let as = "span";
2
+ export let size = "medium";
2
3
  export let color = "default";
3
4
  export let interactive = false;
4
5
  export let outline = false;
@@ -9,15 +10,31 @@ let styleClass = "default";
9
10
  if (outline) {
10
11
  styleClass = fill ? "outline-fill" : "outline";
11
12
  }
13
+ let tabindex = interactive ? 0 : void 0;
12
14
  </script>
13
15
 
14
- <span
15
- class="color-{color} style-{styleClass} size-{size}"
16
+
17
+ <svelte:element
18
+ this={as}
19
+ role={interactive ? 'button' : undefined}
20
+ tabindex={tabindex}
21
+ class="button color-{color} style-{styleClass} size-{size}"
16
22
  class:interactive
17
23
  class:has-start={$$slots.start}
18
24
  class:has-end={$$slots.end}
19
25
  {...$$restProps}
20
26
 
27
+ on:keyup
28
+ on:keydown
29
+ on:keypress
30
+ on:focus
31
+ on:blur
32
+ on:click
33
+ on:mouseover
34
+ on:mouseenter
35
+ on:mouseleave
36
+ on:change
37
+
21
38
  style:background-color={bg}
22
39
  style:color={fg}
23
40
  >
@@ -32,7 +49,10 @@ if (outline) {
32
49
  <slot name="end" />
33
50
  {/if}
34
51
 
35
- </span>
52
+ </svelte:element>
53
+
54
+
55
+
36
56
 
37
57
  <style>span {
38
58
  vertical-align: middle;
@@ -157,4 +177,10 @@ span.style-outline-fill.color-orange {
157
177
  background-color: var(--orange-light);
158
178
  color: var(--orange-dark);
159
179
  border: 1px solid var(--orange-dark);
180
+ }
181
+
182
+ .button[disabled] {
183
+ opacity: 0.5 !important;
184
+ cursor: not-allowed;
185
+ box-shadow: none !important;
160
186
  }</style>
@@ -2,6 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ as?: "span" | "button" | "a" | undefined;
5
6
  size?: "small" | "medium" | "large" | "x-small" | undefined;
6
7
  color?: "default" | "accent" | "green" | "red" | "blue" | "orange" | undefined;
7
8
  interactive?: boolean | undefined;
@@ -11,6 +12,17 @@ declare const __propDef: {
11
12
  fg?: string | undefined;
12
13
  };
13
14
  events: {
15
+ keyup: KeyboardEvent;
16
+ keydown: KeyboardEvent;
17
+ keypress: KeyboardEvent;
18
+ focus: FocusEvent;
19
+ blur: FocusEvent;
20
+ click: MouseEvent;
21
+ mouseover: MouseEvent;
22
+ mouseenter: MouseEvent;
23
+ mouseleave: MouseEvent;
24
+ change: Event;
25
+ } & {
14
26
  [evt: string]: CustomEvent<any>;
15
27
  };
16
28
  slots: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "scripts": {