@synerise/ds-icon-picker 1.6.14 → 1.6.16

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 (39) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +4 -4
  3. package/dist/IconPicker.const.js +6 -2
  4. package/dist/IconPicker.d.ts +2 -2
  5. package/dist/IconPicker.js +55 -96
  6. package/dist/IconPicker.styles.d.ts +14 -14
  7. package/dist/IconPicker.styles.js +41 -44
  8. package/dist/IconPicker.types.d.ts +3 -3
  9. package/dist/IconPicker.types.js +1 -1
  10. package/dist/_virtual/preload-helper.js +57 -0
  11. package/dist/components/List/List.d.ts +2 -2
  12. package/dist/components/List/List.js +33 -44
  13. package/dist/components/ListItem/ListItem.d.ts +3 -3
  14. package/dist/components/ListItem/ListItem.js +16 -29
  15. package/dist/components/ListItem/ListItem.types.d.ts +1 -1
  16. package/dist/components/ListItem/ListItem.types.js +1 -1
  17. package/dist/components/Overlay/Overlay.d.ts +3 -3
  18. package/dist/components/Overlay/Overlay.js +23 -31
  19. package/dist/components/Overlay/Overlay.types.d.ts +1 -1
  20. package/dist/components/Overlay/Overlay.types.js +1 -1
  21. package/dist/components/RowItem.d.ts +2 -2
  22. package/dist/components/RowItem.js +25 -28
  23. package/dist/hooks/useGroupItems.d.ts +1 -1
  24. package/dist/hooks/useGroupItems.js +19 -14
  25. package/dist/hooks/useIconSourceLoader.d.ts +1 -1
  26. package/dist/hooks/useIconSourceLoader.js +51 -91
  27. package/dist/index.js +4 -1
  28. package/dist/modules.d.js +1 -1
  29. package/dist/modules.d.ts +0 -0
  30. package/dist/utils/createItemData.d.ts +1 -1
  31. package/dist/utils/createItemData.js +10 -9
  32. package/dist/utils/loadFontAwesome.d.ts +5 -5
  33. package/dist/utils/loadFontAwesome.js +35 -38
  34. package/dist/utils/matchesSearchQuery.js +5 -2
  35. package/dist/utils/prepareItems.d.ts +1 -1
  36. package/dist/utils/prepareItems.js +14 -12
  37. package/dist/utils/typeguards.utils.d.ts +1 -1
  38. package/dist/utils/typeguards.utils.js +14 -8
  39. package/package.json +12 -12
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { type SourceType } from '../../IconPicker.types';
3
- import { type OverlayType } from './Overlay.types';
1
+ import { default as React } from 'react';
2
+ import { SourceType } from '../../IconPicker.types';
3
+ import { OverlayType } from './Overlay.types';
4
4
  declare const Overlay: <Source extends SourceType>({ value, onSearchChange, onClearInput, placeholder, onSelect, data, focus, noResultMsg, }: OverlayType<Source>) => React.JSX.Element;
5
5
  export default Overlay;
@@ -1,32 +1,24 @@
1
- import React from 'react';
2
- import { useTheme } from '@synerise/ds-core';
3
- import Dropdown from '@synerise/ds-dropdown';
4
- import Icon, { SearchM } from '@synerise/ds-icon';
5
- import List from '../List/List';
6
- var Overlay = function Overlay(_ref) {
7
- var value = _ref.value,
8
- onSearchChange = _ref.onSearchChange,
9
- onClearInput = _ref.onClearInput,
10
- placeholder = _ref.placeholder,
11
- onSelect = _ref.onSelect,
12
- data = _ref.data,
13
- focus = _ref.focus,
14
- noResultMsg = _ref.noResultMsg;
15
- var theme = useTheme();
16
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown.SearchInput, {
17
- onSearchChange: onSearchChange,
18
- onClearInput: onClearInput,
19
- placeholder: placeholder,
20
- value: value,
21
- autofocus: focus,
22
- iconLeft: /*#__PURE__*/React.createElement(Icon, {
23
- component: /*#__PURE__*/React.createElement(SearchM, null),
24
- color: theme.palette['grey-600']
25
- })
26
- }), /*#__PURE__*/React.createElement(List, {
27
- onSelect: onSelect,
28
- data: data,
29
- noResultMsg: noResultMsg
30
- }));
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useTheme } from "@synerise/ds-core";
3
+ import Dropdown from "@synerise/ds-dropdown";
4
+ import Icon, { SearchM } from "@synerise/ds-icon";
5
+ import List from "../List/List.js";
6
+ const Overlay = ({
7
+ value,
8
+ onSearchChange,
9
+ onClearInput,
10
+ placeholder,
11
+ onSelect,
12
+ data,
13
+ focus,
14
+ noResultMsg
15
+ }) => {
16
+ const theme = useTheme();
17
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ /* @__PURE__ */ jsx(Dropdown.SearchInput, { onSearchChange, onClearInput, placeholder, value, autofocus: focus, iconLeft: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(SearchM, {}), color: theme.palette["grey-600"] }) }),
19
+ /* @__PURE__ */ jsx(List, { onSelect, data, noResultMsg })
20
+ ] });
21
+ };
22
+ export {
23
+ Overlay as default
31
24
  };
