@bodynarf/react.components 1.7.94 → 1.7.96

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 (67) hide show
  1. package/components/accordion/component/index.d.ts +0 -1
  2. package/components/accordion/component/index.d.ts.map +1 -1
  3. package/components/accordion/component/index.js +5 -5
  4. package/components/anchor/types.d.ts +1 -11
  5. package/components/anchor/types.d.ts.map +1 -1
  6. package/components/button/component/index.d.ts.map +1 -1
  7. package/components/button/component/index.js +6 -5
  8. package/components/button/types.d.ts +2 -1
  9. package/components/button/types.d.ts.map +1 -1
  10. package/components/dropdown/component/index.d.ts +1 -0
  11. package/components/dropdown/component/index.d.ts.map +1 -1
  12. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  13. package/components/dropdown/components/compact/index.js +7 -7
  14. package/components/dropdown/components/withLabel/index.d.ts +1 -2
  15. package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
  16. package/components/dropdown/components/withLabel/index.js +6 -6
  17. package/components/paginator/component/index.d.ts +1 -1
  18. package/components/paginator/component/index.d.ts.map +1 -1
  19. package/components/paginator/component/index.js +3 -3
  20. package/components/primitives/checkbox/component/index.d.ts +1 -2
  21. package/components/primitives/checkbox/component/index.d.ts.map +1 -1
  22. package/components/primitives/checkbox/component/index.js +7 -7
  23. package/components/primitives/checkbox/types.d.ts +1 -1
  24. package/components/primitives/checkbox/types.d.ts.map +1 -1
  25. package/components/primitives/color/component/index.d.ts +1 -0
  26. package/components/primitives/color/component/index.d.ts.map +1 -1
  27. package/components/primitives/color/components/withLabel/index.d.ts +1 -1
  28. package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
  29. package/components/primitives/color/components/withLabel/index.js +6 -5
  30. package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
  31. package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
  32. package/components/primitives/color/components/withoutLabel/index.js +6 -5
  33. package/components/primitives/color/types.d.ts +3 -15
  34. package/components/primitives/color/types.d.ts.map +1 -1
  35. package/components/primitives/date/component/index.js +3 -3
  36. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -1
  37. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -1
  38. package/components/primitives/multiline/components/multilineWithLabel/index.js +4 -4
  39. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +0 -1
  40. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +1 -1
  41. package/components/primitives/multiline/components/multilineWithoutLabel/index.js +4 -4
  42. package/components/primitives/number/components/withLabel/index.d.ts +0 -1
  43. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  44. package/components/primitives/number/components/withLabel/index.js +5 -5
  45. package/components/primitives/number/components/withoutLabel/index.d.ts +0 -1
  46. package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
  47. package/components/primitives/number/components/withoutLabel/index.js +4 -4
  48. package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
  49. package/components/primitives/password/components/withLabel/index.js +3 -3
  50. package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
  51. package/components/primitives/password/components/withoutLabel/index.js +3 -3
  52. package/components/primitives/password/types.d.ts +2 -2
  53. package/components/primitives/password/types.d.ts.map +1 -1
  54. package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -1
  55. package/components/primitives/text/components/textWithLabel/index.js +3 -3
  56. package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +1 -1
  57. package/components/primitives/text/components/textWithoutLabel/index.js +3 -3
  58. package/components/search/component/index.d.ts.map +1 -1
  59. package/components/search/component/index.js +3 -3
  60. package/components/tabs/component/index.d.ts +0 -1
  61. package/components/tabs/component/index.d.ts.map +1 -1
  62. package/components/tabs/component/index.js +5 -5
  63. package/components/tag/component/index.d.ts.map +1 -1
  64. package/components/tag/component/index.js +3 -5
  65. package/package.json +1 -1
  66. package/readme.md +17 -11
  67. package/tsconfig.tsbuildinfo +1 -1
