@ozen-ui/kit 0.7.0 → 0.9.0

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 (188) hide show
  1. package/FieldControl/package.json +5 -0
  2. package/FieldInput/package.json +5 -0
  3. package/Fieldset/package.json +5 -0
  4. package/__inner__/cjs/components/Backdrop/Backdrop.d.ts +2 -2
  5. package/__inner__/cjs/components/Breadcrumbs/types.d.ts +2 -2
  6. package/__inner__/cjs/components/DataList/DataList.d.ts +1 -1
  7. package/__inner__/cjs/components/DataList/DataListProvider.d.ts +5 -5
  8. package/__inner__/cjs/components/FieldControl/FieldControl.css +135 -0
  9. package/__inner__/cjs/components/FieldControl/FieldControl.d.ts +13 -0
  10. package/__inner__/cjs/components/FieldControl/FieldControl.js +82 -0
  11. package/__inner__/cjs/components/FieldControl/FieldControlContext.d.ts +15 -0
  12. package/__inner__/cjs/components/FieldControl/FieldControlContext.js +6 -0
  13. package/__inner__/cjs/components/FieldControl/index.d.ts +2 -0
  14. package/__inner__/cjs/components/FieldControl/index.js +5 -0
  15. package/__inner__/cjs/components/FieldHint/FieldHint.d.ts +6 -9
  16. package/__inner__/cjs/components/FieldHint/FieldHint.js +24 -4
  17. package/__inner__/cjs/components/FieldIcon/FieldIcon.css +1 -21
  18. package/__inner__/cjs/components/FieldIcon/FieldIcon.d.ts +8 -12
  19. package/__inner__/cjs/components/FieldIcon/FieldIcon.js +15 -4
  20. package/__inner__/cjs/components/FieldInput/FieldInput.d.ts +11 -0
  21. package/__inner__/cjs/components/FieldInput/FieldInput.js +54 -0
  22. package/__inner__/cjs/components/FieldInput/index.d.ts +1 -0
  23. package/__inner__/cjs/components/FieldInput/index.js +4 -0
  24. package/__inner__/cjs/components/FieldLabel/FieldLabel.d.ts +7 -5
  25. package/__inner__/cjs/components/FieldLabel/FieldLabel.js +39 -10
  26. package/__inner__/cjs/components/Fieldset/Fieldset.css +13 -0
  27. package/__inner__/cjs/components/Fieldset/Fieldset.d.ts +10 -0
  28. package/__inner__/cjs/components/Fieldset/Fieldset.js +15 -0
  29. package/__inner__/cjs/components/Fieldset/index.d.ts +1 -0
  30. package/__inner__/cjs/components/Fieldset/index.js +4 -0
  31. package/__inner__/cjs/components/FilePicker/FilePicker.css +48 -59
  32. package/__inner__/cjs/components/FilePicker/FilePicker.js +2 -1
  33. package/__inner__/cjs/components/Input/Input.css +9 -121
  34. package/__inner__/cjs/components/Input/Input.d.ts +1 -62
  35. package/__inner__/cjs/components/Input/Input.js +32 -53
  36. package/__inner__/cjs/components/Input/constants.d.ts +1 -0
  37. package/__inner__/cjs/components/Input/constants.js +4 -0
  38. package/__inner__/cjs/components/Input/index.d.ts +1 -0
  39. package/__inner__/cjs/components/Input/index.js +1 -0
  40. package/__inner__/cjs/components/Input/types.d.ts +71 -0
  41. package/__inner__/cjs/components/Input/types.js +13 -0
  42. package/__inner__/cjs/components/InputNumber/InputNumber.css +60 -74
  43. package/__inner__/cjs/components/InputNumber/InputNumber.js +2 -1
  44. package/__inner__/cjs/components/InputNumber/utils.d.ts +2 -2
  45. package/__inner__/cjs/components/Link/Link.d.ts +1 -1
  46. package/__inner__/cjs/components/List/components/ListItem/ListItem.d.ts +1 -2
  47. package/__inner__/cjs/components/List/components/ListItemButton/ListItemButton.d.ts +1 -2
  48. package/__inner__/cjs/components/List/types.d.ts +3 -3
  49. package/__inner__/cjs/components/Menu/components/MenuItem/MenuItem.d.ts +1 -1
  50. package/__inner__/cjs/components/Menu/components/MenuList/MenuList.d.ts +1 -1
  51. package/__inner__/cjs/components/Modal/Modal.css +4 -8
  52. package/__inner__/cjs/components/Modal/Modal.d.ts +18 -2
  53. package/__inner__/cjs/components/Modal/Modal.js +13 -21
  54. package/__inner__/cjs/components/Modal/components/ModalConsumer.d.ts +5 -0
  55. package/__inner__/cjs/components/Modal/components/ModalConsumer.js +15 -0
  56. package/__inner__/cjs/components/Modal/components/index.d.ts +1 -0
  57. package/__inner__/cjs/components/Modal/components/index.js +4 -0
  58. package/__inner__/cjs/components/Pagination/helpers/createPaginationRange/createPaginationRange.d.ts +1 -1
  59. package/__inner__/cjs/components/Pagination/types.d.ts +5 -5
  60. package/__inner__/cjs/components/Popover/types.d.ts +4 -5
  61. package/__inner__/cjs/components/ProgressBar/ProgressBar.d.ts +2 -2
  62. package/__inner__/cjs/components/Select/Select.css +5 -16
  63. package/__inner__/cjs/components/Select/components/SelectInput/SelectInput.js +2 -1
  64. package/__inner__/cjs/components/Select/types.d.ts +3 -4
  65. package/__inner__/cjs/components/Slider/types.d.ts +1 -1
  66. package/__inner__/cjs/components/Snackbar/types.d.ts +1 -1
  67. package/__inner__/cjs/components/Tag/components/RemoveButton/RemoveButton.d.ts +1 -1
  68. package/__inner__/cjs/components/Textarea/Textarea.css +3 -107
  69. package/__inner__/cjs/components/Textarea/Textarea.d.ts +1 -59
  70. package/__inner__/cjs/components/Textarea/Textarea.js +8 -62
  71. package/__inner__/cjs/components/Textarea/components/TextareaConsumer.d.ts +3 -0
  72. package/__inner__/cjs/components/Textarea/components/TextareaConsumer.js +36 -0
  73. package/__inner__/cjs/components/Textarea/components/TextareaCounter.d.ts +7 -0
  74. package/__inner__/cjs/components/Textarea/components/TextareaCounter.js +25 -0
  75. package/__inner__/cjs/components/Textarea/components/index.d.ts +2 -0
  76. package/__inner__/cjs/components/Textarea/components/index.js +5 -0
  77. package/__inner__/cjs/components/Textarea/constants.d.ts +1 -0
  78. package/__inner__/cjs/components/Textarea/constants.js +4 -0
  79. package/__inner__/cjs/components/Textarea/index.d.ts +1 -0
  80. package/__inner__/cjs/components/Textarea/index.js +1 -0
  81. package/__inner__/cjs/components/Textarea/types.d.ts +69 -0
  82. package/__inner__/cjs/components/Textarea/types.js +4 -0
  83. package/__inner__/cjs/components/ThemeProvider/ThemeProvider.d.ts +2 -1
  84. package/__inner__/cjs/components/ThemeProvider/types.d.ts +2 -0
  85. package/__inner__/cjs/components/Tooltip/types.d.ts +1 -1
  86. package/__inner__/cjs/hooks/useLockBodyScroll/index.d.ts +1 -0
  87. package/__inner__/cjs/hooks/useLockBodyScroll/index.js +4 -0
  88. package/__inner__/cjs/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +1 -0
  89. package/__inner__/cjs/hooks/useLockBodyScroll/useLockBodyScroll.js +18 -0
  90. package/__inner__/cjs/hooks/useMultiRef/useMultiRef.d.ts +2 -3
  91. package/__inner__/cjs/types/ResponsiveValue.d.ts +1 -1
  92. package/__inner__/cjs/utils/isKey.d.ts +2 -2
  93. package/__inner__/cjs/utils/polymorphicComponentWithRef.d.ts +0 -1
  94. package/__inner__/esm/components/Backdrop/Backdrop.d.ts +2 -2
  95. package/__inner__/esm/components/Backdrop/Backdrop.js +1 -1
  96. package/__inner__/esm/components/Breadcrumbs/types.d.ts +2 -2
  97. package/__inner__/esm/components/DataList/DataList.d.ts +1 -1
  98. package/__inner__/esm/components/DataList/DataListProvider.d.ts +5 -5
  99. package/__inner__/esm/components/FieldControl/FieldControl.css +135 -0
  100. package/__inner__/esm/components/FieldControl/FieldControl.d.ts +13 -0
  101. package/__inner__/esm/components/FieldControl/FieldControl.js +79 -0
  102. package/__inner__/esm/components/FieldControl/FieldControlContext.d.ts +15 -0
  103. package/__inner__/esm/components/FieldControl/FieldControlContext.js +2 -0
  104. package/__inner__/esm/components/FieldControl/index.d.ts +2 -0
  105. package/__inner__/esm/components/FieldControl/index.js +2 -0
  106. package/__inner__/esm/components/FieldHint/FieldHint.d.ts +6 -9
  107. package/__inner__/esm/components/FieldHint/FieldHint.js +25 -5
  108. package/__inner__/esm/components/FieldIcon/FieldIcon.css +1 -21
  109. package/__inner__/esm/components/FieldIcon/FieldIcon.d.ts +8 -12
  110. package/__inner__/esm/components/FieldIcon/FieldIcon.js +16 -5
  111. package/__inner__/esm/components/FieldInput/FieldInput.d.ts +11 -0
  112. package/__inner__/esm/components/FieldInput/FieldInput.js +51 -0
  113. package/__inner__/esm/components/FieldInput/index.d.ts +1 -0
  114. package/__inner__/esm/components/FieldInput/index.js +1 -0
  115. package/__inner__/esm/components/FieldLabel/FieldLabel.d.ts +7 -5
  116. package/__inner__/esm/components/FieldLabel/FieldLabel.js +38 -8
  117. package/__inner__/esm/components/Fieldset/Fieldset.css +13 -0
  118. package/__inner__/esm/components/Fieldset/Fieldset.d.ts +10 -0
  119. package/__inner__/esm/components/Fieldset/Fieldset.js +12 -0
  120. package/__inner__/esm/components/Fieldset/index.d.ts +1 -0
  121. package/__inner__/esm/components/Fieldset/index.js +1 -0
  122. package/__inner__/esm/components/FilePicker/FilePicker.css +48 -59
  123. package/__inner__/esm/components/FilePicker/FilePicker.js +2 -1
  124. package/__inner__/esm/components/Input/Input.css +9 -121
  125. package/__inner__/esm/components/Input/Input.d.ts +1 -62
  126. package/__inner__/esm/components/Input/Input.js +33 -54
  127. package/__inner__/esm/components/Input/constants.d.ts +1 -0
  128. package/__inner__/esm/components/Input/constants.js +1 -0
  129. package/__inner__/esm/components/Input/index.d.ts +1 -0
  130. package/__inner__/esm/components/Input/index.js +1 -0
  131. package/__inner__/esm/components/Input/types.d.ts +71 -0
  132. package/__inner__/esm/components/Input/types.js +10 -0
  133. package/__inner__/esm/components/InputNumber/InputNumber.css +60 -74
  134. package/__inner__/esm/components/InputNumber/InputNumber.js +2 -1
  135. package/__inner__/esm/components/InputNumber/utils.d.ts +2 -2
  136. package/__inner__/esm/components/Link/Link.d.ts +1 -1
  137. package/__inner__/esm/components/List/components/ListItem/ListItem.d.ts +1 -2
  138. package/__inner__/esm/components/List/components/ListItemButton/ListItemButton.d.ts +1 -2
  139. package/__inner__/esm/components/List/types.d.ts +3 -3
  140. package/__inner__/esm/components/Menu/components/MenuItem/MenuItem.d.ts +1 -1
  141. package/__inner__/esm/components/Menu/components/MenuList/MenuList.d.ts +1 -1
  142. package/__inner__/esm/components/Modal/Modal.css +4 -8
  143. package/__inner__/esm/components/Modal/Modal.d.ts +18 -2
  144. package/__inner__/esm/components/Modal/Modal.js +13 -21
  145. package/__inner__/esm/components/Modal/components/ModalConsumer.d.ts +5 -0
  146. package/__inner__/esm/components/Modal/components/ModalConsumer.js +12 -0
  147. package/__inner__/esm/components/Modal/components/index.d.ts +1 -0
  148. package/__inner__/esm/components/Modal/components/index.js +1 -0
  149. package/__inner__/esm/components/Pagination/helpers/createPaginationRange/createPaginationRange.d.ts +1 -1
  150. package/__inner__/esm/components/Pagination/types.d.ts +5 -5
  151. package/__inner__/esm/components/Popover/types.d.ts +4 -5
  152. package/__inner__/esm/components/ProgressBar/ProgressBar.d.ts +2 -2
  153. package/__inner__/esm/components/ProgressBar/ProgressBar.js +1 -1
  154. package/__inner__/esm/components/Select/Select.css +5 -16
  155. package/__inner__/esm/components/Select/components/SelectInput/SelectInput.js +2 -1
  156. package/__inner__/esm/components/Select/types.d.ts +3 -4
  157. package/__inner__/esm/components/Slider/types.d.ts +1 -1
  158. package/__inner__/esm/components/Snackbar/types.d.ts +1 -1
  159. package/__inner__/esm/components/Tag/components/RemoveButton/RemoveButton.d.ts +1 -1
  160. package/__inner__/esm/components/Textarea/Textarea.css +3 -107
  161. package/__inner__/esm/components/Textarea/Textarea.d.ts +1 -59
  162. package/__inner__/esm/components/Textarea/Textarea.js +9 -63
  163. package/__inner__/esm/components/Textarea/components/TextareaConsumer.d.ts +3 -0
  164. package/__inner__/esm/components/Textarea/components/TextareaConsumer.js +32 -0
  165. package/__inner__/esm/components/Textarea/components/TextareaCounter.d.ts +7 -0
  166. package/__inner__/esm/components/Textarea/components/TextareaCounter.js +21 -0
  167. package/__inner__/esm/components/Textarea/components/index.d.ts +2 -0
  168. package/__inner__/esm/components/Textarea/components/index.js +2 -0
  169. package/__inner__/esm/components/Textarea/constants.d.ts +1 -0
  170. package/__inner__/esm/components/Textarea/constants.js +1 -0
  171. package/__inner__/esm/components/Textarea/index.d.ts +1 -0
  172. package/__inner__/esm/components/Textarea/index.js +1 -0
  173. package/__inner__/esm/components/Textarea/types.d.ts +69 -0
  174. package/__inner__/esm/components/Textarea/types.js +1 -0
  175. package/__inner__/esm/components/ThemeProvider/ThemeProvider.d.ts +2 -1
  176. package/__inner__/esm/components/ThemeProvider/types.d.ts +2 -0
  177. package/__inner__/esm/components/Tooltip/Tooltip.js +1 -1
  178. package/__inner__/esm/components/Tooltip/types.d.ts +1 -1
  179. package/__inner__/esm/hooks/useLockBodyScroll/index.d.ts +1 -0
  180. package/__inner__/esm/hooks/useLockBodyScroll/index.js +1 -0
  181. package/__inner__/esm/hooks/useLockBodyScroll/useLockBodyScroll.d.ts +1 -0
  182. package/__inner__/esm/hooks/useLockBodyScroll/useLockBodyScroll.js +14 -0
  183. package/__inner__/esm/hooks/useMultiRef/useMultiRef.d.ts +2 -3
  184. package/__inner__/esm/types/ResponsiveValue.d.ts +1 -1
  185. package/__inner__/esm/utils/isKey.d.ts +2 -2
  186. package/__inner__/esm/utils/polymorphicComponentWithRef.d.ts +0 -1
  187. package/package.json +1 -1
  188. package/useLockBodyScroll/package.json +5 -0
