@solidpb/ui-kit 0.4.1 → 0.4.2
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.
|
@@ -25,6 +25,21 @@ const checkbox = tv({
|
|
|
25
25
|
size: "sm",
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
|
+
const label = tv({
|
|
29
|
+
base: "label text-xs",
|
|
30
|
+
variants: {
|
|
31
|
+
size: {
|
|
32
|
+
xs: "text-xs",
|
|
33
|
+
sm: "text-xs",
|
|
34
|
+
md: "text-xs",
|
|
35
|
+
lg: "text-sm",
|
|
36
|
+
xl: "text-sm",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "sm",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
28
43
|
export const Checkbox = (props) => {
|
|
29
44
|
const [local, inputProps] = splitProps(props, ["label", "size", "appearance", "class", "onChange"]);
|
|
30
45
|
return (<label class="flex items-center gap-3 w-fit">
|
|
@@ -36,7 +51,7 @@ export const Checkbox = (props) => {
|
|
|
36
51
|
local.onChange?.(e.currentTarget.checked);
|
|
37
52
|
}}/>
|
|
38
53
|
|
|
39
|
-
{local.label && <span class=
|
|
54
|
+
{local.label && <span class={label({ size: local.size })}>{local.label}</span>}
|
|
40
55
|
</label>);
|
|
41
56
|
};
|
|
42
57
|
export default Checkbox;
|
package/dist/components/Form.jsx
CHANGED
|
@@ -20,6 +20,7 @@ export function createForm() {
|
|
|
20
20
|
const Form = (props) => {
|
|
21
21
|
const [values, setValues] = createStore({ ...props.data });
|
|
22
22
|
const setValue = (key, value) => {
|
|
23
|
+
console.log("Setting value", key, value);
|
|
23
24
|
setValues(key, value);
|
|
24
25
|
};
|
|
25
26
|
const getValue = (key) => {
|
|
@@ -18,6 +18,7 @@ export interface RelationPickerProps<T> {
|
|
|
18
18
|
onTextInputChange?: (text: string) => void;
|
|
19
19
|
defaultFilter?: (option: T[] | Exclude<NonNullable<T>, null>, filter: string) => boolean;
|
|
20
20
|
onLinkClick?: (value: T) => void;
|
|
21
|
+
href?: string;
|
|
21
22
|
}
|
|
22
23
|
export declare const RelationPicker: <T>(props: RelationPickerProps<T>) => import("solid-js").JSX.Element;
|
|
23
24
|
export default RelationPicker;
|
|
@@ -103,9 +103,9 @@ export const RelationPicker = (props) => {
|
|
|
103
103
|
tags: props.multi && Array.isArray(props.value) && props.value.length > 0,
|
|
104
104
|
})}>
|
|
105
105
|
<Show when={props.multi} fallback={<>
|
|
106
|
-
{!props.multi && values() && (<
|
|
106
|
+
{!props.multi && values() && (props.href || props.onLinkClick) && (<a class="btn btn-ghost btn-primary btn-xs btn-square" href={props.href} onClick={() => props.onLinkClick?.(props.value)}>
|
|
107
107
|
<Link class="w-[1em] h-[1em]"/>
|
|
108
|
-
</
|
|
108
|
+
</a>)}
|
|
109
109
|
<Combobox.Input onBlur={(e) => {
|
|
110
110
|
if (!props.value) {
|
|
111
111
|
e.currentTarget.value = "";
|
|
@@ -25,6 +25,21 @@ const toggle = tv({
|
|
|
25
25
|
size: "sm",
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
|
+
const label = tv({
|
|
29
|
+
base: "label text-xs",
|
|
30
|
+
variants: {
|
|
31
|
+
size: {
|
|
32
|
+
xs: "text-xs",
|
|
33
|
+
sm: "text-xs",
|
|
34
|
+
md: "text-xs",
|
|
35
|
+
lg: "text-sm",
|
|
36
|
+
xl: "text-sm",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "sm",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
28
43
|
export const Switch = (props) => {
|
|
29
44
|
const [local, inputProps] = splitProps(props, ["label", "size", "appearance", "class", "onChange"]);
|
|
30
45
|
return (<label class="flex items-center gap-3 w-fit">
|
|
@@ -33,9 +48,9 @@ export const Switch = (props) => {
|
|
|
33
48
|
appearance: local.appearance,
|
|
34
49
|
class: local.class,
|
|
35
50
|
})} onChange={(e) => {
|
|
36
|
-
local.onChange?.(
|
|
51
|
+
local.onChange?.(e.currentTarget.checked);
|
|
37
52
|
}}/>
|
|
38
|
-
{local.label && <span class=
|
|
53
|
+
{local.label && <span class={label({ size: local.size })}>{local.label}</span>}
|
|
39
54
|
</label>);
|
|
40
55
|
};
|
|
41
56
|
export default Switch;
|