@nice2dev/ui 1.4.3 → 1.4.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/CHANGELOG.md +59 -0
- package/dist/{NiceDataGrid-CrKDzMM1.cjs → NiceDataGrid-mrnaLHQk.cjs} +1 -1
- package/dist/{NiceForm-CT9hEXpc.cjs → NiceForm-O3sv-DNX.cjs} +1 -1
- package/dist/NiceMention-tgJKS8PH.cjs +432 -0
- package/dist/NiceSavedQueryPanel-U1-yaw-Q.cjs +587 -0
- package/dist/{NiceScheduler-BZQAKEVF.cjs → NiceScheduler-Boo-D1S-.cjs} +1 -1
- package/dist/{core-lazy-VTd5zfoZ.cjs → core-lazy-C_qnVGxE.cjs} +1 -1
- package/dist/data/NiceTreeGrid.mjs +519 -458
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +20 -1
- package/dist/editors/pickers/NiceDateRangeBox.mjs +258 -227
- package/dist/editors/pickers/NiceDateTimePicker.mjs +403 -388
- package/dist/editors/rich/NiceMarkdownEditor.mjs +2 -1
- package/dist/editors/rich/NiceWiki.mjs +225 -158
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +29 -7
- package/dist/index.cjs +112 -112
- package/dist/index.d.ts +110 -8
- package/dist/index.mjs +716 -713
- package/dist/style.css +2 -2
- package/dist/tools/NiceThemeGalleryPicker.mjs +362 -0
- package/package.json +4 -4
- package/dist/NiceMention-BZEHqPrf.cjs +0 -432
- package/dist/NiceSavedQueryPanel-C5Ab_NWx.cjs +0 -587
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { jsxs as f, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as Q, useControllableState as U, useRovingFocus as j, NiceIcon as Z, themePreviewRoles as ee } from "@nice2dev/ui-core";
|
|
3
|
+
import q, { useState as S, useRef as V } from "react";
|
|
4
|
+
import { NiceModal as te } from "../feedback/NiceModal.mjs";
|
|
5
|
+
import { NICE_THEME_CATALOG_ENTRIES as ae, NICE_THEME_CATALOG as re } from "./themeCatalog.mjs";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const T = (e, y) => ({
|
|
8
|
+
backgroundColor: e,
|
|
9
|
+
backgroundImage: y
|
|
10
|
+
}), ne = ({ roles: e, width: y = 240, label: v }) => {
|
|
11
|
+
const d = y, i = Math.round(d * 0.62), n = Math.round(i * 0.13), s = Math.round(d * 0.24), r = Math.max(4, Math.round(d * 0.035)), a = Math.max(2, Math.round(i * 0.035)), p = Math.round((i - n) * 0.1), u = s + r, M = d - u - r, o = (l) => /* @__PURE__ */ h("span", { style: { position: "absolute", ...l } }), w = n + r * 2 + a * 2, x = Math.round(i * 0.2), _ = Math.round((M - r) / 2), c = w + x + r, k = i - c - r * 2 - a * 3, C = [0.45, 0.7, 0.55, 0.9, 0.65, 0.8], N = Math.round((M - r * 2) / (C.length * 1.6)), R = i - r - a * 3;
|
|
12
|
+
return /* @__PURE__ */ f(
|
|
13
|
+
"span",
|
|
14
|
+
{
|
|
15
|
+
className: "nice-theme-gallery__preview",
|
|
16
|
+
role: "img",
|
|
17
|
+
"aria-label": v,
|
|
18
|
+
style: {
|
|
19
|
+
width: d,
|
|
20
|
+
height: i,
|
|
21
|
+
...T(e.body, e.bodyImage),
|
|
22
|
+
borderColor: e.panelBorder
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
o({ top: 0, left: 0, right: 0, height: n, ...T(e.topNav, e.topNavImage) }),
|
|
26
|
+
o({
|
|
27
|
+
top: Math.round(n * 0.28),
|
|
28
|
+
left: r,
|
|
29
|
+
width: Math.round(n * 0.44),
|
|
30
|
+
height: Math.round(n * 0.44),
|
|
31
|
+
borderRadius: "30%",
|
|
32
|
+
background: e.primary
|
|
33
|
+
}),
|
|
34
|
+
o({
|
|
35
|
+
top: Math.round(n * 0.42),
|
|
36
|
+
left: r + n,
|
|
37
|
+
width: Math.round(d * 0.2),
|
|
38
|
+
height: a,
|
|
39
|
+
borderRadius: a,
|
|
40
|
+
background: e.topNavText,
|
|
41
|
+
opacity: 0.85
|
|
42
|
+
}),
|
|
43
|
+
o({
|
|
44
|
+
top: Math.round(n * 0.22),
|
|
45
|
+
right: r,
|
|
46
|
+
width: Math.round(n * 0.56),
|
|
47
|
+
height: Math.round(n * 0.56),
|
|
48
|
+
borderRadius: "50%",
|
|
49
|
+
background: e.accent
|
|
50
|
+
}),
|
|
51
|
+
o({
|
|
52
|
+
top: n,
|
|
53
|
+
bottom: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
width: s,
|
|
56
|
+
...T(e.sideNav, e.sideNavImage)
|
|
57
|
+
}),
|
|
58
|
+
e.headers.map((l, m) => /* @__PURE__ */ f(q.Fragment, { children: [
|
|
59
|
+
o({ top: n + m * p, left: 0, width: s, height: p, background: l }),
|
|
60
|
+
o({
|
|
61
|
+
top: n + m * p + Math.round((p - a) / 2),
|
|
62
|
+
left: r,
|
|
63
|
+
width: Math.round(s * (0.6 - m * 0.1)),
|
|
64
|
+
height: a,
|
|
65
|
+
borderRadius: a,
|
|
66
|
+
background: e.headerTexts[m] ?? e.sideNavText,
|
|
67
|
+
opacity: 0.8
|
|
68
|
+
})
|
|
69
|
+
] }, m)),
|
|
70
|
+
o({
|
|
71
|
+
top: n + e.headers.length * p + Math.round(p * 0.3),
|
|
72
|
+
left: 0,
|
|
73
|
+
width: s,
|
|
74
|
+
height: p,
|
|
75
|
+
background: e.highlight
|
|
76
|
+
}),
|
|
77
|
+
[0, 1, 2].map(
|
|
78
|
+
(l) => o({
|
|
79
|
+
top: n + (e.headers.length + 1.6 + l) * p + Math.round((p - a) / 2),
|
|
80
|
+
left: r,
|
|
81
|
+
width: Math.round(s * (0.55 - l * 0.08)),
|
|
82
|
+
height: a,
|
|
83
|
+
borderRadius: a,
|
|
84
|
+
background: e.sideNavText,
|
|
85
|
+
opacity: 0.55
|
|
86
|
+
})
|
|
87
|
+
),
|
|
88
|
+
o({
|
|
89
|
+
top: n + r,
|
|
90
|
+
left: u,
|
|
91
|
+
width: Math.round(M * 0.45),
|
|
92
|
+
height: a * 1.6,
|
|
93
|
+
borderRadius: a,
|
|
94
|
+
background: e.text,
|
|
95
|
+
opacity: 0.9
|
|
96
|
+
}),
|
|
97
|
+
[0, 1].map((l) => /* @__PURE__ */ f(q.Fragment, { children: [
|
|
98
|
+
o({
|
|
99
|
+
top: w,
|
|
100
|
+
left: u + l * (_ + r),
|
|
101
|
+
width: _,
|
|
102
|
+
height: x,
|
|
103
|
+
...T(e.panel, e.panelImage),
|
|
104
|
+
border: `1px solid ${e.panelBorder}`,
|
|
105
|
+
borderRadius: Math.max(2, Math.round(d * 0.012))
|
|
106
|
+
}),
|
|
107
|
+
o({
|
|
108
|
+
top: w + Math.round(x * 0.22),
|
|
109
|
+
left: u + l * (_ + r) + r,
|
|
110
|
+
width: Math.round(_ * 0.45),
|
|
111
|
+
height: a,
|
|
112
|
+
borderRadius: a,
|
|
113
|
+
background: e.text,
|
|
114
|
+
opacity: 0.5
|
|
115
|
+
}),
|
|
116
|
+
o({
|
|
117
|
+
top: w + Math.round(x * 0.55),
|
|
118
|
+
left: u + l * (_ + r) + r,
|
|
119
|
+
width: Math.round(_ * 0.6),
|
|
120
|
+
height: a * 2,
|
|
121
|
+
borderRadius: a,
|
|
122
|
+
background: l === 0 ? e.primary : e.accent
|
|
123
|
+
})
|
|
124
|
+
] }, l)),
|
|
125
|
+
o({
|
|
126
|
+
top: c,
|
|
127
|
+
left: u,
|
|
128
|
+
width: M,
|
|
129
|
+
height: k,
|
|
130
|
+
...T(e.panel, e.panelImage),
|
|
131
|
+
border: `1px solid ${e.panelBorder}`,
|
|
132
|
+
borderRadius: Math.max(2, Math.round(d * 0.012))
|
|
133
|
+
}),
|
|
134
|
+
C.map(
|
|
135
|
+
(l, m) => o({
|
|
136
|
+
bottom: i - c - k + r,
|
|
137
|
+
left: u + r + Math.round(m * N * 1.6),
|
|
138
|
+
width: N,
|
|
139
|
+
height: Math.round((k - r * 2) * l),
|
|
140
|
+
borderRadius: `${Math.max(1, Math.round(N * 0.25))}px ${Math.max(1, Math.round(N * 0.25))}px 0 0`,
|
|
141
|
+
background: m % 3 === 2 ? e.accent : e.primary,
|
|
142
|
+
opacity: m % 3 === 1 ? 0.65 : 1
|
|
143
|
+
})
|
|
144
|
+
),
|
|
145
|
+
o({
|
|
146
|
+
top: R,
|
|
147
|
+
left: u,
|
|
148
|
+
width: Math.round(M * 0.3),
|
|
149
|
+
height: a * 3,
|
|
150
|
+
borderRadius: a * 1.5,
|
|
151
|
+
background: e.primary
|
|
152
|
+
}),
|
|
153
|
+
o({
|
|
154
|
+
top: R,
|
|
155
|
+
left: u + Math.round(M * 0.3) + r,
|
|
156
|
+
width: Math.round(M * 0.3),
|
|
157
|
+
height: a * 3,
|
|
158
|
+
borderRadius: a * 1.5,
|
|
159
|
+
border: `1px solid ${e.primary}`,
|
|
160
|
+
boxSizing: "border-box"
|
|
161
|
+
}),
|
|
162
|
+
o({
|
|
163
|
+
top: R + Math.round(a * 0.5),
|
|
164
|
+
right: r,
|
|
165
|
+
width: Math.round(M * 0.18),
|
|
166
|
+
height: a * 2,
|
|
167
|
+
borderRadius: a,
|
|
168
|
+
background: e.accent,
|
|
169
|
+
opacity: 0.85
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}, oe = /* @__PURE__ */ re.map(
|
|
175
|
+
({ id: e, label: y }) => ({ id: e, label: y })
|
|
176
|
+
);
|
|
177
|
+
function le({
|
|
178
|
+
item: e,
|
|
179
|
+
selected: y,
|
|
180
|
+
width: v,
|
|
181
|
+
categoryLabel: d,
|
|
182
|
+
previewLabel: i,
|
|
183
|
+
extra: n,
|
|
184
|
+
className: s,
|
|
185
|
+
onPick: r
|
|
186
|
+
}) {
|
|
187
|
+
const a = ee(e.theme);
|
|
188
|
+
return /* @__PURE__ */ f(
|
|
189
|
+
"button",
|
|
190
|
+
{
|
|
191
|
+
type: "button",
|
|
192
|
+
"aria-pressed": y,
|
|
193
|
+
className: `nice-theme-gallery__card${s ? ` ${s}` : ""}`,
|
|
194
|
+
style: {
|
|
195
|
+
"--nice-tgp-accent": a.primary,
|
|
196
|
+
"--nice-tgp-surface": a.panel,
|
|
197
|
+
"--nice-tgp-text": a.text
|
|
198
|
+
},
|
|
199
|
+
title: e.name,
|
|
200
|
+
onClick: r,
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ h(ne, { roles: a, width: v, label: i }),
|
|
203
|
+
/* @__PURE__ */ f("span", { className: "nice-theme-gallery__footer", children: [
|
|
204
|
+
/* @__PURE__ */ h("span", { className: "nice-theme-gallery__name", children: e.name }),
|
|
205
|
+
d && /* @__PURE__ */ h("span", { className: "nice-theme-gallery__meta", children: d })
|
|
206
|
+
] }),
|
|
207
|
+
n
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
const me = ({
|
|
213
|
+
themes: e = ae,
|
|
214
|
+
categories: y = oe,
|
|
215
|
+
value: v,
|
|
216
|
+
defaultValue: d,
|
|
217
|
+
onChange: i,
|
|
218
|
+
limit: n,
|
|
219
|
+
previewWidth: s = 240,
|
|
220
|
+
searchable: r = !1,
|
|
221
|
+
renderCardExtra: a,
|
|
222
|
+
cardClassName: p,
|
|
223
|
+
className: u,
|
|
224
|
+
style: M,
|
|
225
|
+
id: o,
|
|
226
|
+
title: w,
|
|
227
|
+
label: x,
|
|
228
|
+
"data-testid": _
|
|
229
|
+
}) => {
|
|
230
|
+
const { t: c } = Q(), [k, C] = U({
|
|
231
|
+
value: v,
|
|
232
|
+
defaultValue: d,
|
|
233
|
+
fallbackValue: null,
|
|
234
|
+
componentName: "NiceThemeGalleryPicker"
|
|
235
|
+
}), [N, R] = S(""), [l, m] = S(!1), [A, X] = S(""), [$, D] = S(""), L = V(null), F = V(null);
|
|
236
|
+
j(L, {
|
|
237
|
+
orientation: n ? "horizontal" : "grid",
|
|
238
|
+
itemSelector: ".nice-theme-gallery__card"
|
|
239
|
+
}), j(F, { orientation: "grid", itemSelector: ".nice-theme-gallery__card" });
|
|
240
|
+
const G = x ?? c("themeGallery.title", "Theme gallery"), J = c("pickerCommons.themePreview", "Theme preview"), I = (t) => {
|
|
241
|
+
if (!t)
|
|
242
|
+
return;
|
|
243
|
+
const g = y.find((b) => b.id === t);
|
|
244
|
+
return c(`theme.category.${t}`, g?.label ?? t);
|
|
245
|
+
}, P = (t, g) => {
|
|
246
|
+
const b = g.trim().toLowerCase();
|
|
247
|
+
return !b || t.name.toLowerCase().includes(b) || (I(t.category) ?? "").toLowerCase().includes(b);
|
|
248
|
+
}, H = (() => {
|
|
249
|
+
const t = e.filter((E) => P(E, N));
|
|
250
|
+
if (!n || t.length <= n)
|
|
251
|
+
return t;
|
|
252
|
+
const g = t.slice(0, n), b = t.find((E) => E.name === k);
|
|
253
|
+
return b && !g.includes(b) && (g[g.length - 1] = b), g;
|
|
254
|
+
})(), O = y.filter((t) => e.some((g) => g.category === t.id)), z = e.filter(
|
|
255
|
+
(t) => (!$ || t.category === $) && P(t, A)
|
|
256
|
+
), K = (t) => {
|
|
257
|
+
C(t.name), i?.(t.name, t);
|
|
258
|
+
}, B = (t) => /* @__PURE__ */ h(
|
|
259
|
+
le,
|
|
260
|
+
{
|
|
261
|
+
item: t,
|
|
262
|
+
selected: t.name === k,
|
|
263
|
+
width: s,
|
|
264
|
+
categoryLabel: I(t.category),
|
|
265
|
+
previewLabel: J,
|
|
266
|
+
extra: a?.(t),
|
|
267
|
+
className: p?.(t),
|
|
268
|
+
onPick: () => K(t)
|
|
269
|
+
},
|
|
270
|
+
t.name
|
|
271
|
+
), W = (t, g) => /* @__PURE__ */ h(
|
|
272
|
+
"input",
|
|
273
|
+
{
|
|
274
|
+
type: "search",
|
|
275
|
+
className: "nice-input nice-theme-gallery__search",
|
|
276
|
+
value: t,
|
|
277
|
+
onChange: (b) => g(b.target.value),
|
|
278
|
+
placeholder: c("themeGallery.search", "Search themes…"),
|
|
279
|
+
"aria-label": c("themeGallery.search", "Search themes…")
|
|
280
|
+
}
|
|
281
|
+
), Y = { "--nice-tgp-card-width": `${s + 20}px` };
|
|
282
|
+
return /* @__PURE__ */ f(
|
|
283
|
+
"div",
|
|
284
|
+
{
|
|
285
|
+
id: o,
|
|
286
|
+
className: `nice-theme-gallery${u ? ` ${u}` : ""}`,
|
|
287
|
+
style: { ...Y, ...M },
|
|
288
|
+
title: w,
|
|
289
|
+
"data-testid": _,
|
|
290
|
+
children: [
|
|
291
|
+
r && W(N, R),
|
|
292
|
+
/* @__PURE__ */ h(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
ref: L,
|
|
296
|
+
className: `nice-theme-gallery__grid${n ? " nice-theme-gallery__grid--row" : ""}`,
|
|
297
|
+
role: "group",
|
|
298
|
+
"aria-label": G,
|
|
299
|
+
children: H.map(B)
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
H.length === 0 && /* @__PURE__ */ h("p", { className: "nice-theme-gallery__empty", children: c("themeGallery.empty", "No theme matches the search.") }),
|
|
303
|
+
n !== void 0 && e.length > n && /* @__PURE__ */ f(
|
|
304
|
+
"button",
|
|
305
|
+
{
|
|
306
|
+
type: "button",
|
|
307
|
+
className: "nice-theme-gallery__more",
|
|
308
|
+
onClick: () => m(!0),
|
|
309
|
+
"aria-haspopup": "dialog",
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ h(Z, { name: "grid", size: 14 }),
|
|
312
|
+
" ",
|
|
313
|
+
c("themeGallery.showMore", "Show more"),
|
|
314
|
+
/* @__PURE__ */ h("span", { className: "nice-theme-gallery__count", children: e.length })
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ h(
|
|
319
|
+
te,
|
|
320
|
+
{
|
|
321
|
+
open: l,
|
|
322
|
+
onClose: () => m(!1),
|
|
323
|
+
title: G,
|
|
324
|
+
size: "xl",
|
|
325
|
+
className: "nice-theme-gallery__modal",
|
|
326
|
+
children: /* @__PURE__ */ f("div", { className: "nice-theme-gallery", style: Y, children: [
|
|
327
|
+
/* @__PURE__ */ f("div", { className: "nice-theme-gallery__toolbar", children: [
|
|
328
|
+
W(A, X),
|
|
329
|
+
O.length > 1 && /* @__PURE__ */ h("div", { className: "nice-theme-gallery__tabs", role: "group", "aria-label": G, children: [{ id: "", label: c("themeGallery.all", "All") }, ...O].map((t) => /* @__PURE__ */ h(
|
|
330
|
+
"button",
|
|
331
|
+
{
|
|
332
|
+
type: "button",
|
|
333
|
+
className: "nice-theme-gallery__tab",
|
|
334
|
+
"aria-pressed": $ === t.id,
|
|
335
|
+
onClick: () => D(t.id),
|
|
336
|
+
children: t.id ? I(t.id) : t.label
|
|
337
|
+
},
|
|
338
|
+
t.id
|
|
339
|
+
)) })
|
|
340
|
+
] }),
|
|
341
|
+
/* @__PURE__ */ h(
|
|
342
|
+
"div",
|
|
343
|
+
{
|
|
344
|
+
ref: F,
|
|
345
|
+
className: "nice-theme-gallery__grid",
|
|
346
|
+
role: "group",
|
|
347
|
+
"aria-label": G,
|
|
348
|
+
children: z.map(B)
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
z.length === 0 && /* @__PURE__ */ h("p", { className: "nice-theme-gallery__empty", children: c("themeGallery.empty", "No theme matches the search.") })
|
|
352
|
+
] })
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
};
|
|
359
|
+
export {
|
|
360
|
+
me as NiceThemeGalleryPicker,
|
|
361
|
+
ne as NiceThemeGalleryPreview
|
|
362
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "Nice2Dev UI — Universal, themeable, i18n-ready React component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"react-dom": ">=17.0.0"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@nice2dev/i18n": "^1.4.
|
|
101
|
-
"@nice2dev/ui-core": "^1.4.
|
|
100
|
+
"@nice2dev/i18n": "^1.4.5",
|
|
101
|
+
"@nice2dev/ui-core": "^1.4.5",
|
|
102
102
|
"country-flag-icons": "^1.6.20"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@nice2dev/testing": "^1.4.
|
|
105
|
+
"@nice2dev/testing": "^1.4.5",
|
|
106
106
|
"@playwright/test": "^1.62.1",
|
|
107
107
|
"@testing-library/dom": "^10.4.1",
|
|
108
108
|
"@testing-library/jest-dom": "^7.0.1",
|