@ozen-ui/kit 0.12.0 → 0.13.1

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.
Files changed (39) hide show
  1. package/__inner__/cjs/components/DataList/DataList.css +55 -28
  2. package/__inner__/cjs/components/DataList/DataList.d.ts +2 -2
  3. package/__inner__/cjs/components/DataList/DataList.js +62 -24
  4. package/__inner__/cjs/components/DataList/DataListProvider.d.ts +8 -10
  5. package/__inner__/cjs/components/DataList/DataListProvider.js +0 -2
  6. package/__inner__/cjs/components/DataList/components/DataListOption.d.ts +5 -18
  7. package/__inner__/cjs/components/DataList/components/DataListOption.js +14 -22
  8. package/__inner__/cjs/components/DataList/types.d.ts +19 -12
  9. package/__inner__/cjs/components/DataList/types.js +5 -0
  10. package/__inner__/cjs/components/DataList/useDataListNavigation.d.ts +15 -6
  11. package/__inner__/cjs/components/DataList/useDataListNavigation.js +68 -21
  12. package/__inner__/cjs/components/FieldControl/FieldControl.css +0 -15
  13. package/__inner__/cjs/components/Input/Input.css +0 -7
  14. package/__inner__/cjs/components/Input/Input.js +5 -5
  15. package/__inner__/cjs/components/Input/types.d.ts +3 -3
  16. package/__inner__/cjs/components/InputNumber/InputNumber.js +10 -10
  17. package/__inner__/cjs/components/InputNumber/types.d.ts +2 -0
  18. package/__inner__/cjs/components/Textarea/types.d.ts +1 -3
  19. package/__inner__/cjs/hooks/useControlled/useControlled.js +3 -3
  20. package/__inner__/esm/components/DataList/DataList.css +55 -28
  21. package/__inner__/esm/components/DataList/DataList.d.ts +2 -2
  22. package/__inner__/esm/components/DataList/DataList.js +63 -25
  23. package/__inner__/esm/components/DataList/DataListProvider.d.ts +8 -10
  24. package/__inner__/esm/components/DataList/DataListProvider.js +0 -2
  25. package/__inner__/esm/components/DataList/components/DataListOption.d.ts +5 -18
  26. package/__inner__/esm/components/DataList/components/DataListOption.js +16 -23
  27. package/__inner__/esm/components/DataList/types.d.ts +19 -12
  28. package/__inner__/esm/components/DataList/types.js +2 -1
  29. package/__inner__/esm/components/DataList/useDataListNavigation.d.ts +15 -6
  30. package/__inner__/esm/components/DataList/useDataListNavigation.js +69 -22
  31. package/__inner__/esm/components/FieldControl/FieldControl.css +0 -15
  32. package/__inner__/esm/components/Input/Input.css +0 -7
  33. package/__inner__/esm/components/Input/Input.js +5 -5
  34. package/__inner__/esm/components/Input/types.d.ts +3 -3
  35. package/__inner__/esm/components/InputNumber/InputNumber.js +10 -10
  36. package/__inner__/esm/components/InputNumber/types.d.ts +2 -0
  37. package/__inner__/esm/components/Textarea/types.d.ts +1 -3
  38. package/__inner__/esm/hooks/useControlled/useControlled.js +3 -3
  39. package/package.json +1 -1
@@ -24,9 +24,6 @@
24
24
 
25
25
  text-transform: var(--typography-text-2xs-text_transform, none);
26
26
  }
27
- .FieldControl_size_2xs .FieldInput::-webkit-calendar-picker-indicator {
28
- inset-inline-end: -25px;
29
- }
30
27
  .FieldControl_size_xs {
31
28
  --textfield-gutter-x: 12px;
32
29
  --textfield-input-height: 40px;
@@ -39,9 +36,6 @@
39
36
 
40
37
  text-transform: var(--typography-text-xs-text_transform, none);
41
38
  }
42
- .FieldControl_size_xs .FieldInput::-webkit-calendar-picker-indicator {
43
- inset-inline-end: -25px;
44
- }
45
39
  .FieldControl_size_s {
46
40
  --textfield-gutter-x: 16px;
47
41
  --textfield-input-height: 48px;
@@ -54,9 +48,6 @@
54
48
 
55
49
  text-transform: var(--typography-text-s-text_transform, none);
56
50
  }
57
- .FieldControl_size_s .FieldInput::-webkit-calendar-picker-indicator {
58
- inset-inline-end: -30px;
59
- }
60
51
  .FieldControl_size_m {
61
52
  --textfield-gutter-x: 20px;
62
53
  --textfield-input-height: 56px;
@@ -69,9 +60,6 @@
69
60
 
70
61
  text-transform: var(--typography-text-m-text_transform, none);
71
62
  }
72
- .FieldControl_size_m .FieldInput::-webkit-calendar-picker-indicator {
73
- inset-inline-end: -34px;
74
- }
75
63
  .FieldControl_size_l {
76
64
  --textfield-gutter-x: 24px;
77
65
  --textfield-input-height: 64px;
@@ -84,9 +72,6 @@
84
72
 
85
73
  text-transform: var(--typography-text-l-text_transform, none);
86
74
  }
87
- .FieldControl_size_l .FieldInput::-webkit-calendar-picker-indicator {
88
- inset-inline-end: -39px;
89
- }
90
75
  .FieldControl_hasLabel.FieldControl_size_2xs {
91
76
  --textfield-input-padding: 8px 0 8px;
92
77
  }
@@ -44,13 +44,6 @@
44
44
  appearance: none;
45
45
  margin: 0;
46
46
  }
