@bodynarf/react.components 1.10.1 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bodynarf-react.components-1.10.1.tgz +0 -0
- package/bodynarf-react.components-1.11.0.tgz +0 -0
- package/components/breadcrumbs/component/index.js +3 -3
- package/components/breadcrumbs/types.d.ts +7 -2
- package/components/breadcrumbs/types.d.ts.map +1 -1
- package/components/file/component/index.d.ts +6 -0
- package/components/file/component/index.d.ts.map +1 -0
- package/components/file/component/index.js +50 -0
- package/components/file/component/styles.scss +107 -0
- package/components/file/index.d.ts +3 -0
- package/components/file/index.d.ts.map +1 -0
- package/components/file/index.js +2 -0
- package/components/file/types.d.ts +27 -0
- package/components/file/types.d.ts.map +1 -0
- package/components/file/types.js +1 -0
- package/components/primitives/checkbox/component/index.d.ts +1 -1
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +9 -6
- package/components/primitives/checkbox/types.d.ts +1 -1
- package/components/primitives/checkbox/types.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.d.ts +1 -1
- package/components/primitives/color/components/picker/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.js +5 -5
- 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 +2 -2
- 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 -2
- package/components/primitives/date/component/index.d.ts +1 -1
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +2 -2
- package/components/primitives/internal/componentWithLabel/index.d.ts +4 -4
- package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.js +8 -4
- package/components/primitives/multiline/components/withLabel/index.d.ts +1 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withLabel/index.js +2 -2
- package/components/primitives/multiline/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withoutLabel/index.js +2 -2
- package/components/primitives/number/components/withLabel/index.d.ts +1 -1
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +2 -2
- package/components/primitives/number/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +2 -2
- package/components/primitives/password/components/withLabel/index.d.ts +1 -1
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +2 -2
- package/components/primitives/password/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +2 -2
- package/components/primitives/text/components/withLabel/index.d.ts +1 -1
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withLabel/index.js +2 -2
- package/components/primitives/text/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withoutLabel/index.js +2 -2
- package/components/search/component/index.d.ts +1 -1
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +4 -5
- package/components/search/types.d.ts +6 -2
- package/components/search/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types/baseInputElementProps.d.ts +6 -0
- package/types/baseInputElementProps.d.ts.map +1 -1
- package/types/labelConfiguration.d.ts +3 -2
- package/types/labelConfiguration.d.ts.map +1 -1
- package/bodynarf-react.components-1.10.0.tgz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -28,10 +28,10 @@ export default BreadCrumbs;
|
|
|
28
28
|
/** Template for single breadcrumb */
|
|
29
29
|
const BreadCrumbItem = ({ item, icon }) => {
|
|
30
30
|
if (isNullOrUndefined(icon)) {
|
|
31
|
-
return (_jsx("a", { href: item.path, "aria-current": item.active ? "page" : undefined, children: item.
|
|
31
|
+
return (_jsx("a", { href: item.path, "aria-current": item.active ? "page" : undefined, children: item.caption }));
|
|
32
32
|
}
|
|
33
33
|
if (icon?.position === ElementPosition.Right) {
|
|
34
|
-
return (_jsxs("a", { href: item.path, "aria-current": item.active ? "page" : undefined, children: [item.
|
|
34
|
+
return (_jsxs("a", { href: item.path, "aria-current": item.active ? "page" : undefined, children: [item.caption, _jsx(Icon, { ...icon })] }));
|
|
35
35
|
}
|
|
36
|
-
return (_jsxs("a", { href: item.path, "aria-current": item.active ? "page" : undefined, children: [_jsx(Icon, { ...icon }), item.
|
|
36
|
+
return (_jsxs("a", { href: item.path, "aria-current": item.active ? "page" : undefined, children: [_jsx(Icon, { ...icon }), item.caption] }));
|
|
37
37
|
};
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
import { BaseElementProps, ElementIcon, ElementPosition, ElementSize } from "../../types";
|
|
3
3
|
/** Breadcrumb item */
|
|
4
4
|
export interface BreadCrumb {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Displayed text
|
|
7
|
+
* @deprecated Use `caption` instead
|
|
8
|
+
*/
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Displayable caption */
|
|
11
|
+
caption: string;
|
|
7
12
|
/** Page address */
|
|
8
13
|
path: string;
|
|
9
14
|
/** Is current page. Will be not clickable */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumbs/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzF,sBAAsB;AACtB,MAAM,WAAW,UAAU;IACvB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumbs/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzF,sBAAsB;AACtB,MAAM,WAAW,UAAU;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAEhB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IAMb,6CAA6C;IAC7C,MAAM,EAAE,OAAO,CAAC;IAEhB,gCAAgC;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,uCAAuC;AACvC,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACtD,wBAAwB;IACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAEzB;;;;;;;;;;;;;;;MAeE;IACF,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,GAAG,CAAC,OAAO,CAAC;IAEnD,iBAAiB;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,CAAC;CACvD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./styles.scss";
|
|
2
|
+
import { FileUploadProps } from "..";
|
|
3
|
+
/** FileUpload textual input component */
|
|
4
|
+
declare const FileUpload: ({ onValueChange, placeholder, name, disabled, size, style, displayFileName, boxed, alignment, clearSelectionTitle, className, title, data, }: FileUploadProps) => JSX.Element;
|
|
5
|
+
export default FileUpload;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/file/component/index.tsx"],"names":[],"mappings":"AAQA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErC,yCAAyC;AACzC,QAAA,MAAM,UAAU,iJAWb,eAAe,KAAG,WA6GpB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
import { generateGuid, getClassName, isNullish, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize, ElementPosition } from "../../../types";
|
|
5
|
+
import { mapDataAttributes } from "../../../utils";
|
|
6
|
+
import Icon from "../../icon";
|
|
7
|
+
import "./styles.scss";
|
|
8
|
+
/** FileUpload textual input component */
|
|
9
|
+
const FileUpload = ({ onValueChange, placeholder, name = generateGuid(), disabled = false, size = ElementSize.Normal, style, displayFileName = true, boxed = false, alignment = ElementPosition.Left, clearSelectionTitle = "Remove file selection", className, title, data, }) => {
|
|
10
|
+
if (boxed && alignment === ElementPosition.Right) {
|
|
11
|
+
throw new Error("Boxed style cannot be used with Right alignment");
|
|
12
|
+
}
|
|
13
|
+
const [selectedFileName, setSelectedFileName] = useState(undefined);
|
|
14
|
+
const inputRef = useRef(null);
|
|
15
|
+
const onChange = useCallback((event) => {
|
|
16
|
+
const firstFile = event.target.files?.[0];
|
|
17
|
+
onValueChange(firstFile);
|
|
18
|
+
if (displayFileName && !isNullish(firstFile)) {
|
|
19
|
+
const fileName = firstFile.name;
|
|
20
|
+
setSelectedFileName(fileName);
|
|
21
|
+
}
|
|
22
|
+
}, [displayFileName, onValueChange]);
|
|
23
|
+
const onClearClick = useCallback(() => {
|
|
24
|
+
inputRef.current.value = "";
|
|
25
|
+
onValueChange(undefined);
|
|
26
|
+
setSelectedFileName(undefined);
|
|
27
|
+
}, [onValueChange]);
|
|
28
|
+
const containerClassName = getClassName([
|
|
29
|
+
"bbr-fileUpload",
|
|
30
|
+
"file",
|
|
31
|
+
displayFileName ? "has-name" : "",
|
|
32
|
+
alignment === ElementPosition.Right ? "is-right" : "",
|
|
33
|
+
boxed ? "is-boxed" : "",
|
|
34
|
+
isNullish(style) ? "" : `is-${style}`,
|
|
35
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
36
|
+
className,
|
|
37
|
+
]);
|
|
38
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
39
|
+
? undefined
|
|
40
|
+
: mapDataAttributes(data);
|
|
41
|
+
const shouldDisplayFileName = displayFileName && !isNullish(selectedFileName);
|
|
42
|
+
return (_jsxs("div", { className: containerClassName, children: [shouldDisplayFileName && alignment === ElementPosition.Right
|
|
43
|
+
&&
|
|
44
|
+
_jsx(Icon, { name: "x-lg", className: "file-clear", size: size, onClick: onClearClick, title: clearSelectionTitle }), _jsxs("label", { className: "file-label", children: [_jsx("input", { type: "file", className: "file-input", id: name, name: name, disabled: disabled, onChange: onChange, placeholder: placeholder, title: title, ...dataAttributes, ref: inputRef }), _jsxs("span", { className: "file-cta", children: [_jsx("span", { className: "file-icon", children: _jsx(Icon, { name: "upload", size: size }) }), _jsx("span", { className: "file-label", children: placeholder })] }), shouldDisplayFileName
|
|
45
|
+
&&
|
|
46
|
+
_jsx("span", { className: "file-name", title: selectedFileName, children: selectedFileName })] }), shouldDisplayFileName && alignment === ElementPosition.Left
|
|
47
|
+
&&
|
|
48
|
+
_jsx(Icon, { name: "x-lg", className: "file-clear", size: size, onClick: onClearClick, title: clearSelectionTitle })] }));
|
|
49
|
+
};
|
|
50
|
+
export default FileUpload;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
.bbr-fileUpload {
|
|
2
|
+
&.has-name {
|
|
3
|
+
.file-clear {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
z-index: 2;
|
|
8
|
+
|
|
9
|
+
&:hover {
|
|
10
|
+
color: #0d6efd;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&:not(.is-right) {
|
|
15
|
+
&.is-small {
|
|
16
|
+
.file-name {
|
|
17
|
+
padding-right: 1.5rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.file-clear {
|
|
21
|
+
margin-left: -1.25rem;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.is-medium {
|
|
26
|
+
.file-name {
|
|
27
|
+
padding-right: 2rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.file-clear {
|
|
31
|
+
margin-left: -1.75rem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.is-large {
|
|
36
|
+
.file-name {
|
|
37
|
+
padding-right: 2.75rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.file-clear {
|
|
41
|
+
margin-left: -2.5rem;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:not(.is-small):not(.is-medium):not(.is-large) {
|
|
46
|
+
.file-name {
|
|
47
|
+
padding-right: 1.75rem;
|
|
48
|
+
max-width: 17rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.file-clear {
|
|
52
|
+
margin-left: -1.5rem;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.is-right {
|
|
58
|
+
&.is-small {
|
|
59
|
+
.file-name {
|
|
60
|
+
padding-left: 1.5rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.file-clear {
|
|
64
|
+
margin-right: -1.25rem;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.is-medium {
|
|
69
|
+
.file-name {
|
|
70
|
+
padding-left: 2rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.file-clear {
|
|
74
|
+
margin-right: -1.75rem;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.is-large {
|
|
79
|
+
.file-name {
|
|
80
|
+
padding-left: 2.75rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.file-clear {
|
|
84
|
+
margin-right: -2.5rem;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:not(.is-small):not(.is-medium):not(.is-large) {
|
|
89
|
+
.file-name {
|
|
90
|
+
padding-left: 1.75rem;
|
|
91
|
+
max-width: 17rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.file-clear {
|
|
95
|
+
margin-right: -1.5rem;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.is-boxed {
|
|
101
|
+
.file-clear {
|
|
102
|
+
align-items: end;
|
|
103
|
+
padding-bottom: 0.75rem;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/file/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseElementProps, BaseInputElementProps, ElementFloatPosition } from "../../types";
|
|
2
|
+
/** File upload component props type */
|
|
3
|
+
export declare type FileUploadProps = BaseElementProps & Pick<BaseInputElementProps<File>, "onValueChange" | "disabled" | "size" | "style" | "name"> & {
|
|
4
|
+
/** Input element placeholder */
|
|
5
|
+
placeholder: string;
|
|
6
|
+
/**
|
|
7
|
+
* Position of a upload file
|
|
8
|
+
*
|
|
9
|
+
* ! NOTE: Right alignment cannot be used with boxed style
|
|
10
|
+
*/
|
|
11
|
+
alignment?: ElementFloatPosition;
|
|
12
|
+
/**
|
|
13
|
+
* Display file name after selection
|
|
14
|
+
*
|
|
15
|
+
* Default is `true`
|
|
16
|
+
*/
|
|
17
|
+
displayFileName?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Is boxed block
|
|
20
|
+
*
|
|
21
|
+
* ! NOTE: Cannot be used with Right alignment
|
|
22
|
+
*/
|
|
23
|
+
boxed?: boolean;
|
|
24
|
+
/** Title for clear button */
|
|
25
|
+
clearSelectionTitle?: string;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/file/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3F,uCAAuC;AACvC,oBAAY,eAAe,GAAG,gBAAgB,GAAG,IAAI,CACjD,qBAAqB,CAAC,IAAI,CAAC,EACzB,eAAe,GAAG,UAAU,GAC5B,MAAM,GAAG,OAAO,GAChB,MAAM,CACX,GAAG;IACA,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAEjC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,6BAA6B;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import "./style.scss";
|
|
3
3
|
import { CheckBoxProps } from "../..";
|
|
4
4
|
/** Boolean input component */
|
|
5
|
-
declare const CheckBox: ({ onValueChange, defaultValue, label, name, size, style, disabled, rounded, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, className,
|
|
5
|
+
declare const CheckBox: ({ onValueChange, defaultValue, label, name, size, style, disabled, rounded, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, className, data, }: CheckBoxProps) => JSX.Element;
|
|
6
6
|
export default CheckBox;
|
|
7
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,8KAWX,aAAa,KAAG,WAyFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { generateGuid, getClassName, isNullish, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../types";
|
|
5
5
|
import { mapDataAttributes } from "../../../../utils";
|
|
6
6
|
import ComponentWithLabel from "../../internal/componentWithLabel";
|
|
7
7
|
import "./style.scss";
|
|
8
8
|
/** Boolean input component */
|
|
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,
|
|
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, data, }) => {
|
|
10
10
|
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
11
11
|
const elClassName = getClassName([
|
|
12
12
|
"is-checkradio",
|
|
@@ -20,18 +20,21 @@ const CheckBox = ({ onValueChange, defaultValue, label, name = generateGuid(), s
|
|
|
20
20
|
block ? "is-block" : "",
|
|
21
21
|
withoutBorder ? "has-no-border" : "",
|
|
22
22
|
]);
|
|
23
|
-
const dataAttributes =
|
|
23
|
+
const dataAttributes = isNullish(data)
|
|
24
24
|
? undefined
|
|
25
25
|
: mapDataAttributes(data);
|
|
26
|
-
if (!
|
|
26
|
+
if (!isNullish(label) && isFormLabel) {
|
|
27
27
|
return (_jsxs(ComponentWithLabel, { id: name, label: {
|
|
28
28
|
...label,
|
|
29
29
|
horizontalContainerClassName: getClassName([label.horizontalContainerClassName, "p-0"]),
|
|
30
|
-
}, size: ElementSize.Normal, children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue,
|
|
30
|
+
}, size: ElementSize.Normal, children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, ...dataAttributes }), _jsx("label", { className: "is-empty", htmlFor: name })] }));
|
|
31
31
|
}
|
|
32
32
|
const labelClassName = isNullOrUndefined(label)
|
|
33
33
|
? "is-empty"
|
|
34
34
|
: undefined;
|
|
35
|
-
|
|
35
|
+
const labelDataAttributes = isNullish(label?.data)
|
|
36
|
+
? undefined
|
|
37
|
+
: mapDataAttributes(label.data);
|
|
38
|
+
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, ...dataAttributes }), _jsx("label", { htmlFor: name, className: labelClassName, title: label?.title, ...labelDataAttributes, children: label?.caption })] }));
|
|
36
39
|
};
|
|
37
40
|
export default CheckBox;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseInputElementProps } from "../../../types";
|
|
2
2
|
/** Checkbox component props type */
|
|
3
|
-
export interface CheckBoxProps extends Omit<BaseInputElementProps<boolean>, "readonly" | "validationState" | "loading" | "placeholder" | "hint"> {
|
|
3
|
+
export interface CheckBoxProps extends Omit<BaseInputElementProps<boolean>, "readonly" | "validationState" | "loading" | "placeholder" | "hint" | "title" | "autofocus"> {
|
|
4
4
|
/** Is full colored checkbox */
|
|
5
5
|
block?: boolean;
|
|
6
6
|
/** Remove the checkbox border */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACpE,UAAU,GAAG,iBAAiB,GAC9B,SAAS,GAAG,aAAa,GACzB,MAAM,GAAG,OAAO,GAChB,WAAW,CAChB;IACG,+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"}
|
|
@@ -15,6 +15,6 @@ export interface ColorPickerControlProps extends Omit<BaseInputElementProps<stri
|
|
|
15
15
|
previewConfig?: ColorPickerPreviewConfig;
|
|
16
16
|
}
|
|
17
17
|
/** Color picker container component */
|
|
18
|
-
declare const ColorPickerControl: ({ value, defaultValue, onValueChange, elementClassName, disabled, previewConfig, size, id, title, data, hint, validationState, }: ColorPickerControlProps) => JSX.Element;
|
|
18
|
+
declare const ColorPickerControl: ({ value, defaultValue, onValueChange, elementClassName, disabled, autoFocus, 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,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,
|
|
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,gJAQrB,uBAAuB,KAAG,WA2C5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -4,15 +4,15 @@ 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 = ({ value, defaultValue, onValueChange, elementClassName, disabled = false, previewConfig, size, id, title, data, hint, validationState, }) => {
|
|
7
|
+
const ColorPickerControl = ({ value, defaultValue, onValueChange, elementClassName, disabled = false, autoFocus = false, previewConfig, size, id, title, data, hint, validationState, }) => {
|
|
8
8
|
if (!isNullOrUndefined(previewConfig)) {
|
|
9
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,
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "control bbr-input", children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, ...data, title: title }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
12
12
|
};
|
|
13
13
|
export default ColorPickerControl;
|
|
14
14
|
/** Picker sub component with preview */
|
|
15
|
-
const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onValueChange, value, id, title, data, previewConfig, hint, validationState, }) => {
|
|
15
|
+
const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onValueChange, value, autoFocus = false, id, title, data, previewConfig, hint, validationState, }) => {
|
|
16
16
|
const classNames = getClassName([
|
|
17
17
|
"bbr-color-picker__preview",
|
|
18
18
|
"button",
|
|
@@ -30,7 +30,7 @@ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onV
|
|
|
30
30
|
previewConfig.position === ElementPosition.Left ? "ml-1" : "mr-1",
|
|
31
31
|
]);
|
|
32
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: {
|
|
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, autoFocus: autoFocus, 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
36
|
}, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
@@ -38,5 +38,5 @@ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onV
|
|
|
38
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("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 })] }));
|
|
41
|
+
}, children: value }), _jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, autoFocus: autoFocus, 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, onValueChange, validationState, disabled, rounded, size, label, hint, className, title, data, }: ColorPickerProps): JSX.Element;
|
|
4
|
+
declare function ColorPickerWithLabel({ preview, name, defaultValue, onValueChange, validationState, disabled, rounded, size, autoFocus, 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,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,
|
|
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,SAAiB,EACjB,KAAK,EAEL,IAAI,EACJ,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,gBAAgB,eAiDlB;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 = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size = ElementSize.Normal, label, hint, className, title, data, }) {
|
|
9
|
+
function ColorPickerWithLabel({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size = ElementSize.Normal, autoFocus = false, label, hint, className, title, data, }) {
|
|
10
10
|
const defaultColor = isNullOrUndefined(defaultValue)
|
|
11
11
|
? whiteHex
|
|
12
12
|
: rgbToHex(defaultValue);
|
|
@@ -20,6 +20,6 @@ function ColorPickerWithLabel({ preview, name = generateGuid(), defaultValue, on
|
|
|
20
20
|
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
21
21
|
"input",
|
|
22
22
|
]);
|
|
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 }) }));
|
|
23
|
+
return (_jsx(ComponentWithLabel, { id: name, size: size, label: label, children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, autoFocus: autoFocus, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, hint: hint, validationState: validationState, data: data, title: title }) }));
|
|
24
24
|
}
|
|
25
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, onValueChange, validationState, disabled, rounded, size, className, title, data, hint, }: ColorPickerProps): JSX.Element;
|
|
4
|
+
declare function ColorPickerWithoutLabel({ preview, name, defaultValue, onValueChange, validationState, disabled, rounded, size, autoFocus, 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,IAAqB,EACrB,YAAY,EAAE,aAAa,EAC3B,eAAe,EACf,QAAgB,EAAE,OAAe,EAAE,IAAI,
|
|
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,EACvC,SAAiB,EAEjB,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,GACP,EAAE,gBAAgB,eA8ClB;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 = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size, className, title, data, hint, }) {
|
|
6
|
+
function ColorPickerWithoutLabel({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size, autoFocus = false, className, title, data, hint, }) {
|
|
7
7
|
const defaultColor = isNullOrUndefined(defaultValue)
|
|
8
8
|
? whiteHex
|
|
9
9
|
: rgbToHex(defaultValue);
|
|
@@ -16,6 +16,6 @@ function ColorPickerWithoutLabel({ preview, name = generateGuid(), defaultValue,
|
|
|
16
16
|
isNullOrUndefined(size) ? "" : `is-${size}`,
|
|
17
17
|
"input",
|
|
18
18
|
]);
|
|
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 }) }));
|
|
19
|
+
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, autoFocus: autoFocus, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, data: data, title: title, hint: hint, validationState: validationState }) }));
|
|
20
20
|
}
|
|
21
21
|
export default ColorPickerWithoutLabel;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import "./style.scss";
|
|
3
3
|
import { DateProps } from "../..";
|
|
4
4
|
/** Date input component */
|
|
5
|
-
declare const DatePicker: ({ defaultValue, onValueChange, validationState, name, style, size, readonly, disabled, rounded, loading, label, onBlur, className, title, data, hint, }: DateProps) => JSX.Element;
|
|
5
|
+
declare const DatePicker: ({ defaultValue, onValueChange, validationState, name, style, size, readonly, disabled, rounded, loading, autoFocus, label, onBlur, className, title, data, hint, }: DateProps) => JSX.Element;
|
|
6
6
|
export default DatePicker;
|
|
7
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,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,
|
|
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,uKAWb,SAAS,KAAG,WA4Dd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -7,7 +7,7 @@ import ComponentWithLabel from "../../internal/componentWithLabel";
|
|
|
7
7
|
import InternalHint from "../../internal/hint";
|
|
8
8
|
import "./style.scss";
|
|
9
9
|
/** Date input component */
|
|
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, }) => {
|
|
10
|
+
const DatePicker = ({ defaultValue, onValueChange, validationState, name = generateGuid(), style, size = ElementSize.Normal, readonly = false, disabled = false, rounded = false, loading = false, autoFocus = 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]);
|
|
@@ -26,6 +26,6 @@ const DatePicker = ({ defaultValue, onValueChange, validationState, name = gener
|
|
|
26
26
|
const dataAttributes = isNullOrUndefined(data)
|
|
27
27
|
? undefined
|
|
28
28
|
: mapDataAttributes(data);
|
|
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 })] }));
|
|
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, autoFocus: autoFocus, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
30
30
|
};
|
|
31
31
|
export default DatePicker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { FC } from "react";
|
|
2
2
|
import { ElementSize, LabelConfiguration } from "../../../../types";
|
|
3
3
|
/** Form input component with label props */
|
|
4
|
-
export
|
|
4
|
+
export declare type ComponentWithLabelProps = {
|
|
5
5
|
/** Label configuration */
|
|
6
6
|
label: LabelConfiguration;
|
|
7
7
|
/** Component size */
|
|
@@ -10,8 +10,8 @@ export interface ComponentWithLabelProps {
|
|
|
10
10
|
id: string;
|
|
11
11
|
/** Node element with input element */
|
|
12
12
|
children: React.ReactNode;
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
/** Form input component with describing label */
|
|
15
|
-
declare const ComponentWithLabel:
|
|
15
|
+
declare const ComponentWithLabel: FC<ComponentWithLabelProps>;
|
|
16
16
|
export default ComponentWithLabel;
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG7D,4CAA4C;AAC5C,oBAAY,uBAAuB,GAAG;IAClC,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,CAAC;AAEF,iDAAiD;AACjD,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAqEnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
2
|
+
import { getClassName, getValueOrDefault, isNullish } from "@bodynarf/utils";
|
|
3
3
|
import { ElementSize } from "../../../../types";
|
|
4
|
+
import { mapDataAttributes } from "../../../../utils";
|
|
4
5
|
/** Form input component with describing label */
|
|
5
6
|
const ComponentWithLabel = ({ label, id, size, children, }) => {
|
|
6
7
|
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
7
8
|
const labelClassName = getClassName([
|
|
8
9
|
"label",
|
|
9
10
|
!label.horizontal ? elSizeClassName : "",
|
|
10
|
-
label.className
|
|
11
|
+
label.className,
|
|
11
12
|
]);
|
|
13
|
+
const dataAttributes = isNullish(label.data)
|
|
14
|
+
? undefined
|
|
15
|
+
: mapDataAttributes(label.data);
|
|
12
16
|
if (label.horizontal) {
|
|
13
17
|
const labelContainerClassName = getClassName([
|
|
14
18
|
"field-label",
|
|
@@ -19,8 +23,8 @@ const ComponentWithLabel = ({ label, id, size, children, }) => {
|
|
|
19
23
|
"field-body",
|
|
20
24
|
label.horizontalFieldContainerClassName
|
|
21
25
|
]);
|
|
22
|
-
return (_jsxs("div", { className: "bbr-field bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName,
|
|
26
|
+
return (_jsxs("div", { className: "bbr-field bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { htmlFor: id, className: labelClassName, title: label.title, ...dataAttributes, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsx("div", { className: "field", children: children }) })] }));
|
|
23
27
|
}
|
|
24
|
-
return (_jsxs("div", { className: "bbr-field bbr-input field", children: [_jsx("label", { className: labelClassName,
|
|
28
|
+
return (_jsxs("div", { className: "bbr-field bbr-input field", children: [_jsx("label", { htmlFor: id, className: labelClassName, title: label.title, ...dataAttributes, children: label.caption }), children] }));
|
|
25
29
|
};
|
|
26
30
|
export default ComponentWithLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MultilineProps } from "../..";
|
|
3
3
|
/** Multiline textual input component with describing label */
|
|
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
|
+
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, name, size, style, label, placeholder, readonly, disabled, loading, fixed, autoFocus, rows, onBlur, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
5
5
|
export default MultilineWithLabel;
|
|
6
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,wLAYrB,cAAc,KAAG,WAqDnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -6,7 +6,7 @@ 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, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, rows, onBlur, className, title, data, hint, }) => {
|
|
9
|
+
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, autoFocus = false, rows, onBlur, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
11
|
const elClassName = getClassName([
|
|
12
12
|
className,
|
|
@@ -22,6 +22,6 @@ const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, name
|
|
|
22
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
23
23
|
? undefined
|
|
24
24
|
: mapDataAttributes(data);
|
|
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 })] }));
|
|
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, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
26
26
|
};
|
|
27
27
|
export default MultilineWithLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MultilineProps } from "../..";
|
|
3
3
|
/** Multiline textual input component without describing label*/
|
|
4
|
-
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading, fixed, rows, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
4
|
+
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading, fixed, autoFocus, rows, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
5
5
|
export default MultilineWithoutLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,6JAUxB,cAAc,KAAG,WAkDnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|