@rotki/ui-library 0.1.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/LICENSE.md +659 -0
- package/README.md +170 -0
- package/dist/all-icons.d.ts +2495 -0
- package/dist/colors-01d79c7b.mjs +47 -0
- package/dist/components/alerts/Alert.vue.d.ts +84 -0
- package/dist/components/buttons/button/Button.vue.d.ts +97 -0
- package/dist/components/buttons/button-group/ButtonGroup.vue.d.ts +48 -0
- package/dist/components/chips/Chip.vue.d.ts +78 -0
- package/dist/components/forms/auto-complete/AutoComplete.vue.d.ts +184 -0
- package/dist/components/forms/auto-complete/AutoCompleteSelection.vue.d.ts +81 -0
- package/dist/components/forms/checkbox/Checkbox.vue.d.ts +101 -0
- package/dist/components/forms/radio-button/radio/Radio.vue.d.ts +98 -0
- package/dist/components/forms/radio-button/radio-group/RadioGroup.vue.d.ts +61 -0
- package/dist/components/forms/revealable-text-field/RevealableTextField.vue.d.ts +10 -0
- package/dist/components/forms/text-field/TextField.vue.d.ts +156 -0
- package/dist/components/icons/Icon.vue.d.ts +37 -0
- package/dist/components/logos/Logo.vue.d.ts +17 -0
- package/dist/components/progress/Progress.vue.d.ts +102 -0
- package/dist/components/steppers/FooterStepper.vue.d.ts +40 -0
- package/dist/components/steppers/Stepper.vue.d.ts +77 -0
- package/dist/components/steppers/StepperCustomIcon.vue.d.ts +21 -0
- package/dist/components/steppers/StepperIcon.vue.d.ts +21 -0
- package/dist/composables/icons.d.ts +5 -0
- package/dist/composables/theme.d.ts +6 -0
- package/dist/consts/colors.d.ts +8 -0
- package/dist/consts/typography.d.ts +5 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.es.js +13500 -0
- package/dist/style.css +1 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme.es.js +169 -0
- package/dist/types/icons.d.ts +4 -0
- package/dist/types/stepper.d.ts +20 -0
- package/dist/types/theme.d.ts +40 -0
- package/dist/utils/generate-id.d.ts +4 -0
- package/package.json +128 -0
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# @rotki/ui-library
|
|
2
|
+
|
|
3
|
+
A vue component library and design system for rotki
|
|
4
|
+
|
|
5
|
+
### Installation
|
|
6
|
+
|
|
7
|
+
To install the dependencies you need to run on the root of the repository
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
pnpm install --frozen-lockfile
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Compiles and minifies for production
|
|
14
|
+
The following command when executed from the project root will build the `@rotki/ui-library` bundle.
|
|
15
|
+
This command will create the bundle for both Vue version >=3.4.3.
|
|
16
|
+
```
|
|
17
|
+
pnpm run build:prod
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you want to build for specific version, you can run:
|
|
21
|
+
```
|
|
22
|
+
pnpm run build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Lint check
|
|
26
|
+
```
|
|
27
|
+
pnpm run lint
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Lints and fixes files
|
|
31
|
+
```
|
|
32
|
+
pnpm run lint:fix
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Type check
|
|
36
|
+
```
|
|
37
|
+
pnpm run typecheck
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
# Storybook
|
|
41
|
+
In order to run the storybook, you can run:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
pnpm run storybook
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
# Testing: Unit
|
|
48
|
+
In order to test the components, you can run:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
pnpm run test
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
# Testing: end-to-end
|
|
55
|
+
In order to test the components in use in a vue 3 project, you can run:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
pnpm run test:e2e
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
coverage results can be generated and previewed with:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
pnpm run coverage
|
|
65
|
+
pnpm run coverage:preview
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# How to test the usage locally.
|
|
70
|
+
After you build the bundle, in the `package.json` on your main project, you can add this to the dependencies:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"@rotki/ui-library": "file:...path_of_this_directory"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
When the dependency installed on the main project, it will run the `postinstall` script.
|
|
79
|
+
|
|
80
|
+
Don't forget to import the `style.css` file from `@rotki/ui-library` in the project root (e.g main.ts)
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import '@rotki/ui-library/dist/style.css';
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Also, import the library plugin use:
|
|
87
|
+
|
|
88
|
+
Vue 3
|
|
89
|
+
```typescript
|
|
90
|
+
import { RuiPlugin } from "@rotki/ui-library";
|
|
91
|
+
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
app.use(RuiPlugin, options);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
And then you can use the component
|
|
98
|
+
```vue
|
|
99
|
+
<script setup lang="ts">
|
|
100
|
+
import { RuiButton } from '@rotki/ui-library';
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<VContainer>
|
|
105
|
+
<RuiButton outlined>This is button</RuiButton>
|
|
106
|
+
</VContainer>
|
|
107
|
+
</template>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
after complete setup, we can then use the theme manager as:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const { toggleThemeMode, setThemeConfig, switchThemeScheme, state, store } = useRotkiTheme();
|
|
114
|
+
|
|
115
|
+
// to change the theme (pass colors as described by `ThemeConfig`) anytime:
|
|
116
|
+
setThemeConfig(newTheme);
|
|
117
|
+
|
|
118
|
+
// to switch between auto|light|dark
|
|
119
|
+
toggleThemeMode();
|
|
120
|
+
|
|
121
|
+
// to switch to a specific theme mode
|
|
122
|
+
switchThemeScheme(ThemeMode.dark);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# Use icons
|
|
127
|
+
We use remix-icons. You need to run this script to scrap the svgs data from remix-icons. (This script runs automatically on `postinstall`. Run this in case the icons aren't generated properly)
|
|
128
|
+
```
|
|
129
|
+
pnpm run generate:icons
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
You need to specify which icons you want to enable, when installing the RuiPlugin.
|
|
133
|
+
```typescript
|
|
134
|
+
import { Ri4kFill, Ri4kLine, RuiPlugin } from '@rotki/ui-library';
|
|
135
|
+
|
|
136
|
+
Vue.use(RuiPlugin, {
|
|
137
|
+
icons: [Ri4kFill, Ri4kLine]
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```vue
|
|
142
|
+
<script lang="ts" setup>
|
|
143
|
+
import { RuiIcon } from '@rotki/ui-library';
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<VContainer>
|
|
148
|
+
<RuiIcon name="4k-fill" />
|
|
149
|
+
<RuiIcon name="4k-line" />
|
|
150
|
+
</VContainer>
|
|
151
|
+
</template>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
# Use @rotki/ui-library theme
|
|
155
|
+
You can extend @rotki/ui-library tailwind theme configuration by adding these to your tailwind config. It will provide you the classes for the colors, typography, and shadow.
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
// tailwind.config.js
|
|
159
|
+
|
|
160
|
+
module.exports = {
|
|
161
|
+
// ... your tailwind configs,
|
|
162
|
+
plugins: [require('@rotki/ui-library/theme')]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
[AGPL-3.0](./LICENSE) License © 2023- [Rotki Solutions GmbH](https://github.com/rotki)
|
|
170
|
+
|