@inceptionbg/iui 2.0.12 → 2.0.14

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.
Files changed (51) hide show
  1. package/dist/index.d.ts +112 -53
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/iui.css +1 -1
  5. package/package.json +1 -1
  6. package/rollup.config.js +1 -5
  7. package/src/assets/icons/light/faBookmark.ts +15 -15
  8. package/src/assets/icons/light/faBookmarkSlash.ts +15 -15
  9. package/src/assets/images/logo/inception.svg +22 -0
  10. package/src/components/Button/Button.tsx +1 -1
  11. package/src/components/Button/SplitButton.tsx +91 -0
  12. package/src/components/Dialog/components/DialogFooter.tsx +5 -1
  13. package/src/components/Header/Components/ModuleSelect.tsx +15 -10
  14. package/src/components/Header/Components/UserMenu.tsx +1 -0
  15. package/src/components/List/List.tsx +5 -3
  16. package/src/components/List/ListItem.tsx +58 -13
  17. package/src/components/Menu/Menu.tsx +5 -1
  18. package/src/components/Pullover/Pullover.tsx +25 -9
  19. package/src/components/Sidebar/Sidebar.tsx +6 -4
  20. package/src/components/Table/Table.tsx +2 -5
  21. package/src/components/Table/components/edit/TableEditRow.tsx +4 -1
  22. package/src/components/Table/components/filters/TableFilters.tsx +4 -1
  23. package/src/components/Table/components/items/TableItemActions.tsx +12 -3
  24. package/src/components/Table/components/print/TablePrint.tsx +4 -1
  25. package/src/components/Table/components/sort/TableSort.tsx +19 -1
  26. package/src/components/Table/components/templates/TableTemplates.tsx +56 -45
  27. package/src/components/Table/contexts/TableContext.tsx +13 -17
  28. package/src/components/Table/hooks/localHooks/useLocalTableColumns.tsx +8 -10
  29. package/src/components/Table/hooks/localHooks/useLocalTableData.tsx +1 -1
  30. package/src/components/Table/hooks/useTableColumns.ts +28 -0
  31. package/src/components/Table/hooks/useTablePagination.ts +10 -7
  32. package/src/components/Table/hooks/useTableSelect.ts +15 -7
  33. package/src/index.ts +14 -2
  34. package/src/styles/App.scss +1 -0
  35. package/src/styles/common/maps/_buttonMaps.scss +42 -0
  36. package/src/styles/components/_button.scss +11 -50
  37. package/src/styles/components/_buttonSplit.scss +90 -0
  38. package/src/styles/components/_header.scss +26 -5
  39. package/src/styles/components/_list.scss +19 -1
  40. package/src/styles/components/_page.scss +2 -1
  41. package/src/styles/components/_sidebar.scss +2 -2
  42. package/src/styles/components/_table.scss +6 -6
  43. package/src/styles/variables/_variables.scss +1 -0
  44. package/src/types/ITable.ts +40 -44
  45. package/src/utils/i18n/i18nIUICyrilic.ts +22 -13
  46. package/src/utils/i18n/i18nIUILatin.ts +15 -7
  47. package/src/utils/i18n/i18nIUIMe.ts +21 -11
  48. package/src/utils/logoUtils.ts +7 -0
  49. package/src/utils/tableUtils.ts +5 -5
  50. package/tsconfig.json +2 -0
  51. package/src/components/Table/hooks/useDefaultTemplate.ts +0 -20
@@ -1,16 +1,19 @@
1
- import { useState } from 'react';
1
+ import { useMemo, useState } from 'react';
2
2
  import { IPagination, IPaginationControl } from '../../../types/ITable';
3
3
 
