@bodynarf/react.components 1.7.94 → 1.7.96
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 +0 -1
- package/components/accordion/component/index.d.ts.map +1 -1
- package/components/accordion/component/index.js +5 -5
- package/components/anchor/types.d.ts +1 -11
- package/components/anchor/types.d.ts.map +1 -1
- package/components/button/component/index.d.ts.map +1 -1
- package/components/button/component/index.js +6 -5
- package/components/button/types.d.ts +2 -1
- package/components/button/types.d.ts.map +1 -1
- package/components/dropdown/component/index.d.ts +1 -0
- package/components/dropdown/component/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +7 -7
- package/components/dropdown/components/withLabel/index.d.ts +1 -2
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +6 -6
- package/components/paginator/component/index.d.ts +1 -1
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +3 -3
- package/components/primitives/checkbox/component/index.d.ts +1 -2
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +7 -7
- package/components/primitives/checkbox/types.d.ts +1 -1
- package/components/primitives/checkbox/types.d.ts.map +1 -1
- package/components/primitives/color/component/index.d.ts +1 -0
- package/components/primitives/color/component/index.d.ts.map +1 -1
- 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 +6 -5
- 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 +6 -5
- package/components/primitives/color/types.d.ts +3 -15
- package/components/primitives/color/types.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +3 -3
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.js +4 -4
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +0 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +4 -4
- package/components/primitives/number/components/withLabel/index.d.ts +0 -1
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +5 -5
- package/components/primitives/number/components/withoutLabel/index.d.ts +0 -1
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +4 -4
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +3 -3
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +3 -3
- package/components/primitives/password/types.d.ts +2 -2
- package/components/primitives/password/types.d.ts.map +1 -1
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/textWithLabel/index.js +3 -3
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/textWithoutLabel/index.js +3 -3
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +3 -3
- package/components/tabs/component/index.d.ts +0 -1
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +5 -5
- package/components/tag/component/index.d.ts.map +1 -1
- package/components/tag/component/index.js +3 -5
- package/package.json +1 -1
- package/readme.md +17 -11
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/component/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/component/index.tsx"],"names":[],"mappings":"AAIA,OAAO,cAAc,CAAC;AAOtB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,sBAAsB;AACtB,QAAA,MAAM,SAAS,2FAMZ,cAAc,KAAG,WA8DnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -6,13 +6,13 @@ import { ElementSize } from "../..";
|
|
|
6
6
|
import Icon from "../../icon";
|
|
7
7
|
import { mapDataAttributes } from "../../../utils";
|
|
8
8
|
/** Accordion panel */
|
|
9
|
-
const Accordion = ({ children, caption, style, size, defaultExpanded, onToggle, className, data, title, }) => {
|
|
9
|
+
const Accordion = ({ children, caption, style, size = ElementSize.Medium, defaultExpanded = false, onToggle, className, data, title, }) => {
|
|
10
10
|
const expandablePanelRef = useRef(null);
|
|
11
|
-
const [isExpanded, setIsExpanded] = useState(defaultExpanded
|
|
12
|
-
const [maxHeight, setMaxHeight] = useState(defaultExpanded
|
|
11
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
12
|
+
const [maxHeight, setMaxHeight] = useState(defaultExpanded ? undefined : 0);
|
|
13
13
|
const toggleCollapse = useCallback(() => setMaxHeight(isExpanded ? 0 : expandablePanelRef.current.scrollHeight), [isExpanded]);
|
|
14
14
|
useEffect(() => {
|
|
15
|
-
if (defaultExpanded
|
|
15
|
+
if (defaultExpanded && !isNullOrUndefined(expandablePanelRef.current)) {
|
|
16
16
|
setMaxHeight(expandablePanelRef.current.scrollHeight);
|
|
17
17
|
}
|
|
18
18
|
}, [defaultExpanded]);
|
|
@@ -30,6 +30,6 @@ const Accordion = ({ children, caption, style, size, defaultExpanded, onToggle,
|
|
|
30
30
|
const dataAttributes = isNullOrUndefined(data)
|
|
31
31
|
? undefined
|
|
32
32
|
: mapDataAttributes(data);
|
|
33
|
-
return (_jsxs("article", { className: elClassName, "aria-expanded": isExpanded, ...dataAttributes, children: [_jsxs("div", { className: "message-header is-unselectable", onClick: toggleCollapse, children: [_jsx("span", { title: title, children: caption }), _jsx(Icon, { name: "arrow-down", size: size
|
|
33
|
+
return (_jsxs("article", { className: elClassName, "aria-expanded": isExpanded, ...dataAttributes, children: [_jsxs("div", { className: "message-header is-unselectable", onClick: toggleCollapse, children: [_jsx("span", { title: title, children: caption }), _jsx(Icon, { name: "arrow-down", size: size })] }), _jsx("div", { className: "message-body", ref: expandablePanelRef, style: { maxHeight: `${maxHeight}px` }, children: _jsx("div", { className: "message-body__content", children: children }) })] }));
|
|
34
34
|
};
|
|
35
35
|
export default Accordion;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import { ElementIcon } from "..";
|
|
2
2
|
/** Anchor component props type */
|
|
3
|
-
export interface AnchorProps {
|
|
4
|
-
/** Link destination */
|
|
5
|
-
href?: string;
|
|
6
|
-
/** Link caption */
|
|
7
|
-
caption?: string;
|
|
8
|
-
/** Click handler */
|
|
9
|
-
onClick?: () => void;
|
|
3
|
+
export interface AnchorProps extends Omit<SimpleAnchorProps, "className"> {
|
|
10
4
|
/** Configuration od inner icon */
|
|
11
5
|
icon?: ElementIcon;
|
|
12
|
-
/** Title of anchor */
|
|
13
|
-
title?: string;
|
|
14
|
-
/** Where to open the linked document */
|
|
15
|
-
target?: "_blank" | "_top";
|
|
16
6
|
/** Additional class names */
|
|
17
7
|
className?: string;
|
|
18
8
|
/** Should css hovering effects be disabled */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,kCAAkC;AAClC,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,kCAAkC;AAClC,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC;IACrE,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAC9B,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAC;IAElB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,4BAA4B;IAC5B,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/button/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAe,MAAM,iBAAiB,CAAC;AAO3D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/button/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAe,MAAM,iBAAiB,CAAC;AAO3D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAkD9D"}
|
|
@@ -12,17 +12,18 @@ export default function Button(props) {
|
|
|
12
12
|
if (isNullOrEmpty(props.caption) && isNullOrUndefined(props.icon)) {
|
|
13
13
|
throw new Error("No button content provided.");
|
|
14
14
|
}
|
|
15
|
+
const { light = false, outlined = false, rounded = false, isLoading = false, static: isStatic = false } = props;
|
|
15
16
|
const className = getClassName([
|
|
16
17
|
"button",
|
|
17
18
|
"bbr-button",
|
|
18
19
|
props.className,
|
|
19
20
|
`is-${props.type}`,
|
|
20
|
-
|
|
21
|
+
light ? "is-light" : "",
|
|
21
22
|
!isNullOrUndefined(props.size) ? `is-${props.size}` : "",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
outlined ? "is-outlined" : "",
|
|
24
|
+
rounded ? "is-rounded" : "",
|
|
25
|
+
isLoading ? "is-loading" : "",
|
|
26
|
+
isStatic ? "is-static" : "",
|
|
26
27
|
]);
|
|
27
28
|
const data = isNullOrUndefined(props.data)
|
|
28
29
|
? undefined
|
|
@@ -24,7 +24,8 @@ export interface ButtonProps extends BaseElementProps {
|
|
|
24
24
|
onClick?: () => void;
|
|
25
25
|
}
|
|
26
26
|
/** Button types according to Bulma framework */
|
|
27
|
-
export declare type ButtonType =
|
|
27
|
+
export declare type ButtonType = // TODO: to enum
|
|
28
|
+
"default" /** color: transparent */ | "primary" /** color: sea-wave green */ | "link" /** color: blue-violet */ | "info" /** color: sky-blue */ | "success" /** color: green */ | "warning" /** color: yellow */ | "danger" /** color: red */ | "white" /** color: white */ | "light" /** color: light-gray */ | "dark" /** color: dark-gray */ | "black" /** color: black */ | "text" /** Underline text with color: gray */ | "ghost" /** Blue underline text with color: transparent */;
|
|
28
29
|
/** Simple button props type */
|
|
29
30
|
export interface SimpleButtonProps extends Omit<ButtonProps, 'className'> {
|
|
30
31
|
/** Button class name*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7E,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;IAEjB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mBAAmB;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,gDAAgD;AAChD,oBAAY,UAAU,GAClB,SAAS,CAAC,yBAAyB,GACjC,SAAS,CAAC,4BAA4B,GACtC,MAAM,CAAC,yBAAyB,GAChC,MAAM,CAAC,sBAAsB,GAC7B,SAAS,CAAC,mBAAmB,GAC7B,SAAS,CAAC,oBAAoB,GAC9B,QAAQ,CAAC,iBAAiB,GAC1B,OAAO,CAAC,mBAAmB,GAC3B,OAAO,CAAC,wBAAwB,GAChC,MAAM,CAAC,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,GAC3B,MAAM,CAAC,sCAAsC,GAC7C,OAAO,CAAC,kDAAkD,CAC3D;AAEL,+BAA+B;AAC/B,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IACrE,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,yBAAyB;IACzB,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7E,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;IAEjB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mBAAmB;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,gDAAgD;AAChD,oBAAY,UAAU,GAClB,AADqB,gBAAgB;AACrC,SAAS,CAAC,yBAAyB,GACjC,SAAS,CAAC,4BAA4B,GACtC,MAAM,CAAC,yBAAyB,GAChC,MAAM,CAAC,sBAAsB,GAC7B,SAAS,CAAC,mBAAmB,GAC7B,SAAS,CAAC,oBAAoB,GAC9B,QAAQ,CAAC,iBAAiB,GAC1B,OAAO,CAAC,mBAAmB,GAC3B,OAAO,CAAC,wBAAwB,GAChC,MAAM,CAAC,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,GAC3B,MAAM,CAAC,sCAAsC,GAC7C,OAAO,CAAC,kDAAkD,CAC3D;AAEL,+BAA+B;AAC/B,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IACrE,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,yBAAyB;IACzB,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/component/index.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAKtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,yBAAyB;AACzB,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAMxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAKtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,yBAAyB;AACzB,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAMxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,QAAA,MAAM,eAAe,2IAOlB,aAAa,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,QAAA,MAAM,eAAe,2IAOlB,aAAa,KAAG,WA8GlB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -5,11 +5,11 @@ import { getValidationValues } from "../../../../utils";
|
|
|
5
5
|
import { useComponentOutsideClick } from "../../../../hooks";
|
|
6
6
|
import DropdownItem from "../../../dropdown/components/item";
|
|
7
7
|
import DropdownLabel from "../../../dropdown/components/label";
|
|
8
|
-
const DropdownCompact = ({ items, value, onSelect, deselectable, className, hideOnOuterClick, listMaxHeight, placeholder, compact, disabled, validationState, }) => {
|
|
8
|
+
const DropdownCompact = ({ items, value, onSelect, deselectable = false, className, hideOnOuterClick, listMaxHeight, placeholder, compact = false, disabled = false, validationState, }) => {
|
|
9
9
|
const id = useId();
|
|
10
10
|
const [isListVisible, setListVisible] = useState(false);
|
|
11
11
|
const onItemClick = useCallback((event) => {
|
|
12
|
-
if (disabled
|
|
12
|
+
if (disabled) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const target = event.target;
|
|
@@ -17,7 +17,7 @@ const DropdownCompact = ({ items, value, onSelect, deselectable, className, hide
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const dataValue = target.dataset["dropdownItemValue"];
|
|
20
|
-
if (
|
|
20
|
+
if (isNullOrUndefined(dataValue)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
const item = items.find(x => x.value === dataValue);
|
|
@@ -32,7 +32,7 @@ const DropdownCompact = ({ items, value, onSelect, deselectable, className, hide
|
|
|
32
32
|
setListVisible(false);
|
|
33
33
|
}, [setListVisible, value, items, onSelect, disabled]);
|
|
34
34
|
const onLabelClick = useCallback((event) => {
|
|
35
|
-
if (disabled
|
|
35
|
+
if (disabled) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
const target = event.target;
|
|
@@ -50,14 +50,14 @@ const DropdownCompact = ({ items, value, onSelect, deselectable, className, hide
|
|
|
50
50
|
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
|
|
51
51
|
const classNames = getClassName([
|
|
52
52
|
"bbr-dropdown",
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
disabled ? "bbr-dropdown--disabled" : "",
|
|
54
|
+
compact ? "bbr-dropdown--compact" : "",
|
|
55
55
|
isListVisible ? "is-active" : "",
|
|
56
56
|
isNullOrEmpty(listMaxHeight) ? "bbr-dropdown--height-default" : "",
|
|
57
57
|
className,
|
|
58
58
|
"dropdown",
|
|
59
59
|
]);
|
|
60
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { selectedItem: value, caption: placeholder, onClick: onLabelClick, className: styleClassName, deselectable: deselectable
|
|
60
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { selectedItem: value, caption: placeholder, onClick: onLabelClick, className: styleClassName, deselectable: deselectable }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
61
61
|
? _jsx("ul", { className: "dropdown-content", style: { maxHeight: listMaxHeight }, children: items.map(item => _jsx(DropdownItem, { item: item, onClick: onItemClick, selected: value?.value === item.value }, item.id)) })
|
|
62
62
|
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id), isValidationDefined && validationMessages.length > 0 &&
|
|
63
63
|
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { DropdownProps } from "../../../dropdown";
|
|
3
|
-
declare const DropdownWithLabel: ({ items, value, onSelect, validationState, deselectable, className, hideOnOuterClick, listMaxHeight, label, placeholder, disabled }: DropdownProps) => JSX.Element;
|
|
2
|
+
declare const DropdownWithLabel: ({ items, value, onSelect, validationState, deselectable, className, hideOnOuterClick, listMaxHeight, label, placeholder, disabled, }: DropdownProps) => JSX.Element;
|
|
4
3
|
export default DropdownWithLabel;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/withLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/withLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,QAAA,MAAM,iBAAiB,yIAOpB,aAAa,KAAG,WAoLlB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -5,12 +5,12 @@ import { getValidationValues } from "../../../../utils";
|
|
|
5
5
|
import { useComponentOutsideClick } from "../../../../hooks";
|
|
6
6
|
import DropdownItem from "../../../dropdown/components/item";
|
|
7
7
|
import DropdownLabel from "../../../dropdown/components/label";
|
|
8
|
-
const DropdownWithLabel = ({ items, value, onSelect, validationState, deselectable, className, hideOnOuterClick, listMaxHeight, label, placeholder, disabled }) => {
|
|
8
|
+
const DropdownWithLabel = ({ items, value, onSelect, validationState, deselectable = false, className, hideOnOuterClick, listMaxHeight, label, placeholder, disabled = false, }) => {
|
|
9
9
|
const id = useId();
|
|
10
10
|
const [isListVisible, setListVisible] = useState(false);
|
|
11
11
|
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
|
|
12
12
|
const onItemClick = useCallback((event) => {
|
|
13
|
-
if (disabled
|
|
13
|
+
if (disabled) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const target = event.target;
|
|
@@ -33,7 +33,7 @@ const DropdownWithLabel = ({ items, value, onSelect, validationState, deselectab
|
|
|
33
33
|
setListVisible(false);
|
|
34
34
|
}, [setListVisible, value, items, onSelect, disabled]);
|
|
35
35
|
const onLabelClick = useCallback((event) => {
|
|
36
|
-
if (disabled
|
|
36
|
+
if (disabled) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const target = event.target;
|
|
@@ -50,7 +50,7 @@ const DropdownWithLabel = ({ items, value, onSelect, validationState, deselectab
|
|
|
50
50
|
useComponentOutsideClick(`[data-dropdown-id="${id}"]`, isListVisible, () => setListVisible(false), hideOnOuterClick);
|
|
51
51
|
const classNames = getClassName([
|
|
52
52
|
"bbr-dropdown",
|
|
53
|
-
|
|
53
|
+
disabled ? "bbr-dropdown--disabled" : "",
|
|
54
54
|
isListVisible ? "is-active" : "",
|
|
55
55
|
isNullOrEmpty(listMaxHeight) ? "bbr-dropdown--height-default" : "",
|
|
56
56
|
className,
|
|
@@ -70,12 +70,12 @@ const DropdownWithLabel = ({ items, value, onSelect, validationState, deselectab
|
|
|
70
70
|
"field-body",
|
|
71
71
|
label.horizontalFieldContainerClassName
|
|
72
72
|
]);
|
|
73
|
-
return (_jsxs("div", { className: "bbr-dropdown__root-container--with-label bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { className: styleClassName, caption: placeholder, deselectable: deselectable
|
|
73
|
+
return (_jsxs("div", { className: "bbr-dropdown__root-container--with-label bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { className: styleClassName, caption: placeholder, deselectable: deselectable, selectedItem: value, onClick: onLabelClick }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
74
74
|
? _jsx("ul", { className: "dropdown-content", style: { maxHeight: listMaxHeight }, children: items.map(item => _jsx(DropdownItem, { item: item, selected: value?.value === item.value, onClick: onItemClick }, item.id)) })
|
|
75
75
|
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id), isValidationDefined && validationMessages.length > 0 &&
|
|
76
76
|
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
77
77
|
}
|
|
78
|
-
return (_jsxs("div", { className: "field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { className: styleClassName, caption: placeholder, deselectable: deselectable
|
|
78
|
+
return (_jsxs("div", { className: "field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { className: styleClassName, caption: placeholder, deselectable: deselectable, selectedItem: value, onClick: onLabelClick }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
79
79
|
? _jsx("ul", { className: "dropdown-content", style: { maxHeight: listMaxHeight }, children: items.map(item => _jsx(DropdownItem, { item: item, selected: value?.value === item.value, onClick: onItemClick }, item.id)) })
|
|
80
80
|
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id), isValidationDefined && validationMessages.length > 0 &&
|
|
81
81
|
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
@@ -4,5 +4,5 @@ import { PaginatorProps } from "../../paginator";
|
|
|
4
4
|
* Paginator component.
|
|
5
5
|
* Used for visualization of paging configuration
|
|
6
6
|
*/
|
|
7
|
-
export default function Paginator({ count, onPageChange, currentPage, position,
|
|
7
|
+
export default function Paginator({ count, onPageChange, currentPage, position, size, className, rounded, showNextButtons, nearPagesCount }: PaginatorProps): JSX.Element;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/paginator/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAuB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhF;;;EAGE;AACF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAC9B,KAAK,EAAE,YAAY,EAAE,WAAW,EAChC,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/paginator/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAuB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhF;;;EAGE;AACF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAC9B,KAAK,EAAE,YAAY,EAAE,WAAW,EAChC,QAAQ,EACR,IAAI,EAAE,SAAS,EACf,OAAe,EAAE,eAAuB,EACxC,cAAc,EACjB,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CA4G9B"}
|
|
@@ -6,7 +6,7 @@ import { generatePageNumbers } from "../../paginator";
|
|
|
6
6
|
* Paginator component.
|
|
7
7
|
* Used for visualization of paging configuration
|
|
8
8
|
*/
|
|
9
|
-
export default function Paginator({ count, onPageChange, currentPage, position,
|
|
9
|
+
export default function Paginator({ count, onPageChange, currentPage, position, size, className, rounded = false, showNextButtons = false, nearPagesCount }) {
|
|
10
10
|
const page = currentPage || 0;
|
|
11
11
|
const pageChange = useCallback((event) => {
|
|
12
12
|
const target = event.target;
|
|
@@ -29,11 +29,11 @@ export default function Paginator({ count, onPageChange, currentPage, position,
|
|
|
29
29
|
"bbr-paginator",
|
|
30
30
|
"pagination",
|
|
31
31
|
paginationPositionToClassMap.has(position || "") ? paginationPositionToClassMap.get(position || "") : "",
|
|
32
|
-
rounded
|
|
32
|
+
rounded ? "is-rounded" : "",
|
|
33
33
|
isNullOrEmpty(size) ? "" : `is-${size}`,
|
|
34
34
|
className
|
|
35
35
|
]);
|
|
36
|
-
return (_jsxs("nav", { className: classNames, role: "navigation", "aria-label": "pagination", children: [showNextButtons
|
|
36
|
+
return (_jsxs("nav", { className: classNames, role: "navigation", "aria-label": "pagination", children: [showNextButtons &&
|
|
37
37
|
_jsxs(_Fragment, { children: [_jsx("a", { className: `pagination-previous${canGoBack ? "" : " is-disabled"}`, "data-page": page - 1, onClick: pageChange, children: "Previous" }), _jsx("a", { className: `pagination-next${canGoForward ? "" : " is-disabled"}`, "data-page": page + 1, onClick: pageChange, children: "Next page" })] }), _jsxs("ul", { className: "pagination-list", children: [page !== 1 && !pageNumbers.includes(1) &&
|
|
38
38
|
_jsxs(_Fragment, { children: [_jsx("li", { children: _jsx("a", { className: "pagination-link", "aria-label": "Goto page 1", "data-page": 1, onClick: pageChange, children: "1" }) }), _jsx("li", { children: _jsx("span", { className: "pagination-ellipsis", children: "\u2026" }) })] }), pageNumbers.map(x => _jsx("li", { children: _jsx("a", { className: `pagination-link${page === x ? " is-current" : ""}`, "aria-label": `Goto page ${x}`, "data-page": x, onClick: pageChange, children: x }) }, x)), page != count && !pageNumbers.includes(count) &&
|
|
39
39
|
_jsxs(_Fragment, { children: [_jsx("li", { children: _jsx("span", { className: "pagination-ellipsis", children: "\u2026" }) }), _jsx("li", { children: _jsx("a", { className: "pagination-link", "aria-label": `Goto page ${count}`, "data-page": count, onClick: pageChange, children: count }) })] })] })] }));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import "./style.scss";
|
|
3
2
|
import { CheckBoxProps } from "../../checkbox";
|
|
4
3
|
/** Boolean input component */
|
|
5
|
-
declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled,
|
|
4
|
+
declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, size, style, rounded, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, }: CheckBoxProps) => JSX.Element;
|
|
6
5
|
export default CheckBox;
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":"AAIA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,6JAOX,aAAa,KAAG,WAoFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -3,21 +3,21 @@ import { useCallback } from "react";
|
|
|
3
3
|
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import "./style.scss";
|
|
5
5
|
/** Boolean input component */
|
|
6
|
-
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled,
|
|
6
|
+
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, size, style, rounded = false, block = false, withoutBorder = false, hasBackgroundColor = false, fixBackgroundColor = false, isFormLabel = false, }) => {
|
|
7
7
|
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
8
8
|
const id = name || generateGuid();
|
|
9
9
|
const className = getClassName([
|
|
10
10
|
"is-checkradio",
|
|
11
11
|
"m-check-radio",
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
hasBackgroundColor ? "has-background-color" : "",
|
|
13
|
+
fixBackgroundColor && hasBackgroundColor ? "m-has-background-color" : "",
|
|
14
14
|
isNullOrUndefined(size) ? "" : size === "normal" ? "" : `is-${size}`,
|
|
15
|
-
|
|
15
|
+
rounded ? "is-circle" : "",
|
|
16
16
|
isNullOrUndefined(style) ? "" : `is-${style}`,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
block ? "is-block" : "",
|
|
18
|
+
withoutBorder ? "has-no-border" : "",
|
|
19
19
|
]);
|
|
20
|
-
if (!isNullOrUndefined(label) && isFormLabel
|
|
20
|
+
if (!isNullOrUndefined(label) && isFormLabel) {
|
|
21
21
|
const labelClassName = getClassName([
|
|
22
22
|
"label",
|
|
23
23
|
label.className
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseInputElementProps } from "../..";
|
|
2
2
|
/** Checkbox component props type */
|
|
3
|
-
export interface CheckBoxProps extends BaseInputElementProps<boolean> {
|
|
3
|
+
export interface CheckBoxProps extends Omit<BaseInputElementProps<boolean>, "readonly" | "validationState" | "loading" | "placeholder"> {
|
|
4
4
|
/** Is full colored checkbox */
|
|
5
5
|
block?: boolean;
|
|
6
6
|
/** Remove the checkbox border */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtE,UAAU,GAAG,iBAAiB,GAC5B,SAAS,GAAG,aAAa,CAC9B;IACG,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iCAAiC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;MAGE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;MAIE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/color/component/index.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAKtC,6BAA6B;AAC7B,QAAA,MAAM,WAAW,UAAW,gBAAgB,KAAG,WAGF,CACxC;AAEL,eAAe,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/color/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAKtC,6BAA6B;AAC7B,QAAA,MAAM,WAAW,UAAW,gBAAgB,KAAG,WAGF,CACxC;AAEL,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColorPickerProps } from "../..";
|
|
3
3
|
/** Color picker component with form label */
|
|
4
|
-
declare function ColorPickerWithLabel({ className, title, showPreview, name, defaultValue, validationState,
|
|
4
|
+
declare function ColorPickerWithLabel({ className, title, showPreview, name, defaultValue, validationState, onValueChange, data, disabled, rounded, label, }: ColorPickerProps): JSX.Element;
|
|
5
5
|
export default ColorPickerWithLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC1B,SAAS,EAAE,KAAK,EAChB,WAAW,EACX,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,6CAA6C;AAC7C,iBAAS,oBAAoB,CAAC,EAC1B,SAAS,EAAE,KAAK,EAChB,WAAW,EACX,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,aAAa,EACb,IAAI,EACJ,QAAgB,EAAE,OAAe,EACjC,KAAK,GACR,EAAE,gBAAgB,eAiHlB;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -4,17 +4,18 @@ import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whit
|
|
|
4
4
|
import { getValidationValues, mapDataAttributes } from "../../../../..";
|
|
5
5
|
import ColorPickerControl from "../picker";
|
|
6
6
|
/** Color picker component with form label */
|
|
7
|
-
function ColorPickerWithLabel({ className, title, showPreview, name, defaultValue, validationState,
|
|
7
|
+
function ColorPickerWithLabel({ className, title, showPreview, name, defaultValue, validationState, onValueChange, data, disabled = false, rounded = false, label, }) {
|
|
8
8
|
const defaultColor = isNullOrUndefined(defaultValue)
|
|
9
9
|
? whiteHex
|
|
10
10
|
: rgbToHex(defaultValue);
|
|
11
11
|
const [value, setValue] = useState(defaultColor);
|
|
12
|
-
const
|
|
13
|
-
useEffect(() =>
|
|
12
|
+
const onChange = useCallback((event) => setValue(event.target.value), [setValue]);
|
|
13
|
+
useEffect(() => onValueChange?.call(undefined, hexToRgb(value)), [onValueChange, value]);
|
|
14
14
|
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
|
|
15
15
|
const elClassName = getClassName([
|
|
16
16
|
className,
|
|
17
17
|
styleClassName,
|
|
18
|
+
rounded ? "is-rounded" : "",
|
|
18
19
|
"input",
|
|
19
20
|
]);
|
|
20
21
|
const inputContainerClassName = getClassName([
|
|
@@ -40,8 +41,8 @@ function ColorPickerWithLabel({ className, title, showPreview, name, defaultValu
|
|
|
40
41
|
"field-body",
|
|
41
42
|
label.horizontalFieldContainerClassName
|
|
42
43
|
]);
|
|
43
|
-
return (_jsxs("div", { className: "bbr-color-picker bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsx("div", { className: "field", children: _jsx(ColorPickerControl, { containerClassName: inputContainerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange:
|
|
44
|
+
return (_jsxs("div", { className: "bbr-color-picker bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsx("div", { className: "field", children: _jsx(ColorPickerControl, { containerClassName: inputContainerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange: onChange, value: value, id: id, title: title, dataAttributes: dataAttributes, isValidationDefined: isValidationDefined, validationMessages: validationMessages, styleClassName: styleClassName }) }) })] }));
|
|
44
45
|
}
|
|
45
|
-
return (_jsxs("div", { className: "bbr-color-picker bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx(ColorPickerControl, { containerClassName: inputContainerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange:
|
|
46
|
+
return (_jsxs("div", { className: "bbr-color-picker bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx(ColorPickerControl, { containerClassName: inputContainerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange: onChange, value: value, id: id, title: title, dataAttributes: dataAttributes, isValidationDefined: isValidationDefined, validationMessages: validationMessages, styleClassName: styleClassName })] }));
|
|
46
47
|
}
|
|
47
48
|
export default ColorPickerWithLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColorPickerProps } from "../..";
|
|
3
3
|
/** Color picker component without form label */
|
|
4
|
-
declare function ColorPickerWithoutLabel({ className, title, showPreview, name, defaultValue, validationState,
|
|
4
|
+
declare function ColorPickerWithoutLabel({ className, title, showPreview, name, defaultValue, validationState, onValueChange, data, disabled, rounded, }: ColorPickerProps): JSX.Element;
|
|
5
5
|
export default ColorPickerWithoutLabel;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,iBAAS,uBAAuB,CAAC,EAC7B,SAAS,EAAE,KAAK,EAChB,WAAW,EACX,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/color/components/withoutLabel/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGzC,gDAAgD;AAChD,iBAAS,uBAAuB,CAAC,EAC7B,SAAS,EAAE,KAAK,EAChB,WAAW,EACX,IAAI,EACJ,YAAY,EAAE,eAAe,EAC7B,aAAa,EACb,IAAI,EACJ,QAAgB,EAAE,OAAe,GACpC,EAAE,gBAAgB,eA+ElB;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -4,17 +4,18 @@ import { generateGuid, getClassName, hexToRgb, isNullOrUndefined, rgbToHex, whit
|
|
|
4
4
|
import { getValidationValues, mapDataAttributes } from "../../../../..";
|
|
5
5
|
import ColorPickerControl from "../picker";
|
|
6
6
|
/** Color picker component without form label */
|
|
7
|
-
function ColorPickerWithoutLabel({ className, title, showPreview, name, defaultValue, validationState,
|
|
7
|
+
function ColorPickerWithoutLabel({ className, title, showPreview, name, defaultValue, validationState, onValueChange, data, disabled = false, rounded = false, }) {
|
|
8
8
|
const defaultColor = isNullOrUndefined(defaultValue)
|
|
9
9
|
? whiteHex
|
|
10
10
|
: rgbToHex(defaultValue);
|
|
11
11
|
const [value, setValue] = useState(defaultColor);
|
|
12
|
-
const
|
|
13
|
-
useEffect(() =>
|
|
12
|
+
const onChange = useCallback((event) => setValue(event.target.value), [setValue]);
|
|
13
|
+
useEffect(() => onValueChange?.call(undefined, hexToRgb(value)), [onValueChange, value]);
|
|
14
14
|
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
|
|
15
15
|
const elClassName = getClassName([
|
|
16
16
|
className,
|
|
17
17
|
styleClassName,
|
|
18
|
+
rounded ? "is-rounded" : "",
|
|
18
19
|
"input",
|
|
19
20
|
]);
|
|
20
21
|
const containerClassName = getClassName([
|
|
@@ -27,8 +28,8 @@ function ColorPickerWithoutLabel({ className, title, showPreview, name, defaultV
|
|
|
27
28
|
: mapDataAttributes(data);
|
|
28
29
|
const id = name || generateGuid();
|
|
29
30
|
if (showPreview) {
|
|
30
|
-
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { containerClassName: containerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange:
|
|
31
|
+
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { containerClassName: containerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange: onChange, value: value, id: id, title: title, dataAttributes: dataAttributes, isValidationDefined: isValidationDefined, validationMessages: validationMessages, styleClassName: styleClassName }) }));
|
|
31
32
|
}
|
|
32
|
-
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { containerClassName: containerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange:
|
|
33
|
+
return (_jsx("div", { className: "bbr-color-picker", children: _jsx(ColorPickerControl, { containerClassName: containerClassName, className: elClassName, disabled: disabled, showPreview: showPreview, defaultColor: defaultColor, onValueChange: onChange, value: value, id: id, title: title, dataAttributes: dataAttributes, isValidationDefined: isValidationDefined, validationMessages: validationMessages, styleClassName: styleClassName }) }));
|
|
33
34
|
}
|
|
34
35
|
export default ColorPickerWithoutLabel;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import { Color } from "@bodynarf/utils";
|
|
2
|
-
import { BaseElementProps, InputLabel, ValidationState } from "../../..";
|
|
3
1
|
import { CSSProperties } from "react";
|
|
2
|
+
import { Color } from "@bodynarf/utils";
|
|
3
|
+
import { BaseInputElementProps } from "../../..";
|
|
4
4
|
/** Color picker props type */
|
|
5
|
-
export interface ColorPickerProps extends
|
|
6
|
-
/** Default color value */
|
|
7
|
-
defaultValue?: Color;
|
|
8
|
-
/** Label configuration */
|
|
9
|
-
label?: InputLabel;
|
|
10
|
-
/** Change extra handler */
|
|
11
|
-
onChange?: (color: Color) => void;
|
|
12
|
-
/** Name of element. Required for form elements */
|
|
13
|
-
name?: string;
|
|
14
|
-
/** Should be component disabled. Selecting is not allowed */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** Current validation state */
|
|
17
|
-
validationState?: ValidationState;
|
|
5
|
+
export interface ColorPickerProps extends Omit<BaseInputElementProps<Color>, "style" | "loading" | "size" | "readonly" | "placeholder"> {
|
|
18
6
|
/**
|
|
19
7
|
* Show text with color preview.
|
|
20
8
|
* If set - outlined button-like element on the right will be rendered
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/color/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/color/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,MAAM,CAAC;AAE7C,8BAA8B;AAC9B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EACvE,OAAO,GAAG,SAAS,GACjB,MAAM,GAAG,UAAU,GAAG,aAAa,CACxC;IACG;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC3D,gDAAgD;IAChD,kCAAkC,EAAE,MAAM,CAAC;IAE3C,sDAAsD;IACtD,uBAAuB,EAAE,MAAM,CAAC;CACnC"}
|
|
@@ -5,7 +5,7 @@ import "../../../../common.scss";
|
|
|
5
5
|
import { ElementSize } from "../../..";
|
|
6
6
|
import { getValidationValues } from "../../../../utils";
|
|
7
7
|
/** Date input component */
|
|
8
|
-
const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded, loading, style, label, onBlur }) => {
|
|
8
|
+
const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded = false, loading = false, style, label, onBlur }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value)
|
|
10
10
|
? undefined
|
|
11
11
|
: new Date(event.target.value)), [onValueChange]);
|
|
@@ -16,12 +16,12 @@ const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validatio
|
|
|
16
16
|
className,
|
|
17
17
|
elSizeClassName,
|
|
18
18
|
styleClassName,
|
|
19
|
-
rounded
|
|
19
|
+
rounded ? "is-rounded" : "",
|
|
20
20
|
"input",
|
|
21
21
|
]);
|
|
22
22
|
const inputContainerClassName = getClassName([
|
|
23
23
|
"control",
|
|
24
|
-
loading
|
|
24
|
+
loading ? "is-loading" : "",
|
|
25
25
|
]);
|
|
26
26
|
const stringifiedDefValue = defaultValue?.toISOString().split("T")[0];
|
|
27
27
|
const labelClassName = getClassName([
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { MultilineProps } from "../../../multiline";
|
|
3
2
|
/** Multiline textual input component with describing label */
|
|
4
3
|
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded, loading, label, placeholder, fixed, rows, onBlur }: MultilineProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,kKAOrB,cAAc,KAAG,WAyGnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
|
4
4
|
import { ElementSize } from "../../../..";
|
|
5
5
|
import { getValidationValues } from "../../../../../utils";
|
|
6
6
|
/** Multiline textual input component with describing label */
|
|
7
|
-
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded, loading, label, placeholder, fixed, rows, onBlur }) => {
|
|
7
|
+
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded = false, loading = false, label, placeholder, fixed = false, rows, onBlur }) => {
|
|
8
8
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
9
|
const id = name || generateGuid();
|
|
10
10
|
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
@@ -12,14 +12,14 @@ const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, read
|
|
|
12
12
|
const elClassName = getClassName([
|
|
13
13
|
className,
|
|
14
14
|
elSizeClassName,
|
|
15
|
-
rounded
|
|
15
|
+
rounded ? "is-rounded" : "",
|
|
16
16
|
styleClassName,
|
|
17
17
|
"textarea",
|
|
18
|
-
fixed
|
|
18
|
+
fixed ? "has-fixed-size" : "",
|
|
19
19
|
]);
|
|
20
20
|
const inputContainerClassName = getClassName([
|
|
21
21
|
"control",
|
|
22
|
-
loading
|
|
22
|
+
loading ? "is-loading" : "",
|
|
23
23
|
]);
|
|
24
24
|
const labelClassName = getClassName([
|
|
25
25
|
"label",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { MultilineProps } from "../../../multiline";
|
|
3
2
|
/** Multiline textual input component without describing label*/
|
|
4
3
|
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded, loading, fixed, rows, }: MultilineProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,wIAMxB,cAAc,KAAG,WA2CnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|