@qeetrix/react 0.0.0-stage → 0.0.2

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 (204) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/README.md +167 -2
  3. package/dist/accordion/accordion.d.ts +42 -0
  4. package/dist/accordion/accordion.js +72 -0
  5. package/dist/accordion/index.d.ts +2 -0
  6. package/dist/accordion/index.js +1 -0
  7. package/dist/avatar/avatar.d.ts +21 -0
  8. package/dist/avatar/avatar.js +43 -0
  9. package/dist/avatar/index.d.ts +2 -0
  10. package/dist/avatar/index.js +1 -0
  11. package/dist/badge/badge.d.ts +14 -0
  12. package/dist/badge/badge.js +25 -0
  13. package/dist/badge/index.d.ts +2 -0
  14. package/dist/badge/index.js +1 -0
  15. package/dist/box/box.d.ts +27 -0
  16. package/dist/box/box.js +21 -0
  17. package/dist/box/index.d.ts +2 -0
  18. package/dist/box/index.js +1 -0
  19. package/dist/button/button.d.ts +46 -0
  20. package/dist/button/button.js +74 -0
  21. package/dist/button/index.d.ts +2 -0
  22. package/dist/button/index.js +1 -0
  23. package/dist/card/card.d.ts +30 -0
  24. package/dist/card/card.js +56 -0
  25. package/dist/card/index.d.ts +2 -0
  26. package/dist/card/index.js +1 -0
  27. package/dist/checkbox/checkbox.d.ts +33 -0
  28. package/dist/checkbox/checkbox.js +61 -0
  29. package/dist/checkbox/index.d.ts +2 -0
  30. package/dist/checkbox/index.js +1 -0
  31. package/dist/css/accordion.css +73 -0
  32. package/dist/css/avatar.css +44 -0
  33. package/dist/css/badge.css +53 -0
  34. package/dist/css/base.css +5 -0
  35. package/dist/css/box.css +163 -0
  36. package/dist/css/button.css +168 -0
  37. package/dist/css/card.css +75 -0
  38. package/dist/css/checkbox.css +58 -0
  39. package/dist/css/dialog.css +121 -0
  40. package/dist/css/drawer.css +123 -0
  41. package/dist/css/field.css +121 -0
  42. package/dist/css/fieldset.css +37 -0
  43. package/dist/css/grid.css +86 -0
  44. package/dist/css/heading.css +93 -0
  45. package/dist/css/inline.css +85 -0
  46. package/dist/css/input.css +98 -0
  47. package/dist/css/link.css +45 -0
  48. package/dist/css/menu.css +149 -0
  49. package/dist/css/popover.css +72 -0
  50. package/dist/css/progress.css +88 -0
  51. package/dist/css/radio.css +54 -0
  52. package/dist/css/scroll-area.css +63 -0
  53. package/dist/css/select.css +173 -0
  54. package/dist/css/separator.css +28 -0
  55. package/dist/css/skeleton.css +33 -0
  56. package/dist/css/skip-link.css +33 -0
  57. package/dist/css/slider.css +86 -0
  58. package/dist/css/spinner.css +55 -0
  59. package/dist/css/stack.css +76 -0
  60. package/dist/css/switch.css +79 -0
  61. package/dist/css/table.css +68 -0
  62. package/dist/css/tabs.css +112 -0
  63. package/dist/css/text-field.css +4 -0
  64. package/dist/css/text.css +106 -0
  65. package/dist/css/toast.css +108 -0
  66. package/dist/css/toggle.css +112 -0
  67. package/dist/css/tooltip.css +41 -0
  68. package/dist/css/visually-hidden.css +15 -0
  69. package/dist/dialog/dialog.d.ts +51 -0
  70. package/dist/dialog/dialog.js +120 -0
  71. package/dist/dialog/index.d.ts +2 -0
  72. package/dist/dialog/index.js +1 -0
  73. package/dist/drawer/drawer.d.ts +46 -0
  74. package/dist/drawer/drawer.js +101 -0
  75. package/dist/drawer/index.d.ts +2 -0
  76. package/dist/drawer/index.js +1 -0
  77. package/dist/field/choice.d.ts +21 -0
  78. package/dist/field/choice.js +67 -0
  79. package/dist/field/field.d.ts +28 -0
  80. package/dist/field/field.js +77 -0
  81. package/dist/field/index.d.ts +3 -0
  82. package/dist/field/index.js +1 -0
  83. package/dist/fieldset/fieldset.d.ts +19 -0
  84. package/dist/fieldset/fieldset.js +29 -0
  85. package/dist/fieldset/index.d.ts +2 -0
  86. package/dist/fieldset/index.js +1 -0
  87. package/dist/grid/grid.d.ts +30 -0
  88. package/dist/grid/grid.js +36 -0
  89. package/dist/grid/index.d.ts +2 -0
  90. package/dist/grid/index.js +1 -0
  91. package/dist/heading/heading.d.ts +23 -0
  92. package/dist/heading/heading.js +30 -0
  93. package/dist/heading/index.d.ts +2 -0
  94. package/dist/heading/index.js +1 -0
  95. package/dist/index.d.ts +80 -0
  96. package/dist/index.js +38 -0
  97. package/dist/inline/index.d.ts +2 -0
  98. package/dist/inline/index.js +1 -0
  99. package/dist/inline/inline.d.ts +19 -0
  100. package/dist/inline/inline.js +16 -0
  101. package/dist/input/index.d.ts +2 -0
  102. package/dist/input/index.js +1 -0
  103. package/dist/input/input.d.ts +37 -0
  104. package/dist/input/input.js +63 -0
  105. package/dist/internal/control.d.ts +9 -0
  106. package/dist/internal/control.js +4 -0
  107. package/dist/internal/cx.js +7 -0
  108. package/dist/internal/messages.js +22 -0
  109. package/dist/internal/refs.js +23 -0
  110. package/dist/internal/render.d.ts +6 -0
  111. package/dist/internal/render.js +22 -0
  112. package/dist/internal/space.d.ts +9 -0
  113. package/dist/internal/text.d.ts +5 -0
  114. package/dist/internal/text.js +18 -0
  115. package/dist/link/index.d.ts +2 -0
  116. package/dist/link/index.js +1 -0
  117. package/dist/link/link.d.ts +13 -0
  118. package/dist/link/link.js +31 -0
  119. package/dist/menu/index.d.ts +2 -0
  120. package/dist/menu/index.js +1 -0
  121. package/dist/menu/menu.d.ts +76 -0
  122. package/dist/menu/menu.js +172 -0
  123. package/dist/popover/index.d.ts +2 -0
  124. package/dist/popover/index.js +1 -0
  125. package/dist/popover/popover.d.ts +33 -0
  126. package/dist/popover/popover.js +48 -0
  127. package/dist/progress/index.d.ts +2 -0
  128. package/dist/progress/index.js +1 -0
  129. package/dist/progress/progress.d.ts +26 -0
  130. package/dist/progress/progress.js +57 -0
  131. package/dist/radio/index.d.ts +2 -0
  132. package/dist/radio/index.js +1 -0
  133. package/dist/radio/radio.d.ts +31 -0
  134. package/dist/radio/radio.js +47 -0
  135. package/dist/scroll-area/index.d.ts +2 -0
  136. package/dist/scroll-area/index.js +1 -0
  137. package/dist/scroll-area/scroll-area.d.ts +18 -0
  138. package/dist/scroll-area/scroll-area.js +39 -0
  139. package/dist/select/index.d.ts +2 -0
  140. package/dist/select/index.js +1 -0
  141. package/dist/select/select.d.ts +36 -0
  142. package/dist/select/select.js +82 -0
  143. package/dist/separator/index.d.ts +2 -0
  144. package/dist/separator/index.js +1 -0
  145. package/dist/separator/separator.d.ts +16 -0
  146. package/dist/separator/separator.js +16 -0
  147. package/dist/skeleton/index.d.ts +2 -0
  148. package/dist/skeleton/index.js +1 -0
  149. package/dist/skeleton/skeleton.d.ts +12 -0
  150. package/dist/skeleton/skeleton.js +18 -0
  151. package/dist/skip-link/index.d.ts +2 -0
  152. package/dist/skip-link/index.js +1 -0
  153. package/dist/skip-link/skip-link.d.ts +13 -0
  154. package/dist/skip-link/skip-link.js +18 -0
  155. package/dist/slider/index.d.ts +2 -0
  156. package/dist/slider/index.js +1 -0
  157. package/dist/slider/slider.d.ts +17 -0
  158. package/dist/slider/slider.js +51 -0
  159. package/dist/spinner/index.d.ts +2 -0
  160. package/dist/spinner/index.js +1 -0
  161. package/dist/spinner/spinner.d.ts +15 -0
  162. package/dist/spinner/spinner.js +19 -0
  163. package/dist/stack/index.d.ts +2 -0
  164. package/dist/stack/index.js +1 -0
  165. package/dist/stack/stack.d.ts +17 -0
  166. package/dist/stack/stack.js +15 -0
  167. package/dist/styles.css +2960 -0
  168. package/dist/switch/index.d.ts +2 -0
  169. package/dist/switch/index.js +1 -0
  170. package/dist/switch/switch.d.ts +18 -0
  171. package/dist/switch/switch.js +31 -0
  172. package/dist/table/index.d.ts +2 -0
  173. package/dist/table/index.js +1 -0
  174. package/dist/table/table.d.ts +36 -0
  175. package/dist/table/table.js +69 -0
  176. package/dist/tabs/index.d.ts +2 -0
  177. package/dist/tabs/index.js +1 -0
  178. package/dist/tabs/tabs.d.ts +43 -0
  179. package/dist/tabs/tabs.js +66 -0
  180. package/dist/text/index.d.ts +3 -0
  181. package/dist/text/index.js +1 -0
  182. package/dist/text/text.d.ts +24 -0
  183. package/dist/text/text.js +24 -0
  184. package/dist/text-field/index.d.ts +2 -0
  185. package/dist/text-field/index.js +1 -0
  186. package/dist/text-field/text-field.d.ts +15 -0
  187. package/dist/text-field/text-field.js +41 -0
  188. package/dist/toast/index.d.ts +2 -0
  189. package/dist/toast/index.js +1 -0
  190. package/dist/toast/toast.d.ts +54 -0
  191. package/dist/toast/toast.js +123 -0
  192. package/dist/toggle/index.d.ts +2 -0
  193. package/dist/toggle/index.js +1 -0
  194. package/dist/toggle/toggle.d.ts +48 -0
  195. package/dist/toggle/toggle.js +54 -0
  196. package/dist/tooltip/index.d.ts +2 -0
  197. package/dist/tooltip/index.js +1 -0
  198. package/dist/tooltip/tooltip.d.ts +26 -0
  199. package/dist/tooltip/tooltip.js +39 -0
  200. package/dist/visually-hidden/index.d.ts +2 -0
  201. package/dist/visually-hidden/index.js +1 -0
  202. package/dist/visually-hidden/visually-hidden.d.ts +8 -0
  203. package/dist/visually-hidden/visually-hidden.js +12 -0
  204. package/package.json +219 -4
