asterui 0.12.62 → 0.12.63
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/Anchor.d.ts +2 -0
- package/dist/components/Anchor.js +79 -75
- package/dist/components/Anchor.js.map +1 -1
- package/dist/components/Autocomplete.d.ts +1 -0
- package/dist/components/Autocomplete.js +115 -110
- package/dist/components/Autocomplete.js.map +1 -1
- package/dist/components/Breadcrumb.d.ts +4 -2
- package/dist/components/Breadcrumb.js +54 -29
- package/dist/components/Breadcrumb.js.map +1 -1
- package/dist/components/Button.d.ts +5 -1
- package/dist/components/Button.js +117 -107
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Chart.d.ts +1 -0
- package/dist/components/Chart.js +31 -30
- package/dist/components/Chart.js.map +1 -1
- package/dist/components/Chat.d.ts +1 -0
- package/dist/components/Chat.js +32 -30
- package/dist/components/Chat.js.map +1 -1
- package/dist/components/Command.d.ts +5 -2
- package/dist/components/Command.js +262 -233
- package/dist/components/Command.js.map +1 -1
- package/dist/components/ContextMenu.d.ts +4 -0
- package/dist/components/ContextMenu.js +149 -130
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/Dock.d.ts +2 -0
- package/dist/components/Dock.js +70 -46
- package/dist/components/Dock.js.map +1 -1
- package/dist/components/FileInput.d.ts +1 -0
- package/dist/components/FileInput.js +26 -26
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Filter.d.ts +1 -0
- package/dist/components/Filter.js +43 -40
- package/dist/components/Filter.js.map +1 -1
- package/dist/components/Flex.d.ts +1 -0
- package/dist/components/Flex.js +43 -42
- package/dist/components/Flex.js.map +1 -1
- package/dist/components/FloatButton.d.ts +3 -0
- package/dist/components/FloatButton.js +178 -127
- package/dist/components/FloatButton.js.map +1 -1
- package/dist/components/Input.d.ts +1 -0
- package/dist/components/Input.js +201 -184
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Loading.d.ts +1 -0
- package/dist/components/Loading.js +40 -37
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/Masonry.d.ts +1 -0
- package/dist/components/Masonry.js +45 -42
- package/dist/components/Masonry.js.map +1 -1
- package/dist/components/Mention.d.ts +1 -0
- package/dist/components/Mention.js +95 -91
- package/dist/components/Mention.js.map +1 -1
- package/dist/components/MonthCalendar.d.ts +1 -0
- package/dist/components/MonthCalendar.js +104 -97
- package/dist/components/MonthCalendar.js.map +1 -1
- package/dist/components/QRCode.d.ts +1 -0
- package/dist/components/QRCode.js +84 -55
- package/dist/components/QRCode.js.map +1 -1
- package/dist/components/RadialProgress.d.ts +1 -0
- package/dist/components/RadialProgress.js +19 -17
- package/dist/components/RadialProgress.js.map +1 -1
- package/dist/components/Range.d.ts +1 -0
- package/dist/components/Range.js +45 -43
- package/dist/components/Range.js.map +1 -1
- package/dist/components/Rating.d.ts +4 -2
- package/dist/components/Rating.js +83 -79
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/Responsive.d.ts +4 -2
- package/dist/components/Responsive.js +10 -9
- package/dist/components/Responsive.js.map +1 -1
- package/dist/components/Result.d.ts +1 -0
- package/dist/components/Result.js +24 -22
- package/dist/components/Result.js.map +1 -1
- package/dist/components/Select.d.ts +1 -0
- package/dist/components/Select.js +72 -62
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Splitter.d.ts +2 -0
- package/dist/components/Splitter.js +137 -131
- package/dist/components/Splitter.js.map +1 -1
- package/dist/components/Stat.d.ts +4 -2
- package/dist/components/Stat.js +19 -18
- package/dist/components/Stat.js.map +1 -1
- package/dist/components/Steps.d.ts +4 -2
- package/dist/components/Steps.js +56 -52
- package/dist/components/Steps.js.map +1 -1
- package/dist/components/TextRotate.d.ts +1 -0
- package/dist/components/TextRotate.js +14 -12
- package/dist/components/TextRotate.js.map +1 -1
- package/dist/components/Textarea.d.ts +1 -0
- package/dist/components/Textarea.js +31 -30
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/ThemeController.d.ts +6 -3
- package/dist/components/ThemeController.js +101 -92
- package/dist/components/ThemeController.js.map +1 -1
- package/dist/components/Typography.d.ts +10 -5
- package/dist/components/Typography.js +84 -81
- package/dist/components/Typography.js.map +1 -1
- package/dist/components/VirtualList.d.ts +2 -1
- package/dist/components/VirtualList.js +40 -36
- package/dist/components/VirtualList.js.map +1 -1
- package/dist/components/Watermark.d.ts +1 -0
- package/dist/components/Watermark.js +74 -71
- package/dist/components/Watermark.js.map +1 -1
- package/dist/components/WeekCalendar.d.ts +1 -0
- package/dist/components/WeekCalendar.js +91 -76
- package/dist/components/WeekCalendar.js.map +1 -1
- package/package.json +1 -1
package/dist/components/Chart.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as p, useEffect as m } from "react";
|
|
3
|
-
import
|
|
4
|
-
import { useTheme as
|
|
5
|
-
function
|
|
3
|
+
import k from "apexcharts";
|
|
4
|
+
import { useTheme as A } from "../hooks/useTheme.js";
|
|
5
|
+
function a(t, o) {
|
|
6
6
|
const l = { ...t };
|
|
7
|
-
for (const
|
|
8
|
-
e
|
|
9
|
-
t[
|
|
10
|
-
e
|
|
11
|
-
) : l[
|
|
7
|
+
for (const e in o)
|
|
8
|
+
o[e] !== void 0 && (typeof o[e] == "object" && o[e] !== null && !Array.isArray(o[e]) && typeof t[e] == "object" && t[e] !== null && !Array.isArray(t[e]) ? l[e] = a(
|
|
9
|
+
t[e],
|
|
10
|
+
o[e]
|
|
11
|
+
) : l[e] = o[e]);
|
|
12
12
|
return l;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const T = ({
|
|
15
15
|
type: t,
|
|
16
|
-
series:
|
|
16
|
+
series: o,
|
|
17
17
|
width: l = "100%",
|
|
18
|
-
height:
|
|
19
|
-
options:
|
|
20
|
-
themed:
|
|
21
|
-
className: y = ""
|
|
18
|
+
height: e = 350,
|
|
19
|
+
options: c = {},
|
|
20
|
+
themed: f = !0,
|
|
21
|
+
className: y = "",
|
|
22
|
+
"data-testid": h
|
|
22
23
|
}) => {
|
|
23
|
-
const u = p(null), n = p(null), { isDark:
|
|
24
|
+
const u = p(null), n = p(null), { isDark: d, colors: r } = A(), b = () => ({
|
|
24
25
|
colors: [
|
|
25
26
|
r.primary,
|
|
26
27
|
r.secondary,
|
|
@@ -31,7 +32,7 @@ const j = ({
|
|
|
31
32
|
r.error
|
|
32
33
|
],
|
|
33
34
|
theme: {
|
|
34
|
-
mode:
|
|
35
|
+
mode: d ? "dark" : "light"
|
|
35
36
|
},
|
|
36
37
|
chart: {
|
|
37
38
|
background: "transparent",
|
|
@@ -67,7 +68,7 @@ const j = ({
|
|
|
67
68
|
}
|
|
68
69
|
},
|
|
69
70
|
tooltip: {
|
|
70
|
-
theme:
|
|
71
|
+
theme: d ? "dark" : "light",
|
|
71
72
|
style: {
|
|
72
73
|
fontSize: "12px"
|
|
73
74
|
},
|
|
@@ -89,34 +90,34 @@ const j = ({
|
|
|
89
90
|
enabled: !1
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
}),
|
|
93
|
+
}), i = () => {
|
|
93
94
|
const s = {
|
|
94
95
|
chart: {
|
|
95
96
|
type: t,
|
|
96
97
|
width: l,
|
|
97
|
-
height:
|
|
98
|
+
height: e
|
|
98
99
|
},
|
|
99
|
-
series:
|
|
100
|
+
series: o
|
|
100
101
|
};
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
return
|
|
102
|
+
if (f) {
|
|
103
|
+
const g = b();
|
|
104
|
+
return a(a(s, g), c);
|
|
104
105
|
}
|
|
105
|
-
return
|
|
106
|
+
return a(s, c);
|
|
106
107
|
};
|
|
107
108
|
return m(() => {
|
|
108
109
|
if (!u.current) return;
|
|
109
|
-
const s =
|
|
110
|
-
return n.current = new
|
|
110
|
+
const s = i();
|
|
111
|
+
return n.current = new k(u.current, s), n.current.render(), () => {
|
|
111
112
|
n.current && (n.current.destroy(), n.current = null);
|
|
112
113
|
};
|
|
113
114
|
}, []), m(() => {
|
|
114
115
|
if (!n.current) return;
|
|
115
|
-
const s =
|
|
116
|
+
const s = i();
|
|
116
117
|
n.current.updateOptions(s, !0, !0);
|
|
117
|
-
}, [t,
|
|
118
|
+
}, [t, o, l, e, c, f, d, r]), /* @__PURE__ */ x("div", { ref: u, className: y, "data-testid": h });
|
|
118
119
|
};
|
|
119
120
|
export {
|
|
120
|
-
|
|
121
|
+
T as Chart
|
|
121
122
|
};
|
|
122
123
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sources":["../../src/components/Chart.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react'\nimport ApexCharts from 'apexcharts'\nimport type { ApexOptions } from 'apexcharts'\nimport { useTheme } from '../hooks/useTheme'\n\nexport interface ChartProps {\n /** Chart type */\n type: 'line' | 'area' | 'bar' | 'pie' | 'donut' | 'radialBar' | 'scatter' | 'bubble' | 'heatmap' | 'candlestick' | 'boxPlot' | 'radar' | 'polarArea' | 'rangeBar' | 'rangeArea' | 'treemap'\n /** Chart series data */\n series: ApexAxisChartSeries | ApexNonAxisChartSeries\n /** Chart width */\n width?: string | number\n /** Chart height */\n height?: string | number\n /** ApexCharts options (merged with theme defaults) */\n options?: ApexOptions\n /** Use daisyUI theme colors */\n themed?: boolean\n /** Additional CSS classes */\n className?: string\n}\n\n// Deep merge objects\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target }\n\n for (const key in source) {\n if (source[key] !== undefined) {\n if (\n typeof source[key] === 'object' &&\n source[key] !== null &&\n !Array.isArray(source[key]) &&\n typeof target[key] === 'object' &&\n target[key] !== null &&\n !Array.isArray(target[key])\n ) {\n result[key] = deepMerge(\n target[key] as Record<string, unknown>,\n source[key] as Record<string, unknown>\n ) as T[Extract<keyof T, string>]\n } else {\n result[key] = source[key] as T[Extract<keyof T, string>]\n }\n }\n }\n\n return result\n}\n\nexport const Chart: React.FC<ChartProps> = ({\n type,\n series,\n width = '100%',\n height = 350,\n options = {},\n themed = true,\n className = '',\n}) => {\n const chartRef = useRef<HTMLDivElement>(null)\n const chartInstance = useRef<ApexCharts | null>(null)\n const { isDark, colors } = useTheme()\n\n // Build theme-aware chart options\n const getThemedOptions = (): Partial<ApexOptions> => {\n const chartColors = [\n colors.primary,\n colors.secondary,\n colors.accent,\n colors.info,\n colors.success,\n colors.warning,\n colors.error,\n ]\n\n return {\n colors: chartColors,\n theme: {\n mode: isDark ? 'dark' : 'light',\n },\n chart: {\n background: 'transparent',\n foreColor: colors.foreground,\n },\n grid: {\n borderColor: colors.foreground + '20', // 12.5% opacity\n },\n xaxis: {\n labels: {\n style: {\n colors: colors.foreground,\n },\n },\n axisBorder: {\n color: colors.foreground + '20',\n },\n axisTicks: {\n color: colors.foreground + '20',\n },\n },\n yaxis: {\n labels: {\n style: {\n colors: colors.foreground,\n },\n },\n },\n legend: {\n labels: {\n colors: colors.foreground,\n },\n },\n tooltip: {\n theme: isDark ? 'dark' : 'light',\n style: {\n fontSize: '12px',\n },\n x: {\n show: true,\n },\n marker: {\n show: true,\n },\n },\n dataLabels: {\n style: {\n colors: Array(7).fill(colors.foreground),\n },\n background: {\n enabled: false,\n },\n dropShadow: {\n enabled: false,\n },\n },\n }\n }\n\n // Build final options\n const buildOptions = (): ApexOptions => {\n const baseOptions: ApexOptions = {\n chart: {\n type,\n width,\n height,\n },\n series,\n }\n\n if (themed) {\n const themedOpts = getThemedOptions()\n return deepMerge(deepMerge(baseOptions as unknown as Record<string, unknown>, themedOpts as unknown as Record<string, unknown>), options as unknown as Record<string, unknown>) as ApexOptions\n }\n\n return deepMerge(baseOptions as unknown as Record<string, unknown>, options as unknown as Record<string, unknown>) as ApexOptions\n }\n\n // Initialize chart\n useEffect(() => {\n if (!chartRef.current) return\n\n const opts = buildOptions()\n chartInstance.current = new ApexCharts(chartRef.current, opts)\n chartInstance.current.render()\n\n return () => {\n if (chartInstance.current) {\n chartInstance.current.destroy()\n chartInstance.current = null\n }\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n // Update chart when props or theme change\n useEffect(() => {\n if (!chartInstance.current) return\n\n const opts = buildOptions()\n chartInstance.current.updateOptions(opts, true, true)\n }, [type, series, width, height, options, themed, isDark, colors]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return <div ref={chartRef} className={className} />\n}\n"],"names":["deepMerge","target","source","result","key","Chart","type","series","width","height","options","themed","className","chartRef","useRef","chartInstance","isDark","colors","useTheme","getThemedOptions","buildOptions","baseOptions","themedOpts","useEffect","opts","ApexCharts"
|
|
1
|
+
{"version":3,"file":"Chart.js","sources":["../../src/components/Chart.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react'\nimport ApexCharts from 'apexcharts'\nimport type { ApexOptions } from 'apexcharts'\nimport { useTheme } from '../hooks/useTheme'\n\nexport interface ChartProps {\n /** Chart type */\n type: 'line' | 'area' | 'bar' | 'pie' | 'donut' | 'radialBar' | 'scatter' | 'bubble' | 'heatmap' | 'candlestick' | 'boxPlot' | 'radar' | 'polarArea' | 'rangeBar' | 'rangeArea' | 'treemap'\n /** Chart series data */\n series: ApexAxisChartSeries | ApexNonAxisChartSeries\n /** Chart width */\n width?: string | number\n /** Chart height */\n height?: string | number\n /** ApexCharts options (merged with theme defaults) */\n options?: ApexOptions\n /** Use daisyUI theme colors */\n themed?: boolean\n /** Additional CSS classes */\n className?: string\n 'data-testid'?: string\n}\n\n// Deep merge objects\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target }\n\n for (const key in source) {\n if (source[key] !== undefined) {\n if (\n typeof source[key] === 'object' &&\n source[key] !== null &&\n !Array.isArray(source[key]) &&\n typeof target[key] === 'object' &&\n target[key] !== null &&\n !Array.isArray(target[key])\n ) {\n result[key] = deepMerge(\n target[key] as Record<string, unknown>,\n source[key] as Record<string, unknown>\n ) as T[Extract<keyof T, string>]\n } else {\n result[key] = source[key] as T[Extract<keyof T, string>]\n }\n }\n }\n\n return result\n}\n\nexport const Chart: React.FC<ChartProps> = ({\n type,\n series,\n width = '100%',\n height = 350,\n options = {},\n themed = true,\n className = '',\n 'data-testid': testId,\n}) => {\n const chartRef = useRef<HTMLDivElement>(null)\n const chartInstance = useRef<ApexCharts | null>(null)\n const { isDark, colors } = useTheme()\n\n // Build theme-aware chart options\n const getThemedOptions = (): Partial<ApexOptions> => {\n const chartColors = [\n colors.primary,\n colors.secondary,\n colors.accent,\n colors.info,\n colors.success,\n colors.warning,\n colors.error,\n ]\n\n return {\n colors: chartColors,\n theme: {\n mode: isDark ? 'dark' : 'light',\n },\n chart: {\n background: 'transparent',\n foreColor: colors.foreground,\n },\n grid: {\n borderColor: colors.foreground + '20', // 12.5% opacity\n },\n xaxis: {\n labels: {\n style: {\n colors: colors.foreground,\n },\n },\n axisBorder: {\n color: colors.foreground + '20',\n },\n axisTicks: {\n color: colors.foreground + '20',\n },\n },\n yaxis: {\n labels: {\n style: {\n colors: colors.foreground,\n },\n },\n },\n legend: {\n labels: {\n colors: colors.foreground,\n },\n },\n tooltip: {\n theme: isDark ? 'dark' : 'light',\n style: {\n fontSize: '12px',\n },\n x: {\n show: true,\n },\n marker: {\n show: true,\n },\n },\n dataLabels: {\n style: {\n colors: Array(7).fill(colors.foreground),\n },\n background: {\n enabled: false,\n },\n dropShadow: {\n enabled: false,\n },\n },\n }\n }\n\n // Build final options\n const buildOptions = (): ApexOptions => {\n const baseOptions: ApexOptions = {\n chart: {\n type,\n width,\n height,\n },\n series,\n }\n\n if (themed) {\n const themedOpts = getThemedOptions()\n return deepMerge(deepMerge(baseOptions as unknown as Record<string, unknown>, themedOpts as unknown as Record<string, unknown>), options as unknown as Record<string, unknown>) as ApexOptions\n }\n\n return deepMerge(baseOptions as unknown as Record<string, unknown>, options as unknown as Record<string, unknown>) as ApexOptions\n }\n\n // Initialize chart\n useEffect(() => {\n if (!chartRef.current) return\n\n const opts = buildOptions()\n chartInstance.current = new ApexCharts(chartRef.current, opts)\n chartInstance.current.render()\n\n return () => {\n if (chartInstance.current) {\n chartInstance.current.destroy()\n chartInstance.current = null\n }\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n // Update chart when props or theme change\n useEffect(() => {\n if (!chartInstance.current) return\n\n const opts = buildOptions()\n chartInstance.current.updateOptions(opts, true, true)\n }, [type, series, width, height, options, themed, isDark, colors]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return <div ref={chartRef} className={className} data-testid={testId} />\n}\n"],"names":["deepMerge","target","source","result","key","Chart","type","series","width","height","options","themed","className","testId","chartRef","useRef","chartInstance","isDark","colors","useTheme","getThemedOptions","buildOptions","baseOptions","themedOpts","useEffect","opts","ApexCharts"],"mappings":";;;;AAwBA,SAASA,EAA6CC,GAAWC,GAAuB;AACtF,QAAMC,IAAS,EAAE,GAAGF,EAAA;AAEpB,aAAWG,KAAOF;AAChB,IAAIA,EAAOE,CAAG,MAAM,WAEhB,OAAOF,EAAOE,CAAG,KAAM,YACvBF,EAAOE,CAAG,MAAM,QAChB,CAAC,MAAM,QAAQF,EAAOE,CAAG,CAAC,KAC1B,OAAOH,EAAOG,CAAG,KAAM,YACvBH,EAAOG,CAAG,MAAM,QAChB,CAAC,MAAM,QAAQH,EAAOG,CAAG,CAAC,IAE1BD,EAAOC,CAAG,IAAIJ;AAAA,MACZC,EAAOG,CAAG;AAAA,MACVF,EAAOE,CAAG;AAAA,IAAA,IAGZD,EAAOC,CAAG,IAAIF,EAAOE,CAAG;AAK9B,SAAOD;AACT;AAEO,MAAME,IAA8B,CAAC;AAAA,EAC1C,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU,CAAA;AAAA,EACV,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,eAAeC;AACjB,MAAM;AACJ,QAAMC,IAAWC,EAAuB,IAAI,GACtCC,IAAgBD,E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A;AAAA,MAEX,YAAY;AAAA,QACV,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,EACF,IAKEG,IAAe,MAAmB;AACtC,UAAMC,IAA2B;AAAA,MAC/B,OAAO;AAAA,QACL,MAAAhB;AAAA,QACA,OAAAE;AAAA,QACA,QAAAC;AAAA,MAAA;AAAA,MAEF,QAAAF;AAAA,IAAA;AAGF,QAAII,GAAQ;AACV,YAAMY,IAAaH,EAAA;AACnB,aAAOpB,EAAUA,EAAUsB,GAAmDC,CAAgD,GAAGb,CAA6C;AAAA,IAChL;AAEA,WAAOV,EAAUsB,GAAmDZ,CAA6C;AAAA,EACnH;AAGA,SAAAc,EAAU,MAAM;AACd,QAAI,CAACV,EAAS,QAAS;AAEvB,UAAMW,IAAOJ,EAAA;AACb,WAAAL,EAAc,UAAU,IAAIU,EAAWZ,EAAS,SAASW,CAAI,GAC7DT,EAAc,QAAQ,OAAA,GAEf,MAAM;AACX,MAAIA,EAAc,YAChBA,EAAc,QAAQ,QAAA,GACtBA,EAAc,UAAU;AAAA,IAE5B;AAAA,EACF,GAAG,CAAA,CAAE,GAGLQ,EAAU,MAAM;AACd,QAAI,CAACR,EAAc,QAAS;AAE5B,UAAMS,IAAOJ,EAAA;AACb,IAAAL,EAAc,QAAQ,cAAcS,GAAM,IAAM,EAAI;AAAA,EACtD,GAAG,CAACnB,GAAMC,GAAQC,GAAOC,GAAQC,GAASC,GAAQM,GAAQC,CAAM,CAAC,qBAEzD,OAAA,EAAI,KAAKJ,GAAU,WAAAF,GAAsB,eAAaC,GAAQ;AACxE;"}
|
|
@@ -7,5 +7,6 @@ export interface ChatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
header?: React.ReactNode;
|
|
8
8
|
footer?: React.ReactNode;
|
|
9
9
|
color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
|
|
10
|
+
'data-testid'?: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const Chat: React.FC<ChatProps>;
|
package/dist/components/Chat.js
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useId as
|
|
3
|
-
const
|
|
4
|
-
message:
|
|
5
|
-
position:
|
|
6
|
-
avatar:
|
|
7
|
-
avatarAlt:
|
|
8
|
-
header:
|
|
9
|
-
footer:
|
|
10
|
-
color:
|
|
11
|
-
className:
|
|
12
|
-
|
|
1
|
+
import { jsxs as B, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useId as f } from "react";
|
|
3
|
+
const g = "chat", p = "chat-start", y = "chat-end", N = "chat-image", $ = "chat-header", j = "chat-bubble", w = "chat-bubble-primary", x = "chat-bubble-secondary", I = "chat-bubble-accent", S = "chat-bubble-neutral", A = "chat-bubble-info", E = "chat-bubble-success", F = "chat-bubble-warning", H = "chat-bubble-error", P = "chat-footer", T = "avatar", q = ({
|
|
4
|
+
message: o,
|
|
5
|
+
position: h = "start",
|
|
6
|
+
avatar: b,
|
|
7
|
+
avatarAlt: i = "",
|
|
8
|
+
header: e,
|
|
9
|
+
footer: d,
|
|
10
|
+
color: s,
|
|
11
|
+
className: u = "",
|
|
12
|
+
"data-testid": c,
|
|
13
|
+
...C
|
|
13
14
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
primary:
|
|
16
|
-
secondary:
|
|
15
|
+
const n = f(), m = h === "start" ? p : y, a = (v) => c ? `${c}-${v}` : void 0, r = {
|
|
16
|
+
primary: w,
|
|
17
|
+
secondary: x,
|
|
17
18
|
accent: I,
|
|
18
|
-
neutral:
|
|
19
|
-
info:
|
|
20
|
-
success:
|
|
21
|
-
warning:
|
|
22
|
-
error:
|
|
23
|
-
},
|
|
24
|
-
return
|
|
19
|
+
neutral: S,
|
|
20
|
+
info: A,
|
|
21
|
+
success: E,
|
|
22
|
+
warning: F,
|
|
23
|
+
error: H
|
|
24
|
+
}, l = [j];
|
|
25
|
+
return s && r[s] && l.push(r[s]), /* @__PURE__ */ B(
|
|
25
26
|
"article",
|
|
26
27
|
{
|
|
27
|
-
className: `${
|
|
28
|
-
"aria-labelledby":
|
|
29
|
-
|
|
28
|
+
className: `${g} ${m} ${u}`,
|
|
29
|
+
"aria-labelledby": e ? n : void 0,
|
|
30
|
+
"data-testid": c,
|
|
31
|
+
...C,
|
|
30
32
|
children: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */ t("div", { className:
|
|
34
|
-
|
|
33
|
+
b && /* @__PURE__ */ t("div", { className: `${N} ${T}`, "data-testid": a("avatar"), children: /* @__PURE__ */ t("div", { className: "w-10 rounded-full", children: /* @__PURE__ */ t("img", { alt: i, src: b }) }) }),
|
|
34
|
+
e && /* @__PURE__ */ t("div", { id: n, className: $, "data-testid": a("header"), children: e }),
|
|
35
|
+
/* @__PURE__ */ t("div", { className: l.join(" "), "data-testid": a("bubble"), children: o }),
|
|
36
|
+
d && /* @__PURE__ */ t("div", { className: P, "data-testid": a("footer"), children: d })
|
|
35
37
|
]
|
|
36
38
|
}
|
|
37
39
|
);
|
|
38
40
|
};
|
|
39
41
|
export {
|
|
40
|
-
|
|
42
|
+
q as Chat
|
|
41
43
|
};
|
|
42
44
|
//# sourceMappingURL=Chat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.js","sources":["../../src/components/Chat.tsx"],"sourcesContent":["import React, { useId } from 'react'\n\n// DaisyUI classes\nconst dChat = 'chat'\nconst dChatStart = 'chat-start'\nconst dChatEnd = 'chat-end'\nconst dChatImage = 'chat-image'\nconst dChatHeader = 'chat-header'\nconst dChatBubble = 'chat-bubble'\nconst dChatBubblePrimary = 'chat-bubble-primary'\nconst dChatBubbleSecondary = 'chat-bubble-secondary'\nconst dChatBubbleAccent = 'chat-bubble-accent'\nconst dChatBubbleNeutral = 'chat-bubble-neutral'\nconst dChatBubbleInfo = 'chat-bubble-info'\nconst dChatBubbleSuccess = 'chat-bubble-success'\nconst dChatBubbleWarning = 'chat-bubble-warning'\nconst dChatBubbleError = 'chat-bubble-error'\nconst dChatFooter = 'chat-footer'\nconst dAvatar = 'avatar'\n\nexport interface ChatProps extends React.HTMLAttributes<HTMLDivElement> {\n message: React.ReactNode\n position?: 'start' | 'end'\n avatar?: string\n avatarAlt?: string\n header?: React.ReactNode\n footer?: React.ReactNode\n color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error'\n}\n\nexport const Chat: React.FC<ChatProps> = ({\n message,\n position = 'start',\n avatar,\n avatarAlt = '',\n header,\n footer,\n color,\n className = '',\n ...rest\n}) => {\n const headerId = useId()\n const positionClass = position === 'start' ? dChatStart : dChatEnd\n\n const colorClasses: Record<string, string> = {\n primary: dChatBubblePrimary,\n secondary: dChatBubbleSecondary,\n accent: dChatBubbleAccent,\n neutral: dChatBubbleNeutral,\n info: dChatBubbleInfo,\n success: dChatBubbleSuccess,\n warning: dChatBubbleWarning,\n error: dChatBubbleError,\n }\n\n const bubbleClasses = [dChatBubble]\n if (color && colorClasses[color]) {\n bubbleClasses.push(colorClasses[color])\n }\n\n return (\n <article\n className={`${dChat} ${positionClass} ${className}`}\n aria-labelledby={header ? headerId : undefined}\n {...rest}\n >\n {avatar && (\n <div className={`${dChatImage} ${dAvatar}`}>\n <div className=\"w-10 rounded-full\">\n <img alt={avatarAlt} src={avatar} />\n </div>\n </div>\n )}\n {header && <div id={headerId} className={dChatHeader}>{header}</div>}\n <div className={bubbleClasses.join(' ')}>{message}</div>\n {footer && <div className={dChatFooter}>{footer}</div>}\n </article>\n )\n}\n"],"names":["dChat","dChatStart","dChatEnd","dChatImage","dChatHeader","dChatBubble","dChatBubblePrimary","dChatBubbleSecondary","dChatBubbleAccent","dChatBubbleNeutral","dChatBubbleInfo","dChatBubbleSuccess","dChatBubbleWarning","dChatBubbleError","dChatFooter","dAvatar","Chat","message","position","avatar","avatarAlt","header","footer","color","className","rest","headerId","useId","positionClass","colorClasses","bubbleClasses","jsxs","jsx"],"mappings":";;AAGA,MAAMA,IAAQ,QACRC,IAAa,cACbC,IAAW,YACXC,IAAa,cACbC,IAAc,eACdC,IAAc,eACdC,IAAqB,uBACrBC,IAAuB,yBACvBC,IAAoB,sBACpBC,IAAqB,uBACrBC,IAAkB,oBAClBC,IAAqB,uBACrBC,IAAqB,uBACrBC,IAAmB,qBACnBC,IAAc,eACdC,IAAU,
|
|
1
|
+
{"version":3,"file":"Chat.js","sources":["../../src/components/Chat.tsx"],"sourcesContent":["import React, { useId } from 'react'\n\n// DaisyUI classes\nconst dChat = 'chat'\nconst dChatStart = 'chat-start'\nconst dChatEnd = 'chat-end'\nconst dChatImage = 'chat-image'\nconst dChatHeader = 'chat-header'\nconst dChatBubble = 'chat-bubble'\nconst dChatBubblePrimary = 'chat-bubble-primary'\nconst dChatBubbleSecondary = 'chat-bubble-secondary'\nconst dChatBubbleAccent = 'chat-bubble-accent'\nconst dChatBubbleNeutral = 'chat-bubble-neutral'\nconst dChatBubbleInfo = 'chat-bubble-info'\nconst dChatBubbleSuccess = 'chat-bubble-success'\nconst dChatBubbleWarning = 'chat-bubble-warning'\nconst dChatBubbleError = 'chat-bubble-error'\nconst dChatFooter = 'chat-footer'\nconst dAvatar = 'avatar'\n\nexport interface ChatProps extends React.HTMLAttributes<HTMLDivElement> {\n message: React.ReactNode\n position?: 'start' | 'end'\n avatar?: string\n avatarAlt?: string\n header?: React.ReactNode\n footer?: React.ReactNode\n color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error'\n 'data-testid'?: string\n}\n\nexport const Chat: React.FC<ChatProps> = ({\n message,\n position = 'start',\n avatar,\n avatarAlt = '',\n header,\n footer,\n color,\n className = '',\n 'data-testid': testId,\n ...rest\n}) => {\n const headerId = useId()\n const positionClass = position === 'start' ? dChatStart : dChatEnd\n const getTestId = (suffix: string) => (testId ? `${testId}-${suffix}` : undefined)\n\n const colorClasses: Record<string, string> = {\n primary: dChatBubblePrimary,\n secondary: dChatBubbleSecondary,\n accent: dChatBubbleAccent,\n neutral: dChatBubbleNeutral,\n info: dChatBubbleInfo,\n success: dChatBubbleSuccess,\n warning: dChatBubbleWarning,\n error: dChatBubbleError,\n }\n\n const bubbleClasses = [dChatBubble]\n if (color && colorClasses[color]) {\n bubbleClasses.push(colorClasses[color])\n }\n\n return (\n <article\n className={`${dChat} ${positionClass} ${className}`}\n aria-labelledby={header ? headerId : undefined}\n data-testid={testId}\n {...rest}\n >\n {avatar && (\n <div className={`${dChatImage} ${dAvatar}`} data-testid={getTestId('avatar')}>\n <div className=\"w-10 rounded-full\">\n <img alt={avatarAlt} src={avatar} />\n </div>\n </div>\n )}\n {header && <div id={headerId} className={dChatHeader} data-testid={getTestId('header')}>{header}</div>}\n <div className={bubbleClasses.join(' ')} data-testid={getTestId('bubble')}>{message}</div>\n {footer && <div className={dChatFooter} data-testid={getTestId('footer')}>{footer}</div>}\n </article>\n )\n}\n"],"names":["dChat","dChatStart","dChatEnd","dChatImage","dChatHeader","dChatBubble","dChatBubblePrimary","dChatBubbleSecondary","dChatBubbleAccent","dChatBubbleNeutral","dChatBubbleInfo","dChatBubbleSuccess","dChatBubbleWarning","dChatBubbleError","dChatFooter","dAvatar","Chat","message","position","avatar","avatarAlt","header","footer","color","className","testId","rest","headerId","useId","positionClass","getTestId","suffix","colorClasses","bubbleClasses","jsxs","jsx"],"mappings":";;AAGA,MAAMA,IAAQ,QACRC,IAAa,cACbC,IAAW,YACXC,IAAa,cACbC,IAAc,eACdC,IAAc,eACdC,IAAqB,uBACrBC,IAAuB,yBACvBC,IAAoB,sBACpBC,IAAqB,uBACrBC,IAAkB,oBAClBC,IAAqB,uBACrBC,IAAqB,uBACrBC,IAAmB,qBACnBC,IAAc,eACdC,IAAU,UAaHC,IAA4B,CAAC;AAAA,EACxC,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,W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AAAA,IAAA;AAAA,EAAA;AAGxF;"}
|
|
@@ -19,12 +19,14 @@ export interface CommandProps extends Omit<React.HTMLAttributes<HTMLDialogElemen
|
|
|
19
19
|
shortcut?: string[];
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
emptyMessage?: React.ReactNode;
|
|
22
|
+
'data-testid'?: string;
|
|
22
23
|
}
|
|
23
24
|
interface CommandInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
|
|
24
25
|
value?: string;
|
|
25
26
|
onValueChange?: (value: string) => void;
|
|
27
|
+
'data-testid'?: string;
|
|
26
28
|
}
|
|
27
|
-
declare function CommandInput({ placeholder, value, onValueChange, ...rest }: CommandInputProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare function CommandInput({ placeholder, value, onValueChange, 'data-testid': testId, ...rest }: CommandInputProps): import("react/jsx-runtime").JSX.Element;
|
|
28
30
|
interface CommandListProps {
|
|
29
31
|
children: React.ReactNode;
|
|
30
32
|
}
|
|
@@ -41,8 +43,9 @@ interface CommandItemProps {
|
|
|
41
43
|
disabled?: boolean;
|
|
42
44
|
keywords?: string[];
|
|
43
45
|
icon?: React.ReactNode;
|
|
46
|
+
'data-testid'?: string;
|
|
44
47
|
}
|
|
45
|
-
declare function CommandItem({ children, value, onSelect, disabled, keywords, icon, }: CommandItemProps): import("react/jsx-runtime").JSX.Element | null;
|
|
48
|
+
declare function CommandItem({ children, value, onSelect, disabled, keywords, icon, 'data-testid': testId, }: CommandItemProps): import("react/jsx-runtime").JSX.Element | null;
|
|
46
49
|
interface CommandEmptyProps {
|
|
47
50
|
children?: React.ReactNode;
|
|
48
51
|
}
|