@kwantis-id3/frontend-library 0.6.1 → 0.7.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/cjs/index.js +36 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/{accordion → Accordion}/Accordion.d.ts +2 -3
- package/dist/{esm/types/components/button → cjs/types/components/Button}/Button.d.ts +2 -2
- package/dist/cjs/types/components/SelectFilter/MultiSelect.d.ts +18 -0
- package/dist/cjs/types/components/SelectFilter/SingleSelect.d.ts +18 -0
- package/dist/cjs/types/components/SelectFilter/index.d.ts +2 -0
- package/dist/cjs/types/components/ThemeContext/ThemeContext.d.ts +2 -2
- package/dist/cjs/types/components/index.d.ts +3 -2
- package/dist/esm/index.js +36 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/{accordion → Accordion}/Accordion.d.ts +2 -3
- package/dist/{cjs/types/components/button → esm/types/components/Button}/Button.d.ts +2 -2
- package/dist/esm/types/components/SelectFilter/MultiSelect.d.ts +18 -0
- package/dist/esm/types/components/SelectFilter/SingleSelect.d.ts +18 -0
- package/dist/esm/types/components/SelectFilter/index.d.ts +2 -0
- package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +2 -2
- package/dist/esm/types/components/index.d.ts +3 -2
- package/dist/index.d.ts +41 -8
- package/package.json +14 -4
- /package/dist/cjs/types/components/{accordion → Accordion}/AccordionStyled.d.ts +0 -0
- /package/dist/cjs/types/components/{accordion → Accordion}/index.d.ts +0 -0
- /package/dist/cjs/types/components/{button → Button}/index.d.ts +0 -0
- /package/dist/esm/types/components/{accordion → Accordion}/AccordionStyled.d.ts +0 -0
- /package/dist/esm/types/components/{accordion → Accordion}/index.d.ts +0 -0
- /package/dist/esm/types/components/{button → Button}/index.d.ts +0 -0
|
@@ -3,18 +3,17 @@ import { Interpolation } from "@emotion/styled";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ThemeColors } from "../ThemeContext";
|
|
5
5
|
import { Theme } from "@emotion/react";
|
|
6
|
-
export
|
|
6
|
+
export type AccordionProps = {
|
|
7
7
|
title: string;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
color?: ThemeColors;
|
|
10
10
|
iconColor?: ThemeColors;
|
|
11
11
|
dividerColor?: ThemeColors;
|
|
12
|
-
variant?: "contained" | "outlined" | "text";
|
|
13
12
|
isOpen?: boolean;
|
|
14
13
|
isLazy?: boolean;
|
|
15
14
|
onClick?: () => void;
|
|
16
15
|
onOpen?: () => void;
|
|
17
16
|
onClose?: () => void;
|
|
18
17
|
sx?: Interpolation<Theme>;
|
|
19
|
-
}
|
|
18
|
+
};
|
|
20
19
|
export declare const Accordion: (props: AccordionProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
@@ -3,7 +3,7 @@ import { ThemeColors } from "../ThemeContext/ThemeContext";
|
|
|
3
3
|
import { Interpolation } from "@emotion/styled";
|
|
4
4
|
import { Theme } from "@emotion/react";
|
|
5
5
|
export type ButtonVariants = "contained" | "outlined" | "text";
|
|
6
|
-
export
|
|
6
|
+
export type ButtonProps = {
|
|
7
7
|
label: string;
|
|
8
8
|
color?: ThemeColors;
|
|
9
9
|
sx?: Interpolation<Theme>;
|
|
@@ -12,5 +12,5 @@ export interface ButtonProps {
|
|
|
12
12
|
htmlClassName?: string;
|
|
13
13
|
htmlId?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
export declare const Button: (props: ButtonProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GroupBase } from "react-select";
|
|
3
|
+
import { ThemeColors } from "../ThemeContext";
|
|
4
|
+
export interface MultiSelectProps<Option, IsMulti extends boolean, Group> {
|
|
5
|
+
options: Option[];
|
|
6
|
+
onChange?: (option: Option[] | null) => void;
|
|
7
|
+
value?: readonly Option[] | null;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isClearable?: boolean;
|
|
11
|
+
isSearchable?: boolean;
|
|
12
|
+
isOptionDisabled?: (option: Option) => boolean;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
color?: ThemeColors;
|
|
15
|
+
htmlId?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const MultiSelect: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: MultiSelectProps<Option, IsMulti, Group>) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GroupBase } from "react-select";
|
|
3
|
+
import { ThemeColors } from "../ThemeContext";
|
|
4
|
+
export interface SingleSelectProps<Option, IsMulti extends boolean, Group> {
|
|
5
|
+
options: Option[];
|
|
6
|
+
onChange?: (option: Option | null) => void;
|
|
7
|
+
value?: Option | null;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isClearable?: boolean;
|
|
11
|
+
isSearchable?: boolean;
|
|
12
|
+
isOptionDisabled?: (option: Option) => boolean;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
color?: ThemeColors;
|
|
15
|
+
htmlId?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const SingleSelect: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: SingleSelectProps<Option, IsMulti, Group>) => JSX.Element;
|
|
@@ -12,9 +12,9 @@ export type ThemeColorsObject = {
|
|
|
12
12
|
statusCritical: Color;
|
|
13
13
|
statusNeutral: Color;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type ThemeContextProps = {
|
|
16
16
|
colors: ThemeColorsObject;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
export type ThemeColors = keyof ThemeColorsObject;
|
|
19
19
|
export declare const defaultThemeColors: {
|
|
20
20
|
primary: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { Button, ButtonProps } from "./
|
|
1
|
+
export { Button, ButtonProps } from "./Button";
|
|
2
2
|
export { ThemeColors, ThemeColorsObject, ThemeContextProvider, useThemeContext, } from "./ThemeContext";
|
|
3
|
-
export { Accordion, AccordionProps } from "./
|
|
3
|
+
export { Accordion, AccordionProps } from "./Accordion";
|
|
4
|
+
export { SingleSelect, SingleSelectProps, MultiSelect, MultiSelectProps, } from "./SelectFilter";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Interpolation } from '@emotion/styled';
|
|
4
5
|
import { Theme } from '@emotion/react';
|
|
6
|
+
import { GroupBase } from 'react-select';
|
|
5
7
|
|
|
6
8
|
type Color = {
|
|
7
9
|
main: string;
|
|
@@ -16,9 +18,9 @@ type ThemeColorsObject = {
|
|
|
16
18
|
statusCritical: Color;
|
|
17
19
|
statusNeutral: Color;
|
|
18
20
|
};
|
|
19
|
-
|
|
21
|
+
type ThemeContextProps = {
|
|
20
22
|
colors: ThemeColorsObject;
|
|
21
|
-
}
|
|
23
|
+
};
|
|
22
24
|
type ThemeColors = keyof ThemeColorsObject;
|
|
23
25
|
declare const ThemeContextProvider: (props: React.PropsWithChildren<{
|
|
24
26
|
theme?: ThemeContextProps;
|
|
@@ -26,7 +28,7 @@ declare const ThemeContextProvider: (props: React.PropsWithChildren<{
|
|
|
26
28
|
declare const useThemeContext: () => ThemeContextProps;
|
|
27
29
|
|
|
28
30
|
type ButtonVariants = "contained" | "outlined" | "text";
|
|
29
|
-
|
|
31
|
+
type ButtonProps = {
|
|
30
32
|
label: string;
|
|
31
33
|
color?: ThemeColors;
|
|
32
34
|
sx?: Interpolation<Theme>;
|
|
@@ -35,23 +37,54 @@ interface ButtonProps {
|
|
|
35
37
|
htmlClassName?: string;
|
|
36
38
|
htmlId?: string;
|
|
37
39
|
disabled?: boolean;
|
|
38
|
-
}
|
|
40
|
+
};
|
|
39
41
|
declare const Button: (props: ButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
type AccordionProps = {
|
|
42
44
|
title: string;
|
|
43
45
|
children: React.ReactNode;
|
|
44
46
|
color?: ThemeColors;
|
|
45
47
|
iconColor?: ThemeColors;
|
|
46
48
|
dividerColor?: ThemeColors;
|
|
47
|
-
variant?: "contained" | "outlined" | "text";
|
|
48
49
|
isOpen?: boolean;
|
|
49
50
|
isLazy?: boolean;
|
|
50
51
|
onClick?: () => void;
|
|
51
52
|
onOpen?: () => void;
|
|
52
53
|
onClose?: () => void;
|
|
53
54
|
sx?: Interpolation<Theme>;
|
|
54
|
-
}
|
|
55
|
+
};
|
|
55
56
|
declare const Accordion: (props: AccordionProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
interface SingleSelectProps<Option, IsMulti extends boolean, Group> {
|
|
59
|
+
options: Option[];
|
|
60
|
+
onChange?: (option: Option | null) => void;
|
|
61
|
+
value?: Option | null;
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
isDisabled?: boolean;
|
|
64
|
+
isClearable?: boolean;
|
|
65
|
+
isSearchable?: boolean;
|
|
66
|
+
isOptionDisabled?: (option: Option) => boolean;
|
|
67
|
+
isLoading?: boolean;
|
|
68
|
+
color?: ThemeColors;
|
|
69
|
+
htmlId?: string;
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
declare const SingleSelect: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: SingleSelectProps<Option, IsMulti, Group>) => JSX.Element;
|
|
73
|
+
|
|
74
|
+
interface MultiSelectProps<Option, IsMulti extends boolean, Group> {
|
|
75
|
+
options: Option[];
|
|
76
|
+
onChange?: (option: Option[] | null) => void;
|
|
77
|
+
value?: readonly Option[] | null;
|
|
78
|
+
placeholder?: string;
|
|
79
|
+
isDisabled?: boolean;
|
|
80
|
+
isClearable?: boolean;
|
|
81
|
+
isSearchable?: boolean;
|
|
82
|
+
isOptionDisabled?: (option: Option) => boolean;
|
|
83
|
+
isLoading?: boolean;
|
|
84
|
+
color?: ThemeColors;
|
|
85
|
+
htmlId?: string;
|
|
86
|
+
className?: string;
|
|
87
|
+
}
|
|
88
|
+
declare const MultiSelect: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: MultiSelectProps<Option, IsMulti, Group>) => JSX.Element;
|
|
89
|
+
|
|
90
|
+
export { Accordion, AccordionProps, Button, ButtonProps, MultiSelect, MultiSelectProps, SingleSelect, SingleSelectProps, ThemeColors, ThemeColorsObject, ThemeContextProvider, useThemeContext };
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kwantis-id3/frontend-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Kwantis frontend components collection",
|
|
5
|
-
"author":
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "kwantis"
|
|
7
|
+
},
|
|
6
8
|
"license": "apache-2.0",
|
|
7
9
|
"devDependencies": {
|
|
8
10
|
"@emotion/react": "^11.10.6",
|
|
@@ -22,9 +24,12 @@
|
|
|
22
24
|
"@types/jest": "^29.5.0",
|
|
23
25
|
"@types/react": "^18.0.33",
|
|
24
26
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
27
|
+
"@types/tinycolor2": "^1.4.3",
|
|
25
28
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
26
29
|
"@typescript-eslint/parser": "^5.58.0",
|
|
30
|
+
"chromatic": "^6.17.4",
|
|
27
31
|
"eslint": "^8.38.0",
|
|
32
|
+
"eslint-config-prettier": "^8.8.0",
|
|
28
33
|
"eslint-plugin-react": "^7.32.2",
|
|
29
34
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
30
35
|
"jest": "^29.5.0",
|
|
@@ -54,12 +59,17 @@
|
|
|
54
59
|
"@rollup/plugin-terser": "^0.4.1",
|
|
55
60
|
"react-collapsible": "^2.10.0",
|
|
56
61
|
"react-icons-kit": "^2.0.0",
|
|
57
|
-
"
|
|
62
|
+
"react-select": "^5.7.3",
|
|
63
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
64
|
+
"tinycolor2": "^1.6.0"
|
|
58
65
|
},
|
|
66
|
+
"readme": "ERROR: No README data found!",
|
|
67
|
+
"_id": "@kwantis-id3/frontend-library@0.6.1",
|
|
59
68
|
"scripts": {
|
|
60
69
|
"rollup": "rollup -c",
|
|
61
70
|
"test": "jest",
|
|
62
71
|
"storybook": "storybook dev -p 6006",
|
|
63
|
-
"build-storybook": "storybook build"
|
|
72
|
+
"build-storybook": "storybook build",
|
|
73
|
+
"chromatic": "npx chromatic --project-token=3dd812d03e4c"
|
|
64
74
|
}
|
|
65
75
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|