@@ -4,22 +4,22 @@ import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../..";
5
5
  import { getValidationValues } from "../../../../../utils";
6
6
  /** Multiline textual input component without describing label*/
7
- const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded, loading, fixed, rows, }) => {
7
+ const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded = false, loading = false, fixed = false, rows, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
9
9
  const id = name || generateGuid();
10
10
  const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
11
11
  const elClassName = getClassName([
12
12
  className,
13
13
  "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
14
- rounded === true ? "is-rounded" : "",
14
+ rounded ? "is-rounded" : "",
15
15
  styleClassName,
16
16
  "textarea",
17
- fixed === true ? "has-fixed-size" : "",
17
+ fixed ? "has-fixed-size" : "",
18
18
  ]);
19
19
  const inputContainerClassName = getClassName([
20
20
  "control",
21
21
  "bbr-input",
22
- loading === true ? "is-loading" : "",
22
+ loading ? "is-loading" : "",
23
23
  ]);
24
24
  return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: elClassName, placeholder: placeholder, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, id: id, name: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
25
25
  _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { NumberProps } from "../../../number";
3
2
  /** Number component with label */
4
3
  declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, step, }: NumberProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,kCAAkC;AAClC,QAAA,MAAM,eAAe,4JAOlB,WAAW,KAAG,WA2GhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,kCAAkC;AAClC,QAAA,MAAM,eAAe,4JAOlB,WAAW,KAAG,WA2GhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -4,7 +4,7 @@ import { generateGuid, getClassName, getValueOrDefault, isStringEmpty } from "@b
4
4
  import { ElementSize } from "../../../..";
5
5
  import { getValidationValues } from "../../../../../utils";
6
6
  /** Number component with label */
7
- const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, step, }) => {
7
+ const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded = false, loading = false, label, placeholder, onBlur, step = 1, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value) ? undefined : +event.target.value), [onValueChange]);
9
9
  const id = name || generateGuid();
10
10
  const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
@@ -12,13 +12,13 @@ const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, vali
12
12
  const elClassName = getClassName([
13
13
  className,
14
14
  elSizeClassName,
15
- rounded === true ? "is-rounded" : "",
15
+ rounded ? "is-rounded" : "",
16
16
  styleClassName,
17
17
  "input",
18
18
  ]);
19
19
  const inputContainerClassName = getClassName([
20
20
  "control",
21
- loading === true ? "is-loading" : "",
21
+ loading ? "is-loading" : "",
22
22
  ]);
23
23
  const labelClassName = getClassName([
24
24
  "label",
@@ -35,10 +35,10 @@ const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, vali
35
35
  "field-body",
36
36
  label.horizontalFieldContainerClassName
37
37
  ]);
38
- return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, step: step ?? 1 }) }), isValidationDefined && validationMessages.length > 0 &&
38
+ return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, step: step }) }), isValidationDefined && validationMessages.length > 0 &&
39
39
  _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
40
40
  }
41
- return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, step: step ?? 1 }) }), isValidationDefined && validationMessages.length > 0 &&
41
+ return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, step: step }) }), isValidationDefined && validationMessages.length > 0 &&
42
42
  _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
43
43
  };
44
44
  export default NumberWithLabel;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { NumberProps } from "../../../number";
3
2
  /** Number component without label */
4
3
  declare const NumberWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, step, }: NumberProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,qJAOrB,WAAW,KAAG,WA8ChB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,qJAOrB,WAAW,KAAG,WA8ChB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -4,23 +4,23 @@ import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../..";
5
5
  import { getValidationValues } from "../../../../../utils";
6
6
  /** Number component without label */
