@solidpb/ui-kit 0.1.1 → 0.3.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.
- package/README.md +17 -0
- package/dist/components/ActivityFeed/ActivityFeed.d.ts +16 -0
- package/dist/components/ActivityFeed/ActivityFeed.jsx +54 -0
- package/dist/components/ActivityFeed/index.d.ts +1 -0
- package/dist/components/ActivityFeed/index.js +1 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +27 -0
- package/dist/components/AlertDialog/AlertDialog.jsx +62 -0
- package/dist/components/AlertDialog/alertDialogContext.d.ts +9 -0
- package/dist/components/AlertDialog/alertDialogContext.js +2 -0
- package/dist/components/AlertDialog/index.d.ts +1 -0
- package/dist/components/AlertDialog/index.js +1 -0
- package/dist/components/Avatar/Avatar.d.ts +10 -0
- package/dist/components/Avatar/Avatar.jsx +30 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/BreadCrumbs/BreadCrumbs.d.ts +12 -0
- package/dist/components/BreadCrumbs/BreadCrumbs.jsx +26 -0
- package/dist/components/BreadCrumbs/index.d.ts +1 -0
- package/dist/components/BreadCrumbs/index.js +1 -0
- package/dist/components/Button/Button.d.ts +3 -3
- package/dist/components/Button/Button.jsx +1 -6
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Card/Card.jsx +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +6 -7
- package/dist/components/Checkbox/Checkbox.jsx +39 -22
- package/dist/components/ColorPicker/ColorPicker.d.ts +10 -0
- package/dist/components/ColorPicker/ColorPicker.jsx +61 -0
- package/dist/components/ColorPicker/index.d.ts +1 -0
- package/dist/components/ColorPicker/index.js +1 -0
- package/dist/components/Container/Container.d.ts +0 -1
- package/dist/components/Container/Container.jsx +2 -8
- package/dist/components/DateInput/DateInput.d.ts +5 -0
- package/dist/components/DateInput/DateInput.jsx +29 -8
- package/dist/components/Drawer/Drawer.d.ts +33 -0
- package/dist/components/Drawer/Drawer.jsx +49 -0
- package/dist/components/Drawer/drawerContext.d.ts +6 -0
- package/dist/components/Drawer/drawerContext.js +9 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +23 -7
- package/dist/components/DropdownMenu/DropdownMenu.jsx +41 -15
- package/dist/components/FileInput/FileInput.d.ts +7 -3
- package/dist/components/FileInput/FileInput.jsx +35 -9
- package/dist/components/FilterBar/AddFilter.d.ts +9 -0
- package/dist/components/FilterBar/AddFilter.jsx +14 -0
- package/dist/components/FilterBar/AddSortingDropdown.d.ts +9 -0
- package/dist/components/FilterBar/AddSortingDropdown.jsx +67 -0
- package/dist/components/FilterBar/EditFilters.d.ts +10 -0
- package/dist/components/FilterBar/EditFilters.jsx +12 -0
- package/dist/components/FilterBar/FilterBar.d.ts +54 -0
- package/dist/components/FilterBar/FilterBar.jsx +234 -0
- package/dist/components/FilterBar/FilterChip.d.ts +23 -0
- package/dist/components/FilterBar/FilterChip.jsx +220 -0
- package/dist/components/FilterBar/FilterEdit.d.ts +13 -0
- package/dist/components/FilterBar/FilterEdit.jsx +159 -0
- package/dist/components/FilterBar/FiltersEdit.d.ts +13 -0
- package/dist/components/FilterBar/FiltersEdit.jsx +45 -0
- package/dist/components/FilterBar/index.d.ts +1 -0
- package/dist/components/FilterBar/index.js +1 -0
- package/dist/components/Form/Form.d.ts +37 -2
- package/dist/components/Form/Form.jsx +102 -3
- package/dist/components/Form/formContext.d.ts +2 -0
- package/dist/components/Form/formContext.js +9 -0
- package/dist/components/Image/Image.d.ts +6 -7
- package/dist/components/Image/Image.jsx +74 -7
- package/dist/components/Input/Input.d.ts +4 -4
- package/dist/components/Input/Input.jsx +9 -35
- package/dist/components/Kanban/Kanban.d.ts +19 -0
- package/dist/components/Kanban/Kanban.jsx +68 -0
- package/dist/components/Kanban/KanbanCard.d.ts +11 -0
- package/dist/components/Kanban/KanbanCard.jsx +94 -0
- package/dist/components/Kanban/KanbanColumn.d.ts +18 -0
- package/dist/components/Kanban/KanbanColumn.jsx +251 -0
- package/dist/components/Kanban/index.d.ts +1 -0
- package/dist/components/Kanban/index.js +1 -0
- package/dist/components/Link/Link.d.ts +8 -6
- package/dist/components/Link/Link.jsx +17 -5
- package/dist/components/Modal/Modal.d.ts +17 -8
- package/dist/components/Modal/Modal.jsx +32 -39
- package/dist/components/Modal/modalContext.d.ts +2 -3
- package/dist/components/Navbar/Navbar.d.ts +26 -0
- package/dist/components/Navbar/Navbar.jsx +40 -0
- package/dist/components/Navbar/index.d.ts +1 -0
- package/dist/components/Navbar/index.js +1 -0
- package/dist/components/NumberInput/NumberInput.d.ts +8 -6
- package/dist/components/NumberInput/NumberInput.jsx +52 -7
- package/dist/components/Pagination/Pagination.d.ts +15 -0
- package/dist/components/Pagination/Pagination.jsx +67 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/components/SearchInput/SearchInput.jsx +38 -3
- package/dist/components/Select/Select.d.ts +13 -11
- package/dist/components/Select/Select.jsx +78 -32
- package/dist/components/Slider/Slider.d.ts +16 -0
- package/dist/components/Slider/Slider.jsx +60 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Switch/Switch.d.ts +6 -8
- package/dist/components/Switch/Switch.jsx +38 -19
- package/dist/components/Table/Table.d.ts +27 -0
- package/dist/components/Table/Table.jsx +193 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.js +1 -0
- package/dist/components/Tabs/Tabs.d.ts +25 -1
- package/dist/components/Tabs/Tabs.jsx +42 -1
- package/dist/components/Tabs/tabContext.d.ts +9 -0
- package/dist/components/Tabs/tabContext.js +2 -0
- package/dist/components/Tag/Tag.d.ts +7 -5
- package/dist/components/Tag/Tag.jsx +40 -14
- package/dist/components/TagArea/TagArea.d.ts +6 -2
- package/dist/components/TagArea/TagArea.jsx +89 -35
- package/dist/components/TextArea/TextArea.d.ts +9 -8
- package/dist/components/TextArea/TextArea.jsx +54 -18
- package/dist/components/ThemeSwitch/ThemeSwitch.d.ts +11 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.jsx +49 -0
- package/dist/components/ThemeSwitch/index.d.ts +1 -0
- package/dist/components/ThemeSwitch/index.js +1 -0
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/Toast/Toast.jsx +13 -10
- package/dist/components/Toast/Toaster.jsx +1 -2
- package/dist/components/Tooltip/Tooltip.d.ts +4 -3
- package/dist/components/Tooltip/Tooltip.jsx +19 -8
- package/dist/constants.d.ts +8 -0
- package/dist/constants.js +8 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +14 -2
- package/dist/methods/triggerFlash.d.ts +1 -0
- package/dist/methods/triggerFlash.js +7 -0
- package/package.json +3 -2
- package/dist/components/List/List.d.ts +0 -26
- package/dist/components/List/List.jsx +0 -120
- package/dist/components/List/index.d.ts +0 -1
- package/dist/components/List/index.js +0 -1
- package/dist/components/RelationPicker/RelationPicker.d.ts +0 -11
- package/dist/components/RelationPicker/RelationPicker.jsx +0 -13
- package/dist/components/RelationPicker/index.d.ts +0 -1
- package/dist/components/RelationPicker/index.js +0 -1
package/README.md
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
1
|
## UI components for solidpb
|
|
2
|
+
|
|
3
|
+
Need to add below to vite.config.ts:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
optimizeDeps: {
|
|
7
|
+
exclude: ["@solidpb/ui-kit"],
|
|
8
|
+
},
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Also to index.css (refer daisyui docs):
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
@plugin "daisyui" {
|
|
15
|
+
themes: {choose theme} --default, {choose theme} --prefersdark;
|
|
16
|
+
}
|
|
17
|
+
@source "../node_modules/@solidpb/ui-kit";
|
|
18
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component } from "solid-js";
|
|
2
|
+
export interface FeedItem {
|
|
3
|
+
username: string;
|
|
4
|
+
profileUrl: string;
|
|
5
|
+
message: string;
|
|
6
|
+
timeStamp: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ActivityFeedProps {
|
|
9
|
+
feed: FeedItem[];
|
|
10
|
+
class?: string;
|
|
11
|
+
profileUrl: string;
|
|
12
|
+
username: string;
|
|
13
|
+
onMessageCreate?: (msg: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const ActivityFeed: Component<ActivityFeedProps>;
|
|
16
|
+
export default ActivityFeed;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createSignal, For } from "solid-js";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { Avatar } from "../Avatar";
|
|
4
|
+
import { TextArea } from "../TextArea";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
const activityFeed = tv({
|
|
7
|
+
base: "bg-base-100 w-100 min-h-full border-l border-l-base-300 p-3",
|
|
8
|
+
});
|
|
9
|
+
export const ActivityFeed = (props) => {
|
|
10
|
+
const [feed, setFeed] = createSignal(props.feed);
|
|
11
|
+
const [input, setInput] = createSignal("");
|
|
12
|
+
const handleSubmit = () => {
|
|
13
|
+
props.onMessageCreate?.(input());
|
|
14
|
+
const date = new Date();
|
|
15
|
+
const dateString = date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
|
|
16
|
+
setFeed([
|
|
17
|
+
...feed(),
|
|
18
|
+
{ username: props.username, profileUrl: props.profileUrl, message: input(), timeStamp: dateString },
|
|
19
|
+
]);
|
|
20
|
+
setInput("");
|
|
21
|
+
};
|
|
22
|
+
return (<div class={activityFeed({ class: props.class })}>
|
|
23
|
+
<div class="mb-2">
|
|
24
|
+
<div class="flex items-start gap-2.5">
|
|
25
|
+
<Avatar src={props.profileUrl} class="w-10"/>
|
|
26
|
+
<div class="space-y-1 flex-1">
|
|
27
|
+
<TextArea textareaProps={{ autoResize: true }} value={input()} onChange={setInput}/>
|
|
28
|
+
<div>
|
|
29
|
+
<Button size="sm" appearance="primary" onClick={handleSubmit}>
|
|
30
|
+
Send
|
|
31
|
+
</Button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div>
|
|
37
|
+
<For each={feed().reverse()}>
|
|
38
|
+
{(feedItem) => (<div class="chat chat-start">
|
|
39
|
+
<div class="chat-image avatar">
|
|
40
|
+
<div class="w-10 rounded-full">
|
|
41
|
+
<img src={feedItem.profileUrl}/>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="chat-header">
|
|
45
|
+
{feedItem.username}
|
|
46
|
+
<time class="text-xs opacity-50">{feedItem.timeStamp}</time>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="chat-bubble text-sm">{feedItem.message}</div>
|
|
49
|
+
</div>)}
|
|
50
|
+
</For>
|
|
51
|
+
</div>
|
|
52
|
+
</div>);
|
|
53
|
+
};
|
|
54
|
+
export default ActivityFeed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ActivityFeed";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ActivityFeed";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSXElement, ParentComponent } from "solid-js";
|
|
2
|
+
import { ButtonProps } from "../Button";
|
|
3
|
+
interface AlertDialogProps {
|
|
4
|
+
id: string;
|
|
5
|
+
actions?: JSXElement;
|
|
6
|
+
}
|
|
7
|
+
interface AlertDialogContentProps {
|
|
8
|
+
title: string;
|
|
9
|
+
}
|
|
10
|
+
interface AlertDialogComponents {
|
|
11
|
+
Button: ParentComponent<ButtonProps>;
|
|
12
|
+
Buttons: ParentComponent;
|
|
13
|
+
Content: ParentComponent<AlertDialogContentProps>;
|
|
14
|
+
Trigger: ParentComponent<ButtonProps>;
|
|
15
|
+
}
|
|
16
|
+
export declare const AlertDialog: ParentComponent<AlertDialogProps> & AlertDialogComponents;
|
|
17
|
+
export declare const AlertDialogButton: ParentComponent<ButtonProps>;
|
|
18
|
+
export declare const AlertDialogButtons: ParentComponent;
|
|
19
|
+
export declare const AlertDialogTrigger: ParentComponent<ButtonProps>;
|
|
20
|
+
export declare const AlertDialogContent: ParentComponent<AlertDialogContentProps>;
|
|
21
|
+
export default AlertDialog;
|
|
22
|
+
export declare function useAlertDialog(): {
|
|
23
|
+
id: string;
|
|
24
|
+
actions?: JSXElement;
|
|
25
|
+
open: import("solid-js").Accessor<boolean>;
|
|
26
|
+
setOpen: (v: boolean) => void;
|
|
27
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createSignal, useContext } from "solid-js";
|
|
2
|
+
import Close from "lucide-solid/icons/x";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
import { AlertDialogContext } from "./alertDialogContext";
|
|
5
|
+
export const AlertDialog = (props) => {
|
|
6
|
+
const [open, setOpen] = createSignal(false);
|
|
7
|
+
const handleOpen = (v) => {
|
|
8
|
+
if (v) {
|
|
9
|
+
const dialog = document.getElementById(props.id);
|
|
10
|
+
dialog.showModal();
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const dialog = document.getElementById(props.id);
|
|
14
|
+
dialog.close();
|
|
15
|
+
}
|
|
16
|
+
setOpen(v);
|
|
17
|
+
};
|
|
18
|
+
return (<AlertDialogContext.Provider value={{ id: props.id, open, setOpen: handleOpen }}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</AlertDialogContext.Provider>);
|
|
21
|
+
};
|
|
22
|
+
export const AlertDialogButton = (props) => {
|
|
23
|
+
return <Button {...props} size="sm"></Button>;
|
|
24
|
+
};
|
|
25
|
+
export const AlertDialogButtons = (props) => {
|
|
26
|
+
return <div class="flex justify-end gap-2">{props.children}</div>;
|
|
27
|
+
};
|
|
28
|
+
export const AlertDialogTrigger = (props) => {
|
|
29
|
+
const { open, setOpen } = useAlertDialog();
|
|
30
|
+
return (<Button {...props} size="sm" onClick={() => setOpen(!open())}>
|
|
31
|
+
{props.children}
|
|
32
|
+
</Button>);
|
|
33
|
+
};
|
|
34
|
+
export const AlertDialogContent = (props) => {
|
|
35
|
+
const { id, setOpen } = useAlertDialog();
|
|
36
|
+
return (<dialog id={id} class="modal">
|
|
37
|
+
<div class="modal-box">
|
|
38
|
+
<div class="flex justify-between items-start">
|
|
39
|
+
{props.title && <h3 class="font-bold text-lg mb-2">{props.title}</h3>}
|
|
40
|
+
<Button variant="ghost" modifier="square" size="xs" onClick={() => setOpen(false)}>
|
|
41
|
+
<Close size={20}/>
|
|
42
|
+
</Button>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="flex flex-col gap-2">{props.children}</div>
|
|
45
|
+
</div>
|
|
46
|
+
<form method="dialog" class="modal-backdrop">
|
|
47
|
+
<button class="cursor-auto">close</button>
|
|
48
|
+
</form>
|
|
49
|
+
</dialog>);
|
|
50
|
+
};
|
|
51
|
+
AlertDialog.Button = AlertDialogButton;
|
|
52
|
+
AlertDialog.Buttons = AlertDialogButtons;
|
|
53
|
+
AlertDialog.Trigger = AlertDialogTrigger;
|
|
54
|
+
AlertDialog.Content = AlertDialogContent;
|
|
55
|
+
export default AlertDialog;
|
|
56
|
+
export function useAlertDialog() {
|
|
57
|
+
const context = useContext(AlertDialogContext);
|
|
58
|
+
if (!context) {
|
|
59
|
+
throw new Error("useModal must be used within a Modal");
|
|
60
|
+
}
|
|
61
|
+
return context;
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Accessor, JSXElement } from "solid-js";
|
|
2
|
+
type AlertDialogContextType = {
|
|
3
|
+
id: string;
|
|
4
|
+
actions?: JSXElement;
|
|
5
|
+
open: Accessor<boolean>;
|
|
6
|
+
setOpen: (v: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const AlertDialogContext: import("solid-js").Context<AlertDialogContextType | undefined>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AlertDialog";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AlertDialog";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Component } from "solid-js";
|
|
2
|
+
interface AvatarProps {
|
|
3
|
+
src?: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
fallback?: string;
|
|
7
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
8
|
+
}
|
|
9
|
+
export declare const Avatar: Component<AvatarProps>;
|
|
10
|
+
export default Avatar;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Image } from "@kobalte/core/image";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const avatar = tv({
|
|
4
|
+
base: "rounded-full font-bold",
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
xs: "w-6 h-6 text-xs",
|
|
8
|
+
sm: "w-8 h-8 text-sm",
|
|
9
|
+
md: "w-12 h-12 text-lg",
|
|
10
|
+
lg: "w-16 h-16 text-2xl",
|
|
11
|
+
xl: "w-24 h-24 text-4xl",
|
|
12
|
+
},
|
|
13
|
+
fallback: {
|
|
14
|
+
true: "bg-base-200 flex items-center justify-center",
|
|
15
|
+
false: "",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: "sm",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export const Avatar = (props) => {
|
|
23
|
+
return (<Image fallbackDelay={100} class="avatar">
|
|
24
|
+
<Image.Img src={props.src} alt={props.alt} class={avatar({ size: props.size, class: props.class })}/>
|
|
25
|
+
<Image.Fallback class={avatar({ size: props.size, class: props.class, fallback: true })}>
|
|
26
|
+
{props.fallback}
|
|
27
|
+
</Image.Fallback>
|
|
28
|
+
</Image>);
|
|
29
|
+
};
|
|
30
|
+
export default Avatar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Avatar";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Avatar";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component } from "solid-js";
|
|
2
|
+
export interface BreadCrumb {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface BreadCrumbsProps {
|
|
8
|
+
items: BreadCrumb[];
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const BreadCrumbs: Component<BreadCrumbsProps>;
|
|
12
|
+
export default BreadCrumbs;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { For, Show } from "solid-js";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const breadcrumbs = tv({
|
|
4
|
+
base: "breadcrumbs text-sm",
|
|
5
|
+
});
|
|
6
|
+
export const BreadCrumbs = (props) => {
|
|
7
|
+
return (<div class={breadcrumbs({ class: props.class })}>
|
|
8
|
+
<ul>
|
|
9
|
+
<For each={props.items}>
|
|
10
|
+
{(item) => (<li>
|
|
11
|
+
<Show when={item.href || item.onClick} fallback={item.label}>
|
|
12
|
+
<a href={item.href} onClick={(e) => {
|
|
13
|
+
if (item.onClick) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
item.onClick();
|
|
16
|
+
}
|
|
17
|
+
}}>
|
|
18
|
+
{item.label}
|
|
19
|
+
</a>
|
|
20
|
+
</Show>
|
|
21
|
+
</li>)}
|
|
22
|
+
</For>
|
|
23
|
+
</ul>
|
|
24
|
+
</div>);
|
|
25
|
+
};
|
|
26
|
+
export default BreadCrumbs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BreadCrumbs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BreadCrumbs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ParentComponent, ValidComponent } from "solid-js";
|
|
2
|
-
import { ButtonRootProps } from "@kobalte/core/button";
|
|
2
|
+
import { type ButtonRootProps } from "@kobalte/core/button";
|
|
3
3
|
import { PolymorphicProps } from "@kobalte/core/polymorphic";
|
|
4
4
|
type BaseProps<T extends ValidComponent = "button"> = PolymorphicProps<T, ButtonRootProps<T>>;
|
|
5
|
-
interface
|
|
5
|
+
export interface ButtonProps extends BaseProps {
|
|
6
6
|
variant?: "outline" | "dash" | "soft" | "ghost" | "link";
|
|
7
7
|
appearance?: "primary" | "secondary" | "success" | "warning" | "neutral" | "error" | "accent" | "info";
|
|
8
8
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
9
|
modifier?: "wide" | "block" | "square" | "circle";
|
|
10
10
|
isLoading?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const Button: ParentComponent<
|
|
12
|
+
export declare const Button: ParentComponent<ButtonProps>;
|
|
13
13
|
export default Button;
|
|
@@ -28,21 +28,16 @@ const button = tv({
|
|
|
28
28
|
soft: "btn-soft",
|
|
29
29
|
ghost: "btn-ghost",
|
|
30
30
|
link: "btn-link",
|
|
31
|
-
none: "",
|
|
32
31
|
},
|
|
33
32
|
modifier: {
|
|
34
33
|
wide: "btn-wide",
|
|
35
34
|
block: "btn-block",
|
|
36
35
|
square: "btn-square",
|
|
37
36
|
circle: "btn-circle",
|
|
38
|
-
none: "",
|
|
39
37
|
},
|
|
40
38
|
},
|
|
41
39
|
defaultVariants: {
|
|
42
|
-
|
|
43
|
-
appearance: "neutral",
|
|
44
|
-
size: "md",
|
|
45
|
-
modifier: "none",
|
|
40
|
+
size: "sm",
|
|
46
41
|
},
|
|
47
42
|
});
|
|
48
43
|
const spinnerSizeMap = {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Show } from "solid-js";
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
3
|
const card = tv({
|
|
4
|
-
base: "card bg-base-100 shadow-sm",
|
|
4
|
+
base: "card bg-base-100 shadow-sm border border-base-200",
|
|
5
5
|
});
|
|
6
6
|
const cardBody = tv({
|
|
7
7
|
base: "card-body w-full",
|
|
8
8
|
});
|
|
9
|
+
const cardImage = tv({
|
|
10
|
+
base: "px-4 pt-4",
|
|
11
|
+
});
|
|
9
12
|
export const Card = (props) => {
|
|
10
13
|
return (<div class={card({ class: props.class })}>
|
|
11
14
|
<Show when={props.img}>
|
|
12
|
-
<figure>
|
|
15
|
+
<figure class={cardImage({ class: props.imgClass })}>
|
|
13
16
|
<img src={props.img} alt={props.imgAlt ?? "Card Image"}/>
|
|
14
17
|
</figure>
|
|
15
18
|
</Show>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Component,
|
|
2
|
-
|
|
3
|
-
import { PolymorphicProps } from "@kobalte/core";
|
|
4
|
-
type CheckBoxProps<T extends ValidComponent = "div"> = PolymorphicProps<T, CheckboxRootProps<T>>;
|
|
5
|
-
interface Props extends CheckBoxProps {
|
|
1
|
+
import { Component, JSX } from "solid-js";
|
|
2
|
+
export interface CheckboxProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "onChange"> {
|
|
6
3
|
label?: string;
|
|
7
|
-
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
5
|
+
appearance?: "primary" | "secondary" | "success" | "warning" | "error" | "info" | "accent" | "neutral";
|
|
6
|
+
onChange?: (checked: boolean) => void;
|
|
8
7
|
}
|
|
9
|
-
export declare const Checkbox: Component<
|
|
8
|
+
export declare const Checkbox: Component<CheckboxProps>;
|
|
10
9
|
export default Checkbox;
|
|
@@ -1,25 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { splitProps } from "solid-js";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const checkbox = tv({
|
|
4
|
+
base: "checkbox",
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
xs: "checkbox-xs",
|
|
8
|
+
sm: "checkbox-sm",
|
|
9
|
+
md: "checkbox-md",
|
|
10
|
+
lg: "checkbox-lg",
|
|
11
|
+
xl: "checkbox-xl",
|
|
12
|
+
},
|
|
13
|
+
appearance: {
|
|
14
|
+
primary: "checkbox-primary",
|
|
15
|
+
secondary: "checkbox-secondary",
|
|
16
|
+
success: "checkbox-success",
|
|
17
|
+
warning: "checkbox-warning",
|
|
18
|
+
error: "checkbox-error",
|
|
19
|
+
info: "checkbox-info",
|
|
20
|
+
accent: "checkbox-accent",
|
|
21
|
+
neutral: "checkbox-neutral",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "sm",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
5
28
|
export const Checkbox = (props) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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>);
|
|
29
|
+
const [local, inputProps] = splitProps(props, ["label", "size", "appearance", "class", "onChange"]);
|
|
30
|
+
return (<label class="flex items-center gap-3 w-fit">
|
|
31
|
+
<input {...inputProps} type="checkbox" class={checkbox({
|
|
32
|
+
size: local.size,
|
|
33
|
+
appearance: local.appearance,
|
|
34
|
+
class: local.class,
|
|
35
|
+
})} onChange={(e) => {
|
|
36
|
+
local.onChange?.(e.currentTarget.checked);
|
|
37
|
+
}}/>
|
|
38
|
+
|
|
39
|
+
{local.label && <span class="select-none">{local.label}</span>}
|
|
40
|
+
</label>);
|
|
24
41
|
};
|
|
25
42
|
export default Checkbox;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface ColorPickerProps {
|
|
2
|
+
value?: string;
|
|
3
|
+
onChange?: (color: string) => void;
|
|
4
|
+
saveFunc?: (v: string) => Promise<void>;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
label?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function ColorPicker(props: ColorPickerProps): import("solid-js").JSX.Element;
|
|
10
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Show, createSignal } from "solid-js";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const colorPicker = tv({
|
|
4
|
+
base: "flex items-center justify-center w-10 h-10 cursor-pointer rounded-lg focus:outline-2",
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
xs: "w-6 h-6",
|
|
8
|
+
sm: "w-8 h-8",
|
|
9
|
+
md: "w-10 h-10",
|
|
10
|
+
lg: "w-12 h-12",
|
|
11
|
+
xl: "w-16 h-16",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: "sm",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const label = tv({
|
|
19
|
+
base: "label",
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
xs: "text-xs",
|
|
23
|
+
sm: "text-xs",
|
|
24
|
+
md: "text-xs",
|
|
25
|
+
lg: "text-sm",
|
|
26
|
+
xl: "text-sm",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: "sm",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export function ColorPicker(props) {
|
|
34
|
+
let inputRef;
|
|
35
|
+
let swatchRef;
|
|
36
|
+
const [color, setColor] = createSignal(props.value ?? "#000000");
|
|
37
|
+
// Sync external value changes
|
|
38
|
+
if (props.value !== undefined && props.value !== color()) {
|
|
39
|
+
setColor(props.value);
|
|
40
|
+
}
|
|
41
|
+
const handleChange = (e) => {
|
|
42
|
+
const value = e.target.value;
|
|
43
|
+
setColor(value);
|
|
44
|
+
props.onChange?.(value);
|
|
45
|
+
props.saveFunc?.(value);
|
|
46
|
+
};
|
|
47
|
+
const handleDivClick = () => {
|
|
48
|
+
inputRef?.click();
|
|
49
|
+
};
|
|
50
|
+
return (<label class="flex flex-col gap-1 w-fit">
|
|
51
|
+
<Show when={props.label}>
|
|
52
|
+
<span class={label({ size: props.size })}>{props.label}</span>
|
|
53
|
+
</Show>
|
|
54
|
+
<div ref={(el) => (swatchRef = el)} class={colorPicker({ size: props.size, class: props.class })} style={{ background: color() }} aria-label="Color picker" tabIndex={0} role="button" onClick={handleDivClick} onKeyDown={(e) => {
|
|
55
|
+
if (e.key === "Enter" || e.key === " ")
|
|
56
|
+
handleDivClick();
|
|
57
|
+
}}></div>
|
|
58
|
+
<input ref={(el) => (inputRef = el)} type="color" value={color()} onInput={handleChange} style={{ position: "absolute", opacity: 0, width: "1px", height: "1px", "pointer-events": "none" }} tabIndex={-1} aria-hidden="true" onfocus={() => swatchRef?.focus()}/>
|
|
59
|
+
</label>);
|
|
60
|
+
}
|
|
61
|
+
export default ColorPicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorPicker } from "./ColorPicker";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorPicker } from "./ColorPicker";
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { tv } from "tailwind-variants";
|
|
2
2
|
const container = tv({
|
|
3
|
-
base: "flex-1 bg-base-100
|
|
4
|
-
variants: {
|
|
5
|
-
noPadding: {
|
|
6
|
-
true: "",
|
|
7
|
-
false: "py-4 px-[3vw]",
|
|
8
|
-
},
|
|
9
|
-
},
|
|
3
|
+
base: "flex-1 bg-base-100 min-h-[calc(100vh-4rem)] py-4 px-[2vw]",
|
|
10
4
|
});
|
|
11
5
|
export const Container = (props) => {
|
|
12
|
-
const classes = container({
|
|
6
|
+
const classes = container({ class: props.class });
|
|
13
7
|
return <div class={classes}>{props.children}</div>;
|
|
14
8
|
};
|
|
15
9
|
export default Container;
|
|
@@ -3,7 +3,12 @@ interface DateInputProps {
|
|
|
3
3
|
label?: string;
|
|
4
4
|
value: Date | null;
|
|
5
5
|
onChange: (date: Date | null) => void;
|
|
6
|
+
variant?: "ghost";
|
|
7
|
+
appearance?: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
9
|
class?: string;
|
|
10
|
+
min?: string;
|
|
11
|
+
max?: string;
|
|
7
12
|
}
|
|
8
13
|
export declare const DateInput: Component<DateInputProps>;
|
|
9
14
|
export default DateInput;
|
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
import { Show } from "solid-js";
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
3
|
const dateInput = tv({
|
|
4
|
-
base: "
|
|
4
|
+
base: "input outline-offset-0",
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
ghost: "input-ghost",
|
|
8
|
+
none: "",
|
|
9
|
+
},
|
|
10
|
+
appearance: {
|
|
11
|
+
neutral: "input-neutral",
|
|
12
|
+
primary: "input-primary",
|
|
13
|
+
secondary: "input-secondary",
|
|
14
|
+
accent: "input-accent",
|
|
15
|
+
info: "input-info",
|
|
16
|
+
success: "input-success",
|
|
17
|
+
warning: "input-warning",
|
|
18
|
+
error: "input-error",
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
xs: "input-xs",
|
|
22
|
+
sm: "input-sm",
|
|
23
|
+
md: "input-md",
|
|
24
|
+
lg: "input-lg",
|
|
25
|
+
xl: "input-xl",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
5
28
|
});
|
|
6
29
|
export const DateInput = (props) => {
|
|
7
|
-
//
|
|
30
|
+
// yyyy-mm-dd for input value
|
|
8
31
|
const valueStr = () => (props.value ? props.value.toISOString().slice(0, 10) : "");
|
|
9
32
|
const handleChange = (e) => {
|
|
10
33
|
const val = e.target.value;
|
|
11
34
|
props.onChange(val ? new Date(val) : null);
|
|
12
35
|
};
|
|
13
|
-
return (<
|
|
36
|
+
return (<label class="floating-label">
|
|
14
37
|
<Show when={props.label}>
|
|
15
|
-
<label
|
|
16
|
-
{props.label}
|
|
17
|
-
</label>
|
|
38
|
+
<span>{props.label}</span>
|
|
18
39
|
</Show>
|
|
19
|
-
<input type="date" class={dateInput()} value={valueStr()} onInput={handleChange}/>
|
|
20
|
-
</
|
|
40
|
+
<input type="date" class={dateInput({ size: props.size, variant: props.variant, appearance: props.appearance })} value={valueStr()} onInput={handleChange} min={props.min} max={props.max}/>
|
|
41
|
+
</label>);
|
|
21
42
|
};
|
|
22
43
|
export default DateInput;
|