@bodynarf/react.components 1.9.1 → 1.10.0
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.10.0.tgz +0 -0
- package/components/accordion/component/index.d.ts +1 -0
- package/components/accordion/component/index.d.ts.map +1 -1
- package/components/accordion/component/index.js +3 -3
- package/components/anchor/component/index.js +2 -2
- package/components/anchor/components/anchorWithIcon/index.d.ts +9 -2
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
- package/components/anchor/components/anchorWithIcon/index.js +2 -2
- package/components/anchor/components/simpleAnchor/index.d.ts +3 -2
- package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
- package/components/anchor/components/simpleAnchor/index.js +1 -1
- package/components/anchor/types.d.ts +3 -11
- package/components/anchor/types.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.d.ts +7 -32
- package/components/breadcrumbs/component/index.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.js +22 -6
- package/components/breadcrumbs/types.d.ts +30 -1
- package/components/breadcrumbs/types.d.ts.map +1 -1
- package/components/button/component/index.d.ts.map +1 -1
- package/components/button/component/index.js +3 -3
- package/components/button/types.d.ts +1 -1
- package/components/dropdown/component/style.scss +3 -3
- package/components/dropdown/components/compact/index.d.ts +8 -1
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +17 -5
- package/components/dropdown/components/label/index.d.ts +1 -17
- package/components/dropdown/components/label/index.d.ts.map +1 -1
- package/components/dropdown/components/label/index.js +1 -54
- package/components/dropdown/components/withLabel/index.d.ts +3 -1
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +8 -82
- package/components/dropdown/types.d.ts +8 -0
- package/components/dropdown/types.d.ts.map +1 -1
- package/components/icon/component/index.d.ts +3 -2
- package/components/icon/component/index.d.ts.map +1 -1
- package/components/icon/component/index.js +4 -3
- package/components/icon/types.d.ts +2 -0
- package/components/icon/types.d.ts.map +1 -1
- package/components/multiselect/component/index.d.ts +8 -0
- package/components/multiselect/component/index.d.ts.map +1 -0
- package/components/multiselect/component/index.js +13 -0
- package/components/multiselect/component/style.scss +20 -0
- package/components/multiselect/components/item/index.d.ts +25 -0
- package/components/multiselect/components/item/index.d.ts.map +1 -0
- package/components/multiselect/components/item/index.js +62 -0
- package/components/multiselect/components/label/component/index.d.ts +20 -0
- package/components/multiselect/components/label/component/index.d.ts.map +1 -0
- package/components/multiselect/components/label/component/index.js +12 -0
- package/components/multiselect/components/label/components/empty/index.d.ts +8 -0
- package/components/multiselect/components/label/components/empty/index.d.ts.map +1 -0
- package/components/multiselect/components/label/components/empty/index.js +16 -0
- package/components/multiselect/components/label/components/nonEmpty/index.d.ts +8 -0
- package/components/multiselect/components/label/components/nonEmpty/index.d.ts.map +1 -0
- package/components/multiselect/components/label/components/nonEmpty/index.js +16 -0
- package/components/multiselect/components/label/index.d.ts +2 -0
- package/components/multiselect/components/label/index.d.ts.map +1 -0
- package/components/multiselect/components/label/index.js +1 -0
- package/components/multiselect/components/withLabel/index.d.ts +6 -0
- package/components/multiselect/components/withLabel/index.d.ts.map +1 -0
- package/components/multiselect/components/withLabel/index.js +11 -0
- package/components/multiselect/components/withoutLabel/index.d.ts +10 -0
- package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -0
- package/components/multiselect/components/withoutLabel/index.js +84 -0
- package/components/multiselect/index.d.ts +3 -0
- package/components/multiselect/index.d.ts.map +1 -0
- package/components/multiselect/index.js +2 -0
- package/components/multiselect/types.d.ts +41 -0
- package/components/multiselect/types.d.ts.map +1 -0
- package/components/multiselect/types.js +1 -0
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +22 -5
- package/components/paginator/index.d.ts +0 -1
- package/components/paginator/index.d.ts.map +1 -1
- package/components/paginator/index.js +0 -1
- package/components/primitives/checkbox/component/index.d.ts +2 -1
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +8 -6
- package/components/primitives/checkbox/component/style.scss +22 -3
- package/components/primitives/color/components/picker/index.d.ts +3 -3
- package/components/primitives/color/components/picker/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.js +8 -8
- 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 +3 -4
- 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 +2 -3
- package/components/primitives/date/component/index.d.ts +3 -2
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +5 -7
- package/components/primitives/date/component/style.scss +11 -0
- package/components/primitives/date/types.d.ts +1 -1
- package/components/primitives/date/types.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.js +2 -2
- package/components/primitives/internal/hint/index.d.ts +4 -7
- package/components/primitives/internal/hint/index.d.ts.map +1 -1
- package/components/primitives/internal/hint/index.js +1 -0
- package/components/primitives/internal/hint/style.scss +4 -0
- package/components/primitives/multiline/component/index.d.ts +0 -1
- package/components/primitives/multiline/component/index.d.ts.map +1 -1
- package/components/primitives/multiline/component/index.js +0 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts +2 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withLabel/index.js +4 -6
- package/components/primitives/multiline/components/withoutLabel/index.d.ts +1 -0
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withoutLabel/index.js +4 -5
- package/components/primitives/number/components/withLabel/index.d.ts +2 -1
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +4 -6
- package/components/primitives/number/components/withoutLabel/index.d.ts +2 -1
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +5 -6
- package/components/primitives/password/components/withLabel/index.d.ts +2 -1
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +5 -6
- package/components/primitives/password/components/withoutLabel/index.d.ts +1 -0
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +6 -7
- package/components/primitives/text/component/index.d.ts +0 -1
- package/components/primitives/text/component/index.d.ts.map +1 -1
- package/components/primitives/text/component/index.js +0 -1
- package/components/primitives/text/components/withLabel/index.d.ts +1 -0
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withLabel/index.js +4 -6
- package/components/primitives/text/components/withoutLabel/index.d.ts +2 -1
- package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withoutLabel/index.js +5 -6
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +6 -8
- package/components/table/component/index.d.ts +1 -35
- package/components/table/component/index.d.ts.map +1 -1
- package/components/table/component/index.js +1 -1
- package/components/table/types.d.ts +36 -1
- package/components/table/types.d.ts.map +1 -1
- package/components/tabs/component/index.d.ts +3 -26
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +3 -3
- package/components/tabs/types.d.ts +24 -1
- package/components/tabs/types.d.ts.map +1 -1
- package/components/tag/component/index.d.ts +1 -0
- package/components/tag/component/index.d.ts.map +1 -1
- package/components/tag/component/index.js +3 -3
- package/components/tag/types.d.ts +3 -3
- package/components/tag/types.d.ts.map +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.d.ts.map +1 -1
- package/hooks/index.js +1 -0
- package/hooks/useComponentOutsideClick.d.ts.map +1 -1
- package/hooks/useComponentOutsideClick.js +2 -3
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/bodynarf-react.components-1.9.3.tgz +0 -0
- package/common.scss +0 -8
- package/components/paginator/utils.d.ts +0 -10
- package/components/paginator/utils.d.ts.map +0 -1
- package/components/paginator/utils.js +0 -18
|
@@ -2,13 +2,12 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useMemo } from "react";
|
|
3
3
|
import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { mapDataAttributes } from "../../../utils";
|
|
5
|
-
import { ElementPosition } from "../../../types";
|
|
6
|
-
import { generatePageNumbers } from "../..";
|
|
5
|
+
import { ElementPosition, ElementSize } from "../../../types";
|
|
7
6
|
/**
|
|
8
7
|
* Paginator component.
|
|
9
8
|
* Used for visualization of paging configuration
|
|
10
9
|
*/
|
|
11
|
-
export default function Paginator({ count, onPageChange, currentPage = 0, position = ElementPosition.Left, size, rounded = false, showNextButtons = false, nearPagesCount, className, title, data, }) {
|
|
10
|
+
export default function Paginator({ count, onPageChange, currentPage = 0, position = ElementPosition.Left, size = ElementSize.Normal, rounded = false, showNextButtons = false, nearPagesCount = 3, className, title, data, }) {
|
|
12
11
|
const pageChange = useCallback((event) => {
|
|
13
12
|
const target = event.target;
|
|
14
13
|
const pageRaw = target.dataset["page"];
|
|
@@ -32,12 +31,12 @@ export default function Paginator({ count, onPageChange, currentPage = 0, positi
|
|
|
32
31
|
className,
|
|
33
32
|
paginationPositionToClassMap.get(position),
|
|
34
33
|
rounded ? "is-rounded" : "",
|
|
35
|
-
|
|
34
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
36
35
|
]);
|
|
37
36
|
const dataAttributes = isNullOrUndefined(data)
|
|
38
37
|
? undefined
|
|
39
38
|
: mapDataAttributes(data);
|
|
40
|
-
return (_jsxs("nav", {
|
|
39
|
+
return (_jsxs("nav", { role: "navigation", className: classNames, "aria-label": "pagination", title: title, ...dataAttributes, children: [showNextButtons &&
|
|
41
40
|
_jsxs(_Fragment, { children: [_jsx("a", { className: `pagination-previous${canGoBack ? "" : " is-disabled"}`, "data-page": currentPage - 1, onClick: pageChange, children: "Previous" }), _jsx("a", { className: `pagination-next${canGoForward ? "" : " is-disabled"}`, "data-page": currentPage + 1, onClick: pageChange, children: "Next page" })] }), _jsxs("ul", { className: "pagination-list", children: [currentPage !== 1 && !pageNumbers.includes(1) &&
|
|
42
41
|
_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${currentPage === x ? " is-current" : ""}`, "aria-label": `Goto page ${x}`, "data-page": x, onClick: pageChange, children: x }) }, x)), currentPage != count && !pageNumbers.includes(count) &&
|
|
43
42
|
_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 }) })] })] })] }));
|
|
@@ -50,3 +49,21 @@ const paginationPositionToClassMap = new Map([
|
|
|
50
49
|
[ElementPosition.Center, "is-centered"],
|
|
51
50
|
[ElementPosition.Right, "is-right"]
|
|
52
51
|
]);
|
|
52
|
+
/**
|
|
53
|
+
* Get nearest numbers from each side (left & right)
|
|
54
|
+
* @param page Number of current page
|
|
55
|
+
* @param count Amount of pages
|
|
56
|
+
* @param size Amount of pages from left & right to current page
|
|
57
|
+
* @throws Current page is greater than pages amount
|
|
58
|
+
* @returns Array of nearest numbers to current page
|
|
59
|
+
*/
|
|
60
|
+
const generatePageNumbers = (page, count, size) => {
|
|
61
|
+
if (page < 0 || count <= 0 || page > count) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
return [
|
|
65
|
+
...new Array(size).fill(page).map((_, i) => page - i - 1).filter(x => x > 0 && x < page).reverse(),
|
|
66
|
+
page,
|
|
67
|
+
...new Array(size).fill(page).map((_, i) => page + i + 1).filter(x => x > 0 && x > page && x <= count)
|
|
68
|
+
];
|
|
69
|
+
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import "./style.scss";
|
|
2
3
|
import { CheckBoxProps } from "../..";
|
|
3
4
|
/** Boolean input component */
|
|
4
|
-
declare const CheckBox: ({
|
|
5
|
+
declare const CheckBox: ({ onValueChange, defaultValue, label, name, size, style, disabled, rounded, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, className, title, data, }: CheckBoxProps) => JSX.Element;
|
|
5
6
|
export default CheckBox;
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":"AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,qLAWX,aAAa,KAAG,WAoFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -6,16 +6,15 @@ import { mapDataAttributes } from "../../../../utils";
|
|
|
6
6
|
import ComponentWithLabel from "../../internal/componentWithLabel";
|
|
7
7
|
import "./style.scss";
|
|
8
8
|
/** Boolean input component */
|
|
9
|
-
const CheckBox = ({
|
|
9
|
+
const CheckBox = ({ onValueChange, defaultValue, label, name = generateGuid(), size = ElementSize.Normal, style, disabled = false, rounded = false, block = false, withoutBorder = false, hasBackgroundColor = false, fixBackgroundColor = false, isFormLabel = false, className, title, data, }) => {
|
|
10
10
|
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
11
|
-
const id = name ?? generateGuid();
|
|
12
11
|
const elClassName = getClassName([
|
|
13
12
|
"is-checkradio",
|
|
14
13
|
"m-check-radio",
|
|
15
14
|
className,
|
|
16
15
|
hasBackgroundColor ? "has-background-color" : "",
|
|
17
16
|
fixBackgroundColor && hasBackgroundColor ? "m-has-background-color" : "",
|
|
18
|
-
|
|
17
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
19
18
|
rounded ? "is-circle" : "",
|
|
20
19
|
isNullOrUndefined(style) ? "" : `is-${style}`,
|
|
21
20
|
block ? "is-block" : "",
|
|
@@ -25,11 +24,14 @@ const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, size, st
|
|
|
25
24
|
? undefined
|
|
26
25
|
: mapDataAttributes(data);
|
|
27
26
|
if (!isNullOrUndefined(label) && isFormLabel) {
|
|
28
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
27
|
+
return (_jsxs(ComponentWithLabel, { id: name, label: {
|
|
29
28
|
...label,
|
|
30
29
|
horizontalContainerClassName: getClassName([label.horizontalContainerClassName, "p-0"]),
|
|
31
|
-
}, size: ElementSize.Normal, children: [_jsx("input", { type: "checkbox", id:
|
|
30
|
+
}, size: ElementSize.Normal, children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, title: title, ...dataAttributes }), _jsx("label", { className: "is-empty", htmlFor: name })] }));
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
const labelClassName = isNullOrUndefined(label)
|
|
33
|
+
? "is-empty"
|
|
34
|
+
: undefined;
|
|
35
|
+
return (_jsxs("div", { className: "bbr-field bbr-input field mr-2", children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, title: title, ...dataAttributes }), _jsx("label", { htmlFor: name, className: labelClassName, children: label?.caption })] }));
|
|
34
36
|
};
|
|
35
37
|
export default CheckBox;
|
|
@@ -3,8 +3,27 @@
|
|
|
3
3
|
border-color: #dbdbdb !important;
|
|
4
4
|
background-color: transparent !important;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
&.is-block + label.is-empty {
|
|
8
|
+
&::before {
|
|
9
|
+
left: 0.25rem !important;
|
|
10
|
+
top: 0.25rem !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&::after {
|
|
14
|
+
top: 0.45rem;
|
|
15
|
+
left: 0.7rem;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:not(.is-block) + label {
|
|
20
|
+
&::after {
|
|
21
|
+
top: 0.275rem;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
& + label.is-empty {
|
|
26
|
+
padding-left: 1rem;
|
|
27
|
+
margin: 0 !important;
|
|
9
28
|
}
|
|
10
29
|
}
|
|
@@ -3,8 +3,6 @@ import { BaseInputElementProps } from "../../../../../types";
|
|
|
3
3
|
import { ColorPickerPreviewConfig } from "../..";
|
|
4
4
|
/** Props of `ColorPickerControl` */
|
|
5
5
|
export interface ColorPickerControlProps extends Omit<BaseInputElementProps<string>, "onValueChange" | "placeholder" | "rounded" | "readonly" | "loading" | "className"> {
|
|
6
|
-
/** Preview element configuration */
|
|
7
|
-
previewConfig?: ColorPickerPreviewConfig;
|
|
8
6
|
/** Current color value */
|
|
9
7
|
value: string;
|
|
10
8
|
/** Control unique identifier */
|
|
@@ -13,8 +11,10 @@ export interface ColorPickerControlProps extends Omit<BaseInputElementProps<stri
|
|
|
13
11
|
elementClassName: string;
|
|
14
12
|
/** Handler of control value change*/
|
|
15
13
|
onValueChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
/** Preview element configuration */
|
|
15
|
+
previewConfig?: ColorPickerPreviewConfig;
|
|
16
16
|
}
|
|
17
17
|
/** Color picker container component */
|
|
18
|
-
declare const ColorPickerControl: ({
|
|
18
|
+
declare const ColorPickerControl: ({ value, defaultValue, onValueChange, elementClassName, disabled, previewConfig, size, id, title, data, hint, validationState, }: ColorPickerControlProps) => JSX.Element;
|
|
19
19
|
export default ColorPickerControl;
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/picker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3E,oCAAoC;AACpC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACjD,qBAAqB,CAAC,MAAM,CAAC,EAC3B,eAAe,GAAG,aAAa,GAC/B,SAAS,GAAG,UAAU,GACtB,SAAS,GAAG,WAAW,CAC5B;IACG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/picker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3E,oCAAoC;AACpC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACjD,qBAAqB,CAAC,MAAM,CAAC,EAC3B,eAAe,GAAG,aAAa,GAC/B,SAAS,GAAG,UAAU,GACtB,SAAS,GAAG,WAAW,CAC5B;IACG,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,6BAA6B;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IAEzB,qCAAqC;IACrC,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAE9D,oCAAoC;IACpC,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC5C;AAED,uCAAuC;AACvC,QAAA,MAAM,kBAAkB,qIAQrB,uBAAuB,KAAG,WA0C5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -4,11 +4,11 @@ import { ElementPosition } from "../../../../../types";
|
|
|
4
4
|
import { mapDataAttributes } from "../../../../../utils";
|
|
5
5
|
import InternalHint from "../../../internal/hint";
|
|
6
6
|
/** Color picker container component */
|
|
7
|
-
const ColorPickerControl = ({
|
|
7
|
+
const ColorPickerControl = ({ value, defaultValue, onValueChange, elementClassName, disabled = false, previewConfig, size, id, title, data, hint, validationState, }) => {
|
|
8
8
|
if (!isNullOrUndefined(previewConfig)) {
|
|
9
|
-
return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled,
|
|
9
|
+
return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, elementClassName: elementClassName, data: data, title: title }));
|
|
10
10
|
}
|
|
11
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "control bbr-input", children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, className: elementClassName, onChange: onValueChange, defaultValue: defaultValue, title: title
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "control bbr-input", children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, className: elementClassName, onChange: onValueChange, defaultValue: defaultValue, ...data, title: title }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
12
12
|
};
|
|
13
13
|
export default ColorPickerControl;
|
|
14
14
|
/** Picker sub component with preview */
|
|
@@ -29,14 +29,14 @@ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onV
|
|
|
29
29
|
"is-flex-grow-1",
|
|
30
30
|
previewConfig.position === ElementPosition.Left ? "ml-1" : "mr-1",
|
|
31
31
|
]);
|
|
32
|
-
if (previewConfig.position === ElementPosition.
|
|
33
|
-
return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("button", { className: classNames, style: {
|
|
32
|
+
if (previewConfig.position === ElementPosition.Right) {
|
|
33
|
+
return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, title: title, ...dataAttributes }) }), _jsx("button", { className: classNames, style: {
|
|
34
34
|
"--color-picker__background-color": value,
|
|
35
35
|
"--color-picker__color": color,
|
|
36
|
-
}, children: value }), _jsx(
|
|
36
|
+
}, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
37
37
|
}
|
|
38
|
-
return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("
|
|
38
|
+
return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("button", { className: classNames, style: {
|
|
39
39
|
"--color-picker__background-color": value,
|
|
40
40
|
"--color-picker__color": color,
|
|
41
|
-
}, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
41
|
+
}, children: value }), _jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
42
42
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColorPickerProps } from "../..";
|
|
3
3
|
/** Color picker component with form label */
|
|
4
|
-
declare function ColorPickerWithLabel({ preview, name, defaultValue,
|
|
4
|
+
declare function ColorPickerWithLabel({ preview, name, defaultValue, onValueChange, validationState, disabled, rounded, size, label, hint, className, title, data, }: ColorPickerProps): JSX.Element;
|
|
5
5
|
export default ColorPickerWithLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC1B,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC1B,OAAO,EACP,IAAqB,EACrB,YAAY,EAAE,aAAa,EAC3B,eAAe,EACf,QAAgB,EAAE,OAAe,EAAE,IAAyB,EAC5D,KAAK,EAEL,IAAI,EACJ,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,gBAAgB,eAgDlB;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { getStyleClassName } from "../../../../../utils";
|
|
|
6
6
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
7
|
import ColorPickerControl from "../picker";
|
|
8
8
|
/** Color picker component with form label */
|
|
9
|
-
function ColorPickerWithLabel({ preview, name, defaultValue,
|
|
9
|
+
function ColorPickerWithLabel({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size = ElementSize.Normal, label, hint, className, title, data, }) {
|
|
10
10
|
const defaultColor = isNullOrUndefined(defaultValue)
|
|
11
11
|
? whiteHex
|
|
12
12
|
: rgbToHex(defaultValue);
|
|
@@ -17,10 +17,9 @@ function ColorPickerWithLabel({ preview, name, defaultValue, validationState, on
|
|
|
17
17
|
className,
|
|
18
18
|
rounded ? "is-rounded" : "",
|
|
19
19
|
getStyleClassName(undefined, validationState),
|
|
20
|
-
|
|
20
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
21
21
|
"input",
|
|
22
22
|
]);
|
|
23
|
-
|
|
24
|
-
return (_jsx(ComponentWithLabel, { id: id, label: label, size: size ?? ElementSize.Normal, children: _jsx(ColorPickerControl, { id: id, value: value, disabled: disabled, previewConfig: preview, elementClassName: elClassName, onValueChange: onChange, defaultValue: defaultColor, hint: hint, validationState: validationState, data: data, title: title }) }));
|
|
23
|
+
return (_jsx(ComponentWithLabel, { id: name, size: size, label: label, children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, hint: hint, validationState: validationState, data: data, title: title }) }));
|
|
25
24
|
}
|
|
26
25
|
export default ColorPickerWithLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColorPickerProps } from "../..";
|
|
3
3
|
/** Color picker component without form label */
|
|
4
|
-
declare function ColorPickerWithoutLabel({ preview, name, defaultValue,
|
|
4
|
+
declare function ColorPickerWithoutLabel({ preview, name, defaultValue, onValueChange, validationState, disabled, rounded, size, className, title, data, hint, }: ColorPickerProps): JSX.Element;
|
|
5
5
|
export default ColorPickerWithoutLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,iBAAS,uBAAuB,CAAC,EAC7B,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,iBAAS,uBAAuB,CAAC,EAC7B,OAAO,EACP,IAAqB,EACrB,YAAY,EAAE,aAAa,EAC3B,eAAe,EACf,QAAgB,EAAE,OAAe,EAAE,IAAI,EAEvC,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,GACP,EAAE,gBAAgB,eA6ClB;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
3
3
|
import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whiteHex } from "@bodynarf/utils";
|
|
4
4
|
import ColorPickerControl from "../picker";
|
|
5
5
|
/** Color picker component without form label */
|
|
6
|
-
function ColorPickerWithoutLabel({ preview, name, defaultValue,
|
|
6
|
+
function ColorPickerWithoutLabel({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size, className, title, data, hint, }) {
|
|
7
7
|
const defaultColor = isNullOrUndefined(defaultValue)
|
|
8
8
|
? whiteHex
|
|
9
9
|
: rgbToHex(defaultValue);
|
|
@@ -16,7 +16,6 @@ function ColorPickerWithoutLabel({ preview, name, defaultValue, validationState,
|
|
|
16
16
|
isNullOrUndefined(size) ? "" : `is-${size}`,
|
|
17
17
|
"input",
|
|
18
18
|
]);
|
|
19
|
-
|
|
20
|
-
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: id, value: value, disabled: disabled, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, data: data, title: title, hint: hint, validationState: validationState }) }));
|
|
19
|
+
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, data: data, title: title, hint: hint, validationState: validationState }) }));
|
|
21
20
|
}
|
|
22
21
|
export default ColorPickerWithoutLabel;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./style.scss";
|
|
2
3
|
import { DateProps } from "../..";
|
|
3
4
|
/** Date input component */
|
|
4
|
-
declare const DatePicker: ({ defaultValue, onValueChange,
|
|
5
|
+
declare const DatePicker: ({ defaultValue, onValueChange, validationState, name, style, size, readonly, disabled, rounded, loading, label, onBlur, className, title, data, hint, }: DateProps) => JSX.Element;
|
|
5
6
|
export default DatePicker;
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":";AASA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,4JAWb,SAAS,KAAG,WA2Dd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../utils";
|
|
6
6
|
import ComponentWithLabel from "../../internal/componentWithLabel";
|
|
7
7
|
import InternalHint from "../../internal/hint";
|
|
8
|
-
import "
|
|
8
|
+
import "./style.scss";
|
|
9
9
|
/** Date input component */
|
|
10
|
-
const DatePicker = ({ defaultValue, onValueChange,
|
|
10
|
+
const DatePicker = ({ defaultValue, onValueChange, validationState, name = generateGuid(), style, size = ElementSize.Normal, readonly = false, disabled = false, rounded = false, loading = false, label, onBlur, className, title, data, hint, }) => {
|
|
11
11
|
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value)
|
|
12
12
|
? undefined
|
|
13
13
|
: new Date(event.target.value)), [onValueChange]);
|
|
14
|
-
const id = name ?? generateGuid();
|
|
15
|
-
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
16
14
|
const elClassName = getClassName([
|
|
17
15
|
className,
|
|
18
|
-
|
|
16
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
19
17
|
getStyleClassName(style, validationState),
|
|
20
18
|
rounded ? "is-rounded" : "",
|
|
21
19
|
"input",
|
|
@@ -28,6 +26,6 @@ const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validatio
|
|
|
28
26
|
const dataAttributes = isNullOrUndefined(data)
|
|
29
27
|
? undefined
|
|
30
28
|
: mapDataAttributes(data);
|
|
31
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
29
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, defaultValue: stringifiedDefValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
32
30
|
};
|
|
33
31
|
export default DatePicker;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseInputElementProps, LabelConfiguration } from "../../../types";
|
|
2
2
|
/** Date input component props type */
|
|
3
|
-
export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder"> {
|
|
3
|
+
export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder" | "label"> {
|
|
4
4
|
/** Label configuration */
|
|
5
5
|
label: LabelConfiguration;
|
|
6
6
|
/** Focus out event handler */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEvE,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEvE,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,IAAI,CACnC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EACvC,aAAa,GAAG,OAAO,CAC1B;IACG,0BAA0B;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAE1B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7D,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACpC,0BAA0B;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAE1B,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAElB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IAEX,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,iDAAiD;AACjD,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7D,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACpC,0BAA0B;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAE1B,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAElB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IAEX,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,iDAAiD;AACjD,QAAA,MAAM,kBAAkB,mCAGrB,uBAAuB,KAAG,WAwD5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -19,8 +19,8 @@ const ComponentWithLabel = ({ label, id, size, children, }) => {
|
|
|
19
19
|
"field-body",
|
|
20
20
|
label.horizontalFieldContainerClassName
|
|
21
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 }) })] }));
|
|
22
|
+
return (_jsxs("div", { className: "bbr-field 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
23
|
}
|
|
24
|
-
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), children] }));
|
|
24
|
+
return (_jsxs("div", { className: "bbr-field bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), children] }));
|
|
25
25
|
};
|
|
26
26
|
export default ComponentWithLabel;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseInputElementProps } from "../../../../types";
|
|
3
|
+
import "./style.scss";
|
|
2
4
|
/** Props of `InternalHint` */
|
|
3
|
-
|
|
4
|
-
/** @inheritdoc BaseInputElementProps.validationState */
|
|
5
|
-
validationState?: ValidationState;
|
|
6
|
-
/** @inheritdoc BaseInputElementProps.hint */
|
|
7
|
-
hint?: HintConfiguration;
|
|
8
|
-
}
|
|
5
|
+
declare type HintProps = Pick<BaseInputElementProps<any>, "validationState" | "hint">;
|
|
9
6
|
/** Hint component for internal use (as form input elements hints) */
|
|
10
7
|
declare const InternalHint: ({ validationState, hint, }: HintProps) => JSX.Element;
|
|
11
8
|
export default InternalHint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,qBAAqB,EAAqE,MAAM,YAAY,CAAC;AAGtH,OAAO,cAAc,CAAC;AAEtB,8BAA8B;AAC9B,aAAK,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,CAAC;AAE9E,qEAAqE;AACrE,QAAA,MAAM,YAAY,+BAEf,SAAS,KAAG,WAgDd,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import { ElementPosition, ElementSize, ValidationStatus } from "../../../../types";
|
|
4
4
|
import Icon from "../../../icon";
|
|
5
|
+
import "./style.scss";
|
|
5
6
|
/** Hint component for internal use (as form input elements hints) */
|
|
6
7
|
const InternalHint = ({ validationState, hint, }) => {
|
|
7
8
|
if (isNullOrUndefined(validationState) && isNullOrUndefined(hint)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAK1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import "../../../../common.scss";
|
|
4
3
|
import MultilineWithoutLabel from "../components/withoutLabel";
|
|
5
4
|
import MultilineWithLabel from "../components/withLabel";
|
|
6
5
|
/** Multiline textual input component */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { MultilineProps } from "../..";
|
|
2
3
|
/** Multiline textual input component with describing label */
|
|
3
|
-
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState,
|
|
4
|
+
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, name, size, style, label, placeholder, readonly, disabled, loading, fixed, rows, onBlur, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
4
5
|
export default MultilineWithLabel;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,6KAYrB,cAAc,KAAG,WAoDnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
7
|
import InternalHint from "../../../internal/hint";
|
|
8
8
|
/** Multiline textual input component with describing label */
|
|
9
|
-
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState,
|
|
9
|
+
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, rows, onBlur, className, title, data, hint, }) => {
|
|
10
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
11
|
const elClassName = getClassName([
|
|
14
12
|
className,
|
|
15
|
-
|
|
13
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
16
14
|
getStyleClassName(style, validationState),
|
|
17
15
|
"textarea",
|
|
18
16
|
fixed ? "has-fixed-size" : "",
|
|
@@ -24,6 +22,6 @@ const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, read
|
|
|
24
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
25
23
|
? undefined
|
|
26
24
|
: mapDataAttributes(data);
|
|
27
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
25
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, 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
26
|
};
|
|
29
27
|
export default MultilineWithLabel;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { MultilineProps } from "../..";
|
|
2
3
|
/** Multiline textual input component without describing label*/
|
|
3
4
|
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading, fixed, rows, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
@@ -1 +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,
|
|
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,kJAUxB,cAAc,KAAG,WAiDnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
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, }) => {
|
|
8
|
+
const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), placeholder, onBlur, size = ElementSize.Normal, style, loading = false, fixed = false, rows, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
10
|
-
const id = name ?? generateGuid();
|
|
11
10
|
const elClassName = getClassName([
|
|
12
11
|
className,
|
|
13
|
-
|
|
12
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
14
13
|
getStyleClassName(style, validationState),
|
|
15
14
|
"textarea",
|
|
16
15
|
fixed ? "has-fixed-size" : "",
|
|
@@ -23,6 +22,6 @@ const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, n
|
|
|
23
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
24
23
|
? undefined
|
|
25
24
|
: mapDataAttributes(data);
|
|
26
|
-
return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id:
|
|
25
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, onBlur: onBlur, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
27
26
|
};
|
|
28
27
|
export default MultilineWithoutLabel;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { NumberProps } from "../..";
|
|
2
3
|
/** Number component with label */
|
|
3
|
-
declare const NumberWithLabel: ({ onValueChange,
|
|
4
|
+
declare const NumberWithLabel: ({ onValueChange, defaultValue, validationState, name, label, placeholder, size, style, rounded, loading, readonly, disabled, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
|
|
4
5
|
export default NumberWithLabel;
|
|
5
6
|
//# 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":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,+
|
|
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,+KAWlB,WAAW,KAAG,WAuDhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|