@elliemae/ds-breadcrumb 3.0.0-next.1 → 3.0.0-next.5
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/dist/cjs/DSBreadcrumb.js +121 -0
- package/dist/cjs/DSBreadcrumb.js.map +7 -0
- package/dist/cjs/DSBreadcrumbItem.js +123 -0
- package/dist/cjs/DSBreadcrumbItem.js.map +7 -0
- package/dist/cjs/hooks/useKeyboardNavigation.js +57 -0
- package/dist/cjs/hooks/useKeyboardNavigation.js.map +7 -0
- package/dist/cjs/index.d.js +27 -0
- package/dist/cjs/index.d.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/styles.js +107 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/esm/DSBreadcrumb.js +94 -0
- package/dist/esm/DSBreadcrumb.js.map +7 -0
- package/dist/esm/DSBreadcrumbItem.js +96 -0
- package/dist/esm/DSBreadcrumbItem.js.map +7 -0
- package/{esm → dist/esm}/hooks/useKeyboardNavigation.js +11 -9
- package/dist/esm/hooks/useKeyboardNavigation.js.map +7 -0
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/styles.js +78 -0
- package/dist/esm/styles.js.map +7 -0
- package/package.json +35 -26
- package/cjs/DSBreadcrumb.js +0 -102
- package/cjs/DSBreadcrumbItem.js +0 -98
- package/cjs/hooks/useKeyboardNavigation.js +0 -30
- package/cjs/index.d.js +0 -2
- package/cjs/index.js +0 -15
- package/cjs/styles.js +0 -68
- package/esm/DSBreadcrumb.js +0 -88
- package/esm/DSBreadcrumbItem.js +0 -87
- package/esm/index.d.js +0 -1
- package/esm/index.js +0 -2
- package/esm/styles.js +0 -57
- package/types/DSBreadcrumb.d.ts +0 -56
- package/types/DSBreadcrumbItem.d.ts +0 -78
- package/types/hooks/useKeyboardNavigation.d.ts +0 -2
- package/types/index.d.d.ts +0 -27
- package/types/index.d.ts +0 -3
- package/types/styles.d.ts +0 -6
- package/types/tests/DSBreadcrumb.test.d.ts +0 -1
- package/types/tests/DSBreadcrumbItem.test.d.ts +0 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
42
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(module2))
|
|
44
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
45
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (module2, isNodeMode) => {
|
|
50
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
51
|
+
};
|
|
52
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
53
|
+
return (module2, temp) => {
|
|
54
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
55
|
+
};
|
|
56
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
57
|
+
var DSBreadcrumb_exports = {};
|
|
58
|
+
__export(DSBreadcrumb_exports, {
|
|
59
|
+
DSBreadcrumb: () => DSBreadcrumb,
|
|
60
|
+
DSBreadcrumbWithSchema: () => DSBreadcrumbWithSchema,
|
|
61
|
+
default: () => DSBreadcrumb_default,
|
|
62
|
+
htmlElements: () => htmlElements
|
|
63
|
+
});
|
|
64
|
+
var React = __toESM(require("react"));
|
|
65
|
+
var import_react = __toESM(require("react"));
|
|
66
|
+
var import_react_desc = require("react-desc");
|
|
67
|
+
var import_DSBreadcrumbItem = __toESM(require("./DSBreadcrumbItem"));
|
|
68
|
+
var import_useKeyboardNavigation = require("./hooks/useKeyboardNavigation");
|
|
69
|
+
var import_styles = require("./styles");
|
|
70
|
+
const htmlElements = ["nav", "div", "header", "footer", "main"];
|
|
71
|
+
const DSBreadcrumb = (_a) => {
|
|
72
|
+
var _b = _a, {
|
|
73
|
+
containerProps = {},
|
|
74
|
+
as = "nav",
|
|
75
|
+
label = "Breadcrumb",
|
|
76
|
+
isTitle = false,
|
|
77
|
+
children,
|
|
78
|
+
trailingSlash = true
|
|
79
|
+
} = _b, rest = __objRest(_b, [
|
|
80
|
+
"containerProps",
|
|
81
|
+
"as",
|
|
82
|
+
"label",
|
|
83
|
+
"isTitle",
|
|
84
|
+
"children",
|
|
85
|
+
"trailingSlash"
|
|
86
|
+
]);
|
|
87
|
+
const [addRef, onKeyDown] = (0, import_useKeyboardNavigation.useKeyboardNavigation)();
|
|
88
|
+
const safeElement = (0, import_react.useMemo)(() => htmlElements.indexOf(as) > -1 ? as : "nav", [as]);
|
|
89
|
+
return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledContainer, __spreadProps(__spreadValues(__spreadValues({
|
|
90
|
+
"aria-label": label,
|
|
91
|
+
"data-testid": "breadcrumb-nav-container"
|
|
92
|
+
}, rest), containerProps), {
|
|
93
|
+
as: safeElement
|
|
94
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledList, {
|
|
95
|
+
"data-testid": "list-container"
|
|
96
|
+
}, import_react.default.Children.map(children, (child, childIndex) => childIndex < children.length - 1 ? (0, import_react.cloneElement)(child, {
|
|
97
|
+
childIndex,
|
|
98
|
+
addRef,
|
|
99
|
+
onKeyDown
|
|
100
|
+
}) : (0, import_react.cloneElement)(child, {
|
|
101
|
+
childIndex,
|
|
102
|
+
addRef,
|
|
103
|
+
onKeyDown,
|
|
104
|
+
trailingSlash,
|
|
105
|
+
isTitle
|
|
106
|
+
}))));
|
|
107
|
+
};
|
|
108
|
+
DSBreadcrumb.Item = import_DSBreadcrumbItem.default;
|
|
109
|
+
const props = {
|
|
110
|
+
containerProps: import_react_desc.PropTypes.object.description("props injected to breadcrumb wrapper"),
|
|
111
|
+
as: import_react_desc.PropTypes.string.description("Type of element you want the main container to be: 'nav', 'div', 'header', 'footer', 'main'"),
|
|
112
|
+
isTitle: import_react_desc.PropTypes.bool.description("Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title"),
|
|
113
|
+
label: import_react_desc.PropTypes.string.description("breadcrumb label"),
|
|
114
|
+
children: import_react_desc.PropTypes.arrayOf(import_DSBreadcrumbItem.default).isRequired.description("Container items to wrap")
|
|
115
|
+
};
|
|
116
|
+
DSBreadcrumb.propTypes = props;
|
|
117
|
+
const DSBreadcrumbWithSchema = (0, import_react_desc.describe)(DSBreadcrumb);
|
|
118
|
+
DSBreadcrumbWithSchema.propTypes = props;
|
|
119
|
+
var DSBreadcrumb_default = DSBreadcrumb;
|
|
120
|
+
module.exports = __toCommonJS(DSBreadcrumb_exports);
|
|
121
|
+
//# sourceMappingURL=DSBreadcrumb.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSBreadcrumb.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { cloneElement, useMemo } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport DSBreadcrumbItem from './DSBreadcrumbItem';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation';\nimport type { DSBreadcrumbPropsT } from './index.d';\nimport { StyledContainer, StyledList } from './styles';\n\nconst htmlElements = ['nav', 'div', 'header', 'footer', 'main'] as const;\n\nconst DSBreadcrumb = ({\n containerProps = {},\n as = 'nav',\n label = 'Breadcrumb',\n isTitle = false,\n children,\n trailingSlash = true,\n ...rest\n}: DSBreadcrumbPropsT): React.ReactElement => {\n const [addRef, onKeyDown] = useKeyboardNavigation();\n\n const safeElement = useMemo(\n () => (htmlElements.indexOf(as) > -1 ? as : 'nav'),\n [as],\n );\n\n return (\n <StyledContainer\n aria-label={label}\n data-testid=\"breadcrumb-nav-container\"\n {...rest}\n {...containerProps}\n as={safeElement}\n >\n <StyledList data-testid=\"list-container\">\n {React.Children.map(children, (child: React.ReactElement, childIndex) =>\n childIndex < children.length - 1\n ? cloneElement(child, {\n childIndex,\n addRef,\n onKeyDown,\n })\n : cloneElement(child, {\n childIndex,\n addRef,\n onKeyDown,\n trailingSlash,\n isTitle,\n }),\n )}\n </StyledList>\n </StyledContainer>\n );\n};\n\nDSBreadcrumb.Item = DSBreadcrumbItem;\n\nconst props = {\n /** props injected to breadcrumb wrapper */\n containerProps: PropTypes.object.description(\n 'props injected to breadcrumb wrapper',\n ),\n /**\n * Type of element you want the main container to be:\n * 'nav', 'div', 'header', 'footer', 'main'\n */\n as: PropTypes.string.description(\n \"Type of element you want the main container to be: 'nav', 'div', 'header', 'footer', 'main'\",\n ),\n /**\n * Whether to show the last element of the breadcrumb as a title\n * Also removes trailing slash to show last element as title\n */\n isTitle: PropTypes.bool.description(\n 'Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title',\n ),\n /** breadcrumb label */\n label: PropTypes.string.description('breadcrumb label'),\n /**\n * Container items to wrap\n */\n children: PropTypes.arrayOf(DSBreadcrumbItem).isRequired.description(\n 'Container items to wrap',\n ),\n};\n\nDSBreadcrumb.propTypes = props;\n\nconst DSBreadcrumbWithSchema = describe(DSBreadcrumb);\nDSBreadcrumbWithSchema.propTypes = props;\n\nexport { DSBreadcrumb, DSBreadcrumbWithSchema, htmlElements };\nexport default DSBreadcrumb;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAC7C,wBAAoC;AACpC,8BAA6B;AAC7B,mCAAsC;AAEtC,oBAA4C;AAE5C,MAAM,eAAe,CAAC,OAAO,OAAO,UAAU,UAAU;AAExD,MAAM,eAAe,CAAC,OAQwB;AARxB,eACpB;AAAA,qBAAiB;AAAA,IACjB,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,UAAU;AAAA,IACV;AAAA,IACA,gBAAgB;AAAA,MANI,IAOjB,iBAPiB,IAOjB;AAAA,IANH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,CAAC,QAAQ,aAAa;AAE5B,QAAM,cAAc,0BAClB,MAAO,aAAa,QAAQ,MAAM,KAAK,KAAK,OAC5C,CAAC;AAGH,SACE,mDAAC,+BAAD;AAAA,IACE,cAAY;AAAA,IACZ,eAAY;AAAA,KACR,OACA,iBAJN;AAAA,IAKE,IAAI;AAAA,MAEJ,mDAAC,0BAAD;AAAA,IAAY,eAAY;AAAA,KACrB,qBAAM,SAAS,IAAI,UAAU,CAAC,OAA2B,eACxD,aAAa,SAAS,SAAS,IAC3B,+BAAa,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,OAEF,+BAAa,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAQhB,aAAa,OAAO;AAEpB,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,4BAAU,OAAO,YAC/B;AAAA,EAMF,IAAI,4BAAU,OAAO,YACnB;AAAA,EAMF,SAAS,4BAAU,KAAK,YACtB;AAAA,EAGF,OAAO,4BAAU,OAAO,YAAY;AAAA,EAIpC,UAAU,4BAAU,QAAQ,iCAAkB,WAAW,YACvD;AAAA;AAIJ,aAAa,YAAY;AAEzB,MAAM,yBAAyB,gCAAS;AACxC,uBAAuB,YAAY;AAGnC,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __objRest = (source, exclude) => {
|
|
23
|
+
var target = {};
|
|
24
|
+
for (var prop in source)
|
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
+
target[prop] = source[prop];
|
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
|
+
};
|
|
38
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
39
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
40
|
+
for (let key of __getOwnPropNames(module2))
|
|
41
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
42
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
};
|
|
46
|
+
var __toESM = (module2, isNodeMode) => {
|
|
47
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
48
|
+
};
|
|
49
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
50
|
+
return (module2, temp) => {
|
|
51
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
52
|
+
};
|
|
53
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
54
|
+
var DSBreadcrumbItem_exports = {};
|
|
55
|
+
__export(DSBreadcrumbItem_exports, {
|
|
56
|
+
DSBreadcrumbItem: () => DSBreadcrumbItem,
|
|
57
|
+
DSBreadcrumbItemWithSchema: () => DSBreadcrumbItemWithSchema,
|
|
58
|
+
default: () => DSBreadcrumbItem_default
|
|
59
|
+
});
|
|
60
|
+
var React = __toESM(require("react"));
|
|
61
|
+
var import_react = __toESM(require("react"));
|
|
62
|
+
var import_react_desc = require("react-desc");
|
|
63
|
+
var import_styles = require("./styles");
|
|
64
|
+
function DSBreadcrumbItem(_a) {
|
|
65
|
+
var _b = _a, {
|
|
66
|
+
active = false,
|
|
67
|
+
as = "a",
|
|
68
|
+
href = void 0,
|
|
69
|
+
isTitle,
|
|
70
|
+
onClick = () => null,
|
|
71
|
+
label = "",
|
|
72
|
+
color = null,
|
|
73
|
+
addRef,
|
|
74
|
+
childIndex,
|
|
75
|
+
trailingSlash,
|
|
76
|
+
onKeyDown = () => null
|
|
77
|
+
} = _b, rest = __objRest(_b, [
|
|
78
|
+
"active",
|
|
79
|
+
"as",
|
|
80
|
+
"href",
|
|
81
|
+
"isTitle",
|
|
82
|
+
"onClick",
|
|
83
|
+
"label",
|
|
84
|
+
"color",
|
|
85
|
+
"addRef",
|
|
86
|
+
"childIndex",
|
|
87
|
+
"trailingSlash",
|
|
88
|
+
"onKeyDown"
|
|
89
|
+
]);
|
|
90
|
+
return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledCrumbWrapper, __spreadValues({
|
|
91
|
+
"aria-current": active ? "page" : void 0,
|
|
92
|
+
"data-testid": "breadcrumb-item-container",
|
|
93
|
+
isTitle,
|
|
94
|
+
trailingSlash
|
|
95
|
+
}, rest), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledLink, {
|
|
96
|
+
as,
|
|
97
|
+
href,
|
|
98
|
+
onClick,
|
|
99
|
+
ref: addRef,
|
|
100
|
+
tabIndex: 0,
|
|
101
|
+
isActive: active,
|
|
102
|
+
onKeyDown: (e) => onKeyDown(e, childIndex, onClick),
|
|
103
|
+
isTitle,
|
|
104
|
+
color
|
|
105
|
+
}, label));
|
|
106
|
+
}
|
|
107
|
+
const props = {
|
|
108
|
+
containerComponent: import_react_desc.PropTypes.string.description("inject props to wrapper"),
|
|
109
|
+
as: import_react_desc.PropTypes.string.description("render as any html node"),
|
|
110
|
+
active: import_react_desc.PropTypes.bool.description("active item"),
|
|
111
|
+
href: import_react_desc.PropTypes.string.description("href link"),
|
|
112
|
+
onClick: import_react_desc.PropTypes.func.description("on click handler"),
|
|
113
|
+
isTitle: import_react_desc.PropTypes.bool.description("style item as title"),
|
|
114
|
+
trailingSlash: import_react_desc.PropTypes.bool.description("add trailing slash"),
|
|
115
|
+
label: import_react_desc.PropTypes.string.description("item label"),
|
|
116
|
+
color: import_react_desc.PropTypes.string.description("link color")
|
|
117
|
+
};
|
|
118
|
+
DSBreadcrumbItem.propTypes = props;
|
|
119
|
+
const DSBreadcrumbItemWithSchema = (0, import_react_desc.describe)(DSBreadcrumbItem);
|
|
120
|
+
DSBreadcrumbItemWithSchema.propTypes = props;
|
|
121
|
+
var DSBreadcrumbItem_default = DSBreadcrumbItem;
|
|
122
|
+
module.exports = __toCommonJS(DSBreadcrumbItem_exports);
|
|
123
|
+
//# sourceMappingURL=DSBreadcrumbItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSBreadcrumbItem.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport type { DSBreadcrumbItemPropsT } from './index.d';\nimport { StyledLink, StyledCrumbWrapper } from './styles';\n\nfunction DSBreadcrumbItem({\n active = false,\n as = 'a',\n href = undefined,\n isTitle,\n onClick = () => null,\n label = '',\n color = null,\n addRef,\n childIndex,\n trailingSlash,\n onKeyDown = () => null,\n ...rest\n}: DSBreadcrumbItemPropsT): React.ReactElement {\n return (\n <StyledCrumbWrapper\n aria-current={active ? 'page' : undefined}\n data-testid=\"breadcrumb-item-container\"\n isTitle={isTitle}\n trailingSlash={trailingSlash}\n {...rest}\n >\n <StyledLink\n as={as}\n href={href}\n onClick={onClick}\n ref={addRef}\n tabIndex={0}\n isActive={active}\n onKeyDown={(e: React.KeyboardEvent) =>\n onKeyDown(e, childIndex, onClick)\n }\n isTitle={isTitle}\n color={color}\n >\n {label}\n </StyledLink>\n </StyledCrumbWrapper>\n );\n}\n\nconst props = {\n /** inject props to wrapper */\n containerComponent: PropTypes.string.description('inject props to wrapper'),\n /** render as any html node */\n as: PropTypes.string.description('render as any html node'),\n /** active item */\n active: PropTypes.bool.description('active item'),\n /** href link */\n href: PropTypes.string.description('href link'),\n /** on click handler */\n onClick: PropTypes.func.description('on click handler'),\n /** style item as title */\n isTitle: PropTypes.bool.description('style item as title'),\n /** add trailing slash */\n trailingSlash: PropTypes.bool.description('add trailing slash'),\n /** item label */\n label: PropTypes.string.description('item label'),\n /** link color */\n color: PropTypes.string.description('link color'),\n};\n\nDSBreadcrumbItem.propTypes = props;\n\nconst DSBreadcrumbItemWithSchema = describe(DSBreadcrumbItem);\nDSBreadcrumbItemWithSchema.propTypes = props;\n\nexport { DSBreadcrumbItem, DSBreadcrumbItemWithSchema };\nexport default DSBreadcrumbItem;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AAEpC,oBAA+C;AAE/C,0BAA0B,IAaqB;AAbrB,eACxB;AAAA,aAAS;AAAA,IACT,KAAK;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA,UAAU,MAAM;AAAA,IAChB,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAAA,MAXM,IAYrB,iBAZqB,IAYrB;AAAA,IAXH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,SACE,mDAAC,kCAAD;AAAA,IACE,gBAAc,SAAS,SAAS;AAAA,IAChC,eAAY;AAAA,IACZ;AAAA,IACA;AAAA,KACI,OAEJ,mDAAC,0BAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,IACV,WAAW,CAAC,MACV,UAAU,GAAG,YAAY;AAAA,IAE3B;AAAA,IACA;AAAA,KAEC;AAAA;AAMT,MAAM,QAAQ;AAAA,EAEZ,oBAAoB,4BAAU,OAAO,YAAY;AAAA,EAEjD,IAAI,4BAAU,OAAO,YAAY;AAAA,EAEjC,QAAQ,4BAAU,KAAK,YAAY;AAAA,EAEnC,MAAM,4BAAU,OAAO,YAAY;AAAA,EAEnC,SAAS,4BAAU,KAAK,YAAY;AAAA,EAEpC,SAAS,4BAAU,KAAK,YAAY;AAAA,EAEpC,eAAe,4BAAU,KAAK,YAAY;AAAA,EAE1C,OAAO,4BAAU,OAAO,YAAY;AAAA,EAEpC,OAAO,4BAAU,OAAO,YAAY;AAAA;AAGtC,iBAAiB,YAAY;AAE7B,MAAM,6BAA6B,gCAAS;AAC5C,2BAA2B,YAAY;AAGvC,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var useKeyboardNavigation_exports = {};
|
|
29
|
+
__export(useKeyboardNavigation_exports, {
|
|
30
|
+
useKeyboardNavigation: () => useKeyboardNavigation
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
const useKeyboardNavigation = () => {
|
|
35
|
+
const componentsRef = (0, import_react.useRef)([]);
|
|
36
|
+
const addRef = (0, import_react.useCallback)((ref) => {
|
|
37
|
+
if (ref && !componentsRef.current.includes(ref)) {
|
|
38
|
+
componentsRef.current.push(ref);
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
const onKeyDown = (0, import_react.useCallback)((e, componentRefIndex, callback) => {
|
|
42
|
+
if (e.key === "ArrowDown" && componentsRef.current[componentRefIndex + 1]) {
|
|
43
|
+
componentsRef.current[componentRefIndex + 1].focus();
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
} else if (e.key === "ArrowUp" && componentRefIndex !== 0) {
|
|
46
|
+
componentsRef.current[componentRefIndex - 1].focus();
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
} else if (e.key === "Enter") {
|
|
49
|
+
callback();
|
|
50
|
+
} else if (e.ctrlKey && e.altKey && e.key === " ") {
|
|
51
|
+
componentsRef.current[componentRefIndex].click();
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
return [addRef, onKeyDown];
|
|
55
|
+
};
|
|
56
|
+
module.exports = __toCommonJS(useKeyboardNavigation_exports);
|
|
57
|
+
//# sourceMappingURL=useKeyboardNavigation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useKeyboardNavigation.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useRef, useCallback } from 'react';\n\nexport const useKeyboardNavigation = () => {\n const componentsRef = useRef<HTMLAnchorElement[]>([]);\n\n const addRef = useCallback((ref: HTMLAnchorElement) => {\n if (ref && !componentsRef.current.includes(ref)) {\n componentsRef.current.push(ref);\n }\n }, []);\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent, componentRefIndex, callback) => {\n if (\n e.key === 'ArrowDown' &&\n componentsRef.current[componentRefIndex + 1]\n ) {\n componentsRef.current[componentRefIndex + 1].focus();\n e.preventDefault();\n } else if (e.key === 'ArrowUp' && componentRefIndex !== 0) {\n componentsRef.current[componentRefIndex - 1].focus();\n e.preventDefault();\n } else if (e.key === 'Enter') {\n callback();\n } else if (e.ctrlKey && e.altKey && e.key === ' ') {\n componentsRef.current[componentRefIndex].click();\n }\n },\n [],\n );\n\n return [addRef, onKeyDown];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2C;AAEpC,MAAM,wBAAwB,MAAM;AACzC,QAAM,gBAAgB,yBAA4B;AAElD,QAAM,SAAS,8BAAY,CAAC,QAA2B;AACrD,QAAI,OAAO,CAAC,cAAc,QAAQ,SAAS,MAAM;AAC/C,oBAAc,QAAQ,KAAK;AAAA;AAAA,KAE5B;AAEH,QAAM,YAAY,8BAChB,CAAC,GAAwB,mBAAmB,aAAa;AACvD,QACE,EAAE,QAAQ,eACV,cAAc,QAAQ,oBAAoB,IAC1C;AACA,oBAAc,QAAQ,oBAAoB,GAAG;AAC7C,QAAE;AAAA,eACO,EAAE,QAAQ,aAAa,sBAAsB,GAAG;AACzD,oBAAc,QAAQ,oBAAoB,GAAG;AAC7C,QAAE;AAAA,eACO,EAAE,QAAQ,SAAS;AAC5B;AAAA,eACS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,KAAK;AACjD,oBAAc,QAAQ,mBAAmB;AAAA;AAAA,KAG7C;AAGF,SAAO,CAAC,QAAQ;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(module2))
|
|
11
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (module2, isNodeMode) => {
|
|
17
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
+
return (module2, temp) => {
|
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
+
};
|
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var index_d_exports = {};
|
|
25
|
+
var React = __toESM(require("react"));
|
|
26
|
+
module.exports = __toCommonJS(index_d_exports);
|
|
27
|
+
//# sourceMappingURL=index.d.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.d.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { htmlElements } from './DSBreadcrumb';\n\ntype SafeComponentsT = typeof htmlElements[number];\n\ntype SafeItemComponentT = 'a' | 'button' | 'div' | 'span' | 'p';\n\ninterface DSBreadcrumbPropsT {\n containerProps?: unknown;\n as?: SafeComponentsT;\n label?: string;\n isTitle?: boolean;\n trailingSlash?: boolean;\n children: React.ReactElement[];\n}\n\ninterface DSBreadcrumbItemPropsT {\n active?: boolean;\n isActive?: boolean;\n as?: SafeItemComponentT;\n href?: string;\n isTitle?: boolean;\n trailingSlash?: boolean;\n addRef: (ref: HTMLElement) => void;\n onKeyDown: (\n e: React.KeyboardEvent,\n componentRefIndex: number,\n onClick: () => void,\n ) => void;\n onClick?: () => void;\n label?: string;\n childIndex: number;\n color?: string | null;\n}\n\nexport {\n DSBreadcrumbPropsT,\n DSBreadcrumbItemPropsT,\n SafeComponentsT,\n SafeItemComponentT,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
default: () => import_DSBreadcrumb.default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
__reExport(src_exports, require("./DSBreadcrumb"));
|
|
34
|
+
__reExport(src_exports, require("./DSBreadcrumbItem"));
|
|
35
|
+
var import_DSBreadcrumb = __toESM(require("./DSBreadcrumb"));
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './DSBreadcrumb';\nexport * from './DSBreadcrumbItem';\nexport { default } from './DSBreadcrumb';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AACd,0BAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var styles_exports = {};
|
|
29
|
+
__export(styles_exports, {
|
|
30
|
+
StyledContainer: () => StyledContainer,
|
|
31
|
+
StyledCrumbWrapper: () => StyledCrumbWrapper,
|
|
32
|
+
StyledLink: () => StyledLink,
|
|
33
|
+
StyledList: () => StyledList
|
|
34
|
+
});
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
37
|
+
const handleColor = (theme, isActive, color, isTitle) => {
|
|
38
|
+
if (isActive)
|
|
39
|
+
return theme.colors.neutral[800];
|
|
40
|
+
else if (color)
|
|
41
|
+
return color;
|
|
42
|
+
else if (isTitle)
|
|
43
|
+
return theme.colors.neutral[700];
|
|
44
|
+
else
|
|
45
|
+
return theme.colors.brand[600];
|
|
46
|
+
};
|
|
47
|
+
const StyledList = import_styled_components.default.ol`
|
|
48
|
+
width: 100%;
|
|
49
|
+
list-style: none;
|
|
50
|
+
display: flex;
|
|
51
|
+
padding: 0;
|
|
52
|
+
margin: 0;
|
|
53
|
+
li:first-child * {
|
|
54
|
+
margin-left: 0;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
const StyledCrumbWrapper = import_styled_components.default.li`
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
flex-shrink: 20;
|
|
61
|
+
transition: flex-shrink 0.1s cubic-bezier(0.64, 0, 0.35, 1);
|
|
62
|
+
height: 16px;
|
|
63
|
+
min-width: 10px;
|
|
64
|
+
&:hover {
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
}
|
|
67
|
+
${({ theme, isTitle, trailingSlash }) => isTitle || !trailingSlash ? `&:not(:last-child):after {
|
|
68
|
+
display: inline-block;
|
|
69
|
+
content: '/';
|
|
70
|
+
color: ${theme.colors.neutral[700]};
|
|
71
|
+
}
|
|
72
|
+
` : `&:after {
|
|
73
|
+
display: inline-block;
|
|
74
|
+
content: '/';
|
|
75
|
+
color: ${theme.colors.neutral[700]};
|
|
76
|
+
}
|
|
77
|
+
`}
|
|
78
|
+
`;
|
|
79
|
+
const StyledContainer = import_styled_components.default.nav`
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
padding: 0;
|
|
83
|
+
`;
|
|
84
|
+
const StyledLink = import_styled_components.default.a`
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
text-overflow: ellipsis;
|
|
88
|
+
text-decoration: none;
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
outline: none;
|
|
91
|
+
margin: 0 2px;
|
|
92
|
+
border: 2px solid transparent;
|
|
93
|
+
-webkit-text-stroke: 0.4px transparent;
|
|
94
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
95
|
+
color: ${({ theme, isActive, color, isTitle }) => handleColor(theme, isActive, color, isTitle)};
|
|
96
|
+
&:hover {
|
|
97
|
+
color: ${({ theme, color }) => color ? color : theme.colors.brand[800]};
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
${({ theme, color }) => `-webkit-text-stroke: 0.4px ${color ? color : theme.colors.brand[800]}`};
|
|
100
|
+
}
|
|
101
|
+
&:focus {
|
|
102
|
+
${({ theme }) => `border: 2px solid ${theme.colors.brand[700]};`}
|
|
103
|
+
border-radius: 2px;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
module.exports = __toCommonJS(styles_exports);
|
|
107
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styles.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { Theme } from '@elliemae/pui-theme';\nimport styled from 'styled-components';\nimport type { DSBreadcrumbItemPropsT } from './index.d';\n\nconst handleColor = (theme: Theme, isActive: boolean, color: string, isTitle: boolean): string => {\n if (isActive) return theme.colors.neutral[800];\n else if (color) return color;\n else if (isTitle) return theme.colors.neutral[700];\n else return theme.colors.brand[600];\n};\n\nconst StyledList = styled.ol`\n width: 100%;\n list-style: none;\n display: flex;\n padding: 0;\n margin: 0;\n li:first-child * {\n margin-left: 0;\n }\n`;\n\nconst StyledCrumbWrapper = styled.li<Partial<DSBreadcrumbItemPropsT>>`\n display: inline-flex;\n align-items: center;\n flex-shrink: 20;\n transition: flex-shrink 0.1s cubic-bezier(0.64, 0, 0.35, 1);\n height: 16px;\n min-width: 10px;\n &:hover {\n flex-shrink: 0;\n }\n ${({ theme, isTitle, trailingSlash }) =>\n isTitle || !trailingSlash\n ? `&:not(:last-child):after {\n display: inline-block;\n content: '/';\n color: ${theme.colors.neutral[700]};\n }\n `\n : `&:after {\n display: inline-block;\n content: '/';\n color: ${theme.colors.neutral[700]};\n }\n `}\n`;\n\nconst StyledContainer = styled.nav`\n display: flex;\n align-items: center;\n padding: 0;\n`;\n\nconst StyledLink = styled.a<Partial<DSBreadcrumbItemPropsT>>`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-decoration: none;\n font-size: 12px;\n outline: none;\n margin: 0 2px;\n border: 2px solid transparent;\n -webkit-text-stroke: 0.4px transparent;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n color: ${({ theme, isActive, color, isTitle }) => handleColor(theme, isActive, color, isTitle)};\n &:hover {\n color: ${({ theme, color }) => (color ? color : theme.colors.brand[800])};\n cursor: pointer;\n ${({ theme, color }) => `-webkit-text-stroke: 0.4px ${color ? color : theme.colors.brand[800]}`};\n }\n &:focus {\n ${({ theme }) => `border: 2px solid ${theme.colors.brand[700]};`}\n border-radius: 2px;\n }\n`;\n\nexport { StyledList, StyledCrumbWrapper, StyledContainer, StyledLink };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,+BAAmB;AAGnB,MAAM,cAAc,CAAC,OAAc,UAAmB,OAAe,YAA6B;AAChG,MAAI;AAAU,WAAO,MAAM,OAAO,QAAQ;AAAA,WACjC;AAAO,WAAO;AAAA,WACd;AAAS,WAAO,MAAM,OAAO,QAAQ;AAAA;AACzC,WAAO,MAAM,OAAO,MAAM;AAAA;AAGjC,MAAM,aAAa,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAW1B,MAAM,qBAAqB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAU9B,CAAC,EAAE,OAAO,SAAS,oBACnB,WAAW,CAAC,gBACR;AAAA;AAAA;AAAA,aAGK,MAAM,OAAO,QAAQ;AAAA;AAAA,MAG1B;AAAA;AAAA;AAAA,aAGK,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAKlC,MAAM,kBAAkB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAM/B,MAAM,aAAa,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAUT,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA,WACvC,CAAC,EAAE,OAAO,UAAU,OAAO,cAAc,YAAY,OAAO,UAAU,OAAO;AAAA;AAAA,aAE3E,CAAC,EAAE,OAAO,YAAa,QAAQ,QAAQ,MAAM,OAAO,MAAM;AAAA;AAAA,MAEjE,CAAC,EAAE,OAAO,YAAY,8BAA8B,QAAQ,QAAQ,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,MAGvF,CAAC,EAAE,YAAY,qBAAqB,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
import React2, { cloneElement, useMemo } from "react";
|
|
34
|
+
import { PropTypes, describe } from "react-desc";
|
|
35
|
+
import DSBreadcrumbItem from "./DSBreadcrumbItem";
|
|
36
|
+
import { useKeyboardNavigation } from "./hooks/useKeyboardNavigation";
|
|
37
|
+
import { StyledContainer, StyledList } from "./styles";
|
|
38
|
+
const htmlElements = ["nav", "div", "header", "footer", "main"];
|
|
39
|
+
const DSBreadcrumb = (_a) => {
|
|
40
|
+
var _b = _a, {
|
|
41
|
+
containerProps = {},
|
|
42
|
+
as = "nav",
|
|
43
|
+
label = "Breadcrumb",
|
|
44
|
+
isTitle = false,
|
|
45
|
+
children,
|
|
46
|
+
trailingSlash = true
|
|
47
|
+
} = _b, rest = __objRest(_b, [
|
|
48
|
+
"containerProps",
|
|
49
|
+
"as",
|
|
50
|
+
"label",
|
|
51
|
+
"isTitle",
|
|
52
|
+
"children",
|
|
53
|
+
"trailingSlash"
|
|
54
|
+
]);
|
|
55
|
+
const [addRef, onKeyDown] = useKeyboardNavigation();
|
|
56
|
+
const safeElement = useMemo(() => htmlElements.indexOf(as) > -1 ? as : "nav", [as]);
|
|
57
|
+
return /* @__PURE__ */ React2.createElement(StyledContainer, __spreadProps(__spreadValues(__spreadValues({
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
"data-testid": "breadcrumb-nav-container"
|
|
60
|
+
}, rest), containerProps), {
|
|
61
|
+
as: safeElement
|
|
62
|
+
}), /* @__PURE__ */ React2.createElement(StyledList, {
|
|
63
|
+
"data-testid": "list-container"
|
|
64
|
+
}, React2.Children.map(children, (child, childIndex) => childIndex < children.length - 1 ? cloneElement(child, {
|
|
65
|
+
childIndex,
|
|
66
|
+
addRef,
|
|
67
|
+
onKeyDown
|
|
68
|
+
}) : cloneElement(child, {
|
|
69
|
+
childIndex,
|
|
70
|
+
addRef,
|
|
71
|
+
onKeyDown,
|
|
72
|
+
trailingSlash,
|
|
73
|
+
isTitle
|
|
74
|
+
}))));
|
|
75
|
+
};
|
|
76
|
+
DSBreadcrumb.Item = DSBreadcrumbItem;
|
|
77
|
+
const props = {
|
|
78
|
+
containerProps: PropTypes.object.description("props injected to breadcrumb wrapper"),
|
|
79
|
+
as: PropTypes.string.description("Type of element you want the main container to be: 'nav', 'div', 'header', 'footer', 'main'"),
|
|
80
|
+
isTitle: PropTypes.bool.description("Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title"),
|
|
81
|
+
label: PropTypes.string.description("breadcrumb label"),
|
|
82
|
+
children: PropTypes.arrayOf(DSBreadcrumbItem).isRequired.description("Container items to wrap")
|
|
83
|
+
};
|
|
84
|
+
DSBreadcrumb.propTypes = props;
|
|
85
|
+
const DSBreadcrumbWithSchema = describe(DSBreadcrumb);
|
|
86
|
+
DSBreadcrumbWithSchema.propTypes = props;
|
|
87
|
+
var DSBreadcrumb_default = DSBreadcrumb;
|
|
88
|
+
export {
|
|
89
|
+
DSBreadcrumb,
|
|
90
|
+
DSBreadcrumbWithSchema,
|
|
91
|
+
DSBreadcrumb_default as default,
|
|
92
|
+
htmlElements
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=DSBreadcrumb.js.map
|