@yahoo/uds 3.97.0 → 3.98.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.
@@ -417,15 +417,21 @@ interface SizeStyleProps {
417
417
  }
418
418
  type StyleProps = BackgroundStyleProps & BorderStyleProps & LayoutStyleProps & FlexStyleProps & SpacingStyleProps & TextStyleProps & ImageStyleProps & CustomSizingStyleProps & ShadowStyleProps & SizeStyleProps & NestedBorderRadiusStyleProps;
419
419
  interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps, SizeStyleProps, ShadowStyleProps, NestedBorderRadiusStyleProps {
420
+ /** Merge props onto the immediate child element instead of rendering a wrapper. */
420
421
  asChild?: boolean;
422
+ /** The HTML element type to render. @default 'div' */
421
423
  as?: ElementType;
422
424
  }
423
425
  interface UniversalStackProps extends Omit<UniversalBoxProps, 'flexDirection'> {
426
+ /** The spacing between child elements. */
424
427
  gap?: SpacingAlias;
428
+ /** Element or render function inserted between each child. */
425
429
  separator?: ReactNode | ((index: number) => ReactNode);
426
430
  }
427
431
  interface UniversalTextProps extends PropsWithChildren, TextStyleProps, UniversalBoxProps {
432
+ /** Typography variant — sets fontSize, lineHeight, letterSpacing, and fontFamily together. @default 'body1' */
428
433
  variant?: TextVariant;
434
+ /** Text color from the theme palette. @default 'primary' */
429
435
  color?: ForegroundColor;
430
436
  }
431
437
  /**
@@ -433,9 +439,13 @@ interface UniversalTextProps extends PropsWithChildren, TextStyleProps, Universa
433
439
  * @template Icon - The icon component type. Defaults to GenericIconComponent.
434
440
  */
435
441
  interface UniversalIconProps<Icon = GenericIconComponent> {
442
+ /** The icon component to render. */
436
443
  name: Icon;
444
+ /** Icon size. @default 'md' */
437
445
  size?: IconSize;
446
+ /** Icon style variant. @default 'outline' */
438
447
  variant?: IconVariant;
448
+ /** Icon color from the theme palette. @default 'primary' */
439
449
  color?: ForegroundColor | 'inherit';
440
450
  }
441
451
  type SVGElementProps = Omit<HTMLAttributes<SVGSVGElement>, 'color'>;
@@ -448,188 +458,308 @@ type BackwardsCompatibleReactElement = null | undefined | ReactElement;
448
458
  */
449
459
  type UniversalIconSlot<Icon = GenericIconComponent> = Icon | BackwardsCompatibleReactElement | ((iconProps: IconSlotRenderProps) => BackwardsCompatibleReactElement);
450
460
  interface UniversalPressableProps extends Omit<UniversalBoxProps, 'as'> {
461
+ /** Callback fired when the element is pressed. */
451
462
  onPress?: () => void;
452
463
  }
453
464
  interface UniversalIconButtonProps<Icon = GenericIconComponent> {
465
+ /** The visual style variant of the button. */
454
466
  variant?: ButtonVariantFlat;
467
+ /** The size of the button. */
455
468
  size?: IconButtonSize;
469
+ /** The icon style variant. @default 'outline' */
456
470
  iconVariant?: IconVariant;
471
+ /** The icon to render. */
457
472
  name: Icon;
473
+ /** HTML name attribute for form submission. */
458
474
  htmlName?: string;
475
+ /** Shows a loading spinner and disables the button. */
459
476
  loading?: boolean;
477
+ /** Disable motion effects (scale on press, icon animations). @default false */
460
478
  disableEffects?: boolean;
461
479
  }
462
480
  interface UniversalButtonProps<IconSlotType = UniversalIconSlot> extends Pick<SizeStyleProps, 'width'> {
481
+ /** The visual style variant of the button. */
463
482
  variant?: ButtonVariantFlat;
483
+ /** The size of the button. */
464
484
  size?: ButtonSize;
485
+ /** The icon style variant. */
465
486
  iconVariant?: IconVariant;
487
+ /** Icon displayed before the button label. */
466
488
  startIcon?: IconSlotType;
489
+ /** Icon displayed after the button label. */
467
490
  endIcon?: IconSlotType;
491
+ /** Shows a loading spinner and disables the button. @default false */
468
492
  loading?: boolean;
493
+ /** Disable motion effects (scale on press, icon animations). @default false */
469
494
  disableEffects?: boolean;
495
+ /** Merge props onto the immediate child element instead of rendering a wrapper. @default false */
470
496
  asChild?: boolean;
471
497
  }
