@bodynarf/react.components 1.13.5 → 1.13.6

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 (171) hide show
  1. package/components/accordion/component/index.d.ts.map +1 -1
  2. package/components/accordion/component/index.js +7 -9
  3. package/components/accordion/types.d.ts +2 -2
  4. package/components/accordion/types.d.ts.map +1 -1
  5. package/components/anchor/types.d.ts +1 -1
  6. package/components/breadcrumbs/component/index.d.ts.map +1 -1
  7. package/components/breadcrumbs/component/index.js +9 -11
  8. package/components/breadcrumbs/types.d.ts +16 -16
  9. package/components/breadcrumbs/types.d.ts.map +1 -1
  10. package/components/button/component/index.js +3 -3
  11. package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
  12. package/components/button/components/buttonWithIcon/index.js +4 -6
  13. package/components/button/components/simpleButton/index.d.ts.map +1 -1
  14. package/components/button/components/simpleButton/index.js +2 -5
  15. package/components/button/types.d.ts +2 -2
  16. package/components/button/types.d.ts.map +1 -1
  17. package/components/dropdown/component/index.d.ts.map +1 -1
  18. package/components/dropdown/component/index.js +6 -3
  19. package/components/dropdown/component/style.scss +13 -0
  20. package/components/dropdown/components/compact/index.d.ts.map +1 -1
  21. package/components/dropdown/components/compact/index.js +22 -11
  22. package/components/dropdown/components/item/index.js +6 -6
  23. package/components/dropdown/components/label/component/index.d.ts +4 -4
  24. package/components/dropdown/components/label/component/index.d.ts.map +1 -1
  25. package/components/dropdown/components/label/component/index.js +4 -4
  26. package/components/dropdown/components/label/components/selected/index.d.ts +1 -1
  27. package/components/dropdown/components/label/components/selected/index.d.ts.map +1 -1
  28. package/components/dropdown/components/label/components/selected/index.js +5 -5
  29. package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts +1 -1
  30. package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts.map +1 -1
  31. package/components/dropdown/components/label/components/selectedWithIcon/index.js +4 -4
  32. package/components/dropdown/components/label/components/withSearch/index.js +3 -3
  33. package/components/dropdown/components/withLabel/index.d.ts +2 -1
  34. package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
  35. package/components/dropdown/components/withLabel/index.js +3 -1
  36. package/components/file/component/index.d.ts.map +1 -1
  37. package/components/file/component/index.js +6 -8
  38. package/components/icon/component/index.d.ts.map +1 -1
  39. package/components/icon/component/index.js +2 -4
  40. package/components/index.d.ts +33 -1
  41. package/components/index.d.ts.map +1 -1
  42. package/components/index.js +35 -1
  43. package/components/multiselect/component/index.d.ts.map +1 -1
  44. package/components/multiselect/component/index.js +6 -3
  45. package/components/multiselect/component/style.scss +13 -0
  46. package/components/multiselect/components/item/index.d.ts.map +1 -1
  47. package/components/multiselect/components/item/index.js +5 -5
  48. package/components/multiselect/components/label/components/empty/index.js +1 -1
  49. package/components/multiselect/components/label/components/nonEmpty/index.js +1 -1
  50. package/components/multiselect/components/withLabel/index.d.ts +2 -1
  51. package/components/multiselect/components/withLabel/index.d.ts.map +1 -1
  52. package/components/multiselect/components/withLabel/index.js +3 -1
  53. package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -1
  54. package/components/multiselect/components/withoutLabel/index.js +23 -9
  55. package/components/multiselect/types.d.ts +8 -8
  56. package/components/multiselect/types.d.ts.map +1 -1
  57. package/components/paginator/component/index.d.ts.map +1 -1
  58. package/components/paginator/component/index.js +10 -12
  59. package/components/paginator/types.d.ts +2 -2
  60. package/components/paginator/types.d.ts.map +1 -1
  61. package/components/primitives/checkbox/component/index.d.ts.map +1 -1
  62. package/components/primitives/checkbox/component/index.js +9 -11
  63. package/components/primitives/color/component/index.d.ts.map +1 -1
  64. package/components/primitives/color/component/index.js +7 -3
  65. package/components/primitives/color/components/picker/index.d.ts +3 -3
  66. package/components/primitives/color/components/picker/index.d.ts.map +1 -1
  67. package/components/primitives/color/components/picker/index.js +9 -10
  68. package/components/primitives/color/components/withLabel/index.d.ts +2 -1
  69. package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
  70. package/components/primitives/color/components/withLabel/index.js +5 -5
  71. package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
  72. package/components/primitives/color/components/withoutLabel/index.js +5 -4
  73. package/components/primitives/color/types.d.ts +1 -1
  74. package/components/primitives/color/types.d.ts.map +1 -1
  75. package/components/primitives/date/component/index.d.ts +2 -1
  76. package/components/primitives/date/component/index.d.ts.map +1 -1
  77. package/components/primitives/date/component/index.js +6 -6
  78. package/components/primitives/date/types.d.ts +2 -2
  79. package/components/primitives/date/types.d.ts.map +1 -1
  80. package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
  81. package/components/primitives/internal/componentWithLabel/index.js +2 -2
  82. package/components/primitives/internal/hint/index.d.ts.map +1 -1
  83. package/components/primitives/internal/hint/index.js +6 -6
  84. package/components/primitives/multiline/component/index.d.ts.map +1 -1
  85. package/components/primitives/multiline/component/index.js +6 -3
  86. package/components/primitives/multiline/components/withLabel/index.d.ts +2 -1
  87. package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
  88. package/components/primitives/multiline/components/withLabel/index.js +6 -6
  89. package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
  90. package/components/primitives/multiline/components/withoutLabel/index.js +6 -8
  91. package/components/primitives/multiline/types.d.ts +2 -2
  92. package/components/primitives/multiline/types.d.ts.map +1 -1
  93. package/components/primitives/number/component/index.d.ts.map +1 -1
  94. package/components/primitives/number/component/index.js +6 -3
  95. package/components/primitives/number/components/withLabel/index.d.ts +2 -1
  96. package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
  97. package/components/primitives/number/components/withLabel/index.js +6 -6
  98. package/components/primitives/number/components/withoutLabel/index.js +6 -8
  99. package/components/primitives/number/types.d.ts +2 -2
  100. package/components/primitives/number/types.d.ts.map +1 -1
  101. package/components/primitives/password/component/index.d.ts.map +1 -1
  102. package/components/primitives/password/component/index.js +6 -3
  103. package/components/primitives/password/components/withLabel/index.d.ts +2 -1
  104. package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
  105. package/components/primitives/password/components/withLabel/index.js +5 -7
  106. package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
  107. package/components/primitives/password/components/withoutLabel/index.js +5 -7
  108. package/components/primitives/password/types.d.ts +3 -3
  109. package/components/primitives/password/types.d.ts.map +1 -1
  110. package/components/primitives/text/component/index.d.ts.map +1 -1
  111. package/components/primitives/text/component/index.js +6 -3
  112. package/components/primitives/text/components/withLabel/index.d.ts +2 -1
  113. package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
  114. package/components/primitives/text/components/withLabel/index.js +6 -8
  115. package/components/primitives/text/components/withoutLabel/index.js +6 -8
  116. package/components/primitives/text/index.d.ts.map +1 -1
  117. package/components/primitives/text/types.d.ts +2 -2
  118. package/components/primitives/text/types.d.ts.map +1 -1
  119. package/components/progress/component/index.d.ts +7 -0
  120. package/components/progress/component/index.d.ts.map +1 -0
  121. package/components/progress/component/index.js +34 -0
  122. package/components/progress/component/style.scss +211 -0
  123. package/components/progress/index.d.ts +3 -0
  124. package/components/progress/index.d.ts.map +1 -0
  125. package/components/progress/index.js +2 -0
  126. package/components/progress/types.d.ts +23 -0
  127. package/components/progress/types.d.ts.map +1 -0
  128. package/components/progress/types.js +1 -0
  129. package/components/search/component/index.d.ts.map +1 -1
  130. package/components/search/component/index.js +7 -9
  131. package/components/search/types.d.ts +2 -2
  132. package/components/search/types.d.ts.map +1 -1
  133. package/components/table/component/index.d.ts.map +1 -1
  134. package/components/table/component/index.js +3 -5
  135. package/components/table/components/heading/index.js +4 -4
  136. package/components/tabs/component/index.d.ts.map +1 -1
  137. package/components/tabs/component/index.js +10 -31
  138. package/components/tabs/components/item/index.d.ts.map +1 -1
  139. package/components/tabs/components/item/index.js +2 -2
  140. package/components/tabs/types.d.ts +2 -2
  141. package/components/tabs/types.d.ts.map +1 -1
  142. package/components/tag/component/index.d.ts.map +1 -1
  143. package/components/tag/component/index.js +11 -13
  144. package/components/tag/component/style.scss +1 -1
  145. package/hooks/useComponentOutsideClick.d.ts.map +1 -1
  146. package/hooks/useComponentOutsideClick.js +3 -2
  147. package/hooks/useEventListener.d.ts.map +1 -1
  148. package/hooks/useEventListener.js +5 -2
  149. package/hooks/useMount.js +1 -1
  150. package/hooks/usePagination.d.ts +1 -1
  151. package/hooks/usePagination.d.ts.map +1 -1
  152. package/package.json +3 -3
  153. package/tsconfig.tsbuildinfo +1 -1
  154. package/types/base/baseInputElementProps.d.ts +5 -4
  155. package/types/base/baseInputElementProps.d.ts.map +1 -1
  156. package/types/base/index.d.ts +2 -0
  157. package/types/base/index.d.ts.map +1 -1
  158. package/types/base/index.js +2 -0
  159. package/types/base/keyboardElement.d.ts +9 -0
  160. package/types/base/keyboardElement.d.ts.map +1 -0
  161. package/types/base/keyboardElement.js +1 -0
  162. package/types/base/labeledElement.d.ts +7 -0
  163. package/types/base/labeledElement.d.ts.map +1 -0
  164. package/types/base/labeledElement.js +1 -0
  165. package/utils/dataAttributes.d.ts +2 -1
  166. package/utils/dataAttributes.d.ts.map +1 -1
  167. package/utils/dataAttributes.js +5 -2
  168. package/utils/styles.d.ts +64 -8
  169. package/utils/styles.d.ts.map +1 -1
  170. package/utils/styles.js +93 -11
  171. package/utils/validation.js +3 -3
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { emptyFn, generateGuid, getClassName, isNullish, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { emptyFn, generateGuid, getClassName, isNotNullish, isNullish } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../types";
5
- import { mapDataAttributes } from "../../../../utils";
5
+ import { getElementColorClassName, getSizeClassName, mapDataAttributes } from "../../../../utils";
6
6
  import ComponentWithLabel from "../../internal/componentWithLabel";
7
7
  import "./style.scss";
8
8
  // todo: https://justboil.github.io/bulma-checkbox/
@@ -15,29 +15,27 @@ const CheckBox = ({ onValueChange = emptyFn, defaultValue, label, name = generat
15
15
  className,
16
16
  hasBackgroundColor ? "has-background-color" : "",
17
17
  fixBackgroundColor && hasBackgroundColor ? "m-has-background-color" : "",
18
- size === ElementSize.Normal ? "" : `is-${size}`,
18
+ getSizeClassName(size, ElementSize.Normal),
19
19
  rounded ? "is-circle" : "",
20
- isNullOrUndefined(style) ? "" : `is-${style}`,
20
+ getElementColorClassName(style),
21
21
  block ? "is-block" : "",
22
22
  withoutBorder ? "has-no-border" : "",
23
23
  ]);
24
- const dataAttributes = isNullish(data)
25
- ? undefined
26
- : mapDataAttributes(data);
27
- if (!isNullish(label) && isFormLabel) {
24
+ const dataAttributes = mapDataAttributes(data);
25
+ if (isNotNullish(label) && isFormLabel) {
28
26
  return (_jsxs(ComponentWithLabel, { id: name, size: size, label: {
29
27
  ...label,
30
28
  horizontal: label.horizontal ?? false,
31
29
  horizontalContainerClassName: getClassName([label.horizontalContainerClassName, "p-0"]),
32
- }, children: [_jsx("input", { type: "checkbox", id: name, name: name, disabled: disabled, onChange: onChecked, className: elClassName, defaultChecked: defaultValue, ...dataAttributes }), _jsx("label", { title: title, htmlFor: name, className: "is-empty" })] }));
30
+ }, children: [_jsx("input", { id: name, name: name, type: "checkbox", disabled: disabled, ...dataAttributes, onChange: onChecked, className: elClassName, defaultChecked: defaultValue }), _jsx("label", { title: title, htmlFor: name, className: "is-empty" })] }));
33
31
  }