7
- const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, step, }) => {
7
+ const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded = false, loading = false, placeholder, onBlur, step = 1, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
9
9
  const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
10
10
  const elClassName = getClassName([
11
11
  className,
12
12
  "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
13
- rounded === true ? "is-rounded" : "",
13
+ rounded ? "is-rounded" : "",
14
14
  styleClassName,
15
15
  "input",
16
16
  ]);
17
17
  const containerClassName = getClassName([
18
18
  "control",
19
19
  "bbr-input",
20
- loading === true ? "is-loading" : "",
20
+ loading ? "is-loading" : "",
21
21
  ]);
22
22
  const id = name || generateGuid();
23
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, step: step ?? 1 }) }), isValidationDefined && validationMessages.length > 0 &&
23
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, step: step }) }), isValidationDefined && validationMessages.length > 0 &&
24
24
  _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
25
25
  };
26
26
  export default NumberWithoutLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,QAAA,MAAM,iBAAiB,uIAMpB,aAAa,KAAG,WAgIlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,QAAA,MAAM,iBAAiB,uIAOpB,aAAa,KAAG,WAgIlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -4,7 +4,7 @@ import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
4
4
  import { getValidationValues } from "../../../../../utils";
5
5
  import { ElementSize } from "../../../..";
6
6
  import Icon from "../../../../icon";
