@synerise/ds-cascader 1.1.25 → 1.1.27
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/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/dist/Cascader.d.ts +2 -2
- package/dist/Cascader.js +85 -143
- package/dist/Cascader.styles.d.ts +6 -6
- package/dist/Cascader.styles.js +19 -17
- package/dist/Cascader.types.d.ts +1 -1
- package/dist/Cascader.types.js +1 -1
- package/dist/Elements/BackAction/BackAction.d.ts +2 -2
- package/dist/Elements/BackAction/BackAction.js +18 -16
- package/dist/Elements/BackAction/BackAction.styles.d.ts +4 -4
- package/dist/Elements/BackAction/BackAction.styles.js +15 -17
- package/dist/Elements/BackAction/BackAction.types.d.ts +1 -1
- package/dist/Elements/BackAction/BackAction.types.js +1 -1
- package/dist/Elements/BottomAction/BottomAction.d.ts +2 -2
- package/dist/Elements/BottomAction/BottomAction.js +14 -13
- package/dist/Elements/BottomAction/BottomAction.styles.d.ts +3 -3
- package/dist/Elements/BottomAction/BottomAction.styles.js +11 -14
- package/dist/Elements/BottomAction/BottomAction.types.d.ts +1 -1
- package/dist/Elements/BottomAction/BottomAction.types.js +1 -1
- package/dist/Elements/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/dist/Elements/Breadcrumb/Breadcrumb.js +47 -73
- package/dist/Elements/Breadcrumb/Breadcrumb.styles.d.ts +13 -13
- package/dist/Elements/Breadcrumb/Breadcrumb.styles.js +36 -46
- package/dist/Elements/Breadcrumb/Breadcrumb.types.d.ts +2 -2
- package/dist/Elements/Breadcrumb/Breadcrumb.types.js +1 -1
- package/dist/Elements/Breadcrumb/utils.d.ts +1 -1
- package/dist/Elements/Breadcrumb/utils.js +15 -9
- package/dist/Elements/BreadcrumbsList/BreadcrumbsList.d.ts +4 -4
- package/dist/Elements/BreadcrumbsList/BreadcrumbsList.js +28 -35
- package/dist/Elements/BreadcrumbsList/BreadcrumbsList.types.d.ts +2 -2
- package/dist/Elements/BreadcrumbsList/BreadcrumbsList.types.js +1 -1
- package/dist/Elements/CategoriesList/CategoriesList.d.ts +2 -2
- package/dist/Elements/CategoriesList/CategoriesList.js +26 -49
- package/dist/Elements/CategoriesList/CategoriesList.types.d.ts +2 -2
- package/dist/Elements/CategoriesList/CategoriesList.types.js +1 -1
- package/dist/Elements/Navigation/Navigation.d.ts +2 -2
- package/dist/Elements/Navigation/Navigation.js +32 -40
- package/dist/Elements/Navigation/Navigation.types.d.ts +1 -1
- package/dist/Elements/Navigation/Navigation.types.js +1 -1
- package/dist/index.js +6 -2
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +37 -43
- package/package.json +13 -13
|
@@ -1,81 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var breadcrumbsArray = [].concat(path);
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState, useEffect } from "react";
|
|
3
|
+
import { theme } from "@synerise/ds-core";
|
|
4
|
+
import Icon, { AngleRightS } from "@synerise/ds-icon";
|
|
5
|
+
import { renderWithHighlight } from "@synerise/ds-utils";
|
|
6
|
+
import { Breadcrumb as Breadcrumb$1, OuterWrapper, PrefixWrapper, InnerWrapper, Description, ContentWrapper, BreadcrumbContent, BreadcrumbRoute, BreadcrumbName, ArrowRight } from "./Breadcrumb.styles.js";
|
|
7
|
+
import { isOverflown, attachActiveClassName, shouldHaveArrowPlaceholder, shouldRenderArrow } from "./utils.js";
|
|
8
|
+
const Breadcrumb = ({
|
|
9
|
+
path,
|
|
10
|
+
disabled,
|
|
11
|
+
highlight,
|
|
12
|
+
description,
|
|
13
|
+
onPathClick,
|
|
14
|
+
compact,
|
|
15
|
+
startWithArrow,
|
|
16
|
+
gradientOverlap,
|
|
17
|
+
highlightActivePath,
|
|
18
|
+
className,
|
|
19
|
+
prefixel,
|
|
20
|
+
isNavigation,
|
|
21
|
+
...rest
|
|
22
|
+
}) => {
|
|
23
|
+
const pathToDisplay = useMemo(() => {
|
|
24
|
+
const breadcrumbsArray = [...path];
|
|
26
25
|
return compact ? breadcrumbsArray.reverse() : breadcrumbsArray;
|
|
27
26
|
}, [compact, path]);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
var shouldRenderGradientOverlap = gradientOverlap && isOverflown(contentRef);
|
|
27
|
+
const contentRef = useRef(null);
|
|
28
|
+
const [gradient, setGradient] = useState(false);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const shouldRenderGradientOverlap = gradientOverlap && isOverflown(contentRef);
|
|
34
31
|
setGradient(!!shouldRenderGradientOverlap);
|
|
35
32
|
}, [path, contentRef, gradientOverlap]);
|
|
36
|
-
|
|
37
|
-
if (description && typeof description ===
|
|
38
|
-
return renderWithHighlight(description, highlight,
|
|
33
|
+
const descriptionWithHighlight = useMemo(() => {
|
|
34
|
+
if (description && typeof description === "string" && highlight) {
|
|
35
|
+
return renderWithHighlight(description, highlight, "search-highlight", "search-highlight");
|
|
39
36
|
}
|
|
40
37
|
return description;
|
|
41
38
|
}, [description, highlight]);
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"data-testid": "ds-cascader-breadcrumb-content",
|
|
59
|
-
gradientOverlap: gradient
|
|
60
|
-
}, /*#__PURE__*/React.createElement(S.BreadcrumbContent, {
|
|
61
|
-
className: "breadcrumb-content",
|
|
62
|
-
ref: contentRef
|
|
63
|
-
}, pathToDisplay.map(function (item, index) {
|
|
64
|
-
return /*#__PURE__*/React.createElement(S.BreadcrumbRoute, {
|
|
65
|
-
className: "route",
|
|
66
|
-
key: item + "-" + index
|
|
67
|
-
}, /*#__PURE__*/React.createElement(S.BreadcrumbName, {
|
|
68
|
-
className: "ds-breadcrumb-name " + attachActiveClassName(index, !!highlightActivePath, path, !!compact),
|
|
69
|
-
onClick: function onClick() {
|
|
70
|
-
onPathClick == null || onPathClick(item);
|
|
71
|
-
}
|
|
72
|
-
}, renderWithHighlight(item, highlight)), shouldHaveArrowPlaceholder(index, path, !!compact, !!startWithArrow) && /*#__PURE__*/React.createElement(S.ArrowRight, {
|
|
73
|
-
className: "ds-arrow",
|
|
74
|
-
visible: shouldRenderArrow(path, index, !!startWithArrow)
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
76
|
-
component: /*#__PURE__*/React.createElement(AngleRightS, null),
|
|
77
|
-
color: theme.palette['grey-600']
|
|
78
|
-
})));
|
|
79
|
-
}))))));
|
|
39
|
+
return /* @__PURE__ */ jsx(Breadcrumb$1, { tabIndex: 0, role: "menuitem", "data-testid": "ds-cascader-breadrumb", className: `${className} ds-breadcrumb`, prefixel: !!prefixel, disabled, compact, clickable: !!onPathClick, isNavigation, ...rest, children: /* @__PURE__ */ jsxs(OuterWrapper, { children: [
|
|
40
|
+
prefixel && /* @__PURE__ */ jsx(PrefixWrapper, { "data-testid": "list-item-prefix", disabled, children: prefixel }),
|
|
41
|
+
/* @__PURE__ */ jsxs(InnerWrapper, { children: [
|
|
42
|
+
!!description && /* @__PURE__ */ jsx(Description, { "data-testid": "ds-cascader-breadcrumb-description", children: descriptionWithHighlight }),
|
|
43
|
+
/* @__PURE__ */ jsx(ContentWrapper, { "data-testid": "ds-cascader-breadcrumb-content", gradientOverlap: gradient, children: /* @__PURE__ */ jsx(BreadcrumbContent, { className: "breadcrumb-content", ref: contentRef, children: pathToDisplay.map((item, index) => /* @__PURE__ */ jsxs(BreadcrumbRoute, { className: "route", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(BreadcrumbName, { className: `ds-breadcrumb-name ${attachActiveClassName(index, !!highlightActivePath, path, !!compact)}`, onClick: () => {
|
|
45
|
+
onPathClick?.(item);
|
|
46
|
+
}, children: renderWithHighlight(item, highlight) }),
|
|
47
|
+
shouldHaveArrowPlaceholder(index, path, !!compact, !!startWithArrow) && /* @__PURE__ */ jsx(ArrowRight, { className: "ds-arrow", visible: shouldRenderArrow(path, index, !!startWithArrow), children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleRightS, {}), color: theme.palette["grey-600"] }) })
|
|
48
|
+
] }, `${item}-${index}`)) }) })
|
|
49
|
+
] })
|
|
50
|
+
] }) });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
Breadcrumb,
|
|
54
|
+
Breadcrumb as default
|
|
80
55
|
};
|
|
81
|
-
export default Breadcrumb;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const PrefixWrapper: import(
|
|
1
|
+
import { ThemeProps } from '@synerise/ds-core';
|
|
2
|
+
import { StyledListItem } from '@synerise/ds-list-item';
|
|
3
|
+
export declare const PrefixWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}, never>;
|
|
7
|
-
export declare const Highlight: import(
|
|
8
|
-
export declare const ArrowRight: import(
|
|
7
|
+
export declare const Highlight: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
8
|
+
export declare const ArrowRight: import('styled-components').StyledComponent<"div", any, {
|
|
9
9
|
visible: boolean;
|
|
10
10
|
}, never>;
|
|
11
|
-
export declare const BreadcrumbContent: import(
|
|
11
|
+
export declare const BreadcrumbContent: import('styled-components').StyledComponent<"div", any, {
|
|
12
12
|
prefixel?: boolean;
|
|
13
13
|
}, never>;
|
|
14
|
-
export declare const Description: import(
|
|
15
|
-
export declare const ContentWrapper: import(
|
|
14
|
+
export declare const Description: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
15
|
+
export declare const ContentWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
16
16
|
gradientOverlap?: boolean;
|
|
17
17
|
}, never>;
|
|
18
|
-
export declare const BreadcrumbName: import(
|
|
18
|
+
export declare const BreadcrumbName: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
19
19
|
export declare const disableDefaultClickingStyles: (props: ThemeProps & {
|
|
20
20
|
disabled?: boolean;
|
|
21
|
-
}) => import(
|
|
22
|
-
export declare const OuterWrapper: import(
|
|
23
|
-
export declare const InnerWrapper: import(
|
|
21
|
+
}) => import('styled-components').FlattenSimpleInterpolation;
|
|
22
|
+
export declare const OuterWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
23
|
+
export declare const InnerWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
24
24
|
type BreadcrumbProps = {
|
|
25
25
|
clickable?: boolean;
|
|
26
26
|
prefixel?: boolean;
|
|
@@ -30,5 +30,5 @@ type BreadcrumbProps = {
|
|
|
30
30
|
isNavigation?: boolean;
|
|
31
31
|
};
|
|
32
32
|
export declare const Breadcrumb: StyledListItem<BreadcrumbProps>;
|
|
33
|
-
export declare const BreadcrumbRoute: import(
|
|
33
|
+
export declare const BreadcrumbRoute: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
34
34
|
export {};
|
|
@@ -1,73 +1,63 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import ListItem from
|
|
3
|
-
import { Inner } from
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import ListItem from "@synerise/ds-list-item";
|
|
3
|
+
import { Inner } from "@synerise/ds-list-item/dist/components/Text/Text.styles";
|
|
4
|
+
const TRANSITION_FN = "0.3s ease-in-out";
|
|
5
|
+
const PrefixWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
6
6
|
displayName: "Breadcrumbstyles__PrefixWrapper",
|
|
7
7
|
componentId: "sc-1rgfkd8-0"
|
|
8
8
|
})(["display:flex;order:1;opacity:1;transition:opacity ", ";margin-top:-7px;margin-bottom:-7px;margin-left:-4px;margin-right:12px;align-items:center;"], TRANSITION_FN);
|
|
9
|
-
|
|
9
|
+
const Highlight = /* @__PURE__ */ styled.span.withConfig({
|
|
10
10
|
displayName: "Breadcrumbstyles__Highlight",
|
|
11
11
|
componentId: "sc-1rgfkd8-1"
|
|
12
12
|
})([""]);
|
|
13
|
-
|
|
13
|
+
const ArrowRight = /* @__PURE__ */ styled.div.withConfig({
|
|
14
14
|
displayName: "Breadcrumbstyles__ArrowRight",
|
|
15
15
|
componentId: "sc-1rgfkd8-2"
|
|
16
|
-
})(["transition:opacity ", ";opacity:", ";svg{transition:fill ", ";}"], TRANSITION_FN,
|
|
17
|
-
|
|
18
|
-
}, TRANSITION_FN);
|
|
19
|
-
export var BreadcrumbContent = styled.div.withConfig({
|
|
16
|
+
})(["transition:opacity ", ";opacity:", ";svg{transition:fill ", ";}"], TRANSITION_FN, (props) => props.visible ? "1" : "0", TRANSITION_FN);
|
|
17
|
+
const BreadcrumbContent = /* @__PURE__ */ styled.div.withConfig({
|
|
20
18
|
displayName: "Breadcrumbstyles__BreadcrumbContent",
|
|
21
19
|
componentId: "sc-1rgfkd8-3"
|
|
22
20
|
})(["display:flex;align-items:center;"]);
|
|
23
|
-
|
|
21
|
+
const Description = /* @__PURE__ */ styled.div.withConfig({
|
|
24
22
|
displayName: "Breadcrumbstyles__Description",
|
|
25
23
|
componentId: "sc-1rgfkd8-4"
|
|
26
|
-
})(["direction:ltr;width:100%;font-weight:400;color:", ";.search-highlight{font-weight:500;}text-overflow:ellipsis;overflow:hidden;"],
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
export var ContentWrapper = styled.div.withConfig({
|
|
24
|
+
})(["direction:ltr;width:100%;font-weight:400;color:", ";.search-highlight{font-weight:500;}text-overflow:ellipsis;overflow:hidden;"], (props) => props.theme.palette["grey-600"]);
|
|
25
|
+
const ContentWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
30
26
|
displayName: "Breadcrumbstyles__ContentWrapper",
|
|
31
27
|
componentId: "sc-1rgfkd8-5"
|
|
32
|
-
})(["position:relative;&::before{pointer-events:none;content:'';opacity:", ";position:absolute;display:block;width:50px;height:18px;transition:opacity ", ";background-image:", ";}&::after{pointer-events:none;content:'';opacity:", ";position:absolute;left:0;top:0;display:block;width:50px;height:18px;transition:opacity ", ";background-image:", ";}"],
|
|
33
|
-
|
|
34
|
-
}, TRANSITION_FN, function (props) {
|
|
35
|
-
return "-webkit-linear-gradient( left, " + props.theme.palette['grey-050'] + " 0%, rgba(255,255,255,0) 100% )";
|
|
36
|
-
}, function (props) {
|
|
37
|
-
return props.gradientOverlap ? '1' : '0';
|
|
38
|
-
}, TRANSITION_FN, function (props) {
|
|
39
|
-
return "-webkit-linear-gradient( left, " + props.theme.palette.white + " 0%, rgba(255,255,255,0) 100% )";
|
|
40
|
-
});
|
|
41
|
-
export var BreadcrumbName = styled.div.withConfig({
|
|
28
|
+
})(["position:relative;&::before{pointer-events:none;content:'';opacity:", ";position:absolute;display:block;width:50px;height:18px;transition:opacity ", ";background-image:", ";}&::after{pointer-events:none;content:'';opacity:", ";position:absolute;left:0;top:0;display:block;width:50px;height:18px;transition:opacity ", ";background-image:", ";}"], (props) => props.gradientOverlap ? "1" : "0", TRANSITION_FN, (props) => `-webkit-linear-gradient( left, ${props.theme.palette["grey-050"]} 0%, rgba(255,255,255,0) 100% )`, (props) => props.gradientOverlap ? "1" : "0", TRANSITION_FN, (props) => `-webkit-linear-gradient( left, ${props.theme.palette.white} 0%, rgba(255,255,255,0) 100% )`);
|
|
29
|
+
const BreadcrumbName = /* @__PURE__ */ styled.div.withConfig({
|
|
42
30
|
displayName: "Breadcrumbstyles__BreadcrumbName",
|
|
43
31
|
componentId: "sc-1rgfkd8-6"
|
|
44
|
-
})(["direction:ltr;font-weight:400;transition:color ", ";color:", ";.search-highlight{font-weight:500;}"], TRANSITION_FN,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export var disableDefaultClickingStyles = function disableDefaultClickingStyles(props) {
|
|
48
|
-
return css(["&,&:focus,&:hover{background:", " !important;box-shadow:inset 0 0 0 2px transparent !important;", ",", "{color:", ";}", " > .ds-icon > svg{fill:", ";}}", ":hover,", ":hover{color:", ";}&&&:hover{", "{.ds-icon > svg{fill:", " !important;}}}&&&{", ":hover{.ds-icon > svg{fill:", " !important;}}"], props.theme.palette.white, BreadcrumbName, Description, props.theme.palette['grey-600'], ArrowRight, props.theme.palette['grey-600'], BreadcrumbName, Description, props.disabled ? props.theme.palette['grey-600'] : props.theme.palette['blue-600'], PrefixWrapper, props.theme.palette['grey-600'], PrefixWrapper, props.theme.palette['blue-600']);
|
|
49
|
-
};
|
|
50
|
-
export var OuterWrapper = styled.div.withConfig({
|
|
32
|
+
})(["direction:ltr;font-weight:400;transition:color ", ";color:", ";.search-highlight{font-weight:500;}"], TRANSITION_FN, (props) => props.theme.palette["grey-600"]);
|
|
33
|
+
const disableDefaultClickingStyles = (props) => css(["&,&:focus,&:hover{background:", " !important;box-shadow:inset 0 0 0 2px transparent !important;", ",", "{color:", ";}", " > .ds-icon > svg{fill:", ";}}", ":hover,", ":hover{color:", ";}&&&:hover{", "{.ds-icon > svg{fill:", " !important;}}}&&&{", ":hover{.ds-icon > svg{fill:", " !important;}}"], props.theme.palette.white, BreadcrumbName, Description, props.theme.palette["grey-600"], ArrowRight, props.theme.palette["grey-600"], BreadcrumbName, Description, props.disabled ? props.theme.palette["grey-600"] : props.theme.palette["blue-600"], PrefixWrapper, props.theme.palette["grey-600"], PrefixWrapper, props.theme.palette["blue-600"]);
|
|
34
|
+
const OuterWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
51
35
|
displayName: "Breadcrumbstyles__OuterWrapper",
|
|
52
36
|
componentId: "sc-1rgfkd8-7"
|
|
53
37
|
})(["padding:7px 0;width:100%;display:flex;align-items:center;flex-wrap:nowrap;user-select:none;"]);
|
|
54
|
-
|
|
38
|
+
const InnerWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
55
39
|
displayName: "Breadcrumbstyles__InnerWrapper",
|
|
56
40
|
componentId: "sc-1rgfkd8-8"
|
|
57
41
|
})(["text-overflow:ellipsis;order:2;overflow:hidden;white-space:nowrap;font-size:13px;line-height:1.39;min-height:18px;user-select:none;"]);
|
|
58
|
-
|
|
42
|
+
const Breadcrumb = /* @__PURE__ */ styled(ListItem).withConfig({
|
|
59
43
|
displayName: "Breadcrumbstyles__Breadcrumb",
|
|
60
44
|
componentId: "sc-1rgfkd8-9"
|
|
61
|
-
})(["", "{direction:", ";flex-wrap:", ";}&:hover{", "::after{opacity:0;}", "::before{opacity:0;}}", " ", ""], BreadcrumbContent,
|
|
62
|
-
|
|
63
|
-
}, function (props) {
|
|
64
|
-
return props.compact ? 'no-wrap' : 'wrap';
|
|
65
|
-
}, ContentWrapper, ContentWrapper, function (props) {
|
|
66
|
-
return props.isNavigation ? css(["&:hover,&:active,&:focus,&:focus:active{", "{background:transparent;}}", ",", "{&:hover{color:", ";}}&&&{", ":hover{.ds-icon > svg{fill:", " !important;}}&:focus{", "{box-shadow:none;}}"], Inner, BreadcrumbName, Description, props.disabled ? props.theme.palette['grey-600'] : props.theme.palette['blue-600'], PrefixWrapper, props.theme.palette['blue-600'], Inner) : css(["&:hover{background:", ";color:", ";", " > .ds-icon > svg{fill:", ";}", ",", "{color:", ";}}&:focus:not(:active){box-shadow:inset 0 0 0 2px ", ";}&:focus:active{", "::before{background-image:", ";}}"], props.theme.palette['grey-050'], props.theme.palette['blue-600'], ArrowRight, props.disabled ? props.theme.palette['grey-600'] : props.theme.palette['blue-600'], BreadcrumbName, Description, props.disabled ? props.theme.palette['grey-600'] : props.theme.palette['blue-600'], props.theme.palette['blue-600'], ContentWrapper, "-webkit-linear-gradient( left, " + props.theme.palette['grey-100'] + " 0%, rgba(255,255,255,0) 100%)");
|
|
67
|
-
}, function (props) {
|
|
68
|
-
return props.clickable && !props.isNavigation && disableDefaultClickingStyles(props);
|
|
69
|
-
});
|
|
70
|
-
export var BreadcrumbRoute = styled.div.withConfig({
|
|
45
|
+
})(["", "{direction:", ";flex-wrap:", ";}&:hover{", "::after{opacity:0;}", "::before{opacity:0;}}", " ", ""], BreadcrumbContent, (props) => props.compact ? "rtl" : "ltr", (props) => props.compact ? "no-wrap" : "wrap", ContentWrapper, ContentWrapper, (props) => props.isNavigation ? css(["&:hover,&:active,&:focus,&:focus:active{", "{background:transparent;}}", ",", "{&:hover{color:", ";}}&&&{", ":hover{.ds-icon > svg{fill:", " !important;}}&:focus{", "{box-shadow:none;}}"], Inner, BreadcrumbName, Description, props.disabled ? props.theme.palette["grey-600"] : props.theme.palette["blue-600"], PrefixWrapper, props.theme.palette["blue-600"], Inner) : css(["&:hover{background:", ";color:", ";", " > .ds-icon > svg{fill:", ";}", ",", "{color:", ";}}&:focus:not(:active){box-shadow:inset 0 0 0 2px ", ";}&:focus:active{", "::before{background-image:", ";}}"], props.theme.palette["grey-050"], props.theme.palette["blue-600"], ArrowRight, props.disabled ? props.theme.palette["grey-600"] : props.theme.palette["blue-600"], BreadcrumbName, Description, props.disabled ? props.theme.palette["grey-600"] : props.theme.palette["blue-600"], props.theme.palette["blue-600"], ContentWrapper, `-webkit-linear-gradient( left, ${props.theme.palette["grey-100"]} 0%, rgba(255,255,255,0) 100%)`), (props) => props.clickable && !props.isNavigation && disableDefaultClickingStyles(props));
|
|
46
|
+
const BreadcrumbRoute = /* @__PURE__ */ styled.div.withConfig({
|
|
71
47
|
displayName: "Breadcrumbstyles__BreadcrumbRoute",
|
|
72
48
|
componentId: "sc-1rgfkd8-10"
|
|
73
|
-
})(["display:flex;align-items:center;padding-top:height:18px;.active{font-weight:500;}"]);
|
|
49
|
+
})(["display:flex;align-items:center;padding-top:height:18px;.active{font-weight:500;}"]);
|
|
50
|
+
export {
|
|
51
|
+
ArrowRight,
|
|
52
|
+
Breadcrumb,
|
|
53
|
+
BreadcrumbContent,
|
|
54
|
+
BreadcrumbName,
|
|
55
|
+
BreadcrumbRoute,
|
|
56
|
+
ContentWrapper,
|
|
57
|
+
Description,
|
|
58
|
+
Highlight,
|
|
59
|
+
InnerWrapper,
|
|
60
|
+
OuterWrapper,
|
|
61
|
+
PrefixWrapper,
|
|
62
|
+
disableDefaultClickingStyles
|
|
63
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { ListItemProps } from '@synerise/ds-list-item';
|
|
3
3
|
export type BreadcrumbProps = ListItemProps & {
|
|
4
4
|
prefixel?: ReactNode;
|
|
5
5
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
2
|
export declare const attachActiveClassName: (index: number, highlightActivePath: boolean, path: Array<string>, compact: boolean) => "" | "active";
|
|
3
3
|
export declare const shouldRenderArrow: (breadCrumbPath: string[], index: number, startWithArrow: boolean) => boolean;
|
|
4
4
|
export declare const shouldHaveArrowPlaceholder: (index: number, path: string[], compact: boolean, startWithArrow: boolean) => boolean;
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
const attachActiveClassName = (index, highlightActivePath, path, compact) => {
|
|
2
2
|
if (compact) {
|
|
3
|
-
return highlightActivePath && index === 0 ?
|
|
3
|
+
return highlightActivePath && index === 0 ? "active" : "";
|
|
4
4
|
}
|
|
5
|
-
return highlightActivePath && index === path.length - 1 ?
|
|
5
|
+
return highlightActivePath && index === path.length - 1 ? "active" : "";
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
const shouldRenderArrow = (breadCrumbPath, index, startWithArrow) => {
|
|
8
8
|
if (!breadCrumbPath || !breadCrumbPath.length) {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
const nextBreadcrumb = breadCrumbPath[index + 1];
|
|
12
12
|
if (!nextBreadcrumb) {
|
|
13
13
|
return startWithArrow;
|
|
14
14
|
}
|
|
15
15
|
return true;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
const shouldHaveArrowPlaceholder = (index, path, compact, startWithArrow) => {
|
|
18
18
|
if (compact) {
|
|
19
19
|
return startWithArrow || index < path.length - 1 && path.length > 1;
|
|
20
20
|
}
|
|
21
21
|
return startWithArrow || path.length > 1 || index > 0;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
const isOverflown = (elementRef) => {
|
|
24
24
|
if (elementRef !== null && elementRef.current !== null) {
|
|
25
|
-
|
|
25
|
+
const element = elementRef.current;
|
|
26
26
|
return element.scrollWidth > element.clientWidth;
|
|
27
27
|
}
|
|
28
28
|
return false;
|
|
29
|
-
};
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
attachActiveClassName,
|
|
32
|
+
isOverflown,
|
|
33
|
+
shouldHaveArrowPlaceholder,
|
|
34
|
+
shouldRenderArrow
|
|
35
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare const BreadcrumbsList: ({ paths, highlight, width, visibleRows, onBreadCrumbClick, rowHeight, scrollTop, selectedIds, }: BreadcrumbsListProps) => React.ReactElement<import(
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Path } from '../../Cascader.types';
|
|
3
|
+
import { BreadcrumbsListProps } from './BreadcrumbsList.types';
|
|
4
|
+
export declare const BreadcrumbsList: ({ paths, highlight, width, visibleRows, onBreadCrumbClick, rowHeight, scrollTop, selectedIds, }: BreadcrumbsListProps) => React.ReactElement<import('@synerise/ds-search/dist/Elements/SearchItems/SearchItems.types').SearchItemListProps<Path>, string | React.JSXElementConstructor<any>>;
|
|
5
5
|
export default BreadcrumbsList;
|
|
@@ -1,45 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { theme } from
|
|
3
|
-
import Icon, { CheckS } from
|
|
4
|
-
import { renderSearchList } from
|
|
5
|
-
import Breadcrumb from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { theme } from "@synerise/ds-core";
|
|
3
|
+
import Icon, { CheckS } from "@synerise/ds-icon";
|
|
4
|
+
import { renderSearchList } from "@synerise/ds-search/dist/Elements/SearchItems/SearchItems";
|
|
5
|
+
import { Breadcrumb } from "../Breadcrumb/Breadcrumb.js";
|
|
6
|
+
const DEFAULT_VISIBLE_ROWS = 6;
|
|
7
|
+
const DEFAULT_ROW_HEIGHT = 50;
|
|
8
|
+
const BreadcrumbsList = ({
|
|
9
|
+
paths,
|
|
10
|
+
highlight,
|
|
11
|
+
width,
|
|
12
|
+
visibleRows,
|
|
13
|
+
onBreadCrumbClick,
|
|
14
|
+
rowHeight,
|
|
15
|
+
scrollTop,
|
|
16
|
+
selectedIds
|
|
17
|
+
}) => {
|
|
18
|
+
const listPropsObject = {
|
|
19
|
+
scrollTop
|
|
19
20
|
};
|
|
20
21
|
return renderSearchList({
|
|
21
22
|
data: paths,
|
|
22
23
|
visibleRows: visibleRows || DEFAULT_VISIBLE_ROWS,
|
|
23
|
-
highlight
|
|
24
|
-
width
|
|
24
|
+
highlight,
|
|
25
|
+
width,
|
|
25
26
|
rowHeight: rowHeight || DEFAULT_ROW_HEIGHT,
|
|
26
27
|
onItemClick: onBreadCrumbClick,
|
|
27
|
-
itemRender:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
component: /*#__PURE__*/React.createElement(CheckS, null)
|
|
31
|
-
}));
|
|
32
|
-
return /*#__PURE__*/React.createElement(Breadcrumb, {
|
|
33
|
-
gradientOverlap: true,
|
|
34
|
-
compact: true,
|
|
35
|
-
path: item.path,
|
|
36
|
-
key: "" + item.id,
|
|
37
|
-
suffixel: selectedIds.includes(item.id) ? tickIcon : undefined,
|
|
38
|
-
description: item.path[item.path.length - 1],
|
|
39
|
-
highlight: highlight
|
|
40
|
-
});
|
|
28
|
+
itemRender: (item) => {
|
|
29
|
+
const tickIcon = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Icon, { color: theme.palette["green-600"], component: /* @__PURE__ */ jsx(CheckS, {}) }) });
|
|
30
|
+
return /* @__PURE__ */ jsx(Breadcrumb, { gradientOverlap: true, compact: true, path: item.path, suffixel: selectedIds.includes(item.id) ? tickIcon : void 0, description: item.path[item.path.length - 1], highlight }, `${item.id}`);
|
|
41
31
|
},
|
|
42
32
|
listProps: listPropsObject
|
|
43
33
|
});
|
|
44
34
|
};
|
|
45
|
-
export
|
|
35
|
+
export {
|
|
36
|
+
BreadcrumbsList,
|
|
37
|
+
BreadcrumbsList as default
|
|
38
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CategoriesListProps } from './CategoriesList.types';
|
|
3
3
|
export declare const CategoriesList: ({ rootCategory, onCategoryClick, suffixel, onSuffixelClick, selectedIds, }: CategoriesListProps) => React.JSX.Element;
|
|
4
4
|
export default CategoriesList;
|
|
@@ -1,58 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { theme } from "@synerise/ds-core";
|
|
5
|
+
import Icon, { CheckS } from "@synerise/ds-icon";
|
|
6
|
+
import ListItem from "@synerise/ds-list-item";
|
|
7
|
+
import { hasNestedCategories } from "../../utils.js";
|
|
8
|
+
const CategoriesSuffix = /* @__PURE__ */ styled.div.withConfig({
|
|
8
9
|
displayName: "CategoriesList__CategoriesSuffix",
|
|
9
10
|
componentId: "sc-zu5q3f-0"
|
|
10
11
|
})([""]);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const CategoriesList = ({
|
|
13
|
+
rootCategory,
|
|
14
|
+
onCategoryClick,
|
|
15
|
+
suffixel,
|
|
16
|
+
onSuffixelClick,
|
|
17
|
+
selectedIds
|
|
18
|
+
}) => {
|
|
19
|
+
const onCategoryClickHandler = useCallback((item) => {
|
|
18
20
|
onCategoryClick && onCategoryClick(item);
|
|
19
21
|
}, [onCategoryClick]);
|
|
20
|
-
|
|
22
|
+
const onSuffixelClickHandler = useCallback((item, event) => {
|
|
21
23
|
event.stopPropagation();
|
|
22
24
|
onSuffixelClick && onSuffixelClick(item);
|
|
23
25
|
}, [onSuffixelClick]);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, Object.keys(rootCategory)
|
|
35
|
-
// @ts-expect-error rootCategory is in fact more than what Category type defines
|
|
36
|
-
// apart from id, name and path it can have nested categories with any key
|
|
37
|
-
// STOR-1904
|
|
38
|
-
.filter(function (key) {
|
|
39
|
-
var _rootCategory$key;
|
|
40
|
-
return (_rootCategory$key = rootCategory[key]) == null ? void 0 : _rootCategory$key.name;
|
|
41
|
-
}).map(function (key) {
|
|
42
|
-
// @ts-expect-error rootCategory is in fact more than what Category type defines
|
|
43
|
-
// apart from id, name and path it can have nested categories with any key
|
|
44
|
-
// STOR-1904
|
|
45
|
-
var item = rootCategory[key];
|
|
46
|
-
return /*#__PURE__*/React.createElement(ListItem, {
|
|
47
|
-
text: item.name,
|
|
48
|
-
key: "" + item.id,
|
|
49
|
-
type: selectedIds.includes(item.id) ? undefined : 'select',
|
|
50
|
-
suffixel: renderSuffix(item),
|
|
51
|
-
parent: hasNestedCategories(item),
|
|
52
|
-
onClick: function onClick() {
|
|
53
|
-
return onCategoryClickHandler(item);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}));
|
|
26
|
+
const renderSuffix = (item) => /* @__PURE__ */ jsx(CategoriesSuffix, { onClick: (event) => onSuffixelClickHandler(item, event), children: selectedIds.includes(item.id) ? /* @__PURE__ */ jsx(Icon, { color: theme.palette["green-600"], component: /* @__PURE__ */ jsx(CheckS, {}) }) : suffixel });
|
|
27
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Object.keys(rootCategory).filter((key) => rootCategory[key]?.name).map((key) => {
|
|
28
|
+
const item = rootCategory[key];
|
|
29
|
+
return /* @__PURE__ */ jsx(ListItem, { text: item.name, type: selectedIds.includes(item.id) ? void 0 : "select", suffixel: renderSuffix(item), parent: hasNestedCategories(item), onClick: () => onCategoryClickHandler(item) }, `${item.id}`);
|
|
30
|
+
}) });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
CategoriesList,
|
|
34
|
+
CategoriesList as default
|
|
57
35
|
};
|
|
58
|
-
export default CategoriesList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode, ReactText } from 'react';
|
|
2
|
+
import { Category } from '../../Cascader.types';
|
|
3
3
|
export interface CategoriesListProps {
|
|
4
4
|
rootCategory: Category;
|
|
5
5
|
onCategoryClick: (item: Category) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NavigationProps } from './Navigation.types';
|
|
3
3
|
export declare const Navigation: ({ backActionVisible, onHomeIconClick, onPathClick, activeCategory, previousCategory, breadcrumbVisible, }: NavigationProps) => React.JSX.Element;
|
|
4
4
|
export default Navigation;
|