32
- export default Overlay;
@@ -1,4 +1,4 @@
1
- import type { FilterElement, IconPickerProps, SelectItemHandler, SourceType, ValueTypeForSource } from '../../IconPicker.types';
1
+ import { FilterElement, IconPickerProps, SelectItemHandler, SourceType, ValueTypeForSource } from '../../IconPicker.types';
2
2
  export type OverlayType<Source extends SourceType> = Pick<IconPickerProps<Source>, 'noResultMsg' | 'placeholder'> & {
3
3
  value: string;
4
4
  data: FilterElement<ValueTypeForSource<Source>>[];
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import React, { type ReactElement } from 'react';
2
- import { type RowItemProps, type SourceType } from '../IconPicker.types';
1
+ import { default as React, ReactElement } from 'react';
2
+ import { RowItemProps, SourceType } from '../IconPicker.types';
3
3
  export declare const RowItem: React.MemoExoticComponent<(<Source extends SourceType>({ data, index, style, }: RowItemProps<Source>) => ReactElement)>;
@@ -1,28 +1,25 @@
1
- import React, { memo } from 'react';
2
- import { areEqual } from 'react-window';
3
- import * as S from '../IconPicker.styles';
4
- import { isCategories } from '../utils/typeguards.utils';
5
- import ListItem from './ListItem/ListItem';
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
- });
27
- })));
28
- }, areEqual);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
+ import { areEqual } from "react-window";
4
+ import { ListRow, Title } from "../IconPicker.styles.js";
5
+ import { isCategories } from "../utils/typeguards.utils.js";
6
+ import ListItem from "./ListItem/ListItem.js";
7
+ const RowItem = memo(({
8
+ data,
9
+ index,
10
+ style
11
+ }) => {
12
+ const {
13
+ elementSize,
14
+ itemsPerRow,
15
+ onSelect,
16
+ items
17
+ } = data;
18
+ const rowItems = items[index];
19
+ return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx(ListRow, { children: isCategories(rowItems) ? /* @__PURE__ */ jsx(Title, { elementSize: `${elementSize}px`, children: rowItems[0].category }) : rowItems.map((item, i) => {
20
+ return /* @__PURE__ */ jsx(ListItem, { element: item, itemsPerRow, onSelect, index: i }, i);
21
+ }) }) });
22
+ }, areEqual);
23
+ export {
24
+ RowItem
25
+ };
@@ -1,2 +1,2 @@
1
- import { type FilterElement, type GroupedFilterElement, type SourceType, type ValueTypeForSource } from '../IconPicker.types';
1
+ import { FilterElement, GroupedFilterElement, SourceType, ValueTypeForSource } from '../IconPicker.types';
2
2
  export declare const useGroupItems: <Source extends SourceType>(data: FilterElement<ValueTypeForSource<Source>>[], itemsPerRow: number) => GroupedFilterElement<Source>[];