472
498
  interface UniversalImageProps extends Omit<UniversalBoxProps, 'width' | 'height'>, ImageStyleProps {
499
+ /** Image source URL. */
473
500
  src: string;
501
+ /** Alt text for accessibility. */
474
502
  alt?: string;
503
+ /** Image width in pixels. */
475
504
  width?: number;
505
+ /** Image height in pixels. */
476
506
  height?: number;
477
507
  }
478
508
  type ImgElementProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'size' | 'color' | 'height' | 'width' | 'alt' | 'src'>;
479
509
  interface ImagePropsWithImgProps extends UniversalImageProps, ImgElementProps {}
480
510
  interface UniversalFormLabelProps extends Omit<UniversalTextProps, 'variant' | 'color'> {
511
+ /** The HTML element type to render. */
481
512
  as?: ElementType;
513
+ /** Typography variant for the label text. */
482
514
  variant?: UniversalTextProps['variant'] | 'inherit';
515
+ /** Whether the field is required (shows asterisk). */
483
516
  required?: boolean;
517
+ /** Label text color. */
484
518
  color?: ForegroundColor | 'inherit';
519
+ /** Whether the associated field has a validation error. */
485
520
  hasError?: boolean;
521
+ /** Whether to display a required asterisk (*) next to the label. */
486
522
  showRequiredAsterisk?: boolean;
523
+ /** The label content. */
487
524
  label?: string | ReactNode | (() => ReactNode);
488
525
  }
489
526
  interface UniversalInputProps<IconSlotType = UniversalIconSlot> {
527
+ /** The label displayed above the input. */
490
528
  label?: string | ReactNode | (() => ReactNode);
529
+ /** Whether the input is disabled. */
491
530
  disabled?: boolean;
531
+ /** Whether the input is required. */
492
532
  required?: boolean;
533
+ /** Helper text displayed below the input. */
493
534
  helpText?: string | ReactNode | (() => ReactNode);
535
+ /** Icon displayed alongside the helper text. */
494
536
  helperTextIcon?: IconSlotType;
537
+ /** Whether the input has a validation error. */
495
538
  hasError?: boolean;
539
+ /** The size of the input. @default 'md' */
496
540
  size?: InputSize;
541
+ /** Icon displayed at the start of the input. */
497
542
  startIcon?: IconSlotType;
543
+ /** Icon displayed at the end of the input. */
498
544
  endIcon?: IconSlotType;
545
+ /** Disable motion and transition effects. */
499
546
  reduceMotion?: boolean;
547
+ /** Whether the input is read-only. */
500
548
  readOnly?: boolean;
549
+ /** The width of the input container. @default 'full' */
501
550
  width?: UniversalBoxProps['width'];
502
551
  }
503
552
  type DividerVariant = 'primary' | 'secondary' | 'tertiary' | 'muted';
504
553
  interface UniversalDividerProps {
554
+ /** The visual style variant of the divider. @default 'primary' */
505
555
  variant?: DividerVariant;
556
+ /** Whether to render as a vertical divider. @default false */
506
557
  vertical?: boolean;
558
+ /** Position of content within the divider. @default 'center' */
507
559
  contentPosition?: 'start' | 'center' | 'end';
508
560
  }
509
561
  type LinkVariant = 'primary' | 'secondary' | 'tertiary' | 'on-color';
510
562
  type LinkTextVariant = TextVariantWithoutEmphasized;
511
563
  interface UniversalLinkProps<IconSlotType = UniversalIconSlot> {
564
+ /** Typography variant for the link text. */
512
565
  textVariant?: LinkTextVariant;
566
+ /** The visual style variant of the link. @default 'primary' */
513
567
  variant?: LinkVariant;
568
+ /** Icon displayed before the link text. */
514
569
  startIcon?: IconSlotType;
570
+ /** Icon displayed after the link text. */
515
571
  endIcon?: IconSlotType;
572
+ /** Always show an underline, not just on hover. @default false */
516
573
  alwaysUnderline?: boolean;
517
574
  }
518
575
  type CheckboxValue = boolean | 'indeterminate';
519
576
  type CheckboxVariant = 'primary' | 'secondary';
520
577
  type CheckboxSize = 'sm' | 'md';
521
578
  interface UniversalCheckboxProps {
579
+ /** The visual style variant of the checkbox. @default 'primary' */
522
580
  variant?: CheckboxVariant;
581
+ /** The size of the checkbox. @default 'md' */
523
582
  size?: CheckboxSize;
583
+ /** The label content displayed alongside the checkbox. */
524
584
  label?: string | ReactNode | (() => ReactNode);
585
+ /** The controlled checked state. */
525
586
  checked?: CheckboxValue;
587
+ /** Whether the checkbox has a validation error. */
526
588
  hasError?: boolean;
589
+ /** Disable motion and transition effects. */
527
590
  reduceMotion?: boolean;
591
+ /** Position of the label relative to the checkbox. @default 'start' */
528
592
  labelPosition?: 'start' | 'end';
529
593
  }
