@lobehub/ui 5.19.3 → 5.20.1
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/es/Markdown/SyntaxMarkdown/CachedMarkdown.mjs +3 -2
- package/es/Markdown/SyntaxMarkdown/CachedMarkdown.mjs.map +1 -1
- package/es/Markdown/plugins/rehypeStreamAnimated.mjs.map +1 -1
- package/es/ThemeProvider/GlobalStyle/global.mjs +3 -2
- package/es/ThemeProvider/GlobalStyle/global.mjs.map +1 -1
- package/es/ThemeProvider/ThemeProvider.mjs +1 -1
- package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
- package/es/base-ui/AutoComplete/AutoComplete.d.mts +8 -0
- package/es/base-ui/AutoComplete/AutoComplete.mjs +91 -0
- package/es/base-ui/AutoComplete/AutoComplete.mjs.map +1 -0
- package/es/base-ui/AutoComplete/index.d.mts +3 -0
- package/es/base-ui/AutoComplete/style.d.mts +12 -0
- package/es/base-ui/AutoComplete/style.mjs +76 -0
- package/es/base-ui/AutoComplete/style.mjs.map +1 -0
- package/es/base-ui/AutoComplete/type.d.mts +40 -0
- package/es/base-ui/Button/style.mjs +6 -3
- package/es/base-ui/Button/style.mjs.map +1 -1
- package/es/base-ui/Checkbox/Checkbox.d.mts +8 -0
- package/es/base-ui/Checkbox/Checkbox.mjs +61 -0
- package/es/base-ui/Checkbox/Checkbox.mjs.map +1 -0
- package/es/base-ui/Checkbox/CheckboxGroup.d.mts +8 -0
- package/es/base-ui/Checkbox/CheckboxGroup.mjs +37 -0
- package/es/base-ui/Checkbox/CheckboxGroup.mjs.map +1 -0
- package/es/base-ui/Checkbox/index.d.mts +4 -0
- package/es/base-ui/Checkbox/style.d.mts +9 -0
- package/es/base-ui/Checkbox/style.mjs +70 -0
- package/es/base-ui/Checkbox/style.mjs.map +1 -0
- package/es/base-ui/Checkbox/type.d.mts +51 -0
- package/es/base-ui/Form/Form.mjs +155 -0
- package/es/base-ui/Form/Form.mjs.map +1 -0
- package/es/base-ui/Form/components/FormDivider.d.mts +8 -0
- package/es/base-ui/Form/components/FormDivider.mjs +19 -0
- package/es/base-ui/Form/components/FormDivider.mjs.map +1 -0
- package/es/base-ui/Form/components/FormField.d.mts +8 -0
- package/es/base-ui/Form/components/FormField.mjs +59 -0
- package/es/base-ui/Form/components/FormField.mjs.map +1 -0
- package/es/base-ui/Form/components/FormFlatGroup.d.mts +8 -0
- package/es/base-ui/Form/components/FormFlatGroup.mjs +20 -0
- package/es/base-ui/Form/components/FormFlatGroup.mjs.map +1 -0
- package/es/base-ui/Form/components/FormFooter.d.mts +8 -0
- package/es/base-ui/Form/components/FormFooter.mjs +20 -0
- package/es/base-ui/Form/components/FormFooter.mjs.map +1 -0
- package/es/base-ui/Form/components/FormGroup.d.mts +8 -0
- package/es/base-ui/Form/components/FormGroup.mjs +87 -0
- package/es/base-ui/Form/components/FormGroup.mjs.map +1 -0
- package/es/base-ui/Form/components/FormSubmitFooter.d.mts +8 -0
- package/es/base-ui/Form/components/FormSubmitFooter.mjs +118 -0
- package/es/base-ui/Form/components/FormSubmitFooter.mjs.map +1 -0
- package/es/base-ui/Form/components/FormTitle.d.mts +8 -0
- package/es/base-ui/Form/components/FormTitle.mjs +42 -0
- package/es/base-ui/Form/components/FormTitle.mjs.map +1 -0
- package/es/base-ui/Form/context.d.mts +6 -0
- package/es/base-ui/Form/context.mjs +15 -0
- package/es/base-ui/Form/context.mjs.map +1 -0
- package/es/base-ui/Form/index.d.mts +25 -0
- package/es/base-ui/Form/index.mjs +24 -0
- package/es/base-ui/Form/index.mjs.map +1 -0
- package/es/base-ui/Form/style.mjs +288 -0
- package/es/base-ui/Form/style.mjs.map +1 -0
- package/es/base-ui/Form/type.d.mts +139 -0
- package/es/base-ui/Input/Input.d.mts +8 -0
- package/es/base-ui/Input/Input.mjs +43 -0
- package/es/base-ui/Input/Input.mjs.map +1 -0
- package/es/base-ui/Input/InputNumber.d.mts +8 -0
- package/es/base-ui/Input/InputNumber.mjs +50 -0
- package/es/base-ui/Input/InputNumber.mjs.map +1 -0
- package/es/base-ui/Input/InputOTP.d.mts +8 -0
- package/es/base-ui/Input/InputOTP.mjs +31 -0
- package/es/base-ui/Input/InputOTP.mjs.map +1 -0
- package/es/base-ui/Input/InputPassword.d.mts +8 -0
- package/es/base-ui/Input/InputPassword.mjs +31 -0
- package/es/base-ui/Input/InputPassword.mjs.map +1 -0
- package/es/base-ui/Input/TextArea.d.mts +8 -0
- package/es/base-ui/Input/TextArea.mjs +43 -0
- package/es/base-ui/Input/TextArea.mjs.map +1 -0
- package/es/base-ui/Input/index.d.mts +7 -0
- package/es/base-ui/Input/style.d.mts +33 -0
- package/es/base-ui/Input/style.mjs +230 -0
- package/es/base-ui/Input/style.mjs.map +1 -0
- package/es/base-ui/Input/type.d.mts +122 -0
- package/es/base-ui/Select/style.mjs +4 -3
- package/es/base-ui/Select/style.mjs.map +1 -1
- package/es/base-ui/Slider/Slider.d.mts +8 -0
- package/es/base-ui/Slider/Slider.mjs +34 -0
- package/es/base-ui/Slider/Slider.mjs.map +1 -0
- package/es/base-ui/Slider/SliderWithInput.d.mts +8 -0
- package/es/base-ui/Slider/SliderWithInput.mjs +64 -0
- package/es/base-ui/Slider/SliderWithInput.mjs.map +1 -0
- package/es/base-ui/Slider/index.d.mts +4 -0
- package/es/base-ui/Slider/style.d.mts +11 -0
- package/es/base-ui/Slider/style.mjs +69 -0
- package/es/base-ui/Slider/style.mjs.map +1 -0
- package/es/base-ui/Slider/type.d.mts +47 -0
- package/es/base-ui/controlSize.d.mts +10 -0
- package/es/base-ui/controlSize.mjs +10 -0
- package/es/base-ui/controlSize.mjs.map +1 -0
- package/es/base-ui/index.d.mts +33 -4
- package/es/base-ui/index.mjs +28 -4
- package/es/eslint/index.mjs +25 -15
- package/es/eslint/index.mjs.map +1 -1
- package/es/node_modules/@types/hast/index.d.mts +642 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormGroup.mjs","names":[],"sources":["../../../../src/base-ui/Form/components/FormGroup.tsx"],"sourcesContent":["'use client';\n\nimport { Collapsible } from '@base-ui/react/collapsible';\nimport { cx, useResponsive } from 'antd-style';\nimport { ChevronDown } from 'lucide-react';\nimport { memo, type ReactNode } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { groupStyles, groupVariants } from '../style';\nimport type { FormGroupProps } from '../type';\n\nconst GroupTitle = memo<{\n desc?: ReactNode;\n icon?: FormGroupProps['icon'];\n mobile?: boolean;\n title?: ReactNode;\n variant?: FormGroupProps['variant'];\n}>(({ icon, title, desc, variant, mobile }) => (\n <div\n className={cx(\n groupStyles.title,\n variant === 'borderless' && !mobile && groupStyles.titleBorderless,\n mobile && groupStyles.mobileTitle,\n )}\n >\n {icon && <Icon icon={icon} />}\n <div>\n {title}\n {desc && <div className={groupStyles.desc}>{desc}</div>}\n </div>\n </div>\n));\n\nGroupTitle.displayName = 'GroupTitle';\n\nconst FormGroup = memo<FormGroupProps>(\n ({\n className,\n icon,\n title,\n children,\n extra,\n variant = 'borderless',\n defaultActive = true,\n collapsible,\n active,\n onCollapse,\n desc,\n keyValue: _keyValue,\n ...rest\n }) => {\n const { mobile } = useResponsive();\n const isBorderless = variant === 'borderless';\n const isCollapsible = collapsible === undefined ? !isBorderless : collapsible;\n\n if (mobile)\n return (\n <div className={className} {...rest}>\n <div className={cx(groupStyles.header, groupStyles.mobileHeader)}>\n <GroupTitle mobile desc={desc} icon={icon} title={title} />\n {extra}\n </div>\n <div className={groupStyles.mobileBody}>{children}</div>\n </div>\n );\n\n if (!isCollapsible)\n return (\n <div className={cx(groupVariants({ variant }), className)} {...rest}>\n {title && (\n <div\n className={cx(\n groupStyles.header,\n isBorderless ? groupStyles.headerBorderless : groupStyles.headerBoxed,\n )}\n >\n <GroupTitle desc={desc} icon={icon} title={title} variant={variant} />\n {extra}\n </div>\n )}\n <div className={cx(groupStyles.body, !isBorderless && groupStyles.bodyBoxed)}>\n {children}\n </div>\n </div>\n );\n\n return (\n <Collapsible.Root\n className={cx(groupVariants({ variant }), className)}\n defaultOpen={defaultActive}\n open={active}\n onOpenChange={onCollapse}\n {...rest}\n >\n <div\n className={cx(\n groupStyles.header,\n isBorderless ? groupStyles.headerBorderless : groupStyles.headerBoxed,\n )}\n >\n <Collapsible.Trigger className={groupStyles.trigger}>\n <GroupTitle desc={desc} icon={icon} title={title} variant={variant} />\n <Icon className={groupStyles.chevron} icon={ChevronDown} />\n </Collapsible.Trigger>\n {extra}\n </div>\n <Collapsible.Panel className={groupStyles.panel}>\n <div className={cx(groupStyles.body, !isBorderless && groupStyles.bodyBoxed)}>\n {children}\n </div>\n </Collapsible.Panel>\n </Collapsible.Root>\n );\n },\n);\n\nFormGroup.displayName = 'FormGroup';\n\nexport default FormGroup;\n"],"mappings":";;;;;;;;;AAYA,MAAM,aAAa,MAMf,EAAE,MAAM,OAAO,MAAM,SAAS,aAChC,qBAAC,OAAD;CACE,WAAW,GACT,YAAY,OACZ,YAAY,gBAAgB,CAAC,UAAU,YAAY,iBACnD,UAAU,YAAY,YACvB;WALH,CAOG,QAAQ,oBAAC,MAAD,EAAY,MAAQ,CAAA,EAC7B,qBAAC,OAAD,EAAA,UAAA,CACG,OACA,QAAQ,oBAAC,OAAD;EAAK,WAAW,YAAY;YAAO;EAAW,CAAA,CACnD,EAAA,CAAA,CACF;GACN;AAEF,WAAW,cAAc;AAEzB,MAAM,YAAY,MACf,EACC,WACA,MACA,OACA,UACA,OACA,UAAU,cACV,gBAAgB,MAChB,aACA,QACA,YACA,MACA,UAAU,WACV,GAAG,WACC;CACJ,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,eAAe,YAAY;CACjC,MAAM,gBAAgB,gBAAgB,KAAA,IAAY,CAAC,eAAe;AAElE,KAAI,OACF,QACE,qBAAC,OAAD;EAAgB;EAAW,GAAI;YAA/B,CACE,qBAAC,OAAD;GAAK,WAAW,GAAG,YAAY,QAAQ,YAAY,aAAa;aAAhE,CACE,oBAAC,YAAD;IAAY,QAAA;IAAa;IAAY;IAAa;IAAS,CAAA,EAC1D,MACG;MACN,oBAAC,OAAD;GAAK,WAAW,YAAY;GAAa;GAAe,CAAA,CACpD;;AAGV,KAAI,CAAC,cACH,QACE,qBAAC,OAAD;EAAK,WAAW,GAAG,cAAc,EAAE,SAAS,CAAC,EAAE,UAAU;EAAE,GAAI;YAA/D,CACG,SACC,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,QACZ,eAAe,YAAY,mBAAmB,YAAY,YAC3D;aAJH,CAME,oBAAC,YAAD;IAAkB;IAAY;IAAa;IAAgB;IAAW,CAAA,EACrE,MACG;MAER,oBAAC,OAAD;GAAK,WAAW,GAAG,YAAY,MAAM,CAAC,gBAAgB,YAAY,UAAU;GACzE;GACG,CAAA,CACF;;AAGV,QACE,qBAAC,YAAY,MAAb;EACE,WAAW,GAAG,cAAc,EAAE,SAAS,CAAC,EAAE,UAAU;EACpD,aAAa;EACb,MAAM;EACN,cAAc;EACd,GAAI;YALN,CAOE,qBAAC,OAAD;GACE,WAAW,GACT,YAAY,QACZ,eAAe,YAAY,mBAAmB,YAAY,YAC3D;aAJH,CAME,qBAAC,YAAY,SAAb;IAAqB,WAAW,YAAY;cAA5C,CACE,oBAAC,YAAD;KAAkB;KAAY;KAAa;KAAgB;KAAW,CAAA,EACtE,oBAAC,MAAD;KAAM,WAAW,YAAY;KAAS,MAAM;KAAe,CAAA,CACvC;OACrB,MACG;MACN,oBAAC,YAAY,OAAb;GAAmB,WAAW,YAAY;aACxC,oBAAC,OAAD;IAAK,WAAW,GAAG,YAAY,MAAM,CAAC,gBAAgB,YAAY,UAAU;IACzE;IACG,CAAA;GACY,CAAA,CACH;;EAGxB;AAED,UAAU,cAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormSubmitFooterProps } from "../type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Form/components/FormSubmitFooter.d.ts
|
|
5
|
+
declare const FormSubmitFooter: _$react.NamedExoticComponent<FormSubmitFooterProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { FormSubmitFooter };
|
|
8
|
+
//# sourceMappingURL=FormSubmitFooter.d.mts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMotionComponent } from "../../../MotionProvider/index.mjs";
|
|
3
|
+
import FlexBasic_default from "../../../Flex/FlexBasic.mjs";
|
|
4
|
+
import Icon from "../../../Icon/Icon.mjs";
|
|
5
|
+
import { useTranslation } from "../../../i18n/useTranslation.mjs";
|
|
6
|
+
import form_default from "../../../i18n/resources/en/form.mjs";
|
|
7
|
+
import Button from "../../Button/Button.mjs";
|
|
8
|
+
import { submitFooterStyles } from "../style.mjs";
|
|
9
|
+
import { useFormContext } from "../context.mjs";
|
|
10
|
+
import { memo, useEffect } from "react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { cssVar, cx } from "antd-style";
|
|
13
|
+
import { InfoIcon } from "lucide-react";
|
|
14
|
+
//#region src/base-ui/Form/components/FormSubmitFooter.tsx
|
|
15
|
+
const FormSubmitFooter = memo(({ enableReset = true, buttonProps, float, onReset, saveButtonProps, resetButtonProps, enableUnsavedWarning, children, texts, className, ...rest }) => {
|
|
16
|
+
const Motion = useMotionComponent();
|
|
17
|
+
const { hasUnsavedChanges, requestReset, submitLoading } = useFormContext();
|
|
18
|
+
const { t } = useTranslation(form_default);
|
|
19
|
+
const unsavedWarningText = texts?.unSavedWarning ?? t("form.unsavedWarning");
|
|
20
|
+
const unsavedText = texts?.unSaved ?? t("form.unsavedChanges");
|
|
21
|
+
const resetText = texts?.reset ?? t("form.reset");
|
|
22
|
+
const submitText = texts?.submit ?? t("form.submit");
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!enableUnsavedWarning || typeof window === "undefined" || !hasUnsavedChanges) return;
|
|
25
|
+
const fn = (e) => {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
e.returnValue = unsavedWarningText;
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener("beforeunload", fn);
|
|
30
|
+
return () => window.removeEventListener("beforeunload", fn);
|
|
31
|
+
}, [
|
|
32
|
+
enableUnsavedWarning,
|
|
33
|
+
hasUnsavedChanges,
|
|
34
|
+
unsavedWarningText
|
|
35
|
+
]);
|
|
36
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
37
|
+
(float || hasUnsavedChanges) && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
38
|
+
color: cssVar.colorTextDescription,
|
|
39
|
+
icon: InfoIcon,
|
|
40
|
+
size: 12,
|
|
41
|
+
style: { marginLeft: 8 }
|
|
42
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
43
|
+
style: {
|
|
44
|
+
color: cssVar.colorTextDescription,
|
|
45
|
+
flex: "none",
|
|
46
|
+
fontSize: 12,
|
|
47
|
+
marginRight: float ? 16 : 4
|
|
48
|
+
},
|
|
49
|
+
children: unsavedText
|
|
50
|
+
})] }),
|
|
51
|
+
children,
|
|
52
|
+
enableReset && (float || hasUnsavedChanges) && /* @__PURE__ */ jsx(Button, {
|
|
53
|
+
htmlType: "button",
|
|
54
|
+
shape: float ? "round" : void 0,
|
|
55
|
+
type: "fill",
|
|
56
|
+
onClick: () => {
|
|
57
|
+
requestReset();
|
|
58
|
+
onReset?.();
|
|
59
|
+
},
|
|
60
|
+
...buttonProps,
|
|
61
|
+
...resetButtonProps,
|
|
62
|
+
children: resetText
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx(Button, {
|
|
65
|
+
htmlType: "submit",
|
|
66
|
+
loading: submitLoading,
|
|
67
|
+
shape: float ? "round" : void 0,
|
|
68
|
+
type: "primary",
|
|
69
|
+
...buttonProps,
|
|
70
|
+
...saveButtonProps,
|
|
71
|
+
children: submitText
|
|
72
|
+
})
|
|
73
|
+
] });
|
|
74
|
+
if (!float) return /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
75
|
+
horizontal: true,
|
|
76
|
+
align: "center",
|
|
77
|
+
className: cx(submitFooterStyles.footer, className),
|
|
78
|
+
gap: 8,
|
|
79
|
+
justify: "flex-end",
|
|
80
|
+
...rest,
|
|
81
|
+
children: content
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ jsx(Motion.div, {
|
|
84
|
+
animate: hasUnsavedChanges ? "visible" : "hidden",
|
|
85
|
+
className: submitFooterStyles.floatFooter,
|
|
86
|
+
initial: "hidden",
|
|
87
|
+
transition: {
|
|
88
|
+
duration: .1,
|
|
89
|
+
ease: "easeOut"
|
|
90
|
+
},
|
|
91
|
+
variants: {
|
|
92
|
+
hidden: {
|
|
93
|
+
opacity: 0,
|
|
94
|
+
x: "-50%",
|
|
95
|
+
y: 20
|
|
96
|
+
},
|
|
97
|
+
visible: {
|
|
98
|
+
opacity: 1,
|
|
99
|
+
x: "-50%",
|
|
100
|
+
y: 0
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
children: /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
104
|
+
horizontal: true,
|
|
105
|
+
align: "center",
|
|
106
|
+
className,
|
|
107
|
+
gap: 8,
|
|
108
|
+
justify: "center",
|
|
109
|
+
...rest,
|
|
110
|
+
children: content
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
FormSubmitFooter.displayName = "FormSubmitFooter";
|
|
115
|
+
//#endregion
|
|
116
|
+
export { FormSubmitFooter as default };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=FormSubmitFooter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSubmitFooter.mjs","names":["formMessages","Flexbox","styles"],"sources":["../../../../src/base-ui/Form/components/FormSubmitFooter.tsx"],"sourcesContent":["'use client';\n\nimport { cssVar, cx } from 'antd-style';\nimport { InfoIcon } from 'lucide-react';\nimport { memo, useEffect } from 'react';\n\nimport Button from '@/base-ui/Button';\nimport { Flexbox } from '@/Flex';\nimport formMessages from '@/i18n/resources/en/form';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { useFormContext } from '../context';\nimport { submitFooterStyles as styles } from '../style';\nimport type { FormSubmitFooterProps } from '../type';\n\nconst FormSubmitFooter = memo<FormSubmitFooterProps>(\n ({\n enableReset = true,\n buttonProps,\n float,\n onReset,\n saveButtonProps,\n resetButtonProps,\n enableUnsavedWarning,\n children,\n texts,\n className,\n ...rest\n }) => {\n const Motion = useMotionComponent();\n const { hasUnsavedChanges, requestReset, submitLoading } = useFormContext();\n const { t } = useTranslation(formMessages);\n\n const unsavedWarningText = texts?.unSavedWarning ?? t('form.unsavedWarning');\n const unsavedText = texts?.unSaved ?? t('form.unsavedChanges');\n const resetText = texts?.reset ?? t('form.reset');\n const submitText = texts?.submit ?? t('form.submit');\n\n useEffect(() => {\n if (!enableUnsavedWarning || typeof window === 'undefined' || !hasUnsavedChanges) return;\n const fn = (e: BeforeUnloadEvent) => {\n e.preventDefault();\n e.returnValue = unsavedWarningText;\n };\n window.addEventListener('beforeunload', fn);\n return () => window.removeEventListener('beforeunload', fn);\n }, [enableUnsavedWarning, hasUnsavedChanges, unsavedWarningText]);\n\n const content = (\n <>\n {(float || hasUnsavedChanges) && (\n <>\n <Icon\n color={cssVar.colorTextDescription}\n icon={InfoIcon}\n size={12}\n style={{ marginLeft: 8 }}\n />\n <span\n style={{\n color: cssVar.colorTextDescription,\n flex: 'none',\n fontSize: 12,\n marginRight: float ? 16 : 4,\n }}\n >\n {unsavedText}\n </span>\n </>\n )}\n {children}\n {enableReset && (float || hasUnsavedChanges) && (\n <Button\n htmlType={'button'}\n shape={float ? 'round' : undefined}\n type={'fill'}\n onClick={() => {\n requestReset();\n onReset?.();\n }}\n {...buttonProps}\n {...resetButtonProps}\n >\n {resetText}\n </Button>\n )}\n <Button\n htmlType={'submit'}\n loading={submitLoading}\n shape={float ? 'round' : undefined}\n type={'primary'}\n {...buttonProps}\n {...saveButtonProps}\n >\n {submitText}\n </Button>\n </>\n );\n\n if (!float)\n return (\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.footer, className)}\n gap={8}\n justify={'flex-end'}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n\n return (\n <Motion.div\n animate={hasUnsavedChanges ? 'visible' : 'hidden'}\n className={styles.floatFooter}\n initial={'hidden'}\n transition={{ duration: 0.1, ease: 'easeOut' }}\n variants={{\n hidden: {\n opacity: 0,\n x: '-50%',\n y: 20,\n },\n visible: {\n opacity: 1,\n x: '-50%',\n y: 0,\n },\n }}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={className}\n gap={8}\n justify={'center'}\n {...rest}\n >\n {content}\n </Flexbox>\n </Motion.div>\n );\n },\n);\n\nFormSubmitFooter.displayName = 'FormSubmitFooter';\n\nexport default FormSubmitFooter;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,mBAAmB,MACtB,EACC,cAAc,MACd,aACA,OACA,SACA,iBACA,kBACA,sBACA,UACA,OACA,WACA,GAAG,WACC;CACJ,MAAM,SAAS,oBAAoB;CACnC,MAAM,EAAE,mBAAmB,cAAc,kBAAkB,gBAAgB;CAC3E,MAAM,EAAE,MAAM,eAAeA,aAAa;CAE1C,MAAM,qBAAqB,OAAO,kBAAkB,EAAE,sBAAsB;CAC5E,MAAM,cAAc,OAAO,WAAW,EAAE,sBAAsB;CAC9D,MAAM,YAAY,OAAO,SAAS,EAAE,aAAa;CACjD,MAAM,aAAa,OAAO,UAAU,EAAE,cAAc;AAEpD,iBAAgB;AACd,MAAI,CAAC,wBAAwB,OAAO,WAAW,eAAe,CAAC,kBAAmB;EAClF,MAAM,MAAM,MAAyB;AACnC,KAAE,gBAAgB;AAClB,KAAE,cAAc;;AAElB,SAAO,iBAAiB,gBAAgB,GAAG;AAC3C,eAAa,OAAO,oBAAoB,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,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import FlexBasic_default from "../../../Flex/FlexBasic.mjs";
|
|
3
|
+
import Tag from "../../../Tag/Tag.mjs";
|
|
4
|
+
import { titleStyles } from "../style.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cx } from "antd-style";
|
|
7
|
+
//#region src/base-ui/Form/components/FormTitle.tsx
|
|
8
|
+
const FormTitle = ({ tag, title, desc, avatar, classNames, styles: customStyles, tagProps, ...rest }) => {
|
|
9
|
+
return /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
10
|
+
horizontal: true,
|
|
11
|
+
align: "center",
|
|
12
|
+
gap: 8,
|
|
13
|
+
...rest,
|
|
14
|
+
children: [avatar, /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
15
|
+
className: cx(titleStyles.content, classNames?.content),
|
|
16
|
+
gap: 8,
|
|
17
|
+
style: customStyles?.content,
|
|
18
|
+
children: [/* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
19
|
+
horizontal: true,
|
|
20
|
+
align: "center",
|
|
21
|
+
className: cx(titleStyles.title, classNames?.title),
|
|
22
|
+
gap: 8,
|
|
23
|
+
style: customStyles?.title,
|
|
24
|
+
children: [title, tag && /* @__PURE__ */ jsx(Tag, {
|
|
25
|
+
className: classNames?.tag,
|
|
26
|
+
style: customStyles?.tag,
|
|
27
|
+
...tagProps,
|
|
28
|
+
children: tag
|
|
29
|
+
})]
|
|
30
|
+
}), desc && /* @__PURE__ */ jsx("small", {
|
|
31
|
+
className: cx(titleStyles.desc, classNames?.desc),
|
|
32
|
+
style: customStyles?.desc,
|
|
33
|
+
children: desc
|
|
34
|
+
})]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
FormTitle.displayName = "FormTitle";
|
|
39
|
+
//#endregion
|
|
40
|
+
export { FormTitle as default };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=FormTitle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTitle.mjs","names":["Flexbox","styles"],"sources":["../../../../src/base-ui/Form/components/FormTitle.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { type FC } from 'react';\n\nimport { Flexbox } from '@/Flex';\nimport Tag from '@/Tag';\n\nimport { titleStyles as styles } from '../style';\nimport type { FormTitleProps } from '../type';\n\nconst FormTitle: FC<FormTitleProps> = ({\n tag,\n title,\n desc,\n avatar,\n classNames,\n styles: customStyles,\n tagProps,\n ...rest\n}) => {\n return (\n <Flexbox horizontal align={'center'} gap={8} {...rest}>\n {avatar}\n <Flexbox\n className={cx(styles.content, classNames?.content)}\n gap={8}\n style={customStyles?.content}\n >\n <Flexbox\n horizontal\n align={'center'}\n className={cx(styles.title, classNames?.title)}\n gap={8}\n style={customStyles?.title}\n >\n {title}\n {tag && (\n <Tag className={classNames?.tag} style={customStyles?.tag} {...tagProps}>\n {tag}\n </Tag>\n )}\n </Flexbox>\n {desc && (\n <small className={cx(styles.desc, classNames?.desc)} style={customStyles?.desc}>\n {desc}\n </small>\n )}\n </Flexbox>\n </Flexbox>\n );\n};\n\nFormTitle.displayName = 'FormTitle';\n\nexport default FormTitle;\n"],"mappings":";;;;;;;AAWA,MAAM,aAAiC,EACrC,KACA,OACA,MACA,QACA,YACA,QAAQ,cACR,UACA,GAAG,WACC;AACJ,QACE,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAO;EAAU,KAAK;EAAG,GAAI;YAAjD,CACG,QACD,qBAACA,mBAAD;GACE,WAAW,GAAGC,YAAO,SAAS,YAAY,QAAQ;GAClD,KAAK;GACL,OAAO,cAAc;aAHvB,CAKE,qBAACD,mBAAD;IACE,YAAA;IACA,OAAO;IACP,WAAW,GAAGC,YAAO,OAAO,YAAY,MAAM;IAC9C,KAAK;IACL,OAAO,cAAc;cALvB,CAOG,OACA,OACC,oBAAC,KAAD;KAAK,WAAW,YAAY;KAAK,OAAO,cAAc;KAAK,GAAI;eAC5D;KACG,CAAA,CAEA;OACT,QACC,oBAAC,SAAD;IAAO,WAAW,GAAGA,YAAO,MAAM,YAAY,KAAK;IAAE,OAAO,cAAc;cACvE;IACK,CAAA,CAEF;KACF;;;AAId,UAAU,cAAc"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, use } from "react";
|
|
3
|
+
//#region src/base-ui/Form/context.ts
|
|
4
|
+
const FormContext = createContext({
|
|
5
|
+
hasUnsavedChanges: false,
|
|
6
|
+
layout: "horizontal",
|
|
7
|
+
requestReset: () => {},
|
|
8
|
+
submitLoading: false,
|
|
9
|
+
variant: "borderless"
|
|
10
|
+
});
|
|
11
|
+
const useFormContext = () => use(FormContext);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { FormContext, useFormContext };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/base-ui/Form/context.ts"],"sourcesContent":["'use client';\n\nimport { createContext, use } from 'react';\n\nimport type { FormContextValue } from './type';\n\nexport const FormContext = createContext<FormContextValue>({\n hasUnsavedChanges: false,\n layout: 'horizontal',\n requestReset: () => {},\n submitLoading: false,\n variant: 'borderless',\n});\n\nexport const useFormContext = () => use(FormContext);\n"],"mappings":";;;AAMA,MAAa,cAAc,cAAgC;CACzD,mBAAmB;CACnB,QAAQ;CACR,oBAAoB;CACpB,eAAe;CACf,SAAS;CACV,CAAC;AAEF,MAAa,uBAAuB,IAAI,YAAY"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FlexBasicProps } from "../../Flex/type.mjs";
|
|
2
|
+
import { FormContextValue, FormDividerProps, FormFieldProps, FormFlatGroupProps, FormFooterProps, FormGroupItemType, FormGroupProps, FormLayout, FormProps, FormSubmitFooterProps, FormTitleProps, FormValues, FormVariant, ItemsType } from "./type.mjs";
|
|
3
|
+
import { FormDivider } from "./components/FormDivider.mjs";
|
|
4
|
+
import { FormField } from "./components/FormField.mjs";
|
|
5
|
+
import { FormFlatGroup } from "./components/FormFlatGroup.mjs";
|
|
6
|
+
import { FormFooter } from "./components/FormFooter.mjs";
|
|
7
|
+
import { FormGroup } from "./components/FormGroup.mjs";
|
|
8
|
+
import { FormSubmitFooter } from "./components/FormSubmitFooter.mjs";
|
|
9
|
+
import { FormTitle } from "./components/FormTitle.mjs";
|
|
10
|
+
import { useFormContext } from "./context.mjs";
|
|
11
|
+
import * as _$react from "react";
|
|
12
|
+
|
|
13
|
+
//#region src/base-ui/Form/index.d.ts
|
|
14
|
+
declare const Form: _$react.NamedExoticComponent<FormProps> & {
|
|
15
|
+
Divider: _$react.FC<FormDividerProps>;
|
|
16
|
+
Field: _$react.NamedExoticComponent<FormFieldProps>;
|
|
17
|
+
FlatGroup: _$react.NamedExoticComponent<FormFlatGroupProps>;
|
|
18
|
+
Footer: _$react.FC<FlexBasicProps>;
|
|
19
|
+
Group: _$react.NamedExoticComponent<FormGroupProps>;
|
|
20
|
+
SubmitFooter: _$react.NamedExoticComponent<FormSubmitFooterProps>;
|
|
21
|
+
Title: _$react.FC<FormTitleProps>;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Form };
|
|
25
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import FormDivider from "./components/FormDivider.mjs";
|
|
3
|
+
import "./context.mjs";
|
|
4
|
+
import FormTitle from "./components/FormTitle.mjs";
|
|
5
|
+
import FormField from "./components/FormField.mjs";
|
|
6
|
+
import FormFlatGroup from "./components/FormFlatGroup.mjs";
|
|
7
|
+
import FormFooter from "./components/FormFooter.mjs";
|
|
8
|
+
import FormGroup from "./components/FormGroup.mjs";
|
|
9
|
+
import FormSubmitFooter from "./components/FormSubmitFooter.mjs";
|
|
10
|
+
import Form$1 from "./Form.mjs";
|
|
11
|
+
//#region src/base-ui/Form/index.ts
|
|
12
|
+
const Form = Object.assign(Form$1, {
|
|
13
|
+
Divider: FormDivider,
|
|
14
|
+
Field: FormField,
|
|
15
|
+
FlatGroup: FormFlatGroup,
|
|
16
|
+
Footer: FormFooter,
|
|
17
|
+
Group: FormGroup,
|
|
18
|
+
SubmitFooter: FormSubmitFooter,
|
|
19
|
+
Title: FormTitle
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Form as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["FormParent"],"sources":["../../../src/base-ui/Form/index.ts"],"sourcesContent":["'use client';\n\nimport FormDivider from './components/FormDivider';\nimport FormField from './components/FormField';\nimport FormFlatGroup from './components/FormFlatGroup';\nimport FormFooter from './components/FormFooter';\nimport FormGroup from './components/FormGroup';\nimport FormSubmitFooter from './components/FormSubmitFooter';\nimport FormTitle from './components/FormTitle';\nimport FormParent from './Form';\n\nexport const Form = Object.assign(FormParent, {\n Divider: FormDivider,\n Field: FormField,\n FlatGroup: FormFlatGroup,\n Footer: FormFooter,\n Group: FormGroup,\n SubmitFooter: FormSubmitFooter,\n Title: FormTitle,\n});\n\nexport { useFormContext } from './context';\nexport {\n FormDivider,\n FormField,\n FormFlatGroup,\n FormFooter,\n FormGroup,\n FormSubmitFooter,\n FormTitle,\n};\nexport type {\n FormContextValue,\n FormDividerProps,\n FormFieldProps,\n FormFlatGroupProps,\n FormFooterProps,\n FormGroupItemType,\n FormGroupProps,\n FormLayout,\n FormProps,\n FormSubmitFooterProps,\n FormTitleProps,\n FormValues,\n FormVariant,\n ItemsType,\n} from './type';\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,OAAO,OAAO,OAAOA,QAAY;CAC5C,SAAS;CACT,OAAO;CACP,WAAW;CACX,QAAQ;CACR,OAAO;CACP,cAAc;CACd,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { staticStylish } from "../../styles/theme/customStylishStatic.mjs";
|
|
2
|
+
import { createStaticStyles, responsive } from "antd-style";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
//#region src/base-ui/Form/style.ts
|
|
5
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
6
|
+
root: css`
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 16px;
|
|
12
|
+
|
|
13
|
+
width: 100%;
|
|
14
|
+
|
|
15
|
+
${responsive.sm} {
|
|
16
|
+
gap: 0 !important;
|
|
17
|
+
}
|
|
18
|
+
`,
|
|
19
|
+
rootBorderless: css`
|
|
20
|
+
gap: 48px;
|
|
21
|
+
`
|
|
22
|
+
}));
|
|
23
|
+
const rootVariants = cva(styles.root, {
|
|
24
|
+
defaultVariants: { variant: "borderless" },
|
|
25
|
+
variants: { variant: {
|
|
26
|
+
borderless: styles.rootBorderless,
|
|
27
|
+
filled: null,
|
|
28
|
+
outlined: null
|
|
29
|
+
} }
|
|
30
|
+
});
|
|
31
|
+
const fieldStyles = createStaticStyles(({ css, cssVar }) => ({
|
|
32
|
+
control: css`
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
gap: 4px;
|
|
36
|
+
align-items: flex-end;
|
|
37
|
+
|
|
38
|
+
min-width: var(--form-field-min-width, unset);
|
|
39
|
+
`,
|
|
40
|
+
controlVertical: css`
|
|
41
|
+
align-items: stretch;
|
|
42
|
+
width: 100%;
|
|
43
|
+
`,
|
|
44
|
+
error: css`
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: ${cssVar.colorError};
|
|
47
|
+
`,
|
|
48
|
+
horizontal: css`
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
`,
|
|
53
|
+
label: css`
|
|
54
|
+
display: block;
|
|
55
|
+
flex: 1;
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
text-align: start;
|
|
58
|
+
`,
|
|
59
|
+
root: css`
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: 12px;
|
|
62
|
+
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
width: 100%;
|
|
65
|
+
padding-block: 16px;
|
|
66
|
+
`,
|
|
67
|
+
vertical: css`
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
align-items: stretch;
|
|
71
|
+
`
|
|
72
|
+
}));
|
|
73
|
+
const fieldVariants = cva(fieldStyles.root, {
|
|
74
|
+
defaultVariants: { layout: "horizontal" },
|
|
75
|
+
variants: { layout: {
|
|
76
|
+
horizontal: fieldStyles.horizontal,
|
|
77
|
+
vertical: fieldStyles.vertical
|
|
78
|
+
} }
|
|
79
|
+
});
|
|
80
|
+
const dividerStyles = createStaticStyles(({ css, cssVar }) => ({ root: css`
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 1px;
|
|
83
|
+
margin: 0;
|
|
84
|
+
border: none;
|
|
85
|
+
|
|
86
|
+
background: ${cssVar.colorBorderSecondary};
|
|
87
|
+
` }));
|
|
88
|
+
const groupStyles = createStaticStyles(({ css, cssVar }) => ({
|
|
89
|
+
body: css`
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
`,
|
|
93
|
+
bodyBoxed: css`
|
|
94
|
+
padding-inline: 16px;
|
|
95
|
+
`,
|
|
96
|
+
chevron: css`
|
|
97
|
+
flex: none;
|
|
98
|
+
color: ${cssVar.colorTextDescription};
|
|
99
|
+
transition: transform 200ms ${cssVar.motionEaseOut};
|
|
100
|
+
|
|
101
|
+
[data-panel-open] & {
|
|
102
|
+
transform: rotate(180deg);
|
|
103
|
+
}
|
|
104
|
+
`,
|
|
105
|
+
desc: css`
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
font-weight: 400;
|
|
108
|
+
color: ${cssVar.colorTextDescription};
|
|
109
|
+
`,
|
|
110
|
+
header: css`
|
|
111
|
+
display: flex;
|
|
112
|
+
gap: 12px;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: space-between;
|
|
115
|
+
|
|
116
|
+
width: 100%;
|
|
117
|
+
`,
|
|
118
|
+
headerBorderless: css`
|
|
119
|
+
padding-block-end: 16px;
|
|
120
|
+
border-block-end: 1px solid ${cssVar.colorBorderSecondary};
|
|
121
|
+
`,
|
|
122
|
+
headerBoxed: css`
|
|
123
|
+
padding: 16px;
|
|
124
|
+
`,
|
|
125
|
+
mobileBody: css`
|
|
126
|
+
padding-block: 0;
|
|
127
|
+
padding-inline: 16px;
|
|
128
|
+
background: ${cssVar.colorBgContainer};
|
|
129
|
+
`,
|
|
130
|
+
mobileHeader: css`
|
|
131
|
+
padding: 16px;
|
|
132
|
+
background: ${cssVar.colorBgLayout};
|
|
133
|
+
`,
|
|
134
|
+
mobileTitle: css`
|
|
135
|
+
font-size: 14px;
|
|
136
|
+
font-weight: 400;
|
|
137
|
+
opacity: 0.5;
|
|
138
|
+
`,
|
|
139
|
+
panel: css`
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
height: var(--collapsible-panel-height);
|
|
142
|
+
transition: height 200ms ${cssVar.motionEaseOut};
|
|
143
|
+
|
|
144
|
+
&[data-starting-style],
|
|
145
|
+
&[data-ending-style] {
|
|
146
|
+
height: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
transition-duration: 0s;
|
|
151
|
+
}
|
|
152
|
+
`,
|
|
153
|
+
rootFilled: css`
|
|
154
|
+
border-radius: ${cssVar.borderRadiusLG};
|
|
155
|
+
${staticStylish.variantFilledWithoutHover}
|
|
156
|
+
background: ${cssVar.colorFillQuaternary};
|
|
157
|
+
`,
|
|
158
|
+
rootOutlined: css`
|
|
159
|
+
border-radius: ${cssVar.borderRadiusLG};
|
|
160
|
+
${staticStylish.variantOutlinedWithoutHover}
|
|
161
|
+
`,
|
|
162
|
+
title: css`
|
|
163
|
+
display: flex;
|
|
164
|
+
gap: 8px;
|
|
165
|
+
align-items: center;
|
|
166
|
+
|
|
167
|
+
font-size: 16px;
|
|
168
|
+
font-weight: bold;
|
|
169
|
+
color: ${cssVar.colorText};
|
|
170
|
+
`,
|
|
171
|
+
titleBorderless: css`
|
|
172
|
+
font-size: 18px;
|
|
173
|
+
`,
|
|
174
|
+
trigger: css`
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
|
|
177
|
+
display: flex;
|
|
178
|
+
flex: 1;
|
|
179
|
+
gap: 12px;
|
|
180
|
+
align-items: center;
|
|
181
|
+
|
|
182
|
+
margin: 0;
|
|
183
|
+
padding: 0;
|
|
184
|
+
border: none;
|
|
185
|
+
|
|
186
|
+
text-align: start;
|
|
187
|
+
|
|
188
|
+
background: none;
|
|
189
|
+
outline: none;
|
|
190
|
+
|
|
191
|
+
&:focus-visible {
|
|
192
|
+
border-radius: ${cssVar.borderRadius};
|
|
193
|
+
box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};
|
|
194
|
+
}
|
|
195
|
+
`
|
|
196
|
+
}));
|
|
197
|
+
const groupVariants = cva(null, {
|
|
198
|
+
defaultVariants: { variant: "borderless" },
|
|
199
|
+
variants: { variant: {
|
|
200
|
+
borderless: null,
|
|
201
|
+
filled: groupStyles.rootFilled,
|
|
202
|
+
outlined: groupStyles.rootOutlined
|
|
203
|
+
} }
|
|
204
|
+
});
|
|
205
|
+
const flatGroupStyles = createStaticStyles(({ cx, css, cssVar }) => ({
|
|
206
|
+
borderless: cx(staticStylish.variantBorderlessWithoutHover, css`
|
|
207
|
+
padding-inline: 0;
|
|
208
|
+
`),
|
|
209
|
+
filled: cx(staticStylish.variantFilledWithoutHover, css`
|
|
210
|
+
background: ${cssVar.colorFillQuaternary};
|
|
211
|
+
`),
|
|
212
|
+
mobile: css`
|
|
213
|
+
padding-block: 0;
|
|
214
|
+
padding-inline: 16px;
|
|
215
|
+
border-radius: 0;
|
|
216
|
+
background: ${cssVar.colorBgContainer};
|
|
217
|
+
`,
|
|
218
|
+
outlined: staticStylish.variantOutlinedWithoutHover,
|
|
219
|
+
root: css`
|
|
220
|
+
padding-inline: 16px;
|
|
221
|
+
border-radius: ${cssVar.borderRadiusLG};
|
|
222
|
+
`
|
|
223
|
+
}));
|
|
224
|
+
const flatGroupVariants = cva(flatGroupStyles.root, {
|
|
225
|
+
defaultVariants: { variant: "borderless" },
|
|
226
|
+
variants: { variant: {
|
|
227
|
+
borderless: flatGroupStyles.borderless,
|
|
228
|
+
filled: flatGroupStyles.filled,
|
|
229
|
+
outlined: flatGroupStyles.outlined
|
|
230
|
+
} }
|
|
231
|
+
});
|
|
232
|
+
const footerStyles = createStaticStyles(({ css, cssVar }) => ({ root: css`
|
|
233
|
+
${responsive.sm} {
|
|
234
|
+
padding: 16px;
|
|
235
|
+
border-block-start: 1px solid ${cssVar.colorBorderSecondary};
|
|
236
|
+
background: ${cssVar.colorBgContainer};
|
|
237
|
+
}
|
|
238
|
+
` }));
|
|
239
|
+
const submitFooterStyles = createStaticStyles(({ css, cssVar }) => ({
|
|
240
|
+
floatFooter: css`
|
|
241
|
+
position: fixed;
|
|
242
|
+
z-index: 1000;
|
|
243
|
+
inset-block-end: 24px;
|
|
244
|
+
inset-inline-start: 50%;
|
|
245
|
+
transform: translateX(-50%);
|
|
246
|
+
|
|
247
|
+
width: max-content;
|
|
248
|
+
padding: 8px;
|
|
249
|
+
border: 1px solid ${cssVar.colorBorderSecondary};
|
|
250
|
+
border-radius: 48px;
|
|
251
|
+
|
|
252
|
+
background: ${cssVar.colorBgContainer};
|
|
253
|
+
box-shadow: ${cssVar.boxShadowSecondary};
|
|
254
|
+
`,
|
|
255
|
+
footer: css`
|
|
256
|
+
${responsive.sm} {
|
|
257
|
+
margin-block-start: calc(-1 * ${cssVar.borderRadius});
|
|
258
|
+
padding: 16px;
|
|
259
|
+
border-block-start: 1px solid ${cssVar.colorBorderSecondary};
|
|
260
|
+
background: ${cssVar.colorBgContainer};
|
|
261
|
+
}
|
|
262
|
+
`
|
|
263
|
+
}));
|
|
264
|
+
const titleStyles = createStaticStyles(({ css, cssVar }) => ({
|
|
265
|
+
content: css`
|
|
266
|
+
position: relative;
|
|
267
|
+
text-align: start;
|
|
268
|
+
`,
|
|
269
|
+
desc: css`
|
|
270
|
+
display: block;
|
|
271
|
+
|
|
272
|
+
font-size: 12px;
|
|
273
|
+
font-weight: 400;
|
|
274
|
+
line-height: 1.44;
|
|
275
|
+
color: ${cssVar.colorTextDescription};
|
|
276
|
+
word-wrap: break-word;
|
|
277
|
+
white-space: pre-wrap;
|
|
278
|
+
`,
|
|
279
|
+
title: css`
|
|
280
|
+
font-weight: 500;
|
|
281
|
+
line-height: 1;
|
|
282
|
+
color: ${cssVar.colorText};
|
|
283
|
+
`
|
|
284
|
+
}));
|
|
285
|
+
//#endregion
|
|
286
|
+
export { dividerStyles, fieldStyles, fieldVariants, flatGroupStyles, flatGroupVariants, footerStyles, groupStyles, groupVariants, rootVariants, submitFooterStyles, titleStyles };
|
|
287
|
+
|
|
288
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../../src/base-ui/Form/style.ts"],"sourcesContent":["import { createStaticStyles, responsive } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css }) => ({\n root: css`\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n width: 100%;\n\n ${responsive.sm} {\n gap: 0 !important;\n }\n `,\n rootBorderless: css`\n gap: 48px;\n `,\n}));\n\nexport const rootVariants = cva(styles.root, {\n defaultVariants: {\n variant: 'borderless',\n },\n variants: {\n variant: {\n borderless: styles.rootBorderless,\n filled: null,\n outlined: null,\n },\n },\n});\n\nexport const fieldStyles = createStaticStyles(({ css, cssVar }) => ({\n control: css`\n display: flex;\n flex-direction: column;\n gap: 4px;\n align-items: flex-end;\n\n min-width: var(--form-field-min-width, unset);\n `,\n controlVertical: css`\n align-items: stretch;\n width: 100%;\n `,\n error: css`\n font-size: 12px;\n color: ${cssVar.colorError};\n `,\n horizontal: css`\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n `,\n label: css`\n display: block;\n flex: 1;\n max-width: 100%;\n text-align: start;\n `,\n root: css`\n display: flex;\n gap: 12px;\n\n box-sizing: border-box;\n width: 100%;\n padding-block: 16px;\n `,\n vertical: css`\n flex-direction: column;\n gap: 8px;\n align-items: stretch;\n `,\n}));\n\nexport const fieldVariants = cva(fieldStyles.root, {\n defaultVariants: {\n layout: 'horizontal',\n },\n variants: {\n layout: {\n horizontal: fieldStyles.horizontal,\n vertical: fieldStyles.vertical,\n },\n },\n});\n\nexport const dividerStyles = createStaticStyles(({ css, cssVar }) => ({\n root: css`\n width: 100%;\n height: 1px;\n margin: 0;\n border: none;\n\n background: ${cssVar.colorBorderSecondary};\n `,\n}));\n\nexport const groupStyles = createStaticStyles(({ css, cssVar }) => ({\n body: css`\n display: flex;\n flex-direction: column;\n `,\n bodyBoxed: css`\n padding-inline: 16px;\n `,\n chevron: css`\n flex: none;\n color: ${cssVar.colorTextDescription};\n transition: transform 200ms ${cssVar.motionEaseOut};\n\n [data-panel-open] & {\n transform: rotate(180deg);\n }\n `,\n desc: css`\n font-size: 12px;\n font-weight: 400;\n color: ${cssVar.colorTextDescription};\n `,\n header: css`\n display: flex;\n gap: 12px;\n align-items: center;\n justify-content: space-between;\n\n width: 100%;\n `,\n headerBorderless: css`\n padding-block-end: 16px;\n border-block-end: 1px solid ${cssVar.colorBorderSecondary};\n `,\n headerBoxed: css`\n padding: 16px;\n `,\n mobileBody: css`\n padding-block: 0;\n padding-inline: 16px;\n background: ${cssVar.colorBgContainer};\n `,\n mobileHeader: css`\n padding: 16px;\n background: ${cssVar.colorBgLayout};\n `,\n mobileTitle: css`\n font-size: 14px;\n font-weight: 400;\n opacity: 0.5;\n `,\n panel: css`\n overflow: hidden;\n height: var(--collapsible-panel-height);\n transition: height 200ms ${cssVar.motionEaseOut};\n\n &[data-starting-style],\n &[data-ending-style] {\n height: 0;\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n rootFilled: css`\n border-radius: ${cssVar.borderRadiusLG};\n ${lobeStaticStylish.variantFilledWithoutHover}\n background: ${cssVar.colorFillQuaternary};\n `,\n rootOutlined: css`\n border-radius: ${cssVar.borderRadiusLG};\n ${lobeStaticStylish.variantOutlinedWithoutHover}\n `,\n title: css`\n display: flex;\n gap: 8px;\n align-items: center;\n\n font-size: 16px;\n font-weight: bold;\n color: ${cssVar.colorText};\n `,\n titleBorderless: css`\n font-size: 18px;\n `,\n trigger: css`\n cursor: pointer;\n\n display: flex;\n flex: 1;\n gap: 12px;\n align-items: center;\n\n margin: 0;\n padding: 0;\n border: none;\n\n text-align: start;\n\n background: none;\n outline: none;\n\n &:focus-visible {\n border-radius: ${cssVar.borderRadius};\n box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};\n }\n `,\n}));\n\nexport const groupVariants = cva(null, {\n defaultVariants: {\n variant: 'borderless',\n },\n variants: {\n variant: {\n borderless: null,\n filled: groupStyles.rootFilled,\n outlined: groupStyles.rootOutlined,\n },\n },\n});\n\nexport const flatGroupStyles = createStaticStyles(({ cx, css, cssVar }) => ({\n borderless: cx(\n lobeStaticStylish.variantBorderlessWithoutHover,\n css`\n padding-inline: 0;\n `,\n ),\n filled: cx(\n lobeStaticStylish.variantFilledWithoutHover,\n css`\n background: ${cssVar.colorFillQuaternary};\n `,\n ),\n mobile: css`\n padding-block: 0;\n padding-inline: 16px;\n border-radius: 0;\n background: ${cssVar.colorBgContainer};\n `,\n outlined: lobeStaticStylish.variantOutlinedWithoutHover,\n root: css`\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadiusLG};\n `,\n}));\n\nexport const flatGroupVariants = cva(flatGroupStyles.root, {\n defaultVariants: {\n variant: 'borderless',\n },\n variants: {\n variant: {\n borderless: flatGroupStyles.borderless,\n filled: flatGroupStyles.filled,\n outlined: flatGroupStyles.outlined,\n },\n },\n});\n\nexport const footerStyles = createStaticStyles(({ css, cssVar }) => ({\n root: css`\n ${responsive.sm} {\n padding: 16px;\n border-block-start: 1px solid ${cssVar.colorBorderSecondary};\n background: ${cssVar.colorBgContainer};\n }\n `,\n}));\n\nexport const submitFooterStyles = createStaticStyles(({ css, cssVar }) => ({\n floatFooter: css`\n position: fixed;\n z-index: 1000;\n inset-block-end: 24px;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n\n width: max-content;\n padding: 8px;\n border: 1px solid ${cssVar.colorBorderSecondary};\n border-radius: 48px;\n\n background: ${cssVar.colorBgContainer};\n box-shadow: ${cssVar.boxShadowSecondary};\n `,\n footer: css`\n ${responsive.sm} {\n margin-block-start: calc(-1 * ${cssVar.borderRadius});\n padding: 16px;\n border-block-start: 1px solid ${cssVar.colorBorderSecondary};\n background: ${cssVar.colorBgContainer};\n }\n `,\n}));\n\nexport const titleStyles = createStaticStyles(({ css, cssVar }) => ({\n content: css`\n position: relative;\n text-align: start;\n `,\n desc: css`\n display: block;\n\n font-size: 12px;\n font-weight: 400;\n line-height: 1.44;\n color: ${cssVar.colorTextDescription};\n word-wrap: break-word;\n white-space: pre-wrap;\n `,\n title: css`\n font-weight: 500;\n line-height: 1;\n color: ${cssVar.colorText};\n `,\n}));\n"],"mappings":";;;;AAKA,MAAa,SAAS,oBAAoB,EAAE,WAAW;CACrD,MAAM,GAAG;;;;;;;;;MASL,WAAW,GAAG;;;;CAIlB,gBAAgB,GAAG;;;CAGpB,EAAE;AAEH,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB,EACf,SAAS,cACV;CACD,UAAU,EACR,SAAS;EACP,YAAY,OAAO;EACnB,QAAQ;EACR,UAAU;EACX,EACF;CACF,CAAC;AAEF,MAAa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