@rotki/ui-library 0.7.0 → 0.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/README.md CHANGED
@@ -27,11 +27,11 @@ import '@fontsource/roboto/latin.css';
27
27
  To use the library you must install the library plugin:
28
28
 
29
29
  ```typescript
30
- import { RuiPlugin } from "@rotki/ui-library";
30
+ import { createRui } from "@rotki/ui-library";
31
31
 
32
32
  ...
33
-
34
- app.use(RuiPlugin, options);
33
+ const RuiPlugin = createRui(options);
34
+ app.use(RuiPlugin);
35
35
  ```
36
36
 
37
37
  ### Using the components
@@ -72,11 +72,14 @@ switchThemeScheme(ThemeMode.dark);
72
72
 
73
73
  You need to specify which icons you want to enable, when installing the RuiPlugin.
74
74
  ```typescript
75
- import { Ri4kFill, Ri4kLine, RuiPlugin } from '@rotki/ui-library';
76
-
77
- app.use(RuiPlugin, {
78
- icons: [Ri4kFill, Ri4kLine]
79
- });
75
+ import { Ri4kFill, Ri4kLine, createRui } from '@rotki/ui-library';
76
+
77
+ const RuiPlugin = createRui({
78
+ theme: {
79
+ icons: [Ri4kFill, Ri4kLine]
80
+ }
81
+ })
82
+ app.use(RuiPlugin);
80
83
  ```
81
84
 