@@ -1,18 +1,20 @@
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;
1
+ import { useMemo } from "react";
2
+ const useGroupItems = (data, itemsPerRow) => {
3
+ const groupedData = useMemo(() => {
4
+ return data.reduce((flatItemsAndCategories, group) => {
5
+ const {
6
+ category,
7
+ items
8
+ } = group;
7
9
  flatItemsAndCategories.push([{
8
- category: category
10
+ category
9
11
  }]);
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;
12
+ const groupItemsLength = items.length;
13
+ const rowCount = Math.ceil(groupItemsLength / itemsPerRow);
14
+ for (let i = 0; i < rowCount; i += 1) {
15
+ const rowItems = [];
16
+ for (let j = 0; j < itemsPerRow; j += 1) {
17
+ const idx = itemsPerRow * i + j;
16
18
  if (idx < groupItemsLength) {
17
19
  rowItems.push(items[idx]);
18
20
  }
@@ -23,4 +25,7 @@ export var useGroupItems = function useGroupItems(data, itemsPerRow) {
23
25
  }, []);
24
26
  }, [data, itemsPerRow]);
25
27
  return groupedData;
26
- };
28
+ };
29
+ export {
30
+ useGroupItems
31
+ };
@@ -1,2 +1,2 @@
1
- import { type FilterElement, type SourceType, type ValueTypeForSource } from '../IconPicker.types';
1
+ import { FilterElement, SourceType, ValueTypeForSource } from '../IconPicker.types';
2
2
  export declare const useIconSourceLoader: <Source extends SourceType>(data: SourceType) => FilterElement<ValueTypeForSource<Source>>[];
@@ -1,96 +1,53 @@
1
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
3
- 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); }
4
- 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); }); }; }
5
- import React, { useCallback, useState } from 'react';
6
- import Icon from '@synerise/ds-icon';
7
- import * as medium from '@synerise/ds-icon/dist/icons/M';
8
- import { loadFontAwesome } from '../utils/loadFontAwesome';
9
- import { prepareItems } from '../utils/prepareItems';
10
- import { isDSSourceType, isFASourceType } from '../utils/typeguards.utils';
11
- export var useIconSourceLoader = function useIconSourceLoader(data) {
12
- var _useState = useState([]),
13
- items = _useState[0],
14
- setItems = _useState[1];
15
- var loadedItems = useCallback(function () {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useCallback } from "react";
3
+ import Icon from "@synerise/ds-icon";
4
+ import * as medium from "@synerise/ds-icon/dist/icons/M";
5
+ import { loadFontAwesome } from "../utils/loadFontAwesome.js";
6
+ import { prepareItems } from "../utils/prepareItems.js";
7
+ import { isDSSourceType, isFASourceType } from "../utils/typeguards.utils.js";
8
+ const useIconSourceLoader = (data) => {
9
+ const [items, setItems] = useState([]);
10
+ const loadedItems = useCallback(() => {
16
11
  if (!items.length) {
17
- var loadFAIcons = /*#__PURE__*/function () {
18
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
19
- var _yield$loadFontAwesom, fas, fab, far, icon, FontAwesomeIcon;
20
- return _regenerator().w(function (_context) {
21
- while (1) switch (_context.n) {
22
- case 0:
23
- _context.n = 1;
24
- return loadFontAwesome();
25
- case 1:
26
- _yield$loadFontAwesom = _context.v;
27
- fas = _yield$loadFontAwesom.fas;
28
- fab = _yield$loadFontAwesom.fab;
29
- far = _yield$loadFontAwesom.far;
30
- icon = _yield$loadFontAwesom.icon;
31
- FontAwesomeIcon = _yield$loadFontAwesom.FontAwesomeIcon;
32
- setItems([{
33
- category: 'Solid',
34
- items: Object.values(fas).map(function (iconData) {
35
- return {
36
- keywords: iconData.iconName,
37
- item: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
38
- icon: icon(iconData),
39
- key: iconData.iconName
40
- }),
41
- value: [iconData.prefix, iconData.iconName]
42
- };
43
- })
44
- }, {
45
- category: 'Brands',
46
- items: Object.values(fab).map(function (iconData) {
47
- return {
48
- keywords: iconData.iconName,
49
- item: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
50
- icon: icon(iconData),
51
- key: iconData.iconName
52
- }),
53
- value: [iconData.prefix, iconData.iconName]
54
- };
55
- })
56
- }, {
57
- category: 'Regular',
58
- items: Object.values(far).map(function (iconData) {
59
- return {
60
- keywords: iconData.iconName,
61
- item: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
62
- icon: icon(iconData),
63
- key: iconData.iconName
64
- }),
65
- value: [iconData.prefix, iconData.iconName]
66
- };
67
- })
68
- }]);
69
- case 2:
70
- return _context.a(2);
71
- }
72
- }, _callee);
73
- }));
74
- return function loadFAIcons() {
75
- return _ref.apply(this, arguments);
76
- };
77
- }();
12
+ const loadFAIcons = async () => {
13
+ const {
14
+ fas,
15
+ fab,
16
+ far,
17
+ icon,
18
+ FontAwesomeIcon
19
+ } = await loadFontAwesome();
20
+ setItems([{
21
+ category: "Solid",
22
+ items: Object.values(fas).map((iconData) => ({
23
+ keywords: iconData.iconName,
24
+ item: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: icon(iconData) }, iconData.iconName),
25
+ value: [iconData.prefix, iconData.iconName]
26
+ }))
27
+ }, {
28
+ category: "Brands",
29
+ items: Object.values(fab).map((iconData) => ({
30
+ keywords: iconData.iconName,
31
+ item: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: icon(iconData) }, iconData.iconName),
32
+ value: [iconData.prefix, iconData.iconName]
33
+ }))
34
+ }, {
35
+ category: "Regular",
36
+ items: Object.values(far).map((iconData) => ({
37
+ keywords: iconData.iconName,
38
+ item: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: icon(iconData) }, iconData.iconName),
39
+ value: [iconData.prefix, iconData.iconName]
40
+ }))
41
+ }]);
42
+ };
78
43
  if (isDSSourceType(data)) {
79
- var iconItems = Object.entries(medium).map(function (_ref2) {
80
- var name = _ref2[0],
81
- Component = _ref2[1];
82
- return {
83
- keywords: name,
84
- item: /*#__PURE__*/React.createElement(Icon, {
85
- component: /*#__PURE__*/React.createElement(Component, null)
86
- }),
87
- value: /*#__PURE__*/React.createElement(Icon, {
88
- component: /*#__PURE__*/React.createElement(Component, null)
89
- })
90
- };
91
- });
44
+ const iconItems = Object.entries(medium).map(([name, Component]) => ({
45
+ keywords: name,
46
+ item: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Component, {}) }),
47
+ value: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Component, {}) })
48
+ }));
92
49
  setItems([{
93
- category: 'DS Icons',
50
+ category: "DS Icons",
94
51
  items: iconItems
95
52
  }]);
