@oppulence/design-system 1.0.3 → 1.0.5
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/hooks/use-resize-observer.ts +24 -0
- package/lib/ai.ts +31 -0
- package/package.json +19 -1
- package/src/components/atoms/animated-size-container.tsx +59 -0
- package/src/components/atoms/button.tsx +2 -0
- package/src/components/atoms/currency-input.tsx +16 -0
- package/src/components/atoms/icons.tsx +840 -0
- package/src/components/atoms/image.tsx +23 -0
- package/src/components/atoms/index.ts +10 -0
- package/src/components/atoms/loader.tsx +92 -0
- package/src/components/atoms/quantity-input.tsx +103 -0
- package/src/components/atoms/record-button.tsx +178 -0
- package/src/components/atoms/submit-button.tsx +26 -0
- package/src/components/atoms/text-effect.tsx +251 -0
- package/src/components/atoms/text-shimmer.tsx +74 -0
- package/src/components/molecules/actions.tsx +53 -0
- package/src/components/molecules/branch.tsx +192 -0
- package/src/components/molecules/code-block.tsx +151 -0
- package/src/components/molecules/form.tsx +177 -0
- package/src/components/molecules/index.ts +12 -0
- package/src/components/molecules/inline-citation.tsx +295 -0
- package/src/components/molecules/message.tsx +64 -0
- package/src/components/molecules/sources.tsx +116 -0
- package/src/components/molecules/suggestion.tsx +53 -0
- package/src/components/molecules/task.tsx +74 -0
- package/src/components/molecules/time-range-input.tsx +73 -0
- package/src/components/molecules/tool-call-indicator.tsx +42 -0
- package/src/components/molecules/tool.tsx +130 -0
- package/src/components/organisms/combobox-dropdown.tsx +171 -0
- package/src/components/organisms/conversation.tsx +98 -0
- package/src/components/organisms/date-range-picker.tsx +53 -0
- package/src/components/organisms/editor/extentions/bubble-menu/bubble-item.tsx +30 -0
- package/src/components/organisms/editor/extentions/bubble-menu/bubble-menu-button.tsx +27 -0
- package/src/components/organisms/editor/extentions/bubble-menu/index.tsx +63 -0
- package/src/components/organisms/editor/extentions/bubble-menu/link-item.tsx +104 -0
- package/src/components/organisms/editor/extentions/register.ts +22 -0
- package/src/components/organisms/editor/index.tsx +50 -0
- package/src/components/organisms/editor/styles.css +31 -0
- package/src/components/organisms/editor/utils.ts +19 -0
- package/src/components/organisms/index.ts +11 -0
- package/src/components/organisms/multiple-selector.tsx +632 -0
- package/src/components/organisms/prompt-input.tsx +747 -0
- package/src/components/organisms/reasoning.tsx +170 -0
- package/src/components/organisms/response.tsx +121 -0
- package/src/components/organisms/toast-toaster.tsx +84 -0
- package/src/components/organisms/toast.tsx +124 -0
- package/src/components/organisms/use-toast.tsx +206 -0
- package/src/styles/globals.css +169 -212
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type RefObject, useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export function useResizeObserver(
|
|
4
|
+
elementRef: RefObject<Element>,
|
|
5
|
+
): ResizeObserverEntry | undefined {
|
|
6
|
+
const [entry, setEntry] = useState<ResizeObserverEntry>();
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const node = elementRef?.current;
|
|
10
|
+
if (!node) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
15
|
+
setEntry(entry);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
observer.observe(node);
|
|
19
|
+
|
|
20
|
+
return () => observer.disconnect();
|
|
21
|
+
}, [elementRef]);
|
|
22
|
+
|
|
23
|
+
return entry;
|
|
24
|
+
}
|
package/lib/ai.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ChatRole = "assistant" | "user" | "system" | "tool";
|
|
2
|
+
|
|
3
|
+
export type ChatStatus = "idle" | "submitted" | "streaming" | "error";
|
|
4
|
+
|
|
5
|
+
export type FileUIPart = {
|
|
6
|
+
type: "file";
|
|
7
|
+
url?: string;
|
|
8
|
+
mediaType?: string;
|
|
9
|
+
filename?: string;
|
|
10
|
+
data?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ToolState =
|
|
14
|
+
| "input-streaming"
|
|
15
|
+
| "input-available"
|
|
16
|
+
| "output-available"
|
|
17
|
+
| "output-error";
|
|
18
|
+
|
|
19
|
+
export type ToolUIPart = {
|
|
20
|
+
type: string;
|
|
21
|
+
state: ToolState;
|
|
22
|
+
input?: unknown;
|
|
23
|
+
output?: unknown;
|
|
24
|
+
errorText?: string | null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type GeneratedImage = {
|
|
28
|
+
base64: string;
|
|
29
|
+
mediaType: string;
|
|
30
|
+
uint8Array?: Uint8Array;
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oppulence/design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Design system for Oppulence - shadcn-style components with Tailwind CSS v4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -68,21 +68,39 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@base-ui/react": "^1.0.0",
|
|
70
70
|
"@fontsource-variable/plus-jakarta-sans": "^5.2.8",
|
|
71
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
72
|
+
"@radix-ui/react-slot": "^1.2.3",
|
|
73
|
+
"@radix-ui/react-toast": "^1.2.14",
|
|
74
|
+
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
75
|
+
"@tiptap/extension-link": "^2.12.0",
|
|
76
|
+
"@tiptap/extension-placeholder": "^2.12.0",
|
|
77
|
+
"@tiptap/extension-underline": "^2.12.0",
|
|
78
|
+
"@tiptap/pm": "^2.12.0",
|
|
79
|
+
"@tiptap/react": "^2.12.0",
|
|
80
|
+
"@tiptap/starter-kit": "^2.12.0",
|
|
71
81
|
"class-variance-authority": "^0.7.1",
|
|
72
82
|
"clsx": "^2.1.1",
|
|
73
83
|
"cmdk": "^1.1.1",
|
|
74
84
|
"date-fns": "^4.1.0",
|
|
75
85
|
"embla-carousel-react": "^8.6.0",
|
|
86
|
+
"framer-motion": "^12.23.25",
|
|
76
87
|
"input-otp": "^1.4.2",
|
|
77
88
|
"lucide-react": "^0.562.0",
|
|
78
89
|
"next-themes": "^0.4.6",
|
|
79
90
|
"react-day-picker": "^9.13.0",
|
|
91
|
+
"react-hook-form": "^7.70.0",
|
|
92
|
+
"react-icons": "^5.5.0",
|
|
93
|
+
"react-number-format": "^5.4.4",
|
|
80
94
|
"react-resizable-panels": "^4.2.0",
|
|
95
|
+
"react-syntax-highlighter": "^15.6.6",
|
|
81
96
|
"recharts": "2.15.4",
|
|
82
97
|
"shadcn": "^3.6.2",
|
|
83
98
|
"sonner": "^2.0.7",
|
|
99
|
+
"streamdown": "1.2.0",
|
|
84
100
|
"tailwind-merge": "^3.4.0",
|
|
101
|
+
"tippy.js": "^6.3.7",
|
|
85
102
|
"tw-animate-css": "^1.4.0",
|
|
103
|
+
"use-stick-to-bottom": "^1.1.1",
|
|
86
104
|
"vaul": "^1.1.2"
|
|
87
105
|
},
|
|
88
106
|
"peerDependencies": {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { motion } from "framer-motion";
|
|
4
|
+
import {
|
|
5
|
+
type ComponentPropsWithoutRef,
|
|
6
|
+
type PropsWithChildren,
|
|
7
|
+
type RefObject,
|
|
8
|
+
forwardRef,
|
|
9
|
+
useRef,
|
|
10
|
+
} from "react";
|
|
11
|
+
|
|
12
|
+
import { useResizeObserver } from "../../../hooks/use-resize-observer";
|
|
13
|
+
import { cn } from "../../../lib/utils";
|
|
14
|
+
|
|
15
|
+
type AnimatedSizeContainerProps = PropsWithChildren<{
|
|
16
|
+
width?: boolean;
|
|
17
|
+
height?: boolean;
|
|
18
|
+
}> &
|
|
19
|
+
Omit<ComponentPropsWithoutRef<typeof motion.div>, "animate" | "children" | "className">;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A container with animated width and height (each optional) based on children dimensions.
|
|
23
|
+
*/
|
|
24
|
+
const AnimatedSizeContainer = forwardRef<
|
|
25
|
+
HTMLDivElement,
|
|
26
|
+
AnimatedSizeContainerProps
|
|
27
|
+
>(({ width = false, height = false, transition, children, ...rest }, ref) => {
|
|
28
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
29
|
+
const resizeObserverEntry = useResizeObserver(containerRef as RefObject<Element>);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<motion.div
|
|
33
|
+
ref={ref}
|
|
34
|
+
className="overflow-hidden"
|
|
35
|
+
animate={{
|
|
36
|
+
width: width
|
|
37
|
+
? (resizeObserverEntry?.contentRect?.width ?? "auto")
|
|
38
|
+
: "auto",
|
|
39
|
+
height: height
|
|
40
|
+
? (resizeObserverEntry?.contentRect?.height ?? "auto")
|
|
41
|
+
: "auto",
|
|
42
|
+
}}
|
|
43
|
+
transition={transition ?? { type: "spring", duration: 0.3 }}
|
|
44
|
+
{...rest}
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
ref={containerRef}
|
|
48
|
+
className={cn(height && "h-max", width && "w-max")}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
</motion.div>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
AnimatedSizeContainer.displayName = "AnimatedSizeContainer";
|
|
57
|
+
|
|
58
|
+
export { AnimatedSizeContainer };
|
|
59
|
+
export type { AnimatedSizeContainerProps };
|
|
@@ -76,6 +76,8 @@ type ButtonProps = Omit<ButtonPrimitive.Props, "className"> &
|
|
|
76
76
|
iconLeft?: React.ReactNode;
|
|
77
77
|
/** Icon to show on the right side of the button */
|
|
78
78
|
iconRight?: React.ReactNode;
|
|
79
|
+
/** HTML button type attribute */
|
|
80
|
+
type?: "button" | "submit" | "reset";
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NumericFormat, type NumericFormatProps } from "react-number-format";
|
|
2
|
+
|
|
3
|
+
import { Input } from "./input";
|
|
4
|
+
|
|
5
|
+
export function CurrencyInput({
|
|
6
|
+
thousandSeparator = true,
|
|
7
|
+
...props
|
|
8
|
+
}: Omit<NumericFormatProps, "className">) {
|
|
9
|
+
return (
|
|
10
|
+
<NumericFormat
|
|
11
|
+
thousandSeparator={thousandSeparator}
|
|
12
|
+
customInput={Input}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|