@bodynarf/react.components 1.2.4 → 1.3.3

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.
Files changed (28) hide show
  1. package/components/button/index.d.ts.map +1 -1
  2. package/components/button/index.js +2 -3
  3. package/components/primitives/checkbox/checkbox.scss +4 -0
  4. package/components/primitives/checkbox/index.d.ts +18 -0
  5. package/components/primitives/checkbox/index.d.ts.map +1 -0
  6. package/components/primitives/checkbox/index.js +21 -0
  7. package/components/primitives/date/index.d.ts +0 -1
  8. package/components/primitives/date/index.d.ts.map +1 -1
  9. package/components/primitives/date/index.js +16 -2
  10. package/components/primitives/index.d.ts +1 -0
  11. package/components/primitives/index.d.ts.map +1 -1
  12. package/components/primitives/index.js +1 -0
  13. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -1
  14. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -1
  15. package/components/primitives/multiline/components/multilineWithLabel/index.js +16 -2
  16. package/components/primitives/multiline/index.d.ts +0 -1
  17. package/components/primitives/multiline/index.d.ts.map +1 -1
  18. package/components/primitives/text/components/textWithLabel/index.d.ts +0 -1
  19. package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -1
  20. package/components/primitives/text/components/textWithLabel/index.js +16 -2
  21. package/components/primitives/text/index.d.ts +0 -1
  22. package/components/primitives/text/index.d.ts.map +1 -1
  23. package/components/primitives/types.d.ts +6 -0
  24. package/components/primitives/types.d.ts.map +1 -1
  25. package/components/search/index.d.ts.map +1 -1
  26. package/components/search/index.js +2 -4
  27. package/package.json +1 -1
  28. package/readme.md +19 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.tsx"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;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AAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAgC9D"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isNullOrEmpty, isStringEmpty, isNullOrUndefined, getClassName } from '@bodynarf/utils';
2
+ import { isNullOrEmpty, isNullOrUndefined, getClassName } from '@bodynarf/utils';
3
3
  import './button.scss';
4
4
  import { ButtonWithIcon } from './components/buttonWithIcon';
5
5
  import { SimpleButton } from './components/simpleButton';
@@ -8,8 +8,7 @@ import { SimpleButton } from './components/simpleButton';
8
8
  * @throws Caption is not defined and icon configuration is not defined at the same time
9
9
  */
10
10
  export default function Button(props) {
11
- if ((isNullOrEmpty(props.caption))
12
- && (isNullOrUndefined(props.icon) || isStringEmpty(props.icon?.className))) {
11
+ if (isNullOrEmpty(props.caption) && isNullOrUndefined(props.icon)) {
13
12
  throw new Error("No button content provided.");
14
13
  }
15
14
  const className = getClassName([
@@ -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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BaseInputElementProps, InputLabel } from '../types';
3
2
  /** Date input conponent props type */
4
3
  export declare type DateProps = Omit<BaseInputElementProps<Date | undefined>, 'placeholder'> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7D,sCAAsC;AACtC,oBAAY,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC,GAAG;IACnF,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;CACrB,CAAA;AAED,2BAA2B;AAC3B,QAAA,MAAM,UAAU,UAAW,SAAS,KAAG,WAqFtC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7D,sCAAsC;AACtC,oBAAY,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC,GAAG;IACnF,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;CACrB,CAAA;AAED,2BAA2B;AAC3B,QAAA,MAAM,UAAU,UAAW,SAAS,KAAG,WAsGtC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -23,9 +23,23 @@ const DatePicker = (props) => {
23
23
  ]);
24
24
  const label = props.label;
25
25
  const defaultValue = props.defaultValue?.toISOString().split("T")[0];
26
+ const labelClassName = getClassName([
27
+ "label",
28
+ label.horizontal !== true ? size : "",
29
+ label.className
30
+ ]);
26
31
  if (label.horizontal === true) {
27
- return (_jsxs("div", { className: "app-input field is-horizontal", children: [_jsx("div", { className: `field-label ${size}`, children: _jsx("label", { className: "label", htmlFor: id, children: label.caption }) }), _jsx("div", { className: "field-body", children: _jsx("div", { className: "field", children: _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: className, readOnly: props.readonly, disabled: props.disabled, defaultValue: defaultValue, onChange: onValueChange, name: id, id: id }) }) }) })] }));
32
+ const labelContainerClassName = getClassName([
33
+ "field-label",
34
+ size,
35
+ label.horizontalContainerClassName
36
+ ]);
37
+ const fieldContainerClassName = getClassName([
38
+ "field-body",
39
+ label.horizontalFieldContainerClassName
40
+ ]);
41
+ return (_jsxs("div", { className: "app-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: _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: className, readOnly: props.readonly, disabled: props.disabled, defaultValue: defaultValue, onChange: onValueChange, name: id, id: id }) }) }) })] }));
28
42
  }
29
- return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: `label ${size}`, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: className, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue?.toLocaleDateString(), onChange: onValueChange, name: id, id: id }) })] }));
43
+ return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: className, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue?.toLocaleDateString(), onChange: onValueChange, name: id, id: id }) })] }));
30
44
  };
