@bodynarf/react.components 1.2.4 → 1.3.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.
@@ -0,0 +1,4 @@
1
+ .is-checkradio[type="checkbox"].has-background-color.m-has-background-color:not(:checked) + label::before {
2
+ border-color: #dbdbdb !important;
3
+ background-color: transparent !important;
4
+ }
@@ -0,0 +1,18 @@
1
+ import './checkbox.scss';
2
+ import { BaseInputElementProps } from "../types";
3
+ export declare type CheckBoxProps = BaseInputElementProps<boolean> & {
4
+ /** Is full colored checkbox */
5
+ block?: boolean;
6
+ /** Remove the checkbox border */
7
+ withoutBorder?: boolean;
8
+ /** Checkbox has background color */
9
+ hasBackgroundColor?: boolean;
10
+ /**
11
+ * Set unchecked background as transparent.
12
+ * Only used with `hasBackgroundColor`
13
+ */
14
+ fixBackgroundColor?: boolean;
15
+ };
16
+ declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor }: CheckBoxProps) => JSX.Element;
17
+ export default CheckBox;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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,oBAAY,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,GAAG;IACzD,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iCAAiC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,oCAAoC;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;MAGE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,QAAQ,+IAKX,aAAa,KAAG,WAsClB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
+ import './checkbox.scss';
5
+ const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor }) => {
6
+ const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
7
+ const id = name || generateGuid();
8
+ const className = getClassName([
9
+ "m-check-radio",
10
+ "is-checkradio",
11
+ hasBackgroundColor == true ? "has-background-color" : "",
12
+ fixBackgroundColor === true && hasBackgroundColor == true ? "m-has-background-color" : "",
13
+ isNullOrUndefined(style) ? "" : size === 'normal' ? "" : `is-${size}`,
14
+ rounded === true ? "is-circle" : "",
15
+ isNullOrUndefined(style) ? "" : `is-${style}`,
16
+ block === true ? "is-block" : "",
17
+ withoutBorder === true ? "has-no-border" : "",
18
+ ]);
19
+ 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 })] }));
20
+ };
21
+ export default CheckBox;
@@ -1,5 +1,6 @@
1
1
  export * from './date';
2
2
  export * from './multiline';
3
3
  export * from './text';
4
+ export * from './checkbox';
4
5
  export * from './types';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './date';
2
2
  export * from './multiline';
3
3
  export * from './text';
4
+ export * from './checkbox';
4
5
  export * from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodynarf/react.components",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
4
4
  "author": {
5
5
  "name": "Artem",
6
6
  "email": "bodynar@gmail.com"
package/readme.md CHANGED
@@ -12,6 +12,7 @@ Small library with react components based on Bulma CSS framework&nbsp; <a href="
12
12
  2. Install [Bulma](https://bulma.io/)
13
13
  3. Make sure you imported bulma styles in parent container
14
14
  4. *(Optional)* To use **Icon** component - install [Bootstrap Icons](https://icons.getbootstrap.com/) and make sure you imported these styles in parent container
15
+ 5. *(Optional)* To use **Checkbox** component - install [bulma-checkradio](https://www.npmjs.com/package/bulma-checkradio) and make sure you imported these styles in parent container
15
16
 
16
17
  ## Description
17
18
  ### Simple components
@@ -24,6 +25,7 @@ Simple react components based on html elements.
24
25
  - **Button**
25
26
  - **Icon** - *see p.4 of installation*
26
27
  - **Dropdown** - custom dropdown component, based on html div elements & css. Allows to use icon in elements
28
+ - **Checkbox** - (*see p.5 of installation*) Checkbox component based on [bulma-checkradio](https://wikiki.github.io/form/checkradio/1)
27
29
 
28
30
  ### Complex components
29
31
  Complex components is set of components built via combining simple components or represent complex logical component