@nice2dev/admin 1.0.28 → 1.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.
package/dist/index.mjs CHANGED
@@ -1,20 +1,21 @@
1
- import { jsxs as t, jsx as e, Fragment as G } from "react/jsx-runtime";
2
- import { forwardRef as I, useState as k, useMemo as $, useCallback as U, useContext as H, createContext as K } from "react";
3
- const z = I(
4
- function(v, g) {
1
+ import { jsxs as n, jsx as e, Fragment as O } from "react/jsx-runtime";
2
+ import { forwardRef as $, useState as A, useMemo as D, useCallback as U, useContext as V, createContext as Y } from "react";
3
+ import { NiceButton as G, NiceIcon as z, NiceDataGrid as P, NiceAvatar as K, NiceTag as J, NiceBadge as W, NiceSelect as Q } from "@nice2dev/ui";
4
+ const ie = $(
5
+ function(u, _) {
5
6
  const {
6
- widgets: u,
7
- columns: C = 4,
8
- title: N = "Dashboard",
9
- headerActions: b,
10
- onWidgetClick: p,
11
- className: f,
12
- style: x
13
- } = v;
14
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-dashboard ${f ?? ""}`, style: x, children: [
15
- /* @__PURE__ */ t("div", { className: "nice-admin-dashboard__header", children: [
16
- /* @__PURE__ */ e("h2", { children: N }),
17
- b && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__actions", children: b })
7
+ widgets: m,
8
+ columns: y = 4,
9
+ title: g = "Dashboard",
10
+ headerActions: p,
11
+ onWidgetClick: l,
12
+ className: k,
13
+ style: C
14
+ } = u;
15
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-admin-dashboard ${k ?? ""}`, style: C, children: [
16
+ /* @__PURE__ */ n("div", { className: "nice-admin-dashboard__header", children: [
17
+ /* @__PURE__ */ e("h2", { children: g }),
18
+ p && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__actions", children: p })
18
19
  ] }),
19
20
  /* @__PURE__ */ e(
20
21
  "div",
@@ -22,206 +23,315 @@ const z = I(
22
23
  className: "nice-admin-dashboard__grid",
23
24
  style: {
24
25
  display: "grid",
25
- gridTemplateColumns: `repeat(${C}, 1fr)`,
26
+ gridTemplateColumns: `repeat(${y}, 1fr)`,
26
27
  gap: 16
27
28
  },
28
- children: u.map((s) => /* @__PURE__ */ t(
29
+ children: m.map((c) => /* @__PURE__ */ n(
29
30
  "div",
30
31
  {
31
- className: `nice-admin-dashboard__widget nice-admin-dashboard__widget--${s.type}`,
32
+ className: `nice-admin-dashboard__widget nice-admin-dashboard__widget--${c.type}`,
32
33
  style: {
33
- gridColumn: s.colSpan ? `span ${s.colSpan}` : void 0,
34
- gridRow: s.rowSpan ? `span ${s.rowSpan}` : void 0
34
+ gridColumn: c.colSpan ? `span ${c.colSpan}` : void 0,
35
+ gridRow: c.rowSpan ? `span ${c.rowSpan}` : void 0
35
36
  },
36
- onClick: () => p == null ? void 0 : p(s),
37
- onKeyDown: p ? (w) => {
38
- (w.key === "Enter" || w.key === " ") && p(s);
37
+ onClick: () => l == null ? void 0 : l(c),
38
+ onKeyDown: l ? (S) => {
39
+ (S.key === "Enter" || S.key === " ") && l(c);
39
40
  } : void 0,
40
- role: p ? "button" : void 0,
41
- tabIndex: p ? 0 : void 0,
41
+ role: l ? "button" : void 0,
42
+ tabIndex: l ? 0 : void 0,
42
43
  children: [
43
- /* @__PURE__ */ t("div", { className: "nice-admin-dashboard__widget-header", children: [
44
- s.icon && /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-icon", children: s.icon }),
45
- /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-title", children: s.title })
44
+ /* @__PURE__ */ n("div", { className: "nice-admin-dashboard__widget-header", children: [
45
+ c.icon && /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-icon", children: c.icon }),
46
+ /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__widget-title", children: c.title })
46
47
  ] }),
47
- s.type === "stat" && /* @__PURE__ */ t("div", { className: "nice-admin-dashboard__stat", children: [
48
- /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__stat-value", children: s.value }),
49
- s.change && /* @__PURE__ */ e(
48
+ c.type === "stat" && /* @__PURE__ */ n("div", { className: "nice-admin-dashboard__stat", children: [
49
+ /* @__PURE__ */ e("span", { className: "nice-admin-dashboard__stat-value", children: c.value }),
50
+ c.change && /* @__PURE__ */ e(
50
51
  "span",
51
52
  {
52
- className: `nice-admin-dashboard__stat-change ${s.changePositive ? "nice-admin-dashboard__stat-change--positive" : "nice-admin-dashboard__stat-change--negative"}`,
53
- children: s.change
53
+ className: `nice-admin-dashboard__stat-change ${c.changePositive ? "nice-admin-dashboard__stat-change--positive" : "nice-admin-dashboard__stat-change--negative"}`,
54
+ children: c.change
54
55
  }
55
56
  )
56
57
  ] }),
57
- s.type === "custom" && s.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__custom", children: s.render() }),
58
- (s.type === "chart" || s.type === "table" || s.type === "list") && s.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__content", children: s.render() })
58
+ c.type === "custom" && c.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__custom", children: c.render() }),
59
+ (c.type === "chart" || c.type === "table" || c.type === "list") && c.render && /* @__PURE__ */ e("div", { className: "nice-admin-dashboard__content", children: c.render() })
59
60
  ]
60
61
  },
61
- s.id
62
+ c.id
62
63
  ))
63
64
  }
64
65
  )
65
66
  ] });
66
67
  }
67
- ), Y = {
68
- active: "#22c55e",
69
- inactive: "#9ca3af",
70
- suspended: "#ef4444",
71
- pending: "#eab308"
72
- }, Q = I(
73
- function(v, g) {
68
+ ), X = {
69
+ active: "success",
70
+ inactive: "secondary",
71
+ suspended: "danger",
72
+ pending: "warning"
73
+ }, se = $(
74
+ function(u, _) {
74
75
  const {
75
- users: u,
76
- availableRoles: C = [],
77
- onCreate: N,
78
- onEdit: b,
79
- onDelete: p,
80
- onToggleStatus: f,
81
- onChangeRoles: x,
82
- searchable: s = !0,
83
- title: w = "User Management",
84
- className: L,
85
- style: _
86
- } = v, [y, S] = k(""), [c, n] = k(""), l = $(() => {
87
- let a = u;
88
- if (c && (a = a.filter((o) => o.status === c)), y.trim()) {
89
- const o = y.toLowerCase();
90
- a = a.filter(
91
- (R) => R.name.toLowerCase().includes(o) || R.email.toLowerCase().includes(o) || R.roles.some((T) => T.toLowerCase().includes(o))
92
- );
93
- }
94
- return a;
95
- }, [u, c, y]), m = U(
96
- (a) => {
97
- if (!f)
98
- return;
99
- const o = a.status === "active" ? "suspended" : "active";
100
- f(a.id, o);
101
- },
102
- [f]
103
- );
104
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-users ${L ?? ""}`, style: _, children: [
105
- /* @__PURE__ */ t("div", { className: "nice-admin-users__header", children: [
106
- /* @__PURE__ */ e("h3", { children: w }),
107
- /* @__PURE__ */ t("span", { className: "nice-admin-users__count", children: [
108
- u.length,
109
- " users"
110
- ] }),
111
- N && /* @__PURE__ */ e("button", { className: "nice-admin-users__create-btn", onClick: N, children: "+ Add User" })
112
- ] }),
113
- /* @__PURE__ */ t("div", { className: "nice-admin-users__toolbar", children: [
114
- s && /* @__PURE__ */ e(
115
- "input",
116
- {
117
- type: "text",
118
- value: y,
119
- onChange: (a) => S(a.target.value),
120
- placeholder: "Search users…",
121
- className: "nice-admin-users__search"
122
- }
123
- ),
124
- /* @__PURE__ */ t(
125
- "select",
126
- {
127
- value: c,
128
- onChange: (a) => n(a.target.value),
129
- className: "nice-admin-users__status-filter",
130
- children: [
131
- /* @__PURE__ */ e("option", { value: "", children: "All statuses" }),
132
- /* @__PURE__ */ e("option", { value: "active", children: "Active" }),
133
- /* @__PURE__ */ e("option", { value: "inactive", children: "Inactive" }),
134
- /* @__PURE__ */ e("option", { value: "suspended", children: "Suspended" }),
135
- /* @__PURE__ */ e("option", { value: "pending", children: "Pending" })
136
- ]
137
- }
138
- )
139
- ] }),
140
- l.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-admin-users__empty", children: "No users found." }) : /* @__PURE__ */ t("table", { className: "nice-admin-users__table", children: [
141
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
142
- /* @__PURE__ */ e("th", { children: "User" }),
143
- /* @__PURE__ */ e("th", { children: "Email" }),
144
- /* @__PURE__ */ e("th", { children: "Roles" }),
145
- /* @__PURE__ */ e("th", { children: "Status" }),
146
- /* @__PURE__ */ e("th", { children: "Created" }),
147
- /* @__PURE__ */ e("th", { children: "Last Login" }),
148
- /* @__PURE__ */ e("th", { children: "Actions" })
149
- ] }) }),
150
- /* @__PURE__ */ e("tbody", { children: l.map((a) => /* @__PURE__ */ t("tr", { children: [
151
- /* @__PURE__ */ t("td", { className: "nice-admin-users__user-cell", children: [
152
- a.avatarUrl && /* @__PURE__ */ e("img", { src: a.avatarUrl, alt: "", className: "nice-admin-users__avatar" }),
153
- /* @__PURE__ */ e("span", { children: a.name })
154
- ] }),
155
- /* @__PURE__ */ e("td", { children: a.email }),
156
- /* @__PURE__ */ e("td", { children: x ? /* @__PURE__ */ e(
76
+ users: m,
77
+ availableRoles: y = [],
78
+ onCreate: g,
79
+ onEdit: p,
80
+ onDelete: l,
81
+ onToggleStatus: k,
82
+ onChangeRoles: C,
83
+ searchable: c = !0,
84
+ title: S,
85
+ className: T,
86
+ style: f
87
+ } = u, [N, x] = A(""), v = D(
88
+ () => N ? m.filter((r) => r.status === N) : m,
89
+ [m, N]
90
+ ), a = D(() => {
91
+ const r = [
92
+ {
93
+ field: "name",
94
+ header: "User",
95
+ sortable: !0,
96
+ render: (h, b) => /* @__PURE__ */ n("span", { className: "nice-admin-users__user-cell", children: [
97
+ /* @__PURE__ */ e(K, { src: b.avatarUrl, name: b.name, size: "sm" }),
98
+ /* @__PURE__ */ e("span", { children: b.name })
99
+ ] })
100
+ },
101
+ {
102
+ field: "email",
103
+ header: "Email",
104
+ sortable: !0,
105
+ render: (h) => /* @__PURE__ */ e("span", { className: "nice-admin-users__email", children: String(h ?? "") })
106
+ },
107
+ {
108
+ field: "roles",
109
+ header: "Roles",
110
+ render: (h, b) => C ? /* @__PURE__ */ e(
157
111
  "select",
158
112
  {
159
113
  multiple: !0,
160
- value: a.roles,
161
- onChange: (o) => {
162
- const R = Array.from(o.target.selectedOptions, (T) => T.value);
163
- x(a.id, R);
114
+ value: b.roles,
115
+ onChange: (w) => {
116
+ const o = Array.from(w.target.selectedOptions, (L) => L.value);
117
+ C(b.id, o);
164
118
  },
165
119
  className: "nice-admin-users__roles-select",
166
- children: C.map((o) => /* @__PURE__ */ e("option", { value: o, children: o }, o))
120
+ "aria-label": `Roles for ${b.name}`,
121
+ children: y.map((w) => /* @__PURE__ */ e("option", { value: w, children: w }, w))
122
+ }
123
+ ) : /* @__PURE__ */ e("span", { className: "nice-admin-users__roles", children: b.roles.map((w) => /* @__PURE__ */ e(J, { size: "sm", children: w }, w)) })
124
+ },
125
+ {
126
+ field: "status",
127
+ header: "Status",
128
+ sortable: !0,
129
+ render: (h, b) => {
130
+ const w = /* @__PURE__ */ e(W, { variant: X[b.status], size: "sm", children: b.status });
131
+ if (!k)
132
+ return /* @__PURE__ */ e("span", { className: "nice-admin-users__status-badge", children: w });
133
+ const o = b.status === "active" ? "suspended" : "active";
134
+ return /* @__PURE__ */ e(
135
+ "button",
136
+ {
137
+ type: "button",
138
+ className: "nice-admin-users__status-badge nice-admin-users__status-badge--toggle",
139
+ onClick: () => k(b.id, o),
140
+ "aria-label": `Toggle status for ${b.name}`,
141
+ children: w
142
+ }
143
+ );
144
+ }
145
+ },
146
+ {
147
+ field: "createdAt",
148
+ header: "Created",
149
+ dataType: "date",
150
+ sortable: !0
151
+ },
152
+ {
153
+ field: "lastLoginAt",
154
+ header: "Last Login",
155
+ dataType: "date",
156
+ sortable: !0,
157
+ render: (h) => h ? String(h) : "—"
158
+ }
159
+ ];
160
+ return (p || l) && r.push({
161
+ field: "__actions",
162
+ header: "Actions",
163
+ align: "right",
164
+ render: (h, b) => /* @__PURE__ */ n("span", { className: "nice-admin-users__actions", children: [
165
+ p && /* @__PURE__ */ e(
166
+ G,
167
+ {
168
+ size: "sm",
169
+ variant: "ghost",
170
+ ariaLabel: `Edit ${b.name}`,
171
+ onClick: () => p(b),
172
+ children: /* @__PURE__ */ e(z, { name: "edit" })
167
173
  }
168
- ) : a.roles.join(", ") }),
169
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
170
- "span",
174
+ ),
175
+ l && /* @__PURE__ */ e(
176
+ G,
171
177
  {
172
- className: "nice-admin-users__status-badge",
173
- style: { backgroundColor: Y[a.status] },
174
- onClick: () => m(a),
175
- onKeyDown: f ? (o) => {
176
- (o.key === "Enter" || o.key === " ") && m(a);
177
- } : void 0,
178
- role: f ? "button" : void 0,
179
- tabIndex: f ? 0 : void 0,
180
- children: a.status
178
+ size: "sm",
179
+ variant: "ghost",
180
+ ariaLabel: `Delete ${b.name}`,
181
+ onClick: () => l(b.id),
182
+ children: /* @__PURE__ */ e(z, { name: "trash" })
181
183
  }
182
- ) }),
183
- /* @__PURE__ */ e("td", { children: a.createdAt }),
184
- /* @__PURE__ */ e("td", { children: a.lastLoginAt ?? "—" }),
185
- /* @__PURE__ */ t("td", { className: "nice-admin-users__actions", children: [
186
- b && /* @__PURE__ */ e("button", { onClick: () => b(a), children: "Edit" }),
187
- p && /* @__PURE__ */ e("button", { onClick: () => p(a.id), children: "Delete" })
188
- ] })
189
- ] }, a.id)) })
184
+ )
185
+ ] })
186
+ }), r;
187
+ }, [y, C, l, p, k]), s = D(() => {
188
+ if (l)
189
+ return [
190
+ {
191
+ key: "delete",
192
+ label: "Delete",
193
+ variant: "danger",
194
+ icon: /* @__PURE__ */ e(z, { name: "trash" }),
195
+ onClick: (r) => r.forEach((h) => l(h))
196
+ }
197
+ ];
198
+ }, [l]), d = /* @__PURE__ */ n("div", { className: "nice-admin-users__toolbar", children: [
199
+ /* @__PURE__ */ e(
200
+ Q,
201
+ {
202
+ value: N,
203
+ onChange: (r) => x(r ?? ""),
204
+ title: "Filter by status",
205
+ options: [
206
+ { value: "", label: "All statuses" },
207
+ { value: "active", label: "Active" },
208
+ { value: "inactive", label: "Inactive" },
209
+ { value: "suspended", label: "Suspended" },
210
+ { value: "pending", label: "Pending" }
211
+ ],
212
+ size: "sm"
213
+ }
214
+ ),
215
+ g && /* @__PURE__ */ n(G, { size: "sm", variant: "primary", onClick: g, children: [
216
+ /* @__PURE__ */ e(z, { name: "plus" }),
217
+ /* @__PURE__ */ e("span", { children: "Add User" })
190
218
  ] })
191
219
  ] });
220
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-admin-users ${T ?? ""}`, style: f, children: [
221
+ S != null && /* @__PURE__ */ n("div", { className: "nice-admin-users__header", children: [
222
+ /* @__PURE__ */ e("h3", { children: S }),
223
+ /* @__PURE__ */ n("span", { className: "nice-admin-users__count", children: [
224
+ m.length,
225
+ " users"
226
+ ] })
227
+ ] }),
228
+ /* @__PURE__ */ e(
229
+ P,
230
+ {
231
+ columns: a,
232
+ data: v,
233
+ keyField: "id",
234
+ searchable: c,
235
+ searchPlaceholder: "Search users…",
236
+ selectable: !!l,
237
+ bulkActions: s,
238
+ striped: !0,
239
+ toolbar: d,
240
+ emptyText: "No users found."
241
+ }
242
+ )
243
+ ] });
192
244
  }
193
- ), X = I(
194
- function(v, g) {
195
- var h;
245
+ );
246
+ function Z(F) {
247
+ let u = 0;
248
+ for (const _ of Object.values(F.permissions))
249
+ u += _.length;
250
+ return u;
251
+ }
252
+ const re = $(
253
+ function(u, _) {
254
+ var L;
196
255
  const {
197
- roles: u,
198
- actions: C,
199
- resources: N,
200
- onPermissionChange: b,
201
- onCreate: p,
202
- onDelete: f,
203
- onRename: x,
204
- title: s = "Role Management",
205
- className: w,
206
- style: L
207
- } = v, [_, y] = k(((h = u[0]) == null ? void 0 : h.id) ?? null), [S, c] = k(!1), [n, l] = k(""), [m, a] = k(""), o = u.find((r) => r.id === _), R = U(() => {
208
- !n.trim() || !p || (p(n.trim(), m.trim()), l(""), a(""), c(!1));
209
- }, [n, m, p]), T = (r, d, i) => {
210
- var A;
211
- return ((A = r.permissions[d]) == null ? void 0 : A.includes(i)) ?? !1;
212
- };
213
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-roles ${w ?? ""}`, style: L, children: [
214
- /* @__PURE__ */ t("div", { className: "nice-admin-roles__header", children: [
215
- /* @__PURE__ */ e("h3", { children: s }),
216
- p && /* @__PURE__ */ e("button", { onClick: () => c(!S), children: "+ New Role" })
256
+ roles: m,
257
+ actions: y,
258
+ resources: g,
259
+ onPermissionChange: p,
260
+ onCreate: l,
261
+ onDelete: k,
262
+ onRename: C,
263
+ title: c,
264
+ className: S,
265
+ style: T
266
+ } = u, [f, N] = A(((L = m[0]) == null ? void 0 : L.id) ?? null), [x, v] = A(!1), [a, s] = A(""), [d, r] = A(""), h = m.find((i) => i.id === f), b = U(() => {
267
+ !a.trim() || !l || (l(a.trim(), d.trim()), s(""), r(""), v(!1));
268
+ }, [a, d, l]), w = (i, t, E) => {
269
+ var R;
270
+ return ((R = i.permissions[t]) == null ? void 0 : R.includes(E)) ?? !1;
271
+ }, o = D(
272
+ () => [
273
+ {
274
+ field: "name",
275
+ header: "Role",
276
+ sortable: !0,
277
+ render: (i, t) => /* @__PURE__ */ n("span", { className: "nice-admin-roles__name-cell", children: [
278
+ t.color && /* @__PURE__ */ e(
279
+ "span",
280
+ {
281
+ className: "nice-admin-roles__color-dot",
282
+ style: { background: t.color },
283
+ "aria-hidden": "true"
284
+ }
285
+ ),
286
+ /* @__PURE__ */ e("span", { children: t.name }),
287
+ t.isSystem && /* @__PURE__ */ e(
288
+ z,
289
+ {
290
+ name: "lock",
291
+ size: "sm",
292
+ title: "System role",
293
+ className: "nice-admin-roles__system-icon"
294
+ }
295
+ )
296
+ ] })
297
+ },
298
+ {
299
+ field: "description",
300
+ header: "Description",
301
+ sortable: !0,
302
+ render: (i, t) => t.description ?? "—"
303
+ },
304
+ {
305
+ field: "permissionCount",
306
+ header: "Permissions",
307
+ align: "right",
308
+ dataType: "number",
309
+ sortable: !0,
310
+ render: (i, t) => Z(t)
311
+ },
312
+ {
313
+ field: "userCount",
314
+ header: "Users",
315
+ align: "right",
316
+ dataType: "number",
317
+ sortable: !0,
318
+ render: (i, t) => t.userCount ?? 0
319
+ }
320
+ ],
321
+ []
322
+ );
323
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-admin-roles ${S ?? ""}`, style: T, children: [
324
+ (c || l) && /* @__PURE__ */ n("div", { className: "nice-admin-roles__header", children: [
325
+ c && /* @__PURE__ */ e("h3", { children: c }),
326
+ l && /* @__PURE__ */ e("button", { onClick: () => v(!x), children: "+ New Role" })
217
327
  ] }),
218
- S && /* @__PURE__ */ t("div", { className: "nice-admin-roles__create-form", children: [
328
+ x && /* @__PURE__ */ n("div", { className: "nice-admin-roles__create-form", children: [
219
329
  /* @__PURE__ */ e(
220
330
  "input",
221
331
  {
222
332
  type: "text",
223
- value: n,
224
- onChange: (r) => l(r.target.value),
333
+ value: a,
334
+ onChange: (i) => s(i.target.value),
225
335
  placeholder: "Role name"
226
336
  }
227
337
  ),
@@ -229,125 +339,162 @@ const z = I(
229
339
  "input",
230
340
  {
231
341
  type: "text",
232
- value: m,
233
- onChange: (r) => a(r.target.value),
342
+ value: d,
343
+ onChange: (i) => r(i.target.value),
234
344
  placeholder: "Description"
235
345
  }
236
346
  ),
237
- /* @__PURE__ */ e("button", { onClick: R, disabled: !n.trim(), children: "Create" }),
238
- /* @__PURE__ */ e("button", { onClick: () => c(!1), children: "Cancel" })
347
+ /* @__PURE__ */ e("button", { onClick: b, disabled: !a.trim(), children: "Create" }),
348
+ /* @__PURE__ */ e("button", { onClick: () => v(!1), children: "Cancel" })
239
349
  ] }),
240
- /* @__PURE__ */ e("div", { className: "nice-admin-roles__tabs", children: u.map((r) => /* @__PURE__ */ t(
241
- "button",
350
+ /* @__PURE__ */ e(
351
+ P,
242
352
  {
243
- className: `nice-admin-roles__tab ${r.id === _ ? "nice-admin-roles__tab--active" : ""}`,
244
- onClick: () => y(r.id),
245
- style: r.color ? { borderColor: r.color } : void 0,
246
- children: [
247
- r.name,
248
- r.userCount != null && /* @__PURE__ */ t("span", { className: "nice-admin-roles__tab-count", children: [
249
- "(",
250
- r.userCount,
251
- ")"
252
- ] }),
253
- r.isSystem && /* @__PURE__ */ e("span", { className: "nice-admin-roles__tab-system", children: "🔒" })
254
- ]
255
- },
256
- r.id
257
- )) }),
258
- o && /* @__PURE__ */ t("div", { className: "nice-admin-roles__matrix-wrap", children: [
259
- o.description && /* @__PURE__ */ e("p", { className: "nice-admin-roles__description", children: o.description }),
260
- /* @__PURE__ */ t("table", { className: "nice-admin-roles__matrix", children: [
261
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
353
+ className: "nice-admin-roles__grid",
354
+ columns: o,
355
+ data: m,
356
+ keyField: "id",
357
+ searchable: !0,
358
+ striped: !0,
359
+ size: "sm",
360
+ selectable: !1,
361
+ onRowClick: (i) => N(i.id)
362
+ }
363
+ ),
364
+ h && /* @__PURE__ */ n("div", { className: "nice-admin-roles__matrix-wrap", children: [
365
+ h.description && /* @__PURE__ */ e("p", { className: "nice-admin-roles__description", children: h.description }),
366
+ /* @__PURE__ */ n("table", { className: "nice-admin-roles__matrix", children: [
367
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
262
368
  /* @__PURE__ */ e("th", { children: "Resource" }),
263
- C.map((r) => /* @__PURE__ */ e("th", { title: r.description, children: r.label }, r.id))
369
+ y.map((i) => /* @__PURE__ */ e("th", { title: i.description, children: i.label }, i.id))
264
370
  ] }) }),
265
- /* @__PURE__ */ e("tbody", { children: N.map((r) => /* @__PURE__ */ t("tr", { children: [
266
- /* @__PURE__ */ e("td", { children: r.label }),
267
- C.map((d) => {
268
- const i = T(o, r.id, d.id);
371
+ /* @__PURE__ */ e("tbody", { children: g.map((i) => /* @__PURE__ */ n("tr", { children: [
372
+ /* @__PURE__ */ e("td", { children: i.label }),
373
+ y.map((t) => {
374
+ const E = w(h, i.id, t.id);
269
375
  return /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
270
376
  "input",
271
377
  {
272
378
  type: "checkbox",
273
- checked: i,
274
- onChange: () => b == null ? void 0 : b(o.id, r.id, d.id, !i),
275
- disabled: o.isSystem
379
+ checked: E,
380
+ onChange: () => p == null ? void 0 : p(h.id, i.id, t.id, !E),
381
+ disabled: h.isSystem
276
382
  }
277
- ) }, d.id);
383
+ ) }, t.id);
278
384
  })
279
- ] }, r.id)) })
385
+ ] }, i.id)) })
280
386
  ] }),
281
- !o.isSystem && /* @__PURE__ */ t("div", { className: "nice-admin-roles__role-actions", children: [
282
- x && /* @__PURE__ */ e(
387
+ !h.isSystem && /* @__PURE__ */ n("div", { className: "nice-admin-roles__role-actions", children: [
388
+ C && /* @__PURE__ */ e(
283
389
  "button",
284
390
  {
285
391
  onClick: () => {
286
- const r = prompt("New role name:", o.name);
287
- r && x(o.id, r);
392
+ const i = prompt("New role name:", h.name);
393
+ i && C(h.id, i);
288
394
  },
289
395
  children: "Rename"
290
396
  }
291
397
  ),
292
- f && /* @__PURE__ */ e("button", { onClick: () => f(o.id), children: "Delete Role" })
398
+ k && /* @__PURE__ */ e("button", { onClick: () => k(h.id), children: "Delete Role" })
293
399
  ] })
294
400
  ] })
295
401
  ] });
296
402
  }
297
- ), V = {
298
- info: { color: "#3b82f6", label: "INFO" },
299
- warning: { color: "#eab308", label: "WARN" },
300
- error: { color: "#ef4444", label: "ERROR" },
301
- critical: { color: "#dc2626", label: "CRIT" }
302
- }, Z = I(
303
- function(v, g) {
403
+ ), j = {
404
+ info: { color: "var(--nice-color-info, #3b82f6)", label: "INFO", icon: "info" },
405
+ warning: { color: "var(--nice-color-warning, #eab308)", label: "WARN", icon: "warning" },
406
+ error: { color: "var(--nice-color-danger, #ef4444)", label: "ERROR", icon: "error" },
407
+ critical: { color: "var(--nice-color-danger, #dc2626)", label: "CRIT", icon: "error" }
408
+ }, le = $(
409
+ function(u, _) {
304
410
  const {
305
- entries: u,
306
- onEntryClick: C,
307
- onLoadMore: N,
308
- hasMore: b = !1,
309
- searchable: p = !0,
310
- showSeverityFilter: f = !0,
311
- title: x = "Audit Log",
312
- className: s,
313
- style: w
314
- } = v, [L, _] = k(""), [y, S] = k(""), c = $(() => {
315
- let n = u;
316
- if (y && (n = n.filter((l) => l.severity === y)), L.trim()) {
317
- const l = L.toLowerCase();
318
- n = n.filter(
319
- (m) => {
320
- var a;
321
- return m.actorName.toLowerCase().includes(l) || m.action.toLowerCase().includes(l) || m.resource.toLowerCase().includes(l) || ((a = m.details) == null ? void 0 : a.toLowerCase().includes(l));
411
+ entries: m,
412
+ onEntryClick: y,
413
+ onLoadMore: g,
414
+ hasMore: p = !1,
415
+ searchable: l = !0,
416
+ showSeverityFilter: k = !0,
417
+ title: C,
418
+ className: c,
419
+ style: S
420
+ } = u, [T, f] = A(""), [N, x] = A(""), v = D(() => {
421
+ let s = m;
422
+ if (N && (s = s.filter((d) => d.severity === N)), T.trim()) {
423
+ const d = T.toLowerCase();
424
+ s = s.filter(
425
+ (r) => {
426
+ var h;
427
+ return r.actorName.toLowerCase().includes(d) || r.action.toLowerCase().includes(d) || r.resource.toLowerCase().includes(d) || ((h = r.details) == null ? void 0 : h.toLowerCase().includes(d));
322
428
  }
323
429
  );
324
430
  }
325
- return n;
326
- }, [u, y, L]);
327
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-audit-log ${s ?? ""}`, style: w, children: [
328
- /* @__PURE__ */ t("div", { className: "nice-admin-audit-log__header", children: [
329
- /* @__PURE__ */ e("h3", { children: x }),
330
- /* @__PURE__ */ t("span", { className: "nice-admin-audit-log__count", children: [
331
- u.length,
332
- " entries"
333
- ] })
334
- ] }),
335
- /* @__PURE__ */ t("div", { className: "nice-admin-audit-log__toolbar", children: [
336
- p && /* @__PURE__ */ e(
431
+ return s;
432
+ }, [m, N, T]), a = D(
433
+ () => [
434
+ { field: "timestamp", header: "Timestamp", sortable: !0, width: 170 },
435
+ {
436
+ field: "severity",
437
+ header: "Severity",
438
+ sortable: !0,
439
+ width: 120,
440
+ render: (s, d) => {
441
+ const r = j[d.severity];
442
+ return /* @__PURE__ */ n(
443
+ "span",
444
+ {
445
+ className: "nice-admin-audit-log__severity",
446
+ style: { color: r.color, display: "inline-flex", alignItems: "center", gap: 4 },
447
+ children: [
448
+ /* @__PURE__ */ e(z, { name: r.icon, size: 14 }),
449
+ r.label
450
+ ]
451
+ }
452
+ );
453
+ }
454
+ },
455
+ { field: "actorName", header: "Actor", sortable: !0 },
456
+ { field: "action", header: "Action", sortable: !0 },
457
+ {
458
+ field: "resource",
459
+ header: "Resource",
460
+ sortable: !0,
461
+ render: (s, d) => /* @__PURE__ */ n(O, { children: [
462
+ d.resource,
463
+ d.resourceId ? ` #${d.resourceId}` : ""
464
+ ] })
465
+ },
466
+ {
467
+ field: "ipAddress",
468
+ header: "IP",
469
+ width: 130,
470
+ render: (s) => s ?? "—"
471
+ },
472
+ {
473
+ field: "details",
474
+ header: "Details",
475
+ render: (s) => /* @__PURE__ */ e("span", { className: "nice-admin-audit-log__details", children: s ?? "—" })
476
+ }
477
+ ],
478
+ []
479
+ );
480
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-admin-audit-log ${c ?? ""}`, style: S, children: [
481
+ C && /* @__PURE__ */ e("div", { className: "nice-admin-audit-log__header", children: /* @__PURE__ */ e("h3", { children: C }) }),
482
+ /* @__PURE__ */ n("div", { className: "nice-admin-audit-log__toolbar", children: [
483
+ l && /* @__PURE__ */ e(
337
484
  "input",
338
485
  {
339
486
  type: "text",
340
- value: L,
341
- onChange: (n) => _(n.target.value),
487
+ value: T,
488
+ onChange: (s) => f(s.target.value),
342
489
  placeholder: "Search audit log…",
343
490
  className: "nice-admin-audit-log__search"
344
491
  }
345
492
  ),
346
- f && /* @__PURE__ */ t(
493
+ k && /* @__PURE__ */ n(
347
494
  "select",
348
495
  {
349
- value: y,
350
- onChange: (n) => S(n.target.value),
496
+ value: N,
497
+ onChange: (s) => x(s.target.value),
351
498
  className: "nice-admin-audit-log__severity-filter",
352
499
  children: [
353
500
  /* @__PURE__ */ e("option", { value: "", children: "All severities" }),
@@ -359,106 +506,82 @@ const z = I(
359
506
  }
360
507
  )
361
508
  ] }),
362
- c.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-admin-audit-log__empty", children: "No audit log entries found." }) : /* @__PURE__ */ t("table", { className: "nice-admin-audit-log__table", children: [
363
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
364
- /* @__PURE__ */ e("th", { children: "Timestamp" }),
365
- /* @__PURE__ */ e("th", { children: "Severity" }),
366
- /* @__PURE__ */ e("th", { children: "Actor" }),
367
- /* @__PURE__ */ e("th", { children: "Action" }),
368
- /* @__PURE__ */ e("th", { children: "Resource" }),
369
- /* @__PURE__ */ e("th", { children: "IP" }),
370
- /* @__PURE__ */ e("th", { children: "Details" })
371
- ] }) }),
372
- /* @__PURE__ */ e("tbody", { children: c.map((n) => {
373
- const l = V[n.severity];
374
- return /* @__PURE__ */ t(
375
- "tr",
376
- {
377
- className: "nice-admin-audit-log__row",
378
- onClick: () => C == null ? void 0 : C(n),
379
- role: C ? "button" : void 0,
380
- tabIndex: C ? 0 : void 0,
381
- children: [
382
- /* @__PURE__ */ e("td", { children: n.timestamp }),
383
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: "nice-admin-audit-log__severity", style: { color: l.color }, children: l.label }) }),
384
- /* @__PURE__ */ e("td", { children: n.actorName }),
385
- /* @__PURE__ */ e("td", { children: n.action }),
386
- /* @__PURE__ */ t("td", { children: [
387
- n.resource,
388
- n.resourceId ? ` #${n.resourceId}` : ""
389
- ] }),
390
- /* @__PURE__ */ e("td", { children: n.ipAddress ?? "—" }),
391
- /* @__PURE__ */ e("td", { className: "nice-admin-audit-log__details", children: n.details ?? "—" })
392
- ]
393
- },
394
- n.id
395
- );
396
- }) })
397
- ] }),
398
- b && N && /* @__PURE__ */ e("button", { className: "nice-admin-audit-log__load-more", onClick: N, children: "Load more" })
509
+ /* @__PURE__ */ e(
510
+ P,
511
+ {
512
+ columns: a,
513
+ data: v,
514
+ keyField: "id",
515
+ striped: !0,
516
+ size: "sm",
517
+ emptyText: "No audit log entries found.",
518
+ onRowClick: y ? (s) => y(s) : void 0
519
+ }
520
+ ),
521
+ p && g && /* @__PURE__ */ e("button", { className: "nice-admin-audit-log__load-more", onClick: g, children: "Load more" })
399
522
  ] });
