@itcase/ui 1.3.15 → 1.3.16

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.
@@ -52,7 +52,7 @@ var choiceConfig = {
52
52
  choiceConfig.appearance = newComponent;
53
53
  },
54
54
  };
55
- var Choice = React.forwardRef(function Choice(props, ref) {
55
+ function Choice(props) {
56
56
  var _a = props.isCheckbox, isCheckbox = _a === undefined ? false : _a, _b = props.isDisabled, isDisabled = _b === undefined ? false : _b, _c = props.isLoading, isLoading = _c === undefined ? false : _c, _d = props.active, active = _d === undefined ? { 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 === undefined ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === undefined ? 'normal' : _f, type = props.type;
57
57
  var controlRef = React.useRef(null);
58
58
  var optionsRefs = React.useMemo(function () { return new Map(options.map(function (item) { return [item.value, React.createRef()]; })); }, [options]);
@@ -87,7 +87,7 @@ var Choice = React.forwardRef(function Choice(props, ref) {
87
87
  ? activeIconItemFill || item.activeIconItemFill
88
88
  : iconItemFill || item.iconItemFill })), after] })] }, "".concat(name, "-").concat(item.value)));
89
89
  }) })) }));
90
- });
90
+ }
91
91
 
92
92
  exports.Choice = Choice;
93
93
  exports.choiceAppearance = choiceAppearance;
@@ -108,11 +108,31 @@ function useStyles(props) {
108
108
  }
109
109
  }
110
110
  if (value) {
111
- // TODO: handle 16px/9px propValues for Horizontal(Left/Right) and Vertical(Top/Bottom)
112
- const HAS_UNIT = /\D/;
113
- const ignorePX = ['zIndex', 'order', 'flexGrow'].includes(styleAttributeKey);
114
- if (!HAS_UNIT.test(value) && !ignorePX) {
115
- value = `${value}px`;
111
+ // Check not digit symbols. Chars means some unit ("px", "em", "rem" or custom "m")
112
+ const hasUnitRegExp = /\D/;
113
+ // If value has some unit
114
+ if (hasUnitRegExp.test(value)) {
115
+ // Check value on our custom "m"(module) unit
116
+ const hasModuleUnitRegExp = /^\d+m$/;
117
+ // If value has module unit
118
+ if (hasModuleUnitRegExp.test(value)) {
119
+ // Find numbers from value value
120
+ const numberMatchesList = value.match(/\d+/);
121
+ // If "numberMatchesList" not null (has matches)
122
+ if (numberMatchesList) {
123
+ // Parse module value to px value
124
+ const valueModule = parseFloat(numberMatchesList[0]);
125
+ const valuePx = valueModule * 8;
126
+ value = `${valuePx}px`;
127
+ }
128
+ }
129
+ } else {
130
+ // Some properties doesn't have any units
131
+ const ignorePX = ['zIndex', 'order', 'flexGrow'].includes(styleAttributeKey);
132
+ if (!ignorePX) {
133
+ // Add px to non-unit value
134
+ value = `${value}px`;
135
+ }
116
136
  }
117
137
  if (styleAttributeKey.includes('Horizontal')) {
118
138
  const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import React, { useRef, useMemo, createRef, useCallback } from 'react';
2
+ import { useRef, useMemo, createRef, useCallback } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useDeviceTargetClassGenerator } from '../hooks/useDeviceTargetClassGenerator.js';
5
5
  import { I as Icon } from '../Icon-Dz1q9WC2.js';
@@ -50,7 +50,7 @@ var choiceConfig = {
50
50
  choiceConfig.appearance = newComponent;
51
51
  },
52
52
  };
53
- var Choice = React.forwardRef(function Choice(props, ref) {
53
+ function Choice(props) {
54
54
  var _a = props.isCheckbox, isCheckbox = _a === undefined ? false : _a, _b = props.isDisabled, isDisabled = _b === undefined ? false : _b, _c = props.isLoading, isLoading = _c === undefined ? false : _c, _d = props.active, active = _d === undefined ? { 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 === undefined ? [] : _e, set = props.set, setActiveSegment = props.setActiveSegment, _f = props.size, size = _f === undefined ? 'normal' : _f, type = props.type;
55
55
  var controlRef = useRef(null);
56
56
  var optionsRefs = useMemo(function () { return new Map(options.map(function (item) { return [item.value, createRef()]; })); }, [options]);
@@ -85,6 +85,6 @@ var Choice = React.forwardRef(function Choice(props, ref) {
85
85
  ? activeIconItemFill || item.activeIconItemFill
86
86
  : iconItemFill || item.iconItemFill })), after] })] }, "".concat(name, "-").concat(item.value)));
87
87
  }) })) }));
88
- });
88
+ }
89
89
 
90
90
  export { Choice, choiceAppearance, choiceConfig };
@@ -106,11 +106,31 @@ function useStyles(props) {
106
106
  }
107
107
  }
