@bodynarf/react.components 1.9.1 → 1.10.1

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 (159) hide show
  1. package/bodynarf-react.components-1.10.0.tgz +0 -0
  2. package/components/accordion/component/index.d.ts +1 -0
  3. package/components/accordion/component/index.d.ts.map +1 -1
  4. package/components/accordion/component/index.js +3 -3
  5. package/components/anchor/component/index.js +2 -2
  6. package/components/anchor/components/anchorWithIcon/index.d.ts +9 -2
  7. package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
  8. package/components/anchor/components/anchorWithIcon/index.js +2 -2
  9. package/components/anchor/components/simpleAnchor/index.d.ts +3 -2
  10. package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
  11. package/components/anchor/components/simpleAnchor/index.js +1 -1
  12. package/components/anchor/types.d.ts +3 -11
  13. package/components/anchor/types.d.ts.map +1 -1
  14. package/components/breadcrumbs/component/index.d.ts +7 -32
  15. package/components/breadcrumbs/component/index.d.ts.map +1 -1
  16. package/components/breadcrumbs/component/index.js +22 -6
  17. package/components/breadcrumbs/types.d.ts +30 -1
  18. package/components/breadcrumbs/types.d.ts.map +1 -1
  19. package/components/button/component/index.d.ts.map +1 -1
  20. package/components/button/component/index.js +3 -3
  21. package/components/button/types.d.ts +1 -1
  22. package/components/dropdown/component/style.scss +3 -3
  23. package/components/dropdown/components/compact/index.d.ts +8 -1
  24. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  25. package/components/dropdown/components/compact/index.js +17 -5
  26. package/components/dropdown/components/label/index.d.ts +1 -17
  27. package/components/dropdown/components/label/index.d.ts.map +1 -1
  28. package/components/dropdown/components/label/index.js +1 -54
  29. package/components/dropdown/components/withLabel/index.d.ts +3 -1
  30. package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
  31. package/components/dropdown/components/withLabel/index.js +8 -82
  32. package/components/dropdown/types.d.ts +8 -0
  33. package/components/dropdown/types.d.ts.map +1 -1
  34. package/components/icon/component/index.d.ts +3 -2
  35. package/components/icon/component/index.d.ts.map +1 -1
  36. package/components/icon/component/index.js +4 -3
  37. package/components/icon/types.d.ts +2 -0
  38. package/components/icon/types.d.ts.map +1 -1
  39. package/components/multiselect/component/index.d.ts +8 -0
  40. package/components/multiselect/component/index.d.ts.map +1 -0
  41. package/components/multiselect/component/index.js +13 -0
  42. package/components/multiselect/component/style.scss +20 -0
  43. package/components/multiselect/components/item/index.d.ts +25 -0
  44. package/components/multiselect/components/item/index.d.ts.map +1 -0
  45. package/components/multiselect/components/item/index.js +62 -0
  46. package/components/multiselect/components/label/component/index.d.ts +20 -0
  47. package/components/multiselect/components/label/component/index.d.ts.map +1 -0
  48. package/components/multiselect/components/label/component/index.js +12 -0
  49. package/components/multiselect/components/label/components/empty/index.d.ts +8 -0
  50. package/components/multiselect/components/label/components/empty/index.d.ts.map +1 -0
  51. package/components/multiselect/components/label/components/empty/index.js +16 -0
  52. package/components/multiselect/components/label/components/nonEmpty/index.d.ts +8 -0
  53. package/components/multiselect/components/label/components/nonEmpty/index.d.ts.map +1 -0
  54. package/components/multiselect/components/label/components/nonEmpty/index.js +16 -0
  55. package/components/multiselect/components/label/index.d.ts +2 -0
  56. package/components/multiselect/components/label/index.d.ts.map +1 -0
  57. package/components/multiselect/components/label/index.js +1 -0
  58. package/components/multiselect/components/withLabel/index.d.ts +6 -0
  59. package/components/multiselect/components/withLabel/index.d.ts.map +1 -0
  60. package/components/multiselect/components/withLabel/index.js +11 -0
  61. package/components/multiselect/components/withoutLabel/index.d.ts +10 -0
  62. package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -0
  63. package/components/multiselect/components/withoutLabel/index.js +84 -0
  64. package/components/multiselect/index.d.ts +3 -0
  65. package/components/multiselect/index.d.ts.map +1 -0
  66. package/components/multiselect/index.js +2 -0
  67. package/components/multiselect/types.d.ts +41 -0
  68. package/components/multiselect/types.d.ts.map +1 -0
  69. package/components/multiselect/types.js +1 -0
  70. package/components/paginator/component/index.d.ts.map +1 -1
  71. package/components/paginator/component/index.js +22 -5
  72. package/components/paginator/index.d.ts +0 -1
  73. package/components/paginator/index.d.ts.map +1 -1
  74. package/components/paginator/index.js +0 -1
  75. package/components/primitives/checkbox/component/index.d.ts +2 -1
  76. package/components/primitives/checkbox/component/index.d.ts.map +1 -1
  77. package/components/primitives/checkbox/component/index.js +8 -6
  78. package/components/primitives/checkbox/component/style.scss +22 -3
  79. package/components/primitives/color/components/picker/index.d.ts +3 -3
  80. package/components/primitives/color/components/picker/index.d.ts.map +1 -1
  81. package/components/primitives/color/components/picker/index.js +8 -8
  82. package/components/primitives/color/components/withLabel/index.d.ts +1 -1
  83. package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
  84. package/components/primitives/color/components/withLabel/index.js +3 -4
  85. package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
  86. package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
  87. package/components/primitives/color/components/withoutLabel/index.js +2 -3
  88. package/components/primitives/date/component/index.d.ts +3 -2
  89. package/components/primitives/date/component/index.d.ts.map +1 -1
  90. package/components/primitives/date/component/index.js +5 -7
  91. package/components/primitives/date/component/style.scss +11 -0
  92. package/components/primitives/date/types.d.ts +1 -1
  93. package/components/primitives/date/types.d.ts.map +1 -1
  94. package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
  95. package/components/primitives/internal/componentWithLabel/index.js +2 -2
  96. package/components/primitives/internal/hint/index.d.ts +4 -7
  97. package/components/primitives/internal/hint/index.d.ts.map +1 -1
  98. package/components/primitives/internal/hint/index.js +1 -0
  99. package/components/primitives/internal/hint/style.scss +4 -0
  100. package/components/primitives/multiline/component/index.d.ts +0 -1
  101. package/components/primitives/multiline/component/index.d.ts.map +1 -1
  102. package/components/primitives/multiline/component/index.js +0 -1
  103. package/components/primitives/multiline/components/withLabel/index.d.ts +2 -1
  104. package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
  105. package/components/primitives/multiline/components/withLabel/index.js +4 -6
  106. package/components/primitives/multiline/components/withoutLabel/index.d.ts +1 -0
  107. package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
  108. package/components/primitives/multiline/components/withoutLabel/index.js +4 -5
  109. package/components/primitives/number/components/withLabel/index.d.ts +2 -1
  110. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  111. package/components/primitives/number/components/withLabel/index.js +4 -6
  112. package/components/primitives/number/components/withoutLabel/index.d.ts +2 -1
  113. package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
  114. package/components/primitives/number/components/withoutLabel/index.js +5 -6
  115. package/components/primitives/password/components/withLabel/index.d.ts +2 -1
  116. package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
  117. package/components/primitives/password/components/withLabel/index.js +5 -6
  118. package/components/primitives/password/components/withoutLabel/index.d.ts +1 -0
  119. package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
  120. package/components/primitives/password/components/withoutLabel/index.js +6 -7
  121. package/components/primitives/text/component/index.d.ts +0 -1
  122. package/components/primitives/text/component/index.d.ts.map +1 -1
  123. package/components/primitives/text/component/index.js +0 -1
  124. package/components/primitives/text/components/withLabel/index.d.ts +1 -0
  125. package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
  126. package/components/primitives/text/components/withLabel/index.js +4 -6
  127. package/components/primitives/text/components/withoutLabel/index.d.ts +2 -1
  128. package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -1
  129. package/components/primitives/text/components/withoutLabel/index.js +5 -6
  130. package/components/search/component/index.d.ts.map +1 -1
  131. package/components/search/component/index.js +6 -8
  132. package/components/table/component/index.d.ts +1 -35
  133. package/components/table/component/index.d.ts.map +1 -1
  134. package/components/table/component/index.js +1 -1
  135. package/components/table/types.d.ts +36 -1
  136. package/components/table/types.d.ts.map +1 -1
  137. package/components/tabs/component/index.d.ts +3 -26
  138. package/components/tabs/component/index.d.ts.map +1 -1
  139. package/components/tabs/component/index.js +3 -3
  140. package/components/tabs/types.d.ts +24 -1
  141. package/components/tabs/types.d.ts.map +1 -1
  142. package/components/tag/component/index.d.ts +1 -0
  143. package/components/tag/component/index.d.ts.map +1 -1
  144. package/components/tag/component/index.js +3 -3
  145. package/components/tag/types.d.ts +3 -3
  146. package/components/tag/types.d.ts.map +1 -1
  147. package/hooks/index.d.ts +1 -0
  148. package/hooks/index.d.ts.map +1 -1
  149. package/hooks/index.js +1 -0
  150. package/hooks/useComponentOutsideClick.d.ts.map +1 -1
  151. package/hooks/useComponentOutsideClick.js +2 -3
  152. package/package.json +2 -2
  153. package/readme.md +5 -3
  154. package/tsconfig.tsbuildinfo +1 -1
  155. package/bodynarf-react.components-1.9.3.tgz +0 -0
  156. package/common.scss +0 -8
  157. package/components/paginator/utils.d.ts +0 -10
  158. package/components/paginator/utils.d.ts.map +0 -1
  159. package/components/paginator/utils.js +0 -18