82
85
  ```vue
@@ -26,6 +26,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
26
26
  type: globalThis.PropType<RuiIcons>;
27
27
  default: undefined;
28
28
  };
29
+ closeable: {
30
+ type: globalThis.PropType<boolean>;
31
+ default: boolean;
32
+ };
29
33
  description: {
30
34
  type: globalThis.PropType<string>;
31
35
  default: string;
@@ -34,10 +38,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
34
38
  type: globalThis.PropType<string>;
35
39
  default: string;
36
40
  };
37
- closeable: {
38
- type: globalThis.PropType<boolean>;
39
- default: boolean;
40
- };
41
41
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
42
42
  action: () => void;
43
43
  close: () => void;
@@ -58,6 +58,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
58
58
  type: globalThis.PropType<RuiIcons>;
59
59
  default: undefined;
60
60
  };
61
+ closeable: {
62
+ type: globalThis.PropType<boolean>;
63
+ default: boolean;
64
+ };
61
65
  description: {
62
66
  type: globalThis.PropType<string>;
63
67
  default: string;
@@ -66,10 +70,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
66
70
  type: globalThis.PropType<string>;
67
71
  default: string;
68
72
  };
69
- closeable: {
70
- type: globalThis.PropType<boolean>;
71
- default: boolean;
72
- };
73
73
  }>> & {
74
74
  onClose?: (() => any) | undefined;
75
75
  onAction?: (() => any) | undefined;
@@ -78,9 +78,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
78
78
  type: "primary" | "secondary" | "error" | "warning" | "info" | "success";
79
79
  title: string;
80
80
  icon: RuiIcons;
81
+ closeable: boolean;
81
82
  description: string;
82
83
  actionText: string;
83
- closeable: boolean;
84
84
  }, {}>, {
85
85
  title?(_: {}): any;
86
86
  default?(_: {}): any;
@@ -1,11 +1,16 @@
1
1
  import { type ContextColorsType } from '../../consts/colors';
2
+ import { type RuiIcons } from '~/src';
2
3
  export interface Props {
3
- label?: string;
4
- dismissible?: boolean;
4
+ tile?: boolean;
5
+ clickable?: boolean;
6
+ closeable?: boolean;
5
7
  disabled?: boolean;
6
8
  size?: 'sm' | 'md';
7
9
  variant?: 'filled' | 'outlined';
8
10
  color?: 'grey' | ContextColorsType;
11
+ closeIcon?: RuiIcons;
12
+ bgColor?: string;
13
+ textColor?: string;
9
14
  }
10
15
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
11
16
  variant: {
@@ -20,20 +25,36 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
20
25
  type: globalThis.PropType<"sm" | "md">;
21
26
  default: string;
22
27
  };
23
- label: {
28
+ disabled: {
29
+ type: globalThis.PropType<boolean>;
30
+ default: boolean;
31
+ };
32
+ textColor: {
24
33
  type: globalThis.PropType<string>;
25
- default: string;
34
+ default: undefined;
26
35
  };
27
- disabled: {
36
+ tile: {
37
+ type: globalThis.PropType<boolean>;
38
+ };
39
+ clickable: {
28
40
  type: globalThis.PropType<boolean>;
29
41
  default: boolean;
30
42
  };
31
- dismissible: {
43
+ closeable: {
32
44
  type: globalThis.PropType<boolean>;
33
45
  default: boolean;
34
46
  };
47
+ closeIcon: {
48
+ type: globalThis.PropType<RuiIcons>;
49
+ default: string;
50
+ };
51
+ bgColor: {
52
+ type: globalThis.PropType<string>;
53
+ default: undefined;
54
+ };
35
55
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
- remove: () => void;
56
+ "click:close": () => void;
57
+ click: () => void;
37
58
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
38
59
  variant: {
39
60
  type: globalThis.PropType<"outlined" | "filled">;
@@ -47,27 +68,46 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
47
68
  type: globalThis.PropType<"sm" | "md">;
48
69
  default: string;
49
70
  };
50
- label: {
71
+ disabled: {
72
+ type: globalThis.PropType<boolean>;
73
+ default: boolean;
74
+ };
75
+ textColor: {
51
76
  type: globalThis.PropType<string>;
52
- default: string;
77
+ default: undefined;
53
78
  };
54
- disabled: {
79
+ tile: {
80
+ type: globalThis.PropType<boolean>;
81
+ };
82
+ clickable: {
55
83
  type: globalThis.PropType<boolean>;
56
84
  default: boolean;
57
85
  };
58
- dismissible: {
86
+ closeable: {
59
87
  type: globalThis.PropType<boolean>;
60
88
  default: boolean;
61
89
  };
90
+ closeIcon: {
91
+ type: globalThis.PropType<RuiIcons>;
92
+ default: string;
93
+ };
94
+ bgColor: {
95
+ type: globalThis.PropType<string>;
96
+ default: undefined;
97
+ };
62
98
  }>> & {
63
- onRemove?: (() => any) | undefined;
99
+ onClick?: (() => any) | undefined;
100
+ "onClick:close"?: (() => any) | undefined;
64
101
  }, {
65
102
  variant: "outlined" | "filled";
66
103
  color: "grey" | "primary" | "secondary" | "error" | "warning" | "info" | "success";
67
104
  size: "sm" | "md";
68
- label: string;
69
105
  disabled: boolean;
70
- dismissible: boolean;
106
+ textColor: string;
107
+ clickable: boolean;
108
+ closeable: boolean;
109
+ closeIcon: RuiIcons;
110
+ bgColor: string;
71
111
  }, {}>, {
72
112
  prepend?(_: {}): any;
73
113
  default?(_: {}): any;
@@ -20,6 +20,7 @@ import { type Props as RevealableTextFieldProps, default as RuiRevealableTextFie
20
20
  import { type Props as LogoProps, default as RuiLogo } from '../components/logos/Logo.vue';
21
21
  import { default as RuiSimpleSelect, type Props as SimpleSelectProps } from '../components/forms/select/SimpleSelect.vue';
22
22
  import { type TableColumn as DataTableColumn, type TableOptions as DataTableOptions, type Props as DataTableProps, type SortColumn as DataTableSortColumn, default as RuiDataTable } from '../components/tables/DataTable.vue';
23
+ import { type Props as ExpandButtonProps, default as RuiTableRowExpander } from '../components/tables/ExpandButton.vue';
23
24
  import { default as RuiTablePagination, type TablePaginationData, type Props as TablePaginationProps } from '../components/tables/TablePagination.vue';
24
25
  import { type Props as CardProps, default as RuiCard } from '../components/cards/Card.vue';
25
26
  import { type Props as CardHeaderProps, default as RuiCardHeader } from '../components/cards/CardHeader.vue';
@@ -28,4 +29,4 @@ import { default as RuiTab, type Props as TabProps } from '../components/tabs/ta
28
29
  import { default as RuiTabItems, type Props as TabItemsProps } from '../components/tabs/tab-items/TabItems.vue';
29
30
  import { default as RuiTabItem, type Props as TabItemProps } from '../components/tabs/tab-item/TabItem.vue';
30
31
  import { default as RuiSkeletonLoader, type Props as SkeletonLoaderProps } from '../components/loaders/Skeleton.vue';
31
- export { RuiAlert, RuiAutoComplete, RuiBadge, RuiButton, RuiButtonGroup, RuiCheckbox, RuiChip, RuiFooterStepper, RuiIcon, RuiLogo, RuiProgress, RuiRadio, RuiRadioGroup, RuiRevealableTextField, RuiStepper, RuiTextField, RuiTooltip, RuiDataTable, RuiSimpleSelect, RuiDialog, RuiCard, RuiCardHeader, RuiTabs, RuiTab, RuiTabItems, RuiTabItem, RuiTablePagination, RuiSkeletonLoader, RuiTextArea, RuiDivider, AutoCompleteProps, ChipProps, TooltipProps, SimpleSelectProps, DataTableProps, DataTableColumn, DataTableSortColumn, DataTableOptions, TablePaginationData, DialogProps, ButtonProps, ButtonGroupProps, CardProps, CardHeaderProps, BadgeProps, AlertProps, CheckboxProps, ProgressProps, RadioGroupProps, RadioProps, LogoProps, StepperProps, TextFieldProps, IconProps, FooterStepperProps, TabsProps, TabProps, TabItemsProps, TabItemProps, TablePaginationProps, RevealableTextFieldProps, SkeletonLoaderProps, DividerProps, TextAreaProps, };
32
+ export { RuiAlert, RuiAutoComplete, RuiBadge, RuiButton, RuiButtonGroup, RuiCheckbox, RuiChip, RuiFooterStepper, RuiIcon, RuiLogo, RuiProgress, RuiRadio, RuiRadioGroup, RuiRevealableTextField, RuiStepper, RuiTextField, RuiTooltip, RuiDataTable, RuiSimpleSelect, RuiDialog, RuiCard, RuiCardHeader, RuiTabs, RuiTab, RuiTabItems, RuiTabItem, RuiTablePagination, RuiSkeletonLoader, RuiTextArea, RuiDivider, RuiTableRowExpander, AutoCompleteProps, ChipProps, TooltipProps, SimpleSelectProps, DataTableProps, DataTableColumn, DataTableSortColumn, DataTableOptions, TablePaginationData, DialogProps, ButtonProps, ButtonGroupProps, CardProps, CardHeaderProps, BadgeProps, AlertProps, CheckboxProps, ProgressProps, RadioGroupProps, RadioProps, LogoProps, StepperProps, TextFieldProps, IconProps, FooterStepperProps, TabsProps, TabProps, TabItemsProps, TabItemProps, TablePaginationProps, RevealableTextFieldProps, SkeletonLoaderProps, DividerProps, TextAreaProps, ExpandButtonProps, };
@@ -1,4 +1,4 @@
1
- import { A as p, a as l, R as m, B as d, b as T, k as b, l as n, C as g, c as C, D as x, j as S, t as c, F as A, I as B, _ as D, P as F, d as I, e as h, f as k, i as P, r as f, g as v, n as G, p as L, o as j, q, m as H, s as _, h as w, T as y } from "../index-Q2a5R3OH.js";
1
+ import { A as p, a as l, R as m, B as d, b as T, m as b, n, C as g, d as x, D as C, l as S, v as A, F as B, I as D, _ as F, P as I, e as c, f as h, g as k, k as v, t as P, h as f, p as E, r as G, q as L, s as j, E as q, o as w, u as H, i as _, j as y } from "../index-2YbRDW3N.js";
2
2
  import "vue";
3
3
  import "@vueuse/shared";
4
4
  import "../index-W2poXQa4.js";
@@ -15,26 +15,27 @@ export {
15
15
  b as RuiCard,
16
16
  n as RuiCardHeader,
17
17
  g as RuiCheckbox,
18
- C as RuiChip,
19
- x as RuiDataTable,
18
+ x as RuiChip,
19
+ C as RuiDataTable,
20
20
  S as RuiDialog,
21
- c as RuiDivider,
22
- A as RuiFooterStepper,
23
- B as RuiIcon,
24
- D as RuiLogo,
25
- F as RuiProgress,
26
- I as RuiRadio,
21
+ A as RuiDivider,
22
+ B as RuiFooterStepper,
23
+ D as RuiIcon,
24
+ F as RuiLogo,
25
+ I as RuiProgress,
26
+ c as RuiRadio,
27
27
  h as RuiRadioGroup,
28
28
  k as RuiRevealableTextField,
29
- P as RuiSimpleSelect,
30
- f as RuiSkeletonLoader,
31
- v as RuiStepper,
32
- G as RuiTab,
33
- L as RuiTabItem,
34
- j as RuiTabItems,
35
- q as RuiTablePagination,
36
- H as RuiTabs,
37
- _ as RuiTextArea,
38
- w as RuiTextField,
29
+ v as RuiSimpleSelect,
30
+ P as RuiSkeletonLoader,
31
+ f as RuiStepper,
32
+ E as RuiTab,
33
+ G as RuiTabItem,
34
+ L as RuiTabItems,
35
+ j as RuiTablePagination,
36
+ q as RuiTableRowExpander,
37
+ w as RuiTabs,
38
+ H as RuiTextArea,
39
+ _ as RuiTextField,
39
40
  y as RuiTooltip
40
41
  };
@@ -43,7 +43,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
43
43
  default: boolean;
44
44
  };
45
45
  placement: {
46
- type: globalThis.PropType<"center" | "top" | "bottom">;
46
+ type: globalThis.PropType<"bottom" | "top" | "center">;
47
47
  default: string;
48
48
  };
49
49
  dot: {
@@ -88,7 +88,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
88
88
  default: boolean;
89
89
  };
90
90
  placement: {
91
- type: globalThis.PropType<"center" | "top" | "bottom">;
91
+ type: globalThis.PropType<"bottom" | "top" | "center">;
92
92
  default: string;
93
93
  };
94
94
  dot: {
@@ -111,7 +111,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
111
111
  icon: RuiIcons | null;
112
112
  modelValue: boolean;
113
113
  left: boolean;
114
- placement: "center" | "top" | "bottom";
114
+ placement: "bottom" | "top" | "center";
115
115
  dot: boolean;
116
116
  offsetX: string | number;
117
117
  offsetY: string | number;
@@ -113,7 +113,7 @@ export interface Props<T, K extends keyof T> {
113
113
  */
114
114
  columnAttr?: string;
115
115
  /**
116
- * flag to show a more or less spaceous table
116
+ * flag to show a more or less spacious table
117
117
  */
118
118
  dense?: boolean;
119
119
  /**
@@ -126,7 +126,7 @@ export interface Props<T, K extends keyof T> {
126
126
  striped?: boolean;
127
127
  /**
128
128
  * flag to show loading state of the table
129
- * triggers an indefinite progress at the bottom of the table header
129
+ * triggers indefinite progress at the bottom of the table header
130
130
  */
131
131
  loading?: boolean;
132
132
  /**
@@ -143,6 +143,24 @@ export interface Props<T, K extends keyof T> {
143
143
  */
144
144
  hideDefaultFooter?: boolean;
145
145
  rounded?: 'sm' | 'md' | 'lg';
146
+ /**
147
+ * model for expanded rows
148
+ */
149
+ expanded?: T[];
150
+ /**
151
+ * make expansion work like accordion
152
+ */
153
+ singleExpand?: boolean;
154
+ /**
155
+ * make expansion work like accordion
156
+ */
157
+ stickyHeader?: boolean;
158
+ stickyOffset?: number;
159
+ /**
160
+ * Affects how the items per page work across the app.
161
+ * When true, changing the items per page setting in one table will affect other tables.
162
+ */
163
+ globalItemsPerPage?: boolean;
146
164
  }
147
165
  declare const _default: <T extends object, IdType extends keyof T = keyof T>(__VLS_props: Props<T, IdType> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
148
166
  props: Props<T, IdType>;
@@ -154,7 +172,15 @@ declare const _default: <T extends object, IdType extends keyof T = keyof T>(__V
154
172
  column: TableColumn<T>;
155
173
  row: T;
156
174
  index: number;
175
+ }) => any>> & Partial<Record<string, (_: {
176
+ column: TableColumn<T>;
177
+ row: T;
178
+ index: number;
157
179
  }) => any>> & {
180
+ "expanded-item"?(_: {
181
+ row: T;
182
+ index: number;
183
+ }): any;
158
184
  "no-data"?(_: {}): any;
159
185
  "empty-description"?(_: {}): any;
160
186
  "body.append"?(_: {}): any;
@@ -162,6 +188,7 @@ declare const _default: <T extends object, IdType extends keyof T = keyof T>(__V
162
188
  };
163
189
  emit: {
164
190
  (e: 'update:model-value', value?: T[IdType][] | undefined): void;
191
+ (e: 'update:expanded', value: T[]): void;
165
192
  (e: 'update:pagination', value: TablePaginationData): void;
166
193
  (e: 'update:sort', value?: SortColumn<T> | SortColumn<T>[] | undefined): void;
167
194
  (e: 'update:options', value: TableOptions<T>): void;
@@ -176,7 +203,15 @@ declare const _default: <T extends object, IdType extends keyof T = keyof T>(__V
176
203
  column: TableColumn<T>;
177
204
  row: T;
178
205
  index: number;
206
+ }) => any>> & Partial<Record<string, (_: {
207
+ column: TableColumn<T>;
208
+ row: T;
209
+ index: number;
179
210
  }) => any>> & {
211
+ "expanded-item"?(_: {
212
+ row: T;
213
+ index: number;
214
+ }): any;
180
215
  "no-data"?(_: {}): any;
181
216
  "empty-description"?(_: {}): any;
182
217
  "body.append"?(_: {}): any;
@@ -184,6 +219,7 @@ declare const _default: <T extends object, IdType extends keyof T = keyof T>(__V
184
219
  };
185
220
  emit: {
186
221
  (e: 'update:model-value', value?: T[IdType][] | undefined): void;
222
+ (e: 'update:expanded', value: T[]): void;
187
223
  (e: 'update:pagination', value: TablePaginationData): void;
188
224
  (e: 'update:sort', value?: SortColumn<T> | SortColumn<T>[] | undefined): void;
189
225
  (e: 'update:options', value: TableOptions<T>): void;
@@ -201,7 +237,15 @@ declare const _default: <T extends object, IdType extends keyof T = keyof T>(__V
201
237
  column: TableColumn<T>;
202
238
  row: T;
203
239
  index: number;
240
+ }) => any>> & Partial<Record<string, (_: {
241
+ column: TableColumn<T>;
242
+ row: T;
243
+ index: number;
204
244
  }) => any>> & {
245
+ "expanded-item"?(_: {
246
+ row: T;
247
+ index: number;
248
+ }): any;
205
249
  "no-data"?(_: {}): any;
206
250
  "empty-description"?(_: {}): any;
207
251
  "body.append"?(_: {}): any;
@@ -209,6 +253,7 @@ declare const _default: <T extends object, IdType extends keyof T = keyof T>(__V
209
253
  };
210
254
  emit: {
211
255
  (e: 'update:model-value', value?: T[IdType][] | undefined): void;
256
+ (e: 'update:expanded', value: T[]): void;
212
257
  (e: 'update:pagination', value: TablePaginationData): void;
213
258
  (e: 'update:sort', value?: SortColumn<T> | SortColumn<T>[] | undefined): void;
214
259
  (e: 'update:options', value: TableOptions<T>): void;
@@ -0,0 +1,34 @@
1
+ import { type RuiIcons } from '~/src';
2
+ export interface Props {
3
+ expanded: boolean;
4
+ icon?: RuiIcons;
5
+ }
6
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
7
+ icon: {
8
+ type: globalThis.PropType<RuiIcons>;
9
+ default: string;
10
+ };
11
+ expanded: {
12
+ type: globalThis.PropType<boolean>;
13
+ required: true;
14
+ };
15
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
16
+ icon: {
17
+ type: globalThis.PropType<RuiIcons>;
18
+ default: string;
19
+ };
20
+ expanded: {
21
+ type: globalThis.PropType<boolean>;
22
+ required: true;
23
+ };
24
+ }>>, {
25
+ icon: RuiIcons;
26
+ }, {}>, {
27
+ default?(_: {}): any;
28
+ }>;
29
+ export default _default;
30
+ type __VLS_WithTemplateSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,9 @@
1
+ import { type InjectionKey, type Ref } from 'vue';
2
+ import { type MaybeRef } from '@vueuse/shared';
3
+ export interface TableOptions {
4
+ itemsPerPage: Ref<number>;
5
+ globalItemsPerPage: MaybeRef<boolean>;
6
+ }
7
+ export declare const TableSymbol: InjectionKey<TableOptions>;
8
+ export declare const createTableDefaults: (options?: Partial<TableOptions>) => TableOptions;
9
+ export declare const useTable: () => TableOptions;
@@ -0,0 +1,9 @@
1
+ import { type Ref } from 'vue';
2
+ /**
3
+ * Setup sticky table header
4
+ */
5
+ export declare const useStickyTableHeader: (offsetTop?: Ref<number>) => {
6
+ stick: Ref<boolean>;
7
+ table: Ref<HTMLTableElement | null>;
8
+ tableScroller: Ref<HTMLElement | null>;
9
+ };