@fluid-app/ui-primitives 0.1.0 → 0.1.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/index.cjs CHANGED
@@ -4,11 +4,12 @@ var clsx = require('clsx');
4
4
  var tailwindMerge = require('tailwind-merge');
5
5
  var zod = require('@hookform/resolvers/zod');
6
6
  var reactHookForm = require('react-hook-form');
7
- var React6 = require('react');
7
+ var React8 = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var AccordionPrimitive = require('@radix-ui/react-accordion');
10
10
  var lucideReact = require('lucide-react');
11
11
  var classVarianceAuthority = require('class-variance-authority');
12
+ var radixUi = require('radix-ui');
12
13
  var reactSlot = require('@radix-ui/react-slot');
13
14
  var reactDayPicker = require('react-day-picker');
14
15
  var RechartsPrimitive = require('recharts');
@@ -44,7 +45,7 @@ function _interopNamespace(e) {
44
45
  return Object.freeze(n);
45
46
  }
46
47
 
47
- var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
48
+ var React8__namespace = /*#__PURE__*/_interopNamespace(React8);
48
49
  var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
49
50
  var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
50
51
  var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
@@ -71,7 +72,7 @@ function useZodForm(schema, options) {
71
72
  const resolver = zodResolverFn(schema);
72
73
  return reactHookForm.useForm({ ...options, resolver });
73
74
  }