530
594
  type RadioValue = boolean;
531
595
  type RadioVariant = 'primary' | 'secondary';
532
596
  type RadioSize = 'sm' | 'md';
533
597
  interface UniversalRadioProps {
598
+ /** The visual style variant of the radio. @default 'primary' */
534
599
  variant?: RadioVariant;
600
+ /** The size of the radio. @default 'md' */
535
601
  size?: RadioSize;
602
+ /** The label content displayed alongside the radio. */
536
603
  label?: string | ReactNode | (() => ReactNode);
604
+ /** The value submitted with form data. @default '' */
537
605
  value?: string;
606
+ /** The controlled checked state. */
538
607
  checked?: boolean;
608
+ /** Whether the radio has a validation error. */
539
609
  hasError?: boolean;
610
+ /** Disable motion and transition effects. */
540
611
  reduceMotion?: boolean;
612
+ /** Position of the label relative to the radio. @default 'start' */
541
613
  labelPosition?: 'start' | 'end';
542
614
  }
543
615
  interface UniversalRadioGroupProps {
616
+ /** The name shared by all radios in the group (for form submission). */
544
617
  name?: string;
618
+ /** The controlled selected value. */
545
619
  value?: string;
620
+ /** The initial selected value for uncontrolled mode. */
546
621
  defaultValue?: string;
622
+ /** Callback fired when the selected value changes. */
547
623
  onChange?: (value: string | undefined) => void;
624
+ /** Merge props onto the immediate child element instead of rendering a wrapper. */
548
625
  asChild?: boolean;
549
626
  }
550
627
  type SwitchSize = 'sm' | 'md';
551
628
  interface UniversalSwitchProps<IconSlotType = UniversalIconSlot> {
629
+ /** The size of the switch. @default 'md' */
552
630
  size?: SwitchSize;
631
+ /** The label content displayed alongside the switch. */
553
632
  label?: string | ReactNode | (() => ReactNode);
633
+ /** The controlled on/off state. */
554
634
  isOn?: boolean;
635
+ /** The initial on/off state for uncontrolled mode. */
555
636
  defaultIsOn?: boolean;
637
+ /** Icon displayed inside the switch when on. */
556
638
  onIcon?: IconSlotType;
639
+ /** Icon displayed inside the switch when off. */
557
640
  offIcon?: IconSlotType;
641
+ /** Disable motion and transition effects. */
558
642
  reduceMotion?: boolean;
643
+ /** Position of the label relative to the switch. @default 'start' */
559
644
  labelPosition?: 'start' | 'end';
560
645
  }
561
646
  type ChipVariant = 'primary' | 'secondary' | 'brand' | 'brand-secondary';
562
647
  type ChipSize = 'sm' | 'md';
563
648
  interface UniversalChipBaseProps<IconSlotType = UniversalIconSlot> extends PropsWithChildren {
649
+ /** The visual style variant of the chip. */
564
650
  variant?: ChipVariant;
651
+ /** The size of the chip. @default 'md' */
565
652
  size?: ChipSize;
653
+ /** Icon displayed at the start of the chip. */
566
654
  startIcon?: IconSlotType;
655
+ /** Icon displayed at the end of the chip. */
567
656
  endIcon?: IconSlotType;
657
+ /** Minimum width of the chip in pixels. */
568
658
  minWidth?: number;
659
+ /** Maximum width of the chip in pixels. @default 200 */
569
660
  maxWidth?: number;
661
+ /** The HTML element type to render. */
570
662
  as?: ElementType;
663
+ /** Disable motion and transition effects. */
571
664
  reduceMotion?: boolean;
665
+ /** Whether the chip is disabled. @default false */
572
666
  disabled?: boolean;
573
667
  }
574
668
  interface UniversalChipDismissibleProps<IconSlotType = UniversalIconSlot> extends Omit<UniversalChipBaseProps, 'endIcon' | 'asChild' | 'layerClassNames'> {
669
+ /** Callback fired when the dismiss button is pressed. Shows a dismiss icon. */
575
670
  onDismiss?: () => void;
671
+ /** Accessibility label for the dismiss button. */
576
672
  dismissButtonAriaLabel?: string;
673
+ /** Custom icon for the dismiss button. */
577
674
  dismissIcon?: IconSlotType;
578
675
  }
579
676
  interface UniversalChipToggleProps extends Omit<UniversalChipBaseProps, 'asChild' | 'layerClassNames'> {
677
+ /** Whether the chip is toggled/selected. */
580
678
  isToggled?: boolean;
679
+ /** Callback fired when the chip toggle state changes. */
581
680
  onToggle?: (isToggled: boolean) => void;
582
681
  }
583
682
  type UniversalChipButtonProps = Omit<UniversalChipToggleProps, 'isToggled' | 'onToggle' | 'asChild'>;
