@djcali570/component-lib 0.0.4 → 0.0.5

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,58 +1,9 @@
1
- # Svelte library
1
+ # DJCali570 Component Library
2
2
 
3
- Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
3
+ Components:
4
4
 
5
- Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
-
7
- ## Creating a project
8
-
9
- If you're seeing this, you've probably already done this step. Congrats!
10
-
11
- ```bash
12
- # create a new project in the current directory
13
- npx sv create
14
-
15
- # create a new project in my-app
16
- npx sv create my-app
17
- ```
18
-
19
- ## Developing
20
-
21
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22
-
23
- ```bash
24
- npm run dev
25
-
26
- # or start the server and open the app in a new browser tab
27
- npm run dev -- --open
28
- ```
29
-
30
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
-
32
- ## Building
33
-
34
- To build your library:
35
-
36
- ```bash
37
- npm run package
38
- ```
39
-
40
- To create a production version of your showcase app:
41
-
42
- ```bash
43
- npm run build
44
- ```
45
-
46
- You can preview the production build with `npm run preview`.
47
-
48
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
49
-
50
- ## Publishing
51
-
52
- Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53
-
54
- To publish your library to [npm](https://www.npmjs.com):
55
-
56
- ```bash
57
- npm publish
58
- ```
5
+ ### Date Picker
6
+ ### Time Picker
7
+ ### Input
8
+ ### Dropdown
9
+ ### Accordion
@@ -0,0 +1,147 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ // Define colorScheme type
5
+ interface Accordion5ColorScheme {
6
+ bgColor: string;
7
+ textColor: string;
8
+ triggerColor: string;
9
+ }
10
+
11
+ // Props with typed colorScheme
12
+ let {
13
+ colorScheme: partialColorScheme = {},
14
+ title = 'Title',
15
+ panel
16
+ }: {
17
+ colorScheme?: Partial<Accordion5ColorScheme>;
18
+ title?: string;
19
+ panel: Snippet;
20
+ } = $props();
21
+
22
+ // Default colorScheme
23
+ const defaultColorScheme: Accordion5ColorScheme = {
24
+ bgColor: '#121212',
25
+ textColor: '#D6D6D6',
26
+ triggerColor: '#D6D6D6'
27
+ };
28
+
29
+ // Merge partial colorScheme with defaults
30
+ const colorScheme = { ...defaultColorScheme, ...partialColorScheme };
31
+
32
+ let status = $state(false);
33
+ let panelHeight = $state('0px'); // Store dynamic height
34
+ let panelRef: HTMLDivElement | undefined = $state(); // Reference to inner panel
35
+
36
+ // Toggle panel and update height
37
+ function showPanel() {
38
+ status = !status;
39
+ if (status && panelRef) {
40
+ // Set max-height to content height when opening
41
+ panelHeight = `${panelRef.scrollHeight}px`;
42
+ } else {
43
+ // Reset to 0 when closing
44
+ panelHeight = '0px';
45
+ }
46
+ }
47
+
48
+ // Update height on content change (if panel content is dynamic)
49
+ $effect(() => {
50
+ if (status && panelRef) {
51
+ panelHeight = `${panelRef.scrollHeight}px`;
52
+ }
53
+ });
54
+ </script>
55
+
56
+ <div
57
+ class="accordion5"
58
+ style="
59
+ --acc5-bgColor: {colorScheme.bgColor};
60
+ --acc5-textColor: {colorScheme.textColor};
61
+ --acc5-triggerColor: {colorScheme.triggerColor};
62
+ "
63
+ >
64
+ <button onclick={showPanel}>
65
+ <div class="panel-head">
66
+ <div class="panel-title">
67
+ <div>{title}</div>
68
+ </div>
69
+ <div class="panel-head-icon-container">
70
+ <div class="panel-head-icon" class:open={status}>
71
+ <svg viewBox="0 0 200 200">
72
+ <path
73
+ fill="currentColor"
74
+ d="M96.5,63.4c1.9-1.9,5.1-1.9,7.1,0l65.8,65.8c1,1,1.5,2.2,1.5,3.5s-0.5,2.6-1.5,3.5c-1.9,1.9-5.1,1.9-7.1,0L100,74.1L37.5,136.6c-1.9,1.9-5.1,1.9-7.1,0c-0.9-1.1-1.4-2.3-1.4-3.6c0-1.3,0.5-2.6,1.5-3.5L96.5,63.4z"
75
+ />
76
+ </svg>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </button>
81
+ <div class="accPanel" class:open={status} style="max-height: {panelHeight}">
82
+ <div class="accPanel-inner" bind:this={panelRef}>
83
+ {@render panel()}
84
+ </div>
85
+ </div>
86
+ </div>
87
+
88
+ <style>
89
+ .accordion5 {
90
+ width: 100%;
91
+ max-width: 600px;
92
+ margin: 0 auto;
93
+ border-radius: 0.5rem;
94
+ background-color: var(--acc5-bgColor);
95
+ }
96
+
97
+ button {
98
+ width: 100%;
99
+ padding: 0.5rem;
100
+ font-size: 1rem;
101
+ cursor: pointer;
102
+ border: none;
103
+ text-align: left;
104
+ }
105
+
106
+ .panel-head {
107
+ width: 100%;
108
+ display: grid;
109
+ grid-template-columns: 1fr min-content;
110
+ }
111
+
112
+ .panel-title {
113
+ display: flex;
114
+ justify-content: flex-start;
115
+ align-items: center;
116
+ width: 100%;
117
+ height: 100%;
118
+ color: var(--acc5-textColor);
119
+ }
120
+
121
+ .panel-head-icon-container {
122
+ display: flex;
123
+ justify-content: center;
124
+ align-items: center;
125
+ width: 1.5rem;
126
+ height: 1.5rem;
127
+ }
128
+ .panel-head-icon {
129
+ width: 1.2rem;
130
+ height: 1.2rem;
131
+ color: var(--acc5-triggerColor);
132
+ transition: transform 400ms ease-in-out;
133
+ }
134
+
135
+ .accPanel {
136
+ overflow: hidden;
137
+ max-height: 0;
138
+ transition: max-height 400ms ease-in-out;
139
+ }
140
+
141
+ .accPanel-inner {
142
+ padding: 1rem;
143
+ }
144
+ .panel-head-icon.open {
145
+ transform: rotate(180deg);
146
+ }
147
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Accordion5ColorScheme {
3
+ bgColor: string;
4
+ textColor: string;
5
+ triggerColor: string;
6
+ }
7
+ type $$ComponentProps = {
8
+ colorScheme?: Partial<Accordion5ColorScheme>;
9
+ title?: string;
10
+ panel: Snippet;
11
+ };
12
+ declare const Accordion5: import("svelte").Component<$$ComponentProps, {}, "">;
13
+ type Accordion5 = ReturnType<typeof Accordion5>;
14
+ export default Accordion5;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ import DatePicker5 from "./DatePicker5.svelte";
2
2
  import DropDown5 from "./DropDown5.svelte";
3
3
  import Input5 from "./Input5.svelte";
4
4
  import TimePicker5 from "./TimePicker5.svelte";
5
- export { DatePicker5, Input5, DropDown5, TimePicker5 };
5
+ import Accordion5 from "./Accordion5.svelte";
6
+ export { DatePicker5, Input5, DropDown5, TimePicker5, Accordion5 };
package/dist/index.js CHANGED
@@ -3,4 +3,5 @@ import DatePicker5 from "./DatePicker5.svelte";
3
3
  import DropDown5 from "./DropDown5.svelte";
4
4
  import Input5 from "./Input5.svelte";
5
5
  import TimePicker5 from "./TimePicker5.svelte";
6
- export { DatePicker5, Input5, DropDown5, TimePicker5 };
6
+ import Accordion5 from "./Accordion5.svelte";
7
+ export { DatePicker5, Input5, DropDown5, TimePicker5, Accordion5 };
package/package.json CHANGED
@@ -1,69 +1,67 @@
1
1
  {
2
- "name": "@djcali570/component-lib",
3
- "version": "0.0.4",
4
- "scripts": {
5
- "dev": "vite dev",
6
- "build": "vite build && npm run prepack",
7
- "package": "svelte-kit sync && svelte-package && publint",
8
- "preview": "vite preview",
9
- "prepare": "svelte-kit sync || echo ''",
10
- "prepack": "svelte-kit sync && svelte-package && publint",
11
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13
- "format": "prettier --write .",
14
- "lint": "prettier --check . && eslint ."
15
- },
16
- "files": [
17
- "dist",
18
- "!dist/**/*.test.*",
19
- "!dist/**/*.spec.*"
20
- ],
21
- "sideEffects": [
22
- "**/*.css"
23
- ],
24
- "svelte": "./dist/index.js",
25
- "types": "./dist/index.d.ts",
26
- "type": "module",
27
- "exports": {
28
- ".": {
29
- "types": "./dist/index.d.ts",
30
- "svelte": "./dist/index.js"
31
- }
32
- },
33
- "peerDependencies": {
34
- "svelte": "^5.0.0",
35
- "@sveltejs/kit": "^2.16.0",
36
- "tailwindcss": "^4.0.0"
37
- },
38
- "devDependencies": {
39
- "@eslint/compat": "^1.2.5",
40
- "@eslint/js": "^9.18.0",
41
- "@sveltejs/adapter-auto": "^6.0.0",
42
- "@sveltejs/kit": "^2.16.0",
43
- "@sveltejs/package": "^2.0.0",
44
- "@sveltejs/vite-plugin-svelte": "^5.0.0",
45
- "@tailwindcss/vite": "^4.0.0",
46
- "eslint": "^9.18.0",
47
- "eslint-config-prettier": "^10.0.1",
48
- "eslint-plugin-svelte": "^3.0.0",
49
- "globals": "^16.0.0",
50
- "prettier": "^3.4.2",
51
- "prettier-plugin-svelte": "^3.3.3",
52
- "prettier-plugin-tailwindcss": "^0.6.11",
53
- "publint": "^0.3.2",
54
- "svelte": "^5.0.0",
55
- "svelte-check": "^4.0.0",
56
- "tailwindcss": "^4.0.0",
57
- "typescript": "^5.0.0",
58
- "typescript-eslint": "^8.20.0",
59
- "vite": "^6.2.6"
60
- },
61
- "keywords": [
62
- "svelte",
63
- "SvelteKit",
64
- "components"
65
- ],
66
- "author": {
67
- "name": "Jay Cali"
68
- }
69
- }
2
+ "name": "@djcali570/component-lib",
3
+ "version": "0.0.5",
4
+ "files": [
5
+ "dist",
6
+ "!dist/**/*.test.*",
7
+ "!dist/**/*.spec.*"
8
+ ],
9
+ "sideEffects": [
10
+ "**/*.css"
11
+ ],
12
+ "svelte": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "svelte": "./dist/index.js"
19
+ }
20
+ },
21
+ "peerDependencies": {
22
+ "svelte": "^5.0.0",
23
+ "@sveltejs/kit": "^2.16.0",
24
+ "tailwindcss": "^4.0.0"
25
+ },
26
+ "devDependencies": {
27
+ "@eslint/compat": "^1.2.5",
28
+ "@eslint/js": "^9.18.0",
29
+ "@sveltejs/adapter-auto": "^6.0.0",
30
+ "@sveltejs/kit": "^2.16.0",
31
+ "@sveltejs/package": "^2.0.0",
32
+ "@sveltejs/vite-plugin-svelte": "^5.0.0",
33
+ "@tailwindcss/vite": "^4.0.0",
34
+ "eslint": "^9.18.0",
35
+ "eslint-config-prettier": "^10.0.1",
36
+ "eslint-plugin-svelte": "^3.0.0",
37
+ "globals": "^16.0.0",
38
+ "prettier": "^3.4.2",
39
+ "prettier-plugin-svelte": "^3.3.3",
40
+ "prettier-plugin-tailwindcss": "^0.6.11",
41
+ "publint": "^0.3.2",
42
+ "svelte": "^5.0.0",
43
+ "svelte-check": "^4.0.0",
44
+ "tailwindcss": "^4.0.0",
45
+ "typescript": "^5.0.0",
46
+ "typescript-eslint": "^8.20.0",
47
+ "vite": "^6.2.6"
48
+ },
49
+ "keywords": [
50
+ "svelte",
51
+ "SvelteKit",
52
+ "components"
53
+ ],
54
+ "author": {
55
+ "name": "Jay Cali"
56
+ },
57
+ "scripts": {
58
+ "dev": "vite dev",
59
+ "build": "vite build && npm run prepack",
60
+ "package": "svelte-kit sync && svelte-package && publint",
61
+ "preview": "vite preview",
62
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
63
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
64
+ "format": "prettier --write .",
65
+ "lint": "prettier --check . && eslint ."
66
+ }
67
+ }