34
- const isEmptyLabel = isNullOrUndefined(label);
32
+ const isEmptyLabel = isNullish(label);
35
33
  const labelClassName = isEmptyLabel
36
34
  ? "is-empty"
37
35
  : undefined;
38
36
  const labelDataAttributes = isNullish(label?.data)
39
37
  ? undefined
40
38
  : mapDataAttributes(label.data);
41
- 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, ...dataAttributes }), _jsx("label", { htmlFor: name, className: labelClassName, title: isEmptyLabel ? title : label?.title, ...labelDataAttributes, children: label?.caption })] }));
39
+ return (_jsxs("div", { className: "bbr-field bbr-input field mr-2", children: [_jsx("input", { id: name, name: name, type: "checkbox", disabled: disabled, ...dataAttributes, onChange: onChecked, className: elClassName, defaultChecked: defaultValue }), _jsx("label", { htmlFor: name, ...labelDataAttributes, className: labelClassName, title: isEmptyLabel ? title : label?.title, children: label?.caption })] }));
42
40
  };
43
41
  export default CheckBox;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/color/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAItC,6BAA6B;AAC7B,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAGO,CACxC;AAEL,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/color/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAItC,6BAA6B;AAC7B,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAU7B,CACJ;AAEL,eAAe,WAAW,CAAC"}
