@baseline-ui/core 0.39.0 → 0.40.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.ts CHANGED
@@ -5,14 +5,14 @@ import * as react_aria from 'react-aria';
5
5
  import { 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, AriaTimeFieldProps, TimeValue, AriaDateFieldProps, DateValue, FocusProps, KeyboardProps as KeyboardProps$1, PressEvent, Locale } from 'react-aria';
6
6
  export { I18nProviderProps, useCollator, useDateFormatter, useNumberFormatter } from 'react-aria';
7
7
  import { DraggableCollectionStateOptions, DroppableCollectionStateOptions, Orientation, ListState, OverlayTriggerState, OverlayTriggerProps, TooltipTriggerProps, SliderStateOptions, ToggleProps, MenuTriggerProps, NumberFieldStateOptions, ListProps, SelectStateOptions, Item as Item$2, Selection as Selection$1, ComboBoxStateOptions, Node as Node$2, TimeFieldStateOptions, TreeProps, DateFieldStateOptions } from 'react-stately';
8
- import { Node as Node$1, DragItem, FocusableElement, DOMAttributes, AriaLabelingProps, AriaValidationProps, DOMProps } from '@react-types/shared';
8
+ import { Node as Node$1, DragItem, DOMAttributes, FocusableElement, DOMProps, AriaLabelingProps, AriaValidationProps } from '@react-types/shared';
9
9
  import { PressHookProps, KeyboardProps } from '@react-aria/interactions';
10
10
  import { AriaTabListProps } from '@react-types/tabs';
11
+ import { AriaColorSwatchProps } from '@react-aria/color';
11
12
  import { ColorFieldProps, Color } from '@react-stately/color';
12
13
  import { OnRender, OnRenderStart, OnDragStart, OnDrag, OnDragEnd, OnResizeStart, OnResize, OnResizeEnd, OnRotateStart, OnRotate, OnRotateEnd, OnSnap, RotationPosition } from 'react-moveable';
13
14
  import { Theme, Sprinkles } from '@baseline-ui/tokens';
14
15
  import { AriaToolbarProps } from '@react-aria/toolbar';
15
- import { AriaColorSwatchProps } from '@react-aria/color';
16
16
  import { AriaActionGroupProps } from '@react-aria/actiongroup';
17
17
  import { TreeItem } from 'react-complex-tree';
18
18
  import { PanelProps as PanelProps$1, ImperativePanelHandle as ImperativePanelHandle$1, PanelGroupProps as PanelGroupProps$1, ImperativePanelGroupHandle as ImperativePanelGroupHandle$1, PanelResizeHandleProps as PanelResizeHandleProps$1 } from 'react-resizable-panels';
@@ -337,7 +337,10 @@ interface TooltipProps extends StylingProps, TooltipTriggerProps, AriaTooltipPro
337
337
  /** The content of the tooltip. */
338
338
  text?: string;
339
339
  /** The tooltip trigger element. */
