@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.
- package/CHANGELOG.md +181 -0
- package/README.md +167 -2
- 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 +46 -0
- package/dist/button/button.js +74 -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 +44 -0
- package/dist/css/badge.css +53 -0
- package/dist/css/base.css +5 -0
- package/dist/css/box.css +163 -0
- package/dist/css/button.css +168 -0
- package/dist/css/card.css +75 -0
- package/dist/css/checkbox.css +58 -0
- package/dist/css/dialog.css +121 -0
- package/dist/css/drawer.css +123 -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 +98 -0
- package/dist/css/link.css +45 -0
- package/dist/css/menu.css +149 -0
- package/dist/css/popover.css +72 -0
- package/dist/css/progress.css +88 -0
- package/dist/css/radio.css +54 -0
- package/dist/css/scroll-area.css +63 -0
- package/dist/css/select.css +173 -0
- package/dist/css/separator.css +28 -0
- package/dist/css/skeleton.css +33 -0
- package/dist/css/skip-link.css +33 -0
- package/dist/css/slider.css +86 -0
- package/dist/css/spinner.css +55 -0
- package/dist/css/stack.css +76 -0
- package/dist/css/switch.css +79 -0
- package/dist/css/table.css +68 -0
- package/dist/css/tabs.css +112 -0
- package/dist/css/text-field.css +4 -0
- package/dist/css/text.css +106 -0
- package/dist/css/toast.css +108 -0
- package/dist/css/toggle.css +112 -0
- package/dist/css/tooltip.css +41 -0
- package/dist/css/visually-hidden.css +15 -0
- package/dist/dialog/dialog.d.ts +51 -0
- package/dist/dialog/dialog.js +120 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +1 -0
- package/dist/drawer/drawer.d.ts +46 -0
- package/dist/drawer/drawer.js +101 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/index.js +1 -0
- package/dist/field/choice.d.ts +21 -0
- package/dist/field/choice.js +67 -0
- package/dist/field/field.d.ts +28 -0
- package/dist/field/field.js +77 -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/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 +80 -0
- package/dist/index.js +38 -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/messages.js +22 -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 +13 -0
- package/dist/link/link.js +31 -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 +57 -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 +17 -0
- package/dist/slider/slider.js +51 -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 +2960 -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 +41 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +1 -0
- package/dist/toast/toast.d.ts +54 -0
- package/dist/toast/toast.js +123 -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 +219 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ControlSize, QeetrixIcon } from "../internal/control.js";
|
|
2
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { Button } from "@base-ui/react/button";
|
|
4
|
+
export type ButtonVariant = "solid" | "soft" | "ghost";
|
|
5
|
+
export type ButtonTone = "brand" | "danger";
|
|
6
|
+
interface ButtonBaseProps extends Omit<ComponentProps<"button">, "children"> {
|
|
7
|
+
/** Emphasis: `solid` (primary, Ember), `soft` (secondary, graphite), `ghost` (tertiary). */
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
/** `danger` for the confirming action of a destructive flow. */
|
|
10
|
+
tone?: ButtonTone;
|
|
11
|
+
/** Height from the density tokens. Default `md`. */
|
|
12
|
+
size?: ControlSize;
|
|
13
|
+
/** Busy: a spinner replaces the icon, clicks are ignored and `aria-busy` is set. */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** Render a different element through Base UI, e.g. a router link. */
|
|
16
|
+
render?: Button.Props["render"];
|
|
17
|
+
}
|
|
18
|
+
export interface ButtonProps extends ButtonBaseProps {
|
|
19
|
+
/** The label. Write it as a verb: "Create invoice". */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** A trailing icon from `@qeetrix/icons`; rendered in the sharp shape. */
|
|
22
|
+
icon?: QeetrixIcon;
|
|
23
|
+
/** Fill the width of the container (forms, mobile). */
|
|
24
|
+
fullWidth?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface IconButtonProps extends ButtonBaseProps {
|
|
27
|
+
/** The icon, from `@qeetrix/icons`; rendered in the sharp shape. */
|
|
28
|
+
icon: QeetrixIcon;
|
|
29
|
+
/** Required: an icon-only button has no visible label. */
|
|
30
|
+
"aria-label": string;
|
|
31
|
+
/**
|
|
32
|
+
* The tooltip, which shows the `aria-label` by default (06-component-specs.md §1). Pass other text
|
|
33
|
+
* to show that instead, or `false` where the label is visible nearby.
|
|
34
|
+
*/
|
|
35
|
+
tooltip?: ReactNode | false;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* An action. One `solid` and one `soft` per region, everything else `ghost` (design rules §7).
|
|
39
|
+
* Disabled buttons stay focusable, so the reason they're disabled can be read.
|
|
40
|
+
*/
|
|
41
|
+
declare function Button$1({ variant, tone, size, icon, loading, fullWidth, disabled, className, children, type, ...props }: ButtonProps): ReactElement;
|
|
42
|
+
/**
|
|
43
|
+
* A square, icon-only button. Its `aria-label` is required by its type, and it shows as a tooltip.
|
|
44
|
+
*/
|
|
45
|
+
export declare function IconButton({ variant, tone, size, icon, loading, tooltip, disabled, className, type, ...props }: IconButtonProps): ReactElement;
|
|
46
|
+
export { Button$1 as Button };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../internal/cx.js";
|
|
3
|
+
import { iconSize } from "../internal/control.js";
|
|
4
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
5
|
+
import { Tooltip } from "../tooltip/tooltip.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Button } from "@base-ui/react/button";
|
|
8
|
+
// src/button/button.tsx
|
|
9
|
+
function content(icon, size, loading) {
|
|
10
|
+
if (loading) return /* @__PURE__ */ jsx(Spinner, {
|
|
11
|
+
decorative: true,
|
|
12
|
+
size: size === "lg" ? "lg" : "md"
|
|
13
|
+
});
|
|
14
|
+
if (!icon) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(icon, {
|
|
16
|
+
shape: "sharp",
|
|
17
|
+
size: iconSize(size),
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
className: "qx-button-icon",
|
|
20
|
+
"data-slot": "button-icon"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An action. One `solid` and one `soft` per region, everything else `ghost` (design rules §7).
|
|
25
|
+
* Disabled buttons stay focusable, so the reason they're disabled can be read.
|
|
26
|
+
*/
|
|
27
|
+
function Button$1({ variant = "solid", tone = "brand", size = "md", icon, loading = false, fullWidth, disabled, className, children, type = "button", ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
29
|
+
...props,
|
|
30
|
+
type,
|
|
31
|
+
disabled: disabled || loading,
|
|
32
|
+
focusableWhenDisabled: true,
|
|
33
|
+
"aria-busy": loading || void 0,
|
|
34
|
+
className: cx("qx-button", className),
|
|
35
|
+
"data-slot": "button",
|
|
36
|
+
"data-variant": variant,
|
|
37
|
+
"data-tone": tone,
|
|
38
|
+
"data-size": size,
|
|
39
|
+
"data-icon": icon ? "" : void 0,
|
|
40
|
+
"data-loading": loading ? "" : void 0,
|
|
41
|
+
"data-full-width": fullWidth ? "" : void 0,
|
|
42
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: "qx-button-label",
|
|
44
|
+
"data-slot": "button-label",
|
|
45
|
+
children
|
|
46
|
+
}), content(icon, size, loading)]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A square, icon-only button. Its `aria-label` is required by its type, and it shows as a tooltip.
|
|
51
|
+
*/
|
|
52
|
+
function IconButton({ variant = "ghost", tone = "brand", size = "md", icon, loading = false, tooltip, disabled, className, type = "button", ...props }) {
|
|
53
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
54
|
+
...props,
|
|
55
|
+
type,
|
|
56
|
+
disabled: disabled || loading,
|
|
57
|
+
focusableWhenDisabled: true,
|
|
58
|
+
"aria-busy": loading || void 0,
|
|
59
|
+
className: cx("qx-button qx-icon-button", className),
|
|
60
|
+
"data-slot": "icon-button",
|
|
61
|
+
"data-variant": variant,
|
|
62
|
+
"data-tone": tone,
|
|
63
|
+
"data-size": size,
|
|
64
|
+
"data-icon": "",
|
|
65
|
+
"data-loading": loading ? "" : void 0,
|
|
66
|
+
children: content(icon, size, loading)
|
|
67
|
+
});
|
|
68
|
+
if (tooltip === false) return button;
|
|
69
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
70
|
+
content: tooltip ?? props["aria-label"],
|
|
71
|
+
children: button
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export { Button$1 as Button, IconButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button, IconButton } from "./button.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RenderProp } from "../internal/render.js";
|
|
2
|
+
import { HeadingLevel } from "../heading/heading.js";
|
|
3
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
4
|
+
/** A titled card names its heading level, so the page sets the outline, not the look. */
|
|
5
|
+
type CardTitle = {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
level: HeadingLevel;
|
|
8
|
+
} | {
|
|
9
|
+
title?: undefined;
|
|
10
|
+
level?: undefined;
|
|
11
|
+
};
|
|
12
|
+
interface CardOwnProps extends Omit<ComponentProps<"div">, "title"> {
|
|
13
|
+
/** A line under the title. */
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
/** Actions at the end of the header, e.g. a ghost "View all" button. */
|
|
16
|
+
actions?: ReactNode;
|
|
17
|
+
/** A ruled footer, e.g. the card's actions. */
|
|
18
|
+
footer?: ReactNode;
|
|
19
|
+
/** Render a different element, e.g. `render={<article />}`. */
|
|
20
|
+
render?: RenderProp;
|
|
21
|
+
}
|
|
22
|
+
/** Card props: a `title` needs its heading `level`. The children are the body. */
|
|
23
|
+
export type CardProps = CardOwnProps & CardTitle;
|
|
24
|
+
/**
|
|
25
|
+
* Related content on a page (06-component-specs.md §9): a raised, ruled surface with no shadow. A
|
|
26
|
+
* titled card is a section labelled by its title. A Table as the body's direct child runs edge to
|
|
27
|
+
* edge. Server-safe.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Card({ title, level, description, actions, footer, render, className, children, ...props }: CardProps): ReactElement;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cx } from "../internal/cx.js";
|
|
2
|
+
import { renderElement } from "../internal/render.js";
|
|
3
|
+
import { Heading } from "../heading/heading.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
// src/card/card.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Related content on a page (06-component-specs.md §9): a raised, ruled surface with no shadow. A
|
|
9
|
+
* titled card is a section labelled by its title. A Table as the body's direct child runs edge to
|
|
10
|
+
* edge. Server-safe.
|
|
11
|
+
*/
|
|
12
|
+
function Card({ title, level, description, actions, footer, render, className, children, ...props }) {
|
|
13
|
+
const titleId = useId();
|
|
14
|
+
const titled = title != null && level !== void 0;
|
|
15
|
+
const header = titled || description != null || actions != null;
|
|
16
|
+
return renderElement(titled ? "section" : "div", render, {
|
|
17
|
+
...titled ? { "aria-labelledby": titleId } : {},
|
|
18
|
+
...props,
|
|
19
|
+
className: cx("qx-card", className),
|
|
20
|
+
"data-slot": "card",
|
|
21
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
header && /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
className: "qx-card-header",
|
|
24
|
+
"data-slot": "card-header",
|
|
25
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "qx-card-heading",
|
|
27
|
+
children: [titled && /* @__PURE__ */ jsx(Heading, {
|
|
28
|
+
level,
|
|
29
|
+
size: "title-sm",
|
|
30
|
+
id: titleId,
|
|
31
|
+
children: title
|
|
32
|
+
}), description != null && /* @__PURE__ */ jsx("p", {
|
|
33
|
+
className: "qx-card-description",
|
|
34
|
+
"data-slot": "card-description",
|
|
35
|
+
children: description
|
|
36
|
+
})]
|
|
37
|
+
}), actions != null && /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "qx-card-actions",
|
|
39
|
+
"data-slot": "card-actions",
|
|
40
|
+
children: actions
|
|
41
|
+
})]
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "qx-card-body",
|
|
45
|
+
"data-slot": "card-body",
|
|
46
|
+
children
|
|
47
|
+
}),
|
|
48
|
+
footer != null && /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "qx-card-footer",
|
|
50
|
+
"data-slot": "card-footer",
|
|
51
|
+
children: footer
|
|
52
|
+
})
|
|
53
|
+
] })
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export { Card };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Card } from "./card.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FieldMessageProps } from "../field/field.js";
|
|
2
|
+
import { ChoiceLabelProps, ChoiceOrientation } from "../field/choice.js";
|
|
3
|
+
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
4
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
5
|
+
import { CheckboxGroup } from "@base-ui/react/checkbox-group";
|
|
6
|
+
interface CheckboxOwnProps extends Omit<Checkbox.Root.Props, "className" | "style" | "children"> {
|
|
7
|
+
/** A line under the label. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Placement of the row (or of the control alone, with no label) only. */
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
/** Checkbox props: Base UI's, plus `label` — or, with no visible label, a required `aria-label`. */
|
|
14
|
+
export type CheckboxProps = CheckboxOwnProps & ChoiceLabelProps;
|
|
15
|
+
/**
|
|
16
|
+
* Turns one option on or off, or picks several inside a CheckboxGroup (06-component-specs.md §3).
|
|
17
|
+
* `ref` and Base UI props go to the control; the label makes the whole row the click target.
|
|
18
|
+
*/
|
|
19
|
+
declare function Checkbox$1({ label, description, className, style, indeterminate, ...props }: CheckboxProps): ReactElement;
|
|
20
|
+
export interface CheckboxGroupProps extends Omit<CheckboxGroup.Props, "className" | "style" | "render">, FieldMessageProps {
|
|
21
|
+
/** The question, shown as the group's legend. */
|
|
22
|
+
label: ReactNode;
|
|
23
|
+
/** The field name the checked values submit under. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** `vertical` (default) or `horizontal` for short options. */
|
|
26
|
+
orientation?: ChoiceOrientation;
|
|
27
|
+
/** Placement only (margin, width, grid placement). */
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
/** Several options under one question; `value` is the array of checked options' values. */
|
|
32
|
+
declare function CheckboxGroup$1({ label, description, error, name, disabled, orientation, className, style, children, ...props }: CheckboxGroupProps): ReactElement;
|
|
33
|
+
export { Checkbox$1 as Checkbox, CheckboxGroup$1 as CheckboxGroup };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../internal/cx.js";
|
|
3
|
+
import { ChoiceGroup, ChoiceRow } from "../field/choice.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
6
|
+
import { CheckboxGroup } from "@base-ui/react/checkbox-group";
|
|
7
|
+
import { CheckIcon } from "@qeetrix/icons/icons/check";
|
|
8
|
+
import { MinusIcon } from "@qeetrix/icons/icons/minus";
|
|
9
|
+
// src/checkbox/checkbox.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Turns one option on or off, or picks several inside a CheckboxGroup (06-component-specs.md §3).
|
|
12
|
+
* `ref` and Base UI props go to the control; the label makes the whole row the click target.
|
|
13
|
+
*/
|
|
14
|
+
function Checkbox$1({ label, description, className, style, indeterminate, ...props }) {
|
|
15
|
+
const Mark = indeterminate ? MinusIcon : CheckIcon;
|
|
16
|
+
return /* @__PURE__ */ jsx(ChoiceRow, {
|
|
17
|
+
kind: "checkbox",
|
|
18
|
+
label,
|
|
19
|
+
description,
|
|
20
|
+
disabled: props.disabled,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
children: /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
24
|
+
...props,
|
|
25
|
+
indeterminate,
|
|
26
|
+
className: cx("qx-checkbox", label == null ? className : void 0),
|
|
27
|
+
style: label == null ? style : void 0,
|
|
28
|
+
"data-slot": "checkbox-indicator",
|
|
29
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
30
|
+
className: "qx-checkbox-mark",
|
|
31
|
+
"data-slot": "checkbox-mark",
|
|
32
|
+
children: /* @__PURE__ */ jsx(Mark, {
|
|
33
|
+
shape: "sharp",
|
|
34
|
+
size: 12,
|
|
35
|
+
strokeWidth: 3,
|
|
36
|
+
"aria-hidden": true
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** Several options under one question; `value` is the array of checked options' values. */
|
|
43
|
+
function CheckboxGroup$1({ label, description, error, name, disabled, orientation = "vertical", className, style, children, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx(ChoiceGroup, {
|
|
45
|
+
kind: "checkbox",
|
|
46
|
+
label,
|
|
47
|
+
description,
|
|
48
|
+
error,
|
|
49
|
+
name,
|
|
50
|
+
disabled,
|
|
51
|
+
orientation,
|
|
52
|
+
className,
|
|
53
|
+
style,
|
|
54
|
+
group: /* @__PURE__ */ jsx(CheckboxGroup, {
|
|
55
|
+
...props,
|
|
56
|
+
disabled
|
|
57
|
+
}),
|
|
58
|
+
children
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export { Checkbox$1 as Checkbox, CheckboxGroup$1 as CheckboxGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox, CheckboxGroup } from "./checkbox.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@import "./base.css";
|
|
2
|
+
|
|
3
|
+
@layer qx.components {
|
|
4
|
+
.qx-accordion {
|
|
5
|
+
border-block-end: var(--qx-border-width-default) solid var(--qx-color-border-subtle);
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
min-inline-size: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.qx-accordion-item {
|
|
12
|
+
border-block-start: var(--qx-border-width-default) solid var(--qx-color-border-subtle);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.qx-accordion-header {
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.qx-accordion-trigger {
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: var(--qx-space-gap-md);
|
|
23
|
+
inline-size: 100%;
|
|
24
|
+
min-block-size: var(--qx-size-control-lg);
|
|
25
|
+
color: var(--qx-color-text-default);
|
|
26
|
+
font: var(--qx-typography-title-sm);
|
|
27
|
+
font-variation-settings: "GEOM" var(--qx-font-geometry-heading);
|
|
28
|
+
text-align: start;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
background: none;
|
|
31
|
+
border: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.qx-accordion-trigger:focus-visible {
|
|
37
|
+
outline: var(--qx-focus-ring-width) solid var(--qx-color-border-focus);
|
|
38
|
+
outline-offset: calc(-1 * var(--qx-focus-ring-width));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.qx-accordion-trigger[data-disabled] {
|
|
42
|
+
color: var(--qx-color-text-disabled);
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.qx-accordion-icon {
|
|
47
|
+
color: var(--qx-color-icon-subtle);
|
|
48
|
+
transition-property: rotate;
|
|
49
|
+
transition-duration: var(--qx-motion-duration-normal);
|
|
50
|
+
transition-timing-function: var(--qx-motion-easing-standard);
|
|
51
|
+
flex: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[data-panel-open] > .qx-accordion-icon {
|
|
55
|
+
rotate: 180deg;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.qx-accordion-panel, .qx-collapsible-panel {
|
|
59
|
+
block-size: var(--accordion-panel-height, var(--collapsible-panel-height));
|
|
60
|
+
transition-property: block-size;
|
|
61
|
+
transition-duration: var(--qx-motion-duration-normal);
|
|
62
|
+
transition-timing-function: var(--qx-motion-easing-standard);
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:is(.qx-accordion-panel, .qx-collapsible-panel)[data-starting-style], :is(.qx-accordion-panel, .qx-collapsible-panel)[data-ending-style] {
|
|
67
|
+
block-size: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.qx-accordion-content {
|
|
71
|
+
padding-block-end: var(--qx-space-inset-lg);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@import "./base.css";
|
|
2
|
+
|
|
3
|
+
@layer qx.components {
|
|
4
|
+
.qx-avatar {
|
|
5
|
+
border-radius: var(--qx-radius-full);
|
|
6
|
+
background: var(--qx-color-bg-neutral-subtle-pressed);
|
|
7
|
+
block-size: 32px;
|
|
8
|
+
inline-size: 32px;
|
|
9
|
+
color: var(--qx-color-text-default);
|
|
10
|
+
font: var(--qx-typography-label-sm);
|
|
11
|
+
font-variation-settings: "GEOM" var(--qx-font-geometry-body);
|
|
12
|
+
vertical-align: middle;
|
|
13
|
+
-webkit-user-select: none;
|
|
14
|
+
user-select: none;
|
|
15
|
+
flex: none;
|
|
16
|
+
place-items: center;
|
|
17
|
+
display: inline-grid;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.qx-avatar[data-size="sm"] {
|
|
22
|
+
block-size: 24px;
|
|
23
|
+
inline-size: 24px;
|
|
24
|
+
font-size: var(--qx-typography-label-sm-font-size);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.qx-avatar[data-size="lg"] {
|
|
28
|
+
block-size: 40px;
|
|
29
|
+
inline-size: 40px;
|
|
30
|
+
font: var(--qx-typography-label-md);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.qx-avatar[data-size="xl"] {
|
|
34
|
+
block-size: 48px;
|
|
35
|
+
inline-size: 48px;
|
|
36
|
+
font: var(--qx-typography-label-md);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.qx-avatar-image {
|
|
40
|
+
object-fit: cover;
|
|
41
|
+
block-size: 100%;
|
|
42
|
+
inline-size: 100%;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@import "./base.css";
|
|
2
|
+
|
|
3
|
+
@layer qx.components {
|
|
4
|
+
.qx-badge {
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--qx-space-gap-xs);
|
|
7
|
+
border-radius: var(--qx-radius-chip);
|
|
8
|
+
background: var(--qx-color-bg-neutral-subtle-pressed);
|
|
9
|
+
max-inline-size: 100%;
|
|
10
|
+
color: var(--qx-color-text-default);
|
|
11
|
+
font: var(--qx-typography-label-sm);
|
|
12
|
+
font-variation-settings: "GEOM" var(--qx-font-geometry-body);
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
padding: 2px 8px;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.qx-badge[data-tone="brand"] {
|
|
20
|
+
background: var(--qx-color-bg-brand-subtle);
|
|
21
|
+
color: var(--qx-color-text-brand);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.qx-badge[data-tone="info"] {
|
|
25
|
+
background: var(--qx-color-bg-info-subtle);
|
|
26
|
+
color: var(--qx-color-text-info);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.qx-badge[data-tone="success"] {
|
|
30
|
+
background: var(--qx-color-bg-success-subtle);
|
|
31
|
+
color: var(--qx-color-text-success);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.qx-badge[data-tone="warning"] {
|
|
35
|
+
background: var(--qx-color-bg-warning-subtle);
|
|
36
|
+
color: var(--qx-color-text-warning);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.qx-badge[data-tone="danger"] {
|
|
40
|
+
background: var(--qx-color-bg-danger-subtle);
|
|
41
|
+
color: var(--qx-color-text-danger);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.qx-badge-icon {
|
|
45
|
+
flex: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.qx-badge-label {
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
min-inline-size: 0;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/css/box.css
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
@import "./base.css";
|
|
2
|
+
|
|
3
|
+
@layer qx.components {
|
|
4
|
+
.qx-box[data-padding="none"] {
|
|
5
|
+
padding: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.qx-box[data-padding="xs"] {
|
|
9
|
+
padding: var(--qx-space-inset-xs);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.qx-box[data-padding="sm"] {
|
|
13
|
+
padding: var(--qx-space-inset-sm);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.qx-box[data-padding="md"] {
|
|
17
|
+
padding: var(--qx-space-inset-md);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.qx-box[data-padding="lg"] {
|
|
21
|
+
padding: var(--qx-space-inset-lg);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.qx-box[data-padding="xl"] {
|
|
25
|
+
padding: var(--qx-space-inset-xl);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.qx-box[data-padding-inline="none"] {
|
|
29
|
+
padding-inline: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.qx-box[data-padding-inline="xs"] {
|
|
33
|
+
padding-inline: var(--qx-space-inset-xs);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.qx-box[data-padding-inline="sm"] {
|
|
37
|
+
padding-inline: var(--qx-space-inset-sm);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.qx-box[data-padding-inline="md"] {
|
|
41
|
+
padding-inline: var(--qx-space-inset-md);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.qx-box[data-padding-inline="lg"] {
|
|
45
|
+
padding-inline: var(--qx-space-inset-lg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.qx-box[data-padding-inline="xl"] {
|
|
49
|
+
padding-inline: var(--qx-space-inset-xl);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.qx-box[data-padding-block="none"] {
|
|
53
|
+
padding-block: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.qx-box[data-padding-block="xs"] {
|
|
57
|
+
padding-block: var(--qx-space-inset-xs);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.qx-box[data-padding-block="sm"] {
|
|
61
|
+
padding-block: var(--qx-space-inset-sm);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.qx-box[data-padding-block="md"] {
|
|
65
|
+
padding-block: var(--qx-space-inset-md);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.qx-box[data-padding-block="lg"] {
|
|
69
|
+
padding-block: var(--qx-space-inset-lg);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.qx-box[data-padding-block="xl"] {
|
|
73
|
+
padding-block: var(--qx-space-inset-xl);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.qx-box[data-background="canvas"] {
|
|
77
|
+
background: var(--qx-color-surface-canvas);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.qx-box[data-background="default"] {
|
|
81
|
+
background: var(--qx-color-surface-default);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.qx-box[data-background="raised"] {
|
|
85
|
+
background: var(--qx-color-surface-raised);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.qx-box[data-background="sunken"] {
|
|
89
|
+
background: var(--qx-color-surface-sunken);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.qx-box[data-background="overlay"] {
|
|
93
|
+
background: var(--qx-color-surface-overlay);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.qx-box[data-background="inverse"] {
|
|
97
|
+
background: var(--qx-color-surface-inverse);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.qx-box[data-background="neutral"] {
|
|
101
|
+
background: var(--qx-color-bg-neutral-subtle);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.qx-box[data-background="brand"] {
|
|
105
|
+
background: var(--qx-color-bg-brand-subtle);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.qx-box[data-background="selected"] {
|
|
109
|
+
background: var(--qx-color-bg-selected);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.qx-box[data-background="inverse"] {
|
|
113
|
+
color: var(--qx-color-text-inverse);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.qx-box[data-border="none"] {
|
|
117
|
+
border: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.qx-box[data-border="subtle"] {
|
|
121
|
+
border: var(--qx-border-width-default) solid var(--qx-color-border-subtle);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.qx-box[data-border="default"] {
|
|
125
|
+
border: var(--qx-border-width-default) solid var(--qx-color-border-default);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.qx-box[data-border="strong"] {
|
|
129
|
+
border: var(--qx-border-width-default) solid var(--qx-color-border-strong);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.qx-box[data-radius="none"] {
|
|
133
|
+
border-radius: var(--qx-radius-none);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.qx-box[data-radius="sm"] {
|
|
137
|
+
border-radius: var(--qx-radius-sm);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.qx-box[data-radius="control"] {
|
|
141
|
+
border-radius: var(--qx-radius-control);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.qx-box[data-radius="surface"] {
|
|
145
|
+
border-radius: var(--qx-radius-surface);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.qx-box[data-radius="overlay"] {
|
|
149
|
+
border-radius: var(--qx-radius-overlay);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.qx-box[data-radius="modal"] {
|
|
153
|
+
border-radius: var(--qx-radius-modal);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.qx-box[data-radius="chip"] {
|
|
157
|
+
border-radius: var(--qx-radius-chip);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.qx-box[data-radius="full"] {
|
|
161
|
+
border-radius: var(--qx-radius-full);
|
|
162
|
+
}
|
|
163
|
+
}
|