@hubstr/kit 0.1.3 → 0.1.5

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 (28) hide show
  1. package/editor/src/codemirror/index.ts +1 -1
  2. package/editor/src/plugins/code/plugin/index.ts +2 -1
  3. package/editor/src/plugins/codeblock/plugin/index.ts +2 -1
  4. package/editor/src/plugins/codemirror-block/plugin/index.ts +2 -1
  5. package/editor/src/plugins/common/plugin/index.ts +5 -4
  6. package/editor/src/plugins/common/utils/index.ts +2 -1
  7. package/editor/src/plugins/file/plugin/index.ts +2 -1
  8. package/editor/src/plugins/litexml/index.ts +1 -0
  9. package/editor/src/plugins/litexml/service/litexml-service.ts +11 -1
  10. package/editor/src/plugins/table/plugin/index.ts +2 -1
  11. package/icons/es/components/AgentGuideCard/index.js +107 -107
  12. package/icons/es/components/ColorPreview/index.js +34 -34
  13. package/icons/es/components/Dashboard/IconItem.js +140 -140
  14. package/icons/es/components/Dashboard/Text.js +65 -65
  15. package/icons/es/components/Dashboard/index.js +102 -102
  16. package/icons/es/components/DownloadButton/index.js +27 -27
  17. package/icons/es/components/Editor/Color.js +46 -46
  18. package/icons/es/components/Editor/Mono.js +44 -44
  19. package/icons/es/components/Editor/Preview.js +53 -53
  20. package/icons/es/components/Editor/Text.js +44 -44
  21. package/icons/es/components/Editor/index.js +135 -135
  22. package/icons/es/components/IconPreview/ColorPreview.js +37 -37
  23. package/icons/es/components/IconPreview/index.js +66 -66
  24. package/icons/es/features/index.d.ts +1 -5
  25. package/icons/es/features/index.js +1 -1
  26. package/icons/es/features/ui-runtime.js +1 -5
  27. package/package.json +329 -310
  28. package/ui/src/Markdown/SyntaxMarkdown/CachedMarkdown.tsx +1 -3
