@equinor/apollo-components 3.1.1 → 3.1.2-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.
package/dist/index.d.ts CHANGED
@@ -1,41 +1,13 @@
1
- export * from 'apollo-common';
2
1
  import { IconData } from '@equinor/eds-icons';
3
2
  import * as react from 'react';
4
- import { ReactNode, ReactElement, HTMLProps, MutableRefObject, Dispatch, SetStateAction } from 'react';
3
+ import { ReactNode, ReactElement, HTMLProps, MutableRefObject, Dispatch, SetStateAction, SyntheticEvent } from 'react';
5
4
  import * as styled_components from 'styled-components';
6
5
  import * as _equinor_eds_core_react from '@equinor/eds-core-react';
7
- import { CellProps } from '@equinor/eds-core-react';
6
+ import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-core-react';
8
7
  import { Cell, Header, CellContext, Table, Row, SortingState, OnChangeFn, ColumnDef, RowSelectionState, ExpandedState, VisibilityState, HeaderContext } from '@tanstack/react-table';
9
8
  import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
10
9
  import { SetRequired } from 'type-fest';
11
10
 
12
- declare type FormMeta = {
13
- _isNew?: boolean;
14
- _editMode?: boolean;
15
- _hasRemoteChange?: boolean;
16
- };
17
- declare type WithoutFormMeta<T extends FormMeta> = Omit<T, keyof FormMeta>;
18
-
19
- /**
20
- * Subscribes to the `_editMode` field in a `react-hook-form` context.
21
- *
22
- * @returns edit mode value
23
- */
24
- declare function useEditMode(): boolean;
25
- /**
26
- * Subscribes to the `_hasRemoteChange` field in a `react-hook-form` context.
27
- *
28
- * @returns edit mode value
29
- */
30
- declare function useHasRemoteChange(): boolean;
31
- /**
32
- * @returns function getting is new meta
33
- */
34
- declare function useGetIsNew(): () => boolean;
35
- declare function useSetFormMeta<T extends FormMeta>(): (newValues: Partial<T>) => void;
36
- declare function removeFormMeta<T extends FormMeta>(withFormMeta: T): Omit<T, keyof FormMeta>;
37
- declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
38
-
39
11
  interface AppShellProps {
40
12
  children?: ReactNode;
41
13
  sidebar?: ReactNode;
@@ -73,6 +45,13 @@ declare type HierarchyCellOptions = {
73
45
  };
74
46
  declare function HierarchyCell<T>(cell: CellContext<T, any>, options?: HierarchyCellOptions): JSX.Element;
75
47
 
48
+ interface PopoverCellProps {
49
+ id: string;
50
+ value: string;
51
+ title?: string | JSX.Element | ReactNode;
52
+ }
53
+ declare const PopoverCell: (props: PopoverCellProps) => JSX.Element;
54
+
76
55
  interface ColumnSelectProps<T> {
77
56
  table: Table<T>;
78
57
  }
@@ -211,6 +190,11 @@ declare const leftCellShadow: styled_components.FlattenSimpleInterpolation;
211
190
  declare const StickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, {} & CellProps, never>;
212
191
  declare const StickyHeaderCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, ({} & CellProps) & CellProps, never>;
213
192
 
193
+ declare type TypographyProps = {
194
+ truncate?: boolean;
195
+ } & TypographyProps$1;
196
+ declare const TypographyCustom: (props: TypographyProps) => JSX.Element;
197
+
214
198
  /**
215
199
  * Generate a HSL color based on a given string.
216
200
  *
@@ -218,5 +202,84 @@ declare const StickyHeaderCell: styled_components.StyledComponent<react.ForwardR
218
202
  * @returns A valid hsl color
219
203
  */
220
204
  declare function stringToHslColor(str: string, s?: number, l?: number): string;
205
+ /** Wrap an event handler and stop event propagation */
206
+ declare function stopPropagation<T extends HTMLElement>(handler: (e: SyntheticEvent<T>) => void): (e: SyntheticEvent<T>) => void;
207
+
208
+ declare type FormMeta = {
209
+ _isNew?: boolean;
210
+ _editMode?: boolean;
211
+ _hasRemoteChange?: boolean;
212
+ };
213
+ declare type WithoutFormMeta<T extends FormMeta> = Omit<T, keyof FormMeta>;
214
+
215
+ /**
216
+ * Subscribes to the `_editMode` field in a `react-hook-form` context.
217
+ *
218
+ * @returns edit mode value
219
+ */
220
+ declare function useEditMode(): boolean;
221
+ /**
222
+ * Subscribes to the `_hasRemoteChange` field in a `react-hook-form` context.
223
+ *
224
+ * @returns edit mode value
225
+ */
226
+ declare function useHasRemoteChange(): boolean;
227
+ /**
228
+ * @returns function getting is new meta
229
+ */
230
+ declare function useGetIsNew(): () => boolean;
231
+ declare function useSetFormMeta<T extends FormMeta>(): (newValues: Partial<T>) => void;
232
+ declare function removeFormMeta<T extends FormMeta>(withFormMeta: T): Omit<T, keyof FormMeta>;
233
+ declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
234
+
235
+ declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T, boolean>): JSX.Element;
236
+
237
+ interface EditableDateCellProps<T extends FormMeta> extends CellContext<T, unknown> {
238
+ dateStringFormatter?: (date: string) => string;
239
+ }
240
+ declare function EditableDateCell<T extends FormMeta>(props: EditableDateCellProps<T>): JSX.Element;
241
+
242
+ interface Option {
243
+ label: string;
244
+ value: string;
245
+ }
246
+ interface EditableDropdownCellProps<T extends FormMeta> extends CellContext<T, unknown> {
247
+ /**
248
+ * `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
249
+ */
250
+ options: Option[];
251
+ }
252
+ declare function EditableDropdownCell<T extends FormMeta>(props: EditableDropdownCellProps<T>): JSX.Element;
253
+ declare const AutocompleteCustom: styled_components.StyledComponent<(<T>(props: {
254
+ options: T[];
255
+ label: string;
256
+ initialSelectedOptions?: T[] | undefined;
257
+ meta?: string | undefined;
258
+ disabled?: boolean | undefined;
259
+ readOnly?: boolean | undefined;
260
+ hideClearButton?: boolean | undefined;
261
+ selectedOptions?: T[] | undefined;
262
+ onOptionsChange?: ((changes: _equinor_eds_core_react.AutocompleteChanges<T>) => void) | undefined;
263
+ multiple?: boolean | undefined;
264
+ optionLabel?: ((option: T) => string) | undefined;
265
+ disablePortal?: boolean | undefined;
266
+ optionDisabled?: ((option: T) => boolean) | undefined;
267
+ optionsFilter?: ((option: T, inputValue: string) => boolean) | undefined;
268
+ autoWidth?: boolean | undefined;
269
+ placeholder?: string | undefined;
270
+ clearSearchOnChange?: boolean | undefined;
271
+ } & react.HTMLAttributes<HTMLDivElement> & {
272
+ ref?: react.ForwardedRef<HTMLDivElement> | undefined;
273
+ displayName?: string | undefined;
274
+ }) => JSX.Element), any, {}, never>;
275
+
276
+ declare function EditableNumberCell<T extends FormMeta>(context: CellContext<T, number>): JSX.Element;
277
+
278
+ interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
279
+ title: string;
280
+ }
281
+ declare function EditableTextAreaCell<T extends FormMeta>(props: EdtiableTextAreaProps<T>): JSX.Element;
282
+
283
+ declare function EditableTextFieldCell<T extends FormMeta>(context: CellContext<T, unknown>): JSX.Element;
221
284
 
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 };
285
+ 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, leftCellShadow, prependSelectColumn, removeFormMeta, stopPropagation, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };