@bodynarf/react.components 1.8.22 → 1.9.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 (256) hide show
  1. package/common.scss +3 -2
  2. package/components/accordion/component/index.d.ts +2 -2
  3. package/components/accordion/component/index.d.ts.map +1 -1
  4. package/components/accordion/component/index.js +4 -4
  5. package/components/accordion/types.d.ts +1 -1
  6. package/components/accordion/types.d.ts.map +1 -1
  7. package/components/anchor/component/index.d.ts +1 -1
  8. package/components/anchor/component/index.d.ts.map +1 -1
  9. package/components/anchor/component/index.js +6 -6
  10. package/components/anchor/components/anchorWithIcon/index.d.ts +3 -2
  11. package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
  12. package/components/anchor/components/anchorWithIcon/index.js +14 -9
  13. package/components/anchor/components/simpleAnchor/index.d.ts +3 -2
  14. package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
  15. package/components/anchor/components/simpleAnchor/index.js +8 -2
  16. package/components/anchor/types.d.ts +2 -6
  17. package/components/anchor/types.d.ts.map +1 -1
  18. package/components/breadcrumbs/component/index.d.ts +34 -0
  19. package/components/breadcrumbs/component/index.d.ts.map +1 -0
  20. package/components/breadcrumbs/component/index.js +21 -0
  21. package/components/breadcrumbs/index.d.ts +3 -0
  22. package/components/breadcrumbs/index.d.ts.map +1 -0
  23. package/components/breadcrumbs/index.js +2 -0
  24. package/components/breadcrumbs/types.d.ts +13 -0
  25. package/components/breadcrumbs/types.d.ts.map +1 -0
  26. package/components/button/component/index.d.ts +1 -1
  27. package/components/button/component/index.d.ts.map +1 -1
  28. package/components/button/component/index.js +4 -8
  29. package/components/button/components/buttonWithIcon/index.d.ts +3 -2
  30. package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
  31. package/components/button/components/buttonWithIcon/index.js +14 -9
  32. package/components/button/components/simpleButton/index.d.ts +3 -2
  33. package/components/button/components/simpleButton/index.d.ts.map +1 -1
  34. package/components/button/components/simpleButton/index.js +8 -2
  35. package/components/button/types.d.ts +1 -1
  36. package/components/button/types.d.ts.map +1 -1
  37. package/components/button/types.js +0 -3
  38. package/components/dropdown/component/index.d.ts +1 -1
  39. package/components/dropdown/component/index.d.ts.map +1 -1
  40. package/components/dropdown/component/index.js +5 -8
  41. package/components/dropdown/component/style.scss +5 -1
  42. package/components/dropdown/components/compact/index.d.ts +2 -2
  43. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  44. package/components/dropdown/components/compact/index.js +12 -9
  45. package/components/dropdown/components/item/index.d.ts +1 -1
  46. package/components/dropdown/components/item/index.d.ts.map +1 -1
  47. package/components/dropdown/components/item/index.js +34 -2
  48. package/components/dropdown/components/label/index.d.ts +1 -1
  49. package/components/dropdown/components/label/index.d.ts.map +1 -1
  50. package/components/dropdown/components/label/index.js +41 -9
  51. package/components/dropdown/components/withLabel/index.d.ts +2 -2
  52. package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
  53. package/components/dropdown/components/withLabel/index.js +14 -12
  54. package/components/dropdown/types.d.ts +13 -2
  55. package/components/dropdown/types.d.ts.map +1 -1
  56. package/components/icon/component/index.d.ts +2 -2
  57. package/components/icon/component/index.d.ts.map +1 -1
  58. package/components/icon/component/index.js +9 -5
  59. package/components/icon/types.d.ts +2 -4
  60. package/components/icon/types.d.ts.map +1 -1
  61. package/components/index.d.ts +0 -1
  62. package/components/index.d.ts.map +1 -1
  63. package/components/index.js +0 -1
  64. package/components/paginator/component/index.d.ts +2 -2
  65. package/components/paginator/component/index.d.ts.map +1 -1
  66. package/components/paginator/component/index.js +19 -14
  67. package/components/paginator/types.d.ts +3 -5
  68. package/components/paginator/types.d.ts.map +1 -1
  69. package/components/primitives/checkbox/component/index.d.ts +2 -2
  70. package/components/primitives/checkbox/component/index.d.ts.map +1 -1
  71. package/components/primitives/checkbox/component/index.js +15 -17
  72. package/components/primitives/checkbox/types.d.ts +2 -2
  73. package/components/primitives/checkbox/types.d.ts.map +1 -1
  74. package/components/primitives/color/component/index.d.ts.map +1 -1
  75. package/components/primitives/color/components/picker/index.d.ts +11 -29
  76. package/components/primitives/color/components/picker/index.d.ts.map +1 -1
  77. package/components/primitives/color/components/picker/index.js +15 -12
  78. package/components/primitives/color/components/withLabel/index.d.ts +1 -1
  79. package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
  80. package/components/primitives/color/components/withLabel/index.js +8 -30
  81. package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
  82. package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
  83. package/components/primitives/color/components/withoutLabel/index.js +3 -13
  84. package/components/primitives/color/types.d.ts +1 -1
  85. package/components/primitives/color/types.d.ts.map +1 -1
  86. package/components/primitives/date/component/index.d.ts +2 -2
  87. package/components/primitives/date/component/index.d.ts.map +1 -1
  88. package/components/primitives/date/component/index.js +12 -27
  89. package/components/primitives/date/types.d.ts +2 -2
  90. package/components/primitives/date/types.d.ts.map +1 -1
  91. package/components/primitives/index.d.ts +0 -1
  92. package/components/primitives/index.d.ts.map +1 -1
  93. package/components/primitives/index.js +0 -1
  94. package/components/primitives/internal/componentWithLabel/index.d.ts +17 -0
  95. package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -0
  96. package/components/primitives/internal/componentWithLabel/index.js +26 -0
  97. package/components/primitives/internal/hint/index.d.ts +13 -0
  98. package/components/primitives/internal/hint/index.d.ts.map +1 -0
  99. package/components/primitives/internal/hint/index.js +47 -0
  100. package/components/primitives/multiline/component/index.d.ts +1 -1
  101. package/components/primitives/multiline/component/index.d.ts.map +1 -1
  102. package/components/primitives/multiline/component/index.js +5 -8
  103. package/components/primitives/multiline/components/withLabel/index.d.ts +6 -0
  104. package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -0
  105. package/components/primitives/multiline/components/withLabel/index.js +29 -0
  106. package/components/primitives/multiline/components/withoutLabel/index.d.ts +6 -0
  107. package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -0
  108. package/components/primitives/multiline/components/withoutLabel/index.js +28 -0
  109. package/components/primitives/multiline/types.d.ts +1 -1
  110. package/components/primitives/multiline/types.d.ts.map +1 -1
  111. package/components/primitives/number/component/index.d.ts +1 -1
  112. package/components/primitives/number/component/index.d.ts.map +1 -1
  113. package/components/primitives/number/component/index.js +5 -8
  114. package/components/primitives/number/components/withLabel/index.d.ts +2 -2
  115. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  116. package/components/primitives/number/components/withLabel/index.js +12 -27
  117. package/components/primitives/number/components/withoutLabel/index.d.ts +2 -2
  118. package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
  119. package/components/primitives/number/components/withoutLabel/index.js +11 -9
  120. package/components/primitives/number/types.d.ts +1 -1
  121. package/components/primitives/number/types.d.ts.map +1 -1
  122. package/components/primitives/password/component/index.d.ts +1 -1
  123. package/components/primitives/password/component/index.d.ts.map +1 -1
  124. package/components/primitives/password/component/index.js +5 -6
  125. package/components/primitives/password/components/withLabel/index.d.ts +2 -2
  126. package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
  127. package/components/primitives/password/components/withLabel/index.js +14 -30
  128. package/components/primitives/password/components/withoutLabel/index.d.ts +2 -2
  129. package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
  130. package/components/primitives/password/components/withoutLabel/index.js +13 -11
  131. package/components/primitives/password/types.d.ts +1 -1
  132. package/components/primitives/password/types.d.ts.map +1 -1
  133. package/components/primitives/text/component/index.d.ts +1 -1
  134. package/components/primitives/text/component/index.d.ts.map +1 -1
  135. package/components/primitives/text/component/index.js +5 -8
  136. package/components/primitives/text/components/withLabel/index.d.ts +6 -0
  137. package/components/primitives/text/components/withLabel/index.d.ts.map +1 -0
  138. package/components/primitives/text/components/withLabel/index.js +29 -0
  139. package/components/primitives/text/components/withoutLabel/index.d.ts +6 -0
  140. package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -0
  141. package/components/primitives/text/components/withoutLabel/index.js +28 -0
  142. package/components/primitives/text/types.d.ts +1 -1
  143. package/components/primitives/text/types.d.ts.map +1 -1
  144. package/components/search/component/index.d.ts +2 -2
  145. package/components/search/component/index.d.ts.map +1 -1
  146. package/components/search/component/index.js +16 -10
  147. package/components/search/types.d.ts +2 -2
  148. package/components/search/types.d.ts.map +1 -1
  149. package/components/table/component/index.d.ts +43 -0
  150. package/components/table/component/index.d.ts.map +1 -0
  151. package/components/table/component/index.js +27 -0
  152. package/components/table/components/heading/index.d.ts +13 -0
  153. package/components/table/components/heading/index.d.ts.map +1 -0
  154. package/components/table/components/heading/index.js +21 -0
  155. package/components/table/index.d.ts +3 -0
  156. package/components/table/index.d.ts.map +1 -0
  157. package/components/table/index.js +2 -0
  158. package/components/table/types.d.ts +18 -0
  159. package/components/table/types.d.ts.map +1 -0
  160. package/components/tabs/component/index.d.ts +3 -3
  161. package/components/tabs/component/index.d.ts.map +1 -1
  162. package/components/tabs/component/index.js +14 -8
  163. package/components/tabs/components/item/index.d.ts +1 -1
  164. package/components/tabs/components/item/index.d.ts.map +1 -1
  165. package/components/tabs/components/item/index.js +4 -3
  166. package/components/tabs/types.d.ts +1 -12
  167. package/components/tabs/types.d.ts.map +1 -1
  168. package/components/tabs/types.js +0 -12
  169. package/components/tag/component/index.d.ts +2 -2
  170. package/components/tag/component/index.d.ts.map +1 -1
  171. package/components/tag/component/index.js +13 -7
  172. package/components/tag/types.d.ts +1 -1
  173. package/components/tag/types.d.ts.map +1 -1
  174. package/hooks/usePagination.d.ts.map +1 -1
  175. package/hooks/usePagination.js +11 -2
  176. package/index.d.ts +1 -0
  177. package/index.d.ts.map +1 -1
  178. package/index.js +1 -0
  179. package/package.json +11 -4
  180. package/readme.md +2 -0
  181. package/tsconfig.tsbuildinfo +1 -1
  182. package/types/baseElementProps.d.ts +11 -0
  183. package/types/baseElementProps.d.ts.map +1 -0
  184. package/types/baseElementProps.js +1 -0
  185. package/{components/primitives/types/baseProps.d.ts → types/baseInputElementProps.d.ts} +10 -4
  186. package/types/baseInputElementProps.d.ts.map +1 -0
  187. package/types/baseInputElementProps.js +1 -0
  188. package/types/dataAttributes.d.ts +9 -0
  189. package/types/dataAttributes.d.ts.map +1 -0
  190. package/types/dataAttributes.js +1 -0
  191. package/types/elementColor.d.ts +18 -0
  192. package/types/elementColor.d.ts.map +1 -0
  193. package/types/elementColor.js +18 -0
  194. package/types/elementIcon.d.ts +22 -0
  195. package/types/elementIcon.d.ts.map +1 -0
  196. package/types/elementIcon.js +1 -0
  197. package/types/elementPosition.d.ts +12 -0
  198. package/types/elementPosition.d.ts.map +1 -0
  199. package/types/elementPosition.js +10 -0
  200. package/types/elementSize.d.ts +12 -0
  201. package/types/elementSize.d.ts.map +1 -0
  202. package/types/elementSize.js +12 -0
  203. package/types/hintConfiguration.d.ts +13 -0
  204. package/types/hintConfiguration.d.ts.map +1 -0
  205. package/types/hintConfiguration.js +1 -0
  206. package/types/index.d.ts +11 -0
  207. package/types/index.d.ts.map +1 -0
  208. package/types/index.js +10 -0
  209. package/{components/primitives/types/label.d.ts → types/labelConfiguration.d.ts} +3 -3
  210. package/types/labelConfiguration.d.ts.map +1 -0
  211. package/types/labelConfiguration.js +1 -0
  212. package/{components/primitives/types → types}/validation/index.d.ts +1 -1
  213. package/types/validation/index.d.ts.map +1 -0
  214. package/{components/primitives/types → types}/validation/index.js +1 -1
  215. package/{components/primitives/types → types}/validation/state.d.ts +2 -2
  216. package/types/validation/state.d.ts.map +1 -0
  217. package/{components/primitives/types → types}/validation/state.js +0 -1
  218. package/{components/primitives/types → types}/validation/status.d.ts +1 -1
  219. package/types/validation/status.d.ts.map +1 -0
  220. package/{components/primitives/types → types}/validation/status.js +1 -2
  221. package/utils/dataAttributes.d.ts +1 -1
  222. package/utils/dataAttributes.d.ts.map +1 -1
  223. package/utils/index.d.ts +1 -1
  224. package/utils/index.d.ts.map +1 -1
  225. package/utils/index.js +1 -1
  226. package/utils/validation.d.ts +11 -0
  227. package/utils/validation.d.ts.map +1 -0
  228. package/utils/validation.js +20 -0
  229. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -6
  230. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -1
  231. package/components/primitives/multiline/components/multilineWithLabel/index.js +0 -44
  232. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +0 -6
  233. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -1
  234. package/components/primitives/multiline/components/multilineWithoutLabel/index.js +0 -26
  235. package/components/primitives/text/components/textWithLabel/index.d.ts +0 -6
  236. package/components/primitives/text/components/textWithLabel/index.d.ts.map +0 -1
  237. package/components/primitives/text/components/textWithLabel/index.js +0 -44
  238. package/components/primitives/text/components/textWithoutLabel/index.d.ts +0 -6
  239. package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +0 -1
  240. package/components/primitives/text/components/textWithoutLabel/index.js +0 -26
  241. package/components/primitives/types/baseProps.d.ts.map +0 -1
  242. package/components/primitives/types/index.d.ts +0 -4
  243. package/components/primitives/types/index.d.ts.map +0 -1
  244. package/components/primitives/types/index.js +0 -3
  245. package/components/primitives/types/label.d.ts.map +0 -1
  246. package/components/primitives/types/validation/index.d.ts.map +0 -1
  247. package/components/primitives/types/validation/state.d.ts.map +0 -1
  248. package/components/primitives/types/validation/status.d.ts.map +0 -1
  249. package/components/types.d.ts +0 -78
  250. package/components/types.d.ts.map +0 -1
  251. package/components/types.js +0 -41
  252. package/utils/formValidation.d.ts +0 -16
  253. package/utils/formValidation.d.ts.map +0 -1
  254. package/utils/formValidation.js +0 -35
  255. /package/components/{primitives/types/baseProps.js → breadcrumbs/types.js} +0 -0
  256. /package/components/{primitives/types/label.js → table/types.js} +0 -0
