@equinor/apollo-components 3.1.0 → 3.1.1

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
@@ -1,40 +1,13 @@
1
+ export * from 'apollo-common';
1
2
  import { IconData } from '@equinor/eds-icons';
2
3
  import * as react from 'react';
3
- import { ReactNode, ReactElement, HTMLProps, MutableRefObject, Dispatch, SetStateAction, SyntheticEvent } from 'react';
4
+ import { ReactNode, ReactElement, HTMLProps, MutableRefObject, Dispatch, SetStateAction } from 'react';
4
5
  import * as styled_components from 'styled-components';
5
6
  import * as _equinor_eds_core_react from '@equinor/eds-core-react';
6
- import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-core-react';
7
- import { Cell, CellContext, Header, Table, Row, SortingState, OnChangeFn, ColumnDef, RowSelectionState, ExpandedState, VisibilityState, HeaderContext } from '@tanstack/react-table';
7
+ import { CellProps } from '@equinor/eds-core-react';
8
+ import { Cell, Header, CellContext, Table, Row, SortingState, OnChangeFn, ColumnDef, RowSelectionState, ExpandedState, VisibilityState, HeaderContext } from '@tanstack/react-table';
8
9
  import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
9
10
  import { SetRequired } from 'type-fest';
10
- import { Variants } from '@equinor/eds-core-react/dist/types/components/types';
11
- import { FieldError } from 'react-hook-form';
12
-
13
- interface AppShellProps {
14
- children?: ReactNode;
15
- sidebar?: ReactNode;
16
- icon?: IconData;
17
- title?: string;
18
- }
19
- declare const AppShell: ({ children, icon, title, sidebar }: AppShellProps) => JSX.Element;
20
-
21
- declare function AppSidebar(): JSX.Element;
22
-
23
- declare const ChipsCell: (props: {
24
- values?: string[];
25
- }) => JSX.Element;
26
-
27
- declare type TableCellProps<T> = {
28
- cell: Cell<T, unknown>;
29
- highlight?: boolean;
30
- getStickyCellColor?: (cell: Cell<T, unknown>) => string;
31
- };
32
- declare type StyledStickyCellProps = {
33
- highlight?: boolean;
34
- backgroundColor?: string;
35
- };
36
- declare const StyledStickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<_equinor_eds_core_react.CellProps & react.RefAttributes<HTMLTableCellElement>>, any, ({} & _equinor_eds_core_react.CellProps) & StyledStickyCellProps, never>;
37
- declare function DynamicCell<T>({ cell, highlight, getStickyCellColor }: TableCellProps<T>): JSX.Element;
38
11
 
39
12
  declare type FormMeta = {
40
13
  _isNew?: boolean;
@@ -63,55 +36,31 @@ declare function useSetFormMeta<T extends FormMeta>(): (newValues: Partial<T>) =
63
36
  declare function removeFormMeta<T extends FormMeta>(withFormMeta: T): Omit<T, keyof FormMeta>;
64
37
  declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
65
38
 
66
- declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T, boolean>): JSX.Element;
67
-
68
- interface EditableDateCellProps<T extends FormMeta> extends CellContext<T, unknown> {
69
- dateStringFormatter?: (date: string) => string;
70
- }
71
- declare function EditableDateCell<T extends FormMeta>(props: EditableDateCellProps<T>): JSX.Element;
72
-
73
- interface Option {
74
- label: string;
75
- value: string;
76
- }
77
- interface EditableDropdownCellProps<T extends FormMeta> extends CellContext<T, unknown> {
78
- /**
79
- * `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
80
- */
81
- options: Option[];
39
+ interface AppShellProps {
40
+ children?: ReactNode;
41
+ sidebar?: ReactNode;
42
+ icon?: IconData;
43
+ title?: string;
82
44
  }
83
- declare function EditableDropdownCell<T extends FormMeta>(props: EditableDropdownCellProps<T>): JSX.Element;
84
- declare const AutocompleteCustom: styled_components.StyledComponent<(<T>(props: {
85
- options: T[];
86
- label: string;
87
- initialSelectedOptions?: T[] | undefined;
88
- meta?: string | undefined;
89
- disabled?: boolean | undefined;
90
- readOnly?: boolean | undefined;
91
- hideClearButton?: boolean | undefined;
92
- selectedOptions?: T[] | undefined;
93
- onOptionsChange?: ((changes: _equinor_eds_core_react.AutocompleteChanges<T>) => void) | undefined;
94
- multiple?: boolean | undefined;
95
- optionLabel?: ((option: T) => string) | undefined;
96
- disablePortal?: boolean | undefined;
97
- optionDisabled?: ((option: T) => boolean) | undefined;
98
- optionsFilter?: ((option: T, inputValue: string) => boolean) | undefined;
99
- autoWidth?: boolean | undefined;
100
- placeholder?: string | undefined;
101
- clearSearchOnChange?: boolean | undefined;
102
- } & react.HTMLAttributes<HTMLDivElement> & {
103
- ref?: react.ForwardedRef<HTMLDivElement> | undefined;
104
- displayName?: string | undefined;
105
- }) => JSX.Element), any, {}, never>;
45
+ declare const AppShell: ({ children, icon, title, sidebar }: AppShellProps) => JSX.Element;
106
46
 
107
- declare function EditableNumberCell<T extends FormMeta>(context: CellContext<T, number>): JSX.Element;
47
+ declare function AppSidebar(): JSX.Element;
108
48
 
109
- interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
110
- dialogTitle: string;
111
- }
112
- declare function EditableTextAreaCell<T extends FormMeta>(props: EdtiableTextAreaProps<T>): JSX.Element;
49
+ declare const ChipsCell: (props: {
50
+ values?: string[];
51
+ }) => JSX.Element;
113
52
 