584
683
  interface UniversalChipLinkProps extends Omit<UniversalChipBaseProps, 'layerClassNames'> {
684
+ /** The URL the chip links to. */
585
685
  href?: string;
586
686
  }
587
687
  interface UniversalChipProps extends UniversalChipToggleProps, UniversalChipLinkProps, UniversalChipButtonProps, UniversalChipDismissibleProps {}
588
688
  type BadgeVariant = 'primary' | 'secondary' | 'brand' | 'brand-secondary' | 'alert' | 'alert-secondary' | 'positive' | 'positive-secondary' | 'warning' | 'warning-secondary' | 'info' | 'info-secondary';
589
689
  type BadgeSize = 'xs' | 'sm' | 'md' | 'lg';
590
690
  interface UniversalBadgeProps<IconSlotType = UniversalIconSlot> extends PropsWithChildren {
691
+ /** The HTML element type to render. */
591
692
  as?: ElementType;
693
+ /** The visual style variant of the badge. @default 'primary' */
592
694
  variant?: BadgeVariant;
695
+ /** The size of the badge. @default 'md' */
593
696
  size?: BadgeSize;
697
+ /** Override the background color. */
594
698
  backgroundColor?: string;
699
+ /** Override the text color. */
595
700
  color?: string;
701
+ /** Override the icon color. */
596
702
  iconColor?: string;
703
+ /** Override the border color. */
597
704
  borderColor?: string;
705
+ /** Icon displayed at the start of the badge. */
598
706
  startIcon?: IconSlotType;
707
+ /** Icon displayed at the end of the badge. */
599
708
  endIcon?: IconSlotType;
709
+ /** Minimum width of the badge in pixels. */
600
710
  minWidth?: number;
711
+ /** Maximum width of the badge in pixels. @default 200 */
601
712
  maxWidth?: number | 'full';
602
713
  }
603
714
  type AvatarVariant = 'primary' | 'secondary';
604
715
  type AvatarAbbreviationStrategy = 'first' | 'last' | 'firstAndLast' | 'firstTwo' | 'firstThree' | 'firstOfEach' | ((name: string) => string);
605
716
  interface UniversalAvatarBaseProps {
717
+ /** The size of the avatar. @default 'md' */
606
718
  size?: AvatarSize;
719
+ /** The visual style variant of the avatar. @default 'primary' */
607
720
  variant?: 'primary' | 'secondary';
721
+ /** Custom size in pixels, overriding the size token. */
608
722
  customSize?: number;
723
+ /** Strategy for generating initials from a name. */
609
724
  abbreviationStrategy?: AvatarAbbreviationStrategy;
725
+ /** Alt text for accessibility. */
610
726
  alt?: string;
727
+ /** Additional CSS class name. */
611
728
  className?: string;
612
729
  }
613
730
  interface UniversalAvatarImageProps extends UniversalAvatarBaseProps {
731
+ /** Image source URL. */
614
732
  src: string;
733
+ /** Responsive image source set. */
615
734
  srcSet?: string;
735
+ /** Fallback name or initials displayed when the image fails to load. */
616
736
  fallback?: string;
617
737
  }
618
738
  interface UniversalAvatarTextProps extends UniversalAvatarBaseProps {
739
+ /** Full name used to generate initials. */
619
740
  name?: string;
741
+ /** Explicit initials to display (overrides auto-generated from name). */
620
742
  initials?: string;
621
743
  }
622
744
  interface UniversalAvatarIconProps<IconSlotType = UniversalIconSlot> extends Omit<UniversalAvatarBaseProps, 'abbreviationStrategy'> {
745
+ /** Custom icon to display in the avatar. */
623
746
  icon?: IconSlotType;
624
747
  }
625
748
  type UniversalAvatarProps = UniversalAvatarImageProps;
626
749
  interface UniversalMenuItemProps<IconSlotType = UniversalIconSlot> extends Omit<UniversalPressableProps, 'asChild'>, PropsWithChildren {
750
+ /** Icon displayed at the end of the menu item. */
627
751
  endIcon?: IconSlotType;
752
+ /** Icon displayed at the start of the menu item. */
628
753
  startIcon?: IconSlotType;
754
+ /** Typography variant for the menu item text. */
629
755
  textVariant?: TextVariant;
756
+ /** The value identifying this menu item. */
630
757
  name?: string;
758
+ /** Whether this menu item is currently active/highlighted. */
631
759
  active?: boolean;
760
+ /** Whether the menu item is disabled. */
632
761
  disabled?: boolean;
762
+ /** Render prop slots for customizing internal elements. */
633
763
  slots?: {
634
764
  root?: (props: HTMLAttributes<any> & {
635
765
  ref?: Ref<any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yahoo/uds",
3
3
  "description": "Yahoo Universal System",
4
- "version": "3.97.0",
4
+ "version": "3.98.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",