@true-engineering/true-react-common-ui-kit 3.20.1 → 3.21.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.
Files changed (89) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +6 -0
  3. package/dist/components/DatePicker/types.d.ts +1 -1
  4. package/dist/components/WithPopup/WithPopup.d.ts +1 -1
  5. package/dist/true-react-common-ui-kit.js +60 -58
  6. package/dist/true-react-common-ui-kit.js.map +1 -1
  7. package/dist/true-react-common-ui-kit.umd.cjs +60 -58
  8. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  9. package/package.json +1 -1
  10. package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
  11. package/src/components/AccountInfo/AccountInfo.tsx +80 -80
  12. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  13. package/src/components/AddButton/AddButton.tsx +52 -52
  14. package/src/components/Button/Button.tsx +129 -129
  15. package/src/components/Colors/Colors.stories.tsx +7 -7
  16. package/src/components/DateInput/DateInput.tsx +90 -90
  17. package/src/components/DateInput/constants.ts +2 -2
  18. package/src/components/DatePicker/DatePicker.tsx +310 -308
  19. package/src/components/DatePicker/types.ts +1 -0
  20. package/src/components/Description/Description.stories.tsx +27 -27
  21. package/src/components/Description/Description.tsx +61 -61
  22. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
  23. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
  24. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
  25. package/src/components/Flag/Flag.stories.tsx +29 -29
  26. package/src/components/Flag/Flag.tsx +26 -26
  27. package/src/components/Flag/augment.d.ts +1 -1
  28. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +38 -38
  29. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
  30. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +196 -196
  31. package/src/components/FlexibleTable/helpers.ts +13 -13
  32. package/src/components/Icon/Icon.stories.tsx +86 -86
  33. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  34. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  35. package/src/components/Icon/complexIcons/index.ts +1 -1
  36. package/src/components/IncrementInput/IncrementInput.tsx +105 -105
  37. package/src/components/Input/Input.tsx +297 -297
  38. package/src/components/Input/types.ts +32 -32
  39. package/src/components/List/List.stories.tsx +70 -70
  40. package/src/components/List/List.tsx +33 -33
  41. package/src/components/List/components/ListItem/ListItem.tsx +57 -57
  42. package/src/components/Modal/Modal.stories.tsx +105 -105
  43. package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
  44. package/src/components/MultiSelect/MultiSelect.tsx +106 -106
  45. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
  46. package/src/components/Notification/Notification.stories.tsx +46 -46
  47. package/src/components/Notification/Notification.tsx +69 -69
  48. package/src/components/NumberInput/NumberInput.tsx +137 -137
  49. package/src/components/NumberInput/index.ts +1 -1
  50. package/src/components/PhoneInput/PhoneInput.tsx +214 -214
  51. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
  52. package/src/components/PhoneInput/types.ts +16 -16
  53. package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
  54. package/src/components/RadioButton/RadioButton.tsx +57 -57
  55. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  56. package/src/components/Select/MultiSelect.stories.tsx +240 -240
  57. package/src/components/Select/Select.stories.tsx +235 -235
  58. package/src/components/Select/constants.ts +2 -2
  59. package/src/components/Select/types.ts +1 -1
  60. package/src/components/Selector/Selector.stories.tsx +62 -62
  61. package/src/components/Selector/Selector.tsx +115 -115
  62. package/src/components/Selector/index.ts +2 -2
  63. package/src/components/Selector/types.ts +12 -12
  64. package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
  65. package/src/components/SmartInput/SmartInput.tsx +134 -134
  66. package/src/components/Status/Status.stories.tsx +73 -73
  67. package/src/components/Status/Status.styles.ts +143 -143
  68. package/src/components/Status/Status.tsx +49 -49
  69. package/src/components/Status/constants.ts +11 -11
  70. package/src/components/Status/index.ts +3 -3
  71. package/src/components/Status/types.ts +5 -5
  72. package/src/components/Switch/Switch.stories.tsx +40 -40
  73. package/src/components/Switch/Switch.tsx +75 -75
  74. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
  75. package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
  76. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  77. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
  78. package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
  79. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  80. package/src/components/Toaster/Toaster.stories.tsx +30 -30
  81. package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
  82. package/src/components/Tooltip/Tooltip.tsx +35 -35
  83. package/src/components/Tooltip/types.ts +1 -1
  84. package/src/components/WithPopup/WithPopup.tsx +1 -1
  85. package/src/helpers/popper-helpers.ts +17 -17
  86. package/src/hooks/use-dropdown.ts +84 -84
  87. package/src/hooks/use-is-mounted.ts +15 -15
  88. package/src/theme/helpers.ts +76 -76
  89. package/src/vite-env.d.ts +1 -1