@@ -1,10 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isNullOrUndefined } from "@bodynarf/utils";
2
+ import { isNullish } from "@bodynarf/utils";
3
3
  import "./style.scss";
4
4
  import ColorPickerWithoutLabel from "../components/withoutLabel";
5
5
  import ColorPickerWithLabel from "../components/withLabel";
6
6
  /** Color picker component */
7
- const ColorPicker = (props) => isNullOrUndefined(props.label)
7
+ const ColorPicker = (props) =>
8
+ // eslint-disable-next-line react/destructuring-assignment
9
+ isNullish(props.label)
8
10
  ? _jsx(ColorPickerWithoutLabel, { ...props })
9
- : _jsx(ColorPickerWithLabel, { ...props });
11
+ : (_jsx(ColorPickerWithLabel, { ...props,
12
+ // eslint-disable-next-line react/destructuring-assignment
13
+ label: props.label }));
10
14
  export default ColorPicker;
@@ -2,17 +2,17 @@ import { ChangeEvent, FC } from "react";
2
2
  import { BaseInputElementProps } from "../../../../../types";
3
3
  import { ColorPickerPreviewConfig } from "../..";
4
4
  /** Props of `ColorPickerControl` */
5
- export type ColorPickerControlProps = Omit<BaseInputElementProps<string>, "placeholder" | "rounded" | "readonly" | "loading" | "className"> & {
5
+ export type ColorPickerControlProps = Omit<BaseInputElementProps<string>, "placeholder" | "rounded" | "readonly" | "loading" | "className" | "onKeyDown" | "onKeyUp"> & {
6
6
  /** Current color value */
7
7
  value: string;
8
8
  /** Control unique identifier */
9
9
  id: string;
10
10
  /** Class names of control */
11
11
  elementClassName: string;
12
- /** Handler of control value change*/
13
- onValueChange: (event: ChangeEvent<HTMLInputElement>) => void;
14
12
  /** Preview element configuration */
15
13
  previewConfig?: ColorPickerPreviewConfig;
14
+ /** Handler of control value change*/
15
+ onValueChange: (event: ChangeEvent<HTMLInputElement>) => void;
16
16
  };
17
17
  /** Color picker container component */
18
18
  declare const ColorPickerControl: FC<ColorPickerControlProps>;
@@ -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,EAAE,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3E,oCAAoC;AACpC,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACtC,qBAAqB,CAAC,MAAM,CAAC,EAC3B,aAAa,GACb,SAAS,GAAG,UAAU,GACtB,SAAS,GAAG,WAAW,CAC5B,GAAG;IACA,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,CAAC;AAEF,uCAAuC;AACvC,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAmDnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/picker/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE3E,oCAAoC;AACpC,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACtC,qBAAqB,CAAC,MAAM,CAAC,EAC3B,aAAa,GACb,SAAS,GAAG,UAAU,GACtB,SAAS,GAAG,WAAW,GACvB,WAAW,GAAG,SAAS,CAC5B,GAAG;IACA,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,6BAA6B;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IAEzB,oCAAoC;IACpC,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAEzC,qCAAqC;IACrC,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF,uCAAuC;AACvC,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAgDnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,27 +1,26 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getClassName, getFontColorFromString, isNullOrUndefined } from "@bodynarf/utils";
2
+ import { getClassName, getFontColorFromString, isNotNullish, isNullish } from "@bodynarf/utils";
3
3
  import { ElementPosition } from "../../../../../types";
