@rokkit/forms 1.1.18 → 1.1.19

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 (88) hide show
  1. package/dist/FieldLayout.svelte.d.ts +23 -0
  2. package/dist/FormRenderer.svelte.d.ts +59 -0
  3. package/dist/InfoField.svelte.d.ts +10 -0
  4. package/dist/Input.svelte.d.ts +14 -0
  5. package/dist/InputField.svelte.d.ts +37 -0
  6. package/dist/StatusList.svelte.d.ts +19 -0
  7. package/dist/StepIndicator.svelte.d.ts +12 -0
  8. package/dist/display/DisplayCardGrid.svelte.d.ts +17 -0
  9. package/dist/display/DisplayList.svelte.d.ts +14 -0
  10. package/dist/display/DisplaySection.svelte.d.ts +13 -0
  11. package/dist/display/DisplayTable.svelte.d.ts +19 -0
  12. package/dist/display/DisplayValue.svelte.d.ts +11 -0
  13. package/dist/input/ArrayEditor.svelte.d.ts +15 -0
  14. package/dist/input/InputCheckbox.svelte.d.ts +15 -0
  15. package/dist/input/InputColor.svelte.d.ts +8 -0
  16. package/dist/input/InputDate.svelte.d.ts +8 -0
  17. package/dist/input/InputDateTime.svelte.d.ts +8 -0
  18. package/dist/input/InputEmail.svelte.d.ts +8 -0
  19. package/dist/input/InputFile.svelte.d.ts +8 -0
  20. package/dist/input/InputMonth.svelte.d.ts +8 -0
  21. package/dist/input/InputNumber.svelte.d.ts +8 -0
  22. package/dist/input/InputPassword.svelte.d.ts +8 -0
  23. package/dist/input/InputRadio.svelte.d.ts +16 -0
  24. package/dist/input/InputRange.svelte.d.ts +8 -0
  25. package/dist/input/InputSelect.svelte.d.ts +13 -0
  26. package/dist/input/InputSwatch.svelte.d.ts +13 -0
  27. package/dist/input/InputSwitch.svelte.d.ts +7 -0
  28. package/dist/input/InputTel.svelte.d.ts +8 -0
  29. package/dist/input/InputText.svelte.d.ts +8 -0
  30. package/dist/input/InputTextArea.svelte.d.ts +8 -0
  31. package/dist/input/InputTime.svelte.d.ts +8 -0
  32. package/dist/input/InputToggle.svelte.d.ts +5 -0
  33. package/dist/input/InputUrl.svelte.d.ts +8 -0
  34. package/dist/input/InputWeek.svelte.d.ts +8 -0
  35. package/dist/lib/Input.svelte.d.ts +37 -0
  36. package/dist/{src/lib → lib}/builder.svelte.d.ts +8 -8
  37. package/dist/types.d.ts +14 -0
  38. package/package.json +14 -3
  39. package/src/FieldLayout.svelte +35 -7
  40. package/src/FormRenderer.svelte +87 -19
  41. package/src/InfoField.svelte +10 -2
  42. package/src/Input.svelte +14 -2
  43. package/src/InputField.svelte +41 -14
  44. package/src/StatusList.svelte +23 -4
  45. package/src/StepIndicator.svelte +10 -8
  46. package/src/display/DisplayCardGrid.svelte +24 -7
  47. package/src/display/DisplayList.svelte +15 -2
  48. package/src/display/DisplaySection.svelte +14 -2
  49. package/src/display/DisplayTable.svelte +36 -13
  50. package/src/display/DisplayValue.svelte +18 -9
  51. package/src/input/ArrayEditor.svelte +41 -23
  52. package/src/input/InputCheckbox.svelte +17 -25
  53. package/src/input/InputColor.svelte +10 -17
  54. package/src/input/InputDate.svelte +10 -21
  55. package/src/input/InputDateTime.svelte +10 -21
  56. package/src/input/InputEmail.svelte +10 -24
  57. package/src/input/InputFile.svelte +10 -18
  58. package/src/input/InputMonth.svelte +10 -21
  59. package/src/input/InputNumber.svelte +10 -22
  60. package/src/input/InputPassword.svelte +10 -23
  61. package/src/input/InputRadio.svelte +16 -21
  62. package/src/input/InputRange.svelte +10 -20
  63. package/src/input/InputSelect.svelte +20 -20
  64. package/src/input/InputSwatch.svelte +12 -14
  65. package/src/input/InputSwitch.svelte +6 -12
  66. package/src/input/InputTel.svelte +10 -23
  67. package/src/input/InputText.svelte +10 -23
  68. package/src/input/InputTextArea.svelte +10 -23
  69. package/src/input/InputTime.svelte +10 -21
  70. package/src/input/InputToggle.svelte +4 -14
  71. package/src/input/InputUrl.svelte +10 -23
  72. package/src/input/InputWeek.svelte +10 -21
  73. package/src/lib/Input.svelte +47 -13
  74. package/src/lib/builder.svelte.js +6 -6
  75. package/dist/src/types.d.ts +0 -5
  76. /package/dist/{src/display → display}/index.d.ts +0 -0
  77. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  78. /package/dist/{src/input → input}/index.d.ts +0 -0
  79. /package/dist/{src/lib → lib}/conditions.d.ts +0 -0
  80. /package/dist/{src/lib → lib}/conditions.spec.d.ts +0 -0
  81. /package/dist/{src/lib → lib}/fields.d.ts +0 -0
  82. /package/dist/{src/lib → lib}/fields.spec.d.ts +0 -0
  83. /package/dist/{src/lib → lib}/index.d.ts +0 -0
  84. /package/dist/{src/lib → lib}/layout.d.ts +0 -0
  85. /package/dist/{src/lib → lib}/lookup.svelte.d.ts +0 -0
  86. /package/dist/{src/lib → lib}/renderers.d.ts +0 -0
  87. /package/dist/{src/lib → lib}/schema.d.ts +0 -0
  88. /package/dist/{src/lib → lib}/validation.d.ts +0 -0
