@algorithm-shift/design-system 1.2.66 → 1.2.68
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/index.css +19 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +100 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +123 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -157,7 +157,7 @@ function TabList({
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// src/components/Layout/TabGroup.tsx
|
|
160
|
-
import { useEffect as useEffect2, useMemo } from "react";
|
|
160
|
+
import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
161
161
|
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
162
162
|
function TabGroupComponent({
|
|
163
163
|
children,
|
|
@@ -167,11 +167,13 @@ function TabGroupComponent({
|
|
|
167
167
|
activeTab,
|
|
168
168
|
onTabChange
|
|
169
169
|
}) {
|
|
170
|
+
const [mounted, setMounted] = useState2(false);
|
|
170
171
|
useEffect2(() => {
|
|
171
|
-
if (list && list.length > 0 && !activeTab && onTabChange) {
|
|
172
|
+
if (list && list.length > 0 && !activeTab && onTabChange && !mounted) {
|
|
172
173
|
onTabChange(list[0]?.tabId);
|
|
174
|
+
setMounted(true);
|
|
173
175
|
}
|
|
174
|
-
}, [list, activeTab, onTabChange]);
|
|
176
|
+
}, [list, activeTab, onTabChange, mounted]);
|
|
175
177
|
const formatedList = useMemo(
|
|
176
178
|
() => Array.isArray(list) ? [...list].sort((a, b) => (a.orderNumber ?? 0) - (b.orderNumber ?? 0)) : [],
|
|
177
179
|
[list]
|
|
@@ -27304,7 +27306,7 @@ var RadioInput = ({
|
|
|
27304
27306
|
var RadioInput_default = RadioInput;
|
|
27305
27307
|
|
|
27306
27308
|
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
27307
|
-
import { useCallback, useEffect as useEffect11, useState as
|
|
27309
|
+
import { useCallback, useEffect as useEffect11, useState as useState3 } from "react";
|
|
27308
27310
|
import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
27309
27311
|
var MultiCheckbox = ({
|
|
27310
27312
|
className,
|
|
@@ -27318,7 +27320,7 @@ var MultiCheckbox = ({
|
|
|
27318
27320
|
isDisabled = false
|
|
27319
27321
|
}) => {
|
|
27320
27322
|
const list = Array.isArray(data) ? data : [];
|
|
27321
|
-
const [value, setValue] =
|
|
27323
|
+
const [value, setValue] = useState3(propValue);
|
|
27322
27324
|
const options = (list || []).map((item) => ({
|
|
27323
27325
|
value: item[dataKey || "value"],
|
|
27324
27326
|
label: item[dataLabel || "label"]
|
|
@@ -28404,7 +28406,7 @@ function DataTable({
|
|
|
28404
28406
|
return [];
|
|
28405
28407
|
};
|
|
28406
28408
|
return /* @__PURE__ */ jsxs26("div", { className: "overflow-hidden rounded-md w-full", children: [
|
|
28407
|
-
/* @__PURE__ */ jsxs26("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2
|
|
28409
|
+
/* @__PURE__ */ jsxs26("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 bg-gray-50`, children: [
|
|
28408
28410
|
globalSearch && /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
|
|
28409
28411
|
/* @__PURE__ */ jsxs26("div", { className: "relative w-full", children: [
|
|
28410
28412
|
/* @__PURE__ */ jsx47(
|
|
@@ -28440,7 +28442,7 @@ function DataTable({
|
|
|
28440
28442
|
{
|
|
28441
28443
|
variant: "outline",
|
|
28442
28444
|
size: "sm",
|
|
28443
|
-
className: "px-3 py-1 text-xs cursor-pointer",
|
|
28445
|
+
className: "px-3 py-1 text-xs cursor-pointer border-gray-300",
|
|
28444
28446
|
children: "Manage Columns"
|
|
28445
28447
|
}
|
|
28446
28448
|
) }),
|
|
@@ -29121,19 +29123,56 @@ function Navbar({
|
|
|
29121
29123
|
}
|
|
29122
29124
|
|
|
29123
29125
|
// src/components/Chart/BarChart.tsx
|
|
29124
|
-
import
|
|
29126
|
+
import React9 from "react";
|
|
29127
|
+
import {
|
|
29128
|
+
BarChart,
|
|
29129
|
+
Bar,
|
|
29130
|
+
Area,
|
|
29131
|
+
AreaChart,
|
|
29132
|
+
XAxis,
|
|
29133
|
+
YAxis,
|
|
29134
|
+
CartesianGrid,
|
|
29135
|
+
Tooltip,
|
|
29136
|
+
ResponsiveContainer,
|
|
29137
|
+
Legend
|
|
29138
|
+
} from "recharts";
|
|
29125
29139
|
import { jsx as jsx59, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
29126
|
-
var ChartComponent = ({ className, style, ...props }) => {
|
|
29127
|
-
const data = Array.isArray(props
|
|
29140
|
+
var ChartComponent = ({ className, style, loading, ...props }) => {
|
|
29141
|
+
const data = Array.isArray(props.data) ? props.data : [];
|
|
29128
29142
|
const chartType = props.chartType || "bar";
|
|
29129
29143
|
const legendsPosition = props.legendsPosition === "middle" || props.legendsPosition === "bottom" ? props.legendsPosition : "top";
|
|
29130
|
-
|
|
29144
|
+
if (loading || data.length === 0) {
|
|
29145
|
+
return /* @__PURE__ */ jsx59(
|
|
29146
|
+
"div",
|
|
29147
|
+
{
|
|
29148
|
+
className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
|
|
29149
|
+
style,
|
|
29150
|
+
children: /* @__PURE__ */ jsx59("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
|
|
29151
|
+
}
|
|
29152
|
+
);
|
|
29153
|
+
}
|
|
29154
|
+
return /* @__PURE__ */ jsx59("div", { className: `${className} h-[400px]`, style, children: /* @__PURE__ */ jsx59(ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ jsxs34(BarChart, { data, title: "Leads", desc: "content", children: [
|
|
29131
29155
|
/* @__PURE__ */ jsx59(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
29132
29156
|
/* @__PURE__ */ jsx59(XAxis, { dataKey: "name" }),
|
|
29133
29157
|
/* @__PURE__ */ jsx59(YAxis, {}),
|
|
29134
|
-
/* @__PURE__ */ jsx59(Tooltip, {}),
|
|
29158
|
+
/* @__PURE__ */ jsx59(Tooltip, { formatter: (value) => `${value}k` }),
|
|
29135
29159
|
/* @__PURE__ */ jsx59(Legend, { verticalAlign: legendsPosition, align: "center" }),
|
|
29136
|
-
/* @__PURE__ */ jsx59(
|
|
29160
|
+
/* @__PURE__ */ jsx59(
|
|
29161
|
+
Bar,
|
|
29162
|
+
{
|
|
29163
|
+
dataKey: "value",
|
|
29164
|
+
fill: "#00695C",
|
|
29165
|
+
radius: [6, 6, 0, 0],
|
|
29166
|
+
isAnimationActive: false,
|
|
29167
|
+
children: data.map((entry, index) => /* @__PURE__ */ jsx59(
|
|
29168
|
+
"rect",
|
|
29169
|
+
{
|
|
29170
|
+
fill: entry.color || "#00695C"
|
|
29171
|
+
},
|
|
29172
|
+
`bar-${index}`
|
|
29173
|
+
))
|
|
29174
|
+
}
|
|
29175
|
+
)
|
|
29137
29176
|
] }) : /* @__PURE__ */ jsxs34(AreaChart, { data, children: [
|
|
29138
29177
|
/* @__PURE__ */ jsx59("defs", { children: /* @__PURE__ */ jsxs34("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
29139
29178
|
/* @__PURE__ */ jsx59("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
|
|
@@ -29142,7 +29181,7 @@ var ChartComponent = ({ className, style, ...props }) => {
|
|
|
29142
29181
|
/* @__PURE__ */ jsx59(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
29143
29182
|
/* @__PURE__ */ jsx59(XAxis, { dataKey: "name" }),
|
|
29144
29183
|
/* @__PURE__ */ jsx59(YAxis, {}),
|
|
29145
|
-
/* @__PURE__ */ jsx59(Tooltip, {}),
|
|
29184
|
+
/* @__PURE__ */ jsx59(Tooltip, { formatter: (value) => `${value}k` }),
|
|
29146
29185
|
/* @__PURE__ */ jsx59(
|
|
29147
29186
|
Area,
|
|
29148
29187
|
{
|
|
@@ -29150,47 +29189,51 @@ var ChartComponent = ({ className, style, ...props }) => {
|
|
|
29150
29189
|
dataKey: "value",
|
|
29151
29190
|
stroke: "#00695C",
|
|
29152
29191
|
fillOpacity: 1,
|
|
29153
|
-
fill: "url(#colorCount)"
|
|
29192
|
+
fill: "url(#colorCount)",
|
|
29193
|
+
isAnimationActive: false
|
|
29154
29194
|
}
|
|
29155
29195
|
)
|
|
29156
29196
|
] }) }) });
|
|
29157
29197
|
};
|
|
29158
|
-
var BarChart_default = ChartComponent;
|
|
29198
|
+
var BarChart_default = React9.memo(ChartComponent);
|
|
29159
29199
|
|
|
29160
29200
|
// src/components/Chart/PieChart.tsx
|
|
29161
|
-
import
|
|
29201
|
+
import React10, { useMemo as useMemo3 } from "react";
|
|
29202
|
+
import {
|
|
29203
|
+
PieChart,
|
|
29204
|
+
Pie,
|
|
29205
|
+
Cell,
|
|
29206
|
+
ResponsiveContainer as ResponsiveContainer2,
|
|
29207
|
+
Tooltip as Tooltip2,
|
|
29208
|
+
LabelList
|
|
29209
|
+
} from "recharts";
|
|
29162
29210
|
import { Fragment as Fragment19, jsx as jsx60, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
29163
|
-
var
|
|
29164
|
-
const
|
|
29165
|
-
|
|
29166
|
-
|
|
29211
|
+
var getRandomColor = () => {
|
|
29212
|
+
const palette = [
|
|
29213
|
+
"#2563eb",
|
|
29214
|
+
"#10b981",
|
|
29215
|
+
"#f59e0b",
|
|
29216
|
+
"#ef4444",
|
|
29217
|
+
"#8b5cf6",
|
|
29218
|
+
"#14b8a6",
|
|
29219
|
+
"#ec4899",
|
|
29220
|
+
"#e11d48",
|
|
29221
|
+
"#22c55e",
|
|
29222
|
+
"#3b82f6"
|
|
29223
|
+
];
|
|
29224
|
+
return palette[Math.floor(Math.random() * palette.length)];
|
|
29225
|
+
};
|
|
29226
|
+
var DonutChart = ({ className, style, loading, ...props }) => {
|
|
29167
29227
|
const showLegends = props.showLegends ?? true;
|
|
29168
29228
|
const labelType = props.labelType || "inside";
|
|
29169
29229
|
const canvasMode = props.canvasMode;
|
|
29170
|
-
const
|
|
29171
|
-
if (
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
{
|
|
29176
|
-
x,
|
|
29177
|
-
y,
|
|
29178
|
-
textAnchor: "middle",
|
|
29179
|
-
dominantBaseline: "central",
|
|
29180
|
-
className: "text-[10px] font-semibold",
|
|
29181
|
-
fill: labelType === "inside" ? "#fff" : "#000",
|
|
29182
|
-
children: [
|
|
29183
|
-
value,
|
|
29184
|
-
"k ",
|
|
29185
|
-
showPercentage ? `(${percentage}%)` : ""
|
|
29186
|
-
]
|
|
29187
|
-
}
|
|
29188
|
-
);
|
|
29189
|
-
};
|
|
29230
|
+
const data = useMemo3(() => {
|
|
29231
|
+
if (!Array.isArray(props.data)) return [];
|
|
29232
|
+
return props.data.map((item) => ({ ...item, color: getRandomColor() }));
|
|
29233
|
+
}, [props.data]);
|
|
29234
|
+
const total = useMemo3(() => data.reduce((sum, d) => sum + d.value, 0), [data]);
|
|
29190
29235
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
29191
|
-
const
|
|
29192
|
-
const wrapperClass = canvasMode ? forceDesktop ? "flex-row" : "flex-col" : "flex-col md:flex-row";
|
|
29193
|
-
const renderLegends = () => {
|
|
29236
|
+
const renderLegends = useMemo3(() => {
|
|
29194
29237
|
if (!showLegends) return null;
|
|
29195
29238
|
return /* @__PURE__ */ jsx60(Fragment19, { children: data.map((d) => /* @__PURE__ */ jsxs35(
|
|
29196
29239
|
"div",
|
|
@@ -29209,23 +29252,33 @@ var DonutChart = ({ className, style, ...props }) => {
|
|
|
29209
29252
|
},
|
|
29210
29253
|
d.name
|
|
29211
29254
|
)) });
|
|
29212
|
-
};
|
|
29255
|
+
}, [data, showLegends]);
|
|
29256
|
+
if (loading || data.length === 0) {
|
|
29257
|
+
return /* @__PURE__ */ jsx60(
|
|
29258
|
+
"div",
|
|
29259
|
+
{
|
|
29260
|
+
className: `flex items-center justify-center w-full h-[300px] md:h-[400px] bg-gray-50 animate-pulse rounded-lg ${className}`,
|
|
29261
|
+
style,
|
|
29262
|
+
children: /* @__PURE__ */ jsx60("div", { className: "text-gray-400 text-sm md:text-base", children: loading ? "Loading chart report..." : "No data available to display the chart." })
|
|
29263
|
+
}
|
|
29264
|
+
);
|
|
29265
|
+
}
|
|
29213
29266
|
return /* @__PURE__ */ jsxs35(
|
|
29214
29267
|
"div",
|
|
29215
29268
|
{
|
|
29216
|
-
className: `relative flex items-center ${
|
|
29269
|
+
className: `relative flex flex-col items-center ${className}`,
|
|
29217
29270
|
style,
|
|
29218
29271
|
children: [
|
|
29219
29272
|
/* @__PURE__ */ jsxs35("div", { className: "relative w-full md:w-[70%] h-[300px] md:h-[400px] flex items-center justify-center", children: [
|
|
29220
|
-
|
|
29273
|
+
/* @__PURE__ */ jsx60(ResponsiveContainer2, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs35(PieChart, { children: [
|
|
29221
29274
|
/* @__PURE__ */ jsxs35(
|
|
29222
29275
|
Pie,
|
|
29223
29276
|
{
|
|
29224
29277
|
data,
|
|
29225
29278
|
cx: "50%",
|
|
29226
29279
|
cy: "50%",
|
|
29227
|
-
innerRadius:
|
|
29228
|
-
outerRadius:
|
|
29280
|
+
innerRadius: forceMobile ? 60 : 80,
|
|
29281
|
+
outerRadius: forceMobile ? 100 : 140,
|
|
29229
29282
|
dataKey: "value",
|
|
29230
29283
|
labelLine: false,
|
|
29231
29284
|
isAnimationActive: false,
|
|
@@ -29236,26 +29289,38 @@ var DonutChart = ({ className, style, ...props }) => {
|
|
|
29236
29289
|
{
|
|
29237
29290
|
dataKey: "value",
|
|
29238
29291
|
position: labelType === "inside" ? "inside" : "outside",
|
|
29239
|
-
|
|
29292
|
+
fill: labelType === "inside" ? "#fff" : "#000",
|
|
29293
|
+
fontSize: forceMobile ? 10 : 13,
|
|
29294
|
+
fontWeight: 600
|
|
29240
29295
|
}
|
|
29241
29296
|
)
|
|
29242
29297
|
]
|
|
29243
29298
|
}
|
|
29244
29299
|
),
|
|
29245
|
-
/* @__PURE__ */ jsx60(
|
|
29300
|
+
/* @__PURE__ */ jsx60(
|
|
29301
|
+
Tooltip2,
|
|
29302
|
+
{
|
|
29303
|
+
formatter: (value, name) => [`${value}k`, name]
|
|
29304
|
+
}
|
|
29305
|
+
)
|
|
29246
29306
|
] }) }),
|
|
29247
|
-
/* @__PURE__ */ jsxs35(
|
|
29248
|
-
|
|
29249
|
-
|
|
29250
|
-
|
|
29307
|
+
/* @__PURE__ */ jsxs35(
|
|
29308
|
+
"div",
|
|
29309
|
+
{
|
|
29310
|
+
className: `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 ${forceMobile ? "text-2xl" : "text-4xl"} font-bold text-[#000]`,
|
|
29311
|
+
children: [
|
|
29312
|
+
total,
|
|
29313
|
+
"k"
|
|
29314
|
+
]
|
|
29315
|
+
}
|
|
29316
|
+
)
|
|
29251
29317
|
] }),
|
|
29252
|
-
/* @__PURE__ */ jsx60("div", { className:
|
|
29253
|
-
w-full md:w-auto`, children: renderLegends() })
|
|
29318
|
+
/* @__PURE__ */ jsx60("div", { className: "flex flex-wrap justify-center gap-2 mt-6 w-full md:w-auto", children: renderLegends })
|
|
29254
29319
|
]
|
|
29255
29320
|
}
|
|
29256
29321
|
);
|
|
29257
29322
|
};
|
|
29258
|
-
var PieChart_default = DonutChart;
|
|
29323
|
+
var PieChart_default = React10.memo(DonutChart);
|
|
29259
29324
|
|
|
29260
29325
|
// src/components/Blocks/EmailComposer.tsx
|
|
29261
29326
|
import { jsx as jsx61, jsxs as jsxs36 } from "react/jsx-runtime";
|