@salemcobalt/ui 0.2.0-rc.1 → 0.2.0-rc.3

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.js CHANGED
@@ -196,12 +196,18 @@ function ArchiveIcon(props) {
196
196
  /* @__PURE__ */ jsx5("path", { d: "M3.25 5.75v6.5a1 1 0 0 0 1 1h7.5a1 1 0 0 0 1-1v-6.5M6.5 8.75h3" })
197
197
  ] });
198
198
  }
199
+ function ArrowDownIcon(props) {
200
+ return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M8 3v10M4 9l4 4 4-4" }) });
201
+ }
199
202
  function ArrowLeftIcon(props) {
200
203
  return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M13 8H3M7 4 3 8l4 4" }) });
201
204
  }
202
205
  function ArrowRightIcon(props) {
203
206
  return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M3 8h10M9 4l4 4-4 4" }) });
204
207
  }
208
+ function ArrowUpIcon(props) {
209
+ return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M8 13V3M4 7l4-4 4 4" }) });
210
+ }
205
211
  function BellIcon(props) {
206
212
  return /* @__PURE__ */ jsxs4(Icon, { ...props, children: [
207
213
  /* @__PURE__ */ jsx5("path", { d: "M4 6.5a4 4 0 0 1 8 0v3l1.25 2H2.75L4 9.5z" }),
@@ -489,8 +495,10 @@ var Dialog = { Root, Trigger, Content, Title, Description, Body, Actions, Close
489
495
  // src/icons/icon-names.gen.ts
490
496
  var iconNames = [
491
497
  "archive",
498
+ "arrow-down",
492
499
  "arrow-left",
493
500
  "arrow-right",
501
+ "arrow-up",
494
502
  "bell",
495
503
  "briefcase",
496
504
  "calendar",
@@ -1293,12 +1301,192 @@ function Text({
1293
1301
  });
1294
1302
  }
1295
1303
 
1304
+ // src/components/Table/Table.tsx
1305
+ import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
1306
+ function Root5({
1307
+ stickyHeader = false,
1308
+ maxHeight,
1309
+ density,
1310
+ divided = true,
1311
+ layout = "auto",
1312
+ wrapperClassName,
1313
+ wrapperStyle,
1314
+ className,
1315
+ style,
1316
+ children,
1317
+ ...rest
1318
+ }) {
1319
+ return /* @__PURE__ */ jsx21(
1320
+ "div",
1321
+ {
1322
+ className: cx("sc-table-wrap", wrapperClassName),
1323
+ "data-sticky-header": stickyHeader || void 0,
1324
+ "data-scroll": maxHeight ? "" : void 0,
1325
+ style: maxHeight ? { ...wrapperStyle, maxBlockSize: maxHeight } : wrapperStyle,
1326
+ children: /* @__PURE__ */ jsx21(
1327
+ "table",
1328
+ {
1329
+ className: cx("sc-table", className),
1330
+ "data-density": density,
1331
+ "data-divided": divided || void 0,
1332
+ "data-layout": layout,
1333
+ style,
1334
+ ...rest,
1335
+ children
1336
+ }
1337
+ )
1338
+ }
1339
+ );
1340
+ }
1341
+ function Caption({ className, ...rest }) {
1342
+ return /* @__PURE__ */ jsx21("caption", { className: cx("sc-table__caption", className), ...rest });
1343
+ }
1344
+ function Head({ className, ...rest }) {
1345
+ return /* @__PURE__ */ jsx21("thead", { className: cx("sc-table__head", className), ...rest });
1346
+ }
1347
+ function Body2({ className, ...rest }) {
1348
+ return /* @__PURE__ */ jsx21("tbody", { className: cx("sc-table__body", className), ...rest });
1349
+ }
1350
+ function Foot({ className, ...rest }) {
1351
+ return /* @__PURE__ */ jsx21("tfoot", { className: cx("sc-table__foot", className), ...rest });
1352
+ }
1353
+ function Row({ selected = false, interactive = false, className, ...rest }) {
1354
+ return /* @__PURE__ */ jsx21(
1355
+ "tr",
1356
+ {
1357
+ className: cx("sc-table__row", className),
1358
+ "data-selected": selected || void 0,
1359
+ "data-interactive": interactive || void 0,
1360
+ "aria-selected": selected || void 0,
1361
+ ...rest
1362
+ }
1363
+ );
1364
+ }
1365
+ function Header({
1366
+ align,
1367
+ numeric = false,
1368
+ nowrap = false,
1369
+ truncate = false,
1370
+ width,
1371
+ sortable = false,
1372
+ sortDirection = "none",
1373
+ onSort,
1374
+ scope = "col",
1375
+ className,
1376
+ style,
1377
+ children,
1378
+ ...rest
1379
+ }) {
1380
+ const sorted = sortable && sortDirection !== "none";
1381
+ return /* @__PURE__ */ jsx21(
1382
+ "th",
1383
+ {
1384
+ scope,
1385
+ className: cx("sc-table__header", className),
1386
+ "data-align": align ?? (numeric ? "end" : void 0),
1387
+ "data-numeric": numeric || void 0,
1388
+ "data-nowrap": nowrap || void 0,
1389
+ "data-truncate": truncate || void 0,
1390
+ "data-sortable": sortable || void 0,
1391
+ "data-sorted": sorted ? sortDirection : void 0,
1392
+ "aria-sort": sorted ? sortDirection : void 0,
1393
+ style: width ? { ...style, inlineSize: width } : style,
1394
+ ...rest,
1395
+ children: sortable ? /* @__PURE__ */ jsxs18(
1396
+ "button",
1397
+ {
1398
+ type: "button",
1399
+ className: "sc-table__sort",
1400
+ onClick: () => onSort?.(sortDirection === "ascending" ? "descending" : "ascending"),
1401
+ children: [
1402
+ /* @__PURE__ */ jsx21("span", { className: "sc-table__sort-label", children }),
1403
+ /* @__PURE__ */ jsx21("span", { className: "sc-table__sort-icon", "aria-hidden": "true", children: sortDirection === "descending" ? /* @__PURE__ */ jsx21(ArrowDownIcon, { size: "xs" }) : /* @__PURE__ */ jsx21(ArrowUpIcon, { size: "xs" }) })
1404
+ ]
1405
+ }
1406
+ ) : children
1407
+ }
1408
+ );
1409
+ }
1410
+ function Cell({
1411
+ align,
1412
+ numeric = false,
1413
+ nowrap = false,
1414
+ truncate = false,
1415
+ width,
1416
+ className,
1417
+ style,
1418
+ ...rest
1419
+ }) {
1420
+ return /* @__PURE__ */ jsx21(
1421
+ "td",
1422
+ {
1423
+ className: cx("sc-table__cell", className),
1424
+ "data-align": align ?? (numeric ? "end" : void 0),
1425
+ "data-numeric": numeric || void 0,
1426
+ "data-nowrap": nowrap || void 0,
1427
+ "data-truncate": truncate || void 0,
1428
+ style: width ? { ...style, inlineSize: width } : style,
1429
+ ...rest
1430
+ }
1431
+ );
1432
+ }
1433
+ var Table = { Root: Root5, Caption, Head, Body: Body2, Foot, Row, Header, Cell };
1434
+
1435
+ // src/components/Stat/Stat.tsx
1436
+ import { createElement as createElement5 } from "react";
1437
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
1438
+ var trendIcons = {
1439
+ up: /* @__PURE__ */ jsx22(ArrowUpIcon, { size: "xs" }),
1440
+ down: /* @__PURE__ */ jsx22(ArrowDownIcon, { size: "xs" }),
1441
+ flat: /* @__PURE__ */ jsx22(ArrowRightIcon, { size: "xs" })
1442
+ };
1443
+ function Stat({
1444
+ label,
1445
+ value,
1446
+ delta,
1447
+ deltaTone = "neutral",
1448
+ trend,
1449
+ hint,
1450
+ icon,
1451
+ variant = "outlined",
1452
+ size = "md",
1453
+ as = "div",
1454
+ className,
1455
+ ...rest
1456
+ }) {
1457
+ return createElement5(
1458
+ as,
1459
+ {
1460
+ className: cx("sc-stat", className),
1461
+ "data-variant": variant,
1462
+ "data-size": size,
1463
+ ...rest
1464
+ },
1465
+ /* @__PURE__ */ jsxs19(Fragment4, { children: [
1466
+ /* @__PURE__ */ jsx22("div", { className: "sc-stat__label", children: label }),
1467
+ icon ? /* @__PURE__ */ jsx22("span", { className: "sc-stat__icon", "aria-hidden": "true", children: icon }) : null,
1468
+ /* @__PURE__ */ jsx22("div", { className: "sc-stat__value", children: value }),
1469
+ delta != null ? /* @__PURE__ */ jsxs19("div", { className: "sc-stat__delta", "data-tone": deltaTone, children: [
1470
+ trend ? /* @__PURE__ */ jsx22("span", { className: "sc-stat__trend", "aria-hidden": "true", children: trendIcons[trend] }) : null,
1471
+ trend ? /* @__PURE__ */ jsxs19("span", { className: "sc-visually-hidden", children: [
1472
+ trend === "flat" ? "unchanged" : trend,
1473
+ " "
1474
+ ] }) : null,
1475
+ delta
1476
+ ] }) : null,
1477
+ hint != null ? /* @__PURE__ */ jsx22("div", { className: "sc-stat__hint", children: hint }) : null
1478
+ ] })
1479
+ );
1480
+ }
1481
+
1296
1482
  // src/index.ts
1297
1483
  var version = "0.1.1";
1298
1484
  export {
1299
1485
  ArchiveIcon,
1486
+ ArrowDownIcon,
1300
1487
  ArrowLeftIcon,
1301
1488
  ArrowRightIcon,
1489
+ ArrowUpIcon,
1302
1490
  Badge,
1303
1491
  Banner,
1304
1492
  BellIcon,
@@ -1352,8 +1540,10 @@ export {
1352
1540
  Spinner,
1353
1541
  Stack,
1354
1542
  StarIcon,
1543
+ Stat,
1355
1544
  SunIcon,
1356
1545
  Switch,
1546
+ Table,
1357
1547
  Tabs,
1358
1548
  Text,
1359
1549
  Textarea,