@qeetrix/react 0.0.1 → 0.0.4
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 +288 -0
- package/README.md +240 -4
- package/dist/accordion/accordion.d.ts +42 -0
- package/dist/accordion/accordion.js +72 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +1 -0
- package/dist/avatar/avatar.d.ts +21 -0
- package/dist/avatar/avatar.js +43 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +1 -0
- package/dist/badge/badge.d.ts +14 -0
- package/dist/badge/badge.js +25 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/badge/index.js +1 -0
- package/dist/box/box.d.ts +27 -0
- package/dist/box/box.js +21 -0
- package/dist/box/index.d.ts +2 -0
- package/dist/box/index.js +1 -0
- package/dist/button/button.d.ts +50 -0
- package/dist/button/button.js +78 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +1 -0
- package/dist/card/card.d.ts +30 -0
- package/dist/card/card.js +56 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/card/index.js +1 -0
- package/dist/checkbox/checkbox.d.ts +33 -0
- package/dist/checkbox/checkbox.js +61 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/css/accordion.css +73 -0
- package/dist/css/avatar.css +50 -0
- package/dist/css/badge.css +59 -0
- package/dist/css/box.css +163 -0
- package/dist/css/button.css +243 -0
- package/dist/css/card.css +75 -0
- package/dist/css/checkbox.css +67 -0
- package/dist/css/dialog.css +128 -0
- package/dist/css/drawer.css +129 -0
- package/dist/css/experimental/alert.css +89 -0
- package/dist/css/experimental/app-shell.css +258 -0
- package/dist/css/experimental/breadcrumb.css +67 -0
- package/dist/css/experimental/copy-button.css +13 -0
- package/dist/css/experimental/empty-state.css +63 -0
- package/dist/css/experimental/otp-input.css +84 -0
- package/dist/css/experimental/page-header.css +110 -0
- package/dist/css/experimental/password-input.css +21 -0
- package/dist/css/experimental/sidebar.css +234 -0
- package/dist/css/experimental/stat.css +115 -0
- package/dist/css/experimental/top-bar.css +299 -0
- package/dist/css/field.css +121 -0
- package/dist/css/fieldset.css +37 -0
- package/dist/css/grid.css +86 -0
- package/dist/css/heading.css +93 -0
- package/dist/css/inline.css +85 -0
- package/dist/css/input.css +108 -0
- package/dist/css/link.css +45 -0
- package/dist/css/menu.css +166 -0
- package/dist/css/popover.css +72 -0
- package/dist/css/progress.css +102 -0
- package/dist/css/radio.css +54 -0
- package/dist/css/scroll-area.css +70 -0
- package/dist/css/select.css +189 -0
- package/dist/css/separator.css +35 -0
- package/dist/css/skeleton.css +39 -0
- package/dist/css/skip-link.css +33 -0
- package/dist/css/slider.css +108 -0
- package/dist/css/spinner.css +55 -0
- package/dist/css/stack.css +76 -0
- package/dist/css/switch.css +112 -0
- package/dist/css/table.css +68 -0
- package/dist/css/tabs.css +123 -0
- package/dist/css/text-field.css +4 -0
- package/dist/css/text.css +106 -0
- package/dist/css/toast.css +115 -0
- package/dist/css/toggle.css +125 -0
- package/dist/css/tooltip.css +47 -0
- package/dist/css/visually-hidden.css +15 -0
- package/dist/dialog/dialog.d.ts +54 -0
- package/dist/dialog/dialog.js +121 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +1 -0
- package/dist/drawer/drawer.d.ts +49 -0
- package/dist/drawer/drawer.js +102 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/index.js +1 -0
- package/dist/experimental/alert/alert.d.ts +29 -0
- package/dist/experimental/alert/alert.js +72 -0
- package/dist/experimental/alert/index.d.ts +2 -0
- package/dist/experimental/app-shell/app-shell.d.ts +60 -0
- package/dist/experimental/app-shell/app-shell.js +224 -0
- package/dist/experimental/app-shell/index.d.ts +2 -0
- package/dist/experimental/breadcrumb/breadcrumb.d.ts +27 -0
- package/dist/experimental/breadcrumb/breadcrumb.js +48 -0
- package/dist/experimental/breadcrumb/index.d.ts +2 -0
- package/dist/experimental/copy-button/copy-button.d.ts +27 -0
- package/dist/experimental/copy-button/copy-button.js +61 -0
- package/dist/experimental/copy-button/index.d.ts +2 -0
- package/dist/experimental/empty-state/data-state.d.ts +23 -0
- package/dist/experimental/empty-state/data-state.js +40 -0
- package/dist/experimental/empty-state/empty-state.d.ts +26 -0
- package/dist/experimental/empty-state/empty-state.js +46 -0
- package/dist/experimental/empty-state/index.d.ts +3 -0
- package/dist/experimental/index.d.ts +24 -0
- package/dist/experimental/index.js +13 -0
- package/dist/experimental/otp-input/index.d.ts +2 -0
- package/dist/experimental/otp-input/otp-input.d.ts +27 -0
- package/dist/experimental/otp-input/otp-input.js +39 -0
- package/dist/experimental/page-header/index.d.ts +2 -0
- package/dist/experimental/page-header/page-header.d.ts +32 -0
- package/dist/experimental/page-header/page-header.js +73 -0
- package/dist/experimental/password-input/index.d.ts +2 -0
- package/dist/experimental/password-input/password-input.d.ts +26 -0
- package/dist/experimental/password-input/password-input.js +103 -0
- package/dist/experimental/sidebar/index.d.ts +2 -0
- package/dist/experimental/sidebar/sidebar.d.ts +64 -0
- package/dist/experimental/sidebar/sidebar.js +200 -0
- package/dist/experimental/stat/index.d.ts +2 -0
- package/dist/experimental/stat/stat.d.ts +31 -0
- package/dist/experimental/stat/stat.js +90 -0
- package/dist/experimental/top-bar/index.d.ts +2 -0
- package/dist/experimental/top-bar/top-bar.d.ts +60 -0
- package/dist/experimental/top-bar/top-bar.js +162 -0
- package/dist/field/choice.d.ts +21 -0
- package/dist/field/choice.js +67 -0
- package/dist/field/field.d.ts +31 -0
- package/dist/field/field.js +78 -0
- package/dist/field/index.d.ts +3 -0
- package/dist/field/index.js +1 -0
- package/dist/fieldset/fieldset.d.ts +19 -0
- package/dist/fieldset/fieldset.js +29 -0
- package/dist/fieldset/index.d.ts +2 -0
- package/dist/fieldset/index.js +1 -0
- package/dist/format/format.d.ts +12 -0
- package/dist/format/format.js +50 -0
- package/dist/format/index.d.ts +2 -0
- package/dist/format/index.js +1 -0
- package/dist/grid/grid.d.ts +30 -0
- package/dist/grid/grid.js +36 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +1 -0
- package/dist/heading/heading.d.ts +23 -0
- package/dist/heading/heading.js +30 -0
- package/dist/heading/index.d.ts +2 -0
- package/dist/heading/index.js +1 -0
- package/dist/index.d.ts +84 -1
- package/dist/index.js +40 -0
- package/dist/inline/index.d.ts +2 -0
- package/dist/inline/index.js +1 -0
- package/dist/inline/inline.d.ts +19 -0
- package/dist/inline/inline.js +16 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +1 -0
- package/dist/input/input.d.ts +37 -0
- package/dist/input/input.js +63 -0
- package/dist/internal/control.d.ts +9 -0
- package/dist/internal/control.js +4 -0
- package/dist/internal/cx.js +7 -0
- package/dist/internal/media.js +15 -0
- package/dist/internal/messages.d.ts +75 -0
- package/dist/internal/messages.js +61 -0
- package/dist/internal/refs.js +23 -0
- package/dist/internal/render.d.ts +6 -0
- package/dist/internal/render.js +22 -0
- package/dist/internal/space.d.ts +9 -0
- package/dist/internal/text.d.ts +5 -0
- package/dist/internal/text.js +18 -0
- package/dist/link/index.d.ts +2 -0
- package/dist/link/index.js +1 -0
- package/dist/link/link.d.ts +19 -0
- package/dist/link/link.js +32 -0
- package/dist/locales/hi.d.ts +8 -0
- package/dist/locales/hi.js +60 -0
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/menu.d.ts +76 -0
- package/dist/menu/menu.js +172 -0
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover/popover.d.ts +33 -0
- package/dist/popover/popover.js +48 -0
- package/dist/progress/index.d.ts +2 -0
- package/dist/progress/index.js +1 -0
- package/dist/progress/progress.d.ts +26 -0
- package/dist/progress/progress.js +62 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.js +1 -0
- package/dist/provider/provider.d.ts +46 -0
- package/dist/provider/provider.js +90 -0
- package/dist/radio/index.d.ts +2 -0
- package/dist/radio/index.js +1 -0
- package/dist/radio/radio.d.ts +31 -0
- package/dist/radio/radio.js +47 -0
- package/dist/scroll-area/index.d.ts +2 -0
- package/dist/scroll-area/index.js +1 -0
- package/dist/scroll-area/scroll-area.d.ts +18 -0
- package/dist/scroll-area/scroll-area.js +39 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/index.js +1 -0
- package/dist/select/select.d.ts +36 -0
- package/dist/select/select.js +82 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator/separator.d.ts +16 -0
- package/dist/separator/separator.js +16 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/skeleton.d.ts +12 -0
- package/dist/skeleton/skeleton.js +18 -0
- package/dist/skip-link/index.d.ts +2 -0
- package/dist/skip-link/index.js +1 -0
- package/dist/skip-link/skip-link.d.ts +13 -0
- package/dist/skip-link/skip-link.js +18 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.js +1 -0
- package/dist/slider/slider.d.ts +20 -0
- package/dist/slider/slider.js +58 -0
- package/dist/spinner/index.d.ts +2 -0
- package/dist/spinner/index.js +1 -0
- package/dist/spinner/spinner.d.ts +15 -0
- package/dist/spinner/spinner.js +19 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/index.js +1 -0
- package/dist/stack/stack.d.ts +17 -0
- package/dist/stack/stack.js +15 -0
- package/dist/styles.css +4548 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch/switch.d.ts +18 -0
- package/dist/switch/switch.js +31 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/table/index.js +1 -0
- package/dist/table/table.d.ts +36 -0
- package/dist/table/table.js +69 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +1 -0
- package/dist/tabs/tabs.d.ts +43 -0
- package/dist/tabs/tabs.js +66 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.js +1 -0
- package/dist/text/text.d.ts +24 -0
- package/dist/text/text.js +24 -0
- package/dist/text-field/index.d.ts +2 -0
- package/dist/text-field/index.js +1 -0
- package/dist/text-field/text-field.d.ts +15 -0
- package/dist/text-field/text-field.js +43 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +1 -0
- package/dist/toast/toast.d.ts +57 -0
- package/dist/toast/toast.js +124 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +1 -0
- package/dist/toggle/toggle.d.ts +48 -0
- package/dist/toggle/toggle.js +54 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tooltip/tooltip.d.ts +26 -0
- package/dist/tooltip/tooltip.js +39 -0
- package/dist/visually-hidden/index.d.ts +2 -0
- package/dist/visually-hidden/index.js +1 -0
- package/dist/visually-hidden/visually-hidden.d.ts +8 -0
- package/dist/visually-hidden/visually-hidden.js +12 -0
- package/package.json +170 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from "./switch.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChoiceLabelProps } from "../field/choice.js";
|
|
2
|
+
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { Switch } from "@base-ui/react/switch";
|
|
4
|
+
interface SwitchOwnProps extends Omit<Switch.Root.Props, "className" | "style" | "children"> {
|
|
5
|
+
/** A line under the label. */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** Placement of the row (or of the control alone, with no label) only. */
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
/** Switch props: Base UI's, plus `label` — or, with no visible label, a required `aria-label`. */
|
|
12
|
+
export type SwitchProps = SwitchOwnProps & ChoiceLabelProps;
|
|
13
|
+
/**
|
|
14
|
+
* Turns a setting on or off immediately (06-component-specs.md §3). A setting that waits for a Save
|
|
15
|
+
* button is a Checkbox.
|
|
16
|
+
*/
|
|
17
|
+
declare function Switch$1({ label, description, className, style, ...props }: SwitchProps): ReactElement;
|
|
18
|
+
export { Switch$1 as Switch };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../internal/cx.js";
|
|
3
|
+
import { ChoiceRow } from "../field/choice.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Switch } from "@base-ui/react/switch";
|
|
6
|
+
// src/switch/switch.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Turns a setting on or off immediately (06-component-specs.md §3). A setting that waits for a Save
|
|
9
|
+
* button is a Checkbox.
|
|
10
|
+
*/
|
|
11
|
+
function Switch$1({ label, description, className, style, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(ChoiceRow, {
|
|
13
|
+
kind: "switch",
|
|
14
|
+
label,
|
|
15
|
+
description,
|
|
16
|
+
disabled: props.disabled,
|
|
17
|
+
className,
|
|
18
|
+
style,
|
|
19
|
+
children: /* @__PURE__ */ jsx(Switch.Root, {
|
|
20
|
+
...props,
|
|
21
|
+
className: cx("qx-switch", label == null ? className : void 0),
|
|
22
|
+
style: label == null ? style : void 0,
|
|
23
|
+
"data-slot": "switch-track",
|
|
24
|
+
children: /* @__PURE__ */ jsx(Switch.Thumb, {
|
|
25
|
+
className: "qx-switch-thumb",
|
|
26
|
+
"data-slot": "switch-thumb"
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { Switch$1 as Switch };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Table, TableAlign, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps } from "./table.js";
|
|
2
|
+
export { Table, type TableAlign, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "./table.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
|
+
export type TableAlign = "start" | "center" | "end";
|
|
3
|
+
export interface TableProps extends ComponentProps<"table"> {}
|
|
4
|
+
export interface TableCaptionProps extends ComponentProps<"caption"> {}
|
|
5
|
+
export interface TableHeaderProps extends ComponentProps<"thead"> {}
|
|
6
|
+
export interface TableBodyProps extends ComponentProps<"tbody"> {}
|
|
7
|
+
export interface TableRowProps extends ComponentProps<"tr"> {
|
|
8
|
+
/** The Ember tint of a selected row. Its checked checkbox carries the meaning. */
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface CellLook {
|
|
12
|
+
/** Horizontal alignment. Default `start`. */
|
|
13
|
+
align?: TableAlign;
|
|
14
|
+
/** Numbers, amounts and dates: tabular figures, end-aligned. */
|
|
15
|
+
numeric?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface TableHeadProps extends Omit<ComponentProps<"th">, "align">, CellLook {}
|
|
18
|
+
export interface TableCellProps extends Omit<ComponentProps<"td">, "align">, CellLook {}
|
|
19
|
+
/**
|
|
20
|
+
* A semantic data table (design rules §15): a header band, rows at the density's row height and
|
|
21
|
+
* 1px lines between them. Wide tables go in a ScrollArea. Server-safe.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Table({ className, ...props }: TableProps): ReactElement;
|
|
24
|
+
/** The table's name, above it. Every table needs a caption or an `aria-label`. */
|
|
25
|
+
export declare function TableCaption({ className, ...props }: TableCaptionProps): ReactElement;
|
|
26
|
+
/** The header band. */
|
|
27
|
+
export declare function TableHeader({ className, ...props }: TableHeaderProps): ReactElement;
|
|
28
|
+
/** The rows. */
|
|
29
|
+
export declare function TableBody({ className, ...props }: TableBodyProps): ReactElement;
|
|
30
|
+
/** A row; `selected` tints it. */
|
|
31
|
+
export declare function TableRow({ selected, className, ...props }: TableRowProps): ReactElement;
|
|
32
|
+
/** A header cell; `scope` defaults to `col`. */
|
|
33
|
+
export declare function TableHead({ align, numeric, scope, className, ...props }: TableHeadProps): ReactElement;
|
|
34
|
+
/** A data cell. */
|
|
35
|
+
export declare function TableCell({ align, numeric, className, ...props }: TableCellProps): ReactElement;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { cx } from "../internal/cx.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/table/table.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A semantic data table (design rules §15): a header band, rows at the density's row height and
|
|
6
|
+
* 1px lines between them. Wide tables go in a ScrollArea. Server-safe.
|
|
7
|
+
*/
|
|
8
|
+
function Table({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("table", {
|
|
10
|
+
...props,
|
|
11
|
+
className: cx("qx-table", className),
|
|
12
|
+
"data-slot": "table"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** The table's name, above it. Every table needs a caption or an `aria-label`. */
|
|
16
|
+
function TableCaption({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
18
|
+
...props,
|
|
19
|
+
className: cx("qx-table-caption", className),
|
|
20
|
+
"data-slot": "table-caption"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** The header band. */
|
|
24
|
+
function TableHeader({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
26
|
+
...props,
|
|
27
|
+
className: cx("qx-table-header", className),
|
|
28
|
+
"data-slot": "table-header"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** The rows. */
|
|
32
|
+
function TableBody({ className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
34
|
+
...props,
|
|
35
|
+
className: cx("qx-table-body", className),
|
|
36
|
+
"data-slot": "table-body"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** A row; `selected` tints it. */
|
|
40
|
+
function TableRow({ selected, className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
42
|
+
...props,
|
|
43
|
+
className: cx("qx-table-row", className),
|
|
44
|
+
"data-slot": "table-row",
|
|
45
|
+
"data-selected": selected ? "" : void 0
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** A header cell; `scope` defaults to `col`. */
|
|
49
|
+
function TableHead({ align, numeric, scope = "col", className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx("th", {
|
|
51
|
+
...props,
|
|
52
|
+
scope,
|
|
53
|
+
className: cx("qx-table-head", className),
|
|
54
|
+
"data-slot": "table-head",
|
|
55
|
+
"data-align": numeric ? "end" : align,
|
|
56
|
+
"data-numeric": numeric ? "" : void 0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** A data cell. */
|
|
60
|
+
function TableCell({ align, numeric, className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx("td", {
|
|
62
|
+
...props,
|
|
63
|
+
className: cx("qx-table-cell", className),
|
|
64
|
+
"data-slot": "table-cell",
|
|
65
|
+
"data-align": numeric ? "end" : align,
|
|
66
|
+
"data-numeric": numeric ? "" : void 0
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tab, Tabs, TabsList, TabsPanel } from "./tabs.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { QeetrixIcon } from "../internal/control.js";
|
|
2
|
+
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
4
|
+
export interface TabsProps extends Omit<Tabs.Root.Props, "className" | "style"> {
|
|
5
|
+
/** Placement only. */
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
export interface TabsListProps extends Omit<Tabs.List.Props, "className" | "style"> {
|
|
10
|
+
/** Select a tab as soon as it takes focus. Default `true`; turn it off when panels load slowly. */
|
|
11
|
+
activateOnFocus?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
export interface TabProps extends Omit<Tabs.Tab.Props, "className" | "style" | "children"> {
|
|
16
|
+
/** A leading 16px icon from `@qeetrix/icons`, sharp. */
|
|
17
|
+
icon?: QeetrixIcon;
|
|
18
|
+
/** Show the icon's filled drawing while selected. Only for icons that have one. */
|
|
19
|
+
filledWhenSelected?: boolean;
|
|
20
|
+
/** The label. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
export interface TabsPanelProps extends Omit<Tabs.Panel.Props, "className" | "style"> {
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Views of the same context (06-component-specs.md §8): `value` / `defaultValue` /
|
|
31
|
+
* `onValueChange(value, details)`, and `orientation`.
|
|
32
|
+
*/
|
|
33
|
+
declare function Tabs$1({ className, ...props }: TabsProps): ReactElement;
|
|
34
|
+
/**
|
|
35
|
+
* The tabs, one tab stop: arrow keys move between them, Home and End jump. It draws the Ember bar
|
|
36
|
+
* under the selected tab, and the bar slides when the selection changes.
|
|
37
|
+
*/
|
|
38
|
+
export declare function TabsList({ activateOnFocus, className, children, ...props }: TabsListProps): ReactElement;
|
|
39
|
+
/** One tab: a label, and optionally a leading icon that fills when selected. */
|
|
40
|
+
export declare function Tab({ icon: Icon, filledWhenSelected, className, children, ...props }: TabProps): ReactElement;
|
|
41
|
+
/** The content for one tab's `value`; it follows the tab list in the Tab order. */
|
|
42
|
+
export declare function TabsPanel({ className, ...props }: TabsPanelProps): ReactElement;
|
|
43
|
+
export { Tabs$1 as Tabs };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../internal/cx.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
5
|
+
// src/tabs/tabs.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Views of the same context (06-component-specs.md §8): `value` / `defaultValue` /
|
|
8
|
+
* `onValueChange(value, details)`, and `orientation`.
|
|
9
|
+
*/
|
|
10
|
+
function Tabs$1({ className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Tabs.Root, {
|
|
12
|
+
...props,
|
|
13
|
+
className: cx("qx-tabs", className),
|
|
14
|
+
"data-slot": "tabs"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The tabs, one tab stop: arrow keys move between them, Home and End jump. It draws the Ember bar
|
|
19
|
+
* under the selected tab, and the bar slides when the selection changes.
|
|
20
|
+
*/
|
|
21
|
+
function TabsList({ activateOnFocus = true, className, children, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsxs(Tabs.List, {
|
|
23
|
+
...props,
|
|
24
|
+
activateOnFocus,
|
|
25
|
+
className: cx("qx-tabs-list", className),
|
|
26
|
+
"data-slot": "tabs-list",
|
|
27
|
+
children: [children, /* @__PURE__ */ jsx(Tabs.Indicator, {
|
|
28
|
+
className: "qx-tabs-indicator",
|
|
29
|
+
"data-slot": "tabs-indicator"
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** One tab: a label, and optionally a leading icon that fills when selected. */
|
|
34
|
+
function Tab({ icon: Icon, filledWhenSelected, className, children, ...props }) {
|
|
35
|
+
const Filled = Icon;
|
|
36
|
+
return /* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
37
|
+
...props,
|
|
38
|
+
className: cx("qx-tab", className),
|
|
39
|
+
"data-slot": "tab",
|
|
40
|
+
children: [
|
|
41
|
+
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
42
|
+
shape: "sharp",
|
|
43
|
+
size: 16,
|
|
44
|
+
"aria-hidden": true,
|
|
45
|
+
className: "qx-tab-icon qx-tab-icon-outline"
|
|
46
|
+
}),
|
|
47
|
+
Filled && filledWhenSelected && /* @__PURE__ */ jsx(Filled, {
|
|
48
|
+
shape: "sharp",
|
|
49
|
+
variant: "filled",
|
|
50
|
+
size: 16,
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
className: "qx-tab-icon qx-tab-icon-filled"
|
|
53
|
+
}),
|
|
54
|
+
children
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** The content for one tab's `value`; it follows the tab list in the Tab order. */
|
|
59
|
+
function TabsPanel({ className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
61
|
+
...props,
|
|
62
|
+
className: cx("qx-tabs-panel", className),
|
|
63
|
+
"data-slot": "tabs-panel"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { Tab, Tabs$1 as Tabs, TabsList, TabsPanel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Text } from "./text.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RenderProp } from "../internal/render.js";
|
|
2
|
+
import { TextAlign } from "../internal/space.js";
|
|
3
|
+
import { TextTone, Truncate } from "../internal/text.js";
|
|
4
|
+
import { ComponentProps, ReactElement } from "react";
|
|
5
|
+
export type TextSize = "sm" | "md" | "lg";
|
|
6
|
+
export type TextWeight = "regular" | "medium" | "semibold";
|
|
7
|
+
export interface TextProps extends ComponentProps<"span"> {
|
|
8
|
+
/** The body role: `sm` 12/16, `md` 14/20 (default), `lg` 16/24. */
|
|
9
|
+
size?: TextSize;
|
|
10
|
+
/** `regular` 400 (default), `medium` 500, `semibold` 600. */
|
|
11
|
+
weight?: TextWeight;
|
|
12
|
+
/** A text colour from the tokens; unset inherits. */
|
|
13
|
+
tone?: TextTone;
|
|
14
|
+
/** Fira Code at the same size, for code, IDs and keys. */
|
|
15
|
+
mono?: boolean;
|
|
16
|
+
/** `true` for one line with an ellipsis, or a number of lines. */
|
|
17
|
+
truncate?: Truncate;
|
|
18
|
+
/** Logical alignment. */
|
|
19
|
+
align?: TextAlign;
|
|
20
|
+
/** Render a different element, e.g. `<p />`. Default `<span>`. */
|
|
21
|
+
render?: RenderProp;
|
|
22
|
+
}
|
|
23
|
+
/** Running text, labels and inline code, on the token type roles. */
|
|
24
|
+
export declare function Text({ size, weight, tone, mono, truncate, align, render, className, style, ...props }: TextProps): ReactElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cx } from "../internal/cx.js";
|
|
2
|
+
import { renderElement } from "../internal/render.js";
|
|
3
|
+
import { truncation } from "../internal/text.js";
|
|
4
|
+
// src/text/text.tsx
|
|
5
|
+
/** Running text, labels and inline code, on the token type roles. */
|
|
6
|
+
function Text({ size, weight, tone, mono, truncate, align, render, className, style, ...props }) {
|
|
7
|
+
const clamp = truncation(truncate);
|
|
8
|
+
return renderElement("span", render, {
|
|
9
|
+
...props,
|
|
10
|
+
className: cx("qx-text", className),
|
|
11
|
+
style: clamp.style || style ? {
|
|
12
|
+
...clamp.style,
|
|
13
|
+
...style
|
|
14
|
+
} : void 0,
|
|
15
|
+
"data-slot": "text",
|
|
16
|
+
"data-size": size,
|
|
17
|
+
"data-weight": weight,
|
|
18
|
+
"data-tone": tone,
|
|
19
|
+
"data-mono": mono ? "" : void 0,
|
|
20
|
+
"data-truncate": clamp.attribute,
|
|
21
|
+
"data-align": align
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { Text };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextField } from "./text-field.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FieldProps } from "../field/field.js";
|
|
2
|
+
import { InputProps } from "../input/input.js";
|
|
3
|
+
import { CSSProperties, ReactElement } from "react";
|
|
4
|
+
type FieldOnly = Pick<FieldProps, "label" | "description" | "error" | "optional" | "hideLabel" | "invalid" | "validate" | "validationMode" | "validationDebounceTime" | "dirty" | "touched" | "actionsRef" | "messages">;
|
|
5
|
+
export interface TextFieldProps extends Omit<InputProps, "className" | "style">, FieldOnly {
|
|
6
|
+
/** Placement of the whole row only (margin, width, grid placement). */
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Field + Input in one: the default way to build a text row (D-12). `name`, `disabled` and
|
|
12
|
+
* validation go to the Field; `ref`, `required`, `readOnly` and every other prop go to the input.
|
|
13
|
+
*/
|
|
14
|
+
export declare function TextField({ label, description, error, optional, hideLabel, invalid, validate, validationMode, validationDebounceTime, dirty, touched, actionsRef, messages, name, disabled, className, style, ...inputProps }: TextFieldProps): ReactElement;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../internal/cx.js";
|
|
3
|
+
import { useMessages } from "../provider/provider.js";
|
|
4
|
+
import { FieldMessages, labelText } from "../field/field.js";
|
|
5
|
+
import { Input } from "../input/input.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Field } from "@base-ui/react/field";
|
|
8
|
+
// src/text-field/text-field.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Field + Input in one: the default way to build a text row (D-12). `name`, `disabled` and
|
|
11
|
+
* validation go to the Field; `ref`, `required`, `readOnly` and every other prop go to the input.
|
|
12
|
+
*/
|
|
13
|
+
function TextField({ label, description, error, optional, hideLabel, invalid, validate, validationMode, validationDebounceTime, dirty, touched, actionsRef, messages, name, disabled, className, style, ...inputProps }) {
|
|
14
|
+
const strings = useMessages("field", messages);
|
|
15
|
+
return /* @__PURE__ */ jsxs(Field.Root, {
|
|
16
|
+
name,
|
|
17
|
+
disabled,
|
|
18
|
+
invalid: invalid ?? (error != null ? true : void 0),
|
|
19
|
+
validate,
|
|
20
|
+
validationMode,
|
|
21
|
+
validationDebounceTime,
|
|
22
|
+
dirty,
|
|
23
|
+
touched,
|
|
24
|
+
actionsRef,
|
|
25
|
+
className: cx("qx-field", className),
|
|
26
|
+
style,
|
|
27
|
+
"data-slot": "text-field",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Field.Label, {
|
|
30
|
+
className: "qx-field-label",
|
|
31
|
+
"data-slot": "field-label",
|
|
32
|
+
"data-hidden": hideLabel ? "" : void 0,
|
|
33
|
+
children: labelText(label, optional, strings.optional)
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx(Input, { ...inputProps }),
|
|
36
|
+
/* @__PURE__ */ jsx(FieldMessages, {
|
|
37
|
+
description,
|
|
38
|
+
error
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { TextField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToastProvider, useToast } from "./toast.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { QeetrixMessages } from "../internal/messages.js";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
export type ToastTone = "info" | "success" | "warning" | "danger";
|
|
4
|
+
export interface ToastOptions {
|
|
5
|
+
/** What happened, in a few words ("Invoice sent"). */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** One more line, if it helps. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Default `info`. A `danger` toast stays until dismissed and is announced at once. */
|
|
10
|
+
tone?: ToastTone;
|
|
11
|
+
/** At most one action, such as Undo. */
|
|
12
|
+
action?: {
|
|
13
|
+
label: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
};
|
|
16
|
+
/** Milliseconds before it closes. Default 5000; `danger` toasts ignore it. */
|
|
17
|
+
timeout?: number;
|
|
18
|
+
/** Your own id, to update or close it later. */
|
|
19
|
+
id?: string;
|
|
20
|
+
/** Called when it closes, however it closes. */
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
}
|
|
23
|
+
export interface ToastPromiseOptions<Value> {
|
|
24
|
+
loading: ToastOptions;
|
|
25
|
+
success: ToastOptions | ((value: Value) => ToastOptions);
|
|
26
|
+
error: ToastOptions | ((error: unknown) => ToastOptions);
|
|
27
|
+
}
|
|
28
|
+
export interface ToastApi {
|
|
29
|
+
/** Shows a toast and returns its id. */
|
|
30
|
+
add: (options: ToastOptions) => string;
|
|
31
|
+
/** Closes one toast, or every toast with no id. */
|
|
32
|
+
close: (id?: string) => void;
|
|
33
|
+
/** Changes a toast that is showing. */
|
|
34
|
+
update: (id: string, options: Partial<ToastOptions>) => void;
|
|
35
|
+
/** Shows `loading`, then `success` or `error` when the promise settles; returns the promise. */
|
|
36
|
+
promise: <Value>(promise: Promise<Value>, options: ToastPromiseOptions<Value>) => Promise<Value>;
|
|
37
|
+
}
|
|
38
|
+
export interface ToastProviderProps {
|
|
39
|
+
/** Your app. */
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
/** The most toasts shown at once; older ones wait. Default 3. */
|
|
42
|
+
limit?: number;
|
|
43
|
+
/** Default milliseconds before a toast closes. Default 5000. */
|
|
44
|
+
timeout?: number;
|
|
45
|
+
/** The region's name and the close label, over QeetrixProvider's and the English defaults. */
|
|
46
|
+
messages?: Partial<QeetrixMessages["toast"]>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Shows toasts from anywhere inside ToastProvider:
|
|
50
|
+
* `const toast = useToast(); toast.add({ title: "Invoice sent", tone: "success" })`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useToast(): ToastApi;
|
|
53
|
+
/**
|
|
54
|
+
* Wrap the app once. It renders the toast region: a landmark named "Notifications" at the bottom
|
|
55
|
+
* end, reachable with F6. Toasts pause while hovered or focused and swipe away on touch.
|
|
56
|
+
*/
|
|
57
|
+
export declare function ToastProvider({ children, limit, timeout, messages }: ToastProviderProps): ReactElement;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button, IconButton } from "../button/button.js";
|
|
3
|
+
import { useMessages } from "../provider/provider.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { CircleAlertIcon } from "@qeetrix/icons/icons/circle-alert";
|
|
6
|
+
import { XIcon } from "@qeetrix/icons/icons/x";
|
|
7
|
+
import { Toast } from "@base-ui/react/toast";
|
|
8
|
+
import { CircleCheckIcon } from "@qeetrix/icons/icons/circle-check";
|
|
9
|
+
import { InfoIcon } from "@qeetrix/icons/icons/info";
|
|
10
|
+
import { TriangleAlertIcon } from "@qeetrix/icons/icons/triangle-alert";
|
|
11
|
+
// src/toast/toast.tsx
|
|
12
|
+
const ICONS = {
|
|
13
|
+
info: InfoIcon,
|
|
14
|
+
success: CircleCheckIcon,
|
|
15
|
+
warning: TriangleAlertIcon,
|
|
16
|
+
danger: CircleAlertIcon
|
|
17
|
+
};
|
|
18
|
+
/** Qeetrix options in Base UI's terms: the tone is the type, and danger never times out. */
|
|
19
|
+
function toBase(options) {
|
|
20
|
+
const { tone, action, timeout, ...rest } = options;
|
|
21
|
+
const base = { ...rest };
|
|
22
|
+
if (tone !== void 0) base.type = tone;
|
|
23
|
+
if (timeout !== void 0) base.timeout = timeout;
|
|
24
|
+
if (tone === "danger") {
|
|
25
|
+
base.timeout = 0;
|
|
26
|
+
base.priority = "high";
|
|
27
|
+
}
|
|
28
|
+
if (action !== void 0) base.actionProps = {
|
|
29
|
+
children: action.label,
|
|
30
|
+
onClick: action.onClick
|
|
31
|
+
};
|
|
32
|
+
return base;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Shows toasts from anywhere inside ToastProvider:
|
|
36
|
+
* `const toast = useToast(); toast.add({ title: "Invoice sent", tone: "success" })`.
|
|
37
|
+
*/
|
|
38
|
+
function useToast() {
|
|
39
|
+
const manager = Toast.useToastManager();
|
|
40
|
+
return {
|
|
41
|
+
add: (options) => manager.add(toBase({
|
|
42
|
+
tone: "info",
|
|
43
|
+
...options
|
|
44
|
+
})),
|
|
45
|
+
close: (id) => manager.close(id),
|
|
46
|
+
update: (id, options) => manager.update(id, toBase(options)),
|
|
47
|
+
promise: (promise, { loading, success, error }) => manager.promise(promise, {
|
|
48
|
+
loading: toBase({
|
|
49
|
+
tone: "info",
|
|
50
|
+
...loading
|
|
51
|
+
}),
|
|
52
|
+
success: (value) => toBase({
|
|
53
|
+
tone: "success",
|
|
54
|
+
...typeof success === "function" ? success(value) : success
|
|
55
|
+
}),
|
|
56
|
+
error: (reason) => toBase({
|
|
57
|
+
tone: "danger",
|
|
58
|
+
...typeof error === "function" ? error(reason) : error
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function ToastList({ closeLabel }) {
|
|
64
|
+
const { toasts } = Toast.useToastManager();
|
|
65
|
+
return toasts.map((toast) => {
|
|
66
|
+
const tone = toast.type ?? "info";
|
|
67
|
+
const Icon = ICONS[tone] ?? InfoIcon;
|
|
68
|
+
return /* @__PURE__ */ jsxs(Toast.Root, {
|
|
69
|
+
toast,
|
|
70
|
+
className: "qx-toast",
|
|
71
|
+
"data-slot": "toast",
|
|
72
|
+
"data-tone": tone,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
75
|
+
shape: "sharp",
|
|
76
|
+
size: 18,
|
|
77
|
+
"aria-hidden": true,
|
|
78
|
+
className: "qx-toast-icon"
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsxs(Toast.Content, {
|
|
81
|
+
className: "qx-toast-content",
|
|
82
|
+
children: [/* @__PURE__ */ jsx(Toast.Title, {
|
|
83
|
+
className: "qx-toast-title",
|
|
84
|
+
"data-slot": "toast-title"
|
|
85
|
+
}), /* @__PURE__ */ jsx(Toast.Description, {
|
|
86
|
+
className: "qx-toast-description",
|
|
87
|
+
"data-slot": "toast-description"
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
toast.actionProps && /* @__PURE__ */ jsx(Toast.Action, {
|
|
91
|
+
className: "qx-toast-action",
|
|
92
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
size: "sm"
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx(Toast.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
98
|
+
icon: XIcon,
|
|
99
|
+
"aria-label": closeLabel,
|
|
100
|
+
size: "sm",
|
|
101
|
+
tooltip: false
|
|
102
|
+
}) })
|
|
103
|
+
]
|
|
104
|
+
}, toast.id);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Wrap the app once. It renders the toast region: a landmark named "Notifications" at the bottom
|
|
109
|
+
* end, reachable with F6. Toasts pause while hovered or focused and swipe away on touch.
|
|
110
|
+
*/
|
|
111
|
+
function ToastProvider({ children, limit = 3, timeout = 5e3, messages }) {
|
|
112
|
+
const strings = useMessages("toast", messages);
|
|
113
|
+
return /* @__PURE__ */ jsxs(Toast.Provider, {
|
|
114
|
+
limit,
|
|
115
|
+
timeout,
|
|
116
|
+
children: [children, /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, {
|
|
117
|
+
className: "qx-toast-viewport",
|
|
118
|
+
"data-slot": "toast-viewport",
|
|
119
|
+
"aria-label": strings.region,
|
|
120
|
+
children: /* @__PURE__ */ jsx(ToastList, { closeLabel: strings.close })
|
|
121
|
+
}) })]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
export { ToastProvider, useToast };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Toggle, ToggleGroup } from "./toggle.js";
|