@bodynarf/react.components 1.9.0 → 1.10.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.
Files changed (172) hide show
  1. package/bodynarf-react.components-1.10.0.tgz +0 -0
  2. package/components/accordion/component/index.js +3 -3
  3. package/components/anchor/component/index.js +2 -2
  4. package/components/anchor/components/anchorWithIcon/index.d.ts +8 -2
  5. package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
  6. package/components/anchor/components/anchorWithIcon/index.js +2 -2
  7. package/components/anchor/components/simpleAnchor/index.d.ts +2 -2
  8. package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
  9. package/components/anchor/components/simpleAnchor/index.js +1 -1
  10. package/components/anchor/types.d.ts +3 -11
  11. package/components/anchor/types.d.ts.map +1 -1
  12. package/components/breadcrumbs/component/index.d.ts +7 -32
  13. package/components/breadcrumbs/component/index.d.ts.map +1 -1
  14. package/components/breadcrumbs/component/index.js +22 -6
  15. package/components/breadcrumbs/types.d.ts +30 -1
  16. package/components/breadcrumbs/types.d.ts.map +1 -1
  17. package/components/button/component/index.d.ts.map +1 -1
  18. package/components/button/component/index.js +3 -3
  19. package/components/button/types.d.ts +1 -1
  20. package/components/dropdown/component/style.scss +3 -3
  21. package/components/dropdown/components/compact/index.d.ts +8 -2
  22. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  23. package/components/dropdown/components/compact/index.js +17 -5
  24. package/components/dropdown/components/label/component/index.d.ts +27 -0
  25. package/components/dropdown/components/label/component/index.d.ts.map +1 -0
  26. package/components/dropdown/components/label/component/index.js +16 -0
  27. package/components/dropdown/components/label/components/empty/index.d.ts +8 -0
  28. package/components/dropdown/components/label/components/empty/index.d.ts.map +1 -0
  29. package/components/dropdown/components/label/components/empty/index.js +16 -0
  30. package/components/dropdown/components/label/components/selected/index.d.ts +8 -0
  31. package/components/dropdown/components/label/components/selected/index.d.ts.map +1 -0
  32. package/components/dropdown/components/label/components/selected/index.js +20 -0
  33. package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts +8 -0
  34. package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts.map +1 -0
  35. package/components/dropdown/components/label/components/selectedWithIcon/index.js +28 -0
  36. package/components/dropdown/components/label/components/withSearch/index.d.ts +16 -0
  37. package/components/dropdown/components/label/components/withSearch/index.d.ts.map +1 -0
  38. package/components/dropdown/components/label/components/withSearch/index.js +33 -0
  39. package/components/dropdown/components/label/components/withSearch/style.scss +29 -0
  40. package/components/dropdown/components/label/index.d.ts +1 -17
  41. package/components/dropdown/components/label/index.d.ts.map +1 -1
  42. package/components/dropdown/components/label/index.js +1 -54
  43. package/components/dropdown/components/withLabel/index.d.ts +3 -2
  44. package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
  45. package/components/dropdown/components/withLabel/index.js +8 -82
  46. package/components/dropdown/types.d.ts +8 -0
  47. package/components/dropdown/types.d.ts.map +1 -1
  48. package/components/icon/component/index.d.ts +3 -2
  49. package/components/icon/component/index.d.ts.map +1 -1
  50. package/components/icon/component/index.js +4 -3
  51. package/components/icon/types.d.ts +2 -0
  52. package/components/icon/types.d.ts.map +1 -1
  53. package/components/multiselect/component/index.d.ts +8 -0
  54. package/components/multiselect/component/index.d.ts.map +1 -0
  55. package/components/multiselect/component/index.js +13 -0
  56. package/components/multiselect/component/style.scss +20 -0
  57. package/components/multiselect/components/item/index.d.ts +25 -0
  58. package/components/multiselect/components/item/index.d.ts.map +1 -0
  59. package/components/multiselect/components/item/index.js +62 -0
  60. package/components/multiselect/components/label/component/index.d.ts +20 -0
  61. package/components/multiselect/components/label/component/index.d.ts.map +1 -0
  62. package/components/multiselect/components/label/component/index.js +12 -0
  63. package/components/multiselect/components/label/components/empty/index.d.ts +8 -0
  64. package/components/multiselect/components/label/components/empty/index.d.ts.map +1 -0
  65. package/components/multiselect/components/label/components/empty/index.js +16 -0
  66. package/components/multiselect/components/label/components/nonEmpty/index.d.ts +8 -0
  67. package/components/multiselect/components/label/components/nonEmpty/index.d.ts.map +1 -0
  68. package/components/multiselect/components/label/components/nonEmpty/index.js +16 -0
  69. package/components/multiselect/components/label/index.d.ts +2 -0
  70. package/components/multiselect/components/label/index.d.ts.map +1 -0
  71. package/components/multiselect/components/label/index.js +1 -0
  72. package/components/multiselect/components/withLabel/index.d.ts +6 -0
  73. package/components/multiselect/components/withLabel/index.d.ts.map +1 -0
  74. package/components/multiselect/components/withLabel/index.js +11 -0
  75. package/components/multiselect/components/withoutLabel/index.d.ts +10 -0
  76. package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -0
  77. package/components/multiselect/components/withoutLabel/index.js +84 -0
  78. package/components/multiselect/index.d.ts +3 -0
  79. package/components/multiselect/index.d.ts.map +1 -0
  80. package/components/multiselect/index.js +2 -0
  81. package/components/multiselect/types.d.ts +41 -0
  82. package/components/multiselect/types.d.ts.map +1 -0
  83. package/components/multiselect/types.js +1 -0
  84. package/components/paginator/component/index.d.ts.map +1 -1
  85. package/components/paginator/component/index.js +22 -5
  86. package/components/paginator/index.d.ts +0 -1
  87. package/components/paginator/index.d.ts.map +1 -1
  88. package/components/paginator/index.js +0 -1
  89. package/components/primitives/checkbox/component/index.d.ts +1 -1
  90. package/components/primitives/checkbox/component/index.d.ts.map +1 -1
  91. package/components/primitives/checkbox/component/index.js +8 -6
  92. package/components/primitives/checkbox/component/style.scss +22 -3
  93. package/components/primitives/color/components/picker/index.d.ts +3 -3
  94. package/components/primitives/color/components/picker/index.d.ts.map +1 -1
  95. package/components/primitives/color/components/picker/index.js +8 -8
  96. package/components/primitives/color/components/withLabel/index.d.ts +1 -1
  97. package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
  98. package/components/primitives/color/components/withLabel/index.js +3 -4
  99. package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
  100. package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
  101. package/components/primitives/color/components/withoutLabel/index.js +2 -3
  102. package/components/primitives/date/component/index.d.ts +2 -2
  103. package/components/primitives/date/component/index.d.ts.map +1 -1
  104. package/components/primitives/date/component/index.js +5 -7
  105. package/components/primitives/date/component/style.scss +11 -0
  106. package/components/primitives/date/types.d.ts +1 -1
  107. package/components/primitives/date/types.d.ts.map +1 -1
  108. package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
  109. package/components/primitives/internal/componentWithLabel/index.js +2 -2
  110. package/components/primitives/internal/hint/index.d.ts +3 -7
  111. package/components/primitives/internal/hint/index.d.ts.map +1 -1
  112. package/components/primitives/internal/hint/index.js +1 -0
  113. package/components/primitives/internal/hint/style.scss +4 -0
  114. package/components/primitives/multiline/component/index.d.ts +0 -1
  115. package/components/primitives/multiline/component/index.d.ts.map +1 -1
  116. package/components/primitives/multiline/component/index.js +0 -1
  117. package/components/primitives/multiline/components/withLabel/index.d.ts +1 -1
  118. package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
  119. package/components/primitives/multiline/components/withLabel/index.js +4 -6
  120. package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
  121. package/components/primitives/multiline/components/withoutLabel/index.js +4 -5
  122. package/components/primitives/number/components/withLabel/index.d.ts +1 -1
  123. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  124. package/components/primitives/number/components/withLabel/index.js +4 -6
  125. package/components/primitives/number/components/withoutLabel/index.d.ts +1 -1
  126. package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
  127. package/components/primitives/number/components/withoutLabel/index.js +5 -6
  128. package/components/primitives/password/components/withLabel/index.d.ts +1 -1
  129. package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
  130. package/components/primitives/password/components/withLabel/index.js +5 -6
  131. package/components/primitives/password/components/withoutLabel/index.js +6 -7
  132. package/components/primitives/text/component/index.d.ts +0 -1
  133. package/components/primitives/text/component/index.d.ts.map +1 -1
  134. package/components/primitives/text/component/index.js +0 -1
  135. package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
  136. package/components/primitives/text/components/withLabel/index.js +4 -6
  137. package/components/primitives/text/components/withoutLabel/index.d.ts +1 -1
  138. package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -1
  139. package/components/primitives/text/components/withoutLabel/index.js +5 -6
  140. package/components/search/component/index.d.ts.map +1 -1
  141. package/components/search/component/index.js +6 -8
  142. package/components/table/component/index.d.ts +2 -35
  143. package/components/table/component/index.d.ts.map +1 -1
  144. package/components/table/component/index.js +4 -2
  145. package/components/table/component/style.scss +21 -0
  146. package/components/table/components/heading/index.d.ts.map +1 -1
  147. package/components/table/components/heading/index.js +3 -3
  148. package/components/table/types.d.ts +36 -1
  149. package/components/table/types.d.ts.map +1 -1
  150. package/components/tabs/component/index.d.ts +3 -27
  151. package/components/tabs/component/index.d.ts.map +1 -1
  152. package/components/tabs/component/index.js +3 -3
  153. package/components/tabs/types.d.ts +24 -1
  154. package/components/tabs/types.d.ts.map +1 -1
  155. package/components/tag/component/index.d.ts.map +1 -1
  156. package/components/tag/component/index.js +3 -3
  157. package/components/tag/types.d.ts +3 -3
  158. package/components/tag/types.d.ts.map +1 -1
  159. package/hooks/index.d.ts +1 -0
  160. package/hooks/index.d.ts.map +1 -1
  161. package/hooks/index.js +1 -0
  162. package/hooks/useComponentOutsideClick.d.ts.map +1 -1
  163. package/hooks/useComponentOutsideClick.js +2 -3
  164. package/hooks/useUnmount.d.ts +8 -0
  165. package/hooks/useUnmount.d.ts.map +1 -0
  166. package/hooks/useUnmount.js +22 -0
  167. package/package.json +2 -2
  168. package/tsconfig.tsbuildinfo +1 -1
  169. package/common.scss +0 -8
  170. package/components/paginator/utils.d.ts +0 -10
  171. package/components/paginator/utils.d.ts.map +0 -1
  172. package/components/paginator/utils.js +0 -18
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
3
  import { ElementPosition, ElementSize, ValidationStatus } from "../../../../types";
