@bodynarf/react.components 1.4.13 → 1.4.14
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/components/primitives/checkbox/checkbox.scss +7 -3
- package/components/primitives/checkbox/index.d.ts +6 -2
- package/components/primitives/checkbox/index.d.ts.map +1 -1
- package/components/primitives/checkbox/index.js +16 -1
- package/components/primitives/number/components/withLabel/index.d.ts +1 -0
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
.is-checkradio
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
.is-checkradio.m-check-radio {
|
|
2
|
+
padding: 0;
|
|
3
|
+
|
|
4
|
+
&[type="checkbox"].has-background-color.m-has-background-color:not(:checked) + label::before {
|
|
5
|
+
border-color: #dbdbdb !important;
|
|
6
|
+
background-color: transparent !important;
|
|
7
|
+
}
|
|
4
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import "./checkbox.scss";
|
|
3
2
|
import { BaseInputElementProps } from "../types";
|
|
4
3
|
export interface CheckBoxProps extends BaseInputElementProps<boolean> {
|
|
@@ -17,8 +16,13 @@ export interface CheckBoxProps extends BaseInputElementProps<boolean> {
|
|
|
17
16
|
* @example `{ style: InputColor.Info, hasBackgrounColor: true, fixBackgroundColor: true }` -
|
|
18
17
|
*/
|
|
19
18
|
fixBackgroundColor?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Display component with label as form element.
|
|
21
|
+
* Label will be placed at left
|
|
22
|
+
*/
|
|
23
|
+
isFormLabel?: boolean;
|
|
20
24
|
}
|
|
21
25
|
/** Boolean input component */
|
|
22
|
-
declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor }: CheckBoxProps) => JSX.Element;
|
|
26
|
+
declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, }: CheckBoxProps) => JSX.Element;
|
|
23
27
|
export default CheckBox;
|
|
24
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/index.tsx"],"names":[],"mappings":"AAIA,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,OAAO,CAAC;IACjE,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iCAAiC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;MAGE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;MAIE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,6JAMX,aAAa,KAAG,WAoFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
|
4
4
|
import "./checkbox.scss";
|
|
5
5
|
;
|
|
6
6
|
/** Boolean input component */
|
|
7
|
-
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor }) => {
|
|
7
|
+
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, }) => {
|
|
8
8
|
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
9
9
|
const id = name || generateGuid();
|
|
10
10
|
const className = getClassName([
|
|
@@ -18,6 +18,21 @@ const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded,
|
|
|
18
18
|
(block ?? false) ? "is-block" : "",
|
|
19
19
|
(withoutBorder ?? false) ? "has-no-border" : "",
|
|
20
20
|
]);
|
|
21
|
+
if (!isNullOrUndefined(label) && isFormLabel === true) {
|
|
22
|
+
const labelClassName = getClassName([
|
|
23
|
+
"label",
|
|
24
|
+
label.className
|
|
25
|
+
]);
|
|
26
|
+
const labelContainerClassName = getClassName([
|
|
27
|
+
"field-label",
|
|
28
|
+
label.horizontalContainerClassName
|
|
29
|
+
]);
|
|
30
|
+
const fieldContainerClassName = getClassName([
|
|
31
|
+
"field-body",
|
|
32
|
+
label.horizontalFieldContainerClassName
|
|
33
|
+
]);
|
|
34
|
+
return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("input", { type: "checkbox", name: id, id: id, disabled: disabled, onChange: onChecked, className: className, defaultChecked: defaultValue }), _jsx("label", { htmlFor: id })] }) })] }));
|
|
35
|
+
}
|
|
21
36
|
return (_jsxs("div", { className: "field", children: [_jsx("input", { type: "checkbox", name: id, id: id, disabled: disabled, onChange: onChecked, className: className, defaultChecked: defaultValue }), _jsx("label", { htmlFor: id, children: label?.caption })] }));
|
|
22
37
|
};
|
|
23
38
|
export default CheckBox;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { NumberProps } from "../..";
|
|
2
3
|
/** Number component with label */
|
|
3
4
|
declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }: NumberProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,sJAMlB,WAAW,KAAG,WAyGhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,sJAMlB,WAAW,KAAG,WAyGhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|