@itcase/ui 1.2.3 → 1.2.4

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.
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var tslib_es6 = require('../../tslib.es6-CKiUdo7p.js');
3
4
  var jsxRuntime = require('react/jsx-runtime');
4
5
  var React = require('react');
5
6
  var clsx = require('clsx');
@@ -19,7 +20,6 @@ require('lodash/maxBy');
19
20
  require('lodash/upperFirst');
20
21
  require('../hooks/styleAttributes.js');
21
22
  require('../../Link-DQxoFKhI.js');
22
- require('../../tslib.es6-CKiUdo7p.js');
23
23
  require('../../Tooltip-DkTKx9n-.js');
24
24
  require('../../Title-zwP6c2U2.js');
25
25
 
@@ -30,7 +30,7 @@ var choiceConfig = {
30
30
  },
31
31
  };
32
32
  var Choice = React.forwardRef(function Choice(props, ref) {
33
- var _a = props.isCheckbox, isCheckbox = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.active, active = _d === void 0 ? { value: undefined } : _d, activeIcon = props.activeIcon, activeIconItemFill = props.activeIconItemFill, after = props.after, appearance = props.appearance, before = props.before, className = props.className, icon = props.icon, iconFillDisabled = props.iconFillDisabled, iconItemFill = props.iconItemFill, iconSize = props.iconSize, labelTextActiveColor = props.labelTextActiveColor, labelTextActiveColorDisabled = props.labelTextActiveColorDisabled, labelTextColor = props.labelTextColor, labelTextColorDisabled = props.labelTextColorDisabled, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, name = props.name, _e = props.options, options = _e === void 0 ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === void 0 ? 'normal' : _f, type = props.type;
33
+ var gap = props.gap, _a = props.isCheckbox, isCheckbox = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.active, active = _d === void 0 ? { value: undefined } : _d, activeIcon = props.activeIcon, activeIconItemFill = props.activeIconItemFill, after = props.after, appearance = props.appearance, before = props.before, className = props.className, icon = props.icon, iconFillDisabled = props.iconFillDisabled, iconItemFill = props.iconItemFill, iconSize = props.iconSize, labelTextActiveColor = props.labelTextActiveColor, labelTextActiveColorDisabled = props.labelTextActiveColorDisabled, labelTextColor = props.labelTextColor, labelTextColorDisabled = props.labelTextColorDisabled, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, name = props.name, _e = props.options, options = _e === void 0 ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === void 0 ? 'normal' : _f, type = props.type;
34
34
  var controlRef = React.useRef(null);
35
35
  var optionsRefs = React.useMemo(function () { return new Map(options.map(function (item) { return [item.value, React.createRef()]; })); }, [options]);
36
36
  var onChange = React.useCallback(function (event, item) {
@@ -77,18 +77,18 @@ var Choice = React.forwardRef(function Choice(props, ref) {
77
77
  var appearanceConfig = (appearance && choiceConfig.appearance && choiceConfig.appearance[appearance]);
78
78
  return (jsxRuntime.jsx("div", { className: clsx(className, 'choice', shapeClass ||
79
79
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.shape) &&
80
- "choice_shape_".concat(appearanceConfig.shape).replace(/([A-Z])/g, '-$1').toLowerCase()), !isDisabled
81
- ? fillClass ||
82
- ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fill) &&
83
- "fill_".concat(appearanceConfig.fill).replace(/([A-Z])/g, '-$1').toLowerCase())
84
- : fillDisabledClass, borderColorClass ||
80
+ "choice_shape_".concat(appearanceConfig.shape).replace(/([A-Z])/g, '-$1').toLowerCase()), borderColorClass ||
85
81
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.borderColor) &&
86
82
  "border-color_".concat(appearanceConfig.borderColor)
87
83
  .replace(/([A-Z])/g, '-$1')
88
- .toLowerCase()), borderWidthClass, borderTypeClass, set && "choice_set_".concat(set), size && "choice_size_".concat(size), type && "choice_type_".concat(type)), ref: controlRef, children: isLoading ? (jsxRuntime.jsx(Loader.Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent", set: "simple" })) : (jsxRuntime.jsx("div", { className: "choice__wrapper", children: options.map(function (item) { return (jsxRuntime.jsxs("div", { className: clsx('choice__item', !isDisabled &&
84
+ .toLowerCase()), borderWidthClass, borderTypeClass, set && "choice_set_".concat(set), size && "choice_size_".concat(size), type && "choice_type_".concat(type)), ref: controlRef, children: isLoading ? (jsxRuntime.jsx(Loader.Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent", set: "simple" })) : (jsxRuntime.jsx("div", { className: "choice__wrapper", style: tslib_es6.__assign({}, (gap && { gap: gap })), children: options.map(function (item) { return (jsxRuntime.jsxs("div", { className: clsx('choice__item', !isDisabled
85
+ ? fillClass ||
86
+ ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fill) &&
87
+ "fill_".concat(appearanceConfig.fill).replace(/([A-Z])/g, '-$1').toLowerCase())
88
+ : fillDisabledClass, !isDisabled &&
89
89
  (fillHoverClass ||
90
90
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fillHover) &&
91
- "fill_active_".concat(appearanceConfig.fillHover)
91
+ "fill_hover_".concat(appearanceConfig.fillHover)
92
92
  .replace(/([A-Z])/g, '-$1')
93
93
  .toLowerCase())), item.value !== (active === null || active === void 0 ? void 0 : active.value) && isDisabled && 'choice__item_state_disabled', item.value === (active === null || active === void 0 ? void 0 : active.value)