4
4
  import Icon from "../../../icon";
5
+ import "./style.scss";
5
6
  /** Hint component for internal use (as form input elements hints) */
6
7
  const InternalHint = ({ validationState, hint, }) => {
7
8
  if (isNullOrUndefined(validationState) && isNullOrUndefined(hint)) {
@@ -0,0 +1,4 @@
1
+ p.bbr-hint {
2
+ white-space: pre-line;
3
+ display: inline-flex;
4
+ }
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import "../../../../common.scss";
3
2
  import { MultilineProps } from "..";
4
3
  /** Multiline textual input component */
5
4
  declare const Multiline: (props: MultilineProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAK1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAK1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { isNullOrUndefined } from "@bodynarf/utils";
3
- import "../../../../common.scss";
4
3
  import MultilineWithoutLabel from "../components/withoutLabel";
5
4
  import MultilineWithLabel from "../components/withLabel";
6
5
  /** Multiline textual input component */
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { MultilineProps } from "../..";
3
3
  /** Multiline textual input component with describing label */
4
- declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, readonly, disabled, name, size, style, loading, label, placeholder, fixed, rows, onBlur, className, title, data, hint, }: MultilineProps) => JSX.Element;
4
+ declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, name, size, style, label, placeholder, readonly, disabled, loading, fixed, rows, onBlur, className, title, data, hint, }: MultilineProps) => JSX.Element;
5
5
  export default MultilineWithLabel;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,6KAUrB,cAAc,KAAG,WAuDnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,6KAYrB,cAAc,KAAG,WAoDnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,18 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import ComponentWithLabel from "../../../internal/componentWithLabel";
