@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/typography/variants.ts","../../src/ui/typography/heading-base.tsx","../../src/ui/typography/heading.tsx","../../src/ui/typography/text-base.tsx","../../src/ui/typography/text.tsx","../../src/ui/typography/list-base.tsx","../../src/ui/typography/list.tsx","../../src/ui/typography/blockquote-base.tsx","../../src/ui/typography/blockquote.tsx","../../src/ui/typography/inline-code-base.tsx","../../src/ui/typography/inline-code.tsx","../../src/ui/typography/code-block-base.tsx","../../src/ui/typography/code-block.tsx"],"names":["jsx","tone","className","children","ref","ordered","marker","rest"],"mappings":";;;;AAGO,IAAM,sBAAA,GAAyB,IAAI,EAAA,EAAI;AAAA,EAC5C,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,+BAAA;AAAA,MACT,KAAA,EAAO,gCAAA;AAAA,MACP,OAAA,EAAS,kCAAA;AAAA,MACT,SAAA,EAAW,gCAAA;AAAA,MACX,MAAA,EAAQ,sCAAA;AAAA,MACR,WAAA,EAAa,kCAAA;AAAA,MACb,IAAA,EAAM,gCAAA;AAAA,MACN,OAAA,EAAS,wCAAA;AAAA,MACT,OAAA,EAAS,oCAAA;AAAA,MACT,KAAA,EAAO,gCAAA;AAAA,MACP,sBAAA,EAAwB,gFAAA;AAAA,MACxB,sBAAA,EAAwB,gFAAA;AAAA,MACxB,oBAAA,EAAsB,8EAAA;AAAA,MACtB,qBAAA,EAAuB,+EAAA;AAAA,MACvB,sBAAA,EAAwB,gFAAA;AAAA,MACxB,mBAAA,EAAqB,6EAAA;AAAA,MACrB,sBAAA,EAAwB,gFAAA;AAAA,MACxB,oBAAA,EAAsB;AAAA;AACxB,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,IAAA,EAAM;AAAA;AAEV,CAAC;AAEM,IAAM,oBAAA,GAAuB,IAAI,aAAA,EAAe;AAAA,EACrD,QAAA,EAAU;AAAA,IACR,KAAA,EAAO;AAAA,MACL,CAAA,EAAG,+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":"typography.mjs","sourcesContent":["import { cva } from \"class-variance-authority\";\n\n/** Semantic text colors aligned with slate/cyan/violet accents used across the kit (dark-first). */\nexport const typographyToneVariants = cva(\"\", {\n variants: {\n tone: {\n default: \"text-slate-50 border-white/15\",\n muted: \"text-slate-400 border-white/15\",\n primary: \"text-cyan-300 border-cyan-300/40\",\n secondary: \"text-slate-300 border-white/15\",\n accent: \"text-violet-300 border-violet-300/40\",\n destructive: \"text-rose-400 border-rose-300/40\",\n info: \"text-sky-300 border-sky-300/40\",\n success: \"text-emerald-300 border-emerald-300/40\",\n warning: \"text-amber-300 border-amber-300/40\",\n error: \"text-red-300 border-red-300/40\",\n \"gradient-pink-violet\": \"bg-linear-to-r from-pink-400 to-violet-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-violet\": \"bg-linear-to-r from-cyan-400 to-violet-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-blue\": \"bg-linear-to-r from-cyan-400 to-blue-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-green\": \"bg-linear-to-r from-cyan-400 to-green-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-orange\": \"bg-linear-to-r from-cyan-400 to-orange-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-red\": \"bg-linear-to-r from-cyan-400 to-red-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-purple\": \"bg-linear-to-r from-cyan-400 to-purple-400 bg-clip-text text-transparent w-fit\",\n \"gradient-cyan-pink\": \"bg-linear-to-r from-cyan-400 to-pink-400 bg-clip-text text-transparent w-fit\",\n },\n },\n defaultVariants: {\n tone: \"default\",\n },\n});\n\nexport const headingLevelVariants = cva(\"scroll-m-20\", {\n variants: {\n level: {\n 1: \"text-4xl font-bold tracking-tight md:text-5xl\",\n 2: \"text-3xl font-semibold tracking-tight\",\n 3: \"text-2xl font-semibold tracking-tight\",\n 4: \"text-xl font-semibold tracking-tight\",\n 5: \"text-lg font-medium\",\n 6: \"text-base font-medium\",\n },\n },\n});\n\nexport const textSizeVariants = cva(\"\", {\n variants: {\n size: {\n sm: \"text-sm leading-relaxed\",\n base: \"text-base leading-relaxed\",\n lg: \"text-lg leading-relaxed\",\n },\n },\n defaultVariants: {\n size: \"base\",\n },\n});\n\n/** Marker style for unordered lists; ignored when `ordered` is true (decimal numbering). */\nexport const unorderedListMarkerVariants = cva(\"space-y-2 pl-5\", {\n variants: {\n marker: {\n disc: \"list-disc\",\n circle: \"[list-style-type:circle]\",\n none: \"list-none pl-0\",\n },\n },\n defaultVariants: {\n marker: \"disc\",\n },\n});\n\nexport const orderedListVariants = cva(\"list-decimal space-y-2 pl-5\");\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { HeadingProps } from \"./types\";\nimport {\n headingLevelVariants,\n typographyToneVariants,\n} from \"./variants\";\n\nconst HEADING_TAGS = {\n 1: \"h1\",\n 2: \"h2\",\n 3: \"h3\",\n 4: \"h4\",\n 5: \"h5\",\n 6: \"h6\",\n} as const;\n\nexport const HeadingBase = (props: HeadingProps) => {\n const {\n level,\n displayLevel,\n tone,\n bold,\n italic,\n underline,\n strikethrough,\n ref,\n className,\n children,\n ...rest\n } = props;\n\n const Tag = HEADING_TAGS[level];\n const scale = displayLevel ?? level;\n\n return (\n <Tag\n ref={ref}\n data-slot=\"typography-heading\"\n data-level={level}\n className={cn(\n typographyToneVariants({ tone }),\n headingLevelVariants({ level: scale }),\n bold && \"font-bold\",\n italic && \"italic\",\n underline && \"underline underline-offset-4\",\n strikethrough && \"line-through\",\n className,\n )}\n {...rest}\n >\n {children}\n </Tag>\n );\n};\n\nHeadingBase.displayName = \"Heading\";\n","import { HeadingBase } from \"./heading-base\";\nimport type { HeadingProps } from \"./types\";\n\nexport const Heading = (props: HeadingProps) => {\n return <HeadingBase {...props} />;\n};\n\nHeading.displayName = \"Heading\";\n","import { cn } from \"../../lib/utils\";\n\nimport type { TextProps } from \"./types\";\nimport { textSizeVariants, typographyToneVariants } from \"./variants\";\n\nexport const TextBase = (props: TextProps) => {\n const {\n as = \"p\",\n size = \"base\",\n tone,\n bold,\n italic,\n underline,\n strikethrough,\n highlight,\n className,\n children,\n ...rest\n } = props;\n\n const Component = as;\n\n return (\n <Component\n data-slot=\"typography-text\"\n className={cn(\n typographyToneVariants({ tone }),\n textSizeVariants({ size }),\n bold && \"font-semibold\",\n italic && \"italic\",\n underline && \"underline underline-offset-2\",\n strikethrough && \"line-through\",\n highlight && \"rounded bg-amber-400/15 px-0.5\",\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n};\n\nTextBase.displayName = \"Text\";\n","import { TextBase } from \"./text-base\";\nimport type { TextProps } from \"./types\";\n\nexport const Text = (props: TextProps) => {\n return <TextBase {...props} />;\n};\n\nText.displayName = \"Text\";\n","import { cn } from \"../../lib/utils\";\n\nimport type { ListProps, ListItemProps } from \"./types\";\nimport {\n orderedListVariants,\n typographyToneVariants,\n unorderedListMarkerVariants,\n} from \"./variants\";\n\nexport function ListBase(props: ListProps) {\n if (\"ordered\" in props && props.ordered === true) {\n const {\n tone,\n className,\n children,\n ref,\n ordered,\n marker,\n ...rest\n } = props;\n\n void ordered;\n void marker;\n\n return (\n <ol\n ref={ref}\n data-slot=\"typography-list\"\n data-list-type=\"ordered\"\n className={cn(\n typographyToneVariants({ tone }),\n orderedListVariants(),\n className,\n )}\n {...rest}\n >\n {children}\n </ol>\n );\n }\n\n const {\n marker = \"disc\",\n tone,\n className,\n children,\n ref,\n ordered,\n ...rest\n } = props;\n\n void ordered;\n\n return (\n <ul\n ref={ref}\n data-slot=\"typography-list\"\n data-list-type=\"unordered\"\n className={cn(\n typographyToneVariants({ tone }),\n unorderedListMarkerVariants({ marker }),\n className,\n )}\n {...rest}\n >\n {children}\n </ul>\n );\n}\n\nListBase.displayName = \"List\";\n\nexport function ListItemBase(props: ListItemProps) {\n const { className, children, ref, ...rest } = props;\n\n return (\n <li\n ref={ref}\n data-slot=\"typography-list-item\"\n className={cn(\"leading-relaxed\", className)}\n {...rest}\n >\n {children}\n </li>\n );\n}\n\nListItemBase.displayName = \"ListItem\";\n","import type { ListProps } from \"./types\";\n\nimport { ListBase, ListItemBase } from \"./list-base\";\n\nexport const ListItem = ListItemBase;\n\nfunction ListRoot(props: ListProps) {\n return <ListBase {...props} />;\n}\n\nexport const List = Object.assign(ListRoot, {\n Item: ListItem,\n});\n\nListRoot.displayName = \"List\";\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { BlockquoteProps } from \"./types\";\nimport { typographyToneVariants } from \"./variants\";\n\nexport const BlockquoteBase = (props: BlockquoteProps) => {\n const {\n tone,\n attribution,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n return (\n <blockquote\n ref={ref}\n data-slot=\"typography-blockquote\"\n className={cn(\n typographyToneVariants({ tone }),\n \"border-l-4 py-1 pl-4 italic\",\n className,\n )}\n {...rest}\n >\n <div className=\"space-y-2 leading-relaxed\">{children}</div>\n {attribution ? (\n <footer className=\"mt-3 text-sm not-italic\">\n <cite>{attribution}</cite>\n </footer>\n ) : null}\n </blockquote>\n );\n};\n\nBlockquoteBase.displayName = \"Blockquote\";\n","import { BlockquoteBase } from \"./blockquote-base\";\nimport type { BlockquoteProps } from \"./types\";\n\nexport const Blockquote = (props: BlockquoteProps) => {\n return <BlockquoteBase {...props} />;\n};\n\nBlockquote.displayName = \"Blockquote\";\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { InlineCodeProps } from \"./types\";\nimport { typographyToneVariants } from \"./variants\";\n\nexport const InlineCodeBase = (props: InlineCodeProps) => {\n const { tone, className, children, ref, ...rest } = props;\n\n return (\n <code\n ref={ref}\n data-slot=\"typography-inline-code\"\n className={cn(\n typographyToneVariants({ tone }),\n \"rounded-md border border-white/10 bg-white/6 px-1.5 py-0.5 font-mono text-[0.925em] font-normal\",\n className,\n )}\n {...rest}\n >\n {children}\n </code>\n );\n};\n\nInlineCodeBase.displayName = \"InlineCode\";\n","import { InlineCodeBase } from \"./inline-code-base\";\nimport type { InlineCodeProps } from \"./types\";\n\nexport const InlineCode = (props: InlineCodeProps) => {\n return <InlineCodeBase {...props} />;\n};\n\nInlineCode.displayName = \"InlineCode\";\n","import { forwardRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { CodeBlockProps } from \"./types\";\nimport { typographyToneVariants } from \"./variants\";\n\nexport const CodeBlockBase = (props: CodeBlockProps) => {\n const {\n tone,\n language,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n const ariaLabel = language ? `Code sample (${language})` : \"Code sample\";\n\n return (\n <pre\n ref={ref}\n data-slot=\"typography-code-block\"\n aria-label={ariaLabel}\n className={cn(\n typographyToneVariants({ tone }),\n \"overflow-x-auto rounded-xl border border-white/10 bg-slate-950/80 p-4 text-sm leading-relaxed shadow-inner shadow-slate-950/40\",\n className,\n )}\n {...rest}\n >\n <code className=\"font-mono text-[0.95em]\">{children}</code>\n </pre>\n );\n};\n\nCodeBlockBase.displayName = \"CodeBlock\";\n","import { CodeBlockBase } from \"./code-block-base\";\nimport type { CodeBlockProps } from \"./types\";\n\nexport const CodeBlock = (props: CodeBlockProps) => {\n return <CodeBlockBase {...props} />;\n};\n\nCodeBlock.displayName = \"CodeBlock\";\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { filterSearchSuggestions } from "./filter-search-suggestions";
|
|
4
|
-
import type { SearchFilterable } from "./types";
|
|
5
|
-
|
|
6
|
-
const sampleItems: SearchFilterable[] = [
|
|
7
|
-
{ id: "1", label: "Installation", href: "/preview/installation", keywords: ["npm", "setup"] },
|
|
8
|
-
{ id: "2", label: "Modal", href: "/preview/components/modal" },
|
|
9
|
-
{ id: "3", label: "GitHub", href: "https://example.com/repo", keywords: ["github", "source"] },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
describe("filterSearchSuggestions", () => {
|
|
13
|
-
it("returns empty list for whitespace-only query", () => {
|
|
14
|
-
expect(filterSearchSuggestions({ query: " ", items: sampleItems })).toEqual([]);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("returns empty list for empty query", () => {
|
|
18
|
-
expect(filterSearchSuggestions({ query: "", items: sampleItems })).toEqual([]);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("matches label case-insensitively", () => {
|
|
22
|
-
expect(filterSearchSuggestions({ query: "modal", items: sampleItems })).toEqual([
|
|
23
|
-
{ id: "2", label: "Modal", href: "/preview/components/modal" },
|
|
24
|
-
]);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("matches href substring", () => {
|
|
28
|
-
expect(filterSearchSuggestions({ query: "installation", items: sampleItems })).toEqual([
|
|
29
|
-
{ id: "1", label: "Installation", href: "/preview/installation", keywords: ["npm", "setup"] },
|
|
30
|
-
]);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("matches keywords", () => {
|
|
34
|
-
expect(filterSearchSuggestions({ query: "github", items: sampleItems })).toEqual([
|
|
35
|
-
{ id: "3", label: "GitHub", href: "https://example.com/repo", keywords: ["github", "source"] },
|
|
36
|
-
]);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("respects maxResults", () => {
|
|
40
|
-
const many: SearchFilterable[] = Array.from({ length: 30 }, (_, index) => ({
|
|
41
|
-
id: `x-${index}`,
|
|
42
|
-
label: `Item ${index}`,
|
|
43
|
-
href: `/x/${index}`,
|
|
44
|
-
keywords: ["alpha"],
|
|
45
|
-
}));
|
|
46
|
-
expect(filterSearchSuggestions({ query: "alpha", items: many, options: { maxResults: 5 } })).toHaveLength(5);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { SearchFilterable } from "./types";
|
|
2
|
-
|
|
3
|
-
export type FilterSearchSuggestionsOptions = {
|
|
4
|
-
/** Maximum number of matches returned. */
|
|
5
|
-
maxResults?: number;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Returns items whose label, description, href, or keywords contain the query (case-insensitive).
|
|
10
|
-
* Whitespace-only query matches no items.
|
|
11
|
-
*/
|
|
12
|
-
export function filterSearchSuggestions<T extends SearchFilterable>({
|
|
13
|
-
query,
|
|
14
|
-
items,
|
|
15
|
-
options = { maxResults: 20 },
|
|
16
|
-
}: {
|
|
17
|
-
query: string;
|
|
18
|
-
items: readonly T[];
|
|
19
|
-
options?: FilterSearchSuggestionsOptions;
|
|
20
|
-
}): T[] {
|
|
21
|
-
const maxResults = options.maxResults ?? 20;
|
|
22
|
-
const normalized = query.trim().toLowerCase();
|
|
23
|
-
if (!normalized) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const matches: T[] = [];
|
|
28
|
-
for (const item of items) {
|
|
29
|
-
const isMatch =
|
|
30
|
-
item.label.toLowerCase().includes(normalized) ||
|
|
31
|
-
(item.description?.toLowerCase().includes(normalized)) ||
|
|
32
|
-
(item.href?.toLowerCase().includes(normalized)) ||
|
|
33
|
-
(item.keywords?.some((k) => k.toLowerCase().includes(normalized)));
|
|
34
|
-
|
|
35
|
-
if (isMatch) {
|
|
36
|
-
matches.push(item);
|
|
37
|
-
if (matches.length >= maxResults || maxResults <= 0) {
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return matches;
|
|
43
|
-
}
|
package/src/ui/search/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { SearchBar } from "./search-bar";
|
|
2
|
-
export { SearchSuggestionList } from "./search-suggestion-list";
|
|
3
|
-
export { searchSuggestionOptionDomId } from "./search-suggestion-utils";
|
|
4
|
-
export { filterSearchSuggestions } from "./filter-search-suggestions";
|
|
5
|
-
export type {
|
|
6
|
-
SearchBarProps,
|
|
7
|
-
SearchSuggestionItem,
|
|
8
|
-
SearchSuggestionListProps,
|
|
9
|
-
SearchFilterable,
|
|
10
|
-
} from "./types";
|
|
11
|
-
export type { FilterSearchSuggestionsOptions } from "./filter-search-suggestions";
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useId } from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
import { inputVariants } from "../inputs/variants";
|
|
7
|
-
|
|
8
|
-
import type { SearchBarProps } from "./types";
|
|
9
|
-
|
|
10
|
-
export const SearchBar = function SearchBar(
|
|
11
|
-
{
|
|
12
|
-
value,
|
|
13
|
-
onValueChange,
|
|
14
|
-
leadingSlot,
|
|
15
|
-
className,
|
|
16
|
-
inputClassName,
|
|
17
|
-
appearance = "default",
|
|
18
|
-
inputSize = "md",
|
|
19
|
-
ring = true,
|
|
20
|
-
id,
|
|
21
|
-
onChange,
|
|
22
|
-
disabled,
|
|
23
|
-
type,
|
|
24
|
-
comboboxListboxId,
|
|
25
|
-
comboboxActiveOptionId,
|
|
26
|
-
comboboxExpanded,
|
|
27
|
-
ref,
|
|
28
|
-
...rest
|
|
29
|
-
}: SearchBarProps,
|
|
30
|
-
) {
|
|
31
|
-
const generatedId = useId();
|
|
32
|
-
const controlId = id ?? generatedId;
|
|
33
|
-
const combobox = Boolean(comboboxListboxId);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div
|
|
37
|
-
data-slot="search-bar"
|
|
38
|
-
className={cn("relative flex w-full min-w-0 items-center", className)}
|
|
39
|
-
>
|
|
40
|
-
{leadingSlot ? (
|
|
41
|
-
<span
|
|
42
|
-
className="pointer-events-none absolute left-3 top-1/2 z-1 flex -translate-y-1/2 text-slate-400 [&_svg]:size-4"
|
|
43
|
-
aria-hidden
|
|
44
|
-
>
|
|
45
|
-
{leadingSlot}
|
|
46
|
-
</span>
|
|
47
|
-
) : null}
|
|
48
|
-
<input
|
|
49
|
-
ref={ref}
|
|
50
|
-
id={controlId}
|
|
51
|
-
type={type ?? "search"}
|
|
52
|
-
autoComplete="off"
|
|
53
|
-
spellCheck={false}
|
|
54
|
-
disabled={disabled}
|
|
55
|
-
value={value}
|
|
56
|
-
data-slot="search-bar-input"
|
|
57
|
-
className={cn(
|
|
58
|
-
inputVariants({ appearance, size: inputSize, ring, as: "input" }),
|
|
59
|
-
leadingSlot ? "pl-10" : null,
|
|
60
|
-
inputClassName,
|
|
61
|
-
)}
|
|
62
|
-
onChange={(event) => {
|
|
63
|
-
onChange?.(event);
|
|
64
|
-
onValueChange?.(event.target.value);
|
|
65
|
-
}}
|
|
66
|
-
{...(combobox
|
|
67
|
-
? {
|
|
68
|
-
role: "combobox" as const,
|
|
69
|
-
"aria-autocomplete": "list" as const,
|
|
70
|
-
"aria-controls": comboboxListboxId,
|
|
71
|
-
"aria-expanded": comboboxExpanded ?? false,
|
|
72
|
-
...(comboboxActiveOptionId
|
|
73
|
-
? { "aria-activedescendant": comboboxActiveOptionId }
|
|
74
|
-
: {}),
|
|
75
|
-
}
|
|
76
|
-
: {})}
|
|
77
|
-
{...rest}
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
SearchBar.displayName = "SearchBar";
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Fragment } from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
import { searchSuggestionOptionDomId } from "./search-suggestion-utils";
|
|
7
|
-
|
|
8
|
-
import type { SearchSuggestionListProps } from "./types";
|
|
9
|
-
|
|
10
|
-
const rowClassName =
|
|
11
|
-
"flex w-full flex-col gap-0.5 rounded-lg px-3 py-2.5 text-left text-sm transition-colors hover:bg-white/5 focus-visible:bg-white/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/50";
|
|
12
|
-
|
|
13
|
-
export function SearchSuggestionList({
|
|
14
|
-
items,
|
|
15
|
-
onSelect,
|
|
16
|
-
activeId,
|
|
17
|
-
onActiveIdChange,
|
|
18
|
-
listboxId,
|
|
19
|
-
className,
|
|
20
|
-
listClassName,
|
|
21
|
-
emptyLabel,
|
|
22
|
-
}: SearchSuggestionListProps) {
|
|
23
|
-
if (items.length === 0) {
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
data-slot="search-suggestion-list-empty"
|
|
27
|
-
className={cn("px-1 py-6 text-center text-sm text-slate-500", className)}
|
|
28
|
-
>
|
|
29
|
-
{emptyLabel ?? "No matches."}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const useListbox = Boolean(listboxId);
|
|
35
|
-
|
|
36
|
-
const rows: Array<{
|
|
37
|
-
item: (typeof items)[number];
|
|
38
|
-
showGroup: boolean;
|
|
39
|
-
}> = [];
|
|
40
|
-
let lastGroupSeen: string | undefined;
|
|
41
|
-
for (const item of items) {
|
|
42
|
-
const showGroup = Boolean(item.group && item.group !== lastGroupSeen);
|
|
43
|
-
if (item.group) {
|
|
44
|
-
lastGroupSeen = item.group;
|
|
45
|
-
}
|
|
46
|
-
rows.push({ item, showGroup });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<nav
|
|
51
|
-
data-slot="search-suggestion-list"
|
|
52
|
-
aria-label="Search results"
|
|
53
|
-
className={cn("flex max-h-[min(50vh,360px)] flex-col gap-1 overflow-y-auto pr-1", className)}
|
|
54
|
-
>
|
|
55
|
-
<div
|
|
56
|
-
{...(useListbox
|
|
57
|
-
? {
|
|
58
|
-
id: listboxId,
|
|
59
|
-
role: "listbox" as const,
|
|
60
|
-
}
|
|
61
|
-
: {})}
|
|
62
|
-
className={cn("flex flex-col gap-0.5", listClassName)}
|
|
63
|
-
>
|
|
64
|
-
{rows.map(({ item, showGroup }) => {
|
|
65
|
-
const isActive = activeId === item.id;
|
|
66
|
-
const optionDomId =
|
|
67
|
-
useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : undefined;
|
|
68
|
-
return (
|
|
69
|
-
<Fragment key={item.id}>
|
|
70
|
-
{showGroup ? (
|
|
71
|
-
<div
|
|
72
|
-
role="presentation"
|
|
73
|
-
className="sticky top-0 z-1 bg-slate-950/95 px-2 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-slate-500 backdrop-blur-sm"
|
|
74
|
-
>
|
|
75
|
-
{item.group}
|
|
76
|
-
</div>
|
|
77
|
-
) : null}
|
|
78
|
-
<button
|
|
79
|
-
type="button"
|
|
80
|
-
id={optionDomId}
|
|
81
|
-
role={useListbox ? "option" : undefined}
|
|
82
|
-
aria-selected={useListbox ? isActive : undefined}
|
|
83
|
-
data-active={isActive ? "" : undefined}
|
|
84
|
-
className={cn(rowClassName, isActive ? "bg-white/5" : null)}
|
|
85
|
-
onMouseEnter={() => onActiveIdChange?.(item.id)}
|
|
86
|
-
onFocus={() => onActiveIdChange?.(item.id)}
|
|
87
|
-
onClick={() => onSelect(item.id)}
|
|
88
|
-
>
|
|
89
|
-
<span className="font-medium text-slate-100">{item.label}</span>
|
|
90
|
-
{item.description ? (
|
|
91
|
-
<span className="truncate text-xs text-slate-500">{item.description}</span>
|
|
92
|
-
) : null}
|
|
93
|
-
</button>
|
|
94
|
-
</Fragment>
|
|
95
|
-
);
|
|
96
|
-
})}
|
|
97
|
-
</div>
|
|
98
|
-
</nav>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
SearchSuggestionList.displayName = "SearchSuggestionList";
|
|
103
|
-
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { searchSuggestionOptionDomId } from "./search-suggestion-utils";
|
|
4
|
-
|
|
5
|
-
describe("searchSuggestionOptionDomId", () => {
|
|
6
|
-
it("prefixes listbox id and sanitizes item id", () => {
|
|
7
|
-
expect(searchSuggestionOptionDomId(":lb:", "/a/b")).toBe(":lb:_opt__a_b");
|
|
8
|
-
});
|
|
9
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds a stable DOM id for a listbox option so `aria-activedescendant` on the combobox
|
|
3
|
-
* input can reference it. Safe for href-like `itemId` strings.
|
|
4
|
-
*/
|
|
5
|
-
export function searchSuggestionOptionDomId(listboxId: string, itemId: string): string {
|
|
6
|
-
const safe = itemId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
7
|
-
return `${listboxId}_opt_${safe}`;
|
|
8
|
-
}
|
package/src/ui/search/types.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
-
|
|
3
|
-
import type { VariantProps } from "class-variance-authority";
|
|
4
|
-
|
|
5
|
-
import type { inputVariants } from "../inputs/variants";
|
|
6
|
-
|
|
7
|
-
export type SearchBarProps = Omit<
|
|
8
|
-
InputHTMLAttributes<HTMLInputElement>,
|
|
9
|
-
"size" | "children" | "role"
|
|
10
|
-
> & {
|
|
11
|
-
value: string;
|
|
12
|
-
onValueChange?: (value: string) => void;
|
|
13
|
-
leadingSlot?: ReactNode;
|
|
14
|
-
inputClassName?: string;
|
|
15
|
-
appearance?: VariantProps<typeof inputVariants>["appearance"];
|
|
16
|
-
inputSize?: VariantProps<typeof inputVariants>["size"];
|
|
17
|
-
ring?: VariantProps<typeof inputVariants>["ring"];
|
|
18
|
-
/** When set, the input exposes combobox semantics wired to a `role="listbox"` with this id. */
|
|
19
|
-
comboboxListboxId?: string;
|
|
20
|
-
/** Element id of the active option (from `searchSuggestionOptionDomId`) for `aria-activedescendant`. */
|
|
21
|
-
comboboxActiveOptionId?: string;
|
|
22
|
-
/** Whether the suggestion list is visibly expanded (controls `aria-expanded`). */
|
|
23
|
-
comboboxExpanded?: boolean;
|
|
24
|
-
ref?: Ref<HTMLInputElement>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type SearchSuggestionItem = {
|
|
28
|
-
id: string;
|
|
29
|
-
label: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
group?: string;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type SearchSuggestionListProps = {
|
|
35
|
-
items: readonly SearchSuggestionItem[];
|
|
36
|
-
onSelect: (id: string) => void;
|
|
37
|
-
activeId?: string;
|
|
38
|
-
onActiveIdChange?: (id: string | undefined) => void;
|
|
39
|
-
/** Pass the same id as `comboboxListboxId` on `SearchBar` for ARIA wiring. */
|
|
40
|
-
listboxId?: string;
|
|
41
|
-
className?: string;
|
|
42
|
-
listClassName?: string;
|
|
43
|
-
emptyLabel?: ReactNode;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type SearchFilterable = {
|
|
47
|
-
id: string;
|
|
48
|
-
label: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
keywords?: readonly string[];
|
|
51
|
-
href?: string;
|
|
52
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
import type { BlockquoteProps } from "./types";
|
|
6
|
-
import { typographyToneVariants } from "./variants";
|
|
7
|
-
|
|
8
|
-
export const BlockquoteBase = (props: BlockquoteProps) => {
|
|
9
|
-
const {
|
|
10
|
-
tone,
|
|
11
|
-
attribution,
|
|
12
|
-
className,
|
|
13
|
-
children,
|
|
14
|
-
ref,
|
|
15
|
-
...rest
|
|
16
|
-
} = props;
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<blockquote
|
|
20
|
-
ref={ref}
|
|
21
|
-
data-slot="typography-blockquote"
|
|
22
|
-
className={cn(
|
|
23
|
-
typographyToneVariants({ tone }),
|
|
24
|
-
"border-l-4 py-1 pl-4 italic",
|
|
25
|
-
className,
|
|
26
|
-
)}
|
|
27
|
-
{...rest}
|
|
28
|
-
>
|
|
29
|
-
<div className="space-y-2 leading-relaxed">{children}</div>
|
|
30
|
-
{attribution ? (
|
|
31
|
-
<footer className="mt-3 text-sm not-italic">
|
|
32
|
-
<cite>{attribution}</cite>
|
|
33
|
-
</footer>
|
|
34
|
-
) : null}
|
|
35
|
-
</blockquote>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
BlockquoteBase.displayName = "Blockquote";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
import type { CodeBlockProps } from "./types";
|
|
6
|
-
import { typographyToneVariants } from "./variants";
|
|
7
|
-
|
|
8
|
-
export const CodeBlockBase = (props: CodeBlockProps) => {
|
|
9
|
-
const {
|
|
10
|
-
tone,
|
|
11
|
-
language,
|
|
12
|
-
className,
|
|
13
|
-
children,
|
|
14
|
-
ref,
|
|
15
|
-
...rest
|
|
16
|
-
} = props;
|
|
17
|
-
|
|
18
|
-
const ariaLabel = language ? `Code sample (${language})` : "Code sample";
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<pre
|
|
22
|
-
ref={ref}
|
|
23
|
-
data-slot="typography-code-block"
|
|
24
|
-
aria-label={ariaLabel}
|
|
25
|
-
className={cn(
|
|
26
|
-
typographyToneVariants({ tone }),
|
|
27
|
-
"overflow-x-auto rounded-xl border border-white/10 bg-slate-950/80 p-4 text-sm leading-relaxed shadow-inner shadow-slate-950/40",
|
|
28
|
-
className,
|
|
29
|
-
)}
|
|
30
|
-
{...rest}
|
|
31
|
-
>
|
|
32
|
-
<code className="font-mono text-[0.95em]">{children}</code>
|
|
33
|
-
</pre>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
CodeBlockBase.displayName = "CodeBlock";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
import type { HeadingProps } from "./types";
|
|
6
|
-
import {
|
|
7
|
-
headingLevelVariants,
|
|
8
|
-
typographyToneVariants,
|
|
9
|
-
} from "./variants";
|
|
10
|
-
|
|
11
|
-
const HEADING_TAGS = {
|
|
12
|
-
1: "h1",
|
|
13
|
-
2: "h2",
|
|
14
|
-
3: "h3",
|
|
15
|
-
4: "h4",
|
|
16
|
-
5: "h5",
|
|
17
|
-
6: "h6",
|
|
18
|
-
} as const;
|
|
19
|
-
|
|
20
|
-
export const HeadingBase = (props: HeadingProps) => {
|
|
21
|
-
const {
|
|
22
|
-
level,
|
|
23
|
-
displayLevel,
|
|
24
|
-
tone,
|
|
25
|
-
bold,
|
|
26
|
-
italic,
|
|
27
|
-
underline,
|
|
28
|
-
strikethrough,
|
|
29
|
-
ref,
|
|
30
|
-
className,
|
|
31
|
-
children,
|
|
32
|
-
...rest
|
|
33
|
-
} = props;
|
|
34
|
-
|
|
35
|
-
const Tag = HEADING_TAGS[level];
|
|
36
|
-
const scale = displayLevel ?? level;
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Tag
|
|
40
|
-
ref={ref}
|
|
41
|
-
data-slot="typography-heading"
|
|
42
|
-
data-level={level}
|
|
43
|
-
className={cn(
|
|
44
|
-
typographyToneVariants({ tone }),
|
|
45
|
-
headingLevelVariants({ level: scale }),
|
|
46
|
-
bold && "font-bold",
|
|
47
|
-
italic && "italic",
|
|
48
|
-
underline && "underline underline-offset-4",
|
|
49
|
-
strikethrough && "line-through",
|
|
50
|
-
className,
|
|
51
|
-
)}
|
|
52
|
-
{...rest}
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</Tag>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
HeadingBase.displayName = "Heading";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { Heading } from "./heading";
|
|
2
|
-
export { Text } from "./text";
|
|
3
|
-
export { List, ListItem } from "./list";
|
|
4
|
-
export { Blockquote } from "./blockquote";
|
|
5
|
-
export { InlineCode } from "./inline-code";
|
|
6
|
-
export { CodeBlock } from "./code-block";
|
|
7
|
-
|
|
8
|
-
export type {
|
|
9
|
-
BlockquoteProps,
|
|
10
|
-
CodeBlockProps,
|
|
11
|
-
HeadingLevel,
|
|
12
|
-
HeadingProps,
|
|
13
|
-
InlineCodeProps,
|
|
14
|
-
ListItemProps,
|
|
15
|
-
ListProps,
|
|
16
|
-
TextElement,
|
|
17
|
-
TextProps,
|
|
18
|
-
TypographyTone,
|
|
19
|
-
UnorderedMarker,
|
|
20
|
-
} from "./types";
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
headingLevelVariants,
|
|
24
|
-
orderedListVariants,
|
|
25
|
-
textSizeVariants,
|
|
26
|
-
typographyToneVariants,
|
|
27
|
-
unorderedListMarkerVariants,
|
|
28
|
-
} from "./variants";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
import type { InlineCodeProps } from "./types";
|
|
6
|
-
import { typographyToneVariants } from "./variants";
|
|
7
|
-
|
|
8
|
-
export const InlineCodeBase = (props: InlineCodeProps) => {
|
|
9
|
-
const { tone, className, children, ref, ...rest } = props;
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<code
|
|
13
|
-
ref={ref}
|
|
14
|
-
data-slot="typography-inline-code"
|
|
15
|
-
className={cn(
|
|
16
|
-
typographyToneVariants({ tone }),
|
|
17
|
-
"rounded-md border border-white/10 bg-white/6 px-1.5 py-0.5 font-mono text-[0.925em] font-normal",
|
|
18
|
-
className,
|
|
19
|
-
)}
|
|
20
|
-
{...rest}
|
|
21
|
-
>
|
|
22
|
-
{children}
|
|
23
|
-
</code>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
InlineCodeBase.displayName = "InlineCode";
|