@@ -1,17 +1,18 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getClassName, getFontColorFromString, isNullOrUndefined } from "@bodynarf/utils";
3
- import { ElementPosition } from "../../../../..";
3
+ import { ElementPosition } from "../../../../../types";
4
+ import { mapDataAttributes } from "../../../../../utils";
5
+ import InternalHint from "../../../internal/hint";
4
6
  /** Color picker container component */
5
- const ColorPickerControl = ({ containerClassName, className, disabled, previewConfig, size, defaultColor, onValueChange, value, id, title, dataAttributes, isValidationDefined, validationMessages, styleClassName, }) => {
7
+ const ColorPickerControl = ({ elementClassName, disabled, previewConfig, size, defaultValue, onValueChange, value, id, title, data, hint, validationState, }) => {
6
8
  if (!isNullOrUndefined(previewConfig)) {
7
- return _jsx(PickerWithPreview, { containerClassName: containerClassName, className: className, disabled: disabled, size: size, defaultColor: defaultColor, onValueChange: onValueChange, value: value, id: id, title: title, dataAttributes: dataAttributes, previewConfig: previewConfig, isValidationDefined: isValidationDefined, validationMessages: validationMessages, styleClassName: styleClassName });
9
+ return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled, elementClassName: elementClassName, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, title: title, data: data }));
8
10
  }
