@webority/ui-react 0.31.0 → 0.33.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.
@@ -13,15 +13,19 @@ import "@webority/ui-elements";
13
13
  * that needs a decision first (a reason for a lost deal) opens the product's own AppModal from
14
14
  * `onMove` and settles the promise with the modal's outcome.
15
15
  *
16
- * Below the md breakpoint the board shows one column per screen with a column switcher above it;
17
- * the board scrolls inside itself, so the page never scrolls sideways.
16
+ * Below the md breakpoint the board shows one column per screen with a column switcher above it
17
+ * that stays at the top of the viewport; the board scrolls inside itself, so the page never
18
+ * scrolls sideways.
18
19
  *
19
20
  * @param {object} props
20
21
  * @param {{ key: string, title: string, tone?: 'neutral'|'primary'|'info'|'success'|'warning'|'danger',
21
22
  * href?: string, summary?: import('react').ReactNode | ((cards: object[]) => import('react').ReactNode),
22
- * acceptFrom?: string[], collapsible?: boolean, collapsed?: boolean, emptyText?: string }[]} props.columns
23
+ * acceptFrom?: string[], collapsible?: boolean, collapsed?: boolean, emptyText?: string,
24
+ * visibleLimit?: number }[]} props.columns
23
25
  * The columns, left to right. `acceptFrom` lists the only columns this one takes cards from;
24
26
  * `collapsible` columns fold to a strip, remembered per `boardId`; `collapsed` is the first state.
27
+ * `visibleLimit` shows the first N cards the filter lets through, with "Show N more" for the
28
+ * rest; the count still covers every card, and a card dropped there always shows.
25
29
  * @param {object[]} props.cards Every card on the board.
26
30
  * @param {(card: object) => import('react').ReactNode} props.renderCard The card's content.
27
31
  * @param {(card: object) => string} [props.getCardKey] Default `card.key ?? card.id`.
@@ -29,6 +33,9 @@ import "@webority/ui-elements";
29
33
  * @param {(card: object) => number} [props.getCardValue] The number a computed summary adds up.
30
34
  * @param {(card: object) => string} [props.cardLabel] The card's accessible name, used in announcements.
31
35
  * @param {(card: object) => boolean} [props.isCardLocked] A locked card cannot be moved.
36
+ * @param {(attempt: { card: object, key: string, reason: 'locked'|'readonly' }) => void} [props.onLocked]
37
+ * Someone tried to pick up a card that cannot move (a locked card, or any card on a read-only
38
+ * board); show your own message. Screen readers are told either way.
32
39
  * @param {(move: { card: object, key: string, from: string, to: string, index: number }) => void | Promise<unknown>} [props.onMove]
33
40
  * @param {(card: object, from: string, to: string) => boolean | string} [props.accept] Refuse a move:
34
41
  * false, or a string saying why (shown in the column while the card is carried).
@@ -37,13 +44,14 @@ import "@webority/ui-elements";
37
44
  * @param {string} [props.ariaLabel='Board'] Accessible name of the board region.
38
45
  * @param {string} [props.emptyText='Nothing here'] Text of an empty column.
39
46
  * @param {boolean} [props.readOnly=false] No card can move.
47
+ * @param {boolean} [props.swipeHint=false] On phones, a "Swipe sideways or tap a column" line under the switcher.
40
48
  * @param {'number'|'currency'|'compact'} [props.summaryFormat] Each column's summary becomes the sum
41
49
  * of its visible cards' `getCardValue`, in this format.
42
50
  * @param {'rupees'|'paise'} [props.summaryUnit='rupees'] The unit of the card values.
43
51
  * @param {string} [props.className]
44
52
  * @param {string} [props.id] The board's id; the column, body and help ids derive from it. Generated when omitted.
45
53
  */
46
- export default function AppKanban({ columns, cards, renderCard, getCardKey, getCardColumn, getCardValue, cardLabel, isCardLocked, onMove, accept, filter, boardId, ariaLabel, emptyText, readOnly, summaryFormat, summaryUnit, className, id, ...rest }: {
54
+ export default function AppKanban({ columns, cards, renderCard, getCardKey, getCardColumn, getCardValue, cardLabel, isCardLocked, onLocked, onMove, accept, filter, boardId, ariaLabel, emptyText, readOnly, swipeHint, summaryFormat, summaryUnit, className, id, ...rest }: {
47
55
  columns: {
48
56
  key: string;
49
57
  title: string;
@@ -54,6 +62,7 @@ export default function AppKanban({ columns, cards, renderCard, getCardKey, getC
54
62
  collapsible?: boolean;
55
63
  collapsed?: boolean;
56
64
  emptyText?: string;
65
+ visibleLimit?: number;
57
66
  }[];
58
67
  cards: object[];
59
68
  renderCard: (card: object) => import('react').ReactNode;
@@ -62,6 +71,11 @@ export default function AppKanban({ columns, cards, renderCard, getCardKey, getC
62
71
  getCardValue?: (card: object) => number;
63
72
  cardLabel?: (card: object) => string;
64
73
  isCardLocked?: (card: object) => boolean;
74
+ onLocked?: (attempt: {
75
+ card: object;
76
+ key: string;
77
+ reason: 'locked' | 'readonly';
78
+ }) => void;
65
79
  onMove?: (move: {
66
80
  card: object;
67
81
  key: string;
@@ -75,6 +89,7 @@ export default function AppKanban({ columns, cards, renderCard, getCardKey, getC
75
89
  ariaLabel?: string;
76
90
  emptyText?: string;
77
91
  readOnly?: boolean;
92
+ swipeHint?: boolean;
78
93
  summaryFormat?: 'number' | 'currency' | 'compact';
79
94
  summaryUnit?: 'rupees' | 'paise';
80
95
  className?: string;