@bodynarf/react.components 1.2.2 → 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.
- package/components/anchor/components/anchorWithIcon/index.js +2 -2
- package/components/button/components/buttonWithIcon/index.js +2 -2
- package/components/icon/index.js +1 -1
- package/components/primitives/checkbox/checkbox.scss +4 -0
- package/components/primitives/checkbox/index.d.ts +18 -0
- package/components/primitives/checkbox/index.d.ts.map +1 -0
- package/components/primitives/checkbox/index.js +21 -0
- package/components/primitives/index.d.ts +1 -0
- package/components/primitives/index.d.ts.map +1 -1
- package/components/primitives/index.js +1 -0
- package/components/types.d.ts +7 -3
- package/components/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +2 -0
|
@@ -10,7 +10,7 @@ export const AnchorWithIcon = ({ href, className, onClick, caption, title, targe
|
|
|
10
10
|
? `${icon.className} app-icon--left`
|
|
11
11
|
: `${icon.className} app-icon--right`;
|
|
12
12
|
if (iconPosition === 'left') {
|
|
13
|
-
return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [_jsx(Icon, { ...icon,
|
|
13
|
+
return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
|
|
14
14
|
}
|
|
15
|
-
return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [caption, _jsx(Icon, { ...icon,
|
|
15
|
+
return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
|
|
16
16
|
};
|
|
@@ -13,7 +13,7 @@ export const ButtonWithIcon = ({ className, disabled, onClick, caption, title, i
|
|
|
13
13
|
? `${className} button--icon-only`
|
|
14
14
|
: className;
|
|
15
15
|
if (iconPosition === 'left') {
|
|
16
|
-
return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: [_jsx(Icon, { ...icon,
|
|
16
|
+
return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
|
|
17
17
|
}
|
|
18
|
-
return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: [caption, _jsx(Icon, { ...icon,
|
|
18
|
+
return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
|
|
19
19
|
};
|
package/components/icon/index.js
CHANGED
|
@@ -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 +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"}
|
package/components/types.d.ts
CHANGED
|
@@ -17,10 +17,14 @@ export declare type IconPosition = 'left' | 'right';
|
|
|
17
17
|
/** Icon for component */
|
|
18
18
|
export declare type ElementIcon = {
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Icon name. Must be without `bi-`
|
|
21
|
+
* @example ["Arrow repeat", "arrow-repeat"]
|
|
22
|
+
* // Icon name to icon class name.
|
|
23
|
+
* // For class name check bootstrap icons website
|
|
22
24
|
*/
|
|
23
|
-
|
|
25
|
+
name: string;
|
|
26
|
+
/** Additional classname */
|
|
27
|
+
className?: string;
|
|
24
28
|
/** Icon size */
|
|
25
29
|
size?: ElementSize;
|
|
26
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oBAAY,gBAAgB,GAAG;IAC3B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8BAA8B;IAC9B,IAAI,CAAC,EAAE;QACH,8CAA8C;QAC9C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,4BAA4B;AAC5B,oBAAY,WAAW,GACjB,OAAO,GACP,QAAQ,CAAC,mBAAmB,GAC5B,OAAO,CAAC;AAEd,4BAA4B;AAC5B,oBAAY,YAAY,GAClB,MAAM,GACN,OAAO,CAAC;AAEd,0BAA0B;AAC1B,oBAAY,WAAW,GAAG;IACtB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oBAAY,gBAAgB,GAAG;IAC3B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8BAA8B;IAC9B,IAAI,CAAC,EAAE;QACH,8CAA8C;QAC9C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,4BAA4B;AAC5B,oBAAY,WAAW,GACjB,OAAO,GACP,QAAQ,CAAC,mBAAmB,GAC5B,OAAO,CAAC;AAEd,4BAA4B;AAC5B,oBAAY,YAAY,GAClB,MAAM,GACN,OAAO,CAAC;AAEd,0BAA0B;AAC1B,oBAAY,WAAW,GAAG;IACtB;;;;;MAKE;IACF,IAAI,EAAE,MAAM,CAAC;IAEb,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;;MAGE;IACF,QAAQ,CAAC,EAAE,YAAY,CAAC;CAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bodynarf/react.components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Artem",
|
|
6
6
|
"email": "bodynar@gmail.com"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "npx tsc",
|
|
25
|
-
"
|
|
25
|
+
"publish_package": "npx tsc && copy package.json dist && copy readme.md dist && cd dist && npm publish --access=public"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "^18.0.11",
|
package/readme.md
CHANGED
|
@@ -12,6 +12,7 @@ Small library with react components based on Bulma CSS framework <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
|