@undefine-ui/design-system 3.2.0 → 3.3.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 +51 -0
- package/dist/index.cjs +290 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +290 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -551,6 +551,57 @@ The animated logo automatically plays on mount with:
|
|
|
551
551
|
|
|
552
552
|
Ideal for splash screens, loading overlays, or brand storytelling moments.
|
|
553
553
|
|
|
554
|
+
### ApexCharts Styling
|
|
555
|
+
|
|
556
|
+
The design system provides styling utilities for ApexCharts integration, ensuring charts match the Define theme.
|
|
557
|
+
|
|
558
|
+
**Installation:**
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
pnpm add apexcharts react-apexcharts
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
**Usage:**
|
|
565
|
+
|
|
566
|
+
```tsx
|
|
567
|
+
import ReactApexChart from 'react-apexcharts';
|
|
568
|
+
import { useTheme, styled } from '@mui/material/styles';
|
|
569
|
+
import { apexChartsStyles, getDefaultChartOptions } from '@undefine-ui/design-system';
|
|
570
|
+
|
|
571
|
+
// Create a styled wrapper
|
|
572
|
+
const ChartWrapper = styled('div')(({ theme }) => ({
|
|
573
|
+
...apexChartsStyles(theme)
|
|
574
|
+
}));
|
|
575
|
+
|
|
576
|
+
function LineChart() {
|
|
577
|
+
const theme = useTheme();
|
|
578
|
+
|
|
579
|
+
const chartOptions = {
|
|
580
|
+
...getDefaultChartOptions(theme),
|
|
581
|
+
xaxis: {
|
|
582
|
+
...getDefaultChartOptions(theme).xaxis,
|
|
583
|
+
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
const chartSeries = [
|
|
588
|
+
{ name: 'Bookings', data: [10, 41, 35, 51, 49, 62, 69] },
|
|
589
|
+
{ name: 'Revenue', data: [20, 35, 50, 30, 45, 55, 40] }
|
|
590
|
+
];
|
|
591
|
+
|
|
592
|
+
return (
|
|
593
|
+
<ChartWrapper>
|
|
594
|
+
<ReactApexChart type="line" series={chartSeries} options={chartOptions} height={350} />
|
|
595
|
+
</ChartWrapper>
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
**Available exports:**
|
|
601
|
+
|
|
602
|
+
- `apexChartsStyles(theme)` - CSS styles to apply to a wrapper element (tooltips, legends, labels)
|
|
603
|
+
- `getDefaultChartOptions(theme)` - Default ApexCharts options with theme colors, typography, and grid styling
|
|
604
|
+
|
|
554
605
|
## Export surface
|
|
555
606
|
|
|
556
607
|
Everything is re-exported from `src/index.ts`. Key groups:
|
package/dist/index.cjs
CHANGED
|
@@ -112,6 +112,7 @@ __export(index_exports, {
|
|
|
112
112
|
XMark: () => XMark,
|
|
113
113
|
XMarkSolid: () => XMarkSolid,
|
|
114
114
|
action: () => action,
|
|
115
|
+
apexChartsStyles: () => apexChartsStyles,
|
|
115
116
|
background: () => background,
|
|
116
117
|
baseAction: () => baseAction,
|
|
117
118
|
basePalette: () => basePalette,
|
|
@@ -138,6 +139,7 @@ __export(index_exports, {
|
|
|
138
139
|
fShortenNumber: () => fShortenNumber,
|
|
139
140
|
formatFullname: () => formatFullname,
|
|
140
141
|
getCurrencySymbol: () => getCurrencySymbol,
|
|
142
|
+
getDefaultChartOptions: () => getDefaultChartOptions,
|
|
141
143
|
getInitials: () => getInitials,
|
|
142
144
|
getStorage: () => getStorage,
|
|
143
145
|
grey: () => grey,
|
|
@@ -1229,6 +1231,292 @@ var menuItem = (theme) => {
|
|
|
1229
1231
|
};
|
|
1230
1232
|
};
|
|
1231
1233
|
|
|
1234
|
+
// src/theme/styles/apex-charts.ts
|
|
1235
|
+
var apexChartsStyles = (theme) => ({
|
|
1236
|
+
// Chart container
|
|
1237
|
+
"& .apexcharts-canvas": {
|
|
1238
|
+
// Tooltip
|
|
1239
|
+
"& .apexcharts-tooltip": {
|
|
1240
|
+
border: "none",
|
|
1241
|
+
boxShadow: theme.customShadows["shadow-md"],
|
|
1242
|
+
borderRadius: theme.radius["radius-md"],
|
|
1243
|
+
backgroundColor: theme.vars.palette.background.paper,
|
|
1244
|
+
color: theme.vars.palette.text.primary,
|
|
1245
|
+
"&.apexcharts-theme-light": {
|
|
1246
|
+
border: `1px solid ${theme.vars.palette.border.subtle}`,
|
|
1247
|
+
backgroundColor: theme.vars.palette.background.paper
|
|
1248
|
+
},
|
|
1249
|
+
"& .apexcharts-tooltip-title": {
|
|
1250
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
1251
|
+
backgroundColor: varAlpha(theme.vars.palette.grey["500Channel"], 0.08),
|
|
1252
|
+
borderColor: theme.vars.palette.border.subtle,
|
|
1253
|
+
color: theme.vars.palette.text.header
|
|
1254
|
+
},
|
|
1255
|
+
"& .apexcharts-tooltip-series-group": {
|
|
1256
|
+
backgroundColor: "transparent"
|
|
1257
|
+
}
|
|
1258
|
+
},
|
|
1259
|
+
// Xaxis & Yaxis labels
|
|
1260
|
+
"& .apexcharts-xaxis-label, & .apexcharts-yaxis-label": {
|
|
1261
|
+
fill: theme.vars.palette.text.secondary
|
|
1262
|
+
},
|
|
1263
|
+
// Xaxis tick
|
|
1264
|
+
"& .apexcharts-xaxis-tick": {
|
|
1265
|
+
stroke: theme.vars.palette.border.subtle
|
|
1266
|
+
},
|
|
1267
|
+
// Grid
|
|
1268
|
+
"& .apexcharts-gridline": {
|
|
1269
|
+
stroke: theme.vars.palette.border.subtle
|
|
1270
|
+
},
|
|
1271
|
+
"& .apexcharts-grid-borders line": {
|
|
1272
|
+
stroke: theme.vars.palette.border.subtle
|
|
1273
|
+
},
|
|
1274
|
+
// Data labels
|
|
1275
|
+
"& .apexcharts-datalabels-group": {
|
|
1276
|
+
"& .apexcharts-data-labels": {
|
|
1277
|
+
textAnchor: "middle"
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1280
|
+
"& .apexcharts-datalabel": {
|
|
1281
|
+
fill: theme.vars.palette.text.primary
|
|
1282
|
+
},
|
|
1283
|
+
"& .apexcharts-datalabel-label": {
|
|
1284
|
+
fill: theme.vars.palette.text.secondary,
|
|
1285
|
+
fontSize: theme.typography.body2.fontSize,
|
|
1286
|
+
fontFamily: theme.typography.fontFamily
|
|
1287
|
+
},
|
|
1288
|
+
"& .apexcharts-datalabel-value": {
|
|
1289
|
+
fill: theme.vars.palette.text.primary,
|
|
1290
|
+
fontWeight: theme.typography.fontWeightSemiBold,
|
|
1291
|
+
fontFamily: theme.typography.fontFamily
|
|
1292
|
+
},
|
|
1293
|
+
// Radar
|
|
1294
|
+
"& .apexcharts-radar-series polygon": {
|
|
1295
|
+
fill: "transparent",
|
|
1296
|
+
stroke: theme.vars.palette.border.subtle
|
|
1297
|
+
},
|
|
1298
|
+
"& .apexcharts-radar-series line": {
|
|
1299
|
+
stroke: theme.vars.palette.border.subtle
|
|
1300
|
+
},
|
|
1301
|
+
// Legend
|
|
1302
|
+
"& .apexcharts-legend": {
|
|
1303
|
+
padding: 0,
|
|
1304
|
+
"& .apexcharts-legend-series": {
|
|
1305
|
+
alignItems: "center",
|
|
1306
|
+
display: "inline-flex !important"
|
|
1307
|
+
},
|
|
1308
|
+
"& .apexcharts-legend-marker": {
|
|
1309
|
+
marginRight: 8
|
|
1310
|
+
},
|
|
1311
|
+
"& .apexcharts-legend-text": {
|
|
1312
|
+
color: `${theme.vars.palette.text.primary} !important`,
|
|
1313
|
+
fontSize: `${theme.typography.body2.fontSize} !important`,
|
|
1314
|
+
fontWeight: `${theme.typography.fontWeightMedium} !important`,
|
|
1315
|
+
fontFamily: theme.typography.fontFamily,
|
|
1316
|
+
lineHeight: "18px",
|
|
1317
|
+
textTransform: "capitalize"
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
// Annotations
|
|
1321
|
+
"& .apexcharts-xaxis-annotation-label, & .apexcharts-yaxis-annotation-label": {
|
|
1322
|
+
fill: theme.vars.palette.text.primary
|
|
1323
|
+
},
|
|
1324
|
+
"& .apexcharts-annotation-rect": {
|
|
1325
|
+
fill: varAlpha(theme.vars.palette.grey["500Channel"], 0.08)
|
|
1326
|
+
},
|
|
1327
|
+
// Point annotation
|
|
1328
|
+
"& .apexcharts-point-annotation-label": {
|
|
1329
|
+
fill: theme.vars.palette.text.primary,
|
|
1330
|
+
fontFamily: theme.typography.fontFamily
|
|
1331
|
+
},
|
|
1332
|
+
"& .apexcharts-point-annotation-marker": {
|
|
1333
|
+
stroke: theme.vars.palette.primary.main
|
|
1334
|
+
},
|
|
1335
|
+
// Toolbar icons (hidden by default, enable as needed)
|
|
1336
|
+
"& .apexcharts-toolbar": {
|
|
1337
|
+
"& .apexcharts-reset-icon, & .apexcharts-zoom-icon, & .apexcharts-zoomin-icon, & .apexcharts-zoomout-icon, & .apexcharts-pan-icon, & .apexcharts-selection-icon": {
|
|
1338
|
+
display: "none"
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
// Treemap
|
|
1342
|
+
"& .apexcharts-treemap-rect": {
|
|
1343
|
+
stroke: theme.vars.palette.background.paper
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
var getDefaultChartOptions = (theme) => ({
|
|
1348
|
+
chart: {
|
|
1349
|
+
toolbar: { show: false },
|
|
1350
|
+
zoom: { enabled: false },
|
|
1351
|
+
fontFamily: theme.typography.fontFamily,
|
|
1352
|
+
foreColor: theme.vars.palette.text.secondary
|
|
1353
|
+
},
|
|
1354
|
+
colors: [
|
|
1355
|
+
theme.vars.palette.primary.main,
|
|
1356
|
+
theme.vars.palette.info.main,
|
|
1357
|
+
theme.vars.palette.success.main,
|
|
1358
|
+
theme.vars.palette.warning.main,
|
|
1359
|
+
theme.vars.palette.error.main,
|
|
1360
|
+
theme.vars.palette.secondary.main
|
|
1361
|
+
],
|
|
1362
|
+
stroke: {
|
|
1363
|
+
width: 2.5,
|
|
1364
|
+
curve: "smooth",
|
|
1365
|
+
lineCap: "round"
|
|
1366
|
+
},
|
|
1367
|
+
grid: {
|
|
1368
|
+
strokeDashArray: 3,
|
|
1369
|
+
borderColor: theme.vars.palette.border.subtle,
|
|
1370
|
+
padding: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
1371
|
+
xaxis: { lines: { show: false } },
|
|
1372
|
+
yaxis: { lines: { show: true } }
|
|
1373
|
+
},
|
|
1374
|
+
xaxis: {
|
|
1375
|
+
axisBorder: { show: false },
|
|
1376
|
+
axisTicks: { show: false },
|
|
1377
|
+
crosshairs: {
|
|
1378
|
+
show: true,
|
|
1379
|
+
stroke: {
|
|
1380
|
+
color: theme.vars.palette.primary.main,
|
|
1381
|
+
width: 2,
|
|
1382
|
+
dashArray: 5
|
|
1383
|
+
}
|
|
1384
|
+
},
|
|
1385
|
+
labels: {
|
|
1386
|
+
style: {
|
|
1387
|
+
colors: theme.vars.palette.text.secondary,
|
|
1388
|
+
fontSize: "12px",
|
|
1389
|
+
fontFamily: theme.typography.fontFamily
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
yaxis: {
|
|
1394
|
+
crosshairs: {
|
|
1395
|
+
show: false
|
|
1396
|
+
},
|
|
1397
|
+
labels: {
|
|
1398
|
+
style: {
|
|
1399
|
+
colors: theme.vars.palette.text.secondary,
|
|
1400
|
+
fontSize: "12px",
|
|
1401
|
+
fontFamily: theme.typography.fontFamily
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
tooltip: {
|
|
1406
|
+
theme: "light",
|
|
1407
|
+
fillSeriesColor: false,
|
|
1408
|
+
x: { show: true },
|
|
1409
|
+
y: {
|
|
1410
|
+
formatter: (value) => value !== void 0 ? `${value}` : value,
|
|
1411
|
+
title: { formatter: (seriesName) => `${seriesName}: ` }
|
|
1412
|
+
},
|
|
1413
|
+
marker: { show: false }
|
|
1414
|
+
},
|
|
1415
|
+
legend: {
|
|
1416
|
+
show: true,
|
|
1417
|
+
position: "top",
|
|
1418
|
+
horizontalAlign: "right",
|
|
1419
|
+
fontSize: "13px",
|
|
1420
|
+
fontFamily: theme.typography.fontFamily,
|
|
1421
|
+
fontWeight: 500,
|
|
1422
|
+
markers: {
|
|
1423
|
+
size: 7,
|
|
1424
|
+
strokeWidth: 0
|
|
1425
|
+
},
|
|
1426
|
+
labels: {
|
|
1427
|
+
colors: theme.vars.palette.text.primary
|
|
1428
|
+
},
|
|
1429
|
+
itemMargin: {
|
|
1430
|
+
horizontal: 12,
|
|
1431
|
+
vertical: 0
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
plotOptions: {
|
|
1435
|
+
bar: {
|
|
1436
|
+
borderRadius: 4,
|
|
1437
|
+
columnWidth: "40%",
|
|
1438
|
+
borderRadiusApplication: "end"
|
|
1439
|
+
},
|
|
1440
|
+
pie: {
|
|
1441
|
+
donut: {
|
|
1442
|
+
labels: {
|
|
1443
|
+
show: true,
|
|
1444
|
+
value: {
|
|
1445
|
+
fontWeight: 600,
|
|
1446
|
+
fontFamily: theme.typography.fontFamily
|
|
1447
|
+
},
|
|
1448
|
+
total: {
|
|
1449
|
+
show: true,
|
|
1450
|
+
fontFamily: theme.typography.fontFamily,
|
|
1451
|
+
label: "Total"
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
},
|
|
1456
|
+
radialBar: {
|
|
1457
|
+
track: {
|
|
1458
|
+
background: varAlpha(theme.vars.palette.grey["500Channel"], 0.16)
|
|
1459
|
+
},
|
|
1460
|
+
dataLabels: {
|
|
1461
|
+
value: {
|
|
1462
|
+
fontWeight: 600,
|
|
1463
|
+
fontFamily: theme.typography.fontFamily
|
|
1464
|
+
},
|
|
1465
|
+
total: {
|
|
1466
|
+
fontFamily: theme.typography.fontFamily
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
radar: {
|
|
1471
|
+
polygons: {
|
|
1472
|
+
fill: { colors: ["transparent"] },
|
|
1473
|
+
strokeColors: theme.vars.palette.border.subtle
|
|
1474
|
+
}
|
|
1475
|
+
},
|
|
1476
|
+
polarArea: {
|
|
1477
|
+
rings: {
|
|
1478
|
+
strokeColor: theme.vars.palette.border.subtle
|
|
1479
|
+
},
|
|
1480
|
+
spokes: {
|
|
1481
|
+
connectorColors: theme.vars.palette.border.subtle
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
dataLabels: {
|
|
1486
|
+
enabled: false,
|
|
1487
|
+
dropShadow: { enabled: false },
|
|
1488
|
+
style: {
|
|
1489
|
+
fontFamily: theme.typography.fontFamily
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
markers: {
|
|
1493
|
+
size: 4,
|
|
1494
|
+
strokeWidth: 0,
|
|
1495
|
+
hover: {
|
|
1496
|
+
size: 6,
|
|
1497
|
+
sizeOffset: 3,
|
|
1498
|
+
strokeWidth: 7
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
fill: {
|
|
1502
|
+
opacity: 1
|
|
1503
|
+
},
|
|
1504
|
+
states: {
|
|
1505
|
+
hover: { filter: { type: "lighten", value: 0.04 } },
|
|
1506
|
+
active: { filter: { type: "darken", value: 0.88 } }
|
|
1507
|
+
},
|
|
1508
|
+
responsive: [
|
|
1509
|
+
{
|
|
1510
|
+
breakpoint: theme.breakpoints.values.sm,
|
|
1511
|
+
options: {
|
|
1512
|
+
plotOptions: {
|
|
1513
|
+
bar: { columnWidth: "60%" }
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
]
|
|
1518
|
+
});
|
|
1519
|
+
|
|
1232
1520
|
// src/theme/core/colors.json
|
|
1233
1521
|
var colors_default = {
|
|
1234
1522
|
primary: {
|
|
@@ -9525,6 +9813,7 @@ __reExport(index_exports, components_exports2, module.exports);
|
|
|
9525
9813
|
XMark,
|
|
9526
9814
|
XMarkSolid,
|
|
9527
9815
|
action,
|
|
9816
|
+
apexChartsStyles,
|
|
9528
9817
|
background,
|
|
9529
9818
|
baseAction,
|
|
9530
9819
|
basePalette,
|
|
@@ -9551,6 +9840,7 @@ __reExport(index_exports, components_exports2, module.exports);
|
|
|
9551
9840
|
fShortenNumber,
|
|
9552
9841
|
formatFullname,
|
|
9553
9842
|
getCurrencySymbol,
|
|
9843
|
+
getDefaultChartOptions,
|
|
9554
9844
|
getInitials,
|
|
9555
9845
|
getStorage,
|
|
9556
9846
|
grey,
|