@bodynarf/react.components 1.6.4 → 1.7.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/dist/bbr-components.js +1040 -0
- package/dist/bbr-components.umd.cjs +27 -0
- package/{components → dist/components}/accordion/component/index.d.ts +4 -6
- package/{components/button/index.js → dist/components/accordion/index.d.ts} +2 -2
- package/{components → dist/components}/accordion/types.d.ts +16 -18
- package/dist/components/anchor/component/index.d.ts +3 -0
- package/{components → dist/components}/anchor/components/anchorWithIcon/index.d.ts +3 -5
- package/{components → dist/components}/anchor/components/simpleAnchor/index.d.ts +3 -5
- package/{components/dropdown/index.js → dist/components/anchor/index.d.ts} +2 -2
- package/{components → dist/components}/anchor/types.d.ts +38 -39
- package/{components → dist/components}/button/component/index.d.ts +6 -9
- package/{components → dist/components}/button/components/buttonWithIcon/index.d.ts +3 -5
- package/{components → dist/components}/button/components/simpleButton/index.d.ts +3 -5
- package/{components/accordion/index.js → dist/components/button/index.d.ts} +2 -2
- package/{components → dist/components}/button/types.d.ts +36 -37
- package/dist/components/dropdown/component/index.d.ts +4 -0
- package/{components → dist/components}/dropdown/components/compact/index.d.ts +3 -5
- package/{components → dist/components}/dropdown/components/item/index.d.ts +13 -15
- package/{components → dist/components}/dropdown/components/label/index.d.ts +17 -18
- package/{components → dist/components}/dropdown/components/withLabel/index.d.ts +3 -5
- package/{components/anchor/index.js → dist/components/dropdown/index.d.ts} +2 -2
- package/{components → dist/components}/dropdown/types.d.ts +45 -46
- package/{components → dist/components}/icon/component/index.d.ts +5 -8
- package/dist/components/icon/index.d.ts +2 -0
- package/{components → dist/components}/icon/types.d.ts +15 -16
- package/{components/index.js → dist/components/index.d.ts} +11 -11
- package/{components → dist/components}/paginator/component/index.d.ts +6 -8
- package/{components/paginator/index.js → dist/components/paginator/index.d.ts} +3 -3
- package/{components → dist/components}/paginator/types.d.ts +27 -28
- package/{components → dist/components}/paginator/utils.d.ts +9 -10
- package/{components → dist/components}/primitives/checkbox/component/index.d.ts +4 -7
- package/dist/components/primitives/checkbox/index.d.ts +2 -0
- package/{components → dist/components}/primitives/checkbox/types.d.ts +24 -25
- package/{components → dist/components}/primitives/date/component/index.d.ts +4 -6
- package/dist/components/primitives/date/index.d.ts +2 -0
- package/{components → dist/components}/primitives/date/types.d.ts +8 -9
- package/{components/primitives/index.js → dist/components/primitives/index.d.ts} +7 -7
- package/dist/components/primitives/multiline/component/index.d.ts +4 -0
- package/{components → dist/components}/primitives/multiline/components/multilineWithLabel/index.d.ts +4 -5
- package/{components → dist/components}/primitives/multiline/components/multilineWithoutLabel/index.d.ts +4 -5
- package/dist/components/primitives/multiline/index.d.ts +2 -0
- package/{components → dist/components}/primitives/multiline/types.d.ts +10 -11
- package/{components → dist/components}/primitives/number/component/index.d.ts +4 -6
- package/{components → dist/components}/primitives/number/components/withLabel/index.d.ts +4 -5
- package/{components → dist/components}/primitives/number/components/withoutLabel/index.d.ts +4 -5
- package/dist/components/primitives/number/index.d.ts +2 -0
- package/{components → dist/components}/primitives/number/types.d.ts +12 -13
- package/dist/components/primitives/password/component/index.d.ts +4 -0
- package/{components → dist/components}/primitives/password/components/withLabel/index.d.ts +3 -4
- package/{components → dist/components}/primitives/password/components/withoutLabel/index.d.ts +3 -4
- package/dist/components/primitives/password/index.d.ts +2 -0
- package/{components → dist/components}/primitives/password/types.d.ts +9 -10
- package/dist/components/primitives/text/component/index.d.ts +4 -0
- package/{components → dist/components}/primitives/text/components/textWithLabel/index.d.ts +4 -5
- package/{components → dist/components}/primitives/text/components/textWithoutLabel/index.d.ts +4 -5
- package/dist/components/primitives/text/index.d.ts +2 -0
- package/{components → dist/components}/primitives/text/types.d.ts +6 -7
- package/{components → dist/components}/primitives/types/baseProps.d.ts +29 -30
- package/{components/primitives/types/index.js → dist/components/primitives/types/index.d.ts} +3 -3
- package/{components → dist/components}/primitives/types/label.d.ts +13 -14
- package/{components/primitives/types/validation/index.js → dist/components/primitives/types/validation/index.d.ts} +2 -2
- package/{components → dist/components}/primitives/types/validation/state.d.ts +8 -9
- package/{components → dist/components}/primitives/types/validation/status.d.ts +9 -10
- package/{components → dist/components}/search/component/index.d.ts +3 -6
- package/dist/components/search/index.d.ts +2 -0
- package/{components → dist/components}/search/types.d.ts +26 -27
- package/{components → dist/components}/tabs/component/index.d.ts +31 -33
- package/{components → dist/components}/tabs/components/item/index.d.ts +11 -13
- package/dist/components/tabs/index.d.ts +2 -0
- package/{components → dist/components}/tabs/types.d.ts +42 -43
- package/{components → dist/components}/tag/component/index.d.ts +4 -6
- package/dist/components/tag/index.d.ts +2 -0
- package/{components → dist/components}/tag/types.d.ts +26 -27
- package/{components → dist/components}/types.d.ts +66 -67
- package/{hooks/index.js → dist/hooks/index.d.ts} +2 -2
- package/{hooks → dist/hooks}/useComponentOutsideClick.d.ts +10 -11
- package/{hooks → dist/hooks}/usePagination.d.ts +19 -20
- package/{index.js → dist/index.d.ts} +3 -3
- package/dist/style.css +1 -0
- package/{utils → dist/utils}/dataAttributes.d.ts +7 -8
- package/{utils → dist/utils}/formValidation.d.ts +15 -16
- package/{utils/index.js → dist/utils/index.d.ts} +2 -2
- package/package.json +45 -38
- package/common.scss +0 -3
- package/components/accordion/component/index.d.ts.map +0 -1
- package/components/accordion/component/index.js +0 -35
- package/components/accordion/component/style.scss +0 -31
- package/components/accordion/index.d.ts +0 -3
- package/components/accordion/index.d.ts.map +0 -1
- package/components/accordion/types.d.ts.map +0 -1
- package/components/accordion/types.js +0 -1
- package/components/anchor/component/index.d.ts +0 -6
- package/components/anchor/component/index.d.ts.map +0 -1
- package/components/anchor/component/index.js +0 -20
- package/components/anchor/component/style.scss +0 -15
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +0 -1
- package/components/anchor/components/anchorWithIcon/index.js +0 -16
- package/components/anchor/components/simpleAnchor/index.d.ts.map +0 -1
- package/components/anchor/components/simpleAnchor/index.js +0 -5
- package/components/anchor/index.d.ts +0 -3
- package/components/anchor/index.d.ts.map +0 -1
- package/components/anchor/types.d.ts.map +0 -1
- package/components/anchor/types.js +0 -1
- package/components/button/component/index.d.ts.map +0 -1
- package/components/button/component/index.js +0 -36
- package/components/button/component/style.scss +0 -12
- package/components/button/components/buttonWithIcon/index.d.ts.map +0 -1
- package/components/button/components/buttonWithIcon/index.js +0 -19
- package/components/button/components/simpleButton/index.d.ts.map +0 -1
- package/components/button/components/simpleButton/index.js +0 -5
- package/components/button/index.d.ts +0 -3
- package/components/button/index.d.ts.map +0 -1
- package/components/button/types.d.ts.map +0 -1
- package/components/button/types.js +0 -4
- package/components/dropdown/component/index.d.ts +0 -7
- package/components/dropdown/component/index.d.ts.map +0 -1
- package/components/dropdown/component/index.js +0 -15
- package/components/dropdown/component/style.scss +0 -120
- package/components/dropdown/components/compact/index.d.ts.map +0 -1
- package/components/dropdown/components/compact/index.js +0 -62
- package/components/dropdown/components/item/index.d.ts.map +0 -1
- package/components/dropdown/components/item/index.js +0 -6
- package/components/dropdown/components/label/index.d.ts.map +0 -1
- package/components/dropdown/components/label/index.js +0 -22
- package/components/dropdown/components/withLabel/index.d.ts.map +0 -1
- package/components/dropdown/components/withLabel/index.js +0 -83
- package/components/dropdown/index.d.ts +0 -3
- package/components/dropdown/index.d.ts.map +0 -1
- package/components/dropdown/types.d.ts.map +0 -1
- package/components/dropdown/types.js +0 -1
- package/components/icon/component/index.d.ts.map +0 -1
- package/components/icon/component/index.js +0 -23
- package/components/icon/component/style.scss +0 -21
- package/components/icon/index.d.ts +0 -3
- package/components/icon/index.d.ts.map +0 -1
- package/components/icon/index.js +0 -2
- package/components/icon/types.d.ts.map +0 -1
- package/components/icon/types.js +0 -1
- package/components/index.d.ts +0 -12
- package/components/index.d.ts.map +0 -1
- package/components/paginator/component/index.d.ts.map +0 -1
- package/components/paginator/component/index.js +0 -47
- package/components/paginator/index.d.ts +0 -4
- package/components/paginator/index.d.ts.map +0 -1
- package/components/paginator/types.d.ts.map +0 -1
- package/components/paginator/types.js +0 -1
- package/components/paginator/utils.d.ts.map +0 -1
- package/components/paginator/utils.js +0 -18
- package/components/primitives/checkbox/component/index.d.ts.map +0 -1
- package/components/primitives/checkbox/component/index.js +0 -37
- package/components/primitives/checkbox/component/style.scss +0 -10
- package/components/primitives/checkbox/index.d.ts +0 -3
- package/components/primitives/checkbox/index.d.ts.map +0 -1
- package/components/primitives/checkbox/index.js +0 -2
- package/components/primitives/checkbox/types.d.ts.map +0 -1
- package/components/primitives/checkbox/types.js +0 -1
- package/components/primitives/date/component/index.d.ts.map +0 -1
- package/components/primitives/date/component/index.js +0 -48
- package/components/primitives/date/index.d.ts +0 -3
- package/components/primitives/date/index.d.ts.map +0 -1
- package/components/primitives/date/index.js +0 -2
- package/components/primitives/date/types.d.ts.map +0 -1
- package/components/primitives/date/types.js +0 -1
- package/components/primitives/index.d.ts +0 -8
- package/components/primitives/index.d.ts.map +0 -1
- package/components/primitives/multiline/component/index.d.ts +0 -7
- package/components/primitives/multiline/component/index.d.ts.map +0 -1
- package/components/primitives/multiline/component/index.js +0 -15
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.js +0 -45
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +0 -27
- package/components/primitives/multiline/index.d.ts +0 -3
- package/components/primitives/multiline/index.d.ts.map +0 -1
- package/components/primitives/multiline/index.js +0 -2
- package/components/primitives/multiline/types.d.ts.map +0 -1
- package/components/primitives/multiline/types.js +0 -1
- package/components/primitives/number/component/index.d.ts.map +0 -1
- package/components/primitives/number/component/index.js +0 -14
- package/components/primitives/number/components/withLabel/index.d.ts.map +0 -1
- package/components/primitives/number/components/withLabel/index.js +0 -44
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +0 -1
- package/components/primitives/number/components/withoutLabel/index.js +0 -26
- package/components/primitives/number/index.d.ts +0 -3
- package/components/primitives/number/index.d.ts.map +0 -1
- package/components/primitives/number/index.js +0 -2
- package/components/primitives/number/types.d.ts.map +0 -1
- package/components/primitives/number/types.js +0 -1
- package/components/primitives/password/component/index.d.ts +0 -7
- package/components/primitives/password/component/index.d.ts.map +0 -1
- package/components/primitives/password/component/index.js +0 -13
- package/components/primitives/password/component/style.scss +0 -16
- package/components/primitives/password/components/withLabel/index.d.ts.map +0 -1
- package/components/primitives/password/components/withLabel/index.js +0 -51
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +0 -1
- package/components/primitives/password/components/withoutLabel/index.js +0 -33
- package/components/primitives/password/index.d.ts +0 -3
- package/components/primitives/password/index.d.ts.map +0 -1
- package/components/primitives/password/index.js +0 -2
- package/components/primitives/password/types.d.ts.map +0 -1
- package/components/primitives/password/types.js +0 -1
- package/components/primitives/text/component/index.d.ts +0 -7
- package/components/primitives/text/component/index.d.ts.map +0 -1
- package/components/primitives/text/component/index.js +0 -15
- 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.map +0 -1
- package/components/primitives/text/components/textWithoutLabel/index.js +0 -26
- package/components/primitives/text/index.d.ts +0 -3
- package/components/primitives/text/index.d.ts.map +0 -1
- package/components/primitives/text/index.js +0 -2
- package/components/primitives/text/types.d.ts.map +0 -1
- package/components/primitives/text/types.js +0 -1
- package/components/primitives/types/baseProps.d.ts.map +0 -1
- package/components/primitives/types/baseProps.js +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/label.d.ts.map +0 -1
- package/components/primitives/types/label.js +0 -1
- package/components/primitives/types/validation/index.d.ts +0 -3
- 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/state.js +0 -2
- package/components/primitives/types/validation/status.d.ts.map +0 -1
- package/components/primitives/types/validation/status.js +0 -11
- package/components/search/component/index.d.ts.map +0 -1
- package/components/search/component/index.js +0 -37
- package/components/search/component/style.scss +0 -24
- package/components/search/index.d.ts +0 -3
- package/components/search/index.d.ts.map +0 -1
- package/components/search/index.js +0 -2
- package/components/search/types.d.ts.map +0 -1
- package/components/search/types.js +0 -1
- package/components/tabs/component/index.d.ts.map +0 -1
- package/components/tabs/component/index.js +0 -68
- package/components/tabs/component/style.scss +0 -12
- package/components/tabs/components/item/index.d.ts.map +0 -1
- package/components/tabs/components/item/index.js +0 -27
- package/components/tabs/index.d.ts +0 -3
- package/components/tabs/index.d.ts.map +0 -1
- package/components/tabs/index.js +0 -2
- package/components/tabs/types.d.ts.map +0 -1
- package/components/tabs/types.js +0 -34
- package/components/tag/component/index.d.ts.map +0 -1
- package/components/tag/component/index.js +0 -28
- package/components/tag/component/style.scss +0 -27
- package/components/tag/index.d.ts +0 -3
- package/components/tag/index.d.ts.map +0 -1
- package/components/tag/index.js +0 -2
- package/components/tag/types.d.ts.map +0 -1
- package/components/tag/types.js +0 -1
- package/components/types.d.ts.map +0 -1
- package/components/types.js +0 -31
- package/hooks/index.d.ts +0 -3
- package/hooks/index.d.ts.map +0 -1
- package/hooks/useComponentOutsideClick.d.ts.map +0 -1
- package/hooks/useComponentOutsideClick.js +0 -32
- package/hooks/usePagination.d.ts.map +0 -1
- package/hooks/usePagination.js +0 -28
- package/index.d.ts +0 -4
- package/index.d.ts.map +0 -1
- package/readme.md +0 -56
- package/tsconfig.tsbuildinfo +0 -1
- package/utils/dataAttributes.d.ts.map +0 -1
- package/utils/dataAttributes.js +0 -19
- package/utils/formValidation.d.ts.map +0 -1
- package/utils/formValidation.js +0 -35
- package/utils/index.d.ts +0 -3
- package/utils/index.d.ts.map +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import Icon from "../../../icon";
|
|
4
|
-
import { ElementSize } from "../../..";
|
|
5
|
-
/** Label component */
|
|
6
|
-
const DropdownLabel = ({ caption, selectedItem, onClick, deselectable, className, }) => {
|
|
7
|
-
const itemSelected = !isNullOrUndefined(selectedItem);
|
|
8
|
-
const text = itemSelected
|
|
9
|
-
? selectedItem?.displayValue
|
|
10
|
-
: caption;
|
|
11
|
-
const deselectVisible = deselectable && itemSelected;
|
|
12
|
-
const elClassName = getClassName([
|
|
13
|
-
"dropdown-trigger",
|
|
14
|
-
"bbr-dropdown__label",
|
|
15
|
-
isNullOrEmpty(className) ? "" : `${className}--md`,
|
|
16
|
-
itemSelected ? "" : "bbr-dropdown__label--default",
|
|
17
|
-
"button"
|
|
18
|
-
]);
|
|
19
|
-
return (_jsxs("label", { className: elClassName, onClick: onClick, children: [deselectVisible &&
|
|
20
|
-
_jsx(Icon, { name: "plus-lg", size: ElementSize.Medium }), _jsx("span", { className: deselectVisible ? "mx-2" : "mr-2", title: itemSelected ? text : undefined, children: text }), _jsx(Icon, { name: "arrow-down", size: ElementSize.Medium })] }));
|
|
21
|
-
};
|
|
22
|
-
export default DropdownLabel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/withLabel/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,QAAA,MAAM,iBAAiB,wIAOpB,aAAa,KAAG,WAoLlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useId, useState } from "react";
|
|
3
|
-
import { isNullOrUndefined, isNullOrEmpty, getClassName } from "@bodynarf/utils";
|
|
4
|
-
import { getValidationValues } from "../../../../utils";
|
|
5
|
-
import { useComponentOutsideClick } from "../../../../hooks";
|
|
6
|
-
import DropdownItem from "../item";
|
|
7
|
-
import DropdownLabel from "../label";
|
|
8
|
-
const DropdownWithLabel = ({ items, value, onSelect, validationState, deselectable, className, hideOnOuterClick, listMaxHeight, label, placeholder, disabled }) => {
|
|
9
|
-
const id = useId();
|
|
10
|
-
const [isListVisible, setListVisible] = useState(false);
|
|
11
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
|
|
12
|
-
const onItemClick = useCallback((event) => {
|
|
13
|
-
if (disabled ?? false) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const target = event.target;
|
|
17
|
-
if (isNullOrUndefined(target)) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const dataValue = target.dataset["dropdownItemValue"];
|
|
21
|
-
if (isNullOrEmpty(dataValue)) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const item = items.find(x => x.value === dataValue);
|
|
25
|
-
if (isNullOrUndefined(item)) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (value === item) {
|
|
29
|
-
setListVisible(false);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
onSelect(item);
|
|
33
|
-
setListVisible(false);
|
|
34
|
-
}, [setListVisible, value, items, onSelect, disabled]);
|
|
35
|
-
const onLabelClick = useCallback((event) => {
|
|
36
|
-
if (disabled ?? false) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const target = event.target;
|
|
40
|
-
if (isNullOrUndefined(target)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (target.classList.contains("bi-plus-lg")) {
|
|
44
|
-
onSelect(undefined);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
setListVisible(state => !state);
|
|
48
|
-
}
|
|
49
|
-
}, [onSelect, setListVisible, disabled]);
|
|
50
|
-
useComponentOutsideClick(`[data-dropdown-id="${id}"]`, isListVisible, () => setListVisible(false), hideOnOuterClick);
|
|
51
|
-
const classNames = getClassName([
|
|
52
|
-
"bbr-dropdown",
|
|
53
|
-
(disabled ?? false) ? "bbr-dropdown--disabled" : "",
|
|
54
|
-
isListVisible ? "is-active" : "",
|
|
55
|
-
isNullOrEmpty(listMaxHeight) ? "bbr-dropdown--height-default" : "",
|
|
56
|
-
className,
|
|
57
|
-
"dropdown"
|
|
58
|
-
]);
|
|
59
|
-
const labelClassName = getClassName([
|
|
60
|
-
"label",
|
|
61
|
-
label.className
|
|
62
|
-
]);
|
|
63
|
-
if (label.horizontal) {
|
|
64
|
-
const labelContainerClassName = getClassName([
|
|
65
|
-
"field-label",
|
|
66
|
-
"is-normal",
|
|
67
|
-
label.horizontalContainerClassName
|
|
68
|
-
]);
|
|
69
|
-
const fieldContainerClassName = getClassName([
|
|
70
|
-
"field-body",
|
|
71
|
-
label.horizontalFieldContainerClassName
|
|
72
|
-
]);
|
|
73
|
-
return (_jsxs("div", { className: "bbr-dropdown__root-container--with-label 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: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { className: styleClassName, caption: placeholder, deselectable: deselectable === true, selectedItem: value, onClick: onLabelClick }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
74
|
-
? _jsx("ul", { className: "dropdown-content", style: { maxHeight: listMaxHeight }, children: items.map(item => _jsx(DropdownItem, { item: item, selected: value?.value === item.value, onClick: onItemClick }, item.id)) })
|
|
75
|
-
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id), isValidationDefined && validationMessages.length > 0 &&
|
|
76
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
77
|
-
}
|
|
78
|
-
return (_jsxs("div", { className: "field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { className: styleClassName, caption: placeholder, deselectable: deselectable === true, selectedItem: value, onClick: onLabelClick }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
79
|
-
? _jsx("ul", { className: "dropdown-content", style: { maxHeight: listMaxHeight }, children: items.map(item => _jsx(DropdownItem, { item: item, selected: value?.value === item.value, onClick: onItemClick }, item.id)) })
|
|
80
|
-
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id), isValidationDefined && validationMessages.length > 0 &&
|
|
81
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
82
|
-
};
|
|
83
|
-
export default DropdownWithLabel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAEnE,oBAAoB;AACpB,MAAM,WAAW,cAAc;IAC3B,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IAEX,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,sBAAsB;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACnD,kCAAkC;IAClC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE7B,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB;;MAEE;IACF,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1C;;;MAGE;IACF,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB,gEAAgE;IAChE,gBAAgB,EAAE,OAAO,CAAC;IAE1B,wBAAwB;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,+BAA+B;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/icon/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAU/B;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EACzB,IAAI,EAAE,IAAyB,EAC/B,SAAS,GACZ,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAYzB"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getClassName } from "@bodynarf/utils";
|
|
3
|
-
import "./style.scss";
|
|
4
|
-
import { ElementSize } from "../..";
|
|
5
|
-
const sizeToClassMap = new Map([
|
|
6
|
-
[ElementSize.Small, "bbr-icon--size-smal"],
|
|
7
|
-
[ElementSize.Normal, ""],
|
|
8
|
-
[ElementSize.Medium, "bbr-icon--size-medium"],
|
|
9
|
-
[ElementSize.Large, "bbr-icon--size-large"]
|
|
10
|
-
]);
|
|
11
|
-
/**
|
|
12
|
-
* Icon component. Based on bootstrap icons
|
|
13
|
-
*/
|
|
14
|
-
export default function Icon({ name, size = ElementSize.Normal, className, }) {
|
|
15
|
-
const classNames = getClassName([
|
|
16
|
-
"bbr-icon",
|
|
17
|
-
"bi",
|
|
18
|
-
`bi-${name}`,
|
|
19
|
-
sizeToClassMap.has(size) ? sizeToClassMap.get(size) : "",
|
|
20
|
-
className
|
|
21
|
-
]);
|
|
22
|
-
return (_jsx("i", { className: classNames }));
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.bbr-icon {
|
|
2
|
-
transition: 0.15s ease-in-out color;
|
|
3
|
-
font-size: 1rem;
|
|
4
|
-
|
|
5
|
-
&--size-small {
|
|
6
|
-
font-size: 0.85rem;
|
|
7
|
-
}
|
|
8
|
-
&--size-medium {
|
|
9
|
-
font-size: 1.25rem;
|
|
10
|
-
}
|
|
11
|
-
&--size-large {
|
|
12
|
-
font-size: 2rem;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&--right {
|
|
16
|
-
margin-left: 0.5rem;
|
|
17
|
-
}
|
|
18
|
-
&--left {
|
|
19
|
-
margin-right: 0.5rem;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
package/components/icon/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/icon/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,2BAA2B;AAC3B,MAAM,WAAW,SAAS;IACtB;;;;;MAKE;IACF,IAAI,EAAE,MAAM,CAAC;IAEb,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
package/components/icon/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/components/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./accordion";
|
|
2
|
-
export * from "./anchor";
|
|
3
|
-
export * from "./button";
|
|
4
|
-
export * from "./dropdown";
|
|
5
|
-
export * from "./icon";
|
|
6
|
-
export * from "./paginator";
|
|
7
|
-
export * from "./search";
|
|
8
|
-
export * from "./tabs";
|
|
9
|
-
export * from "./tag";
|
|
10
|
-
export * from "./primitives";
|
|
11
|
-
export * from "./types";
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AAEtB,cAAc,cAAc,CAAC;AAE7B,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/paginator/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAuB,cAAc,EAAE,MAAM,IAAI,CAAC;AAEzD;;;EAGE;AACF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAC9B,KAAK,EAAE,YAAY,EAAE,WAAW,EAChC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAClC,eAAe,EAAE,cAAc,EAClC,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CA4G9B"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo } from "react";
|
|
3
|
-
import { getClassName, isNullOrEmpty } from "@bodynarf/utils";
|
|
4
|
-
import { generatePageNumbers } from "..";
|
|
5
|
-
/**
|
|
6
|
-
* Paginator component.
|
|
7
|
-
* Used for visualization of pagging configuration
|
|
8
|
-
*/
|
|
9
|
-
export default function Paginator({ count, onPageChange, currentPage, position, rounded, size, className, showNextButtons, nearPagesCount }) {
|
|
10
|
-
const page = currentPage || 0;
|
|
11
|
-
const pageChange = useCallback((event) => {
|
|
12
|
-
const target = event.target;
|
|
13
|
-
const pageRaw = target.dataset["page"];
|
|
14
|
-
if (isNullOrEmpty(pageRaw)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const page = +pageRaw;
|
|
18
|
-
if (page !== currentPage && page > 0 && page <= count) {
|
|
19
|
-
onPageChange(page);
|
|
20
|
-
}
|
|
21
|
-
}, [onPageChange, currentPage, count]);
|
|
22
|
-
const pageNumbers = useMemo(() => generatePageNumbers(page, count, nearPagesCount), [page, count]);
|
|
23
|
-
const canGoBack = useMemo(() => page > 1, [page]);
|
|
24
|
-
const canGoForward = useMemo(() => page < count, [page, count]);
|
|
25
|
-
if (pageNumbers.length <= 1) {
|
|
26
|
-
return _jsx(_Fragment, {});
|
|
27
|
-
}
|
|
28
|
-
const classNames = getClassName([
|
|
29
|
-
"bbr-paginator",
|
|
30
|
-
"pagination",
|
|
31
|
-
paginationPositionToClassMap.has(position || "") ? paginationPositionToClassMap.get(position || "") : "",
|
|
32
|
-
rounded == true ? "is-rounded" : "",
|
|
33
|
-
isNullOrEmpty(size) ? "" : `is-${size}`,
|
|
34
|
-
className
|
|
35
|
-
]);
|
|
36
|
-
return (_jsxs("nav", { className: classNames, role: "navigation", "aria-label": "pagination", children: [showNextButtons === true &&
|
|
37
|
-
_jsxs(_Fragment, { children: [_jsx("a", { className: `pagination-previous${canGoBack ? "" : " is-disabled"}`, "data-page": page - 1, onClick: pageChange, children: "Previous" }), _jsx("a", { className: `pagination-next${canGoForward ? "" : " is-disabled"}`, "data-page": page + 1, onClick: pageChange, children: "Next page" })] }), _jsxs("ul", { className: "pagination-list", children: [page !== 1 && !pageNumbers.includes(1) &&
|
|
38
|
-
_jsxs(_Fragment, { children: [_jsx("li", { children: _jsx("a", { className: "pagination-link", "aria-label": "Goto page 1", "data-page": 1, onClick: pageChange, children: "1" }) }), _jsx("li", { children: _jsx("span", { className: "pagination-ellipsis", children: "\u2026" }) })] }), pageNumbers.map(x => _jsx("li", { children: _jsx("a", { className: `pagination-link${page === x ? " is-current" : ""}`, "aria-label": `Goto page ${x}`, "data-page": x, onClick: pageChange, children: x }) }, x)), page != count && !pageNumbers.includes(count) &&
|
|
39
|
-
_jsxs(_Fragment, { children: [_jsx("li", { children: _jsx("span", { className: "pagination-ellipsis", children: "\u2026" }) }), _jsx("li", { children: _jsx("a", { className: "pagination-link", "aria-label": `Goto page ${count}`, "data-page": count, onClick: pageChange, children: count }) })] })] })] }));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Position setting to css class name map
|
|
43
|
-
*/
|
|
44
|
-
const paginationPositionToClassMap = new Map([
|
|
45
|
-
["center", "is-centered"],
|
|
46
|
-
["right", "is-right"]
|
|
47
|
-
]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,MAAM,WAAW,cAAc;IAC3B,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;MAGE;IACF,QAAQ,CAAC,EACP,MAAM,GACN,QAAQ,GACR,OAAO,CACR;IAED,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;MAGE;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,SAAU,MAAM,SAAS,MAAM,SAAQ,MAAM,KAAO,MAAM,MAAM,CAU/F,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get nearest numbers from each side (left & right)
|
|
3
|
-
* @param page Number of current page
|
|
4
|
-
* @param count Amount of pages
|
|
5
|
-
* @param size Amount of pages from left & right to current page. Default is 3
|
|
6
|
-
* @throws Current page is greater than pages amount
|
|
7
|
-
* @returns Array of nearest numbers to current page
|
|
8
|
-
*/
|
|
9
|
-
export const generatePageNumbers = (page, count, size = 3) => {
|
|
10
|
-
if (page < 0 || count <= 0 || page > count) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
return [
|
|
14
|
-
...new Array(size).fill(page).map((_, i) => page - i - 1).filter(x => x > 0 && x < page).reverse(),
|
|
15
|
-
page,
|
|
16
|
-
...new Array(size).fill(page).map((_, i) => page + i + 1).filter(x => x > 0 && x > page && x <= count)
|
|
17
|
-
];
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEnC,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,6JAMX,aAAa,KAAG,WAoFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
-
import "./style.scss";
|
|
5
|
-
/** Boolean input component */
|
|
6
|
-
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, }) => {
|
|
7
|
-
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
8
|
-
const id = name || generateGuid();
|
|
9
|
-
const className = getClassName([
|
|
10
|
-
"is-checkradio",
|
|
11
|
-
"m-check-radio",
|
|
12
|
-
(hasBackgroundColor ?? false) ? "has-background-color" : "",
|
|
13
|
-
(fixBackgroundColor ?? false) && (hasBackgroundColor ?? false) ? "m-has-background-color" : "",
|
|
14
|
-
isNullOrUndefined(size) ? "" : size === "normal" ? "" : `is-${size}`,
|
|
15
|
-
(rounded ?? false) ? "is-circle" : "",
|
|
16
|
-
isNullOrUndefined(style) ? "" : `is-${style}`,
|
|
17
|
-
(block ?? false) ? "is-block" : "",
|
|
18
|
-
(withoutBorder ?? false) ? "has-no-border" : "",
|
|
19
|
-
]);
|
|
20
|
-
if (!isNullOrUndefined(label) && isFormLabel === true) {
|
|
21
|
-
const labelClassName = getClassName([
|
|
22
|
-
"label",
|
|
23
|
-
label.className
|
|
24
|
-
]);
|
|
25
|
-
const labelContainerClassName = getClassName([
|
|
26
|
-
"field-label",
|
|
27
|
-
label.horizontalContainerClassName
|
|
28
|
-
]);
|
|
29
|
-
const fieldContainerClassName = getClassName([
|
|
30
|
-
"field-body",
|
|
31
|
-
label.horizontalFieldContainerClassName
|
|
32
|
-
]);
|
|
33
|
-
return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("input", { type: "checkbox", name: id, id: id, disabled: disabled, onChange: onChecked, className: className, defaultChecked: defaultValue }), _jsx("label", { htmlFor: id })] }) })] }));
|
|
34
|
-
}
|
|
35
|
-
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("input", { type: "checkbox", name: id, id: id, disabled: disabled, onChange: onChecked, className: className, defaultChecked: defaultValue }), _jsx("label", { htmlFor: id, children: label?.caption })] }));
|
|
36
|
-
};
|
|
37
|
-
export default CheckBox;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
.is-checkradio.m-check-radio[type="checkbox"] {
|
|
2
|
-
&.has-background-color.m-has-background-color:not(:checked) + label::before {
|
|
3
|
-
border-color: #dbdbdb !important;
|
|
4
|
-
background-color: transparent !important;
|
|
5
|
-
}
|
|
6
|
-
& + label::before,
|
|
7
|
-
& + label:before {
|
|
8
|
-
top: 0.125rem;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAE3C,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,OAAO,CAAC;IACjE,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iCAAiC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;MAGE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;MAIE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":"AAIA,OAAO,yBAAyB,CAAC;AAIjC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,wIAMb,SAAS,KAAG,WA4Gd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
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 "../../../../common.scss";
|
|
5
|
-
import { ElementSize } from "../../..";
|
|
6
|
-
import { getValidationValues } from "../../../../utils";
|
|
7
|
-
/** Date input component */
|
|
8
|
-
const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded, loading, style, label, onBlur }) => {
|
|
9
|
-
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value)
|
|
10
|
-
? undefined
|
|
11
|
-
: new Date(event.target.value)), [onValueChange]);
|
|
12
|
-
const id = name || generateGuid();
|
|
13
|
-
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
14
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
15
|
-
const elClassName = getClassName([
|
|
16
|
-
className,
|
|
17
|
-
elSizeClassName,
|
|
18
|
-
styleClassName,
|
|
19
|
-
rounded === true ? "is-rounded" : "",
|
|
20
|
-
"input",
|
|
21
|
-
]);
|
|
22
|
-
const inputContainerClassName = getClassName([
|
|
23
|
-
"control",
|
|
24
|
-
loading === true ? "is-loading" : "",
|
|
25
|
-
]);
|
|
26
|
-
const stingifiedDefValue = defaultValue?.toISOString().split("T")[0];
|
|
27
|
-
const labelClassName = getClassName([
|
|
28
|
-
"label",
|
|
29
|
-
!label.horizontal ? elSizeClassName : "",
|
|
30
|
-
label.className
|
|
31
|
-
]);
|
|
32
|
-
if (label.horizontal) {
|
|
33
|
-
const labelContainerClassName = getClassName([
|
|
34
|
-
"field-label",
|
|
35
|
-
elSizeClassName,
|
|
36
|
-
label.horizontalContainerClassName
|
|
37
|
-
]);
|
|
38
|
-
const fieldContainerClassName = getClassName([
|
|
39
|
-
"field-body",
|
|
40
|
-
label.horizontalFieldContainerClassName
|
|
41
|
-
]);
|
|
42
|
-
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: "date", className: elClassName, readOnly: readonly, disabled: disabled, defaultValue: stingifiedDefValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
43
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
44
|
-
}
|
|
45
|
-
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: "date", className: elClassName, readOnly: readonly, disabled: disabled, defaultValue: stingifiedDefValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
46
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
47
|
-
};
|
|
48
|
-
export default DatePicker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEvD,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC;IAC3F,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;IAElB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import "../../../../common.scss";
|
|
3
|
-
import { MultilineProps } from "..";
|
|
4
|
-
/** Multiline textual input component */
|
|
5
|
-
declare const Multiline: (props: MultilineProps) => JSX.Element;
|
|
6
|
-
export default Multiline;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAKpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAQ1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import "../../../../common.scss";
|
|
4
|
-
import MultilineWithoutLabel from "../components/multilineWithoutLabel";
|
|
5
|
-
import MultilineWithLabel from "../components/multilineWithLabel";
|
|
6
|
-
/** Multiline textual input component */
|
|
7
|
-
const Multiline = (props) => {
|
|
8
|
-
if (isNullOrUndefined(props.label)) {
|
|
9
|
-
return (_jsx(MultilineWithoutLabel, { ...props }));
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return (_jsx(MultilineWithLabel, { ...props }));
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export default Multiline;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,kKAOrB,cAAc,KAAG,WAyGnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
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 "../../../..";
|
|
5
|
-
import { getValidationValues } from "../../../../../utils";
|
|
6
|
-
/** Multiline textual input component with describing label */
|
|
7
|
-
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded, loading, label, placeholder, fixed, rows, 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
|
-
"textarea",
|
|
18
|
-
fixed === true ? "has-fixed-size" : "",
|
|
19
|
-
]);
|
|
20
|
-
const inputContainerClassName = getClassName([
|
|
21
|
-
"control",
|
|
22
|
-
loading === true ? "is-loading" : "",
|
|
23
|
-
]);
|
|
24
|
-
const labelClassName = getClassName([
|
|
25
|
-
"label",
|
|
26
|
-
!label.horizontal ? elSizeClassName : "",
|
|
27
|
-
label.className
|
|
28
|
-
]);
|
|
29
|
-
if (label.horizontal) {
|
|
30
|
-
const labelContainerClassName = getClassName([
|
|
31
|
-
"field-label",
|
|
32
|
-
elSizeClassName,
|
|
33
|
-
label.horizontalContainerClassName
|
|
34
|
-
]);
|
|
35
|
-
const fieldContainerClassName = getClassName([
|
|
36
|
-
"field-body",
|
|
37
|
-
label.horizontalFieldContainerClassName
|
|
38
|
-
]);
|
|
39
|
-
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("textarea", { className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
40
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
41
|
-
}
|
|
42
|
-
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
43
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
44
|
-
};
|
|
45
|
-
export default MultilineWithLabel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,wIAMxB,cAAc,KAAG,WA2CnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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 "../../../../";
|
|
5
|
-
import { getValidationValues } from "../../../../../utils";
|
|
6
|
-
/** Multiline textual input component without describing label*/
|
|
7
|
-
const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded, loading, fixed, rows, }) => {
|
|
8
|
-
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
|
-
const id = name || generateGuid();
|
|
10
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
11
|
-
const elClassName = getClassName([
|
|
12
|
-
className,
|
|
13
|
-
"is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
|
|
14
|
-
rounded === true ? "is-rounded" : "",
|
|
15
|
-
styleClassName,
|
|
16
|
-
"textarea",
|
|
17
|
-
fixed === true ? "has-fixed-size" : "",
|
|
18
|
-
]);
|
|
19
|
-
const inputContainerClassName = getClassName([
|
|
20
|
-
"control",
|
|
21
|
-
"bbr-input",
|
|
22
|
-
loading === true ? "is-loading" : "",
|
|
23
|
-
]);
|
|
24
|
-
return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: elClassName, placeholder: placeholder, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, id: id, name: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
25
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
26
|
-
};
|
|
27
|
-
export default MultilineWithoutLabel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAE3C,mDAAmD;AACnD,MAAM,WAAW,cAAe,SAAQ,qBAAqB,CAAC,MAAM,CAAC;IACjE,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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
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;AAKjC,6BAA6B;AAC7B,QAAA,MAAM,MAAM,UAAW,WAAW,KAAG,WAOpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|