@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 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 [yyyy] [name of copyright owner]
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,3 @@
1
+ import { FC } from 'react';
2
+ import { FormProps, WithItem } from './Form.types';
3
+ export declare const Form: FC<FormProps> & WithItem;
@@ -0,0 +1,12 @@
1
+ import { FormItem } from "./components/FormItem/FormItem.js";
2
+ const FormComponent = (props) => {
3
+ const {
4
+ children
5
+ } = props;
6
+ return children;
7
+ };
8
+ const Form = FormComponent;
9
+ FormComponent.Item = FormItem;
10
+ export {
11
+ Form
12
+ };
@@ -0,0 +1,7 @@
1
+ import { ComponentType, PropsWithChildren } from 'react';
2
+ import { FormItemProps } from './components/FormItem/FormItem.types';
3
+ export interface FormProps extends PropsWithChildren {
4
+ }
5
+ export interface WithItem {
6
+ Item: ComponentType<FormItemProps>;
7
+ }
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { FormItemProps } from './FormItem.types';
3
+ export declare const FormItem: FC<FormItemProps>;
@@ -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
+ };
@@ -0,0 +1,5 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export type ValidateStatus = "success" | "error";
3
+ export interface FormItemProps extends PropsWithChildren {
4
+ validateStatus?: ValidateStatus;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ValidateStatus } from '../FormItem.types';
2
+ export interface FormItemContext {
3
+ status?: ValidateStatus;
4
+ }
5
+ export declare const FormItemContext: import('react').Context<FormItemContext>;
@@ -0,0 +1,5 @@
1
+ import { createContext } from "react";
2
+ const FormItemContext = createContext({});
3
+ export {
4
+ FormItemContext
5
+ };
@@ -0,0 +1,3 @@
1
+ export { Form } from './Form';
2
+ export type { FormProps } from './Form.types';
3
+ export type { FormItemProps } from './components/FormItem/FormItem.types';
@@ -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}-error-status`]: rest.status === "error"
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) || !picker) {
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}-error-status`]: rest.status === "error"
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) || !picker) {
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";
@@ -58,6 +58,7 @@ export declare const getRangeSelectorStyle: (pickerTokens: PickerTokens) => (the
58
58
  ".picker-input > input": {
59
59
  "::placeholder": {
60
60
  color: "#BFBFBF";
61
+ textOverflow: string;
61
62
  };
62
63
  fontFamily: "Roboto";
63
64
  fontSize: 14;
@@ -30,6 +30,7 @@ export declare const getSingleSelectorStyle: (pickerTokens: PickerTokens) => (th
30
30
  ".picker-input > input": {
31
31
  "::placeholder": {
32
32
  color: "#BFBFBF";
33
+ textOverflow: string;
33
34
  };
34
35
  fontFamily: "Roboto";
35
36
  fontSize: 14;
@@ -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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infomaximum/ui-kit",
3
3
  "license": "Apache-2.0",
4
- "version": "0.9.1",
4
+ "version": "0.10.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",