@solidpb/ui-kit 0.1.0

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.
Files changed (114) hide show
  1. package/README.md +1 -0
  2. package/dist/components/Button/Button.d.ts +12 -0
  3. package/dist/components/Button/Button.jsx +93 -0
  4. package/dist/components/Button/index.d.ts +1 -0
  5. package/dist/components/Button/index.js +1 -0
  6. package/dist/components/Card/Card.d.ts +6 -0
  7. package/dist/components/Card/Card.jsx +6 -0
  8. package/dist/components/Card/index.d.ts +1 -0
  9. package/dist/components/Card/index.js +1 -0
  10. package/dist/components/Checkbox/Checkbox.d.ts +10 -0
  11. package/dist/components/Checkbox/Checkbox.jsx +25 -0
  12. package/dist/components/Checkbox/index.d.ts +1 -0
  13. package/dist/components/Checkbox/index.js +1 -0
  14. package/dist/components/Container/Container.d.ts +7 -0
  15. package/dist/components/Container/Container.jsx +5 -0
  16. package/dist/components/Container/index.d.ts +1 -0
  17. package/dist/components/Container/index.js +1 -0
  18. package/dist/components/DateInput/DateInput.d.ts +9 -0
  19. package/dist/components/DateInput/DateInput.jsx +22 -0
  20. package/dist/components/DateInput/index.d.ts +1 -0
  21. package/dist/components/DateInput/index.js +1 -0
  22. package/dist/components/DropdownMenu/DropdownMenu.d.ts +11 -0
  23. package/dist/components/DropdownMenu/DropdownMenu.jsx +22 -0
  24. package/dist/components/DropdownMenu/index.d.ts +1 -0
  25. package/dist/components/DropdownMenu/index.js +1 -0
  26. package/dist/components/FileInput/FileInput.d.ts +10 -0
  27. package/dist/components/FileInput/FileInput.jsx +18 -0
  28. package/dist/components/FileInput/index.d.ts +1 -0
  29. package/dist/components/FileInput/index.js +1 -0
  30. package/dist/components/Form/Form.d.ts +2 -0
  31. package/dist/components/Form/Form.jsx +3 -0
  32. package/dist/components/Form/index.d.ts +1 -0
  33. package/dist/components/Form/index.js +1 -0
  34. package/dist/components/Heading/Heading.d.ts +7 -0
  35. package/dist/components/Heading/Heading.jsx +29 -0
  36. package/dist/components/Heading/index.d.ts +1 -0
  37. package/dist/components/Heading/index.js +1 -0
  38. package/dist/components/Image/Image.d.ts +9 -0
  39. package/dist/components/Image/Image.jsx +15 -0
  40. package/dist/components/Image/index.d.ts +1 -0
  41. package/dist/components/Image/index.js +1 -0
  42. package/dist/components/Input/Input.d.ts +15 -0
  43. package/dist/components/Input/Input.jsx +86 -0
  44. package/dist/components/Input/index.d.ts +1 -0
  45. package/dist/components/Input/index.js +1 -0
  46. package/dist/components/Link/Link.d.ts +9 -0
  47. package/dist/components/Link/Link.jsx +13 -0
  48. package/dist/components/Link/index.d.ts +1 -0
  49. package/dist/components/Link/index.js +1 -0
  50. package/dist/components/List/List.d.ts +26 -0
  51. package/dist/components/List/List.jsx +120 -0
  52. package/dist/components/List/index.d.ts +1 -0
  53. package/dist/components/List/index.js +1 -0
  54. package/dist/components/Modal/Modal.d.ts +13 -0
  55. package/dist/components/Modal/Modal.jsx +51 -0
  56. package/dist/components/Modal/index.d.ts +1 -0
  57. package/dist/components/Modal/index.js +1 -0
  58. package/dist/components/Modal/modalContext.d.ts +7 -0
  59. package/dist/components/Modal/modalContext.js +2 -0
  60. package/dist/components/NumberInput/NumberInput.d.ts +13 -0
  61. package/dist/components/NumberInput/NumberInput.jsx +20 -0
  62. package/dist/components/NumberInput/index.d.ts +1 -0
  63. package/dist/components/NumberInput/index.js +1 -0
  64. package/dist/components/RelationPicker/RelationPicker.d.ts +11 -0
  65. package/dist/components/RelationPicker/RelationPicker.jsx +13 -0
  66. package/dist/components/RelationPicker/index.d.ts +1 -0
  67. package/dist/components/RelationPicker/index.js +1 -0
  68. package/dist/components/SearchInput/SearchInput.d.ts +9 -0
  69. package/dist/components/SearchInput/SearchInput.jsx +9 -0
  70. package/dist/components/SearchInput/index.d.ts +1 -0
  71. package/dist/components/SearchInput/index.js +1 -0
  72. package/dist/components/Select/Select.d.ts +15 -0
  73. package/dist/components/Select/Select.jsx +37 -0
  74. package/dist/components/Select/index.d.ts +1 -0
  75. package/dist/components/Select/index.js +1 -0
  76. package/dist/components/Switch/Switch.d.ts +11 -0
  77. package/dist/components/Switch/Switch.jsx +22 -0
  78. package/dist/components/Switch/index.d.ts +1 -0
  79. package/dist/components/Switch/index.js +1 -0
  80. package/dist/components/Tabs/Tabs.d.ts +3 -0
  81. package/dist/components/Tabs/Tabs.jsx +4 -0
  82. package/dist/components/Tabs/index.d.ts +1 -0
  83. package/dist/components/Tabs/index.js +1 -0
  84. package/dist/components/Tag/Tag.d.ts +10 -0
  85. package/dist/components/Tag/Tag.jsx +30 -0
  86. package/dist/components/Tag/index.d.ts +1 -0
  87. package/dist/components/Tag/index.js +1 -0
  88. package/dist/components/TagArea/TagArea.d.ts +11 -0
  89. package/dist/components/TagArea/TagArea.jsx +62 -0
  90. package/dist/components/TagArea/index.d.ts +1 -0
  91. package/dist/components/TagArea/index.js +1 -0
  92. package/dist/components/Text/Text.d.ts +9 -0
  93. package/dist/components/Text/Text.jsx +25 -0
  94. package/dist/components/Text/index.d.ts +1 -0
  95. package/dist/components/Text/index.js +1 -0
  96. package/dist/components/TextArea/TextArea.d.ts +14 -0
  97. package/dist/components/TextArea/TextArea.jsx +40 -0
  98. package/dist/components/TextArea/index.d.ts +1 -0
  99. package/dist/components/TextArea/index.js +1 -0
  100. package/dist/components/Toast/Toast.d.ts +9 -0
  101. package/dist/components/Toast/Toast.jsx +36 -0
  102. package/dist/components/Toast/Toaster.d.ts +3 -0
  103. package/dist/components/Toast/Toaster.jsx +11 -0
  104. package/dist/components/Toast/index.d.ts +2 -0
  105. package/dist/components/Toast/index.js +2 -0
  106. package/dist/components/Tooltip/Tooltip.d.ts +8 -0
  107. package/dist/components/Tooltip/Tooltip.jsx +12 -0
  108. package/dist/components/Tooltip/index.d.ts +1 -0
  109. package/dist/components/Tooltip/index.js +1 -0
  110. package/dist/index.d.ts +26 -0
  111. package/dist/index.js +26 -0
  112. package/dist/methods/debounce.d.ts +1 -0
  113. package/dist/methods/debounce.js +7 -0
  114. package/package.json +41 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ ## UI components for solidpb