@@ -0,0 +1,51 @@
1
+ import { __assign, __read, __rest } from "tslib";
2
+ import React, { useCallback, useContext, useState, useEffect } from 'react';
3
+ import { useControlled } from '../../hooks/useControlled';
4
+ import { cn } from '../../utils/classname';
5
+ import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
6
+ import { FieldControlContext } from '../FieldControl';
7
+ export var FIELD_INPUT_DEFAULT_TAG = 'input';
8
+ export var cnFieldInput = cn('FieldInput');
9
+ export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
10
+ var _b = _a.as, Tag = _b === void 0 ? FIELD_INPUT_DEFAULT_TAG : _b, className = _a.className, requiredProp = _a.required, disabledProp = _a.disabled, valueProp = _a.value, onChange = _a.onChange, defaultValue = _a.defaultValue, children = _a.children, onFocus = _a.onFocus, onBlur = _a.onBlur, other = __rest(_a, ["as", "className", "required", "disabled", "value", "onChange", "defaultValue", "children", "onFocus", "onBlur"]);
11
+ var _c = __read(useState(), 2), focused = _c[0], setFocused = _c[1];
12
+ var context = useContext(FieldControlContext);
13
+ var _d = __read(context, 2), fieldControl = _d[0], setFieldControl = _d[1];
14
+ var _e = __read(useControlled({
15
+ value: valueProp,
16
+ name: 'FieldInput',
17
+ state: 'value',
18
+ defaultValue: defaultValue
19
+ }), 2), valueState = _e[0], setValueState = _e[1];
20
+ var filled = !!valueState || valueState === 0;
21
+ var required = requiredProp;
22
+ var disabled = disabledProp;
23
+ if (fieldControl) {
24
+ if (required === undefined && fieldControl.required) {
25
+ required = fieldControl.required;
26
+ }
27
+ if (disabled === undefined && fieldControl.disabled) {
28
+ disabled = fieldControl.disabled;
29
+ }
30
+ }
31
+ useEffect(function () {
32
+ setFieldControl(function (prevState) { return (__assign(__assign({}, prevState), { filled: filled, focused: focused, value: valueState })); });
33
+ }, [filled, focused, valueState]);
34
+ var handleChange = useCallback(function (e) {
35
+ if (disabled)
36
+ return;
37
+ var value = e.target.value;
38
+ setValueState(value);
39
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
40
+ }, [onChange, disabled]);
41
+ var handleFocus = useCallback(function (e) {
42
+ setFocused(true);
43
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
44
+ }, [onFocus]);
45
+ var handleBlur = useCallback(function (e) {
46
+ setFocused(false);
47
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
48
+ }, [onBlur]);
49
+ return (React.createElement(Tag, __assign({ className: cnFieldInput({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, defaultValue: defaultValue, value: valueProp }, other, { ref: ref }), children));
50
+ });
51
+ FieldInput.displayName = 'FieldInput';
@@ -0,0 +1 @@
1
+ export * from './FieldInput';
@@ -0,0 +1 @@
1
+ export * from './FieldInput';
@@ -1,8 +1,10 @@
1
- import type { HTMLAttributes, Ref } from 'react';
2
- import * as React from 'react';
3
1
  import './FieldLabel.css';
