@gridui/form 2.0.1 → 2.0.2
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 +2 -2
- package/dist/index.js +11 -11
- package/dist/index.js.map +2 -2
- package/dist/styles.css +22 -25
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Core family. Public API: `ActionForm`, `ActionFormProps`, `Field`, `FieldGrid`,
|
|
|
5
5
|
Import components from `@gridui/form` and load `@gridui/form/styles.css` after Theme.
|
|
6
6
|
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
|
-
See [component ownership](
|
|
8
|
+
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/form/.changeset/history).
|
|
9
9
|
|
|
10
10
|
## Form controls
|
|
11
11
|
|
|
@@ -50,7 +50,7 @@ page frames or shared region seams.
|
|
|
50
50
|
|
|
51
51
|
## Declarative action boundaries
|
|
52
52
|
|
|
53
|
-
[`useAsyncAction` from `@gridui/button`](
|
|
53
|
+
[`useAsyncAction` from `@gridui/button`](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/button/README.md#action-helpers)
|
|
54
54
|
owns pending state and scheduling for caller-owned actions. `ActionForm` from
|
|
55
55
|
`@gridui/form` prevents native form navigation and invokes its declared
|
|
56
56
|
`onAction` unless disabled. Native form
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var ActionForm = (props) => {
|
|
|
38
38
|
import { cva } from "class-variance-authority";
|
|
39
39
|
var fieldSizingStyles = cva("", {
|
|
40
40
|
variants: {
|
|
41
|
-
grow: { true: "flex-1 basis-48" }
|
|
41
|
+
grow: { true: "gridui-u-flex-1 gridui-u-basis-48" }
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ import { cn } from "@gridui/style-utils";
|
|
|
47
47
|
import { cva as cva2 } from "class-variance-authority";
|
|
48
48
|
var fieldStyles = cva2(cn(
|
|
49
49
|
"gridui-field",
|
|
50
|
-
"grid min-w-0 gap-gridui-8"
|
|
50
|
+
"gridui-u-grid gridui-u-min-w-0 gridui-u-gap-gridui-8"
|
|
51
51
|
));
|
|
52
52
|
var fieldClass = (className) => {
|
|
53
53
|
return cn(fieldStyles(), className);
|
|
@@ -73,9 +73,9 @@ import { cn as cn3 } from "@gridui/style-utils";
|
|
|
73
73
|
import { cva as cva3 } from "class-variance-authority";
|
|
74
74
|
var fieldGridStyles = cva3(cn3(
|
|
75
75
|
"gridui-field-grid",
|
|
76
|
-
"grid grid-cols-2 gap-gridui-16",
|
|
77
|
-
"
|
|
78
|
-
"[@media(max-width:24rem)]:grid-cols-[1fr]"
|
|
76
|
+
"gridui-u-grid gridui-u-grid-cols-2 gridui-u-gap-gridui-16",
|
|
77
|
+
"gridui-u-*:data-[span='full']:col-span-full",
|
|
78
|
+
"gridui-u-[@media(max-width:24rem)]:grid-cols-[1fr]"
|
|
79
79
|
));
|
|
80
80
|
|
|
81
81
|
// src/field-grid/field-grid.tsx
|
|
@@ -97,8 +97,8 @@ import { cn as cn5 } from "@gridui/style-utils";
|
|
|
97
97
|
import { cva as cva4 } from "class-variance-authority";
|
|
98
98
|
var fieldNoteStyles = cva4(cn5(
|
|
99
99
|
"gridui-field-note",
|
|
100
|
-
"text-muted type-supporting wrap-anywhere",
|
|
101
|
-
"data-[invalid='true']:text-danger-foreground"
|
|
100
|
+
"gridui-u-text-muted gridui-u-type-supporting gridui-u-wrap-anywhere",
|
|
101
|
+
"gridui-u-data-[invalid='true']:text-danger-foreground"
|
|
102
102
|
));
|
|
103
103
|
|
|
104
104
|
// src/field-note/field-note.tsx
|
|
@@ -125,8 +125,8 @@ import { cn as cn7 } from "@gridui/style-utils";
|
|
|
125
125
|
import { cva as cva5 } from "class-variance-authority";
|
|
126
126
|
var fieldsetStyles = cva5(cn7(
|
|
127
127
|
"gridui-fieldset",
|
|
128
|
-
"min-w-0 m-0 p-0 border-0",
|
|
129
|
-
"[&>legend]:mb-gridui-24 [&>legend]:p-0"
|
|
128
|
+
"gridui-u-min-w-0 gridui-u-m-0 gridui-u-p-0 gridui-u-border-0",
|
|
129
|
+
"gridui-u-[&>legend]:mb-gridui-24 gridui-u-[&>legend]:p-0"
|
|
130
130
|
));
|
|
131
131
|
|
|
132
132
|
// src/fieldset/fieldset.tsx
|
|
@@ -165,7 +165,7 @@ var ListFieldControl = (props) => {
|
|
|
165
165
|
{
|
|
166
166
|
...restProps,
|
|
167
167
|
multiple: true,
|
|
168
|
-
className: "sr-only",
|
|
168
|
+
className: "gridui-u-sr-only",
|
|
169
169
|
"aria-hidden": "true",
|
|
170
170
|
tabIndex: -1,
|
|
171
171
|
onChange: (event) => {
|
|
@@ -185,7 +185,7 @@ import { cn as cn9 } from "@gridui/style-utils";
|
|
|
185
185
|
import { cva as cva6 } from "class-variance-authority";
|
|
186
186
|
var searchFormStyles = cva6(cn9(
|
|
187
187
|
"gridui-search-form",
|
|
188
|
-
"flex flex-wrap items-end gap-gridui-16"
|
|
188
|
+
"gridui-u-flex gridui-u-flex-wrap gridui-u-items-end gridui-u-gap-gridui-16"
|
|
189
189
|
));
|
|
190
190
|
|
|
191
191
|
// src/search-form/search-form.tsx
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/action-form/run-action.ts", "../src/action-form/action-form.tsx", "../src/shared/field-sizing.ts", "../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/shared/focus-invalid-control.ts", "../src/list-field-control/list-field-control.tsx", "../src/search-form/style.ts", "../src/search-form/search-form.tsx", "../src/shared/navigation.ts", "../src/shared/use-form-reset.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 Shared\n * @description Field Sizing\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const fieldSizingStyles = cva(\"\", {\n variants: {\n grow: { true: \"flex-1 basis-48\" },\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 { fieldSizingStyles } from \"../shared/field-sizing\";\nimport { fieldClass } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldProps = ComponentPropsWithRef<\"div\"> & {\n readonly grow?: boolean;\n readonly span?: \"auto\" | \"full\";\n};\n\nexport const Field: FC<FieldProps> = (props: FieldProps) => {\n const { span = \"auto\", grow = false, className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(fieldClass(), fieldSizingStyles({ grow }), 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 \"[@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 { fieldSizingStyles } from \"../shared/field-sizing\";\nimport { fieldGridStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldGridProps = ComponentPropsWithRef<\"div\"> & {\n readonly grow?: boolean;\n};\n\nexport const FieldGrid: FC<FieldGridProps> = (props: FieldGridProps) => {\n const { grow = false, className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(fieldGridStyles(), fieldSizingStyles({ grow }), 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));\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 Shared\n * @description Focus Invalid Control\n */\n\nimport type { SyntheticEvent } from \"react\";\n\nexport const focusInvalidControl = (\n event: SyntheticEvent<HTMLInputElement | HTMLSelectElement>,\n focus: () => void,\n): void => {\n event.preventDefault();\n const control = event.currentTarget;\n const owner = control.form;\n const firstInvalid = owner && Array.from(owner.elements).find(element => {\n return \"willValidate\" in element && element.willValidate && element.matches(\":invalid\");\n });\n if (!owner || firstInvalid === control) {\n focus();\n }\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace ListFieldControl\n * @description List Field Control\n */\n\nimport { focusInvalidControl } from \"../shared/focus-invalid-control\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ListFieldControlProps = Pick<ComponentPropsWithRef<\"select\">, \"name\" | \"form\" | \"disabled\" | \"required\" | \"ref\" | \"children\"> & {\n readonly value: readonly string[];\n readonly onValueChange?: (value: string[]) => void;\n readonly onInvalidFocus: () => void;\n};\n\nexport const ListFieldControl: FC<ListFieldControlProps> = (props: ListFieldControlProps) => {\n const { onValueChange, onInvalidFocus, ...restProps } = props;\n return (<select\n {...restProps}\n multiple\n className=\"sr-only\"\n aria-hidden=\"true\"\n tabIndex={-1}\n onChange={event => {\n onValueChange?.(Array.from(event.currentTarget.selectedOptions, option => {\n return option.value;\n }));\n }}\n onInvalid={event => {\n focusInvalidControl(event, onInvalidFocus);\n }}\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));\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 Form Reset\n */\n\nimport { type RefObject, useEffect, useLayoutEffect, useRef } from \"react\";\n\ntype ResetElement = HTMLElement & {\n readonly form?: HTMLFormElement | null;\n};\n\nconst formOwner = (element: ResetElement, form?: string): Element | null => {\n if (element.form !== undefined) {\n return element.form;\n }\n return form === undefined ? element.closest(\"form\") : element.ownerDocument.getElementById(form);\n};\n\nexport const useFormReset = (element: RefObject<ResetElement | null>, onReset: () => void, form?: string): void => {\n const latest = useRef(onReset);\n useLayoutEffect(() => {\n latest.current = onReset;\n });\n useEffect(() => {\n const document = element.current?.ownerDocument;\n if (!document) {\n return;\n }\n const pending = new Set<ReturnType<typeof setTimeout>>();\n const reset = (event: Event): void => {\n const control = element.current;\n if (!control || event.target !== formOwner(control, form)) {\n return;\n }\n // Native reset runs after dispatch; React bubbling handlers can cancel it.\n const timer = setTimeout(() => {\n pending.delete(timer);\n const current = element.current;\n if (!event.defaultPrevented && current && event.target === formOwner(current, form)) {\n latest.current();\n }\n }, 0);\n pending.add(timer);\n };\n document.addEventListener(\"reset\", reset, true);\n return () => {\n document.removeEventListener(\"reset\", reset, true);\n pending.forEach(timer => {\n clearTimeout(timer);\n });\n };\n }, [\n element,\n form,\n ]);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Shared\n * @description Use List Field\n */\n\nimport { useFormReset } from \"./use-form-reset\";\nimport { 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 useFormReset(native, () => {\n flushSync(() => {\n latest.current.update(initial.current);\n latest.current.onReset();\n });\n if (native.current) {\n for (const option of native.current.options) {\n option.selected = latest.current.selected.includes(option.value);\n }\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,WAAW;AAEb,IAAM,oBAAoB,IAAI,IAAI;AAAA,EACrC,UAAU;AAAA,IACN,MAAM,EAAE,MAAM,
|
|
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 Shared\n * @description Field Sizing\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const fieldSizingStyles = cva(\"\", {\n variants: {\n grow: { true: \"gridui-u-flex-1 gridui-u-basis-48\" },\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 \"gridui-u-grid gridui-u-min-w-0 gridui-u-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 { fieldSizingStyles } from \"../shared/field-sizing\";\nimport { fieldClass } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldProps = ComponentPropsWithRef<\"div\"> & {\n readonly grow?: boolean;\n readonly span?: \"auto\" | \"full\";\n};\n\nexport const Field: FC<FieldProps> = (props: FieldProps) => {\n const { span = \"auto\", grow = false, className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(fieldClass(), fieldSizingStyles({ grow }), 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 \"gridui-u-grid gridui-u-grid-cols-2 gridui-u-gap-gridui-16\",\n \"gridui-u-*:data-[span='full']:col-span-full\",\n \"gridui-u-[@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 { fieldSizingStyles } from \"../shared/field-sizing\";\nimport { fieldGridStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type FieldGridProps = ComponentPropsWithRef<\"div\"> & {\n readonly grow?: boolean;\n};\n\nexport const FieldGrid: FC<FieldGridProps> = (props: FieldGridProps) => {\n const { grow = false, className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(fieldGridStyles(), fieldSizingStyles({ grow }), 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 \"gridui-u-text-muted gridui-u-type-supporting gridui-u-wrap-anywhere\",\n \"gridui-u-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 \"gridui-u-min-w-0 gridui-u-m-0 gridui-u-p-0 gridui-u-border-0\",\n \"gridui-u-[&>legend]:mb-gridui-24 gridui-u-[&>legend]:p-0\",\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 Shared\n * @description Focus Invalid Control\n */\n\nimport type { SyntheticEvent } from \"react\";\n\nexport const focusInvalidControl = (\n event: SyntheticEvent<HTMLInputElement | HTMLSelectElement>,\n focus: () => void,\n): void => {\n event.preventDefault();\n const control = event.currentTarget;\n const owner = control.form;\n const firstInvalid = owner && Array.from(owner.elements).find(element => {\n return \"willValidate\" in element && element.willValidate && element.matches(\":invalid\");\n });\n if (!owner || firstInvalid === control) {\n focus();\n }\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace ListFieldControl\n * @description List Field Control\n */\n\nimport { focusInvalidControl } from \"../shared/focus-invalid-control\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ListFieldControlProps = Pick<ComponentPropsWithRef<\"select\">, \"name\" | \"form\" | \"disabled\" | \"required\" | \"ref\" | \"children\"> & {\n readonly value: readonly string[];\n readonly onValueChange?: (value: string[]) => void;\n readonly onInvalidFocus: () => void;\n};\n\nexport const ListFieldControl: FC<ListFieldControlProps> = (props: ListFieldControlProps) => {\n const { onValueChange, onInvalidFocus, ...restProps } = props;\n return (<select\n {...restProps}\n multiple\n className=\"gridui-u-sr-only\"\n aria-hidden=\"true\"\n tabIndex={-1}\n onChange={event => {\n onValueChange?.(Array.from(event.currentTarget.selectedOptions, option => {\n return option.value;\n }));\n }}\n onInvalid={event => {\n focusInvalidControl(event, onInvalidFocus);\n }}\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 \"gridui-u-flex gridui-u-flex-wrap gridui-u-items-end gridui-u-gap-gridui-16\",\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 Form Reset\n */\n\nimport { type RefObject, useEffect, useLayoutEffect, useRef } from \"react\";\n\ntype ResetElement = HTMLElement & {\n readonly form?: HTMLFormElement | null;\n};\n\nconst formOwner = (element: ResetElement, form?: string): Element | null => {\n if (element.form !== undefined) {\n return element.form;\n }\n return form === undefined ? element.closest(\"form\") : element.ownerDocument.getElementById(form);\n};\n\nexport const useFormReset = (element: RefObject<ResetElement | null>, onReset: () => void, form?: string): void => {\n const latest = useRef(onReset);\n useLayoutEffect(() => {\n latest.current = onReset;\n });\n useEffect(() => {\n const document = element.current?.ownerDocument;\n if (!document) {\n return;\n }\n const pending = new Set<ReturnType<typeof setTimeout>>();\n const reset = (event: Event): void => {\n const control = element.current;\n if (!control || event.target !== formOwner(control, form)) {\n return;\n }\n // Native reset runs after dispatch; React bubbling handlers can cancel it.\n const timer = setTimeout(() => {\n pending.delete(timer);\n const current = element.current;\n if (!event.defaultPrevented && current && event.target === formOwner(current, form)) {\n latest.current();\n }\n }, 0);\n pending.add(timer);\n };\n document.addEventListener(\"reset\", reset, true);\n return () => {\n document.removeEventListener(\"reset\", reset, true);\n pending.forEach(timer => {\n clearTimeout(timer);\n });\n };\n }, [\n element,\n form,\n ]);\n};\n", "/**\n * @author WMXPY\n * @package Form\n * @namespace Shared\n * @description Use List Field\n */\n\nimport { useFormReset } from \"./use-form-reset\";\nimport { 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 useFormReset(native, () => {\n flushSync(() => {\n latest.current.update(initial.current);\n latest.current.onReset();\n });\n if (native.current) {\n for (const option of native.current.options) {\n option.selected = latest.current.selected.includes(option.value);\n }\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,WAAW;AAEb,IAAM,oBAAoB,IAAI,IAAI;AAAA,EACrC,UAAU;AAAA,IACN,MAAM,EAAE,MAAM,oCAAoC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QAAQ,WAAW;AAAA,EAC1E;AACA,QAAM,SAAS,CAAC,SAA4B;AACxC,UAAM,SAAS,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC;AAChC,QAAI,SAAS,WAAW,OAAO,UAAU,SAAS,MAAM,CAAC,OAAO,UAAU;AACtE,aAAO,UAAU,OAAO,KAAK;AAAA,IACjC,CAAC,GAAG;AACA;AAAA,IACJ;AACA,QAAI,UAAU,QAAW;AACrB,eAAS,MAAM;AAAA,IACnB;AACA,oBAAgB,MAAM;AAAA,EAC1B;AACA,QAAM,SAASA,QAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACD,EAAAD,iBAAgB,MAAM;AAClB,WAAO,UAAU;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ,CAAC;AACD,eAAa,QAAQ,MAAM;AACvB,cAAU,MAAM;AACZ,aAAO,QAAQ,OAAO,QAAQ,OAAO;AACrC,aAAO,QAAQ,QAAQ;AAAA,IAC3B,CAAC;AACD,QAAI,OAAO,SAAS;AAChB,iBAAW,UAAU,OAAO,QAAQ,SAAS;AACzC,eAAO,WAAW,OAAO,QAAQ,SAAS,SAAS,OAAO,KAAK;AAAA,MACnE;AAAA,IACJ;AAAA,EACJ,GAAG,IAAI;AACP,QAAM,SAAS,CAAC,SAA4B;AACxC,QAAI,UAAU,GAAG;AACb,aAAO,IAAI;AAAA,IACf;AAAA,EACJ;AACA,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": ["cva", "cn", "jsx", "cn", "cva", "cn", "jsx", "cn", "cva", "cn", "jsx", "cn", "cva", "cn", "jsx", "jsx", "cn", "cva", "cn", "jsx", "useEffect", "useLayoutEffect", "useRef"]
|
|
7
7
|
}
|
package/dist/styles.css
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
@layer utilities {
|
|
10
|
-
.sr-only {
|
|
10
|
+
.gridui-u-sr-only {
|
|
11
11
|
position: absolute;
|
|
12
12
|
width: 1px;
|
|
13
13
|
height: 1px;
|
|
@@ -18,73 +18,70 @@
|
|
|
18
18
|
white-space: nowrap;
|
|
19
19
|
border-width: 0;
|
|
20
20
|
}
|
|
21
|
-
.m-0 {
|
|
21
|
+
.gridui-u-m-0 {
|
|
22
22
|
margin: 0px;
|
|
23
23
|
}
|
|
24
|
-
.flex {
|
|
24
|
+
.gridui-u-flex {
|
|
25
25
|
display: flex;
|
|
26
26
|
}
|
|
27
|
-
.grid {
|
|
27
|
+
.gridui-u-grid {
|
|
28
28
|
display: grid;
|
|
29
29
|
}
|
|
30
|
-
.min-w-0 {
|
|
30
|
+
.gridui-u-min-w-0 {
|
|
31
31
|
min-width: 0px;
|
|
32
32
|
}
|
|
33
|
-
.flex-1 {
|
|
33
|
+
.gridui-u-flex-1 {
|
|
34
34
|
flex: 1;
|
|
35
35
|
}
|
|
36
|
-
.
|
|
37
|
-
flex-grow: 1;
|
|
38
|
-
}
|
|
39
|
-
.basis-48 {
|
|
36
|
+
.gridui-u-basis-48 {
|
|
40
37
|
flex-basis: calc(var(--spacing) * 48);
|
|
41
38
|
}
|
|
42
|
-
.grid-cols-2 {
|
|
39
|
+
.gridui-u-grid-cols-2 {
|
|
43
40
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
44
41
|
}
|
|
45
|
-
.flex-wrap {
|
|
42
|
+
.gridui-u-flex-wrap {
|
|
46
43
|
flex-wrap: wrap;
|
|
47
44
|
}
|
|
48
|
-
.items-end {
|
|
45
|
+
.gridui-u-items-end {
|
|
49
46
|
align-items: flex-end;
|
|
50
47
|
}
|
|
51
|
-
.gap-gridui-8 {
|
|
48
|
+
.gridui-u-gap-gridui-8 {
|
|
52
49
|
gap: var(--gridui-space-8);
|
|
53
50
|
}
|
|
54
|
-
.gap-gridui-16 {
|
|
51
|
+
.gridui-u-gap-gridui-16 {
|
|
55
52
|
gap: var(--gridui-space-16);
|
|
56
53
|
}
|
|
57
|
-
.border-0 {
|
|
54
|
+
.gridui-u-border-0 {
|
|
58
55
|
border-style: var(--tw-border-style);
|
|
59
56
|
border-width: 0px;
|
|
60
57
|
}
|
|
61
|
-
.p-0 {
|
|
58
|
+
.gridui-u-p-0 {
|
|
62
59
|
padding: 0px;
|
|
63
60
|
}
|
|
64
|
-
.type-supporting {
|
|
61
|
+
.gridui-u-type-supporting {
|
|
65
62
|
font: var(--gridui-type-supporting);
|
|
66
63
|
letter-spacing: normal;
|
|
67
64
|
}
|
|
68
|
-
.wrap-anywhere {
|
|
65
|
+
.gridui-u-wrap-anywhere {
|
|
69
66
|
overflow-wrap: anywhere;
|
|
70
67
|
}
|
|
71
|
-
.text-muted {
|
|
68
|
+
.gridui-u-text-muted {
|
|
72
69
|
color: var(--gridui-muted);
|
|
73
70
|
}
|
|
74
|
-
.data-\[invalid\=\'true\'\]\:text-danger-foreground[data-invalid='true'] {
|
|
71
|
+
.gridui-u-data-\[invalid\=\'true\'\]\:text-danger-foreground[data-invalid='true'] {
|
|
75
72
|
color: var(--gridui-danger-foreground);
|
|
76
73
|
}
|
|
77
|
-
:is(
|
|
74
|
+
:is(.gridui-u-\*\:data-\[span\=\'full\'\]\:col-span-full > *)[data-span='full'] {
|
|
78
75
|
grid-column: 1 / -1;
|
|
79
76
|
}
|
|
80
|
-
|
|
77
|
+
.gridui-u-\[\&\>legend\]\:mb-gridui-24 > legend {
|
|
81
78
|
margin-bottom: var(--gridui-space-24);
|
|
82
79
|
}
|
|
83
|
-
|
|
80
|
+
.gridui-u-\[\&\>legend\]\:p-0 > legend {
|
|
84
81
|
padding: 0px;
|
|
85
82
|
}
|
|
86
83
|
@media (max-width:24rem) {
|
|
87
|
-
|
|
84
|
+
.gridui-u-\[\@media\(max-width\:24rem\)\]\:grid-cols-\[1fr\] {
|
|
88
85
|
grid-template-columns: 1fr;
|
|
89
86
|
}
|
|
90
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/form",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "GridUI React form",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -26,18 +26,22 @@
|
|
|
26
26
|
"react-dom": "^19.2.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@gridui/style-utils": "^2.1.
|
|
30
|
-
"@gridui/theme": "^2.2
|
|
29
|
+
"@gridui/style-utils": "^2.1.4",
|
|
30
|
+
"@gridui/theme": "^2.3.2",
|
|
31
31
|
"class-variance-authority": "0.7.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
35
|
+
"@gridui/button": "2.2.0",
|
|
36
|
+
"@gridui/input": "1.1.2",
|
|
35
37
|
"@jest/globals": "30.5.2",
|
|
38
|
+
"@storybook/react-vite": "10.6.5",
|
|
36
39
|
"@types/jest": "30.0.0",
|
|
37
40
|
"@types/node": "26.6.6",
|
|
38
41
|
"@types/react": "19.3.0",
|
|
39
42
|
"@types/react-dom": "19.3.0",
|
|
40
43
|
"jest": "30.5.2",
|
|
44
|
+
"lucide-react": "1.65.0",
|
|
41
45
|
"react": "19.3.1",
|
|
42
46
|
"react-dom": "19.3.1",
|
|
43
47
|
"typescript": "6.0.3"
|