@aviala-design/spiral 3.1.1 → 4.0.0-next.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.
- package/README.md +80 -0
- package/dist/{chunk-Q6UMVIGM.cjs → chunk-JZOPCN75.cjs} +45 -5
- package/dist/chunk-JZOPCN75.cjs.map +1 -0
- package/dist/{chunk-G7RVHJIV.js → chunk-NUOJ7QVZ.js} +48 -8
- package/dist/chunk-NUOJ7QVZ.js.map +1 -0
- package/dist/component-catalog.json +4 -1
- package/dist/component-changelogs.json +252 -0
- package/dist/form.cjs +11 -9
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +4 -2
- package/dist/form.js.map +1 -1
- package/dist/index.cjs +5799 -2521
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +981 -168
- package/dist/index.d.ts +981 -168
- package/dist/index.js +6678 -3400
- package/dist/index.js.map +1 -1
- package/dist/props.json +2389 -474
- package/dist/styles.css +5884 -1624
- package/package.json +6 -14
- package/dist/chunk-G7RVHJIV.js.map +0 -1
- package/dist/chunk-Q6UMVIGM.cjs.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @aviala-design/spiral
|
|
2
|
+
|
|
3
|
+
Spiral — Aviala Design React component library (Radix-free, powered by `@ui-sdk/core` + `@ui-sdk/react`).
|
|
4
|
+
|
|
5
|
+
**Spiral v4 is currently published under the `next` dist-tag (experimental prerelease).**
|
|
6
|
+
|
|
7
|
+
- Docs site: <https://avialaoss.github.io/developer-kit/>
|
|
8
|
+
- Coding-agent guide: <https://avialaoss.github.io/developer-kit/llms.txt>
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @aviala-design/spiral@next
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Requires **React >=19** (`react` and `react-dom` are peer dependencies). `@aviala-design/tokens` and `@aviala-design/icons` come in as dependencies — no separate install needed.
|
|
17
|
+
|
|
18
|
+
## CSS: one import, no Tailwind
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import "@aviala-design/spiral/styles.css";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
That single file ships design tokens, component effects, the default ALD theme, and layout utilities precompiled. You do **not** need `tailwindcss` or `@source` scanning.
|
|
25
|
+
|
|
26
|
+
## Minimal app
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import "@aviala-design/spiral/styles.css";
|
|
30
|
+
import { ThemeProvider, Button } from "@aviala-design/spiral";
|
|
31
|
+
|
|
32
|
+
export function App() {
|
|
33
|
+
return (
|
|
34
|
+
<ThemeProvider defaultMode="light" defaultPresetId="ald">
|
|
35
|
+
<Button mode="primary">Hello Spiral</Button>
|
|
36
|
+
</ThemeProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`ThemeProvider` also auto-initializes keyboard focus handling (`initKeyboardFocus`) — do not call it manually. Custom themes go through `defineTheme({ package, base })` and the `themes` registry prop.
|
|
42
|
+
|
|
43
|
+
## Form subpath
|
|
44
|
+
|
|
45
|
+
Form bindings live on a separate entrypoint so the main bundle stays free of `react-hook-form`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm add react-hook-form # peer, >=7.50
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { Form, FormField } from "@aviala-design/spiral/form";
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Do **not** import `Form` / `FormField` from the main entry.
|
|
56
|
+
|
|
57
|
+
## Machine-readable reference
|
|
58
|
+
|
|
59
|
+
The package ships a component index and a full props reference:
|
|
60
|
+
|
|
61
|
+
- `@aviala-design/spiral/component-catalog.json` — names, import paths, subparts, provider hints
|
|
62
|
+
- `@aviala-design/spiral/props.json` — per-component props (`name`, `type`, `defaultValue`, `required`, `description`)
|
|
63
|
+
|
|
64
|
+
Hosted copies (same data, refreshed on every `next` push):
|
|
65
|
+
|
|
66
|
+
- <https://avialaoss.github.io/developer-kit/component-catalog.json>
|
|
67
|
+
- <https://avialaoss.github.io/developer-kit/props.json>
|
|
68
|
+
|
|
69
|
+
Coding agents: start from <https://avialaoss.github.io/developer-kit/llms.txt>.
|
|
70
|
+
|
|
71
|
+
## v3 → v4 highlights
|
|
72
|
+
|
|
73
|
+
- Radix UI primitives replaced by `@ui-sdk/core` + `@ui-sdk/react` (bundled).
|
|
74
|
+
- React `>=19` required.
|
|
75
|
+
- Tokens: `--special-effort-*` renamed to `--special-effect-*`; `basicEffect` / `specialEffect` split.
|
|
76
|
+
- 12-step preset color palettes; `UploadList` / `UploadListItem`; `SegmentatorGroup` adds `appearance="normal"` (`"themed" | "normal"`, default `"themed"`).
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
|
@@ -15,8 +15,46 @@ function useResolvedControlError(errorProp) {
|
|
|
15
15
|
return _nullishCoalesce(_nullishCoalesce(errorProp, () => ( _optionalChain([ctx, 'optionalAccess', _ => _.invalid]))), () => ( false));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// src/lib/slot.tsx
|
|
19
|
+
var _primitive = require('@ui-sdk/react/primitive');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function getElementRef(element) {
|
|
27
|
+
let getter = _optionalChain([Object, 'access', _2 => _2.getOwnPropertyDescriptor, 'call', _3 => _3(element.props, "ref"), 'optionalAccess', _4 => _4.get]);
|
|
28
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
29
|
+
if (mayWarn) return element.ref;
|
|
30
|
+
getter = _optionalChain([Object, 'access', _5 => _5.getOwnPropertyDescriptor, 'call', _6 => _6(element, "ref"), 'optionalAccess', _7 => _7.get]);
|
|
31
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
32
|
+
if (mayWarn) return element.props.ref;
|
|
33
|
+
return element.props.ref || element.ref;
|
|
34
|
+
}
|
|
35
|
+
var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...slotProps }, forwardedRef) {
|
|
36
|
+
if (!_react.isValidElement.call(void 0, children)) {
|
|
37
|
+
if (children || children === 0) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"Slot failed to slot onto its children. Expected a single React element child."
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const child = children;
|
|
45
|
+
const { ref: childPropRef, ...childProps } = child.props;
|
|
46
|
+
const childRef = _nullishCoalesce(childPropRef, () => ( getElementRef(child)));
|
|
47
|
+
const canRef = child.type !== _react.Fragment;
|
|
48
|
+
const merged = _primitive.mergeProps.call(void 0,
|
|
49
|
+
canRef && forwardedRef ? { ...slotProps, ref: forwardedRef } : slotProps,
|
|
50
|
+
childProps,
|
|
51
|
+
canRef && childRef ? { ref: childRef } : {}
|
|
52
|
+
);
|
|
53
|
+
return _react.cloneElement.call(void 0, child, merged);
|
|
54
|
+
});
|
|
55
|
+
Slot.displayName = "Slot";
|
|
56
|
+
|
|
18
57
|
// src/components/typography.tsx
|
|
19
|
-
var _reactslot = require('@radix-ui/react-slot');
|
|
20
58
|
var _classvarianceauthority = require('class-variance-authority');
|
|
21
59
|
|
|
22
60
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -29,7 +67,8 @@ var typographyVariants = _classvarianceauthority.cva.call(void 0, "aviala-typogr
|
|
|
29
67
|
title: "aviala-typography--title",
|
|
30
68
|
subtitle: "aviala-typography--subtitle",
|
|
31
69
|
text: "aviala-typography--text",
|
|
32
|
-
caption: "aviala-typography--caption"
|
|
70
|
+
caption: "aviala-typography--caption",
|
|
71
|
+
footnote: "aviala-typography--footnote"
|
|
33
72
|
}
|
|
34
73
|
},
|
|
35
74
|
defaultVariants: {
|
|
@@ -53,7 +92,7 @@ var Typography = _react.forwardRef.call(void 0,
|
|
|
53
92
|
"data-content": content,
|
|
54
93
|
"data-tone": tone === "white" ? "white" : void 0
|
|
55
94
|
};
|
|
56
|
-
if (asChild) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
95
|
+
if (asChild) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Slot, { ...hostProps });
|
|
57
96
|
return _react.createElement.call(void 0, Tag, hostProps);
|
|
58
97
|
}
|
|
59
98
|
);
|
|
@@ -171,5 +210,6 @@ TypefacePair.displayName = "TypefacePair";
|
|
|
171
210
|
|
|
172
211
|
|
|
173
212
|
|
|
174
|
-
|
|
175
|
-
|
|
213
|
+
|
|
214
|
+
exports.cn = cn; exports.FormFieldControlContext = FormFieldControlContext; exports.useResolvedControlError = useResolvedControlError; exports.Slot = Slot; exports.typographyVariants = typographyVariants; exports.Typography = Typography; exports.Typeface = Typeface; exports.TypefacePair = TypefacePair;
|
|
215
|
+
//# sourceMappingURL=chunk-JZOPCN75.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/developer-kit/developer-kit/packages/ui/dist/chunk-JZOPCN75.cjs","../src/lib/utils.ts","../src/components/form-field-context.ts","../src/lib/slot.tsx","../src/components/typography.tsx","../src/components/typeface.tsx"],"names":["Slot","forwardRef","jsx"],"mappings":"AAAA,6rBAAY;AACZ;AACA;ACFA,4BAAsC;AACtC,+CAAwB;AAEjB,SAAS,EAAA,CAAA,GAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,oCAAA,wBAAQ,MAAW,CAAC,CAAA;AAC7B;ADGA;AACA;AETA,8BAA0C;AAanC,IAAM,wBAAA,EACX,kCAAA,IAAuD,CAAA;AAMlD,SAAS,uBAAA,CAAwB,SAAA,EAA8B;AACpE,EAAA,MAAM,IAAA,EAAM,+BAAA,uBAAkC,CAAA;AAC9C,EAAA,yCAAO,SAAA,0BAAa,GAAA,2BAAK,WAAA,UAAW,OAAA;AACtC;AFPA;AACA;AGjBA,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,KAAA;AACrD,YAAA,OAAO,IAAA;AAET,UAAA,MAAM,YAAA,EACJ,MAAA,IAAU,EAAA,EACN,eAAA,EACA,MAAA,IAAU,EAAA,EACR,iBAAA,EACA,eAAA;AAER,UAAA,uBACEA,6BAAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,SAAA,EAAU,uBAAA;AAAA,cACV,WAAA,EAAW,KAAA;AAAA,cAEX,QAAA,kBAAAA,6BAAAA,UAAC,EAAA,EAAW,KAAA,EAAO,IAAA,CAAK,KAAA,EAAO,OAAA,EAAS,WAAA,EAAa,IAAA,EAClD,QAAA,EAAA,MAAA,CACH;AAAA,YAAA,CAAA;AAAA,YANK,CAAA,EAAA;AAOP,UAAA;AAEH,QAAA;AAAA,MAAA;AACH,IAAA;AAEJ,EAAA;AACF;AACS;AAEA;AAOL,EAAA;AAIQ,IAAA;AACV,EAAA;AAEI,EAAA;AACM,IAAA;AACV,EAAA;AAEU,EAAA;AACD,IAAA;AACT,EAAA;AAEQ,EAAA;AACV;AAQa;AACD,EAAA;AACP,IAAA;AAAA,IAAA;AACC,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACI,MAAA;AAAA,IAAA;AACN,EAAA;AAEJ;AACa;AL8BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/developer-kit/developer-kit/packages/ui/dist/chunk-JZOPCN75.cjs","sourcesContent":[null,"import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { createContext, useContext } from \"react\";\n\n/**\n * Kept free of `react-hook-form` imports so the controls that consume it\n * (Input, Textarea, Select, …) stay usable from the main entry without the\n * peer dependency installed. The RHF-aware pieces live in `form-field.tsx`,\n * which is only reachable through `@aviala-design/spiral/form`.\n */\ntype FormFieldControlContextValue = {\n /** True when FormField is showing an error tip (layout `error` or RHF message). */\n invalid: boolean;\n};\n\nexport const FormFieldControlContext =\n createContext<FormFieldControlContextValue | null>(null);\n\n/**\n * Resolve a control `error` prop against the surrounding FormField.\n * Explicit `error={true|false}` wins; otherwise inherits FormField tip invalidity.\n */\nexport function useResolvedControlError(errorProp?: boolean): boolean {\n const ctx = useContext(FormFieldControlContext);\n return errorProp ?? ctx?.invalid ?? false;\n}\n","import { mergeProps } from \"@ui-sdk/react/primitive\";\nimport {\n cloneElement,\n forwardRef,\n Fragment,\n isValidElement,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nexport type SlotProps = HTMLAttributes<HTMLElement> & {\n children?: ReactNode;\n};\n\ntype AnyRef = Ref<unknown> | undefined;\n\n/**\n * The ref a child element carries. React 19 exposes it as a prop; earlier\n * versions keep it on the element behind a getter that warns on access.\n */\nfunction getElementRef(element: ReactElement<Record<string, unknown>>): AnyRef {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) return (element as unknown as { ref?: AnyRef }).ref;\n\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) return (element.props as { ref?: AnyRef }).ref;\n\n return (\n (element.props as { ref?: AnyRef }).ref ||\n (element as unknown as { ref?: AnyRef }).ref\n );\n}\n\n/**\n * Renders its single child element with the slot's props merged in: class\n * names and styles combine, event handlers run child-first, and both refs\n * receive the element. The `asChild` counterpart of every Spiral component.\n */\nexport const Slot = forwardRef<HTMLElement, SlotProps>(function Slot(\n { children, ...slotProps },\n forwardedRef\n) {\n if (!isValidElement(children)) {\n if (children || children === 0) {\n throw new Error(\n \"Slot failed to slot onto its children. Expected a single React element child.\"\n );\n }\n return null;\n }\n\n const child = children as ReactElement<Record<string, unknown>>;\n // Keep the child's ref out of the prop merge so it is composed exactly once.\n const { ref: childPropRef, ...childProps } = child.props;\n const childRef = (childPropRef as AnyRef) ?? getElementRef(child);\n // A Fragment cannot carry a ref, matching Radix Slot.\n const canRef = child.type !== Fragment;\n\n const merged = mergeProps(\n canRef && forwardedRef ? { ...slotProps, ref: forwardedRef } : slotProps,\n childProps,\n canRef && childRef ? { ref: childRef } : {}\n );\n\n return cloneElement(child, merged);\n});\n\nSlot.displayName = \"Slot\";\n","import { Slot } from \"../lib/slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { createElement, forwardRef, type HTMLAttributes } from \"react\";\nimport { cn } from \"../lib/utils\";\n\n/** Figma Components → System Composition → Typography (128:85) */\nexport type TypographyLevel =\n | \"display\"\n | \"headline1\"\n | \"headline2\"\n | \"title\"\n | \"subtitle\"\n | \"text\"\n | \"caption\"\n | \"footnote\";\n\nexport type TypographyContent = \"text\" | \"number\";\nexport type TypographyTone = \"default\" | \"white\";\n\nexport const typographyVariants = cva(\"aviala-typography\", {\n variants: {\n level: {\n display: \"aviala-typography--display\",\n headline1: \"aviala-typography--headline1\",\n headline2: \"aviala-typography--headline2\",\n title: \"aviala-typography--title\",\n subtitle: \"aviala-typography--subtitle\",\n text: \"aviala-typography--text\",\n caption: \"aviala-typography--caption\",\n footnote: \"aviala-typography--footnote\",\n },\n },\n defaultVariants: {\n level: \"text\",\n },\n});\n\nexport type TypographyProps = HTMLAttributes<HTMLElement> &\n VariantProps<typeof typographyVariants> & {\n /** Figma `Content` — text vs numeric styling */\n content?: TypographyContent;\n /** Figma `White` — light text on dark surfaces */\n tone?: TypographyTone;\n asChild?: boolean;\n as?:\n \"p\" | \"span\" | \"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"label\";\n };\n\nexport const Typography = forwardRef<HTMLSpanElement, TypographyProps>(\n (\n {\n className,\n level = \"text\",\n content = \"text\",\n tone = \"default\",\n as: Tag = \"span\",\n asChild = false,\n ...props\n },\n ref\n ) => {\n const hostProps = {\n ...props,\n ref,\n className: cn(typographyVariants({ level }), className),\n \"data-content\": content,\n \"data-tone\": tone === \"white\" ? \"white\" : undefined,\n };\n\n if (asChild) return <Slot {...hostProps} />;\n\n // JSX resolves a union `as` tag to the intersection of every member's props,\n // which no single element ref can satisfy. createElement keeps the ref typed\n // as HTMLElement.\n return createElement(Tag, hostProps);\n }\n);\nTypography.displayName = \"Typography\";\n","import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport {\n Typography,\n type TypographyContent,\n type TypographyLevel,\n type TypographyTone,\n} from \"./typography\";\n\n/** Figma Components → System Composition → Typeface (527:56311) */\nexport type TypefaceContent =\n | \"allCustom\"\n | \"textCaption\"\n | \"textCaptionSubtitle\"\n | \"textTitle\"\n | \"textHeadline2\"\n | \"textHeadline1\";\n\ntype TypefaceLine = {\n level: TypographyLevel;\n content?: TypographyContent;\n tone?: TypographyTone;\n children: ReactNode;\n};\n\nconst typefaceLayouts: Record<TypefaceContent, TypefaceLine[]> = {\n allCustom: [\n { level: \"text\", children: null },\n { level: \"caption\", children: null },\n ],\n textCaption: [\n { level: \"text\", children: null },\n { level: \"caption\", children: null },\n ],\n textCaptionSubtitle: [\n { level: \"subtitle\", children: null },\n { level: \"text\", children: null },\n { level: \"caption\", children: null },\n ],\n textTitle: [\n { level: \"title\", children: null },\n { level: \"text\", children: null },\n ],\n textHeadline2: [\n { level: \"headline2\", children: null },\n { level: \"text\", children: null },\n ],\n textHeadline1: [\n { level: \"headline1\", children: null },\n { level: \"text\", children: null },\n ],\n};\n\nexport type TypefaceProps = Omit<HTMLAttributes<HTMLDivElement>, \"content\"> & {\n /** Figma `Content` preset */\n content?: TypefaceContent;\n /** Primary line — overrides preset first line */\n primary?: ReactNode;\n /** Secondary line — overrides preset second line */\n secondary?: ReactNode;\n /** Tertiary line — used by `textCaptionSubtitle` */\n tertiary?: ReactNode;\n /** Per-line content mode for numeric text */\n primaryContent?: TypographyContent;\n secondaryContent?: TypographyContent;\n tertiaryContent?: TypographyContent;\n tone?: TypographyTone;\n};\n\nexport const Typeface = forwardRef<HTMLDivElement, TypefaceProps>(\n (\n {\n className,\n content = \"allCustom\",\n primary,\n secondary,\n tertiary,\n primaryContent = \"text\",\n secondaryContent = \"text\",\n tertiaryContent = \"text\",\n tone = \"default\",\n children,\n ...props\n },\n ref\n ) => {\n const layout = typefaceLayouts[content];\n const values = resolveTypefaceValues(\n primary,\n secondary,\n tertiary,\n children\n );\n\n return (\n <div\n ref={ref}\n className={cn(\"aviala-typeface\", className)}\n data-content={content}\n {...props}\n >\n {layout.map((line, index) => {\n const value = values[index];\n if (value === undefined || value === null || value === false)\n return null;\n\n const lineContent =\n index === 0\n ? primaryContent\n : index === 1\n ? secondaryContent\n : tertiaryContent;\n\n return (\n <span\n key={`${line.level}-${index}`}\n className=\"aviala-typeface__line\"\n data-line={index}\n >\n <Typography level={line.level} content={lineContent} tone={tone}>\n {value}\n </Typography>\n </span>\n );\n })}\n </div>\n );\n }\n);\nTypeface.displayName = \"Typeface\";\n\nfunction resolveTypefaceValues(\n primary?: ReactNode,\n secondary?: ReactNode,\n tertiary?: ReactNode,\n children?: ReactNode\n): ReactNode[] {\n if (\n primary !== undefined ||\n secondary !== undefined ||\n tertiary !== undefined\n ) {\n return [primary, secondary, tertiary];\n }\n\n if (children == null || children === false) {\n return [];\n }\n\n if (Array.isArray(children)) {\n return children;\n }\n\n return [children];\n}\n\n/** Convenience helper for two-line label + caption pairs (Radio, Checkbox, etc.) */\nexport type TypefacePairProps = Omit<TypefaceProps, \"content\"> & {\n title: ReactNode;\n description?: ReactNode;\n};\n\nexport const TypefacePair = forwardRef<HTMLDivElement, TypefacePairProps>(\n ({ title, description, ...props }, ref) => (\n <Typeface\n ref={ref}\n content=\"textCaption\"\n primary={title}\n secondary={description}\n {...props}\n />\n )\n);\nTypefacePair.displayName = \"TypefacePair\";\n"]}
|
|
@@ -15,10 +15,48 @@ function useResolvedControlError(errorProp) {
|
|
|
15
15
|
return errorProp ?? ctx?.invalid ?? false;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// src/lib/slot.tsx
|
|
19
|
+
import { mergeProps } from "@ui-sdk/react/primitive";
|
|
20
|
+
import {
|
|
21
|
+
cloneElement,
|
|
22
|
+
forwardRef,
|
|
23
|
+
Fragment,
|
|
24
|
+
isValidElement
|
|
25
|
+
} from "react";
|
|
26
|
+
function getElementRef(element) {
|
|
27
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
28
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
29
|
+
if (mayWarn) return element.ref;
|
|
30
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
31
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
32
|
+
if (mayWarn) return element.props.ref;
|
|
33
|
+
return element.props.ref || element.ref;
|
|
34
|
+
}
|
|
35
|
+
var Slot = forwardRef(function Slot2({ children, ...slotProps }, forwardedRef) {
|
|
36
|
+
if (!isValidElement(children)) {
|
|
37
|
+
if (children || children === 0) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"Slot failed to slot onto its children. Expected a single React element child."
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const child = children;
|
|
45
|
+
const { ref: childPropRef, ...childProps } = child.props;
|
|
46
|
+
const childRef = childPropRef ?? getElementRef(child);
|
|
47
|
+
const canRef = child.type !== Fragment;
|
|
48
|
+
const merged = mergeProps(
|
|
49
|
+
canRef && forwardedRef ? { ...slotProps, ref: forwardedRef } : slotProps,
|
|
50
|
+
childProps,
|
|
51
|
+
canRef && childRef ? { ref: childRef } : {}
|
|
52
|
+
);
|
|
53
|
+
return cloneElement(child, merged);
|
|
54
|
+
});
|
|
55
|
+
Slot.displayName = "Slot";
|
|
56
|
+
|
|
18
57
|
// src/components/typography.tsx
|
|
19
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
20
58
|
import { cva } from "class-variance-authority";
|
|
21
|
-
import { createElement, forwardRef } from "react";
|
|
59
|
+
import { createElement, forwardRef as forwardRef2 } from "react";
|
|
22
60
|
import { jsx } from "react/jsx-runtime";
|
|
23
61
|
var typographyVariants = cva("aviala-typography", {
|
|
24
62
|
variants: {
|
|
@@ -29,14 +67,15 @@ var typographyVariants = cva("aviala-typography", {
|
|
|
29
67
|
title: "aviala-typography--title",
|
|
30
68
|
subtitle: "aviala-typography--subtitle",
|
|
31
69
|
text: "aviala-typography--text",
|
|
32
|
-
caption: "aviala-typography--caption"
|
|
70
|
+
caption: "aviala-typography--caption",
|
|
71
|
+
footnote: "aviala-typography--footnote"
|
|
33
72
|
}
|
|
34
73
|
},
|
|
35
74
|
defaultVariants: {
|
|
36
75
|
level: "text"
|
|
37
76
|
}
|
|
38
77
|
});
|
|
39
|
-
var Typography =
|
|
78
|
+
var Typography = forwardRef2(
|
|
40
79
|
({
|
|
41
80
|
className,
|
|
42
81
|
level = "text",
|
|
@@ -60,7 +99,7 @@ var Typography = forwardRef(
|
|
|
60
99
|
Typography.displayName = "Typography";
|
|
61
100
|
|
|
62
101
|
// src/components/typeface.tsx
|
|
63
|
-
import { forwardRef as
|
|
102
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
64
103
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
65
104
|
var typefaceLayouts = {
|
|
66
105
|
allCustom: [
|
|
@@ -89,7 +128,7 @@ var typefaceLayouts = {
|
|
|
89
128
|
{ level: "text", children: null }
|
|
90
129
|
]
|
|
91
130
|
};
|
|
92
|
-
var Typeface =
|
|
131
|
+
var Typeface = forwardRef3(
|
|
93
132
|
({
|
|
94
133
|
className,
|
|
95
134
|
content = "allCustom",
|
|
@@ -149,7 +188,7 @@ function resolveTypefaceValues(primary, secondary, tertiary, children) {
|
|
|
149
188
|
}
|
|
150
189
|
return [children];
|
|
151
190
|
}
|
|
152
|
-
var TypefacePair =
|
|
191
|
+
var TypefacePair = forwardRef3(
|
|
153
192
|
({ title, description, ...props }, ref) => /* @__PURE__ */ jsx2(
|
|
154
193
|
Typeface,
|
|
155
194
|
{
|
|
@@ -167,9 +206,10 @@ export {
|
|
|
167
206
|
cn,
|
|
168
207
|
FormFieldControlContext,
|
|
169
208
|
useResolvedControlError,
|
|
209
|
+
Slot,
|
|
170
210
|
typographyVariants,
|
|
171
211
|
Typography,
|
|
172
212
|
Typeface,
|
|
173
213
|
TypefacePair
|
|
174
214
|
};
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
215
|
+
//# sourceMappingURL=chunk-NUOJ7QVZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/components/form-field-context.ts","../src/lib/slot.tsx","../src/components/typography.tsx","../src/components/typeface.tsx"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { createContext, useContext } from \"react\";\n\n/**\n * Kept free of `react-hook-form` imports so the controls that consume it\n * (Input, Textarea, Select, …) stay usable from the main entry without the\n * peer dependency installed. The RHF-aware pieces live in `form-field.tsx`,\n * which is only reachable through `@aviala-design/spiral/form`.\n */\ntype FormFieldControlContextValue = {\n /** True when FormField is showing an error tip (layout `error` or RHF message). */\n invalid: boolean;\n};\n\nexport const FormFieldControlContext =\n createContext<FormFieldControlContextValue | null>(null);\n\n/**\n * Resolve a control `error` prop against the surrounding FormField.\n * Explicit `error={true|false}` wins; otherwise inherits FormField tip invalidity.\n */\nexport function useResolvedControlError(errorProp?: boolean): boolean {\n const ctx = useContext(FormFieldControlContext);\n return errorProp ?? ctx?.invalid ?? false;\n}\n","import { mergeProps } from \"@ui-sdk/react/primitive\";\nimport {\n cloneElement,\n forwardRef,\n Fragment,\n isValidElement,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nexport type SlotProps = HTMLAttributes<HTMLElement> & {\n children?: ReactNode;\n};\n\ntype AnyRef = Ref<unknown> | undefined;\n\n/**\n * The ref a child element carries. React 19 exposes it as a prop; earlier\n * versions keep it on the element behind a getter that warns on access.\n */\nfunction getElementRef(element: ReactElement<Record<string, unknown>>): AnyRef {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) return (element as unknown as { ref?: AnyRef }).ref;\n\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) return (element.props as { ref?: AnyRef }).ref;\n\n return (\n (element.props as { ref?: AnyRef }).ref ||\n (element as unknown as { ref?: AnyRef }).ref\n );\n}\n\n/**\n * Renders its single child element with the slot's props merged in: class\n * names and styles combine, event handlers run child-first, and both refs\n * receive the element. The `asChild` counterpart of every Spiral component.\n */\nexport const Slot = forwardRef<HTMLElement, SlotProps>(function Slot(\n { children, ...slotProps },\n forwardedRef\n) {\n if (!isValidElement(children)) {\n if (children || children === 0) {\n throw new Error(\n \"Slot failed to slot onto its children. Expected a single React element child.\"\n );\n }\n return null;\n }\n\n const child = children as ReactElement<Record<string, unknown>>;\n // Keep the child's ref out of the prop merge so it is composed exactly once.\n const { ref: childPropRef, ...childProps } = child.props;\n const childRef = (childPropRef as AnyRef) ?? getElementRef(child);\n // A Fragment cannot carry a ref, matching Radix Slot.\n const canRef = child.type !== Fragment;\n\n const merged = mergeProps(\n canRef && forwardedRef ? { ...slotProps, ref: forwardedRef } : slotProps,\n childProps,\n canRef && childRef ? { ref: childRef } : {}\n );\n\n return cloneElement(child, merged);\n});\n\nSlot.displayName = \"Slot\";\n","import { Slot } from \"../lib/slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { createElement, forwardRef, type HTMLAttributes } from \"react\";\nimport { cn } from \"../lib/utils\";\n\n/** Figma Components → System Composition → Typography (128:85) */\nexport type TypographyLevel =\n | \"display\"\n | \"headline1\"\n | \"headline2\"\n | \"title\"\n | \"subtitle\"\n | \"text\"\n | \"caption\"\n | \"footnote\";\n\nexport type TypographyContent = \"text\" | \"number\";\nexport type TypographyTone = \"default\" | \"white\";\n\nexport const typographyVariants = cva(\"aviala-typography\", {\n variants: {\n level: {\n display: \"aviala-typography--display\",\n headline1: \"aviala-typography--headline1\",\n headline2: \"aviala-typography--headline2\",\n title: \"aviala-typography--title\",\n subtitle: \"aviala-typography--subtitle\",\n text: \"aviala-typography--text\",\n caption: \"aviala-typography--caption\",\n footnote: \"aviala-typography--footnote\",\n },\n },\n defaultVariants: {\n level: \"text\",\n },\n});\n\nexport type TypographyProps = HTMLAttributes<HTMLElement> &\n VariantProps<typeof typographyVariants> & {\n /** Figma `Content` — text vs numeric styling */\n content?: TypographyContent;\n /** Figma `White` — light text on dark surfaces */\n tone?: TypographyTone;\n asChild?: boolean;\n as?:\n \"p\" | \"span\" | \"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"label\";\n };\n\nexport const Typography = forwardRef<HTMLSpanElement, TypographyProps>(\n (\n {\n className,\n level = \"text\",\n content = \"text\",\n tone = \"default\",\n as: Tag = \"span\",\n asChild = false,\n ...props\n },\n ref\n ) => {\n const hostProps = {\n ...props,\n ref,\n className: cn(typographyVariants({ level }), className),\n \"data-content\": content,\n \"data-tone\": tone === \"white\" ? \"white\" : undefined,\n };\n\n if (asChild) return <Slot {...hostProps} />;\n\n // JSX resolves a union `as` tag to the intersection of every member's props,\n // which no single element ref can satisfy. createElement keeps the ref typed\n // as HTMLElement.\n return createElement(Tag, hostProps);\n }\n);\nTypography.displayName = \"Typography\";\n","import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport {\n Typography,\n type TypographyContent,\n type TypographyLevel,\n type TypographyTone,\n} from \"./typography\";\n\n/** Figma Components → System Composition → Typeface (527:56311) */\nexport type TypefaceContent =\n | \"allCustom\"\n | \"textCaption\"\n | \"textCaptionSubtitle\"\n | \"textTitle\"\n | \"textHeadline2\"\n | \"textHeadline1\";\n\ntype TypefaceLine = {\n level: TypographyLevel;\n content?: TypographyContent;\n tone?: TypographyTone;\n children: ReactNode;\n};\n\nconst typefaceLayouts: Record<TypefaceContent, TypefaceLine[]> = {\n allCustom: [\n { level: \"text\", children: null },\n { level: \"caption\", children: null },\n ],\n textCaption: [\n { level: \"text\", children: null },\n { level: \"caption\", children: null },\n ],\n textCaptionSubtitle: [\n { level: \"subtitle\", children: null },\n { level: \"text\", children: null },\n { level: \"caption\", children: null },\n ],\n textTitle: [\n { level: \"title\", children: null },\n { level: \"text\", children: null },\n ],\n textHeadline2: [\n { level: \"headline2\", children: null },\n { level: \"text\", children: null },\n ],\n textHeadline1: [\n { level: \"headline1\", children: null },\n { level: \"text\", children: null },\n ],\n};\n\nexport type TypefaceProps = Omit<HTMLAttributes<HTMLDivElement>, \"content\"> & {\n /** Figma `Content` preset */\n content?: TypefaceContent;\n /** Primary line — overrides preset first line */\n primary?: ReactNode;\n /** Secondary line — overrides preset second line */\n secondary?: ReactNode;\n /** Tertiary line — used by `textCaptionSubtitle` */\n tertiary?: ReactNode;\n /** Per-line content mode for numeric text */\n primaryContent?: TypographyContent;\n secondaryContent?: TypographyContent;\n tertiaryContent?: TypographyContent;\n tone?: TypographyTone;\n};\n\nexport const Typeface = forwardRef<HTMLDivElement, TypefaceProps>(\n (\n {\n className,\n content = \"allCustom\",\n primary,\n secondary,\n tertiary,\n primaryContent = \"text\",\n secondaryContent = \"text\",\n tertiaryContent = \"text\",\n tone = \"default\",\n children,\n ...props\n },\n ref\n ) => {\n const layout = typefaceLayouts[content];\n const values = resolveTypefaceValues(\n primary,\n secondary,\n tertiary,\n children\n );\n\n return (\n <div\n ref={ref}\n className={cn(\"aviala-typeface\", className)}\n data-content={content}\n {...props}\n >\n {layout.map((line, index) => {\n const value = values[index];\n if (value === undefined || value === null || value === false)\n return null;\n\n const lineContent =\n index === 0\n ? primaryContent\n : index === 1\n ? secondaryContent\n : tertiaryContent;\n\n return (\n <span\n key={`${line.level}-${index}`}\n className=\"aviala-typeface__line\"\n data-line={index}\n >\n <Typography level={line.level} content={lineContent} tone={tone}>\n {value}\n </Typography>\n </span>\n );\n })}\n </div>\n );\n }\n);\nTypeface.displayName = \"Typeface\";\n\nfunction resolveTypefaceValues(\n primary?: ReactNode,\n secondary?: ReactNode,\n tertiary?: ReactNode,\n children?: ReactNode\n): ReactNode[] {\n if (\n primary !== undefined ||\n secondary !== undefined ||\n tertiary !== undefined\n ) {\n return [primary, secondary, tertiary];\n }\n\n if (children == null || children === false) {\n return [];\n }\n\n if (Array.isArray(children)) {\n return children;\n }\n\n return [children];\n}\n\n/** Convenience helper for two-line label + caption pairs (Radio, Checkbox, etc.) */\nexport type TypefacePairProps = Omit<TypefaceProps, \"content\"> & {\n title: ReactNode;\n description?: ReactNode;\n};\n\nexport const TypefacePair = forwardRef<HTMLDivElement, TypefacePairProps>(\n ({ title, description, ...props }, ref) => (\n <Typeface\n ref={ref}\n content=\"textCaption\"\n primary={title}\n secondary={description}\n {...props}\n />\n )\n);\nTypefacePair.displayName = \"TypefacePair\";\n"],"mappings":";;;AAAA,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACLA,SAAS,eAAe,kBAAkB;AAanC,IAAM,0BACX,cAAmD,IAAI;AAMlD,SAAS,wBAAwB,WAA8B;AACpE,QAAM,MAAM,WAAW,uBAAuB;AAC9C,SAAO,aAAa,KAAK,WAAW;AACtC;;;ACvBA,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAYP,SAAS,cAAc,SAAwD;AAC7E,MAAI,SAAS,OAAO,yBAAyB,QAAQ,OAAO,KAAK,GAAG;AACpE,MAAI,UAAU,UAAU,oBAAoB,UAAU,OAAO;AAC7D,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