@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.
@@ -13,6 +13,9 @@ var PopoverPrimitive = require('@radix-ui/react-popover');
13
13
  var framerMotion = require('framer-motion');
14
14
  var SelectPrimitive = require('@radix-ui/react-select');
15
15
  var TabsPrimitive = require('@radix-ui/react-tabs');
16
+ var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
17
+ var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
18
+ var SwitchPrimitive = require('@radix-ui/react-switch');
16
19
 
17
20
  function _interopNamespace(e) {
18
21
  if (e && e.__esModule) return e;
@@ -39,6 +42,9 @@ var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMe
39
42
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
40
43
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
41
44
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
45
+ var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
46
+ var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
47
+ var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
42
48
 
43
49
  var buttonVariants = classVarianceAuthority.cva(
44
50
  "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",
@@ -1459,7 +1465,7 @@ var Textarea = React9__namespace.forwardRef(
1459
1465
  );
1460
1466
  Textarea.displayName = "Textarea";
1461
1467
  var toggleGroupVariants = classVarianceAuthority.cva(
1462
- "inline-flex w-fit items-stretch rounded-hz-lg border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1468
+ "inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1463
1469
  {
1464
1470
  variants: {
1465
1471
  size: {
@@ -1474,60 +1480,266 @@ var toggleGroupVariants = classVarianceAuthority.cva(
1474
1480
  }
1475
1481
  );
1476
1482
  var toggleItemVariants = classVarianceAuthority.cva(
1477
- "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",
1483
+ "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",
1478
1484
  {
1479
1485
  variants: {
1480
1486
  size: {
1481
- default: "h-full min-w-[120px]",
1482
- sm: "h-full min-w-[90px] text-xs",
1483
- lg: "h-full min-w-[140px] text-base"
1487
+ default: "h-full px-6",
1488
+ sm: "h-full px-4 text-xs",
1489
+ lg: "h-full px-8 text-base"
1484
1490
  },
1485
- active: {
1486
- true: "!bg-blue-50 border border-blue-500 text-blue-600 dark:!bg-blue-950/40 dark:border-blue-400 dark:text-blue-400",
1487
- false: "!bg-transparent border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
1491
+ iconOnly: {
1492
+ true: "aspect-square px-0 min-w-0",
1493
+ false: "min-w-[120px]"
1488
1494
  }
1489
1495
  },
1496
+ compoundVariants: [
1497
+ { size: "sm", iconOnly: false, class: "min-w-[90px]" },
1498
+ { size: "lg", iconOnly: false, class: "min-w-[140px]" }
1499
+ ],
1490
1500
  defaultVariants: {
1491
1501
  size: "default",
1492
- active: false
1502
+ iconOnly: false
1493
1503
  }
1494
1504
  }
1495
1505
  );
1506
+ var containerRadiusClass = {
1507
+ none: "rounded-hz-lg",
1508
+ sm: "rounded-sm",
1509
+ md: "rounded-md",
1510
+ lg: "rounded-lg",
1511
+ full: "rounded-full"
1512
+ };
1513
+ var itemRadiusClass = {
1514
+ none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
1515
+ sm: "first:rounded-l-sm last:rounded-r-sm",
1516
+ md: "first:rounded-l-md last:rounded-r-md",
1517
+ lg: "first:rounded-l-lg last:rounded-r-lg",
1518
+ full: "rounded-full"
1519
+ };
1496
1520
  function Toggle({
1497
1521
  className,
1498
1522
  options,
1499
1523
  value,
1500
1524
  onChange,
1501
1525
  size,
1526
+ radius = "none",
1502
1527
  ...props
1503
1528
  }) {
1504
1529
  return /* @__PURE__ */ jsxRuntime.jsx(
1505
- "div",
1530
+ ToggleGroupPrimitive__namespace.Root,
1531
+ {
1532
+ ...props,
1533
+ type: "multiple",
1534
+ ...value !== void 0 ? { value, onValueChange: onChange } : {},
1535
+ className: chunkYO72COII_js.cn(
1536
+ toggleGroupVariants({ size }),
1537
+ containerRadiusClass[radius],
1538
+ className
1539
+ ),
1540
+ children: options.map((option) => {
1541
+ const iconOnly = !!option.icon && !option.label;
1542
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1543
+ ToggleGroupPrimitive__namespace.Item,
1544
+ {
1545
+ value: option.value,
1546
+ disabled: option.disabled,
1547
+ "aria-label": iconOnly ? option.ariaLabel ?? option.value : void 0,
1548
+ className: chunkYO72COII_js.cn(
1549
+ toggleItemVariants({ size, iconOnly }),
1550
+ itemRadiusClass[radius],
1551
+ "border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
1552
+ "data-[state=on]:!bg-blue-50 data-[state=on]:border-blue-500 data-[state=on]:text-blue-600",
1553
+ "dark:data-[state=on]:!bg-blue-950/40 dark:data-[state=on]:border-blue-400 dark:data-[state=on]:text-blue-400"
1554
+ ),
1555
+ children: [
1556
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 inline-flex", children: option.icon }),
1557
+ option.label
1558
+ ]
1559
+ },
1560
+ option.value
1561
+ );
1562
+ })
1563
+ }
1564
+ );
1565
+ }
1566
+ var segmentedControlVariants = classVarianceAuthority.cva(
1567
+ "inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
1568
+ {
1569
+ variants: {
1570
+ size: {
1571
+ default: "h-[52px]",
1572
+ sm: "h-10",
1573
+ lg: "h-[60px]"
1574
+ }
1575
+ },
1576
+ defaultVariants: {
1577
+ size: "default"
1578
+ }
1579
+ }
1580
+ );
1581
+ var segmentedControlItemVariants = classVarianceAuthority.cva(
1582
+ "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",
1583
+ {
1584
+ variants: {
1585
+ size: {
1586
+ default: "h-full min-w-[120px]",
1587
+ sm: "h-full min-w-[90px] text-xs",
1588
+ lg: "h-full min-w-[140px] text-base"
1589
+ }
1590
+ },
1591
+ defaultVariants: {
1592
+ size: "default"
1593
+ }
1594
+ }
1595
+ );
1596
+ var containerRadiusClass2 = {
1597
+ none: "rounded-hz-lg",
1598
+ sm: "rounded-sm",
1599
+ md: "rounded-md",
1600
+ lg: "rounded-lg",
1601
+ full: "rounded-full"
1602
+ };
1603
+ var itemRadiusClass2 = {
1604
+ none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
1605
+ sm: "first:rounded-l-sm last:rounded-r-sm",
1606
+ md: "first:rounded-l-md last:rounded-r-md",
1607
+ lg: "first:rounded-l-lg last:rounded-r-lg",
1608
+ full: "rounded-full"
1609
+ };
1610
+ function SegmentedControl({
1611
+ className,
1612
+ options,
1613
+ value,
1614
+ onChange,
1615
+ size,
1616
+ radius = "none",
1617
+ ...props
1618
+ }) {
1619
+ return /* @__PURE__ */ jsxRuntime.jsx(
1620
+ RadioGroupPrimitive__namespace.Root,
1506
1621
  {
1507
- role: "radiogroup",
1508
- className: chunkYO72COII_js.cn(toggleGroupVariants({ size }), className),
1509
1622
  ...props,
1510
- children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1511
- "button",
1623
+ ...value !== void 0 ? { value, onValueChange: onChange } : {},
1624
+ className: chunkYO72COII_js.cn(
1625
+ segmentedControlVariants({ size }),
1626
+ containerRadiusClass2[radius],
1627
+ className
1628
+ ),
1629
+ children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
1630
+ RadioGroupPrimitive__namespace.Item,
1512
1631
  {
1513
- role: "radio",
1514
- type: "button",
1515
- "aria-checked": value === option.value,
1632
+ value: option.value,
1516
1633
  disabled: option.disabled,
1517
1634
  className: chunkYO72COII_js.cn(
1518
- toggleItemVariants({
1519
- size,
1520
- active: value === option.value
1521
- })
1635
+ segmentedControlItemVariants({ size }),
1636
+ itemRadiusClass2[radius],
1637
+ "border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
1638
+ "data-[state=checked]:!bg-blue-50 data-[state=checked]:border-blue-500 data-[state=checked]:text-blue-600",
1639
+ "dark:data-[state=checked]:!bg-blue-950/40 dark:data-[state=checked]:border-blue-400 dark:data-[state=checked]:text-blue-400"
1522
1640
  ),
1523
- onClick: () => onChange(option.value),
1524
- children: option.label
1641
+ children: [
1642
+ /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "hidden" }),
1643
+ option.label
1644
+ ]
1525
1645
  },
1526
1646
  option.value
1527
1647
  ))
1528
1648
  }
1529
1649
  );
1530
1650
  }
1651
+ var switchTrackVariants = classVarianceAuthority.cva(
1652
+ "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",
1653
+ {
1654
+ variants: {
1655
+ size: {
1656
+ sm: "h-5 w-9",
1657
+ default: "h-6 w-11",
1658
+ lg: "h-7 w-[52px]"
1659
+ }
1660
+ },
1661
+ defaultVariants: {
1662
+ size: "default"
1663
+ }
1664
+ }
1665
+ );
1666
+ var switchThumbVariants = classVarianceAuthority.cva(
1667
+ "pointer-events-none block rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=unchecked]:translate-x-0",
1668
+ {
1669
+ variants: {
1670
+ size: {
1671
+ sm: "h-4 w-4 data-[state=checked]:translate-x-4",
1672
+ default: "h-5 w-5 data-[state=checked]:translate-x-5",
1673
+ lg: "h-6 w-6 data-[state=checked]:translate-x-6"
1674
+ }
1675
+ },
1676
+ defaultVariants: {
1677
+ size: "default"
1678
+ }
1679
+ }
1680
+ );
1681
+ var switchLabelVariants = classVarianceAuthority.cva("select-none", {
1682
+ variants: {
1683
+ size: {
1684
+ sm: "text-xs",
1685
+ default: "text-sm",
1686
+ lg: "text-base"
1687
+ }
1688
+ },
1689
+ defaultVariants: {
1690
+ size: "default"
1691
+ }
1692
+ });
1693
+ var Switch = React9__namespace.forwardRef(({ className, size, label, labelPosition = "right", ...props }, ref) => {
1694
+ const generatedId = React9__namespace.useId();
1695
+ const switchId = props.id ?? generatedId;
1696
+ const switchEl = /* @__PURE__ */ jsxRuntime.jsx(
1697
+ SwitchPrimitive__namespace.Root,
1698
+ {
1699
+ ...props,
1700
+ id: switchId,
1701
+ ref,
1702
+ className: chunkYO72COII_js.cn(switchTrackVariants({ size }), className),
1703
+ children: /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitive__namespace.Thumb, { className: switchThumbVariants({ size }) })
1704
+ }
1705
+ );
1706
+ if (!label) return switchEl;
1707
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1708
+ "div",
1709
+ {
1710
+ className: chunkYO72COII_js.cn(
1711
+ "inline-flex items-center gap-2",
1712
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1713
+ ),
1714
+ children: [
1715
+ labelPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(
1716
+ "label",
1717
+ {
1718
+ htmlFor: switchId,
1719
+ className: chunkYO72COII_js.cn(
1720
+ switchLabelVariants({ size }),
1721
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1722
+ ),
1723
+ children: label
1724
+ }
1725
+ ),
1726
+ switchEl,
1727
+ labelPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(
1728
+ "label",
1729
+ {
1730
+ htmlFor: switchId,
1731
+ className: chunkYO72COII_js.cn(
1732
+ switchLabelVariants({ size }),
1733
+ props.disabled ? "cursor-not-allowed" : "cursor-pointer"
1734
+ ),
1735
+ children: label
1736
+ }
1737
+ )
1738
+ ]
1739
+ }
1740
+ );
1741
+ });
1742
+ Switch.displayName = "Switch";
1531
1743
 
