@kwantis-id3/frontend-library 0.9.1 → 0.10.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/README.md +94 -0
- package/dist/esm/index.js +40 -35
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Accordion/Accordion.d.ts +4 -4
- package/dist/esm/types/components/Button/Button.d.ts +2 -2
- package/dist/esm/types/components/SelectFilter/MultiSelect.d.ts +2 -2
- package/dist/esm/types/components/SelectFilter/SingleSelect.d.ts +2 -2
- package/dist/esm/types/components/Slider/Slider.d.ts +4 -3
- package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +14 -1
- package/dist/index.d.ts +23 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,3 +23,97 @@ With pnpm
|
|
|
23
23
|
```bash
|
|
24
24
|
pnpm add @kwantis-id3/frontend-library
|
|
25
25
|
```
|
|
26
|
+
|
|
27
|
+
Note that the library uses @emotion/styled and @emotion/react as peer dependencies. Depending on your package manager, you may need to install them manually.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
The library has various components, each one with its own documentation. Please refer to the storybook documentation for more information.
|
|
31
|
+
|
|
32
|
+
### Components List
|
|
33
|
+
At the moment, the library contains the following components:
|
|
34
|
+
- Accordion
|
|
35
|
+
- Button
|
|
36
|
+
- Select (both single and multi)
|
|
37
|
+
- Slider
|
|
38
|
+
|
|
39
|
+
The following are under development or on our roadmap:
|
|
40
|
+
- Label
|
|
41
|
+
- Checkbox
|
|
42
|
+
- Radio
|
|
43
|
+
- Textfield
|
|
44
|
+
- Datepicker
|
|
45
|
+
- Timepicker
|
|
46
|
+
- Datetimepicker
|
|
47
|
+
- Table
|
|
48
|
+
- Modal
|
|
49
|
+
- Tabs
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
You can find various examples of usage in the projects stories.
|
|
53
|
+
|
|
54
|
+
### Theming
|
|
55
|
+
The library internally uses the [emotion](https://emotion.sh/docs/introduction) library for styling. By default, the library uses a default theme, that looks like this:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
export const defaultThemeColors = {
|
|
59
|
+
primary: { main: "#1d4e89", contrastText: "#ffffff" },
|
|
60
|
+
secondary: { main: "#00b2ca", contrastText: "#ffffff" },
|
|
61
|
+
tertiary: { main: "#7dcfb6", contrastText: "#ffffff" },
|
|
62
|
+
statusOk: { main: "#00e200", contrastText: "#ffffff" },
|
|
63
|
+
statusWarning: { main: "#efff00", contrastText: "#ffffff" },
|
|
64
|
+
statusCritical: { main: "#ff3838", contrastText: "#ffffff" },
|
|
65
|
+
statusNeutral: { main: "#7b8089", contrastText: "#ffffff" },
|
|
66
|
+
};
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You can override the default theme by passing a custom theme to the `ThemeContextProvider` component, like this:
|
|
70
|
+
```js
|
|
71
|
+
import { ThemeContextProvider } from "@kwantis-id3/frontend-library";
|
|
72
|
+
|
|
73
|
+
const customTheme = {
|
|
74
|
+
primary: { main: "#1d4e89", contrastText: "#ffffff" },
|
|
75
|
+
secondary: { main: "#00b2ca", contrastText: "#ffffff" },
|
|
76
|
+
tertiary: { main: "#7dcfb6", contrastText: "#ffffff" },
|
|
77
|
+
statusOk: { main: "#00e200", contrastText: "#ffffff" },
|
|
78
|
+
statusWarning: { main: "#efff00", contrastText: "#ffffff" },
|
|
79
|
+
statusCritical: { main: "#ff3838", contrastText: "#ffffff" },
|
|
80
|
+
statusNeutral: { main: "#7b8089", contrastText: "#ffffff" },
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const App = () => {
|
|
84
|
+
return (
|
|
85
|
+
<ThemeContextProvider theme={customTheme}>
|
|
86
|
+
<YourApp />
|
|
87
|
+
</ThemeContextProvider>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
To add custom properties to the theme, you can extend the `ThemeColorsObject` interface in a **.d.ts** file, like this:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
import "@kwantis-id3/frontend-library";
|
|
96
|
+
|
|
97
|
+
declare module "@kwantis-id3/frontend-library" {
|
|
98
|
+
interface ThemeColorsObject {
|
|
99
|
+
newColor: Color;
|
|
100
|
+
newColor2: Color;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### The Color prop
|
|
106
|
+
Each component that has a **color** prop, accepts a string.
|
|
107
|
+
The string can be a color name, a hex code, or a css color function.
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
// Color name
|
|
111
|
+
<Button color="primary" />
|
|
112
|
+
|
|
113
|
+
// Hex code
|
|
114
|
+
<Button color="#1d4e89" />
|
|
115
|
+
|
|
116
|
+
// Css color function
|
|
117
|
+
<Button color="rgb(29, 78, 137)" />
|
|
118
|
+
```
|
|
119
|
+
|