@s-hirano-ist/s-ui 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/display/loading.d.ts +14 -0
- package/dist/display/loading.d.ts.map +1 -1
- package/dist/display/loading.js +14 -0
- package/dist/display/loading.js.map +1 -1
- package/dist/display/status/status-code-view.d.ts +29 -2
- package/dist/display/status/status-code-view.d.ts.map +1 -1
- package/dist/display/status/status-code-view.js +18 -0
- package/dist/display/status/status-code-view.js.map +1 -1
- package/dist/forms/fields/form-dropdown-input.d.ts +61 -7
- package/dist/forms/fields/form-dropdown-input.d.ts.map +1 -1
- package/dist/forms/fields/form-dropdown-input.js +64 -11
- package/dist/forms/fields/form-dropdown-input.js.map +1 -1
- package/dist/forms/fields/form-file-input.d.ts +30 -3
- package/dist/forms/fields/form-file-input.d.ts.map +1 -1
- package/dist/forms/fields/form-file-input.js +21 -0
- package/dist/forms/fields/form-file-input.js.map +1 -1
- package/dist/forms/fields/form-input-with-button.d.ts +41 -3
- package/dist/forms/fields/form-input-with-button.d.ts.map +1 -1
- package/dist/forms/fields/form-input-with-button.js +28 -0
- package/dist/forms/fields/form-input-with-button.js.map +1 -1
- package/dist/forms/fields/form-input.d.ts +32 -3
- package/dist/forms/fields/form-input.d.ts.map +1 -1
- package/dist/forms/fields/form-input.js +23 -0
- package/dist/forms/fields/form-input.js.map +1 -1
- package/dist/forms/fields/form-textarea.d.ts +31 -3
- package/dist/forms/fields/form-textarea.d.ts.map +1 -1
- package/dist/forms/fields/form-textarea.js +22 -0
- package/dist/forms/fields/form-textarea.js.map +1 -1
- package/dist/forms/generic-form-wrapper.d.ts +66 -3
- package/dist/forms/generic-form-wrapper.d.ts.map +1 -1
- package/dist/forms/generic-form-wrapper.js +53 -0
- package/dist/forms/generic-form-wrapper.js.map +1 -1
- package/dist/hooks/use-infinite-scroll.d.ts +58 -3
- package/dist/hooks/use-infinite-scroll.d.ts.map +1 -1
- package/dist/hooks/use-infinite-scroll.js +40 -0
- package/dist/hooks/use-infinite-scroll.js.map +1 -1
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/layouts/body/viewer-body.d.ts +49 -3
- package/dist/layouts/body/viewer-body.d.ts.map +1 -1
- package/dist/layouts/body/viewer-body.js +41 -1
- package/dist/layouts/body/viewer-body.js.map +1 -1
- package/dist/providers/theme-provider.d.ts +23 -0
- package/dist/providers/theme-provider.d.ts.map +1 -1
- package/dist/providers/theme-provider.js +23 -0
- package/dist/providers/theme-provider.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/badge.d.ts +41 -0
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +35 -0
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/button.d.ts +58 -0
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +50 -0
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.d.ts +74 -0
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +74 -0
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/command.d.ts +117 -1
- package/dist/ui/command.d.ts.map +1 -1
- package/dist/ui/command.js +117 -1
- package/dist/ui/command.js.map +1 -1
- package/dist/ui/dialog.d.ts +88 -0
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +88 -0
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/drawer.d.ts +85 -0
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +85 -0
- package/dist/ui/drawer.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts +88 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +88 -0
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/input.d.ts +27 -0
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +22 -0
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/label.d.ts +16 -0
- package/dist/ui/label.d.ts.map +1 -1
- package/dist/ui/label.js +20 -0
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/popover.d.ts +50 -0
- package/dist/ui/popover.d.ts.map +1 -0
- package/dist/ui/popover.js +54 -0
- package/dist/ui/popover.js.map +1 -0
- package/dist/ui/sonner.d.ts +27 -0
- package/dist/ui/sonner.d.ts.map +1 -1
- package/dist/ui/sonner.js +22 -0
- package/dist/ui/sonner.js.map +1 -1
- package/dist/ui/tabs.d.ts +50 -0
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +50 -0
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.d.ts +24 -0
- package/dist/ui/textarea.d.ts.map +1 -1
- package/dist/ui/textarea.js +19 -0
- package/dist/ui/textarea.js.map +1 -1
- package/dist/utils/cn.d.ts +19 -0
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +19 -0
- package/dist/utils/cn.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A centered loading spinner component.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Displays an animated spinner using Lucide's Loader icon.
|
|
6
|
+
* Used for loading states throughout the application.
|
|
7
|
+
*
|
|
8
|
+
* @returns A centered loading indicator
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* {isLoading ? <Loading /> : <Content />}
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
declare function Loading(): import("react/jsx-runtime").JSX.Element;
|
|
2
16
|
export default Loading;
|
|
3
17
|
//# sourceMappingURL=loading.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../display/loading.tsx"],"names":[],"mappings":"AAEA,iBAAS,OAAO,4CAMf;AAED,eAAe,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../display/loading.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,iBAAS,OAAO,4CAMf;AAED,eAAe,OAAO,CAAC"}
|
package/dist/display/loading.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Loader } from "lucide-react";
|
|
3
|
+
/**
|
|
4
|
+
* A centered loading spinner component.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Displays an animated spinner using Lucide's Loader icon.
|
|
8
|
+
* Used for loading states throughout the application.
|
|
9
|
+
*
|
|
10
|
+
* @returns A centered loading indicator
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* {isLoading ? <Loading /> : <Content />}
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
3
17
|
function Loading() {
|
|
4
18
|
return (_jsx("div", { className: "flex h-full items-center justify-center p-16", children: _jsx(Loader, { className: "animate-spin", size: 48 }) }));
|
|
5
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.js","sourceRoot":"","sources":["../../display/loading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,SAAS,OAAO;IACf,OAAO,CACN,cAAK,SAAS,EAAC,8CAA8C,YAC5D,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,EAAC,IAAI,EAAE,EAAE,GAAI,GACxC,CACN,CAAC;AACH,CAAC;AAED,eAAe,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"loading.js","sourceRoot":"","sources":["../../display/loading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;;;GAaG;AACH,SAAS,OAAO;IACf,OAAO,CACN,cAAK,SAAS,EAAC,8CAA8C,YAC5D,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,EAAC,IAAI,EAAE,EAAE,GAAI,GACxC,CACN,CAAC;AACH,CAAC;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* HTTP status codes supported by StatusCodeView.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* - `000` - Custom status (e.g., no results)
|
|
6
|
+
* - `204` - No Content
|
|
7
|
+
* - `403` - Forbidden
|
|
8
|
+
* - `404` - Not Found
|
|
9
|
+
* - `500` - Internal Server Error
|
|
10
|
+
*/
|
|
11
|
+
export type StatusCode = "000" | "204" | "403" | "404" | "500";
|
|
12
|
+
/**
|
|
13
|
+
* A stylized display for HTTP status codes.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Shows the status code prominently with a gradient effect
|
|
17
|
+
* and an accompanying description text.
|
|
18
|
+
*
|
|
19
|
+
* @param props - Status code and description string
|
|
20
|
+
* @returns A styled status code display
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <StatusCodeView
|
|
25
|
+
* statusCode="404"
|
|
26
|
+
* statusCodeString="Page Not Found"
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
2
30
|
export declare function StatusCodeView({ statusCode, statusCodeString, }: {
|
|
3
31
|
statusCode: StatusCode;
|
|
4
32
|
statusCodeString: string;
|
|
5
33
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
7
34
|
//# sourceMappingURL=status-code-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-code-view.d.ts","sourceRoot":"","sources":["../../../display/status/status-code-view.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"status-code-view.d.ts","sourceRoot":"","sources":["../../../display/status/status-code-view.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,EAC9B,UAAU,EACV,gBAAgB,GAChB,EAAE;IACF,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CACzB,2CAcA"}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* A stylized display for HTTP status codes.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Shows the status code prominently with a gradient effect
|
|
8
|
+
* and an accompanying description text.
|
|
9
|
+
*
|
|
10
|
+
* @param props - Status code and description string
|
|
11
|
+
* @returns A styled status code display
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <StatusCodeView
|
|
16
|
+
* statusCode="404"
|
|
17
|
+
* statusCodeString="Page Not Found"
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export function StatusCodeView({ statusCode, statusCodeString, }) {
|
|
4
22
|
return (_jsxs("div", { className: "w-full bg-linear-to-r from-primary to-primary-grad bg-clip-text p-2 text-center font-extrabold text-transparent", "data-testid": "status-code-view", children: [_jsxs("div", { className: "text-9xl", children: [_jsx("span", { className: "hidden font-light sm:inline", children: "---" }), String(statusCode), _jsx("span", { className: "hidden font-light sm:inline", children: "---" })] }), _jsxs("div", { className: "text-sm", children: ["------", statusCodeString, "------"] })] }));
|
|
5
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-code-view.js","sourceRoot":"","sources":["../../../display/status/status-code-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"status-code-view.js","sourceRoot":"","sources":["../../../display/status/status-code-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAcb;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAAC,EAC9B,UAAU,EACV,gBAAgB,GAIhB;IACA,OAAO,CACN,eACC,SAAS,EAAC,iHAAiH,iBAC/G,kBAAkB,aAE9B,eAAK,SAAS,EAAC,UAAU,aACxB,eAAM,SAAS,EAAC,6BAA6B,oBAAW,EACvD,MAAM,CAAC,UAAU,CAAC,EACnB,eAAM,SAAS,EAAC,6BAA6B,oBAAW,IACnD,EACN,eAAK,SAAS,EAAC,SAAS,uBAAQ,gBAAgB,cAAa,IACxD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +1,69 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props for the FormDropdownInput component.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This component provides a searchable dropdown with support for custom values.
|
|
7
|
+
* It integrates with the generic form wrapper for form state management.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link FormDropdownInput} for the component
|
|
10
|
+
*/
|
|
11
|
+
export type Props = {
|
|
12
|
+
/** The label text displayed above the dropdown */
|
|
4
13
|
label: string;
|
|
14
|
+
/** The HTML id for the input element */
|
|
5
15
|
htmlFor: string;
|
|
16
|
+
/** Array of options with id and display name */
|
|
6
17
|
options: {
|
|
7
18
|
id: string;
|
|
8
19
|
name: string;
|
|
9
20
|
}[];
|
|
10
|
-
|
|
21
|
+
/** Optional ref to access the hidden input element */
|
|
11
22
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
/** Placeholder text when no value is selected */
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/** The form field name (defaults to htmlFor if not provided) */
|
|
26
|
+
name?: string;
|
|
27
|
+
/** Whether the field is required */
|
|
28
|
+
required?: boolean;
|
|
29
|
+
/** Whether the field is disabled */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Message shown when no options match the search */
|
|
32
|
+
emptyMessage?: string;
|
|
33
|
+
/** Placeholder text for the search input */
|
|
34
|
+
searchPlaceholder?: string;
|
|
35
|
+
/** Function to generate the label for custom values */
|
|
36
|
+
customValueLabel?: (value: string) => string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A searchable dropdown input component for forms.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Combines Popover and Command components for a combobox experience.
|
|
43
|
+
* Supports:
|
|
44
|
+
* - Searchable options
|
|
45
|
+
* - Custom value entry
|
|
46
|
+
* - Form state preservation via GenericFormWrapper
|
|
47
|
+
* - Keyboard navigation
|
|
48
|
+
*
|
|
49
|
+
* @param props - Dropdown configuration including options and labels
|
|
50
|
+
* @returns A searchable dropdown field with hidden input for form submission
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <FormDropdownInput
|
|
55
|
+
* label="Category"
|
|
56
|
+
* htmlFor="category"
|
|
57
|
+
* name="category"
|
|
58
|
+
* options={[
|
|
59
|
+
* { id: "1", name: "Technology" },
|
|
60
|
+
* { id: "2", name: "Business" },
|
|
61
|
+
* ]}
|
|
62
|
+
* placeholder="Select a category"
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
67
|
+
*/
|
|
68
|
+
export declare function FormDropdownInput({ label, htmlFor, options, inputRef, placeholder, name, required, disabled, emptyMessage, searchPlaceholder, customValueLabel, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
69
|
//# sourceMappingURL=form-dropdown-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-dropdown-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-dropdown-input.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-dropdown-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-dropdown-input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAe5D;;;;;;;;GAQG;AACH,MAAM,MAAM,KAAK,GAAG;IACnB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAAC,EACjC,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,YAAiC,EACjC,iBAA+B,EAC/B,gBAAsC,GACtC,EAAE,KAAK,2CA4GP"}
|
|
@@ -1,23 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
+
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
3
5
|
import { Button } from "../../ui/button";
|
|
4
|
-
import {
|
|
5
|
-
import { Input } from "../../ui/input";
|
|
6
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../ui/command";
|
|
6
7
|
import { Label } from "../../ui/label";
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover";
|
|
9
|
+
import { cn } from "../../utils/cn";
|
|
7
10
|
import { useFormValues } from "../generic-form-wrapper";
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A searchable dropdown input component for forms.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Combines Popover and Command components for a combobox experience.
|
|
16
|
+
* Supports:
|
|
17
|
+
* - Searchable options
|
|
18
|
+
* - Custom value entry
|
|
19
|
+
* - Form state preservation via GenericFormWrapper
|
|
20
|
+
* - Keyboard navigation
|
|
21
|
+
*
|
|
22
|
+
* @param props - Dropdown configuration including options and labels
|
|
23
|
+
* @returns A searchable dropdown field with hidden input for form submission
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <FormDropdownInput
|
|
28
|
+
* label="Category"
|
|
29
|
+
* htmlFor="category"
|
|
30
|
+
* name="category"
|
|
31
|
+
* options={[
|
|
32
|
+
* { id: "1", name: "Technology" },
|
|
33
|
+
* { id: "2", name: "Business" },
|
|
34
|
+
* ]}
|
|
35
|
+
* placeholder="Select a category"
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
40
|
+
*/
|
|
41
|
+
export function FormDropdownInput({ label, htmlFor, options, inputRef, placeholder, name, required, disabled, emptyMessage = "No results found", searchPlaceholder = "Search...", customValueLabel = (v) => `Use "${v}"`, }) {
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
const [value, setValue] = useState("");
|
|
44
|
+
const [searchValue, setSearchValue] = useState("");
|
|
9
45
|
const formValues = useFormValues();
|
|
10
|
-
const preservedValue = formValues[
|
|
11
|
-
|
|
46
|
+
const preservedValue = formValues[name || htmlFor];
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (preservedValue) {
|
|
49
|
+
setValue(preservedValue);
|
|
50
|
+
}
|
|
51
|
+
}, [preservedValue]);
|
|
52
|
+
useEffect(() => {
|
|
12
53
|
if (inputRef?.current) {
|
|
13
54
|
inputRef.current.value = value;
|
|
14
55
|
}
|
|
56
|
+
}, [value, inputRef]);
|
|
57
|
+
const handleSelect = (selectedValue) => {
|
|
58
|
+
setValue(selectedValue);
|
|
59
|
+
setSearchValue("");
|
|
60
|
+
setOpen(false);
|
|
15
61
|
};
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
62
|
+
const handleCustomValue = () => {
|
|
63
|
+
if (searchValue) {
|
|
64
|
+
setValue(searchValue);
|
|
65
|
+
setSearchValue("");
|
|
66
|
+
setOpen(false);
|
|
19
67
|
}
|
|
20
|
-
}
|
|
21
|
-
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsxs(
|
|
68
|
+
};
|
|
69
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsxs(Popover, { onOpenChange: setOpen, open: open, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { "aria-expanded": open, className: "w-full justify-between", disabled: disabled, role: "combobox", variant: "outline", children: [value || placeholder || "Select...", _jsx(ChevronsUpDownIcon, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", children: _jsxs(Command, { shouldFilter: true, children: [_jsx(CommandInput, { onKeyDown: (e) => {
|
|
70
|
+
if (e.key === "Enter" && searchValue) {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
handleCustomValue();
|
|
73
|
+
}
|
|
74
|
+
}, onValueChange: setSearchValue, placeholder: searchPlaceholder, value: searchValue }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: searchValue ? (_jsx("button", { className: "w-full text-left hover:underline", onClick: handleCustomValue, type: "button", children: customValueLabel(searchValue) })) : (emptyMessage) }), _jsx(CommandGroup, { children: options.map((option) => (_jsxs(CommandItem, { onSelect: () => handleSelect(option.name), value: option.name, children: [_jsx(CheckIcon, { className: cn("mr-2 h-4 w-4", value === option.name ? "opacity-100" : "opacity-0") }), option.name] }, option.id))) })] })] }) })] }), _jsx("input", { id: htmlFor, name: name || htmlFor, ref: inputRef, required: required, type: "hidden", value: value })] }));
|
|
22
75
|
}
|
|
23
76
|
//# sourceMappingURL=form-dropdown-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-dropdown-input.js","sourceRoot":"","sources":["../../../forms/fields/form-dropdown-input.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-dropdown-input.js","sourceRoot":"","sources":["../../../forms/fields/form-dropdown-input.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
2
|
import { Input } from "../../ui/input";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Props for the FormFileInput component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link FormFileInput} for the component
|
|
7
|
+
*/
|
|
8
|
+
export type FormFileInputProps = {
|
|
9
|
+
/** The label text displayed above the file input */
|
|
4
10
|
label: string;
|
|
11
|
+
/** The HTML id for the input element */
|
|
5
12
|
htmlFor: string;
|
|
6
13
|
} & ComponentProps<typeof Input>;
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A labeled file input component for forms.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Provides a styled file upload field.
|
|
19
|
+
* Note: File inputs don't preserve values on form errors due to browser security.
|
|
20
|
+
*
|
|
21
|
+
* @param props - File input props including label and standard input attributes
|
|
22
|
+
* @returns A labeled file input field
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <FormFileInput
|
|
27
|
+
* label="Upload Image"
|
|
28
|
+
* htmlFor="image"
|
|
29
|
+
* name="image"
|
|
30
|
+
* accept="image/*"
|
|
31
|
+
* required
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function FormFileInput({ label, htmlFor, ...inputProps }: FormFileInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
36
|
//# sourceMappingURL=form-file-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-file-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-file-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,
|
|
1
|
+
{"version":3,"file":"form-file-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-file-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,EAC7B,KAAK,EACL,OAAO,EACP,GAAG,UAAU,EACb,EAAE,kBAAkB,2CAOpB"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Input } from "../../ui/input";
|
|
3
3
|
import { Label } from "../../ui/label";
|
|
4
|
+
/**
|
|
5
|
+
* A labeled file input component for forms.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Provides a styled file upload field.
|
|
9
|
+
* Note: File inputs don't preserve values on form errors due to browser security.
|
|
10
|
+
*
|
|
11
|
+
* @param props - File input props including label and standard input attributes
|
|
12
|
+
* @returns A labeled file input field
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <FormFileInput
|
|
17
|
+
* label="Upload Image"
|
|
18
|
+
* htmlFor="image"
|
|
19
|
+
* name="image"
|
|
20
|
+
* accept="image/*"
|
|
21
|
+
* required
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
export function FormFileInput({ label, htmlFor, ...inputProps }) {
|
|
5
26
|
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsx(Input, { id: htmlFor, type: "file", ...inputProps })] }));
|
|
6
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-file-input.js","sourceRoot":"","sources":["../../../forms/fields/form-file-input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"form-file-input.js","sourceRoot":"","sources":["../../../forms/fields/form-file-input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAcvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,EAC7B,KAAK,EACL,OAAO,EACP,GAAG,UAAU,EACO;IACpB,OAAO,CACN,eAAK,SAAS,EAAC,WAAW,aACzB,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,YAAG,KAAK,GAAS,EACxC,KAAC,KAAK,IAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,KAAK,UAAU,GAAI,IAC7C,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,51 @@
|
|
|
1
1
|
import { type ComponentProps, type RefObject } from "react";
|
|
2
2
|
import { Input } from "../../ui/input";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Props for the FormInputWithButton component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link FormInputWithButton} for the component
|
|
7
|
+
*/
|
|
8
|
+
export type FormInputWithButtonProps = {
|
|
9
|
+
/** The label text displayed above the input */
|
|
4
10
|
label: string;
|
|
11
|
+
/** The HTML id for the input element */
|
|
5
12
|
htmlFor: string;
|
|
13
|
+
/** Icon or content for the action button */
|
|
6
14
|
buttonIcon: React.ReactNode;
|
|
15
|
+
/** Callback when the button is clicked */
|
|
7
16
|
onButtonClick: () => void;
|
|
17
|
+
/** Optional ref to access the input element */
|
|
8
18
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
19
|
+
/** Test id for the button element */
|
|
9
20
|
buttonTestId?: string;
|
|
10
21
|
} & Omit<ComponentProps<typeof Input>, "ref">;
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A text input with an adjacent action button.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Useful for inputs that need an associated action like:
|
|
27
|
+
* - URL input with fetch button
|
|
28
|
+
* - Search input with clear button
|
|
29
|
+
* - Password input with visibility toggle
|
|
30
|
+
*
|
|
31
|
+
* Integrates with GenericFormWrapper for form state preservation.
|
|
32
|
+
*
|
|
33
|
+
* @param props - Input and button configuration
|
|
34
|
+
* @returns An input field with an action button
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <FormInputWithButton
|
|
39
|
+
* label="URL"
|
|
40
|
+
* htmlFor="url"
|
|
41
|
+
* name="url"
|
|
42
|
+
* buttonIcon={<FetchIcon />}
|
|
43
|
+
* onButtonClick={handleFetch}
|
|
44
|
+
* placeholder="https://example.com"
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
49
|
+
*/
|
|
50
|
+
export declare function FormInputWithButton({ label, htmlFor, buttonIcon, onButtonClick, inputRef, buttonTestId, defaultValue, ...inputProps }: FormInputWithButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
51
|
//# sourceMappingURL=form-input-with-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-input-with-button.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-input-with-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,
|
|
1
|
+
{"version":3,"file":"form-input-with-button.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-input-with-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACtC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0CAA0C;IAC1C,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,EACnC,KAAK,EACL,OAAO,EACP,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,GAAG,UAAU,EACb,EAAE,wBAAwB,2CA+B1B"}
|
|
@@ -4,6 +4,34 @@ import { Button } from "../../ui/button";
|
|
|
4
4
|
import { Input } from "../../ui/input";
|
|
5
5
|
import { Label } from "../../ui/label";
|
|
6
6
|
import { useFormValues } from "../generic-form-wrapper";
|
|
7
|
+
/**
|
|
8
|
+
* A text input with an adjacent action button.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Useful for inputs that need an associated action like:
|
|
12
|
+
* - URL input with fetch button
|
|
13
|
+
* - Search input with clear button
|
|
14
|
+
* - Password input with visibility toggle
|
|
15
|
+
*
|
|
16
|
+
* Integrates with GenericFormWrapper for form state preservation.
|
|
17
|
+
*
|
|
18
|
+
* @param props - Input and button configuration
|
|
19
|
+
* @returns An input field with an action button
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <FormInputWithButton
|
|
24
|
+
* label="URL"
|
|
25
|
+
* htmlFor="url"
|
|
26
|
+
* name="url"
|
|
27
|
+
* buttonIcon={<FetchIcon />}
|
|
28
|
+
* onButtonClick={handleFetch}
|
|
29
|
+
* placeholder="https://example.com"
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
34
|
+
*/
|
|
7
35
|
export function FormInputWithButton({ label, htmlFor, buttonIcon, onButtonClick, inputRef, buttonTestId, defaultValue, ...inputProps }) {
|
|
8
36
|
const formValues = useFormValues();
|
|
9
37
|
const preservedValue = formValues[inputProps.name || htmlFor];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-input-with-button.js","sourceRoot":"","sources":["../../../forms/fields/form-input-with-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuC,SAAS,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"form-input-with-button.js","sourceRoot":"","sources":["../../../forms/fields/form-input-with-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuC,SAAS,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAsBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,mBAAmB,CAAC,EACnC,KAAK,EACL,OAAO,EACP,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,GAAG,UAAU,EACa;IAC1B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,cAAc,IAAI,QAAQ,EAAE,OAAO,EAAE,CAAC;YACzC,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;QACzC,CAAC;IACF,CAAC,EAAE,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE/B,OAAO,CACN,eAAK,SAAS,EAAC,WAAW,aACzB,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,YAAG,KAAK,GAAS,EACxC,eAAK,SAAS,EAAC,MAAM,aACpB,KAAC,KAAK,IACL,YAAY,EAAE,cAAc,IAAI,YAAY,EAC5C,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,QAAQ,KACT,UAAU,GACb,EACF,KAAC,MAAM,mBACO,YAAY,EACzB,OAAO,EAAE,aAAa,EACtB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,YAEd,UAAU,GACH,IACJ,IACD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
2
|
import { Input } from "../../ui/input";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Props for the FormInput component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link FormInput} for the component
|
|
7
|
+
*/
|
|
8
|
+
export type FormInputProps = {
|
|
9
|
+
/** The label text displayed above the input */
|
|
4
10
|
label: string;
|
|
11
|
+
/** The HTML id for the input element */
|
|
5
12
|
htmlFor: string;
|
|
6
13
|
} & ComponentProps<typeof Input>;
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A labeled text input component for forms.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Integrates with GenericFormWrapper for form state preservation.
|
|
19
|
+
* Automatically restores value on form errors.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Input props including label and standard input attributes
|
|
22
|
+
* @returns A labeled input field
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <FormInput
|
|
27
|
+
* label="Email"
|
|
28
|
+
* htmlFor="email"
|
|
29
|
+
* name="email"
|
|
30
|
+
* type="email"
|
|
31
|
+
* required
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
36
|
+
*/
|
|
37
|
+
export declare function FormInput({ label, htmlFor, defaultValue, ...inputProps }: FormInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
38
|
//# sourceMappingURL=form-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,
|
|
1
|
+
{"version":3,"file":"form-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,EACzB,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,UAAU,EACb,EAAE,cAAc,2CAchB"}
|
|
@@ -2,6 +2,29 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Input } from "../../ui/input";
|
|
3
3
|
import { Label } from "../../ui/label";
|
|
4
4
|
import { useFormValues } from "../generic-form-wrapper";
|
|
5
|
+
/**
|
|
6
|
+
* A labeled text input component for forms.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Integrates with GenericFormWrapper for form state preservation.
|
|
10
|
+
* Automatically restores value on form errors.
|
|
11
|
+
*
|
|
12
|
+
* @param props - Input props including label and standard input attributes
|
|
13
|
+
* @returns A labeled input field
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <FormInput
|
|
18
|
+
* label="Email"
|
|
19
|
+
* htmlFor="email"
|
|
20
|
+
* name="email"
|
|
21
|
+
* type="email"
|
|
22
|
+
* required
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
27
|
+
*/
|
|
5
28
|
export function FormInput({ label, htmlFor, defaultValue, ...inputProps }) {
|
|
6
29
|
const formValues = useFormValues();
|
|
7
30
|
const preservedValue = formValues[inputProps.name || htmlFor];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-input.js","sourceRoot":"","sources":["../../../forms/fields/form-input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"form-input.js","sourceRoot":"","sources":["../../../forms/fields/form-input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAcxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,SAAS,CAAC,EACzB,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,UAAU,EACG;IAChB,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;IAE9D,OAAO,CACN,eAAK,SAAS,EAAC,WAAW,aACzB,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,YAAG,KAAK,GAAS,EACxC,KAAC,KAAK,IACL,YAAY,EAAE,cAAc,IAAI,YAAY,EAC5C,EAAE,EAAE,OAAO,KACP,UAAU,GACb,IACG,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
2
|
import { Textarea } from "../../ui/textarea";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Props for the FormTextarea component.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link FormTextarea} for the component
|
|
7
|
+
*/
|
|
8
|
+
export type FormTextareaProps = {
|
|
9
|
+
/** The label text displayed above the textarea */
|
|
4
10
|
label: string;
|
|
11
|
+
/** The HTML id for the textarea element */
|
|
5
12
|
htmlFor: string;
|
|
6
13
|
} & ComponentProps<typeof Textarea>;
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A labeled multi-line text input component for forms.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Integrates with GenericFormWrapper for form state preservation.
|
|
19
|
+
* Automatically restores value on form errors.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Textarea props including label and standard textarea attributes
|
|
22
|
+
* @returns A labeled textarea field
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <FormTextarea
|
|
27
|
+
* label="Description"
|
|
28
|
+
* htmlFor="description"
|
|
29
|
+
* name="description"
|
|
30
|
+
* rows={5}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @see {@link GenericFormWrapper} for form integration
|
|
35
|
+
*/
|
|
36
|
+
export declare function FormTextarea({ label, htmlFor, defaultValue, ...textareaProps }: FormTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
9
37
|
//# sourceMappingURL=form-textarea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-textarea.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,
|
|
1
|
+
{"version":3,"file":"form-textarea.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,aAAa,EAChB,EAAE,iBAAiB,2CAcnB"}
|