@kwantis-id3/frontend-library 0.27.2 → 1.0.0-rc.4

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 (51) hide show
  1. package/dist/esm/index.js +226 -61
  2. package/dist/esm/index.js.map +1 -1
  3. package/dist/esm/types/components/Accordion/Accordion.d.ts +3 -4
  4. package/dist/esm/types/components/Accordion/AccordionStyled.d.ts +4 -4
  5. package/dist/esm/types/components/Button/Button.d.ts +1 -2
  6. package/dist/esm/types/components/Card/Card.d.ts +15 -0
  7. package/dist/esm/types/components/Card/CardInterfaces.d.ts +6 -0
  8. package/dist/esm/types/components/Card/CardStyled.d.ts +24 -0
  9. package/dist/esm/types/components/Card/index.d.ts +2 -0
  10. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +6 -5
  11. package/dist/esm/types/components/Dropdown/DropdownStyled.d.ts +10 -11
  12. package/dist/esm/types/components/Indicator/ErrorIndicator.d.ts +3 -0
  13. package/dist/esm/types/components/Indicator/Indicator.d.ts +7 -0
  14. package/dist/esm/types/components/Indicator/IndicatorInterfaces.d.ts +11 -0
  15. package/dist/esm/types/components/Indicator/LiveIndicator.d.ts +3 -0
  16. package/dist/esm/types/components/Indicator/SuccessIndicator.d.ts +3 -0
  17. package/dist/esm/types/components/Indicator/WarningIndicator.d.ts +3 -0
  18. package/dist/esm/types/components/Indicator/index.d.ts +2 -0
  19. package/dist/esm/types/components/InputField/InputField.d.ts +1 -2
  20. package/dist/esm/types/components/InputField/StyledInputField.d.ts +2 -2
  21. package/dist/esm/types/components/Modal/StyledModal.d.ts +4 -2
  22. package/dist/esm/types/components/MultiViewList/MultiViewList.d.ts +3 -0
  23. package/dist/esm/types/components/MultiViewList/MultiViewListInterfaces.d.ts +6 -0
  24. package/dist/esm/types/components/MultiViewList/MultiViewListStyled.d.ts +4 -0
  25. package/dist/esm/types/components/MultiViewList/index.d.ts +2 -0
  26. package/dist/esm/types/components/SelectFilter/MultiSelect.d.ts +2 -4
  27. package/dist/esm/types/components/SelectFilter/SingleSelect.d.ts +2 -4
  28. package/dist/esm/types/components/Slider/Slider.d.ts +4 -6
  29. package/dist/esm/types/components/Slider/SliderStyled.d.ts +4 -4
  30. package/dist/esm/types/components/Table/DebouncedFilter.d.ts +7 -0
  31. package/dist/esm/types/components/Table/DebouncedInput.d.ts +6 -0
  32. package/dist/esm/types/components/Table/Table.d.ts +3 -0
  33. package/dist/esm/types/components/Table/TableInterfaces.d.ts +21 -0
  34. package/dist/esm/types/components/Table/TableStyled.d.ts +14 -0
  35. package/dist/esm/types/components/Table/index.d.ts +2 -0
  36. package/dist/esm/types/components/Tag/Tag.d.ts +24 -0
  37. package/dist/esm/types/components/Tag/index.d.ts +1 -0
  38. package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +5 -71
  39. package/dist/esm/types/components/ThemeContext/ThemeInterfaces.d.ts +109 -0
  40. package/dist/esm/types/components/ThemeContext/index.d.ts +2 -1
  41. package/dist/esm/types/components/index.d.ts +6 -1
  42. package/dist/esm/types/utils/colors.d.ts +20 -0
  43. package/dist/esm/types/utils/index.d.ts +3 -0
  44. package/dist/esm/types/utils/styled.d.ts +1 -38
  45. package/dist/esm/types/utils/testing.d.ts +54 -0
  46. package/dist/esm/types/utils/transientOptions.d.ts +7 -0
  47. package/dist/esm/types/utils/usePrefersColorScheme.d.ts +1 -0
  48. package/dist/index.d.ts +255 -85
  49. package/package.json +8 -6
  50. package/src/types/emotion.d.ts +8 -0
  51. package/src/types/tanstack.d.ts +7 -0
