@tachui/primitives 0.8.0-alpha
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/LICENSE +363 -0
- package/README.md +458 -0
- package/dist/BasicInput-CWFHw9rL.js +390 -0
- package/dist/Divider-DWgDKavU.js +474 -0
- package/dist/HTML-aWcvQ0VC.js +321 -0
- package/dist/Picker-DrZ7ibdt.js +1675 -0
- package/dist/Text-DYyFBJ6i.js +165 -0
- package/dist/controls/Button.d.ts +250 -0
- package/dist/controls/Button.d.ts.map +1 -0
- package/dist/controls/Link.d.ts +365 -0
- package/dist/controls/Link.d.ts.map +1 -0
- package/dist/controls/Picker.d.ts +153 -0
- package/dist/controls/Picker.d.ts.map +1 -0
- package/dist/controls/Toggle.d.ts +207 -0
- package/dist/controls/Toggle.d.ts.map +1 -0
- package/dist/controls/index.d.ts +8 -0
- package/dist/controls/index.d.ts.map +1 -0
- package/dist/controls/index.js +18 -0
- package/dist/display/HTML.d.ts +120 -0
- package/dist/display/HTML.d.ts.map +1 -0
- package/dist/display/Image.d.ts +192 -0
- package/dist/display/Image.d.ts.map +1 -0
- package/dist/display/Text.d.ts +269 -0
- package/dist/display/Text.d.ts.map +1 -0
- package/dist/display/index.d.ts +7 -0
- package/dist/display/index.d.ts.map +1 -0
- package/dist/display/index.js +21 -0
- package/dist/forms/BasicForm.d.ts +141 -0
- package/dist/forms/BasicForm.d.ts.map +1 -0
- package/dist/forms/BasicInput.d.ts +116 -0
- package/dist/forms/BasicInput.d.ts.map +1 -0
- package/dist/forms/index.d.ts +6 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +10 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +485 -0
- package/dist/layout/Divider.d.ts +168 -0
- package/dist/layout/Divider.d.ts.map +1 -0
- package/dist/layout/Spacer.d.ts +35 -0
- package/dist/layout/Spacer.d.ts.map +1 -0
- package/dist/layout/Stack.d.ts +74 -0
- package/dist/layout/Stack.d.ts.map +1 -0
- package/dist/layout/index.d.ts +7 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +15 -0
- package/dist/validation.d.ts +91 -0
- package/dist/validation.d.ts.map +1 -0
- package/package.json +82 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { D as x, b as k, d as B, c as T, H as b, L as P, S as y, a as I, V as j, Z as S, e as L, w as A } from "./Divider-DWgDKavU.js";
|
|
2
|
+
import { E as V, T as $, a as C, b as H, c as E } from "./Text-DYyFBJ6i.js";
|
|
3
|
+
import { E as q, d as U, e as D, f as N, g as W, h as _, i as M, H as R, I as Z, b as z, a as G, c as J } from "./HTML-aWcvQ0VC.js";
|
|
4
|
+
import { B as Q, a as X, E as Y, h as ee, c as te, L as oe, b as ne, P as ie, i as re, j as ae, T as se, e as ce, f as le, g as pe, d as de } from "./Picker-DrZ7ibdt.js";
|
|
5
|
+
import { B as ue, a as me, b as he, c as fe, d as ve, e as we, f as xe } from "./BasicInput-CWFHw9rL.js";
|
|
6
|
+
function d(e) {
|
|
7
|
+
return e && typeof e == "object" && "value" in e;
|
|
8
|
+
}
|
|
9
|
+
class n extends Error {
|
|
10
|
+
constructor(t, o) {
|
|
11
|
+
super(t), this.context = o, this.name = "TachUIValidationError";
|
|
12
|
+
}
|
|
13
|
+
getFormattedMessage() {
|
|
14
|
+
const {
|
|
15
|
+
component: t,
|
|
16
|
+
suggestion: o,
|
|
17
|
+
example: i,
|
|
18
|
+
documentation: s,
|
|
19
|
+
package: p
|
|
20
|
+
} = this.context;
|
|
21
|
+
let c = `❌ ${p ? `[@tachui/${p}]` : "[Primitives]"} ${t} Component Error: ${this.message}
|
|
22
|
+
`;
|
|
23
|
+
return o && (c += `
|
|
24
|
+
💡 Suggestion: ${o}
|
|
25
|
+
`), i && (c += `
|
|
26
|
+
❌ Wrong: ${i.wrong}`, c += `
|
|
27
|
+
✅ Correct: ${i.correct}
|
|
28
|
+
`), s && (c += `
|
|
29
|
+
📚 Documentation: ${s}`), c;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
let l = {
|
|
33
|
+
enabled: process.env.NODE_ENV !== "production",
|
|
34
|
+
errorLevel: "error"
|
|
35
|
+
};
|
|
36
|
+
function a() {
|
|
37
|
+
return l.enabled && process.env.NODE_ENV !== "production";
|
|
38
|
+
}
|
|
39
|
+
const r = {
|
|
40
|
+
// Text Component
|
|
41
|
+
validateText(e) {
|
|
42
|
+
if (!a()) return;
|
|
43
|
+
if (e.length === 0)
|
|
44
|
+
throw new n(
|
|
45
|
+
"Text component requires a content parameter",
|
|
46
|
+
{
|
|
47
|
+
component: "Text",
|
|
48
|
+
suggestion: 'Add a content parameter: Text("Hello World")',
|
|
49
|
+
documentation: "https://docs.tachui.dev/components/text",
|
|
50
|
+
example: {
|
|
51
|
+
wrong: "Text()",
|
|
52
|
+
correct: 'Text("Hello World")'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const [t] = e;
|
|
57
|
+
if (t == null)
|
|
58
|
+
throw new n(
|
|
59
|
+
"Text content cannot be undefined or null",
|
|
60
|
+
{
|
|
61
|
+
component: "Text",
|
|
62
|
+
suggestion: "Provide a valid string, function, or Signal",
|
|
63
|
+
example: {
|
|
64
|
+
wrong: "Text(null)",
|
|
65
|
+
correct: 'Text("Hello World")'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const o = typeof t;
|
|
70
|
+
if (!(o === "string" || o === "function" || d(t)))
|
|
71
|
+
throw new n(
|
|
72
|
+
`Text content must be a string, function, or Signal. Received: ${o}`,
|
|
73
|
+
{
|
|
74
|
+
component: "Text",
|
|
75
|
+
suggestion: "Use a string literal, function, or reactive signal",
|
|
76
|
+
example: {
|
|
77
|
+
wrong: "Text(123)",
|
|
78
|
+
correct: 'Text("Hello World")'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
// Button Component
|
|
84
|
+
validateButton(e) {
|
|
85
|
+
if (!a()) return;
|
|
86
|
+
if (e.length === 0)
|
|
87
|
+
throw new n(
|
|
88
|
+
"Button component requires a title parameter",
|
|
89
|
+
{
|
|
90
|
+
component: "Button",
|
|
91
|
+
suggestion: 'Add a title parameter: Button("Click me", () => {})',
|
|
92
|
+
documentation: "https://docs.tachui.dev/components/button",
|
|
93
|
+
example: {
|
|
94
|
+
wrong: "Button()",
|
|
95
|
+
correct: 'Button("Click me", () => {})'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
const [t, o] = e;
|
|
100
|
+
if (t == null)
|
|
101
|
+
throw new n(
|
|
102
|
+
"Button title cannot be undefined or null",
|
|
103
|
+
{
|
|
104
|
+
component: "Button",
|
|
105
|
+
suggestion: "Provide a valid string, function, or Signal",
|
|
106
|
+
example: {
|
|
107
|
+
wrong: "Button(null)",
|
|
108
|
+
correct: 'Button("Click me")'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
const i = typeof t;
|
|
113
|
+
if (!(i === "string" || i === "function" || d(t)))
|
|
114
|
+
throw new n(
|
|
115
|
+
`Button title must be a string, function, or Signal. Received: ${i}`,
|
|
116
|
+
{
|
|
117
|
+
component: "Button",
|
|
118
|
+
suggestion: "Use a string literal, function, or reactive signal",
|
|
119
|
+
example: {
|
|
120
|
+
wrong: "Button(123)",
|
|
121
|
+
correct: 'Button("Click me")'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
o === void 0 && e.length === 1 && l.errorLevel !== "error" && console.warn(
|
|
126
|
+
"⚠️ Button without action may not be interactive. Consider adding an action parameter."
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
// Image Component
|
|
130
|
+
validateImage(e) {
|
|
131
|
+
if (!a()) return;
|
|
132
|
+
if (e.length === 0)
|
|
133
|
+
throw new n(
|
|
134
|
+
"Image component requires a source parameter",
|
|
135
|
+
{
|
|
136
|
+
component: "Image",
|
|
137
|
+
suggestion: 'Add a source parameter: Image({ source: "image.jpg" })',
|
|
138
|
+
documentation: "https://docs.tachui.dev/components/image",
|
|
139
|
+
example: {
|
|
140
|
+
wrong: "Image()",
|
|
141
|
+
correct: 'Image({ source: "image.jpg" })'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
const [t] = e;
|
|
146
|
+
if (!t || typeof t != "object")
|
|
147
|
+
throw new n("Image requires a props object", {
|
|
148
|
+
component: "Image",
|
|
149
|
+
suggestion: "Pass a props object with source property",
|
|
150
|
+
example: {
|
|
151
|
+
wrong: 'Image("image.jpg")',
|
|
152
|
+
correct: 'Image({ source: "image.jpg" })'
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
if (!t.source)
|
|
156
|
+
throw new n("Image source property is required", {
|
|
157
|
+
component: "Image",
|
|
158
|
+
suggestion: "Provide a valid image source URL or path",
|
|
159
|
+
example: {
|
|
160
|
+
wrong: 'Image({ alt: "description" })',
|
|
161
|
+
correct: 'Image({ source: "image.jpg", alt: "description" })'
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
// Toggle Component
|
|
166
|
+
validateToggle(e) {
|
|
167
|
+
if (!a()) return;
|
|
168
|
+
if (e.length === 0)
|
|
169
|
+
throw new n(
|
|
170
|
+
"Toggle component requires an isOn parameter",
|
|
171
|
+
{
|
|
172
|
+
component: "Toggle",
|
|
173
|
+
suggestion: "Add an isOn parameter: Toggle({ isOn: signal })",
|
|
174
|
+
documentation: "https://docs.tachui.dev/components/toggle",
|
|
175
|
+
example: {
|
|
176
|
+
wrong: "Toggle()",
|
|
177
|
+
correct: "Toggle({ isOn: isEnabled })"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
const [t] = e;
|
|
182
|
+
if (!t || typeof t != "object")
|
|
183
|
+
throw new n("Toggle requires a props object", {
|
|
184
|
+
component: "Toggle",
|
|
185
|
+
suggestion: "Pass a props object with isOn property",
|
|
186
|
+
example: {
|
|
187
|
+
wrong: "Toggle(true)",
|
|
188
|
+
correct: "Toggle({ isOn: true })"
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
if (t.isOn === void 0)
|
|
192
|
+
throw new n("Toggle isOn property is required", {
|
|
193
|
+
component: "Toggle",
|
|
194
|
+
suggestion: "Provide a boolean value or Signal for isOn",
|
|
195
|
+
example: {
|
|
196
|
+
wrong: "Toggle({ onToggle: handler })",
|
|
197
|
+
correct: "Toggle({ isOn: true, onToggle: handler })"
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
// Picker Component
|
|
202
|
+
validatePicker(e) {
|
|
203
|
+
if (!a()) return;
|
|
204
|
+
if (e.length === 0)
|
|
205
|
+
throw new n(
|
|
206
|
+
"Picker component requires a props object",
|
|
207
|
+
{
|
|
208
|
+
component: "Picker",
|
|
209
|
+
suggestion: 'Add props: Picker({ options: ["A", "B"], selected: signal })',
|
|
210
|
+
documentation: "https://docs.tachui.dev/components/picker",
|
|
211
|
+
example: {
|
|
212
|
+
wrong: "Picker()",
|
|
213
|
+
correct: 'Picker({ options: ["A", "B"], selected: selectedValue })'
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
const [t] = e;
|
|
218
|
+
if (!t || typeof t != "object")
|
|
219
|
+
throw new n("Picker requires a props object", {
|
|
220
|
+
component: "Picker",
|
|
221
|
+
suggestion: "Pass a props object with options and selected properties",
|
|
222
|
+
example: {
|
|
223
|
+
wrong: 'Picker(["A", "B"])',
|
|
224
|
+
correct: 'Picker({ options: ["A", "B"], selected: selectedValue })'
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
const o = t;
|
|
228
|
+
if (!Array.isArray(o.options))
|
|
229
|
+
throw new n("Picker options must be an array", {
|
|
230
|
+
component: "Picker",
|
|
231
|
+
suggestion: "Provide an array of options",
|
|
232
|
+
example: {
|
|
233
|
+
wrong: 'Picker({ options: "invalid" })',
|
|
234
|
+
correct: 'Picker({ options: ["Option A", "Option B"] })'
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if (o.selected === void 0)
|
|
238
|
+
throw new n("Picker selected property is required", {
|
|
239
|
+
component: "Picker",
|
|
240
|
+
suggestion: "Provide a selected value or Signal",
|
|
241
|
+
example: {
|
|
242
|
+
wrong: 'Picker({ options: ["A", "B"] })',
|
|
243
|
+
correct: 'Picker({ options: ["A", "B"], selected: selectedValue })'
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
// Layout Components (VStack, HStack, ZStack)
|
|
248
|
+
validateStack(e, t) {
|
|
249
|
+
if (!a()) return;
|
|
250
|
+
if (t.length === 0)
|
|
251
|
+
throw new n(
|
|
252
|
+
`${e} component requires a props object with children array`,
|
|
253
|
+
{
|
|
254
|
+
component: e,
|
|
255
|
+
suggestion: `Add children: ${e}({ children: [Text("Hello")] })`,
|
|
256
|
+
documentation: "https://docs.tachui.dev/components/layout",
|
|
257
|
+
example: {
|
|
258
|
+
wrong: `${e}()`,
|
|
259
|
+
correct: `${e}({ children: [Text("Hello")] })`
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
const [o] = t;
|
|
264
|
+
if (!o || typeof o != "object")
|
|
265
|
+
throw new n(
|
|
266
|
+
`${e} requires a props object`,
|
|
267
|
+
{
|
|
268
|
+
component: e,
|
|
269
|
+
suggestion: "Pass a props object with children array",
|
|
270
|
+
example: {
|
|
271
|
+
wrong: `${e}("invalid")`,
|
|
272
|
+
correct: `${e}({ children: [Text("Hello")] })`
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
const i = o;
|
|
277
|
+
if (!Array.isArray(i.children))
|
|
278
|
+
throw new n(
|
|
279
|
+
`${e} children must be an array`,
|
|
280
|
+
{
|
|
281
|
+
component: e,
|
|
282
|
+
suggestion: "Provide an array of components",
|
|
283
|
+
example: {
|
|
284
|
+
wrong: `${e}({ children: Text("Hello") })`,
|
|
285
|
+
correct: `${e}({ children: [Text("Hello")] })`
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
},
|
|
290
|
+
// Link Component
|
|
291
|
+
validateLink(e) {
|
|
292
|
+
if (!a()) return;
|
|
293
|
+
if (e.length === 0)
|
|
294
|
+
throw new n(
|
|
295
|
+
"Link component requires a props object with href",
|
|
296
|
+
{
|
|
297
|
+
component: "Link",
|
|
298
|
+
suggestion: 'Add href: Link({ href: "/path", children: [Text("Click here")] })',
|
|
299
|
+
documentation: "https://docs.tachui.dev/components/link",
|
|
300
|
+
example: {
|
|
301
|
+
wrong: "Link()",
|
|
302
|
+
correct: 'Link({ href: "/about", children: [Text("About")] })'
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
const [t] = e;
|
|
307
|
+
if (!t || typeof t != "object")
|
|
308
|
+
throw new n("Link requires a props object", {
|
|
309
|
+
component: "Link",
|
|
310
|
+
suggestion: "Pass a props object with href property",
|
|
311
|
+
example: {
|
|
312
|
+
wrong: 'Link("/path")',
|
|
313
|
+
correct: 'Link({ href: "/path", children: [Text("Link")] })'
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
if (!t.href)
|
|
317
|
+
throw new n("Link href property is required", {
|
|
318
|
+
component: "Link",
|
|
319
|
+
suggestion: "Provide a valid URL or path for href",
|
|
320
|
+
example: {
|
|
321
|
+
wrong: 'Link({ children: [Text("Link")] })',
|
|
322
|
+
correct: 'Link({ href: "/about", children: [Text("About")] })'
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
// BasicForm Component
|
|
327
|
+
validateBasicForm(e) {
|
|
328
|
+
if (!a()) return;
|
|
329
|
+
if (e.length === 0)
|
|
330
|
+
throw new n(
|
|
331
|
+
"BasicForm component requires children array",
|
|
332
|
+
{
|
|
333
|
+
component: "BasicForm",
|
|
334
|
+
suggestion: 'Add children: BasicForm([BasicInput({}), Button("Submit")])',
|
|
335
|
+
documentation: "https://docs.tachui.dev/components/forms",
|
|
336
|
+
example: {
|
|
337
|
+
wrong: "BasicForm()",
|
|
338
|
+
correct: 'BasicForm([BasicInput({}), Button("Submit")])'
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
const [t, o] = e;
|
|
343
|
+
if (!Array.isArray(t))
|
|
344
|
+
throw new n("BasicForm children must be an array", {
|
|
345
|
+
component: "BasicForm",
|
|
346
|
+
suggestion: "Provide an array of form components",
|
|
347
|
+
example: {
|
|
348
|
+
wrong: "BasicForm(BasicInput({}))",
|
|
349
|
+
correct: 'BasicForm([BasicInput({}), Button("Submit")])'
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
},
|
|
353
|
+
// BasicInput Component
|
|
354
|
+
validateBasicInput(e) {
|
|
355
|
+
if (!a()) return;
|
|
356
|
+
const [t] = e;
|
|
357
|
+
if (t && typeof t == "object") {
|
|
358
|
+
const o = t;
|
|
359
|
+
if (o.type) {
|
|
360
|
+
const i = [
|
|
361
|
+
"text",
|
|
362
|
+
"email",
|
|
363
|
+
"password",
|
|
364
|
+
"number",
|
|
365
|
+
"tel",
|
|
366
|
+
"url",
|
|
367
|
+
"search"
|
|
368
|
+
];
|
|
369
|
+
if (!i.includes(o.type))
|
|
370
|
+
throw new n(
|
|
371
|
+
`Invalid input type: ${o.type}`,
|
|
372
|
+
{
|
|
373
|
+
component: "BasicInput",
|
|
374
|
+
suggestion: `Use one of: ${i.join(", ")}`,
|
|
375
|
+
example: {
|
|
376
|
+
wrong: 'BasicInput({ type: "invalid" })',
|
|
377
|
+
correct: 'BasicInput({ type: "email" })'
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
function g(e, t, o) {
|
|
386
|
+
return function(...s) {
|
|
387
|
+
return o(s), e.apply(this, s);
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function u(e) {
|
|
391
|
+
l = { ...l, ...e };
|
|
392
|
+
}
|
|
393
|
+
function m() {
|
|
394
|
+
return { ...l };
|
|
395
|
+
}
|
|
396
|
+
const f = {
|
|
397
|
+
// Direct validation methods
|
|
398
|
+
validateText: r.validateText,
|
|
399
|
+
validateButton: r.validateButton,
|
|
400
|
+
validateImage: r.validateImage,
|
|
401
|
+
validateToggle: r.validateToggle,
|
|
402
|
+
validatePicker: r.validatePicker,
|
|
403
|
+
validateStack: r.validateStack,
|
|
404
|
+
validateLink: r.validateLink,
|
|
405
|
+
validateBasicForm: r.validateBasicForm,
|
|
406
|
+
validateBasicInput: r.validateBasicInput,
|
|
407
|
+
// Configuration
|
|
408
|
+
configure: u,
|
|
409
|
+
getConfig: m,
|
|
410
|
+
// Utilities
|
|
411
|
+
isValidationEnabled: a,
|
|
412
|
+
withComponentValidation: g,
|
|
413
|
+
// Test method
|
|
414
|
+
test: () => {
|
|
415
|
+
console.group("🧪 Primitives Validation Test");
|
|
416
|
+
try {
|
|
417
|
+
console.info("Testing Text validation..."), r.validateText(["Hello World"]), console.info("✅ Text validation passed"), console.info("Testing Button validation..."), r.validateButton(["Click me", () => {
|
|
418
|
+
}]), console.info("✅ Button validation passed"), console.info("Testing Image validation..."), r.validateImage([{ source: "image.jpg" }]), console.info("✅ Image validation passed"), console.info("Testing Stack validation..."), r.validateStack("VStack", [
|
|
419
|
+
{ children: ["Hello"] }
|
|
420
|
+
]), console.info("✅ Stack validation passed"), console.info("✅ All primitives validation tests passed");
|
|
421
|
+
} catch (e) {
|
|
422
|
+
console.error("❌ Primitives validation test failed:", e);
|
|
423
|
+
}
|
|
424
|
+
console.groupEnd();
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
export {
|
|
428
|
+
ue as BasicForm,
|
|
429
|
+
me as BasicFormImplementation,
|
|
430
|
+
he as BasicFormStyles,
|
|
431
|
+
fe as BasicFormValidation,
|
|
432
|
+
ve as BasicInput,
|
|
433
|
+
we as BasicInputStyles,
|
|
434
|
+
xe as BasicInputUtils,
|
|
435
|
+
Q as Button,
|
|
436
|
+
X as ButtonStyles,
|
|
437
|
+
x as Divider,
|
|
438
|
+
k as DividerComponent,
|
|
439
|
+
B as DividerStyles,
|
|
440
|
+
T as DividerUtils,
|
|
441
|
+
Y as EnhancedButton,
|
|
442
|
+
q as EnhancedImage,
|
|
443
|
+
ee as EnhancedPicker,
|
|
444
|
+
V as EnhancedText,
|
|
445
|
+
te as EnhancedToggle,
|
|
446
|
+
U as H1,
|
|
447
|
+
D as H2,
|
|
448
|
+
N as H3,
|
|
449
|
+
W as H4,
|
|
450
|
+
_ as H5,
|
|
451
|
+
M as H6,
|
|
452
|
+
b as HStack,
|
|
453
|
+
R as HTML,
|
|
454
|
+
Z as Image,
|
|
455
|
+
z as ImageContentModes,
|
|
456
|
+
G as ImageStates,
|
|
457
|
+
J as ImageUtils,
|
|
458
|
+
P as LayoutComponent,
|
|
459
|
+
oe as Link,
|
|
460
|
+
ne as LinkUtils,
|
|
461
|
+
ie as Picker,
|
|
462
|
+
re as PickerStyles,
|
|
463
|
+
ae as PickerUtils,
|
|
464
|
+
r as PrimitiveComponentValidation,
|
|
465
|
+
f as PrimitivesValidationUtils,
|
|
466
|
+
y as Spacer,
|
|
467
|
+
I as SpacerComponent,
|
|
468
|
+
n as TachUIValidationError,
|
|
469
|
+
$ as Text,
|
|
470
|
+
C as TextFormat,
|
|
471
|
+
H as TextStyles,
|
|
472
|
+
se as Toggle,
|
|
473
|
+
ce as ToggleStyles,
|
|
474
|
+
le as ToggleUtils,
|
|
475
|
+
pe as ToggleWithLabel,
|
|
476
|
+
E as Typography,
|
|
477
|
+
j as VStack,
|
|
478
|
+
S as ZStack,
|
|
479
|
+
u as configurePrimitivesValidation,
|
|
480
|
+
de as defaultButtonTheme,
|
|
481
|
+
L as defaultDividerTheme,
|
|
482
|
+
m as getPrimitivesValidationConfig,
|
|
483
|
+
g as withComponentValidation,
|
|
484
|
+
A as withModifiers
|
|
485
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Divider Component
|
|
3
|
+
*
|
|
4
|
+
* SwiftUI-inspired Divider component for visual separation between content.
|
|
5
|
+
* Simple, clean line separator with customizable styling.
|
|
6
|
+
*/
|
|
7
|
+
import type { ModifiableComponent, ModifierBuilder } from '@tachui/core';
|
|
8
|
+
import type { Signal } from '@tachui/core';
|
|
9
|
+
import type { ComponentInstance, ComponentProps, DOMNode } from '@tachui/core';
|
|
10
|
+
/**
|
|
11
|
+
* Divider component properties
|
|
12
|
+
*/
|
|
13
|
+
export interface DividerProps extends ComponentProps {
|
|
14
|
+
color?: string | Signal<string>;
|
|
15
|
+
thickness?: number | Signal<number>;
|
|
16
|
+
length?: number | string | Signal<number | string>;
|
|
17
|
+
orientation?: 'horizontal' | 'vertical';
|
|
18
|
+
margin?: number | Signal<number>;
|
|
19
|
+
style?: 'solid' | 'dashed' | 'dotted';
|
|
20
|
+
opacity?: number | Signal<number>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Default divider theme
|
|
24
|
+
*/
|
|
25
|
+
export interface DividerTheme {
|
|
26
|
+
colors: {
|
|
27
|
+
default: string;
|
|
28
|
+
light: string;
|
|
29
|
+
medium: string;
|
|
30
|
+
heavy: string;
|
|
31
|
+
primary: string;
|
|
32
|
+
secondary: string;
|
|
33
|
+
subtle: string;
|
|
34
|
+
prominent: string;
|
|
35
|
+
};
|
|
36
|
+
thickness: {
|
|
37
|
+
thin: number;
|
|
38
|
+
medium: number;
|
|
39
|
+
thick: number;
|
|
40
|
+
};
|
|
41
|
+
spacing: {
|
|
42
|
+
small: number;
|
|
43
|
+
medium: number;
|
|
44
|
+
large: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export declare const defaultDividerTheme: DividerTheme;
|
|
48
|
+
/**
|
|
49
|
+
* Divider component implementation
|
|
50
|
+
*/
|
|
51
|
+
export declare class DividerComponent implements ComponentInstance<DividerProps> {
|
|
52
|
+
readonly type: "component";
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly props: DividerProps;
|
|
55
|
+
cleanup: (() => void)[];
|
|
56
|
+
private theme;
|
|
57
|
+
constructor(props: DividerProps);
|
|
58
|
+
private resolveValue;
|
|
59
|
+
private getBaseStyles;
|
|
60
|
+
render(): DOMNode;
|
|
61
|
+
/**
|
|
62
|
+
* Cleanup resources
|
|
63
|
+
*/
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create a Divider component
|
|
68
|
+
*/
|
|
69
|
+
export declare function Divider(props?: DividerProps): ModifiableComponent<DividerProps> & {
|
|
70
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Divider utility functions
|
|
74
|
+
*/
|
|
75
|
+
export declare const DividerUtils: {
|
|
76
|
+
/**
|
|
77
|
+
* Create a horizontal divider
|
|
78
|
+
*/
|
|
79
|
+
horizontal(props?: Omit<DividerProps, "orientation">): ModifiableComponent<DividerProps> & {
|
|
80
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Create a vertical divider
|
|
84
|
+
*/
|
|
85
|
+
vertical(lengthOrProps?: number | string | Omit<DividerProps, "orientation">, thickness?: number): ModifiableComponent<DividerProps> & {
|
|
86
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Create a thin divider
|
|
90
|
+
*/
|
|
91
|
+
thin(color?: string): ModifiableComponent<DividerProps> & {
|
|
92
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Create a medium divider
|
|
96
|
+
*/
|
|
97
|
+
medium(color?: string): ModifiableComponent<DividerProps> & {
|
|
98
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Create a thick divider
|
|
102
|
+
*/
|
|
103
|
+
thick(color?: string): ModifiableComponent<DividerProps> & {
|
|
104
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Create a dashed divider
|
|
108
|
+
*/
|
|
109
|
+
dashed(color?: string, thickness?: number): ModifiableComponent<DividerProps> & {
|
|
110
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Create a dotted divider
|
|
114
|
+
*/
|
|
115
|
+
dotted(color?: string, thickness?: number): ModifiableComponent<DividerProps> & {
|
|
116
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Create a subtle divider
|
|
120
|
+
*/
|
|
121
|
+
subtle(color?: string): ModifiableComponent<DividerProps> & {
|
|
122
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Create a prominent divider
|
|
126
|
+
*/
|
|
127
|
+
prominent(color?: string): ModifiableComponent<DividerProps> & {
|
|
128
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Divider styles utility
|
|
133
|
+
*/
|
|
134
|
+
export declare const DividerStyles: {
|
|
135
|
+
theme: DividerTheme;
|
|
136
|
+
colors: {
|
|
137
|
+
primary: string;
|
|
138
|
+
success: string;
|
|
139
|
+
warning: string;
|
|
140
|
+
danger: string;
|
|
141
|
+
};
|
|
142
|
+
thin: (color?: string) => {
|
|
143
|
+
thickness: number;
|
|
144
|
+
color: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
medium: (color?: string) => {
|
|
147
|
+
thickness: number;
|
|
148
|
+
color: string | undefined;
|
|
149
|
+
};
|
|
150
|
+
thick: (color?: string) => {
|
|
151
|
+
thickness: number;
|
|
152
|
+
color: string | undefined;
|
|
153
|
+
};
|
|
154
|
+
createTheme: (overrides: Partial<DividerTheme>) => DividerTheme;
|
|
155
|
+
primary: (color?: string) => ModifiableComponent<DividerProps> & {
|
|
156
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
157
|
+
};
|
|
158
|
+
secondary: (color?: string) => ModifiableComponent<DividerProps> & {
|
|
159
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
160
|
+
};
|
|
161
|
+
subtle: (color?: string) => ModifiableComponent<DividerProps> & {
|
|
162
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
163
|
+
};
|
|
164
|
+
prominent: (color?: string) => ModifiableComponent<DividerProps> & {
|
|
165
|
+
modifier: ModifierBuilder<ModifiableComponent<DividerProps>>;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../src/layout/Divider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG9E;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc;IAElD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,G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C,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAA;KAC7D;IAID;;OAEG;mBAEO,MAAM,cACF,MAAM,GACjB,mBAAmB,CAAC,YAAY,CAAC,GAAG;QACrC,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAA;KAC7D;IAID;;OAEG;mBACY,MAAM,GAAG,mBAAmB,CAAC,YAAY,CAAC,GAAG;QAC1D,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAA;KAC7D;IAOD;;OAEG;sBACe,MAAM,GAAG,mBAAmB,CAAC,YAAY,CAAC,GAAG;QAC7D,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAA;KAC7D;CAMF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;mBAUT,MAAM;;;;qBAIJ,MAAM;;;;oBAIP,MAAM;;;;6BAKG,OAAO,CAAC,YAAY,CAAC,KAAG,YAAY;sBAgB3C,MAAM;kBA7Jd,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;;wBA+JxC,MAAM;kBA/JhB,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;;qBAiK3C,MAAM;kBAjKb,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;;wBAmKxC,MAAM;kBAnKhB,eAAe,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;;CAqK7D,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spacer Component
|
|
3
|
+
*
|
|
4
|
+
* SwiftUI-inspired Spacer component that expands to fill available space
|
|
5
|
+
* along the main axis of its container. Behaves like SwiftUI.Spacer.
|
|
6
|
+
*/
|
|
7
|
+
import type { ModifiableComponent, ModifierBuilder } from '@tachui/core';
|
|
8
|
+
import type { ComponentInstance, ComponentProps, DOMNode } from '@tachui/core';
|
|
9
|
+
import { ComponentWithCSSClasses, type CSSClassesProps } from '@tachui/core';
|
|
10
|
+
/**
|
|
11
|
+
* Spacer component properties with CSS classes support
|
|
12
|
+
*/
|
|
13
|
+
export interface SpacerProps extends ComponentProps, CSSClassesProps {
|
|
14
|
+
minLength?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Spacer component implementation with CSS classes support
|
|
18
|
+
*/
|
|
19
|
+
export declare class SpacerComponent extends ComponentWithCSSClasses implements ComponentInstance<SpacerProps> {
|
|
20
|
+
readonly type: "component";
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly props: SpacerProps;
|
|
23
|
+
constructor(props: SpacerProps);
|
|
24
|
+
render(): DOMNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a Spacer component with optional minimum length
|
|
28
|
+
*/
|
|
29
|
+
export declare function Spacer(minLength?: number): ModifiableComponent<SpacerProps> & {
|
|
30
|
+
modifier: ModifierBuilder<ModifiableComponent<SpacerProps>>;
|
|
31
|
+
};
|
|
32
|
+
export declare function Spacer(props?: SpacerProps): ModifiableComponent<SpacerProps> & {
|
|
33
|
+
modifier: ModifierBuilder<ModifiableComponent<SpacerProps>>;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=Spacer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spacer.d.ts","sourceRoot":"","sources":["../../src/layout/Spacer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE9E,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAE5E;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,cAAc,EAAE,eAAe;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAoBD;;GAEG;AACH,qBAAa,eACX,SAAQ,uBACR,YAAW,iBAAiB,CAAC,WAAW,CAAC;IAEzC,SAAgB,IAAI,EAAG,WAAW,CAAS;IAC3C,SAAgB,EAAE,EAAE,MAAM,CAAA;IAC1B,SAAgB,KAAK,EAAE,WAAW,CAAA;gBAEtB,KAAK,EAAE,WAAW;IAM9B,MAAM,IAAI,OAAO;CA8BlB;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC,WAAW,CAAC,GAAG;IAC7E,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAA;CAC5D,CAAA;AACD,wBAAgB,MAAM,CACpB,KAAK,CAAC,EAAE,WAAW,GAClB,mBAAmB,CAAC,WAAW,CAAC,GAAG;IACpC,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAA;CAC5D,CAAA"}
|