panelui-native 0.46.0 → 0.49.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.
Files changed (72) hide show
  1. package/README.md +5 -1
  2. package/lib/module/components/accordion/index.js +32 -4
  3. package/lib/module/components/accordion/index.js.map +1 -1
  4. package/lib/module/components/button/index.js +83 -15
  5. package/lib/module/components/button/index.js.map +1 -1
  6. package/lib/module/components/button-group/index.js +186 -0
  7. package/lib/module/components/button-group/index.js.map +1 -0
  8. package/lib/module/components/color-picker/index.js +110 -1
  9. package/lib/module/components/color-picker/index.js.map +1 -1
  10. package/lib/module/components/date-time-picker/index.js +23 -5
  11. package/lib/module/components/date-time-picker/index.js.map +1 -1
  12. package/lib/module/components/fab/index.js +514 -0
  13. package/lib/module/components/fab/index.js.map +1 -0
  14. package/lib/module/components/markdown-editor/index.js +406 -0
  15. package/lib/module/components/markdown-editor/index.js.map +1 -0
  16. package/lib/module/components/markdown-editor/markdown-transforms.js +243 -0
  17. package/lib/module/components/markdown-editor/markdown-transforms.js.map +1 -0
  18. package/lib/module/components/questionnaire/index.js +1312 -0
  19. package/lib/module/components/questionnaire/index.js.map +1 -0
  20. package/lib/module/components/tabs/index.js +94 -18
  21. package/lib/module/components/tabs/index.js.map +1 -1
  22. package/lib/module/components/time-picker/index.js +34 -6
  23. package/lib/module/components/time-picker/index.js.map +1 -1
  24. package/lib/module/components/tree/index.js +500 -0
  25. package/lib/module/components/tree/index.js.map +1 -0
  26. package/lib/module/icons/index.js +217 -0
  27. package/lib/module/icons/index.js.map +1 -1
  28. package/lib/module/index.js +6 -1
  29. package/lib/module/index.js.map +1 -1
  30. package/lib/typescript/src/components/accordion/index.d.ts +21 -0
  31. package/lib/typescript/src/components/accordion/index.d.ts.map +1 -1
  32. package/lib/typescript/src/components/button/index.d.ts +21 -0
  33. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  34. package/lib/typescript/src/components/button-group/index.d.ts +212 -0
  35. package/lib/typescript/src/components/button-group/index.d.ts.map +1 -0
  36. package/lib/typescript/src/components/color-picker/index.d.ts +82 -1
  37. package/lib/typescript/src/components/color-picker/index.d.ts.map +1 -1
  38. package/lib/typescript/src/components/date-time-picker/index.d.ts +7 -1
  39. package/lib/typescript/src/components/date-time-picker/index.d.ts.map +1 -1
  40. package/lib/typescript/src/components/fab/index.d.ts +285 -0
  41. package/lib/typescript/src/components/fab/index.d.ts.map +1 -0
  42. package/lib/typescript/src/components/markdown-editor/index.d.ts +102 -0
  43. package/lib/typescript/src/components/markdown-editor/index.d.ts.map +1 -0
  44. package/lib/typescript/src/components/markdown-editor/markdown-transforms.d.ts +76 -0
  45. package/lib/typescript/src/components/markdown-editor/markdown-transforms.d.ts.map +1 -0
  46. package/lib/typescript/src/components/questionnaire/index.d.ts +336 -0
  47. package/lib/typescript/src/components/questionnaire/index.d.ts.map +1 -0
  48. package/lib/typescript/src/components/tabs/index.d.ts +9 -0
  49. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  50. package/lib/typescript/src/components/time-picker/index.d.ts +19 -1
  51. package/lib/typescript/src/components/time-picker/index.d.ts.map +1 -1
  52. package/lib/typescript/src/components/tree/index.d.ts +125 -0
  53. package/lib/typescript/src/components/tree/index.d.ts.map +1 -0
  54. package/lib/typescript/src/icons/index.d.ts +22 -0
  55. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  56. package/lib/typescript/src/index.d.ts +8 -3
  57. package/lib/typescript/src/index.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/src/components/accordion/index.tsx +48 -6
  60. package/src/components/button/index.tsx +97 -15
  61. package/src/components/button-group/index.tsx +199 -0
  62. package/src/components/color-picker/index.tsx +140 -3
  63. package/src/components/date-time-picker/index.tsx +39 -3
  64. package/src/components/fab/index.tsx +583 -0
  65. package/src/components/markdown-editor/index.tsx +526 -0
  66. package/src/components/markdown-editor/markdown-transforms.ts +228 -0
  67. package/src/components/questionnaire/index.tsx +1615 -0
  68. package/src/components/tabs/index.tsx +100 -28
  69. package/src/components/time-picker/index.tsx +42 -6
  70. package/src/components/tree/index.tsx +564 -0
  71. package/src/icons/index.tsx +154 -0
  72. package/src/index.ts +77 -1