@@ -2,13 +2,12 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useCallback, useMemo } from "react";
3
3
  import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
4
4
  import { mapDataAttributes } from "../../../utils";
5
- import { ElementPosition } from "../../../types";
6
- import { generatePageNumbers } from "../..";
5
+ import { ElementPosition, ElementSize } from "../../../types";
7
6
  /**
8
7
  * Paginator component.
9
8
  * Used for visualization of paging configuration
10
9
  */
11
- export default function Paginator({ count, onPageChange, currentPage = 0, position = ElementPosition.Left, size, rounded = false, showNextButtons = false, nearPagesCount, className, title, data, }) {
10
+ export default function Paginator({ count, onPageChange, currentPage = 0, position = ElementPosition.Left, size = ElementSize.Normal, rounded = false, showNextButtons = false, nearPagesCount = 3, className, title, data, }) {
12
11
  const pageChange = useCallback((event) => {
13
12
  const target = event.target;
14
13
  const pageRaw = target.dataset["page"];
@@ -32,12 +31,12 @@ export default function Paginator({ count, onPageChange, currentPage = 0, positi
32
31
  className,
33
32
  paginationPositionToClassMap.get(position),
34
33
  rounded ? "is-rounded" : "",
35
- isNullOrEmpty(size) ? "" : `is-${size}`,
34
+ size === ElementSize.Normal ? "" : `is-${size}`,
36
35
  ]);
37
36
  const dataAttributes = isNullOrUndefined(data)
38
37
  ? undefined
39
38
  : mapDataAttributes(data);
40
- return (_jsxs("nav", { className: classNames, role: "navigation", "aria-label": "pagination", title: title, ...dataAttributes, children: [showNextButtons &&
39
+ return (_jsxs("nav", { role: "navigation", className: classNames, "aria-label": "pagination", title: title, ...dataAttributes, children: [showNextButtons &&
41
40
  _jsxs(_Fragment, { children: [_jsx("a", { className: `pagination-previous${canGoBack ? "" : " is-disabled"}`, "data-page": currentPage - 1, onClick: pageChange, children: "Previous" }), _jsx("a", { className: `pagination-next${canGoForward ? "" : " is-disabled"}`, "data-page": currentPage + 1, onClick: pageChange, children: "Next page" })] }), _jsxs("ul", { className: "pagination-list", children: [currentPage !== 1 && !pageNumbers.includes(1) &&
42
41
  _jsxs(_Fragment, { children: [_jsx("li", { children: _jsx("a", { className: "pagination-link", "aria-label": "Goto page 1", "data-page": 1, onClick: pageChange, children: "1" }) }), _jsx("li", { children: _jsx("span", { className: "pagination-ellipsis", children: "\u2026" }) })] }), pageNumbers.map(x => _jsx("li", { children: _jsx("a", { className: `pagination-link${currentPage === x ? " is-current" : ""}`, "aria-label": `Goto page ${x}`, "data-page": x, onClick: pageChange, children: x }) }, x)), currentPage != count && !pageNumbers.includes(count) &&
43
42
  _jsxs(_Fragment, { children: [_jsx("li", { children: _jsx("span", { className: "pagination-ellipsis", children: "\u2026" }) }), _jsx("li", { children: _jsx("a", { className: "pagination-link", "aria-label": `Goto page ${count}`, "data-page": count, onClick: pageChange, children: count }) })] })] })] }));
@@ -50,3 +49,21 @@ const paginationPositionToClassMap = new Map([
50
49
  [ElementPosition.Center, "is-centered"],
51
50
  [ElementPosition.Right, "is-right"]
52
51
  ]);
52
+ /**
53
+ * Get nearest numbers from each side (left & right)
54
+ * @param page Number of current page
55
+ * @param count Amount of pages
56
+ * @param size Amount of pages from left & right to current page
57
+ * @throws Current page is greater than pages amount
58
+ * @returns Array of nearest numbers to current page
59
+ */
60
+ const generatePageNumbers = (page, count, size) => {
61
+ if (page < 0 || count <= 0 || page > count) {
62
+ return [];
63
+ }
64
+ return [
65
+ ...new Array(size).fill(page).map((_, i) => page - i - 1).filter(x => x > 0 && x < page).reverse(),
66
+ page,
67
+ ...new Array(size).fill(page).map((_, i) => page + i + 1).filter(x => x > 0 && x > page && x <= count)
68
+ ];
69
+ };
@@ -1,4 +1,3 @@
1
1
  export { default } from "./component";
2
2
  export * from "./types";
3
- export * from "./utils";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export { default } from "./component";
2
2
  export * from "./types";
3
- export * from "./utils";
@@ -1,6 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import "./style.scss";
2
3
  import { CheckBoxProps } from "../..";
3
4
  /** Boolean input component */
4
- declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, size, style, rounded, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, className, title, data, }: CheckBoxProps) => JSX.Element;
5
+ declare const CheckBox: ({ onValueChange, defaultValue, label, name, size, style, disabled, rounded, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, className, title, data, }: CheckBoxProps) => JSX.Element;
5
6
  export default CheckBox;
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":"AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,qLASX,aAAa,KAAG,WA8ElB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,qLAWX,aAAa,KAAG,WAoFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -6,16 +6,15 @@ import { mapDataAttributes } from "../../../../utils";
6
6
  import ComponentWithLabel from "../../internal/componentWithLabel";
7
7
  import "./style.scss";
8
8
  /** Boolean input component */
9
- const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, size, style, rounded = false, block = false, withoutBorder = false, hasBackgroundColor = false, fixBackgroundColor = false, isFormLabel = false, className, title, data, }) => {
9
+ const CheckBox = ({ onValueChange, defaultValue, label, name = generateGuid(), size = ElementSize.Normal, style, disabled = false, rounded = false, block = false, withoutBorder = false, hasBackgroundColor = false, fixBackgroundColor = false, isFormLabel = false, className, title, data, }) => {
10
10
  const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
11
- const id = name ?? generateGuid();
12
11
  const elClassName = getClassName([
13
12
  "is-checkradio",
14
13
  "m-check-radio",
15
14
  className,
16
15
  hasBackgroundColor ? "has-background-color" : "",
17
16
  fixBackgroundColor && hasBackgroundColor ? "m-has-background-color" : "",
18
- isNullOrUndefined(size) ? "" : size === "normal" ? "" : `is-${size}`,
17
+ size === ElementSize.Normal ? "" : `is-${size}`,
19
18
  rounded ? "is-circle" : "",
20
19
  isNullOrUndefined(style) ? "" : `is-${style}`,
21
20
  block ? "is-block" : "",
@@ -25,11 +24,14 @@ const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, size, st
25
24
  ? undefined
26
25
  : mapDataAttributes(data);
27
26
  if (!isNullOrUndefined(label) && isFormLabel) {
28
- return (_jsxs(ComponentWithLabel, { id: id, label: {
27
+ return (_jsxs(ComponentWithLabel, { id: name, label: {
29
28
  ...label,
30
29
  horizontalContainerClassName: getClassName([label.horizontalContainerClassName, "p-0"]),
31
- }, size: ElementSize.Normal, children: [_jsx("input", { type: "checkbox", id: id, name: id, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, title: title, ...dataAttributes }), _jsx("label", { htmlFor: id })] }));
30
+ }, size: ElementSize.Normal, children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, title: title, ...dataAttributes }), _jsx("label", { className: "is-empty", htmlFor: name })] }));
32
31
  }
33
- return (_jsxs("div", { className: "bbr-input field", children: [_jsx("input", { type: "checkbox", id: id, name: id, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, title: title, ...dataAttributes }), _jsx("label", { htmlFor: id, children: label?.caption })] }));
32
+ const labelClassName = isNullOrUndefined(label)
33
+ ? "is-empty"
34
+ : undefined;
35
+ return (_jsxs("div", { className: "bbr-field bbr-input field mr-2", children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, title: title, ...dataAttributes }), _jsx("label", { htmlFor: name, className: labelClassName, children: label?.caption })] }));
34
36
  };
35
37
  export default CheckBox;
@@ -3,8 +3,27 @@
3
3
  border-color: #dbdbdb !important;
4
4
  background-color: transparent !important;
5
5
  }
