@infomaximum/ui-kit 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/components/Form/Form.d.ts +3 -0
- package/dist/components/Form/Form.js +12 -0
- package/dist/components/Form/Form.types.d.ts +7 -0
- package/dist/components/Form/components/FormItem/FormItem.d.ts +3 -0
- package/dist/components/Form/components/FormItem/FormItem.js +17 -0
- package/dist/components/Form/components/FormItem/FormItem.types.d.ts +5 -0
- package/dist/components/Form/components/FormItem/contexts/FormItemContext.d.ts +5 -0
- package/dist/components/Form/components/FormItem/contexts/FormItemContext.js +5 -0
- package/dist/components/Form/index.d.ts +3 -0
- package/dist/components/InternalPicker/pickers/RangePicker/RangePicker.js +10 -2
- package/dist/components/InternalPicker/pickers/RangePicker/RangePicker.utils.js +4 -1
- package/dist/components/InternalPicker/pickers/SinglePicker/SinglePicker.js +10 -2
- package/dist/components/InternalPicker/pickers/SinglePicker/SinglePicker.utils.js +4 -1
- package/dist/components/InternalPicker/styles/Popup.styles.d.ts +0 -1
- package/dist/components/InternalPicker/styles/RangeSelector.styles.d.ts +1 -0
- package/dist/components/InternalPicker/styles/SingleSelector.styles.d.ts +1 -0
- package/dist/components/InternalPicker/styles/SingleSelector.styles.js +2 -1
- package/dist/components/InternalPicker/styles/TimePanel.styles.d.ts +0 -1
- package/dist/components/InternalPicker/styles/TimePanel.styles.js +0 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2025 Infomaximum
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { FormItemContext } from "./contexts/FormItemContext.js";
|
|
4
|
+
const FormItemComponent = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
validateStatus,
|
|
7
|
+
children
|
|
8
|
+
} = props;
|
|
9
|
+
const contextValue = useMemo(() => ({
|
|
10
|
+
status: validateStatus
|
|
11
|
+
}), [validateStatus]);
|
|
12
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: contextValue, children });
|
|
13
|
+
};
|
|
14
|
+
const FormItem = FormItemComponent;
|
|
15
|
+
export {
|
|
16
|
+
FormItem
|
|
17
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef, memo } from "react";
|
|
2
|
+
import { forwardRef, useContext, memo } from "react";
|
|
3
3
|
import { RangePicker as RangePicker$1 } from "rc-picker";
|
|
4
4
|
import { ClassNames } from "@emotion/react";
|
|
5
5
|
import { getPickerTokens } from "../../tokens.js";
|
|
@@ -9,6 +9,7 @@ import { getRangeSelectorStyle } from "../../styles/RangeSelector.styles.js";
|
|
|
9
9
|
import dayjs from "dayjs";
|
|
10
10
|
import { getFormatByPicker, defaultProps } from "../SinglePicker/SinglePicker.utils.js";
|
|
11
11
|
import { getRangePlaceholder } from "./RangePicker.utils.js";
|
|
12
|
+
import { FormItemContext } from "../../../Form/components/FormItem/contexts/FormItemContext.js";
|
|
12
13
|
import { useTheme } from "../../../../hooks/useTheme/useTheme.js";
|
|
13
14
|
import { useConfig } from "../../../ConfigProvider/hooks/useConfig/useConfig.js";
|
|
14
15
|
import { useComponents } from "../hooks/useComponents/useComponents.js";
|
|
@@ -19,6 +20,7 @@ const RangePickerComponent = forwardRef((props, ref) => {
|
|
|
19
20
|
const {
|
|
20
21
|
components: componentsProp,
|
|
21
22
|
placeholder,
|
|
23
|
+
status: statusProp,
|
|
22
24
|
...rest
|
|
23
25
|
} = props;
|
|
24
26
|
const theme = useTheme();
|
|
@@ -31,13 +33,19 @@ const RangePickerComponent = forwardRef((props, ref) => {
|
|
|
31
33
|
} = useComponents({
|
|
32
34
|
components: componentsProp
|
|
33
35
|
});
|
|
36
|
+
const {
|
|
37
|
+
status: contextStatus
|
|
38
|
+
} = useContext(FormItemContext);
|
|
39
|
+
const status = statusProp || contextStatus;
|
|
34
40
|
return /* @__PURE__ */ jsx(ClassNames, { children: ({
|
|
35
41
|
css,
|
|
36
42
|
cx
|
|
37
43
|
}) => {
|
|
38
44
|
var _a;
|
|
39
45
|
return /* @__PURE__ */ jsx(RangePicker$1, { ref, locale, placeholder: getRangePlaceholder(locale, rest.picker, placeholder), separator: defaultSeparator, format: getFormatByPicker(rest.picker, Boolean(rest.showTime)), ...defaultProps, ...rest, components, prefixCls, className: cx(css(getRangeSelectorStyle(pickerTokens)(theme)), {
|
|
40
|
-
[`${prefixCls}-
|
|
46
|
+
[`${prefixCls}-success-status`]: status === "success"
|
|
47
|
+
}, {
|
|
48
|
+
[`${prefixCls}-error-status`]: status === "error"
|
|
41
49
|
}, rest.className), classNames: {
|
|
42
50
|
popup: cx(css(getPopupStyle(pickerTokens)(theme)), (_a = rest.classNames) == null ? void 0 : _a.popup)
|
|
43
51
|
} });
|
|
@@ -3,9 +3,12 @@ const getRangePlaceholder = (locale, picker, placeholder) => {
|
|
|
3
3
|
if (placeholder) {
|
|
4
4
|
return placeholder;
|
|
5
5
|
}
|
|
6
|
-
if (isNull(placeholder)
|
|
6
|
+
if (isNull(placeholder)) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
+
if (!picker) {
|
|
10
|
+
return locale.rangeDatePlaceholder;
|
|
11
|
+
}
|
|
9
12
|
return locale[`range${capitalize(picker)}Placeholder`];
|
|
10
13
|
};
|
|
11
14
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef, memo } from "react";
|
|
2
|
+
import { forwardRef, useContext, memo } from "react";
|
|
3
3
|
import { Picker } from "rc-picker";
|
|
4
4
|
import { ClassNames } from "@emotion/react";
|
|
5
5
|
import { getPickerTokens } from "../../tokens.js";
|
|
@@ -9,6 +9,7 @@ import { getPopupStyle } from "../../styles/Popup.styles.js";
|
|
|
9
9
|
import { getSingleSelectorStyle } from "../../styles/SingleSelector.styles.js";
|
|
10
10
|
import dayjs from "dayjs";
|
|
11
11
|
import { getSinglePlaceholder, getFormatByPicker, defaultProps } from "./SinglePicker.utils.js";
|
|
12
|
+
import { FormItemContext } from "../../../Form/components/FormItem/contexts/FormItemContext.js";
|
|
12
13
|
import { useTheme } from "../../../../hooks/useTheme/useTheme.js";
|
|
13
14
|
import { useConfig } from "../../../ConfigProvider/hooks/useConfig/useConfig.js";
|
|
14
15
|
import { useComponents } from "../hooks/useComponents/useComponents.js";
|
|
@@ -18,6 +19,7 @@ const SinglePickerComponent = forwardRef((props, ref) => {
|
|
|
18
19
|
const {
|
|
19
20
|
components: componentsProp,
|
|
20
21
|
placeholder,
|
|
22
|
+
status: statusProp,
|
|
21
23
|
...rest
|
|
22
24
|
} = props;
|
|
23
25
|
const theme = useTheme();
|
|
@@ -30,13 +32,19 @@ const SinglePickerComponent = forwardRef((props, ref) => {
|
|
|
30
32
|
} = useComponents({
|
|
31
33
|
components: componentsProp
|
|
32
34
|
});
|
|
35
|
+
const {
|
|
36
|
+
status: contextStatus
|
|
37
|
+
} = useContext(FormItemContext);
|
|
38
|
+
const status = statusProp || contextStatus;
|
|
33
39
|
return /* @__PURE__ */ jsx(ClassNames, { children: ({
|
|
34
40
|
css,
|
|
35
41
|
cx
|
|
36
42
|
}) => {
|
|
37
43
|
var _a;
|
|
38
44
|
return /* @__PURE__ */ jsx(Picker, { ref, locale, placeholder: getSinglePlaceholder(locale, rest.picker, placeholder), format: getFormatByPicker(rest.picker, Boolean(rest.showTime)), ...defaultProps, ...rest, components, prefixCls, className: cx(css(getSingleSelectorStyle(pickerTokens)(theme)), {
|
|
39
|
-
[`${prefixCls}-
|
|
45
|
+
[`${prefixCls}-success-status`]: status === "success"
|
|
46
|
+
}, {
|
|
47
|
+
[`${prefixCls}-error-status`]: status === "error"
|
|
40
48
|
}, rest.className), classNames: {
|
|
41
49
|
popup: cx(css(getPopupStyle(pickerTokens)(theme)), (_a = rest.classNames) == null ? void 0 : _a.popup)
|
|
42
50
|
} });
|
|
@@ -89,9 +89,12 @@ const getSinglePlaceholder = (locale, picker, placeholder) => {
|
|
|
89
89
|
if (placeholder) {
|
|
90
90
|
return placeholder;
|
|
91
91
|
}
|
|
92
|
-
if (isNull(placeholder)
|
|
92
|
+
if (isNull(placeholder)) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
+
if (!picker) {
|
|
96
|
+
return locale.datePlaceholder;
|
|
97
|
+
}
|
|
95
98
|
return locale[`${picker}Placeholder`];
|
|
96
99
|
};
|
|
97
100
|
export {
|
|
@@ -1000,7 +1000,6 @@ export declare const getPopupStyle: (pickerTokens: PickerTokens) => (theme: Them
|
|
|
1000
1000
|
readonly color: "#BFBFBF";
|
|
1001
1001
|
};
|
|
1002
1002
|
".picker-time-panel-column": {
|
|
1003
|
-
readonly scrollbarWidth: "thin";
|
|
1004
1003
|
readonly boxSizing: "border-box";
|
|
1005
1004
|
readonly listStyle: "none";
|
|
1006
1005
|
readonly margin: "4px 0";
|
|
@@ -52,7 +52,8 @@ const getPickerInputStyle = (pickerTokens, theme) => ({
|
|
|
52
52
|
background: "inherit",
|
|
53
53
|
...theme.typography.body2,
|
|
54
54
|
"::placeholder": {
|
|
55
|
-
color: pickerTokens.pickerPlaceholder
|
|
55
|
+
color: pickerTokens.pickerPlaceholder,
|
|
56
|
+
textOverflow: "unset"
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
59
|
[`.${prefixCls}-input > input:placeholder-shown`]: {
|
|
@@ -22,7 +22,6 @@ export declare const getPickerTimePanelStyle: (pickerTokens: PickerTokens, theme
|
|
|
22
22
|
readonly color: "#BFBFBF";
|
|
23
23
|
};
|
|
24
24
|
".picker-time-panel-column": {
|
|
25
|
-
readonly scrollbarWidth: "thin";
|
|
26
25
|
readonly boxSizing: "border-box";
|
|
27
26
|
readonly listStyle: "none";
|
|
28
27
|
readonly margin: "4px 0";
|
|
@@ -15,8 +15,6 @@ const getPickerTimePanelContentStyle = () => ({
|
|
|
15
15
|
});
|
|
16
16
|
const getPickerTimePanelColumnStyle = (pickerTokens, theme) => ({
|
|
17
17
|
[`.${prefixCls}-time-panel-column`]: {
|
|
18
|
-
scrollbarWidth: "thin",
|
|
19
|
-
// TODO: пока непонятно, на чьей стороне стилизация скролла, пока без задачи.
|
|
20
18
|
boxSizing: "border-box",
|
|
21
19
|
listStyle: "none",
|
|
22
20
|
margin: `${theme.paddingXS}px 0`,
|
package/dist/index.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export type { AvatarProps } from './components/Avatar';
|
|
|
37
37
|
export { Tag } from './components/Tag';
|
|
38
38
|
export type { TagProps, CheckableProps } from './components/Tag';
|
|
39
39
|
export { ConfigProvider, useConfig, type Locale } from './components/ConfigProvider';
|
|
40
|
-
export type { PickerLocale } from './components/InternalPicker';
|
|
40
|
+
export type { PickerLocale, RangePickerProps } from './components/InternalPicker';
|
|
41
|
+
export { type FormProps, type FormItemProps, Form } from './components/Form';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { Avatar } from "./components/Avatar/Avatar.js";
|
|
|
24
24
|
import { Tag } from "./components/Tag/Tag.js";
|
|
25
25
|
import { ConfigProvider } from "./components/ConfigProvider/ConfigProvider.js";
|
|
26
26
|
import { useConfig } from "./components/ConfigProvider/hooks/useConfig/useConfig.js";
|
|
27
|
+
import { Form } from "./components/Form/Form.js";
|
|
27
28
|
export {
|
|
28
29
|
Alert,
|
|
29
30
|
Avatar,
|
|
@@ -32,6 +33,7 @@ export {
|
|
|
32
33
|
ConfigProvider,
|
|
33
34
|
DatePicker,
|
|
34
35
|
Dropdown,
|
|
36
|
+
Form,
|
|
35
37
|
Input,
|
|
36
38
|
InputNumber,
|
|
37
39
|
LoadingOutlined,
|