@efolusi/meridian 1.19.1 → 1.21.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/README.md +1 -1
- package/ai/Bubble.d.ts +16 -0
- package/ai/Bubble.js +71 -0
- package/ai/ChatMessage.js +2 -5
- package/ai/Confirmation.d.ts +0 -7
- package/ai/Confirmation.js +3 -6
- package/ai/GeneratedImage.d.ts +0 -2
- package/ai/GeneratedImage.js +2 -4
- package/ai/Marker.d.ts +26 -0
- package/ai/Marker.js +67 -0
- package/ai/Message.d.ts +13 -0
- package/ai/Message.js +68 -0
- package/ai/MessageScroller.d.ts +21 -0
- package/ai/MessageScroller.js +283 -0
- package/ai/ModelSelector.d.ts +2 -2
- package/ai/ModelSelector.js +1 -2
- package/ai/Player.js +1 -1
- package/ai/PromptSteps.js +4 -2
- package/ai/Sandbox.d.ts +0 -2
- package/ai/Sandbox.js +2 -4
- package/ai/Suggestions.d.ts +0 -2
- package/ai/Suggestions.js +1 -4
- package/ai/WebPreview.d.ts +0 -2
- package/ai/WebPreview.js +2 -4
- package/code/Console.js +1 -1
- package/code/EnvList.d.ts +0 -2
- package/code/EnvList.js +2 -3
- package/components.css +660 -423
- package/data/BarChart.d.ts +0 -2
- package/data/BarChart.js +1 -4
- package/data/Chart.d.ts +14 -0
- package/data/Chart.js +149 -0
- package/data/EmptyState.d.ts +8 -13
- package/data/EmptyState.js +62 -24
- package/data/LineChart.js +7 -4
- package/data/Skeleton.d.ts +2 -11
- package/data/Skeleton.js +8 -38
- package/data/Sparkline.js +4 -1
- package/data/StatusDot.d.ts +0 -4
- package/data/StatusDot.js +3 -6
- package/data/Table.d.ts +11 -4
- package/data/Table.js +39 -7
- package/dates/Calendar.d.ts +10 -27
- package/dates/Calendar.js +250 -184
- package/dates/TimePicker.js +2 -2
- package/display/Accordion.d.ts +47 -15
- package/display/Accordion.js +257 -27
- package/display/AspectRatio.d.ts +4 -6
- package/display/AspectRatio.js +7 -5
- package/display/Avatar.d.ts +17 -14
- package/display/Avatar.js +68 -43
- package/display/Badge.d.ts +9 -8
- package/display/Badge.js +32 -14
- package/display/Card.d.ts +11 -13
- package/display/Card.js +74 -29
- package/display/Carousel.d.ts +23 -15
- package/display/Carousel.js +217 -66
- package/display/Collapsible.d.ts +19 -9
- package/display/Collapsible.js +140 -28
- package/display/Direction.d.ts +10 -0
- package/display/Direction.js +24 -0
- package/display/Item.d.ts +19 -0
- package/display/Item.js +152 -0
- package/display/Kbd.d.ts +5 -7
- package/display/Kbd.js +22 -10
- package/display/Link.js +2 -4
- package/display/Resizable.d.ts +6 -16
- package/display/Resizable.js +141 -58
- package/display/ScrollArea.d.ts +3 -1
- package/display/ScrollArea.js +30 -5
- package/display/Separator.d.ts +9 -0
- package/display/Separator.js +18 -0
- package/display/Timeline.d.ts +24 -0
- package/display/Timeline.js +51 -0
- package/display/Toolbar.js +5 -4
- package/display/TreeList.d.ts +0 -2
- package/display/TreeList.js +2 -5
- package/feedback/Alert.d.ts +13 -13
- package/feedback/Alert.js +40 -36
- package/feedback/AlertDialog.d.ts +30 -0
- package/feedback/AlertDialog.js +249 -0
- package/feedback/Banner.d.ts +1 -3
- package/feedback/Banner.js +1 -5
- package/feedback/ConfirmDialog.d.ts +1 -1
- package/feedback/ConfirmDialog.js +18 -20
- package/feedback/Dialog.d.ts +13 -16
- package/feedback/Dialog.js +204 -62
- package/feedback/Progress.d.ts +8 -9
- package/feedback/Progress.js +42 -24
- package/feedback/Sonner.d.ts +8 -0
- package/feedback/Sonner.js +238 -0
- package/feedback/Spinner.d.ts +2 -9
- package/feedback/Spinner.js +19 -28
- package/feedback/Tooltip.d.ts +9 -10
- package/feedback/Tooltip.js +147 -96
- package/files/Attachment.d.ts +27 -0
- package/files/Attachment.js +111 -0
- package/files/FileDrop.js +3 -1
- package/finance/PaymentCard.js +3 -3
- package/forms/Button.d.ts +6 -5
- package/forms/Button.js +42 -8
- package/forms/ButtonGroup.d.ts +11 -3
- package/forms/ButtonGroup.js +57 -6
- package/forms/Checkbox.d.ts +14 -3
- package/forms/Checkbox.js +84 -16
- package/forms/Combobox.d.ts +24 -16
- package/forms/Combobox.js +466 -135
- package/forms/Field.d.ts +14 -0
- package/forms/Field.js +99 -0
- package/forms/IconButton.d.ts +1 -1
- package/forms/IconButton.js +4 -3
- package/forms/Input.d.ts +8 -8
- package/forms/Input.js +46 -33
- package/forms/InputGroup.d.ts +8 -15
- package/forms/InputGroup.js +74 -35
- package/forms/InputOTP.d.ts +13 -0
- package/forms/InputOTP.js +125 -0
- package/forms/Label.d.ts +2 -6
- package/forms/Label.js +6 -4
- package/forms/NativeSelect.d.ts +16 -0
- package/forms/NativeSelect.js +35 -0
- package/forms/NumberInput.js +2 -2
- package/forms/Radio.d.ts +12 -1
- package/forms/Radio.js +76 -6
- package/forms/Select.d.ts +12 -9
- package/forms/Select.js +254 -42
- package/forms/Slider.d.ts +10 -17
- package/forms/Slider.js +78 -39
- package/forms/Switch.d.ts +8 -2
- package/forms/Switch.js +46 -15
- package/forms/Textarea.d.ts +1 -1
- package/forms/Textarea.js +26 -18
- package/forms/Toggle.d.ts +18 -15
- package/forms/Toggle.js +96 -42
- package/icons/_svg.js +2 -0
- package/index.d.ts +20 -8
- package/index.js +50 -38
- package/navigation/Breadcrumbs.d.ts +18 -11
- package/navigation/Breadcrumbs.js +99 -26
- package/navigation/Menubar.d.ts +52 -10
- package/navigation/Menubar.js +191 -146
- package/navigation/NavigationMenu.d.ts +15 -0
- package/navigation/NavigationMenu.js +296 -0
- package/navigation/Pagination.d.ts +10 -9
- package/navigation/Pagination.js +94 -51
- package/navigation/SideNav.js +4 -3
- package/navigation/Sidebar.d.ts +29 -0
- package/navigation/Sidebar.js +311 -0
- package/navigation/Tabs.d.ts +9 -5
- package/navigation/Tabs.js +132 -44
- package/overlay/Command.d.ts +32 -0
- package/overlay/Command.js +257 -0
- package/overlay/ContextMenu.d.ts +40 -8
- package/overlay/ContextMenu.js +468 -107
- package/overlay/Drawer.d.ts +29 -14
- package/overlay/Drawer.js +178 -80
- package/overlay/DropdownMenu.d.ts +43 -0
- package/overlay/DropdownMenu.js +502 -0
- package/overlay/HoverCard.d.ts +21 -12
- package/overlay/HoverCard.js +129 -61
- package/overlay/Popover.d.ts +11 -13
- package/overlay/Popover.js +138 -65
- package/overlay/Portal.js +21 -7
- package/overlay/Sheet.d.ts +11 -0
- package/overlay/Sheet.js +62 -0
- package/package.json +4 -1
- package/tokens/base.css +1 -1
- package/dates/DatePicker.d.ts +0 -14
- package/dates/DatePicker.js +0 -111
- package/dates/DateRangePicker.d.ts +0 -23
- package/dates/DateRangePicker.js +0 -150
- package/display/ListItem.d.ts +0 -19
- package/display/ListItem.js +0 -50
- package/feedback/Toast.d.ts +0 -78
- package/feedback/Toast.js +0 -192
- package/forms/DigitEntry.d.ts +0 -15
- package/forms/DigitEntry.js +0 -79
- package/forms/FormField.d.ts +0 -82
- package/forms/FormField.js +0 -209
- package/overlay/CommandPalette.d.ts +0 -21
- package/overlay/CommandPalette.js +0 -148
- package/overlay/Menu.d.ts +0 -24
- package/overlay/Menu.js +0 -139
package/data/BarChart.d.ts
CHANGED
|
@@ -9,8 +9,6 @@ export interface BarChartProps {
|
|
|
9
9
|
labels?: string[];
|
|
10
10
|
/** Hover value formatter */
|
|
11
11
|
format?: (v: number) => string;
|
|
12
|
-
/** @deprecated Use `format`. Alias kept for one major; `format` wins when both are passed. */
|
|
13
|
-
formatValue?: (v: number) => string;
|
|
14
12
|
style?: React.CSSProperties;
|
|
15
13
|
className?: string;
|
|
16
14
|
}
|
package/data/BarChart.js
CHANGED
|
@@ -8,13 +8,10 @@ export function BarChart({
|
|
|
8
8
|
highlightLast = 0,
|
|
9
9
|
labels,
|
|
10
10
|
format,
|
|
11
|
-
formatValue,
|
|
12
11
|
style,
|
|
13
12
|
className,
|
|
14
13
|
...rest
|
|
15
14
|
}) {
|
|
16
|
-
// formatValue is the deprecated alias; format (the sibling-chart convention) wins when both are passed.
|
|
17
|
-
const fmt = format ?? formatValue;
|
|
18
15
|
const vals = data.map(d => typeof d === 'number' ? d : d.value);
|
|
19
16
|
const max = Math.max(...vals, 1);
|
|
20
17
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
@@ -31,7 +28,7 @@ export function BarChart({
|
|
|
31
28
|
style: {
|
|
32
29
|
height: cssPct(Math.max(2, v / max * 100))
|
|
33
30
|
},
|
|
34
|
-
title: (data[i] && data[i].label ? data[i].label + ' · ' : '') + (
|
|
31
|
+
title: (data[i] && data[i].label ? data[i].label + ' · ' : '') + (format ? format(v) : v.toLocaleString())
|
|
35
32
|
}))), labels && labels.length ? /*#__PURE__*/React.createElement("div", {
|
|
36
33
|
className: "ef-bars__labels"
|
|
37
34
|
}, labels.map((l, i) => /*#__PURE__*/React.createElement("span", {
|
package/data/Chart.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { DefaultLegendContentProps, DefaultTooltipContentProps, LegendProps, ResponsiveContainerProps, TooltipProps, TooltipValueType } from 'recharts';
|
|
3
|
+
|
|
4
|
+
export type ChartConfig = Record<string, { label?: React.ReactNode; icon?: React.ComponentType } & ({ color?: string; theme?: never } | { color?: never; theme: { light: string; dark: string } })>;
|
|
5
|
+
export declare function useChart(): { config: ChartConfig };
|
|
6
|
+
export interface ChartContainerProps extends React.HTMLAttributes<HTMLDivElement> { config: ChartConfig; children: ResponsiveContainerProps['children']; initialDimension?: { width: number; height: number } }
|
|
7
|
+
export declare const ChartContainer: React.ForwardRefExoticComponent<ChartContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare function ChartStyle(props: { id: string; config: ChartConfig }): React.JSX.Element | null;
|
|
9
|
+
export declare function ChartTooltip(props: TooltipProps<any, any>): React.JSX.Element | null;
|
|
10
|
+
export interface ChartTooltipContentProps extends Omit<DefaultTooltipContentProps<TooltipValueType, string | number>, 'accessibilityLayer'> { active?: boolean; className?: string; hideLabel?: boolean; hideIndicator?: boolean; indicator?: 'line' | 'dot' | 'dashed'; nameKey?: string; labelKey?: string; color?: string }
|
|
11
|
+
export declare function ChartTooltipContent(props: ChartTooltipContentProps): React.JSX.Element | null;
|
|
12
|
+
export declare function ChartLegend(props: LegendProps): React.JSX.Element | null;
|
|
13
|
+
export interface ChartLegendContentProps extends DefaultLegendContentProps { className?: string; hideIcon?: boolean; nameKey?: string }
|
|
14
|
+
export declare function ChartLegendContent(props: ChartLegendContentProps): React.JSX.Element | null;
|
package/data/Chart.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import * as RechartsPrimitive from 'recharts';
|
|
5
|
+
const THEMES = {
|
|
6
|
+
light: '',
|
|
7
|
+
dark: '[data-theme="dark"]'
|
|
8
|
+
};
|
|
9
|
+
const INITIAL_DIMENSION = {
|
|
10
|
+
width: 320,
|
|
11
|
+
height: 200
|
|
12
|
+
};
|
|
13
|
+
const ChartContext = /*#__PURE__*/React.createContext(null);
|
|
14
|
+
export function useChart() {
|
|
15
|
+
const context = React.useContext(ChartContext);
|
|
16
|
+
if (!context) throw new Error('useChart must be used within a <ChartContainer />');
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
export function ChartStyle({
|
|
20
|
+
id,
|
|
21
|
+
config
|
|
22
|
+
}) {
|
|
23
|
+
const colors = Object.entries(config || {}).filter(([, item]) => item.theme || item.color);
|
|
24
|
+
if (!colors.length) return null;
|
|
25
|
+
const css = Object.entries(THEMES).map(([theme, prefix]) => `${prefix} [data-chart="${id}"]{\n${colors.map(([key, item]) => {
|
|
26
|
+
const value = item.theme ? item.theme[theme] : item.color;
|
|
27
|
+
return value ? `--color-${key}:${value};` : '';
|
|
28
|
+
}).join('\n')}\n}`).join('\n');
|
|
29
|
+
return /*#__PURE__*/React.createElement("style", {
|
|
30
|
+
dangerouslySetInnerHTML: {
|
|
31
|
+
__html: css
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer({
|
|
36
|
+
id,
|
|
37
|
+
className,
|
|
38
|
+
children,
|
|
39
|
+
config = {},
|
|
40
|
+
initialDimension = INITIAL_DIMENSION,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) {
|
|
43
|
+
const uniqueId = React.useId();
|
|
44
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
|
|
45
|
+
const ResponsiveContainer = RechartsPrimitive && RechartsPrimitive.ResponsiveContainer;
|
|
46
|
+
return /*#__PURE__*/React.createElement(ChartContext.Provider, {
|
|
47
|
+
value: {
|
|
48
|
+
config
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
51
|
+
ref: ref,
|
|
52
|
+
"data-slot": "chart",
|
|
53
|
+
"data-chart": chartId,
|
|
54
|
+
className: `ef-chart${className ? ` ${className}` : ''}`
|
|
55
|
+
}, props), /*#__PURE__*/React.createElement(ChartStyle, {
|
|
56
|
+
id: chartId,
|
|
57
|
+
config: config
|
|
58
|
+
}), ResponsiveContainer ? /*#__PURE__*/React.createElement(ResponsiveContainer, {
|
|
59
|
+
initialDimension: initialDimension
|
|
60
|
+
}, children) : children));
|
|
61
|
+
});
|
|
62
|
+
export function ChartTooltip(props) {
|
|
63
|
+
const Tooltip = RechartsPrimitive && RechartsPrimitive.Tooltip;
|
|
64
|
+
return Tooltip ? /*#__PURE__*/React.createElement(Tooltip, props) : null;
|
|
65
|
+
}
|
|
66
|
+
function payloadConfig(config, payload, key) {
|
|
67
|
+
if (!payload || typeof payload !== 'object') return undefined;
|
|
68
|
+
const nested = payload.payload && typeof payload.payload === 'object' ? payload.payload : undefined;
|
|
69
|
+
const mapped = typeof payload[key] === 'string' ? payload[key] : nested && typeof nested[key] === 'string' ? nested[key] : key;
|
|
70
|
+
return config[mapped] || config[key];
|
|
71
|
+
}
|
|
72
|
+
export function ChartTooltipContent({
|
|
73
|
+
active,
|
|
74
|
+
payload,
|
|
75
|
+
className,
|
|
76
|
+
indicator = 'dot',
|
|
77
|
+
hideLabel = false,
|
|
78
|
+
hideIndicator = false,
|
|
79
|
+
label,
|
|
80
|
+
labelFormatter,
|
|
81
|
+
labelClassName,
|
|
82
|
+
formatter,
|
|
83
|
+
color,
|
|
84
|
+
nameKey,
|
|
85
|
+
labelKey
|
|
86
|
+
}) {
|
|
87
|
+
const {
|
|
88
|
+
config
|
|
89
|
+
} = useChart();
|
|
90
|
+
if (!active || !payload || !payload.length) return null;
|
|
91
|
+
const first = payload[0];
|
|
92
|
+
const labelConfig = payloadConfig(config, first, `${labelKey || first.dataKey || first.name || 'value'}`);
|
|
93
|
+
const labelValue = !labelKey && typeof label === 'string' ? config[label]?.label || label : labelConfig?.label;
|
|
94
|
+
const labelNode = hideLabel || !labelValue ? null : /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: `ef-chart-tooltip__label${labelClassName ? ` ${labelClassName}` : ''}`
|
|
96
|
+
}, labelFormatter ? labelFormatter(labelValue, payload) : labelValue);
|
|
97
|
+
const nestLabel = payload.length === 1 && indicator !== 'dot';
|
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: `ef-chart-tooltip${className ? ` ${className}` : ''}`
|
|
100
|
+
}, !nestLabel ? labelNode : null, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "ef-chart-tooltip__items"
|
|
102
|
+
}, payload.filter(item => item.type !== 'none').map((item, index) => {
|
|
103
|
+
const configItem = payloadConfig(config, item, `${nameKey || item.name || item.dataKey || 'value'}`);
|
|
104
|
+
const indicatorColor = color || item.payload?.fill || item.color;
|
|
105
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "ef-chart-tooltip__item",
|
|
107
|
+
key: index
|
|
108
|
+
}, formatter && item.value !== undefined && item.name ? formatter(item.value, item.name, item, index, item.payload) : /*#__PURE__*/React.createElement(React.Fragment, null, configItem?.icon ? /*#__PURE__*/React.createElement(configItem.icon) : !hideIndicator ? /*#__PURE__*/React.createElement("span", {
|
|
109
|
+
className: `ef-chart-tooltip__indicator ef-chart-tooltip__indicator--${indicator}`,
|
|
110
|
+
style: {
|
|
111
|
+
'--chart-indicator': indicatorColor
|
|
112
|
+
}
|
|
113
|
+
}) : null, /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
className: "ef-chart-tooltip__name"
|
|
115
|
+
}, nestLabel ? labelNode : null, configItem?.label || item.name), item.value != null ? /*#__PURE__*/React.createElement("span", {
|
|
116
|
+
className: "ef-chart-tooltip__value"
|
|
117
|
+
}, typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)) : null));
|
|
118
|
+
})));
|
|
119
|
+
}
|
|
120
|
+
export function ChartLegend(props) {
|
|
121
|
+
const Legend = RechartsPrimitive && RechartsPrimitive.Legend;
|
|
122
|
+
return Legend ? /*#__PURE__*/React.createElement(Legend, props) : null;
|
|
123
|
+
}
|
|
124
|
+
export function ChartLegendContent({
|
|
125
|
+
className,
|
|
126
|
+
hideIcon = false,
|
|
127
|
+
payload,
|
|
128
|
+
verticalAlign = 'bottom',
|
|
129
|
+
nameKey
|
|
130
|
+
}) {
|
|
131
|
+
const {
|
|
132
|
+
config
|
|
133
|
+
} = useChart();
|
|
134
|
+
if (!payload || !payload.length) return null;
|
|
135
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
className: `ef-chart-legend ef-chart-legend--${verticalAlign}${className ? ` ${className}` : ''}`
|
|
137
|
+
}, payload.filter(item => item.type !== 'none').map((item, index) => {
|
|
138
|
+
const configItem = payloadConfig(config, item, `${nameKey || item.dataKey || 'value'}`);
|
|
139
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
140
|
+
className: "ef-chart-legend__item",
|
|
141
|
+
key: index
|
|
142
|
+
}, configItem?.icon && !hideIcon ? /*#__PURE__*/React.createElement(configItem.icon) : /*#__PURE__*/React.createElement("span", {
|
|
143
|
+
className: "ef-chart-legend__mark",
|
|
144
|
+
style: {
|
|
145
|
+
backgroundColor: item.color
|
|
146
|
+
}
|
|
147
|
+
}), configItem?.label);
|
|
148
|
+
}));
|
|
149
|
+
}
|
package/data/EmptyState.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
bordered?: boolean;
|
|
10
|
-
style?: React.CSSProperties;
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function EmptyState(props: EmptyStateProps): React.JSX.Element;
|
|
1
|
+
export type EmptyElementProps = React.HTMLAttributes<HTMLDivElement>;
|
|
2
|
+
export declare const Empty: React.ForwardRefExoticComponent<EmptyElementProps & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export declare const EmptyHeader: React.ForwardRefExoticComponent<EmptyElementProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export interface EmptyMediaProps extends EmptyElementProps { variant?: 'default' | 'icon'; }
|
|
5
|
+
export declare const EmptyMedia: React.ForwardRefExoticComponent<EmptyMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const EmptyTitle: React.ForwardRefExoticComponent<EmptyElementProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const EmptyDescription: React.ForwardRefExoticComponent<EmptyElementProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const EmptyContent: React.ForwardRefExoticComponent<EmptyElementProps & React.RefAttributes<HTMLDivElement>>;
|
package/data/EmptyState.js
CHANGED
|
@@ -1,30 +1,68 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
description,
|
|
9
|
-
action,
|
|
10
|
-
bordered,
|
|
11
|
-
style,
|
|
4
|
+
function cx(base, className) {
|
|
5
|
+
return base + (className ? ` ${className}` : '');
|
|
6
|
+
}
|
|
7
|
+
export const Empty = /*#__PURE__*/React.forwardRef(function Empty({
|
|
12
8
|
className,
|
|
13
9
|
...rest
|
|
14
|
-
}) {
|
|
10
|
+
}, ref) {
|
|
15
11
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
className:
|
|
29
|
-
}
|
|
30
|
-
}
|
|
12
|
+
ref: ref,
|
|
13
|
+
"data-slot": "empty",
|
|
14
|
+
className: cx('ef-empty', className)
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
export const EmptyHeader = /*#__PURE__*/React.forwardRef(function EmptyHeader({
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
20
|
+
}, ref) {
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
"data-slot": "empty-header",
|
|
24
|
+
className: cx('ef-empty__header', className)
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
export const EmptyMedia = /*#__PURE__*/React.forwardRef(function EmptyMedia({
|
|
28
|
+
variant = 'default',
|
|
29
|
+
className,
|
|
30
|
+
...rest
|
|
31
|
+
}, ref) {
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
33
|
+
ref: ref,
|
|
34
|
+
"data-slot": "empty-media",
|
|
35
|
+
"data-variant": variant === 'icon' ? 'icon' : 'default',
|
|
36
|
+
className: cx('ef-empty__media', className)
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
export const EmptyTitle = /*#__PURE__*/React.forwardRef(function EmptyTitle({
|
|
40
|
+
className,
|
|
41
|
+
...rest
|
|
42
|
+
}, ref) {
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
44
|
+
ref: ref,
|
|
45
|
+
"data-slot": "empty-title",
|
|
46
|
+
className: cx('ef-empty__title', className)
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
export const EmptyDescription = /*#__PURE__*/React.forwardRef(function EmptyDescription({
|
|
50
|
+
className,
|
|
51
|
+
...rest
|
|
52
|
+
}, ref) {
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
54
|
+
ref: ref,
|
|
55
|
+
"data-slot": "empty-description",
|
|
56
|
+
className: cx('ef-empty__description', className)
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
export const EmptyContent = /*#__PURE__*/React.forwardRef(function EmptyContent({
|
|
60
|
+
className,
|
|
61
|
+
...rest
|
|
62
|
+
}, ref) {
|
|
63
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
64
|
+
ref: ref,
|
|
65
|
+
"data-slot": "empty-content",
|
|
66
|
+
className: cx('ef-empty__content', className)
|
|
67
|
+
}));
|
|
68
|
+
});
|
package/data/LineChart.js
CHANGED
|
@@ -21,10 +21,13 @@ export function LineChart({
|
|
|
21
21
|
const max = Math.max(...vals),
|
|
22
22
|
min = Math.min(...vals);
|
|
23
23
|
const span = max - min || 1;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
24
|
+
const n = data.length;
|
|
25
|
+
const x = i => PAD + (n === 1 ? 0.5 : i / (n - 1)) * (W - PAD * 2);
|
|
26
|
+
const y = v => n === 1 ? H / 2 : H - PAD - (v - min) / span * (H - PAD * 2);
|
|
27
|
+
// One reading has no left-to-right span; draw it as a flat line across the
|
|
28
|
+
// middle instead of dividing by zero, which put NaN in the path.
|
|
29
|
+
const path = n === 1 ? `M${PAD.toFixed(1)},${y(data[0].value).toFixed(1)} L${(W - PAD).toFixed(1)},${y(data[0].value).toFixed(1)}` : data.map((d, i) => (i ? 'L' : 'M') + x(i).toFixed(1) + ',' + y(d.value).toFixed(1)).join(' ');
|
|
30
|
+
const area = n === 1 ? `${path} L${(W - PAD).toFixed(1)},${(H - PAD).toFixed(1)} L${PAD.toFixed(1)},${(H - PAD).toFixed(1)} Z` : path + ` L${x(data.length - 1).toFixed(1)},${H - PAD} L${x(0).toFixed(1)},${H - PAD} Z`;
|
|
28
31
|
const move = e => {
|
|
29
32
|
const r = ref.current.getBoundingClientRect();
|
|
30
33
|
const i = Math.round((e.clientX - r.left) / r.width * (data.length - 1));
|
package/data/Skeleton.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
variant?: 'text' | 'rect' | 'circle';
|
|
4
|
-
width?: number | string;
|
|
5
|
-
height?: number | string;
|
|
6
|
-
/** Stacked text lines (last one 60% wide) @default 1 */
|
|
7
|
-
lines?: number;
|
|
8
|
-
style?: React.CSSProperties;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function Skeleton(props: SkeletonProps): React.JSX.Element;
|
|
1
|
+
export type SkeletonProps = React.HTMLAttributes<HTMLDivElement>;
|
|
2
|
+
export declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLDivElement>>;
|
package/data/Skeleton.js
CHANGED
|
@@ -1,43 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export function Skeleton({
|
|
5
|
-
variant = 'text',
|
|
6
|
-
width,
|
|
7
|
-
height,
|
|
8
|
-
lines = 1,
|
|
9
|
-
style,
|
|
4
|
+
export const Skeleton = /*#__PURE__*/React.forwardRef(function Skeleton({
|
|
10
5
|
className,
|
|
11
6
|
...rest
|
|
12
|
-
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
gap: 8,
|
|
21
|
-
...style
|
|
22
|
-
},
|
|
23
|
-
className: className
|
|
24
|
-
}), Array.from({
|
|
25
|
-
length: lines
|
|
26
|
-
}, (_, i) => /*#__PURE__*/React.createElement("span", {
|
|
27
|
-
key: i,
|
|
28
|
-
className: "ef-skel",
|
|
29
|
-
style: {
|
|
30
|
-
width: i === lines - 1 ? '60%' : w,
|
|
31
|
-
height: h
|
|
32
|
-
}
|
|
33
|
-
})));
|
|
34
|
-
}
|
|
35
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
36
|
-
className: `ef-skel${variant === 'circle' ? ' ef-skel--circle' : ''}${className ? ' ' + className : ''}`,
|
|
37
|
-
style: {
|
|
38
|
-
width: w,
|
|
39
|
-
height: h,
|
|
40
|
-
...style
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
7
|
+
}, ref) {
|
|
8
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
"data-slot": "skeleton",
|
|
11
|
+
className: `ef-skel${className ? ' ' + className : ''}`
|
|
12
|
+
}));
|
|
13
|
+
});
|
package/data/Sparkline.js
CHANGED
|
@@ -13,11 +13,14 @@ export function Sparkline({
|
|
|
13
13
|
...rest
|
|
14
14
|
}) {
|
|
15
15
|
if (!data.length) return null;
|
|
16
|
+
const len = data.length;
|
|
16
17
|
const min = Math.min(...data),
|
|
17
18
|
max = Math.max(...data),
|
|
18
19
|
span = max - min || 1;
|
|
19
20
|
const pad = strokeWidth;
|
|
20
|
-
|
|
21
|
+
// One reading has no left-to-right span; draw it as a flat line across the
|
|
22
|
+
// middle instead of dividing by zero, which put NaN in every coordinate.
|
|
23
|
+
const pts = len === 1 ? [[pad, height / 2], [width - pad, height / 2]] : data.map((v, i) => [pad + i / (len - 1) * (width - pad * 2), pad + (1 - (v - min) / span) * (height - pad * 2)]);
|
|
21
24
|
const dir = direction || (data[data.length - 1] >= data[0] ? 'up' : 'down');
|
|
22
25
|
const color = dir === 'up' ? 'var(--success-600)' : dir === 'down' ? 'var(--danger-600)' : 'var(--text-primary)';
|
|
23
26
|
const line = pts.map(p => p.map(n => n.toFixed(1)).join(',')).join(' ');
|
package/data/StatusDot.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
export interface StatusDotProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
2
2
|
/** @default 'ok' */
|
|
3
3
|
status?: 'ok' | 'warn' | 'err' | 'busy' | 'off';
|
|
4
|
-
/** @deprecated use `status` */
|
|
5
|
-
state?: 'ok' | 'warn' | 'err' | 'busy' | 'off';
|
|
6
4
|
label?: React.ReactNode;
|
|
7
5
|
/** Text announced for the status; defaults to OK / Warning / Error / Busy / Offline */
|
|
8
6
|
statusLabel?: string;
|
|
9
|
-
/** @deprecated use `statusLabel` */
|
|
10
|
-
stateLabel?: string;
|
|
11
7
|
/** Radiating pulse for live states */
|
|
12
8
|
pulse?: boolean;
|
|
13
9
|
style?: React.CSSProperties;
|
package/data/StatusDot.js
CHANGED
|
@@ -9,22 +9,19 @@ const STATE_TEXT = {
|
|
|
9
9
|
off: 'Offline'
|
|
10
10
|
};
|
|
11
11
|
export function StatusDot({
|
|
12
|
-
status,
|
|
13
|
-
state,
|
|
12
|
+
status = 'ok',
|
|
14
13
|
statusLabel,
|
|
15
|
-
stateLabel,
|
|
16
14
|
label,
|
|
17
15
|
pulse,
|
|
18
16
|
style,
|
|
19
17
|
className,
|
|
20
18
|
...rest
|
|
21
19
|
}) {
|
|
22
|
-
const s = status
|
|
23
|
-
|
|
20
|
+
const s = status;
|
|
24
21
|
// The dot itself is colour-only, so the state must also exist as text. With a
|
|
25
22
|
// visible label the state rides along visually hidden ("Error: API"); without
|
|
26
23
|
// one the whole span becomes an image whose accessible name is the state.
|
|
27
|
-
const stateText =
|
|
24
|
+
const stateText = statusLabel || STATE_TEXT[s] || s;
|
|
28
25
|
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
29
26
|
className: `ef-status ef-status--${s}${pulse ? ' ef-status--pulse' : ''}${className ? ' ' + className : ''}`,
|
|
30
27
|
style: style,
|
package/data/Table.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export interface TableSort {
|
|
|
17
17
|
key: string;
|
|
18
18
|
direction: 'asc' | 'desc';
|
|
19
19
|
}
|
|
20
|
-
export interface TableProps extends React.
|
|
21
|
-
columns
|
|
22
|
-
rows
|
|
20
|
+
export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
21
|
+
columns?: TableColumn[];
|
|
22
|
+
rows?: any[];
|
|
23
23
|
/** Field name or fn for React keys @default index */
|
|
24
24
|
rowKey?: string | ((row: any) => string);
|
|
25
25
|
onRowClick?: (row: any) => void;
|
|
@@ -49,5 +49,12 @@ export interface TableProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
49
49
|
}
|
|
50
50
|
/** Ref lands on the scrolling wrapper element. */
|
|
51
51
|
export declare const Table: React.ForwardRefExoticComponent<
|
|
52
|
-
TableProps & React.RefAttributes<
|
|
52
|
+
TableProps & React.RefAttributes<HTMLTableElement>
|
|
53
53
|
>;
|
|
54
|
+
export declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
55
|
+
export declare const TableBody: typeof TableHeader;
|
|
56
|
+
export declare const TableFooter: typeof TableHeader;
|
|
57
|
+
export declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
58
|
+
export declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
59
|
+
export declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
60
|
+
export declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
package/data/Table.js
CHANGED
|
@@ -19,6 +19,7 @@ export const Table = /*#__PURE__*/React.forwardRef(function Table({
|
|
|
19
19
|
rowKey,
|
|
20
20
|
onRowClick,
|
|
21
21
|
dense,
|
|
22
|
+
children,
|
|
22
23
|
sort: sortProp,
|
|
23
24
|
defaultSort,
|
|
24
25
|
onSortChange,
|
|
@@ -35,6 +36,18 @@ export const Table = /*#__PURE__*/React.forwardRef(function Table({
|
|
|
35
36
|
className,
|
|
36
37
|
...rest
|
|
37
38
|
}, ref) {
|
|
39
|
+
if (!columns || !rows) {
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
"data-slot": "table-container",
|
|
42
|
+
className: "ef-table-wrap"
|
|
43
|
+
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
44
|
+
ref: ref
|
|
45
|
+
}, rest, {
|
|
46
|
+
"data-slot": "table",
|
|
47
|
+
className: `ef-table${dense ? ' ef-table--dense' : ''}${className ? ' ' + className : ''}`,
|
|
48
|
+
style: style
|
|
49
|
+
}), children));
|
|
50
|
+
}
|
|
38
51
|
const key = (row, i) => rowKey ? typeof rowKey === 'function' ? rowKey(row) : row[rowKey] : i;
|
|
39
52
|
const [innerSort, setInnerSort] = React.useState(defaultSort || null);
|
|
40
53
|
const sort = sortProp !== undefined ? sortProp : innerSort;
|
|
@@ -85,11 +98,8 @@ export const Table = /*#__PURE__*/React.forwardRef(function Table({
|
|
|
85
98
|
className: "ef-table__sel"
|
|
86
99
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
87
100
|
"aria-label": allOn ? 'Deselect all rows' : 'Select all rows',
|
|
88
|
-
checked: allOn,
|
|
89
|
-
|
|
90
|
-
if (el) el.indeterminate = someOn;
|
|
91
|
-
},
|
|
92
|
-
onChange: e => applySel(e.target.checked ? allKeys : [])
|
|
101
|
+
checked: allOn ? true : someOn ? 'indeterminate' : false,
|
|
102
|
+
onCheckedChange: next => applySel(next === true ? allKeys : [])
|
|
93
103
|
})) : null, columns.map(c => {
|
|
94
104
|
const on = sort && sort.key === c.key;
|
|
95
105
|
return /*#__PURE__*/React.createElement("th", {
|
|
@@ -138,7 +148,7 @@ export const Table = /*#__PURE__*/React.forwardRef(function Table({
|
|
|
138
148
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
139
149
|
"aria-label": `Select row ${i + 1}`,
|
|
140
150
|
checked: !!isSel,
|
|
141
|
-
|
|
151
|
+
onCheckedChange: next => applySel(next === true ? [...selected, k] : selected.filter(x => x !== k))
|
|
142
152
|
})) : null, columns.map(c => /*#__PURE__*/React.createElement("td", {
|
|
143
153
|
key: c.key,
|
|
144
154
|
className: c.numeric ? 'ef-num' : '',
|
|
@@ -147,4 +157,26 @@ export const Table = /*#__PURE__*/React.forwardRef(function Table({
|
|
|
147
157
|
}
|
|
148
158
|
}, c.render ? c.render(row[c.key], row, i) : row[c.key])));
|
|
149
159
|
}))));
|
|
150
|
-
});
|
|
160
|
+
});
|
|
161
|
+
const tablePart = (tag, slot, displayName) => {
|
|
162
|
+
const Part = /*#__PURE__*/React.forwardRef(function TablePart({
|
|
163
|
+
className,
|
|
164
|
+
...props
|
|
165
|
+
}, ref) {
|
|
166
|
+
return /*#__PURE__*/React.createElement(tag, {
|
|
167
|
+
ref,
|
|
168
|
+
'data-slot': slot,
|
|
169
|
+
className,
|
|
170
|
+
...props
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
Part.displayName = displayName;
|
|
174
|
+
return Part;
|
|
175
|
+
};
|
|
176
|
+
export const TableHeader = tablePart('thead', 'table-header', 'TableHeader');
|
|
177
|
+
export const TableBody = tablePart('tbody', 'table-body', 'TableBody');
|
|
178
|
+
export const TableFooter = tablePart('tfoot', 'table-footer', 'TableFooter');
|
|
179
|
+
export const TableRow = tablePart('tr', 'table-row', 'TableRow');
|
|
180
|
+
export const TableHead = tablePart('th', 'table-head', 'TableHead');
|
|
181
|
+
export const TableCell = tablePart('td', 'table-cell', 'TableCell');
|
|
182
|
+
export const TableCaption = tablePart('caption', 'table-caption', 'TableCaption');
|
package/dates/Calendar.d.ts
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
export interface DateRange {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export interface DateRange { from?: Date; to?: Date }
|
|
2
|
+
export type DateMatcher = Date | Date[] | ((date: Date) => boolean) | { before?: Date; after?: Date; from?: Date; to?: Date; dayOfWeek?: number[] };
|
|
3
|
+
export interface CalendarDayButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { day: { date: Date } | Date; modifiers?: Record<string, boolean>; locale?: string | { code?: string } }
|
|
4
|
+
export declare const CalendarDayButton: React.ForwardRefExoticComponent<CalendarDayButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export interface CalendarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
6
|
+
mode?: 'single' | 'multiple' | 'range'; selected?: Date | Date[] | DateRange; onSelect?: (selected: any, triggerDate: Date, modifiers: Record<string, boolean>, event: unknown) => void;
|
|
7
|
+
month?: Date; defaultMonth?: Date; onMonthChange?: (month: Date) => void; disabled?: DateMatcher; required?: boolean; showOutsideDays?: boolean; fixedWeeks?: boolean; numberOfMonths?: number;
|
|
8
|
+
captionLayout?: 'label' | 'dropdown' | 'dropdown-months' | 'dropdown-years'; startMonth?: Date; endMonth?: Date; locale?: string | { code?: string }; dir?: 'ltr' | 'rtl'; buttonVariant?: string;
|
|
9
|
+
classNames?: Record<string, string>; formatters?: { formatCaption?: (date: Date) => string; formatWeekdayName?: (date: Date) => string }; components?: { DayButton?: React.ComponentType<CalendarDayButtonProps> };
|
|
6
10
|
}
|
|
7
|
-
export
|
|
8
|
-
/** Single-date mode (the default) */
|
|
9
|
-
range?: false;
|
|
10
|
-
/** Selected date as YYYY-MM-DD */
|
|
11
|
-
value?: string;
|
|
12
|
-
onChange?: (date: string) => void;
|
|
13
|
-
/** BCP 47 locale for month and weekday names via Intl (e.g. 'id', 'en'); omit for English. The grid stays Monday-first for every locale. */
|
|
14
|
-
locale?: string;
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
className?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface CalendarRangeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
19
|
-
/** Range mode: value/onChange carry a {from,to} pair; first pick sets from, second sets to (swapped when earlier), third starts over */
|
|
20
|
-
range: true;
|
|
21
|
-
value?: DateRange;
|
|
22
|
-
onChange?: (range: DateRange) => void;
|
|
23
|
-
/** BCP 47 locale for month and weekday names via Intl (e.g. 'id', 'en'); omit for English. The grid stays Monday-first for every locale. */
|
|
24
|
-
locale?: string;
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
|
-
className?: string;
|
|
27
|
-
}
|
|
28
|
-
export declare function Calendar(props: CalendarProps | CalendarRangeProps): React.JSX.Element;
|
|
11
|
+
export declare function Calendar(props: CalendarProps): React.JSX.Element;
|