@elliemae/ds-breadcrumb 3.80.0-next.41 → 3.80.0-next.42
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 +34 -46
- package/dist/cjs/DSBreadcrumb.js.map +3 -3
- package/dist/cjs/DSBreadcrumbItem.js +6 -25
- package/dist/cjs/DSBreadcrumbItem.js.map +3 -3
- package/dist/cjs/constants/index.js +10 -0
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js +11 -5
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/react-desc-prop-types.js +63 -0
- package/dist/cjs/react-desc-prop-types.js.map +3 -3
- package/dist/cjs/typescript-testing/slot-props.js +46 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-breadcrumb-valid.js +19 -1
- package/dist/cjs/typescript-testing/typescript-breadcrumb-valid.js.map +2 -2
- package/dist/esm/DSBreadcrumb.js +36 -48
- package/dist/esm/DSBreadcrumb.js.map +3 -3
- package/dist/esm/DSBreadcrumbItem.js +8 -27
- package/dist/esm/DSBreadcrumbItem.js.map +3 -3
- package/dist/esm/constants/index.js +10 -0
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js +14 -4
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/react-desc-prop-types.js +63 -0
- package/dist/esm/react-desc-prop-types.js.map +3 -3
- package/dist/esm/typescript-testing/slot-props.js +23 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-breadcrumb-valid.js +19 -1
- package/dist/esm/typescript-testing/typescript-breadcrumb-valid.js.map +2 -2
- package/dist/types/constants/index.d.ts +8 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/react-desc-prop-types.d.ts +25 -9
- package/package.json +7 -6
package/dist/esm/DSBreadcrumb.js
CHANGED
|
@@ -1,74 +1,62 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { describe, useMemoMergePropsWithDefault, useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
4
4
|
import React2, { cloneElement, useMemo } from "react";
|
|
5
5
|
import DSBreadcrumbItem from "./DSBreadcrumbItem.js";
|
|
6
6
|
import { useKeyboardNavigation } from "./hooks/useKeyboardNavigation.js";
|
|
7
|
-
import { defaultProps } from "./react-desc-prop-types.js";
|
|
7
|
+
import { defaultProps, DSBreadcrumbPropTypesSchema } from "./react-desc-prop-types.js";
|
|
8
8
|
import { StyledContainer, StyledList } from "./styles.js";
|
|
9
9
|
const htmlElements = ["nav", "div"];
|
|
10
|
-
const NavContainer = (
|
|
11
|
-
const { label, containerProps, as, children, ...rest } =
|
|
10
|
+
const NavContainer = (props) => {
|
|
11
|
+
const { label, containerProps, as, children, ownerPropsConfig, ...rest } = props;
|
|
12
12
|
return (
|
|
13
13
|
// @ts-expect-error - styled components are not correctly supporting the alias in typescript
|
|
14
|
-
/* @__PURE__ */ jsx(StyledContainer, { "aria-label": label, ...rest, ...containerProps, as, children: /* @__PURE__ */ jsx(StyledList, { children }) })
|
|
14
|
+
/* @__PURE__ */ jsx(StyledContainer, { "aria-label": label, ...rest, ...containerProps, as, ...ownerPropsConfig, children: /* @__PURE__ */ jsx(StyledList, { ...ownerPropsConfig, children }) })
|
|
15
15
|
);
|
|
16
16
|
};
|
|
17
|
-
const DivContainer = (
|
|
18
|
-
const { label, containerProps, as, children, ...rest } =
|
|
17
|
+
const DivContainer = (props) => {
|
|
18
|
+
const { label, containerProps, as, children, ownerPropsConfig, ...rest } = props;
|
|
19
19
|
return (
|
|
20
20
|
// @ts-expect-error - styled components are not correctly supporting the alias in typescript
|
|
21
|
-
/* @__PURE__ */ jsx(StyledContainer, { ...rest, ...containerProps, as, children: /* @__PURE__ */ jsx(StyledList, { "aria-label": label, children }) })
|
|
21
|
+
/* @__PURE__ */ jsx(StyledContainer, { ...rest, ...containerProps, as, ...ownerPropsConfig, children: /* @__PURE__ */ jsx(StyledList, { "aria-label": label, ...ownerPropsConfig, children }) })
|
|
22
22
|
);
|
|
23
23
|
};
|
|
24
|
-
const DSBreadcrumb = (
|
|
25
|
-
const propsWithDefaults = useMemoMergePropsWithDefault(
|
|
24
|
+
const DSBreadcrumb = (props) => {
|
|
25
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);
|
|
26
26
|
const { containerProps, as, label, trailingSlash, isTitle, children, ...rest } = propsWithDefaults;
|
|
27
27
|
const [addRef, onKeyDown] = useKeyboardNavigation({ isTitle });
|
|
28
|
+
const ownerPropsConfig = useOwnerProps(propsWithDefaults);
|
|
28
29
|
const safeElement = useMemo(() => htmlElements.indexOf(as) > -1 ? as : "nav", [as]);
|
|
29
30
|
const Container = as === "nav" ? NavContainer : DivContainer;
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
Container,
|
|
33
|
+
{
|
|
34
|
+
label,
|
|
35
|
+
...rest,
|
|
36
|
+
containerProps,
|
|
37
|
+
as: safeElement,
|
|
38
|
+
ownerPropsConfig,
|
|
39
|
+
children: React2.Children.map(
|
|
40
|
+
children,
|
|
41
|
+
(child, childIndex) => childIndex < children.length - 1 ? cloneElement(child, {
|
|
42
|
+
childIndex,
|
|
43
|
+
addRef,
|
|
44
|
+
onKeyDown
|
|
45
|
+
}) : cloneElement(child, {
|
|
46
|
+
childIndex,
|
|
47
|
+
addRef,
|
|
48
|
+
onKeyDown,
|
|
49
|
+
trailingSlash,
|
|
50
|
+
isTitle
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
);
|
|
44
55
|
};
|
|
45
56
|
DSBreadcrumb.Item = DSBreadcrumbItem;
|
|
46
|
-
const props = {
|
|
47
|
-
/** props injected to breadcrumb wrapper */
|
|
48
|
-
containerProps: PropTypes.object.description("props injected to breadcrumb wrapper"),
|
|
49
|
-
/**
|
|
50
|
-
* Type of element you want the main container to be:
|
|
51
|
-
* 'nav', 'div'
|
|
52
|
-
*/
|
|
53
|
-
as: PropTypes.oneOf(["nav", "div"]).description("Type of element you want the main container to be: 'nav' or 'div'. Defaults to 'nav'.").defaultValue("nav"),
|
|
54
|
-
/**
|
|
55
|
-
* Whether to show the last element of the breadcrumb as a title
|
|
56
|
-
* Also removes trailing slash to show last element as title
|
|
57
|
-
*/
|
|
58
|
-
isTitle: PropTypes.bool.description(
|
|
59
|
-
"Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title"
|
|
60
|
-
),
|
|
61
|
-
/** breadcrumb label */
|
|
62
|
-
label: PropTypes.string.description("breadcrumb label"),
|
|
63
|
-
/**
|
|
64
|
-
* Container items to wrap
|
|
65
|
-
*/
|
|
66
|
-
trailingSlash: PropTypes.bool.description("Whether to show trailing slash on all items except the last one").defaultValue(true),
|
|
67
|
-
children: PropTypes.arrayOf(PropTypes.element).isRequired.description("Container items to wrap")
|
|
68
|
-
};
|
|
69
57
|
DSBreadcrumb.displayName = "DSBreadcrumb";
|
|
70
58
|
const DSBreadcrumbWithSchema = describe(DSBreadcrumb);
|
|
71
|
-
DSBreadcrumbWithSchema.propTypes =
|
|
59
|
+
DSBreadcrumbWithSchema.propTypes = DSBreadcrumbPropTypesSchema;
|
|
72
60
|
var DSBreadcrumb_default = DSBreadcrumb;
|
|
73
61
|
export {
|
|
74
62
|
DSBreadcrumb,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSBreadcrumb.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": ["React"
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe, useMemoMergePropsWithDefault, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React, { cloneElement, useMemo } from 'react';\nimport DSBreadcrumbItem from './DSBreadcrumbItem.js';\nimport { useKeyboardNavigation } from './hooks/useKeyboardNavigation.js';\nimport type { DSBreadcrumbT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBreadcrumbPropTypesSchema } from './react-desc-prop-types.js';\nimport { StyledContainer, StyledList } from './styles.js';\n\nconst htmlElements = ['nav', 'div'] as const;\n\ntype ContainerProps = Omit<DSBreadcrumbT.InternalProps, 'isTitle' | 'trailingSlash'> & {\n ownerPropsConfig: ReturnType<typeof useOwnerProps<DSBreadcrumbT.InternalProps>>;\n};\n\nconst NavContainer = (props: ContainerProps) => {\n const { label, containerProps, as, children, ownerPropsConfig, ...rest } = props;\n return (\n // @ts-expect-error - styled components are not correctly supporting the alias in typescript\n <StyledContainer aria-label={label} {...rest} {...containerProps} as={as} {...ownerPropsConfig}>\n <StyledList {...ownerPropsConfig}>{children}</StyledList>\n </StyledContainer>\n );\n};\n\nconst DivContainer = (props: ContainerProps) => {\n const { label, containerProps, as, children, ownerPropsConfig, ...rest } = props;\n return (\n // @ts-expect-error - styled components are not correctly supporting the alias in typescript\n <StyledContainer {...rest} {...containerProps} as={as} {...ownerPropsConfig}>\n <StyledList aria-label={label} {...ownerPropsConfig}>\n {children}\n </StyledList>\n </StyledContainer>\n );\n};\n\nconst DSBreadcrumb = (props: DSBreadcrumbT.Props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSBreadcrumbT.InternalProps>(props, defaultProps);\n const { containerProps, as, label, trailingSlash, isTitle, children, ...rest } = propsWithDefaults;\n const [addRef, onKeyDown] = useKeyboardNavigation({ isTitle });\n const ownerPropsConfig = useOwnerProps(propsWithDefaults);\n\n const safeElement = useMemo(() => (htmlElements.indexOf(as) > -1 ? as : 'nav'), [as]);\n\n const Container = as === 'nav' ? NavContainer : DivContainer;\n\n return (\n <Container\n label={label}\n {...rest}\n containerProps={containerProps}\n as={safeElement}\n ownerPropsConfig={ownerPropsConfig}\n >\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 </Container>\n );\n};\n\nDSBreadcrumb.Item = DSBreadcrumbItem;\n\nDSBreadcrumb.displayName = 'DSBreadcrumb';\nconst DSBreadcrumbWithSchema = describe(DSBreadcrumb);\nDSBreadcrumbWithSchema.propTypes = DSBreadcrumbPropTypesSchema;\n\nexport { DSBreadcrumb, DSBreadcrumbWithSchema, htmlElements };\nexport default DSBreadcrumb;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmBjB;AAnBN,SAAS,UAAU,8BAA8B,qBAAqB;AACtE,OAAOA,UAAS,cAAc,eAAe;AAC7C,OAAO,sBAAsB;AAC7B,SAAS,6BAA6B;AAEtC,SAAS,cAAc,mCAAmC;AAC1D,SAAS,iBAAiB,kBAAkB;AAE5C,MAAM,eAAe,CAAC,OAAO,KAAK;AAMlC,MAAM,eAAe,CAAC,UAA0B;AAC9C,QAAM,EAAE,OAAO,gBAAgB,IAAI,UAAU,kBAAkB,GAAG,KAAK,IAAI;AAC3E;AAAA;AAAA,IAEE,oBAAC,mBAAgB,cAAY,OAAQ,GAAG,MAAO,GAAG,gBAAgB,IAAS,GAAG,kBAC5E,8BAAC,cAAY,GAAG,kBAAmB,UAAS,GAC9C;AAAA;AAEJ;AAEA,MAAM,eAAe,CAAC,UAA0B;AAC9C,QAAM,EAAE,OAAO,gBAAgB,IAAI,UAAU,kBAAkB,GAAG,KAAK,IAAI;AAC3E;AAAA;AAAA,IAEE,oBAAC,mBAAiB,GAAG,MAAO,GAAG,gBAAgB,IAAS,GAAG,kBACzD,8BAAC,cAAW,cAAY,OAAQ,GAAG,kBAChC,UACH,GACF;AAAA;AAEJ;AAEA,MAAM,eAAe,CAAC,UAA+B;AACnD,QAAM,oBAAoB,6BAA0D,OAAO,YAAY;AACvG,QAAM,EAAE,gBAAgB,IAAI,OAAO,eAAe,SAAS,UAAU,GAAG,KAAK,IAAI;AACjF,QAAM,CAAC,QAAQ,SAAS,IAAI,sBAAsB,EAAE,QAAQ,CAAC;AAC7D,QAAM,mBAAmB,cAAc,iBAAiB;AAExD,QAAM,cAAc,QAAQ,MAAO,aAAa,QAAQ,EAAE,IAAI,KAAK,KAAK,OAAQ,CAAC,EAAE,CAAC;AAEpF,QAAM,YAAY,OAAO,QAAQ,eAAe;AAEhD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ;AAAA,MACA,IAAI;AAAA,MACJ;AAAA,MAEC,UAAAA,OAAM,SAAS;AAAA,QAAI;AAAA,QAAU,CAAC,OAA2B,eACxD,aAAa,SAAS,SAAS,IAC3B,aAAa,OAAO;AAAA,UAClB;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC,IACD,aAAa,OAAO;AAAA,UAClB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACP;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,OAAO;AAEpB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;AAGnC,IAAO,uBAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { describe, useMemoMergePropsWithDefault, useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
4
4
|
import React2 from "react";
|
|
5
|
-
import { defaultItemProps } from "./react-desc-prop-types.js";
|
|
5
|
+
import { defaultItemProps, DSBreadcrumbItemPropTypesSchema } from "./react-desc-prop-types.js";
|
|
6
6
|
import { StyledCrumbWrapper, StyledLink } from "./styles.js";
|
|
7
|
-
const DSBreadcrumbItem = (
|
|
8
|
-
const propsWithDefaults = useMemoMergePropsWithDefault(
|
|
7
|
+
const DSBreadcrumbItem = (props) => {
|
|
8
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultItemProps);
|
|
9
9
|
const { as, active, href, onClick, onKeyDown, addRef, isTitle, trailingSlash, label, childIndex, color, ...rest } = propsWithDefaults;
|
|
10
|
+
const ownerPropsConfig = useOwnerProps(propsWithDefaults);
|
|
10
11
|
const ariaCurrent = React2.useMemo(() => {
|
|
11
12
|
if (active) {
|
|
12
13
|
return as === "button" || as === "span" ? "step" : "page";
|
|
@@ -21,7 +22,7 @@ const DSBreadcrumbItem = (props2) => {
|
|
|
21
22
|
[isTitle, onClick]
|
|
22
23
|
);
|
|
23
24
|
const component = isTitle && active ? "span" : as;
|
|
24
|
-
return /* @__PURE__ */ jsx(StyledCrumbWrapper, { isTitle, trailingSlash, children: /* @__PURE__ */ jsx(
|
|
25
|
+
return /* @__PURE__ */ jsx(StyledCrumbWrapper, { isTitle, trailingSlash, ...ownerPropsConfig, children: /* @__PURE__ */ jsx(
|
|
25
26
|
StyledLink,
|
|
26
27
|
{
|
|
27
28
|
variant: "link",
|
|
@@ -36,34 +37,14 @@ const DSBreadcrumbItem = (props2) => {
|
|
|
36
37
|
innerRef: addRef,
|
|
37
38
|
"aria-current": ariaCurrent,
|
|
38
39
|
...rest,
|
|
40
|
+
...ownerPropsConfig,
|
|
39
41
|
children: label
|
|
40
42
|
}
|
|
41
43
|
) });
|
|
42
44
|
};
|
|
43
|
-
const props = {
|
|
44
|
-
/**
|
|
45
|
-
* Type of element you want the item to be:
|
|
46
|
-
* 'a', 'button'
|
|
47
|
-
*/
|
|
48
|
-
as: PropTypes.oneOf(["a", "button"]).description('Type of element you want the item to be: "a" or "button". Defaults to "a"').defaultValue("a"),
|
|
49
|
-
/** active item */
|
|
50
|
-
active: PropTypes.bool.description("Active item"),
|
|
51
|
-
/** href link */
|
|
52
|
-
href: PropTypes.string.description("Href link"),
|
|
53
|
-
/** on click handler */
|
|
54
|
-
onClick: PropTypes.func.description("On click handler"),
|
|
55
|
-
/** style item as title */
|
|
56
|
-
isTitle: PropTypes.bool.description("Style item as title"),
|
|
57
|
-
/** add trailing slash */
|
|
58
|
-
trailingSlash: PropTypes.bool.description("Add trailing slash"),
|
|
59
|
-
/** item label */
|
|
60
|
-
label: PropTypes.string.description("Item label"),
|
|
61
|
-
/** link color */
|
|
62
|
-
color: PropTypes.string.description("Link color")
|
|
63
|
-
};
|
|
64
45
|
DSBreadcrumbItem.displayName = "DSBreadcrumbItem";
|
|
65
46
|
const DSBreadcrumbItemWithSchema = describe(DSBreadcrumbItem);
|
|
66
|
-
DSBreadcrumbItemWithSchema.propTypes =
|
|
47
|
+
DSBreadcrumbItemWithSchema.propTypes = DSBreadcrumbItemPropTypesSchema;
|
|
67
48
|
var DSBreadcrumbItem_default = DSBreadcrumbItem;
|
|
68
49
|
export {
|
|
69
50
|
DSBreadcrumbItem,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSBreadcrumbItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": ["React"
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe, useMemoMergePropsWithDefault, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport type { DSBreadcrumbItemT } from './react-desc-prop-types.js';\nimport { defaultItemProps, DSBreadcrumbItemPropTypesSchema } from './react-desc-prop-types.js';\nimport { StyledCrumbWrapper, StyledLink } from './styles.js';\n\nconst DSBreadcrumbItem = (props: DSBreadcrumbItemT.Props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSBreadcrumbItemT.InternalProps>(props, defaultItemProps);\n const { as, active, href, onClick, onKeyDown, addRef, isTitle, trailingSlash, label, childIndex, color, ...rest } =\n propsWithDefaults;\n const ownerPropsConfig = useOwnerProps(propsWithDefaults);\n\n const ariaCurrent = React.useMemo(() => {\n if (active) {\n return as === 'button' || as === 'span' ? 'step' : 'page';\n }\n return undefined;\n }, [active, as]);\n\n const handleOnClick = React.useCallback(\n (e: React.MouseEvent) => {\n if (isTitle) return;\n onClick(e);\n },\n [isTitle, onClick],\n );\n\n // Determine the component type\n // When isTitle=true. All non-current steps are links with its style. Active step can have aria-current. Active step has non-interactable behaviour and style.\n // Active step can be SPAN\n const component = isTitle && active ? 'span' : as;\n\n return (\n <StyledCrumbWrapper isTitle={isTitle} trailingSlash={trailingSlash} {...ownerPropsConfig}>\n <StyledLink\n variant=\"link\"\n component={component}\n href={href}\n onClick={handleOnClick}\n tabIndex={isTitle ? -1 : 0}\n active={active}\n onKeyDown={(e: React.KeyboardEvent) => onKeyDown(e, childIndex ?? -1, handleOnClick)}\n isTitle={isTitle}\n color={color}\n innerRef={addRef}\n aria-current={ariaCurrent}\n {...rest}\n {...ownerPropsConfig}\n >\n {label}\n </StyledLink>\n </StyledCrumbWrapper>\n );\n};\n\nDSBreadcrumbItem.displayName = 'DSBreadcrumbItem';\nconst DSBreadcrumbItemWithSchema = describe(DSBreadcrumbItem);\nDSBreadcrumbItemWithSchema.propTypes = DSBreadcrumbItemPropTypesSchema;\n\nexport { DSBreadcrumbItem, DSBreadcrumbItemWithSchema };\nexport default DSBreadcrumbItem;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACkCjB;AAlCN,SAAS,UAAU,8BAA8B,qBAAqB;AACtE,OAAOA,YAAW;AAElB,SAAS,kBAAkB,uCAAuC;AAClE,SAAS,oBAAoB,kBAAkB;AAE/C,MAAM,mBAAmB,CAAC,UAAmC;AAC3D,QAAM,oBAAoB,6BAA8D,OAAO,gBAAgB;AAC/G,QAAM,EAAE,IAAI,QAAQ,MAAM,SAAS,WAAW,QAAQ,SAAS,eAAe,OAAO,YAAY,OAAO,GAAG,KAAK,IAC9G;AACF,QAAM,mBAAmB,cAAc,iBAAiB;AAExD,QAAM,cAAcA,OAAM,QAAQ,MAAM;AACtC,QAAI,QAAQ;AACV,aAAO,OAAO,YAAY,OAAO,SAAS,SAAS;AAAA,IACrD;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,EAAE,CAAC;AAEf,QAAM,gBAAgBA,OAAM;AAAA,IAC1B,CAAC,MAAwB;AACvB,UAAI,QAAS;AACb,cAAQ,CAAC;AAAA,IACX;AAAA,IACA,CAAC,SAAS,OAAO;AAAA,EACnB;AAKA,QAAM,YAAY,WAAW,SAAS,SAAS;AAE/C,SACE,oBAAC,sBAAmB,SAAkB,eAA+B,GAAG,kBACtE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,UAAU,UAAU,KAAK;AAAA,MACzB;AAAA,MACA,WAAW,CAAC,MAA2B,UAAU,GAAG,cAAc,IAAI,aAAa;AAAA,MACnF;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,gBAAc;AAAA,MACb,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,iBAAiB,cAAc;AAC/B,MAAM,6BAA6B,SAAS,gBAAgB;AAC5D,2BAA2B,YAAY;AAGvC,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -7,10 +7,20 @@ const BREADCRUMB_SLOTS = {
|
|
|
7
7
|
LINK: "link",
|
|
8
8
|
LIST: "list"
|
|
9
9
|
};
|
|
10
|
+
const BREADCRUMB_TRAIL_SLOTS = {
|
|
11
|
+
CONTAINER: BREADCRUMB_SLOTS.CONTAINER,
|
|
12
|
+
LIST: BREADCRUMB_SLOTS.LIST
|
|
13
|
+
};
|
|
14
|
+
const BREADCRUMB_ITEM_SLOTS = {
|
|
15
|
+
CRUMBWRAPPER: BREADCRUMB_SLOTS.CRUMBWRAPPER,
|
|
16
|
+
LINK: BREADCRUMB_SLOTS.LINK
|
|
17
|
+
};
|
|
10
18
|
const BREADCRUMB_DATA_TESTID = slotObjectToDataTestIds(DSBreadcrumbName, BREADCRUMB_SLOTS);
|
|
11
19
|
export {
|
|
12
20
|
BREADCRUMB_DATA_TESTID,
|
|
21
|
+
BREADCRUMB_ITEM_SLOTS,
|
|
13
22
|
BREADCRUMB_SLOTS,
|
|
23
|
+
BREADCRUMB_TRAIL_SLOTS,
|
|
14
24
|
DSBreadcrumbName
|
|
15
25
|
};
|
|
16
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSBreadcrumbName = 'DSBreadcrumb';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const BREADCRUMB_SLOTS = {\n CONTAINER: 'container',\n CRUMBWRAPPER: 'crumb-wrapper',\n LINK: 'link',\n LIST: 'list',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const BREADCRUMB_DATA_TESTID = slotObjectToDataTestIds(DSBreadcrumbName, BREADCRUMB_SLOTS);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,mBAAmB;AAGzB,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,EACX,cAAc;AAAA,EACd,MAAM;AAAA,EACN,MAAM;AACR;AAGO,MAAM,yBAAyB,wBAAwB,kBAAkB,gBAAgB;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSBreadcrumbName = 'DSBreadcrumb';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const BREADCRUMB_SLOTS = {\n CONTAINER: 'container',\n CRUMBWRAPPER: 'crumb-wrapper',\n LINK: 'link',\n LIST: 'list',\n} as const;\n\n// the slots above are split between the two components that render them:\n// DSBreadcrumb renders the trail (container + list), so their slot props go on <DSBreadcrumb />\nexport const BREADCRUMB_TRAIL_SLOTS = {\n CONTAINER: BREADCRUMB_SLOTS.CONTAINER,\n LIST: BREADCRUMB_SLOTS.LIST,\n} as const;\n\n// DSBreadcrumbItem renders each crumb (crumb wrapper + link), so their slot props go on each <DSBreadcrumb.Item />\nexport const BREADCRUMB_ITEM_SLOTS = {\n CRUMBWRAPPER: BREADCRUMB_SLOTS.CRUMBWRAPPER,\n LINK: BREADCRUMB_SLOTS.LINK,\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const BREADCRUMB_DATA_TESTID = slotObjectToDataTestIds(DSBreadcrumbName, BREADCRUMB_SLOTS);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,mBAAmB;AAGzB,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,EACX,cAAc;AAAA,EACd,MAAM;AAAA,EACN,MAAM;AACR;AAIO,MAAM,yBAAyB;AAAA,EACpC,WAAW,iBAAiB;AAAA,EAC5B,MAAM,iBAAiB;AACzB;AAGO,MAAM,wBAAwB;AAAA,EACnC,cAAc,iBAAiB;AAAA,EAC/B,MAAM,iBAAiB;AACzB;AAGO,MAAM,yBAAyB,wBAAwB,kBAAkB,gBAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DSBreadcrumb, DSBreadcrumbWithSchema, htmlElements } from "./DSBreadcrumb.js";
|
|
3
|
+
import { DSBreadcrumbItem, DSBreadcrumbItemWithSchema } from "./DSBreadcrumbItem.js";
|
|
4
|
+
import {
|
|
5
|
+
defaultProps,
|
|
6
|
+
defaultItemProps
|
|
7
|
+
} from "./react-desc-prop-types.js";
|
|
5
8
|
import { DSBreadcrumbName, BREADCRUMB_SLOTS, BREADCRUMB_DATA_TESTID } from "./constants/index.js";
|
|
6
9
|
export {
|
|
7
10
|
BREADCRUMB_DATA_TESTID,
|
|
8
11
|
BREADCRUMB_SLOTS,
|
|
9
|
-
|
|
12
|
+
DSBreadcrumb,
|
|
13
|
+
DSBreadcrumbItem,
|
|
14
|
+
DSBreadcrumbItemWithSchema,
|
|
15
|
+
DSBreadcrumbName,
|
|
16
|
+
DSBreadcrumbWithSchema,
|
|
17
|
+
defaultItemProps,
|
|
18
|
+
defaultProps,
|
|
19
|
+
htmlElements
|
|
10
20
|
};
|
|
11
21
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSBreadcrumb, DSBreadcrumbWithSchema, htmlElements } from './DSBreadcrumb.js';\nexport { DSBreadcrumbItem, DSBreadcrumbItemWithSchema } from './DSBreadcrumbItem.js';\nexport {\n defaultProps,\n defaultItemProps,\n type DSBreadcrumbT,\n type DSBreadcrumbItemT,\n type SafeComponentsT,\n type SafeItemComponentT,\n} from './react-desc-prop-types.js';\nexport { DSBreadcrumbName, BREADCRUMB_SLOTS, BREADCRUMB_DATA_TESTID } from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc,wBAAwB,oBAAoB;AACnE,SAAS,kBAAkB,kCAAkC;AAC7D;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AACP,SAAS,kBAAkB,kBAAkB,8BAA8B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PropTypes, getPropsPerSlotPropTypes, globalAttributesPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
import { DSBreadcrumbName, BREADCRUMB_ITEM_SLOTS, BREADCRUMB_TRAIL_SLOTS } from "./constants/index.js";
|
|
2
4
|
const defaultProps = {
|
|
3
5
|
containerProps: {},
|
|
4
6
|
as: "nav",
|
|
@@ -14,7 +16,68 @@ const defaultItemProps = {
|
|
|
14
16
|
label: "",
|
|
15
17
|
childIndex: -1
|
|
16
18
|
};
|
|
19
|
+
const DSBreadcrumbPropTypes = {
|
|
20
|
+
...getPropsPerSlotPropTypes(DSBreadcrumbName, BREADCRUMB_TRAIL_SLOTS),
|
|
21
|
+
...globalAttributesPropTypes,
|
|
22
|
+
/** props injected to breadcrumb wrapper */
|
|
23
|
+
containerProps: PropTypes.object.description("props injected to breadcrumb wrapper"),
|
|
24
|
+
/**
|
|
25
|
+
* Type of element you want the main container to be:
|
|
26
|
+
* 'nav', 'div'
|
|
27
|
+
*/
|
|
28
|
+
as: PropTypes.oneOf(["nav", "div"]).description("Type of element you want the main container to be: 'nav' or 'div'. Defaults to 'nav'.").defaultValue("nav"),
|
|
29
|
+
/**
|
|
30
|
+
* Whether to show the last element of the breadcrumb as a title
|
|
31
|
+
* Also removes trailing slash to show last element as title
|
|
32
|
+
*/
|
|
33
|
+
isTitle: PropTypes.bool.description(
|
|
34
|
+
"Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title"
|
|
35
|
+
),
|
|
36
|
+
/** breadcrumb label */
|
|
37
|
+
label: PropTypes.string.description("breadcrumb label"),
|
|
38
|
+
/**
|
|
39
|
+
* Container items to wrap
|
|
40
|
+
*/
|
|
41
|
+
trailingSlash: PropTypes.bool.description("Whether to show trailing slash on all items except the last one").defaultValue(true),
|
|
42
|
+
children: PropTypes.arrayOf(PropTypes.element).isRequired.description("Container items to wrap")
|
|
43
|
+
};
|
|
44
|
+
const itemGlobalAttributesPropTypes = {
|
|
45
|
+
...globalAttributesPropTypes,
|
|
46
|
+
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).hidden()
|
|
47
|
+
};
|
|
48
|
+
const DSBreadcrumbItemPropTypes = {
|
|
49
|
+
...getPropsPerSlotPropTypes(DSBreadcrumbName, BREADCRUMB_ITEM_SLOTS),
|
|
50
|
+
...itemGlobalAttributesPropTypes,
|
|
51
|
+
/**
|
|
52
|
+
* Type of element you want the item to be:
|
|
53
|
+
* 'a', 'button'
|
|
54
|
+
*/
|
|
55
|
+
as: PropTypes.oneOf(["a", "button"]).description('Type of element you want the item to be: "a" or "button". Defaults to "a"').defaultValue("a"),
|
|
56
|
+
/** active item */
|
|
57
|
+
active: PropTypes.bool.description("Active item"),
|
|
58
|
+
/** href link */
|
|
59
|
+
href: PropTypes.string.description("Href link"),
|
|
60
|
+
/** on click handler */
|
|
61
|
+
onClick: PropTypes.func.description("On click handler"),
|
|
62
|
+
/** style item as title */
|
|
63
|
+
isTitle: PropTypes.bool.description("Style item as title"),
|
|
64
|
+
/** add trailing slash */
|
|
65
|
+
trailingSlash: PropTypes.bool.description("Add trailing slash"),
|
|
66
|
+
/** item label */
|
|
67
|
+
label: PropTypes.string.description("Item label"),
|
|
68
|
+
/** link color */
|
|
69
|
+
color: PropTypes.string.description("Link color"),
|
|
70
|
+
// injected by DSBreadcrumb into each of its items, not meant to be set by consumers
|
|
71
|
+
childIndex: PropTypes.number.hidden(),
|
|
72
|
+
addRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).hidden()
|
|
73
|
+
};
|
|
74
|
+
const DSBreadcrumbPropTypesSchema = DSBreadcrumbPropTypes;
|
|
75
|
+
const DSBreadcrumbItemPropTypesSchema = DSBreadcrumbItemPropTypes;
|
|
17
76
|
export {
|
|
77
|
+
DSBreadcrumbItemPropTypes,
|
|
78
|
+
DSBreadcrumbItemPropTypesSchema,
|
|
79
|
+
DSBreadcrumbPropTypes,
|
|
80
|
+
DSBreadcrumbPropTypesSchema,
|
|
18
81
|
defaultItemProps,
|
|
19
82
|
defaultProps
|
|
20
83
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport type React from 'react';\nimport type { htmlElements } from './DSBreadcrumb.js';\ntype SafeComponentsT = (typeof htmlElements)[number];\n\ntype SafeItemComponentT = 'a' | 'button' | 'span';\n\nexport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport { PropTypes, getPropsPerSlotPropTypes, globalAttributesPropTypes } from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type React from 'react';\nimport type { htmlElements } from './DSBreadcrumb.js';\nimport { DSBreadcrumbName, BREADCRUMB_ITEM_SLOTS, BREADCRUMB_TRAIL_SLOTS } from './constants/index.js';\n\ntype SafeComponentsT = (typeof htmlElements)[number];\n\ntype SafeItemComponentT = 'a' | 'button' | 'span';\n\nexport declare namespace DSBreadcrumbT {\n export type SlotFunctionArguments = {\n dsBreadcrumbContainer: () => object;\n dsBreadcrumbList: () => object;\n };\n\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n as: SafeComponentsT;\n label: string;\n isTitle: boolean;\n trailingSlash: boolean;\n }\n\n export interface RequiredProps {\n children: React.ReactElement[];\n }\n\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSBreadcrumbName,\n typeof BREADCRUMB_TRAIL_SLOTS\n > {}\n\n export interface Props\n extends\n Partial<DefaultProps>,\n RequiredProps,\n OptionalProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof OptionalProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n RequiredProps,\n OptionalProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof OptionalProps>,\n XstyledProps {}\n}\n\nexport declare namespace DSBreadcrumbItemT {\n export type SlotFunctionArguments = {\n dsBreadcrumbCrumbWrapper: () => object;\n dsBreadcrumbLink: () => object;\n };\n\n export interface DefaultProps {\n active: boolean;\n as: SafeItemComponentT;\n onKeyDown: (e: React.KeyboardEvent, componentRefIndex: number, onClick: (e: React.MouseEvent) => void) => void;\n onClick: (e: React.MouseEvent) => void;\n label: string;\n childIndex: number;\n }\n\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSBreadcrumbName,\n typeof BREADCRUMB_ITEM_SLOTS\n > {\n addRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;\n href?: string;\n isTitle?: boolean;\n trailingSlash?: boolean;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof OptionalProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof OptionalProps>,\n XstyledProps {}\n}\n\nexport const defaultProps: DSBreadcrumbT.DefaultProps = {\n containerProps: {},\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n};\n\nexport const defaultItemProps: DSBreadcrumbItemT.DefaultProps = {\n active: false,\n as: 'a',\n onKeyDown: () => null,\n onClick: () => null,\n label: '',\n childIndex: -1,\n};\n\n// xstyled props stay typed on Props for backward compatibility, but they are left out of the documented schema:\n// they never reach the CSS of DSBreadcrumb and only partially reach the link of DSBreadcrumbItem\n// (see KNOWN_INTENTIONAL_DEVIATIONS.md)\nexport const DSBreadcrumbPropTypes: DSPropTypesSchema<Omit<DSBreadcrumbT.Props, keyof XstyledProps>> = {\n ...getPropsPerSlotPropTypes(DSBreadcrumbName, BREADCRUMB_TRAIL_SLOTS),\n ...globalAttributesPropTypes,\n /** props injected to breadcrumb wrapper */\n containerProps: PropTypes.object.description('props injected to breadcrumb wrapper'),\n /**\n * Type of element you want the main container to be:\n * 'nav', 'div'\n */\n as: PropTypes.oneOf(['nav', 'div'])\n .description(\"Type of element you want the main container to be: 'nav' or 'div'. Defaults to 'nav'.\")\n .defaultValue('nav'),\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 trailingSlash: PropTypes.bool\n .description('Whether to show trailing slash on all items except the last one')\n .defaultValue(true),\n children: PropTypes.arrayOf(PropTypes.element).isRequired.description('Container items to wrap'),\n};\n\n// a consumer innerRef replaces the addRef DSBreadcrumb relies on for arrow key navigation,\n// so the item schema keeps it hidden (see KNOWN_INTENTIONAL_DEVIATIONS.md)\nconst itemGlobalAttributesPropTypes = {\n ...globalAttributesPropTypes,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).hidden(),\n};\n\nexport const DSBreadcrumbItemPropTypes: DSPropTypesSchema<Omit<DSBreadcrumbItemT.Props, keyof XstyledProps>> = {\n ...getPropsPerSlotPropTypes(DSBreadcrumbName, BREADCRUMB_ITEM_SLOTS),\n ...itemGlobalAttributesPropTypes,\n /**\n * Type of element you want the item to be:\n * 'a', 'button'\n */\n as: PropTypes.oneOf(['a', 'button'])\n .description('Type of element you want the item to be: \"a\" or \"button\". Defaults to \"a\"')\n .defaultValue('a'),\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 // injected by DSBreadcrumb into each of its items, not meant to be set by consumers\n childIndex: PropTypes.number.hidden(),\n addRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).hidden(),\n};\n\nexport const DSBreadcrumbPropTypesSchema = DSBreadcrumbPropTypes as unknown as ValidationMap<DSBreadcrumbT.Props>;\nexport const DSBreadcrumbItemPropTypesSchema =\n DSBreadcrumbItemPropTypes as unknown as ValidationMap<DSBreadcrumbItemT.Props>;\n\nexport type { SafeComponentsT, SafeItemComponentT };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,WAAW,0BAA0B,iCAAiC;AAI/E,SAAS,kBAAkB,uBAAuB,8BAA8B;AAsFzE,MAAM,eAA2C;AAAA,EACtD,gBAAgB,CAAC;AAAA,EACjB,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AACjB;AAEO,MAAM,mBAAmD;AAAA,EAC9D,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,WAAW,MAAM;AAAA,EACjB,SAAS,MAAM;AAAA,EACf,OAAO;AAAA,EACP,YAAY;AACd;AAKO,MAAM,wBAA0F;AAAA,EACrG,GAAG,yBAAyB,kBAAkB,sBAAsB;AAAA,EACpE,GAAG;AAAA;AAAA,EAEH,gBAAgB,UAAU,OAAO,YAAY,sCAAsC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnF,IAAI,UAAU,MAAM,CAAC,OAAO,KAAK,CAAC,EAC/B,YAAY,uFAAuF,EACnG,aAAa,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrB,SAAS,UAAU,KAAK;AAAA,IACtB;AAAA,EACF;AAAA;AAAA,EAEA,OAAO,UAAU,OAAO,YAAY,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAItD,eAAe,UAAU,KACtB,YAAY,iEAAiE,EAC7E,aAAa,IAAI;AAAA,EACpB,UAAU,UAAU,QAAQ,UAAU,OAAO,EAAE,WAAW,YAAY,yBAAyB;AACjG;AAIA,MAAM,gCAAgC;AAAA,EACpC,GAAG;AAAA,EACH,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,OAAO;AAC3E;AAEO,MAAM,4BAAkG;AAAA,EAC7G,GAAG,yBAAyB,kBAAkB,qBAAqB;AAAA,EACnE,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,EAKH,IAAI,UAAU,MAAM,CAAC,KAAK,QAAQ,CAAC,EAChC,YAAY,2EAA2E,EACvF,aAAa,GAAG;AAAA;AAAA,EAEnB,QAAQ,UAAU,KAAK,YAAY,aAAa;AAAA;AAAA,EAEhD,MAAM,UAAU,OAAO,YAAY,WAAW;AAAA;AAAA,EAE9C,SAAS,UAAU,KAAK,YAAY,kBAAkB;AAAA;AAAA,EAEtD,SAAS,UAAU,KAAK,YAAY,qBAAqB;AAAA;AAAA,EAEzD,eAAe,UAAU,KAAK,YAAY,oBAAoB;AAAA;AAAA,EAE9D,OAAO,UAAU,OAAO,YAAY,YAAY;AAAA;AAAA,EAEhD,OAAO,UAAU,OAAO,YAAY,YAAY;AAAA;AAAA,EAEhD,YAAY,UAAU,OAAO,OAAO;AAAA,EACpC,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,OAAO;AACzE;AAEO,MAAM,8BAA8B;AACpC,MAAM,kCACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const TrailSlotPropsAsObject = {
|
|
3
|
+
dsBreadcrumbContainer: { "aria-label": "just a typescript test" },
|
|
4
|
+
dsBreadcrumbList: { "aria-label": "just a typescript test" }
|
|
5
|
+
};
|
|
6
|
+
const TrailSlotPropsAsFunctions = {
|
|
7
|
+
dsBreadcrumbContainer: () => ({ "aria-label": "just a typescript test" }),
|
|
8
|
+
dsBreadcrumbList: () => ({ "aria-label": "just a typescript test" })
|
|
9
|
+
};
|
|
10
|
+
const TrailSlotFunctionsAreValidProps = TrailSlotPropsAsFunctions;
|
|
11
|
+
const EnsureAllTrailSlotsExistInSlotFunctionArguments = TrailSlotPropsAsFunctions;
|
|
12
|
+
const ItemSlotPropsAsObject = {
|
|
13
|
+
dsBreadcrumbCrumbWrapper: { "aria-label": "just a typescript test" },
|
|
14
|
+
dsBreadcrumbLink: { "aria-label": "just a typescript test" }
|
|
15
|
+
};
|
|
16
|
+
const ItemSlotPropsAsFunctions = {
|
|
17
|
+
dsBreadcrumbCrumbWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
18
|
+
dsBreadcrumbLink: () => ({ "aria-label": "just a typescript test" })
|
|
19
|
+
};
|
|
20
|
+
const ItemSlotFunctionsAreValidProps = ItemSlotPropsAsFunctions;
|
|
21
|
+
const EnsureAllItemSlotsExistInSlotFunctionArguments = ItemSlotPropsAsFunctions;
|
|
22
|
+
const EnsureAllSlotsExistInSlotFunctionArguments = { ...TrailSlotPropsAsFunctions, ...ItemSlotPropsAsFunctions };
|
|
23
|
+
//# sourceMappingURL=slot-props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/slot-props.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type {\n DSBreadcrumbName,\n BREADCRUMB_SLOTS,\n BREADCRUMB_TRAIL_SLOTS,\n BREADCRUMB_ITEM_SLOTS,\n} from '../constants/index.js';\nimport type { DSBreadcrumbT, DSBreadcrumbItemT } from '../react-desc-prop-types.js';\n\n// DSBreadcrumb renders the trail slots\nconst TrailSlotPropsAsObject: Partial<DSBreadcrumbT.Props> = {\n dsBreadcrumbContainer: { 'aria-label': 'just a typescript test' },\n dsBreadcrumbList: { 'aria-label': 'just a typescript test' },\n};\n\nconst TrailSlotPropsAsFunctions: DSBreadcrumbT.SlotFunctionArguments = {\n dsBreadcrumbContainer: () => ({ 'aria-label': 'just a typescript test' }),\n dsBreadcrumbList: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// The function form must also be accepted by the public Props, slot by slot\nconst TrailSlotFunctionsAreValidProps: Partial<DSBreadcrumbT.Props> = TrailSlotPropsAsFunctions;\n\n// Exhaustiveness check \u2014 fails compilation if a trail slot is missing from SlotFunctionArguments\nconst EnsureAllTrailSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSBreadcrumbName, typeof BREADCRUMB_TRAIL_SLOTS>\n> = TrailSlotPropsAsFunctions;\n\n// DSBreadcrumbItem renders the item slots\nconst ItemSlotPropsAsObject: Partial<DSBreadcrumbItemT.Props> = {\n dsBreadcrumbCrumbWrapper: { 'aria-label': 'just a typescript test' },\n dsBreadcrumbLink: { 'aria-label': 'just a typescript test' },\n};\n\nconst ItemSlotPropsAsFunctions: DSBreadcrumbItemT.SlotFunctionArguments = {\n dsBreadcrumbCrumbWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsBreadcrumbLink: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// The function form must also be accepted by the public Props, slot by slot\nconst ItemSlotFunctionsAreValidProps: Partial<DSBreadcrumbItemT.Props> = ItemSlotPropsAsFunctions;\n\n// Exhaustiveness check \u2014 fails compilation if an item slot is missing from SlotFunctionArguments\nconst EnsureAllItemSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSBreadcrumbName, typeof BREADCRUMB_ITEM_SLOTS>\n> = ItemSlotPropsAsFunctions;\n\n// Exhaustiveness check across both components \u2014 fails compilation if a slot of BREADCRUMB_SLOTS is rendered by neither\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSBreadcrumbName, typeof BREADCRUMB_SLOTS>\n> = { ...TrailSlotPropsAsFunctions, ...ItemSlotPropsAsFunctions };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACWvB,MAAM,yBAAuD;AAAA,EAC3D,uBAAuB,EAAE,cAAc,yBAAyB;AAAA,EAChE,kBAAkB,EAAE,cAAc,yBAAyB;AAC7D;AAEA,MAAM,4BAAiE;AAAA,EACrE,uBAAuB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACvE,kBAAkB,OAAO,EAAE,cAAc,yBAAyB;AACpE;AAGA,MAAM,kCAAgE;AAGtE,MAAM,kDAEF;AAGJ,MAAM,wBAA0D;AAAA,EAC9D,0BAA0B,EAAE,cAAc,yBAAyB;AAAA,EACnE,kBAAkB,EAAE,cAAc,yBAAyB;AAC7D;AAEA,MAAM,2BAAoE;AAAA,EACxE,0BAA0B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC1E,kBAAkB,OAAO,EAAE,cAAc,yBAAyB;AACpE;AAGA,MAAM,iCAAmE;AAGzE,MAAM,iDAEF;AAGJ,MAAM,6CAEF,EAAE,GAAG,2BAA2B,GAAG,yBAAyB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -54,6 +54,24 @@ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
|
54
54
|
/* @__PURE__ */ jsxs(DSBreadcrumb, { as: "nav", label: "Breadcrumb", isTitle: false, trailingSlash: true, containerProps: {}, children: [
|
|
55
55
|
/* @__PURE__ */ jsx(DSBreadcrumbItem, { href: "/", label: "Home" }),
|
|
56
56
|
/* @__PURE__ */ jsx(DSBreadcrumbItem, { href: "/home", label: "Home2" })
|
|
57
|
-
] })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
DSBreadcrumb,
|
|
60
|
+
{
|
|
61
|
+
dsBreadcrumbContainer: { "aria-label": "Loan navigation" },
|
|
62
|
+
dsBreadcrumbList: () => ({ "data-custom": "list" }),
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
DSBreadcrumbItem,
|
|
66
|
+
{
|
|
67
|
+
label: "Home",
|
|
68
|
+
dsBreadcrumbCrumbWrapper: { "data-custom": "crumb" },
|
|
69
|
+
dsBreadcrumbLink: () => ({ "aria-label": "Home page" })
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(DSBreadcrumb.Item, { label: "Loans", dsBreadcrumbLink: { "aria-label": "Loans page" } })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
)
|
|
58
76
|
] });
|
|
59
77
|
//# sourceMappingURL=typescript-breadcrumb-valid.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-breadcrumb-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBreadcrumb, DSBreadcrumbItem } from '../index.js';\nimport type { DSBreadcrumbT, DSBreadcrumbItemT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBreadcrumbT.Props;\ntype ComponentPropsInternals = DSBreadcrumbT.InternalProps;\ntype ComponentPropsDefaultProps = DSBreadcrumbT.DefaultProps;\ntype ComponentPropsRequiredProps = DSBreadcrumbT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n children: [],\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n containerProps: {},\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n children: [],\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n containerProps: {},\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n children: [],\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n containerProps: {},\n} as ComponentPropsForApp;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSBreadcrumb {...testExplicitDefinition} />\n <DSBreadcrumb {...testInferedTypeCompatibility} />\n {/* works with inline values */}\n <DSBreadcrumb as=\"nav\" label=\"Breadcrumb\" isTitle={false} trailingSlash containerProps={{}}>\n <DSBreadcrumbItem href=\"/\" label=\"Home\" />\n <DSBreadcrumbItem href=\"/home\" label=\"Home2\" />\n </DSBreadcrumb>\n </>\n);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACoErB,mBAEE,KAGA,YALF;AAnEF,SAAS,cAAc,wBAAwB;AAS/C,MAAM,oBAAiD;AAAA,EACrD,UAAU,CAAC;AACb;AAIA,MAAM,sBAA2D;AAAA,EAC/D,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AACX;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,gBAAgB,CAAC;AACnB;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,UAAU,CAAC;AAAA,EACX,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,gBAAgB,CAAC;AACnB;AAGA,MAAM,+BAA+B;AAAA,EACnC,UAAU,CAAC;AAAA,EACX,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,gBAAgB,CAAC;AACnB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,gBAAc,GAAG,wBAAwB;AAAA,EAC1C,oBAAC,gBAAc,GAAG,8BAA8B;AAAA,EAEhD,qBAAC,gBAAa,IAAG,OAAM,OAAM,cAAa,SAAS,OAAO,eAAa,MAAC,gBAAgB,CAAC,GACvF;AAAA,wBAAC,oBAAiB,MAAK,KAAI,OAAM,QAAO;AAAA,IACxC,oBAAC,oBAAiB,MAAK,SAAQ,OAAM,SAAQ;AAAA,KAC/C;AAAA,GACF;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBreadcrumb, DSBreadcrumbItem } from '../index.js';\nimport type { DSBreadcrumbT, DSBreadcrumbItemT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBreadcrumbT.Props;\ntype ComponentPropsInternals = DSBreadcrumbT.InternalProps;\ntype ComponentPropsDefaultProps = DSBreadcrumbT.DefaultProps;\ntype ComponentPropsRequiredProps = DSBreadcrumbT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n children: [],\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n containerProps: {},\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n children: [],\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n containerProps: {},\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n children: [],\n as: 'nav',\n label: 'Breadcrumb',\n isTitle: false,\n trailingSlash: true,\n containerProps: {},\n} as ComponentPropsForApp;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSBreadcrumb {...testExplicitDefinition} />\n <DSBreadcrumb {...testInferedTypeCompatibility} />\n {/* works with inline values */}\n <DSBreadcrumb as=\"nav\" label=\"Breadcrumb\" isTitle={false} trailingSlash containerProps={{}}>\n <DSBreadcrumbItem href=\"/\" label=\"Home\" />\n <DSBreadcrumbItem href=\"/home\" label=\"Home2\" />\n </DSBreadcrumb>\n {/* works with slot props, object and function forms: trail slots on DSBreadcrumb, item slots on each item */}\n <DSBreadcrumb\n dsBreadcrumbContainer={{ 'aria-label': 'Loan navigation' }}\n dsBreadcrumbList={() => ({ 'data-custom': 'list' })}\n >\n <DSBreadcrumbItem\n label=\"Home\"\n dsBreadcrumbCrumbWrapper={{ 'data-custom': 'crumb' }}\n dsBreadcrumbLink={() => ({ 'aria-label': 'Home page' })}\n />\n <DSBreadcrumb.Item label=\"Loans\" dsBreadcrumbLink={{ 'aria-label': 'Loans page' }} />\n </DSBreadcrumb>\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoErB,mBAEE,KAGA,YALF;AAnEF,SAAS,cAAc,wBAAwB;AAS/C,MAAM,oBAAiD;AAAA,EACrD,UAAU,CAAC;AACb;AAIA,MAAM,sBAA2D;AAAA,EAC/D,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AACX;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,gBAAgB,CAAC;AACnB;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,UAAU,CAAC;AAAA,EACX,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,gBAAgB,CAAC;AACnB;AAGA,MAAM,+BAA+B;AAAA,EACnC,UAAU,CAAC;AAAA,EACX,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,gBAAgB,CAAC;AACnB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,gBAAc,GAAG,wBAAwB;AAAA,EAC1C,oBAAC,gBAAc,GAAG,8BAA8B;AAAA,EAEhD,qBAAC,gBAAa,IAAG,OAAM,OAAM,cAAa,SAAS,OAAO,eAAa,MAAC,gBAAgB,CAAC,GACvF;AAAA,wBAAC,oBAAiB,MAAK,KAAI,OAAM,QAAO;AAAA,IACxC,oBAAC,oBAAiB,MAAK,SAAQ,OAAM,SAAQ;AAAA,KAC/C;AAAA,EAEA;AAAA,IAAC;AAAA;AAAA,MACC,uBAAuB,EAAE,cAAc,kBAAkB;AAAA,MACzD,kBAAkB,OAAO,EAAE,eAAe,OAAO;AAAA,MAEjD;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,0BAA0B,EAAE,eAAe,QAAQ;AAAA,YACnD,kBAAkB,OAAO,EAAE,cAAc,YAAY;AAAA;AAAA,QACvD;AAAA,QACA,oBAAC,aAAa,MAAb,EAAkB,OAAM,SAAQ,kBAAkB,EAAE,cAAc,aAAa,GAAG;AAAA;AAAA;AAAA,EACrF;AAAA,GACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,6 +5,14 @@ export declare const BREADCRUMB_SLOTS: {
|
|
|
5
5
|
readonly LINK: "link";
|
|
6
6
|
readonly LIST: "list";
|
|
7
7
|
};
|
|
8
|
+
export declare const BREADCRUMB_TRAIL_SLOTS: {
|
|
9
|
+
readonly CONTAINER: "container";
|
|
10
|
+
readonly LIST: "list";
|
|
11
|
+
};
|
|
12
|
+
export declare const BREADCRUMB_ITEM_SLOTS: {
|
|
13
|
+
readonly CRUMBWRAPPER: "crumb-wrapper";
|
|
14
|
+
readonly LINK: "link";
|
|
15
|
+
};
|
|
8
16
|
export declare const BREADCRUMB_DATA_TESTID: {
|
|
9
17
|
readonly CONTAINER: "ds-breadcrumb-container";
|
|
10
18
|
readonly CRUMBWRAPPER: "ds-breadcrumb-crumb-wrapper";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { DSBreadcrumb, DSBreadcrumbWithSchema, htmlElements } from './DSBreadcrumb.js';
|
|
2
|
+
export { DSBreadcrumbItem, DSBreadcrumbItemWithSchema } from './DSBreadcrumbItem.js';
|
|
3
|
+
export { defaultProps, defaultItemProps, type DSBreadcrumbT, type DSBreadcrumbItemT, type SafeComponentsT, type SafeItemComponentT, } from './react-desc-prop-types.js';
|
|
4
4
|
export { DSBreadcrumbName, BREADCRUMB_SLOTS, BREADCRUMB_DATA_TESTID } from './constants/index.js';
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';
|
|
1
|
+
import type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';
|
|
2
|
+
import { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';
|
|
2
3
|
import type React from 'react';
|
|
3
4
|
import type { htmlElements } from './DSBreadcrumb.js';
|
|
5
|
+
import { DSBreadcrumbName, BREADCRUMB_ITEM_SLOTS, BREADCRUMB_TRAIL_SLOTS } from './constants/index.js';
|
|
4
6
|
type SafeComponentsT = (typeof htmlElements)[number];
|
|
5
7
|
type SafeItemComponentT = 'a' | 'button' | 'span';
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export declare namespace DSBreadcrumbT {
|
|
9
|
+
type SlotFunctionArguments = {
|
|
10
|
+
dsBreadcrumbContainer: () => object;
|
|
11
|
+
dsBreadcrumbList: () => object;
|
|
12
|
+
};
|
|
9
13
|
interface DefaultProps {
|
|
10
14
|
containerProps: Record<string, unknown>;
|
|
11
15
|
as: SafeComponentsT;
|
|
@@ -16,12 +20,18 @@ declare namespace DSBreadcrumbT {
|
|
|
16
20
|
interface RequiredProps {
|
|
17
21
|
children: React.ReactElement[];
|
|
18
22
|
}
|
|
19
|
-
interface
|
|
23
|
+
interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSBreadcrumbName, typeof BREADCRUMB_TRAIL_SLOTS> {
|
|
24
|
+
}
|
|
25
|
+
interface Props extends Partial<DefaultProps>, RequiredProps, OptionalProps, Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof OptionalProps>, XstyledProps {
|
|
20
26
|
}
|
|
21
|
-
interface InternalProps extends DefaultProps, RequiredProps, Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps>, XstyledProps {
|
|
27
|
+
interface InternalProps extends DefaultProps, RequiredProps, OptionalProps, Omit<GlobalAttributesT, keyof DefaultProps | keyof RequiredProps | keyof OptionalProps>, XstyledProps {
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
|
-
declare namespace DSBreadcrumbItemT {
|
|
30
|
+
export declare namespace DSBreadcrumbItemT {
|
|
31
|
+
type SlotFunctionArguments = {
|
|
32
|
+
dsBreadcrumbCrumbWrapper: () => object;
|
|
33
|
+
dsBreadcrumbLink: () => object;
|
|
34
|
+
};
|
|
25
35
|
interface DefaultProps {
|
|
26
36
|
active: boolean;
|
|
27
37
|
as: SafeItemComponentT;
|
|
@@ -30,7 +40,7 @@ declare namespace DSBreadcrumbItemT {
|
|
|
30
40
|
label: string;
|
|
31
41
|
childIndex: number;
|
|
32
42
|
}
|
|
33
|
-
interface OptionalProps {
|
|
43
|
+
interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSBreadcrumbName, typeof BREADCRUMB_ITEM_SLOTS> {
|
|
34
44
|
addRef?: React.MutableRefObject<HTMLDivElement | null> | React.RefCallback<HTMLDivElement>;
|
|
35
45
|
href?: string;
|
|
36
46
|
isTitle?: boolean;
|
|
@@ -41,4 +51,10 @@ declare namespace DSBreadcrumbItemT {
|
|
|
41
51
|
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT, keyof DefaultProps | keyof OptionalProps>, XstyledProps {
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
|
-
export
|
|
54
|
+
export declare const defaultProps: DSBreadcrumbT.DefaultProps;
|
|
55
|
+
export declare const defaultItemProps: DSBreadcrumbItemT.DefaultProps;
|
|
56
|
+
export declare const DSBreadcrumbPropTypes: DSPropTypesSchema<Omit<DSBreadcrumbT.Props, keyof XstyledProps>>;
|
|
57
|
+
export declare const DSBreadcrumbItemPropTypes: DSPropTypesSchema<Omit<DSBreadcrumbItemT.Props, keyof XstyledProps>>;
|
|
58
|
+
export declare const DSBreadcrumbPropTypesSchema: ValidationMap<DSBreadcrumbT.Props>;
|
|
59
|
+
export declare const DSBreadcrumbItemPropTypesSchema: ValidationMap<DSBreadcrumbItemT.Props>;
|
|
60
|
+
export type { SafeComponentsT, SafeItemComponentT };
|