7
- const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }) => {
7
+ const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded = false, loading = false, label, placeholder, canShowPassword = false, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
9
9
  const [contentIsHidden, setContentIsHidden] = useState(true);
10
10
  const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
@@ -14,14 +14,14 @@ const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, cla
14
14
  const elClassName = getClassName([
15
15
  className,
16
16
  elSizeClassName,
17
- rounded === true ? "is-rounded" : "",
17
+ rounded ? "is-rounded" : "",
18
18
  styleClassName,
19
19
  "bbr-password",
20
20
  "input",
21
21
  ]);
22
22
  const inputContainerClassName = getClassName([
23
23
  "control",
24
- loading === true ? "is-loading" : "",
24
+ loading ? "is-loading" : "",
25
25
  canShowPassword ? "has-icons-right" : "",
26
26
  "bbr-password__wrapper",
27
27
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,QAAA,MAAM,oBAAoB,gIAMvB,aAAa,KAAG,WA4DlB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,QAAA,MAAM,oBAAoB,gIAOvB,aAAa,KAAG,WA4DlB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -4,7 +4,7 @@ import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../..";
5
5
  import { getValidationValues } from "../../../../../utils";
6
6
  import Icon from "../../../../icon";
7
- const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }) => {
7
+ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded = false, loading = false, placeholder, canShowPassword = false, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
9
9
  const [contentIsHidden, setContentIsHidden] = useState(true);
10
10
  const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
@@ -14,7 +14,7 @@ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name,
14
14
  const elClassName = getClassName([
15
15
  className,
16
16
  elSizeClassName,
17
- rounded === true ? "is-rounded" : "",
17
+ rounded ? "is-rounded" : "",
18
18
  styleClassName,
19
19
  "bbr-password",
20
20
  "input",
@@ -22,7 +22,7 @@ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name,
22
22
  const containerClassName = getClassName([
23
23
  "control",
24
24
  "bbr-input",
25
- loading === true ? "is-loading" : "",
25
+ loading ? "is-loading" : "",
26
26
  canShowPassword ? "has-icons-right" : "",
27
27
  "bbr-password__wrapper",
28
28
  ]);
@@ -2,9 +2,9 @@ import { BaseInputElementProps } from "../..";
2
2
  /** Password component props type */
3
3
  export interface PasswordProps extends Omit<BaseInputElementProps<string>, "defaultValue" | "readonly"> {
4
4
  /**
5
- * Is icon "Show password" visible.
5
+ * Is clickable icon "Show password" visible.
6
6
  * Will show password on click
7
7
  */
8
- canShowPassword: boolean;
8
+ canShowPassword?: boolean;
9
9
  }
10
10
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACnG;;;MAGE;IACF,eAAe,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACnG;;;MAGE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,0CAA0C;AAC1C,QAAA,MAAM,aAAa,sJAMhB,SAAS,KAAG,WAwGd,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,0CAA0C;AAC1C,QAAA,MAAM,aAAa,sJAOhB,SAAS,KAAG,WAwGd,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -4,7 +4,7 @@ import { generateGuid, getClassName, getValueOrDefault, } from "@bodynarf/utils"
4
4
  import { ElementSize } from "../../../..";
5
5
  import { getValidationValues } from "../../../../../utils";
6
6
  /** Textual input with describing label */
7
- const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }) => {
7
+ const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded = false, loading = false, label, placeholder, onBlur, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
9
9
  const id = name || generateGuid();
10
10
  const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
@@ -12,13 +12,13 @@ const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, valida
12
12
  const elClassName = getClassName([
13
13
  className,
14
14
  elSizeClassName,
15
- rounded === true ? "is-rounded" : "",
15
+ rounded ? "is-rounded" : "",
16
16
  styleClassName,
17
17
  "input",
18
18
  ]);
19
19
  const inputContainerClassName = getClassName([
20
20
  "control",
21
- loading === true ? "is-loading" : "",
21
+ loading ? "is-loading" : "",
22
22
  ]);
23
23
  const labelClassName = getClassName([
24
24
  "label",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithoutLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,+IAMnB,SAAS,KAAG,WA6Cd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/textWithoutLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,+IAOnB,SAAS,KAAG,WA6Cd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -4,20 +4,20 @@ import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../..";
5
5
  import { getValidationValues } from "../../../../../utils";
6
6
  /** Textual input without describing label */
7
- const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }) => {
7
+ const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded = false, loading = false, placeholder, onBlur, }) => {
8
8
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
9
9
  const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
10
10
  const elClassName = getClassName([
11
11
  className,
12
12
  "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
13
- rounded === true ? "is-rounded" : "",
13
+ rounded ? "is-rounded" : "",
14
14
  styleClassName,
15
15
  "input",
16
16
  ]);
17
17
  const containerClassName = getClassName([
18
18
  "control",
19
19
  "bbr-input",
20
- loading === true ? "is-loading" : "",
20
+ loading ? "is-loading" : "",
21
21
  ]);
22
22
  const id = name || generateGuid();
23
23
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { className: elClassName, type: "text", placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,UAAU,EAAE,QAAQ,EAAE,OAAO,EAC7B,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GACrC,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAyE3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,UAAU,EAAE,QAAQ,EAAE,OAAO,EAC7B,IAAI,EAAE,YAAY,EAClB,IAAI,EACJ,SAAiB,EAAE,OAAe,EAAE,QAAQ,GAC/C,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAyE3B"}
@@ -4,7 +4,7 @@ import { generateGuid, getClassName } from "@bodynarf/utils";
4
4
  import "./style.scss";
5
5
  import Button from "../../button";
6
6
  /** Search component */
7
- export default function Search({ searchType, onSearch, caption, name, defaultValue, size, isLoading, rounded, disabled, }) {
7
+ export default function Search({ searchType, onSearch, caption, name, defaultValue, size, isLoading = false, rounded = false, disabled, }) {
8
8
  const [elementName] = useState(name || generateGuid());
9
9
  const [searchValue, setSearchValue] = useState(defaultValue || "");
10
10
  const onChange = useCallback((event) => {
@@ -19,14 +19,14 @@ export default function Search({ searchType, onSearch, caption, name, defaultVal
19
19
  "bbr-search",
20
20
  "control",
21
21
  `is-${(size || "normal")}`,
22
- isLoading === true ? "is-loading" : "",
22
+ isLoading ? "is-loading" : "",
23
23
  searchType === "byButton" ? "is-expanded" : "",
24
24
  ]);
25
25
  const inputClassName = getClassName([
26
26
  "input",
27
27
  "is-unselectable",
28
28
  `is-${(size || "normal")}`,
29
- rounded === true ? "is-rounded" : "",
29
+ rounded ? "is-rounded" : "",
30
30
  ]);
31
31
  if (searchType === "byButton") {
32
32
  return (_jsxs("div", { className: "field has-addons", children: [_jsx("div", { className: className, children: _jsx("input", { type: "search", name: elementName, defaultValue: searchValue, className: inputClassName, disabled: disabled, onChange: onChange, placeholder: caption }) }), _jsx("div", { className: "control", children: _jsx(Button, { caption: "Search", type: "info", onClick: onSearchButtonClick, isLoading: isLoading, size: size }) })] }));
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./style.scss";
3
2
  import { BaseElementProps, ElementSize } from "../..";
4
3
  import { TabItem, TabsPosition, TabsStyle } from "../../tabs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGxE,gCAAgC;AAChC,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,WAAW;IACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtB,8CAA8C;IAC9C,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAE5C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,4GAMP,SAAS,KAAG,WA6Ed,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/component/index.tsx"],"names":[],"mappings":"AAIA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGxE,gCAAgC;AAChC,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,WAAW;IACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtB,8CAA8C;IAC9C,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAE5C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,sBAAsB;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,4GAMP,SAAS,KAAG,WA6Ed,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -10,11 +10,11 @@ import TabItemComponent from "../../tabs/components/item";
10
10
  * Tabs panel
11
11
  * @throws Items are empty
12
12
  */
13
- const Tabs = ({ items, onActiveItemChange, defaultActive, size, position, style, fullWidth, className, title, data, }) => {
13
+ const Tabs = ({ items, onActiveItemChange, defaultActive = items[0], size, position = TabsPosition.left, style = TabsStyle.default, fullWidth = false, className, title, data, }) => {
14
14
  if (items.length === 0) {
15
15
  throw new Error("Invalid configuration. Tab items must be defined");
16
16
  }
17
- const [activeItem, setActiveItem] = useState(defaultActive ?? items[0]);
17
+ const [activeItem, setActiveItem] = useState(defaultActive);
18
18
  const isFirstRun = useRef(true);
19
19
  const onTabsClick = useCallback((container) => {
20
20
  const closestTab = container.target.closest(".bbr-tabs__tab");
@@ -41,10 +41,10 @@ const Tabs = ({ items, onActiveItemChange, defaultActive, size, position, style,
41
41
  const elClassName = getClassName([
42
42
  "bbr-tabs",
43
43
  "tabs",
44
- position ?? TabsPosition.left,
44
+ position,
45
45
  getSizeClassName(size, [ElementSize.Normal]),
46
- style ?? TabsStyle.default,
47
- fullWidth === true ? "is-fullwidth" : "",
46
+ style,
47
+ fullWidth ? "is-fullwidth" : "",
48
48
  className,
49
49
  ]);
50
50
  const dataAttributes = isNullOrUndefined(data)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tag/component/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,cAAc,CAAC;AAEtB,sBAAsB;AACtB,QAAA,MAAM,GAAG,2FAMN,QAAQ,KAAG,WAmCb,CAAC;AAEF,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tag/component/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,cAAc,CAAC;AAEtB,sBAAsB;AACtB,QAAA,MAAM,GAAG,2FAQN,QAAQ,KAAG,WA+Bb,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -3,9 +3,7 @@ import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
3
  import { ElementColor, ElementSize } from "../..";
4
4
  import "./style.scss";
5
5
  /** Single tag item */
6
- const Tag = ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, }) => {
7
- size ??= ElementSize.Normal;
8
- style ??= ElementColor.Default;
6
+ const Tag = ({ content, size = ElementSize.Normal, style = ElementColor.Default, rounded = false, lightColor = false, customColor, onClick, className, title, }) => {
9
7
  if (!isNullOrUndefined(customColor)) {
10
8
  style = ElementColor.Default;
11
9
  }
@@ -14,8 +12,8 @@ const Tag = ({ content, size, style, rounded, lightColor, customColor, onClick,
14
12
  "tag",
15
13
  style === ElementColor.Default ? "" : `is-${style}`,
16
14
  !isNullOrUndefined(customColor) ? "bbr-tag--custom" : "",
17
- lightColor === true && isNullOrUndefined(customColor) ? "is-light" : "",
18
- rounded === true ? "is-rounded" : "",
15
+ lightColor && isNullOrUndefined(customColor) ? "is-light" : "",
16
+ rounded ? "is-rounded" : "",
19
17
  size === ElementSize.Normal || size === ElementSize.Small ? "" : `is-${size}`,
20
18
  isNullOrUndefined(onClick) ? "" : "bbr-tag--clickable",
21
19
  className,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodynarf/react.components",
3
- "version": "1.7.94",
3
+ "version": "1.7.96",
4
4
  "author": {
5
5
  "name": "Artem",
6
6
  "email": "bodynar@gmail.com"
package/readme.md CHANGED
@@ -15,26 +15,30 @@ Small library with react components based on Bulma CSS framework&nbsp; <a href="
15
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
16
16
 
17
17
  ## Description
18
+ Mostly all components have root css class with `bbr-` prefix. BBR - Bodynarf Bulma React
18
19
 
19
- Mostly all components have root class with `bbr-` prefix. BBR - Bodynarf Bulma React
20
20
  ### Simple components
21
21
  Simple react components based on html elements.
22
22
 
23
+ #### Controls
24
+ - **Checkbox** - (*see p.5 of installation*) Checkbox component based on [bulma-checkradio](https://wikiki.github.io/form/checkradio)
23
25
  - **ColorPicker** - control that allows picking color (with preview option)
24
- - **Date** - date input;
25
- - **Multiline** - multiline text input;
26
+ - **Date** - date input
27
+ - **Multiline** - multiline text input
28
+ - **Number** - number input with step
29
+ - **Password** - single line password input (requires icon, see icon component description)
26
30
  - **Text** - single line text input;
27
- - **Anchor**
28
- - **Button**
29
- - **Number**
30
- - **Password** - single line password input (requires icon, see *p.4*)
31
+
32
+ #### Components
33
+ - **Anchor** - simple anchor (link) component
34
+ - **Button** - button that allows user to interact with system by clicking it _(assume everyone knows what is button)_
31
35
  - **Icon** - *see p.4 of installation*
32
- - **Dropdown** - custom dropdown component, based on html div elements & css. Allows to use icon in elements
33
- - **Checkbox** - (*see p.5 of installation*) Checkbox component based on [bulma-checkradio](https://wikiki.github.io/form/checkradio)
36
+ - **Tag** - small component stands for tag visualization
34
37
 
35
38
  ### Complex components
36
39
  Complex components is set of components built via combining simple components or represent complex logical component
37
- - **Search** - Search bar with optional button to perform search
40
+ - **Accordion** - Collapsible container that can hide some content inside
41
+ - **Dropdown** - custom dropdown component, based on html div elements & css (requires icon, see icon component description)
38
42
  - **Paginator** - Pagination elements to navigate through paged list
39
43
 
40
44
  Example:
@@ -50,8 +54,10 @@ Complex components is set of components built via combining simple components or
50
54
  onPageChange={onPageChange}
51
55
  />
52
56
  ```
57
+ - **Search** - Search bar with optional button to perform search
58
+ - **Tabs** - Container for multi-content with option of switching displaying content without refreshing\scrolling page
53
59
 
54
60
  ### Hooks
55
61
 
56
- - **useComponentOutsideClick** - Attach watcher for mouse clicks and emmit event when click was outside of component
62
+ - **useComponentOutsideClick** - Attach watcher for mouse clicks and emit event when click was outside of component
57
63
  - **usePagination** - Create a pagination config to easily manipulate with Paginator component