@rotki/ui-library 0.1.1 → 0.2.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
@@ -1,91 +1,31 @@
1
1
  # @rotki/ui-library
2
2
 
3
- A vue component library and design system for rotki
3
+ A Vue component library and design system for rotki
4
4
 
5
- ### Installation
5
+ ## Getting started
6
6
 
7
- To install the dependencies you need to run on the root of the repository
7
+ ### Installing the library
8
8
 
9
- ```
10
- pnpm install --frozen-lockfile
11
- ```
9
+ You can start using the library after installing it from npm along with the roboto font:
12
10
 
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
11
+ ```bash
12
+ pnpm install -D --save-exact @rotki/ui-library @fontsource/roboto
18
13
  ```
19
14
 
20
- If you want to build for specific version, you can run:
21
- ```
22
- pnpm run build
23
- ```
15
+ ### Importing the stylesheets
24
16
 
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)
17
+ Don't forget to import the `style.css` file from `@rotki/ui-library` along with the latin roboto font,
18
+ in the project root (e.g main.ts)
81
19
 
82
20
  ```typescript
83
21
  import '@rotki/ui-library/dist/style.css';
22
+ import '@fontsource/roboto/latin.css';
84
23
  ```
85
24
 
86
- Also, import the library plugin use:
25
+ ### Using the plugin
26
+
27
+ To use the library you must install the library plugin:
87
28
 
88
- Vue 3
89
29
  ```typescript
90
30
  import { RuiPlugin } from "@rotki/ui-library";
91
31
 
@@ -94,22 +34,28 @@ import { RuiPlugin } from "@rotki/ui-library";
94
34
  app.use(RuiPlugin, options);
95
35
  ```
96
36
 
97
- And then you can use the component
37
+ ### Using the components
38
+
39
+ Then you can you the library components e.g.:
40
+
98
41
  ```vue
99
42
  <script setup lang="ts">
100
43
  import { RuiButton } from '@rotki/ui-library';
101
44
  </script>
102
45
 
103
46
  <template>
104
- <VContainer>
47
+ <div>
105
48
  <RuiButton outlined>This is button</RuiButton>
106
- </VContainer>
49
+ </div>
107
50
  </template>
108
51
  ```
109
52
 
110
- after complete setup, we can then use the theme manager as:
53
+ ### Managing the theme
54
+
55
+ To dynamically manage the theme you can use the theme manager
111
56
 
112
57
  ```typescript
58
+ import { useRotkiTheme } from '@rotki/ui-library';
113
59
  const { toggleThemeMode, setThemeConfig, switchThemeScheme, state, store } = useRotkiTheme();
114
60
 
115
61
  // to change the theme (pass colors as described by `ThemeConfig`) anytime:
@@ -122,18 +68,13 @@ toggleThemeMode();
122
68
  switchThemeScheme(ThemeMode.dark);
123
69
  ```
124
70
 
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
- ```
71
+ ### Using the icons
131
72
 
132
73
  You need to specify which icons you want to enable, when installing the RuiPlugin.
133
74
  ```typescript
134
75
  import { Ri4kFill, Ri4kLine, RuiPlugin } from '@rotki/ui-library';
135
76
 