400
523
  }
401
- ), j = I(
402
- function(v, g) {
524
+ ), ce = $(
525
+ function(u, _) {
403
526
  const {
404
- settings: u,
405
- onSave: C,
406
- onChange: N,
407
- onReset: b,
408
- saving: p = !1,
409
- title: f = "Settings",
410
- className: x,
411
- style: s
412
- } = v, [w, L] = k(() => {
413
- const n = {};
414
- for (const l of u)
415
- n[l.key] = l.value;
416
- return n;
417
- }), _ = U(
418
- (n, l) => {
419
- L((m) => ({ ...m, [n]: l })), N == null || N(n, l);
527
+ settings: m,
528
+ onSave: y,
529
+ onChange: g,
530
+ onReset: p,
531
+ saving: l = !1,
532
+ title: k = "Settings",
533
+ className: C,
534
+ style: c
535
+ } = u, [S, T] = A(() => {
536
+ const a = {};
537
+ for (const s of m)
538
+ a[s.key] = s.value;
539
+ return a;
540
+ }), f = U(
541
+ (a, s) => {
542
+ T((d) => ({ ...d, [a]: s })), g == null || g(a, s);
420
543
  },
421
- [N]
422
- ), y = U(() => {
423
- C == null || C(w);
424
- }, [C, w]), S = /* @__PURE__ */ new Map();
425
- for (const n of u) {
426
- const l = n.section ?? "General";
427
- S.has(l) || S.set(l, []), S.get(l).push(n);
544
+ [g]
545
+ ), N = U(() => {
546
+ y == null || y(S);
547
+ }, [y, S]), x = /* @__PURE__ */ new Map();
548
+ for (const a of m) {
549
+ const s = a.section ?? "General";
550
+ x.has(s) || x.set(s, []), x.get(s).push(a);
428
551
  }
429
- const c = (n) => {
430
- var m;
431
- const l = w[n.key];
432
- switch (n.type) {
552
+ const v = (a) => {
553
+ var d;
554
+ const s = S[a.key];
555
+ switch (a.type) {
433
556
  case "boolean":
434
- return /* @__PURE__ */ t("label", { className: "nice-admin-settings__toggle", children: [
557
+ return /* @__PURE__ */ n("label", { className: "nice-admin-settings__toggle", children: [
435
558
  /* @__PURE__ */ e(
436
559
  "input",
437
560
  {
438
561
  type: "checkbox",
439
- checked: !!l,
440
- onChange: (a) => _(n.key, a.target.checked)
562
+ checked: !!s,
563
+ onChange: (r) => f(a.key, r.target.checked)
441
564
  }
442
565
  ),
443
- n.label
566
+ a.label
444
567
  ] });
445
568
  case "select":
446
569
  return /* @__PURE__ */ e(
447
570
  "select",
448
571
  {
449
- value: String(l ?? ""),
450
- onChange: (a) => _(n.key, a.target.value),
572
+ value: String(s ?? ""),
573
+ onChange: (r) => f(a.key, r.target.value),
451
574
  className: "nice-admin-settings__select",
452
- children: (m = n.options) == null ? void 0 : m.map((a) => /* @__PURE__ */ e("option", { value: a.value, children: a.label }, a.value))
575
+ children: (d = a.options) == null ? void 0 : d.map((r) => /* @__PURE__ */ e("option", { value: r.value, children: r.label }, r.value))
453
576
  }
454
577
  );
455
578
  case "textarea":
456
579
  return /* @__PURE__ */ e(
457
580
  "textarea",
458
581
  {
459
- value: String(l ?? ""),
460
- onChange: (a) => _(n.key, a.target.value),
461
- placeholder: n.placeholder,
582
+ value: String(s ?? ""),
583
+ onChange: (r) => f(a.key, r.target.value),
584
+ placeholder: a.placeholder,
462
585
  className: "nice-admin-settings__textarea",
463
586
  rows: 4
464
587
  }
@@ -468,9 +591,9 @@ const z = I(
468
591
  "input",
469
592
  {
470
593
  type: "number",
471
- value: l != null ? Number(l) : "",
472
- onChange: (a) => _(n.key, parseFloat(a.target.value) || 0),
473
- placeholder: n.placeholder,
594
+ value: s != null ? Number(s) : "",
595
+ onChange: (r) => f(a.key, parseFloat(r.target.value) || 0),
596
+ placeholder: a.placeholder,
474
597
  className: "nice-admin-settings__input"
475
598
  }
476
599
  );
@@ -479,8 +602,8 @@ const z = I(
479
602
  "input",
480
603
  {
481
604
  type: "color",
482
- value: String(l ?? "#000000"),
483
- onChange: (a) => _(n.key, a.target.value),
605
+ value: String(s ?? "#000000"),
606
+ onChange: (r) => f(a.key, r.target.value),
484
607
  className: "nice-admin-settings__color"
485
608
  }
486
609
  );
@@ -489,9 +612,9 @@ const z = I(
489
612
  "input",
490
613
  {
491
614
  type: "password",
492
- value: String(l ?? ""),
493
- onChange: (a) => _(n.key, a.target.value),
494
- placeholder: n.placeholder,
615
+ value: String(s ?? ""),
616
+ onChange: (r) => f(a.key, r.target.value),
617
+ placeholder: a.placeholder,
495
618
  className: "nice-admin-settings__input",
496
619
  autoComplete: "new-password"
497
620
  }
@@ -501,151 +624,169 @@ const z = I(
501
624
  "input",
502
625
  {
503
626
  type: "text",
504
- value: String(l ?? ""),
505
- onChange: (a) => _(n.key, a.target.value),
506
- placeholder: n.placeholder,
627
+ value: String(s ?? ""),
628
+ onChange: (r) => f(a.key, r.target.value),
629
+ placeholder: a.placeholder,
507
630
  className: "nice-admin-settings__input"
508
631
  }
509
632
  );
510
633
  }
511
634
  };
512
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-settings ${x ?? ""}`, style: s, children: [
513
- /* @__PURE__ */ e("div", { className: "nice-admin-settings__header", children: /* @__PURE__ */ e("h3", { children: f }) }),
514
- Array.from(S.entries()).map(([n, l]) => /* @__PURE__ */ t("fieldset", { className: "nice-admin-settings__section", children: [
515
- /* @__PURE__ */ e("legend", { children: n }),
516
- l.map((m) => /* @__PURE__ */ t("div", { className: "nice-admin-settings__field", children: [
517
- m.type !== "boolean" && /* @__PURE__ */ t("label", { className: "nice-admin-settings__label", children: [
518
- m.label,
519
- m.required && /* @__PURE__ */ e("span", { className: "nice-admin-settings__required", children: "*" })
635
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-admin-settings ${C ?? ""}`, style: c, children: [
636
+ /* @__PURE__ */ e("div", { className: "nice-admin-settings__header", children: /* @__PURE__ */ e("h3", { children: k }) }),
637
+ Array.from(x.entries()).map(([a, s]) => /* @__PURE__ */ n("fieldset", { className: "nice-admin-settings__section", children: [
638
+ /* @__PURE__ */ e("legend", { children: a }),
639
+ s.map((d) => /* @__PURE__ */ n("div", { className: "nice-admin-settings__field", children: [
640
+ d.type !== "boolean" && /* @__PURE__ */ n("label", { className: "nice-admin-settings__label", children: [
641
+ d.label,
642
+ d.required && /* @__PURE__ */ e("span", { className: "nice-admin-settings__required", children: "*" })
520
643
  ] }),
521
- m.description && /* @__PURE__ */ e("p", { className: "nice-admin-settings__description", children: m.description }),
522
- c(m)
523
- ] }, m.key))
524
- ] }, n)),
525
- /* @__PURE__ */ t("div", { className: "nice-admin-settings__actions", children: [
526
- /* @__PURE__ */ e("button", { className: "nice-admin-settings__save-btn", onClick: y, disabled: p, children: p ? "Saving…" : "Save Settings" }),
527
- b && /* @__PURE__ */ e("button", { className: "nice-admin-settings__reset-btn", onClick: b, children: "Reset to Defaults" })
644
+ d.description && /* @__PURE__ */ e("p", { className: "nice-admin-settings__description", children: d.description }),
645
+ v(d)
646
+ ] }, d.key))
647
+ ] }, a)),
648
+ /* @__PURE__ */ n("div", { className: "nice-admin-settings__actions", children: [
649
+ /* @__PURE__ */ e("button", { className: "nice-admin-settings__save-btn", onClick: N, disabled: l, children: l ? "Saving…" : "Save Settings" }),
650
+ p && /* @__PURE__ */ e("button", { className: "nice-admin-settings__reset-btn", onClick: p, children: "Reset to Defaults" })
528
651
  ] })
529
652
  ] });
530
653
  }
531
- ), ee = I(
532
- function(v, g) {
654
+ ), de = $(
655
+ function(u, _) {
533
656
  const {
534
- notifications: u,
535
- availableChannels: C = ["email", "push", "sms", "in-app", "webhook"],
536
- onToggle: N,
537
- onEdit: b,
538
- onTest: p,
539
- onCreate: f,
540
- onDelete: x,
541
- title: s = "Notification Management",
542
- className: w,
543
- style: L
544
- } = v, [_, y] = k(""), S = $(() => {
545
- if (!_.trim())
546
- return u;
547
- const c = _.toLowerCase();
548
- return u.filter(
549
- (n) => {
550
- var l;
551
- return n.name.toLowerCase().includes(c) || n.event.toLowerCase().includes(c) || ((l = n.description) == null ? void 0 : l.toLowerCase().includes(c));
552
- }
553
- );
554
- }, [u, _]);
555
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-admin-notifications ${w ?? ""}`, style: L, children: [
556
- /* @__PURE__ */ t("div", { className: "nice-admin-notifications__header", children: [
557
- /* @__PURE__ */ e("h3", { children: s }),
558
- f && /* @__PURE__ */ e("button", { onClick: f, children: "+ New Notification" })
559
- ] }),
560
- /* @__PURE__ */ e(
561
- "input",
657
+ notifications: m,
658
+ availableChannels: y = ["email", "push", "sms", "in-app", "webhook"],
659
+ onToggle: g,
660
+ onEdit: p,
661
+ onTest: l,
662
+ onCreate: k,
663
+ onDelete: C,
664
+ title: c,
665
+ className: S,
666
+ style: T
667
+ } = u, f = D(() => {
668
+ const x = [
562
669
  {
563
- type: "text",
564
- value: _,
565
- onChange: (c) => y(c.target.value),
566
- placeholder: "Search notifications…",
567
- className: "nice-admin-notifications__search"
568
- }
569
- ),
570
- S.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-admin-notifications__empty", children: "No notifications found." }) : /* @__PURE__ */ t("table", { className: "nice-admin-notifications__table", children: [
571
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
572
- /* @__PURE__ */ e("th", { children: "Enabled" }),
573
- /* @__PURE__ */ e("th", { children: "Name" }),
574
- /* @__PURE__ */ e("th", { children: "Event" }),
575
- /* @__PURE__ */ e("th", { children: "Channels" }),
576
- /* @__PURE__ */ e("th", { children: "Last Sent" }),
577
- /* @__PURE__ */ e("th", { children: "Sent" }),
578
- /* @__PURE__ */ e("th", { children: "Actions" })
579
- ] }) }),
580
- /* @__PURE__ */ e("tbody", { children: S.map((c) => /* @__PURE__ */ t("tr", { children: [
581
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
670
+ field: "enabled",
671
+ header: "Enabled",
672
+ align: "center",
673
+ width: 90,
674
+ sortable: !0,
675
+ render: (v, a) => /* @__PURE__ */ e(
582
676
  "input",
583
677
  {
584
678
  type: "checkbox",
585
- checked: c.enabled,
586
- onChange: () => N == null ? void 0 : N(c.id, !c.enabled)
679
+ checked: a.enabled,
680
+ onChange: () => g == null ? void 0 : g(a.id, !a.enabled),
681
+ "aria-label": `Toggle ${a.name}`
587
682
  }
588
- ) }),
589
- /* @__PURE__ */ t("td", { children: [
590
- /* @__PURE__ */ e("strong", { children: c.name }),
591
- c.description && /* @__PURE__ */ e("br", {}),
592
- c.description && /* @__PURE__ */ e("small", { children: c.description })
593
- ] }),
594
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: c.event }) }),
595
- /* @__PURE__ */ e("td", { children: c.channels.join(", ") }),
596
- /* @__PURE__ */ e("td", { children: c.lastSentAt ?? "—" }),
597
- /* @__PURE__ */ e("td", { children: c.sentCount ?? 0 }),
598
- /* @__PURE__ */ t("td", { className: "nice-admin-notifications__actions", children: [
599
- b && /* @__PURE__ */ e("button", { onClick: () => b(c), children: "Edit" }),
600
- p && /* @__PURE__ */ e("button", { onClick: () => p(c.id), children: "Test" }),
601
- x && /* @__PURE__ */ e("button", { onClick: () => x(c.id), children: "Delete" })
683
+ )
684
+ },
685
+ {
686
+ field: "name",
687
+ header: "Name",
688
+ sortable: !0,
689
+ render: (v, a) => /* @__PURE__ */ n("div", { className: "nice-admin-notifications__name", children: [
690
+ /* @__PURE__ */ e("strong", { children: a.name }),
691
+ a.description && /* @__PURE__ */ e("small", { className: "nice-admin-notifications__description", children: a.description })
602
692
  ] })
603
- ] }, c.id)) })
604
- ] })
693
+ },
694
+ {
695
+ field: "event",
696
+ header: "Event",
697
+ sortable: !0,
698
+ render: (v, a) => /* @__PURE__ */ e("code", { children: a.event })
699
+ },
700
+ {
701
+ field: "channels",
702
+ header: "Channels",
703
+ render: (v, a) => a.channels.join(", ")
704
+ },
705
+ {
706
+ field: "lastSentAt",
707
+ header: "Last Sent",
708
+ sortable: !0,
709
+ render: (v, a) => a.lastSentAt ?? "—"
710
+ },
711
+ {
712
+ field: "sentCount",
713
+ header: "Sent",
714
+ align: "right",
715
+ dataType: "number",
716
+ sortable: !0,
717
+ render: (v, a) => a.sentCount ?? 0
718
+ }
719
+ ];
720
+ return (p || l || C) && x.push({
721
+ field: "__actions",
722
+ header: "Actions",
723
+ align: "right",
724
+ sortable: !1,
725
+ render: (v, a) => /* @__PURE__ */ n("div", { className: "nice-admin-notifications__actions", children: [
726
+ p && /* @__PURE__ */ e("button", { type: "button", onClick: () => p(a), children: "Edit" }),
727
+ l && /* @__PURE__ */ e("button", { type: "button", onClick: () => l(a.id), children: "Test" }),
728
+ C && /* @__PURE__ */ e("button", { type: "button", onClick: () => C(a.id), children: "Delete" })
729
+ ] })
730
+ }), x;
731
+ }, [g, p, l, C]), N = k ? /* @__PURE__ */ e("button", { type: "button", onClick: k, className: "nice-admin-notifications__create", children: "New Notification" }) : void 0;
732
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-admin-notifications ${S ?? ""}`, style: T, children: [
733
+ c && /* @__PURE__ */ e("div", { className: "nice-admin-notifications__header", children: /* @__PURE__ */ e("h3", { children: c }) }),
734
+ /* @__PURE__ */ e(
735
+ P,
736
+ {
737
+ data: m,
738
+ columns: f,
739
+ keyField: "id",
740
+ searchable: !0,
741
+ striped: !0,
742
+ emptyText: "No notifications found.",
743
+ toolbar: N
744
+ }
745
+ )
605
746
  ] });
606
747
  }
607
- ), te = I(
608
- function(v, g) {
748
+ ), oe = $(
749
+ function(u, _) {
609
750
  const {
610
- flags: u,
611
- environmentNames: C = ["development", "staging", "production"],
612
- onToggle: N,
613
- onPercentageChange: b,
614
- onCreate: p,
615
- onDelete: f,
616
- onEdit: x,
617
- title: s = "Feature Flags",
618
- className: w,
619
- style: L
620
- } = v, [_, y] = k(""), [S, c] = k(!1), [n, l] = k(""), [m, a] = k(""), [o, R] = k(""), T = $(() => {
621
- if (!_.trim())
622
- return u;
623
- const d = _.toLowerCase();
624
- return u.filter(
625
- (i) => {
626
- var A, F;
627
- return i.key.toLowerCase().includes(d) || i.name.toLowerCase().includes(d) || ((A = i.description) == null ? void 0 : A.toLowerCase().includes(d)) || ((F = i.tags) == null ? void 0 : F.some((D) => D.toLowerCase().includes(d)));
751
+ flags: m,
752
+ environmentNames: y = ["development", "staging", "production"],
753
+ onToggle: g,
754
+ onPercentageChange: p,
755
+ onCreate: l,
756
+ onDelete: k,
757
+ onEdit: C,
758
+ title: c = "Feature Flags",
759
+ className: S,
760
+ style: T
761
+ } = u, [f, N] = A(""), [x, v] = A(!1), [a, s] = A(""), [d, r] = A(""), [h, b] = A(""), w = D(() => {
762
+ if (!f.trim())
763
+ return m;
764
+ const i = f.toLowerCase();
765
+ return m.filter(
766
+ (t) => {
767
+ var E, R;
768
+ return t.key.toLowerCase().includes(i) || t.name.toLowerCase().includes(i) || ((E = t.description) == null ? void 0 : E.toLowerCase().includes(i)) || ((R = t.tags) == null ? void 0 : R.some((I) => I.toLowerCase().includes(i)));
628
769
  }
629
770
  );
630
- }, [u, _]), h = U(() => {
631
- !n.trim() || !m.trim() || !p || (p(n.trim(), m.trim(), o.trim()), l(""), a(""), R(""), c(!1));
632
- }, [n, m, o, p]), r = (d, i) => d.environments.find((A) => A.name === i);
633
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-feature-flags ${w ?? ""}`, style: L, children: [
634
- /* @__PURE__ */ t("div", { className: "nice-feature-flags__header", children: [
635
- /* @__PURE__ */ e("h3", { children: s }),
636
- /* @__PURE__ */ t("span", { className: "nice-feature-flags__count", children: [
637
- u.length,
771
+ }, [m, f]), o = U(() => {
772
+ !a.trim() || !d.trim() || !l || (l(a.trim(), d.trim(), h.trim()), s(""), r(""), b(""), v(!1));
773
+ }, [a, d, h, l]), L = (i, t) => i.environments.find((E) => E.name === t);
774
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-feature-flags ${S ?? ""}`, style: T, children: [
775
+ /* @__PURE__ */ n("div", { className: "nice-feature-flags__header", children: [
776
+ /* @__PURE__ */ e("h3", { children: c }),
777
+ /* @__PURE__ */ n("span", { className: "nice-feature-flags__count", children: [
778
+ m.length,
638
779
  " flags"
639
780
  ] }),
640
- p && /* @__PURE__ */ e("button", { onClick: () => c(!S), children: "+ New Flag" })
781
+ l && /* @__PURE__ */ e("button", { onClick: () => v(!x), children: "+ New Flag" })
641
782
  ] }),
642
- S && /* @__PURE__ */ t("div", { className: "nice-feature-flags__create-form", children: [
783
+ x && /* @__PURE__ */ n("div", { className: "nice-feature-flags__create-form", children: [
643
784
  /* @__PURE__ */ e(
644
785
  "input",
645
786
  {
646
787
  type: "text",
647
- value: n,
648
- onChange: (d) => l(d.target.value),
788
+ value: a,
789
+ onChange: (i) => s(i.target.value),
649
790
  placeholder: "flag_key"
650
791
  }
651
792
  ),
@@ -653,8 +794,8 @@ const z = I(
653
794
  "input",
654
795
  {
655
796
  type: "text",
656
- value: m,
657
- onChange: (d) => a(d.target.value),
797
+ value: d,
798
+ onChange: (i) => r(i.target.value),
658
799
  placeholder: "Display name"
659
800
  }
660
801
  ),
@@ -662,158 +803,158 @@ const z = I(
662
803
  "input",
663
804
  {
664
805
  type: "text",
665
- value: o,
666
- onChange: (d) => R(d.target.value),
806
+ value: h,
807
+ onChange: (i) => b(i.target.value),
667
808
  placeholder: "Description"
668
809
  }
669
810
  ),
670
- /* @__PURE__ */ e("button", { onClick: h, disabled: !n.trim() || !m.trim(), children: "Create" }),
671
- /* @__PURE__ */ e("button", { onClick: () => c(!1), children: "Cancel" })
811
+ /* @__PURE__ */ e("button", { onClick: o, disabled: !a.trim() || !d.trim(), children: "Create" }),
812
+ /* @__PURE__ */ e("button", { onClick: () => v(!1), children: "Cancel" })
672
813
  ] }),
673
814
  /* @__PURE__ */ e(
674
815
  "input",
675
816
  {
676
817
  type: "text",
677
- value: _,
678
- onChange: (d) => y(d.target.value),
818
+ value: f,
819
+ onChange: (i) => N(i.target.value),
679
820
  placeholder: "Search flags…",
680
821
  className: "nice-feature-flags__search"
681
822
  }
682
823
  ),
683
- T.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-feature-flags__empty", children: "No feature flags found." }) : /* @__PURE__ */ t("table", { className: "nice-feature-flags__table", children: [
684
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
824
+ w.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-feature-flags__empty", children: "No feature flags found." }) : /* @__PURE__ */ n("table", { className: "nice-feature-flags__table", children: [
825
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
685
826
  /* @__PURE__ */ e("th", { children: "Flag" }),
686
- C.map((d) => /* @__PURE__ */ e("th", { children: d }, d)),
827
+ y.map((i) => /* @__PURE__ */ e("th", { children: i }, i)),
687
828
  /* @__PURE__ */ e("th", { children: "Tags" }),
688
829
  /* @__PURE__ */ e("th", { children: "Updated" }),
689
830
  /* @__PURE__ */ e("th", { children: "Actions" })
690
831
  ] }) }),
691
- /* @__PURE__ */ e("tbody", { children: T.map((d) => {
692
- var i;
693
- return /* @__PURE__ */ t("tr", { children: [
694
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("div", { className: "nice-feature-flags__flag-info", children: [
695
- /* @__PURE__ */ e("strong", { children: d.name }),
696
- /* @__PURE__ */ e("code", { className: "nice-feature-flags__key", children: d.key }),
697
- d.description && /* @__PURE__ */ e("small", { children: d.description })
832
+ /* @__PURE__ */ e("tbody", { children: w.map((i) => {
833
+ var t;
834
+ return /* @__PURE__ */ n("tr", { children: [
835
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ n("div", { className: "nice-feature-flags__flag-info", children: [
836
+ /* @__PURE__ */ e("strong", { children: i.name }),
837
+ /* @__PURE__ */ e("code", { className: "nice-feature-flags__key", children: i.key }),
838
+ i.description && /* @__PURE__ */ e("small", { children: i.description })
698
839
  ] }) }),
699
- C.map((A) => {
700
- const F = r(d, A);
701
- return /* @__PURE__ */ t("td", { className: "nice-feature-flags__env-cell", children: [
840
+ y.map((E) => {
841
+ const R = L(i, E);
842
+ return /* @__PURE__ */ n("td", { className: "nice-feature-flags__env-cell", children: [
702
843
  /* @__PURE__ */ e(
703
844
  "input",
704
845
  {
705
846
  type: "checkbox",
706
- checked: (F == null ? void 0 : F.enabled) ?? !1,
707
- onChange: () => N == null ? void 0 : N(d.id, A, !((F == null ? void 0 : F.enabled) ?? !1))
847
+ checked: (R == null ? void 0 : R.enabled) ?? !1,
848
+ onChange: () => g == null ? void 0 : g(i.id, E, !((R == null ? void 0 : R.enabled) ?? !1))
708
849
  }
709
850
  ),
710
- (F == null ? void 0 : F.percentage) != null && /* @__PURE__ */ e(
851
+ (R == null ? void 0 : R.percentage) != null && /* @__PURE__ */ e(
711
852
  "input",
712
853
  {
713
854
  type: "number",
714
855
  min: 0,
715
856
  max: 100,
716
- value: F.percentage,
717
- onChange: (D) => b == null ? void 0 : b(
718
- d.id,
719
- A,
720
- parseInt(D.target.value, 10) || 0
857
+ value: R.percentage,
858
+ onChange: (I) => p == null ? void 0 : p(
859
+ i.id,
860
+ E,
861
+ parseInt(I.target.value, 10) || 0
721
862
  ),
722
863
  className: "nice-feature-flags__percentage",
723
864
  title: "Rollout %"
724
865
  }
725
866
  )
726
- ] }, A);
867
+ ] }, E);
727
868
  }),
728
- /* @__PURE__ */ e("td", { children: ((i = d.tags) == null ? void 0 : i.join(", ")) || "—" }),
729
- /* @__PURE__ */ e("td", { children: d.updatedAt ?? d.createdAt }),
730
- /* @__PURE__ */ t("td", { className: "nice-feature-flags__actions", children: [
731
- x && /* @__PURE__ */ e("button", { onClick: () => x(d), children: "Edit" }),
732
- f && /* @__PURE__ */ e("button", { onClick: () => f(d.id), children: "Delete" })
869
+ /* @__PURE__ */ e("td", { children: ((t = i.tags) == null ? void 0 : t.join(", ")) || "—" }),
870
+ /* @__PURE__ */ e("td", { children: i.updatedAt ?? i.createdAt }),
871
+ /* @__PURE__ */ n("td", { className: "nice-feature-flags__actions", children: [
872
+ C && /* @__PURE__ */ e("button", { onClick: () => C(i), children: "Edit" }),
873
+ k && /* @__PURE__ */ e("button", { onClick: () => k(i.id), children: "Delete" })
733
874
  ] })
734
- ] }, d.id);
875
+ ] }, i.id);
735
876
  }) })
736
877
  ] })
737
878
  ] });
738
879
  }
739
- ), ne = I(
740
- function(v, g) {
741
- var T;
880
+ ), he = $(
881
+ function(u, _) {
882
+ var w;
742
883
  const {
743
- entities: u,
744
- formats: C = ["json", "csv", "xlsx"],
745
- jobs: N = [],
746
- onImport: b,
747
- onExport: p,
748
- onDownload: f,
749
- title: x = "Import / Export",
750
- className: s,
751
- style: w
752
- } = v, [L, _] = k("export"), [y, S] = k(((T = u[0]) == null ? void 0 : T.id) ?? ""), [c, n] = k(C[0] ?? "json"), [l, m] = k(null), a = U(() => {
753
- !b || !l || !y || (b(y, c, l), m(null));
754
- }, [b, y, c, l]), o = U(() => {
755
- !p || !y || p(y, c);
756
- }, [p, y, c]), R = (h) => {
757
- var r;
758
- m(((r = h.target.files) == null ? void 0 : r[0]) ?? null);
884
+ entities: m,
885
+ formats: y = ["json", "csv", "xlsx"],
886
+ jobs: g = [],
887
+ onImport: p,
888
+ onExport: l,
889
+ onDownload: k,
890
+ title: C = "Import / Export",
891
+ className: c,
892
+ style: S
893
+ } = u, [T, f] = A("export"), [N, x] = A(((w = m[0]) == null ? void 0 : w.id) ?? ""), [v, a] = A(y[0] ?? "json"), [s, d] = A(null), r = U(() => {
894
+ !p || !s || !N || (p(N, v, s), d(null));
895
+ }, [p, N, v, s]), h = U(() => {
896
+ !l || !N || l(N, v);
897
+ }, [l, N, v]), b = (o) => {
898
+ var L;
899
+ d(((L = o.target.files) == null ? void 0 : L[0]) ?? null);
759
900
  };
760
- return /* @__PURE__ */ t("div", { ref: g, className: `nice-import-export ${s ?? ""}`, style: w, children: [
761
- /* @__PURE__ */ e("div", { className: "nice-import-export__header", children: /* @__PURE__ */ e("h3", { children: x }) }),
762
- /* @__PURE__ */ t("div", { className: "nice-import-export__tabs", children: [
901
+ return /* @__PURE__ */ n("div", { ref: _, className: `nice-import-export ${c ?? ""}`, style: S, children: [
902
+ /* @__PURE__ */ e("div", { className: "nice-import-export__header", children: /* @__PURE__ */ e("h3", { children: C }) }),
903
+ /* @__PURE__ */ n("div", { className: "nice-import-export__tabs", children: [
763
904
  /* @__PURE__ */ e(
764
905
  "button",
765
906
  {
766
- className: `nice-import-export__tab ${L === "import" ? "nice-import-export__tab--active" : ""}`,
767
- onClick: () => _("import"),
907
+ className: `nice-import-export__tab ${T === "import" ? "nice-import-export__tab--active" : ""}`,
908
+ onClick: () => f("import"),
768
909
  children: "Import"
769
910
  }
770
911
  ),
771
912
  /* @__PURE__ */ e(
772
913
  "button",
773
914
  {
774
- className: `nice-import-export__tab ${L === "export" ? "nice-import-export__tab--active" : ""}`,
775
- onClick: () => _("export"),
915
+ className: `nice-import-export__tab ${T === "export" ? "nice-import-export__tab--active" : ""}`,
916
+ onClick: () => f("export"),
776
917
  children: "Export"
777
918
  }
778
919
  )
779
920
  ] }),
780
- /* @__PURE__ */ t("div", { className: "nice-import-export__form", children: [
781
- /* @__PURE__ */ t("label", { children: [
921
+ /* @__PURE__ */ n("div", { className: "nice-import-export__form", children: [
922
+ /* @__PURE__ */ n("label", { children: [
782
923
  "Entity",
783
- /* @__PURE__ */ e("select", { value: y, onChange: (h) => S(h.target.value), children: u.map((h) => /* @__PURE__ */ e("option", { value: h.id, children: h.label }, h.id)) })
924
+ /* @__PURE__ */ e("select", { value: N, onChange: (o) => x(o.target.value), children: m.map((o) => /* @__PURE__ */ e("option", { value: o.id, children: o.label }, o.id)) })
784
925
  ] }),
785
- /* @__PURE__ */ t("label", { children: [
926
+ /* @__PURE__ */ n("label", { children: [
786
927
  "Format",
787
928
  /* @__PURE__ */ e(
788
929
  "select",
789
930
  {
790
- value: c,
791
- onChange: (h) => n(h.target.value),
792
- children: C.map((h) => /* @__PURE__ */ e("option", { value: h, children: h.toUpperCase() }, h))
931
+ value: v,
932
+ onChange: (o) => a(o.target.value),
933
+ children: y.map((o) => /* @__PURE__ */ e("option", { value: o, children: o.toUpperCase() }, o))
793
934
  }
794
935
  )
795
936
  ] }),
796
- L === "import" && /* @__PURE__ */ t(G, { children: [
797
- /* @__PURE__ */ t("label", { children: [
937
+ T === "import" && /* @__PURE__ */ n(O, { children: [
938
+ /* @__PURE__ */ n("label", { children: [
798
939
  "File",
799
- /* @__PURE__ */ e("input", { type: "file", onChange: R, accept: `.${c}` })
940
+ /* @__PURE__ */ e("input", { type: "file", onChange: b, accept: `.${v}` })
800
941
  ] }),
801
942
  /* @__PURE__ */ e(
802
943
  "button",
803
944
  {
804
945
  className: "nice-import-export__action-btn",
805
- onClick: a,
806
- disabled: !l,
946
+ onClick: r,
947
+ disabled: !s,
807
948
  children: "Start Import"
808
949
  }
809
950
  )
810
951
  ] }),
811
- L === "export" && /* @__PURE__ */ e("button", { className: "nice-import-export__action-btn", onClick: o, children: "Start Export" })
952
+ T === "export" && /* @__PURE__ */ e("button", { className: "nice-import-export__action-btn", onClick: h, children: "Start Export" })
812
953
  ] }),
813
- N.length > 0 && /* @__PURE__ */ t("div", { className: "nice-import-export__jobs", children: [
954
+ g.length > 0 && /* @__PURE__ */ n("div", { className: "nice-import-export__jobs", children: [
814
955
  /* @__PURE__ */ e("h4", { children: "Recent Jobs" }),
815
- /* @__PURE__ */ t("table", { className: "nice-import-export__jobs-table", children: [
816
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
956
+ /* @__PURE__ */ n("table", { className: "nice-import-export__jobs-table", children: [
957
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
817
958
  /* @__PURE__ */ e("th", { children: "Type" }),
818
959
  /* @__PURE__ */ e("th", { children: "Format" }),
819
960
  /* @__PURE__ */ e("th", { children: "Status" }),
@@ -822,135 +963,135 @@ const z = I(
822
963
  /* @__PURE__ */ e("th", { children: "Created" }),
823
964
  /* @__PURE__ */ e("th", {})
824
965
  ] }) }),
825
- /* @__PURE__ */ e("tbody", { children: N.map((h) => /* @__PURE__ */ t("tr", { children: [
826
- /* @__PURE__ */ e("td", { children: h.type }),
827
- /* @__PURE__ */ e("td", { children: h.format.toUpperCase() }),
966
+ /* @__PURE__ */ e("tbody", { children: g.map((o) => /* @__PURE__ */ n("tr", { children: [
967
+ /* @__PURE__ */ e("td", { children: o.type }),
968
+ /* @__PURE__ */ e("td", { children: o.format.toUpperCase() }),
828
969
  /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
829
970
  "span",
830
971
  {
831
- className: `nice-import-export__status nice-import-export__status--${h.status}`,
832
- children: h.status
972
+ className: `nice-import-export__status nice-import-export__status--${o.status}`,
973
+ children: o.status
833
974
  }
834
975
  ) }),
835
- /* @__PURE__ */ e("td", { children: h.processedRows != null && h.totalRows ? `${h.processedRows} / ${h.totalRows}` : "—" }),
836
- /* @__PURE__ */ e("td", { children: h.errorCount ?? 0 }),
837
- /* @__PURE__ */ e("td", { children: h.createdAt }),
838
- /* @__PURE__ */ e("td", { children: h.type === "export" && h.status === "completed" && f && /* @__PURE__ */ e("button", { onClick: () => f(h.id), children: "Download" }) })
839
- ] }, h.id)) })
976
+ /* @__PURE__ */ e("td", { children: o.processedRows != null && o.totalRows ? `${o.processedRows} / ${o.totalRows}` : "—" }),
977
+ /* @__PURE__ */ e("td", { children: o.errorCount ?? 0 }),
978
+ /* @__PURE__ */ e("td", { children: o.createdAt }),
979
+ /* @__PURE__ */ e("td", { children: o.type === "export" && o.status === "completed" && k && /* @__PURE__ */ e("button", { onClick: () => k(o.id), children: "Download" }) })
980
+ ] }, o.id)) })
840
981
  ] })
841
982
  ] })
842
983
  ] });
843
984
  }
844
- ), q = K({ flags: {} });
845
- function ie({ config: E, children: v }) {
846
- return /* @__PURE__ */ e(q.Provider, { value: E, children: v });
985
+ ), q = Y({ flags: {} });
986
+ function ue({ config: F, children: u }) {
987
+ return /* @__PURE__ */ e(q.Provider, { value: F, children: u });
847
988
  }
848
- function B(E) {
849
- const v = H(q);
850
- return $(() => {
851
- const g = v.flags[E];
852
- return g === void 0 ? { enabled: !1 } : typeof g == "boolean" ? { enabled: g } : { enabled: g > 0, percentage: g };
853
- }, [v.flags, E]);
989
+ function ee(F) {
990
+ const u = V(q);
991
+ return D(() => {
992
+ const _ = u.flags[F];
993
+ return _ === void 0 ? { enabled: !1 } : typeof _ == "boolean" ? { enabled: _ } : { enabled: _ > 0, percentage: _ };
994
+ }, [u.flags, F]);
854
995
  }
855
- function ae({ flag: E, fallback: v = null, children: g }) {
856
- const { enabled: u } = B(E);
857
- return /* @__PURE__ */ e(G, { children: u ? g : v });
996
+ function me({ flag: F, fallback: u = null, children: _ }) {
997
+ const { enabled: m } = ee(F);
998
+ return /* @__PURE__ */ e(O, { children: m ? _ : u });
858
999
  }
859
1000
  const M = {
860
1001
  low: "#2196f3",
861
1002
  medium: "#ff9800",
862
1003
  high: "#f44336",
863
1004
  critical: "#9c27b0"
864
- }, O = {
1005
+ }, H = {
865
1006
  field: "Hidden Field",
866
1007
  endpoint: "Decoy Endpoint",
867
1008
  file: "Canary File",
868
1009
  credential: "Fake Credential",
869
1010
  cookie: "Tracking Cookie"
870
- }, ce = I(
1011
+ }, pe = $(
871
1012
  function({
872
- tokens: v,
873
- events: g,
874
- onCreate: u,
875
- onToggle: C,
876
- onDelete: N,
877
- onDismissEvent: b,
878
- title: p = "Honey Tokens",
879
- className: f,
880
- style: x
881
- }, s) {
882
- const [w, L] = k(""), [_, y] = k(!1), [S, c] = k(""), [n, l] = k("field"), [m, a] = k("medium"), [o, R] = k(""), T = $(
883
- () => v.filter(
884
- (i) => i.name.toLowerCase().includes(w.toLowerCase()) || i.location.toLowerCase().includes(w.toLowerCase())
1013
+ tokens: u,
1014
+ events: _,
1015
+ onCreate: m,
1016
+ onToggle: y,
1017
+ onDelete: g,
1018
+ onDismissEvent: p,
1019
+ title: l = "Honey Tokens",
1020
+ className: k,
1021
+ style: C
1022
+ }, c) {
1023
+ const [S, T] = A(""), [f, N] = A(!1), [x, v] = A(""), [a, s] = A("field"), [d, r] = A("medium"), [h, b] = A(""), w = D(
1024
+ () => u.filter(
1025
+ (t) => t.name.toLowerCase().includes(S.toLowerCase()) || t.location.toLowerCase().includes(S.toLowerCase())
885
1026
  ),
886
- [v, w]
887
- ), h = $(
888
- () => [...g].sort((i, A) => new Date(A.timestamp).getTime() - new Date(i.timestamp).getTime()),
889
- [g]
890
- ), r = $(() => {
891
- const i = v.filter((D) => D.active).length, A = v.reduce((D, P) => D + P.tripCount, 0), F = g.filter((D) => D.severity === "critical").length;
892
- return { activeCount: i, totalCount: v.length, totalTrips: A, criticalEvents: F };
893
- }, [v, g]), d = () => {
894
- S.trim() && o.trim() && u && (u(S.trim(), n, m, o.trim()), c(""), R(""), y(!1));
1027
+ [u, S]
1028
+ ), o = D(
1029
+ () => [..._].sort((t, E) => new Date(E.timestamp).getTime() - new Date(t.timestamp).getTime()),
1030
+ [_]
1031
+ ), L = D(() => {
1032
+ const t = u.filter((I) => I.active).length, E = u.reduce((I, B) => I + B.tripCount, 0), R = _.filter((I) => I.severity === "critical").length;
1033
+ return { activeCount: t, totalCount: u.length, totalTrips: E, criticalEvents: R };
1034
+ }, [u, _]), i = () => {
1035
+ x.trim() && h.trim() && m && (m(x.trim(), a, d, h.trim()), v(""), b(""), N(!1));
895
1036
  };
896
- return /* @__PURE__ */ t(
1037
+ return /* @__PURE__ */ n(
897
1038
  "div",
898
1039
  {
899
- ref: s,
900
- className: `nice-honey-token-dashboard${f ? ` ${f}` : ""}`,
901
- style: x,
1040
+ ref: c,
1041
+ className: `nice-honey-token-dashboard${k ? ` ${k}` : ""}`,
1042
+ style: C,
902
1043
  children: [
903
- /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__header", children: [
904
- /* @__PURE__ */ e("h2", { children: p }),
905
- /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__stats", children: [
906
- /* @__PURE__ */ t("span", { className: "nice-honey-token-dashboard__stat", children: [
1044
+ /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__header", children: [
1045
+ /* @__PURE__ */ e("h2", { children: l }),
1046
+ /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__stats", children: [
1047
+ /* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat", children: [
907
1048
  "Active: ",
908
- r.activeCount,
1049
+ L.activeCount,
909
1050
  "/",
910
- r.totalCount
1051
+ L.totalCount
911
1052
  ] }),
912
- /* @__PURE__ */ t("span", { className: "nice-honey-token-dashboard__stat", children: [
1053
+ /* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat", children: [
913
1054
  "Trips: ",
914
- r.totalTrips
1055
+ L.totalTrips
915
1056
  ] }),
916
- r.criticalEvents > 0 && /* @__PURE__ */ t("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: [
1057
+ L.criticalEvents > 0 && /* @__PURE__ */ n("span", { className: "nice-honey-token-dashboard__stat nice-honey-token-dashboard__stat--critical", children: [
917
1058
  "Critical: ",
918
- r.criticalEvents
1059
+ L.criticalEvents
919
1060
  ] })
920
1061
  ] })
921
1062
  ] }),
922
- /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__toolbar", children: [
1063
+ /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__toolbar", children: [
923
1064
  /* @__PURE__ */ e(
924
1065
  "input",
925
1066
  {
926
1067
  type: "text",
927
1068
  className: "nice-honey-token-dashboard__search",
928
1069
  placeholder: "Search tokens...",
929
- value: w,
930
- onChange: (i) => L(i.target.value)
1070
+ value: S,
1071
+ onChange: (t) => T(t.target.value)
931
1072
  }
932
1073
  ),
933
- u && /* @__PURE__ */ e(
1074
+ m && /* @__PURE__ */ e(
934
1075
  "button",
935
1076
  {
936
1077
  className: "nice-honey-token-dashboard__btn",
937
- onClick: () => y(!_),
938
- children: _ ? "Cancel" : "+ New Token"
1078
+ onClick: () => N(!f),
1079
+ children: f ? "Cancel" : "+ New Token"
939
1080
  }
940
1081
  )
941
1082
  ] }),
942
- _ && /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__create", children: [
1083
+ f && /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__create", children: [
943
1084
  /* @__PURE__ */ e(
944
1085
  "input",
945
1086
  {
946
1087
  type: "text",
947
1088
  placeholder: "Token name",
948
- value: S,
949
- onChange: (i) => c(i.target.value)
1089
+ value: x,
1090
+ onChange: (t) => v(t.target.value)
950
1091
  }
951
1092
  ),
952
- /* @__PURE__ */ e("select", { value: n, onChange: (i) => l(i.target.value), children: Object.entries(O).map(([i, A]) => /* @__PURE__ */ e("option", { value: i, children: A }, i)) }),
953
- /* @__PURE__ */ t("select", { value: m, onChange: (i) => a(i.target.value), children: [
1093
+ /* @__PURE__ */ e("select", { value: a, onChange: (t) => s(t.target.value), children: Object.entries(H).map(([t, E]) => /* @__PURE__ */ e("option", { value: t, children: E }, t)) }),
1094
+ /* @__PURE__ */ n("select", { value: d, onChange: (t) => r(t.target.value), children: [
954
1095
  /* @__PURE__ */ e("option", { value: "low", children: "Low" }),
955
1096
  /* @__PURE__ */ e("option", { value: "medium", children: "Medium" }),
956
1097
  /* @__PURE__ */ e("option", { value: "high", children: "High" }),
@@ -961,20 +1102,20 @@ const M = {
961
1102
  {
962
1103
  type: "text",
963
1104
  placeholder: "Location (e.g. /api/admin/secret)",
964
- value: o,
965
- onChange: (i) => R(i.target.value)
1105
+ value: h,
1106
+ onChange: (t) => b(t.target.value)
966
1107
  }
967
1108
  ),
968
- /* @__PURE__ */ e("button", { onClick: d, children: "Create" })
1109
+ /* @__PURE__ */ e("button", { onClick: i, children: "Create" })
969
1110
  ] }),
970
- /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__tokens", children: [
971
- /* @__PURE__ */ t("h3", { children: [
1111
+ /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__tokens", children: [
1112
+ /* @__PURE__ */ n("h3", { children: [
972
1113
  "Tokens (",
973
- T.length,
1114
+ w.length,
974
1115
  ")"
975
1116
  ] }),
976
- /* @__PURE__ */ t("table", { className: "nice-honey-token-dashboard__table", children: [
977
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
1117
+ /* @__PURE__ */ n("table", { className: "nice-honey-token-dashboard__table", children: [
1118
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
978
1119
  /* @__PURE__ */ e("th", { children: "Name" }),
979
1120
  /* @__PURE__ */ e("th", { children: "Type" }),
980
1121
  /* @__PURE__ */ e("th", { children: "Severity" }),
@@ -984,73 +1125,73 @@ const M = {
984
1125
  /* @__PURE__ */ e("th", { children: "Status" }),
985
1126
  /* @__PURE__ */ e("th", { children: "Actions" })
986
1127
  ] }) }),
987
- /* @__PURE__ */ e("tbody", { children: T.map((i) => /* @__PURE__ */ t("tr", { className: i.tripCount > 0 ? "nice-honey-token-dashboard__row--tripped" : "", children: [
988
- /* @__PURE__ */ e("td", { children: i.name }),
989
- /* @__PURE__ */ e("td", { children: O[i.type] }),
1128
+ /* @__PURE__ */ e("tbody", { children: w.map((t) => /* @__PURE__ */ n("tr", { className: t.tripCount > 0 ? "nice-honey-token-dashboard__row--tripped" : "", children: [
1129
+ /* @__PURE__ */ e("td", { children: t.name }),
1130
+ /* @__PURE__ */ e("td", { children: H[t.type] }),
990
1131
  /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
991
1132
  "span",
992
1133
  {
993
1134
  className: "nice-honey-token-dashboard__severity",
994
- style: { color: M[i.severity] },
995
- children: i.severity
1135
+ style: { color: M[t.severity] },
1136
+ children: t.severity
996
1137
  }
997
1138
  ) }),
998
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: i.location }) }),
999
- /* @__PURE__ */ e("td", { children: i.tripCount }),
1000
- /* @__PURE__ */ e("td", { children: i.lastTripped ?? "—" }),
1001
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `nice-honey-token-dashboard__status--${i.active ? "active" : "inactive"}`, children: i.active ? "Active" : "Inactive" }) }),
1002
- /* @__PURE__ */ t("td", { children: [
1003
- C && /* @__PURE__ */ e("button", { onClick: () => C(i.id, !i.active), children: i.active ? "Disable" : "Enable" }),
1004
- N && /* @__PURE__ */ e("button", { onClick: () => N(i.id), children: "Delete" })
1139
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: t.location }) }),
1140
+ /* @__PURE__ */ e("td", { children: t.tripCount }),
1141
+ /* @__PURE__ */ e("td", { children: t.lastTripped ?? "—" }),
1142
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `nice-honey-token-dashboard__status--${t.active ? "active" : "inactive"}`, children: t.active ? "Active" : "Inactive" }) }),
1143
+ /* @__PURE__ */ n("td", { children: [
1144
+ y && /* @__PURE__ */ e("button", { onClick: () => y(t.id, !t.active), children: t.active ? "Disable" : "Enable" }),
1145
+ g && /* @__PURE__ */ e("button", { onClick: () => g(t.id), children: "Delete" })
1005
1146
  ] })
1006
- ] }, i.id)) })
1147
+ ] }, t.id)) })
1007
1148
  ] })
1008
1149
  ] }),
1009
- h.length > 0 && /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__events", children: [
1010
- /* @__PURE__ */ t("h3", { children: [
1150
+ o.length > 0 && /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__events", children: [
1151
+ /* @__PURE__ */ n("h3", { children: [
1011
1152
  "Recent Events (",
1012
- h.length,
1153
+ o.length,
1013
1154
  ")"
1014
1155
  ] }),
1015
- /* @__PURE__ */ e("div", { className: "nice-honey-token-dashboard__event-list", children: h.map((i) => /* @__PURE__ */ t(
1156
+ /* @__PURE__ */ e("div", { className: "nice-honey-token-dashboard__event-list", children: o.map((t) => /* @__PURE__ */ n(
1016
1157
  "div",
1017
1158
  {
1018
- className: `nice-honey-token-dashboard__event nice-honey-token-dashboard__event--${i.severity}`,
1159
+ className: `nice-honey-token-dashboard__event nice-honey-token-dashboard__event--${t.severity}`,
1019
1160
  children: [
1020
- /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__event-header", children: [
1021
- /* @__PURE__ */ e("strong", { children: i.tokenName }),
1161
+ /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__event-header", children: [
1162
+ /* @__PURE__ */ e("strong", { children: t.tokenName }),
1022
1163
  /* @__PURE__ */ e(
1023
1164
  "span",
1024
1165
  {
1025
1166
  className: "nice-honey-token-dashboard__severity",
1026
- style: { color: M[i.severity] },
1027
- children: i.severity
1167
+ style: { color: M[t.severity] },
1168
+ children: t.severity
1028
1169
  }
1029
1170
  ),
1030
- /* @__PURE__ */ e("time", { children: i.timestamp })
1171
+ /* @__PURE__ */ e("time", { children: t.timestamp })
1031
1172
  ] }),
1032
- /* @__PURE__ */ t("div", { className: "nice-honey-token-dashboard__event-details", children: [
1033
- /* @__PURE__ */ t("span", { children: [
1173
+ /* @__PURE__ */ n("div", { className: "nice-honey-token-dashboard__event-details", children: [
1174
+ /* @__PURE__ */ n("span", { children: [
1034
1175
  "IP: ",
1035
- i.sourceIp
1176
+ t.sourceIp
1036
1177
  ] }),
1037
- i.userId && /* @__PURE__ */ t("span", { children: [
1178
+ t.userId && /* @__PURE__ */ n("span", { children: [
1038
1179
  "User: ",
1039
- i.userId
1180
+ t.userId
1040
1181
  ] }),
1041
- i.details && /* @__PURE__ */ e("span", { children: i.details })
1182
+ t.details && /* @__PURE__ */ e("span", { children: t.details })
1042
1183
  ] }),
1043
- b && /* @__PURE__ */ e(
1184
+ p && /* @__PURE__ */ e(
1044
1185
  "button",
1045
1186
  {
1046
1187
  className: "nice-honey-token-dashboard__dismiss",
1047
- onClick: () => b(i.id),
1188
+ onClick: () => p(t.id),
1048
1189
  children: "Dismiss"
1049
1190
  }
1050
1191
  )
1051
1192
  ]
1052
1193
  },
1053
- i.id
1194
+ t.id
1054
1195
  )) })
1055
1196
  ] })
1056
1197
  ]
@@ -1059,17 +1200,17 @@ const M = {
1059
1200
  }
1060
1201
  );
1061
1202
  export {
1062
- ae as FeatureGate,
1063
- Z as NiceAdminAuditLog,
1064
- z as NiceAdminDashboard,
1065
- ee as NiceAdminNotifications,
1066
- X as NiceAdminRoles,
1067
- j as NiceAdminSettings,
1068
- Q as NiceAdminUsers,
1069
- te as NiceFeatureFlags,
1070
- ae as NiceFeatureGate,
1071
- ie as NiceFeatureGateProvider,
1072
- ce as NiceHoneyTokenDashboard,
1073
- ne as NiceImportExport,
1074
- B as useFeatureGate
1203
+ me as FeatureGate,
1204
+ le as NiceAdminAuditLog,
1205
+ ie as NiceAdminDashboard,
1206
+ de as NiceAdminNotifications,
1207
+ re as NiceAdminRoles,
1208
+ ce as NiceAdminSettings,
1209
+ se as NiceAdminUsers,
1210
+ oe as NiceFeatureFlags,
1211
+ me as NiceFeatureGate,
1212
+ ue as NiceFeatureGateProvider,
1213
+ pe as NiceHoneyTokenDashboard,
1214
+ he as NiceImportExport,
1215
+ ee as useFeatureGate
1075
1216
  };