96
53
  return;
@@ -104,4 +61,7 @@ export var useIconSourceLoader = function useIconSourceLoader(data) {
104
61
  }, [data, items.length]);
105
62
  loadedItems();
106
63
  return items;
107
- };
64
+ };
65
+ export {
66
+ useIconSourceLoader
67
+ };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export { default } from './IconPicker';
1
+ import { default as default2 } from "./IconPicker.js";
2
+ export {
3
+ default2 as default
4
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
@@ -1,2 +1,2 @@
1
- import type { ListItemData, SourceType } from '../IconPicker.types';
1
+ import { ListItemData, SourceType } from '../IconPicker.types';
2
2
  export declare const createItemData: <Source extends SourceType>(items: ListItemData<Source>["items"], elementSize: ListItemData<Source>["elementSize"], onSelect: ListItemData<Source>["onSelect"], itemsPerRow: ListItemData<Source>["itemsPerRow"]) => ListItemData<Source>;
@@ -1,9 +1,10 @@
1
- import memoize from 'memoize-one';
2
- export var createItemData = memoize(function (items, elementSize, onSelect, itemsPerRow) {
3
- return {
4
- items: items,
5
- elementSize: elementSize,
6
- onSelect: onSelect,
7
- itemsPerRow: itemsPerRow
8
- };
9
- });
1
+ import memoize from "memoize-one";
2
+ const createItemData = memoize((items, elementSize, onSelect, itemsPerRow) => ({
3
+ items,
4
+ elementSize,
5
+ onSelect,
6
+ itemsPerRow
7
+ }));
8
+ export {
9
+ createItemData
10
+ };
@@ -1,7 +1,7 @@
1
1
  export declare const loadFontAwesome: () => Promise<{
2
- fas: import("@fortawesome/fontawesome-svg-core").IconPack;
3
- icon: typeof import("@fortawesome/fontawesome-svg-core").icon;
4
- fab: import("@fortawesome/fontawesome-svg-core").IconPack;
5
- far: import("@fortawesome/fontawesome-svg-core").IconPack;
6
- FontAwesomeIcon: typeof import("@fortawesome/react-fontawesome").FontAwesomeIcon;
2
+ fas: import('@fortawesome/fontawesome-svg-core').IconPack;
3
+ icon: typeof import('@fortawesome/fontawesome-svg-core').icon;
4
+ fab: import('@fortawesome/fontawesome-svg-core').IconPack;
5
+ far: import('@fortawesome/fontawesome-svg-core').IconPack;
6
+ FontAwesomeIcon: typeof import('@fortawesome/react-fontawesome').FontAwesomeIcon;
7
7
  }>;
@@ -1,39 +1,36 @@
1
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
3
- 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); }
4
- 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); }); }; }
5
- export var loadFontAwesome = /*#__PURE__*/function () {
6
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
7
- var core, solid, brands, regular, component, loaded, _loaded$, library, icon, fas, fab, far, FontAwesomeIcon;
8
- return _regenerator().w(function (_context) {
9
- while (1) switch (_context.n) {
10
- case 0:
11
- core = import('@fortawesome/fontawesome-svg-core');
12
- solid = import('@fortawesome/free-solid-svg-icons');
13
- brands = import('@fortawesome/free-brands-svg-icons');
14
- regular = import('@fortawesome/free-regular-svg-icons');
15
- component = import('@fortawesome/react-fontawesome');
16
- _context.n = 1;
17
- return Promise.all([core, solid, brands, regular, component]);
18
- case 1:
19
- loaded = _context.v;
20
- _loaded$ = loaded[0], library = _loaded$.library, icon = _loaded$.icon;
21
- fas = loaded[1].fas;
22
- fab = loaded[2].fab;
23
- far = loaded[3].far;
24
- FontAwesomeIcon = loaded[4].FontAwesomeIcon;
25
- library.add(fas, fab, far);
26
- return _context.a(2, {
27
- fas: fas,
28
- icon: icon,
29
- fab: fab,
30
- far: far,
31
- FontAwesomeIcon: FontAwesomeIcon
32
- });
33
- }
34
- }, _callee);
35
- }));
36
- return function loadFontAwesome() {
37
- return _ref.apply(this, arguments);
1
+ import { __vitePreload } from "../_virtual/preload-helper.js";
2
+ const loadFontAwesome = async () => {
3
+ const core = __vitePreload(() => import("@fortawesome/fontawesome-svg-core"), true ? [] : void 0);
4
+ const solid = __vitePreload(() => import("@fortawesome/free-solid-svg-icons"), true ? [] : void 0);
5
+ const brands = __vitePreload(() => import("@fortawesome/free-brands-svg-icons"), true ? [] : void 0);
6
+ const regular = __vitePreload(() => import("@fortawesome/free-regular-svg-icons"), true ? [] : void 0);
7
+ const component = __vitePreload(() => import("@fortawesome/react-fontawesome"), true ? [] : void 0);
8
+ const loaded = await Promise.all([core, solid, brands, regular, component]);
9
+ const {
10
+ library,
11
+ icon
12
+ } = loaded[0];
13
+ const {
14
+ fas
15
+ } = loaded[1];
16
+ const {
17
+ fab
18
+ } = loaded[2];
19
+ const {
20
+ far
21
+ } = loaded[3];
22
+ const {
23
+ FontAwesomeIcon
24
+ } = loaded[4];
25
+ library.add(fas, fab, far);
26
+ return {
27
+ fas,
28
+ icon,
29
+ fab,
30
+ far,
31
+ FontAwesomeIcon
38
32
  };
39
- }();
33
+ };
34
+ export {
35
+ loadFontAwesome
36
+ };
@@ -1,3 +1,6 @@
1
- export var matchesSearchQuery = function matchesSearchQuery(text, searchQuery) {
1
+ const matchesSearchQuery = (text, searchQuery) => {
2
2
  return text.toLowerCase().includes(searchQuery.toLowerCase());
3
- };
3
+ };
4
+ export {
5
+ matchesSearchQuery
6
+ };
@@ -1,2 +1,2 @@
1
- import { type DataSource, type FilterElement, type ValueTypeForSource } from '../IconPicker.types';
1
+ import { DataSource, FilterElement, ValueTypeForSource } from '../IconPicker.types';
2
2
  export declare const prepareItems: (data: DataSource[]) => FilterElement<ValueTypeForSource<DataSource[]>>[];
