@elliemae/ds-breadcrumb 2.2.0-next.4 → 2.3.0-alpha.2

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/cjs/styles.js CHANGED
@@ -1,68 +1,107 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var styled = require('styled-components');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
-
11
- const handleColor = (theme, isActive, color, isTitle) => {
12
- if (isActive) return theme.colors.neutral[800];else if (color) return color;else if (isTitle) return theme.colors.neutral[700];else return theme.colors.brand[600];
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 });
13
11
  };
14
-
15
- const StyledList = /*#__PURE__*/styled__default["default"].ol.withConfig({
16
- componentId: "sc-12gvmg4-0"
17
- })(["width:100%;list-style:none;display:flex;padding:0;margin:0;li:first-child *{margin-left:0;}"]);
18
- const StyledCrumbWrapper = /*#__PURE__*/styled__default["default"].li.withConfig({
19
- componentId: "sc-12gvmg4-1"
20
- })(["display:inline-flex;align-items:center;flex-shrink:20;transition:flex-shrink 0.1s cubic-bezier(0.64,0,0.35,1);height:16px;min-width:10px;&:hover{flex-shrink:0;}", ""], _ref => {
21
- let {
22
- theme,
23
- isTitle,
24
- trailingSlash
25
- } = _ref;
26
- return isTitle || !trailingSlash ? "&:not(:last-child):after {\n display: inline-block;\n content: '/';\n color: ".concat(theme.colors.neutral[700], ";\n }\n ") : "&:after {\n display: inline-block;\n content: '/';\n color: ".concat(theme.colors.neutral[700], ";\n }\n ");
27
- });
28
- const StyledContainer = /*#__PURE__*/styled__default["default"].nav.withConfig({
29
- componentId: "sc-12gvmg4-2"
30
- })(["display:flex;align-items:center;padding:0;"]);
31
- const StyledLink = /*#__PURE__*/styled__default["default"].a.withConfig({
32
- componentId: "sc-12gvmg4-3"
33
- })(["white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;font-size:12px;outline:none;margin:0 2px;border:2px solid transparent;-webkit-text-stroke:0.4px transparent;font-weight:", ";color:", ";&:hover{color:", ";cursor:pointer;", ";}&:focus{", " border-radius:2px;}"], _ref2 => {
34
- let {
35
- theme
36
- } = _ref2;
37
- return theme.fontWeights.regular;
38
- }, _ref3 => {
39
- let {
40
- theme,
41
- isActive,
42
- color,
43
- isTitle
44
- } = _ref3;
45
- return handleColor(theme, isActive, color, isTitle);
46
- }, _ref4 => {
47
- let {
48
- theme,
49
- color
50
- } = _ref4;
51
- return color ? color : theme.colors.brand[800];
52
- }, _ref5 => {
53
- let {
54
- theme,
55
- color
56
- } = _ref5;
57
- return "-webkit-text-stroke: 0.4px ".concat(color ? color : theme.colors.brand[800]);
58
- }, _ref6 => {
59
- let {
60
- theme
61
- } = _ref6;
62
- return "border: 2px solid ".concat(theme.colors.brand[700], ";");
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
63
34
  });
