@equinor/echo-components 2.2.3 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-components",
3
- "version": "2.2.3",
3
+ "version": "2.4.0",
4
4
  "dependencies": {
5
5
  "chart.js": "4.5.1",
6
6
  "react-datepicker": "8.7.0",
@@ -8,10 +8,10 @@
8
8
  "react-window": "1.8.11"
9
9
  },
10
10
  "peerDependencies": {
11
- "@equinor/echo-utils": ">= 2.2.3 < 3.0.0",
11
+ "@equinor/echo-utils": ">= 2.4.0 < 3.0.0",
12
12
  "@equinor/eds-core-react": "0.49.0",
13
13
  "@equinor/eds-icons": "0.22.0",
14
- "@equinor/eds-tokens": "0.10.0",
14
+ "@equinor/eds-tokens": "2.1.0",
15
15
  "classnames": "2.5.1",
16
16
  "lodash": ">= 4.17.21 < 5",
17
17
  "react": ">= 17.0.2",
@@ -20,6 +20,10 @@
20
20
  "sortablejs": ">= 1.15.1 < 2",
21
21
  "zustand": ">= 4.4.7 < 5"
22
22
  },
23
+ "exports": {
24
+ "./package.json": "./package.json",
25
+ ".": "./index.cjs.js"
26
+ },
23
27
  "main": "./index.cjs.js",
24
28
  "type": "commonjs",
25
29
  "types": "./index.d.ts"
@@ -1,8 +1,11 @@
1
1
  import { ButtonProps } from '@equinor/eds-core-react';
2
- export type EchoButtonProps = ButtonProps;
2
+ export type EchoButtonProps = ButtonProps & {
3
+ isSelected?: boolean;
4
+ };
3
5
  /**
4
- * Wrapper for EDS Button with UI preferences support.
5
- * If EDS implements mode and density in the future (as in figma), this can be removed.
6
+ * Wrapper for EDS Button with UI preferences support, and dark mode support (uses new light/dark CSS variables).
7
+ * This button component should be removed when EDS 1.0 is fully adopted, then we would use the button component from there.
8
+ * For now we need this to be able to implement temporary styles with dark support.
6
9
  */
7
10
  export declare const EchoButton: import("react").ForwardRefExoticComponent<{
8
11
  color?: "primary" | "secondary" | "danger";
@@ -11,4 +14,6 @@ export declare const EchoButton: import("react").ForwardRefExoticComponent<{
11
14
  disabled?: boolean;
12
15
  type?: string;
13
16
  fullWidth?: boolean;
14
- } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>>;
17
+ } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
18
+ isSelected?: boolean;
19
+ } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,16 @@
1
+ import { EchoButtonProps } from './EchoButton';
2
+ /**
3
+ * Temporary EDS toggle button, remove when EDS 1.0 is available.
4
+ * Visually merges multiple toggle buttons together.
5
+ * It uses EchoButton as a base and adds isSelected prop and aria-pressed attribute for accessibility.
6
+ * Note: Ghost variants are not supported for toggle buttons as they don't provide clear visual feedback for the selected state.
7
+ *
8
+ * @component
9
+ * @param {object} props - Component props
10
+ * @param {boolean} [props.isSelected] - Indicates if the button is in a selected state.
11
+ * @param {'contained' | 'contained_icon' | 'outlined'} [props.variant] - Button variant. Ghost variants are not available for toggle buttons.
12
+ */
13
+ export declare const EchoToggleButton: import("react").ForwardRefExoticComponent<Omit<EchoButtonProps, "variant"> & {
14
+ isSelected?: boolean;
15
+ variant?: Exclude<EchoButtonProps["variant"], "ghost" | "ghost_icon">;
16
+ } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -14,6 +14,7 @@ export * from './dropdown/Dropdown';
14
14
  export * from './echoBottomBar/EchoBottomBar';
15
15
  export * from './echoButton/EchoActionButton';
16
16
  export * from './echoButton/EchoButton';
17
+ export * from './echoButton/EchoToggleButton';
17
18
  export * from './echoCard/index';
18
19
  export * from './echoHeader/EchoHeader';
19
20
  export * from './echoMenu/EchoMenu';
@@ -19,6 +19,7 @@ export interface ItemMarkerProps {
19
19
  maxNumberOfChips?: number;
20
20
  zIndex?: number | string;
21
21
  highlightColor?: string;
22
+ isGhosted?: boolean;
22
23
  }