@@ -0,0 +1,23 @@
1
+ import { type Component } from 'svelte';
2
+ import FieldLayout from './FieldLayout.svelte';
3
+ type LayoutSchema = {
4
+ wrapper?: string;
5
+ key?: string;
6
+ component?: string;
7
+ elements?: LayoutSchema[];
8
+ props?: Record<string, unknown>;
9
+ [key: string]: unknown;
10
+ };
11
+ /** Recursive field-value tree: each node is itself an indexable record of nodes. */
12
+ type FieldTree = {
13
+ [key: string]: FieldTree;
14
+ };
15
+ type Props = {
16
+ value?: FieldTree;
17
+ schema?: LayoutSchema;
18
+ path?: string[];
19
+ onchange?: (value: unknown) => void;
20
+ };
21
+ declare const FieldLayout: Component<Props, {}, "value">;
22
+ type FieldLayout = ReturnType<typeof FieldLayout>;
23
+ export default FieldLayout;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * FormRenderer component with snippet-based rendering
3
+ * Handles defaultInput, info, separator, display components, and custom child snippet selection.
4
+ * Supports form submission with validate-before-submit, loading state, and optional action buttons.
5
+ */
6
+ import { type Snippet, type Component } from 'svelte';
7
+ import { FormBuilder } from './lib/builder.svelte.js';
8
+ import type { LookupConfig } from './lib/lookup.svelte.js';
9
+ /** A single element produced by FormBuilder.elements. */
10
+ type FormElement = {
11
+ scope?: string;
12
+ type?: string;
13
+ value?: unknown;
14
+ override?: boolean;
15
+ props?: Record<string, unknown> & {
16
+ elements?: FormElement[];
17
+ };
18
+ };
19
+ type ValidateMode = 'blur' | 'change' | 'manual';
20
+ type ExternalValidation = {
21
+ state?: string;
22
+ text?: string;
23
+ } | null | undefined;
24
+ type ActionsContext = {
25
+ submitting: boolean;
26
+ isValid: boolean;
27
+ isDirty: boolean;
28
+ submit: (e: Event) => void | Promise<void>;
29
+ reset: () => void;
30
+ };
31
+ type Props = {
32
+ /** Optional external builder instance */
33
+ builder?: FormBuilder;
34
+ /** Direct data prop (alternative to builder) */
35
+ data?: Record<string, unknown>;
36
+ schema?: Record<string, unknown> | null;
37
+ layout?: Record<string, unknown> | null;
38
+ /** Lookup configurations */
39
+ lookups?: Record<string, LookupConfig>;
40
+ /** Validation mode */
41
+ validateOn?: ValidateMode;
42
+ /** Custom type renderers (merged with defaults) */
43
+ renderers?: Record<string, Component<Record<string, unknown>>>;
44
+ onupdate?: (data: Record<string, unknown>) => void;
45
+ onvalidate?: (fieldPath: string, value: unknown, event: string) => ExternalValidation;
46
+ onselect?: (selected: unknown, item: unknown) => void;
47
+ onsubmit?: (data: Record<string, unknown>, meta: {
48
+ isValid: boolean;
49
+ errors: unknown[];
50
+ }) => void | Promise<void>;
51
+ /** Custom actions snippet */
52
+ actions?: Snippet<[ActionsContext]>;
53
+ className?: string;
54
+ /** Custom snippet rendered when an element opts into an override */
55
+ child?: Snippet<[FormElement]>;
56
+ } & Record<string, unknown>;
57
+ declare const FormRenderer: Component<Props, {}, "data">;
58
+ type FormRenderer = ReturnType<typeof FormRenderer>;
59
+ export default FormRenderer;
@@ -0,0 +1,10 @@
1
+ type Props = {
2
+ class?: string;
3
+ name?: string;
4
+ value?: unknown;
5
+ label?: string;
6
+ description?: string;
7
+ };
8
+ declare const InfoField: import("svelte").Component<Props, {}, "">;
9
+ type InfoField = ReturnType<typeof InfoField>;
10
+ export default InfoField;
@@ -0,0 +1,14 @@
1
+ import type { Component } from 'svelte';
2
+ type Props = {
3
+ type?: string;
4
+ value?: unknown;
5
+ onchange?: ((value: unknown) => void) | null;
6
+ oninput?: ((value: unknown) => void) | null;
7
+ onfocus?: ((event: FocusEvent) => void) | null;
8
+ onblur?: ((event: FocusEvent) => void) | null;
9
+ icon?: string | null;
10
+ renderers?: Record<string, Component<Record<string, unknown>>>;
11
+ } & Record<string, unknown>;
12
+ declare const Input: Component<Props, {}, "value">;
13
+ type Input = ReturnType<typeof Input>;
14
+ export default Input;
@@ -0,0 +1,37 @@
1
+ import type { Component } from 'svelte';
2
+ type FieldMessage = {
3
+ state?: string;
4
+ text?: string;
5
+ };
6
+ type Props = {
7
+ class?: string;
8
+ name?: string;
9
+ value?: unknown;
10
+ type?: string;
11
+ required?: boolean;
12
+ status?: string;
13
+ disabled?: boolean;
14
+ dirty?: boolean;
15
+ message?: FieldMessage | string;
16
+ nolabel?: boolean;
17
+ icon?: string;
18
+ label?: string;
19
+ description?: string;
20
+ onchange?: (value: unknown) => void;
21
+ onblur?: () => void;
22
+ id?: string;
23
+ renderers?: Record<string, Component<Record<string, unknown>>>;
24
+ /**
25
+ * Field layout — controls how the label and input are arranged.
26
+ *
27
+ * - `stacked` (default) — label above input. Best for form pages
28
+ * with full-width inputs and long labels.
29
+ * - `inline` — label and input on the same row (label takes a
30
+ * fixed leading column). Best for compact control panels —
31
+ * playground knob rows, settings dialogs, tweak editors.
32
+ */
33
+ variant?: 'stacked' | 'inline';
34
+ } & Record<string, unknown>;
35
+ declare const InputField: Component<Props, {}, "value">;
36
+ type InputField = ReturnType<typeof InputField>;
37
+ export default InputField;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * StatusList — grouped summary of validation messages
3
+ * Groups items by severity (error, warning, info, success) with count headers.
4
+ * Supports click-to-focus via onclick callback.
5
+ */
6
+ type Severity = 'error' | 'warning' | 'info' | 'success';
7
+ type StatusItem = {
8
+ state: Severity;
9
+ path: string;
10
+ text: string;
11
+ };
12
+ type Props = {
13
+ items?: StatusItem[];
14
+ onclick?: (path: string) => void;
15
+ class?: string;
16
+ };
17
+ declare const StatusList: import("svelte").Component<Props, {}, "">;
18
+ type StatusList = ReturnType<typeof StatusList>;
19
+ export default StatusList;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * StepIndicator — standalone presentational component showing multi-step form progress.
3
+ * Place anywhere on the page; wire to FormBuilder.currentStep and FormBuilder.goToStep.
4
+ */
5
+ type Props = {
6
+ steps?: string[];
7
+ current?: number;
8
+ onclick?: (index: number) => void;
9
+ };
10
+ declare const StepIndicator: import("svelte").Component<Props, {}, "">;
11
+ type StepIndicator = ReturnType<typeof StepIndicator>;
12
+ export default StepIndicator;
@@ -0,0 +1,17 @@
1
+ type DisplayField = {
2
+ key: string;
3
+ label?: string;
4
+ format?: string;
5
+ };
6
+ type DisplayItem = Record<string, unknown>;
7
+ type Props = {
8
+ data?: DisplayItem[];
9
+ fields?: DisplayField[];
10
+ select?: 'one' | 'many';
11
+ title?: string;
12
+ onselect?: (selected: DisplayItem | DisplayItem[], item: DisplayItem) => void;
13
+ class?: string;
14
+ };
15
+ declare const DisplayCardGrid: import("svelte").Component<Props, {}, "">;
16
+ type DisplayCardGrid = ReturnType<typeof DisplayCardGrid>;
17
+ export default DisplayCardGrid;
@@ -0,0 +1,14 @@
1
+ type DisplayField = {
2
+ key: string;
3
+ label?: string;
4
+ format?: string;
5
+ };
6
+ type Props = {
7
+ data?: Array<Record<string, unknown>>;
8
+ fields?: DisplayField[];
9
+ title?: string;
10
+ class?: string;
11
+ };
12
+ declare const DisplayList: import("svelte").Component<Props, {}, "">;
13
+ type DisplayList = ReturnType<typeof DisplayList>;
14
+ export default DisplayList;
@@ -0,0 +1,13 @@
1
+ type DisplayField = {
2
+ key: string;
3
+ label?: string;
4
+ format?: string;
5
+ };
6
+ type Props = {
7
+ data?: Record<string, unknown>;
8
+ fields?: DisplayField[];
9
+ title?: string;
10
+ };
11
+ declare const DisplaySection: import("svelte").Component<Props, {}, "">;
12
+ type DisplaySection = ReturnType<typeof DisplaySection>;
13
+ export default DisplaySection;
@@ -0,0 +1,19 @@
1
+ type DisplayColumn = {
2
+ key: string;
3
+ label?: string;
4
+ sortable?: boolean;
5
+ width?: string;
6
+ align?: 'left' | 'center' | 'right';
7
+ format?: string;
8
+ };
9
+ type Props = {
10
+ data?: Array<Record<string, unknown>>;
11
+ columns?: DisplayColumn[];
12
+ select?: 'one' | 'many';
13
+ title?: string;
14
+ onselect?: (value: unknown, row: Record<string, unknown>) => void;
15
+ class?: string;
16
+ };
17
+ declare const DisplayTable: import("svelte").Component<Props, {}, "">;
18
+ type DisplayTable = ReturnType<typeof DisplayTable>;
19
+ export default DisplayTable;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Format-aware value display component.
3
+ * Renders a value with formatting based on the `format` hint.
4
+ */
5
+ type Props = {
6
+ value?: unknown;
7
+ format?: string;
8
+ };
9
+ declare const DisplayValue: import("svelte").Component<Props, {}, "">;
10
+ type DisplayValue = ReturnType<typeof DisplayValue>;
11
+ export default DisplayValue;
@@ -0,0 +1,15 @@
1
+ type ItemSchema = {
2
+ type?: string;
3
+ default?: unknown;
4
+ properties?: Record<string, ItemSchema>;
5
+ };
6
+ type Props = {
7
+ value?: unknown[];
8
+ onchange?: (value: unknown[]) => void;
9
+ items?: ItemSchema;
10
+ disabled?: boolean;
11
+ readonly?: boolean;
12
+ };
13
+ declare const ArrayEditor: import("svelte").Component<Props, {}, "value">;
14
+ type ArrayEditor = ReturnType<typeof ArrayEditor>;
15
+ export default ArrayEditor;
@@ -0,0 +1,15 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type StateIcons = {
3
+ checked?: string;
4
+ unchecked?: string;
5
+ unknown?: string;
6
+ };
7
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
8
+ value?: boolean | null;
9
+ variant?: 'default' | 'custom';
10
+ icons?: StateIcons;
11
+ onchange?: (value: boolean) => void;
12
+ };
13
+ declare const InputCheckbox: import("svelte").Component<Props, {}, "value">;
14
+ type InputCheckbox = ReturnType<typeof InputCheckbox>;
15
+ export default InputCheckbox;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputColor: import("svelte").Component<Props, {}, "value">;
7
+ type InputColor = ReturnType<typeof InputColor>;
8
+ export default InputColor;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputDate: import("svelte").Component<Props, {}, "value">;
7
+ type InputDate = ReturnType<typeof InputDate>;
8
+ export default InputDate;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputDateTime: import("svelte").Component<Props, {}, "value">;
7
+ type InputDateTime = ReturnType<typeof InputDateTime>;
8
+ export default InputDateTime;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputEmail: import("svelte").Component<Props, {}, "value">;
7
+ type InputEmail = ReturnType<typeof InputEmail>;
8
+ export default InputEmail;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: FileList | null;
4
+ onchange?: (value: FileList | null) => void;
5
+ };
6
+ declare const InputFile: import("svelte").Component<Props, {}, "value">;
7
+ type InputFile = ReturnType<typeof InputFile>;
8
+ export default InputFile;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputMonth: import("svelte").Component<Props, {}, "value">;
7
+ type InputMonth = ReturnType<typeof InputMonth>;
8
+ export default InputMonth;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: number;
4
+ onchange?: (value: number) => void;
5
+ };
6
+ declare const InputNumber: import("svelte").Component<Props, {}, "value">;
7
+ type InputNumber = ReturnType<typeof InputNumber>;
8
+ export default InputNumber;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputPassword: import("svelte").Component<Props, {}, "value">;
7
+ type InputPassword = ReturnType<typeof InputPassword>;
8
+ export default InputPassword;
@@ -0,0 +1,16 @@
1
+ import { type FieldMapping } from '@rokkit/core';
2
+ type Props = {
3
+ class?: string;
4
+ value?: unknown;
5
+ fields?: FieldMapping;
6
+ options?: unknown[];
7
+ disabled?: boolean;
8
+ flip?: boolean;
9
+ onchange?: (value: unknown) => void;
10
+ onfocus?: (event: FocusEvent) => void;
11
+ onblur?: (event: FocusEvent) => void;
12
+ [key: string]: unknown;
13
+ };
14
+ declare const InputRadio: import("svelte").Component<Props, {}, "value">;
15
+ type InputRadio = ReturnType<typeof InputRadio>;
16
+ export default InputRadio;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: number;
4
+ onchange?: (value: number) => void;
5
+ };
6
+ declare const InputRange: import("svelte").Component<Props, {}, "value">;
7
+ type InputRange = ReturnType<typeof InputRange>;
8
+ export default InputRange;
@@ -0,0 +1,13 @@
1
+ type Option = string | Record<string, unknown>;
2
+ type Props = {
3
+ value?: unknown;
4
+ fields?: Record<string, string>;
5
+ options?: Option[];
6
+ placeholder?: string;
7
+ disabled?: boolean;
8
+ size?: 'sm' | 'md' | 'lg';
9
+ onchange?: (value: unknown, item: unknown) => void;
10
+ };
11
+ declare const InputSelect: import("svelte").Component<Props, {}, "value">;
12
+ type InputSelect = ReturnType<typeof InputSelect>;
13
+ export default InputSelect;
@@ -0,0 +1,13 @@
1
+ type Props = {
2
+ value?: unknown;
3
+ options?: Array<string | number | Record<string, unknown>>;
4
+ fields?: Record<string, string>;
5
+ multiple?: boolean;
6
+ shape?: 'square' | 'circle';
7
+ size?: 'sm' | 'md' | 'lg';
8
+ disabled?: boolean;
9
+ onchange?: (value: unknown, item: unknown) => void;
10
+ };
11
+ declare const InputSwatch: import("svelte").Component<Props, {}, "value">;
12
+ type InputSwatch = ReturnType<typeof InputSwatch>;
13
+ export default InputSwatch;
@@ -0,0 +1,7 @@
1
+ import { type SwitchProps } from '@rokkit/ui';
2
+ type Props = SwitchProps & {
3
+ name?: string;
4
+ };
5
+ declare const InputSwitch: import("svelte").Component<Props, {}, "value">;
6
+ type InputSwitch = ReturnType<typeof InputSwitch>;
7
+ export default InputSwitch;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputTel: import("svelte").Component<Props, {}, "value">;
7
+ type InputTel = ReturnType<typeof InputTel>;
8
+ export default InputTel;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputText: import("svelte").Component<Props, {}, "value">;
7
+ type InputText = ReturnType<typeof InputText>;
8
+ export default InputText;
@@ -0,0 +1,8 @@
1
+ import type { HTMLTextareaAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLTextareaAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputTextArea: import("svelte").Component<Props, {}, "value">;
7
+ type InputTextArea = ReturnType<typeof InputTextArea>;
8
+ export default InputTextArea;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputTime: import("svelte").Component<Props, {}, "value">;
7
+ type InputTime = ReturnType<typeof InputTime>;
8
+ export default InputTime;
@@ -0,0 +1,5 @@
1
+ import { type ToggleProps } from '@rokkit/ui';
2
+ type Props = Pick<ToggleProps, 'value' | 'options' | 'fields' | 'disabled' | 'size' | 'showLabels' | 'onchange'>;
3
+ declare const InputToggle: import("svelte").Component<Props, {}, "value">;
4
+ type InputToggle = ReturnType<typeof InputToggle>;
5
+ export default InputToggle;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputUrl: import("svelte").Component<Props, {}, "value">;
7
+ type InputUrl = ReturnType<typeof InputUrl>;
8
+ export default InputUrl;
@@ -0,0 +1,8 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ type Props = Omit<HTMLInputAttributes, 'value' | 'onchange'> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ };
6
+ declare const InputWeek: import("svelte").Component<Props, {}, "value">;
7
+ type InputWeek = ReturnType<typeof InputWeek>;
8
+ export default InputWeek;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Universal Input wrapper component supporting all HTML input types
3
+ * Provides consistent interface with label, description, message handling
4
+ */
5
+ type Message = {
6
+ state: 'error' | 'warning' | 'info' | 'success';
7
+ text: string;
8
+ };
9
+ type SelectOption = string | {
10
+ value: unknown;
11
+ label?: string;
12
+ };
13
+ type Props = {
14
+ type?: string;
15
+ value?: unknown;
16
+ label?: string;
17
+ description?: string;
18
+ message?: Message | null;
19
+ placeholder?: string;
20
+ required?: boolean;
21
+ disabled?: boolean;
22
+ readonly?: boolean;
23
+ min?: number | string;
24
+ max?: number | string;
25
+ step?: number | string;
26
+ pattern?: string;
27
+ minLength?: number;
28
+ maxLength?: number;
29
+ options?: SelectOption[];
30
+ className?: string;
31
+ onchange?: (value: unknown) => void;
32
+ onfocus?: (event: FocusEvent) => void;
33
+ onblur?: (event: FocusEvent) => void;
34
+ } & Record<string, unknown>;
35
+ declare const Input: import("svelte").Component<Props, {}, "value">;
36
+ type Input = ReturnType<typeof Input>;
37
+ export default Input;
@@ -4,12 +4,12 @@
4
4
  export class FormBuilder {
5
5
  /**
6
6
  * Create a new FormBuilder instance
7
- * @param {Object} [data={}] - Initial data object
7
+ * @param {Record<string, unknown>} [data={}] - Initial data object
8
8
  * @param {Object|null} [schema=null] - Optional schema override
9
9
  * @param {Object|null} [layout=null] - Optional layout override
10
10
  * @param {Object<string, import('./lookup.svelte.js').LookupConfig>} [lookups={}] - Lookup configurations
11
11
  */
12
- constructor(data?: Object, schema?: Object | null, layout?: Object | null, lookups?: {
12
+ constructor(data?: Record<string, unknown>, schema?: Object | null, layout?: Object | null, lookups?: {
13
13
  [x: string]: import("./lookup.svelte.js").LookupConfig;
14
14
  });
15
15
  /** @type {FormElement[]} */
@@ -20,14 +20,14 @@ export class FormBuilder {
20
20
  get combined(): any;
21
21
  /**
22
22
  * Set the data
23
- * @param {Object} value - New data object
23
+ * @param {Record<string, unknown>} value - New data object
24
24
  */
25
- set data(value: Object);
25
+ set data(value: Record<string, unknown>);
26
26
  /**
27
27
  * Get the current data
28
- * @returns {Object} Current data object
28
+ * @returns {Record<string, unknown>} Current data object
29
29
  */
30
- get data(): Object;
30
+ get data(): Record<string, unknown>;
31
31
  /**
32
32
  * Set the schema
33
33
  * @param {Object} value - New schema object
@@ -145,9 +145,9 @@ export class FormBuilder {
145
145
  * Get form data with hidden field values stripped out
146
146
  * Hidden fields are those absent from this.elements (the derived list)
147
147
  * Does not mutate this.#data
148
- * @returns {Object} Filtered data containing only visible field keys
148
+ * @returns {Record<string, unknown>} Filtered data containing only visible field keys
149
149
  */
150
- getVisibleData(): Object;
150
+ getVisibleData(): Record<string, unknown>;
151
151
  /**
152
152
  * Whether all fields pass validation (no error-state messages)
153
153
  * @returns {boolean}
@@ -0,0 +1,14 @@
1
+ export namespace types {
2
+ let string: import("svelte").Component<Omit<import("svelte/elements").HTMLInputAttributes, "value" | "onchange"> & {
3
+ value?: string;
4
+ onchange?: (value: string) => void;
5
+ }, {}, "value">;
6
+ let integer: import("svelte").Component<Omit<import("svelte/elements").HTMLInputAttributes, "value" | "onchange"> & {
7
+ value?: number;
8
+ onchange?: (value: number) => void;
9
+ }, {}, "value">;
10
+ let phone: import("svelte").Component<Omit<import("svelte/elements").HTMLInputAttributes, "value" | "onchange"> & {
11
+ value?: string;
12
+ onchange?: (value: string) => void;
13
+ }, {}, "value">;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/forms",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "Form building components for Rokkit applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,10 +14,11 @@
14
14
  "access": "public"
15
15
  },
16
16
  "scripts": {
17
- "prepublishOnly": "cp ../../LICENSE . && tsc --project tsconfig.build.json",
17
+ "prepublishOnly": "cp ../../LICENSE . && bun run clean && bun run build",
18
18
  "postpublish": "rm -f LICENSE",
19
19
  "clean": "rm -rf dist",
20
- "build": "bun clean && bun prepublishOnly"
20
+ "build": "svelte-package -i src -o dist",
21
+ "check": "svelte-check --tsconfig ./tsconfig.json"
21
22
  },
22
23
  "files": [
23
24
  "src/**/*.js",
@@ -35,6 +36,7 @@
35
36
  "svelte": "./src/index.js"
36
37
  },
37
38
  "./lib": {
39
+ "types": "./dist/lib/index.d.ts",
38
40
  "import": "./src/lib/index.js"
39
41
  }
40
42
  },
@@ -44,5 +46,14 @@
44
46
  "@rokkit/states": "latest",
45
47
  "@rokkit/ui": "latest",
46
48
  "ramda": "^0.32.0"
49
+ },
50
+ "peerDependencies": {
51
+ "svelte": "^5.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@sveltejs/package": "^2.5.8",
55
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
56
+ "@types/ramda": "^0.31.1",
57
+ "svelte-check": "^4.4.3"
47
58
  }
48
59
  }