@webority/ui-react 0.35.2 → 0.37.0
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.
|
@@ -8,15 +8,15 @@ import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
|
8
8
|
import { KANBAN_SUMMARY_FORMATS as f, KANBAN_TEXT as p, KANBAN_TONES as m, kanbanOverflow as ee, kanbanSummaryFormat as h, kanbanVisibleLimit as g, sumKanbanValues as _ } from "@webority/ui-elements/elements/kanban";
|
|
9
9
|
//#region src/components/AppKanban.jsx
|
|
10
10
|
var v = (e) => e.key ?? e.id, y = (e) => e.column, b = ["rupees", "paise"];
|
|
11
|
-
function x({ columns: x = [], cards: S = [], renderCard: C, renderColumnActions: w, getCardKey: T = v, getCardColumn: E = y, getCardValue: D, cardLabel: O, isCardLocked: k, onLocked: A, onMove: j, accept: M, filter: N, boardId: P, ariaLabel:
|
|
11
|
+
function x({ columns: x = [], cards: S = [], renderCard: C, renderColumnActions: w, getCardKey: T = v, getCardColumn: E = y, getCardValue: D, cardLabel: O, isCardLocked: k, onLocked: A, onMove: j, accept: M, filter: N, boardId: P, ariaLabel: te = "Board", emptyText: ne = p.empty, readOnly: re = !1, swipeHint: ie = !1, fill: F = !1, summaryFormat: I, summaryUnit: L, className: R = "", id: z, ...B }) {
|
|
12
12
|
t("AppKanban", B), e("AppKanban", "summaryFormat", I, f), e("AppKanban", "summaryUnit", L, b);
|
|
13
13
|
for (let t of x) e("AppKanban", "columns[].tone", t.tone, m);
|
|
14
|
-
let V = o(), H = z || `kanban-${V.replace(/[^a-zA-Z0-9_-]/g, "")}`, U = c(null), [W, G] = l(() => /* @__PURE__ */ new Map()), [K, q] = l(() => /* @__PURE__ */ new Set()), [J, Y] = l(() => /* @__PURE__ */ new Set()),
|
|
14
|
+
let V = o(), H = z || `kanban-${V.replace(/[^a-zA-Z0-9_-]/g, "")}`, U = c(null), [W, G] = l(() => /* @__PURE__ */ new Map()), [K, q] = l(() => /* @__PURE__ */ new Set()), [J, Y] = l(() => /* @__PURE__ */ new Set()), ae = s(() => new Map(S.map((e) => [String(T(e)), e])), [S, T]), X = c(null);
|
|
15
15
|
X.current = {
|
|
16
16
|
accept: M,
|
|
17
17
|
onMove: j,
|
|
18
18
|
onLocked: A,
|
|
19
|
-
byKey:
|
|
19
|
+
byKey: ae,
|
|
20
20
|
columns: x
|
|
21
21
|
};
|
|
22
22
|
let Z = I && f.includes(I) && (L == null || b.includes(L)) ? h(I, L) : null, Q = s(() => {
|
|
@@ -85,7 +85,7 @@ function x({ columns: x = [], cards: S = [], renderCard: C, renderColumnActions:
|
|
|
85
85
|
e.removeEventListener("wui:kanban:move", t), e.removeEventListener("wui:kanban:locked", n), e.accept = void 0;
|
|
86
86
|
};
|
|
87
87
|
}, []);
|
|
88
|
-
let $ = (e) => !N || N(e) !== !1,
|
|
88
|
+
let $ = (e) => !N || N(e) !== !1, oe = (e, t) => {
|
|
89
89
|
K.has(e) && Y((e) => {
|
|
90
90
|
let n = new Set(e);
|
|
91
91
|
for (let e of t) n.delete(String(T(e)));
|
|
@@ -100,11 +100,12 @@ function x({ columns: x = [], cards: S = [], renderCard: C, renderColumnActions:
|
|
|
100
100
|
id: H,
|
|
101
101
|
class: R ? `wui-kanban ${R}` : "wui-kanban",
|
|
102
102
|
role: "region",
|
|
103
|
-
"aria-label":
|
|
103
|
+
"aria-label": te,
|
|
104
104
|
"board-id": P || void 0,
|
|
105
105
|
"summary-format": Z ? I : void 0,
|
|
106
106
|
"summary-unit": Z && L ? L : void 0,
|
|
107
|
-
readonly:
|
|
107
|
+
readonly: re ? "" : void 0,
|
|
108
|
+
fill: F ? "" : void 0,
|
|
108
109
|
controlled: "",
|
|
109
110
|
...B,
|
|
110
111
|
children: [
|
|
@@ -127,7 +128,7 @@ function x({ columns: x = [], cards: S = [], renderCard: C, renderColumnActions:
|
|
|
127
128
|
})]
|
|
128
129
|
}, e.key))
|
|
129
130
|
}),
|
|
130
|
-
|
|
131
|
+
ie && /* @__PURE__ */ d("p", {
|
|
131
132
|
className: "wui-kanban-hint",
|
|
132
133
|
"aria-hidden": "true",
|
|
133
134
|
children: [/* @__PURE__ */ u(n, {
|
|
@@ -237,14 +238,14 @@ function x({ columns: x = [], cards: S = [], renderCard: C, renderColumnActions:
|
|
|
237
238
|
"aria-controls": `${t}-body`,
|
|
238
239
|
"aria-expanded": c ? "true" : "false",
|
|
239
240
|
hidden: c ? a.length <= s : l.size === 0,
|
|
240
|
-
onClick: () =>
|
|
241
|
+
onClick: () => oe(e.key, r),
|
|
241
242
|
children: c ? p.fewer : p.more(l.size)
|
|
242
243
|
}),
|
|
243
244
|
/* @__PURE__ */ u("p", {
|
|
244
245
|
className: "wui-kanban-empty",
|
|
245
246
|
"data-wui-empty": "",
|
|
246
247
|
hidden: a.length > 0,
|
|
247
|
-
children: e.emptyText ??
|
|
248
|
+
children: e.emptyText ?? ne
|
|
248
249
|
})
|
|
249
250
|
]
|
|
250
251
|
}, e.key);
|
|
@@ -235,34 +235,35 @@ function C({ tab: e, linkComponent: t }) {
|
|
|
235
235
|
children: i
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
|
-
function w({ item: e, linkComponent: t, onNavigate: r,
|
|
239
|
-
let a = Array.isArray(e.children) && e.children.length > 0,
|
|
238
|
+
function w({ item: e, linkComponent: t, onNavigate: r, depth: i = 0 }) {
|
|
239
|
+
let a = i > 0, o = i > 1 ? { "--wui-nav-depth": i } : void 0, c = Array.isArray(e.children) && e.children.length > 0, l = c && e.children.some((e) => e.active), [u, h] = d(l);
|
|
240
240
|
s(() => {
|
|
241
|
-
|
|
242
|
-
}, [
|
|
243
|
-
let
|
|
241
|
+
l && !u && h(!0);
|
|
242
|
+
}, [l, u]);
|
|
243
|
+
let g = typeof e.label == "string" ? e.label : void 0, _ = !a && e.icon && /* @__PURE__ */ p("span", {
|
|
244
244
|
className: "app-nav-icon",
|
|
245
245
|
children: typeof e.icon == "string" ? /* @__PURE__ */ p(n, {
|
|
246
246
|
name: e.icon,
|
|
247
247
|
size: 22
|
|
248
248
|
}) : e.icon
|
|
249
|
-
}),
|
|
249
|
+
}), v = e.badge != null && /* @__PURE__ */ p("span", {
|
|
250
250
|
className: `app-nav-badge${e.badgeTone ? ` tone-${e.badgeTone}` : ""}`,
|
|
251
251
|
children: e.badge
|
|
252
252
|
});
|
|
253
|
-
if (
|
|
253
|
+
if (c) return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
|
|
254
254
|
type: "button",
|
|
255
|
-
className: `app-nav-item has-children${
|
|
256
|
-
|
|
257
|
-
"
|
|
258
|
-
|
|
255
|
+
className: `app-nav-item${a ? " app-nav-subitem" : ""} has-children${l ? " active" : ""}`,
|
|
256
|
+
style: o,
|
|
257
|
+
"aria-expanded": u,
|
|
258
|
+
"data-label": g,
|
|
259
|
+
onClick: () => h((e) => !e),
|
|
259
260
|
children: [
|
|
260
|
-
|
|
261
|
+
_,
|
|
261
262
|
/* @__PURE__ */ p("span", {
|
|
262
263
|
className: "app-nav-text",
|
|
263
264
|
children: e.label
|
|
264
265
|
}),
|
|
265
|
-
|
|
266
|
+
v,
|
|
266
267
|
/* @__PURE__ */ p("span", {
|
|
267
268
|
className: "app-nav-caret",
|
|
268
269
|
children: /* @__PURE__ */ p(n, {
|
|
@@ -272,26 +273,26 @@ function w({ item: e, linkComponent: t, onNavigate: r, sub: i = !1 }) {
|
|
|
272
273
|
})
|
|
273
274
|
]
|
|
274
275
|
}), /* @__PURE__ */ p("div", {
|
|
275
|
-
className: `app-nav-sub${
|
|
276
|
-
inert: !
|
|
277
|
-
"aria-hidden": !
|
|
276
|
+
className: `app-nav-sub${u ? " expanded" : ""}`,
|
|
277
|
+
inert: !u,
|
|
278
|
+
"aria-hidden": !u || void 0,
|
|
278
279
|
children: /* @__PURE__ */ p("div", {
|
|
279
280
|
className: "app-nav-sub-inner",
|
|
280
281
|
children: e.children.map((e) => /* @__PURE__ */ p(w, {
|
|
281
282
|
item: e,
|
|
282
283
|
linkComponent: t,
|
|
283
284
|
onNavigate: r,
|
|
284
|
-
|
|
285
|
+
depth: i + 1
|
|
285
286
|
}, e.key ?? e.href))
|
|
286
287
|
})
|
|
287
288
|
})] });
|
|
288
|
-
let
|
|
289
|
-
|
|
289
|
+
let y = `app-nav-item${a ? " app-nav-subitem" : ""}${e.active ? " active" : ""}`, b = /* @__PURE__ */ m(f, { children: [
|
|
290
|
+
_,
|
|
290
291
|
/* @__PURE__ */ p("span", {
|
|
291
292
|
className: "app-nav-text",
|
|
292
293
|
children: e.label
|
|
293
294
|
}),
|
|
294
|
-
|
|
295
|
+
v,
|
|
295
296
|
e.trailingIcon && /* @__PURE__ */ p("span", {
|
|
296
297
|
className: "app-nav-trailing",
|
|
297
298
|
children: typeof e.trailingIcon == "string" ? /* @__PURE__ */ p(n, {
|
|
@@ -299,21 +300,23 @@ function w({ item: e, linkComponent: t, onNavigate: r, sub: i = !1 }) {
|
|
|
299
300
|
size: 16
|
|
300
301
|
}) : e.trailingIcon
|
|
301
302
|
})
|
|
302
|
-
] }),
|
|
303
|
+
] }), x = e.active ? "page" : void 0;
|
|
303
304
|
return t ? /* @__PURE__ */ p(t, {
|
|
304
|
-
className:
|
|
305
|
+
className: y,
|
|
306
|
+
style: o,
|
|
305
307
|
to: e.href,
|
|
306
|
-
"aria-current":
|
|
307
|
-
"data-label":
|
|
308
|
+
"aria-current": x,
|
|
309
|
+
"data-label": g,
|
|
308
310
|
onClick: r,
|
|
309
|
-
children:
|
|
311
|
+
children: b
|
|
310
312
|
}) : /* @__PURE__ */ p("a", {
|
|
311
|
-
className:
|
|
313
|
+
className: y,
|
|
314
|
+
style: o,
|
|
312
315
|
href: e.href,
|
|
313
|
-
"aria-current":
|
|
314
|
-
"data-label":
|
|
316
|
+
"aria-current": x,
|
|
317
|
+
"data-label": g,
|
|
315
318
|
onClick: r,
|
|
316
|
-
children:
|
|
319
|
+
children: b
|
|
317
320
|
});
|
|
318
321
|
}
|
|
319
322
|
function T() {
|
|
@@ -49,13 +49,18 @@
|
|
|
49
49
|
* @param {string} [props.emptyText='Nothing here'] Text of an empty column.
|
|
50
50
|
* @param {boolean} [props.readOnly=false] No card can move.
|
|
51
51
|
* @param {boolean} [props.swipeHint=false] On phones, a "Swipe sideways or tap a column" line under the switcher.
|
|
52
|
+
* @param {boolean} [props.fill=false] From md up, the board fits the screen: it is the viewport's height
|
|
53
|
+
* less `--wui-kanban-fill-offset` (240px by default; set it on the board for the page around it), and
|
|
54
|
+
* each column's cards scroll inside the column under its fixed head, so a long column never scrolls
|
|
55
|
+
* the page. While a card is carried, a column's list scrolls when the pointer nears its top or
|
|
56
|
+
* bottom. Phones keep the one-column layout, scrolling the page.
|
|
52
57
|
* @param {'number'|'currency'|'compact'} [props.summaryFormat] Each column's summary becomes the sum
|
|
53
58
|
* of its visible cards' `getCardValue`, in this format.
|
|
54
59
|
* @param {'rupees'|'paise'} [props.summaryUnit='rupees'] The unit of the card values.
|
|
55
60
|
* @param {string} [props.className]
|
|
56
61
|
* @param {string} [props.id] The board's id; the column, body and help ids derive from it. Generated when omitted.
|
|
57
62
|
*/
|
|
58
|
-
export default function AppKanban({ columns, cards, renderCard, renderColumnActions, getCardKey, getCardColumn, getCardValue, cardLabel, isCardLocked, onLocked, onMove, accept, filter, boardId, ariaLabel, emptyText, readOnly, swipeHint, summaryFormat, summaryUnit, className, id, ...rest }: {
|
|
63
|
+
export default function AppKanban({ columns, cards, renderCard, renderColumnActions, getCardKey, getCardColumn, getCardValue, cardLabel, isCardLocked, onLocked, onMove, accept, filter, boardId, ariaLabel, emptyText, readOnly, swipeHint, fill, summaryFormat, summaryUnit, className, id, ...rest }: {
|
|
59
64
|
columns: {
|
|
60
65
|
key: string;
|
|
61
66
|
title: string;
|
|
@@ -95,6 +100,7 @@ export default function AppKanban({ columns, cards, renderCard, renderColumnActi
|
|
|
95
100
|
emptyText?: string;
|
|
96
101
|
readOnly?: boolean;
|
|
97
102
|
swipeHint?: boolean;
|
|
103
|
+
fill?: boolean;
|
|
98
104
|
summaryFormat?: 'number' | 'currency' | 'compact';
|
|
99
105
|
summaryUnit?: 'rupees' | 'paise';
|
|
100
106
|
className?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@webority/theme": "0.
|
|
33
|
-
"@webority/ui-elements": "0.
|
|
32
|
+
"@webority/theme": "0.37.0",
|
|
33
|
+
"@webority/ui-elements": "0.37.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@webority/analytics": "^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0",
|