@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { For, Show } from "solid-js";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import ChevronLeft from "lucide-solid/icons/chevron-left";
|
|
4
|
+
import ChevronRight from "lucide-solid/icons/chevron-right";
|
|
5
|
+
import ChevronDown from "lucide-solid/icons/chevron-down";
|
|
6
|
+
import { tv } from "tailwind-variants";
|
|
7
|
+
import { iconSize } from "../../constants";
|
|
8
|
+
import { DropdownMenu } from "../DropdownMenu";
|
|
9
|
+
import { NumberInput } from "../NumberInput";
|
|
10
|
+
const base = tv({
|
|
11
|
+
base: "flex items-center gap-2",
|
|
12
|
+
});
|
|
13
|
+
const labelClass = tv({
|
|
14
|
+
base: "min-w-30 text-end",
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
xs: "text-xs",
|
|
18
|
+
sm: "text-xs",
|
|
19
|
+
md: "text-sm",
|
|
20
|
+
lg: "text-sm",
|
|
21
|
+
xl: "text-md",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "sm",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
export const Pagination = (props) => {
|
|
29
|
+
const from = () => Math.max(0, props.page() * props.perPage()) + 1;
|
|
30
|
+
const to = () => Math.min(props.totalItems, (props.page() + 1) * props.perPage());
|
|
31
|
+
const totalPages = () => Math.ceil(props.totalItems / props.perPage());
|
|
32
|
+
const isFirstPage = () => props.page() === 0;
|
|
33
|
+
const isLastPage = () => props.page() >= totalPages() - 1;
|
|
34
|
+
return (<div class={base({ class: props.class })}>
|
|
35
|
+
<Show when={props.totalItems > 0}>
|
|
36
|
+
<p class={labelClass({ size: props.size })}>
|
|
37
|
+
Results: {from()}-{to()} of {props.totalItems}
|
|
38
|
+
</p>
|
|
39
|
+
</Show>
|
|
40
|
+
<DropdownMenu>
|
|
41
|
+
<DropdownMenu.Trigger>
|
|
42
|
+
<Button size={props.size} class="min-w-25">
|
|
43
|
+
<div class="flex items-center gap-1">
|
|
44
|
+
<span>{props.perPage()} / page </span>
|
|
45
|
+
<ChevronDown size={iconSize[props.size ?? "md"]}/>
|
|
46
|
+
</div>
|
|
47
|
+
</Button>
|
|
48
|
+
</DropdownMenu.Trigger>
|
|
49
|
+
<DropdownMenu.Content size={props.size}>
|
|
50
|
+
<For each={props.perPageOptions}>
|
|
51
|
+
{(opt) => (<DropdownMenu.MenuItem onSelect={() => props.onPerPageChange(opt)}>
|
|
52
|
+
<a>{opt}</a>
|
|
53
|
+
</DropdownMenu.MenuItem>)}
|
|
54
|
+
</For>
|
|
55
|
+
</DropdownMenu.Content>
|
|
56
|
+
</DropdownMenu>
|
|
57
|
+
<div class="join">
|
|
58
|
+
<Button class="join-item" size={props.size} modifier="square" disabled={isFirstPage()} onClick={props.onPrevPage}>
|
|
59
|
+
<ChevronLeft size={iconSize[props.size ?? "md"]}/>
|
|
60
|
+
</Button>
|
|
61
|
+
<NumberInput class="join-item" inputProps={{ class: "rounded-none w-15 text-center" }} size={props.size} minValue={1} maxValue={totalPages()} rawValue={props.page() + 1} onRawValueChange={(val) => props.onPageChange(val - 1)}/>
|
|
62
|
+
<Button class="join-item" size={props.size} modifier="square" disabled={isLastPage()} onClick={props.onNextPage}>
|
|
63
|
+
<ChevronRight size={iconSize[props.size ?? "md"]}/>
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>);
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Pagination";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Pagination";
|
|
@@ -4,6 +4,9 @@ interface SearchInputProps {
|
|
|
4
4
|
onChange: (v: string) => void;
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
class?: string;
|
|
7
|
+
variant?: "ghost";
|
|
8
|
+
appearance?: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
|
|
9
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
10
|
}
|
|
8
11
|
export declare const SearchInput: Component<SearchInputProps>;
|
|
9
12
|
export default SearchInput;
|
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
import { TextField } from "@kobalte/core/text-field";
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
|
+
import Search from "lucide-solid/icons/search";
|
|
3
4
|
const search = tv({
|
|
4
|
-
base: "
|
|
5
|
+
base: "input outline-offset-0",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
ghost: "input-ghost",
|
|
9
|
+
none: "",
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
xs: "input-xs",
|
|
13
|
+
sm: "input-sm",
|
|
14
|
+
md: "input-md",
|
|
15
|
+
lg: "input-lg",
|
|
16
|
+
xl: "input-xl",
|
|
17
|
+
},
|
|
18
|
+
appearance: {
|
|
19
|
+
neutral: "input-neutral",
|
|
20
|
+
primary: "input-primary",
|
|
21
|
+
secondary: "input-secondary",
|
|
22
|
+
accent: "input-accent",
|
|
23
|
+
info: "input-info",
|
|
24
|
+
success: "input-success",
|
|
25
|
+
warning: "input-warning",
|
|
26
|
+
error: "input-error",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: "sm",
|
|
31
|
+
},
|
|
5
32
|
});
|
|
6
|
-
export const SearchInput = (props) => (<TextField
|
|
7
|
-
<TextField.
|
|
33
|
+
export const SearchInput = (props) => (<TextField value={props.value} onChange={props.onChange}>
|
|
34
|
+
<TextField.Label class={search({
|
|
35
|
+
class: props.class,
|
|
36
|
+
variant: props.variant,
|
|
37
|
+
size: props.size,
|
|
38
|
+
appearance: props.appearance,
|
|
39
|
+
})}>
|
|
40
|
+
<Search class="w-[1em] h-[1em] shrink-0 opacity-70"/>
|
|
41
|
+
<TextField.Input placeholder={props.placeholder || "Search"} class="grow"/>
|
|
42
|
+
</TextField.Label>
|
|
8
43
|
</TextField>);
|
|
9
44
|
export default SearchInput;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export interface SelectProps<T> {
|
|
2
|
+
options: T[];
|
|
3
|
+
value: T | null;
|
|
4
|
+
onChange: (val: T | null) => void;
|
|
5
|
+
labelKey?: keyof T;
|
|
6
|
+
valueKey?: keyof T;
|
|
7
|
+
disabledKey?: keyof T;
|
|
7
8
|
label?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
placeholder?: string;
|
|
9
|
+
variant?: "ghost";
|
|
10
|
+
appearance?: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
|
|
11
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
12
12
|
class?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
13
15
|
}
|
|
14
|
-
export declare const Select:
|
|
16
|
+
export declare const Select: <T>(props: SelectProps<T>) => import("solid-js").JSX.Element;
|
|
15
17
|
export default Select;
|
|
@@ -1,37 +1,83 @@
|
|
|
1
|
-
import { Select as
|
|
1
|
+
import { Select as KSelect } from "@kobalte/core/select";
|
|
2
2
|
import Check from "lucide-solid/icons/check";
|
|
3
|
-
import
|
|
3
|
+
import Down from "lucide-solid/icons/chevron-down";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
const trigger = tv({
|
|
6
|
+
base: "input outline-offset-0 flex justify-between items-center",
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
ghost: "input-ghost",
|
|
10
|
+
none: "",
|
|
11
|
+
},
|
|
12
|
+
appearance: {
|
|
13
|
+
neutral: "input-neutral",
|
|
14
|
+
primary: "input-primary",
|
|
15
|
+
secondary: "input-secondary",
|
|
16
|
+
accent: "input-accent",
|
|
17
|
+
info: "input-info",
|
|
18
|
+
success: "input-success",
|
|
19
|
+
warning: "input-warning",
|
|
20
|
+
error: "input-error",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
xs: "input-xs",
|
|
24
|
+
sm: "input-sm",
|
|
25
|
+
md: "input-md",
|
|
26
|
+
lg: "input-lg",
|
|
27
|
+
xl: "input-xl",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
size: "sm",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const menu = tv({
|
|
35
|
+
base: "menu w-full",
|
|
36
|
+
variants: {
|
|
37
|
+
size: {
|
|
38
|
+
xs: "menu-xs",
|
|
39
|
+
sm: "menu-sm",
|
|
40
|
+
md: "menu-base",
|
|
41
|
+
lg: "menu-lg",
|
|
42
|
+
xl: "menu-xl",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
size: "sm",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
4
49
|
export const Select = (props) => {
|
|
5
|
-
return (<
|
|
6
|
-
{props.label &&
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</KobalteSelect.Item>);
|
|
50
|
+
return (<label class="floating-label">
|
|
51
|
+
{props.label && <span>{props.label}</span>}
|
|
52
|
+
<KSelect disabled={props.disabled} multiple={false} value={props.value} onChange={props.onChange} options={props.options} optionValue={props.valueKey} optionTextValue={props.labelKey} optionDisabled={props.disabledKey} placeholder={props.placeholder} itemComponent={(itemProps) => {
|
|
53
|
+
return (<KSelect.Item item={itemProps.item} class="outline-none focus:bg-base-300 rounded-sm">
|
|
54
|
+
<KSelect.ItemLabel class="flex flex-row justify-between items-center">
|
|
55
|
+
{props.labelKey ? String(itemProps.item.rawValue[props.labelKey]) : itemProps.item.textValue}
|
|
56
|
+
<KSelect.ItemIndicator>
|
|
57
|
+
<Check size={16}/>
|
|
58
|
+
</KSelect.ItemIndicator>
|
|
59
|
+
</KSelect.ItemLabel>
|
|
60
|
+
</KSelect.Item>);
|
|
17
61
|
}}>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
<KSelect.Trigger class={trigger({
|
|
63
|
+
variant: props.variant,
|
|
64
|
+
appearance: props.appearance,
|
|
65
|
+
size: props.size,
|
|
66
|
+
class: props.class,
|
|
67
|
+
})}>
|
|
68
|
+
<KSelect.Value>
|
|
69
|
+
{(state) => String(props.labelKey ? state.selectedOption()?.[props.labelKey] : "")}
|
|
70
|
+
</KSelect.Value>
|
|
71
|
+
<KSelect.Icon>
|
|
72
|
+
<Down size={16}/>
|
|
73
|
+
</KSelect.Icon>
|
|
74
|
+
</KSelect.Trigger>
|
|
75
|
+
<KSelect.Portal>
|
|
76
|
+
<KSelect.Content class="rounded-box bg-base-100 shadow-md border border-base-200 z-20">
|
|
77
|
+
<KSelect.Listbox class={menu({ size: props.size })}/>
|
|
78
|
+
</KSelect.Content>
|
|
79
|
+
</KSelect.Portal>
|
|
80
|
+
</KSelect>
|
|
81
|
+
</label>);
|
|
36
82
|
};
|
|
37
83
|
export default Select;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component } from "solid-js";
|
|
2
|
+
export interface SliderProps {
|
|
3
|
+
value?: number;
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
step?: number;
|
|
7
|
+
onChange?: (v: number) => void;
|
|
8
|
+
saveFunc?: (v: number) => Promise<any>;
|
|
9
|
+
appearance?: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
|
|
10
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
11
|
+
class?: string;
|
|
12
|
+
labelClass?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const Slider: Component<SliderProps>;
|
|
16
|
+
export default Slider;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createMemo, Show } from "solid-js";
|
|
2
|
+
import { debounce } from "../../methods/debounce";
|
|
3
|
+
import { tv } from "tailwind-variants";
|
|
4
|
+
const slider = tv({
|
|
5
|
+
base: "range",
|
|
6
|
+
variants: {
|
|
7
|
+
appearance: {
|
|
8
|
+
neutral: "range-neutral",
|
|
9
|
+
primary: "range-primary",
|
|
10
|
+
secondary: "range-secondary",
|
|
11
|
+
accent: "range-accent",
|
|
12
|
+
info: "range-info",
|
|
13
|
+
success: "range-success",
|
|
14
|
+
warning: "range-warning",
|
|
15
|
+
error: "range-error",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
xs: "range-xs",
|
|
19
|
+
sm: "range-sm",
|
|
20
|
+
md: "range-md",
|
|
21
|
+
lg: "range-lg",
|
|
22
|
+
xl: "range-xl",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
size: "sm",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const label = tv({
|
|
30
|
+
base: "label text-xs",
|
|
31
|
+
variants: {
|
|
32
|
+
size: {
|
|
33
|
+
xs: "text-xs",
|
|
34
|
+
sm: "text-xs",
|
|
35
|
+
md: "text-xs",
|
|
36
|
+
lg: "text-sm",
|
|
37
|
+
xl: "text-sm",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
size: "sm",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
export const Slider = (props) => {
|
|
45
|
+
const debouncedSave = createMemo(() => (props.saveFunc ? debounce(props.saveFunc) : undefined));
|
|
46
|
+
const handleChange = (val) => {
|
|
47
|
+
const v = val[0];
|
|
48
|
+
props.onChange?.(v);
|
|
49
|
+
debouncedSave()?.(v);
|
|
50
|
+
};
|
|
51
|
+
return (<label class="flex flex-col gap-1 w-fit">
|
|
52
|
+
<Show when={props.label}>
|
|
53
|
+
<span class={label({ size: props.size, class: props.labelClass })}>{props.label}</span>
|
|
54
|
+
</Show>
|
|
55
|
+
<input class={slider({ appearance: props.appearance, size: props.size, class: props.class })} type="range" min={props.min} max={props.max} value={props.value} step={props.step} onInput={(e) => {
|
|
56
|
+
handleChange([e.currentTarget.valueAsNumber]);
|
|
57
|
+
}}/>
|
|
58
|
+
</label>);
|
|
59
|
+
};
|
|
60
|
+
export default Slider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Slider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Slider";
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { PolymorphicProps } from "@kobalte/core";
|
|
4
|
-
type SwitchProps<T extends ValidComponent = "div"> = PolymorphicProps<T, SwitchRootProps<T>>;
|
|
5
|
-
interface Props extends SwitchProps {
|
|
1
|
+
import { Component, JSX } from "solid-js";
|
|
2
|
+
export interface SwitchProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "type" | "onChange"> {
|
|
6
3
|
label?: string;
|
|
7
|
-
size?: "sm" | "md";
|
|
8
|
-
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
5
|
+
appearance?: "primary" | "secondary" | "success" | "warning" | "error" | "info" | "accent" | "neutral";
|
|
6
|
+
onChange?: (checked: boolean) => void;
|
|
9
7
|
}
|
|
10
|
-
export declare const Switch: Component<
|
|
8
|
+
export declare const Switch: Component<SwitchProps>;
|
|
11
9
|
export default Switch;
|
|
@@ -1,22 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { splitProps } from "solid-js";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
const toggle = tv({
|
|
4
|
+
base: "toggle",
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
xs: "toggle-xs",
|
|
8
|
+
sm: "toggle-sm",
|
|
9
|
+
md: "toggle-md",
|
|
10
|
+
lg: "toggle-lg",
|
|
11
|
+
xl: "toggle-xl",
|
|
12
|
+
},
|
|
13
|
+
appearance: {
|
|
14
|
+
primary: "toggle-primary",
|
|
15
|
+
secondary: "toggle-secondary",
|
|
16
|
+
success: "toggle-success",
|
|
17
|
+
warning: "toggle-warning",
|
|
18
|
+
error: "toggle-error",
|
|
19
|
+
info: "toggle-info",
|
|
20
|
+
accent: "toggle-accent",
|
|
21
|
+
neutral: "toggle-neutral",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "sm",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
4
28
|
export const Switch = (props) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
data-[checked]:bg-white data-[checked]:border-white transition-all`}>
|
|
17
|
-
<KSwitch.Thumb class={`h-5 w-5 rounded-full bg-white transition-transform
|
|
18
|
-
data-[checked]:[transform:translateX(calc(100%-2px))]`}/>
|
|
19
|
-
</KSwitch.Control>
|
|
20
|
-
</KSwitch>);
|
|
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={toggle({
|
|
32
|
+
size: local.size,
|
|
33
|
+
appearance: local.appearance,
|
|
34
|
+
class: local.class,
|
|
35
|
+
})} onChange={(e) => {
|
|
36
|
+
local.onChange?.(Boolean(e.currentTarget.value));
|
|
37
|
+
}}/>
|
|
38
|
+
{local.label && <span class="select-none">{local.label}</span>}
|
|
39
|
+
</label>);
|
|
21
40
|
};
|
|
22
41
|
export default Switch;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { ColumnDef, ColumnFiltersState, Row } from "@tanstack/solid-table";
|
|
2
1
|
import { Accessor, JSXElement } from "solid-js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { ColumnDef, Row } from "@tanstack/solid-table";
|
|
3
|
+
interface TableItem {
|
|
4
|
+
id: string;
|
|
5
|
+
collectionId: string;
|
|
6
|
+
tablePosition?: number;
|
|
7
|
+
}
|
|
8
|
+
interface TableProps<T extends TableItem> {
|
|
9
|
+
data: T[];
|
|
6
10
|
createFunc?: () => Promise<void>;
|
|
7
11
|
headerActions?: JSXElement;
|
|
8
12
|
columns: Accessor<ColumnDef<T>[]>;
|
|
@@ -13,14 +17,11 @@ interface ListProps<T> {
|
|
|
13
17
|
searchPlaceholder?: string;
|
|
14
18
|
renderRow?: (row: Row<T>, onRowClick: (item: T) => void) => JSXElement;
|
|
15
19
|
showItemCount?: boolean;
|
|
16
|
-
|
|
20
|
+
class?: string;
|
|
17
21
|
search?: boolean;
|
|
18
22
|
headers?: boolean;
|
|
23
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
24
|
+
onReorderRow?: (item: T, oldInd: number, newInd: number) => void;
|
|
19
25
|
}
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
22
|
-
columns: Accessor<ColumnDef<T>[]>;
|
|
23
|
-
onClick: (item: T) => void;
|
|
24
|
-
}) => JSXElement;
|
|
25
|
-
export declare const List: <T>(props: ListProps<T>) => JSXElement;
|
|
26
|
-
export default List;
|
|
26
|
+
export declare const Table: <T extends TableItem>(props: TableProps<T>) => JSXElement;
|
|
27
|
+
export default Table;
|