@godxjp/ui 31.4.0 → 31.6.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/agent/START-HERE.md +6 -6
- package/agent/components/BranchScopePicker.json +5 -0
- package/agent/components/Cascader.json +1 -1
- package/agent/components/CodeBlock.json +7 -1
- package/agent/components/DataTable.json +2 -2
- package/agent/components/InfiniteQueryState.json +6 -1
- package/agent/components/OrgChart.json +59 -0
- package/agent/components/RangeTimeline.json +6 -0
- package/agent/components/RecordPicker.json +10 -0
- package/agent/components/Transfer.json +5 -0
- package/agent/components/Tree.json +21 -4
- package/agent/components/TreeSelect.json +1 -1
- package/agent/components-index.json +5 -0
- package/agent/components.json +123 -10
- package/agent/index.json +7 -7
- package/agent/llms.txt +7 -7
- package/agent/tokens.json +114 -0
- package/dist/components/data-display/code-block.js +90 -4
- package/dist/components/data-display/data-table.d.ts +3 -0
- package/dist/components/data-display/data-table.js +415 -370
- package/dist/components/data-display/index.d.ts +2 -0
- package/dist/components/data-display/index.js +2 -0
- package/dist/components/data-display/org-chart.d.ts +5 -0
- package/dist/components/data-display/org-chart.js +169 -0
- package/dist/components/data-display/range-timeline.d.ts +20 -0
- package/dist/components/data-display/range-timeline.js +217 -197
- package/dist/components/data-display/tree.js +179 -23
- package/dist/components/data-entry/branch-scope-picker.d.ts +1 -0
- package/dist/components/data-entry/branch-scope-picker.js +2 -1
- package/dist/components/data-entry/cascader.js +4 -5
- package/dist/components/data-entry/record-picker.d.ts +2 -0
- package/dist/components/data-entry/record-picker.js +22 -3
- package/dist/components/data-entry/transfer.d.ts +1 -1
- package/dist/components/data-entry/transfer.js +5 -2
- package/dist/components/data-entry/tree-select.js +14 -5
- package/dist/components/general/typography.d.ts +32 -0
- package/dist/components/general/typography.js +11 -2
- package/dist/components/query/infinite-query-state.d.ts +1 -1
- package/dist/components/query/infinite-query-state.js +2 -1
- package/dist/contracts/measurement.json +1 -1
- package/dist/i18n/messages/en.json +26 -2
- package/dist/i18n/messages/ja.json +17 -2
- package/dist/i18n/messages/vi.json +17 -2
- package/dist/lib/hooks.d.ts +8 -4
- package/dist/lib/hooks.js +5 -2
- package/dist/lib/tree.d.ts +23 -0
- package/dist/lib/tree.js +29 -0
- package/dist/props/components/data-display.prop.d.ts +72 -3
- package/dist/props/components/data-entry.prop.d.ts +31 -4
- package/dist/props/components/query.prop.d.ts +8 -1
- package/dist/props/registry.d.ts +63 -6
- package/dist/props/registry.js +90 -4
- package/dist/props/vocabulary/data.prop.d.ts +32 -2
- package/dist/props/vocabulary/index.d.ts +1 -1
- package/dist/styles/data-display-layout.css +225 -0
- package/dist/styles/layers.json +14 -1
- package/dist/styles/table-layout.css +16 -1
- package/dist/tokens/base.css +1 -0
- package/dist/tokens/components/org-chart.css +27 -0
- package/dist/tokens/components/tree.css +2 -0
- package/docs/FRAME-COVERAGE-REPORT.md +3 -2
- package/docs/data-display/code-block.tsx +27 -0
- package/docs/data-display/data-table/examples/server-paged.tsx +23 -0
- package/docs/data-display/data-table/index.md +2 -0
- package/docs/data-display/org-chart.tsx +165 -0
- package/docs/data-display/timeline.tsx +33 -0
- package/docs/data-display/tree.tsx +154 -0
- package/docs/data-entry/branch-scope-picker.tsx +6 -1
- package/docs/data-entry/record-picker.tsx +1 -0
- package/docs/data-entry/transfer.tsx +1 -0
- package/docs/i18n/messages/en.json +19 -0
- package/docs/i18n/messages/ja.json +18 -0
- package/docs/i18n/messages/vi.json +18 -0
- package/docs/navigation/tabs.tsx +17 -15
- package/docs/query/data-state.tsx +2 -4
- package/docs/query/infinite-query-state.tsx +5 -1
- package/docs/roadmap/tree-components.md +2 -1
- package/docs/showcase/table-view-tabs.tsx +1 -1
- package/package.json +2 -2
- package/scripts/ui-audit.mjs +15 -5
|
@@ -53,6 +53,8 @@ export { ChatBubble, ChatBubbleList } from "./chat-bubble.js";
|
|
|
53
53
|
export type { ChatBubbleListProp, ChatBubbleListProps, ChatBubblePlacementProp, ChatBubbleProp, ChatBubbleProps, ChatBubbleToneProp, ChatBubbleTypingProp, ChatBubbleVariantProp, ChatMessageProp, } from "./chat-bubble.js";
|
|
54
54
|
export { Tree } from "./tree.js";
|
|
55
55
|
export type { TreeNodeProp, TreeProp, TreeProps } from "./tree.js";
|
|
56
|
+
export { OrgChart } from "./org-chart.js";
|
|
57
|
+
export type { OrgChartNodeProp, OrgChartNodeVariantProp, OrgChartProp, OrgChartProps, } from "./org-chart.js";
|
|
56
58
|
export { Welcome } from "./welcome.js";
|
|
57
59
|
export type { WelcomeProp, WelcomeProps, WelcomeVariantProp } from "./welcome.js";
|
|
58
60
|
export { ThoughtChain, ThoughtChainItem } from "./thought-chain.js";
|
|
@@ -60,6 +60,7 @@ import { PermissionMatrix } from "./permission-matrix.js";
|
|
|
60
60
|
import { RangeTimeline } from "./range-timeline.js";
|
|
61
61
|
import { ChatBubble, ChatBubbleList } from "./chat-bubble.js";
|
|
62
62
|
import { Tree } from "./tree.js";
|
|
63
|
+
import { OrgChart } from "./org-chart.js";
|
|
63
64
|
import { Welcome } from "./welcome.js";
|
|
64
65
|
import { ThoughtChain, ThoughtChainItem } from "./thought-chain.js";
|
|
65
66
|
export {
|
|
@@ -103,6 +104,7 @@ export {
|
|
|
103
104
|
Legend,
|
|
104
105
|
ListRow,
|
|
105
106
|
Marquee,
|
|
107
|
+
OrgChart,
|
|
106
108
|
PermissionMatrix,
|
|
107
109
|
Popover,
|
|
108
110
|
PopoverAnchor,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { OrgChartProp } from "../../props/components/data-display.prop.js";
|
|
3
|
+
export type { OrgChartNodeProp, OrgChartNodeVariantProp, OrgChartProp, OrgChartProp as OrgChartProps, } from "../../props/components/data-display.prop.js";
|
|
4
|
+
/** `ref` reaches the root `<div>` — the container the breakpoint is measured against. */
|
|
5
|
+
export declare const OrgChart: React.ForwardRefExoticComponent<OrgChartProp & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useTranslation } from "../../i18n/use-translation.js";
|
|
5
|
+
import { useScrollsHorizontally } from "../../lib/hooks.js";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { Tree } from "./tree.js";
|
|
8
|
+
function flatten(nodes) {
|
|
9
|
+
const out = [];
|
|
10
|
+
const walk = (list, depth, parent) => {
|
|
11
|
+
for (const node of list) {
|
|
12
|
+
const index = out.length;
|
|
13
|
+
out.push({ node, depth, parent, firstChild: null });
|
|
14
|
+
if (node.children?.length) {
|
|
15
|
+
out[index].firstChild = out.length;
|
|
16
|
+
walk(node.children, depth + 1, index);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
walk(nodes, 0, null);
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
function toTreeData(nodes) {
|
|
24
|
+
return nodes.map((node) => ({
|
|
25
|
+
value: node.key,
|
|
26
|
+
label: node.name,
|
|
27
|
+
children: node.children?.length ? toTreeData(node.children) : void 0
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
function isRtl(element) {
|
|
31
|
+
return element.closest("[dir]")?.getAttribute("dir")?.toLowerCase() === "rtl";
|
|
32
|
+
}
|
|
33
|
+
function OrgChartRoot({
|
|
34
|
+
data,
|
|
35
|
+
renderNode,
|
|
36
|
+
label,
|
|
37
|
+
className,
|
|
38
|
+
id,
|
|
39
|
+
forwardedRef,
|
|
40
|
+
...rest
|
|
41
|
+
}) {
|
|
42
|
+
const { t } = useTranslation();
|
|
43
|
+
const reactId = React.useId();
|
|
44
|
+
const baseId = id ?? `${reactId}-org-chart`;
|
|
45
|
+
const treeLabel = label ?? t("dataDisplay.orgChart.label");
|
|
46
|
+
const flat = React.useMemo(() => flatten(data), [data]);
|
|
47
|
+
const indexByKey = React.useMemo(
|
|
48
|
+
() => new Map(flat.map((entry, index) => [entry.node.key, index])),
|
|
49
|
+
[flat]
|
|
50
|
+
);
|
|
51
|
+
const scrollRef = React.useRef(null);
|
|
52
|
+
const scrolls = useScrollsHorizontally(scrollRef, true);
|
|
53
|
+
const [activeKey, setActiveKey] = React.useState(null);
|
|
54
|
+
const rovingKey = (activeKey && indexByKey.has(activeKey) ? activeKey : null) ?? flat[0]?.node.key ?? null;
|
|
55
|
+
const nodeRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
56
|
+
const moveTo = (index) => {
|
|
57
|
+
if (index == null) return;
|
|
58
|
+
const entry = flat[index];
|
|
59
|
+
if (!entry) return;
|
|
60
|
+
setActiveKey(entry.node.key);
|
|
61
|
+
nodeRefs.current.get(entry.node.key)?.focus();
|
|
62
|
+
};
|
|
63
|
+
const onKeyDown = (event, index) => {
|
|
64
|
+
const entry = flat[index];
|
|
65
|
+
const rtl = isRtl(event.currentTarget);
|
|
66
|
+
const inward = rtl ? "ArrowLeft" : "ArrowRight";
|
|
67
|
+
const outward = rtl ? "ArrowRight" : "ArrowLeft";
|
|
68
|
+
let target;
|
|
69
|
+
if (event.key === "ArrowDown") target = index + 1 < flat.length ? index + 1 : null;
|
|
70
|
+
else if (event.key === "ArrowUp") target = index > 0 ? index - 1 : null;
|
|
71
|
+
else if (event.key === "Home") target = 0;
|
|
72
|
+
else if (event.key === "End") target = flat.length - 1;
|
|
73
|
+
else if (event.key === inward) target = entry.firstChild;
|
|
74
|
+
else if (event.key === outward) target = entry.parent;
|
|
75
|
+
else return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
moveTo(target ?? null);
|
|
78
|
+
};
|
|
79
|
+
const renderBranch = (nodes) => nodes.map((node, position) => {
|
|
80
|
+
const index = indexByKey.get(node.key);
|
|
81
|
+
const { depth } = flat[index];
|
|
82
|
+
const nodeId = `${baseId}-n${index}`;
|
|
83
|
+
const groupId = `${nodeId}-group`;
|
|
84
|
+
const hasChildren = Boolean(node.children?.length);
|
|
85
|
+
const isAgent = node.variant === "agent";
|
|
86
|
+
const labelledBy = renderNode ? void 0 : [
|
|
87
|
+
`${nodeId}-name`,
|
|
88
|
+
node.title ? `${nodeId}-title` : null,
|
|
89
|
+
isAgent ? `${nodeId}-kind` : null
|
|
90
|
+
].filter(Boolean).join(" ");
|
|
91
|
+
return /* @__PURE__ */ jsxs("li", { role: "none", className: "ui-org-chart-branch", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
ref: (element) => {
|
|
96
|
+
nodeRefs.current.set(node.key, element);
|
|
97
|
+
},
|
|
98
|
+
id: nodeId,
|
|
99
|
+
role: "treeitem",
|
|
100
|
+
"aria-level": depth + 1,
|
|
101
|
+
"aria-setsize": nodes.length,
|
|
102
|
+
"aria-posinset": position + 1,
|
|
103
|
+
"aria-labelledby": labelledBy,
|
|
104
|
+
"aria-describedby": !renderNode && node.extra ? `${nodeId}-extra` : void 0,
|
|
105
|
+
"aria-owns": hasChildren ? groupId : void 0,
|
|
106
|
+
tabIndex: rovingKey === node.key ? 0 : -1,
|
|
107
|
+
"data-key": node.key,
|
|
108
|
+
"data-variant": isAgent ? "agent" : "person",
|
|
109
|
+
className: "ui-org-chart-node ui-focus-ring",
|
|
110
|
+
onFocus: () => setActiveKey(node.key),
|
|
111
|
+
onKeyDown: (event) => onKeyDown(event, index),
|
|
112
|
+
children: [
|
|
113
|
+
renderNode ? renderNode(node) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
node.avatar ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ui-org-chart-avatar", children: node.avatar }) : null,
|
|
115
|
+
/* @__PURE__ */ jsxs("span", { className: "ui-org-chart-text", children: [
|
|
116
|
+
/* @__PURE__ */ jsx("span", { id: `${nodeId}-name`, className: "ui-org-chart-name", children: node.name }),
|
|
117
|
+
node.title ? /* @__PURE__ */ jsx("span", { id: `${nodeId}-title`, className: "ui-org-chart-title", children: node.title }) : null,
|
|
118
|
+
node.extra ? /* @__PURE__ */ jsx("span", { id: `${nodeId}-extra`, className: "ui-org-chart-extra", children: node.extra }) : null
|
|
119
|
+
] })
|
|
120
|
+
] }),
|
|
121
|
+
isAgent ? /* @__PURE__ */ jsx("span", { id: `${nodeId}-kind`, className: "sr-only", children: t("dataDisplay.orgChart.agent") }) : null
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
hasChildren ? /* @__PURE__ */ jsx("ul", { id: groupId, role: "group", className: "ui-org-chart-children", children: renderBranch(node.children) }) : null
|
|
126
|
+
] }, node.key);
|
|
127
|
+
});
|
|
128
|
+
const treeData = React.useMemo(() => toTreeData(data), [data]);
|
|
129
|
+
const nodeByKey = React.useMemo(
|
|
130
|
+
() => new Map(flat.map((entry) => [entry.node.key, entry.node])),
|
|
131
|
+
[flat]
|
|
132
|
+
);
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref: forwardedRef, id, className: cn("ui-org-chart", className), children: [
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: scrollRef,
|
|
138
|
+
className: "ui-org-chart-scroll",
|
|
139
|
+
...scrolls ? { role: "region", "aria-label": t("dataDisplay.orgChart.scrollRegion"), tabIndex: 0 } : {},
|
|
140
|
+
children: /* @__PURE__ */ jsx("ul", { role: "tree", "aria-label": treeLabel, className: "ui-org-chart-tree", children: renderBranch(data) })
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: "ui-org-chart-list", children: /* @__PURE__ */ jsx(
|
|
144
|
+
Tree,
|
|
145
|
+
{
|
|
146
|
+
"aria-label": treeLabel,
|
|
147
|
+
treeData,
|
|
148
|
+
defaultExpandAll: true,
|
|
149
|
+
titleRender: (treeNode) => {
|
|
150
|
+
const node = nodeByKey.get(treeNode.value);
|
|
151
|
+
if (!node) return treeNode.label;
|
|
152
|
+
if (renderNode) return renderNode(node);
|
|
153
|
+
return /* @__PURE__ */ jsxs("span", { className: "ui-org-chart-list-row", children: [
|
|
154
|
+
node.avatar ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ui-org-chart-avatar", children: node.avatar }) : null,
|
|
155
|
+
/* @__PURE__ */ jsx("span", { className: "ui-org-chart-name", children: node.name }),
|
|
156
|
+
node.title ? /* @__PURE__ */ jsx("span", { className: "ui-org-chart-title", children: node.title }) : null,
|
|
157
|
+
node.variant === "agent" ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: t("dataDisplay.orgChart.agent") }) : null,
|
|
158
|
+
node.extra ? /* @__PURE__ */ jsx("span", { className: "ui-org-chart-extra", children: node.extra }) : null
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
) })
|
|
163
|
+
] });
|
|
164
|
+
}
|
|
165
|
+
const OrgChart = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(OrgChartRoot, { ...props, forwardedRef: ref }));
|
|
166
|
+
OrgChart.displayName = "OrgChart";
|
|
167
|
+
export {
|
|
168
|
+
OrgChart
|
|
169
|
+
};
|
|
@@ -53,6 +53,16 @@ export type RangeTimelineProps = React.HTMLAttributes<HTMLElement> & {
|
|
|
53
53
|
defaultExpandedValues?: readonly string[];
|
|
54
54
|
/** Fires with the next expanded parent ids, for controlled and uncontrolled timelines alike. */
|
|
55
55
|
onExpandedValuesChange?: (values: string[]) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Keep the axis header (bands + ticks) on screen while the PAGE scrolls a long schedule — antd
|
|
58
|
+
* Table `sticky`. `offsetHeader` is the distance in px from the top of the scrolling viewport,
|
|
59
|
+
* e.g. the height of a fixed app topbar. The header then scrolls horizontally with the body.
|
|
60
|
+
* Needs no clipping ancestor (e.g. `Card`, which is `overflow: hidden`) between it and the page
|
|
61
|
+
* scroller. antd's `offsetScroll` / `getContainer` (a sticky horizontal scrollbar) are not ported.
|
|
62
|
+
*/
|
|
63
|
+
sticky?: boolean | {
|
|
64
|
+
offsetHeader?: number;
|
|
65
|
+
};
|
|
56
66
|
};
|
|
57
67
|
/** A horizontal range axis. Units and labels are data; the design system owns all geometry. */
|
|
58
68
|
export declare const RangeTimeline: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
@@ -94,4 +104,14 @@ export declare const RangeTimeline: React.ForwardRefExoticComponent<React.HTMLAt
|
|
|
94
104
|
defaultExpandedValues?: readonly string[];
|
|
95
105
|
/** Fires with the next expanded parent ids, for controlled and uncontrolled timelines alike. */
|
|
96
106
|
onExpandedValuesChange?: (values: string[]) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Keep the axis header (bands + ticks) on screen while the PAGE scrolls a long schedule — antd
|
|
109
|
+
* Table `sticky`. `offsetHeader` is the distance in px from the top of the scrolling viewport,
|
|
110
|
+
* e.g. the height of a fixed app topbar. The header then scrolls horizontally with the body.
|
|
111
|
+
* Needs no clipping ancestor (e.g. `Card`, which is `overflow: hidden`) between it and the page
|
|
112
|
+
* scroller. antd's `offsetScroll` / `getContainer` (a sticky horizontal scrollbar) are not ported.
|
|
113
|
+
*/
|
|
114
|
+
sticky?: boolean | {
|
|
115
|
+
offsetHeader?: number;
|
|
116
|
+
};
|
|
97
117
|
} & React.RefAttributes<HTMLElement>>;
|