@@ -0,0 +1,109 @@
1
+ export type TColorScale = {
2
+ 50: string;
3
+ 100: string;
4
+ 200: string;
5
+ 300: string;
6
+ 400: string;
7
+ 500: string;
8
+ 600: string;
9
+ 700: string;
10
+ 800: string;
11
+ 900: string;
12
+ 950: string;
13
+ };
14
+ export interface ICommonColors {
15
+ red: TColorScale;
16
+ green: TColorScale;
17
+ blue: TColorScale;
18
+ yellow: TColorScale;
19
+ purple: TColorScale;
20
+ darkBlue: TColorScale;
21
+ orange: TColorScale;
22
+ gray: TColorScale;
23
+ }
24
+ export interface IBackgroundColors {
25
+ main: string;
26
+ radialGradient: string;
27
+ }
28
+ interface ISharedColorProperties {
29
+ /** Represents the color itself */
30
+ main: string;
31
+ /** A slightly different color derived from the main one */
32
+ variant: string;
33
+ }
34
+ export interface IStandardPaletteColor extends ISharedColorProperties {
35
+ /** The color to be used for text and elements that need to contrast with the main / variant */
36
+ contrast: string;
37
+ }
38
+ export interface ITagColors {
39
+ default: {
40
+ main: string;
41
+ text: string;
42
+ };
43
+ warm: {
44
+ main: string;
45
+ text: string;
46
+ };
47
+ cold: {
48
+ main: string;
49
+ text: string;
50
+ };
51
+ paper: {
52
+ main: string;
53
+ text: string;
54
+ };
55
+ }
56
+ export interface IIndicatorColors {
57
+ main: string;
58
+ mainFill: string;
59
+ success: string;
60
+ successFill: string;
61
+ warning: string;
62
+ warningFill: string;
63
+ error: string;
64
+ errorFill: string;
65
+ }
66
+ export interface IPalette {
67
+ /** Application background */
68
+ background: IBackgroundColors;
69
+ /** Primary Brand Color */
70
+ primary: IStandardPaletteColor;
71
+ /** Color config for actions solved with a success */
72
+ success: IStandardPaletteColor;
73
+ /** Color config for actions solved with a warning */
74
+ warning: IStandardPaletteColor;
75
+ /** Color config for actions solved with an error */
76
+ error: IStandardPaletteColor;
77
+ /** Color config for surfaces*/
78
+ surface: IStandardPaletteColor;
79
+ /** Color config for borders */
80
+ border: ISharedColorProperties;
81
+ /** Color config for tags */
82
+ tag: ITagColors;
83
+ /** Color config for indicators */
84
+ indicator: IIndicatorColors;
85
+ }
86
+ export type TThemeMode = "light" | "dark" | "system";
87
+ export interface IThemeContextProps {
88
+ /** From this prop you can override (even partially) the palettes (dark and light) of the library. */
89
+ palettes?: {
90
+ light?: Partial<IPalette>;
91
+ dark?: Partial<IPalette>;
92
+ };
93
+ defaultMode?: TThemeMode;
94
+ }
95
+ export interface IThemeContextValue {
96
+ /** Which mode is currently active */
97
+ mode: TThemeMode;
98
+ /** Which mode is currently displayed.
99
+ * This is useful when the mode is set to "system" and the user has a dark mode preference.
100
+ */
101
+ displayedMode: "light" | "dark";
102
+ /** A collection of common Colors with variants */
103
+ commonColors: ICommonColors;
104
+ /** This will contain the palette of the correct color mode. */
105
+ activePalette: IPalette;
106
+ /** use this function to change the mode */
107
+ setMode: (mode: TThemeMode) => void;
108
+ }
109
+ export {};
@@ -1 +1,2 @@
1
- export { ThemeColors, ThemeColorsObject, ThemeContextProps, ThemeProperties, ThemeContextProvider, useThemeContext, } from "./ThemeContext";
1
+ export * from "./ThemeContext";
2
+ export * from "./ThemeInterfaces";
@@ -1,8 +1,13 @@
1
1
  export { Button, ButtonProps } from "./Button";
