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

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 (39) hide show
  1. package/dist/esm/index.js +109 -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/SelectFilter/MultiSelect.d.ts +2 -4
  23. package/dist/esm/types/components/SelectFilter/SingleSelect.d.ts +2 -4
  24. package/dist/esm/types/components/Slider/Slider.d.ts +4 -6
  25. package/dist/esm/types/components/Slider/SliderStyled.d.ts +4 -4
  26. package/dist/esm/types/components/Tag/Tag.d.ts +24 -0
  27. package/dist/esm/types/components/Tag/index.d.ts +1 -0
  28. package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +5 -71
  29. package/dist/esm/types/components/ThemeContext/ThemeInterfaces.d.ts +109 -0
  30. package/dist/esm/types/components/ThemeContext/index.d.ts +2 -1
  31. package/dist/esm/types/components/index.d.ts +4 -1
  32. package/dist/esm/types/utils/colors.d.ts +20 -0
  33. package/dist/esm/types/utils/index.d.ts +3 -0
  34. package/dist/esm/types/utils/styled.d.ts +1 -38
  35. package/dist/esm/types/utils/testing.d.ts +5 -0
  36. package/dist/esm/types/utils/transientOptions.d.ts +7 -0
  37. package/dist/esm/types/utils/usePrefersColorScheme.d.ts +1 -0
  38. package/dist/index.d.ts +223 -85
  39. package/package.json +4 -4
@@ -1,8 +1,11 @@
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";
@@ -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,5 @@
1
+ import React from "react";
2
+ import { IThemeContextProps } from "../components/ThemeContext/ThemeInterfaces";
3
+ import { RenderHookResult, RenderResult } from "@testing-library/react";
4
+ export declare const renderWithTheme: (ui: React.ReactElement, themeProps?: IThemeContextProps) => RenderResult;
5
+ export declare function renderHookWithTheme<T, R>(hook: (props: T) => R, themeProps?: IThemeContextProps): RenderHookResult<R, T>;
@@ -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";
package/dist/index.d.ts CHANGED
@@ -1,42 +1,13 @@
1
1
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default from 'react';
4
- import { Interpolation, CreateStyled as CreateStyled$1, CreateStyledComponent, FilteringStyledOptions, StyledOptions } from '@emotion/styled';
5
- import { Theme, PropsOf } from '@emotion/react';
6
-
7
- interface Color {
8
- main: string;
9
- contrastText: string;
10
- }
11
- interface ThemeColorsObject {
12
- primary: Color;
13
- secondary: Color;
14
- tertiary: Color;
15
- statusOk: Color;
16
- statusWarning: Color;
17
- statusCritical: Color;
18
- statusNeutral: Color;
19
- }
20
- interface ThemeContextProps {
21
- colors: ThemeColorsObject;
22
- }
23
- interface Nothing {
24
- }
25
- type Union<T, U> = T | (U & Nothing);
26
- type ThemeColors = keyof ThemeColorsObject;
27
- type ThemeColorsExtended = Union<ThemeColors, string>;
28
- type ThemeProperties = ThemeContextProps & {
29
- getColor: (color: ThemeColorsExtended) => Color;
30
- };
31
- declare const ThemeContextProvider: (props: React__default.PropsWithChildren<{
32
- theme?: ThemeContextProps;
33
- }>) => React__default.JSX.Element;
34
- declare const useThemeContext: () => ThemeProperties;
3
+ import React__default, { FC, PropsWithChildren } from 'react';
4
+ import { Interpolation, CreateStyled } from '@emotion/styled';
5
+ import { Theme, Interpolation as Interpolation$1 } from '@emotion/react';
35
6
 
36
7
  type ButtonVariants = "contained" | "outlined" | "text";
