@uipath/apollo-wind 0.10.0 → 0.11.0-pr295.af4e744
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/components/custom/canvas-studio.cjs +133 -0
- package/dist/components/custom/canvas-studio.d.ts +99 -0
- package/dist/components/custom/canvas-studio.js +93 -0
- package/dist/components/custom/canvas.cjs +44 -0
- package/dist/components/custom/canvas.d.ts +14 -0
- package/dist/components/custom/canvas.js +10 -0
- package/dist/components/custom/chat-composer.cjs +105 -0
- package/dist/components/custom/chat-composer.d.ts +15 -0
- package/dist/components/custom/chat-composer.js +71 -0
- package/dist/components/custom/chat-first-experience.cjs +87 -0
- package/dist/components/custom/chat-first-experience.d.ts +24 -0
- package/dist/components/custom/chat-first-experience.js +53 -0
- package/dist/components/custom/chat-prompt-suggestions.cjs +49 -0
- package/dist/components/custom/chat-prompt-suggestions.d.ts +18 -0
- package/dist/components/custom/chat-prompt-suggestions.js +15 -0
- package/dist/components/custom/chat-steps-view.cjs +308 -0
- package/dist/components/custom/chat-steps-view.d.ts +38 -0
- package/dist/components/custom/chat-steps-view.js +274 -0
- package/dist/components/custom/flow-node.cjs +76 -0
- package/dist/components/custom/flow-node.d.ts +20 -0
- package/dist/components/custom/flow-node.js +42 -0
- package/dist/components/custom/flow-properties-bar.cjs +103 -0
- package/dist/components/custom/flow-properties-bar.d.ts +21 -0
- package/dist/components/custom/flow-properties-bar.js +69 -0
- package/dist/components/custom/flow-properties-expanded.cjs +328 -0
- package/dist/components/custom/flow-properties-expanded.d.ts +21 -0
- package/dist/components/custom/flow-properties-expanded.js +294 -0
- package/dist/components/custom/flow-properties-simple.cjs +364 -0
- package/dist/components/custom/flow-properties-simple.d.ts +62 -0
- package/dist/components/custom/flow-properties-simple.js +330 -0
- package/dist/components/custom/flow-properties.cjs +56 -0
- package/dist/components/custom/flow-properties.d.ts +28 -0
- package/dist/components/custom/flow-properties.js +22 -0
- package/dist/components/custom/global-header.cjs +422 -0
- package/dist/components/custom/global-header.d.ts +38 -0
- package/dist/components/custom/global-header.js +388 -0
- package/dist/components/custom/grid-maestro.cjs +62 -0
- package/dist/components/custom/grid-maestro.d.ts +19 -0
- package/dist/components/custom/grid-maestro.js +22 -0
- package/dist/components/custom/page-header.cjs +92 -0
- package/dist/components/custom/page-header.d.ts +43 -0
- package/dist/components/custom/page-header.js +58 -0
- package/dist/components/custom/panel-delegate.cjs +285 -0
- package/dist/components/custom/panel-delegate.d.ts +34 -0
- package/dist/components/custom/panel-delegate.js +251 -0
- package/dist/components/custom/panel-flow.cjs +262 -0
- package/dist/components/custom/panel-flow.d.ts +38 -0
- package/dist/components/custom/panel-flow.js +225 -0
- package/dist/components/custom/panel-maestro.cjs +74 -0
- package/dist/components/custom/panel-maestro.d.ts +30 -0
- package/dist/components/custom/panel-maestro.js +40 -0
- package/dist/components/custom/panel-studio.cjs +122 -0
- package/dist/components/custom/panel-studio.d.ts +48 -0
- package/dist/components/custom/panel-studio.js +85 -0
- package/dist/components/custom/toolbar-canvas.cjs +124 -0
- package/dist/components/custom/toolbar-canvas.d.ts +15 -0
- package/dist/components/custom/toolbar-canvas.js +90 -0
- package/dist/components/custom/toolbar-view.cjs +121 -0
- package/dist/components/custom/toolbar-view.d.ts +14 -0
- package/dist/components/custom/toolbar-view.js +87 -0
- package/dist/components/custom/viewport-guard.cjs +92 -0
- package/dist/components/custom/viewport-guard.d.ts +23 -0
- package/dist/components/custom/viewport-guard.js +55 -0
- package/dist/components/forms/field-renderer.cjs +3 -1
- package/dist/components/forms/field-renderer.js +3 -1
- package/dist/components/forms/form-designer.cjs +13 -2
- package/dist/components/forms/form-designer.js +13 -2
- package/dist/components/forms/rules-engine.d.ts +1 -1
- package/dist/components/ui/breadcrumb.cjs +1 -2
- package/dist/components/ui/breadcrumb.js +1 -2
- package/dist/components/ui/button-group.cjs +5 -3
- package/dist/components/ui/button-group.d.ts +2 -2
- package/dist/components/ui/button-group.js +5 -3
- package/dist/components/ui/button.cjs +3 -3
- package/dist/components/ui/button.js +3 -3
- package/dist/components/ui/chart.cjs +223 -0
- package/dist/components/ui/chart.d.ts +40 -0
- package/dist/components/ui/chart.js +174 -0
- package/dist/components/ui/code-block.cjs +258 -0
- package/dist/components/ui/code-block.d.ts +48 -0
- package/dist/components/ui/code-block.js +207 -0
- package/dist/components/ui/data-table.cjs +22 -4
- package/dist/components/ui/data-table.d.ts +5 -2
- package/dist/components/ui/data-table.js +23 -5
- package/dist/components/ui/editable-cell.cjs +3 -10
- package/dist/components/ui/editable-cell.js +3 -10
- package/dist/components/ui/empty-state.cjs +17 -6
- package/dist/components/ui/empty-state.d.ts +7 -0
- package/dist/components/ui/empty-state.js +17 -6
- package/dist/components/ui/file-upload.cjs +8 -0
- package/dist/components/ui/file-upload.js +8 -0
- package/dist/components/ui/index.cjs +289 -149
- package/dist/components/ui/index.d.ts +2 -3
- package/dist/components/ui/index.js +2 -3
- package/dist/components/ui/multi-select.cjs +3 -10
- package/dist/components/ui/multi-select.js +3 -10
- package/dist/components/ui/pagination.cjs +0 -1
- package/dist/components/ui/pagination.js +0 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/tree-view.cjs +1117 -0
- package/dist/components/ui/tree-view.d.ts +95 -0
- package/dist/components/ui/tree-view.js +1083 -0
- package/dist/foundation/Future/colors.cjs +92 -0
- package/dist/foundation/Future/colors.d.ts +132 -0
- package/dist/foundation/Future/colors.js +43 -0
- package/dist/foundation/Future/radius.cjs +46 -0
- package/dist/foundation/Future/radius.d.ts +33 -0
- package/dist/foundation/Future/radius.js +12 -0
- package/dist/foundation/Future/responsive.cjs +49 -0
- package/dist/foundation/Future/responsive.d.ts +40 -0
- package/dist/foundation/Future/responsive.js +12 -0
- package/dist/foundation/Future/shadows.cjs +48 -0
- package/dist/foundation/Future/shadows.d.ts +29 -0
- package/dist/foundation/Future/shadows.js +11 -0
- package/dist/foundation/Future/spacing.cjs +71 -0
- package/dist/foundation/Future/spacing.d.ts +80 -0
- package/dist/foundation/Future/spacing.js +31 -0
- package/dist/foundation/Future/strokes.cjs +59 -0
- package/dist/foundation/Future/strokes.d.ts +49 -0
- package/dist/foundation/Future/strokes.js +19 -0
- package/dist/foundation/Future/types.cjs +18 -0
- package/dist/foundation/Future/types.d.ts +25 -0
- package/dist/foundation/Future/types.js +0 -0
- package/dist/foundation/Future/typography.cjs +79 -0
- package/dist/foundation/Future/typography.d.ts +86 -0
- package/dist/foundation/Future/typography.js +33 -0
- package/dist/index.cjs +131 -221
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -4
- package/dist/src/foundation/Future/themes.css +279 -0
- package/dist/styles.css +1941 -605
- package/dist/tailwind.css +874 -87
- package/dist/templates/Admin/settings-admin.d.ts +5 -0
- package/dist/templates/Admin/template-admin.d.ts +86 -0
- package/dist/templates/Delegate/template-delegate.d.ts +26 -0
- package/dist/templates/EmptyErrors/error-components.d.ts +3 -0
- package/dist/templates/Experiments/ideas-AnimatedGradientText.d.ts +23 -0
- package/dist/templates/Flow/template-flow.d.ts +57 -0
- package/dist/templates/Maestro/template-maestro.d.ts +52 -0
- package/dist/templates/Studio/template-studio.d.ts +102 -0
- package/dist/templates/{vscode-example.d.ts → VisualStudio/shell.d.ts} +1 -1
- package/package.json +12 -1
- package/dist/components/ui/menubar.cjs +0 -210
- package/dist/components/ui/menubar.d.ts +0 -28
- package/dist/components/ui/menubar.js +0 -131
- package/dist/components/ui/navigation-menu.cjs +0 -122
- package/dist/components/ui/navigation-menu.d.ts +0 -12
- package/dist/components/ui/navigation-menu.js +0 -64
- package/dist/examples/admin-layout-example.cjs +0 -490
- package/dist/examples/admin-layout-example.d.ts +0 -92
- package/dist/examples/admin-layout-example.js +0 -411
- package/dist/examples/app-shell-example.cjs +0 -452
- package/dist/examples/app-shell-example.d.ts +0 -52
- package/dist/examples/app-shell-example.js +0 -418
- package/dist/examples/dashboard-example.cjs +0 -590
- package/dist/examples/dashboard-example.d.ts +0 -11
- package/dist/examples/dashboard-example.js +0 -556
- package/dist/examples/data-management-example.cjs +0 -584
- package/dist/examples/data-management-example.d.ts +0 -1
- package/dist/examples/data-management-example.js +0 -550
- package/dist/examples/flow-editor-layout-example.cjs +0 -309
- package/dist/examples/flow-editor-layout-example.d.ts +0 -22
- package/dist/examples/flow-editor-layout-example.js +0 -269
- package/dist/examples/flow-start-example.cjs +0 -467
- package/dist/examples/flow-start-example.d.ts +0 -30
- package/dist/examples/flow-start-example.js +0 -433
- package/dist/examples/form-builder-example.cjs +0 -674
- package/dist/examples/form-builder-example.js +0 -640
- package/dist/examples/new-project-example.cjs +0 -550
- package/dist/examples/new-project-example.d.ts +0 -30
- package/dist/examples/new-project-example.js +0 -516
- package/dist/examples/settings-example.cjs +0 -864
- package/dist/examples/settings-example.d.ts +0 -1
- package/dist/examples/settings-example.js +0 -830
- package/dist/examples/vscode-example.cjs +0 -340
- package/dist/examples/vscode-example.d.ts +0 -80
- package/dist/examples/vscode-example.js +0 -270
- package/dist/templates/admin-layout-example.d.ts +0 -92
- package/dist/templates/app-shell-example.d.ts +0 -52
- package/dist/templates/dashboard-example.d.ts +0 -11
- package/dist/templates/data-management-example.d.ts +0 -1
- package/dist/templates/flow-editor-layout-example.d.ts +0 -22
- package/dist/templates/flow-start-example.d.ts +0 -30
- package/dist/templates/form-builder-example.d.ts +0 -1
- package/dist/templates/new-project-example.d.ts +0 -30
- package/dist/templates/settings-example.d.ts +0 -1
- /package/dist/{examples → templates/Forms}/form-builder-example.d.ts +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ChartContainer: ()=>ChartContainer,
|
|
28
|
+
ChartLegend: ()=>ChartLegend,
|
|
29
|
+
ChartTooltipContent: ()=>ChartTooltipContent,
|
|
30
|
+
ChartLegendContent: ()=>ChartLegendContent,
|
|
31
|
+
ChartTooltip: ()=>ChartTooltip,
|
|
32
|
+
ChartStyle: ()=>ChartStyle
|
|
33
|
+
});
|
|
34
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
35
|
+
const external_react_namespaceObject = require("react");
|
|
36
|
+
const external_recharts_namespaceObject = require("recharts");
|
|
37
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
38
|
+
const THEMES = {
|
|
39
|
+
light: ':is(.light, .light-hc, .future-light)',
|
|
40
|
+
dark: ':is(.dark, .dark-hc, .future-dark, .wireframe, .vertex, .canvas)'
|
|
41
|
+
};
|
|
42
|
+
const ChartContext = /*#__PURE__*/ external_react_namespaceObject.createContext(null);
|
|
43
|
+
function useChart() {
|
|
44
|
+
const context = external_react_namespaceObject.useContext(ChartContext);
|
|
45
|
+
if (!context) throw new Error('useChart must be used within a <ChartContainer />');
|
|
46
|
+
return context;
|
|
47
|
+
}
|
|
48
|
+
function ChartContainer({ id, className, children, config, ...props }) {
|
|
49
|
+
const uniqueId = external_react_namespaceObject.useId();
|
|
50
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
|
|
51
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ChartContext.Provider, {
|
|
52
|
+
value: {
|
|
53
|
+
config
|
|
54
|
+
},
|
|
55
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
56
|
+
"data-slot": "chart",
|
|
57
|
+
"data-chart": chartId,
|
|
58
|
+
className: (0, index_cjs_namespaceObject.cn)("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
59
|
+
...props,
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ChartStyle, {
|
|
62
|
+
id: chartId,
|
|
63
|
+
config: config
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_recharts_namespaceObject.ResponsiveContainer, {
|
|
66
|
+
children: children
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const sanitizeCssToken = (value)=>value.replace(/[^a-z0-9-]/gi, '');
|
|
73
|
+
const ChartStyle = ({ id, config })=>{
|
|
74
|
+
const colorConfig = Object.entries(config).filter(([, itemConfig])=>itemConfig.theme || itemConfig.color);
|
|
75
|
+
if (!colorConfig.length) return null;
|
|
76
|
+
const safeId = sanitizeCssToken(id);
|
|
77
|
+
const css = Object.entries(THEMES).map(([theme, selectors])=>{
|
|
78
|
+
const lines = colorConfig.map(([key, itemConfig])=>{
|
|
79
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
80
|
+
const safeKey = sanitizeCssToken(key);
|
|
81
|
+
if (!color || !safeKey) return null;
|
|
82
|
+
return ` --color-${safeKey}: ${color};`;
|
|
83
|
+
}).filter(Boolean).join('\n');
|
|
84
|
+
if (!lines) return '';
|
|
85
|
+
return `${selectors} [data-chart="${safeId}"] {\n${lines}\n}`;
|
|
86
|
+
}).filter(Boolean).join('\n');
|
|
87
|
+
if (!css) return null;
|
|
88
|
+
const sanitizedCss = css.replace(/<\//g, '\\3c /');
|
|
89
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("style", {
|
|
90
|
+
children: sanitizedCss
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const ChartTooltip = external_recharts_namespaceObject.Tooltip;
|
|
94
|
+
function ChartTooltipContent({ active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
95
|
+
const { config } = useChart();
|
|
96
|
+
const tooltipLabel = external_react_namespaceObject.useMemo(()=>{
|
|
97
|
+
if (hideLabel || !payload?.length) return null;
|
|
98
|
+
const [item] = payload;
|
|
99
|
+
const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
|
|
100
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
101
|
+
const value = labelKey || 'string' != typeof label ? itemConfig?.label : config[label]?.label || label;
|
|
102
|
+
if (labelFormatter) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
103
|
+
className: (0, index_cjs_namespaceObject.cn)('font-medium', labelClassName),
|
|
104
|
+
children: labelFormatter(value, payload)
|
|
105
|
+
});
|
|
106
|
+
if (!value) return null;
|
|
107
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
108
|
+
className: (0, index_cjs_namespaceObject.cn)('font-medium', labelClassName),
|
|
109
|
+
children: value
|
|
110
|
+
});
|
|
111
|
+
}, [
|
|
112
|
+
label,
|
|
113
|
+
labelFormatter,
|
|
114
|
+
payload,
|
|
115
|
+
hideLabel,
|
|
116
|
+
labelClassName,
|
|
117
|
+
config,
|
|
118
|
+
labelKey
|
|
119
|
+
]);
|
|
120
|
+
if (!active || !payload?.length) return null;
|
|
121
|
+
const nestLabel = 1 === payload.length && 'dot' !== indicator;
|
|
122
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
123
|
+
className: (0, index_cjs_namespaceObject.cn)('border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl', className),
|
|
124
|
+
children: [
|
|
125
|
+
nestLabel ? null : tooltipLabel,
|
|
126
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
127
|
+
className: "grid gap-1.5",
|
|
128
|
+
children: payload.filter((item)=>'none' !== item.type).map((item, index)=>{
|
|
129
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
130
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
131
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
132
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
133
|
+
className: (0, index_cjs_namespaceObject.cn)('[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5', 'dot' === indicator && 'items-center'),
|
|
134
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
135
|
+
children: [
|
|
136
|
+
itemConfig?.icon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(itemConfig.icon, {}) : !hideIndicator && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
137
|
+
className: (0, index_cjs_namespaceObject.cn)('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {
|
|
138
|
+
'h-2.5 w-2.5': 'dot' === indicator,
|
|
139
|
+
'w-1': 'line' === indicator,
|
|
140
|
+
'w-0 border-[1.5px] border-dashed bg-transparent': 'dashed' === indicator,
|
|
141
|
+
'my-0.5': nestLabel && 'dashed' === indicator
|
|
142
|
+
}),
|
|
143
|
+
style: {
|
|
144
|
+
'--color-bg': indicatorColor,
|
|
145
|
+
'--color-border': indicatorColor
|
|
146
|
+
}
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
149
|
+
className: (0, index_cjs_namespaceObject.cn)('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'),
|
|
150
|
+
children: [
|
|
151
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
152
|
+
className: "grid gap-1.5",
|
|
153
|
+
children: [
|
|
154
|
+
nestLabel ? tooltipLabel : null,
|
|
155
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
156
|
+
className: "text-muted-foreground",
|
|
157
|
+
children: itemConfig?.label || item.name
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
null != item.value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
162
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
163
|
+
children: item.value.toLocaleString()
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
}, item.dataKey);
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const ChartLegend = external_recharts_namespaceObject.Legend;
|
|
176
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }) {
|
|
177
|
+
const { config } = useChart();
|
|
178
|
+
if (!payload?.length) return null;
|
|
179
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
180
|
+
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-center gap-4', 'top' === verticalAlign ? 'pb-3' : 'pt-3', className),
|
|
181
|
+
children: payload.filter((item)=>'none' !== item.type).map((item)=>{
|
|
182
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
183
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
184
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
185
|
+
className: (0, index_cjs_namespaceObject.cn)('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3'),
|
|
186
|
+
children: [
|
|
187
|
+
itemConfig?.icon && !hideIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(itemConfig.icon, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
188
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
189
|
+
style: {
|
|
190
|
+
backgroundColor: item.color
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
193
|
+
itemConfig?.label
|
|
194
|
+
]
|
|
195
|
+
}, item.value);
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
200
|
+
if ('object' != typeof payload || null === payload) return;
|
|
201
|
+
const payloadPayload = 'payload' in payload && 'object' == typeof payload.payload && null !== payload.payload ? payload.payload : void 0;
|
|
202
|
+
let configLabelKey = key;
|
|
203
|
+
if (key in payload && 'string' == typeof payload[key]) configLabelKey = payload[key];
|
|
204
|
+
else if (payloadPayload && key in payloadPayload && 'string' == typeof payloadPayload[key]) configLabelKey = payloadPayload[key];
|
|
205
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
206
|
+
}
|
|
207
|
+
exports.ChartContainer = __webpack_exports__.ChartContainer;
|
|
208
|
+
exports.ChartLegend = __webpack_exports__.ChartLegend;
|
|
209
|
+
exports.ChartLegendContent = __webpack_exports__.ChartLegendContent;
|
|
210
|
+
exports.ChartStyle = __webpack_exports__.ChartStyle;
|
|
211
|
+
exports.ChartTooltip = __webpack_exports__.ChartTooltip;
|
|
212
|
+
exports.ChartTooltipContent = __webpack_exports__.ChartTooltipContent;
|
|
213
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
214
|
+
"ChartContainer",
|
|
215
|
+
"ChartLegend",
|
|
216
|
+
"ChartLegendContent",
|
|
217
|
+
"ChartStyle",
|
|
218
|
+
"ChartTooltip",
|
|
219
|
+
"ChartTooltipContent"
|
|
220
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
221
|
+
Object.defineProperty(exports, '__esModule', {
|
|
222
|
+
value: true
|
|
223
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RechartsPrimitive from 'recharts';
|
|
3
|
+
declare const THEMES: {
|
|
4
|
+
readonly light: ":is(.light, .light-hc, .future-light)";
|
|
5
|
+
readonly dark: ":is(.dark, .dark-hc, .future-dark, .wireframe, .vertex, .canvas)";
|
|
6
|
+
};
|
|
7
|
+
export type ChartConfig = {
|
|
8
|
+
[k in string]: {
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
icon?: React.ComponentType;
|
|
11
|
+
} & ({
|
|
12
|
+
color?: string;
|
|
13
|
+
theme?: never;
|
|
14
|
+
} | {
|
|
15
|
+
color?: never;
|
|
16
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<'div'> & {
|
|
20
|
+
config: ChartConfig;
|
|
21
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare const ChartStyle: ({ id, config }: {
|
|
24
|
+
id: string;
|
|
25
|
+
config: ChartConfig;
|
|
26
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
27
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
28
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<'div'> & {
|
|
29
|
+
hideLabel?: boolean;
|
|
30
|
+
hideIndicator?: boolean;
|
|
31
|
+
indicator?: 'line' | 'dot' | 'dashed';
|
|
32
|
+
nameKey?: string;
|
|
33
|
+
labelKey?: string;
|
|
34
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
35
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
36
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<'div'> & Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
|
|
37
|
+
hideIcon?: boolean;
|
|
38
|
+
nameKey?: string;
|
|
39
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
40
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useId, useMemo } from "react";
|
|
3
|
+
import { Legend, ResponsiveContainer, Tooltip } from "recharts";
|
|
4
|
+
import { cn } from "../../lib/index.js";
|
|
5
|
+
const THEMES = {
|
|
6
|
+
light: ':is(.light, .light-hc, .future-light)',
|
|
7
|
+
dark: ':is(.dark, .dark-hc, .future-dark, .wireframe, .vertex, .canvas)'
|
|
8
|
+
};
|
|
9
|
+
const ChartContext = /*#__PURE__*/ createContext(null);
|
|
10
|
+
function useChart() {
|
|
11
|
+
const context = useContext(ChartContext);
|
|
12
|
+
if (!context) throw new Error('useChart must be used within a <ChartContainer />');
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
function ChartContainer({ id, className, children, config, ...props }) {
|
|
16
|
+
const uniqueId = useId();
|
|
17
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
|
|
18
|
+
return /*#__PURE__*/ jsx(ChartContext.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
config
|
|
21
|
+
},
|
|
22
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
23
|
+
"data-slot": "chart",
|
|
24
|
+
"data-chart": chartId,
|
|
25
|
+
className: cn("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
26
|
+
...props,
|
|
27
|
+
children: [
|
|
28
|
+
/*#__PURE__*/ jsx(ChartStyle, {
|
|
29
|
+
id: chartId,
|
|
30
|
+
config: config
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ jsx(ResponsiveContainer, {
|
|
33
|
+
children: children
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const sanitizeCssToken = (value)=>value.replace(/[^a-z0-9-]/gi, '');
|
|
40
|
+
const ChartStyle = ({ id, config })=>{
|
|
41
|
+
const colorConfig = Object.entries(config).filter(([, itemConfig])=>itemConfig.theme || itemConfig.color);
|
|
42
|
+
if (!colorConfig.length) return null;
|
|
43
|
+
const safeId = sanitizeCssToken(id);
|
|
44
|
+
const css = Object.entries(THEMES).map(([theme, selectors])=>{
|
|
45
|
+
const lines = colorConfig.map(([key, itemConfig])=>{
|
|
46
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
47
|
+
const safeKey = sanitizeCssToken(key);
|
|
48
|
+
if (!color || !safeKey) return null;
|
|
49
|
+
return ` --color-${safeKey}: ${color};`;
|
|
50
|
+
}).filter(Boolean).join('\n');
|
|
51
|
+
if (!lines) return '';
|
|
52
|
+
return `${selectors} [data-chart="${safeId}"] {\n${lines}\n}`;
|
|
53
|
+
}).filter(Boolean).join('\n');
|
|
54
|
+
if (!css) return null;
|
|
55
|
+
const sanitizedCss = css.replace(/<\//g, '\\3c /');
|
|
56
|
+
return /*#__PURE__*/ jsx("style", {
|
|
57
|
+
children: sanitizedCss
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const ChartTooltip = Tooltip;
|
|
61
|
+
function ChartTooltipContent({ active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
62
|
+
const { config } = useChart();
|
|
63
|
+
const tooltipLabel = useMemo(()=>{
|
|
64
|
+
if (hideLabel || !payload?.length) return null;
|
|
65
|
+
const [item] = payload;
|
|
66
|
+
const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
|
|
67
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
68
|
+
const value = labelKey || 'string' != typeof label ? itemConfig?.label : config[label]?.label || label;
|
|
69
|
+
if (labelFormatter) return /*#__PURE__*/ jsx("div", {
|
|
70
|
+
className: cn('font-medium', labelClassName),
|
|
71
|
+
children: labelFormatter(value, payload)
|
|
72
|
+
});
|
|
73
|
+
if (!value) return null;
|
|
74
|
+
return /*#__PURE__*/ jsx("div", {
|
|
75
|
+
className: cn('font-medium', labelClassName),
|
|
76
|
+
children: value
|
|
77
|
+
});
|
|
78
|
+
}, [
|
|
79
|
+
label,
|
|
80
|
+
labelFormatter,
|
|
81
|
+
payload,
|
|
82
|
+
hideLabel,
|
|
83
|
+
labelClassName,
|
|
84
|
+
config,
|
|
85
|
+
labelKey
|
|
86
|
+
]);
|
|
87
|
+
if (!active || !payload?.length) return null;
|
|
88
|
+
const nestLabel = 1 === payload.length && 'dot' !== indicator;
|
|
89
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
90
|
+
className: cn('border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl', className),
|
|
91
|
+
children: [
|
|
92
|
+
nestLabel ? null : tooltipLabel,
|
|
93
|
+
/*#__PURE__*/ jsx("div", {
|
|
94
|
+
className: "grid gap-1.5",
|
|
95
|
+
children: payload.filter((item)=>'none' !== item.type).map((item, index)=>{
|
|
96
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
97
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
98
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
99
|
+
return /*#__PURE__*/ jsx("div", {
|
|
100
|
+
className: cn('[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5', 'dot' === indicator && 'items-center'),
|
|
101
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /*#__PURE__*/ jsxs(Fragment, {
|
|
102
|
+
children: [
|
|
103
|
+
itemConfig?.icon ? /*#__PURE__*/ jsx(itemConfig.icon, {}) : !hideIndicator && /*#__PURE__*/ jsx("div", {
|
|
104
|
+
className: cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {
|
|
105
|
+
'h-2.5 w-2.5': 'dot' === indicator,
|
|
106
|
+
'w-1': 'line' === indicator,
|
|
107
|
+
'w-0 border-[1.5px] border-dashed bg-transparent': 'dashed' === indicator,
|
|
108
|
+
'my-0.5': nestLabel && 'dashed' === indicator
|
|
109
|
+
}),
|
|
110
|
+
style: {
|
|
111
|
+
'--color-bg': indicatorColor,
|
|
112
|
+
'--color-border': indicatorColor
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ jsxs("div", {
|
|
116
|
+
className: cn('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'),
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ jsxs("div", {
|
|
119
|
+
className: "grid gap-1.5",
|
|
120
|
+
children: [
|
|
121
|
+
nestLabel ? tooltipLabel : null,
|
|
122
|
+
/*#__PURE__*/ jsx("span", {
|
|
123
|
+
className: "text-muted-foreground",
|
|
124
|
+
children: itemConfig?.label || item.name
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
}),
|
|
128
|
+
null != item.value && /*#__PURE__*/ jsx("span", {
|
|
129
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
130
|
+
children: item.value.toLocaleString()
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
})
|
|
136
|
+
}, item.dataKey);
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const ChartLegend = Legend;
|
|
143
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }) {
|
|
144
|
+
const { config } = useChart();
|
|
145
|
+
if (!payload?.length) return null;
|
|
146
|
+
return /*#__PURE__*/ jsx("div", {
|
|
147
|
+
className: cn('flex items-center justify-center gap-4', 'top' === verticalAlign ? 'pb-3' : 'pt-3', className),
|
|
148
|
+
children: payload.filter((item)=>'none' !== item.type).map((item)=>{
|
|
149
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
150
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
151
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
152
|
+
className: cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3'),
|
|
153
|
+
children: [
|
|
154
|
+
itemConfig?.icon && !hideIcon ? /*#__PURE__*/ jsx(itemConfig.icon, {}) : /*#__PURE__*/ jsx("div", {
|
|
155
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
156
|
+
style: {
|
|
157
|
+
backgroundColor: item.color
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
itemConfig?.label
|
|
161
|
+
]
|
|
162
|
+
}, item.value);
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
167
|
+
if ('object' != typeof payload || null === payload) return;
|
|
168
|
+
const payloadPayload = 'payload' in payload && 'object' == typeof payload.payload && null !== payload.payload ? payload.payload : void 0;
|
|
169
|
+
let configLabelKey = key;
|
|
170
|
+
if (key in payload && 'string' == typeof payload[key]) configLabelKey = payload[key];
|
|
171
|
+
else if (payloadPayload && key in payloadPayload && 'string' == typeof payloadPayload[key]) configLabelKey = payloadPayload[key];
|
|
172
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
173
|
+
}
|
|
174
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|