@bodynarf/react.components 1.7.1 → 1.7.3
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 → components}/accordion/component/index.d.ts +7 -4
- package/components/accordion/component/index.d.ts.map +1 -0
- package/components/accordion/component/index.js +35 -0
- package/components/accordion/index.d.ts +3 -0
- package/components/accordion/index.d.ts.map +1 -0
- package/{dist/components/anchor/index.d.ts → components/accordion/index.js} +2 -2
- package/{dist/components → components}/accordion/types.d.ts +18 -16
- package/components/accordion/types.d.ts.map +1 -0
- package/components/accordion/types.js +1 -0
- package/components/anchor/component/index.d.ts +6 -0
- package/components/anchor/component/index.d.ts.map +1 -0
- package/components/anchor/component/index.js +20 -0
- package/{dist/components → components}/anchor/components/anchorWithIcon/index.d.ts +5 -3
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -0
- package/components/anchor/components/anchorWithIcon/index.js +16 -0
- package/{dist/components → components}/anchor/components/simpleAnchor/index.d.ts +5 -3
- package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -0
- package/components/anchor/components/simpleAnchor/index.js +5 -0
- package/components/anchor/index.d.ts +3 -0
- package/components/anchor/index.d.ts.map +1 -0
- package/{dist/components/button/index.d.ts → components/anchor/index.js} +2 -2
- package/{dist/components → components}/anchor/types.d.ts +39 -38
- package/components/anchor/types.d.ts.map +1 -0
- package/components/anchor/types.js +1 -0
- package/{dist/components → components}/button/component/index.d.ts +9 -6
- package/components/button/component/index.d.ts.map +1 -0
- package/components/button/component/index.js +36 -0
- package/{dist/components → components}/button/components/buttonWithIcon/index.d.ts +5 -3
- package/components/button/components/buttonWithIcon/index.d.ts.map +1 -0
- package/components/button/components/buttonWithIcon/index.js +19 -0
- package/{dist/components → components}/button/components/simpleButton/index.d.ts +5 -3
- package/components/button/components/simpleButton/index.d.ts.map +1 -0
- package/components/button/components/simpleButton/index.js +5 -0
- package/components/button/index.d.ts +3 -0
- package/components/button/index.d.ts.map +1 -0
- package/{dist/components/dropdown/index.d.ts → components/button/index.js} +2 -2
- package/{dist/components → components}/button/types.d.ts +37 -36
- package/components/button/types.d.ts.map +1 -0
- package/components/button/types.js +4 -0
- package/components/dropdown/component/index.d.ts +7 -0
- package/components/dropdown/component/index.d.ts.map +1 -0
- package/components/dropdown/component/index.js +15 -0
- package/{dist/components → components}/dropdown/components/compact/index.d.ts +5 -3
- package/components/dropdown/components/compact/index.d.ts.map +1 -0
- package/components/dropdown/components/compact/index.js +62 -0
- package/{dist/components → components}/dropdown/components/item/index.d.ts +15 -13
- package/components/dropdown/components/item/index.d.ts.map +1 -0
- package/components/dropdown/components/item/index.js +6 -0
- package/{dist/components → components}/dropdown/components/label/index.d.ts +18 -17
- package/components/dropdown/components/label/index.d.ts.map +1 -0
- package/components/dropdown/components/label/index.js +22 -0
- package/{dist/components → components}/dropdown/components/withLabel/index.d.ts +5 -3
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -0
- package/components/dropdown/components/withLabel/index.js +83 -0
- package/components/dropdown/index.d.ts +3 -0
- package/components/dropdown/index.d.ts.map +1 -0
- package/{dist/components/accordion/index.d.ts → components/dropdown/index.js} +2 -2
- package/{dist/components → components}/dropdown/types.d.ts +46 -45
- package/components/dropdown/types.d.ts.map +1 -0
- package/components/dropdown/types.js +1 -0
- package/components/icon/component/index.d.ts +8 -0
- package/components/icon/component/index.d.ts.map +1 -0
- package/components/icon/component/index.js +23 -0
- package/components/icon/index.d.ts +3 -0
- package/components/icon/index.d.ts.map +1 -0
- package/components/icon/index.js +2 -0
- package/{dist/components → components}/icon/types.d.ts +16 -15
- package/components/icon/types.d.ts.map +1 -0
- package/components/icon/types.js +1 -0
- package/components/index.d.ts +12 -0
- package/components/index.d.ts.map +1 -0
- package/{dist/components/index.d.ts → components/index.js} +11 -11
- package/{dist/components → components}/paginator/component/index.d.ts +8 -6
- package/components/paginator/component/index.d.ts.map +1 -0
- package/components/paginator/component/index.js +47 -0
- package/components/paginator/index.d.ts +4 -0
- package/components/paginator/index.d.ts.map +1 -0
- package/{dist/components/paginator/index.d.ts → components/paginator/index.js} +3 -3
- package/{dist/components → components}/paginator/types.d.ts +28 -27
- package/components/paginator/types.d.ts.map +1 -0
- package/components/paginator/types.js +1 -0
- package/{dist/components → components}/paginator/utils.d.ts +10 -9
- package/components/paginator/utils.d.ts.map +1 -0
- package/components/paginator/utils.js +18 -0
- package/{dist/components → components}/primitives/checkbox/component/index.d.ts +7 -4
- package/components/primitives/checkbox/component/index.d.ts.map +1 -0
- package/components/primitives/checkbox/component/index.js +37 -0
- package/components/primitives/checkbox/index.d.ts +3 -0
- package/components/primitives/checkbox/index.d.ts.map +1 -0
- package/components/primitives/checkbox/index.js +2 -0
- package/{dist/components → components}/primitives/checkbox/types.d.ts +25 -24
- package/components/primitives/checkbox/types.d.ts.map +1 -0
- package/components/primitives/checkbox/types.js +1 -0
- package/{dist/components → components}/primitives/date/component/index.d.ts +7 -4
- package/components/primitives/date/component/index.d.ts.map +1 -0
- package/components/primitives/date/component/index.js +48 -0
- package/components/primitives/date/index.d.ts +3 -0
- package/components/primitives/date/index.d.ts.map +1 -0
- package/components/primitives/date/index.js +2 -0
- package/{dist/components → components}/primitives/date/types.d.ts +9 -8
- package/components/primitives/date/types.d.ts.map +1 -0
- package/components/primitives/date/types.js +1 -0
- package/components/primitives/index.d.ts +8 -0
- package/components/primitives/index.d.ts.map +1 -0
- package/{dist/components/primitives/index.d.ts → components/primitives/index.js} +7 -7
- package/components/primitives/multiline/component/index.d.ts +7 -0
- package/components/primitives/multiline/component/index.d.ts.map +1 -0
- package/components/primitives/multiline/component/index.js +15 -0
- package/{dist/components → components}/primitives/multiline/components/multilineWithLabel/index.d.ts +6 -4
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/multilineWithLabel/index.js +45 -0
- package/{dist/components → components}/primitives/multiline/components/multilineWithoutLabel/index.d.ts +6 -4
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +27 -0
- package/components/primitives/multiline/index.d.ts +3 -0
- package/components/primitives/multiline/index.d.ts.map +1 -0
- package/components/primitives/multiline/index.js +2 -0
- package/{dist/components → components}/primitives/multiline/types.d.ts +11 -10
- package/components/primitives/multiline/types.d.ts.map +1 -0
- package/components/primitives/multiline/types.js +1 -0
- package/components/primitives/number/component/index.d.ts +6 -0
- package/components/primitives/number/component/index.d.ts.map +1 -0
- package/components/primitives/number/component/index.js +14 -0
- package/{dist/components → components}/primitives/number/components/withLabel/index.d.ts +6 -4
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/number/components/withLabel/index.js +44 -0
- package/{dist/components → components}/primitives/number/components/withoutLabel/index.d.ts +6 -4
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/number/components/withoutLabel/index.js +26 -0
- package/components/primitives/number/index.d.ts +3 -0
- package/components/primitives/number/index.d.ts.map +1 -0
- package/components/primitives/number/index.js +2 -0
- package/{dist/components → components}/primitives/number/types.d.ts +13 -12
- package/components/primitives/number/types.d.ts.map +1 -0
- package/components/primitives/number/types.js +1 -0
- package/components/primitives/password/component/index.d.ts +7 -0
- package/components/primitives/password/component/index.d.ts.map +1 -0
- package/components/primitives/password/component/index.js +13 -0
- package/{dist/components → components}/primitives/password/components/withLabel/index.d.ts +5 -3
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/password/components/withLabel/index.js +51 -0
- package/{dist/components → components}/primitives/password/components/withoutLabel/index.d.ts +5 -3
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/password/components/withoutLabel/index.js +33 -0
- package/components/primitives/password/index.d.ts +3 -0
- package/components/primitives/password/index.d.ts.map +1 -0
- package/components/primitives/password/index.js +2 -0
- package/{dist/components → components}/primitives/password/types.d.ts +10 -9
- package/components/primitives/password/types.d.ts.map +1 -0
- package/components/primitives/password/types.js +1 -0
- package/components/primitives/text/component/index.d.ts +7 -0
- package/components/primitives/text/component/index.d.ts.map +1 -0
- package/components/primitives/text/component/index.js +15 -0
- package/{dist/components → components}/primitives/text/components/textWithLabel/index.d.ts +6 -4
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/textWithLabel/index.js +44 -0
- package/{dist/components → components}/primitives/text/components/textWithoutLabel/index.d.ts +6 -4
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/textWithoutLabel/index.js +26 -0
- package/components/primitives/text/index.d.ts +3 -0
- package/components/primitives/text/index.d.ts.map +1 -0
- package/components/primitives/text/index.js +2 -0
- package/{dist/components → components}/primitives/text/types.d.ts +7 -6
- package/components/primitives/text/types.d.ts.map +1 -0
- package/components/primitives/text/types.js +1 -0
- package/{dist/components → components}/primitives/types/baseProps.d.ts +30 -29
- package/components/primitives/types/baseProps.d.ts.map +1 -0
- package/components/primitives/types/baseProps.js +1 -0
- package/components/primitives/types/index.d.ts +4 -0
- package/components/primitives/types/index.d.ts.map +1 -0
- package/{dist/components/primitives/types/index.d.ts → components/primitives/types/index.js} +3 -3
- package/{dist/components → components}/primitives/types/label.d.ts +14 -13
- package/components/primitives/types/label.d.ts.map +1 -0
- package/components/primitives/types/label.js +1 -0
- package/components/primitives/types/validation/index.d.ts +3 -0
- package/components/primitives/types/validation/index.d.ts.map +1 -0
- package/{dist/components/primitives/types/validation/index.d.ts → components/primitives/types/validation/index.js} +2 -2
- package/{dist/components → components}/primitives/types/validation/state.d.ts +9 -8
- package/components/primitives/types/validation/state.d.ts.map +1 -0
- package/components/primitives/types/validation/state.js +2 -0
- package/{dist/components → components}/primitives/types/validation/status.d.ts +10 -9
- package/components/primitives/types/validation/status.d.ts.map +1 -0
- package/components/primitives/types/validation/status.js +11 -0
- package/{dist/components → components}/search/component/index.d.ts +6 -3
- package/components/search/component/index.d.ts.map +1 -0
- package/components/search/component/index.js +37 -0
- package/components/search/index.d.ts +3 -0
- package/components/search/index.d.ts.map +1 -0
- package/components/search/index.js +2 -0
- package/{dist/components → components}/search/types.d.ts +27 -26
- package/components/search/types.d.ts.map +1 -0
- package/components/search/types.js +1 -0
- package/{dist/components → components}/tabs/component/index.d.ts +34 -31
- package/components/tabs/component/index.d.ts.map +1 -0
- package/components/tabs/component/index.js +68 -0
- package/{dist/components → components}/tabs/components/item/index.d.ts +13 -11
- package/components/tabs/components/item/index.d.ts.map +1 -0
- package/components/tabs/components/item/index.js +27 -0
- package/components/tabs/index.d.ts +3 -0
- package/components/tabs/index.d.ts.map +1 -0
- package/components/tabs/index.js +2 -0
- package/{dist/components → components}/tabs/types.d.ts +43 -42
- package/components/tabs/types.d.ts.map +1 -0
- package/components/tabs/types.js +34 -0
- package/{dist/components → components}/tag/component/index.d.ts +7 -4
- package/components/tag/component/index.d.ts.map +1 -0
- package/components/tag/component/index.js +28 -0
- package/components/tag/index.d.ts +3 -0
- package/components/tag/index.d.ts.map +1 -0
- package/components/tag/index.js +2 -0
- package/{dist/components → components}/tag/types.d.ts +27 -26
- package/components/tag/types.d.ts.map +1 -0
- package/components/tag/types.js +1 -0
- package/{dist/components → components}/types.d.ts +67 -66
- package/components/types.d.ts.map +1 -0
- package/components/types.js +31 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.d.ts.map +1 -0
- package/{dist/hooks/index.d.ts → hooks/index.js} +2 -2
- package/{dist/hooks → hooks}/useComponentOutsideClick.d.ts +11 -10
- package/hooks/useComponentOutsideClick.d.ts.map +1 -0
- package/hooks/useComponentOutsideClick.js +32 -0
- package/{dist/hooks → hooks}/usePagination.d.ts +20 -19
- package/hooks/usePagination.d.ts.map +1 -0
- package/hooks/usePagination.js +28 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.d.ts → index.js} +3 -3
- package/package.json +39 -45
- package/readme.md +56 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/{dist/utils → utils}/dataAttributes.d.ts +8 -7
- package/utils/dataAttributes.d.ts.map +1 -0
- package/utils/dataAttributes.js +19 -0
- package/{dist/utils → utils}/formValidation.d.ts +16 -15
- package/utils/formValidation.d.ts.map +1 -0
- package/utils/formValidation.js +35 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.d.ts.map +1 -0
- package/{dist/utils/index.d.ts → utils/index.js} +2 -2
- package/dist/bbr-components.js +0 -1040
- package/dist/bbr-components.umd.cjs +0 -27
- package/dist/components/anchor/component/index.d.ts +0 -3
- package/dist/components/dropdown/component/index.d.ts +0 -4
- package/dist/components/icon/component/index.d.ts +0 -5
- package/dist/components/icon/index.d.ts +0 -2
- package/dist/components/primitives/checkbox/index.d.ts +0 -2
- package/dist/components/primitives/date/index.d.ts +0 -2
- package/dist/components/primitives/multiline/component/index.d.ts +0 -4
- package/dist/components/primitives/multiline/index.d.ts +0 -2
- package/dist/components/primitives/number/component/index.d.ts +0 -4
- package/dist/components/primitives/number/index.d.ts +0 -2
- package/dist/components/primitives/password/component/index.d.ts +0 -4
- package/dist/components/primitives/password/index.d.ts +0 -2
- package/dist/components/primitives/text/component/index.d.ts +0 -4
- package/dist/components/primitives/text/index.d.ts +0 -2
- package/dist/components/search/index.d.ts +0 -2
- package/dist/components/tabs/index.d.ts +0 -2
- package/dist/components/tag/index.d.ts +0 -2
- package/dist/style.css +0 -1
|
@@ -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, isStringEmpty } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "@bbr/components";
|
|
5
|
+
import { getValidationValues } from "@bbr/utils";
|
|
6
|
+
/** Number component with label */
|
|
7
|
+
const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, step, }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value) ? undefined : +event.target.value), [onValueChange]);
|
|
9
|
+
const id = name || generateGuid();
|
|
10
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.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: "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: [_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, step: step ?? 1 }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
39
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("div", { className: "bbr-input 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, step: step ?? 1 }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
42
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
43
|
+
};
|
|
44
|
+
export default NumberWithLabel;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NumberProps } from "@bbr/components/number";
|
|
3
|
+
/** Number component without label */
|
|
4
|
+
declare const NumberWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, step, }: NumberProps) => JSX.Element;
|
|
5
|
+
export default NumberWithoutLabel;
|
|
6
|
+
//# 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":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,qJAOrB,WAAW,KAAG,WA8ChB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { ElementSize } from "@bbr/components";
|
|
5
|
+
import { getValidationValues } from "@bbr/utils";
|
|
6
|
+
/** Number component without label */
|
|
7
|
+
const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, step, }) => {
|
|
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, ElementSize.Normal)),
|
|
13
|
+
rounded === true ? "is-rounded" : "",
|
|
14
|
+
styleClassName,
|
|
15
|
+
"input",
|
|
16
|
+
]);
|
|
17
|
+
const containerClassName = getClassName([
|
|
18
|
+
"control",
|
|
19
|
+
"bbr-input",
|
|
20
|
+
loading === true ? "is-loading" : "",
|
|
21
|
+
]);
|
|
22
|
+
const id = name || generateGuid();
|
|
23
|
+
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, step: step ?? 1 }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
24
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
25
|
+
};
|
|
26
|
+
export default NumberWithoutLabel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
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
|
-
* Difference which will be used to change value after step button click.
|
|
8
|
-
* See html input step documentation.
|
|
9
|
-
* @default 1
|
|
10
|
-
*/
|
|
11
|
-
step?: number;
|
|
12
|
-
}
|
|
1
|
+
import { BaseInputElementProps } from "@bbr/components";
|
|
2
|
+
/** Number component props type */
|
|
3
|
+
export interface NumberProps extends BaseInputElementProps<number> {
|
|
4
|
+
/** Focus out event handler */
|
|
5
|
+
onBlur?: () => void;
|
|
6
|
+
/**
|
|
7
|
+
* Difference which will be used to change value after step button click.
|
|
8
|
+
* See html input step documentation.
|
|
9
|
+
* @default 1
|
|
10
|
+
*/
|
|
11
|
+
step?: number;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,kCAAkC;AAClC,MAAM,WAAW,WAAY,SAAQ,qBAAqB,CAAC,MAAM,CAAC;IAC9D,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;MAIE;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./style.scss";
|
|
3
|
+
import { PasswordProps } from "@bbr/components/password";
|
|
4
|
+
/** Password input component */
|
|
5
|
+
declare const Password: (props: PasswordProps) => JSX.Element;
|
|
6
|
+
export default Password;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/password/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,+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 "@bbr/components/password/components/withLabel";
|
|
5
|
+
import PasswordWithoutLabel from "@bbr/components/password/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,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PasswordProps } from "@bbr/components/password";
|
|
3
|
+
declare const PasswordWithLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
4
|
+
export default PasswordWithLabel;
|
|
5
|
+
//# 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":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,QAAA,MAAM,iBAAiB,uIAMpB,aAAa,KAAG,WAgIlB,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 { getValidationValues } from "@bbr/utils";
|
|
5
|
+
import { ElementSize } from "@bbr/components";
|
|
6
|
+
import Icon from "@bbr/components/icon";
|
|
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, ElementSize.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", size: ElementSize.Medium }) })] }), isValidationDefined && validationMessages.length > 0 &&
|
|
45
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
46
|
+
}
|
|
47
|
+
return (_jsxs("div", { className: "bbr-input 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", size: ElementSize.Medium }) })] }), isValidationDefined && validationMessages.length > 0 &&
|
|
49
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
50
|
+
};
|
|
51
|
+
export default PasswordWithLabel;
|
package/{dist/components → components}/primitives/password/components/withoutLabel/index.d.ts
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PasswordProps } from "@bbr/components/password";
|
|
3
|
+
declare const PasswordWithoutLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
4
|
+
export default PasswordWithoutLabel;
|
|
5
|
+
//# 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":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,QAAA,MAAM,oBAAoB,gIAMvB,aAAa,KAAG,WA4DlB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { ElementSize } from "@bbr/components";
|
|
5
|
+
import { getValidationValues } from "@bbr/utils";
|
|
6
|
+
import Icon from "@bbr/components/icon";
|
|
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, ElementSize.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
|
+
"bbr-input",
|
|
25
|
+
loading === true ? "is-loading" : "",
|
|
26
|
+
canShowPassword ? "has-icons-right" : "",
|
|
27
|
+
"bbr-password__wrapper",
|
|
28
|
+
]);
|
|
29
|
+
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 &&
|
|
30
|
+
_jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), isValidationDefined && validationMessages.length > 0 &&
|
|
31
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
32
|
+
};
|
|
33
|
+
export default PasswordWithoutLabel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BaseInputElementProps } from
|
|
2
|
-
/** Password component props type */
|
|
3
|
-
export interface PasswordProps extends Omit<BaseInputElementProps<string>, "defaultValue" | "readonly"> {
|
|
4
|
-
/**
|
|
5
|
-
* Is icon "Show password" visible.
|
|
6
|
-
* Will show password on click
|
|
7
|
-
*/
|
|
8
|
-
canShowPassword: boolean;
|
|
9
|
-
}
|
|
1
|
+
import { BaseInputElementProps } from "@bbr/components";
|
|
2
|
+
/** Password component props type */
|
|
3
|
+
export interface PasswordProps extends Omit<BaseInputElementProps<string>, "defaultValue" | "readonly"> {
|
|
4
|
+
/**
|
|
5
|
+
* Is icon "Show password" visible.
|
|
6
|
+
* Will show password on click
|
|
7
|
+
*/
|
|
8
|
+
canShowPassword: boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,8BAA8B;AAC9B,QAAA,MAAM,IAAI,UAAW,SAAS,KAAG,WAOhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import "../../../../common.scss";
|
|
4
|
+
import TextWithLabel from "@bbr/components/text/components/textWithLabel";
|
|
5
|
+
import TextWithoutLabel from "@bbr/components/text/components/textWithoutLabel";
|
|
6
|
+
/** Textual input component */
|
|
7
|
+
const Text = (props) => {
|
|
8
|
+
if (isNullOrUndefined(props.label)) {
|
|
9
|
+
return (_jsx(TextWithoutLabel, { ...props }));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return (_jsx(TextWithLabel, { ...props }));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export default Text;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextProps } from "@bbr/components/text";
|
|
3
|
+
/** Textual input with describing label */
|
|
4
|
+
declare const TextWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }: TextProps) => JSX.Element;
|
|
5
|
+
export default TextWithLabel;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,0CAA0C;AAC1C,QAAA,MAAM,aAAa,sJAMhB,SAAS,KAAG,WAwGd,CAAC;AAEF,eAAe,aAAa,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 { ElementSize } from "@bbr/components";
|
|
5
|
+
import { getValidationValues } from "@bbr/utils";
|
|
6
|
+
/** Textual input with describing label */
|
|
7
|
+
const TextWithLabel = ({ 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, ElementSize.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: "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: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", 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: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", 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 TextWithLabel;
|
package/{dist/components → components}/primitives/text/components/textWithoutLabel/index.d.ts
RENAMED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextProps } from "@bbr/components/text";
|
|
3
|
+
/** Textual input without describing label */
|
|
4
|
+
declare const TextWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }: TextProps) => JSX.Element;
|
|
5
|
+
export default TextWithoutLabel;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithoutLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,+IAMnB,SAAS,KAAG,WA6Cd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { ElementSize } from "@bbr/components";
|
|
5
|
+
import { getValidationValues } from "@bbr/utils";
|
|
6
|
+
/** Textual input without describing label */
|
|
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), [onValueChange]);
|
|
9
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
10
|
+
const elClassName = getClassName([
|
|
11
|
+
className,
|
|
12
|
+
"is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
|
|
13
|
+
rounded === true ? "is-rounded" : "",
|
|
14
|
+
styleClassName,
|
|
15
|
+
"input",
|
|
16
|
+
]);
|
|
17
|
+
const containerClassName = getClassName([
|
|
18
|
+
"control",
|
|
19
|
+
"bbr-input",
|
|
20
|
+
loading === true ? "is-loading" : "",
|
|
21
|
+
]);
|
|
22
|
+
const id = name || generateGuid();
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { className: elClassName, type: "text", placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
24
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
25
|
+
};
|
|
26
|
+
export default TextWithoutLabel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BaseInputElementProps } from
|
|
2
|
-
/** Text input component props type */
|
|
3
|
-
export interface TextProps extends BaseInputElementProps<string> {
|
|
4
|
-
/** Focus out event handler */
|
|
5
|
-
onBlur?: () => void;
|
|
6
|
-
}
|
|
1
|
+
import { BaseInputElementProps } from "@bbr/components";
|
|
2
|
+
/** Text input component props type */
|
|
3
|
+
export interface TextProps extends BaseInputElementProps<string> {
|
|
4
|
+
/** Focus out event handler */
|
|
5
|
+
onBlur?: () => void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,qBAAqB,CAAC,MAAM,CAAC;IAC5D,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { BaseElementProps, ElementColor, ElementSize } from
|
|
2
|
-
import { InputLabel, ValidationState } from ".";
|
|
3
|
-
/** Base properties for input components */
|
|
4
|
-
export interface BaseInputElementProps<TValue> extends BaseElementProps {
|
|
5
|
-
/** Value change handler. Changed value must be stored outside of component */
|
|
6
|
-
onValueChange: (value?: TValue) => void;
|
|
7
|
-
/** Default value of input component*/
|
|
8
|
-
defaultValue?: TValue;
|
|
9
|
-
/** Input element placeholder */
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
/** Is component borders are rounded */
|
|
12
|
-
rounded?: boolean;
|
|
13
|
-
/** Should be component disabled. Selecting is not allowed */
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
/** Should be component int read only mode. Selecting is allowed */
|
|
16
|
-
readonly?: boolean;
|
|
17
|
-
/** Component size */
|
|
18
|
-
size?: ElementSize;
|
|
19
|
-
/** Label configuration */
|
|
20
|
-
label?: InputLabel;
|
|
21
|
-
/** Displaying loading state of component as spinner in right end of component */
|
|
22
|
-
loading?: boolean;
|
|
23
|
-
/** Style. Colors the border */
|
|
24
|
-
style?: ElementColor;
|
|
25
|
-
/** Name of element. Required for form elements */
|
|
26
|
-
name?: string;
|
|
27
|
-
/** Current validation state */
|
|
28
|
-
validationState?: ValidationState;
|
|
29
|
-
}
|
|
1
|
+
import { BaseElementProps, ElementColor, ElementSize } from "@bbr/components";
|
|
2
|
+
import { InputLabel, ValidationState } from ".";
|
|
3
|
+
/** Base properties for input components */
|
|
4
|
+
export interface BaseInputElementProps<TValue> extends BaseElementProps {
|
|
5
|
+
/** Value change handler. Changed value must be stored outside of component */
|
|
6
|
+
onValueChange: (value?: TValue) => void;
|
|
7
|
+
/** Default value of input component*/
|
|
8
|
+
defaultValue?: TValue;
|
|
9
|
+
/** Input element placeholder */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** Is component borders are rounded */
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
/** Should be component disabled. Selecting is not allowed */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Should be component int read only mode. Selecting is allowed */
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
/** Component size */
|
|
18
|
+
size?: ElementSize;
|
|
19
|
+
/** Label configuration */
|
|
20
|
+
label?: InputLabel;
|
|
21
|
+
/** Displaying loading state of component as spinner in right end of component */
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
/** Style. Colors the border */
|
|
24
|
+
style?: ElementColor;
|
|
25
|
+
/** Name of element. Required for form elements */
|
|
26
|
+
name?: string;
|
|
27
|
+
/** Current validation state */
|
|
28
|
+
validationState?: ValidationState;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=baseProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseProps.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/types/baseProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,WAAW,qBAAqB,CAAC,MAAM,CAAE,SAAQ,gBAAgB;IACnE,8EAA8E;IAC9E,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+BAA+B;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
package/{dist/components/primitives/types/index.d.ts → components/primitives/types/index.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./baseProps";
|
|
2
|
-
export * from "./label";
|
|
3
|
-
export * from "./validation";
|
|
1
|
+
export * from "./baseProps";
|
|
2
|
+
export * from "./label";
|
|
3
|
+
export * from "./validation";
|