4
- import { mapDataAttributes } from "../../../../../utils";
4
+ import { getSizeClassName, mapDataAttributes } from "../../../../../utils";
5
5
  import InternalHint from "../../../internal/hint";
6
6
  /** Color picker container component */
7
7
  const ColorPickerControl = ({ value, defaultValue, onValueChange, elementClassName, disabled = false, autoFocus = false, previewConfig, size, id, title, data, hint, validationState, }) => {
8
- if (!isNullOrUndefined(previewConfig)) {
9
- return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, elementClassName: elementClassName, data: data, title: title }));
8
+ if (isNotNullish(previewConfig)) {
9
+ return (_jsx(PickerWithPreview, { id: id, size: size, data: data, value: value, title: title, disabled: disabled, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, elementClassName: elementClassName }));
10
10
  }
11
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "control bbr-input", children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, ...data, title: title }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
11
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "control bbr-input", children: _jsx("input", { id: id, name: id, ...data, type: "color", title: title, disabled: disabled, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
12
12
  };
13
13
  export default ColorPickerControl;
14
14
  /** Picker sub component with preview */
15
- // eslint-disable-next-line react/no-multi-comp
16
15
  const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onValueChange, value, autoFocus = false, id, title, data, previewConfig, hint, validationState, }) => {
17
16
  const classNames = getClassName([
18
17
  "bbr-color-picker__preview",
19
18
  "button",
20
19
  "is-outlined",
21
- isNullOrUndefined(size) ? "" : `is-${size}`
20
+ getSizeClassName(size)
22
21
  ]);
23
22
  const color = getFontColorFromString(value);
24
- const dataAttributes = isNullOrUndefined(data)
23
+ const dataAttributes = isNullish(data)
25
24
  ? undefined
26
25
  : mapDataAttributes(data);
27
26
  const controlContainerClassName = getClassName([
@@ -31,7 +30,7 @@ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onV
31
30
  previewConfig.position === ElementPosition.Left ? "ml-1" : "mr-1",
32
31
  ]);
33
32
  if (previewConfig.position === ElementPosition.Right) {
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", id: id, name: id, disabled: disabled, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, title: title, ...dataAttributes }) }), _jsx("button", { type: "button", className: classNames, style: {
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", { id: id, name: id, type: "color", title: title, disabled: disabled, ...dataAttributes, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName }) }), _jsx("button", { type: "button", className: classNames, style: {
35
34
  "--color-picker__background-color": value,
36
35
  "--color-picker__color": color,
37
36
  }, children: value }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
