@bodynarf/react.components 1.8.22 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bodynarf-react.components-1.9.3.tgz +0 -0
- package/common.scss +3 -2
- package/components/accordion/component/index.d.ts +2 -3
- package/components/accordion/component/index.d.ts.map +1 -1
- package/components/accordion/component/index.js +4 -4
- package/components/accordion/types.d.ts +1 -1
- package/components/accordion/types.d.ts.map +1 -1
- package/components/anchor/component/index.d.ts +1 -1
- package/components/anchor/component/index.d.ts.map +1 -1
- package/components/anchor/component/index.js +6 -6
- package/components/anchor/components/anchorWithIcon/index.d.ts +3 -3
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
- package/components/anchor/components/anchorWithIcon/index.js +14 -9
- package/components/anchor/components/simpleAnchor/index.d.ts +3 -3
- package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
- package/components/anchor/components/simpleAnchor/index.js +8 -2
- package/components/anchor/types.d.ts +2 -6
- package/components/anchor/types.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.d.ts +34 -0
- package/components/breadcrumbs/component/index.d.ts.map +1 -0
- package/components/breadcrumbs/component/index.js +21 -0
- package/components/breadcrumbs/index.d.ts +3 -0
- package/components/breadcrumbs/index.d.ts.map +1 -0
- package/components/breadcrumbs/index.js +2 -0
- package/components/breadcrumbs/types.d.ts +13 -0
- package/components/breadcrumbs/types.d.ts.map +1 -0
- package/components/button/component/index.d.ts +1 -1
- package/components/button/component/index.d.ts.map +1 -1
- package/components/button/component/index.js +4 -8
- package/components/button/components/buttonWithIcon/index.d.ts +3 -2
- package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
- package/components/button/components/buttonWithIcon/index.js +14 -9
- package/components/button/components/simpleButton/index.d.ts +3 -2
- package/components/button/components/simpleButton/index.d.ts.map +1 -1
- package/components/button/components/simpleButton/index.js +8 -2
- package/components/button/types.d.ts +1 -1
- package/components/button/types.d.ts.map +1 -1
- package/components/button/types.js +0 -3
- package/components/dropdown/component/index.d.ts +1 -1
- package/components/dropdown/component/index.d.ts.map +1 -1
- package/components/dropdown/component/index.js +5 -8
- package/components/dropdown/component/style.scss +5 -1
- package/components/dropdown/components/compact/index.d.ts +2 -3
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +12 -9
- package/components/dropdown/components/item/index.d.ts +1 -1
- package/components/dropdown/components/item/index.d.ts.map +1 -1
- package/components/dropdown/components/item/index.js +34 -2
- package/components/dropdown/components/label/component/index.d.ts +27 -0
- package/components/dropdown/components/label/component/index.d.ts.map +1 -0
- package/components/dropdown/components/label/component/index.js +16 -0
- package/components/dropdown/components/label/components/empty/index.d.ts +8 -0
- package/components/dropdown/components/label/components/empty/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/empty/index.js +16 -0
- package/components/dropdown/components/label/components/selected/index.d.ts +8 -0
- package/components/dropdown/components/label/components/selected/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/selected/index.js +20 -0
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts +8 -0
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/selectedWithIcon/index.js +28 -0
- package/components/dropdown/components/label/components/withSearch/index.d.ts +16 -0
- package/components/dropdown/components/label/components/withSearch/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/withSearch/index.js +33 -0
- package/components/dropdown/components/label/components/withSearch/style.scss +29 -0
- package/components/dropdown/components/label/index.d.ts +1 -1
- package/components/dropdown/components/label/index.d.ts.map +1 -1
- package/components/dropdown/components/label/index.js +41 -9
- package/components/dropdown/components/withLabel/index.d.ts +2 -3
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +14 -12
- package/components/dropdown/types.d.ts +13 -2
- package/components/dropdown/types.d.ts.map +1 -1
- package/components/icon/component/index.d.ts +2 -2
- package/components/icon/component/index.d.ts.map +1 -1
- package/components/icon/component/index.js +9 -5
- package/components/icon/types.d.ts +2 -4
- package/components/icon/types.d.ts.map +1 -1
- package/components/index.d.ts +0 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +0 -1
- package/components/paginator/component/index.d.ts +2 -2
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +19 -14
- package/components/paginator/types.d.ts +3 -5
- package/components/paginator/types.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.d.ts +2 -3
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +15 -17
- package/components/primitives/checkbox/types.d.ts +2 -2
- package/components/primitives/checkbox/types.d.ts.map +1 -1
- package/components/primitives/color/component/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.d.ts +11 -29
- package/components/primitives/color/components/picker/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.js +15 -12
- package/components/primitives/color/components/withLabel/index.d.ts +1 -1
- package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withLabel/index.js +8 -30
- package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withoutLabel/index.js +3 -13
- package/components/primitives/color/types.d.ts +1 -1
- package/components/primitives/color/types.d.ts.map +1 -1
- package/components/primitives/date/component/index.d.ts +2 -3
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +12 -27
- package/components/primitives/date/types.d.ts +2 -2
- package/components/primitives/date/types.d.ts.map +1 -1
- package/components/primitives/index.d.ts +0 -1
- package/components/primitives/index.d.ts.map +1 -1
- package/components/primitives/index.js +0 -1
- package/components/primitives/internal/componentWithLabel/index.d.ts +17 -0
- package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -0
- package/components/primitives/internal/componentWithLabel/index.js +26 -0
- package/components/primitives/internal/hint/index.d.ts +12 -0
- package/components/primitives/internal/hint/index.d.ts.map +1 -0
- package/components/primitives/internal/hint/index.js +47 -0
- package/components/primitives/multiline/component/index.d.ts +1 -1
- package/components/primitives/multiline/component/index.d.ts.map +1 -1
- package/components/primitives/multiline/component/index.js +5 -8
- package/components/primitives/multiline/components/withLabel/index.d.ts +5 -0
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/withLabel/index.js +29 -0
- package/components/primitives/multiline/components/withoutLabel/index.d.ts +5 -0
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/withoutLabel/index.js +28 -0
- package/components/primitives/multiline/types.d.ts +1 -1
- package/components/primitives/multiline/types.d.ts.map +1 -1
- package/components/primitives/number/component/index.d.ts +1 -1
- package/components/primitives/number/component/index.d.ts.map +1 -1
- package/components/primitives/number/component/index.js +5 -8
- package/components/primitives/number/components/withLabel/index.d.ts +2 -3
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +12 -27
- package/components/primitives/number/components/withoutLabel/index.d.ts +2 -3
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +11 -9
- package/components/primitives/number/types.d.ts +1 -1
- package/components/primitives/number/types.d.ts.map +1 -1
- package/components/primitives/password/component/index.d.ts +1 -1
- package/components/primitives/password/component/index.d.ts.map +1 -1
- package/components/primitives/password/component/index.js +5 -6
- package/components/primitives/password/components/withLabel/index.d.ts +2 -3
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +14 -30
- package/components/primitives/password/components/withoutLabel/index.d.ts +2 -3
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +13 -11
- package/components/primitives/password/types.d.ts +1 -1
- package/components/primitives/password/types.d.ts.map +1 -1
- package/components/primitives/text/component/index.d.ts +1 -1
- package/components/primitives/text/component/index.d.ts.map +1 -1
- package/components/primitives/text/component/index.js +5 -8
- package/components/primitives/text/components/withLabel/index.d.ts +5 -0
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/withLabel/index.js +29 -0
- package/components/primitives/text/components/withoutLabel/index.d.ts +5 -0
- package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/withoutLabel/index.js +28 -0
- package/components/primitives/text/types.d.ts +1 -1
- package/components/primitives/text/types.d.ts.map +1 -1
- package/components/search/component/index.d.ts +2 -2
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +16 -10
- package/components/search/types.d.ts +2 -2
- package/components/search/types.d.ts.map +1 -1
- package/components/table/component/index.d.ts +44 -0
- package/components/table/component/index.d.ts.map +1 -0
- package/components/table/component/index.js +29 -0
- package/components/table/component/style.scss +21 -0
- package/components/table/components/heading/index.d.ts +13 -0
- package/components/table/components/heading/index.d.ts.map +1 -0
- package/components/table/components/heading/index.js +21 -0
- package/components/table/index.d.ts +3 -0
- package/components/table/index.d.ts.map +1 -0
- package/components/table/index.js +2 -0
- package/components/table/types.d.ts +18 -0
- package/components/table/types.d.ts.map +1 -0
- package/components/tabs/component/index.d.ts +3 -4
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +14 -8
- package/components/tabs/components/item/index.d.ts +1 -1
- package/components/tabs/components/item/index.d.ts.map +1 -1
- package/components/tabs/components/item/index.js +4 -3
- package/components/tabs/types.d.ts +1 -12
- package/components/tabs/types.d.ts.map +1 -1
- package/components/tabs/types.js +0 -12
- package/components/tag/component/index.d.ts +2 -3
- package/components/tag/component/index.d.ts.map +1 -1
- package/components/tag/component/index.js +13 -7
- package/components/tag/types.d.ts +1 -1
- package/components/tag/types.d.ts.map +1 -1
- package/hooks/usePagination.d.ts.map +1 -1
- package/hooks/usePagination.js +11 -2
- package/hooks/useUnmount.d.ts +8 -0
- package/hooks/useUnmount.d.ts.map +1 -0
- package/hooks/useUnmount.js +22 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/package.json +11 -4
- package/readme.md +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/baseElementProps.d.ts +11 -0
- package/types/baseElementProps.d.ts.map +1 -0
- package/types/baseElementProps.js +1 -0
- package/{components/primitives/types/baseProps.d.ts → types/baseInputElementProps.d.ts} +10 -4
- package/types/baseInputElementProps.d.ts.map +1 -0
- package/types/baseInputElementProps.js +1 -0
- package/types/dataAttributes.d.ts +9 -0
- package/types/dataAttributes.d.ts.map +1 -0
- package/types/dataAttributes.js +1 -0
- package/types/elementColor.d.ts +18 -0
- package/types/elementColor.d.ts.map +1 -0
- package/types/elementColor.js +18 -0
- package/types/elementIcon.d.ts +22 -0
- package/types/elementIcon.d.ts.map +1 -0
- package/types/elementIcon.js +1 -0
- package/types/elementPosition.d.ts +12 -0
- package/types/elementPosition.d.ts.map +1 -0
- package/types/elementPosition.js +10 -0
- package/types/elementSize.d.ts +12 -0
- package/types/elementSize.d.ts.map +1 -0
- package/types/elementSize.js +12 -0
- package/types/hintConfiguration.d.ts +13 -0
- package/types/hintConfiguration.d.ts.map +1 -0
- package/types/hintConfiguration.js +1 -0
- package/types/index.d.ts +11 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +10 -0
- package/{components/primitives/types/label.d.ts → types/labelConfiguration.d.ts} +3 -3
- package/types/labelConfiguration.d.ts.map +1 -0
- package/types/labelConfiguration.js +1 -0
- package/{components/primitives/types → types}/validation/index.d.ts +1 -1
- package/types/validation/index.d.ts.map +1 -0
- package/{components/primitives/types → types}/validation/index.js +1 -1
- package/{components/primitives/types → types}/validation/state.d.ts +2 -2
- package/types/validation/state.d.ts.map +1 -0
- package/{components/primitives/types → types}/validation/state.js +0 -1
- package/{components/primitives/types → types}/validation/status.d.ts +1 -1
- package/types/validation/status.d.ts.map +1 -0
- package/{components/primitives/types → types}/validation/status.js +1 -2
- package/utils/dataAttributes.d.ts +1 -1
- package/utils/dataAttributes.d.ts.map +1 -1
- package/utils/index.d.ts +1 -1
- package/utils/index.d.ts.map +1 -1
- package/utils/index.js +1 -1
- package/utils/validation.d.ts +11 -0
- package/utils/validation.d.ts.map +1 -0
- package/utils/validation.js +20 -0
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -6
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.js +0 -44
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +0 -6
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +0 -26
- package/components/primitives/text/components/textWithLabel/index.d.ts +0 -6
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +0 -1
- package/components/primitives/text/components/textWithLabel/index.js +0 -44
- package/components/primitives/text/components/textWithoutLabel/index.d.ts +0 -6
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/text/components/textWithoutLabel/index.js +0 -26
- package/components/primitives/types/baseProps.d.ts.map +0 -1
- package/components/primitives/types/index.d.ts +0 -4
- package/components/primitives/types/index.d.ts.map +0 -1
- package/components/primitives/types/index.js +0 -3
- package/components/primitives/types/label.d.ts.map +0 -1
- package/components/primitives/types/validation/index.d.ts.map +0 -1
- package/components/primitives/types/validation/state.d.ts.map +0 -1
- package/components/primitives/types/validation/status.d.ts.map +0 -1
- package/components/types.d.ts +0 -78
- package/components/types.d.ts.map +0 -1
- package/components/types.js +0 -41
- package/utils/formValidation.d.ts +0 -16
- package/utils/formValidation.d.ts.map +0 -1
- package/utils/formValidation.js +0 -35
- /package/components/{primitives/types/baseProps.js → breadcrumbs/types.js} +0 -0
- /package/components/{primitives/types/label.js → table/types.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
3
|
+
import { ElementSize } from "../../../../types";
|
|
4
|
+
/** Form input component with describing label */
|
|
5
|
+
const ComponentWithLabel = ({ label, id, size, children, }) => {
|
|
6
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
7
|
+
const labelClassName = getClassName([
|
|
8
|
+
"label",
|
|
9
|
+
!label.horizontal ? elSizeClassName : "",
|
|
10
|
+
label.className
|
|
11
|
+
]);
|
|
12
|
+
if (label.horizontal) {
|
|
13
|
+
const labelContainerClassName = getClassName([
|
|
14
|
+
"field-label",
|
|
15
|
+
elSizeClassName,
|
|
16
|
+
label.horizontalContainerClassName
|
|
17
|
+
]);
|
|
18
|
+
const fieldContainerClassName = getClassName([
|
|
19
|
+
"field-body",
|
|
20
|
+
label.horizontalFieldContainerClassName
|
|
21
|
+
]);
|
|
22
|
+
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: _jsx("div", { className: "field", children: children }) })] }));
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), children] }));
|
|
25
|
+
};
|
|
26
|
+
export default ComponentWithLabel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HintConfiguration, ValidationState } from "../../../../types";
|
|
2
|
+
/** Props of `InternalHint` */
|
|
3
|
+
interface HintProps {
|
|
4
|
+
/** @inheritdoc BaseInputElementProps.validationState */
|
|
5
|
+
validationState?: ValidationState;
|
|
6
|
+
/** @inheritdoc BaseInputElementProps.hint */
|
|
7
|
+
hint?: HintConfiguration;
|
|
8
|
+
}
|
|
9
|
+
/** Hint component for internal use (as form input elements hints) */
|
|
10
|
+
declare const InternalHint: ({ validationState, hint, }: HintProps) => JSX.Element;
|
|
11
|
+
export default InternalHint;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgC,iBAAiB,EAAE,eAAe,EAAoB,MAAM,YAAY,CAAC;AAGhH,8BAA8B;AAC9B,UAAU,SAAS;IACf,wDAAwD;IACxD,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,qEAAqE;AACrE,QAAA,MAAM,YAAY,+BAEf,SAAS,KAAG,WAgDd,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { ElementPosition, ElementSize, ValidationStatus } from "../../../../types";
|
|
4
|
+
import Icon from "../../../icon";
|
|
5
|
+
/** Hint component for internal use (as form input elements hints) */
|
|
6
|
+
const InternalHint = ({ validationState, hint, }) => {
|
|
7
|
+
if (isNullOrUndefined(validationState) && isNullOrUndefined(hint)) {
|
|
8
|
+
return _jsx(_Fragment, {});
|
|
9
|
+
}
|
|
10
|
+
const validationStateDefined = !isNullOrUndefined(validationState)
|
|
11
|
+
&& validationState.status !== ValidationStatus.None
|
|
12
|
+
&& validationState.messages.length > 0;
|
|
13
|
+
if (validationStateDefined) {
|
|
14
|
+
const validationClassName = validationState.status === ValidationStatus.Valid
|
|
15
|
+
? "is-success"
|
|
16
|
+
: "is-danger";
|
|
17
|
+
return (_jsx("p", { className: `help m-help ${validationClassName}`, children: validationState.messages.join("\n") }));
|
|
18
|
+
}
|
|
19
|
+
if (isNullOrUndefined(hint)) {
|
|
20
|
+
return (_jsx(_Fragment, {}));
|
|
21
|
+
}
|
|
22
|
+
const className = getClassName([
|
|
23
|
+
"bbr-hint",
|
|
24
|
+
"help",
|
|
25
|
+
"m-help",
|
|
26
|
+
(hint.grey ?? false) ? "has-text-grey" : undefined,
|
|
27
|
+
(hint.italic ?? false) ? "is-italic" : undefined,
|
|
28
|
+
]);
|
|
29
|
+
if (!isNullOrUndefined(hint.icon)) {
|
|
30
|
+
return (_jsx(HintWithIcon, { ...hint, className: className }));
|
|
31
|
+
}
|
|
32
|
+
return (_jsx("p", { className: className, children: hint.content }));
|
|
33
|
+
};
|
|
34
|
+
export default InternalHint;
|
|
35
|
+
/** Hint element with icon */
|
|
36
|
+
const HintWithIcon = ({ className, content, icon, }) => {
|
|
37
|
+
const iconClassName = getClassName([
|
|
38
|
+
icon.className,
|
|
39
|
+
icon.position === ElementPosition.Right
|
|
40
|
+
? "bbr-icon--right"
|
|
41
|
+
: "bbr-icon--left"
|
|
42
|
+
]);
|
|
43
|
+
if (icon.position === ElementPosition.Right) {
|
|
44
|
+
return (_jsxs("p", { className: className, children: [content, _jsx(Icon, { name: icon.name, className: iconClassName, size: icon.size ?? ElementSize.Small })] }));
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs("p", { className: className, children: [_jsx(Icon, { name: icon.name, className: iconClassName, size: icon.size ?? ElementSize.Small }), content] }));
|
|
47
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "../../../../common.scss";
|
|
3
|
-
import { MultilineProps } from "
|
|
3
|
+
import { MultilineProps } from "..";
|
|
4
4
|
/** Multiline textual input component */
|
|
5
5
|
declare const Multiline: (props: MultilineProps) => JSX.Element;
|
|
6
6
|
export default Multiline;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAK1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import "../../../../common.scss";
|
|
4
|
-
import MultilineWithoutLabel from "
|
|
5
|
-
import MultilineWithLabel from "
|
|
4
|
+
import MultilineWithoutLabel from "../components/withoutLabel";
|
|
5
|
+
import MultilineWithLabel from "../components/withLabel";
|
|
6
6
|
/** Multiline textual input component */
|
|
7
7
|
const Multiline = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
else {
|
|
12
|
-
return (_jsx(MultilineWithLabel, { ...props }));
|
|
13
|
-
}
|
|
8
|
+
return isNullOrUndefined(props.label)
|
|
9
|
+
? _jsx(MultilineWithoutLabel, { ...props })
|
|
10
|
+
: _jsx(MultilineWithLabel, { ...props });
|
|
14
11
|
};
|
|
15
12
|
export default Multiline;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MultilineProps } from "../..";
|
|
2
|
+
/** Multiline textual input component with describing label */
|
|
3
|
+
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, readonly, disabled, name, size, style, loading, label, placeholder, fixed, rows, onBlur, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
4
|
+
export default MultilineWithLabel;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withLabel/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,6KAUrB,cAAc,KAAG,WAuDnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../../types";
|
|
5
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
|
+
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
|
+
import InternalHint from "../../../internal/hint";
|
|
8
|
+
/** Multiline textual input component with describing label */
|
|
9
|
+
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, readonly, disabled, name, size, style, loading = false, label, placeholder, fixed = false, rows, onBlur, className, title, data, hint, }) => {
|
|
10
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
|
+
const id = name ?? generateGuid();
|
|
12
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
13
|
+
const elClassName = getClassName([
|
|
14
|
+
className,
|
|
15
|
+
elSizeClassName,
|
|
16
|
+
getStyleClassName(style, validationState),
|
|
17
|
+
"textarea",
|
|
18
|
+
fixed ? "has-fixed-size" : "",
|
|
19
|
+
]);
|
|
20
|
+
const inputContainerClassName = getClassName([
|
|
21
|
+
"control",
|
|
22
|
+
loading ? "is-loading" : "",
|
|
23
|
+
]);
|
|
24
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
25
|
+
? undefined
|
|
26
|
+
: mapDataAttributes(data);
|
|
27
|
+
return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: id, name: id, rows: rows, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
28
|
+
};
|
|
29
|
+
export default MultilineWithLabel;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MultilineProps } from "../..";
|
|
2
|
+
/** Multiline textual input component without describing label*/
|
|
3
|
+
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading, fixed, rows, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
4
|
+
export default MultilineWithoutLabel;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,kJASxB,cAAc,KAAG,WAiDnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../../types";
|
|
5
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
|
+
import InternalHint from "../../../internal/hint";
|
|
7
|
+
/** Multiline textual input component without describing label*/
|
|
8
|
+
const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading = false, fixed = false, rows, className, title, data, hint, }) => {
|
|
9
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
10
|
+
const id = name ?? generateGuid();
|
|
11
|
+
const elClassName = getClassName([
|
|
12
|
+
className,
|
|
13
|
+
"is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
|
|
14
|
+
getStyleClassName(style, validationState),
|
|
15
|
+
"textarea",
|
|
16
|
+
fixed ? "has-fixed-size" : "",
|
|
17
|
+
]);
|
|
18
|
+
const inputContainerClassName = getClassName([
|
|
19
|
+
"control",
|
|
20
|
+
"bbr-input",
|
|
21
|
+
loading ? "is-loading" : "",
|
|
22
|
+
]);
|
|
23
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
24
|
+
? undefined
|
|
25
|
+
: mapDataAttributes(data);
|
|
26
|
+
return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: id, name: id, rows: rows, onBlur: onBlur, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
27
|
+
};
|
|
28
|
+
export default MultilineWithoutLabel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseInputElementProps } from "
|
|
1
|
+
import { BaseInputElementProps } from "../../../types";
|
|
2
2
|
/** Multiline textual input component props type */
|
|
3
3
|
export interface MultilineProps extends Omit<BaseInputElementProps<string>, "rounded"> {
|
|
4
4
|
/** Is input should be resizable */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,mDAAmD;AACnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAClF,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAIjC,6BAA6B;AAC7B,QAAA,MAAM,MAAM,UAAW,WAAW,KAAG,WAIpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import NumberWithLabel from "
|
|
4
|
-
import NumberWithoutLabel from "
|
|
3
|
+
import NumberWithLabel from "../components/withLabel";
|
|
4
|
+
import NumberWithoutLabel from "../components/withoutLabel";
|
|
5
5
|
/** Number input component */
|
|
6
6
|
const Number = (props) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
else {
|
|
11
|
-
return (_jsx(NumberWithLabel, { ...props }));
|
|
12
|
-
}
|
|
7
|
+
return isNullOrUndefined(props.label)
|
|
8
|
+
? _jsx(NumberWithoutLabel, { ...props })
|
|
9
|
+
: _jsx(NumberWithLabel, { ...props });
|
|
13
10
|
};
|
|
14
11
|
export default Number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { NumberProps } from "../../../number";
|
|
1
|
+
import { NumberProps } from "../..";
|
|
3
2
|
/** Number component with label */
|
|
4
|
-
declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name,
|
|
3
|
+
declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded, loading, label, placeholder, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
|
|
5
4
|
export default NumberWithLabel;
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,+KAUlB,WAAW,KAAG,WA0DhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName, getValueOrDefault, isStringEmpty } from "@bodynarf/utils";
|
|
4
|
-
import { ElementSize } from "
|
|
5
|
-
import {
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../../types";
|
|
5
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
|
+
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
|
+
import InternalHint from "../../../internal/hint";
|
|
6
8
|
/** Number component with label */
|
|
7
|
-
const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name,
|
|
9
|
+
const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, label, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
|
|
8
10
|
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value) ? undefined : +event.target.value), [onValueChange]);
|
|
9
|
-
const id = name
|
|
11
|
+
const id = name ?? generateGuid();
|
|
10
12
|
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
11
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
13
|
const elClassName = getClassName([
|
|
13
14
|
className,
|
|
14
15
|
elSizeClassName,
|
|
15
16
|
rounded ? "is-rounded" : "",
|
|
16
|
-
|
|
17
|
+
getStyleClassName(style, validationState),
|
|
17
18
|
"input",
|
|
18
19
|
]);
|
|
19
20
|
const inputContainerClassName = getClassName([
|
|
20
21
|
"control",
|
|
21
22
|
loading ? "is-loading" : "",
|
|
22
23
|
]);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 }) }), 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 }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
42
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
24
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
25
|
+
? undefined
|
|
26
|
+
: mapDataAttributes(data);
|
|
27
|
+
return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", id: id, name: id, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
43
28
|
};
|
|
44
29
|
export default NumberWithLabel;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { NumberProps } from "../../../number";
|
|
1
|
+
import { NumberProps } from "../..";
|
|
3
2
|
/** Number component without label */
|
|
4
|
-
declare const NumberWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name,
|
|
3
|
+
declare const NumberWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded, loading, placeholder, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
|
|
5
4
|
export default NumberWithoutLabel;
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,wKAUrB,WAAW,KAAG,WAqDhB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
-
import { ElementSize } from "
|
|
5
|
-
import {
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../../types";
|
|
5
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
|
+
import InternalHint from "../../../internal/hint";
|
|
6
7
|
/** Number component without label */
|
|
7
|
-
const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name,
|
|
8
|
+
const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
|
|
8
9
|
const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
|
|
9
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
10
10
|
const elClassName = getClassName([
|
|
11
11
|
className,
|
|
12
12
|
"is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
|
|
13
13
|
rounded ? "is-rounded" : "",
|
|
14
|
-
|
|
14
|
+
getStyleClassName(style, validationState),
|
|
15
15
|
"input",
|
|
16
16
|
]);
|
|
17
17
|
const containerClassName = getClassName([
|
|
@@ -19,8 +19,10 @@ const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, v
|
|
|
19
19
|
"bbr-input",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const id = name
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const id = name ?? generateGuid();
|
|
23
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
24
|
+
? undefined
|
|
25
|
+
: mapDataAttributes(data);
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", id: id, name: id, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
25
27
|
};
|
|
26
28
|
export default NumberWithoutLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./style.scss";
|
|
3
|
-
import { PasswordProps } from "
|
|
3
|
+
import { PasswordProps } from "../..";
|
|
4
4
|
/** Password input component */
|
|
5
5
|
declare const Password: (props: PasswordProps) => JSX.Element;
|
|
6
6
|
export default Password;
|
|
@@ -1 +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,
|
|
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,OAAO,CAAC;AAItC,+BAA+B;AAC/B,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAIxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import "./style.scss";
|
|
4
|
-
import PasswordWithLabel from "
|
|
5
|
-
import PasswordWithoutLabel from "
|
|
4
|
+
import PasswordWithLabel from "../components/withLabel";
|
|
5
|
+
import PasswordWithoutLabel from "../components/withoutLabel";
|
|
6
6
|
/** Password input component */
|
|
7
7
|
const Password = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return _jsx(PasswordWithLabel, { ...props });
|
|
8
|
+
return isNullOrUndefined(props.label)
|
|
9
|
+
? _jsx(PasswordWithoutLabel, { ...props })
|
|
10
|
+
: _jsx(PasswordWithLabel, { ...props });
|
|
12
11
|
};
|
|
13
12
|
export default Password;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const PasswordWithLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
1
|
+
import { PasswordProps } from "../..";
|
|
2
|
+
declare const PasswordWithLabel: ({ onValueChange, disabled, validationState, name, size, style, rounded, loading, label, placeholder, canShowPassword, className, title, data, hint, }: PasswordProps) => JSX.Element;
|
|
4
3
|
export default PasswordWithLabel;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,0JAUpB,aAAa,KAAG,WAwElB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../../types";
|
|
5
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import Icon from "../../../../icon";
|
|
7
|
-
|
|
7
|
+
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
8
|
+
import InternalHint from "../../../internal/hint";
|
|
9
|
+
const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, size, style, rounded = false, loading = false, label, placeholder, canShowPassword = false, className, title, data, hint, }) => {
|
|
8
10
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
11
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
10
12
|
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
11
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
13
|
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
13
|
-
const id = name
|
|
14
|
+
const id = name ?? generateGuid();
|
|
14
15
|
const elClassName = getClassName([
|
|
16
|
+
"bbr-password",
|
|
15
17
|
className,
|
|
16
18
|
elSizeClassName,
|
|
17
19
|
rounded ? "is-rounded" : "",
|
|
18
|
-
|
|
19
|
-
"bbr-password",
|
|
20
|
+
getStyleClassName(style, validationState),
|
|
20
21
|
"input",
|
|
21
22
|
]);
|
|
22
23
|
const inputContainerClassName = getClassName([
|
|
@@ -25,27 +26,10 @@ const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, cla
|
|
|
25
26
|
canShowPassword ? "has-icons-right" : "",
|
|
26
27
|
"bbr-password__wrapper",
|
|
27
28
|
]);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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") })] }));
|
|
29
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
30
|
+
? undefined
|
|
31
|
+
: mapDataAttributes(data);
|
|
32
|
+
return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: id, name: id, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
|
|
33
|
+
_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 }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
50
34
|
};
|
|
51
35
|
export default PasswordWithLabel;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const PasswordWithoutLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
1
|
+
import { PasswordProps } from "../..";
|
|
2
|
+
declare const PasswordWithoutLabel: ({ onValueChange, disabled, validationState, name, size, style, rounded, loading, placeholder, canShowPassword, className, title, data, hint, }: PasswordProps) => JSX.Element;
|
|
4
3
|
export default PasswordWithoutLabel;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withoutLabel/index.tsx"],"names":[],"mappings":"
|
|
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,mJAUvB,aAAa,KAAG,WAoElB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
-
import { ElementSize } from "
|
|
5
|
-
import {
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../../types";
|
|
5
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import Icon from "../../../../icon";
|
|
7
|
-
|
|
7
|
+
import InternalHint from "../../../internal/hint";
|
|
8
|
+
const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, size, style, rounded = false, loading = false, placeholder, canShowPassword = false, className, title, data, hint, }) => {
|
|
8
9
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
10
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
10
11
|
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
11
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
12
|
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
13
|
-
const id = name
|
|
13
|
+
const id = name ?? generateGuid();
|
|
14
14
|
const elClassName = getClassName([
|
|
15
|
+
"bbr-password",
|
|
15
16
|
className,
|
|
16
17
|
elSizeClassName,
|
|
17
18
|
rounded ? "is-rounded" : "",
|
|
18
|
-
|
|
19
|
-
"bbr-password",
|
|
19
|
+
getStyleClassName(style, validationState),
|
|
20
20
|
"input",
|
|
21
21
|
]);
|
|
22
22
|
const containerClassName = getClassName([
|
|
@@ -26,8 +26,10 @@ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name,
|
|
|
26
26
|
canShowPassword ? "has-icons-right" : "",
|
|
27
27
|
"bbr-password__wrapper",
|
|
28
28
|
]);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
30
|
+
? undefined
|
|
31
|
+
: mapDataAttributes(data);
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: id, name: id, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
|
|
33
|
+
_jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
32
34
|
};
|
|
33
35
|
export default PasswordWithoutLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACnG;;;MAGE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|