@solidpb/ui-kit 0.1.0 → 0.1.1

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.
@@ -3,9 +3,10 @@ import { 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
5
  interface Props extends BaseProps {
6
- variant?: "text" | "solid";
7
- appearance?: "primary" | "success" | "warning" | "neutral" | "error" | "muted";
8
- size?: "xs" | "sm" | "md" | "lg";
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
12
  export declare const Button: ParentComponent<Props>;
@@ -3,71 +3,55 @@ 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: "bg-light-primary dark:bg-dark-primary/20 dark:text-dark-primary",
16
- success: "bg-light-success dark:bg-dark-success/20 dark:text-dark-success",
17
- warning: "bg-light-warning dark:bg-dark-warning/20 dark:text-dark-warning",
18
- neutral: "bg-light-neutral dark:bg-dark-neutral/20 dark:text-dark-neutral",
19
- error: "bg-light-error dark:bg-dark-error/20 dark:text-dark-error",
20
- muted: "bg-light-muted dark:bg-dark-muted/20 dark:text-dark-muted",
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: "text-xs px-2 py-1",
24
- sm: "text-sm px-3 py-1.5",
25
- md: "text-base px-4 py-2",
26
- lg: "text-lg px-5 py-3",
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
- text: "bg-transparent dark:bg-transparent border-none py-0 px-1 hover:underline underline-offset-4",
30
- solid: "dark:border-1",
26
+ outline: "btn-outline",
27
+ dash: "btn-dash",
28
+ soft: "btn-soft",
29
+ ghost: "btn-ghost",
30
+ link: "btn-link",
31
+ none: "",
31
32
  },
32
- },
33
- compoundVariants: [
34
- {
35
- variant: "text",
36
- appearance: "primary",
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",
33
+ modifier: {
34
+ wide: "btn-wide",
35
+ block: "btn-block",
36
+ square: "btn-square",
37
+ circle: "btn-circle",
38
+ none: "",
53
39
  },
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
- ],
40
+ },
65
41
  defaultVariants: {
66
- variant: "solid",
42
+ variant: "none",
67
43
  appearance: "neutral",
68
44
  size: "md",
45
+ modifier: "none",
69
46
  },
70
47
  });