9
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "color", className: className, disabled: disabled, defaultValue: defaultColor, onChange: onValueChange, name: id, id: id, title: title, ...dataAttributes }) }), isValidationDefined && validationMessages.length > 0 &&
10
- _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
11
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "control bbr-input", children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, className: elementClassName, onChange: onValueChange, defaultValue: defaultValue, title: title, ...data }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
11
12
  };
12
13
  export default ColorPickerControl;
13
14
  /** Picker sub component with preview */
14
- const PickerWithPreview = ({ containerClassName, className, disabled, size, defaultColor, onValueChange, value, id, title, dataAttributes, previewConfig, isValidationDefined, validationMessages, styleClassName, }) => {
15
+ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onValueChange, value, id, title, data, previewConfig, hint, validationState, }) => {
15
16
  const classNames = getClassName([
16
17
  "bbr-color-picker__preview",
17
18
  "button",
@@ -19,8 +20,12 @@ const PickerWithPreview = ({ containerClassName, className, disabled, size, defa
19
20
  isNullOrUndefined(size) ? "" : `is-${size}`
20
21
  ]);
21
22
  const color = getFontColorFromString(value);
23
+ const dataAttributes = isNullOrUndefined(data)
24
+ ? undefined
25
+ : mapDataAttributes(data);
22
26
  const controlContainerClassName = getClassName([
23
- containerClassName,
27
+ "control",
28
+ "bbr-input",
24
29
  "is-flex-grow-1",
25
30
  previewConfig.position === ElementPosition.Left ? "ml-1" : "mr-1",
26
31
  ]);
@@ -28,12 +33,10 @@ const PickerWithPreview = ({ containerClassName, className, disabled, size, defa
28
33
  return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("button", { className: classNames, style: {
29
34
  "--color-picker__background-color": value,
30
35
  "--color-picker__color": color,
31
- }, children: value }), _jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", className: className, disabled: disabled, defaultValue: defaultColor, onChange: onValueChange, name: id, id: id, title: title, ...dataAttributes }) }), isValidationDefined && validationMessages.length > 0 &&
32
- _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
36
+ }, children: value }), _jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
33
37
  }
34
- return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", className: className, disabled: disabled, defaultValue: defaultColor, onChange: onValueChange, name: id, id: id, title: title, ...dataAttributes }) }), _jsx("button", { className: classNames, style: {
38
+ return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, title: title, ...dataAttributes }) }), _jsx("button", { className: classNames, style: {
35
39
  "--color-picker__background-color": value,
36
40
  "--color-picker__color": color,
37
- }, children: value }), isValidationDefined && validationMessages.length > 0 &&
38
- _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
41
+ }, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
39
42
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ColorPickerProps } from "../..";
3
3
  /** Color picker component with form label */
