@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/cjs/DSBreadcrumb.js
CHANGED
|
@@ -43,67 +43,55 @@ var import_useKeyboardNavigation = require("./hooks/useKeyboardNavigation.js");
|
|
|
43
43
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
44
44
|
var import_styles = require("./styles.js");
|
|
45
45
|
const htmlElements = ["nav", "div"];
|
|
46
|
-
const NavContainer = (
|
|
47
|
-
const { label, containerProps, as, children, ...rest } =
|
|
46
|
+
const NavContainer = (props) => {
|
|
47
|
+
const { label, containerProps, as, children, ownerPropsConfig, ...rest } = props;
|
|
48
48
|
return (
|
|
49
49
|
// @ts-expect-error - styled components are not correctly supporting the alias in typescript
|
|
50
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { "aria-label": label, ...rest, ...containerProps, as, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledList, { children }) })
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { "aria-label": label, ...rest, ...containerProps, as, ...ownerPropsConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledList, { ...ownerPropsConfig, children }) })
|
|
51
51
|
);
|
|
52
52
|
};
|
|
53
|
-
const DivContainer = (
|
|
54
|
-
const { label, containerProps, as, children, ...rest } =
|
|
53
|
+
const DivContainer = (props) => {
|
|
54
|
+
const { label, containerProps, as, children, ownerPropsConfig, ...rest } = props;
|
|
55
55
|
return (
|
|
56
56
|
// @ts-expect-error - styled components are not correctly supporting the alias in typescript
|
|
57
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { ...rest, ...containerProps, as, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledList, { "aria-label": label, children }) })
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { ...rest, ...containerProps, as, ...ownerPropsConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledList, { "aria-label": label, ...ownerPropsConfig, children }) })
|
|
58
58
|
);
|
|
59
59
|
};
|
|
60
|
-
const DSBreadcrumb = (
|
|
61
|
-
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
60
|
+
const DSBreadcrumb = (props) => {
|
|
61
|
+
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
62
62
|
const { containerProps, as, label, trailingSlash, isTitle, children, ...rest } = propsWithDefaults;
|
|
63
63
|
const [addRef, onKeyDown] = (0, import_useKeyboardNavigation.useKeyboardNavigation)({ isTitle });
|
|
64
|
+
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefaults);
|
|
64
65
|
const safeElement = (0, import_react.useMemo)(() => htmlElements.indexOf(as) > -1 ? as : "nav", [as]);
|
|
65
66
|
const Container = as === "nav" ? NavContainer : DivContainer;
|
|
66
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
Container,
|
|
69
|
+
{
|
|
70
|
+
label,
|
|
71
|
+
...rest,
|
|
72
|
+
containerProps,
|
|
73
|
+
as: safeElement,
|
|
74
|
+
ownerPropsConfig,
|
|
75
|
+
children: import_react.default.Children.map(
|
|
76
|
+
children,
|
|
77
|
+
(child, childIndex) => childIndex < children.length - 1 ? (0, import_react.cloneElement)(child, {
|
|
78
|
+
childIndex,
|
|
79
|
+
addRef,
|
|
80
|
+
onKeyDown
|
|
81
|
+
}) : (0, import_react.cloneElement)(child, {
|
|
82
|
+
childIndex,
|
|
83
|
+
addRef,
|
|
84
|
+
onKeyDown,
|
|
85
|
+
trailingSlash,
|
|
86
|
+
isTitle
|
|
87
|
+
})
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
);
|
|
80
91
|
};
|
|
81
92
|
DSBreadcrumb.Item = import_DSBreadcrumbItem.default;
|
|
82
|
-
const props = {
|
|
83
|
-
/** props injected to breadcrumb wrapper */
|
|
84
|
-
containerProps: import_ds_props_helpers.PropTypes.object.description("props injected to breadcrumb wrapper"),
|
|
85
|
-
/**
|
|
86
|
-
* Type of element you want the main container to be:
|
|
87
|
-
* 'nav', 'div'
|
|
88
|
-
*/
|
|
89
|
-
as: import_ds_props_helpers.PropTypes.oneOf(["nav", "div"]).description("Type of element you want the main container to be: 'nav' or 'div'. Defaults to 'nav'.").defaultValue("nav"),
|
|
90
|
-
/**
|
|
91
|
-
* Whether to show the last element of the breadcrumb as a title
|
|
92
|
-
* Also removes trailing slash to show last element as title
|
|
93
|
-
*/
|
|
94
|
-
isTitle: import_ds_props_helpers.PropTypes.bool.description(
|
|
95
|
-
"Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title"
|
|
96
|
-
),
|
|
97
|
-
/** breadcrumb label */
|
|
98
|
-
label: import_ds_props_helpers.PropTypes.string.description("breadcrumb label"),
|
|
99
|
-
/**
|
|
100
|
-
* Container items to wrap
|
|
101
|
-
*/
|
|
102
|
-
trailingSlash: import_ds_props_helpers.PropTypes.bool.description("Whether to show trailing slash on all items except the last one").defaultValue(true),
|
|
103
|
-
children: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.element).isRequired.description("Container items to wrap")
|
|
104
|
-
};
|
|
105
93
|
DSBreadcrumb.displayName = "DSBreadcrumb";
|
|
106
94
|
const DSBreadcrumbWithSchema = (0, import_ds_props_helpers.describe)(DSBreadcrumb);
|
|
107
|
-
DSBreadcrumbWithSchema.propTypes =
|
|
95
|
+
DSBreadcrumbWithSchema.propTypes = import_react_desc_prop_types.DSBreadcrumbPropTypesSchema;
|
|
108
96
|
var DSBreadcrumb_default = DSBreadcrumb;
|
|
109
97
|
//# sourceMappingURL=DSBreadcrumb.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSBreadcrumb.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBjB;AAnBN,8BAAsE;AACtE,mBAA6C;AAC7C,8BAA6B;AAC7B,mCAAsC;AAEtC,mCAA0D;AAC1D,oBAA4C;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,4CAAC,iCAAgB,cAAY,OAAQ,GAAG,MAAO,GAAG,gBAAgB,IAAS,GAAG,kBAC5E,sDAAC,4BAAY,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,4CAAC,iCAAiB,GAAG,MAAO,GAAG,gBAAgB,IAAS,GAAG,kBACzD,sDAAC,4BAAW,cAAY,OAAQ,GAAG,kBAChC,UACH,GACF;AAAA;AAEJ;AAEA,MAAM,eAAe,CAAC,UAA+B;AACnD,QAAM,wBAAoB,sDAA0D,OAAO,yCAAY;AACvG,QAAM,EAAE,gBAAgB,IAAI,OAAO,eAAe,SAAS,UAAU,GAAG,KAAK,IAAI;AACjF,QAAM,CAAC,QAAQ,SAAS,QAAI,oDAAsB,EAAE,QAAQ,CAAC;AAC7D,QAAM,uBAAmB,uCAAc,iBAAiB;AAExD,QAAM,kBAAc,sBAAQ,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,uBAAAA,QAAM,SAAS;AAAA,QAAI;AAAA,QAAU,CAAC,OAA2B,eACxD,aAAa,SAAS,SAAS,QAC3B,2BAAa,OAAO;AAAA,UAClB;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC,QACD,2BAAa,OAAO;AAAA,UAClB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACP;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,OAAO,wBAAAC;AAEpB,aAAa,cAAc;AAC3B,MAAM,6BAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;AAGnC,IAAO,uBAAQ;",
|
|
6
|
+
"names": ["React", "DSBreadcrumbItem"]
|
|
7
7
|
}
|
|
@@ -39,9 +39,10 @@ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
|
39
39
|
var import_react = __toESM(require("react"));
|
|
40
40
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
41
|
var import_styles = require("./styles.js");
|
|
42
|
-
const DSBreadcrumbItem = (
|
|
43
|
-
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
42
|
+
const DSBreadcrumbItem = (props) => {
|
|
43
|
+
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultItemProps);
|
|
44
44
|
const { as, active, href, onClick, onKeyDown, addRef, isTitle, trailingSlash, label, childIndex, color, ...rest } = propsWithDefaults;
|
|
45
|
+
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefaults);
|
|
45
46
|
const ariaCurrent = import_react.default.useMemo(() => {
|
|
46
47
|
if (active) {
|
|
47
48
|
return as === "button" || as === "span" ? "step" : "page";
|
|
@@ -56,7 +57,7 @@ const DSBreadcrumbItem = (props2) => {
|
|
|
56
57
|
[isTitle, onClick]
|
|
57
58
|
);
|
|
58
59
|
const component = isTitle && active ? "span" : as;
|
|
59
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCrumbWrapper, { isTitle, trailingSlash, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCrumbWrapper, { isTitle, trailingSlash, ...ownerPropsConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
61
|
import_styles.StyledLink,
|
|
61
62
|
{
|
|
62
63
|
variant: "link",
|
|
@@ -71,33 +72,13 @@ const DSBreadcrumbItem = (props2) => {
|
|
|
71
72
|
innerRef: addRef,
|
|
72
73
|
"aria-current": ariaCurrent,
|
|
73
74
|
...rest,
|
|
75
|
+
...ownerPropsConfig,
|
|
74
76
|
children: label
|
|
75
77
|
}
|
|
76
78
|
) });
|
|
77
79
|
};
|
|
78
|
-
const props = {
|
|
79
|
-
/**
|
|
80
|
-
* Type of element you want the item to be:
|
|
81
|
-
* 'a', 'button'
|
|
82
|
-
*/
|
|
83
|
-
as: import_ds_props_helpers.PropTypes.oneOf(["a", "button"]).description('Type of element you want the item to be: "a" or "button". Defaults to "a"').defaultValue("a"),
|
|
84
|
-
/** active item */
|
|
85
|
-
active: import_ds_props_helpers.PropTypes.bool.description("Active item"),
|
|
86
|
-
/** href link */
|
|
87
|
-
href: import_ds_props_helpers.PropTypes.string.description("Href link"),
|
|
88
|
-
/** on click handler */
|
|
89
|
-
onClick: import_ds_props_helpers.PropTypes.func.description("On click handler"),
|
|
90
|
-
/** style item as title */
|
|
91
|
-
isTitle: import_ds_props_helpers.PropTypes.bool.description("Style item as title"),
|
|
92
|
-
/** add trailing slash */
|
|
93
|
-
trailingSlash: import_ds_props_helpers.PropTypes.bool.description("Add trailing slash"),
|
|
94
|
-
/** item label */
|
|
95
|
-
label: import_ds_props_helpers.PropTypes.string.description("Item label"),
|
|
96
|
-
/** link color */
|
|
97
|
-
color: import_ds_props_helpers.PropTypes.string.description("Link color")
|
|
98
|
-
};
|
|
99
80
|
DSBreadcrumbItem.displayName = "DSBreadcrumbItem";
|
|
100
81
|
const DSBreadcrumbItemWithSchema = (0, import_ds_props_helpers.describe)(DSBreadcrumbItem);
|
|
101
|
-
DSBreadcrumbItemWithSchema.propTypes =
|
|
82
|
+
DSBreadcrumbItemWithSchema.propTypes = import_react_desc_prop_types.DSBreadcrumbItemPropTypesSchema;
|
|
102
83
|
var DSBreadcrumbItem_default = DSBreadcrumbItem;
|
|
103
84
|
//# sourceMappingURL=DSBreadcrumbItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSBreadcrumbItem.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkCjB;AAlCN,8BAAsE;AACtE,mBAAkB;AAElB,mCAAkE;AAClE,oBAA+C;AAE/C,MAAM,mBAAmB,CAAC,UAAmC;AAC3D,QAAM,wBAAoB,sDAA8D,OAAO,6CAAgB;AAC/G,QAAM,EAAE,IAAI,QAAQ,MAAM,SAAS,WAAW,QAAQ,SAAS,eAAe,OAAO,YAAY,OAAO,GAAG,KAAK,IAC9G;AACF,QAAM,uBAAmB,uCAAc,iBAAiB;AAExD,QAAM,cAAc,aAAAA,QAAM,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,gBAAgB,aAAAA,QAAM;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,4CAAC,oCAAmB,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,iCAA6B,kCAAS,gBAAgB;AAC5D,2BAA2B,YAAY;AAGvC,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -29,7 +29,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var constants_exports = {};
|
|
30
30
|
__export(constants_exports, {
|
|
31
31
|
BREADCRUMB_DATA_TESTID: () => BREADCRUMB_DATA_TESTID,
|
|
32
|
+
BREADCRUMB_ITEM_SLOTS: () => BREADCRUMB_ITEM_SLOTS,
|
|
32
33
|
BREADCRUMB_SLOTS: () => BREADCRUMB_SLOTS,
|
|
34
|
+
BREADCRUMB_TRAIL_SLOTS: () => BREADCRUMB_TRAIL_SLOTS,
|
|
33
35
|
DSBreadcrumbName: () => DSBreadcrumbName
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(constants_exports);
|
|
@@ -42,5 +44,13 @@ const BREADCRUMB_SLOTS = {
|
|
|
42
44
|
LINK: "link",
|
|
43
45
|
LIST: "list"
|
|
44
46
|
};
|
|
47
|
+
const BREADCRUMB_TRAIL_SLOTS = {
|
|
48
|
+
CONTAINER: BREADCRUMB_SLOTS.CONTAINER,
|
|
49
|
+
LIST: BREADCRUMB_SLOTS.LIST
|
|
50
|
+
};
|
|
51
|
+
const BREADCRUMB_ITEM_SLOTS = {
|
|
52
|
+
CRUMBWRAPPER: BREADCRUMB_SLOTS.CRUMBWRAPPER,
|
|
53
|
+
LINK: BREADCRUMB_SLOTS.LINK
|
|
54
|
+
};
|
|
45
55
|
const BREADCRUMB_DATA_TESTID = (0, import_ds_system.slotObjectToDataTestIds)(DSBreadcrumbName, BREADCRUMB_SLOTS);
|
|
46
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,mBAAmB;AAGzB,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,EACX,cAAc;AAAA,EACd,MAAM;AAAA,EACN,MAAM;AACR;AAGO,MAAM,6BAAyB,0CAAwB,kBAAkB,gBAAgB;",
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;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,6BAAyB,0CAAwB,kBAAkB,gBAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -17,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -31,12 +30,19 @@ var index_exports = {};
|
|
|
31
30
|
__export(index_exports, {
|
|
32
31
|
BREADCRUMB_DATA_TESTID: () => import_constants.BREADCRUMB_DATA_TESTID,
|
|
33
32
|
BREADCRUMB_SLOTS: () => import_constants.BREADCRUMB_SLOTS,
|
|
34
|
-
|
|
33
|
+
DSBreadcrumb: () => import_DSBreadcrumb.DSBreadcrumb,
|
|
34
|
+
DSBreadcrumbItem: () => import_DSBreadcrumbItem.DSBreadcrumbItem,
|
|
35
|
+
DSBreadcrumbItemWithSchema: () => import_DSBreadcrumbItem.DSBreadcrumbItemWithSchema,
|
|
36
|
+
DSBreadcrumbName: () => import_constants.DSBreadcrumbName,
|
|
37
|
+
DSBreadcrumbWithSchema: () => import_DSBreadcrumb.DSBreadcrumbWithSchema,
|
|
38
|
+
defaultItemProps: () => import_react_desc_prop_types.defaultItemProps,
|
|
39
|
+
defaultProps: () => import_react_desc_prop_types.defaultProps,
|
|
40
|
+
htmlElements: () => import_DSBreadcrumb.htmlElements
|
|
35
41
|
});
|
|
36
42
|
module.exports = __toCommonJS(index_exports);
|
|
37
43
|
var React = __toESM(require("react"));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
var import_DSBreadcrumb = require("./DSBreadcrumb.js");
|
|
45
|
+
var import_DSBreadcrumbItem = require("./DSBreadcrumbItem.js");
|
|
46
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
47
|
var import_constants = require("./constants/index.js");
|
|
42
48
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAmE;AACnE,8BAA6D;AAC7D,mCAOO;AACP,uBAA2E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,11 +28,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var react_desc_prop_types_exports = {};
|
|
30
30
|
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSBreadcrumbItemPropTypes: () => DSBreadcrumbItemPropTypes,
|
|
32
|
+
DSBreadcrumbItemPropTypesSchema: () => DSBreadcrumbItemPropTypesSchema,
|
|
33
|
+
DSBreadcrumbPropTypes: () => DSBreadcrumbPropTypes,
|
|
34
|
+
DSBreadcrumbPropTypesSchema: () => DSBreadcrumbPropTypesSchema,
|
|
31
35
|
defaultItemProps: () => defaultItemProps,
|
|
32
36
|
defaultProps: () => defaultProps
|
|
33
37
|
});
|
|
34
38
|
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
35
39
|
var React = __toESM(require("react"));
|
|
40
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
41
|
+
var import_constants = require("./constants/index.js");
|
|
36
42
|
const defaultProps = {
|
|
37
43
|
containerProps: {},
|
|
38
44
|
as: "nav",
|
|
@@ -48,4 +54,61 @@ const defaultItemProps = {
|
|
|
48
54
|
label: "",
|
|
49
55
|
childIndex: -1
|
|
50
56
|
};
|
|
57
|
+
const DSBreadcrumbPropTypes = {
|
|
58
|
+
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSBreadcrumbName, import_constants.BREADCRUMB_TRAIL_SLOTS),
|
|
59
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
60
|
+
/** props injected to breadcrumb wrapper */
|
|
61
|
+
containerProps: import_ds_props_helpers.PropTypes.object.description("props injected to breadcrumb wrapper"),
|
|
62
|
+
/**
|
|
63
|
+
* Type of element you want the main container to be:
|
|
64
|
+
* 'nav', 'div'
|
|
65
|
+
*/
|
|
66
|
+
as: import_ds_props_helpers.PropTypes.oneOf(["nav", "div"]).description("Type of element you want the main container to be: 'nav' or 'div'. Defaults to 'nav'.").defaultValue("nav"),
|
|
67
|
+
/**
|
|
68
|
+
* Whether to show the last element of the breadcrumb as a title
|
|
69
|
+
* Also removes trailing slash to show last element as title
|
|
70
|
+
*/
|
|
71
|
+
isTitle: import_ds_props_helpers.PropTypes.bool.description(
|
|
72
|
+
"Whether to show the last element of the breadcrumb as a title. Also removes trailing slash to show last element as title"
|
|
73
|
+
),
|
|
74
|
+
/** breadcrumb label */
|
|
75
|
+
label: import_ds_props_helpers.PropTypes.string.description("breadcrumb label"),
|
|
76
|
+
/**
|
|
77
|
+
* Container items to wrap
|
|
78
|
+
*/
|
|
79
|
+
trailingSlash: import_ds_props_helpers.PropTypes.bool.description("Whether to show trailing slash on all items except the last one").defaultValue(true),
|
|
80
|
+
children: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.element).isRequired.description("Container items to wrap")
|
|
81
|
+
};
|
|
82
|
+
const itemGlobalAttributesPropTypes = {
|
|
83
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
84
|
+
innerRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.object, import_ds_props_helpers.PropTypes.func]).hidden()
|
|
85
|
+
};
|
|
86
|
+
const DSBreadcrumbItemPropTypes = {
|
|
87
|
+
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSBreadcrumbName, import_constants.BREADCRUMB_ITEM_SLOTS),
|
|
88
|
+
...itemGlobalAttributesPropTypes,
|
|
89
|
+
/**
|
|
90
|
+
* Type of element you want the item to be:
|
|
91
|
+
* 'a', 'button'
|
|
92
|
+
*/
|
|
93
|
+
as: import_ds_props_helpers.PropTypes.oneOf(["a", "button"]).description('Type of element you want the item to be: "a" or "button". Defaults to "a"').defaultValue("a"),
|
|
94
|
+
/** active item */
|
|
95
|
+
active: import_ds_props_helpers.PropTypes.bool.description("Active item"),
|
|
96
|
+
/** href link */
|
|
97
|
+
href: import_ds_props_helpers.PropTypes.string.description("Href link"),
|
|
98
|
+
/** on click handler */
|
|
99
|
+
onClick: import_ds_props_helpers.PropTypes.func.description("On click handler"),
|
|
100
|
+
/** style item as title */
|
|
101
|
+
isTitle: import_ds_props_helpers.PropTypes.bool.description("Style item as title"),
|
|
102
|
+
/** add trailing slash */
|
|
103
|
+
trailingSlash: import_ds_props_helpers.PropTypes.bool.description("Add trailing slash"),
|
|
104
|
+
/** item label */
|
|
105
|
+
label: import_ds_props_helpers.PropTypes.string.description("Item label"),
|
|
106
|
+
/** link color */
|
|
107
|
+
color: import_ds_props_helpers.PropTypes.string.description("Link color"),
|
|
108
|
+
// injected by DSBreadcrumb into each of its items, not meant to be set by consumers
|
|
109
|
+
childIndex: import_ds_props_helpers.PropTypes.number.hidden(),
|
|
110
|
+
addRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.object, import_ds_props_helpers.PropTypes.func]).hidden()
|
|
111
|
+
};
|
|
112
|
+
const DSBreadcrumbPropTypesSchema = DSBreadcrumbPropTypes;
|
|
113
|
+
const DSBreadcrumbItemPropTypesSchema = DSBreadcrumbItemPropTypes;
|
|
51
114
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/react-desc-prop-types.
|
|
4
|
-
"sourcesContent": ["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;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA+E;AAI/E,uBAAgF;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,OAAG,kDAAyB,mCAAkB,uCAAsB;AAAA,EACpE,GAAG;AAAA;AAAA,EAEH,gBAAgB,kCAAU,OAAO,YAAY,sCAAsC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnF,IAAI,kCAAU,MAAM,CAAC,OAAO,KAAK,CAAC,EAC/B,YAAY,uFAAuF,EACnG,aAAa,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrB,SAAS,kCAAU,KAAK;AAAA,IACtB;AAAA,EACF;AAAA;AAAA,EAEA,OAAO,kCAAU,OAAO,YAAY,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAItD,eAAe,kCAAU,KACtB,YAAY,iEAAiE,EAC7E,aAAa,IAAI;AAAA,EACpB,UAAU,kCAAU,QAAQ,kCAAU,OAAO,EAAE,WAAW,YAAY,yBAAyB;AACjG;AAIA,MAAM,gCAAgC;AAAA,EACpC,GAAG;AAAA,EACH,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,OAAO;AAC3E;AAEO,MAAM,4BAAkG;AAAA,EAC7G,OAAG,kDAAyB,mCAAkB,sCAAqB;AAAA,EACnE,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,EAKH,IAAI,kCAAU,MAAM,CAAC,KAAK,QAAQ,CAAC,EAChC,YAAY,2EAA2E,EACvF,aAAa,GAAG;AAAA;AAAA,EAEnB,QAAQ,kCAAU,KAAK,YAAY,aAAa;AAAA;AAAA,EAEhD,MAAM,kCAAU,OAAO,YAAY,WAAW;AAAA;AAAA,EAE9C,SAAS,kCAAU,KAAK,YAAY,kBAAkB;AAAA;AAAA,EAEtD,SAAS,kCAAU,KAAK,YAAY,qBAAqB;AAAA;AAAA,EAEzD,eAAe,kCAAU,KAAK,YAAY,oBAAoB;AAAA;AAAA,EAE9D,OAAO,kCAAU,OAAO,YAAY,YAAY;AAAA;AAAA,EAEhD,OAAO,kCAAU,OAAO,YAAY,YAAY;AAAA;AAAA,EAEhD,YAAY,kCAAU,OAAO,OAAO;AAAA,EACpC,QAAQ,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,OAAO;AACzE;AAEO,MAAM,8BAA8B;AACpC,MAAM,kCACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
|
+
const TrailSlotPropsAsObject = {
|
|
26
|
+
dsBreadcrumbContainer: { "aria-label": "just a typescript test" },
|
|
27
|
+
dsBreadcrumbList: { "aria-label": "just a typescript test" }
|
|
28
|
+
};
|
|
29
|
+
const TrailSlotPropsAsFunctions = {
|
|
30
|
+
dsBreadcrumbContainer: () => ({ "aria-label": "just a typescript test" }),
|
|
31
|
+
dsBreadcrumbList: () => ({ "aria-label": "just a typescript test" })
|
|
32
|
+
};
|
|
33
|
+
const TrailSlotFunctionsAreValidProps = TrailSlotPropsAsFunctions;
|
|
34
|
+
const EnsureAllTrailSlotsExistInSlotFunctionArguments = TrailSlotPropsAsFunctions;
|
|
35
|
+
const ItemSlotPropsAsObject = {
|
|
36
|
+
dsBreadcrumbCrumbWrapper: { "aria-label": "just a typescript test" },
|
|
37
|
+
dsBreadcrumbLink: { "aria-label": "just a typescript test" }
|
|
38
|
+
};
|
|
39
|
+
const ItemSlotPropsAsFunctions = {
|
|
40
|
+
dsBreadcrumbCrumbWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
41
|
+
dsBreadcrumbLink: () => ({ "aria-label": "just a typescript test" })
|
|
42
|
+
};
|
|
43
|
+
const ItemSlotFunctionsAreValidProps = ItemSlotPropsAsFunctions;
|
|
44
|
+
const EnsureAllItemSlotsExistInSlotFunctionArguments = ItemSlotPropsAsFunctions;
|
|
45
|
+
const EnsureAllSlotsExistInSlotFunctionArguments = { ...TrailSlotPropsAsFunctions, ...ItemSlotPropsAsFunctions };
|
|
46
|
+
//# 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,YAAuB;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
|
+
}
|
|
@@ -77,6 +77,24 @@ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)
|
|
|
77
77
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import__.DSBreadcrumb, { as: "nav", label: "Breadcrumb", isTitle: false, trailingSlash: true, containerProps: {}, children: [
|
|
78
78
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSBreadcrumbItem, { href: "/", label: "Home" }),
|
|
79
79
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSBreadcrumbItem, { href: "/home", label: "Home2" })
|
|
80
|
-
] })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
82
|
+
import__.DSBreadcrumb,
|
|
83
|
+
{
|
|
84
|
+
dsBreadcrumbContainer: { "aria-label": "Loan navigation" },
|
|
85
|
+
dsBreadcrumbList: () => ({ "data-custom": "list" }),
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
import__.DSBreadcrumbItem,
|
|
89
|
+
{
|
|
90
|
+
label: "Home",
|
|
91
|
+
dsBreadcrumbCrumbWrapper: { "data-custom": "crumb" },
|
|
92
|
+
dsBreadcrumbLink: () => ({ "aria-label": "Home page" })
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSBreadcrumb.Item, { label: "Loans", dsBreadcrumbLink: { "aria-label": "Loans page" } })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
)
|
|
81
99
|
] });
|
|
82
100
|
//# 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,YAAuB;ACoErB;AAnEF,eAA+C;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,4EAEE;AAAA,8CAAC,yBAAc,GAAG,wBAAwB;AAAA,EAC1C,4CAAC,yBAAc,GAAG,8BAA8B;AAAA,EAEhD,6CAAC,yBAAa,IAAG,OAAM,OAAM,cAAa,SAAS,OAAO,eAAa,MAAC,gBAAgB,CAAC,GACvF;AAAA,gDAAC,6BAAiB,MAAK,KAAI,OAAM,QAAO;AAAA,IACxC,4CAAC,6BAAiB,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,YAAuB;ACoErB;AAnEF,eAA+C;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,4EAEE;AAAA,8CAAC,yBAAc,GAAG,wBAAwB;AAAA,EAC1C,4CAAC,yBAAc,GAAG,8BAA8B;AAAA,EAEhD,6CAAC,yBAAa,IAAG,OAAM,OAAM,cAAa,SAAS,OAAO,eAAa,MAAC,gBAAgB,CAAC,GACvF;AAAA,gDAAC,6BAAiB,MAAK,KAAI,OAAM,QAAO;AAAA,IACxC,4CAAC,6BAAiB,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,4CAAC,sBAAa,MAAb,EAAkB,OAAM,SAAQ,kBAAkB,EAAE,cAAc,aAAa,GAAG;AAAA;AAAA;AAAA,EACrF;AAAA,GACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|