@dmitryvim/form-builder 0.3.4 → 0.5.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/dist/browser/formbuilder.min.js +181 -123
- package/dist/browser/formbuilder.v0.5.0.min.js +1499 -0
- package/dist/cjs/index.cjs +150 -91
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +144 -89
- package/dist/esm/index.js.map +1 -1
- package/dist/form-builder.js +181 -123
- package/dist/types/components/file/library.d.ts +1 -1
- package/dist/types/components/textarea.d.ts +4 -2
- package/dist/types/styles/theme.d.ts +3 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/schema.d.ts +32 -2
- package/dist/types/utils/styles.d.ts +3 -1
- package/package.json +19 -19
- package/dist/browser/formbuilder.v0.3.4.min.js +0 -1441
|
@@ -64,7 +64,7 @@ export declare function handleLibraryPickMulti(opts: HandleLibraryPickMultiOptio
|
|
|
64
64
|
* @param state Form builder state
|
|
65
65
|
* @param element FileElement schema definition
|
|
66
66
|
* @param container The .file-preview-container element
|
|
67
|
-
* @param fileWrapper The .
|
|
67
|
+
* @param fileWrapper The .fb-row wrapper that contains the hidden input
|
|
68
68
|
* @param pathKey Field name / bracket-notation path for the hidden input
|
|
69
69
|
* @param fieldPath Bracket-notation field path (for onChange context)
|
|
70
70
|
* @param renderCallback Called with the accepted resource ID; caller renders the tile
|
|
@@ -6,7 +6,9 @@ export declare function renderMultipleTextareaElement(element: TextareaElement,
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function validateTextareaElement(element: TextareaElement, key: string, context: ComponentContext): ValidationResult;
|
|
8
8
|
/**
|
|
9
|
-
* Update textarea field - delegates to text updater since they share update
|
|
10
|
-
* then triggers resize
|
|
9
|
+
* Update textarea field - delegates to text updater since they share update
|
|
10
|
+
* logic, then triggers resize so auto-expand recomputes height for the new
|
|
11
|
+
* value. As of v0.4.0 auto-expand is always on, so the resize event is
|
|
12
|
+
* dispatched unconditionally.
|
|
11
13
|
*/
|
|
12
14
|
export declare function updateTextareaField(element: TextareaElement, fieldPath: string, value: any, context: ComponentContext): void;
|
|
@@ -88,6 +88,9 @@ export interface Theme {
|
|
|
88
88
|
labelSectionFontSize: string;
|
|
89
89
|
labelSectionLetterSpacing: string;
|
|
90
90
|
labelSectionTextTransform: string;
|
|
91
|
+
labelFontSize: string;
|
|
92
|
+
labelLineHeight: string;
|
|
93
|
+
labelMarginBottom: string;
|
|
91
94
|
}
|
|
92
95
|
export declare const defaultTheme: Theme;
|
|
93
96
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { SelectOption, ElementAction, EnableCondition, BaseElement, TextElement, TextareaElement, NumberElement, SelectElement, SwitcherElement, BooleanElement, FileElement, FilesElement, ColourElement, SliderElement, ContainerElement, GroupElement, TableElement, TableMerge, TableData, RichInputElement, MarkdownElement, Element, Schema, ExternalAction, FormData, RenderContext, } from "./schema.js";
|
|
1
|
+
export type { SelectOption, ElementAction, ElementSize, ElementWidth, EnableCondition, BaseElement, TextElement, TextareaElement, NumberElement, SelectElement, SwitcherElement, BooleanElement, FileElement, FilesElement, ColourElement, SliderElement, ContainerElement, GroupElement, TableElement, TableMerge, TableData, RichInputElement, MarkdownElement, Element, Schema, ExternalAction, FormData, RenderContext, } from "./schema.js";
|
|
2
2
|
export type { Translations, Locale, Config, ResourceMetadata, PickedResource, } from "./config.js";
|
|
3
3
|
export type { State } from "./state.js";
|
|
4
4
|
export type { ComponentContext, ValidationResult, ComponentValidator, ComponentUpdater, ComponentOperations, } from "./component-operations.js";
|
|
@@ -36,6 +36,20 @@ export interface EnableCondition {
|
|
|
36
36
|
equals?: any;
|
|
37
37
|
scope?: "relative" | "absolute";
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Visual density token applied to input-bearing elements. Controls
|
|
41
|
+
* padding/font-size via the `.fb-size-{token}` class on the field wrapper.
|
|
42
|
+
* Defaults to `"md"`. Larger sizes (`lg`/`xl`) suit hero forms; smaller
|
|
43
|
+
* sizes (`sm`/`xs`) suit dense admin tables.
|
|
44
|
+
*/
|
|
45
|
+
export type ElementSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
46
|
+
/**
|
|
47
|
+
* Horizontal slot the element occupies within its container's flex-wrap row.
|
|
48
|
+
* Defaults to `"full"` (own row). Mixing widths (e.g. `[1/2, 1/2, full]`)
|
|
49
|
+
* lets a single container hold both partial-column and full-width fields.
|
|
50
|
+
* Widths in one row should sum to ≤ 1; remainders leave whitespace.
|
|
51
|
+
*/
|
|
52
|
+
export type ElementWidth = "1/3" | "1/2" | "2/3" | "full";
|
|
39
53
|
export interface BaseElement {
|
|
40
54
|
type: string;
|
|
41
55
|
key: string;
|
|
@@ -48,6 +62,10 @@ export interface BaseElement {
|
|
|
48
62
|
default?: any;
|
|
49
63
|
actions?: ElementAction[];
|
|
50
64
|
enableIf?: EnableCondition;
|
|
65
|
+
/** Visual density. Default: "md". See {@link ElementSize}. */
|
|
66
|
+
size?: ElementSize;
|
|
67
|
+
/** Horizontal slot within container row. Default: "full". See {@link ElementWidth}. */
|
|
68
|
+
width?: ElementWidth;
|
|
51
69
|
}
|
|
52
70
|
export interface TextElement extends BaseElement {
|
|
53
71
|
type: "text";
|
|
@@ -70,6 +88,11 @@ export interface TextareaElement extends BaseElement {
|
|
|
70
88
|
multiple?: boolean;
|
|
71
89
|
minCount?: number;
|
|
72
90
|
maxCount?: number;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated As of v0.4.0 auto-expand is always on for textarea. This flag
|
|
93
|
+
* is ignored (kept only to avoid breaking existing schemas that set it).
|
|
94
|
+
* Use `rows` to set the initial visible row count.
|
|
95
|
+
*/
|
|
73
96
|
autoExpand?: boolean;
|
|
74
97
|
addLabel?: string;
|
|
75
98
|
}
|
|
@@ -132,13 +155,20 @@ export interface ContainerElement extends BaseElement {
|
|
|
132
155
|
multiple?: boolean;
|
|
133
156
|
minCount?: number;
|
|
134
157
|
maxCount?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Number of columns for horizontal layout (default: 1 for vertical).
|
|
160
|
+
* Applies to single containers (multiple !== true) and to `displayMode: "stack"` items.
|
|
161
|
+
* **Ignored for `displayMode: "slides"`** — slides use a responsive CSS grid;
|
|
162
|
+
* tune density via the `--fb-slide-min-width` CSS variable instead.
|
|
163
|
+
*/
|
|
135
164
|
columns?: 1 | 2 | 3 | 4;
|
|
136
165
|
prefillHints?: PrefillHint[];
|
|
137
166
|
/**
|
|
138
167
|
* How items are arranged when `multiple: true`.
|
|
139
168
|
* - "stack" (default): vertical list, one item per row (current behavior).
|
|
140
|
-
* - "slides":
|
|
141
|
-
*
|
|
169
|
+
* - "slides": responsive grid. Column count is driven by container width and
|
|
170
|
+
* `--fb-slide-min-width` (default 280px). Schema `columns` is ignored —
|
|
171
|
+
* override via theme / host CSS instead. See `.docs/theming.md` (Slides grid).
|
|
142
172
|
* Ignored when `multiple: false`.
|
|
143
173
|
*/
|
|
144
174
|
displayMode?: "stack" | "slides";
|
|
@@ -53,7 +53,9 @@ export declare function ensureThemingHooks(doc: Document): void;
|
|
|
53
53
|
* where width hasn't moved — otherwise our own height writes would feed back
|
|
54
54
|
* into the observer.
|
|
55
55
|
*/
|
|
56
|
-
export declare function applyAutoExpand(textarea: HTMLTextAreaElement
|
|
56
|
+
export declare function applyAutoExpand(textarea: HTMLTextAreaElement, options?: {
|
|
57
|
+
minRows?: number;
|
|
58
|
+
}): void;
|
|
57
59
|
/**
|
|
58
60
|
* Enforce single-line semantics on a textarea: block the Enter key and
|
|
59
61
|
* strip newlines from pasted content. Used to render <textarea rows=1> as
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.5.0",
|
|
7
7
|
"description": "A reusable JSON schema form builder library",
|
|
8
8
|
"main": "./dist/cjs/index.cjs",
|
|
9
9
|
"module": "./dist/esm/index.js",
|
|
@@ -52,23 +52,23 @@
|
|
|
52
52
|
"url": "git+https://github.com/picazru/form-builder.git"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.
|
|
56
|
-
"@babel/preset-env": "^7.
|
|
57
|
-
"@eslint/js": "^
|
|
58
|
-
"@rollup/plugin-commonjs": "^
|
|
59
|
-
"@rollup/plugin-node-resolve": "^
|
|
60
|
-
"@rollup/plugin-replace": "^6.0.
|
|
61
|
-
"@types/node": "^
|
|
62
|
-
"babel-jest": "^30.
|
|
63
|
-
"eslint": "^
|
|
64
|
-
"jest": "^
|
|
65
|
-
"jest-environment-jsdom": "^
|
|
66
|
-
"prettier": "^3.
|
|
67
|
-
"rollup": "^4.
|
|
68
|
-
"rollup-plugin-esbuild": "^6.1
|
|
69
|
-
"serve": "^14.
|
|
70
|
-
"tsup": "^8.
|
|
71
|
-
"typescript": "^
|
|
72
|
-
"typescript-eslint": "^8.
|
|
55
|
+
"@babel/core": "^7.29.0",
|
|
56
|
+
"@babel/preset-env": "^7.29.5",
|
|
57
|
+
"@eslint/js": "^10.0.1",
|
|
58
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
59
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
60
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
61
|
+
"@types/node": "^25.8.0",
|
|
62
|
+
"babel-jest": "^30.4.1",
|
|
63
|
+
"eslint": "^10.4.0",
|
|
64
|
+
"jest": "^30.4.2",
|
|
65
|
+
"jest-environment-jsdom": "^30.4.1",
|
|
66
|
+
"prettier": "^3.8.3",
|
|
67
|
+
"rollup": "^4.60.4",
|
|
68
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
69
|
+
"serve": "^14.2.6",
|
|
70
|
+
"tsup": "^8.5.1",
|
|
71
|
+
"typescript": "^6.0.3",
|
|
72
|
+
"typescript-eslint": "^8.59.3"
|
|
73
73
|
}
|
|
74
74
|
}
|