6
- & + label::before,
7
- & + label:before {
8
- top: 0.125rem;
6
+
7
+ &.is-block + label.is-empty {
8
+ &::before {
9
+ left: 0.25rem !important;
10
+ top: 0.25rem !important;
11
+ }
12
+
13
+ &::after {
14
+ top: 0.45rem;
15
+ left: 0.7rem;
16
+ }
17
+ }
18
+
19
+ &:not(.is-block) + label {
20
+ &::after {
21
+ top: 0.275rem;
22
+ }
23
+ }
24
+
25
+ & + label.is-empty {
26
+ padding-left: 1rem;
27
+ margin: 0 !important;
9
28
  }
10
29
  }
@@ -3,8 +3,6 @@ import { BaseInputElementProps } from "../../../../../types";
3
3
  import { ColorPickerPreviewConfig } from "../..";
4
4
  /** Props of `ColorPickerControl` */
5
5
  export interface ColorPickerControlProps extends Omit<BaseInputElementProps<string>, "onValueChange" | "placeholder" | "rounded" | "readonly" | "loading" | "className"> {
6
- /** Preview element configuration */
7
- previewConfig?: ColorPickerPreviewConfig;
8
6
  /** Current color value */
9
7
  value: string;
10
8
  /** Control unique identifier */
@@ -13,8 +11,10 @@ export interface ColorPickerControlProps extends Omit<BaseInputElementProps<stri
13
11
  elementClassName: string;
14
12
  /** Handler of control value change*/
15
13
  onValueChange: (event: ChangeEvent<HTMLInputElement>) => void;
14
+ /** Preview element configuration */
15
+ previewConfig?: ColorPickerPreviewConfig;
16
16
  }