4
- export declare const fieldLabelSizeVariant: readonly ["2xs", "xs", "s", "m", "l"];
5
- export type FieldLabelSizeVariant = (typeof fieldLabelSizeVariant)[number];
2
+ import type { Ref, ComponentRef, ComponentPropsWithRef } from 'react';
3
+ import React from 'react';
4
+ import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
5
+ export type FieldLabelSizeVariant = FormElementSizeVariant;
6
+ export declare const FIELD_LABEL_DEFAULT_TAG = "span";
7
+ export type FieldLabelRef = ComponentRef<typeof FIELD_LABEL_DEFAULT_TAG>;
6
8
  export type FieldLabelProps = {
7
9
  /** Если {true} переводит компонент в визуальное состояние заполненный */
8
10
  filled?: boolean;
@@ -20,6 +22,6 @@ export type FieldLabelProps = {
20
22
  ref?: Ref<HTMLSpanElement>;
21
23
  /** Значение компонента */
22
24
  children?: string;
23
- } & HTMLAttributes<HTMLSpanElement>;
25
+ } & ComponentPropsWithRef<typeof FIELD_LABEL_DEFAULT_TAG>;
24
26
  export declare const cnFieldLabel: import("@bem-react/classname").ClassNameFormatter;
25
27
  export declare const FieldLabel: React.ForwardRefExoticComponent<Omit<FieldLabelProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