4
- declare function ColorPickerWithLabel({ className, title, preview, name, defaultValue, validationState, onValueChange, data, disabled, rounded, size, label, }: ColorPickerProps): JSX.Element;
4
+ declare function ColorPickerWithLabel({ preview, name, defaultValue, validationState, onValueChange, disabled, rounded, size, label, className, title, data, hint, }: ColorPickerProps): JSX.Element;
5
5
  export default ColorPickerWithLabel;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC1B,SAAS,EAAE,KAAK,EAChB,OAAO,EACP,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,aAAa,EACb,IAAI,EACJ,QAAgB,EAAE,OAAe,EAAE,IAAI,EACvC,KAAK,GACR,EAAE,gBAAgB,eAiHlB;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC1B,OAAO,EACP,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,aAAa,EACb,QAAgB,EAAE,OAAe,EAAE,IAAI,EACvC,KAAK,EAEL,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,GACP,EAAE,gBAAgB,eAmDlB;AAED,eAAe,oBAAoB,CAAC"}
@@ -1,48 +1,26 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useState } from "react";
3
3
  import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whiteHex } from "@bodynarf/utils";
4
- import { getValidationValues, mapDataAttributes } from "../../../../..";
4
+ import { ElementSize } from "../../../../../types";
5
+ import { getStyleClassName } from "../../../../../utils";
6
+ import ComponentWithLabel from "../../../internal/componentWithLabel";
5
7
  import ColorPickerControl from "../picker";
6
8
  /** Color picker component with form label */