114
- declare function EditableTextFieldCell<T extends FormMeta>(context: CellContext<T, unknown>): JSX.Element;
53
+ declare type TableCellProps<T> = {
54
+ cell: Cell<T, unknown>;
55
+ highlight?: boolean;
56
+ getStickyCellColor?: (cell: Cell<T, unknown>) => string;
57
+ };
58
+ declare type StyledStickyCellProps = {
59
+ highlight?: boolean;
60
+ backgroundColor?: string;
61
+ };
62
+ declare const StyledStickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<_equinor_eds_core_react.CellProps & react.RefAttributes<HTMLTableCellElement>>, any, ({} & _equinor_eds_core_react.CellProps) & StyledStickyCellProps, never>;
63
+ declare function DynamicCell<T>({ cell, highlight, getStickyCellColor }: TableCellProps<T>): JSX.Element;
115
64
 
116
65
  interface HeaderCellProps<TData, TValue> {
117
66
  header: Header<TData, TValue>;
@@ -124,13 +73,6 @@ declare type HierarchyCellOptions = {
124
73
  };
125
74
  declare function HierarchyCell<T>(cell: CellContext<T, any>, options?: HierarchyCellOptions): JSX.Element;
126
75
 
127
- interface PopoverCellProps {
128
- id: string;
129
- value: string;
130
- title?: string | JSX.Element | ReactNode;
131
- }
132
- declare const PopoverCell: (props: PopoverCellProps) => JSX.Element;
133
-
134
76
  interface ColumnSelectProps<T> {
135
77
  table: Table<T>;
136
78
  }
@@ -269,11 +211,6 @@ declare const leftCellShadow: styled_components.FlattenSimpleInterpolation;
269
211
  declare const StickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, {} & CellProps, never>;
270
212
  declare const StickyHeaderCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, ({} & CellProps) & CellProps, never>;
271
213
 
272
- declare type TypographyProps = {
273
- truncate?: boolean;
274
- } & TypographyProps$1;
275
- declare const TypographyCustom: (props: TypographyProps) => JSX.Element;
276
-
277
214
  /**
278
215
  * Generate a HSL color based on a given string.
279
216
  *
@@ -281,20 +218,5 @@ declare const TypographyCustom: (props: TypographyProps) => JSX.Element;
281
218
  * @returns A valid hsl color
282
219
  */
283
220
  declare function stringToHslColor(str: string, s?: number, l?: number): string;
284
- /** Wrap an event handler and stop event propagation */
285
- declare function stopPropagation<T extends HTMLElement>(handler: (e: SyntheticEvent<T>) => void): (e: SyntheticEvent<T>) => void;
286
- interface GetHelperTextPropsProps {
287
- error?: FieldError;
288
- warning?: {
289
- message: string;
290
- };
291
- helperText?: string;
292
- }
293
- interface GetHelperTextProps {
294
- variant?: Variants;
295
- helperText?: string;
296
- helperIcon: JSX.Element | null;
297
- }
298
- declare function getHelperTextProps({ error, warning, helperText, }: GetHelperTextPropsProps): GetHelperTextProps;
299
221
 
300
- export { AppShell, AppSidebar, AutocompleteCustom, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableProps, DynamicCell, EditableCheckboxCell, EditableDateCell, EditableDateCellProps, EditableDropdownCell, EditableDropdownCellProps, EditableNumberCell, EditableTextAreaCell, EditableTextFieldCell, FormMeta, HTMLPropsRef, HeaderCell, HierarchyCell, InfiniteScrollConfig, Option, PopoverCell, RowConfig, RowSelectionMode, SelectColumnDef, SortConfig, StickyCell, StickyHeaderCell, StyledStickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, TypographyCustom, TypographyProps, WithoutFormMeta, addFormMeta, capitalizeHeader, getHelperTextProps, leftCellShadow, prependSelectColumn, removeFormMeta, stopPropagation, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };
222
+ export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableProps, DynamicCell, FormMeta, HTMLPropsRef, HeaderCell, HierarchyCell, InfiniteScrollConfig, RowConfig, RowSelectionMode, SelectColumnDef, SortConfig, StickyCell, StickyHeaderCell, StyledStickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, WithoutFormMeta, addFormMeta, capitalizeHeader, leftCellShadow, prependSelectColumn, removeFormMeta, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };