@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.
- package/components/accordion/component/index.d.ts.map +1 -1
- package/components/accordion/component/index.js +7 -9
- package/components/accordion/types.d.ts +2 -2
- package/components/accordion/types.d.ts.map +1 -1
- package/components/anchor/types.d.ts +1 -1
- package/components/breadcrumbs/component/index.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.js +9 -11
- package/components/breadcrumbs/types.d.ts +16 -16
- package/components/breadcrumbs/types.d.ts.map +1 -1
- package/components/button/component/index.js +3 -3
- package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
- package/components/button/components/buttonWithIcon/index.js +4 -6
- package/components/button/components/simpleButton/index.d.ts.map +1 -1
- package/components/button/components/simpleButton/index.js +2 -5
- package/components/button/types.d.ts +2 -2
- package/components/button/types.d.ts.map +1 -1
- package/components/dropdown/component/index.d.ts.map +1 -1
- package/components/dropdown/component/index.js +6 -3
- package/components/dropdown/component/style.scss +13 -0
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +22 -11
- package/components/dropdown/components/item/index.js +6 -6
- package/components/dropdown/components/label/component/index.d.ts +4 -4
- package/components/dropdown/components/label/component/index.d.ts.map +1 -1
- package/components/dropdown/components/label/component/index.js +4 -4
- package/components/dropdown/components/label/components/selected/index.d.ts +1 -1
- package/components/dropdown/components/label/components/selected/index.d.ts.map +1 -1
- package/components/dropdown/components/label/components/selected/index.js +5 -5
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts +1 -1
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts.map +1 -1
- package/components/dropdown/components/label/components/selectedWithIcon/index.js +4 -4
- package/components/dropdown/components/label/components/withSearch/index.js +3 -3
- package/components/dropdown/components/withLabel/index.d.ts +2 -1
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +3 -1
- package/components/file/component/index.d.ts.map +1 -1
- package/components/file/component/index.js +6 -8
- package/components/icon/component/index.d.ts.map +1 -1
- package/components/icon/component/index.js +2 -4
- package/components/index.d.ts +33 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +35 -1
- package/components/multiselect/component/index.d.ts.map +1 -1
- package/components/multiselect/component/index.js +6 -3
- package/components/multiselect/component/style.scss +13 -0
- package/components/multiselect/components/item/index.d.ts.map +1 -1
- package/components/multiselect/components/item/index.js +5 -5
- package/components/multiselect/components/label/components/empty/index.js +1 -1
- package/components/multiselect/components/label/components/nonEmpty/index.js +1 -1
- package/components/multiselect/components/withLabel/index.d.ts +2 -1
- package/components/multiselect/components/withLabel/index.d.ts.map +1 -1
- package/components/multiselect/components/withLabel/index.js +3 -1
- package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -1
- package/components/multiselect/components/withoutLabel/index.js +23 -9
- package/components/multiselect/types.d.ts +8 -8
- package/components/multiselect/types.d.ts.map +1 -1
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +10 -12
- package/components/paginator/types.d.ts +2 -2
- package/components/paginator/types.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +9 -11
- package/components/primitives/color/component/index.d.ts.map +1 -1
- package/components/primitives/color/component/index.js +7 -3
- package/components/primitives/color/components/picker/index.d.ts +3 -3
- package/components/primitives/color/components/picker/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.js +9 -10
- package/components/primitives/color/components/withLabel/index.d.ts +2 -1
- package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withLabel/index.js +5 -5
- package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withoutLabel/index.js +5 -4
- package/components/primitives/color/types.d.ts +1 -1
- package/components/primitives/color/types.d.ts.map +1 -1
- package/components/primitives/date/component/index.d.ts +2 -1
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +6 -6
- package/components/primitives/date/types.d.ts +2 -2
- package/components/primitives/date/types.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.js +2 -2
- package/components/primitives/internal/hint/index.d.ts.map +1 -1
- package/components/primitives/internal/hint/index.js +6 -6
- package/components/primitives/multiline/component/index.d.ts.map +1 -1
- package/components/primitives/multiline/component/index.js +6 -3
- package/components/primitives/multiline/components/withLabel/index.d.ts +2 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withLabel/index.js +6 -6
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withoutLabel/index.js +6 -8
- package/components/primitives/multiline/types.d.ts +2 -2
- package/components/primitives/multiline/types.d.ts.map +1 -1
- package/components/primitives/number/component/index.d.ts.map +1 -1
- package/components/primitives/number/component/index.js +6 -3
- package/components/primitives/number/components/withLabel/index.d.ts +2 -1
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +6 -6
- package/components/primitives/number/components/withoutLabel/index.js +6 -8
- package/components/primitives/number/types.d.ts +2 -2
- package/components/primitives/number/types.d.ts.map +1 -1
- package/components/primitives/password/component/index.d.ts.map +1 -1
- package/components/primitives/password/component/index.js +6 -3
- package/components/primitives/password/components/withLabel/index.d.ts +2 -1
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +5 -7
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +5 -7
- package/components/primitives/password/types.d.ts +3 -3
- package/components/primitives/password/types.d.ts.map +1 -1
- package/components/primitives/text/component/index.d.ts.map +1 -1
- package/components/primitives/text/component/index.js +6 -3
- package/components/primitives/text/components/withLabel/index.d.ts +2 -1
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withLabel/index.js +6 -8
- package/components/primitives/text/components/withoutLabel/index.js +6 -8
- package/components/primitives/text/index.d.ts.map +1 -1
- package/components/primitives/text/types.d.ts +2 -2
- package/components/primitives/text/types.d.ts.map +1 -1
- package/components/progress/component/index.d.ts +7 -0
- package/components/progress/component/index.d.ts.map +1 -0
- package/components/progress/component/index.js +34 -0
- package/components/progress/component/style.scss +211 -0
- package/components/progress/index.d.ts +3 -0
- package/components/progress/index.d.ts.map +1 -0
- package/components/progress/index.js +2 -0
- package/components/progress/types.d.ts +23 -0
- package/components/progress/types.d.ts.map +1 -0
- package/components/progress/types.js +1 -0
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +7 -9
- package/components/search/types.d.ts +2 -2
- package/components/search/types.d.ts.map +1 -1
- package/components/table/component/index.d.ts.map +1 -1
- package/components/table/component/index.js +3 -5
- package/components/table/components/heading/index.js +4 -4
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +10 -31
- package/components/tabs/components/item/index.d.ts.map +1 -1
- package/components/tabs/components/item/index.js +2 -2
- package/components/tabs/types.d.ts +2 -2
- package/components/tabs/types.d.ts.map +1 -1
- package/components/tag/component/index.d.ts.map +1 -1
- package/components/tag/component/index.js +11 -13
- package/components/tag/component/style.scss +1 -1
- package/hooks/useComponentOutsideClick.d.ts.map +1 -1
- package/hooks/useComponentOutsideClick.js +3 -2
- package/hooks/useEventListener.d.ts.map +1 -1
- package/hooks/useEventListener.js +5 -2
- package/hooks/useMount.js +1 -1
- package/hooks/usePagination.d.ts +1 -1
- package/hooks/usePagination.d.ts.map +1 -1
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/types/base/baseInputElementProps.d.ts +5 -4
- package/types/base/baseInputElementProps.d.ts.map +1 -1
- package/types/base/index.d.ts +2 -0
- package/types/base/index.d.ts.map +1 -1
- package/types/base/index.js +2 -0
- package/types/base/keyboardElement.d.ts +9 -0
- package/types/base/keyboardElement.d.ts.map +1 -0
- package/types/base/keyboardElement.js +1 -0
- package/types/base/labeledElement.d.ts +7 -0
- package/types/base/labeledElement.d.ts.map +1 -0
- package/types/base/labeledElement.js +1 -0
- package/utils/dataAttributes.d.ts +2 -1
- package/utils/dataAttributes.d.ts.map +1 -1
- package/utils/dataAttributes.js +5 -2
- package/utils/styles.d.ts +64 -8
- package/utils/styles.d.ts.map +1 -1
- package/utils/styles.js +93 -11
- 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,
|
|
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
|
|
18
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
19
19
|
rounded ? "is-circle" : "",
|
|
20
|
-
|
|
20
|
+
getElementColorClassName(style),
|
|
21
21
|
block ? "is-block" : "",
|
|
22
22
|
withoutBorder ? "has-no-border" : "",
|
|
23
23
|
]);
|
|
24
|
-
const dataAttributes =
|
|
25
|
-
|
|
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", {
|
|
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 =
|
|
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", {
|
|
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,
|
|
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 {
|
|
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) =>
|
|
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":"
|
|
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,
|
|
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 (
|
|
9
|
-
return (_jsx(PickerWithPreview, { id: id, size: size, value: value, disabled: disabled, defaultValue: defaultValue, onValueChange: onValueChange, previewConfig: previewConfig, elementClassName: elementClassName
|
|
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", {
|
|
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
|
-
|
|
20
|
+
getSizeClassName(size)
|
|
22
21
|
]);
|
|
23
22
|
const color = getFontColorFromString(value);
|
|
24
|
-
const dataAttributes =
|
|
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", {
|
|
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", {
|
|
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;
|
|
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,
|
|
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 =
|
|
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
|
|
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,
|
|
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;
|
|
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,
|
|
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 =
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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;
|
|
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,
|
|
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
|
|
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 =
|
|
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",
|
|
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;
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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 (
|
|
8
|
+
if (isNullish(validationState) && isNullish(hint)) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
const validationStateDefined =
|
|
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 (
|
|
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 (
|
|
31
|
-
return (_jsx(HintWithIcon, {
|
|
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,
|
|
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 {
|
|
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
|
-
|
|
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;
|
|
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,
|
|
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
|
|
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 =
|
|
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,
|
|
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,
|
|
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
|
|
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
|
|
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 =
|
|
23
|
-
|
|
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;
|
|
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,
|
|
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 {
|
|
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
|
-
|
|
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;
|
|
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"}
|