@ptbdynamic/plinth 0.0.0-stage → 0.2.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.
Files changed (150) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +258 -2
  3. package/package.json +99 -4
  4. package/packages/css/dist/avatar.css +122 -0
  5. package/packages/css/dist/badge.css +76 -0
  6. package/packages/css/dist/button.css +273 -0
  7. package/packages/css/dist/callout.css +143 -0
  8. package/packages/css/dist/code-block.css +283 -0
  9. package/packages/css/dist/confirm-dialog.css +183 -0
  10. package/packages/css/dist/data-table.css +470 -0
  11. package/packages/css/dist/dialog.css +113 -0
  12. package/packages/css/dist/drawer.css +156 -0
  13. package/packages/css/dist/fonts/geist/LICENSE +93 -0
  14. package/packages/css/dist/fonts/geist/geist-cyrillic-ext-wght-normal.woff2 +0 -0
  15. package/packages/css/dist/fonts/geist/geist-cyrillic-wght-normal.woff2 +0 -0
  16. package/packages/css/dist/fonts/geist/geist-latin-ext-wght-normal.woff2 +0 -0
  17. package/packages/css/dist/fonts/geist/geist-latin-wght-normal.woff2 +0 -0
  18. package/packages/css/dist/fonts/geist/geist-vietnamese-wght-normal.woff2 +0 -0
  19. package/packages/css/dist/fonts/geist-mono/LICENSE +93 -0
  20. package/packages/css/dist/fonts/geist-mono/geist-mono-cyrillic-ext-wght-normal.woff2 +0 -0
  21. package/packages/css/dist/fonts/geist-mono/geist-mono-cyrillic-wght-normal.woff2 +0 -0
  22. package/packages/css/dist/fonts/geist-mono/geist-mono-latin-ext-wght-normal.woff2 +0 -0
  23. package/packages/css/dist/fonts/geist-mono/geist-mono-latin-wght-normal.woff2 +0 -0
  24. package/packages/css/dist/fonts/geist-mono/geist-mono-symbols2-wght-normal.woff2 +0 -0
  25. package/packages/css/dist/fonts/geist-mono/geist-mono-vietnamese-wght-normal.woff2 +0 -0
  26. package/packages/css/dist/fonts/index.css +109 -0
  27. package/packages/css/dist/header.css +110 -0
  28. package/packages/css/dist/icon.css +51 -0
  29. package/packages/css/dist/list-card.css +76 -0
  30. package/packages/css/dist/list-row.css +164 -0
  31. package/packages/css/dist/menu-sheet.css +84 -0
  32. package/packages/css/dist/menu.css +245 -0
  33. package/packages/css/dist/modal.css +367 -0
  34. package/packages/css/dist/page-header.css +124 -0
  35. package/packages/css/dist/pill-row.css +197 -0
  36. package/packages/css/dist/plinth.css +4446 -0
  37. package/packages/css/dist/section-menu.css +226 -0
  38. package/packages/css/dist/sheet.css +239 -0
  39. package/packages/css/dist/text-field.css +230 -0
  40. package/packages/css/dist/textarea.css +169 -0
  41. package/packages/css/dist/tokens.css +413 -0
  42. package/packages/react/dist/PlinthAvatar.d.ts +17 -0
  43. package/packages/react/dist/PlinthBadge.d.ts +7 -0
  44. package/packages/react/dist/PlinthButton.d.ts +29 -0
  45. package/packages/react/dist/PlinthCallout.d.ts +16 -0
  46. package/packages/react/dist/PlinthCodeBlock.d.ts +24 -0
  47. package/packages/react/dist/PlinthConfirmDialog.d.ts +38 -0
  48. package/packages/react/dist/PlinthDataTable.d.ts +11 -0
  49. package/packages/react/dist/PlinthDataTableCell.d.ts +15 -0
  50. package/packages/react/dist/PlinthDataTableColumn.d.ts +13 -0
  51. package/packages/react/dist/PlinthDataTableEmpty.d.ts +9 -0
  52. package/packages/react/dist/PlinthDataTableRow.d.ts +9 -0
  53. package/packages/react/dist/PlinthDataTableSort.d.ts +4 -0
  54. package/packages/react/dist/PlinthDialog.d.ts +26 -0
  55. package/packages/react/dist/PlinthDrawer.d.ts +29 -0
  56. package/packages/react/dist/PlinthIcon.d.ts +10 -0
  57. package/packages/react/dist/PlinthIconButton.d.ts +26 -0
  58. package/packages/react/dist/PlinthListCard.d.ts +14 -0
  59. package/packages/react/dist/PlinthListRow.d.ts +29 -0
  60. package/packages/react/dist/PlinthMenu.d.ts +12 -0
  61. package/packages/react/dist/PlinthMenuGroup.d.ts +9 -0
  62. package/packages/react/dist/PlinthMenuItem.d.ts +26 -0
  63. package/packages/react/dist/PlinthMenuSeparator.d.ts +4 -0
  64. package/packages/react/dist/PlinthMenuSheet.d.ts +24 -0
  65. package/packages/react/dist/PlinthPageHeader.d.ts +17 -0
  66. package/packages/react/dist/PlinthPill.d.ts +17 -0
  67. package/packages/react/dist/PlinthPillRow.d.ts +13 -0
  68. package/packages/react/dist/PlinthSectionMenu.d.ts +11 -0
  69. package/packages/react/dist/PlinthSectionMenuItem.d.ts +20 -0
  70. package/packages/react/dist/PlinthSheet.d.ts +26 -0
  71. package/packages/react/dist/PlinthTextField.d.ts +24 -0
  72. package/packages/react/dist/PlinthTextarea.d.ts +24 -0
  73. package/packages/react/dist/avatar.d.ts +12 -0
  74. package/packages/react/dist/button.d.ts +21 -0
  75. package/packages/react/dist/callout.d.ts +19 -0
  76. package/packages/react/dist/code-block.d.ts +16 -0
  77. package/packages/react/dist/confirm-dialog.d.ts +23 -0
  78. package/packages/react/dist/data-table.d.ts +15 -0
  79. package/packages/react/dist/dialog.d.ts +10 -0
  80. package/packages/react/dist/drawer.d.ts +20 -0
  81. package/packages/react/dist/heading.d.ts +5 -0
  82. package/packages/react/dist/icon.d.ts +5 -0
  83. package/packages/react/dist/index.d.ts +49 -0
  84. package/packages/react/dist/index.js +1326 -0
  85. package/packages/react/dist/list-row.d.ts +5 -0
  86. package/packages/react/dist/markup.d.ts +9 -0
  87. package/packages/react/dist/menu.d.ts +7 -0
  88. package/packages/react/dist/page-header.d.ts +5 -0
  89. package/packages/react/dist/sheet.d.ts +12 -0
  90. package/packages/react/dist/size.d.ts +13 -0
  91. package/packages/react/dist/swipe.d.ts +15 -0
  92. package/packages/react/dist/text-field.d.ts +10 -0
  93. package/packages/react/dist/tones.d.ts +5 -0
  94. package/packages/tokens/dist/index.d.ts +230 -0
  95. package/packages/tokens/dist/index.js +4091 -0
  96. package/packages/tokens/dist/tailwind-theme.css +80 -0
  97. package/packages/tokens/dist/tokens.css +413 -0
  98. package/packages/tokens/dist/tokens.json +3875 -0
  99. package/packages/vue/dist/PlinthAvatar.vue.d.ts +24 -0
  100. package/packages/vue/dist/PlinthBadge.vue.d.ts +21 -0
  101. package/packages/vue/dist/PlinthButton.vue.d.ts +42 -0
  102. package/packages/vue/dist/PlinthCallout.vue.d.ts +31 -0
  103. package/packages/vue/dist/PlinthCodeBlock.vue.d.ts +49 -0
  104. package/packages/vue/dist/PlinthConfirmDialog.vue.d.ts +51 -0
  105. package/packages/vue/dist/PlinthDataTable.vue.d.ts +21 -0
  106. package/packages/vue/dist/PlinthDataTableCell.vue.d.ts +29 -0
  107. package/packages/vue/dist/PlinthDataTableColumn.vue.d.ts +26 -0
  108. package/packages/vue/dist/PlinthDataTableEmpty.vue.d.ts +19 -0
  109. package/packages/vue/dist/PlinthDataTableRow.vue.d.ts +19 -0
  110. package/packages/vue/dist/PlinthDataTableSort.vue.d.ts +13 -0
  111. package/packages/vue/dist/PlinthDialog.vue.d.ts +45 -0
  112. package/packages/vue/dist/PlinthDrawer.vue.d.ts +48 -0
  113. package/packages/vue/dist/PlinthIcon.vue.d.ts +23 -0
  114. package/packages/vue/dist/PlinthIconButton.vue.d.ts +37 -0
  115. package/packages/vue/dist/PlinthListCard.vue.d.ts +26 -0
  116. package/packages/vue/dist/PlinthListRow.vue.d.ts +38 -0
  117. package/packages/vue/dist/PlinthMenu.vue.d.ts +24 -0
  118. package/packages/vue/dist/PlinthMenuGroup.vue.d.ts +17 -0
  119. package/packages/vue/dist/PlinthMenuItem.vue.d.ts +34 -0
  120. package/packages/vue/dist/PlinthMenuSeparator.vue.d.ts +3 -0
  121. package/packages/vue/dist/PlinthMenuSheet.vue.d.ts +48 -0
  122. package/packages/vue/dist/PlinthPageHeader.vue.d.ts +27 -0
  123. package/packages/vue/dist/PlinthPill.vue.d.ts +28 -0
  124. package/packages/vue/dist/PlinthPillRow.vue.d.ts +22 -0
  125. package/packages/vue/dist/PlinthSectionMenu.vue.d.ts +22 -0
  126. package/packages/vue/dist/PlinthSectionMenuItem.vue.d.ts +28 -0
  127. package/packages/vue/dist/PlinthSheet.vue.d.ts +45 -0
  128. package/packages/vue/dist/PlinthTextField.vue.d.ts +51 -0
  129. package/packages/vue/dist/PlinthTextarea.vue.d.ts +42 -0
  130. package/packages/vue/dist/avatar.d.ts +12 -0
  131. package/packages/vue/dist/button.d.ts +5 -0
  132. package/packages/vue/dist/callout.d.ts +19 -0
  133. package/packages/vue/dist/code-block.d.ts +16 -0
  134. package/packages/vue/dist/confirm-dialog.d.ts +23 -0
  135. package/packages/vue/dist/data-table.d.ts +15 -0
  136. package/packages/vue/dist/dialog.d.ts +10 -0
  137. package/packages/vue/dist/drawer.d.ts +20 -0
  138. package/packages/vue/dist/heading.d.ts +5 -0
  139. package/packages/vue/dist/icon.d.ts +5 -0
  140. package/packages/vue/dist/index.d.ts +53 -0
  141. package/packages/vue/dist/index.js +1732 -0
  142. package/packages/vue/dist/list-row.d.ts +5 -0
  143. package/packages/vue/dist/menu.d.ts +8 -0
  144. package/packages/vue/dist/page-header.d.ts +5 -0
  145. package/packages/vue/dist/sheet.d.ts +12 -0
  146. package/packages/vue/dist/size.d.ts +13 -0
  147. package/packages/vue/dist/slots.d.ts +3 -0
  148. package/packages/vue/dist/swipe.d.ts +12 -0
  149. package/packages/vue/dist/text-field.d.ts +10 -0
  150. package/packages/vue/dist/tones.d.ts +5 -0
