@kwantis-id3/frontend-library 0.14.2 → 0.16.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 +16 -3
- package/dist/esm/index.js +100 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Accordion/Accordion.d.ts +3 -0
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/esm/types/components/Dropdown/DropdownStyled.d.ts +50 -0
- package/dist/esm/types/components/Dropdown/index.d.ts +1 -0
- package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +14 -2
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/esm/types/utils/index.d.ts +2 -0
- package/dist/esm/types/utils/isMobile.d.ts +7 -0
- package/dist/esm/types/utils/styled.d.ts +3 -3
- package/dist/index.d.ts +35 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ At the moment, the library contains the following components:
|
|
|
38
38
|
- Select (both single and multi)
|
|
39
39
|
- Slider
|
|
40
40
|
- Textfield
|
|
41
|
+
- Multilevel Dropdown
|
|
41
42
|
|
|
42
43
|
The following are under development or on our roadmap:
|
|
43
44
|
- Label
|
|
@@ -241,7 +242,13 @@ const primaryColor = theme.colors.primary.main;
|
|
|
241
242
|
const primaryColor = theme.getColor("primary");
|
|
242
243
|
```
|
|
243
244
|
|
|
244
|
-
Basically, the property `getColor` can
|
|
245
|
+
Basically, the property `getColor` can be used to:
|
|
246
|
+
- Access the theme colors, in 2 ways:
|
|
247
|
+
- Access the color directly, if the passed string is a valid key of the `ThemeColorsObject` interface. This is the same as accessing the color directly from the `colors` property, giving you access to the possible custom properties that you may have added to the theme.
|
|
248
|
+
- Access the color through a path, if the passed string is a valid path of the `ThemeColorsObject` interface. This returns a `Color` object, that has only the `main` and `contrastText` properties, where `main` is the color that you are accessing, and `contrastText` is generated automatically to grant the best readability possible.
|
|
249
|
+
- Generate a valid `Color` object, if the passed string is a valid hex code or css color function
|
|
250
|
+
|
|
251
|
+
|
|
245
252
|
|
|
246
253
|
In the latter case, the contrastText property will automatically be generated to grant the best readability possible.
|
|
247
254
|
|
|
@@ -250,6 +257,9 @@ If the passed string is not a valid color, the function will default to the prim
|
|
|
250
257
|
const tertiartyColor = theme.getColor("tertiary");
|
|
251
258
|
console.log(tertiaryColor); // { main: "#7dcfb6", contrastText: "#ffffff" }
|
|
252
259
|
|
|
260
|
+
const tertiartyTextColor = theme.getColor("tertiary.contrastText");
|
|
261
|
+
console.log(tertiaryTextColor); // { main: "#ffffff", contrastText: "#000000"}
|
|
262
|
+
|
|
253
263
|
const fuchsia = theme.getColor("fuchsia");
|
|
254
264
|
console.log(fuchsia); // { main: "fuchsia", contrastText: "#000000" }
|
|
255
265
|
|
|
@@ -262,12 +272,15 @@ If the passed string is not a valid color, the function will default to the prim
|
|
|
262
272
|
|
|
263
273
|
## The Color prop
|
|
264
274
|
Each component that has a **color** prop, accepts a string.
|
|
265
|
-
The string can be a color name, a hex code, or a css color function.
|
|
275
|
+
The string can be a color name, a color path, a hex code, or a css color function.
|
|
266
276
|
|
|
267
277
|
```tsx
|
|
268
278
|
// Color name
|
|
269
279
|
<Button color="primary" />
|
|
270
280
|
|
|
281
|
+
// Color path
|
|
282
|
+
<Button color="primary.contrastText" />
|
|
283
|
+
|
|
271
284
|
// Hex code
|
|
272
285
|
<Button color="#1d4e89" />
|
|
273
286
|
|
|
@@ -309,5 +322,5 @@ const MyComponent = () => {
|
|
|
309
322
|
return <StyledDiv $bgColor="red">I'm red!</StyledDiv>;
|
|
310
323
|
};
|
|
311
324
|
```
|
|
312
|
-
It's important that the props defined this way are prefixed with a `$` sign, to avoid conflicts.
|
|
325
|
+
It's important that the props defined this way are prefixed with a `$` sign, to avoid conflicts with the native HTML props.
|
|
313
326
|
|