@uipath/apollo-wind 0.9.1 → 0.10.0-pr219.61d64eb
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.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 +48 -0
- package/dist/components/custom/chat-prompt-suggestions.d.ts +18 -0
- package/dist/components/custom/chat-prompt-suggestions.js +14 -0
- package/dist/components/custom/chat-steps-view.cjs +307 -0
- package/dist/components/custom/chat-steps-view.d.ts +38 -0
- package/dist/components/custom/chat-steps-view.js +273 -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 +101 -0
- package/dist/components/custom/flow-properties-bar.d.ts +21 -0
- package/dist/components/custom/flow-properties-bar.js +67 -0
- package/dist/components/custom/flow-properties-expanded.cjs +324 -0
- package/dist/components/custom/flow-properties-expanded.d.ts +19 -0
- package/dist/components/custom/flow-properties-expanded.js +290 -0
- package/dist/components/custom/flow-properties-simple.cjs +357 -0
- package/dist/components/custom/flow-properties-simple.d.ts +62 -0
- package/dist/components/custom/flow-properties-simple.js +323 -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 +415 -0
- package/dist/components/custom/global-header.d.ts +38 -0
- package/dist/components/custom/global-header.js +381 -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/panel-delegate.cjs +280 -0
- package/dist/components/custom/panel-delegate.d.ts +34 -0
- package/dist/components/custom/panel-delegate.js +246 -0
- package/dist/components/custom/panel-flow.cjs +260 -0
- package/dist/components/custom/panel-flow.d.ts +38 -0
- package/dist/components/custom/panel-flow.js +223 -0
- package/dist/components/custom/panel-maestro.cjs +73 -0
- package/dist/components/custom/panel-maestro.d.ts +30 -0
- package/dist/components/custom/panel-maestro.js +39 -0
- package/dist/components/custom/toolbar-canvas.cjs +121 -0
- package/dist/components/custom/toolbar-canvas.d.ts +15 -0
- package/dist/components/custom/toolbar-canvas.js +87 -0
- package/dist/components/custom/toolbar-view.cjs +119 -0
- package/dist/components/custom/toolbar-view.d.ts +14 -0
- package/dist/components/custom/toolbar-view.js +85 -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/ui/button.cjs +3 -3
- package/dist/components/ui/button.js +3 -3
- package/dist/components/ui/chart.cjs +218 -0
- package/dist/components/ui/chart.d.ts +40 -0
- package/dist/components/ui/chart.js +169 -0
- package/dist/components/ui/data-table.cjs +14 -2
- package/dist/components/ui/data-table.d.ts +4 -1
- package/dist/components/ui/data-table.js +15 -3
- 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 +82 -42
- package/dist/components/ui/file-upload.d.ts +3 -1
- package/dist/components/ui/file-upload.js +82 -42
- 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/tree-view.cjs +1101 -0
- package/dist/components/ui/tree-view.d.ts +95 -0
- package/dist/components/ui/tree-view.js +1067 -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 +18 -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 +125 -219
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -4
- package/dist/src/foundation/Future/themes.css +371 -0
- package/dist/styles.css +1704 -582
- package/dist/tailwind.css +4 -0
- package/dist/templates/Admin/settings-admin.d.ts +5 -0
- package/dist/templates/Admin/template-admin.d.ts +105 -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 +52 -0
- package/dist/templates/Maestro/template-maestro.d.ts +52 -0
- package/dist/templates/{vscode-example.d.ts → VisualStudio/shell.d.ts} +1 -1
- package/package.json +10 -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,218 @@
|
|
|
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: '.future-light',
|
|
40
|
+
dark: '.future-dark'
|
|
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 ChartStyle = ({ id, config })=>{
|
|
73
|
+
const colorConfig = Object.entries(config).filter(([, config])=>config.theme || config.color);
|
|
74
|
+
if (!colorConfig.length) return null;
|
|
75
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("style", {
|
|
76
|
+
dangerouslySetInnerHTML: {
|
|
77
|
+
__html: Object.entries(THEMES).map(([theme, prefix])=>`
|
|
78
|
+
${prefix} [data-chart=${id}] {
|
|
79
|
+
${colorConfig.map(([key, itemConfig])=>{
|
|
80
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
81
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
82
|
+
}).join('\n')}
|
|
83
|
+
}
|
|
84
|
+
`).join('\n')
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const ChartTooltip = external_recharts_namespaceObject.Tooltip;
|
|
89
|
+
function ChartTooltipContent({ active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
90
|
+
const { config } = useChart();
|
|
91
|
+
const tooltipLabel = external_react_namespaceObject.useMemo(()=>{
|
|
92
|
+
if (hideLabel || !payload?.length) return null;
|
|
93
|
+
const [item] = payload;
|
|
94
|
+
const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
|
|
95
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
96
|
+
const value = labelKey || 'string' != typeof label ? itemConfig?.label : config[label]?.label || label;
|
|
97
|
+
if (labelFormatter) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
98
|
+
className: (0, index_cjs_namespaceObject.cn)('font-medium', labelClassName),
|
|
99
|
+
children: labelFormatter(value, payload)
|
|
100
|
+
});
|
|
101
|
+
if (!value) return null;
|
|
102
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
103
|
+
className: (0, index_cjs_namespaceObject.cn)('font-medium', labelClassName),
|
|
104
|
+
children: value
|
|
105
|
+
});
|
|
106
|
+
}, [
|
|
107
|
+
label,
|
|
108
|
+
labelFormatter,
|
|
109
|
+
payload,
|
|
110
|
+
hideLabel,
|
|
111
|
+
labelClassName,
|
|
112
|
+
config,
|
|
113
|
+
labelKey
|
|
114
|
+
]);
|
|
115
|
+
if (!active || !payload?.length) return null;
|
|
116
|
+
const nestLabel = 1 === payload.length && 'dot' !== indicator;
|
|
117
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
118
|
+
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),
|
|
119
|
+
children: [
|
|
120
|
+
nestLabel ? null : tooltipLabel,
|
|
121
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
122
|
+
className: "grid gap-1.5",
|
|
123
|
+
children: payload.filter((item)=>'none' !== item.type).map((item, index)=>{
|
|
124
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
125
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
126
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
127
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
128
|
+
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'),
|
|
129
|
+
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, {
|
|
130
|
+
children: [
|
|
131
|
+
itemConfig?.icon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(itemConfig.icon, {}) : !hideIndicator && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
132
|
+
className: (0, index_cjs_namespaceObject.cn)('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {
|
|
133
|
+
'h-2.5 w-2.5': 'dot' === indicator,
|
|
134
|
+
'w-1': 'line' === indicator,
|
|
135
|
+
'w-0 border-[1.5px] border-dashed bg-transparent': 'dashed' === indicator,
|
|
136
|
+
'my-0.5': nestLabel && 'dashed' === indicator
|
|
137
|
+
}),
|
|
138
|
+
style: {
|
|
139
|
+
'--color-bg': indicatorColor,
|
|
140
|
+
'--color-border': indicatorColor
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
144
|
+
className: (0, index_cjs_namespaceObject.cn)('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'),
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
147
|
+
className: "grid gap-1.5",
|
|
148
|
+
children: [
|
|
149
|
+
nestLabel ? tooltipLabel : null,
|
|
150
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
151
|
+
className: "text-muted-foreground",
|
|
152
|
+
children: itemConfig?.label || item.name
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}),
|
|
156
|
+
item.value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
157
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
158
|
+
children: item.value.toLocaleString()
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
}, item.dataKey);
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const ChartLegend = external_recharts_namespaceObject.Legend;
|
|
171
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }) {
|
|
172
|
+
const { config } = useChart();
|
|
173
|
+
if (!payload?.length) return null;
|
|
174
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
175
|
+
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-center gap-4', 'top' === verticalAlign ? 'pb-3' : 'pt-3', className),
|
|
176
|
+
children: payload.filter((item)=>'none' !== item.type).map((item)=>{
|
|
177
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
178
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
179
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
180
|
+
className: (0, index_cjs_namespaceObject.cn)('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3'),
|
|
181
|
+
children: [
|
|
182
|
+
itemConfig?.icon && !hideIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(itemConfig.icon, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
183
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
184
|
+
style: {
|
|
185
|
+
backgroundColor: item.color
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
itemConfig?.label
|
|
189
|
+
]
|
|
190
|
+
}, item.value);
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
195
|
+
if ('object' != typeof payload || null === payload) return;
|
|
196
|
+
const payloadPayload = 'payload' in payload && 'object' == typeof payload.payload && null !== payload.payload ? payload.payload : void 0;
|
|
197
|
+
let configLabelKey = key;
|
|
198
|
+
if (key in payload && 'string' == typeof payload[key]) configLabelKey = payload[key];
|
|
199
|
+
else if (payloadPayload && key in payloadPayload && 'string' == typeof payloadPayload[key]) configLabelKey = payloadPayload[key];
|
|
200
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
201
|
+
}
|
|
202
|
+
exports.ChartContainer = __webpack_exports__.ChartContainer;
|
|
203
|
+
exports.ChartLegend = __webpack_exports__.ChartLegend;
|
|
204
|
+
exports.ChartLegendContent = __webpack_exports__.ChartLegendContent;
|
|
205
|
+
exports.ChartStyle = __webpack_exports__.ChartStyle;
|
|
206
|
+
exports.ChartTooltip = __webpack_exports__.ChartTooltip;
|
|
207
|
+
exports.ChartTooltipContent = __webpack_exports__.ChartTooltipContent;
|
|
208
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
209
|
+
"ChartContainer",
|
|
210
|
+
"ChartLegend",
|
|
211
|
+
"ChartLegendContent",
|
|
212
|
+
"ChartStyle",
|
|
213
|
+
"ChartTooltip",
|
|
214
|
+
"ChartTooltipContent"
|
|
215
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
216
|
+
Object.defineProperty(exports, '__esModule', {
|
|
217
|
+
value: true
|
|
218
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RechartsPrimitive from 'recharts';
|
|
3
|
+
declare const THEMES: {
|
|
4
|
+
readonly light: ".future-light";
|
|
5
|
+
readonly dark: ".future-dark";
|
|
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,169 @@
|
|
|
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: '.future-light',
|
|
7
|
+
dark: '.future-dark'
|
|
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 ChartStyle = ({ id, config })=>{
|
|
40
|
+
const colorConfig = Object.entries(config).filter(([, config])=>config.theme || config.color);
|
|
41
|
+
if (!colorConfig.length) return null;
|
|
42
|
+
return /*#__PURE__*/ jsx("style", {
|
|
43
|
+
dangerouslySetInnerHTML: {
|
|
44
|
+
__html: Object.entries(THEMES).map(([theme, prefix])=>`
|
|
45
|
+
${prefix} [data-chart=${id}] {
|
|
46
|
+
${colorConfig.map(([key, itemConfig])=>{
|
|
47
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
48
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
49
|
+
}).join('\n')}
|
|
50
|
+
}
|
|
51
|
+
`).join('\n')
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const ChartTooltip = Tooltip;
|
|
56
|
+
function ChartTooltipContent({ active, payload, className, indicator = 'dot', hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }) {
|
|
57
|
+
const { config } = useChart();
|
|
58
|
+
const tooltipLabel = useMemo(()=>{
|
|
59
|
+
if (hideLabel || !payload?.length) return null;
|
|
60
|
+
const [item] = payload;
|
|
61
|
+
const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
|
|
62
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
63
|
+
const value = labelKey || 'string' != typeof label ? itemConfig?.label : config[label]?.label || label;
|
|
64
|
+
if (labelFormatter) return /*#__PURE__*/ jsx("div", {
|
|
65
|
+
className: cn('font-medium', labelClassName),
|
|
66
|
+
children: labelFormatter(value, payload)
|
|
67
|
+
});
|
|
68
|
+
if (!value) return null;
|
|
69
|
+
return /*#__PURE__*/ jsx("div", {
|
|
70
|
+
className: cn('font-medium', labelClassName),
|
|
71
|
+
children: value
|
|
72
|
+
});
|
|
73
|
+
}, [
|
|
74
|
+
label,
|
|
75
|
+
labelFormatter,
|
|
76
|
+
payload,
|
|
77
|
+
hideLabel,
|
|
78
|
+
labelClassName,
|
|
79
|
+
config,
|
|
80
|
+
labelKey
|
|
81
|
+
]);
|
|
82
|
+
if (!active || !payload?.length) return null;
|
|
83
|
+
const nestLabel = 1 === payload.length && 'dot' !== indicator;
|
|
84
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
85
|
+
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),
|
|
86
|
+
children: [
|
|
87
|
+
nestLabel ? null : tooltipLabel,
|
|
88
|
+
/*#__PURE__*/ jsx("div", {
|
|
89
|
+
className: "grid gap-1.5",
|
|
90
|
+
children: payload.filter((item)=>'none' !== item.type).map((item, index)=>{
|
|
91
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
92
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
93
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
94
|
+
return /*#__PURE__*/ jsx("div", {
|
|
95
|
+
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'),
|
|
96
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /*#__PURE__*/ jsxs(Fragment, {
|
|
97
|
+
children: [
|
|
98
|
+
itemConfig?.icon ? /*#__PURE__*/ jsx(itemConfig.icon, {}) : !hideIndicator && /*#__PURE__*/ jsx("div", {
|
|
99
|
+
className: cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {
|
|
100
|
+
'h-2.5 w-2.5': 'dot' === indicator,
|
|
101
|
+
'w-1': 'line' === indicator,
|
|
102
|
+
'w-0 border-[1.5px] border-dashed bg-transparent': 'dashed' === indicator,
|
|
103
|
+
'my-0.5': nestLabel && 'dashed' === indicator
|
|
104
|
+
}),
|
|
105
|
+
style: {
|
|
106
|
+
'--color-bg': indicatorColor,
|
|
107
|
+
'--color-border': indicatorColor
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsxs("div", {
|
|
111
|
+
className: cn('flex flex-1 justify-between leading-none', nestLabel ? 'items-end' : 'items-center'),
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ jsxs("div", {
|
|
114
|
+
className: "grid gap-1.5",
|
|
115
|
+
children: [
|
|
116
|
+
nestLabel ? tooltipLabel : null,
|
|
117
|
+
/*#__PURE__*/ jsx("span", {
|
|
118
|
+
className: "text-muted-foreground",
|
|
119
|
+
children: itemConfig?.label || item.name
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}),
|
|
123
|
+
item.value && /*#__PURE__*/ jsx("span", {
|
|
124
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
125
|
+
children: item.value.toLocaleString()
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
}, item.dataKey);
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const ChartLegend = Legend;
|
|
138
|
+
function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }) {
|
|
139
|
+
const { config } = useChart();
|
|
140
|
+
if (!payload?.length) return null;
|
|
141
|
+
return /*#__PURE__*/ jsx("div", {
|
|
142
|
+
className: cn('flex items-center justify-center gap-4', 'top' === verticalAlign ? 'pb-3' : 'pt-3', className),
|
|
143
|
+
children: payload.filter((item)=>'none' !== item.type).map((item)=>{
|
|
144
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
145
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
146
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
147
|
+
className: cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3'),
|
|
148
|
+
children: [
|
|
149
|
+
itemConfig?.icon && !hideIcon ? /*#__PURE__*/ jsx(itemConfig.icon, {}) : /*#__PURE__*/ jsx("div", {
|
|
150
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
151
|
+
style: {
|
|
152
|
+
backgroundColor: item.color
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
itemConfig?.label
|
|
156
|
+
]
|
|
157
|
+
}, item.value);
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
162
|
+
if ('object' != typeof payload || null === payload) return;
|
|
163
|
+
const payloadPayload = 'payload' in payload && 'object' == typeof payload.payload && null !== payload.payload ? payload.payload : void 0;
|
|
164
|
+
let configLabelKey = key;
|
|
165
|
+
if (key in payload && 'string' == typeof payload[key]) configLabelKey = payload[key];
|
|
166
|
+
else if (payloadPayload && key in payloadPayload && 'string' == typeof payloadPayload[key]) configLabelKey = payloadPayload[key];
|
|
167
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
168
|
+
}
|
|
169
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -38,11 +38,22 @@ const external_editable_cell_cjs_namespaceObject = require("./editable-cell.cjs"
|
|
|
38
38
|
const external_input_cjs_namespaceObject = require("./input.cjs");
|
|
39
39
|
const external_table_cjs_namespaceObject = require("./table.cjs");
|
|
40
40
|
const react_table_namespaceObject = require("@tanstack/react-table");
|
|
41
|
-
function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns' }) {
|
|
41
|
+
function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns', rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, toolbarContent }) {
|
|
42
42
|
const [sorting, setSorting] = external_react_namespaceObject.useState([]);
|
|
43
43
|
const [columnFilters, setColumnFilters] = external_react_namespaceObject.useState([]);
|
|
44
44
|
const [columnVisibility, setColumnVisibility] = external_react_namespaceObject.useState({});
|
|
45
|
-
const [
|
|
45
|
+
const [internalRowSelection, setInternalRowSelection] = external_react_namespaceObject.useState({});
|
|
46
|
+
const isControlled = void 0 !== controlledRowSelection;
|
|
47
|
+
const rowSelection = isControlled ? controlledRowSelection : internalRowSelection;
|
|
48
|
+
const setRowSelection = external_react_namespaceObject.useCallback((updater)=>{
|
|
49
|
+
const next = 'function' == typeof updater ? updater(rowSelection) : updater;
|
|
50
|
+
if (!isControlled) setInternalRowSelection(next);
|
|
51
|
+
controlledOnRowSelectionChange?.(next);
|
|
52
|
+
}, [
|
|
53
|
+
isControlled,
|
|
54
|
+
rowSelection,
|
|
55
|
+
controlledOnRowSelectionChange
|
|
56
|
+
]);
|
|
46
57
|
const processedColumns = external_react_namespaceObject.useMemo(()=>{
|
|
47
58
|
if (!editable || !onCellUpdate) return columns;
|
|
48
59
|
return columns.map((col)=>{
|
|
@@ -100,6 +111,7 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
|
|
|
100
111
|
onChange: (event)=>table.getColumn(searchKey)?.setFilterValue(event.target.value),
|
|
101
112
|
className: "max-w-sm"
|
|
102
113
|
}),
|
|
114
|
+
toolbarContent,
|
|
103
115
|
showColumnToggle && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
104
116
|
children: [
|
|
105
117
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
|
|
@@ -13,8 +13,11 @@ export interface DataTableProps<TData, TValue> {
|
|
|
13
13
|
resizable?: boolean;
|
|
14
14
|
compact?: boolean;
|
|
15
15
|
columnToggleText?: string;
|
|
16
|
+
rowSelection?: Record<string, boolean>;
|
|
17
|
+
onRowSelectionChange?: (selection: Record<string, boolean>) => void;
|
|
18
|
+
toolbarContent?: React.ReactNode;
|
|
16
19
|
}
|
|
17
|
-
export declare function DataTable<TData, TValue>({ columns, data, searchKey, searchPlaceholder, showColumnToggle, showPagination, pageSize, editable, onCellUpdate, resizable, compact, columnToggleText, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function DataTable<TData, TValue>({ columns, data, searchKey, searchPlaceholder, showColumnToggle, showPagination, pageSize, editable, onCellUpdate, resizable, compact, columnToggleText, rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, toolbarContent, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
export declare function DataTableColumnHeader<TData, TValue>({ column, title, children, }: {
|
|
19
22
|
column: Column<TData, TValue>;
|
|
20
23
|
title: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown } from "lucide-react";
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
5
|
import { Checkbox } from "./checkbox.js";
|
|
@@ -8,11 +8,22 @@ import { EditableCell } from "./editable-cell.js";
|
|
|
8
8
|
import { Input } from "./input.js";
|
|
9
9
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "./table.js";
|
|
10
10
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
11
|
-
function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns' }) {
|
|
11
|
+
function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns', rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, toolbarContent }) {
|
|
12
12
|
const [sorting, setSorting] = useState([]);
|
|
13
13
|
const [columnFilters, setColumnFilters] = useState([]);
|
|
14
14
|
const [columnVisibility, setColumnVisibility] = useState({});
|
|
15
|
-
const [
|
|
15
|
+
const [internalRowSelection, setInternalRowSelection] = useState({});
|
|
16
|
+
const isControlled = void 0 !== controlledRowSelection;
|
|
17
|
+
const rowSelection = isControlled ? controlledRowSelection : internalRowSelection;
|
|
18
|
+
const setRowSelection = useCallback((updater)=>{
|
|
19
|
+
const next = 'function' == typeof updater ? updater(rowSelection) : updater;
|
|
20
|
+
if (!isControlled) setInternalRowSelection(next);
|
|
21
|
+
controlledOnRowSelectionChange?.(next);
|
|
22
|
+
}, [
|
|
23
|
+
isControlled,
|
|
24
|
+
rowSelection,
|
|
25
|
+
controlledOnRowSelectionChange
|
|
26
|
+
]);
|
|
16
27
|
const processedColumns = useMemo(()=>{
|
|
17
28
|
if (!editable || !onCellUpdate) return columns;
|
|
18
29
|
return columns.map((col)=>{
|
|
@@ -70,6 +81,7 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
|
|
|
70
81
|
onChange: (event)=>table.getColumn(searchKey)?.setFilterValue(event.target.value),
|
|
71
82
|
className: "max-w-sm"
|
|
72
83
|
}),
|
|
84
|
+
toolbarContent,
|
|
73
85
|
showColumnToggle && /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
74
86
|
children: [
|
|
75
87
|
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
@@ -30,25 +30,31 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
31
|
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
32
32
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
33
|
-
const EmptyState = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ icon, title, description, action, secondaryAction, className, ...props }, ref)
|
|
33
|
+
const EmptyState = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ icon, code, title, description, action, secondaryAction, className, children, ...props }, ref)=>{
|
|
34
|
+
const hasSimpleActions = !children && (action || secondaryAction);
|
|
35
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
34
36
|
ref: ref,
|
|
35
37
|
className: (0, index_cjs_namespaceObject.cn)('flex flex-col items-center justify-center p-8 text-center', className),
|
|
36
38
|
...props,
|
|
37
39
|
children: [
|
|
38
40
|
icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
39
|
-
className: "mb-6 flex
|
|
41
|
+
className: "mb-6 flex items-center justify-center",
|
|
40
42
|
children: icon
|
|
41
43
|
}),
|
|
44
|
+
code && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h1", {
|
|
45
|
+
className: "text-[40px] font-bold tracking-[-0.8px] leading-none mb-4",
|
|
46
|
+
children: code
|
|
47
|
+
}),
|
|
42
48
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h3", {
|
|
43
49
|
className: "text-xl font-semibold tracking-tight",
|
|
44
50
|
children: title
|
|
45
51
|
}),
|
|
46
52
|
description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
47
|
-
className: "mt-3
|
|
53
|
+
className: "mt-3 max-w-md text-sm text-muted-foreground leading-relaxed",
|
|
48
54
|
children: description
|
|
49
55
|
}),
|
|
50
|
-
|
|
51
|
-
className: "flex flex-wrap items-center justify-center gap-2",
|
|
56
|
+
hasSimpleActions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
57
|
+
className: "mt-6 flex flex-wrap items-center justify-center gap-2",
|
|
52
58
|
children: [
|
|
53
59
|
action && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
54
60
|
onClick: action.onClick,
|
|
@@ -60,9 +66,14 @@ const EmptyState = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ ic
|
|
|
60
66
|
children: secondaryAction.label
|
|
61
67
|
})
|
|
62
68
|
]
|
|
69
|
+
}),
|
|
70
|
+
children && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
71
|
+
className: "mt-6 flex flex-wrap items-center justify-center gap-2",
|
|
72
|
+
children: children
|
|
63
73
|
})
|
|
64
74
|
]
|
|
65
|
-
})
|
|
75
|
+
});
|
|
76
|
+
});
|
|
66
77
|
EmptyState.displayName = 'EmptyState';
|
|
67
78
|
exports.EmptyState = __webpack_exports__.EmptyState;
|
|
68
79
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Optional visual element displayed above the content (icon, illustration, video, etc.) */
|
|
3
4
|
icon?: React.ReactNode;
|
|
5
|
+
/** Optional large status code displayed above the title (e.g. "404", "500") */
|
|
6
|
+
code?: string;
|
|
7
|
+
/** Primary heading — always visible */
|
|
4
8
|
title: string;
|
|
9
|
+
/** Optional body text below the title */
|
|
5
10
|
description?: string;
|
|
11
|
+
/** Simple primary action — ignored when children are provided */
|
|
6
12
|
action?: {
|
|
7
13
|
label: string;
|
|
8
14
|
onClick: () => void;
|
|
9
15
|
};
|
|
16
|
+
/** Simple secondary action — ignored when children are provided */
|
|
10
17
|
secondaryAction?: {
|
|
11
18
|
label: string;
|
|
12
19
|
onClick: () => void;
|
|
@@ -2,25 +2,31 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
4
|
import { cn } from "../../lib/index.js";
|
|
5
|
-
const EmptyState = /*#__PURE__*/ forwardRef(({ icon, title, description, action, secondaryAction, className, ...props }, ref)
|
|
5
|
+
const EmptyState = /*#__PURE__*/ forwardRef(({ icon, code, title, description, action, secondaryAction, className, children, ...props }, ref)=>{
|
|
6
|
+
const hasSimpleActions = !children && (action || secondaryAction);
|
|
7
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
6
8
|
ref: ref,
|
|
7
9
|
className: cn('flex flex-col items-center justify-center p-8 text-center', className),
|
|
8
10
|
...props,
|
|
9
11
|
children: [
|
|
10
12
|
icon && /*#__PURE__*/ jsx("div", {
|
|
11
|
-
className: "mb-6 flex
|
|
13
|
+
className: "mb-6 flex items-center justify-center",
|
|
12
14
|
children: icon
|
|
13
15
|
}),
|
|
16
|
+
code && /*#__PURE__*/ jsx("h1", {
|
|
17
|
+
className: "text-[40px] font-bold tracking-[-0.8px] leading-none mb-4",
|
|
18
|
+
children: code
|
|
19
|
+
}),
|
|
14
20
|
/*#__PURE__*/ jsx("h3", {
|
|
15
21
|
className: "text-xl font-semibold tracking-tight",
|
|
16
22
|
children: title
|
|
17
23
|
}),
|
|
18
24
|
description && /*#__PURE__*/ jsx("p", {
|
|
19
|
-
className: "mt-3
|
|
25
|
+
className: "mt-3 max-w-md text-sm text-muted-foreground leading-relaxed",
|
|
20
26
|
children: description
|
|
21
27
|
}),
|
|
22
|
-
|
|
23
|
-
className: "flex flex-wrap items-center justify-center gap-2",
|
|
28
|
+
hasSimpleActions && /*#__PURE__*/ jsxs("div", {
|
|
29
|
+
className: "mt-6 flex flex-wrap items-center justify-center gap-2",
|
|
24
30
|
children: [
|
|
25
31
|
action && /*#__PURE__*/ jsx(Button, {
|
|
26
32
|
onClick: action.onClick,
|
|
@@ -32,8 +38,13 @@ const EmptyState = /*#__PURE__*/ forwardRef(({ icon, title, description, action,
|
|
|
32
38
|
children: secondaryAction.label
|
|
33
39
|
})
|
|
34
40
|
]
|
|
41
|
+
}),
|
|
42
|
+
children && /*#__PURE__*/ jsx("div", {
|
|
43
|
+
className: "mt-6 flex flex-wrap items-center justify-center gap-2",
|
|
44
|
+
children: children
|
|
35
45
|
})
|
|
36
46
|
]
|
|
37
|
-
})
|
|
47
|
+
});
|
|
48
|
+
});
|
|
38
49
|
EmptyState.displayName = 'EmptyState';
|
|
39
50
|
export { EmptyState };
|