@baseline-ui/core 0.39.1 → 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, DOMAttributes, FocusableElement, 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';
@@ -394,13 +394,53 @@ declare const Tooltip: React__default.ForwardRefExoticComponent<TooltipProps & R
394
394
 
395
395
  declare const Focusable: React__default.ForwardRefExoticComponent<FocusableProps & React__default.RefAttributes<FocusableElement>>;
396
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
+
397
427
  interface IconComponentProps {
398
428
  /** The icon to show at the start of the color input. */
399
429
  icon?: React__default.FC<IconProps>;
400
430
  /** The aria label for the color input button. */
401
431
  "aria-label": string;
402
- /** Props to pass to the tooltip component. */
403
- 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"];
404
444
  }
405
445
 
406
446
  interface SliderProps extends Omit<AriaSliderProps<number> & SliderStateOptions<number>, "orientation" | "numberFormatter">, StylingProps {
@@ -772,36 +812,6 @@ interface ProgressSpinnerProps extends Omit<AriaProgressBarProps, "value" | "isI
772
812
 
773
813
  declare const ProgressSpinner: React__default.ForwardRefExoticComponent<ProgressSpinnerProps & React__default.RefAttributes<HTMLDivElement>>;
774
814
 
775
- interface ActionIconButtonProps extends ActionButtonSharedProps {
776
- /** The icon to display */
777
- icon: React__default.FC<IconProps>;
778
- /**
779
- * The size of the icon button.
780
- *
781
- * @default "md"
782
- */
783
- size?: "xxs" | "xs" | "sm" | "md" | "lg";
784
- /**
785
- * The variant of the icon button.
786
- *
787
- * @default "primary"
788
- */
789
- variant?: "primary" | "secondary" | "tertiary" | "ghost" | "toolbar" | "popover";
790
- /** Indicates whether focusing should be prevented on press. */
791
- preventFocusOnPress?: boolean;
792
- /**
793
- * Whether to show a tooltip. You can pass a boolean or a partial tooltip
794
- * object that extends the default tooltip props.
795
- *
796
- * @default false
797
- */
798
- tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
799
- /** The drag props to use for drag and drop interactions. */
800
- dragProps?: React__default.HTMLAttributes<HTMLElement>;
801
- }
802
-
803
- declare const ActionIconButton: React__default.ForwardRefExoticComponent<ActionIconButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
804
-
805
815
  interface ToggleButtonProps extends Omit<StylingProps, "style" | "className">, Omit<AriaToggleButtonProps, "children">, StylingWithUIState<{
806
816
  isSelected?: boolean;
807
817
  }> {
@@ -1264,11 +1274,51 @@ declare const Dialog: React__default.ForwardRefExoticComponent<DialogProps & Rea
1264
1274
 
1265
1275
  declare const DialogTitle: React__default.ForwardRefExoticComponent<DialogTitleProps & React__default.RefAttributes<HTMLDivElement>>;
1266
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
+
1267
1317
  interface ColorPreset {
1268
1318
  label: string;
1269
1319
  color: string;
1270
1320
  }
1271
- 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"> {
1272
1322
  /**
1273
1323
  * The list of color presets to show in the color picker. The signature of the
1274
1324
  * color presets is:
@@ -1301,7 +1351,9 @@ interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorF
1301
1351
  *
1302
1352
  * @default true
1303
1353
  */
1304
- colorLabel?: boolean | ((color: Color | null) => string);
1354
+ colorLabel?: boolean | ((color: Color | null, options: {
1355
+ isIndeterminate: boolean;
1356
+ }) => string);
1305
1357
  /**
1306
1358
  * Whether to allow alpha values in the custom color picker.
1307
1359
  *
@@ -1363,13 +1415,19 @@ interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorF
1363
1415
  colorName?: string | boolean;
1364
1416
  triggerProps: AriaButtonProps<"button">;
1365
1417
  labelId?: string;
1366
- }) => React__default.ReactElement;
1418
+ } & Pick<ColorSwatchProps, "isIndeterminate" | "indeterminateIcon">) => React__default.ReactElement;
1367
1419
  /**
1368
1420
  * Handler that is called when the user stops dragging or clicking on the
1369
1421
  * color picker. In case of presets, this is called when the user clicks on a
1370
1422
  * color preset.
1371
1423
  */
1372
1424
  onChangeEnd?: (color: Color | null) => void;
1425
+ /**
1426
+ * Whether the color input is indeterminate.
1427
+ *
1428
+ * @default false
1429
+ */
1430
+ isIndeterminate?: boolean;
1373
1431
  }
1374
1432
  interface IconColorInputProps extends StylingProps, Omit<ColorInputProps, "renderTriggerButton" | "colorLabel" | "label" | "labelPosition" | "aria-label">, IconComponentProps {
1375
1433
  /**
@@ -1386,12 +1444,13 @@ declare const IconColorInputButton: React__default.ForwardRefExoticComponent<Omi
1386
1444
  icon: React__default.FC<IconProps>;
1387
1445
  color?: string | null;
1388
1446
  } & React__default.RefAttributes<HTMLButtonElement>>;
1389
- 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"> {
1390
1448
  isOpen: boolean;
1391
1449
  "aria-label"?: string;
1392
1450
  labelPosition?: "top" | "start";
1393
1451
  color: Color | null;
1394
1452
  colorName?: string | boolean;
1453
+ isIndeterminate?: boolean;
1395
1454
  }
1396
1455
 
1397
1456
  declare const IconColorInput: React__default.ForwardRefExoticComponent<IconColorInputProps & React__default.RefAttributes<HTMLDivElement>>;
@@ -2365,6 +2424,7 @@ interface ImageGalleryProps extends StylingProps, Omit<ListBoxProps, "items" | "
2365
2424
 
2366
2425
  declare const ImageGallery: React__default.ForwardRefExoticComponent<ImageGalleryProps & React__default.RefAttributes<HTMLDivElement>>;
2367
2426
 
2427
+ type ButtonBehaviour = "toggle" | "action";
2368
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 {
2369
2429
  /**
2370
2430
  * The size of the button.
@@ -2402,7 +2462,7 @@ interface ButtonSelectProps extends StylingProps, Pick<SelectProps, "isDisabled"
2402
2462
  *
2403
2463
  * @default "toggle"
2404
2464
  */
2405
- buttonBehaviour?: "toggle" | "action";
2465
+ buttonBehaviour?: ButtonBehaviour | ((activeKey: string) => ButtonBehaviour);
2406
2466
  }
2407
2467
 
2408
2468
  declare const ButtonSelect: React__default.ForwardRefExoticComponent<ButtonSelectProps & React__default.RefAttributes<HTMLDivElement>>;
@@ -2507,32 +2567,6 @@ interface ComboBoxProps extends StylingProps, Omit<AriaComboBoxOptions<ListItem>
2507
2567
 
2508
2568
  declare const ComboBox: React__default.ForwardRefExoticComponent<ComboBoxProps & React__default.RefAttributes<HTMLDivElement>>;
2509
2569
 
2510
- interface ColorSwatchProps extends Omit<AriaColorSwatchProps, "colorName">, StylingProps, DOMProps, AriaLabelingProps {
2511
- /** Whether the swatch is focused by keyboard. */
2512
- isFocusVisible?: boolean;
2513
- /** Whether the swatch is selected. */
2514
- isSelected?: boolean;
2515
- /**
2516
- * Whether the swatch is interactive. This is used to determine whether to
2517
- * show hover styles.
2518
- */
2519
- isInteractive?: boolean;
2520
- /**
2521
- * Whether the swatch is disabled. This is used to determine whether to show
2522
- * disabled styles.
2523
- */
2524
- isDisabled?: boolean;
2525
- /**
2526
- * Whether to show a tooltip. You can pass a boolean or a partial tooltip
2527
- * object that extends the default tooltip props.
2528
- *
2529
- * @default false
2530
- */
2531
- tooltip?: boolean | Partial<Omit<TooltipProps, "children">>;
2532
- }
2533
-
2534
- declare const ColorSwatch: React__default.ForwardRefExoticComponent<ColorSwatchProps & React__default.RefAttributes<HTMLDivElement>>;
2535
-
2536
2570
  type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGridListOptions<ListOption> & Partial<Pick<DragAndDropProps, "enableReorder" | "orientation" | "layout" | "onReorder">> & {
2537
2571
  /**
2538
2572
  * The items to render in the grid list. Items have the following shape:
@@ -2612,6 +2646,7 @@ type GridListProps = Omit<StylingProps & ListProps<ListOption> & AriaGridListOpt
2612
2646
 
2613
2647
  declare const GridList: React__default.ForwardRefExoticComponent<GridListProps & React__default.RefAttributes<HTMLUListElement>>;
2614
2648
 
2649
+ type ActionTooltipProps = Omit<TooltipProps, "variant" | "size" | "includeArrow" | "children">;
2615
2650
  interface ActionGroupProps extends StylingProps, Omit<AriaActionGroupProps<ListItem>, "children"> {
2616
2651
  /** The items to display in the action group. */
2617
2652
  items: ListItem[];
@@ -2621,7 +2656,7 @@ interface ActionGroupProps extends StylingProps, Omit<AriaActionGroupProps<ListI
2621
2656
  */
2622
2657
  selectionMode?: "single" | "multiple";
2623
2658
  /** The props to be passed to the tooltip component. */
2624
- tooltipProps?: IconComponentProps["tooltipProps"] | ((item: ListItem) => IconComponentProps["tooltipProps"]);
2659
+ tooltipProps?: ActionTooltipProps | ((item: ListItem) => ActionTooltipProps);
2625
2660
  /**
2626
2661
  * A function that renders an action item. This function is called for each
2627
2662
  * item in the action group. By default, an `ActionIconButton` is rendered.