@equinor/echo-components 4.2.0 → 4.3.0-beta-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.
Files changed (29) hide show
  1. package/{1dd428dbc8752224.svg → 04852fb8014a9692.svg} +19 -19
  2. package/{246374c510469011.svg → 0a6a2110d0267d69.svg} +142 -142
  3. package/README.md +278 -278
  4. package/{8ddc7d44de9795fc.svg → bb2d3aa591e687f9.svg} +112 -112
  5. package/{c283d1a6c49e1d97.svg → fb72d3eecaa74688.svg} +82 -82
  6. package/index.cjs.js +1 -1
  7. package/index.d.ts +1 -1
  8. package/package.json +3 -3
  9. package/src/components/echoButton/EchoButton.d.ts +4 -4
  10. package/src/components/echoButton/EchoToggleButton.d.ts +7 -1
  11. package/src/components/echoToggleButtonGroup/EchoToggleButtonGroup.d.ts +29 -0
  12. package/src/components/index.d.ts +5 -0
  13. package/src/components/itemMarkerPopover/ItemMarkerPopover.d.ts +22 -0
  14. package/src/components/itemMarkerPopover/ItemMarkerPopoverContent.d.ts +10 -0
  15. package/src/components/itemMarkerPopover/ItemMarkerPopoverFooter.d.ts +9 -0
  16. package/src/components/itemMarkerPopover/ItemMarkerPopoverHeader.d.ts +25 -0
  17. package/src/components/itemMarkerPopover/OldItemMarkerPopover.d.ts +2 -2
  18. package/src/components/itemMarkerPopover/itemMarkerPopoverHeader/ItemMarkerPopoverHeaderPagination.d.ts +8 -0
  19. package/src/components/itemMarkerPopover/itemMarkerPopoverHeader/ItemMarkerPopoverHeaderTitle.d.ts +5 -0
  20. package/src/components/legendSelector/LegendSelector.d.ts +1 -1
  21. package/src/components/legendSelector/useVisibleLegends.d.ts +1 -1
  22. package/src/components/selectionBar/SelectionBar.d.ts +13 -0
  23. package/src/components/selectionBar/SelectionBarContent.d.ts +10 -0
  24. package/src/components/selectionBar/SelectionBarCounter.d.ts +16 -0
  25. package/src/components/selectionBar/SelectionBarFeedback.d.ts +20 -0
  26. package/src/components/selectionBar/menu/SelectionBarMenu.d.ts +20 -0
  27. package/src/components/selectionBar/menu/SelectionBarMenuItem.d.ts +19 -0
  28. package/src/components/selectionBar/selectionBarFeedback.types.d.ts +1 -0
  29. package/src/components/selectionColorPicker/SelectionColorPicker.d.ts +2 -1
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./src/index";
1
+ export * from "./src\\index";
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@equinor/echo-components",
3
- "version": "4.2.0",
3
+ "version": "4.3.0-beta-0",
4
4
  "dependencies": {
5
5
  "chart.js": "4.5.1",
6
- "react-datepicker": "8.10.0",
6
+ "react-datepicker": "9.1.0",
7
7
  "react-swipeable": "7.0.2",
8
8
  "react-window": "1.8.11"
9
9
  },
