@infomaximum/ui-kit 0.15.0 → 0.15.2

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.
@@ -18,7 +18,7 @@ export declare const checkboxStyle: (checked: boolean, disabled: boolean, isHove
18
18
  readonly boxSizing: "border-box";
19
19
  readonly border: string;
20
20
  readonly borderRadius: 4;
21
- readonly background: "#F0F0F0" | "#FAFAFA" | "#0CB3B3" | "#50CCC4";
21
+ readonly background: "#F0F0F0" | "#FFFFFF" | "#0CB3B3" | "#50CCC4";
22
22
  readonly cursor: "pointer" | "not-allowed";
23
23
  };
24
24
  input: () => {
@@ -1,6 +1,6 @@
1
1
  import { Theme } from 'themes';
2
2
  export declare const getCheckboxTokens: (theme: Theme) => {
3
- checkboxBg: "#FAFAFA";
3
+ checkboxBg: "#FFFFFF";
4
4
  checkboxBgChecked: "#0CB3B3";
5
5
  checkboxBgCheckedHover: "#50CCC4";
6
6
  checkboxBgDisabled: "#F0F0F0";
@@ -1,5 +1,5 @@
1
1
  const getCheckboxTokens = (theme) => ({
2
- checkboxBg: theme.bgComplimentary,
2
+ checkboxBg: theme.bgContainer,
3
3
  checkboxBgChecked: theme.primaryBase,
4
4
  checkboxBgCheckedHover: theme.primaryHover,
5
5
  checkboxBgDisabled: theme.bgContainerDisabled,
@@ -7,7 +7,7 @@ import { SwapRightOutlined } from "@infomaximum/icons";
7
7
  import { getPopupStyle } from "../../styles/Popup.styles.js";
8
8
  import { getRangeSelectorStyle } from "../../styles/RangeSelector.styles.js";
9
9
  import dayjs from "dayjs";
10
- import { getFormatByPicker, minDate, defaultProps } from "../SinglePicker/SinglePicker.utils.js";
10
+ import { getFormatByPicker, minDate, getAllowClearValue, defaultProps } from "../SinglePicker/SinglePicker.utils.js";
11
11
  import { getRangePlaceholder } from "./RangePicker.utils.js";
12
12
  import { FormItemContext } from "../../../Form/components/FormItem/contexts/FormItemContext.js";
13
13
  import { useTheme } from "../../../../hooks/useTheme/useTheme.js";
@@ -21,6 +21,7 @@ const RangePickerComponent = forwardRef((props, ref) => {
21
21
  components: componentsProp,
22
22
  placeholder,
23
23
  status: statusProp,
24
+ allowClear: allowClearProp,
24
25
  ...rest
25
26
  } = props;
26
27
  const theme = useTheme();
@@ -42,7 +43,7 @@ const RangePickerComponent = forwardRef((props, ref) => {
42
43
  cx
43
44
  }) => {
44
45
  var _a;
45
- return /* @__PURE__ */ jsx(RangePicker$1, { ref, locale, placeholder: getRangePlaceholder(locale, rest.picker, placeholder), separator: defaultSeparator, format: getFormatByPicker(rest.picker, Boolean(rest.showTime)), minDate, ...defaultProps, ...rest, components, prefixCls, className: cx(css(getRangeSelectorStyle(pickerTokens)(theme)), {
46
+ return /* @__PURE__ */ jsx(RangePicker$1, { ref, locale, placeholder: getRangePlaceholder(locale, rest.picker, placeholder), separator: defaultSeparator, format: getFormatByPicker(rest.picker, Boolean(rest.showTime)), minDate, allowClear: getAllowClearValue(allowClearProp), ...defaultProps, ...rest, components, prefixCls, className: cx(css(getRangeSelectorStyle(pickerTokens)(theme)), {
46
47
  [`${prefixCls}-success-status`]: status === "success"
47
48
  }, {
48
49
  [`${prefixCls}-error-status`]: status === "error"
@@ -9,7 +9,7 @@ import "react-intersection-observer/test-utils";
9
9
  import { getPopupStyle } from "../../styles/Popup.styles.js";
10
10
  import { getSingleSelectorStyle } from "../../styles/SingleSelector.styles.js";
11
11
  import dayjs from "dayjs";
12
- import { getSinglePlaceholder, getFormatByPicker, minDate, defaultProps } from "./SinglePicker.utils.js";
12
+ import { getSinglePlaceholder, getFormatByPicker, minDate, getAllowClearValue, defaultProps } from "./SinglePicker.utils.js";
13
13
  import { FormItemContext } from "../../../Form/components/FormItem/contexts/FormItemContext.js";
14
14
  import { useTheme } from "../../../../hooks/useTheme/useTheme.js";
15
15
  import { useConfig } from "../../../ConfigProvider/hooks/useConfig/useConfig.js";
@@ -21,6 +21,7 @@ const SinglePickerComponent = forwardRef((props, ref) => {
21
21
  components: componentsProp,
22
22
  placeholder,
23
23
  status: statusProp,
24
+ allowClear: allowClearProp,
24
25
  ...rest
25
26
  } = props;
26
27
  const theme = useTheme();
@@ -42,7 +43,7 @@ const SinglePickerComponent = forwardRef((props, ref) => {
42
43
  cx
43
44
  }) => {
44
45
  var _a;
45
- return /* @__PURE__ */ jsx(Picker, { ref, locale, placeholder: getSinglePlaceholder(locale, rest.picker, placeholder), format: getFormatByPicker(rest.picker, Boolean(rest.showTime)), minDate, ...defaultProps, ...rest, components, prefixCls, className: cx(css(getSingleSelectorStyle(pickerTokens)(theme)), {
46
+ return /* @__PURE__ */ jsx(Picker, { ref, locale, placeholder: getSinglePlaceholder(locale, rest.picker, placeholder), format: getFormatByPicker(rest.picker, Boolean(rest.showTime)), minDate, allowClear: getAllowClearValue(allowClearProp), ...defaultProps, ...rest, components, prefixCls, className: cx(css(getSingleSelectorStyle(pickerTokens)(theme)), {
46
47
  [`${prefixCls}-success-status`]: status === "success"
47
48
  }, {
48
49
  [`${prefixCls}-error-status`]: status === "error"
@@ -1,12 +1,11 @@
1
1
  import { Dayjs } from 'dayjs';
2
2
  import { GenerateConfig } from 'rc-picker/lib/generate';
3
- import { Locale } from 'rc-picker/lib/interface';
3
+ import { Locale, SharedPickerProps } from 'rc-picker/lib/interface';
4
4
  import { SinglePickerProps } from './SinglePicker.types';
5
5
  import { PickerLocale } from '../../config';
6
+ export declare const defaultAllowClearConfig: SharedPickerProps["allowClear"];
7
+ export declare const getAllowClearValue: (allowClearProp: SharedPickerProps["allowClear"]) => SharedPickerProps["allowClear"];
6
8
  export declare const defaultProps: {
7
- allowClear: {
8
- clearIcon: import("@emotion/react/jsx-runtime").JSX.Element;
9
- };
10
9
  generateConfig: GenerateConfig<Dayjs>;
11
10
  };
12
11
  export declare const quarterFormats: Partial<Locale>;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "@emotion/react/jsx-runtime";
2
2
  import { CloseCircleFilled } from "@infomaximum/icons";
3
3
  import dayjsGenerateConfig from "rc-picker/es/generate/dayjs.js";
4
- import { upperFirst, isUndefined, isNull, isNumber } from "lodash-es";
4
+ import { upperFirst, isObject, isUndefined, isEmpty, isNull, isNumber } from "lodash-es";
5
5
  import dayjs from "dayjs";
6
6
  const fieldQuarterFormat = "Q-YYYY";
7
7
  const cellQuarterFormat = "Q";
@@ -57,10 +57,19 @@ const generateConfig = {
57
57
  }
58
58
  }
59
59
  };
60
+ const defaultAllowClearConfig = {
61
+ clearIcon: /* @__PURE__ */ jsx(CloseCircleFilled, {})
62
+ };
63
+ const getAllowClearValue = (allowClearProp) => {
64
+ if (isObject(allowClearProp) && allowClearProp.clearIcon) {
65
+ return allowClearProp;
66
+ }
67
+ if (allowClearProp === true || isUndefined(allowClearProp) || isObject(allowClearProp) && (isEmpty(allowClearProp) || isUndefined(allowClearProp.clearIcon))) {
68
+ return defaultAllowClearConfig;
69
+ }
70
+ return false;
71
+ };
60
72
  const defaultProps = {
61
- allowClear: {
62
- clearIcon: /* @__PURE__ */ jsx(CloseCircleFilled, {})
63
- },
64
73
  generateConfig
65
74
  };
66
75
  const defaultFormats = {
@@ -99,8 +108,10 @@ const getSinglePlaceholder = (locale, picker, placeholder) => {
99
108
  };
100
109
  const minDate = dayjs("1900-01-01");
101
110
  export {
111
+ defaultAllowClearConfig,
102
112
  defaultFormats,
103
113
  defaultProps,
114
+ getAllowClearValue,
104
115
  getFormatByPicker,
105
116
  getSinglePlaceholder,
106
117
  minDate
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.15.0",
4
+ "version": "0.15.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",