108
108
  if (value) {
109
- // TODO: handle 16px/9px propValues for Horizontal(Left/Right) and Vertical(Top/Bottom)
110
- const HAS_UNIT = /\D/;
111
- const ignorePX = ['zIndex', 'order', 'flexGrow'].includes(styleAttributeKey);
112
- if (!HAS_UNIT.test(value) && !ignorePX) {
113
- value = `${value}px`;
109
+ // Check not digit symbols. Chars means some unit ("px", "em", "rem" or custom "m")
110
+ const hasUnitRegExp = /\D/;
111
+ // If value has some unit
112
+ if (hasUnitRegExp.test(value)) {
113
+ // Check value on our custom "m"(module) unit
114
+ const hasModuleUnitRegExp = /^\d+m$/;
115
+ // If value has module unit
116
+ if (hasModuleUnitRegExp.test(value)) {
117
+ // Find numbers from value value
118
+ const numberMatchesList = value.match(/\d+/);
119
+ // If "numberMatchesList" not null (has matches)
120
+ if (numberMatchesList) {
121
+ // Parse module value to px value
122
+ const valueModule = parseFloat(numberMatchesList[0]);
123
+ const valuePx = valueModule * 8;
124
+ value = `${valuePx}px`;
125
+ }
126
+ }
127
+ } else {
128
+ // Some properties doesn't have any units
129
+ const ignorePX = ['zIndex', 'order', 'flexGrow'].includes(styleAttributeKey);
130
+ if (!ignorePX) {
131
+ // Add px to non-unit value
132
+ value = `${value}px`;
133
+ }
114
134
  }
115
135
  if (styleAttributeKey.includes('Horizontal')) {
116
136
  const keyLeft = styleAttributeKey.replace('Horizontal', 'Left');
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import type { iChoiceConfig } from './Choice.interface';
1
+ import type { iChoiceConfig, iChoiceProps } from './Choice.interface';
3
2
  declare const choiceConfig: iChoiceConfig;
4
- declare const Choice: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
3
+ declare function Choice(props: iChoiceProps): import("react/jsx-runtime").JSX.Element;
5
4
  export { Choice, choiceConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/ui",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "description": "UI components (Modal, Loader, Popup, etc)",
5
5
  "keywords": [
6
6
  "Modal",
@@ -90,7 +90,7 @@
90
90
  "@itcase/icons": "^1.0.18",
91
91
  "clsx": "^2.1.1",
92
92
  "date-fns": "^4.1.0",
93
- "framer-motion": "^12.0.1",
93
+ "framer-motion": "^12.0.5",
94
94
  "js-cookie": "^3.0.5",
95
95
  "lodash": "^4.17.21",
96
96
  "rc-slider": "^11.1.8",
@@ -107,15 +107,15 @@
107
107
  "react-responsive": "^10.0.0",
108
108
  "react-scroll": "^1.9.0",
109
109
  "react-scrollbars-custom": "^4.1.1",
110
- "react-select": "^5.9.0",
110
+ "react-select": "^5.10.0",
111
111
  "swiper": "^11.2.1",
112
112
  "uuid": "^11.0.5"
113
113
  },
114
114
  "devDependencies": {
115
- "@babel/core": "^7.26.0",
115
+ "@babel/core": "^7.26.7",
116
116
  "@babel/eslint-parser": "^7.26.5",
117
117
  "@babel/eslint-plugin": "^7.25.9",
118
- "@babel/preset-env": "^7.26.0",
118
+ "@babel/preset-env": "^7.26.7",
119
119
  "@babel/preset-react": "^7.26.3",
120
120
  "@commitlint/cli": "^19.6.1",
121
121
  "@commitlint/config-conventional": "^19.6.0",
@@ -132,14 +132,14 @@
132
132
  "@semantic-release/changelog": "^6.0.3",
133
133
  "@semantic-release/git": "^10.0.1",
134
134
  "@semantic-release/release-notes-generator": "14.0.3",
135
- "@storybook/addon-essentials": "^8.5.0",
136
- "@storybook/addon-interactions": "^8.5.0",
135
+ "@storybook/addon-essentials": "^8.5.1",
136
+ "@storybook/addon-interactions": "^8.5.1",
137
137
  "@storybook/addon-styling-webpack": "^1.0.1",
138
- "@storybook/addon-themes": "^8.5.0",
138
+ "@storybook/addon-themes": "^8.5.1",
139
139
  "@storybook/addon-webpack5-compiler-swc": "^2.0.0",
140
- "@storybook/blocks": "^8.5.0",
141
- "@storybook/react": "^8.5.0",
142
- "@storybook/react-webpack5": "^8.5.0",
140
+ "@storybook/blocks": "^8.5.1",
141
+ "@storybook/react": "^8.5.1",
142
+ "@storybook/react-webpack5": "^8.5.1",
143
143
  "@types/js-cookie": "^3.0.6",
144
144
  "@types/lodash": "^4.17.14",
145
145
  "@types/react": "^19",
@@ -152,9 +152,9 @@
152
152
  "babel-plugin-react-docgen": "^4.2.1",
153
153
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
154
154
  "conventional-changelog-conventionalcommits": "^8.0.0",
155
- "eslint": "9.18.0",
155
+ "eslint": "9.19.0",
156
156
  "husky": "^9.1.7",
157
- "lint-staged": "^15.4.1",
157
+ "lint-staged": "^15.4.3",
158
158
  "npm": "^11.0.0",
159
159
  "postcss": "^8.5.1",
160
160
  "postcss-aspect-ratio-polyfill": "^2.0.0",
@@ -178,14 +178,14 @@
178
178
  "postcss-pxtorem": "^6.1.0",
179
179
  "postcss-sort-media-queries": "^5.2.0",
180
180
  "prettier": "^3.4.2",
181
- "rollup": "^4.31.0",
181
+ "rollup": "^4.32.0",
182
182
  "rollup-plugin-copy": "^3.5.0",
183
183
  "rollup-plugin-dts": "^6.1.1",
184
184
  "rollup-plugin-peer-deps-external": "^2.2.4",
185
185
  "rollup-preserve-directives": "^1.1.3",
186
186
  "semantic-release": "^24.2.1",
187
- "storybook": "^8.5.0",
188
- "stylelint": "^16.13.2",
187
+ "storybook": "^8.5.1",
188
+ "stylelint": "^16.14.0",
189
189
  "typescript": "^5.7.3"
190
190
  }
191
191
  }