23
24
  /**
24
25
  * Renders an item marker with optional chips.
@@ -2,6 +2,5 @@ export type PaginationProps = {
2
2
  itemCount: number;
3
3
  currentItemIndex: number;
4
4
  setCurrentItemIndex: (index: number) => void;
5
- darkTheme?: boolean;
6
5
  };
7
- export declare const Pagination: ({ itemCount, currentItemIndex, setCurrentItemIndex, darkTheme }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const Pagination: ({ itemCount, currentItemIndex, setCurrentItemIndex }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,4 +9,19 @@ export type ItemMarkerPopover = {
9
9
  className?: string;
10
10
  style?: CSSProperties;
11
11
  };
12
+ /**
13
+ * Popover component that can display a single item, or a pagination of multiple items.
14
+ * NB:
15
+ * The content that is being passed in needs to be styled accordingly to the dark theme.
16
+ * When using ListItem for the content, using the css parameter -webkit-text-fill-color is recommended for overriding the text color.
17
+ * To override the hover effect for ListItem, override the elements in the ListItem like this: > li:hover
18
+ * This component will always render in dark mode.
19
+ * @param {JSX.Element[] | string[]} items - List of items to be displayed in the popover.
20
+ * @param {boolean} isOpen - If true, popover is open.
21
+ * @param {() => void} handleClose - Function to close the popover (this is used to handle closing only, not toggling it).
22
+ * @param {string} title - Title of the popover.
23
+ * @param {number} zIndex - Z-index of the popover.
24
+ * @param {string} className - ClassName of the popover.
25
+ * @param {CSSProperties} style - style of the popover.
26
+ */
12
27
  export declare const ItemMarkerPopover: ({ items, isOpen, handleClose, title, zIndex, className, style }: ItemMarkerPopover) => false | import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,7 @@ export interface LegendChipProps {
5
5
  disabled?: boolean;
6
6
  onClick?: (isDisabled: boolean) => void;
7
7
  showAsPlainLabel?: boolean;
8
+ colors?: string[];
8
9
  }
9
10
  /**
10
11
  * Legend chip component to display a legend status chip.
@@ -12,6 +12,7 @@ export interface LegendSelectorProps {
12
12
  /**
13
13
  * Legend selector component that will display the selected legend type and the statuses.
14
14
  * Note that this component is meant to be displayed on a darker background, and should be used with the LegendSelectorAccordion as display in the LegendSelector story in the storybook.
15
+ * Will always render dark.
15
16
  * @param {JSX.Element[]} options - List of options to be displayed in the selection-selector.
16
17
  * @param {string} selectedOption - The selected option.
17
18
  * @param {(option: string) => void} onOptionsClick - Function that is called when another option is clicked.
package/src/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import './style-reset.css';
2
+ import '@equinor/eds-tokens/css/variables.css';
2
3
  import '@equinor/eds-tokens/tokens.css';
3
- import './theme/echoPrimitives.generated.css';
4
4
  import './theme/echoModes.generated.css';
5
+ import './theme/echoPrimitives.generated.css';
6
+ import './theme/echoUI.generated.css';
5
7
  import './theme/theme.css';
6
8
  export * from './components';
7
9
  export * from './elements';
@@ -10,8 +12,8 @@ export * from './hooks';
10
12
  export * from './icons';
11
13
  export * from './providers/UIPreferenceProvider';
12
14
  export * from './structure';
13
- export { echoPrimitives } from './theme/echoPrimitives.generated';
14
15
  export { echoModes } from './theme/echoModes.generated';
16
+ export { echoPrimitives } from './theme/echoPrimitives.generated';
15
17
  export { themeConst } from './theme/themeConst';
16
18
  export * from './types';
17
19
  export * from './utils';
@@ -9,7 +9,8 @@ interface UIPreferencesContextType {
9
9
  }
10
10
  interface UIPreferencesProviderProps {
11
11
  children: ReactNode;
12
- mode: Mode;
12
+ /** @deprecated - Follows the old color scheme, use new EDS tokens instead if needed */
13
+ mode?: Mode;
13
14
  density?: Density;
14
15
  }
15
16
  /**
@@ -253,6 +253,7 @@ export declare const echoModes: {
253
253
  readonly stidNotificationsSeverityTextIconDefaultSeverity: "#000000";
254
254
  readonly stidOfpDocumentsFillOfpdark: "#ffc67a";
255
255
  readonly stidOfpDocumentsFillOfplight: "#ffe7d6";
256
+ readonly stidOfpDocumentsFillNone: "rgba(255 255 255 / 0)";
256
257
  readonly stidOfpDocumentsFillBlue: "#d5eaf4";
257
258
  readonly stidOfpDocumentsFillGrey: "#bebebe";
258
259
  readonly stidOfpDocumentsTextIconOfpdark: "#000000";
@@ -36,6 +36,7 @@ export declare const echoPrimitives: {
36
36
  readonly edsPrimaryEdsMossGreen_100: "#007079";
37
37
  readonly standardItemStatusMultiple: "#3d3d3d";
38
38
  readonly standardItemStatusUnknown_1: "#bebebe";
39
+ readonly miscEchoCustomUiHoverOverlay: "rgba(0 0 0 / 0.9)";
39
40
  readonly miscEchoCustomUiMarkerActive: "#00ffff";
40
41
  readonly miscTextIconBlack: "#000000";
41
42
  readonly miscTextIconWhite: "#ffffff";
@@ -0,0 +1,8 @@
1
+ export declare const echoUI: {
2
+ readonly bgFabResting: "rgba(0 0 0 / 0.8)";
3
+ readonly bgFabHover: "rgba(0 0 0 / 0.9)";
4
+ readonly bgLightenLighten_16: "rgba(255 255 255 / 0.16)";
5
+ readonly bgLightenLighten_10: "rgba(255 255 255 / 0.1)";
6
+ readonly bgLightenLighten_30: "rgba(255 255 255 / 0.3)";
7
+ readonly miscMarkerActive: "#00ffff";
8
+ };
@@ -161,5 +161,6 @@ export declare const themeConst: {
161
161
  edsDarkInteractivePrimaryHover: string;
162
162
  edsDarkInteractiveDisabledFill: string;
163
163
  edsDarkInteractiveDisabledText: string;
164
+ edsDarkTextStaticIconsSecondary: string;
164
165
  selectionIndicator: string;
165
166
  };