@zentauri-ui/zentauri-components 1.4.6 → 1.4.41
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 +1 -64
- package/cli/registry.json +1 -3
- package/package.json +3 -3
- package/dist/ui/search/filter-search-suggestions.d.ts +0 -15
- package/dist/ui/search/filter-search-suggestions.d.ts.map +0 -1
- package/dist/ui/search/index.d.ts +0 -7
- package/dist/ui/search/index.d.ts.map +0 -1
- package/dist/ui/search/search-bar.d.ts +0 -6
- package/dist/ui/search/search-bar.d.ts.map +0 -1
- package/dist/ui/search/search-suggestion-list.d.ts +0 -6
- package/dist/ui/search/search-suggestion-list.d.ts.map +0 -1
- package/dist/ui/search/search-suggestion-utils.d.ts +0 -6
- package/dist/ui/search/search-suggestion-utils.d.ts.map +0 -1
- package/dist/ui/search/types.d.ts +0 -44
- package/dist/ui/search/types.d.ts.map +0 -1
- package/dist/ui/search.js +0 -199
- package/dist/ui/search.js.map +0 -1
- package/dist/ui/search.mjs +0 -194
- package/dist/ui/search.mjs.map +0 -1
- package/dist/ui/typography/blockquote-base.d.ts +0 -6
- package/dist/ui/typography/blockquote-base.d.ts.map +0 -1
- package/dist/ui/typography/blockquote.d.ts +0 -6
- package/dist/ui/typography/blockquote.d.ts.map +0 -1
- package/dist/ui/typography/code-block-base.d.ts +0 -6
- package/dist/ui/typography/code-block-base.d.ts.map +0 -1
- package/dist/ui/typography/code-block.d.ts +0 -6
- package/dist/ui/typography/code-block.d.ts.map +0 -1
- package/dist/ui/typography/heading-base.d.ts +0 -6
- package/dist/ui/typography/heading-base.d.ts.map +0 -1
- package/dist/ui/typography/heading.d.ts +0 -6
- package/dist/ui/typography/heading.d.ts.map +0 -1
- package/dist/ui/typography/index.d.ts +0 -9
- package/dist/ui/typography/index.d.ts.map +0 -1
- package/dist/ui/typography/inline-code-base.d.ts +0 -6
- package/dist/ui/typography/inline-code-base.d.ts.map +0 -1
- package/dist/ui/typography/inline-code.d.ts +0 -6
- package/dist/ui/typography/inline-code.d.ts.map +0 -1
- package/dist/ui/typography/list-base.d.ts +0 -10
- package/dist/ui/typography/list-base.d.ts.map +0 -1
- package/dist/ui/typography/list.d.ts +0 -12
- package/dist/ui/typography/list.d.ts.map +0 -1
- package/dist/ui/typography/text-base.d.ts +0 -6
- package/dist/ui/typography/text-base.d.ts.map +0 -1
- package/dist/ui/typography/text.d.ts +0 -6
- package/dist/ui/typography/text.d.ts.map +0 -1
- package/dist/ui/typography/types.d.ts +0 -56
- package/dist/ui/typography/types.d.ts.map +0 -1
- package/dist/ui/typography/variants.d.ts +0 -16
- package/dist/ui/typography/variants.d.ts.map +0 -1
- package/dist/ui/typography.js +0 -334
- package/dist/ui/typography.js.map +0 -1
- package/dist/ui/typography.mjs +0 -321
- package/dist/ui/typography.mjs.map +0 -1
- package/src/ui/search/filter-search-suggestions.test.ts +0 -48
- package/src/ui/search/filter-search-suggestions.ts +0 -43
- package/src/ui/search/index.ts +0 -11
- package/src/ui/search/search-bar.tsx +0 -83
- package/src/ui/search/search-suggestion-list.tsx +0 -103
- package/src/ui/search/search-suggestion-utils.test.ts +0 -9
- package/src/ui/search/search-suggestion-utils.ts +0 -8
- package/src/ui/search/types.ts +0 -52
- package/src/ui/typography/blockquote-base.tsx +0 -39
- package/src/ui/typography/blockquote.tsx +0 -8
- package/src/ui/typography/code-block-base.tsx +0 -37
- package/src/ui/typography/code-block.tsx +0 -8
- package/src/ui/typography/heading-base.tsx +0 -59
- package/src/ui/typography/heading.tsx +0 -8
- package/src/ui/typography/index.ts +0 -28
- package/src/ui/typography/inline-code-base.tsx +0 -27
- package/src/ui/typography/inline-code.tsx +0 -8
- package/src/ui/typography/list-base.tsx +0 -88
- package/src/ui/typography/list.tsx +0 -15
- package/src/ui/typography/text-base.tsx +0 -43
- package/src/ui/typography/text.tsx +0 -8
- package/src/ui/typography/types.ts +0 -90
- package/src/ui/typography/typography.test.tsx +0 -80
- package/src/ui/typography/variants.ts +0 -72
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { cn } from "../../lib/utils";
|
|
2
|
-
|
|
3
|
-
import type { ListProps, ListItemProps } from "./types";
|
|
4
|
-
import {
|
|
5
|
-
orderedListVariants,
|
|
6
|
-
typographyToneVariants,
|
|
7
|
-
unorderedListMarkerVariants,
|
|
8
|
-
} from "./variants";
|
|
9
|
-
|
|
10
|
-
export function ListBase(props: ListProps) {
|
|
11
|
-
if ("ordered" in props && props.ordered === true) {
|
|
12
|
-
const {
|
|
13
|
-
tone,
|
|
14
|
-
className,
|
|
15
|
-
children,
|
|
16
|
-
ref,
|
|
17
|
-
ordered,
|
|
18
|
-
marker,
|
|
19
|
-
...rest
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
void ordered;
|
|
23
|
-
void marker;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<ol
|
|
27
|
-
ref={ref}
|
|
28
|
-
data-slot="typography-list"
|
|
29
|
-
data-list-type="ordered"
|
|
30
|
-
className={cn(
|
|
31
|
-
typographyToneVariants({ tone }),
|
|
32
|
-
orderedListVariants(),
|
|
33
|
-
className,
|
|
34
|
-
)}
|
|
35
|
-
{...rest}
|
|
36
|
-
>
|
|
37
|
-
{children}
|
|
38
|
-
</ol>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
marker = "disc",
|
|
44
|
-
tone,
|
|
45
|
-
className,
|
|
46
|
-
children,
|
|
47
|
-
ref,
|
|
48
|
-
ordered,
|
|
49
|
-
...rest
|
|
50
|
-
} = props;
|
|
51
|
-
|
|
52
|
-
void ordered;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<ul
|
|
56
|
-
ref={ref}
|
|
57
|
-
data-slot="typography-list"
|
|
58
|
-
data-list-type="unordered"
|
|
59
|
-
className={cn(
|
|
60
|
-
typographyToneVariants({ tone }),
|
|
61
|
-
unorderedListMarkerVariants({ marker }),
|
|
62
|
-
className,
|
|
63
|
-
)}
|
|
64
|
-
{...rest}
|
|
65
|
-
>
|
|
66
|
-
{children}
|
|
67
|
-
</ul>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
ListBase.displayName = "List";
|
|
72
|
-
|
|
73
|
-
export function ListItemBase(props: ListItemProps) {
|
|
74
|
-
const { className, children, ref, ...rest } = props;
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<li
|
|
78
|
-
ref={ref}
|
|
79
|
-
data-slot="typography-list-item"
|
|
80
|
-
className={cn("leading-relaxed", className)}
|
|
81
|
-
{...rest}
|
|
82
|
-
>
|
|
83
|
-
{children}
|
|
84
|
-
</li>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
ListItemBase.displayName = "ListItem";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ListProps } from "./types";
|
|
2
|
-
|
|
3
|
-
import { ListBase, ListItemBase } from "./list-base";
|
|
4
|
-
|
|
5
|
-
export const ListItem = ListItemBase;
|
|
6
|
-
|
|
7
|
-
function ListRoot(props: ListProps) {
|
|
8
|
-
return <ListBase {...props} />;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const List = Object.assign(ListRoot, {
|
|
12
|
-
Item: ListItem,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
ListRoot.displayName = "List";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { cn } from "../../lib/utils";
|
|
2
|
-
|
|
3
|
-
import type { TextProps } from "./types";
|
|
4
|
-
import { textSizeVariants, typographyToneVariants } from "./variants";
|
|
5
|
-
|
|
6
|
-
export const TextBase = (props: TextProps) => {
|
|
7
|
-
const {
|
|
8
|
-
as = "p",
|
|
9
|
-
size = "base",
|
|
10
|
-
tone,
|
|
11
|
-
bold,
|
|
12
|
-
italic,
|
|
13
|
-
underline,
|
|
14
|
-
strikethrough,
|
|
15
|
-
highlight,
|
|
16
|
-
className,
|
|
17
|
-
children,
|
|
18
|
-
...rest
|
|
19
|
-
} = props;
|
|
20
|
-
|
|
21
|
-
const Component = as;
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Component
|
|
25
|
-
data-slot="typography-text"
|
|
26
|
-
className={cn(
|
|
27
|
-
typographyToneVariants({ tone }),
|
|
28
|
-
textSizeVariants({ size }),
|
|
29
|
-
bold && "font-semibold",
|
|
30
|
-
italic && "italic",
|
|
31
|
-
underline && "underline underline-offset-2",
|
|
32
|
-
strikethrough && "line-through",
|
|
33
|
-
highlight && "rounded bg-amber-400/15 px-0.5",
|
|
34
|
-
className,
|
|
35
|
-
)}
|
|
36
|
-
{...rest}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</Component>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
TextBase.displayName = "Text";
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { VariantProps } from "class-variance-authority";
|
|
2
|
-
import type {
|
|
3
|
-
ComponentProps,
|
|
4
|
-
HTMLAttributes,
|
|
5
|
-
RefObject,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
import type {
|
|
9
|
-
textSizeVariants,
|
|
10
|
-
typographyToneVariants,
|
|
11
|
-
unorderedListMarkerVariants,
|
|
12
|
-
} from "./variants";
|
|
13
|
-
|
|
14
|
-
export type TypographyTone = NonNullable<
|
|
15
|
-
VariantProps<typeof typographyToneVariants>["tone"]
|
|
16
|
-
>;
|
|
17
|
-
|
|
18
|
-
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
19
|
-
|
|
20
|
-
export type HeadingProps = Omit<
|
|
21
|
-
ComponentProps<"h1">,
|
|
22
|
-
"color"
|
|
23
|
-
> & {
|
|
24
|
-
level: HeadingLevel;
|
|
25
|
-
/** Visual scale; defaults to `level`. */
|
|
26
|
-
displayLevel?: HeadingLevel;
|
|
27
|
-
tone?: TypographyTone;
|
|
28
|
-
bold?: boolean;
|
|
29
|
-
italic?: boolean;
|
|
30
|
-
underline?: boolean;
|
|
31
|
-
strikethrough?: boolean;
|
|
32
|
-
ref?: RefObject<HTMLHeadingElement>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type TextElement = "p" | "span" | "div" | "label";
|
|
36
|
-
|
|
37
|
-
export type TextProps = Omit<HTMLAttributes<HTMLElement>, "color"> & {
|
|
38
|
-
as?: TextElement;
|
|
39
|
-
size?: NonNullable<VariantProps<typeof textSizeVariants>["size"]>;
|
|
40
|
-
tone?: TypographyTone;
|
|
41
|
-
bold?: boolean;
|
|
42
|
-
italic?: boolean;
|
|
43
|
-
underline?: boolean;
|
|
44
|
-
strikethrough?: boolean;
|
|
45
|
-
highlight?: boolean;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type UnorderedMarker = NonNullable<
|
|
49
|
-
VariantProps<typeof unorderedListMarkerVariants>["marker"]
|
|
50
|
-
>;
|
|
51
|
-
|
|
52
|
-
export type ListProps =
|
|
53
|
-
| (Omit<ComponentProps<"ul">, "color"> & {
|
|
54
|
-
ordered?: false;
|
|
55
|
-
marker?: UnorderedMarker;
|
|
56
|
-
tone?: TypographyTone;
|
|
57
|
-
})
|
|
58
|
-
| (Omit<ComponentProps<"ol">, "color"> & {
|
|
59
|
-
ordered: true;
|
|
60
|
-
marker?: undefined;
|
|
61
|
-
tone?: TypographyTone;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export type ListItemProps = ComponentProps<"li"> & {
|
|
65
|
-
ref?: RefObject<HTMLLIElement>;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type BlockquoteProps = ComponentProps<"blockquote"> & {
|
|
69
|
-
tone?: TypographyTone;
|
|
70
|
-
/** Attribution label shown in a footer (distinct from the HTML `cite` URL attribute). */
|
|
71
|
-
attribution?: string;
|
|
72
|
-
ref?: RefObject<HTMLQuoteElement>;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type InlineCodeProps = Omit<
|
|
76
|
-
ComponentProps<"code">,
|
|
77
|
-
"color"
|
|
78
|
-
> & {
|
|
79
|
-
tone?: TypographyTone;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export type CodeBlockProps = Omit<
|
|
83
|
-
ComponentProps<"pre">,
|
|
84
|
-
"color"
|
|
85
|
-
> & {
|
|
86
|
-
tone?: TypographyTone;
|
|
87
|
-
/** Hint for stacked highlighting stacks / aria-labels. */
|
|
88
|
-
language?: string;
|
|
89
|
-
ref?: RefObject<HTMLPreElement>;
|
|
90
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { render, screen } from "@testing-library/react";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Blockquote,
|
|
6
|
-
CodeBlock,
|
|
7
|
-
Heading,
|
|
8
|
-
InlineCode,
|
|
9
|
-
List,
|
|
10
|
-
ListItem,
|
|
11
|
-
Text,
|
|
12
|
-
} from "./index";
|
|
13
|
-
|
|
14
|
-
describe("Typography primitives", () => {
|
|
15
|
-
it("should render Heading as the requested level with displayName", () => {
|
|
16
|
-
render(<Heading level={2}>Section</Heading>);
|
|
17
|
-
expect(
|
|
18
|
-
screen.getByRole("heading", { level: 2, name: "Section" }),
|
|
19
|
-
).toBeInTheDocument();
|
|
20
|
-
expect(Heading.displayName).toBe("Heading");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should apply tone classes on Text", () => {
|
|
24
|
-
const { container } = render(
|
|
25
|
-
<Text tone="muted" data-testid="muted-text">
|
|
26
|
-
Body
|
|
27
|
-
</Text>,
|
|
28
|
-
);
|
|
29
|
-
const node = container.querySelector('[data-testid="muted-text"]');
|
|
30
|
-
expect(node?.className).toMatch(/text-slate-400/);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should render unordered List with list marker utilities", () => {
|
|
34
|
-
const { container } = render(
|
|
35
|
-
<List>
|
|
36
|
-
<ListItem>Alpha</ListItem>
|
|
37
|
-
</List>,
|
|
38
|
-
);
|
|
39
|
-
const ul = container.querySelector('[data-slot="typography-list"]');
|
|
40
|
-
expect(ul?.tagName).toBe("UL");
|
|
41
|
-
expect(ul?.className).toMatch(/list-disc/);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should render ordered List as ol", () => {
|
|
45
|
-
const { container } = render(
|
|
46
|
-
<List ordered>
|
|
47
|
-
<ListItem>One</ListItem>
|
|
48
|
-
</List>,
|
|
49
|
-
);
|
|
50
|
-
const ol = container.querySelector('[data-slot="typography-list"]');
|
|
51
|
-
expect(ol?.tagName).toBe("OL");
|
|
52
|
-
expect(ol?.className).toMatch(/list-decimal/);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("should render Blockquote with optional attribution footer", () => {
|
|
56
|
-
render(
|
|
57
|
-
<Blockquote attribution="Source">
|
|
58
|
-
<p>Quoted</p>
|
|
59
|
-
</Blockquote>,
|
|
60
|
-
);
|
|
61
|
-
expect(screen.getByText("Quoted")).toBeInTheDocument();
|
|
62
|
-
expect(screen.getByText("Source")).toBeInTheDocument();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("should render InlineCode with monospace styling token", () => {
|
|
66
|
-
const { container } = render(<InlineCode>npm i</InlineCode>);
|
|
67
|
-
const code = container.querySelector('[data-slot="typography-inline-code"]');
|
|
68
|
-
expect(code?.tagName).toBe("CODE");
|
|
69
|
-
expect(code?.className).toMatch(/font-mono/);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("should render CodeBlock with nested code element", () => {
|
|
73
|
-
const { container } = render(
|
|
74
|
-
<CodeBlock language="tsx">{`const x = 1;`}</CodeBlock>,
|
|
75
|
-
);
|
|
76
|
-
const pre = container.querySelector('[data-slot="typography-code-block"]');
|
|
77
|
-
expect(pre?.tagName).toBe("PRE");
|
|
78
|
-
expect(pre?.querySelector("code")?.textContent).toContain("const x");
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
/** Semantic text colors aligned with slate/cyan/violet accents used across the kit (dark-first). */
|
|
4
|
-
export const typographyToneVariants = cva("", {
|
|
5
|
-
variants: {
|
|
6
|
-
tone: {
|
|
7
|
-
default: "text-slate-50 border-white/15",
|
|
8
|
-
muted: "text-slate-400 border-white/15",
|
|
9
|
-
primary: "text-cyan-300 border-cyan-300/40",
|
|
10
|
-
secondary: "text-slate-300 border-white/15",
|
|
11
|
-
accent: "text-violet-300 border-violet-300/40",
|
|
12
|
-
destructive: "text-rose-400 border-rose-300/40",
|
|
13
|
-
info: "text-sky-300 border-sky-300/40",
|
|
14
|
-
success: "text-emerald-300 border-emerald-300/40",
|
|
15
|
-
warning: "text-amber-300 border-amber-300/40",
|
|
16
|
-
error: "text-red-300 border-red-300/40",
|
|
17
|
-
"gradient-pink-violet": "bg-linear-to-r from-pink-400 to-violet-400 bg-clip-text text-transparent w-fit",
|
|
18
|
-
"gradient-cyan-violet": "bg-linear-to-r from-cyan-400 to-violet-400 bg-clip-text text-transparent w-fit",
|
|
19
|
-
"gradient-cyan-blue": "bg-linear-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent w-fit",
|
|
20
|
-
"gradient-cyan-green": "bg-linear-to-r from-cyan-400 to-green-400 bg-clip-text text-transparent w-fit",
|
|
21
|
-
"gradient-cyan-orange": "bg-linear-to-r from-cyan-400 to-orange-400 bg-clip-text text-transparent w-fit",
|
|
22
|
-
"gradient-cyan-red": "bg-linear-to-r from-cyan-400 to-red-400 bg-clip-text text-transparent w-fit",
|
|
23
|
-
"gradient-cyan-purple": "bg-linear-to-r from-cyan-400 to-purple-400 bg-clip-text text-transparent w-fit",
|
|
24
|
-
"gradient-cyan-pink": "bg-linear-to-r from-cyan-400 to-pink-400 bg-clip-text text-transparent w-fit",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
tone: "default",
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const headingLevelVariants = cva("scroll-m-20", {
|
|
33
|
-
variants: {
|
|
34
|
-
level: {
|
|
35
|
-
1: "text-4xl font-bold tracking-tight md:text-5xl",
|
|
36
|
-
2: "text-3xl font-semibold tracking-tight",
|
|
37
|
-
3: "text-2xl font-semibold tracking-tight",
|
|
38
|
-
4: "text-xl font-semibold tracking-tight",
|
|
39
|
-
5: "text-lg font-medium",
|
|
40
|
-
6: "text-base font-medium",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export const textSizeVariants = cva("", {
|
|
46
|
-
variants: {
|
|
47
|
-
size: {
|
|
48
|
-
sm: "text-sm leading-relaxed",
|
|
49
|
-
base: "text-base leading-relaxed",
|
|
50
|
-
lg: "text-lg leading-relaxed",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
defaultVariants: {
|
|
54
|
-
size: "base",
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
/** Marker style for unordered lists; ignored when `ordered` is true (decimal numbering). */
|
|
59
|
-
export const unorderedListMarkerVariants = cva("space-y-2 pl-5", {
|
|
60
|
-
variants: {
|
|
61
|
-
marker: {
|
|
62
|
-
disc: "list-disc",
|
|
63
|
-
circle: "[list-style-type:circle]",
|
|
64
|
-
none: "list-none pl-0",
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
defaultVariants: {
|
|
68
|
-
marker: "disc",
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export const orderedListVariants = cva("list-decimal space-y-2 pl-5");
|