@lobehub/ui 5.19.2 → 5.20.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/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 +4 -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/Popover/PopoverGroup.mjs +9 -2
- package/es/base-ui/Popover/PopoverGroup.mjs.map +1 -1
- package/es/base-ui/Popover/PopoverStandalone.mjs +9 -3
- package/es/base-ui/Popover/PopoverStandalone.mjs.map +1 -1
- package/es/base-ui/Popover/hoverOnlyPress.mjs +14 -0
- package/es/base-ui/Popover/hoverOnlyPress.mjs.map +1 -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/package.json +4 -3
|
@@ -0,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":"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"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { FlexboxProps } from "../../Flex/type.mjs";
|
|
2
|
+
import { DivProps } from "../../types/index.mjs";
|
|
3
|
+
import { IconProps } from "../../Icon/type.mjs";
|
|
4
|
+
import { TagProps } from "../../Tag/type.mjs";
|
|
5
|
+
import { ButtonProps } from "../Button/type.mjs";
|
|
6
|
+
import { CSSProperties, ComponentProps, ReactNode, Ref } from "react";
|
|
7
|
+
import { Field } from "@base-ui/react/field";
|
|
8
|
+
import { Form } from "@base-ui/react/form";
|
|
9
|
+
|
|
10
|
+
//#region src/base-ui/Form/type.d.ts
|
|
11
|
+
type FormVariant = 'filled' | 'outlined' | 'borderless';
|
|
12
|
+
type FormLayout = 'horizontal' | 'vertical';
|
|
13
|
+
type ItemsType = 'group' | 'flat';
|
|
14
|
+
type FormValues = Record<string, any>;
|
|
15
|
+
type BaseFormProps = Omit<ComponentProps<typeof Form>, 'render' | 'className' | 'style'>;
|
|
16
|
+
interface FormProps extends BaseFormProps {
|
|
17
|
+
activeKey?: (string | number)[];
|
|
18
|
+
className?: string;
|
|
19
|
+
classNames?: {
|
|
20
|
+
group?: string;
|
|
21
|
+
item?: string;
|
|
22
|
+
};
|
|
23
|
+
collapsible?: boolean;
|
|
24
|
+
defaultActiveKey?: (string | number)[];
|
|
25
|
+
footer?: ReactNode;
|
|
26
|
+
gap?: number | string;
|
|
27
|
+
/**
|
|
28
|
+
* Initial values distributed to fields as `defaultValue` by name.
|
|
29
|
+
* Also the baseline for unsaved-changes detection and native reset.
|
|
30
|
+
*/
|
|
31
|
+
initialValues?: FormValues;
|
|
32
|
+
itemMinWidth?: FormFieldProps['minWidth'];
|
|
33
|
+
items?: FormGroupItemType[] | FormFieldProps[];
|
|
34
|
+
itemsType?: ItemsType;
|
|
35
|
+
layout?: FormLayout;
|
|
36
|
+
onCollapse?: (key: (string | number)[]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Called with collected field values on submit. Async callbacks drive submit loading state.
|
|
39
|
+
*/
|
|
40
|
+
onFinish?: (values: FormValues, eventDetails: Parameters<NonNullable<BaseFormProps['onFormSubmit']>>[1]) => void | Promise<void>;
|
|
41
|
+
ref?: Ref<HTMLFormElement>;
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
styles?: {
|
|
44
|
+
group?: CSSProperties;
|
|
45
|
+
item?: CSSProperties;
|
|
46
|
+
};
|
|
47
|
+
variant?: FormVariant;
|
|
48
|
+
}
|
|
49
|
+
interface FormFieldProps extends Omit<ComponentProps<typeof Field.Root>, 'render' | 'children' | 'className' | 'style'> {
|
|
50
|
+
avatar?: ReactNode;
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
className?: string;
|
|
53
|
+
desc?: ReactNode;
|
|
54
|
+
divider?: boolean;
|
|
55
|
+
hidden?: boolean;
|
|
56
|
+
label?: ReactNode;
|
|
57
|
+
layout?: FormLayout;
|
|
58
|
+
minWidth?: string | number;
|
|
59
|
+
required?: boolean;
|
|
60
|
+
style?: CSSProperties;
|
|
61
|
+
tag?: string;
|
|
62
|
+
variant?: FormVariant;
|
|
63
|
+
}
|
|
64
|
+
interface FormGroupItemType {
|
|
65
|
+
children: FormFieldProps[] | ReactNode;
|
|
66
|
+
collapsible?: boolean;
|
|
67
|
+
defaultActive?: boolean;
|
|
68
|
+
desc?: ReactNode;
|
|
69
|
+
extra?: ReactNode;
|
|
70
|
+
icon?: IconProps['icon'];
|
|
71
|
+
key?: string;
|
|
72
|
+
title: ReactNode;
|
|
73
|
+
variant?: FormVariant;
|
|
74
|
+
}
|
|
75
|
+
interface FormGroupProps extends Omit<DivProps, 'title'> {
|
|
76
|
+
active?: boolean;
|
|
77
|
+
collapsible?: boolean;
|
|
78
|
+
defaultActive?: boolean;
|
|
79
|
+
desc?: ReactNode;
|
|
80
|
+
extra?: ReactNode;
|
|
81
|
+
icon?: IconProps['icon'];
|
|
82
|
+
keyValue?: string | number;
|
|
83
|
+
onCollapse?: (active: boolean) => void;
|
|
84
|
+
title?: ReactNode;
|
|
85
|
+
variant?: FormVariant;
|
|
86
|
+
}
|
|
87
|
+
interface FormFlatGroupProps extends FlexboxProps {
|
|
88
|
+
variant?: FormVariant;
|
|
89
|
+
}
|
|
90
|
+
interface FormDividerProps extends DivProps {
|
|
91
|
+
visible?: boolean;
|
|
92
|
+
}
|
|
93
|
+
type FormFooterProps = FlexboxProps;
|
|
94
|
+
interface FormSubmitFooterProps extends Omit<FlexboxProps, 'onReset'> {
|
|
95
|
+
buttonProps?: Omit<ButtonProps, 'children'>;
|
|
96
|
+
enableReset?: boolean;
|
|
97
|
+
enableUnsavedWarning?: boolean;
|
|
98
|
+
float?: boolean;
|
|
99
|
+
onReset?: () => void;
|
|
100
|
+
resetButtonProps?: Omit<ButtonProps, 'children'>;
|
|
101
|
+
saveButtonProps?: Omit<ButtonProps, 'children'>;
|
|
102
|
+
texts?: {
|
|
103
|
+
reset?: string;
|
|
104
|
+
submit?: string;
|
|
105
|
+
unSaved?: string;
|
|
106
|
+
unSavedWarning?: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
interface FormTitleProps extends Omit<FlexboxProps, 'title'> {
|
|
110
|
+
avatar?: ReactNode;
|
|
111
|
+
classNames?: {
|
|
112
|
+
content?: string;
|
|
113
|
+
desc?: string;
|
|
114
|
+
tag?: string;
|
|
115
|
+
title?: string;
|
|
116
|
+
};
|
|
117
|
+
desc?: ReactNode;
|
|
118
|
+
styles?: {
|
|
119
|
+
content?: CSSProperties;
|
|
120
|
+
desc?: CSSProperties;
|
|
121
|
+
tag?: CSSProperties;
|
|
122
|
+
title?: CSSProperties;
|
|
123
|
+
};
|
|
124
|
+
tag?: string;
|
|
125
|
+
tagProps?: Omit<TagProps, 'children'>;
|
|
126
|
+
title: ReactNode;
|
|
127
|
+
}
|
|
128
|
+
interface FormContextValue {
|
|
129
|
+
hasUnsavedChanges: boolean;
|
|
130
|
+
initialValues?: FormValues;
|
|
131
|
+
itemMinWidth?: FormFieldProps['minWidth'];
|
|
132
|
+
layout: FormLayout;
|
|
133
|
+
requestReset: () => void;
|
|
134
|
+
submitLoading: boolean;
|
|
135
|
+
variant: FormVariant;
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { FormContextValue, FormDividerProps, FormFieldProps, FormFlatGroupProps, FormFooterProps, FormGroupItemType, FormGroupProps, FormLayout, FormProps, FormSubmitFooterProps, FormTitleProps, FormValues, FormVariant, ItemsType };
|
|
139
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { rootVariants, styles } from "./style.mjs";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cx, useThemeMode } from "antd-style";
|
|
6
|
+
import { Input } from "@base-ui/react/input";
|
|
7
|
+
//#region src/base-ui/Input/Input.tsx
|
|
8
|
+
const Input$1 = memo(({ ref, className, classNames, styles: customStyles, style, variant, shadow, size = "middle", prefix, suffix, disabled, ...rest }) => {
|
|
9
|
+
const { isDarkMode } = useThemeMode();
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: cx(rootVariants({
|
|
12
|
+
shadow,
|
|
13
|
+
size,
|
|
14
|
+
variant: variant || (isDarkMode ? "filled" : "outlined")
|
|
15
|
+
}), className),
|
|
16
|
+
"data-disabled": disabled ? "" : void 0,
|
|
17
|
+
style,
|
|
18
|
+
children: [
|
|
19
|
+
prefix && /* @__PURE__ */ jsx("span", {
|
|
20
|
+
className: cx(styles.slot, classNames?.prefix),
|
|
21
|
+
style: customStyles?.prefix,
|
|
22
|
+
children: prefix
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsx(Input, {
|
|
25
|
+
className: cx(styles.input, classNames?.input),
|
|
26
|
+
disabled,
|
|
27
|
+
ref,
|
|
28
|
+
style: customStyles?.input,
|
|
29
|
+
...rest
|
|
30
|
+
}),
|
|
31
|
+
suffix && /* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: cx(styles.slot, classNames?.suffix),
|
|
33
|
+
style: customStyles?.suffix,
|
|
34
|
+
children: suffix
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
Input$1.displayName = "Input";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Input$1 as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=Input.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.mjs","names":["Input","BaseInput"],"sources":["../../../src/base-ui/Input/Input.tsx"],"sourcesContent":["'use client';\n\nimport { Input as BaseInput } from '@base-ui/react/input';\nimport { cx, useThemeMode } from 'antd-style';\nimport { memo } from 'react';\n\nimport { rootVariants, styles } from './style';\nimport type { InputProps } from './type';\n\nconst Input = memo<InputProps>(\n ({\n ref,\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n prefix,\n suffix,\n disabled,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n return (\n <div\n className={cx(rootVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n style={style}\n >\n {prefix && (\n <span className={cx(styles.slot, classNames?.prefix)} style={customStyles?.prefix}>\n {prefix}\n </span>\n )}\n <BaseInput\n className={cx(styles.input, classNames?.input)}\n disabled={disabled}\n ref={ref}\n style={customStyles?.input}\n {...rest}\n />\n {suffix && (\n <span className={cx(styles.slot, classNames?.suffix)} style={customStyles?.suffix}>\n {suffix}\n </span>\n )}\n </div>\n );\n },\n);\n\nInput.displayName = 'Input';\n\nexport default Input;\n"],"mappings":";;;;;;;AASA,MAAMA,UAAQ,MACX,EACC,KACA,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,QACA,QACA,UACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,cAAc;AAGrC,QACE,qBAAC,OAAD;EACE,WAAW,GAAG,aAAa;GAAE;GAAQ;GAAM,SAJzB,YAAY,aAAa,WAAW;GAIa,CAAC,EAAE,UAAU;EAChF,iBAAe,WAAW,KAAK,KAAA;EACxB;YAHT;GAKG,UACC,oBAAC,QAAD;IAAM,WAAW,GAAG,OAAO,MAAM,YAAY,OAAO;IAAE,OAAO,cAAc;cACxE;IACI,CAAA;GAET,oBAACC,OAAD;IACE,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;IACpC;IACL;IACL,OAAO,cAAc;IACrB,GAAI;IACJ,CAAA;GACD,UACC,oBAAC,QAAD;IAAM,WAAW,GAAG,OAAO,MAAM,YAAY,OAAO;IAAE,OAAO,cAAc;cACxE;IACI,CAAA;GAEL;;EAGX;AAED,QAAM,cAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputNumberProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Input/InputNumber.d.ts
|
|
5
|
+
declare const InputNumber: _$react.NamedExoticComponent<InputNumberProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { InputNumber };
|
|
8
|
+
//# sourceMappingURL=InputNumber.d.mts.map
|