2
- export { ThemeColors, ThemeColorsObject, ThemeContextProps, ThemeProperties, ThemeContextProvider, useThemeContext, } from "./ThemeContext";
2
+ export * from "./ThemeContext";
3
3
  export { Accordion, AccordionProps } from "./Accordion";
4
4
  export { InputField } from "./InputField";
5
5
  export { SingleSelect, SingleSelectProps, MultiSelect, MultiSelectProps, } from "./SelectFilter";
6
6
  export { Slider, SliderProps } from "./Slider";
7
7
  export { Dropdown, DropdownProps, DropdownItem } from "./Dropdown";
8
8
  export { Modal } from "./Modal";
9
+ export { TIndicatorProps, TIndicatorVariants, Indicator } from "./Indicator";
10
+ export { Tag, TTagProps } from "./Tag";
11
+ export { Card, CardHeader, CardContent, CardFooter, CardIndicators, CardMediaSection, TCardSectionProps, } from "./Card";
12
+ export { Table, renderCell, TTableProps, TTableCell, TCellValues, TTableRow, } from "./Table";
13
+ export { MultiViewList, TMultiViewListProps } from "./MultiViewList";
@@ -0,0 +1,20 @@
1
+ /**
2
+ *
3
+ * @param color the color to get the contrast color for
4
+ * @returns the most readable color between black and white
5
+ */
6
+ export declare const getContrastColor: (color: string) => string;
7
+ /**
8
+ *
9
+ * @param color the color to darken
10
+ * @param strength the strength (0-100) to darken the color
11
+ * @returns the color darkened by the strength
12
+ */
13
+ export declare const darkenColor: (color: string, strength?: number) => string;
14
+ /**
15
+ *
16
+ * @param color the color to lighten
17
+ * @param strength the strength (0-100) to lighten the color
18
+ * @returns the color lightened by the strength
19
+ */
20
+ export declare const lightenColor: (color: string, strength?: number) => string;
@@ -2,3 +2,6 @@ import useIsMobile from "./isMobile";
2
2
  export { transientOptions } from "./transientOptions";
3
3
  export { styled } from "./styled";
4
4
  export { useIsMobile };
5
+ export { getContrastColor } from "./colors";
6
+ export { darkenColor } from "./colors";
7
+ export { lightenColor } from "./colors";
@@ -1,39 +1,2 @@
1
- import { PropsOf } from "@emotion/react";
2
- import { CreateStyledComponent, StyledOptions, FilteringStyledOptions } from "@emotion/styled";
3
- import { ThemeContextProps } from "../components";
4
- export type StyledTags = {
5
- [Tag in keyof JSX.IntrinsicElements]: CreateStyledComponent<{
6
- theme?: ThemeContextProps;
7
- as?: React.ElementType;
8
- }, JSX.IntrinsicElements[Tag]>;
9
- };
10
- export interface BaseCreateStyled {
11
- <C extends React.ComponentClass<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> & string = keyof React.ComponentProps<C> & string>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & {
12
- theme?: ThemeContextProps;
13
- }, {}, {
14
- ref?: React.Ref<InstanceType<C>>;
15
- }>;
16
- <C extends React.ComponentClass<React.ComponentProps<C>>>(component: C, options?: StyledOptions<React.ComponentProps<C>>): CreateStyledComponent<PropsOf<C> & {
17
- theme?: ThemeContextProps;
18
- }, {}, {
19
- ref?: React.Ref<InstanceType<C>>;
20
- }>;
21
- <C extends React.ComponentType<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> & string = keyof React.ComponentProps<C> & string>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & {
22
- theme?: ThemeContextProps;
23
- }>;
24
- <C extends React.ComponentType<React.ComponentProps<C>>>(component: C, options?: StyledOptions<React.ComponentProps<C>>): CreateStyledComponent<PropsOf<C> & {
25
- theme?: ThemeContextProps;
26
- }>;
27
- <Tag extends keyof JSX.IntrinsicElements, ForwardedProps extends keyof JSX.IntrinsicElements[Tag] & string = keyof JSX.IntrinsicElements[Tag] & string>(tag: Tag, options: FilteringStyledOptions<JSX.IntrinsicElements[Tag], ForwardedProps>): CreateStyledComponent<{
28
- theme?: ThemeContextProps;
29
- as?: React.ElementType;
30
- }, Pick<JSX.IntrinsicElements[Tag], ForwardedProps>>;
31
- <Tag extends keyof JSX.IntrinsicElements>(tag: Tag, options?: StyledOptions<JSX.IntrinsicElements[Tag]>): CreateStyledComponent<{
32
- theme?: ThemeContextProps;
33
- as?: React.ElementType;
34
- }, JSX.IntrinsicElements[Tag]>;
35
- }
36
- interface CreateStyled extends BaseCreateStyled, StyledTags {
37
- }
1
+ import { CreateStyled } from "@emotion/styled";
38
2
  export declare const styled: CreateStyled;
