@formadapter/daisyui 0.0.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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/index.d.ts +230 -0
- package/dist/index.js +694 -0
- package/dist/index.js.map +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ludicrous
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# `@formadapter/daisyui`
|
|
2
|
+
|
|
3
|
+
A complete DaisyUI 5 adapter for FormAdapter. It renders accessible native HTML
|
|
4
|
+
elements with DaisyUI classes and has no React wrapper dependency.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
bun add @formadapter/react @formadapter/daisyui daisyui zod
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Enable DaisyUI and include the adapter build in Tailwind's source scan:
|
|
11
|
+
|
|
12
|
+
```css
|
|
13
|
+
@import "tailwindcss";
|
|
14
|
+
@source "../node_modules/@formadapter/daisyui/dist";
|
|
15
|
+
@plugin "daisyui";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Set DaisyUI once
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
"use client";
|
|
22
|
+
|
|
23
|
+
import { DaisyUIProvider } from "@formadapter/daisyui";
|
|
24
|
+
|
|
25
|
+
export function Providers({ children }: { children: React.ReactNode }) {
|
|
26
|
+
return <DaisyUIProvider>{children}</DaisyUIProvider>;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Forms created with `createForm` from `@formadapter/react` resolve that nearest
|
|
31
|
+
provider automatically. A nested `FormAdapterProvider` replaces DaisyUI for its
|
|
32
|
+
subtree rather than merging adapters implicitly.
|
|
33
|
+
|
|
34
|
+
For a standalone form, this package also exports an adapter-bound factory:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { createForm } from "@formadapter/daisyui";
|
|
38
|
+
import { z } from "zod";
|
|
39
|
+
|
|
40
|
+
const Contact = createForm(z.object({
|
|
41
|
+
email: z.email(),
|
|
42
|
+
message: z.string(),
|
|
43
|
+
})).configure({
|
|
44
|
+
fields: { message: { control: "textarea" } },
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export function ContactForm() {
|
|
48
|
+
return <Contact.Form onSubmit={(values) => console.log(values)} />;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The adapter includes input, textarea, select, radio, checkbox, and file controls
|
|
53
|
+
plus all form, group, array, button, wizard, message, validation-summary, and
|
|
54
|
+
unsupported-schema slots. It reflects disabled, read-only, required, invalid,
|
|
55
|
+
pending, and validating state with native behavior and DaisyUI classes.
|
|
56
|
+
|
|
57
|
+
Use `daisyUIAdapter.extend(...)` to replace selected controls or slots and/or
|
|
58
|
+
register typed custom controls, then provide the resulting complete adapter at
|
|
59
|
+
the scope where it should apply.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { ArrayItemSlotProps, ArraySlotProps, ButtonSlotProps, ControlProps, CreateForm, ErrorSummarySlotProps, FieldSlotProps, FormAdapter, FormMessageSlotProps, FormSlotProps, GroupSlotProps, UnsupportedSlotProps, WizardSlotProps } from "@formadapter/react";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/adapter.d.ts
|
|
6
|
+
declare const daisyUIAdapter: FormAdapter<Record<never, never>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/provider.d.ts
|
|
9
|
+
interface DaisyUIProviderProps {
|
|
10
|
+
readonly children: ReactNode;
|
|
11
|
+
/** Must match DaisyUI's `prefix` plugin option, including separators. */
|
|
12
|
+
readonly prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Client boundary that keeps the function-rich adapter out of Server Component props. */
|
|
15
|
+
declare function DaisyUIProvider({
|
|
16
|
+
children,
|
|
17
|
+
prefix
|
|
18
|
+
}: DaisyUIProviderProps): ReactNode;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/controls/checkbox.d.ts
|
|
21
|
+
declare function Checkbox({
|
|
22
|
+
controlRef,
|
|
23
|
+
disabled,
|
|
24
|
+
field,
|
|
25
|
+
id,
|
|
26
|
+
inputProps,
|
|
27
|
+
invalid,
|
|
28
|
+
name,
|
|
29
|
+
onBlur,
|
|
30
|
+
onValueChange,
|
|
31
|
+
readOnly,
|
|
32
|
+
required,
|
|
33
|
+
value
|
|
34
|
+
}: ControlProps): ReactNode;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/controls/file.d.ts
|
|
37
|
+
declare function File({
|
|
38
|
+
controlRef,
|
|
39
|
+
disabled,
|
|
40
|
+
field,
|
|
41
|
+
id,
|
|
42
|
+
inputProps,
|
|
43
|
+
invalid,
|
|
44
|
+
name,
|
|
45
|
+
onBlur,
|
|
46
|
+
onValueChange,
|
|
47
|
+
readOnly,
|
|
48
|
+
required,
|
|
49
|
+
value
|
|
50
|
+
}: ControlProps): ReactNode;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/controls/input.d.ts
|
|
53
|
+
declare function Input({
|
|
54
|
+
controlRef,
|
|
55
|
+
disabled,
|
|
56
|
+
field,
|
|
57
|
+
id,
|
|
58
|
+
inputProps,
|
|
59
|
+
invalid,
|
|
60
|
+
name,
|
|
61
|
+
onBlur,
|
|
62
|
+
onValueChange,
|
|
63
|
+
readOnly,
|
|
64
|
+
required,
|
|
65
|
+
value
|
|
66
|
+
}: ControlProps): ReactNode;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/controls/radio.d.ts
|
|
69
|
+
declare function Radio({
|
|
70
|
+
controlRef,
|
|
71
|
+
disabled,
|
|
72
|
+
field,
|
|
73
|
+
id,
|
|
74
|
+
inputProps,
|
|
75
|
+
invalid,
|
|
76
|
+
name,
|
|
77
|
+
onBlur,
|
|
78
|
+
onValueChange,
|
|
79
|
+
readOnly,
|
|
80
|
+
required,
|
|
81
|
+
value
|
|
82
|
+
}: ControlProps): ReactNode;
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/controls/select.d.ts
|
|
85
|
+
declare function Select({
|
|
86
|
+
controlRef,
|
|
87
|
+
disabled,
|
|
88
|
+
field,
|
|
89
|
+
id,
|
|
90
|
+
inputProps,
|
|
91
|
+
invalid,
|
|
92
|
+
name,
|
|
93
|
+
onBlur,
|
|
94
|
+
onValueChange,
|
|
95
|
+
readOnly,
|
|
96
|
+
required,
|
|
97
|
+
value
|
|
98
|
+
}: ControlProps): ReactNode;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/controls/textarea.d.ts
|
|
101
|
+
declare function Textarea({
|
|
102
|
+
controlRef,
|
|
103
|
+
disabled,
|
|
104
|
+
field,
|
|
105
|
+
id,
|
|
106
|
+
inputProps,
|
|
107
|
+
invalid,
|
|
108
|
+
name,
|
|
109
|
+
onBlur,
|
|
110
|
+
onValueChange,
|
|
111
|
+
readOnly,
|
|
112
|
+
required,
|
|
113
|
+
value
|
|
114
|
+
}: ControlProps): ReactNode;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/slots/array.d.ts
|
|
117
|
+
declare function Array({
|
|
118
|
+
actions,
|
|
119
|
+
children,
|
|
120
|
+
className,
|
|
121
|
+
disabled,
|
|
122
|
+
error,
|
|
123
|
+
errorId,
|
|
124
|
+
field,
|
|
125
|
+
itemCount,
|
|
126
|
+
readOnly,
|
|
127
|
+
required,
|
|
128
|
+
style,
|
|
129
|
+
...props
|
|
130
|
+
}: ArraySlotProps): ReactNode;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/slots/array-item.d.ts
|
|
133
|
+
declare function ArrayItem({
|
|
134
|
+
actions,
|
|
135
|
+
children,
|
|
136
|
+
className,
|
|
137
|
+
field,
|
|
138
|
+
index,
|
|
139
|
+
label,
|
|
140
|
+
style,
|
|
141
|
+
...props
|
|
142
|
+
}: ArrayItemSlotProps): ReactNode;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/slots/button.d.ts
|
|
145
|
+
declare function Button({
|
|
146
|
+
ariaLabel,
|
|
147
|
+
children,
|
|
148
|
+
disabled,
|
|
149
|
+
intent,
|
|
150
|
+
onClick,
|
|
151
|
+
pending,
|
|
152
|
+
type
|
|
153
|
+
}: ButtonSlotProps): ReactNode;
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/slots/error-summary.d.ts
|
|
156
|
+
declare function ErrorSummary({
|
|
157
|
+
errors,
|
|
158
|
+
items,
|
|
159
|
+
onSelect,
|
|
160
|
+
title
|
|
161
|
+
}: ErrorSummarySlotProps): ReactNode;
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/slots/field.d.ts
|
|
164
|
+
declare function Field({
|
|
165
|
+
children,
|
|
166
|
+
className,
|
|
167
|
+
controlId,
|
|
168
|
+
descriptionId,
|
|
169
|
+
error,
|
|
170
|
+
errorId,
|
|
171
|
+
field,
|
|
172
|
+
invalid,
|
|
173
|
+
required,
|
|
174
|
+
style,
|
|
175
|
+
validating,
|
|
176
|
+
...props
|
|
177
|
+
}: FieldSlotProps): ReactNode;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/slots/form.d.ts
|
|
180
|
+
declare function Form({
|
|
181
|
+
children,
|
|
182
|
+
className,
|
|
183
|
+
style,
|
|
184
|
+
...props
|
|
185
|
+
}: FormSlotProps): ReactNode;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/slots/form-message.d.ts
|
|
188
|
+
declare function FormMessage({
|
|
189
|
+
kind,
|
|
190
|
+
message
|
|
191
|
+
}: FormMessageSlotProps): ReactNode;
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/slots/group.d.ts
|
|
194
|
+
declare function Group({
|
|
195
|
+
children,
|
|
196
|
+
className,
|
|
197
|
+
disabled,
|
|
198
|
+
error,
|
|
199
|
+
errorId,
|
|
200
|
+
field,
|
|
201
|
+
readOnly,
|
|
202
|
+
required,
|
|
203
|
+
style,
|
|
204
|
+
...props
|
|
205
|
+
}: GroupSlotProps): ReactNode;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/slots/unsupported.d.ts
|
|
208
|
+
declare function Unsupported({
|
|
209
|
+
field,
|
|
210
|
+
reason
|
|
211
|
+
}: UnsupportedSlotProps): ReactNode;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/slots/wizard.d.ts
|
|
214
|
+
declare function Wizard({
|
|
215
|
+
children,
|
|
216
|
+
className,
|
|
217
|
+
currentStep,
|
|
218
|
+
description,
|
|
219
|
+
navigation,
|
|
220
|
+
steps,
|
|
221
|
+
title,
|
|
222
|
+
totalSteps,
|
|
223
|
+
...props
|
|
224
|
+
}: WizardSlotProps): ReactNode;
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/index.d.ts
|
|
227
|
+
declare const createForm: CreateForm<typeof daisyUIAdapter>;
|
|
228
|
+
//#endregion
|
|
229
|
+
export { Array, ArrayItem, Button, Checkbox, DaisyUIProvider, type DaisyUIProviderProps, ErrorSummary, Field, File, Form, FormMessage, Group, Input, Radio, Select, Textarea, Unsupported, Wizard, createForm, daisyUIAdapter };
|
|
230
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import { FormAdapterProvider, createAdapter, createFormFactory } from "@formadapter/react";
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useId, useRef } from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { changedInputValue, inputType, inputValue, nativeControlProps, optionForValue, selectedOptionValue, serializedOptionValue } from "@formadapter/html/native";
|
|
7
|
+
//#region src/class-names.ts
|
|
8
|
+
function classNames(...values) {
|
|
9
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
10
|
+
for (const value of values) {
|
|
11
|
+
if (!value) continue;
|
|
12
|
+
for (const token of value.split(/\s+/u)) if (token) tokens.add(token);
|
|
13
|
+
}
|
|
14
|
+
return tokens.size > 0 ? [...tokens].join(" ") : void 0;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/prefix.tsx
|
|
18
|
+
const DaisyUIClassPrefixContext = createContext("");
|
|
19
|
+
const DAISY_UI_COMPONENT_CLASS_ROOTS = [
|
|
20
|
+
"alert",
|
|
21
|
+
"btn",
|
|
22
|
+
"card",
|
|
23
|
+
"checkbox",
|
|
24
|
+
"fieldset",
|
|
25
|
+
"file-input",
|
|
26
|
+
"input",
|
|
27
|
+
"join",
|
|
28
|
+
"label",
|
|
29
|
+
"link",
|
|
30
|
+
"loading",
|
|
31
|
+
"progress",
|
|
32
|
+
"radio",
|
|
33
|
+
"range",
|
|
34
|
+
"select",
|
|
35
|
+
"textarea"
|
|
36
|
+
];
|
|
37
|
+
function isDaisyUIComponentClass(token) {
|
|
38
|
+
return DAISY_UI_COMPONENT_CLASS_ROOTS.some((root) => token === root || token.startsWith(`${root}-`));
|
|
39
|
+
}
|
|
40
|
+
function DaisyUIClassPrefixProvider({ children, prefix }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(DaisyUIClassPrefixContext.Provider, {
|
|
42
|
+
value: prefix,
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** Prefixes DaisyUI component classes without rewriting Tailwind utilities. */
|
|
47
|
+
function useDaisyUIClassNames(...values) {
|
|
48
|
+
const prefix = useContext(DaisyUIClassPrefixContext);
|
|
49
|
+
return classNames(...values.map((value) => {
|
|
50
|
+
if (!value || prefix.length === 0) return value;
|
|
51
|
+
return value.split(/\s+/u).filter(Boolean).map((token) => isDaisyUIComponentClass(token) ? `${prefix}${token}` : token).join(" ");
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/controls/checkbox.tsx
|
|
56
|
+
function requiresCheckedValue(field) {
|
|
57
|
+
return typeof field.source === "object" && field.source !== null && field.source.const === true;
|
|
58
|
+
}
|
|
59
|
+
function Checkbox({ controlRef, disabled, field, id, inputProps, invalid, name, onBlur, onValueChange, readOnly, required, value }) {
|
|
60
|
+
const configured = nativeControlProps(field);
|
|
61
|
+
const daisyClassName = useDaisyUIClassNames("checkbox", invalid && "checkbox-error");
|
|
62
|
+
return /* @__PURE__ */ jsx("input", {
|
|
63
|
+
...configured.props,
|
|
64
|
+
...inputProps,
|
|
65
|
+
"aria-readonly": readOnly || void 0,
|
|
66
|
+
checked: value === true,
|
|
67
|
+
className: classNames(daisyClassName, configured.className),
|
|
68
|
+
disabled: disabled || readOnly,
|
|
69
|
+
id,
|
|
70
|
+
name,
|
|
71
|
+
onBlur,
|
|
72
|
+
onChange: (event) => {
|
|
73
|
+
if (!readOnly) onValueChange(event.currentTarget.checked);
|
|
74
|
+
},
|
|
75
|
+
readOnly,
|
|
76
|
+
ref: controlRef,
|
|
77
|
+
required: required && requiresCheckedValue(field),
|
|
78
|
+
style: configured.style,
|
|
79
|
+
type: "checkbox",
|
|
80
|
+
value: "true"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/controls/control-style.ts
|
|
85
|
+
function mergeControlStyle(configured) {
|
|
86
|
+
return {
|
|
87
|
+
width: "100%",
|
|
88
|
+
...configured
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/controls/file.tsx
|
|
93
|
+
function isFileMetadata(value) {
|
|
94
|
+
return typeof value === "object" && value !== null && typeof value.lastModified === "number" && typeof value.name === "string" && typeof value.size === "number" && typeof value.type === "string";
|
|
95
|
+
}
|
|
96
|
+
function controlledFiles(value) {
|
|
97
|
+
if (isFileMetadata(value)) return [value];
|
|
98
|
+
if (typeof FileList !== "undefined" && value instanceof FileList) return Array.from(value).filter(isFileMetadata);
|
|
99
|
+
if (!Array.isArray(value)) return [];
|
|
100
|
+
return value.filter(isFileMetadata);
|
|
101
|
+
}
|
|
102
|
+
function nativeFilesMatch(value, files) {
|
|
103
|
+
const controlled = controlledFiles(value);
|
|
104
|
+
if (controlled.length === 0 || files?.length !== controlled.length) return false;
|
|
105
|
+
return controlled.every((file, index) => {
|
|
106
|
+
const nativeFile = files.item(index);
|
|
107
|
+
return nativeFile !== null && (Object.is(file, nativeFile) || file.name === nativeFile.name && file.size === nativeFile.size && file.type === nativeFile.type && file.lastModified === nativeFile.lastModified);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function File({ controlRef, disabled, field, id, inputProps, invalid, name, onBlur, onValueChange, readOnly, required, value }) {
|
|
111
|
+
const configured = nativeControlProps(field);
|
|
112
|
+
const daisyClassName = useDaisyUIClassNames("file-input", invalid && "file-input-error");
|
|
113
|
+
const input = useRef(null);
|
|
114
|
+
const setControlRef = useCallback((instance) => {
|
|
115
|
+
input.current = instance;
|
|
116
|
+
controlRef(instance);
|
|
117
|
+
}, [controlRef]);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
const current = input.current;
|
|
120
|
+
if (current?.value && !nativeFilesMatch(value, current.files)) current.value = "";
|
|
121
|
+
}, [value]);
|
|
122
|
+
return /* @__PURE__ */ jsx("input", {
|
|
123
|
+
...configured.props,
|
|
124
|
+
...inputProps,
|
|
125
|
+
accept: field.constraints.accept ?? field.constraints.contentMediaType ?? configured.props.accept,
|
|
126
|
+
className: classNames(daisyClassName, configured.className),
|
|
127
|
+
disabled: disabled || readOnly,
|
|
128
|
+
id,
|
|
129
|
+
multiple: field.config.multiple || field.constraints.multiple,
|
|
130
|
+
name,
|
|
131
|
+
onBlur,
|
|
132
|
+
onChange: (event) => {
|
|
133
|
+
const files = event.currentTarget.files;
|
|
134
|
+
onValueChange(field.config.multiple || field.constraints.multiple ? Array.from(files ?? []) : files?.[0] ?? "");
|
|
135
|
+
},
|
|
136
|
+
ref: setControlRef,
|
|
137
|
+
required,
|
|
138
|
+
style: mergeControlStyle(configured.style),
|
|
139
|
+
type: "file"
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/controls/input.tsx
|
|
144
|
+
function Input({ controlRef, disabled, field, id, inputProps, invalid, name, onBlur, onValueChange, readOnly, required, value }) {
|
|
145
|
+
const configured = nativeControlProps(field);
|
|
146
|
+
const type = inputType(field);
|
|
147
|
+
const daisyClassName = useDaisyUIClassNames(type === "hidden" ? void 0 : type === "range" ? "range" : "input", invalid && (type === "range" ? "range-error" : type === "hidden" ? void 0 : "input-error"));
|
|
148
|
+
return /* @__PURE__ */ jsx("input", {
|
|
149
|
+
...configured.props,
|
|
150
|
+
...inputProps,
|
|
151
|
+
className: classNames(daisyClassName, configured.className),
|
|
152
|
+
disabled: disabled || readOnly && type === "range",
|
|
153
|
+
id,
|
|
154
|
+
max: field.constraints.maximum,
|
|
155
|
+
maxLength: field.constraints.maxLength,
|
|
156
|
+
min: field.constraints.minimum,
|
|
157
|
+
minLength: field.constraints.minLength,
|
|
158
|
+
name,
|
|
159
|
+
onBlur,
|
|
160
|
+
onChange: (event) => {
|
|
161
|
+
if (readOnly) return;
|
|
162
|
+
onValueChange(changedInputValue(field, event.currentTarget.value, event.currentTarget.valueAsNumber));
|
|
163
|
+
},
|
|
164
|
+
pattern: field.constraints.pattern,
|
|
165
|
+
placeholder: field.config.placeholder ?? configured.props.placeholder,
|
|
166
|
+
readOnly,
|
|
167
|
+
ref: controlRef,
|
|
168
|
+
required,
|
|
169
|
+
step: field.constraints.multipleOf ?? (field.dataType === "integer" ? 1 : field.dataType === "number" ? "any" : void 0),
|
|
170
|
+
style: mergeControlStyle(configured.style),
|
|
171
|
+
type,
|
|
172
|
+
value: inputValue(value, type)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/controls/radio.tsx
|
|
177
|
+
function Radio({ controlRef, disabled, field, id, inputProps, invalid, name, onBlur, onValueChange, readOnly, required, value }) {
|
|
178
|
+
const configured = nativeControlProps(field);
|
|
179
|
+
const options = field.options ?? [];
|
|
180
|
+
const labelClassName = useDaisyUIClassNames("label");
|
|
181
|
+
const radioClassName = useDaisyUIClassNames("radio", invalid && "radio-error");
|
|
182
|
+
return /* @__PURE__ */ jsx("div", {
|
|
183
|
+
...inputProps,
|
|
184
|
+
"aria-label": inputProps["aria-label"] ?? field.label,
|
|
185
|
+
"aria-readonly": readOnly || void 0,
|
|
186
|
+
"aria-required": required || void 0,
|
|
187
|
+
ref: options.length === 0 ? controlRef : void 0,
|
|
188
|
+
role: "radiogroup",
|
|
189
|
+
style: {
|
|
190
|
+
display: "flex",
|
|
191
|
+
flexWrap: "wrap",
|
|
192
|
+
gap: "0.75rem"
|
|
193
|
+
},
|
|
194
|
+
tabIndex: options.length === 0 ? -1 : void 0,
|
|
195
|
+
children: options.map((option, index) => {
|
|
196
|
+
const optionId = index === 0 ? id : `${id}-${index}`;
|
|
197
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
198
|
+
className: labelClassName,
|
|
199
|
+
htmlFor: optionId,
|
|
200
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
201
|
+
...configured.props,
|
|
202
|
+
className: classNames(radioClassName, configured.className),
|
|
203
|
+
checked: Object.is(value, option.value),
|
|
204
|
+
disabled: disabled || readOnly,
|
|
205
|
+
id: optionId,
|
|
206
|
+
name,
|
|
207
|
+
onBlur,
|
|
208
|
+
onChange: () => {
|
|
209
|
+
if (!readOnly) onValueChange(option.value);
|
|
210
|
+
},
|
|
211
|
+
readOnly,
|
|
212
|
+
ref: index === 0 ? controlRef : void 0,
|
|
213
|
+
required,
|
|
214
|
+
style: configured.style,
|
|
215
|
+
type: "radio",
|
|
216
|
+
value: serializedOptionValue(option.value)
|
|
217
|
+
}), /* @__PURE__ */ jsx("span", { children: option.label })]
|
|
218
|
+
}, optionId);
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/controls/select.tsx
|
|
224
|
+
function Select({ controlRef, disabled, field, id, inputProps, invalid, name, onBlur, onValueChange, readOnly, required, value }) {
|
|
225
|
+
const configured = nativeControlProps(field);
|
|
226
|
+
const options = field.options ?? [];
|
|
227
|
+
const placeholder = field.config.placeholder ?? "Select an option";
|
|
228
|
+
const daisyClassName = useDaisyUIClassNames("select", invalid && "select-error");
|
|
229
|
+
return /* @__PURE__ */ jsxs("select", {
|
|
230
|
+
...configured.props,
|
|
231
|
+
...inputProps,
|
|
232
|
+
"aria-readonly": readOnly || void 0,
|
|
233
|
+
className: classNames(daisyClassName, configured.className),
|
|
234
|
+
disabled: disabled || readOnly,
|
|
235
|
+
id,
|
|
236
|
+
name,
|
|
237
|
+
onBlur,
|
|
238
|
+
onChange: (event) => {
|
|
239
|
+
if (readOnly) return;
|
|
240
|
+
const selected = optionForValue(options, event.currentTarget.value);
|
|
241
|
+
onValueChange(selected ? selected.value : "");
|
|
242
|
+
},
|
|
243
|
+
required,
|
|
244
|
+
ref: controlRef,
|
|
245
|
+
style: mergeControlStyle(configured.style),
|
|
246
|
+
value: selectedOptionValue(options, value),
|
|
247
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
248
|
+
disabled: required,
|
|
249
|
+
value: "",
|
|
250
|
+
children: placeholder
|
|
251
|
+
}), options.map((option, index) => /* @__PURE__ */ jsx("option", {
|
|
252
|
+
value: serializedOptionValue(option.value),
|
|
253
|
+
children: option.label
|
|
254
|
+
}, `${serializedOptionValue(option.value)}-${index}`))]
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/controls/textarea.tsx
|
|
259
|
+
function Textarea({ controlRef, disabled, field, id, inputProps, invalid, name, onBlur, onValueChange, readOnly, required, value }) {
|
|
260
|
+
const configured = nativeControlProps(field);
|
|
261
|
+
const daisyClassName = useDaisyUIClassNames("textarea", invalid && "textarea-error");
|
|
262
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
263
|
+
...configured.props,
|
|
264
|
+
...inputProps,
|
|
265
|
+
className: classNames(daisyClassName, configured.className),
|
|
266
|
+
disabled,
|
|
267
|
+
id,
|
|
268
|
+
maxLength: field.constraints.maxLength,
|
|
269
|
+
minLength: field.constraints.minLength,
|
|
270
|
+
name,
|
|
271
|
+
onBlur,
|
|
272
|
+
onChange: (event) => onValueChange(event.currentTarget.value),
|
|
273
|
+
placeholder: field.config.placeholder ?? configured.props.placeholder,
|
|
274
|
+
readOnly,
|
|
275
|
+
ref: controlRef,
|
|
276
|
+
required,
|
|
277
|
+
style: mergeControlStyle(configured.style),
|
|
278
|
+
value: inputValue(value)
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/slots/array.tsx
|
|
283
|
+
function Array$1({ actions, children, className, disabled, error, errorId, field, itemCount, readOnly, required, style, ...props }) {
|
|
284
|
+
const descriptionId = useId();
|
|
285
|
+
const fieldsetClassName = useDaisyUIClassNames("fieldset rounded-box");
|
|
286
|
+
const legendClassName = useDaisyUIClassNames("fieldset-legend");
|
|
287
|
+
const labelClassName = useDaisyUIClassNames("label");
|
|
288
|
+
const surfaceClassName = useDaisyUIClassNames("bg-base-200 border-base-300");
|
|
289
|
+
const errorClassName = useDaisyUIClassNames("text-error");
|
|
290
|
+
const describedBy = [
|
|
291
|
+
props["aria-describedby"],
|
|
292
|
+
field.description ? descriptionId : void 0,
|
|
293
|
+
error ? errorId : void 0
|
|
294
|
+
].filter(Boolean).join(" ") || void 0;
|
|
295
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
296
|
+
...props,
|
|
297
|
+
"aria-describedby": describedBy,
|
|
298
|
+
"aria-invalid": error ? true : void 0,
|
|
299
|
+
className: classNames(fieldsetClassName, surfaceClassName, "border p-4", className),
|
|
300
|
+
"data-field-path": field.path,
|
|
301
|
+
"data-invalid": error ? true : void 0,
|
|
302
|
+
"data-item-count": itemCount,
|
|
303
|
+
"data-readonly": readOnly || void 0,
|
|
304
|
+
"aria-disabled": disabled || void 0,
|
|
305
|
+
style: {
|
|
306
|
+
width: "100%",
|
|
307
|
+
...style
|
|
308
|
+
},
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsxs("legend", {
|
|
311
|
+
className: legendClassName,
|
|
312
|
+
children: [field.label, required ? /* @__PURE__ */ jsxs("span", {
|
|
313
|
+
"aria-hidden": "true",
|
|
314
|
+
className: errorClassName,
|
|
315
|
+
children: [" ", "*"]
|
|
316
|
+
}) : null]
|
|
317
|
+
}),
|
|
318
|
+
field.description ? /* @__PURE__ */ jsx("p", {
|
|
319
|
+
className: labelClassName,
|
|
320
|
+
id: descriptionId,
|
|
321
|
+
children: field.description
|
|
322
|
+
}) : null,
|
|
323
|
+
/* @__PURE__ */ jsx("div", {
|
|
324
|
+
style: {
|
|
325
|
+
display: "grid",
|
|
326
|
+
gap: "0.75rem"
|
|
327
|
+
},
|
|
328
|
+
children
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ jsx("div", { children: actions }),
|
|
331
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
332
|
+
className: classNames(labelClassName, errorClassName),
|
|
333
|
+
id: errorId,
|
|
334
|
+
role: "alert",
|
|
335
|
+
children: error
|
|
336
|
+
}) : null
|
|
337
|
+
]
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/slots/array-item.tsx
|
|
342
|
+
function ArrayItem({ actions, children, className, field, index, label, style, ...props }) {
|
|
343
|
+
const labelId = useId();
|
|
344
|
+
const cardClassName = useDaisyUIClassNames("card card-border");
|
|
345
|
+
const cardBodyClassName = useDaisyUIClassNames("card-body");
|
|
346
|
+
const cardTitleClassName = useDaisyUIClassNames("card-title");
|
|
347
|
+
const joinClassName = useDaisyUIClassNames("join");
|
|
348
|
+
const surfaceClassName = useDaisyUIClassNames("border-base-300 bg-base-100");
|
|
349
|
+
return /* @__PURE__ */ jsx("div", {
|
|
350
|
+
...props,
|
|
351
|
+
"aria-labelledby": props["aria-labelledby"] ?? labelId,
|
|
352
|
+
className: classNames(cardClassName, surfaceClassName, className),
|
|
353
|
+
"data-array-path": field.path,
|
|
354
|
+
"data-item-index": index,
|
|
355
|
+
role: props.role ?? "group",
|
|
356
|
+
style,
|
|
357
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
358
|
+
className: cardBodyClassName,
|
|
359
|
+
style: {
|
|
360
|
+
gap: "0.75rem",
|
|
361
|
+
padding: "1rem"
|
|
362
|
+
},
|
|
363
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
364
|
+
style: {
|
|
365
|
+
alignItems: "center",
|
|
366
|
+
display: "flex",
|
|
367
|
+
gap: "0.5rem",
|
|
368
|
+
justifyContent: "space-between"
|
|
369
|
+
},
|
|
370
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
371
|
+
className: cardTitleClassName,
|
|
372
|
+
id: labelId,
|
|
373
|
+
style: { fontSize: "0.875rem" },
|
|
374
|
+
children: label
|
|
375
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
376
|
+
className: joinClassName,
|
|
377
|
+
children: actions
|
|
378
|
+
})]
|
|
379
|
+
}), children]
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/slots/button.tsx
|
|
385
|
+
const INTENT_CLASS = {
|
|
386
|
+
add: "btn-outline btn-sm",
|
|
387
|
+
"move-down": "btn-ghost btn-sm join-item",
|
|
388
|
+
"move-up": "btn-ghost btn-sm join-item",
|
|
389
|
+
next: "btn-primary",
|
|
390
|
+
previous: "btn-ghost",
|
|
391
|
+
remove: "btn-error btn-outline btn-sm join-item",
|
|
392
|
+
submit: "btn-primary"
|
|
393
|
+
};
|
|
394
|
+
function Button({ ariaLabel, children, disabled, intent, onClick, pending, type }) {
|
|
395
|
+
const buttonClassName = useDaisyUIClassNames("btn", INTENT_CLASS[intent]);
|
|
396
|
+
const loadingClassName = useDaisyUIClassNames("loading loading-spinner loading-xs");
|
|
397
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
398
|
+
"aria-label": ariaLabel,
|
|
399
|
+
"aria-busy": pending || void 0,
|
|
400
|
+
className: buttonClassName,
|
|
401
|
+
"data-intent": intent,
|
|
402
|
+
disabled,
|
|
403
|
+
onClick,
|
|
404
|
+
type,
|
|
405
|
+
children: [pending ? /* @__PURE__ */ jsx("span", {
|
|
406
|
+
"aria-hidden": "true",
|
|
407
|
+
className: loadingClassName
|
|
408
|
+
}) : null, children]
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/slots/error-summary.tsx
|
|
413
|
+
function ErrorSummary({ errors, items, onSelect, title }) {
|
|
414
|
+
const alertClassName = useDaisyUIClassNames("alert alert-error");
|
|
415
|
+
const linkClassName = useDaisyUIClassNames("link");
|
|
416
|
+
const resolvedItems = items ?? errors.map((message) => ({ message }));
|
|
417
|
+
if (resolvedItems.length === 0) return null;
|
|
418
|
+
return /* @__PURE__ */ jsx("div", {
|
|
419
|
+
className: alertClassName,
|
|
420
|
+
role: "alert",
|
|
421
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: title }), /* @__PURE__ */ jsx("ul", {
|
|
422
|
+
style: {
|
|
423
|
+
listStyle: "disc",
|
|
424
|
+
margin: "0.5rem 0 0 1.25rem"
|
|
425
|
+
},
|
|
426
|
+
children: resolvedItems.map((item, index) => {
|
|
427
|
+
const focusPath = item.focusPath;
|
|
428
|
+
return /* @__PURE__ */ jsx("li", { children: focusPath && onSelect ? /* @__PURE__ */ jsx("button", {
|
|
429
|
+
className: linkClassName,
|
|
430
|
+
onClick: () => onSelect(focusPath),
|
|
431
|
+
type: "button",
|
|
432
|
+
children: item.message
|
|
433
|
+
}) : item.message }, `${item.path ?? "form"}-${item.message}-${index}`);
|
|
434
|
+
})
|
|
435
|
+
})] })
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/slots/field.tsx
|
|
440
|
+
function FieldLabel({ label, required }) {
|
|
441
|
+
const errorClassName = useDaisyUIClassNames("text-error");
|
|
442
|
+
return /* @__PURE__ */ jsxs("span", { children: [label, required ? /* @__PURE__ */ jsxs("span", {
|
|
443
|
+
"aria-hidden": "true",
|
|
444
|
+
className: errorClassName,
|
|
445
|
+
children: [" ", "*"]
|
|
446
|
+
}) : null] });
|
|
447
|
+
}
|
|
448
|
+
function Field({ children, className, controlId, descriptionId, error, errorId, field, invalid, required, style, validating, ...props }) {
|
|
449
|
+
const fieldsetClassName = useDaisyUIClassNames("fieldset");
|
|
450
|
+
const legendClassName = useDaisyUIClassNames("fieldset-legend");
|
|
451
|
+
const labelClassName = useDaisyUIClassNames("label");
|
|
452
|
+
const errorClassName = useDaisyUIClassNames("text-error");
|
|
453
|
+
if (field.control === "hidden" || field.inputType === "hidden") return children;
|
|
454
|
+
const isCheckbox = field.control === "checkbox";
|
|
455
|
+
const isRadio = field.control === "radio";
|
|
456
|
+
const label = /* @__PURE__ */ jsx(FieldLabel, {
|
|
457
|
+
label: field.label,
|
|
458
|
+
required
|
|
459
|
+
});
|
|
460
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
461
|
+
...props,
|
|
462
|
+
className: classNames(fieldsetClassName, className),
|
|
463
|
+
"data-field-path": field.path,
|
|
464
|
+
"data-invalid": invalid || void 0,
|
|
465
|
+
"data-validating": validating || void 0,
|
|
466
|
+
style: {
|
|
467
|
+
width: "100%",
|
|
468
|
+
...style
|
|
469
|
+
},
|
|
470
|
+
children: [
|
|
471
|
+
isCheckbox ? /* @__PURE__ */ jsxs("label", {
|
|
472
|
+
className: labelClassName,
|
|
473
|
+
htmlFor: controlId,
|
|
474
|
+
children: [children, label]
|
|
475
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [isRadio ? /* @__PURE__ */ jsx("div", {
|
|
476
|
+
className: legendClassName,
|
|
477
|
+
children: label
|
|
478
|
+
}) : /* @__PURE__ */ jsx("label", {
|
|
479
|
+
className: labelClassName,
|
|
480
|
+
htmlFor: controlId,
|
|
481
|
+
children: label
|
|
482
|
+
}), children] }),
|
|
483
|
+
field.description ? /* @__PURE__ */ jsx("p", {
|
|
484
|
+
className: labelClassName,
|
|
485
|
+
id: descriptionId,
|
|
486
|
+
children: field.description
|
|
487
|
+
}) : null,
|
|
488
|
+
validating ? /* @__PURE__ */ jsx("output", {
|
|
489
|
+
className: labelClassName,
|
|
490
|
+
children: "Checking…"
|
|
491
|
+
}) : null,
|
|
492
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
493
|
+
className: classNames(labelClassName, errorClassName),
|
|
494
|
+
id: errorId,
|
|
495
|
+
role: "alert",
|
|
496
|
+
children: error
|
|
497
|
+
}) : null
|
|
498
|
+
]
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/slots/form.tsx
|
|
503
|
+
function Form({ children, className, style, ...props }) {
|
|
504
|
+
const fieldsetClassName = useDaisyUIClassNames("fieldset");
|
|
505
|
+
return /* @__PURE__ */ jsx("form", {
|
|
506
|
+
...props,
|
|
507
|
+
className: classNames(fieldsetClassName, className),
|
|
508
|
+
style: {
|
|
509
|
+
display: "grid",
|
|
510
|
+
gap: "1rem",
|
|
511
|
+
width: "100%",
|
|
512
|
+
...style
|
|
513
|
+
},
|
|
514
|
+
children
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/slots/form-message.tsx
|
|
519
|
+
const KIND_CLASS = {
|
|
520
|
+
error: "alert-error",
|
|
521
|
+
info: "alert-info",
|
|
522
|
+
success: "alert-success"
|
|
523
|
+
};
|
|
524
|
+
function FormMessage({ kind, message }) {
|
|
525
|
+
return /* @__PURE__ */ jsx("div", {
|
|
526
|
+
className: useDaisyUIClassNames("alert", KIND_CLASS[kind]),
|
|
527
|
+
role: kind === "error" ? "alert" : "status",
|
|
528
|
+
children: /* @__PURE__ */ jsx("span", { children: message })
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/slots/group.tsx
|
|
533
|
+
function Group({ children, className, disabled, error, errorId, field, readOnly, required, style, ...props }) {
|
|
534
|
+
const descriptionId = useId();
|
|
535
|
+
const fieldsetClassName = useDaisyUIClassNames("fieldset rounded-box");
|
|
536
|
+
const legendClassName = useDaisyUIClassNames("fieldset-legend");
|
|
537
|
+
const labelClassName = useDaisyUIClassNames("label");
|
|
538
|
+
const surfaceClassName = useDaisyUIClassNames("bg-base-200 border-base-300");
|
|
539
|
+
const errorClassName = useDaisyUIClassNames("text-error");
|
|
540
|
+
const describedBy = [
|
|
541
|
+
props["aria-describedby"],
|
|
542
|
+
field.description ? descriptionId : void 0,
|
|
543
|
+
error ? errorId : void 0
|
|
544
|
+
].filter(Boolean).join(" ") || void 0;
|
|
545
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
546
|
+
...props,
|
|
547
|
+
"aria-describedby": describedBy,
|
|
548
|
+
"aria-invalid": error ? true : void 0,
|
|
549
|
+
className: classNames(fieldsetClassName, surfaceClassName, "border p-4", className),
|
|
550
|
+
"data-readonly": readOnly || void 0,
|
|
551
|
+
"data-invalid": error ? true : void 0,
|
|
552
|
+
"data-field-path": field.path,
|
|
553
|
+
"aria-disabled": disabled || void 0,
|
|
554
|
+
style: {
|
|
555
|
+
width: "100%",
|
|
556
|
+
...style
|
|
557
|
+
},
|
|
558
|
+
children: [
|
|
559
|
+
/* @__PURE__ */ jsxs("legend", {
|
|
560
|
+
className: legendClassName,
|
|
561
|
+
children: [field.label, required ? /* @__PURE__ */ jsxs("span", {
|
|
562
|
+
"aria-hidden": "true",
|
|
563
|
+
className: errorClassName,
|
|
564
|
+
children: [" ", "*"]
|
|
565
|
+
}) : null]
|
|
566
|
+
}),
|
|
567
|
+
field.description ? /* @__PURE__ */ jsx("p", {
|
|
568
|
+
className: labelClassName,
|
|
569
|
+
id: descriptionId,
|
|
570
|
+
children: field.description
|
|
571
|
+
}) : null,
|
|
572
|
+
children,
|
|
573
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
574
|
+
className: classNames(labelClassName, errorClassName),
|
|
575
|
+
id: errorId,
|
|
576
|
+
role: "alert",
|
|
577
|
+
children: error
|
|
578
|
+
}) : null
|
|
579
|
+
]
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region src/slots/unsupported.tsx
|
|
584
|
+
function Unsupported({ field, reason }) {
|
|
585
|
+
return /* @__PURE__ */ jsx("div", {
|
|
586
|
+
className: useDaisyUIClassNames("alert alert-warning"),
|
|
587
|
+
role: "alert",
|
|
588
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: field.label }), /* @__PURE__ */ jsx("p", { children: reason })] })
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/slots/wizard.tsx
|
|
593
|
+
function Wizard({ children, className, currentStep, description, navigation, steps, title, totalSteps, ...props }) {
|
|
594
|
+
const headingId = useId();
|
|
595
|
+
const heading = useRef(null);
|
|
596
|
+
const previousStep = useRef(currentStep);
|
|
597
|
+
const progressClassName = useDaisyUIClassNames("progress progress-primary");
|
|
598
|
+
const mutedClassName = useDaisyUIClassNames("text-base-content/60");
|
|
599
|
+
const descriptionClassName = useDaisyUIClassNames("text-base-content/70");
|
|
600
|
+
useEffect(() => {
|
|
601
|
+
if (previousStep.current !== currentStep) heading.current?.focus();
|
|
602
|
+
previousStep.current = currentStep;
|
|
603
|
+
}, [currentStep]);
|
|
604
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
605
|
+
...props,
|
|
606
|
+
"aria-labelledby": props["aria-labelledby"] ?? headingId,
|
|
607
|
+
className: classNames("grid gap-4", className),
|
|
608
|
+
"data-step-count": steps?.length,
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
611
|
+
/* @__PURE__ */ jsxs("p", {
|
|
612
|
+
"aria-live": "polite",
|
|
613
|
+
className: classNames(mutedClassName, "text-sm"),
|
|
614
|
+
children: [
|
|
615
|
+
"Step ",
|
|
616
|
+
currentStep,
|
|
617
|
+
" of ",
|
|
618
|
+
totalSteps
|
|
619
|
+
]
|
|
620
|
+
}),
|
|
621
|
+
/* @__PURE__ */ jsx("h2", {
|
|
622
|
+
className: "text-xl font-semibold",
|
|
623
|
+
id: headingId,
|
|
624
|
+
ref: heading,
|
|
625
|
+
tabIndex: -1,
|
|
626
|
+
children: title
|
|
627
|
+
}),
|
|
628
|
+
description ? /* @__PURE__ */ jsx("p", {
|
|
629
|
+
className: descriptionClassName,
|
|
630
|
+
children: description
|
|
631
|
+
}) : null
|
|
632
|
+
] }),
|
|
633
|
+
/* @__PURE__ */ jsx("progress", {
|
|
634
|
+
"aria-label": `Step ${currentStep} of ${totalSteps}`,
|
|
635
|
+
className: classNames(progressClassName, "w-full"),
|
|
636
|
+
max: totalSteps,
|
|
637
|
+
value: currentStep
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ jsx("div", {
|
|
640
|
+
className: "grid gap-4",
|
|
641
|
+
children
|
|
642
|
+
}),
|
|
643
|
+
/* @__PURE__ */ jsx("div", {
|
|
644
|
+
className: "flex items-center justify-between gap-3",
|
|
645
|
+
children: navigation
|
|
646
|
+
})
|
|
647
|
+
]
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region src/adapter.ts
|
|
652
|
+
const daisyUIAdapter = createAdapter({
|
|
653
|
+
name: "DaisyUI",
|
|
654
|
+
controls: {
|
|
655
|
+
checkbox: Checkbox,
|
|
656
|
+
custom: {},
|
|
657
|
+
file: File,
|
|
658
|
+
input: Input,
|
|
659
|
+
radio: Radio,
|
|
660
|
+
select: Select,
|
|
661
|
+
textarea: Textarea
|
|
662
|
+
},
|
|
663
|
+
slots: {
|
|
664
|
+
Array: Array$1,
|
|
665
|
+
ArrayItem,
|
|
666
|
+
Button,
|
|
667
|
+
ErrorSummary,
|
|
668
|
+
Field,
|
|
669
|
+
Form,
|
|
670
|
+
FormMessage,
|
|
671
|
+
Group,
|
|
672
|
+
Unsupported,
|
|
673
|
+
Wizard
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/provider.tsx
|
|
678
|
+
/** Client boundary that keeps the function-rich adapter out of Server Component props. */
|
|
679
|
+
function DaisyUIProvider({ children, prefix = "" }) {
|
|
680
|
+
return /* @__PURE__ */ jsx(DaisyUIClassPrefixProvider, {
|
|
681
|
+
prefix,
|
|
682
|
+
children: /* @__PURE__ */ jsx(FormAdapterProvider, {
|
|
683
|
+
adapter: daisyUIAdapter,
|
|
684
|
+
children
|
|
685
|
+
})
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
//#endregion
|
|
689
|
+
//#region src/index.ts
|
|
690
|
+
const createForm = createFormFactory(daisyUIAdapter);
|
|
691
|
+
//#endregion
|
|
692
|
+
export { Array$1 as Array, ArrayItem, Button, Checkbox, DaisyUIProvider, ErrorSummary, Field, File, Form, FormMessage, Group, Input, Radio, Select, Textarea, Unsupported, Wizard, createForm, daisyUIAdapter };
|
|
693
|
+
|
|
694
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Array"],"sources":["../src/class-names.ts","../src/prefix.tsx","../src/controls/checkbox.tsx","../src/controls/control-style.ts","../src/controls/file.tsx","../src/controls/input.tsx","../src/controls/radio.tsx","../src/controls/select.tsx","../src/controls/textarea.tsx","../src/slots/array.tsx","../src/slots/array-item.tsx","../src/slots/button.tsx","../src/slots/error-summary.tsx","../src/slots/field.tsx","../src/slots/form.tsx","../src/slots/form-message.tsx","../src/slots/group.tsx","../src/slots/unsupported.tsx","../src/slots/wizard.tsx","../src/adapter.ts","../src/provider.tsx","../src/index.ts"],"sourcesContent":["export function classNames(\n ...values: readonly (string | false | null | undefined)[]\n): string | undefined {\n const tokens = new Set<string>();\n\n for (const value of values) {\n if (!value) continue;\n\n for (const token of value.split(/\\s+/u)) {\n if (token) tokens.add(token);\n }\n }\n\n return tokens.size > 0 ? [...tokens].join(\" \") : undefined;\n}\n","\"use client\";\n\nimport {\n createContext,\n useContext,\n type ReactNode,\n} from \"react\";\n\nimport { classNames } from \"./class-names\";\n\nconst DaisyUIClassPrefixContext = createContext(\"\");\n\n// DaisyUI prefixes its component classes and their modifiers, but theme-backed\n// Tailwind utilities such as `text-error`, `bg-base-200`, and `rounded-box`\n// retain their ordinary names. Keep this list at the component-family level so\n// new modifiers (for example `btn-*`) inherit the correct behavior.\nconst DAISY_UI_COMPONENT_CLASS_ROOTS = [\n \"alert\",\n \"btn\",\n \"card\",\n \"checkbox\",\n \"fieldset\",\n \"file-input\",\n \"input\",\n \"join\",\n \"label\",\n \"link\",\n \"loading\",\n \"progress\",\n \"radio\",\n \"range\",\n \"select\",\n \"textarea\",\n] as const;\n\nfunction isDaisyUIComponentClass(token: string): boolean {\n return DAISY_UI_COMPONENT_CLASS_ROOTS.some((root) =>\n token === root || token.startsWith(`${root}-`)\n );\n}\n\ninterface DaisyUIClassPrefixProviderProps {\n readonly children: ReactNode;\n readonly prefix: string;\n}\n\nexport function DaisyUIClassPrefixProvider({\n children,\n prefix,\n}: DaisyUIClassPrefixProviderProps): ReactNode {\n return (\n <DaisyUIClassPrefixContext.Provider value={prefix}>\n {children}\n </DaisyUIClassPrefixContext.Provider>\n );\n}\n\n/** Prefixes DaisyUI component classes without rewriting Tailwind utilities. */\nexport function useDaisyUIClassNames(\n ...values: readonly (string | false | null | undefined)[]\n): string | undefined {\n const prefix = useContext(DaisyUIClassPrefixContext);\n\n return classNames(\n ...values.map((value) => {\n if (!value || prefix.length === 0) return value;\n return value\n .split(/\\s+/u)\n .filter(Boolean)\n .map((token) =>\n isDaisyUIComponentClass(token) ? `${prefix}${token}` : token\n )\n .join(\" \");\n }),\n );\n}\n","import type {\n InputHTMLAttributes,\n ReactNode,\n} from \"react\";\n\nimport type { ControlProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\nimport { nativeControlProps } from \"@formadapter/html/native\";\n\nfunction requiresCheckedValue(field: ControlProps[\"field\"]): boolean {\n return typeof field.source === \"object\" &&\n field.source !== null &&\n field.source.const === true;\n}\n\nexport function Checkbox({\n controlRef,\n disabled,\n field,\n id,\n inputProps,\n invalid,\n name,\n onBlur,\n onValueChange,\n readOnly,\n required,\n value,\n}: ControlProps): ReactNode {\n const configured = nativeControlProps<InputHTMLAttributes<HTMLInputElement>>(\n field,\n );\n const daisyClassName = useDaisyUIClassNames(\n \"checkbox\",\n invalid && \"checkbox-error\",\n );\n\n return (\n <input\n {...configured.props}\n {...inputProps}\n aria-readonly={readOnly || undefined}\n checked={value === true}\n className={classNames(\n daisyClassName,\n configured.className,\n )}\n disabled={disabled || readOnly}\n id={id}\n name={name}\n onBlur={onBlur}\n onChange={(event) => {\n if (!readOnly) onValueChange(event.currentTarget.checked);\n }}\n readOnly={readOnly}\n ref={controlRef}\n required={required && requiresCheckedValue(field)}\n style={configured.style}\n type=\"checkbox\"\n value=\"true\"\n />\n );\n}\n","import type { CSSProperties } from \"react\";\n\nexport function mergeControlStyle(\n configured: CSSProperties | undefined,\n): CSSProperties {\n return {\n width: \"100%\",\n ...configured,\n };\n}\n","import {\n useCallback,\n useEffect,\n useRef,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\n\nimport type { ControlProps } from \"@formadapter/react\";\nimport { nativeControlProps } from \"@formadapter/html/native\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\nimport { mergeControlStyle } from \"./control-style\";\n\ninterface FileMetadata {\n readonly lastModified: number;\n readonly name: string;\n readonly size: number;\n readonly type: string;\n}\n\nfunction isFileMetadata(value: unknown): value is FileMetadata {\n return typeof value === \"object\" && value !== null &&\n typeof (value as Partial<FileMetadata>).lastModified === \"number\" &&\n typeof (value as Partial<FileMetadata>).name === \"string\" &&\n typeof (value as Partial<FileMetadata>).size === \"number\" &&\n typeof (value as Partial<FileMetadata>).type === \"string\";\n}\n\nfunction controlledFiles(value: unknown): readonly FileMetadata[] {\n if (isFileMetadata(value)) return [value];\n if (typeof FileList !== \"undefined\" && value instanceof FileList) {\n return Array.from(value).filter(isFileMetadata);\n }\n if (!Array.isArray(value)) return [];\n return value.filter(isFileMetadata);\n}\n\nfunction nativeFilesMatch(\n value: unknown,\n files: FileList | null,\n): boolean {\n const controlled = controlledFiles(value);\n if (controlled.length === 0 || files?.length !== controlled.length) {\n return false;\n }\n return controlled.every((file, index) => {\n const nativeFile = files.item(index);\n return nativeFile !== null &&\n (Object.is(file, nativeFile) ||\n (file.name === nativeFile.name &&\n file.size === nativeFile.size &&\n file.type === nativeFile.type &&\n file.lastModified === nativeFile.lastModified));\n });\n}\n\nexport function File({\n controlRef,\n disabled,\n field,\n id,\n inputProps,\n invalid,\n name,\n onBlur,\n onValueChange,\n readOnly,\n required,\n value,\n}: ControlProps): ReactNode {\n const configured = nativeControlProps<InputHTMLAttributes<HTMLInputElement>>(\n field,\n );\n const daisyClassName = useDaisyUIClassNames(\n \"file-input\",\n invalid && \"file-input-error\",\n );\n const input = useRef<HTMLInputElement | null>(null);\n const setControlRef = useCallback((instance: HTMLInputElement | null) => {\n input.current = instance;\n controlRef(instance);\n }, [controlRef]);\n useEffect(() => {\n const current = input.current;\n if (current?.value && !nativeFilesMatch(value, current.files)) {\n // Browsers forbid assigning a non-empty file selection. Clear a stale\n // native label rather than displaying file A while form state submits B.\n current.value = \"\";\n }\n }, [value]);\n\n return (\n <input\n {...configured.props}\n {...inputProps}\n accept={\n field.constraints.accept ??\n field.constraints.contentMediaType ??\n configured.props.accept\n }\n className={classNames(\n daisyClassName,\n configured.className,\n )}\n disabled={disabled || readOnly}\n id={id}\n multiple={\n field.config.multiple ||\n field.constraints.multiple\n }\n name={name}\n onBlur={onBlur}\n onChange={(event) => {\n const files = event.currentTarget.files;\n onValueChange(\n field.config.multiple ||\n field.constraints.multiple\n ? Array.from(files ?? [])\n : files?.[0] ?? \"\",\n );\n }}\n ref={setControlRef}\n required={required}\n style={mergeControlStyle(configured.style)}\n type=\"file\"\n />\n );\n}\n","import type {\n InputHTMLAttributes,\n ReactNode,\n} from \"react\";\n\nimport type { ControlProps } from \"@formadapter/react\";\nimport {\n changedInputValue,\n inputType,\n inputValue,\n nativeControlProps,\n} from \"@formadapter/html/native\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\nimport { mergeControlStyle } from \"./control-style\";\n\nexport function Input({\n controlRef,\n disabled,\n field,\n id,\n inputProps,\n invalid,\n name,\n onBlur,\n onValueChange,\n readOnly,\n required,\n value,\n}: ControlProps): ReactNode {\n const configured = nativeControlProps<InputHTMLAttributes<HTMLInputElement>>(\n field,\n );\n const type = inputType(field);\n const baseClassName =\n type === \"hidden\" ? undefined : type === \"range\" ? \"range\" : \"input\";\n const invalidClassName =\n type === \"range\"\n ? \"range-error\"\n : type === \"hidden\"\n ? undefined\n : \"input-error\";\n const daisyClassName = useDaisyUIClassNames(\n baseClassName,\n invalid && invalidClassName,\n );\n\n return (\n <input\n {...configured.props}\n {...inputProps}\n className={classNames(\n daisyClassName,\n configured.className,\n )}\n disabled={disabled || (readOnly && type === \"range\")}\n id={id}\n max={field.constraints.maximum}\n maxLength={field.constraints.maxLength}\n min={field.constraints.minimum}\n minLength={field.constraints.minLength}\n name={name}\n onBlur={onBlur}\n onChange={(event) => {\n if (readOnly) return;\n onValueChange(\n changedInputValue(\n field,\n event.currentTarget.value,\n event.currentTarget.valueAsNumber,\n ),\n );\n }}\n pattern={field.constraints.pattern}\n placeholder={field.config.placeholder ?? configured.props.placeholder}\n readOnly={readOnly}\n ref={controlRef}\n required={required}\n step={\n field.constraints.multipleOf ??\n (field.dataType === \"integer\"\n ? 1\n : field.dataType === \"number\"\n ? \"any\"\n : undefined)\n }\n style={mergeControlStyle(configured.style)}\n type={type}\n value={inputValue(value, type)}\n />\n );\n}\n","import type {\n InputHTMLAttributes,\n ReactNode,\n} from \"react\";\n\nimport type { ControlProps } from \"@formadapter/react\";\nimport {\n nativeControlProps,\n serializedOptionValue,\n} from \"@formadapter/html/native\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function Radio({\n controlRef,\n disabled,\n field,\n id,\n inputProps,\n invalid,\n name,\n onBlur,\n onValueChange,\n readOnly,\n required,\n value,\n}: ControlProps): ReactNode {\n const configured = nativeControlProps<InputHTMLAttributes<HTMLInputElement>>(\n field,\n );\n const options = field.options ?? [];\n const labelClassName = useDaisyUIClassNames(\"label\");\n const radioClassName = useDaisyUIClassNames(\n \"radio\",\n invalid && \"radio-error\",\n );\n\n return (\n <div\n {...inputProps}\n aria-label={inputProps[\"aria-label\"] ?? field.label}\n aria-readonly={readOnly || undefined}\n aria-required={required || undefined}\n ref={options.length === 0 ? controlRef : undefined}\n role=\"radiogroup\"\n style={{\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"0.75rem\",\n }}\n tabIndex={options.length === 0 ? -1 : undefined}\n >\n {options.map((option, index) => {\n const optionId = index === 0 ? id : `${id}-${index}`;\n return (\n <label className={labelClassName} htmlFor={optionId} key={optionId}>\n <input\n {...configured.props}\n className={classNames(\n radioClassName,\n configured.className,\n )}\n checked={Object.is(value, option.value)}\n disabled={disabled || readOnly}\n id={optionId}\n name={name}\n onBlur={onBlur}\n onChange={() => {\n if (!readOnly) onValueChange(option.value);\n }}\n readOnly={readOnly}\n ref={index === 0 ? controlRef : undefined}\n required={required}\n style={configured.style}\n type=\"radio\"\n value={serializedOptionValue(option.value)}\n />\n <span>{option.label}</span>\n </label>\n );\n })}\n </div>\n );\n}\n","import type {\n ReactNode,\n SelectHTMLAttributes,\n} from \"react\";\n\nimport type { ControlProps } from \"@formadapter/react\";\nimport {\n nativeControlProps,\n optionForValue,\n selectedOptionValue,\n serializedOptionValue,\n} from \"@formadapter/html/native\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\nimport { mergeControlStyle } from \"./control-style\";\n\nexport function Select({\n controlRef,\n disabled,\n field,\n id,\n inputProps,\n invalid,\n name,\n onBlur,\n onValueChange,\n readOnly,\n required,\n value,\n}: ControlProps): ReactNode {\n const configured =\n nativeControlProps<SelectHTMLAttributes<HTMLSelectElement>>(field);\n const options = field.options ?? [];\n const placeholder = field.config.placeholder ?? \"Select an option\";\n const daisyClassName = useDaisyUIClassNames(\n \"select\",\n invalid && \"select-error\",\n );\n\n return (\n <select\n {...configured.props}\n {...inputProps}\n aria-readonly={readOnly || undefined}\n className={classNames(\n daisyClassName,\n configured.className,\n )}\n disabled={disabled || readOnly}\n id={id}\n name={name}\n onBlur={onBlur}\n onChange={(event) => {\n if (readOnly) return;\n const selected = optionForValue(options, event.currentTarget.value);\n onValueChange(selected ? selected.value : \"\");\n }}\n required={required}\n ref={controlRef}\n style={mergeControlStyle(configured.style)}\n value={selectedOptionValue(options, value)}\n >\n <option disabled={required} value=\"\">\n {placeholder}\n </option>\n {options.map((option, index) => (\n <option\n key={`${serializedOptionValue(option.value)}-${index}`}\n value={serializedOptionValue(option.value)}\n >\n {option.label}\n </option>\n ))}\n </select>\n );\n}\n","import type {\n ReactNode,\n TextareaHTMLAttributes,\n} from \"react\";\n\nimport type { ControlProps } from \"@formadapter/react\";\nimport {\n inputValue,\n nativeControlProps,\n} from \"@formadapter/html/native\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\nimport { mergeControlStyle } from \"./control-style\";\n\nexport function Textarea({\n controlRef,\n disabled,\n field,\n id,\n inputProps,\n invalid,\n name,\n onBlur,\n onValueChange,\n readOnly,\n required,\n value,\n}: ControlProps): ReactNode {\n const configured =\n nativeControlProps<TextareaHTMLAttributes<HTMLTextAreaElement>>(field);\n const daisyClassName = useDaisyUIClassNames(\n \"textarea\",\n invalid && \"textarea-error\",\n );\n\n return (\n <textarea\n {...configured.props}\n {...inputProps}\n className={classNames(\n daisyClassName,\n configured.className,\n )}\n disabled={disabled}\n id={id}\n maxLength={field.constraints.maxLength}\n minLength={field.constraints.minLength}\n name={name}\n onBlur={onBlur}\n onChange={(event) => onValueChange(event.currentTarget.value)}\n placeholder={field.config.placeholder ?? configured.props.placeholder}\n readOnly={readOnly}\n ref={controlRef}\n required={required}\n style={mergeControlStyle(configured.style)}\n value={inputValue(value)}\n />\n );\n}\n","import { useId, type ReactNode } from \"react\";\n\nimport type { ArraySlotProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function Array({\n actions,\n children,\n className,\n disabled,\n error,\n errorId,\n field,\n itemCount,\n readOnly,\n required,\n style,\n ...props\n}: ArraySlotProps): ReactNode {\n const descriptionId = useId();\n const fieldsetClassName = useDaisyUIClassNames(\"fieldset rounded-box\");\n const legendClassName = useDaisyUIClassNames(\"fieldset-legend\");\n const labelClassName = useDaisyUIClassNames(\"label\");\n const surfaceClassName = useDaisyUIClassNames(\"bg-base-200 border-base-300\");\n const errorClassName = useDaisyUIClassNames(\"text-error\");\n const describedBy = [\n props[\"aria-describedby\"],\n field.description ? descriptionId : undefined,\n error ? errorId : undefined,\n ].filter(Boolean).join(\" \") || undefined;\n\n return (\n <fieldset\n {...props}\n aria-describedby={describedBy}\n aria-invalid={error ? true : undefined}\n className={classNames(\n fieldsetClassName,\n surfaceClassName,\n \"border p-4\",\n className,\n )}\n data-field-path={field.path}\n data-invalid={error ? true : undefined}\n data-item-count={itemCount}\n data-readonly={readOnly || undefined}\n aria-disabled={disabled || undefined}\n style={{ width: \"100%\", ...style }}\n >\n <legend className={legendClassName}>\n {field.label}\n {required ? (\n <span aria-hidden=\"true\" className={errorClassName}>\n {\" \"}*\n </span>\n ) : null}\n </legend>\n {field.description ? (\n <p className={labelClassName} id={descriptionId}>{field.description}</p>\n ) : null}\n <div style={{ display: \"grid\", gap: \"0.75rem\" }}>{children}</div>\n <div>{actions}</div>\n {error ? (\n <p className={classNames(labelClassName, errorClassName)} id={errorId} role=\"alert\">\n {error}\n </p>\n ) : null}\n </fieldset>\n );\n}\n","import { useId, type ReactNode } from \"react\";\n\nimport type { ArrayItemSlotProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function ArrayItem({\n actions,\n children,\n className,\n field,\n index,\n label,\n style,\n ...props\n}: ArrayItemSlotProps): ReactNode {\n const labelId = useId();\n const cardClassName = useDaisyUIClassNames(\"card card-border\");\n const cardBodyClassName = useDaisyUIClassNames(\"card-body\");\n const cardTitleClassName = useDaisyUIClassNames(\"card-title\");\n const joinClassName = useDaisyUIClassNames(\"join\");\n const surfaceClassName = useDaisyUIClassNames(\"border-base-300 bg-base-100\");\n return (\n <div\n {...props}\n aria-labelledby={props[\"aria-labelledby\"] ?? labelId}\n className={classNames(\n cardClassName,\n surfaceClassName,\n className,\n )}\n data-array-path={field.path}\n data-item-index={index}\n role={props.role ?? \"group\"}\n style={style}\n >\n <div className={cardBodyClassName} style={{ gap: \"0.75rem\", padding: \"1rem\" }}>\n <div\n style={{\n alignItems: \"center\",\n display: \"flex\",\n gap: \"0.5rem\",\n justifyContent: \"space-between\",\n }}\n >\n <span\n className={cardTitleClassName}\n id={labelId}\n style={{ fontSize: \"0.875rem\" }}\n >\n {label}\n </span>\n <div className={joinClassName}>{actions}</div>\n </div>\n {children}\n </div>\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport type {\n ButtonIntent,\n ButtonSlotProps,\n} from \"@formadapter/react\";\n\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nconst INTENT_CLASS: Readonly<Record<ButtonIntent, string>> = {\n add: \"btn-outline btn-sm\",\n \"move-down\": \"btn-ghost btn-sm join-item\",\n \"move-up\": \"btn-ghost btn-sm join-item\",\n next: \"btn-primary\",\n previous: \"btn-ghost\",\n remove: \"btn-error btn-outline btn-sm join-item\",\n submit: \"btn-primary\",\n};\n\nexport function Button({\n ariaLabel,\n children,\n disabled,\n intent,\n onClick,\n pending,\n type,\n}: ButtonSlotProps): ReactNode {\n const buttonClassName = useDaisyUIClassNames(\"btn\", INTENT_CLASS[intent]);\n const loadingClassName = useDaisyUIClassNames(\n \"loading loading-spinner loading-xs\",\n );\n\n return (\n <button\n aria-label={ariaLabel}\n aria-busy={pending || undefined}\n className={buttonClassName}\n data-intent={intent}\n disabled={disabled}\n onClick={onClick}\n type={type}\n >\n {pending ? (\n <span aria-hidden=\"true\" className={loadingClassName} />\n ) : null}\n {children}\n </button>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport type { ErrorSummarySlotProps } from \"@formadapter/react\";\n\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function ErrorSummary({\n errors,\n items,\n onSelect,\n title,\n}: ErrorSummarySlotProps): ReactNode {\n const alertClassName = useDaisyUIClassNames(\"alert alert-error\");\n const linkClassName = useDaisyUIClassNames(\"link\");\n const resolvedItems: NonNullable<ErrorSummarySlotProps[\"items\"]> =\n items ?? errors.map((message) => ({ message }));\n\n if (resolvedItems.length === 0) return null;\n\n return (\n <div className={alertClassName} role=\"alert\">\n <div>\n <strong>{title}</strong>\n <ul style={{ listStyle: \"disc\", margin: \"0.5rem 0 0 1.25rem\" }}>\n {resolvedItems.map((item, index) => {\n const focusPath = item.focusPath;\n return (\n <li key={`${item.path ?? \"form\"}-${item.message}-${index}`}>\n {focusPath && onSelect ? (\n <button\n className={linkClassName}\n onClick={() => onSelect(focusPath)}\n type=\"button\"\n >\n {item.message}\n </button>\n ) : item.message}\n </li>\n );\n })}\n </ul>\n </div>\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport type { FieldSlotProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nfunction FieldLabel({\n label,\n required,\n}: {\n readonly label: string;\n readonly required: boolean;\n}): ReactNode {\n const errorClassName = useDaisyUIClassNames(\"text-error\");\n return (\n <span>\n {label}\n {required ? (\n <span aria-hidden=\"true\" className={errorClassName}>\n {\" \"}*\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function Field({\n children,\n className,\n controlId,\n descriptionId,\n error,\n errorId,\n field,\n invalid,\n required,\n style,\n validating,\n ...props\n}: FieldSlotProps): ReactNode {\n const fieldsetClassName = useDaisyUIClassNames(\"fieldset\");\n const legendClassName = useDaisyUIClassNames(\"fieldset-legend\");\n const labelClassName = useDaisyUIClassNames(\"label\");\n const errorClassName = useDaisyUIClassNames(\"text-error\");\n\n if (field.control === \"hidden\" || field.inputType === \"hidden\") {\n return children;\n }\n\n const isCheckbox = field.control === \"checkbox\";\n const isRadio = field.control === \"radio\";\n const label = <FieldLabel label={field.label} required={required} />;\n\n return (\n <div\n {...props}\n className={classNames(fieldsetClassName, className)}\n data-field-path={field.path}\n data-invalid={invalid || undefined}\n data-validating={validating || undefined}\n style={{ width: \"100%\", ...style }}\n >\n {isCheckbox ? (\n <label className={labelClassName} htmlFor={controlId}>\n {children}\n {label}\n </label>\n ) : (\n <>\n {isRadio ? (\n <div className={legendClassName}>{label}</div>\n ) : (\n <label className={labelClassName} htmlFor={controlId}>\n {label}\n </label>\n )}\n {children}\n </>\n )}\n {field.description ? (\n <p className={labelClassName} id={descriptionId}>\n {field.description}\n </p>\n ) : null}\n {validating ? (\n <output className={labelClassName}>Checking…</output>\n ) : null}\n {error ? (\n <p className={classNames(labelClassName, errorClassName)} id={errorId} role=\"alert\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport type { FormSlotProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function Form({\n children,\n className,\n style,\n ...props\n}: FormSlotProps): ReactNode {\n const fieldsetClassName = useDaisyUIClassNames(\"fieldset\");\n\n return (\n <form\n {...props}\n className={classNames(fieldsetClassName, className)}\n style={{\n display: \"grid\",\n gap: \"1rem\",\n width: \"100%\",\n ...style,\n }}\n >\n {children}\n </form>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport type { FormMessageSlotProps } from \"@formadapter/react\";\n\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nconst KIND_CLASS: Readonly<Record<FormMessageSlotProps[\"kind\"], string>> = {\n error: \"alert-error\",\n info: \"alert-info\",\n success: \"alert-success\",\n};\n\nexport function FormMessage({\n kind,\n message,\n}: FormMessageSlotProps): ReactNode {\n const alertClassName = useDaisyUIClassNames(\"alert\", KIND_CLASS[kind]);\n\n return (\n <div\n className={alertClassName}\n role={kind === \"error\" ? \"alert\" : \"status\"}\n >\n <span>{message}</span>\n </div>\n );\n}\n","import { useId, type ReactNode } from \"react\";\n\nimport type { GroupSlotProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function Group({\n children,\n className,\n disabled,\n error,\n errorId,\n field,\n readOnly,\n required,\n style,\n ...props\n}: GroupSlotProps): ReactNode {\n const descriptionId = useId();\n const fieldsetClassName = useDaisyUIClassNames(\"fieldset rounded-box\");\n const legendClassName = useDaisyUIClassNames(\"fieldset-legend\");\n const labelClassName = useDaisyUIClassNames(\"label\");\n const surfaceClassName = useDaisyUIClassNames(\"bg-base-200 border-base-300\");\n const errorClassName = useDaisyUIClassNames(\"text-error\");\n const describedBy = [\n props[\"aria-describedby\"],\n field.description ? descriptionId : undefined,\n error ? errorId : undefined,\n ].filter(Boolean).join(\" \") || undefined;\n\n return (\n <fieldset\n {...props}\n aria-describedby={describedBy}\n aria-invalid={error ? true : undefined}\n className={classNames(\n fieldsetClassName,\n surfaceClassName,\n \"border p-4\",\n className,\n )}\n data-readonly={readOnly || undefined}\n data-invalid={error ? true : undefined}\n data-field-path={field.path}\n aria-disabled={disabled || undefined}\n style={{ width: \"100%\", ...style }}\n >\n <legend className={legendClassName}>\n {field.label}\n {required ? (\n <span aria-hidden=\"true\" className={errorClassName}>\n {\" \"}*\n </span>\n ) : null}\n </legend>\n {field.description ? (\n <p className={labelClassName} id={descriptionId}>{field.description}</p>\n ) : null}\n {children}\n {error ? (\n <p\n className={classNames(labelClassName, errorClassName)}\n id={errorId}\n role=\"alert\"\n >\n {error}\n </p>\n ) : null}\n </fieldset>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport type { UnsupportedSlotProps } from \"@formadapter/react\";\n\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function Unsupported({\n field,\n reason,\n}: UnsupportedSlotProps): ReactNode {\n const alertClassName = useDaisyUIClassNames(\"alert alert-warning\");\n\n return (\n <div className={alertClassName} role=\"alert\">\n <div>\n <strong>{field.label}</strong>\n <p>{reason}</p>\n </div>\n </div>\n );\n}\n","import {\n useEffect,\n useId,\n useRef,\n type ReactNode,\n} from \"react\";\n\nimport type { WizardSlotProps } from \"@formadapter/react\";\n\nimport { classNames } from \"../class-names\";\nimport { useDaisyUIClassNames } from \"../prefix\";\n\nexport function Wizard({\n children,\n className,\n currentStep,\n description,\n navigation,\n steps,\n title,\n totalSteps,\n ...props\n}: WizardSlotProps): ReactNode {\n const headingId = useId();\n const heading = useRef<HTMLHeadingElement | null>(null);\n const previousStep = useRef(currentStep);\n const progressClassName = useDaisyUIClassNames(\"progress progress-primary\");\n const mutedClassName = useDaisyUIClassNames(\"text-base-content/60\");\n const descriptionClassName = useDaisyUIClassNames(\"text-base-content/70\");\n\n useEffect(() => {\n if (previousStep.current !== currentStep) heading.current?.focus();\n previousStep.current = currentStep;\n }, [currentStep]);\n\n return (\n <section\n {...props}\n aria-labelledby={props[\"aria-labelledby\"] ?? headingId}\n className={classNames(\"grid gap-4\", className)}\n data-step-count={steps?.length}\n >\n <div>\n <p aria-live=\"polite\" className={classNames(mutedClassName, \"text-sm\")}>\n Step {currentStep} of {totalSteps}\n </p>\n <h2\n className=\"text-xl font-semibold\"\n id={headingId}\n ref={heading}\n tabIndex={-1}\n >\n {title}\n </h2>\n {description ? <p className={descriptionClassName}>{description}</p> : null}\n </div>\n <progress\n aria-label={`Step ${currentStep} of ${totalSteps}`}\n className={classNames(progressClassName, \"w-full\")}\n max={totalSteps}\n value={currentStep}\n />\n <div className=\"grid gap-4\">{children}</div>\n <div className=\"flex items-center justify-between gap-3\">{navigation}</div>\n </section>\n );\n}\n","import {\n createAdapter,\n type FormAdapter,\n} from \"@formadapter/react\";\n\nimport { Checkbox } from \"./controls/checkbox\";\nimport { File } from \"./controls/file\";\nimport { Input } from \"./controls/input\";\nimport { Radio } from \"./controls/radio\";\nimport { Select } from \"./controls/select\";\nimport { Textarea } from \"./controls/textarea\";\nimport { Array } from \"./slots/array\";\nimport { ArrayItem } from \"./slots/array-item\";\nimport { Button } from \"./slots/button\";\nimport { ErrorSummary } from \"./slots/error-summary\";\nimport { Field } from \"./slots/field\";\nimport { Form } from \"./slots/form\";\nimport { FormMessage } from \"./slots/form-message\";\nimport { Group } from \"./slots/group\";\nimport { Unsupported } from \"./slots/unsupported\";\nimport { Wizard } from \"./slots/wizard\";\n\nexport const daisyUIAdapter: FormAdapter<Record<never, never>> = createAdapter({\n name: \"DaisyUI\",\n controls: {\n checkbox: Checkbox,\n custom: {},\n file: File,\n input: Input,\n radio: Radio,\n select: Select,\n textarea: Textarea,\n },\n slots: {\n Array,\n ArrayItem,\n Button,\n ErrorSummary,\n Field,\n Form,\n FormMessage,\n Group,\n Unsupported,\n Wizard,\n },\n});\n","\"use client\";\n\nimport type { ReactNode } from \"react\";\n\nimport { FormAdapterProvider } from \"@formadapter/react\";\n\nimport { daisyUIAdapter } from \"./adapter\";\nimport { DaisyUIClassPrefixProvider } from \"./prefix\";\n\nexport interface DaisyUIProviderProps {\n readonly children: ReactNode;\n /** Must match DaisyUI's `prefix` plugin option, including separators. */\n readonly prefix?: string;\n}\n\n/** Client boundary that keeps the function-rich adapter out of Server Component props. */\nexport function DaisyUIProvider({\n children,\n prefix = \"\",\n}: DaisyUIProviderProps): ReactNode {\n return (\n <DaisyUIClassPrefixProvider prefix={prefix}>\n <FormAdapterProvider adapter={daisyUIAdapter}>\n {children}\n </FormAdapterProvider>\n </DaisyUIClassPrefixProvider>\n );\n}\n","\"use client\";\n\nimport {\n createFormFactory,\n type CreateForm,\n} from \"@formadapter/react\";\n\nimport { daisyUIAdapter } from \"./adapter\";\n\nexport { daisyUIAdapter } from \"./adapter\";\nexport { DaisyUIProvider } from \"./provider\";\nexport type { DaisyUIProviderProps } from \"./provider\";\nexport { Checkbox } from \"./controls/checkbox\";\nexport { File } from \"./controls/file\";\nexport { Input } from \"./controls/input\";\nexport { Radio } from \"./controls/radio\";\nexport { Select } from \"./controls/select\";\nexport { Textarea } from \"./controls/textarea\";\nexport { Array } from \"./slots/array\";\nexport { ArrayItem } from \"./slots/array-item\";\nexport { Button } from \"./slots/button\";\nexport { ErrorSummary } from \"./slots/error-summary\";\nexport { Field } from \"./slots/field\";\nexport { Form } from \"./slots/form\";\nexport { FormMessage } from \"./slots/form-message\";\nexport { Group } from \"./slots/group\";\nexport { Unsupported } from \"./slots/unsupported\";\nexport { Wizard } from \"./slots/wizard\";\n\nexport const createForm: CreateForm<typeof daisyUIAdapter> =\n createFormFactory(daisyUIAdapter);\n"],"mappings":";;;;;;;AAAA,SAAgB,WACd,GAAG,QACiB;CACpB,MAAM,yBAAS,IAAI,KAAa;AAEhC,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,CAAC,MAAO;AAEZ,OAAK,MAAM,SAAS,MAAM,MAAM,OAAO,CACrC,KAAI,MAAO,QAAO,IAAI,MAAM;;AAIhC,QAAO,OAAO,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,GAAG,KAAA;;;;ACHnD,MAAM,4BAA4B,cAAc,GAAG;AAMnD,MAAM,iCAAiC;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAS,wBAAwB,OAAwB;AACvD,QAAO,+BAA+B,MAAM,SAC1C,UAAU,QAAQ,MAAM,WAAW,GAAG,KAAK,GAAG,CAC/C;;AAQH,SAAgB,2BAA2B,EACzC,UACA,UAC6C;AAC7C,QACE,oBAAC,0BAA0B,UAA3B;EAAoC,OAAO;EACxC;EACkC,CAAA;;;AAKzC,SAAgB,qBACd,GAAG,QACiB;CACpB,MAAM,SAAS,WAAW,0BAA0B;AAEpD,QAAO,WACL,GAAG,OAAO,KAAK,UAAU;AACvB,MAAI,CAAC,SAAS,OAAO,WAA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AAY,CAAC;AAEjB,QACE,qBAAC,WAAD;EACE,GAAI;EACJ,mBAAiB,MAAM,sBAAsB;EAC7C,WAAW,WAAW,cAAc,UAAU;EAC9C,mBAAiB,OAAO;YAJ1B;GAME,qBAAC,OAAD,EAAA,UAAA;IACE,qBAAC,KAAD;KAAG,aAAU;KAAS,WAAW,WAAW,gBAAgB,UAAU;eAAtE;MAAwE;MAChE;MAAY;MAAK;MACrB;;IACJ,oBAAC,MAAD;KACE,WAAU;KACV,IAAI;KACJ,KAAK;KACL,UAAU;eAET;KACE,CAAA;IACJ,cAAc,oBAAC,KAAD;KAAG,WAAW;eAAuB;KAAgB,CAAA,GAAG;IACnE,EAAA,CAAA;GACN,oBAAC,YAAD;IACE,cAAY,QAAQ,YAAY,MAAM;IACtC,WAAW,WAAW,mBAAmB,SAAS;IAClD,KAAK;IACL,OAAO;IACP,CAAA;GACF,oBAAC,OAAD;IAAK,WAAU;IAAc;IAAe,CAAA;GAC5C,oBAAC,OAAD;IAAK,WAAU;cAA2C;IAAiB,CAAA;GACnE;;;;;AC1Cd,MAAa,iBAAoD,cAAc;CAC7E,MAAM;CACN,UAAU;EACR,UAAU;EACV,QAAQ,EAAE;EACV,MAAM;EACN,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;EACX;CACD,OAAO;EACL,OAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACF,CAAC;;;;AC7BF,SAAgB,gBAAgB,EAC9B,UACA,SAAS,MACyB;AAClC,QACE,oBAAC,4BAAD;EAAoC;YAClC,oBAAC,qBAAD;GAAqB,SAAS;GAC3B;GACmB,CAAA;EACK,CAAA;;;;ACIjC,MAAa,aACX,kBAAkB,eAAe"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@formadapter/daisyui",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Native DaisyUI v5 renderer for FormAdapter.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"daisyui",
|
|
7
|
+
"forms",
|
|
8
|
+
"react",
|
|
9
|
+
"schema",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://formadapter.com",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/ludicroushq/formadapter/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/ludicroushq/formadapter.git",
|
|
19
|
+
"directory": "packages/daisyui"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "ludicrous",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"module": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@formadapter/core": "^0.0.0",
|
|
46
|
+
"@formadapter/html": "^0.0.0",
|
|
47
|
+
"@formadapter/react": "^0.0.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"daisyui": "^5.0.0",
|
|
51
|
+
"react": "^19.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/react": "^19.2.17",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
56
|
+
"daisyui": "^5.6.16",
|
|
57
|
+
"react": "19.2.7",
|
|
58
|
+
"react-dom": "19.2.7"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsdown",
|
|
62
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo .turbo",
|
|
63
|
+
"dev": "tsdown --watch",
|
|
64
|
+
"test": "vitest run --config vitest.config.ts",
|
|
65
|
+
"test:coverage": "vitest run --config vitest.config.ts --coverage",
|
|
66
|
+
"typecheck": "tsc --project tsconfig.json --noEmit"
|
|
67
|
+
}
|
|
68
|
+
}
|