17
17
  /** Color picker container component */
18
- declare const ColorPickerControl: ({ elementClassName, disabled, previewConfig, size, defaultValue, onValueChange, value, id, title, data, hint, validationState, }: ColorPickerControlProps) => JSX.Element;
18
+ declare const ColorPickerControl: ({ value, defaultValue, onValueChange, elementClassName, disabled, previewConfig, size, id, title, data, hint, validationState, }: ColorPickerControlProps) => JSX.Element;
19
19
  export default ColorPickerControl;
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/picker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3E,oCAAoC;AACpC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACjD,qBAAqB,CAAC,MAAM,CAAC,EAC3B,eAAe,GAAG,aAAa,GAC/B,SAAS,GAAG,UAAU,GACtB,SAAS,GAAG,WAAW,CAC5B;IACG,oCAAoC;IACpC,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAEzC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,6BAA6B;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IAEzB,qCAAqC;IACrC,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACjE;AAED,uCAAuC;AACvC,QAAA,MAAM,kBAAkB,qIAOrB,uBAAuB,KAAG,WA0C5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/picker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3E,oCAAoC;AACpC,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACjD,qBAAqB,CAAC,MAAM,CAAC,EAC3B,eAAe,GAAG,aAAa,GAC/B,SAAS,GAAG,UAAU,GACtB,SAAS,GAAG,WAAW,CAC5B;IACG,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,6BAA6B;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IAEzB,qCAAqC;IACrC,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAE9D,oCAAoC;IACpC,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC5C;AAED,uCAAuC;AACvC,QAAA,MAAM,kBAAkB,qIAQrB,uBAAuB,KAAG,WA0C5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -4,11 +4,11 @@ import { ElementPosition } from "../../../../../types";
4
4
  import { mapDataAttributes } from "../../../../../utils";