7
- function ColorPickerWithLabel({ className, title, preview, name, defaultValue, validationState, onValueChange, data, disabled = false, rounded = false, size, label, }) {
9
+ function ColorPickerWithLabel({ preview, name, defaultValue, validationState, onValueChange, disabled = false, rounded = false, size, label, className, title, data, hint, }) {
8
10
  const defaultColor = isNullOrUndefined(defaultValue)
9
11
  ? whiteHex
10
12
  : rgbToHex(defaultValue);
11
13
  const [value, setValue] = useState(defaultColor);
12
14
  const onChange = useCallback((event) => setValue(event.target.value), [setValue]);
13
15
  useEffect(() => onValueChange(hexToRgb(value)), [onValueChange, value]);
14
- const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
15
16
  const elClassName = getClassName([
16
17
  className,
17
- styleClassName,
18
18
  rounded ? "is-rounded" : "",
19
+ getStyleClassName(undefined, validationState),
19
20
  isNullOrUndefined(size) ? "" : `is-${size}`,
20
21
  "input",
21
22
  ]);
22
- const inputContainerClassName = getClassName([
23
- "control",
24
- "bbr-input",
25
- ]);
26
- const dataAttributes = isNullOrUndefined(data)
27
- ? undefined
28
- : mapDataAttributes(data);
29
- const id = name || generateGuid();
30
- const labelClassName = getClassName([
31
- "label",
32
- label.className
33
- ]);
34
- if (label.horizontal) {
35
- const labelContainerClassName = getClassName([
36
- "field-label",
37
- "is-normal",
38
- label.horizontalContainerClassName
39
- ]);
40
- const fieldContainerClassName = getClassName([
41
- "field-body",
42
- label.horizontalFieldContainerClassName
43
- ]);
44
- return (_jsxs("div", { className: "bbr-color-picker 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: _jsx("div", { className: "field", children: _jsx(ColorPickerControl, { id: id, value: value, title: title, disabled: disabled, previewConfig: preview, className: elClassName, onValueChange: onChange, defaultColor: defaultColor, styleClassName: styleClassName, dataAttributes: dataAttributes, validationMessages: validationMessages, isValidationDefined: isValidationDefined, containerClassName: inputContainerClassName }) }) })] }));
45
- }
46
- return (_jsxs("div", { className: "bbr-color-picker bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx(ColorPickerControl, { id: id, value: value, title: title, disabled: disabled, previewConfig: preview, className: elClassName, onValueChange: onChange, defaultColor: defaultColor, dataAttributes: dataAttributes, styleClassName: styleClassName, validationMessages: validationMessages, isValidationDefined: isValidationDefined, containerClassName: inputContainerClassName })] }));
23
+ const id = name ?? generateGuid();
24
+ return (_jsx(ComponentWithLabel, { id: id, label: label, size: size ?? ElementSize.Normal, children: _jsx(ColorPickerControl, { id: id, value: value, disabled: disabled, previewConfig: preview, elementClassName: elClassName, onValueChange: onChange, defaultValue: defaultColor, hint: hint, validationState: validationState, data: data, title: title }) }));
47
25
  }
48
26
  export default ColorPickerWithLabel;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ColorPickerProps } from "../..";
3
3
  /** Color picker component without form label */
4
- declare function ColorPickerWithoutLabel({ className, title, preview, name, defaultValue, validationState, onValueChange, data, disabled, rounded, size, }: ColorPickerProps): JSX.Element;
4
+ declare function ColorPickerWithoutLabel({ preview, name, defaultValue, validationState, onValueChange, disabled, rounded, size, className, title, data, hint, }: ColorPickerProps): JSX.Element;
5
5
  export default ColorPickerWithoutLabel;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,iBAAS,uBAAuB,CAAC,EAC7B,SAAS,EAAE,KAAK,EAChB,OAAO,EACP,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,aAAa,EACb,IAAI,EACJ,QAAgB,EAAE,OAAe,EAAE,IAAI,GAC1C,EAAE,gBAAgB,eAyDlB;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,iBAAS,uBAAuB,CAAC,EAC7B,OAAO,EACP,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,aAAa,EACb,QAAgB,EAAE,OAAe,EAAE,IAAI,EAEvC,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,GACP,EAAE,gBAAgB,eA6ClB;AAED,eAAe,uBAAuB,CAAC"}
@@ -1,32 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useState } from "react";
3
3
  import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whiteHex } from "@bodynarf/utils";
4
- import { getValidationValues, mapDataAttributes } from "../../../../..";
5
4
  import ColorPickerControl from "../picker";
6
5
  /** Color picker component without form label */
7
- function ColorPickerWithoutLabel({ className, title, preview, name, defaultValue, validationState, onValueChange, data, disabled = false, rounded = false, size, }) {
6
+ function ColorPickerWithoutLabel({ preview, name, defaultValue, validationState, onValueChange, disabled = false, rounded = false, size, className, title, data, hint, }) {
8
7
  const defaultColor = isNullOrUndefined(defaultValue)
9
8
  ? whiteHex
10
9
  : rgbToHex(defaultValue);
11
10
  const [value, setValue] = useState(defaultColor);
12
11
  const onChange = useCallback((event) => setValue(event.target.value), [setValue]);
13
12
  useEffect(() => onValueChange(hexToRgb(value)), [onValueChange, value]);
14
- const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
15
13
  const elClassName = getClassName([
16
14
  className,
17
- styleClassName,
18
15
  rounded ? "is-rounded" : "",
19
16
  isNullOrUndefined(size) ? "" : `is-${size}`,
20
17
  "input",
21
18
  ]);
22
- const containerClassName = getClassName([
23
- "control",
24
- "bbr-input",
25
- ]);
26
- const dataAttributes = isNullOrUndefined(data)
27
- ? undefined
28
- : mapDataAttributes(data);
29
- const id = name || generateGuid();
30
- return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: id, title: title, value: value, disabled: disabled, className: elClassName, previewConfig: preview, onValueChange: onChange, defaultColor: defaultColor, dataAttributes: dataAttributes, styleClassName: styleClassName, validationMessages: validationMessages, containerClassName: containerClassName, isValidationDefined: isValidationDefined }) }));
19
+ const id = name ?? generateGuid();
20
+ return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: id, value: value, disabled: disabled, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, data: data, title: title, hint: hint, validationState: validationState }) }));
31
21
  }