7
7
  import InternalHint from "../../../internal/hint";
8
8
  /** Multiline textual input component with describing label */
9
- const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, readonly, disabled, name, size, style, loading = false, label, placeholder, fixed = false, rows, onBlur, className, title, data, hint, }) => {
9
+ const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, rows, onBlur, className, title, data, hint, }) => {
10
10
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
11
- const id = name ?? generateGuid();
12
- const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
13
11
  const elClassName = getClassName([
14
12
  className,
15
- elSizeClassName,
13
+ size === ElementSize.Normal ? "" : `is-${size}`,
16
14
  getStyleClassName(style, validationState),
17
15
  "textarea",
18
16
  fixed ? "has-fixed-size" : "",
@@ -24,6 +22,6 @@ const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, read
24
22
  const dataAttributes = isNullOrUndefined(data)
25
23
  ? undefined
26
24
  : mapDataAttributes(data);
27
- return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: id, name: id, rows: rows, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
25
+ return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
28
26
  };
29
27
  export default MultilineWithLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,kJASxB,cAAc,KAAG,WAiDnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,kJAUxB,cAAc,KAAG,WAiDnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1,16 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import InternalHint from "../../../internal/hint";
7
7
  /** Multiline textual input component without describing label*/
8
- const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading = false, fixed = false, rows, className, title, data, hint, }) => {
8
+ const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), placeholder, onBlur, size = ElementSize.Normal, style, loading = false, fixed = false, rows, className, title, data, hint, }) => {
9
9
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
10
- const id = name ?? generateGuid();
11
10
  const elClassName = getClassName([
12
11
  className,
13
- "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
12
+ size === ElementSize.Normal ? "" : `is-${size}`,
14
13
  getStyleClassName(style, validationState),
15
14
  "textarea",
16
15
  fixed ? "has-fixed-size" : "",
@@ -23,6 +22,6 @@ const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, n
23
22
  const dataAttributes = isNullOrUndefined(data)
24
23
  ? undefined
25
24
  : mapDataAttributes(data);
26
- return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: id, name: id, rows: rows, onBlur: onBlur, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
25
+ return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, onBlur: onBlur, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
27
26
  };
28
27
  export default MultilineWithoutLabel;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { NumberProps } from "../..";
3
3
  /** Number component with label */
4
- declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded, loading, label, placeholder, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
4
+ declare const NumberWithLabel: ({ onValueChange, defaultValue, validationState, name, label, placeholder, size, style, rounded, loading, readonly, disabled, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
5
5
  export default NumberWithLabel;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,+KAUlB,WAAW,KAAG,WA0DhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,+KAWlB,WAAW,KAAG,WAuDhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,18 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import ComponentWithLabel from "../../../internal/componentWithLabel";
7
7
  import InternalHint from "../../../internal/hint";
8
8
  /** Number component with label */
9
- const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, label, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
9
+ const NumberWithLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), label, placeholder, size = ElementSize.Normal, style, rounded = false, loading = false, readonly = false, disabled = false, onBlur, step = 1, className, title, data, hint, }) => {
10
10
  const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value) ? undefined : +event.target.value), [onValueChange]);