64
-
65
- exports.StyledContainer = StyledContainer;
66
- exports.StyledCrumbWrapper = StyledCrumbWrapper;
67
- exports.StyledLink = StyledLink;
68
- exports.StyledList = StyledList;
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
+ }
@@ -1,88 +1,57 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import _jsx from '@babel/runtime/helpers/esm/jsx';
3
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
- import 'core-js/modules/web.dom-collections.iterator.js';
5
- import 'core-js/modules/esnext.async-iterator.map.js';
6
- import 'core-js/modules/esnext.iterator.map.js';
7
- import 'core-js/modules/esnext.async-iterator.filter.js';
8
- import 'core-js/modules/esnext.iterator.constructor.js';
9
- import 'core-js/modules/esnext.iterator.filter.js';
10
- import 'core-js/modules/esnext.async-iterator.for-each.js';
11
- import 'core-js/modules/esnext.iterator.for-each.js';
12
- import React, { useMemo, cloneElement } from 'react';
13
- import { PropTypes, describe } from 'react-desc';
14
- import { DSBreadcrumbItem } from './DSBreadcrumbItem.js';
15
- import { useKeyboardNavigation } from './hooks/useKeyboardNavigation.js';
16
- import { StyledContainer, StyledList } from './styles.js';
17
- import { jsx } from 'react/jsx-runtime';
18
-
19
- const _excluded = ["containerProps", "as", "label", "isTitle", "children", "trailingSlash"];
20
-
21
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
-
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
- const htmlElements = ['nav', 'div', 'header', 'footer', 'main'];
25
-
26
- const DSBreadcrumb = _ref => {
27
- let {
28
- containerProps = {},
29
- as = 'nav',
30
- label = 'Breadcrumb',
31
- isTitle = false,
32
- children,
33
- trailingSlash = true
34
- } = _ref,
35
- rest = _objectWithoutProperties(_ref, _excluded);
36
-
1
+ import * as React from "react";
2
+ import React2, { cloneElement, useMemo } from "react";
3
+ import { PropTypes, describe } from "react-desc";
4
+ import DSBreadcrumbItem from "./DSBreadcrumbItem";
5
+ import { useKeyboardNavigation } from "./hooks/useKeyboardNavigation";
6
+ import { StyledContainer, StyledList } from "./styles";
7
+ const htmlElements = ["nav", "div", "header", "footer", "main"];
8
+ const DSBreadcrumb = ({
9
+ containerProps = {},
10
+ as = "nav",
11
+ label = "Breadcrumb",
12
+ isTitle = false,
13
+ children,
14
+ trailingSlash = true,
15
+ ...rest
16
+ }) => {
37
17
  const [addRef, onKeyDown] = useKeyboardNavigation();
38
- const safeElement = useMemo(() => htmlElements.indexOf(as) > -1 ? as : 'nav', [as]);
39
- return /*#__PURE__*/jsx(StyledContainer, _objectSpread(_objectSpread(_objectSpread({
18
+ const safeElement = useMemo(() => htmlElements.indexOf(as) > -1 ? as : "nav", [as]);
19
+ return /* @__PURE__ */ React2.createElement(StyledContainer, {
40
20
  "aria-label": label,
41
- "data-testid": "breadcrumb-nav-container"
42
- }, rest), containerProps), {}, {
43
- as: safeElement,
44
- children: /*#__PURE__*/_jsx(StyledList, {
45
- "data-testid": "list-container"
46
- }, void 0, React.Children.map(children, (child, childIndex) => childIndex < children.length - 1 ? /*#__PURE__*/cloneElement(child, {
47
- childIndex,
48
- addRef,
49
- onKeyDown
50
- }) : /*#__PURE__*/cloneElement(child, {
51
- childIndex,
52
- addRef,
53
- onKeyDown,
54
- trailingSlash,
55
- isTitle
56
- })))
57
- }));
21
+ "data-testid": "breadcrumb-nav-container",
22
+ ...rest,
23
+ ...containerProps,
24
+ as: safeElement
25
+ }, /* @__PURE__ */ React2.createElement(StyledList, {
26
+ "data-testid": "list-container"
27
+ }, React2.Children.map(children, (child, childIndex) => childIndex < children.length - 1 ? cloneElement(child, {
28
+ childIndex,
29
+ addRef,
30
+ onKeyDown
31
+ }) : cloneElement(child, {
32
+ childIndex,
33
+ addRef,
34
+ onKeyDown,
35
+ trailingSlash,
36
+ isTitle
37
+ }))));
58
38
  };
59
-
60
39
  DSBreadcrumb.Item = DSBreadcrumbItem;
61
40
  const props = {
62
- /** props injected to breadcrumb wrapper */
63
- containerProps: PropTypes.object.description('props injected to breadcrumb wrapper'),
64
-
65
- /**
66
- * Type of element you want the main container to be:
67
- * 'nav', 'div', 'header', 'footer', 'main'
68
- */
41
+ containerProps: PropTypes.object.description("props injected to breadcrumb wrapper"),
69
42
  as: PropTypes.string.description("Type of element you want the main container to be: 'nav', 'div', 'header', 'footer', 'main'"),
70
-
71
- /**
72
- * Whether to show the last element of the breadcrumb as a title
73
- * Also removes trailing slash to show last element as title
74
- */
75
- 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'),
76
-
77
- /** breadcrumb label */
78
- label: PropTypes.string.description('breadcrumb label'),
79
-
80
- /**
81
- * Container items to wrap
82
- */
83
- children: PropTypes.arrayOf(DSBreadcrumbItem).isRequired.description('Container items to wrap')
43
+ 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"),
44
+ label: PropTypes.string.description("breadcrumb label"),
45
+ children: PropTypes.arrayOf(DSBreadcrumbItem).isRequired.description("Container items to wrap")
84
46
  };
47
+ DSBreadcrumb.propTypes = props;
85
48
  const DSBreadcrumbWithSchema = describe(DSBreadcrumb);
86
49
  DSBreadcrumbWithSchema.propTypes = props;
87
-
88
- export { DSBreadcrumb, DSBreadcrumbWithSchema, DSBreadcrumb as default, htmlElements };
50
+ var DSBreadcrumb_default = DSBreadcrumb;
51
+ export {
52
+ DSBreadcrumb,
53
+ DSBreadcrumbWithSchema,
54
+ DSBreadcrumb_default as default,
55
+ htmlElements
56
+ };
57
+ //# sourceMappingURL=DSBreadcrumb.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSBreadcrumb.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA;AAEA,MAAM,eAAe,CAAC,OAAO,OAAO,UAAU,UAAU;AAExD,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB;AAAA,EACjB,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA,gBAAgB;AAAA,KACb;AAAA,MACyC;AAC5C,QAAM,CAAC,QAAQ,aAAa;AAE5B,QAAM,cAAc,QAClB,MAAO,aAAa,QAAQ,MAAM,KAAK,KAAK,OAC5C,CAAC;AAGH,SACE,qCAAC,iBAAD;AAAA,IACE,cAAY;AAAA,IACZ,eAAY;AAAA,OACR;AAAA,OACA;AAAA,IACJ,IAAI;AAAA,KAEJ,qCAAC,YAAD;AAAA,IAAY,eAAY;AAAA,KACrB,OAAM,SAAS,IAAI,UAAU,CAAC,OAA2B,eACxD,aAAa,SAAS,SAAS,IAC3B,aAAa,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,OAEF,aAAa,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAQhB,aAAa,OAAO;AAEpB,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAC/B;AAAA,EAMF,IAAI,UAAU,OAAO,YACnB;AAAA,EAMF,SAAS,UAAU,KAAK,YACtB;AAAA,EAGF,OAAO,UAAU,OAAO,YAAY;AAAA,EAIpC,UAAU,UAAU,QAAQ,kBAAkB,WAAW,YACvD;AAAA;AAIJ,aAAa,YAAY;AAEzB,MAAM,yBAAyB,SAAS;AACxC,uBAAuB,YAAY;AAGnC,IAAO,uBAAQ;",
6
+ "names": []
7
+ }
@@ -1,87 +1,57 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
8
- import 'react';
9
- import { PropTypes, describe } from 'react-desc';
10
- import { StyledCrumbWrapper, StyledLink } from './styles.js';
11
- import { jsx } from 'react/jsx-runtime';
12
-
13
- const _excluded = ["active", "as", "href", "isTitle", "onClick", "label", "color", "addRef", "childIndex", "trailingSlash", "onKeyDown"];
14
-
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
-
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
-
19
- function DSBreadcrumbItem(_ref) {
20
- let {
21
- active = false,
22
- as = 'a',
23
- href = undefined,
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { PropTypes, describe } from "react-desc";
4
+ import { StyledLink, StyledCrumbWrapper } from "./styles";
5
+ function DSBreadcrumbItem({
6
+ active = false,
7
+ as = "a",
8
+ href = void 0,
9
+ isTitle,
10
+ onClick = () => null,
11
+ label = "",
12
+ color = null,
13
+ addRef,
14
+ childIndex,
15
+ trailingSlash,
16
+ onKeyDown = () => null,
17
+ ...rest
18
+ }) {
19
+ return /* @__PURE__ */ React2.createElement(StyledCrumbWrapper, {
20
+ "aria-current": active ? "page" : void 0,
21
+ "data-testid": "breadcrumb-item-container",
24
22
  isTitle,
25
- onClick = () => null,
26
- label = '',
27
- color = null,
28
- addRef,
29
- childIndex,
30
23
  trailingSlash,
31
- onKeyDown = () => null
32
- } = _ref,
33
- rest = _objectWithoutProperties(_ref, _excluded);
34
-
35
- return /*#__PURE__*/jsx(StyledCrumbWrapper, _objectSpread(_objectSpread({
36
- "aria-current": active ? 'page' : undefined,
37
- "data-testid": "breadcrumb-item-container",
38
- isTitle: isTitle,
39
- trailingSlash: trailingSlash
40
- }, rest), {}, {
41
- children: /*#__PURE__*/jsx(StyledLink, {
42
- as: as,
43
- href: href,
44
- onClick: onClick,
45
- ref: addRef,
46
- tabIndex: 0,
47
- isActive: active,
48
- onKeyDown: e => onKeyDown(e, childIndex, onClick),
49
- isTitle: isTitle,
50
- color: color,
51
- children: label
52
- })
53
- }));
24
+ ...rest
25
+ }, /* @__PURE__ */ React2.createElement(StyledLink, {
26
+ as,
27
+ href,
28
+ onClick,
29
+ ref: addRef,
30
+ tabIndex: 0,
31
+ isActive: active,
32
+ onKeyDown: (e) => onKeyDown(e, childIndex, onClick),
33
+ isTitle,
34
+ color
35
+ }, label));
54
36
  }
55
-
56
37
  const props = {
57
- /** inject props to wrapper */
58
- containerComponent: PropTypes.string.description('inject props to wrapper'),
59
-
60
- /** render as any html node */
61
- as: PropTypes.string.description('render as any html node'),
62
-
63
- /** active item */
64
- active: PropTypes.bool.description('active item'),
65
-
66
- /** href link */
67
- href: PropTypes.string.description('href link'),
68
-
69
- /** on click handler */
70
- onClick: PropTypes.func.description('on click handler'),
71
-
72
- /** style item as title */
73
- isTitle: PropTypes.bool.description('style item as title'),
74
-
75
- /** add trailing slash */
76
- trailingSlash: PropTypes.bool.description('add trailing slash'),
77
-
78
- /** item label */
79
- label: PropTypes.string.description('item label'),
80
-
81
- /** link color */
82
- color: PropTypes.string.description('link color')
38
+ containerComponent: PropTypes.string.description("inject props to wrapper"),
39
+ as: PropTypes.string.description("render as any html node"),
40
+ active: PropTypes.bool.description("active item"),
41
+ href: PropTypes.string.description("href link"),
42
+ onClick: PropTypes.func.description("on click handler"),
43
+ isTitle: PropTypes.bool.description("style item as title"),
44
+ trailingSlash: PropTypes.bool.description("add trailing slash"),
45
+ label: PropTypes.string.description("item label"),
46
+ color: PropTypes.string.description("link color")
83
47
  };
48
+ DSBreadcrumbItem.propTypes = props;
84
49
  const DSBreadcrumbItemWithSchema = describe(DSBreadcrumbItem);
85
50
  DSBreadcrumbItemWithSchema.propTypes = props;
86
-
87
- export { DSBreadcrumbItem, DSBreadcrumbItemWithSchema, DSBreadcrumbItem as default };
51
+ var DSBreadcrumbItem_default = DSBreadcrumbItem;
52
+ export {
53
+ DSBreadcrumbItem,
54
+ DSBreadcrumbItemWithSchema,
55
+ DSBreadcrumbItem_default as default
56
+ };
57
+ //# sourceMappingURL=DSBreadcrumbItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSBreadcrumbItem.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA;AAEA,0BAA0B;AAAA,EACxB,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP;AAAA,EACA,UAAU,MAAM;AAAA,EAChB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,MAAM;AAAA,KACf;AAAA,GAC0C;AAC7C,SACE,qCAAC,oBAAD;AAAA,IACE,gBAAc,SAAS,SAAS;AAAA,IAChC,eAAY;AAAA,IACZ;AAAA,IACA;AAAA,OACI;AAAA,KAEJ,qCAAC,YAAD;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,UAAU,OAAO,YAAY;AAAA,EAEjD,IAAI,UAAU,OAAO,YAAY;AAAA,EAEjC,QAAQ,UAAU,KAAK,YAAY;AAAA,EAEnC,MAAM,UAAU,OAAO,YAAY;AAAA,EAEnC,SAAS,UAAU,KAAK,YAAY;AAAA,EAEpC,SAAS,UAAU,KAAK,YAAY;AAAA,EAEpC,eAAe,UAAU,KAAK,YAAY;AAAA,EAE1C,OAAO,UAAU,OAAO,YAAY;AAAA,EAEpC,OAAO,UAAU,OAAO,YAAY;AAAA;AAGtC,iBAAiB,YAAY;AAE7B,MAAM,6BAA6B,SAAS;AAC5C,2BAA2B,YAAY;AAGvC,IAAO,2BAAQ;",
6
+ "names": []
7
+ }
@@ -1,26 +1,28 @@
1
- import { useRef, useCallback } from 'react';
2
-
1
+ import * as React from "react";
2
+ import { useRef, useCallback } from "react";
3
3
  const useKeyboardNavigation = () => {
4
4
  const componentsRef = useRef([]);
5
- const addRef = useCallback(ref => {
5
+ const addRef = useCallback((ref) => {
6
6
  if (ref && !componentsRef.current.includes(ref)) {
7
7
  componentsRef.current.push(ref);
8
8
  }
9
9
  }, []);
10
10
  const onKeyDown = useCallback((e, componentRefIndex, callback) => {
11
- if (e.key === 'ArrowDown' && componentsRef.current[componentRefIndex + 1]) {
11
+ if (e.key === "ArrowDown" && componentsRef.current[componentRefIndex + 1]) {
12
12
  componentsRef.current[componentRefIndex + 1].focus();
13
13
  e.preventDefault();
14
- } else if (e.key === 'ArrowUp' && componentRefIndex !== 0) {
14
+ } else if (e.key === "ArrowUp" && componentRefIndex !== 0) {
15
15
  componentsRef.current[componentRefIndex - 1].focus();
16
16
  e.preventDefault();
17
- } else if (e.key === 'Enter') {
17
+ } else if (e.key === "Enter") {
18
18
  callback();
19
- } else if (e.ctrlKey && e.altKey && e.key === ' ') {
19
+ } else if (e.ctrlKey && e.altKey && e.key === " ") {
20
20
  componentsRef.current[componentRefIndex].click();
21
21
  }
22
22
  }, []);
23
23
  return [addRef, onKeyDown];
24
24
  };
25
-
26
- export { useKeyboardNavigation };
25
+ export {
26
+ useKeyboardNavigation
27
+ };
28
+ //# sourceMappingURL=useKeyboardNavigation.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useKeyboardNavigation.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,wBAAwB,MAAM;AACzC,QAAM,gBAAgB,OAA4B;AAElD,QAAM,SAAS,YAAY,CAAC,QAA2B;AACrD,QAAI,OAAO,CAAC,cAAc,QAAQ,SAAS,MAAM;AAC/C,oBAAc,QAAQ,KAAK;AAAA;AAAA,KAE5B;AAEH,QAAM,YAAY,YAChB,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
+ }
package/esm/index.d.js CHANGED
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
package/esm/index.js CHANGED
@@ -1,2 +1,8 @@
1
- export { DSBreadcrumb, DSBreadcrumbWithSchema, DSBreadcrumb as default, htmlElements } from './DSBreadcrumb.js';
2
- export { DSBreadcrumbItem, DSBreadcrumbItemWithSchema } from './DSBreadcrumbItem.js';
1
+ import * as React from "react";
2
+ export * from "./DSBreadcrumb";
3
+ export * from "./DSBreadcrumbItem";
4
+ import { default as default2 } from "./DSBreadcrumb";
5
+ export {
6
+ default2 as default
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSBreadcrumb';\nexport * from './DSBreadcrumbItem';\nexport { default } from './DSBreadcrumb';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;",
6
+ "names": []
7
+ }