sveltacular 0.0.31 → 0.0.32

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.
@@ -20,6 +20,7 @@ const onClick = () => {
20
20
 
21
21
  <style>li {
22
22
  display: inline-block;
23
+ vertical-align: top;
23
24
  position: relative;
24
25
  width: 100%;
25
26
  margin-right: 1rem;
@@ -39,7 +40,6 @@ li[role=link] {
39
40
  }
40
41
  li[role=link]:hover {
41
42
  transform: translateY(-0.25rem);
42
- box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
43
43
  }
44
44
  li.sm {
45
45
  max-width: 15rem;
@@ -1,29 +1,91 @@
1
- <script>export let value;
1
+ <script>import { navigateTo } from "../../index.js";
2
+ export let value;
3
+ export let caption = "below";
4
+ export let href = void 0;
5
+ const onClick = () => {
6
+ if (!href)
7
+ return;
8
+ navigateTo(href);
9
+ };
10
+ $:
11
+ formattedValue = typeof value === "number" ? value.toLocaleString() : value;
12
+ $:
13
+ isLink = !!href;
2
14
  </script>
3
15
 
4
- <figure>
5
- <div>{value}</div>
6
- <figcaption><slot /></figcaption>
7
- </figure>
16
+ <button on:click={onClick} class:isLink>
17
+ <figure class={caption}>
18
+ <span class="value">{formattedValue}</span>
19
+ <figcaption><slot /></figcaption>
20
+ </figure>
21
+ </button>
8
22
 
9
- <style>figure {
23
+ <style>button {
10
24
  display: inline-block;
11
- text-align: center;
25
+ margin-right: 1rem;
26
+ padding: 0;
27
+ border: none;
28
+ background: none;
29
+ font-family: var(--base-font-family, sans-serif);
30
+ appearance: none;
31
+ transition: transform 0.2s ease-in-out;
32
+ user-select: text;
33
+ }
34
+ button.isLink {
35
+ cursor: pointer;
36
+ }
37
+ button.isLink:hover {
38
+ transform: translateY(-0.25rem);
39
+ }
40
+ button figure {
41
+ min-width: 6rem;
42
+ margin: 0;
43
+ display: flex;
44
+ gap: 0.5rem;
12
45
  background: #fff;
13
46
  border-radius: 0.25rem;
14
47
  padding: 1rem;
15
48
  box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.1);
16
49
  font-family: sans-serif;
17
- min-width: 6rem;
18
50
  font-family: var(--base-font-family, sans-serif);
51
+ text-align: center;
19
52
  }
20
- figure div {
53
+ button figure .value {
21
54
  font-size: 2.5rem;
22
55
  font-weight: 500;
23
56
  color: #000;
57
+ flex-grow: 1;
24
58
  }
25
- figure figcaption {
59
+ button figure figcaption {
26
60
  font-size: 0.875rem;
27
61
  font-weight: 300;
28
62
  color: #4a5568;
63
+ }
64
+ button figure.above {
65
+ flex-direction: column-reverse;
66
+ align-items: center;
67
+ justify-content: center;
68
+ text-align: center;
69
+ gap: 0.5rem;
70
+ }
71
+ button figure.below {
72
+ flex-direction: column;
73
+ align-items: center;
74
+ justify-content: center;
75
+ text-align: center;
76
+ gap: 0.5rem;
77
+ }
78
+ button figure.left {
79
+ flex-direction: row-reverse;
80
+ align-items: center;
81
+ justify-content: center;
82
+ text-align: left;
83
+ gap: 0.5rem;
84
+ }
85
+ button figure.right {
86
+ flex-direction: row;
87
+ align-items: center;
88
+ justify-content: center;
89
+ text-align: right;
90
+ gap: 0.5rem;
29
91
  }</style>
@@ -2,6 +2,8 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  value: string | number;
5
+ caption?: "above" | "below" | "left" | "right" | undefined;
6
+ href?: string | undefined;
5
7
  };
6
8
  events: {
7
9
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltacular",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "scripts": {
5
5
  "watch": "npm run dev -- --open",
6
6
  "dev": "vite dev",