@kubuild/components 0.2.0 → 0.3.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/blocks/forms.d.ts +6 -0
- package/dist/blocks/forms.d.ts.map +1 -0
- package/dist/blocks/index.cjs +1661 -0
- package/dist/blocks/index.cjs.map +1 -0
- package/dist/blocks/index.d.ts +11 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +15 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/layout.d.ts +6 -0
- package/dist/blocks/layout.d.ts.map +1 -0
- package/dist/blocks/sections.d.ts +6 -0
- package/dist/blocks/sections.d.ts.map +1 -0
- package/dist/{blocks.d.ts → blocks/types.d.ts} +2 -5
- package/dist/blocks/types.d.ts.map +1 -0
- package/dist/chunk-JTQ35OQQ.js +1631 -0
- package/dist/chunk-JTQ35OQQ.js.map +1 -0
- package/dist/chunk-K6I6U7F3.js +2707 -0
- package/dist/chunk-K6I6U7F3.js.map +1 -0
- package/dist/chunk-OK53DS7G.js +911 -0
- package/dist/chunk-OK53DS7G.js.map +1 -0
- package/dist/definitions/constants.d.ts +10 -0
- package/dist/definitions/constants.d.ts.map +1 -0
- package/dist/definitions/data/collection.d.ts +3 -0
- package/dist/definitions/data/collection.d.ts.map +1 -0
- package/dist/definitions/data/index.d.ts +4 -0
- package/dist/definitions/data/index.d.ts.map +1 -0
- package/dist/definitions/data/list.d.ts +4 -0
- package/dist/definitions/data/list.d.ts.map +1 -0
- package/dist/definitions/data/table.d.ts +5 -0
- package/dist/definitions/data/table.d.ts.map +1 -0
- package/dist/definitions/form/button.d.ts +4 -0
- package/dist/definitions/form/button.d.ts.map +1 -0
- package/dist/definitions/form/checkbox.d.ts +3 -0
- package/dist/definitions/form/checkbox.d.ts.map +1 -0
- package/dist/definitions/form/file-upload.d.ts +3 -0
- package/dist/definitions/form/file-upload.d.ts.map +1 -0
- package/dist/definitions/form/form.d.ts +3 -0
- package/dist/definitions/form/form.d.ts.map +1 -0
- package/dist/definitions/form/index.d.ts +10 -0
- package/dist/definitions/form/index.d.ts.map +1 -0
- package/dist/definitions/form/input.d.ts +3 -0
- package/dist/definitions/form/input.d.ts.map +1 -0
- package/dist/definitions/form/radio.d.ts +5 -0
- package/dist/definitions/form/radio.d.ts.map +1 -0
- package/dist/definitions/form/select.d.ts +3 -0
- package/dist/definitions/form/select.d.ts.map +1 -0
- package/dist/definitions/form/switch.d.ts +3 -0
- package/dist/definitions/form/switch.d.ts.map +1 -0
- package/dist/definitions/form/textarea.d.ts +3 -0
- package/dist/definitions/form/textarea.d.ts.map +1 -0
- package/dist/definitions/index.cjs +3512 -0
- package/dist/definitions/index.cjs.map +1 -0
- package/dist/definitions/index.d.ts +12 -0
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/definitions/index.js +90 -0
- package/dist/definitions/index.js.map +1 -0
- package/dist/definitions/interactive/collapsible.d.ts +3 -0
- package/dist/definitions/interactive/collapsible.d.ts.map +1 -0
- package/dist/definitions/interactive/drawer.d.ts +3 -0
- package/dist/definitions/interactive/drawer.d.ts.map +1 -0
- package/dist/definitions/interactive/index.d.ts +4 -0
- package/dist/definitions/interactive/index.d.ts.map +1 -0
- package/dist/definitions/interactive/modal.d.ts +3 -0
- package/dist/definitions/interactive/modal.d.ts.map +1 -0
- package/dist/definitions/layout/columns.d.ts +3 -0
- package/dist/definitions/layout/columns.d.ts.map +1 -0
- package/dist/definitions/layout/container.d.ts +3 -0
- package/dist/definitions/layout/container.d.ts.map +1 -0
- package/dist/definitions/layout/flex.d.ts +7 -0
- package/dist/definitions/layout/flex.d.ts.map +1 -0
- package/dist/definitions/layout/grid.d.ts +7 -0
- package/dist/definitions/layout/grid.d.ts.map +1 -0
- package/dist/definitions/layout/index.d.ts +7 -0
- package/dist/definitions/layout/index.d.ts.map +1 -0
- package/dist/definitions/layout/page.d.ts +3 -0
- package/dist/definitions/layout/page.d.ts.map +1 -0
- package/dist/definitions/layout/section.d.ts +3 -0
- package/dist/definitions/layout/section.d.ts.map +1 -0
- package/dist/definitions/media/html-embed.d.ts +3 -0
- package/dist/definitions/media/html-embed.d.ts.map +1 -0
- package/dist/definitions/media/icon.d.ts +3 -0
- package/dist/definitions/media/icon.d.ts.map +1 -0
- package/dist/definitions/media/image.d.ts +3 -0
- package/dist/definitions/media/image.d.ts.map +1 -0
- package/dist/definitions/media/index.d.ts +5 -0
- package/dist/definitions/media/index.d.ts.map +1 -0
- package/dist/definitions/media/video.d.ts +3 -0
- package/dist/definitions/media/video.d.ts.map +1 -0
- package/dist/definitions/types.d.ts +5 -0
- package/dist/definitions/types.d.ts.map +1 -0
- package/dist/definitions/typography/badge.d.ts +3 -0
- package/dist/definitions/typography/badge.d.ts.map +1 -0
- package/dist/definitions/typography/blockquote.d.ts +3 -0
- package/dist/definitions/typography/blockquote.d.ts.map +1 -0
- package/dist/definitions/typography/code-block.d.ts +3 -0
- package/dist/definitions/typography/code-block.d.ts.map +1 -0
- package/dist/definitions/typography/heading.d.ts +3 -0
- package/dist/definitions/typography/heading.d.ts.map +1 -0
- package/dist/definitions/typography/index.d.ts +8 -0
- package/dist/definitions/typography/index.d.ts.map +1 -0
- package/dist/definitions/typography/link.d.ts +3 -0
- package/dist/definitions/typography/link.d.ts.map +1 -0
- package/dist/definitions/typography/paragraph.d.ts +3 -0
- package/dist/definitions/typography/paragraph.d.ts.map +1 -0
- package/dist/definitions/typography/text.d.ts +3 -0
- package/dist/definitions/typography/text.d.ts.map +1 -0
- package/dist/index.cjs +1568 -814
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +120 -4332
- package/dist/index.js.map +1 -1
- package/dist/traits/common.d.ts +8 -0
- package/dist/traits/common.d.ts.map +1 -0
- package/dist/{traits.d.ts → traits/form.d.ts} +2 -109
- package/dist/traits/form.d.ts.map +1 -0
- package/dist/traits/index.cjs +998 -0
- package/dist/traits/index.cjs.map +1 -0
- package/dist/traits/index.d.ts +7 -0
- package/dist/traits/index.d.ts.map +1 -0
- package/dist/traits/index.js +129 -0
- package/dist/traits/index.js.map +1 -0
- package/dist/traits/link.d.ts +8 -0
- package/dist/traits/link.d.ts.map +1 -0
- package/dist/traits/media.d.ts +18 -0
- package/dist/traits/media.d.ts.map +1 -0
- package/dist/traits/structure.d.ts +10 -0
- package/dist/traits/structure.d.ts.map +1 -0
- package/dist/traits/types.d.ts +69 -0
- package/dist/traits/types.d.ts.map +1 -0
- package/package.json +20 -4
- package/dist/blocks.d.ts.map +0 -1
- package/dist/definitions.d.ts +0 -37
- package/dist/definitions.d.ts.map +0 -1
- package/dist/traits.d.ts.map +0 -1
|
@@ -0,0 +1,3512 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/definitions/index.ts
|
|
21
|
+
var definitions_exports = {};
|
|
22
|
+
__export(definitions_exports, {
|
|
23
|
+
CONTENT_CHILD_TYPES: () => CONTENT_CHILD_TYPES,
|
|
24
|
+
LAYOUT_PARENTS: () => LAYOUT_PARENTS,
|
|
25
|
+
badgeDefinition: () => badgeDefinition,
|
|
26
|
+
blockquoteDefinition: () => blockquoteDefinition,
|
|
27
|
+
buttonDefinition: () => buttonDefinition,
|
|
28
|
+
buttonSubmitDefinition: () => buttonSubmitDefinition,
|
|
29
|
+
checkboxDefinition: () => checkboxDefinition,
|
|
30
|
+
codeBlockDefinition: () => codeBlockDefinition,
|
|
31
|
+
collapsibleDefinition: () => collapsibleDefinition,
|
|
32
|
+
collectionDefinition: () => collectionDefinition,
|
|
33
|
+
columnsDefinition: () => columnsDefinition,
|
|
34
|
+
containerDefinition: () => containerDefinition,
|
|
35
|
+
coreComponentDefinitions: () => coreComponentDefinitions,
|
|
36
|
+
createDefaultComponentRegistry: () => createDefaultComponentRegistry,
|
|
37
|
+
drawerDefinition: () => drawerDefinition,
|
|
38
|
+
fileUploadDefinition: () => fileUploadDefinition,
|
|
39
|
+
flexDefinition: () => flexDefinition,
|
|
40
|
+
formDefinition: () => formDefinition,
|
|
41
|
+
gridDefinition: () => gridDefinition,
|
|
42
|
+
headingDefinition: () => headingDefinition,
|
|
43
|
+
htmlEmbedDefinition: () => htmlEmbedDefinition,
|
|
44
|
+
iconDefinition: () => iconDefinition,
|
|
45
|
+
imageDefinition: () => imageDefinition,
|
|
46
|
+
inputDefinition: () => inputDefinition,
|
|
47
|
+
linkDefinition: () => linkDefinition,
|
|
48
|
+
listDefinition: () => listDefinition,
|
|
49
|
+
listItemDefinition: () => listItemDefinition,
|
|
50
|
+
modalDefinition: () => modalDefinition,
|
|
51
|
+
pageDefinition: () => pageDefinition,
|
|
52
|
+
paragraphDefinition: () => paragraphDefinition,
|
|
53
|
+
radioDefinition: () => radioDefinition,
|
|
54
|
+
radioGroupDefinition: () => radioGroupDefinition,
|
|
55
|
+
radioItemDefinition: () => radioItemDefinition,
|
|
56
|
+
sectionDefinition: () => sectionDefinition,
|
|
57
|
+
selectDefinition: () => selectDefinition,
|
|
58
|
+
switchDefinition: () => switchDefinition,
|
|
59
|
+
tableCellDefinition: () => tableCellDefinition,
|
|
60
|
+
tableDefinition: () => tableDefinition,
|
|
61
|
+
tableRowDefinition: () => tableRowDefinition,
|
|
62
|
+
textDefinition: () => textDefinition,
|
|
63
|
+
textareaDefinition: () => textareaDefinition,
|
|
64
|
+
videoDefinition: () => videoDefinition
|
|
65
|
+
});
|
|
66
|
+
module.exports = __toCommonJS(definitions_exports);
|
|
67
|
+
|
|
68
|
+
// src/registry.ts
|
|
69
|
+
var ComponentRegistry = class {
|
|
70
|
+
components = /* @__PURE__ */ new Map();
|
|
71
|
+
register(definition, allowOverride = false) {
|
|
72
|
+
if (!allowOverride && this.components.has(definition.type)) {
|
|
73
|
+
throw new Error(`Component type "${definition.type}" is already registered.`);
|
|
74
|
+
}
|
|
75
|
+
this.components.set(definition.type, definition);
|
|
76
|
+
}
|
|
77
|
+
unregister(type) {
|
|
78
|
+
return this.components.delete(type);
|
|
79
|
+
}
|
|
80
|
+
get(type) {
|
|
81
|
+
return this.components.get(type);
|
|
82
|
+
}
|
|
83
|
+
has(type) {
|
|
84
|
+
return this.components.has(type);
|
|
85
|
+
}
|
|
86
|
+
list() {
|
|
87
|
+
return Array.from(this.components.values());
|
|
88
|
+
}
|
|
89
|
+
listByCategory(category) {
|
|
90
|
+
return this.list().filter((c) => c.category === category);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check whether `childType` is a valid insertion target under `parentType`,
|
|
94
|
+
* covering both directions of child policy: the parent's `acceptsChildren`/
|
|
95
|
+
* `allowedChildren` (by type, category, or `'*'`) and the child's own
|
|
96
|
+
* `disallowedParents`. Used by the builder to reject an invalid insertion
|
|
97
|
+
* before a node is constructed, rather than after the fact via `validateNode`.
|
|
98
|
+
*/
|
|
99
|
+
canInsertChild(parentType, childType) {
|
|
100
|
+
const errors = [];
|
|
101
|
+
const parentDef = this.get(parentType);
|
|
102
|
+
const childDef = this.get(childType);
|
|
103
|
+
if (!parentDef) {
|
|
104
|
+
errors.push(`Unknown target parent type: "${parentType}".`);
|
|
105
|
+
}
|
|
106
|
+
if (!childDef) {
|
|
107
|
+
errors.push(`Unknown component type: "${childType}".`);
|
|
108
|
+
}
|
|
109
|
+
if (!parentDef || !childDef) {
|
|
110
|
+
return { valid: false, errors };
|
|
111
|
+
}
|
|
112
|
+
if (!parentDef.acceptsChildren) {
|
|
113
|
+
errors.push(`"${parentDef.label}" does not accept children.`);
|
|
114
|
+
} else if (parentDef.allowedChildren) {
|
|
115
|
+
const allowed = parentDef.allowedChildren.includes("*") || parentDef.allowedChildren.includes(childType) || parentDef.allowedChildren.includes(childDef.category);
|
|
116
|
+
if (!allowed) {
|
|
117
|
+
errors.push(`"${parentDef.label}" does not allow "${childDef.label}" as a child.`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (childDef.disallowedParents?.includes(parentType)) {
|
|
121
|
+
errors.push(`"${childDef.label}" is not allowed inside "${parentDef.label}".`);
|
|
122
|
+
}
|
|
123
|
+
return { valid: errors.length === 0, errors };
|
|
124
|
+
}
|
|
125
|
+
validateNode(node, parentType) {
|
|
126
|
+
const def = this.get(node.type);
|
|
127
|
+
const errors = [];
|
|
128
|
+
if (!def) {
|
|
129
|
+
errors.push(`Unknown component type: "${node.type}"`);
|
|
130
|
+
return { valid: false, errors };
|
|
131
|
+
}
|
|
132
|
+
if (!def.acceptsChildren && node.children && node.children.length > 0) {
|
|
133
|
+
errors.push(`Component "${node.type}" does not accept children.`);
|
|
134
|
+
}
|
|
135
|
+
if (def.allowedChildren && node.children) {
|
|
136
|
+
for (const child of node.children) {
|
|
137
|
+
const childCategory = this.get(child.type)?.category;
|
|
138
|
+
const allowed = def.allowedChildren.includes("*") || def.allowedChildren.includes(child.type) || childCategory !== void 0 && def.allowedChildren.includes(childCategory);
|
|
139
|
+
if (!allowed) {
|
|
140
|
+
errors.push(`Component "${node.type}" does not allow child type "${child.type}".`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (parentType && def.disallowedParents?.includes(parentType)) {
|
|
145
|
+
errors.push(`Component "${node.type}" is not allowed inside parent "${parentType}".`);
|
|
146
|
+
}
|
|
147
|
+
if (def.validateProps && node.props) {
|
|
148
|
+
const propResult = def.validateProps(node.props);
|
|
149
|
+
if (Array.isArray(propResult) && propResult.length > 0) {
|
|
150
|
+
errors.push(...propResult);
|
|
151
|
+
} else if (propResult === false) {
|
|
152
|
+
errors.push(`Props validation failed for component "${node.type}".`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return { valid: errors.length === 0, errors };
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// src/traits/types.ts
|
|
160
|
+
function withOverrides(base, overrides) {
|
|
161
|
+
return overrides ? { ...base, ...overrides } : base;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/traits/common.ts
|
|
165
|
+
function idTrait(overrides) {
|
|
166
|
+
return withOverrides(
|
|
167
|
+
{
|
|
168
|
+
name: "id",
|
|
169
|
+
label: "Element ID",
|
|
170
|
+
type: "string",
|
|
171
|
+
attribute: "id",
|
|
172
|
+
group: "identity",
|
|
173
|
+
description: "A custom, document-unique identifier used for anchors, CSS, and scripting."
|
|
174
|
+
},
|
|
175
|
+
overrides
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
function titleTrait(overrides) {
|
|
179
|
+
return withOverrides(
|
|
180
|
+
{
|
|
181
|
+
name: "title",
|
|
182
|
+
label: "Title",
|
|
183
|
+
type: "string",
|
|
184
|
+
attribute: "title",
|
|
185
|
+
group: "semantic",
|
|
186
|
+
description: "Advisory title for the element (tooltip / document title)."
|
|
187
|
+
},
|
|
188
|
+
overrides
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
function ariaLabelTrait(overrides) {
|
|
192
|
+
return withOverrides(
|
|
193
|
+
{
|
|
194
|
+
name: "ariaLabel",
|
|
195
|
+
label: "Accessible Label (aria-label)",
|
|
196
|
+
type: "string",
|
|
197
|
+
attribute: "aria-label",
|
|
198
|
+
group: "accessibility",
|
|
199
|
+
description: "Accessible name for assistive technology when no visible label exists."
|
|
200
|
+
},
|
|
201
|
+
overrides
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/traits/link.ts
|
|
206
|
+
function hrefTrait(overrides) {
|
|
207
|
+
return withOverrides(
|
|
208
|
+
{
|
|
209
|
+
name: "href",
|
|
210
|
+
label: "Link URL",
|
|
211
|
+
type: "string",
|
|
212
|
+
defaultValue: "#",
|
|
213
|
+
attribute: "href",
|
|
214
|
+
group: "link",
|
|
215
|
+
description: "The destination URL the element navigates to when activated."
|
|
216
|
+
},
|
|
217
|
+
overrides
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
function targetTrait(overrides) {
|
|
221
|
+
return withOverrides(
|
|
222
|
+
{
|
|
223
|
+
name: "target",
|
|
224
|
+
label: "Open In",
|
|
225
|
+
type: "select",
|
|
226
|
+
defaultValue: "_self",
|
|
227
|
+
attribute: "target",
|
|
228
|
+
group: "link",
|
|
229
|
+
options: [
|
|
230
|
+
{ label: "Same tab (_self)", value: "_self" },
|
|
231
|
+
{ label: "New tab (_blank)", value: "_blank" },
|
|
232
|
+
{ label: "Parent frame (_parent)", value: "_parent" },
|
|
233
|
+
{ label: "Top frame (_top)", value: "_top" }
|
|
234
|
+
],
|
|
235
|
+
description: "Where the linked resource should open."
|
|
236
|
+
},
|
|
237
|
+
overrides
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
function relTrait(overrides) {
|
|
241
|
+
return withOverrides(
|
|
242
|
+
{
|
|
243
|
+
name: "rel",
|
|
244
|
+
label: "Relationship (rel)",
|
|
245
|
+
type: "string",
|
|
246
|
+
defaultValue: "",
|
|
247
|
+
attribute: "rel",
|
|
248
|
+
group: "link",
|
|
249
|
+
description: 'Space-separated relationship tokens (e.g. "noopener noreferrer").'
|
|
250
|
+
},
|
|
251
|
+
overrides
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/traits/media.ts
|
|
256
|
+
function srcTrait(overrides) {
|
|
257
|
+
return withOverrides(
|
|
258
|
+
{
|
|
259
|
+
name: "src",
|
|
260
|
+
label: "Source URL",
|
|
261
|
+
type: "string",
|
|
262
|
+
attribute: "src",
|
|
263
|
+
group: "media",
|
|
264
|
+
required: true,
|
|
265
|
+
description: "The source URL of the media resource."
|
|
266
|
+
},
|
|
267
|
+
overrides
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
function altTrait(overrides) {
|
|
271
|
+
return withOverrides(
|
|
272
|
+
{
|
|
273
|
+
name: "alt",
|
|
274
|
+
label: "Alt Text",
|
|
275
|
+
type: "string",
|
|
276
|
+
attribute: "alt",
|
|
277
|
+
group: "accessibility",
|
|
278
|
+
required: true,
|
|
279
|
+
description: "Alternative text describing the media for screen readers and fallback."
|
|
280
|
+
},
|
|
281
|
+
overrides
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
function posterTrait(overrides) {
|
|
285
|
+
return withOverrides(
|
|
286
|
+
{
|
|
287
|
+
name: "poster",
|
|
288
|
+
label: "Poster Image URL",
|
|
289
|
+
type: "string",
|
|
290
|
+
attribute: "poster",
|
|
291
|
+
group: "media",
|
|
292
|
+
description: "A preview image shown before the video starts playing."
|
|
293
|
+
},
|
|
294
|
+
overrides
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
function controlsTrait(overrides) {
|
|
298
|
+
return withOverrides(
|
|
299
|
+
{
|
|
300
|
+
name: "controls",
|
|
301
|
+
label: "Show Controls",
|
|
302
|
+
type: "boolean",
|
|
303
|
+
defaultValue: true,
|
|
304
|
+
attribute: "controls",
|
|
305
|
+
group: "media",
|
|
306
|
+
description: "Whether to show the native play/pause/volume controls."
|
|
307
|
+
},
|
|
308
|
+
overrides
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
function autoplayTrait(overrides) {
|
|
312
|
+
return withOverrides(
|
|
313
|
+
{
|
|
314
|
+
name: "autoplay",
|
|
315
|
+
label: "Autoplay",
|
|
316
|
+
type: "boolean",
|
|
317
|
+
defaultValue: false,
|
|
318
|
+
attribute: "autoplay",
|
|
319
|
+
group: "media",
|
|
320
|
+
description: "Whether the media starts playing automatically on load."
|
|
321
|
+
},
|
|
322
|
+
overrides
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
function loopTrait(overrides) {
|
|
326
|
+
return withOverrides(
|
|
327
|
+
{
|
|
328
|
+
name: "loop",
|
|
329
|
+
label: "Loop",
|
|
330
|
+
type: "boolean",
|
|
331
|
+
defaultValue: false,
|
|
332
|
+
attribute: "loop",
|
|
333
|
+
group: "media",
|
|
334
|
+
description: "Whether the media restarts automatically when it reaches the end."
|
|
335
|
+
},
|
|
336
|
+
overrides
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
function mutedTrait(overrides) {
|
|
340
|
+
return withOverrides(
|
|
341
|
+
{
|
|
342
|
+
name: "muted",
|
|
343
|
+
label: "Muted",
|
|
344
|
+
type: "boolean",
|
|
345
|
+
defaultValue: false,
|
|
346
|
+
attribute: "muted",
|
|
347
|
+
group: "media",
|
|
348
|
+
description: "Whether the media starts with the audio muted."
|
|
349
|
+
},
|
|
350
|
+
overrides
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
function loadingTrait(overrides) {
|
|
354
|
+
return withOverrides(
|
|
355
|
+
{
|
|
356
|
+
name: "loading",
|
|
357
|
+
label: "Loading Mode",
|
|
358
|
+
type: "select",
|
|
359
|
+
defaultValue: "lazy",
|
|
360
|
+
attribute: "loading",
|
|
361
|
+
group: "media",
|
|
362
|
+
options: [
|
|
363
|
+
{ label: "Lazy (load when near viewport)", value: "lazy" },
|
|
364
|
+
{ label: "Eager (load immediately)", value: "eager" }
|
|
365
|
+
],
|
|
366
|
+
description: "Native loading hint: lazy defers offscreen images, eager loads immediately."
|
|
367
|
+
},
|
|
368
|
+
overrides
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// src/traits/structure.ts
|
|
373
|
+
function citeTrait(overrides) {
|
|
374
|
+
return withOverrides(
|
|
375
|
+
{
|
|
376
|
+
name: "cite",
|
|
377
|
+
label: "Citation URL (cite)",
|
|
378
|
+
type: "string",
|
|
379
|
+
attribute: "cite",
|
|
380
|
+
group: "semantic",
|
|
381
|
+
description: "The URL of the source document the quote is taken from."
|
|
382
|
+
},
|
|
383
|
+
overrides
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
function colSpanTrait(overrides) {
|
|
387
|
+
return withOverrides(
|
|
388
|
+
{
|
|
389
|
+
name: "colSpan",
|
|
390
|
+
label: "Column Span (colSpan)",
|
|
391
|
+
type: "number",
|
|
392
|
+
defaultValue: 1,
|
|
393
|
+
attribute: "colspan",
|
|
394
|
+
group: "semantic",
|
|
395
|
+
description: "The number of columns the cell spans."
|
|
396
|
+
},
|
|
397
|
+
overrides
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
function rowSpanTrait(overrides) {
|
|
401
|
+
return withOverrides(
|
|
402
|
+
{
|
|
403
|
+
name: "rowSpan",
|
|
404
|
+
label: "Row Span (rowSpan)",
|
|
405
|
+
type: "number",
|
|
406
|
+
defaultValue: 1,
|
|
407
|
+
attribute: "rowspan",
|
|
408
|
+
group: "semantic",
|
|
409
|
+
description: "The number of rows the cell spans."
|
|
410
|
+
},
|
|
411
|
+
overrides
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// src/traits/form.ts
|
|
416
|
+
function placeholderTrait(overrides) {
|
|
417
|
+
return withOverrides(
|
|
418
|
+
{
|
|
419
|
+
name: "placeholder",
|
|
420
|
+
label: "Placeholder",
|
|
421
|
+
type: "string",
|
|
422
|
+
attribute: "placeholder",
|
|
423
|
+
group: "form",
|
|
424
|
+
description: "Hint text shown inside the control when it is empty."
|
|
425
|
+
},
|
|
426
|
+
overrides
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function fieldNameTrait(overrides) {
|
|
430
|
+
return withOverrides(
|
|
431
|
+
{
|
|
432
|
+
name: "name",
|
|
433
|
+
label: "Field Name",
|
|
434
|
+
type: "string",
|
|
435
|
+
attribute: "name",
|
|
436
|
+
group: "form",
|
|
437
|
+
required: true,
|
|
438
|
+
description: "The name submitted with the form data for this field."
|
|
439
|
+
},
|
|
440
|
+
overrides
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
function requiredTrait(overrides) {
|
|
444
|
+
return withOverrides(
|
|
445
|
+
{
|
|
446
|
+
name: "required",
|
|
447
|
+
label: "Required",
|
|
448
|
+
type: "boolean",
|
|
449
|
+
defaultValue: false,
|
|
450
|
+
attribute: "required",
|
|
451
|
+
group: "form",
|
|
452
|
+
description: "Whether the field must be filled before the form can be submitted."
|
|
453
|
+
},
|
|
454
|
+
overrides
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
function disabledTrait(overrides) {
|
|
458
|
+
return withOverrides(
|
|
459
|
+
{
|
|
460
|
+
name: "disabled",
|
|
461
|
+
label: "Disabled",
|
|
462
|
+
type: "boolean",
|
|
463
|
+
defaultValue: false,
|
|
464
|
+
attribute: "disabled",
|
|
465
|
+
group: "behavior",
|
|
466
|
+
description: "Disables the control so it cannot be focused or activated."
|
|
467
|
+
},
|
|
468
|
+
overrides
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
function readOnlyTrait(overrides) {
|
|
472
|
+
return withOverrides(
|
|
473
|
+
{
|
|
474
|
+
name: "readOnly",
|
|
475
|
+
label: "Read Only",
|
|
476
|
+
type: "boolean",
|
|
477
|
+
defaultValue: false,
|
|
478
|
+
attribute: "readonly",
|
|
479
|
+
group: "behavior",
|
|
480
|
+
description: "Prevents the user from modifying the control value."
|
|
481
|
+
},
|
|
482
|
+
overrides
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
function actionTrait(overrides) {
|
|
486
|
+
return withOverrides(
|
|
487
|
+
{
|
|
488
|
+
name: "action",
|
|
489
|
+
label: "Action URL",
|
|
490
|
+
type: "string",
|
|
491
|
+
attribute: "action",
|
|
492
|
+
group: "form",
|
|
493
|
+
description: "The URL the form data is submitted to."
|
|
494
|
+
},
|
|
495
|
+
overrides
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
function methodTrait(overrides) {
|
|
499
|
+
return withOverrides(
|
|
500
|
+
{
|
|
501
|
+
name: "method",
|
|
502
|
+
label: "Method",
|
|
503
|
+
type: "select",
|
|
504
|
+
defaultValue: "POST",
|
|
505
|
+
attribute: "method",
|
|
506
|
+
group: "form",
|
|
507
|
+
options: [
|
|
508
|
+
{ label: "POST", value: "POST" },
|
|
509
|
+
{ label: "GET", value: "GET" }
|
|
510
|
+
],
|
|
511
|
+
description: "The HTTP method used to submit the form."
|
|
512
|
+
},
|
|
513
|
+
overrides
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
function autoCompleteTrait(overrides) {
|
|
517
|
+
return withOverrides(
|
|
518
|
+
{
|
|
519
|
+
name: "autoComplete",
|
|
520
|
+
label: "Auto Complete",
|
|
521
|
+
type: "select",
|
|
522
|
+
defaultValue: "on",
|
|
523
|
+
attribute: "autocomplete",
|
|
524
|
+
group: "form",
|
|
525
|
+
options: [
|
|
526
|
+
{ label: "On", value: "on" },
|
|
527
|
+
{ label: "Off", value: "off" }
|
|
528
|
+
],
|
|
529
|
+
description: "Whether the browser may autofill values for this form."
|
|
530
|
+
},
|
|
531
|
+
overrides
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
function valueTrait(overrides) {
|
|
535
|
+
return withOverrides(
|
|
536
|
+
{
|
|
537
|
+
name: "value",
|
|
538
|
+
label: "Value",
|
|
539
|
+
type: "string",
|
|
540
|
+
attribute: "value",
|
|
541
|
+
group: "form",
|
|
542
|
+
description: "The value submitted with the form data when the control is selected."
|
|
543
|
+
},
|
|
544
|
+
overrides
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
function defaultCheckedTrait(overrides) {
|
|
548
|
+
return withOverrides(
|
|
549
|
+
{
|
|
550
|
+
name: "defaultChecked",
|
|
551
|
+
label: "Default Checked",
|
|
552
|
+
type: "boolean",
|
|
553
|
+
defaultValue: false,
|
|
554
|
+
attribute: "checked",
|
|
555
|
+
group: "form",
|
|
556
|
+
description: "Whether the control starts in the checked state."
|
|
557
|
+
},
|
|
558
|
+
overrides
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function defaultValueTrait(overrides) {
|
|
562
|
+
return withOverrides(
|
|
563
|
+
{
|
|
564
|
+
name: "defaultValue",
|
|
565
|
+
label: "Default Value",
|
|
566
|
+
type: "string",
|
|
567
|
+
attribute: "value",
|
|
568
|
+
group: "form",
|
|
569
|
+
description: "The initial value of the control before the user edits it."
|
|
570
|
+
},
|
|
571
|
+
overrides
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
function rowsTrait(overrides) {
|
|
575
|
+
return withOverrides(
|
|
576
|
+
{
|
|
577
|
+
name: "rows",
|
|
578
|
+
label: "Rows",
|
|
579
|
+
type: "number",
|
|
580
|
+
defaultValue: 4,
|
|
581
|
+
attribute: "rows",
|
|
582
|
+
group: "form",
|
|
583
|
+
description: "The number of visible text lines in the textarea."
|
|
584
|
+
},
|
|
585
|
+
overrides
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
function inputTypeTrait(overrides) {
|
|
589
|
+
return withOverrides(
|
|
590
|
+
{
|
|
591
|
+
name: "type",
|
|
592
|
+
label: "Input Type",
|
|
593
|
+
type: "select",
|
|
594
|
+
defaultValue: "text",
|
|
595
|
+
attribute: "type",
|
|
596
|
+
group: "form",
|
|
597
|
+
description: "The semantic input type of the control."
|
|
598
|
+
},
|
|
599
|
+
overrides
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
function buttonTypeTrait(overrides) {
|
|
603
|
+
return withOverrides(
|
|
604
|
+
{
|
|
605
|
+
name: "buttonType",
|
|
606
|
+
label: "Button Type",
|
|
607
|
+
type: "select",
|
|
608
|
+
defaultValue: "button",
|
|
609
|
+
attribute: "type",
|
|
610
|
+
group: "form",
|
|
611
|
+
options: [
|
|
612
|
+
{ label: "Button", value: "button" },
|
|
613
|
+
{ label: "Submit Form (submit)", value: "submit" },
|
|
614
|
+
{ label: "Reset Form (reset)", value: "reset" }
|
|
615
|
+
],
|
|
616
|
+
description: "The button\u2019s behavior inside a form."
|
|
617
|
+
},
|
|
618
|
+
overrides
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
function preventDefaultTrait(overrides) {
|
|
622
|
+
return withOverrides(
|
|
623
|
+
{
|
|
624
|
+
name: "preventDefault",
|
|
625
|
+
label: "Prevent Default",
|
|
626
|
+
type: "boolean",
|
|
627
|
+
defaultValue: true,
|
|
628
|
+
group: "form",
|
|
629
|
+
description: "Intercept the native browser submit and handle it via the KUBUILD action pipeline instead."
|
|
630
|
+
},
|
|
631
|
+
overrides
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
function scrollToFirstErrorTrait(overrides) {
|
|
635
|
+
return withOverrides(
|
|
636
|
+
{
|
|
637
|
+
name: "scrollToFirstError",
|
|
638
|
+
label: "Scroll to First Error",
|
|
639
|
+
type: "boolean",
|
|
640
|
+
defaultValue: true,
|
|
641
|
+
group: "form",
|
|
642
|
+
description: "Automatically scroll to and focus the first invalid field when submission fails validation."
|
|
643
|
+
},
|
|
644
|
+
overrides
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
function resetOnSubmitTrait(overrides) {
|
|
648
|
+
return withOverrides(
|
|
649
|
+
{
|
|
650
|
+
name: "resetOnSubmit",
|
|
651
|
+
label: "Reset on Submit",
|
|
652
|
+
type: "boolean",
|
|
653
|
+
defaultValue: false,
|
|
654
|
+
group: "form",
|
|
655
|
+
description: "Reset all fields to their initial values after a successful form submission."
|
|
656
|
+
},
|
|
657
|
+
overrides
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
function patternTrait(overrides) {
|
|
661
|
+
return withOverrides(
|
|
662
|
+
{
|
|
663
|
+
name: "pattern",
|
|
664
|
+
label: "Pattern (regex)",
|
|
665
|
+
type: "string",
|
|
666
|
+
attribute: "pattern",
|
|
667
|
+
group: "form",
|
|
668
|
+
description: "A regular expression the input value must match to pass validation."
|
|
669
|
+
},
|
|
670
|
+
overrides
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
function minLengthTrait(overrides) {
|
|
674
|
+
return withOverrides(
|
|
675
|
+
{
|
|
676
|
+
name: "minLength",
|
|
677
|
+
label: "Min Length",
|
|
678
|
+
type: "number",
|
|
679
|
+
attribute: "minlength",
|
|
680
|
+
group: "form",
|
|
681
|
+
description: "The minimum number of characters the user must enter."
|
|
682
|
+
},
|
|
683
|
+
overrides
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
function maxLengthTrait(overrides) {
|
|
687
|
+
return withOverrides(
|
|
688
|
+
{
|
|
689
|
+
name: "maxLength",
|
|
690
|
+
label: "Max Length",
|
|
691
|
+
type: "number",
|
|
692
|
+
attribute: "maxlength",
|
|
693
|
+
group: "form",
|
|
694
|
+
description: "The maximum number of characters the user is allowed to enter."
|
|
695
|
+
},
|
|
696
|
+
overrides
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
function prefixIconTrait(overrides) {
|
|
700
|
+
return withOverrides(
|
|
701
|
+
{
|
|
702
|
+
name: "prefixIcon",
|
|
703
|
+
label: "Prefix Icon",
|
|
704
|
+
type: "string",
|
|
705
|
+
group: "form",
|
|
706
|
+
description: 'Lucide icon name displayed before the input value (e.g. "mail", "search").'
|
|
707
|
+
},
|
|
708
|
+
overrides
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
function suffixIconTrait(overrides) {
|
|
712
|
+
return withOverrides(
|
|
713
|
+
{
|
|
714
|
+
name: "suffixIcon",
|
|
715
|
+
label: "Suffix Icon",
|
|
716
|
+
type: "string",
|
|
717
|
+
group: "form",
|
|
718
|
+
description: 'Lucide icon name displayed after the input value (e.g. "eye", "check").'
|
|
719
|
+
},
|
|
720
|
+
overrides
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
function helperTextTrait(overrides) {
|
|
724
|
+
return withOverrides(
|
|
725
|
+
{
|
|
726
|
+
name: "helperText",
|
|
727
|
+
label: "Helper Text",
|
|
728
|
+
type: "string",
|
|
729
|
+
group: "form",
|
|
730
|
+
description: 'A short message displayed below the input to guide the user (e.g. "Must be at least 8 characters").'
|
|
731
|
+
},
|
|
732
|
+
overrides
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
function resizeTrait(overrides) {
|
|
736
|
+
return withOverrides(
|
|
737
|
+
{
|
|
738
|
+
name: "resize",
|
|
739
|
+
label: "Resize",
|
|
740
|
+
type: "select",
|
|
741
|
+
defaultValue: "vertical",
|
|
742
|
+
group: "form",
|
|
743
|
+
options: [
|
|
744
|
+
{ label: "Vertical only", value: "vertical" },
|
|
745
|
+
{ label: "Horizontal only", value: "horizontal" },
|
|
746
|
+
{ label: "Both", value: "both" },
|
|
747
|
+
{ label: "None", value: "none" }
|
|
748
|
+
],
|
|
749
|
+
description: "Controls whether and how the user can resize the textarea."
|
|
750
|
+
},
|
|
751
|
+
overrides
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
function autoGrowTrait(overrides) {
|
|
755
|
+
return withOverrides(
|
|
756
|
+
{
|
|
757
|
+
name: "autoGrow",
|
|
758
|
+
label: "Auto Grow",
|
|
759
|
+
type: "boolean",
|
|
760
|
+
defaultValue: false,
|
|
761
|
+
group: "form",
|
|
762
|
+
description: "Automatically expand the textarea height to fit the content without scrolling."
|
|
763
|
+
},
|
|
764
|
+
overrides
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
function maxCharCountTrait(overrides) {
|
|
768
|
+
return withOverrides(
|
|
769
|
+
{
|
|
770
|
+
name: "maxCharCount",
|
|
771
|
+
label: "Max Character Count",
|
|
772
|
+
type: "number",
|
|
773
|
+
group: "form",
|
|
774
|
+
description: 'Maximum character limit displayed as a counter below the textarea (e.g. "120 / 500").'
|
|
775
|
+
},
|
|
776
|
+
overrides
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
function optionsListTrait(overrides) {
|
|
780
|
+
return withOverrides(
|
|
781
|
+
{
|
|
782
|
+
name: "options",
|
|
783
|
+
label: "Options",
|
|
784
|
+
type: "string",
|
|
785
|
+
group: "form",
|
|
786
|
+
description: "The list of dropdown options, each with a label and value. Editable via the inspector trait panel."
|
|
787
|
+
},
|
|
788
|
+
overrides
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
function labelTextTrait(overrides) {
|
|
792
|
+
return withOverrides(
|
|
793
|
+
{
|
|
794
|
+
name: "label",
|
|
795
|
+
label: "Label Text",
|
|
796
|
+
type: "string",
|
|
797
|
+
group: "form",
|
|
798
|
+
description: "The visible text label displayed alongside the control."
|
|
799
|
+
},
|
|
800
|
+
overrides
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
function indeterminateTrait(overrides) {
|
|
804
|
+
return withOverrides(
|
|
805
|
+
{
|
|
806
|
+
name: "indeterminate",
|
|
807
|
+
label: "Indeterminate",
|
|
808
|
+
type: "boolean",
|
|
809
|
+
defaultValue: false,
|
|
810
|
+
group: "form",
|
|
811
|
+
description: "Renders the checkbox in a mixed/indeterminate visual state (neither checked nor unchecked)."
|
|
812
|
+
},
|
|
813
|
+
overrides
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
function switchSizeTrait(overrides) {
|
|
817
|
+
return withOverrides(
|
|
818
|
+
{
|
|
819
|
+
name: "switchSize",
|
|
820
|
+
label: "Size",
|
|
821
|
+
type: "select",
|
|
822
|
+
defaultValue: "md",
|
|
823
|
+
group: "form",
|
|
824
|
+
options: [
|
|
825
|
+
{ label: "Small", value: "sm" },
|
|
826
|
+
{ label: "Medium", value: "md" },
|
|
827
|
+
{ label: "Large", value: "lg" }
|
|
828
|
+
],
|
|
829
|
+
description: "The visual size of the switch toggle."
|
|
830
|
+
},
|
|
831
|
+
overrides
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
function orientationTrait(overrides) {
|
|
835
|
+
return withOverrides(
|
|
836
|
+
{
|
|
837
|
+
name: "orientation",
|
|
838
|
+
label: "Orientation",
|
|
839
|
+
type: "select",
|
|
840
|
+
defaultValue: "vertical",
|
|
841
|
+
group: "form",
|
|
842
|
+
options: [
|
|
843
|
+
{ label: "Vertical", value: "vertical" },
|
|
844
|
+
{ label: "Horizontal", value: "horizontal" }
|
|
845
|
+
],
|
|
846
|
+
description: "The layout direction of the child controls (vertical stack or horizontal row)."
|
|
847
|
+
},
|
|
848
|
+
overrides
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
function defaultSelectedTrait(overrides) {
|
|
852
|
+
return withOverrides(
|
|
853
|
+
{
|
|
854
|
+
name: "defaultSelected",
|
|
855
|
+
label: "Default Selected",
|
|
856
|
+
type: "string",
|
|
857
|
+
group: "form",
|
|
858
|
+
description: "The value of the radio item that is selected by default."
|
|
859
|
+
},
|
|
860
|
+
overrides
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
function acceptTrait(overrides) {
|
|
864
|
+
return withOverrides(
|
|
865
|
+
{
|
|
866
|
+
name: "accept",
|
|
867
|
+
label: "Accepted File Types",
|
|
868
|
+
type: "string",
|
|
869
|
+
attribute: "accept",
|
|
870
|
+
defaultValue: "*/*",
|
|
871
|
+
group: "form",
|
|
872
|
+
description: 'Comma-separated list of MIME types or file extensions accepted (e.g. "image/*,.pdf,.docx").'
|
|
873
|
+
},
|
|
874
|
+
overrides
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
function maxFileSizeTrait(overrides) {
|
|
878
|
+
return withOverrides(
|
|
879
|
+
{
|
|
880
|
+
name: "maxFileSize",
|
|
881
|
+
label: "Max File Size (MB)",
|
|
882
|
+
type: "number",
|
|
883
|
+
defaultValue: 10,
|
|
884
|
+
group: "form",
|
|
885
|
+
description: "The maximum allowable file size in megabytes (MB)."
|
|
886
|
+
},
|
|
887
|
+
overrides
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
function multipleTrait(overrides) {
|
|
891
|
+
return withOverrides(
|
|
892
|
+
{
|
|
893
|
+
name: "multiple",
|
|
894
|
+
label: "Allow Multiple Files",
|
|
895
|
+
type: "boolean",
|
|
896
|
+
attribute: "multiple",
|
|
897
|
+
defaultValue: false,
|
|
898
|
+
group: "form",
|
|
899
|
+
description: "Allow multiple files to be selected and uploaded at once."
|
|
900
|
+
},
|
|
901
|
+
overrides
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
function showPreviewTrait(overrides) {
|
|
905
|
+
return withOverrides(
|
|
906
|
+
{
|
|
907
|
+
name: "showPreview",
|
|
908
|
+
label: "Show Preview",
|
|
909
|
+
type: "boolean",
|
|
910
|
+
defaultValue: true,
|
|
911
|
+
group: "form",
|
|
912
|
+
description: "Display an interactive preview (image thumbnail or file list with badges) for selected files."
|
|
913
|
+
},
|
|
914
|
+
overrides
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
function loadingTextTrait(overrides) {
|
|
918
|
+
return withOverrides(
|
|
919
|
+
{
|
|
920
|
+
name: "loadingText",
|
|
921
|
+
label: "Loading Text",
|
|
922
|
+
type: "string",
|
|
923
|
+
defaultValue: "Submitting...",
|
|
924
|
+
group: "behavior",
|
|
925
|
+
description: "Text displayed on the button while the form submission is in progress."
|
|
926
|
+
},
|
|
927
|
+
overrides
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
function showSpinnerTrait(overrides) {
|
|
931
|
+
return withOverrides(
|
|
932
|
+
{
|
|
933
|
+
name: "showSpinner",
|
|
934
|
+
label: "Show Loading Spinner",
|
|
935
|
+
type: "boolean",
|
|
936
|
+
defaultValue: true,
|
|
937
|
+
group: "behavior",
|
|
938
|
+
description: "Automatically show an animated loading spinner icon while form is submitting."
|
|
939
|
+
},
|
|
940
|
+
overrides
|
|
941
|
+
);
|
|
942
|
+
}
|
|
943
|
+
function autoDisableOnSubmitTrait(overrides) {
|
|
944
|
+
return withOverrides(
|
|
945
|
+
{
|
|
946
|
+
name: "autoDisableOnSubmit",
|
|
947
|
+
label: "Auto Disable on Submit",
|
|
948
|
+
type: "boolean",
|
|
949
|
+
defaultValue: true,
|
|
950
|
+
group: "behavior",
|
|
951
|
+
description: "Automatically disable the button to prevent duplicate submissions while the form is submitting."
|
|
952
|
+
},
|
|
953
|
+
overrides
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
// src/definitions/constants.ts
|
|
958
|
+
var LAYOUT_PARENTS = ["page", "section", "container", "columns", "flex", "grid", "modal", "drawer", "collapsible"];
|
|
959
|
+
var CONTENT_CHILD_TYPES = [
|
|
960
|
+
"heading",
|
|
961
|
+
"text",
|
|
962
|
+
"paragraph",
|
|
963
|
+
"link",
|
|
964
|
+
"blockquote",
|
|
965
|
+
"badge",
|
|
966
|
+
"code-block",
|
|
967
|
+
"image",
|
|
968
|
+
"video",
|
|
969
|
+
"icon",
|
|
970
|
+
"html-embed",
|
|
971
|
+
"button",
|
|
972
|
+
"button-submit",
|
|
973
|
+
"form",
|
|
974
|
+
"input",
|
|
975
|
+
"textarea",
|
|
976
|
+
"select",
|
|
977
|
+
"checkbox",
|
|
978
|
+
"switch",
|
|
979
|
+
"radio-group",
|
|
980
|
+
"radio",
|
|
981
|
+
"radio-item",
|
|
982
|
+
"file-upload",
|
|
983
|
+
"list",
|
|
984
|
+
"table",
|
|
985
|
+
"collection",
|
|
986
|
+
"custom",
|
|
987
|
+
"modal",
|
|
988
|
+
"drawer",
|
|
989
|
+
"collapsible"
|
|
990
|
+
];
|
|
991
|
+
|
|
992
|
+
// src/definitions/layout/page.ts
|
|
993
|
+
var pageDefinition = {
|
|
994
|
+
type: "page",
|
|
995
|
+
label: "Page",
|
|
996
|
+
category: "layout",
|
|
997
|
+
icon: "layout",
|
|
998
|
+
acceptsChildren: true,
|
|
999
|
+
allowedChildren: ["section", "custom"],
|
|
1000
|
+
disallowedParents: [...LAYOUT_PARENTS, ...CONTENT_CHILD_TYPES, "list-item", "table-row", "table-cell"],
|
|
1001
|
+
defaultProps: { title: "New Page" },
|
|
1002
|
+
traits: [
|
|
1003
|
+
titleTrait({ defaultValue: "New Page", description: "The document title shown in the browser tab and search results." }),
|
|
1004
|
+
idTrait()
|
|
1005
|
+
],
|
|
1006
|
+
defaultStyles: { base: { minHeight: "100vh", backgroundColor: "#ffffff" } }
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
// src/definitions/layout/section.ts
|
|
1010
|
+
var sectionDefinition = {
|
|
1011
|
+
type: "section",
|
|
1012
|
+
label: "Section",
|
|
1013
|
+
category: "layout",
|
|
1014
|
+
icon: "rows",
|
|
1015
|
+
acceptsChildren: true,
|
|
1016
|
+
allowedChildren: ["container", "columns", "flex", "grid", ...CONTENT_CHILD_TYPES],
|
|
1017
|
+
defaultProps: {},
|
|
1018
|
+
traits: [
|
|
1019
|
+
idTrait(),
|
|
1020
|
+
ariaLabelTrait({ description: "Accessible name for the section landmark." })
|
|
1021
|
+
],
|
|
1022
|
+
defaultStyles: {
|
|
1023
|
+
base: {
|
|
1024
|
+
paddingTop: "48px",
|
|
1025
|
+
paddingBottom: "48px",
|
|
1026
|
+
paddingLeft: "16px",
|
|
1027
|
+
paddingRight: "16px"
|
|
1028
|
+
},
|
|
1029
|
+
tablet: {
|
|
1030
|
+
paddingTop: "32px",
|
|
1031
|
+
paddingBottom: "32px"
|
|
1032
|
+
},
|
|
1033
|
+
mobile: {
|
|
1034
|
+
paddingTop: "24px",
|
|
1035
|
+
paddingBottom: "24px",
|
|
1036
|
+
paddingLeft: "16px",
|
|
1037
|
+
paddingRight: "16px"
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
// src/definitions/layout/container.ts
|
|
1043
|
+
var containerDefinition = {
|
|
1044
|
+
type: "container",
|
|
1045
|
+
label: "Container",
|
|
1046
|
+
category: "layout",
|
|
1047
|
+
icon: "box",
|
|
1048
|
+
acceptsChildren: true,
|
|
1049
|
+
allowedChildren: ["columns", "flex", "grid", ...CONTENT_CHILD_TYPES],
|
|
1050
|
+
defaultProps: { maxWidth: "1200px" },
|
|
1051
|
+
traits: [
|
|
1052
|
+
idTrait()
|
|
1053
|
+
],
|
|
1054
|
+
defaultStyles: {
|
|
1055
|
+
base: {
|
|
1056
|
+
maxWidth: "1200px",
|
|
1057
|
+
margin: "0 auto",
|
|
1058
|
+
width: "100%"
|
|
1059
|
+
},
|
|
1060
|
+
tablet: {
|
|
1061
|
+
maxWidth: "720px"
|
|
1062
|
+
},
|
|
1063
|
+
mobile: {
|
|
1064
|
+
maxWidth: "100%",
|
|
1065
|
+
paddingLeft: "16px",
|
|
1066
|
+
paddingRight: "16px"
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
// src/definitions/layout/columns.ts
|
|
1072
|
+
var columnsDefinition = {
|
|
1073
|
+
type: "columns",
|
|
1074
|
+
label: "Columns",
|
|
1075
|
+
category: "layout",
|
|
1076
|
+
icon: "columns",
|
|
1077
|
+
acceptsChildren: true,
|
|
1078
|
+
allowedChildren: ["container", "flex", "grid", ...CONTENT_CHILD_TYPES],
|
|
1079
|
+
defaultProps: { columns: 2, gap: "16px" },
|
|
1080
|
+
traits: [
|
|
1081
|
+
idTrait()
|
|
1082
|
+
],
|
|
1083
|
+
defaultStyles: {
|
|
1084
|
+
base: {
|
|
1085
|
+
display: "grid",
|
|
1086
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
1087
|
+
gap: "16px"
|
|
1088
|
+
},
|
|
1089
|
+
tablet: {
|
|
1090
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
1091
|
+
gap: "12px"
|
|
1092
|
+
},
|
|
1093
|
+
mobile: {
|
|
1094
|
+
gridTemplateColumns: "repeat(1, minmax(0, 1fr))",
|
|
1095
|
+
gap: "12px"
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
// src/definitions/layout/flex.ts
|
|
1101
|
+
var flexDefinition = {
|
|
1102
|
+
type: "flex",
|
|
1103
|
+
label: "Flex",
|
|
1104
|
+
category: "layout",
|
|
1105
|
+
icon: "flex",
|
|
1106
|
+
acceptsChildren: true,
|
|
1107
|
+
allowedChildren: ["*"],
|
|
1108
|
+
disallowedParents: ["page"],
|
|
1109
|
+
defaultProps: {},
|
|
1110
|
+
traits: [
|
|
1111
|
+
idTrait(),
|
|
1112
|
+
ariaLabelTrait({ description: "Accessible name for the flex container." })
|
|
1113
|
+
],
|
|
1114
|
+
defaultStyles: {
|
|
1115
|
+
base: {
|
|
1116
|
+
display: "flex",
|
|
1117
|
+
flexDirection: "column",
|
|
1118
|
+
gap: "16px"
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
// src/definitions/layout/grid.ts
|
|
1124
|
+
var gridDefinition = {
|
|
1125
|
+
type: "grid",
|
|
1126
|
+
label: "Grid",
|
|
1127
|
+
category: "layout",
|
|
1128
|
+
icon: "grid",
|
|
1129
|
+
acceptsChildren: true,
|
|
1130
|
+
allowedChildren: ["*"],
|
|
1131
|
+
disallowedParents: ["page"],
|
|
1132
|
+
defaultProps: {
|
|
1133
|
+
columns: 3,
|
|
1134
|
+
gap: "16px"
|
|
1135
|
+
},
|
|
1136
|
+
traits: [
|
|
1137
|
+
idTrait(),
|
|
1138
|
+
ariaLabelTrait({ description: "Accessible name for the grid container." })
|
|
1139
|
+
],
|
|
1140
|
+
defaultStyles: {
|
|
1141
|
+
base: {
|
|
1142
|
+
display: "grid",
|
|
1143
|
+
gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
|
|
1144
|
+
gap: "16px"
|
|
1145
|
+
},
|
|
1146
|
+
tablet: {
|
|
1147
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
1148
|
+
gap: "16px"
|
|
1149
|
+
},
|
|
1150
|
+
mobile: {
|
|
1151
|
+
gridTemplateColumns: "repeat(1, minmax(0, 1fr))",
|
|
1152
|
+
gap: "16px"
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
// src/definitions/typography/heading.ts
|
|
1158
|
+
var import_schema = require("@kubuild/schema");
|
|
1159
|
+
var headingDefinition = {
|
|
1160
|
+
type: "heading",
|
|
1161
|
+
label: "Heading",
|
|
1162
|
+
category: "typography",
|
|
1163
|
+
icon: "heading",
|
|
1164
|
+
acceptsChildren: false,
|
|
1165
|
+
defaultProps: { text: "Heading Text", level: 2 },
|
|
1166
|
+
propFields: [
|
|
1167
|
+
{ name: "text", label: "Text", type: "string", defaultValue: "Heading Text" },
|
|
1168
|
+
{
|
|
1169
|
+
name: "level",
|
|
1170
|
+
label: "Heading Level",
|
|
1171
|
+
type: "select",
|
|
1172
|
+
defaultValue: 2,
|
|
1173
|
+
options: [1, 2, 3, 4, 5, 6].map((level) => ({ label: `H${level}`, value: level }))
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
traits: [
|
|
1177
|
+
idTrait(),
|
|
1178
|
+
titleTrait({ description: "Advisory title shown when hovering the heading." }),
|
|
1179
|
+
ariaLabelTrait()
|
|
1180
|
+
],
|
|
1181
|
+
validateProps: (props) => {
|
|
1182
|
+
const errors = [];
|
|
1183
|
+
if (!(0, import_schema.isVariableBinding)(props.text) && (typeof props.text !== "string" || props.text.trim().length === 0)) {
|
|
1184
|
+
errors.push('Heading requires a non-empty "text".');
|
|
1185
|
+
}
|
|
1186
|
+
if (props.level !== void 0 && (typeof props.level !== "number" || props.level < 1 || props.level > 6)) {
|
|
1187
|
+
errors.push('Heading "level" must be a number between 1 and 6.');
|
|
1188
|
+
}
|
|
1189
|
+
return errors.length > 0 ? errors : true;
|
|
1190
|
+
},
|
|
1191
|
+
defaultStyles: {
|
|
1192
|
+
base: {
|
|
1193
|
+
fontSize: "32px",
|
|
1194
|
+
fontWeight: "700",
|
|
1195
|
+
color: "#111827",
|
|
1196
|
+
margin: "0 0 16px 0"
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
// src/definitions/typography/text.ts
|
|
1202
|
+
var import_schema2 = require("@kubuild/schema");
|
|
1203
|
+
var textDefinition = {
|
|
1204
|
+
type: "text",
|
|
1205
|
+
label: "Text",
|
|
1206
|
+
category: "typography",
|
|
1207
|
+
icon: "type",
|
|
1208
|
+
acceptsChildren: false,
|
|
1209
|
+
defaultProps: { content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." },
|
|
1210
|
+
propFields: [
|
|
1211
|
+
{ name: "content", label: "Content", type: "string", defaultValue: "Lorem ipsum dolor sit amet." }
|
|
1212
|
+
],
|
|
1213
|
+
traits: [
|
|
1214
|
+
idTrait(),
|
|
1215
|
+
titleTrait(),
|
|
1216
|
+
ariaLabelTrait()
|
|
1217
|
+
],
|
|
1218
|
+
validateProps: (props) => {
|
|
1219
|
+
if (!(0, import_schema2.isVariableBinding)(props.content) && (typeof props.content !== "string" || props.content.trim().length === 0)) {
|
|
1220
|
+
return ['Text requires a non-empty "content".'];
|
|
1221
|
+
}
|
|
1222
|
+
return true;
|
|
1223
|
+
},
|
|
1224
|
+
defaultStyles: {
|
|
1225
|
+
base: {
|
|
1226
|
+
fontSize: "16px",
|
|
1227
|
+
color: "#4b5563",
|
|
1228
|
+
lineHeight: "1.6"
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1233
|
+
// src/definitions/typography/paragraph.ts
|
|
1234
|
+
var import_schema3 = require("@kubuild/schema");
|
|
1235
|
+
var paragraphDefinition = {
|
|
1236
|
+
type: "paragraph",
|
|
1237
|
+
label: "Paragraph",
|
|
1238
|
+
category: "typography",
|
|
1239
|
+
icon: "paragraph",
|
|
1240
|
+
acceptsChildren: false,
|
|
1241
|
+
defaultProps: {
|
|
1242
|
+
text: "A paragraph of text with clean semantic typography."
|
|
1243
|
+
},
|
|
1244
|
+
propFields: [
|
|
1245
|
+
{
|
|
1246
|
+
name: "text",
|
|
1247
|
+
label: "Text",
|
|
1248
|
+
type: "string",
|
|
1249
|
+
defaultValue: "A paragraph of text with clean semantic typography."
|
|
1250
|
+
}
|
|
1251
|
+
],
|
|
1252
|
+
traits: [
|
|
1253
|
+
idTrait(),
|
|
1254
|
+
titleTrait(),
|
|
1255
|
+
ariaLabelTrait()
|
|
1256
|
+
],
|
|
1257
|
+
validateProps: (props) => {
|
|
1258
|
+
const errors = [];
|
|
1259
|
+
const textVal = props.text ?? props.content;
|
|
1260
|
+
if (textVal !== void 0 && !(0, import_schema3.isVariableBinding)(textVal) && (typeof textVal !== "string" || textVal.trim().length === 0)) {
|
|
1261
|
+
errors.push('Paragraph requires a non-empty "text".');
|
|
1262
|
+
}
|
|
1263
|
+
return errors.length > 0 ? errors : true;
|
|
1264
|
+
},
|
|
1265
|
+
defaultStyles: {
|
|
1266
|
+
base: {
|
|
1267
|
+
fontSize: "16px",
|
|
1268
|
+
color: "#4b5563",
|
|
1269
|
+
lineHeight: "1.6",
|
|
1270
|
+
margin: "0 0 16px 0"
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1275
|
+
// src/definitions/typography/link.ts
|
|
1276
|
+
var import_schema4 = require("@kubuild/schema");
|
|
1277
|
+
var linkDefinition = {
|
|
1278
|
+
type: "link",
|
|
1279
|
+
label: "Link",
|
|
1280
|
+
category: "typography",
|
|
1281
|
+
icon: "link",
|
|
1282
|
+
acceptsChildren: false,
|
|
1283
|
+
defaultProps: {
|
|
1284
|
+
text: "Click here",
|
|
1285
|
+
href: "#",
|
|
1286
|
+
target: "_self",
|
|
1287
|
+
rel: ""
|
|
1288
|
+
},
|
|
1289
|
+
propFields: [
|
|
1290
|
+
{ name: "text", label: "Link Text", type: "string", defaultValue: "Click here" },
|
|
1291
|
+
{ name: "href", label: "URL (href)", type: "string", defaultValue: "#" },
|
|
1292
|
+
{
|
|
1293
|
+
name: "target",
|
|
1294
|
+
label: "Target",
|
|
1295
|
+
type: "select",
|
|
1296
|
+
defaultValue: "_self",
|
|
1297
|
+
options: [
|
|
1298
|
+
{ label: "Same tab (_self)", value: "_self" },
|
|
1299
|
+
{ label: "New tab (_blank)", value: "_blank" },
|
|
1300
|
+
{ label: "Parent (_parent)", value: "_parent" },
|
|
1301
|
+
{ label: "Top (_top)", value: "_top" }
|
|
1302
|
+
]
|
|
1303
|
+
},
|
|
1304
|
+
{ name: "rel", label: "Relationship (rel)", type: "string", defaultValue: "" }
|
|
1305
|
+
],
|
|
1306
|
+
traits: [
|
|
1307
|
+
hrefTrait(),
|
|
1308
|
+
targetTrait(),
|
|
1309
|
+
relTrait(),
|
|
1310
|
+
idTrait(),
|
|
1311
|
+
titleTrait({ description: "Advisory title shown when hovering the link." }),
|
|
1312
|
+
ariaLabelTrait()
|
|
1313
|
+
],
|
|
1314
|
+
validateProps: (props) => {
|
|
1315
|
+
const errors = [];
|
|
1316
|
+
if (props.text !== void 0 && !(0, import_schema4.isVariableBinding)(props.text) && (typeof props.text !== "string" || props.text.trim().length === 0)) {
|
|
1317
|
+
errors.push('Link requires a non-empty "text".');
|
|
1318
|
+
}
|
|
1319
|
+
if (props.href !== void 0 && typeof props.href !== "string" && !(0, import_schema4.isVariableBinding)(props.href)) {
|
|
1320
|
+
errors.push('Link "href" must be a string when provided.');
|
|
1321
|
+
}
|
|
1322
|
+
if (props.target !== void 0 && !(0, import_schema4.isVariableBinding)(props.target)) {
|
|
1323
|
+
const allowedTargets = ["_self", "_blank", "_parent", "_top"];
|
|
1324
|
+
if (typeof props.target !== "string" || !allowedTargets.includes(props.target)) {
|
|
1325
|
+
errors.push(`Link "target" must be one of: ${allowedTargets.join(", ")}.`);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
if (props.rel !== void 0 && typeof props.rel !== "string" && !(0, import_schema4.isVariableBinding)(props.rel)) {
|
|
1329
|
+
errors.push('Link "rel" must be a string when provided.');
|
|
1330
|
+
}
|
|
1331
|
+
return errors.length > 0 ? errors : true;
|
|
1332
|
+
},
|
|
1333
|
+
defaultStyles: {
|
|
1334
|
+
base: {
|
|
1335
|
+
color: "#2563eb",
|
|
1336
|
+
textDecoration: "underline",
|
|
1337
|
+
cursor: "pointer"
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
// src/definitions/typography/blockquote.ts
|
|
1343
|
+
var import_schema5 = require("@kubuild/schema");
|
|
1344
|
+
var blockquoteDefinition = {
|
|
1345
|
+
type: "blockquote",
|
|
1346
|
+
label: "Blockquote",
|
|
1347
|
+
category: "typography",
|
|
1348
|
+
icon: "blockquote",
|
|
1349
|
+
acceptsChildren: true,
|
|
1350
|
+
allowedChildren: [
|
|
1351
|
+
"paragraph",
|
|
1352
|
+
"text",
|
|
1353
|
+
"heading",
|
|
1354
|
+
"link",
|
|
1355
|
+
"badge",
|
|
1356
|
+
"code-block",
|
|
1357
|
+
"image",
|
|
1358
|
+
"video",
|
|
1359
|
+
"icon",
|
|
1360
|
+
"html-embed",
|
|
1361
|
+
"custom"
|
|
1362
|
+
],
|
|
1363
|
+
defaultProps: {
|
|
1364
|
+
text: "\u201CSimplicity is the soul of efficiency.\u201D"
|
|
1365
|
+
},
|
|
1366
|
+
propFields: [
|
|
1367
|
+
{
|
|
1368
|
+
name: "text",
|
|
1369
|
+
label: "Quote Text",
|
|
1370
|
+
type: "string",
|
|
1371
|
+
defaultValue: "\u201CSimplicity is the soul of efficiency.\u201D"
|
|
1372
|
+
},
|
|
1373
|
+
{ name: "cite", label: "Citation URL (cite)", type: "string" }
|
|
1374
|
+
],
|
|
1375
|
+
traits: [
|
|
1376
|
+
citeTrait(),
|
|
1377
|
+
idTrait(),
|
|
1378
|
+
titleTrait(),
|
|
1379
|
+
ariaLabelTrait()
|
|
1380
|
+
],
|
|
1381
|
+
validateProps: (props) => {
|
|
1382
|
+
const errors = [];
|
|
1383
|
+
if (props.text !== void 0 && typeof props.text !== "string" && !(0, import_schema5.isVariableBinding)(props.text)) {
|
|
1384
|
+
errors.push('Blockquote "text" must be a string when provided.');
|
|
1385
|
+
}
|
|
1386
|
+
if (props.cite !== void 0 && typeof props.cite !== "string" && !(0, import_schema5.isVariableBinding)(props.cite)) {
|
|
1387
|
+
errors.push('Blockquote "cite" must be a string when provided.');
|
|
1388
|
+
}
|
|
1389
|
+
return errors.length > 0 ? errors : true;
|
|
1390
|
+
},
|
|
1391
|
+
defaultStyles: {
|
|
1392
|
+
base: {
|
|
1393
|
+
borderLeftWidth: "4px",
|
|
1394
|
+
borderLeftColor: "#3b82f6",
|
|
1395
|
+
borderLeftStyle: "solid",
|
|
1396
|
+
paddingTop: "8px",
|
|
1397
|
+
paddingBottom: "8px",
|
|
1398
|
+
paddingLeft: "16px",
|
|
1399
|
+
paddingRight: "12px",
|
|
1400
|
+
margin: "0 0 16px 0",
|
|
1401
|
+
fontStyle: "italic",
|
|
1402
|
+
color: "#4b5563",
|
|
1403
|
+
backgroundColor: "#f8fafc"
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
// src/definitions/typography/badge.ts
|
|
1409
|
+
var import_schema6 = require("@kubuild/schema");
|
|
1410
|
+
var badgeDefinition = {
|
|
1411
|
+
type: "badge",
|
|
1412
|
+
label: "Badge",
|
|
1413
|
+
category: "typography",
|
|
1414
|
+
icon: "badge",
|
|
1415
|
+
acceptsChildren: false,
|
|
1416
|
+
defaultProps: {
|
|
1417
|
+
text: "Badge",
|
|
1418
|
+
variant: "default"
|
|
1419
|
+
},
|
|
1420
|
+
propFields: [
|
|
1421
|
+
{ name: "text", label: "Badge Text", type: "string", defaultValue: "Badge" },
|
|
1422
|
+
{
|
|
1423
|
+
name: "variant",
|
|
1424
|
+
label: "Variant",
|
|
1425
|
+
type: "select",
|
|
1426
|
+
defaultValue: "default",
|
|
1427
|
+
options: [
|
|
1428
|
+
{ label: "Default", value: "default" },
|
|
1429
|
+
{ label: "Success", value: "success" },
|
|
1430
|
+
{ label: "Warning", value: "warning" },
|
|
1431
|
+
{ label: "Danger", value: "danger" },
|
|
1432
|
+
{ label: "Info", value: "info" }
|
|
1433
|
+
]
|
|
1434
|
+
}
|
|
1435
|
+
],
|
|
1436
|
+
traits: [
|
|
1437
|
+
idTrait(),
|
|
1438
|
+
titleTrait(),
|
|
1439
|
+
ariaLabelTrait()
|
|
1440
|
+
],
|
|
1441
|
+
validateProps: (props) => {
|
|
1442
|
+
const errors = [];
|
|
1443
|
+
if (props.text !== void 0 && !(0, import_schema6.isVariableBinding)(props.text) && (typeof props.text !== "string" || props.text.trim().length === 0)) {
|
|
1444
|
+
errors.push('Badge requires a non-empty "text".');
|
|
1445
|
+
}
|
|
1446
|
+
if (props.variant !== void 0 && typeof props.variant !== "string" && !(0, import_schema6.isVariableBinding)(props.variant)) {
|
|
1447
|
+
errors.push('Badge "variant" must be a string.');
|
|
1448
|
+
}
|
|
1449
|
+
return errors.length > 0 ? errors : true;
|
|
1450
|
+
},
|
|
1451
|
+
defaultStyles: {
|
|
1452
|
+
base: {
|
|
1453
|
+
display: "inline-flex",
|
|
1454
|
+
alignItems: "center",
|
|
1455
|
+
paddingLeft: "10px",
|
|
1456
|
+
paddingRight: "10px",
|
|
1457
|
+
paddingTop: "2px",
|
|
1458
|
+
paddingBottom: "2px",
|
|
1459
|
+
borderRadius: "9999px",
|
|
1460
|
+
fontSize: "12px",
|
|
1461
|
+
fontWeight: "500",
|
|
1462
|
+
lineHeight: "1.4",
|
|
1463
|
+
backgroundColor: "#e0e7ff",
|
|
1464
|
+
color: "#3730a3"
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
// src/definitions/typography/code-block.ts
|
|
1470
|
+
var import_schema7 = require("@kubuild/schema");
|
|
1471
|
+
var codeBlockDefinition = {
|
|
1472
|
+
type: "code-block",
|
|
1473
|
+
label: "Code Block",
|
|
1474
|
+
category: "typography",
|
|
1475
|
+
icon: "code-block",
|
|
1476
|
+
acceptsChildren: false,
|
|
1477
|
+
defaultProps: {
|
|
1478
|
+
code: 'console.log("Hello, world!");',
|
|
1479
|
+
language: "javascript"
|
|
1480
|
+
},
|
|
1481
|
+
propFields: [
|
|
1482
|
+
{
|
|
1483
|
+
name: "code",
|
|
1484
|
+
label: "Code",
|
|
1485
|
+
type: "textarea",
|
|
1486
|
+
defaultValue: 'console.log("Hello, world!");'
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
name: "language",
|
|
1490
|
+
label: "Language",
|
|
1491
|
+
type: "string",
|
|
1492
|
+
defaultValue: "javascript"
|
|
1493
|
+
}
|
|
1494
|
+
],
|
|
1495
|
+
traits: [
|
|
1496
|
+
idTrait(),
|
|
1497
|
+
titleTrait(),
|
|
1498
|
+
ariaLabelTrait({ description: "Accessible label describing what the code example shows." })
|
|
1499
|
+
],
|
|
1500
|
+
validateProps: (props) => {
|
|
1501
|
+
const errors = [];
|
|
1502
|
+
if (props.code !== void 0 && typeof props.code !== "string" && !(0, import_schema7.isVariableBinding)(props.code)) {
|
|
1503
|
+
errors.push('Code Block "code" must be a string when provided.');
|
|
1504
|
+
}
|
|
1505
|
+
if (props.language !== void 0 && typeof props.language !== "string" && !(0, import_schema7.isVariableBinding)(props.language)) {
|
|
1506
|
+
errors.push('Code Block "language" must be a string when provided.');
|
|
1507
|
+
}
|
|
1508
|
+
return errors.length > 0 ? errors : true;
|
|
1509
|
+
},
|
|
1510
|
+
defaultStyles: {
|
|
1511
|
+
base: {
|
|
1512
|
+
backgroundColor: "#1e293b",
|
|
1513
|
+
color: "#f8fafc",
|
|
1514
|
+
padding: "16px",
|
|
1515
|
+
borderRadius: "8px",
|
|
1516
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
1517
|
+
fontSize: "14px",
|
|
1518
|
+
lineHeight: "1.5",
|
|
1519
|
+
overflowX: "auto",
|
|
1520
|
+
margin: "0 0 16px 0",
|
|
1521
|
+
whiteSpace: "pre"
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// src/definitions/media/image.ts
|
|
1527
|
+
var import_schema8 = require("@kubuild/schema");
|
|
1528
|
+
var imageDefinition = {
|
|
1529
|
+
type: "image",
|
|
1530
|
+
label: "Image",
|
|
1531
|
+
category: "media",
|
|
1532
|
+
icon: "image",
|
|
1533
|
+
acceptsChildren: false,
|
|
1534
|
+
capabilities: ["assetProvider"],
|
|
1535
|
+
defaultProps: {
|
|
1536
|
+
src: "https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=800&auto=format&fit=crop&q=80",
|
|
1537
|
+
alt: "Default image",
|
|
1538
|
+
width: 600,
|
|
1539
|
+
height: 400
|
|
1540
|
+
},
|
|
1541
|
+
propFields: [
|
|
1542
|
+
{ name: "src", label: "Image URL", type: "string" },
|
|
1543
|
+
{ name: "asset", label: "Asset Reference", type: "json" },
|
|
1544
|
+
{ name: "alt", label: "Alt Text", type: "string", defaultValue: "Default image" },
|
|
1545
|
+
{ name: "width", label: "Width", type: "number" },
|
|
1546
|
+
{ name: "height", label: "Height", type: "number" }
|
|
1547
|
+
],
|
|
1548
|
+
traits: [
|
|
1549
|
+
srcTrait(),
|
|
1550
|
+
altTrait({ defaultValue: "Default image" }),
|
|
1551
|
+
loadingTrait(),
|
|
1552
|
+
idTrait(),
|
|
1553
|
+
titleTrait(),
|
|
1554
|
+
ariaLabelTrait({ description: "Override the alt text for assistive technology (rarely needed)." })
|
|
1555
|
+
],
|
|
1556
|
+
validateProps: (props) => {
|
|
1557
|
+
const errors = [];
|
|
1558
|
+
const hasSrc = typeof props.src === "string" && props.src.trim().length > 0 || (0, import_schema8.isVariableBinding)(props.src);
|
|
1559
|
+
const hasAsset = (0, import_schema8.isAssetReference)(props.asset);
|
|
1560
|
+
if (!hasSrc && !hasAsset) {
|
|
1561
|
+
errors.push('Image requires either a non-empty "src" URL or a valid "asset" reference.');
|
|
1562
|
+
}
|
|
1563
|
+
const hasAlt = typeof props.alt === "string" && props.alt.trim().length > 0 || (0, import_schema8.isVariableBinding)(props.alt);
|
|
1564
|
+
if (!hasAlt) {
|
|
1565
|
+
errors.push('Image requires non-empty "alt" text.');
|
|
1566
|
+
}
|
|
1567
|
+
return errors.length > 0 ? errors : true;
|
|
1568
|
+
},
|
|
1569
|
+
defaultStyles: {
|
|
1570
|
+
base: {
|
|
1571
|
+
maxWidth: "100%",
|
|
1572
|
+
height: "auto",
|
|
1573
|
+
borderRadius: "8px"
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
// src/definitions/media/video.ts
|
|
1579
|
+
var import_schema9 = require("@kubuild/schema");
|
|
1580
|
+
var videoDefinition = {
|
|
1581
|
+
type: "video",
|
|
1582
|
+
label: "Video",
|
|
1583
|
+
category: "media",
|
|
1584
|
+
icon: "video",
|
|
1585
|
+
acceptsChildren: false,
|
|
1586
|
+
defaultProps: {
|
|
1587
|
+
src: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
|
1588
|
+
provider: "auto",
|
|
1589
|
+
poster: "",
|
|
1590
|
+
controls: true,
|
|
1591
|
+
autoplay: false,
|
|
1592
|
+
loop: false,
|
|
1593
|
+
muted: false,
|
|
1594
|
+
aspectRatio: "16:9"
|
|
1595
|
+
},
|
|
1596
|
+
propFields: [
|
|
1597
|
+
{
|
|
1598
|
+
name: "src",
|
|
1599
|
+
label: "Video URL (HTML5, YouTube, Vimeo)",
|
|
1600
|
+
type: "string",
|
|
1601
|
+
defaultValue: "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
name: "provider",
|
|
1605
|
+
label: "Provider",
|
|
1606
|
+
type: "select",
|
|
1607
|
+
defaultValue: "auto",
|
|
1608
|
+
options: [
|
|
1609
|
+
{ label: "Auto Detect", value: "auto" },
|
|
1610
|
+
{ label: "HTML5 Video", value: "html5" },
|
|
1611
|
+
{ label: "YouTube Embed", value: "youtube" },
|
|
1612
|
+
{ label: "Vimeo Embed", value: "vimeo" }
|
|
1613
|
+
]
|
|
1614
|
+
},
|
|
1615
|
+
{ name: "poster", label: "Poster Image URL", type: "string", defaultValue: "" },
|
|
1616
|
+
{ name: "controls", label: "Show Controls", type: "boolean", defaultValue: true },
|
|
1617
|
+
{ name: "autoplay", label: "Autoplay", type: "boolean", defaultValue: false },
|
|
1618
|
+
{ name: "loop", label: "Loop", type: "boolean", defaultValue: false },
|
|
1619
|
+
{ name: "muted", label: "Muted", type: "boolean", defaultValue: false },
|
|
1620
|
+
{
|
|
1621
|
+
name: "aspectRatio",
|
|
1622
|
+
label: "Aspect Ratio",
|
|
1623
|
+
type: "select",
|
|
1624
|
+
defaultValue: "16:9",
|
|
1625
|
+
options: [
|
|
1626
|
+
{ label: "16:9 (Widescreen)", value: "16:9" },
|
|
1627
|
+
{ label: "4:3 (Standard)", value: "4:3" },
|
|
1628
|
+
{ label: "1:1 (Square)", value: "1:1" },
|
|
1629
|
+
{ label: "9:16 (Vertical)", value: "9:16" },
|
|
1630
|
+
{ label: "Auto", value: "auto" }
|
|
1631
|
+
]
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
1634
|
+
traits: [
|
|
1635
|
+
srcTrait(),
|
|
1636
|
+
posterTrait(),
|
|
1637
|
+
controlsTrait(),
|
|
1638
|
+
autoplayTrait(),
|
|
1639
|
+
loopTrait(),
|
|
1640
|
+
mutedTrait(),
|
|
1641
|
+
idTrait(),
|
|
1642
|
+
titleTrait(),
|
|
1643
|
+
ariaLabelTrait({ description: "Accessible name summarizing the video content." })
|
|
1644
|
+
],
|
|
1645
|
+
validateProps: (props) => {
|
|
1646
|
+
const errors = [];
|
|
1647
|
+
if (props.src !== void 0 && typeof props.src !== "string" && !(0, import_schema9.isVariableBinding)(props.src)) {
|
|
1648
|
+
errors.push('Video "src" must be a string when provided.');
|
|
1649
|
+
}
|
|
1650
|
+
if (props.provider !== void 0 && !(0, import_schema9.isVariableBinding)(props.provider)) {
|
|
1651
|
+
const allowed = ["auto", "html5", "youtube", "vimeo"];
|
|
1652
|
+
if (typeof props.provider !== "string" || !allowed.includes(props.provider)) {
|
|
1653
|
+
errors.push(`Video "provider" must be one of: ${allowed.join(", ")}.`);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
if (props.controls !== void 0 && typeof props.controls !== "boolean" && !(0, import_schema9.isVariableBinding)(props.controls)) {
|
|
1657
|
+
errors.push('Video "controls" must be a boolean.');
|
|
1658
|
+
}
|
|
1659
|
+
if (props.autoplay !== void 0 && typeof props.autoplay !== "boolean" && !(0, import_schema9.isVariableBinding)(props.autoplay)) {
|
|
1660
|
+
errors.push('Video "autoplay" must be a boolean.');
|
|
1661
|
+
}
|
|
1662
|
+
if (props.loop !== void 0 && typeof props.loop !== "boolean" && !(0, import_schema9.isVariableBinding)(props.loop)) {
|
|
1663
|
+
errors.push('Video "loop" must be a boolean.');
|
|
1664
|
+
}
|
|
1665
|
+
if (props.muted !== void 0 && typeof props.muted !== "boolean" && !(0, import_schema9.isVariableBinding)(props.muted)) {
|
|
1666
|
+
errors.push('Video "muted" must be a boolean.');
|
|
1667
|
+
}
|
|
1668
|
+
return errors.length > 0 ? errors : true;
|
|
1669
|
+
},
|
|
1670
|
+
defaultStyles: {
|
|
1671
|
+
base: {
|
|
1672
|
+
width: "100%",
|
|
1673
|
+
maxWidth: "800px",
|
|
1674
|
+
borderRadius: "8px",
|
|
1675
|
+
overflow: "hidden",
|
|
1676
|
+
display: "block",
|
|
1677
|
+
margin: "0 0 16px 0"
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
// src/definitions/media/icon.ts
|
|
1683
|
+
var import_schema10 = require("@kubuild/schema");
|
|
1684
|
+
var iconDefinition = {
|
|
1685
|
+
type: "icon",
|
|
1686
|
+
label: "Icon",
|
|
1687
|
+
category: "media",
|
|
1688
|
+
icon: "sparkles",
|
|
1689
|
+
acceptsChildren: false,
|
|
1690
|
+
defaultProps: {
|
|
1691
|
+
name: "star",
|
|
1692
|
+
size: 24,
|
|
1693
|
+
color: "#2563eb",
|
|
1694
|
+
strokeWidth: 2
|
|
1695
|
+
},
|
|
1696
|
+
propFields: [
|
|
1697
|
+
{ name: "name", label: "Icon Name (Lucide)", type: "string", defaultValue: "star" },
|
|
1698
|
+
{ name: "size", label: "Size (px)", type: "number", defaultValue: 24 },
|
|
1699
|
+
{ name: "color", label: "Color", type: "color", defaultValue: "#2563eb" },
|
|
1700
|
+
{ name: "strokeWidth", label: "Stroke Width", type: "number", defaultValue: 2 }
|
|
1701
|
+
],
|
|
1702
|
+
traits: [
|
|
1703
|
+
idTrait(),
|
|
1704
|
+
titleTrait(),
|
|
1705
|
+
ariaLabelTrait({ required: true, description: "Required: describes what the icon represents for screen readers." })
|
|
1706
|
+
],
|
|
1707
|
+
validateProps: (props) => {
|
|
1708
|
+
const errors = [];
|
|
1709
|
+
if (props.name !== void 0 && !(0, import_schema10.isVariableBinding)(props.name) && (typeof props.name !== "string" || props.name.trim().length === 0)) {
|
|
1710
|
+
errors.push('Icon requires a non-empty "name".');
|
|
1711
|
+
}
|
|
1712
|
+
if (props.size !== void 0 && !(0, import_schema10.isVariableBinding)(props.size)) {
|
|
1713
|
+
if (typeof props.size !== "number" || props.size < 0) {
|
|
1714
|
+
errors.push('Icon "size" must be a non-negative number.');
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
if (props.strokeWidth !== void 0 && !(0, import_schema10.isVariableBinding)(props.strokeWidth)) {
|
|
1718
|
+
if (typeof props.strokeWidth !== "number" || props.strokeWidth < 0) {
|
|
1719
|
+
errors.push('Icon "strokeWidth" must be a non-negative number.');
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
return errors.length > 0 ? errors : true;
|
|
1723
|
+
},
|
|
1724
|
+
defaultStyles: {
|
|
1725
|
+
base: {
|
|
1726
|
+
display: "inline-flex",
|
|
1727
|
+
alignItems: "center",
|
|
1728
|
+
justifyContent: "center"
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
// src/definitions/media/html-embed.ts
|
|
1734
|
+
var import_schema11 = require("@kubuild/schema");
|
|
1735
|
+
var htmlEmbedDefinition = {
|
|
1736
|
+
type: "html-embed",
|
|
1737
|
+
label: "HTML Embed",
|
|
1738
|
+
category: "custom",
|
|
1739
|
+
icon: "code",
|
|
1740
|
+
acceptsChildren: false,
|
|
1741
|
+
defaultProps: {
|
|
1742
|
+
html: '<div style="padding: 16px; background: #f1f5f9; border-radius: 8px; text-align: center; font-family: sans-serif; color: #475569;">Custom HTML Embed Content</div>'
|
|
1743
|
+
},
|
|
1744
|
+
propFields: [
|
|
1745
|
+
{
|
|
1746
|
+
name: "html",
|
|
1747
|
+
label: "HTML / Embed Code",
|
|
1748
|
+
type: "textarea",
|
|
1749
|
+
defaultValue: '<div style="padding: 16px; background: #f1f5f9; border-radius: 8px; text-align: center; font-family: sans-serif; color: #475569;">Custom HTML Embed Content</div>'
|
|
1750
|
+
}
|
|
1751
|
+
],
|
|
1752
|
+
traits: [
|
|
1753
|
+
idTrait(),
|
|
1754
|
+
ariaLabelTrait()
|
|
1755
|
+
],
|
|
1756
|
+
validateProps: (props) => {
|
|
1757
|
+
const errors = [];
|
|
1758
|
+
if (props.html !== void 0 && typeof props.html !== "string" && !(0, import_schema11.isVariableBinding)(props.html)) {
|
|
1759
|
+
errors.push('HTML Embed "html" must be a string.');
|
|
1760
|
+
}
|
|
1761
|
+
return errors.length > 0 ? errors : true;
|
|
1762
|
+
},
|
|
1763
|
+
defaultStyles: {
|
|
1764
|
+
base: {
|
|
1765
|
+
width: "100%",
|
|
1766
|
+
margin: "0 0 16px 0"
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1770
|
+
|
|
1771
|
+
// src/definitions/data/table.ts
|
|
1772
|
+
var import_schema12 = require("@kubuild/schema");
|
|
1773
|
+
var tableDefinition = {
|
|
1774
|
+
type: "table",
|
|
1775
|
+
label: "Table",
|
|
1776
|
+
category: "layout",
|
|
1777
|
+
icon: "table",
|
|
1778
|
+
acceptsChildren: true,
|
|
1779
|
+
allowedChildren: ["table-row"],
|
|
1780
|
+
defaultProps: {
|
|
1781
|
+
striped: false,
|
|
1782
|
+
bordered: true,
|
|
1783
|
+
compact: false
|
|
1784
|
+
},
|
|
1785
|
+
defaultChildren: [
|
|
1786
|
+
{
|
|
1787
|
+
type: "table-row",
|
|
1788
|
+
children: [
|
|
1789
|
+
{ type: "table-cell", props: { tag: "th", text: "Header 1" } },
|
|
1790
|
+
{ type: "table-cell", props: { tag: "th", text: "Header 2" } }
|
|
1791
|
+
]
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
type: "table-row",
|
|
1795
|
+
children: [
|
|
1796
|
+
{ type: "table-cell", props: { tag: "td", text: "Data 1" } },
|
|
1797
|
+
{ type: "table-cell", props: { tag: "td", text: "Data 2" } }
|
|
1798
|
+
]
|
|
1799
|
+
}
|
|
1800
|
+
],
|
|
1801
|
+
propFields: [
|
|
1802
|
+
{ name: "striped", label: "Striped Rows", type: "boolean", defaultValue: false },
|
|
1803
|
+
{ name: "bordered", label: "Bordered", type: "boolean", defaultValue: true },
|
|
1804
|
+
{ name: "compact", label: "Compact Spacing", type: "boolean", defaultValue: false }
|
|
1805
|
+
],
|
|
1806
|
+
traits: [
|
|
1807
|
+
idTrait(),
|
|
1808
|
+
ariaLabelTrait({ description: "Required: provides a caption summary for the table when no visible caption exists." })
|
|
1809
|
+
],
|
|
1810
|
+
validateProps: (props) => {
|
|
1811
|
+
const errors = [];
|
|
1812
|
+
if (props.striped !== void 0 && typeof props.striped !== "boolean" && !(0, import_schema12.isVariableBinding)(props.striped)) {
|
|
1813
|
+
errors.push('Table "striped" must be a boolean.');
|
|
1814
|
+
}
|
|
1815
|
+
if (props.bordered !== void 0 && typeof props.bordered !== "boolean" && !(0, import_schema12.isVariableBinding)(props.bordered)) {
|
|
1816
|
+
errors.push('Table "bordered" must be a boolean.');
|
|
1817
|
+
}
|
|
1818
|
+
if (props.compact !== void 0 && typeof props.compact !== "boolean" && !(0, import_schema12.isVariableBinding)(props.compact)) {
|
|
1819
|
+
errors.push('Table "compact" must be a boolean.');
|
|
1820
|
+
}
|
|
1821
|
+
return errors.length > 0 ? errors : true;
|
|
1822
|
+
},
|
|
1823
|
+
defaultStyles: {
|
|
1824
|
+
base: {
|
|
1825
|
+
width: "100%",
|
|
1826
|
+
margin: "0 0 16px 0",
|
|
1827
|
+
borderCollapse: "collapse"
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
var tableRowDefinition = {
|
|
1832
|
+
type: "table-row",
|
|
1833
|
+
label: "Table Row",
|
|
1834
|
+
category: "layout",
|
|
1835
|
+
icon: "table-row",
|
|
1836
|
+
acceptsChildren: true,
|
|
1837
|
+
allowedChildren: ["table-cell"],
|
|
1838
|
+
disallowedParents: ["page"],
|
|
1839
|
+
defaultProps: {},
|
|
1840
|
+
defaultChildren: [
|
|
1841
|
+
{ type: "table-cell", props: { tag: "td", text: "Data" } }
|
|
1842
|
+
],
|
|
1843
|
+
traits: [
|
|
1844
|
+
idTrait(),
|
|
1845
|
+
ariaLabelTrait()
|
|
1846
|
+
],
|
|
1847
|
+
defaultStyles: {
|
|
1848
|
+
base: {}
|
|
1849
|
+
}
|
|
1850
|
+
};
|
|
1851
|
+
var tableCellDefinition = {
|
|
1852
|
+
type: "table-cell",
|
|
1853
|
+
label: "Table Cell",
|
|
1854
|
+
category: "layout",
|
|
1855
|
+
icon: "table-cell",
|
|
1856
|
+
acceptsChildren: true,
|
|
1857
|
+
allowedChildren: [
|
|
1858
|
+
"heading",
|
|
1859
|
+
"text",
|
|
1860
|
+
"paragraph",
|
|
1861
|
+
"link",
|
|
1862
|
+
"blockquote",
|
|
1863
|
+
"badge",
|
|
1864
|
+
"code-block",
|
|
1865
|
+
"image",
|
|
1866
|
+
"video",
|
|
1867
|
+
"icon",
|
|
1868
|
+
"html-embed",
|
|
1869
|
+
"button",
|
|
1870
|
+
"list",
|
|
1871
|
+
"custom"
|
|
1872
|
+
],
|
|
1873
|
+
disallowedParents: ["page"],
|
|
1874
|
+
defaultProps: {
|
|
1875
|
+
tag: "td",
|
|
1876
|
+
text: "Cell",
|
|
1877
|
+
colSpan: 1,
|
|
1878
|
+
rowSpan: 1
|
|
1879
|
+
},
|
|
1880
|
+
propFields: [
|
|
1881
|
+
{
|
|
1882
|
+
name: "tag",
|
|
1883
|
+
label: "Cell Type",
|
|
1884
|
+
type: "select",
|
|
1885
|
+
defaultValue: "td",
|
|
1886
|
+
options: [
|
|
1887
|
+
{ label: "Data Cell (td)", value: "td" },
|
|
1888
|
+
{ label: "Header Cell (th)", value: "th" }
|
|
1889
|
+
]
|
|
1890
|
+
},
|
|
1891
|
+
{ name: "text", label: "Text", type: "string", defaultValue: "Cell" },
|
|
1892
|
+
{ name: "colSpan", label: "Column Span (colSpan)", type: "number", defaultValue: 1 },
|
|
1893
|
+
{ name: "rowSpan", label: "Row Span (rowSpan)", type: "number", defaultValue: 1 }
|
|
1894
|
+
],
|
|
1895
|
+
traits: [
|
|
1896
|
+
colSpanTrait(),
|
|
1897
|
+
rowSpanTrait(),
|
|
1898
|
+
idTrait(),
|
|
1899
|
+
ariaLabelTrait()
|
|
1900
|
+
],
|
|
1901
|
+
validateProps: (props) => {
|
|
1902
|
+
const errors = [];
|
|
1903
|
+
if (props.tag !== void 0 && !(0, import_schema12.isVariableBinding)(props.tag)) {
|
|
1904
|
+
if (props.tag !== "td" && props.tag !== "th") {
|
|
1905
|
+
errors.push('Table Cell "tag" must be either "td" or "th".');
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
if (props.colSpan !== void 0 && !(0, import_schema12.isVariableBinding)(props.colSpan)) {
|
|
1909
|
+
if (typeof props.colSpan !== "number" || props.colSpan < 1 || !Number.isInteger(props.colSpan)) {
|
|
1910
|
+
errors.push('Table Cell "colSpan" must be a positive integer (>= 1).');
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
if (props.rowSpan !== void 0 && !(0, import_schema12.isVariableBinding)(props.rowSpan)) {
|
|
1914
|
+
if (typeof props.rowSpan !== "number" || props.rowSpan < 1 || !Number.isInteger(props.rowSpan)) {
|
|
1915
|
+
errors.push('Table Cell "rowSpan" must be a positive integer (>= 1).');
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
if (props.text !== void 0 && typeof props.text !== "string" && !(0, import_schema12.isVariableBinding)(props.text)) {
|
|
1919
|
+
errors.push('Table Cell "text" must be a string when provided.');
|
|
1920
|
+
}
|
|
1921
|
+
return errors.length > 0 ? errors : true;
|
|
1922
|
+
},
|
|
1923
|
+
defaultStyles: {
|
|
1924
|
+
base: {
|
|
1925
|
+
padding: "8px 12px",
|
|
1926
|
+
borderWidth: "1px",
|
|
1927
|
+
borderColor: "#e2e8f0",
|
|
1928
|
+
borderStyle: "solid",
|
|
1929
|
+
textAlign: "left"
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
// src/definitions/data/list.ts
|
|
1935
|
+
var import_schema13 = require("@kubuild/schema");
|
|
1936
|
+
var listDefinition = {
|
|
1937
|
+
type: "list",
|
|
1938
|
+
label: "List",
|
|
1939
|
+
category: "typography",
|
|
1940
|
+
icon: "list",
|
|
1941
|
+
acceptsChildren: true,
|
|
1942
|
+
allowedChildren: ["list-item"],
|
|
1943
|
+
defaultProps: {
|
|
1944
|
+
tag: "ul",
|
|
1945
|
+
listStyleType: "disc"
|
|
1946
|
+
},
|
|
1947
|
+
defaultChildren: [
|
|
1948
|
+
{ type: "list-item", props: { text: "List item 1" } },
|
|
1949
|
+
{ type: "list-item", props: { text: "List item 2" } },
|
|
1950
|
+
{ type: "list-item", props: { text: "List item 3" } }
|
|
1951
|
+
],
|
|
1952
|
+
propFields: [
|
|
1953
|
+
{
|
|
1954
|
+
name: "tag",
|
|
1955
|
+
label: "Tag",
|
|
1956
|
+
type: "select",
|
|
1957
|
+
defaultValue: "ul",
|
|
1958
|
+
options: [
|
|
1959
|
+
{ label: "Unordered (ul)", value: "ul" },
|
|
1960
|
+
{ label: "Ordered (ol)", value: "ol" }
|
|
1961
|
+
]
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
name: "listStyleType",
|
|
1965
|
+
label: "List Style Type",
|
|
1966
|
+
type: "select",
|
|
1967
|
+
defaultValue: "disc",
|
|
1968
|
+
options: [
|
|
1969
|
+
{ label: "Disc", value: "disc" },
|
|
1970
|
+
{ label: "Circle", value: "circle" },
|
|
1971
|
+
{ label: "Square", value: "square" },
|
|
1972
|
+
{ label: "Decimal", value: "decimal" },
|
|
1973
|
+
{ label: "None", value: "none" },
|
|
1974
|
+
{ label: "Custom Icon", value: "custom-icon" }
|
|
1975
|
+
]
|
|
1976
|
+
}
|
|
1977
|
+
],
|
|
1978
|
+
traits: [
|
|
1979
|
+
idTrait(),
|
|
1980
|
+
ariaLabelTrait({ description: 'Accessible name for the list (e.g. "Navigation menu", "Features").' })
|
|
1981
|
+
],
|
|
1982
|
+
validateProps: (props) => {
|
|
1983
|
+
const errors = [];
|
|
1984
|
+
if (props.tag !== void 0 && !(0, import_schema13.isVariableBinding)(props.tag)) {
|
|
1985
|
+
if (props.tag !== "ul" && props.tag !== "ol") {
|
|
1986
|
+
errors.push('List "tag" must be either "ul" or "ol".');
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
if (props.listStyleType !== void 0 && !(0, import_schema13.isVariableBinding)(props.listStyleType)) {
|
|
1990
|
+
const allowed = ["disc", "circle", "square", "decimal", "none", "custom-icon"];
|
|
1991
|
+
if (typeof props.listStyleType !== "string" || !allowed.includes(props.listStyleType)) {
|
|
1992
|
+
errors.push(`List "listStyleType" must be one of: ${allowed.join(", ")}.`);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return errors.length > 0 ? errors : true;
|
|
1996
|
+
},
|
|
1997
|
+
defaultStyles: {
|
|
1998
|
+
base: {
|
|
1999
|
+
margin: "0 0 16px 0",
|
|
2000
|
+
paddingLeft: "24px"
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
var listItemDefinition = {
|
|
2005
|
+
type: "list-item",
|
|
2006
|
+
label: "List Item",
|
|
2007
|
+
category: "typography",
|
|
2008
|
+
icon: "list-item",
|
|
2009
|
+
acceptsChildren: true,
|
|
2010
|
+
allowedChildren: [
|
|
2011
|
+
"heading",
|
|
2012
|
+
"text",
|
|
2013
|
+
"paragraph",
|
|
2014
|
+
"link",
|
|
2015
|
+
"blockquote",
|
|
2016
|
+
"badge",
|
|
2017
|
+
"code-block",
|
|
2018
|
+
"image",
|
|
2019
|
+
"video",
|
|
2020
|
+
"icon",
|
|
2021
|
+
"html-embed",
|
|
2022
|
+
"button",
|
|
2023
|
+
"list",
|
|
2024
|
+
"custom"
|
|
2025
|
+
],
|
|
2026
|
+
defaultProps: {
|
|
2027
|
+
text: "List item"
|
|
2028
|
+
},
|
|
2029
|
+
propFields: [
|
|
2030
|
+
{
|
|
2031
|
+
name: "text",
|
|
2032
|
+
label: "Text",
|
|
2033
|
+
type: "string",
|
|
2034
|
+
defaultValue: "List item"
|
|
2035
|
+
}
|
|
2036
|
+
],
|
|
2037
|
+
traits: [
|
|
2038
|
+
idTrait(),
|
|
2039
|
+
titleTrait(),
|
|
2040
|
+
ariaLabelTrait()
|
|
2041
|
+
],
|
|
2042
|
+
validateProps: (props) => {
|
|
2043
|
+
const errors = [];
|
|
2044
|
+
if (props.text !== void 0 && typeof props.text !== "string" && !(0, import_schema13.isVariableBinding)(props.text)) {
|
|
2045
|
+
errors.push('List Item "text" must be a string when provided.');
|
|
2046
|
+
}
|
|
2047
|
+
return errors.length > 0 ? errors : true;
|
|
2048
|
+
},
|
|
2049
|
+
defaultStyles: {
|
|
2050
|
+
base: {
|
|
2051
|
+
margin: "4px 0",
|
|
2052
|
+
fontSize: "16px",
|
|
2053
|
+
color: "#374151",
|
|
2054
|
+
lineHeight: "1.5"
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
|
|
2059
|
+
// src/definitions/data/collection.ts
|
|
2060
|
+
var collectionDefinition = {
|
|
2061
|
+
type: "collection",
|
|
2062
|
+
label: "Collection",
|
|
2063
|
+
category: "data",
|
|
2064
|
+
icon: "database",
|
|
2065
|
+
acceptsChildren: true,
|
|
2066
|
+
defaultProps: {
|
|
2067
|
+
sourceKey: "items",
|
|
2068
|
+
itemAlias: "item"
|
|
2069
|
+
},
|
|
2070
|
+
propFields: [
|
|
2071
|
+
{ name: "sourceKey", label: "Source Variable", type: "string", defaultValue: "items" },
|
|
2072
|
+
{ name: "itemAlias", label: "Item Alias", type: "string", defaultValue: "item" }
|
|
2073
|
+
],
|
|
2074
|
+
traits: [
|
|
2075
|
+
idTrait(),
|
|
2076
|
+
ariaLabelTrait({ description: 'Accessible name summarizing the repeated collection (e.g. "Product list").' })
|
|
2077
|
+
]
|
|
2078
|
+
};
|
|
2079
|
+
|
|
2080
|
+
// src/definitions/form/button.ts
|
|
2081
|
+
var import_schema14 = require("@kubuild/schema");
|
|
2082
|
+
var buttonDefinition = {
|
|
2083
|
+
type: "button",
|
|
2084
|
+
label: "Button",
|
|
2085
|
+
category: "interactive",
|
|
2086
|
+
icon: "mouse-pointer",
|
|
2087
|
+
acceptsChildren: false,
|
|
2088
|
+
capabilities: ["actionRegistry"],
|
|
2089
|
+
defaultProps: {
|
|
2090
|
+
label: "Click Me",
|
|
2091
|
+
variant: "primary"
|
|
2092
|
+
},
|
|
2093
|
+
propFields: [
|
|
2094
|
+
{ name: "label", label: "Label", type: "string", defaultValue: "Click Me" },
|
|
2095
|
+
{ name: "href", label: "Link URL", type: "string" },
|
|
2096
|
+
{ name: "action", label: "Action", type: "action" },
|
|
2097
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2098
|
+
{
|
|
2099
|
+
name: "buttonType",
|
|
2100
|
+
label: "Button Type",
|
|
2101
|
+
type: "select",
|
|
2102
|
+
defaultValue: "button",
|
|
2103
|
+
options: [
|
|
2104
|
+
{ label: "Button", value: "button" },
|
|
2105
|
+
{ label: "Submit Form (submit)", value: "submit" },
|
|
2106
|
+
{ label: "Reset Form (reset)", value: "reset" }
|
|
2107
|
+
]
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
name: "variant",
|
|
2111
|
+
label: "Variant",
|
|
2112
|
+
type: "select",
|
|
2113
|
+
defaultValue: "primary",
|
|
2114
|
+
options: [
|
|
2115
|
+
{ label: "Primary", value: "primary" },
|
|
2116
|
+
{ label: "Secondary", value: "secondary" }
|
|
2117
|
+
]
|
|
2118
|
+
}
|
|
2119
|
+
],
|
|
2120
|
+
traits: [
|
|
2121
|
+
buttonTypeTrait(),
|
|
2122
|
+
disabledTrait(),
|
|
2123
|
+
hrefTrait({ description: "Optional URL \u2014 when set, the button renders as an anchor styled like a button." }),
|
|
2124
|
+
targetTrait({ description: "Where to open the href URL (only used when href is set)." }),
|
|
2125
|
+
relTrait({ description: "Relationship tokens (only used when href is set)." }),
|
|
2126
|
+
idTrait(),
|
|
2127
|
+
titleTrait(),
|
|
2128
|
+
ariaLabelTrait()
|
|
2129
|
+
],
|
|
2130
|
+
validateProps: (props) => {
|
|
2131
|
+
const errors = [];
|
|
2132
|
+
const hasLabel = typeof props.label === "string" && props.label.trim().length > 0 || (0, import_schema14.isVariableBinding)(props.label);
|
|
2133
|
+
if (!hasLabel) {
|
|
2134
|
+
errors.push('Button requires a non-empty "label".');
|
|
2135
|
+
}
|
|
2136
|
+
if (props.href !== void 0 && typeof props.href !== "string" && !(0, import_schema14.isVariableBinding)(props.href)) {
|
|
2137
|
+
errors.push('Button "href" must be a string when provided.');
|
|
2138
|
+
}
|
|
2139
|
+
if (props.buttonType !== void 0 && !(0, import_schema14.isVariableBinding)(props.buttonType)) {
|
|
2140
|
+
if (!["button", "submit", "reset"].includes(props.buttonType)) {
|
|
2141
|
+
errors.push('Button "buttonType" must be one of: "button", "submit", "reset".');
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
if (props.action !== void 0 && !(0, import_schema14.isActionBinding)(props.action)) {
|
|
2145
|
+
errors.push('Button "action" must be a valid action binding when provided.');
|
|
2146
|
+
}
|
|
2147
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema14.isVariableBinding)(props.disabled)) {
|
|
2148
|
+
errors.push('Button "disabled" must be a boolean when provided.');
|
|
2149
|
+
}
|
|
2150
|
+
return errors.length > 0 ? errors : true;
|
|
2151
|
+
},
|
|
2152
|
+
defaultStyles: {
|
|
2153
|
+
base: {
|
|
2154
|
+
backgroundColor: "#2563eb",
|
|
2155
|
+
color: "#ffffff",
|
|
2156
|
+
paddingTop: "10px",
|
|
2157
|
+
paddingBottom: "10px",
|
|
2158
|
+
paddingLeft: "20px",
|
|
2159
|
+
paddingRight: "20px",
|
|
2160
|
+
borderRadius: "6px",
|
|
2161
|
+
fontWeight: "500",
|
|
2162
|
+
fontSize: "15px",
|
|
2163
|
+
border: "none",
|
|
2164
|
+
cursor: "pointer"
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
var buttonSubmitDefinition = {
|
|
2169
|
+
type: "button-submit",
|
|
2170
|
+
label: "Submit Button",
|
|
2171
|
+
category: "form",
|
|
2172
|
+
icon: "send",
|
|
2173
|
+
acceptsChildren: false,
|
|
2174
|
+
capabilities: ["actionRegistry"],
|
|
2175
|
+
disallowedParents: ["page"],
|
|
2176
|
+
defaultProps: {
|
|
2177
|
+
label: "Submit",
|
|
2178
|
+
loadingText: "Submitting...",
|
|
2179
|
+
showSpinner: true,
|
|
2180
|
+
autoDisableOnSubmit: true,
|
|
2181
|
+
variant: "primary",
|
|
2182
|
+
disabled: false,
|
|
2183
|
+
buttonType: "submit"
|
|
2184
|
+
},
|
|
2185
|
+
propFields: [
|
|
2186
|
+
{ name: "label", label: "Label", type: "string", defaultValue: "Submit" },
|
|
2187
|
+
{ name: "loadingText", label: "Loading Text", type: "string", defaultValue: "Submitting..." },
|
|
2188
|
+
{ name: "showSpinner", label: "Show Loading Spinner", type: "boolean", defaultValue: true },
|
|
2189
|
+
{ name: "autoDisableOnSubmit", label: "Auto Disable on Submit", type: "boolean", defaultValue: true },
|
|
2190
|
+
{
|
|
2191
|
+
name: "buttonType",
|
|
2192
|
+
label: "Button Type",
|
|
2193
|
+
type: "select",
|
|
2194
|
+
defaultValue: "submit",
|
|
2195
|
+
options: [
|
|
2196
|
+
{ label: "Submit Form (submit)", value: "submit" },
|
|
2197
|
+
{ label: "Reset Form (reset)", value: "reset" }
|
|
2198
|
+
]
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
name: "variant",
|
|
2202
|
+
label: "Variant",
|
|
2203
|
+
type: "select",
|
|
2204
|
+
defaultValue: "primary",
|
|
2205
|
+
options: [
|
|
2206
|
+
{ label: "Primary", value: "primary" },
|
|
2207
|
+
{ label: "Secondary", value: "secondary" }
|
|
2208
|
+
]
|
|
2209
|
+
},
|
|
2210
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2211
|
+
{ name: "prefixIcon", label: "Prefix Icon", type: "string" },
|
|
2212
|
+
{ name: "suffixIcon", label: "Suffix Icon", type: "string" }
|
|
2213
|
+
],
|
|
2214
|
+
traits: [
|
|
2215
|
+
buttonTypeTrait({
|
|
2216
|
+
defaultValue: "submit",
|
|
2217
|
+
options: [
|
|
2218
|
+
{ label: "Submit Form (submit)", value: "submit" },
|
|
2219
|
+
{ label: "Reset Form (reset)", value: "reset" }
|
|
2220
|
+
]
|
|
2221
|
+
}),
|
|
2222
|
+
labelTextTrait({ defaultValue: "Submit", label: "Label" }),
|
|
2223
|
+
loadingTextTrait(),
|
|
2224
|
+
showSpinnerTrait(),
|
|
2225
|
+
autoDisableOnSubmitTrait(),
|
|
2226
|
+
disabledTrait(),
|
|
2227
|
+
prefixIconTrait(),
|
|
2228
|
+
suffixIconTrait(),
|
|
2229
|
+
idTrait(),
|
|
2230
|
+
titleTrait(),
|
|
2231
|
+
ariaLabelTrait()
|
|
2232
|
+
],
|
|
2233
|
+
validateProps: (props) => {
|
|
2234
|
+
const errors = [];
|
|
2235
|
+
const hasLabel = typeof props.label === "string" && props.label.trim().length > 0 || (0, import_schema14.isVariableBinding)(props.label);
|
|
2236
|
+
if (!hasLabel) {
|
|
2237
|
+
errors.push('Submit Button requires a non-empty "label".');
|
|
2238
|
+
}
|
|
2239
|
+
if (props.loadingText !== void 0 && typeof props.loadingText !== "string" && !(0, import_schema14.isVariableBinding)(props.loadingText)) {
|
|
2240
|
+
errors.push('Submit Button "loadingText" must be a string when provided.');
|
|
2241
|
+
}
|
|
2242
|
+
if (props.showSpinner !== void 0 && typeof props.showSpinner !== "boolean" && !(0, import_schema14.isVariableBinding)(props.showSpinner)) {
|
|
2243
|
+
errors.push('Submit Button "showSpinner" must be a boolean when provided.');
|
|
2244
|
+
}
|
|
2245
|
+
if (props.autoDisableOnSubmit !== void 0 && typeof props.autoDisableOnSubmit !== "boolean" && !(0, import_schema14.isVariableBinding)(props.autoDisableOnSubmit)) {
|
|
2246
|
+
errors.push('Submit Button "autoDisableOnSubmit" must be a boolean when provided.');
|
|
2247
|
+
}
|
|
2248
|
+
if (props.buttonType !== void 0 && !(0, import_schema14.isVariableBinding)(props.buttonType)) {
|
|
2249
|
+
if (!["submit", "reset", "button"].includes(props.buttonType)) {
|
|
2250
|
+
errors.push('Submit Button "buttonType" must be one of: "submit", "reset", "button".');
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema14.isVariableBinding)(props.disabled)) {
|
|
2254
|
+
errors.push('Submit Button "disabled" must be a boolean when provided.');
|
|
2255
|
+
}
|
|
2256
|
+
return errors.length > 0 ? errors : true;
|
|
2257
|
+
},
|
|
2258
|
+
defaultStyles: {
|
|
2259
|
+
base: {
|
|
2260
|
+
backgroundColor: "#2563eb",
|
|
2261
|
+
color: "#ffffff",
|
|
2262
|
+
paddingTop: "10px",
|
|
2263
|
+
paddingBottom: "10px",
|
|
2264
|
+
paddingLeft: "20px",
|
|
2265
|
+
paddingRight: "20px",
|
|
2266
|
+
borderRadius: "6px",
|
|
2267
|
+
fontWeight: "500",
|
|
2268
|
+
fontSize: "15px",
|
|
2269
|
+
border: "none",
|
|
2270
|
+
cursor: "pointer",
|
|
2271
|
+
display: "inline-flex",
|
|
2272
|
+
alignItems: "center",
|
|
2273
|
+
justifyContent: "center",
|
|
2274
|
+
gap: "8px"
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
};
|
|
2278
|
+
|
|
2279
|
+
// src/definitions/form/form.ts
|
|
2280
|
+
var import_schema15 = require("@kubuild/schema");
|
|
2281
|
+
var formDefinition = {
|
|
2282
|
+
type: "form",
|
|
2283
|
+
label: "Form",
|
|
2284
|
+
category: "form",
|
|
2285
|
+
icon: "form",
|
|
2286
|
+
acceptsChildren: true,
|
|
2287
|
+
allowedChildren: [
|
|
2288
|
+
...CONTENT_CHILD_TYPES,
|
|
2289
|
+
"container",
|
|
2290
|
+
"columns",
|
|
2291
|
+
"section"
|
|
2292
|
+
],
|
|
2293
|
+
disallowedParents: ["page"],
|
|
2294
|
+
defaultProps: {
|
|
2295
|
+
name: "contact_form",
|
|
2296
|
+
method: "POST",
|
|
2297
|
+
action: "",
|
|
2298
|
+
target: "_self",
|
|
2299
|
+
autoComplete: "on",
|
|
2300
|
+
preventDefault: true,
|
|
2301
|
+
scrollToFirstError: true,
|
|
2302
|
+
resetOnSubmit: false
|
|
2303
|
+
},
|
|
2304
|
+
defaultChildren: [
|
|
2305
|
+
{ type: "input", props: { name: "name", type: "text", placeholder: "Your Name", required: true } },
|
|
2306
|
+
{ type: "input", props: { name: "email", type: "email", placeholder: "Your Email", required: true } },
|
|
2307
|
+
{ type: "textarea", props: { name: "message", placeholder: "Your Message", rows: 4, required: true } },
|
|
2308
|
+
{ type: "checkbox", props: { name: "agree", label: "I agree to the terms and privacy policy", required: true } },
|
|
2309
|
+
{ type: "button", props: { label: "Send Message", variant: "primary", buttonType: "submit" } }
|
|
2310
|
+
],
|
|
2311
|
+
propFields: [
|
|
2312
|
+
{ name: "name", label: "Form Name", type: "string", defaultValue: "contact_form" },
|
|
2313
|
+
{ name: "action", label: "Action URL", type: "string" },
|
|
2314
|
+
{
|
|
2315
|
+
name: "method",
|
|
2316
|
+
label: "Method",
|
|
2317
|
+
type: "select",
|
|
2318
|
+
defaultValue: "POST",
|
|
2319
|
+
options: [
|
|
2320
|
+
{ label: "POST", value: "POST" },
|
|
2321
|
+
{ label: "GET", value: "GET" }
|
|
2322
|
+
]
|
|
2323
|
+
},
|
|
2324
|
+
{
|
|
2325
|
+
name: "target",
|
|
2326
|
+
label: "Target",
|
|
2327
|
+
type: "select",
|
|
2328
|
+
defaultValue: "_self",
|
|
2329
|
+
options: [
|
|
2330
|
+
{ label: "Same Window (_self)", value: "_self" },
|
|
2331
|
+
{ label: "New Tab (_blank)", value: "_blank" }
|
|
2332
|
+
]
|
|
2333
|
+
},
|
|
2334
|
+
{
|
|
2335
|
+
name: "autoComplete",
|
|
2336
|
+
label: "Auto Complete",
|
|
2337
|
+
type: "select",
|
|
2338
|
+
defaultValue: "on",
|
|
2339
|
+
options: [
|
|
2340
|
+
{ label: "On", value: "on" },
|
|
2341
|
+
{ label: "Off", value: "off" }
|
|
2342
|
+
]
|
|
2343
|
+
},
|
|
2344
|
+
{ name: "preventDefault", label: "Prevent Default", type: "boolean", defaultValue: true },
|
|
2345
|
+
{ name: "scrollToFirstError", label: "Scroll to First Error", type: "boolean", defaultValue: true },
|
|
2346
|
+
{ name: "resetOnSubmit", label: "Reset on Submit", type: "boolean", defaultValue: false }
|
|
2347
|
+
],
|
|
2348
|
+
traits: [
|
|
2349
|
+
fieldNameTrait({ defaultValue: "contact_form", required: false }),
|
|
2350
|
+
actionTrait(),
|
|
2351
|
+
methodTrait(),
|
|
2352
|
+
targetTrait({ options: [
|
|
2353
|
+
{ label: "Same Window (_self)", value: "_self" },
|
|
2354
|
+
{ label: "New Tab (_blank)", value: "_blank" },
|
|
2355
|
+
{ label: "Parent (_parent)", value: "_parent" },
|
|
2356
|
+
{ label: "Top (_top)", value: "_top" }
|
|
2357
|
+
] }),
|
|
2358
|
+
autoCompleteTrait(),
|
|
2359
|
+
preventDefaultTrait(),
|
|
2360
|
+
scrollToFirstErrorTrait(),
|
|
2361
|
+
resetOnSubmitTrait(),
|
|
2362
|
+
idTrait(),
|
|
2363
|
+
ariaLabelTrait({ description: "Accessible name for the form landmark." })
|
|
2364
|
+
],
|
|
2365
|
+
validateProps: (props) => {
|
|
2366
|
+
const errors = [];
|
|
2367
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema15.isVariableBinding)(props.name)) {
|
|
2368
|
+
errors.push('Form "name" must be a string when provided.');
|
|
2369
|
+
}
|
|
2370
|
+
if (props.action !== void 0 && typeof props.action !== "string" && !(0, import_schema15.isVariableBinding)(props.action)) {
|
|
2371
|
+
errors.push('Form "action" must be a string when provided.');
|
|
2372
|
+
}
|
|
2373
|
+
if (props.method !== void 0 && !(0, import_schema15.isVariableBinding)(props.method)) {
|
|
2374
|
+
if (!["GET", "POST", "get", "post"].includes(props.method)) {
|
|
2375
|
+
errors.push('Form "method" must be either "GET" or "POST".');
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
if (props.target !== void 0 && !(0, import_schema15.isVariableBinding)(props.target)) {
|
|
2379
|
+
if (!["_self", "_blank", "_parent", "_top"].includes(props.target)) {
|
|
2380
|
+
errors.push('Form "target" must be one of: "_self", "_blank", "_parent", "_top".');
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
if (props.autoComplete !== void 0 && !(0, import_schema15.isVariableBinding)(props.autoComplete)) {
|
|
2384
|
+
if (!["on", "off"].includes(props.autoComplete)) {
|
|
2385
|
+
errors.push('Form "autoComplete" must be either "on" or "off".');
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
if (props.preventDefault !== void 0 && typeof props.preventDefault !== "boolean" && !(0, import_schema15.isVariableBinding)(props.preventDefault)) {
|
|
2389
|
+
errors.push('Form "preventDefault" must be a boolean when provided.');
|
|
2390
|
+
}
|
|
2391
|
+
if (props.scrollToFirstError !== void 0 && typeof props.scrollToFirstError !== "boolean" && !(0, import_schema15.isVariableBinding)(props.scrollToFirstError)) {
|
|
2392
|
+
errors.push('Form "scrollToFirstError" must be a boolean when provided.');
|
|
2393
|
+
}
|
|
2394
|
+
if (props.resetOnSubmit !== void 0 && typeof props.resetOnSubmit !== "boolean" && !(0, import_schema15.isVariableBinding)(props.resetOnSubmit)) {
|
|
2395
|
+
errors.push('Form "resetOnSubmit" must be a boolean when provided.');
|
|
2396
|
+
}
|
|
2397
|
+
return errors.length > 0 ? errors : true;
|
|
2398
|
+
},
|
|
2399
|
+
defaultStyles: {
|
|
2400
|
+
base: {
|
|
2401
|
+
width: "100%",
|
|
2402
|
+
display: "flex",
|
|
2403
|
+
flexDirection: "column",
|
|
2404
|
+
gap: "16px"
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
// src/definitions/form/input.ts
|
|
2410
|
+
var import_schema16 = require("@kubuild/schema");
|
|
2411
|
+
var inputDefinition = {
|
|
2412
|
+
type: "input",
|
|
2413
|
+
label: "Input",
|
|
2414
|
+
category: "form",
|
|
2415
|
+
icon: "input",
|
|
2416
|
+
acceptsChildren: false,
|
|
2417
|
+
disallowedParents: ["page"],
|
|
2418
|
+
defaultProps: {
|
|
2419
|
+
name: "input_field",
|
|
2420
|
+
type: "text",
|
|
2421
|
+
placeholder: "Enter text...",
|
|
2422
|
+
defaultValue: "",
|
|
2423
|
+
required: false,
|
|
2424
|
+
disabled: false,
|
|
2425
|
+
readOnly: false,
|
|
2426
|
+
pattern: "",
|
|
2427
|
+
minLength: void 0,
|
|
2428
|
+
maxLength: void 0,
|
|
2429
|
+
prefixIcon: "",
|
|
2430
|
+
suffixIcon: "",
|
|
2431
|
+
helperText: ""
|
|
2432
|
+
},
|
|
2433
|
+
propFields: [
|
|
2434
|
+
{ name: "name", label: "Field Name", type: "string", defaultValue: "input_field" },
|
|
2435
|
+
{
|
|
2436
|
+
name: "type",
|
|
2437
|
+
label: "Input Type",
|
|
2438
|
+
type: "select",
|
|
2439
|
+
defaultValue: "text",
|
|
2440
|
+
options: [
|
|
2441
|
+
{ label: "Text", value: "text" },
|
|
2442
|
+
{ label: "Email", value: "email" },
|
|
2443
|
+
{ label: "Number", value: "number" },
|
|
2444
|
+
{ label: "Password", value: "password" },
|
|
2445
|
+
{ label: "Phone (tel)", value: "tel" },
|
|
2446
|
+
{ label: "URL", value: "url" },
|
|
2447
|
+
{ label: "Search", value: "search" },
|
|
2448
|
+
{ label: "Date", value: "date" }
|
|
2449
|
+
]
|
|
2450
|
+
},
|
|
2451
|
+
{ name: "placeholder", label: "Placeholder", type: "string", defaultValue: "Enter text..." },
|
|
2452
|
+
{ name: "defaultValue", label: "Default Value", type: "string" },
|
|
2453
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
2454
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2455
|
+
{ name: "readOnly", label: "Read Only", type: "boolean", defaultValue: false },
|
|
2456
|
+
{ name: "pattern", label: "Pattern (regex)", type: "string" },
|
|
2457
|
+
{ name: "minLength", label: "Min Length", type: "number" },
|
|
2458
|
+
{ name: "maxLength", label: "Max Length", type: "number" },
|
|
2459
|
+
{ name: "prefixIcon", label: "Prefix Icon", type: "string" },
|
|
2460
|
+
{ name: "suffixIcon", label: "Suffix Icon", type: "string" },
|
|
2461
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
2462
|
+
],
|
|
2463
|
+
traits: [
|
|
2464
|
+
inputTypeTrait({ options: [
|
|
2465
|
+
{ label: "Text", value: "text" },
|
|
2466
|
+
{ label: "Email", value: "email" },
|
|
2467
|
+
{ label: "Number", value: "number" },
|
|
2468
|
+
{ label: "Password", value: "password" },
|
|
2469
|
+
{ label: "Phone (tel)", value: "tel" },
|
|
2470
|
+
{ label: "URL", value: "url" },
|
|
2471
|
+
{ label: "Search", value: "search" },
|
|
2472
|
+
{ label: "Date", value: "date" },
|
|
2473
|
+
{ label: "Hidden", value: "hidden" }
|
|
2474
|
+
] }),
|
|
2475
|
+
fieldNameTrait({ defaultValue: "input_field" }),
|
|
2476
|
+
placeholderTrait({ defaultValue: "Enter text..." }),
|
|
2477
|
+
defaultValueTrait(),
|
|
2478
|
+
requiredTrait(),
|
|
2479
|
+
patternTrait(),
|
|
2480
|
+
minLengthTrait(),
|
|
2481
|
+
maxLengthTrait(),
|
|
2482
|
+
prefixIconTrait(),
|
|
2483
|
+
suffixIconTrait(),
|
|
2484
|
+
helperTextTrait(),
|
|
2485
|
+
disabledTrait(),
|
|
2486
|
+
readOnlyTrait(),
|
|
2487
|
+
idTrait(),
|
|
2488
|
+
ariaLabelTrait()
|
|
2489
|
+
],
|
|
2490
|
+
validateProps: (props) => {
|
|
2491
|
+
const errors = [];
|
|
2492
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema16.isVariableBinding)(props.name)) {
|
|
2493
|
+
errors.push('Input "name" must be a string when provided.');
|
|
2494
|
+
}
|
|
2495
|
+
if (props.type !== void 0 && !(0, import_schema16.isVariableBinding)(props.type)) {
|
|
2496
|
+
const validTypes = ["text", "email", "number", "password", "tel", "url", "search", "date", "hidden"];
|
|
2497
|
+
if (!validTypes.includes(props.type)) {
|
|
2498
|
+
errors.push(`Input "type" must be one of: ${validTypes.join(", ")}.`);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
if (props.placeholder !== void 0 && typeof props.placeholder !== "string" && !(0, import_schema16.isVariableBinding)(props.placeholder)) {
|
|
2502
|
+
errors.push('Input "placeholder" must be a string when provided.');
|
|
2503
|
+
}
|
|
2504
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema16.isVariableBinding)(props.required)) {
|
|
2505
|
+
errors.push('Input "required" must be a boolean when provided.');
|
|
2506
|
+
}
|
|
2507
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema16.isVariableBinding)(props.disabled)) {
|
|
2508
|
+
errors.push('Input "disabled" must be a boolean when provided.');
|
|
2509
|
+
}
|
|
2510
|
+
if (props.readOnly !== void 0 && typeof props.readOnly !== "boolean" && !(0, import_schema16.isVariableBinding)(props.readOnly)) {
|
|
2511
|
+
errors.push('Input "readOnly" must be a boolean when provided.');
|
|
2512
|
+
}
|
|
2513
|
+
if (props.pattern !== void 0 && typeof props.pattern !== "string" && !(0, import_schema16.isVariableBinding)(props.pattern)) {
|
|
2514
|
+
errors.push('Input "pattern" must be a string when provided.');
|
|
2515
|
+
}
|
|
2516
|
+
if (props.minLength !== void 0 && !(0, import_schema16.isVariableBinding)(props.minLength)) {
|
|
2517
|
+
if (typeof props.minLength !== "number" || props.minLength < 0 || !Number.isInteger(props.minLength)) {
|
|
2518
|
+
errors.push('Input "minLength" must be a non-negative integer when provided.');
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
if (props.maxLength !== void 0 && !(0, import_schema16.isVariableBinding)(props.maxLength)) {
|
|
2522
|
+
if (typeof props.maxLength !== "number" || props.maxLength < 0 || !Number.isInteger(props.maxLength)) {
|
|
2523
|
+
errors.push('Input "maxLength" must be a non-negative integer when provided.');
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
if (props.prefixIcon !== void 0 && typeof props.prefixIcon !== "string" && !(0, import_schema16.isVariableBinding)(props.prefixIcon)) {
|
|
2527
|
+
errors.push('Input "prefixIcon" must be a string when provided.');
|
|
2528
|
+
}
|
|
2529
|
+
if (props.suffixIcon !== void 0 && typeof props.suffixIcon !== "string" && !(0, import_schema16.isVariableBinding)(props.suffixIcon)) {
|
|
2530
|
+
errors.push('Input "suffixIcon" must be a string when provided.');
|
|
2531
|
+
}
|
|
2532
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema16.isVariableBinding)(props.helperText)) {
|
|
2533
|
+
errors.push('Input "helperText" must be a string when provided.');
|
|
2534
|
+
}
|
|
2535
|
+
return errors.length > 0 ? errors : true;
|
|
2536
|
+
},
|
|
2537
|
+
defaultStyles: {
|
|
2538
|
+
base: {
|
|
2539
|
+
width: "100%",
|
|
2540
|
+
paddingTop: "10px",
|
|
2541
|
+
paddingBottom: "10px",
|
|
2542
|
+
paddingLeft: "14px",
|
|
2543
|
+
paddingRight: "14px",
|
|
2544
|
+
borderRadius: "6px",
|
|
2545
|
+
borderWidth: "1px",
|
|
2546
|
+
borderStyle: "solid",
|
|
2547
|
+
borderColor: "#cbd5e1",
|
|
2548
|
+
fontSize: "14px",
|
|
2549
|
+
backgroundColor: "#ffffff",
|
|
2550
|
+
color: "#1e293b",
|
|
2551
|
+
boxSizing: "border-box"
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
|
|
2556
|
+
// src/definitions/form/textarea.ts
|
|
2557
|
+
var import_schema17 = require("@kubuild/schema");
|
|
2558
|
+
var textareaDefinition = {
|
|
2559
|
+
type: "textarea",
|
|
2560
|
+
label: "Textarea",
|
|
2561
|
+
category: "form",
|
|
2562
|
+
icon: "textarea",
|
|
2563
|
+
acceptsChildren: false,
|
|
2564
|
+
disallowedParents: ["page"],
|
|
2565
|
+
defaultProps: {
|
|
2566
|
+
name: "message",
|
|
2567
|
+
placeholder: "Enter your message...",
|
|
2568
|
+
defaultValue: "",
|
|
2569
|
+
rows: 4,
|
|
2570
|
+
required: false,
|
|
2571
|
+
disabled: false,
|
|
2572
|
+
readOnly: false,
|
|
2573
|
+
resize: "vertical",
|
|
2574
|
+
autoGrow: false,
|
|
2575
|
+
maxCharCount: void 0,
|
|
2576
|
+
helperText: ""
|
|
2577
|
+
},
|
|
2578
|
+
propFields: [
|
|
2579
|
+
{ name: "name", label: "Field Name", type: "string", defaultValue: "message" },
|
|
2580
|
+
{ name: "placeholder", label: "Placeholder", type: "string", defaultValue: "Enter your message..." },
|
|
2581
|
+
{ name: "defaultValue", label: "Default Value", type: "textarea" },
|
|
2582
|
+
{ name: "rows", label: "Rows", type: "number", defaultValue: 4 },
|
|
2583
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
2584
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2585
|
+
{ name: "readOnly", label: "Read Only", type: "boolean", defaultValue: false },
|
|
2586
|
+
{
|
|
2587
|
+
name: "resize",
|
|
2588
|
+
label: "Resize",
|
|
2589
|
+
type: "select",
|
|
2590
|
+
defaultValue: "vertical",
|
|
2591
|
+
options: [
|
|
2592
|
+
{ label: "Vertical only", value: "vertical" },
|
|
2593
|
+
{ label: "Horizontal only", value: "horizontal" },
|
|
2594
|
+
{ label: "Both", value: "both" },
|
|
2595
|
+
{ label: "None", value: "none" }
|
|
2596
|
+
]
|
|
2597
|
+
},
|
|
2598
|
+
{ name: "autoGrow", label: "Auto Grow", type: "boolean", defaultValue: false },
|
|
2599
|
+
{ name: "maxCharCount", label: "Max Character Count", type: "number" },
|
|
2600
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
2601
|
+
],
|
|
2602
|
+
traits: [
|
|
2603
|
+
fieldNameTrait({ defaultValue: "message" }),
|
|
2604
|
+
placeholderTrait({ defaultValue: "Enter your message..." }),
|
|
2605
|
+
defaultValueTrait(),
|
|
2606
|
+
rowsTrait(),
|
|
2607
|
+
resizeTrait(),
|
|
2608
|
+
autoGrowTrait(),
|
|
2609
|
+
maxCharCountTrait(),
|
|
2610
|
+
helperTextTrait(),
|
|
2611
|
+
requiredTrait(),
|
|
2612
|
+
disabledTrait(),
|
|
2613
|
+
readOnlyTrait(),
|
|
2614
|
+
idTrait(),
|
|
2615
|
+
ariaLabelTrait()
|
|
2616
|
+
],
|
|
2617
|
+
validateProps: (props) => {
|
|
2618
|
+
const errors = [];
|
|
2619
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema17.isVariableBinding)(props.name)) {
|
|
2620
|
+
errors.push('Textarea "name" must be a string when provided.');
|
|
2621
|
+
}
|
|
2622
|
+
if (props.rows !== void 0 && !(0, import_schema17.isVariableBinding)(props.rows)) {
|
|
2623
|
+
if (typeof props.rows !== "number" || props.rows < 1 || !Number.isInteger(props.rows)) {
|
|
2624
|
+
errors.push('Textarea "rows" must be a positive integer (>= 1).');
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
if (props.placeholder !== void 0 && typeof props.placeholder !== "string" && !(0, import_schema17.isVariableBinding)(props.placeholder)) {
|
|
2628
|
+
errors.push('Textarea "placeholder" must be a string when provided.');
|
|
2629
|
+
}
|
|
2630
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema17.isVariableBinding)(props.required)) {
|
|
2631
|
+
errors.push('Textarea "required" must be a boolean when provided.');
|
|
2632
|
+
}
|
|
2633
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema17.isVariableBinding)(props.disabled)) {
|
|
2634
|
+
errors.push('Textarea "disabled" must be a boolean when provided.');
|
|
2635
|
+
}
|
|
2636
|
+
if (props.readOnly !== void 0 && typeof props.readOnly !== "boolean" && !(0, import_schema17.isVariableBinding)(props.readOnly)) {
|
|
2637
|
+
errors.push('Textarea "readOnly" must be a boolean when provided.');
|
|
2638
|
+
}
|
|
2639
|
+
if (props.resize !== void 0 && !(0, import_schema17.isVariableBinding)(props.resize)) {
|
|
2640
|
+
const allowedResize = ["vertical", "horizontal", "both", "none"];
|
|
2641
|
+
if (typeof props.resize !== "string" || !allowedResize.includes(props.resize)) {
|
|
2642
|
+
errors.push(`Textarea "resize" must be one of: ${allowedResize.join(", ")}.`);
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
if (props.autoGrow !== void 0 && typeof props.autoGrow !== "boolean" && !(0, import_schema17.isVariableBinding)(props.autoGrow)) {
|
|
2646
|
+
errors.push('Textarea "autoGrow" must be a boolean when provided.');
|
|
2647
|
+
}
|
|
2648
|
+
if (props.maxCharCount !== void 0 && !(0, import_schema17.isVariableBinding)(props.maxCharCount)) {
|
|
2649
|
+
if (typeof props.maxCharCount !== "number" || props.maxCharCount < 1 || !Number.isInteger(props.maxCharCount)) {
|
|
2650
|
+
errors.push('Textarea "maxCharCount" must be a positive integer (>= 1) when provided.');
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema17.isVariableBinding)(props.helperText)) {
|
|
2654
|
+
errors.push('Textarea "helperText" must be a string when provided.');
|
|
2655
|
+
}
|
|
2656
|
+
return errors.length > 0 ? errors : true;
|
|
2657
|
+
},
|
|
2658
|
+
defaultStyles: {
|
|
2659
|
+
base: {
|
|
2660
|
+
width: "100%",
|
|
2661
|
+
paddingTop: "10px",
|
|
2662
|
+
paddingBottom: "10px",
|
|
2663
|
+
paddingLeft: "14px",
|
|
2664
|
+
paddingRight: "14px",
|
|
2665
|
+
borderRadius: "6px",
|
|
2666
|
+
borderWidth: "1px",
|
|
2667
|
+
borderStyle: "solid",
|
|
2668
|
+
borderColor: "#cbd5e1",
|
|
2669
|
+
fontSize: "14px",
|
|
2670
|
+
backgroundColor: "#ffffff",
|
|
2671
|
+
color: "#1e293b",
|
|
2672
|
+
boxSizing: "border-box"
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
};
|
|
2676
|
+
|
|
2677
|
+
// src/definitions/form/select.ts
|
|
2678
|
+
var import_schema18 = require("@kubuild/schema");
|
|
2679
|
+
var selectDefinition = {
|
|
2680
|
+
type: "select",
|
|
2681
|
+
label: "Select",
|
|
2682
|
+
category: "form",
|
|
2683
|
+
icon: "select",
|
|
2684
|
+
acceptsChildren: false,
|
|
2685
|
+
disallowedParents: ["page"],
|
|
2686
|
+
defaultProps: {
|
|
2687
|
+
name: "select_field",
|
|
2688
|
+
placeholder: "Select an option...",
|
|
2689
|
+
options: [
|
|
2690
|
+
{ label: "Option 1", value: "option1" },
|
|
2691
|
+
{ label: "Option 2", value: "option2" },
|
|
2692
|
+
{ label: "Option 3", value: "option3" }
|
|
2693
|
+
],
|
|
2694
|
+
defaultValue: "",
|
|
2695
|
+
required: false,
|
|
2696
|
+
disabled: false,
|
|
2697
|
+
helperText: ""
|
|
2698
|
+
},
|
|
2699
|
+
propFields: [
|
|
2700
|
+
{ name: "name", label: "Field Name", type: "string", defaultValue: "select_field" },
|
|
2701
|
+
{ name: "placeholder", label: "Placeholder", type: "string", defaultValue: "Select an option..." },
|
|
2702
|
+
{
|
|
2703
|
+
name: "options",
|
|
2704
|
+
label: "Options (JSON list)",
|
|
2705
|
+
type: "json",
|
|
2706
|
+
defaultValue: [
|
|
2707
|
+
{ label: "Option 1", value: "option1" },
|
|
2708
|
+
{ label: "Option 2", value: "option2" },
|
|
2709
|
+
{ label: "Option 3", value: "option3" }
|
|
2710
|
+
]
|
|
2711
|
+
},
|
|
2712
|
+
{ name: "defaultValue", label: "Default Selected Value", type: "string" },
|
|
2713
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
2714
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2715
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
2716
|
+
],
|
|
2717
|
+
traits: [
|
|
2718
|
+
fieldNameTrait({ defaultValue: "select_field" }),
|
|
2719
|
+
placeholderTrait({ defaultValue: "Select an option..." }),
|
|
2720
|
+
optionsListTrait({ description: "The list of dropdown choices (label + value pairs). Editable via the inspector trait panel." }),
|
|
2721
|
+
defaultValueTrait({ description: "The initially selected option value (must match one of the option values)." }),
|
|
2722
|
+
helperTextTrait(),
|
|
2723
|
+
requiredTrait(),
|
|
2724
|
+
disabledTrait(),
|
|
2725
|
+
idTrait(),
|
|
2726
|
+
ariaLabelTrait()
|
|
2727
|
+
],
|
|
2728
|
+
validateProps: (props) => {
|
|
2729
|
+
const errors = [];
|
|
2730
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema18.isVariableBinding)(props.name)) {
|
|
2731
|
+
errors.push('Select "name" must be a string when provided.');
|
|
2732
|
+
}
|
|
2733
|
+
if (props.options !== void 0 && !(0, import_schema18.isVariableBinding)(props.options)) {
|
|
2734
|
+
if (!Array.isArray(props.options) && typeof props.options !== "string") {
|
|
2735
|
+
errors.push('Select "options" must be an array of option objects or a JSON string.');
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema18.isVariableBinding)(props.required)) {
|
|
2739
|
+
errors.push('Select "required" must be a boolean when provided.');
|
|
2740
|
+
}
|
|
2741
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema18.isVariableBinding)(props.disabled)) {
|
|
2742
|
+
errors.push('Select "disabled" must be a boolean when provided.');
|
|
2743
|
+
}
|
|
2744
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema18.isVariableBinding)(props.helperText)) {
|
|
2745
|
+
errors.push('Select "helperText" must be a string when provided.');
|
|
2746
|
+
}
|
|
2747
|
+
return errors.length > 0 ? errors : true;
|
|
2748
|
+
},
|
|
2749
|
+
defaultStyles: {
|
|
2750
|
+
base: {
|
|
2751
|
+
width: "100%",
|
|
2752
|
+
paddingTop: "10px",
|
|
2753
|
+
paddingBottom: "10px",
|
|
2754
|
+
paddingLeft: "14px",
|
|
2755
|
+
paddingRight: "14px",
|
|
2756
|
+
borderRadius: "6px",
|
|
2757
|
+
borderWidth: "1px",
|
|
2758
|
+
borderStyle: "solid",
|
|
2759
|
+
borderColor: "#cbd5e1",
|
|
2760
|
+
fontSize: "14px",
|
|
2761
|
+
backgroundColor: "#ffffff",
|
|
2762
|
+
color: "#1e293b",
|
|
2763
|
+
boxSizing: "border-box"
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
};
|
|
2767
|
+
|
|
2768
|
+
// src/definitions/form/checkbox.ts
|
|
2769
|
+
var import_schema19 = require("@kubuild/schema");
|
|
2770
|
+
var checkboxDefinition = {
|
|
2771
|
+
type: "checkbox",
|
|
2772
|
+
label: "Checkbox",
|
|
2773
|
+
category: "form",
|
|
2774
|
+
icon: "checkbox",
|
|
2775
|
+
acceptsChildren: false,
|
|
2776
|
+
disallowedParents: ["page"],
|
|
2777
|
+
defaultProps: {
|
|
2778
|
+
name: "checkbox_field",
|
|
2779
|
+
label: "I agree to the terms and conditions",
|
|
2780
|
+
value: "yes",
|
|
2781
|
+
defaultChecked: false,
|
|
2782
|
+
indeterminate: false,
|
|
2783
|
+
required: false,
|
|
2784
|
+
disabled: false,
|
|
2785
|
+
helperText: ""
|
|
2786
|
+
},
|
|
2787
|
+
propFields: [
|
|
2788
|
+
{ name: "name", label: "Field Name", type: "string", defaultValue: "checkbox_field" },
|
|
2789
|
+
{ name: "label", label: "Label Text", type: "string", defaultValue: "I agree to the terms and conditions" },
|
|
2790
|
+
{ name: "value", label: "Checked Value", type: "string", defaultValue: "yes" },
|
|
2791
|
+
{ name: "defaultChecked", label: "Default Checked", type: "boolean", defaultValue: false },
|
|
2792
|
+
{ name: "indeterminate", label: "Indeterminate", type: "boolean", defaultValue: false },
|
|
2793
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
2794
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2795
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
2796
|
+
],
|
|
2797
|
+
traits: [
|
|
2798
|
+
fieldNameTrait({ defaultValue: "checkbox_field" }),
|
|
2799
|
+
labelTextTrait({ defaultValue: "I agree to the terms and conditions" }),
|
|
2800
|
+
valueTrait({ defaultValue: "yes" }),
|
|
2801
|
+
defaultCheckedTrait(),
|
|
2802
|
+
indeterminateTrait(),
|
|
2803
|
+
helperTextTrait(),
|
|
2804
|
+
requiredTrait(),
|
|
2805
|
+
disabledTrait(),
|
|
2806
|
+
idTrait(),
|
|
2807
|
+
ariaLabelTrait()
|
|
2808
|
+
],
|
|
2809
|
+
validateProps: (props) => {
|
|
2810
|
+
const errors = [];
|
|
2811
|
+
if (props.label !== void 0 && typeof props.label !== "string" && !(0, import_schema19.isVariableBinding)(props.label)) {
|
|
2812
|
+
errors.push('Checkbox "label" must be a string when provided.');
|
|
2813
|
+
}
|
|
2814
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema19.isVariableBinding)(props.name)) {
|
|
2815
|
+
errors.push('Checkbox "name" must be a string when provided.');
|
|
2816
|
+
}
|
|
2817
|
+
if (props.value !== void 0 && typeof props.value !== "string" && !(0, import_schema19.isVariableBinding)(props.value)) {
|
|
2818
|
+
errors.push('Checkbox "value" must be a string when provided.');
|
|
2819
|
+
}
|
|
2820
|
+
if (props.defaultChecked !== void 0 && typeof props.defaultChecked !== "boolean" && !(0, import_schema19.isVariableBinding)(props.defaultChecked)) {
|
|
2821
|
+
errors.push('Checkbox "defaultChecked" must be a boolean when provided.');
|
|
2822
|
+
}
|
|
2823
|
+
if (props.indeterminate !== void 0 && typeof props.indeterminate !== "boolean" && !(0, import_schema19.isVariableBinding)(props.indeterminate)) {
|
|
2824
|
+
errors.push('Checkbox "indeterminate" must be a boolean when provided.');
|
|
2825
|
+
}
|
|
2826
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema19.isVariableBinding)(props.required)) {
|
|
2827
|
+
errors.push('Checkbox "required" must be a boolean when provided.');
|
|
2828
|
+
}
|
|
2829
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema19.isVariableBinding)(props.disabled)) {
|
|
2830
|
+
errors.push('Checkbox "disabled" must be a boolean when provided.');
|
|
2831
|
+
}
|
|
2832
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema19.isVariableBinding)(props.helperText)) {
|
|
2833
|
+
errors.push('Checkbox "helperText" must be a string when provided.');
|
|
2834
|
+
}
|
|
2835
|
+
return errors.length > 0 ? errors : true;
|
|
2836
|
+
},
|
|
2837
|
+
defaultStyles: {
|
|
2838
|
+
base: {
|
|
2839
|
+
display: "inline-flex",
|
|
2840
|
+
alignItems: "center",
|
|
2841
|
+
gap: "8px",
|
|
2842
|
+
fontSize: "14px",
|
|
2843
|
+
color: "#1e293b",
|
|
2844
|
+
cursor: "pointer",
|
|
2845
|
+
userSelect: "none"
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2850
|
+
// src/definitions/form/switch.ts
|
|
2851
|
+
var import_schema20 = require("@kubuild/schema");
|
|
2852
|
+
var switchDefinition = {
|
|
2853
|
+
type: "switch",
|
|
2854
|
+
label: "Switch",
|
|
2855
|
+
category: "form",
|
|
2856
|
+
icon: "switch",
|
|
2857
|
+
acceptsChildren: false,
|
|
2858
|
+
disallowedParents: ["page"],
|
|
2859
|
+
defaultProps: {
|
|
2860
|
+
name: "switch_field",
|
|
2861
|
+
label: "Enable feature",
|
|
2862
|
+
value: "yes",
|
|
2863
|
+
defaultChecked: false,
|
|
2864
|
+
switchSize: "md",
|
|
2865
|
+
required: false,
|
|
2866
|
+
disabled: false,
|
|
2867
|
+
helperText: ""
|
|
2868
|
+
},
|
|
2869
|
+
propFields: [
|
|
2870
|
+
{ name: "name", label: "Field Name", type: "string", defaultValue: "switch_field" },
|
|
2871
|
+
{ name: "label", label: "Label Text", type: "string", defaultValue: "Enable feature" },
|
|
2872
|
+
{ name: "value", label: "Checked Value", type: "string", defaultValue: "yes" },
|
|
2873
|
+
{ name: "defaultChecked", label: "Default Checked", type: "boolean", defaultValue: false },
|
|
2874
|
+
{
|
|
2875
|
+
name: "switchSize",
|
|
2876
|
+
label: "Size",
|
|
2877
|
+
type: "select",
|
|
2878
|
+
defaultValue: "md",
|
|
2879
|
+
options: [
|
|
2880
|
+
{ label: "Small", value: "sm" },
|
|
2881
|
+
{ label: "Medium", value: "md" },
|
|
2882
|
+
{ label: "Large", value: "lg" }
|
|
2883
|
+
]
|
|
2884
|
+
},
|
|
2885
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
2886
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2887
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
2888
|
+
],
|
|
2889
|
+
traits: [
|
|
2890
|
+
fieldNameTrait({ defaultValue: "switch_field" }),
|
|
2891
|
+
labelTextTrait({ defaultValue: "Enable feature" }),
|
|
2892
|
+
valueTrait({ defaultValue: "yes" }),
|
|
2893
|
+
defaultCheckedTrait(),
|
|
2894
|
+
switchSizeTrait(),
|
|
2895
|
+
helperTextTrait(),
|
|
2896
|
+
requiredTrait(),
|
|
2897
|
+
disabledTrait(),
|
|
2898
|
+
idTrait(),
|
|
2899
|
+
ariaLabelTrait()
|
|
2900
|
+
],
|
|
2901
|
+
validateProps: (props) => {
|
|
2902
|
+
const errors = [];
|
|
2903
|
+
if (props.label !== void 0 && typeof props.label !== "string" && !(0, import_schema20.isVariableBinding)(props.label)) {
|
|
2904
|
+
errors.push('Switch "label" must be a string when provided.');
|
|
2905
|
+
}
|
|
2906
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema20.isVariableBinding)(props.name)) {
|
|
2907
|
+
errors.push('Switch "name" must be a string when provided.');
|
|
2908
|
+
}
|
|
2909
|
+
if (props.value !== void 0 && typeof props.value !== "string" && !(0, import_schema20.isVariableBinding)(props.value)) {
|
|
2910
|
+
errors.push('Switch "value" must be a string when provided.');
|
|
2911
|
+
}
|
|
2912
|
+
if (props.defaultChecked !== void 0 && typeof props.defaultChecked !== "boolean" && !(0, import_schema20.isVariableBinding)(props.defaultChecked)) {
|
|
2913
|
+
errors.push('Switch "defaultChecked" must be a boolean when provided.');
|
|
2914
|
+
}
|
|
2915
|
+
if (props.switchSize !== void 0 && !(0, import_schema20.isVariableBinding)(props.switchSize)) {
|
|
2916
|
+
const allowedSizes = ["sm", "md", "lg"];
|
|
2917
|
+
if (typeof props.switchSize !== "string" || !allowedSizes.includes(props.switchSize)) {
|
|
2918
|
+
errors.push(`Switch "switchSize" must be one of: ${allowedSizes.join(", ")}.`);
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema20.isVariableBinding)(props.required)) {
|
|
2922
|
+
errors.push('Switch "required" must be a boolean when provided.');
|
|
2923
|
+
}
|
|
2924
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema20.isVariableBinding)(props.disabled)) {
|
|
2925
|
+
errors.push('Switch "disabled" must be a boolean when provided.');
|
|
2926
|
+
}
|
|
2927
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema20.isVariableBinding)(props.helperText)) {
|
|
2928
|
+
errors.push('Switch "helperText" must be a string when provided.');
|
|
2929
|
+
}
|
|
2930
|
+
return errors.length > 0 ? errors : true;
|
|
2931
|
+
},
|
|
2932
|
+
defaultStyles: {
|
|
2933
|
+
base: {
|
|
2934
|
+
display: "inline-flex",
|
|
2935
|
+
alignItems: "center",
|
|
2936
|
+
gap: "8px",
|
|
2937
|
+
fontSize: "14px",
|
|
2938
|
+
color: "#1e293b",
|
|
2939
|
+
cursor: "pointer",
|
|
2940
|
+
userSelect: "none"
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
};
|
|
2944
|
+
|
|
2945
|
+
// src/definitions/form/radio.ts
|
|
2946
|
+
var import_schema21 = require("@kubuild/schema");
|
|
2947
|
+
var radioGroupDefinition = {
|
|
2948
|
+
type: "radio-group",
|
|
2949
|
+
label: "Radio Group",
|
|
2950
|
+
category: "form",
|
|
2951
|
+
icon: "radio-group",
|
|
2952
|
+
acceptsChildren: true,
|
|
2953
|
+
allowedChildren: ["radio", "radio-item", "custom"],
|
|
2954
|
+
disallowedParents: ["page"],
|
|
2955
|
+
defaultProps: {
|
|
2956
|
+
name: "radio_group",
|
|
2957
|
+
defaultSelected: "option1",
|
|
2958
|
+
orientation: "vertical",
|
|
2959
|
+
required: false,
|
|
2960
|
+
disabled: false,
|
|
2961
|
+
helperText: ""
|
|
2962
|
+
},
|
|
2963
|
+
defaultChildren: [
|
|
2964
|
+
{ type: "radio", props: { name: "radio_group", label: "Option 1", value: "option1", defaultChecked: true } },
|
|
2965
|
+
{ type: "radio", props: { name: "radio_group", label: "Option 2", value: "option2", defaultChecked: false } },
|
|
2966
|
+
{ type: "radio", props: { name: "radio_group", label: "Option 3", value: "option3", defaultChecked: false } }
|
|
2967
|
+
],
|
|
2968
|
+
propFields: [
|
|
2969
|
+
{ name: "name", label: "Group Name", type: "string", defaultValue: "radio_group" },
|
|
2970
|
+
{ name: "defaultSelected", label: "Default Selected", type: "string", defaultValue: "option1" },
|
|
2971
|
+
{
|
|
2972
|
+
name: "orientation",
|
|
2973
|
+
label: "Orientation",
|
|
2974
|
+
type: "select",
|
|
2975
|
+
defaultValue: "vertical",
|
|
2976
|
+
options: [
|
|
2977
|
+
{ label: "Vertical", value: "vertical" },
|
|
2978
|
+
{ label: "Horizontal", value: "horizontal" }
|
|
2979
|
+
]
|
|
2980
|
+
},
|
|
2981
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
2982
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
2983
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
2984
|
+
],
|
|
2985
|
+
traits: [
|
|
2986
|
+
fieldNameTrait({ defaultValue: "radio_group", label: "Group Name" }),
|
|
2987
|
+
defaultSelectedTrait({ defaultValue: "option1" }),
|
|
2988
|
+
orientationTrait(),
|
|
2989
|
+
helperTextTrait(),
|
|
2990
|
+
requiredTrait(),
|
|
2991
|
+
disabledTrait(),
|
|
2992
|
+
idTrait(),
|
|
2993
|
+
ariaLabelTrait()
|
|
2994
|
+
],
|
|
2995
|
+
validateProps: (props) => {
|
|
2996
|
+
const errors = [];
|
|
2997
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema21.isVariableBinding)(props.name)) {
|
|
2998
|
+
errors.push('RadioGroup "name" must be a string when provided.');
|
|
2999
|
+
}
|
|
3000
|
+
if (props.defaultSelected !== void 0 && typeof props.defaultSelected !== "string" && !(0, import_schema21.isVariableBinding)(props.defaultSelected)) {
|
|
3001
|
+
errors.push('RadioGroup "defaultSelected" must be a string when provided.');
|
|
3002
|
+
}
|
|
3003
|
+
if (props.orientation !== void 0 && !(0, import_schema21.isVariableBinding)(props.orientation)) {
|
|
3004
|
+
const allowedOrientations = ["vertical", "horizontal"];
|
|
3005
|
+
if (typeof props.orientation !== "string" || !allowedOrientations.includes(props.orientation)) {
|
|
3006
|
+
errors.push(`RadioGroup "orientation" must be one of: ${allowedOrientations.join(", ")}.`);
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema21.isVariableBinding)(props.required)) {
|
|
3010
|
+
errors.push('RadioGroup "required" must be a boolean when provided.');
|
|
3011
|
+
}
|
|
3012
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema21.isVariableBinding)(props.disabled)) {
|
|
3013
|
+
errors.push('RadioGroup "disabled" must be a boolean when provided.');
|
|
3014
|
+
}
|
|
3015
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema21.isVariableBinding)(props.helperText)) {
|
|
3016
|
+
errors.push('RadioGroup "helperText" must be a string when provided.');
|
|
3017
|
+
}
|
|
3018
|
+
return errors.length > 0 ? errors : true;
|
|
3019
|
+
},
|
|
3020
|
+
defaultStyles: {
|
|
3021
|
+
base: {
|
|
3022
|
+
display: "flex",
|
|
3023
|
+
flexDirection: "column",
|
|
3024
|
+
gap: "8px"
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
};
|
|
3028
|
+
var radioDefinition = {
|
|
3029
|
+
type: "radio",
|
|
3030
|
+
label: "Radio",
|
|
3031
|
+
category: "form",
|
|
3032
|
+
icon: "radio",
|
|
3033
|
+
acceptsChildren: false,
|
|
3034
|
+
disallowedParents: ["page"],
|
|
3035
|
+
defaultProps: {
|
|
3036
|
+
name: "radio_group",
|
|
3037
|
+
label: "Option 1",
|
|
3038
|
+
value: "option1",
|
|
3039
|
+
defaultChecked: false,
|
|
3040
|
+
required: false,
|
|
3041
|
+
disabled: false,
|
|
3042
|
+
helperText: ""
|
|
3043
|
+
},
|
|
3044
|
+
propFields: [
|
|
3045
|
+
{ name: "name", label: "Group Name", type: "string", defaultValue: "radio_group" },
|
|
3046
|
+
{ name: "label", label: "Label Text", type: "string", defaultValue: "Option 1" },
|
|
3047
|
+
{ name: "value", label: "Radio Value", type: "string", defaultValue: "option1" },
|
|
3048
|
+
{ name: "defaultChecked", label: "Default Selected", type: "boolean", defaultValue: false },
|
|
3049
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
3050
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
3051
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
3052
|
+
],
|
|
3053
|
+
traits: [
|
|
3054
|
+
fieldNameTrait({ defaultValue: "radio_group", label: "Group Name" }),
|
|
3055
|
+
labelTextTrait({ defaultValue: "Option 1" }),
|
|
3056
|
+
valueTrait({ defaultValue: "option1" }),
|
|
3057
|
+
defaultCheckedTrait(),
|
|
3058
|
+
helperTextTrait(),
|
|
3059
|
+
requiredTrait(),
|
|
3060
|
+
disabledTrait(),
|
|
3061
|
+
idTrait(),
|
|
3062
|
+
ariaLabelTrait()
|
|
3063
|
+
],
|
|
3064
|
+
validateProps: (props) => {
|
|
3065
|
+
const errors = [];
|
|
3066
|
+
if (props.label !== void 0 && typeof props.label !== "string" && !(0, import_schema21.isVariableBinding)(props.label)) {
|
|
3067
|
+
errors.push('Radio "label" must be a string when provided.');
|
|
3068
|
+
}
|
|
3069
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema21.isVariableBinding)(props.name)) {
|
|
3070
|
+
errors.push('Radio "name" must be a string when provided.');
|
|
3071
|
+
}
|
|
3072
|
+
if (props.value !== void 0 && typeof props.value !== "string" && !(0, import_schema21.isVariableBinding)(props.value)) {
|
|
3073
|
+
errors.push('Radio "value" must be a string when provided.');
|
|
3074
|
+
}
|
|
3075
|
+
if (props.defaultChecked !== void 0 && typeof props.defaultChecked !== "boolean" && !(0, import_schema21.isVariableBinding)(props.defaultChecked)) {
|
|
3076
|
+
errors.push('Radio "defaultChecked" must be a boolean when provided.');
|
|
3077
|
+
}
|
|
3078
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema21.isVariableBinding)(props.required)) {
|
|
3079
|
+
errors.push('Radio "required" must be a boolean when provided.');
|
|
3080
|
+
}
|
|
3081
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema21.isVariableBinding)(props.disabled)) {
|
|
3082
|
+
errors.push('Radio "disabled" must be a boolean when provided.');
|
|
3083
|
+
}
|
|
3084
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema21.isVariableBinding)(props.helperText)) {
|
|
3085
|
+
errors.push('Radio "helperText" must be a string when provided.');
|
|
3086
|
+
}
|
|
3087
|
+
return errors.length > 0 ? errors : true;
|
|
3088
|
+
},
|
|
3089
|
+
defaultStyles: {
|
|
3090
|
+
base: {
|
|
3091
|
+
display: "inline-flex",
|
|
3092
|
+
alignItems: "center",
|
|
3093
|
+
gap: "8px",
|
|
3094
|
+
fontSize: "14px",
|
|
3095
|
+
color: "#1e293b",
|
|
3096
|
+
cursor: "pointer",
|
|
3097
|
+
userSelect: "none"
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
var radioItemDefinition = {
|
|
3102
|
+
...radioDefinition,
|
|
3103
|
+
type: "radio-item",
|
|
3104
|
+
label: "Radio Item"
|
|
3105
|
+
};
|
|
3106
|
+
|
|
3107
|
+
// src/definitions/form/file-upload.ts
|
|
3108
|
+
var import_schema22 = require("@kubuild/schema");
|
|
3109
|
+
var fileUploadDefinition = {
|
|
3110
|
+
type: "file-upload",
|
|
3111
|
+
label: "File Upload",
|
|
3112
|
+
category: "form",
|
|
3113
|
+
icon: "upload",
|
|
3114
|
+
acceptsChildren: false,
|
|
3115
|
+
disallowedParents: ["page"],
|
|
3116
|
+
defaultProps: {
|
|
3117
|
+
name: "file_upload",
|
|
3118
|
+
label: "Upload File",
|
|
3119
|
+
accept: "*/*",
|
|
3120
|
+
maxFileSize: 10,
|
|
3121
|
+
multiple: false,
|
|
3122
|
+
showPreview: true,
|
|
3123
|
+
required: false,
|
|
3124
|
+
disabled: false,
|
|
3125
|
+
helperText: ""
|
|
3126
|
+
},
|
|
3127
|
+
propFields: [
|
|
3128
|
+
{ name: "name", label: "Field Name", type: "string", defaultValue: "file_upload" },
|
|
3129
|
+
{ name: "label", label: "Label Text", type: "string", defaultValue: "Upload File" },
|
|
3130
|
+
{ name: "accept", label: "Accepted File Types", type: "string", defaultValue: "*/*" },
|
|
3131
|
+
{ name: "maxFileSize", label: "Max File Size (MB)", type: "number", defaultValue: 10 },
|
|
3132
|
+
{ name: "multiple", label: "Allow Multiple Files", type: "boolean", defaultValue: false },
|
|
3133
|
+
{ name: "showPreview", label: "Show Preview", type: "boolean", defaultValue: true },
|
|
3134
|
+
{ name: "required", label: "Required", type: "boolean", defaultValue: false },
|
|
3135
|
+
{ name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
|
|
3136
|
+
{ name: "helperText", label: "Helper Text", type: "string" }
|
|
3137
|
+
],
|
|
3138
|
+
traits: [
|
|
3139
|
+
fieldNameTrait({ defaultValue: "file_upload" }),
|
|
3140
|
+
labelTextTrait({ defaultValue: "Upload File" }),
|
|
3141
|
+
acceptTrait(),
|
|
3142
|
+
maxFileSizeTrait(),
|
|
3143
|
+
multipleTrait(),
|
|
3144
|
+
showPreviewTrait(),
|
|
3145
|
+
helperTextTrait(),
|
|
3146
|
+
requiredTrait(),
|
|
3147
|
+
disabledTrait(),
|
|
3148
|
+
idTrait(),
|
|
3149
|
+
ariaLabelTrait()
|
|
3150
|
+
],
|
|
3151
|
+
validateProps: (props) => {
|
|
3152
|
+
const errors = [];
|
|
3153
|
+
if (props.label !== void 0 && typeof props.label !== "string" && !(0, import_schema22.isVariableBinding)(props.label)) {
|
|
3154
|
+
errors.push('FileUpload "label" must be a string when provided.');
|
|
3155
|
+
}
|
|
3156
|
+
if (props.name !== void 0 && typeof props.name !== "string" && !(0, import_schema22.isVariableBinding)(props.name)) {
|
|
3157
|
+
errors.push('FileUpload "name" must be a string when provided.');
|
|
3158
|
+
}
|
|
3159
|
+
if (props.accept !== void 0 && typeof props.accept !== "string" && !(0, import_schema22.isVariableBinding)(props.accept)) {
|
|
3160
|
+
errors.push('FileUpload "accept" must be a string when provided.');
|
|
3161
|
+
}
|
|
3162
|
+
if (props.maxFileSize !== void 0 && !(0, import_schema22.isVariableBinding)(props.maxFileSize)) {
|
|
3163
|
+
if (typeof props.maxFileSize !== "number" || props.maxFileSize <= 0) {
|
|
3164
|
+
errors.push('FileUpload "maxFileSize" must be a positive number when provided.');
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
if (props.multiple !== void 0 && typeof props.multiple !== "boolean" && !(0, import_schema22.isVariableBinding)(props.multiple)) {
|
|
3168
|
+
errors.push('FileUpload "multiple" must be a boolean when provided.');
|
|
3169
|
+
}
|
|
3170
|
+
if (props.showPreview !== void 0 && typeof props.showPreview !== "boolean" && !(0, import_schema22.isVariableBinding)(props.showPreview)) {
|
|
3171
|
+
errors.push('FileUpload "showPreview" must be a boolean when provided.');
|
|
3172
|
+
}
|
|
3173
|
+
if (props.required !== void 0 && typeof props.required !== "boolean" && !(0, import_schema22.isVariableBinding)(props.required)) {
|
|
3174
|
+
errors.push('FileUpload "required" must be a boolean when provided.');
|
|
3175
|
+
}
|
|
3176
|
+
if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !(0, import_schema22.isVariableBinding)(props.disabled)) {
|
|
3177
|
+
errors.push('FileUpload "disabled" must be a boolean when provided.');
|
|
3178
|
+
}
|
|
3179
|
+
if (props.helperText !== void 0 && typeof props.helperText !== "string" && !(0, import_schema22.isVariableBinding)(props.helperText)) {
|
|
3180
|
+
errors.push('FileUpload "helperText" must be a string when provided.');
|
|
3181
|
+
}
|
|
3182
|
+
return errors.length > 0 ? errors : true;
|
|
3183
|
+
},
|
|
3184
|
+
defaultStyles: {
|
|
3185
|
+
base: {
|
|
3186
|
+
display: "flex",
|
|
3187
|
+
flexDirection: "column",
|
|
3188
|
+
gap: "8px",
|
|
3189
|
+
fontSize: "14px",
|
|
3190
|
+
color: "#1e293b"
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
};
|
|
3194
|
+
|
|
3195
|
+
// src/definitions/interactive/modal.ts
|
|
3196
|
+
var modalDefinition = {
|
|
3197
|
+
type: "modal",
|
|
3198
|
+
label: "Modal",
|
|
3199
|
+
category: "interactive",
|
|
3200
|
+
icon: "layout",
|
|
3201
|
+
description: "Pop-up overlay dialog container with backdrop and close controls.",
|
|
3202
|
+
acceptsChildren: true,
|
|
3203
|
+
allowedChildren: ["*"],
|
|
3204
|
+
defaultProps: {
|
|
3205
|
+
modalId: "modal-dialog",
|
|
3206
|
+
title: "Modal Title",
|
|
3207
|
+
backdrop: true,
|
|
3208
|
+
closeOnBackdrop: true,
|
|
3209
|
+
closeOnEscape: true,
|
|
3210
|
+
size: "md",
|
|
3211
|
+
showCloseButton: true
|
|
3212
|
+
},
|
|
3213
|
+
propFields: [
|
|
3214
|
+
{
|
|
3215
|
+
name: "modalId",
|
|
3216
|
+
label: "Modal Target ID",
|
|
3217
|
+
type: "string",
|
|
3218
|
+
defaultValue: "modal-dialog",
|
|
3219
|
+
description: "Unique identifier targeted by open_modal and close_modal actions."
|
|
3220
|
+
},
|
|
3221
|
+
{
|
|
3222
|
+
name: "title",
|
|
3223
|
+
label: "Modal Title",
|
|
3224
|
+
type: "string",
|
|
3225
|
+
defaultValue: "Modal Title",
|
|
3226
|
+
description: "Header title text displayed at the top of the dialog."
|
|
3227
|
+
},
|
|
3228
|
+
{
|
|
3229
|
+
name: "size",
|
|
3230
|
+
label: "Size",
|
|
3231
|
+
type: "select",
|
|
3232
|
+
defaultValue: "md",
|
|
3233
|
+
options: [
|
|
3234
|
+
{ label: "Small (400px)", value: "sm" },
|
|
3235
|
+
{ label: "Medium (560px)", value: "md" },
|
|
3236
|
+
{ label: "Large (768px)", value: "lg" },
|
|
3237
|
+
{ label: "Full Screen", value: "fullscreen" }
|
|
3238
|
+
]
|
|
3239
|
+
},
|
|
3240
|
+
{
|
|
3241
|
+
name: "backdrop",
|
|
3242
|
+
label: "Show Backdrop",
|
|
3243
|
+
type: "boolean",
|
|
3244
|
+
defaultValue: true
|
|
3245
|
+
},
|
|
3246
|
+
{
|
|
3247
|
+
name: "closeOnBackdrop",
|
|
3248
|
+
label: "Close on Backdrop Click",
|
|
3249
|
+
type: "boolean",
|
|
3250
|
+
defaultValue: true
|
|
3251
|
+
},
|
|
3252
|
+
{
|
|
3253
|
+
name: "closeOnEscape",
|
|
3254
|
+
label: "Close on Escape Key",
|
|
3255
|
+
type: "boolean",
|
|
3256
|
+
defaultValue: true
|
|
3257
|
+
},
|
|
3258
|
+
{
|
|
3259
|
+
name: "showCloseButton",
|
|
3260
|
+
label: "Show Close Button",
|
|
3261
|
+
type: "boolean",
|
|
3262
|
+
defaultValue: true
|
|
3263
|
+
}
|
|
3264
|
+
],
|
|
3265
|
+
traits: [
|
|
3266
|
+
idTrait(),
|
|
3267
|
+
titleTrait(),
|
|
3268
|
+
ariaLabelTrait({ description: "Accessible name for the modal dialog." })
|
|
3269
|
+
],
|
|
3270
|
+
defaultStyles: {
|
|
3271
|
+
base: {
|
|
3272
|
+
backgroundColor: "#ffffff",
|
|
3273
|
+
borderRadius: "12px",
|
|
3274
|
+
boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
|
|
3275
|
+
padding: "24px",
|
|
3276
|
+
maxWidth: "560px",
|
|
3277
|
+
width: "100%"
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
};
|
|
3281
|
+
|
|
3282
|
+
// src/definitions/interactive/drawer.ts
|
|
3283
|
+
var drawerDefinition = {
|
|
3284
|
+
type: "drawer",
|
|
3285
|
+
label: "Drawer",
|
|
3286
|
+
category: "interactive",
|
|
3287
|
+
icon: "sidebar",
|
|
3288
|
+
description: "Off-canvas slide-over panel container, ideal for mobile navigation and side sheets.",
|
|
3289
|
+
acceptsChildren: true,
|
|
3290
|
+
allowedChildren: ["*"],
|
|
3291
|
+
defaultProps: {
|
|
3292
|
+
modalId: "mobile-drawer",
|
|
3293
|
+
title: "Navigation Menu",
|
|
3294
|
+
placement: "right",
|
|
3295
|
+
backdrop: true,
|
|
3296
|
+
closeOnBackdrop: true,
|
|
3297
|
+
closeOnEscape: true,
|
|
3298
|
+
showCloseButton: true
|
|
3299
|
+
},
|
|
3300
|
+
propFields: [
|
|
3301
|
+
{
|
|
3302
|
+
name: "modalId",
|
|
3303
|
+
label: "Drawer Target ID",
|
|
3304
|
+
type: "string",
|
|
3305
|
+
defaultValue: "mobile-drawer",
|
|
3306
|
+
description: "Unique identifier targeted by open_modal and close_modal actions."
|
|
3307
|
+
},
|
|
3308
|
+
{
|
|
3309
|
+
name: "placement",
|
|
3310
|
+
label: "Placement",
|
|
3311
|
+
type: "select",
|
|
3312
|
+
defaultValue: "right",
|
|
3313
|
+
options: [
|
|
3314
|
+
{ label: "Slide from Right", value: "right" },
|
|
3315
|
+
{ label: "Slide from Left", value: "left" },
|
|
3316
|
+
{ label: "Slide from Top (Dropdown)", value: "top" },
|
|
3317
|
+
{ label: "Slide from Bottom", value: "bottom" }
|
|
3318
|
+
]
|
|
3319
|
+
},
|
|
3320
|
+
{
|
|
3321
|
+
name: "title",
|
|
3322
|
+
label: "Drawer Title",
|
|
3323
|
+
type: "string",
|
|
3324
|
+
defaultValue: "Navigation Menu",
|
|
3325
|
+
description: "Header title text displayed at the top of the drawer."
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
name: "backdrop",
|
|
3329
|
+
label: "Show Backdrop",
|
|
3330
|
+
type: "boolean",
|
|
3331
|
+
defaultValue: true
|
|
3332
|
+
},
|
|
3333
|
+
{
|
|
3334
|
+
name: "closeOnBackdrop",
|
|
3335
|
+
label: "Close on Backdrop Click",
|
|
3336
|
+
type: "boolean",
|
|
3337
|
+
defaultValue: true
|
|
3338
|
+
},
|
|
3339
|
+
{
|
|
3340
|
+
name: "closeOnEscape",
|
|
3341
|
+
label: "Close on Escape Key",
|
|
3342
|
+
type: "boolean",
|
|
3343
|
+
defaultValue: true
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
name: "showCloseButton",
|
|
3347
|
+
label: "Show Close Button",
|
|
3348
|
+
type: "boolean",
|
|
3349
|
+
defaultValue: true
|
|
3350
|
+
}
|
|
3351
|
+
],
|
|
3352
|
+
traits: [
|
|
3353
|
+
idTrait(),
|
|
3354
|
+
titleTrait(),
|
|
3355
|
+
ariaLabelTrait({ description: "Accessible name for the off-canvas drawer." })
|
|
3356
|
+
],
|
|
3357
|
+
defaultStyles: {
|
|
3358
|
+
base: {
|
|
3359
|
+
backgroundColor: "#ffffff",
|
|
3360
|
+
boxShadow: "-4px 0 24px rgba(0, 0, 0, 0.15)",
|
|
3361
|
+
padding: "24px",
|
|
3362
|
+
width: "320px",
|
|
3363
|
+
maxWidth: "100%"
|
|
3364
|
+
},
|
|
3365
|
+
mobile: {
|
|
3366
|
+
width: "100%"
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
};
|
|
3370
|
+
|
|
3371
|
+
// src/definitions/interactive/collapsible.ts
|
|
3372
|
+
var collapsibleDefinition = {
|
|
3373
|
+
type: "collapsible",
|
|
3374
|
+
label: "Collapsible",
|
|
3375
|
+
category: "interactive",
|
|
3376
|
+
icon: "chevron-down",
|
|
3377
|
+
description: "In-flow expandable container that toggles visibility without a fullscreen overlay.",
|
|
3378
|
+
acceptsChildren: true,
|
|
3379
|
+
allowedChildren: ["*"],
|
|
3380
|
+
defaultProps: {
|
|
3381
|
+
modalId: "collapsible-content",
|
|
3382
|
+
defaultOpen: false,
|
|
3383
|
+
animated: true
|
|
3384
|
+
},
|
|
3385
|
+
propFields: [
|
|
3386
|
+
{
|
|
3387
|
+
name: "modalId",
|
|
3388
|
+
label: "Target ID",
|
|
3389
|
+
type: "string",
|
|
3390
|
+
defaultValue: "collapsible-content",
|
|
3391
|
+
description: 'Identifier targeted by Open Modal (with "Toggle" enabled) or Close Modal actions.'
|
|
3392
|
+
},
|
|
3393
|
+
{
|
|
3394
|
+
name: "defaultOpen",
|
|
3395
|
+
label: "Default Open",
|
|
3396
|
+
type: "boolean",
|
|
3397
|
+
defaultValue: false,
|
|
3398
|
+
description: "Whether the collapsible container starts expanded on initial render."
|
|
3399
|
+
},
|
|
3400
|
+
{
|
|
3401
|
+
name: "animated",
|
|
3402
|
+
label: "Smooth Transition",
|
|
3403
|
+
type: "boolean",
|
|
3404
|
+
defaultValue: true
|
|
3405
|
+
}
|
|
3406
|
+
],
|
|
3407
|
+
traits: [
|
|
3408
|
+
idTrait(),
|
|
3409
|
+
ariaLabelTrait({ description: "Accessible name for the collapsible container." })
|
|
3410
|
+
],
|
|
3411
|
+
defaultStyles: {
|
|
3412
|
+
base: {
|
|
3413
|
+
width: "100%",
|
|
3414
|
+
overflow: "hidden"
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
};
|
|
3418
|
+
|
|
3419
|
+
// src/definitions/index.ts
|
|
3420
|
+
var coreComponentDefinitions = [
|
|
3421
|
+
pageDefinition,
|
|
3422
|
+
sectionDefinition,
|
|
3423
|
+
containerDefinition,
|
|
3424
|
+
columnsDefinition,
|
|
3425
|
+
flexDefinition,
|
|
3426
|
+
gridDefinition,
|
|
3427
|
+
headingDefinition,
|
|
3428
|
+
textDefinition,
|
|
3429
|
+
paragraphDefinition,
|
|
3430
|
+
linkDefinition,
|
|
3431
|
+
blockquoteDefinition,
|
|
3432
|
+
badgeDefinition,
|
|
3433
|
+
codeBlockDefinition,
|
|
3434
|
+
imageDefinition,
|
|
3435
|
+
videoDefinition,
|
|
3436
|
+
iconDefinition,
|
|
3437
|
+
htmlEmbedDefinition,
|
|
3438
|
+
buttonDefinition,
|
|
3439
|
+
buttonSubmitDefinition,
|
|
3440
|
+
formDefinition,
|
|
3441
|
+
inputDefinition,
|
|
3442
|
+
textareaDefinition,
|
|
3443
|
+
selectDefinition,
|
|
3444
|
+
checkboxDefinition,
|
|
3445
|
+
switchDefinition,
|
|
3446
|
+
radioGroupDefinition,
|
|
3447
|
+
radioDefinition,
|
|
3448
|
+
radioItemDefinition,
|
|
3449
|
+
fileUploadDefinition,
|
|
3450
|
+
collectionDefinition,
|
|
3451
|
+
listDefinition,
|
|
3452
|
+
listItemDefinition,
|
|
3453
|
+
tableDefinition,
|
|
3454
|
+
tableRowDefinition,
|
|
3455
|
+
tableCellDefinition,
|
|
3456
|
+
modalDefinition,
|
|
3457
|
+
drawerDefinition,
|
|
3458
|
+
collapsibleDefinition
|
|
3459
|
+
];
|
|
3460
|
+
function createDefaultComponentRegistry() {
|
|
3461
|
+
const registry = new ComponentRegistry();
|
|
3462
|
+
for (const def of coreComponentDefinitions) {
|
|
3463
|
+
registry.register(def);
|
|
3464
|
+
}
|
|
3465
|
+
return registry;
|
|
3466
|
+
}
|
|
3467
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
3468
|
+
0 && (module.exports = {
|
|
3469
|
+
CONTENT_CHILD_TYPES,
|
|
3470
|
+
LAYOUT_PARENTS,
|
|
3471
|
+
badgeDefinition,
|
|
3472
|
+
blockquoteDefinition,
|
|
3473
|
+
buttonDefinition,
|
|
3474
|
+
buttonSubmitDefinition,
|
|
3475
|
+
checkboxDefinition,
|
|
3476
|
+
codeBlockDefinition,
|
|
3477
|
+
collapsibleDefinition,
|
|
3478
|
+
collectionDefinition,
|
|
3479
|
+
columnsDefinition,
|
|
3480
|
+
containerDefinition,
|
|
3481
|
+
coreComponentDefinitions,
|
|
3482
|
+
createDefaultComponentRegistry,
|
|
3483
|
+
drawerDefinition,
|
|
3484
|
+
fileUploadDefinition,
|
|
3485
|
+
flexDefinition,
|
|
3486
|
+
formDefinition,
|
|
3487
|
+
gridDefinition,
|
|
3488
|
+
headingDefinition,
|
|
3489
|
+
htmlEmbedDefinition,
|
|
3490
|
+
iconDefinition,
|
|
3491
|
+
imageDefinition,
|
|
3492
|
+
inputDefinition,
|
|
3493
|
+
linkDefinition,
|
|
3494
|
+
listDefinition,
|
|
3495
|
+
listItemDefinition,
|
|
3496
|
+
modalDefinition,
|
|
3497
|
+
pageDefinition,
|
|
3498
|
+
paragraphDefinition,
|
|
3499
|
+
radioDefinition,
|
|
3500
|
+
radioGroupDefinition,
|
|
3501
|
+
radioItemDefinition,
|
|
3502
|
+
sectionDefinition,
|
|
3503
|
+
selectDefinition,
|
|
3504
|
+
switchDefinition,
|
|
3505
|
+
tableCellDefinition,
|
|
3506
|
+
tableDefinition,
|
|
3507
|
+
tableRowDefinition,
|
|
3508
|
+
textDefinition,
|
|
3509
|
+
textareaDefinition,
|
|
3510
|
+
videoDefinition
|
|
3511
|
+
});
|
|
3512
|
+
//# sourceMappingURL=index.cjs.map
|