@inceptionbg/iui 2.0.12 → 2.0.13

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.
@@ -0,0 +1,41 @@
1
+ import { useState, type FC } from 'react';
2
+ import { IPopupControl } from '../../../../../types/IPopup';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Dialog } from '../../../../Dialog/Dialog';
5
+ import { TextInput } from '../../../../Inputs/TextInput';
6
+ import { Checkbox } from '../../../../Inputs/Checkbox';
7
+ import { IReportTemplate } from '../../../../../types/ITable';
8
+ import { useTableContext } from '../../../contexts/TableContext';
9
+
10
+ interface Props {
11
+ control: IPopupControl['control'];
12
+ }
13
+
14
+ export const CreateTemplateDialog: FC<Props> = ({ control }) => {
15
+ const { t } = useTranslation();
16
+ const { templateData } = useTableContext();
17
+
18
+ const [formData, setFormData] = useState<Partial<IReportTemplate>>({});
19
+
20
+ return (
21
+ <Dialog
22
+ title={t('CreateTemplateLong')}
23
+ control={control}
24
+ onFormSubmit={() => console.log('Template saved!')}
25
+ footer={{ confirmButton: { label: t('CreateTemplate'), type: 'submit' } }}
26
+ >
27
+ <TextInput
28
+ label={t('TemplateName')}
29
+ value={formData.name}
30
+ setValue={name => setFormData({ ...formData, name })}
31
+ />
32
+ {templateData?.allowPublicCreate && (
33
+ <Checkbox
34
+ label={t('PublicTemplate')}
35
+ value={formData.isPublic}
36
+ setValue={isPublic => setFormData({ ...formData, isPublic })}
37
+ />
38
+ )}
39
+ </Dialog>
40
+ );
41
+ };
package/src/index.ts CHANGED
@@ -50,6 +50,7 @@ import { NotificationBadge } from './components/Badge/NotificationBadge';
50
50
  import { PillBadge } from './components/Badge/PillBadge';
51
51
  import { Button } from './components/Button/Button';
52
52
  import { IconButton } from './components/Button/IconButton';
53
+ import { SplitButton } from './components/Button/SplitButton';
53
54
  import { Dashboard } from './components/Dashboard/Dashboard';
54
55
  import { DashboardWidget } from './components/Dashboard/DashboardWidget';
55
56
  import { FastLinksWidget } from './components/Dashboard/FastLinksWidget/FastLinksWidget';
@@ -216,6 +217,7 @@ export {
216
217
  Select,
217
218
  SelectAsyncPaginate,
218
219
  SelectCreatable,
220
+ SplitButton,
219
221
  tableCustomLimit1000,
220
222
  Tabs,
221
223
  TextInput,
@@ -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
+ }
@@ -18,6 +18,7 @@
18
18
  font-size: 12px;
19
19
  color: var(--neutral);
20
20
  margin-top: 4px;
21
+ white-space: pre-line;
21
22
  }
