sveltacular 0.0.30 → 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.
@@ -15,11 +15,12 @@ export let readonly = false;
15
15
  {#if $$slots.default}
16
16
  <FormLabel {id} {required}><slot /></FormLabel>
17
17
  {/if}
18
- <textarea {id} {placeholder} {rows} bind:value {required} {disabled} {readonly} />
18
+ <textarea wrap="soft" {id} {placeholder} {rows} bind:value {required} {disabled} {readonly} />
19
19
  </FormField>
20
20
 
21
21
  <style>textarea {
22
22
  width: 100%;
23
+ height: auto;
23
24
  padding: 0.5rem 1rem;
24
25
  border-radius: 0.25rem;
25
26
  border: 1px solid var(--form-input-border, black);
@@ -30,7 +31,8 @@ export let readonly = false;
30
31
  line-height: 1.25rem;
31
32
  transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, color 0.2s ease-in-out, fill 0.2s ease-in-out, stroke 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
32
33
  user-select: none;
33
- white-space: nowrap;
34
+ resize: vertical;
35
+ white-space: normal;
34
36
  }
35
37
  textarea::placeholder {
36
38
  color: var(--form-input-placeholder, #a0aec0);
@@ -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;
@@ -71,7 +71,6 @@ $:
71
71
  z-index: 999;
72
72
  margin: 0;
73
73
  padding: 0;
74
- box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
75
74
  max-width: 100%;
76
75
  max-height: 15rem;
77
76
  overflow-y: auto;
@@ -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>;
@@ -2,9 +2,9 @@
2
2
  export let dateType = "datetime";
3
3
  export let dateStyle = "medium";
4
4
  export let iconSize = "md";
5
- export let date;
6
- export let title;
7
- export let summary;
5
+ export let date = void 0;
6
+ export let title = void 0;
7
+ export let summary = void 0;
8
8
  </script>
9
9
 
10
10
  <li class="icon-{iconSize}">
@@ -12,15 +12,21 @@ export let summary;
12
12
  <slot name="icon" />
13
13
  </div>
14
14
  <div class="content">
15
- <div class="date">
16
- <DateTime value={date} type={dateType} style={dateStyle} />
17
- </div>
18
- <div class="title">
19
- {title}
20
- </div>
21
- <div class="summary">
22
- {summary}
23
- </div>
15
+ {#if date}
16
+ <div class="date">
17
+ <DateTime value={date} type={dateType} style={dateStyle} />
18
+ </div>
19
+ {/if}
20
+ {#if title}
21
+ <div class="title">
22
+ {title}
23
+ </div>
24
+ {/if}
25
+ {#if summary}
26
+ <div class="summary">
27
+ {summary}
28
+ </div>
29
+ {/if}
24
30
  </div>
25
31
  </li>
26
32
 
@@ -29,7 +35,7 @@ export let summary;
29
35
  position: relative;
30
36
  }
31
37
  li .content {
32
- padding-left: 1rem;
38
+ padding-left: 1.25rem;
33
39
  padding-top: 0.25rem;
34
40
  }
35
41
  li .content .date {
@@ -67,6 +73,7 @@ li .timeline-icon {
67
73
  left: -0.75rem;
68
74
  }
69
75
  li.icon-sm .content {
76
+ padding-left: 1rem;
70
77
  padding-top: 0;
71
78
  }
72
79
  li.icon-sm .timeline-icon {
@@ -5,9 +5,9 @@ declare const __propDef: {
5
5
  dateType?: DateType | undefined;
6
6
  dateStyle?: DateTimeStyle | undefined;
7
7
  iconSize?: "sm" | "md" | "lg" | undefined;
8
- date: string | number | Date;
9
- title: string;
10
- summary: string;
8
+ date?: string | number | Date | undefined;
9
+ title?: string | undefined;
10
+ summary?: string | undefined;
11
11
  };
12
12
  events: {
13
13
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltacular",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "scripts": {
5
5
  "watch": "npm run dev -- --open",
6
6
  "dev": "vite dev",