@@ -0,0 +1,2 @@
1
+ import { Switch, SwitchProps } from "./switch.js";
2
+ export { Switch, type SwitchProps };
@@ -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,2 @@
1
+ import { Tab, TabProps, Tabs, TabsList, TabsListProps, TabsPanel, TabsPanelProps, TabsProps } from "./tabs.js";
2
+ export { Tab, type TabProps, Tabs, TabsList, type TabsListProps, TabsPanel, type TabsPanelProps, type TabsProps };
@@ -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,3 @@
1
+ import { TextTone, Truncate } from "../internal/text.js";
2
+ import { Text, TextProps, TextSize, TextWeight } from "./text.js";
3
+ export { Text, type TextProps, type TextSize, type TextTone, type TextWeight, type Truncate };
@@ -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,2 @@
1
+ import { TextField, TextFieldProps } from "./text-field.js";
2
+ export { TextField, type TextFieldProps };
@@ -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">;
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, name, disabled, className, style, ...inputProps }: TextFieldProps): ReactElement;
15
+ export {};
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { cx } from "../internal/cx.js";
3
+ import { FieldMessages, labelText } from "../field/field.js";
4
+ import { Input } from "../input/input.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Field } from "@base-ui/react/field";
7
+ // src/text-field/text-field.tsx
8
+ /**
9
+ * Field + Input in one: the default way to build a text row (D-12). `name`, `disabled` and
10
+ * validation go to the Field; `ref`, `required`, `readOnly` and every other prop go to the input.
11
+ */
12
+ function TextField({ label, description, error, optional, hideLabel, invalid, validate, validationMode, validationDebounceTime, dirty, touched, actionsRef, name, disabled, className, style, ...inputProps }) {
13
+ return /* @__PURE__ */ jsxs(Field.Root, {
14
+ name,
15
+ disabled,
16
+ invalid: invalid ?? (error != null ? true : void 0),
17
+ validate,
18
+ validationMode,
19
+ validationDebounceTime,
20
+ dirty,
21
+ touched,
22
+ actionsRef,
23
+ className: cx("qx-field", className),
24
+ style,
25
+ "data-slot": "text-field",
26
+ children: [
27
+ /* @__PURE__ */ jsx(Field.Label, {
28
+ className: "qx-field-label",
29
+ "data-slot": "field-label",
30
+ "data-hidden": hideLabel ? "" : void 0,
31
+ children: labelText(label, optional)
32
+ }),
33
+ /* @__PURE__ */ jsx(Input, { ...inputProps }),
34
+ /* @__PURE__ */ jsx(FieldMessages, {
35
+ description,
36
+ error
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ export { TextField };
@@ -0,0 +1,2 @@
1
+ import { ToastApi, ToastOptions, ToastPromiseOptions, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./toast.js";
2
+ export { type ToastApi, type ToastOptions, type ToastPromiseOptions, ToastProvider, type ToastProviderProps, type ToastTone, useToast };
@@ -0,0 +1 @@
1
+ export { ToastProvider, useToast } from "./toast.js";
@@ -0,0 +1,54 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ export type ToastTone = "info" | "success" | "warning" | "danger";
3
+ export interface ToastOptions {
4
+ /** What happened, in a few words ("Invoice sent"). */
5
+ title: ReactNode;
6
+ /** One more line, if it helps. */
7
+ description?: ReactNode;
8
+ /** Default `info`. A `danger` toast stays until dismissed and is announced at once. */
9
+ tone?: ToastTone;
10
+ /** At most one action, such as Undo. */
11
+ action?: {
12
+ label: string;
13
+ onClick: () => void;
14
+ };
15
+ /** Milliseconds before it closes. Default 5000; `danger` toasts ignore it. */
16
+ timeout?: number;
17
+ /** Your own id, to update or close it later. */
18
+ id?: string;
19
+ /** Called when it closes, however it closes. */
20
+ onClose?: () => void;
21
+ }
22
+ export interface ToastPromiseOptions<Value> {
23
+ loading: ToastOptions;
24
+ success: ToastOptions | ((value: Value) => ToastOptions);
25
+ error: ToastOptions | ((error: unknown) => ToastOptions);
26
+ }
27
+ export interface ToastApi {
28
+ /** Shows a toast and returns its id. */
29
+ add: (options: ToastOptions) => string;
30
+ /** Closes one toast, or every toast with no id. */
31
+ close: (id?: string) => void;
32
+ /** Changes a toast that is showing. */
33
+ update: (id: string, options: Partial<ToastOptions>) => void;
34
+ /** Shows `loading`, then `success` or `error` when the promise settles; returns the promise. */
35
+ promise: <Value>(promise: Promise<Value>, options: ToastPromiseOptions<Value>) => Promise<Value>;
36
+ }
37
+ export interface ToastProviderProps {
38
+ /** Your app. */
39
+ children?: ReactNode;
40
+ /** The most toasts shown at once; older ones wait. Default 3. */
41
+ limit?: number;
42
+ /** Default milliseconds before a toast closes. Default 5000. */
43
+ timeout?: number;
44
+ }
45
+ /**
46
+ * Shows toasts from anywhere inside ToastProvider:
47
+ * `const toast = useToast(); toast.add({ title: "Invoice sent", tone: "success" })`.
48
+ */
49
+ export declare function useToast(): ToastApi;
50
+ /**
51
+ * Wrap the app once. It renders the toast region: a landmark named "Notifications" at the bottom
52
+ * end, reachable with F6. Toasts pause while hovered or focused and swipe away on touch.
53
+ */
54
+ export declare function ToastProvider({ children, limit, timeout }: ToastProviderProps): ReactElement;
@@ -0,0 +1,123 @@
1
+ "use client";
2
+ import { messages } from "../internal/messages.js";
3
+ import { Button, IconButton } from "../button/button.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() {
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": messages.toast.close,
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 }) {
112
+ return /* @__PURE__ */ jsxs(Toast.Provider, {
113
+ limit,
114
+ timeout,
115
+ children: [children, /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, {
116
+ className: "qx-toast-viewport",
117
+ "data-slot": "toast-viewport",
118
+ "aria-label": messages.toast.region,
119
+ children: /* @__PURE__ */ jsx(ToastList, {})
120
+ }) })]
121
+ });
122
+ }
123
+ export { ToastProvider, useToast };
@@ -0,0 +1,2 @@
1
+ import { Toggle, ToggleGroup, ToggleGroupProps, ToggleGroupVariant, ToggleProps } from "./toggle.js";
2
+ export { Toggle, ToggleGroup, type ToggleGroupProps, type ToggleGroupVariant, type ToggleProps };
@@ -0,0 +1 @@
1
+ export { Toggle, ToggleGroup } from "./toggle.js";
@@ -0,0 +1,48 @@
1
+ import { ControlSize, QeetrixIcon } from "../internal/control.js";
2
+ import { ComponentProps, ReactElement, ReactNode } from "react";
3
+ import { Toggle } from "@base-ui/react/toggle";
4
+ import { ToggleGroup } from "@base-ui/react/toggle-group";
5
+ export interface ToggleProps extends Omit<ComponentProps<"button">, "value" | "defaultValue" | "onChange" | "children"> {
6
+ /** Controlled pressed state. */
7
+ pressed?: boolean;
8
+ /** Initial pressed state when uncontrolled. */
9
+ defaultPressed?: boolean;
10
+ /** Called with the new pressed state and Base UI's event details. */
11
+ onPressedChange?: Toggle.Props["onPressedChange"];
12
+ /** The toggle's value inside a ToggleGroup. */
13
+ value?: string;
14
+ /** Height from the density tokens. Default `md`; a ToggleGroup's size wins inside the group. */
15
+ size?: ControlSize;
16
+ /** An icon from `@qeetrix/icons`, in the sharp shape. Icon-only toggles need `aria-label`. */
17
+ icon?: QeetrixIcon;
18
+ /** Show the icon's filled drawing while pressed. Only for icons that have one. */
19
+ filledWhenPressed?: boolean;
20
+ /** The label. */
21
+ children?: ReactNode;
22
+ /** Render a different element through Base UI. */
23
+ render?: Toggle.Props["render"];
24
+ }
25
+ /** A pressed / not-pressed control: a tool, or one view among a few (inside a ToggleGroup). */
26
+ declare function Toggle$1({ size, icon, filledWhenPressed, className, children, type, ...props }: ToggleProps): ReactElement;
27
+ export type ToggleGroupVariant = "segmented" | "separate";
28
+ export interface ToggleGroupProps extends Omit<ComponentProps<"div">, "defaultValue" | "onChange" | "dir"> {
29
+ /** Controlled pressed values. */
30
+ value?: readonly string[];
31
+ /** Initial pressed values when uncontrolled. */
32
+ defaultValue?: readonly string[];
33
+ /** Called with the pressed values and Base UI's event details. */
34
+ onValueChange?: ToggleGroup.Props["onValueChange"];
35
+ /** Allow several toggles pressed at once. Default: one at a time. */
36
+ multiple?: boolean;
37
+ /** Disable every toggle. */
38
+ disabled?: boolean;
39
+ /** Default `horizontal`. */
40
+ orientation?: "horizontal" | "vertical";
41
+ /** `segmented` (default): one joined control. `separate`: individual toggles with a gap. */
42
+ variant?: ToggleGroupVariant;
43
+ /** Height for every toggle in the group. Default `md`. */
44
+ size?: ControlSize;
45
+ }
46
+ /** A row of toggles: a segmented control for one view among a few, or a set of tools. */
47
+ declare function ToggleGroup$1({ variant, size, orientation, className, ...props }: ToggleGroupProps): ReactElement;
48
+ export { Toggle$1 as Toggle, ToggleGroup$1 as ToggleGroup };