@versini/ui-icon-picker 3.3.9 → 3.3.11

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-icon-picker v3.3.9
2
+ @versini/ui-icon-picker v3.3.11
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -9,14 +9,6 @@ import { ButtonIcon } from "@versini/ui-button/button-icon";
9
9
  import { TextInput } from "@versini/ui-textinput";
10
10
  import clsx from "clsx";
11
11
  import { useEffect, useMemo, useState } from "react";
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
12
  const useIconPicker = ()=>{
21
13
  const [iconModule, setIconModule] = useState(null);
22
14
  const [loading, setLoading] = useState(true);
@@ -26,7 +18,7 @@ const useIconPicker = ()=>{
26
18
  setLoading(false);
27
19
  });
28
20
  }, []);
29
- const icons = useMemo(()=>iconModule ? Object.entries(iconModule).filter(([iconName])=>iconName !== "IconDog").map(([iconName, IconComponent])=>({
21
+ const icons = useMemo(()=>iconModule ? Object.entries(iconModule).filter(([iconName])=>"IconDog" !== iconName).map(([iconName, IconComponent])=>({
30
22
  name: iconName,
31
23
  friendlyName: iconName.match(/[A-Z][a-z]+/g)?.join(" ") ?? iconName,
32
24
  Component: IconComponent
@@ -35,9 +27,7 @@ const useIconPicker = ()=>{
35
27
  ]);
36
28
  const [search, setSearch] = useState("");
37
29
  const filteredIcons = useMemo(()=>{
38
- if (search === "") {
39
- return icons;
40
- }
30
+ if ("" === search) return icons;
41
31
  const lowerSearch = search.toLowerCase();
42
32
  return icons.filter((icon)=>icon.name.toLowerCase().includes(lowerSearch));
43
33
  }, [
@@ -51,19 +41,12 @@ const useIconPicker = ()=>{
51
41
  loading
52
42
  };
53
43
  };
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
44
  const IconPicker = ({ onChange, className, textInputMode = "dark", noSearch = false })=>{
62
45
  const { search, setSearch, icons, loading } = useIconPicker();
63
- return /*#__PURE__*/ jsxs("div", {
46
+ return jsxs("div", {
64
47
  className: clsx("relative", className),
65
48
  children: [
66
- !noSearch && /*#__PURE__*/ jsx(TextInput, {
49
+ !noSearch && jsx(TextInput, {
67
50
  mode: textInputMode,
68
51
  name: "Search-icons-by-name",
69
52
  label: "Search icons by name",
@@ -72,32 +55,32 @@ const IconPicker = ({ onChange, className, textInputMode = "dark", noSearch = fa
72
55
  onChange: (e)=>setSearch(e.target.value),
73
56
  className: "mb-4"
74
57
  }),
75
- /*#__PURE__*/ jsxs("div", {
58
+ jsxs("div", {
76
59
  className: "flex h-full flex-wrap gap-2 overflow-y-scroll p-2 sm:p-4",
77
60
  children: [
78
- loading && /*#__PURE__*/ jsx("p", {
61
+ loading && jsx("p", {
79
62
  children: "Loading icons..."
80
63
  }),
81
- icons.map(({ name, Component })=>/*#__PURE__*/ jsxs(ButtonIcon, {
64
+ icons.map(({ name, Component })=>jsxs(ButtonIcon, {
82
65
  onClick: ()=>onChange(name),
83
66
  label: name,
84
67
  mode: "dark",
85
68
  variant: "primary",
86
69
  children: [
87
- /*#__PURE__*/ jsx(Component, {}),
88
- /*#__PURE__*/ jsx("span", {
70
+ jsx(Component, {}),
71
+ jsx("span", {
89
72
  className: "sr-only",
90
73
  children: name
91
74
  })
92
75
  ]
93
76
  }, name)),
94
- !loading && icons.length === 0 && /*#__PURE__*/ jsxs("div", {
77
+ !loading && 0 === icons.length && jsxs("div", {
95
78
  className: "col-span-full flex grow flex-col items-center justify-center gap-2 text-center",
96
79
  children: [
97
- /*#__PURE__*/ jsx("p", {
80
+ jsx("p", {
98
81
  children: "No icons found..."
99
82
  }),
100
- /*#__PURE__*/ jsx(Button, {
83
+ jsx(Button, {
101
84
  onClick: ()=>setSearch(""),
102
85
  children: "Clear search"
103
86
  })
@@ -108,5 +91,4 @@ const IconPicker = ({ onChange, className, textInputMode = "dark", noSearch = fa
108
91
  ]
109
92
  });
110
93
  };
111
-
112
94
  export { IconPicker };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-icon-picker",
3
- "version": "3.3.9",
3
+ "version": "3.3.11",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -26,7 +26,7 @@
26
26
  "@testing-library/jest-dom": "7.0.1"
27
27
  },
28
28
  "dependencies": {
29
- "@versini/ui-button": "15.3.7",
29
+ "@versini/ui-button": "15.3.9",
30
30
  "@versini/ui-textinput": "7.3.7",
31
31
  "clsx": "2.1.1",
32
32
  "tailwindcss": "4.3.3"