@tensor_1/react 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chart.cjs +127 -0
- package/dist/chart.d.cts +24 -0
- package/dist/chart.d.ts +3 -0
- package/dist/chart.js +5 -0
- package/dist/components/Alert.d.ts +13 -0
- package/dist/components/Alert.js +14 -0
- package/dist/components/AppShell.d.ts +12 -0
- package/dist/components/AppShell.js +12 -0
- package/dist/components/Avatar.d.ts +30 -0
- package/dist/components/Avatar.js +26 -0
- package/dist/components/Button.d.ts +18 -0
- package/dist/components/Button.js +30 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Card.js +19 -0
- package/dist/components/Chart.d.ts +24 -0
- package/dist/components/Chart.js +83 -0
- package/dist/components/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox.js +35 -0
- package/dist/components/CommandPalette.d.ts +30 -0
- package/dist/components/CommandPalette.js +26 -0
- package/dist/components/Comments.d.ts +19 -0
- package/dist/components/Comments.js +22 -0
- package/dist/components/DetailLayout.d.ts +16 -0
- package/dist/components/DetailLayout.js +11 -0
- package/dist/components/Drawer.d.ts +14 -0
- package/dist/components/Drawer.js +27 -0
- package/dist/components/Field.d.ts +16 -0
- package/dist/components/Field.js +14 -0
- package/dist/components/Input.d.ts +18 -0
- package/dist/components/Input.js +38 -0
- package/dist/components/Kanban.d.ts +21 -0
- package/dist/components/Kanban.js +26 -0
- package/dist/components/Label.d.ts +13 -0
- package/dist/components/Label.js +12 -0
- package/dist/components/List.d.ts +21 -0
- package/dist/components/List.js +21 -0
- package/dist/components/Modal.d.ts +15 -0
- package/dist/components/Modal.js +19 -0
- package/dist/components/PageHeader.d.ts +18 -0
- package/dist/components/PageHeader.js +15 -0
- package/dist/components/Pagination.d.ts +11 -0
- package/dist/components/Pagination.js +53 -0
- package/dist/components/Peek.d.ts +17 -0
- package/dist/components/Peek.js +34 -0
- package/dist/components/Popover.d.ts +18 -0
- package/dist/components/Popover.js +9 -0
- package/dist/components/Progress.d.ts +14 -0
- package/dist/components/Progress.js +20 -0
- package/dist/components/Prose.d.ts +21 -0
- package/dist/components/Prose.js +15 -0
- package/dist/components/Radio.d.ts +14 -0
- package/dist/components/Radio.js +18 -0
- package/dist/components/Select.d.ts +9 -0
- package/dist/components/Select.js +17 -0
- package/dist/components/Sidebar.d.ts +39 -0
- package/dist/components/Sidebar.js +89 -0
- package/dist/components/Spinner.d.ts +10 -0
- package/dist/components/Spinner.js +16 -0
- package/dist/components/Stat.d.ts +21 -0
- package/dist/components/Stat.js +18 -0
- package/dist/components/States.d.ts +38 -0
- package/dist/components/States.js +43 -0
- package/dist/components/StatusPill.d.ts +15 -0
- package/dist/components/StatusPill.js +18 -0
- package/dist/components/Switch.d.ts +9 -0
- package/dist/components/Switch.js +14 -0
- package/dist/components/Table.d.ts +34 -0
- package/dist/components/Table.js +62 -0
- package/dist/components/Tabs.d.ts +19 -0
- package/dist/components/Tabs.js +31 -0
- package/dist/components/Textarea.d.ts +9 -0
- package/dist/components/Textarea.js +18 -0
- package/dist/components/Timeline.d.ts +16 -0
- package/dist/components/Timeline.js +21 -0
- package/dist/components/Toast.d.ts +19 -0
- package/dist/components/Toast.js +29 -0
- package/dist/components/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip.js +7 -0
- package/dist/components/Tree.d.ts +28 -0
- package/dist/components/Tree.js +69 -0
- package/dist/cx.d.ts +3 -0
- package/dist/cx.js +6 -0
- package/dist/hooks/useDialog.d.ts +3 -0
- package/dist/hooks/useDialog.js +21 -0
- package/dist/index.cjs +1040 -0
- package/dist/index.d.cts +534 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +106 -0
- package/package.json +47 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface DrawerProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function Drawer({ open, onClose, title, children, footer, className }: DrawerProps): react.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Drawer, type DrawerProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
import { useDialog } from "../hooks/useDialog.js";
|
|
5
|
+
const CloseIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
6
|
+
function Drawer({ open, onClose, title, children, footer, className }) {
|
|
7
|
+
const ref = useDialog(open);
|
|
8
|
+
return /* @__PURE__ */ jsxs("dialog", { ref, className: cx("uix-drawer", className), onClose, children: [
|
|
9
|
+
(title != null || onClose) && /* @__PURE__ */ jsxs("div", { className: "uix-drawer__header", children: [
|
|
10
|
+
title && /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: "var(--uix-text-h3)" }, children: title }),
|
|
11
|
+
onClose && /* @__PURE__ */ jsx(
|
|
12
|
+
"button",
|
|
13
|
+
{
|
|
14
|
+
style: { marginLeft: "auto", border: 0, background: "transparent", color: "var(--uix-text-muted)", cursor: "pointer", width: 30, height: 30, display: "grid", placeItems: "center", borderRadius: "var(--uix-radius-sm)" },
|
|
15
|
+
onClick: onClose,
|
|
16
|
+
"aria-label": "Close drawer",
|
|
17
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
] }),
|
|
21
|
+
children != null && /* @__PURE__ */ jsx("div", { className: "uix-drawer__body", children }),
|
|
22
|
+
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-drawer__footer", children: footer })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Drawer
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface FieldProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
success?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
htmlFor?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function Field({ label, hint, error, success, required, children, className, htmlFor }: FieldProps): react.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { Field, type FieldProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Field({ label, hint, error, success, required, children, className, htmlFor }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-field", className), children: [
|
|
5
|
+
label && /* @__PURE__ */ jsx("label", { className: "uix-field__label", htmlFor, "data-required": required || void 0, children: label }),
|
|
6
|
+
children,
|
|
7
|
+
error && /* @__PURE__ */ jsx("span", { className: "uix-field__error", children: error }),
|
|
8
|
+
success && !error && /* @__PURE__ */ jsx("span", { className: "uix-field__success", children: success }),
|
|
9
|
+
hint && !error && !success && /* @__PURE__ */ jsx("span", { className: "uix-field__hint", children: hint })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
Field
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
5
|
+
size?: 'sm' | 'md';
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
valid?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
10
|
+
interface InputGroupProps {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
leadingIcon?: ReactNode;
|
|
13
|
+
trailingIcon?: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function InputGroup({ children, leadingIcon, trailingIcon, className }: InputGroupProps): react.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Input, InputGroup, type InputGroupProps, type InputProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
const Input = forwardRef(
|
|
5
|
+
({ size = "md", invalid, valid, className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
"input",
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: cx("uix-input", size === "sm" && "uix-input--sm", className),
|
|
10
|
+
"aria-invalid": invalid || void 0,
|
|
11
|
+
"data-valid": valid || void 0,
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
Input.displayName = "Input";
|
|
17
|
+
function InputGroup({ children, leadingIcon, trailingIcon, className }) {
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: cx(
|
|
22
|
+
"uix-input-group",
|
|
23
|
+
leadingIcon && "uix-input-group--has-leading",
|
|
24
|
+
trailingIcon && "uix-input-group--has-trailing",
|
|
25
|
+
className
|
|
26
|
+
),
|
|
27
|
+
children: [
|
|
28
|
+
leadingIcon && /* @__PURE__ */ jsx("span", { className: "uix-input-group__icon", children: leadingIcon }),
|
|
29
|
+
children,
|
|
30
|
+
trailingIcon && /* @__PURE__ */ jsx("span", { className: "uix-input-group__icon uix-input-group__icon--trailing", children: trailingIcon })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
Input,
|
|
37
|
+
InputGroup
|
|
38
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface KanbanProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare function Kanban({ children, className, ...props }: KanbanProps): react.JSX.Element;
|
|
8
|
+
interface KanbanColumnProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
9
|
+
title?: ReactNode;
|
|
10
|
+
count?: number;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare function KanbanColumn({ title, count, children, className, ...props }: KanbanColumnProps): react.JSX.Element;
|
|
14
|
+
interface KanbanCardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
15
|
+
title?: ReactNode;
|
|
16
|
+
meta?: ReactNode;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
declare function KanbanCard({ title, meta, children, className, ...props }: KanbanCardProps): react.JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, type KanbanProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Kanban({ children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-kanban", className), ...props, children });
|
|
5
|
+
}
|
|
6
|
+
function KanbanColumn({ title, count, children, className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-kanban__col", className), ...props, children: [
|
|
8
|
+
(title != null || count != null) && /* @__PURE__ */ jsxs("div", { className: "uix-kanban__head", children: [
|
|
9
|
+
title,
|
|
10
|
+
count != null && /* @__PURE__ */ jsx("span", { className: "uix-kanban__count", children: count })
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "uix-kanban__body", children })
|
|
13
|
+
] });
|
|
14
|
+
}
|
|
15
|
+
function KanbanCard({ title, meta, children, className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-kanban__card", className), ...props, children: [
|
|
17
|
+
title && /* @__PURE__ */ jsx("div", { className: "uix-kanban__card-title", children: title }),
|
|
18
|
+
meta && /* @__PURE__ */ jsx("div", { className: "uix-kanban__card-meta", children: meta }),
|
|
19
|
+
children
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
Kanban,
|
|
24
|
+
KanbanCard,
|
|
25
|
+
KanbanColumn
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface LabelProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
/** Any CSS color or a `--uix-chart-*` var; sets `--label-color`. */
|
|
6
|
+
color?: string;
|
|
7
|
+
dot?: boolean;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** Colored label / tag over `.uix-label`. */
|
|
11
|
+
declare function Label({ color, dot, children, className, style, ...props }: LabelProps): react.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Label, type LabelProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Label({ color, dot, children, className, style, ...props }) {
|
|
4
|
+
const merged = color ? { "--label-color": color, ...style } : style;
|
|
5
|
+
return /* @__PURE__ */ jsxs("span", { className: cx("uix-label", className), style: merged, ...props, children: [
|
|
6
|
+
dot && /* @__PURE__ */ jsx("span", { className: "uix-label__dot", "aria-hidden": "true" }),
|
|
7
|
+
children
|
|
8
|
+
] });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
Label
|
|
12
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ListProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Bordered, rounded list container over `.uix-list`. */
|
|
8
|
+
declare function List({ children, className, ...props }: ListProps): react.JSX.Element;
|
|
9
|
+
interface ListItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
meta?: ReactNode;
|
|
12
|
+
/** Right-aligned trailing content (status, actions). */
|
|
13
|
+
trail?: ReactNode;
|
|
14
|
+
/** Leading content (icon/avatar) rendered before the title block. */
|
|
15
|
+
leading?: ReactNode;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** A single `.uix-list__item`. Provide `title`/`meta`, or arbitrary `children`. */
|
|
19
|
+
declare function ListItem({ title, meta, trail, leading, children, className, ...props }: ListItemProps): react.JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { List, ListItem, type ListItemProps, type ListProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function List({ children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-list", className), ...props, children });
|
|
5
|
+
}
|
|
6
|
+
function ListItem({ title, meta, trail, leading, children, className, ...props }) {
|
|
7
|
+
const hasTitleBlock = title != null || meta != null;
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-list__item", className), ...props, children: [
|
|
9
|
+
leading,
|
|
10
|
+
hasTitleBlock && /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
11
|
+
title != null && /* @__PURE__ */ jsx("div", { className: "uix-list__title", children: title }),
|
|
12
|
+
meta != null && /* @__PURE__ */ jsx("div", { className: "uix-list__meta", children: meta })
|
|
13
|
+
] }),
|
|
14
|
+
children,
|
|
15
|
+
trail != null && /* @__PURE__ */ jsx("div", { className: "uix-list__trail", children: trail })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
List,
|
|
20
|
+
ListItem
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ModalProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
declare function Modal({ open, onClose, title, children, footer, className, style }: ModalProps): react.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Modal, type ModalProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
import { useDialog } from "../hooks/useDialog.js";
|
|
5
|
+
const CloseIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
6
|
+
function Modal({ open, onClose, title, children, footer, className, style }) {
|
|
7
|
+
const ref = useDialog(open);
|
|
8
|
+
return /* @__PURE__ */ jsxs("dialog", { ref, className: cx("uix-dialog", className), style, onClose, children: [
|
|
9
|
+
(title != null || onClose) && /* @__PURE__ */ jsxs("div", { className: "uix-dialog__header", children: [
|
|
10
|
+
title && /* @__PURE__ */ jsx("div", { className: "uix-dialog__title", children: title }),
|
|
11
|
+
onClose && /* @__PURE__ */ jsx("button", { className: "uix-dialog__close", onClick: onClose, "aria-label": "Close dialog", children: /* @__PURE__ */ jsx(CloseIcon, {}) })
|
|
12
|
+
] }),
|
|
13
|
+
children != null && /* @__PURE__ */ jsx("div", { className: "uix-dialog__body", children }),
|
|
14
|
+
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-dialog__footer", children: footer })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
Modal
|
|
19
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PageHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
5
|
+
eyebrow?: ReactNode;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** Supporting copy under the title. */
|
|
8
|
+
subtitle?: ReactNode;
|
|
9
|
+
/** Right-aligned action area (buttons, menus). */
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Page header — eyebrow / title / subtitle + actions row, over `.uix-page-header`.
|
|
14
|
+
* The hairline + breathing room below come from the component CSS.
|
|
15
|
+
*/
|
|
16
|
+
declare function PageHeader({ eyebrow, title, subtitle, actions, className, ...props }: PageHeaderProps): react.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { PageHeader, type PageHeaderProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function PageHeader({ eyebrow, title, subtitle, actions, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("header", { className: cx("uix-page-header", className), ...props, children: [
|
|
5
|
+
/* @__PURE__ */ jsxs("div", { className: "uix-page-header__titles", children: [
|
|
6
|
+
eyebrow != null && /* @__PURE__ */ jsx("div", { className: "uix-page-header__eyebrow", children: eyebrow }),
|
|
7
|
+
/* @__PURE__ */ jsx("h1", { className: "uix-page-header__title", children: title }),
|
|
8
|
+
subtitle != null && /* @__PURE__ */ jsx("p", { className: "uix-page-header__subtitle", children: subtitle })
|
|
9
|
+
] }),
|
|
10
|
+
actions != null && /* @__PURE__ */ jsx("div", { className: "uix-page-header__actions", children: actions })
|
|
11
|
+
] });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
PageHeader
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PaginationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
5
|
+
page: number;
|
|
6
|
+
pageCount: number;
|
|
7
|
+
onChange: (page: number) => void;
|
|
8
|
+
}
|
|
9
|
+
declare function Pagination({ page, pageCount, onChange, className, ...props }: PaginationProps): react.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Pagination, type PaginationProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function getPageNumbers(page, total) {
|
|
4
|
+
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
5
|
+
const pages = [1];
|
|
6
|
+
if (page > 3) pages.push("ellipsis");
|
|
7
|
+
const start = Math.max(2, page - 1);
|
|
8
|
+
const end = Math.min(total - 1, page + 1);
|
|
9
|
+
for (let p = start; p <= end; p++) pages.push(p);
|
|
10
|
+
if (page < total - 2) pages.push("ellipsis");
|
|
11
|
+
pages.push(total);
|
|
12
|
+
return pages;
|
|
13
|
+
}
|
|
14
|
+
function Pagination({ page, pageCount, onChange, className, ...props }) {
|
|
15
|
+
const pages = getPageNumbers(page, pageCount);
|
|
16
|
+
return /* @__PURE__ */ jsxs("nav", { "aria-label": "Pagination", className: cx("uix-pagination", className), ...props, children: [
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
className: "uix-pagination__btn",
|
|
21
|
+
onClick: () => onChange(page - 1),
|
|
22
|
+
disabled: page <= 1,
|
|
23
|
+
"aria-label": "Previous page",
|
|
24
|
+
children: "\u2039"
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
pages.map(
|
|
28
|
+
(p, i) => p === "ellipsis" ? /* @__PURE__ */ jsx("span", { className: "uix-pagination__ellipsis", children: "\u2026" }, `e${i}`) : /* @__PURE__ */ jsx(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
className: "uix-pagination__btn",
|
|
32
|
+
"aria-current": p === page ? "page" : void 0,
|
|
33
|
+
onClick: () => onChange(p),
|
|
34
|
+
children: p
|
|
35
|
+
},
|
|
36
|
+
p
|
|
37
|
+
)
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
className: "uix-pagination__btn",
|
|
43
|
+
onClick: () => onChange(page + 1),
|
|
44
|
+
disabled: page >= pageCount,
|
|
45
|
+
"aria-label": "Next page",
|
|
46
|
+
children: "\u203A"
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
Pagination
|
|
53
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PeekProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
onNavPrev?: () => void;
|
|
11
|
+
onNavNext?: () => void;
|
|
12
|
+
hint?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, className }: PeekProps): react.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { Peek, type PeekProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
import { useDialog } from "../hooks/useDialog.js";
|
|
5
|
+
const CloseIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
6
|
+
const ChevronUp = () => /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 8l4-4 4 4" }) });
|
|
7
|
+
const ChevronDown = () => /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4" }) });
|
|
8
|
+
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, className }) {
|
|
9
|
+
const ref = useDialog(open);
|
|
10
|
+
const hasNav = onNavPrev != null || onNavNext != null;
|
|
11
|
+
const onBackdropClick = (e) => {
|
|
12
|
+
if (!onClose || e.target !== e.currentTarget) return;
|
|
13
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
14
|
+
if (r.width === 0) return;
|
|
15
|
+
const outside = e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;
|
|
16
|
+
if (outside) onClose();
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsxs("dialog", { ref, className: cx("uix-peek", className), onClose, onClick: onBackdropClick, children: [
|
|
19
|
+
/* @__PURE__ */ jsxs("div", { className: "uix-peek__header", children: [
|
|
20
|
+
hasNav && /* @__PURE__ */ jsxs("div", { className: "uix-peek__nav", children: [
|
|
21
|
+
/* @__PURE__ */ jsx("button", { className: "uix-peek__navbtn", onClick: onNavPrev, disabled: !onNavPrev, "aria-label": "Previous record", children: /* @__PURE__ */ jsx(ChevronUp, {}) }),
|
|
22
|
+
/* @__PURE__ */ jsx("button", { className: "uix-peek__navbtn", onClick: onNavNext, disabled: !onNavNext, "aria-label": "Next record", children: /* @__PURE__ */ jsx(ChevronDown, {}) })
|
|
23
|
+
] }),
|
|
24
|
+
title && /* @__PURE__ */ jsx("div", { className: "uix-peek__title", children: title }),
|
|
25
|
+
hint && /* @__PURE__ */ jsx("span", { className: "uix-peek__hint", children: hint }),
|
|
26
|
+
onClose && /* @__PURE__ */ jsx("button", { className: "uix-peek__close", onClick: onClose, "aria-label": "Close preview", children: /* @__PURE__ */ jsx(CloseIcon, {}) })
|
|
27
|
+
] }),
|
|
28
|
+
children != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__body", children }),
|
|
29
|
+
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-peek__footer", children: footer })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
Peek
|
|
34
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Native popover behavior. Defaults to `"auto"` (light-dismiss). A trigger
|
|
7
|
+
* wires to it via `popoverTarget={id}`. Pass `"manual"` to control open state yourself.
|
|
8
|
+
*/
|
|
9
|
+
popover?: 'auto' | 'manual';
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Anchored surface over `.uix-popover`, using the native Popover API.
|
|
14
|
+
* Compose ITSM things like a filter popover by putting controls inside.
|
|
15
|
+
*/
|
|
16
|
+
declare function Popover({ popover, children, className, ...props }: PopoverProps): react.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Popover, type PopoverProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Popover({ popover = "auto", children, className, ...props }) {
|
|
4
|
+
const popoverAttr = { popover };
|
|
5
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-popover", className), ...popoverAttr, ...props, children });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
Popover
|
|
9
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** 0..max. Ignored when `indeterminate`. */
|
|
6
|
+
value?: number;
|
|
7
|
+
/** Default 100. */
|
|
8
|
+
max?: number;
|
|
9
|
+
/** Continuous slide animation when the amount of work is unknown. */
|
|
10
|
+
indeterminate?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function Progress({ value, max, indeterminate, className, ...props }: ProgressProps): react.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Progress, type ProgressProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Progress({ value = 0, max = 100, indeterminate, className, ...props }) {
|
|
4
|
+
const pct = Math.max(0, Math.min(100, value / (max || 100) * 100));
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
role: "progressbar",
|
|
9
|
+
"aria-valuemin": 0,
|
|
10
|
+
"aria-valuemax": max,
|
|
11
|
+
"aria-valuenow": indeterminate ? void 0 : value,
|
|
12
|
+
className: cx("uix-progress", indeterminate && "uix-progress--indeterminate", className),
|
|
13
|
+
...props,
|
|
14
|
+
children: /* @__PURE__ */ jsx("div", { className: "uix-progress__bar", style: indeterminate ? void 0 : { width: `${pct}%` } })
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
Progress
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ProseProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Long-form content container over `.uix-prose` (KB articles, descriptions,
|
|
9
|
+
* release notes). Apply to a block of rendered HTML/markdown.
|
|
10
|
+
*/
|
|
11
|
+
declare function Prose({ children, className, ...props }: ProseProps): react.JSX.Element;
|
|
12
|
+
type NoteTone = 'info' | 'success' | 'warning' | 'danger';
|
|
13
|
+
interface NoteProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
tone?: NoteTone;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** Callout / note box over `.uix-note`. */
|
|
19
|
+
declare function Note({ tone, icon, children, className, ...props }: NoteProps): react.JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { Note, type NoteProps, type NoteTone, Prose, type ProseProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Prose({ children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-prose", className), ...props, children });
|
|
5
|
+
}
|
|
6
|
+
function Note({ tone, icon, children, className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-note", tone && `uix-note--${tone}`, className), ...props, children: [
|
|
8
|
+
icon != null && /* @__PURE__ */ jsx("div", { className: "uix-note__icon", children: icon }),
|
|
9
|
+
/* @__PURE__ */ jsx("div", { className: "uix-note__body", children })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
Note,
|
|
14
|
+
Prose
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
8
|
+
interface RadioGroupProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function RadioGroup({ children, className }: RadioGroupProps): react.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
const Radio = forwardRef(
|
|
5
|
+
({ label, className, ...props }, ref) => /* @__PURE__ */ jsxs("label", { className: cx("uix-radio", className), children: [
|
|
6
|
+
/* @__PURE__ */ jsx("input", { type: "radio", ref, ...props }),
|
|
7
|
+
/* @__PURE__ */ jsx("span", { className: "uix-radio__dot" }),
|
|
8
|
+
label
|
|
9
|
+
] })
|
|
10
|
+
);
|
|
11
|
+
Radio.displayName = "Radio";
|
|
12
|
+
function RadioGroup({ children, className }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-radio-group", className), children });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
Radio,
|
|
17
|
+
RadioGroup
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { SelectHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
5
|
+
size?: 'sm' | 'md';
|
|
6
|
+
}
|
|
7
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
8
|
+
|
|
9
|
+
export { Select, type SelectProps };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
const Select = forwardRef(
|
|
5
|
+
({ size = "md", className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
"select",
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: cx("uix-select", size === "sm" && "uix-select--sm", className),
|
|
10
|
+
...props
|
|
11
|
+
}
|
|
12
|
+
)
|
|
13
|
+
);
|
|
14
|
+
Select.displayName = "Select";
|
|
15
|
+
export {
|
|
16
|
+
Select
|
|
17
|
+
};
|