@@ -1,141 +1,141 @@
1
- 'use client';
2
-
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
4
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
5
- import { ActionIcon, Block, Center, CopyButton, Flexbox, Text } from '@hubstr/kit/ui';
6
- import { createStaticStyles, cx } from 'antd-style';
7
- import { Link } from 'dumi';
8
- import { DownloadIcon, SearchIcon } from 'lucide-react';
9
- import { readableColor } from 'polished';
10
- import { memo, useCallback, useRef } from 'react';
11
- import { customKebabCase } from "./utils.js";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var styles = createStaticStyles(function (_ref) {
15
- var css = _ref.css,
16
- cssVar = _ref.cssVar;
17
- var colorText = cx('color-text', css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n "]))));
18
- var copy = cx('copy', css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: 1;\n display: none !important;\n "]))));
19
- return {
20
- card: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n "]))),
21
- color: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-inline-end: 1px solid ", ";\n font-family: ", ";\n\n &:hover {\n .color-text {\n display: none;\n }\n\n .copy {\n display: flex !important;\n }\n }\n "])), cssVar.colorBorderSecondary, cssVar.fontFamilyCode),
22
- colorText: colorText,
23
- copy: copy,
24
- row: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-block-start: 1px solid ", ";\n "])), cssVar.colorFillSecondary),
25
- title: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: 0;\n font-size: 16px;\n font-weight: bold;\n "]))),
26
- titleRow: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-block-start: -8px;\n\n &:hover {\n .copy {\n display: flex;\n }\n }\n "])))
27
- };
28
- });
29
- var IconItem = /*#__PURE__*/memo(function (_ref2) {
30
- var children = _ref2.children,
31
- title = _ref2.title,
32
- color = _ref2.color,
33
- id = _ref2.id;
34
- var ref = useRef(null);
35
- var handleDownload = useCallback(function (iconId) {
36
- var _ref$current;
37
- var svgString = String(ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || (_ref$current = _ref$current.querySelector('svg')) === null || _ref$current === void 0 ? void 0 : _ref$current.outerHTML);
38
- var blob = new Blob([svgString], {
39
- type: 'image/svg+xml;charset=utf-8'
40
- });
41
- var url = URL.createObjectURL(blob);
42
- var downloadLink = document.createElement('a');
43
- downloadLink.href = url;
44
- downloadLink.download = "".concat(iconId.toLowerCase(), ".svg");
45
- document.body.append(downloadLink);
46
- downloadLink.click();
47
- downloadLink.remove();
48
- URL.revokeObjectURL(url);
49
- }, []);
50
- return /*#__PURE__*/_jsxs(Block, {
51
- className: styles.card,
52
- variant: 'outlined',
53
- children: [/*#__PURE__*/_jsx(Link, {
54
- style: {
55
- color: 'inherit'
56
- },
57
- to: "/components/".concat(customKebabCase(id)),
58
- children: /*#__PURE__*/_jsx(Center, {
59
- height: 96,
60
- ref: ref,
61
- style: {
62
- position: 'relative'
63
- },
64
- width: '100%',
65
- children: children
66
- })
67
- }), /*#__PURE__*/_jsxs(Flexbox, {
68
- align: 'center',
69
- className: styles.titleRow,
70
- horizontal: true,
71
- justify: 'space-between',
72
- paddingBlock: 8,
73
- paddingInline: 12,
74
- width: '100%',
75
- children: [/*#__PURE__*/_jsx(Text, {
76
- as: 'h2',
77
- className: styles.title,
78
- ellipsis: true,
79
- children: title
80
- }), /*#__PURE__*/_jsx(CopyButton, {
81
- content: title,
82
- size: 'small'
83
- })]
84
- }), /*#__PURE__*/_jsxs(Flexbox, {
85
- align: 'center',
86
- className: styles.row,
87
- horizontal: true,
88
- children: [/*#__PURE__*/_jsxs(Center, {
89
- className: styles.color,
90
- flex: 1,
91
- height: 32,
92
- horizontal: true,
93
- paddingInline: 12,
94
- style: {
95
- background: color,
96
- color: readableColor(color)
97
- },
98
- children: [/*#__PURE__*/_jsx("span", {
99
- className: styles.colorText,
100
- children: color.toUpperCase()
101
- }), /*#__PURE__*/_jsx(CopyButton, {
102
- className: styles.copy,
103
- color: readableColor(color),
104
- content: color.toUpperCase(),
105
- size: 'small'
106
- })]
107
- }), /*#__PURE__*/_jsxs(Flexbox, {
108
- flex: 1,
109
- horizontal: true,
110
- paddingInline: 12,
111
- children: [/*#__PURE__*/_jsx(Center, {
112
- flex: 1,
113
- height: 32,
114
- children: /*#__PURE__*/_jsx("a", {
115
- href: "https://hubstr.io/icons/".concat(customKebabCase(id)),
116
- rel: "noreferrer",
117
- style: {
118
- color: 'inherit'
119
- },
120
- target: '_blank',
121
- children: /*#__PURE__*/_jsx(ActionIcon, {
122
- icon: SearchIcon,
123
- size: 'small'
124
- })
125
- })
126
- }), /*#__PURE__*/_jsx(Center, {
127
- flex: 1,
128
- height: 32,
129
- onClick: function onClick() {
130
- return handleDownload(id);
131
- },
132
- children: /*#__PURE__*/_jsx(ActionIcon, {
133
- icon: DownloadIcon,
134
- size: 'small'
135
- })
136
- })]
137
- })]
138
- })]
139
- });
140
- });
1
+ 'use client';
2
+
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
4
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
5
+ import { ActionIcon, Block, Center, CopyButton, Flexbox, Text } from '@hubstr/kit/ui';
6
+ import { createStaticStyles, cx } from 'antd-style';
7
+ import { Link } from 'dumi';
8
+ import { DownloadIcon, SearchIcon } from 'lucide-react';
9
+ import { readableColor } from 'polished';
10
+ import { memo, useCallback, useRef } from 'react';
11
+ import { customKebabCase } from "./utils.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ var styles = createStaticStyles(function (_ref) {
15
+ var css = _ref.css,
16
+ cssVar = _ref.cssVar;
17
+ var colorText = cx('color-text', css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n "]))));
18
+ var copy = cx('copy', css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: 1;\n display: none !important;\n "]))));
19
+ return {
20
+ card: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n "]))),
21
+ color: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-inline-end: 1px solid ", ";\n font-family: ", ";\n\n &:hover {\n .color-text {\n display: none;\n }\n\n .copy {\n display: flex !important;\n }\n }\n "])), cssVar.colorBorderSecondary, cssVar.fontFamilyCode),
22
+ colorText: colorText,
23
+ copy: copy,
24
+ row: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-block-start: 1px solid ", ";\n "])), cssVar.colorFillSecondary),
25
+ title: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: 0;\n font-size: 16px;\n font-weight: bold;\n "]))),
26
+ titleRow: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-block-start: -8px;\n\n &:hover {\n .copy {\n display: flex;\n }\n }\n "])))
27
+ };
28
+ });
29
+ var IconItem = /*#__PURE__*/memo(function (_ref2) {
30
+ var children = _ref2.children,
31
+ title = _ref2.title,
32
+ color = _ref2.color,
33
+ id = _ref2.id;
34
+ var ref = useRef(null);
35
+ var handleDownload = useCallback(function (iconId) {
36
+ var _ref$current;
37
+ var svgString = String(ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || (_ref$current = _ref$current.querySelector('svg')) === null || _ref$current === void 0 ? void 0 : _ref$current.outerHTML);
38
+ var blob = new Blob([svgString], {
39
+ type: 'image/svg+xml;charset=utf-8'
40
+ });
41
+ var url = URL.createObjectURL(blob);
42
+ var downloadLink = document.createElement('a');
43
+ downloadLink.href = url;
44
+ downloadLink.download = "".concat(iconId.toLowerCase(), ".svg");
45
+ document.body.append(downloadLink);
46
+ downloadLink.click();
47
+ downloadLink.remove();
48
+ URL.revokeObjectURL(url);
49
+ }, []);
50
+ return /*#__PURE__*/_jsxs(Block, {
51
+ className: styles.card,
52
+ variant: 'outlined',
53
+ children: [/*#__PURE__*/_jsx(Link, {
54
+ style: {
55
+ color: 'inherit'
56
+ },
57
+ to: "/components/".concat(customKebabCase(id)),
58
+ children: /*#__PURE__*/_jsx(Center, {
59
+ height: 96,
60
+ ref: ref,
61
+ style: {
62
+ position: 'relative'
63
+ },
64
+ width: '100%',
65
+ children: children
66
+ })
67
+ }), /*#__PURE__*/_jsxs(Flexbox, {
68
+ align: 'center',
69
+ className: styles.titleRow,
70
+ horizontal: true,
71
+ justify: 'space-between',
72
+ paddingBlock: 8,
73
+ paddingInline: 12,
74
+ width: '100%',
75
+ children: [/*#__PURE__*/_jsx(Text, {
76
+ as: 'h2',
77
+ className: styles.title,
78
+ ellipsis: true,
79
+ children: title
80
+ }), /*#__PURE__*/_jsx(CopyButton, {
81
+ content: title,
82
+ size: 'small'
83
+ })]
84
+ }), /*#__PURE__*/_jsxs(Flexbox, {
85
+ align: 'center',
86
+ className: styles.row,
87
+ horizontal: true,
88
+ children: [/*#__PURE__*/_jsxs(Center, {
89
+ className: styles.color,
90
+ flex: 1,
91
+ height: 32,
92
+ horizontal: true,
93
+ paddingInline: 12,
94
+ style: {
95
+ background: color,
96
+ color: readableColor(color)
97
+ },
98
+ children: [/*#__PURE__*/_jsx("span", {
99
+ className: styles.colorText,
100
+ children: color.toUpperCase()
101
+ }), /*#__PURE__*/_jsx(CopyButton, {
102
+ className: styles.copy,
103
+ color: readableColor(color),
104
+ content: color.toUpperCase(),
105
+ size: 'small'
106
+ })]
107
+ }), /*#__PURE__*/_jsxs(Flexbox, {
108
+ flex: 1,
109
+ horizontal: true,
110
+ paddingInline: 12,
111
+ children: [/*#__PURE__*/_jsx(Center, {
112
+ flex: 1,
113
+ height: 32,
114
+ children: /*#__PURE__*/_jsx("a", {
115
+ href: "https://hubstr.io/icons/".concat(customKebabCase(id)),
116
+ rel: "noreferrer",
117
+ style: {
118
+ color: 'inherit'
119
+ },
120
+ target: '_blank',
121
+ children: /*#__PURE__*/_jsx(ActionIcon, {
122
+ icon: SearchIcon,
123
+ size: 'small'
124
+ })
125
+ })
126
+ }), /*#__PURE__*/_jsx(Center, {
127
+ flex: 1,
128
+ height: 32,
129
+ onClick: function onClick() {
130
+ return handleDownload(id);
131
+ },
132
+ children: /*#__PURE__*/_jsx(ActionIcon, {
133
+ icon: DownloadIcon,
134
+ size: 'small'
135
+ })
136
+ })]
137
+ })]
138
+ })]
139
+ });
140
+ });
141
141
  export default IconItem;
@@ -1,66 +1,66 @@
1
- 'use client';
2
-
3
- var _templateObject;
4
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
5
- import * as Icons from "../../index.js";
6
- import { Flexbox } from '@hubstr/kit/ui';
7
- import { StoryBook, useControls, useCreateStore } from '@hubstr/kit/ui/storybook';
8
- import { createStaticStyles } from 'antd-style';
9
- import { memo } from 'react';
10
- import IconPreview from "../IconPreview/index.js";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- var data = Object.values(Icons).filter(function (icon) {
13
- return icon === null || icon === void 0 ? void 0 : icon.colorPrimary;
14
- });
15
- var styles = createStaticStyles(function (_ref) {
16
- var css = _ref.css,
17
- cssVar = _ref.cssVar;
18
- return {
19
- item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 96px;\n padding: 16px;\n border: none;\n background: ", ";\n "])), cssVar.colorBgContainer)
20
- };
21
- });
22
- var Dashboard = /*#__PURE__*/memo(function (_ref2) {
23
- var className = _ref2.className;
24
- var store = useCreateStore();
25
- var _useControls = useControls({
26
- color: {
27
- color: true,
28
- value: '#ffffff'
29
- },
30
- size: {
31
- max: 96,
32
- min: 16,
33
- step: 1,
34
- value: 24
35
- }
36
- }, {
37
- store: store
38
- }),
39
- size = _useControls.size,
40
- color = _useControls.color;
41
- return /*#__PURE__*/_jsx(StoryBook, {
42
- className: className,
43
- levaStore: store,
44
- children: /*#__PURE__*/_jsx(Flexbox, {
45
- align: 'center',
46
- gap: 4,
47
- horizontal: true,
48
- justify: 'center',
49
- style: {
50
- flexWrap: 'wrap'
51
- },
52
- children: data.map(function (Icon, index) {
53
- var IconRender = Icon.Text || Icon.Brand;
54
- if (!IconRender) return null;
55
- return /*#__PURE__*/_jsx(IconPreview, {
56
- className: styles.item,
57
- children: /*#__PURE__*/_jsx(IconRender, {
58
- color: color === '#ffffff' ? undefined : color,
59
- size: size
60
- })
61
- }, index);
62
- })
63
- })
64
- });
65
- });
1
+ 'use client';
2
+
3
+ var _templateObject;
4
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
5
+ import * as Icons from "../../index.js";
6
+ import { Flexbox } from '@hubstr/kit/ui';
7
+ import { StoryBook, useControls, useCreateStore } from '@hubstr/kit/ui/storybook';
8
+ import { createStaticStyles } from 'antd-style';
9
+ import { memo } from 'react';
10
+ import IconPreview from "../IconPreview/index.js";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ var data = Object.values(Icons).filter(function (icon) {
13
+ return icon === null || icon === void 0 ? void 0 : icon.colorPrimary;
14
+ });
15
+ var styles = createStaticStyles(function (_ref) {
16
+ var css = _ref.css,
17
+ cssVar = _ref.cssVar;
18
+ return {
19
+ item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 96px;\n padding: 16px;\n border: none;\n background: ", ";\n "])), cssVar.colorBgContainer)
20
+ };
21
+ });
22
+ var Dashboard = /*#__PURE__*/memo(function (_ref2) {
23
+ var className = _ref2.className;
24
+ var store = useCreateStore();
25
+ var _useControls = useControls({
26
+ color: {
27
+ color: true,
28
+ value: '#ffffff'
29
+ },
30
+ size: {
31
+ max: 96,
32
+ min: 16,
33
+ step: 1,
34
+ value: 24
35
+ }
36
+ }, {
37
+ store: store
38
+ }),
39
+ size = _useControls.size,
40
+ color = _useControls.color;
41
+ return /*#__PURE__*/_jsx(StoryBook, {
42
+ className: className,
43
+ levaStore: store,
44
+ children: /*#__PURE__*/_jsx(Flexbox, {
45
+ align: 'center',
46
+ gap: 4,
47
+ horizontal: true,
48
+ justify: 'center',
49
+ style: {
50
+ flexWrap: 'wrap'
51
+ },
52
+ children: data.map(function (Icon, index) {
53
+ var IconRender = Icon.Text || Icon.Brand;
54
+ if (!IconRender) return null;
55
+ return /*#__PURE__*/_jsx(IconPreview, {
56
+ className: styles.item,
57
+ children: /*#__PURE__*/_jsx(IconRender, {
58
+ color: color === '#ffffff' ? undefined : color,
59
+ size: size
60
+ })
61
+ }, index);
62
+ })
63
+ })
64
+ });
65
+ });
66
66
  export default Dashboard;
@@ -1,103 +1,103 @@
1
- 'use client';
2
-
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
- import * as Icons from "../../index.js";
10
- import { Flexbox, Grid, SearchBar, TooltipGroup } from '@hubstr/kit/ui';
11
- import { Empty, Segmented } from 'antd';
12
- import { cssVar } from 'antd-style';
13
- import { memo, useMemo, useState } from 'react';
14
- import IconItem from "./IconItem.js";
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { jsxs as _jsxs } from "react/jsx-runtime";
17
- var ColorType = /*#__PURE__*/function (ColorType) {
18
- ColorType["Color"] = "color";
19
- ColorType["Mono"] = "mono";
20
- return ColorType;
21
- }(ColorType || {});
22
- var Dashboard = /*#__PURE__*/memo(function () {
23
- var _useState = useState(ColorType.Color),
24
- _useState2 = _slicedToArray(_useState, 2),
25
- type = _useState2[0],
26
- setType = _useState2[1];
27
- var _useState3 = useState(),
28
- _useState4 = _slicedToArray(_useState3, 2),
29
- keyword = _useState4[0],
30
- setKeyword = _useState4[1];
31
- var iconsGroup = useMemo(function () {
32
- return Object.entries(Icons).filter(function (_ref) {
33
- var _ref2 = _slicedToArray(_ref, 2),
34
- key = _ref2[0],
35
- Icon = _ref2[1];
36
- if (!Icon.title) return false;
37
- if (keyword && !key.toLowerCase().includes(keyword.toLowerCase()) && !Icon.title.toLowerCase().includes(keyword.toLowerCase())) return false;
38
- return true;
39
- });
40
- }, [keyword]);
41
- var isMono = type === ColorType.Mono;
42
- return /*#__PURE__*/_jsxs(Flexbox, {
43
- gap: 16,
44
- style: {
45
- maxWidth: 960
46
- },
47
- width: '100%',
48
- children: [/*#__PURE__*/_jsxs(Flexbox, {
49
- align: 'center',
50
- gap: 12,
51
- horizontal: true,
52
- children: [/*#__PURE__*/_jsx(SearchBar, {
53
- allowClear: true,
54
- defaultValue: keyword,
55
- onSearch: function onSearch(v) {
56
- return setKeyword(v);
57
- },
58
- placeholder: 'Search by brand or model keywords...',
59
- style: {
60
- width: '100%'
61
- },
62
- type: 'block'
63
- }), /*#__PURE__*/_jsx(Segmented, {
64
- defaultValue: type,
65
- onChange: function onChange(v) {
66
- return setType(v);
67
- },
68
- options: [{
69
- label: 'Color',
70
- value: ColorType.Color
71
- }, {
72
- label: 'Mono',
73
- value: ColorType.Mono
74
- }],
75
- style: {
76
- border: "1px solid ".concat(cssVar.colorBorder)
77
- }
78
- })]
79
- }), /*#__PURE__*/_jsx(TooltipGroup, {
80
- children: iconsGroup.length > 0 ? /*#__PURE__*/_jsx(Grid, {
81
- maxItemWidth: 160,
82
- rows: 5,
83
- children: iconsGroup.map(function (_ref3) {
84
- var _ref4 = _slicedToArray(_ref3, 2),
85
- key = _ref4[0],
86
- Icon = _ref4[1];
87
- var IconRender = isMono ? Icon : Icon.Color || Icon;
88
- return /*#__PURE__*/_jsx(IconItem, {
89
- color: Icon.colorPrimary,
90
- id: key,
91
- title: Icon.title,
92
- children: /*#__PURE__*/_jsx(IconRender, {
93
- size: 56
94
- })
95
- }, key);
96
- })
97
- }) : /*#__PURE__*/_jsx(Empty, {
98
- image: Empty.PRESENTED_IMAGE_SIMPLE
99
- })
100
- })]
101
- });
102
- });
1
+ 'use client';
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ import * as Icons from "../../index.js";
10
+ import { Flexbox, Grid, SearchBar, TooltipGroup } from '@hubstr/kit/ui';
11
+ import { Empty, Segmented } from 'antd';
12
+ import { cssVar } from 'antd-style';
13
+ import { memo, useMemo, useState } from 'react';
14
+ import IconItem from "./IconItem.js";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ var ColorType = /*#__PURE__*/function (ColorType) {
18
+ ColorType["Color"] = "color";
19
+ ColorType["Mono"] = "mono";
20
+ return ColorType;
21
+ }(ColorType || {});
22
+ var Dashboard = /*#__PURE__*/memo(function () {
23
+ var _useState = useState(ColorType.Color),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ type = _useState2[0],
26
+ setType = _useState2[1];
27
+ var _useState3 = useState(),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ keyword = _useState4[0],
30
+ setKeyword = _useState4[1];
31
+ var iconsGroup = useMemo(function () {
32
+ return Object.entries(Icons).filter(function (_ref) {
33
+ var _ref2 = _slicedToArray(_ref, 2),
34
+ key = _ref2[0],
35
+ Icon = _ref2[1];
36
+ if (!Icon.title) return false;
37
+ if (keyword && !key.toLowerCase().includes(keyword.toLowerCase()) && !Icon.title.toLowerCase().includes(keyword.toLowerCase())) return false;
38
+ return true;
39
+ });
40
+ }, [keyword]);
41
+ var isMono = type === ColorType.Mono;
42
+ return /*#__PURE__*/_jsxs(Flexbox, {
43
+ gap: 16,
44
+ style: {
45
+ maxWidth: 960
46
+ },
47
+ width: '100%',
48
+ children: [/*#__PURE__*/_jsxs(Flexbox, {
49
+ align: 'center',
50
+ gap: 12,
51
+ horizontal: true,
52
+ children: [/*#__PURE__*/_jsx(SearchBar, {
53
+ allowClear: true,
54
+ defaultValue: keyword,
55
+ onSearch: function onSearch(v) {
56
+ return setKeyword(v);
57
+ },
58
+ placeholder: 'Search by brand or model keywords...',
59
+ style: {
60
+ width: '100%'
61
+ },
62
+ type: 'block'
63
+ }), /*#__PURE__*/_jsx(Segmented, {
64
+ defaultValue: type,
65
+ onChange: function onChange(v) {
66
+ return setType(v);
67
+ },
68
+ options: [{
69
+ label: 'Color',
70
+ value: ColorType.Color
71
+ }, {
72
+ label: 'Mono',
73
+ value: ColorType.Mono
74
+ }],
75
+ style: {
76
+ border: "1px solid ".concat(cssVar.colorBorder)
77
+ }
78
+ })]
79
+ }), /*#__PURE__*/_jsx(TooltipGroup, {
80
+ children: iconsGroup.length > 0 ? /*#__PURE__*/_jsx(Grid, {
81
+ maxItemWidth: 160,
82
+ rows: 5,
83
+ children: iconsGroup.map(function (_ref3) {
84
+ var _ref4 = _slicedToArray(_ref3, 2),
85
+ key = _ref4[0],
86
+ Icon = _ref4[1];
87
+ var IconRender = isMono ? Icon : Icon.Color || Icon;
88
+ return /*#__PURE__*/_jsx(IconItem, {
89
+ color: Icon.colorPrimary,
90
+ id: key,
91
+ title: Icon.title,
92
+ children: /*#__PURE__*/_jsx(IconRender, {
93
+ size: 56
94
+ })
95
+ }, key);
96
+ })
97
+ }) : /*#__PURE__*/_jsx(Empty, {
98
+ image: Empty.PRESENTED_IMAGE_SIMPLE
99
+ })
100
+ })]
101
+ });
102
+ });
103
103
  export default Dashboard;