11
- const id = name ?? generateGuid();
12
- const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
13
11
  const elClassName = getClassName([
14
12
  className,
15
- elSizeClassName,
13
+ size === ElementSize.Normal ? "" : `is-${size}`,
16
14
  rounded ? "is-rounded" : "",
17
15
  getStyleClassName(style, validationState),
18
16
  "input",
@@ -24,6 +22,6 @@ const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, vali
24
22
  const dataAttributes = isNullOrUndefined(data)
25
23
  ? undefined
26
24
  : mapDataAttributes(data);
27
- return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", id: id, name: id, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
25
+ return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", id: name, name: name, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
28
26
  };
29
27
  export default NumberWithLabel;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { NumberProps } from "../..";
3
3
  /** Number component without label */
4
- declare const NumberWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded, loading, placeholder, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
4
+ declare const NumberWithoutLabel: ({ onValueChange, defaultValue, validationState, name, size, style, readonly, disabled, rounded, loading, placeholder, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
5
5
  export default NumberWithoutLabel;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,wKAUrB,WAAW,KAAG,WAqDhB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,wKAYrB,WAAW,KAAG,WAqDhB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,15 +1,15 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import InternalHint from "../../../internal/hint";
7
7
  /** Number component without label */
8
- const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
8
+ const NumberWithoutLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), size, style, readonly = false, disabled = false, rounded = false, loading = false, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
9
9
  const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
10
10
  const elClassName = getClassName([
11
11
  className,
12
- "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
12
+ size === ElementSize.Normal ? "" : `is-${size}`,
13
13
  rounded ? "is-rounded" : "",
14
14
  getStyleClassName(style, validationState),
15
15
  "input",
@@ -19,10 +19,9 @@ const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, v
19
19
  "bbr-input",
20
20
  loading ? "is-loading" : "",
21
21
  ]);
22
- const id = name ?? generateGuid();
23
22
  const dataAttributes = isNullOrUndefined(data)
24
23
  ? undefined
25
24
  : mapDataAttributes(data);
26
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", id: id, name: id, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
25
+ return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", id: name, name: name, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
27
26
  };
28
27
  export default NumberWithoutLabel;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { PasswordProps } from "../..";
3
- declare const PasswordWithLabel: ({ onValueChange, disabled, validationState, name, size, style, rounded, loading, label, placeholder, canShowPassword, className, title, data, hint, }: PasswordProps) => JSX.Element;
3
+ declare const PasswordWithLabel: ({ onValueChange, validationState, name, size, style, rounded, loading, disabled, canShowPassword, label, placeholder, className, title, data, hint, }: PasswordProps) => JSX.Element;
4
4
  export default PasswordWithLabel;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,0JAUpB,aAAa,KAAG,WAwElB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,0JAUpB,aAAa,KAAG,WAqElB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,17 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import Icon from "../../../../icon";
7
7
  import ComponentWithLabel from "../../../internal/componentWithLabel";
8
8
  import InternalHint from "../../../internal/hint";
9
- const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, size, style, rounded = false, loading = false, label, placeholder, canShowPassword = false, className, title, data, hint, }) => {
9
+ const PasswordWithLabel = ({ onValueChange, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, disabled = false, canShowPassword = false, label, placeholder, className, title, data, hint, }) => {
10
10
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
11
11
  const [contentIsHidden, setContentIsHidden] = useState(true);
12
12
  const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
13
- const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
14
- const id = name ?? generateGuid();
13
+ const elSizeClassName = size === ElementSize.Normal ? "" : "is-{0}".format(size);
15
14
  const elClassName = getClassName([
16
15
  "bbr-password",
17
16
  className,
@@ -29,7 +28,7 @@ const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, siz
29
28
  const dataAttributes = isNullOrUndefined(data)
30
29
  ? undefined
31
30
  : mapDataAttributes(data);
32
- return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: id, name: id, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
33
- _jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, title: "Show password", children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
31
+ return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: name, name: name, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
32
+ _jsx("span", { onClick: onIconClick, title: "Show password", className: `icon is-right ${elSizeClassName}`, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
34
33
  };
35
34
  export default PasswordWithLabel;
@@ -1,16 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import Icon from "../../../../icon";
7
7
  import InternalHint from "../../../internal/hint";
8
- const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, size, style, rounded = false, loading = false, placeholder, canShowPassword = false, className, title, data, hint, }) => {
8
+ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, placeholder, canShowPassword = false, className, title, data, hint, }) => {
9
9
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
10
10
  const [contentIsHidden, setContentIsHidden] = useState(true);
11
11
  const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
12
- const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
13
- const id = name ?? generateGuid();
12
+ const elSizeClassName = size === ElementSize.Normal ? "" : "is-{0}".format(size);
14
13
  const elClassName = getClassName([
15
14
  "bbr-password",
16
15
  className,
@@ -29,7 +28,7 @@ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name,
29
28
  const dataAttributes = isNullOrUndefined(data)
30
29
  ? undefined
31
30
  : mapDataAttributes(data);
32
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: id, name: id, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
33
- _jsx("span", { className: `icon is-right ${elSizeClassName}`, onMouseEnter: onIconClick, onMouseLeave: onIconClick, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
31
+ return (_jsxs("div", { className: "bbr-field field", children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: name, name: name, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
32
+ _jsx("span", { onClick: onIconClick, title: "Show password", className: `icon is-right ${elSizeClassName}`, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
34
33
  };
35
34
  export default PasswordWithoutLabel;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import "../../../../common.scss";
3
2
  import { TextProps } from "..";
4
3
  /** Textual input component */
5
4
  declare const Text: (props: TextProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAI/B,8BAA8B;AAC9B,QAAA,MAAM,IAAI,UAAW,SAAS,KAAG,WAIhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAI/B,8BAA8B;AAC9B,QAAA,MAAM,IAAI,UAAW,SAAS,KAAG,WAIhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { isNullOrUndefined } from "@bodynarf/utils";
3
- import "../../../../common.scss";
4
3
  import TextWithLabel from "../components/withLabel";
5
4
  import TextWithoutLabel from "../components/withoutLabel";
6
5
  /** Textual input component */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,yKAUhB,SAAS,KAAG,WAwDd,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,yKAUhB,SAAS,KAAG,WAqDd,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,18 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined, } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined, } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import InternalHint from "../../../internal/hint";
7
7
  import ComponentWithLabel from "../../../internal/componentWithLabel";
8
8
  /** Textual input with describing label */
9
- const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, label, placeholder, onBlur, className, title, data, hint, }) => {
9
+ const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, label, placeholder, onBlur, className, title, data, hint, }) => {
10
10
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
11
- const id = name ?? generateGuid();
12
- const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
13
11
  const elClassName = getClassName([
14
12
  className,
15
- elSizeClassName,
13
+ size === ElementSize.Normal ? "" : `is-${size}`,
16
14
  rounded ? "is-rounded" : "",
17
15
  getStyleClassName(style, validationState),
18
16
  "input",
@@ -24,6 +22,6 @@ const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, valida
24
22
  const dataAttributes = isNullOrUndefined(data)
25
23
  ? undefined
26
24
  : mapDataAttributes(data);
27
- return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", id: id, name: id, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
25
+ return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
28
26
  };
29
27
  export default TextWithLabel;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TextProps } from "../..";
3
3
  /** Textual input without describing label */
4
- declare const TextWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded, loading, placeholder, onBlur, className, title, data, hint, }: TextProps) => JSX.Element;
4
+ declare const TextWithoutLabel: ({ onValueChange, defaultValue, validationState, readonly, disabled, name, size, style, rounded, loading, placeholder, onBlur, className, title, data, hint, }: TextProps) => JSX.Element;
5
5
  export default TextWithoutLabel;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,kKAUnB,SAAS,KAAG,WAoDd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,kKAWnB,SAAS,KAAG,WAoDd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,15 +1,15 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
5
  import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import InternalHint from "../../../internal/hint";
7
7
  /** Textual input without describing label */
8
- const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, placeholder, onBlur, className, title, data, hint, }) => {
8
+ const TextWithoutLabel = ({ onValueChange, defaultValue, validationState, readonly = false, disabled = false, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, placeholder, onBlur, className, title, data, hint, }) => {
9
9
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
10
10
  const elClassName = getClassName([
11
11
  className,
12
- "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
12
+ size === ElementSize.Normal ? "" : `is-${size}`,
13
13
  rounded ? "is-rounded" : "",
14
14
  getStyleClassName(style, validationState),
15
15
  "input",
@@ -19,10 +19,9 @@ const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, val
19
19
  "bbr-input",
20
20
  loading ? "is-loading" : "",
21
21
  ]);
22
- const id = name ?? generateGuid();
23
22
  const dataAttributes = isNullOrUndefined(data)
24
23
  ? undefined
25
24
  : mapDataAttributes(data);
26
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "text", id: id, name: id, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
25
+ return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "text", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
27
26
  };
28
27
  export default TextWithoutLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,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,EAE5C,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAqF3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,UAAU,EAAE,QAAQ,EAAE,OAAO,EAC7B,IAAqB,EAAE,YAAiB,EACxC,IAAyB,EACzB,SAAiB,EAAE,OAAe,EAAE,QAAgB,EAEpD,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAwF3B"}
@@ -6,9 +6,9 @@ import { mapDataAttributes } from "../../../utils";
6
6
  import Button from "../../button";
7
7
  import "./style.scss";
8
8
  /** Search component */
9
- export default function Search({ searchType, onSearch, caption, name, defaultValue, size, isLoading = false, rounded = false, disabled, className, title, data, }) {
10
- const [elementName] = useState(name ?? generateGuid());
11
- const [searchValue, setSearchValue] = useState(defaultValue ?? "");
9
+ export default function Search({ searchType, onSearch, caption, name = generateGuid(), defaultValue = "", size = ElementSize.Normal, isLoading = false, rounded = false, disabled = false, className, title, data, }) {
10
+ const [elementName] = useState(name);
11
+ const [searchValue, setSearchValue] = useState(defaultValue);
12
12
  const onChange = useCallback((event) => {
13
13
  const elementValue = event.target.value;
14
14
  if (searchType === "byTyping") {
@@ -21,14 +21,14 @@ export default function Search({ searchType, onSearch, caption, name, defaultVal
21
21
  "bbr-search",
22
22
  "control",
23
23
  className,
24
- `is-${(size ?? ElementSize.Normal)}`,
24
+ `is-${size}`,
25
25
  isLoading ? "is-loading" : "",
26
26
  searchType === "byButton" ? "is-expanded" : "",
27
27
  ]);
28
28
  const inputClassName = getClassName([
29
29
  "input",
30
30
  "is-unselectable",
31
- `is-${(size ?? ElementSize.Normal)}`,
31
+ `is-${size}`,
32
32
  rounded ? "is-rounded" : "",
33
33
  ]);
34
34
  const dataAttributes = isNullOrUndefined(data)
@@ -37,7 +37,5 @@ export default function Search({ searchType, onSearch, caption, name, defaultVal
37
37
  if (searchType === "byButton") {
38
38
  return (_jsxs("div", { className: "field has-addons", children: [_jsx("div", { className: elClassName, children: _jsx("input", { type: "search", name: elementName, disabled: disabled, onChange: onChange, placeholder: caption, defaultValue: searchValue, className: inputClassName, title: title, ...dataAttributes }) }), _jsx("div", { className: "control", children: _jsx(Button, { type: "info", size: size, caption: "Search", disabled: disabled, isLoading: isLoading, onClick: onSearchButtonClick }) })] }));
39
39
  }
40
- else {
41
- return (_jsx("div", { className: elClassName, children: _jsx("input", { type: "search", name: elementName, disabled: disabled, onChange: onChange, placeholder: caption, defaultValue: searchValue, className: inputClassName, title: title, ...dataAttributes }) }));
42
- }
40
+ return (_jsx("div", { className: elClassName, children: _jsx("input", { type: "search", name: elementName, disabled: disabled, onChange: onChange, placeholder: caption, defaultValue: searchValue, className: inputClassName, title: title, ...dataAttributes }) }));
43
41
  }
@@ -1,39 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { BaseElementProps } from "../../../types";
3
- import { SortColumn, TableHeading } from "..";
4
- /** Table props type */
5
- export interface TableProps<TItem> extends BaseElementProps {
6
- /** Header row */
7
- headings: Array<TableHeading<TItem>>;
8
- /** Table body */
9
- children?: React.ReactNode;
10
- /** Add border to all cells */
11
- hasBorder?: boolean;
12
- /** Is row hover effect active */
13
- hoverable?: boolean;
14
- /** Reduce space between cells */
15
- narrow?: boolean;
16
- /** Use all container width */
17
- fullWidth?: boolean;
18
- /** Is header sticks to page on scroll */
19
- hasStickyHeader?: boolean;
20
- /**
21
- * Header has border.
22
- * @description Applied only with `hasStickyHeader` sets as `true`. Adds border effect
23
- */
24
- headerWithBorder?: boolean;
25
- /** Header has no borders */
26
- headerBorderless?: boolean;
27
- /**
28
- * Should rows be stripped.
29
- * @description Even rows will have gray background
30
- */
31
- zebra?: boolean;
32
- /** Current sort column */
33
- currentSortColumn?: SortColumn<TItem>;
34
- /** Header click handler */
35
- onHeaderClick?: (columnName: TableHeading<TItem>) => void;
36
- }
2
+ import { TableProps } from "..";
3
+ import "./style.scss";
37
4
  /**
38
5
  * Tiny table component.
39
6
  * If no sorting is use - use `any` as generic param
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAG9C,uBAAuB;AACvB,MAAM,WAAW,UAAU,CAAC,KAAK,CAAE,SAAQ,gBAAgB;IACvD,iBAAiB;IACjB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAErC,iBAAiB;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,8BAA8B;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yCAAyC;IACzC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;MAGE;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;MAGE;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,0BAA0B;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAEtC,2BAA2B;IAC3B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED;;;GAGG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,EAClB,QAAQ,EACR,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAChE,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,aAAa,EAChC,QAAQ,EAER,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CA0CjC;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,cAAc,CAAC;AAItB;;;GAGG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,EAClB,QAAQ,EAER,SAAiB,EAAE,SAAiB,EAAE,MAAc,EACpD,SAAiB,EAAE,KAAa,EAAE,gBAAwB,EAC1D,eAAuB,EAAE,gBAAwB,EAEjD,iBAAiB,EAAE,aAAa,EAChC,QAAQ,EAER,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CA4CjC;AAED,eAAe,KAAK,CAAC"}
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
3
  import { mapDataAttributes } from "../../../utils";
4
+ import "./style.scss";
4
5
  import TableHeader from "../components/heading";
5
6
  /**
6
7
  * Tiny table component.
7
8
  * If no sorting is use - use `any` as generic param
8
9
  */
9
- function Table({ headings, hasBorder, hoverable, narrow, fullWidth, zebra, headerBorderless, hasStickyHeader, headerWithBorder, currentSortColumn, onHeaderClick, children, className, title, data, }) {
10
+ function Table({ headings, hasBorder = false, hoverable = false, narrow = false, fullWidth = false, zebra = false, headerBorderless = false, hasStickyHeader = false, headerWithBorder = false, currentSortColumn, onHeaderClick, children, className, title, data, }) {
10
11
  const elClassName = getClassName([
12
+ "bbr-table",
11
13
  "table",
12
14
  className,
13
15
  hasBorder ? "is-bordered" : "",
@@ -22,6 +24,6 @@ function Table({ headings, hasBorder, hoverable, narrow, fullWidth, zebra, heade
22
24
  const dataAttributes = isNullOrUndefined(data)
23
25
  ? undefined
24
26
  : mapDataAttributes(data);
25
- return (_jsxs("table", { className: elClassName, title: title, ...dataAttributes, children: [_jsx("thead", { children: _jsx("tr", { children: headings.map((heading, i) => _jsx(TableHeader, { ...heading, sortColumn: currentSortColumn, onClick: onHeaderClick }, i)) }) }), _jsx("tbody", { children: children })] }));
27
+ return (_jsxs("table", { className: elClassName, title: title, ...dataAttributes, children: [_jsx("thead", { children: _jsx("tr", { children: headings.map((heading, i) => _jsx(TableHeader, { ...heading, onClick: onHeaderClick, sortColumn: currentSortColumn }, i)) }) }), _jsx("tbody", { children: children })] }));
26
28
  }
27
29
  export default Table;
@@ -0,0 +1,21 @@
1
+ table.bbr-table {
2
+ &.has-sticky-header thead th {
3
+ position: sticky;
4
+ top: 0.125rem;
5
+ z-index: 1;
6
+ }
7
+
8
+ &.has-shadow-bordered-header thead th {
9
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
10
+ }
11
+
12
+ &.has-borderless-header {
13
+ thead th {
14
+ border: none !important;
15
+ }
16
+
17
+ tbody tr:nth-child(1) td {
18
+ border-top: none !important;
19
+ }
20
+ }
21
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/components/heading/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,yCAAyC;AACzC,MAAM,WAAW,gBAAgB,CAAC,KAAK,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAC;IAChE,0BAA0B;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAE/B,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,yBAAyB;AACzB,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAoCvE;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/components/heading/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,yCAAyC;AACzC,MAAM,WAAW,gBAAgB,CAAC,KAAK,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAC;IAChE,0BAA0B;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAE/B,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,yBAAyB;AACzB,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAkCvE;AAED,eAAe,WAAW,CAAC"}
@@ -14,8 +14,8 @@ function TableHeader(props) {
14
14
  className,
15
15
  sortable ? "is-clickable" : "",
16
16
  ]);
17
- return (_jsx("th", { className: containerClassName, onClick: onHeaderClick, children: _jsxs("div", { children: [_jsx("span", { children: caption }), sortable && sortColumn?.columnName === name
18
- &&
19
- _jsx(Icon, { className: "ml-1", name: `sort-alpha-down${sortColumn.ascending ? "" : "-alt"}` })] }) }));
17
+ return (_jsxs("th", { onClick: onHeaderClick, className: containerClassName, children: [_jsx("span", { children: caption }), sortable && sortColumn?.columnName === name
18
+ &&
19
+ _jsx(Icon, { className: "ml-1", name: `sort-alpha-down${sortColumn.ascending ? "" : "-alt"}` })] }));
20
20
  }
21
21
  export default TableHeader;