5
5
  import InternalHint from "../../../internal/hint";
6
6
  /** Color picker container component */
7
- const ColorPickerControl = ({ elementClassName, disabled, previewConfig, size, defaultValue, onValueChange, value, id, title, data, hint, validationState, }) => {
7
+ const ColorPickerControl = ({ value, defaultValue, onValueChange, elementClassName, disabled = false, previewConfig, size, id, title, data, hint, validationState, }) => {
8
8
  if (!isNullOrUndefined(previewConfig)) {
9
- return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled, elementClassName: elementClassName, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, title: title, data: data }));
9
+ return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, elementClassName: elementClassName, data: data, title: title }));
10
10
  }
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
+ 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, ...data, title: title }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
12
12
  };
13
13
  export default ColorPickerControl;
14
14
  /** Picker sub component with preview */
@@ -29,14 +29,14 @@ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onV
29
29
  "is-flex-grow-1",
30
30
  previewConfig.position === ElementPosition.Left ? "ml-1" : "mr-1",
31
31
  ]);
32
- if (previewConfig.position === ElementPosition.Left) {
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: {
32
+ if (previewConfig.position === ElementPosition.Right) {
33
+ 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: {
34
34
  "--color-picker__background-color": value,
35
35
  "--color-picker__color": color,
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 })] }));
36
+ }, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
37
37
  }
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: {
38
+ return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("button", { className: classNames, style: {
39
39
  "--color-picker__background-color": value,
40
40
  "--color-picker__color": color,
41
- }, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
41
+ }, 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 })] }));
42
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({ preview, name, defaultValue, validationState, onValueChange, disabled, rounded, size, label, className, title, data, hint, }: ColorPickerProps): JSX.Element;
4
+ declare function ColorPickerWithLabel({ preview, name, defaultValue, onValueChange, validationState, disabled, rounded, size, label, hint, className, title, data, }: 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":";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
+ {"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,IAAqB,EACrB,YAAY,EAAE,aAAa,EAC3B,eAAe,EACf,QAAgB,EAAE,OAAe,EAAE,IAAyB,EAC5D,KAAK,EAEL,IAAI,EACJ,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,gBAAgB,eAgDlB;AAED,eAAe,oBAAoB,CAAC"}
@@ -6,7 +6,7 @@ import { getStyleClassName } from "../../../../../utils";
6
6
  import ComponentWithLabel from "../../../internal/componentWithLabel";
7
7
  import ColorPickerControl from "../picker";
8
8
  /** Color picker component with form label */
9
- function ColorPickerWithLabel({ preview, name, defaultValue, validationState, onValueChange, disabled = false, rounded = false, size, label, className, title, data, hint, }) {
9
+ function ColorPickerWithLabel({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size = ElementSize.Normal, label, hint, className, title, data, }) {
10
10
  const defaultColor = isNullOrUndefined(defaultValue)
11
11
  ? whiteHex
12
12
  : rgbToHex(defaultValue);
@@ -17,10 +17,9 @@ function ColorPickerWithLabel({ preview, name, defaultValue, validationState, on
17
17
  className,
18
18
  rounded ? "is-rounded" : "",
19
19
  getStyleClassName(undefined, validationState),
20
- isNullOrUndefined(size) ? "" : `is-${size}`,
20
+ size === ElementSize.Normal ? "" : `is-${size}`,
21
21
  "input",
22
22
  ]);
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 }) }));
23
+ return (_jsx(ComponentWithLabel, { id: name, size: size, label: label, children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, hint: hint, validationState: validationState, data: data, title: title }) }));
25
24
  }
