@solidpb/ui-kit 0.1.0 → 0.2.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 +7 -6
- package/dist/components/Button/Button.jsx +36 -55
- package/dist/components/Card/Card.d.ts +11 -1
- package/dist/components/Card/Card.jsx +25 -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.jsx +11 -1
- 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 +56 -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 +36 -2
- package/dist/components/Form/Form.jsx +98 -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 +56 -7
- package/dist/components/Input/Input.d.ts +4 -4
- package/dist/components/Input/Input.jsx +10 -27
- package/dist/components/Kanban/Kanban.d.ts +19 -0
- package/dist/components/Kanban/Kanban.jsx +66 -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 +256 -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 +22 -0
- package/dist/components/Navbar/Navbar.jsx +38 -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/{List/List.d.ts → Table/Table.d.ts} +13 -12
- 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 +8 -4
- 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 +2 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.jsx +72 -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 +7 -0
- package/dist/constants.js +7 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +14 -4
- package/dist/methods/triggerFlash.d.ts +1 -0
- package/dist/methods/triggerFlash.js +7 -0
- package/package.json +4 -3
- package/dist/components/Heading/Heading.d.ts +0 -7
- package/dist/components/Heading/Heading.jsx +0 -29
- package/dist/components/Heading/index.d.ts +0 -1
- package/dist/components/Heading/index.js +0 -1
- 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/dist/components/Text/Text.d.ts +0 -9
- package/dist/components/Text/Text.jsx +0 -25
- package/dist/components/Text/index.d.ts +0 -1
- package/dist/components/Text/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,12 +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
|
|
6
|
-
variant?: "
|
|
7
|
-
appearance?: "primary" | "success" | "warning" | "neutral" | "error" | "
|
|
8
|
-
size?: "xs" | "sm" | "md" | "lg";
|
|
5
|
+
export interface ButtonProps extends BaseProps {
|
|
6
|
+
variant?: "outline" | "dash" | "soft" | "ghost" | "link";
|
|
7
|
+
appearance?: "primary" | "secondary" | "success" | "warning" | "neutral" | "error" | "accent" | "info";
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
+
modifier?: "wide" | "block" | "square" | "circle";
|
|
9
10
|
isLoading?: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare const Button: ParentComponent<
|
|
12
|
+
export declare const Button: ParentComponent<ButtonProps>;
|
|
12
13
|
export default Button;
|
|
@@ -3,71 +3,50 @@ import { Button as KButton } from "@kobalte/core/button";
|
|
|
3
3
|
import { tv } from "tailwind-variants";
|
|
4
4
|
import Loader from "lucide-solid/icons/loader";
|
|
5
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
|
-
`,
|
|
6
|
+
base: "btn",
|
|
13
7
|
variants: {
|
|
14
8
|
appearance: {
|
|
15
|
-
primary: "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
primary: "btn-primary",
|
|
10
|
+
secondary: "btn-secondary",
|
|
11
|
+
success: "btn-success",
|
|
12
|
+
warning: "btn-warning",
|
|
13
|
+
neutral: "btn-neutral",
|
|
14
|
+
error: "btn-error",
|
|
15
|
+
accent: "btn-accent",
|
|
16
|
+
info: "btn-info",
|
|
21
17
|
},
|
|
22
18
|
size: {
|
|
23
|
-
xs: "
|
|
24
|
-
sm: "
|
|
25
|
-
md: "
|
|
26
|
-
lg: "
|
|
19
|
+
xs: "btn-xs",
|
|
20
|
+
sm: "btn-sm",
|
|
21
|
+
md: "btn-md",
|
|
22
|
+
lg: "btn-lg",
|
|
23
|
+
xl: "btn-xl",
|
|
27
24
|
},
|
|
28
25
|
variant: {
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
outline: "btn-outline",
|
|
27
|
+
dash: "btn-dash",
|
|
28
|
+
soft: "btn-soft",
|
|
29
|
+
ghost: "btn-ghost",
|
|
30
|
+
link: "btn-link",
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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",
|
|
32
|
+
modifier: {
|
|
33
|
+
wide: "btn-wide",
|
|
34
|
+
block: "btn-block",
|
|
35
|
+
square: "btn-square",
|
|
36
|
+
circle: "btn-circle",
|
|
53
37
|
},
|
|
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
|
-
],
|
|
38
|
+
},
|
|
65
39
|
defaultVariants: {
|
|
66
|
-
|
|
67
|
-
appearance: "neutral",
|
|
68
|
-
size: "md",
|
|
40
|
+
size: "sm",
|
|
69
41
|
},
|
|
70
42
|
});
|
|
43
|
+
const spinnerSizeMap = {
|
|
44
|
+
xs: 12,
|
|
45
|
+
sm: 16,
|
|
46
|
+
md: 20,
|
|
47
|
+
lg: 24,
|
|
48
|
+
xl: 28,
|
|
49
|
+
};
|
|
71
50
|
export const Button = (props) => {
|
|
72
51
|
const [local, others] = splitProps(props, [
|
|
73
52
|
"children",
|
|
@@ -76,17 +55,19 @@ export const Button = (props) => {
|
|
|
76
55
|
"appearance",
|
|
77
56
|
"size",
|
|
78
57
|
"isLoading",
|
|
58
|
+
"modifier",
|
|
79
59
|
]);
|
|
80
60
|
const classes = createMemo(() => button({
|
|
81
61
|
variant: local.variant,
|
|
82
62
|
appearance: local.appearance,
|
|
83
63
|
size: local.size,
|
|
64
|
+
modifier: local.modifier,
|
|
84
65
|
class: local.class,
|
|
85
66
|
}));
|
|
86
67
|
return (<KButton class={classes()} disabled={local.isLoading} {...others}>
|
|
87
68
|
{local.children}
|
|
88
69
|
<Show when={local.isLoading}>
|
|
89
|
-
<Loader class="ml-
|
|
70
|
+
<Loader class="ml-1 animate-spin" size={spinnerSizeMap[local.size ?? "md"]}/>
|
|
90
71
|
</Show>
|
|
91
72
|
</KButton>);
|
|
92
73
|
};
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { ParentComponent } from "solid-js";
|
|
2
2
|
interface Props {
|
|
3
3
|
class?: string;
|
|
4
|
+
img?: string;
|
|
5
|
+
imgAlt?: string;
|
|
6
|
+
imgClass?: string;
|
|
7
|
+
bodyClass?: string;
|
|
4
8
|
}
|
|
5
|
-
export declare const Card: ParentComponent<Props
|
|
9
|
+
export declare const Card: ParentComponent<Props> & {
|
|
10
|
+
Title: typeof CardTitle;
|
|
11
|
+
};
|
|
12
|
+
interface CardTitleProps {
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const CardTitle: ParentComponent<CardTitleProps>;
|
|
6
16
|
export default Card;
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
+
import { Show } from "solid-js";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const card = tv({
|
|
4
|
+
base: "card bg-base-100 shadow-sm border border-base-200",
|
|
5
|
+
});
|
|
6
|
+
const cardBody = tv({
|
|
7
|
+
base: "card-body w-full",
|
|
8
|
+
});
|
|
9
|
+
const cardImage = tv({
|
|
10
|
+
base: "px-4 pt-4",
|
|
11
|
+
});
|
|
1
12
|
export const Card = (props) => {
|
|
2
|
-
return (<div class={
|
|
3
|
-
{props.
|
|
13
|
+
return (<div class={card({ class: props.class })}>
|
|
14
|
+
<Show when={props.img}>
|
|
15
|
+
<figure class={cardImage({ class: props.imgClass })}>
|
|
16
|
+
<img src={props.img} alt={props.imgAlt ?? "Card Image"}/>
|
|
17
|
+
</figure>
|
|
18
|
+
</Show>
|
|
19
|
+
<div class={cardBody({ class: props.bodyClass })}>{props.children}</div>
|
|
4
20
|
</div>);
|
|
5
21
|
};
|
|
22
|
+
const cardTitle = tv({
|
|
23
|
+
base: "card-title",
|
|
24
|
+
});
|
|
25
|
+
const CardTitle = (props) => {
|
|
26
|
+
return <h2 class={cardTitle({ class: props.class })}>{props.children}</h2>;
|
|
27
|
+
};
|
|
28
|
+
Card.Title = CardTitle;
|
|
6
29
|
export default Card;
|
|
@@ -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;
|