22
23
  &.disabled {
23
24
  cursor: default;
@@ -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
 
@@ -29,6 +29,16 @@ export interface ITable<T = unknown> {
29
29
  };
30
30
  filterData?: ITableFilterData;
31
31
  sortData?: ITableSortData;
32
+ templateData?: {
33
+ identifier: string;
34
+ setSearch?: (search: string) => void;
35
+ items: IReportTemplate[];
36
+ isLoading?: boolean;
37
+ // data: IReportTemplateData;
38
+ // setTemplateName?: (templateName: string) => void;
39
+ // onClearFilters: () => void;
40
+ allowPublicCreate?: boolean;
41
+ };
32
42
  printData?: IPrintData<T>;
33
43
  sumRows?: ITableDataItem[];
34
44
  editable?: ITableEdit;
@@ -55,29 +65,6 @@ export interface ITable<T = unknown> {
55
65
  className?: string;
56
66
  rowHeight?: 'xs' | 's' | 'm';
57
67
  maxHeight?: string;
58
- templates?: {
59
- identifier: string;
60
- setSearch?: (search: string) => void;
61
- items: {
62
- uuid: string;
63
- name: string;
64
- // identifier: string;
65
- // filterValues?: IReportTemplateFilterValue[];
66
- // columns: string[];
67
- // organization?: ISimpleObject;
68
- // subsystem?: IModule;
69
- // sorts?: string[];
70
- // isPublic?: boolean;
71
- // isDefault?: boolean;
72
- // order?: number;
73
- // createdAt?: string;
74
- // createdBy?: ISimpleObject;
75
- }[];
76
- // data: IReportTemplateData;
77
- // setTemplateName?: (templateName: string) => void;
78
- // onClearFilters: () => void;
79
- // allowPublicCreate?: boolean;
80
- };
81
68
  }
82
69
 
83
70
  export interface ITableColumn {
@@ -40,7 +40,7 @@ export const i18nIUICyrilic = {
40
40
  Columns: 'Колоне',
41
41
  DragDropListsInfo:
42
42
  'Одаберите колоне за приказивање превлачењем са једне листе на другу',
43
- TableSelect: 'Акције над изабраним елементима',
43
+ TableSelect: 'Акције над изабраним редовима',
44
44
  Filter: 'Филтери',
45
45
  ApplyFilters: 'Примени филтере',
46
46
  HiddenColumns: 'Сакривене колоне',
@@ -40,7 +40,7 @@ export const i18nIUILatin = {
40
40
  Columns: 'Kolone',
41
41
  DragDropListsInfo:
42
42
  'Odaberite kolone za prikazivanje prevlačenjem sa jedne liste na drugu',
43
- TableSelect: 'Akcije nad izabranim elementima',
43
+ TableSelect: 'Akcije nad izabranim redovima',
44
44
  Filter: 'Filteri',
45
45
  ApplyFilters: 'Primeni filtere',
46
46
  HiddenColumns: 'Sakrivene kolone',
@@ -60,15 +60,17 @@ export const i18nIUILatin = {
60
60
  Templates: 'Šabloni',
61
61
  ApplyTemplate: 'Primeni šablon',
62
62
  ResetTemplate: 'Poništi šablon',
63
+ DeleteTemplate: 'Obriši šablon',
64
+ CreateTemplateLong: 'Sačuvaj trenutni izgled kao šablon',
65
+ CreateDefaultTemplate: 'Sačuvaj trenutni izgled kao podrazumevani',
66
+ CreateTemplate: 'Kreiraj šablon',
67
+ TemplateName: 'Naziv šablona',
63
68
  // SelectTemplate: 'Izaberi šablon',
64
69
  // TemplateList: 'Lista šablona',
65
- // PublicTemplate: 'Javni šablon',
70
+ PublicTemplate: 'Javni šablon',
66
71
  // PublicTemplates: 'Javni šabloni',
67
72
  // DefaultTemplate: 'Osnovni šabloni',
68
73
  // RemoveFiltersAndLook: 'Poništi izgled i filtere',
69
- // CreateTemplateLong: 'Sačuvaj trenutni izgled kao šablon',
70
- // CreateDefaultTemplate: 'Sačuvaj trenutni izgled kao podrazumevani',
71
- // CreateTemplate: 'Sačuvaj šablon',
72
74
  // DeleteTemplateDesc: 'Da li ste sigurni da želite da izbrišete šablon?',
73
75
  // DeleteTemplateTitle: 'Brisanje šablona',
74
76
 
@@ -38,7 +38,7 @@ export const i18nIUIMe = {
38
38
  allResults: 'Svi',
39
39
  Columns: 'Kolone',
40
40
  DragDropListsInfo: 'Izaberite kolone za prikaz prevlačenjem sa jedne liste na drugu',
41
- TableSelect: 'Akcije nad izabranim elementima',
41
+ TableSelect: 'Akcije nad izabranim redovima',
42
42
  Filter: 'Filteri',
43
43
  ApplyFilters: 'Primijeni filtere',
44
44
  HiddenColumns: 'Skrivene kolone',
package/tsconfig.json CHANGED
@@ -10,6 +10,8 @@
10
10
  "moduleResolution": "node",
11
11
  "forceConsistentCasingInFileNames": true,
12
12
  "skipLibCheck": true,
13
+ "declaration": true,
14
+ "declarationDir": "dist/types",
13
15
  "paths": {
14
16
  "react": ["./node_modules/@types/react"]
15
17
  }