@mond-design-system/react 4.11.0 → 5.0.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
2
+ import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, HTMLInputTypeAttribute, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
3
3
 
4
4
  /**
5
5
  * Join class names, dropping anything falsy.
@@ -612,7 +612,18 @@ interface FieldProps {
612
612
  declare function Field({ label, children, hint, error, required, className }: FieldProps): ReactElement;
613
613
 
614
614
  type InputSize = "sm" | "md" | "lg";
615
- interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
615
+ interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
616
+ /** The native input type, passed straight through — the system adds no types
617
+ of its own, so `email`, `tel`, `url` and `number` behave as the platform
618
+ defines them, keyboard and validation included. Default "text".
619
+
620
+ One type the component answers to: with `type="search"`, `onClear` takes
621
+ over the browser's own clear cross, so the field shows one clear
622
+ affordance rather than two. Without `onClear` the native cross is left
623
+ alone — there it is the only way to empty the field. */
624
+ type?: HTMLInputTypeAttribute;
625
+ /** Control height and type size. The icon slots, the gutter and the clear
626
+ button all step with it. Default "md". */
616
627
  size?: InputSize;
617
628
  /** Marks the value as failing validation — sets aria-invalid and the danger
618
629
  border. Inside a Field the field's error state does this already. */
@@ -624,20 +635,50 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
624
635
  iconRight?: ReactNode;
625
636
  ref?: Ref<HTMLInputElement>;
626
637
  }
638
+ type ClearEnforcement = {
639
+ /** Raises a clear button in the trailing slot whenever the field holds
640
+ text, and runs when it is pressed. An uncontrolled field is emptied
641
+ for you; a controlled one is yours to empty here. Rules out
642
+ iconRight — they are the same slot. */
643
+ onClear: () => void;
644
+ /** Names that button, e.g. "Clear search". Required: the cross says
645
+ nothing to a screen reader, and the words are the app's — "Clear
646
+ search" and "Clear filter" are not interchangeable. */
647
+ clearLabel: string;
648
+ iconRight?: undefined;
649
+ } | {
650
+ onClear?: undefined;
651
+ clearLabel?: undefined;
652
+ };
653
+ type InputProps = InputBaseProps & ClearEnforcement;
627
654
  /**
628
655
  * Single-line text input. Inside a Field it inherits id/description/invalid.
629
656
  *
657
+ * Sizes are `sm` / `md` / `lg`; the icon slots and the clear button step with
658
+ * them. `onClear` folds in what SearchField used to be — pair it with
659
+ * `type="search"` and it replaces the browser's own clear cross.
660
+ *
630
661
  * ```tsx
631
662
  * <Field label="Name">
632
663
  * <Input value={name} onChange={(e) => setName(e.target.value)} />
633
664
  * </Field>
634
665
  *
635
666
  * <Input aria-label="Search" iconLeft={<Icon name="search" />} />
667
+ *
668
+ * <Input
669
+ * type="search"
670
+ * aria-label="Search sessions"
671
+ * iconLeft={<Icon name="search" />}
672
+ * value={query}
673
+ * onChange={(e) => setQuery(e.target.value)}
674
+ * clearLabel="Clear search"
675
+ * onClear={() => setQuery("")}
676
+ * />
636
677
  * ```
637
678
  */
638
- declare function Input({ size, invalid, iconLeft, iconRight, className, ...rest }: InputProps): ReactElement;
679
+ declare function Input({ size, invalid, iconLeft, iconRight, onClear, clearLabel, className, ref, ...rest }: InputProps): ReactElement;
639
680
 