@@ -1,196 +1,196 @@
1
- import { ReactNode, useState, memo, MouseEvent } from 'react';
2
- import clsx from 'clsx';
3
- import {
4
- isEmpty,
5
- isFunction,
6
- isNotEmpty,
7
- isReactNodeNotEmpty,
8
- } from '@true-engineering/true-react-platform-helpers';
9
- import { addDataAttributes } from '../../../../helpers';
10
- import { useTweakStyles } from '../../../../hooks';
11
- import { ICommonProps, IDataAttributes } from '../../../../types';
12
- import {
13
- ITableRow,
14
- IFlexibleTableConfigType,
15
- IFlexibleTableRenderMode,
16
- INestedComponent,
17
- } from '../../types';
18
- import { FlexibleTableCell } from '../FlexibleTableCell';
19
- import { useStyles, IFlexibleTableRowStyles } from './FlexibleTableRow.styles';
20
-
21
- export interface IFlexibleTableRowProps<Row extends ITableRow>
22
- extends Pick<ICommonProps<IFlexibleTableRowStyles>, 'tweakStyles'> {
23
- item: Row;
24
- index: number;
25
- uniqueField?: keyof Row;
26
- renderMode: IFlexibleTableRenderMode;
27
- /** Индексы строк, на которые навешивается класс `active` */
28
- activeRows?: number[];
29
- /** @default false */
30
- isFirstColumnSticky?: boolean;
31
- /** @default false */
32
- isLoading?: boolean;
33
- config: IFlexibleTableConfigType<Row>;
34
- columns: Array<keyof Row & string>;
35
- rowAttributes?: Array<keyof Row>;
36
- /** @default false */
37
- isExpandableRowComponentInitiallyOpen?: boolean | ((row: Row, index: number) => boolean);
38
- /** Возвращает React-элемент, который отрисуется под строкой при нажатии на неё */
39
- expandableRowComponent?: (item: Row, isOpen: boolean, close: () => void) => ReactNode;
40
- // TODO: Заменить string на Generic Values[uniqueField]
41
- onRowHover?: (id?: string) => void;
42
- onRowClick?: (id: string) => void;
43
- }
44
-
45
- function FlexibleTableRowInner<Row extends ITableRow>({
46
- item,
47
- index,
48
- config,
49
- columns,
50
- uniqueField,
51
- renderMode,
52
- activeRows,
53
- isFirstColumnSticky,
54
- isLoading = false,
55
- rowAttributes,
56
- isExpandableRowComponentInitiallyOpen = false,
57
- tweakStyles,
58
- expandableRowComponent,
59
- onRowHover,
60
- onRowClick,
61
- }: IFlexibleTableRowProps<Row>): JSX.Element {
62
- const classes = useStyles({ theme: tweakStyles });
63
-
64
- const tweakTableCellStyles = useTweakStyles({
65
- tweakStyles,
66
- className: 'tweakTableCell',
67
- currentComponentName: 'FlexibleTableRow',
68
- });
69
-
70
- const [isFocused, setFocused] = useState(false);
71
- const [nestedComponent, setNestedComponent] = useState<INestedComponent>(() => {
72
- const isOpen = isFunction(isExpandableRowComponentInitiallyOpen)
73
- ? isExpandableRowComponentInitiallyOpen(item, index)
74
- : isExpandableRowComponentInitiallyOpen;
75
-
76
- const component = isOpen
77
- ? expandableRowComponent?.(item, true, () => {
78
- setNestedComponent({ isOpen: false });
79
- })
80
- : undefined;
81
-
82
- return isReactNodeNotEmpty(component) ? { isOpen: true, component } : { isOpen: false };
83
- });
84
-
85
- const isActive = activeRows?.includes(index) ?? false;
86
- const isEditable = !isLoading && (isNotEmpty(onRowClick) || isNotEmpty(onRowHover));
87
- const isClickable = !isLoading && (isNotEmpty(onRowClick) || isNotEmpty(expandableRowComponent));
88
-
89
- const { isOpen: isNestedComponentExpanded, cellKey: nestedComponentCellKey } = nestedComponent;
90
-
91
- // уникальная разработка, позволяющая прокидывать data-атрибуты в <tr>
92
- // например: rowAttributes={['id']} => <tr data-id="x" />
93
- const rowData = rowAttributes?.reduce<IDataAttributes>(
94
- (acc, cur) => ({ ...acc, [cur]: item[cur] }),
95
- {},
96
- );
97
-
98
- const handleMouseEnter = (event: MouseEvent) => {
99
- if (isNotEmpty(uniqueField) && isNotEmpty(onRowHover)) {
100
- event.stopPropagation();
101
- onRowHover(item[uniqueField]);
102
- setFocused(true);
103
- }
104
- };
105
-
106
- const handleMouseLeave = () => {
107
- onRowHover?.(undefined);
108
- setFocused(false);
109
- };
110
-
111
- const updateNestedComponent = (component?: ReactNode, cellKey?: string) => {
112
- setNestedComponent(
113
- component === undefined ? { isOpen: false } : { isOpen: true, component, cellKey },
114
- );
115
- };
116
-
117
- const closeNestedComponent = () => {
118
- setNestedComponent({ isOpen: false });
119
- };
120
-
121
- const handleRowClick = () => {
122
- if (isNotEmpty(uniqueField)) {
123
- onRowClick?.(item[uniqueField]);
124
- }
125
-
126
- if (isNotEmpty(expandableRowComponent)) {
127
- const newNestedComponent = expandableRowComponent(item, true, closeNestedComponent);
128
-
129
- if (!isNestedComponentExpanded && newNestedComponent !== null) {
130
- updateNestedComponent(newNestedComponent);
131
- return;
132
- }
133
-
134
- if (isNestedComponentExpanded && isEmpty(nestedComponentCellKey)) {
135
- closeNestedComponent();
136
- return;
137
- }
138
- }
139
- };
140
-
141
- const TableRow = renderMode === 'divs' ? 'div' : 'tr';
142
- const TableCell = renderMode === 'divs' ? 'div' : 'td';
143
-
144
- return (
145
- <>
146
- <TableRow
147
- className={clsx(classes.root, {
148
- [classes.active]: isActive,
149
- [classes.editable]: isEditable,
150
- [classes.clickable]: isClickable,
151
- })}
152
- {...(!isLoading && {
153
- onClick: handleRowClick,
154
- onMouseEnter: handleMouseEnter,
155
- onMouseLeave: handleMouseLeave,
156
- })}
157
- {...addDataAttributes({
158
- ...rowData,
159
- active: isActive ? true : undefined,
160
- editable: isEditable ? true : undefined,
161
- isExpandableComponentActive: isNestedComponentExpanded ? true : undefined,
162
- })}
163
- >
164
- {columns.map((key, i) => (
165
- <FlexibleTableCell
166
- key={key}
167
- isSticky={isFirstColumnSticky && i === 0}
168
- isSecond={isFirstColumnSticky && i === 1}
169
- isLoading={isLoading}
170
- row={item}
171
- config={config}
172
- columnName={key}
173
- tweakStyles={tweakTableCellStyles}
174
- renderMode={renderMode}
175
- isFocusedRow={isFocused}
176
- isNestedComponentExpanded={isNestedComponentExpanded && nestedComponentCellKey === key}
177
- isRowNestedComponentExpanded={
178
- isNestedComponentExpanded && isEmpty(nestedComponentCellKey)
179
- }
180
- onSetNestedComponent={(component) => updateNestedComponent(component, key)}
181
- />
182
- ))}
183
- </TableRow>
184
-
185
- {isNestedComponentExpanded && (
186
- <TableRow className={classes.root}>
187
- <TableCell className={classes.nestedComponent} colSpan={columns.length}>
188
- {nestedComponent.component}
189
- </TableCell>
190
- </TableRow>
191
- )}
192
- </>
193
- );
194
- }
195
-
196
- export const FlexibleTableRow = memo(FlexibleTableRowInner) as typeof FlexibleTableRowInner;
1
+ import { ReactNode, useState, memo, MouseEvent } from 'react';
2
+ import clsx from 'clsx';
3
+ import {
4
+ isEmpty,
5
+ isFunction,
6
+ isNotEmpty,
7
+ isReactNodeNotEmpty,
8
+ } from '@true-engineering/true-react-platform-helpers';
9
+ import { addDataAttributes } from '../../../../helpers';
10
+ import { useTweakStyles } from '../../../../hooks';
11
+ import { ICommonProps, IDataAttributes } from '../../../../types';
12
+ import {
13
+ ITableRow,
14
+ IFlexibleTableConfigType,
15
+ IFlexibleTableRenderMode,
16
+ INestedComponent,
17
+ } from '../../types';
18
+ import { FlexibleTableCell } from '../FlexibleTableCell';
19
+ import { useStyles, IFlexibleTableRowStyles } from './FlexibleTableRow.styles';
20
+
21
+ export interface IFlexibleTableRowProps<Row extends ITableRow>
22
+ extends Pick<ICommonProps<IFlexibleTableRowStyles>, 'tweakStyles'> {
23
+ item: Row;
24
+ index: number;
25
+ uniqueField?: keyof Row;
26
+ renderMode: IFlexibleTableRenderMode;
27
+ /** Индексы строк, на которые навешивается класс `active` */
28
+ activeRows?: number[];
29
+ /** @default false */
30
+ isFirstColumnSticky?: boolean;
31
+ /** @default false */
32
+ isLoading?: boolean;
33
+ config: IFlexibleTableConfigType<Row>;
34
+ columns: Array<keyof Row & string>;
35
+ rowAttributes?: Array<keyof Row>;
36
+ /** @default false */
37
+ isExpandableRowComponentInitiallyOpen?: boolean | ((row: Row, index: number) => boolean);
38
+ /** Возвращает React-элемент, который отрисуется под строкой при нажатии на неё */
39
+ expandableRowComponent?: (item: Row, isOpen: boolean, close: () => void) => ReactNode;
40
+ // TODO: Заменить string на Generic Values[uniqueField]
41
+ onRowHover?: (id?: string) => void;
42
+ onRowClick?: (id: string) => void;
43
+ }
44
+
45
+ function FlexibleTableRowInner<Row extends ITableRow>({
46
+ item,
47
+ index,
48
+ config,
49
+ columns,
50
+ uniqueField,
51
+ renderMode,
52
+ activeRows,
53
+ isFirstColumnSticky,
54
+ isLoading = false,
55
+ rowAttributes,
56
+ isExpandableRowComponentInitiallyOpen = false,
57
+ tweakStyles,
58
+ expandableRowComponent,
59
+ onRowHover,
60
+ onRowClick,
61
+ }: IFlexibleTableRowProps<Row>): JSX.Element {
62
+ const classes = useStyles({ theme: tweakStyles });
63
+
64
+ const tweakTableCellStyles = useTweakStyles({
65
+ tweakStyles,
66
+ className: 'tweakTableCell',
67
+ currentComponentName: 'FlexibleTableRow',
68
+ });
69
+
70
+ const [isFocused, setFocused] = useState(false);
71
+ const [nestedComponent, setNestedComponent] = useState<INestedComponent>(() => {
72
+ const isOpen = isFunction(isExpandableRowComponentInitiallyOpen)
73
+ ? isExpandableRowComponentInitiallyOpen(item, index)
74
+ : isExpandableRowComponentInitiallyOpen;
75
+
76
+ const component = isOpen
77
+ ? expandableRowComponent?.(item, true, () => {
78
+ setNestedComponent({ isOpen: false });
79
+ })
80
+ : undefined;
81
+
82
+ return isReactNodeNotEmpty(component) ? { isOpen: true, component } : { isOpen: false };
83
+ });
84
+
85
+ const isActive = activeRows?.includes(index) ?? false;
86
+ const isEditable = !isLoading && (isNotEmpty(onRowClick) || isNotEmpty(onRowHover));
87
+ const isClickable = !isLoading && (isNotEmpty(onRowClick) || isNotEmpty(expandableRowComponent));
88
+
89
+ const { isOpen: isNestedComponentExpanded, cellKey: nestedComponentCellKey } = nestedComponent;
90
+
91
+ // уникальная разработка, позволяющая прокидывать data-атрибуты в <tr>
92
+ // например: rowAttributes={['id']} => <tr data-id="x" />
93
+ const rowData = rowAttributes?.reduce<IDataAttributes>(
94
+ (acc, cur) => ({ ...acc, [cur]: item[cur] }),
95
+ {},
96
+ );
97
+
98
+ const handleMouseEnter = (event: MouseEvent) => {
99
+ if (isNotEmpty(uniqueField) && isNotEmpty(onRowHover)) {
100
+ event.stopPropagation();
101
+ onRowHover(item[uniqueField]);
102
+ setFocused(true);
103
+ }
104
+ };
105
+
106
+ const handleMouseLeave = () => {
107
+ onRowHover?.(undefined);
108
+ setFocused(false);
109
+ };
110
+
111
+ const updateNestedComponent = (component?: ReactNode, cellKey?: string) => {
112
+ setNestedComponent(
113
+ component === undefined ? { isOpen: false } : { isOpen: true, component, cellKey },
114
+ );
115
+ };
116
+
117
+ const closeNestedComponent = () => {
118
+ setNestedComponent({ isOpen: false });
119
+ };
120
+
121
+ const handleRowClick = () => {
122
+ if (isNotEmpty(uniqueField)) {
123
+ onRowClick?.(item[uniqueField]);
124
+ }
125
+
126
+ if (isNotEmpty(expandableRowComponent)) {
127
+ const newNestedComponent = expandableRowComponent(item, true, closeNestedComponent);
128
+
129
+ if (!isNestedComponentExpanded && newNestedComponent !== null) {
130
+ updateNestedComponent(newNestedComponent);
131
+ return;
132
+ }
133
+
134
+ if (isNestedComponentExpanded && isEmpty(nestedComponentCellKey)) {
135
+ closeNestedComponent();
136
+ return;
137
+ }
138
+ }
139
+ };
140
+
141
+ const TableRow = renderMode === 'divs' ? 'div' : 'tr';
142
+ const TableCell = renderMode === 'divs' ? 'div' : 'td';
143
+
144
+ return (
145
+ <>
146
+ <TableRow
147
+ className={clsx(classes.root, {
148
+ [classes.active]: isActive,
149
+ [classes.editable]: isEditable,
150
+ [classes.clickable]: isClickable,
151
+ })}
152
+ {...(!isLoading && {
153
+ onClick: handleRowClick,
154
+ onMouseEnter: handleMouseEnter,
155
+ onMouseLeave: handleMouseLeave,
156
+ })}
157
+ {...addDataAttributes({
158
+ ...rowData,
159
+ active: isActive ? true : undefined,
160
+ editable: isEditable ? true : undefined,
161
+ isExpandableComponentActive: isNestedComponentExpanded ? true : undefined,
162
+ })}
163
+ >
164
+ {columns.map((key, i) => (
165
+ <FlexibleTableCell
166
+ key={key}
167
+ isSticky={isFirstColumnSticky && i === 0}
168
+ isSecond={isFirstColumnSticky && i === 1}
169
+ isLoading={isLoading}
170
+ row={item}
171
+ config={config}
172
+ columnName={key}
173
+ tweakStyles={tweakTableCellStyles}
174
+ renderMode={renderMode}
175
+ isFocusedRow={isFocused}
176
+ isNestedComponentExpanded={isNestedComponentExpanded && nestedComponentCellKey === key}
177
+ isRowNestedComponentExpanded={
178
+ isNestedComponentExpanded && isEmpty(nestedComponentCellKey)
179
+ }
180
+ onSetNestedComponent={(component) => updateNestedComponent(component, key)}
181
+ />
182
+ ))}
183
+ </TableRow>
184
+
185
+ {isNestedComponentExpanded && (
186
+ <TableRow className={classes.root}>
187
+ <TableCell className={classes.nestedComponent} colSpan={columns.length}>
188
+ {nestedComponent.component}
189
+ </TableCell>
190
+ </TableRow>
191
+ )}
192
+ </>
193
+ );
194
+ }
195
+
196
+ export const FlexibleTableRow = memo(FlexibleTableRowInner) as typeof FlexibleTableRowInner;
@@ -1,13 +1,13 @@
1
- import { format } from 'date-fns';
2
- import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import { DEFAULT_DATE_FORMAT } from './constants';
4
- import { IFlexibleTableConfigType } from './types';
5
-
6
- export const hasHorizontalScrollBar = (el: HTMLElement | null | undefined): boolean =>
7
- isNotEmpty(el) && el.scrollWidth !== el.clientWidth;
8
-
9
- export const formatCellContent = <Values>(
10
- value: unknown,
11
- config?: IFlexibleTableConfigType<Values>[keyof Values],
12
- ): string =>
13
- value instanceof Date ? format(value, config?.dateFormat ?? DEFAULT_DATE_FORMAT) : String(value);
1
+ import { format } from 'date-fns';
2
+ import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
+ import { DEFAULT_DATE_FORMAT } from './constants';
4
+ import { IFlexibleTableConfigType } from './types';
5
+
6
+ export const hasHorizontalScrollBar = (el: HTMLElement | null | undefined): boolean =>
7
+ isNotEmpty(el) && el.scrollWidth !== el.clientWidth;
8
+
9
+ export const formatCellContent = <Values>(
10
+ value: unknown,
11
+ config?: IFlexibleTableConfigType<Values>[keyof Values],
12
+ ): string =>
13
+ value instanceof Date ? format(value, config?.dateFormat ?? DEFAULT_DATE_FORMAT) : String(value);
@@ -1,86 +1,86 @@
1
- import { Icon } from './Icon';
2
- import { complexIcons } from './complexIcons';
3
- import { iconsList } from './icons-list';
4
- import { IIconType } from './types';
5
-
6
- const types: IIconType[] = [...Object.keys(iconsList), ...Object.keys(complexIcons)] as IIconType[];
7
-
8
- export default {
9
- title: 'Data Display/Icon',
10
- };
11
-
12
- export const Default = () => (
13
- <div
14
- style={{
15
- border: '1px dotted rgba(0,0,0,.2)',
16
- // color: color('Container color', colors.GREEN_FOCUS),
17
- display: 'flex',
18
- // width: number('Container width', 40, {
19
- // range: true,
20
- // min: 0,
21
- // max: 200,
22
- // step: 10,
23
- // }),
24
- // height: number('Container height', 40, {
25
- // range: true,
26
- // min: 0,
27
- // max: 200,
28
- // step: 10,
29
- // }),
30
- }}
31
- >
32
- {/* <Icon type={select('type', types, types[0])} /> */}
33
- </div>
34
- );
35
-
36
- export const Gallery = () => (
37
- <div
38
- style={{
39
- display: 'flex',
40
- alignItems: 'center',
41
- justifyContent: 'center',
42
- flexWrap: 'wrap',
43
- width: '80vw',
44
- }}
45
- >
46
- {types.map((type) => (
47
- <div
48
- key={type}
49
- style={{
50
- width: 100,
51
- height: 100,
52
- margin: 1,
53
- background: '#f7f7f7',
54
- display: 'flex',
55
- alignItems: 'center',
56
- justifyContent: 'center',
57
- flexDirection: 'column',
58
- }}
59
- >
60
- <div
61
- style={{
62
- width: 32,
63
- height: 32,
64
- margin: '10px 0',
65
- display: 'flex',
66
- alignItems: 'center',
67
- color: '#888',
68
- }}
69
- >
70
- <Icon type={type} />
71
- </div>
72
- <div
73
- style={{
74
- fontFamily: 'Arial',
75
- fontSize: 13,
76
- color: '#747679',
77
- overflow: 'hidden',
78
- padding: '0 5px',
79
- }}
80
- >
81
- {type}
82
- </div>
83
- </div>
84
- ))}
85
- </div>
86
- );
1
+ import { Icon } from './Icon';
2
+ import { complexIcons } from './complexIcons';
3
+ import { iconsList } from './icons-list';
4
+ import { IIconType } from './types';
5
+
6
+ const types: IIconType[] = [...Object.keys(iconsList), ...Object.keys(complexIcons)] as IIconType[];
7
+
8
+ export default {
9
+ title: 'Data Display/Icon',
10
+ };
11
+
12
+ export const Default = () => (
13
+ <div
14
+ style={{
15
+ border: '1px dotted rgba(0,0,0,.2)',
16
+ // color: color('Container color', colors.GREEN_FOCUS),
17
+ display: 'flex',
18
+ // width: number('Container width', 40, {
19
+ // range: true,
20
+ // min: 0,
21
+ // max: 200,
22
+ // step: 10,
23
+ // }),
24
+ // height: number('Container height', 40, {
25
+ // range: true,
26
+ // min: 0,
27
+ // max: 200,
28
+ // step: 10,
29
+ // }),
30
+ }}
31
+ >
32
+ {/* <Icon type={select('type', types, types[0])} /> */}
33
+ </div>
34
+ );
35
+
36
+ export const Gallery = () => (
37
+ <div
38
+ style={{
39
+ display: 'flex',
40
+ alignItems: 'center',
41
+ justifyContent: 'center',
42
+ flexWrap: 'wrap',
43
+ width: '80vw',
44
+ }}
45
+ >
46
+ {types.map((type) => (
47
+ <div
48
+ key={type}
49
+ style={{
50
+ width: 100,
51
+ height: 100,
52
+ margin: 1,
53
+ background: '#f7f7f7',
54
+ display: 'flex',
55
+ alignItems: 'center',
56
+ justifyContent: 'center',
57
+ flexDirection: 'column',
58
+ }}
59
+ >
60
+ <div
61
+ style={{
62
+ width: 32,
63
+ height: 32,
64
+ margin: '10px 0',
65
+ display: 'flex',
66
+ alignItems: 'center',
67
+ color: '#888',
68
+ }}
69
+ >
70
+ <Icon type={type} />
71
+ </div>
72
+ <div
73
+ style={{
74
+ fontFamily: 'Arial',
75
+ fontSize: 13,
76
+ color: '#747679',
77
+ overflow: 'hidden',
78
+ padding: '0 5px',
79
+ }}
80
+ >
81
+ {type}
82
+ </div>
83
+ </div>
84
+ ))}
85
+ </div>
86
+ );
@@ -1 +1 @@
1
- declare module '*.svg?raw';
1
+ declare module '*.svg?raw';