4
4
  export const useTablePagination = (defaultLimit: number = 5) => {
5
5
  const [limit, setLimit] = useState(defaultLimit);
6
6
  const [offset, setOffset] = useState(0);
7
7
 
8
- const pagination: IPagination = { limit, offset };
9
- const paginationControl: IPaginationControl = {
10
- ...pagination,
11
- setLimit,
12
- setOffset,
13
- };
8
+ const pagination: IPagination = useMemo(() => ({ limit, offset }), [limit, offset]);
9
+ const paginationControl: IPaginationControl = useMemo(
10
+ () => ({
11
+ ...pagination,
12
+ setLimit,
13
+ setOffset,
14
+ }),
15
+ [pagination]
16
+ );
14
17
 
15
18
  return { pagination, paginationControl };
16
19
  };
@@ -1,11 +1,19 @@
1
- import { useState } from 'react';
1
+ import { useMemo, useState } from 'react';
2
+ import { ITableSelectedAction } from '../../../types/ITable';
2
3
 
3
- export const useTableSelect = () => {
4
+ export const useTableSelect = ({ actions }: { actions: ITableSelectedAction[] }) => {
4
5
  const [selectedRows, setSelectedRows] = useState(new Set<string>());
5
6
 
6
- return {
7
- selectedRows,
8
- setSelectedRows,
9
- resetSelectedRows: () => setSelectedRows(new Set<string>()),
10
- };
7
+ const rowSelect = useMemo(
8
+ () => ({
9
+ selectedRows,
10
+ setSelectedRows,
11
+ resetSelectedRows: () => setSelectedRows(new Set<string>()),
12
+ actions,
13
+ }),
14
+ // eslint-disable-next-line
15
+ [selectedRows]
16
+ );
17
+
18
+ return rowSelect;
11
19
  };
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ import type {
27
27
  IPaginationControl,
28
28
  ITable,
29
29
  ITableColumn,
30
+ ITableDataActions,
30
31
  ITableDataItem,
31
32
  ITableDataItemCells,
32
33
  ITableEdit,
@@ -34,6 +35,10 @@ import type {
34
35
  ITableFilterData,
35
36
  ITableFilterItem,
36
37
  ITableSort,
38
+ ITableTemplateData,
39
+ IReportTemplate,
40
+ IReportTemplateData,
41
+ IReportTemplateFilterValue,
37
42
  } from './types/ITable';
38
43
  import type { ITreeItem } from './types/ITree';
39
44
  import type { IHeaderAction, IHeaderUserMenuProps } from './types/IHeader';
@@ -50,6 +55,7 @@ import { NotificationBadge } from './components/Badge/NotificationBadge';
50
55
  import { PillBadge } from './components/Badge/PillBadge';
51
56
  import { Button } from './components/Button/Button';
52
57
  import { IconButton } from './components/Button/IconButton';
58
+ import { SplitButton } from './components/Button/SplitButton';
53
59
  import { Dashboard } from './components/Dashboard/Dashboard';
54
60
  import { DashboardWidget } from './components/Dashboard/DashboardWidget';
55
61
  import { FastLinksWidget } from './components/Dashboard/FastLinksWidget/FastLinksWidget';
@@ -96,7 +102,7 @@ import { Table } from './components/Table/Table';
96
102
  // import { TableFooter } from './components/Table/Components/TableFooter';
97
103
  // import { GridTable } from '../idea/GridTable/GridTable';
98
104
  // import { TablePrint } from './components/Table/Components/Print/TablePrint';
99
- import { useDefaultTemplate } from './components/Table/hooks/useDefaultTemplate';
105
+ import { useTableColumns } from './components/Table/hooks/useTableColumns';
100
106
  import { useTableEdit } from './components/Table/hooks/useTableEdit';
101
107
  import { useTableFilterFields } from './components/Table/hooks/useTableFilterFields';
102
108
  import { useTablePagination } from './components/Table/hooks/useTablePagination';
@@ -216,6 +222,7 @@ export {
216
222
  Select,
217
223
  SelectAsyncPaginate,
218
224
  SelectCreatable,
225
+ SplitButton,
219
226
  tableCustomLimit1000,
220
227
  Tabs,
221
228
  TextInput,
@@ -232,7 +239,7 @@ export {
232
239
  // TablePrint,
233
240
  // TableEditRow,
234
241
  // TableFooter,
235
- useDefaultTemplate,
242
+ useTableColumns,
236
243
  useTableEdit,
237
244
  useTableFilterFields,
238
245
  useTablePagination,
@@ -267,6 +274,7 @@ export type {
267
274
  ITab,
268
275
  ITable,
269
276
  ITableColumn,
277
+ ITableDataActions,
270
278
  ITableDataItem,
271
279
  ITableDataItemCells,
272
280
  ITableEdit,
@@ -274,6 +282,10 @@ export type {
274
282
  ITableFilterData,
275
283
  ITableFilterItem,
276
284
  ITableSort,
285
+ ITableTemplateData,
286
+ IReportTemplate,
287
+ IReportTemplateData,
288
+ IReportTemplateFilterValue,
277
289
  IGetPrintData,
278
290
  ITreeItem,
279
291
  IValueLabel,
@@ -15,6 +15,7 @@
15
15
  @use './components/alert';
16
16
  @use './components/badge';
17
17
  @use './components/button';
18
+ @use './components/buttonSplit';
18
19
  @use './components/card';
19
20
  // @use './components/menu-v2';
20
21
  @use './components/dialog';
@@ -0,0 +1,42 @@
1
+ $text-button-sizes: (
2
+ xs: (
3
+ font-size: 10px,
4
+ svg: 12px,
5
+ padding: 0 10px,
6
+ height: 24px,
7
+ gap: 6px,
8
+ ),
9
+ s: (
10
+ font-size: 12px,
11
+ svg: 14px,
12
+ padding: 0 12px,
13
+ height: 30px,
14
+ ),
15
+ m: (
16
+ font-size: 14px,
17
+ svg: 16px,
18
+ padding: 0 14px,
19
+ height: 36px,
20
+ ),
21
+ l: (
22
+ font-size: 16px,
23
+ svg: 20px,
24
+ padding: 0 18px,
25
+ height: 48px,
26
+ ),
27
+ );
28
+
29
+ $icon-button-sizes: (
30
+ s: (
31
+ size: 32px,
32
+ svg: 16px,
33
+ ),
34
+ m: (
35
+ size: 40px,
36
+ svg: 20px,
37
+ ),
38
+ l: (
39
+ size: 44px,
40
+ svg: 24px,
41
+ ),
42
+ );
@@ -1,4 +1,5 @@
1
1
  @use 'sass:map';
2
+ @use '../common/maps/buttonMaps' as buttonMaps;
2
3
 
3
4
  $btn-colors: (primary, neutral, danger);
4
5
 
@@ -6,19 +7,19 @@ $btn-colors: (primary, neutral, danger);
6
7
  display: flex;
7
8
  justify-content: center;
8
9
  align-items: center;
9
- gap: 8px;
10
10
  border-radius: 100px;
11
11
  cursor: pointer;
12
12
  user-select: none;
13
13
  background: none;
14
- transition: border-color 250ms, background-color 250ms;
14
+ transition:
15
+ border-color 250ms,
16
+ background-color 250ms;
15
17
 
16
18
  @each $key in $btn-colors {
17
19
  &.#{$key} {
18
20
  color: var(--#{$key}-600);
19
21
  &.solid {
20
22
  background-color: var(--#{$key});
21
- border-color: var(--#{$key});
22
23
  }
23
24
  &.outlined {
24
25
  border-color: var(--#{$key}-600);
@@ -43,12 +44,12 @@ $btn-colors: (primary, neutral, danger);
43
44
  }
44
45
  }
45
46
 
46
- &:not(.simple) {
47
- border: 1px solid var(--neutral-300);
48
- }
49
47
  &.solid {
50
48
  color: var(--text-inverse);
51
49
  }
50
+ &.outlined {
51
+ border: 1px solid var(--neutral-300);
52
+ }
52
53
  &:disabled {
53
54
  opacity: 0.5;
54
55
  cursor: default;
@@ -59,45 +60,19 @@ $btn-colors: (primary, neutral, danger);
59
60
  }
60
61
 
61
62
  ///// Text Button /////
62
- $text-button-sizes: (
63
- xs: (
64
- font-size: 10px,
65
- svg: 12px,
66
- padding: 4px 10px,
67
- gap: 6px,
68
- ),
69
- s: (
70
- font-size: 12px,
71
- svg: 14px,
72
- padding: 6px 12px,
73
- ),
74
- m: (
75
- font-size: 14px,
76
- svg: 16px,
77
- padding: 8px 14px,
78
- ),
79
- l: (
80
- font-size: 16px,
81
- svg: 20px,
82
- padding: 12px 18px,
83
- ),
84
- );
85
63
 
86
64
  .iui-text-btn {
87
- // letter-spacing: 0.4px;
88
65
  font-weight: 600;
89
66
  white-space: nowrap;
67
+ gap: 8px;
90
68
 
91
69
  // Sizes
92
- @each $size, $vars in $text-button-sizes {
70
+ @each $size, $vars in buttonMaps.$text-button-sizes {
93
71
  &.#{$size} {
94
72
  font-size: map.get($vars, font-size);
95
73
  padding: map.get($vars, padding);
96
74
  gap: map.get($vars, gap);
97
-
98
- @if map.has-key($vars, height) {
99
- height: map.get($vars, height);
100
- }
75
+ height: map.get($vars, height);
101
76
  svg {
102
77
  height: map.get($vars, svg);
103
78
  width: map.get($vars, svg);
@@ -107,23 +82,9 @@ $text-button-sizes: (
107
82
  }
108
83
 
109
84
  ///// Icon Button /////
110
- $icon-button-sizes: (
111
- s: (
112
- size: 32px,
113
- svg: 16px,
114
- ),
115
- m: (
116
- size: 40px,
117
- svg: 20px,
118
- ),
119
- l: (
120
- size: 44px,
121
- svg: 24px,
122
- ),
123
- );
124
85
 
125
86
  .iui-icon-btn {
126
- @each $size, $vars in $icon-button-sizes {
87
+ @each $size, $vars in buttonMaps.$icon-button-sizes {
127
88
  &.#{$size} {
128
89
  min-height: map.get($vars, size);
129
90
  min-width: map.get($vars, size);
@@ -0,0 +1,90 @@
1
+ @use 'sass:map';
2
+ @use '../common/maps/buttonMaps' as buttonMaps;
3
+
4
+ .iui-split-btn {
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ border-radius: 100px;
9
+ cursor: pointer;
10
+ user-select: none;
11
+ overflow: hidden;
12
+ transition:
13
+ border-color 250ms,
14
+ background-color 250ms;
15
+ .iui-btn-content {
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ font-weight: 600;
20
+ white-space: nowrap;
21
+ gap: 8px;
22
+ }
23
+ .btn-actions {
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ border-left: 2px solid var(--neutral-200);
28
+ }
29
+
30
+ &.solid {
31
+ background-color: var(--primary);
32
+ color: var(--text-inverse);
33
+ &:not(:disabled) {
34
+ .iui-btn-content,
35
+ .btn-actions {
36
+ &:hover,
37
+ &:active,
38
+ &.active {
39
+ background-color: var(--primary-600);
40
+ }
41
+ }
42
+ &:focus-visible {
43
+ box-shadow: 0px 0px 1px 3px var(--primary-200);
44
+ }
45
+ }
46
+ }
47
+ &.outlined {
48
+ border: 1px solid var(--neutral-300);
49
+ &:not(:disabled) {
50
+ .iui-btn-content,
51
+ .btn-actions {
52
+ &:hover,
53
+ &:active,
54
+ &.active {
55
+ background-color: var(--neutral-100);
56
+ }
57
+ }
58
+ &:focus-visible {
59
+ box-shadow: 0px 0px 1px 3px var(--neutral-200);
60
+ }
61
+ }
62
+ }
63
+
64
+ &:disabled {
65
+ opacity: 0.5;
66
+ cursor: default;
67
+ }
68
+ &:not(:disabled):active {
69
+ transform: translateY(2px);
70
+ }
71
+ // Sizes
72
+ @each $size, $vars in buttonMaps.$text-button-sizes {
73
+ &.#{$size} {
74
+ .iui-btn-content {
75
+ font-size: map.get($vars, font-size);
76
+ padding: map.get($vars, padding);
77
+ gap: map.get($vars, gap);
78
+ height: map.get($vars, height);
79
+ }
80
+ .btn-actions {
81
+ height: map.get($vars, height);
82
+ width: map.get($vars, height);
83
+ }
84
+ svg {
85
+ height: map.get($vars, svg);
86
+ width: map.get($vars, svg);
87
+ }
88
+ }
89
+ }
90
+ }
@@ -1,8 +1,9 @@
1
1
  @use '../variables/bp';
2
2
 
3
3
  .iui-header {
4
- border-bottom: var(--border);
5
- background: var(--background);
4
+ box-shadow: var(--container-shadow);
5
+ background: var(--primary);
6
+ color: var(--text-inverse);
6
7
  height: var(--header-height);
7
8
  width: 100dvw;
8
9
  display: flex;
@@ -10,13 +11,21 @@
10
11
  justify-content: space-between;
11
12
  padding: 0 24px 0 8px;
12
13
  box-sizing: border-box;
14
+ z-index: 2;
13
15
  .header-button {
14
16
  height: 40px;
15
17
  width: 40px;
16
18
  padding: 8px;
17
19
  border-radius: 50px;
18
- &:hover {
20
+ circle {
21
+ fill: var(--white);
22
+ }
23
+ &:hover,
24
+ &.active {
19
25
  background-color: var(--neutral-hover);
26
+ circle {
27
+ fill: var(--primary);
28
+ }
20
29
  }
21
30
  }
22
31
  }
@@ -31,12 +40,17 @@
31
40
  user-select: none;
32
41
  &:hover {
33
42
  background-color: var(--neutral-hover);
43
+ color: var(--primary);
34
44
  }
35
45
  }
36
46
  .modules-menu {
37
47
  display: grid;
38
48
  grid-template-columns: repeat(2, 1fr);
39
49
  padding: 8px !important;
50
+ top: var(--header-height) !important;
51
+ left: 0 !important;
52
+ border-top-left-radius: 0px !important;
53
+ border-top-right-radius: 0px !important;
40
54
  @media #{bp.$mobile} {
41
55
  grid-template-columns: 1fr;
42
56
  }
@@ -81,7 +95,7 @@
81
95
  user-select: none;
82
96
  -webkit-user-drag: none;
83
97
  .user-icon {
84
- color: var(--primary);
98
+ color: var(--white);
85
99
  height: 36px;
86
100
  width: 36px;
87
101
  }
@@ -96,7 +110,7 @@
96
110
  }
97
111
  .org-name {
98
112
  font-size: 12px;
99
- color: var(--neutral-500);
113
+ color: var(--neutral-200);
100
114
  }
101
115
  p {
102
116
  line-height: 1.5;
@@ -113,6 +127,13 @@
113
127
  border-radius: 50px;
114
128
  }
115
129
  }
130
+ .header-user-menu {
131
+ top: var(--header-height) !important;
132
+ right: 0 !important;
133
+ left: auto !important;
134
+ border-top-left-radius: 0px !important;
135
+ border-top-right-radius: 0px !important;
136
+ }
116
137
 
117
138
  @media #{bp.$mobile} {
118
139
  .user-info {
@@ -4,9 +4,15 @@
4
4
  flex-direction: column;
5
5
  gap: 8px;
6
6
  .iui-list-item {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: space-between;
7
10
  border: var(--border);
8
11
  border-radius: 8px;
9
12
  padding: 12px 16px;
13
+ transition:
14
+ color 0.15s,
15
+ background-color 0.15s;
10
16
  p {
11
17
  font-size: 14px;
12
18
  line-height: 20px;
@@ -18,6 +24,12 @@
18
24
  font-size: 12px;
19
25
  color: var(--neutral);
20
26
  margin-top: 4px;
27
+ white-space: pre-line;
28
+ }
29
+ .iui-list-item-actions {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 4px;
21
33
  }
22
34
  &.disabled {
23
35
  cursor: default;
@@ -28,12 +40,18 @@
28
40
  &:hover {
29
41
  background-color: var(--neutral-hover);
30
42
  }
43
+ &:has(.iui-icon-btn:hover) {
44
+ background-color: transparent;
45
+ }
31
46
  &.active {
32
- background-color: var(--primary);
47
+ background-color: var(--primary) !important;
33
48
  color: var(--text-inverse);
34
49
  .iui-list-item-desc {
35
50
  color: var(--neutral-300);
36
51
  }
52
+ .iui-list-item-actions .iui-icon-btn:not(:hover) {
53
+ background-color: var(--background);
54
+ }
37
55
  }
38
56
  }
39
57
  }
@@ -47,7 +47,7 @@
47
47
  padding: 0 1.5rem;
48
48
  min-height: 55px;
49
49
  max-height: 55px;
50
- border-bottom: var(--border);
50
+ box-shadow: var(--container-shadow);
51
51
 
52
52
  @media #{bp.$mobileTablet} {
53
53
  .breadcrumbs {
@@ -60,4 +60,5 @@
60
60
  text-align: center;
61
61
  padding: 16px;
62
62
  font-size: 12px;
63
+ white-space: pre-line;
63
64
  }
@@ -6,7 +6,7 @@
6
6
  position: relative;
7
7
  display: flex;
8
8
  flex-direction: column;
9
- border-right: var(--border);
9
+ box-shadow: var(--container-shadow);
10
10
  height: calc(100dvh - var(--header-height));
11
11
  width: var(--sidebar-width);
12
12
  transition: width var(--animation);
@@ -190,7 +190,7 @@
190
190
  .item-only {
191
191
  padding-left: 15px;
192
192
  .sidebar-item-label {
193
- padding-left: 6px;
193
+ padding-left: 8px;
194
194
  }
195
195
  }
196
196
  .sidebar-footer p {
@@ -8,9 +8,9 @@ table {
8
8
  //// Header ////
9
9
  thead {
10
10
  z-index: 2;
11
- background-color: var(--neutral-200);
11
+ background-color: var(--neutral-100);
12
12
  tr:first-child th {
13
- border-top: var(--border);
13
+ border-top: var(--borderlight);
14
14
  }
15
15
  }
16
16
  th {
@@ -55,7 +55,7 @@ table {
55
55
  // Cell
56
56
  th,
57
57
  td {
58
- border-bottom: var(--border);
58
+ border-bottom: var(--border-light);
59
59
  // Cell colors
60
60
  &.secondary {
61
61
  background-color: rgba(0, 0, 0, 0.04);
@@ -136,9 +136,9 @@ table {
136
136
  @media #{bp.$landscape} {
137
137
  td,
138
138
  th {
139
- border-right: var(--border);
139
+ border-right: var(--border-light);
140
140
  &:first-child:not(.not-first-cell) {
141
- border-left: var(--border);
141
+ border-left: var(--border-light);
142
142
  }
143
143
  }
144
144
  .select-col,
@@ -211,7 +211,7 @@ table {
211
211
  // gap: 12px;
212
212
  // }
213
213
  // .list-box {
214
- // border: var(--border);
214
+ // border: var(--border-light);
215
215
  // border-radius: 16px;
216
216
  // padding: 10px;
217
217
  // user-select: none;
@@ -82,6 +82,7 @@
82
82
  /////// OTHER ////////
83
83
  --header-height: 60px;
84
84
  --border: 1px solid var(--border-color);
85
+ --border-light: 1px solid var(--neutral-200);
85
86
  --sidebar-width: 260px;
86
87
  --sidebar-collapsed-width: 54px;
87
88