@@ -1,12 +1,14 @@
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
- };
1
+ const prepareItems = (data) => {
2
+ return data.map((group) => ({
3
+ ...group,
4
+ items: group.items.map((item) => {
5
+ return {
6
+ ...item,
7
+ value: item.value === void 0 ? item.item : item.value
8
+ };
9
+ })
10
+ }));
11
+ };
12
+ export {
13
+ prepareItems
14
+ };
@@ -1,4 +1,4 @@
1
- import { type Category, type DSSource, type DataSource, type FASource, type GroupedFilterElement, type SourceType } from '../IconPicker.types';
1
+ import { Category, DSSource, DataSource, FASource, GroupedFilterElement, SourceType } from '../IconPicker.types';
2
2
  export declare const isFASourceType: (data: SourceType) => data is FASource;
3
3
  export declare const isDSSourceType: (data: SourceType) => data is DSSource;
4
4
  export declare const isData: (data: SourceType) => data is DataSource[];
@@ -1,12 +1,18 @@
1
- export var isFASourceType = function isFASourceType(data) {
2
- return data === 'font-awesome';
1
+ const isFASourceType = (data) => {
2
+ return data === "font-awesome";
3
3
  };
4
- export var isDSSourceType = function isDSSourceType(data) {
5
- return data === 'design-system';
4
+ const isDSSourceType = (data) => {
5
+ return data === "design-system";
6
6
  };
7
- export var isData = function isData(data) {
7
+ const isData = (data) => {
8
8
  return Array.isArray(data);
9
9
  };
10
- export var isCategories = function isCategories(element) {
11
- return !!('category' in element[0] && element[0].category);
12
- };
10
+ const isCategories = (element) => {
11
+ return !!("category" in element[0] && element[0].category);
12
+ };
13
+ export {
14
+ isCategories,
15
+ isDSSourceType,
16
+ isData,
17
+ isFASourceType
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-icon-picker",
3
- "version": "1.6.14",
3
+ "version": "1.6.16",
4
4
  "description": "IconPicker UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -32,14 +32,14 @@
32
32
  "sideEffects": false,
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-button": "^1.5.16",
36
- "@synerise/ds-button-group": "^1.1.41",
37
- "@synerise/ds-dropdown": "^1.3.0",
38
- "@synerise/ds-icon": "^1.14.1",
39
- "@synerise/ds-popover": "^1.5.1",
40
- "@synerise/ds-scrollbar": "^1.2.15",
41
- "@synerise/ds-tooltip": "^1.4.8",
42
- "@synerise/ds-utils": "^1.6.0",
35
+ "@synerise/ds-button": "^1.5.18",
36
+ "@synerise/ds-button-group": "^1.1.43",
37
+ "@synerise/ds-dropdown": "^1.3.2",
38
+ "@synerise/ds-icon": "^1.15.1",
39
+ "@synerise/ds-popover": "^1.5.3",
40
+ "@synerise/ds-scrollbar": "^1.2.17",
41
+ "@synerise/ds-tooltip": "^1.4.10",
42
+ "@synerise/ds-utils": "^1.7.1",
43
43
  "memoize-one": "^5.1.1",
44
44
  "react-window": "^1.8.11"
45
45
  },
@@ -54,5 +54,5 @@
54
54
  "react-intl": ">=3.12.0 <= 6.8",
55
55
  "styled-components": "^5.3.3"
56
56
  },
57
- "gitHead": "8dfafc5d7278f09d430f1e7499782d05c76b47c0"
57
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
58
58
  }