37
8
  type ButtonProps = {
38
9
  /** Color of the button */
39
- color?: ThemeColorsExtended;
10
+ color?: string;
40
11
  /** Type of the button */
41
12
  type?: "button" | "submit" | "reset";
42
13
  /** Custom styles */
@@ -55,6 +26,120 @@ type ButtonProps = {
55
26
  };
56
27
  declare const Button: (props: ButtonProps) => _emotion_react_jsx_runtime.JSX.Element;
57
28
 
29
+ type TColorScale = {
30
+ 50: string;
31
+ 100: string;
32
+ 200: string;
33
+ 300: string;
34
+ 400: string;
35
+ 500: string;
36
+ 600: string;
37
+ 700: string;
38
+ 800: string;
39
+ 900: string;
40
+ 950: string;
41
+ };
42
+ interface ICommonColors {
43
+ red: TColorScale;
44
+ green: TColorScale;
45
+ blue: TColorScale;
46
+ yellow: TColorScale;
47
+ purple: TColorScale;
48
+ darkBlue: TColorScale;
49
+ orange: TColorScale;
50
+ gray: TColorScale;
51
+ }
52
+ interface IBackgroundColors {
53
+ main: string;
54
+ radialGradient: string;
55
+ }
56
+ interface ISharedColorProperties {
57
+ /** Represents the color itself */
58
+ main: string;
59
+ /** A slightly different color derived from the main one */
60
+ variant: string;
61
+ }
62
+ interface IStandardPaletteColor extends ISharedColorProperties {
63
+ /** The color to be used for text and elements that need to contrast with the main / variant */
64
+ contrast: string;
65
+ }
66
+ interface ITagColors {
67
+ default: {
68
+ main: string;
69
+ text: string;
70
+ };
71
+ warm: {
72
+ main: string;
73
+ text: string;
74
+ };
75
+ cold: {
76
+ main: string;
77
+ text: string;
78
+ };
79
+ paper: {
80
+ main: string;
81
+ text: string;
82
+ };
83
+ }
84
+ interface IIndicatorColors {
85
+ main: string;
86
+ mainFill: string;
87
+ success: string;
88
+ successFill: string;
89
+ warning: string;
90
+ warningFill: string;
91
+ error: string;
92
+ errorFill: string;
93
+ }
94
+ interface IPalette {
95
+ /** Application background */
96
+ background: IBackgroundColors;
97
+ /** Primary Brand Color */
98
+ primary: IStandardPaletteColor;
99
+ /** Color config for actions solved with a success */
100
+ success: IStandardPaletteColor;
101
+ /** Color config for actions solved with a warning */
102
+ warning: IStandardPaletteColor;
103
+ /** Color config for actions solved with an error */
104
+ error: IStandardPaletteColor;
105
+ /** Color config for surfaces*/
106
+ surface: IStandardPaletteColor;
107
+ /** Color config for borders */
108
+ border: ISharedColorProperties;
109
+ /** Color config for tags */
110
+ tag: ITagColors;
111
+ /** Color config for indicators */
112
+ indicator: IIndicatorColors;
113
+ }
114
+ type TThemeMode = "light" | "dark" | "system";
115
+ interface IThemeContextProps {
116
+ /** From this prop you can override (even partially) the palettes (dark and light) of the library. */
117
+ palettes?: {
118
+ light?: Partial<IPalette>;
119
+ dark?: Partial<IPalette>;
120
+ };
121
+ defaultMode?: TThemeMode;
122
+ }
123
+ interface IThemeContextValue {
124
+ /** Which mode is currently active */
125
+ mode: TThemeMode;
126
+ /** Which mode is currently displayed.
127
+ * This is useful when the mode is set to "system" and the user has a dark mode preference.
128
+ */
129
+ displayedMode: "light" | "dark";
130
+ /** A collection of common Colors with variants */
131
+ commonColors: ICommonColors;
132
+ /** This will contain the palette of the correct color mode. */
133
+ activePalette: IPalette;
134
+ /** use this function to change the mode */
135
+ setMode: (mode: TThemeMode) => void;
136
+ }
137
+
138
+ declare const defaultLightPalette: IPalette;
139
+ declare const defaultDarkPalette: IPalette;
140
+ declare const ThemeContextProvider: ({ palettes, defaultMode, children, }: React__default.PropsWithChildren<IThemeContextProps>) => JSX.Element;
141
+ declare const useThemeContext: () => IThemeContextValue;
142
+
58
143
  type AccordionProps = {
59
144
  /** Text of the accordion trigger */
60
145
  title: string;
@@ -65,11 +150,11 @@ type AccordionProps = {
65
150
  /** Works only if uncontrolled (isOpen props is not present) */
66
151
  defaultOpen?: boolean;
67
152
  /** Color of the accordion */
68
- color?: ThemeColorsExtended;
153
+ color?: string;
69
154
  /** Color of the icon */
70
- iconColor?: ThemeColorsExtended;
155
+ iconColor?: string;
71
156
  /** Color of the divider */
72
- dividerColor?: ThemeColorsExtended;
157
+ dividerColor?: string;
73
158
  /** Hide the icon */
74
159
  hideIcon?: boolean;
75
160
  /** Hide the divider */
@@ -95,7 +180,7 @@ interface TextFieldProps extends React__default.InputHTMLAttributes<HTMLInputEle
95
180
  /** Disables the input */
96
181
  isDisabled?: boolean;
97
182
  /** The color of the input */
98
- color?: ThemeColorsExtended;
183
+ color?: string;
99
184
  /** Change the styles of the input field */
100
185
  sx?: React__default.CSSProperties;
101
186
  }
@@ -130,7 +215,7 @@ interface SingleSelectProps<Option = {
130
215
  /** Wether the select is loading */
131
216
  isLoading?: boolean;
132
217
  /** The color of the select */
133
- color?: ThemeColorsExtended;
218
+ color?: string;
134
219
  /** The HTML id of the container */
135
220
  containerId?: string;
136
221
  /** The HTML id of the select */
@@ -144,7 +229,7 @@ interface SingleSelectProps<Option = {
144
229
  /** Wether the select is required */
145
230
  required?: boolean;
146
231
  }
147
- declare const SingleSelect: <Option>(props: SingleSelectProps<Option>) => React__default.JSX.Element;
232
+ declare const SingleSelect: <Option>(props: SingleSelectProps<Option>) => _emotion_react_jsx_runtime.JSX.Element;
148
233
 
149
234
  interface MultiSelectProps<Option = {
150
235
  label: string;
@@ -175,7 +260,7 @@ interface MultiSelectProps<Option = {
175
260
  /** Wether the select is loading */
176
261
  isLoading?: boolean;
177
262
  /** The color of the select */
178
- color?: ThemeColorsExtended;
263
+ color?: string;
179
264
  /** The HTML id of the container */
180
265
  containerId?: string;
181
266
  /** The HTML id of the select */
@@ -187,7 +272,7 @@ interface MultiSelectProps<Option = {
187
272
  /** Wether the select is required */
188
273
  required?: boolean;
189
274
  }
190
- declare const MultiSelect: <Option>(props: MultiSelectProps<Option>) => React__default.JSX.Element;
275
+ declare const MultiSelect: <Option>(props: MultiSelectProps<Option>) => _emotion_react_jsx_runtime.JSX.Element;
191
276
 
192
277
  type SliderProps = {
193
278
  /** The values of the slider. */
@@ -201,11 +286,11 @@ type SliderProps = {
201
286
  /** The onFinalChange handler of the slider. (called only when the thumb is released) */
202
287
  onFinalChange?: (values: number[]) => void;
203
288
  /** The color of the slider */
204
- color?: ThemeColorsExtended;
289
+ color?: string;
205
290
  /** The color of the section not included in the range */
206
- unselectedColor?: ThemeColorsExtended;
291
+ unselectedColor?: string;
207
292
  /** The color of the thumb */
208
- thumbColor?: ThemeColorsExtended;
293
+ thumbColor?: string;
209
294
  /** The HTML id of the slider */
210
295
  htmlId?: string;
211
296
  /** The class name of the slider */
@@ -221,11 +306,11 @@ type SliderProps = {
221
306
  /** Wether the thumbs can overlap */
222
307
  allowOverlap?: boolean;
223
308
  };
224
- declare const Slider: (props: SliderProps) => React__default.JSX.Element;
309
+ declare const Slider: (props: SliderProps) => _emotion_react_jsx_runtime.JSX.Element;
225
310
 
226
311
  /**
227
312
  * @property {string} value - The value displayed in the dropdown item
228
- * @property {ThemeColorsExtended} color - The color of the dropdown item
313
+ * @property {string} color - The color of the dropdown item
229
314
  * @property {string} textColor - The text color of the dropdown item
230
315
  * @property {DropdownItem[]} children - The children of the dropdown item
231
316
  * @property {() => void} onClick - The onClick handler of the dropdown item
@@ -234,9 +319,11 @@ type DropdownItem = {
234
319
  /** The value displayed in the item */
235
320
  value: string;
236
321
  /** The color of the item */
237
- color?: ThemeColorsExtended;
322
+ bgColor?: string;
238
323
  /** The text color of the item */
239
324
  textColor?: string;
325
+ /** The hover color of the item */
326
+ hoverColor?: string;
240
327
  /** The children of the item */
241
328
  children?: DropdownItem[];
242
329
  /** Wether the item is hidden or not */
@@ -252,9 +339,9 @@ type DropdownProps = {
252
339
  /** The trigger element of the dropdown. Clicking on this item will open the dropdown */
253
340
  trigger: React__default.ReactNode;
254
341
  /** The color of the dropdown */
255
- color?: ThemeColorsExtended;
342
+ bgColor?: string;
256
343
  /** The hover color of the dropdown */
257
- hoverColor?: ThemeColorsExtended;
344
+ hoverColor?: string;
258
345
  /** Controls wether the dropdown should extend towards the left or the right */
259
346
  direction?: "left" | "right";
260
347
  /** The mobile breakpoint, by default it's 768px */
@@ -280,6 +367,63 @@ interface ModalProps {
280
367
  }
281
368
  declare const Modal: React__default.FC<ModalProps>;
282
369
 
370
+ type TIndicatorInstanceProps = {
371
+ outerColor?: string;
372
+ innerColor?: string;
373
+ size?: number;
374
+ title?: string;
375
+ onClick?: (e: React.MouseEvent<SVGSVGElement>) => void;
376
+ };
377
+ type TIndicatorProps = {
378
+ variant: TIndicatorVariants;
379
+ } & TIndicatorInstanceProps;
380
+ type TIndicatorVariants = "live" | "success" | "warning" | "error";
381
+
382
+ type TGenericIndicatorProps = {
383
+ variant: TIndicatorVariants;
384
+ } & TIndicatorProps;
385
+ declare const Indicator: FC<TGenericIndicatorProps>;
386
+
387
+ type TTagProps = {
388
+ text: string;
389
+ /**
390
+ * If `variant` is set to `custom`, `bgColor` and `textColor` will be used.
391
+ * Otherwise, the `variant` will be used to determine the colors.
392
+ *
393
+ * The variants are the keys of the interface `@see ITagColors`, which by default are:
394
+ * - `default`
395
+ * - `warm`
396
+ * - `cold`
397
+ * - `paper`
398
+ */
399
+ variant: keyof ITagColors | "custom";
400
+ /** To use this prop, the variant must be set to `custom` */
401
+ bgColor?: string;
402
+ /** To use this prop, the variant must be set to `custom` */
403
+ textColor?: string;
404
+ sx?: Interpolation<Theme>;
405
+ };
406
+ declare const Tag: FC<TTagProps>;
407
+
408
+ type TCardSectionProps = PropsWithChildren & {
409
+ sx?: Interpolation$1<Theme>;
410
+ onClick?: (e: React__default.MouseEvent<HTMLElement>) => void;
411
+ };
412
+
413
+ /** @jsxImportSource @emotion/react */
414
+
415
+ /**
416
+ * The Card component is a container component that can be used to display content in a structured way.
417
+ * It has 3 possible sizes: small, medium and large.
418
+ *
419
+ */
420
+ declare const Card: FC<TCardSectionProps>;
421
+ declare const CardHeader: FC<TCardSectionProps>;
422
+ declare const CardContent: FC<TCardSectionProps>;
423
+ declare const CardFooter: FC<TCardSectionProps>;
424
+ declare const CardIndicators: FC<TCardSectionProps>;
425
+ declare const CardMediaSection: FC<TCardSectionProps>;
426
+
283
427
  /**
284
428
  * Hook to check if the screen is mobile. The default breakpoint is 768px.
285
429
  * @param {number=} mobileBreakpoint breakpoint width to check against
@@ -287,42 +431,36 @@ declare const Modal: React__default.FC<ModalProps>;
287
431
  */
288
432
  declare const useIsMobile: (mobileBreakpoint?: number) => boolean;
289
433
 
290
- declare const transientOptions: Parameters<CreateStyled$1>[1];
434
+ /**
435
+ * emotion.js doesn't support transient options out of the box.
436
+ *
437
+ * 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.
438
+ * This specific opt-in utility copies the styled-component approach; if used, props starting with `$` will not be passed to the DOM.
439
+ * @see https://github.com/emotion-js/emotion/issues/2193#issuecomment-766173118
440
+ */
441
+ declare const transientOptions: Parameters<CreateStyled>[1];
291
442
 
292
- type StyledTags = {
293
- [Tag in keyof JSX.IntrinsicElements]: CreateStyledComponent<{
294
- theme?: ThemeContextProps;
295
- as?: React.ElementType;
296
- }, JSX.IntrinsicElements[Tag]>;
297
- };
298
- interface BaseCreateStyled {
299
- <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> & {
300
- theme?: ThemeContextProps;
301
- }, {}, {
302
- ref?: React.Ref<InstanceType<C>>;
303
- }>;
304
- <C extends React.ComponentClass<React.ComponentProps<C>>>(component: C, options?: StyledOptions<React.ComponentProps<C>>): CreateStyledComponent<PropsOf<C> & {
305
- theme?: ThemeContextProps;
306
- }, {}, {
307
- ref?: React.Ref<InstanceType<C>>;
308
- }>;
309
- <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> & {
310
- theme?: ThemeContextProps;
311
- }>;
312
- <C extends React.ComponentType<React.ComponentProps<C>>>(component: C, options?: StyledOptions<React.ComponentProps<C>>): CreateStyledComponent<PropsOf<C> & {
313
- theme?: ThemeContextProps;
314
- }>;
315
- <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<{
316
- theme?: ThemeContextProps;
317
- as?: React.ElementType;
318
- }, Pick<JSX.IntrinsicElements[Tag], ForwardedProps>>;
319
- <Tag extends keyof JSX.IntrinsicElements>(tag: Tag, options?: StyledOptions<JSX.IntrinsicElements[Tag]>): CreateStyledComponent<{
320
- theme?: ThemeContextProps;
321
- as?: React.ElementType;
322
- }, JSX.IntrinsicElements[Tag]>;
323
- }
324
- interface CreateStyled extends BaseCreateStyled, StyledTags {
325
- }
326
443
  declare const styled: CreateStyled;
327
444
 
328
- export { Accordion, AccordionProps, Button, ButtonProps, Dropdown, DropdownItem, DropdownProps, InputField, Modal, MultiSelect, MultiSelectProps, SingleSelect, SingleSelectProps, Slider, SliderProps, ThemeColors, ThemeColorsObject, ThemeContextProps, ThemeContextProvider, ThemeProperties, styled, transientOptions, useIsMobile, useThemeContext };
445
+ /**
446
+ *
447
+ * @param color the color to get the contrast color for
448
+ * @returns the most readable color between black and white
449
+ */
450
+ declare const getContrastColor: (color: string) => string;
451
+ /**
452
+ *
453
+ * @param color the color to darken
454
+ * @param strength the strength (0-100) to darken the color
455
+ * @returns the color darkened by the strength
456
+ */
457
+ declare const darkenColor: (color: string, strength?: number) => string;
458
+ /**
459
+ *
460
+ * @param color the color to lighten
461
+ * @param strength the strength (0-100) to lighten the color
462
+ * @returns the color lightened by the strength
463
+ */
464
+ declare const lightenColor: (color: string, strength?: number) => string;
465
+
466
+ export { Accordion, AccordionProps, Button, ButtonProps, Card, CardContent, CardFooter, CardHeader, CardIndicators, CardMediaSection, Dropdown, DropdownItem, DropdownProps, IBackgroundColors, ICommonColors, IIndicatorColors, IPalette, IStandardPaletteColor, ITagColors, IThemeContextProps, IThemeContextValue, Indicator, InputField, Modal, MultiSelect, MultiSelectProps, SingleSelect, SingleSelectProps, Slider, SliderProps, TCardSectionProps, TColorScale, TIndicatorProps, TIndicatorVariants, TTagProps, TThemeMode, Tag, ThemeContextProvider, darkenColor, defaultDarkPalette, defaultLightPalette, getContrastColor, lightenColor, styled, transientOptions, useIsMobile, useThemeContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwantis-id3/frontend-library",
3
- "version": "0.27.2",
3
+ "version": "1.0.0-rc.3",
4
4
  "description": "Kwantis frontend components collection",
5
5
  "scriptsComments": {
6
6
  "storybook": "Starts storybook in development mode",
@@ -54,14 +54,14 @@
54
54
  "@storybook/react-webpack5": "7.4.6",
55
55
  "@storybook/testing-library": "0.2.2",
56
56
  "@testing-library/jest-dom": "^5.16.5",
57
- "@testing-library/react": "^14.0.0",
57
+ "@testing-library/react": "^16.2.0",
58
58
  "@testing-library/user-event": "^14.5.1",
59
59
  "@types/react": "^18.0.33",
60
60
  "@types/testing-library__jest-dom": "^5.14.5",
61
61
  "@types/tinycolor2": "^1.4.3",
62
62
  "@typescript-eslint/eslint-plugin": "^5.58.0",
63
63
  "@typescript-eslint/parser": "^5.58.0",
64
- "@vitest/coverage-v8": "^1.1.0",
64
+ "@vitest/coverage-v8": "^3.0.5",
65
65
  "chromatic": "^11.0.4",
66
66
  "eslint": "^8.38.0",
67
67
  "eslint-config-prettier": "^8.8.0",
@@ -79,7 +79,7 @@
79
79
  "ts-node": "^10.9.1",
80
80
  "tslib": "^2.5.0",
81
81
  "typescript": "^5.0.3",
82
- "vitest": "^1.1.0"
82
+ "vitest": "^3.0.5"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "react": ">= 17.0.2"