@@ -39,5 +38,5 @@ const PickerWithPreview = ({ elementClassName, disabled, size, defaultValue, onV
39
38
  return (_jsxs("div", { className: "is-flex is-flex-direction-row is-flex-wrap-nowrap is-justify-content-start", children: [_jsx("button", { type: "button", className: classNames, style: {
40
39
  "--color-picker__background-color": value,
41
40
  "--color-picker__color": color,
42
- }, children: value }), _jsx("div", { className: controlContainerClassName, children: _jsx("input", { type: "color", id: id, name: id, disabled: disabled, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
41
+ }, children: value }), _jsx("div", { className: controlContainerClassName, children: _jsx("input", { id: id, name: id, type: "color", title: title, disabled: disabled, ...dataAttributes, autoFocus: autoFocus, onChange: onValueChange, defaultValue: defaultValue, className: elementClassName }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
43
42
  };
@@ -1,6 +1,7 @@
1
1
  import { FC } from "react";
2
+ import { BaseInputWithLabel } from "../../../../../types";
2
3
  import { ColorPickerProps } from "../..";
3
4
  /** Color picker component with form label */
4
- declare const ColorPickerWithLabel: FC<ColorPickerProps>;
5
+ declare const ColorPickerWithLabel: FC<BaseInputWithLabel<ColorPickerProps>>;
5
6
  export default ColorPickerWithLabel;
6
7
  //# 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":"AAAA,OAAO,EAAe,EAAE,EAAoC,MAAM,OAAO,CAAC;AAQ1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,gBAAgB,CA4D9C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAoC,MAAM,OAAO,CAAC;AAI1E,OAAO,EAAE,kBAAkB,EAAe,MAAM,YAAY,CAAC;AAI7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CA0DlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useState } from "react";
3
- import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whiteHex } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, hexToRgb, isNullish, rgbToHex, whiteHex } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
- import { getStyleClassName } from "../../../../../utils";
5
+ import { getSizeClassName, 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
9
  const ColorPickerWithLabel = ({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size = ElementSize.Normal, autoFocus = false, label, hint, className, title, data, }) => {
10
- const defaultColor = isNullOrUndefined(defaultValue)
10
+ const defaultColor = isNullish(defaultValue)
11
11
  ? whiteHex
12
12
  : rgbToHex(defaultValue);
13
13
  const [value, setValue] = useState(defaultColor);
@@ -17,9 +17,9 @@ const ColorPickerWithLabel = ({ preview, name = generateGuid(), defaultValue, on
17
17
  className,
18
18
  rounded ? "is-rounded" : "",
19
19
  getStyleClassName(undefined, validationState),
20
- size === ElementSize.Normal ? "" : `is-${size}`,
20
+ getSizeClassName(size),
21
21
  "input",
22
22
  ]);
23
- return (_jsx(ComponentWithLabel, { id: name, size: size, label: label, children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, autoFocus: autoFocus, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, hint: hint, validationState: validationState, data: data, title: title }) }));
23
+ return (_jsx(ComponentWithLabel, { id: name, size: size, label: label, children: _jsx(ColorPickerControl, { id: name, hint: hint, data: data, value: value, title: title, disabled: disabled, autoFocus: autoFocus, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, validationState: validationState }) }));
24
24
  };
25
25
  export default ColorPickerWithLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAoC,MAAM,OAAO,CAAC;AAI1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,QAAA,MAAM,uBAAuB,EAAE,EAAE,CAAC,gBAAgB,CAwDjD,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAoC,MAAM,OAAO,CAAC;AAM1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,QAAA,MAAM,uBAAuB,EAAE,EAAE,CAAC,gBAAgB,CAsDjD,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useState } from "react";
3
- import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whiteHex } from "@bodynarf/utils";
3
+ import { generateGuid, getClassName, hexToRgb, isNullish, rgbToHex, whiteHex } from "@bodynarf/utils";
4
+ import { getSizeClassName } from "../../../../../utils";
4
5
  import ColorPickerControl from "../picker";
5
6
  /** Color picker component without form label */
6
7
  const ColorPickerWithoutLabel = ({ preview, name = generateGuid(), defaultValue, onValueChange, validationState, disabled = false, rounded = false, size, autoFocus = false, className, title, data, hint, }) => {
7
- const defaultColor = isNullOrUndefined(defaultValue)
8
+ const defaultColor = isNullish(defaultValue)
8
9
  ? whiteHex
9
10
  : rgbToHex(defaultValue);
10
11
  const [value, setValue] = useState(defaultColor);
@@ -13,9 +14,9 @@ const ColorPickerWithoutLabel = ({ preview, name = generateGuid(), defaultValue,
13
14
  const elClassName = getClassName([
14
15
  className,
15
16
  rounded ? "is-rounded" : "",
16
- isNullOrUndefined(size) ? "" : `is-${size}`,
17
+ getSizeClassName(size),
17
18
  "input",
18
19
  ]);
19
- return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: name, value: value, disabled: disabled, autoFocus: autoFocus, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, data: data, title: title, hint: hint, validationState: validationState }) }));
20
+ return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { id: name, data: data, hint: hint, value: value, title: title, disabled: disabled, autoFocus: autoFocus, previewConfig: preview, onValueChange: onChange, defaultValue: defaultColor, elementClassName: elClassName, validationState: validationState }) }));
20
21
  };
21
22
  export default ColorPickerWithoutLabel;
@@ -2,7 +2,7 @@ import { CSSProperties } from "react";
2
2
  import { Color } from "@bodynarf/utils";
3
3
  import { ElementFloatPosition, BaseNotNullableInputElementProps } from "../../../types";
4
4
  /** Color picker props type */
