infinity-ui-elements 1.0.8 → 1.1.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.
- package/dist/components/Text/Text.d.ts +20 -0
- package/dist/components/Text/Text.d.ts.map +1 -0
- package/dist/components/Text/Text.stories.d.ts +25 -0
- package/dist/components/Text/Text.stories.d.ts.map +1 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/Text/index.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +192 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +193 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3297,8 +3297,31 @@ const getDefaultConfig = () => {
|
|
|
3297
3297
|
};
|
|
3298
3298
|
const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
|
|
3299
3299
|
|
|
3300
|
+
// Define patterns for custom classes that should be preserved
|
|
3301
|
+
// This approach is more scalable than hardcoding individual class names
|
|
3302
|
+
const CUSTOM_CLASS_PATTERNS = [
|
|
3303
|
+
// Custom font classes
|
|
3304
|
+
/^font-(functional|display)$/,
|
|
3305
|
+
// Custom spacing classes (example)
|
|
3306
|
+
// /^spacing-(xs|sm|md|lg|xl)$/,
|
|
3307
|
+
// Custom color classes (example)
|
|
3308
|
+
// /^color-(primary|secondary|accent)$/,
|
|
3309
|
+
// Any class that starts with 'custom-'
|
|
3310
|
+
/^custom-/,
|
|
3311
|
+
];
|
|
3312
|
+
function isCustomClass(className) {
|
|
3313
|
+
return CUSTOM_CLASS_PATTERNS.some((pattern) => pattern.test(className));
|
|
3314
|
+
}
|
|
3300
3315
|
function cn(...inputs) {
|
|
3301
|
-
|
|
3316
|
+
// Use clsx first to combine classes, then use twMerge for standard Tailwind classes
|
|
3317
|
+
const combined = clsx(inputs);
|
|
3318
|
+
// Split classes and filter out our custom classes before merging
|
|
3319
|
+
const classes = combined.split(" ");
|
|
3320
|
+
const customClasses = classes.filter((cls) => isCustomClass(cls));
|
|
3321
|
+
const standardClasses = classes.filter((cls) => !isCustomClass(cls));
|
|
3322
|
+
// Merge standard classes and add back custom classes
|
|
3323
|
+
const mergedStandard = twMerge(standardClasses.join(" "));
|
|
3324
|
+
return clsx(mergedStandard, customClasses);
|
|
3302
3325
|
}
|
|
3303
3326
|
|
|
3304
3327
|
const buttonVariants = cva("items-center gap-3 justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none", {
|
|
@@ -3526,6 +3549,175 @@ const Button = React__namespace.forwardRef(({ className, variant = "primary", co
|
|
|
3526
3549
|
});
|
|
3527
3550
|
Button.displayName = "Button";
|
|
3528
3551
|
|
|
3552
|
+
const textVariants = cva("", {
|
|
3553
|
+
variants: {
|
|
3554
|
+
variant: {
|
|
3555
|
+
display: "font-functional font-medium",
|
|
3556
|
+
heading: "font-display",
|
|
3557
|
+
body: "font-display",
|
|
3558
|
+
caption: "font-display font-semibold",
|
|
3559
|
+
},
|
|
3560
|
+
size: {
|
|
3561
|
+
"2xlarge": "font-size-700 leading-700 tracking-[0%] mb-0",
|
|
3562
|
+
xlarge: "font-size-1100 leading-1100 tracking-[0%] mb-0",
|
|
3563
|
+
large: "font-size-1000 leading-1000 tracking-[0%] mb-0",
|
|
3564
|
+
medium: "font-size-900 leading-900 tracking-[0%] mb-0",
|
|
3565
|
+
small: "font-size-800 leading-800 tracking-[0%] mb-0",
|
|
3566
|
+
xsmall: "font-size-25 leading-25 tracking-[0%] mb-[var(--paragraph-spacing-100)]",
|
|
3567
|
+
},
|
|
3568
|
+
weight: {
|
|
3569
|
+
regular: "font-normal",
|
|
3570
|
+
medium: "font-medium",
|
|
3571
|
+
semibold: "font-semibold",
|
|
3572
|
+
},
|
|
3573
|
+
color: {
|
|
3574
|
+
default: "text-surface-ink-neutral-normal",
|
|
3575
|
+
subtle: "text-surface-ink-neutral-subtle",
|
|
3576
|
+
muted: "text-surface-ink-neutral-muted",
|
|
3577
|
+
disabled: "text-surface-ink-neutral-disabled",
|
|
3578
|
+
primary: "text-surface-ink-primary-normal",
|
|
3579
|
+
},
|
|
3580
|
+
as: {
|
|
3581
|
+
h1: "",
|
|
3582
|
+
h2: "",
|
|
3583
|
+
h3: "",
|
|
3584
|
+
h4: "",
|
|
3585
|
+
h5: "",
|
|
3586
|
+
h6: "",
|
|
3587
|
+
p: "",
|
|
3588
|
+
span: "",
|
|
3589
|
+
div: "",
|
|
3590
|
+
},
|
|
3591
|
+
},
|
|
3592
|
+
compoundVariants: [
|
|
3593
|
+
// Display variants use Clash Grotesk with medium weight
|
|
3594
|
+
{
|
|
3595
|
+
variant: "display",
|
|
3596
|
+
weight: "regular",
|
|
3597
|
+
class: "font-medium",
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
variant: "display",
|
|
3601
|
+
weight: "medium",
|
|
3602
|
+
class: "font-medium",
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
variant: "display",
|
|
3606
|
+
weight: "semibold",
|
|
3607
|
+
class: "font-medium",
|
|
3608
|
+
},
|
|
3609
|
+
// Caption is always semibold
|
|
3610
|
+
{
|
|
3611
|
+
variant: "caption",
|
|
3612
|
+
weight: "regular",
|
|
3613
|
+
class: "font-semibold",
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
variant: "caption",
|
|
3617
|
+
weight: "medium",
|
|
3618
|
+
class: "font-semibold",
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
variant: "caption",
|
|
3622
|
+
weight: "semibold",
|
|
3623
|
+
class: "font-semibold",
|
|
3624
|
+
},
|
|
3625
|
+
// Size-specific styling based on variant
|
|
3626
|
+
// Display sizes
|
|
3627
|
+
{
|
|
3628
|
+
variant: "display",
|
|
3629
|
+
size: "xlarge",
|
|
3630
|
+
class: "font-size-1100 leading-1100 tracking-[0%] mb-0",
|
|
3631
|
+
},
|
|
3632
|
+
{
|
|
3633
|
+
variant: "display",
|
|
3634
|
+
size: "large",
|
|
3635
|
+
class: "font-size-1000 leading-1000 tracking-[0%] mb-0",
|
|
3636
|
+
},
|
|
3637
|
+
{
|
|
3638
|
+
variant: "display",
|
|
3639
|
+
size: "medium",
|
|
3640
|
+
class: "font-size-900 leading-900 tracking-[0%] mb-0",
|
|
3641
|
+
},
|
|
3642
|
+
{
|
|
3643
|
+
variant: "display",
|
|
3644
|
+
size: "small",
|
|
3645
|
+
class: "font-size-800 leading-800 tracking-[0%] mb-0",
|
|
3646
|
+
},
|
|
3647
|
+
// Heading sizes
|
|
3648
|
+
{
|
|
3649
|
+
variant: "heading",
|
|
3650
|
+
size: "2xlarge",
|
|
3651
|
+
class: "font-size-700 leading-700 tracking-[0%] mb-0",
|
|
3652
|
+
},
|
|
3653
|
+
{
|
|
3654
|
+
variant: "heading",
|
|
3655
|
+
size: "xlarge",
|
|
3656
|
+
class: "font-size-600 leading-600 tracking-[0%] mb-0",
|
|
3657
|
+
},
|
|
3658
|
+
{
|
|
3659
|
+
variant: "heading",
|
|
3660
|
+
size: "large",
|
|
3661
|
+
class: "font-size-500 leading-500 tracking-[0%] mb-0",
|
|
3662
|
+
},
|
|
3663
|
+
{
|
|
3664
|
+
variant: "heading",
|
|
3665
|
+
size: "medium",
|
|
3666
|
+
class: "font-size-400 leading-400 tracking-[0%] mb-0",
|
|
3667
|
+
},
|
|
3668
|
+
{
|
|
3669
|
+
variant: "heading",
|
|
3670
|
+
size: "small",
|
|
3671
|
+
class: "font-size-300 leading-300 tracking-[0%] mb-0",
|
|
3672
|
+
},
|
|
3673
|
+
// Body sizes
|
|
3674
|
+
{
|
|
3675
|
+
variant: "body",
|
|
3676
|
+
size: "large",
|
|
3677
|
+
class: "font-size-200 leading-200 tracking-[0%] mb-[var(--paragraph-spacing-400)]",
|
|
3678
|
+
},
|
|
3679
|
+
{
|
|
3680
|
+
variant: "body",
|
|
3681
|
+
size: "medium",
|
|
3682
|
+
class: "font-size-100 leading-100 tracking-[0%] mb-[var(--paragraph-spacing-300)]",
|
|
3683
|
+
},
|
|
3684
|
+
{
|
|
3685
|
+
variant: "body",
|
|
3686
|
+
size: "small",
|
|
3687
|
+
class: "font-size-75 leading-75 tracking-[0%] mb-[var(--paragraph-spacing-200)]",
|
|
3688
|
+
},
|
|
3689
|
+
{
|
|
3690
|
+
variant: "body",
|
|
3691
|
+
size: "xsmall",
|
|
3692
|
+
class: "font-size-25 leading-25 tracking-[0%] mb-[var(--paragraph-spacing-100)]",
|
|
3693
|
+
},
|
|
3694
|
+
// Caption sizes
|
|
3695
|
+
{
|
|
3696
|
+
variant: "caption",
|
|
3697
|
+
size: "medium",
|
|
3698
|
+
class: "text-50 leading-50 tracking-[0%] mb-0",
|
|
3699
|
+
},
|
|
3700
|
+
],
|
|
3701
|
+
defaultVariants: {
|
|
3702
|
+
variant: "body",
|
|
3703
|
+
size: "medium",
|
|
3704
|
+
weight: "regular",
|
|
3705
|
+
color: "default",
|
|
3706
|
+
as: "p",
|
|
3707
|
+
},
|
|
3708
|
+
});
|
|
3709
|
+
const Text = React__namespace.forwardRef(({ className, variant, size, weight, color, as, children, ...props }, ref) => {
|
|
3710
|
+
const Component = as || "p";
|
|
3711
|
+
return React__namespace.createElement(Component, {
|
|
3712
|
+
className: cn(textVariants({ variant, size, weight, color, as, className })),
|
|
3713
|
+
ref,
|
|
3714
|
+
...props,
|
|
3715
|
+
}, children);
|
|
3716
|
+
});
|
|
3717
|
+
Text.displayName = "Text";
|
|
3718
|
+
|
|
3529
3719
|
exports.Button = Button;
|
|
3720
|
+
exports.Text = Text;
|
|
3530
3721
|
exports.buttonVariants = buttonVariants;
|
|
3722
|
+
exports.textVariants = textVariants;
|
|
3531
3723
|
//# sourceMappingURL=index.js.map
|