26
25
  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({ preview, name, defaultValue, validationState, onValueChange, disabled, rounded, size, className, title, data, hint, }: ColorPickerProps): JSX.Element;
4
+ declare function ColorPickerWithoutLabel({ preview, name, defaultValue, onValueChange, validationState, 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":";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
+ {"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,IAAqB,EACrB,YAAY,EAAE,aAAa,EAC3B,eAAe,EACf,QAAgB,EAAE,OAAe,EAAE,IAAI,EAEvC,SAAS,EAAE,KAAK,EAAE,IAAI,EACtB,IAAI,GACP,EAAE,gBAAgB,eA6ClB;AAED,eAAe,uBAAuB,CAAC"}
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from "react";
3
3
  import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whiteHex } from "@bodynarf/utils";
4
4
  import ColorPickerControl from "../picker";
5
5
  /** Color picker component without form label */
6
- function ColorPickerWithoutLabel({ preview, name, defaultValue, validationState, onValueChange, disabled = false, rounded = false, size, className, title, data, hint, }) {
6
+ function ColorPickerWithoutLabel({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size, className, title, data, hint, }) {
7
7
  const defaultColor = isNullOrUndefined(defaultValue)
8
8
  ? whiteHex
9
9
  : rgbToHex(defaultValue);
@@ -16,7 +16,6 @@ function ColorPickerWithoutLabel({ preview, name, defaultValue, validationState,
16
16
  isNullOrUndefined(size) ? "" : `is-${size}`,
17
17
  "input",
18
18
  ]);
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 }) }));
19
+ return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, data: data, title: title, hint: hint, validationState: validationState }) }));
21
20
  }
