@human-synthesis/norns-ui 0.0.1 → 0.0.3

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.
@@ -0,0 +1,11 @@
1
+ import type { Component } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+
4
+ export type CheckboxProps = Omit<HTMLInputAttributes, 'class' | 'type' | 'checked'> & {
5
+ checked?: boolean;
6
+ error?: boolean;
7
+ class?: string;
8
+ };
9
+
10
+ declare const Checkbox: Component<CheckboxProps>;
11
+ export default Checkbox;
@@ -0,0 +1,17 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type DialogProps = {
4
+ open?: boolean;
5
+ title?: string;
6
+ description?: string;
7
+ hideClose?: boolean;
8
+ trigger?: Snippet;
9
+ actions?: Snippet;
10
+ children?: Snippet;
11
+ triggerClass?: string;
12
+ overlayClass?: string;
13
+ class?: string;
14
+ };
15
+
16
+ declare const Dialog: Component<DialogProps>;
17
+ export default Dialog;
@@ -0,0 +1,23 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type DropdownItem = {
4
+ label?: string;
5
+ separator?: boolean;
6
+ disabled?: boolean;
7
+ onSelect?: (event: Event) => void;
8
+ };
9
+
10
+ export type DropdownProps = {
11
+ open?: boolean;
12
+ side?: 'top' | 'right' | 'bottom' | 'left';
13
+ align?: 'start' | 'center' | 'end';
14
+ sideOffset?: number;
15
+ items?: DropdownItem[];
16
+ trigger?: Snippet;
17
+ children?: Snippet;
18
+ triggerClass?: string;
19
+ class?: string;
20
+ };
21
+
22
+ declare const Dropdown: Component<DropdownProps>;
23
+ export default Dropdown;
@@ -0,0 +1,32 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type FieldProps = {
4
+ /** Label text rendered above the control. Used as id-derivation fallback if no `id`/`name` is given. */
5
+ label?: string;
6
+ /** Helper text shown below the control when there's no error. */
7
+ help?: string;
8
+ /**
9
+ * Explicit error message. Overrides any auto-resolved error from the
10
+ * parent `<Form form={...}>` context. Switches the inner control to
11
+ * error styling.
12
+ */
13
+ error?: string;
14
+ /**
15
+ * Field name — used to look up an auto-error from the parent `<Form>`
16
+ * context (matching `form.errors[*].path[0].key`) and as the default
17
+ * id for the inner control. When set, an inner `<Input>` doesn't need
18
+ * an explicit `name=` either if it inherits from this Field.
19
+ */
20
+ name?: string;
21
+ /** Adds a red asterisk after the label. Cosmetic; pair with `required` on the actual input. */
22
+ required?: boolean;
23
+ /** Explicit id for the control. Otherwise: `name`, then slugified `label`, then undefined. */
24
+ id?: string;
25
+ /** Optional class merged into the field wrapper. */
26
+ class?: string;
27
+ /** Snippet that renders the actual control. Children should call `<Input />`, `<Textarea />`, etc. */
28
+ children?: Snippet;
29
+ };
30
+
31
+ declare const Field: Component<FieldProps>;
32
+ export default Field;
@@ -0,0 +1,11 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type FieldGroupProps = {
4
+ /** Optional legend text rendered as the fieldset's `<legend>`. */
5
+ legend?: string;
6
+ class?: string;
7
+ children?: Snippet;
8
+ };
9
+
10
+ declare const FieldGroup: Component<FieldGroupProps>;
11
+ export default FieldGroup;
@@ -0,0 +1,30 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ import type { HTMLFormAttributes } from 'svelte/elements';
3
+
4
+ /**
5
+ * The shape returned by `fail(400, { errors, values })` from a SvelteKit
6
+ * action — what `+page.server.c`'s `page.actions` produces on validation
7
+ * failure (or a manually-constructed equivalent). `errors` is a valibot
8
+ * issue list; `values` is the raw form data echoed back for re-rendering.
9
+ */
10
+ export type FormActionResult = {
11
+ errors?: Array<{ path?: Array<{ key?: string }>; message: string }>;
12
+ values?: Record<string, string>;
13
+ } | null | undefined;
14
+
15
+ export type FormProps = Omit<HTMLFormAttributes, 'class' | 'children'> & {
16
+ method?: 'GET' | 'POST';
17
+ action?: string;
18
+ enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
19
+ /**
20
+ * Pass the page's `form` prop here. Form derives a `name → message` errors
21
+ * map and exposes it via context so descendant `<Field name="...">` looks
22
+ * up its own error automatically.
23
+ */
24
+ form?: FormActionResult;
25
+ class?: string;
26
+ children?: Snippet;
27
+ };
28
+
29
+ declare const Form: Component<FormProps>;
30
+ export default Form;
@@ -0,0 +1,29 @@
1
+ import type { Component } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+
4
+ export type InputSize = 'sm' | 'md' | 'lg';
5
+ export type InputType =
6
+ | 'text'
7
+ | 'email'
8
+ | 'password'
9
+ | 'number'
10
+ | 'tel'
11
+ | 'url'
12
+ | 'search'
13
+ | 'date'
14
+ | 'time'
15
+ | 'datetime-local'
16
+ | 'month'
17
+ | 'week';
18
+
19
+ export type InputProps = Omit<HTMLInputAttributes, 'class' | 'type' | 'size' | 'value'> & {
20
+ value?: string | number;
21
+ type?: InputType;
22
+ size?: InputSize;
23
+ /** Force the error styling regardless of the parent Field's error state. */
24
+ error?: boolean;
25
+ class?: string;
26
+ };
27
+
28
+ declare const Input: Component<InputProps>;
29
+ export default Input;
@@ -0,0 +1,18 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type PopoverSide = 'top' | 'right' | 'bottom' | 'left';
4
+ export type PopoverAlign = 'start' | 'center' | 'end';
5
+
6
+ export type PopoverProps = {
7
+ open?: boolean;
8
+ side?: PopoverSide;
9
+ align?: PopoverAlign;
10
+ sideOffset?: number;
11
+ trigger?: Snippet;
12
+ children?: Snippet;
13
+ triggerClass?: string;
14
+ class?: string;
15
+ };
16
+
17
+ declare const Popover: Component<PopoverProps>;
18
+ export default Popover;
@@ -0,0 +1,13 @@
1
+ import type { Component } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+
4
+ export type RadioProps = Omit<HTMLInputAttributes, 'class' | 'type'> & {
5
+ /** Two-way bound shared group value — pass `bind:group={selected}` from parent. */
6
+ group?: string;
7
+ value?: string;
8
+ error?: boolean;
9
+ class?: string;
10
+ };
11
+
12
+ declare const Radio: Component<RadioProps>;
13
+ export default Radio;
@@ -0,0 +1,13 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ import type { HTMLSelectAttributes } from 'svelte/elements';
3
+
4
+ export type SelectProps = Omit<HTMLSelectAttributes, 'class' | 'value' | 'children'> & {
5
+ value?: string | number | string[];
6
+ error?: boolean;
7
+ class?: string;
8
+ /** `<option>` children. Pass via Pug body. */
9
+ children?: Snippet;
10
+ };
11
+
12
+ declare const Select: Component<SelectProps>;
13
+ export default Select;
@@ -0,0 +1,20 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type SheetSide = 'top' | 'right' | 'bottom' | 'left';
4
+
5
+ export type SheetProps = {
6
+ open?: boolean;
7
+ side?: SheetSide;
8
+ title?: string;
9
+ description?: string;
10
+ hideClose?: boolean;
11
+ trigger?: Snippet;
12
+ actions?: Snippet;
13
+ children?: Snippet;
14
+ triggerClass?: string;
15
+ overlayClass?: string;
16
+ class?: string;
17
+ };
18
+
19
+ declare const Sheet: Component<SheetProps>;
20
+ export default Sheet;
@@ -0,0 +1,11 @@
1
+ import type { Component } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+
4
+ export type SwitchProps = Omit<HTMLInputAttributes, 'class' | 'type' | 'checked' | 'role'> & {
5
+ checked?: boolean;
6
+ error?: boolean;
7
+ class?: string;
8
+ };
9
+
10
+ declare const Switch: Component<SwitchProps>;
11
+ export default Switch;
@@ -0,0 +1,17 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type TabsItem = {
4
+ value: string;
5
+ label: string;
6
+ panel?: Snippet;
7
+ disabled?: boolean;
8
+ };
9
+
10
+ export type TabsProps = {
11
+ value?: string;
12
+ items?: TabsItem[];
13
+ class?: string;
14
+ };
15
+
16
+ declare const Tabs: Component<TabsProps>;
17
+ export default Tabs;
@@ -0,0 +1,12 @@
1
+ import type { Component } from 'svelte';
2
+ import type { HTMLTextareaAttributes } from 'svelte/elements';
3
+
4
+ export type TextareaProps = Omit<HTMLTextareaAttributes, 'class' | 'value' | 'rows'> & {
5
+ value?: string;
6
+ rows?: number;
7
+ error?: boolean;
8
+ class?: string;
9
+ };
10
+
11
+ declare const Textarea: Component<TextareaProps>;
12
+ export default Textarea;
@@ -0,0 +1,15 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type ToastVariant = 'info' | 'success' | 'warning' | 'error';
4
+
5
+ export type ToastProviderProps = {
6
+ class?: string;
7
+ };
8
+
9
+ export type ToastOpts = {
10
+ variant?: ToastVariant;
11
+ duration?: number;
12
+ };
13
+
14
+ declare const ToastProvider: Component<ToastProviderProps>;
15
+ export default ToastProvider;
@@ -0,0 +1,15 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type TooltipProps = {
4
+ content?: string;
5
+ side?: 'top' | 'right' | 'bottom' | 'left';
6
+ sideOffset?: number;
7
+ delay?: number;
8
+ trigger?: Snippet;
9
+ children?: Snippet;
10
+ triggerClass?: string;
11
+ class?: string;
12
+ };
13
+
14
+ declare const Tooltip: Component<TooltipProps>;
15
+ export default Tooltip;