@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.
- package/README.md +1 -0
- package/dist/components/Button/Button.d.ts +12 -0
- package/dist/components/Button/Button.jsx +93 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/Card/Card.d.ts +6 -0
- package/dist/components/Card/Card.jsx +6 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox/Checkbox.jsx +25 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +1 -0
- package/dist/components/Container/Container.d.ts +7 -0
- package/dist/components/Container/Container.jsx +5 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Container/index.js +1 -0
- package/dist/components/DateInput/DateInput.d.ts +9 -0
- package/dist/components/DateInput/DateInput.jsx +22 -0
- package/dist/components/DateInput/index.d.ts +1 -0
- package/dist/components/DateInput/index.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/dist/components/DropdownMenu/DropdownMenu.jsx +22 -0
- package/dist/components/DropdownMenu/index.d.ts +1 -0
- package/dist/components/DropdownMenu/index.js +1 -0
- package/dist/components/FileInput/FileInput.d.ts +10 -0
- package/dist/components/FileInput/FileInput.jsx +18 -0
- package/dist/components/FileInput/index.d.ts +1 -0
- package/dist/components/FileInput/index.js +1 -0
- package/dist/components/Form/Form.d.ts +2 -0
- package/dist/components/Form/Form.jsx +3 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +1 -0
- package/dist/components/Heading/Heading.d.ts +7 -0
- package/dist/components/Heading/Heading.jsx +29 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/Heading/index.js +1 -0
- package/dist/components/Image/Image.d.ts +9 -0
- package/dist/components/Image/Image.jsx +15 -0
- package/dist/components/Image/index.d.ts +1 -0
- package/dist/components/Image/index.js +1 -0
- package/dist/components/Input/Input.d.ts +15 -0
- package/dist/components/Input/Input.jsx +86 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +1 -0
- package/dist/components/Link/Link.d.ts +9 -0
- package/dist/components/Link/Link.jsx +13 -0
- package/dist/components/Link/index.d.ts +1 -0
- package/dist/components/Link/index.js +1 -0
- package/dist/components/List/List.d.ts +26 -0
- package/dist/components/List/List.jsx +120 -0
- package/dist/components/List/index.d.ts +1 -0
- package/dist/components/List/index.js +1 -0
- package/dist/components/Modal/Modal.d.ts +13 -0
- package/dist/components/Modal/Modal.jsx +51 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Modal/modalContext.d.ts +7 -0
- package/dist/components/Modal/modalContext.js +2 -0
- package/dist/components/NumberInput/NumberInput.d.ts +13 -0
- package/dist/components/NumberInput/NumberInput.jsx +20 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/NumberInput/index.js +1 -0
- package/dist/components/RelationPicker/RelationPicker.d.ts +11 -0
- package/dist/components/RelationPicker/RelationPicker.jsx +13 -0
- package/dist/components/RelationPicker/index.d.ts +1 -0
- package/dist/components/RelationPicker/index.js +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +9 -0
- package/dist/components/SearchInput/SearchInput.jsx +9 -0
- package/dist/components/SearchInput/index.d.ts +1 -0
- package/dist/components/SearchInput/index.js +1 -0
- package/dist/components/Select/Select.d.ts +15 -0
- package/dist/components/Select/Select.jsx +37 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +1 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.jsx +22 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.js +1 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -0
- package/dist/components/Tabs/Tabs.jsx +4 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +1 -0
- package/dist/components/Tag/Tag.d.ts +10 -0
- package/dist/components/Tag/Tag.jsx +30 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.js +1 -0
- package/dist/components/TagArea/TagArea.d.ts +11 -0
- package/dist/components/TagArea/TagArea.jsx +62 -0
- package/dist/components/TagArea/index.d.ts +1 -0
- package/dist/components/TagArea/index.js +1 -0
- package/dist/components/Text/Text.d.ts +9 -0
- package/dist/components/Text/Text.jsx +25 -0
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/Text/index.js +1 -0
- package/dist/components/TextArea/TextArea.d.ts +14 -0
- package/dist/components/TextArea/TextArea.jsx +40 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/components/TextArea/index.js +1 -0
- package/dist/components/Toast/Toast.d.ts +9 -0
- package/dist/components/Toast/Toast.jsx +36 -0
- package/dist/components/Toast/Toaster.d.ts +3 -0
- package/dist/components/Toast/Toaster.jsx +11 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.jsx +12 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/methods/debounce.d.ts +1 -0
- package/dist/methods/debounce.js +7 -0
- package/package.json +41 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createEffect, on, Show, splitProps, createMemo } 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 root = tv({ base: "flex flex-col gap-1" });
|
|
6
|
+
const textarea = tv({
|
|
7
|
+
base: "w-full resize-none rounded-sm outline-none px-2 py-1 min-h-[80px]",
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
bordered: "border-2 border-[var(--color-light-muted)] dark:border-[var(--color-dark-muted)]",
|
|
11
|
+
none: "",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: "none",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export const TextArea = (props) => {
|
|
19
|
+
const [local, others] = splitProps(props, ["label", "class", "inputProps", "saveFunc", "variant"]);
|
|
20
|
+
let textareaRef;
|
|
21
|
+
const debouncedSave = createMemo(() => (local.saveFunc ? debounce(local.saveFunc) : undefined));
|
|
22
|
+
const handleChange = (v) => {
|
|
23
|
+
props.onChange?.(v);
|
|
24
|
+
debouncedSave()?.(v);
|
|
25
|
+
};
|
|
26
|
+
const autoResize = () => {
|
|
27
|
+
if (!textareaRef)
|
|
28
|
+
return;
|
|
29
|
+
textareaRef.style.height = "auto";
|
|
30
|
+
textareaRef.style.height = `${textareaRef.scrollHeight}px`;
|
|
31
|
+
};
|
|
32
|
+
createEffect(on(() => others.value, () => autoResize()));
|
|
33
|
+
return (<TextField class={root({ class: local.class })} {...others} onChange={handleChange}>
|
|
34
|
+
<Show when={local.label}>
|
|
35
|
+
<TextField.Label>{local.label}</TextField.Label>
|
|
36
|
+
</Show>
|
|
37
|
+
<TextField.TextArea ref={textareaRef} class={textarea({ variant: local.variant, class: local.inputProps?.class })} {...local.inputProps}/>
|
|
38
|
+
</TextField>);
|
|
39
|
+
};
|
|
40
|
+
export default TextArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TextArea";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TextArea";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component } from "solid-js";
|
|
2
|
+
import { ToastRootProps } from "@kobalte/core/toast";
|
|
3
|
+
interface Props extends ToastRootProps {
|
|
4
|
+
title: string;
|
|
5
|
+
msg: string;
|
|
6
|
+
variant?: "error" | "neutral";
|
|
7
|
+
}
|
|
8
|
+
export declare const Toast: Component<Props>;
|
|
9
|
+
export default Toast;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createMemo, splitProps } from "solid-js";
|
|
2
|
+
import { Toast as KToast } from "@kobalte/core/toast";
|
|
3
|
+
import X from "lucide-solid/icons/x";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
const toast = tv({
|
|
6
|
+
base: `flex flex-col items-center justify-between gap-1 border-1
|
|
7
|
+
rounded-md px-2 py-1 data-[opened]:animate-slideIn data-[closed]:animate-hide
|
|
8
|
+
data-[swipe=move]:translate-x-[var(--kb-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0
|
|
9
|
+
data-[swipe=cancel]:transition-transform data-[swipe=cancel]:duration-200 data-[swipe=cancel]:ease-out
|
|
10
|
+
data-[swipe=end]:animate-swipeOut shadow-md`,
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
error: "border-red-500",
|
|
14
|
+
neutral: "border-gray-500",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "neutral",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export const Toast = (props) => {
|
|
22
|
+
const [local, rootProps] = splitProps(props, ["msg", "title", "variant"]);
|
|
23
|
+
const classes = createMemo(() => toast({ variant: local.variant }));
|
|
24
|
+
return (<KToast {...rootProps} class={classes()}>
|
|
25
|
+
<div class={`flex items-start w-full`}>
|
|
26
|
+
<div>
|
|
27
|
+
<KToast.Title class="text-md truncate">{local.title}</KToast.Title>
|
|
28
|
+
<KToast.Description class="text-xs line-clamp-4">{local.msg}</KToast.Description>
|
|
29
|
+
</div>
|
|
30
|
+
<KToast.CloseButton class={`shrink-0 ml-auto`}>
|
|
31
|
+
<X size={16}/>
|
|
32
|
+
</KToast.CloseButton>
|
|
33
|
+
</div>
|
|
34
|
+
</KToast>);
|
|
35
|
+
};
|
|
36
|
+
export default Toast;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Portal } from "solid-js/web";
|
|
2
|
+
import { Toast } from "@kobalte/core/toast";
|
|
3
|
+
export const Toaster = () => {
|
|
4
|
+
return (<Portal>
|
|
5
|
+
<Toast.Region>
|
|
6
|
+
<Toast.List class={`z-99999 top-0 right-0 flex flex-col p-(--viewport-padding) fixed gap-2 w-100
|
|
7
|
+
max-w-[100vw] m-0 outline-none list-none`}/>
|
|
8
|
+
</Toast.Region>
|
|
9
|
+
</Portal>);
|
|
10
|
+
};
|
|
11
|
+
export default Toaster;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tooltip as KTooltip } from "@kobalte/core/tooltip";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const tooltip = tv({
|
|
4
|
+
base: "bg-[var(--color-light-surface)] dark:bg-[var(--color-dark-surface)] text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)] px-2 py-1 rounded shadow",
|
|
5
|
+
});
|
|
6
|
+
export const Tooltip = (props) => (<KTooltip>
|
|
7
|
+
<KTooltip.Trigger>{props.children}</KTooltip.Trigger>
|
|
8
|
+
<KTooltip.Portal>
|
|
9
|
+
<KTooltip.Content class={tooltip()}>{props.content}</KTooltip.Content>
|
|
10
|
+
</KTooltip.Portal>
|
|
11
|
+
</KTooltip>);
|
|
12
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./components/Button";
|
|
2
|
+
export * from "./components/Card";
|
|
3
|
+
export * from "./components/Checkbox";
|
|
4
|
+
export * from "./components/Container";
|
|
5
|
+
export * from "./components/DateInput";
|
|
6
|
+
export * from "./components/DropdownMenu";
|
|
7
|
+
export * from "./components/FileInput";
|
|
8
|
+
export * from "./components/Form";
|
|
9
|
+
export * from "./components/Heading";
|
|
10
|
+
export * from "./components/Image";
|
|
11
|
+
export * from "./components/Input";
|
|
12
|
+
export * from "./components/Link";
|
|
13
|
+
export * from "./components/List";
|
|
14
|
+
export * from "./components/Modal";
|
|
15
|
+
export * from "./components/NumberInput";
|
|
16
|
+
export * from "./components/RelationPicker";
|
|
17
|
+
export * from "./components/SearchInput";
|
|
18
|
+
export * from "./components/Select";
|
|
19
|
+
export * from "./components/Switch";
|
|
20
|
+
export * from "./components/Tabs";
|
|
21
|
+
export * from "./components/Tag";
|
|
22
|
+
export * from "./components/TagArea";
|
|
23
|
+
export * from "./components/Text";
|
|
24
|
+
export * from "./components/TextArea";
|
|
25
|
+
export * from "./components/Tooltip";
|
|
26
|
+
export * from "./methods/debounce";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./components/Button";
|
|
2
|
+
export * from "./components/Card";
|
|
3
|
+
export * from "./components/Checkbox";
|
|
4
|
+
export * from "./components/Container";
|
|
5
|
+
export * from "./components/DateInput";
|
|
6
|
+
export * from "./components/DropdownMenu";
|
|
7
|
+
export * from "./components/FileInput";
|
|
8
|
+
export * from "./components/Form";
|
|
9
|
+
export * from "./components/Heading";
|
|
10
|
+
export * from "./components/Image";
|
|
11
|
+
export * from "./components/Input";
|
|
12
|
+
export * from "./components/Link";
|
|
13
|
+
export * from "./components/List";
|
|
14
|
+
export * from "./components/Modal";
|
|
15
|
+
export * from "./components/NumberInput";
|
|
16
|
+
export * from "./components/RelationPicker";
|
|
17
|
+
export * from "./components/SearchInput";
|
|
18
|
+
export * from "./components/Select";
|
|
19
|
+
export * from "./components/Switch";
|
|
20
|
+
export * from "./components/Tabs";
|
|
21
|
+
export * from "./components/Tag";
|
|
22
|
+
export * from "./components/TagArea";
|
|
23
|
+
export * from "./components/Text";
|
|
24
|
+
export * from "./components/TextArea";
|
|
25
|
+
export * from "./components/Tooltip";
|
|
26
|
+
export * from "./methods/debounce";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function debounce<F extends (...args: any[]) => void>(fn: F, ms?: number): (...args: Parameters<F>) => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solidpb/ui-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@storybook/addon-docs": "^9.1.10",
|
|
14
|
+
"@storybook/addon-themes": "^9.1.10",
|
|
15
|
+
"daisyui": "^5.5.14",
|
|
16
|
+
"storybook": "^9.1.10",
|
|
17
|
+
"storybook-solidjs-vite": "^9.0.3",
|
|
18
|
+
"typescript": "^5.9.3",
|
|
19
|
+
"vite": "^7.3.0",
|
|
20
|
+
"vite-plugin-solid": "^2.11.10"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@kobalte/core": "^0.13.11",
|
|
24
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
25
|
+
"@tanstack/solid-table": "^8.21.3",
|
|
26
|
+
"@tanstack/solid-virtual": "^3.13.13",
|
|
27
|
+
"lucide-solid": "^0.562.0",
|
|
28
|
+
"solid-js": "^1.9.10",
|
|
29
|
+
"tailwind-merge": "^3.3.1",
|
|
30
|
+
"tailwind-variants": "^3.2.2",
|
|
31
|
+
"tailwindcss": "^4.1.11"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"start": "vite",
|
|
35
|
+
"publish": "npm publish --access=public",
|
|
36
|
+
"storybook": "storybook dev -p 6006",
|
|
37
|
+
"build-storybook": "storybook build",
|
|
38
|
+
"build": "vite build && tsc -p tsconfig.json",
|
|
39
|
+
"prepublishOnly": "npm run build"
|
|
40
|
+
}
|
|
41
|
+
}
|