@bodynarf/react.components 1.4.5 → 1.4.7
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/components/dropdown/components/compact/index.d.ts +1 -0
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.d.ts +1 -0
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/index.d.ts +1 -0
- package/components/dropdown/index.d.ts.map +1 -1
- package/components/primitives/checkbox/index.d.ts +3 -2
- package/components/primitives/checkbox/index.d.ts.map +1 -1
- package/components/primitives/checkbox/index.js +2 -0
- package/components/primitives/date/index.d.ts +1 -0
- package/components/primitives/date/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +1 -0
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +1 -0
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.d.ts +5 -0
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/number/components/withLabel/index.js +44 -0
- package/components/primitives/number/components/withoutLabel/index.d.ts +5 -0
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/number/components/withoutLabel/index.js +25 -0
- package/components/primitives/number/index.d.ts +10 -0
- package/components/primitives/number/index.d.ts.map +1 -0
- package/components/primitives/number/index.js +14 -0
- package/components/primitives/password/components/withLabel/index.d.ts +4 -0
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/password/components/withLabel/index.js +51 -0
- package/components/primitives/password/components/withoutLabel/index.d.ts +4 -0
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/password/components/withoutLabel/index.js +32 -0
- package/components/primitives/password/index.d.ts +14 -0
- package/components/primitives/password/index.d.ts.map +1 -0
- package/components/primitives/password/index.js +13 -0
- package/components/primitives/password/style.scss +16 -0
- package/components/primitives/text/components/textWithLabel/index.d.ts +1 -0
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/textWithoutLabel/index.js +1 -3
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { DropdownProps } from "../..";
|
|
2
3
|
declare const DropdownCompact: ({ items, value, onSelect, deselectable, className, hideOnOuterClick, listMaxHeight, placeholder, compact, }: DropdownProps) => JSX.Element;
|
|
3
4
|
export default DropdownCompact;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,QAAA,MAAM,eAAe,gHAMlB,aAAa,KAAG,WA6FlB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,QAAA,MAAM,eAAe,gHAMlB,aAAa,KAAG,WA6FlB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { DropdownProps } from '../..';
|
|
2
3
|
declare const DropdownWithLabel: ({ items, value, onSelect, validationState, deselectable, className, hideOnOuterClick, listMaxHeight, label, placeholder }: DropdownProps) => JSX.Element;
|
|
3
4
|
export default DropdownWithLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/withLabel/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,QAAA,MAAM,iBAAiB,8HAOpB,aAAa,KAAG,WA0KlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/withLabel/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,QAAA,MAAM,iBAAiB,8HAOpB,aAAa,KAAG,WA0KlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/index.tsx"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,oBAAY,aAAa,GAAG,gBAAgB,GAAG;IAC3C,kCAAkC;IAClC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE7B;;;MAGE;IACF,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;MAEE;IACF,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1C;;;MAGE;IACF,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,gBAAgB,EAAE,OAAO,CAAC;IAE1B,wBAAwB;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,+BAA+B;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC,CAAA;AAED,yBAAyB;AACzB,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAMxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/index.tsx"],"names":[],"mappings":";AAEA,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,oBAAY,aAAa,GAAG,gBAAgB,GAAG;IAC3C,kCAAkC;IAClC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE7B;;;MAGE;IACF,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;MAEE;IACF,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1C;;;MAGE;IACF,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,gBAAgB,EAAE,OAAO,CAAC;IAE1B,wBAAwB;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,+BAA+B;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC,CAAA;AAED,yBAAyB;AACzB,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAMxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./checkbox.scss";
|
|
2
2
|
import { BaseInputElementProps } from "../types";
|
|
3
|
-
export
|
|
3
|
+
export interface CheckBoxProps extends BaseInputElementProps<boolean> {
|
|
4
4
|
/** Is full colored checkbox */
|
|
5
5
|
block?: boolean;
|
|
6
6
|
/** Remove the checkbox border */
|
|
@@ -16,7 +16,8 @@ export declare type CheckBoxProps = BaseInputElementProps<boolean> & {
|
|
|
16
16
|
* @example `{ style: InputColor.Info, hasBackgrounColor: true, fixBackgroundColor: true }` -
|
|
17
17
|
*/
|
|
18
18
|
fixBackgroundColor?: boolean;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
|
+
/** Boolean input component */
|
|
20
21
|
declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor }: CheckBoxProps) => JSX.Element;
|
|
21
22
|
export default CheckBox;
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/index.tsx"],"names":[],"mappings":"AAIA,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/index.tsx"],"names":[],"mappings":"AAIA,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,OAAO,CAAC;IACjE,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iCAAiC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;MAGE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;MAIE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,+IAKX,aAAa,KAAG,WAsClB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import "./checkbox.scss";
|
|
5
|
+
;
|
|
6
|
+
/** Boolean input component */
|
|
5
7
|
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor }) => {
|
|
6
8
|
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
7
9
|
const id = name || generateGuid();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.tsx"],"names":[],"mappings":"AAIA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAa,MAAM,UAAU,CAAC;AAGxE,sCAAsC;AACtC,oBAAY,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC,GAAG;IACnF,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;IAElB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAA;AAED,2BAA2B;AAC3B,QAAA,MAAM,UAAU,wIAMb,SAAS,KAAG,WA4Gd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.tsx"],"names":[],"mappings":";AAIA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAa,MAAM,UAAU,CAAC;AAGxE,sCAAsC;AACtC,oBAAY,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC,GAAG;IACnF,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;IAElB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAA;AAED,2BAA2B;AAC3B,QAAA,MAAM,UAAU,wIAMb,SAAS,KAAG,WA4Gd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { MultilineProps } from "../..";
|
|
2
3
|
/** Multiline textual input component with describing label */
|
|
3
4
|
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded, loading, label, placeholder, fixed, rows, onBlur }: MultilineProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,kKAOrB,cAAc,KAAG,WAyGnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,kKAOrB,cAAc,KAAG,WAyGnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { MultilineProps } from "../..";
|
|
2
3
|
/** Multiline textual input component without describing label*/
|
|
3
4
|
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded, loading, fixed, rows, }: MultilineProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,wIAMxB,cAAc,KAAG,WA0CnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,wIAMxB,cAAc,KAAG,WA0CnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NumberProps } from "../..";
|
|
2
|
+
/** Number component with label */
|
|
3
|
+
declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }: NumberProps) => JSX.Element;
|
|
4
|
+
export default NumberWithLabel;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,sJAMlB,WAAW,KAAG,WAwGhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
+
import { InputSize } from "../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
|
+
/** Number component with label */
|
|
7
|
+
const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
|
|
9
|
+
const id = name || generateGuid();
|
|
10
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, InputSize.Normal));
|
|
11
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
|
+
const elClassName = getClassName([
|
|
13
|
+
className,
|
|
14
|
+
elSizeClassName,
|
|
15
|
+
rounded === true ? "is-rounded" : "",
|
|
16
|
+
styleClassName,
|
|
17
|
+
"input",
|
|
18
|
+
]);
|
|
19
|
+
const inputContainerClassName = getClassName([
|
|
20
|
+
"control",
|
|
21
|
+
loading === true ? "is-loading" : "",
|
|
22
|
+
]);
|
|
23
|
+
const labelClassName = getClassName([
|
|
24
|
+
"label",
|
|
25
|
+
!label.horizontal ? elSizeClassName : "",
|
|
26
|
+
label.className
|
|
27
|
+
]);
|
|
28
|
+
if (label.horizontal) {
|
|
29
|
+
const labelContainerClassName = getClassName([
|
|
30
|
+
"field-label",
|
|
31
|
+
elSizeClassName,
|
|
32
|
+
label.horizontalContainerClassName
|
|
33
|
+
]);
|
|
34
|
+
const fieldContainerClassName = getClassName([
|
|
35
|
+
"field-body",
|
|
36
|
+
label.horizontalFieldContainerClassName
|
|
37
|
+
]);
|
|
38
|
+
return (_jsxs("div", { className: "app-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
39
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("div", { className: "field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
42
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
43
|
+
};
|
|
44
|
+
export default NumberWithLabel;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NumberProps } from "../..";
|
|
2
|
+
/** Number component without label */
|
|
3
|
+
declare const NumberWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }: NumberProps) => JSX.Element;
|
|
4
|
+
export default NumberWithoutLabel;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,+IAMrB,WAAW,KAAG,WA4ChB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
+
import { InputSize } from "../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
|
+
/** Number component without label */
|
|
7
|
+
const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
|
|
9
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
10
|
+
const elClassName = getClassName([
|
|
11
|
+
className,
|
|
12
|
+
"is-{0}".format(getValueOrDefault(size, InputSize.Normal)),
|
|
13
|
+
rounded === true ? "is-rounded" : "",
|
|
14
|
+
styleClassName,
|
|
15
|
+
"input",
|
|
16
|
+
]);
|
|
17
|
+
const containerClassName = getClassName([
|
|
18
|
+
"control",
|
|
19
|
+
loading === true ? "is-loading" : "",
|
|
20
|
+
]);
|
|
21
|
+
const id = name || generateGuid();
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
23
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
24
|
+
};
|
|
25
|
+
export default NumberWithoutLabel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseInputElementProps } from "..";
|
|
2
|
+
/** Number component props type */
|
|
3
|
+
export interface NumberProps extends BaseInputElementProps<number> {
|
|
4
|
+
/** Focus out event handler */
|
|
5
|
+
onBlur?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/** Number input component */
|
|
8
|
+
declare const Number: (props: NumberProps) => JSX.Element;
|
|
9
|
+
export default Number;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAK3C,kCAAkC;AAClC,MAAM,WAAW,WAAY,SAAQ,qBAAqB,CAAC,MAAM,CAAC;IAC9D,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,6BAA6B;AAC7B,QAAA,MAAM,MAAM,UAAW,WAAW,KAAG,WAOpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import NumberWithLabel from "./components/withLabel";
|
|
4
|
+
import NumberWithoutLabel from "./components/withoutLabel";
|
|
5
|
+
/** Number input component */
|
|
6
|
+
const Number = (props) => {
|
|
7
|
+
if (isNullOrUndefined(props.label)) {
|
|
8
|
+
return (_jsx(NumberWithoutLabel, { ...props }));
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return (_jsx(NumberWithLabel, { ...props }));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export default Number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PasswordProps } from "../..";
|
|
2
|
+
declare const PasswordWithLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
3
|
+
export default PasswordWithLabel;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,uIAMpB,aAAa,KAAG,WA8HlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
+
import Icon from "../../../../icon";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
|
+
import { InputSize } from "../../../";
|
|
7
|
+
const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
|
+
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
10
|
+
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
11
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, InputSize.Normal));
|
|
13
|
+
const id = name || generateGuid();
|
|
14
|
+
const elClassName = getClassName([
|
|
15
|
+
className,
|
|
16
|
+
elSizeClassName,
|
|
17
|
+
rounded === true ? "is-rounded" : "",
|
|
18
|
+
styleClassName,
|
|
19
|
+
"bbr-password",
|
|
20
|
+
"input",
|
|
21
|
+
]);
|
|
22
|
+
const inputContainerClassName = getClassName([
|
|
23
|
+
"control",
|
|
24
|
+
loading === true ? "is-loading" : "",
|
|
25
|
+
canShowPassword ? "has-icons-right" : "",
|
|
26
|
+
"bbr-password__wrapper",
|
|
27
|
+
]);
|
|
28
|
+
const labelClassName = getClassName([
|
|
29
|
+
"label",
|
|
30
|
+
!label.horizontal ? elSizeClassName : "",
|
|
31
|
+
label.className
|
|
32
|
+
]);
|
|
33
|
+
if (label.horizontal) {
|
|
34
|
+
const labelContainerClassName = getClassName([
|
|
35
|
+
"field-label",
|
|
36
|
+
elSizeClassName,
|
|
37
|
+
label.horizontalContainerClassName
|
|
38
|
+
]);
|
|
39
|
+
const fieldContainerClassName = getClassName([
|
|
40
|
+
"field-body",
|
|
41
|
+
label.horizontalFieldContainerClassName
|
|
42
|
+
]);
|
|
43
|
+
return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", className: elClassName, placeholder: placeholder, disabled: disabled, onChange: onChange, name: id, id: id }), canShowPassword && !loading &&
|
|
44
|
+
_jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, title: "Show password", children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash" }) })] }), isValidationDefined && validationMessages.length > 0 &&
|
|
45
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
46
|
+
}
|
|
47
|
+
return (_jsxs("div", { className: "field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", className: elClassName, placeholder: placeholder, disabled: disabled, onChange: onChange, name: id, id: id }), canShowPassword && !loading &&
|
|
48
|
+
_jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash" }) })] }), isValidationDefined && validationMessages.length > 0 &&
|
|
49
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
50
|
+
};
|
|
51
|
+
export default PasswordWithLabel;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PasswordProps } from "../..";
|
|
2
|
+
declare const PasswordWithoutLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
3
|
+
export default PasswordWithoutLabel;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withoutLabel/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,oBAAoB,gIAMvB,aAAa,KAAG,WA0DlB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
+
import Icon from "../../../../icon";
|
|
5
|
+
import { InputSize } from "../../../types";
|
|
6
|
+
import { getValidationValues } from "../../../../../utils";
|
|
7
|
+
const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
|
+
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
10
|
+
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
11
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, InputSize.Normal));
|
|
13
|
+
const id = name || generateGuid();
|
|
14
|
+
const elClassName = getClassName([
|
|
15
|
+
className,
|
|
16
|
+
elSizeClassName,
|
|
17
|
+
rounded === true ? "is-rounded" : "",
|
|
18
|
+
styleClassName,
|
|
19
|
+
"bbr-password",
|
|
20
|
+
"input",
|
|
21
|
+
]);
|
|
22
|
+
const containerClassName = getClassName([
|
|
23
|
+
"control",
|
|
24
|
+
loading === true ? "is-loading" : "",
|
|
25
|
+
canShowPassword ? "has-icons-right" : "",
|
|
26
|
+
"bbr-password__wrapper",
|
|
27
|
+
]);
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", className: elClassName, placeholder: placeholder, disabled: disabled, onChange: onChange, name: id, id: id }), canShowPassword && !loading &&
|
|
29
|
+
_jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash" }) })] }), isValidationDefined && validationMessages.length > 0 &&
|
|
30
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
31
|
+
};
|
|
32
|
+
export default PasswordWithoutLabel;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./style.scss";
|
|
2
|
+
import { BaseInputElementProps } from "../types";
|
|
3
|
+
/** Password component props type */
|
|
4
|
+
export interface PasswordProps extends Omit<BaseInputElementProps<string>, 'defaultValue' | 'readonly'> {
|
|
5
|
+
/**
|
|
6
|
+
* Is icon "Show password" visible.
|
|
7
|
+
* Will show password on click
|
|
8
|
+
*/
|
|
9
|
+
canShowPassword: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Password input component */
|
|
12
|
+
declare const Password: (props: PasswordProps) => JSX.Element;
|
|
13
|
+
export default Password;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/index.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACnG;;;MAGE;IACF,eAAe,EAAE,OAAO,CAAC;CAC5B;AAED,+BAA+B;AAC/B,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAMxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
import PasswordWithLabel from "./components/withLabel";
|
|
5
|
+
import PasswordWithoutLabel from "./components/withoutLabel";
|
|
6
|
+
/** Password input component */
|
|
7
|
+
const Password = (props) => {
|
|
8
|
+
if (isNullOrUndefined(props.label)) {
|
|
9
|
+
return _jsx(PasswordWithoutLabel, { ...props });
|
|
10
|
+
}
|
|
11
|
+
return _jsx(PasswordWithLabel, { ...props });
|
|
12
|
+
};
|
|
13
|
+
export default Password;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TextProps } from "../..";
|
|
2
3
|
/** Textual input with describing label */
|
|
3
4
|
declare const TextWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }: TextProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,sJAMhB,SAAS,KAAG,WAwGd,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,sJAMhB,SAAS,KAAG,WAwGd,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithoutLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,+IAMnB,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithoutLabel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,+IAMnB,SAAS,KAAG,WA4Cd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -5,9 +5,7 @@ import { InputSize } from "../../../types";
|
|
|
5
5
|
import { getValidationValues } from "../../../../../utils";
|
|
6
6
|
/** Textual input without describing label */
|
|
7
7
|
const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }) => {
|
|
8
|
-
const onChange = useCallback((event) => onValueChange(event.target.value),
|
|
9
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
|
-
[onValueChange]);
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
9
|
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
10
|
const elClassName = getClassName([
|
|
13
11
|
className,
|