74
- var PortalContainerContext = React6.createContext(
75
+ var PortalContainerContext = React8.createContext(
75
76
  void 0
76
77
  );
77
78
  function PortalContainerProvider({
@@ -81,7 +82,7 @@ function PortalContainerProvider({
81
82
  return /* @__PURE__ */ jsxRuntime.jsx(PortalContainerContext.Provider, { value: container ?? void 0, children });
82
83
  }
83
84
  function usePortalContainer() {
84
- return React6.useContext(PortalContainerContext);
85
+ return React8.useContext(PortalContainerContext);
85
86
  }
86
87
  function Accordion({
87
88
  className,
@@ -212,6 +213,133 @@ function AlertDescription({
212
213
  }
213
214
  );
214
215
  }
216
+ function Avatar({
217
+ className,
218
+ size = "default",
219
+ ...props
220
+ }) {
221
+ return /* @__PURE__ */ jsxRuntime.jsx(
222
+ radixUi.Avatar.Root,
223
+ {
224
+ "data-slot": "avatar",
225
+ "data-size": size,
226
+ className: cn(
227
+ "group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
228
+ className
229
+ ),
230
+ ...props
231
+ }
232
+ );
233
+ }
234
+ function AvatarImage({
235
+ className,
236
+ ...props
237
+ }) {
238
+ return /* @__PURE__ */ jsxRuntime.jsx(
239
+ radixUi.Avatar.Image,
240
+ {
241
+ "data-slot": "avatar-image",
242
+ className: cn("aspect-square size-full", className),
243
+ ...props
244
+ }
245
+ );
246
+ }
247
+ function AvatarFallback({
248
+ className,
249
+ ...props
250
+ }) {
251
+ return /* @__PURE__ */ jsxRuntime.jsx(
252
+ radixUi.Avatar.Fallback,
253
+ {
254
+ "data-slot": "avatar-fallback",
255
+ className: cn(
256
+ "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
257
+ className
258
+ ),
259
+ ...props
260
+ }
261
+ );
262
+ }
263
+ function AvatarBadge({ className, ...props }) {
264
+ return /* @__PURE__ */ jsxRuntime.jsx(
265
+ "span",
266
+ {
267
+ "data-slot": "avatar-badge",
268
+ className: cn(
269
+ "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background select-none",
270
+ "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
271
+ "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
272
+ "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
273
+ className
274
+ ),
275
+ ...props
276
+ }
277
+ );
278
+ }
279
+ function AvatarGroup({ className, ...props }) {
280
+ return /* @__PURE__ */ jsxRuntime.jsx(
281
+ "div",
282
+ {
283
+ "data-slot": "avatar-group",
284
+ className: cn(
285
+ "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
286
+ className
287
+ ),
288
+ ...props
289
+ }
290
+ );
291
+ }
292
+ function AvatarGroupCount({
293
+ className,
294
+ ...props
295
+ }) {
296
+ return /* @__PURE__ */ jsxRuntime.jsx(
297
+ "div",
298
+ {
299
+ "data-slot": "avatar-group-count",
300
+ className: cn(
301
+ "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
302
+ className
303
+ ),
304
+ ...props
305
+ }
306
+ );
307
+ }
308
+ var badgeVariants = classVarianceAuthority.cva(
309
+ "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
310
+ {
311
+ variants: {
312
+ variant: {
313
+ default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
314
+ secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
315
+ destructive: "bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
316
+ outline: "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
317
+ ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
318
+ link: "text-primary underline-offset-4 [a&]:hover:underline"
319
+ }
320
+ },
321
+ defaultVariants: {
322
+ variant: "default"
323
+ }
324
+ }
325
+ );
326
+ function Badge({
327
+ className,
328
+ variant = "default",
329
+ asChild = false,
330
+ ...props
331
+ }) {
332
+ const Comp = asChild ? radixUi.Slot.Root : "span";
333
+ return /* @__PURE__ */ jsxRuntime.jsx(
334
+ Comp,
335
+ {
336
+ "data-slot": "badge",
337
+ "data-variant": variant,
338
+ className: cn(badgeVariants({ variant }), className),
339
+ ...props
340
+ }
341
+ );
342
+ }
215
343
  var buttonVariants = classVarianceAuthority.cva(
216
344
  "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
217
345
  {
@@ -400,9 +528,9 @@ function CardFooter({ className, ...props }) {
400
528
  );
401
529
  }
402
530
  var THEMES = { light: "", dark: ".dark" };
403
- var ChartContext = React6__namespace.createContext(null);
531
+ var ChartContext = React8__namespace.createContext(null);
404
532
  function useChart() {
405
- const context = React6__namespace.useContext(ChartContext);
533
+ const context = React8__namespace.useContext(ChartContext);
406
534
  if (!context) {
407
535
  throw new Error("useChart must be used within a <ChartContainer />");
408
536
  }
@@ -415,7 +543,7 @@ function ChartContainer({
415
543
  config,
416
544
  ...props
417
545
  }) {
418
- const uniqueId = React6__namespace.useId();
546
+ const uniqueId = React8__namespace.useId();
419
547
  const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
420
548
  return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
421
549
  "div",
@@ -476,7 +604,7 @@ function ChartTooltipContent({
476
604
  labelKey
477
605
  }) {
478
606
  const { config } = useChart();
479
- const tooltipLabel = React6__namespace.useMemo(() => {
607
+ const tooltipLabel = React8__namespace.useMemo(() => {
480
608
  if (hideLabel || !payload?.length) {
481
609
  return null;
482
610
  }
@@ -1164,6 +1292,43 @@ function PopoverDescription({
1164
1292
  }
1165
1293
  );
1166
1294
  }
1295
+ function RadioGroup2({
1296
+ className,
1297
+ ...props
1298
+ }) {
1299
+ return /* @__PURE__ */ jsxRuntime.jsx(
1300
+ radixUi.RadioGroup.Root,
1301
+ {
1302
+ "data-slot": "radio-group",
1303
+ className: cn("grid gap-3", className),
1304
+ ...props
1305
+ }
1306
+ );
1307
+ }
1308
+ function RadioGroupItem({
1309
+ className,
1310
+ ...props
1311
+ }) {
1312
+ return /* @__PURE__ */ jsxRuntime.jsx(
1313
+ radixUi.RadioGroup.Item,
1314
+ {
1315
+ "data-slot": "radio-group-item",
1316
+ className: cn(
1317
+ "aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
1318
+ className
1319
+ ),
1320
+ ...props,
1321
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1322
+ radixUi.RadioGroup.Indicator,
1323
+ {
1324
+ "data-slot": "radio-group-indicator",
1325
+ className: "relative flex items-center justify-center",
1326
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" })
1327
+ }
1328
+ )
1329
+ }
1330
+ );
1331
+ }
1167
1332
  function Select({
1168
1333
  ...props
1169
1334
  }) {
@@ -1320,7 +1485,7 @@ function SelectScrollDownButton({
1320
1485
  }
1321
1486
  );
1322
1487
  }
1323
- var Separator3 = React6__namespace.forwardRef(
1488
+ var Separator3 = React8__namespace.forwardRef(
1324
1489
  ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1325
1490
  SeparatorPrimitive__namespace.Root,
1326
1491
  {
@@ -1349,7 +1514,7 @@ function Skeleton({
1349
1514
  }
1350
1515
  );
1351
1516
  }
1352
- var Slider = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1517
+ var Slider = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1353
1518
  SliderPrimitive__namespace.Root,
1354
1519
  {
1355
1520
  ref,
@@ -1372,7 +1537,7 @@ function SheetPortal(props) {
1372
1537
  const portalContainer = usePortalContainer();
1373
1538
  return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Portal, { container: portalContainer, ...props });
1374
1539
  }
1375
- var SheetOverlay = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1540
+ var SheetOverlay = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1376
1541
  SheetPrimitive__namespace.Overlay,
1377
1542
  {
1378
1543
  className: cn(
@@ -1400,7 +1565,7 @@ var sheetVariants = classVarianceAuthority.cva(
1400
1565
  }
1401
1566
  }
1402
1567
  );
1403
- var SheetContent = React6__namespace.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
1568
+ var SheetContent = React8__namespace.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
1404
1569
  /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, {}),
1405
1570
  /* @__PURE__ */ jsxRuntime.jsxs(
1406
1571
  SheetPrimitive__namespace.Content,
@@ -1443,7 +1608,7 @@ function SheetFooter({ className, ...props }) {
1443
1608
  }
1444
1609
  );
1445
1610
  }
1446
- var SheetTitle = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1611
+ var SheetTitle = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1447
1612
  SheetPrimitive__namespace.Title,
1448
1613
  {
1449
1614
  ref,
@@ -1452,7 +1617,7 @@ var SheetTitle = React6__namespace.forwardRef(({ className, ...props }, ref) =>
1452
1617
  }
1453
1618
  ));
1454
1619
  SheetTitle.displayName = SheetPrimitive__namespace.Title.displayName;
1455
- var SheetDescription = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1620
+ var SheetDescription = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1456
1621
  SheetPrimitive__namespace.Description,
1457
1622
  {
1458
1623
  ref,
@@ -1513,7 +1678,7 @@ function SpinnerWithText({
1513
1678
  }
1514
1679
  );
1515
1680
  }
1516
- var Switch = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1681
+ var Switch = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1517
1682
  SwitchPrimitive__namespace.Root,
1518
1683
  {
1519
1684
  className: cn(
@@ -1533,6 +1698,108 @@ var Switch = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @
1533
1698
  }
1534
1699
  ));
1535
1700
  Switch.displayName = SwitchPrimitive__namespace.Root.displayName;
1701
+ function Table({ className, ...props }) {
1702
+ return /* @__PURE__ */ jsxRuntime.jsx(
1703
+ "div",
1704
+ {
1705
+ "data-slot": "table-container",
1706
+ className: "relative w-full overflow-x-auto",
1707
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1708
+ "table",
1709
+ {
1710
+ "data-slot": "table",
1711
+ className: cn("w-full caption-bottom text-sm", className),
1712
+ ...props
1713
+ }
1714
+ )
1715
+ }
1716
+ );
1717
+ }
1718
+ function TableHeader({ className, ...props }) {
1719
+ return /* @__PURE__ */ jsxRuntime.jsx(
1720
+ "thead",
1721
+ {
1722
+ "data-slot": "table-header",
1723
+ className: cn("[&_tr]:border-b", className),
1724
+ ...props
1725
+ }
1726
+ );
1727
+ }
1728
+ function TableBody({ className, ...props }) {
1729
+ return /* @__PURE__ */ jsxRuntime.jsx(
1730
+ "tbody",
1731
+ {
1732
+ "data-slot": "table-body",
1733
+ className: cn("[&_tr:last-child]:border-0", className),
1734
+ ...props
1735
+ }
1736
+ );
1737
+ }
1738
+ function TableFooter({ className, ...props }) {
1739
+ return /* @__PURE__ */ jsxRuntime.jsx(
1740
+ "tfoot",
1741
+ {
1742
+ "data-slot": "table-footer",
1743
+ className: cn(
1744
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
1745
+ className
1746
+ ),
1747
+ ...props
1748
+ }
1749
+ );
1750
+ }
1751
+ function TableRow({ className, ...props }) {
1752
+ return /* @__PURE__ */ jsxRuntime.jsx(
1753
+ "tr",
1754
+ {
1755
+ "data-slot": "table-row",
1756
+ className: cn(
1757
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
1758
+ className
1759
+ ),
1760
+ ...props
1761
+ }
1762
+ );
1763
+ }
1764
+ function TableHead({ className, ...props }) {
1765
+ return /* @__PURE__ */ jsxRuntime.jsx(
1766
+ "th",
1767
+ {
1768
+ "data-slot": "table-head",
1769
+ className: cn(
1770
+ "h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1771
+ className
1772
+ ),
1773
+ ...props
1774
+ }
1775
+ );
1776
+ }
1777
+ function TableCell({ className, ...props }) {
1778
+ return /* @__PURE__ */ jsxRuntime.jsx(
1779
+ "td",
1780
+ {
1781
+ "data-slot": "table-cell",
1782
+ className: cn(
1783
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1784
+ className
1785
+ ),
1786
+ ...props
1787
+ }
1788
+ );
1789
+ }
1790
+ function TableCaption({
1791
+ className,
1792
+ ...props
1793
+ }) {
1794
+ return /* @__PURE__ */ jsxRuntime.jsx(
1795
+ "caption",
1796
+ {
1797
+ "data-slot": "table-caption",
1798
+ className: cn("mt-4 text-sm text-muted-foreground", className),
1799
+ ...props
1800
+ }
1801
+ );
1802
+ }
1536
1803
  function Tabs({
1537
1804
  className,
1538
1805
  ...props
@@ -1604,7 +1871,7 @@ function Textarea({ className, ...props }) {
1604
1871
  }
1605
1872
  );
1606
1873
  }
1607
- var ToggleGroupContext = React6__namespace.createContext({
1874
+ var ToggleGroupContext = React8__namespace.createContext({
1608
1875
  size: "default",
1609
1876
  variant: "default",
1610
1877
  spacing: 0,
@@ -1650,7 +1917,7 @@ function ToggleGroupItem({
1650
1917
  size = "default",
1651
1918
  ...props
1652
1919
  }) {
1653
- const context = React6__namespace.useContext(ToggleGroupContext);
1920
+ const context = React8__namespace.useContext(ToggleGroupContext);
1654
1921
  return /* @__PURE__ */ jsxRuntime.jsx(
1655
1922
  ToggleGroupPrimitive__namespace.Item,
1656
1923
  {
@@ -1702,6 +1969,13 @@ exports.AccordionTrigger = AccordionTrigger;
1702
1969
  exports.Alert = Alert;
1703
1970
  exports.AlertDescription = AlertDescription;
1704
1971
  exports.AlertTitle = AlertTitle;
1972
+ exports.Avatar = Avatar;
1973
+ exports.AvatarBadge = AvatarBadge;
1974
+ exports.AvatarFallback = AvatarFallback;
1975
+ exports.AvatarGroup = AvatarGroup;
1976
+ exports.AvatarGroupCount = AvatarGroupCount;
1977
+ exports.AvatarImage = AvatarImage;
1978
+ exports.Badge = Badge;
1705
1979
  exports.Button = Button;
1706
1980
  exports.Calendar = Calendar;
1707
1981
  exports.Card = Card;
@@ -1757,6 +2031,8 @@ exports.PopoverHeader = PopoverHeader;
1757
2031
  exports.PopoverTitle = PopoverTitle;
1758
2032
  exports.PopoverTrigger = PopoverTrigger;
1759
2033
  exports.PortalContainerProvider = PortalContainerProvider;
2034
+ exports.RadioGroup = RadioGroup2;
2035
+ exports.RadioGroupItem = RadioGroupItem;
1760
2036
  exports.Select = Select;
1761
2037
  exports.SelectContent = SelectContent;
1762
2038
  exports.SelectGroup = SelectGroup;
@@ -1782,6 +2058,14 @@ exports.Skeleton = Skeleton;
1782
2058
  exports.Slider = Slider;
1783
2059
  exports.SpinnerWithText = SpinnerWithText;
1784
2060
  exports.Switch = Switch;
2061
+ exports.Table = Table;
2062
+ exports.TableBody = TableBody;
2063
+ exports.TableCaption = TableCaption;
2064
+ exports.TableCell = TableCell;
2065
+ exports.TableFooter = TableFooter;
2066
+ exports.TableHead = TableHead;
2067
+ exports.TableHeader = TableHeader;
2068
+ exports.TableRow = TableRow;
1785
2069
  exports.Tabs = Tabs;
1786
2070
  exports.TabsContent = TabsContent;
1787
2071
  exports.TabsList = TabsList;
@@ -1794,6 +2078,7 @@ exports.Tooltip = Tooltip2;
1794
2078
  exports.TooltipContent = TooltipContent;
1795
2079
  exports.TooltipProvider = TooltipProvider;
1796
2080
  exports.TooltipTrigger = TooltipTrigger;
2081
+ exports.badgeVariants = badgeVariants;
1797
2082
  exports.buttonVariants = buttonVariants;
1798
2083
  exports.cn = cn;
1799
2084
  exports.toggleVariants = toggleVariants;