5
- export interface ColorPickerProps extends Omit<BaseNotNullableInputElementProps<Color>, "style" | "loading" | "readonly" | "placeholder"> {
5
+ export interface ColorPickerProps extends Omit<BaseNotNullableInputElementProps<Color>, "style" | "loading" | "readonly" | "placeholder" | "onKeyDown" | "onKeyUp"> {
6
6
  /**
7
7
  * Preview text configuration.
8
8
  * If provided - outlined button-like element will be rendered near picker according to configuration
@@ -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,oBAAoB,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAEpF,8BAA8B;AAC9B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,gCAAgC,CAAC,KAAK,CAAC,EAChF,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
+ {"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,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAEpF,8BAA8B;AAC9B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,gCAAgC,CAAC,KAAK,CAAC,EAChF,OAAO,GAAG,SAAS,GACnB,UAAU,GAAG,aAAa,GAC1B,WAAW,GAAG,SAAS,CAC5B;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,8 @@
1
1
  import { FC } from "react";
2
+ import { LabeledElement } from "../../../../types";
2
3
  import "./style.scss";
3
4
  import { DateProps } from "../..";
4
5
  /** Date input component */
5
- declare const DatePicker: FC<DateProps>;
6
+ declare const DatePicker: FC<Omit<DateProps, "label"> & LabeledElement>;
6
7
  export default DatePicker;
7
8
  //# 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":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AASrD,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,SAAS,CAuE7B,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAe,cAAc,EAAE,MAAM,YAAY,CAAC;AAKzD,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2BAA2B;AAC3B,QAAA,MAAM,UAAU,EAAE,EAAE,CAChB,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,cAAc,CA0ExC,CAAC;AAEN,eAAe,UAAU,CAAC"}
@@ -1,19 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { emptyFn, generateGuid, getClassName, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
3
+ import { emptyFn, generateGuid, getClassName, isNullish, isStringEmpty } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../types";
5
- import { getStyleClassName, mapDataAttributes } from "../../../../utils";
5
+ import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../utils";
6
6
  import ComponentWithLabel from "../../internal/componentWithLabel";
7
7
  import InternalHint from "../../internal/hint";
8
8
  import "./style.scss";
9
9
  /** Date input component */
10
- const DatePicker = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), style, size = ElementSize.Normal, readonly = false, disabled = false, rounded = false, loading = false, autoFocus = false, label, onBlur, className, title, data, hint, }) => {
10
+ const DatePicker = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), style, size = ElementSize.Normal, readonly = false, disabled = false, rounded = false, loading = false, autoFocus = false, label, onBlur, onKeyDown, onKeyUp, 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
14
  const elClassName = getClassName([
15
15
  className,
16
- size === ElementSize.Normal ? "" : `is-${size}`,
16
+ getSizeClassName(size, ElementSize.Normal),
17
17
  getStyleClassName(style, validationState),
18
18
  rounded ? "is-rounded" : "",
19
19
  "input",
@@ -23,9 +23,9 @@ const DatePicker = ({ defaultValue, onValueChange = emptyFn, validationState, na
23
23
  loading ? "is-loading" : "",
24
24
  ]);
25
25
  const stringifiedDefValue = defaultValue?.toISOString().split("T")[0];
26
- const dataAttributes = isNullOrUndefined(data)
26
+ const dataAttributes = isNullish(data)
27
27
  ? undefined
28
28
  : mapDataAttributes(data);
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, autoFocus: autoFocus, 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", { id: name, type: "date", name: name, title: title, onBlur: onBlur, onKeyUp: onKeyUp, readOnly: readonly, disabled: disabled, onChange: onChange, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, defaultValue: stringifiedDefValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
30
30
  };
31
31
  export default DatePicker;
@@ -1,4 +1,4 @@
1
- import { BaseInputElementProps, BaseNullableInputElementProps, BlurableElement } from "../../../types";
1
+ import { BaseInputElementProps, BaseNullableInputElementProps, BlurableElement, KeyboardElement } from "../../../types";
2
2
  /** Date input component props type */
3
- export type DateProps = Omit<BaseNullableInputElementProps<Date>, "placeholder" | "label"> & BlurableElement & Required<Pick<BaseInputElementProps<unknown>, "label">>;
3
+ export type DateProps = Omit<BaseNullableInputElementProps<Date>, "placeholder" | "label"> & BlurableElement & KeyboardElement & Required<Pick<BaseInputElementProps<unknown>, "label">>;
4
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnG,sCAAsC;AACtC,MAAM,MAAM,SAAS,GAAG,IAAI,CACxB,6BAA6B,CAAC,IAAI,CAAC,EACnC,aAAa,GAAG,OAAO,CAC1B,GAAG,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpH,sCAAsC;AACtC,MAAM,MAAM,SAAS,GACf,IAAI,CACF,6BAA6B,CAAC,IAAI,CAAC,EACnC,aAAa,GAAG,OAAO,CAC1B,GAAG,eAAe,GACjB,eAAe,GACf,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CACxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG7D,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAAG;IAClC,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,CAAC;AAEF,iDAAiD;AACjD,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAqEnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/componentWithLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG7D,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAAG;IAClC,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,CAAC;AAEF,iDAAiD;AACjD,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAmEnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -23,8 +23,8 @@ const ComponentWithLabel = ({ label, id, size, children, }) => {
23
23
  "field-body",
24
24
  label.horizontalFieldContainerClassName
25
25
  ]);
