@atlas-art/ui-react 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlas-art/ui-react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -18,7 +18,9 @@
18
18
  }
19
19
  },
20
20
  "files": [
21
- "dist"
21
+ "dist",
22
+ "src",
23
+ "README.md"
22
24
  ],
23
25
  "publishConfig": {
24
26
  "access": "public"
@@ -35,7 +37,7 @@
35
37
  },
36
38
  "dependencies": {
37
39
  "class-variance-authority": "^0.7.1",
38
- "@atlas-art/ui-core": "0.1.0"
40
+ "@atlas-art/ui-core": "0.1.1"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@types/react": "^19.2.14",
@@ -0,0 +1,34 @@
1
+ import { cva, type VariantProps } from "class-variance-authority";
2
+ import { forwardRef } from "react";
3
+ import { Link, type LinkProps } from "react-router";
4
+ import { cn } from "@atlas-art/ui-core";
5
+
6
+ const appLinkVariants = cva("transition", {
7
+ variants: {
8
+ variant: {
9
+ primary: "font-medium text-(--app-active-text) hover:underline",
10
+ muted: "text-sm text-(--app-muted-text) hover:text-(--app-text)",
11
+ },
12
+ },
13
+ defaultVariants: {
14
+ variant: "primary",
15
+ },
16
+ });
17
+
18
+ export interface AppLinkProps
19
+ extends LinkProps,
20
+ VariantProps<typeof appLinkVariants> {
21
+ className?: string;
22
+ }
23
+
24
+ export const AppLink = forwardRef<HTMLAnchorElement, AppLinkProps>(
25
+ ({ className, variant, ...props }, ref) => (
26
+ <Link
27
+ ref={ref}
28
+ className={cn(appLinkVariants({ variant }), className)}
29
+ {...props}
30
+ />
31
+ ),
32
+ );
33
+
34
+ AppLink.displayName = "AppLink";
@@ -0,0 +1 @@
1
+ export * from "./app-link";
@@ -0,0 +1,18 @@
1
+ import type { Ref } from "react";
2
+
3
+ function setRef<T>(ref: Ref<T> | undefined, value: T) {
4
+ if (typeof ref === "function") {
5
+ ref(value);
6
+ return;
7
+ }
8
+
9
+ if (ref && typeof ref === "object") {
10
+ (ref as { current: T }).current = value;
11
+ }
12
+ }
13
+
14
+ export function composeRefs<T>(...refs: Array<Ref<T> | undefined>) {
15
+ return (node: T) => {
16
+ refs.forEach((ref) => setRef(ref, node));
17
+ };
18
+ }
@@ -0,0 +1 @@
1
+ export * from "./ui";
@@ -0,0 +1,22 @@
1
+ import { forwardRef, type ButtonHTMLAttributes } from "react";
2
+ import { buttonVariants, type ButtonVariantProps } from "@atlas-art/ui-core";
3
+ import { cn } from "@atlas-art/ui-core";
4
+
5
+ export interface ButtonProps
6
+ extends ButtonHTMLAttributes<HTMLButtonElement>,
7
+ ButtonVariantProps {}
8
+
9
+ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
10
+ ({ className, variant, size, fullWidth, type = "button", ...props }, ref) => {
11
+ return (
12
+ <button
13
+ ref={ref}
14
+ type={type}
15
+ className={cn(buttonVariants({ variant, size, fullWidth }), className)}
16
+ {...props}
17
+ />
18
+ );
19
+ },
20
+ );
21
+
22
+ Button.displayName = "Button";
@@ -0,0 +1,54 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import { cardVariants, type CardVariantProps } from "@atlas-art/ui-core";
3
+ import { cn } from "@atlas-art/ui-core";
4
+
5
+ export interface CardProps
6
+ extends HTMLAttributes<HTMLDivElement>,
7
+ CardVariantProps {}
8
+
9
+ export const Card = forwardRef<HTMLDivElement, CardProps>(
10
+ ({ className, padding, shadow, ...props }, ref) => (
11
+ <div
12
+ ref={ref}
13
+ className={cn(cardVariants({ padding, shadow }), className)}
14
+ {...props}
15
+ />
16
+ ),
17
+ );
18
+ Card.displayName = "Card";
19
+
20
+ export const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
21
+ ({ className, ...props }, ref) => (
22
+ <div ref={ref} className={cn("mb-3 flex flex-col gap-1.5", className)} {...props} />
23
+ ),
24
+ );
25
+ CardHeader.displayName = "CardHeader";
26
+
27
+ export const CardTitle = forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement>>(
28
+ ({ className, ...props }, ref) => (
29
+ <h3 ref={ref} className={cn("text-base font-semibold", className)} {...props} />
30
+ ),
31
+ );
32
+ CardTitle.displayName = "CardTitle";
33
+
34
+ export const CardDescription = forwardRef<
35
+ HTMLParagraphElement,
36
+ HTMLAttributes<HTMLParagraphElement>
37
+ >(({ className, ...props }, ref) => (
38
+ <p ref={ref} className={cn("text-sm text-(--app-muted-text)", className)} {...props} />
39
+ ));
40
+ CardDescription.displayName = "CardDescription";
41
+
42
+ export const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
43
+ ({ className, ...props }, ref) => (
44
+ <div ref={ref} className={cn("space-y-3", className)} {...props} />
45
+ ),
46
+ );
47
+ CardContent.displayName = "CardContent";
48
+
49
+ export const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
50
+ ({ className, ...props }, ref) => (
51
+ <div ref={ref} className={cn("mt-4 flex items-center gap-2", className)} {...props} />
52
+ ),
53
+ );
54
+ CardFooter.displayName = "CardFooter";
@@ -0,0 +1,36 @@
1
+ import {
2
+ createContext,
3
+ type HTMLAttributes,
4
+ type LabelHTMLAttributes,
5
+ } from "react";
6
+ import {
7
+ errorVariants,
8
+ fieldVariants,
9
+ labelVariants,
10
+ } from "@atlas-art/ui-core";
11
+ import { cn } from "@atlas-art/ui-core";
12
+
13
+ interface FormFieldContextValue {
14
+ hasError: boolean;
15
+ }
16
+
17
+ const FormFieldContext = createContext<FormFieldContextValue>({ hasError: false });
18
+
19
+ export interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {
20
+ error?: string;
21
+ }
22
+
23
+ export function FormField({ className, error, children, ...props }: FormFieldProps) {
24
+ return (
25
+ <FormFieldContext.Provider value={{ hasError: Boolean(error) }}>
26
+ <div className={cn(fieldVariants(), className)} {...props}>
27
+ {children}
28
+ {error ? <p className={errorVariants()}>{error}</p> : null}
29
+ </div>
30
+ </FormFieldContext.Provider>
31
+ );
32
+ }
33
+
34
+ export function FormFieldLabel({ className, ...props }: LabelHTMLAttributes<HTMLLabelElement>) {
35
+ return <label className={cn(labelVariants(), className)} {...props} />;
36
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./button";
2
+ export * from "./input";
3
+ export * from "./card";
4
+ export * from "./form-field";
5
+ export * from "./typography";
6
+ export * from "./split-card";
7
+ export * from "./stack";
@@ -0,0 +1,21 @@
1
+ import { forwardRef, type InputHTMLAttributes } from "react";
2
+ import { inputVariants, type InputVariantProps } from "@atlas-art/ui-core";
3
+ import { cn } from "@atlas-art/ui-core";
4
+
5
+ export interface InputProps
6
+ extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">,
7
+ InputVariantProps {}
8
+
9
+ export const Input = forwardRef<HTMLInputElement, InputProps>(
10
+ ({ className, size, state, ...props }, ref) => {
11
+ return (
12
+ <input
13
+ ref={ref}
14
+ className={cn(inputVariants({ size, state }), className)}
15
+ {...props}
16
+ />
17
+ );
18
+ },
19
+ );
20
+
21
+ Input.displayName = "Input";
@@ -0,0 +1,47 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import {
3
+ splitCardAsideVariants,
4
+ splitCardMainVariants,
5
+ splitCardVariants,
6
+ type SplitCardVariantProps,
7
+ } from "@atlas-art/ui-core";
8
+ import { cn } from "@atlas-art/ui-core";
9
+
10
+ export interface SplitCardProps
11
+ extends HTMLAttributes<HTMLDivElement>,
12
+ SplitCardVariantProps {}
13
+
14
+ export const SplitCard = forwardRef<HTMLDivElement, SplitCardProps>(
15
+ ({ className, columns, ...props }, ref) => (
16
+ <div ref={ref} className={cn(splitCardVariants({ columns }), className)} {...props} />
17
+ ),
18
+ );
19
+ SplitCard.displayName = "SplitCard";
20
+
21
+ export const SplitCardAside = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
22
+ ({ className, ...props }, ref) => (
23
+ <section ref={ref} className={cn(splitCardAsideVariants(), className)} {...props} />
24
+ ),
25
+ );
26
+ SplitCardAside.displayName = "SplitCardAside";
27
+
28
+ export const SplitCardMain = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
29
+ ({ className, ...props }, ref) => (
30
+ <section ref={ref} className={cn(splitCardMainVariants(), className)} {...props} />
31
+ ),
32
+ );
33
+ SplitCardMain.displayName = "SplitCardMain";
34
+
35
+ export const SplitCardDecoration = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
36
+ ({ className, ...props }, ref) => (
37
+ <div
38
+ ref={ref}
39
+ className={cn(
40
+ "pointer-events-none absolute -bottom-14 -right-14 h-44 w-44 rounded-full border border-(--app-border)",
41
+ className,
42
+ )}
43
+ {...props}
44
+ />
45
+ ),
46
+ );
47
+ SplitCardDecoration.displayName = "SplitCardDecoration";
@@ -0,0 +1,18 @@
1
+ import { forwardRef, type HTMLAttributes } from "react";
2
+ import { stackVariants, type StackVariantProps } from "@atlas-art/ui-core";
3
+ import { cn } from "@atlas-art/ui-core";
4
+
5
+ export interface StackProps
6
+ extends HTMLAttributes<HTMLDivElement>, StackVariantProps {}
7
+
8
+ export const Stack = forwardRef<HTMLDivElement, StackProps>(
9
+ ({ className, gap, ...props }, ref) => (
10
+ <div
11
+ ref={ref}
12
+ className={cn(stackVariants({ gap }), className)}
13
+ {...props}
14
+ />
15
+ ),
16
+ );
17
+
18
+ Stack.displayName = "Stack";
@@ -0,0 +1,16 @@
1
+ import { type ElementType, type HTMLAttributes } from "react";
2
+ import { textVariants, type TextVariantProps } from "@atlas-art/ui-core";
3
+ import { cn } from "@atlas-art/ui-core";
4
+
5
+ type TypographyElement = ElementType;
6
+
7
+ export interface TextProps
8
+ extends HTMLAttributes<HTMLElement>,
9
+ TextVariantProps {
10
+ as?: TypographyElement;
11
+ }
12
+
13
+ export function Text({ as, className, variant, ...props }: TextProps) {
14
+ const Component = as ?? "p";
15
+ return <Component className={cn(textVariants({ variant }), className)} {...props} />;
16
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./components";