@human-synthesis/norns-ui 0.0.12 → 0.0.14
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/COMPONENTS.md +1462 -0
- package/README.md +34 -3
- package/package.json +9 -5
- package/src/components/Autocomplete.n +41 -4
- package/src/components/DataTable.n +11 -4
- package/src/components/Form.n +40 -7
- package/src/components/MultiSelect.n +42 -4
- package/src/index.js +2 -0
- package/src/lib/list.svelte.d.ts +46 -0
- package/src/lib/list.svelte.js +143 -0
- package/src/styles/atoms.css +1 -0
- package/src/types/Autocomplete.d.ts +12 -0
- package/src/types/DataTable.d.ts +9 -1
- package/src/types/Form.d.ts +16 -0
- package/src/types/MultiSelect.d.ts +10 -1
- package/src/types/Window.d.ts +22 -0
package/src/types/Form.d.ts
CHANGED
|
@@ -22,6 +22,22 @@ export type FormProps = Omit<HTMLFormAttributes, 'class' | 'children'> & {
|
|
|
22
22
|
* up its own error automatically.
|
|
23
23
|
*/
|
|
24
24
|
form?: FormActionResult;
|
|
25
|
+
/**
|
|
26
|
+
* API mode. Intercepts the submit, collects the fields into a plain object
|
|
27
|
+
* and calls this instead of posting the form — typically
|
|
28
|
+
* `(values) => api.post('/api/notes', values)` against a norns `route()`.
|
|
29
|
+
* A rejection whose `body.issues` (or `issues`) is a valibot issue list is
|
|
30
|
+
* mapped into the same errors context as `form`.
|
|
31
|
+
*/
|
|
32
|
+
submit?: (values: Record<string, FormDataEntryValue>, event: SubmitEvent) => Promise<unknown> | unknown;
|
|
33
|
+
/** Called with the resolved value of `submit`. */
|
|
34
|
+
onsuccess?: (result: unknown, values: Record<string, FormDataEntryValue>) => void;
|
|
35
|
+
/** Called when `submit` rejects (after the errors map was updated). */
|
|
36
|
+
onerror?: (error: unknown) => void;
|
|
37
|
+
/** True while `submit` is pending. Bindable. */
|
|
38
|
+
submitting?: boolean;
|
|
39
|
+
/** API mode: clear the fields after `submit` resolves. */
|
|
40
|
+
resetOnSuccess?: boolean;
|
|
25
41
|
class?: string;
|
|
26
42
|
children?: Snippet;
|
|
27
43
|
};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { Component } from 'svelte';
|
|
2
|
-
import type { ComboboxItem } from './Autocomplete';
|
|
2
|
+
import type { ComboboxItem, ComboboxSource } from './Autocomplete';
|
|
3
3
|
|
|
4
4
|
export type MultiSelectProps = {
|
|
5
|
+
/** Local options, filtered client-side by label. Ignored when `source` is set. */
|
|
5
6
|
items?: ComboboxItem[];
|
|
7
|
+
/** Remote options: called (debounced) with the typed text while the list is open. Picked labels are remembered across searches. */
|
|
8
|
+
source?: ComboboxSource;
|
|
9
|
+
/** Milliseconds to wait after typing before calling `source`. Default 200. */
|
|
10
|
+
debounce?: number;
|
|
11
|
+
/** Minimum typed characters before `source` is called. Default 0. */
|
|
12
|
+
minChars?: number;
|
|
6
13
|
value?: string[];
|
|
7
14
|
open?: boolean;
|
|
8
15
|
placeholder?: string;
|
|
16
|
+
emptyMessage?: string;
|
|
17
|
+
loadingMessage?: string;
|
|
9
18
|
disabled?: boolean;
|
|
10
19
|
name?: string;
|
|
11
20
|
id?: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
|
|
3
|
+
export type WindowProps = {
|
|
4
|
+
/** Header title (truncated). */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** Remove the whole header bar; keeps the rounded shell. */
|
|
7
|
+
hideHeader?: boolean;
|
|
8
|
+
/** When set, renders a `lucide:x` close button (marked `.nodrag`). */
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
/** Fires on double-click over the header bar (e.g. maximise). */
|
|
11
|
+
onHeaderDoubleClick?: (event: MouseEvent) => void;
|
|
12
|
+
/** Extra header controls, rendered before the close button. */
|
|
13
|
+
actions?: Snippet;
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
/** Classes for the outer shell — pass dimensions here (`w-[520px] h-[380px]`). */
|
|
16
|
+
class?: string;
|
|
17
|
+
/** Classes for the body section. */
|
|
18
|
+
bodyClass?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare const Window: Component<WindowProps>;
|
|
22
|
+
export default Window;
|