@pos-360/horizon 0.11.0 → 0.12.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.
@@ -11,6 +11,9 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
11
11
  import { AnimatePresence, motion } from 'framer-motion';
12
12
  import * as SelectPrimitive from '@radix-ui/react-select';
13
13
  import * as TabsPrimitive from '@radix-ui/react-tabs';
14
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
15
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
14
17
 
15
18
  var buttonVariants = cva(
16
19
  "group inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-hz-md text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
@@ -1243,8 +1246,6 @@ var useTabsContext = () => {
1243
1246
  }
1244
1247
  return context;
1245
1248
  };
1246
- var TabsListContext = React9.createContext({ color: "default" });
1247
- var useTabsListContext = () => React9.useContext(TabsListContext);
1248
1249
  var Tabs = React9.forwardRef(({ defaultValue, value, onValueChange, children, ...props }, ref) => {
1249
1250
  const [activeTab, setActiveTabState] = React9.useState(value ?? defaultValue);
1250
1251
  const tabRefs = React9.useRef(/* @__PURE__ */ new Map()).current;
@@ -1286,39 +1287,7 @@ var Tabs = React9.forwardRef(({ defaultValue, value, onValueChange, children, ..
1286
1287
  );
1287
1288
  });
1288
1289
  Tabs.displayName = "Tabs";
1289
- var listColorStyles = {
1290
- default: "bg-gray-100 text-gray-500 dark:bg-neutral-700 dark:text-gray-400",
1291
- primary: "bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-300",
1292
- success: "bg-green-100 text-green-600 dark:bg-green-900/40 dark:text-green-300",
1293
- danger: "bg-red-100 text-red-600 dark:bg-red-900/40 dark:text-red-300",
1294
- warning: "bg-amber-100 text-amber-600 dark:bg-amber-900/40 dark:text-amber-300",
1295
- secondary: "bg-purple-100 text-purple-600 dark:bg-purple-900/40 dark:text-purple-300"
1296
- };
1297
- var indicatorColorStyles = {
1298
- default: "bg-white dark:bg-neutral-900 shadow-sm",
1299
- primary: "bg-blue-500 dark:bg-blue-600",
1300
- success: "bg-green-500 dark:bg-green-600",
1301
- danger: "bg-red-500 dark:bg-red-600",
1302
- warning: "bg-amber-500 dark:bg-amber-600",
1303
- secondary: "bg-purple-500 dark:bg-purple-600"
1304
- };
1305
- var activeTextColorStyles = {
1306
- default: "text-gray-900 dark:text-gray-100",
1307
- primary: "text-white dark:text-white",
1308
- success: "text-white dark:text-white",
1309
- danger: "text-white dark:text-white",
1310
- warning: "text-white dark:text-white",
1311
- secondary: "text-white dark:text-white"
1312
- };
1313
- var inactiveTextColorStyles = {
1314
- default: "text-gray-500 dark:text-gray-400",
1315
- primary: "text-blue-600 dark:text-blue-300",
1316
- success: "text-green-600 dark:text-green-300",
1317
- danger: "text-red-600 dark:text-red-300",
1318
- warning: "text-amber-600 dark:text-amber-300",
1319
- secondary: "text-purple-600 dark:text-purple-300"
1320
- };
1321
- var TabsList = React9.forwardRef(({ className, children, color = "default", ...props }, ref) => {
1290
+ var TabsList = React9.forwardRef(({ className, children, ...props }, ref) => {
1322
1291
  const { activeTab, tabRefs, listRef } = useTabsContext();
1323
1292
  const [indicatorStyle, setIndicatorStyle] = React9.useState(null);
1324
1293
  React9.useEffect(() => {
@@ -1337,7 +1306,7 @@ var TabsList = React9.forwardRef(({ className, children, color = "default", ...p
1337
1306
  window.addEventListener("resize", updateIndicator);
1338
1307
  return () => window.removeEventListener("resize", updateIndicator);
1339
1308
  }, [activeTab, tabRefs, listRef]);
1340
- return /* @__PURE__ */ jsx(TabsListContext.Provider, { value: { color }, children: /* @__PURE__ */ jsxs(
1309
+ return /* @__PURE__ */ jsxs(
1341
1310
  TabsPrimitive.List,
1342
1311
  {
1343
1312
  ref: (node) => {
@@ -1347,7 +1316,7 @@ var TabsList = React9.forwardRef(({ className, children, color = "default", ...p
1347
1316
  },
1348
1317
  className: cn(
1349
1318
  "relative inline-flex h-10 items-center justify-center rounded-hz-lg p-1",
1350
- listColorStyles[color],
1319
+ "bg-gray-100 text-gray-500 dark:bg-neutral-700 dark:text-gray-400",
1351
1320
  className
1352
1321
  ),
1353
1322
  ...props,
@@ -1355,7 +1324,7 @@ var TabsList = React9.forwardRef(({ className, children, color = "default", ...p
1355
1324
  indicatorStyle && /* @__PURE__ */ jsx(
1356
1325
  motion.div,
1357
1326
  {
1358
- className: cn("absolute h-8 rounded-hz-md", indicatorColorStyles[color]),
1327
+ className: cn("absolute h-8 rounded-hz-md", "bg-white dark:bg-neutral-900 shadow-sm"),
1359
1328
  initial: false,
1360
1329
  animate: {
1361
1330
  left: indicatorStyle.left,
@@ -1371,12 +1340,11 @@ var TabsList = React9.forwardRef(({ className, children, color = "default", ...p
1371
1340
  children
1372
1341
  ]
1373
1342
  }
1374
- ) });
1343
+ );
1375
1344
  });
1376
1345
  TabsList.displayName = TabsPrimitive.List.displayName;
1377
1346
  var TabsTrigger = React9.forwardRef(({ className, value, ...props }, ref) => {
1378
1347
  const { registerTab, activeTab } = useTabsContext();
1379
- const { color } = useTabsListContext();
1380
1348
  const triggerRef = React9.useRef(null);
1381
1349
  React9.useEffect(() => {
1382
1350
  registerTab(value, triggerRef.current);
@@ -1394,7 +1362,7 @@ var TabsTrigger = React9.forwardRef(({ className, value, ...props }, ref) => {
1394
1362
  value,
1395
1363
  className: cn(
1396
1364
  "relative z-10 inline-flex items-center justify-center whitespace-nowrap rounded-hz-md px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
1397
- isActive ? activeTextColorStyles[color] : inactiveTextColorStyles[color],
1365
+ isActive ? "text-gray-900 dark:text-gray-100" : "text-gray-500 dark:text-gray-400",
1398
1366
  className
1399
1367
  ),
1400
1368
  ...props
@@ -1431,7 +1399,7 @@ var Textarea = React9.forwardRef(
1431
1399
  );
1432
1400
  Textarea.displayName = "Textarea";
1433
1401
  var toggleGroupVariants = cva(
1434
- "inline-flex w-fit items-stretch rounded-hz-lg border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1402
+ "inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1435
1403
  {
1436
1404
  variants: {
1437
1405
  size: {
@@ -1446,61 +1414,267 @@ var toggleGroupVariants = cva(
1446
1414
  }
1447
1415
  );
1448
1416
  var toggleItemVariants = cva(
1449
- "inline-flex flex-1 items-center justify-center whitespace-nowrap px-6 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 first:rounded-l-hz-lg last:rounded-r-hz-lg",
1417
+ "inline-flex flex-1 items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
1450
1418
  {
1451
1419
  variants: {
1452
1420
  size: {
1453
- default: "h-full min-w-[120px]",
1454
- sm: "h-full min-w-[90px] text-xs",
1455
- lg: "h-full min-w-[140px] text-base"
1421
+ default: "h-full px-6",
1422
+ sm: "h-full px-4 text-xs",
1423
+ lg: "h-full px-8 text-base"
1456
1424
  },
1457
- active: {
1458
- true: "!bg-blue-50 border border-blue-500 text-blue-600 dark:!bg-blue-950/40 dark:border-blue-400 dark:text-blue-400",
1459
- false: "!bg-transparent border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
1425
+ iconOnly: {
1426
+ true: "aspect-square px-0 min-w-0",
1427
+ false: "min-w-[120px]"
1460
1428
  }
1461
1429
  },
1430
+ compoundVariants: [
1431
+ { size: "sm", iconOnly: false, class: "min-w-[90px]" },
1432
+ { size: "lg", iconOnly: false, class: "min-w-[140px]" }
1433
+ ],
1462
1434
  defaultVariants: {
1463
1435
  size: "default",
1464
- active: false
1436
+ iconOnly: false
1465
1437
  }
1466
1438
  }
1467
1439
  );
1440
+ var containerRadiusClass = {
1441
+ none: "rounded-hz-lg",
1442
+ sm: "rounded-sm",
1443
+ md: "rounded-md",
1444
+ lg: "rounded-lg",
1445
+ full: "rounded-full"
1446
+ };
1447
+ var itemRadiusClass = {
1448
+ none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
1449
+ sm: "first:rounded-l-sm last:rounded-r-sm",
1450
+ md: "first:rounded-l-md last:rounded-r-md",
1451
+ lg: "first:rounded-l-lg last:rounded-r-lg",
1452
+ full: "rounded-full"
1453
+ };
1468
1454
  function Toggle({
1469
1455
  className,
1470
1456
  options,
1471
1457
  value,
1472
1458
  onChange,
1473
1459
  size,
1460
+ radius = "none",
1474
1461
  ...props
1475
1462
  }) {
1476
1463
  return /* @__PURE__ */ jsx(
1477
- "div",
1464
+ ToggleGroupPrimitive.Root,
1465
+ {
1466
+ ...props,
1467
+ type: "multiple",
1468
+ ...value !== void 0 ? { value, onValueChange: onChange } : {},
1469
+ className: cn(
1470
+ toggleGroupVariants({ size }),
1471
+ containerRadiusClass[radius],
1472
+ className
1473
+ ),
1474
+ children: options.map((option) => {
1475
+ const iconOnly = !!option.icon && !option.label;
1476
+ return /* @__PURE__ */ jsxs(
1477
+ ToggleGroupPrimitive.Item,
1478
+ {
1479
+ value: option.value,
1480
+ disabled: option.disabled,
1481
+ "aria-label": iconOnly ? option.ariaLabel ?? option.value : void 0,
1482
+ className: cn(
1483
+ toggleItemVariants({ size, iconOnly }),
1484
+ itemRadiusClass[radius],
1485
+ "border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
1486
+ "data-[state=on]:!bg-blue-50 data-[state=on]:border-blue-500 data-[state=on]:text-blue-600",
1487
+ "dark:data-[state=on]:!bg-blue-950/40 dark:data-[state=on]:border-blue-400 dark:data-[state=on]:text-blue-400"
1488
+ ),
1489
+ children: [
1490
+ option.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 inline-flex", children: option.icon }),
1491
+ option.label
1492
+ ]
1493
+ },
1494
+ option.value
1495
+ );
1496
+ })
1497
+ }
1498
+ );
1499
+ }
1500
+ var segmentedControlVariants = cva(
1501
+ "inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1502
+ {
1503
+ variants: {
1504
+ size: {
1505
+ default: "h-[52px]",
1506
+ sm: "h-10",
1507
+ lg: "h-[60px]"
1508
+ }
1509
+ },
1510
+ defaultVariants: {
1511
+ size: "default"
1512
+ }
1513
+ }
1514
+ );
1515
+ var segmentedControlItemVariants = cva(
1516
+ "inline-flex flex-1 cursor-pointer items-center justify-center whitespace-nowrap px-6 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
1517
+ {
1518
+ variants: {
1519
+ size: {
1520
+ default: "h-full min-w-[120px]",
1521
+ sm: "h-full min-w-[90px] text-xs",
1522
+ lg: "h-full min-w-[140px] text-base"
1523
+ }
1524
+ },
1525
+ defaultVariants: {
1526
+ size: "default"
1527
+ }
1528
+ }
1529
+ );
1530
+ var containerRadiusClass2 = {
1531
+ none: "rounded-hz-lg",
1532
+ sm: "rounded-sm",
1533
+ md: "rounded-md",
1534
+ lg: "rounded-lg",
1535
+ full: "rounded-full"
1536
+ };
1537
+ var itemRadiusClass2 = {
1538
+ none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
1539
+ sm: "first:rounded-l-sm last:rounded-r-sm",
1540
+ md: "first:rounded-l-md last:rounded-r-md",
1541
+ lg: "first:rounded-l-lg last:rounded-r-lg",
1542
+ full: "rounded-full"
1543
+ };
1544
+ function SegmentedControl({
1545
+ className,
1546
+ options,
1547
+ value,
1548
+ onChange,
1549
+ size,
1550
+ radius = "none",
1551
+ ...props
1552
+ }) {
1553
+ return /* @__PURE__ */ jsx(
1554
+ RadioGroupPrimitive.Root,
1478
1555
  {
1479
- role: "radiogroup",
1480
- className: cn(toggleGroupVariants({ size }), className),
1481
1556
  ...props,
1482
- children: options.map((option) => /* @__PURE__ */ jsx(
1483
- "button",
1557
+ ...value !== void 0 ? { value, onValueChange: onChange } : {},
1558
+ className: cn(
1559
+ segmentedControlVariants({ size }),
1560
+ containerRadiusClass2[radius],
1561
+ className
1562
+ ),
1563
+ children: options.map((option) => /* @__PURE__ */ jsxs(
1564
+ RadioGroupPrimitive.Item,
1484
1565
  {
1485
- role: "radio",
1486
- type: "button",
1487
- "aria-checked": value === option.value,
1566
+ value: option.value,
1488
1567
  disabled: option.disabled,
1489
1568
  className: cn(
1490
- toggleItemVariants({
1491
- size,
1492
- active: value === option.value
1493
- })
1569
+ segmentedControlItemVariants({ size }),
1570
+ itemRadiusClass2[radius],
1571
+ "border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
1572
+ "data-[state=checked]:!bg-blue-50 data-[state=checked]:border-blue-500 data-[state=checked]:text-blue-600",
1573
+ "dark:data-[state=checked]:!bg-blue-950/40 dark:data-[state=checked]:border-blue-400 dark:data-[state=checked]:text-blue-400"
1494
1574
  ),
1495
- onClick: () => onChange(option.value),
1496
- children: option.label
1575
+ children: [
1576
+ /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "hidden" }),
1577
+ option.label
1578
+ ]
1497
1579
  },
1498
1580
  option.value
1499
1581
  ))
1500
1582
  }
1501
1583
  );
1502
1584
  }
1585
+ var switchTrackVariants = cva(
1586
+ "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-gray-200 dark:data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-700",
1587
+ {
1588
+ variants: {
1589
+ size: {
1590
+ sm: "h-5 w-9",
1591
+ default: "h-6 w-11",
1592
+ lg: "h-7 w-[52px]"
1593
+ }
1594
+ },
1595
+ defaultVariants: {
1596
+ size: "default"
1597
+ }
1598
+ }
1599
+ );
1600
+ var switchThumbVariants = cva(
1601
+ "pointer-events-none block rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=unchecked]:translate-x-0",
1602
+ {
1603
+ variants: {
1604
+ size: {
1605
+ sm: "h-4 w-4 data-[state=checked]:translate-x-4",
1606
+ default: "h-5 w-5 data-[state=checked]:translate-x-5",
1607
+ lg: "h-6 w-6 data-[state=checked]:translate-x-6"
1608
+ }
1609
+ },
1610
+ defaultVariants: {
1611
+ size: "default"
1612
+ }
1613
+ }
1614
+ );
1615
+ var switchLabelVariants = cva("select-none", {
1616
+ variants: {
1617
+ size: {
1618
+ sm: "text-xs",
1619
+ default: "text-sm",
1620
+ lg: "text-base"
1621
+ }
1622
+ },
1623
+ defaultVariants: {
1624
+ size: "default"
1625
+ }
1626
+ });
1627
+ var Switch = React9.forwardRef(({ className, size, label, labelPosition = "right", ...props }, ref) => {
1628
+ const generatedId = React9.useId();
1629
+ const switchId = props.id ?? generatedId;
1630
+ const switchEl = /* @__PURE__ */ jsx(
1631
+ SwitchPrimitive.Root,
1632
+ {
1633
+ ...props,
1634
+ id: switchId,
1635
+ ref,
1636
+ className: cn(switchTrackVariants({ size }), className),
1637
+ children: /* @__PURE__ */ jsx(SwitchPrimitive.Thumb, { className: switchThumbVariants({ size }) })
1638
+ }
1639
+ );
1640
+ if (!label) return switchEl;
1641
+ return /* @__PURE__ */ jsxs(
1642
+ "div",
1643
+ {
1644
+ className: cn(
1645
+ "inline-flex items-center gap-2",
1646
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1647
+ ),
1648
+ children: [
1649
+ labelPosition === "left" && /* @__PURE__ */ jsx(
1650
+ "label",
1651
+ {
1652
+ htmlFor: switchId,
1653
+ className: cn(
1654
+ switchLabelVariants({ size }),
1655
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1656
+ ),
1657
+ children: label
1658
+ }
1659
+ ),
1660
+ switchEl,
1661
+ labelPosition === "right" && /* @__PURE__ */ jsx(
1662
+ "label",
1663
+ {
1664
+ htmlFor: switchId,
1665
+ className: cn(
1666
+ switchLabelVariants({ size }),
1667
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1668
+ ),
1669
+ children: label
1670
+ }
1671
+ )
1672
+ ]
1673
+ }
1674
+ );
1675
+ });
1676
+ Switch.displayName = "Switch";
1503
1677
 
1504
- export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Skeleton, SkeletonAvatar, SkeletonBadge, SkeletonButton, SkeletonCard, SkeletonIcon, SkeletonInput, SkeletonSubtitle, SkeletonTableRow, SkeletonTableRows, SkeletonText, SkeletonTitle, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableRowCheckbox, TableSelectAll, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, buttonVariants, separatorVariants, toggleGroupVariants, toggleItemVariants, useFormContext, useFormFieldContext, useTableSelection };
1505
- //# sourceMappingURL=chunk-FIYD5CSW.mjs.map
1506
- //# sourceMappingURL=chunk-FIYD5CSW.mjs.map
1678
+ export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Skeleton, SkeletonAvatar, SkeletonBadge, SkeletonButton, SkeletonCard, SkeletonIcon, SkeletonInput, SkeletonSubtitle, SkeletonTableRow, SkeletonTableRows, SkeletonText, SkeletonTitle, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableRowCheckbox, TableSelectAll, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, buttonVariants, segmentedControlItemVariants, segmentedControlVariants, separatorVariants, switchLabelVariants, switchThumbVariants, switchTrackVariants, toggleGroupVariants, toggleItemVariants, useFormContext, useFormFieldContext, useTableSelection };
1679
+ //# sourceMappingURL=chunk-3B2NQT6J.mjs.map
1680
+ //# sourceMappingURL=chunk-3B2NQT6J.mjs.map