@baseline-ui/core 0.32.0 → 0.33.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/index.d.ts CHANGED
@@ -4,9 +4,9 @@ import { IconProps, SVGRProps } from '@baseline-ui/icons';
4
4
  import * as react_stately from 'react-stately';
5
5
  import { DraggableCollectionStateOptions, DroppableCollectionStateOptions, Orientation, ListState, OverlayTriggerProps, OverlayTriggerState, TooltipTriggerProps, SliderStateOptions, ToggleProps, MenuTriggerProps, NumberFieldStateOptions, ListProps, SelectStateOptions, Item as Item$2, Selection as Selection$1, ComboBoxStateOptions, Node as Node$2, TreeProps } from 'react-stately';
6
6
  import * as react_aria from 'react-aria';
7
- import { DraggableCollectionOptions, DroppableCollectionOptions, AriaListBoxProps, AriaListBoxOptions, OptionAria, AriaButtonProps, AriaPopoverProps, useOverlayTrigger, AriaTooltipProps, AriaPositionProps, AriaSliderProps, AriaSwitchProps, AriaSearchFieldProps, AriaMenuProps, AriaMenuTriggerProps, AriaLinkOptions, SeparatorProps as SeparatorProps$1, AriaProgressBarProps, AriaTextFieldProps, OverlayProps, AriaToggleButtonProps, AriaCheckboxProps, AriaNumberFieldProps, I18nProviderProps as I18nProviderProps$1, LocalizedStrings, useNumberFormatter, useDateFormatter, AriaTagGroupProps, AriaSelectOptions, Key as Key$1, AriaDialogProps, DropOptions, ClipboardProps, PressProps, AriaRadioGroupProps, AriaModalOverlayProps, AriaComboBoxOptions, AriaComboBoxProps, AriaGridListOptions, GridListItemAria, Locale } from 'react-aria';
7
+ import { DraggableCollectionOptions, DroppableCollectionOptions, AriaListBoxProps, AriaListBoxOptions, OptionAria, AriaButtonProps, AriaPopoverProps, useOverlayTrigger, AriaTooltipProps, AriaPositionProps, FocusableOptions, AriaSliderProps, AriaSwitchProps, AriaSearchFieldProps, AriaMenuProps, AriaMenuTriggerProps, AriaLinkOptions, SeparatorProps as SeparatorProps$1, AriaProgressBarProps, AriaTextFieldProps, OverlayProps, AriaToggleButtonProps, AriaCheckboxProps, AriaNumberFieldProps, I18nProviderProps as I18nProviderProps$1, LocalizedStrings, useNumberFormatter, useDateFormatter, AriaTagGroupProps, AriaSelectOptions, Key as Key$1, AriaDialogProps, DropOptions, ClipboardProps, PressProps, AriaRadioGroupProps, AriaModalOverlayProps, AriaComboBoxOptions, AriaComboBoxProps, AriaGridListOptions, GridListItemAria, Locale } from 'react-aria';
8
8
  export { I18nProviderProps, useCollator, useDateFormatter, useNumberFormatter } from 'react-aria';
9
- import { Node as Node$1, DragItem, DOMAttributes, AriaLabelingProps, AriaValidationProps, DOMProps } from '@react-types/shared';
9
+ import { Node as Node$1, DragItem, FocusableElement, DOMAttributes, AriaLabelingProps, AriaValidationProps, DOMProps } from '@react-types/shared';
10
10
  import { PressHookProps, KeyboardProps } from '@react-aria/interactions';
11
11
  import { Theme, Sprinkles } from '@baseline-ui/tokens';
12
12
  import { AriaTabListProps } from '@react-types/tabs';
@@ -110,6 +110,13 @@ interface ListHandle {
110
110
  /** Imperatively focuses the specified key */
111
111
  setFocusedKey: (key: string) => void;
112
112
  }
