@djcali570/component-lib 0.0.9 → 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 +31 -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}
|
|
@@ -69,7 +77,7 @@
|
|
|
69
77
|
<!-- Y-axis labels -->
|
|
70
78
|
<div class="yaxis">
|
|
71
79
|
{#each yAxis as label, i}
|
|
72
|
-
<div class="yaxis__label" style="bottom: {(i / yAxis.length) * 100 - 2
|
|
80
|
+
<div class="yaxis__label" style="bottom: {(i / yAxis.length) * 100 - 3.2}%;">
|
|
73
81
|
{label}
|
|
74
82
|
</div>
|
|
75
83
|
{/each}
|
|
@@ -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:
|
|
151
|
+
font-family: inherit;
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
.chart5__layout__container {
|
|
@@ -156,16 +169,21 @@
|
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
.yaxis {
|
|
159
|
-
|
|
172
|
+
position: relative;
|
|
173
|
+
padding-right: 0.5em;
|
|
160
174
|
height: 100%;
|
|
161
|
-
width:
|
|
175
|
+
width: 1.2em;
|
|
176
|
+
box-sizing: border-box;
|
|
162
177
|
}
|
|
163
178
|
|
|
164
179
|
.yaxis__label {
|
|
165
180
|
position: absolute;
|
|
181
|
+
width: 100%;
|
|
166
182
|
text-align: right;
|
|
167
183
|
font-size: 0.9rem;
|
|
168
184
|
color: var(--chart5__yTextColor);
|
|
185
|
+
padding-right: 0.25em;
|
|
186
|
+
box-sizing: border-box;
|
|
169
187
|
}
|
|
170
188
|
|
|
171
189
|
.data-area {
|
|
@@ -230,24 +248,26 @@
|
|
|
230
248
|
.xaxis__container {
|
|
231
249
|
display: flex;
|
|
232
250
|
width: 100%;
|
|
251
|
+
height: 2em;
|
|
233
252
|
box-sizing: border-box;
|
|
234
253
|
padding-block: 0.5rem;
|
|
235
254
|
padding-inline: 0.5rem;
|
|
236
255
|
}
|
|
237
256
|
.xaxis {
|
|
238
257
|
display: grid;
|
|
239
|
-
min-height: 2rem;
|
|
240
258
|
flex: 1;
|
|
241
259
|
box-sizing: border-box;
|
|
242
260
|
}
|
|
243
261
|
|
|
244
262
|
.xaxis__label {
|
|
245
263
|
text-align: center;
|
|
246
|
-
font-size: 0.
|
|
264
|
+
font-size: 0.7rem;
|
|
247
265
|
color: var(--chart5__xTextColor);
|
|
248
266
|
}
|
|
249
267
|
.xaxis__dummy {
|
|
250
|
-
width:
|
|
251
|
-
|
|
268
|
+
width: 1.2em;
|
|
269
|
+
height: 100%;
|
|
270
|
+
padding-right: 0.5em;
|
|
271
|
+
box-sizing: border-box;
|
|
252
272
|
}
|
|
253
273
|
</style>
|
package/dist/Chart5.svelte.d.ts
CHANGED