340
- children: React__default.ReactNode;
340
+ children: React__default.ReactNode | ((props: {
341
+ triggerProps: DOMAttributes;
342
+ triggerRef: React__default.RefObject<HTMLElement>;
343
+ }) => React__default.ReactNode);
341
344
  /**
342
345
  * The delay time for the tooltip to show up.
343
346
  *
@@ -391,13 +394,53 @@ declare const Tooltip: React__default.ForwardRefExoticComponent<TooltipProps & R
391
394
 
392
395
  declare const Focusable: React__default.ForwardRefExoticComponent<FocusableProps & React__default.RefAttributes<FocusableElement>>;
393
396
 
397
+ interface ActionIconButtonProps extends ActionButtonSharedProps {
398
+ /** The icon to display */
399
+ icon: React__default.FC<IconProps>;
400
+ /**
401
+ * The size of the icon button.
402
+ *
403
+ * @default "md"
404
+ */
405
+ size?: "xxs" | "xs" | "sm" | "md" | "lg";
406
+ /**
407
+ * The variant of the icon button.
408
+ *
409
+ * @default "primary"
410
+ */
411
+ variant?: "primary" | "secondary" | "tertiary" | "ghost" | "toolbar" | "popover";
412
+ /** Indicates whether focusing should be prevented on press. */
413
+ preventFocusOnPress?: boolean;
414
+ /**
415
+ * Whether to show a tooltip. You can pass a boolean or a partial tooltip
416
+ * object that extends the default tooltip props.
417
+ *
418
+ * @default false
419
+ */
420
+ tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
421
+ /** The drag props to use for drag and drop interactions. */
422
+ dragProps?: React__default.HTMLAttributes<HTMLElement>;
423
+ }
424
+
425
+ declare const ActionIconButton: React__default.ForwardRefExoticComponent<ActionIconButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
426
+
394
427
  interface IconComponentProps {
395
428
  /** The icon to show at the start of the color input. */
396
429
  icon?: React__default.FC<IconProps>;
397
430
  /** The aria label for the color input button. */
398
431
  "aria-label": string;
399
- /** Props to pass to the tooltip component. */
400
- tooltipProps?: Omit<TooltipProps, "variant" | "size" | "includeArrow" | "children">;
432
+ /**
433
+ * Whether to show the tooltip on the main element.
434
+ *
435
+ * @default true
436
+ */
437
+ tooltip?: ActionIconButtonProps["tooltip"];
438
+ /**
439
+ * Whether to show the tooltip on the icon.
440
+ *
441
+ * @default true
442
+ */
443
+ iconTooltip?: ActionIconButtonProps["tooltip"];
401
444
  }
402
445
 