10
10
  "peerDependencies": {
11
- "@equinor/echo-utils": ">= 4.2.0 < 5.0.0",
11
+ "@equinor/echo-utils": "4.3.0-beta-0",
12
12
  "@equinor/eds-core-react": "0.49.0",
13
13
  "@equinor/eds-icons": "0.22.0",
14
14
  "@equinor/eds-tokens": "2.1.0",
@@ -1,7 +1,7 @@
1
1
  import { ButtonProps } from '@equinor/eds-core-react';
2
2
  export type EchoButtonProps = ButtonProps & {
3
- isSelected?: boolean;
4
- isLoading?: boolean;
3
+ readonly isLoading?: boolean;
4
+ readonly isSelected?: boolean;
5
5
  };
6
6
  /**
7
7
  * Wrapper for EDS Button with UI preferences support, and dark mode support (uses new light/dark CSS variables).
@@ -16,6 +16,6 @@ export declare const EchoButton: import("react").ForwardRefExoticComponent<{
16
16
  type?: string;
17
17
  fullWidth?: boolean;
18
18
  } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
19
- isSelected?: boolean;
20
- isLoading?: boolean;
19
+ readonly isLoading?: boolean;
20
+ readonly isSelected?: boolean;
21
21
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,4 +1,9 @@
1
1
  import { EchoButtonProps } from './EchoButton';
2
+ export type EchoToggleButtonProps = Omit<EchoButtonProps, 'variant' | 'color'> & {
3
+ isSelected?: boolean;
4
+ variant?: Exclude<EchoButtonProps['variant'], 'ghost' | 'ghost_icon'>;
5
+ color?: Exclude<EchoButtonProps['color'], 'danger'>;
6
+ };
2
7
  /**
3
8
  * Temporary EDS toggle button, remove when EDS 1.0 is available.
4
9
  * Visually merges multiple toggle buttons together.
@@ -10,7 +15,8 @@ import { EchoButtonProps } from './EchoButton';
10
15
  * @param {boolean} [props.isSelected] - Indicates if the button is in a selected state.
11
16
  * @param {'contained' | 'contained_icon' | 'outlined'} [props.variant] - Button variant. Ghost variants are not available for toggle buttons.
12
17
  */
13
- export declare const EchoToggleButton: import("react").ForwardRefExoticComponent<Omit<EchoButtonProps, "variant"> & {
18
+ export declare const EchoToggleButton: import("react").ForwardRefExoticComponent<Omit<EchoButtonProps, "color" | "variant"> & {
14
19
  isSelected?: boolean;
15
20
  variant?: Exclude<EchoButtonProps["variant"], "ghost" | "ghost_icon">;
21
+ color?: Exclude<EchoButtonProps["color"], "danger">;
16
22
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,29 @@
1
+ import { type EchoToggleButtonProps } from '../echoButton/EchoToggleButton';
2
+ export interface EchoToggleButtonGroupOption<T> {
3
+ readonly label: string | JSX.Element;
4
+ readonly value: T;
5
+ }
6
+ interface EchoToggleButtonGroupProps<T> {
7
+ readonly className?: string;
8
+ readonly options: ReadonlyArray<EchoToggleButtonGroupOption<T>>;
9
+ readonly selectedOption: T;
10
+ readonly onOptionSelected?: (option: T, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
11
+ readonly variant?: EchoToggleButtonProps['variant'];
12
+ readonly color?: EchoToggleButtonProps['color'];
13
+ }
14
+ /**
15
+ * EchoToggleButtonGroup is a controlled component that renders a group of selectable buttons.
16
+ *
17
+ * Displays each option as a button, highlights the currently selected option, and calls the `onSelect` callback when a different option is chosen.
18
+ * Uses Echo UI components and compact density for consistent styling. Uses EDS colors with color-scheme for automatic dark mode support.
19
+ *
20
+ * @component
21
+ * @param {object} props - Component props
22
+ * @param {string} [props.className] - Optional additional CSS class for custom styling.
23
+ * @param {ReadonlyArray<EchoToggleButtonGroupOption<T>>} props.options - List of selectable options.
24
+ * @param {EchoToggleButtonGroupOption<T>} props.selectedOption - The currently selected option.
25
+ * @param {(option: T) => void} [props.onOptionSelected] - Callback invoked when a new option is selected.
26
+ * @returns {JSX.Element | null} The rendered button group, or null if no options are provided.
27
+ */
28
+ export declare const EchoToggleButtonGroup: <T>(props: EchoToggleButtonGroupProps<T>) => import("react/jsx-runtime").JSX.Element | null;
29
+ export {};
@@ -18,6 +18,7 @@ export * from './echoButton/EchoToggleButton';
18
18
  export * from './echoCard/index';
19
19
  export * from './echoHeader/EchoHeader';
20
20
  export * from './echoMenu/EchoMenu';
21
+ export * from './echoToggleButtonGroup/EchoToggleButtonGroup';
21
22
  export * from './floatingActionButton';
22
23
  export * from './floatingActionButton/FloatingActionButton';
23
24
  export * from './functionalLocationListItem/FunctionalLocationListItem';
@@ -31,6 +32,7 @@ export type { ItemMarkerChipProps } from './itemMarker/ItemMarkerChip';
31
32
  export * from './itemMarker/ItemMarkerIcon';
32
33
  export * from './itemMarker/MultipleItemMarkers';
33
34
  export * from './itemMarker/utils/itemMarkerUtils';
35
+ export * from './itemMarkerPopover/ItemMarkerPopover';
34
36
  export * from './itemMarkerPopover/OldItemMarkerPopover';
35
37
  export * from './legend';
36
38
  export * from './legendChip/LegendChip';
@@ -55,6 +57,9 @@ export * from './secondaryMarker/SecondaryMarker';
55
57
  export * from './secondaryMarker/SecondaryMarkerExpander';
56
58
  export * from './secondaryMarker/SecondaryMarkerWithChip';
57
59
  export * from './secondaryMarker/SecondaryMarkerWrapper';
60
+ export type { SelectionBarMenuState } from './selectionBar/menu/SelectionBarMenu';
61
+ export * from './selectionBar/SelectionBar';
62
+ export type { SelectionBarFeedbackType } from './selectionBar/selectionBarFeedback.types';
58
63
  export * from './selectionColorPicker/SelectionColorPicker';
59
64
  export * from './selectTextOnFocusAutocomplete/SelectTextOnFocusAutocomplete';
60
65
  export * from './sidebarButton/SidebarButton';
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ export type ArrowPosition = 'left' | 'right' | 'top' | 'bottom' | 'none';
3
+ export interface ItemMarkerPopoverProps {
4
+ /**
5
+ * Children should be ItemMarkerPopover.Header, ItemMarkerPopover.Content, and/or ItemMarkerPopover.Footer
6
+ */
7
+ readonly children: ReactNode;
8
+ readonly className?: string;
9
+ readonly zIndex?: number;
10
+ /**
11
+ * Position of the arrow pointer. Defaults to 'left' (arrow points left, popover opens to the right).
12
+ */
13
+ readonly arrowPosition?: ArrowPosition;
14
+ }
15
+ export declare const ItemMarkerPopover: (({ children, className, zIndex, arrowPosition }: ItemMarkerPopoverProps) => import("react/jsx-runtime").JSX.Element) & {
16
+ Header: ((props: import("./ItemMarkerPopoverHeader").ItemMarkerPopoverHeaderProps) => import("react/jsx-runtime").JSX.Element) & {
17
+ Pagination: (props: import("./itemMarkerPopoverHeader/ItemMarkerPopoverHeaderPagination").ItemMarkerPopoverHeaderPaginationProps) => import("react/jsx-runtime").JSX.Element;
18
+ Title: (props: import("./itemMarkerPopoverHeader/ItemMarkerPopoverHeaderTitle").HeaderTitleProps) => import("react/jsx-runtime").JSX.Element;
19
+ };
20
+ Content: (props: import("./ItemMarkerPopoverContent").ItemMarkerPopoverContentProps) => import("react/jsx-runtime").JSX.Element;
21
+ Footer: ({ children, className }: import("./ItemMarkerPopoverFooter").ItemMarkerPopoverFooterProps) => import("react/jsx-runtime").JSX.Element;
22
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ItemMarkerPopoverContentProps {
3
+ /**
4
+ * Main content (typically a card component)
5
+ */
6
+ readonly children: ReactNode;
7
+ readonly className?: string;
8
+ readonly onClick?: () => void;
9
+ }
10
+ export declare const Content: (props: ItemMarkerPopoverContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ItemMarkerPopoverFooterProps {
3
+ /**
4
+ * Footer content (typically SelectionBar)
5
+ */
6
+ readonly children: ReactNode;
7
+ readonly className?: string;
8
+ }
9
+ export declare const Footer: ({ children, className }: ItemMarkerPopoverFooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ItemMarkerPopoverHeaderProps {
3
+ readonly onClose: () => void;
4
+ /**
5
+ * Children: use Header.Pagination and Header.Title
6
+ */
7
+ readonly children: ReactNode;
8
+ readonly className?: string;
9
+ }
10
+ /**
11
+ * @example
12
+ * <Header onClose={() => console.log('close popover')}>
13
+ * <Header.Pagination
14
+ * currentIndex={1}
15
+ * totalCount={5}
16
+ * onPrevious={() => console.log('previous item')}
17
+ * onNext={() => console.log('next item')}
18
+ * />
19
+ * <Header.Title>Item 1</Header.Title>
20
+ * </Header>
21
+ */
22
+ export declare const Header: ((props: ItemMarkerPopoverHeaderProps) => import("react/jsx-runtime").JSX.Element) & {
23
+ Pagination: (props: import("./itemMarkerPopoverHeader/ItemMarkerPopoverHeaderPagination").ItemMarkerPopoverHeaderPaginationProps) => import("react/jsx-runtime").JSX.Element;
24
+ Title: (props: import("./itemMarkerPopoverHeader/ItemMarkerPopoverHeaderTitle").HeaderTitleProps) => import("react/jsx-runtime").JSX.Element;
25
+ };
@@ -10,6 +10,8 @@ export type OldItemMarkerPopover = {
10
10
  style?: CSSProperties;
11
11
  };
12
12
  /**
13
+ * /** @deprecated This component is being deprecated as a part of #419082 in favor of the new ItemMarkerPopover compound component which interacts well with ItemCard.
14
+ *
13
15
  * Popover component that can display a single item, or a pagination of multiple items.
14
16
  * NB:
15
17
  * The content that is being passed in needs to be styled accordingly to the dark theme.
@@ -25,5 +27,3 @@ export type OldItemMarkerPopover = {
25
27
  * @param {CSSProperties} style - style of the popover.
26
28
  */
27
29
  export declare const OldItemMarkerPopover: ({ items, isOpen, handleClose, title, zIndex, className, style }: OldItemMarkerPopover) => false | import("react/jsx-runtime").JSX.Element;
28
- /** @deprecated This component is being deprecated as a part of #419082 in favor of the new ItemMarkerPopover compound component which interacts well with ItemCard. */
29
- export declare const ItemMarkerPopover: ({ items, isOpen, handleClose, title, zIndex, className, style }: OldItemMarkerPopover) => false | import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export interface ItemMarkerPopoverHeaderPaginationProps {
2
+ readonly currentIndex: number;
3
+ readonly totalCount: number;
4
+ readonly onPrevious: () => void;
5
+ readonly onNext: () => void;
6
+ readonly className?: string;
7
+ }
8
+ export declare const ItemMarkerPopoverHeaderPagination: (props: ItemMarkerPopoverHeaderPaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export interface HeaderTitleProps {
2
+ readonly children: string;
3
+ readonly className?: string;
4
+ }
5
+ export declare const ItemMarkerPopoverHeaderTitle: (props: HeaderTitleProps) => import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,7 @@ export interface LegendSelectorProps {
4
4
  options: ReadonlyArray<string>;
5
5
  selectedOption: string;
6
6
  onOptionClick: (option: string) => void;
7
- legends: LegendChipProps[];
7
+ legends: ReadonlyArray<LegendChipProps>;
8
8
  showLegendToggle?: boolean;
9
9
  visual?: JSX.Element;
10
10
  placeholder?: string;
@@ -6,4 +6,4 @@ import { LegendChipProps } from '../legendChip/LegendChip';
6
6
  * @param {number} availableWidth - The available width for showing the legends, in px.
7
7
  * @returns {LegendChipProps[]} - Array of visible legends.
8
8
  */
9
- export declare const useVisibleLegends: (showAllLegends: boolean, legends: LegendChipProps[], availableWidth: number) => LegendChipProps[];
9
+ export declare const useVisibleLegends: (showAllLegends: boolean, legends: ReadonlyArray<LegendChipProps>, availableWidth: number) => ReadonlyArray<LegendChipProps>;
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface SelectionBarProps {
3
+ readonly children: ReactNode;
4
+ readonly className?: string;
5
+ }
6
+ export declare const SelectionBar: (({ children, className }: SelectionBarProps) => import("react/jsx-runtime").JSX.Element) & {
7
+ Content: ({ children, className }: import("./SelectionBarContent").SelectionBarContentProps) => import("react/jsx-runtime").JSX.Element;
8
+ Menu: ((props: import("./menu/SelectionBarMenu").SelectionBarMenuProps) => import("react/jsx-runtime").JSX.Element) & {
9
+ MenuItem: (props: import("./menu/SelectionBarMenuItem").SelectionBarMenuItemProps) => import("react/jsx-runtime").JSX.Element;
10
+ };
11
+ Counter: (props: import("./SelectionBarCounter").SelectionBarCounterProps) => import("react/jsx-runtime").JSX.Element;
12
+ Feedback: ({ feedbackType, className }: import("./SelectionBarFeedback").SelectionBarFeedbackProps) => import("react/jsx-runtime").JSX.Element;
13
+ };
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface SelectionBarContentProps {
3
+ readonly children: ReactNode;
4
+ readonly className?: string;
5
+ }
6
+ /**
7
+ * Flexible content area within the SelectionBar.
8
+ * Put any components or elements here.
9
+ */
10
+ export declare const SelectionBarContent: ({ children, className }: SelectionBarContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ export interface SelectionBarCounterProps {
2
+ /** Number of currently selected items */
3
+ readonly selectedItems: number;
4
+ /** Total number of items available */
5
+ readonly totalItems: number;
6
+ }
7
+ /**
8
+ * Displays a selection count in the format "selected / total".
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <SelectionBar.Counter selectedItems={2} totalItems={5} />
13
+ * // Renders: "2 / 5"
14
+ * ```
15
+ */
16
+ export declare const SelectionBarCounter: (props: SelectionBarCounterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import type { SelectionBarFeedbackType } from './selectionBarFeedback.types';
2
+ export interface SelectionBarFeedbackProps {
3
+ /** The type of feedback to display */
4
+ readonly feedbackType: SelectionBarFeedbackType;
5
+ /** Optional additional CSS class */
6
+ readonly className?: string;
7
+ }
8
+ /**
9
+ * Displays feedback status within the SelectionBar (e.g., "Added", "Removed", "Failed to add").
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <SelectionBar.Feedback feedbackType="added" />
14
+ * // Renders: ✓ Added (in success color)
15
+ *
16
+ * <SelectionBar.Feedback feedbackType="addError" />
17
+ * // Renders: ⚠ Failed to add (in error color)
18
+ * ```
19
+ */
20
+ export declare const SelectionBarFeedback: ({ feedbackType, className }: SelectionBarFeedbackProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ export type SelectionBarMenuState = 'unselected' | 'selected' | 'loading';
3
+ export interface SelectionBarMenuProps {
4
+ readonly children: ReactNode;
5
+ /**
6
+ * Unique ID for the menu
7
+ */
8
+ readonly menuId?: string;
9
+ readonly className?: string;
10
+ readonly state?: SelectionBarMenuState;
11
+ /**
12
+ * This will overwrite the default onClick used for opening the menu.
13
+ * Useful for special case where we only have one list, and we want to
14
+ * auto-add to that without opening the menu.
15
+ */
16
+ readonly overwriteMenuTriggerClick?: () => void;
17
+ }
18
+ export declare const SelectionBarMenu: ((props: SelectionBarMenuProps) => import("react/jsx-runtime").JSX.Element) & {
19
+ MenuItem: (props: import("./SelectionBarMenuItem").SelectionBarMenuItemProps) => import("react/jsx-runtime").JSX.Element;
20
+ };
@@ -0,0 +1,19 @@
1
+ export type SelectionBarMenuItemVariant = 'add' | 'remove';
2
+ export interface SelectionBarMenuItemProps {
3
+ readonly children: string | string[];
4
+ readonly onClick: (event: React.MouseEvent<Element, MouseEvent>) => void;
5
+ readonly disabled?: boolean;
6
+ /**
7
+ * Determines the icon and styling of the menu item. Defaults to 'add'.
8
+ */
9
+ readonly variant?: SelectionBarMenuItemVariant;
10
+ readonly hasBorderBottom?: boolean;
11
+ /**
12
+ * Whether the menu should close when this item is clicked. Defaults to true.
13
+ */
14
+ readonly closeMenuOnClick?: boolean;
15
+ }
16
+ /**
17
+ * Menu item for use within SelectionBar.Menu
18
+ */
19
+ export declare const SelectionBarMenuItem: (props: SelectionBarMenuItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export type SelectionBarFeedbackType = 'added' | 'removed' | 'addError' | 'removeError' | 'colorChanged' | 'colorChangeError';
@@ -1,9 +1,10 @@
1
1
  interface SelectionColorProps {
2
+ readonly className?: string;
2
3
  readonly itemColor?: string;
3
4
  readonly colors: ReadonlyArray<string>;
4
5
  readonly onColorSelect: (color: string) => void;
5
6
  readonly disabled?: boolean;
6
7
  readonly renderButtonAsSpan?: boolean;
7
8
  }
8
- export declare const SelectionColorPicker: ({ itemColor, colors, onColorSelect, disabled, renderButtonAsSpan }: SelectionColorProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const SelectionColorPicker: ({ itemColor, colors, onColorSelect, disabled, renderButtonAsSpan, className }: SelectionColorProps) => import("react/jsx-runtime").JSX.Element;
9
10
  export {};