@putkoff/abstract-utilities 0.0.3 → 0.0.4
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/dist/cjs/functions/ui_utils/src/button.d.ts +3 -2
- package/dist/cjs/index.js +18 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/functions/ui_utils/src/button.d.ts +3 -2
- package/dist/esm/index.js +18 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/functions/ui_utils/src/button.d.ts +3 -2
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function Button({ children, color, ...rest }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
1
|
+
export declare function Button({ children, color, variant, className, ...rest }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
2
|
color?: 'gray' | 'green' | 'blue';
|
|
3
|
+
variant?: 'default' | 'icon' | 'primary' | 'secondary';
|
|
4
|
+
className?: string;
|
|
4
5
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/esm/index.js
CHANGED
|
@@ -1532,10 +1532,24 @@ function get_window_parts() {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
|
|
1534
1534
|
function Button(_a) {
|
|
1535
|
-
var { children, color = 'gray' } = _a, rest = __rest(_a, ["children", "color"]);
|
|
1536
|
-
const base = 'rounded px-3 py-1 text-sm';
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1535
|
+
var { children, color = 'gray', variant = 'default', className = '' } = _a, rest = __rest(_a, ["children", "color", "variant", "className"]);
|
|
1536
|
+
const base = 'rounded px-3 py-1 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-150';
|
|
1537
|
+
const variantStyles = {
|
|
1538
|
+
default: '',
|
|
1539
|
+
icon: 'p-1 bg-transparent hover:bg-gray-100',
|
|
1540
|
+
primary: 'text-white',
|
|
1541
|
+
secondary: '',
|
|
1542
|
+
};
|
|
1543
|
+
const palette = {
|
|
1544
|
+
gray: variant === 'primary'
|
|
1545
|
+
? 'bg-gray-600 hover:bg-gray-700 focus:ring-gray-500'
|
|
1546
|
+
: 'bg-gray-200 hover:bg-gray-300 focus:ring-gray-400',
|
|
1547
|
+
green: 'bg-green-600 text-white hover:bg-green-700 focus:ring-green-500',
|
|
1548
|
+
blue: variant === 'primary'
|
|
1549
|
+
? 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500'
|
|
1550
|
+
: 'bg-blue-200 hover:bg-blue-300 focus:ring-blue-400',
|
|
1551
|
+
};
|
|
1552
|
+
return (jsx("button", Object.assign({ className: `${base} ${variantStyles[variant]} ${palette[color]} ${className}` }, rest, { children: children })));
|
|
1539
1553
|
}
|
|
1540
1554
|
|
|
1541
1555
|
function Checkbox(_a) {
|