infinity-ui-elements 1.4.1-beta.1 → 1.4.1-beta.3
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/components/Link/Link.d.ts +24 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.stories.d.ts +22 -0
- package/dist/components/Link/Link.stories.d.ts.map +1 -0
- package/dist/components/Link/index.d.ts +3 -0
- package/dist/components/Link/index.d.ts.map +1 -0
- package/dist/components/ListItem/ListItem.stories.d.ts.map +1 -1
- package/dist/components/TabItem/TabItem.d.ts +53 -0
- package/dist/components/TabItem/TabItem.d.ts.map +1 -0
- package/dist/components/TabItem/TabItem.stories.d.ts +98 -0
- package/dist/components/TabItem/TabItem.stories.d.ts.map +1 -0
- package/dist/components/TabItem/index.d.ts +2 -0
- package/dist/components/TabItem/index.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +76 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +80 -0
- package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +243 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +246 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var clsx = require('clsx');
|
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
8
|
var reactSlot = require('@radix-ui/react-slot');
|
|
9
9
|
var reactSpinners = require('react-spinners');
|
|
10
|
+
var lucideReact = require('lucide-react');
|
|
10
11
|
|
|
11
12
|
function _interopNamespaceDefault(e) {
|
|
12
13
|
var n = Object.create(null);
|
|
@@ -1264,6 +1265,136 @@ const FormHeader = React__namespace.forwardRef(({ label, size = "medium", isOpti
|
|
|
1264
1265
|
});
|
|
1265
1266
|
FormHeader.displayName = "FormHeader";
|
|
1266
1267
|
|
|
1268
|
+
const linkVariants = classVarianceAuthority.cva("inline-flex items-center gap-1 whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none underline decoration-1 underline-offset-4", {
|
|
1269
|
+
variants: {
|
|
1270
|
+
type: {
|
|
1271
|
+
anchor: "",
|
|
1272
|
+
action: "cursor-pointer",
|
|
1273
|
+
},
|
|
1274
|
+
color: {
|
|
1275
|
+
primary: "",
|
|
1276
|
+
positive: "",
|
|
1277
|
+
negative: "",
|
|
1278
|
+
notice: "",
|
|
1279
|
+
info: "",
|
|
1280
|
+
neutral: "",
|
|
1281
|
+
},
|
|
1282
|
+
size: {
|
|
1283
|
+
xsmall: "text-body-xsmall-medium gap-1",
|
|
1284
|
+
small: "text-body-small-medium gap-1",
|
|
1285
|
+
medium: "text-body-medium-medium gap-1.5",
|
|
1286
|
+
large: "text-body-large-medium gap-1.5",
|
|
1287
|
+
},
|
|
1288
|
+
isIconOnly: {
|
|
1289
|
+
true: "no-underline",
|
|
1290
|
+
false: "",
|
|
1291
|
+
},
|
|
1292
|
+
isDisabled: {
|
|
1293
|
+
true: "cursor-not-allowed opacity-50",
|
|
1294
|
+
false: "cursor-pointer",
|
|
1295
|
+
},
|
|
1296
|
+
},
|
|
1297
|
+
compoundVariants: [
|
|
1298
|
+
// Primary color variants
|
|
1299
|
+
{
|
|
1300
|
+
color: "primary",
|
|
1301
|
+
class: `text-action-ink-primary-normal
|
|
1302
|
+
hover:text-action-ink-primary-hover
|
|
1303
|
+
disabled:text-action-ink-primary-disabled
|
|
1304
|
+
active:text-action-ink-primary-activated
|
|
1305
|
+
focus:text-action-ink-primary-hover
|
|
1306
|
+
`,
|
|
1307
|
+
},
|
|
1308
|
+
// Positive color variants
|
|
1309
|
+
{
|
|
1310
|
+
color: "positive",
|
|
1311
|
+
class: `text-action-ink-positive-normal
|
|
1312
|
+
hover:text-action-ink-positive-hover
|
|
1313
|
+
disabled:text-action-ink-positive-disabled
|
|
1314
|
+
active:text-action-ink-positive-activated
|
|
1315
|
+
focus:text-action-ink-positive-hover
|
|
1316
|
+
`,
|
|
1317
|
+
},
|
|
1318
|
+
// Negative color variants
|
|
1319
|
+
{
|
|
1320
|
+
color: "negative",
|
|
1321
|
+
class: `text-action-ink-negative-normal
|
|
1322
|
+
hover:text-action-ink-negative-hover
|
|
1323
|
+
disabled:text-action-ink-negative-disabled
|
|
1324
|
+
active:text-action-ink-negative-activated
|
|
1325
|
+
focus:text-action-ink-negative-hover
|
|
1326
|
+
`,
|
|
1327
|
+
},
|
|
1328
|
+
// Notice color variants
|
|
1329
|
+
{
|
|
1330
|
+
color: "notice",
|
|
1331
|
+
class: `text-action-ink-notice-normal
|
|
1332
|
+
hover:text-action-ink-notice-hover
|
|
1333
|
+
disabled:text-action-ink-notice-disabled
|
|
1334
|
+
active:text-action-ink-notice-activated
|
|
1335
|
+
focus:text-action-ink-notice-hover
|
|
1336
|
+
`,
|
|
1337
|
+
},
|
|
1338
|
+
// Info color variants
|
|
1339
|
+
{
|
|
1340
|
+
color: "info",
|
|
1341
|
+
class: `text-action-ink-info-normal
|
|
1342
|
+
hover:text-action-ink-info-hover
|
|
1343
|
+
disabled:text-action-ink-info-disabled
|
|
1344
|
+
active:text-action-ink-info-activated
|
|
1345
|
+
focus:text-action-ink-info-hover
|
|
1346
|
+
`,
|
|
1347
|
+
},
|
|
1348
|
+
// Neutral color variants
|
|
1349
|
+
{
|
|
1350
|
+
color: "neutral",
|
|
1351
|
+
class: `text-action-ink-neutral-normal
|
|
1352
|
+
hover:text-action-ink-neutral-hover
|
|
1353
|
+
disabled:text-action-ink-neutral-disabled
|
|
1354
|
+
active:text-action-ink-neutral-activated
|
|
1355
|
+
focus:text-action-ink-neutral-hover
|
|
1356
|
+
`,
|
|
1357
|
+
},
|
|
1358
|
+
],
|
|
1359
|
+
defaultVariants: {
|
|
1360
|
+
type: "anchor",
|
|
1361
|
+
color: "primary",
|
|
1362
|
+
size: "medium",
|
|
1363
|
+
isIconOnly: false,
|
|
1364
|
+
isDisabled: false,
|
|
1365
|
+
},
|
|
1366
|
+
});
|
|
1367
|
+
const Link = React__namespace.forwardRef(({ className, type = "anchor", color = "primary", size = "medium", isIconOnly = false, isDisabled = false, asChild = false, showIcon = false, icon, leadingIcon, trailingIcon, children, onClick, ...props }, ref) => {
|
|
1368
|
+
const Comp = asChild ? reactSlot.Slot : "a";
|
|
1369
|
+
const handleClick = (e) => {
|
|
1370
|
+
if (isDisabled) {
|
|
1371
|
+
e.preventDefault();
|
|
1372
|
+
return;
|
|
1373
|
+
}
|
|
1374
|
+
onClick?.(e);
|
|
1375
|
+
};
|
|
1376
|
+
// Icon size based on link size
|
|
1377
|
+
const iconSize = {
|
|
1378
|
+
xsmall: 12,
|
|
1379
|
+
small: 14,
|
|
1380
|
+
medium: 16,
|
|
1381
|
+
large: 18,
|
|
1382
|
+
}[size];
|
|
1383
|
+
// Determine what to show as trailing icon
|
|
1384
|
+
// Priority: trailingIcon > (showIcon && icon) > (showIcon && default ExternalLink)
|
|
1385
|
+
const finalTrailingIcon = trailingIcon || (showIcon && (icon || jsxRuntime.jsx(lucideReact.ExternalLink, { size: iconSize })));
|
|
1386
|
+
const linkContent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [leadingIcon && !isIconOnly && (jsxRuntime.jsx("span", { className: "inline-flex items-center", children: leadingIcon })), !isIconOnly && children, isIconOnly && children, finalTrailingIcon && !isIconOnly && (jsxRuntime.jsx("span", { className: "inline-flex items-center", children: finalTrailingIcon })), isIconOnly &&
|
|
1387
|
+
(leadingIcon || finalTrailingIcon || (jsxRuntime.jsx(lucideReact.ExternalLink, { size: iconSize })))] }));
|
|
1388
|
+
return (jsxRuntime.jsx(Comp, { className: cn(linkVariants({
|
|
1389
|
+
type,
|
|
1390
|
+
color,
|
|
1391
|
+
size,
|
|
1392
|
+
isIconOnly,
|
|
1393
|
+
isDisabled,
|
|
1394
|
+
}), className), ref: ref, onClick: handleClick, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : undefined, ...props, children: linkContent }));
|
|
1395
|
+
});
|
|
1396
|
+
Link.displayName = "Link";
|
|
1397
|
+
|
|
1267
1398
|
const listItemVariants = classVarianceAuthority.cva("flex items-start gap-3 p-3 rounded-medium transition-colors cursor-pointer", {
|
|
1268
1399
|
variants: {
|
|
1269
1400
|
variant: {
|
|
@@ -1647,6 +1778,117 @@ const Switch = React__namespace.forwardRef(({ label, size = "medium", isDisabled
|
|
|
1647
1778
|
});
|
|
1648
1779
|
Switch.displayName = "Switch";
|
|
1649
1780
|
|
|
1781
|
+
const tabItemVariants = classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 relative cursor-pointer", {
|
|
1782
|
+
variants: {
|
|
1783
|
+
variant: {
|
|
1784
|
+
bordered: "border-b-2",
|
|
1785
|
+
filled: "rounded-medium",
|
|
1786
|
+
},
|
|
1787
|
+
size: {
|
|
1788
|
+
small: "px-4 h-10 text-body-small-medium",
|
|
1789
|
+
large: "px-6 h-12 text-body-large-medium",
|
|
1790
|
+
},
|
|
1791
|
+
isSelected: {
|
|
1792
|
+
true: "",
|
|
1793
|
+
false: "",
|
|
1794
|
+
},
|
|
1795
|
+
isDisabled: {
|
|
1796
|
+
true: "cursor-not-allowed opacity-50",
|
|
1797
|
+
false: "",
|
|
1798
|
+
},
|
|
1799
|
+
isFullWidth: {
|
|
1800
|
+
true: "flex-1",
|
|
1801
|
+
false: "",
|
|
1802
|
+
},
|
|
1803
|
+
},
|
|
1804
|
+
compoundVariants: [
|
|
1805
|
+
// Bordered variant - not selected
|
|
1806
|
+
{
|
|
1807
|
+
variant: "bordered",
|
|
1808
|
+
isSelected: false,
|
|
1809
|
+
isDisabled: false,
|
|
1810
|
+
class: `text-text-body-secondary
|
|
1811
|
+
border-b-transparent
|
|
1812
|
+
text-action-ink-neutral-muted
|
|
1813
|
+
hover:text-action-ink-neutral-subtle
|
|
1814
|
+
hover:border-b-action-outline-neutral-faded-hover`,
|
|
1815
|
+
},
|
|
1816
|
+
// Bordered variant - selected
|
|
1817
|
+
{
|
|
1818
|
+
variant: "bordered",
|
|
1819
|
+
isSelected: true,
|
|
1820
|
+
isDisabled: false,
|
|
1821
|
+
class: "text-text-body-primary border-b-action-fill-primary-default text-action-ink-primary-normal hover:border-b-action-fill-primary-hover",
|
|
1822
|
+
},
|
|
1823
|
+
// Bordered variant - disabled
|
|
1824
|
+
{
|
|
1825
|
+
variant: "bordered",
|
|
1826
|
+
isDisabled: true,
|
|
1827
|
+
class: "text-text-body-disabled border-b-transparent",
|
|
1828
|
+
},
|
|
1829
|
+
// Filled variant - not selected
|
|
1830
|
+
{
|
|
1831
|
+
variant: "filled",
|
|
1832
|
+
isSelected: false,
|
|
1833
|
+
isDisabled: false,
|
|
1834
|
+
class: "text-text-body-secondary hover:text-text-body-primary hover:bg-surface-layer-3",
|
|
1835
|
+
},
|
|
1836
|
+
// Filled variant - selected
|
|
1837
|
+
{
|
|
1838
|
+
variant: "filled",
|
|
1839
|
+
isSelected: true,
|
|
1840
|
+
isDisabled: false,
|
|
1841
|
+
class: "text-text-body-primary bg-surface-layer-3",
|
|
1842
|
+
},
|
|
1843
|
+
// Filled variant - disabled
|
|
1844
|
+
{
|
|
1845
|
+
variant: "filled",
|
|
1846
|
+
isDisabled: true,
|
|
1847
|
+
class: "text-text-body-disabled",
|
|
1848
|
+
},
|
|
1849
|
+
],
|
|
1850
|
+
defaultVariants: {
|
|
1851
|
+
variant: "bordered",
|
|
1852
|
+
size: "large",
|
|
1853
|
+
isSelected: false,
|
|
1854
|
+
isDisabled: false,
|
|
1855
|
+
isFullWidth: false,
|
|
1856
|
+
},
|
|
1857
|
+
});
|
|
1858
|
+
const TabItem = React__namespace.forwardRef(({ leadingComponent, title, trailingComponent, isSelected = false, isDisabled = false, size = "large", variant = "bordered", isFullWidth = false, className, onClick, ...props }, ref) => {
|
|
1859
|
+
return (jsxRuntime.jsxs("button", { ref: ref, type: "button", role: "tab", "aria-selected": isSelected, disabled: isDisabled, className: cn(tabItemVariants({
|
|
1860
|
+
variant,
|
|
1861
|
+
size,
|
|
1862
|
+
isSelected,
|
|
1863
|
+
isDisabled,
|
|
1864
|
+
isFullWidth,
|
|
1865
|
+
}), className), onClick: onClick, ...props, children: [leadingComponent && (jsxRuntime.jsx("span", { className: "inline-flex items-center", children: leadingComponent })), jsxRuntime.jsx("span", { className: "inline-flex items-center", children: title }), trailingComponent && (jsxRuntime.jsx("span", { className: "inline-flex items-center", children: trailingComponent }))] }));
|
|
1866
|
+
});
|
|
1867
|
+
TabItem.displayName = "TabItem";
|
|
1868
|
+
|
|
1869
|
+
const Tabs = React__namespace.forwardRef(({ tabs, selectedTabId, defaultSelectedTabId, onTabChange, variant = "bordered", size = "large", isFullWidth = false, className, tabListClassName, contentClassName, renderContent = true, ...props }, ref) => {
|
|
1870
|
+
// Internal state for uncontrolled mode
|
|
1871
|
+
const [internalSelectedId, setInternalSelectedId] = React__namespace.useState(defaultSelectedTabId || tabs[0]?.id || "");
|
|
1872
|
+
// Determine if component is controlled
|
|
1873
|
+
const isControlled = selectedTabId !== undefined;
|
|
1874
|
+
const activeTabId = isControlled ? selectedTabId : internalSelectedId;
|
|
1875
|
+
// Handle tab selection
|
|
1876
|
+
const handleTabClick = (tabId) => {
|
|
1877
|
+
if (!isControlled) {
|
|
1878
|
+
setInternalSelectedId(tabId);
|
|
1879
|
+
}
|
|
1880
|
+
onTabChange?.(tabId);
|
|
1881
|
+
};
|
|
1882
|
+
// Get the active tab content
|
|
1883
|
+
const activeTab = tabs.find((tab) => tab.id === activeTabId);
|
|
1884
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("w-full", className), ...props, children: [jsxRuntime.jsx("div", { role: "tablist", className: cn("inline-flex items-center", {
|
|
1885
|
+
"w-full": isFullWidth,
|
|
1886
|
+
"border-b border-b-[1.5px] border-surface-outline-neutral-muted": variant === "bordered",
|
|
1887
|
+
"bg-surface-layer-2 rounded-medium p-1 gap-1": variant === "filled",
|
|
1888
|
+
}, tabListClassName), children: tabs.map((tab) => (jsxRuntime.jsx(TabItem, { leadingComponent: tab.leadingComponent, title: tab.title, trailingComponent: tab.trailingComponent, isSelected: tab.id === activeTabId, isDisabled: tab.isDisabled, variant: variant, size: size, isFullWidth: isFullWidth, onClick: () => !tab.isDisabled && handleTabClick(tab.id) }, tab.id))) }), renderContent && activeTab?.content && (jsxRuntime.jsx("div", { role: "tabpanel", className: cn("mt-4", contentClassName), "aria-labelledby": activeTabId, children: activeTab.content }))] }));
|
|
1889
|
+
});
|
|
1890
|
+
Tabs.displayName = "Tabs";
|
|
1891
|
+
|
|
1650
1892
|
const textAreaVariants = classVarianceAuthority.cva("relative flex flex-col border rounded-medium transition-all font-display font-size-100 leading-100", {
|
|
1651
1893
|
variants: {
|
|
1652
1894
|
size: {
|
|
@@ -1850,9 +2092,12 @@ exports.Divider = Divider;
|
|
|
1850
2092
|
exports.FormFooter = FormFooter;
|
|
1851
2093
|
exports.FormHeader = FormHeader;
|
|
1852
2094
|
exports.Icon = Icon;
|
|
2095
|
+
exports.Link = Link;
|
|
1853
2096
|
exports.ListItem = ListItem;
|
|
1854
2097
|
exports.Radio = Radio;
|
|
1855
2098
|
exports.Switch = Switch;
|
|
2099
|
+
exports.TabItem = TabItem;
|
|
2100
|
+
exports.Tabs = Tabs;
|
|
1856
2101
|
exports.Text = Text;
|
|
1857
2102
|
exports.TextArea = TextArea;
|
|
1858
2103
|
exports.TextField = TextField;
|
|
@@ -1865,6 +2110,7 @@ exports.counterVariants = counterVariants;
|
|
|
1865
2110
|
exports.getAvailableIcons = getAvailableIcons;
|
|
1866
2111
|
exports.hasIcon = hasIcon;
|
|
1867
2112
|
exports.iconRegistry = iconRegistry;
|
|
2113
|
+
exports.linkVariants = linkVariants;
|
|
1868
2114
|
exports.listItemVariants = listItemVariants;
|
|
1869
2115
|
exports.radioVariants = radioVariants;
|
|
1870
2116
|
exports.switchVariants = switchVariants;
|