@@ -1,14 +1,44 @@
1
- import { forwardRef } from 'react';
2
- import * as React from 'react';
3
- import { cn } from '../../utils/classname';
1
+ import { __assign, __read } from "tslib";
4
2
  import './FieldLabel.css';
5
- export var fieldLabelSizeVariant = ['2xs', 'xs', 's', 'm', 'l'];
3
+ import React, { forwardRef, useContext, useEffect } from 'react';
4
+ import { cn } from '../../utils/classname';
5
+ import { FieldControlContext } from '../FieldControl';
6
+ export var FIELD_LABEL_DEFAULT_TAG = 'span';
6
7
  export var cnFieldLabel = cn('FieldLabel');
7
8
  export var FieldLabel = forwardRef(function (_a, ref) {
8
- var focused = _a.focused, children = _a.children, filled = _a.filled, shrink = _a.shrink, required = _a.required, disabled = _a.disabled, className = _a.className, size = _a.size;
9
- return (React.createElement("span", { className: cnFieldLabel({ filled: filled, shrink: shrink, focused: focused, disabled: disabled, size: size }, [
10
- className,
11
- ]), ref: ref },
9
+ var focusedProp = _a.focused, children = _a.children, filledProp = _a.filled, shrink = _a.shrink, requiredProp = _a.required, disabledProp = _a.disabled, className = _a.className, sizeProp = _a.size;
10
+ var context = useContext(FieldControlContext);
11
+ var _b = __read(context, 2), fieldControl = _b[0], setFieldControl = _b[1];
12
+ var Tag = FIELD_LABEL_DEFAULT_TAG;
13
+ var size = sizeProp;
14
+ var required = requiredProp;
15
+ var disabled = disabledProp;
16
+ var focused = focusedProp;
17
+ var filled = filledProp;
18
+ useEffect(function () {
19
+ setFieldControl(function (prevState) { return (__assign(__assign({}, prevState), { label: children })); });
20
+ }, [children]);
21
+ if (!children) {
22
+ return null;
23
+ }
24
+ if (fieldControl) {
25
+ if (size === undefined && fieldControl.size) {
26
+ size = fieldControl.size;
27
+ }
28
+ if (required === undefined && fieldControl.required) {
29
+ required = fieldControl.required;
30
+ }
31
+ if (disabled === undefined && fieldControl.disabled) {
32
+ disabled = fieldControl.disabled;
33
+ }
34
+ if (focused === undefined && fieldControl.focused) {
35
+ focused = fieldControl.focused;
36
+ }
37
+ if (filled === undefined && fieldControl.filled) {
38
+ filled = fieldControl.filled;
39
+ }
40
+ }
41
+ return (React.createElement(Tag, { className: cnFieldLabel({ filled: filled, shrink: shrink, focused: focused, disabled: disabled, size: size, required: required }, [className]), ref: ref },
12
42
  children,
13
43
  " ",
14
44
  required && React.createElement("sup", null, "*")));
@@ -0,0 +1,13 @@
1
+ .Fieldset {
2
+ position: absolute;
3
+ inset-block-end: 0;
4
+ inset-inline-end: 0;
5
+ inset-block-start: 0;
6
+ inset-inline-start: 0;
7
+ margin: 0;
8
+ padding: 0;
9
+ pointer-events: none;
10
+ border-radius: var(--border-radius-xs);
11
+ border: var(--textfield-border-width) solid var(--textfield-border-color);
12
+ transition: border var(--transition-default);
13
+ }
@@ -0,0 +1,10 @@
1
+ import './Fieldset.css';
2
+ import React from 'react';
3
+ import type { ComponentPropsWithRef, ComponentRef } from 'react';
4
+ export declare const FIELDSET_DEFAULT_TAG = "fieldset";
5
+ export type FieldsetRef = ComponentRef<typeof FIELDSET_DEFAULT_TAG>;
6
+ export type FieldsetProps = ComponentPropsWithRef<typeof FIELDSET_DEFAULT_TAG>;
7
+ export declare const cnFieldset: import("@bem-react/classname").ClassNameFormatter;
8
+ export declare const Fieldset: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & {
9
+ ref?: ((instance: HTMLFieldSetElement | null) => void) | React.RefObject<HTMLFieldSetElement> | null | undefined;
10
+ }, "ref"> & React.RefAttributes<HTMLFieldSetElement>>;
@@ -0,0 +1,12 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import './Fieldset.css';
3
+ import React, { forwardRef } from 'react';
4
+ import { cn } from '../../utils/classname';
5
+ export var FIELDSET_DEFAULT_TAG = 'fieldset';
6
+ export var cnFieldset = cn('Fieldset');
7
+ export var Fieldset = forwardRef(function (_a, ref) {
8
+ var className = _a.className, other = __rest(_a, ["className"]);
9
+ var Tag = FIELDSET_DEFAULT_TAG;
10
+ return React.createElement(Tag, __assign({ className: cnFieldset({}, [className]) }, other, { ref: ref }));
11
+ });
12
+ Fieldset.displayName = 'Fieldset';
@@ -0,0 +1 @@
1
+ export * from './Fieldset';
@@ -0,0 +1 @@
1
+ export * from './Fieldset';
@@ -1,9 +1,10 @@
1
1
  /* stylelint-disable */
2
2
  .FilePicker {
3
- --file-picker-color: var(--color-content-tertiary);
4
- --file-picker-background-color: var(--color-background-primary);
5
- --file-picker-border-width: var(--border-width-s);
6
- --file-picker-border-color: var(--color-border-main);
3
+ --textfield-color: var(--color-content-tertiary);
4
+ --textfield-background-color: var(--color-background-primary);
5
+ --textfield-border-width: var(--border-width-s);
6
+ --textfield-border-color: var(--color-border-main);
7
+ font: var(--textfield-input-font);
7
8
  display: inline-flex;
8
9
  vertical-align: top;
9
10
  flex-direction: column;
@@ -11,14 +12,14 @@
11
12
  .FilePicker-Body {
12
13
  position: relative;
13
14
  display: flex;
14
- -moz-column-gap: var(--file-picker-input-gap);
15
- column-gap: var(--file-picker-input-gap);
15
+ -moz-column-gap: var(--textfield-input-gap);
16
+ column-gap: var(--textfield-input-gap);
16
17
  align-items: center;
17
18
  box-sizing: border-box;
18
- padding: 0 var(--file-picker-gutter-x);
19
- background-color: var(--file-picker-background-color);
19
+ padding: 0 var(--textfield-gutter-x);
20
+ background-color: var(--textfield-background-color);
20
21
  transition: background-color var(--transition-slow);
21
- color: var(--file-picker-color);
22
+ color: var(--textfield-color);
22
23
  border-radius: var(--border-radius-xs);
23
24
  cursor: pointer;
24
25
  }
@@ -42,9 +43,8 @@
42
43
  padding: 0;
43
44
  background: none;
44
45
  box-sizing: border-box;
45
- color: var(--file-picker-color);
46
- block-size: var(--file-picker-input-height);
47
- font: var(--file-picker-input-font);
46
+ color: var(--textfield-color);
47
+ block-size: var(--textfield-input-height);
48
48
  }
49
49
  .FilePicker-Input {
50
50
  inset-block-end: 0;
@@ -57,85 +57,74 @@
57
57
  .FilePicker-Input:focus + .FilePicker-Placeholder {
58
58
  opacity: 1;
59
59
  }
60
- .FilePicker-Fieldset {
61
- position: absolute;
62
- inset: 0;
63
- margin: 0;
64
- padding: 0;
65
- pointer-events: none;
66
- border-radius: var(--border-radius-xs);
67
- border: var(--file-picker-border-width) solid
68
- var(--file-picker-border-color);
69
- transition: border var(--transition-default);
70
- }
71
60
  .FilePicker_size_2xs {
72
- --file-picker-gutter-x: 12px;
73
- --file-picker-input-height: 32px;
74
- --file-picker-input-font: var(--typography-text-2xs-font);
75
- --file-picker-input-padding: 8px 0 8px;
76
- --file-picker-input-gap: var(--space-s);
61
+ --textfield-gutter-x: 12px;
62
+ --textfield-input-height: 32px;
63
+ --textfield-input-font: var(--typography-text-2xs-font);
64
+ --textfield-input-padding: 8px 0 8px;
65
+ --textfield-input-gap: var(--space-s);
77
66
  }
78
67
  .FilePicker_size_xs {
79
- --file-picker-gutter-x: 12px;
80
- --file-picker-input-height: 40px;
81
- --file-picker-input-font: var(--typography-text-xs-font);
82
- --file-picker-input-padding: 19px 0 4px;
83
- --file-picker-input-gap: var(--space-s);
68
+ --textfield-gutter-x: 12px;
69
+ --textfield-input-height: 40px;
70
+ --textfield-input-font: var(--typography-text-xs-font);
71
+ --textfield-input-padding: 19px 0 4px;
72
+ --textfield-input-gap: var(--space-s);
84
73
  }
85
74
  .FilePicker_size_s {
86
- --file-picker-gutter-x: 16px;
87
- --file-picker-input-height: 48px;
88
- --file-picker-input-font: var(--typography-text-s-font);
89
- --file-picker-input-padding: 21px 0 6px;
90
- --file-picker-input-gap: var(--space-m);
75
+ --textfield-gutter-x: 16px;
76
+ --textfield-input-height: 48px;
77
+ --textfield-input-font: var(--typography-text-s-font);
78
+ --textfield-input-padding: 21px 0 6px;
79
+ --textfield-input-gap: var(--space-m);
91
80
  }
92
81
  .FilePicker_size_m {
93
- --file-picker-gutter-x: 20px;
94
- --file-picker-input-height: 56px;
95
- --file-picker-input-font: var(--typography-text-m-font);
96
- --file-picker-input-padding: 24px 0 6px;
97
- --file-picker-input-gap: var(--space-m);
82
+ --textfield-gutter-x: 20px;
83
+ --textfield-input-height: 56px;
84
+ --textfield-input-font: var(--typography-text-m-font);
85
+ --textfield-input-padding: 24px 0 6px;
86
+ --textfield-input-gap: var(--space-m);
98
87
  }
99
88
  .FilePicker_size_l {
100
- --file-picker-gutter-x: 24px;
101
- --file-picker-input-height: 64px;
102
- --file-picker-input-font: var(--typography-text-l-font);
103
- --file-picker-input-padding: 26px 0 6px;
104
- --file-picker-input-gap: var(--space-l);
89
+ --textfield-gutter-x: 24px;
90
+ --textfield-input-height: 64px;
91
+ --textfield-input-font: var(--typography-text-l-font);
92
+ --textfield-input-padding: 26px 0 6px;
93
+ --textfield-input-gap: var(--space-l);
105
94
  }
106
95
  .FilePicker_fullWidth {
107
96
  inline-size: 100%;
108
97
  }
109
98
  .FilePicker_hasValue {
110
- --file-picker-color: var(--color-content-primary);
99
+ --textfield-color: var(--color-content-primary);
111
100
  }
112
101
  .FilePicker_hasLabel .FilePicker-Placeholder {
113
102
  opacity: 0;
114
103
  }
115
104
  .FilePicker_hasLabel .FilePicker-FileName,
116
105
  .FilePicker_hasLabel .FilePicker-Placeholder {
117
- padding: var(--file-picker-input-padding);
118
- font: var(--file-picker-input-font);
106
+ padding: var(--textfield-input-padding);
107
+ font: var(--textfield-input-font);
119
108
  }
120
109
  .FilePicker:hover {
121
- --file-picker-border-color: var(--color-border-main-hover);
110
+ --textfield-border-color: var(--color-border-main-hover);
122
111
  }
123
112
  .FilePicker_focused,
124
113
  .FilePicker_focused:hover {
125
- --file-picker-border-width: var(--border-width-m);
126
- --file-picker-background-color: var(--color-background-main);
127
- --file-picker-border-color: var(--color-border-action);
114
+ --textfield-border-width: var(--border-width-m);
115
+ --textfield-background-color: var(--color-background-main);
116
+ --textfield-border-color: var(--color-border-action);
128
117
  }
129
118
  .FilePicker_error,
130
119
  .FilePicker_error.FilePicker:hover,
131
120
  .FilePicker_error.FilePicker_focused,
132
121
  .FilePicker_error.FilePicker_focused:hover {
133
- --file-picker-border-color: var(--color-border-error);
122
+ --textfield-border-color: var(--color-border-error);
134
123
  }
135
124
  .FilePicker_disabled {
136
- --file-picker-border-color: var(--color-border-disabled);
137
- --file-picker-background-color: var(--color-background-disabled);
138
- --file-picker-color: var(--color-content-secondary);
125
+ --textfield-border-color: var(--color-border-disabled);
126
+ --textfield-background-color: var(--color-background-disabled);
127
+ --textfield-color: var(--color-content-secondary);
139
128
  pointer-events: none;
140
129
  cursor: default;
141
130
  }
@@ -9,6 +9,7 @@ import { isKey } from '../../utils/isKey';
9
9
  import { FieldHint } from '../FieldHint';
10
10
  import { FieldIcon } from '../FieldIcon';
11
11
  import { FieldLabel } from '../FieldLabel';
12
+ import { Fieldset } from '../Fieldset';
12
13
  import { IconButton } from '../IconButton';
13
14
  import { FILE_PICKER_DEFAULT_SIZE, FILE_PICKER_DEFAULT_PLACEHOLDER, FILE_PICKER_DEFAULT_DISABLED, FILE_PICKER_DEFAULT_REQUIRED, FILE_PICKER_DEFAULT_FULL_WIDTH, FILE_PICKER_DEFAULT_DISABLE_TRUNCATE, FILE_PICKER_DEFAULT_VALUE_RENDERER, FILE_PICKER_DEFAULT_MULTIPLE, FILE_PICKER_DEFAULT_MULTIPLE_CLEAR_TEXT, } from './constants';
14
15
  export var cnFilePicker = cn('FilePicker');
@@ -69,7 +70,7 @@ export var FilePicker = forwardRef(function (inProps, ref) {
69
70
  (fileList === null || fileList === void 0 ? void 0 : fileList.length) ? (React.createElement("span", { className: cnFilePicker('FileName') }, renderValue(fileList, disableTruncate))) : (React.createElement("span", { "aria-placeholder": placeholder, className: cnFilePicker('Placeholder') }, placeholder))),
70
71
  !!(fileList === null || fileList === void 0 ? void 0 : fileList.length) && onClearProp && (React.createElement(IconButton, { tabIndex: -1, variant: "function", "aria-label": clearText, ref: clearRef, onClick: onClear, size: size, icon: CloseIcon })),
71
72
  React.createElement(FieldIcon, { className: cnFilePicker('RenderRight'), icon: renderRight, size: size }),
72
- React.createElement("fieldset", { className: cnFilePicker('Fieldset') })),
73
+ React.createElement(Fieldset, { className: cnFilePicker('Fieldset') })),
73
74
  React.createElement(FieldHint, { size: size, error: error, disabled: disabled }, hint)));
74
75
  });
