@djcali570/component-lib 0.0.10 → 0.0.12

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 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
- {/Snippet}
55
+ {/snippet}
27
56
  </Accordion5>
28
57
  ```
29
58
 
@@ -43,10 +72,18 @@ 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
  ```
87
+
88
+ # Updates
89
+ 0.0.12 - Made all components colorScheme properties optional.
@@ -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="Value: {data} for {labels[i]}"
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, sans-serif, Helvetica;
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
- position: relative;
172
+ position: relative;
160
173
  padding-right: 0.5em;
161
174
  height: 100%;
162
175
  width: 1.2em;
163
- box-sizing: border-box;
176
+ box-sizing: border-box;
164
177
  }
165
178
 
166
179
  .yaxis__label {
167
180
  position: absolute;
168
- width: 100%;
181
+ width: 100%;
169
182
  text-align: right;
170
183
  font-size: 0.9rem;
171
184
  color: var(--chart5__yTextColor);
172
- padding-right: 0.25em;
173
- box-sizing: border-box;
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.9rem;
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>
@@ -1,6 +1,8 @@
1
+ import type { Snippet } from 'svelte';
1
2
  import type { Chart5ColorScheme } from './types.js';
2
3
  type $$ComponentProps = {
3
4
  colorScheme?: Partial<Chart5ColorScheme>;
5
+ title?: Snippet;
4
6
  maxWidth?: string;
5
7
  height?: string;
6
8
  labels?: string[];
@@ -40,7 +40,7 @@
40
40
  inputTextColor: '#D6D6D6',
41
41
  inputBgColor: '#121212',
42
42
  inputBorderColor: '#262626',
43
- inputFocusedBorderColor: '#4787ac',
43
+ inputFocusedBorderColor: '#5ac1dd',
44
44
  inputClearColor: '#989A9A',
45
45
  inputClearHoverColor: '#1F2023',
46
46
  placeholderColor: '#46464A',
@@ -49,7 +49,7 @@
49
49
  pickerTextColor: '#D6D6D6',
50
50
  pickerInactiveDayColor: '#46464A',
51
51
  pickerTodayColor: '#BF3131',
52
- pickerSelectedDayBgColor: '#4787ac',
52
+ pickerSelectedDayBgColor: '#5ac1dd',
53
53
  pickerSelectedDayTextColor: '#121212',
54
54
  pickerChevronHoverColor: '#1F2023',
55
55
  pickerMaxHeight: '340px'
@@ -32,9 +32,9 @@
32
32
  borderColor: '#262626',
33
33
  titleColor: '#989A9A',
34
34
  dropdownBgColor: '#141414',
35
- focusedColor: '#4787ac',
35
+ focusedColor: '#5ac1dd',
36
36
  itemTextColor: '#D6D6D6',
37
- itemHoverBgColor: '#4787ac',
37
+ itemHoverBgColor: '#5ac1dd',
38
38
  itemHoverTextColor: '#121212'
39
39
  };
40
40
 
@@ -49,10 +49,10 @@
49
49
  mainBgColor: '#121212',
50
50
  titleColor: '#989A9A',
51
51
  borderColor: '#262626',
52
- focusedColor: '#4787ac',
52
+ focusedColor: '#5ac1dd',
53
53
  clearColor: '#989A9A',
54
54
  clearHoverColor: '#1F2023',
55
- counterTextColor: '#4787ac',
55
+ counterTextColor: '#5ac1dd',
56
56
  counterBgColor: '#1F2023'
57
57
  };
58
58
 
@@ -33,7 +33,7 @@
33
33
  textColor: '#D6D6D6',
34
34
  bgColor: '#121212',
35
35
  borderColor: '#262626',
36
- focusedColor: '#4787ac',
36
+ focusedColor: '#5ac1dd',
37
37
  titleColor: '#989A9A',
38
38
  clearColor: '#989A9A',
39
39
  clearHoverColor: '#1F2023',
package/dist/types.d.ts CHANGED
@@ -1,43 +1,43 @@
1
1
  import type { Component } from "svelte";
2
2
  export interface Input5ColorScheme {
3
- mainTextColor: string;
4
- mainBgColor: string;
5
- titleColor: string;
6
- borderColor: string;
7
- focusedColor: string;
8
- clearColor: string;
9
- clearHoverColor: string;
10
- counterTextColor: string;
11
- counterBgColor: string;
3
+ mainTextColor?: string;
4
+ mainBgColor?: string;
5
+ titleColor?: string;
6
+ borderColor?: string;
7
+ focusedColor?: string;
8
+ clearColor?: string;
9
+ clearHoverColor?: string;
10
+ counterTextColor?: string;
11
+ counterBgColor?: string;
12
12
  }
13
13
  export interface DatePicker5ColorScheme {
14
- labelTextColor: string;
15
- inputTextColor: string;
16
- inputBgColor: string;
17
- inputBorderColor: string;
18
- inputFocusedBorderColor: string;
19
- inputClearColor: string;
20
- inputClearHoverColor: string;
21
- placeholderColor: string;
22
- pickerBgColor: string;
23
- pickerMonthBgColor: string;
24
- pickerTextColor: string;
25
- pickerInactiveDayColor: string;
26
- pickerTodayColor: string;
27
- pickerSelectedDayBgColor: string;
28
- pickerSelectedDayTextColor: string;
29
- pickerChevronHoverColor: string;
30
- pickerMaxHeight: string;
14
+ labelTextColor?: string;
15
+ inputTextColor?: string;
16
+ inputBgColor?: string;
17
+ inputBorderColor?: string;
18
+ inputFocusedBorderColor?: string;
19
+ inputClearColor?: string;
20
+ inputClearHoverColor?: string;
21
+ placeholderColor?: string;
22
+ pickerBgColor?: string;
23
+ pickerMonthBgColor?: string;
24
+ pickerTextColor?: string;
25
+ pickerInactiveDayColor?: string;
26
+ pickerTodayColor?: string;
27
+ pickerSelectedDayBgColor?: string;
28
+ pickerSelectedDayTextColor?: string;
29
+ pickerChevronHoverColor?: string;
30
+ pickerMaxHeight?: string;
31
31
  }
32
32
  export interface TimePicker5ColorScheme {
33
- textColor: string;
34
- bgColor: string;
35
- borderColor: string;
36
- focusedColor: string;
37
- titleColor: string;
38
- clearColor: string;
39
- clearHoverColor: string;
40
- dropdownBgColor: string;
33
+ textColor?: string;
34
+ bgColor?: string;
35
+ borderColor?: string;
36
+ focusedColor?: string;
37
+ titleColor?: string;
38
+ clearColor?: string;
39
+ clearHoverColor?: string;
40
+ dropdownBgColor?: string;
41
41
  }
42
42
  export interface Accordion5ColorScheme {
43
43
  bgColor?: string;
@@ -49,12 +49,12 @@ export interface DropDown5ColorScheme {
49
49
  bgColor?: string;
50
50
  textColor?: string;
51
51
  borderColor?: string;
52
- titleColor: string;
53
- dropdownBgColor: string;
54
- focusedColor: string;
55
- itemTextColor: string;
56
- itemHoverBgColor: string;
57
- itemHoverTextColor: string;
52
+ titleColor?: string;
53
+ dropdownBgColor?: string;
54
+ focusedColor?: string;
55
+ itemTextColor?: string;
56
+ itemHoverBgColor?: string;
57
+ itemHoverTextColor?: string;
58
58
  }
59
59
  export interface DropDownItem<TProps extends Record<string, any> = {}> {
60
60
  id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djcali570/component-lib",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",