infinity-ui-elements 1.9.6 → 1.9.8

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.js CHANGED
@@ -1676,6 +1676,175 @@ const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium
1676
1676
  });
1677
1677
  Checkbox.displayName = "Checkbox";
1678
1678
 
1679
+ const chipVariants = classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-full border transition-colors focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none", {
1680
+ variants: {
1681
+ intent: {
1682
+ primary: "",
1683
+ positive: "",
1684
+ negative: "",
1685
+ },
1686
+ selection: {
1687
+ default: "",
1688
+ light: "",
1689
+ intense: "",
1690
+ },
1691
+ size: {
1692
+ xsmall: "h-[24px] px-3 gap-2 text-body-small-medium",
1693
+ small: "h-[28px] px-4 gap-2 text-body-medium-medium",
1694
+ medium: "h-[36px] px-5 gap-3 text-body-large-medium",
1695
+ large: "h-[44px] px-6 gap-3 text-heading-medium-medium",
1696
+ },
1697
+ isDisabled: {
1698
+ true: "cursor-not-allowed",
1699
+ false: "cursor-pointer",
1700
+ },
1701
+ },
1702
+ compoundVariants: [
1703
+ // Selection: default (neutral chip, intent influences focus ring/border)
1704
+ {
1705
+ selection: "default",
1706
+ class: `
1707
+ bg-surface-fill-neutral-intense
1708
+ text-action-ink-neutral-normal
1709
+ border-action-outline-neutral-faded
1710
+ hover:bg-action-fill-neutral-faded-hover
1711
+ hover:border-action-outline-neutral-faded-hover
1712
+ active:bg-action-fill-neutral-faded-activated
1713
+ active:border-action-outline-neutral-faded-activated
1714
+ disabled:bg-surface-fill-neutral-moderate
1715
+ disabled:text-surface-ink-neutral-disabled
1716
+ disabled:border-action-outline-neutral-disabled
1717
+ `,
1718
+ },
1719
+ {
1720
+ selection: "default",
1721
+ intent: "primary",
1722
+ class: "focus-visible:ring-action-outline-primary-faded-hover focus-visible:border-action-outline-primary-faded-hover",
1723
+ },
1724
+ {
1725
+ selection: "default",
1726
+ intent: "positive",
1727
+ class: "focus-visible:ring-action-outline-positive-faded-hover focus-visible:border-action-outline-positive-faded-hover",
1728
+ },
1729
+ {
1730
+ selection: "default",
1731
+ intent: "negative",
1732
+ class: "focus-visible:ring-action-outline-negative-faded-hover focus-visible:border-action-outline-negative-faded-hover",
1733
+ },
1734
+ // Selection: light
1735
+ {
1736
+ selection: "light",
1737
+ intent: "primary",
1738
+ class: `
1739
+ bg-action-fill-primary-faded
1740
+ text-action-ink-primary-normal
1741
+ border-action-outline-primary-faded
1742
+ hover:bg-action-fill-primary-faded-hover
1743
+ hover:border-action-outline-primary-faded-hover
1744
+ active:bg-action-fill-primary-faded-activated
1745
+ active:border-action-outline-primary-faded-activated
1746
+ focus-visible:ring-action-outline-primary-faded-hover
1747
+ disabled:bg-action-fill-primary-disabled
1748
+ disabled:text-action-ink-primary-disabled
1749
+ disabled:border-action-outline-primary-disabled
1750
+ `,
1751
+ },
1752
+ {
1753
+ selection: "light",
1754
+ intent: "positive",
1755
+ class: `
1756
+ bg-action-fill-positive-faded
1757
+ text-action-ink-positive-normal
1758
+ border-action-outline-positive-faded
1759
+ hover:bg-action-fill-positive-faded-hover
1760
+ hover:border-action-outline-positive-faded-hover
1761
+ active:bg-action-fill-positive-faded-activated
1762
+ active:border-action-outline-positive-faded-activated
1763
+ focus-visible:ring-action-outline-positive-faded-hover
1764
+ disabled:bg-action-fill-positive-disabled
1765
+ disabled:text-action-ink-positive-disabled
1766
+ disabled:border-action-outline-positive-disabled
1767
+ `,
1768
+ },
1769
+ {
1770
+ selection: "light",
1771
+ intent: "negative",
1772
+ class: `
1773
+ bg-action-fill-negative-faded
1774
+ text-action-ink-negative-normal
1775
+ border-action-outline-negative-faded
1776
+ hover:bg-action-fill-negative-faded-hover
1777
+ hover:border-action-outline-negative-faded-hover
1778
+ active:bg-action-fill-negative-faded-activated
1779
+ active:border-action-outline-negative-faded-activated
1780
+ focus-visible:ring-action-outline-negative-faded-hover
1781
+ disabled:bg-action-fill-negative-disabled
1782
+ disabled:text-action-ink-negative-disabled
1783
+ disabled:border-action-outline-negative-disabled
1784
+ `,
1785
+ },
1786
+ // Selection: intense
1787
+ {
1788
+ selection: "intense",
1789
+ intent: "primary",
1790
+ class: `
1791
+ bg-action-fill-primary-default
1792
+ text-action-ink-on-primary-normal
1793
+ border-transparent
1794
+ hover:bg-action-fill-primary-hover
1795
+ active:bg-action-fill-primary-activated
1796
+ focus-visible:ring-action-outline-primary-faded-hover
1797
+ disabled:bg-action-fill-primary-disabled
1798
+ disabled:text-action-ink-primary-disabled
1799
+ `,
1800
+ },
1801
+ {
1802
+ selection: "intense",
1803
+ intent: "positive",
1804
+ class: `
1805
+ bg-action-fill-positive-default
1806
+ text-action-ink-on-primary-normal
1807
+ border-transparent
1808
+ hover:bg-action-fill-positive-hover
1809
+ active:bg-action-fill-positive-activated
1810
+ focus-visible:ring-action-outline-positive-faded-hover
1811
+ disabled:bg-action-fill-positive-disabled
1812
+ disabled:text-action-ink-positive-disabled
1813
+ `,
1814
+ },
1815
+ {
1816
+ selection: "intense",
1817
+ intent: "negative",
1818
+ class: `
1819
+ bg-action-fill-negative-default
1820
+ text-action-ink-on-primary-normal
1821
+ border-transparent
1822
+ hover:bg-action-fill-negative-hover
1823
+ active:bg-action-fill-negative-activated
1824
+ focus-visible:ring-action-outline-negative-faded-hover
1825
+ disabled:bg-action-fill-negative-disabled
1826
+ disabled:text-action-ink-negative-disabled
1827
+ `,
1828
+ },
1829
+ ],
1830
+ defaultVariants: {
1831
+ intent: "primary",
1832
+ selection: "default",
1833
+ size: "medium",
1834
+ isDisabled: false,
1835
+ },
1836
+ });
1837
+ const Chip = React__namespace.forwardRef(({ className, intent = "primary", selection = "default", size = "medium", isDisabled = false, leadingComponent, trailingComponent, disabled, children, type, ...props }, ref) => {
1838
+ const finalDisabled = Boolean(disabled || isDisabled);
1839
+ return (jsxRuntime.jsxs("button", { ref: ref, type: type ?? "button", disabled: finalDisabled, className: cn(chipVariants({
1840
+ intent,
1841
+ selection,
1842
+ size,
1843
+ isDisabled: finalDisabled,
1844
+ }), className), ...props, children: [leadingComponent && (jsxRuntime.jsx("span", { className: "inline-flex items-center", children: leadingComponent })), jsxRuntime.jsx("span", { className: "inline-flex items-center", children: children }), trailingComponent && (jsxRuntime.jsx("span", { className: "inline-flex items-center", children: trailingComponent }))] }));
1845
+ });
1846
+ Chip.displayName = "Chip";
1847
+
1679
1848
  const counterVariants = classVarianceAuthority.cva("inline-flex items-center justify-center transition-colors", {
1680
1849
  variants: {
1681
1850
  size: {
@@ -2920,7 +3089,7 @@ const DateRangePicker = React__namespace.forwardRef(({ className, value: control
2920
3089
  ? `${window.innerHeight - position.bottom - gap - 10}px`
2921
3090
  : `${position.top - gap - 10}px`,
2922
3091
  overflowY: "auto",
2923
- }, className: cn("bg-surface-fill-neutral-intense rounded-large shadow-lg border border-surface-outline-neutral-subtle", calendarClassName), onClick: (e) => e.stopPropagation(), children: jsxRuntime.jsxs("div", { className: "flex", children: [showPresets && presets.length > 0 && (jsxRuntime.jsx("div", { className: "w-48 border-r border-surface-outline-neutral-subtle p-4 flex flex-col", children: presets.map((preset) => (jsxRuntime.jsx(ListItem, { title: preset.label, type: "single", showChevron: false, isSelected: selectedPreset === preset.value, onClick: () => handlePresetClick(preset), containerClassName: "mb-1 last:mb-0" }, preset.value))) })), jsxRuntime.jsxs("div", { className: "p-4", children: [jsxRuntime.jsxs("div", { className: "flex gap-6", children: [jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [jsxRuntime.jsx("div", { className: "flex flex-col px-3", children: jsxRuntime.jsx("p", { className: "text-body-small-medium", children: "Start Date" }) }), jsxRuntime.jsxs("div", { className: "flex flex-col p-5 rounded-[8px] bg-surface-fill-neutral-moderate", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3 px-3", children: [jsxRuntime.jsx("h3", { className: "text-body-small-medium font-medium text-surface-ink-neutral-normal", children: formatMonthYear(startMonth) }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("button", { onClick: handlePrevStartMonth, className: "p-1 hover:bg-surface-fill-neutral-faded rounded transition-colors", "aria-label": "Previous month", children: jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "w-4 h-4 text-surface-ink-neutral-normal" }) }), jsxRuntime.jsx("button", { onClick: handleNextStartMonth, className: "p-1 hover:bg-surface-fill-neutral-faded rounded transition-colors", "aria-label": "Next month", children: jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-surface-ink-neutral-normal" }) })] })] }), jsxRuntime.jsx("div", { className: "date-range-calendar-wrapper", children: jsxRuntime.jsx(Calendar, { onChange: handleStartDateChange, value: tempValue.startDate, minDate: minDateParsed ?? undefined, maxDate: tempValue.endDate
3092
+ }, className: cn("bg-surface-fill-neutral-intense rounded-large shadow-lg border-[0.5px] border-surface-outline-neutral-subtle", calendarClassName), onClick: (e) => e.stopPropagation(), children: jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsxs("div", { className: "flex flex-row p-7 gap-7", children: [showPresets && presets.length > 0 && (jsxRuntime.jsx("div", { className: "w-[160px] flex flex-col gap-2", children: presets.map((preset) => (jsxRuntime.jsx(ListItem, { title: preset.label, type: "single", showChevron: false, isSelected: selectedPreset === preset.value, onClick: () => handlePresetClick(preset), containerClassName: "px-4 py-3" }, preset.value))) })), jsxRuntime.jsxs("div", { className: "flex gap-7", children: [jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [jsxRuntime.jsx("div", { className: "flex flex-col px-3", children: jsxRuntime.jsx("p", { className: "text-body-small-medium", children: "Start Date" }) }), jsxRuntime.jsxs("div", { className: "flex flex-col p-5 rounded-[8px] bg-surface-fill-neutral-moderate", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3 px-3", children: [jsxRuntime.jsx("h3", { className: "text-body-small-medium font-medium text-surface-ink-neutral-normal", children: formatMonthYear(startMonth) }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("button", { onClick: handlePrevStartMonth, className: "p-1 hover:bg-surface-fill-neutral-faded rounded transition-colors", "aria-label": "Previous month", children: jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "w-4 h-4 text-surface-ink-neutral-normal" }) }), jsxRuntime.jsx("button", { onClick: handleNextStartMonth, className: "p-1 hover:bg-surface-fill-neutral-faded rounded transition-colors", "aria-label": "Next month", children: jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-surface-ink-neutral-normal" }) })] })] }), jsxRuntime.jsx("div", { className: "date-range-calendar-wrapper", children: jsxRuntime.jsx(Calendar, { onChange: handleStartDateChange, value: tempValue.startDate, minDate: minDateParsed ?? undefined, maxDate: tempValue.endDate
2924
3093
  ? tempValue.endDate
2925
3094
  : maxDateParsed ?? undefined, activeStartDate: startMonth, onActiveStartDateChange: ({ activeStartDate, }) => {
2926
3095
  if (activeStartDate)
@@ -2952,15 +3121,15 @@ const DateRangePicker = React__namespace.forwardRef(({ className, value: control
2952
3121
  "SAT",
2953
3122
  ];
2954
3123
  return weekdayNames[date.getDay()];
2955
- } }) })] })] })] }), jsxRuntime.jsxs("div", { className: "mt-4 pt-4 border-t border-surface-outline-neutral-subtle flex items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "w-2 h-2 rounded-full bg-action-fill-primary-default" }), jsxRuntime.jsx("span", { className: "text-sm text-surface-ink-neutral-normal", children: tempValue.startDate && tempValue.endDate
2956
- ? isSameDay(tempValue.startDate, tempValue.endDate)
2957
- ? "Today"
2958
- : `${formatDate(tempValue.startDate)} - ${formatDate(tempValue.endDate)}`
2959
- : tempValue.startDate
2960
- ? `From ${formatDate(tempValue.startDate)}`
2961
- : tempValue.endDate
2962
- ? `Until ${formatDate(tempValue.endDate)}`
2963
- : "No selection" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx(Button, { variant: "secondary", color: "neutral", size: "small", onClick: handleCancel, children: "Cancel" }), jsxRuntime.jsx(Button, { variant: "primary", color: "primary", size: "small", onClick: handleApply, children: "Apply date range" })] })] })] })] }) }));
3124
+ } }) })] })] })] })] }), jsxRuntime.jsxs("div", { className: "border-t-[0.5px] border-surface-outline-neutral-subtle flex px-8 py-5 items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "w-2 h-2 rounded-full bg-action-fill-primary-default" }), jsxRuntime.jsx("span", { className: "text-sm text-surface-ink-neutral-normal", children: tempValue.startDate && tempValue.endDate
3125
+ ? isSameDay(tempValue.startDate, tempValue.endDate)
3126
+ ? "Today"
3127
+ : `${formatDate(tempValue.startDate)} - ${formatDate(tempValue.endDate)}`
3128
+ : tempValue.startDate
3129
+ ? `From ${formatDate(tempValue.startDate)}`
3130
+ : tempValue.endDate
3131
+ ? `Until ${formatDate(tempValue.endDate)}`
3132
+ : "No selection" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [jsxRuntime.jsx(Button, { variant: "secondary", color: "neutral", size: "small", onClick: handleCancel, children: "Cancel" }), jsxRuntime.jsx(Button, { variant: "primary", color: "primary", size: "small", onClick: handleApply, children: "Apply date range" })] })] })] }) }));
2964
3133
  return reactDom.createPortal(calendarPopup, document.body);
2965
3134
  })()] }));
2966
3135
  });
@@ -5982,6 +6151,7 @@ exports.Badge = Badge;
5982
6151
  exports.Button = Button;
5983
6152
  exports.ButtonGroup = ButtonGroup;
5984
6153
  exports.Checkbox = Checkbox;
6154
+ exports.Chip = Chip;
5985
6155
  exports.Counter = Counter;
5986
6156
  exports.DatePicker = DatePicker;
5987
6157
  exports.DateRangePicker = DateRangePicker;
@@ -6025,6 +6195,7 @@ exports.badgeVariants = badgeVariants;
6025
6195
  exports.buttonGroupVariants = buttonGroupVariants;
6026
6196
  exports.buttonVariants = buttonVariants;
6027
6197
  exports.checkboxVariants = checkboxVariants;
6198
+ exports.chipVariants = chipVariants;
6028
6199
  exports.cn = cn;
6029
6200
  exports.counterVariants = counterVariants;
6030
6201
  exports.datePickerVariants = datePickerVariants;