640
- interface PasswordInputProps extends Omit<InputProps, "type"> {
681
+ interface PasswordInputProps extends Omit<InputProps, "type" | "onClear" | "clearLabel" | "iconRight"> {
641
682
  /** Names the reveal button while the password is hidden, e.g. "Show password".
642
683
  Required: the button carries no visible text, so this is the only thing a
643
684
  screen reader has, and it is the app's language rather than the system's. */
@@ -820,26 +861,6 @@ interface SegmentedControlProps<T extends string = string> {
820
861
  */
821
862
  declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, repick, className, }: SegmentedControlProps<T>): ReactElement;
822
863
 
823
- interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
824
- /** Accessible name. */
825
- label: string;
826
- /** Names the clear button, e.g. "Clear search". Required: the button is a
827
- glyph, so this is all a screen reader has, and the words are the app's. */
828
- clearLabel: string;
829
- value: string;
830
- /** Receives the new text — "" when cleared. */
831
- onChange: (value: string) => void;
832
- ref?: Ref<HTMLInputElement>;
833
- }
834
- /**
835
- * Controlled search input with a clear affordance once there is text.
836
- *
837
- * ```tsx
838
- * <SearchField label="Search sessions" clearLabel="Clear search" value={query} onChange={setQuery} />
839
- * ```
840
- */
841
- declare function SearchField({ label, clearLabel, value, onChange, className, ...rest }: SearchFieldProps): ReactElement;
842
-
843
864
  interface ScrollerLabels {
844
865
  previous: string;
845
866
  next: string;
@@ -1239,8 +1260,24 @@ type CardSectionProps = HTMLAttributes<HTMLDivElement> & {
1239
1260
  };
1240
1261
  /** Top slot — title row, media, tabs. */
1241
1262
  declare function CardHeader({ className, ...rest }: CardSectionProps): ReactElement;
1242
- /** Main content slot. */
1243
- declare function CardBody({ className, ...rest }: CardSectionProps): ReactElement;
1263
+ interface CardBodyProps extends CardSectionProps {
1264
+ /** How many lines of content the card affords. Past it the body clips, with
1265
+ an ellipsis on the last line. Unset, the body grows to what it holds. */
1266
+ lines?: number;
1267
+ }
1268
+ /**
1269
+ * Main content slot.
1270
+ *
1271
+ * The card is the box, so the box is what says how much of a thing fits:
1272
+ * `lines` clips whatever the body holds — a paragraph, two of them, a bare
1273
+ * string — rather than asking each child to clip itself.
1274
+ *
1275
+ * A budgeted body counts lines, which is a thing only `-webkit-box` does, so it
1276
+ * is no longer a flex column: `gap` between its children stops applying and a
1277
+ * margin is what separates them. A body doing layout for a card keeps its own
1278
+ * budget-free, and holds a budgeted one for the part that has to fit.
1279
+ */
1280
+ declare function CardBody({ lines, className, style, ...rest }: CardBodyProps): ReactElement;
1244
1281
  /** Bottom slot — actions, meta. */
1245
1282
  declare function CardFooter({ className, ...rest }: CardSectionProps): ReactElement;
1246
1283
 
@@ -1942,4 +1979,4 @@ interface RovingGroupOptions {
1942
1979
  */
1943
1980
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1944
1981
 
1945
- export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
1982
+ export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, type CardBodyProps, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
2
+ import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, HTMLInputTypeAttribute, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
3
3
 
4
4
  /**
5
5
  * Join class names, dropping anything falsy.
@@ -612,7 +612,18 @@ interface FieldProps {
612
612
  declare function Field({ label, children, hint, error, required, className }: FieldProps): ReactElement;
613
613
 
614
614
  type InputSize = "sm" | "md" | "lg";
615
- interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
615
+ interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
616
+ /** The native input type, passed straight through — the system adds no types
617
+ of its own, so `email`, `tel`, `url` and `number` behave as the platform
618
+ defines them, keyboard and validation included. Default "text".
619
+
620
+ One type the component answers to: with `type="search"`, `onClear` takes
621
+ over the browser's own clear cross, so the field shows one clear
622
+ affordance rather than two. Without `onClear` the native cross is left
623
+ alone — there it is the only way to empty the field. */
624
+ type?: HTMLInputTypeAttribute;
625
+ /** Control height and type size. The icon slots, the gutter and the clear
626
+ button all step with it. Default "md". */
616
627
  size?: InputSize;
617
628
  /** Marks the value as failing validation — sets aria-invalid and the danger
618
629
  border. Inside a Field the field's error state does this already. */
@@ -624,20 +635,50 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
624
635
  iconRight?: ReactNode;
625
636
  ref?: Ref<HTMLInputElement>;
626
637
  }
638
+ type ClearEnforcement = {
639
+ /** Raises a clear button in the trailing slot whenever the field holds
640
+ text, and runs when it is pressed. An uncontrolled field is emptied
641
+ for you; a controlled one is yours to empty here. Rules out
642
+ iconRight — they are the same slot. */
643
+ onClear: () => void;
644
+ /** Names that button, e.g. "Clear search". Required: the cross says
645
+ nothing to a screen reader, and the words are the app's — "Clear
646
+ search" and "Clear filter" are not interchangeable. */
647
+ clearLabel: string;
648
+ iconRight?: undefined;
649
+ } | {
650
+ onClear?: undefined;
651
+ clearLabel?: undefined;
652
+ };
653
+ type InputProps = InputBaseProps & ClearEnforcement;
627
654
  /**
628
655
  * Single-line text input. Inside a Field it inherits id/description/invalid.
629
656
  *
657
+ * Sizes are `sm` / `md` / `lg`; the icon slots and the clear button step with
658
+ * them. `onClear` folds in what SearchField used to be — pair it with
659
+ * `type="search"` and it replaces the browser's own clear cross.
660
+ *
630
661
  * ```tsx
631
662
  * <Field label="Name">
632
663
  * <Input value={name} onChange={(e) => setName(e.target.value)} />
633
664
  * </Field>
634
665
  *
635
666
  * <Input aria-label="Search" iconLeft={<Icon name="search" />} />
667
+ *
668
+ * <Input
669
+ * type="search"
670
+ * aria-label="Search sessions"
671
+ * iconLeft={<Icon name="search" />}
672
+ * value={query}
673
+ * onChange={(e) => setQuery(e.target.value)}
674
+ * clearLabel="Clear search"
675
+ * onClear={() => setQuery("")}
676
+ * />
636
677
  * ```
637
678
  */
638
- declare function Input({ size, invalid, iconLeft, iconRight, className, ...rest }: InputProps): ReactElement;
679
+ declare function Input({ size, invalid, iconLeft, iconRight, onClear, clearLabel, className, ref, ...rest }: InputProps): ReactElement;
639
680
 
640
- interface PasswordInputProps extends Omit<InputProps, "type"> {
681
+ interface PasswordInputProps extends Omit<InputProps, "type" | "onClear" | "clearLabel" | "iconRight"> {
641
682
  /** Names the reveal button while the password is hidden, e.g. "Show password".
642
683
  Required: the button carries no visible text, so this is the only thing a
643
684
  screen reader has, and it is the app's language rather than the system's. */
@@ -820,26 +861,6 @@ interface SegmentedControlProps<T extends string = string> {
820
861
  */
821
862
  declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, repick, className, }: SegmentedControlProps<T>): ReactElement;
822
863
 
823
- interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
824
- /** Accessible name. */
825
- label: string;
826
- /** Names the clear button, e.g. "Clear search". Required: the button is a
827
- glyph, so this is all a screen reader has, and the words are the app's. */
828
- clearLabel: string;
829
- value: string;
830
- /** Receives the new text — "" when cleared. */
831
- onChange: (value: string) => void;
832
- ref?: Ref<HTMLInputElement>;
833
- }
834
- /**
835
- * Controlled search input with a clear affordance once there is text.
836
- *
837
- * ```tsx
838
- * <SearchField label="Search sessions" clearLabel="Clear search" value={query} onChange={setQuery} />
839
- * ```
840
- */
841
- declare function SearchField({ label, clearLabel, value, onChange, className, ...rest }: SearchFieldProps): ReactElement;
842
-
843
864
  interface ScrollerLabels {
844
865
  previous: string;
845
866
  next: string;
@@ -1239,8 +1260,24 @@ type CardSectionProps = HTMLAttributes<HTMLDivElement> & {
1239
1260
  };
1240
1261
  /** Top slot — title row, media, tabs. */
1241
1262
  declare function CardHeader({ className, ...rest }: CardSectionProps): ReactElement;
1242
- /** Main content slot. */
1243
- declare function CardBody({ className, ...rest }: CardSectionProps): ReactElement;
1263
+ interface CardBodyProps extends CardSectionProps {
1264
+ /** How many lines of content the card affords. Past it the body clips, with
1265
+ an ellipsis on the last line. Unset, the body grows to what it holds. */
1266
+ lines?: number;
1267
+ }
1268
+ /**
1269
+ * Main content slot.
1270
+ *
1271
+ * The card is the box, so the box is what says how much of a thing fits:
1272
+ * `lines` clips whatever the body holds — a paragraph, two of them, a bare
1273
+ * string — rather than asking each child to clip itself.
1274
+ *
1275
+ * A budgeted body counts lines, which is a thing only `-webkit-box` does, so it
1276
+ * is no longer a flex column: `gap` between its children stops applying and a
1277
+ * margin is what separates them. A body doing layout for a card keeps its own
1278
+ * budget-free, and holds a budgeted one for the part that has to fit.
1279
+ */
1280
+ declare function CardBody({ lines, className, style, ...rest }: CardBodyProps): ReactElement;
1244
1281
  /** Bottom slot — actions, meta. */
1245
1282
  declare function CardFooter({ className, ...rest }: CardSectionProps): ReactElement;
1246
1283
 
@@ -1942,4 +1979,4 @@ interface RovingGroupOptions {
1942
1979
  */
1943
1980
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1944
1981
 
1945
- export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
1982
+ export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, type CardBodyProps, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
package/dist/index.js CHANGED
@@ -1092,20 +1092,47 @@ function ProgressBar({
1092
1092
  );
1093
1093
  }
1094
1094
 
1095
+ // src/internal/forkRef.ts
1096
+ function forkRef(own, given) {
1097
+ return (node) => {
1098
+ own.current = node;
1099
+ if (typeof given === "function") given(node);
1100
+ else if (given != null) given.current = node;
1101
+ };
1102
+ }
1103
+
1095
1104
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Input/Input.module.css?mds-scoped
1096
- var Input_module_default = { "input": "mds-Input__input", "size-sm": "mds-Input__size-sm", "size-md": "mds-Input__size-md", "size-lg": "mds-Input__size-lg", "iconWrap": "mds-Input__iconWrap", "icon": "mds-Input__icon", "iconLeft": "mds-Input__iconLeft", "iconRight": "mds-Input__iconRight", "with-icon-left": "mds-Input__with-icon-left", "with-icon-right": "mds-Input__with-icon-right" };
1105
+ var Input_module_default = { "input": "mds-Input__input", "own-clear": "mds-Input__own-clear", "size-sm": "mds-Input__size-sm", "size-md": "mds-Input__size-md", "size-lg": "mds-Input__size-lg", "iconWrap": "mds-Input__iconWrap", "icon": "mds-Input__icon", "slot-sm": "mds-Input__slot-sm", "slot-md": "mds-Input__slot-md", "slot-lg": "mds-Input__slot-lg", "iconLeft": "mds-Input__iconLeft", "iconRight": "mds-Input__iconRight", "with-icon-left": "mds-Input__with-icon-left", "with-icon-right": "mds-Input__with-icon-right", "clear": "mds-Input__clear mds-hit-area__hitArea", "clearGlyph": "mds-Input__clearGlyph" };
1097
1106
  function Input({
1098
1107
  size = "md",
1099
1108
  invalid,
1100
1109
  iconLeft,
1101
1110
  iconRight,
1111
+ onClear,
1112
+ clearLabel,
1102
1113
  className,
1114
+ ref,
1103
1115
  ...rest
1104
1116
  }) {
1105
1117
  const field = useFieldContext();
1118
+ const own = useRef(null);
1119
+ const [typedInto, setTypedInto] = useState(() => String(rest.defaultValue ?? "") !== "");
1120
+ const hasText = rest.value !== void 0 ? String(rest.value) !== "" : typedInto;
1121
+ const showClear = onClear != null && hasText;
1122
+ const handleChange = (event) => {
1123
+ if (onClear != null) setTypedInto(event.target.value !== "");
1124
+ rest.onChange?.(event);
1125
+ };
1126
+ const clear = () => {
1127
+ if (rest.value === void 0 && own.current != null) own.current.value = "";
1128
+ setTypedInto(false);
1129
+ own.current?.focus();
1130
+ onClear?.();
1131
+ };
1106
1132
  const input = /* @__PURE__ */ jsx(
1107
1133
  "input",
1108
1134
  {
1135
+ ref: forkRef(own, ref),
1109
1136
  id: rest.id ?? field?.id,
1110
1137
  "aria-describedby": rest["aria-describedby"] ?? field?.describedBy,
1111
1138
  "aria-invalid": rest["aria-invalid"] ?? ((invalid ?? field?.invalid) || void 0),
@@ -1113,17 +1140,20 @@ function Input({
1113
1140
  Input_module_default.input,
1114
1141
  Input_module_default[`size-${size}`],
1115
1142
  iconLeft != null && Input_module_default["with-icon-left"],
1116
- iconRight != null && Input_module_default["with-icon-right"],
1143
+ (iconRight != null || showClear) && Input_module_default["with-icon-right"],
1144
+ onClear != null && Input_module_default["own-clear"],
1117
1145
  className
1118
1146
  ),
1119
- ...rest
1147
+ ...rest,
1148
+ onChange: handleChange
1120
1149
  }
1121
1150
  );
1122
- if (iconLeft == null && iconRight == null) return input;
1123
- return /* @__PURE__ */ jsxs("span", { className: Input_module_default.iconWrap, children: [
1151
+ if (iconLeft == null && iconRight == null && onClear == null) return input;
1152
+ return /* @__PURE__ */ jsxs("span", { className: cx(Input_module_default.iconWrap, Input_module_default[`slot-${size}`]), children: [
1124
1153
  input,
1125
1154
  iconLeft != null && /* @__PURE__ */ jsx("span", { className: cx(Input_module_default.icon, Input_module_default.iconLeft), "aria-hidden": "true", children: iconLeft }),
1126
- iconRight != null && /* @__PURE__ */ jsx("span", { className: cx(Input_module_default.icon, Input_module_default.iconRight), "aria-hidden": "true", children: iconRight })
1155
+ iconRight != null && /* @__PURE__ */ jsx("span", { className: cx(Input_module_default.icon, Input_module_default.iconRight), "aria-hidden": "true", children: iconRight }),
1156
+ showClear && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": clearLabel, className: Input_module_default.clear, onClick: clear, children: /* @__PURE__ */ jsx(CloseGlyph, { className: Input_module_default.clearGlyph }) })
1127
1157
  ] });
1128
1158
  }
1129
1159
 
@@ -1195,15 +1225,6 @@ function Textarea({ rows = 3, showCount = false, className, ...rest }) {
1195
1225
  ] });
1196
1226
  }
1197
1227
 
1198
- // src/internal/forkRef.ts
1199
- function forkRef(own, given) {
1200
- return (node) => {
1201
- own.current = node;
1202
- if (typeof given === "function") given(node);
1203
- else if (given != null) given.current = node;
1204
- };
1205
- }
1206
-
1207
1228
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Checkbox/Checkbox.module.css?mds-scoped
1208
1229
  var Checkbox_module_default = { "root": "mds-Checkbox__root", "box": "mds-Checkbox__box mds-hit-area__hitArea", "bare": "mds-Checkbox__bare", "label": "mds-Checkbox__label" };
1209
1230
  function Checkbox({
@@ -1316,51 +1337,6 @@ function SegmentedControl({
1316
1337
  );
1317
1338
  }
1318
1339
 
1319
- // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/SearchField/SearchField.module.css?mds-scoped
1320
- var SearchField_module_default = { "wrap": "mds-SearchField__wrap", "glass": "mds-SearchField__glass", "input": "mds-SearchField__input", "clear": "mds-SearchField__clear mds-hit-area__hitArea", "clearGlyph": "mds-SearchField__clearGlyph" };
1321
- function SearchField({
1322
- label,
1323
- clearLabel,
1324
- value,
1325
- onChange,
1326
- className,
1327
- ...rest
1328
- }) {
1329
- return /* @__PURE__ */ jsxs("span", { className: cx(SearchField_module_default.wrap, className), children: [
1330
- /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: SearchField_module_default.glass, children: /* @__PURE__ */ jsx(
1331
- "path",
1332
- {
1333
- d: "M7 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10Zm7 2-3.5-3.5",
1334
- fill: "none",
1335
- stroke: "currentColor",
1336
- strokeWidth: "1.5",
1337
- strokeLinecap: "round"
1338
- }
1339
- ) }),
1340
- /* @__PURE__ */ jsx(
1341
- "input",
1342
- {
1343
- type: "search",
1344
- "aria-label": label,
1345
- value,
1346
- onChange: (event) => onChange(event.target.value),
1347
- className: SearchField_module_default.input,
1348
- ...rest
1349
- }
1350
- ),
1351
- value !== "" && /* @__PURE__ */ jsx(
1352
- "button",
1353
- {
1354
- type: "button",
1355
- "aria-label": clearLabel,
1356
- className: SearchField_module_default.clear,
1357
- onClick: () => onChange(""),
1358
- children: /* @__PURE__ */ jsx(CloseGlyph, { className: SearchField_module_default.clearGlyph })
1359
- }
1360
- )
1361
- ] });
1362
- }
1363
-
1364
1340
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Scroller/Scroller.module.css?mds-scoped
1365
1341
  var Scroller_module_default = { "scroller": "mds-Scroller__scroller", "header": "mds-Scroller__header", "trailing": "mds-Scroller__trailing", "track": "mds-Scroller__track", "arrows": "mds-Scroller__arrows" };
1366
1342
  var STEP = 0.8;
@@ -1840,7 +1816,7 @@ function Container(props) {
1840
1816
  }
1841
1817
 
1842
1818
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Card/Card.module.css?mds-scoped
1843
- var Card_module_default = { "card": "mds-Card__card", "variant-raised": "mds-Card__variant-raised", "variant-sunken": "mds-Card__variant-sunken", "emphasis": "mds-Card__emphasis", "interactive": "mds-Card__interactive", "header": "mds-Card__header", "body": "mds-Card__body", "footer": "mds-Card__footer" };
1819
+ var Card_module_default = { "card": "mds-Card__card", "variant-raised": "mds-Card__variant-raised", "variant-sunken": "mds-Card__variant-sunken", "emphasis": "mds-Card__emphasis", "interactive": "mds-Card__interactive", "header": "mds-Card__header", "body": "mds-Card__body", "footer": "mds-Card__footer", "clipped": "mds-Card__clipped" };
1844
1820
  function Card({ children, variant = "card", emphasis = false, onClick, href, as, className, ref, ...rest }) {
1845
1821
  const cardClass = cx(Card_module_default.card, Card_module_default[`variant-${variant}`], emphasis && Card_module_default.emphasis, className);
1846
1822
  if (href !== void 0) {
@@ -1866,8 +1842,16 @@ function Card({ children, variant = "card", emphasis = false, onClick, href, as,
1866
1842
  function CardHeader({ className, ...rest }) {
1867
1843
  return /* @__PURE__ */ jsx("div", { className: cx(Card_module_default.header, className), ...rest });
1868
1844
  }
1869
- function CardBody({ className, ...rest }) {
1870
- return /* @__PURE__ */ jsx("div", { className: cx(Card_module_default.body, className), ...rest });
1845
+ function CardBody({ lines, className, style, ...rest }) {
1846
+ const vars = lines === void 0 ? void 0 : { "--card-lines": lines };
1847
+ return /* @__PURE__ */ jsx(
1848
+ "div",
1849
+ {
1850
+ className: cx(Card_module_default.body, lines !== void 0 && Card_module_default.clipped, className),
1851
+ style: { ...vars, ...style },
1852
+ ...rest
1853
+ }
1854
+ );
1871
1855
  }
1872
1856
  function CardFooter({ className, ...rest }) {
1873
1857
  return /* @__PURE__ */ jsx("div", { className: cx(Card_module_default.footer, className), ...rest });
@@ -2822,6 +2806,6 @@ function useRovingGroup(ref, { selector, orientation = "horizontal" }) {
2822
2806
  );
2823
2807
  }
2824
2808
 
2825
- export { AppBar, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Chip, ChipBar, ChipGroup, ConfirmDialog, Container, CountButton, DataTable, DateTimePicker, Divider, EmptyState, Field, FileDrop, Heading, Icon, IconProvider, ImageCarousel, Inline, Input, Lightbox, Link, ListGroup, ListItem, MediaPlaceholder, Modal, ModalBody, ModalFooter, ModalHeader, OverlayHistoryContext, PasswordInput, ProgressBar, Radio, Screen, ScreenContent, Scroller, SearchField, SegmentedControl, Select, Sheet, SheetBody, SheetFooter, SheetHeader, SideNav, SideNavGroup, SideNavItem, Skeleton, Spinner, Stack, Switch, Tab, TabBar, TabBarAction, TabBarItem, TabList, TabPanel, Tabs, Tag, Text, Textarea, ToastProvider, UploadProgress, VideoPlayer, VisuallyHidden, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
2809
+ export { AppBar, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Chip, ChipBar, ChipGroup, ConfirmDialog, Container, CountButton, DataTable, DateTimePicker, Divider, EmptyState, Field, FileDrop, Heading, Icon, IconProvider, ImageCarousel, Inline, Input, Lightbox, Link, ListGroup, ListItem, MediaPlaceholder, Modal, ModalBody, ModalFooter, ModalHeader, OverlayHistoryContext, PasswordInput, ProgressBar, Radio, Screen, ScreenContent, Scroller, SegmentedControl, Select, Sheet, SheetBody, SheetFooter, SheetHeader, SideNav, SideNavGroup, SideNavItem, Skeleton, Spinner, Stack, Switch, Tab, TabBar, TabBarAction, TabBarItem, TabList, TabPanel, Tabs, Tag, Text, Textarea, ToastProvider, UploadProgress, VideoPlayer, VisuallyHidden, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
2826
2810
  //# sourceMappingURL=index.js.map
2827
2811
  //# sourceMappingURL=index.js.map