klip-components 0.2.1
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/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/components/Button/Button.d.ts +60 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Debug/Debug.d.ts +8 -0
- package/dist/components/Debug/Debug.d.ts.map +1 -0
- package/dist/components/Debug/index.d.ts +2 -0
- package/dist/components/Debug/index.d.ts.map +1 -0
- package/dist/components/SimpleButton/SimpleButton.d.ts +11 -0
- package/dist/components/SimpleButton/SimpleButton.d.ts.map +1 -0
- package/dist/components/SimpleButton/index.d.ts +2 -0
- package/dist/components/SimpleButton/index.d.ts.map +1 -0
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +9 -0
- package/dist/components/ThemeToggle/ThemeToggle.d.ts.map +1 -0
- package/dist/components/ThemeToggle/index.d.ts +3 -0
- package/dist/components/ThemeToggle/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/klip-components.cjs.js +37 -0
- package/dist/klip-components.css +1 -0
- package/dist/klip-components.es.js +391 -0
- package/dist/theme/ThemeProvider.d.ts +37 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/context.d.ts +17 -0
- package/dist/theme/context.d.ts.map +1 -0
- package/dist/theme/cssGenerator.d.ts +14 -0
- package/dist/theme/cssGenerator.d.ts.map +1 -0
- package/dist/theme/defaultThemes.d.ts +11 -0
- package/dist/theme/defaultThemes.d.ts.map +1 -0
- package/dist/theme/hooks.d.ts +68 -0
- package/dist/theme/hooks.d.ts.map +1 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/utils.d.ts +23 -0
- package/dist/theme/utils.d.ts.map +1 -0
- package/dist/types/theme.d.ts +78 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +37 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 deleonagencyorg
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# 🚀 Klip Components
|
|
2
|
+
|
|
3
|
+
A modern, flexible, and reusable React component library built with TypeScript and Vite.
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/js/klip-components)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](http://www.typescriptlang.org/)
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- 🎨 **Modern Design**: Clean and professional UI components
|
|
12
|
+
- 🌈 **Theme System**: Client-side theme generation with custom colors and dark/light mode
|
|
13
|
+
- 🔧 **TypeScript**: Full TypeScript support with comprehensive type definitions
|
|
14
|
+
- 📱 **Responsive**: Mobile-first design approach
|
|
15
|
+
- ♿ **Accessible**: Built with accessibility best practices in mind
|
|
16
|
+
- 🎯 **Flexible**: Highly customizable with variants, sizes, and theme overrides
|
|
17
|
+
- 📦 **Tree Shakable**: Import only what you need
|
|
18
|
+
- ⚡ **Zero Setup**: No server configuration required - works with static builds
|
|
19
|
+
- 📚 **Well Documented**: Complete Storybook documentation
|
|
20
|
+
|
|
21
|
+
## 📦 Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install klip-components
|
|
25
|
+
# or
|
|
26
|
+
yarn add klip-components
|
|
27
|
+
# or
|
|
28
|
+
bun add klip-components
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 🔧 Quick Start
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { ThemeProvider, Button } from 'klip-components';
|
|
35
|
+
|
|
36
|
+
function App() {
|
|
37
|
+
return (
|
|
38
|
+
<ThemeProvider
|
|
39
|
+
theme={{
|
|
40
|
+
colors: {
|
|
41
|
+
primary: { main: '#ff6b6b', hover: '#ff5252' },
|
|
42
|
+
},
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Button variant="primary">Custom Themed Button</Button>
|
|
46
|
+
</ThemeProvider>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Theme Provider Setup
|
|
52
|
+
|
|
53
|
+
For custom themes and dark/light mode support, wrap your app with the `ThemeProvider`:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { ThemeProvider, Button, ThemeToggle } from 'klip-components';
|
|
57
|
+
|
|
58
|
+
// Custom brand colors
|
|
59
|
+
const customTheme = {
|
|
60
|
+
colors: {
|
|
61
|
+
primary: {
|
|
62
|
+
main: '#8b5cf6', // Purple
|
|
63
|
+
hover: '#7c3aed',
|
|
64
|
+
},
|
|
65
|
+
secondary: {
|
|
66
|
+
main: '#10b981', // Emerald
|
|
67
|
+
hover: '#059669',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function App() {
|
|
73
|
+
return (
|
|
74
|
+
<ThemeProvider defaultMode="auto" theme={customTheme}>
|
|
75
|
+
<div>
|
|
76
|
+
<ThemeToggle />
|
|
77
|
+
<Button variant="primary" size="lg">
|
|
78
|
+
Themed Button
|
|
79
|
+
</Button>
|
|
80
|
+
<Button variant="secondary" size="sm">
|
|
81
|
+
Secondary Button
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
</ThemeProvider>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Using Theme Hooks
|
|
90
|
+
|
|
91
|
+
Access theme values and controls in your components:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { useTheme } from 'klip-components';
|
|
95
|
+
|
|
96
|
+
function ThemedComponent() {
|
|
97
|
+
const { theme, isDark, setMode, updateTheme } = useTheme();
|
|
98
|
+
|
|
99
|
+
const handleCustomize = () => {
|
|
100
|
+
updateTheme({
|
|
101
|
+
colors: {
|
|
102
|
+
primary: { main: '#ff6b6b', hover: '#ff5252' },
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div>
|
|
109
|
+
<h2>Current Mode: {isDark ? 'Dark' : 'Light'}</h2>
|
|
110
|
+
<button onClick={() => setMode(isDark ? 'light' : 'dark')}>Toggle Theme</button>
|
|
111
|
+
<button onClick={handleCustomize}>Customize Colors</button>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 🎨 Theme System
|
|
118
|
+
|
|
119
|
+
The theme system is **zero-configuration** and works perfectly with static builds:
|
|
120
|
+
|
|
121
|
+
- ✅ **No server setup required** - pure client-side CSS generation
|
|
122
|
+
- ✅ **Zero FOUC** - themes load before React renders
|
|
123
|
+
- ✅ **Static build friendly** - works with any hosting platform
|
|
124
|
+
- ✅ **Dynamic theming** - change colors at runtime
|
|
125
|
+
- ✅ **Dark/light mode** - automatic system detection with manual override
|
|
126
|
+
|
|
127
|
+
## 📖 Documentation
|
|
128
|
+
|
|
129
|
+
Explore all components and their variants in our Storybook documentation:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Clone the repository
|
|
133
|
+
git clone https://github.com/deleonagencyorg/klip_components
|
|
134
|
+
cd klip-components
|
|
135
|
+
|
|
136
|
+
# Install dependencies
|
|
137
|
+
bun install
|
|
138
|
+
|
|
139
|
+
# Start Storybook
|
|
140
|
+
bun run storybook
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Visit `http://localhost:6006` to see the interactive component documentation.
|
|
144
|
+
|
|
145
|
+
## 🛠️ Development
|
|
146
|
+
|
|
147
|
+
### Prerequisites
|
|
148
|
+
|
|
149
|
+
- Node.js 22+ or Bun
|
|
150
|
+
- React 18+
|
|
151
|
+
|
|
152
|
+
### Setup
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Clone the repository
|
|
156
|
+
git clone <repository-url>
|
|
157
|
+
cd klip-components
|
|
158
|
+
|
|
159
|
+
# Install dependencies
|
|
160
|
+
bun install
|
|
161
|
+
|
|
162
|
+
# Start development server
|
|
163
|
+
bun run dev
|
|
164
|
+
|
|
165
|
+
# Start Storybook
|
|
166
|
+
bun run storybook
|
|
167
|
+
|
|
168
|
+
# Build the library
|
|
169
|
+
bun run build
|
|
170
|
+
|
|
171
|
+
# Run linting
|
|
172
|
+
bun run lint
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Scripts
|
|
176
|
+
|
|
177
|
+
| Script | Description |
|
|
178
|
+
| ----------------- | ---------------------------------- |
|
|
179
|
+
| `dev` | Start development server |
|
|
180
|
+
| `build` | Build the library for production |
|
|
181
|
+
| `storybook` | Start Storybook development server |
|
|
182
|
+
| `build-storybook` | Build Storybook for production |
|
|
183
|
+
| `lint` | Run ESLint |
|
|
184
|
+
| `preview` | Preview production build |
|
|
185
|
+
|
|
186
|
+
## 🤝 Contributing
|
|
187
|
+
|
|
188
|
+
We welcome contributions! Please follow these steps:
|
|
189
|
+
|
|
190
|
+
1. Fork the repository
|
|
191
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
192
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
193
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
194
|
+
5. Open a Pull Request
|
|
195
|
+
|
|
196
|
+
### Development Guidelines
|
|
197
|
+
|
|
198
|
+
- Write TypeScript for all components
|
|
199
|
+
- Include proper JSDoc documentation
|
|
200
|
+
- Add Storybook stories for new components
|
|
201
|
+
- Follow the existing code style
|
|
202
|
+
- Test your changes thoroughly
|
|
203
|
+
|
|
204
|
+
## 📄 License
|
|
205
|
+
|
|
206
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
207
|
+
|
|
208
|
+
## 🔗 Links
|
|
209
|
+
|
|
210
|
+
- [npm Package](#)
|
|
211
|
+
- [Storybook Documentation](#) <!-- Add your Storybook URL -->
|
|
212
|
+
- [GitHub Issues](#)
|
|
213
|
+
|
|
214
|
+
## 🙏 Acknowledgments
|
|
215
|
+
|
|
216
|
+
- Built with [React](https://reactjs.org/)
|
|
217
|
+
- Bundled with [Vite](https://vitejs.dev/)
|
|
218
|
+
- Documented with [Storybook](https://storybook.js.org/)
|
|
219
|
+
- Styled with CSS Variables
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
_Made with ❤️ by the Klip team_
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props interface for the Button component.
|
|
4
|
+
* Extends standard HTML button attributes with additional styling options.
|
|
5
|
+
*/
|
|
6
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
/** Visual style variant of the button */
|
|
8
|
+
variant?: 'primary' | 'secondary' | 'success' | 'danger';
|
|
9
|
+
/** Size of the button */
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
/** Whether the button should take full width of its container */
|
|
12
|
+
block?: boolean;
|
|
13
|
+
/** Content to be rendered inside the button */
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A flexible and reusable Button component with multiple variants, sizes, and styling options.
|
|
18
|
+
* Supports all standard HTML button attributes and provides additional customization through props.
|
|
19
|
+
* Uses CSS classes for styling and conditionally applies classes based on props.
|
|
20
|
+
*
|
|
21
|
+
* @param {ButtonProps} props - The props for the Button component
|
|
22
|
+
* @param {('primary'|'secondary'|'success'|'danger')} [props.variant='primary'] - Visual style variant
|
|
23
|
+
* @param {('sm'|'md'|'lg')} [props.size='md'] - Button size
|
|
24
|
+
* @param {boolean} [props.block=false] - Whether button should be full width
|
|
25
|
+
* @param {string} [props.className=''] - Additional CSS classes to apply
|
|
26
|
+
* @param {React.ReactNode} props.children - Content to render inside the button
|
|
27
|
+
* @param {...React.ButtonHTMLAttributes<HTMLButtonElement>} props - All other standard button attributes
|
|
28
|
+
* @returns {JSX.Element} The rendered Button component
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Basic primary button
|
|
32
|
+
* <Button>Click me</Button>
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Secondary button with small size
|
|
36
|
+
* <Button variant="secondary" size="sm">Small Button</Button>
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Full-width danger button with click handler
|
|
40
|
+
* <Button
|
|
41
|
+
* variant="danger"
|
|
42
|
+
* block
|
|
43
|
+
* onClick={() => console.log('Clicked!')}
|
|
44
|
+
* >
|
|
45
|
+
* Delete Item
|
|
46
|
+
* </Button>
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // Disabled success button with custom class
|
|
50
|
+
* <Button
|
|
51
|
+
* variant="success"
|
|
52
|
+
* size="lg"
|
|
53
|
+
* disabled
|
|
54
|
+
* className="my-custom-class"
|
|
55
|
+
* >
|
|
56
|
+
* Save Changes
|
|
57
|
+
* </Button>
|
|
58
|
+
*/
|
|
59
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
60
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF,yCAAyC;IACzC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;IACzD,yBAAyB;IACzB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgBxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Debug.d.ts","sourceRoot":"","sources":["../../../src/components/Debug/Debug.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,EAAE,UAAU,2CAU9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Debug/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SimpleButtonProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Simple button component without hooks for testing
|
|
9
|
+
*/
|
|
10
|
+
export declare function SimpleButton({ children, onClick, className }: SimpleButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=SimpleButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleButton.d.ts","sourceRoot":"","sources":["../../../src/components/SimpleButton/SimpleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAgB/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SimpleButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ThemeToggleProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A simple theme toggle button component that demonstrates theme usage
|
|
6
|
+
* Shows how to use the useTheme hook and access theme values
|
|
7
|
+
*/
|
|
8
|
+
export declare function ThemeToggle({ className }: ThemeToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ThemeToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeToggle/ThemeToggle.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CAwC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC;AAGhC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),n=require("react");function x(r){var o,s,e="";if(typeof r=="string"||typeof r=="number")e+=r;else if(typeof r=="object")if(Array.isArray(r)){var a=r.length;for(o=0;o<a;o++)r[o]&&(s=x(r[o]))&&(e&&(e+=" "),e+=s)}else for(s in r)r[s]&&(e&&(e+=" "),e+=s);return e}function $(){for(var r,o,s=0,e="",a=arguments.length;s<a;s++)(r=arguments[s])&&(o=x(r))&&(e&&(e+=" "),e+=o);return e}function w(...r){const o=r.join(" ").split(" ").filter(Boolean);return[...new Set(o)].join(" ")}function u(...r){const o=$(...r);return w(o)}const B=({variant:r="primary",size:o="md",block:s=!1,className:e="",children:a,...l})=>c.jsx("button",{className:u("btn",`btn-${r}`,o!=="md"&&`btn-${o}`,s&&"btn-block",e),...l,children:a}),f=n.createContext(void 0);function h(){const r=n.useContext(f);if(r===void 0)throw new Error("useTheme must be used within a ThemeProvider");return r}function D(){const{theme:r}=h();return{primaryColor:`var(--primary-color, ${r.colors.primary.main})`,primaryHover:`var(--primary-hover, ${r.colors.primary.hover})`,secondaryColor:`var(--secondary-color, ${r.colors.secondary.main})`,secondaryHover:`var(--secondary-hover, ${r.colors.secondary.hover})`,tertiaryColor:`var(--tertiary-color, ${r.colors.tertiary.main})`,tertiaryHover:`var(--tertiary-hover, ${r.colors.tertiary.hover})`,successColor:`var(--success-color, ${r.colors.semantic.success})`,dangerColor:`var(--danger-color, ${r.colors.semantic.danger})`,warningColor:`var(--warning-color, ${r.colors.semantic.warning})`,infoColor:`var(--info-color, ${r.colors.semantic.info})`,spacingXs:`var(--spacing-xs, ${r.spacing.xs})`,spacingSm:`var(--spacing-sm, ${r.spacing.sm})`,spacingMd:`var(--spacing-md, ${r.spacing.md})`,spacingLg:`var(--spacing-lg, ${r.spacing.lg})`,spacingXl:`var(--spacing-xl, ${r.spacing.xl})`,borderRadiusSm:`var(--border-radius-sm, ${r.borderRadius.sm})`,borderRadius:`var(--border-radius, ${r.borderRadius.base})`,borderRadiusLg:`var(--border-radius-lg, ${r.borderRadius.lg})`,fontFamily:`var(--font-family, ${r.typography.fontFamily})`,fontSizeSm:`var(--font-size-sm, ${r.typography.fontSize.sm})`,fontSizeBase:`var(--font-size-base, ${r.typography.fontSize.base})`,fontSizeLg:`var(--font-size-lg, ${r.typography.fontSize.lg})`,shadowSm:`var(--shadow-sm, ${r.shadows.sm})`,shadowMd:`var(--shadow-md, ${r.shadows.md})`,shadowLg:`var(--shadow-lg, ${r.shadows.lg})`}}function M({className:r}){const{mode:o,setMode:s,isDark:e}=h(),a=()=>{s(o==="auto"?"light":o==="light"?"dark":"auto")},l=()=>{switch(o){case"light":return"☀️ Light";case"dark":return"🌙 Dark";case"auto":return`🔄 Auto (${e?"Dark":"Light"})`;default:return"Theme"}};return c.jsx("button",{onClick:a,className:u("px-3 py-2 rounded-md text-sm font-medium transition-colors","bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600","text-gray-900 dark:text-gray-100",r),title:`Current theme: ${o}${o==="auto"?` (${e?"dark":"light"})`:""}`,children:l()})}function E({className:r}){return console.log("React version:",n.version),console.log("React object:",n),c.jsxs("div",{className:r,children:[c.jsxs("p",{children:["React Version: ",n.version]}),c.jsxs("p",{children:["React loaded: ",n?"Yes":"No"]})]})}function L({children:r,onClick:o,className:s}){return c.jsx("button",{onClick:o,className:s,style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px"},children:r})}const m={colors:{primary:{main:"#05445e",hover:"#033e52"},secondary:{main:"#189ab4",hover:"#0f7a9c"},tertiary:{main:"#75e6da",hover:"#5cc6c0"},semantic:{success:"#18a558",danger:"#db1f48",warning:"#e9b210",info:"#e0e9e0"}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{sm:"4px",base:"8px",lg:"12px"},typography:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1)"}},S={colors:{primary:{main:"#7dd3fc",hover:"#0ea5e9"},secondary:{main:"#34d399",hover:"#10b981"},tertiary:{main:"#fbbf24",hover:"#f59e0b"},semantic:{success:"#22c55e",danger:"#ef4444",warning:"#f59e0b",info:"#3b82f6"}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{sm:"4px",base:"8px",lg:"12px"},typography:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.15)",md:"0 4px 6px -1px rgb(0 0 0 / 0.2)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.25)"}};function g(r,o){return{colors:{primary:{...r.colors.primary,...o.colors?.primary},secondary:{...r.colors.secondary,...o.colors?.secondary},tertiary:{...r.colors.tertiary,...o.colors?.tertiary},semantic:{...r.colors.semantic,...o.colors?.semantic}},spacing:{...r.spacing,...o.spacing},borderRadius:{...r.borderRadius,...o.borderRadius},typography:{...r.typography,...o.typography,fontSize:{...r.typography.fontSize,...o.typography?.fontSize}},shadows:{...r.shadows,...o.shadows}}}function A(r,o=document.documentElement){o.style.setProperty("--primary-color",r.colors.primary.main),o.style.setProperty("--primary-hover",r.colors.primary.hover),o.style.setProperty("--secondary-color",r.colors.secondary.main),o.style.setProperty("--secondary-hover",r.colors.secondary.hover),o.style.setProperty("--tertiary-color",r.colors.tertiary.main),o.style.setProperty("--tertiary-hover",r.colors.tertiary.hover),o.style.setProperty("--success-color",r.colors.semantic.success),o.style.setProperty("--danger-color",r.colors.semantic.danger),o.style.setProperty("--warning-color",r.colors.semantic.warning),o.style.setProperty("--info-color",r.colors.semantic.info),o.style.setProperty("--spacing-xs",r.spacing.xs),o.style.setProperty("--spacing-sm",r.spacing.sm),o.style.setProperty("--spacing-md",r.spacing.md),o.style.setProperty("--spacing-lg",r.spacing.lg),o.style.setProperty("--spacing-xl",r.spacing.xl),o.style.setProperty("--border-radius-sm",r.borderRadius.sm),o.style.setProperty("--border-radius",r.borderRadius.base),o.style.setProperty("--border-radius-lg",r.borderRadius.lg),o.style.setProperty("--font-family",r.typography.fontFamily),o.style.setProperty("--font-size-sm",r.typography.fontSize.sm),o.style.setProperty("--font-size-base",r.typography.fontSize.base),o.style.setProperty("--font-size-lg",r.typography.fontSize.lg),o.style.setProperty("--shadow-sm",r.shadows.sm),o.style.setProperty("--shadow-md",r.shadows.md),o.style.setProperty("--shadow-lg",r.shadows.lg)}function V(r,o){const s=o.split(".");let e=r;for(const a of s){if(typeof e!="object"||e===null||!(a in e))return;e=e[a]}return typeof e=="string"?e:void 0}function F(r){return`--${r.replace(/\./g,"-")}`}function k(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function O(r,o=":root"){return`
|
|
2
|
+
${o} {
|
|
3
|
+
/* Colors */
|
|
4
|
+
--primary-color: ${r.colors.primary.main};
|
|
5
|
+
--primary-hover: ${r.colors.primary.hover};
|
|
6
|
+
--secondary-color: ${r.colors.secondary.main};
|
|
7
|
+
--secondary-hover: ${r.colors.secondary.hover};
|
|
8
|
+
--tertiary-color: ${r.colors.tertiary.main};
|
|
9
|
+
--tertiary-hover: ${r.colors.tertiary.hover};
|
|
10
|
+
--success-color: ${r.colors.semantic.success};
|
|
11
|
+
--danger-color: ${r.colors.semantic.danger};
|
|
12
|
+
--warning-color: ${r.colors.semantic.warning};
|
|
13
|
+
--info-color: ${r.colors.semantic.info};
|
|
14
|
+
|
|
15
|
+
/* Spacing */
|
|
16
|
+
--spacing-xs: ${r.spacing.xs};
|
|
17
|
+
--spacing-sm: ${r.spacing.sm};
|
|
18
|
+
--spacing-md: ${r.spacing.md};
|
|
19
|
+
--spacing-lg: ${r.spacing.lg};
|
|
20
|
+
--spacing-xl: ${r.spacing.xl};
|
|
21
|
+
|
|
22
|
+
/* Border Radius */
|
|
23
|
+
--border-radius-sm: ${r.borderRadius.sm};
|
|
24
|
+
--border-radius: ${r.borderRadius.base};
|
|
25
|
+
--border-radius-lg: ${r.borderRadius.lg};
|
|
26
|
+
|
|
27
|
+
/* Typography */
|
|
28
|
+
--font-family: ${r.typography.fontFamily};
|
|
29
|
+
--font-size-sm: ${r.typography.fontSize.sm};
|
|
30
|
+
--font-size-base: ${r.typography.fontSize.base};
|
|
31
|
+
--font-size-lg: ${r.typography.fontSize.lg};
|
|
32
|
+
|
|
33
|
+
/* Shadows */
|
|
34
|
+
--shadow-sm: ${r.shadows.sm};
|
|
35
|
+
--shadow-md: ${r.shadows.md};
|
|
36
|
+
--shadow-lg: ${r.shadows.lg};
|
|
37
|
+
}`}function H({children:r,defaultMode:o="auto",theme:s,darkTheme:e=S}){const[a,l]=n.useState(o),[y,b]=n.useState(s||{}),[C,P]=n.useState(()=>k()==="dark"),v=a==="dark"||a==="auto"&&C,p=g(v?e:m,y),T=n.useCallback(t=>{l(t)},[]),z=n.useCallback(t=>{b(i=>g({...m,...i},t))},[]),R=n.useCallback(()=>{b({})},[]);n.useEffect(()=>{if(typeof window>"u")return;const t=window.matchMedia("(prefers-color-scheme: dark)"),i=d=>{P(d.matches)};return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),n.useLayoutEffect(()=>{if(Object.keys(y).length>0){const t=O(p),i=document.getElementById("klip-custom-theme");i&&i.remove();const d=document.createElement("style");d.id="klip-custom-theme",d.textContent=t,document.head.insertBefore(d,document.head.firstChild)}else{const t=document.getElementById("klip-custom-theme");t&&t.remove()}},[p,y]);const j={theme:p,mode:a,setMode:T,updateTheme:z,resetTheme:R,isDark:v};return c.jsx(f.Provider,{value:j,children:r})}exports.Button=B;exports.Debug=E;exports.SimpleButton=L;exports.ThemeContext=f;exports.ThemeProvider=H;exports.ThemeToggle=M;exports.applyThemeToDOM=A;exports.clsx=$;exports.cn=u;exports.createCSSVariable=F;exports.darkTheme=S;exports.defaultTheme=m;exports.detectColorScheme=k;exports.getThemeValue=V;exports.mergeClasses=w;exports.mergeTheme=g;exports.useTheme=h;exports.useThemeVariables=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--primary-color:#05445e;--primary-hover:#033e52;--secondary-color:#189ab4;--secondary-hover:#0f7a9c;--tertiary-color:#75e6da;--tertiary-hover:#5cc6c0;--success-color:#18a558;--danger-color:#db1f48;--warning-color:#e9b210;--info-color:#e0e9e0;--border-radius:8px;--border-radius-sm:4px;--border-radius-lg:12px;--font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;--font-size-sm:.875rem;--font-size-base:1rem;--font-size-lg:1.125rem;--spacing-xs:.25rem;--spacing-sm:.5rem;--spacing-md:1rem;--spacing-lg:1.5rem;--spacing-xl:2rem;--shadow-sm:0 1px 2px 0 rgba(0,0,0,.05);--shadow-md:0 4px 6px -1px rgba(0,0,0,.1);--shadow-lg:0 10px 15px -3px rgba(0,0,0,.1)}.btn{align-items:center;border:1px solid transparent;border-radius:var(--border-radius);cursor:pointer;display:inline-flex;font-family:var(--font-family);font-size:var(--font-size-base);font-weight:500;justify-content:center;line-height:1.5;padding:var(--spacing-sm) var(--spacing-md);text-decoration:none;transition:all .15s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.btn:disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.btn:focus{outline:2px solid var(--primary-color);outline-offset:2px}.btn-primary{background-color:var(--primary-color);border-color:var(--primary-color);color:#fff}.btn-primary:hover:not(:disabled){background-color:var(--primary-hover);border-color:var(--primary-hover)}.btn-secondary{background-color:transparent;border-color:var(--primary-color);color:var(--primary-color)}.btn-secondary:hover:not(:disabled){background-color:var(--primary-color);color:#fff}.btn-success{background-color:var(--success-color);border-color:var(--success-color);color:#fff}.btn-danger{background-color:var(--danger-color);border-color:var(--danger-color);color:#fff}.btn-sm{border-radius:var(--border-radius-sm);font-size:var(--font-size-sm);padding:var(--spacing-xs) var(--spacing-sm)}.btn-lg{border-radius:var(--border-radius-lg);font-size:var(--font-size-lg);padding:var(--spacing-md) var(--spacing-lg)}.btn-block{display:flex;width:100%}
|