32
22
  export default ColorPickerWithoutLabel;
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { Color } from "@bodynarf/utils";
3
- import { BaseInputElementProps, ElementFloatPosition } from "../../..";
3
+ import { ElementFloatPosition, BaseInputElementProps } from "../../../types";
4
4
  /** Color picker props type */
5
5
  export interface ColorPickerProps extends Omit<BaseInputElementProps<Color>, "style" | "loading" | "readonly" | "placeholder"> {
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/color/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAEnE,8BAA8B;AAC9B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EACvE,OAAO,GAAG,SAAS,GACjB,UAAU,GAAG,aAAa,CAC/B;IACG;;;OAGG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC3D,gDAAgD;IAChD,kCAAkC,EAAE,MAAM,CAAC;IAE3C,sDAAsD;IACtD,uBAAuB,EAAE,MAAM,CAAC;CACnC;AAED,6DAA6D;AAC7D,MAAM,WAAW,wBAAwB;IACrC,mCAAmC;IACnC,QAAQ,EAAE,oBAAoB,CAAC;CAClC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/color/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEzE,8BAA8B;AAC9B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EACrE,OAAO,GAAG,SAAS,GACnB,UAAU,GAAG,aAAa,CAC/B;IACG;;;OAGG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACtC;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC3D,gDAAgD;IAChD,kCAAkC,EAAE,MAAM,CAAC;IAE3C,sDAAsD;IACtD,uBAAuB,EAAE,MAAM,CAAC;CACnC;AAED,6DAA6D;AAC7D,MAAM,WAAW,wBAAwB;IACrC,mCAAmC;IACnC,QAAQ,EAAE,oBAAoB,CAAC;CAClC"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import "../../../../common.scss";
3
- import { DateProps } from "../../date";
3
+ import { DateProps } from "../..";
4
4
  /** Date input component */
5
- declare const DatePicker: ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded, loading, style, label, onBlur }: DateProps) => JSX.Element;
5
+ declare const DatePicker: ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, rounded, loading, style, label, onBlur, className, title, data, hint, }: DateProps) => JSX.Element;
6
6
  export default DatePicker;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,yBAAyB,CAAC;AAKjC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,2BAA2B;AAC3B,QAAA,MAAM,UAAU,wIAMb,SAAS,KAAG,WA4Gd,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":";AASA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,4JASb,SAAS,KAAG,WA8Dd,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,21 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { generateGuid, getClassName, getValueOrDefault, isStringEmpty } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
4
+ import { ElementSize } from "../../../../types";
5
+ import { getStyleClassName, mapDataAttributes } from "../../../../utils";
6
+ import ComponentWithLabel from "../../internal/componentWithLabel";
7
+ import InternalHint from "../../internal/hint";
4
8
  import "../../../../common.scss";
5
- import { ElementSize } from "../../..";
6
- import { getValidationValues } from "../../../../utils";
7
9
  /** Date input component */
8
- const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded = false, loading = false, style, label, onBlur }) => {
10
+ const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, rounded = false, loading = false, style, label, onBlur, className, title, data, hint, }) => {
9
11
  const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value)
10
12
  ? undefined
11
13
  : new Date(event.target.value)), [onValueChange]);
12
- const id = name || generateGuid();
14
+ const id = name ?? generateGuid();
13
15
  const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
14
- const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
15
16
  const elClassName = getClassName([
16
17
  className,
17
18
  elSizeClassName,
18
- styleClassName,
19
+ getStyleClassName(style, validationState),
19
20
  rounded ? "is-rounded" : "",
20
21
  "input",
21
22
  ]);
@@ -24,25 +25,9 @@ const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validatio
24
25
  loading ? "is-loading" : "",
25
26
  ]);
26
27
  const stringifiedDefValue = defaultValue?.toISOString().split("T")[0];
