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