1532
1744
  exports.Button = Button;
1533
1745
  exports.Card = Card;
@@ -1572,6 +1784,7 @@ exports.Popover = Popover;
1572
1784
  exports.PopoverAnchor = PopoverAnchor;
1573
1785
  exports.PopoverContent = PopoverContent;
1574
1786
  exports.PopoverTrigger = PopoverTrigger;
1787
+ exports.SegmentedControl = SegmentedControl;
1575
1788
  exports.Select = Select;
1576
1789
  exports.SelectContent = SelectContent;
1577
1790
  exports.SelectGroup = SelectGroup;
@@ -1595,6 +1808,7 @@ exports.SkeletonTableRow = SkeletonTableRow;
1595
1808
  exports.SkeletonTableRows = SkeletonTableRows;
1596
1809
  exports.SkeletonText = SkeletonText;
1597
1810
  exports.SkeletonTitle = SkeletonTitle;
1811
+ exports.Switch = Switch;
1598
1812
  exports.Table = Table;
1599
1813
  exports.TableBody = TableBody;
1600
1814
  exports.TableCaption = TableCaption;
@@ -1612,11 +1826,16 @@ exports.TabsTrigger = TabsTrigger;
1612
1826
  exports.Textarea = Textarea;
1613
1827
  exports.Toggle = Toggle;
1614
1828
  exports.buttonVariants = buttonVariants;
1829
+ exports.segmentedControlItemVariants = segmentedControlItemVariants;
1830
+ exports.segmentedControlVariants = segmentedControlVariants;
1615
1831
  exports.separatorVariants = separatorVariants;
1832
+ exports.switchLabelVariants = switchLabelVariants;
1833
+ exports.switchThumbVariants = switchThumbVariants;
1834
+ exports.switchTrackVariants = switchTrackVariants;
1616
1835
  exports.toggleGroupVariants = toggleGroupVariants;
1617
1836
  exports.toggleItemVariants = toggleItemVariants;
1618
1837
  exports.useFormContext = useFormContext;
1619
1838
  exports.useFormFieldContext = useFormFieldContext;
1620
1839
  exports.useTableSelection = useTableSelection;
1621
- //# sourceMappingURL=chunk-6B6UOXJJ.js.map
1622
- //# sourceMappingURL=chunk-6B6UOXJJ.js.map
1840
+ //# sourceMappingURL=chunk-U2QEAL7N.js.map
1841
+ //# sourceMappingURL=chunk-U2QEAL7N.js.map