@gridui/form 0.0.0-stage → 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/README.md +56 -2
- package/dist/action-form/action-form.d.ts +13 -0
- package/dist/action-form/run-action.d.ts +7 -0
- package/dist/field/field.d.ts +11 -0
- package/dist/field/style.d.ts +8 -0
- package/dist/field-grid/field-grid.d.ts +9 -0
- package/dist/field-grid/style.d.ts +7 -0
- package/dist/field-note/field-note.d.ts +11 -0
- package/dist/field-note/style.d.ts +7 -0
- package/dist/fieldset/fieldset.d.ts +9 -0
- package/dist/fieldset/style.d.ts +7 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +272 -0
- package/dist/index.js.map +7 -0
- package/dist/search-form/search-form.d.ts +9 -0
- package/dist/search-form/style.d.ts +7 -0
- package/dist/shared/navigation.d.ts +8 -0
- package/dist/shared/use-list-field.d.ts +21 -0
- package/dist/styles.css +110 -0
- package/package.json +48 -3
package/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/form
|
|
2
|
+
|
|
3
|
+
Core family. Public API: `ActionForm`, `ActionFormProps`, `Field`, `FieldGrid`, `FieldGridProps`, `FieldNote`, `FieldNoteProps`, `FieldProps`, `Fieldset`, `FieldsetProps`, `ListFieldProps`, `SearchForm`, `SearchFormProps`, `fieldClass`, `runFormAction`, `useListField`, `useUnsavedNavigation`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/form` and load `@gridui/form/styles.css` after Theme.
|
|
6
|
+
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
|
+
|
|
8
|
+
See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
|
|
9
|
+
|
|
10
|
+
## Form controls
|
|
11
|
+
|
|
12
|
+
`@gridui/form` owns field presentation, ActionForm, shared form state helpers, and FieldGrid/SearchForm arrangements. Input and Label belong to `@gridui/input`; Select and Combobox belong to `@gridui/select`; FilePicker belongs to `@gridui/file-picker`.
|
|
13
|
+
Inputs preserve native form constraints, refs, labels, descriptions and invalid
|
|
14
|
+
state; controls use 2.75rem standard or 2.25rem small sizing. Select accepts explicit
|
|
15
|
+
options with managed keyboard navigation, focus, and native form integration. `Field`, `Fieldset`, and
|
|
16
|
+
`FieldNote` own field grouping, label/icon alignment, and error presentation.
|
|
17
|
+
Fieldset keeps native disabled propagation and legend semantics.
|
|
18
|
+
|
|
19
|
+
`FilePicker` owns the bordered surface, drag state, native input, and optional
|
|
20
|
+
selection button. Callers supply `inputId`, `accept`, labels, hint, icon,
|
|
21
|
+
`disabled`, and `onFile`; `drop` enables drag-and-drop. Omitting `action` retains
|
|
22
|
+
the visible native input. `onFile` may return a promise. FilePicker owns its native input ref and clears
|
|
23
|
+
selection after that callback settles, including errors and cancelled
|
|
24
|
+
replacement. `onFileError(error)` receives synchronous reader exceptions and promise
|
|
25
|
+
rejections after input cleanup. Without a handler, failures are logged to the
|
|
26
|
+
console instead of becoming unhandled promise rejections. This permits repeated selection of the same file without DOM
|
|
27
|
+
access in business controllers. Parsing and exported bytes remain application-owned. Optional
|
|
28
|
+
`confirmSelection` requests native confirmation before replacing a pending file.
|
|
29
|
+
`useUnsavedNavigation(pending)` owns the native unload guard; callers decide
|
|
30
|
+
whether their current draft requires protection. `downloadBlob` from `@gridui/button` owns
|
|
31
|
+
the download anchor and object URL lifecycle. Invalid borders use the danger
|
|
32
|
+
color token; keyboard focus remains owned by the theme.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Form arrangements
|
|
36
|
+
|
|
37
|
+
Import `FieldGrid` and `SearchForm` from `@gridui/form`.
|
|
38
|
+
FieldGrid supplies full-width field spans, two columns above 24rem, and one
|
|
39
|
+
column at or below 24rem. SearchForm aligns native fields and submit actions.
|
|
40
|
+
Both forward native props and refs. Controls owns labels, constraints, invalid
|
|
41
|
+
state, field notes, and native fieldset semantics; applications own values,
|
|
42
|
+
validation, and submission actions. These local form arrangements do not own
|
|
43
|
+
page frames or shared region seams.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Declarative action boundaries
|
|
47
|
+
|
|
48
|
+
[`useAsyncAction` from `@gridui/button`](../button/README.md#action-helpers)
|
|
49
|
+
owns pending state and scheduling for caller-owned actions. `ActionForm` from
|
|
50
|
+
`@gridui/form` prevents native form navigation and invokes its declared
|
|
51
|
+
`onAction` unless disabled. Native form
|
|
52
|
+
validation still runs before submission. `onActionError(error)` receives synchronous
|
|
53
|
+
exceptions and promise rejections; without a handler, failures are logged to the
|
|
54
|
+
console. Applications own visible feedback. `Input.onValueChange` exposes text
|
|
55
|
+
values directly; native onChange props remain available for browser-level
|
|
56
|
+
consumers.
|
|
2
57
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace ActionForm
|
|
5
|
+
* @description Action Form
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type ActionFormProps = Omit<ComponentPropsWithRef<"form">, "onSubmit"> & {
|
|
9
|
+
readonly onAction: () => void | Promise<void>;
|
|
10
|
+
readonly onActionError?: (error: unknown) => void;
|
|
11
|
+
readonly disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const ActionForm: FC<ActionFormProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace Field
|
|
5
|
+
* @description Field
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type FieldProps = ComponentPropsWithRef<"div"> & {
|
|
9
|
+
readonly span?: "auto" | "full";
|
|
10
|
+
};
|
|
11
|
+
export declare const Field: FC<FieldProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace Field
|
|
5
|
+
* @description Style
|
|
6
|
+
*/
|
|
7
|
+
export declare const fieldStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
|
+
export declare const fieldClass: (className?: string) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace FieldGrid
|
|
5
|
+
* @description Field Grid
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type FieldGridProps = ComponentPropsWithRef<"div">;
|
|
9
|
+
export declare const FieldGrid: FC<FieldGridProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace FieldNote
|
|
5
|
+
* @description Field Note
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type FieldNoteProps = ComponentPropsWithRef<"span"> & {
|
|
9
|
+
readonly invalid?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const FieldNote: FC<FieldNoteProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace Fieldset
|
|
5
|
+
* @description Fieldset
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type FieldsetProps = ComponentPropsWithRef<"fieldset">;
|
|
9
|
+
export declare const Fieldset: FC<FieldsetProps>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { ActionFormProps } from "./action-form/action-form";
|
|
8
|
+
export { ActionForm } from "./action-form/action-form";
|
|
9
|
+
export { runFormAction } from "./action-form/run-action";
|
|
10
|
+
export type { FieldProps } from "./field/field";
|
|
11
|
+
export { Field } from "./field/field";
|
|
12
|
+
export { fieldClass } from "./field/style";
|
|
13
|
+
export type { FieldGridProps } from "./field-grid/field-grid";
|
|
14
|
+
export { FieldGrid } from "./field-grid/field-grid";
|
|
15
|
+
export type { FieldNoteProps } from "./field-note/field-note";
|
|
16
|
+
export { FieldNote } from "./field-note/field-note";
|
|
17
|
+
export type { FieldsetProps } from "./fieldset/fieldset";
|
|
18
|
+
export { Fieldset } from "./fieldset/fieldset";
|
|
19
|
+
export type { SearchFormProps } from "./search-form/search-form";
|
|
20
|
+
export { SearchForm } from "./search-form/search-form";
|
|
21
|
+
export { useUnsavedNavigation } from "./shared/navigation";
|
|
22
|
+
export type { ListFieldProps } from "./shared/use-list-field";
|
|
23
|
+
export { useListField } from "./shared/use-list-field";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// src/action-form/run-action.ts
|
|
2
|
+
var runFormAction = async (action, onError) => {
|
|
3
|
+
try {
|
|
4
|
+
await action();
|
|
5
|
+
} catch (error) {
|
|
6
|
+
if (onError) {
|
|
7
|
+
onError(error);
|
|
8
|
+
} else {
|
|
9
|
+
console.error(error);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/action-form/action-form.tsx
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
var ActionForm = (props) => {
|
|
17
|
+
const {
|
|
18
|
+
onAction,
|
|
19
|
+
onActionError,
|
|
20
|
+
disabled = false,
|
|
21
|
+
...restProps
|
|
22
|
+
} = props;
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"form",
|
|
25
|
+
{
|
|
26
|
+
...restProps,
|
|
27
|
+
onSubmit: (event) => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
if (!disabled) {
|
|
30
|
+
void runFormAction(onAction, onActionError);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/field/style.ts
|
|
38
|
+
import { cn } from "@gridui/style-utils";
|
|
39
|
+
import { cva } from "class-variance-authority";
|
|
40
|
+
var fieldStyles = cva(cn(
|
|
41
|
+
"gridui-field",
|
|
42
|
+
"grid min-w-0 gap-gridui-8"
|
|
43
|
+
));
|
|
44
|
+
var fieldClass = (className) => {
|
|
45
|
+
return cn(fieldStyles(), className);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/field/field.tsx
|
|
49
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
50
|
+
var Field = (props) => {
|
|
51
|
+
const { span = "auto", className, ...restProps } = props;
|
|
52
|
+
return /* @__PURE__ */ jsx2(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
...restProps,
|
|
56
|
+
className: fieldClass(className),
|
|
57
|
+
"data-span": span
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/field-grid/style.ts
|
|
63
|
+
import { cn as cn2 } from "@gridui/style-utils";
|
|
64
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
65
|
+
var fieldGridStyles = cva2(cn2(
|
|
66
|
+
"gridui-field-grid",
|
|
67
|
+
"grid grid-cols-2 gap-gridui-16",
|
|
68
|
+
"*:data-[span='full']:col-span-full",
|
|
69
|
+
"[&_label]:inline-flex [&_label]:items-center [&_label]:gap-gridui-4",
|
|
70
|
+
"[&_label_svg]:w-gridui-16 [&_label_svg]:h-gridui-16 [&_label_svg]:text-foreground",
|
|
71
|
+
"[@media(max-width:24rem)]:grid-cols-[1fr]"
|
|
72
|
+
));
|
|
73
|
+
|
|
74
|
+
// src/field-grid/field-grid.tsx
|
|
75
|
+
import { cn as cn3 } from "@gridui/style-utils";
|
|
76
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
77
|
+
var FieldGrid = (props) => {
|
|
78
|
+
const { className, ...restProps } = props;
|
|
79
|
+
return /* @__PURE__ */ jsx3(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
...restProps,
|
|
83
|
+
className: cn3(fieldGridStyles(), className)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/field-note/style.ts
|
|
89
|
+
import { cn as cn4 } from "@gridui/style-utils";
|
|
90
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
91
|
+
var fieldNoteStyles = cva3(cn4(
|
|
92
|
+
"gridui-field-note",
|
|
93
|
+
"text-muted type-supporting wrap-anywhere",
|
|
94
|
+
"data-[invalid='true']:text-danger-foreground"
|
|
95
|
+
));
|
|
96
|
+
|
|
97
|
+
// src/field-note/field-note.tsx
|
|
98
|
+
import { cn as cn5 } from "@gridui/style-utils";
|
|
99
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
100
|
+
var FieldNote = (props) => {
|
|
101
|
+
const {
|
|
102
|
+
invalid = false,
|
|
103
|
+
className,
|
|
104
|
+
...restProps
|
|
105
|
+
} = props;
|
|
106
|
+
return /* @__PURE__ */ jsx4(
|
|
107
|
+
"span",
|
|
108
|
+
{
|
|
109
|
+
...restProps,
|
|
110
|
+
className: cn5(fieldNoteStyles(), className),
|
|
111
|
+
"data-invalid": invalid
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/fieldset/style.ts
|
|
117
|
+
import { cn as cn6 } from "@gridui/style-utils";
|
|
118
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
119
|
+
var fieldsetStyles = cva4(cn6(
|
|
120
|
+
"gridui-fieldset",
|
|
121
|
+
"min-w-0 m-0 p-0 border-0",
|
|
122
|
+
"[&_legend]:mb-gridui-24 [&_legend]:p-0",
|
|
123
|
+
"[&_legend_span]:ml-gridui-8"
|
|
124
|
+
));
|
|
125
|
+
|
|
126
|
+
// src/fieldset/fieldset.tsx
|
|
127
|
+
import { cn as cn7 } from "@gridui/style-utils";
|
|
128
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
129
|
+
var Fieldset = (props) => {
|
|
130
|
+
const { className, ...restProps } = props;
|
|
131
|
+
return /* @__PURE__ */ jsx5(
|
|
132
|
+
"fieldset",
|
|
133
|
+
{
|
|
134
|
+
...restProps,
|
|
135
|
+
className: cn7(fieldsetStyles(), className)
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// src/search-form/style.ts
|
|
141
|
+
import { cn as cn8 } from "@gridui/style-utils";
|
|
142
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
143
|
+
var searchFormStyles = cva5(cn8(
|
|
144
|
+
"gridui-search-form",
|
|
145
|
+
"flex flex-wrap items-end gap-gridui-16",
|
|
146
|
+
"[&_>_div]:flex-1 [&_>_div]:min-w-48"
|
|
147
|
+
));
|
|
148
|
+
|
|
149
|
+
// src/search-form/search-form.tsx
|
|
150
|
+
import { cn as cn9 } from "@gridui/style-utils";
|
|
151
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
152
|
+
var SearchForm = (props) => {
|
|
153
|
+
const { className, ...restProps } = props;
|
|
154
|
+
return /* @__PURE__ */ jsx6(
|
|
155
|
+
"form",
|
|
156
|
+
{
|
|
157
|
+
...restProps,
|
|
158
|
+
className: cn9(searchFormStyles(), className)
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// src/shared/navigation.ts
|
|
164
|
+
import { useEffect } from "react";
|
|
165
|
+
var protectUnsavedNavigation = (target) => {
|
|
166
|
+
const warn = (event) => {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
};
|
|
169
|
+
target.addEventListener("beforeunload", warn);
|
|
170
|
+
return () => {
|
|
171
|
+
target.removeEventListener("beforeunload", warn);
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
var useUnsavedNavigation = (pending) => {
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
return pending ? protectUnsavedNavigation(window) : void 0;
|
|
177
|
+
}, [pending]);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/shared/use-list-field.ts
|
|
181
|
+
import { useEffect as useEffect2, useLayoutEffect, useRef, useState } from "react";
|
|
182
|
+
import { flushSync } from "react-dom";
|
|
183
|
+
var useListField = (props, onReset) => {
|
|
184
|
+
const { value, defaultValue = [], onValueChange, disabled, readOnly, form } = props;
|
|
185
|
+
const [
|
|
186
|
+
local,
|
|
187
|
+
setLocal
|
|
188
|
+
] = useState(() => {
|
|
189
|
+
return [...new Set(defaultValue)];
|
|
190
|
+
});
|
|
191
|
+
const selected = [...new Set(value ?? local)];
|
|
192
|
+
const initial = useRef(selected);
|
|
193
|
+
const native = useRef(null);
|
|
194
|
+
const control = useRef(null);
|
|
195
|
+
const available = () => {
|
|
196
|
+
return !disabled && !readOnly && !control.current?.matches(":disabled");
|
|
197
|
+
};
|
|
198
|
+
const update = (next) => {
|
|
199
|
+
const unique = [...new Set(next)];
|
|
200
|
+
if (selected.length === unique.length && selected.every((entry, index) => {
|
|
201
|
+
return entry === unique[index];
|
|
202
|
+
})) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (value === void 0) {
|
|
206
|
+
setLocal(unique);
|
|
207
|
+
}
|
|
208
|
+
onValueChange?.(unique);
|
|
209
|
+
};
|
|
210
|
+
const latest = useRef({
|
|
211
|
+
update,
|
|
212
|
+
onReset,
|
|
213
|
+
selected
|
|
214
|
+
});
|
|
215
|
+
useLayoutEffect(() => {
|
|
216
|
+
latest.current = {
|
|
217
|
+
update,
|
|
218
|
+
onReset,
|
|
219
|
+
selected
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
useEffect2(() => {
|
|
223
|
+
const owner = native.current?.form;
|
|
224
|
+
let mounted = true;
|
|
225
|
+
const reset = (event) => {
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
if (!mounted || event.defaultPrevented) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
flushSync(() => {
|
|
231
|
+
latest.current.update(initial.current);
|
|
232
|
+
latest.current.onReset();
|
|
233
|
+
});
|
|
234
|
+
if (native.current) {
|
|
235
|
+
for (const option of native.current.options) {
|
|
236
|
+
option.selected = latest.current.selected.includes(option.value);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}, 0);
|
|
240
|
+
};
|
|
241
|
+
owner?.addEventListener("reset", reset);
|
|
242
|
+
return () => {
|
|
243
|
+
mounted = false;
|
|
244
|
+
owner?.removeEventListener("reset", reset);
|
|
245
|
+
};
|
|
246
|
+
}, [form]);
|
|
247
|
+
const change = (next) => {
|
|
248
|
+
if (available()) {
|
|
249
|
+
update(next);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
return {
|
|
253
|
+
selected,
|
|
254
|
+
native,
|
|
255
|
+
control,
|
|
256
|
+
change,
|
|
257
|
+
available
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
export {
|
|
261
|
+
ActionForm,
|
|
262
|
+
Field,
|
|
263
|
+
FieldGrid,
|
|
264
|
+
FieldNote,
|
|
265
|
+
Fieldset,
|
|
266
|
+
SearchForm,
|
|
267
|
+
fieldClass,
|
|
268
|
+
runFormAction,
|
|
269
|
+
useListField,
|
|
270
|
+
useUnsavedNavigation
|
|
271
|
+
};
|
|
272
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/action-form/run-action.ts", "../src/action-form/action-form.tsx", "../src/field/style.ts", "../src/field/field.tsx", "../src/field-grid/style.ts", "../src/field-grid/field-grid.tsx", "../src/field-note/style.ts", "../src/field-note/field-note.tsx", "../src/fieldset/style.ts", "../src/fieldset/fieldset.tsx", "../src/search-form/style.ts", "../src/search-form/search-form.tsx", "../src/shared/navigation.ts", "../src/shared/use-list-field.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Form\n * @namespace ActionForm\n * @description Run Action\n */\n\nexport const runFormAction = async (\n action: () => void | Promise<void>,\n onError?: (error: unknown) => void,\n): Promise<void> => {\n try {\n await action();\n } catch (error) {\n if (onError) {\n onError(error);\n } else {\n console.error(error);\n }\n }\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace ActionForm\n * @description Action Form\n */\n\nimport { runFormAction } from \"./run-action\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ActionFormProps = Omit<ComponentPropsWithRef<\"form\">, \"onSubmit\"> & {\n readonly onAction: () => void | Promise<void>;\n readonly onActionError?: (error: unknown) => void;\n readonly disabled?: boolean;\n};\n\nexport const ActionForm: FC<ActionFormProps> = (props: ActionFormProps) => {\n const {\n onAction,\n onActionError,\n disabled = false,\n ...restProps\n } = props;\n return (<form\n {...restProps}\n onSubmit={(event) => {\n event.preventDefault();\n if (!disabled) {\n void runFormAction(onAction, onActionError);\n }\n }}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Field\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const fieldStyles = cva(cn(\n \"gridui-field\",\n \"grid min-w-0 gap-gridui-8\",\n));\n\nexport const fieldClass = (className?: string): string => {\n return cn(fieldStyles(), className);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Field\n * @description Field\n */\n\nimport { fieldClass } from \"./style\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldProps = ComponentPropsWithRef<\"div\"> & {\n readonly span?: \"auto\" | \"full\";\n};\n\nexport const Field: FC<FieldProps> = (props: FieldProps) => {\n const { span = \"auto\", className, ...restProps } = props;\n return (<div\n {...restProps}\n className={fieldClass(className)}\n data-span={span}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace FieldGrid\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const fieldGridStyles = cva(cn(\n \"gridui-field-grid\",\n \"grid grid-cols-2 gap-gridui-16\",\n \"*:data-[span='full']:col-span-full\",\n \"[&_label]:inline-flex [&_label]:items-center [&_label]:gap-gridui-4\",\n \"[&_label_svg]:w-gridui-16 [&_label_svg]:h-gridui-16 [&_label_svg]:text-foreground\",\n \"[@media(max-width:24rem)]:grid-cols-[1fr]\",\n));\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace FieldGrid\n * @description Field Grid\n */\n\nimport { fieldGridStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldGridProps = ComponentPropsWithRef<\"div\">;\n\nexport const FieldGrid: FC<FieldGridProps> = (props: FieldGridProps) => {\n const { className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(fieldGridStyles(), className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace FieldNote\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const fieldNoteStyles = cva(cn(\n \"gridui-field-note\",\n \"text-muted type-supporting wrap-anywhere\",\n \"data-[invalid='true']:text-danger-foreground\",\n));\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace FieldNote\n * @description Field Note\n */\n\nimport { fieldNoteStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldNoteProps = ComponentPropsWithRef<\"span\"> & {\n readonly invalid?: boolean;\n};\n\nexport const FieldNote: FC<FieldNoteProps> = (props: FieldNoteProps) => {\n const {\n invalid = false,\n className,\n ...restProps\n } = props;\n return (<span\n {...restProps}\n className={cn(fieldNoteStyles(), className)}\n data-invalid={invalid}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Fieldset\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const fieldsetStyles = cva(cn(\n \"gridui-fieldset\",\n \"min-w-0 m-0 p-0 border-0\",\n \"[&_legend]:mb-gridui-24 [&_legend]:p-0\",\n \"[&_legend_span]:ml-gridui-8\",\n));\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Fieldset\n * @description Fieldset\n */\n\nimport { fieldsetStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldsetProps = ComponentPropsWithRef<\"fieldset\">;\n\nexport const Fieldset: FC<FieldsetProps> = (props: FieldsetProps) => {\n const { className, ...restProps } = props;\n return (<fieldset\n {...restProps}\n className={cn(fieldsetStyles(), className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace SearchForm\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const searchFormStyles = cva(cn(\n \"gridui-search-form\",\n \"flex flex-wrap items-end gap-gridui-16\",\n \"[&_>_div]:flex-1 [&_>_div]:min-w-48\",\n));\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace SearchForm\n * @description Search Form\n */\n\nimport { searchFormStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type SearchFormProps = ComponentPropsWithRef<\"form\">;\n\nexport const SearchForm: FC<SearchFormProps> = (props: SearchFormProps) => {\n const { className, ...restProps } = props;\n return (<form\n {...restProps}\n className={cn(searchFormStyles(), className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Shared\n * @description Navigation\n */\n\nimport { useEffect } from \"react\";\n\nexport const protectUnsavedNavigation = (target: EventTarget): () => void => {\n const warn = (event: Event): void => {\n event.preventDefault();\n };\n target.addEventListener(\"beforeunload\", warn);\n return () => {\n target.removeEventListener(\"beforeunload\", warn);\n };\n};\n\nexport const useUnsavedNavigation = (pending: boolean): void => {\n useEffect(() => {\n return pending ? protectUnsavedNavigation(window) : undefined;\n }, [pending]);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Shared\n * @description Use List Field\n */\n\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\n\nexport type ListFieldProps = {\n readonly value?: readonly string[] | undefined;\n readonly defaultValue?: readonly string[] | undefined;\n readonly onValueChange?: ((value: string[]) => void) | undefined;\n readonly disabled?: boolean | undefined;\n readonly readOnly?: boolean | undefined;\n readonly form?: string | undefined;\n};\n\nexport const useListField = (props: ListFieldProps, onReset: () => void) => {\n const { value, defaultValue = [], onValueChange, disabled, readOnly, form } = props;\n const [\n local,\n setLocal,\n ] = useState(() => {\n return [...new Set(defaultValue)];\n });\n const selected = [...new Set(value ?? local)];\n const initial = useRef(selected);\n const native = useRef<HTMLSelectElement>(null);\n const control = useRef<HTMLElement>(null);\n const available = () => {\n return !disabled && !readOnly && !control.current?.matches(\":disabled\");\n };\n const update = (next: readonly string[]) => {\n const unique = [...new Set(next)];\n if (selected.length === unique.length && selected.every((entry, index) => {\n return entry === unique[index];\n })) {\n return;\n }\n if (value === undefined) {\n setLocal(unique);\n }\n onValueChange?.(unique);\n };\n const latest = useRef({\n update,\n onReset,\n selected,\n });\n useLayoutEffect(() => {\n latest.current = {\n update,\n onReset,\n selected,\n };\n });\n useEffect(() => {\n const owner = native.current?.form;\n let mounted = true;\n const reset = (event: Event) => {\n setTimeout(() => {\n if (!mounted || event.defaultPrevented) {\n return;\n }\n flushSync(() => {\n latest.current.update(initial.current); latest.current.onReset();\n });\n if (native.current) {\n for (const option of native.current.options) { option.selected = latest.current.selected.includes(option.value); }\n }\n }, 0);\n };\n owner?.addEventListener(\"reset\", reset);\n return () => {\n mounted = false; owner?.removeEventListener(\"reset\", reset);\n };\n }, [form]);\n const change = (next: readonly string[]) => {\n if (available()) {\n update(next);\n }\n };\n return {\n selected,\n native,\n control,\n change,\n available,\n };\n};\n"],
|
|
5
|
+
"mappings": ";AAOO,IAAM,gBAAgB,OACzB,QACA,YACgB;AAChB,MAAI;AACA,UAAM,OAAO;AAAA,EACjB,SAAS,OAAO;AACZ,QAAI,SAAS;AACT,cAAQ,KAAK;AAAA,IACjB,OAAO;AACH,cAAQ,MAAM,KAAK;AAAA,IACvB;AAAA,EACJ;AACJ;;;ACGY;AAPL,IAAM,aAAkC,CAAC,UAA2B;AACvE,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,GAAG;AAAA,EACP,IAAI;AACJ,SAAQ;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,UAAU,CAAC,UAAU;AACjB,cAAM,eAAe;AACrB,YAAI,CAAC,UAAU;AACX,eAAK,cAAc,UAAU,aAAa;AAAA,QAC9C;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;ACzBA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,cAAc,IAAI;AAAA,EAC3B;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,aAAa,CAAC,cAA+B;AACtD,SAAO,GAAG,YAAY,GAAG,SAAS;AACtC;;;ACDY,gBAAAA,YAAA;AAFL,IAAM,QAAwB,CAAC,UAAsB;AACxD,QAAM,EAAE,OAAO,QAAQ,WAAW,GAAG,UAAU,IAAI;AACnD,SAAQ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,WAAW,WAAW,SAAS;AAAA,MAC/B,aAAW;AAAA;AAAA,EACf;AACJ;;;ACdA,SAAS,MAAAC,WAAU;AACnB,SAAS,OAAAC,YAAW;AAEb,IAAM,kBAAkBA,KAAID;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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", "jsx", "cn", "cva", "cn", "jsx", "cn", "cva", "cn", "jsx", "cn", "cva", "cn", "jsx", "useEffect"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace SearchForm
|
|
5
|
+
* @description Search Form
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type SearchFormProps = ComponentPropsWithRef<"form">;
|
|
9
|
+
export declare const SearchForm: FC<SearchFormProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Form
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Use List Field
|
|
6
|
+
*/
|
|
7
|
+
export type ListFieldProps = {
|
|
8
|
+
readonly value?: readonly string[] | undefined;
|
|
9
|
+
readonly defaultValue?: readonly string[] | undefined;
|
|
10
|
+
readonly onValueChange?: ((value: string[]) => void) | undefined;
|
|
11
|
+
readonly disabled?: boolean | undefined;
|
|
12
|
+
readonly readOnly?: boolean | undefined;
|
|
13
|
+
readonly form?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare const useListField: (props: ListFieldProps, onReset: () => void) => {
|
|
16
|
+
selected: string[];
|
|
17
|
+
native: import("react").RefObject<HTMLSelectElement | null>;
|
|
18
|
+
control: import("react").RefObject<HTMLElement | null>;
|
|
19
|
+
change: (next: readonly string[]) => void;
|
|
20
|
+
available: () => boolean;
|
|
21
|
+
};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--spacing: 0.25rem;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@layer utilities {
|
|
10
|
+
.m-0 {
|
|
11
|
+
margin: 0px;
|
|
12
|
+
}
|
|
13
|
+
.flex {
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
.grid {
|
|
17
|
+
display: grid;
|
|
18
|
+
}
|
|
19
|
+
.min-w-0 {
|
|
20
|
+
min-width: 0px;
|
|
21
|
+
}
|
|
22
|
+
.grid-cols-2 {
|
|
23
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
24
|
+
}
|
|
25
|
+
.flex-wrap {
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
}
|
|
28
|
+
.items-end {
|
|
29
|
+
align-items: flex-end;
|
|
30
|
+
}
|
|
31
|
+
.gap-gridui-8 {
|
|
32
|
+
gap: var(--gridui-space-8);
|
|
33
|
+
}
|
|
34
|
+
.gap-gridui-16 {
|
|
35
|
+
gap: var(--gridui-space-16);
|
|
36
|
+
}
|
|
37
|
+
.border-0 {
|
|
38
|
+
border-style: var(--tw-border-style);
|
|
39
|
+
border-width: 0px;
|
|
40
|
+
}
|
|
41
|
+
.p-0 {
|
|
42
|
+
padding: 0px;
|
|
43
|
+
}
|
|
44
|
+
.type-supporting {
|
|
45
|
+
font: var(--gridui-type-supporting);
|
|
46
|
+
letter-spacing: normal;
|
|
47
|
+
}
|
|
48
|
+
.wrap-anywhere {
|
|
49
|
+
overflow-wrap: anywhere;
|
|
50
|
+
}
|
|
51
|
+
.text-muted {
|
|
52
|
+
color: var(--gridui-muted);
|
|
53
|
+
}
|
|
54
|
+
.data-\[invalid\=\'true\'\]\:text-danger-foreground[data-invalid='true'] {
|
|
55
|
+
color: var(--gridui-danger-foreground);
|
|
56
|
+
}
|
|
57
|
+
:is(.\*\:data-\[span\=\'full\'\]\:col-span-full > *)[data-span='full'] {
|
|
58
|
+
grid-column: 1 / -1;
|
|
59
|
+
}
|
|
60
|
+
.\[\&_\>_div\]\:min-w-48 > div {
|
|
61
|
+
min-width: calc(var(--spacing) * 48);
|
|
62
|
+
}
|
|
63
|
+
.\[\&_\>_div\]\:flex-1 > div {
|
|
64
|
+
flex: 1;
|
|
65
|
+
}
|
|
66
|
+
.\[\&_label\]\:inline-flex label {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
}
|
|
69
|
+
.\[\&_label\]\:items-center label {
|
|
70
|
+
align-items: center;
|
|
71
|
+
}
|
|
72
|
+
.\[\&_label\]\:gap-gridui-4 label {
|
|
73
|
+
gap: var(--gridui-space-4);
|
|
74
|
+
}
|
|
75
|
+
.\[\&_label_svg\]\:h-gridui-16 label svg {
|
|
76
|
+
height: var(--gridui-space-16);
|
|
77
|
+
}
|
|
78
|
+
.\[\&_label_svg\]\:w-gridui-16 label svg {
|
|
79
|
+
width: var(--gridui-space-16);
|
|
80
|
+
}
|
|
81
|
+
.\[\&_label_svg\]\:text-foreground label svg {
|
|
82
|
+
color: var(--gridui-foreground);
|
|
83
|
+
}
|
|
84
|
+
.\[\&_legend\]\:mb-gridui-24 legend {
|
|
85
|
+
margin-bottom: var(--gridui-space-24);
|
|
86
|
+
}
|
|
87
|
+
.\[\&_legend\]\:p-0 legend {
|
|
88
|
+
padding: 0px;
|
|
89
|
+
}
|
|
90
|
+
.\[\&_legend_span\]\:ml-gridui-8 legend span {
|
|
91
|
+
margin-left: var(--gridui-space-8);
|
|
92
|
+
}
|
|
93
|
+
@media (max-width:24rem) {
|
|
94
|
+
.\[\@media\(max-width\:24rem\)\]\:grid-cols-\[1fr\] {
|
|
95
|
+
grid-template-columns: 1fr;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
@property --tw-border-style {
|
|
100
|
+
syntax: "*";
|
|
101
|
+
inherits: false;
|
|
102
|
+
initial-value: solid;
|
|
103
|
+
}
|
|
104
|
+
@layer properties {
|
|
105
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
106
|
+
*, ::before, ::after, ::backdrop {
|
|
107
|
+
--tw-border-style: solid;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/form",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "GridUI React form",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@gridui/style-utils": "^2.1.2",
|
|
30
|
+
"@gridui/theme": "^2.1.2",
|
|
31
|
+
"class-variance-authority": "0.7.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
35
|
+
"@jest/globals": "30.5.2",
|
|
36
|
+
"@types/jest": "30.0.0",
|
|
37
|
+
"@types/node": "26.6.5",
|
|
38
|
+
"@types/react": "19.3.0",
|
|
39
|
+
"@types/react-dom": "19.3.0",
|
|
40
|
+
"jest": "30.5.2",
|
|
41
|
+
"react": "19.3.1",
|
|
42
|
+
"react-dom": "19.3.1",
|
|
43
|
+
"typescript": "6.0.3"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
47
|
+
"compile": "tsc --project tsconfig.json",
|
|
48
|
+
"test": "jest",
|
|
49
|
+
"coverage": "jest --coverage"
|
|
50
|
+
}
|
|
6
51
|
}
|