@baseline-ui/core 0.44.0 → 0.44.2

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
@@ -2407,6 +2407,10 @@ interface I18nProviderProps$1 {
2407
2407
  /** The locale to apply to the children. */
2408
2408
  locale?: string;
2409
2409
  }
2410
+ /**
2411
+ * Returns the current locale and layout direction.
2412
+ */
2413
+ declare function useLocale(): Locale;
2410
2414
  interface DateFormatterOptions extends Intl.DateTimeFormatOptions {
2411
2415
  calendar?: string;
2412
2416
  }
@@ -2433,6 +2437,20 @@ interface TreeProps<T> extends CollectionStateBase<T>, Expandable, MultipleSelec
2433
2437
  /** Whether `disabledKeys` applies to all interactions, or only selection. */
2434
2438
  disabledBehavior?: DisabledBehavior;
2435
2439
  }
2440
+ interface TreeState<T> {
2441
+ /** A collection of items in the tree. */
2442
+ readonly collection: Collection<Node$1<T>>;
2443
+ /** A set of keys for items that are disabled. */
2444
+ readonly disabledKeys: Set<Key>;
2445
+ /** A set of keys for items that are expanded. */
2446
+ readonly expandedKeys: Set<Key>;
2447
+ /** Toggles the expanded state for an item by its key. */
2448
+ toggleKey(key: Key): void;
2449
+ /** Replaces the set of expanded keys. */
2450
+ setExpandedKeys(keys: Set<Key>): void;
2451
+ /** A selection manager to read and update multiple selection state. */
2452
+ readonly selectionManager: SelectionManager;
2453
+ }
2436
2454
 