47
- .Input-Field::-webkit-calendar-picker-indicator {
48
- opacity: 0;
49
- position: absolute;
50
- inset-block-start: 50%;
51
- transform: translateY(-50%);
52
- cursor: pointer;
53
- }
54
47
  .Input-Field[type='number'] {
55
48
  -webkit-appearance: textfield;
56
49
  -moz-appearance: textfield;
@@ -21,16 +21,16 @@ exports.Input = (0, react_1.forwardRef)(function (inProps, ref) {
21
21
  props: inProps,
22
22
  name: 'Input',
23
23
  });
24
- var _a = props.size, size = _a === void 0 ? constants_1.INPUT_DEFAULT_SIZE : _a, label = props.label, error = props.error, autoFocus = props.autoFocus, placeholder = props.placeholder, id = props.id, name = props.name, type = props.type, renderLeft = props.renderLeft, renderRight = props.renderRight, inputRef = props.inputRef, fullWidth = props.fullWidth, disabled = props.disabled, hint = props.hint, required = props.required, className = props.className, inputProps = props.inputProps, value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, labelProps = props.labelProps, labelRef = props.labelRef, other = tslib_1.__rest(props, ["size", "label", "error", "autoFocus", "placeholder", "id", "name", "type", "renderLeft", "renderRight", "inputRef", "fullWidth", "disabled", "hint", "required", "className", "inputProps", "value", "defaultValue", "onChange", "labelProps", "labelRef"]);
25
- var labelInnerRef = (0, react_1.useRef)(null);
24
+ var _a = props.size, size = _a === void 0 ? constants_1.INPUT_DEFAULT_SIZE : _a, label = props.label, error = props.error, autoFocus = props.autoFocus, placeholder = props.placeholder, id = props.id, name = props.name, type = props.type, renderLeft = props.renderLeft, renderRight = props.renderRight, inputRef = props.inputRef, fullWidth = props.fullWidth, disabled = props.disabled, hint = props.hint, required = props.required, className = props.className, inputProps = props.inputProps, value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, labelProps = props.labelProps, labelRef = props.labelRef, bodyProps = props.bodyProps, other = tslib_1.__rest(props, ["size", "label", "error", "autoFocus", "placeholder", "id", "name", "type", "renderLeft", "renderRight", "inputRef", "fullWidth", "disabled", "hint", "required", "className", "inputProps", "value", "defaultValue", "onChange", "labelProps", "labelRef", "bodyProps"]);
25
+ var bodyInnerRef = (0, react_1.useRef)(null);
26
26
  var fieldInnerRef = (0, react_1.useRef)(null);
27
27
  /* Хук useEventListener необходим для того, чтобы при нажатии на кнопку мыши
28
- * внутри HTML-элемента label - фокус не переходил на body или на цель нажатия кнопки мыши.
28
+ * внутри HTML-элемента label фокус не переходил на body или на цель нажатия кнопки мыши.
29
29
  * Если же нажатие кнопки происходит на самом HTML-элементе input, то мы ничего не делаем,
30
30
  * так как в противном случае мы сломаем возможность выделять текст для копирования.
31
31
  */
32
32
  (0, useEventListener_1.useEventListener)({
33
- element: labelInnerRef,
33
+ element: bodyInnerRef,
34
34
  eventName: 'mousedown',
35
35
  handler: function (e) {
36
36
  var _a;
@@ -41,7 +41,7 @@ exports.Input = (0, react_1.forwardRef)(function (inProps, ref) {
41
41
  },
42
42
  });
43
43
  return (react_1.default.createElement(FieldControl_1.FieldControl, tslib_1.__assign({ size: size, error: error, disabled: disabled, required: required, fullWidth: fullWidth }, other, { ref: ref, className: (0, exports.cnInput)({}, [className]) }),
44
- react_1.default.createElement("label", { className: (0, exports.cnInput)('Body'), ref: labelInnerRef },
44
+ react_1.default.createElement("label", tslib_1.__assign({}, bodyProps, { className: (0, exports.cnInput)('Body'), ref: (0, useMultiRef_1.useMultiRef)([bodyProps === null || bodyProps === void 0 ? void 0 : bodyProps.ref, bodyInnerRef]) }),
45
45
  react_1.default.createElement(FieldIcon_1.FieldIcon, { icon: renderLeft }),
46
46
  react_1.default.createElement("div", { className: (0, exports.cnInput)('FieldContainer') },
47
47
  react_1.default.createElement(FieldLabel_1.FieldLabel, tslib_1.__assign({}, labelProps, { ref: labelRef || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref), className: labelProps === null || labelProps === void 0 ? void 0 : labelProps.className }), label),
@@ -1,4 +1,4 @@
1
- import type { ComponentPropsWithRef, ComponentRef, Ref } from 'react';
1
+ import type { ComponentPropsWithRef, Ref } from 'react';
2
2
  import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
3
3
  import type { FIELD_CONTROL_DEFAULT_TAG } from '../FieldControl';
4
4
  import type { FieldIconProps } from '../FieldIcon';
@@ -63,8 +63,8 @@ export type InputProps = Omit<ComponentPropsWithRef<typeof FIELD_CONTROL_DEFAULT
63
63
  };
64
64
  /** Свойства FieldLabel */
65
65
  labelProps?: FieldLabelProps;
66
- /** Ссылка на корневой DOM-элемент компонента */
67
- ref?: ComponentRef<typeof FIELD_CONTROL_DEFAULT_TAG>;
66
+ /** Cвойства Body */
67
+ bodyProps?: ComponentPropsWithRef<'label'>;
68
68
  /** data-атрибут для тестирования */
69
69
  'data-testid'?: string;
70
70
  } & InputPropsDeprecated;
@@ -24,7 +24,7 @@ exports.InputNumber = (0, react_1.forwardRef)(function (inProps, ref) {
24
24
  props: inProps,
25
25
  name: 'InputNumber',
26
26
  });
27
- var _a = props.size, size = _a === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MAX : _k, label = props.label, placeholder = props.placeholder, id = props.id, name = props.name, renderLeft = props.renderLeft, renderRight = props.renderRight, hint = props.hint, className = props.className, inputProps = props.inputProps, valueProp = props.value, onChange = props.onChange, labelRef = props.labelRef, labelProps = props.labelProps, other = tslib_1.__rest(props, ["size", "step", "autoFocus", "error", "required", "disabled", "fullWidth", "defaultValue", "min", "max", "label", "placeholder", "id", "name", "renderLeft", "renderRight", "hint", "className", "inputProps", "value", "onChange", "labelRef", "labelProps"]);
27
+ var _a = props.size, size = _a === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MAX : _k, label = props.label, placeholder = props.placeholder, id = props.id, name = props.name, renderLeft = props.renderLeft, renderRight = props.renderRight, hint = props.hint, className = props.className, inputProps = props.inputProps, valueProp = props.value, onChange = props.onChange, labelRef = props.labelRef, labelProps = props.labelProps, bodyProps = props.bodyProps, other = tslib_1.__rest(props, ["size", "step", "autoFocus", "error", "required", "disabled", "fullWidth", "defaultValue", "min", "max", "label", "placeholder", "id", "name", "renderLeft", "renderRight", "hint", "className", "inputProps", "value", "onChange", "labelRef", "labelProps", "bodyProps"]);
28
28
  var _l = tslib_1.__read((0, react_1.useState)(false), 2), focused = _l[0], setFocused = _l[1];
29
29
  var _m = tslib_1.__read((0, react_1.useState)(null), 2), timeoutId = _m[0], setTimeoutId = _m[1];
30
30
  var _o = tslib_1.__read((0, react_1.useState)(null), 2), countDirection = _o[0], setCountDirection = _o[1];
@@ -34,8 +34,8 @@ exports.InputNumber = (0, react_1.forwardRef)(function (inProps, ref) {
34
34
  state: 'value',
35
35
  defaultValue: defaultValue,
36
36
  }), 2), valueState = _p[0], setValueState = _p[1];
37
- var labelElemRef = (0, react_1.useRef)(null);
38
- var fieldRef = (0, react_1.useRef)(null);
37
+ var bodyInnerRef = (0, react_1.useRef)(null);
38
+ var fieldInnerRef = (0, react_1.useRef)(null);
39
39
  var filled = (0, utils_1.isValidValue)(valueState);
40
40
  var handleChange = function (event) {
41
41
  if (disabled)
@@ -93,18 +93,18 @@ exports.InputNumber = (0, react_1.forwardRef)(function (inProps, ref) {
93
93
  (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(inputProps, event);
94
94
  };
95
95
  /* Хук useEventListener необходим для того, чтобы при нажатии на кнопку мыши
96
- * внутри HTML-элемента label - фокус не переходил на body или на цель нажатия кнопки мыши.
96
+ * внутри HTML-элемента label фокус не переходил на body или на цель нажатия кнопки мыши.
97
97
  * Если же нажатие кнопки происходит на самом HTML-элементе input, то мы ничего не делаем,
98
98
  * так как в противном случае мы сломаем возможность выделять текст для копирования.
99
99
  */
100
100
  (0, useEventListener_1.useEventListener)({
101
- element: labelElemRef,
101
+ element: bodyInnerRef,
102
102
  eventName: 'mousedown',
103
103
  handler: function (e) {
104
104
  var _a;
105
- if (e.target !== fieldRef.current) {
105
+ if (e.target !== fieldInnerRef.current) {
106
106
  e.preventDefault();
107
- (_a = fieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
107
+ (_a = fieldInnerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
108
108
  }
109
109
  },
110
110
  });
@@ -135,13 +135,13 @@ exports.InputNumber = (0, react_1.forwardRef)(function (inProps, ref) {
135
135
  hasLabel: !!label,
136
136
  focused: focused,
137
137
  }, [className]) }),
138
- react_1.default.createElement("label", { ref: labelElemRef, className: (0, exports.cnInputNumber)('Body') },
138
+ react_1.default.createElement("label", tslib_1.__assign({}, bodyProps, { className: (0, exports.cnInputNumber)('Body'), ref: (0, useMultiRef_1.useMultiRef)([bodyProps === null || bodyProps === void 0 ? void 0 : bodyProps.ref, bodyInnerRef]) }),
139
139
  react_1.default.createElement(FieldIcon_1.FieldIcon, { className: (0, exports.cnInputNumber)('RenderLeft'), icon: renderLeft, size: size }),
140
140
  react_1.default.createElement("div", { className: (0, exports.cnInputNumber)('FieldContainer') },
141
- label && (react_1.default.createElement(FieldLabel_1.FieldLabel, tslib_1.__assign({ filled: filled, focused: focused, required: required, disabled: disabled, size: size }, labelProps, { className: (0, exports.cnInputNumber)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelRef }), label)),
141
+ react_1.default.createElement(FieldLabel_1.FieldLabel, tslib_1.__assign({ filled: filled, focused: focused, required: required, disabled: disabled, size: size }, labelProps, { className: (0, exports.cnInputNumber)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelRef }), label),
142
142
  react_1.default.createElement("input", tslib_1.__assign({ id: id, name: name, autoFocus: autoFocus, disabled: disabled, value: valueState, required: required, placeholder: placeholder, className: (0, exports.cnInputNumber)('Field', { filled: filled }, [
143
143
  inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
144
- ]), min: min, max: max, step: step }, inputProps, { type: "number", onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleKeyDown, ref: (0, useMultiRef_1.useMultiRef)([inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, fieldRef]) }))),
144
+ ]), min: min, max: max, step: step }, inputProps, { type: "number", onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleKeyDown, ref: (0, useMultiRef_1.useMultiRef)([inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, fieldInnerRef]) }))),
145
145
  react_1.default.createElement(FieldIcon_1.FieldIcon, { className: (0, exports.cnInputNumber)('RenderRight'), icon: renderRight, size: size }),
146
146
  react_1.default.createElement("span", { className: (0, exports.cnInputNumber)('Controls') },
147
147
  react_1.default.createElement(IconButton_1.IconButton, { tabIndex: -1, size: size, className: (0, exports.cnInputNumber)('Increment'), icon: icons_1.SortUpIcon, onMouseDown: handleMouseDown('increment'), disabled: disabled, "aria-label": "increment", type: "button", variant: "ghost" }),
@@ -52,6 +52,8 @@ export type InputNumberProps = {
52
52
  labelRef?: FieldLabelProps['ref'];
53
53
  /** Свойства FieldLabel */
54
54
  labelProps?: FieldLabelProps;
55
+ /** Cвойства Body */
56
+ bodyProps?: ComponentPropsWithRef<'label'>;
55
57
  /** Шаг инкремента/декремента */
56
58
  step?: number;
57
59
  /** Минимально допустимое значение */
@@ -1,4 +1,4 @@
1
- import type { Ref, ComponentPropsWithRef, ComponentRef } from 'react';
1
+ import type { Ref, ComponentPropsWithRef } from 'react';
2
2
  import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
3
3
  import type { FIELD_CONTROL_DEFAULT_TAG } from '../FieldControl';
4
4
  import type { FieldLabelProps } from '../FieldLabel';
@@ -61,8 +61,6 @@ export type TextareaProps = Omit<ComponentPropsWithRef<typeof FIELD_CONTROL_DEFA
61
61
  };
62
62
  /** Свойства FieldLabel */
63
63
  labelProps?: FieldLabelProps;
64
- /** Ссылка на корневой DOM-элемент компонента */
65
- ref?: ComponentRef<typeof FIELD_CONTROL_DEFAULT_TAG>;
66
64
  /** data-атрибут для тестирования */
67
65
  'data-testid'?: string;
68
66
  } & TextareaPropsDeprecated;
@@ -25,7 +25,7 @@ var useControlled = function (_a) {
25
25
  console.error([
26
26
  "\u00D6zen-UI: \u041F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 '".concat(state, "' \u0443 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430 ").concat(name, " \u043F\u043E\u043C\u0435\u043D\u044F\u043B\u043E\u0441\u044C \u0441 ").concat(isControlled ? '' : 'не', "\u043A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u043C\u043E\u0433\u043E \u043D\u0430 ").concat(isControlled ? 'не' : '', "\u043A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u043C\u043E\u0435."),
27
27
  'Компоненты не должны переключаться с неконтролируемого поведения в контролируемое, или наоборот.',
28
- 'Поведение определяется после первого рендера и является контролируемым, если значение не "undefined"',
28
+ 'Поведение определяется после первого рендера и является контролируемым, если значение не «undefined».',
29
29
  ].join('\n'));
30
30
  }
31
31
  }, [state, name, valueProp]);
@@ -33,8 +33,8 @@ var useControlled = function (_a) {
33
33
  (0, react_1.useEffect)(function () {
34
34
  if (!isControlled && defaultValue_1 !== defaultProp) {
35
35
  console.error([
36
- "\u00D6zen-UI: \u041D\u0435\u043A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u043C\u044B\u0439 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 ".concat(name, " \u0441\u043C\u0435\u043D\u0438\u043B default ").concat(state, " \u043F\u043E\u0441\u043B\u0435 \u043F\u0435\u0440\u0432\u043E\u0439 \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 ").concat(name) +
37
- "\u0415\u0441\u043B\u0438 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043C\u0435\u043D\u044F\u0442\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435\u0441\u044C \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u043C\u044B\u043C \u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435\u043C.",
36
+ "\u00D6zen-UI: \u041D\u0435\u043A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u043C\u044B\u0439 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 ".concat(name, " \u0441\u043C\u0435\u043D\u0438\u043B default ").concat(state, " \u043F\u043E\u0441\u043B\u0435 \u043F\u0435\u0440\u0432\u043E\u0439 \u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 ").concat(name, "."),
37
+ "\u0415\u0441\u043B\u0438 \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043C\u0435\u043D\u044F\u0442\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432\u043E\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435\u0441\u044C \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u043C\u044B\u043C \u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435\u043C.",
38
38
  ].join('\n'));
39
39
  }
40
40
  }, [JSON.stringify(defaultProp)]);
@@ -1,10 +1,10 @@
1
- .DataList {
2
- --scroll-bar-size: 12px;
3
- }
4
- .DataList::-webkit-scrollbar {
1
+ .DataList-List {
2
+ --scroll-bar-size: 12px;
3
+ }
4
+ .DataList-List::-webkit-scrollbar {
5
5
  inline-size: var(--scroll-bar-size);
6
6
  }
7
- .DataList::-webkit-scrollbar-thumb {
7
+ .DataList-List::-webkit-scrollbar-thumb {
8
8
  background-color: var(--color-background-secondary);
9
9
  border-radius: calc(var(--scroll-bar-size) / 2);
10
10
  border: calc(var(--scroll-bar-size) / 4) solid transparent;
@@ -12,56 +12,83 @@
12
12
  border-image: initial;
13
13
  min-block-size: 24px;
14
14
  }
15
- .DataList::-webkit-scrollbar-thumb:hover,
16
- .DataList::-webkit-scrollbar-thumb:active {
15
+ .DataList-List::-webkit-scrollbar-thumb:hover,
16
+ .DataList-List::-webkit-scrollbar-thumb:active {
17
17
  border: calc(var(--scroll-bar-size) / 4) solid transparent;
18
18
  background-clip: padding-box;
19
19
  }
20
- .DataList::-webkit-scrollbar-thumb:hover {
20
+ .DataList-List::-webkit-scrollbar-thumb:hover {
21
21
  background-color: var(--color-background-secondary-hover);
22
22
  }
23
- .DataList::-webkit-scrollbar-thumb:active {
23
+ .DataList-List::-webkit-scrollbar-thumb:active {
24
24
  background-color: var(--color-background-secondary-pressed);
25
25
  }
26
- .DataList::-webkit-scrollbar-corner {
26
+ .DataList-List::-webkit-scrollbar-corner {
27
27
  background: transparent;
28
28
  }
29
- .DataList {
30
- scroll-behavior: smooth;
31
- overflow: hidden auto;
32
- max-block-size: 40vb;
29
+ .DataList-List {
30
+ overflow: hidden auto;
31
+ max-block-size: 40vb;
33
32
  }
34
-
35
33
  .DataList-Option {
36
34
  cursor: pointer;
37
35
  }
38
-
39
- .DataList-Option:not(.DataList-Option_disabled).DataList-Option_highlighted {
40
- background-color: var(--color-background-main-hover);
41
- }
42
-
43
- .DataList-Option:not(.DataList-Option_disabled).DataList-Option_outlined {
36
+ .DataList-Option_focused {
44
37
  box-shadow: inset var(--shadow-outline-focused);
45
38
  }
46
-
39
+ .DataList-Option_highlighted {
40
+ background-color: var(--color-background-main-hover);
41
+ }
47
42
  .DataList-Option_disabled {
48
43
  cursor: not-allowed;
49
44
  }
50
-
51
- .DataList-Option_disabled .ListItemText-TextPrimary {
52
- color: var(--color-content-disabled);
45
+ .DataList-Option_disabled .ListItemText-TextPrimary,
46
+ .DataList-Option_disabled .ListItemText-TextSecondary {
47
+ color: var(--color-content-tertiary);
53
48
  }
54
-
55
49
  .DataList-IconWrapper {
56
50
  min-inline-size: var(--select-check-icon-size);
57
51
  min-block-size: var(--select-check-icon-size);
58
52
  display: flex;
59
53
  }
60
-
61
54
  .DataList-IconWrapper_size_s {
62
55
  --select-check-icon-size: 16px;
63
56
  }
64
-
65
57
  .DataList-IconWrapper_size_m {
66
58
  --select-check-icon-size: 24px;
67
59
  }
60
+ .DataList_animation-enter {
61
+ opacity: 0;
62
+ transform: translate(0, calc(var(--space-s) * -1));
63
+ pointer-events: none;
64
+ }
65
+ .DataList_animation-enter-active {
66
+ opacity: 1;
67
+ transition:
68
+ opacity var(--transition-default),
69
+ transform var(--transition-default);
70
+ transform: translate(0);
71
+ pointer-events: none;
72
+ }
73
+ .DataList_animation-enter-done {
74
+ opacity: 1;
75
+ transform: translate(0);
76
+ }
77
+ .DataList_animation-exit {
78
+ opacity: 1;
79
+ transform: translate(0);
80
+ pointer-events: none;
81
+ }
82
+ .DataList_animation-exit-active {
83
+ opacity: 0;
84
+ transition:
85
+ opacity var(--transition-default),
86
+ transform var(--transition-default);
87
+ transform: translate(0, calc(var(--space-s) * -1));
88
+ pointer-events: none;
89
+ }
90
+ .DataList_animation-exit-done {
91
+ opacity: 0;
92
+ transform: translate(0, calc(var(--space-s) * -1));
93
+ pointer-events: none;
94
+ }
@@ -1,4 +1,4 @@
1
1
  import './DataList.css';
2
- import type { DataListBaseProps } from './index';
2
+ import type { DataListComponent } from './index';
3
3
  export declare const cnDataList: import("@bem-react/classname").ClassNameFormatter;
4
- export declare const DataList: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<DataListBaseProps, "div">;
4
+ export declare const DataList: DataListComponent;
@@ -1,50 +1,88 @@
1
- import { __assign, __read, __rest } from "tslib";
1
+ import { __assign, __read, __rest, __spreadArray } from "tslib";
2
2
  import './DataList.css';
3
- import React, { useRef } from 'react';
3
+ import React from 'react';
4
+ import { useBoolean } from '../../hooks/useBoolean';
4
5
  import { useControlled } from '../../hooks/useControlled';
5
6
  import { useEventListener } from '../../hooks/useEventListener';
6
7
  import { useMultiRef } from '../../hooks/useMultiRef';
7
8
  import { useThemeProps } from '../../hooks/useThemeProps';
8
9
  import { cn } from '../../utils/classname';
9
- import { isKey } from '../../utils/isKey';
10
10
  import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
11
11
  import { List } from '../List';
12
12
  import { Popover } from '../Popover';
13
13
  import { DATA_LIST_DEFAULT_SIZE, DATA_LIST_DEFAULT_OPEN, DATA_LIST_DEFAULT_TAG, } from './constants';
14
14
  import { DataListContext } from './DataListProvider';
15
+ import { isMultipleParams, isNotMultipleParams } from './index';
15
16
  import { useDataListNavigation } from './useDataListNavigation';
16
17
  export var cnDataList = cn('DataList');
17
- export var DataList = polymorphicComponentWithRef(function (inProps, ref) {
18
- var _a = useThemeProps({ props: inProps, name: 'DataList' }), _b = _a.as, as = _b === void 0 ? DATA_LIST_DEFAULT_TAG : _b, _c = _a.open, open = _c === void 0 ? DATA_LIST_DEFAULT_OPEN : _c, _d = _a.size, size = _d === void 0 ? DATA_LIST_DEFAULT_SIZE : _d, name = _a.name, children = _a.children, anchorRef = _a.anchorRef, onSelect = _a.onSelect, selectedProp = _a.selected, defaultSelected = _a.defaultSelected, listProps = _a.listProps, other = __rest(_a, ["as", "open", "size", "name", "children", "anchorRef", "onSelect", "selected", "defaultSelected", "listProps"]);
19
- var _e = __read(useControlled({
18
+ var DataListRender = function (inProps, ref) {
19
+ var _a = useThemeProps({ props: inProps, name: 'DataList' }), _b = _a.open, open = _b === void 0 ? DATA_LIST_DEFAULT_OPEN : _b, _c = _a.size, size = _c === void 0 ? DATA_LIST_DEFAULT_SIZE : _c, _d = _a.as, as = _d === void 0 ? DATA_LIST_DEFAULT_TAG : _d, name = _a.name, children = _a.children, anchorRef = _a.anchorRef, selectedProp = _a.selected, defaultSelected = _a.defaultSelected, onClose = _a.onClose, onEnteredProp = _a.onEntered, onExitedProp = _a.onExited, listProps = _a.listProps, other = __rest(_a, ["open", "size", "as", "name", "children", "anchorRef", "selected", "defaultSelected", "onClose", "onEntered", "onExited", "listProps"]);
20
+ // Состояние полностью представленного компонента
21
+ var _e = __read(useBoolean(false), 2), opened = _e[0], _f = _e[1], onEntered = _f.on, onExited = _f.off;
22
+ var _g = __read(useControlled({
20
23
  name: 'DataList',
21
24
  defaultValue: defaultSelected,
22
25
  value: selectedProp,
23
26
  state: 'selected',
24
- }), 2), selected = _e[0], setSelected = _e[1];
25
- var listRef = useRef(null);
26
- var handleSelect = function (event, option) {
27
- setSelected(option);
28
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, { name: name, value: option });
27
+ }), 2), selected = _g[0], setSelected = _g[1];
28
+ var handleSelect = function (event, value) {
29
+ var _a, _b, _c;
30
+ var res;
31
+ var props = __assign(__assign({}, inProps), { selected: selected });
32
+ if (isMultipleParams(props)) {
33
+ res = ((_a = props.selected) === null || _a === void 0 ? void 0 : _a.includes(value))
34
+ ? props.selected.filter(function (item) { return item !== value; })
35
+ : __spreadArray(__spreadArray([], __read((selected || [])), false), [value], false);
36
+ (_b = props.onSelect) === null || _b === void 0 ? void 0 : _b.call(props, event, { name: name, value: res });
37
+ }
38
+ if (isNotMultipleParams(props)) {
39
+ res = value;
40
+ (_c = props.onSelect) === null || _c === void 0 ? void 0 : _c.call(props, event, { name: name, value: value });
41
+ }
42
+ setSelected(res || '');
29
43
  };
30
- var _f = useDataListNavigation({
44
+ // Фиксируем последний выбранный элемент в списке, чтобы потом переводить на него scroll в контейнере
45
+ var lastSelectedOption = Array.isArray(selected)
46
+ ? selected[selected.length - 1]
47
+ : selected;
48
+ var _h = useDataListNavigation({
31
49
  name: name,
32
- listRef: listRef,
33
- }), onKeyDown = _f.onKeyDown, currentItem = _f.currentItem, listNavigation = __rest(_f, ["onKeyDown", "currentItem"]);
50
+ active: opened,
51
+ selected: lastSelectedOption,
52
+ onSelect: function (e, selectedItem) {
53
+ handleSelect(e, selectedItem);
54
+ },
55
+ }), onKeyDown = _h.onKeyDown, listRef = _h.ref, navigation = __rest(_h, ["onKeyDown", "ref"]);
56
+ // Назначает элементу контроля события управления списком с клавиатуры
34
57
  useEventListener({
35
58
  active: open,
36
59
  eventName: 'keydown',
37
60
  element: anchorRef,
38
- handler: function (event) {
39
- var _a;
40
- onKeyDown(event);
41
- if (isKey(event, 'Enter')) {
42
- handleSelect(event, ((_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.dataset) === null || _a === void 0 ? void 0 : _a.value) || '');
43
- }
61
+ handler: onKeyDown,
62
+ });
63
+ // Закрывает список как только элемент контроля теряет фокус
64
+ useEventListener({
65
+ active: open,
66
+ eventName: 'focusout',
67
+ element: anchorRef,
68
+ handler: function () {
69
+ onClose === null || onClose === void 0 ? void 0 : onClose();
44
70
  },
45
71
  });
46
- return (React.createElement(Popover, __assign({ as: as, open: open, placement: "bottom-start", disableReturnFocus: true, disableEnforceFocus: true, equalAnchorWidth: true, offset: [0, 4], anchorRef: anchorRef }, other, { ref: ref }),
47
- React.createElement(DataListContext.Provider, { value: __assign({ selected: selected, size: size, onSelect: handleSelect, currentItem: currentItem }, listNavigation) },
48
- React.createElement(List, __assign({ as: "ul", size: size }, listProps, { ref: useMultiRef([listRef, listProps === null || listProps === void 0 ? void 0 : listProps.ref]), className: cnDataList('', [listProps === null || listProps === void 0 ? void 0 : listProps.className]) }), children))));
49
- });
50
- DataList.displayName = 'DataList';
72
+ return (React.createElement(Popover, __assign({ as: as, open: open, placement: "bottom-start", disableReturnFocus: true, disableClickOutside: true, disableEnforceFocus: true, offset: [0, 4], onClose: onClose, anchorRef: anchorRef, transitionProps: {
73
+ classNames: cnDataList({ animation: true }),
74
+ } }, other, { onEntered: function () {
75
+ onEntered();
76
+ onEnteredProp === null || onEnteredProp === void 0 ? void 0 : onEnteredProp();
77
+ }, onExited: function () {
78
+ onExited();
79
+ onExitedProp === null || onExitedProp === void 0 ? void 0 : onExitedProp();
80
+ }, ref: ref }),
81
+ React.createElement(DataListContext.Provider, { value: __assign({ selected: selected, size: size }, navigation) },
82
+ React.createElement(List, __assign({ as: "ul", size: size }, listProps, { onMouseDown: function (e) {
83
+ var _a;
84
+ e.preventDefault();
85
+ (_a = listProps === null || listProps === void 0 ? void 0 : listProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(listProps, e);
86
+ }, ref: useMultiRef([listRef, listProps === null || listProps === void 0 ? void 0 : listProps.ref]), className: cnDataList('List', [listProps === null || listProps === void 0 ? void 0 : listProps.className]) }), children))));
87
+ };
88
+ export var DataList = polymorphicComponentWithRef(DataListRender);
@@ -1,18 +1,16 @@
1
1
  import type { SyntheticEvent, MouseEvent } from 'react';
2
+ import type React from 'react';
2
3
  import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
3
- export type DataListSelectPayload = {
4
- name?: string;
5
- value: string;
6
- };
7
4
  export type DataListContextState = {
8
5
  'data-list': string;
9
- currentItem: HTMLElement | null;
10
- selected?: string;
11
- keyboardHighlight: boolean;
6
+ selected?: string | string[];
7
+ focused?: string | null;
8
+ highlighted?: string | null;
12
9
  size: FormElementSizeVariant;
10
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
13
11
  onSelect?: (event: SyntheticEvent, option: string) => void;
14
- onMouseMove?: (event: MouseEvent<HTMLLIElement>) => void;
15
- onMouseLeave?: (event: MouseEvent<HTMLLIElement>) => void;
12
+ onMouseMove?: (event: MouseEvent<HTMLElement>) => void;
13
+ onMouseLeave?: (event: MouseEvent<HTMLElement>) => void;
16
14
  };
17
- export declare const DataListContext: import("react").Context<DataListContextState>;
15
+ export declare const DataListContext: React.Context<DataListContextState>;
18
16
  export declare const useDataListContext: () => DataListContextState;
@@ -2,8 +2,6 @@ import { createContext, useContext } from 'react';
2
2
  import { DATA_LIST_DEFAULT_SIZE } from './constants';
3
3
  export var DataListContext = createContext({
4
4
  'data-list': '',
5
- currentItem: null,
6
- keyboardHighlight: false,
7
5
  size: DATA_LIST_DEFAULT_SIZE,
8
6
  });
9
7
  export var useDataListContext = function () { return useContext(DataListContext); };
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import type { KeyboardEventHandler, MouseEventHandler, HTMLAttributes } from 'react';
2
+ import type { KeyboardEventHandler, MouseEventHandler, ReactNode, ComponentPropsWithRef } from 'react';
3
3
  export type DataListOptionProps = {
4
4
  /** Если {true} отображает опцию заблокированной */
5
5
  disabled?: boolean;
6
6
  /** Значение, если оно отличается от содержимого опции */
7
- value?: string;
7
+ value: string;
8
8
  /** Функция обратного вызова обработчик нажатий на клавиатуре */
9
9
  onKeyDown?: KeyboardEventHandler<HTMLLIElement>;
10
10
  /** Функция обратного вызова обработчик нажатий на клавиатуре */
@@ -12,19 +12,6 @@ export type DataListOptionProps = {
12
12
  /** Функция обратного вызова обработчик нажатий на клавиатуре */
13
13
  onMouseLeave?: MouseEventHandler<HTMLLIElement>;
14
14
  /** Содержимое компонента */
15
- children: string;
16
- } & HTMLAttributes<HTMLLIElement>;
17
- export declare const DataListOption: React.ForwardRefExoticComponent<{
18
- /** Если {true} отображает опцию заблокированной */
19
- disabled?: boolean | undefined;
20
- /** Значение, если оно отличается от содержимого опции */
21
- value?: string | undefined;
22
- /** Функция обратного вызова обработчик нажатий на клавиатуре */
23
- onKeyDown?: React.KeyboardEventHandler<HTMLLIElement> | undefined;
24
- /** Функция обратного вызова обработчик нажатий на клавиатуре */
25
- onMouseMove?: React.MouseEventHandler<HTMLLIElement> | undefined;
26
- /** Функция обратного вызова обработчик нажатий на клавиатуре */
27
- onMouseLeave?: React.MouseEventHandler<HTMLLIElement> | undefined;
28
- /** Содержимое компонента */
29
- children: string;
30
- } & React.HTMLAttributes<HTMLLIElement> & React.RefAttributes<HTMLLIElement>>;
15
+ children: ReactNode;
16
+ } & ComponentPropsWithRef<'li'>;
17
+ export declare const DataListOption: React.ForwardRefExoticComponent<Omit<DataListOptionProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
@@ -1,44 +1,37 @@
1
- import React, { useRef, forwardRef } from 'react';
1
+ import { __assign, __rest } from "tslib";
2
+ import React, { forwardRef } from 'react';
2
3
  import { TickIcon } from '@ozen-ui/icons';
3
- import { useMultiRef } from '../../../hooks/useMultiRef';
4
4
  import { getIconSizeToFormElement } from '../../../utils/getIconSizeToFormElement';
5
5
  import { ListItem, ListItemText, ListItemIcon } from '../../List';
6
6
  import { DATA_LIST_OPTION_DEFAULT_DISABLED } from '../constants';
7
7
  import { cnDataList } from '../DataList';
8
8
  import { useDataListContext } from '../DataListProvider';
9
9
  export var DataListOption = forwardRef(function (_a, ref) {
10
- var value = _a.value, onMouseDown = _a.onMouseDown, onMouseMoveProp = _a.onMouseMove, onMouseLeaveProp = _a.onMouseLeave, _b = _a.disabled, disabled = _b === void 0 ? DATA_LIST_OPTION_DEFAULT_DISABLED : _b, label = _a.children;
11
- var optionRef = useRef(null);
12
- var _c = useDataListContext(), size = _c.size, currentItem = _c.currentItem, _d = _c.selected, selected = _d === void 0 ? '' : _d, keyboardHighlight = _c.keyboardHighlight, onSelect = _c.onSelect, onMouseMove = _c.onMouseMove, onMouseLeave = _c.onMouseLeave, dataListName = _c["data-list"];
10
+ var value = _a.value, onMouseMoveProp = _a.onMouseMove, onMouseLeaveProp = _a.onMouseLeave, onClickProp = _a.onClick, _b = _a.disabled, disabled = _b === void 0 ? DATA_LIST_OPTION_DEFAULT_DISABLED : _b, label = _a.children, className = _a.className, other = __rest(_a, ["value", "onMouseMove", "onMouseLeave", "onClick", "disabled", "children", "className"]);
11
+ var _c = useDataListContext(), size = _c.size, _d = _c.selected, selected = _d === void 0 ? [] : _d, focused = _c.focused, highlighted = _c.highlighted, onClick = _c.onClick, onMouseMove = _c.onMouseMove, onMouseLeave = _c.onMouseLeave, dataListName = _c["data-list"];
13
12
  var iconSize = getIconSizeToFormElement(size);
14
- var isSelected = (value || label) === selected;
15
- var isHighlighted = !!currentItem && currentItem === optionRef.current;
13
+ var isSelected = Array.isArray(selected)
14
+ ? selected.includes(value)
15
+ : selected === value;
16
16
  var handleClick = function (event) {
17
- var _a;
18
- if (disabled) {
19
- return;
20
- }
21
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, ((_a = event.currentTarget.dataset) === null || _a === void 0 ? void 0 : _a.value) || '');
17
+ onClickProp === null || onClickProp === void 0 ? void 0 : onClickProp(event);
18
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
22
19
  };
23
20
  var handleMouseMove = function (event) {
24
- onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(event);
25
21
  onMouseMoveProp === null || onMouseMoveProp === void 0 ? void 0 : onMouseMoveProp(event);
22
+ onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(event);
26
23
  };
27
24
  var handleMouseLeave = function (event) {
28
25
  onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(event);
29
26
  onMouseLeaveProp === null || onMouseLeaveProp === void 0 ? void 0 : onMouseLeaveProp(event);
30
27
  };
31
- var handleMouseDown = function (event) {
32
- event.preventDefault();
33
- onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
34
- };
35
- return (React.createElement(ListItem, { role: "option", ref: useMultiRef([optionRef, ref]), "data-list": dataListName, "data-value": value || label, "aria-selected": isSelected, "aria-disabled": disabled, onClick: handleClick, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, className: cnDataList('Option', {
28
+ return (React.createElement(ListItem, __assign({ role: "option", "data-list": dataListName, "data-list-value": value, "data-list-disabled": disabled, "aria-selected": isSelected, "aria-disabled": disabled, onClick: handleClick, onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, className: cnDataList('Option', {
36
29
  disabled: disabled,
37
- highlighted: !disabled && isHighlighted && !keyboardHighlight,
38
- outlined: !disabled && isHighlighted && keyboardHighlight,
39
- }) },
40
- React.createElement(ListItemText, { className: cnDataList('Text', { disabled: disabled }), primary: label }),
30
+ highlighted: !disabled && highlighted === value,
31
+ focused: !disabled && focused === value,
32
+ }, [className]) }, other, { ref: ref }), typeof label === 'string' ? (React.createElement(React.Fragment, null,
33
+ React.createElement(ListItemText, { className: cnDataList('Text'), primary: label }),
41
34
  React.createElement("div", { className: cnDataList('IconWrapper', { size: iconSize }) }, isSelected && (React.createElement(ListItemIcon, null,
42
- React.createElement(TickIcon, { size: iconSize }))))));
35
+ React.createElement(TickIcon, { size: iconSize })))))) : (label)));
43
36
  });
44
37
  DataListOption.displayName = 'DataListOption';