39
- export {};
@@ -0,0 +1,54 @@
1
+ import { TCellValues, TTableRow } from "../components/index";
2
+ import React from "react";
3
+ import { IThemeContextProps } from "../components/ThemeContext/ThemeInterfaces";
4
+ import { RenderHookResult, RenderResult } from "@testing-library/react";
5
+ import { ColumnDef } from "@tanstack/react-table";
6
+ export declare const renderWithTheme: (ui: React.ReactElement, themeProps?: IThemeContextProps) => RenderResult;
7
+ export declare function renderHookWithTheme<T, R>(hook: (props: T) => R, themeProps?: IThemeContextProps): RenderHookResult<R, T>;
8
+ export declare const headingStyle: {
9
+ padding: string;
10
+ margin: string;
11
+ fontWeight: string;
12
+ };
13
+ export declare const templateColumns: ColumnDef<TTableRow<TCellValues>, TCellValues>[];
14
+ export declare const templateTableData: {
15
+ cells: {
16
+ well_name: {
17
+ value: string;
18
+ };
19
+ is_live: {
20
+ value: boolean;
21
+ };
22
+ well_profile: {
23
+ value: string;
24
+ };
25
+ country: {
26
+ value: string;
27
+ };
28
+ spud: {
29
+ value: string;
30
+ };
31
+ rig: {
32
+ value: string;
33
+ };
34
+ rig_type: {
35
+ value: string;
36
+ };
37
+ bu: {
38
+ value: string;
39
+ };
40
+ contractor: {
41
+ value: string;
42
+ };
43
+ data_quality: {
44
+ value: number;
45
+ };
46
+ last_sensors_data: {
47
+ value: string;
48
+ };
49
+ last_ddr: {
50
+ value: string;
51
+ };
52
+ };
53
+ }[];
54
+ export declare const TemplateCard: (item: TTableRow<TCellValues>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,2 +1,9 @@
1
1
  import { CreateStyled } from "@emotion/styled";
2
+ /**
3
+ * emotion.js doesn't support transient options out of the box.
4
+ *
5
+ * Without them, you will get a warning in the console for every custom prop that you pass to a styled component, since it will be forwarded to the DOM.
6
+ * This specific opt-in utility copies the styled-component approach; if used, props starting with `$` will not be passed to the DOM.
7
+ * @see https://github.com/emotion-js/emotion/issues/2193#issuecomment-766173118
8
+ */
2
9
  export declare const transientOptions: Parameters<CreateStyled>[1];
@@ -0,0 +1 @@
1
+ export declare function usePrefersColorScheme(): "light" | "dark";