@skiddph/prui 0.3.0 → 0.4.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.
@@ -1,14 +1,19 @@
1
1
  import { PropsMeta } from './props-meta';
2
+ import { SurfaceProps } from './surface';
2
3
  import * as React from "react";
3
- export type ButtonVariant = "primary" | "default" | "ghost" | "danger";
4
+ export type ButtonVariant = "primary" | "default" | "ghost" | "danger" | "outline" | "soft" | "link";
4
5
  export type ButtonSize = "sm" | "md" | "lg" | "icon";
5
- export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, SurfaceProps {
6
7
  variant?: ButtonVariant;
7
8
  size?: ButtonSize;
8
9
  /** Render the single child instead of a button element. */
9
10
  asChild?: boolean;
10
11
  /** Show a spinner and disable the button. */
11
12
  loading?: boolean;
13
+ /** Strip the skin: keep structure and behavior, style it yourself. */
14
+ unstyled?: boolean;
15
+ /** Stretch to the parent's full width. */
16
+ fullWidth?: boolean;
12
17
  }
13
18
  export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
14
19
  export declare const buttonPropsMeta: PropsMeta;
@@ -1,58 +1,71 @@
1
- import { jsx as r, jsxs as b, Fragment as g } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { Loader2 as h } from "lucide-react";
1
+ import { jsx as n, jsxs as j, Fragment as B } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { Loader2 as R } from "lucide-react";
4
4
  import { cn as i } from "./cn.js";
5
- const v = {
6
- primary: "bg-[var(--prui-brand)] text-[var(--prui-brand-fg)] hover:brightness-110 active:brightness-95",
7
- default: "bg-[var(--prui-raise)] text-[var(--prui-fg)] border border-[var(--prui-line)] hover:border-[var(--prui-dim)]",
8
- ghost: "bg-transparent text-[var(--prui-fg)] hover:bg-[var(--prui-raise)]",
9
- danger: "bg-[var(--prui-danger)] text-white hover:brightness-110 active:brightness-95"
10
- }, x = {
5
+ import { resolveSurface as z, withSurface as E } from "./surface.js";
6
+ const F = {
7
+ primary: "bg-[var(--prui-s-bg,var(--prui-brand))] text-[var(--prui-s-fg,var(--prui-brand-fg))] hover:brightness-110 active:brightness-95",
8
+ default: "bg-[var(--prui-s-bg,var(--prui-raise))] text-[var(--prui-s-fg,var(--prui-fg))] border border-[var(--prui-line)] hover:border-[var(--prui-dim)]",
9
+ ghost: "bg-[var(--prui-s-bg,transparent)] text-[var(--prui-s-fg,var(--prui-fg))] hover:bg-[var(--prui-raise)]",
10
+ danger: "bg-[var(--prui-s-bg,var(--prui-danger))] text-[var(--prui-s-fg,#fff)] hover:brightness-110 active:brightness-95",
11
+ outline: "bg-[var(--prui-s-bg,transparent)] text-[var(--prui-s-fg,var(--prui-brand))] border border-[var(--prui-s-border,var(--prui-brand))] hover:bg-[var(--prui-brand)]/10",
12
+ soft: "bg-[var(--prui-brand)]/12 text-[var(--prui-s-fg,var(--prui-brand))] hover:bg-[var(--prui-brand)]/20",
13
+ link: "bg-transparent text-[var(--prui-s-fg,var(--prui-brand))] underline-offset-4 hover:underline p-0"
14
+ }, L = {
11
15
  sm: "h-7 px-2.5 text-xs gap-1.5",
12
16
  md: "h-9 px-3.5 text-sm gap-2",
13
17
  lg: "h-11 px-5 text-base gap-2",
14
18
  icon: "h-9 w-9 p-0"
15
- }, y = n.forwardRef(
16
- ({ className: d, variant: p = "default", size: c = "md", asChild: u = !1, loading: e = !1, disabled: m, children: t, ...o }, f) => {
17
- const s = i(
19
+ }, M = o.forwardRef(
20
+ ({ className: u, style: d, variant: p = "default", size: f = "md", asChild: c = !1, loading: e = !1, disabled: m, unstyled: b, fullWidth: g, bg: v, fg: h, radius: x, texture: y, textureColor: N, elevation: w, children: r, ...s }, S) => {
21
+ const C = z({ bg: v, fg: h, radius: x, texture: y, textureColor: N, elevation: w }), k = i(
18
22
  "prui-button inline-flex items-center justify-center whitespace-nowrap font-medium select-none",
19
23
  "transition-[filter,background-color,border-color] duration-150 outline-none cursor-pointer",
20
24
  "focus-visible:ring-2 focus-visible:ring-[var(--prui-brand)] focus-visible:ring-offset-1",
21
25
  "disabled:pointer-events-none disabled:opacity-50",
22
- v[p],
23
- x[c],
24
- d
25
- );
26
- if (u && n.isValidElement(t)) {
27
- const a = t;
28
- return n.cloneElement(a, {
29
- className: i(s, a.props.className),
30
- ...o,
31
- children: e ? /* @__PURE__ */ r(l, {}) : a.props.children
26
+ g && "w-full",
27
+ "rounded-[var(--prui-s-radius,var(--prui-radius))]",
28
+ b ? [] : [F[p], L[f]],
29
+ u
30
+ ), t = E(k, d, C);
31
+ if (c && o.isValidElement(r)) {
32
+ const a = r;
33
+ return o.cloneElement(a, {
34
+ className: i(t.className, a.props.className),
35
+ style: { ...t.style ?? {}, ...a.props.style },
36
+ ...s,
37
+ children: e ? /* @__PURE__ */ n(l, {}) : a.props.children
32
38
  });
33
39
  }
34
- return /* @__PURE__ */ r("button", { ref: f, className: s, disabled: m || e, "data-loading": e || void 0, ...o, children: e ? /* @__PURE__ */ b(g, { children: [
35
- /* @__PURE__ */ r(l, {}),
36
- t
37
- ] }) : t });
40
+ return /* @__PURE__ */ n("button", { ref: S, className: t.className, style: t.style, disabled: m || e, "data-loading": e || void 0, ...s, children: e ? /* @__PURE__ */ j(B, { children: [
41
+ /* @__PURE__ */ n(l, {}),
42
+ r
43
+ ] }) : r });
38
44
  }
39
45
  );
40
- y.displayName = "Button";
46
+ M.displayName = "Button";
41
47
  function l() {
42
- return /* @__PURE__ */ r(h, { className: "h-4 w-4 animate-spin", "aria-hidden": !0 });
48
+ return /* @__PURE__ */ n(R, { className: "h-4 w-4 animate-spin", "aria-hidden": !0 });
43
49
  }
44
- const B = {
50
+ const A = {
45
51
  name: "Button",
46
52
  props: [
47
- { name: "variant", type: "'primary' | 'default' | 'ghost' | 'danger'", default: "'default'", control: "select", options: ["primary", "default", "ghost", "danger"] },
53
+ { name: "variant", type: "'primary' | 'default' | 'ghost' | 'danger' | 'outline' | 'soft' | 'link'", default: "'default'", control: "select", options: ["primary", "default", "ghost", "danger", "outline", "soft", "link"] },
48
54
  { name: "size", type: "'sm' | 'md' | 'lg' | 'icon'", default: "'md'", control: "select", options: ["sm", "md", "lg", "icon"] },
49
55
  { name: "asChild", type: "boolean", default: "false", control: "boolean" },
50
56
  { name: "loading", type: "boolean", default: "false", control: "boolean" },
51
57
  { name: "disabled", type: "boolean", default: "false", control: "boolean" },
58
+ { name: "unstyled", type: "boolean", default: "false", control: "boolean" },
59
+ { name: "fullWidth", type: "boolean", default: "false", control: "boolean" },
60
+ { name: "bg", type: "string (CSS color or var)", default: "theme default", control: "text" },
61
+ { name: "fg", type: "string (CSS color)", default: "theme default", control: "text" },
62
+ { name: "radius", type: "'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | length", default: "var(--prui-radius)", control: "text" },
63
+ { name: "texture", type: "'none' | 'dots' | 'grid' | 'stripes' | 'diagonal'", default: "'none'", control: "select", options: ["none", "dots", "grid", "stripes", "diagonal"] },
64
+ { name: "elevation", type: "'none' | 'sm' | 'md' | 'lg'", default: "'none'", control: "select", options: ["none", "sm", "md", "lg"] },
52
65
  { name: "children", type: "ReactNode", default: null, control: "text" }
53
66
  ]
54
67
  };
55
68
  export {
56
- y as Button,
57
- B as buttonPropsMeta
69
+ M as Button,
70
+ A as buttonPropsMeta
58
71
  };
@@ -1,12 +1,19 @@
1
+ import { SurfaceProps } from './surface';
1
2
  import { PropsMeta } from './props-meta';
2
3
  import * as React from "react";
3
4
  export type BadgeVariant = "default" | "brand" | "ok" | "warn" | "danger" | "outline";
4
- export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
5
+ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, SurfaceProps {
5
6
  variant?: BadgeVariant;
6
7
  }
7
8
  export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
8
9
  export declare const badgePropsMeta: PropsMeta;
9
- export declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
10
+ export type CardVariant = "default" | "outline" | "ghost" | "elevated";
11
+ export interface CardProps extends React.HTMLAttributes<HTMLDivElement>, SurfaceProps {
12
+ variant?: CardVariant;
13
+ /** Strip the skin: keep the box, style everything yourself. */
14
+ unstyled?: boolean;
15
+ }
16
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
10
17
  export declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
11
18
  export declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
12
19
  export declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
package/dist/core/card.js CHANGED
@@ -1,85 +1,100 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import * as n from "react";
3
+ import { resolveSurface as g, withSurface as x } from "./surface.js";
3
4
  import { cn as d } from "./cn.js";
4
- const g = {
5
+ const w = {
5
6
  default: "bg-[var(--prui-raise)] text-[var(--prui-fg)] border-transparent",
6
7
  brand: "bg-[var(--prui-brand)]/15 text-[var(--prui-brand)] border-transparent",
7
8
  ok: "bg-[var(--prui-ok)]/15 text-[var(--prui-ok)] border-transparent",
8
9
  warn: "bg-[var(--prui-warn)]/15 text-[var(--prui-warn)] border-transparent",
9
10
  danger: "bg-[var(--prui-danger)]/15 text-[var(--prui-danger)] border-transparent",
10
11
  outline: "bg-transparent text-[var(--prui-fg)] border-[var(--prui-line)]"
11
- }, x = n.forwardRef(
12
- ({ className: a, variant: e = "default", ...r }, i) => /* @__PURE__ */ t(
13
- "span",
14
- {
15
- ref: i,
16
- "data-variant": e,
17
- className: d(
18
- "prui-badge inline-flex items-center gap-1 rounded-[var(--prui-radius-full)] border px-2 py-0.5",
12
+ }, y = n.forwardRef(
13
+ ({ className: a, style: e, variant: r = "default", bg: o, fg: i, radius: l, texture: p, textureColor: u, elevation: c, ...m }, f) => {
14
+ const v = g({ bg: o, fg: i, radius: l, texture: p, textureColor: u, elevation: c }), s = x(
15
+ d(
16
+ "prui-badge inline-flex items-center gap-1 rounded-[var(--prui-s-radius,var(--prui-radius-full))] border px-2 py-0.5",
19
17
  "text-xs font-medium whitespace-nowrap",
20
- g[e],
18
+ w[r],
21
19
  a
22
20
  ),
23
- ...r
24
- }
25
- )
21
+ e,
22
+ v
23
+ );
24
+ return /* @__PURE__ */ t(
25
+ "span",
26
+ {
27
+ ref: f,
28
+ "data-variant": r,
29
+ style: s.style,
30
+ className: s.className,
31
+ ...m
32
+ }
33
+ );
34
+ }
26
35
  );
27
- x.displayName = "Badge";
28
- const B = {
36
+ y.displayName = "Badge";
37
+ const z = {
29
38
  name: "Badge",
30
39
  props: [
31
40
  { name: "variant", type: "'default' | 'brand' | 'ok' | 'warn' | 'danger' | 'outline'", default: "'default'", control: "select", options: ["default", "brand", "ok", "warn", "danger", "outline"] },
32
41
  { name: "children", type: "ReactNode", default: null, control: "text" }
33
42
  ]
34
- }, b = n.forwardRef(
35
- ({ className: a, ...e }, r) => /* @__PURE__ */ t(
36
- "div",
37
- {
38
- ref: r,
39
- className: d(
40
- "prui-card rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-surface)]",
43
+ }, N = {
44
+ default: "border border-[var(--prui-line)]",
45
+ outline: "border border-[var(--prui-s-border,var(--prui-brand))] bg-transparent",
46
+ ghost: "border border-transparent bg-transparent",
47
+ elevated: "border border-[var(--prui-line)] prui-elev-md"
48
+ }, C = n.forwardRef(
49
+ ({ className: a, style: e, variant: r = "default", unstyled: o, bg: i, fg: l, radius: p, texture: u, textureColor: c, elevation: m, ...f }, v) => {
50
+ const s = g({ bg: i, fg: l, radius: p, texture: u, textureColor: c, elevation: m }), b = x(
51
+ d(
52
+ "prui-card rounded-[var(--prui-s-radius,var(--prui-radius))]",
53
+ o ? [] : [N[r]],
41
54
  a
42
55
  ),
43
- ...e
44
- }
45
- )
56
+ e,
57
+ s
58
+ );
59
+ return /* @__PURE__ */ t("div", { ref: v, className: b.className, style: b.style, ...f });
60
+ }
46
61
  );
47
- b.displayName = "Card";
48
- const w = n.forwardRef(
62
+ C.displayName = "Card";
63
+ const h = n.forwardRef(
49
64
  ({ className: a, ...e }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("prui-card-header flex flex-col gap-1 p-4", a), ...e })
50
65
  );
51
- w.displayName = "CardHeader";
52
- const N = n.forwardRef(
66
+ h.displayName = "CardHeader";
67
+ const R = n.forwardRef(
53
68
  ({ className: a, ...e }, r) => /* @__PURE__ */ t("h3", { ref: r, className: d("prui-card-title text-base font-semibold text-[var(--prui-fg)]", a), ...e })
54
69
  );
55
- N.displayName = "CardTitle";
56
- const y = n.forwardRef(
70
+ R.displayName = "CardTitle";
71
+ const k = n.forwardRef(
57
72
  ({ className: a, ...e }, r) => /* @__PURE__ */ t("p", { ref: r, className: d("prui-card-description text-sm text-[var(--prui-dim)]", a), ...e })
58
73
  );
59
- y.displayName = "CardDescription";
60
- const C = n.forwardRef(
74
+ k.displayName = "CardDescription";
75
+ const j = n.forwardRef(
61
76
  ({ className: a, ...e }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("prui-card-content p-4 pt-0", a), ...e })
62
77
  );
63
- C.displayName = "CardContent";
64
- const h = n.forwardRef(
78
+ j.displayName = "CardContent";
79
+ const S = n.forwardRef(
65
80
  ({ className: a, ...e }, r) => /* @__PURE__ */ t("div", { ref: r, className: d("prui-card-footer flex items-center p-4 pt-0", a), ...e })
66
81
  );
67
- h.displayName = "CardFooter";
68
- const F = {
82
+ S.displayName = "CardFooter";
83
+ const D = {
69
84
  name: "Card",
70
85
  props: [
71
86
  { name: "children", type: "ReactNode", default: null, control: "text" },
72
87
  { name: "className", type: "string", default: "undefined", control: "text" }
73
88
  ]
74
- }, R = {
89
+ }, A = {
75
90
  sm: "h-6 w-6 text-[10px]",
76
91
  md: "h-8 w-8 text-xs",
77
92
  lg: "h-12 w-12 text-base"
78
- }, k = n.forwardRef(
79
- ({ className: a, src: e, alt: r, fallback: i, size: s = "md", ...l }, p) => {
80
- const [u, c] = n.useState(!1), f = e && !u, m = i ?? (r ? r.split(/\s+/).slice(0, 2).map((v) => {
81
- var o;
82
- return ((o = v[0]) == null ? void 0 : o.toUpperCase()) ?? "";
93
+ }, B = n.forwardRef(
94
+ ({ className: a, src: e, alt: r, fallback: o, size: i = "md", ...l }, p) => {
95
+ const [u, c] = n.useState(!1), m = e && !u, f = o ?? (r ? r.split(/\s+/).slice(0, 2).map((v) => {
96
+ var s;
97
+ return ((s = v[0]) == null ? void 0 : s.toUpperCase()) ?? "";
83
98
  }).join("") : "");
84
99
  return /* @__PURE__ */ t(
85
100
  "span",
@@ -88,17 +103,17 @@ const F = {
88
103
  className: d(
89
104
  "prui-avatar relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden",
90
105
  "rounded-[var(--prui-radius-full)] bg-[var(--prui-raise)] text-[var(--prui-dim)] font-medium",
91
- R[s],
106
+ A[i],
92
107
  a
93
108
  ),
94
109
  ...l,
95
- children: f ? /* @__PURE__ */ t("img", { src: e, alt: r ?? "", className: "h-full w-full object-cover", onError: () => c(!0) }) : m
110
+ children: m ? /* @__PURE__ */ t("img", { src: e, alt: r ?? "", className: "h-full w-full object-cover", onError: () => c(!0) }) : f
96
111
  }
97
112
  );
98
113
  }
99
114
  );
100
- k.displayName = "Avatar";
101
- const M = {
115
+ B.displayName = "Avatar";
116
+ const H = {
102
117
  name: "Avatar",
103
118
  props: [
104
119
  { name: "src", type: "string", default: "undefined", control: "text" },
@@ -108,15 +123,15 @@ const M = {
108
123
  ]
109
124
  };
110
125
  export {
111
- k as Avatar,
112
- x as Badge,
113
- b as Card,
114
- C as CardContent,
115
- y as CardDescription,
116
- h as CardFooter,
117
- w as CardHeader,
118
- N as CardTitle,
119
- M as avatarPropsMeta,
120
- B as badgePropsMeta,
121
- F as cardPropsMeta
126
+ B as Avatar,
127
+ y as Badge,
128
+ C as Card,
129
+ j as CardContent,
130
+ k as CardDescription,
131
+ S as CardFooter,
132
+ h as CardHeader,
133
+ R as CardTitle,
134
+ H as avatarPropsMeta,
135
+ z as badgePropsMeta,
136
+ D as cardPropsMeta
122
137
  };
@@ -1,5 +1,6 @@
1
1
  /** PRUI primitives layer: standard composition building blocks plus cn(). */
2
2
  export { cn } from './cn';
3
+ export { resolveSurface, withSurface, type SurfaceProps, type SurfaceRadius, type SurfaceTexture, type SurfaceElevation } from './surface';
3
4
  export type { PropsMeta, PropMeta, PropControl } from './props-meta';
4
5
  export { Button, buttonPropsMeta, type ButtonProps, type ButtonVariant, type ButtonSize, } from './button';
5
6
  export { Input, inputPropsMeta, Textarea, textareaPropsMeta, type InputProps, type TextareaProps, } from './input';
@@ -1,8 +1,21 @@
1
+ import { SurfaceProps } from './surface';
1
2
  import { PropsMeta } from './props-meta';
2
3
  import * as React from "react";
3
- export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
4
+ declare const inputSizeClasses: {
5
+ readonly sm: "h-8 px-2.5";
6
+ readonly md: "h-9 px-3";
7
+ readonly lg: "h-11 px-4 text-base";
8
+ };
9
+ export type InputSize = keyof typeof inputSizeClasses;
10
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, SurfaceProps {
11
+ /** Control height step; the native numeric size attribute is not exposed. */
12
+ size?: InputSize;
13
+ /** Visual variant: outlined (default) or filled. */
14
+ variant?: "default" | "filled";
15
+ }
4
16
  export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
5
17
  export declare const inputPropsMeta: PropsMeta;
6
18
  export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
7
19
  export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
8
20
  export declare const textareaPropsMeta: PropsMeta;
21
+ export {};
@@ -1,31 +1,46 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { cn as o } from "./cn.js";
4
- const l = "prui-input w-full bg-[var(--prui-background)] text-[var(--prui-fg)] placeholder:text-[var(--prui-dim)] border border-[var(--prui-line)] rounded-[var(--prui-radius)] px-3 h-9 text-sm outline-none transition-colors focus:border-[var(--prui-brand)] focus:ring-2 focus:ring-[var(--prui-brand)]/30 disabled:opacity-50 disabled:cursor-not-allowed", u = n.forwardRef(
5
- ({ className: e, type: t = "text", ...a }, p) => /* @__PURE__ */ r("input", { ref: p, type: t, className: o(l, e), ...a })
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { resolveSurface as v, withSurface as h } from "./surface.js";
4
+ import { cn as s } from "./cn.js";
5
+ const u = "prui-f-control prui-input w-full bg-[var(--prui-s-bg,var(--prui-background))] text-[var(--prui-s-fg,var(--prui-fg))] placeholder:text-[var(--prui-dim)] border border-[var(--prui-line)] rounded-[var(--prui-s-radius,var(--prui-radius))] text-sm outline-none transition-colors focus:border-[var(--prui-brand)] focus:ring-2 focus:ring-[var(--prui-brand)]/30 disabled:opacity-50 disabled:cursor-not-allowed", w = {
6
+ sm: "h-8 px-2.5",
7
+ md: "h-9 px-3",
8
+ lg: "h-11 px-4 text-base"
9
+ }, N = l.forwardRef(
10
+ ({ className: e, style: t, type: r = "text", size: a = "md", variant: i = "default", bg: p, fg: d, radius: c, texture: m, textureColor: f, elevation: x, ...b }, g) => {
11
+ const y = v({ bg: p, fg: d, radius: c, texture: m, textureColor: f, elevation: x }), n = h(
12
+ s(u, w[a], i === "filled" && "bg-[var(--prui-s-bg,var(--prui-raise))] border-transparent", e),
13
+ t,
14
+ y
15
+ );
16
+ return /* @__PURE__ */ o("input", { ref: g, type: r, className: n.className, style: n.style, ...b });
17
+ }
6
18
  );
7
- u.displayName = "Input";
8
- const c = {
19
+ N.displayName = "Input";
20
+ const S = {
9
21
  name: "Input",
10
22
  props: [
11
23
  { name: "type", type: "string", default: "'text'", control: "select", options: ["text", "password", "email", "number", "search"] },
24
+ { name: "size", type: "'sm' | 'md' | 'lg'", default: "'md'", control: "select", options: ["sm", "md", "lg"] },
25
+ { name: "variant", type: "'default' | 'filled'", default: "'default'", control: "select", options: ["default", "filled"] },
12
26
  { name: "value", type: "string", default: null, control: "text" },
13
27
  { name: "placeholder", type: "string", default: "undefined", control: "text" },
14
28
  { name: "disabled", type: "boolean", default: "false", control: "boolean" },
15
29
  { name: "onChange", type: "(e) => void", default: null, control: "none" }
16
30
  ]
17
- }, i = n.forwardRef(
18
- ({ className: e, ...t }, a) => /* @__PURE__ */ r(
31
+ }, z = l.forwardRef(
32
+ ({ className: e, style: t, ...r }, a) => /* @__PURE__ */ o(
19
33
  "textarea",
20
34
  {
21
35
  ref: a,
22
- className: o(l, "h-auto min-h-20 py-2 resize-y", e),
23
- ...t
36
+ style: t,
37
+ className: s(u, "h-auto min-h-20 py-2 resize-y", e),
38
+ ...r
24
39
  }
25
40
  )
26
41
  );
27
- i.displayName = "Textarea";
28
- const m = {
42
+ z.displayName = "Textarea";
43
+ const T = {
29
44
  name: "Textarea",
30
45
  props: [
31
46
  { name: "value", type: "string", default: null, control: "textarea" },
@@ -35,8 +50,8 @@ const m = {
35
50
  ]
36
51
  };
37
52
  export {
38
- u as Input,
39
- i as Textarea,
40
- c as inputPropsMeta,
41
- m as textareaPropsMeta
53
+ N as Input,
54
+ z as Textarea,
55
+ S as inputPropsMeta,
56
+ T as textareaPropsMeta
42
57
  };
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Surface: an opt-in flexibility layer shared by the primitives. A surface
4
+ * accepts any CSS color or var() for background and foreground, a radius
5
+ * step (or raw length), a subtle background texture, and an elevation step.
6
+ * Nothing here changes the default look: every value degrades to the
7
+ * current theme's tokens through var() fallbacks inside the components.
8
+ */
9
+ export type SurfaceRadius = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | (string & {});
10
+ export type SurfaceTexture = "none" | "dots" | "grid" | "stripes" | "diagonal";
11
+ export type SurfaceElevation = "none" | "sm" | "md" | "lg";
12
+ export interface SurfaceProps {
13
+ /** Any CSS background value: color, gradient, or var(). */
14
+ bg?: string;
15
+ /** Any CSS color for text or icons on this surface. */
16
+ fg?: string;
17
+ /** Radius step name, or a raw CSS length like "12px". */
18
+ radius?: SurfaceRadius;
19
+ /** Subtle background pattern drawn with the texture color. */
20
+ texture?: SurfaceTexture;
21
+ /** Pattern color; defaults to the theme's --prui-line token. */
22
+ textureColor?: string;
23
+ /** Box shadow step. */
24
+ elevation?: SurfaceElevation;
25
+ }
26
+ export interface SurfaceResult {
27
+ style?: React.CSSProperties;
28
+ className?: string;
29
+ }
30
+ /**
31
+ * Resolve surface props into inline custom properties plus texture and
32
+ * elevation classes. Returns undefined when nothing is set, so components
33
+ * keep their original render path.
34
+ */
35
+ export declare function resolveSurface(p?: SurfaceProps): SurfaceResult | undefined;
36
+ /** Merge a surface result into a component's className and style. */
37
+ export declare function withSurface(className: string, style: React.CSSProperties | undefined, surface: SurfaceResult | undefined): {
38
+ className: string;
39
+ style?: React.CSSProperties;
40
+ };
@@ -0,0 +1,37 @@
1
+ import "react";
2
+ const s = {
3
+ none: "0px",
4
+ xs: "2px",
5
+ sm: "var(--prui-radius-1)",
6
+ md: "var(--prui-radius)",
7
+ lg: "var(--prui-radius-3)",
8
+ xl: "18px",
9
+ full: "9999px"
10
+ }, u = {
11
+ sm: "prui-elev-sm",
12
+ md: "prui-elev-md",
13
+ lg: "prui-elev-lg"
14
+ };
15
+ function l(e) {
16
+ if (!e) return;
17
+ const i = {}, r = [];
18
+ if (e.bg && (i["--prui-s-bg"] = e.bg), e.fg && (i["--prui-s-fg"] = e.fg), e.radius && (i["--prui-s-radius"] = s[e.radius] ?? e.radius), e.textureColor && (i["--prui-tex-c"] = e.textureColor), e.texture && e.texture !== "none" && r.push(`prui-tex-${e.texture}`), e.elevation && e.elevation !== "none") {
19
+ const t = u[e.elevation];
20
+ t && r.push(t);
21
+ }
22
+ if (!(!r.length && !Object.keys(i).length))
23
+ return {
24
+ style: Object.keys(i).length ? i : void 0,
25
+ className: r.length ? r.join(" ") : void 0
26
+ };
27
+ }
28
+ function o(e, i, r) {
29
+ return r ? {
30
+ className: [e, r.className].filter(Boolean).join(" "),
31
+ style: { ...i, ...r.style }
32
+ } : { className: e, style: i };
33
+ }
34
+ export {
35
+ l as resolveSurface,
36
+ o as withSurface
37
+ };