@feitio/react 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -23,8 +23,10 @@ export function Saved() {
23
23
  ```
24
24
 
25
25
  - **Behaviors wire themselves.** Menu, Notice, Dialog, Switch, SegmentedControl, TimeInput,
26
- FilterField, ScrollFade, BackToTop and AppShell bring their JavaScript (from `@feitio/vanilla`)
27
- when they mount. Nothing to call.
26
+ FilterField, ScrollFade, BackToTop, AppShell and Kanban bring their JavaScript (from
27
+ `@feitio/vanilla`) when they mount. Nothing to call.
28
+ - **Kanban from state.** Pass each column's `KanbanCard`s in `cards`; `onMove` gets
29
+ `{ id, from, to, index }` (move the card in your state) and `onCreate` gets the column and the text.
28
30
  - **Notices from code.** `const { show, close } = useNotices()`, then `show(element)` with the
29
31
  element a Notice's `ref` points to.
30
32
  - **Feedback from state.** A StatusOverlay follows its `state` and `label` props.
@@ -33,4 +35,4 @@ export function Saved() {
33
35
  - **Controls are uncontrolled**: `value`, `checked` and `on` are where they start; `onChange` tells
34
36
  what changed.
35
37
 
36
- The guidelines, every component and when not to use it: https://made-by-maid.github.io/feitio/
38
+ The guidelines, every component and when not to use it: https://feitio.bymaid.com/
@@ -0,0 +1,40 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ export interface KanbanColumn {
3
+ id: string;
4
+ title: string;
5
+ /** What an empty column says, inviting to act. */
6
+ empty?: string;
7
+ /** The new-card button: its words, the field's label, and the words of Save and Cancel. */
8
+ create?: {
9
+ label: string;
10
+ field: string;
11
+ save?: string;
12
+ cancel?: string;
13
+ };
14
+ }
15
+ /** A move the board asks for: the card, from where, to where, and at which place. */
16
+ export interface KanbanMove {
17
+ id: string;
18
+ from: string;
19
+ to: string;
20
+ index: number;
21
+ }
22
+ export interface KanbanProps {
23
+ id: string;
24
+ /** The board's name, for screen readers. */
25
+ label: string;
26
+ columns: KanbanColumn[];
27
+ /** Each column's cards (KanbanCard), by column id. */
28
+ cards?: Record<string, ReactNode>;
29
+ /** The stage a phone shows first; the first column when left out. */
30
+ current?: string;
31
+ /** The title of the move list. */
32
+ moveLabel?: string;
33
+ /** A card was dragged or sent to another column: move it in your state. */
34
+ onMove?: (move: KanbanMove) => void;
35
+ /** Something was written in a column's new-card field: add the card. */
36
+ onCreate?: (column: string, text: string) => void;
37
+ sprite?: string;
38
+ }
39
+ /** Kanban: work in columns, one per stage, and cards that go from one to the next. */
40
+ export declare function Kanban({ id, label, columns, cards, current, moveLabel, onMove, onCreate, sprite, }: KanbanProps): ReactElement;
@@ -0,0 +1,17 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ export interface KanbanCardProps {
3
+ id: string;
4
+ /** The card's name, for screen readers (and the move button's label). */
5
+ name: string;
6
+ /** The columns it may go to, by id. */
7
+ to?: string[];
8
+ /** The move button's word; screen readers hear it with the card's name. */
9
+ moveLabel?: string;
10
+ /** What a card that cannot move says. */
11
+ fixedLabel?: string;
12
+ sprite?: string;
13
+ /** The card's content, free. */
14
+ children?: ReactNode;
15
+ }
16
+ /** KanbanCard: one card of a Kanban column, lifted paper held by a strip of tape. */
17
+ export declare function KanbanCard({ id, name, to, moveLabel, fixedLabel, sprite, children, }: KanbanCardProps): ReactElement;
@@ -8,3 +8,5 @@ export declare function wireMenu(element: HTMLElement): void;
8
8
  export declare function wireNotice(element: HTMLElement): void;
9
9
  /** The ScrollFade or BackToTop next to this element (each one is wired once). */
10
10
  export declare function wireScroll(element: HTMLElement): void;
11
+ /** One Kanban: its tabs, dragging, the move button and the new card. */
12
+ export declare function wireKanban(element: HTMLElement): void;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export * from './Heading.js';
29
29
  export * from './Hint.js';
30
30
  export * from './Icon.js';
31
31
  export * from './Inline.js';
32
+ export * from './Kanban.js';
33
+ export * from './KanbanCard.js';
32
34
  export * from './Kbd.js';
33
35
  export * from './Label.js';
34
36
  export * from './Link.js';