@pos-360/horizon 0.11.0 → 0.12.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.
@@ -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",
@@ -1431,7 +1434,7 @@ var Textarea = React9.forwardRef(
1431
1434
  );
1432
1435
  Textarea.displayName = "Textarea";
1433
1436
  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",
1437
+ "inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1435
1438
  {
1436
1439
  variants: {
1437
1440
  size: {
@@ -1446,61 +1449,267 @@ var toggleGroupVariants = cva(
1446
1449
  }
1447
1450
  );
1448
1451
  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",
1452
+ "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
1453
  {
1451
1454
  variants: {
1452
1455
  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"
1456
+ default: "h-full px-6",
1457
+ sm: "h-full px-4 text-xs",
1458
+ lg: "h-full px-8 text-base"
1456
1459
  },
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"
1460
+ iconOnly: {
1461
+ true: "aspect-square px-0 min-w-0",
1462
+ false: "min-w-[120px]"
1460
1463
  }
1461
1464
  },
1465
+ compoundVariants: [
1466
+ { size: "sm", iconOnly: false, class: "min-w-[90px]" },
1467
+ { size: "lg", iconOnly: false, class: "min-w-[140px]" }
1468
+ ],
1462
1469
  defaultVariants: {
1463
1470
  size: "default",
1464
- active: false
1471
+ iconOnly: false
1465
1472
  }
1466
1473
  }
1467
1474
  );
1475
+ var containerRadiusClass = {
1476
+ none: "rounded-hz-lg",
1477
+ sm: "rounded-sm",
1478
+ md: "rounded-md",
1479
+ lg: "rounded-lg",
1480
+ full: "rounded-full"
1481
+ };
1482
+ var itemRadiusClass = {
1483
+ none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
1484
+ sm: "first:rounded-l-sm last:rounded-r-sm",
1485
+ md: "first:rounded-l-md last:rounded-r-md",
1486
+ lg: "first:rounded-l-lg last:rounded-r-lg",
1487
+ full: "rounded-full"
1488
+ };
1468
1489
  function Toggle({
1469
1490
  className,
1470
1491
  options,
1471
1492
  value,
1472
1493
  onChange,
1473
1494
  size,
1495
+ radius = "none",
1474
1496
  ...props
1475
1497
  }) {
1476
1498
  return /* @__PURE__ */ jsx(
1477
- "div",
1499
+ ToggleGroupPrimitive.Root,
1500
+ {
1501
+ ...props,
1502
+ type: "multiple",
1503
+ ...value !== void 0 ? { value, onValueChange: onChange } : {},
1504
+ className: cn(
1505
+ toggleGroupVariants({ size }),
1506
+ containerRadiusClass[radius],
1507
+ className
1508
+ ),
1509
+ children: options.map((option) => {
1510
+ const iconOnly = !!option.icon && !option.label;
1511
+ return /* @__PURE__ */ jsxs(
1512
+ ToggleGroupPrimitive.Item,
1513
+ {
1514
+ value: option.value,
1515
+ disabled: option.disabled,
1516
+ "aria-label": iconOnly ? option.ariaLabel ?? option.value : void 0,
1517
+ className: cn(
1518
+ toggleItemVariants({ size, iconOnly }),
1519
+ itemRadiusClass[radius],
1520
+ "border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
1521
+ "data-[state=on]:!bg-blue-50 data-[state=on]:border-blue-500 data-[state=on]:text-blue-600",
1522
+ "dark:data-[state=on]:!bg-blue-950/40 dark:data-[state=on]:border-blue-400 dark:data-[state=on]:text-blue-400"
1523
+ ),
1524
+ children: [
1525
+ option.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 inline-flex", children: option.icon }),
1526
+ option.label
1527
+ ]
1528
+ },
1529
+ option.value
1530
+ );
1531
+ })
1532
+ }
1533
+ );
1534
+ }
1535
+ var segmentedControlVariants = cva(
1536
+ "inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1537
+ {
1538
+ variants: {
1539
+ size: {
1540
+ default: "h-[52px]",
1541
+ sm: "h-10",
1542
+ lg: "h-[60px]"
1543
+ }
1544
+ },
1545
+ defaultVariants: {
1546
+ size: "default"
1547
+ }
1548
+ }
1549
+ );
1550
+ var segmentedControlItemVariants = cva(
1551
+ "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",
1552
+ {
1553
+ variants: {
1554
+ size: {
1555
+ default: "h-full min-w-[120px]",
1556
+ sm: "h-full min-w-[90px] text-xs",
1557
+ lg: "h-full min-w-[140px] text-base"
1558
+ }
1559
+ },
1560
+ defaultVariants: {
1561
+ size: "default"
1562
+ }
1563
+ }
1564
+ );
1565
+ var containerRadiusClass2 = {
1566
+ none: "rounded-hz-lg",
1567
+ sm: "rounded-sm",
1568
+ md: "rounded-md",
1569
+ lg: "rounded-lg",
1570
+ full: "rounded-full"
1571
+ };
1572
+ var itemRadiusClass2 = {
1573
+ none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
1574
+ sm: "first:rounded-l-sm last:rounded-r-sm",
1575
+ md: "first:rounded-l-md last:rounded-r-md",
1576
+ lg: "first:rounded-l-lg last:rounded-r-lg",
1577
+ full: "rounded-full"
1578
+ };
1579
+ function SegmentedControl({
1580
+ className,
1581
+ options,
1582
+ value,
1583
+ onChange,
1584
+ size,
1585
+ radius = "none",
1586
+ ...props
1587
+ }) {
1588
+ return /* @__PURE__ */ jsx(
1589
+ RadioGroupPrimitive.Root,
1478
1590
  {
1479
- role: "radiogroup",
1480
- className: cn(toggleGroupVariants({ size }), className),
1481
1591
  ...props,
1482
- children: options.map((option) => /* @__PURE__ */ jsx(
1483
- "button",
1592
+ ...value !== void 0 ? { value, onValueChange: onChange } : {},
1593
+ className: cn(
1594
+ segmentedControlVariants({ size }),
1595
+ containerRadiusClass2[radius],
1596
+ className
1597
+ ),
1598
+ children: options.map((option) => /* @__PURE__ */ jsxs(
1599
+ RadioGroupPrimitive.Item,
1484
1600
  {
1485
- role: "radio",
1486
- type: "button",
1487
- "aria-checked": value === option.value,
1601
+ value: option.value,
1488
1602
  disabled: option.disabled,
1489
1603
  className: cn(
1490
- toggleItemVariants({
1491
- size,
1492
- active: value === option.value
1493
- })
1604
+ segmentedControlItemVariants({ size }),
1605
+ itemRadiusClass2[radius],
1606
+ "border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
1607
+ "data-[state=checked]:!bg-blue-50 data-[state=checked]:border-blue-500 data-[state=checked]:text-blue-600",
1608
+ "dark:data-[state=checked]:!bg-blue-950/40 dark:data-[state=checked]:border-blue-400 dark:data-[state=checked]:text-blue-400"
1494
1609
  ),
1495
- onClick: () => onChange(option.value),
1496
- children: option.label
1610
+ children: [
1611
+ /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "hidden" }),
1612
+ option.label
1613
+ ]
1497
1614
  },
1498
1615
  option.value
1499
1616
  ))
1500
1617
  }
1501
1618
  );
1502
1619
  }