22
21
  export default ColorPickerWithoutLabel;
@@ -1,6 +1,7 @@
1
- import "../../../../common.scss";
1
+ /// <reference types="react" />
2
+ import "./style.scss";
2
3
  import { DateProps } from "../..";
3
4
  /** Date input component */
4
- declare const DatePicker: ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, rounded, loading, style, label, onBlur, className, title, data, hint, }: DateProps) => JSX.Element;
5
+ declare const DatePicker: ({ defaultValue, onValueChange, validationState, name, style, size, readonly, disabled, rounded, loading, label, onBlur, className, title, data, hint, }: DateProps) => JSX.Element;
5
6
  export default DatePicker;
6
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":"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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":";AASA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,4JAWb,SAAS,KAAG,WA2Dd,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,21 +1,19 @@
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
- import "../../../../common.scss";
8
+ import "./style.scss";
9
9
  /** Date input component */
10
- const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, rounded = false, loading = false, style, label, onBlur, className, title, data, hint, }) => {
10
+ const DatePicker = ({ defaultValue, onValueChange, validationState, name = generateGuid(), style, size = ElementSize.Normal, readonly = false, disabled = false, rounded = false, loading = false, label, onBlur, className, title, data, hint, }) => {
11
11
  const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value)
12
12
  ? undefined
13
13
  : new Date(event.target.value)), [onValueChange]);