@@ -0,0 +1,102 @@
1
+ /**
2
+ * MarkdownEditor — a field for writing markdown, and a way to see it rendered.
3
+ *
4
+ * ```tsx
5
+ * const [draft, setDraft] = useState('');
6
+ *
7
+ * <MarkdownEditor value={draft} onValueChange={setDraft} rows={12} />
8
+ * ```
9
+ *
10
+ * ## Writing and reading are two modes, not two panes
11
+ *
12
+ * Side by side is how this is done on a desktop, and it does not survive the
13
+ * trip to a phone: two columns of a phone's width are two columns too narrow to
14
+ * read, and the keyboard covers the bottom half of the screen exactly when the
15
+ * writer is using it. So there is one pane and a switch — write, or read what
16
+ * you wrote. The toolbar carries the switch, because the toolbar is the one
17
+ * thing on screen in both modes.
18
+ *
19
+ * ## The toolbar edits the selection
20
+ *
21
+ * Every button here is a function of the text and where the caret is in it, and
22
+ * the answer that matters is not which characters get inserted but where the
23
+ * caret lands afterwards. Bolding a selected phrase leaves it selected, so it
24
+ * can be italicised next; bolding nothing puts the caret between the new
25
+ * markers, where the writing is about to go; and pressing the same button again
26
+ * takes the markers off. Those rules live in `markdown-transforms.ts` as pure
27
+ * functions over `(text, selection)`, away from anything to do with a field.
28
+ *
29
+ * ## Why it renders through Response
30
+ *
31
+ * The preview is `Response`, the same reader that renders a model's answer, so
32
+ * markdown means the same thing everywhere in the library and there is one
33
+ * parser to be right rather than two to keep in step. It renders through
34
+ * `Typography`, `CodeBlock` and `Table`, which is to say through the app's own
35
+ * type and colours — a preview that looked like a document viewer would be
36
+ * showing the writer something they are not going to ship.
37
+ *
38
+ * Nothing here reaches for a platform markdown renderer. `Text` in SwiftUI can
39
+ * parse markdown and Jetpack Compose's cannot, so a platform-backed editor
40
+ * would render on one of the two and be a plain string on the other.
41
+ *
42
+ * Works controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
43
+ */
44
+ import { type ReactNode } from 'react';
45
+ import { View, type TextInput, type ViewProps } from 'react-native';
46
+ import { type TextareaProps } from '../textarea/index.js';
47
+ export type { EditorSelection, EditResult } from './markdown-transforms.js';
48
+ /** Which pane the editor is showing. */
49
+ export type MarkdownEditorMode = 'write' | 'preview';
50
+ /** A formatting action the toolbar can offer. */
51
+ export type MarkdownEditorAction = 'bold' | 'italic' | 'heading' | 'quote' | 'code' | 'bulletList' | 'orderedList' | 'link';
52
+ export interface MarkdownEditorProps extends Omit<ViewProps, 'children'> {
53
+ className?: string;
54
+ /** Controlled text. Leave unset and pass `defaultValue` to run uncontrolled. */
55
+ value?: string;
56
+ /** Starting text when uncontrolled. */
57
+ defaultValue?: string;
58
+ onValueChange?: (value: string) => void;
59
+ /** Controlled pane. */
60
+ mode?: MarkdownEditorMode;
61
+ /** Starting pane when uncontrolled. */
62
+ defaultMode?: MarkdownEditorMode;
63
+ onModeChange?: (mode: MarkdownEditorMode) => void;
64
+ /** Stop the field being edited and the toolbar being pressed. */
65
+ disabled?: boolean;
66
+ /**
67
+ * The parts, in the order they should stack. Left out, the editor draws its
68
+ * toolbar, its field and its preview in that order — which is the whole
69
+ * component, and the reason it usually needs no children.
70
+ */
71
+ children?: ReactNode;
72
+ /** Forwarded to the field when the editor draws its own. */
73
+ placeholder?: string;
74
+ /** Height of the field, in lines. Forwarded to the field the editor draws. */
75
+ rows?: number;
76
+ }
77
+ export interface MarkdownEditorToolbarProps extends Omit<ViewProps, 'children'> {
78
+ className?: string;
79
+ /** Which formatting actions to offer, in the order given. */
80
+ actions?: MarkdownEditorAction[];
81
+ /**
82
+ * Show the write/preview switch. On by default — a preview nobody can reach
83
+ * is a pane that does not exist.
84
+ */
85
+ showModeSwitch?: boolean;
86
+ /** Anything else to put on the row: a word count, a save state, a submit. */
87
+ children?: ReactNode;
88
+ }
89
+ export interface MarkdownEditorInputProps extends Omit<TextareaProps, 'value' | 'onChangeText' | 'defaultValue'> {
90
+ className?: string;
91
+ }
92
+ export interface MarkdownEditorPreviewProps extends Omit<ViewProps, 'children'> {
93
+ className?: string;
94
+ /** What to show when there is nothing written yet. */
95
+ emptyText?: string;
96
+ }
97
+ export declare const MarkdownEditor: import("react").ForwardRefExoticComponent<MarkdownEditorProps & import("react").RefAttributes<View>> & {
98
+ Toolbar: import("react").ForwardRefExoticComponent<MarkdownEditorToolbarProps & import("react").RefAttributes<View>>;
99
+ Input: import("react").ForwardRefExoticComponent<MarkdownEditorInputProps & import("react").RefAttributes<TextInput>>;
100
+ Preview: import("react").ForwardRefExoticComponent<MarkdownEditorPreviewProps & import("react").RefAttributes<View>>;
101
+ };
102
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/markdown-editor/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,IAAI,EAEJ,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAmBtB,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,sBAAa,CAAC;AAW3D,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAAuB,CAAC;AAEzE,wCAAwC;AACxC,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,QAAQ,GACR,SAAS,GACT,OAAO,GACP,MAAM,GACN,YAAY,GACZ,aAAa,GACb,MAAM,CAAC;AAwGX,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,uBAAuB;IACvB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,uCAAuC;IACvC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA0HD,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAmED,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,cAAc,GAAG,cAAc,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoDD,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA+BD,eAAO,MAAM,cAAc;;;;CAIzB,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The edits a formatting toolbar makes, as functions of the text and where the
3
+ * caret is in it.
4
+ *
5
+ * Pure, and deliberately so. Every one of these takes `(text, selection)` and
6
+ * returns the text that should replace it together with where the selection
7
+ * should end up — no component, no ref, no input. What makes a formatting
8
+ * toolbar feel broken is never the characters it inserts; it is where the caret
9
+ * lands afterwards, and that is a property of these functions rather than of
10
+ * the field they are wired to.
11
+ *
12
+ * Three rules they all keep:
13
+ *
14
+ * - **Applying twice undoes it.** A toolbar button that only ever adds is a
15
+ * button you can press once, and every press after that damages the text.
16
+ * - **A selection stays selected.** Bolding three words and then italicising
17
+ * the same three has to be two presses, not a press and a re-selection.
18
+ * - **With nothing selected, the caret lands where the writing goes** — between
19
+ * the new markers rather than after them.
20
+ */
21
+ export interface EditorSelection {
22
+ start: number;
23
+ end: number;
24
+ }
25
+ export interface EditResult {
26
+ text: string;
27
+ selection: EditorSelection;
28
+ }
29
+ /**
30
+ * Wraps the selection in `marker`, or unwraps it if it is already wrapped.
31
+ *
32
+ * "Already wrapped" is checked both ways round: the markers may be inside the
33
+ * selection (the writer selected `**bold**`) or immediately outside it (they
34
+ * selected `bold` in the middle of `**bold**`). Both are the same intent, and a
35
+ * toolbar that only recognised one of them would add a second pair of asterisks
36
+ * to text that already had them.
37
+ */
38
+ export declare function toggleWrap(text: string, selection: EditorSelection, marker: string): EditResult;
39
+ /**
40
+ * Puts `prefix` on the front of every line the selection touches, or takes it
41
+ * off if every one of them already has it.
42
+ *
43
+ * Every one, not any one: a mixed block is a block the writer is trying to make
44
+ * uniform, so the useful answer there is to add rather than to remove.
45
+ */
46
+ export declare function toggleLinePrefix(text: string, selection: EditorSelection, prefix: string): EditResult;
47
+ /**
48
+ * Numbers the lines the selection touches, or unnumbers them.
49
+ *
50
+ * Counted from one within the block rather than continuing whatever came above
51
+ * it: the numbers a writer types are not the numbers that get rendered — every
52
+ * markdown reader renumbers an ordered list from its first item — so the useful
53
+ * thing is for the source to read the way the output will.
54
+ */
55
+ export declare function toggleOrderedList(text: string, selection: EditorSelection): EditResult;
56
+ /** Placeholder left where a link's target goes. */
57
+ export declare const LINK_PLACEHOLDER = "url";
58
+ /**
59
+ * Turns the selection into a link, and selects the part that still needs
60
+ * filling in.
61
+ *
62
+ * Which part that is depends on what was selected. With text selected, the
63
+ * label is written and the target is not, so the placeholder target is left
64
+ * selected and typing replaces it. With nothing selected there is neither, and
65
+ * the label comes first because it is the half the writer is thinking about.
66
+ */
67
+ export declare function insertLink(text: string, selection: EditorSelection): EditResult;
68
+ /**
69
+ * Puts the selected lines in a fence, or takes them out of one.
70
+ *
71
+ * A fence is the one construct that has to sit on lines of its own, so this
72
+ * makes room for itself: a blank line before it when it is not already at the
73
+ * start of a paragraph, and one after it at the end.
74
+ */
75
+ export declare function toggleFence(text: string, selection: EditorSelection): EditResult;
76
+ //# sourceMappingURL=markdown-transforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-transforms.d.ts","sourceRoot":"","sources":["../../../../../src/components/markdown-editor/markdown-transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,eAAe,CAAC;CAC5B;AAaD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,MAAM,GACb,UAAU,CAmCZ;AAiCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,MAAM,GACb,UAAU,CASZ;AAKD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,GACzB,UAAU,CAQZ;AAMD,mDAAmD;AACnD,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,UAAU,CAY/E;AAMD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,UAAU,CAiBhF"}
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Questionnaire — one question at a time, with progress, validation and a way
3
+ * back.
4
+ *
5
+ * Unlike `Steps`, which reflects a flow the app owns, Questionnaire *owns* the
6
+ * flow: it holds the answers, decides which question is current, gates the way
7
+ * forward on the current one being answered, and reports the whole set back
8
+ * when it is done. The caller supplies the questions and does something with
9
+ * the answers; everything between those two points belongs here.
10
+ *
11
+ * ```tsx
12
+ * <Questionnaire items={items} onSubmit={(answers) => save(answers)}>
13
+ * <Questionnaire.Title>Project setup</Questionnaire.Title>
14
+ * <Questionnaire.Progress />
15
+ * <Questionnaire.Item name="direction" required>
16
+ * <Questionnaire.Question>What should we build next?</Questionnaire.Question>
17
+ * <Questionnaire.Description>Choose one, or write your own.</Questionnaire.Description>
18
+ * <Questionnaire.Choices>
19
+ * <Questionnaire.Choice value="delegation" label="Delegation" />
20
+ * <Questionnaire.Choice value="prompts" label="Question prompts" />
21
+ * <Questionnaire.Input placeholder="Type another answer…" />
22
+ * </Questionnaire.Choices>
23
+ * <Questionnaire.Error />
24
+ * </Questionnaire.Item>
25
+ * <Questionnaire.Footer>
26
+ * <Questionnaire.Back />
27
+ * <Questionnaire.Next />
28
+ * <Questionnaire.Submit />
29
+ * </Questionnaire.Footer>
30
+ * </Questionnaire>
31
+ * ```
32
+ *
33
+ * ## Why it draws its own Frame
34
+ *
35
+ * A survey is a widget, not a paragraph: it wants a boundary, a title strip and
36
+ * a footer that stays put while the middle changes. That is exactly `Frame`, so
37
+ * the root renders one rather than leaving every caller to assemble the same
38
+ * shell. `Frame.Panel`'s `overflow-hidden` also does the clipping the sliding
39
+ * question needs, for free. Pass `frame={false}` to drop it — for a
40
+ * questionnaire inside a `BottomSheet` or a card that already draws a border.
41
+ *
42
+ * ## Why the root reads its children instead of collecting registrations
43
+ *
44
+ * Only the active question is mounted, so an unmounted one cannot report that
45
+ * it exists — and without knowing the full set there is no total to count
46
+ * against, no "is this the last one", and no way to disable a question the
47
+ * user has not reached. So the root inspects its children once per render and
48
+ * reads `name`, `required`, `multiple` and `disabled` straight off the
49
+ * elements. React elements carry their props before anything renders them,
50
+ * which makes the whole set knowable without mounting any of it.
51
+ *
52
+ * That same pass sorts the parts into the shell: the title and progress go to
53
+ * the header strip, the footer to a section at the bottom of the panel, and
54
+ * everything else is a question.
55
+ *
56
+ * ## Answers are one record, the way a form would submit them
57
+ *
58
+ * `answers[name]` is a string for a single-answer question and an array for a
59
+ * `multiple` one. A freeform answer lands under the same name — it is another
60
+ * answer to the same question, not a separate field — which is why the text
61
+ * input shows whatever value does not match one of the question's own choices.
62
+ * Picking a choice and typing therefore replace each other, without either one
63
+ * having to know the other exists.
64
+ *
65
+ * ## What blocks the way forward
66
+ *
67
+ * A required question blocks until it has an answer. An optional one never
68
+ * blocks. `Questionnaire.Skip` does not unblock anything, then — it *records*
69
+ * that the question was deliberately left out, moving its status from
70
+ * `unanswered` to `skipped` so the app can tell the two apart. Making an
71
+ * optional question demand an explicit skip would trap anyone who did not
72
+ * render the Skip button, and a question that cannot be ignored is not
73
+ * optional.
74
+ */
75
+ import { type ReactNode } from 'react';
76
+ import { View, type TextInput, type ViewProps } from 'react-native';
77
+ import { type ButtonProps } from '../button/index.js';
78
+ import { type InputProps } from '../input/index.js';
79
+ /** Where a question stands: never touched, answered, or deliberately left out. */
80
+ export type QuestionnaireItemStatus = 'unanswered' | 'answered' | 'skipped';
81
+ /** Which key each answer is badged with. */
82
+ export type QuestionnaireShortcutMode = 'letters' | 'numbers';
83
+ /** Every answer given so far, keyed by question name. */
84
+ export type QuestionnaireAnswers = Record<string, string | string[]>;
85
+ /**
86
+ * A question, described rather than rendered. Pass these as `items` so the
87
+ * questionnaire knows its full set before any of it mounts — which is what
88
+ * makes a conditional question countable and a total meaningful.
89
+ */
90
+ export interface QuestionnaireItemDefinition {
91
+ /** Unique name — the key this question's answer is stored under. */
92
+ name: string;
93
+ /** Blocks the way forward until it has an answer. */
94
+ required?: boolean;
95
+ /** Accepts more than one answer, so its answer is an array. */
96
+ multiple?: boolean;
97
+ /** Left out of the count and never navigated to. */
98
+ disabled?: boolean;
99
+ }
100
+ export interface QuestionnaireProps extends Omit<ViewProps, 'children'> {
101
+ className?: string;
102
+ /**
103
+ * The full set of questions, in order. Optional: without it the order and
104
+ * the totals come from the `Questionnaire.Item` children instead. Pass it
105
+ * when a question is conditional, since a question the user has not reached
106
+ * still has to be counted — or not counted, if it no longer applies.
107
+ */
108
+ items?: readonly QuestionnaireItemDefinition[];
109
+ /** Controlled active question, by name. */
110
+ item?: string;
111
+ /** Which question to open on. Defaults to the first enabled one. */
112
+ defaultItem?: string;
113
+ /** Called with the name of the question being moved to. */
114
+ onItemChange?: (name: string) => void;
115
+ /** Controlled answers. */
116
+ answers?: QuestionnaireAnswers;
117
+ /** Answers to start with — for resuming a part-finished questionnaire. */
118
+ defaultAnswers?: QuestionnaireAnswers;
119
+ /** Called with the whole set every time any answer changes. */
120
+ onAnswersChange?: (answers: QuestionnaireAnswers) => void;
121
+ /** Called with every answer once the last question validates. */
122
+ onSubmit?: (answers: QuestionnaireAnswers) => void;
123
+ /**
124
+ * Badge every answer with a letter (`A`, `B`, `C`) or a number (`1`, `2`,
125
+ * `3`). Disabled answers are skipped rather than taking a badge with them.
126
+ *
127
+ * The badge is an affordance, not a binding: React Native surfaces hardware
128
+ * key events only to a focused text field, so nothing here can listen for
129
+ * the key itself.
130
+ */
131
+ shortcuts?: QuestionnaireShortcutMode;
132
+ /**
133
+ * Let a horizontal drag move between questions. Going forward is gated on
134
+ * the same answer the button is, so a swipe off an unanswered required
135
+ * question springs back and shows its error.
136
+ */
137
+ swipeable?: boolean;
138
+ /**
139
+ * Draw the surrounding `Frame`. Turn it off to place the questionnaire in a
140
+ * sheet, a dialog or a card that already draws its own boundary.
141
+ */
142
+ frame?: boolean;
143
+ children?: ReactNode;
144
+ }
145
+ declare function QuestionnaireRoot({ className, items, item: itemProp, defaultItem, onItemChange, answers: answersProp, defaultAnswers, onAnswersChange, onSubmit, shortcuts, swipeable, frame, children, ...props }: QuestionnaireProps): import("react").JSX.Element;
146
+ declare namespace QuestionnaireRoot {
147
+ var displayName: string;
148
+ }
149
+ export interface QuestionnaireTitleProps extends ViewProps {
150
+ className?: string;
151
+ children?: ReactNode;
152
+ }
153
+ /**
154
+ * Names the questionnaire as a whole, in the frame's header strip. The
155
+ * current question's own prompt is `Questionnaire.Question`.
156
+ */
157
+ declare function QuestionnaireTitle({ className, children, ...props }: QuestionnaireTitleProps): import("react").JSX.Element;
158
+ declare namespace QuestionnaireTitle {
159
+ var displayName: string;
160
+ }
161
+ /** What a custom progress indicator is told about where the reader is. */
162
+ export interface QuestionnaireProgressState {
163
+ /** One-based position of the active question. */
164
+ current: number;
165
+ /** How many questions are enabled. */
166
+ total: number;
167
+ first: boolean;
168
+ last: boolean;
169
+ }
170
+ /** How the position is drawn. */
171
+ export type QuestionnaireProgressVariant = 'pips' | 'numbers' | 'count';
172
+ export interface QuestionnaireProgressProps {
173
+ className?: string;
174
+ /**
175
+ * `pips` is a bar per question, filled up to the one being asked and widened
176
+ * on it. `numbers` counts them out instead, which is what you want when the
177
+ * reader will be sent back to a particular question. `count` is the plain
178
+ * `Question 2 of 5`.
179
+ *
180
+ * `pips` and `numbers` fall back to `count` past eight questions, where
181
+ * neither is countable at a glance any more.
182
+ */
183
+ variant?: QuestionnaireProgressVariant;
184
+ /**
185
+ * Replace the indicator entirely. Given a function, it is called with the
186
+ * position — for a bar, a row of dots, or a percentage.
187
+ */
188
+ children?: ReactNode | ((state: QuestionnaireProgressState) => ReactNode);
189
+ }
190
+ /** Where the reader is in the set, announced as a progress bar. */
191
+ declare function QuestionnaireProgress({ className, variant, children, }: QuestionnaireProgressProps): import("react").JSX.Element;
192
+ declare namespace QuestionnaireProgress {
193
+ var displayName: string;
194
+ }
195
+ export interface QuestionnaireItemProps extends Omit<ViewProps, 'children'> {
196
+ className?: string;
197
+ /** Unique name — the key this question's answer is stored under. */
198
+ name: string;
199
+ /** Blocks the way forward until it has an answer. */
200
+ required?: boolean;
201
+ /** Accepts more than one answer, so its answer is an array. */
202
+ multiple?: boolean;
203
+ /** Left out of the count and never navigated to. */
204
+ disabled?: boolean;
205
+ /** Mark the question at fault from a validator of your own. */
206
+ invalid?: boolean;
207
+ /** Called whenever this question moves between unanswered, answered and skipped. */
208
+ onStatusChange?: (status: QuestionnaireItemStatus) => void;
209
+ children?: ReactNode;
210
+ }
211
+ /**
212
+ * One question. Only the active one is mounted, so anything it holds is built
213
+ * when it is reached and thrown away when it is left.
214
+ */
215
+ declare function QuestionnaireItem({ className, name, required, multiple, invalid: invalidProp, children, disabled: _disabled, onStatusChange: _onStatusChange, ...props }: QuestionnaireItemProps): import("react").JSX.Element;
216
+ declare namespace QuestionnaireItem {
217
+ var displayName: string;
218
+ }
219
+ export interface QuestionnaireQuestionProps extends ViewProps {
220
+ className?: string;
221
+ children?: ReactNode;
222
+ }
223
+ /** The question being asked. */
224
+ declare function QuestionnaireQuestion({ className, children, ...props }: QuestionnaireQuestionProps): import("react").JSX.Element;
225
+ declare namespace QuestionnaireQuestion {
226
+ var displayName: string;
227
+ }
228
+ export interface QuestionnaireDescriptionProps extends ViewProps {
229
+ className?: string;
230
+ children?: ReactNode;
231
+ }
232
+ /** A line under the question — what to consider, or that it can be skipped. */
233
+ declare function QuestionnaireDescription({ className, children, ...props }: QuestionnaireDescriptionProps): import("react").JSX.Element;
234
+ declare namespace QuestionnaireDescription {
235
+ var displayName: string;
236
+ }
237
+ export interface QuestionnaireChoicesProps extends Omit<ViewProps, 'children'> {
238
+ className?: string;
239
+ children?: ReactNode;
240
+ }
241
+ /**
242
+ * The answers to a question. It hands each choice its shortcut badge, counting
243
+ * only the ones that can be picked so a disabled answer does not take a letter
244
+ * out of the sequence with it.
245
+ */
246
+ declare function QuestionnaireChoices({ className, children, ...props }: QuestionnaireChoicesProps): import("react").JSX.Element;
247
+ declare namespace QuestionnaireChoices {
248
+ var displayName: string;
249
+ }
250
+ export interface QuestionnaireChoiceProps {
251
+ className?: string;
252
+ /** The value recorded when this answer is picked. */
253
+ value: string;
254
+ /** The answer itself. */
255
+ label?: string;
256
+ /** A line under the label, for an answer that needs explaining. */
257
+ description?: string;
258
+ disabled?: boolean;
259
+ children?: ReactNode;
260
+ }
261
+ export interface QuestionnaireInputProps extends Omit<InputProps, 'value' | 'onChangeText' | 'errorMessage'> {
262
+ className?: string;
263
+ }
264
+ export interface QuestionnaireErrorProps extends ViewProps {
265
+ className?: string;
266
+ /** Replace the default message. */
267
+ children?: ReactNode;
268
+ }
269
+ /** Why the way forward is closed. Nothing until the question fails to pass. */
270
+ declare function QuestionnaireError({ className, children, ...props }: QuestionnaireErrorProps): import("react").JSX.Element | null;
271
+ declare namespace QuestionnaireError {
272
+ var displayName: string;
273
+ }
274
+ export interface QuestionnaireFooterProps extends ViewProps {
275
+ className?: string;
276
+ children?: ReactNode;
277
+ }
278
+ /**
279
+ * The action row, in its own section at the foot of the panel. It stays put
280
+ * while the question above it changes, which is what keeps the button under
281
+ * the thumb where it was.
282
+ */
283
+ declare function QuestionnaireFooter({ className, children, ...props }: QuestionnaireFooterProps): import("react").JSX.Element;
284
+ declare namespace QuestionnaireFooter {
285
+ var displayName: string;
286
+ }
287
+ /** What a navigation button is told about the question it is acting on. */
288
+ export interface QuestionnaireActionState {
289
+ /** Whether the action applies to the active question at all. */
290
+ visible: boolean;
291
+ /** Where the active question stands. */
292
+ status: QuestionnaireItemStatus;
293
+ }
294
+ export interface QuestionnaireActionProps extends Omit<ButtonProps, 'children'> {
295
+ /** Replace the label. Given a function, it is called with the question's state. */
296
+ children?: ReactNode | ((state: QuestionnaireActionState) => ReactNode);
297
+ }
298
+ /**
299
+ * A flexible gap for the footer, so the trailing buttons sit against the
300
+ * trailing edge whether or not `Questionnaire.Back` is showing.
301
+ */
302
+ declare function QuestionnaireSpacer({ className, ...props }: ViewProps): import("react").JSX.Element;
303
+ declare namespace QuestionnaireSpacer {
304
+ var displayName: string;
305
+ }
306
+ export declare const Questionnaire: typeof QuestionnaireRoot & {
307
+ Title: typeof QuestionnaireTitle;
308
+ Progress: typeof QuestionnaireProgress;
309
+ Item: typeof QuestionnaireItem;
310
+ Question: typeof QuestionnaireQuestion;
311
+ Description: typeof QuestionnaireDescription;
312
+ Choices: typeof QuestionnaireChoices;
313
+ Choice: import("react").ForwardRefExoticComponent<QuestionnaireChoiceProps & import("react").RefAttributes<View>>;
314
+ Input: import("react").ForwardRefExoticComponent<QuestionnaireInputProps & import("react").RefAttributes<TextInput>>;
315
+ Error: typeof QuestionnaireError;
316
+ Footer: typeof QuestionnaireFooter;
317
+ Spacer: typeof QuestionnaireSpacer;
318
+ Back: {
319
+ ({ children, variant, className, ...props }: QuestionnaireActionProps): import("react").JSX.Element | null;
320
+ displayName: string;
321
+ };
322
+ Skip: {
323
+ ({ children, variant, className, ...props }: QuestionnaireActionProps): import("react").JSX.Element | null;
324
+ displayName: string;
325
+ };
326
+ Next: {
327
+ ({ children, variant, className, ...props }: QuestionnaireActionProps): import("react").JSX.Element | null;
328
+ displayName: string;
329
+ };
330
+ Submit: {
331
+ ({ children, variant, className, ...props }: QuestionnaireActionProps): import("react").JSX.Element | null;
332
+ displayName: string;
333
+ };
334
+ };
335
+ export {};
336
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/questionnaire/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,OAAO,EAaL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,IAAI,EAEJ,KAAK,SAAS,EACd,KAAK,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AAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,iBAAS,mBAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAQvF;kBARQ,mBAAmB;;;AAW5B,2EAA2E;AAC3E,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,MAAM,EAAE,uBAAuB,CAAC;CACjC;AAED,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IAC7E,mFAAmF;IACnF,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,wBAAwB,KAAK,SAAS,CAAC,CAAC;CACzE;AA4GD;;;GAGG;AACH,iBAAS,mBAAmB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,+BAE9D;kBAFQ,mBAAmB;;;AAK5B,eAAO,MAAM,aAAa;;;;;;;;;;;;;qDAjFoC,wBAAwB;;;;qDAAxB,wBAAwB;;;;qDAAxB,wBAAwB;;;;qDAAxB,wBAAwB;;;CAiGpF,CAAC"}
@@ -58,6 +58,15 @@ export interface TabsProps extends ViewProps {
58
58
  * already wants a horizontal drag — a carousel, a slider, a row that swipes
59
59
  * open — and the two cannot both have it. Turn it on for panels of ordinary
60
60
  * scrolling content, where it is the gesture people try first.
61
+ *
62
+ * **It does not change what is mounted.** Only `keepMounted` decides that,
63
+ * with or without this — a swipe animates between two panels of which one is
64
+ * being unmounted and the other mounted for the first time, exactly as a
65
+ * press does. What it does change is that the mount now happens *while
66
+ * something is moving*, so a panel that is slow to build stops being a pause
67
+ * before it appears and starts being a stutter in the movement. If a swipe
68
+ * feels heavier than a press on the same tab set, the panel is expensive to
69
+ * mount; `keepMounted` is the answer, not turning this off.
61
70
  */
62
71
  swipeable?: boolean;
63
72
  children: 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BAAgB,sCAgMrF;AAED,eAAO,MAAM,IAAI;;;;CAIf,CAAC"}
@@ -50,6 +50,14 @@ export type { HourCycle, TimeValue };
50
50
  export type TimePickerLayout = 'wheel' | 'clock' | 'ruler';
51
51
  /** How the panel gets onto the screen. */
52
52
  export type TimePickerPresentation = 'popover' | 'dialog' | 'bottom-sheet' | 'inline';
53
+ /**
54
+ * How loudly the ruler face states the time it is on.
55
+ *
56
+ * `default` is the big centred number, right when the scale is the only thing
57
+ * on the panel. `compact` steps it down to sit under something that outranks
58
+ * it, and `none` drops it for a caller that writes the time itself.
59
+ */
60
+ export type TimePickerReadout = 'default' | 'compact' | 'none';
53
61
  export interface TimePickerProps {
54
62
  /** Controlled selection, as `{ hour, minute }` on a 24-hour clock. */
55
63
  value?: TimeValue;
@@ -80,6 +88,16 @@ export interface TimePickerProps {
80
88
  format?: (value: TimeValue) => string;
81
89
  /** BCP 47 tag for the time's text and the meridiem labels. */
82
90
  locale?: string;
91
+ /**
92
+ * How loudly the `ruler` face states the time it is on. The other two faces
93
+ * spell the time out in their own columns and hands, and ignore this.
94
+ *
95
+ * The big centred number is right when the scale is the only thing on the
96
+ * panel. Under something that outranks it — a calendar, a form row — it is
97
+ * the largest text on screen for the smaller half of the answer, so step it
98
+ * down with `compact` or take it over yourself with `none`.
99
+ */
100
+ readout?: TimePickerReadout;
83
101
  /** Stop the trigger opening it, and the faces from being scrolled. */
84
102
  disabled?: boolean;
85
103
  className?: string;
@@ -94,7 +112,7 @@ export interface TimePickerProps {
94
112
  onPress?: () => void;
95
113
  }> | ReactNode;
96
114
  }
97
- declare function TimePickerRoot({ value: valueProp, defaultValue, onValueChange, layout, presentation, open: openProp, onOpenChange, hourCycle, minuteStep, minTime, maxTime, placeholder, format, locale, disabled, className, children, }: TimePickerProps): import("react").JSX.Element;
115
+ declare function TimePickerRoot({ value: valueProp, defaultValue, onValueChange, layout, presentation, open: openProp, onOpenChange, hourCycle, minuteStep, minTime, maxTime, placeholder, format, locale, readout, disabled, className, children, }: TimePickerProps): import("react").JSX.Element;
98
116
  declare namespace TimePickerRoot {
99
117
  var displayName: string;
100
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/time-picker/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAuBf,OAAO,EAYL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,qBAAkB,CAAC;AAK1B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAErC,kCAAkC;AAClC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;AA+nBtF,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC3C,kCAAkC;IAClC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,0CAA0C;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,yCAAyC;IACzC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,MAAM,CAAC;IACtC,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;CAC/D;AASD,iBAAS,cAAc,CAAC,EACtB,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,aAAa,EACb,MAAgB,EAChB,YAAwB,EACxB,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,SAAc,EACd,UAAU,EACV,OAAO,EACP,OAAO,EACP,WAAiC,EACjC,MAAM,EACN,MAAM,EACN,QAAgB,EAChB,SAAS,EACT,QAAQ,GACT,EAAE,eAAe,+BA6JjB;kBA/KQ,cAAc;;;AAkLvB,eAAO,MAAM,UAAU;;CAErB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/time-picker/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAuBf,OAAO,EAYL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,qBAAkB,CAAC;AAK1B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAErC,kCAAkC;AAClC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,Q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