@invoicebox/ui 0.1.0-alpha.213 → 0.1.0-alpha.216
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.
- package/dist/components/form/InputLabel/index.d.ts +1 -0
- package/dist/components/form/InputLabel/index.js +5 -2
- package/dist/components/form/InputLabel/palette.d.ts +1 -0
- package/dist/components/form/InputLabel/palette.js +2 -1
- package/dist/components/form/InputLabel/styles.d.ts +1 -0
- package/dist/components/form/InputLabel/styles.js +14 -8
- package/dist/components/form/Select/components/Input/index.d.ts +2 -2
- package/dist/components/form/Select/components/Input/index.js +4 -2
- package/dist/components/form/Select/index.d.ts +3 -2
- package/dist/components/form/Select/index.js +4 -2
- package/dist/components/form/TextInput/index.d.ts +12 -3
- package/dist/components/form/TextInput/index.js +9 -4
- package/package.json +1 -1
|
@@ -17,7 +17,9 @@ var InputLabel = exports.InputLabel = function InputLabel(_ref) {
|
|
|
17
17
|
label = _ref.label,
|
|
18
18
|
_ref$inFocus = _ref.inFocus,
|
|
19
19
|
inFocus = _ref$inFocus === void 0 ? false : _ref$inFocus,
|
|
20
|
-
children = _ref.children
|
|
20
|
+
children = _ref.children,
|
|
21
|
+
_ref$required = _ref.required,
|
|
22
|
+
required = _ref$required === void 0 ? false : _ref$required;
|
|
21
23
|
var palette = (0, _palette.useComponentPalette)('inputLabel');
|
|
22
24
|
return /*#__PURE__*/_react["default"].createElement(S.Wrapper, {
|
|
23
25
|
$palette: palette,
|
|
@@ -26,6 +28,7 @@ var InputLabel = exports.InputLabel = function InputLabel(_ref) {
|
|
|
26
28
|
}, label && /*#__PURE__*/_react["default"].createElement(S.Label, {
|
|
27
29
|
$palette: palette,
|
|
28
30
|
$inFocus: inFocus,
|
|
29
|
-
variant: "captionRegular"
|
|
31
|
+
variant: "captionRegular",
|
|
32
|
+
$required: required
|
|
30
33
|
}, label), children);
|
|
31
34
|
};
|
|
@@ -8,6 +8,7 @@ var generateInputLabelPalette = exports.generateInputLabelPalette = function gen
|
|
|
8
8
|
return {
|
|
9
9
|
bg: abstractPalette.base,
|
|
10
10
|
text: abstractPalette.neutralBrutal,
|
|
11
|
-
textHighlight: abstractPalette.primary
|
|
11
|
+
textHighlight: abstractPalette.primary,
|
|
12
|
+
error: abstractPalette.error
|
|
12
13
|
};
|
|
13
14
|
};
|
|
@@ -3,6 +3,7 @@ import { TInputLabelPalette } from './palette';
|
|
|
3
3
|
export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("../../common/Typography").TTypographyProps & import("styled-components/dist/types").BaseObject, {
|
|
4
4
|
$inFocus: boolean;
|
|
5
5
|
$palette: TInputLabelPalette;
|
|
6
|
+
$required?: boolean | undefined;
|
|
6
7
|
}>> & string & Omit<import("react").FC<import("../../common/Typography").TTypographyProps>, keyof import("react").Component<any, {}, any>>;
|
|
7
8
|
export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
9
|
$disabled: boolean;
|
|
@@ -12,25 +12,31 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
12
12
|
var Label = exports.Label = (0, _styledComponents["default"])(_Typography.Typography).withConfig({
|
|
13
13
|
displayName: "styles__Label",
|
|
14
14
|
componentId: "sc-1prrc3p-0"
|
|
15
|
-
})(["border-radius:10px;position:absolute;top:0;left:10px;background-color:", ";padding:0 10px;z-index:2;transition:color 0.2s ease-in-out 0s;color:", ";"], function (_ref) {
|
|
15
|
+
})(["border-radius:10px;position:absolute;top:0;left:10px;background-color:", ";padding:0 10px;z-index:2;transition:color 0.2s ease-in-out 0s;color:", ";", ""], function (_ref) {
|
|
16
16
|
var $palette = _ref.$palette;
|
|
17
17
|
return $palette.bg;
|
|
18
18
|
}, function (_ref2) {
|
|
19
19
|
var $inFocus = _ref2.$inFocus,
|
|
20
20
|
$palette = _ref2.$palette;
|
|
21
21
|
return $inFocus ? $palette.textHighlight : $palette.text;
|
|
22
|
+
}, function (_ref3) {
|
|
23
|
+
var $required = _ref3.$required,
|
|
24
|
+
$palette = _ref3.$palette;
|
|
25
|
+
return $required && (0, _styledComponents.css)(["&::after{content:\" *\";color:", ";"], function () {
|
|
26
|
+
return $palette.error;
|
|
27
|
+
});
|
|
22
28
|
});
|
|
23
29
|
var Wrapper = exports.Wrapper = _styledComponents["default"].div.withConfig({
|
|
24
30
|
displayName: "styles__Wrapper",
|
|
25
31
|
componentId: "sc-1prrc3p-1"
|
|
26
|
-
})(["position:relative;padding-top:", "px;width:100%;opacity:", ";&:hover ", "{", ";}"], function (
|
|
27
|
-
var $isLabel =
|
|
32
|
+
})(["position:relative;padding-top:", "px;width:100%;opacity:", ";&:hover ", "{", ";}"], function (_ref4) {
|
|
33
|
+
var $isLabel = _ref4.$isLabel;
|
|
28
34
|
return $isLabel ? 10 : 0;
|
|
29
|
-
}, function (
|
|
30
|
-
var $disabled =
|
|
35
|
+
}, function (_ref5) {
|
|
36
|
+
var $disabled = _ref5.$disabled;
|
|
31
37
|
return $disabled ? 0.5 : 1;
|
|
32
|
-
}, Label, function (
|
|
33
|
-
var $disabled =
|
|
34
|
-
$palette =
|
|
38
|
+
}, Label, function (_ref6) {
|
|
39
|
+
var $disabled = _ref6.$disabled,
|
|
40
|
+
$palette = _ref6.$palette;
|
|
35
41
|
return !$disabled && (0, _styledComponents.css)(["color:", ";"], $palette.textHighlight);
|
|
36
42
|
});
|
|
@@ -3,11 +3,11 @@ import { TProps as TInputLabelProps } from '../../../InputLabel';
|
|
|
3
3
|
import { TProps as TPureInputProps } from '../../../PureInput';
|
|
4
4
|
import { TProps as TArrowProps } from '../../../../common/Arrow';
|
|
5
5
|
import { TSizes } from '../../../constants';
|
|
6
|
-
export type TProps = Pick<TInputLabelProps, 'inFocus' | 'label'> & Pick<TPureInputProps, 'hasError' | 'placeholder' | 'name' | 'onFocus' | 'onBlur' | 'value' | 'onClick'> & Pick<TArrowProps, 'isOpen'> & {
|
|
6
|
+
export type TProps = Pick<TInputLabelProps, 'inFocus' | 'label' | 'required'> & Pick<TPureInputProps, 'hasError' | 'placeholder' | 'name' | 'onFocus' | 'onBlur' | 'value' | 'onClick'> & Pick<TArrowProps, 'isOpen'> & {
|
|
7
7
|
onReset?: () => void;
|
|
8
8
|
size?: TSizes;
|
|
9
9
|
};
|
|
10
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<TInputLabelProps, "label" | "inFocus"> & Pick<TPureInputProps, "name" | "value" | "placeholder" | "onFocus" | "onBlur" | "onClick" | "hasError"> & Pick<TArrowProps, "isOpen"> & {
|
|
10
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<TInputLabelProps, "required" | "label" | "inFocus"> & Pick<TPureInputProps, "name" | "value" | "placeholder" | "onFocus" | "onBlur" | "onClick" | "hasError"> & Pick<TArrowProps, "isOpen"> & {
|
|
11
11
|
onReset?: (() => void) | undefined;
|
|
12
12
|
size?: TSizes | undefined;
|
|
13
13
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -28,11 +28,13 @@ var Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
|
28
28
|
onReset = _ref.onReset,
|
|
29
29
|
_ref$size = _ref.size,
|
|
30
30
|
size = _ref$size === void 0 ? 'M' : _ref$size,
|
|
31
|
-
onClick = _ref.onClick
|
|
31
|
+
onClick = _ref.onClick,
|
|
32
|
+
required = _ref.required;
|
|
32
33
|
var isShowResetIcon = !!value && !!onReset;
|
|
33
34
|
return /*#__PURE__*/_react["default"].createElement(_InputLabel.InputLabel, {
|
|
34
35
|
inFocus: inFocus,
|
|
35
|
-
label: label
|
|
36
|
+
label: label,
|
|
37
|
+
required: required
|
|
36
38
|
}, /*#__PURE__*/_react["default"].createElement(S.ControlWrapper, null, /*#__PURE__*/_react["default"].createElement(_PureInput.PureInput, _extends({
|
|
37
39
|
ref: ref,
|
|
38
40
|
hasError: hasError,
|
|
@@ -11,7 +11,7 @@ export type TGroup = {
|
|
|
11
11
|
id: string;
|
|
12
12
|
entity?: unknown;
|
|
13
13
|
};
|
|
14
|
-
export type TProps<TValue> = Pick<TInputProps, 'label' | 'hasError' | 'placeholder' | 'name' | 'size' | 'onBlur'> & {
|
|
14
|
+
export type TProps<TValue> = Pick<TInputProps, 'label' | 'hasError' | 'placeholder' | 'name' | 'size' | 'onBlur' | 'required'> & {
|
|
15
15
|
value: TValue | null;
|
|
16
16
|
onChange: (value: TValue | null) => void;
|
|
17
17
|
options: TOption<TValue>[];
|
|
@@ -25,5 +25,6 @@ export type TProps<TValue> = Pick<TInputProps, 'label' | 'hasError' | 'placehold
|
|
|
25
25
|
scrollbarMaxHeight?: number;
|
|
26
26
|
emptyOptionsLabel?: string;
|
|
27
27
|
isLoading?: boolean;
|
|
28
|
+
required?: boolean;
|
|
28
29
|
};
|
|
29
|
-
export declare const Select: <TValue extends string | number>({ label, hasError, placeholder, name, value, onChange, options, groups, isResetButtonEnabled, size, renderOption, dropdownHeader, isDrawerOptions, renderGroup, scrollbarMaxHeight, scrollbarHeader, emptyOptionsLabel, isLoading, onBlur, }: TProps<TValue>) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const Select: <TValue extends string | number>({ label, hasError, placeholder, name, value, onChange, options, groups, isResetButtonEnabled, size, renderOption, dropdownHeader, isDrawerOptions, renderGroup, scrollbarMaxHeight, scrollbarHeader, emptyOptionsLabel, isLoading, onBlur, required, }: TProps<TValue>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -50,7 +50,8 @@ var Select = exports.Select = function Select(_ref) {
|
|
|
50
50
|
scrollbarHeader = _ref.scrollbarHeader,
|
|
51
51
|
emptyOptionsLabel = _ref.emptyOptionsLabel,
|
|
52
52
|
isLoading = _ref.isLoading,
|
|
53
|
-
onBlur = _ref.onBlur
|
|
53
|
+
onBlur = _ref.onBlur,
|
|
54
|
+
required = _ref.required;
|
|
54
55
|
var palette = (0, _palette.useComponentPalette)('select');
|
|
55
56
|
var _useInputFocus = (0, _useInputFocus2.useInputFocus)({
|
|
56
57
|
onBlur: onBlur
|
|
@@ -207,7 +208,8 @@ var Select = exports.Select = function Select(_ref) {
|
|
|
207
208
|
isOpen: isOpen,
|
|
208
209
|
onReset: isResetButtonEnabled ? handleReset : undefined,
|
|
209
210
|
size: size,
|
|
210
|
-
onClick: isDrawerOptions ? handleInputClick : undefined
|
|
211
|
+
onClick: isDrawerOptions ? handleInputClick : undefined,
|
|
212
|
+
required: required
|
|
211
213
|
})), isDrawerOptions ? /*#__PURE__*/_react["default"].createElement(_Drawer.Drawer, {
|
|
212
214
|
onClose: handleHide,
|
|
213
215
|
isOpen: isOpen,
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { TProps as TInputLabelProps } from '../InputLabel';
|
|
3
3
|
import { TProps as TPureInputProps } from '../PureInput';
|
|
4
4
|
import { TSizes } from '../constants';
|
|
5
|
-
export type TProps = Pick<TInputLabelProps, 'label'> & Pick<TPureInputProps, 'placeholder' | 'hasError' | 'onFocus' | 'onBlur' | 'disabled' | 'name' | 'paddingRight' | 'type' | 'isOnlyNumbers' | 'autoFocus' | 'rows'> & {
|
|
5
|
+
export type TProps = Pick<TInputLabelProps, 'label' | 'required'> & Pick<TPureInputProps, 'placeholder' | 'hasError' | 'onFocus' | 'onBlur' | 'disabled' | 'name' | 'paddingRight' | 'type' | 'isOnlyNumbers' | 'autoFocus' | 'rows'> & {
|
|
6
6
|
value: string;
|
|
7
7
|
onChange: (value: string) => void;
|
|
8
8
|
maxLength?: number;
|
|
9
9
|
size?: TSizes;
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
element?: 'input' | 'textarea';
|
|
12
|
+
required?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare const TextInput:
|
|
14
|
+
export declare const TextInput: React.ForwardRefExoticComponent<Pick<TInputLabelProps, "required" | "label"> & Pick<TPureInputProps, "type" | "name" | "paddingRight" | "disabled" | "placeholder" | "rows" | "autoFocus" | "onFocus" | "onBlur" | "hasError" | "isOnlyNumbers"> & {
|
|
15
|
+
value: string;
|
|
16
|
+
onChange: (value: string) => void;
|
|
17
|
+
maxLength?: number | undefined;
|
|
18
|
+
size?: TSizes | undefined;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
element?: "input" | "textarea" | undefined;
|
|
21
|
+
required?: boolean | undefined;
|
|
22
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -14,7 +14,7 @@ var _constants = require("../constants");
|
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
16
16
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
-
var TextInput = exports.TextInput = function
|
|
17
|
+
var TextInput = exports.TextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
18
18
|
var _ref$hasError = _ref.hasError,
|
|
19
19
|
hasError = _ref$hasError === void 0 ? false : _ref$hasError,
|
|
20
20
|
onFocus = _ref.onFocus,
|
|
@@ -35,7 +35,9 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
35
35
|
autoFocus = _ref.autoFocus,
|
|
36
36
|
_ref$element = _ref.element,
|
|
37
37
|
element = _ref$element === void 0 ? 'input' : _ref$element,
|
|
38
|
-
rows = _ref.rows
|
|
38
|
+
rows = _ref.rows,
|
|
39
|
+
_ref$required = _ref.required,
|
|
40
|
+
required = _ref$required === void 0 ? false : _ref$required;
|
|
39
41
|
var _useInputFocus = (0, _useInputFocus2.useInputFocus)({
|
|
40
42
|
onFocus: onFocus,
|
|
41
43
|
onBlur: onBlur
|
|
@@ -49,8 +51,10 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
49
51
|
return /*#__PURE__*/_react["default"].createElement(_InputLabel.InputLabel, {
|
|
50
52
|
inFocus: inFocus,
|
|
51
53
|
label: label,
|
|
52
|
-
disabled: disabled
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
required: required
|
|
53
56
|
}, /*#__PURE__*/_react["default"].createElement(S.InputLabelContent, null, /*#__PURE__*/_react["default"].createElement(_PureInput.PureInput, _extends({
|
|
57
|
+
ref: ref,
|
|
54
58
|
name: name,
|
|
55
59
|
disabled: disabled,
|
|
56
60
|
hasError: hasError,
|
|
@@ -67,4 +71,5 @@ var TextInput = exports.TextInput = function TextInput(_ref) {
|
|
|
67
71
|
element: element,
|
|
68
72
|
rows: rows
|
|
69
73
|
}, _constants.SIZE_PARAMS_MAP[size])), children && /*#__PURE__*/_react["default"].createElement(S.ChildrenWrapper, null, children)));
|
|
70
|
-
};
|
|
74
|
+
});
|
|
75
|
+
TextInput.displayName = 'TextInput';
|