31
45
  export default DatePicker;
@@ -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';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MultilineProps } from '../..';
3
2
  /** Multiline textual input component with describing label */
4
3
  declare const MultilineWithLabel: (props: MultilineProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,UAAW,cAAc,KAAG,WAkFnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,UAAW,cAAc,KAAG,WAmGnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -21,9 +21,23 @@ const MultilineWithLabel = (props) => {
21
21
  (props.style || 'default') === 'default' ? '' : `is-${props.style}`
22
22
  ]);
23
23
  const label = props.label;
24
+ const labelClassName = getClassName([
25
+ "label",
26
+ label.horizontal !== true ? size : "",
27
+ label.className
28
+ ]);
24
29
  if (label.horizontal === true) {
25
- return (_jsxs("div", { className: "app-input field is-horizontal", children: [_jsx("div", { className: `field-label ${size}`, children: _jsx("label", { className: "label", htmlFor: id, children: label.caption }) }), _jsx("div", { className: "field-body", children: _jsx("div", { className: "field", children: _jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: className, placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id, rows: props.rows }) }) }) })] }));
30
+ const labelContainerClassName = getClassName([
31
+ "field-label",
32
+ size,
33
+ label.horizontalContainerClassName
34
+ ]);
35
+ const fieldContainerClassName = getClassName([
36
+ "field-body",
37
+ label.horizontalFieldContainerClassName
38
+ ]);
39
+ return (_jsxs("div", { className: "app-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: _jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: className, placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id, rows: props.rows }) }) }) })] }));
26
40
  }
27
- return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: `label ${size}`, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: className, placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id, rows: props.rows }) })] }));
41
+ return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: className, placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id, rows: props.rows }) })] }));
28
42
  };
29
43
  export default MultilineWithLabel;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BaseInputElementProps } from '../types';
3
2
  /** Multiline textual input conponent props type */
4
3
  export declare type MultilineProps = BaseInputElementProps<string> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,mDAAmD;AACnD,oBAAY,cAAc,GAAG,qBAAqB,CAAC,MAAM,CAAC,GAAG;IACzD,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAQ1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,mDAAmD;AACnD,oBAAY,cAAc,GAAG,qBAAqB,CAAC,MAAM,CAAC,GAAG;IACzD,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAQ1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TextProps } from '../..';
3
2
  /** Textual input with describing label */
4
3
  declare const TextWithLabel: (props: TextProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,UAAW,SAAS,KAAG,WAiFzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,UAAW,SAAS,KAAG,WAkGzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -20,9 +20,23 @@ const TextWithLabel = (props) => {
20
20
  (props.style || 'default') === 'default' ? '' : `is-${props.style}`
21
21
  ]);
22
22
  const label = props.label;