@@ -0,0 +1,24 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type CodeBlockTab } from './code-block';
3
+ interface CodeBlockOptions {
4
+ /** A file name or a short label above the code; it may hold a little markup (a badge). */
5
+ label?: ReactNode;
6
+ /** The highlighter's markup for the code (trusted, not escaped), in place of `children`. */
7
+ html?: string;
8
+ /** Language tabs (up to six), each with its own code; `children` is then not used. */
9
+ tabs?: CodeBlockTab[];
10
+ /** The tab that starts checked (later the browser keeps it); the first when unknown. */
11
+ selected?: string;
12
+ /** The tabs' accessible name. */
13
+ tabsLabel?: string;
14
+ /** Shows the copy button. */
15
+ copy?: boolean;
16
+ copyLabel?: string;
17
+ /** What the button and the status say for two seconds after copying. */
18
+ copiedLabel?: string;
19
+ /** The code was copied to the clipboard (Vue's `copied` event). */
20
+ onCopied?: (text: string) => void;
21
+ }
22
+ export type PlinthCodeBlockProps = CodeBlockOptions & Omit<ComponentProps<'div'>, keyof CodeBlockOptions>;
23
+ export declare function PlinthCodeBlock({ id, label, html, tabs: allTabs, selected, tabsLabel, copy, copyLabel, copiedLabel, onCopied, className, children, ...rest }: PlinthCodeBlockProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,38 @@
1
+ import { type ComponentProps } from 'react';
2
+ import { type ConfirmDialogKind, type ConfirmDialogTone } from './confirm-dialog';
3
+ import { type DialogSidePhone } from './dialog';
4
+ interface ConfirmDialogOptions {
5
+ /** The dialog's id; one is generated when it is missing. */
6
+ id?: string;
7
+ /** The question, and the dialog's accessible name. */
8
+ title: string;
9
+ /** What happens if the person confirms, and the dialog's accessible description. */
10
+ message: string;
11
+ /** What it asks for: only a yes, a phrase typed exactly, or the person's password. */
12
+ kind?: ConfirmDialogKind;
13
+ /** The phrase to type, for the type-to-confirm kind. */
14
+ phrase?: string;
15
+ /** The field's label; `:phrase` shows the phrase in it. Each kind has a default. */
16
+ fieldLabel?: string;
17
+ /** The confirm button's label. */
18
+ confirmLabel?: string;
19
+ /** The cancel button's label. */
20
+ cancelLabel?: string;
21
+ /** danger makes the confirm button the danger variant, for a destructive action. */
22
+ tone?: ConfirmDialogTone;
23
+ /** A message under the field, set by the app (a wrong password). */
24
+ error?: string;
25
+ /** The confirm button is busy while the app checks. */
26
+ busy?: boolean;
27
+ /** How it shows below 768px: centred, or a bottom sheet. */
28
+ sidePhone?: DialogSidePhone;
29
+ }
30
+ /**
31
+ * A confirmation dialog on a `<dialog>`: open it with a button that has `commandfor` and
32
+ * `command="show-modal"`, or with `showModal()` on a ref. `onSubmit` (it bubbles from the form)
33
+ * is the confirm, after the browser checked the field; `onClose` is the dialog's close event
34
+ * (Vue's `close`), with `returnValue` "confirm", "cancel" (Cancel) or "" (Escape).
35
+ */
36
+ export type PlinthConfirmDialogProps = ConfirmDialogOptions & Omit<ComponentProps<'dialog'>, keyof ConfirmDialogOptions | 'children'>;
37
+ export declare function PlinthConfirmDialog({ id, title, message, kind, phrase, fieldLabel, confirmLabel, cancelLabel, tone, error, busy, sidePhone, className, ...rest }: PlinthConfirmDialogProps): import("react").JSX.Element;
38
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ interface DataTableOptions {
3
+ /** The table's name, shown above it. Without it, name the table with aria-label. */
4
+ caption?: string;
5
+ /** The column headers, PlinthDataTableColumn elements (Vue's `head` slot). */
6
+ head?: ReactNode;
7
+ }
8
+ /** A table that becomes a card per row on a phone: `children` are its rows. */
9
+ export type PlinthDataTableProps = DataTableOptions & Omit<ComponentProps<'table'>, keyof DataTableOptions>;
10
+ export declare function PlinthDataTable({ caption, head, className, children, ...rest }: PlinthDataTableProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { type DataTableCellKind } from './data-table';
3
+ interface DataTableCellOptions {
4
+ /** The column's name, shown before the value on a phone's card. */
5
+ label?: string;
6
+ /** What the cell is on a phone's card: a labelled field, the card's title, or its actions. */
7
+ kind?: DataTableCellKind;
8
+ /** Numbers: aligned to the end, with figures of one width. */
9
+ numeric?: boolean;
10
+ /** Hidden on a phone's card; shown from 768px up. */
11
+ hideOnPhone?: boolean;
12
+ }
13
+ export type PlinthDataTableCellProps = DataTableCellOptions & Omit<ComponentProps<'td'>, keyof DataTableCellOptions>;
14
+ export declare function PlinthDataTableCell({ label, kind, numeric, hideOnPhone, className, children, ...rest }: PlinthDataTableCellProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { type DataTableSort } from './data-table';
3
+ interface DataTableColumnOptions {
4
+ /** A sortable column's state, printed as aria-sort; put a PlinthDataTableSort in it. */
5
+ sort?: DataTableSort;
6
+ /** Numbers: aligned to the end, with figures of one width. */
7
+ numeric?: boolean;
8
+ /** Hidden on a phone's card; shown from 768px up. Give the column's cells the same. */
9
+ hideOnPhone?: boolean;
10
+ }
11
+ export type PlinthDataTableColumnProps = DataTableColumnOptions & Omit<ComponentProps<'th'>, keyof DataTableColumnOptions>;
12
+ export declare function PlinthDataTableColumn({ sort, numeric, hideOnPhone, className, children, ...rest }: PlinthDataTableColumnProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface DataTableEmptyOptions {
3
+ /** How many columns the table has; the empty cell spans them all. */
4
+ columns?: number | string;
5
+ }
6
+ /** The row in place of the rows when there are none: `children` say so. */
7
+ export type PlinthDataTableEmptyProps = DataTableEmptyOptions & Omit<ComponentProps<'tr'>, keyof DataTableEmptyOptions>;
8
+ export declare function PlinthDataTableEmpty({ columns, className, children, ...rest }: PlinthDataTableEmptyProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface DataTableRowOptions {
3
+ /** A selectable row's state, printed as aria-selected; leave it out when rows can't be selected. */
4
+ selected?: boolean;
5
+ }
6
+ /** A row of PlinthDataTableCell elements. */
7
+ export type PlinthDataTableRowProps = DataTableRowOptions & Omit<ComponentProps<'tr'>, keyof DataTableRowOptions>;
8
+ export declare function PlinthDataTableRow({ selected, className, children, ...rest }: PlinthDataTableRowProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ComponentProps } from 'react';
2
+ /** The sort button in a sortable column's header; the column's `sort` says its state. */
3
+ export type PlinthDataTableSortProps = ComponentProps<'button'>;
4
+ export declare function PlinthDataTableSort({ className, children, ...rest }: PlinthDataTableSortProps): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type DialogSidePhone } from './dialog';
3
+ interface DialogOptions {
4
+ /** The dialog's id; one is generated when it is missing. */
5
+ id?: string;
6
+ /** The heading, and the dialog's accessible name. */
7
+ title: string;
8
+ /** A line under the title, and the dialog's accessible description. */
9
+ description?: string;
10
+ /** The close button's accessible name. */
11
+ closeLabel?: string;
12
+ /** Whether the close button, Escape and the backdrop close it; false makes an alert dialog. */
13
+ dismissible?: boolean;
14
+ /** How it shows below 768px: centred, or a bottom sheet. */
15
+ sidePhone?: DialogSidePhone;
16
+ /** The actions under the body (Vue's `footer` slot). */
17
+ footer?: ReactNode;
18
+ }
19
+ /**
20
+ * A `<dialog>`: open it with a button that has `commandfor` and `command="show-modal"`, or with
21
+ * `showModal()` on a ref. `onClose` is the dialog's close event (Vue's `close`): its buttons, the
22
+ * close button, Escape, the backdrop or `close()`.
23
+ */
24
+ export type PlinthDialogProps = DialogOptions & Omit<ComponentProps<'dialog'>, keyof DialogOptions>;
25
+ export declare function PlinthDialog({ id, title, description, closeLabel, dismissible, sidePhone, footer, className, children, ref, ...rest }: PlinthDialogProps): import("react").JSX.Element;
26
+ export {};
@@ -0,0 +1,29 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type DrawerDesktop, type DrawerSnap } from './drawer';
3
+ interface DrawerOptions {
4
+ /** The dialog's id; one is generated when it is missing. */
5
+ id?: string;
6
+ /** The heading, and the drawer's accessible name. */
7
+ title: string;
8
+ /** A line under the title, and the drawer's accessible description. */
9
+ description?: string;
10
+ /** The close button's accessible name. */
11
+ closeLabel?: string;
12
+ /** Its presentation from 768px up: a dialog or a sheet. */
13
+ desktop?: DrawerDesktop;
14
+ /** Where it can rest on a phone (a list, or a string separated by spaces); none for as tall as its content. */
15
+ snapPoints?: readonly DrawerSnap[] | string;
16
+ /** The snap point it opens at; the largest listed when it is missing. */
17
+ snap?: DrawerSnap;
18
+ /** The actions under the body (Vue's `footer` slot). */
19
+ footer?: ReactNode;
20
+ }
21
+ /**
22
+ * A `<dialog>` on the bottom edge of a phone that the person drags: open it with a button that
23
+ * has `commandfor` and `command="show-modal"`, or with `showModal()` on a ref. `onClose` is the
24
+ * dialog's close event (Vue's `close`): the close button, Escape, the backdrop, a swipe down or
25
+ * `close()`.
26
+ */
27
+ export type PlinthDrawerProps = DrawerOptions & Omit<ComponentProps<'dialog'>, keyof DrawerOptions>;
28
+ export declare function PlinthDrawer({ id, title, description, closeLabel, desktop, snapPoints, snap, footer, className, children, ref, ...rest }: PlinthDrawerProps): import("react").JSX.Element;
29
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { type IconSize } from './icon';
3
+ export type PlinthIconProps = ComponentProps<'span'> & {
4
+ size?: IconSize;
5
+ /** Makes the icon meaningful; without it the icon is decorative and hidden. */
6
+ label?: string;
7
+ /** Flips the icon in right-to-left text, for icons that point a direction. */
8
+ mirror?: boolean;
9
+ };
10
+ export declare function PlinthIcon({ size, label, mirror, className, children, 'aria-label': ariaLabel, ...rest }: PlinthIconProps): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { type ButtonVariant, type InvokerCommandProps } from './button';
3
+ import { type ControlSize } from './size';
4
+ interface IconButtonOptions {
5
+ /** The accessible name: required, since the button has no visible text. */
6
+ label: string;
7
+ variant?: ButtonVariant;
8
+ size?: ControlSize;
9
+ disabled?: boolean;
10
+ busy?: boolean;
11
+ /** Makes it a toggle: true or false prints aria-pressed. */
12
+ pressed?: boolean | null;
13
+ /** Flips the icon in right-to-left text, for icons that point a direction. */
14
+ mirror?: boolean;
15
+ }
16
+ /**
17
+ * A `<button>` with only an icon, or with an `href` a link that looks like one. The button takes
18
+ * `commandfor` and `command`; a link doesn't.
19
+ */
20
+ export type PlinthIconButtonProps = (IconButtonOptions & InvokerCommandProps & Omit<ComponentProps<'button'>, keyof IconButtonOptions | keyof InvokerCommandProps> & {
21
+ href?: undefined;
22
+ }) | (IconButtonOptions & Omit<ComponentProps<'a'>, keyof IconButtonOptions> & {
23
+ href: string;
24
+ });
25
+ export declare function PlinthIconButton({ label, href, variant, size, disabled, busy, pressed, mirror, className, children, 'aria-label': ariaLabel, ...rest }: PlinthIconButtonProps): import("react").JSX.Element;
26
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { type HeadingLevel } from './heading';
3
+ interface ListCardOptions {
4
+ /** A heading above the card. */
5
+ heading?: string;
6
+ /** The heading's element, h2 to h6. */
7
+ headingLevel?: HeadingLevel;
8
+ /** A note under the card. */
9
+ footer?: string;
10
+ }
11
+ /** A card of list rows: `children` are its `<li>` elements, each holding a list row. */
12
+ export type PlinthListCardProps = ListCardOptions & Omit<ComponentProps<'div'>, keyof ListCardOptions>;
13
+ export declare function PlinthListCard({ heading, headingLevel, footer, className, children, ...rest }: PlinthListCardProps): import("react").JSX.Element;
14
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { ComponentProps, ReactNode, Ref } from 'react';
2
+ interface ListRowOptions {
3
+ /** A second line under the title. */
4
+ description?: string;
5
+ /** The row's own chevron, at the end, for a row that opens something. */
6
+ chevron?: boolean;
7
+ /** Renders the row as a button, when it has no href. */
8
+ button?: boolean;
9
+ /** The row for the page being shown: aria-current="page", on a link or static row. */
10
+ current?: boolean;
11
+ /** Disables a link or button row. */
12
+ disabled?: boolean;
13
+ /** Before the title: an icon or an avatar (Vue's `leading` slot). */
14
+ leading?: ReactNode;
15
+ /** After the title: a value, a badge or a switch (Vue's `trailing` slot). */
16
+ trailing?: ReactNode;
17
+ }
18
+ /**
19
+ * A link with an `href`, a `<button>` with `button`, otherwise a static `<div>`. Without an
20
+ * `href` the root may be either, so its `ref` is an HTMLElement.
21
+ */
22
+ export type PlinthListRowProps = (ListRowOptions & Omit<ComponentProps<'a'>, keyof ListRowOptions> & {
23
+ href: string;
24
+ }) | (ListRowOptions & Omit<ComponentProps<'button'>, keyof ListRowOptions | 'ref'> & {
25
+ href?: undefined;
26
+ ref?: Ref<HTMLElement>;
27
+ });
28
+ export declare function PlinthListRow({ description, chevron, href, button, current, disabled, leading, trailing, className, children, ...rest }: PlinthListRowProps): import("react").JSX.Element;
29
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface MenuOptions {
3
+ /** The menu's id, which its button names in `popoverTarget`. */
4
+ id: string;
5
+ }
6
+ /**
7
+ * A `<div popover="auto">`: open it with a button that has `popoverTarget` set to its id (or
8
+ * `commandfor` and `command="toggle-popover"`). Its `onToggle` is the popover's toggle event.
9
+ */
10
+ export type PlinthMenuProps = MenuOptions & Omit<ComponentProps<'div'>, keyof MenuOptions>;
11
+ export declare function PlinthMenu({ id, className, children, ...rest }: PlinthMenuProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface MenuGroupOptions {
3
+ /** The heading over the group's items, and the group's accessible name. */
4
+ label?: string;
5
+ }
6
+ /** A `<div role="group">` of menu items under a heading. */
7
+ export type PlinthMenuGroupProps = MenuGroupOptions & Omit<ComponentProps<'div'>, keyof MenuGroupOptions>;
8
+ export declare function PlinthMenuGroup({ label, className, children, ...rest }: PlinthMenuGroupProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import type { InvokerCommandProps } from './button';
3
+ import { type MenuItemTone } from './menu';
4
+ interface MenuItemOptions {
5
+ /** `danger` for an item that destroys or removes something. */
6
+ tone?: MenuItemTone;
7
+ /** A keyboard shortcut to show at the item's end, such as ⌘D. */
8
+ shortcut?: string;
9
+ /** Disables the item. */
10
+ disabled?: boolean;
11
+ /** The id of the menu a button item closes; the menu around it when missing. */
12
+ menu?: string;
13
+ /** The project's icon before the label, decorative (Vue's `icon` slot). */
14
+ icon?: ReactNode;
15
+ }
16
+ /**
17
+ * A `<button>` that closes its menu when pressed (its own `commandfor` and `command` win), or
18
+ * with an `href` a link. The label is `children`.
19
+ */
20
+ export type PlinthMenuItemProps = (MenuItemOptions & InvokerCommandProps & Omit<ComponentProps<'button'>, keyof MenuItemOptions | keyof InvokerCommandProps> & {
21
+ href?: undefined;
22
+ }) | (MenuItemOptions & Omit<ComponentProps<'a'>, keyof MenuItemOptions> & {
23
+ href: string;
24
+ });
25
+ export declare function PlinthMenuItem({ href, tone, shortcut, disabled, menu, icon, className, children, ...rest }: PlinthMenuItemProps): import("react").JSX.Element;
26
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ComponentProps } from 'react';
2
+ /** An `<hr>` between a menu's items. */
3
+ export type PlinthMenuSeparatorProps = ComponentProps<'hr'>;
4
+ export declare function PlinthMenuSeparator({ className, ...rest }: PlinthMenuSeparatorProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type PlinthSheetProps } from './PlinthSheet';
3
+ interface MenuSheetOptions {
4
+ /** The dialog's id, for the menu button's commandfor; one is generated when it is missing. */
5
+ id?: string;
6
+ /** The heading, and the sheet's and the navigation's accessible name. */
7
+ title?: string;
8
+ /** The close button's accessible name. */
9
+ closeLabel?: string;
10
+ /** The signed-in user's name; leave it out for no user row. */
11
+ userName?: string;
12
+ /** A second line under the name: an email or a role. */
13
+ userDetail?: string;
14
+ /** The user's picture; initials from the name stand in without it. */
15
+ userSrc?: string;
16
+ /** Makes the user row a link, to the profile. */
17
+ userHref?: string;
18
+ /** The account's rows under the navigation, such as Sign out (Vue's `account` slot). */
19
+ account?: ReactNode;
20
+ }
21
+ /** A sheet from the end: `children` are the navigation. `onClose` is the dialog's close event. */
22
+ export type PlinthMenuSheetProps = MenuSheetOptions & Omit<PlinthSheetProps, keyof MenuSheetOptions | 'description' | 'side' | 'sidePhone' | 'footer'>;
23
+ export declare function PlinthMenuSheet({ id, title, closeLabel, userName, userDetail, userSrc, userHref, account, className, children, ...rest }: PlinthMenuSheetProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import { type PageHeaderLevel } from './page-header';
3
+ interface PageHeaderOptions {
4
+ /** The page's heading. */
5
+ heading: string;
6
+ /** The heading's element: `h1`, or `h2` to `h6` beside another page's `h1`. */
7
+ level?: PageHeaderLevel;
8
+ /** The screen's top bar: it adds the top safe-area inset (data-top). */
9
+ top?: boolean;
10
+ /** The leading action, usually a menu button or a back link (Vue's `leading` slot). */
11
+ leading?: ReactNode;
12
+ /** The trailing actions: icon buttons or a primary button (Vue's `actions` slot). */
13
+ actions?: ReactNode;
14
+ }
15
+ export type PlinthPageHeaderProps = PageHeaderOptions & Omit<ComponentProps<'header'>, keyof PageHeaderOptions | 'children'>;
16
+ export declare function PlinthPageHeader({ heading, level, top, leading, actions, className, ...rest }: PlinthPageHeaderProps): import("react").JSX.Element;
17
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface PillOptions {
3
+ /** A number after the label, such as how many items the filter shows. */
4
+ count?: string | number | null;
5
+ /** The selected pill: aria-pressed="true" on a button, aria-current="page" on a link. */
6
+ selected?: boolean;
7
+ /** Disables the pill. */
8
+ disabled?: boolean;
9
+ }
10
+ /** A `<button>`, or with an `href` a link, for a row that navigates. */
11
+ export type PlinthPillProps = (PillOptions & Omit<ComponentProps<'button'>, keyof PillOptions> & {
12
+ href?: undefined;
13
+ }) | (PillOptions & Omit<ComponentProps<'a'>, keyof PillOptions> & {
14
+ href: string;
15
+ });
16
+ export declare function PlinthPill({ count, href, selected, disabled, className, children, ...rest }: PlinthPillProps): import("react").JSX.Element;
17
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps, Ref } from 'react';
2
+ interface PillRowOptions {
3
+ /** The row's accessible name (aria-label). */
4
+ label?: string;
5
+ /** Renders the row as a <nav>, for pills that are links. */
6
+ nav?: boolean;
7
+ }
8
+ /** A `<div role="group">`, or with `nav` a `<nav>`, so its `ref` is an HTMLElement. */
9
+ export type PlinthPillRowProps = PillRowOptions & Omit<ComponentProps<'div'>, keyof PillRowOptions | 'ref'> & {
10
+ ref?: Ref<HTMLElement>;
11
+ };
12
+ export declare function PlinthPillRow({ label, nav, className, children, ...rest }: PlinthPillRowProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface SectionMenuOptions {
3
+ /** The menu's accessible name (aria-label). */
4
+ label?: string;
5
+ /** A <nav> of links (the default); false for a <div role="group"> of buttons. */
6
+ nav?: boolean;
7
+ }
8
+ /** A `<nav>`, or without `nav` a `<div role="group">`. */
9
+ export type PlinthSectionMenuProps = SectionMenuOptions & Omit<ComponentProps<'nav'>, keyof SectionMenuOptions>;
10
+ export declare function PlinthSectionMenu({ label, nav, className, children, ...rest }: PlinthSectionMenuProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { ComponentProps } from 'react';
2
+ interface SectionMenuItemOptions {
3
+ /** A number after the label, such as how many items the section holds. */
4
+ count?: string | number | null;
5
+ /** The current section: aria-current="page" on a link, aria-pressed="true" on a button. */
6
+ current?: boolean;
7
+ /** Disables the item. */
8
+ disabled?: boolean;
9
+ }
10
+ /**
11
+ * A link to the section's address, or without an `href` a `<button>` that switches the view in
12
+ * place.
13
+ */
14
+ export type PlinthSectionMenuItemProps = (SectionMenuItemOptions & Omit<ComponentProps<'button'>, keyof SectionMenuItemOptions> & {
15
+ href?: undefined;
16
+ }) | (SectionMenuItemOptions & Omit<ComponentProps<'a'>, keyof SectionMenuItemOptions> & {
17
+ href: string;
18
+ });
19
+ export declare function PlinthSectionMenuItem({ count, href, current, disabled, className, children, ...rest }: PlinthSectionMenuItemProps): import("react").JSX.Element;
20
+ export {};
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type SheetSide } from './sheet';
3
+ interface SheetOptions {
4
+ /** The dialog's id; one is generated when it is missing. */
5
+ id?: string;
6
+ /** The heading, and the sheet's accessible name. */
7
+ title: string;
8
+ /** A line under the title, and the sheet's accessible description. */
9
+ description?: string;
10
+ /** The close button's accessible name. */
11
+ closeLabel?: string;
12
+ /** The edge the sheet comes from, at every width. */
13
+ side?: SheetSide;
14
+ /** The edge below 768px, when it is another one. */
15
+ sidePhone?: SheetSide;
16
+ /** The actions under the body (Vue's `footer` slot). */
17
+ footer?: ReactNode;
18
+ }
19
+ /**
20
+ * A `<dialog>`: open it with a button that has `commandfor` and `command="show-modal"`, or with
21
+ * `showModal()` on a ref. `onClose` is the dialog's close event (Vue's `close`): the close button,
22
+ * Escape, the backdrop or `close()`.
23
+ */
24
+ export type PlinthSheetProps = SheetOptions & Omit<ComponentProps<'dialog'>, keyof SheetOptions>;
25
+ export declare function PlinthSheet({ id, title, description, closeLabel, side, sidePhone, footer, className, children, ref, ...rest }: PlinthSheetProps): import("react").JSX.Element;
26
+ export {};
@@ -0,0 +1,24 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type TextFieldSize } from './text-field';
3
+ interface TextFieldOptions {
4
+ /** The label, and the field's accessible name. */
5
+ label: string;
6
+ /** Hides the label visually; screen readers still read it. */
7
+ hideLabel?: boolean;
8
+ size?: TextFieldSize;
9
+ /** A line under the field that helps fill it in. */
10
+ description?: string;
11
+ /** What is wrong with the value; it marks the field invalid. */
12
+ error?: string;
13
+ /** The leading icon (Vue's `icon` slot). */
14
+ icon?: ReactNode;
15
+ /** A small control or hint at the end, such as a clear button (Vue's `trailing` slot). */
16
+ trailing?: ReactNode;
17
+ }
18
+ /**
19
+ * A text field. `className` goes on the root; every other prop (`value`, `onChange`, `name`,
20
+ * `placeholder`, `ref`, …) on the `<input>`.
21
+ */
22
+ export type PlinthTextFieldProps = TextFieldOptions & Omit<ComponentProps<'input'>, keyof TextFieldOptions | 'children'>;
23
+ export declare function PlinthTextField({ label, hideLabel, id, type, size, description, error, icon, trailing, className, ...rest }: PlinthTextFieldProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ import { type ComponentProps } from 'react';
2
+ interface TextareaOptions {
3
+ /** The label, and the field's accessible name. */
4
+ label: string;
5
+ /** Hides the label visually; screen readers still read it. */
6
+ hideLabel?: boolean;
7
+ /** The lines it shows, and where it starts when it grows. */
8
+ rows?: number;
9
+ /** Grows with its content, from rows lines to maxRows, then scrolls. */
10
+ grow?: boolean;
11
+ /** The most lines it grows to. */
12
+ maxRows?: number;
13
+ /** A line under the field that helps fill it in. */
14
+ description?: string;
15
+ /** What is wrong with the value; it marks the field invalid. */
16
+ error?: string;
17
+ }
18
+ /**
19
+ * A textarea. `className` goes on the root; every other prop (`value`, `onChange`, `name`,
20
+ * `placeholder`, `ref`, …) on the `<textarea>`.
21
+ */
22
+ export type PlinthTextareaProps = TextareaOptions & Omit<ComponentProps<'textarea'>, keyof TextareaOptions | 'children'>;
23
+ export declare function PlinthTextarea({ label, hideLabel, id, rows, grow, maxRows, description, error, className, style, ...rest }: PlinthTextareaProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,12 @@
1
+ /** The avatar sizes (24, 32, 40 and 56 px), from the shared size scale. `md` is the default. */
2
+ export declare const avatarSizes: readonly ["sm", "md", "lg", "xl"];
3
+ export type AvatarSize = (typeof avatarSizes)[number];
4
+ /** A size from the list, or `md` when it is not one of them. */
5
+ export declare function avatarSize(value: string | undefined): AvatarSize;
6
+ /**
7
+ * Initials from a name: the first letter of the first and the last word, upper case. Blade's
8
+ * Initials::from() does the same; the parity tests compare them.
9
+ */
10
+ export declare function initialsFrom(name: string): string;
11
+ /** The person shown when there is neither an image nor a name to take initials from. */
12
+ export declare const avatarGlyph = "<svg class=\"plinth-avatar-glyph\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"9\" r=\"4\"></circle><path d=\"M4.5 20a7.5 7.5 0 0 1 15 0\"></path></svg>";
@@ -0,0 +1,21 @@
1
+ /** The button's variants. `primary` is the default. */
2
+ export declare const buttonVariants: readonly ["primary", "accent", "secondary", "ghost", "danger", "danger-ghost"];
3
+ export type ButtonVariant = (typeof buttonVariants)[number];
4
+ /** A variant from the list, or `primary` when it is not one of them. */
5
+ export declare function buttonVariant(value: string | undefined): ButtonVariant;
6
+ /**
7
+ * The invoker commands a button can send to the element its `commandfor` names: the dialog and
8
+ * popover commands, or a custom one, which starts with two dashes.
9
+ */
10
+ export type InvokerCommand = 'show-modal' | 'close' | 'request-close' | 'show-popover' | 'hide-popover' | 'toggle-popover' | `--${string}`;
11
+ /**
12
+ * The invoker command attributes, typed here because `@types/react` doesn't list them yet. React
13
+ * passes them to the DOM as they are, lowercase. Plinth types them on its own buttons rather than
14
+ * adding them to React's global types.
15
+ */
16
+ export interface InvokerCommandProps {
17
+ /** The id of the element the command goes to, such as a dialog. */
18
+ commandfor?: string;
19
+ /** What to do to it, such as `show-modal` or `close`. */
20
+ command?: InvokerCommand;
21
+ }
@@ -0,0 +1,19 @@
1
+ /** The callout's tones. `neutral` is the default. */
2
+ export declare const calloutTones: readonly ["neutral", "info", "success", "warning", "danger"];
3
+ export type CalloutTone = (typeof calloutTones)[number];
4
+ /** A tone from the list, or `neutral` when it is not one of them. */
5
+ export declare function calloutTone(value: string | undefined): CalloutTone;
6
+ /**
7
+ * The callout's roles: `note` (the default) for a note in the page, `status` for a message the
8
+ * app adds after something happens, `alert` for an urgent one. Assistive technology announces the
9
+ * last two when they appear.
10
+ */
11
+ export declare const calloutRoles: readonly ["note", "status", "alert"];
12
+ export type CalloutRole = (typeof calloutRoles)[number];
13
+ /** A role from the list, or `note` when it is not one of them. */
14
+ export declare function calloutRole(value: string | undefined): CalloutRole;
15
+ /**
16
+ * Each tone's icon, a different shape for each, so the tone never rests on colour alone. Blade's
17
+ * CalloutTone::icon() prints the same markup; the icon slot replaces it.
18
+ */
19
+ export declare const calloutIcons: Record<CalloutTone, string>;
@@ -0,0 +1,16 @@
1
+ /** A language tab: its name (Blade, Vue, React, HTML) and its code, as text or as markup. */
2
+ export interface CodeBlockTab {
3
+ label: string;
4
+ code: string;
5
+ /** The highlighter's markup for the code (trusted, not escaped), in place of `code`. */
6
+ html?: string;
7
+ }
8
+ /** The CSS shows the code of the first six tabs, so a block has at most six. */
9
+ export declare const codeBlockTabs: (tabs: readonly CodeBlockTab[]) => CodeBlockTab[];
10
+ /** The index of the tab that starts checked: the one labelled `selected`, or the first. */
11
+ export declare const checkedTab: (tabs: readonly CodeBlockTab[], selected: string | undefined) => number;
12
+ /**
13
+ * The text a code block's copy button copies: the code of the checked tab's <pre>, or of the only
14
+ * one. Vue's layer and Blade's Alpine do the same.
15
+ */
16
+ export declare function codeBlockText(button: Element): string;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * What the confirmation dialog asks for: `simple` (the default) asks only, `type` asks for a
3
+ * phrase typed exactly, `password` asks for the person's password, which the app checks.
4
+ */
5
+ export declare const confirmDialogKinds: readonly ["simple", "type", "password"];
6
+ export type ConfirmDialogKind = (typeof confirmDialogKinds)[number];
7
+ /** A kind from the list, or `simple` when it is not one of them. */
8
+ export declare function confirmDialogKind(value: string | undefined): ConfirmDialogKind;
9
+ /** The confirm button's tone: `neutral` (the default, a primary button) or `danger`. */
10
+ export declare const confirmDialogTones: readonly ["neutral", "danger"];
11
+ export type ConfirmDialogTone = (typeof confirmDialogTones)[number];
12
+ /** A tone from the list, or `neutral` when it is not one of them. */
13
+ export declare function confirmDialogTone(value: string | undefined): ConfirmDialogTone;
14
+ /** The field's label when the app gives none; `:phrase` is where the phrase goes. */
15
+ export declare const confirmDialogFieldLabels: {
16
+ readonly type: "Type :phrase to confirm";
17
+ readonly password: "Password";
18
+ };
19
+ /**
20
+ * The input's pattern: the phrase with the characters a pattern (a `v`-flag regular expression)
21
+ * treats as syntax escaped, so the browser accepts exactly the phrase.
22
+ */
23
+ export declare const confirmDialogPattern: (phrase: string) => string;