@@ -0,0 +1,12 @@
1
+ import { ParentComponent, ValidComponent } from "solid-js";
2
+ import { ButtonRootProps } from "@kobalte/core/button";
3
+ import { PolymorphicProps } from "@kobalte/core/polymorphic";
4
+ type BaseProps<T extends ValidComponent = "button"> = PolymorphicProps<T, ButtonRootProps<T>>;
5
+ interface Props extends BaseProps {
6
+ variant?: "text" | "solid";
7
+ appearance?: "primary" | "success" | "warning" | "neutral" | "error" | "muted";
8
+ size?: "xs" | "sm" | "md" | "lg";
9
+ isLoading?: boolean;
10
+ }
11
+ export declare const Button: ParentComponent<Props>;
12
+ export default Button;
@@ -0,0 +1,93 @@
1
+ import { createMemo, Show, splitProps } from "solid-js";
2
+ import { Button as KButton } from "@kobalte/core/button";
3
+ import { tv } from "tailwind-variants";
4
+ import Loader from "lucide-solid/icons/loader";
5
+ const button = tv({
6
+ base: `
7
+ inline-flex items-center justify-center gap-2 font-medium
8
+ transition active:opacity-60 hover:opacity-90
9
+ focus:outline-none focus:ring-1
10
+ disabled:opacity-50 disabled:cursor-not-allowed
11
+ rounded-md
12
+ `,
13
+ variants: {
14
+ appearance: {
15
+ primary: "bg-light-primary dark:bg-dark-primary/20 dark:text-dark-primary",
16
+ success: "bg-light-success dark:bg-dark-success/20 dark:text-dark-success",
17
+ warning: "bg-light-warning dark:bg-dark-warning/20 dark:text-dark-warning",
18
+ neutral: "bg-light-neutral dark:bg-dark-neutral/20 dark:text-dark-neutral",
19
+ error: "bg-light-error dark:bg-dark-error/20 dark:text-dark-error",
20
+ muted: "bg-light-muted dark:bg-dark-muted/20 dark:text-dark-muted",
21
+ },
22
+ size: {
23
+ xs: "text-xs px-2 py-1",
24
+ sm: "text-sm px-3 py-1.5",
25
+ md: "text-base px-4 py-2",
26
+ lg: "text-lg px-5 py-3",
27
+ },
28
+ variant: {
29
+ text: "bg-transparent dark:bg-transparent border-none py-0 px-1 hover:underline underline-offset-4",
30
+ solid: "dark:border-1",
31
+ },
32
+ },
33
+ compoundVariants: [
34
+ {
35
+ variant: "text",
36
+ appearance: "primary",
37
+ class: "text-light-primary dark:text-dark-primary",
38
+ },
39
+ {
40
+ variant: "text",
41
+ appearance: "success",
42
+ class: "text-light-success dark:text-dark-success",
43
+ },
44
+ {
45
+ variant: "text",
46
+ appearance: "warning",
47
+ class: "text-light-warning dark:text-dark-warning",
48
+ },
49
+ {
50
+ variant: "text",
51
+ appearance: "neutral",
52
+ class: "text-light-neutral dark:text-dark-neutral",
53
+ },
54
+ {
55
+ variant: "text",
56
+ appearance: "error",
57
+ class: "text-light-error dark:text-dark-error",
58
+ },
59
+ {
60
+ variant: "text",
61
+ appearance: "muted",
62
+ class: "text-light-muted dark:text-dark-muted",
63
+ },
64
+ ],
65
+ defaultVariants: {
66
+ variant: "solid",
67
+ appearance: "neutral",
68
+ size: "md",
69
+ },
70
+ });
71
+ export const Button = (props) => {
72
+ const [local, others] = splitProps(props, [
73
+ "children",
74
+ "class",
75
+ "variant",
76
+ "appearance",
77
+ "size",
78
+ "isLoading",
79
+ ]);
80
+ const classes = createMemo(() => button({
81
+ variant: local.variant,
82
+ appearance: local.appearance,
83
+ size: local.size,
84
+ class: local.class,
85
+ }));
86
+ return (<KButton class={classes()} disabled={local.isLoading} {...others}>
87
+ {local.children}
88
+ <Show when={local.isLoading}>
89
+ <Loader class="ml-2 animate-spin"/>
90
+ </Show>
91
+ </KButton>);
92
+ };
93
+ export default Button;
@@ -0,0 +1 @@
1
+ export * from "./Button";
@@ -0,0 +1 @@
1
+ export * from "./Button";
@@ -0,0 +1,6 @@
1
+ import { ParentComponent } from "solid-js";
2
+ interface Props {
3
+ class?: string;
4
+ }
5
+ export declare const Card: ParentComponent<Props>;
6
+ export default Card;
@@ -0,0 +1,6 @@
1
+ export const Card = (props) => {
2
+ return (<div class={`rounded-xl p-3 bg-[var(--color-light-surface)] dark:bg-[var(--color-dark-surface)] text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)] ${props.class ?? ""}`}>
3
+ {props.children}
4
+ </div>);
5
+ };
6
+ export default Card;
@@ -0,0 +1 @@
1
+ export * from "./Card";
@@ -0,0 +1 @@
1
+ export * from "./Card";
@@ -0,0 +1,10 @@
1
+ import { Component, ValidComponent } from "solid-js";
2
+ import { CheckboxRootProps } from "@kobalte/core/checkbox";
3
+ import { PolymorphicProps } from "@kobalte/core";
4
+ type CheckBoxProps<T extends ValidComponent = "div"> = PolymorphicProps<T, CheckboxRootProps<T>>;
5
+ interface Props extends CheckBoxProps {
6
+ label?: string;
7
+ saveFunc?: (v: boolean) => Promise<void>;
8
+ }
9
+ export declare const Checkbox: Component<Props>;
10
+ export default Checkbox;
@@ -0,0 +1,25 @@
1
+ import { createMemo, Show } from "solid-js";
2
+ import { Checkbox as KCheckbox } from "@kobalte/core/checkbox";
3
+ import Check from "lucide-solid/icons/check";
4
+ import { debounce } from "../../methods/debounce";
5
+ export const Checkbox = (props) => {
6
+ const debouncedSave = createMemo(() => (props.saveFunc ? debounce(props.saveFunc) : undefined));
7
+ const handleChange = (v) => {
8
+ props.onChange?.(v);
9
+ debouncedSave()?.(v);
10
+ };
11
+ return (<KCheckbox checked={props.checked} onChange={handleChange} class="flex flex-row space-x-2 items-center">
12
+ <KCheckbox.Input />
13
+ <KCheckbox.Control class="h-5 w-5 rounded-sm border-2 border-[var(--color-light-muted)] dark:border-[var(--color-dark-muted)] bg-[var(--color-light-surface)] dark:bg-[var(--color-dark-surface)] data-[checked]:bg-[var(--color-light-primary)] dark:data-[checked]:bg-[var(--color-dark-primary)] transition-colors">
14
+ <KCheckbox.Indicator class="text-[var(--color-light-surface)] dark:text-[var(--color-dark-surface)]">
15
+ <Check />
16
+ </KCheckbox.Indicator>
17
+ </KCheckbox.Control>
18
+ <Show when={props.label}>
19
+ <KCheckbox.Label class="text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)]">
20
+ {props.label}
21
+ </KCheckbox.Label>
22
+ </Show>
23
+ </KCheckbox>);
24
+ };
25
+ export default Checkbox;
@@ -0,0 +1 @@
1
+ export * from "./Checkbox";
@@ -0,0 +1 @@
1
+ export * from "./Checkbox";
@@ -0,0 +1,7 @@
1
+ import { ParentComponent } from "solid-js";
2
+ interface Props {
3
+ class?: string;
4
+ noPadding?: boolean;
5
+ }
6
+ export declare const Container: ParentComponent<Props>;
7
+ export default Container;
@@ -0,0 +1,5 @@
1
+ export const Container = (props) => {
2
+ const classes = `flex-1 ${props.noPadding ? "" : "py-4 px-[3vw]"} ${props.class ?? ""}`;
3
+ return <div class={classes}>{props.children}</div>;
4
+ };
5
+ export default Container;
@@ -0,0 +1 @@
1
+ export * from "./Container";
@@ -0,0 +1 @@
1
+ export * from "./Container";
@@ -0,0 +1,9 @@
1
+ import { Component } from "solid-js";
2
+ interface DateInputProps {
3
+ label?: string;
4
+ value: Date | null;
5
+ onChange: (date: Date | null) => void;
6
+ class?: string;
7
+ }
8
+ export declare const DateInput: Component<DateInputProps>;
9
+ export default DateInput;
@@ -0,0 +1,22 @@
1
+ import { Show } from "solid-js";
2
+ import { tv } from "tailwind-variants";
3
+ const dateInput = tv({
4
+ base: "rounded border px-2 py-1 bg-[var(--color-light-surface)] dark:bg-[var(--color-dark-surface)] text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)] border-[var(--color-light-muted)] dark:border-[var(--color-dark-muted)]",
5
+ });
6
+ export const DateInput = (props) => {
7
+ // Convert Date to yyyy-mm-dd string for input value
8
+ const valueStr = () => (props.value ? props.value.toISOString().slice(0, 10) : "");
9
+ const handleChange = (e) => {
10
+ const val = e.target.value;
11
+ props.onChange(val ? new Date(val) : null);
12
+ };
13
+ return (<div class={props.class}>
14
+ <Show when={props.label}>
15
+ <label class="block mb-1 text-xs font-medium text-[var(--color-text-light-secondary)] dark:text-[var(--color-text-dark-secondary)]">
16
+ {props.label}
17
+ </label>
18
+ </Show>
19
+ <input type="date" class={dateInput()} value={valueStr()} onInput={handleChange}/>
20
+ </div>);
21
+ };
22
+ export default DateInput;
@@ -0,0 +1 @@
1
+ export * from "./DateInput";
@@ -0,0 +1 @@
1
+ export * from "./DateInput";
@@ -0,0 +1,11 @@
1
+ import { Component } from "solid-js";
2
+ interface DropdownMenuProps {
3
+ label?: string;
4
+ items: {
5
+ label: string;
6
+ onSelect: () => void;
7
+ }[];
8
+ class?: string;
9
+ }
10
+ export declare const DropdownMenu: Component<DropdownMenuProps>;
11
+ export default DropdownMenu;
@@ -0,0 +1,22 @@
1
+ import { DropdownMenu as KDropdownMenu } from "@kobalte/core/dropdown-menu";
2
+ import { For } from "solid-js";
3
+ import { tv } from "tailwind-variants";
4
+ const menu = tv({
5
+ base: "bg-[var(--color-light-surface)] dark:bg-[var(--color-dark-surface)] rounded shadow-md p-2 min-w-[120px]",
6
+ });
7
+ const item = tv({
8
+ base: "px-3 py-2 cursor-pointer hover:bg-[var(--color-light-muted)] dark:hover:bg-[var(--color-dark-muted)] rounded",
9
+ });
10
+ export const DropdownMenu = (props) => (<KDropdownMenu>
11
+ <KDropdownMenu.Trigger class={props.class}>{props.label}</KDropdownMenu.Trigger>
12
+ <KDropdownMenu.Portal>
13
+ <KDropdownMenu.Content class={menu()}>
14
+ <For each={props.items}>
15
+ {(itemObj) => (<KDropdownMenu.Item class={item()} onSelect={itemObj.onSelect}>
16
+ {itemObj.label}
17
+ </KDropdownMenu.Item>)}
18
+ </For>
19
+ </KDropdownMenu.Content>
20
+ </KDropdownMenu.Portal>
21
+ </KDropdownMenu>);
22
+ export default DropdownMenu;
@@ -0,0 +1 @@
1
+ export * from "./DropdownMenu";
@@ -0,0 +1 @@
1
+ export * from "./DropdownMenu";
@@ -0,0 +1,10 @@
1
+ import { Component } from "solid-js";
2
+ interface FileInputProps {
3
+ label?: string;
4
+ onChange: (files: FileList | null) => void;
5
+ accept?: string;
6
+ multiple?: boolean;
7
+ class?: string;
8
+ }
9
+ export declare const FileInput: Component<FileInputProps>;
10
+ export default FileInput;
@@ -0,0 +1,18 @@
1
+ import { Show, splitProps } from "solid-js";
2
+ import { tv } from "tailwind-variants";
3
+ const root = tv({ base: "flex flex-col gap-1" });
4
+ const input = tv({
5
+ base: "block w-full text-sm text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)] file:mr-4 file:py-2 file:px-4 file:rounded file:border-0 file:text-sm file:font-semibold file:bg-[var(--color-light-muted)] dark:file:bg-[var(--color-dark-muted)] file:text-[var(--color-light-primary)] dark:file:text-[var(--color-dark-primary)] hover:file:bg-[var(--color-light-surface)] dark:hover:file:bg-[var(--color-dark-surface)] transition",
6
+ });
7
+ export const FileInput = (props) => {
8
+ const [local, others] = splitProps(props, ["label", "class", "onChange"]);
9
+ return (<div class={root({ class: local.class })}>
10
+ <Show when={local.label}>
11
+ <label class="block mb-1 text-xs font-medium text-[var(--color-text-light-secondary)] dark:text-[var(--color-text-dark-secondary)]">
12
+ {local.label}
13
+ </label>
14
+ </Show>
15
+ <input type="file" class={input()} accept={props.accept} multiple={props.multiple} {...others} onChange={(e) => local.onChange(e.currentTarget.files)}/>
16
+ </div>);
17
+ };
18
+ export default FileInput;
@@ -0,0 +1 @@
1
+ export * from "./FileInput";
@@ -0,0 +1 @@
1
+ export * from "./FileInput";
@@ -0,0 +1,2 @@
1
+ import { ParentComponent } from "solid-js";
2
+ export declare const Form: ParentComponent;
@@ -0,0 +1,3 @@
1
+ export const Form = (props) => {
2
+ return <div>{props.children}</div>;
3
+ };
@@ -0,0 +1 @@
1
+ export * from "./Form";
@@ -0,0 +1 @@
1
+ export * from "./Form";
@@ -0,0 +1,7 @@
1
+ import { JSX } from "solid-js";
2
+ interface Props extends JSX.HTMLAttributes<HTMLElement> {
3
+ as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
4
+ appearance?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
5
+ }
6
+ export declare const Heading: (props: Props) => JSX.Element;
7
+ export default Heading;
@@ -0,0 +1,29 @@
1
+ import { splitProps, createMemo } from "solid-js";
2
+ import { Dynamic } from "solid-js/web";
3
+ import { tv } from "tailwind-variants";
4
+ const heading = tv({
5
+ base: "font-sans text-balance tracking-tight",
6
+ variants: {
7
+ appearance: {
8
+ h1: "text-4xl font-bold",
9
+ h2: "text-3xl font-semibold",
10
+ h3: "text-2xl font-semibold",
11
+ h4: "text-xl font-medium",
12
+ h5: "text-lg font-medium",
13
+ h6: "text-base font-medium",
14
+ p: "text-base font-normal",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ appearance: "p",
19
+ },
20
+ });
21
+ export const Heading = (props) => {
22
+ const [local, others] = splitProps(props, ["as", "appearance", "class", "children"]);
23
+ const Tag = (local.as ?? "p");
24
+ const classes = createMemo(() => heading({ appearance: local.appearance ?? local.as ?? "p", class: local.class }));
25
+ return (<Dynamic component={Tag} class={classes()} {...others}>
26
+ {local.children}
27
+ </Dynamic>);
28
+ };
29
+ export default Heading;
@@ -0,0 +1 @@
1
+ export * from "./Heading";
@@ -0,0 +1 @@
1
+ export * from "./Heading";
@@ -0,0 +1,9 @@
1
+ import { Component } from "solid-js";
2
+ interface ImageProps {
3
+ src: string;
4
+ alt?: string;
5
+ class?: string;
6
+ rounded?: boolean;
7
+ }
8
+ export declare const Image: Component<ImageProps>;
9
+ export default Image;
@@ -0,0 +1,15 @@
1
+ import { tv } from "tailwind-variants";
2
+ const image = tv({
3
+ base: "object-cover",
4
+ variants: {
5
+ rounded: {
6
+ true: "rounded-full",
7
+ false: "rounded-none",
8
+ },
9
+ },
10
+ defaultVariants: {
11
+ rounded: false,
12
+ },
13
+ });
14
+ export const Image = (props) => (<img src={props.src} alt={props.alt} class={image({ rounded: props.rounded, class: props.class })}/>);
15
+ export default Image;
@@ -0,0 +1 @@
1
+ export * from "./Image";
@@ -0,0 +1 @@
1
+ export * from "./Image";
@@ -0,0 +1,15 @@
1
+ import { Component, ValidComponent } from "solid-js";
2
+ import { type TextFieldInputProps, type TextFieldRootProps } from "@kobalte/core/text-field";
3
+ import type { PolymorphicProps } from "@kobalte/core";
4
+ type InputProps<T extends ValidComponent = "input"> = PolymorphicProps<T, TextFieldInputProps<T>>;
5
+ interface ExtraProps {
6
+ label?: string;
7
+ variant?: "ghost" | "none";
8
+ appearance?: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
9
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
10
+ inputProps?: InputProps;
11
+ saveFunc?: (v: string) => Promise<any>;
12
+ }
13
+ type InputRootProps<T extends ValidComponent = "div"> = ExtraProps & PolymorphicProps<T, TextFieldRootProps<T>>;
14
+ export declare const Input: Component<InputRootProps>;
15
+ export default Input;
@@ -0,0 +1,86 @@
1
+ import { createMemo, Show, splitProps } from "solid-js";
2
+ import { TextField } from "@kobalte/core/text-field";
3
+ import { tv } from "tailwind-variants";
4
+ import { debounce } from "../../methods/debounce";
5
+ const inputRoot = tv({
6
+ base: "relative flex flex-col gap-1 mt-3",
7
+ });
8
+ const inputLabel = tv({
9
+ base: "absolute left-3 px-1 font-medium pointer-events-none z-10 bg-base-100",
10
+ variants: {
11
+ size: {
12
+ xs: "text-xs",
13
+ sm: "text-xs",
14
+ md: "text-sm",
15
+ lg: "text-sm",
16
+ xl: "text-md",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ size: "md",
21
+ },
22
+ });
23
+ const inputField = tv({
24
+ base: "input outline-offset-0",
25
+ variants: {
26
+ variant: {
27
+ ghost: "input-ghost",
28
+ none: "",
29
+ },
30
+ size: {
31
+ xs: "input-xs",
32
+ sm: "input-sm",
33
+ md: "input-md",
34
+ lg: "input-lg",
35
+ xl: "input-xl",
36
+ },
37
+ appearance: {
38
+ neutral: "input-neutral",
39
+ primary: "input-primary",
40
+ secondary: "input-secondary",
41
+ accent: "input-accent",
42
+ info: "input-info",
43
+ success: "input-success",
44
+ warning: "input-warning",
45
+ error: "input-error",
46
+ },
47
+ },
48
+ defaultVariants: {
49
+ variant: "none",
50
+ size: "md",
51
+ appearance: "neutral",
52
+ },
53
+ });
54
+ export const Input = (props) => {
55
+ const [local, others] = splitProps(props, [
56
+ "label",
57
+ "class",
58
+ "variant",
59
+ "appearance",
60
+ "size",
61
+ "inputProps",
62
+ "saveFunc",
63
+ "onChange",
64
+ ]);
65
+ const debouncedSave = createMemo(() => (local.saveFunc ? debounce(local.saveFunc) : undefined));
66
+ const handleChange = (v) => {
67
+ local.onChange?.(v);
68
+ debouncedSave()?.(v);
69
+ };
70
+ return (<TextField class={inputRoot({ class: local.class })} {...others} onChange={handleChange}>
71
+ <div class="relative w-full">
72
+ <Show when={local.label}>
73
+ <TextField.Label class={inputLabel({ size: local.size })} style="transform: translateY(-50%);">
74
+ {local.label}
75
+ </TextField.Label>
76
+ </Show>
77
+ <TextField.Input class={inputField({
78
+ appearance: local.appearance,
79
+ variant: local.variant,
80
+ size: local.size,
81
+ class: local.inputProps?.class,
82
+ })} {...local.inputProps}/>
83
+ </div>
84
+ </TextField>);
85
+ };
86
+ export default Input;
@@ -0,0 +1 @@
1
+ export * from "./Input";
@@ -0,0 +1 @@
1
+ export * from "./Input";
@@ -0,0 +1,9 @@
1
+ import { JSX, ValidComponent, ParentComponent } from "solid-js";
2
+ interface LinkProps {
3
+ as?: ValidComponent;
4
+ href?: string;
5
+ children: JSX.Element;
6
+ class?: string;
7
+ }
8
+ export declare const Link: ParentComponent<LinkProps>;
9
+ export default Link;
@@ -0,0 +1,13 @@
1
+ import { splitProps } from "solid-js";
2
+ import { Dynamic } from "solid-js/web";
3
+ import { tv } from "tailwind-variants";
4
+ const link = tv({
5
+ base: "text-[var(--color-light-primary)] dark:text-[var(--color-dark-primary)] hover:underline underline-offset-4 transition",
6
+ });
7
+ export const Link = (props) => {
8
+ const [local, others] = splitProps(props, ["as", "children", "class"]);
9
+ return (<Dynamic component={local.as ?? "a"} {...others} class={link({ class: local.class })}>
10
+ {local.children}
11
+ </Dynamic>);
12
+ };
13
+ export default Link;
@@ -0,0 +1 @@
1
+ export * from "./Link";
@@ -0,0 +1 @@
1
+ export * from "./Link";
@@ -0,0 +1,26 @@
1
+ import { ColumnDef, ColumnFiltersState, Row } from "@tanstack/solid-table";
2
+ import { Accessor, JSXElement } from "solid-js";
3
+ interface ListProps<T> {
4
+ data?: Accessor<T[]>;
5
+ filters?: Accessor<ColumnFiltersState>;
6
+ createFunc?: () => Promise<void>;
7
+ headerActions?: JSXElement;
8
+ columns: Accessor<ColumnDef<T>[]>;
9
+ onRowClick: (item: T) => void;
10
+ loading?: boolean;
11
+ emptyState?: JSXElement;
12
+ loadingFallback?: JSXElement;
13
+ searchPlaceholder?: string;
14
+ renderRow?: (row: Row<T>, onRowClick: (item: T) => void) => JSXElement;
15
+ showItemCount?: boolean;
16
+ containerClass?: string;
17
+ search?: boolean;
18
+ headers?: boolean;
19
+ }
20
+ export declare const DefaultRowRenderer: <T>(props: {
21
+ row: Row<T>;
22
+ columns: Accessor<ColumnDef<T>[]>;
23
+ onClick: (item: T) => void;
24
+ }) => JSXElement;
25
+ export declare const List: <T>(props: ListProps<T>) => JSXElement;
26
+ export default List;