@bodynarf/react.components 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bodynarf-react.components-1.10.0.tgz +0 -0
- package/components/accordion/component/index.js +3 -3
- package/components/anchor/component/index.js +2 -2
- package/components/anchor/components/anchorWithIcon/index.d.ts +8 -2
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
- package/components/anchor/components/anchorWithIcon/index.js +2 -2
- package/components/anchor/components/simpleAnchor/index.d.ts +2 -2
- package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
- package/components/anchor/components/simpleAnchor/index.js +1 -1
- package/components/anchor/types.d.ts +3 -11
- package/components/anchor/types.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.d.ts +7 -32
- package/components/breadcrumbs/component/index.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.js +22 -6
- package/components/breadcrumbs/types.d.ts +30 -1
- package/components/breadcrumbs/types.d.ts.map +1 -1
- package/components/button/component/index.d.ts.map +1 -1
- package/components/button/component/index.js +3 -3
- package/components/button/types.d.ts +1 -1
- package/components/dropdown/component/style.scss +3 -3
- package/components/dropdown/components/compact/index.d.ts +8 -2
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +17 -5
- package/components/dropdown/components/label/component/index.d.ts +27 -0
- package/components/dropdown/components/label/component/index.d.ts.map +1 -0
- package/components/dropdown/components/label/component/index.js +16 -0
- package/components/dropdown/components/label/components/empty/index.d.ts +8 -0
- package/components/dropdown/components/label/components/empty/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/empty/index.js +16 -0
- package/components/dropdown/components/label/components/selected/index.d.ts +8 -0
- package/components/dropdown/components/label/components/selected/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/selected/index.js +20 -0
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts +8 -0
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/selectedWithIcon/index.js +28 -0
- package/components/dropdown/components/label/components/withSearch/index.d.ts +16 -0
- package/components/dropdown/components/label/components/withSearch/index.d.ts.map +1 -0
- package/components/dropdown/components/label/components/withSearch/index.js +33 -0
- package/components/dropdown/components/label/components/withSearch/style.scss +29 -0
- package/components/dropdown/components/label/index.d.ts +1 -17
- package/components/dropdown/components/label/index.d.ts.map +1 -1
- package/components/dropdown/components/label/index.js +1 -54
- package/components/dropdown/components/withLabel/index.d.ts +3 -2
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +8 -82
- package/components/dropdown/types.d.ts +8 -0
- package/components/dropdown/types.d.ts.map +1 -1
- package/components/icon/component/index.d.ts +3 -2
- package/components/icon/component/index.d.ts.map +1 -1
- package/components/icon/component/index.js +4 -3
- package/components/icon/types.d.ts +2 -0
- package/components/icon/types.d.ts.map +1 -1
- package/components/multiselect/component/index.d.ts +8 -0
- package/components/multiselect/component/index.d.ts.map +1 -0
- package/components/multiselect/component/index.js +13 -0
- package/components/multiselect/component/style.scss +20 -0
- package/components/multiselect/components/item/index.d.ts +25 -0
- package/components/multiselect/components/item/index.d.ts.map +1 -0
- package/components/multiselect/components/item/index.js +62 -0
- package/components/multiselect/components/label/component/index.d.ts +20 -0
- package/components/multiselect/components/label/component/index.d.ts.map +1 -0
- package/components/multiselect/components/label/component/index.js +12 -0
- package/components/multiselect/components/label/components/empty/index.d.ts +8 -0
- package/components/multiselect/components/label/components/empty/index.d.ts.map +1 -0
- package/components/multiselect/components/label/components/empty/index.js +16 -0
- package/components/multiselect/components/label/components/nonEmpty/index.d.ts +8 -0
- package/components/multiselect/components/label/components/nonEmpty/index.d.ts.map +1 -0
- package/components/multiselect/components/label/components/nonEmpty/index.js +16 -0
- package/components/multiselect/components/label/index.d.ts +2 -0
- package/components/multiselect/components/label/index.d.ts.map +1 -0
- package/components/multiselect/components/label/index.js +1 -0
- package/components/multiselect/components/withLabel/index.d.ts +6 -0
- package/components/multiselect/components/withLabel/index.d.ts.map +1 -0
- package/components/multiselect/components/withLabel/index.js +11 -0
- package/components/multiselect/components/withoutLabel/index.d.ts +10 -0
- package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -0
- package/components/multiselect/components/withoutLabel/index.js +84 -0
- package/components/multiselect/index.d.ts +3 -0
- package/components/multiselect/index.d.ts.map +1 -0
- package/components/multiselect/index.js +2 -0
- package/components/multiselect/types.d.ts +41 -0
- package/components/multiselect/types.d.ts.map +1 -0
- package/components/multiselect/types.js +1 -0
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +22 -5
- package/components/paginator/index.d.ts +0 -1
- package/components/paginator/index.d.ts.map +1 -1
- package/components/paginator/index.js +0 -1
- package/components/primitives/checkbox/component/index.d.ts +1 -1
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +8 -6
- package/components/primitives/checkbox/component/style.scss +22 -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 +8 -8
- package/components/primitives/color/components/withLabel/index.d.ts +1 -1
- package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withLabel/index.js +3 -4
- package/components/primitives/color/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withoutLabel/index.js +2 -3
- package/components/primitives/date/component/index.d.ts +2 -2
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +5 -7
- package/components/primitives/date/component/style.scss +11 -0
- package/components/primitives/date/types.d.ts +1 -1
- 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 +3 -7
- package/components/primitives/internal/hint/index.d.ts.map +1 -1
- package/components/primitives/internal/hint/index.js +1 -0
- package/components/primitives/internal/hint/style.scss +4 -0
- package/components/primitives/multiline/component/index.d.ts +0 -1
- package/components/primitives/multiline/component/index.d.ts.map +1 -1
- package/components/primitives/multiline/component/index.js +0 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts +1 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withLabel/index.js +4 -6
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withoutLabel/index.js +4 -5
- package/components/primitives/number/components/withLabel/index.d.ts +1 -1
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +4 -6
- package/components/primitives/number/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +5 -6
- package/components/primitives/password/components/withLabel/index.d.ts +1 -1
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +5 -6
- package/components/primitives/password/components/withoutLabel/index.js +6 -7
- package/components/primitives/text/component/index.d.ts +0 -1
- package/components/primitives/text/component/index.d.ts.map +1 -1
- package/components/primitives/text/component/index.js +0 -1
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withLabel/index.js +4 -6
- package/components/primitives/text/components/withoutLabel/index.d.ts +1 -1
- package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withoutLabel/index.js +5 -6
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +6 -8
- package/components/table/component/index.d.ts +2 -35
- package/components/table/component/index.d.ts.map +1 -1
- package/components/table/component/index.js +4 -2
- package/components/table/component/style.scss +21 -0
- package/components/table/components/heading/index.d.ts.map +1 -1
- package/components/table/components/heading/index.js +3 -3
- package/components/table/types.d.ts +36 -1
- package/components/table/types.d.ts.map +1 -1
- package/components/tabs/component/index.d.ts +3 -27
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +3 -3
- package/components/tabs/types.d.ts +24 -1
- 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 +3 -3
- package/components/tag/types.d.ts +3 -3
- package/components/tag/types.d.ts.map +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.d.ts.map +1 -1
- package/hooks/index.js +1 -0
- package/hooks/useComponentOutsideClick.d.ts.map +1 -1
- package/hooks/useComponentOutsideClick.js +2 -3
- package/hooks/useUnmount.d.ts +8 -0
- package/hooks/useUnmount.d.ts.map +1 -0
- package/hooks/useUnmount.js +22 -0
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/common.scss +0 -8
- package/components/paginator/utils.d.ts +0 -10
- package/components/paginator/utils.d.ts.map +0 -1
- package/components/paginator/utils.js +0 -18
|
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import { ElementPosition, ElementSize, ValidationStatus } from "../../../../types";
|
|
4
4
|
import Icon from "../../../icon";
|
|
5
|
+
import "./style.scss";
|
|
5
6
|
/** Hint component for internal use (as form input elements hints) */
|
|
6
7
|
const InternalHint = ({ validationState, hint, }) => {
|
|
7
8
|
if (isNullOrUndefined(validationState) && isNullOrUndefined(hint)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAIpC,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAK1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import "../../../../common.scss";
|
|
4
3
|
import MultilineWithoutLabel from "../components/withoutLabel";
|
|
5
4
|
import MultilineWithLabel from "../components/withLabel";
|
|
6
5
|
/** Multiline textual input component */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MultilineProps } from "../..";
|
|
3
3
|
/** Multiline textual input component with describing label */
|
|
4
|
-
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState,
|
|
4
|
+
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, name, size, style, label, placeholder, readonly, disabled, loading, fixed, rows, onBlur, className, title, data, hint, }: MultilineProps) => JSX.Element;
|
|
5
5
|
export default MultilineWithLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,6KAYrB,cAAc,KAAG,WAoDnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
7
|
import InternalHint from "../../../internal/hint";
|
|
8
8
|
/** Multiline textual input component with describing label */
|
|
9
|
-
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState,
|
|
9
|
+
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, name = generateGuid(), size = ElementSize.Normal, style, label, placeholder, readonly = false, disabled = false, loading = false, fixed = false, rows, onBlur, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
|
-
const id = name ?? generateGuid();
|
|
12
|
-
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
13
11
|
const elClassName = getClassName([
|
|
14
12
|
className,
|
|
15
|
-
|
|
13
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
16
14
|
getStyleClassName(style, validationState),
|
|
17
15
|
"textarea",
|
|
18
16
|
fixed ? "has-fixed-size" : "",
|
|
@@ -24,6 +22,6 @@ const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, read
|
|
|
24
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
25
23
|
? undefined
|
|
26
24
|
: mapDataAttributes(data);
|
|
27
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
25
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
28
26
|
};
|
|
29
27
|
export default MultilineWithLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,kJAUxB,cAAc,KAAG,WAiDnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
/** Multiline textual input component without describing label*/
|
|
8
|
-
const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, size, style, loading = false, fixed = false, rows, className, title, data, hint, }) => {
|
|
8
|
+
const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), placeholder, onBlur, size = ElementSize.Normal, style, loading = false, fixed = false, rows, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
10
|
-
const id = name ?? generateGuid();
|
|
11
10
|
const elClassName = getClassName([
|
|
12
11
|
className,
|
|
13
|
-
|
|
12
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
14
13
|
getStyleClassName(style, validationState),
|
|
15
14
|
"textarea",
|
|
16
15
|
fixed ? "has-fixed-size" : "",
|
|
@@ -23,6 +22,6 @@ const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, n
|
|
|
23
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
24
23
|
? undefined
|
|
25
24
|
: mapDataAttributes(data);
|
|
26
|
-
return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id:
|
|
25
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { id: name, name: name, rows: rows, onBlur: onBlur, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
27
26
|
};
|
|
28
27
|
export default MultilineWithoutLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NumberProps } from "../..";
|
|
3
3
|
/** Number component with label */
|
|
4
|
-
declare const NumberWithLabel: ({ onValueChange,
|
|
4
|
+
declare const NumberWithLabel: ({ onValueChange, defaultValue, validationState, name, label, placeholder, size, style, rounded, loading, readonly, disabled, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
|
|
5
5
|
export default NumberWithLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,kCAAkC;AAClC,QAAA,MAAM,eAAe,+KAWlB,WAAW,KAAG,WAuDhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined, isStringEmpty } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
7
|
import InternalHint from "../../../internal/hint";
|
|
8
8
|
/** Number component with label */
|
|
9
|
-
const NumberWithLabel = ({ onValueChange,
|
|
9
|
+
const NumberWithLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), label, placeholder, size = ElementSize.Normal, style, rounded = false, loading = false, readonly = false, disabled = false, onBlur, step = 1, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value) ? undefined : +event.target.value), [onValueChange]);
|
|
11
|
-
const id = name ?? generateGuid();
|
|
12
|
-
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
13
11
|
const elClassName = getClassName([
|
|
14
12
|
className,
|
|
15
|
-
|
|
13
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
16
14
|
rounded ? "is-rounded" : "",
|
|
17
15
|
getStyleClassName(style, validationState),
|
|
18
16
|
"input",
|
|
@@ -24,6 +22,6 @@ const NumberWithLabel = ({ onValueChange, readonly, disabled, defaultValue, vali
|
|
|
24
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
25
23
|
? undefined
|
|
26
24
|
: mapDataAttributes(data);
|
|
27
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
25
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "number", id: name, name: name, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
28
26
|
};
|
|
29
27
|
export default NumberWithLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NumberProps } from "../..";
|
|
3
3
|
/** Number component without label */
|
|
4
|
-
declare const NumberWithoutLabel: ({ onValueChange,
|
|
4
|
+
declare const NumberWithoutLabel: ({ onValueChange, defaultValue, validationState, name, size, style, readonly, disabled, rounded, loading, placeholder, onBlur, step, className, title, data, hint, }: NumberProps) => JSX.Element;
|
|
5
5
|
export default NumberWithoutLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,qCAAqC;AACrC,QAAA,MAAM,kBAAkB,wKAYrB,WAAW,KAAG,WAqDhB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
/** Number component without label */
|
|
8
|
-
const NumberWithoutLabel = ({ onValueChange,
|
|
8
|
+
const NumberWithoutLabel = ({ onValueChange, defaultValue, validationState, name = generateGuid(), size, style, readonly = false, disabled = false, rounded = false, loading = false, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
|
|
10
10
|
const elClassName = getClassName([
|
|
11
11
|
className,
|
|
12
|
-
|
|
12
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
13
13
|
rounded ? "is-rounded" : "",
|
|
14
14
|
getStyleClassName(style, validationState),
|
|
15
15
|
"input",
|
|
@@ -19,10 +19,9 @@ const NumberWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, v
|
|
|
19
19
|
"bbr-input",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const id = name ?? generateGuid();
|
|
23
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
24
23
|
? undefined
|
|
25
24
|
: mapDataAttributes(data);
|
|
26
|
-
return (_jsxs(
|
|
25
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", id: name, name: name, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
27
26
|
};
|
|
28
27
|
export default NumberWithoutLabel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PasswordProps } from "../..";
|
|
3
|
-
declare const PasswordWithLabel: ({ onValueChange,
|
|
3
|
+
declare const PasswordWithLabel: ({ onValueChange, validationState, name, size, style, rounded, loading, disabled, canShowPassword, label, placeholder, className, title, data, hint, }: PasswordProps) => JSX.Element;
|
|
4
4
|
export default PasswordWithLabel;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,0JAUpB,aAAa,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,0JAUpB,aAAa,KAAG,WAqElB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import Icon from "../../../../icon";
|
|
7
7
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
8
8
|
import InternalHint from "../../../internal/hint";
|
|
9
|
-
const PasswordWithLabel = ({ onValueChange,
|
|
9
|
+
const PasswordWithLabel = ({ onValueChange, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, disabled = false, canShowPassword = false, label, placeholder, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
11
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
12
12
|
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
13
|
-
const elSizeClassName = "is-{0}".format(
|
|
14
|
-
const id = name ?? generateGuid();
|
|
13
|
+
const elSizeClassName = size === ElementSize.Normal ? "" : "is-{0}".format(size);
|
|
15
14
|
const elClassName = getClassName([
|
|
16
15
|
"bbr-password",
|
|
17
16
|
className,
|
|
@@ -29,7 +28,7 @@ const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, siz
|
|
|
29
28
|
const dataAttributes = isNullOrUndefined(data)
|
|
30
29
|
? undefined
|
|
31
30
|
: mapDataAttributes(data);
|
|
32
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
33
|
-
_jsx("span", { className: `icon is-right ${elSizeClassName}`,
|
|
31
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: name, name: name, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
|
|
32
|
+
_jsx("span", { onClick: onIconClick, title: "Show password", className: `icon is-right ${elSizeClassName}`, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
34
33
|
};
|
|
35
34
|
export default PasswordWithLabel;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import Icon from "../../../../icon";
|
|
7
7
|
import InternalHint from "../../../internal/hint";
|
|
8
|
-
const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, size, style, rounded = false, loading = false, placeholder, canShowPassword = false, className, title, data, hint, }) => {
|
|
8
|
+
const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, placeholder, canShowPassword = false, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
10
10
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
11
11
|
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
12
|
-
const elSizeClassName = "is-{0}".format(
|
|
13
|
-
const id = name ?? generateGuid();
|
|
12
|
+
const elSizeClassName = size === ElementSize.Normal ? "" : "is-{0}".format(size);
|
|
14
13
|
const elClassName = getClassName([
|
|
15
14
|
"bbr-password",
|
|
16
15
|
className,
|
|
@@ -29,7 +28,7 @@ const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name,
|
|
|
29
28
|
const dataAttributes = isNullOrUndefined(data)
|
|
30
29
|
? undefined
|
|
31
30
|
: mapDataAttributes(data);
|
|
32
|
-
return (_jsxs(
|
|
33
|
-
_jsx("span", { className: `icon is-right ${elSizeClassName}`,
|
|
31
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: name, name: name, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, title: title, ...dataAttributes }), canShowPassword && !loading &&
|
|
32
|
+
_jsx("span", { onClick: onIconClick, title: "Show password", className: `icon is-right ${elSizeClassName}`, children: _jsx(Icon, { name: contentIsHidden ? "eye" : "eye-slash", size: ElementSize.Medium }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
34
33
|
};
|
|
35
34
|
export default PasswordWithoutLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAI/B,8BAA8B;AAC9B,QAAA,MAAM,IAAI,UAAW,SAAS,KAAG,WAIhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import "../../../../common.scss";
|
|
4
3
|
import TextWithLabel from "../components/withLabel";
|
|
5
4
|
import TextWithoutLabel from "../components/withoutLabel";
|
|
6
5
|
/** Textual input component */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,yKAUhB,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withLabel/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,yKAUhB,SAAS,KAAG,WAqDd,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined, } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
8
8
|
/** Textual input with describing label */
|
|
9
|
-
const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, size, style, rounded = false, loading = false, label, placeholder, onBlur, className, title, data, hint, }) => {
|
|
9
|
+
const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, label, placeholder, onBlur, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
|
-
const id = name ?? generateGuid();
|
|
12
|
-
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
13
11
|
const elClassName = getClassName([
|
|
14
12
|
className,
|
|
15
|
-
|
|
13
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
16
14
|
rounded ? "is-rounded" : "",
|
|
17
15
|
getStyleClassName(style, validationState),
|
|
18
16
|
"input",
|
|
@@ -24,6 +22,6 @@ const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, valida
|
|
|
24
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
25
23
|
? undefined
|
|
26
24
|
: mapDataAttributes(data);
|
|
27
|
-
return (_jsxs(ComponentWithLabel, { id:
|
|
25
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
28
26
|
};
|
|
29
27
|
export default TextWithLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextProps } from "../..";
|
|
3
3
|
/** Textual input without describing label */
|
|
4
|
-
declare const TextWithoutLabel: ({ onValueChange,
|
|
4
|
+
declare const TextWithoutLabel: ({ onValueChange, defaultValue, validationState, readonly, disabled, name, size, style, rounded, loading, placeholder, onBlur, className, title, data, hint, }: TextProps) => JSX.Element;
|
|
5
5
|
export default TextWithoutLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,6CAA6C;AAC7C,QAAA,MAAM,gBAAgB,kKAWnB,SAAS,KAAG,WAoDd,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { generateGuid, getClassName,
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
/** Textual input without describing label */
|
|
8
|
-
const TextWithoutLabel = ({ onValueChange,
|
|
8
|
+
const TextWithoutLabel = ({ onValueChange, defaultValue, validationState, readonly = false, disabled = false, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, placeholder, onBlur, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
10
10
|
const elClassName = getClassName([
|
|
11
11
|
className,
|
|
12
|
-
|
|
12
|
+
size === ElementSize.Normal ? "" : `is-${size}`,
|
|
13
13
|
rounded ? "is-rounded" : "",
|
|
14
14
|
getStyleClassName(style, validationState),
|
|
15
15
|
"input",
|
|
@@ -19,10 +19,9 @@ const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, val
|
|
|
19
19
|
"bbr-input",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const id = name ?? generateGuid();
|
|
23
22
|
const dataAttributes = isNullOrUndefined(data)
|
|
24
23
|
? undefined
|
|
25
24
|
: mapDataAttributes(data);
|
|
26
|
-
return (_jsxs(
|
|
25
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "text", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
27
26
|
};
|
|
28
27
|
export default TextWithoutLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,UAAU,EAAE,QAAQ,EAAE,OAAO,EAC7B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC3B,UAAU,EAAE,QAAQ,EAAE,OAAO,EAC7B,IAAqB,EAAE,YAAiB,EACxC,IAAyB,EACzB,SAAiB,EAAE,OAAe,EAAE,QAAgB,EAEpD,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAwF3B"}
|
|
@@ -6,9 +6,9 @@ import { mapDataAttributes } from "../../../utils";
|
|
|
6
6
|
import Button from "../../button";
|
|
7
7
|
import "./style.scss";
|
|
8
8
|
/** Search component */
|
|
9
|
-
export default function Search({ searchType, onSearch, caption, name, defaultValue, size, isLoading = false, rounded = false, disabled, className, title, data, }) {
|
|
10
|
-
const [elementName] = useState(name
|
|
11
|
-
const [searchValue, setSearchValue] = useState(defaultValue
|
|
9
|
+
export default function Search({ searchType, onSearch, caption, name = generateGuid(), defaultValue = "", size = ElementSize.Normal, isLoading = false, rounded = false, disabled = false, className, title, data, }) {
|
|
10
|
+
const [elementName] = useState(name);
|
|
11
|
+
const [searchValue, setSearchValue] = useState(defaultValue);
|
|
12
12
|
const onChange = useCallback((event) => {
|
|
13
13
|
const elementValue = event.target.value;
|
|
14
14
|
if (searchType === "byTyping") {
|
|
@@ -21,14 +21,14 @@ export default function Search({ searchType, onSearch, caption, name, defaultVal
|
|
|
21
21
|
"bbr-search",
|
|
22
22
|
"control",
|
|
23
23
|
className,
|
|
24
|
-
`is-${
|
|
24
|
+
`is-${size}`,
|
|
25
25
|
isLoading ? "is-loading" : "",
|
|
26
26
|
searchType === "byButton" ? "is-expanded" : "",
|
|
27
27
|
]);
|
|
28
28
|
const inputClassName = getClassName([
|
|
29
29
|
"input",
|
|
30
30
|
"is-unselectable",
|
|
31
|
-
`is-${
|
|
31
|
+
`is-${size}`,
|
|
32
32
|
rounded ? "is-rounded" : "",
|
|
33
33
|
]);
|
|
34
34
|
const dataAttributes = isNullOrUndefined(data)
|
|
@@ -37,7 +37,5 @@ export default function Search({ searchType, onSearch, caption, name, defaultVal
|
|
|
37
37
|
if (searchType === "byButton") {
|
|
38
38
|
return (_jsxs("div", { className: "field has-addons", children: [_jsx("div", { className: elClassName, children: _jsx("input", { type: "search", name: elementName, disabled: disabled, onChange: onChange, placeholder: caption, defaultValue: searchValue, className: inputClassName, title: title, ...dataAttributes }) }), _jsx("div", { className: "control", children: _jsx(Button, { type: "info", size: size, caption: "Search", disabled: disabled, isLoading: isLoading, onClick: onSearchButtonClick }) })] }));
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
return (_jsx("div", { className: elClassName, children: _jsx("input", { type: "search", name: elementName, disabled: disabled, onChange: onChange, placeholder: caption, defaultValue: searchValue, className: inputClassName, title: title, ...dataAttributes }) }));
|
|
42
|
-
}
|
|
40
|
+
return (_jsx("div", { className: elClassName, children: _jsx("input", { type: "search", name: elementName, disabled: disabled, onChange: onChange, placeholder: caption, defaultValue: searchValue, className: inputClassName, title: title, ...dataAttributes }) }));
|
|
43
41
|
}
|
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
/** Table props type */
|
|
5
|
-
export interface TableProps<TItem> extends BaseElementProps {
|
|
6
|
-
/** Header row */
|
|
7
|
-
headings: Array<TableHeading<TItem>>;
|
|
8
|
-
/** Table body */
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
/** Add border to all cells */
|
|
11
|
-
hasBorder?: boolean;
|
|
12
|
-
/** Is row hover effect active */
|
|
13
|
-
hoverable?: boolean;
|
|
14
|
-
/** Reduce space between cells */
|
|
15
|
-
narrow?: boolean;
|
|
16
|
-
/** Use all container width */
|
|
17
|
-
fullWidth?: boolean;
|
|
18
|
-
/** Is header sticks to page on scroll */
|
|
19
|
-
hasStickyHeader?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Header has border.
|
|
22
|
-
* @description Applied only with `hasStickyHeader` sets as `true`. Adds border effect
|
|
23
|
-
*/
|
|
24
|
-
headerWithBorder?: boolean;
|
|
25
|
-
/** Header has no borders */
|
|
26
|
-
headerBorderless?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Should rows be stripped.
|
|
29
|
-
* @description Even rows will have gray background
|
|
30
|
-
*/
|
|
31
|
-
zebra?: boolean;
|
|
32
|
-
/** Current sort column */
|
|
33
|
-
currentSortColumn?: SortColumn<TItem>;
|
|
34
|
-
/** Header click handler */
|
|
35
|
-
onHeaderClick?: (columnName: TableHeading<TItem>) => void;
|
|
36
|
-
}
|
|
2
|
+
import { TableProps } from "..";
|
|
3
|
+
import "./style.scss";
|
|
37
4
|
/**
|
|
38
5
|
* Tiny table component.
|
|
39
6
|
* If no sorting is use - use `any` as generic param
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/component/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/table/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,cAAc,CAAC;AAItB;;;GAGG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,EAClB,QAAQ,EAER,SAAiB,EAAE,SAAiB,EAAE,MAAc,EACpD,SAAiB,EAAE,KAAa,EAAE,gBAAwB,EAC1D,eAAuB,EAAE,gBAAwB,EAEjD,iBAAiB,EAAE,aAAa,EAChC,QAAQ,EAER,SAAS,EAAE,KAAK,EAAE,IAAI,GACzB,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CA4CjC;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import { mapDataAttributes } from "../../../utils";
|
|
4
|
+
import "./style.scss";
|
|
4
5
|
import TableHeader from "../components/heading";
|
|
5
6
|
/**
|
|
6
7
|
* Tiny table component.
|
|
7
8
|
* If no sorting is use - use `any` as generic param
|
|
8
9
|
*/
|
|
9
|
-
function Table({ headings, hasBorder, hoverable, narrow, fullWidth, zebra, headerBorderless, hasStickyHeader, headerWithBorder, currentSortColumn, onHeaderClick, children, className, title, data, }) {
|
|
10
|
+
function Table({ headings, hasBorder = false, hoverable = false, narrow = false, fullWidth = false, zebra = false, headerBorderless = false, hasStickyHeader = false, headerWithBorder = false, currentSortColumn, onHeaderClick, children, className, title, data, }) {
|
|
10
11
|
const elClassName = getClassName([
|
|
12
|
+
"bbr-table",
|
|
11
13
|
"table",
|
|
12
14
|
className,
|
|
13
15
|
hasBorder ? "is-bordered" : "",
|
|
@@ -22,6 +24,6 @@ function Table({ headings, hasBorder, hoverable, narrow, fullWidth, zebra, heade
|
|
|
22
24
|
const dataAttributes = isNullOrUndefined(data)
|
|
23
25
|
? undefined
|
|
24
26
|
: mapDataAttributes(data);
|
|
25
|
-
return (_jsxs("table", { className: elClassName, title: title, ...dataAttributes, children: [_jsx("thead", { children: _jsx("tr", { children: headings.map((heading, i) => _jsx(TableHeader, { ...heading,
|
|
27
|
+
return (_jsxs("table", { className: elClassName, title: title, ...dataAttributes, children: [_jsx("thead", { children: _jsx("tr", { children: headings.map((heading, i) => _jsx(TableHeader, { ...heading, onClick: onHeaderClick, sortColumn: currentSortColumn }, i)) }) }), _jsx("tbody", { children: children })] }));
|
|
26
28
|
}
|
|
27
29
|
export default Table;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
table.bbr-table {
|
|
2
|
+
&.has-sticky-header thead th {
|
|
3
|
+
position: sticky;
|
|
4
|
+
top: 0.125rem;
|
|
5
|
+
z-index: 1;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&.has-shadow-bordered-header thead th {
|
|
9
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&.has-borderless-header {
|
|
13
|
+
thead th {
|
|
14
|
+
border: none !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
tbody tr:nth-child(1) td {
|
|
18
|
+
border-top: none !important;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/components/heading/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,yCAAyC;AACzC,MAAM,WAAW,gBAAgB,CAAC,KAAK,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAC;IAChE,0BAA0B;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAE/B,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,yBAAyB;AACzB,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/components/heading/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,yCAAyC;AACzC,MAAM,WAAW,gBAAgB,CAAC,KAAK,CAAE,SAAQ,YAAY,CAAC,KAAK,CAAC;IAChE,0BAA0B;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAE/B,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACnD;AAED,yBAAyB;AACzB,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAkCvE;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -14,8 +14,8 @@ function TableHeader(props) {
|
|
|
14
14
|
className,
|
|
15
15
|
sortable ? "is-clickable" : "",
|
|
16
16
|
]);
|
|
17
|
-
return (
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return (_jsxs("th", { onClick: onHeaderClick, className: containerClassName, children: [_jsx("span", { children: caption }), sortable && sortColumn?.columnName === name
|
|
18
|
+
&&
|
|
19
|
+
_jsx(Icon, { className: "ml-1", name: `sort-alpha-down${sortColumn.ascending ? "" : "-alt"}` })] }));
|
|
20
20
|
}
|
|
21
21
|
export default TableHeader;
|