75
76
  FilePicker.displayName = 'FilePicker';
@@ -1,30 +1,3 @@
1
- /* stylelint-disable */
2
- .Input {
3
- --textfield-color: var(--color-content-primary);
4
- --textfield-background-color: var(--color-background-primary);
5
- --textfield-border-width: var(--border-width-s);
6
- --textfield-border-color: var(--color-border-main);
7
- cursor: text;
8
- display: inline-flex;
9
- vertical-align: top;
10
- flex-direction: column;
11
- }
12
- .Input > * {
13
- cursor: text;
14
- }
15
- .Input-Fieldset {
16
- position: absolute;
17
- inset-block-end: 0;
18
- inset-inline-end: 0;
19
- inset-block-start: 0;
20
- inset-inline-start: 0;
21
- margin: 0;
22
- padding: 0;
23
- pointer-events: none;
24
- border-radius: var(--border-radius-xs);
25
- border: var(--textfield-border-width) solid var(--textfield-border-color);
26
- transition: border var(--transition-default);
27
- }
28
1
  .Input-Body {
29
2
  position: relative;
30
3
  display: flex;
@@ -38,133 +11,48 @@
38
11
  color: var(--textfield-color);
39
12
  border-radius: var(--border-radius-xs);
40
13
  }
41
- .Input-FieldContainer {
14
+ .Input-FieldContainer {
42
15
  inline-size: 100%;
43
16
  position: relative;
44
17
  }
45
- .Input-Field {
18
+ .Input-Field {
46
19
  border: none;
47
20
  outline: none;
48
21
  display: flex;
49
22
  inline-size: 100%;
50
- padding: 0;
23
+ padding: var(--textfield-input-padding);
51
24
  background: none;
52
25
  color: var(--textfield-color);
53
26
  box-sizing: border-box;
54
27
  block-size: var(--textfield-input-height);
55
- font: var(--textfield-input-font);
28
+ font: inherit;
56
29
  }
57
- .Input-Field::placeholder {
30
+ .Input-Field::placeholder {
58
31
  opacity: 1;
59
32
  color: var(--color-content-tertiary);
60
33
  }
61
- .Input-Field:-webkit-autofill,
34
+ .Input-Field:-webkit-autofill,
62
35
  .Input-Field:-webkit-autofill:hover,
63
36
  .Input-Field:-webkit-autofill:focus {
64
37
  box-shadow: 0 0 0 1000px var(--textfield-background-color) inset !important;
65
38
  background-color: transparent !important;
66
39
  -webkit-text-fill-color: var(--color-content-info-dark);
67
40
  }
68
- .Input-Field::-webkit-outer-spin-button,
41
+ .Input-Field::-webkit-outer-spin-button,
69
42
  .Input-Field::-webkit-inner-spin-button {
70
43
  -webkit-appearance: none;
71
44
  appearance: none;
72
45
  margin: 0;
73
46
  }
74
- .Input-Field::-webkit-calendar-picker-indicator {
47
+ .Input-Field::-webkit-calendar-picker-indicator {
75
48
  opacity: 0;
76
49
  position: absolute;
77
50
  inset-block-start: 50%;
78
51
  transform: translateY(-50%);
79
52
  cursor: pointer;
80
53
  }
81
- .Input-Field[type='number'] {
54
+ .Input-Field[type='number'] {
82
55
  -webkit-appearance: textfield;
83
56
  -moz-appearance: textfield;
84
57
  appearance: textfield;
85
58
  }
86
- .Input_size_2xs {
87
- --textfield-gutter-x: 12px;
88
- --textfield-input-height: 32px;
89
- --textfield-input-font: var(--typography-text-2xs-font);
90
- --textfield-input-padding: 8px 0 8px;
91
- --textfield-input-gap: var(--space-s);
92
- }
93
- .Input_size_2xs .Input-Field::-webkit-calendar-picker-indicator {
94
- inset-inline-end: -25px;
95
- }
96
- .Input_size_xs {
97
- --textfield-gutter-x: 12px;
98
- --textfield-input-height: 40px;
99
- --textfield-input-font: var(--typography-text-xs-font);
100
- --textfield-input-padding: 19px 0 4px;
101
- --textfield-input-gap: var(--space-s);
102
- }
103
- .Input_size_xs .Input-Field::-webkit-calendar-picker-indicator {
104
- inset-inline-end: -25px;
105
- }
106
- .Input_size_s {
107
- --textfield-gutter-x: 16px;
108
- --textfield-input-height: 48px;
109
- --textfield-input-font: var(--typography-text-s-font);
110
- --textfield-input-padding: 21px 0 6px;
111
- --textfield-input-gap: var(--space-m);
112
- }
113
- .Input_size_s .Input-Field::-webkit-calendar-picker-indicator {
114
- inset-inline-end: -30px;
115
- }
116
- .Input_size_m {
117
- --textfield-gutter-x: 20px;
118
- --textfield-input-height: 56px;
119
- --textfield-input-font: var(--typography-text-m-font);
120
- --textfield-input-padding: 24px 0 6px;
121
- --textfield-input-gap: var(--space-m);
122
- }
123
- .Input_size_m .Input-Field::-webkit-calendar-picker-indicator {
124
- inset-inline-end: -34px;
125
- }
126
- .Input_size_l {
127
- --textfield-gutter-x: 24px;
128
- --textfield-input-height: 64px;
129
- --textfield-input-font: var(--typography-text-l-font);
130
- --textfield-input-padding: 26px 0 6px;
131
- --textfield-input-gap: var(--space-l);
132
- }
133
- .Input_size_l .Input-Field::-webkit-calendar-picker-indicator {
134
- inset-inline-end: -39px;
135
- }
136
- .Input_fullWidth {
137
- inline-size: 100%;
138
- }
139
- .Input_hasLabel .Input-Field {
140
- padding: var(--textfield-input-padding);
141
- font: var(--textfield-input-font);
142
- }
143
- .Input_hasLabel .Input-Field::placeholder {
144
- opacity: 0;
145
- }
146
- .Input_hasLabel .Input-Field:focus::placeholder {
147
- opacity: 1;
148
- }
149
- .Input:hover {
150
- --textfield-border-color: var(--color-border-main-hover);
151
- }
152
- .Input_focused,
153
- .Input_focused:hover {
154
- --textfield-border-width: var(--border-width-m);
155
- --textfield-background-color: var(--color-background-main);
156
- --textfield-border-color: var(--color-border-action);
157
- }
158
- .Input_error,
159
- .Input_error.Input:hover,
160
- .Input_error.Input_focused,
161
- .Input_error.Input_focused:hover {
162
- --textfield-border-color: var(--color-border-error);
163
- }
164
- .Input_disabled {
165
- --textfield-border-color: var(--color-border-disabled);
166
- --textfield-background-color: var(--color-background-disabled);
167
- --textfield-color: var(--color-content-secondary);
168
- pointer-events: none;
169
- cursor: default;
170
- }
@@ -1,66 +1,5 @@
1
1
  import './Input.css';
2
2
  import React from 'react';
3
- import type { HTMLAttributes, InputHTMLAttributes, Ref } from 'react';
4
- import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
5
- import { type FieldIconProps } from '../FieldIcon';
6
- import { type FieldLabelProps } from '../FieldLabel';
7
- export declare const inputTypeVariant: readonly ["number", "date", "datetime-local", "time", "text", "tel", "password", "email"];
8
- export type InputTypeVariant = (typeof inputTypeVariant)[number];
9
- export type InputSizeVariant = FormElementSizeVariant;
10
- type InputElement = InputHTMLAttributes<HTMLInputElement>;
11
- export type InputProps = {
12
- /** Атрибут id для элемента input */
13
- id?: string;
14
- /** Атрибут name для элемента input */
15
- name?: string;
16
- /** Лейбл */
17
- label?: string;
18
- /** Размер компонента */
19
- size?: InputSizeVariant;
20
- /** Подсказка. Отображается, когда вариант не выбран */
21
- placeholder?: string;
22
- /** Если {true} устанавливает автофокус */
23
- autoFocus?: boolean;
24
- /** Если {true} переводит поле в состояние ошибки */
25
- error?: boolean;
26
- /** Если {true} растягивает поле на всю ширину */
27
- fullWidth?: boolean;
28
- /** Дополнительное описание к полю */
29
- hint?: string | null | undefined;
30
- /** Атрибут type для элемента input */
31
- type?: InputTypeVariant;
32
- /** Если {true} делает элемент неактивным */
33
- disabled?: boolean;
34
- /** Если {true} делает элемент обязательным к заполнению */
35
- required?: boolean;
36
- /** Минимальное количество символов разрешенных для ввода */
37
- minLength?: InputElement['minLength'];
38
- /** Максимальное количество символов разрешенных для ввода */
39
- maxLength?: InputElement['maxLength'];
40
- /** Текст или иконка слева */
41
- renderLeft?: FieldIconProps['icon'];
42
- /** Текст или иконка справа */
43
- renderRight?: FieldIconProps['icon'];
44
- /** Выбранное значение */
45
- value?: InputElement['value'];
46
- /** Значение по умолчанию (неконтролируемый компонент) */
47
- defaultValue?: InputElement['defaultValue'];
48
- /** Обработчик события на изменение значения поля */
49
- onChange?: InputElement['onChange'];
50
- /** Ссылка на элемент input */
51
- inputRef?: Ref<HTMLInputElement>;
52
- /** Свойства элемента input */
53
- inputProps?: InputElement & {
54
- 'data-testid'?: string;
55
- };
56
- /** Ссылка на FieldLabel */
57
- labelRef?: FieldLabelProps['ref'];
58
- /** Свойства FieldLabel */
59
- labelProps?: FieldLabelProps;
60
- /** Ссылка на корневой DOM-элемент компонента */
61
- ref?: Ref<HTMLDivElement>;
62
- 'data-testid'?: string;
63
- } & Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'onChange'>;
3
+ import type { InputProps } from './index';
64
4
  export declare const cnInput: import("@bem-react/classname").ClassNameFormatter;
65
5
  export declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
- export {};