diff --git a/pkgs/clan-app/ui/src/components/Form/Checkbox.css b/pkgs/clan-app/ui/src/components/Form/Checkbox.css
deleted file mode 100644
index c7ea91258..000000000
--- a/pkgs/clan-app/ui/src/components/Form/Checkbox.css
+++ /dev/null
@@ -1,52 +0,0 @@
-div.form-field {
- &.checkbox {
- @apply items-start;
-
- & div.checkbox-control {
- @apply w-5 h-5 rounded-sm bg-def-1 border border-inv-1 p-[0.0625rem];
-
- &:hover {
- @apply bg-def-acc-2;
- }
-
- &[data-disabled] {
- @apply border-def-2;
- }
-
- &[data-invalid] {
- @apply border-semantic-error-4;
- }
-
- &[data-readonly] {
- @apply cursor-default bg-inherit border-none;
- }
- }
- }
-
- &.inverted {
- &.checkbox {
- & div.checkbox-control {
- @apply bg-inv-1;
-
- &:hover,
- &[data-checked] {
- @apply bg-inv-acc-4;
- }
-
- &[data-disabled] {
- @apply bg-def-4 border-none;
- }
-
- &[data-readonly] {
- @apply bg-inherit;
- }
- }
- }
- }
-
- &.s {
- & div.checkbox-control {
- @apply w-4 h-4;
- }
- }
-}
diff --git a/pkgs/clan-app/ui/src/components/Form/Checkbox.module.css b/pkgs/clan-app/ui/src/components/Form/Checkbox.module.css
new file mode 100644
index 000000000..462c8539c
--- /dev/null
+++ b/pkgs/clan-app/ui/src/components/Form/Checkbox.module.css
@@ -0,0 +1,43 @@
+.checkbox {
+ @apply items-start;
+}
+
+.checkboxControl {
+ @apply w-5 h-5 rounded-sm bg-def-1 border border-inv-1 p-[0.0625rem];
+
+ &:hover {
+ @apply bg-def-acc-2;
+ }
+
+ &[data-disabled] {
+ @apply border-def-2;
+ }
+
+ &[data-invalid] {
+ @apply border-semantic-error-4;
+ }
+
+ &[data-readonly] {
+ @apply cursor-default bg-inherit border-none;
+ }
+
+ .checkbox.s & {
+ @apply w-4 h-4;
+ }
+ .checkbox.inverted & {
+ @apply bg-inv-1;
+
+ &:hover,
+ &[data-checked] {
+ @apply bg-inv-acc-4;
+ }
+
+ &[data-disabled] {
+ @apply bg-def-4 border-none;
+ }
+
+ &[data-readonly] {
+ @apply bg-inherit;
+ }
+ }
+}
diff --git a/pkgs/clan-app/ui/src/components/Form/Checkbox.tsx b/pkgs/clan-app/ui/src/components/Form/Checkbox.tsx
index 6f30de3e8..e71f13044 100644
--- a/pkgs/clan-app/ui/src/components/Form/Checkbox.tsx
+++ b/pkgs/clan-app/ui/src/components/Form/Checkbox.tsx
@@ -1,19 +1,18 @@
import {
CheckboxInputProps as KCheckboxInputProps,
CheckboxRootProps as KCheckboxRootProps,
+ Checkbox as KCheckbox,
} from "@kobalte/core/checkbox";
-import { Checkbox as KCheckbox } from "@kobalte/core";
-
import Icon from "@/src/components/Icon/Icon";
import cx from "classnames";
import { Label } from "./Label";
import { PolymorphicProps } from "@kobalte/core/polymorphic";
-import "./Checkbox.css";
+import styles from "./Checkbox.module.css";
import { FieldProps } from "./Field";
import { Orienter } from "./Orienter";
-import { Match, splitProps, Switch } from "solid-js";
+import { Match, mergeProps, splitProps, Switch } from "solid-js";
export type CheckboxProps = FieldProps &
KCheckboxRootProps & {
@@ -21,24 +20,15 @@ export type CheckboxProps = FieldProps &
};
export const Checkbox = (props: CheckboxProps) => {
- // we need to separate output the input otherwise it interferes with prop binding
- const [_, rootProps] = splitProps(props, ["input"]);
-
- const [styleProps, otherRootProps] = splitProps(rootProps, [
- "class",
- "size",
- "orientation",
- "inverted",
- "ghost",
- ]);
-
- const alignment = () =>
- (props.orientation || "vertical") == "vertical" ? "start" : "center";
+ const [local, other] = splitProps(
+ mergeProps({ size: "default", orientation: "vertical" } as const, props),
+ ["size", "orientation", "inverted", "ghost", "input"],
+ );
const iconChecked = (
@@ -47,50 +37,45 @@ export const Checkbox = (props: CheckboxProps) => {
const iconUnchecked = (
);
return (
-
{(state) => (
-
+
-
-
+
+
-
+
{iconChecked}
-
- {iconChecked}
-
-
- {iconUnchecked}
-
+ {iconChecked}
+ {iconUnchecked}
)}
-
+
);
};
diff --git a/pkgs/clan-app/ui/src/components/Form/Label.css b/pkgs/clan-app/ui/src/components/Form/Label.css
index f52b3f494..fb32b499d 100644
--- a/pkgs/clan-app/ui/src/components/Form/Label.css
+++ b/pkgs/clan-app/ui/src/components/Form/Label.css
@@ -13,15 +13,4 @@ div.form-label {
& > label {
@apply flex items-center gap-1;
}
-
- & > span[data-required]:not(span[data-readonly]),
- & > label[data-required]:not(label[data-readonly]) {
- .typography::after {
- @apply fg-def-4 ml-1;
-
- content: "*";
- font-family: "Commit Mono", monospace;
- font-size: 0.6875rem;
- }
- }
}
diff --git a/pkgs/clan-app/ui/src/components/Form/Label.tsx b/pkgs/clan-app/ui/src/components/Form/Label.tsx
index 4a99e77e6..832e2f555 100644
--- a/pkgs/clan-app/ui/src/components/Form/Label.tsx
+++ b/pkgs/clan-app/ui/src/components/Form/Label.tsx
@@ -49,6 +49,7 @@ export const Label = (props: LabelProps) => {
color={props.validationState == "invalid" ? "error" : "primary"}
weight={props.labelWeight || "bold"}
inverted={props.inverted}
+ in="Label"
>
{props.label}
diff --git a/pkgs/clan-app/ui/src/components/Typography/Typography.module.css b/pkgs/clan-app/ui/src/components/Typography/Typography.module.css
index 1d35dac4e..9f1b3f902 100644
--- a/pkgs/clan-app/ui/src/components/Typography/Typography.module.css
+++ b/pkgs/clan-app/ui/src/components/Typography/Typography.module.css
@@ -189,7 +189,15 @@
.typography.in-Button {
@apply max-w-full overflow-hidden whitespace-nowrap text-ellipsis;
}
+.typography.in-Label {
+ [data-required]:not([data-readonly]) &::after {
+ @apply fg-def-4 ml-1;
+ content: "*";
+ font-family: "Commit Mono", monospace;
+ font-size: 0.6875rem;
+ }
+}
.typography.in-Modal-title {
@apply mx-auto;
}
diff --git a/pkgs/clan-app/ui/src/components/Typography/Typography.tsx b/pkgs/clan-app/ui/src/components/Typography/Typography.tsx
index c265babbb..fc4e2c816 100644
--- a/pkgs/clan-app/ui/src/components/Typography/Typography.tsx
+++ b/pkgs/clan-app/ui/src/components/Typography/Typography.tsx
@@ -53,6 +53,7 @@ export interface TypographyProps {
align?: "left" | "center" | "right";
in?:
| "Button"
+ | "Label"
| "Modal-title"
| "TagSelect-label"
| "Select-item-label"