48
+ const spinnerSizeMap = {
49
+ xs: 12,
50
+ sm: 16,
51
+ md: 20,
52
+ lg: 24,
53
+ xl: 28,
54
+ };
71
55
  export const Button = (props) => {
72
56
  const [local, others] = splitProps(props, [
73
57
  "children",
@@ -76,17 +60,19 @@ export const Button = (props) => {
76
60
  "appearance",
77
61
  "size",
78
62
  "isLoading",
63
+ "modifier",
79
64
  ]);
80
65
  const classes = createMemo(() => button({
81
66
  variant: local.variant,
82
67
  appearance: local.appearance,
83
68
  size: local.size,
69
+ modifier: local.modifier,
84
70
  class: local.class,
85
71
  }));
86
72
  return (<KButton class={classes()} disabled={local.isLoading} {...others}>
87
73
  {local.children}
88
74
  <Show when={local.isLoading}>
89
- <Loader class="ml-2 animate-spin"/>
75
+ <Loader class="ml-1 animate-spin" size={spinnerSizeMap[local.size ?? "md"]}/>
90
76
  </Show>
91
77
  </KButton>);
92
78
  };
@@ -1,6 +1,15 @@
1
1
  import { ParentComponent } from "solid-js";
2
2
  interface Props {
3
3
  class?: string;
4
+ img?: string;
5
+ imgAlt?: string;
6
+ bodyClass?: string;
4
7
  }
5
- export declare const Card: ParentComponent<Props>;
8
+ export declare const Card: ParentComponent<Props> & {
9
+ Title: typeof CardTitle;
10
+ };
11
+ interface CardTitleProps {
12
+ class?: string;
13
+ }
14
+ declare const CardTitle: ParentComponent<CardTitleProps>;
6
15
  export default Card;
@@ -1,6 +1,26 @@
1
+ import { Show } from "solid-js";
2
+ import { tv } from "tailwind-variants";
3
+ const card = tv({
4
+ base: "card bg-base-100 shadow-sm",
5
+ });
6
+ const cardBody = tv({
7
+ base: "card-body w-full",
8
+ });
1
9
  export const Card = (props) => {
2
- return (<div class={`rounded-xl p-3 bg-[var(--color-light-surface)] dark:bg-[var(--color-dark-surface)] text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)] ${props.class ?? ""}`}>
3
- {props.children}
10
+ return (<div class={card({ class: props.class })}>
11
+ <Show when={props.img}>
12
+ <figure>
13
+ <img src={props.img} alt={props.imgAlt ?? "Card Image"}/>
14
+ </figure>
15
+ </Show>
16
+ <div class={cardBody({ class: props.bodyClass })}>{props.children}</div>
4
17
  </div>);
5
18
  };
19
+ const cardTitle = tv({
20
+ base: "card-title",
21
+ });
22
+ const CardTitle = (props) => {
23
+ return <h2 class={cardTitle({ class: props.class })}>{props.children}</h2>;
24
+ };
25
+ Card.Title = CardTitle;
6
26
  export default Card;
@@ -1,5 +1,15 @@
1
+ import { tv } from "tailwind-variants";
2
+ const container = tv({
3
+ base: "flex-1 bg-base-100 dark:bg-base-900 min-h-[calc(100vh-4rem)]",
4
+ variants: {
5
+ noPadding: {
6
+ true: "",
7
+ false: "py-4 px-[3vw]",
8
+ },
9
+ },
10
+ });
1
11
  export const Container = (props) => {
2
- const classes = `flex-1 ${props.noPadding ? "" : "py-4 px-[3vw]"} ${props.class ?? ""}`;
12
+ const classes = container({ noPadding: props.noPadding, class: props.class });
3
13
  return <div class={classes}>{props.children}</div>;
4
14
  };
5
15
  export default Container;
@@ -3,7 +3,16 @@ import { TextField } from "@kobalte/core/text-field";
3
3
  import { tv } from "tailwind-variants";
4
4
  import { debounce } from "../../methods/debounce";
5
5
  const inputRoot = tv({
6
- base: "relative flex flex-col gap-1 mt-3",
6
+ base: "relative flex flex-col gap-1",
7
+ variants: {
8
+ marginTop: {
9
+ yes: "mt-2",
10
+ no: "",
11
+ },
12
+ },
13
+ defaultVariants: {
14
+ marginTop: "no",
15
+ },
7
16
  });
8
17
  const inputLabel = tv({
9
18
  base: "absolute left-3 px-1 font-medium pointer-events-none z-10 bg-base-100",
@@ -67,7 +76,7 @@ export const Input = (props) => {
67
76
  local.onChange?.(v);
68
77
  debouncedSave()?.(v);
69
78
  };
70
- return (<TextField class={inputRoot({ class: local.class })} {...others} onChange={handleChange}>
79
+ return (<TextField class={inputRoot({ class: local.class, marginTop: local.label ? "yes" : "no" })} {...others} onChange={handleChange}>
71
80
  <div class="relative w-full">
72
81
  <Show when={local.label}>
73
82
  <TextField.Label class={inputLabel({ size: local.size })} style="transform: translateY(-50%);">
@@ -63,7 +63,7 @@ export const List = (props) => {
63
63
  <Show when={props.search}>
64
64
  <div class="flex items-center space-x-2 mt-3 mb-1">
65
65
  <Show when={props.createFunc}>
66
- <Button class="flex text-sm items-center pl-1 pr-2" variant="solid" appearance="success" onClick={props.createFunc}>
66
+ <Button class="flex text-sm items-center pl-1 pr-2" appearance="success" onClick={props.createFunc}>
67
67
  <Plus size={20}/>
68
68
  New
69
69
  </Button>
@@ -1,4 +1,4 @@
1
- interface RelationPickerProps<T extends TagRecord = TagRecord> {
1
+ interface RelationPickerProps<T extends Tag = Tag> {
2
2
  relations: T[];
3
3
  setRelations: (relations: T[]) => void;
4
4
  suggestions?: T[];
@@ -7,5 +7,5 @@ interface RelationPickerProps<T extends TagRecord = TagRecord> {
7
7
  placeholder?: string;
8
8
  label?: string;
9
9
  }
10
- export declare const RelationPicker: <T extends TagRecord = TagRecord>(props: RelationPickerProps<T>) => import("solid-js").JSX.Element;
10
+ export declare const RelationPicker: <T extends Tag = Tag>(props: RelationPickerProps<T>) => import("solid-js").JSX.Element;
11
11
  export default RelationPicker;
@@ -1,5 +1,5 @@
1
1
  import { JSX } from "solid-js";
2
- interface TagAreaProps<T extends TagRecord = TagRecord> {
2
+ interface TagAreaProps<T extends Tag = Tag> {
3
3
  tags: T[];
4
4
  setTags: (tags: T[]) => void;
5
5
  onCreateTag: (name: string) => Promise<T>;
@@ -7,5 +7,5 @@ interface TagAreaProps<T extends TagRecord = TagRecord> {
7
7
  suggestions?: T[];
8
8
  placeholder?: string;
9
9
  }
10
- export declare const TagArea: <T extends TagRecord = TagRecord>(props: TagAreaProps<T>) => JSX.Element;
10
+ export declare const TagArea: <T extends Tag = Tag>(props: TagAreaProps<T>) => JSX.Element;
11
11
  export default TagArea;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from "./components/DateInput";
6
6
  export * from "./components/DropdownMenu";
7
7
  export * from "./components/FileInput";
8
8
  export * from "./components/Form";
9
- export * from "./components/Heading";
10
9
  export * from "./components/Image";
11
10
  export * from "./components/Input";
12
11
  export * from "./components/Link";
@@ -20,7 +19,6 @@ export * from "./components/Switch";
20
19
  export * from "./components/Tabs";
21
20
  export * from "./components/Tag";
22
21
  export * from "./components/TagArea";
23
- export * from "./components/Text";
24
22
  export * from "./components/TextArea";
25
23
  export * from "./components/Tooltip";
26
24
  export * from "./methods/debounce";
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ export * from "./components/DateInput";
6
6
  export * from "./components/DropdownMenu";
7
7
  export * from "./components/FileInput";
8
8
  export * from "./components/Form";
9
- export * from "./components/Heading";
10
9
  export * from "./components/Image";
11
10
  export * from "./components/Input";
12
11
  export * from "./components/Link";
@@ -20,7 +19,6 @@ export * from "./components/Switch";
20
19
  export * from "./components/Tabs";
21
20
  export * from "./components/Tag";
22
21
  export * from "./components/TagArea";
23
- export * from "./components/Text";
24
22
  export * from "./components/TextArea";
25
23
  export * from "./components/Tooltip";
26
24
  export * from "./methods/debounce";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidpb/ui-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "publish": "npm publish --access=public",
36
36
  "storybook": "storybook dev -p 6006",
37
37
  "build-storybook": "storybook build",
38
- "build": "vite build && tsc -p tsconfig.json",
38
+ "build": "vite build && tsc -p tsconfig.build.json",
39
39
  "prepublishOnly": "npm run build"
40
40
  }
41
41
  }
@@ -1,7 +0,0 @@
1
- import { JSX } from "solid-js";
2
- interface Props extends JSX.HTMLAttributes<HTMLElement> {
3
- as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
4
- appearance?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
5
- }
6
- export declare const Heading: (props: Props) => JSX.Element;
7
- export default Heading;
@@ -1,29 +0,0 @@
1
- import { splitProps, createMemo } from "solid-js";
2
- import { Dynamic } from "solid-js/web";
3
- import { tv } from "tailwind-variants";
4
- const heading = tv({
5
- base: "font-sans text-balance tracking-tight",
6
- variants: {
7
- appearance: {
8
- h1: "text-4xl font-bold",
9
- h2: "text-3xl font-semibold",
10
- h3: "text-2xl font-semibold",
11
- h4: "text-xl font-medium",
12
- h5: "text-lg font-medium",
13
- h6: "text-base font-medium",
14
- p: "text-base font-normal",
15
- },
16
- },
17
- defaultVariants: {
18
- appearance: "p",
19
- },
20
- });
21
- export const Heading = (props) => {
22
- const [local, others] = splitProps(props, ["as", "appearance", "class", "children"]);
23
- const Tag = (local.as ?? "p");
24
- const classes = createMemo(() => heading({ appearance: local.appearance ?? local.as ?? "p", class: local.class }));
25
- return (<Dynamic component={Tag} class={classes()} {...others}>
26
- {local.children}
27
- </Dynamic>);
28
- };
29
- export default Heading;
@@ -1 +0,0 @@
1
- export * from "./Heading";
@@ -1 +0,0 @@
1
- export * from "./Heading";
@@ -1,9 +0,0 @@
1
- import { Component, JSX } from "solid-js";
2
- interface TextProps {
3
- children: JSX.Element;
4
- size?: "sm" | "md" | "lg";
5
- color?: "primary" | "secondary" | "error" | "success" | "warning" | "muted";
6
- class?: string;
7
- }
8
- export declare const Text: Component<TextProps>;
9
- export default Text;
@@ -1,25 +0,0 @@
1
- import { tv } from "tailwind-variants";
2
- const text = tv({
3
- base: "font-normal",
4
- variants: {
5
- size: {
6
- sm: "text-sm",
7
- md: "text-base",
8
- lg: "text-lg",
9
- },
10
- color: {
11
- primary: "text-[var(--color-text-light-primary)] dark:text-[var(--color-text-dark-primary)]",
12
- secondary: "text-[var(--color-text-light-secondary)] dark:text-[var(--color-text-dark-secondary)]",
13
- error: "text-[var(--color-light-error)] dark:text-[var(--color-dark-error)]",
14
- success: "text-[var(--color-light-success)] dark:text-[var(--color-dark-success)]",
15
- warning: "text-[var(--color-light-warning)] dark:text-[var(--color-dark-warning)]",
16
- muted: "text-[var(--color-light-muted)] dark:text-[var(--color-dark-muted)]",
17
- },
18
- },
19
- defaultVariants: {
20
- size: "md",
21
- color: "primary",
22
- },
23
- });
24
- export const Text = (props) => (<span class={text({ size: props.size, color: props.color, class: props.class })}>{props.children}</span>);
25
- export default Text;
@@ -1 +0,0 @@
1
- export * from "./Text";
@@ -1 +0,0 @@
1
- export * from "./Text";