@rotki/ui-library 2.6.4 → 2.8.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/components/accordions/accordion/RuiAccordion.vue.d.ts +3 -2
- package/dist/components/accordions/accordions/RuiAccordions.vue.d.ts +2 -1
- package/dist/components/alerts/RuiAlert.vue.d.ts +4 -3
- package/dist/components/buttons/button/RuiButton.vue.d.ts +7 -5
- package/dist/components/buttons/button-group/RuiButtonGroup.vue.d.ts +6 -5
- package/dist/components/calendar/RuiCalendar.vue.d.ts +4 -2
- package/dist/components/calendar/RuiCalendarGrid.vue.d.ts +4 -2
- package/dist/components/calendar/RuiCalendarHeader.vue.d.ts +4 -2
- package/dist/components/calendar/RuiCalendarMenu.vue.d.ts +4 -2
- package/dist/components/cards/RuiCard.vue.d.ts +4 -3
- package/dist/components/cards/RuiCardHeader.vue.d.ts +3 -2
- package/dist/components/chips/RuiChip.vue.d.ts +4 -3
- package/dist/components/color-picker/RuiColorBoard.vue.d.ts +2 -1
- package/dist/components/color-picker/RuiColorDisplay.vue.d.ts +2 -1
- package/dist/components/color-picker/RuiColorHue.vue.d.ts +4 -3
- package/dist/components/color-picker/RuiColorInput.vue.d.ts +4 -3
- package/dist/components/color-picker/RuiColorPicker.vue.d.ts +2 -1
- package/dist/components/color-picker/utils.d.ts +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.vue.d.ts +10 -8
- package/dist/components/date-time-picker/RuiDateTimePickerMenu.vue.d.ts +5 -3
- package/dist/components/divider/RuiDivider.vue.d.ts +2 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +29 -28
- package/dist/components/forms/checkbox/RuiCheckbox.vue.d.ts +4 -3
- package/dist/components/forms/radio-button/radio/RuiRadio.vue.d.ts +7 -6
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue.d.ts +7 -6
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue.d.ts +8 -6
- package/dist/components/forms/select/RuiMenuSelect.vue.d.ts +747 -10
- package/dist/components/forms/select/RuiSimpleSelect.vue.d.ts +3 -2
- package/dist/components/forms/slider/RuiSlider.vue.d.ts +3 -2
- package/dist/components/forms/switch/RuiSwitch.vue.d.ts +3 -2
- package/dist/components/forms/text-area/RuiTextArea.vue.d.ts +8 -6
- package/dist/components/forms/text-field/RuiTextField.vue.d.ts +10 -8
- package/dist/components/helpers/RuiFormTextDetail.vue.d.ts +2 -1
- package/dist/components/icons/RuiIcon.vue.d.ts +2 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.es.js +4343 -4260
- package/dist/components/loaders/RuiSkeletonBase.vue.d.ts +2 -1
- package/dist/components/loaders/RuiSkeletonLoader.vue.d.ts +2 -1
- package/dist/components/logos/RuiLogo.vue.d.ts +2 -1
- package/dist/components/overlays/badge/RuiBadge.vue.d.ts +5 -4
- package/dist/components/overlays/bottom-sheet/RuiBottomSheet.vue.d.ts +3 -2
- package/dist/components/overlays/dialog/RuiDialog.vue.d.ts +6 -5
- package/dist/components/overlays/menu/RuiMenu.vue.d.ts +6 -3
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue.d.ts +6 -5
- package/dist/components/overlays/notification/RuiNotification.vue.d.ts +4 -3
- package/dist/components/overlays/tooltip/RuiTooltip.vue.d.ts +4 -3
- package/dist/components/progress/RuiProgress.vue.d.ts +3 -2
- package/dist/components/steppers/RuiFooterStepper.vue.d.ts +2 -1
- package/dist/components/steppers/RuiStepper.vue.d.ts +4 -3
- package/dist/components/steppers/RuiStepperCustomIcon.vue.d.ts +2 -1
- package/dist/components/steppers/RuiStepperIcon.vue.d.ts +2 -1
- package/dist/components/tables/RuiDataTable.vue.d.ts +13 -12
- package/dist/components/tables/RuiExpandButton.vue.d.ts +3 -2
- package/dist/components/tables/RuiTableHead.vue.d.ts +7 -6
- package/dist/components/tables/RuiTablePagination.vue.d.ts +3 -2
- package/dist/components/tabs/tab/RuiTab.vue.d.ts +5 -4
- package/dist/components/tabs/tab-item/RuiTabItem.vue.d.ts +4 -3
- package/dist/components/tabs/tab-items/RuiTabItems.vue.d.ts +7 -6
- package/dist/components/tabs/tabs/RuiTabs.vue.d.ts +3 -2
- package/dist/components/time-picker/RuiTimePicker.vue.d.ts +4 -2
- package/dist/composables/defaults/table.d.ts +1 -2
- package/dist/composables/dropdown-menu.d.ts +3 -2
- package/dist/composables/index-CC7A7CEh.js +737 -0
- package/dist/composables/index.es.js +1 -1
- package/dist/composables/popper.d.ts +2 -2
- package/dist/composables/sticky-header.d.ts +1 -1
- package/dist/consts/time-accuracy-BnKA5GyT.js +1 -1
- package/dist/consts/typography.d.ts +38 -4
- package/dist/icons/icons_1.d.ts +1 -1
- package/dist/icons/icons_1.es.js +896 -896
- package/dist/icons/icons_2.d.ts +1 -1
- package/dist/icons/icons_2.es.js +1002 -1002
- package/dist/icons/icons_3.d.ts +1 -1
- package/dist/icons/icons_3.es.js +982 -982
- package/dist/icons/icons_4.d.ts +1 -0
- package/dist/icons/icons_4.es.js +358 -354
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.es.js +1219 -1218
- package/dist/{index-cTPqOSmm.js → index-D7l4d7N2.js} +4 -4
- package/dist/index.es.js +1221 -1220
- package/dist/style.css +1 -1
- package/dist/theme/index.es.js +30 -23
- package/dist/utils/form-text-detail.d.ts +1 -1
- package/dist/utils/index-DJ-ueLCs.js +158 -0
- package/dist/vendor-Hqbg5uCG.js +1931 -0
- package/dist/web-types.json +59 -39
- package/package.json +41 -48
- package/README.md +0 -276
- package/dist/composables/index-D7DVd8pO.js +0 -717
- package/dist/utils/index-D-sENcA8.js +0 -158
- package/dist/vendor-X3mXJl51.js +0 -1931
package/README.md
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
# @rotki/ui-library
|
|
2
|
-
|
|
3
|
-
A Vue component library and design system for rotki
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@rotki/ui-library)
|
|
6
|
-
[](https://github.com/rotki/ui-library/actions/workflows/ci.yml)
|
|
7
|
-
[](https://codecov.io/gh/rotki/ui-library)
|
|
8
|
-
[](https://github.com/rotki/ui-library/blob/main/LICENSE.md)
|
|
9
|
-
|
|
10
|
-
## Getting started
|
|
11
|
-
|
|
12
|
-
### Installing the library
|
|
13
|
-
|
|
14
|
-
You can start using the library after installing it from npm along with the roboto font:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pnpm install -D --save-exact @rotki/ui-library @fontsource/roboto
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Importing the stylesheets
|
|
21
|
-
|
|
22
|
-
Don't forget to import the `style.css` file from `@rotki/ui-library` along with the latin roboto font,
|
|
23
|
-
in the project root (e.g main.ts)
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import '@rotki/ui-library/dist/style.css';
|
|
27
|
-
import '@fontsource/roboto/latin.css';
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Using the plugin
|
|
31
|
-
|
|
32
|
-
To use the library you must install the library plugin:
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
import { createRui } from '@rotki/ui-library';
|
|
36
|
-
|
|
37
|
-
const RuiPlugin = createRui(options);
|
|
38
|
-
app.use(RuiPlugin);
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Using the components
|
|
42
|
-
|
|
43
|
-
Then you can you the library components e.g.:
|
|
44
|
-
|
|
45
|
-
```vue
|
|
46
|
-
<script setup lang="ts">
|
|
47
|
-
import { RuiButton } from '@rotki/ui-library';
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<template>
|
|
51
|
-
<div>
|
|
52
|
-
<RuiButton outlined>
|
|
53
|
-
This is button
|
|
54
|
-
</RuiButton>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Managing the theme
|
|
60
|
-
|
|
61
|
-
To dynamically manage the theme you can use the theme manager
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
import { useRotkiTheme } from '@rotki/ui-library';
|
|
65
|
-
const { toggleThemeMode, setThemeConfig, switchThemeScheme, state, store } = useRotkiTheme();
|
|
66
|
-
|
|
67
|
-
// to change the theme (pass colors as described by `ThemeConfig`) anytime:
|
|
68
|
-
setThemeConfig(newTheme);
|
|
69
|
-
|
|
70
|
-
// to switch between auto|light|dark
|
|
71
|
-
toggleThemeMode();
|
|
72
|
-
|
|
73
|
-
// to switch to a specific theme mode
|
|
74
|
-
switchThemeScheme(ThemeMode.dark);
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Using the icons
|
|
78
|
-
|
|
79
|
-
You need to specify which icons you want to enable, when installing the RuiPlugin.
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
import { createRui, Ri4kFill, Ri4kLine } from '@rotki/ui-library';
|
|
83
|
-
|
|
84
|
-
const RuiPlugin = createRui({
|
|
85
|
-
theme: {
|
|
86
|
-
icons: [Ri4kFill, Ri4kLine],
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
app.use(RuiPlugin);
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
```vue
|
|
93
|
-
<script lang="ts" setup>
|
|
94
|
-
import { RuiIcon } from '@rotki/ui-library';
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<template>
|
|
98
|
-
<div>
|
|
99
|
-
<RuiIcon name="4k-fill" />
|
|
100
|
-
<RuiIcon name="4k-line" />
|
|
101
|
-
</div>
|
|
102
|
-
</template>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Setting up internationalization (i18n)
|
|
106
|
-
|
|
107
|
-
The UI library supports internationalization through the `createRuiI8nPlugin` function. This allows you to provide translations for UI components.
|
|
108
|
-
|
|
109
|
-
#### Setting up the i18n plugin
|
|
110
|
-
|
|
111
|
-
First, you need to set up your Vue i18n instance and then connect it to the UI library:
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
import { createRui, createRuiI8nPlugin } from '@rotki/ui-library';
|
|
115
|
-
import { createApp } from 'vue';
|
|
116
|
-
import { createI18n } from 'vue-i18n';
|
|
117
|
-
|
|
118
|
-
// Create your i18n instance
|
|
119
|
-
const i18n = createI18n({
|
|
120
|
-
legacy: false, // You must set `false`, to use Composition API
|
|
121
|
-
locale: 'en',
|
|
122
|
-
messages: {
|
|
123
|
-
en: {
|
|
124
|
-
// Your app translations
|
|
125
|
-
// UI library translations (see below)
|
|
126
|
-
rui: {
|
|
127
|
-
date_time_picker: {
|
|
128
|
-
date_after_max: 'Date cannot be after {date}',
|
|
129
|
-
date_before_min: 'Date cannot be before {date}',
|
|
130
|
-
date_in_future: 'The selected date cannot be in the future',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
// Other languages...
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const app = createApp(App);
|
|
139
|
-
|
|
140
|
-
// Create and use the Rotki UI plugin
|
|
141
|
-
const RuiPlugin = createRui();
|
|
142
|
-
app.use(RuiPlugin);
|
|
143
|
-
|
|
144
|
-
// Create and use the Rotki UI i18n plugin
|
|
145
|
-
const RuiI18nPlugin = createRuiI8nPlugin(i18n);
|
|
146
|
-
app.use(RuiI18nPlugin);
|
|
147
|
-
|
|
148
|
-
app.use(i18n);
|
|
149
|
-
app.mount('#app');
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
#### Available translation keys
|
|
153
|
-
|
|
154
|
-
The UI library uses the following translation keys:
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
// These are defined in src/i18n/keys.ts
|
|
158
|
-
export const RUI_I18N_KEYS = {
|
|
159
|
-
dateTimePicker: {
|
|
160
|
-
dateAfterMax: 'rui.date_time_picker.date_after_max',
|
|
161
|
-
dateBeforeMin: 'rui.date_time_picker.date_before_min',
|
|
162
|
-
dateInFuture: 'rui.date_time_picker.date_in_future',
|
|
163
|
-
},
|
|
164
|
-
} as const;
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Use @rotki/ui-library tailwindcss theme
|
|
168
|
-
|
|
169
|
-
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.
|
|
170
|
-
|
|
171
|
-
```javascript
|
|
172
|
-
// tailwind.config.js
|
|
173
|
-
|
|
174
|
-
module.exports = {
|
|
175
|
-
// ... your tailwind configs,
|
|
176
|
-
plugins: [require('@rotki/ui-library/theme')],
|
|
177
|
-
};
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Development
|
|
181
|
-
|
|
182
|
-
### Installation
|
|
183
|
-
|
|
184
|
-
To install the dependencies you need to run on the root of the repository
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
pnpm install --frozen-lockfile
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Compiles and minifies for production
|
|
191
|
-
|
|
192
|
-
The following command when executed from the project root will build the `@rotki/ui-library` bundle.
|
|
193
|
-
This command will create the bundle for both Vue version >=3.4.3.
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
pnpm run build:prod
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
If you want to build for specific version, you can run:
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
pnpm run build
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Lint check
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
pnpm run lint
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Lints and fixes files
|
|
212
|
-
|
|
213
|
-
```
|
|
214
|
-
pnpm run lint:fix
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Type check
|
|
218
|
-
|
|
219
|
-
```
|
|
220
|
-
pnpm run typecheck
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### Storybook
|
|
224
|
-
|
|
225
|
-
In order to run the storybook, you can run:
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
pnpm run storybook
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Testing: Unit
|
|
232
|
-
|
|
233
|
-
In order to test the components, you can run:
|
|
234
|
-
|
|
235
|
-
```
|
|
236
|
-
pnpm run test
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Testing: end-to-end
|
|
240
|
-
|
|
241
|
-
In order to test the components in use in a vue 3 project, you can run:
|
|
242
|
-
|
|
243
|
-
```
|
|
244
|
-
pnpm run test:e2e
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
coverage results can be generated and previewed with:
|
|
248
|
-
|
|
249
|
-
```
|
|
250
|
-
pnpm run coverage
|
|
251
|
-
pnpm run coverage:preview
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Locally testing the library
|
|
255
|
-
|
|
256
|
-
After you build the bundle, in the `package.json` on your main project, you can add this to the dependencies:
|
|
257
|
-
|
|
258
|
-
```json
|
|
259
|
-
{
|
|
260
|
-
"@rotki/ui-library": "file:...path_of_this_directory"
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
When the dependency installed on the main project, it will run the `prepare` script.
|
|
265
|
-
|
|
266
|
-
### Generating the library icons
|
|
267
|
-
|
|
268
|
-
We use remix-icons. You need to run this script to scrap the svgs data from remix-icons. (This script runs automatically on `prepare`. Run this in case the icons aren't generated properly)
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
pnpm run generate:icons
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## License
|
|
275
|
-
|
|
276
|
-
[AGPL-3.0](./LICENSE.md) License © 2023- [Rotki Solutions GmbH](https://github.com/rotki)
|