@sofya-ds/react 1.8.0 → 1.10.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/dist/index.cjs CHANGED
@@ -138,6 +138,8 @@ __export(index_exports, {
138
138
  TableBody: () => TableBody,
139
139
  TableCaption: () => TableCaption,
140
140
  TableCell: () => TableCell,
141
+ TableCellDescription: () => TableCellDescription,
142
+ TableCellTitle: () => TableCellTitle,
141
143
  TableFooter: () => TableFooter,
142
144
  TableHead: () => TableHead,
143
145
  TableHeader: () => TableHeader,
@@ -212,6 +214,7 @@ __export(index_exports, {
212
214
  switchSizeOptions: () => switchSizeOptions,
213
215
  tableActionToneOptions: () => tableActionToneOptions,
214
216
  tableCellVariantOptions: () => tableCellVariantOptions,
217
+ tableDensityOptions: () => tableDensityOptions,
215
218
  tableStatusToneOptions: () => tableStatusToneOptions,
216
219
  textSizeOptions: () => textSizeOptions,
217
220
  textSplitTypeOptions: () => textSplitTypeOptions,
@@ -345,6 +348,7 @@ var tablerIconRegistry = {
345
348
  IconChevronLeft: import_icons_react.IconChevronLeft,
346
349
  IconChevronDown: import_icons_react.IconChevronDown,
347
350
  IconChevronUp: import_icons_react.IconChevronUp,
351
+ IconCopy: import_icons_react.IconCopy,
348
352
  IconEdit: import_icons_react.IconEdit,
349
353
  IconFile: import_icons_react.IconFile,
350
354
  IconFolders: import_icons_react.IconFolders,
@@ -360,6 +364,7 @@ var tablerIconRegistry = {
360
364
  IconSearch: import_icons_react.IconSearch,
361
365
  IconSquareToggle: import_icons_react.IconSquareToggle,
362
366
  IconSparkles: import_icons_react.IconSparkles,
367
+ IconStar: import_icons_react.IconStar,
363
368
  IconUser: import_icons_react.IconUser,
364
369
  IconUserFilled: import_icons_react.IconUserFilled,
365
370
  IconUserCircle: import_icons_react.IconUserCircle,
@@ -416,7 +421,9 @@ var legacyIconToTablerNameMap = {
416
421
  "caret-up": "IconChevronUp",
417
422
  "caret-left": "IconChevronLeft",
418
423
  "caret-right": "IconChevronRight",
424
+ "copy": "IconCopy",
419
425
  "logout": "IconLogout",
426
+ "star": "IconStar",
420
427
  "users-group": "IconUsersGroup",
421
428
  "archive": "IconArchive",
422
429
  "folder": "IconFolder",
@@ -5640,17 +5647,28 @@ Switch.displayName = SwitchPrimitives.Root.displayName;
5640
5647
  var import_class_variance_authority8 = require("class-variance-authority");
5641
5648
  var React37 = __toESM(require("react"), 1);
5642
5649
  var import_jsx_runtime39 = require("react/jsx-runtime");
5650
+ var tableDensityOptions = ["default", "compact"];
5643
5651
  var tableCellVariantOptions = ["default", "primary", "muted"];
5644
5652
  var tableStatusToneOptions = [
5645
5653
  "active",
5646
5654
  "inactive",
5655
+ "info",
5647
5656
  "warning"
5648
5657
  ];
5649
5658
  var tableActionToneOptions = ["primary", "neutral", "danger"];
5659
+ var TableDensityContext = React37.createContext("default");
5660
+ function useTableDensity(density) {
5661
+ const inheritedDensity = React37.useContext(TableDensityContext);
5662
+ return density ?? inheritedDensity;
5663
+ }
5650
5664
  var tableCellVariants = (0, import_class_variance_authority8.cva)(
5651
- "px-2 py-6 align-middle [font-family:var(--sofya-text-body-font-family)] text-[length:var(--sofya-text-body-font-size)] font-normal leading-[var(--sofya-text-body-line-height)] tracking-[var(--sofya-text-body-letter-spacing)]",
5665
+ "px-4 align-middle [font-family:var(--sofya-text-body-font-family)] text-[length:var(--sofya-text-body-font-size)] font-normal leading-[var(--sofya-text-body-line-height)] tracking-[var(--sofya-text-body-letter-spacing)]",
5652
5666
  {
5653
5667
  variants: {
5668
+ density: {
5669
+ default: "py-5",
5670
+ compact: "h-[72px] py-3"
5671
+ },
5654
5672
  variant: {
5655
5673
  default: "text-[color:var(--sofya-text-soft)]",
5656
5674
  primary: "font-medium text-[color:var(--sofya-text-default)]",
@@ -5658,24 +5676,31 @@ var tableCellVariants = (0, import_class_variance_authority8.cva)(
5658
5676
  }
5659
5677
  },
5660
5678
  defaultVariants: {
5679
+ density: "default",
5661
5680
  variant: "default"
5662
5681
  }
5663
5682
  }
5664
5683
  );
5665
5684
  var tableStatusBadgeVariants = (0, import_class_variance_authority8.cva)("normal-case", {
5666
5685
  variants: {
5686
+ density: {
5687
+ default: "",
5688
+ compact: "h-6 min-h-6 px-4 py-1"
5689
+ },
5667
5690
  tone: {
5668
5691
  active: "border-[color:var(--sofya-tone-success-border)] bg-[color:var(--sofya-tone-success-background)] text-[color:var(--sofya-tone-success-foreground)]",
5669
5692
  inactive: "border-[color:var(--sofya-tone-default-border)] bg-[color:var(--sofya-tone-default-background)] text-[color:var(--sofya-text-subtle)]",
5693
+ info: "border-transparent bg-primary/10 text-primary",
5670
5694
  warning: "border-[color:var(--sofya-tone-warning-border)] bg-[color:var(--sofya-tone-warning-background)] text-[color:var(--sofya-tone-warning-foreground)]"
5671
5695
  }
5672
5696
  },
5673
5697
  defaultVariants: {
5698
+ density: "default",
5674
5699
  tone: "active"
5675
5700
  }
5676
5701
  });
5677
5702
  var tableActionButtonVariants = (0, import_class_variance_authority8.cva)(
5678
- "text-[length:var(--sofya-text-body-font-size)] leading-[var(--sofya-text-body-line-height)] shadow-none motion-safe:active:scale-[0.97] focus-visible:ring-[color:var(--sofya-focus-ring-soft)] focus-visible:ring-offset-0 disabled:opacity-40 [&_svg]:h-[1em] [&_svg]:w-[1em] [&_svg]:shrink-0",
5703
+ "h-8 w-8 text-[length:var(--sofya-text-body-font-size)] leading-[var(--sofya-text-body-line-height)] shadow-none motion-safe:active:scale-[0.97] focus-visible:ring-[color:var(--sofya-focus-ring-soft)] focus-visible:ring-offset-0 disabled:opacity-40 [&_svg]:h-[1em] [&_svg]:w-[1em] [&_svg]:shrink-0",
5679
5704
  {
5680
5705
  variants: {
5681
5706
  tone: {
@@ -5689,8 +5714,8 @@ var tableActionButtonVariants = (0, import_class_variance_authority8.cva)(
5689
5714
  }
5690
5715
  }
5691
5716
  );
5692
- var Table = React37.forwardRef(function Table2({ className, ...props }, ref) {
5693
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5717
+ var Table = React37.forwardRef(function Table2({ className, density = "default", ...props }, ref) {
5718
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableDensityContext.Provider, { value: density, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5694
5719
  "div",
5695
5720
  {
5696
5721
  "data-slot": "table-container",
@@ -5698,31 +5723,32 @@ var Table = React37.forwardRef(function Table2({ className, ...props }, ref) {
5698
5723
  children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5699
5724
  "table",
5700
5725
  {
5726
+ "data-density": density,
5701
5727
  "data-slot": "table",
5702
5728
  ref,
5703
5729
  className: cn(
5704
- "w-full min-w-[1040px] caption-bottom border-collapse bg-card",
5730
+ "w-full min-w-[1040px] caption-bottom border-separate border-spacing-0 bg-card",
5705
5731
  className
5706
5732
  ),
5707
5733
  ...props
5708
5734
  }
5709
5735
  )
5710
5736
  }
5711
- );
5737
+ ) });
5712
5738
  });
5713
5739
  var TableHeader = React37.forwardRef(function TableHeader2({ className, ...props }, ref) {
5714
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5740
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableDensityContext.Provider, { value: "default", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5715
5741
  "thead",
5716
5742
  {
5717
5743
  "data-slot": "table-header",
5718
5744
  ref,
5719
5745
  className: cn(
5720
- "[&_tr]:border-b [&_tr]:border-[color:var(--sofya-border-strong)] [&_tr:hover]:bg-transparent",
5746
+ "[&_tr]:border-0 [&_tr:hover]:bg-transparent [&_th]:bg-[color:var(--sofya-tone-default-background)] [&_th:first-child]:rounded-tl-[var(--sofya-radius-md)] [&_th:last-child]:rounded-tr-[var(--sofya-radius-md)]",
5721
5747
  className
5722
5748
  ),
5723
5749
  ...props
5724
5750
  }
5725
- );
5751
+ ) });
5726
5752
  });
5727
5753
  var TableBody = React37.forwardRef(function TableBody2({ className, ...props }, ref) {
5728
5754
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -5730,7 +5756,7 @@ var TableBody = React37.forwardRef(function TableBody2({ className, ...props },
5730
5756
  {
5731
5757
  "data-slot": "table-body",
5732
5758
  ref,
5733
- className: cn("[&_tr:last-child]:border-0", className),
5759
+ className: cn("[&_tr:last-child>td]:border-0", className),
5734
5760
  ...props
5735
5761
  }
5736
5762
  );
@@ -5749,20 +5775,25 @@ var TableFooter = React37.forwardRef(function TableFooter2({ className, ...props
5749
5775
  }
5750
5776
  );
5751
5777
  });
5752
- var TableRow = React37.forwardRef(function TableRow2({ className, ...props }, ref) {
5753
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5754
- "tr",
5755
- {
5756
- "data-slot": "table-row",
5757
- ref,
5758
- className: cn(
5759
- "border-b border-[color:var(--sofya-border-soft)] transition-colors duration-sofya ease-sofya hover:bg-[color:var(--sofya-tone-default-background)] data-[state=selected]:bg-[color:var(--sofya-tone-default-background)]",
5760
- className
5761
- ),
5762
- ...props
5763
- }
5764
- );
5765
- });
5778
+ var TableRow = React37.forwardRef(
5779
+ function TableRow2({ className, density, ...props }, ref) {
5780
+ const resolvedDensity = useTableDensity(density);
5781
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableDensityContext.Provider, { value: resolvedDensity, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5782
+ "tr",
5783
+ {
5784
+ "data-density": resolvedDensity,
5785
+ "data-slot": "table-row",
5786
+ ref,
5787
+ className: cn(
5788
+ "border-b border-[color:var(--sofya-border-soft)] transition-colors duration-sofya ease-sofya hover:bg-[color:var(--sofya-tone-default-background)] data-[state=selected]:bg-[color:var(--sofya-tone-default-background)] [&>td]:border-b [&>td]:border-[color:var(--sofya-border-soft)]",
5789
+ resolvedDensity === "compact" && "h-[72px]",
5790
+ className
5791
+ ),
5792
+ ...props
5793
+ }
5794
+ ) });
5795
+ }
5796
+ );
5766
5797
  var TableHead = React37.forwardRef(function TableHead2({ className, children, ...props }, ref) {
5767
5798
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5768
5799
  "th",
@@ -5770,7 +5801,7 @@ var TableHead = React37.forwardRef(function TableHead2({ className, children, ..
5770
5801
  "data-slot": "table-head",
5771
5802
  ref,
5772
5803
  className: cn(
5773
- "whitespace-nowrap px-2 py-8 text-left align-middle [font-family:var(--sofya-text-tiny-font-family)] text-[length:var(--sofya-text-tiny-font-size)] font-medium uppercase leading-4 tracking-[0.12em] text-[color:var(--sofya-text-default)] [&_svg]:h-[1em] [&_svg]:w-[1em] [&_svg]:shrink-0",
5804
+ "whitespace-nowrap px-4 py-4 text-left align-middle [font-family:var(--sofya-text-tiny-font-family)] text-[length:var(--sofya-text-tiny-font-size)] font-medium uppercase leading-4 tracking-[0.08em] text-[color:var(--sofya-text-default)] [&_svg]:h-[1em] [&_svg]:w-[1em] [&_svg]:shrink-0",
5774
5805
  className
5775
5806
  ),
5776
5807
  ...props,
@@ -5784,14 +5815,16 @@ var TableHead = React37.forwardRef(function TableHead2({ className, children, ..
5784
5815
  );
5785
5816
  });
5786
5817
  var TableCell = React37.forwardRef(
5787
- function TableCell2({ className, variant, truncate, children, ...props }, ref) {
5818
+ function TableCell2({ className, density, variant, truncate, children, ...props }, ref) {
5819
+ const resolvedDensity = useTableDensity(density);
5788
5820
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5789
5821
  "td",
5790
5822
  {
5823
+ "data-density": resolvedDensity,
5791
5824
  "data-slot": "table-cell",
5792
5825
  ref,
5793
5826
  className: cn(
5794
- tableCellVariants({ variant }),
5827
+ tableCellVariants({ density: resolvedDensity, variant }),
5795
5828
  truncate && "max-w-0",
5796
5829
  className
5797
5830
  ),
@@ -5829,17 +5862,72 @@ var TableCaption = React37.forwardRef(function TableCaption2({ className, childr
5829
5862
  }
5830
5863
  );
5831
5864
  });
5865
+ var TableCellTitle = React37.forwardRef(
5866
+ function TableCellTitle2({ className, children, size, ...props }, ref) {
5867
+ const density = useTableDensity();
5868
+ const resolvedSize = size ?? (density === "compact" ? "compact" : "default");
5869
+ const textSize = resolvedSize === "compact" ? "label-md" : "body";
5870
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5871
+ "span",
5872
+ {
5873
+ "data-slot": "table-cell-title",
5874
+ ref,
5875
+ className: cn(
5876
+ "block font-medium text-[color:var(--sofya-text-default)]",
5877
+ className
5878
+ ),
5879
+ ...props,
5880
+ children: renderTextContent(children, {
5881
+ as: "span",
5882
+ className: "block text-inherit",
5883
+ size: textSize,
5884
+ style: inheritedTypographyStyle
5885
+ })
5886
+ }
5887
+ );
5888
+ }
5889
+ );
5890
+ var TableCellDescription = React37.forwardRef(function TableCellDescription2({ className, children, size, ...props }, ref) {
5891
+ const density = useTableDensity();
5892
+ const resolvedSize = size ?? (density === "compact" ? "compact" : "default");
5893
+ const textSize = resolvedSize === "compact" ? "body-sm" : "tiny";
5894
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5895
+ "span",
5896
+ {
5897
+ "data-slot": "table-cell-description",
5898
+ ref,
5899
+ className: cn(
5900
+ "block text-[color:var(--sofya-text-subtle)]",
5901
+ resolvedSize === "compact" ? "mt-0" : "mt-1",
5902
+ className
5903
+ ),
5904
+ ...props,
5905
+ children: renderTextContent(children, {
5906
+ as: "span",
5907
+ className: "block text-inherit",
5908
+ size: textSize,
5909
+ style: inheritedTypographyStyle
5910
+ })
5911
+ }
5912
+ );
5913
+ });
5832
5914
  function TableStatusBadge({
5833
5915
  className,
5916
+ density,
5834
5917
  tone,
5835
5918
  children,
5836
5919
  ...props
5837
5920
  }) {
5921
+ const resolvedDensity = useTableDensity(density);
5838
5922
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5839
5923
  Badge,
5840
5924
  {
5925
+ "data-density": resolvedDensity,
5841
5926
  variant: "pill",
5842
- className: cn(tableStatusBadgeVariants({ tone }), className),
5927
+ className: cn(
5928
+ tableStatusBadgeVariants({ density: resolvedDensity, tone }),
5929
+ className
5930
+ ),
5843
5931
  ...props,
5844
5932
  children: renderTextContent(children, {
5845
5933
  as: "span",
@@ -5887,6 +5975,8 @@ TableRow.displayName = "TableRow";
5887
5975
  TableHead.displayName = "TableHead";
5888
5976
  TableCell.displayName = "TableCell";
5889
5977
  TableCaption.displayName = "TableCaption";
5978
+ TableCellTitle.displayName = "TableCellTitle";
5979
+ TableCellDescription.displayName = "TableCellDescription";
5890
5980
  TableActionButton.displayName = "TableActionButton";
5891
5981
  TableActions.displayName = "TableActions";
5892
5982
 
@@ -6361,6 +6451,8 @@ var import_tokens4 = require("@sofya-ds/tokens");
6361
6451
  TableBody,
6362
6452
  TableCaption,
6363
6453
  TableCell,
6454
+ TableCellDescription,
6455
+ TableCellTitle,
6364
6456
  TableFooter,
6365
6457
  TableHead,
6366
6458
  TableHeader,
@@ -6435,6 +6527,7 @@ var import_tokens4 = require("@sofya-ds/tokens");
6435
6527
  switchSizeOptions,
6436
6528
  tableActionToneOptions,
6437
6529
  tableCellVariantOptions,
6530
+ tableDensityOptions,
6438
6531
  tableStatusToneOptions,
6439
6532
  textSizeOptions,
6440
6533
  textSplitTypeOptions,