@djcali570/component-lib 0.0.10 → 0.0.11
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.
- package/README.md +39 -5
- package/dist/Chart5.svelte +26 -11
- package/dist/Chart5.svelte.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,36 @@
|
|
|
1
1
|
# DJCali570 Svelte 5 Component Library
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
Components make use of Svelte's runes so will only work with Svelte 5
|
|
5
4
|
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
Use default or customize the input color scheme
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
import { Input5 } from '@djcali570/component-lib';
|
|
11
|
+
import type { Input5ColorScheme } from '@djcali570/component-lib';
|
|
12
|
+
|
|
13
|
+
let ics: Input5ColorScheme = {
|
|
14
|
+
mainTextColor: '#D6D6D6',
|
|
15
|
+
mainBgColor: '#121212',
|
|
16
|
+
titleColor: '#989A9A'
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
#### Features
|
|
21
|
+
- Counter
|
|
22
|
+
- readonly / disabled options
|
|
23
|
+
- onUpdate Callback
|
|
24
|
+
- types: Text, Number or Password
|
|
25
|
+
- Input formatting
|
|
26
|
+
- Input or Textarea
|
|
27
|
+
|
|
28
|
+
### Use of the Input component
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
<Input5 title="Input Title" colorScheme={ics} validator="phone" />
|
|
32
|
+
```
|
|
33
|
+
|
|
6
34
|
## Accordion
|
|
7
35
|
|
|
8
36
|
Use default or customize the accordion color scheme
|
|
@@ -18,12 +46,13 @@ let acs: Accordion5ColorScheme = {
|
|
|
18
46
|
}
|
|
19
47
|
```
|
|
20
48
|
|
|
21
|
-
Use of the Accordion component
|
|
49
|
+
### Use of the Accordion component
|
|
50
|
+
|
|
22
51
|
```
|
|
23
52
|
<Accordion5 colorScheme={acs} title='My Title'>
|
|
24
53
|
{#snippet panel()}
|
|
25
54
|
<p>Accordion Contents</p>
|
|
26
|
-
{/
|
|
55
|
+
{/snippet}
|
|
27
56
|
</Accordion5>
|
|
28
57
|
```
|
|
29
58
|
|
|
@@ -43,10 +72,15 @@ let ccs: Chart5ColorScheme = {
|
|
|
43
72
|
}
|
|
44
73
|
```
|
|
45
74
|
|
|
46
|
-
Use of the Chart component
|
|
75
|
+
### Use of the Chart component
|
|
76
|
+
|
|
47
77
|
```
|
|
48
78
|
let labels: string[] = ['Label1', 'label2'];
|
|
49
79
|
let values: number[] = [35, 20];
|
|
50
80
|
|
|
51
|
-
<Chart5 {labels} {values} colorScheme={ccs} height="300px"
|
|
81
|
+
<Chart5 {labels} {values} colorScheme={ccs} height="300px">
|
|
82
|
+
{#snippet title()}
|
|
83
|
+
<p>My Title</p>
|
|
84
|
+
{/snippet}
|
|
85
|
+
</Chart5>
|
|
52
86
|
```
|
package/dist/Chart5.svelte
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { Chart5ColorScheme } from './types.js';
|
|
3
4
|
|
|
4
5
|
let {
|
|
5
6
|
colorScheme: partialColorScheme = {},
|
|
7
|
+
title,
|
|
6
8
|
maxWidth = '400px',
|
|
7
9
|
height = '400px',
|
|
8
10
|
labels = [],
|
|
9
11
|
values = []
|
|
10
12
|
}: {
|
|
11
13
|
colorScheme?: Partial<Chart5ColorScheme>;
|
|
14
|
+
title?: Snippet;
|
|
12
15
|
maxWidth?: string;
|
|
13
16
|
height?: string;
|
|
14
17
|
labels?: string[];
|
|
@@ -16,7 +19,7 @@
|
|
|
16
19
|
} = $props();
|
|
17
20
|
|
|
18
21
|
const defaultColorScheme: Chart5ColorScheme = {
|
|
19
|
-
bgColor: '#121212',
|
|
22
|
+
bgColor: '#121212',
|
|
20
23
|
gridLineColor: '#303030',
|
|
21
24
|
xAxisTextColor: '#5ac1dd',
|
|
22
25
|
yAxisTextColor: '#5ac1dd'
|
|
@@ -58,9 +61,14 @@
|
|
|
58
61
|
--chart5__bgColor: {colorScheme.bgColor};
|
|
59
62
|
--chart5__glColor: {colorScheme.gridLineColor};
|
|
60
63
|
--chart5__yTextColor: {colorScheme.yAxisTextColor};
|
|
61
|
-
--chart5__xTextColor: {colorScheme.xAxisTextColor};
|
|
64
|
+
--chart5__xTextColor: {colorScheme.xAxisTextColor};
|
|
62
65
|
"
|
|
63
66
|
>
|
|
67
|
+
{#if title}
|
|
68
|
+
<div class="title">
|
|
69
|
+
{@render title()}
|
|
70
|
+
</div>
|
|
71
|
+
{/if}
|
|
64
72
|
{#if values.length === 0}
|
|
65
73
|
<div class="empty-state">No data available</div>
|
|
66
74
|
{:else}
|
|
@@ -92,7 +100,7 @@
|
|
|
92
100
|
<div
|
|
93
101
|
class="data-bar"
|
|
94
102
|
style="height: {(data / maxY) * highPct}%;"
|
|
95
|
-
title=
|
|
103
|
+
title={data.toString()}
|
|
96
104
|
></div>
|
|
97
105
|
</div>
|
|
98
106
|
{/each}
|
|
@@ -116,6 +124,11 @@
|
|
|
116
124
|
</div>
|
|
117
125
|
|
|
118
126
|
<style>
|
|
127
|
+
.title {
|
|
128
|
+
width: 100%;
|
|
129
|
+
padding: 0.5em;
|
|
130
|
+
box-sizing: border-box;
|
|
131
|
+
}
|
|
119
132
|
.empty-state {
|
|
120
133
|
display: flex;
|
|
121
134
|
justify-content: center;
|
|
@@ -135,7 +148,7 @@
|
|
|
135
148
|
flex-direction: column;
|
|
136
149
|
justify-content: center;
|
|
137
150
|
align-items: center;
|
|
138
|
-
font-family: inherit
|
|
151
|
+
font-family: inherit;
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
.chart5__layout__container {
|
|
@@ -156,21 +169,21 @@
|
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
.yaxis {
|
|
159
|
-
|
|
172
|
+
position: relative;
|
|
160
173
|
padding-right: 0.5em;
|
|
161
174
|
height: 100%;
|
|
162
175
|
width: 1.2em;
|
|
163
|
-
|
|
176
|
+
box-sizing: border-box;
|
|
164
177
|
}
|
|
165
178
|
|
|
166
179
|
.yaxis__label {
|
|
167
180
|
position: absolute;
|
|
168
|
-
|
|
181
|
+
width: 100%;
|
|
169
182
|
text-align: right;
|
|
170
183
|
font-size: 0.9rem;
|
|
171
184
|
color: var(--chart5__yTextColor);
|
|
172
|
-
|
|
173
|
-
|
|
185
|
+
padding-right: 0.25em;
|
|
186
|
+
box-sizing: border-box;
|
|
174
187
|
}
|
|
175
188
|
|
|
176
189
|
.data-area {
|
|
@@ -235,24 +248,26 @@
|
|
|
235
248
|
.xaxis__container {
|
|
236
249
|
display: flex;
|
|
237
250
|
width: 100%;
|
|
251
|
+
height: 2em;
|
|
238
252
|
box-sizing: border-box;
|
|
239
253
|
padding-block: 0.5rem;
|
|
240
254
|
padding-inline: 0.5rem;
|
|
241
255
|
}
|
|
242
256
|
.xaxis {
|
|
243
257
|
display: grid;
|
|
244
|
-
min-height: 2rem;
|
|
245
258
|
flex: 1;
|
|
246
259
|
box-sizing: border-box;
|
|
247
260
|
}
|
|
248
261
|
|
|
249
262
|
.xaxis__label {
|
|
250
263
|
text-align: center;
|
|
251
|
-
font-size: 0.
|
|
264
|
+
font-size: 0.7rem;
|
|
252
265
|
color: var(--chart5__xTextColor);
|
|
253
266
|
}
|
|
254
267
|
.xaxis__dummy {
|
|
255
268
|
width: 1.2em;
|
|
269
|
+
height: 100%;
|
|
256
270
|
padding-right: 0.5em;
|
|
271
|
+
box-sizing: border-box;
|
|
257
272
|
}
|
|
258
273
|
</style>
|
package/dist/Chart5.svelte.d.ts
CHANGED