136
- Vue.use(RuiPlugin, {
77
+ app.use(RuiPlugin, {
137
78
  icons: [Ri4kFill, Ri4kLine]
138
79
  });
139
80
  ```
@@ -144,14 +85,14 @@ import { RuiIcon } from '@rotki/ui-library';
144
85
  </script>
145
86
 
146
87
  <template>
147
- <VContainer>
88
+ <div>
148
89
  <RuiIcon name="4k-fill" />
149
90
  <RuiIcon name="4k-line" />
150
- </VContainer>
91
+ </div>
151
92
  </template>
152
93
  ```
153
94
 
154
- # Use @rotki/ui-library theme
95
+ ### Use @rotki/ui-library tailwindcss theme
155
96
  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
97
 
157
98
  ```javascript
@@ -163,6 +104,87 @@ module.exports = {
163
104
  }
164
105
  ```
165
106
 
107
+ ## Development
108
+
109
+ ### Installation
110
+
111
+ To install the dependencies you need to run on the root of the repository
112
+
113
+ ```
114
+ pnpm install --frozen-lockfile
115
+ ```
116
+
117
+ ### Compiles and minifies for production
118
+ The following command when executed from the project root will build the `@rotki/ui-library` bundle.
119
+ This command will create the bundle for both Vue version >=3.4.3.
120
+ ```
121
+ pnpm run build:prod
122
+ ```
123
+
124
+ If you want to build for specific version, you can run:
125
+ ```
126
+ pnpm run build
127
+ ```
128
+
129
+ ### Lint check
130
+ ```
131
+ pnpm run lint
132
+ ```
133
+
134
+ ### Lints and fixes files
135
+ ```
136
+ pnpm run lint:fix
137
+ ```
138
+
139
+ ### Type check
140
+ ```
141
+ pnpm run typecheck
142
+ ```
143
+
144
+ ### Storybook
145
+ In order to run the storybook, you can run:
146
+
147
+ ```
148
+ pnpm run storybook
149
+ ```
150
+
151
+ ### Testing: Unit
152
+ In order to test the components, you can run:
153
+
154
+ ```
155
+ pnpm run test
156
+ ```
157
+
158
+ ### Testing: end-to-end
159
+ In order to test the components in use in a vue 3 project, you can run:
160
+
161
+ ```
162
+ pnpm run test:e2e
163
+ ```
164
+
165
+ coverage results can be generated and previewed with:
166
+
167
+ ```
168
+ pnpm run coverage
169
+ pnpm run coverage:preview
170
+ ```
171
+
172
+ ### Locally testing the library
173
+ After you build the bundle, in the `package.json` on your main project, you can add this to the dependencies:
174
+
175
+ ```json
176
+ {
177
+ "@rotki/ui-library": "file:...path_of_this_directory"
178
+ }
179
+ ```
180
+
181
+ When the dependency installed on the main project, it will run the `prepare` script.
182
+
183
+ ### Generating the library icons
184
+ 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)
185
+ ```
186
+ pnpm run generate:icons
187
+ ```
166
188
 
167
189
  ## License
168
190
 
@@ -0,0 +1,16 @@
1
+ import { default as RuiAlert } from '../components/alerts/Alert.vue';
2
+ import { default as RuiAutoComplete } from '../components/forms/auto-complete/AutoComplete.vue';
3
+ import { default as RuiButton } from '../components/buttons/button/Button.vue';
4
+ import { default as RuiButtonGroup } from '../components/buttons/button-group/ButtonGroup.vue';
5
+ import { default as RuiIcon } from '../components/icons/Icon.vue';
6
+ import { default as RuiCheckbox } from '../components/forms/checkbox/Checkbox.vue';
7
+ import { default as RuiChip } from '../components/chips/Chip.vue';
8
+ import { default as RuiStepper } from '../components/steppers/Stepper.vue';
9
+ import { default as RuiTextField } from '../components/forms/text-field/TextField.vue';
10
+ import { default as RuiFooterStepper } from '../components/steppers/FooterStepper.vue';
11
+ import { default as RuiProgress } from '../components/progress/Progress.vue';
12
+ import { default as RuiRadioGroup } from '../components/forms/radio-button/radio-group/RadioGroup.vue';
13
+ import { default as RuiRadio } from '../components/forms/radio-button/radio/Radio.vue';
14
+ import { default as RuiRevealableTextField } from '../components/forms/revealable-text-field/RevealableTextField.vue';
15
+ import { default as RuiLogo } from '../components/logos/Logo.vue';
16
+ export { RuiAlert, RuiAutoComplete, RuiButton, RuiButtonGroup, RuiCheckbox, RuiChip, RuiFooterStepper, RuiIcon, RuiLogo, RuiProgress, RuiRadio, RuiRadioGroup, RuiRevealableTextField, RuiStepper, RuiTextField, };
@@ -2,6 +2,7 @@ export interface Props {
2
2
  pages: number;
3
3
  modelValue?: number;
4
4
  variant?: 'numeric' | 'bullet' | 'progress' | 'pill';
5
+ arrowButtons?: boolean;
5
6
  }
6
7
  declare const _default: import("vue").DefineComponent<{
7
8
  variant: {
@@ -16,6 +17,10 @@ declare const _default: import("vue").DefineComponent<{
16
17
  type: globalThis.PropType<number>;
17
18
  required: true;
18
19
  };
20
+ arrowButtons: {
21
+ type: globalThis.PropType<boolean>;
22
+ default: boolean;
23
+ };
19
24
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
25
  "update:modelValue": (modelValue: number) => void;
21
26
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -31,10 +36,15 @@ declare const _default: import("vue").DefineComponent<{
31
36
  type: globalThis.PropType<number>;
32
37
  required: true;
33
38
  };
39
+ arrowButtons: {
40
+ type: globalThis.PropType<boolean>;
41
+ default: boolean;
42
+ };
34
43
  }>> & {
35
44
  "onUpdate:modelValue"?: ((modelValue: number) => any) | undefined;
36
45
  }, {
37
46
  variant: "progress" | "numeric" | "bullet" | "pill";
38
47
  modelValue: number;
48
+ arrowButtons: boolean;
39
49
  }, {}>;
40
50
  export default _default;
@@ -1,5 +1,6 @@
1
1
  import { StepperOrientation, StepperState, type StepperStep } from '../../types/stepper';
2
2
  export interface Props {
3
+ step?: number;
3
4
  steps: StepperStep[];
4
5
  iconTop?: boolean;
5
6
  custom?: boolean;
@@ -12,6 +13,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
12
13
  type: globalThis.PropType<StepperOrientation>;
13
14
  default: "horizontal";
14
15
  };
16
+ step: {
17
+ type: globalThis.PropType<number>;
18
+ default: number;
19
+ };
15
20
  steps: {
16
21
  type: globalThis.PropType<StepperStep[]>;
17
22
  required: true;
@@ -37,6 +42,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
37
42
  type: globalThis.PropType<StepperOrientation>;
38
43
  default: "horizontal";
39
44
  };
45
+ step: {
46
+ type: globalThis.PropType<number>;
47
+ default: number;
48
+ };
40
49
  steps: {
41
50
  type: globalThis.PropType<StepperStep[]>;
42
51
  required: true;
@@ -59,13 +68,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
59
68
  };
60
69
  }>>, {
61
70
  orientation: StepperOrientation;
71
+ step: number;
62
72
  iconTop: boolean;
63
73
  custom: boolean;
64
74
  titleClass: string;
65
75
  subtitleClass: string;
66
76
  }, {}>, {
67
77
  icon?(_: {
68
- state: StepperState;
78
+ state: StepperState | undefined;
69
79
  index: number;
70
80
  }): any;
71
81
  }>;
@@ -2,7 +2,7 @@ import { StepperState } from '../../types/stepper';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  state: {
4
4
  type: globalThis.PropType<StepperState>;
5
- required: true;
5
+ default: "inactive";
6
6
  };
7
7
  index: {
8
8
  type: globalThis.PropType<number>;
@@ -11,11 +11,13 @@ declare const _default: import("vue").DefineComponent<{
11
11
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
12
  state: {
13
13
  type: globalThis.PropType<StepperState>;
14
- required: true;
14
+ default: "inactive";
15
15
  };
16
16
  index: {
17
17
  type: globalThis.PropType<number>;
18
18
  required: true;
19
19
  };
20
- }>>, {}, {}>;
20
+ }>>, {
21
+ state: StepperState;
22
+ }, {}>;
21
23
  export default _default;
@@ -2,7 +2,7 @@ import { StepperState } from '../../types/stepper';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  state: {
4
4
  type: globalThis.PropType<StepperState>;
5
- required: true;
5
+ default: "inactive";
6
6
  };
7
7
  index: {
8
8
  type: globalThis.PropType<number>;
@@ -11,11 +11,13 @@ declare const _default: import("vue").DefineComponent<{
11
11
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
12
  state: {
13
13
  type: globalThis.PropType<StepperState>;
14
- required: true;
14
+ default: "inactive";
15
15
  };
16
16
  index: {
17
17
  type: globalThis.PropType<number>;
18
18
  required: true;
19
19
  };
20
- }>>, {}, {}>;
20
+ }>>, {
21
+ state: StepperState;
22
+ }, {}>;
21
23
  export default _default;
@@ -0,0 +1,21 @@
1
+ import { A as R, a as s, R as t, B as r, C as p, b as l, F as d, c as m, _ as x, d as C, e as F, f as b, g as c, h as g, i as h } from "./index-74133324.mjs";
2
+ import "vue";
3
+ import "./index-eb935704.mjs";
4
+ import "./colors-01d79c7b.mjs";
5
+ export {
6
+ R as RuiAlert,
7
+ s as RuiAutoComplete,
8
+ t as RuiButton,
9
+ r as RuiButtonGroup,
10
+ p as RuiCheckbox,
11
+ l as RuiChip,
12
+ d as RuiFooterStepper,
13
+ m as RuiIcon,
14
+ x as RuiLogo,
15
+ C as RuiProgress,
16
+ F as RuiRadio,
17
+ b as RuiRadioGroup,
18
+ c as RuiRevealableTextField,
19
+ g as RuiStepper,
20
+ h as RuiTextField
21
+ };
@@ -0,0 +1,2 @@
1
+ export { useIcons } from '../composables/icons';
2
+ export { useRotkiTheme } from '../composables/theme';
@@ -0,0 +1,7 @@
1
+ import { u as r, a as t } from "./index-eb935704.mjs";
2
+ import "vue";
3
+ import "./colors-01d79c7b.mjs";
4
+ export {
5
+ r as useIcons,
6
+ t as useRotkiTheme
7
+ };