14
- const id = name ?? generateGuid();
15
- const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
16
14
  const elClassName = getClassName([
17
15
  className,
18
- elSizeClassName,
16
+ size === ElementSize.Normal ? "" : `is-${size}`,
19
17
  getStyleClassName(style, validationState),
20
18
  rounded ? "is-rounded" : "",
21
19
  "input",
@@ -28,6 +26,6 @@ const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validatio
28
26
  const dataAttributes = isNullOrUndefined(data)
29
27
  ? undefined
30
28
  : 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 })] }));
29
+ return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, defaultValue: stringifiedDefValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
32
30
  };
33
31
  export default DatePicker;
@@ -0,0 +1,11 @@
1
+ .control.is-loading input[type="date"]::-webkit-calendar-picker-indicator {
2
+ display: none;
3
+ }
4
+
5
+ .control input[type="date"] {
6
+ &::-webkit-calendar-picker-indicator {
7
+ position: absolute;
8
+ right: 0.75rem;
9
+ cursor: pointer;
10
+ }
11
+ }
@@ -1,6 +1,6 @@
1
1
  import { BaseInputElementProps, LabelConfiguration } from "../../../types";
2
2
  /** Date input component props type */
3
- export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder"> {
3
+ export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder" | "label"> {
4
4
  /** Label configuration */
5
5
  label: LabelConfiguration;
6
6
  /** Focus out event handler */
@@ -1 +1 @@
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"}
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,CACnC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EACvC,aAAa,GAAG,OAAO,CAC1B;IACG,0BAA0B;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAE1B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
@@ -1 +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"}
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,mCAGrB,uBAAuB,KAAG,WAwD5B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -19,8 +19,8 @@ const ComponentWithLabel = ({ label, id, size, children, }) => {
19
19
  "field-body",
20
20
  label.horizontalFieldContainerClassName
21
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 }) })] }));
22
+ return (_jsxs("div", { className: "bbr-field 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
23
  }
24
- return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), children] }));
24
+ return (_jsxs("div", { className: "bbr-field bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), children] }));
25
25
  };
26
26
  export default ComponentWithLabel;
@@ -1,11 +1,8 @@
1
- import { HintConfiguration, ValidationState } from "../../../../types";
1
+ /// <reference types="react" />
2
+ import { BaseInputElementProps } from "../../../../types";
3
+ import "./style.scss";
2
4
  /** Props of `InternalHint` */
3
- interface HintProps {
4
- /** @inheritdoc BaseInputElementProps.validationState */
5
- validationState?: ValidationState;
6
- /** @inheritdoc BaseInputElementProps.hint */
7
- hint?: HintConfiguration;
8
- }
5
+ declare type HintProps = Pick<BaseInputElementProps<any>, "validationState" | "hint">;
9
6
  /** Hint component for internal use (as form input elements hints) */
10
7
  declare const InternalHint: ({ validationState, hint, }: HintProps) => JSX.Element;
11
8
  export default InternalHint;
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,qBAAqB,EAAqE,MAAM,YAAY,CAAC;AAGtH,OAAO,cAAc,CAAC;AAEtB,8BAA8B;AAC9B,aAAK,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,CAAC;AAE9E,qEAAqE;AACrE,QAAA,MAAM,YAAY,+BAEf,SAAS,KAAG,WAgDd,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -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,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { MultilineProps } from "../..";
2
3
  /** Multiline textual input component with describing label */
3
- 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;
4
5
  export default MultilineWithLabel;
5
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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { MultilineProps } from "../..";
2
3
  /** Multiline textual input component without describing label*/
3
4
  declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading, fixed, rows, className, title, data, hint, }: MultilineProps) => JSX.Element;
@@ -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,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { NumberProps } from "../..";
2
3
  /** Number component with label */
3
- 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;
4
5
  export default NumberWithLabel;
5
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"}