113
+ interface UIState {
114
+ isFocusVisible: boolean;
115
+ isSelected: boolean;
116
+ isFocused: boolean;
117
+ isDisabled: boolean;
118
+ isPressed: boolean;
119
+ }
113
120
  interface ListBoxProps extends StylingProps, Omit<AriaListBoxProps<ListItem> & AriaListBoxOptions<ListItem>, "children" | "linkBehavior" | "isVirtualized" | "keyboardDelegate" | "items">, Omit<DragAndDropProps, "preview" | "enableReorder" | "orientation" | "layout">, Partial<Pick<DragAndDropProps, "enableReorder" | "orientation" | "layout">> {
114
121
  /**
115
122
  * The items to render in the listbox. Items have the following shape:
@@ -172,11 +179,11 @@ interface ListBoxProps extends StylingProps, Omit<AriaListBoxProps<ListItem> & A
172
179
  /** The style of the drop indicator used in a component. */
173
180
  dropIndicatorStyle?: React__default.CSSProperties;
174
181
  /** The CSS class name for the option. */
175
- optionClassName?: string | ((item: ListOption) => string | undefined);
182
+ optionClassName?: string | ((item: ListOption, state: UIState) => string | undefined);
176
183
  /** The CSS class name for the section. */
177
184
  sectionClassName?: string | ((item: ListSection) => string | undefined);
178
185
  /** The style of the option. */
179
- optionStyle?: React__default.CSSProperties | ((item: ListOption) => React__default.CSSProperties | undefined);
186
+ optionStyle?: React__default.CSSProperties | ((item: ListOption, state: UIState) => React__default.CSSProperties | undefined);
180
187
  /** The style of the section. */
181
188
  sectionStyle?: React__default.CSSProperties | ((item: ListSection) => React__default.CSSProperties | undefined);
182
189
  /**
@@ -356,9 +363,21 @@ interface TooltipProps extends StylingProps, TooltipTriggerProps, AriaTooltipPro
356
363
  */
357
364
  portalContainer?: HTMLElement;
358
365
  }
366
+ interface FocusableProps extends FocusableOptions, StylingProps {
367
+ /** The content of the focusable element. */
368
+ children: React__default.ReactNode;
369
+ /**
370
+ * The element type to render.
371
+ *
372
+ * @default "div"
373
+ */
374
+ elementType?: keyof React__default.ReactHTML;
375
+ }
359
376
 
360
377
  declare const Tooltip: React__default.ForwardRefExoticComponent<TooltipProps & React__default.RefAttributes<HTMLDivElement>>;
361
378
 