1620
+ var switchTrackVariants = cva(
1621
+ "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",
1622
+ {
1623
+ variants: {
1624
+ size: {
1625
+ sm: "h-5 w-9",
1626
+ default: "h-6 w-11",
1627
+ lg: "h-7 w-[52px]"
1628
+ }
1629
+ },
1630
+ defaultVariants: {
1631
+ size: "default"
1632
+ }
1633
+ }
1634
+ );
1635
+ var switchThumbVariants = cva(
1636
+ "pointer-events-none block rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=unchecked]:translate-x-0",
1637
+ {
1638
+ variants: {
1639
+ size: {
1640
+ sm: "h-4 w-4 data-[state=checked]:translate-x-4",
1641
+ default: "h-5 w-5 data-[state=checked]:translate-x-5",
1642
+ lg: "h-6 w-6 data-[state=checked]:translate-x-6"
1643
+ }
1644
+ },
1645
+ defaultVariants: {
1646
+ size: "default"
1647
+ }
1648
+ }
1649
+ );
1650
+ var switchLabelVariants = cva("select-none", {
1651
+ variants: {
1652
+ size: {
1653
+ sm: "text-xs",
1654
+ default: "text-sm",
1655
+ lg: "text-base"
1656
+ }
1657
+ },
1658
+ defaultVariants: {
1659
+ size: "default"
1660
+ }
1661
+ });
1662
+ var Switch = React9.forwardRef(({ className, size, label, labelPosition = "right", ...props }, ref) => {
1663
+ const generatedId = React9.useId();
1664
+ const switchId = props.id ?? generatedId;
1665
+ const switchEl = /* @__PURE__ */ jsx(
1666
+ SwitchPrimitive.Root,
1667
+ {
1668
+ ...props,
1669
+ id: switchId,
1670
+ ref,
1671
+ className: cn(switchTrackVariants({ size }), className),
1672
+ children: /* @__PURE__ */ jsx(SwitchPrimitive.Thumb, { className: switchThumbVariants({ size }) })
1673
+ }
1674
+ );
1675
+ if (!label) return switchEl;
1676
+ return /* @__PURE__ */ jsxs(
1677
+ "div",
1678
+ {
1679
+ className: cn(
1680
+ "inline-flex items-center gap-2",
1681
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1682
+ ),
1683
+ children: [
1684
+ labelPosition === "left" && /* @__PURE__ */ jsx(
1685
+ "label",
1686
+ {
1687
+ htmlFor: switchId,
1688
+ className: cn(
1689
+ switchLabelVariants({ size }),
1690
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1691
+ ),
1692
+ children: label
1693
+ }
1694
+ ),
1695
+ switchEl,
1696
+ labelPosition === "right" && /* @__PURE__ */ jsx(
1697
+ "label",
1698
+ {
1699
+ htmlFor: switchId,
1700
+ className: cn(
1701
+ switchLabelVariants({ size }),
1702
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1703
+ ),
1704
+ children: label
1705
+ }
1706
+ )
1707
+ ]
1708
+ }
1709
+ );
1710
+ });
1711
+ Switch.displayName = "Switch";
1503
1712
 
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
1713
+ 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 };
1714
+ //# sourceMappingURL=chunk-RPR6I35V.mjs.map
1715
+ //# sourceMappingURL=chunk-RPR6I35V.mjs.map