@andreagiugni/tailwind-dashboard-ui 0.5.0 → 0.5.1
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/{chunk-OSIOO5AE.cjs → chunk-2C5QY3Z2.cjs} +22 -6
- package/dist/chunk-2C5QY3Z2.cjs.map +1 -0
- package/dist/{chunk-BGA7AECV.cjs → chunk-3EE6CPHW.cjs} +11 -3
- package/dist/chunk-3EE6CPHW.cjs.map +1 -0
- package/dist/{chunk-3T6AZMUZ.cjs → chunk-MYN5LDMO.cjs} +88 -62
- package/dist/chunk-MYN5LDMO.cjs.map +1 -0
- package/dist/{chunk-MEU4PMP5.js → chunk-NWIOJGF7.js} +11 -3
- package/dist/chunk-NWIOJGF7.js.map +1 -0
- package/dist/{chunk-AGRX5ZR6.js → chunk-P7LI2FSR.js} +90 -64
- package/dist/chunk-P7LI2FSR.js.map +1 -0
- package/dist/{chunk-HZQZC5CK.js → chunk-YAKIMPXZ.js} +22 -6
- package/dist/chunk-YAKIMPXZ.js.map +1 -0
- package/dist/components/Charts/BarChart.cjs +2 -2
- package/dist/components/Charts/BarChart.js +1 -1
- package/dist/components/Charts/LineChart.cjs +2 -2
- package/dist/components/Charts/LineChart.js +1 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +2 -2
- package/dist/components/ColorPicker/ColorPicker.js +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3T6AZMUZ.cjs.map +0 -1
- package/dist/chunk-AGRX5ZR6.js.map +0 -1
- package/dist/chunk-BGA7AECV.cjs.map +0 -1
- package/dist/chunk-HZQZC5CK.js.map +0 -1
- package/dist/chunk-MEU4PMP5.js.map +0 -1
- package/dist/chunk-OSIOO5AE.cjs.map +0 -1
|
@@ -29,10 +29,12 @@ var defaultOptions = {
|
|
|
29
29
|
dataLabels: {
|
|
30
30
|
enabled: false
|
|
31
31
|
},
|
|
32
|
+
// No transparent stroke around the columns: it shrinks and shifts the
|
|
33
|
+
// painted bar inside its allocated slot, so the hover highlight band
|
|
34
|
+
// (crosshairs width "barWidth" = the allocated width) would render wider
|
|
35
|
+
// than — and offset from — the visible bar.
|
|
32
36
|
stroke: {
|
|
33
|
-
show:
|
|
34
|
-
width: 4,
|
|
35
|
-
colors: ["transparent"]
|
|
37
|
+
show: false
|
|
36
38
|
},
|
|
37
39
|
xaxis: {
|
|
38
40
|
categories: [
|
|
@@ -54,13 +56,27 @@ var defaultOptions = {
|
|
|
54
56
|
},
|
|
55
57
|
axisTicks: {
|
|
56
58
|
show: false
|
|
59
|
+
},
|
|
60
|
+
// Match the hover highlight band to the bar width (the default band spans
|
|
61
|
+
// the whole category slot, looking ~3x wider than the 39% columns).
|
|
62
|
+
crosshairs: {
|
|
63
|
+
width: "barWidth"
|
|
57
64
|
}
|
|
58
65
|
},
|
|
59
66
|
legend: {
|
|
60
67
|
show: true,
|
|
61
68
|
position: "top",
|
|
62
69
|
horizontalAlign: "left",
|
|
63
|
-
fontFamily: "Outfit"
|
|
70
|
+
fontFamily: "Outfit",
|
|
71
|
+
// Rounded, border-less swatches that echo the column styling. ApexCharts
|
|
72
|
+
// sets the marker span's `color` to the series color, so `currentColor`
|
|
73
|
+
// picks it up; `customHTML` lets us round the corners (the built-in shapes
|
|
74
|
+
// are sharp SVG paths that CSS border-radius can't touch).
|
|
75
|
+
markers: {
|
|
76
|
+
size: 7,
|
|
77
|
+
strokeWidth: 0,
|
|
78
|
+
customHTML: () => '<span style="display:block;height:100%;width:100%;border-radius:3px;background:currentColor"></span>'
|
|
79
|
+
}
|
|
64
80
|
},
|
|
65
81
|
yaxis: {
|
|
66
82
|
title: {
|
|
@@ -126,5 +142,5 @@ var BarChart = ({
|
|
|
126
142
|
};
|
|
127
143
|
|
|
128
144
|
exports.BarChart = BarChart;
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
145
|
+
//# sourceMappingURL=chunk-2C5QY3Z2.cjs.map
|
|
146
|
+
//# sourceMappingURL=chunk-2C5QY3Z2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Charts/BarChart.tsx"],"names":["jsx","Chart"],"mappings":";;;;;;;;;AAaA,IAAM,cAAA,GAA8B;AAAA,EAClC,MAAA,EAAQ,CAAC,SAAS,CAAA;AAAA,EAClB,KAAA,EAAO;AAAA,IACL,UAAA,EAAY,oBAAA;AAAA,IACZ,IAAA,EAAM,KAAA;AAAA,IACN,MAAA,EAAQ,GAAA;AAAA,IACR,OAAA,EAAS;AAAA,MACP,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,GAAA,EAAK;AAAA,MACH,UAAA,EAAY,KAAA;AAAA,MACZ,WAAA,EAAa,KAAA;AAAA,MACb,YAAA,EAAc,CAAA;AAAA,MACd,uBAAA,EAAyB;AAAA;AAC3B,GACF;AAAA,EACA,UAAA,EAAY;AAAA,IACV,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,KAAA,EAAO;AAAA,IACL,UAAA,EAAY;AAAA,MACV,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,UAAA,EAAY;AAAA,MACV,IAAA,EAAM;AAAA,KACR;AAAA,IACA,SAAA,EAAW;AAAA,MACT,IAAA,EAAM;AAAA,KACR;AAAA;AAAA;AAAA,IAGA,UAAA,EAAY;AAAA,MACV,KAAA,EAAO;AAAA;AACT,GACF;AAAA,EACA,M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AA,CAAe,MAAA;AAAA,IACpD,KAAA,EAAO;AAAA,MACL,GAAG,cAAA,CAAe,KAAA;AAAA,MAClB,GAAG,OAAA,EAAS,KAAA;AAAA,MACZ,QAAQ,MAAA,IAAU,OAAA,EAAS,KAAA,EAAO,MAAA,IAAU,eAAe,KAAA,EAAO;AAAA,KACpE;AAAA,IACA,KAAA,EAAO;AAAA,MACL,GAAG,cAAA,CAAe,KAAA;AAAA,MAClB,GAAG,OAAA,EAAS,KAAA;AAAA,MACZ,YACE,UAAA,IACA,OAAA,EAAS,KAAA,EAAO,UAAA,IAChB,eAAe,KAAA,EAAO;AAAA;AAC1B,GACF;AAEA,EAAA,uBACEA,cAAA;AAAA,IAACC,sBAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,aAAA;AAAA,MACT,QAAQ,MAAA,IAAU,aAAA;AAAA,MAClB,IAAA,EAAK,KAAA;AAAA,MACL,QAAQ,MAAA,IAAU;AAAA;AAAA,GACpB;AAEJ","file":"chunk-2C5QY3Z2.cjs","sourcesContent":["\"use client\";\nimport React from \"react\";\nimport Chart from \"react-apexcharts\";\nimport type { ApexOptions } from \"apexcharts\";\n\nexport interface BarChartProps {\n series?: ApexAxisChartSeries;\n categories?: string[];\n colors?: string[];\n height?: number;\n options?: ApexOptions;\n}\n\nconst defaultOptions: ApexOptions = {\n colors: [\"#465fff\"],\n chart: {\n fontFamily: \"Outfit, sans-serif\",\n type: \"bar\",\n height: 180,\n toolbar: {\n show: false,\n },\n },\n plotOptions: {\n bar: {\n horizontal: false,\n columnWidth: \"39%\",\n borderRadius: 5,\n borderRadiusApplication: \"end\",\n },\n },\n dataLabels: {\n enabled: false,\n },\n // No transparent stroke around the columns: it shrinks and shifts the\n // painted bar inside its allocated slot, so the hover highlight band\n // (crosshairs width \"barWidth\" = the allocated width) would render wider\n // than — and offset from — the visible bar.\n stroke: {\n show: false,\n },\n xaxis: {\n categories: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n axisBorder: {\n show: false,\n },\n axisTicks: {\n show: false,\n },\n // Match the hover highlight band to the bar width (the default band spans\n // the whole category slot, looking ~3x wider than the 39% columns).\n crosshairs: {\n width: \"barWidth\",\n },\n },\n legend: {\n show: true,\n position: \"top\",\n horizontalAlign: \"left\",\n fontFamily: \"Outfit\",\n // Rounded, border-less swatches that echo the column styling. ApexCharts\n // sets the marker span's `color` to the series color, so `currentColor`\n // picks it up; `customHTML` lets us round the corners (the built-in shapes\n // are sharp SVG paths that CSS border-radius can't touch).\n markers: {\n size: 7,\n strokeWidth: 0,\n customHTML: () =>\n '<span style=\"display:block;height:100%;width:100%;border-radius:3px;background:currentColor\"></span>',\n },\n },\n yaxis: {\n title: {\n text: undefined,\n },\n },\n grid: {\n yaxis: {\n lines: {\n show: true,\n },\n },\n },\n fill: {\n opacity: 1,\n },\n tooltip: {\n x: {\n show: false,\n },\n y: {\n formatter: (val: number) => `${val}`,\n },\n },\n};\n\nconst defaultSeries: ApexAxisChartSeries = [\n {\n name: \"Sales\",\n data: [168, 385, 201, 298, 187, 195, 291, 110, 215, 390, 280, 112],\n },\n];\n\nexport const BarChart: React.FC<BarChartProps> = ({\n series,\n categories,\n colors,\n height,\n options,\n}) => {\n const mergedOptions: ApexOptions = {\n ...defaultOptions,\n ...options,\n colors: colors ?? options?.colors ?? defaultOptions.colors,\n chart: {\n ...defaultOptions.chart,\n ...options?.chart,\n height: height ?? options?.chart?.height ?? defaultOptions.chart?.height,\n },\n xaxis: {\n ...defaultOptions.xaxis,\n ...options?.xaxis,\n categories:\n categories ??\n options?.xaxis?.categories ??\n defaultOptions.xaxis?.categories,\n },\n };\n\n return (\n <Chart\n options={mergedOptions}\n series={series ?? defaultSeries}\n type=\"bar\"\n height={height ?? 180}\n />\n );\n};\n"]}
|
|
@@ -12,7 +12,15 @@ var defaultOptions = {
|
|
|
12
12
|
legend: {
|
|
13
13
|
show: false,
|
|
14
14
|
position: "top",
|
|
15
|
-
horizontalAlign: "left"
|
|
15
|
+
horizontalAlign: "left",
|
|
16
|
+
// Rounded, border-less swatches (visible when the legend is enabled).
|
|
17
|
+
// ApexCharts sets the marker span's `color` to the series color, so
|
|
18
|
+
// `currentColor` picks it up; `customHTML` rounds the corners.
|
|
19
|
+
markers: {
|
|
20
|
+
size: 7,
|
|
21
|
+
strokeWidth: 0,
|
|
22
|
+
customHTML: () => '<span style="display:block;height:100%;width:100%;border-radius:3px;background:currentColor"></span>'
|
|
23
|
+
}
|
|
16
24
|
},
|
|
17
25
|
colors: ["#465FFF", "#9CB9FF"],
|
|
18
26
|
chart: {
|
|
@@ -148,5 +156,5 @@ var LineChart = ({
|
|
|
148
156
|
};
|
|
149
157
|
|
|
150
158
|
exports.LineChart = LineChart;
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
159
|
+
//# sourceMappingURL=chunk-3EE6CPHW.cjs.map
|
|
160
|
+
//# sourceMappingURL=chunk-3EE6CPHW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Charts/LineChart.tsx"],"names":["jsx","Chart"],"mappings":";;;;;;;;;AAaA,IAAM,cAAA,GAA8B;AAAA,EAClC,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,KAAA;AAAA,IACN,QAAA,EAAU,KAAA;AAAA,IACV,eAAA,EAAiB,MAAA;AAAA;AAAA;AAAA;AAAA,IAIjB,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,CAAA;AAAA,MACN,WAAA,EAAa,CAAA;AAAA,MACb,YAAY,MACV;AAAA;AACJ,GACF;AAAA,EACA,MAAA,EAAQ,CAAC,SAAA,EAAW,SAAS,CAAA;AAAA,EAC7B,KAAA,EAAO;AAAA,IACL,UAAA,EAAY,oBAAA;AAAA,IACZ,MAAA,EAAQ,GAAA;AAAA,IACR,IA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AAU,OAAA,EAAS,KAAA,EAAO,MAAA,IAAU,eAAe,KAAA,EAAO;AAAA,KACpE;AAAA,IACA,KAAA,EAAO;AAAA,MACL,GAAG,cAAA,CAAe,KAAA;AAAA,MAClB,GAAG,OAAA,EAAS,KAAA;AAAA,MACZ,YACE,UAAA,IACA,OAAA,EAAS,KAAA,EAAO,UAAA,IAChB,eAAe,KAAA,EAAO;AAAA;AAC1B,GACF;AAEA,EAAA,uBACEA,cAAA;AAAA,IAACC,sBAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,aAAA;AAAA,MACT,QAAQ,MAAA,IAAU,aAAA;AAAA,MAClB,IAAA,EAAK,MAAA;AAAA,MACL,QAAQ,MAAA,IAAU;AAAA;AAAA,GACpB;AAEJ","file":"chunk-3EE6CPHW.cjs","sourcesContent":["\"use client\";\nimport React from \"react\";\nimport Chart from \"react-apexcharts\";\nimport type { ApexOptions } from \"apexcharts\";\n\nexport interface LineChartProps {\n series?: ApexAxisChartSeries;\n categories?: string[];\n colors?: string[];\n height?: number;\n options?: ApexOptions;\n}\n\nconst defaultOptions: ApexOptions = {\n legend: {\n show: false,\n position: \"top\",\n horizontalAlign: \"left\",\n // Rounded, border-less swatches (visible when the legend is enabled).\n // ApexCharts sets the marker span's `color` to the series color, so\n // `currentColor` picks it up; `customHTML` rounds the corners.\n markers: {\n size: 7,\n strokeWidth: 0,\n customHTML: () =>\n '<span style=\"display:block;height:100%;width:100%;border-radius:3px;background:currentColor\"></span>',\n },\n },\n colors: [\"#465FFF\", \"#9CB9FF\"],\n chart: {\n fontFamily: \"Outfit, sans-serif\",\n height: 310,\n type: \"line\",\n toolbar: {\n show: false,\n },\n },\n stroke: {\n curve: \"straight\",\n width: [2, 2],\n },\n fill: {\n type: \"gradient\",\n gradient: {\n opacityFrom: 0.55,\n opacityTo: 0,\n },\n },\n markers: {\n size: 0,\n strokeColors: \"#fff\",\n strokeWidth: 2,\n hover: {\n size: 6,\n },\n },\n grid: {\n xaxis: {\n lines: {\n show: false,\n },\n },\n yaxis: {\n lines: {\n show: true,\n },\n },\n },\n dataLabels: {\n enabled: false,\n },\n tooltip: {\n enabled: true,\n x: {\n format: \"dd MMM yyyy\",\n },\n },\n xaxis: {\n type: \"category\",\n categories: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n axisBorder: {\n show: false,\n },\n axisTicks: {\n show: false,\n },\n tooltip: {\n enabled: false,\n },\n },\n yaxis: {\n labels: {\n style: {\n fontSize: \"12px\",\n colors: [\"#6B7280\"],\n },\n },\n title: {\n text: \"\",\n style: {\n fontSize: \"0px\",\n },\n },\n },\n};\n\nconst defaultSeries: ApexAxisChartSeries = [\n {\n name: \"Sales\",\n data: [180, 190, 170, 160, 175, 165, 170, 205, 230, 210, 240, 235],\n },\n {\n name: \"Revenue\",\n data: [40, 30, 50, 40, 55, 40, 70, 100, 110, 120, 150, 140],\n },\n];\n\nexport const LineChart: React.FC<LineChartProps> = ({\n series,\n categories,\n colors,\n height,\n options,\n}) => {\n const mergedOptions: ApexOptions = {\n ...defaultOptions,\n ...options,\n colors: colors ?? options?.colors ?? defaultOptions.colors,\n chart: {\n ...defaultOptions.chart,\n ...options?.chart,\n height: height ?? options?.chart?.height ?? defaultOptions.chart?.height,\n },\n xaxis: {\n ...defaultOptions.xaxis,\n ...options?.xaxis,\n categories:\n categories ??\n options?.xaxis?.categories ??\n defaultOptions.xaxis?.categories,\n },\n };\n\n return (\n <Chart\n options={mergedOptions}\n series={series ?? defaultSeries}\n type=\"area\"\n height={height ?? 310}\n />\n );\n};\n"]}
|
|
@@ -21,38 +21,32 @@ function parseValue(text, format) {
|
|
|
21
21
|
return { type: "hsla", h: n[0], s: n[1], l: n[2], a: n[3] };
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
switch (input.type) {
|
|
26
|
-
case "hex":
|
|
27
|
-
return input.value;
|
|
28
|
-
case "rgb":
|
|
29
|
-
return `rgb(${input.r}, ${input.g}, ${input.b})`;
|
|
30
|
-
case "rgba":
|
|
31
|
-
return `rgba(${input.r}, ${input.g}, ${input.b}, ${input.a})`;
|
|
32
|
-
case "hsl":
|
|
33
|
-
return `hsl(${input.h}, ${input.s}%, ${input.l}%)`;
|
|
34
|
-
case "hsla":
|
|
35
|
-
return `hsla(${input.h}, ${input.s}%, ${input.l}%, ${input.a})`;
|
|
36
|
-
case "hsv":
|
|
37
|
-
return `hsv(${input.h}, ${input.s}%, ${input.v}%)`;
|
|
38
|
-
case "hsva":
|
|
39
|
-
return `hsva(${input.h}, ${input.s}%, ${input.v}%, ${input.a})`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function stateToString(state, format) {
|
|
24
|
+
function colorToString(color, format) {
|
|
43
25
|
switch (format) {
|
|
44
|
-
case "hex":
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
case "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
26
|
+
case "hex": {
|
|
27
|
+
const { r, g, b } = color.getRgb();
|
|
28
|
+
const a = color.getRgba().a;
|
|
29
|
+
const hex = `#${[r, g, b].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("")}`;
|
|
30
|
+
return a < 1 ? `${hex}${Math.round(a * 255).toString(16).padStart(2, "0")}` : hex;
|
|
31
|
+
}
|
|
32
|
+
case "rgb": {
|
|
33
|
+
const { r, g, b } = color.getRgb();
|
|
34
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
35
|
+
}
|
|
36
|
+
case "rgba": {
|
|
37
|
+
const { r, g, b, a } = color.getRgba();
|
|
38
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
39
|
+
}
|
|
40
|
+
case "hsl": {
|
|
41
|
+
const { h, s, l } = color.getHsl();
|
|
42
|
+
return `hsl(${h}, ${s}%, ${l}%)`;
|
|
43
|
+
}
|
|
44
|
+
case "hsla": {
|
|
45
|
+
const { h, s, l, a } = color.getHsla();
|
|
46
|
+
return `hsla(${h}, ${s}%, ${l}%, ${a})`;
|
|
47
|
+
}
|
|
54
48
|
default:
|
|
55
|
-
return
|
|
49
|
+
return color.getHex();
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
52
|
var pipetteIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -73,32 +67,50 @@ var ColorPicker = ({
|
|
|
73
67
|
className,
|
|
74
68
|
...rest
|
|
75
69
|
}) => {
|
|
76
|
-
const [
|
|
77
|
-
type: "hex",
|
|
78
|
-
|
|
79
|
-
});
|
|
70
|
+
const [hsva, setHsva] = react.useState(
|
|
71
|
+
() => new reactBeautifulColor.Color({ type: "hex", value: defaultValue }).getHsva()
|
|
72
|
+
);
|
|
80
73
|
const [format, setFormat] = react.useState(defaultFormat);
|
|
81
74
|
const [draft, setDraft] = react.useState(null);
|
|
75
|
+
const [exact, setExact] = react.useState(
|
|
76
|
+
() => ({ format: "hex", value: defaultValue })
|
|
77
|
+
);
|
|
78
|
+
const colorInput = react.useMemo(() => ({ type: "hsva", ...hsva }), [hsva]);
|
|
82
79
|
const currentColor = react.useMemo(() => new reactBeautifulColor.Color(colorInput), [colorInput]);
|
|
83
|
-
const display =
|
|
80
|
+
const display = exact && exact.format === format ? exact.value : colorToString(currentColor, format);
|
|
84
81
|
const inputValue = draft ?? display;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
const hsvaRef = react.useRef(hsva);
|
|
83
|
+
hsvaRef.current = hsva;
|
|
84
|
+
const formatRef = react.useRef(format);
|
|
85
|
+
formatRef.current = format;
|
|
86
|
+
const onChangeRef = react.useRef(onChange);
|
|
87
|
+
onChangeRef.current = onChange;
|
|
88
|
+
const handlePickerChange = react.useCallback((next) => {
|
|
89
|
+
const nv = next.getHsva();
|
|
90
|
+
const cur = hsvaRef.current;
|
|
91
|
+
if (nv.h === cur.h && nv.s === cur.s && nv.v === cur.v && nv.a === cur.a) return;
|
|
92
|
+
setHsva(nv);
|
|
93
|
+
setExact(null);
|
|
94
|
+
setDraft(null);
|
|
95
|
+
onChangeRef.current?.(colorToString(next, formatRef.current), next);
|
|
96
|
+
}, []);
|
|
93
97
|
const handleFormatChange = (f) => {
|
|
94
98
|
setFormat(f);
|
|
95
99
|
setDraft(null);
|
|
96
|
-
onChange?.(
|
|
100
|
+
onChange?.(
|
|
101
|
+
exact && exact.format === f ? exact.value : colorToString(currentColor, f),
|
|
102
|
+
currentColor
|
|
103
|
+
);
|
|
97
104
|
};
|
|
98
105
|
const handleInputChange = (text) => {
|
|
99
106
|
setDraft(text);
|
|
100
107
|
const parsed = parseValue(text, format);
|
|
101
|
-
if (parsed)
|
|
108
|
+
if (parsed) {
|
|
109
|
+
const c = new reactBeautifulColor.Color(parsed);
|
|
110
|
+
setHsva(c.getHsva());
|
|
111
|
+
setExact({ format, value: text.trim() });
|
|
112
|
+
onChange?.(text.trim(), c);
|
|
113
|
+
}
|
|
102
114
|
};
|
|
103
115
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkYERNSNT4_cjs.cn("w-full max-w-xs", className), ...rest, children: [
|
|
104
116
|
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400", children: label }),
|
|
@@ -107,14 +119,14 @@ var ColorPicker = ({
|
|
|
107
119
|
{
|
|
108
120
|
color: colorInput,
|
|
109
121
|
onChange: handlePickerChange,
|
|
110
|
-
className: "rounded-2xl border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-white/[0.03]",
|
|
122
|
+
className: "h-auto w-full rounded-2xl border border-gray-200 bg-white p-3 shadow-none dark:border-gray-800 dark:bg-white/[0.03]",
|
|
111
123
|
children: [
|
|
112
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.Saturation, { className: "mb-
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.Saturation, { className: "mb-4 h-40 rounded-lg" }),
|
|
113
125
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
114
126
|
withEyeDropper && /* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.EyeDropper, { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-white/[0.03]", children: pipetteIcon }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col gap-
|
|
116
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.Hue, { className: "h-
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.Alpha, { className: "h-
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col gap-3", children: [
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.Hue, { className: "h-4" }),
|
|
129
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactBeautifulColor.ColorPicker.Alpha, { className: "h-4" })
|
|
118
130
|
] })
|
|
119
131
|
] })
|
|
120
132
|
]
|
|
@@ -129,16 +141,30 @@ var ColorPicker = ({
|
|
|
129
141
|
style: { backgroundColor: currentColor.format("rgba") }
|
|
130
142
|
}
|
|
131
143
|
),
|
|
132
|
-
formats.length > 1 && /* @__PURE__ */ jsxRuntime.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
formats.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative shrink-0", children: [
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
+
"select",
|
|
147
|
+
{
|
|
148
|
+
"aria-label": "Color format",
|
|
149
|
+
value: format,
|
|
150
|
+
onChange: (e) => handleFormatChange(e.target.value),
|
|
151
|
+
className: "h-11 appearance-none rounded-lg border border-gray-300 bg-transparent pl-3 pr-8 text-sm text-gray-700 focus:outline-hidden dark:border-gray-700 dark:text-gray-300",
|
|
152
|
+
children: formats.map((f) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: f, children: f.toUpperCase() }, f))
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
156
|
+
"svg",
|
|
157
|
+
{
|
|
158
|
+
"aria-hidden": "true",
|
|
159
|
+
className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400",
|
|
160
|
+
width: "14",
|
|
161
|
+
height: "14",
|
|
162
|
+
viewBox: "0 0 24 24",
|
|
163
|
+
fill: "none",
|
|
164
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
] }),
|
|
142
168
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
143
169
|
"input",
|
|
144
170
|
{
|
|
@@ -154,5 +180,5 @@ var ColorPicker = ({
|
|
|
154
180
|
};
|
|
155
181
|
|
|
156
182
|
exports.ColorPicker = ColorPicker;
|
|
157
|
-
//# sourceMappingURL=chunk-
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-MYN5LDMO.cjs.map
|
|
184
|
+
//# sourceMappingURL=chunk-MYN5LDMO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorPicker/ColorPicker.tsx"],"names":["jsx","useState","Color","useMemo","useRef","useCallback","jsxs","cn","RBColorPicker"],"mappings":";;;;;;;AA8BA,IAAM,cAAmC,CAAC,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,OAAO,MAAM,CAAA;AAG7E,SAAS,UAAA,CAAW,MAAc,MAAA,EAA8C;AAC9E,EAAA,MAAM,CAAA,GAAI,KAAK,IAAA,EAAK;AACpB,EAAA,IAAI,WAAW,KAAA,EAAO;AACpB,IAAA,OAAO,2CAAA,CAA4C,KAAK,CAAC,CAAA,GACrD,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,CAAA,EAAE,GACxB,IAAA;AAAA,EACN;AACA,EAAA,MAAM,CAAA,GAAI,EAAE,KAAA,CAAM,cAAc,GAAG,GAAA,CAAI,MAAM,KAAK,EAAC;AACnD,EAAA,IAAI,MAAA,KAAW,SAAS,CAAA,CAAE,MAAA,IAAU,GAAG,OAAO,EAAE,MAAM,KAAA,EAAO,CAAA,EAAG,EAAE,CAAC,CAAA,EAAG,GAAG,CAAA,CAAE,CAAC,GAAG,CAAA,EAAG,CAAA,CAAE,CAAC,CAAA,EAAE;AACvF,EAAA,IAAI,MAAA,KAAW,MAAA,IAAU,CAAA,CAAE,MAAA,IAAU,CAAA;AACnC,IAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,CAAA,CAAE,CAAC,GAAG,CAAA,EAAG,CAAA,CAAE,CAAC,CAAA,EAAG,GAAG,CAAA,CAAE,CAAC,GAAG,CAAA,EAAG,CAAA,CAAE,CAAC,CAAA,EAAE;AAC5D,EAAA,IAAI,MAAA,KAAW,SAAS,CAAA,CAAE,MAAA,IAAU,GAAG,OAAO,EAAE,MAAM,KAAA,EAAO,CAAA,EAAG,EAAE,CAAC,CAAA,EAAG,GAAG,CAAA,CAAE,CAAC,GAAG,CAAA,EAAG,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A,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAW,aAAA;AAAA,UACX,KAAA,EAAO,UAAA;AAAA,UACP,UAAU,CAAC,CAAA,KAAM,iBAAA,CAAkB,CAAA,CAAE,OAAO,KAAK,CAAA;AAAA,UACjD,MAAA,EAAQ,MAAM,QAAA,CAAS,IAAI,CAAA;AAAA,UAC3B,SAAA,EAAU;AAAA;AAAA;AACZ,KAAA,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"chunk-MYN5LDMO.cjs","sourcesContent":["\"use client\";\nimport React, { useCallback, useMemo, useRef, useState } from \"react\";\nimport { ColorPicker as RBColorPicker, Color } from \"react-beautiful-color\";\nimport { cn } from \"../../lib/cn\";\n\n// `react-beautiful-color` doesn't re-export these types from its entry, so\n// derive them from the values its API does expose.\ntype Hsva = ReturnType<Color[\"getHsva\"]>;\ntype ColorInput = ConstructorParameters<typeof Color>[0] & { type: string };\n\nexport type ColorPickerFormat = \"hex\" | \"rgb\" | \"rgba\" | \"hsl\" | \"hsla\";\n\nexport interface ColorPickerProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Initial color (uncontrolled). Any hex string, e.g. `\"#3641f5\"`. */\n defaultValue?: string;\n /** Format selected on first render. Default: `\"hex\"`. */\n defaultFormat?: ColorPickerFormat;\n /** Formats offered in the switcher. Default: all five. */\n formats?: ColorPickerFormat[];\n /** Render the value input + format switcher. Default: `true`. */\n showInput?: boolean;\n /** Show the native eye-dropper button (browser support varies). */\n withEyeDropper?: boolean;\n /** Optional label rendered above the picker. */\n label?: string;\n /** Fires on every change with the formatted string and the `Color` instance. */\n onChange?: (value: string, color: Color) => void;\n}\n\nconst ALL_FORMATS: ColorPickerFormat[] = [\"hex\", \"rgb\", \"rgba\", \"hsl\", \"hsla\"];\n\n/** Parse the text in the input back into a `ColorInput`, or `null` if invalid. */\nfunction parseValue(text: string, format: ColorPickerFormat): ColorInput | null {\n const t = text.trim();\n if (format === \"hex\") {\n return /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)\n ? { type: \"hex\", value: t }\n : null;\n }\n const n = t.match(/-?\\d*\\.?\\d+/g)?.map(Number) ?? [];\n if (format === \"rgb\" && n.length >= 3) return { type: \"rgb\", r: n[0], g: n[1], b: n[2] };\n if (format === \"rgba\" && n.length >= 4)\n return { type: \"rgba\", r: n[0], g: n[1], b: n[2], a: n[3] };\n if (format === \"hsl\" && n.length >= 3) return { type: \"hsl\", h: n[0], s: n[1], l: n[2] };\n if (format === \"hsla\" && n.length >= 4)\n return { type: \"hsla\", h: n[0], s: n[1], l: n[2], a: n[3] };\n return null;\n}\n\n/** Format a `Color` into the requested CSS string. */\nfunction colorToString(color: Color, format: ColorPickerFormat): string {\n switch (format) {\n case \"hex\": {\n const { r, g, b } = color.getRgb();\n const a = color.getRgba().a;\n const hex = `#${[r, g, b].map((v) => Math.round(v).toString(16).padStart(2, \"0\")).join(\"\")}`;\n return a < 1\n ? `${hex}${Math.round(a * 255).toString(16).padStart(2, \"0\")}`\n : hex;\n }\n case \"rgb\": {\n const { r, g, b } = color.getRgb();\n return `rgb(${r}, ${g}, ${b})`;\n }\n case \"rgba\": {\n const { r, g, b, a } = color.getRgba();\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n }\n case \"hsl\": {\n const { h, s, l } = color.getHsl();\n return `hsl(${h}, ${s}%, ${l}%)`;\n }\n case \"hsla\": {\n const { h, s, l, a } = color.getHsla();\n return `hsla(${h}, ${s}%, ${l}%, ${a})`;\n }\n default:\n return color.getHex();\n }\n}\n\nconst pipetteIcon = (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M19.5 3.5a2.12 2.12 0 0 0-3 0l-2.3 2.3-1-1-1.4 1.4 1 1L4 14.9V19h4.1l7.7-7.7 1 1 1.4-1.4-1-1 2.3-2.3a2.12 2.12 0 0 0 0-3ZM7.3 17.6H6v-1.3l6.6-6.6 1.3 1.3-6.6 6.6Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport const ColorPicker: React.FC<ColorPickerProps> = ({\n defaultValue = \"#3641f5\",\n defaultFormat = \"hex\",\n formats = ALL_FORMATS,\n showInput = true,\n withEyeDropper = false,\n label,\n onChange,\n className,\n ...rest\n}) => {\n // Internal state lives in full-fidelity HSVA — the picker's native space.\n // Feeding anything lossier (e.g. hex) back into the controlled picker makes\n // the knobs fight the cursor (hue/alpha collapse on round-trip), which is\n // why drag would freeze or snap.\n const [hsva, setHsva] = useState<Hsva>(() =>\n new Color({ type: \"hex\", value: defaultValue }).getHsva()\n );\n const [format, setFormat] = useState<ColorPickerFormat>(defaultFormat);\n // While the input is focused we keep a raw draft so partial/invalid typing\n // isn't clobbered by the normalized value.\n const [draft, setDraft] = useState<string | null>(null);\n // HSVA is integer-quantized, so we keep the user's exact text (defaultValue\n // or typed) and show it verbatim until the picker actually changes color.\n const [exact, setExact] = useState<{ format: ColorPickerFormat; value: string } | null>(\n () => ({ format: \"hex\", value: defaultValue })\n );\n\n const colorInput = useMemo(() => ({ type: \"hsva\" as const, ...hsva }), [hsva]);\n const currentColor = useMemo(() => new Color(colorInput), [colorInput]);\n const display =\n exact && exact.format === format ? exact.value : colorToString(currentColor, format);\n const inputValue = draft ?? display;\n\n // The picker's internal drag layer unbinds its document listeners whenever\n // the `onChange` identity changes (its cleanup effect depends on it), which\n // would kill an in-flight drag after the first tick. Keep the handler\n // identity-stable and read mutable values through refs.\n const hsvaRef = useRef(hsva);\n hsvaRef.current = hsva;\n const formatRef = useRef(format);\n formatRef.current = format;\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const handlePickerChange = useCallback((next: Color) => {\n const nv = next.getHsva();\n const cur = hsvaRef.current;\n // The picker re-emits the current color on mount; ignore no-op changes so\n // the exact defaultValue isn't clobbered.\n if (nv.h === cur.h && nv.s === cur.s && nv.v === cur.v && nv.a === cur.a) return;\n setHsva(nv);\n setExact(null);\n setDraft(null);\n onChangeRef.current?.(colorToString(next, formatRef.current), next);\n }, []);\n\n const handleFormatChange = (f: ColorPickerFormat) => {\n setFormat(f);\n setDraft(null);\n onChange?.(\n exact && exact.format === f ? exact.value : colorToString(currentColor, f),\n currentColor\n );\n };\n\n const handleInputChange = (text: string) => {\n setDraft(text);\n const parsed = parseValue(text, format);\n if (parsed) {\n const c = new Color(parsed);\n setHsva(c.getHsva());\n setExact({ format, value: text.trim() });\n onChange?.(text.trim(), c);\n }\n };\n\n return (\n <div className={cn(\"w-full max-w-xs\", className)} {...rest}>\n {label && (\n <span className=\"mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400\">\n {label}\n </span>\n )}\n <RBColorPicker\n color={colorInput}\n onChange={handlePickerChange}\n className=\"h-auto w-full rounded-2xl border border-gray-200 bg-white p-3 shadow-none dark:border-gray-800 dark:bg-white/[0.03]\"\n >\n {/* no overflow-hidden here: it would clip the drag knobs (24px) beyond\n the track bounds, shrinking their visible/grabbable area */}\n <RBColorPicker.Saturation className=\"mb-4 h-40 rounded-lg\" />\n <div className=\"flex items-center gap-3\">\n {withEyeDropper && (\n <RBColorPicker.EyeDropper className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-white/[0.03]\">\n {pipetteIcon}\n </RBColorPicker.EyeDropper>\n )}\n <div className=\"flex flex-1 flex-col gap-3\">\n <RBColorPicker.Hue className=\"h-4\" />\n <RBColorPicker.Alpha className=\"h-4\" />\n </div>\n </div>\n </RBColorPicker>\n\n {showInput && (\n <div className=\"mt-3 flex items-stretch gap-2\">\n <span\n aria-hidden=\"true\"\n className=\"h-11 w-11 shrink-0 rounded-lg border border-gray-200 dark:border-gray-700\"\n style={{ backgroundColor: currentColor.format(\"rgba\") }}\n />\n {formats.length > 1 && (\n <span className=\"relative shrink-0\">\n <select\n aria-label=\"Color format\"\n value={format}\n onChange={(e) => handleFormatChange(e.target.value as ColorPickerFormat)}\n className=\"h-11 appearance-none rounded-lg border border-gray-300 bg-transparent pl-3 pr-8 text-sm text-gray-700 focus:outline-hidden dark:border-gray-700 dark:text-gray-300\"\n >\n {formats.map((f) => (\n <option key={f} value={f}>\n {f.toUpperCase()}\n </option>\n ))}\n </select>\n <svg\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <path d=\"m6 9 6 6 6-6\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </span>\n )}\n <input\n aria-label=\"Color value\"\n value={inputValue}\n onChange={(e) => handleInputChange(e.target.value)}\n onBlur={() => setDraft(null)}\n className=\"h-11 w-full rounded-lg border border-gray-300 bg-transparent px-3 text-sm text-gray-800 focus:outline-hidden dark:border-gray-700 dark:text-white/90\"\n />\n </div>\n )}\n </div>\n );\n};\n"]}
|
|
@@ -6,7 +6,15 @@ var defaultOptions = {
|
|
|
6
6
|
legend: {
|
|
7
7
|
show: false,
|
|
8
8
|
position: "top",
|
|
9
|
-
horizontalAlign: "left"
|
|
9
|
+
horizontalAlign: "left",
|
|
10
|
+
// Rounded, border-less swatches (visible when the legend is enabled).
|
|
11
|
+
// ApexCharts sets the marker span's `color` to the series color, so
|
|
12
|
+
// `currentColor` picks it up; `customHTML` rounds the corners.
|
|
13
|
+
markers: {
|
|
14
|
+
size: 7,
|
|
15
|
+
strokeWidth: 0,
|
|
16
|
+
customHTML: () => '<span style="display:block;height:100%;width:100%;border-radius:3px;background:currentColor"></span>'
|
|
17
|
+
}
|
|
10
18
|
},
|
|
11
19
|
colors: ["#465FFF", "#9CB9FF"],
|
|
12
20
|
chart: {
|
|
@@ -142,5 +150,5 @@ var LineChart = ({
|
|
|
142
150
|
};
|
|
143
151
|
|
|
144
152
|
export { LineChart };
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
153
|
+
//# sourceMappingURL=chunk-NWIOJGF7.js.map
|
|
154
|
+
//# sourceMappingURL=chunk-NWIOJGF7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Charts/LineChart.tsx"],"names":[],"mappings":";;;AAaA,IAAM,cAAA,GAA8B;AAAA,EAClC,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,KAAA;AAAA,IACN,QAAA,EAAU,KAAA;AAAA,IACV,eAAA,EAAiB,MAAA;AAAA;AAAA;AAAA;AAAA,IAIjB,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,CAAA;AAAA,MACN,WAAA,EAAa,CAAA;AAAA,MACb,YAAY,MACV;AAAA;AACJ,GACF;AAAA,EACA,MAAA,EAAQ,CAAC,SAAA,EAAW,SAAS,CAAA;AAAA,EAC7B,KAAA,EAAO;AAAA,IACL,UAAA,EAAY,oBAAA;AAAA,IACZ,MAAA,EAAQ,GAAA;AAAA,IACR,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,MACP,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,UAAA;AAAA,IACP,KAAA,EAAO,CAAC,CAAA,EAAG,CAAC;AAAA,GACd;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,UAAA;AAAA,IACN,QAAA,EAAU;AAAA,MACR,WAAA,EAAa,IAAA;AAAA,MACb,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,CAAA;AAAA,IACN,YAAA,EAAc,MAAA;AAAA,IACd,WAAA,EAAa,CAAA;AAAA,IACb,KAAA,EAAO;AAAA,MACL,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,KAAA,EA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nimport type { ApexOptions } from \"apexcharts\";\n\nexport interface LineChartProps {\n series?: ApexAxisChartSeries;\n categories?: string[];\n colors?: string[];\n height?: number;\n options?: ApexOptions;\n}\n\nconst defaultOptions: ApexOptions = {\n legend: {\n show: false,\n position: \"top\",\n horizontalAlign: \"left\",\n // Rounded, border-less swatches (visible when the legend is enabled).\n // ApexCharts sets the marker span's `color` to the series color, so\n // `currentColor` picks it up; `customHTML` rounds the corners.\n markers: {\n size: 7,\n strokeWidth: 0,\n customHTML: () =>\n '<span style=\"display:block;height:100%;width:100%;border-radius:3px;background:currentColor\"></span>',\n },\n },\n colors: [\"#465FFF\", \"#9CB9FF\"],\n chart: {\n fontFamily: \"Outfit, sans-serif\",\n height: 310,\n type: \"line\",\n toolbar: {\n show: false,\n },\n },\n stroke: {\n curve: \"straight\",\n width: [2, 2],\n },\n fill: {\n type: \"gradient\",\n gradient: {\n opacityFrom: 0.55,\n opacityTo: 0,\n },\n },\n markers: {\n size: 0,\n strokeColors: \"#fff\",\n strokeWidth: 2,\n hover: {\n size: 6,\n },\n },\n grid: {\n xaxis: {\n lines: {\n show: false,\n },\n },\n yaxis: {\n lines: {\n show: true,\n },\n },\n },\n dataLabels: {\n enabled: false,\n },\n tooltip: {\n enabled: true,\n x: {\n format: \"dd MMM yyyy\",\n },\n },\n xaxis: {\n type: \"category\",\n categories: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n axisBorder: {\n show: false,\n },\n axisTicks: {\n show: false,\n },\n tooltip: {\n enabled: false,\n },\n },\n yaxis: {\n labels: {\n style: {\n fontSize: \"12px\",\n colors: [\"#6B7280\"],\n },\n },\n title: {\n text: \"\",\n style: {\n fontSize: \"0px\",\n },\n },\n },\n};\n\nconst defaultSeries: ApexAxisChartSeries = [\n {\n name: \"Sales\",\n data: [180, 190, 170, 160, 175, 165, 170, 205, 230, 210, 240, 235],\n },\n {\n name: \"Revenue\",\n data: [40, 30, 50, 40, 55, 40, 70, 100, 110, 120, 150, 140],\n },\n];\n\nexport const LineChart: React.FC<LineChartProps> = ({\n series,\n categories,\n colors,\n height,\n options,\n}) => {\n const mergedOptions: ApexOptions = {\n ...defaultOptions,\n ...options,\n colors: colors ?? options?.colors ?? defaultOptions.colors,\n chart: {\n ...defaultOptions.chart,\n ...options?.chart,\n height: height ?? options?.chart?.height ?? defaultOptions.chart?.height,\n },\n xaxis: {\n ...defaultOptions.xaxis,\n ...options?.xaxis,\n categories:\n categories ??\n options?.xaxis?.categories ??\n defaultOptions.xaxis?.categories,\n },\n };\n\n return (\n <Chart\n options={mergedOptions}\n series={series ?? defaultSeries}\n type=\"area\"\n height={height ?? 310}\n />\n );\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from './chunk-ZLIYUUA4.js';
|
|
3
|
-
import { useState, useMemo } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { useState, useMemo, useRef, useCallback } from 'react';
|
|
4
|
+
import { Color, ColorPicker as ColorPicker$1 } from 'react-beautiful-color';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
var ALL_FORMATS = ["hex", "rgb", "rgba", "hsl", "hsla"];
|
|
@@ -19,38 +19,32 @@ function parseValue(text, format) {
|
|
|
19
19
|
return { type: "hsla", h: n[0], s: n[1], l: n[2], a: n[3] };
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
switch (input.type) {
|
|
24
|
-
case "hex":
|
|
25
|
-
return input.value;
|
|
26
|
-
case "rgb":
|
|
27
|
-
return `rgb(${input.r}, ${input.g}, ${input.b})`;
|
|
28
|
-
case "rgba":
|
|
29
|
-
return `rgba(${input.r}, ${input.g}, ${input.b}, ${input.a})`;
|
|
30
|
-
case "hsl":
|
|
31
|
-
return `hsl(${input.h}, ${input.s}%, ${input.l}%)`;
|
|
32
|
-
case "hsla":
|
|
33
|
-
return `hsla(${input.h}, ${input.s}%, ${input.l}%, ${input.a})`;
|
|
34
|
-
case "hsv":
|
|
35
|
-
return `hsv(${input.h}, ${input.s}%, ${input.v}%)`;
|
|
36
|
-
case "hsva":
|
|
37
|
-
return `hsva(${input.h}, ${input.s}%, ${input.v}%, ${input.a})`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function stateToString(state, format) {
|
|
22
|
+
function colorToString(color, format) {
|
|
41
23
|
switch (format) {
|
|
42
|
-
case "hex":
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case "
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
case "hex": {
|
|
25
|
+
const { r, g, b } = color.getRgb();
|
|
26
|
+
const a = color.getRgba().a;
|
|
27
|
+
const hex = `#${[r, g, b].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("")}`;
|
|
28
|
+
return a < 1 ? `${hex}${Math.round(a * 255).toString(16).padStart(2, "0")}` : hex;
|
|
29
|
+
}
|
|
30
|
+
case "rgb": {
|
|
31
|
+
const { r, g, b } = color.getRgb();
|
|
32
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
33
|
+
}
|
|
34
|
+
case "rgba": {
|
|
35
|
+
const { r, g, b, a } = color.getRgba();
|
|
36
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
37
|
+
}
|
|
38
|
+
case "hsl": {
|
|
39
|
+
const { h, s, l } = color.getHsl();
|
|
40
|
+
return `hsl(${h}, ${s}%, ${l}%)`;
|
|
41
|
+
}
|
|
42
|
+
case "hsla": {
|
|
43
|
+
const { h, s, l, a } = color.getHsla();
|
|
44
|
+
return `hsla(${h}, ${s}%, ${l}%, ${a})`;
|
|
45
|
+
}
|
|
52
46
|
default:
|
|
53
|
-
return
|
|
47
|
+
return color.getHex();
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
50
|
var pipetteIcon = /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
@@ -71,32 +65,50 @@ var ColorPicker = ({
|
|
|
71
65
|
className,
|
|
72
66
|
...rest
|
|
73
67
|
}) => {
|
|
74
|
-
const [
|
|
75
|
-
type: "hex",
|
|
76
|
-
|
|
77
|
-
});
|
|
68
|
+
const [hsva, setHsva] = useState(
|
|
69
|
+
() => new Color({ type: "hex", value: defaultValue }).getHsva()
|
|
70
|
+
);
|
|
78
71
|
const [format, setFormat] = useState(defaultFormat);
|
|
79
72
|
const [draft, setDraft] = useState(null);
|
|
73
|
+
const [exact, setExact] = useState(
|
|
74
|
+
() => ({ format: "hex", value: defaultValue })
|
|
75
|
+
);
|
|
76
|
+
const colorInput = useMemo(() => ({ type: "hsva", ...hsva }), [hsva]);
|
|
80
77
|
const currentColor = useMemo(() => new Color(colorInput), [colorInput]);
|
|
81
|
-
const display =
|
|
78
|
+
const display = exact && exact.format === format ? exact.value : colorToString(currentColor, format);
|
|
82
79
|
const inputValue = draft ?? display;
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
const hsvaRef = useRef(hsva);
|
|
81
|
+
hsvaRef.current = hsva;
|
|
82
|
+
const formatRef = useRef(format);
|
|
83
|
+
formatRef.current = format;
|
|
84
|
+
const onChangeRef = useRef(onChange);
|
|
85
|
+
onChangeRef.current = onChange;
|
|
86
|
+
const handlePickerChange = useCallback((next) => {
|
|
87
|
+
const nv = next.getHsva();
|
|
88
|
+
const cur = hsvaRef.current;
|
|
89
|
+
if (nv.h === cur.h && nv.s === cur.s && nv.v === cur.v && nv.a === cur.a) return;
|
|
90
|
+
setHsva(nv);
|
|
91
|
+
setExact(null);
|
|
92
|
+
setDraft(null);
|
|
93
|
+
onChangeRef.current?.(colorToString(next, formatRef.current), next);
|
|
94
|
+
}, []);
|
|
91
95
|
const handleFormatChange = (f) => {
|
|
92
96
|
setFormat(f);
|
|
93
97
|
setDraft(null);
|
|
94
|
-
onChange?.(
|
|
98
|
+
onChange?.(
|
|
99
|
+
exact && exact.format === f ? exact.value : colorToString(currentColor, f),
|
|
100
|
+
currentColor
|
|
101
|
+
);
|
|
95
102
|
};
|
|
96
103
|
const handleInputChange = (text) => {
|
|
97
104
|
setDraft(text);
|
|
98
105
|
const parsed = parseValue(text, format);
|
|
99
|
-
if (parsed)
|
|
106
|
+
if (parsed) {
|
|
107
|
+
const c = new Color(parsed);
|
|
108
|
+
setHsva(c.getHsva());
|
|
109
|
+
setExact({ format, value: text.trim() });
|
|
110
|
+
onChange?.(text.trim(), c);
|
|
111
|
+
}
|
|
100
112
|
};
|
|
101
113
|
return /* @__PURE__ */ jsxs("div", { className: cn("w-full max-w-xs", className), ...rest, children: [
|
|
102
114
|
label && /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400", children: label }),
|
|
@@ -105,14 +117,14 @@ var ColorPicker = ({
|
|
|
105
117
|
{
|
|
106
118
|
color: colorInput,
|
|
107
119
|
onChange: handlePickerChange,
|
|
108
|
-
className: "rounded-2xl border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-white/[0.03]",
|
|
120
|
+
className: "h-auto w-full rounded-2xl border border-gray-200 bg-white p-3 shadow-none dark:border-gray-800 dark:bg-white/[0.03]",
|
|
109
121
|
children: [
|
|
110
|
-
/* @__PURE__ */ jsx(ColorPicker$1.Saturation, { className: "mb-
|
|
122
|
+
/* @__PURE__ */ jsx(ColorPicker$1.Saturation, { className: "mb-4 h-40 rounded-lg" }),
|
|
111
123
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
112
124
|
withEyeDropper && /* @__PURE__ */ jsx(ColorPicker$1.EyeDropper, { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-white/[0.03]", children: pipetteIcon }),
|
|
113
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-
|
|
114
|
-
/* @__PURE__ */ jsx(ColorPicker$1.Hue, { className: "h-
|
|
115
|
-
/* @__PURE__ */ jsx(ColorPicker$1.Alpha, { className: "h-
|
|
125
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-3", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(ColorPicker$1.Hue, { className: "h-4" }),
|
|
127
|
+
/* @__PURE__ */ jsx(ColorPicker$1.Alpha, { className: "h-4" })
|
|
116
128
|
] })
|
|
117
129
|
] })
|
|
118
130
|
]
|
|
@@ -127,16 +139,30 @@ var ColorPicker = ({
|
|
|
127
139
|
style: { backgroundColor: currentColor.format("rgba") }
|
|
128
140
|
}
|
|
129
141
|
),
|
|
130
|
-
formats.length > 1 && /* @__PURE__ */
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
formats.length > 1 && /* @__PURE__ */ jsxs("span", { className: "relative shrink-0", children: [
|
|
143
|
+
/* @__PURE__ */ jsx(
|
|
144
|
+
"select",
|
|
145
|
+
{
|
|
146
|
+
"aria-label": "Color format",
|
|
147
|
+
value: format,
|
|
148
|
+
onChange: (e) => handleFormatChange(e.target.value),
|
|
149
|
+
className: "h-11 appearance-none rounded-lg border border-gray-300 bg-transparent pl-3 pr-8 text-sm text-gray-700 focus:outline-hidden dark:border-gray-700 dark:text-gray-300",
|
|
150
|
+
children: formats.map((f) => /* @__PURE__ */ jsx("option", { value: f, children: f.toUpperCase() }, f))
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
"svg",
|
|
155
|
+
{
|
|
156
|
+
"aria-hidden": "true",
|
|
157
|
+
className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400",
|
|
158
|
+
width: "14",
|
|
159
|
+
height: "14",
|
|
160
|
+
viewBox: "0 0 24 24",
|
|
161
|
+
fill: "none",
|
|
162
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] }),
|
|
140
166
|
/* @__PURE__ */ jsx(
|
|
141
167
|
"input",
|
|
142
168
|
{
|
|
@@ -152,5 +178,5 @@ var ColorPicker = ({
|
|
|
152
178
|
};
|
|
153
179
|
|
|
154
180
|
export { ColorPicker };
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
181
|
+
//# sourceMappingURL=chunk-P7LI2FSR.js.map
|
|
182
|
+
//# sourceMappingURL=chunk-P7LI2FSR.js.map
|