27
- const labelClassName = getClassName([
28
- "label",
29
- !label.horizontal ? elSizeClassName : "",
30
- label.className
31
- ]);
32
- if (label.horizontal) {
33
- const labelContainerClassName = getClassName([
34
- "field-label",
35
- elSizeClassName,
36
- label.horizontalContainerClassName
37
- ]);
38
- const fieldContainerClassName = getClassName([
39
- "field-body",
40
- label.horizontalFieldContainerClassName
41
- ]);
42
- 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: "date", className: elClassName, readOnly: readonly, disabled: disabled, defaultValue: stringifiedDefValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
43
- _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
44
- }
45
- 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: "date", className: elClassName, readOnly: readonly, disabled: disabled, defaultValue: stringifiedDefValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
46
- _jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
28
+ const dataAttributes = isNullOrUndefined(data)
29
+ ? undefined
30
+ : mapDataAttributes(data);
31
+ return (_jsxs(ComponentWithLabel, { id: id, label: label, size: getValueOrDefault(size, ElementSize.Normal), children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", id: id, name: id, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, defaultValue: stringifiedDefValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
47
32
  };
48
33
  export default DatePicker;
@@ -1,8 +1,8 @@
1
- import { BaseInputElementProps, InputLabel } from "../..";
1
+ import { BaseInputElementProps, LabelConfiguration } from "../../../types";
2
2
  /** Date input component props type */
3
3
  export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder"> {
4
4
  /** Label configuration */
5
- label: InputLabel;
5
+ label: LabelConfiguration;
6
6
  /** Focus out event handler */
7
7
  onBlur?: () => void;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEpE,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC;IAC3F,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;IAElB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEvE,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC;IAC3F,0BAA0B;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAE1B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
@@ -5,5 +5,4 @@ export * from "./multiline";
5
5
  export * from "./number";
6
6
  export * from "./password";
7
7
  export * from "./text";
8
- export * from "./types";
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
@@ -5,4 +5,3 @@ export * from "./multiline";
5
5
  export * from "./number";
6
6
  export * from "./password";
7
7
  export * from "./text";
8
- export * from "./types";
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { ElementSize, LabelConfiguration } from "../../../../types";
3
+ /** Form input component with label props */
4
+ export interface ComponentWithLabelProps {
5
+ /** Label configuration */
6
+ label: LabelConfiguration;
7
+ /** Component size */
8
+ size: ElementSize;
9
+ /** Unique component identifier */
10
+ id: string;
11
+ /** Node element with input element */
12
+ children: React.ReactNode;
13
+ }
14
+ /** Form input component with describing label */
15
+ declare const ComponentWithLabel: ({ label, id, size, children, }: ComponentWithLabelProps) => JSX.Element;
16
+ export default ComponentWithLabel;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7D,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACpC,0BAA0B;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAE1B,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAElB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IAEX,sCAAsC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,iDAAiD;AACjD,QAAA,MAAM,kBAAkB,mCAIrB,uBAAuB,KAAG,WAoD5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassName, getValueOrDefault } from "@bodynarf/utils";
3
+ import { ElementSize } from "../../../../types";
4
+ /** Form input component with describing label */
5
+ const ComponentWithLabel = ({ label, id, size, children, }) => {
6
+ const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
7
+ const labelClassName = getClassName([
8
+ "label",
9
+ !label.horizontal ? elSizeClassName : "",
10
+ label.className
11
+ ]);
12
+ if (label.horizontal) {
13
+ const labelContainerClassName = getClassName([
14
+ "field-label",
15
+ elSizeClassName,
16
+ label.horizontalContainerClassName
17
+ ]);
18
+ const fieldContainerClassName = getClassName([
19
+ "field-body",
20
+ label.horizontalFieldContainerClassName
21
+ ]);
22
+ 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: _jsx("div", { className: "field", children: children }) })] }));
23
+ }
24
+ return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), children] }));
25
+ };
26
+ export default ComponentWithLabel;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { HintConfiguration, ValidationState } from "../../../../types";
3
+ /** Props of `InternalHint` */
4
+ interface HintProps {
5
+ /** @inheritdoc BaseInputElementProps.validationState */
6
+ validationState?: ValidationState;
7
+ /** @inheritdoc BaseInputElementProps.hint */
8
+ hint?: HintConfiguration;
9
+ }
10
+ /** Hint component for internal use (as form input elements hints) */
11
+ declare const InternalHint: ({ validationState, hint, }: HintProps) => JSX.Element;
12
+ export default InternalHint;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAgC,iBAAiB,EAAE,eAAe,EAAoB,MAAM,YAAY,CAAC;AAGhH,8BAA8B;AAC9B,UAAU,SAAS;IACf,wDAAwD;IACxD,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,qEAAqE;AACrE,QAAA,MAAM,YAAY,+BAEf,SAAS,KAAG,WAgDd,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { ElementPosition, ElementSize, ValidationStatus } from "../../../../types";
4
+ import Icon from "../../../icon";
5
+ /** Hint component for internal use (as form input elements hints) */
6
+ const InternalHint = ({ validationState, hint, }) => {
7
+ if (isNullOrUndefined(validationState) && isNullOrUndefined(hint)) {
8
+ return _jsx(_Fragment, {});
9
+ }
10
+ const validationStateDefined = !isNullOrUndefined(validationState)
11
+ && validationState.status !== ValidationStatus.None
12
+ && validationState.messages.length > 0;
13
+ if (validationStateDefined) {
14
+ const validationClassName = validationState.status === ValidationStatus.Valid
15
+ ? "is-success"
16
+ : "is-danger";
17
+ return (_jsx("p", { className: `help m-help ${validationClassName}`, children: validationState.messages.join("\n") }));
18
+ }
19
+ if (isNullOrUndefined(hint)) {
20
+ return (_jsx(_Fragment, {}));
21
+ }
22
+ const className = getClassName([
23
+ "bbr-hint",
24
+ "help",
25
+ "m-help",
26
+ (hint.grey ?? false) ? "has-text-grey" : undefined,
27
+ (hint.italic ?? false) ? "is-italic" : undefined,
28
+ ]);
29
+ if (!isNullOrUndefined(hint.icon)) {
30
+ return (_jsx(HintWithIcon, { ...hint, className: className }));
31
+ }
32
+ return (_jsx("p", { className: className, children: hint.content }));
33
+ };
34
+ export default InternalHint;
35
+ /** Hint element with icon */
36
+ const HintWithIcon = ({ className, content, icon, }) => {
37
+ const iconClassName = getClassName([
38
+ icon.className,
39
+ icon.position === ElementPosition.Right
40
+ ? "bbr-icon--right"
41
+ : "bbr-icon--left"
42
+ ]);
43
+ if (icon.position === ElementPosition.Right) {
44
+ return (_jsxs("p", { className: className, children: [content, _jsx(Icon, { name: icon.name, className: iconClassName, size: icon.size ?? ElementSize.Small })] }));
45
+ }
46
+ return (_jsxs("p", { className: className, children: [_jsx(Icon, { name: icon.name, className: iconClassName, size: icon.size ?? ElementSize.Small }), content] }));
47
+ };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import "../../../../common.scss";
3
- import { MultilineProps } from "../../multiline";
3
+ import { MultilineProps } from "..";
4
4
  /** Multiline textual input component */
