@idyeah/diya 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +317 -0
- package/NOTICE +29 -0
- package/README.md +596 -5
- package/dist/DiyaProvider.d.ts +79 -0
- package/dist/DiyaProvider.js +77 -0
- package/dist/Icon.d.ts +10 -0
- package/dist/Icon.js +27 -0
- package/dist/accordion/Accordion.d.ts +34 -0
- package/dist/accordion/Accordion.js +15 -0
- package/dist/alert/Alert.d.ts +49 -0
- package/dist/alert/Alert.js +11 -0
- package/dist/alert/messages.d.ts +9 -0
- package/dist/alert/messages.js +2 -0
- package/dist/api.json +7277 -0
- package/dist/api.schema.json +214 -0
- package/dist/application-patterns/Chatbot.d.ts +114 -0
- package/dist/application-patterns/Chatbot.js +110 -0
- package/dist/application-patterns/SideNavigation.d.ts +74 -0
- package/dist/application-patterns/SideNavigation.js +31 -0
- package/dist/application-patterns/chatbot-messages.d.ts +20 -0
- package/dist/application-patterns/chatbot-messages.js +2 -0
- package/dist/application-patterns/side-navigation-messages.d.ts +5 -0
- package/dist/application-patterns/side-navigation-messages.js +2 -0
- package/dist/avatar/Avatar.d.ts +32 -0
- package/dist/avatar/Avatar.js +19 -0
- package/dist/avatar/messages.d.ts +7 -0
- package/dist/avatar/messages.js +2 -0
- package/dist/badge/Badge.d.ts +42 -0
- package/dist/badge/Badge.js +16 -0
- package/dist/badge/badge-utils.d.ts +6 -0
- package/dist/badge/badge-utils.js +24 -0
- package/dist/badge/messages.d.ts +4 -0
- package/dist/badge/messages.js +2 -0
- package/dist/breadcrumbs/Breadcrumbs.d.ts +34 -0
- package/dist/breadcrumbs/Breadcrumbs.js +19 -0
- package/dist/breadcrumbs/messages.d.ts +5 -0
- package/dist/breadcrumbs/messages.js +2 -0
- package/dist/button/Button.d.ts +46 -0
- package/dist/button/Button.js +44 -0
- package/dist/calendar/Calendar.d.ts +55 -0
- package/dist/calendar/Calendar.js +61 -0
- package/dist/calendar/messages.d.ts +8 -0
- package/dist/calendar/messages.js +2 -0
- package/dist/calendar/month.d.ts +61 -0
- package/dist/calendar/month.js +134 -0
- package/dist/card/Card.d.ts +46 -0
- package/dist/card/Card.js +8 -0
- package/dist/choice/Choice.d.ts +72 -0
- package/dist/choice/Choice.js +68 -0
- package/dist/choice/messages.d.ts +4 -0
- package/dist/choice/messages.js +2 -0
- package/dist/code-block/CodeBlock.d.ts +20 -0
- package/dist/code-block/CodeBlock.js +49 -0
- package/dist/code-block/messages.d.ts +8 -0
- package/dist/code-block/messages.js +2 -0
- package/dist/combobox/Combobox.d.ts +60 -0
- package/dist/combobox/Combobox.js +160 -0
- package/dist/combobox/messages.d.ts +9 -0
- package/dist/combobox/messages.js +2 -0
- package/dist/combobox/useAnchoredPopover.d.ts +5 -0
- package/dist/combobox/useAnchoredPopover.js +100 -0
- package/dist/data-viz/DataViz.d.ts +140 -0
- package/dist/data-viz/DataViz.js +469 -0
- package/dist/data-viz/index.d.ts +2 -0
- package/dist/data-viz/index.js +1 -0
- package/dist/data-viz/messages.d.ts +11 -0
- package/dist/data-viz/messages.js +2 -0
- package/dist/date-picker/DatePicker.d.ts +57 -0
- package/dist/date-picker/DatePicker.js +146 -0
- package/dist/date-picker/messages.d.ts +13 -0
- package/dist/date-picker/messages.js +2 -0
- package/dist/dialog/Dialog.d.ts +84 -0
- package/dist/dialog/Dialog.js +107 -0
- package/dist/dialog/messages.d.ts +9 -0
- package/dist/dialog/messages.js +2 -0
- package/dist/fonts/DIYASans-Italic.woff2 +0 -0
- package/dist/fonts/DIYASans.woff2 +0 -0
- package/dist/fonts/OFL.txt +94 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +46 -0
- package/dist/internal/brand.d.ts +33 -0
- package/dist/internal/brand.js +57 -0
- package/dist/internal/cx.d.ts +2 -0
- package/dist/internal/cx.js +4 -0
- package/dist/internal/link.d.ts +14 -0
- package/dist/internal/link.js +7 -0
- package/dist/internal/slot.d.ts +15 -0
- package/dist/internal/slot.js +67 -0
- package/dist/layout/Inline.d.ts +4 -0
- package/dist/layout/Inline.js +7 -0
- package/dist/layout/Stack.d.ts +4 -0
- package/dist/layout/Stack.js +7 -0
- package/dist/layout/layout.d.ts +32 -0
- package/dist/layout/layout.js +12 -0
- package/dist/link/TextLink.d.ts +23 -0
- package/dist/link/TextLink.js +17 -0
- package/dist/list/List.d.ts +48 -0
- package/dist/list/List.js +17 -0
- package/dist/list/messages.d.ts +4 -0
- package/dist/list/messages.js +2 -0
- package/dist/menu/Menu.d.ts +49 -0
- package/dist/menu/Menu.js +54 -0
- package/dist/messages-defaults.d.ts +201 -0
- package/dist/messages-defaults.js +61 -0
- package/dist/messages.d.ts +12 -0
- package/dist/messages.js +1 -0
- package/dist/metric/Metric.d.ts +42 -0
- package/dist/metric/Metric.js +11 -0
- package/dist/metric/messages.d.ts +9 -0
- package/dist/metric/messages.js +2 -0
- package/dist/overlay/FloatingSurface.d.ts +29 -0
- package/dist/overlay/FloatingSurface.js +254 -0
- package/dist/page-header/PageHeader.d.ts +38 -0
- package/dist/page-header/PageHeader.js +10 -0
- package/dist/pagination/Pagination.d.ts +44 -0
- package/dist/pagination/Pagination.js +26 -0
- package/dist/pagination/messages.d.ts +11 -0
- package/dist/pagination/messages.js +2 -0
- package/dist/popover/Popover.d.ts +23 -0
- package/dist/popover/Popover.js +8 -0
- package/dist/progress/Progress.d.ts +33 -0
- package/dist/progress/Progress.js +14 -0
- package/dist/progress/messages.d.ts +4 -0
- package/dist/progress/messages.js +2 -0
- package/dist/prose/Prose.d.ts +14 -0
- package/dist/prose/Prose.js +7 -0
- package/dist/rating/Rating.d.ts +32 -0
- package/dist/rating/Rating.js +27 -0
- package/dist/rating/messages.d.ts +6 -0
- package/dist/rating/messages.js +2 -0
- package/dist/search/Search.d.ts +11 -0
- package/dist/search/Search.js +9 -0
- package/dist/select/Select.d.ts +65 -0
- package/dist/select/Select.js +19 -0
- package/dist/select/messages.d.ts +4 -0
- package/dist/select/messages.js +2 -0
- package/dist/site-header/SiteHeader.d.ts +88 -0
- package/dist/site-header/SiteHeader.js +211 -0
- package/dist/site-header/messages.d.ts +8 -0
- package/dist/site-header/messages.js +2 -0
- package/dist/slider/Slider.d.ts +54 -0
- package/dist/slider/Slider.js +89 -0
- package/dist/slider/messages.d.ts +5 -0
- package/dist/slider/messages.js +2 -0
- package/dist/styles.css +3379 -0
- package/dist/switch/Switch.d.ts +47 -0
- package/dist/switch/Switch.js +18 -0
- package/dist/table/Table.d.ts +99 -0
- package/dist/table/Table.js +158 -0
- package/dist/table/messages.d.ts +23 -0
- package/dist/table/messages.js +2 -0
- package/dist/tabs/Tabs.d.ts +49 -0
- package/dist/tabs/Tabs.js +26 -0
- package/dist/tag/Tag.d.ts +37 -0
- package/dist/tag/Tag.js +20 -0
- package/dist/tag/messages.d.ts +4 -0
- package/dist/tag/messages.js +2 -0
- package/dist/text-area/TextArea.d.ts +47 -0
- package/dist/text-area/TextArea.js +19 -0
- package/dist/text-input/TextInput.d.ts +53 -0
- package/dist/text-input/TextInput.js +35 -0
- package/dist/text-input/messages.d.ts +4 -0
- package/dist/text-input/messages.js +3 -0
- package/dist/text-input/native-field.d.ts +15 -0
- package/dist/text-input/native-field.js +56 -0
- package/dist/toast/Toast.d.ts +24 -0
- package/dist/toast/Toast.js +79 -0
- package/dist/toast/messages.d.ts +4 -0
- package/dist/toast/messages.js +2 -0
- package/dist/tooltip/Tooltip.d.ts +22 -0
- package/dist/tooltip/Tooltip.js +92 -0
- package/dist/workflow/ContentState.d.ts +44 -0
- package/dist/workflow/ContentState.js +11 -0
- package/dist/workflow/Drawer.d.ts +48 -0
- package/dist/workflow/Drawer.js +51 -0
- package/dist/workflow/FileUpload.d.ts +67 -0
- package/dist/workflow/FileUpload.js +47 -0
- package/dist/workflow/Form.d.ts +52 -0
- package/dist/workflow/Form.js +16 -0
- package/dist/workflow/Wizard.d.ts +76 -0
- package/dist/workflow/Wizard.js +31 -0
- package/dist/workflow/drawer-messages.d.ts +4 -0
- package/dist/workflow/drawer-messages.js +2 -0
- package/dist/workflow/file-upload-messages.d.ts +11 -0
- package/dist/workflow/file-upload-messages.js +2 -0
- package/dist/workflow/form-messages.d.ts +5 -0
- package/dist/workflow/form-messages.js +2 -0
- package/dist/workflow/wizard-messages.d.ts +9 -0
- package/dist/workflow/wizard-messages.js +2 -0
- package/package.json +82 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
|
+
import { cx } from '../internal/cx.js';
|
|
5
|
+
/** A page's heading block with optional breadcrumbs, description, tags, actions and tabs. Data and actions belong to the host app. Optional slots reserve no empty space. */
|
|
6
|
+
export const PageHeader = forwardRef(function PageHeader({ title, headingLevel = 2, breadcrumbs, description, tags, actions, navigation, surface = true, className, ...props }, ref) {
|
|
7
|
+
const headingId = useId();
|
|
8
|
+
const Heading = `h${headingLevel}`;
|
|
9
|
+
return _jsxs("section", { ...props, ref: ref, className: cx('diya-page-header', className), "data-surface": surface, "aria-labelledby": props['aria-labelledby'] ?? headingId, children: [breadcrumbs && _jsx("div", { className: "diya-page-header-breadcrumbs", children: breadcrumbs }), _jsxs("div", { className: "diya-page-header-main", children: [_jsxs("div", { className: "diya-page-header-copy", children: [_jsx(Heading, { id: headingId, children: title }), description && _jsx("div", { className: "diya-page-header-description", children: description }), tags && _jsx("div", { className: "diya-page-header-tags", children: tags })] }), actions && _jsx("div", { className: "diya-page-header-actions", children: actions })] }), navigation && _jsx("div", { className: "diya-page-header-navigation", children: navigation })] });
|
|
10
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { paginationMessages } from './messages.js';
|
|
3
|
+
declare module '../messages.js' {
|
|
4
|
+
interface DiyaMessages {
|
|
5
|
+
pagination: typeof paginationMessages;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type PaginationProps = HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
/** Current page, starting at 1; clamped to the pages that exist. */
|
|
10
|
+
page: number;
|
|
11
|
+
/** Total number of items across all pages, not the number of pages. */
|
|
12
|
+
total: number;
|
|
13
|
+
/** Items per page. */
|
|
14
|
+
pageSize: number;
|
|
15
|
+
/** Called with the 1-based page a person picks. */
|
|
16
|
+
onPageChange: (page: number) => void;
|
|
17
|
+
/** When given, shows a "Per page" select and is called with the new size. */
|
|
18
|
+
onPageSizeChange?: (size: number) => void;
|
|
19
|
+
/** Sizes offered by the "Per page" select; the current `pageSize` is always included. Defaults to `[10, 25, 50]`. */
|
|
20
|
+
pageSizeOptions?: number[];
|
|
21
|
+
/** Shows the visible range, such as "11–20 of 42", announced as a status. Defaults to true. */
|
|
22
|
+
showCount?: boolean;
|
|
23
|
+
/** Shows numbered page buttons between Previous and Next, with gaps for long runs. Defaults to true. */
|
|
24
|
+
showNumbers?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** Previous / Next page controls with optional page numbers, a range count and a page-size select; narrow spaces get arrow buttons. The ref, `className`, `style` and other attributes go to the outer element. */
|
|
27
|
+
export declare const Pagination: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
28
|
+
/** Current page, starting at 1; clamped to the pages that exist. */
|
|
29
|
+
page: number;
|
|
30
|
+
/** Total number of items across all pages, not the number of pages. */
|
|
31
|
+
total: number;
|
|
32
|
+
/** Items per page. */
|
|
33
|
+
pageSize: number;
|
|
34
|
+
/** Called with the 1-based page a person picks. */
|
|
35
|
+
onPageChange: (page: number) => void;
|
|
36
|
+
/** When given, shows a "Per page" select and is called with the new size. */
|
|
37
|
+
onPageSizeChange?: (size: number) => void;
|
|
38
|
+
/** Sizes offered by the "Per page" select; the current `pageSize` is always included. Defaults to `[10, 25, 50]`. */
|
|
39
|
+
pageSizeOptions?: number[];
|
|
40
|
+
/** Shows the visible range, such as "11–20 of 42", announced as a status. Defaults to true. */
|
|
41
|
+
showCount?: boolean;
|
|
42
|
+
/** Shows numbered page buttons between Previous and Next, with gaps for long runs. Defaults to true. */
|
|
43
|
+
showNumbers?: boolean;
|
|
44
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Select } from '../select/Select.js';
|
|
5
|
+
import { Button } from '../button/Button.js';
|
|
6
|
+
import { useDiyaMessages } from '../DiyaProvider.js';
|
|
7
|
+
import { cx } from '../internal/cx.js';
|
|
8
|
+
import { paginationMessages } from './messages.js';
|
|
9
|
+
const chevron = (path) => _jsx("svg", { className: "diya-pagination-chevron", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: _jsx("path", { d: path }) });
|
|
10
|
+
/** Previous / Next page controls with optional page numbers, a range count and a page-size select; narrow spaces get arrow buttons. The ref, `className`, `style` and other attributes go to the outer element. */
|
|
11
|
+
export const Pagination = forwardRef(function Pagination({ page, total, pageSize, onPageChange, onPageSizeChange, pageSizeOptions = [10, 25, 50], showCount = true, showNumbers = true, className, ...props }, ref) {
|
|
12
|
+
const t = useDiyaMessages('pagination', paginationMessages);
|
|
13
|
+
const count = Math.max(0, Math.floor(total));
|
|
14
|
+
const size = Math.max(1, Math.floor(pageSize));
|
|
15
|
+
const pages = Math.max(1, Math.ceil(count / size));
|
|
16
|
+
const current = Math.max(1, Math.min(pages, page));
|
|
17
|
+
const visible = Array.from(new Set([1, pages, current - 1, current, current + 1].filter((n) => n >= 1 && n <= pages))).sort((a, b) => a - b);
|
|
18
|
+
const cells = [];
|
|
19
|
+
visible.forEach((n, i) => { if (i && n - visible[i - 1] > 1) {
|
|
20
|
+
if (n - visible[i - 1] === 2)
|
|
21
|
+
cells.push(n - 1);
|
|
22
|
+
else
|
|
23
|
+
cells.push(`gap-${n}`);
|
|
24
|
+
} ; cells.push(n); });
|
|
25
|
+
return _jsxs("div", { ...props, ref: ref, className: cx('diya-pagination', className), children: [showCount && _jsx("p", { className: "diya-pagination-count", role: "status", children: count ? t.range((current - 1) * size + 1, Math.min(current * size, count), count) : t.noResults }), _jsxs("nav", { "aria-label": t.label, "data-cells": showNumbers ? cells.length : undefined, children: [_jsxs(Button, { size: "small", variant: "quiet", shape: "pill", disabled: current === 1 || count === 0, onClick: () => onPageChange(current - 1), children: [chevron('m15 5-7 7 7 7'), _jsx("span", { className: "diya-pagination-step", children: t.previous })] }), showNumbers && cells.map((cell) => typeof cell === 'string' ? _jsx("span", { className: "diya-pagination-gap", "aria-hidden": "true", children: "\u2026" }, cell) : _jsx(Button, { size: "small", variant: current === cell ? 'solid' : 'quiet', shape: "pill", "aria-label": t.page(cell), "aria-current": current === cell ? 'page' : undefined, "data-far": Math.abs(cell - current) > 1 || undefined, disabled: count === 0, onClick: () => onPageChange(cell), children: cell }, cell)), _jsxs(Button, { size: "small", variant: "quiet", shape: "pill", disabled: current === pages || count === 0, onClick: () => onPageChange(current + 1), children: [_jsx("span", { className: "diya-pagination-step", children: t.next }), chevron('m9 5 7 7-7 7')] })] }), onPageSizeChange && _jsxs("div", { className: "diya-pagination-size", children: [_jsx("span", { children: t.perPage }), _jsx(Select, { label: t.resultsPerPage, hideLabel: true, size: "small", value: String(size), onValueChange: value => onPageSizeChange(Number(value)), options: Array.from(new Set([...pageSizeOptions, size])).sort((a, b) => a - b).map(n => ({ value: String(n), label: String(n) })) })] })] });
|
|
26
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** pagination: English defaults, overridable through DiyaProvider `messages`. */
|
|
2
|
+
export declare const paginationMessages: {
|
|
3
|
+
label: string;
|
|
4
|
+
previous: string;
|
|
5
|
+
next: string;
|
|
6
|
+
perPage: string;
|
|
7
|
+
resultsPerPage: string;
|
|
8
|
+
page: (page: number) => string;
|
|
9
|
+
range: (start: number, end: number, total: number) => string;
|
|
10
|
+
noResults: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** pagination: English defaults, overridable through DiyaProvider `messages`. */
|
|
2
|
+
export const paginationMessages = { label: 'Pagination', previous: 'Previous', next: 'Next', perPage: 'Per page', resultsPerPage: 'Results per page', page: (page) => `Page ${page}`, range: (start, end, total) => `${start}–${end} of ${total}`, noResults: '0 results' };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FloatingTriggerProps } from '../overlay/FloatingSurface.js';
|
|
3
|
+
export type PopoverProps = FloatingTriggerProps & {
|
|
4
|
+
/** The trigger button's visible text and the panel's accessible name; with `trigger`, only the panel's name. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Preferred side for the panel; it moves to stay on screen. Defaults to 'bottom'. */
|
|
7
|
+
placement?: 'top' | 'bottom';
|
|
8
|
+
/** Disables the trigger and closes an open panel. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** The panel's content, or a function that renders it; call `close` to shut it and return focus to the trigger. */
|
|
11
|
+
children: ReactNode | ((close: () => void) => ReactNode);
|
|
12
|
+
};
|
|
13
|
+
/** A button that opens a small panel of interactive content beside it; `className`, `style`, other attributes and the ref go to the trigger. */
|
|
14
|
+
export declare const Popover: import("react").ForwardRefExoticComponent<FloatingTriggerProps & {
|
|
15
|
+
/** The trigger button's visible text and the panel's accessible name; with `trigger`, only the panel's name. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Preferred side for the panel; it moves to stay on screen. Defaults to 'bottom'. */
|
|
18
|
+
placement?: "top" | "bottom";
|
|
19
|
+
/** Disables the trigger and closes an open panel. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** The panel's content, or a function that renders it; call `close` to shut it and return focus to the trigger. */
|
|
22
|
+
children: ReactNode | ((close: () => void) => ReactNode);
|
|
23
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { FloatingSurface } from '../overlay/FloatingSurface.js';
|
|
5
|
+
/** A button that opens a small panel of interactive content beside it; `className`, `style`, other attributes and the ref go to the trigger. */
|
|
6
|
+
export const Popover = forwardRef(function Popover({ label, placement = 'bottom', disabled = false, children, ...props }, ref) {
|
|
7
|
+
return _jsx(FloatingSurface, { ...props, ref: ref, label: label, placement: placement, disabled: disabled, children: children });
|
|
8
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { progressMessages } from './messages.js';
|
|
3
|
+
declare module '../messages.js' {
|
|
4
|
+
interface DiyaMessages {
|
|
5
|
+
progress: typeof progressMessages;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Without a `value`, progress is indeterminate: working, amount unknown. */
|
|
9
|
+
export type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
10
|
+
/** Percent complete, 0–100 (clamped); omit it for indeterminate progress. */
|
|
11
|
+
value?: number;
|
|
12
|
+
/** 'linear' is a bar; 'circular' is a ring. Defaults to 'linear'. */
|
|
13
|
+
variant?: 'linear' | 'circular';
|
|
14
|
+
/** Forces indeterminate progress even when `value` is set. */
|
|
15
|
+
indeterminate?: boolean;
|
|
16
|
+
/** Shows the rounded percentage beside the meter, visually only; hidden while indeterminate. Defaults to true. */
|
|
17
|
+
showValue?: boolean;
|
|
18
|
+
/** Accessible name for the progress bar, such as 'Uploading report'; not shown. */
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
/** A bar or ring showing how much of a task is done, or that work is under way. */
|
|
22
|
+
export declare const Progress: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
23
|
+
/** Percent complete, 0–100 (clamped); omit it for indeterminate progress. */
|
|
24
|
+
value?: number;
|
|
25
|
+
/** 'linear' is a bar; 'circular' is a ring. Defaults to 'linear'. */
|
|
26
|
+
variant?: "linear" | "circular";
|
|
27
|
+
/** Forces indeterminate progress even when `value` is set. */
|
|
28
|
+
indeterminate?: boolean;
|
|
29
|
+
/** Shows the rounded percentage beside the meter, visually only; hidden while indeterminate. Defaults to true. */
|
|
30
|
+
showValue?: boolean;
|
|
31
|
+
/** Accessible name for the progress bar, such as 'Uploading report'; not shown. */
|
|
32
|
+
label: string;
|
|
33
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { useDiyaLocale, useDiyaMessages } from '../DiyaProvider.js';
|
|
5
|
+
import { cx } from '../internal/cx.js';
|
|
6
|
+
import { progressMessages } from './messages.js';
|
|
7
|
+
/** A bar or ring showing how much of a task is done, or that work is under way. */
|
|
8
|
+
export const Progress = forwardRef(function Progress({ value, variant = 'linear', indeterminate: forced = false, showValue = true, label, className, ...props }, ref) {
|
|
9
|
+
const t = useDiyaMessages('progress', progressMessages);
|
|
10
|
+
const locale = useDiyaLocale();
|
|
11
|
+
const indeterminate = forced || value === undefined || !Number.isFinite(value);
|
|
12
|
+
const amount = indeterminate ? 0 : Math.min(100, Math.max(0, value));
|
|
13
|
+
return _jsxs("div", { ...props, ref: ref, className: cx('diya-progress', className), "data-variant": variant, "data-indeterminate": indeterminate, children: [_jsx("div", { className: "diya-progress-meter", role: "progressbar", "aria-label": label, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": indeterminate ? undefined : amount, "aria-valuetext": indeterminate ? t.inProgress : undefined, children: variant === 'linear' ? _jsx("div", { className: "diya-progress-track", children: _jsx("span", { style: { width: indeterminate ? '35%' : `${amount}%` } }) }) : _jsxs("svg", { viewBox: "0 0 100 100", "aria-hidden": "true", children: [_jsx("circle", { className: "diya-progress-track-circle", cx: "50", cy: "50", r: "42" }), _jsx("circle", { className: "diya-progress-fill-circle", cx: "50", cy: "50", r: "42", pathLength: "100", strokeDasharray: "100", strokeDashoffset: indeterminate ? 72 : 100 - amount })] }) }), showValue && !indeterminate && _jsx("span", { className: "diya-progress-value", "aria-hidden": "true", children: new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 0 }).format(Math.round(amount) / 100) })] });
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type ProseProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
/** Your own HTML content: headings, paragraphs, links, lists, quotes, code, tables and images. Rendered HTML can come in through `dangerouslySetInnerHTML` instead. */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Text size, with headings, tables and captions in step: 'small' (15px) for writing inside an app, such as a drawer or a card; 'medium' (17px) for articles and docs pages; 'large' (20px) for long reads. Defaults to 'medium'. */
|
|
6
|
+
size?: 'small' | 'medium' | 'large';
|
|
7
|
+
};
|
|
8
|
+
/** Gives the plain HTML inside it DIYA's type and rhythm, for articles, docs pages, changelogs and legal pages. DIYA components placed inside keep their own styles. Needs no provider context, so it renders in Server Components. */
|
|
9
|
+
export declare const Prose: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
10
|
+
/** Your own HTML content: headings, paragraphs, links, lists, quotes, code, tables and images. Rendered HTML can come in through `dangerouslySetInnerHTML` instead. */
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/** Text size, with headings, tables and captions in step: 'small' (15px) for writing inside an app, such as a drawer or a card; 'medium' (17px) for articles and docs pages; 'large' (20px) for long reads. Defaults to 'medium'. */
|
|
13
|
+
size?: "small" | "medium" | "large";
|
|
14
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cx } from '../internal/cx.js';
|
|
4
|
+
/** Gives the plain HTML inside it DIYA's type and rhythm, for articles, docs pages, changelogs and legal pages. DIYA components placed inside keep their own styles. Needs no provider context, so it renders in Server Components. */
|
|
5
|
+
export const Prose = forwardRef(function Prose({ size = 'medium', className, children, ...props }, ref) {
|
|
6
|
+
return _jsx("div", { ...props, ref: ref, className: cx('diya-prose', className), "data-size": size, children: children });
|
|
7
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { ratingMessages } from './messages.js';
|
|
3
|
+
declare module '../messages.js' {
|
|
4
|
+
interface DiyaMessages {
|
|
5
|
+
rating: typeof ratingMessages;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type RatingProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
|
|
9
|
+
/** The rating, from 0 to `max`. Values outside that range are clamped, and one that isn't a number shows as 0. The stars fill to the nearest half (4.3 shows four and a half); the number and the accessible name keep one decimal. */
|
|
10
|
+
value: number;
|
|
11
|
+
/** How many stars: a whole number from 1 to 10. Defaults to 5. */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** How many reviews the rating comes from, shown after the stars as '(128)' and announced as '128 reviews'. Leave it out to show the stars alone. */
|
|
14
|
+
count?: number;
|
|
15
|
+
/** Shows the value as a number before the stars, such as '4.3'. Defaults to false. */
|
|
16
|
+
showValue?: boolean;
|
|
17
|
+
/** Star and text size. Defaults to 'medium'. */
|
|
18
|
+
size?: 'small' | 'medium' | 'large';
|
|
19
|
+
};
|
|
20
|
+
/** A read-only star rating, with an optional number and review count, announced as one phrase such as "Rated 4.3 out of 5, 128 reviews". */
|
|
21
|
+
export declare const Rating: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
22
|
+
/** The rating, from 0 to `max`. Values outside that range are clamped, and one that isn't a number shows as 0. The stars fill to the nearest half (4.3 shows four and a half); the number and the accessible name keep one decimal. */
|
|
23
|
+
value: number;
|
|
24
|
+
/** How many stars: a whole number from 1 to 10. Defaults to 5. */
|
|
25
|
+
max?: number;
|
|
26
|
+
/** How many reviews the rating comes from, shown after the stars as '(128)' and announced as '128 reviews'. Leave it out to show the stars alone. */
|
|
27
|
+
count?: number;
|
|
28
|
+
/** Shows the value as a number before the stars, such as '4.3'. Defaults to false. */
|
|
29
|
+
showValue?: boolean;
|
|
30
|
+
/** Star and text size. Defaults to 'medium'. */
|
|
31
|
+
size?: "small" | "medium" | "large";
|
|
32
|
+
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { useDiyaLocale, useDiyaMessages } from '../DiyaProvider.js';
|
|
5
|
+
import { cx } from '../internal/cx.js';
|
|
6
|
+
import { ratingMessages } from './messages.js';
|
|
7
|
+
// A five-point star with softened corners in a 24-unit box, and its left half. A half
|
|
8
|
+
// star draws the half over an empty star, so no seam shows down the middle.
|
|
9
|
+
const STAR = 'M11.25 2.24Q12 .6 12.75 2.24L15.14 7.4Q15.55 8.31 16.55 8.43L22.2 9.1Q23.98 9.31 22.66 10.53L18.49 14.39Q17.75 15.07 17.95 16.05L19.06 21.63Q19.41 23.4 17.84 22.52L12.87 19.74Q12 19.25 11.13 19.74L6.16 22.52Q4.59 23.4 4.94 21.63L6.05 16.05Q6.25 15.07 5.51 14.39L1.34 10.53Q.02 9.31 1.8 9.1L7.45 8.43Q8.45 8.31 8.86 7.4Z';
|
|
10
|
+
const HALF = 'M12 19.5Q11.56 19.5 11.13 19.74L6.16 22.52Q4.59 23.4 4.94 21.63L6.05 16.05Q6.25 15.07 5.51 14.39L1.34 10.53Q.02 9.31 1.8 9.1L7.45 8.43Q8.45 8.31 8.86 7.4L11.25 2.24Q11.62 1.42 12 1.42Z';
|
|
11
|
+
/** A read-only star rating, with an optional number and review count, announced as one phrase such as "Rated 4.3 out of 5, 128 reviews". */
|
|
12
|
+
export const Rating = forwardRef(function Rating({ value, max = 5, count, showValue = false, size = 'medium', className, ...props }, ref) {
|
|
13
|
+
const t = useDiyaMessages('rating', ratingMessages);
|
|
14
|
+
const locale = useDiyaLocale();
|
|
15
|
+
const stars = Number.isFinite(max) ? Math.min(10, Math.max(1, Math.round(max))) : 5;
|
|
16
|
+
const number = Number(value);
|
|
17
|
+
// One decimal is what people read and hear; the stars round that to the nearest half.
|
|
18
|
+
const rated = Math.round((Number.isNaN(number) ? 0 : Math.min(stars, Math.max(0, number))) * 10) / 10;
|
|
19
|
+
const filled = Math.round(rated * 2) / 2;
|
|
20
|
+
const reviews = typeof count === 'number' && Number.isFinite(count) ? Math.max(0, Math.floor(count)) : undefined;
|
|
21
|
+
const whole = new Intl.NumberFormat(locale);
|
|
22
|
+
const spoken = t.rated(new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(rated), whole.format(stars));
|
|
23
|
+
return _jsxs("span", { role: "img", ...props, ref: ref, className: cx('diya-rating', className), "data-size": size, "aria-label": reviews === undefined ? spoken : `${spoken}, ${t.reviews(reviews, whole.format(reviews))}`, children: [showValue && _jsx("span", { className: "diya-rating-value", "aria-hidden": "true", children: new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(rated) }), _jsx("span", { className: "diya-rating-stars", "aria-hidden": "true", children: Array.from({ length: stars }, (_, index) => {
|
|
24
|
+
const fill = Math.min(1, Math.max(0, filled - index));
|
|
25
|
+
return _jsxs("svg", { viewBox: "0 0 24 24", width: "16", height: "16", "data-fill": fill === 1 ? 'full' : fill ? 'half' : 'empty', children: [fill < 1 && _jsx("path", { className: "diya-rating-empty", d: STAR }), fill > 0 && _jsx("path", { d: fill === 1 ? STAR : HALF })] }, index);
|
|
26
|
+
}) }), reviews !== undefined && _jsx("span", { className: "diya-rating-count", "aria-hidden": "true", children: t.count(whole.format(reviews)) })] });
|
|
27
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** rating: English defaults, overridable through DiyaProvider `messages`. */
|
|
2
|
+
export const ratingMessages = { rated: (value, max) => `Rated ${value} out of ${max}`, reviews: (count, formatted) => `${formatted} ${count === 1 ? 'review' : 'reviews'}`, count: (formatted) => `(${formatted})` };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TextInputProps } from '../text-input/TextInput.js';
|
|
2
|
+
/** TextInput's props, with the search type and magnifier icon built in. */
|
|
3
|
+
export type SearchProps = Omit<TextInputProps, 'type' | 'leadingIcon'> & {
|
|
4
|
+
/** Corner style of the field; defaults to 'rounded', the same corners as every other control. 'pill' is fully round. */
|
|
5
|
+
shape?: 'rounded' | 'pill';
|
|
6
|
+
};
|
|
7
|
+
/** A search field: a TextInput with type="search" and a magnifier icon. */
|
|
8
|
+
export declare const Search: import("react").ForwardRefExoticComponent<Omit<TextInputProps, "type" | "leadingIcon"> & {
|
|
9
|
+
/** Corner style of the field; defaults to 'rounded', the same corners as every other control. 'pill' is fully round. */
|
|
10
|
+
shape?: "rounded" | "pill";
|
|
11
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { cx } from '../internal/cx.js';
|
|
5
|
+
import { TextInput } from '../text-input/TextInput.js';
|
|
6
|
+
/** A search field: a TextInput with type="search" and a magnifier icon. */
|
|
7
|
+
export const Search = forwardRef(function Search({ shape = 'rounded', className, ...props }, ref) {
|
|
8
|
+
return _jsx(TextInput, { ...props, ref: ref, className: cx('diya-search', `diya-search-${shape}`, className), type: "search", leadingIcon: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: [_jsx("circle", { cx: "10.5", cy: "10.5", r: "6.5" }), _jsx("path", { d: "m16 16 5 5" })] }) });
|
|
9
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ReactNode, type SelectHTMLAttributes } from 'react';
|
|
2
|
+
import { selectMessages } from './messages.js';
|
|
3
|
+
declare module '../messages.js' {
|
|
4
|
+
interface DiyaMessages {
|
|
5
|
+
select: typeof selectMessages;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type SelectOption = {
|
|
9
|
+
/** The value reported when this option is chosen; unique within the list. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** Visible option text. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Shows the option but stops it being chosen. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** A native single select. Native attributes, including `name`, `onChange(event)`, `onBlur` and the ref, go on the select; `className` and `style` go on the outer field wrapper. */
|
|
17
|
+
export type SelectProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size' | 'children' | 'multiple' | 'value' | 'defaultValue'> & {
|
|
18
|
+
/** Visible label above the select; also its accessible name. Hide it with hideLabel. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Hides the label visually but keeps it as the select's accessible name. */
|
|
21
|
+
hideLabel?: boolean;
|
|
22
|
+
/** Visible hint below the select, announced with it; `error` replaces it while set. */
|
|
23
|
+
helperText?: string;
|
|
24
|
+
/** Visible error message below the select; marks the field invalid while set. */
|
|
25
|
+
error?: string;
|
|
26
|
+
/** Control height and type size; defaults to 'medium'. */
|
|
27
|
+
size?: 'small' | 'medium' | 'large';
|
|
28
|
+
/** Visible text of the empty, unselectable first option, shown while value is ''; defaults to the `select.placeholder` message. */
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
/** Decorative icon inside the select's start edge; hidden from assistive tech. */
|
|
31
|
+
leadingIcon?: ReactNode;
|
|
32
|
+
/** The chosen option's value, or '' for none, when controlled; pair it with `onValueChange`. */
|
|
33
|
+
value?: string;
|
|
34
|
+
/** The initially chosen value when uncontrolled; defaults to '' (the placeholder), and a form reset returns to it. */
|
|
35
|
+
defaultValue?: string;
|
|
36
|
+
/** The choices, in display order. */
|
|
37
|
+
options: SelectOption[];
|
|
38
|
+
/** Called with the chosen option's value, like every other DIYA field. The native `onChange` still works. */
|
|
39
|
+
onValueChange?: (value: string) => void;
|
|
40
|
+
};
|
|
41
|
+
/** A labeled native dropdown for choosing one option; pair `value` with `onValueChange`. */
|
|
42
|
+
export declare const Select: import("react").ForwardRefExoticComponent<Omit<SelectHTMLAttributes<HTMLSelectElement>, "value" | "children" | "size" | "multiple" | "defaultValue"> & {
|
|
43
|
+
/** Visible label above the select; also its accessible name. Hide it with hideLabel. */
|
|
44
|
+
label: string;
|
|
45
|
+
/** Hides the label visually but keeps it as the select's accessible name. */
|
|
46
|
+
hideLabel?: boolean;
|
|
47
|
+
/** Visible hint below the select, announced with it; `error` replaces it while set. */
|
|
48
|
+
helperText?: string;
|
|
49
|
+
/** Visible error message below the select; marks the field invalid while set. */
|
|
50
|
+
error?: string;
|
|
51
|
+
/** Control height and type size; defaults to 'medium'. */
|
|
52
|
+
size?: "small" | "medium" | "large";
|
|
53
|
+
/** Visible text of the empty, unselectable first option, shown while value is ''; defaults to the `select.placeholder` message. */
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
/** Decorative icon inside the select's start edge; hidden from assistive tech. */
|
|
56
|
+
leadingIcon?: ReactNode;
|
|
57
|
+
/** The chosen option's value, or '' for none, when controlled; pair it with `onValueChange`. */
|
|
58
|
+
value?: string;
|
|
59
|
+
/** The initially chosen value when uncontrolled; defaults to '' (the placeholder), and a form reset returns to it. */
|
|
60
|
+
defaultValue?: string;
|
|
61
|
+
/** The choices, in display order. */
|
|
62
|
+
options: SelectOption[];
|
|
63
|
+
/** Called with the chosen option's value, like every other DIYA field. The native `onChange` still works. */
|
|
64
|
+
onValueChange?: (value: string) => void;
|
|
65
|
+
} & import("react").RefAttributes<HTMLSelectElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
|
+
import { useDiyaMessages } from '../DiyaProvider.js';
|
|
5
|
+
import { cx } from '../internal/cx.js';
|
|
6
|
+
import { selectMessages } from './messages.js';
|
|
7
|
+
/** A labeled native dropdown for choosing one option; pair `value` with `onValueChange`. */
|
|
8
|
+
export const Select = forwardRef(function Select({ label, hideLabel = false, helperText, error, size = 'medium', placeholder, leadingIcon, options, id, disabled, className, style, value, defaultValue, onChange, onValueChange, 'aria-invalid': ariaInvalid, 'aria-describedby': describedBy, ...props }, ref) {
|
|
9
|
+
const generated = useId();
|
|
10
|
+
const t = useDiyaMessages('select', selectMessages);
|
|
11
|
+
const fieldId = id ?? generated;
|
|
12
|
+
const description = error || helperText;
|
|
13
|
+
const descriptionId = `${fieldId}-description`;
|
|
14
|
+
return (_jsxs("div", { className: cx('diya-text-field diya-select-field', className), style: style, "data-size": size, "data-disabled": disabled || undefined, "data-invalid": !!error || undefined, children: [_jsx("label", { htmlFor: fieldId, className: hideLabel ? 'diya-sr-only' : undefined, children: label }), _jsxs("div", { className: "diya-select-control", children: [leadingIcon && (_jsx("span", { className: "diya-select-leading", "aria-hidden": "true", children: leadingIcon })), _jsxs("select", { ...props, ref: ref, id: fieldId, ...(value !== undefined ? { value } : { defaultValue: defaultValue ?? '' }), disabled: disabled, onChange: (event) => {
|
|
15
|
+
onChange?.(event);
|
|
16
|
+
onValueChange?.(event.target.value);
|
|
17
|
+
}, "aria-invalid": error ? true : ariaInvalid, "aria-describedby": [describedBy, description ? descriptionId : undefined].filter(Boolean).join(' ') ||
|
|
18
|
+
undefined, children: [_jsx("option", { value: "", disabled: true, children: placeholder ?? t.placeholder }), options.map((option) => (_jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value)))] }), _jsx("svg", { className: "diya-select-chevron", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: _jsx("path", { d: "m6 9 6 6 6-6" }) })] }), description && (_jsxs("p", { id: descriptionId, className: "diya-text-field-description", children: [error && _jsx("span", { "aria-hidden": "true", children: "!" }), description] }))] }));
|
|
19
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { siteHeaderMessages } from './messages.js';
|
|
3
|
+
declare module '../messages.js' {
|
|
4
|
+
interface DiyaMessages {
|
|
5
|
+
siteHeader: typeof siteHeaderMessages;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type SiteHeaderItem = {
|
|
9
|
+
/** Stable key; matched against the header's `value` and passed to `onValueChange`. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** Visible link text. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Renders a real link through the provider's `linkComponent`; plain clicks call `onValueChange` instead of navigating when it is given. */
|
|
14
|
+
href?: string;
|
|
15
|
+
/** Shows the item but prevents choosing it. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type SiteHeaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
/** Logo or product name at the start of the header. */
|
|
20
|
+
brand: ReactNode;
|
|
21
|
+
/** Accessible name of the brand link or button (not shown); defaults to "Home". */
|
|
22
|
+
brandLabel?: string;
|
|
23
|
+
/** Makes the brand a link to this URL, through the provider's `linkComponent`. */
|
|
24
|
+
brandHref?: string;
|
|
25
|
+
/** Makes the brand a button that calls this, when there is no `brandHref`. */
|
|
26
|
+
onBrandClick?: () => void;
|
|
27
|
+
/** Top-level navigation links; they collapse into a menu button when space runs out. */
|
|
28
|
+
items?: SiteHeaderItem[];
|
|
29
|
+
/** The current item's `value`; it is marked as the current page. */
|
|
30
|
+
value?: string;
|
|
31
|
+
/** Called with an item's `value` when it is chosen; routing belongs to the caller. */
|
|
32
|
+
onValueChange?: (value: string) => void;
|
|
33
|
+
/** Accessible name for the navigation landmark (not shown); defaults to "Main navigation". */
|
|
34
|
+
navigationLabel?: string;
|
|
35
|
+
/** Adds a search field; the caller owns its text. */
|
|
36
|
+
search?: {
|
|
37
|
+
/** The search field's text. */
|
|
38
|
+
value: string;
|
|
39
|
+
/** Called with the new text on every keystroke. */
|
|
40
|
+
onValueChange: (value: string) => void;
|
|
41
|
+
/** Called with the text when the person presses Enter. */
|
|
42
|
+
onSubmit?: (value: string) => void;
|
|
43
|
+
/** Accessible name for the field and search landmark (not shown); defaults to "Search". */
|
|
44
|
+
label?: string;
|
|
45
|
+
/** Placeholder text; defaults to "Search". */
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
};
|
|
48
|
+
/** Slot for icon buttons such as notifications or help, before the avatar. */
|
|
49
|
+
utilities?: ReactNode;
|
|
50
|
+
/** Slot at the end for the account avatar or its menu. */
|
|
51
|
+
avatar?: ReactNode;
|
|
52
|
+
};
|
|
53
|
+
/** A responsive top bar with brand, navigation, search and utilities that collapses its links into a menu when space runs out. The ref, `className`, `style` and other attributes go to the outer container. */
|
|
54
|
+
export declare const SiteHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
55
|
+
/** Logo or product name at the start of the header. */
|
|
56
|
+
brand: ReactNode;
|
|
57
|
+
/** Accessible name of the brand link or button (not shown); defaults to "Home". */
|
|
58
|
+
brandLabel?: string;
|
|
59
|
+
/** Makes the brand a link to this URL, through the provider's `linkComponent`. */
|
|
60
|
+
brandHref?: string;
|
|
61
|
+
/** Makes the brand a button that calls this, when there is no `brandHref`. */
|
|
62
|
+
onBrandClick?: () => void;
|
|
63
|
+
/** Top-level navigation links; they collapse into a menu button when space runs out. */
|
|
64
|
+
items?: SiteHeaderItem[];
|
|
65
|
+
/** The current item's `value`; it is marked as the current page. */
|
|
66
|
+
value?: string;
|
|
67
|
+
/** Called with an item's `value` when it is chosen; routing belongs to the caller. */
|
|
68
|
+
onValueChange?: (value: string) => void;
|
|
69
|
+
/** Accessible name for the navigation landmark (not shown); defaults to "Main navigation". */
|
|
70
|
+
navigationLabel?: string;
|
|
71
|
+
/** Adds a search field; the caller owns its text. */
|
|
72
|
+
search?: {
|
|
73
|
+
/** The search field's text. */
|
|
74
|
+
value: string;
|
|
75
|
+
/** Called with the new text on every keystroke. */
|
|
76
|
+
onValueChange: (value: string) => void;
|
|
77
|
+
/** Called with the text when the person presses Enter. */
|
|
78
|
+
onSubmit?: (value: string) => void;
|
|
79
|
+
/** Accessible name for the field and search landmark (not shown); defaults to "Search". */
|
|
80
|
+
label?: string;
|
|
81
|
+
/** Placeholder text; defaults to "Search". */
|
|
82
|
+
placeholder?: string;
|
|
83
|
+
};
|
|
84
|
+
/** Slot for icon buttons such as notifications or help, before the avatar. */
|
|
85
|
+
utilities?: ReactNode;
|
|
86
|
+
/** Slot at the end for the account avatar or its menu. */
|
|
87
|
+
avatar?: ReactNode;
|
|
88
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|