403
446
  interface SliderProps extends Omit<AriaSliderProps<number> & SliderStateOptions<number>, "orientation" | "numberFormatter">, StylingProps {
@@ -769,36 +812,6 @@ interface ProgressSpinnerProps extends Omit<AriaProgressBarProps, "value" | "isI
769
812
 
770
813
  declare const ProgressSpinner: React__default.ForwardRefExoticComponent<ProgressSpinnerProps & React__default.RefAttributes<HTMLDivElement>>;
771
814
 
772
- interface ActionIconButtonProps extends ActionButtonSharedProps {
773
- /** The icon to display */
774
- icon: React__default.FC<IconProps>;
775
- /**
776
- * The size of the icon button.
777
- *
778
- * @default "md"
779
- */
780
- size?: "xxs" | "xs" | "sm" | "md" | "lg";
781
- /**
782
- * The variant of the icon button.
783
- *
784
- * @default "primary"
785
- */
786
- variant?: "primary" | "secondary" | "tertiary" | "ghost" | "toolbar" | "popover";
787
- /** Indicates whether focusing should be prevented on press. */
788
- preventFocusOnPress?: boolean;
789
- /**
790
- * Whether to show a tooltip. You can pass a boolean or a partial tooltip
791
- * object that extends the default tooltip props.
792
- *
793
- * @default false
794
- */
795
- tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
796
- /** The drag props to use for drag and drop interactions. */
797
- dragProps?: React__default.HTMLAttributes<HTMLElement>;
798
- }
799
-
800
- declare const ActionIconButton: React__default.ForwardRefExoticComponent<ActionIconButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
801
-
802
815
  interface ToggleButtonProps extends Omit<StylingProps, "style" | "className">, Omit<AriaToggleButtonProps, "children">, StylingWithUIState<{
803
816
  isSelected?: boolean;
804
817
  }> {
@@ -1261,11 +1274,51 @@ declare const Dialog: React__default.ForwardRefExoticComponent<DialogProps & Rea
1261
1274
 
1262
1275
  declare const DialogTitle: React__default.ForwardRefExoticComponent<DialogTitleProps & React__default.RefAttributes<HTMLDivElement>>;
1263
1276
 
1277
+ interface ColorSwatchProps extends Omit<AriaColorSwatchProps, "colorName">, StylingProps, DOMProps, AriaLabelingProps {
1278
+ /** Whether the swatch is focused by keyboard. */
1279
+ isFocusVisible?: boolean;
1280
+ /** Whether the swatch is selected. */
1281
+ isSelected?: boolean;
1282
+ /**
1283
+ * Whether the swatch is interactive. This is used to determine whether to
1284
+ * show hover styles.
1285
+ */
1286
+ isInteractive?: boolean;
1287
+ /**
1288
+ * Whether the swatch is disabled. This is used to determine whether to show
1289
+ * disabled styles.
1290
+ */
1291
+ isDisabled?: boolean;
1292
+ /**
1293
+ * Whether to show a tooltip. You can pass a boolean or a partial tooltip
1294
+ * object that extends the default tooltip props.
1295
+ *
1296
+ * @default false
1297
+ */
1298
+ tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
1299
+ /**
1300
+ * Whether the swatch is indeterminate. When this is `true`, the color related
1301
+ * props will be ignored.
1302
+ *
1303
+ * @default false
1304
+ */
1305
+ isIndeterminate?: boolean;
1306
+ /**
1307
+ * The icon to display when the swatch is indeterminate. The icon should be a
1308
+ * 16x16px icon to ensure consistency with the design system.
1309
+ *
1310
+ * @default HelpIcon
1311
+ */
1312
+ indeterminateIcon?: React__default.FC<IconProps> | null;
1313
+ }
1314
+
1315
+ declare const ColorSwatch: React__default.ForwardRefExoticComponent<ColorSwatchProps & React__default.RefAttributes<HTMLDivElement>>;
1316
+
1264
1317
  interface ColorPreset {
1265
1318
  label: string;
1266
1319
  color: string;
1267
1320
  }
1268
- interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorFieldProps, "onChange" | "defaultValue" | "value" | "label" | "isDisabled">, Pick<AriaLabelingProps, "aria-label">, Pick<PopoverContentProps, "isNonModal" | "placement" | "shouldUpdatePosition" | "shouldFlip" | "boundaryElement" | "crossOffset" | "offset" | "portalContainer"> {
1321
+ interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorFieldProps, "onChange" | "defaultValue" | "value" | "label" | "isDisabled">, Pick<AriaLabelingProps, "aria-label">, Pick<PopoverContentProps, "isNonModal" | "placement" | "shouldUpdatePosition" | "shouldFlip" | "boundaryElement" | "crossOffset" | "offset" | "portalContainer">, Pick<ColorSwatchProps, "isIndeterminate" | "indeterminateIcon"> {
1269
1322
  /**
1270
1323
  * The list of color presets to show in the color picker. The signature of the
1271
1324
  * color presets is:
@@ -1298,7 +1351,9 @@ interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorF
1298
1351
  *
1299
1352
  * @default true
1300
1353
  */
1301
- colorLabel?: boolean | ((color: Color | null) => string);
1354
+ colorLabel?: boolean | ((color: Color | null, options: {
1355
+ isIndeterminate: boolean;
1356
+ }) => string);
1302
1357
  /**
1303
1358
  * Whether to allow alpha values in the custom color picker.
1304
1359
  *
@@ -1360,13 +1415,19 @@ interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorF
1360
1415
  colorName?: string | boolean;
1361
1416
  triggerProps: AriaButtonProps<"button">;
1362
1417
  labelId?: string;
1363
- }) => React__default.ReactElement;
1418
+ } & Pick<ColorSwatchProps, "isIndeterminate" | "indeterminateIcon">) => React__default.ReactElement;
1364
1419
  /**
1365
1420
  * Handler that is called when the user stops dragging or clicking on the
1366
1421
  * color picker. In case of presets, this is called when the user clicks on a
1367
1422
  * color preset.
1368
1423
  */
1369
1424
  onChangeEnd?: (color: Color | null) => void;
1425
+ /**
1426
+ * Whether the color input is indeterminate.
1427
+ *
1428
+ * @default false
1429
+ */
1430
+ isIndeterminate?: boolean;
1370
1431
  }
1371
1432
  interface IconColorInputProps extends StylingProps, Omit<ColorInputProps, "renderTriggerButton" | "colorLabel" | "label" | "labelPosition" | "aria-label">, IconComponentProps {
1372
1433
  /**
@@ -1383,12 +1444,13 @@ declare const IconColorInputButton: React__default.ForwardRefExoticComponent<Omi
1383
1444
  icon: React__default.FC<IconProps>;
1384
1445
  color?: string | null;
1385
1446
  } & React__default.RefAttributes<HTMLButtonElement>>;
1386
- interface ColorInputButtonProps extends Omit<ActionButtonProps, "label" | "className" | "style">, StylingProps, Pick<ColorInputProps, "colorLabel"> {
1447
+ interface ColorInputButtonProps extends Omit<ActionButtonProps, "label" | "className" | "style">, StylingProps, Pick<ColorInputProps, "colorLabel">, Pick<ColorSwatchProps, "isIndeterminate" | "indeterminateIcon"> {
1387
1448
  isOpen: boolean;
1388
1449
  "aria-label"?: string;
1389
1450
  labelPosition?: "top" | "start";
1390
1451
  color: Color | null;
1391
1452
  colorName?: string | boolean;
1453
+ isIndeterminate?: boolean;
1392
1454
  }
1393
1455
 
1394
1456
  declare const IconColorInput: React__default.ForwardRefExoticComponent<IconColorInputProps & React__default.RefAttributes<HTMLDivElement>>;
@@ -1826,6 +1888,16 @@ interface ModalContentProps extends Omit<AriaModalOverlayProps, "isDismissable"
1826
1888
  * @default false
1827
1889
  */
1828
1890
  disableAnimation?: boolean;
1891
+ /**
1892
+ * Whether the modal should be rendered with the initial animation. If set to
1893
+ * false, the modal will be rendered without the initial animation on mount.
1894
+ * This doesn't affect the animation when the modal is is being opened or
1895
+ * closed after it has been mounted. This prop is ignored if
1896
+ * `disableAnimation` is set to `true`.
1897
+ *
1898
+ * @default true
1899
+ */
1900
+ shouldAnimateOnMount?: boolean;
1829
1901
  /**
1830
1902
  * Whether the modal should be rendered as a drawer. This will render the
1831
1903
  * modal with a transparent background and no border at the bottom. The `auto`
@@ -2352,6 +2424,7 @@ interface ImageGalleryProps extends StylingProps, Omit<ListBoxProps, "items" | "
2352
2424
 
2353
2425
  declare const ImageGallery: React__default.ForwardRefExoticComponent<ImageGalleryProps & React__default.RefAttributes<HTMLDivElement>>;
2354
2426
 
2427
+ type ButtonBehaviour = "toggle" | "action";
2355
2428
  interface ButtonSelectProps extends StylingProps, Pick<SelectProps, "isDisabled" | "validationState" | "onSelectionChange" | "selectedKey" | "defaultSelectedKey" | "items" | "showSelectedIcon" | "isOpen" | "defaultOpen" | "triggerClassName" | "triggerStyle">, Pick<ToggleButtonProps, "onPress" | "isSelected" | "defaultSelected" | "excludeFromTabOrder">, AriaLabelingProps {
2356
2429
  /**
2357
2430
  * The size of the button.
@@ -2384,11 +2457,17 @@ interface ButtonSelectProps extends StylingProps, Pick<SelectProps, "isDisabled"
2384
2457
  }) => React__default.CSSProperties);
2385
2458
  /** Props for the tooltip. */
2386
2459
  tooltipProps?: Omit<TooltipProps, "children"> | ((trigger: "button" | "select") => Omit<TooltipProps, "children">);
2460
+ /**
2461
+ * The behaviour of the button select.
2462
+ *
2463
+ * @default "toggle"
2464
+ */
2465
+ buttonBehaviour?: ButtonBehaviour | ((activeKey: string) => ButtonBehaviour);
2387
2466
  }
2388
2467
 
2389
2468
  declare const ButtonSelect: React__default.ForwardRefExoticComponent<ButtonSelectProps & React__default.RefAttributes<HTMLDivElement>>;
2390
2469
 
2391
- interface ComboBoxProps extends StylingProps, Omit<AriaComboBoxOptions<ListItem>, "items" | "children" | "inputRef" | "popoverRef" | "listBoxRef" | "buttonRef" | "validationState" | "errorMessage" | "description">, Omit<AriaComboBoxProps<ListItem>, "items" | "children" | "errorMessage" | "description" | "validationState">, Omit<ListBoxProps, "autoFocus" | "onBlur" | "onFocus" | "onSelectionChange" | "selectionBehavior" | "selectionMode" | "selectedKeys" | "defaultSelectedKeys" | "renderDropIndicator" | "renderDragPreview" | "dropIndicatorClassName" | "dropIndicatorStyle" | keyof DragAndDropProps>, AriaValidationProps, Omit<ComboBoxStateOptions<ListItem>, "items" | "children" | "errorMessage" | "description" | "validationState" | "selectedKey">, InputMessage {
2470
+ interface ComboBoxProps extends StylingProps, Omit<AriaComboBoxOptions<ListItem>, "items" | "children" | "inputRef" | "popoverRef" | "listBoxRef" | "buttonRef" | "validationState" | "errorMessage" | "description">, Omit<AriaComboBoxProps<ListItem>, "items" | "children" | "errorMessage" | "description" | "validationState">, Omit<ListBoxProps, "autoFocus" | "onBlur" | "onFocus" | "onSelectionChange" | "selectionBehavior" | "selectionMode" | "selectedKeys" | "defaultSelectedKeys" | "renderDropIndicator" | "renderDragPreview" | "dropIndicatorClassName" | "dropIndicatorStyle" | keyof DragAndDropProps>, AriaValidationProps, Omit<ComboBoxStateOptions<ListItem>, "items" | "children" | "errorMessage" | "description" | "validationState" | "selectedKey">, InputMessage, Pick<ActionIconButtonProps, "tooltip"> {
2392
2471
  /** ID of the initially selected item */
2393
2472
  defaultSelectedKey?: string;
2394
2473
  /**
@@ -2488,32 +2567,6 @@ interface ComboBoxProps extends StylingProps, Omit<AriaComboBoxOptions<ListItem>
2488
2567
 
2489
2568
  declare const ComboBox: React__default.ForwardRefExoticComponent<ComboBoxProps & React__default.RefAttributes<HTMLDivElement>>;
2490
2569
 
2491
- interface ColorSwatchProps extends Omit<AriaColorSwatchProps, "colorName">, StylingProps, DOMProps, AriaLabelingProps {
2492
- /** Whether the swatch is focused by keyboard. */
2493
- isFocusVisible?: boolean;
2494
- /** Whether the swatch is selected. */
2495
- isSelected?: boolean;
2496
- /**
2497
- * Whether the swatch is interactive. This is used to determine whether to
2498
- * show hover styles.
2499
- */
2500
- isInteractive?: boolean;
2501
- /**
2502
- * Whether the swatch is disabled. This is used to determine whether to show
2503
- * disabled styles.
2504
- */
2505
- isDisabled?: boolean;
2506
- /**
2507
- * Whether to show a tooltip. You can pass a boolean or a partial tooltip
2508
- * object that extends the default tooltip props.
2509
- *
2510
- * @default false
2511
- */
2512
- tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
2513
- }
2514
-
2515
- declare const ColorSwatch: React__default.ForwardRefExoticComponent<ColorSwatchProps & React__default.RefAttributes<HTMLDivElement>>;
2516
-
2517
2570
  type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGridListOptions<ListOption> & Partial<Pick<DragAndDropProps, "enableReorder" | "orientation" | "layout" | "onReorder">> & {
2518
2571
  /**
2519
2572
  * The items to render in the grid list. Items have the following shape:
@@ -2593,6 +2646,7 @@ type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGridListOpt
2593
2646
 
2594
2647
  declare const GridList: React__default.ForwardRefExoticComponent<GridListProps & React__default.RefAttributes<HTMLUListElement>>;
2595
2648
 
2649
+ type ActionTooltipProps = Omit<TooltipProps, "variant" | "size" | "includeArrow" | "children">;
2596
2650
  interface ActionGroupProps extends StylingProps, Omit<AriaActionGroupProps<ListItem>, "children"> {
2597
2651
  /** The items to display in the action group. */
2598
2652
  items: ListItem[];
@@ -2602,7 +2656,7 @@ interface ActionGroupProps extends StylingProps, Omit<AriaActionGroupProps<ListI
2602
2656
  */
2603
2657
  selectionMode?: "single" | "multiple";
2604
2658
  /** The props to be passed to the tooltip component. */
2605
- tooltipProps?: IconComponentProps["tooltipProps"] | ((item: ListItem) => IconComponentProps["tooltipProps"]);
2659
+ tooltipProps?: ActionTooltipProps | ((item: ListItem) => ActionTooltipProps);
2606
2660
  /**
2607
2661
  * A function that renders an action item. This function is called for each
2608
2662
  * item in the action group. By default, an `ActionIconButton` is rendered.