zc-ui-library 0.1.4 → 0.1.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zc-ui-library",
3
3
  "private": false,
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
package/src/App.tsx CHANGED
@@ -1,9 +1,11 @@
1
1
  import './App.css'
2
+ import {ZcButton} from "./components/Button";
3
+
2
4
  function App() {
3
5
 
4
6
  return (
5
7
  <>
6
-
8
+ <ZcButton>klik</ZcButton>
7
9
  </>
8
10
  )
9
11
  }
@@ -1,7 +1,52 @@
1
- export default function ZcButton() {
1
+ import * as React from 'react'
2
+
3
+ export type ButtonVariant = 'primary' | 'secondary'
4
+ export type ButtonSize = 'sm' | 'md' | 'lg'
5
+
6
+ export interface ButtonProps
7
+ extends React.ButtonHTMLAttributes<HTMLButtonElement> {
8
+ variant?: ButtonVariant
9
+ size?: ButtonSize
10
+ }
11
+
12
+ export const ZcButton = React.forwardRef<
13
+ HTMLButtonElement,
14
+ ButtonProps
15
+ >(function ZcButton(
16
+ {
17
+ variant = 'primary',
18
+ size = 'md',
19
+ disabled,
20
+ children,
21
+ ...props
22
+ },
23
+ ref
24
+ ) {
2
25
  return (
3
- <button>
4
- clicked
26
+ <button
27
+ ref={ref}
28
+ disabled={disabled}
29
+ data-variant={variant}
30
+ data-size={size}
31
+ style={{
32
+ padding:
33
+ size === 'sm'
34
+ ? '6px 10px'
35
+ : size === 'lg'
36
+ ? '12px 18px'
37
+ : '8px 14px',
38
+ borderRadius: 6,
39
+ border: '1px solid transparent',
40
+ cursor: disabled ? 'not-allowed' : 'pointer',
41
+ background:
42
+ variant === 'secondary' ? '#fff' : '#2563eb',
43
+ color:
44
+ variant === 'secondary' ? '#111' : '#fff',
45
+ opacity: disabled ? 0.6 : 1,
46
+ }}
47
+ {...props}
48
+ >
49
+ {children}
5
50
  </button>
6
51
  )
7
- }
52
+ })
@@ -0,0 +1 @@
1
+ export * from './ZcButton';
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export {default as ZcButton} from './components/Button/ZcButton.tsx';
1
+ export * from './components/Button';
package/vite.config.js CHANGED
@@ -18,7 +18,7 @@ export default defineConfig({
18
18
  build: {
19
19
  lib: {
20
20
  entry: path.resolve(__dirname, 'src/index.ts'),
21
- name: 'ZcUILibrary',
21
+ name: 'zc-ui-library',
22
22
  formats: ['es', 'cjs'],
23
23
  fileName: (format) =>
24
24
  format === 'es' ? 'index.js' : 'index.cjs',
@@ -29,10 +29,4 @@ export default defineConfig({
29
29
  sourcemap: true,
30
30
  emptyOutDir: true,
31
31
  },
32
-
33
- css: {
34
- postcss: {
35
- plugins: [tailwindcss],
36
- },
37
- },
38
32
  })