singularity-components 0.1.8 → 0.1.53
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 +3 -0
- package/dist/main.cjs +203 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.css +637 -0
- package/dist/main.css.map +1 -0
- package/dist/main.d.cts +55 -0
- package/dist/main.d.ts +54 -0
- package/dist/main.js +163 -0
- package/dist/main.js.map +1 -0
- package/package.json +46 -35
- package/dist/App.d.ts +0 -3
- package/dist/components/ui/skeleton.d.ts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2921
- package/dist/lib/utils.d.ts +0 -3
package/dist/main.d.cts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
type props = {
|
|
8
|
+
text?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const Demo: ({ text }: props) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
type ValidBreakpoint = "" | "sm:" | "md:" | "lg:" | "xl:" | "2xl:";
|
|
13
|
+
type ValidMarginDirection = "m-" | "mx-" | "my-" | "mt-" | "mr-" | "mb-" | "ml-";
|
|
14
|
+
type ValidMarginSize = "0" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | "px" | "auto";
|
|
15
|
+
type TailwindMarginClass = "" | `${ValidBreakpoint}${ValidMarginDirection}${ValidMarginSize}`;
|
|
16
|
+
type OmitClassProperty<T1, T2 extends string> = Omit<T1, T2>;
|
|
17
|
+
|
|
18
|
+
declare const buttonVariants: (props?: ({
|
|
19
|
+
variant?: "link" | "primary" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
20
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
21
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
22
|
+
interface ButtonProps extends OmitClassProperty<React.ButtonHTMLAttributes<HTMLButtonElement>, "className">, VariantProps<typeof buttonVariants> {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
className?: TailwindMarginClass;
|
|
25
|
+
}
|
|
26
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
|
|
28
|
+
declare const badgeVariants: (props?: ({
|
|
29
|
+
variant?: "default" | "outline" | "purple" | "green" | null | undefined;
|
|
30
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
31
|
+
interface BadgeProps extends OmitClassProperty<React.HTMLAttributes<HTMLDivElement>, "className">, VariantProps<typeof badgeVariants> {
|
|
32
|
+
className?: TailwindMarginClass;
|
|
33
|
+
}
|
|
34
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
declare const layoutVariants: (props?: ({
|
|
37
|
+
variant?: "100" | "66-33" | "50-50" | "33-33-33" | "25-25-25-25" | null | undefined;
|
|
38
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
39
|
+
interface LayoutProps extends OmitClassProperty<React.HTMLAttributes<HTMLDivElement>, "className">, VariantProps<typeof layoutVariants> {
|
|
40
|
+
fullWidth?: boolean;
|
|
41
|
+
className?: TailwindMarginClass;
|
|
42
|
+
}
|
|
43
|
+
declare function Layout({ children, className, variant, ...props }: PropsWithChildren<LayoutProps>): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare namespace Layout {
|
|
45
|
+
var Col1: typeof Col;
|
|
46
|
+
var Col2: typeof Col;
|
|
47
|
+
var Col3: typeof Col;
|
|
48
|
+
var Col4: typeof Col;
|
|
49
|
+
}
|
|
50
|
+
type colProp = {
|
|
51
|
+
children: React.ReactNode;
|
|
52
|
+
};
|
|
53
|
+
declare function Col({ children }: colProp): react_jsx_runtime.JSX.Element;
|
|
54
|
+
|
|
55
|
+
export { Badge, Button, Demo, Layout };
|
package/dist/main.d.ts
CHANGED
|
@@ -1 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { PropsWithChildren } from 'react';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
1
6
|
|
|
7
|
+
type props = {
|
|
8
|
+
text?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const Demo: ({ text }: props) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
type ValidBreakpoint = "" | "sm:" | "md:" | "lg:" | "xl:" | "2xl:";
|
|
13
|
+
type ValidMarginDirection = "m-" | "mx-" | "my-" | "mt-" | "mr-" | "mb-" | "ml-";
|
|
14
|
+
type ValidMarginSize = "0" | "0.5" | "1" | "1.5" | "2" | "2.5" | "3" | "3.5" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "14" | "16" | "20" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "52" | "56" | "60" | "64" | "72" | "80" | "96" | "px" | "auto";
|
|
15
|
+
type TailwindMarginClass = "" | `${ValidBreakpoint}${ValidMarginDirection}${ValidMarginSize}`;
|
|
16
|
+
type OmitClassProperty<T1, T2 extends string> = Omit<T1, T2>;
|
|
17
|
+
|
|
18
|
+
declare const buttonVariants: (props?: ({
|
|
19
|
+
variant?: "link" | "primary" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
20
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
21
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
22
|
+
interface ButtonProps extends OmitClassProperty<React.ButtonHTMLAttributes<HTMLButtonElement>, "className">, VariantProps<typeof buttonVariants> {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
className?: TailwindMarginClass;
|
|
25
|
+
}
|
|
26
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
|
|
28
|
+
declare const badgeVariants: (props?: ({
|
|
29
|
+
variant?: "default" | "outline" | "purple" | "green" | null | undefined;
|
|
30
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
31
|
+
interface BadgeProps extends OmitClassProperty<React.HTMLAttributes<HTMLDivElement>, "className">, VariantProps<typeof badgeVariants> {
|
|
32
|
+
className?: TailwindMarginClass;
|
|
33
|
+
}
|
|
34
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
declare const layoutVariants: (props?: ({
|
|
37
|
+
variant?: "100" | "66-33" | "50-50" | "33-33-33" | "25-25-25-25" | null | undefined;
|
|
38
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
39
|
+
interface LayoutProps extends OmitClassProperty<React.HTMLAttributes<HTMLDivElement>, "className">, VariantProps<typeof layoutVariants> {
|
|
40
|
+
fullWidth?: boolean;
|
|
41
|
+
className?: TailwindMarginClass;
|
|
42
|
+
}
|
|
43
|
+
declare function Layout({ children, className, variant, ...props }: PropsWithChildren<LayoutProps>): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare namespace Layout {
|
|
45
|
+
var Col1: typeof Col;
|
|
46
|
+
var Col2: typeof Col;
|
|
47
|
+
var Col3: typeof Col;
|
|
48
|
+
var Col4: typeof Col;
|
|
49
|
+
}
|
|
50
|
+
type colProp = {
|
|
51
|
+
children: React.ReactNode;
|
|
52
|
+
};
|
|
53
|
+
declare function Col({ children }: colProp): react_jsx_runtime.JSX.Element;
|
|
54
|
+
|
|
55
|
+
export { Badge, Button, Demo, Layout };
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// lib/utils.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { extendTailwindMerge, twMerge } from "tailwind-merge";
|
|
4
|
+
function cn(...inputs) {
|
|
5
|
+
const twMergeWithPrefix = extendTailwindMerge({
|
|
6
|
+
prefix: "sg-"
|
|
7
|
+
});
|
|
8
|
+
return twMergeWithPrefix(twMerge(clsx(inputs)));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// lib/components/Demo.tsx
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
var Demo = ({ text }) => {
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: cn(
|
|
18
|
+
"sg-text-orange-500 sg-p-4 sg-p-3 sg-text-white sg-bg-black"
|
|
19
|
+
),
|
|
20
|
+
children: text
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// lib/components/ui/button/button.tsx
|
|
26
|
+
import * as React from "react";
|
|
27
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
28
|
+
import { cva } from "class-variance-authority";
|
|
29
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
30
|
+
var buttonVariants = cva(
|
|
31
|
+
"sg-inline-flex sg-items-center sg-justify-center sg-gap-2 sg-whitespace-nowrap sg-rounded-md sg-text-sm sg-font-medium sg-transition-colors focus-visible:sg-outline-none focus-visible:ring-offset-2 focus-visible:sg-ring-2 focus-visible:sg-ring-ring disabled:sg-pointer-events-none disabled:sg-opacity-50 [&_svg]:sg-pointer-events-none [&_svg]:sg-size-4 [&_svg]:sg-shrink-0",
|
|
32
|
+
{
|
|
33
|
+
variants: {
|
|
34
|
+
variant: {
|
|
35
|
+
primary: "sg-bg-orange sg-text-orange-foreground sg-shadow hover:sg-bg-orange/90",
|
|
36
|
+
secondary: "sg-bg-purple sg-text-purple-foreground sg-shadow-sm hover:sg-bg-purple/90",
|
|
37
|
+
destructive: "sg-bg-red sg-text-red-foreground sg-shadow-sm hover:sg-bg-red/90",
|
|
38
|
+
outline: "sg-border sg-border-orange sg-bg-white sg-shadow-sm hover:sg-bg-gray/20",
|
|
39
|
+
ghost: "hover:sg-bg-accent hover:sg-text-accent-foreground",
|
|
40
|
+
link: "sg-text-primary sg-underline-offset-4 hover:sg-underline"
|
|
41
|
+
},
|
|
42
|
+
size: {
|
|
43
|
+
default: "sg-h-9 sg-px-4 sg-py-2",
|
|
44
|
+
sm: "sg-h-8 sg-rounded-md sg-px-3 sg-text-xs",
|
|
45
|
+
lg: "sg-h-10 sg-rounded-md sg-px-8",
|
|
46
|
+
icon: "sg-h-9 sg-w-9"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
variant: "primary",
|
|
51
|
+
size: "default"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
var Button = React.forwardRef(
|
|
56
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
57
|
+
const Comp = asChild ? Slot : "button";
|
|
58
|
+
return /* @__PURE__ */ jsx2(
|
|
59
|
+
Comp,
|
|
60
|
+
{
|
|
61
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
62
|
+
ref,
|
|
63
|
+
...props
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
Button.displayName = "Button";
|
|
69
|
+
|
|
70
|
+
// lib/components/ui/badge/badge.tsx
|
|
71
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
72
|
+
|
|
73
|
+
// lib/components/ui/layout/layout.tsx
|
|
74
|
+
import * as React2 from "react";
|
|
75
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
76
|
+
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
77
|
+
var layoutVariants = cva2("sg-grid sg-gap-4 ", {
|
|
78
|
+
variants: {
|
|
79
|
+
variant: {
|
|
80
|
+
"100": "sg-grid-cols-1",
|
|
81
|
+
"66-33": "sg-grid-cols-1 md:sg-grid-cols-2",
|
|
82
|
+
"50-50": "sg-grid-cols-1 md:sg-grid-cols-2",
|
|
83
|
+
"33-33-33": "sg-grid-cols-1 md:sg-grid-cols-2",
|
|
84
|
+
"25-25-25-25": "sg-grid-cols-1 md:sg-grid-cols-2"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
variant: "100"
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
function Layout({
|
|
92
|
+
children,
|
|
93
|
+
className,
|
|
94
|
+
variant = "100",
|
|
95
|
+
...props
|
|
96
|
+
}) {
|
|
97
|
+
const allowedInLayout = (content) => {
|
|
98
|
+
if (content.type === Layout.Col1) {
|
|
99
|
+
return true;
|
|
100
|
+
} else if (content.type === Layout.Col2 && (variant === "66-33" || variant === "50-50")) {
|
|
101
|
+
return true;
|
|
102
|
+
} else if (content.type === Layout.Col3 && (variant === "33-33-33" || variant === "25-25-25-25")) {
|
|
103
|
+
return true;
|
|
104
|
+
} else if (content.type === Layout.Col4 && variant === "25-25-25-25") {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
console.error("Content not allowed in column for layout", content.type);
|
|
108
|
+
return false;
|
|
109
|
+
};
|
|
110
|
+
const renderColumn = (content) => {
|
|
111
|
+
if (!allowedInLayout(content)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
console.log("content", content);
|
|
115
|
+
return /* @__PURE__ */ jsx3("div", { children: content });
|
|
116
|
+
};
|
|
117
|
+
return /* @__PURE__ */ jsx3("div", { className: "sg-mx-auto sg-max-w-[960px]", children: /* @__PURE__ */ jsx3("div", { className: cn(layoutVariants({ variant }), className), ...props, children: React2.Children.map(
|
|
118
|
+
children,
|
|
119
|
+
(child) => React2.isValidElement(child) ? renderColumn(child) : /* @__PURE__ */ jsx3(Fragment, {})
|
|
120
|
+
) }) });
|
|
121
|
+
}
|
|
122
|
+
function Col({ children }) {
|
|
123
|
+
return /* @__PURE__ */ jsx3(Fragment, { children });
|
|
124
|
+
}
|
|
125
|
+
Layout.Col1 = Col;
|
|
126
|
+
Layout.Col2 = Col;
|
|
127
|
+
Layout.Col3 = Col;
|
|
128
|
+
Layout.Col4 = Col;
|
|
129
|
+
|
|
130
|
+
// lib/components/ui/badge/badge.tsx
|
|
131
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
132
|
+
var badgeVariants = cva3(
|
|
133
|
+
"sg-inline-flex sg-items-center sg-rounded-md sg-border sg-px-2.5 sg-py-0.5 sg-text-xs sg-font-semibold sg-transition-colors focus:sg-outline-none focus:sg-ring-2 focus:sg-ring-ring focus:sg-ring-offset-2",
|
|
134
|
+
{
|
|
135
|
+
variants: {
|
|
136
|
+
variant: {
|
|
137
|
+
default: "sg-border-transparent sg-bg-orange sg-text-orange-foreground sg-shadow hover:sg-bg-orange/80",
|
|
138
|
+
purple: "sg-border-transparent sg-bg-purple sg-text-purple-foreground sg-shadow hover:sg-bg-purple/80",
|
|
139
|
+
green: "sg-border-transparent sg-bg-green sg-text-green-foreground sg-shadow hover:sg-bg-green/80",
|
|
140
|
+
outline: "sg-text-foreground"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
defaultVariants: {
|
|
144
|
+
variant: "default"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
function Badge({ className, variant, ...props }) {
|
|
149
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
150
|
+
/* @__PURE__ */ jsx4("div", { className: cn(badgeVariants({ variant }), className), ...props }),
|
|
151
|
+
/* @__PURE__ */ jsxs(Layout, { variant: "66-33", children: [
|
|
152
|
+
/* @__PURE__ */ jsx4(Layout.Col1, { children: "Col1" }),
|
|
153
|
+
/* @__PURE__ */ jsx4(Layout.Col2, { children: "Col2" })
|
|
154
|
+
] })
|
|
155
|
+
] });
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
Badge,
|
|
159
|
+
Button,
|
|
160
|
+
Demo,
|
|
161
|
+
Layout
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../lib/utils.ts","../lib/components/Demo.tsx","../lib/components/ui/button/button.tsx","../lib/components/ui/badge/badge.tsx","../lib/components/ui/layout/layout.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\r\nimport { extendTailwindMerge, twMerge } from \"tailwind-merge\";\r\nimport {} from \"tailwind-merge\";\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n const twMergeWithPrefix = extendTailwindMerge({\r\n prefix: \"sg-\",\r\n });\r\n\r\n return twMergeWithPrefix(twMerge(clsx(inputs)));\r\n}\r\n","import { cn } from \"../utils\";\n\ntype props = {\n text?: string;\n};\n\nexport const Demo = ({ text }: props) => {\n return (\n <div\n className={cn(\n \"sg-text-orange-500 sg-p-4 sg-p-3 sg-text-white sg-bg-black\"\n )}\n >\n {text}\n </div>\n );\n};\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../../utils\";\nimport { OmitClassProperty, TailwindMarginClass } from \"../../../lib/types\";\n\nconst buttonVariants = cva(\n \"sg-inline-flex sg-items-center sg-justify-center sg-gap-2 sg-whitespace-nowrap sg-rounded-md sg-text-sm sg-font-medium sg-transition-colors focus-visible:sg-outline-none focus-visible:ring-offset-2 focus-visible:sg-ring-2 focus-visible:sg-ring-ring disabled:sg-pointer-events-none disabled:sg-opacity-50 [&_svg]:sg-pointer-events-none [&_svg]:sg-size-4 [&_svg]:sg-shrink-0\",\n {\n variants: {\n variant: {\n primary:\n \"sg-bg-orange sg-text-orange-foreground sg-shadow hover:sg-bg-orange/90\",\n secondary:\n \"sg-bg-purple sg-text-purple-foreground sg-shadow-sm hover:sg-bg-purple/90\",\n destructive:\n \"sg-bg-red sg-text-red-foreground sg-shadow-sm hover:sg-bg-red/90\",\n outline:\n \"sg-border sg-border-orange sg-bg-white sg-shadow-sm hover:sg-bg-gray/20\",\n ghost: \"hover:sg-bg-accent hover:sg-text-accent-foreground\",\n link: \"sg-text-primary sg-underline-offset-4 hover:sg-underline\",\n },\n size: {\n default: \"sg-h-9 sg-px-4 sg-py-2\",\n sm: \"sg-h-8 sg-rounded-md sg-px-3 sg-text-xs\",\n lg: \"sg-h-10 sg-rounded-md sg-px-8\",\n icon: \"sg-h-9 sg-w-9\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"default\",\n },\n }\n);\n\nexport interface ButtonProps\n extends OmitClassProperty<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"className\"\n >,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n className?: TailwindMarginClass;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../../utils\";\nimport { OmitClassProperty, TailwindMarginClass } from \"../../../lib/types\";\nimport { Layout } from \"../layout/layout\";\n\nconst badgeVariants = cva(\n \"sg-inline-flex sg-items-center sg-rounded-md sg-border sg-px-2.5 sg-py-0.5 sg-text-xs sg-font-semibold sg-transition-colors focus:sg-outline-none focus:sg-ring-2 focus:sg-ring-ring focus:sg-ring-offset-2\",\n {\n variants: {\n variant: {\n default:\n \"sg-border-transparent sg-bg-orange sg-text-orange-foreground sg-shadow hover:sg-bg-orange/80\",\n purple:\n \"sg-border-transparent sg-bg-purple sg-text-purple-foreground sg-shadow hover:sg-bg-purple/80\",\n green:\n \"sg-border-transparent sg-bg-green sg-text-green-foreground sg-shadow hover:sg-bg-green/80\",\n outline: \"sg-text-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n);\n\nexport interface BadgeProps\n extends OmitClassProperty<React.HTMLAttributes<HTMLDivElement>, \"className\">,\n VariantProps<typeof badgeVariants> {\n className?: TailwindMarginClass;\n}\n\nfunction Badge({ className, variant, ...props }: BadgeProps) {\n return (\n <>\n <div className={cn(badgeVariants({ variant }), className)} {...props} />\n {/* <Layout variant={\"100\"}> */}\n <Layout variant={\"66-33\"}>\n <Layout.Col1>Col1</Layout.Col1>\n <Layout.Col2>Col2</Layout.Col2>\n </Layout>\n </>\n );\n}\n\nexport { Badge, badgeVariants };\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../../utils\";\nimport { OmitClassProperty, TailwindMarginClass } from \"../../../lib/types\";\nimport { PropsWithChildren } from \"react\";\n\nconst layoutVariants = cva(\"sg-grid sg-gap-4 \", {\n variants: {\n variant: {\n \"100\": \"sg-grid-cols-1\",\n \"66-33\": \"sg-grid-cols-1 md:sg-grid-cols-2\",\n \"50-50\": \"sg-grid-cols-1 md:sg-grid-cols-2\",\n \"33-33-33\": \"sg-grid-cols-1 md:sg-grid-cols-2\",\n \"25-25-25-25\": \"sg-grid-cols-1 md:sg-grid-cols-2\",\n },\n },\n defaultVariants: {\n variant: \"100\",\n },\n});\n\nexport interface LayoutProps\n extends OmitClassProperty<React.HTMLAttributes<HTMLDivElement>, \"className\">,\n VariantProps<typeof layoutVariants> {\n fullWidth?: boolean;\n className?: TailwindMarginClass;\n}\n\nfunction Layout({\n children,\n className,\n variant = \"100\",\n ...props\n}: PropsWithChildren<LayoutProps>) {\n const allowedInLayout = (\n content: React.ReactElement<any, string | React.JSXElementConstructor<any>>\n ): boolean => {\n if (content.type === Layout.Col1) {\n return true;\n } else if (\n content.type === Layout.Col2 &&\n (variant === \"66-33\" || variant === \"50-50\")\n ) {\n return true;\n } else if (\n content.type === Layout.Col3 &&\n (variant === \"33-33-33\" || variant === \"25-25-25-25\")\n ) {\n return true;\n } else if (content.type === Layout.Col4 && variant === \"25-25-25-25\") {\n return true;\n }\n\n console.error(\"Content not allowed in column for layout\", content.type);\n return false;\n };\n\n const renderColumn = (\n content: React.ReactElement<any, string | React.JSXElementConstructor<any>>\n ) => {\n if (!allowedInLayout(content)) {\n return;\n }\n console.log(\"content\", content);\n return <div>{content}</div>;\n };\n\n return (\n <div className=\"sg-mx-auto sg-max-w-[960px]\">\n <div className={cn(layoutVariants({ variant }), className)} {...props}>\n {React.Children.map(children, (child) =>\n React.isValidElement(child) ? renderColumn(child) : <></>\n )}\n </div>\n </div>\n );\n}\n\ntype colProp = {\n children: React.ReactNode;\n};\n\nfunction Col({ children }: colProp) {\n return <>{children}</>;\n}\n\nLayout.Col1 = Col;\nLayout.Col2 = Col;\nLayout.Col3 = Col;\nLayout.Col4 = Col;\n\nexport { Layout, layoutVariants };\n"],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,qBAAqB,eAAe;AAGtC,SAAS,MAAM,QAAsB;AAC1C,QAAM,oBAAoB,oBAAoB;AAAA,IAC5C,QAAQ;AAAA,EACV,CAAC;AAED,SAAO,kBAAkB,QAAQ,KAAK,MAAM,CAAC,CAAC;AAChD;;;ACFI;AAFG,IAAM,OAAO,CAAC,EAAE,KAAK,MAAa;AACvC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;AChBA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AAgDjC,gBAAAA,YAAA;AA5CN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAA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AAA,IAEtE,qBAAC,UAAO,SAAS,SACf;AAAA,sBAAAA,KAAC,OAAO,MAAP,EAAY,kBAAI;AAAA,MACjB,gBAAAA,KAAC,OAAO,MAAP,EAAY,kBAAI;AAAA,OACnB;AAAA,KACF;AAEJ;","names":["jsx","cva","React","cva","jsx","cva","Fragment","jsx","cva"]}
|
package/package.json
CHANGED
|
@@ -1,49 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "singularity-components",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.53",
|
|
4
|
+
"main": "./dist/main.js",
|
|
5
|
+
"module": "./dist/main.mjs",
|
|
6
|
+
"types": "./dist/main.d.ts",
|
|
5
7
|
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
8
|
"files": [
|
|
10
9
|
"dist"
|
|
11
10
|
],
|
|
12
11
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"lint": "eslint .",
|
|
16
|
-
"preview": "vite preview",
|
|
17
|
-
"prepublishOnly": "npm run build"
|
|
18
|
-
},
|
|
19
|
-
"peerDependencies": {
|
|
20
|
-
"react": "^18.0.0",
|
|
21
|
-
"react-dom": "^18.0.0"
|
|
12
|
+
"build": "tsup",
|
|
13
|
+
"storybook": "storybook dev -p 6006 --no-open"
|
|
22
14
|
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"test"
|
|
17
|
+
],
|
|
18
|
+
"author": "Filip",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"description": "",
|
|
23
21
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
22
|
+
"@radix-ui/react-slot": "^1.1.1",
|
|
23
|
+
"class-variance-authority": "^0.7.1",
|
|
24
|
+
"clsx": "^2.1.1",
|
|
25
|
+
"lucide-react": "^0.468.0",
|
|
26
|
+
"react": "^19.0.0",
|
|
27
|
+
"react-dom": "^19.0.0",
|
|
28
|
+
"tailwind-merge": "^2.5.5",
|
|
28
29
|
"tailwindcss-animate": "^1.0.7"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
32
|
+
"@chromatic-com/storybook": "^3.2.2",
|
|
33
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
34
|
+
"@storybook/addon-interactions": "^8.4.7",
|
|
35
|
+
"@storybook/addon-links": "^8.4.7",
|
|
36
|
+
"@storybook/addon-onboarding": "^8.4.7",
|
|
37
|
+
"@storybook/blocks": "^8.4.7",
|
|
38
|
+
"@storybook/react": "^8.4.7",
|
|
39
|
+
"@storybook/react-vite": "^8.4.7",
|
|
40
|
+
"@storybook/test": "^8.4.7",
|
|
41
|
+
"@types/react": "^19.0.1",
|
|
42
|
+
"@types/react-dom": "^19.0.2",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.18.0",
|
|
45
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
46
|
+
"autoprefixer": "^10.4.20",
|
|
47
|
+
"eslint": "^9.17.0",
|
|
48
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
49
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
50
|
+
"eslint-plugin-storybook": "^0.11.1",
|
|
51
|
+
"postcss": "^8.4.49",
|
|
52
|
+
"postcss-import": "^16.1.0",
|
|
53
|
+
"storybook": "^8.4.7",
|
|
54
|
+
"tailwindcss": "^3.4.16",
|
|
55
|
+
"tsup": "^8.3.5",
|
|
56
|
+
"typescript": "^5.7.2",
|
|
57
|
+
"vite": "^6.0.3",
|
|
58
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
48
59
|
}
|
|
49
60
|
}
|
package/dist/App.d.ts
DELETED
package/dist/index.d.ts
DELETED