26
- return (_jsxs("div", { className: "bbr-field bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { htmlFor: id, className: labelClassName, title: label.title, ...dataAttributes, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsx("div", { className: "field", children: children }) })] }));
26
+ return (_jsxs("div", { className: "bbr-field bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { htmlFor: id, title: label.title, ...dataAttributes, className: labelClassName, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsx("div", { className: "field", children: children }) })] }));
27
27
  }
28
- return (_jsxs("div", { className: "bbr-field bbr-input field", children: [_jsx("label", { htmlFor: id, className: labelClassName, title: label.title, ...dataAttributes, children: label.caption }), children] }));
28
+ return (_jsxs("div", { className: "bbr-field bbr-input field", children: [_jsx("label", { htmlFor: id, title: label.title, ...dataAttributes, className: labelClassName, children: label.caption }), children] }));
29
29
  };
30
30
  export default ComponentWithLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,qBAAqB,EAAqE,MAAM,YAAY,CAAC;AAGtH,OAAO,cAAc,CAAC;AAEtB,8BAA8B;AAC9B,KAAK,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,CAAC;AAElF,qEAAqE;AACrE,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,SAAS,CAkD/B,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/internal/hint/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,qBAAqB,EAAqE,MAAM,YAAY,CAAC;AAGtH,OAAO,cAAc,CAAC;AAEtB,8BAA8B;AAC9B,KAAK,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,CAAC;AAElF,qEAAqE;AACrE,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,SAAS,CAmD/B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,14 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
2
+ import { getClassName, isNotNullish, isNullish } from "@bodynarf/utils";
3
3
  import { ElementPosition, ElementSize, ValidationStatus } from "../../../../types";
4
4
  import Icon from "../../../icon";
5
5
  import "./style.scss";
6
6
  /** Hint component for internal use (as form input elements hints) */
7
7
  const InternalHint = ({ validationState, hint, }) => {
8
- if (isNullOrUndefined(validationState) && isNullOrUndefined(hint)) {
8
+ if (isNullish(validationState) && isNullish(hint)) {
9
9
  return null;
10
10
  }
11
- const validationStateDefined = !isNullOrUndefined(validationState)
11
+ const validationStateDefined = isNotNullish(validationState)
12
12
  && validationState.status !== ValidationStatus.None
13
13
  && (validationState.messages ?? []).length > 0;
14
14
  if (validationStateDefined) {
@@ -17,7 +17,7 @@ const InternalHint = ({ validationState, hint, }) => {
17
17
  : "is-danger";
18
18
  return (_jsx("p", { className: `help m-help bbr-hint ${validationClassName}`, children: (validationState.messages ?? []).join("\n") }));
19
19
  }
20
- if (isNullOrUndefined(hint)) {
20
+ if (isNullish(hint)) {
21
21
  return null;
22
22
  }
23
23
  const className = getClassName([
@@ -27,8 +27,8 @@ const InternalHint = ({ validationState, hint, }) => {
27
27
  (hint.grey ?? false) ? "has-text-grey" : undefined,
28
28
  (hint.italic ?? false) ? "is-italic" : undefined,
29
29
  ]);
30
- if (!isNullOrUndefined(hint.icon)) {
31
- return (_jsx(HintWithIcon, { ...hint, className: className }));
30
+ if (isNotNullish(hint.icon)) {
31
+ return (_jsx(HintWithIcon, { icon: hint.icon, className: className, content: hint.content }));
32
32
  }
33
33
  return (_jsx("p", { className: className, children: hint.content }));
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAKjC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAYjC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,11 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isNullOrUndefined } from "@bodynarf/utils";
2
+ import { isNullish } from "@bodynarf/utils";
3
3
  import MultilineWithoutLabel from "../components/withoutLabel";
4
4
  import MultilineWithLabel from "../components/withLabel";
5
5
  /** Multiline textual input component */
6
6
  const Multiline = (props) => {
7
- return isNullOrUndefined(props.label)
7
+ // eslint-disable-next-line react/destructuring-assignment
8
+ return isNullish(props.label)
8
9
  ? _jsx(MultilineWithoutLabel, { ...props })
9
- : _jsx(MultilineWithLabel, { ...props });
10
+ : (_jsx(MultilineWithLabel, { ...props,
11
+ // eslint-disable-next-line react/destructuring-assignment
12
+ label: props.label }));
10
13
  };
11
14
  export default Multiline;
@@ -1,6 +1,7 @@
1
1
  import { FC } from "react";
2
+ import { LabeledElement } from "../../../../../types";
2
3
  import { MultilineProps } from "../..";
3
4
  /** Multiline textual input component with describing label */
4
- declare const MultilineWithLabel: FC<MultilineProps>;
5
+ declare const MultilineWithLabel: FC<Omit<MultilineProps, "label"> & LabeledElement>;
5
6
  export default MultilineWithLabel;
6
7
  //# 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":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AASrD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,cAAc,CAiE1C,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAe,cAAc,EAAE,MAAM,YAAY,CAAC;AAKzD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,EAAE,EAAE,CACxB,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,cAAc,CAqE7C,CAAC;AAEN,eAAe,kBAAkB,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { emptyFn, generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { emptyFn, generateGuid, getClassName, isNullish } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
- import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
5
+ import { getSizeClassName, 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 = emptyFn, validationState, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, autoFocus = false, rows, onBlur, className, title, data, hint, }) => {
9
+ const MultilineWithLabel = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, autoFocus = false, rows, onBlur, onKeyDown, onKeyUp, className, title, data, hint, }) => {
10
10
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
11
11
  const elClassName = getClassName([
12
12
  className,
13
- size === ElementSize.Normal ? "" : `is-${size}`,
13
+ getSizeClassName(size, ElementSize.Normal),
14
14
  getStyleClassName(style, validationState),
15
15
  "textarea",
16
16
  fixed ? "has-fixed-size" : "",
@@ -19,9 +19,9 @@ const MultilineWithLabel = ({ defaultValue, onValueChange = emptyFn, validationS
19
19
  "control",
20
20
  loading ? "is-loading" : "",
21
21
  ]);
22
- const dataAttributes = isNullOrUndefined(data)
22
+ const dataAttributes = isNullish(data)
23
23
  ? undefined
24
24
  : mapDataAttributes(data);
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, autoFocus: autoFocus, 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, title: title, onBlur: onBlur, onKeyUp: onKeyUp, disabled: disabled, onChange: onChange, readOnly: readonly, ...dataAttributes, autoFocus: autoFocus, onKeyDown: onKeyDown, className: elClassName, placeholder: placeholder, defaultValue: defaultValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
26
26
  };
27
27
  export default MultilineWithLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AAQrD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,cAAc,CAgE7C,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AAQrD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,cAAc,CAiE7C,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from "react";
3
- import { emptyFn, generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
3
+ import { emptyFn, generateGuid, getClassName } from "@bodynarf/utils";
4
4
  import { ElementSize } from "../../../../../types";
5
- import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
5
+ import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../../utils";
6
6
  import InternalHint from "../../../internal/hint";
7
7
  /** Multiline textual input component without describing label*/
8
- const MultilineWithoutLabel = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), size = ElementSize.Normal, style, placeholder, readonly = false, disabled = false, loading = false, fixed = false, autoFocus = false, rows, onBlur, className, title, data, hint, }) => {
8
+ const MultilineWithoutLabel = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), size = ElementSize.Normal, style, placeholder, readonly = false, disabled = false, loading = false, fixed = false, autoFocus = false, rows, onBlur, onKeyDown, onKeyUp, className, title, data, hint, }) => {
9
9
  const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
10
10
  const elClassName = getClassName([
11
11
  className,
12
- size === ElementSize.Normal ? "" : `is-${size}`,
12
+ getSizeClassName(size, ElementSize.Normal),
13
13
  getStyleClassName(style, validationState),
14
14
  "textarea",
15
15
  fixed ? "has-fixed-size" : "",
@@ -19,9 +19,7 @@ const MultilineWithoutLabel = ({ defaultValue, onValueChange = emptyFn, validati
19
19
  "bbr-input",
20
20
  loading ? "is-loading" : "",
21
21
  ]);
22
- const dataAttributes = isNullOrUndefined(data)
23
- ? undefined
24
- : mapDataAttributes(data);
25
- return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
22
+ const dataAttributes = mapDataAttributes(data);
23
+ return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, title: title, onBlur: onBlur, onKeyUp: onKeyUp, disabled: disabled, onChange: onChange, readOnly: readonly, ...dataAttributes, autoFocus: autoFocus, onKeyDown: onKeyDown, className: elClassName, placeholder: placeholder, defaultValue: defaultValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
26
24
  };
27
25
  export default MultilineWithoutLabel;
@@ -1,6 +1,6 @@
1
- import { BaseNotNullableInputElementProps, BlurableElement } from "../../../types";
1
+ import { BaseNotNullableInputElementProps, BlurableElement, KeyboardElement } from "../../../types";
2
2
  /** Multiline textual input component props type */
3
- export type MultilineProps = Omit<BaseNotNullableInputElementProps<string>, "rounded"> & BlurableElement & {
3
+ export type MultilineProps = Omit<BaseNotNullableInputElementProps<string>, "rounded"> & BlurableElement & KeyboardElement & {
4
4
  /** Is input should be resizable */
5
5
  fixed?: boolean;
6
6
  /** Number of initial rows count */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/E,mDAAmD;AACnD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,gCAAgC,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,GAChF,eAAe,GACf;IACE,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhG,mDAAmD;AACnD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,gCAAgC,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,GAChF,eAAe,GACf,eAAe,GACf;IACE,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAIjC,6BAA6B;AAC7B,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAI3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAIjC,6BAA6B;AAC7B,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAW3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,11 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isNullOrUndefined } from "@bodynarf/utils";
2
+ import { isNullish } from "@bodynarf/utils";
3
3
  import NumberWithLabel from "../components/withLabel";
4
4
  import NumberWithoutLabel from "../components/withoutLabel";
5
5
  /** Number input component */
6
6
  const Number = (props) => {
7
- return isNullOrUndefined(props.label)
7
+ // eslint-disable-next-line react/destructuring-assignment
8
+ return isNullish(props.label)
8
9
  ? _jsx(NumberWithoutLabel, { ...props })
9
- : _jsx(NumberWithLabel, { ...props });
10
+ : (_jsx(NumberWithLabel, { ...props,
11
+ // eslint-disable-next-line react/destructuring-assignment
12
+ label: props.label }));
10
13
  };
11
14
  export default Number;
@@ -1,6 +1,7 @@
1
1
  import { FC } from "react";
2
+ import { LabeledElement } from "../../../../../types";
2
3
  import { NumberProps } from "../..";
3
4
  /** Number component with label */
4
- declare const NumberWithLabel: FC<NumberProps>;
5
+ declare const NumberWithLabel: FC<Omit<NumberProps, "label"> & LabeledElement>;
5
6
  export default NumberWithLabel;
6
7
  //# 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":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AASrD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,WAAW,CAmEpC,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAe,cAAc,EAAE,MAAM,YAAY,CAAC;AAKzD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,EAAE,EAAE,CACrB,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,cAAc,CAsE1C,CAAC;AAEN,eAAe,eAAe,CAAC"}