@synerise/ds-icon-picker 1.1.2 → 1.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/CHANGELOG.md +11 -0
- package/README.md +22 -8
- package/dist/IconPicker.const.d.ts +2 -0
- package/dist/IconPicker.const.js +2 -0
- package/dist/IconPicker.d.ts +2 -2
- package/dist/IconPicker.js +39 -26
- package/dist/IconPicker.styles.d.ts +11 -2
- package/dist/IconPicker.styles.js +27 -10
- package/dist/IconPicker.types.d.ts +43 -9
- package/dist/components/List/List.d.ts +4 -0
- package/dist/components/List/List.js +51 -0
- package/dist/components/ListItem/ListItem.d.ts +5 -0
- package/dist/{ListItem → components/ListItem}/ListItem.js +11 -8
- package/dist/components/ListItem/ListItem.types.d.ts +7 -0
- package/dist/components/Overlay/Overlay.d.ts +5 -0
- package/dist/components/Overlay/Overlay.types.d.ts +9 -0
- package/dist/components/RowItem.d.ts +3 -0
- package/dist/components/RowItem.js +29 -0
- package/dist/hooks/useGroupItems.d.ts +2 -0
- package/dist/hooks/useGroupItems.js +26 -0
- package/dist/hooks/useIconSourceLoader.d.ts +2 -0
- package/dist/hooks/useIconSourceLoader.js +106 -0
- package/dist/index.d.ts +1 -1
- package/dist/utils/createItemData.d.ts +2 -0
- package/dist/utils/createItemData.js +9 -0
- package/dist/utils/loadFontAwesome.d.ts +7 -0
- package/dist/utils/loadFontAwesome.js +41 -0
- package/dist/utils/matchesSearchQuery.d.ts +1 -0
- package/dist/utils/matchesSearchQuery.js +3 -0
- package/dist/utils/prepareItems.d.ts +2 -0
- package/dist/utils/prepareItems.js +12 -0
- package/dist/utils/typeguards.utils.d.ts +5 -0
- package/dist/utils/typeguards.utils.js +12 -0
- package/package.json +13 -7
- package/dist/List/List.d.ts +0 -4
- package/dist/List/List.js +0 -34
- package/dist/List/List.types.d.ts +0 -7
- package/dist/List/List.types.js +0 -1
- package/dist/ListItem/ListItem.d.ts +0 -4
- package/dist/ListItem/ListItem.types.d.ts +0 -7
- package/dist/Overlay/Overlay.d.ts +0 -4
- package/dist/Overlay/Overlay.types.d.ts +0 -7
- /package/dist/{ListItem → components/ListItem}/ListItem.types.js +0 -0
- /package/dist/{Overlay → components/Overlay}/Overlay.js +0 -0
- /package/dist/{Overlay → components/Overlay}/Overlay.types.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.2.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-icon-picker@1.1.2...@synerise/ds-icon-picker@1.2.0) (2025-04-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **icon-picker:** add font-awesome icons ([410af61](https://github.com/Synerise/synerise-design/commit/410af613d20ac65ad244cbaa823abdc9fb3dfaf2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.1.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-icon-picker@1.1.1...@synerise/ds-icon-picker@1.1.2) (2025-04-02)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-icon-picker
|
package/README.md
CHANGED
|
@@ -13,6 +13,18 @@ or
|
|
|
13
13
|
yarn add @synerise/ds-icon-picker
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
If you intend to use font-awesome icon you also need to have these packages installed, as they are not included in this package:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
21
|
+
"@fortawesome/fontawesome-svg-core": "^6",
|
|
22
|
+
"@fortawesome/free-brands-svg-icons": "^6",
|
|
23
|
+
"@fortawesome/free-regular-svg-icons": "^6",
|
|
24
|
+
"@fortawesome/free-solid-svg-icons": "^6"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
16
28
|
## Usage
|
|
17
29
|
|
|
18
30
|
```
|
|
@@ -28,11 +40,13 @@ import IconPicker from '@synerise/ds-icon-picker'
|
|
|
28
40
|
|
|
29
41
|
## API
|
|
30
42
|
|
|
31
|
-
| Property | Description | Type
|
|
32
|
-
| ----------- | --------------------------------------------------- |
|
|
33
|
-
| button | Button Node |
|
|
34
|
-
| data |
|
|
35
|
-
| noResultMsg | Node displayed when no items matches searched query |
|
|
36
|
-
| onSelect | Action on icon select |
|
|
37
|
-
| placeholder | Input placeholder | string
|
|
38
|
-
| trigger | Trigger type | `['click', 'hover', 'contextMenu']`
|
|
43
|
+
| Property | Description | Type | Default |
|
|
44
|
+
| ----------- | --------------------------------------------------- | ----------------------------------------------- | ------- |
|
|
45
|
+
| button | Button Node | ReactElement | - |
|
|
46
|
+
| data | Icons list source | 'design-system' / 'font-awesome' / DataSource[] | - |
|
|
47
|
+
| noResultMsg | Node displayed when no items matches searched query | ReactNode | - |
|
|
48
|
+
| onSelect | Action on icon select | OnSelectType | - |
|
|
49
|
+
| placeholder | Input placeholder | string | - |
|
|
50
|
+
| trigger | Trigger type | `['click', 'hover', 'contextMenu']` | [] |
|
|
51
|
+
|
|
52
|
+
OnSelectType depends on the icon list source. For `design-system` or plain items provided as `DataSource[]` it is `(item: ReactNode) => void;`. For `font-awesome` it is `(item: [IconPrefix, IconName]) => void;`. See FontAwesome docs on how to use the IconPrefix and IconName to display an icon.
|
package/dist/IconPicker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IconPickerProps } from './IconPicker.types';
|
|
3
|
-
declare const IconPicker: ({ button, data, onSelect, trigger, placeholder, noResultMsg }: IconPickerProps) => React.JSX.Element;
|
|
2
|
+
import { IconPickerProps, SourceType } from './IconPicker.types';
|
|
3
|
+
declare const IconPicker: <IconSource extends SourceType>({ button, data, onSelect, trigger, placeholder, noResultMsg, }: IconPickerProps<IconSource>) => React.JSX.Element;
|
|
4
4
|
export default IconPicker;
|
package/dist/IconPicker.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
3
|
import Dropdown from '@synerise/ds-dropdown';
|
|
3
4
|
import { useOnClickOutside } from '@synerise/ds-utils';
|
|
4
5
|
import * as S from './IconPicker.styles';
|
|
5
|
-
import Overlay from './Overlay/Overlay';
|
|
6
|
+
import Overlay from './components/Overlay/Overlay';
|
|
7
|
+
import { useIconSourceLoader } from './hooks/useIconSourceLoader';
|
|
8
|
+
import { matchesSearchQuery } from './utils/matchesSearchQuery';
|
|
6
9
|
var IconPicker = function IconPicker(_ref) {
|
|
7
10
|
var button = _ref.button,
|
|
8
11
|
data = _ref.data,
|
|
9
|
-
|
|
12
|
+
onSelect = _ref.onSelect,
|
|
10
13
|
trigger = _ref.trigger,
|
|
11
14
|
placeholder = _ref.placeholder,
|
|
12
15
|
noResultMsg = _ref.noResultMsg;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
var items = useIconSourceLoader(data);
|
|
17
|
+
var _useState = useState(items),
|
|
18
|
+
filteredItems = _useState[0],
|
|
19
|
+
setFilteredItems = _useState[1];
|
|
16
20
|
var _useState2 = useState(''),
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
searchQuery = _useState2[0],
|
|
22
|
+
setSearchQuery = _useState2[1];
|
|
19
23
|
var _useState3 = useState(false),
|
|
20
24
|
isOpen = _useState3[0],
|
|
21
25
|
setOpen = _useState3[1];
|
|
@@ -23,24 +27,38 @@ var IconPicker = function IconPicker(_ref) {
|
|
|
23
27
|
focus = _useState4[0],
|
|
24
28
|
setFocus = _useState4[1];
|
|
25
29
|
var ref = useRef(null);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
if (searchQuery) {
|
|
32
|
+
var groups = items.map(function (group) {
|
|
33
|
+
var matching = group.items.filter(function (icon) {
|
|
34
|
+
return icon.keywords && matchesSearchQuery(icon.keywords, searchQuery);
|
|
35
|
+
});
|
|
36
|
+
return _extends({}, group, {
|
|
37
|
+
items: matching
|
|
38
|
+
});
|
|
39
|
+
}).filter(function (group) {
|
|
40
|
+
return group.items.length;
|
|
41
|
+
});
|
|
42
|
+
setFilteredItems(groups);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
setFilteredItems(items);
|
|
46
|
+
}, [searchQuery, items]);
|
|
33
47
|
useOnClickOutside(ref, function () {
|
|
34
48
|
setOpen(false);
|
|
49
|
+
setSearchQuery('');
|
|
35
50
|
});
|
|
36
51
|
var onClearInput = function onClearInput() {
|
|
37
|
-
|
|
38
|
-
setFilteredData(data);
|
|
52
|
+
setSearchQuery('');
|
|
39
53
|
};
|
|
40
54
|
var toggleOpen = function toggleOpen(newState) {
|
|
41
55
|
setOpen(newState);
|
|
42
56
|
setFocus(newState);
|
|
43
57
|
};
|
|
58
|
+
var handleSelect = function handleSelect(value) {
|
|
59
|
+
toggleOpen(false);
|
|
60
|
+
onSelect(value);
|
|
61
|
+
};
|
|
44
62
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
45
63
|
visible: isOpen,
|
|
46
64
|
onVisibleChange: toggleOpen,
|
|
@@ -49,17 +67,12 @@ var IconPicker = function IconPicker(_ref) {
|
|
|
49
67
|
overlay: /*#__PURE__*/React.createElement(S.Overlay, {
|
|
50
68
|
ref: ref
|
|
51
69
|
}, /*#__PURE__*/React.createElement(Overlay, {
|
|
52
|
-
value:
|
|
53
|
-
onSearchChange:
|
|
54
|
-
return filter(val);
|
|
55
|
-
},
|
|
70
|
+
value: searchQuery,
|
|
71
|
+
onSearchChange: setSearchQuery,
|
|
56
72
|
onClearInput: onClearInput,
|
|
57
73
|
placeholder: placeholder,
|
|
58
|
-
data:
|
|
59
|
-
onSelect:
|
|
60
|
-
toggleOpen(false);
|
|
61
|
-
_onSelect(val);
|
|
62
|
-
},
|
|
74
|
+
data: filteredItems,
|
|
75
|
+
onSelect: handleSelect,
|
|
63
76
|
focus: focus,
|
|
64
77
|
noResultMsg: noResultMsg
|
|
65
78
|
}))
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { FixedSizeList } from 'react-window';
|
|
1
2
|
export declare const List: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const ListItem: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
export declare const ListItem: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
itemsPerRow: number;
|
|
5
|
+
}, never>;
|
|
3
6
|
export declare const OverlayWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const VirtualList: import("styled-components").StyledComponent<typeof FixedSizeList, any, {
|
|
8
|
+
listHeight: number;
|
|
9
|
+
}, never>;
|
|
4
10
|
export declare const Overlay: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
5
|
-
export declare const Title: import("styled-components").StyledComponent<"div", any, {
|
|
11
|
+
export declare const Title: import("styled-components").StyledComponent<"div", any, {
|
|
12
|
+
elementSize: string;
|
|
13
|
+
}, never>;
|
|
6
14
|
export declare const FontIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
15
|
export declare const IconTrigger: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
16
|
export declare const NoResults: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
17
|
export declare const Icon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
18
|
export declare const Content: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const ListRow: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FixedSizeList } from 'react-window';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
export var List = styled.div.withConfig({
|
|
3
4
|
displayName: "IconPickerstyles__List",
|
|
@@ -6,14 +7,22 @@ export var List = styled.div.withConfig({
|
|
|
6
7
|
export var ListItem = styled.div.withConfig({
|
|
7
8
|
displayName: "IconPickerstyles__ListItem",
|
|
8
9
|
componentId: "sc-iun0xm-1"
|
|
9
|
-
})(["width:
|
|
10
|
+
})(["display:flex;width:", "%;align-items:center;justify-content:center;button{transition-duration:0s;}"], function (props) {
|
|
11
|
+
return 100 / props.itemsPerRow;
|
|
12
|
+
});
|
|
10
13
|
export var OverlayWrapper = styled.div.withConfig({
|
|
11
14
|
displayName: "IconPickerstyles__OverlayWrapper",
|
|
12
15
|
componentId: "sc-iun0xm-2"
|
|
13
16
|
})(["padding:6px;"]);
|
|
17
|
+
export var VirtualList = styled(FixedSizeList).withConfig({
|
|
18
|
+
displayName: "IconPickerstyles__VirtualList",
|
|
19
|
+
componentId: "sc-iun0xm-3"
|
|
20
|
+
})(["max-height:", "px;height:auto !important;overflow-x:unset !important;overflow-y:unset !important;"], function (props) {
|
|
21
|
+
return props.listHeight;
|
|
22
|
+
});
|
|
14
23
|
export var Overlay = styled.span.withConfig({
|
|
15
24
|
displayName: "IconPickerstyles__Overlay",
|
|
16
|
-
componentId: "sc-iun0xm-
|
|
25
|
+
componentId: "sc-iun0xm-4"
|
|
17
26
|
})(["width:250px;background-color:", ";position:relative;display:block;border-radius:3px;", ":not(:last-child){&::after{content:'';display:flex;width:calc(100% - 6px);height:1px;background-image:linear-gradient( to right,", " 40%,", " 100%,transparent 0% );background-position:0 bottom;background-size:4px 1px;background-repeat:repeat-x;margin:4px auto 0;}}", ":first-child{padding-top:16px;}"], function (props) {
|
|
18
27
|
return props.theme.palette.white;
|
|
19
28
|
}, OverlayWrapper, function (_ref) {
|
|
@@ -25,27 +34,35 @@ export var Overlay = styled.span.withConfig({
|
|
|
25
34
|
}, OverlayWrapper);
|
|
26
35
|
export var Title = styled.div.withConfig({
|
|
27
36
|
displayName: "IconPickerstyles__Title",
|
|
28
|
-
componentId: "sc-iun0xm-
|
|
29
|
-
})(["font-size:10px;line-height:1.6;font-weight:500;text-transform:uppercase;color:", ";padding:0
|
|
37
|
+
componentId: "sc-iun0xm-5"
|
|
38
|
+
})(["font-size:10px;line-height:1.6;font-weight:500;text-transform:uppercase;color:", ";padding:0 12px;flex-basis:100%;height:", ";line-height:", ";"], function (props) {
|
|
30
39
|
return props.theme.palette['grey-500'];
|
|
40
|
+
}, function (props) {
|
|
41
|
+
return props.elementSize;
|
|
42
|
+
}, function (props) {
|
|
43
|
+
return props.elementSize;
|
|
31
44
|
});
|
|
32
45
|
export var FontIcon = styled.div.withConfig({
|
|
33
46
|
displayName: "IconPickerstyles__FontIcon",
|
|
34
|
-
componentId: "sc-iun0xm-
|
|
47
|
+
componentId: "sc-iun0xm-6"
|
|
35
48
|
})(["font-family:'apple color emoji,segoe ui emoji,noto color emoji,android emoji,emojisymbols,emojione mozilla,twemoji mozilla,segoe ui symbol';font-size:18px;line-height:35px;"]);
|
|
36
49
|
export var IconTrigger = styled.div.withConfig({
|
|
37
50
|
displayName: "IconPickerstyles__IconTrigger",
|
|
38
|
-
componentId: "sc-iun0xm-
|
|
51
|
+
componentId: "sc-iun0xm-7"
|
|
39
52
|
})(["display:inline-block;cursor:pointer;&&&{.icon-wrapper{display:flex;pointer-events:none;svg{fill:currentColor;}}}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:144dpi){letter-spacing:-0.2em;}"]);
|
|
40
53
|
export var NoResults = styled.div.withConfig({
|
|
41
54
|
displayName: "IconPickerstyles__NoResults",
|
|
42
|
-
componentId: "sc-iun0xm-
|
|
55
|
+
componentId: "sc-iun0xm-8"
|
|
43
56
|
})(["min-height:206px;display:flex;justify-content:center;"]);
|
|
44
57
|
export var Icon = styled.div.withConfig({
|
|
45
58
|
displayName: "IconPickerstyles__Icon",
|
|
46
|
-
componentId: "sc-iun0xm-
|
|
59
|
+
componentId: "sc-iun0xm-9"
|
|
47
60
|
})(["width:40px;height:40px;background:rgba(148,158,166,0.05);border-radius:50%;display:flex;align-items:center;justify-content:center;margin:0 auto;"]);
|
|
48
61
|
export var Content = styled.div.withConfig({
|
|
49
62
|
displayName: "IconPickerstyles__Content",
|
|
50
|
-
componentId: "sc-iun0xm-
|
|
51
|
-
})(["margin-top:42px;p{margin-top:16px;font-size:14px;line-height:1.43;text-align:center;}"]);
|
|
63
|
+
componentId: "sc-iun0xm-10"
|
|
64
|
+
})(["margin-top:42px;p{margin-top:16px;font-size:14px;line-height:1.43;text-align:center;}"]);
|
|
65
|
+
export var ListRow = styled.div.withConfig({
|
|
66
|
+
displayName: "IconPickerstyles__ListRow",
|
|
67
|
+
componentId: "sc-iun0xm-11"
|
|
68
|
+
})(["display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;box-sizing:border-box;width:100%;height:100%;max-width:100%;"]);
|
|
@@ -1,16 +1,50 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { IconName, IconPrefix } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
3
|
+
export type FilterItem<ValueType extends FAValue | ReactNode> = {
|
|
4
|
+
keywords?: string;
|
|
5
|
+
value: ValueType;
|
|
3
6
|
item: ReactNode;
|
|
4
7
|
};
|
|
5
|
-
export type FilterElement = {
|
|
6
|
-
|
|
7
|
-
items: FilterItem[];
|
|
8
|
+
export type FilterElement<ValueType extends FAValue | ReactNode = ReactNode> = Category & {
|
|
9
|
+
items: FilterItem<ValueType>[];
|
|
8
10
|
};
|
|
9
|
-
export type
|
|
11
|
+
export type DataSource = Category & {
|
|
12
|
+
items: {
|
|
13
|
+
item: ReactNode;
|
|
14
|
+
value?: ReactNode;
|
|
15
|
+
keywords?: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
export type Category = {
|
|
19
|
+
category: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export type FAValue = [IconPrefix, IconName];
|
|
22
|
+
export type ValueTypeForSource<Source extends SourceType> = Source extends FASource ? FAValue : ReactNode;
|
|
23
|
+
export type SelectItemHandler<Source extends SourceType> = (prop: ValueTypeForSource<Source>) => void;
|
|
24
|
+
export type GroupedFilterElement<Source extends SourceType> = Category[] | FilterItem<ValueTypeForSource<Source>>[];
|
|
25
|
+
export type FASource = 'font-awesome';
|
|
26
|
+
export type DSSource = 'design-system';
|
|
27
|
+
export type SourceType = FASource | DSSource | DataSource[];
|
|
28
|
+
export type IconPickerProps<Source extends SourceType> = {
|
|
10
29
|
button: ReactElement;
|
|
11
|
-
data:
|
|
12
|
-
onSelect:
|
|
30
|
+
data: Source;
|
|
31
|
+
onSelect: SelectItemHandler<Source>;
|
|
13
32
|
trigger: ('click' | 'hover' | 'contextMenu')[];
|
|
14
33
|
placeholder: string;
|
|
15
|
-
noResultMsg?:
|
|
34
|
+
noResultMsg?: ReactNode;
|
|
35
|
+
};
|
|
36
|
+
export type ListItemData<Source extends SourceType> = {
|
|
37
|
+
elementSize: number;
|
|
38
|
+
itemsPerRow: number;
|
|
39
|
+
items: GroupedFilterElement<Source>[];
|
|
40
|
+
} & Pick<ListProps<Source>, 'onSelect'>;
|
|
41
|
+
export type ListProps<Source extends SourceType> = {
|
|
42
|
+
data: FilterElement<ValueTypeForSource<Source>>[];
|
|
43
|
+
onSelect: SelectItemHandler<Source>;
|
|
44
|
+
noResultMsg?: ReactNode;
|
|
45
|
+
};
|
|
46
|
+
export type RowItemProps<Source extends SourceType> = {
|
|
47
|
+
data: ListItemData<Source>;
|
|
48
|
+
index: number;
|
|
49
|
+
style: CSSProperties;
|
|
16
50
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import Scrollbar from '@synerise/ds-scrollbar';
|
|
4
|
+
import Icon, { SearchNoResultsM } from '@synerise/ds-icon';
|
|
5
|
+
import { useTheme } from '@synerise/ds-core';
|
|
6
|
+
import { createItemData } from '../../utils/createItemData';
|
|
7
|
+
import { useGroupItems } from '../../hooks/useGroupItems';
|
|
8
|
+
import { RowItem } from '../RowItem';
|
|
9
|
+
import * as S from '../../IconPicker.styles';
|
|
10
|
+
import { ELEMENT_HEIGHT, ITEMS_PER_ROW } from '../../IconPicker.const';
|
|
11
|
+
var List = function List(_ref) {
|
|
12
|
+
var data = _ref.data,
|
|
13
|
+
onSelect = _ref.onSelect,
|
|
14
|
+
_ref$noResultMsg = _ref.noResultMsg,
|
|
15
|
+
noResultMsg = _ref$noResultMsg === void 0 ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
16
|
+
id: "DS.ICON-PICKER.NO-RESULTS"
|
|
17
|
+
}) : _ref$noResultMsg;
|
|
18
|
+
var theme = useTheme();
|
|
19
|
+
var groupedData = useGroupItems(data, ITEMS_PER_ROW);
|
|
20
|
+
var listRef = useRef(null);
|
|
21
|
+
var scrollBarRef = useRef(null);
|
|
22
|
+
var handleScroll = function handleScroll(_ref2) {
|
|
23
|
+
var currentTarget = _ref2.currentTarget;
|
|
24
|
+
var scrollTop = currentTarget.scrollTop;
|
|
25
|
+
if (listRef.current) {
|
|
26
|
+
listRef.current.scrollTo(scrollTop);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var itemData = createItemData(groupedData, ELEMENT_HEIGHT, onSelect, ITEMS_PER_ROW);
|
|
30
|
+
return /*#__PURE__*/React.createElement(Scrollbar, {
|
|
31
|
+
ref: scrollBarRef,
|
|
32
|
+
absolute: true,
|
|
33
|
+
"data-testid": "icon-list",
|
|
34
|
+
maxHeight: 330,
|
|
35
|
+
onScroll: handleScroll
|
|
36
|
+
}, !data.length ? /*#__PURE__*/React.createElement(S.OverlayWrapper, null, /*#__PURE__*/React.createElement(S.NoResults, null, /*#__PURE__*/React.createElement(S.Content, null, /*#__PURE__*/React.createElement(S.Icon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
37
|
+
component: /*#__PURE__*/React.createElement(SearchNoResultsM, null),
|
|
38
|
+
color: theme.palette['grey-600']
|
|
39
|
+
})), /*#__PURE__*/React.createElement("p", null, noResultMsg)))) : /*#__PURE__*/React.createElement(S.VirtualList, {
|
|
40
|
+
listHeight: 330,
|
|
41
|
+
ref: listRef,
|
|
42
|
+
height: 330,
|
|
43
|
+
itemCount: groupedData.length,
|
|
44
|
+
itemData: itemData,
|
|
45
|
+
itemSize: ELEMENT_HEIGHT,
|
|
46
|
+
width: "100%"
|
|
47
|
+
}, function (props) {
|
|
48
|
+
return /*#__PURE__*/React.createElement(RowItem, props);
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
export default List;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ListItemProps } from './ListItem.types';
|
|
3
|
+
import { SourceType } from '../../IconPicker.types';
|
|
4
|
+
declare const ListItem: <Source extends SourceType>({ element, index, onSelect, itemsPerRow }: ListItemProps<Source>) => React.JSX.Element;
|
|
5
|
+
export default ListItem;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from '@synerise/ds-button';
|
|
3
|
-
import * as S from '
|
|
3
|
+
import * as S from '../../IconPicker.styles';
|
|
4
4
|
var ListItem = function ListItem(_ref) {
|
|
5
5
|
var element = _ref.element,
|
|
6
6
|
index = _ref.index,
|
|
7
|
-
onSelect = _ref.onSelect
|
|
7
|
+
onSelect = _ref.onSelect,
|
|
8
|
+
itemsPerRow = _ref.itemsPerRow;
|
|
8
9
|
var selectIcon = function selectIcon() {
|
|
9
|
-
onSelect(element.
|
|
10
|
+
onSelect(element.value);
|
|
10
11
|
};
|
|
11
|
-
return /*#__PURE__*/React.createElement(S.ListItem,
|
|
12
|
+
return /*#__PURE__*/React.createElement(S.ListItem, {
|
|
13
|
+
itemsPerRow: itemsPerRow
|
|
14
|
+
}, typeof element.item !== 'string' && element.item.type.name === 'Avatar' ?
|
|
12
15
|
/*#__PURE__*/
|
|
13
16
|
// eslint-disable-line
|
|
14
17
|
React.createElement(S.IconTrigger, {
|
|
15
18
|
onMouseUp: selectIcon,
|
|
16
|
-
"data-testid": "icon" + index
|
|
19
|
+
"data-testid": "icon-" + index
|
|
17
20
|
}, element.item) : /*#__PURE__*/React.createElement(Button, {
|
|
18
21
|
type: "ghost",
|
|
19
|
-
mode: "single-icon"
|
|
22
|
+
mode: "single-icon",
|
|
23
|
+
onClick: selectIcon
|
|
20
24
|
}, /*#__PURE__*/React.createElement(S.IconTrigger, {
|
|
21
|
-
|
|
22
|
-
"data-testid": "icon" + index
|
|
25
|
+
"data-testid": "icon-" + index
|
|
23
26
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24
27
|
className: "icon-wrapper"
|
|
25
28
|
}, typeof element.item === 'string' ? /*#__PURE__*/React.createElement(S.FontIcon, null, element.item) : element.item))));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FilterItem, ListProps, SourceType, ValueTypeForSource } from '../../IconPicker.types';
|
|
2
|
+
export type ListItemProps<Source extends SourceType> = {
|
|
3
|
+
element: FilterItem<ValueTypeForSource<Source>>;
|
|
4
|
+
index: number;
|
|
5
|
+
itemsPerRow: number;
|
|
6
|
+
onSelect: ListProps<Source>['onSelect'];
|
|
7
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OverlayType } from './Overlay.types';
|
|
3
|
+
import { SourceType } from '../../IconPicker.types';
|
|
4
|
+
declare const Overlay: <Source extends SourceType>({ value, onSearchChange, onClearInput, placeholder, onSelect, data, focus, noResultMsg, }: OverlayType<Source>) => React.JSX.Element;
|
|
5
|
+
export default Overlay;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FilterElement, IconPickerProps, SelectItemHandler, SourceType, ValueTypeForSource } from '../../IconPicker.types';
|
|
2
|
+
export type OverlayType<Source extends SourceType> = Pick<IconPickerProps<Source>, 'noResultMsg' | 'placeholder'> & {
|
|
3
|
+
value: string;
|
|
4
|
+
data: FilterElement<ValueTypeForSource<Source>>[];
|
|
5
|
+
onSelect: SelectItemHandler<Source>;
|
|
6
|
+
onSearchChange: (value: string) => void;
|
|
7
|
+
onClearInput?: () => void;
|
|
8
|
+
focus: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { areEqual } from 'react-window';
|
|
3
|
+
import ListItem from './ListItem/ListItem';
|
|
4
|
+
import * as S from '../IconPicker.styles';
|
|
5
|
+
import { isCategories } from '../utils/typeguards.utils';
|
|
6
|
+
export var RowItem = /*#__PURE__*/memo(function (_ref) {
|
|
7
|
+
var data = _ref.data,
|
|
8
|
+
index = _ref.index,
|
|
9
|
+
style = _ref.style;
|
|
10
|
+
var elementSize = data.elementSize,
|
|
11
|
+
itemsPerRow = data.itemsPerRow,
|
|
12
|
+
onSelect = data.onSelect,
|
|
13
|
+
items = data.items;
|
|
14
|
+
var rowItems = items[index];
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
style: style
|
|
17
|
+
}, /*#__PURE__*/React.createElement(S.ListRow, null, isCategories(rowItems) ? /*#__PURE__*/React.createElement(S.Title, {
|
|
18
|
+
elementSize: elementSize + "px"
|
|
19
|
+
}, rowItems[0].category) : rowItems.map(function (item, i) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
21
|
+
key: i,
|
|
22
|
+
element: item,
|
|
23
|
+
itemsPerRow: itemsPerRow,
|
|
24
|
+
onSelect: onSelect,
|
|
25
|
+
index: i
|
|
26
|
+
}) // eslint-disable-line react/no-array-index-key
|
|
27
|
+
;
|
|
28
|
+
})));
|
|
29
|
+
}, areEqual);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FilterElement, GroupedFilterElement, SourceType, ValueTypeForSource } from '../IconPicker.types';
|
|
2
|
+
export declare const useGroupItems: <Source extends SourceType>(data: FilterElement<ValueTypeForSource<Source>>[], itemsPerRow: number) => GroupedFilterElement<Source>[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
export var useGroupItems = function useGroupItems(data, itemsPerRow) {
|
|
3
|
+
var groupedData = useMemo(function () {
|
|
4
|
+
return data.reduce(function (flatItemsAndCategories, group) {
|
|
5
|
+
var category = group.category,
|
|
6
|
+
items = group.items;
|
|
7
|
+
flatItemsAndCategories.push([{
|
|
8
|
+
category: category
|
|
9
|
+
}]);
|
|
10
|
+
var groupItemsLength = items.length;
|
|
11
|
+
var rowCount = Math.ceil(groupItemsLength / itemsPerRow);
|
|
12
|
+
for (var i = 0; i < rowCount; i += 1) {
|
|
13
|
+
var rowItems = [];
|
|
14
|
+
for (var j = 0; j < itemsPerRow; j += 1) {
|
|
15
|
+
var idx = itemsPerRow * i + j;
|
|
16
|
+
if (idx < groupItemsLength) {
|
|
17
|
+
rowItems.push(items[idx]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
flatItemsAndCategories.push(rowItems);
|
|
21
|
+
}
|
|
22
|
+
return flatItemsAndCategories;
|
|
23
|
+
}, []);
|
|
24
|
+
}, [data, itemsPerRow]);
|
|
25
|
+
return groupedData;
|
|
26
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
3
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
4
|
+
import React, { useCallback, useState } from 'react';
|
|
5
|
+
import Icon, { medium } from '@synerise/ds-icon';
|
|
6
|
+
import { isDSSourceType, isFASourceType } from '../utils/typeguards.utils';
|
|
7
|
+
import { loadFontAwesome } from '../utils/loadFontAwesome';
|
|
8
|
+
import { prepareItems } from '../utils/prepareItems';
|
|
9
|
+
export var useIconSourceLoader = function useIconSourceLoader(data) {
|
|
10
|
+
var _useState = useState([]),
|
|
11
|
+
items = _useState[0],
|
|
12
|
+
setItems = _useState[1];
|
|
13
|
+
var loadedItems = useCallback(function () {
|
|
14
|
+
if (!items.length) {
|
|
15
|
+
var loadFAIcons = /*#__PURE__*/function () {
|
|
16
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17
|
+
var _yield$loadFontAwesom, fas, fab, far, icon, FontAwesomeIcon;
|
|
18
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
_context.next = 2;
|
|
22
|
+
return loadFontAwesome();
|
|
23
|
+
case 2:
|
|
24
|
+
_yield$loadFontAwesom = _context.sent;
|
|
25
|
+
fas = _yield$loadFontAwesom.fas;
|
|
26
|
+
fab = _yield$loadFontAwesom.fab;
|
|
27
|
+
far = _yield$loadFontAwesom.far;
|
|
28
|
+
icon = _yield$loadFontAwesom.icon;
|
|
29
|
+
FontAwesomeIcon = _yield$loadFontAwesom.FontAwesomeIcon;
|
|
30
|
+
setItems([{
|
|
31
|
+
category: 'Solid',
|
|
32
|
+
items: Object.values(fas).map(function (iconData) {
|
|
33
|
+
return {
|
|
34
|
+
keywords: iconData.iconName,
|
|
35
|
+
item: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
36
|
+
icon: icon(iconData),
|
|
37
|
+
key: iconData.iconName
|
|
38
|
+
}),
|
|
39
|
+
value: [iconData.prefix, iconData.iconName]
|
|
40
|
+
};
|
|
41
|
+
})
|
|
42
|
+
}, {
|
|
43
|
+
category: 'Brands',
|
|
44
|
+
items: Object.values(fab).map(function (iconData) {
|
|
45
|
+
return {
|
|
46
|
+
keywords: iconData.iconName,
|
|
47
|
+
item: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
48
|
+
icon: icon(iconData),
|
|
49
|
+
key: iconData.iconName
|
|
50
|
+
}),
|
|
51
|
+
value: [iconData.prefix, iconData.iconName]
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
}, {
|
|
55
|
+
category: 'Regular',
|
|
56
|
+
items: Object.values(far).map(function (iconData) {
|
|
57
|
+
return {
|
|
58
|
+
keywords: iconData.iconName,
|
|
59
|
+
item: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
60
|
+
icon: icon(iconData),
|
|
61
|
+
key: iconData.iconName
|
|
62
|
+
}),
|
|
63
|
+
value: [iconData.prefix, iconData.iconName]
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
}]);
|
|
67
|
+
case 9:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context.stop();
|
|
70
|
+
}
|
|
71
|
+
}, _callee);
|
|
72
|
+
}));
|
|
73
|
+
return function loadFAIcons() {
|
|
74
|
+
return _ref.apply(this, arguments);
|
|
75
|
+
};
|
|
76
|
+
}();
|
|
77
|
+
if (isDSSourceType(data)) {
|
|
78
|
+
var iconItems = Object.entries(medium).map(function (_ref2) {
|
|
79
|
+
var name = _ref2[0],
|
|
80
|
+
Component = _ref2[1];
|
|
81
|
+
return {
|
|
82
|
+
keywords: name,
|
|
83
|
+
item: /*#__PURE__*/React.createElement(Icon, {
|
|
84
|
+
component: /*#__PURE__*/React.createElement(Component, null)
|
|
85
|
+
}),
|
|
86
|
+
value: /*#__PURE__*/React.createElement(Icon, {
|
|
87
|
+
component: /*#__PURE__*/React.createElement(Component, null)
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
setItems([{
|
|
92
|
+
category: 'DS Icons',
|
|
93
|
+
items: iconItems
|
|
94
|
+
}]);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (isFASourceType(data)) {
|
|
98
|
+
loadFAIcons();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
setItems(prepareItems(data));
|
|
102
|
+
}
|
|
103
|
+
}, [data, items.length]);
|
|
104
|
+
loadedItems();
|
|
105
|
+
return items;
|
|
106
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './IconPicker';
|
|
2
|
-
export type { FilterElement, FilterItem, IconPickerProps } from './IconPicker.types';
|
|
2
|
+
export type { FilterElement, FilterItem, DataSource, IconPickerProps, SourceType, FASource, FAValue, DSSource, } from './IconPicker.types';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ListItemData, SourceType } from '../IconPicker.types';
|
|
2
|
+
export declare const createItemData: <Source extends SourceType>(items: import("../IconPicker.types").GroupedFilterElement<Source>[], elementSize: number, onSelect: import("../IconPicker.types").SelectItemHandler<Source>, itemsPerRow: number) => ListItemData<Source>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const loadFontAwesome: () => Promise<{
|
|
2
|
+
fas: import("@fortawesome/fontawesome-common-types").IconPack;
|
|
3
|
+
icon: typeof import("@fortawesome/fontawesome-svg-core").icon;
|
|
4
|
+
fab: import("@fortawesome/fontawesome-common-types").IconPack;
|
|
5
|
+
far: import("@fortawesome/fontawesome-common-types").IconPack;
|
|
6
|
+
FontAwesomeIcon: typeof import("@fortawesome/react-fontawesome").FontAwesomeIcon;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
3
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
4
|
+
export var loadFontAwesome = /*#__PURE__*/function () {
|
|
5
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
6
|
+
var core, solid, brands, regular, component, loaded, _loaded$, library, icon, fas, fab, far, FontAwesomeIcon;
|
|
7
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9
|
+
case 0:
|
|
10
|
+
core = import('@fortawesome/fontawesome-svg-core');
|
|
11
|
+
solid = import('@fortawesome/free-solid-svg-icons');
|
|
12
|
+
brands = import('@fortawesome/free-brands-svg-icons');
|
|
13
|
+
regular = import('@fortawesome/free-regular-svg-icons');
|
|
14
|
+
component = import('@fortawesome/react-fontawesome');
|
|
15
|
+
_context.next = 7;
|
|
16
|
+
return Promise.all([core, solid, brands, regular, component]);
|
|
17
|
+
case 7:
|
|
18
|
+
loaded = _context.sent;
|
|
19
|
+
_loaded$ = loaded[0], library = _loaded$.library, icon = _loaded$.icon;
|
|
20
|
+
fas = loaded[1].fas;
|
|
21
|
+
fab = loaded[2].fab;
|
|
22
|
+
far = loaded[3].far;
|
|
23
|
+
FontAwesomeIcon = loaded[4].FontAwesomeIcon;
|
|
24
|
+
library.add(fas, fab, far);
|
|
25
|
+
return _context.abrupt("return", {
|
|
26
|
+
fas: fas,
|
|
27
|
+
icon: icon,
|
|
28
|
+
fab: fab,
|
|
29
|
+
far: far,
|
|
30
|
+
FontAwesomeIcon: FontAwesomeIcon
|
|
31
|
+
});
|
|
32
|
+
case 15:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}, _callee);
|
|
37
|
+
}));
|
|
38
|
+
return function loadFontAwesome() {
|
|
39
|
+
return _ref.apply(this, arguments);
|
|
40
|
+
};
|
|
41
|
+
}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const matchesSearchQuery: (text: string, searchQuery: string) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
export var prepareItems = function prepareItems(data) {
|
|
3
|
+
return data.map(function (group) {
|
|
4
|
+
return _extends({}, group, {
|
|
5
|
+
items: group.items.map(function (item) {
|
|
6
|
+
return _extends({}, item, {
|
|
7
|
+
value: item.value === undefined ? item.item : item.value
|
|
8
|
+
});
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SourceType, DataSource, GroupedFilterElement, Category } from '../IconPicker.types';
|
|
2
|
+
export declare const isFASourceType: (data: SourceType) => data is "font-awesome";
|
|
3
|
+
export declare const isDSSourceType: (data: SourceType) => data is "design-system";
|
|
4
|
+
export declare const isData: (data: SourceType) => data is DataSource[];
|
|
5
|
+
export declare const isCategories: <Source extends SourceType>(element: GroupedFilterElement<Source>) => element is Category[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var isFASourceType = function isFASourceType(data) {
|
|
2
|
+
return data === 'font-awesome';
|
|
3
|
+
};
|
|
4
|
+
export var isDSSourceType = function isDSSourceType(data) {
|
|
5
|
+
return data === 'design-system';
|
|
6
|
+
};
|
|
7
|
+
export var isData = function isData(data) {
|
|
8
|
+
return Array.isArray(data);
|
|
9
|
+
};
|
|
10
|
+
export var isCategories = function isCategories(element) {
|
|
11
|
+
return !!('category' in element[0] && element[0].category);
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-icon-picker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "IconPicker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -31,18 +31,24 @@
|
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"types": "dist/index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@synerise/ds-button": "^1.1.
|
|
35
|
-
"@synerise/ds-dropdown": "^1.0.
|
|
36
|
-
"@synerise/ds-icon": "^1.
|
|
37
|
-
"@synerise/ds-scrollbar": "^1.0.
|
|
34
|
+
"@synerise/ds-button": "^1.1.4",
|
|
35
|
+
"@synerise/ds-dropdown": "^1.0.5",
|
|
36
|
+
"@synerise/ds-icon": "^1.4.0",
|
|
37
|
+
"@synerise/ds-scrollbar": "^1.0.5",
|
|
38
38
|
"@synerise/ds-utils": "^1.0.1",
|
|
39
|
-
"
|
|
39
|
+
"memoize-one": "^5.1.1",
|
|
40
|
+
"react-window": "^1.8.11"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
43
|
+
"@fortawesome/fontawesome-svg-core": "^6",
|
|
44
|
+
"@fortawesome/free-brands-svg-icons": "^6",
|
|
45
|
+
"@fortawesome/free-regular-svg-icons": "^6",
|
|
46
|
+
"@fortawesome/free-solid-svg-icons": "^6",
|
|
47
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
42
48
|
"@synerise/ds-core": "*",
|
|
43
49
|
"react": ">=16.9.0 <= 18.3.1",
|
|
44
50
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
45
51
|
"styled-components": "^5.3.3"
|
|
46
52
|
},
|
|
47
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "6735f9babfeef53122f54ca86cba5f581e8870d9"
|
|
48
54
|
}
|
package/dist/List/List.d.ts
DELETED
package/dist/List/List.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Scrollbar from '@synerise/ds-scrollbar';
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
import Icon, { SearchNoResultsM } from '@synerise/ds-icon';
|
|
5
|
-
import { theme } from '@synerise/ds-core';
|
|
6
|
-
import ListItem from '../ListItem/ListItem';
|
|
7
|
-
import * as S from '../IconPicker.styles';
|
|
8
|
-
var List = function List(_ref) {
|
|
9
|
-
var data = _ref.data,
|
|
10
|
-
onSelect = _ref.onSelect,
|
|
11
|
-
_ref$noResultMsg = _ref.noResultMsg,
|
|
12
|
-
noResultMsg = _ref$noResultMsg === void 0 ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
13
|
-
id: "DS.ICON-PICKER.NO-RESULTS"
|
|
14
|
-
}) : _ref$noResultMsg;
|
|
15
|
-
return /*#__PURE__*/React.createElement(Scrollbar, {
|
|
16
|
-
maxHeight: 330
|
|
17
|
-
}, !data.length ? /*#__PURE__*/React.createElement(S.OverlayWrapper, null, /*#__PURE__*/React.createElement(S.NoResults, null, /*#__PURE__*/React.createElement(S.Content, null, /*#__PURE__*/React.createElement(S.Icon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
-
component: /*#__PURE__*/React.createElement(SearchNoResultsM, null),
|
|
19
|
-
color: theme.palette['grey-600']
|
|
20
|
-
})), /*#__PURE__*/React.createElement("p", null, noResultMsg)))) : data.map(function (list) {
|
|
21
|
-
return !!list.items.length && /*#__PURE__*/React.createElement(S.OverlayWrapper, {
|
|
22
|
-
key: list.category
|
|
23
|
-
}, list.category && /*#__PURE__*/React.createElement(S.Title, null, list.category), /*#__PURE__*/React.createElement(S.List, null, list.items.map(function (el, i) {
|
|
24
|
-
return /*#__PURE__*/React.createElement(ListItem, {
|
|
25
|
-
key: i,
|
|
26
|
-
element: el,
|
|
27
|
-
onSelect: onSelect,
|
|
28
|
-
index: i
|
|
29
|
-
}) // eslint-disable-line react/no-array-index-key
|
|
30
|
-
;
|
|
31
|
-
})));
|
|
32
|
-
}));
|
|
33
|
-
};
|
|
34
|
-
export default List;
|
package/dist/List/List.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { IconPickerProps } from '../IconPicker.types';
|
|
2
|
-
export type OverlayType = Pick<IconPickerProps, 'data' | 'noResultMsg' | 'placeholder' | 'onSelect'> & {
|
|
3
|
-
value: string;
|
|
4
|
-
onSearchChange: (value: string) => void;
|
|
5
|
-
onClearInput?: () => void;
|
|
6
|
-
focus: boolean;
|
|
7
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|