@zentauri-ui/zentauri-components 1.4.51 → 1.4.61
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 +63 -1
- package/cli/registry.json +2 -1
- package/dist/ui/search/search-suggestion-list.d.ts.map +1 -1
- package/dist/ui/search.js +10 -6
- package/dist/ui/search.js.map +1 -1
- package/dist/ui/search.mjs +10 -6
- package/dist/ui/search.mjs.map +1 -1
- package/dist/ui/typography/blockquote-base.d.ts +6 -0
- package/dist/ui/typography/blockquote-base.d.ts.map +1 -0
- package/dist/ui/typography/blockquote.d.ts +6 -0
- package/dist/ui/typography/blockquote.d.ts.map +1 -0
- package/dist/ui/typography/code-block-base.d.ts +6 -0
- package/dist/ui/typography/code-block-base.d.ts.map +1 -0
- package/dist/ui/typography/code-block.d.ts +6 -0
- package/dist/ui/typography/code-block.d.ts.map +1 -0
- package/dist/ui/typography/heading-base.d.ts +6 -0
- package/dist/ui/typography/heading-base.d.ts.map +1 -0
- package/dist/ui/typography/heading.d.ts +6 -0
- package/dist/ui/typography/heading.d.ts.map +1 -0
- package/dist/ui/typography/index.d.ts +9 -0
- package/dist/ui/typography/index.d.ts.map +1 -0
- package/dist/ui/typography/inline-code-base.d.ts +6 -0
- package/dist/ui/typography/inline-code-base.d.ts.map +1 -0
- package/dist/ui/typography/inline-code.d.ts +6 -0
- package/dist/ui/typography/inline-code.d.ts.map +1 -0
- package/dist/ui/typography/list-base.d.ts +10 -0
- package/dist/ui/typography/list-base.d.ts.map +1 -0
- package/dist/ui/typography/list.d.ts +12 -0
- package/dist/ui/typography/list.d.ts.map +1 -0
- package/dist/ui/typography/text-base.d.ts +6 -0
- package/dist/ui/typography/text-base.d.ts.map +1 -0
- package/dist/ui/typography/text.d.ts +6 -0
- package/dist/ui/typography/text.d.ts.map +1 -0
- package/dist/ui/typography/types.d.ts +56 -0
- package/dist/ui/typography/types.d.ts.map +1 -0
- package/dist/ui/typography/variants.d.ts +16 -0
- package/dist/ui/typography/variants.d.ts.map +1 -0
- package/dist/ui/typography.js +334 -0
- package/dist/ui/typography.js.map +1 -0
- package/dist/ui/typography.mjs +321 -0
- package/dist/ui/typography.mjs.map +1 -0
- package/package.json +1 -1
- package/src/ui/search/search-bar.tsx +1 -1
- package/src/ui/search/search-suggestion-list.tsx +14 -6
- package/src/ui/typography/blockquote-base.tsx +39 -0
- package/src/ui/typography/blockquote.tsx +8 -0
- package/src/ui/typography/code-block-base.tsx +37 -0
- package/src/ui/typography/code-block.tsx +8 -0
- package/src/ui/typography/heading-base.tsx +59 -0
- package/src/ui/typography/heading.tsx +8 -0
- package/src/ui/typography/index.ts +28 -0
- package/src/ui/typography/inline-code-base.tsx +27 -0
- package/src/ui/typography/inline-code.tsx +8 -0
- package/src/ui/typography/list-base.tsx +88 -0
- package/src/ui/typography/list.tsx +15 -0
- package/src/ui/typography/text-base.tsx +43 -0
- package/src/ui/typography/text.tsx +8 -0
- package/src/ui/typography/types.ts +90 -0
- package/src/ui/typography/typography.test.tsx +80 -0
- package/src/ui/typography/variants.ts +72 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Published artifacts live under `dist/`. Imports use **per-entry subpaths**: `@ze
|
|
|
16
16
|
| `@zentauri-ui/zentauri-components/ui/<name>/animated` | Motion entry for that area when published: animated components, motion presets, and related types (depends on **framer-motion**). |
|
|
17
17
|
| `@zentauri-ui/zentauri-components/hooks/<entry>` | One hook module or `utils` (`cn`, `clampPage`, `range` from `src/lib/utils.ts`). Entries match files under `src/hooks/` (see **React hooks**). |
|
|
18
18
|
|
|
19
|
-
The UI `<name>` segment matches the folder under `src/ui/` (for example `accordion`, `select`, `empty-state`, `buttons` for `Button`, `inputs` for `Input`). The hooks `<entry>` is the file stem (for example `useMediaQuery`, `usePagination`) or `utils`.
|
|
19
|
+
The UI `<name>` segment matches the folder under `src/ui/` (for example `accordion`, `select`, `empty-state`, `buttons` for `Button`, `inputs` for `Input`, `typography` for `Heading` / `Text` and related primitives). The hooks `<entry>` is the file stem (for example `useMediaQuery`, `usePagination`) or `utils`.
|
|
20
20
|
|
|
21
21
|
Only a subset of UI areas publish a `/animated` entry (see **Components**). Some motion entries also re-export non-motion pieces from the same feature so you can import one motion subpath for a whole flow; others pair a base `ui/<name>` import with a small set of `*Animated` exports from `ui/<name>/animated`—use the `animated/index.ts` for that area as the source of truth.
|
|
22
22
|
|
|
@@ -69,6 +69,68 @@ Import static primitives from `@zentauri-ui/zentauri-components/ui/<subpath>` wh
|
|
|
69
69
|
| Toast | `toast` | `toast/animated` |
|
|
70
70
|
| Toggle | `toggle` | `toggle/animated` |
|
|
71
71
|
| Tooltip | `tooltip` | `tooltip/animated` |
|
|
72
|
+
| Typography | `typography` | — |
|
|
73
|
+
|
|
74
|
+
## Typography
|
|
75
|
+
|
|
76
|
+
Import from `@zentauri-ui/zentauri-components/ui/typography`. This entry is **static only** (no `/animated` subpath).
|
|
77
|
+
|
|
78
|
+
**Components:** `Heading`, `Text`, `List` (with `List.Item`, also exported as `ListItem`), `Blockquote`, `InlineCode`, `CodeBlock`.
|
|
79
|
+
|
|
80
|
+
**Types:** `HeadingProps`, `TextProps`, `ListProps`, `ListItemProps`, `BlockquoteProps`, `InlineCodeProps`, `CodeBlockProps`, `HeadingLevel`, `TextElement`, `TypographyTone`, `UnorderedMarker`.
|
|
81
|
+
|
|
82
|
+
**Tone (`tone` prop):** `default`, `muted`, `primary`, `secondary`, `accent`, `destructive`, `info`, `success`, `warning`, `error`, and gradient presets: `gradient-pink-violet`, `gradient-cyan-violet`, `gradient-cyan-blue`, `gradient-cyan-green`, `gradient-cyan-orange`, `gradient-cyan-red`, `gradient-cyan-purple`, `gradient-cyan-pink`. Tones align with kit accent colors (slate / cyan / violet baseline).
|
|
83
|
+
|
|
84
|
+
**Heading:** `level` is required (`1`–`6`) and picks the semantic tag (`h1`–`h6`). Optional `displayLevel` overrides only the visual scale (still the same tag). Optional `bold`, `italic`, `underline`, `strikethrough`.
|
|
85
|
+
|
|
86
|
+
**Text:** Optional `as` (`p`, `span`, `div`, `label`; default `p`). `size` is `sm`, `base`, or `lg` (default `base`). Optional `highlight` plus the same emphasis flags as headings where applicable.
|
|
87
|
+
|
|
88
|
+
**List:** `ordered` renders an `<ol>` (decimal markers); omit or `false` for `<ul>`. Unordered lists accept `marker`: `disc`, `circle`, or `none`.
|
|
89
|
+
|
|
90
|
+
**Blockquote:** Optional `attribution` renders a footer label (separate from the HTML `cite` attribute).
|
|
91
|
+
|
|
92
|
+
**Code samples:** `InlineCode` styles inline `code`; `CodeBlock` renders a `pre` with an inner `code` (pass string or fragment children, not another `code` element) and optional `language` for `aria-label`.
|
|
93
|
+
|
|
94
|
+
**CVA helpers (composition):** `headingLevelVariants`, `textSizeVariants`, `typographyToneVariants`, `unorderedListMarkerVariants`, `orderedListVariants`.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import {
|
|
98
|
+
Blockquote,
|
|
99
|
+
CodeBlock,
|
|
100
|
+
Heading,
|
|
101
|
+
InlineCode,
|
|
102
|
+
List,
|
|
103
|
+
Text,
|
|
104
|
+
} from "@zentauri-ui/zentauri-components/ui/typography";
|
|
105
|
+
|
|
106
|
+
export function ArticleIntro() {
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<Heading level={2} displayLevel={1} tone="gradient-cyan-violet">
|
|
110
|
+
Feature title
|
|
111
|
+
</Heading>
|
|
112
|
+
<Text as="p" size="sm" tone="muted">
|
|
113
|
+
Supporting copy with{" "}
|
|
114
|
+
<InlineCode tone="accent">inline code</InlineCode>.
|
|
115
|
+
</Text>
|
|
116
|
+
<List marker="disc" tone="default">
|
|
117
|
+
<List.Item>First item</List.Item>
|
|
118
|
+
<List.Item>Second item</List.Item>
|
|
119
|
+
</List>
|
|
120
|
+
<List ordered tone="muted">
|
|
121
|
+
<List.Item>Step one</List.Item>
|
|
122
|
+
<List.Item>Step two</List.Item>
|
|
123
|
+
</List>
|
|
124
|
+
<Blockquote tone="secondary" attribution="Docs">
|
|
125
|
+
Quoted guidance for the reader.
|
|
126
|
+
</Blockquote>
|
|
127
|
+
<CodeBlock language="tsx" tone="muted">
|
|
128
|
+
{`export const app = () => null;`}
|
|
129
|
+
</CodeBlock>
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
72
134
|
|
|
73
135
|
## React hooks
|
|
74
136
|
|
package/cli/registry.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-suggestion-list.d.ts","sourceRoot":"","sources":["../../../src/ui/search/search-suggestion-list.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAKzD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,GACX,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"search-suggestion-list.d.ts","sourceRoot":"","sources":["../../../src/ui/search/search-suggestion-list.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAKzD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,GACX,EAAE,yBAAyB,2CA8E3B;yBAvFe,oBAAoB"}
|
package/dist/ui/search.js
CHANGED
|
@@ -104,8 +104,16 @@ function SearchSuggestionList({
|
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
|
-
let lastGroup;
|
|
108
107
|
const useListbox = Boolean(listboxId);
|
|
108
|
+
const rows = [];
|
|
109
|
+
let lastGroupSeen;
|
|
110
|
+
for (const item of items) {
|
|
111
|
+
const showGroup = Boolean(item.group && item.group !== lastGroupSeen);
|
|
112
|
+
if (item.group) {
|
|
113
|
+
lastGroupSeen = item.group;
|
|
114
|
+
}
|
|
115
|
+
rows.push({ item, showGroup });
|
|
116
|
+
}
|
|
109
117
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
118
|
"nav",
|
|
111
119
|
{
|
|
@@ -120,11 +128,7 @@ function SearchSuggestionList({
|
|
|
120
128
|
role: "listbox"
|
|
121
129
|
} : {},
|
|
122
130
|
className: chunkUOZYPWDZ_js.cn("flex flex-col gap-0.5", listClassName),
|
|
123
|
-
children:
|
|
124
|
-
const showGroup = item.group && item.group !== lastGroup;
|
|
125
|
-
if (item.group) {
|
|
126
|
-
lastGroup = item.group;
|
|
127
|
-
}
|
|
131
|
+
children: rows.map(({ item, showGroup }) => {
|
|
128
132
|
const isActive = activeId === item.id;
|
|
129
133
|
const optionDomId = useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : void 0;
|
|
130
134
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
package/dist/ui/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/search/search-bar.tsx","../../src/ui/search/search-suggestion-utils.ts","../../src/ui/search/search-suggestion-list.tsx","../../src/ui/search/filter-search-suggestions.ts"],"names":["SearchBar","useId","jsxs","cn","jsx","inputVariants","Fragment"],"mappings":";;;;;;;AASO,IAAM,SAAA,GAAY,SAASA,UAAAA,CAChC;AAAA,EACE,KAAA;AAAA,EACA,aAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA,GAAa,SAAA;AAAA,EACb,SAAA,GAAY,IAAA;AAAA,EACZ,IAAA,GAAO,IAAA;AAAA,EACP,EAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,iBAAA;AAAA,EACA,sBAAA;AAAA,EACA,gBAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EACA;AACA,EAAA,MAAM,cAAcC,WAA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,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,KAAK,IAAI,CAAA;AACjB,MAAA,IAAI,OAAA,CAAQ,MAAA,IAAU,UAAA,IAAc,UAAA,IAAc,CAAA,EAAG;AACnD,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"search.js","sourcesContent":["\"use client\";\n\nimport { forwardRef, useId } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { inputVariants } from \"../inputs/variants\";\n\nimport type { SearchBarProps } from \"./types\";\n\nexport const SearchBar = function SearchBar(\n {\n value,\n onValueChange,\n leadingSlot,\n className,\n inputClassName,\n appearance = \"default\",\n inputSize = \"md\",\n ring = true,\n id,\n onChange,\n disabled,\n type,\n comboboxListboxId,\n comboboxActiveOptionId,\n comboboxExpanded,\n ref,\n ...rest\n }: SearchBarProps,\n) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const combobox = Boolean(comboboxListboxId);\n\n return (\n <div\n data-slot=\"search-bar\"\n className={cn(\"relative flex w-full min-w-0 items-center\", className)}\n >\n {leadingSlot ? (\n <span\n className=\"pointer-events-none absolute left-3 top-1/2 z-1 flex -translate-y-1/2 text-slate-400 [&_svg]:size-4\"\n aria-hidden\n >\n {leadingSlot}\n </span>\n ) : null}\n <input\n ref={ref}\n id={controlId}\n type={type ?? \"search\"}\n autoComplete=\"off\"\n spellCheck={false}\n disabled={disabled}\n value={value}\n data-slot=\"search-bar-input\"\n className={cn(\n inputVariants({ appearance, size: inputSize, ring, as: \"input\" }),\n leadingSlot ? \"pl-10\" : null,\n inputClassName,\n )}\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.target.value);\n }}\n {...(combobox\n ? {\n role: \"combobox\" as const,\n \"aria-autocomplete\": \"list\" as const,\n \"aria-controls\": comboboxListboxId,\n \"aria-expanded\": comboboxExpanded ?? false,\n ...(comboboxActiveOptionId\n ? { \"aria-activedescendant\": comboboxActiveOptionId }\n : {}),\n }\n : {})}\n {...rest}\n />\n </div>\n );\n}\n\nSearchBar.displayName = \"SearchBar\";\n","/**\n * Builds a stable DOM id for a listbox option so `aria-activedescendant` on the combobox\n * input can reference it. Safe for href-like `itemId` strings.\n */\nexport function searchSuggestionOptionDomId(listboxId: string, itemId: string): string {\n const safe = itemId.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n return `${listboxId}_opt_${safe}`;\n}\n","\"use client\";\n\nimport { Fragment } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { searchSuggestionOptionDomId } from \"./search-suggestion-utils\";\n\nimport type { SearchSuggestionListProps } from \"./types\";\n\nconst rowClassName =\n \"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\";\n\nexport function SearchSuggestionList({\n items,\n onSelect,\n activeId,\n onActiveIdChange,\n listboxId,\n className,\n listClassName,\n emptyLabel,\n}: SearchSuggestionListProps) {\n if (items.length === 0) {\n return (\n <div\n data-slot=\"search-suggestion-list-empty\"\n className={cn(\"px-1 py-6 text-center text-sm text-slate-500\", className)}\n >\n {emptyLabel ?? \"No matches.\"}\n </div>\n );\n }\n\n let lastGroup: string | undefined;\n const useListbox = Boolean(listboxId);\n\n return (\n <nav\n data-slot=\"search-suggestion-list\"\n aria-label=\"Search results\"\n className={cn(\"flex max-h-[min(50vh,360px)] flex-col gap-1 overflow-y-auto pr-1\", className)}\n >\n <div\n {...(useListbox\n ? {\n id: listboxId,\n role: \"listbox\" as const,\n }\n : {})}\n className={cn(\"flex flex-col gap-0.5\", listClassName)}\n >\n {items.map((item) => {\n const showGroup = item.group && item.group !== lastGroup;\n if (item.group) {\n lastGroup = item.group;\n }\n const isActive = activeId === item.id;\n const optionDomId =\n useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : undefined;\n return (\n <Fragment key={item.id}>\n {showGroup ? (\n <div\n role=\"presentation\"\n 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\"\n >\n {item.group}\n </div>\n ) : null}\n <button\n type=\"button\"\n id={optionDomId}\n role={useListbox ? \"option\" : undefined}\n aria-selected={useListbox ? isActive : undefined}\n data-active={isActive ? \"\" : undefined}\n className={cn(rowClassName, isActive ? \"bg-white/5\" : null)}\n onMouseEnter={() => onActiveIdChange?.(item.id)}\n onFocus={() => onActiveIdChange?.(item.id)}\n onClick={() => onSelect(item.id)}\n >\n <span className=\"font-medium text-slate-100\">{item.label}</span>\n {item.description ? (\n <span className=\"truncate text-xs text-slate-500\">{item.description}</span>\n ) : null}\n </button>\n </Fragment>\n );\n })}\n </div>\n </nav>\n );\n}\n\nSearchSuggestionList.displayName = \"SearchSuggestionList\";\n\n","import type { SearchFilterable } from \"./types\";\n\nexport type FilterSearchSuggestionsOptions = {\n /** Maximum number of matches returned. */\n maxResults?: number;\n};\n\n/**\n * Returns items whose label, description, href, or keywords contain the query (case-insensitive).\n * Whitespace-only query matches no items.\n */\nexport function filterSearchSuggestions<T extends SearchFilterable>({\n query,\n items,\n options = { maxResults: 20 },\n}: {\n query: string;\n items: readonly T[];\n options?: FilterSearchSuggestionsOptions;\n}): T[] {\n const maxResults = options.maxResults ?? 20;\n const normalized = query.trim().toLowerCase();\n if (!normalized) {\n return [];\n }\n\n const matches: T[] = [];\n for (const item of items) {\n const isMatch =\n item.label.toLowerCase().includes(normalized) ||\n (item.description?.toLowerCase().includes(normalized)) ||\n (item.href?.toLowerCase().includes(normalized)) ||\n (item.keywords?.some((k) => k.toLowerCase().includes(normalized)));\n\n if (isMatch) {\n matches.push(item);\n if (matches.length >= maxResults || maxResults <= 0) {\n break;\n }\n }\n }\n return matches;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ui/search/search-bar.tsx","../../src/ui/search/search-suggestion-utils.ts","../../src/ui/search/search-suggestion-list.tsx","../../src/ui/search/fil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,CAAA,EAIQ;AACN,EAAA,MAAM,UAAA,GAAa,QAAQ,UAAA,IAAc,EAAA;AACzC,EAAA,MAAM,UAAA,GAAa,KAAA,CAAM,IAAA,EAAK,CAAE,WAAA,EAAY;AAC5C,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,MAAM,UAAe,EAAC;AACtB,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,OAAA,GACJ,IAAA,CAAK,KAAA,CAAM,WAAA,GAAc,QAAA,CAAS,UAAU,CAAA,IAC3C,IAAA,CAAK,WAAA,EAAa,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAA,IACnD,IAAA,CAAK,IAAA,EAAM,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAA,IAC5C,KAAK,QAAA,EAAU,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAC,CAAA;AAElE,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,KAAK,IAAI,CAAA;AACjB,MAAA,IAAI,OAAA,CAAQ,MAAA,IAAU,UAAA,IAAc,UAAA,IAAc,CAAA,EAAG;AACnD,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"search.js","sourcesContent":["\"use client\";\n\nimport { useId } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { inputVariants } from \"../inputs/variants\";\n\nimport type { SearchBarProps } from \"./types\";\n\nexport const SearchBar = function SearchBar(\n {\n value,\n onValueChange,\n leadingSlot,\n className,\n inputClassName,\n appearance = \"default\",\n inputSize = \"md\",\n ring = true,\n id,\n onChange,\n disabled,\n type,\n comboboxListboxId,\n comboboxActiveOptionId,\n comboboxExpanded,\n ref,\n ...rest\n }: SearchBarProps,\n) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const combobox = Boolean(comboboxListboxId);\n\n return (\n <div\n data-slot=\"search-bar\"\n className={cn(\"relative flex w-full min-w-0 items-center\", className)}\n >\n {leadingSlot ? (\n <span\n className=\"pointer-events-none absolute left-3 top-1/2 z-1 flex -translate-y-1/2 text-slate-400 [&_svg]:size-4\"\n aria-hidden\n >\n {leadingSlot}\n </span>\n ) : null}\n <input\n ref={ref}\n id={controlId}\n type={type ?? \"search\"}\n autoComplete=\"off\"\n spellCheck={false}\n disabled={disabled}\n value={value}\n data-slot=\"search-bar-input\"\n className={cn(\n inputVariants({ appearance, size: inputSize, ring, as: \"input\" }),\n leadingSlot ? \"pl-10\" : null,\n inputClassName,\n )}\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.target.value);\n }}\n {...(combobox\n ? {\n role: \"combobox\" as const,\n \"aria-autocomplete\": \"list\" as const,\n \"aria-controls\": comboboxListboxId,\n \"aria-expanded\": comboboxExpanded ?? false,\n ...(comboboxActiveOptionId\n ? { \"aria-activedescendant\": comboboxActiveOptionId }\n : {}),\n }\n : {})}\n {...rest}\n />\n </div>\n );\n}\n\nSearchBar.displayName = \"SearchBar\";\n","/**\n * Builds a stable DOM id for a listbox option so `aria-activedescendant` on the combobox\n * input can reference it. Safe for href-like `itemId` strings.\n */\nexport function searchSuggestionOptionDomId(listboxId: string, itemId: string): string {\n const safe = itemId.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n return `${listboxId}_opt_${safe}`;\n}\n","\"use client\";\n\nimport { Fragment } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { searchSuggestionOptionDomId } from \"./search-suggestion-utils\";\n\nimport type { SearchSuggestionListProps } from \"./types\";\n\nconst rowClassName =\n \"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\";\n\nexport function SearchSuggestionList({\n items,\n onSelect,\n activeId,\n onActiveIdChange,\n listboxId,\n className,\n listClassName,\n emptyLabel,\n}: SearchSuggestionListProps) {\n if (items.length === 0) {\n return (\n <div\n data-slot=\"search-suggestion-list-empty\"\n className={cn(\"px-1 py-6 text-center text-sm text-slate-500\", className)}\n >\n {emptyLabel ?? \"No matches.\"}\n </div>\n );\n }\n\n const useListbox = Boolean(listboxId);\n\n const rows: Array<{\n item: (typeof items)[number];\n showGroup: boolean;\n }> = [];\n let lastGroupSeen: string | undefined;\n for (const item of items) {\n const showGroup = Boolean(item.group && item.group !== lastGroupSeen);\n if (item.group) {\n lastGroupSeen = item.group;\n }\n rows.push({ item, showGroup });\n }\n\n return (\n <nav\n data-slot=\"search-suggestion-list\"\n aria-label=\"Search results\"\n className={cn(\"flex max-h-[min(50vh,360px)] flex-col gap-1 overflow-y-auto pr-1\", className)}\n >\n <div\n {...(useListbox\n ? {\n id: listboxId,\n role: \"listbox\" as const,\n }\n : {})}\n className={cn(\"flex flex-col gap-0.5\", listClassName)}\n >\n {rows.map(({ item, showGroup }) => {\n const isActive = activeId === item.id;\n const optionDomId =\n useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : undefined;\n return (\n <Fragment key={item.id}>\n {showGroup ? (\n <div\n role=\"presentation\"\n 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\"\n >\n {item.group}\n </div>\n ) : null}\n <button\n type=\"button\"\n id={optionDomId}\n role={useListbox ? \"option\" : undefined}\n aria-selected={useListbox ? isActive : undefined}\n data-active={isActive ? \"\" : undefined}\n className={cn(rowClassName, isActive ? \"bg-white/5\" : null)}\n onMouseEnter={() => onActiveIdChange?.(item.id)}\n onFocus={() => onActiveIdChange?.(item.id)}\n onClick={() => onSelect(item.id)}\n >\n <span className=\"font-medium text-slate-100\">{item.label}</span>\n {item.description ? (\n <span className=\"truncate text-xs text-slate-500\">{item.description}</span>\n ) : null}\n </button>\n </Fragment>\n );\n })}\n </div>\n </nav>\n );\n}\n\nSearchSuggestionList.displayName = \"SearchSuggestionList\";\n\n","import type { SearchFilterable } from \"./types\";\n\nexport type FilterSearchSuggestionsOptions = {\n /** Maximum number of matches returned. */\n maxResults?: number;\n};\n\n/**\n * Returns items whose label, description, href, or keywords contain the query (case-insensitive).\n * Whitespace-only query matches no items.\n */\nexport function filterSearchSuggestions<T extends SearchFilterable>({\n query,\n items,\n options = { maxResults: 20 },\n}: {\n query: string;\n items: readonly T[];\n options?: FilterSearchSuggestionsOptions;\n}): T[] {\n const maxResults = options.maxResults ?? 20;\n const normalized = query.trim().toLowerCase();\n if (!normalized) {\n return [];\n }\n\n const matches: T[] = [];\n for (const item of items) {\n const isMatch =\n item.label.toLowerCase().includes(normalized) ||\n (item.description?.toLowerCase().includes(normalized)) ||\n (item.href?.toLowerCase().includes(normalized)) ||\n (item.keywords?.some((k) => k.toLowerCase().includes(normalized)));\n\n if (isMatch) {\n matches.push(item);\n if (matches.length >= maxResults || maxResults <= 0) {\n break;\n }\n }\n }\n return matches;\n}\n"]}
|
package/dist/ui/search.mjs
CHANGED
|
@@ -102,8 +102,16 @@ function SearchSuggestionList({
|
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
|
-
let lastGroup;
|
|
106
105
|
const useListbox = Boolean(listboxId);
|
|
106
|
+
const rows = [];
|
|
107
|
+
let lastGroupSeen;
|
|
108
|
+
for (const item of items) {
|
|
109
|
+
const showGroup = Boolean(item.group && item.group !== lastGroupSeen);
|
|
110
|
+
if (item.group) {
|
|
111
|
+
lastGroupSeen = item.group;
|
|
112
|
+
}
|
|
113
|
+
rows.push({ item, showGroup });
|
|
114
|
+
}
|
|
107
115
|
return /* @__PURE__ */ jsx(
|
|
108
116
|
"nav",
|
|
109
117
|
{
|
|
@@ -118,11 +126,7 @@ function SearchSuggestionList({
|
|
|
118
126
|
role: "listbox"
|
|
119
127
|
} : {},
|
|
120
128
|
className: cn("flex flex-col gap-0.5", listClassName),
|
|
121
|
-
children:
|
|
122
|
-
const showGroup = item.group && item.group !== lastGroup;
|
|
123
|
-
if (item.group) {
|
|
124
|
-
lastGroup = item.group;
|
|
125
|
-
}
|
|
129
|
+
children: rows.map(({ item, showGroup }) => {
|
|
126
130
|
const isActive = activeId === item.id;
|
|
127
131
|
const optionDomId = useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : void 0;
|
|
128
132
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
package/dist/ui/search.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/search/search-bar.tsx","../../src/ui/search/search-suggestion-utils.ts","../../src/ui/search/search-suggestion-list.tsx","../../src/ui/search/filter-search-suggestions.ts"],"names":["SearchBar","jsx","jsxs"],"mappings":";;;;;AASO,IAAM,SAAA,GAAY,SAASA,UAAAA,CAChC;AAAA,EACE,KAAA;AAAA,EACA,aAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA,GAAa,SAAA;AAAA,EACb,SAAA,GAAY,IAAA;AAAA,EACZ,IAAA,GAAO,IAAA;AAAA,EACP,EAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,iBAAA;AAAA,EACA,sBAAA;AAAA,EACA,gBAAA;AAAA,EACA,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EACA;AACA,EAAA,MAAM,cAAc,KAAA,EAAM;AAC1B,EAAA,MAAM,YAAY,EAAA,IAAM,WAAA;AACxB,EAAA,MAAM,QAAA,GAAW,QAAQ,iBAAiB,CAAA;AAE1C,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,YAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,2CAAA,EAA6C,SAAS,CAAA;AAAA,MAEnE,QAAA,EAAA;AAAA,QAAA,WAAA,mBACC,GAAA;AAAA,UAAC,MAAA;AAA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a,KAAK,EAyBpB,CAAA;AAAA,UAEJ,CAAC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;AAEA,oBAAA,CAAqB,WAAA,GAAc,sBAAA;;;AClF5B,SAAS,uBAAA,CAAoD;AAAA,EAClE,KAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA,GAAU,EAAE,UAAA,EAAY,EAAA;AAC1B,CAAA,EAIQ;AACN,EAAA,MAAM,UAAA,GAAa,QAAQ,UAAA,IAAc,EAAA;AACzC,EAAA,MAAM,UAAA,GAAa,KAAA,CAAM,IAAA,EAAK,CAAE,WAAA,EAAY;AAC5C,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,MAAM,UAAe,EAAC;AACtB,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,OAAA,GACJ,IAAA,CAAK,KAAA,CAAM,WAAA,GAAc,QAAA,CAAS,UAAU,CAAA,IAC3C,IAAA,CAAK,WAAA,EAAa,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAA,IACnD,IAAA,CAAK,IAAA,EAAM,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAA,IAC5C,KAAK,QAAA,EAAU,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAC,CAAA;AAElE,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,KAAK,IAAI,CAAA;AACjB,MAAA,IAAI,OAAA,CAAQ,MAAA,IAAU,UAAA,IAAc,UAAA,IAAc,CAAA,EAAG;AACnD,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"search.mjs","sourcesContent":["\"use client\";\n\nimport { forwardRef, useId } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { inputVariants } from \"../inputs/variants\";\n\nimport type { SearchBarProps } from \"./types\";\n\nexport const SearchBar = function SearchBar(\n {\n value,\n onValueChange,\n leadingSlot,\n className,\n inputClassName,\n appearance = \"default\",\n inputSize = \"md\",\n ring = true,\n id,\n onChange,\n disabled,\n type,\n comboboxListboxId,\n comboboxActiveOptionId,\n comboboxExpanded,\n ref,\n ...rest\n }: SearchBarProps,\n) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const combobox = Boolean(comboboxListboxId);\n\n return (\n <div\n data-slot=\"search-bar\"\n className={cn(\"relative flex w-full min-w-0 items-center\", className)}\n >\n {leadingSlot ? (\n <span\n className=\"pointer-events-none absolute left-3 top-1/2 z-1 flex -translate-y-1/2 text-slate-400 [&_svg]:size-4\"\n aria-hidden\n >\n {leadingSlot}\n </span>\n ) : null}\n <input\n ref={ref}\n id={controlId}\n type={type ?? \"search\"}\n autoComplete=\"off\"\n spellCheck={false}\n disabled={disabled}\n value={value}\n data-slot=\"search-bar-input\"\n className={cn(\n inputVariants({ appearance, size: inputSize, ring, as: \"input\" }),\n leadingSlot ? \"pl-10\" : null,\n inputClassName,\n )}\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.target.value);\n }}\n {...(combobox\n ? {\n role: \"combobox\" as const,\n \"aria-autocomplete\": \"list\" as const,\n \"aria-controls\": comboboxListboxId,\n \"aria-expanded\": comboboxExpanded ?? false,\n ...(comboboxActiveOptionId\n ? { \"aria-activedescendant\": comboboxActiveOptionId }\n : {}),\n }\n : {})}\n {...rest}\n />\n </div>\n );\n}\n\nSearchBar.displayName = \"SearchBar\";\n","/**\n * Builds a stable DOM id for a listbox option so `aria-activedescendant` on the combobox\n * input can reference it. Safe for href-like `itemId` strings.\n */\nexport function searchSuggestionOptionDomId(listboxId: string, itemId: string): string {\n const safe = itemId.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n return `${listboxId}_opt_${safe}`;\n}\n","\"use client\";\n\nimport { Fragment } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { searchSuggestionOptionDomId } from \"./search-suggestion-utils\";\n\nimport type { SearchSuggestionListProps } from \"./types\";\n\nconst rowClassName =\n \"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\";\n\nexport function SearchSuggestionList({\n items,\n onSelect,\n activeId,\n onActiveIdChange,\n listboxId,\n className,\n listClassName,\n emptyLabel,\n}: SearchSuggestionListProps) {\n if (items.length === 0) {\n return (\n <div\n data-slot=\"search-suggestion-list-empty\"\n className={cn(\"px-1 py-6 text-center text-sm text-slate-500\", className)}\n >\n {emptyLabel ?? \"No matches.\"}\n </div>\n );\n }\n\n let lastGroup: string | undefined;\n const useListbox = Boolean(listboxId);\n\n return (\n <nav\n data-slot=\"search-suggestion-list\"\n aria-label=\"Search results\"\n className={cn(\"flex max-h-[min(50vh,360px)] flex-col gap-1 overflow-y-auto pr-1\", className)}\n >\n <div\n {...(useListbox\n ? {\n id: listboxId,\n role: \"listbox\" as const,\n }\n : {})}\n className={cn(\"flex flex-col gap-0.5\", listClassName)}\n >\n {items.map((item) => {\n const showGroup = item.group && item.group !== lastGroup;\n if (item.group) {\n lastGroup = item.group;\n }\n const isActive = activeId === item.id;\n const optionDomId =\n useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : undefined;\n return (\n <Fragment key={item.id}>\n {showGroup ? (\n <div\n role=\"presentation\"\n 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\"\n >\n {item.group}\n </div>\n ) : null}\n <button\n type=\"button\"\n id={optionDomId}\n role={useListbox ? \"option\" : undefined}\n aria-selected={useListbox ? isActive : undefined}\n data-active={isActive ? \"\" : undefined}\n className={cn(rowClassName, isActive ? \"bg-white/5\" : null)}\n onMouseEnter={() => onActiveIdChange?.(item.id)}\n onFocus={() => onActiveIdChange?.(item.id)}\n onClick={() => onSelect(item.id)}\n >\n <span className=\"font-medium text-slate-100\">{item.label}</span>\n {item.description ? (\n <span className=\"truncate text-xs text-slate-500\">{item.description}</span>\n ) : null}\n </button>\n </Fragment>\n );\n })}\n </div>\n </nav>\n );\n}\n\nSearchSuggestionList.displayName = \"SearchSuggestionList\";\n\n","import type { SearchFilterable } from \"./types\";\n\nexport type FilterSearchSuggestionsOptions = {\n /** Maximum number of matches returned. */\n maxResults?: number;\n};\n\n/**\n * Returns items whose label, description, href, or keywords contain the query (case-insensitive).\n * Whitespace-only query matches no items.\n */\nexport function filterSearchSuggestions<T extends SearchFilterable>({\n query,\n items,\n options = { maxResults: 20 },\n}: {\n query: string;\n items: readonly T[];\n options?: FilterSearchSuggestionsOptions;\n}): T[] {\n const maxResults = options.maxResults ?? 20;\n const normalized = query.trim().toLowerCase();\n if (!normalized) {\n return [];\n }\n\n const matches: T[] = [];\n for (const item of items) {\n const isMatch =\n item.label.toLowerCase().includes(normalized) ||\n (item.description?.toLowerCase().includes(normalized)) ||\n (item.href?.toLowerCase().includes(normalized)) ||\n (item.keywords?.some((k) => k.toLowerCase().includes(normalized)));\n\n if (isMatch) {\n matches.push(item);\n if (matches.length >= maxResults || maxResults <= 0) {\n break;\n }\n }\n }\n return matches;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ui/search/search-bar.tsx","../../src/ui/search/search-suggestion-utils.ts","../../src/ui/search/search-suggestion-list.tsx","../../src/ui/search/filter-search-suggestions.ts"],"names":["SearchBar","jsx","jsxs"],"mappings":";;;;;AASO,IAAM,SAAA,GAAY,SAASA,UAAAA,CAChC;AAAA,EACE,KAAA;AAAA,EACA,aAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA,GAAa,SAAA;AAAA,EACb,SAAA,GAAY,IAAA;AAAA,EACZ,IAAA,GAAO,IAAA;AAAA,EACP,EAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EAC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AAA,CAAK,WAAA,EAAa,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAA,IACnD,IAAA,CAAK,IAAA,EAAM,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAA,IAC5C,KAAK,QAAA,EAAU,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,WAAA,EAAY,CAAE,QAAA,CAAS,UAAU,CAAC,CAAA;AAElE,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,OAAA,CAAQ,KAAK,IAAI,CAAA;AACjB,MAAA,IAAI,OAAA,CAAQ,MAAA,IAAU,UAAA,IAAc,UAAA,IAAc,CAAA,EAAG;AACnD,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"search.mjs","sourcesContent":["\"use client\";\n\nimport { useId } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { inputVariants } from \"../inputs/variants\";\n\nimport type { SearchBarProps } from \"./types\";\n\nexport const SearchBar = function SearchBar(\n {\n value,\n onValueChange,\n leadingSlot,\n className,\n inputClassName,\n appearance = \"default\",\n inputSize = \"md\",\n ring = true,\n id,\n onChange,\n disabled,\n type,\n comboboxListboxId,\n comboboxActiveOptionId,\n comboboxExpanded,\n ref,\n ...rest\n }: SearchBarProps,\n) {\n const generatedId = useId();\n const controlId = id ?? generatedId;\n const combobox = Boolean(comboboxListboxId);\n\n return (\n <div\n data-slot=\"search-bar\"\n className={cn(\"relative flex w-full min-w-0 items-center\", className)}\n >\n {leadingSlot ? (\n <span\n className=\"pointer-events-none absolute left-3 top-1/2 z-1 flex -translate-y-1/2 text-slate-400 [&_svg]:size-4\"\n aria-hidden\n >\n {leadingSlot}\n </span>\n ) : null}\n <input\n ref={ref}\n id={controlId}\n type={type ?? \"search\"}\n autoComplete=\"off\"\n spellCheck={false}\n disabled={disabled}\n value={value}\n data-slot=\"search-bar-input\"\n className={cn(\n inputVariants({ appearance, size: inputSize, ring, as: \"input\" }),\n leadingSlot ? \"pl-10\" : null,\n inputClassName,\n )}\n onChange={(event) => {\n onChange?.(event);\n onValueChange?.(event.target.value);\n }}\n {...(combobox\n ? {\n role: \"combobox\" as const,\n \"aria-autocomplete\": \"list\" as const,\n \"aria-controls\": comboboxListboxId,\n \"aria-expanded\": comboboxExpanded ?? false,\n ...(comboboxActiveOptionId\n ? { \"aria-activedescendant\": comboboxActiveOptionId }\n : {}),\n }\n : {})}\n {...rest}\n />\n </div>\n );\n}\n\nSearchBar.displayName = \"SearchBar\";\n","/**\n * Builds a stable DOM id for a listbox option so `aria-activedescendant` on the combobox\n * input can reference it. Safe for href-like `itemId` strings.\n */\nexport function searchSuggestionOptionDomId(listboxId: string, itemId: string): string {\n const safe = itemId.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n return `${listboxId}_opt_${safe}`;\n}\n","\"use client\";\n\nimport { Fragment } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { searchSuggestionOptionDomId } from \"./search-suggestion-utils\";\n\nimport type { SearchSuggestionListProps } from \"./types\";\n\nconst rowClassName =\n \"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\";\n\nexport function SearchSuggestionList({\n items,\n onSelect,\n activeId,\n onActiveIdChange,\n listboxId,\n className,\n listClassName,\n emptyLabel,\n}: SearchSuggestionListProps) {\n if (items.length === 0) {\n return (\n <div\n data-slot=\"search-suggestion-list-empty\"\n className={cn(\"px-1 py-6 text-center text-sm text-slate-500\", className)}\n >\n {emptyLabel ?? \"No matches.\"}\n </div>\n );\n }\n\n const useListbox = Boolean(listboxId);\n\n const rows: Array<{\n item: (typeof items)[number];\n showGroup: boolean;\n }> = [];\n let lastGroupSeen: string | undefined;\n for (const item of items) {\n const showGroup = Boolean(item.group && item.group !== lastGroupSeen);\n if (item.group) {\n lastGroupSeen = item.group;\n }\n rows.push({ item, showGroup });\n }\n\n return (\n <nav\n data-slot=\"search-suggestion-list\"\n aria-label=\"Search results\"\n className={cn(\"flex max-h-[min(50vh,360px)] flex-col gap-1 overflow-y-auto pr-1\", className)}\n >\n <div\n {...(useListbox\n ? {\n id: listboxId,\n role: \"listbox\" as const,\n }\n : {})}\n className={cn(\"flex flex-col gap-0.5\", listClassName)}\n >\n {rows.map(({ item, showGroup }) => {\n const isActive = activeId === item.id;\n const optionDomId =\n useListbox && listboxId ? searchSuggestionOptionDomId(listboxId, item.id) : undefined;\n return (\n <Fragment key={item.id}>\n {showGroup ? (\n <div\n role=\"presentation\"\n 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\"\n >\n {item.group}\n </div>\n ) : null}\n <button\n type=\"button\"\n id={optionDomId}\n role={useListbox ? \"option\" : undefined}\n aria-selected={useListbox ? isActive : undefined}\n data-active={isActive ? \"\" : undefined}\n className={cn(rowClassName, isActive ? \"bg-white/5\" : null)}\n onMouseEnter={() => onActiveIdChange?.(item.id)}\n onFocus={() => onActiveIdChange?.(item.id)}\n onClick={() => onSelect(item.id)}\n >\n <span className=\"font-medium text-slate-100\">{item.label}</span>\n {item.description ? (\n <span className=\"truncate text-xs text-slate-500\">{item.description}</span>\n ) : null}\n </button>\n </Fragment>\n );\n })}\n </div>\n </nav>\n );\n}\n\nSearchSuggestionList.displayName = \"SearchSuggestionList\";\n\n","import type { SearchFilterable } from \"./types\";\n\nexport type FilterSearchSuggestionsOptions = {\n /** Maximum number of matches returned. */\n maxResults?: number;\n};\n\n/**\n * Returns items whose label, description, href, or keywords contain the query (case-insensitive).\n * Whitespace-only query matches no items.\n */\nexport function filterSearchSuggestions<T extends SearchFilterable>({\n query,\n items,\n options = { maxResults: 20 },\n}: {\n query: string;\n items: readonly T[];\n options?: FilterSearchSuggestionsOptions;\n}): T[] {\n const maxResults = options.maxResults ?? 20;\n const normalized = query.trim().toLowerCase();\n if (!normalized) {\n return [];\n }\n\n const matches: T[] = [];\n for (const item of items) {\n const isMatch =\n item.label.toLowerCase().includes(normalized) ||\n (item.description?.toLowerCase().includes(normalized)) ||\n (item.href?.toLowerCase().includes(normalized)) ||\n (item.keywords?.some((k) => k.toLowerCase().includes(normalized)));\n\n if (isMatch) {\n matches.push(item);\n if (matches.length >= maxResults || maxResults <= 0) {\n break;\n }\n }\n }\n return matches;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockquote-base.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/blockquote-base.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,eAAO,MAAM,cAAc;YAAW,eAAe;;CA6BpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/blockquote.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU;YAAW,eAAe;;CAEhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block-base.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/code-block-base.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,eAAO,MAAM,aAAa;YAAW,cAAc;;CA2BlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/code-block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,SAAS;YAAW,cAAc;;CAE9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading-base.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/heading-base.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAe5C,eAAO,MAAM,WAAW;YAAW,YAAY;;CAqC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/heading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO;YAAW,YAAY;;CAE1C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export type { BlockquoteProps, CodeBlockProps, HeadingLevel, HeadingProps, InlineCodeProps, ListItemProps, ListProps, TextElement, TextProps, TypographyTone, UnorderedMarker, } from "./types";
|
|
8
|
+
export { headingLevelVariants, orderedListVariants, textSizeVariants, typographyToneVariants, unorderedListMarkerVariants, } from "./variants";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,YAAY,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,aAAa,EACb,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-code-base.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/inline-code-base.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,eAAO,MAAM,cAAc;YAAW,eAAe;;CAiBpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-code.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/inline-code.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU;YAAW,eAAe;;CAEhD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ListProps, ListItemProps } from "./types";
|
|
2
|
+
export declare function ListBase(props: ListProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace ListBase {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function ListItemBase(props: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare namespace ListItemBase {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=list-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-base.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/list-base.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAOxD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,2CA2DxC;yBA3De,QAAQ;;;AA+DxB,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,2CAahD;yBAbe,YAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ListProps } from "./types";
|
|
2
|
+
import { ListItemBase } from "./list-base";
|
|
3
|
+
export declare const ListItem: typeof ListItemBase;
|
|
4
|
+
declare function ListRoot(props: ListProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare namespace ListRoot {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const List: typeof ListRoot & {
|
|
9
|
+
Item: typeof ListItemBase;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAY,YAAY,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,QAAQ,qBAAe,CAAC;AAErC,iBAAS,QAAQ,CAAC,KAAK,EAAE,SAAS,2CAEjC;kBAFQ,QAAQ;;;AAIjB,eAAO,MAAM,IAAI;;CAEf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-base.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/text-base.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,eAAO,MAAM,QAAQ;YAAW,SAAS;;CAmCxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,IAAI;YAAW,SAAS;;CAEpC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { VariantProps } from "class-variance-authority";
|
|
2
|
+
import type { ComponentProps, HTMLAttributes, RefObject } from "react";
|
|
3
|
+
import type { textSizeVariants, typographyToneVariants, unorderedListMarkerVariants } from "./variants";
|
|
4
|
+
export type TypographyTone = NonNullable<VariantProps<typeof typographyToneVariants>["tone"]>;
|
|
5
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
export type HeadingProps = Omit<ComponentProps<"h1">, "color"> & {
|
|
7
|
+
level: HeadingLevel;
|
|
8
|
+
/** Visual scale; defaults to `level`. */
|
|
9
|
+
displayLevel?: HeadingLevel;
|
|
10
|
+
tone?: TypographyTone;
|
|
11
|
+
bold?: boolean;
|
|
12
|
+
italic?: boolean;
|
|
13
|
+
underline?: boolean;
|
|
14
|
+
strikethrough?: boolean;
|
|
15
|
+
ref?: RefObject<HTMLHeadingElement>;
|
|
16
|
+
};
|
|
17
|
+
export type TextElement = "p" | "span" | "div" | "label";
|
|
18
|
+
export type TextProps = Omit<HTMLAttributes<HTMLElement>, "color"> & {
|
|
19
|
+
as?: TextElement;
|
|
20
|
+
size?: NonNullable<VariantProps<typeof textSizeVariants>["size"]>;
|
|
21
|
+
tone?: TypographyTone;
|
|
22
|
+
bold?: boolean;
|
|
23
|
+
italic?: boolean;
|
|
24
|
+
underline?: boolean;
|
|
25
|
+
strikethrough?: boolean;
|
|
26
|
+
highlight?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type UnorderedMarker = NonNullable<VariantProps<typeof unorderedListMarkerVariants>["marker"]>;
|
|
29
|
+
export type ListProps = (Omit<ComponentProps<"ul">, "color"> & {
|
|
30
|
+
ordered?: false;
|
|
31
|
+
marker?: UnorderedMarker;
|
|
32
|
+
tone?: TypographyTone;
|
|
33
|
+
}) | (Omit<ComponentProps<"ol">, "color"> & {
|
|
34
|
+
ordered: true;
|
|
35
|
+
marker?: undefined;
|
|
36
|
+
tone?: TypographyTone;
|
|
37
|
+
});
|
|
38
|
+
export type ListItemProps = ComponentProps<"li"> & {
|
|
39
|
+
ref?: RefObject<HTMLLIElement>;
|
|
40
|
+
};
|
|
41
|
+
export type BlockquoteProps = ComponentProps<"blockquote"> & {
|
|
42
|
+
tone?: TypographyTone;
|
|
43
|
+
/** Attribution label shown in a footer (distinct from the HTML `cite` URL attribute). */
|
|
44
|
+
attribution?: string;
|
|
45
|
+
ref?: RefObject<HTMLQuoteElement>;
|
|
46
|
+
};
|
|
47
|
+
export type InlineCodeProps = Omit<ComponentProps<"code">, "color"> & {
|
|
48
|
+
tone?: TypographyTone;
|
|
49
|
+
};
|
|
50
|
+
export type CodeBlockProps = Omit<ComponentProps<"pre">, "color"> & {
|
|
51
|
+
tone?: TypographyTone;
|
|
52
|
+
/** Hint for stacked highlighting stacks / aria-labels. */
|
|
53
|
+
language?: string;
|
|
54
|
+
ref?: RefObject<HTMLPreElement>;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,SAAS,EACV,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,cAAc,GAAG,WAAW,CACtC,YAAY,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CACpD,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAA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Ae,CAAC;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB,CAAC,GACF,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG;IACrC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB,CAAC,CAAC;AAEP,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG;IACjD,GAAG,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,YAAY,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,yFAAyF;IACzF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,CAAC,MAAM,CAAC,EACtB,OAAO,CACR,GAAG;IACF,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,cAAc,CAAC,KAAK,CAAC,EACrB,OAAO,CACR,GAAG;IACF,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Semantic text colors aligned with slate/cyan/violet accents used across the kit (dark-first). */
|
|
2
|
+
export declare const typographyToneVariants: (props?: ({
|
|
3
|
+
tone?: "error" | "default" | "secondary" | "destructive" | "success" | "warning" | "info" | "muted" | "primary" | "accent" | "gradient-pink-violet" | "gradient-cyan-violet" | "gradient-cyan-blue" | "gradient-cyan-green" | "gradient-cyan-orange" | "gradient-cyan-red" | "gradient-cyan-purple" | "gradient-cyan-pink" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const headingLevelVariants: (props?: ({
|
|
6
|
+
level?: 1 | 2 | 3 | 4 | 6 | 5 | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export declare const textSizeVariants: (props?: ({
|
|
9
|
+
size?: "base" | "sm" | "lg" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
/** Marker style for unordered lists; ignored when `ordered` is true (decimal numbering). */
|
|
12
|
+
export declare const unorderedListMarkerVariants: (props?: ({
|
|
13
|
+
marker?: "circle" | "none" | "disc" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
export declare const orderedListVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
16
|
+
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../src/ui/typography/variants.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,eAAO,MAAM,sBAAsB;;8EA0BjC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;8EAW/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;8EAW3B,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,2BAA2B;;8EAWtC,CAAC;AAEH,eAAO,MAAM,mBAAmB,oFAAqC,CAAC"}
|