@itcase/ui 1.0.83 → 1.0.84

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.
@@ -80,11 +80,11 @@ function Badge(props) {
80
80
  styles: badgeStyles
81
81
  } = useStyles.useStyles(props);
82
82
  return /*#__PURE__*/React__default.default.createElement("div", {
83
- style: badgeStyles,
84
- className: clsx__default.default(className, 'badge', !value && 'badge_type_status', borderColorClass, borderColorHoverClass, borderWidthClass, borderTypeClass, fillClass || badgeConfig.appearance[appearance] && `fill_${badgeConfig.appearance[appearance].fillClass}`?.replace(/([A-Z])/g, '-$1').toLowerCase(), positionClass, sizeClass, shapeClass)
83
+ className: clsx__default.default(className, 'badge', !value && 'badge_type_status', borderColorClass, borderColorHoverClass, borderWidthClass, borderTypeClass, fillClass || badgeConfig.appearance[appearance] && `fill_${badgeConfig.appearance[appearance].fillClass}`?.replace(/([A-Z])/g, '-$1').toLowerCase(), positionClass, sizeClass, shapeClass),
84
+ style: badgeStyles
85
85
  }, children || value && /*#__PURE__*/React__default.default.createElement(index.Text, {
86
86
  size: textSize,
87
- textColor: textColor || badgeConfig.appearance[appearance] && badgeConfig.appearance[appearance].textColor?.replace(/([A-Z])/g, '-$1').toLowerCase()
87
+ textColor: textColor || badgeConfig.appearance[appearance]?.textColor
88
88
  }, value));
89
89
  }
90
90
  Badge.propTypes = {
@@ -153,15 +153,15 @@ const Button = /*#__PURE__*/React__default.default.forwardRef(function Button(pr
153
153
  set: loaderSet
154
154
  }), before, (iconBefore || iconBeforeSrc) && /*#__PURE__*/React__default.default.createElement(index$2.Icon, {
155
155
  className: "button__icon_before",
156
- iconFill: iconBeforeFill || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].iconBeforeFill?.replace(/([A-Z])/g, '-$1').toLowerCase(),
157
- iconStroke: iconBeforeStroke || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].iconBeforeStroke?.replace(/([A-Z])/g, '-$1').toLowerCase(),
156
+ iconFill: iconBeforeFill || buttonConfig.appearance[appearance]?.iconBeforeFill,
157
+ iconStroke: iconBeforeStroke || buttonConfig.appearance[appearance]?.iconBeforeStroke,
158
158
  imageSrc: iconBeforeSrc,
159
159
  size: iconBeforeSize,
160
160
  SvgImage: iconBefore
161
161
  }), (icon || iconSrc) && /*#__PURE__*/React__default.default.createElement(index$2.Icon, {
162
162
  className: "button__icon",
163
- iconFill: iconFill || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].iconFill?.replace(/([A-Z])/g, '-$1').toLowerCase(),
164
- iconStroke: iconStroke || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].iconStroke?.replace(/([A-Z])/g, '-$1').toLowerCase(),
163
+ iconFill: iconFill || buttonConfig.appearance[appearance]?.iconFill,
164
+ iconStroke: iconStroke || buttonConfig.appearance[appearance]?.iconStroke,
165
165
  imageSrc: iconSrc,
166
166
  size: iconSize,
167
167
  SvgImage: icon
@@ -169,13 +169,13 @@ const Button = /*#__PURE__*/React__default.default.forwardRef(function Button(pr
169
169
  className: "button__label",
170
170
  size: labelTextSize,
171
171
  style: labelStyles,
172
- textColor: labelTextColor || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].labelTextColor?.replace(/([A-Z])/g, '-$1').toLowerCase(),
173
- textColorHover: labelTextColorHover || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].labelTextColorHover?.replace(/([A-Z])/g, '-$1').toLowerCase(),
172
+ textColor: labelTextColor || buttonConfig.appearance[appearance]?.labelTextColor,
173
+ textColorHover: labelTextColorHover || buttonConfig.appearance[appearance]?.labelTextColorHover,
174
174
  textWrap: labelTextWrap