5
5
  declare const Multiline: (props: MultilineProps) => JSX.Element;
6
6
  export default Multiline;
@@ -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,2BAA2B,CAAC;AAI3D,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAQ1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/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,15 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { isNullOrUndefined } from "@bodynarf/utils";
3
3
  import "../../../../common.scss";
4
- import MultilineWithoutLabel from "../../multiline/components/multilineWithoutLabel";
5
- import MultilineWithLabel from "../../multiline/components/multilineWithLabel";
4
+ import MultilineWithoutLabel from "../components/withoutLabel";
5
+ import MultilineWithLabel from "../components/withLabel";
6
6
  /** Multiline textual input component */
7
7
  const Multiline = (props) => {
8
- if (isNullOrUndefined(props.label)) {
9
- return (_jsx(MultilineWithoutLabel, { ...props }));
10
- }
11
- else {
12
- return (_jsx(MultilineWithLabel, { ...props }));
13
- }
8
+ return isNullOrUndefined(props.label)
9
+ ? _jsx(MultilineWithoutLabel, { ...props })
10
+ : _jsx(MultilineWithLabel, { ...props });
14
11
  };
15
12
  export default Multiline;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { MultilineProps } from "../..";
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;
5
+ export default MultilineWithLabel;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
4
+ import { ElementSize } from "../../../../../types";
5
+ import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
+ import ComponentWithLabel from "../../../internal/componentWithLabel";
7
+ import InternalHint from "../../../internal/hint";
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, }) => {
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
+ const elClassName = getClassName([
14
+ className,
15
+ elSizeClassName,
16
+ getStyleClassName(style, validationState),
17
+ "textarea",
18
+ fixed ? "has-fixed-size" : "",
19
+ ]);
20
+ const inputContainerClassName = getClassName([
21
+ "control",
22
+ loading ? "is-loading" : "",
23
+ ]);
24
+ const dataAttributes = isNullOrUndefined(data)
25
+ ? undefined
26
+ : 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 })] }));
28
+ };
29
+ export default MultilineWithLabel;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { MultilineProps } from "../..";
3
+ /** Multiline textual input component without describing label*/
4
+ declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading, fixed, rows, className, title, data, hint, }: MultilineProps) => JSX.Element;
5
+ export default MultilineWithoutLabel;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { generateGuid, getClassName, getValueOrDefault, isNullOrUndefined } from "@bodynarf/utils";
4
+ import { ElementSize } from "../../../../../types";
5
+ import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
+ import InternalHint from "../../../internal/hint";
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, }) => {
9
+ const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
10
+ const id = name ?? generateGuid();
11
+ const elClassName = getClassName([
12
+ className,
13
+ "is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
14
+ getStyleClassName(style, validationState),
15
+ "textarea",
16
+ fixed ? "has-fixed-size" : "",
17
+ ]);
18
+ const inputContainerClassName = getClassName([
19
+ "control",
20
+ "bbr-input",
21
+ loading ? "is-loading" : "",
22
+ ]);
23
+ const dataAttributes = isNullOrUndefined(data)
24
+ ? undefined
25
+ : 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 })] }));
27
+ };
28
+ export default MultilineWithoutLabel;
@@ -1,4 +1,4 @@
1
- import { BaseInputElementProps } from "../..";
1
+ import { BaseInputElementProps } from "../../../types";
2
2
  /** Multiline textual input component props type */
3
3
  export interface MultilineProps extends Omit<BaseInputElementProps<string>, "rounded"> {
4
4
  /** Is input should be resizable */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,mDAAmD;AACnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAClF,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,mDAAmD;AACnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAClF,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { NumberProps } from "../../number";
2
+ import { NumberProps } from "..";
3
3
  /** Number input component */
4
4
  declare const Number: (props: NumberProps) => JSX.Element;
5
5
  export default Number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,6BAA6B;AAC7B,QAAA,MAAM,MAAM,UAAW,WAAW,KAAG,WAOpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAIjC,6BAA6B;AAC7B,QAAA,MAAM,MAAM,UAAW,WAAW,KAAG,WAIpC,CAAC;AAEF,eAAe,MAAM,CAAC"}