poi-plugin-kai-planner 1.0.8 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poi-plugin-kai-planner",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "index.js",
5
5
  "author": "aulu",
6
6
  "contributors": ["aulu"],
@@ -0,0 +1,63 @@
1
+ /* src/app/components/EquipTypeIconFilter.js */
2
+
3
+ const React = require("react");
4
+ const { SlotitemTypeIcon } = require("./SlotitemTypeIcon");
5
+
6
+ function EquipTypeIconFilter({ options, selectedKeys, onToggle, onClear, iconSize }) {
7
+ if (!Array.isArray(options) || options.length === 0) return null;
8
+
9
+ const selectedSet = new Set((selectedKeys || []).map(String));
10
+ const size = Number.isFinite(iconSize) ? iconSize : 12;
11
+ const baseButtonStyle = {
12
+ display: "inline-flex",
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ minWidth: 28,
16
+ height: 28,
17
+ padding: 0,
18
+ borderRadius: 8,
19
+ border: "1px solid rgba(255,255,255,0.12)",
20
+ background: "rgba(255,255,255,0.04)",
21
+ color: "#e5e7eb",
22
+ cursor: "pointer",
23
+ flexShrink: 0,
24
+ };
25
+
26
+ return React.createElement(
27
+ "div",
28
+ { style: { display: "flex", gap: 8, flexWrap: "wrap", alignItems: "center" } },
29
+ React.createElement(
30
+ "button",
31
+ {
32
+ type: "button",
33
+ onClick: onClear,
34
+ style: {
35
+ ...baseButtonStyle,
36
+ padding: "0 10px",
37
+ background: selectedSet.size === 0 ? "rgba(255,255,255,0.14)" : "rgba(255,255,255,0.04)",
38
+ },
39
+ },
40
+ "全部"
41
+ ),
42
+ ...options.map((option) => {
43
+ const key = String(option.key);
44
+ const active = selectedSet.has(key);
45
+ return React.createElement(
46
+ "button",
47
+ {
48
+ key,
49
+ type: "button",
50
+ onClick: () => onToggle(key),
51
+ 'aria-label': option.name || key,
52
+ style: {
53
+ ...baseButtonStyle,
54
+ background: active ? "rgba(255,255,255,0.14)" : "rgba(255,255,255,0.04)",
55
+ },
56
+ },
57
+ React.createElement(SlotitemTypeIcon, { iconType: option.iconType, style: { width: size, height: size } })
58
+ );
59
+ })
60
+ );
61
+ }
62
+
63
+ module.exports = { EquipTypeIconFilter };