2437
2455
  interface GridListProps$1<T> extends CollectionBase<T>, MultipleSelection {
2438
2456
  /** Whether to auto focus the gridlist or an option. */
@@ -3376,6 +3394,11 @@ interface AriaToolbarProps extends AriaLabelingProps {
3376
3394
  * @default 'horizontal'
3377
3395
  */
3378
3396
  orientation?: Orientation;
3397
+ /**
3398
+ * Allows tabbing through the toolbar's content when false.
3399
+ * @default true
3400
+ */
3401
+ isSingleTabStop?: boolean;
3379
3402
  }
3380
3403
 
3381
3404
  /*
@@ -19259,6 +19282,31 @@ declare function getOsSpecificKeyboardShortcutLabel(keyboardShortcut: string, us
19259
19282
  */
19260
19283
  declare const getPlainText: (text: string) => string;
19261
19284
 
19285
+ /**
19286
+ * Checks whether a given DOM node is inside an iframe.
19287
+ *
19288
+ * This function compares the node's owning document's `defaultView` to
19289
+ * `window.top`. If they're different, the node is inside an iframe. Handles
19290
+ * cross-origin iframes safely using try/catch.
19291
+ *
19292
+ * @param {Node} node - The DOM node to check.
19293
+ * @returns {boolean} `true` if the node is inside an iframe, `false` otherwise.
19294
+ * @see https://stackoverflow.com/a/326076
19295
+ */
19296
+ declare function isInIframe(el: Node): boolean;
19297
+
19298
+ /**
19299
+ * Checks whether a given node is inside a Shadow DOM.
19300
+ *
19301
+ * This function uses `getRootNode()` to determine if the node's root is a
19302
+ * `ShadowRoot`, which indicates that the node is part of a shadow tree.
19303
+ *
19304
+ * @param {Node} node - The DOM node to check.
19305
+ * @returns {boolean} `true` if the node is inside a Shadow DOM, `false`
19306
+ * otherwise.
19307
+ */
19308
+ declare function isInShadowDOM(element: Node | null | undefined): boolean;
19309
+
19262
19310
  interface ListHandle {
19263
19311
  /** Scrolls the listbox to the specified item. */
19264
19312
  scrollIntoView: (id: string, options?: ScrollIntoViewOptions) => void;
@@ -19408,18 +19456,6 @@ interface ActionButtonProps extends ActionButtonSharedProps {
19408
19456
 
19409
19457
  declare const ActionButton: React__default__default.ForwardRefExoticComponent<ActionButtonProps & React__default__default.RefAttributes<HTMLButtonElement>>;
19410
19458
 
19411
- interface DomNodeRendererProps extends StylingProps, Omit<PressHookProps, "ref"> {
19412
- /**
19413
- * The DOM node to render inside the component. If this is not provided, the
19414
- * component will render nothing. If this is provided, the component will
19415
- * render the DOM node inside a `div` component with `display` set to
19416
- * `contents`.
19417
- */
19418
- node: Node;
19419
- }
19420
-
19421
- declare const DomNodeRenderer: React__default__default.ForwardRefExoticComponent<DomNodeRendererProps & React__default__default.RefAttributes<HTMLDivElement>>;
19422
-
19423
19459
  interface ModalProps extends OverlayTriggerProps$1 {
19424
19460
  /** The contents of the modal. */
19425
19461
  children: React__default__default.ReactNode;
@@ -19568,6 +19604,91 @@ declare const PopoverTrigger: React__default__default.FC<PopoverTriggerProps>;
19568
19604
 
19569
19605
  declare const Popover: React__default__default.FC<PopoverProps>;
19570
19606
 
19607
+ type MenuOption = Omit<ListOption, "description"> & {
19608
+ keyboardShortcut?: string;
19609
+ };
19610
+ type MenuSection = Omit<ListSection, "children"> & {
19611
+ children: MenuOption[];
19612
+ };
19613
+ type MenuItem = MenuOption | MenuSection;
19614
+ type MenuPopoverProps = Pick<PopoverContentProps, "isNonModal" | "placement" | "shouldUpdatePosition" | "shouldFlip" | "boundaryElement" | "crossOffset" | "offset" | "portalContainer">;
19615
+ interface MenuProps extends MenuPopoverProps, MenuTriggerProps, Omit<AriaMenuProps<MenuItem>, "children">, Omit<AriaMenuTriggerProps, "type"> {
19616
+ /** The `className` property assigned to the root element of the component. */
19617
+ className?: string;
19618
+ /** The `className` property assigned to the content element of the component. */
19619
+ contentClassName?: string;
19620
+ /** The `className` property assigned to the item element of the component. */
19621
+ itemClassName?: string;
19622
+ /**
19623
+ * A list of items to render in the menu. Items have the following shape:
19624
+ *
19625
+ * ```ts
19626
+ * export type MenuOption = {
19627
+ * id: string;
19628
+ * label: string;
19629
+ * keyboardShortcut?: string;
19630
+ * icon?: React.FC<IconProps>;
19631
+ * };
19632
+ *
19633
+ * export type MenuSection = {
19634
+ * id: string;
19635
+ * title?: string;
19636
+ * type: "section";
19637
+ * children: MenuOption[];
19638
+ * };
19639
+ *
19640
+ * export type MenuItem = MenuOption | MenuSection;
19641
+ * ```
19642
+ */
19643
+ items: MenuItem[];
19644
+ /**
19645
+ * A function that renders the trigger element of the component. The default
19646
+ * implementation renders an `ActionButton` component.
19647
+ *
19648
+ * ```tsx
19649
+ * <Menu renderTrigger={({ buttonProps, ref }) => <ActionButton {...buttonProps} label="Label" ref={ref} />
19650
+ * ```
19651
+ */
19652
+ renderTrigger?: (options: {
19653
+ buttonProps: ActionButtonProps;
19654
+ ref: React__default__default.RefObject<HTMLButtonElement>;
19655
+ }) => React__default__default.ReactNode;
19656
+ /**
19657
+ * The label of the trigger element. This can be a string, a React node, or a
19658
+ * function that accepts a boolean indicating whether the menu is open.
19659
+ */
19660
+ triggerLabel?: React__default__default.ReactNode | ((isOpen: boolean) => React__default__default.ReactNode);
19661
+ }
19662
+
19663
+ declare const DefaultListOption: React__default__default.ForwardRefExoticComponent<DefaultListOptionProps & React__default__default.RefAttributes<HTMLLIElement>>;
19664
+ interface DefaultListOptionProps {
19665
+ item: Node$1<ListItem | MenuItem>;
19666
+ liProps: React__default__default.ComponentProps<"li">;
19667
+ labelProps: React__default__default.ComponentProps<"span">;
19668
+ isFocusVisible: boolean;
19669
+ isDisabled: boolean;
19670
+ isSelected: boolean;
19671
+ showSelectedIcon?: boolean;
19672
+ description?: string;
19673
+ descriptionProps?: React__default__default.ComponentProps<"span">;
19674
+ selectionMode?: "single" | "multiple";
19675
+ isFocused?: boolean;
19676
+ isPressed?: boolean;
19677
+ _state: ListState<ListItem> | TreeState<MenuItem>;
19678
+ }
19679
+
19680
+ interface DomNodeRendererProps extends StylingProps, Omit<PressHookProps, "ref"> {
19681
+ /**
19682
+ * The DOM node to render inside the component. If this is not provided, the
19683
+ * component will render nothing. If this is provided, the component will
19684
+ * render the DOM node inside a `div` component with `display` set to
19685
+ * `contents`.
19686
+ */
19687
+ node: Node;
19688
+ }
19689
+
19690
+ declare const DomNodeRenderer: React__default__default.ForwardRefExoticComponent<DomNodeRendererProps & React__default__default.RefAttributes<HTMLDivElement>>;
19691
+
19571
19692
  interface TooltipProps extends StylingProps, TooltipTriggerProps, AriaTooltipProps, Omit<AriaPositionProps, "overlayRef" | "targetRef" | "maxHeight" | "isOpen" | "arrowSize"> {
19572
19693
  /** The content of the tooltip. */
19573
19694
  text?: string;
@@ -19804,62 +19925,6 @@ interface PortalContainerProviderProps {
19804
19925
 
19805
19926
  declare const PortalContainerProvider: React__default__default.FC<PortalContainerProviderProps>;
19806
19927
 
19807
- type MenuOption = Omit<ListOption, "description"> & {
19808
- keyboardShortcut?: string;
19809
- };
19810
- type MenuSection = Omit<ListSection, "children"> & {
19811
- children: MenuOption[];
19812
- };
19813
- type MenuItem = MenuOption | MenuSection;
19814
- type MenuPopoverProps = Pick<PopoverContentProps, "isNonModal" | "placement" | "shouldUpdatePosition" | "shouldFlip" | "boundaryElement" | "crossOffset" | "offset" | "portalContainer">;
19815
- interface MenuProps extends MenuPopoverProps, MenuTriggerProps, Omit<AriaMenuProps<MenuItem>, "children">, Omit<AriaMenuTriggerProps, "type"> {
19816
- /** The `className` property assigned to the root element of the component. */
19817
- className?: string;
19818
- /** The `className` property assigned to the content element of the component. */
19819
- contentClassName?: string;
19820
- /** The `className` property assigned to the item element of the component. */
19821
- itemClassName?: string;
19822
- /**
19823
- * A list of items to render in the menu. Items have the following shape:
19824
- *
19825
- * ```ts
19826
- * export type MenuOption = {
19827
- * id: string;
19828
- * label: string;
19829
- * keyboardShortcut?: string;
19830
- * icon?: React.FC<IconProps>;
19831
- * };
19832
- *
19833
- * export type MenuSection = {
19834
- * id: string;
19835
- * title?: string;
19836
- * type: "section";
19837
- * children: MenuOption[];
19838
- * };
19839
- *
19840
- * export type MenuItem = MenuOption | MenuSection;
19841
- * ```
19842
- */
19843
- items: MenuItem[];
19844
- /**
19845
- * A function that renders the trigger element of the component. The default
19846
- * implementation renders an `ActionButton` component.
19847
- *
19848
- * ```tsx
19849
- * <Menu renderTrigger={({ buttonProps, ref }) => <ActionButton {...buttonProps} label="Label" ref={ref} />
19850
- * ```
19851
- */
19852
- renderTrigger?: (options: {
19853
- buttonProps: ActionButtonProps;
19854
- ref: React__default__default.RefObject<HTMLButtonElement>;
19855
- }) => React__default__default.ReactNode;
19856
- /**
19857
- * The label of the trigger element. This can be a string, a React node, or a
19858
- * function that accepts a boolean indicating whether the menu is open.
19859
- */
19860
- triggerLabel?: React__default__default.ReactNode | ((isOpen: boolean) => React__default__default.ReactNode);
19861
- }
19862
-
19863
19928
  declare const Menu: React__default__default.ForwardRefExoticComponent<MenuProps & React__default__default.RefAttributes<HTMLUListElement>>;
19864
19929
 
19865
19930
  interface LinkProps extends AriaLinkOptions, StylingProps {
@@ -20117,6 +20182,8 @@ interface I18nProviderProps extends I18nProviderProps$1 {
20117
20182
 
20118
20183
  declare const I18nProvider: React__default__default.FC<I18nProviderProps>;
20119
20184
 
20185
+ declare const directionVar: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
20186
+
20120
20187
  type NumberFormatProps = Parameters<typeof useNumberFormatter>[0] & {
20121
20188
  /** The number to format. */
20122
20189
  value: number;
@@ -20526,7 +20593,8 @@ interface ColorSwatchProps extends Omit<AriaColorSwatchProps, "colorName">, Styl
20526
20593
  tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
20527
20594
  /**
20528
20595
  * Whether the swatch is indeterminate. When this is `true`, the color related
20529
- * props will be ignored.
20596
+ * props will be ignored and indeterminate styles will be applied. This change
20597
+ * is only visual.
20530
20598
  *
20531
20599
  * @default false
20532
20600
  */
@@ -21161,13 +21229,25 @@ interface ToolbarProps extends StylingProps, AriaToolbarProps {
21161
21229
  */
21162
21230
  collapsibleMenuProps?: Omit<MenuProps, "items" | "onAction" | "placement" | "disabledKeys">;
21163
21231
  /**
21164
- * A function that renders a spacer element in the collapsible toolbar between
21165
- * the toolbar buttons and the menu trigger. This prop is only relevant when
21166
- * `isCollapsible` is true.
21232
+ * A boolean indicating whether to render a spacer element in the collapsible
21233
+ * toolbar between the toolbar buttons and the menu trigger. This prop is only
21234
+ * relevant when `isCollapsible` is true.
21167
21235
  */
21168
21236
  renderSpacer?: boolean;
21169
21237
  /** The callback to call when any key is pressed. */
21170
21238
  onKeyDown?: KeyboardProps["onKeyDown"];
21239
+ /**
21240
+ * When set to true, the toolbar will act as a normal toolbar and will not
21241
+ * contain the navigation within it when the user presses tab again.
21242
+ *
21243
+ * When set to false, the toolbar will allow for navigating through all
21244
+ * elements within it if the user presses tab, and move to the next focusable
21245
+ * element outside of the toolbar only after user navigates through all
21246
+ * elements within the toolbar.
21247
+ *
21248
+ * @default true
21249
+ */
21250
+ isSingleTabStop?: boolean;
21171
21251
  }
21172
21252
 
21173
21253
  declare const Toolbar: React__default__default.ForwardRefExoticComponent<ToolbarProps & React__default__default.RefAttributes<HTMLDivElement>>;
@@ -22682,5 +22762,5 @@ declare namespace reactStately {
22682
22762
  export type { Color };
22683
22763
  }
22684
22764
 
22685
- export { Accordion, AccordionItem, ActionButton, ActionGroup, ActionGroupItem, ActionIconButton, AlertDialog, AudioPlayer, Avatar, Box, ButtonSelect, Checkbox, ColorInput, ColorSwatch, ColorSwatchPicker, ComboBox, DateField, DateFormat, DeviceProvider, DeviceProviderContext, Dialog, DialogTitle, DomNodeRenderer, Drawer, Editor, FileUpload, FocusScope, Focusable, FrameProvider, FreehandCanvas, GlobalToastRegion, GridList, Group, I18nProvider, Icon, IconColorInput, IconColorInputButton, IconSelect, IconSlider, ImageDropZone, ImageGallery, InlineAlert, Link, ListBox, Markdown, Menu, MessageFormat, Modal, ModalClose, ModalContent, ModalTrigger, MotionGlobalConfig, NumberFormat, NumberInput, Pagination, Panel, PanelGroup, PanelResizeHandle, PointPicker, PointPickerContent, PointPickerDisplay, PointsVisualiser, Popover, PopoverContent, PopoverTrigger, Portal, PortalContainerProvider, Pressable, Preview, ProgressBar, ProgressSpinner, RadioGroup, Reaction, ScrollControlButton, SearchInput, Select, Separator, Slider, Switch, TabItem, Tabs, TagGroup, TaggedPagination, Text, TextInput, ThemeProvider, TimeField, ToastQueue, ToggleButton, ToggleIconButton, Toolbar, Tooltip, Transform, TreeView, reactAria as UNSAFE_aria, reactStately as UNSAFE_stately, VisuallyHidden, announce, calculateFontSizeToFitWidth, classNames, cleanKeyFromGlobImport, clearAnnouncer, defineMessages, destroyAnnouncer, disableAnimations, enableAnimations, filterDOMProps, filterTruthyValues, findFocusableElements, getAbsoluteBounds, getAbsolutePosition, getActiveElement, getHTMLElement, getOsSpecificKeyboardShortcutLabel, getOwnerDocument, getPlainText, getSvgPathFromStroke, getTextDimensions, invariant, isFocusableElement, isInputThatOpensKeyboard, isInsideOverlayContent, isRect, isUrl, lightenColor, mergeProps, mergeRefs, parseColor, useCollator, useDateFormatter, useDevice, useFocusRing, useFocusVisible, useI18n, useId, useImage, useInteractionModality, useIntersectionObserver, useIsFirstRender, useKeyboard, useLiveInteractionModality, useLocalStorage, useMutationObserver, useNumberFormatter, useObjectRef, usePointProximity, usePortalContainer, useResizeObserver, useTextSelection, useUndoRedo, useUserPreferences };
22765
+ export { Accordion, AccordionItem, ActionButton, ActionGroup, ActionGroupItem, ActionIconButton, AlertDialog, AudioPlayer, Avatar, Box, ButtonSelect, Checkbox, ColorInput, ColorSwatch, ColorSwatchPicker, ComboBox, DateField, DateFormat, DefaultListOption, DeviceProvider, DeviceProviderContext, Dialog, DialogTitle, DomNodeRenderer, Drawer, Editor, FileUpload, FocusScope, Focusable, FrameProvider, FreehandCanvas, GlobalToastRegion, GridList, Group, I18nProvider, Icon, IconColorInput, IconColorInputButton, IconSelect, IconSlider, ImageDropZone, ImageGallery, InlineAlert, Link, ListBox, Markdown, Menu, MessageFormat, Modal, ModalClose, ModalContent, ModalTrigger, MotionGlobalConfig, NumberFormat, NumberInput, Pagination, Panel, PanelGroup, PanelResizeHandle, PointPicker, PointPickerContent, PointPickerDisplay, PointsVisualiser, Popover, PopoverContent, PopoverTrigger, Portal, PortalContainerProvider, Pressable, Preview, ProgressBar, ProgressSpinner, RadioGroup, Reaction, ScrollControlButton, SearchInput, Select, Separator, Slider, Switch, TabItem, Tabs, TagGroup, TaggedPagination, Text, TextInput, ThemeProvider, TimeField, ToastQueue, ToggleButton, ToggleIconButton, Toolbar, Tooltip, Transform, TreeView, reactAria as UNSAFE_aria, reactStately as UNSAFE_stately, VisuallyHidden, announce, calculateFontSizeToFitWidth, classNames, cleanKeyFromGlobImport, clearAnnouncer, defineMessages, destroyAnnouncer, directionVar, disableAnimations, enableAnimations, filterDOMProps, filterTruthyValues, findFocusableElements, getAbsoluteBounds, getAbsolutePosition, getActiveElement, getHTMLElement, getOsSpecificKeyboardShortcutLabel, getOwnerDocument, getPlainText, getSvgPathFromStroke, getTextDimensions, invariant, isFocusableElement, isInIframe, isInShadowDOM, isInputThatOpensKeyboard, isInsideOverlayContent, isRect, isUrl, lightenColor, mergeProps, mergeRefs, parseColor, useCollator, useDateFormatter, useDevice, useFocusRing, useFocusVisible, useI18n, useId, useImage, useInteractionModality, useIntersectionObserver, useIsFirstRender, useKeyboard, useLiveInteractionModality, useLocalStorage, useLocale, useMutationObserver, useNumberFormatter, useObjectRef, usePointProximity, usePortalContainer, useResizeObserver, useTextSelection, useUndoRedo, useUserPreferences };
22686
22766
  export type { AccordionItemProps, AccordionProps, ActionButtonProps, ActionGroupProps, ActionIconButtonProps, AlertDialogProps, Assertiveness, AudioPlayerProps, AvatarProps, BlockProps, BoxProps, ButtonSelectProps, CheckboxProps, ColorInputProps, ColorPreset, ColorSwatchPickerProps, ColorSwatchProps, ComboBoxProps, DateFieldProps, DateFormatProps, Device, DeviceProviderProps, DialogProps, DialogTitleProps, DomNodeRendererProps, DrawerProps, EditorHandle, EditorProps, FileUploadProps, FocusableProps, FrameProviderProps, FreehandCanvasProps, GridListProps, GroupProps, I18nProviderProps, I18nResult, IconColorInputProps, IconComponentProps$1 as IconComponentProps, IconProps, IconSelectProps, IconSliderProps, ImageDropZoneProps, ImageGalleryProps, ImperativePanelGroupHandle, ImperativePanelHandle, InlineAlertProps, Key, LinkProps, ListBoxProps, ListHandle, ListOption, MarkdownProps, MenuItem, MenuProps, Message, MessageDescriptor, MessageFormatProps, MessageFormatter, ModalContentProps, ModalProps, NumberFormatProps, NumberInputProps, PaginationProps, PanelGroupProps, PanelProps, PanelResizeHandleProps, PointPickerContentProps, PointPickerDisplayProps, PointPickerProps, PointsVisualiserProps, PopoverContentProps, PopoverProps, PopoverTriggerProps, PortalProps, PressEvent, PreviewProps, ProgressBarProps, ProgressSpinnerProps, RadioGroupProps, ReactComplexTreeItem, ReactionProps, Rect, SVGRProps, ScrollControlButtonProps, SearchInputProps, SelectProps, SeparatorProps, SliderProps, StylingProps, SwitchProps, TabItemProps, TabsProps, TagGroupProps, TaggedPaginationProps, TextInputProps, TextProps, ThemeProviderProps, TimeFieldProps, ToastProps, ToggleButtonProps, ToggleIconButtonProps, ToolbarProps, TooltipProps, TransformProps, TreeViewProps };