94
94
  ? !isDisabled
@@ -6,6 +6,7 @@ var React = require('react');
6
6
  var clsx = require('clsx');
7
7
  var DatePicker = require('react-datepicker');
8
8
  var useDeviceTargetClass = require('../hooks/useDeviceTargetClass.js');
9
+ var useStyles = require('../hooks/useStyles.js');
9
10
  var Button = require('../../Button-D4y0v6YL.js');
10
11
  var Icon = require('../../Icon-Cq4hPF2D.js');
11
12
  var Input = require('../../Input-BSpFMsrf.js');
@@ -17,7 +18,6 @@ require('../context/UIContext.js');
17
18
  require('prop-types');
18
19
  require('../hooks/useMediaQueries.js');
19
20
  require('react-responsive');
20
- require('../hooks/useStyles.js');
21
21
  require('lodash/maxBy');
22
22
  require('lodash/upperFirst');
23
23
  require('../hooks/styleAttributes.js');
@@ -1073,7 +1073,7 @@ const ru = {
1073
1073
  function DatePickerInput(props) {
1074
1074
  var className = props.className, clearIcon = props.clearIcon, clearIconFill = props.clearIconFill, clearIconFillHover = props.clearIconFillHover, clearIconFillSize = props.clearIconFillSize, clearIconItemFill = props.clearIconItemFill, clearIconItemFillHover = props.clearIconItemFillHover, clearIconShape = props.clearIconShape, clearIconSize = props.clearIconSize, clearIconSrc = props.clearIconSrc, clearLabel = props.clearLabel, clearLabelTextColor = props.clearLabelTextColor, clearLabelTextColorHover = props.clearLabelTextColorHover, clearLabelTextSize = props.clearLabelTextSize, datePickerProps = props.datePickerProps, endValue = props.endValue, inputProps = props.inputProps, labelTextSize = props.labelTextSize, value = props.value, onChange = props.onChange;
1075
1075
  var widthClass = useDeviceTargetClass.useDeviceTargetClass(props, {
1076
- prefix: 'width_',
1076
+ prefix: 'datepicker_width_',
1077
1077
  propsKey: 'width',
1078
1078
  });
1079
1079
  var datepickerRef = React.useRef(null);
@@ -1107,7 +1107,7 @@ function DatePickerInput(props) {
1107
1107
  setEndDate(newEndDate);
1108
1108
  }, [onChange]);
1109
1109
  var renderDayContents = React.useCallback(function (day, date) {
1110
- return (jsxRuntime.jsx(Button.Button, { className: "react-datepicker__day-button", label: date.getDate().toString(), labelTextColor: datePickerProps.dayTextColor, labelTextSize: datePickerProps.dayTextSize, shape: datePickerProps.dayTextShape, size: datePickerProps.daySize }));
1110
+ return (jsxRuntime.jsx(Button.Button, { className: "react-datepicker__day-button", labelTextColor: datePickerProps.dayTextColor, labelTextSize: datePickerProps.dayTextSize, label: date.getDate().toString(), shape: datePickerProps.dayTextShape, size: datePickerProps.daySize }));
1111
1111
  }, [
1112
1112
  datePickerProps.daySize,
1113
1113
  datePickerProps.dayTextColor,
@@ -1115,7 +1115,7 @@ function DatePickerInput(props) {
1115
1115
  datePickerProps.dayTextSize,
1116
1116
  ]);
1117
1117
  var renderCustomHeader = React.useCallback(function (_a) {
1118
- var monthDate = _a.monthDate, decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth;
1118
+ var decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth, monthDate = _a.monthDate;
1119
1119
  return (jsxRuntime.jsxs("div", { className: "react-datepicker__header--div", children: [datePickerProps.iconLeft && (jsxRuntime.jsx(Icon.Icon, { className: "react-datepicker__icon", fill: datePickerProps.iconFill, fillHover: datePickerProps.iconFillHover, fillSize: datePickerProps.iconFillSize, iconFill: datePickerProps.iconItemFill, shape: datePickerProps.iconShape, size: datePickerProps.iconSize, SvgImage: datePickerProps.iconLeft, onClick: decreaseMonth })), jsxRuntime.jsxs("div", { className: "react-datepicker__data", children: [jsxRuntime.jsx(Text.Text, { className: "react-datepicker__month", size: datePickerProps.monthTextSize, textColor: datePickerProps.monthTextColor, textWeight: datePickerProps.monthTextWeight, children: monthDate.toLocaleString('ru-RU', { month: 'long' }) }), jsxRuntime.jsx(Text.Text, { className: "react-datepicker__year", size: datePickerProps.yearTextSize, textColor: datePickerProps.yearTextColor, textWeight: datePickerProps.yearTextWeight, children: monthDate.toLocaleString('ru-RU', { year: 'numeric' }) })] }), datePickerProps.iconRight && (jsxRuntime.jsx(Icon.Icon, { className: "react-datepicker__icon", fill: datePickerProps.iconFill, fillHover: datePickerProps.iconFillHover, fillSize: datePickerProps.iconFillSize, iconFill: datePickerProps.iconItemFill, shape: datePickerProps.iconShape, size: datePickerProps.iconSize, SvgImage: datePickerProps.iconRight, onClick: increaseMonth }))] }));
1120
1120
  }, [
1121
1121
  datePickerProps.iconFill,
@@ -1139,12 +1139,14 @@ function DatePickerInput(props) {
1139
1139
  React.useEffect(function () {
1140
1140
  setEndDate(end);
1141
1141
  }, [end]);
1142
- return (jsxRuntime.jsx("div", { className: clsx(className, 'datepicker', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.monthsShown) && 'datepicker_type_multiple-months', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.customTimeInput) && 'datepicker_type_button', widthClass), children: jsxRuntime.jsx(DatePicker, tslib_es6.__assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsxRuntime.jsx(DatePickerCustomInput, { labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
1142
+ // @ts-expect-error
1143
+ var datePickerStyles = useStyles.useStyles(props).styles;
1144
+ return (jsxRuntime.jsx("div", { className: clsx(className, 'datepicker', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.monthsShown) && 'datepicker_type_multiple-months', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.customTimeInput) && 'datepicker_type_button', widthClass), style: datePickerStyles, children: jsxRuntime.jsx(DatePicker, tslib_es6.__assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsxRuntime.jsx(DatePickerCustomInput, { labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
1143
1145
  // Important for use custom clear button
1144
1146
  isClearable: false })) }));
1145
1147
  }
1146
1148
  var DatePickerCustomInput = React.forwardRef(function (props, ref) {
1147
- var isClearable = props.isClearable, value = props.value, inputProps = props.inputProps, inputIcon = props.inputIcon;
1149
+ var isClearable = props.isClearable, inputIcon = props.inputIcon, inputProps = props.inputProps, value = props.value;
1148
1150
  var multipleValue = React.useMemo(function () {
1149
1151
  if (value) {
1150
1152
  var twoDates = value.split(' - ');
@@ -1162,7 +1164,7 @@ function DatePickerClearButton(props) {
1162
1164
  (_a = datepickerRef === null || datepickerRef === void 0 ? void 0 : datepickerRef.current) === null || _a === void 0 ? void 0 : _a.onClearClick(event);
1163
1165
  (_b = datepickerRef === null || datepickerRef === void 0 ? void 0 : datepickerRef.current) === null || _b === void 0 ? void 0 : _b.handleFocus(event);
1164
1166
  }, []);
1165
- return (jsxRuntime.jsxs(React.Fragment, { children: [clearLabel && (jsxRuntime.jsx(Label.Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), label: clearLabel, labelTextColor: clearLabelTextColor, labelTextSize: clearLabelTextSize, labelTextColorHover: clearLabelTextColorHover, onClick: onClick })), (clearIcon || clearIconSrc) && (jsxRuntime.jsx(Icon.Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, size: clearIconSize, SvgImage: clearIcon, onClick: onClick }))] }));
1167
+ return (jsxRuntime.jsxs(React.Fragment, { children: [clearLabel && (jsxRuntime.jsx(Label.Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), labelTextColor: clearLabelTextColor, labelTextSize: clearLabelTextSize, label: clearLabel, labelTextColorHover: clearLabelTextColorHover, onClick: onClick })), (clearIcon || clearIconSrc) && (jsxRuntime.jsx(Icon.Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, size: clearIconSize, SvgImage: clearIcon, onClick: onClick }))] }));
1166
1168
  }
1167
1169
  DatePickerClearButton.displayName = 'DatePickerClearButton';
1168
1170
  function DatePickerInputIcon(props) {
@@ -1,3 +1,4 @@
1
+ import { _ as __assign } from '../tslib.es6-S-VPg1Cw.js';
1
2
  import { jsx, jsxs } from 'react/jsx-runtime';
2
3
  import React, { useRef, useMemo, createRef, useCallback } from 'react';
3
4
  import clsx from 'clsx';
@@ -17,7 +18,6 @@ import 'lodash/maxBy';
17
18
  import 'lodash/upperFirst';
18
19
  import '../hooks/styleAttributes.js';
19
20
  import '../Link-Bqu5amIb.js';
20
- import '../tslib.es6-S-VPg1Cw.js';
21
21
  import '../Tooltip-DJufHBiQ.js';
22
22
  import '../Title-BfSFPJtJ.js';
23
23
 
@@ -28,7 +28,7 @@ var choiceConfig = {
28
28
  },
29
29
  };
30
30
  var Choice = React.forwardRef(function Choice(props, ref) {
31
- var _a = props.isCheckbox, isCheckbox = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.active, active = _d === void 0 ? { value: undefined } : _d, activeIcon = props.activeIcon, activeIconItemFill = props.activeIconItemFill, after = props.after, appearance = props.appearance, before = props.before, className = props.className, icon = props.icon, iconFillDisabled = props.iconFillDisabled, iconItemFill = props.iconItemFill, iconSize = props.iconSize, labelTextActiveColor = props.labelTextActiveColor, labelTextActiveColorDisabled = props.labelTextActiveColorDisabled, labelTextColor = props.labelTextColor, labelTextColorDisabled = props.labelTextColorDisabled, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, name = props.name, _e = props.options, options = _e === void 0 ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === void 0 ? 'normal' : _f, type = props.type;
31
+ var gap = props.gap, _a = props.isCheckbox, isCheckbox = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.active, active = _d === void 0 ? { value: undefined } : _d, activeIcon = props.activeIcon, activeIconItemFill = props.activeIconItemFill, after = props.after, appearance = props.appearance, before = props.before, className = props.className, icon = props.icon, iconFillDisabled = props.iconFillDisabled, iconItemFill = props.iconItemFill, iconSize = props.iconSize, labelTextActiveColor = props.labelTextActiveColor, labelTextActiveColorDisabled = props.labelTextActiveColorDisabled, labelTextColor = props.labelTextColor, labelTextColorDisabled = props.labelTextColorDisabled, labelTextSize = props.labelTextSize, labelTextWeight = props.labelTextWeight, name = props.name, _e = props.options, options = _e === void 0 ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === void 0 ? 'normal' : _f, type = props.type;
32
32
  var controlRef = useRef(null);
33
33
  var optionsRefs = useMemo(function () { return new Map(options.map(function (item) { return [item.value, createRef()]; })); }, [options]);
34
34
  var onChange = useCallback(function (event, item) {
@@ -75,18 +75,18 @@ var Choice = React.forwardRef(function Choice(props, ref) {
75
75
  var appearanceConfig = (appearance && choiceConfig.appearance && choiceConfig.appearance[appearance]);
76
76
  return (jsx("div", { className: clsx(className, 'choice', shapeClass ||
77
77
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.shape) &&
78
- "choice_shape_".concat(appearanceConfig.shape).replace(/([A-Z])/g, '-$1').toLowerCase()), !isDisabled
79
- ? fillClass ||
80
- ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fill) &&
81
- "fill_".concat(appearanceConfig.fill).replace(/([A-Z])/g, '-$1').toLowerCase())
82
- : fillDisabledClass, borderColorClass ||
78
+ "choice_shape_".concat(appearanceConfig.shape).replace(/([A-Z])/g, '-$1').toLowerCase()), borderColorClass ||
83
79
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.borderColor) &&
84
80
  "border-color_".concat(appearanceConfig.borderColor)
85
81
  .replace(/([A-Z])/g, '-$1')
86
- .toLowerCase()), borderWidthClass, borderTypeClass, set && "choice_set_".concat(set), size && "choice_size_".concat(size), type && "choice_type_".concat(type)), ref: controlRef, children: isLoading ? (jsx(Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent", set: "simple" })) : (jsx("div", { className: "choice__wrapper", children: options.map(function (item) { return (jsxs("div", { className: clsx('choice__item', !isDisabled &&
82
+ .toLowerCase()), borderWidthClass, borderTypeClass, set && "choice_set_".concat(set), size && "choice_size_".concat(size), type && "choice_type_".concat(type)), ref: controlRef, children: isLoading ? (jsx(Loader, { width: "fill", height: "fill", fill: "surfacePrimary", itemFill: "surfaceItemAccent", set: "simple" })) : (jsx("div", { className: "choice__wrapper", style: __assign({}, (gap && { gap: gap })), children: options.map(function (item) { return (jsxs("div", { className: clsx('choice__item', !isDisabled
83
+ ? fillClass ||
84
+ ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fill) &&
85
+ "fill_".concat(appearanceConfig.fill).replace(/([A-Z])/g, '-$1').toLowerCase())
86
+ : fillDisabledClass, !isDisabled &&
87
87
  (fillHoverClass ||
88
88
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.fillHover) &&
89
- "fill_active_".concat(appearanceConfig.fillHover)
89
+ "fill_hover_".concat(appearanceConfig.fillHover)
90
90
  .replace(/([A-Z])/g, '-$1')
91
91
  .toLowerCase())), item.value !== (active === null || active === void 0 ? void 0 : active.value) && isDisabled && 'choice__item_state_disabled', item.value === (active === null || active === void 0 ? void 0 : active.value)
92
92
  ? !isDisabled
@@ -4,6 +4,7 @@ import React, { useMemo, useCallback, useRef, useState, useEffect } from 'react'
4
4
  import clsx from 'clsx';
5
5
  import DatePicker from 'react-datepicker';
6
6
  import { useDeviceTargetClass } from '../hooks/useDeviceTargetClass.js';
7
+ import { useStyles } from '../hooks/useStyles.js';
7
8
  import { B as Button } from '../Button-BJWuO5uR.js';
8
9
  import { I as Icon } from '../Icon-fTLfvlsK.js';
9
10
  import { I as Input } from '../Input-UkM-ag48.js';
@@ -15,7 +16,6 @@ import '../context/UIContext.js';
15
16
  import 'prop-types';
16
17
  import '../hooks/useMediaQueries.js';
17
18
  import 'react-responsive';
18
- import '../hooks/useStyles.js';
19
19
  import 'lodash/maxBy';
20
20
  import 'lodash/upperFirst';
21
21
  import '../hooks/styleAttributes.js';
@@ -1071,7 +1071,7 @@ const ru = {
1071
1071
  function DatePickerInput(props) {
1072
1072
  var className = props.className, clearIcon = props.clearIcon, clearIconFill = props.clearIconFill, clearIconFillHover = props.clearIconFillHover, clearIconFillSize = props.clearIconFillSize, clearIconItemFill = props.clearIconItemFill, clearIconItemFillHover = props.clearIconItemFillHover, clearIconShape = props.clearIconShape, clearIconSize = props.clearIconSize, clearIconSrc = props.clearIconSrc, clearLabel = props.clearLabel, clearLabelTextColor = props.clearLabelTextColor, clearLabelTextColorHover = props.clearLabelTextColorHover, clearLabelTextSize = props.clearLabelTextSize, datePickerProps = props.datePickerProps, endValue = props.endValue, inputProps = props.inputProps, labelTextSize = props.labelTextSize, value = props.value, onChange = props.onChange;
1073
1073
  var widthClass = useDeviceTargetClass(props, {
1074
- prefix: 'width_',
1074
+ prefix: 'datepicker_width_',
1075
1075
  propsKey: 'width',
1076
1076
  });
1077
1077
  var datepickerRef = useRef(null);
@@ -1105,7 +1105,7 @@ function DatePickerInput(props) {
1105
1105
  setEndDate(newEndDate);
1106
1106
  }, [onChange]);
1107
1107
  var renderDayContents = useCallback(function (day, date) {
1108
- return (jsx(Button, { className: "react-datepicker__day-button", label: date.getDate().toString(), labelTextColor: datePickerProps.dayTextColor, labelTextSize: datePickerProps.dayTextSize, shape: datePickerProps.dayTextShape, size: datePickerProps.daySize }));
1108
+ return (jsx(Button, { className: "react-datepicker__day-button", labelTextColor: datePickerProps.dayTextColor, labelTextSize: datePickerProps.dayTextSize, label: date.getDate().toString(), shape: datePickerProps.dayTextShape, size: datePickerProps.daySize }));
1109
1109
  }, [
1110
1110
  datePickerProps.daySize,
1111
1111
  datePickerProps.dayTextColor,
@@ -1113,7 +1113,7 @@ function DatePickerInput(props) {
1113
1113
  datePickerProps.dayTextSize,
1114
1114
  ]);
1115
1115
  var renderCustomHeader = useCallback(function (_a) {
1116
- var monthDate = _a.monthDate, decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth;
1116
+ var decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth, monthDate = _a.monthDate;
1117
1117
  return (jsxs("div", { className: "react-datepicker__header--div", children: [datePickerProps.iconLeft && (jsx(Icon, { className: "react-datepicker__icon", fill: datePickerProps.iconFill, fillHover: datePickerProps.iconFillHover, fillSize: datePickerProps.iconFillSize, iconFill: datePickerProps.iconItemFill, shape: datePickerProps.iconShape, size: datePickerProps.iconSize, SvgImage: datePickerProps.iconLeft, onClick: decreaseMonth })), jsxs("div", { className: "react-datepicker__data", children: [jsx(Text, { className: "react-datepicker__month", size: datePickerProps.monthTextSize, textColor: datePickerProps.monthTextColor, textWeight: datePickerProps.monthTextWeight, children: monthDate.toLocaleString('ru-RU', { month: 'long' }) }), jsx(Text, { className: "react-datepicker__year", size: datePickerProps.yearTextSize, textColor: datePickerProps.yearTextColor, textWeight: datePickerProps.yearTextWeight, children: monthDate.toLocaleString('ru-RU', { year: 'numeric' }) })] }), datePickerProps.iconRight && (jsx(Icon, { className: "react-datepicker__icon", fill: datePickerProps.iconFill, fillHover: datePickerProps.iconFillHover, fillSize: datePickerProps.iconFillSize, iconFill: datePickerProps.iconItemFill, shape: datePickerProps.iconShape, size: datePickerProps.iconSize, SvgImage: datePickerProps.iconRight, onClick: increaseMonth }))] }));
1118
1118
  }, [
1119
1119
  datePickerProps.iconFill,
@@ -1137,12 +1137,14 @@ function DatePickerInput(props) {
1137
1137
  useEffect(function () {
1138
1138
  setEndDate(end);
1139
1139
  }, [end]);
1140
- return (jsx("div", { className: clsx(className, 'datepicker', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.monthsShown) && 'datepicker_type_multiple-months', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.customTimeInput) && 'datepicker_type_button', widthClass), children: jsx(DatePicker, __assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsx(DatePickerCustomInput, { labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
1140
+ // @ts-expect-error
1141
+ var datePickerStyles = useStyles(props).styles;
1142
+ return (jsx("div", { className: clsx(className, 'datepicker', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.monthsShown) && 'datepicker_type_multiple-months', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.customTimeInput) && 'datepicker_type_button', widthClass), style: datePickerStyles, children: jsx(DatePicker, __assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsx(DatePickerCustomInput, { labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
1141
1143
  // Important for use custom clear button
1142
1144
  isClearable: false })) }));
1143
1145
  }
1144
1146
  var DatePickerCustomInput = React.forwardRef(function (props, ref) {
1145
- var isClearable = props.isClearable, value = props.value, inputProps = props.inputProps, inputIcon = props.inputIcon;
1147
+ var isClearable = props.isClearable, inputIcon = props.inputIcon, inputProps = props.inputProps, value = props.value;
1146
1148
  var multipleValue = useMemo(function () {
1147
1149
  if (value) {
1148
1150
  var twoDates = value.split(' - ');
@@ -1160,7 +1162,7 @@ function DatePickerClearButton(props) {
1160
1162
  (_a = datepickerRef === null || datepickerRef === void 0 ? void 0 : datepickerRef.current) === null || _a === void 0 ? void 0 : _a.onClearClick(event);
1161
1163
  (_b = datepickerRef === null || datepickerRef === void 0 ? void 0 : datepickerRef.current) === null || _b === void 0 ? void 0 : _b.handleFocus(event);
1162
1164
  }, []);
1163
- return (jsxs(React.Fragment, { children: [clearLabel && (jsx(Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), label: clearLabel, labelTextColor: clearLabelTextColor, labelTextSize: clearLabelTextSize, labelTextColorHover: clearLabelTextColorHover, onClick: onClick })), (clearIcon || clearIconSrc) && (jsx(Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, size: clearIconSize, SvgImage: clearIcon, onClick: onClick }))] }));
1165
+ return (jsxs(React.Fragment, { children: [clearLabel && (jsx(Label, { className: clsx('react-datepicker__clear-label', 'cursor_type_pointer'), labelTextColor: clearLabelTextColor, labelTextSize: clearLabelTextSize, label: clearLabel, labelTextColorHover: clearLabelTextColorHover, onClick: onClick })), (clearIcon || clearIconSrc) && (jsx(Icon, { className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), fill: clearIconFill, fillHover: clearIconFillHover, fillSize: clearIconFillSize, iconFill: clearIconItemFill, iconFillHover: clearIconItemFillHover, imageSrc: clearIconSrc, shape: clearIconShape, size: clearIconSize, SvgImage: clearIcon, onClick: onClick }))] }));
1164
1166
  }
1165
1167
  DatePickerClearButton.displayName = 'DatePickerClearButton';
1166
1168
  function DatePickerInputIcon(props) {
@@ -2,16 +2,16 @@
2
2
  min-width: 30px;
3
3
  position: relative;
4
4
  display: flex;
5
- &:hover {
5
+ /* &:hover {
6
6
  background: var(--choice-item-background-hover);
7
- }
7
+ } */
8
8
  &:not(:last-child) {
9
- border-right: 1px solid var(--choice-border-color);
9
+ border-right: var(--chioce-item-border-right, 1px solid var(--choice-border-color));
10
10
  }
11
11
  &_state_disabled {
12
- background: var(--choice-item-state-disabled-background, #ECECEC);
12
+ background: var(--choice-item-state-disabled-background, #ececec);
13
13
  &:hover {
14
- background: var(--choice-item-state-disabled-background, #ECECEC);
14
+ background: var(--choice-item-state-disabled-background, #ececec);
15
15
  }
16
16
  }
17
17
  &_active {
@@ -48,6 +48,33 @@
48
48
  }
49
49
  }
50
50
 
51
+ .choice {
52
+ position: relative;
53
+ display: flex;
54
+ align-items: center;
55
+ &__wrapper {
56
+ position: relative;
57
+ display: flex;
58
+ }
59
+ }
60
+
61
+ .choice {
62
+ &_set {
63
+ &_form {
64
+ ^^&__item {
65
+ min-width: auto;
66
+ border: 1px solid var(--color-surface-border-tertiary);
67
+ border-radius: 6px;
68
+ &-label {
69
+ flex-direction: row-reverse;
70
+ align-items: center;
71
+ gap: 4px;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
51
78
  .choice {
52
79
  &_shape {
53
80
  &_rounded {
@@ -74,18 +101,7 @@
74
101
  }
75
102
  }
76
103
 
77
- .choice {
78
- position: relative;
79
- display: flex;
80
- align-items: center;
81
- &__wrapper {
82
- position: relative;
83
- display: flex;
84
- }
85
- }
86
-
87
104
  :root {
88
-
89
105
  --choice-item-background-hover: var(--color-surface-secondary);
90
106
 
91
107
  --choice-item-background-active: var(--color-surface-active);
@@ -2,16 +2,16 @@
2
2
  min-width: 30px;
3
3
  position: relative;
4
4
  display: flex;
5
- &:hover {
5
+ /* &:hover {
6
6
  background: var(--choice-item-background-hover);
7
- }
7
+ } */
8
8
  &:not(:last-child) {
9
- border-right: 1px solid var(--choice-border-color);
9
+ border-right: var(--chioce-item-border-right, 1px solid var(--choice-border-color));
10
10
  }
11
11
  &_state_disabled {
12
- background: var(--choice-item-state-disabled-background, #ECECEC);
12
+ background: var(--choice-item-state-disabled-background, #ececec);
13
13
  &:hover {
14
- background: var(--choice-item-state-disabled-background, #ECECEC);
14
+ background: var(--choice-item-state-disabled-background, #ececec);
15
15
  }
16
16
  }
17
17
  &_active {
@@ -10,11 +10,11 @@ interface iAccordionItemEventData {
10
10
  interface iAccordionProps extends iStyleAttributes {
11
11
  borderColor?: tBorderColorProps;
12
12
  children?: Element | React.ReactNode;
13
- className: string;
13
+ className?: string;
14
14
  direction?: tDirectionProps;
15
15
  fill?: tFillProps;
16
16
  height?: tHeightProps;
17
- initial: any;
17
+ initial?: any;
18
18
  items?: {
19
19
  id: number | string;
20
20
  content?: ReactNode;
@@ -23,7 +23,7 @@ interface iAccordionProps extends iStyleAttributes {
23
23
  shape?: tShapeProps;
24
24
  style?: CSSProperties;
25
25
  width?: tWidthProps;
26
- isMultiple: boolean;
26
+ isMultiple?: boolean;
27
27
  onClickItem?: (T: iAccordionItemEventData) => void;
28
28
  }
29
29
  interface iAccordionItemProps extends iStyleAttributes {
@@ -19,8 +19,8 @@ interface iChoiceThemeColor {
19
19
  labelTextActiveColorDisabled?: tTextColorProps;
20
20
  labelTextColor?: tTextColorProps;
21
21
  labelTextColorDisabled?: tTextColorProps;
22
- labelTextWeight?: tTextWeightProps;
23
22
  labelTextSize?: tTextSizeProps;
23
+ labelTextWeight?: tTextWeightProps;
24
24
  shape?: tShapeProps;
25
25
  }
26
26
  type tChoiceAppearance = {
@@ -31,29 +31,30 @@ interface iChoiceConfig {
31
31
  setAppearance: (newComponent: tChoiceAppearance) => void;
32
32
  }
33
33
  interface iChoiceProps extends iChoiceThemeColor, iStyleAttributes {
34
- appearance?: tAppearanceKeysDefault;
35
34
  active: {
36
35
  value: ReactNode;
37
36
  };
38
37
  activeIcon?: ReactNode;
39
38
  activeIconItemFill?: tItemColorProps;
40
39
  after?: ReactNode;
40
+ appearance?: tAppearanceKeysDefault;
41
41
  before?: ReactNode;
42
42
  className?: string;
43
+ gap?: string;
43
44
  icon?: ReactNode;
44
- isDisabled?: boolean;
45
- isCheckbox?: boolean;
46
- isLoading?: boolean;
47
45
  name?: string;
48
46
  options: {
49
- value: string;
50
- label: ReactNode;
51
47
  activeIconItemFill: tItemColorProps;
52
48
  iconItemFill: tItemColorProps;
49
+ label: ReactNode;
50
+ value: string;
53
51
  }[];
54
- set?: string;
55
52
  size?: sizeOptionPropsType;
56
53
  type?: string;
54
+ isCheckbox?: boolean;
55
+ isDisabled?: boolean;
56
+ isLoading?: boolean;
57
+ set?: string;
57
58
  setActiveSegment?: (item: any, isChecked?: boolean) => void;
58
59
  }
59
60
  export type { iChoiceThemeColor, tChoiceAppearance, iChoiceConfig, iChoiceProps };
@@ -25,7 +25,7 @@ interface IDatePickerProps extends DatePickerProps {
25
25
  inputIconShape?: tShapeProps;
26
26
  inputIconSize?: iconSizePropsType;
27
27
  inputIconSrc?: string;
28
- monthsShown?: boolean;
28
+ monthsShown?: number;
29
29
  monthTextColor?: tTextColorProps;
30
30
  monthTextSize?: tTextSizeProps;
31
31
  monthTextWeight?: tTextWeightProps;
@@ -1 +1 @@
1
- export type sizeOptionPropsType = 'compact' | 'normal' | 'regular' | 'any';
1
+ export type sizeOptionPropsType = 'any' | 'compact' | 'l' | 'large' | 'm' | 'normal' | 'regular' | 's' | 'tiny' | 'xl' | 'xs' | 'xxl';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/ui",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "UI components (Modal, Loader, Popup, etc)",
5
5
  "keywords": [
6
6
  "Modal",