@solidpb/ui-kit 0.1.1 → 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 +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.jsx +1 -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 +9 -35
- 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 +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 +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 -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.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
|
@@ -1,40 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Show, splitProps, createMemo } from "solid-js";
|
|
2
2
|
import { TextField } from "@kobalte/core/text-field";
|
|
3
3
|
import { tv } from "tailwind-variants";
|
|
4
4
|
import { debounce } from "../../methods/debounce";
|
|
5
|
-
const root = tv({
|
|
5
|
+
const root = tv({
|
|
6
|
+
base: "flex flex-col gap-1",
|
|
7
|
+
variants: {
|
|
8
|
+
marginTop: {
|
|
9
|
+
yes: "mt-3",
|
|
10
|
+
no: "",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
6
14
|
const textarea = tv({
|
|
7
|
-
base: "
|
|
15
|
+
base: "textarea outline-offset-0 resize-none",
|
|
8
16
|
variants: {
|
|
9
17
|
variant: {
|
|
10
|
-
bordered: "border-2 border-[var(--color-light-muted)] dark:border-[var(--color-dark-muted)]",
|
|
11
18
|
none: "",
|
|
19
|
+
ghost: "textarea-ghost",
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
xs: "textarea-xs",
|
|
23
|
+
sm: "textarea-sm",
|
|
24
|
+
md: "textarea-md",
|
|
25
|
+
lg: "textarea-lg",
|
|
26
|
+
xl: "textarea-xl",
|
|
27
|
+
},
|
|
28
|
+
appearance: {
|
|
29
|
+
primary: "textarea-primary",
|
|
30
|
+
secondary: "textarea-secondary",
|
|
31
|
+
success: "textarea-success",
|
|
32
|
+
warning: "textarea-warning",
|
|
33
|
+
neutral: "textarea-neutral",
|
|
34
|
+
error: "textarea-error",
|
|
35
|
+
accent: "textarea-accent",
|
|
36
|
+
info: "textarea-info",
|
|
12
37
|
},
|
|
13
38
|
},
|
|
14
39
|
defaultVariants: {
|
|
15
|
-
|
|
40
|
+
size: "sm",
|
|
16
41
|
},
|
|
17
42
|
});
|
|
18
43
|
export const TextArea = (props) => {
|
|
19
|
-
const [local, others] = splitProps(props, [
|
|
44
|
+
const [local, others] = splitProps(props, [
|
|
45
|
+
"label",
|
|
46
|
+
"class",
|
|
47
|
+
"textareaProps",
|
|
48
|
+
"saveFunc",
|
|
49
|
+
"variant",
|
|
50
|
+
"size",
|
|
51
|
+
"appearance",
|
|
52
|
+
]);
|
|
20
53
|
let textareaRef;
|
|
21
54
|
const debouncedSave = createMemo(() => (local.saveFunc ? debounce(local.saveFunc) : undefined));
|
|
22
55
|
const handleChange = (v) => {
|
|
23
56
|
props.onChange?.(v);
|
|
24
57
|
debouncedSave()?.(v);
|
|
25
58
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
return (<TextField {...others} class={root({
|
|
60
|
+
marginTop: local.label ? "yes" : "no",
|
|
61
|
+
class: local.class,
|
|
62
|
+
})} onChange={handleChange}>
|
|
63
|
+
<TextField.Label class="floating-label">
|
|
64
|
+
<Show when={local.label}>
|
|
65
|
+
<span>{local.label}</span>
|
|
66
|
+
</Show>
|
|
67
|
+
<TextField.TextArea {...local.textareaProps} ref={textareaRef} class={textarea({
|
|
68
|
+
variant: local.variant,
|
|
69
|
+
appearance: local.appearance,
|
|
70
|
+
size: local.size,
|
|
71
|
+
class: local.textareaProps?.class,
|
|
72
|
+
})}/>
|
|
73
|
+
</TextField.Label>
|
|
38
74
|
</TextField>);
|
|
39
75
|
};
|
|
40
76
|
export default TextArea;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createSignal, onMount } from "solid-js";
|
|
2
|
+
import Sun from "lucide-solid/icons/sun";
|
|
3
|
+
import Moon from "lucide-solid/icons/moon";
|
|
4
|
+
import Monitor from "lucide-solid/icons/monitor";
|
|
5
|
+
import { DropdownMenu } from "../DropdownMenu";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
const THEME_KEY = "theme";
|
|
8
|
+
function getSystemTheme() {
|
|
9
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches)
|
|
10
|
+
return "dark";
|
|
11
|
+
return "light";
|
|
12
|
+
}
|
|
13
|
+
function applyTheme(theme) {
|
|
14
|
+
const html = document.documentElement;
|
|
15
|
+
let applied = theme;
|
|
16
|
+
if (theme === "system") {
|
|
17
|
+
applied = getSystemTheme();
|
|
18
|
+
}
|
|
19
|
+
html.setAttribute("data-theme", applied);
|
|
20
|
+
}
|
|
21
|
+
const labelClass = "flex items-center gap-1";
|
|
22
|
+
const getThemeValue = (theme) => {
|
|
23
|
+
switch (theme) {
|
|
24
|
+
case "light":
|
|
25
|
+
return (<span class={labelClass}>
|
|
26
|
+
<Sun class="w-[1em] h-[1em]"/> Light
|
|
27
|
+
</span>);
|
|
28
|
+
case "dark":
|
|
29
|
+
return (<span class={labelClass}>
|
|
30
|
+
<Moon class="w-[1em] h-[1em]"/> Dark
|
|
31
|
+
</span>);
|
|
32
|
+
case "system":
|
|
33
|
+
return (<span class={labelClass}>
|
|
34
|
+
<Monitor class="w-[1em] h-[1em]"/> System
|
|
35
|
+
</span>);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export function ThemeSwitch() {
|
|
39
|
+
const [theme, setTheme] = createSignal("system");
|
|
40
|
+
onMount(() => {
|
|
41
|
+
const saved = localStorage.getItem(THEME_KEY);
|
|
42
|
+
if (saved) {
|
|
43
|
+
setTheme(saved);
|
|
44
|
+
applyTheme(saved);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
applyTheme("system");
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const handleChange = (val) => {
|
|
51
|
+
setTheme(val);
|
|
52
|
+
localStorage.setItem(THEME_KEY, val);
|
|
53
|
+
applyTheme(val);
|
|
54
|
+
};
|
|
55
|
+
return (<DropdownMenu>
|
|
56
|
+
<DropdownMenu.Trigger>
|
|
57
|
+
<Button>{getThemeValue(theme())}</Button>
|
|
58
|
+
</DropdownMenu.Trigger>
|
|
59
|
+
<DropdownMenu.Content>
|
|
60
|
+
<DropdownMenu.MenuItem onSelect={() => handleChange("light")}>
|
|
61
|
+
{getThemeValue("light")}
|
|
62
|
+
</DropdownMenu.MenuItem>
|
|
63
|
+
<DropdownMenu.MenuItem onSelect={() => handleChange("dark")}>
|
|
64
|
+
{getThemeValue("dark")}
|
|
65
|
+
</DropdownMenu.MenuItem>
|
|
66
|
+
<DropdownMenu.MenuItem onSelect={() => handleChange("system")}>
|
|
67
|
+
{getThemeValue("system")}
|
|
68
|
+
</DropdownMenu.MenuItem>
|
|
69
|
+
</DropdownMenu.Content>
|
|
70
|
+
</DropdownMenu>);
|
|
71
|
+
}
|
|
72
|
+
export default ThemeSwitch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ThemeSwitch } from "./ThemeSwitch";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ThemeSwitch } from "./ThemeSwitch";
|
|
@@ -3,7 +3,7 @@ import { ToastRootProps } from "@kobalte/core/toast";
|
|
|
3
3
|
interface Props extends ToastRootProps {
|
|
4
4
|
title: string;
|
|
5
5
|
msg: string;
|
|
6
|
-
|
|
6
|
+
appearance?: "primary" | "secondary" | "success" | "warning" | "error" | "neutral" | "info" | "accent";
|
|
7
7
|
}
|
|
8
8
|
export declare const Toast: Component<Props>;
|
|
9
9
|
export default Toast;
|
|
@@ -3,31 +3,34 @@ import { Toast as KToast } from "@kobalte/core/toast";
|
|
|
3
3
|
import X from "lucide-solid/icons/x";
|
|
4
4
|
import { tv } from "tailwind-variants";
|
|
5
5
|
const toast = tv({
|
|
6
|
-
base: `flex flex-col items-center justify-between gap-1 border-1
|
|
6
|
+
base: `alert flex flex-col items-center justify-between gap-1 border-1
|
|
7
7
|
rounded-md px-2 py-1 data-[opened]:animate-slideIn data-[closed]:animate-hide
|
|
8
8
|
data-[swipe=move]:translate-x-[var(--kb-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0
|
|
9
9
|
data-[swipe=cancel]:transition-transform data-[swipe=cancel]:duration-200 data-[swipe=cancel]:ease-out
|
|
10
10
|
data-[swipe=end]:animate-swipeOut shadow-md`,
|
|
11
11
|
variants: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
appearance: {
|
|
13
|
+
primary: "alert-primary",
|
|
14
|
+
secondary: "alert-secondary",
|
|
15
|
+
success: "alert-success",
|
|
16
|
+
warning: "alert-warning",
|
|
17
|
+
error: "alert-error",
|
|
18
|
+
neutral: "alert-neutral",
|
|
19
|
+
info: "alert-info",
|
|
20
|
+
accent: "alert-accent",
|
|
15
21
|
},
|
|
16
22
|
},
|
|
17
|
-
defaultVariants: {
|
|
18
|
-
variant: "neutral",
|
|
19
|
-
},
|
|
20
23
|
});
|
|
21
24
|
export const Toast = (props) => {
|
|
22
|
-
const [local, rootProps] = splitProps(props, ["msg", "title", "
|
|
23
|
-
const classes = createMemo(() => toast({
|
|
25
|
+
const [local, rootProps] = splitProps(props, ["msg", "title", "appearance"]);
|
|
26
|
+
const classes = createMemo(() => toast({ appearance: local.appearance }));
|
|
24
27
|
return (<KToast {...rootProps} class={classes()}>
|
|
25
28
|
<div class={`flex items-start w-full`}>
|
|
26
29
|
<div>
|
|
27
30
|
<KToast.Title class="text-md truncate">{local.title}</KToast.Title>
|
|
28
31
|
<KToast.Description class="text-xs line-clamp-4">{local.msg}</KToast.Description>
|
|
29
32
|
</div>
|
|
30
|
-
<KToast.CloseButton class=
|
|
33
|
+
<KToast.CloseButton class="shrink-0 ml-auto btn btn-ghost btn-xs btn-square">
|
|
31
34
|
<X size={16}/>
|
|
32
35
|
</KToast.CloseButton>
|
|
33
36
|
</div>
|
|
@@ -3,8 +3,7 @@ import { Toast } from "@kobalte/core/toast";
|
|
|
3
3
|
export const Toaster = () => {
|
|
4
4
|
return (<Portal>
|
|
5
5
|
<Toast.Region>
|
|
6
|
-
<Toast.List class=
|
|
7
|
-
max-w-[100vw] m-0 outline-none list-none`}/>
|
|
6
|
+
<Toast.List class="z-1000000 toast toast-top w-80 max-w-[100vw] m-0"/>
|
|
8
7
|
</Toast.Region>
|
|
9
8
|
</Portal>);
|
|
10
9
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, JSXElement } from "solid-js";
|
|
2
2
|
interface TooltipProps {
|
|
3
|
-
content:
|
|
4
|
-
children:
|
|
3
|
+
content: JSXElement;
|
|
4
|
+
children: JSXElement;
|
|
5
5
|
class?: string;
|
|
6
|
+
appearance?: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
|
|
6
7
|
}
|
|
7
8
|
export declare const Tooltip: Component<TooltipProps>;
|
|
8
9
|
export default Tooltip;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import { Tooltip as KTooltip } from "@kobalte/core/tooltip";
|
|
2
1
|
import { tv } from "tailwind-variants";
|
|
3
2
|
const tooltip = tv({
|
|
4
|
-
base: "
|
|
3
|
+
base: "tooltip tooltip-bottom",
|
|
4
|
+
variants: {
|
|
5
|
+
appearance: {
|
|
6
|
+
neutral: "tooltip-neutral",
|
|
7
|
+
primary: "tooltip-primary",
|
|
8
|
+
secondary: "tooltip-secondary",
|
|
9
|
+
accent: "tooltip-accent",
|
|
10
|
+
info: "tooltip-info",
|
|
11
|
+
success: "tooltip-success",
|
|
12
|
+
warning: "tooltip-warning",
|
|
13
|
+
error: "tooltip-error",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
5
16
|
});
|
|
6
|
-
export const Tooltip = (props) =>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
</
|
|
11
|
-
|
|
17
|
+
export const Tooltip = (props) => {
|
|
18
|
+
return (<div class={tooltip({ class: props.class, appearance: props.appearance })}>
|
|
19
|
+
{props.children}
|
|
20
|
+
<div class="tooltip-content">{props.content}</div>
|
|
21
|
+
</div>);
|
|
22
|
+
};
|
|
12
23
|
export default Tooltip;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
|
+
export * from "./components/ActivityFeed";
|
|
2
|
+
export * from "./components/AlertDialog";
|
|
3
|
+
export * from "./components/Avatar";
|
|
4
|
+
export * from "./components/BreadCrumbs";
|
|
1
5
|
export * from "./components/Button";
|
|
2
6
|
export * from "./components/Card";
|
|
3
7
|
export * from "./components/Checkbox";
|
|
8
|
+
export * from "./components/ColorPicker";
|
|
4
9
|
export * from "./components/Container";
|
|
5
10
|
export * from "./components/DateInput";
|
|
11
|
+
export * from "./components/Drawer";
|
|
6
12
|
export * from "./components/DropdownMenu";
|
|
7
13
|
export * from "./components/FileInput";
|
|
14
|
+
export * from "./components/FilterBar";
|
|
8
15
|
export * from "./components/Form";
|
|
9
16
|
export * from "./components/Image";
|
|
10
17
|
export * from "./components/Input";
|
|
18
|
+
export * from "./components/Kanban";
|
|
11
19
|
export * from "./components/Link";
|
|
12
|
-
export * from "./components/List";
|
|
13
20
|
export * from "./components/Modal";
|
|
21
|
+
export * from "./components/Navbar";
|
|
14
22
|
export * from "./components/NumberInput";
|
|
15
|
-
export * from "./components/
|
|
23
|
+
export * from "./components/Pagination";
|
|
16
24
|
export * from "./components/SearchInput";
|
|
17
25
|
export * from "./components/Select";
|
|
26
|
+
export * from "./components/Slider";
|
|
18
27
|
export * from "./components/Switch";
|
|
28
|
+
export * from "./components/Table";
|
|
19
29
|
export * from "./components/Tabs";
|
|
20
30
|
export * from "./components/Tag";
|
|
21
31
|
export * from "./components/TagArea";
|
|
22
32
|
export * from "./components/TextArea";
|
|
33
|
+
export * from "./components/ThemeSwitch";
|
|
34
|
+
export * from "./components/Toast";
|
|
23
35
|
export * from "./components/Tooltip";
|
|
24
36
|
export * from "./methods/debounce";
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
|
+
export * from "./components/ActivityFeed";
|
|
2
|
+
export * from "./components/AlertDialog";
|
|
3
|
+
export * from "./components/Avatar";
|
|
4
|
+
export * from "./components/BreadCrumbs";
|
|
1
5
|
export * from "./components/Button";
|
|
2
6
|
export * from "./components/Card";
|
|
3
7
|
export * from "./components/Checkbox";
|
|
8
|
+
export * from "./components/ColorPicker";
|
|
4
9
|
export * from "./components/Container";
|
|
5
10
|
export * from "./components/DateInput";
|
|
11
|
+
export * from "./components/Drawer";
|
|
6
12
|
export * from "./components/DropdownMenu";
|
|
7
13
|
export * from "./components/FileInput";
|
|
14
|
+
export * from "./components/FilterBar";
|
|
8
15
|
export * from "./components/Form";
|
|
9
16
|
export * from "./components/Image";
|
|
10
17
|
export * from "./components/Input";
|
|
18
|
+
export * from "./components/Kanban";
|
|
11
19
|
export * from "./components/Link";
|
|
12
|
-
export * from "./components/List";
|
|
13
20
|
export * from "./components/Modal";
|
|
21
|
+
export * from "./components/Navbar";
|
|
14
22
|
export * from "./components/NumberInput";
|
|
15
|
-
export * from "./components/
|
|
23
|
+
export * from "./components/Pagination";
|
|
16
24
|
export * from "./components/SearchInput";
|
|
17
25
|
export * from "./components/Select";
|
|
26
|
+
export * from "./components/Slider";
|
|
18
27
|
export * from "./components/Switch";
|
|
28
|
+
export * from "./components/Table";
|
|
19
29
|
export * from "./components/Tabs";
|
|
20
30
|
export * from "./components/Tag";
|
|
21
31
|
export * from "./components/TagArea";
|
|
22
32
|
export * from "./components/TextArea";
|
|
33
|
+
export * from "./components/ThemeSwitch";
|
|
34
|
+
export * from "./components/Toast";
|
|
23
35
|
export * from "./components/Tooltip";
|
|
24
36
|
export * from "./methods/debounce";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const triggerFlash: (ref: HTMLElement) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidpb/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
"vite-plugin-solid": "^2.11.10"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
|
|
24
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
23
25
|
"@kobalte/core": "^0.13.11",
|
|
24
26
|
"@tailwindcss/vite": "^4.1.18",
|
|
25
27
|
"@tanstack/solid-table": "^8.21.3",
|
|
26
|
-
"@tanstack/solid-virtual": "^3.13.13",
|
|
27
28
|
"lucide-solid": "^0.562.0",
|
|
28
29
|
"solid-js": "^1.9.10",
|
|
29
30
|
"tailwind-merge": "^3.3.1",
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { createSolidTable, flexRender, getCoreRowModel, getFilteredRowModel, } from "@tanstack/solid-table";
|
|
2
|
-
import { For, Show, createMemo, createSignal } from "solid-js";
|
|
3
|
-
import { createVirtualizer } from "@tanstack/solid-virtual";
|
|
4
|
-
import { tv } from "tailwind-variants";
|
|
5
|
-
import Loader from "lucide-solid/icons/loader";
|
|
6
|
-
import Plus from "lucide-solid/icons/plus";
|
|
7
|
-
import { Button } from "../Button";
|
|
8
|
-
import { Input } from "../Input";
|
|
9
|
-
const containerClass = tv({
|
|
10
|
-
base: "overflow-y-auto relative flex-1",
|
|
11
|
-
});
|
|
12
|
-
export const DefaultRowRenderer = (props) => {
|
|
13
|
-
return (<div class="flex justify-between items-center cursor-pointer text-sm border-b border-[var(--color-light-muted)] dark:border-[var(--color-dark-muted)] py-2 hover:bg-[var(--color-light-muted)] dark:hover:bg-[var(--color-dark-muted)]" onClick={() => props.onClick(props.row.original)}>
|
|
14
|
-
<For each={props.row.getVisibleCells()}>
|
|
15
|
-
{(cell) => (<div class="flex-1 overflow-hidden truncate">
|
|
16
|
-
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
17
|
-
</div>)}
|
|
18
|
-
</For>
|
|
19
|
-
</div>);
|
|
20
|
-
};
|
|
21
|
-
export const List = (props) => {
|
|
22
|
-
const [globalFilter, setGlobalFilter] = createSignal();
|
|
23
|
-
let parentRef;
|
|
24
|
-
const table = createSolidTable({
|
|
25
|
-
get data() {
|
|
26
|
-
return props.data?.() || [];
|
|
27
|
-
},
|
|
28
|
-
columns: props.columns(),
|
|
29
|
-
getCoreRowModel: getCoreRowModel(),
|
|
30
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
31
|
-
state: {
|
|
32
|
-
get globalFilter() {
|
|
33
|
-
return globalFilter();
|
|
34
|
-
},
|
|
35
|
-
get columnFilters() {
|
|
36
|
-
return props.filters?.();
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
const rowCount = createMemo(() => table.getRowModel().rows.length);
|
|
41
|
-
const dataExists = createMemo(() => props.data?.() || props.loading);
|
|
42
|
-
const rows = createMemo(() => table.getRowModel().rows);
|
|
43
|
-
const virtualizer = createMemo(() => createVirtualizer({
|
|
44
|
-
get count() {
|
|
45
|
-
return rows().length;
|
|
46
|
-
},
|
|
47
|
-
getScrollElement: () => {
|
|
48
|
-
return parentRef;
|
|
49
|
-
},
|
|
50
|
-
estimateSize: () => 41,
|
|
51
|
-
get getItemKey() {
|
|
52
|
-
return (index) => rows()[index].id;
|
|
53
|
-
},
|
|
54
|
-
}));
|
|
55
|
-
const virtualRows = createMemo(() => virtualizer().getVirtualItems());
|
|
56
|
-
const totalSize = createMemo(() => virtualizer().getTotalSize());
|
|
57
|
-
const containerStyle = createMemo(() => containerClass({ class: props.containerClass }));
|
|
58
|
-
return (<div class="flex flex-col h-full max-h-[inherit]">
|
|
59
|
-
<Show when={dataExists()} fallback={props.loadingFallback || (<div class="fixed inset-0 z-100 flex items-center justify-center bg-[var(--color-dark-background)]/25 dark:bg-[var(--color-light-background)]/25">
|
|
60
|
-
<Loader class="w-9 h-9 animate-spin text-[var(--color-light-muted)] dark:text-[var(--color-dark-muted)]"/>
|
|
61
|
-
</div>)}>
|
|
62
|
-
<div class="sticky top-0 bg-charcoal-500/95 backdrop-blur-xs">
|
|
63
|
-
<Show when={props.search}>
|
|
64
|
-
<div class="flex items-center space-x-2 mt-3 mb-1">
|
|
65
|
-
<Show when={props.createFunc}>
|
|
66
|
-
<Button class="flex text-sm items-center pl-1 pr-2" appearance="success" onClick={props.createFunc}>
|
|
67
|
-
<Plus size={20}/>
|
|
68
|
-
New
|
|
69
|
-
</Button>
|
|
70
|
-
</Show>
|
|
71
|
-
|
|
72
|
-
<div class="w-full relative">
|
|
73
|
-
<Input class="w-full" value={globalFilter()} onChange={setGlobalFilter} inputProps={{ placeholder: props.searchPlaceholder ?? "Search", class: "p-1" }}/>
|
|
74
|
-
{props.loading && (<Loader size={16} class="absolute animate-spin top-1/2 transform -translate-y-1/2 right-2"/>)}
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</Show>
|
|
78
|
-
|
|
79
|
-
<Show when={props.headerActions}>{props.headerActions}</Show>
|
|
80
|
-
|
|
81
|
-
<Show when={props.showItemCount}>
|
|
82
|
-
<p class="text-xs italic mb-1">{rowCount()} items</p>
|
|
83
|
-
</Show>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<Show when={props.headers}>
|
|
87
|
-
<For each={table.getHeaderGroups()}>
|
|
88
|
-
{(headerGroup) => (<div class="flex flex-row w-full justify-between sticky top-0 bg-[var(--color-light-surface)]/95 dark:bg-[var(--color-dark-surface)]/95 text-[var(--color-text-light-primary)] dark:text-[var(--color-dark-primary)] backdrop-blur-sm p-2 z-10">
|
|
89
|
-
<For each={headerGroup.headers}>
|
|
90
|
-
{(header) => (<div class="text-left font-bold">
|
|
91
|
-
{flexRender(header.column.columnDef.header, header.getContext())}
|
|
92
|
-
</div>)}
|
|
93
|
-
</For>
|
|
94
|
-
</div>)}
|
|
95
|
-
</For>
|
|
96
|
-
</Show>
|
|
97
|
-
|
|
98
|
-
<div ref={parentRef} class={containerStyle()}>
|
|
99
|
-
<Show when={rowCount() > 0} fallback={props.emptyState || <div class="text-center py-4">No results found.</div>}>
|
|
100
|
-
<div class="w-full" style={{
|
|
101
|
-
height: `${totalSize()}px`,
|
|
102
|
-
position: "relative",
|
|
103
|
-
}}>
|
|
104
|
-
<For each={virtualRows()}>
|
|
105
|
-
{(virtualRow) => {
|
|
106
|
-
const row = rows()[virtualRow.index];
|
|
107
|
-
return (<div data-index={virtualRow.index} ref={(el) => queueMicrotask(() => virtualizer().measureElement(el))} class="absolute w-full" style={{ transform: `translateY(${virtualRow.start}px)` }}>
|
|
108
|
-
<Show when={props.renderRow} fallback={<DefaultRowRenderer row={row} columns={props.columns} onClick={props.onRowClick}/>}>
|
|
109
|
-
{props.renderRow(row, props.onRowClick)}
|
|
110
|
-
</Show>
|
|
111
|
-
</div>);
|
|
112
|
-
}}
|
|
113
|
-
</For>
|
|
114
|
-
</div>
|
|
115
|
-
</Show>
|
|
116
|
-
</div>
|
|
117
|
-
</Show>
|
|
118
|
-
</div>);
|
|
119
|
-
};
|
|
120
|
-
export default List;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./List";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./List";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface RelationPickerProps<T extends Tag = Tag> {
|
|
2
|
-
relations: T[];
|
|
3
|
-
setRelations: (relations: T[]) => void;
|
|
4
|
-
suggestions?: T[];
|
|
5
|
-
onCreateRelation: (name: string) => Promise<T>;
|
|
6
|
-
onDeleteRelation: (relation: T) => Promise<void>;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const RelationPicker: <T extends Tag = Tag>(props: RelationPickerProps<T>) => import("solid-js").JSX.Element;
|
|
11
|
-
export default RelationPicker;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
import TagArea from "../TagArea/TagArea";
|
|
3
|
-
export const RelationPicker = (props) => {
|
|
4
|
-
return (<div class="flex flex-col gap-1">
|
|
5
|
-
<Show when={props.label}>
|
|
6
|
-
<span class="text-xs font-medium text-(--color-text-light-secondary) dark:text-(--color-text-dark-secondary) mb-1">
|
|
7
|
-
{props.label}
|
|
8
|
-
</span>
|
|
9
|
-
</Show>
|
|
10
|
-
<TagArea tags={props.relations} setTags={props.setRelations} suggestions={props.suggestions} onCreateTag={props.onCreateRelation} onDeleteTag={props.onDeleteRelation} placeholder={props.placeholder || "Add relation..."}/>
|
|
11
|
-
</div>);
|
|
12
|
-
};
|
|
13
|
-
export default RelationPicker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./RelationPicker";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./RelationPicker";
|