379
+ declare const Focusable: React__default.ForwardRefExoticComponent<FocusableProps & React__default.RefAttributes<FocusableElement>>;
380
+
362
381
  interface IconComponentProps {
363
382
  /** The icon to show at the start of the color input. */
364
383
  icon?: React__default.FC<IconProps>;
@@ -733,6 +752,8 @@ interface ActionIconButtonProps extends ActionButtonSharedProps {
733
752
  * @default false
734
753
  */
735
754
  tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
755
+ /** The drag props to use for drag and drop interactions. */
756
+ dragProps?: React__default.HTMLAttributes<HTMLElement>;
736
757
  }
737
758
 
738
759
  declare const ActionIconButton: React__default.ForwardRefExoticComponent<ActionIconButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
@@ -2200,6 +2221,7 @@ interface Item {
2200
2221
  src?: string;
2201
2222
  alt?: string;
2202
2223
  }
2224
+ declare type ClassName = string | ((item: Item, state: UIState) => string | undefined);
2203
2225
  declare type Dimension = {
2204
2226
  width: number | "sm" | "md";
2205
2227
  height: number;
@@ -2277,11 +2299,11 @@ interface ImageGalleryProps extends StylingProps, Omit<ListBoxProps, "items" | "
2277
2299
  /** A callback that is called when a key is pressed. */
2278
2300
  onKeyDown?: (event: React__default.KeyboardEvent<HTMLDivElement>) => void;
2279
2301
  /** ClassName for each item container */
2280
- imageContainerClassName?: string;
2302
+ imageContainerClassName?: ClassName;
2281
2303
  /** ClassName for each item image */
2282
- imageClassName?: string;
2304
+ imageClassName?: ClassName;
2283
2305
  /** ClassName for each item image label */
2284
- labelClassName?: string;
2306
+ labelClassName?: ClassName;
2285
2307
  /** A callback that is called to render the image. */
2286
2308
  renderImage?: (item: ListOption<Pick<Item, "alt" | "src">>, options: {
2287
2309
  deleteElement?: React__default.ReactElement;
@@ -2424,6 +2446,11 @@ interface ComboBoxProps extends StylingProps, Omit<AriaComboBoxOptions<ListItem>
2424
2446
  maxValue?: number;
2425
2447
  /** Listener to call when the input value is submitted */
2426
2448
  onInputSubmit?: (value: string) => void;
2449
+ /** Listener to call when the selected value changes */
2450
+ onValueChange?: (option: {
2451
+ value?: string;
2452
+ key?: string | null;
2453
+ }) => void;
2427
2454
  }
2428
2455
 
2429
2456
  declare const ComboBox: React__default.ForwardRefExoticComponent<ComboBoxProps & React__default.RefAttributes<HTMLDivElement>>;
@@ -2443,11 +2470,18 @@ interface ColorSwatchProps extends Omit<AriaColorSwatchProps, "colorName">, Styl
2443
2470
  * disabled styles.
2444
2471
  */
2445
2472
  isDisabled?: boolean;
2473
+ /**
2474
+ * Whether to show a tooltip. You can pass a boolean or a partial tooltip
2475
+ * object that extends the default tooltip props.
2476
+ *
2477
+ * @default false
2478
+ */
2479
+ tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
2446
2480
  }
2447
2481
 
2448
2482
  declare const ColorSwatch: React__default.ForwardRefExoticComponent<ColorSwatchProps & React__default.RefAttributes<HTMLDivElement>>;
2449
2483
 
2450
- declare type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGridListOptions<ListOption> & {
2484
+ declare type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGridListOptions<ListOption> & Partial<Pick<DragAndDropProps, "enableReorder" | "orientation" | "layout" | "onReorder">> & {
2451
2485
  /**
2452
2486
  * The items to render in the grid list. Items have the following shape:
2453
2487
  *
@@ -2493,12 +2527,24 @@ declare type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGri
2493
2527
  * />;
2494
2528
  * ```
2495
2529
  *
2530
+ * The `dragHandleProps` property in the options object is used to pass
2531
+ * props to the drag handle rendered in the grid item. This property is
2532
+ * `undefined` when the grid list is not reorderable.
2533
+ *
2534
+ * DragProps: Props to apply to the drag handle element. dragButtonProps:
2535
+ * Props to apply to the custom drag button element in case the drag
2536
+ * handle is a button and not the whole row.
2537
+ *
2496
2538
  * @param item
2497
2539
  * @param options
2498
2540
  * @param ref
2499
2541
  */
2500
2542
  renderGridItem: (item: Node$1<ListOption>, options: GridListItemAria & {
2501
2543
  checkBoxProps?: CheckboxProps;
2544
+ dragHandleProps?: {
2545
+ dragProps: React__default.HTMLAttributes<HTMLElement>;
2546
+ dragButtonProps: AriaButtonProps;
2547
+ };
2502
2548
  }, ref: React__default.Ref<HTMLLIElement>) => React__default.ReactElement;
2503
2549
  /**
2504
2550
  * Enables editing mode which disables keydown event capturing, useful
@@ -2556,7 +2602,7 @@ interface ActionGroupItemProps extends Pick<ActionGroupProps, "tooltipProps" | "
2556
2602
  state: ListState<ListItem>;
2557
2603
  }
2558
2604
 
2559
- interface ColorSwatchPickerProps extends StylingProps, Pick<RadioGroupProps, "optionsContainerClassName" | "labelPosition">, Pick<ListBoxProps, "optionClassName" | "optionStyle">, AriaLabelingProps {
2605
+ interface ColorSwatchPickerProps extends StylingProps, Pick<RadioGroupProps, "optionsContainerClassName" | "labelPosition">, Pick<ListBoxProps, "optionClassName" | "optionStyle" | "shouldFocusWrap">, AriaLabelingProps {
2560
2606
  /**
2561
2607
  * The items to display in the picker. Each item should have a `color` and a
2562
2608
  * `label`.
@@ -3105,4 +3151,4 @@ declare type Device = ReturnType<typeof useDevice>;
3105
3151
  */
3106
3152
  declare function usePortalContainer(_portalContainer?: HTMLElement): HTMLElement | undefined;
3107
3153
 
3108
- export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, ActionButton, type ActionButtonProps, ActionGroup, ActionGroupItem, type ActionGroupProps, ActionIconButton, type ActionIconButtonProps, AlertDialog, type AlertDialogProps, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, type BlockProps, Box, type BoxProps, ButtonSelect, type ButtonSelectProps, Checkbox, type CheckboxProps, ColorInput, type ColorInputProps, type ColorPreset, ColorSwatch, ColorSwatchPicker, type ColorSwatchPickerProps, type ColorSwatchProps, ComboBox, type ComboBoxProps, DateFormat, type DateFormatProps, type Device, Dialog, type DialogProps, DialogTitle, type DialogTitleProps, DomNodeRenderer, type DomNodeRendererProps, Drawer, type DrawerProps, Editor, type EditorHandle, type EditorProps, FileUpload, type FileUploadProps, FreehandCanvas, type FreehandCanvasProps, GridList, type GridListProps, Group, type GroupProps, I18nProvider, type I18nResult, IconColorInput, IconColorInputButton, type IconColorInputProps, IconSelect, type IconSelectProps, IconSlider, type IconSliderProps, ImageDropZone, type ImageDropZoneProps, ImageGallery, type ImageGalleryProps, type ImperativePanelGroupHandle, type ImperativePanelHandle, InlineAlert, type InlineAlertProps, Link, type LinkProps, ListBox, type ListBoxProps, type ListHandle, type ListOption, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, type MessageDescriptor, MessageFormat, type MessageFormatProps, Modal, ModalClose, ModalContent, type ModalContentProps, type ModalProps, ModalTrigger, NumberFormat, type NumberFormatProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, Panel, PanelGroup, type PanelGroupProps, type PanelProps, PanelResizeHandle, type PanelResizeHandleProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type PopoverTriggerProps, Portal, PortalContainerProvider, type PortalProps, Preview, type PreviewProps, ProgressBar, type ProgressBarProps, ProgressSpinner, type ProgressSpinnerProps, RadioGroup, type RadioGroupProps, type ReactComplexTreeItem, Reaction, type ReactionProps, type Rect, ScrollControlButton, type ScrollControlButtonProps, SearchInput, type SearchInputProps, Select, type SelectProps, Separator, type SeparatorProps, Slider, type SliderProps, type StylingProps, Switch, type SwitchProps, TabItem, type TabItemProps, Tabs, type TabsProps, TagGroup, type TagGroupProps, Text, TextInput, type TextInputProps, type TextProps, ThemeProvider, type ThemeProviderProps, ToggleButton, type ToggleButtonProps, ToggleIconButton, type ToggleIconButtonProps, Toolbar, type ToolbarProps, Tooltip, type TooltipProps, Transform, type TransformProps, Transition, type TransitionProps, TreeView, type TreeViewProps, defineMessages, isInsideOverlayContent, isRect, useDevice, useI18n, useImage, useIntersectionObserver, useIsFirstRender, useLocalStorage, useMutationObserver, usePortalContainer, useResizeObserver, useTextSelection, useUndoRedo, useUserPreferences };
3154
+ export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, ActionButton, type ActionButtonProps, ActionGroup, ActionGroupItem, type ActionGroupProps, ActionIconButton, type ActionIconButtonProps, AlertDialog, type AlertDialogProps, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, type BlockProps, Box, type BoxProps, ButtonSelect, type ButtonSelectProps, Checkbox, type CheckboxProps, ColorInput, type ColorInputProps, type ColorPreset, ColorSwatch, ColorSwatchPicker, type ColorSwatchPickerProps, type ColorSwatchProps, ComboBox, type ComboBoxProps, DateFormat, type DateFormatProps, type Device, Dialog, type DialogProps, DialogTitle, type DialogTitleProps, DomNodeRenderer, type DomNodeRendererProps, Drawer, type DrawerProps, Editor, type EditorHandle, type EditorProps, FileUpload, type FileUploadProps, Focusable, type FocusableProps, FreehandCanvas, type FreehandCanvasProps, GridList, type GridListProps, Group, type GroupProps, I18nProvider, type I18nResult, IconColorInput, IconColorInputButton, type IconColorInputProps, IconSelect, type IconSelectProps, IconSlider, type IconSliderProps, ImageDropZone, type ImageDropZoneProps, ImageGallery, type ImageGalleryProps, type ImperativePanelGroupHandle, type ImperativePanelHandle, InlineAlert, type InlineAlertProps, Link, type LinkProps, ListBox, type ListBoxProps, type ListHandle, type ListOption, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, type MessageDescriptor, MessageFormat, type MessageFormatProps, Modal, ModalClose, ModalContent, type ModalContentProps, type ModalProps, ModalTrigger, NumberFormat, type NumberFormatProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, Panel, PanelGroup, type PanelGroupProps, type PanelProps, PanelResizeHandle, type PanelResizeHandleProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type PopoverTriggerProps, Portal, PortalContainerProvider, type PortalProps, Preview, type PreviewProps, ProgressBar, type ProgressBarProps, ProgressSpinner, type ProgressSpinnerProps, RadioGroup, type RadioGroupProps, type ReactComplexTreeItem, Reaction, type ReactionProps, type Rect, ScrollControlButton, type ScrollControlButtonProps, SearchInput, type SearchInputProps, Select, type SelectProps, Separator, type SeparatorProps, Slider, type SliderProps, type StylingProps, Switch, type SwitchProps, TabItem, type TabItemProps, Tabs, type TabsProps, TagGroup, type TagGroupProps, Text, TextInput, type TextInputProps, type TextProps, ThemeProvider, type ThemeProviderProps, ToggleButton, type ToggleButtonProps, ToggleIconButton, type ToggleIconButtonProps, Toolbar, type ToolbarProps, Tooltip, type TooltipProps, Transform, type TransformProps, Transition, type TransitionProps, TreeView, type TreeViewProps, defineMessages, isInsideOverlayContent, isRect, useDevice, useI18n, useImage, useIntersectionObserver, useIsFirstRender, useLocalStorage, useMutationObserver, usePortalContainer, useResizeObserver, useTextSelection, useUndoRedo, useUserPreferences };