23
+ const labelClassName = getClassName([
24
+ "label",
25
+ label.horizontal !== true ? size : "",
26
+ label.className
27
+ ]);
23
28
  if (label.horizontal === true) {
24
- return (_jsxs("div", { className: "app-input field is-horizontal", children: [_jsx("div", { className: `field-label ${size}`, children: _jsx("label", { className: "label", htmlFor: id, children: label.caption }) }), _jsx("div", { className: "field-body", children: _jsx("div", { className: "field", children: _jsx("div", { className: inputContainerClassName, children: _jsx("input", { className: className, type: "text", placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id }) }) }) })] }));
29
+ const labelContainerClassName = getClassName([
30
+ "field-label",
31
+ size,
32
+ label.horizontalContainerClassName
33
+ ]);
34
+ const fieldContainerClassName = getClassName([
35
+ "field-body",
36
+ label.horizontalFieldContainerClassName
37
+ ]);
38
+ return (_jsxs("div", { className: "app-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: _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", className: className, placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id }) }) }) })] }));
25
39
  }
26
- return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: `label ${size}`, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { className: className, type: "text", placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id }) })] }));
40
+ return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", className: className, placeholder: props.placeholder, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue, onChange: onValueChange, name: id, id: id }) })] }));
27
41
  };
28
42
  export default TextWithLabel;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BaseInputElementProps } from '../types';
3
2
  /** Text input conponent props type */
4
3
  export declare type TextProps = BaseInputElementProps<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,sCAAsC;AACtC,oBAAY,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAEtD,8BAA8B;AAC9B,QAAA,MAAM,IAAI,UAAW,SAAS,KAAG,WAOhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,sCAAsC;AACtC,oBAAY,SAAS,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAEtD,8BAA8B;AAC9B,QAAA,MAAM,IAAI,UAAW,SAAS,KAAG,WAOhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -30,6 +30,12 @@ export declare type InputLabel = {
30
30
  caption: string;
31
31
  /** Should component be on same line with label */
32
32
  horizontal?: boolean;
33
+ /** Additional class names */
34
+ className?: string;
35
+ /** Class name for label parent container in horizontal mode */
36
+ horizontalContainerClassName?: string;
37
+ /** Class name for input parent container in horizontal mode */
38
+ horizontalFieldContainerClassName?: string;
33
39
  };
34
40
  /** Input component size variety */
35
41
  export declare type InputSize = 'small' | 'normal' | 'medium' | 'large';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,2CAA2C;AAC3C,oBAAY,qBAAqB,CAAC,MAAM,IAAI,gBAAgB,GAAG;IAC3D,8EAA8E;IAC9E,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB;IACrB,IAAI,CAAC,EAAE,S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;CACvB,CAAC;AAEF,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA4E9D"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from 'react';
3
- import { generateGuid, getClassName, isNullOrUndefined } from '@bodynarf/utils';
3
+ import { generateGuid, getClassName } from '@bodynarf/utils';
4
4
  import './search.scss';
5
5
  import Button from '../button';
6
6
  /** Search component */
@@ -11,9 +11,7 @@ export default function Search(props) {
11
11
  const onChange = useCallback((event) => {
12
12
  const elementValue = event.target.value;
13
13
  if (searchType === 'byTyping') {
14
- const minCharsToSearch = isNullOrUndefined(props.minCharsToSearch)
15
- ? 3
16
- : props.minCharsToSearch;
14
+ const minCharsToSearch = props.minCharsToSearch || 3;
17
15
  if (elementValue.length >= minCharsToSearch) {
18
16
  props.onSearch(elementValue);
19
17
  }
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.3",
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,9 +25,27 @@ 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)
27
29
 
28
30
  ### Complex components
29
31
  Complex components is set of components built via combining simple components or represent complex logical component
30
32
  - **Search** - Search bar with optional button to perform search
31
33
  - **Paginator** - Pagination elements to navigate through paged list
34
+ Example:
35
+ ```tsx
36
+ const [{ currentPage, pagesCount, onPageChange }, paginate] = usePagination(items.length, ITEMS_PER_PAGE);
37
+ const pageItems = useMemo(() => paginate(items), [paginate, items]);
38
+
39
+ // ...
40
+
41
+ <Paginator
42
+ count={pagesCount}
43
+ currentPage={currentPage}
44
+ onPageChange={onPageChange}
45
+ />
46
+ ```
32
47
 
48
+ ### Hooks
49
+
50
+ - **useComponentOutsideClick** - Attach watcher for mouse clicks and emmit event when click was outside of component
51
+ - **usePagination** - Create a pagination config to easily manipulate with Paginator component