175
175
  }, children || label), (iconAfter || iconAfterSrc) && /*#__PURE__*/React__default.default.createElement(index$2.Icon, {
176
176
  className: "button__icon_after",
177
- iconFill: iconAfterFill || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].iconAfterFill?.replace(/([A-Z])/g, '-$1').toLowerCase(),
178
- iconStroke: iconAfterStroke || buttonConfig.appearance[appearance] && buttonConfig.appearance[appearance].iconAfterStroke?.replace(/([A-Z])/g, '-$1').toLowerCase(),
177
+ iconFill: iconAfterFill || buttonConfig.appearance[appearance]?.iconAfterFill,
178
+ iconStroke: iconAfterStroke || buttonConfig.appearance[appearance]?.iconAfterStroke,
179
179
  imageSrc: iconAfterSrc,
180
180
  size: iconAfterSize,
181
181
  SvgImage: iconAfter
@@ -200,7 +200,7 @@ Button.propTypes = {
200
200
  iconFill: PropTypes__default.default.string,
201
201
  iconSize: PropTypes__default.default.string,
202
202
  iconStroke: PropTypes__default.default.string,
203
- isDisabled: PropTypes__default.default.string,
203
+ isDisabled: PropTypes__default.default.bool,
204
204
  label: PropTypes__default.default.string,
205
205
  labelTextColor: PropTypes__default.default.string,
206
206
  labelTextColorHover: PropTypes__default.default.string,
@@ -420,7 +420,7 @@ Button.__docgenInfo = {
420
420
  "isDisabled": {
421
421
  "description": "",
422
422
  "type": {
423
- "name": "string"
423
+ "name": "bool"
424
424
  },
425
425
  "required": false
426
426
  },
@@ -62,8 +62,8 @@ function Card(props) {
62
62
  propsKey: 'width'
63
63
  });
64
64
  return /*#__PURE__*/React__default.default.createElement("div", {
65
- onClick: onClick,
66
- className: clsx__default.default(className, 'card', shapeClass, size && `card_size_${size}`, type && `card_type_${type}`, widthClass)
65
+ className: clsx__default.default(className, 'card', shapeClass, size && `card_size_${size}`, type && `card_type_${type}`, widthClass),
66
+ onClick: onClick
67
67
  }, /*#__PURE__*/React__default.default.createElement("div", {
68
68
  className: "card__wrapper"
69
69
  }, image, src && /*#__PURE__*/React__default.default.createElement(index.Image, {
@@ -185,7 +185,7 @@ Cell.propTypes = {
185
185
  title: PropTypes__default.default.string,
186
186
  titleTextColor: PropTypes__default.default.string,
187
187
  titleTextSize: PropTypes__default.default.oneOf(size.default),
188
- value: PropTypes__default.default.string,
188
+ value: PropTypes__default.default.oneOfType([PropTypes__default.default.element, PropTypes__default.default.string]),
189
189
  valueTextColor: PropTypes__default.default.string,
190
190
  valueTextSize: PropTypes__default.default.oneOf(size.default),
191
191
  onClick: PropTypes__default.default.func,
@@ -349,7 +349,12 @@ Cell.__docgenInfo = {
349
349
  "value": {
350
350
  "description": "",
351
351
  "type": {
352
- "name": "string"
352
+ "name": "union",
353
+ "value": [{
354
+ "name": "element"
355
+ }, {
356
+ "name": "string"
357
+ }]
353
358
  },
354
359
  "required": false
355
360
  },
@@ -28,7 +28,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
28
28
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
29
29
  var clsx__default = /*#__PURE__*/_interopDefault(clsx);
30
30
 
31
- const Choice = /*#__PURE__*/React__default.default.forwardRef((props, ref) => {
31
+ const Choice = /*#__PURE__*/React__default.default.forwardRef(function Choice(props, ref) {
32
32
  const {
33
33
  name,
34
34
  className,
@@ -42,10 +42,15 @@ const Choice = /*#__PURE__*/React__default.default.forwardRef((props, ref) => {
42
42
  labelTextActiveColor,
43
43
  labelTextSize,
44
44
  before,
45
- after
45
+ after,
46
+ isMultiple
46
47
  } = props;
47
48
  const controlRef = React.useRef(null);
48
49
  const optionsRefs = React.useMemo(() => new Map(options.map(item => [item.value, /*#__PURE__*/React.createRef()])), [options]);
50
+ const onChange = React.useCallback((event, item) => {
51
+ const isChecked = isMultiple ? event.target.checked : true;
52
+ setActiveSegment && setActiveSegment(item, isChecked);
53
+ }, [isMultiple, setActiveSegment]);
49
54
  const borderColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
50
55
  prefix: 'border-color_',
51
56
  propsKey: 'borderColor'
@@ -86,31 +91,44 @@ const Choice = /*#__PURE__*/React__default.default.forwardRef((props, ref) => {
86
91
  }, /*#__PURE__*/React__default.default.createElement("input", {
87
92
  checked: item.value === active.value,
88
93
  className: "choice__item-radio",
89
- id: item.label,
94
+ id: `${name}-${item.value}`,
90
95
  name: name,
91
- type: "radio",
96
+ type: isMultiple ? 'checkbox' : 'radio',
92
97
  value: item.value,
93
- onChange: () => setActiveSegment && setActiveSegment(item)
98
+ onChange: event => onChange(event, item)
94
99
  }), /*#__PURE__*/React__default.default.createElement("label", {
95
100
  className: clsx__default.default('choice__item-label'),
96
- htmlFor: item.label
101
+ htmlFor: `${name}-${item.value}`
97
102
  }, before, /*#__PURE__*/React__default.default.createElement(index.Text, {
98
103
  size: labelTextSize,
99
104
  textColor: item.value === active.value ? labelTextActiveColor : labelTextColor
100
105
  }, item.label), after)))));
101
106
  });
102
- Choice.displayName = 'Choice';
103
107
  Choice.propTypes = {
104
- active: PropTypes__default.default.object,
108
+ active: PropTypes__default.default.shape({
109
+ value: PropTypes__default.default.string,
110
+ label: PropTypes__default.default.string
111
+ }),
112
+ after: PropTypes__default.default.any,
113
+ before: PropTypes__default.default.any,
105
114
  className: PropTypes__default.default.string,
106
- fill: PropTypes__default.default.string,
115
+ isMultiple: PropTypes__default.default.bool,
116
+ labelTextActiveColor: PropTypes__default.default.string,
117
+ labelTextColor: PropTypes__default.default.string,
118
+ labelTextSize: PropTypes__default.default.string,
107
119
  name: PropTypes__default.default.string,
108
- options: PropTypes__default.default.array,
120
+ options: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
121
+ value: PropTypes__default.default.string,
122
+ label: PropTypes__default.default.string
123
+ })),
124
+ set: PropTypes__default.default.string,
109
125
  setActiveSegment: PropTypes__default.default.func,
126
+ size: PropTypes__default.default.string,
110
127
  type: PropTypes__default.default.string
111
128
  };
112
129
  Choice.defaultProps = {
113
- active: {}
130
+ active: {},
131
+ options: []
114
132
  };
115
133
  Choice.__docgenInfo = {
116
134
  "description": "",
@@ -124,7 +142,55 @@ Choice.__docgenInfo = {
124
142
  },
125
143
  "description": "",
126
144
  "type": {
127
- "name": "object"
145
+ "name": "shape",
146
+ "value": {
147
+ "value": {
148
+ "name": "string",
149
+ "required": false
150
+ },
151
+ "label": {
152
+ "name": "string",
153
+ "required": false
154
+ }
155
+ }
156
+ },
157
+ "required": false
158
+ },
159
+ "options": {
160
+ "defaultValue": {
161
+ "value": "[]",
162
+ "computed": false
163
+ },
164
+ "description": "",
165
+ "type": {
166
+ "name": "arrayOf",
167
+ "value": {
168
+ "name": "shape",
169
+ "value": {
170
+ "value": {
171
+ "name": "string",
172
+ "required": false
173
+ },
174
+ "label": {
175
+ "name": "string",
176
+ "required": false
177
+ }
178
+ }
179
+ }
180
+ },
181
+ "required": false
182
+ },
183
+ "after": {
184
+ "description": "",
185
+ "type": {
186
+ "name": "any"
187
+ },
188
+ "required": false
189
+ },
190
+ "before": {
191
+ "description": "",
192
+ "type": {
193
+ "name": "any"
128
194
  },
129
195
  "required": false
130
196
  },
@@ -135,7 +201,28 @@ Choice.__docgenInfo = {
135
201
  },
136
202
  "required": false
137
203
  },
138
- "fill": {
204
+ "isMultiple": {
205
+ "description": "",
206
+ "type": {
207
+ "name": "bool"
208
+ },
209
+ "required": false
210
+ },
211
+ "labelTextActiveColor": {
212
+ "description": "",
213
+ "type": {
214
+ "name": "string"
215
+ },
216
+ "required": false
217
+ },
218
+ "labelTextColor": {
219
+ "description": "",
220
+ "type": {
221
+ "name": "string"
222
+ },
223
+ "required": false
224
+ },
225
+ "labelTextSize": {
139
226
  "description": "",
140
227
  "type": {
141
228
  "name": "string"
@@ -149,10 +236,10 @@ Choice.__docgenInfo = {
149
236
  },
150
237
  "required": false
151
238
  },
152
- "options": {
239
+ "set": {
153
240
  "description": "",
154
241
  "type": {
155
- "name": "array"
242
+ "name": "string"
156
243
  },
157
244
  "required": false
158
245
  },
@@ -163,6 +250,13 @@ Choice.__docgenInfo = {
163
250
  },
164
251
  "required": false
165
252
  },
253
+ "size": {
254
+ "description": "",
255
+ "type": {
256
+ "name": "string"
257
+ },
258
+ "required": false
259
+ },
166
260
  "type": {
167
261
  "description": "",
168
262
  "type": {
@@ -56,8 +56,19 @@ var OTPInput = function (_a) {
56
56
  };
57
57
  var handleInputChange = function (event) {
58
58
  var nativeEvent = event.nativeEvent;
59
- if (!isInputValueValid(event.target.value)) {
60
- // @ts-expect-error - This was added previosly to handle and edge case
59
+ var value = event.target.value;
60
+ if (!isInputValueValid(value)) {
61
+ // Pasting from the native autofill suggestion on a mobile device can pass
62
+ // the pasted string as one long input to one of the cells. This ensures
63
+ // that we handle the full input and not just the first character.
64
+ if (value.length === numInputs) {
65
+ var hasInvalidInput = value.split('').some(function (cellInput) { return !isInputValueValid(cellInput); });
66
+ if (!hasInvalidInput) {
67
+ handleOTPChange(value.split(''));
68
+ focusInput(numInputs - 1);
69
+ }
70
+ }
71
+ // @ts-expect-error - This was added previously to handle and edge case
61
72
  // for dealing with keyCode "229 Unidentified" on Android. Check if this is
62
73
  // still needed.
63
74
  if (nativeEvent.data === null && nativeEvent.inputType === 'deleteContentBackward') {
@@ -164,7 +175,6 @@ var OTPInput = function (_a) {
164
175
  onKeyDown: handleKeyDown,
165
176
  onPaste: handlePaste,
166
177
  autoComplete: 'off',
167
- maxLength: 1,
168
178
  'aria-label': "Please enter OTP character ".concat(index + 1),
169
179
  style: Object.assign(!skipDefaultStyles ? { width: '1em', textAlign: 'center' } : {}, isStyleObject(inputStyle) ? inputStyle : {}),
170
180
  className: typeof inputStyle === 'string' ? inputStyle : undefined,