@taicode/common-web 3.7.0 → 3.7.5
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/output/components/form.d.ts +26 -0
- package/output/components/form.d.ts.map +1 -0
- package/output/components/form.js +69 -0
- package/output/components/index.d.ts +1 -0
- package/output/components/index.d.ts.map +1 -1
- package/output/components/index.js +1 -0
- package/output/features/signin/index.d.ts.map +1 -1
- package/output/features/signin/index.js +4 -2
- package/package.json +2 -2
- package/styles.css +2 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { Label as LabelPrimitive } from 'radix-ui';
|
|
3
|
+
import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form';
|
|
4
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
6
|
+
declare const useFormField: () => {
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
isDirty: boolean;
|
|
9
|
+
isTouched: boolean;
|
|
10
|
+
isValidating: boolean;
|
|
11
|
+
error?: import("react-hook-form").FieldError | undefined;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
formItemId: string;
|
|
15
|
+
formDescriptionId: string;
|
|
16
|
+
formMessageId: string;
|
|
17
|
+
};
|
|
18
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
20
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement> & {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
} & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
23
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
24
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
25
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
|
|
26
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../source/components/form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,KAAK,IAAI,cAAc,EAAyB,MAAM,UAAU,CAAA;AACzE,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAA;AAKxB,QAAA,MAAM,IAAI,8ZAAe,CAAA;AAWzB,QAAA,MAAM,SAAS,GACb,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,OAAO,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,sBAI5C,CAAA;AAQD,QAAA,MAAM,YAAY;;;;;;;;;;;CAuBjB,CAAA;AAED,QAAA,MAAM,QAAQ,6GAUb,CAAA;AAGD,QAAA,MAAM,SAAS,yJAcb,CAAA;AAGF,QAAA,MAAM,WAAW;;gFAef,CAAA;AAGF,QAAA,MAAM,eAAe,yHAapB,CAAA;AAGD,QAAA,MAAM,WAAW,yHAkBhB,CAAA;AAGD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,GACb,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { createContext, forwardRef, useContext, useId } from 'react';
|
|
14
|
+
import { Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';
|
|
15
|
+
import { Controller, FormProvider, useFormContext, } from 'react-hook-form';
|
|
16
|
+
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
17
|
+
import { Label } from './label.js';
|
|
18
|
+
const Form = FormProvider;
|
|
19
|
+
const FormFieldContext = createContext(null);
|
|
20
|
+
const FormField = (props) => (_jsx(FormFieldContext.Provider, { value: { name: props.name }, children: _jsx(Controller, Object.assign({}, props)) }));
|
|
21
|
+
const FormItemContext = createContext(null);
|
|
22
|
+
const useFormField = () => {
|
|
23
|
+
const fieldContext = useContext(FormFieldContext);
|
|
24
|
+
const itemContext = useContext(FormItemContext);
|
|
25
|
+
const { getFieldState, formState } = useFormContext();
|
|
26
|
+
if (!fieldContext) {
|
|
27
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
28
|
+
}
|
|
29
|
+
if (!itemContext) {
|
|
30
|
+
throw new Error('useFormField should be used within <FormItem>');
|
|
31
|
+
}
|
|
32
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
33
|
+
const { id } = itemContext;
|
|
34
|
+
return Object.assign({ id, name: fieldContext.name, formItemId: `${id}-form-item`, formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message` }, fieldState);
|
|
35
|
+
};
|
|
36
|
+
const FormItem = forwardRef((_a, ref) => {
|
|
37
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
38
|
+
const id = useId();
|
|
39
|
+
return (_jsx(FormItemContext.Provider, { value: { id }, children: _jsx("div", Object.assign({ ref: ref, className: mergeClassNames('space-y-2', className) }, props)) }));
|
|
40
|
+
});
|
|
41
|
+
FormItem.displayName = 'FormItem';
|
|
42
|
+
const FormLabel = forwardRef((_a, ref) => {
|
|
43
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
44
|
+
const { error, formItemId } = useFormField();
|
|
45
|
+
return (_jsx(Label, Object.assign({ ref: ref, className: mergeClassNames(error && 'text-destructive', className), htmlFor: formItemId }, props)));
|
|
46
|
+
});
|
|
47
|
+
FormLabel.displayName = 'FormLabel';
|
|
48
|
+
const FormControl = forwardRef((props, ref) => {
|
|
49
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
50
|
+
return (_jsx(SlotPrimitive.Slot, Object.assign({ ref: ref, id: formItemId, "aria-describedby": error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId, "aria-invalid": Boolean(error) }, props)));
|
|
51
|
+
});
|
|
52
|
+
FormControl.displayName = 'FormControl';
|
|
53
|
+
const FormDescription = forwardRef((_a, ref) => {
|
|
54
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
55
|
+
const { formDescriptionId } = useFormField();
|
|
56
|
+
return (_jsx("p", Object.assign({ ref: ref, id: formDescriptionId, className: mergeClassNames('text-sm text-muted-foreground', className) }, props)));
|
|
57
|
+
});
|
|
58
|
+
FormDescription.displayName = 'FormDescription';
|
|
59
|
+
const FormMessage = forwardRef((_a, ref) => {
|
|
60
|
+
var _b;
|
|
61
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
62
|
+
const { error, formMessageId } = useFormField();
|
|
63
|
+
const body = error ? String((_b = error.message) !== null && _b !== void 0 ? _b : '') : children;
|
|
64
|
+
if (!body)
|
|
65
|
+
return null;
|
|
66
|
+
return (_jsx("p", Object.assign({ ref: ref, id: formMessageId, className: mergeClassNames('text-sm font-medium text-destructive', className) }, props, { children: body })));
|
|
67
|
+
});
|
|
68
|
+
FormMessage.displayName = 'FormMessage';
|
|
69
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,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BAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,cAAc;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/features/signin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAY3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAI3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc;IACd,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,cAAc;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAkXD;;;GAGG;AACH,UAAU,yBAAyB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,yBAAyB;IACzB,IAAI,EAAE,SAAS,CAAA;IACf,mBAAmB;IACnB,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAC1B;AAED,eAAO,MAAM,oBAAoB,WAAoB,yBAAyB;;CAmC5E,CAAA"}
|
|
@@ -50,7 +50,9 @@ const Button = (_a) => {
|
|
|
50
50
|
return (_jsx("button", Object.assign({ className: `${baseStyles} ${variantStyles} ${className}` }, props, { children: children })));
|
|
51
51
|
};
|
|
52
52
|
const SigninDialog = observer((props) => {
|
|
53
|
+
var _a;
|
|
53
54
|
const { service, texts } = props;
|
|
55
|
+
const title = (_a = texts[`${service.dialogStatus}Title`]) !== null && _a !== void 0 ? _a : texts.waitingTitle;
|
|
54
56
|
// 禁止关闭弹窗,防止用户误操作
|
|
55
57
|
const preventClose = () => {
|
|
56
58
|
// 不执行任何操作,阻止关闭
|
|
@@ -92,7 +94,7 @@ const SigninDialog = observer((props) => {
|
|
|
92
94
|
/**
|
|
93
95
|
* Waiting 状态 - 等待用户登录
|
|
94
96
|
*/
|
|
95
|
-
const WaitingState = () => (_jsxs(motion.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.9 }, transition: { duration: 0.2 }, className: "flex flex-col items-center gap-4", children: [_jsxs("div", { className: "relative mb-2", children: [_jsx(motion.div, { className: "size-16 rounded-full border-4 border-emerald-200 dark:border-emerald-900", animate: { scale: [1, 1.1, 1] }, transition: { duration: 2, repeat: Infinity } }), _jsx(motion.div, { className: "absolute inset-0
|
|
97
|
+
const WaitingState = () => (_jsxs(motion.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.9 }, transition: { duration: 0.2 }, className: "flex flex-col items-center gap-4", children: [_jsxs("div", { className: "relative mb-2 size-16", children: [_jsx(motion.div, { className: "size-16 rounded-full border-4 border-emerald-200 dark:border-emerald-900", animate: { scale: [1, 1.1, 1] }, transition: { duration: 2, repeat: Infinity } }), _jsx(motion.div, { className: "absolute inset-0 rounded-full border-4 border-emerald-400", animate: { scale: [1, 1.3, 1], opacity: [0.75, 0, 0.75] }, transition: { duration: 2, repeat: Infinity } }), _jsx(motion.svg, { className: "absolute left-1/2 top-1/2 size-8 -translate-x-1/2 -translate-y-1/2 text-emerald-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", initial: { scale: 0 }, animate: { scale: 1 }, transition: { delay: 0.1 }, children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })] }), _jsx("p", { className: "text-base font-semibold text-[var(--foreground)]", children: texts.waitingDescription }), _jsx("p", { className: "text-xs text-[var(--muted-foreground)]", children: texts.waitingHint }), _jsxs("div", { className: "mt-2 flex gap-2", children: [_jsx(Button, { variant: "primary", onClick: handleReopenWindow, children: texts.reopenButton }), _jsx(Button, { variant: "outline", onClick: handleCancel, children: texts.cancelButton })] })] }, "waiting"));
|
|
96
98
|
/**
|
|
97
99
|
* Success 状态 - 登录成功
|
|
98
100
|
*/
|
|
@@ -109,7 +111,7 @@ const SigninDialog = observer((props) => {
|
|
|
109
111
|
* Expired 状态 - 票据过期
|
|
110
112
|
*/
|
|
111
113
|
const ExpiredState = () => (_jsxs(motion.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.9 }, transition: { duration: 0.2 }, className: "flex flex-col items-center gap-4", children: [_jsx(motion.div, { className: "mb-2", initial: { scale: 0 }, animate: { scale: 1 }, transition: { delay: 0.1, type: 'spring' }, children: _jsx(ClockIcon, { className: "size-16 text-orange-600 dark:text-orange-400" }) }), _jsx("p", { className: "text-base font-semibold text-[var(--muted-foreground)]", children: texts.expiredDescription }), _jsxs("div", { className: "mt-2 flex gap-2", children: [_jsx(Button, { variant: "primary", onClick: handleRetry, children: texts.retryButton }), _jsx(Button, { variant: "outline", onClick: handleClose, children: texts.closeButton })] })] }, "expired"));
|
|
112
|
-
return (_jsx(DialogPrimitive.Root, { open: service.isDialogOpen, onOpenChange: (open) => !open && preventClose(), children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
|
|
114
|
+
return (_jsx(DialogPrimitive.Root, { open: service.isDialogOpen, onOpenChange: (open) => !open && preventClose(), children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }), _jsxs(DialogPrimitive.Content, { "aria-describedby": undefined, className: "fixed left-[50%] top-[50%] z-50 w-[calc(100%-2rem)] max-w-md translate-x-[-50%] translate-y-[-50%] rounded-[var(--radius)] border border-[var(--border)] bg-[var(--background)] p-6 text-[var(--foreground)] shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: title }), _jsx("div", { className: "flex flex-col items-center justify-center py-8", children: _jsxs(AnimatePresence, { mode: "wait", children: [service.dialogStatus === 'opening' && _jsx(OpeningState, {}), service.dialogStatus === 'waiting' && _jsx(WaitingState, {}), service.dialogStatus === 'success' && _jsx(SuccessState, {}), service.dialogStatus === 'error' && _jsx(ErrorState, {}), service.dialogStatus === 'cancelled' && _jsx(CancelledState, {}), service.dialogStatus === 'expired' && _jsx(ExpiredState, {})] }) })] })] }) }));
|
|
113
115
|
});
|
|
114
116
|
export const SigninDialogProvider = observer((props) => {
|
|
115
117
|
const { children, apis: apiConfig, texts: customTexts } = props;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taicode/common-web",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5",
|
|
4
4
|
"author": "Alain",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@heroicons/react": "^2.2.0",
|
|
61
61
|
"@needle-di/core": ">=1.0.0",
|
|
62
|
-
"@taicode/common-base": "
|
|
62
|
+
"@taicode/common-base": "workspace:^",
|
|
63
63
|
"@types/react": ">=18",
|
|
64
64
|
"mobx": ">=6",
|
|
65
65
|
"mobx-react-lite": "^4.1.1",
|