@s-hirano-ist/s-ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/dist/display/loading.d.ts +3 -0
- package/dist/display/loading.d.ts.map +1 -0
- package/dist/display/loading.js +7 -0
- package/dist/display/loading.js.map +1 -0
- package/dist/display/status/status-code-view.d.ts +7 -0
- package/dist/display/status/status-code-view.d.ts.map +1 -0
- package/dist/display/status/status-code-view.js +6 -0
- package/dist/display/status/status-code-view.js.map +1 -0
- package/dist/forms/fields/form-dropdown-input.d.ts +15 -0
- package/dist/forms/fields/form-dropdown-input.d.ts.map +1 -0
- package/dist/forms/fields/form-dropdown-input.js +23 -0
- package/dist/forms/fields/form-dropdown-input.js.map +1 -0
- package/dist/forms/fields/form-file-input.d.ts +9 -0
- package/dist/forms/fields/form-file-input.d.ts.map +1 -0
- package/dist/forms/fields/form-file-input.js +7 -0
- package/dist/forms/fields/form-file-input.js.map +1 -0
- package/dist/forms/fields/form-input-with-button.d.ts +13 -0
- package/dist/forms/fields/form-input-with-button.d.ts.map +1 -0
- package/dist/forms/fields/form-input-with-button.js +17 -0
- package/dist/forms/fields/form-input-with-button.js.map +1 -0
- package/dist/forms/fields/form-input.d.ts +9 -0
- package/dist/forms/fields/form-input.d.ts.map +1 -0
- package/dist/forms/fields/form-input.js +10 -0
- package/dist/forms/fields/form-input.js.map +1 -0
- package/dist/forms/fields/form-textarea.d.ts +9 -0
- package/dist/forms/fields/form-textarea.d.ts.map +1 -0
- package/dist/forms/fields/form-textarea.js +10 -0
- package/dist/forms/fields/form-textarea.js.map +1 -0
- package/dist/forms/generic-form-wrapper.d.ts +18 -0
- package/dist/forms/generic-form-wrapper.d.ts.map +1 -0
- package/dist/forms/generic-form-wrapper.js +40 -0
- package/dist/forms/generic-form-wrapper.js.map +1 -0
- package/dist/hooks/use-infinite-scroll.d.ts +13 -0
- package/dist/hooks/use-infinite-scroll.d.ts.map +1 -0
- package/dist/hooks/use-infinite-scroll.js +35 -0
- package/dist/hooks/use-infinite-scroll.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts/body/viewer-body.d.ts +9 -0
- package/dist/layouts/body/viewer-body.d.ts.map +1 -0
- package/dist/layouts/body/viewer-body.js +45 -0
- package/dist/layouts/body/viewer-body.js.map +1 -0
- package/dist/providers/theme-provider.d.ts +4 -0
- package/dist/providers/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider.js +7 -0
- package/dist/providers/theme-provider.js.map +1 -0
- package/dist/tailwind.config.d.ts +78 -0
- package/dist/tailwind.config.d.ts.map +1 -0
- package/dist/tailwind.config.js +67 -0
- package/dist/tailwind.config.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/ui/badge.d.ts +8 -0
- package/dist/ui/badge.d.ts.map +1 -0
- package/dist/ui/badge.js +21 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/button.d.ts +17 -0
- package/dist/ui/button.d.ts.map +1 -0
- package/dist/ui/button.js +38 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/card.d.ts +9 -0
- package/dist/ui/card.d.ts.map +1 -0
- package/dist/ui/card.js +17 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/command.d.ts +21 -0
- package/dist/ui/command.d.ts.map +1 -0
- package/dist/ui/command.js +33 -0
- package/dist/ui/command.js.map +1 -0
- package/dist/ui/dialog.d.ts +21 -0
- package/dist/ui/dialog.d.ts.map +1 -0
- package/dist/ui/dialog.js +26 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/drawer.d.ts +14 -0
- package/dist/ui/drawer.d.ts.map +1 -0
- package/dist/ui/drawer.js +36 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +23 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/ui/dropdown-menu.js +28 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/input.d.ts +5 -0
- package/dist/ui/input.d.ts.map +1 -0
- package/dist/ui/input.js +9 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts +6 -0
- package/dist/ui/label.d.ts.map +1 -0
- package/dist/ui/label.js +11 -0
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/sonner.d.ts +5 -0
- package/dist/ui/sonner.d.ts.map +1 -0
- package/dist/ui/sonner.js +17 -0
- package/dist/ui/sonner.js.map +1 -0
- package/dist/ui/tabs.d.ts +8 -0
- package/dist/ui/tabs.d.ts.map +1 -0
- package/dist/ui/tabs.js +14 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/textarea.d.ts +5 -0
- package/dist/ui/textarea.d.ts.map +1 -0
- package/dist/ui/textarea.js +9 -0
- package/dist/ui/textarea.js.map +1 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/cn.js.map +1 -0
- package/globals.css +60 -0
- package/package.json +87 -0
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type StatusCode = "000" | "204" | "403" | "404" | "500";
|
|
2
|
+
export declare function StatusCodeView({ statusCode, statusCodeString, }: {
|
|
3
|
+
statusCode: StatusCode;
|
|
4
|
+
statusCodeString: string;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=status-code-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-code-view.d.ts","sourceRoot":"","sources":["../../../display/status/status-code-view.tsx"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAExD,wBAAgB,cAAc,CAAC,EAC9B,UAAU,EACV,gBAAgB,GAChB,EAAE;IACF,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CACzB,2CAcA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export function StatusCodeView({ statusCode, statusCodeString, }) {
|
|
4
|
+
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
|
+
}
|
|
6
|
+
//# sourceMappingURL=status-code-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-code-view.js","sourceRoot":"","sources":["../../../display/status/status-code-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComponentProps, type RefObject } from "react";
|
|
2
|
+
import { Input } from "../../ui/input";
|
|
3
|
+
type Props = {
|
|
4
|
+
label: string;
|
|
5
|
+
htmlFor: string;
|
|
6
|
+
options: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}[];
|
|
10
|
+
triggerIcon: React.ReactNode;
|
|
11
|
+
inputRef?: RefObject<HTMLInputElement | null>;
|
|
12
|
+
} & Omit<ComponentProps<typeof Input>, "ref">;
|
|
13
|
+
export declare function FormDropdownInput({ label, htmlFor, options, triggerIcon, inputRef, defaultValue, ...inputProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=form-dropdown-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-dropdown-input.d.ts","sourceRoot":"","sources":["../../../forms/fields/form-dropdown-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAQvE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC9C,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAE9C,wBAAgB,iBAAiB,CAAC,EACjC,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,GAAG,UAAU,EACb,EAAE,KAAK,2CA6CP"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { Button } from "../../ui/button";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "../../ui/dropdown-menu";
|
|
5
|
+
import { Input } from "../../ui/input";
|
|
6
|
+
import { Label } from "../../ui/label";
|
|
7
|
+
import { useFormValues } from "../generic-form-wrapper";
|
|
8
|
+
export function FormDropdownInput({ label, htmlFor, options, triggerIcon, inputRef, defaultValue, ...inputProps }) {
|
|
9
|
+
const formValues = useFormValues();
|
|
10
|
+
const preservedValue = formValues[inputProps.name || htmlFor];
|
|
11
|
+
const handleSelectedValueChange = (value) => {
|
|
12
|
+
if (inputRef?.current) {
|
|
13
|
+
inputRef.current.value = value;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (preservedValue && inputRef?.current) {
|
|
18
|
+
inputRef.current.value = preservedValue;
|
|
19
|
+
}
|
|
20
|
+
}, [preservedValue, inputRef]);
|
|
21
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsxs("div", { className: "flex", children: [_jsx(Input, { defaultValue: preservedValue || defaultValue, id: htmlFor, ref: inputRef, ...inputProps }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", children: triggerIcon }) }), _jsx(DropdownMenuContent, { children: options.map((option) => (_jsx(DropdownMenuItem, { onClick: () => handleSelectedValueChange(option.name), textValue: String(option.name), children: option.name }, option.id))) })] })] })] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=form-dropdown-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-dropdown-input.js","sourceRoot":"","sources":["../../../forms/fields/form-dropdown-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuC,SAAS,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAUxD,MAAM,UAAU,iBAAiB,CAAC,EACjC,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,GAAG,UAAU,EACN;IACP,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;IAE9D,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAE,EAAE;QACnD,IAAI,QAAQ,EAAE,OAAO,EAAE,CAAC;YACvB,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAChC,CAAC;IACF,CAAC,CAAC;IAEF,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,MAAC,YAAY,eACZ,KAAC,mBAAmB,IAAC,OAAO,kBAC3B,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,YAAE,WAAW,GAAU,GACzB,EACtB,KAAC,mBAAmB,cAClB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxB,KAAC,gBAAgB,IAEhB,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,EACrD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAE7B,MAAM,CAAC,IAAI,IAJP,MAAM,CAAC,EAAE,CAKI,CACnB,CAAC,GACmB,IACR,IACV,IACD,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Input } from "../../ui/input";
|
|
3
|
+
type Props = {
|
|
4
|
+
label: string;
|
|
5
|
+
htmlFor: string;
|
|
6
|
+
} & ComponentProps<typeof Input>;
|
|
7
|
+
export declare function FormFileInput({ label, htmlFor, ...inputProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=form-file-input.d.ts.map
|
|
@@ -0,0 +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,KAAK,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjC,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE,KAAK,2CAOrE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from "../../ui/input";
|
|
3
|
+
import { Label } from "../../ui/label";
|
|
4
|
+
export function FormFileInput({ label, htmlFor, ...inputProps }) {
|
|
5
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsx(Input, { id: htmlFor, type: "file", ...inputProps })] }));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=form-file-input.js.map
|
|
@@ -0,0 +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;AAOvC,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,EAAS;IACrE,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ComponentProps, type RefObject } from "react";
|
|
2
|
+
import { Input } from "../../ui/input";
|
|
3
|
+
type Props = {
|
|
4
|
+
label: string;
|
|
5
|
+
htmlFor: string;
|
|
6
|
+
buttonIcon: React.ReactNode;
|
|
7
|
+
onButtonClick: () => void;
|
|
8
|
+
inputRef?: RefObject<HTMLInputElement | null>;
|
|
9
|
+
buttonTestId?: string;
|
|
10
|
+
} & Omit<ComponentProps<typeof Input>, "ref">;
|
|
11
|
+
export declare function FormInputWithButton({ label, htmlFor, buttonIcon, onButtonClick, inputRef, buttonTestId, defaultValue, ...inputProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=form-input-with-button.d.ts.map
|
|
@@ -0,0 +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,KAAK,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,EACnC,KAAK,EACL,OAAO,EACP,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,GAAG,UAAU,EACb,EAAE,KAAK,2CA+BP"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { Button } from "../../ui/button";
|
|
4
|
+
import { Input } from "../../ui/input";
|
|
5
|
+
import { Label } from "../../ui/label";
|
|
6
|
+
import { useFormValues } from "../generic-form-wrapper";
|
|
7
|
+
export function FormInputWithButton({ label, htmlFor, buttonIcon, onButtonClick, inputRef, buttonTestId, defaultValue, ...inputProps }) {
|
|
8
|
+
const formValues = useFormValues();
|
|
9
|
+
const preservedValue = formValues[inputProps.name || htmlFor];
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (preservedValue && inputRef?.current) {
|
|
12
|
+
inputRef.current.value = preservedValue;
|
|
13
|
+
}
|
|
14
|
+
}, [preservedValue, inputRef]);
|
|
15
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsxs("div", { className: "flex", children: [_jsx(Input, { defaultValue: preservedValue || defaultValue, id: htmlFor, ref: inputRef, ...inputProps }), _jsx(Button, { "data-testid": buttonTestId, onClick: onButtonClick, type: "button", variant: "ghost", children: buttonIcon })] })] }));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=form-input-with-button.js.map
|
|
@@ -0,0 +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;AAWxD,MAAM,UAAU,mBAAmB,CAAC,EACnC,KAAK,EACL,OAAO,EACP,UAAU,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,GAAG,UAAU,EACN;IACP,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Input } from "../../ui/input";
|
|
3
|
+
type Props = {
|
|
4
|
+
label: string;
|
|
5
|
+
htmlFor: string;
|
|
6
|
+
} & ComponentProps<typeof Input>;
|
|
7
|
+
export declare function FormInput({ label, htmlFor, defaultValue, ...inputProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=form-input.d.ts.map
|
|
@@ -0,0 +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,KAAK,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAEjC,wBAAgB,SAAS,CAAC,EACzB,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,UAAU,EACb,EAAE,KAAK,2CAcP"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from "../../ui/input";
|
|
3
|
+
import { Label } from "../../ui/label";
|
|
4
|
+
import { useFormValues } from "../generic-form-wrapper";
|
|
5
|
+
export function FormInput({ label, htmlFor, defaultValue, ...inputProps }) {
|
|
6
|
+
const formValues = useFormValues();
|
|
7
|
+
const preservedValue = formValues[inputProps.name || htmlFor];
|
|
8
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsx(Input, { defaultValue: preservedValue || defaultValue, id: htmlFor, ...inputProps })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=form-input.js.map
|
|
@@ -0,0 +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;AAOxD,MAAM,UAAU,SAAS,CAAC,EACzB,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,UAAU,EACN;IACP,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Textarea } from "../../ui/textarea";
|
|
3
|
+
type Props = {
|
|
4
|
+
label: string;
|
|
5
|
+
htmlFor: string;
|
|
6
|
+
} & ComponentProps<typeof Textarea>;
|
|
7
|
+
export declare function FormTextarea({ label, htmlFor, defaultValue, ...textareaProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=form-textarea.d.ts.map
|
|
@@ -0,0 +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,KAAK,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEpC,wBAAgB,YAAY,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,aAAa,EAChB,EAAE,KAAK,2CAcP"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Label } from "../../ui/label";
|
|
3
|
+
import { Textarea } from "../../ui/textarea";
|
|
4
|
+
import { useFormValues } from "../generic-form-wrapper";
|
|
5
|
+
export function FormTextarea({ label, htmlFor, defaultValue, ...textareaProps }) {
|
|
6
|
+
const formValues = useFormValues();
|
|
7
|
+
const preservedValue = formValues[textareaProps.name || htmlFor];
|
|
8
|
+
return (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: htmlFor, children: label }), _jsx(Textarea, { defaultValue: preservedValue || defaultValue, id: htmlFor, ...textareaProps })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=form-textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-textarea.js","sourceRoot":"","sources":["../../../forms/fields/form-textarea.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,MAAM,UAAU,YAAY,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,YAAY,EACZ,GAAG,aAAa,EACT;IACP,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;IAEjE,OAAO,CACN,eAAK,SAAS,EAAC,WAAW,aACzB,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,YAAG,KAAK,GAAS,EACxC,KAAC,QAAQ,IACR,YAAY,EAAE,cAAc,IAAI,YAAY,EAC5C,EAAE,EAAE,OAAO,KACP,aAAa,GAChB,IACG,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare const useFormValues: () => Record<string, string>;
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
action: (formData: FormData) => Promise<T>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
saveLabel: string;
|
|
7
|
+
submitLabel?: string;
|
|
8
|
+
loadingLabel?: string;
|
|
9
|
+
onSubmit?: (formData: FormData) => Promise<void>;
|
|
10
|
+
preservedValues?: Record<string, string>;
|
|
11
|
+
afterSubmit: (responseMessage: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function GenericFormWrapper<T extends {
|
|
14
|
+
message: string;
|
|
15
|
+
success: boolean;
|
|
16
|
+
}>({ action, children, saveLabel, submitLabel, loadingLabel, onSubmit, preservedValues, afterSubmit, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=generic-form-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-form-wrapper.d.ts","sourceRoot":"","sources":["../../forms/generic-form-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,SAAS,EAKd,MAAM,OAAO,CAAC;AAMf,eAAO,MAAM,aAAa,8BAAsC,CAAC;AAEjE,KAAK,KAAK,CAAC,CAAC,IAAI;IACf,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,wBAAgB,kBAAkB,CACjC,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC9C,EACD,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,WAAW,GACX,EAAE,KAAK,CAAC,CAAC,CAAC,2CAkDV"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useActionState, useContext, useEffect, useState, } from "react";
|
|
4
|
+
import Loading from "../display/loading";
|
|
5
|
+
import { Button } from "../ui/button";
|
|
6
|
+
const FormValuesContext = createContext({});
|
|
7
|
+
export const useFormValues = () => useContext(FormValuesContext);
|
|
8
|
+
export function GenericFormWrapper({ action, children, saveLabel, submitLabel, loadingLabel, onSubmit, preservedValues, afterSubmit, }) {
|
|
9
|
+
const [formValues, setFormValues] = useState(preservedValues || {});
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (preservedValues) {
|
|
12
|
+
setFormValues(preservedValues);
|
|
13
|
+
}
|
|
14
|
+
}, [preservedValues]);
|
|
15
|
+
const submitForm = async (_previousState, formData) => {
|
|
16
|
+
if (onSubmit) {
|
|
17
|
+
await onSubmit(formData);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const response = await action(formData);
|
|
21
|
+
afterSubmit(response.message);
|
|
22
|
+
if (response.success) {
|
|
23
|
+
// Clear form on success
|
|
24
|
+
setFormValues({});
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
// Preserve form data on error
|
|
28
|
+
if ("formData" in response && response.formData) {
|
|
29
|
+
setFormValues(response.formData);
|
|
30
|
+
}
|
|
31
|
+
return response;
|
|
32
|
+
};
|
|
33
|
+
const [_, submitAction, isPending] = useActionState(submitForm, null);
|
|
34
|
+
return (_jsx(FormValuesContext.Provider, { value: formValues, children: _jsxs("form", { action: submitAction, className: "space-y-4 px-2 py-4", children: [isPending ? _jsx(Loading, {}) : children, _jsx(Button, { className: "w-full", disabled: isPending, type: "submit", children: isPending && loadingLabel
|
|
35
|
+
? loadingLabel
|
|
36
|
+
: submitLabel
|
|
37
|
+
? submitLabel
|
|
38
|
+
: saveLabel })] }) }));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=generic-form-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-form-wrapper.js","sourceRoot":"","sources":["../../forms/generic-form-wrapper.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EACN,aAAa,EAEb,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,GACR,MAAM,OAAO,CAAC;AACf,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,iBAAiB,GAAG,aAAa,CAAyB,EAAE,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAajE,MAAM,UAAU,kBAAkB,CAEhC,EACD,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,WAAW,GACD;IACV,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAC3C,eAAe,IAAI,EAAE,CACrB,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,eAAe,EAAE,CAAC;YACrB,aAAa,CAAC,eAAe,CAAC,CAAC;QAChC,CAAC;IACF,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,MAAM,UAAU,GAAG,KAAK,EACvB,cAAwB,EACxB,QAAkB,EACE,EAAE;QACtB,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAE9B,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,wBAAwB;YACxB,aAAa,CAAC,EAAE,CAAC,CAAC;YAClB,OAAO,QAAQ,CAAC;QACjB,CAAC;QACD,8BAA8B;QAC9B,IAAI,UAAU,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACjD,aAAa,CAAC,QAAQ,CAAC,QAAkC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAEtE,OAAO,CACN,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAC5C,gBAAM,MAAM,EAAE,YAAY,EAAE,SAAS,EAAC,qBAAqB,aACzD,SAAS,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC,CAAC,QAAQ,EACnC,KAAC,MAAM,IAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,QAAQ,YAC3D,SAAS,IAAI,YAAY;wBACzB,CAAC,CAAC,YAAY;wBACd,CAAC,CAAC,WAAW;4BACZ,CAAC,CAAC,WAAW;4BACb,CAAC,CAAC,SAAS,GACL,IACH,GACqB,CAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type UseInfiniteScrollOptions = {
|
|
2
|
+
hasNextPage: boolean;
|
|
3
|
+
isFetchingNextPage: boolean;
|
|
4
|
+
fetchNextPage: () => Promise<void>;
|
|
5
|
+
rootMargin?: string;
|
|
6
|
+
threshold?: number;
|
|
7
|
+
};
|
|
8
|
+
type UseInfiniteScrollReturn = {
|
|
9
|
+
lastElementRef: (node: HTMLElement | null) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useInfiniteScroll({ hasNextPage, isFetchingNextPage, fetchNextPage, rootMargin, threshold, }: UseInfiniteScrollOptions): UseInfiniteScrollReturn;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=use-infinite-scroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-infinite-scroll.d.ts","sourceRoot":"","sources":["../../hooks/use-infinite-scroll.ts"],"names":[],"mappings":"AAIA,KAAK,wBAAwB,GAAG;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC9B,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EACjC,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,UAAoB,EACpB,SAAe,GACf,EAAE,wBAAwB,GAAG,uBAAuB,CAuCpD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
export function useInfiniteScroll({ hasNextPage, isFetchingNextPage, fetchNextPage, rootMargin = "100px", threshold = 0.1, }) {
|
|
4
|
+
const observer = useRef(null);
|
|
5
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
6
|
+
const lastElementRef = useCallback((node) => {
|
|
7
|
+
if (isFetchingNextPage)
|
|
8
|
+
return;
|
|
9
|
+
if (observer.current)
|
|
10
|
+
observer.current.disconnect();
|
|
11
|
+
observer.current = new IntersectionObserver((entries) => {
|
|
12
|
+
if (entries[0]?.isIntersecting && hasNextPage && isInitialized) {
|
|
13
|
+
fetchNextPage();
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
rootMargin,
|
|
17
|
+
threshold,
|
|
18
|
+
});
|
|
19
|
+
if (node)
|
|
20
|
+
observer.current.observe(node);
|
|
21
|
+
}, [
|
|
22
|
+
isFetchingNextPage,
|
|
23
|
+
hasNextPage,
|
|
24
|
+
fetchNextPage,
|
|
25
|
+
rootMargin,
|
|
26
|
+
threshold,
|
|
27
|
+
isInitialized,
|
|
28
|
+
]);
|
|
29
|
+
// Initialize after first render to avoid SSR issues
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setIsInitialized(true);
|
|
32
|
+
}, []);
|
|
33
|
+
return { lastElementRef };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=use-infinite-scroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-infinite-scroll.js","sourceRoot":"","sources":["../../hooks/use-infinite-scroll.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAcjE,MAAM,UAAU,iBAAiB,CAAC,EACjC,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,UAAU,GAAG,OAAO,EACpB,SAAS,GAAG,GAAG,GACW;IAC1B,MAAM,QAAQ,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;IAC3D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,cAAc,GAAG,WAAW,CACjC,CAAC,IAAwB,EAAE,EAAE;QAC5B,IAAI,kBAAkB;YAAE,OAAO;QAC/B,IAAI,QAAQ,CAAC,OAAO;YAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAEpD,QAAQ,CAAC,OAAO,GAAG,IAAI,oBAAoB,CAC1C,CAAC,OAAO,EAAE,EAAE;YACX,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,IAAI,WAAW,IAAI,aAAa,EAAE,CAAC;gBAChE,aAAa,EAAE,CAAC;YACjB,CAAC;QACF,CAAC,EACD;YACC,UAAU;YACV,SAAS;SACT,CACD,CAAC;QAEF,IAAI,IAAI;YAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC,EACD;QACC,kBAAkB;QAClB,WAAW;QACX,aAAa;QACb,UAAU;QACV,SAAS;QACT,aAAa;KACb,CACD,CAAC;IAEF,oDAAoD;IACpD,SAAS,CAAC,GAAG,EAAE;QACd,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,cAAc,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from "./display/loading";
|
|
2
|
+
export * from "./display/status/status-code-view";
|
|
3
|
+
export * from "./forms/fields/form-dropdown-input";
|
|
4
|
+
export * from "./forms/fields/form-file-input";
|
|
5
|
+
export * from "./forms/fields/form-input";
|
|
6
|
+
export * from "./forms/fields/form-input-with-button";
|
|
7
|
+
export * from "./forms/fields/form-textarea";
|
|
8
|
+
export * from "./forms/generic-form-wrapper";
|
|
9
|
+
export * from "./hooks/use-infinite-scroll";
|
|
10
|
+
export * from "./layouts/body/viewer-body";
|
|
11
|
+
export * from "./providers/theme-provider";
|
|
12
|
+
export * from "./ui/badge";
|
|
13
|
+
export * from "./ui/button";
|
|
14
|
+
export * from "./ui/card";
|
|
15
|
+
export * from "./ui/command";
|
|
16
|
+
export * from "./ui/dialog";
|
|
17
|
+
export * from "./ui/drawer";
|
|
18
|
+
export * from "./ui/dropdown-menu";
|
|
19
|
+
export * from "./ui/input";
|
|
20
|
+
export * from "./ui/label";
|
|
21
|
+
export * from "./ui/sonner";
|
|
22
|
+
export * from "./ui/tabs";
|
|
23
|
+
export * from "./ui/textarea";
|
|
24
|
+
export * from "./utils/cn";
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAE7C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAG9B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// UI Components
|
|
2
|
+
// Display Components
|
|
3
|
+
export * from "./display/loading";
|
|
4
|
+
export * from "./display/status/status-code-view";
|
|
5
|
+
export * from "./forms/fields/form-dropdown-input";
|
|
6
|
+
export * from "./forms/fields/form-file-input";
|
|
7
|
+
export * from "./forms/fields/form-input";
|
|
8
|
+
export * from "./forms/fields/form-input-with-button";
|
|
9
|
+
export * from "./forms/fields/form-textarea";
|
|
10
|
+
// Form Components
|
|
11
|
+
export * from "./forms/generic-form-wrapper";
|
|
12
|
+
// Hooks
|
|
13
|
+
export * from "./hooks/use-infinite-scroll";
|
|
14
|
+
// Layout Components
|
|
15
|
+
export * from "./layouts/body/viewer-body";
|
|
16
|
+
// Providers
|
|
17
|
+
export * from "./providers/theme-provider";
|
|
18
|
+
export * from "./ui/badge";
|
|
19
|
+
export * from "./ui/button";
|
|
20
|
+
export * from "./ui/card";
|
|
21
|
+
export * from "./ui/command";
|
|
22
|
+
export * from "./ui/dialog";
|
|
23
|
+
export * from "./ui/drawer";
|
|
24
|
+
export * from "./ui/dropdown-menu";
|
|
25
|
+
export * from "./ui/input";
|
|
26
|
+
export * from "./ui/label";
|
|
27
|
+
export * from "./ui/sonner";
|
|
28
|
+
export * from "./ui/tabs";
|
|
29
|
+
export * from "./ui/textarea";
|
|
30
|
+
// Utilities
|
|
31
|
+
export * from "./utils/cn";
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAEhB,qBAAqB;AACrB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,kBAAkB;AAClB,cAAc,8BAA8B,CAAC;AAC7C,QAAQ;AACR,cAAc,6BAA6B,CAAC;AAC5C,oBAAoB;AACpB,cAAc,4BAA4B,CAAC;AAC3C,YAAY;AACZ,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAE9B,YAAY;AACZ,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
markdown: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function markdownToReact(markdown: string): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export declare function ViewerBodyClient({ children, markdown }: Props): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=viewer-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-body.d.ts","sourceRoot":"","sources":["../../../layouts/body/viewer-body.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,KAAK,KAAK,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,oDAsDrD;AAED,wBAAsB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,oDASnE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
|
+
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
4
|
+
import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
5
|
+
import remarkGfm from "remark-gfm";
|
|
6
|
+
export async function markdownToReact(markdown) {
|
|
7
|
+
const components = {
|
|
8
|
+
code({ className, children }) {
|
|
9
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
10
|
+
const isInline = !match;
|
|
11
|
+
return isInline ? (_jsx("code", { className: className, children: children })) : (_jsx(SyntaxHighlighter, { PreTag: "div", language: match[1], style: vscDarkPlus, children: String(children).replace(/\n$/, "") }));
|
|
12
|
+
},
|
|
13
|
+
a({ href, children }) {
|
|
14
|
+
const isExternal = href?.startsWith("http");
|
|
15
|
+
return (_jsx("a", { href: href, rel: isExternal ? "nofollow noreferrer" : undefined, target: isExternal ? "_blank" : undefined, children: children }));
|
|
16
|
+
},
|
|
17
|
+
h1: ({ children }) => {
|
|
18
|
+
const id = children
|
|
19
|
+
?.toString()
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^\w]+/g, "-");
|
|
22
|
+
return _jsx("h1", { id: id, children: children });
|
|
23
|
+
},
|
|
24
|
+
h2: ({ children }) => {
|
|
25
|
+
const id = children
|
|
26
|
+
?.toString()
|
|
27
|
+
.toLowerCase()
|
|
28
|
+
.replace(/[^\w]+/g, "-");
|
|
29
|
+
return _jsx("h2", { id: id, children: children });
|
|
30
|
+
},
|
|
31
|
+
h3: ({ children }) => {
|
|
32
|
+
const id = children
|
|
33
|
+
?.toString()
|
|
34
|
+
.toLowerCase()
|
|
35
|
+
.replace(/[^\w]+/g, "-");
|
|
36
|
+
return _jsx("h3", { id: id, children: children });
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
return (_jsx(ReactMarkdown, { components: components, remarkPlugins: [remarkGfm], children: markdown }));
|
|
40
|
+
}
|
|
41
|
+
export async function ViewerBodyClient({ children, markdown }) {
|
|
42
|
+
const content = await markdownToReact(markdown);
|
|
43
|
+
return (_jsxs("div", { className: "prose prose-sm dark:prose-invert mx-auto max-w-5xl space-y-8 px-4 py-2", children: [children, content] }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=viewer-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-body.js","sourceRoot":"","sources":["../../../layouts/body/viewer-body.tsx"],"names":[],"mappings":";AAEA,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB;IACrD,MAAM,UAAU,GAAe;QAC9B,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;YAC3B,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC;YAExB,OAAO,QAAQ,CAAC,CAAC,CAAC,CACjB,eAAM,SAAS,EAAE,SAAS,YAAG,QAAQ,GAAQ,CAC7C,CAAC,CAAC,CAAC,CACH,KAAC,iBAAiB,IAAC,MAAM,EAAC,KAAK,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,YACpE,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GACjB,CACpB,CAAC;QACH,CAAC;QACD,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;YACnB,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YAC5C,OAAO,CACN,YACC,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACnD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAExC,QAAQ,GACN,CACJ,CAAC;QACH,CAAC;QACD,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;YACpB,MAAM,EAAE,GAAG,QAAQ;gBAClB,EAAE,QAAQ,EAAE;iBACX,WAAW,EAAE;iBACb,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAC1B,OAAO,aAAI,EAAE,EAAE,EAAE,YAAG,QAAQ,GAAM,CAAC;QACpC,CAAC;QACD,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;YACpB,MAAM,EAAE,GAAG,QAAQ;gBAClB,EAAE,QAAQ,EAAE;iBACX,WAAW,EAAE;iBACb,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAC1B,OAAO,aAAI,EAAE,EAAE,EAAE,YAAG,QAAQ,GAAM,CAAC;QACpC,CAAC;QACD,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;YACpB,MAAM,EAAE,GAAG,QAAQ;gBAClB,EAAE,QAAQ,EAAE;iBACX,WAAW,EAAE;iBACb,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAC1B,OAAO,aAAI,EAAE,EAAE,EAAE,YAAG,QAAQ,GAAM,CAAC;QACpC,CAAC;KACD,CAAC;IAEF,OAAO,CACN,KAAC,aAAa,IAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,SAAS,CAAC,YAC/D,QAAQ,GACM,CAChB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAS;IACnE,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO,CACN,eAAK,SAAS,EAAC,wEAAwE,aACrF,QAAQ,EACR,OAAO,IACH,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export declare function ThemeProvider({ children, ...props }: React.ComponentProps<typeof NextThemesProvider>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=theme-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../providers/theme-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,wBAAgB,aAAa,CAAC,EAC7B,QAAQ,EACR,GAAG,KAAK,EACR,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,kBAAkB,CAAC,2CAEjD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
4
|
+
export function ThemeProvider({ children, ...props }) {
|
|
5
|
+
return _jsx(NextThemesProvider, { ...props, children: children });
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=theme-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-provider.js","sourceRoot":"","sources":["../../providers/theme-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGlE,MAAM,UAAU,aAAa,CAAC,EAC7B,QAAQ,EACR,GAAG,KAAK,EACyC;IACjD,OAAO,KAAC,kBAAkB,OAAK,KAAK,YAAG,QAAQ,GAAsB,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
declare const config: {
|
|
2
|
+
content: string[];
|
|
3
|
+
prefix: string;
|
|
4
|
+
theme: {
|
|
5
|
+
container: {
|
|
6
|
+
center: boolean;
|
|
7
|
+
padding: string;
|
|
8
|
+
screens: {
|
|
9
|
+
"2xl": string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
extend: {
|
|
13
|
+
typography: () => {
|
|
14
|
+
DEFAULT: {
|
|
15
|
+
css: {
|
|
16
|
+
a: {
|
|
17
|
+
wordBreak: string;
|
|
18
|
+
overflowWrap: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
colors: {
|
|
24
|
+
background: string;
|
|
25
|
+
foreground: string;
|
|
26
|
+
primary: {
|
|
27
|
+
DEFAULT: string;
|
|
28
|
+
grad: string;
|
|
29
|
+
foreground: string;
|
|
30
|
+
};
|
|
31
|
+
destructive: {
|
|
32
|
+
DEFAULT: string;
|
|
33
|
+
};
|
|
34
|
+
muted: {
|
|
35
|
+
DEFAULT: string;
|
|
36
|
+
foreground: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
borderRadius: {
|
|
40
|
+
lg: string;
|
|
41
|
+
md: string;
|
|
42
|
+
sm: string;
|
|
43
|
+
};
|
|
44
|
+
keyframes: {
|
|
45
|
+
"accordion-down": {
|
|
46
|
+
from: {
|
|
47
|
+
height: string;
|
|
48
|
+
};
|
|
49
|
+
to: {
|
|
50
|
+
height: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
"accordion-up": {
|
|
54
|
+
from: {
|
|
55
|
+
height: string;
|
|
56
|
+
};
|
|
57
|
+
to: {
|
|
58
|
+
height: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
"bg-position": {
|
|
62
|
+
"0%": {
|
|
63
|
+
backgroundPosition: string;
|
|
64
|
+
};
|
|
65
|
+
"100%": {
|
|
66
|
+
backgroundPosition: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
animation: {
|
|
71
|
+
"accordion-down": string;
|
|
72
|
+
"accordion-up": string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export default config;
|
|
78
|
+
//# sourceMappingURL=tailwind.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.config.d.ts","sourceRoot":"","sources":["../tailwind.config.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEM,CAAC;AAEnB,eAAe,MAAM,CAAC"}
|