@bodynarf/react.components 1.8.21 → 1.9.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/common.scss +3 -2
- package/components/accordion/component/index.d.ts +2 -2
- package/components/accordion/component/index.d.ts.map +1 -1
- package/components/accordion/component/index.js +4 -4
- package/components/accordion/types.d.ts +1 -1
- package/components/accordion/types.d.ts.map +1 -1
- package/components/anchor/component/index.d.ts +1 -1
- package/components/anchor/component/index.d.ts.map +1 -1
- package/components/anchor/component/index.js +6 -6
- package/components/anchor/components/anchorWithIcon/index.d.ts +3 -2
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -1
- package/components/anchor/components/anchorWithIcon/index.js +14 -9
- package/components/anchor/components/simpleAnchor/index.d.ts +3 -2
- package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -1
- package/components/anchor/components/simpleAnchor/index.js +8 -2
- package/components/anchor/types.d.ts +2 -6
- package/components/anchor/types.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.d.ts +34 -0
- package/components/breadcrumbs/component/index.d.ts.map +1 -0
- package/components/breadcrumbs/component/index.js +21 -0
- package/components/breadcrumbs/index.d.ts +3 -0
- package/components/breadcrumbs/index.d.ts.map +1 -0
- package/components/breadcrumbs/index.js +2 -0
- package/components/breadcrumbs/types.d.ts +13 -0
- package/components/breadcrumbs/types.d.ts.map +1 -0
- package/components/button/component/index.d.ts +1 -1
- package/components/button/component/index.d.ts.map +1 -1
- package/components/button/component/index.js +4 -8
- package/components/button/components/buttonWithIcon/index.d.ts +3 -2
- package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
- package/components/button/components/buttonWithIcon/index.js +14 -9
- package/components/button/components/simpleButton/index.d.ts +3 -2
- package/components/button/components/simpleButton/index.d.ts.map +1 -1
- package/components/button/components/simpleButton/index.js +8 -2
- package/components/button/types.d.ts +1 -1
- package/components/button/types.d.ts.map +1 -1
- package/components/button/types.js +0 -3
- package/components/dropdown/component/index.d.ts +1 -1
- package/components/dropdown/component/index.d.ts.map +1 -1
- package/components/dropdown/component/index.js +5 -8
- package/components/dropdown/component/style.scss +5 -1
- package/components/dropdown/components/compact/index.d.ts +2 -2
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +12 -9
- package/components/dropdown/components/item/index.d.ts +1 -1
- package/components/dropdown/components/item/index.d.ts.map +1 -1
- package/components/dropdown/components/item/index.js +34 -2
- package/components/dropdown/components/label/index.d.ts +1 -1
- package/components/dropdown/components/label/index.d.ts.map +1 -1
- package/components/dropdown/components/label/index.js +41 -9
- package/components/dropdown/components/withLabel/index.d.ts +2 -2
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +14 -12
- package/components/dropdown/types.d.ts +13 -2
- package/components/dropdown/types.d.ts.map +1 -1
- package/components/icon/component/index.d.ts +2 -2
- package/components/icon/component/index.d.ts.map +1 -1
- package/components/icon/component/index.js +9 -5
- package/components/icon/types.d.ts +2 -4
- package/components/icon/types.d.ts.map +1 -1
- package/components/index.d.ts +0 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +0 -1
- package/components/paginator/component/index.d.ts +2 -2
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +19 -14
- package/components/paginator/types.d.ts +3 -5
- package/components/paginator/types.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.d.ts +2 -2
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +15 -17
- package/components/primitives/checkbox/types.d.ts +2 -2
- package/components/primitives/checkbox/types.d.ts.map +1 -1
- package/components/primitives/color/component/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.d.ts +11 -29
- package/components/primitives/color/components/picker/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.js +20 -17
- 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 +8 -30
- 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 +3 -13
- package/components/primitives/color/types.d.ts +1 -1
- package/components/primitives/color/types.d.ts.map +1 -1
- package/components/primitives/date/component/index.d.ts +2 -2
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +12 -27
- package/components/primitives/date/types.d.ts +2 -2
- package/components/primitives/date/types.d.ts.map +1 -1
- package/components/primitives/index.d.ts +0 -1
- package/components/primitives/index.d.ts.map +1 -1
- package/components/primitives/index.js +0 -1
- package/components/primitives/internal/componentWithLabel/index.d.ts +17 -0
- package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -0
- package/components/primitives/internal/componentWithLabel/index.js +26 -0
- package/components/primitives/internal/hint/index.d.ts +13 -0
- package/components/primitives/internal/hint/index.d.ts.map +1 -0
- package/components/primitives/internal/hint/index.js +47 -0
- package/components/primitives/multiline/component/index.d.ts +1 -1
- package/components/primitives/multiline/component/index.d.ts.map +1 -1
- package/components/primitives/multiline/component/index.js +5 -8
- package/components/primitives/multiline/components/withLabel/index.d.ts +6 -0
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/withLabel/index.js +29 -0
- package/components/primitives/multiline/components/withoutLabel/index.d.ts +6 -0
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/withoutLabel/index.js +28 -0
- package/components/primitives/multiline/types.d.ts +1 -1
- package/components/primitives/multiline/types.d.ts.map +1 -1
- package/components/primitives/number/component/index.d.ts +1 -1
- package/components/primitives/number/component/index.d.ts.map +1 -1
- package/components/primitives/number/component/index.js +5 -8
- package/components/primitives/number/components/withLabel/index.d.ts +2 -2
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +12 -27
- package/components/primitives/number/components/withoutLabel/index.d.ts +2 -2
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +11 -9
- package/components/primitives/number/types.d.ts +1 -1
- package/components/primitives/number/types.d.ts.map +1 -1
- package/components/primitives/password/component/index.d.ts +1 -1
- package/components/primitives/password/component/index.d.ts.map +1 -1
- package/components/primitives/password/component/index.js +5 -6
- package/components/primitives/password/components/withLabel/index.d.ts +2 -2
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +14 -30
- package/components/primitives/password/components/withoutLabel/index.d.ts +2 -2
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +13 -11
- package/components/primitives/password/types.d.ts +1 -1
- package/components/primitives/password/types.d.ts.map +1 -1
- package/components/primitives/text/component/index.d.ts +1 -1
- package/components/primitives/text/component/index.d.ts.map +1 -1
- package/components/primitives/text/component/index.js +5 -8
- package/components/primitives/text/components/withLabel/index.d.ts +6 -0
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/withLabel/index.js +29 -0
- package/components/primitives/text/components/withoutLabel/index.d.ts +6 -0
- package/components/primitives/text/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/withoutLabel/index.js +28 -0
- package/components/primitives/text/types.d.ts +1 -1
- package/components/primitives/text/types.d.ts.map +1 -1
- package/components/search/component/index.d.ts +2 -2
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +16 -10
- package/components/search/types.d.ts +2 -2
- package/components/search/types.d.ts.map +1 -1
- package/components/table/component/index.d.ts +43 -0
- package/components/table/component/index.d.ts.map +1 -0
- package/components/table/component/index.js +27 -0
- package/components/table/components/heading/index.d.ts +13 -0
- package/components/table/components/heading/index.d.ts.map +1 -0
- package/components/table/components/heading/index.js +21 -0
- package/components/table/index.d.ts +3 -0
- package/components/table/index.d.ts.map +1 -0
- package/components/table/index.js +2 -0
- package/components/table/types.d.ts +18 -0
- package/components/table/types.d.ts.map +1 -0
- package/components/tabs/component/index.d.ts +3 -3
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +14 -8
- package/components/tabs/components/item/index.d.ts +1 -1
- package/components/tabs/components/item/index.d.ts.map +1 -1
- package/components/tabs/components/item/index.js +4 -3
- package/components/tabs/types.d.ts +1 -12
- package/components/tabs/types.d.ts.map +1 -1
- package/components/tabs/types.js +0 -12
- package/components/tag/component/index.d.ts +2 -2
- package/components/tag/component/index.d.ts.map +1 -1
- package/components/tag/component/index.js +13 -7
- package/components/tag/types.d.ts +1 -1
- package/components/tag/types.d.ts.map +1 -1
- package/hooks/usePagination.d.ts.map +1 -1
- package/hooks/usePagination.js +11 -2
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/package.json +11 -4
- package/readme.md +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/baseElementProps.d.ts +11 -0
- package/types/baseElementProps.d.ts.map +1 -0
- package/types/baseElementProps.js +1 -0
- package/{components/primitives/types/baseProps.d.ts → types/baseInputElementProps.d.ts} +10 -4
- package/types/baseInputElementProps.d.ts.map +1 -0
- package/types/baseInputElementProps.js +1 -0
- package/types/dataAttributes.d.ts +9 -0
- package/types/dataAttributes.d.ts.map +1 -0
- package/types/dataAttributes.js +1 -0
- package/types/elementColor.d.ts +18 -0
- package/types/elementColor.d.ts.map +1 -0
- package/types/elementColor.js +18 -0
- package/types/elementIcon.d.ts +22 -0
- package/types/elementIcon.d.ts.map +1 -0
- package/types/elementIcon.js +1 -0
- package/types/elementPosition.d.ts +12 -0
- package/types/elementPosition.d.ts.map +1 -0
- package/types/elementPosition.js +10 -0
- package/types/elementSize.d.ts +12 -0
- package/types/elementSize.d.ts.map +1 -0
- package/types/elementSize.js +12 -0
- package/types/hintConfiguration.d.ts +13 -0
- package/types/hintConfiguration.d.ts.map +1 -0
- package/types/hintConfiguration.js +1 -0
- package/types/index.d.ts +11 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +10 -0
- package/{components/primitives/types/label.d.ts → types/labelConfiguration.d.ts} +3 -3
- package/types/labelConfiguration.d.ts.map +1 -0
- package/types/labelConfiguration.js +1 -0
- package/{components/primitives/types → types}/validation/index.d.ts +1 -1
- package/types/validation/index.d.ts.map +1 -0
- package/{components/primitives/types → types}/validation/index.js +1 -1
- package/{components/primitives/types → types}/validation/state.d.ts +2 -2
- package/types/validation/state.d.ts.map +1 -0
- package/{components/primitives/types → types}/validation/state.js +0 -1
- package/{components/primitives/types → types}/validation/status.d.ts +1 -1
- package/types/validation/status.d.ts.map +1 -0
- package/{components/primitives/types → types}/validation/status.js +1 -2
- package/utils/dataAttributes.d.ts +1 -1
- package/utils/dataAttributes.d.ts.map +1 -1
- package/utils/index.d.ts +1 -1
- package/utils/index.d.ts.map +1 -1
- package/utils/index.js +1 -1
- package/utils/validation.d.ts +11 -0
- package/utils/validation.d.ts.map +1 -0
- package/utils/validation.js +20 -0
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +0 -6
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.js +0 -44
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +0 -6
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +0 -26
- package/components/primitives/text/components/textWithLabel/index.d.ts +0 -6
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +0 -1
- package/components/primitives/text/components/textWithLabel/index.js +0 -44
- package/components/primitives/text/components/textWithoutLabel/index.d.ts +0 -6
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/text/components/textWithoutLabel/index.js +0 -26
- package/components/primitives/types/baseProps.d.ts.map +0 -1
- package/components/primitives/types/index.d.ts +0 -4
- package/components/primitives/types/index.d.ts.map +0 -1
- package/components/primitives/types/index.js +0 -3
- package/components/primitives/types/label.d.ts.map +0 -1
- package/components/primitives/types/validation/index.d.ts.map +0 -1
- package/components/primitives/types/validation/state.d.ts.map +0 -1
- package/components/primitives/types/validation/status.d.ts.map +0 -1
- package/components/types.d.ts +0 -78
- package/components/types.d.ts.map +0 -1
- package/components/types.js +0 -41
- package/utils/formValidation.d.ts +0 -16
- package/utils/formValidation.d.ts.map +0 -1
- package/utils/formValidation.js +0 -35
- /package/components/{primitives/types/baseProps.js → breadcrumbs/types.js} +0 -0
- /package/components/{primitives/types/label.js → table/types.js} +0 -0
package/common.scss
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./style.scss";
|
|
3
|
-
import { AccordionProps } from "
|
|
3
|
+
import { AccordionProps } from "..";
|
|
4
4
|
/** Accordion panel */
|
|
5
|
-
declare const Accordion: ({ children, caption, style, size, defaultExpanded, onToggle, className,
|
|
5
|
+
declare const Accordion: ({ children, caption, style, size, defaultExpanded, onToggle, className, title, data, }: AccordionProps) => JSX.Element;
|
|
6
6
|
export default Accordion;
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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":";AAQA,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,sBAAsB;AACtB,QAAA,MAAM,SAAS,2FAOZ,cAAc,KAAG,WA+DnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
-
import "
|
|
5
|
-
import { ElementSize } from "../..";
|
|
6
|
-
import Icon from "../../icon";
|
|
4
|
+
import { ElementSize } from "../../../types";
|
|
7
5
|
import { mapDataAttributes } from "../../../utils";
|
|
6
|
+
import Icon from "../../icon";
|
|
7
|
+
import "./style.scss";
|
|
8
8
|
/** Accordion panel */
|
|
9
|
-
const Accordion = ({ children, caption, style, size = ElementSize.Normal, defaultExpanded = false, onToggle, className,
|
|
9
|
+
const Accordion = ({ children, caption, style, size = ElementSize.Normal, defaultExpanded = false, onToggle, className, title, data, }) => {
|
|
10
10
|
const expandablePanelRef = useRef(null);
|
|
11
11
|
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
12
12
|
const [maxHeight, setMaxHeight] = useState(defaultExpanded ? undefined : 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BaseElementProps, ElementColor, ElementSize } from "
|
|
2
|
+
import { BaseElementProps, ElementColor, ElementSize } from "../../types";
|
|
3
3
|
/** Accordion panel props type */
|
|
4
4
|
export interface AccordionProps extends BaseElementProps {
|
|
5
5
|
/** Content that should be collapsed inside */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzE,iCAAiC;AACjC,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,8CAA8C;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAEhB,6BAA6B;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,iBAAiB;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,YAAY;IACZ,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/anchor/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/anchor/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAIjC,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA6B9D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrUndefined,
|
|
2
|
+
import { isNullOrUndefined, getClassName } from "@bodynarf/utils";
|
|
3
3
|
import "./style.scss";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import SimpleAnchor from "../components/simpleAnchor";
|
|
5
|
+
import AnchorWithIcon from "../components/anchorWithIcon";
|
|
6
6
|
/** Anchor component */
|
|
7
7
|
export default function Anchor(props) {
|
|
8
8
|
if (isNullOrUndefined(props.caption) && isNullOrUndefined(props.icon)) {
|
|
@@ -10,11 +10,11 @@ export default function Anchor(props) {
|
|
|
10
10
|
}
|
|
11
11
|
const className = getClassName([
|
|
12
12
|
"bbr-anchor",
|
|
13
|
-
|
|
14
|
-
props.disableHovering === true ? "
|
|
13
|
+
props.className,
|
|
14
|
+
props.disableHovering === true ? "bbr-anchor--unhoverable" : ""
|
|
15
15
|
]);
|
|
16
16
|
if (isNullOrUndefined(props.icon)) {
|
|
17
17
|
return (_jsx(SimpleAnchor, { ...props, className: className, onClick: props.onClick }));
|
|
18
18
|
}
|
|
19
|
-
return (_jsx(AnchorWithIcon, { ...props, className: className, onClick: props.onClick
|
|
19
|
+
return (_jsx(AnchorWithIcon, { ...props, icon: props.icon, className: className, onClick: props.onClick }));
|
|
20
20
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AnchorWithIconProps } from "
|
|
2
|
+
import { AnchorWithIconProps } from "../..";
|
|
3
3
|
/** Anchor with icon component */
|
|
4
|
-
|
|
4
|
+
declare const AnchorWithIcon: ({ href, className, onClick, caption, target, icon, title, data, }: AnchorWithIconProps) => JSX.Element;
|
|
5
|
+
export default AnchorWithIcon;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/anchorWithIcon/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/anchorWithIcon/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,iCAAiC;AACjC,QAAA,MAAM,cAAc,sEAKjB,mBAAmB,KAAG,WA0CxB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrEmpty } from "@bodynarf/utils";
|
|
2
|
+
import { isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { ElementPosition } from "../../../../types";
|
|
4
|
+
import { mapDataAttributes } from "../../../../utils";
|
|
3
5
|
import Icon from "../../../icon";
|
|
4
6
|
/** Anchor with icon component */
|
|
5
|
-
|
|
6
|
-
const iconPosition = icon.position || "left";
|
|
7
|
+
const AnchorWithIcon = ({ href, className, onClick, caption, target, icon, title, data, }) => {
|
|
7
8
|
const iconClassName = isNullOrEmpty(caption)
|
|
8
9
|
? icon.className
|
|
9
|
-
:
|
|
10
|
-
? `${icon.className} bbr-icon--
|
|
11
|
-
: `${icon.className} bbr-icon--
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
: icon.position === ElementPosition.Right
|
|
11
|
+
? `${icon.className} bbr-icon--right`
|
|
12
|
+
: `${icon.className} bbr-icon--left`;
|
|
13
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
14
|
+
? undefined
|
|
15
|
+
: mapDataAttributes(data);
|
|
16
|
+
if (icon.position === ElementPosition.Right) {
|
|
17
|
+
return (_jsxs("a", { href: href, target: target, onClick: onClick, className: className, title: title, ...dataAttributes, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
|
|
14
18
|
}
|
|
15
|
-
return (_jsxs("a", { href: href, className: className,
|
|
19
|
+
return (_jsxs("a", { href: href, className: className, target: target, onClick: onClick, title: title, ...dataAttributes, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
|
|
16
20
|
};
|
|
21
|
+
export default AnchorWithIcon;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SimpleAnchorProps } from "
|
|
2
|
+
import { SimpleAnchorProps } from "../..";
|
|
3
3
|
/** Simple anchor component, without icon */
|
|
4
|
-
|
|
4
|
+
declare const SimpleAnchor: ({ href, className, onClick, caption, target, title, data, }: SimpleAnchorProps) => JSX.Element;
|
|
5
|
+
export default SimpleAnchor;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/simpleAnchor/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/simpleAnchor/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,4CAA4C;AAC5C,QAAA,MAAM,YAAY,gEAIf,iBAAiB,KAAG,WAkBtB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { mapDataAttributes } from "../../../../utils";
|
|
2
4
|
/** Simple anchor component, without icon */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
const SimpleAnchor = ({ href, className, onClick, caption, target, title, data, }) => {
|
|
6
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
7
|
+
? undefined
|
|
8
|
+
: mapDataAttributes(data);
|
|
9
|
+
return (_jsx("a", { href: href, target: target, onClick: onClick, className: className, title: title, ...dataAttributes, children: caption }));
|
|
5
10
|
};
|
|
11
|
+
export default SimpleAnchor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementIcon } from "
|
|
1
|
+
import { BaseElementProps, ElementIcon } from "../../types";
|
|
2
2
|
/** Anchor component props type */
|
|
3
3
|
export interface AnchorProps extends Omit<SimpleAnchorProps, "className"> {
|
|
4
4
|
/** Configuration od inner icon */
|
|
@@ -8,17 +8,13 @@ export interface AnchorProps extends Omit<SimpleAnchorProps, "className"> {
|
|
|
8
8
|
/** Should css hovering effects be disabled */
|
|
9
9
|
disableHovering?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export interface SimpleAnchorProps {
|
|
11
|
+
export interface SimpleAnchorProps extends BaseElementProps {
|
|
12
12
|
/** Link destination */
|
|
13
13
|
href?: string;
|
|
14
|
-
/** Class names */
|
|
15
|
-
className: string;
|
|
16
14
|
/** Click handler */
|
|
17
15
|
onClick?: () => void;
|
|
18
16
|
/** Link caption */
|
|
19
17
|
caption?: string;
|
|
20
|
-
/** Title of anchor */
|
|
21
|
-
title?: string;
|
|
22
18
|
/** Where to open the linked document */
|
|
23
19
|
target?: "_blank" | "_top";
|
|
24
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3D,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,iBAAkB,SAAQ,gBAAgB;IACvD,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,4BAA4B;IAC5B,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseElementProps, ElementSize } from "../../../types";
|
|
3
|
+
import { BreadCrumb } from "../types";
|
|
4
|
+
/** Breadcrumbs component props type */
|
|
5
|
+
export interface BreadcrumbsProps extends BaseElementProps {
|
|
6
|
+
/** Breadcrumbs items */
|
|
7
|
+
items: Array<BreadCrumb>;
|
|
8
|
+
/**
|
|
9
|
+
* Function that generates each element
|
|
10
|
+
* @example
|
|
11
|
+
* <Link to={breadCrumb.path}>
|
|
12
|
+
* {breadCrumb.icon &&
|
|
13
|
+
* <span>
|
|
14
|
+
* <Icon {...breadCrumb.icon} />
|
|
15
|
+
* </span>
|
|
16
|
+
* }
|
|
17
|
+
* <span>
|
|
18
|
+
* {breadCrumb.title}
|
|
19
|
+
* </span>
|
|
20
|
+
* </Link>
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
elementGenerator: (bc: BreadCrumb) => JSX.Element;
|
|
24
|
+
/** Panel size */
|
|
25
|
+
size?: ElementSize;
|
|
26
|
+
/** Items position */
|
|
27
|
+
position?: "centered" | "right";
|
|
28
|
+
/** Items separator. By default `arrow` */
|
|
29
|
+
separator?: "arrow" | "bullet" | "dot" | "succeeds";
|
|
30
|
+
}
|
|
31
|
+
/** Breadcrumbs navigation panel */
|
|
32
|
+
declare const BreadCrumbs: ({ items, size, position, separator, elementGenerator, className, title, data, }: BreadcrumbsProps) => JSX.Element;
|
|
33
|
+
export default BreadCrumbs;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/breadcrumbs/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,uCAAuC;AACvC,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACtD,wBAAwB;IACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAEzB;;;;;;;;;;;;;;MAcE;IACF,gBAAgB,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,GAAG,CAAC,OAAO,CAAC;IAElD,iBAAiB;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAEhC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,CAAC;CACvD;AAED,mCAAmC;AACnC,QAAA,MAAM,WAAW,oFAMd,gBAAgB,KAAG,WAsCrB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { mapDataAttributes } from "../../../utils";
|
|
4
|
+
/** Breadcrumbs navigation panel */
|
|
5
|
+
const BreadCrumbs = ({ items, size, position, separator = "arrow", elementGenerator, className, title, data, }) => {
|
|
6
|
+
if (items.length <= 1) {
|
|
7
|
+
return _jsx(_Fragment, {});
|
|
8
|
+
}
|
|
9
|
+
const elClassName = getClassName([
|
|
10
|
+
"breadcrumb",
|
|
11
|
+
className,
|
|
12
|
+
isNullOrUndefined(size) ? undefined : `is-${size}`,
|
|
13
|
+
`has-${separator}-separator`,
|
|
14
|
+
isNullOrUndefined(position) ? undefined : `is-${position}`,
|
|
15
|
+
]);
|
|
16
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
17
|
+
? undefined
|
|
18
|
+
: mapDataAttributes(data);
|
|
19
|
+
return (_jsx("nav", { className: elClassName, "aria-label": "breadcrumbs", title: title, ...dataAttributes, children: _jsx("ul", { children: items.map(breadCrumb => _jsx("li", { className: breadCrumb.active ? "is-active" : undefined, "aria-current": breadCrumb.active ? "page" : undefined, children: elementGenerator(breadCrumb) }, breadCrumb.path)) }) }));
|
|
20
|
+
};
|
|
21
|
+
export default BreadCrumbs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumbs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ElementIcon } from "../../types";
|
|
2
|
+
/** Breadcrumb item */
|
|
3
|
+
export interface BreadCrumb {
|
|
4
|
+
/** Displayed text */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Page address */
|
|
7
|
+
path: string;
|
|
8
|
+
/** Is current page. Will be not clickable */
|
|
9
|
+
active: boolean;
|
|
10
|
+
/** Bootstrap icon class name */
|
|
11
|
+
icon?: ElementIcon;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/breadcrumbs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,sBAAsB;AACtB,MAAM,WAAW,UAAU;IACvB,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IAEd,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IAEb,6CAA6C;IAC7C,MAAM,EAAE,OAAO,CAAC;IAEhB,gCAAgC;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -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,
|
|
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,IAAI,CAAC;AAIjC;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA4C9D"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrEmpty, isNullOrUndefined, getClassName } from "@bodynarf/utils";
|
|
3
3
|
import "./style.scss";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { SimpleButton } from "../../button/components/simpleButton";
|
|
4
|
+
import ButtonWithIcon from "../components/buttonWithIcon";
|
|
5
|
+
import SimpleButton from "../components/simpleButton";
|
|
7
6
|
/**
|
|
8
7
|
* Button component
|
|
9
8
|
* @throws Caption is not defined and icon configuration is not defined at the same time
|
|
@@ -25,13 +24,10 @@ export default function Button(props) {
|
|
|
25
24
|
isLoading ? "is-loading" : "",
|
|
26
25
|
isStatic ? "is-static" : "",
|
|
27
26
|
]);
|
|
28
|
-
const data = isNullOrUndefined(props.data)
|
|
29
|
-
? undefined
|
|
30
|
-
: mapDataAttributes(props.data);
|
|
31
27
|
if (!isNullOrUndefined(props.icon)) {
|
|
32
|
-
return (_jsx(ButtonWithIcon, { ...props, className: className, onClick: props.onClick, icon: props.icon
|
|
28
|
+
return (_jsx(ButtonWithIcon, { ...props, className: className, onClick: props.onClick, icon: props.icon }));
|
|
33
29
|
}
|
|
34
30
|
else {
|
|
35
|
-
return (_jsx(SimpleButton, { ...props, className: className, onClick: props.onClick
|
|
31
|
+
return (_jsx(SimpleButton, { ...props, className: className, onClick: props.onClick }));
|
|
36
32
|
}
|
|
37
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonWithIconProps } from "
|
|
2
|
+
import { ButtonWithIconProps } from "../..";
|
|
3
3
|
/** Button with icon component */
|
|
4
|
-
|
|
4
|
+
declare const ButtonWithIcon: ({ className, disabled, onClick, caption, icon, title, data, }: ButtonWithIconProps) => JSX.Element;
|
|
5
|
+
export default ButtonWithIcon;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/buttonWithIcon/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/buttonWithIcon/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,iCAAiC;AACjC,QAAA,MAAM,cAAc,kEAMjB,mBAAmB,KAAG,WA4CxB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrEmpty } from "@bodynarf/utils";
|
|
2
|
+
import { isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { ElementPosition } from "../../../../types";
|
|
4
|
+
import { mapDataAttributes } from "../../../../utils";
|
|
3
5
|
import Icon from "../../../icon";
|
|
4
6
|
/** Button with icon component */
|
|
5
|
-
|
|
6
|
-
const iconPosition = icon.position || "left";
|
|
7
|
+
const ButtonWithIcon = ({ className, disabled, onClick, caption, icon, title, data, }) => {
|
|
7
8
|
const iconClassName = isNullOrEmpty(caption)
|
|
8
9
|
? icon.className
|
|
9
|
-
:
|
|
10
|
-
? `${icon.className} bbr-icon--
|
|
11
|
-
: `${icon.className} bbr-icon--
|
|
10
|
+
: icon.position === ElementPosition.Right
|
|
11
|
+
? `${icon.className} bbr-icon--right`
|
|
12
|
+
: `${icon.className} bbr-icon--left`;
|
|
12
13
|
className = isNullOrEmpty(caption)
|
|
13
14
|
? `${className} bbr-button--icon-only`
|
|
14
15
|
: className;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
17
|
+
? undefined
|
|
18
|
+
: mapDataAttributes(data);
|
|
19
|
+
if (icon.position === ElementPosition.Right) {
|
|
20
|
+
return (_jsxs("button", { onClick: onClick, disabled: disabled, className: className, title: title, ...dataAttributes, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
|
|
17
21
|
}
|
|
18
|
-
return (_jsxs("button", {
|
|
22
|
+
return (_jsxs("button", { onClick: onClick, disabled: disabled, className: className, title: title, ...dataAttributes, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
|
|
19
23
|
};
|
|
24
|
+
export default ButtonWithIcon;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SimpleButtonProps } from "
|
|
2
|
+
import { SimpleButtonProps } from "../..";
|
|
3
3
|
/** Simple button component, without icon */
|
|
4
|
-
|
|
4
|
+
declare const SimpleButton: ({ className, disabled, onClick, caption, title, data }: SimpleButtonProps) => JSX.Element;
|
|
5
|
+
export default SimpleButton;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/simpleButton/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/simpleButton/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,4CAA4C;AAC5C,QAAA,MAAM,YAAY,2DAMf,iBAAiB,KAAG,WAiBtB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { mapDataAttributes } from "../../../../utils";
|
|
2
4
|
/** Simple button component, without icon */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
const SimpleButton = ({ className, disabled, onClick, caption, title, data }) => {
|
|
6
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
7
|
+
? undefined
|
|
8
|
+
: mapDataAttributes(data);
|
|
9
|
+
return (_jsx("button", { onClick: onClick, disabled: disabled, className: className, title: title, ...dataAttributes, children: caption }));
|
|
5
10
|
};
|
|
11
|
+
export default SimpleButton;
|
|
@@ -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,
|
|
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,YAAY,CAAC;AAExE,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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAInC,yBAAyB;AACzB,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAIxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import "./style.scss";
|
|
4
|
-
import DropdownWithLabel from "
|
|
5
|
-
import DropdownCompact from "
|
|
4
|
+
import DropdownWithLabel from "../components/withLabel";
|
|
5
|
+
import DropdownCompact from "../components/compact";
|
|
6
6
|
/** Dropdown component */
|
|
7
7
|
const Dropdown = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
else {
|
|
12
|
-
return _jsx(DropdownCompact, { ...props });
|
|
13
|
-
}
|
|
8
|
+
return isNullOrUndefined(props.label)
|
|
9
|
+
? _jsx(DropdownCompact, { ...props })
|
|
10
|
+
: _jsx(DropdownWithLabel, { ...props });
|
|
14
11
|
};
|
|
15
12
|
export default Dropdown;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
font-style: italic;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.bbr-icon {
|
|
38
|
+
.bbr-icon:not(.bbr-dropdown-item__icon) {
|
|
39
39
|
&:hover {
|
|
40
40
|
color: #0d6efd;
|
|
41
41
|
}
|
|
@@ -81,6 +81,10 @@
|
|
|
81
81
|
background-color: #485fc7;
|
|
82
82
|
color: #fff;
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
&__icon {
|
|
86
|
+
padding-left: 0.05rem;
|
|
87
|
+
}
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
&.is-active {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DropdownProps } from "
|
|
3
|
-
declare const DropdownCompact: ({ items, value, onSelect, deselectable,
|
|
2
|
+
import { DropdownProps } from "../..";
|
|
3
|
+
declare const DropdownCompact: ({ items, value, onSelect, deselectable, hideOnOuterClick, listMaxHeight, placeholder, compact, disabled, validationState, className, title, data, hint, }: DropdownProps) => JSX.Element;
|
|
4
4
|
export default DropdownCompact;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,QAAA,MAAM,eAAe,8JAUlB,aAAa,KAAG,WAsHlB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useId, useState } from "react";
|
|
3
3
|
import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
-
import {
|
|
4
|
+
import { getStyleClassName, mapDataAttributes } from "../../../../utils";
|
|
5
5
|
import { useComponentOutsideClick } from "../../../../hooks";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
6
|
+
import InternalHint from "../../../primitives/internal/hint";
|
|
7
|
+
import DropdownItem from "../../components/item";
|
|
8
|
+
import DropdownLabel from "../../components/label";
|
|
9
|
+
const DropdownCompact = ({ items, value, onSelect, deselectable = false, hideOnOuterClick, listMaxHeight, placeholder, compact = false, disabled = false, validationState, className, title, data, hint, }) => {
|
|
9
10
|
const id = useId();
|
|
10
11
|
const [isListVisible, setListVisible] = useState(false);
|
|
11
12
|
const onItemClick = useCallback((event) => {
|
|
@@ -47,19 +48,21 @@ const DropdownCompact = ({ items, value, onSelect, deselectable = false, classNa
|
|
|
47
48
|
}
|
|
48
49
|
}, [onSelect, setListVisible, disabled]);
|
|
49
50
|
useComponentOutsideClick(`[data-dropdown-id="${id}"]`, isListVisible, () => setListVisible(false), hideOnOuterClick);
|
|
50
|
-
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(undefined, validationState);
|
|
51
51
|
const classNames = getClassName([
|
|
52
52
|
"bbr-dropdown",
|
|
53
|
+
className,
|
|
53
54
|
disabled ? "bbr-dropdown--disabled" : "",
|
|
54
55
|
compact ? "bbr-dropdown--compact" : "",
|
|
55
56
|
isListVisible ? "is-active" : "",
|
|
56
57
|
isNullOrEmpty(listMaxHeight) ? "bbr-dropdown--height-default" : "",
|
|
57
|
-
className,
|
|
58
58
|
"dropdown",
|
|
59
59
|
]);
|
|
60
|
-
|
|
60
|
+
const labelComponentClassName = getStyleClassName(undefined, validationState);
|
|
61
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
62
|
+
? undefined
|
|
63
|
+
: mapDataAttributes(data);
|
|
64
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames, "data-dropdown-id": id, title: title, ...dataAttributes, children: [_jsx(DropdownLabel, { selectedItem: value, caption: placeholder, onClick: onLabelClick, deselectable: deselectable, className: labelComponentClassName }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
61
65
|
? _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
|
-
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id),
|
|
63
|
-
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
66
|
+
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
64
67
|
};
|
|
65
68
|
export default DropdownCompact;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/item/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/item/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,0BAA0B;AAC1B,UAAU,iBAAiB;IACvB,kCAAkC;IAClC,IAAI,EAAE,cAAc,CAAC;IAErB,sBAAsB;IACtB,QAAQ,EAAE,OAAO,CAAC;IAElB,yBAAyB;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED,wCAAwC;AACxC,QAAA,MAAM,YAAY,gCAEf,iBAAiB,KAAG,WA4BtB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|