@bouko/react 1.5.7 → 1.5.8
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/components/button.d.ts +1 -0
- package/dist/components/button.js +5 -3
- package/dist/components/heading.js +2 -2
- package/dist/components/input.d.ts +5 -1
- package/dist/components/input.js +3 -2
- package/dist/core/functions.d.ts +1 -0
- package/dist/core/functions.js +6 -0
- package/package.json +1 -1
|
@@ -4,16 +4,18 @@ export function Button({ variant, style, ...props }) {
|
|
|
4
4
|
return (_jsx("button", { className: cn(styles({ variant }), style), ...props }));
|
|
5
5
|
}
|
|
6
6
|
const styles = tv({
|
|
7
|
-
base: "flex items-center gap-2
|
|
7
|
+
base: "flex items-center gap-2 bg-accent hover:bg-accent-dark border border-accent-dark rounded font-semibold text-background-light duration-200 cursor-pointer disabled:cursor-not-allowed",
|
|
8
|
+
defaultVariants: { size: "md" },
|
|
8
9
|
variants: {
|
|
9
10
|
variant: {
|
|
10
11
|
primary: "bg-primary hover:bg-primary-dark border-primary-dark",
|
|
11
|
-
outline: "!bg-transparent border-
|
|
12
|
+
outline: "!bg-transparent border-accent hover:border-accent-dark text-primary",
|
|
12
13
|
ghost: "!bg-transparent border-transparent text-accent hover:text-accent-dark"
|
|
13
14
|
},
|
|
14
15
|
size: {
|
|
15
16
|
sm: "px-3 py-1 text-sm",
|
|
16
|
-
|
|
17
|
+
md: "px-4 py-2",
|
|
18
|
+
lg: "px-5 py-3 text-lg"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
});
|
|
@@ -9,6 +9,6 @@ const base = {
|
|
|
9
9
|
container: "gap-2 items-center",
|
|
10
10
|
subcontainer: "flex grow flex-col",
|
|
11
11
|
badge: "mb-2",
|
|
12
|
-
title: "flex items-center gap-2 font-bold",
|
|
13
|
-
subtitle: "
|
|
12
|
+
title: "flex items-center gap-2 text-lg font-bold",
|
|
13
|
+
subtitle: "font-semibold text-primary-lighter"
|
|
14
14
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type Field as FieldProps } from "@bouko/form";
|
|
2
2
|
type Props<T> = FieldProps<T> & {
|
|
3
3
|
placeholder?: string;
|
|
4
|
+
styles?: {
|
|
5
|
+
container?: string;
|
|
6
|
+
input?: string;
|
|
7
|
+
};
|
|
4
8
|
};
|
|
5
|
-
export default function Input<T>({ id, style, label, required, note, update, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function Input<T>({ id, styles, style, label, required, note, update, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
6
10
|
export {};
|
package/dist/components/input.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Field from "./field";
|
|
3
|
+
import { cn } from "@bouko/style";
|
|
3
4
|
import { setField } from "@bouko/form";
|
|
4
|
-
export default function Input({ id, style, label, required = true, note, update, ...props }) {
|
|
5
|
-
return (_jsx(Field, { style:
|
|
5
|
+
export default function Input({ id, styles, style, label, required = true, note, update, ...props }) {
|
|
6
|
+
return (_jsx(Field, { style: styles?.container, label: label, required: required, note: note, children: _jsx("input", { className: cn("px-3 py-2 bg-input border border-outline duration-200 focus:border-outline-light outline-none rounded text-sm", styles?.input), onChange: ({ target: { value } }) => setField(update, id, value), ...props }) }));
|
|
6
7
|
}
|
package/dist/core/functions.d.ts
CHANGED
package/dist/core/functions.js
CHANGED
|
@@ -13,3 +13,9 @@ export const getFileData = (files) => Promise.all(files.map((file) => {
|
|
|
13
13
|
reader.readAsDataURL(file);
|
|
14
14
|
});
|
|
15
15
|
}));
|
|
16
|
+
export const getEnv = (key) => {
|
|
17
|
+
const value = process.env[key];
|
|
18
|
+
if (!value)
|
|
19
|
+
throw new Error(`Missing required env: ${key}`);
|
|
20
|
+
return value;
|
|
21
|
+
};
|