@yamada-ui/breadcrumb 1.3.13-dev-20241007025246 → 1.3.13-dev-20241007155115
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/breadcrumb.js +3 -3
- package/dist/breadcrumb.js.map +1 -1
- package/dist/breadcrumb.mjs +1 -1
- package/dist/{chunk-6HP2ISS7.mjs → chunk-CIXCLOTL.mjs} +4 -4
- package/dist/{chunk-6HP2ISS7.mjs.map → chunk-CIXCLOTL.mjs.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/dist/breadcrumb.js
CHANGED
@@ -197,15 +197,15 @@ var BreadcrumbItem = (0, import_core.forwardRef)(
|
|
197
197
|
BreadcrumbItem.displayName = "BreadcrumbItem";
|
198
198
|
BreadcrumbItem.__ui__ = "BreadcrumbItem";
|
199
199
|
var BreadcrumbLink = (0, import_core.forwardRef)(
|
200
|
-
({ className, children,
|
200
|
+
({ href, className, children, isCurrentPage, ...rest }, ref) => {
|
201
201
|
const styles = useBreadcrumb();
|
202
202
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
203
203
|
import_core.ui.a,
|
204
204
|
{
|
205
205
|
ref,
|
206
206
|
as: !isCurrentPage ? "a" : "span",
|
207
|
-
className: (0, import_utils.cx)("ui-breadcrumb__link", className),
|
208
207
|
href: !isCurrentPage ? href : void 0,
|
208
|
+
className: (0, import_utils.cx)("ui-breadcrumb__link", className),
|
209
209
|
"aria-current": isCurrentPage ? "page" : void 0,
|
210
210
|
__css: styles.link,
|
211
211
|
...rest,
|
@@ -248,13 +248,13 @@ var BreadcrumbEllipsis = (0, import_core.forwardRef)(
|
|
248
248
|
{
|
249
249
|
ref,
|
250
250
|
className: (0, import_utils.cx)("ui-breadcrumb__item__ellipsis", className),
|
251
|
+
"aria-label": "ellipsis",
|
251
252
|
stroke: "currentColor",
|
252
253
|
strokeLinecap: "round",
|
253
254
|
strokeLinejoin: "round",
|
254
255
|
strokeWidth: "1.5",
|
255
256
|
viewBox: "0 0 36 24",
|
256
257
|
xmlns: "http://www.w3.org/2000/svg",
|
257
|
-
"aria-label": "ellipsis",
|
258
258
|
__css: css,
|
259
259
|
...rest,
|
260
260
|
children: [
|
package/dist/breadcrumb.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/breadcrumb.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n createContext,\n cx,\n getValidChildren,\n isNumber,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement, Fragment, useCallback, useMemo } from \"react\"\n\nconst [BreadcrumbProvider, useBreadcrumb] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: \"BreadcrumbContext\",\n errorMessage: `useBreadcrumb returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" `,\n})\n\nexport interface BreadcrumbGenerateItem extends BreadcrumbLinkProps {\n name?: ReactNode\n isEllipsisPage?: boolean\n containerProps?: Omit<BreadcrumbItemProps, \"isLastChild\">\n}\n\ninterface BreadcrumbOptions {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?:\n | ((props: { items: BreadcrumbGenerateItem[] }) => ReactNode)\n | ReactNode\n /**\n * Number of elements visible on the end(right) edges.\n */\n endBoundaries?: Token<number>\n /**\n * The left and right margin applied to the separator.\n *\n * @default '2'\n */\n gap?: CSSUIProps[\"mx\"]\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbGenerateItem[]\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n */\n startBoundaries?: Token<number>\n /**\n * Props for ol element.\n */\n listProps?: HTMLUIProps<\"ol\">\n}\n\nexport interface BreadcrumbProps\n extends Omit<HTMLUIProps<\"nav\">, \"gap\">,\n ThemeProps<\"Breadcrumb\">,\n BreadcrumbOptions {}\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see Docs https://yamada-ui.com/components/navigation/breadcrumb\n */\nexport const Breadcrumb = forwardRef<BreadcrumbProps, \"nav\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Breadcrumb\", props)\n\n const {\n className,\n children,\n ellipsis,\n endBoundaries: _endBoundaries,\n gap = \"fallback(2, 0.5rem)\",\n items = [],\n separator = \"/\",\n startBoundaries: _startBoundaries,\n listProps,\n ...rest\n } = omitThemeProps(mergedProps)\n let startBoundaries = useValue(_startBoundaries)\n let endBoundaries = useValue(_endBoundaries)\n\n if (startBoundaries === 0) startBoundaries = 1\n if (endBoundaries === 0) endBoundaries = 1\n\n if (startBoundaries) endBoundaries ??= 1\n if (endBoundaries) startBoundaries ??= 1\n\n const hasBoundaries = isNumber(startBoundaries) && isNumber(endBoundaries)\n const isExceed =\n hasBoundaries && startBoundaries! + endBoundaries! < items.length\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n ...styles.container,\n }\n\n const validChildren = getValidChildren(children)\n const hasChildren = validChildren.length\n\n const customEllipsis = useCallback(\n (providedItems?: BreadcrumbGenerateItem[]) => {\n if (!ellipsis) return null\n\n const resolvedItems =\n providedItems ??\n items.slice(startBoundaries!, items.length - endBoundaries!)\n\n return runIfFunc(ellipsis, { items: resolvedItems })\n },\n [ellipsis, endBoundaries, items, startBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n if (hasChildren) {\n return validChildren.map((child, index) =>\n cloneElement(child, {\n gap,\n isLastChild: validChildren.length === index + 1,\n separator,\n }),\n )\n } else {\n let hiddenEllipsis: BreadcrumbGenerateItem[] = []\n\n return items.map((item, index) => {\n const { name, isCurrentPage, isEllipsisPage, containerProps, ...rest } =\n item\n const isLastChild = items.length === index + 1\n const props: BreadcrumbItemProps = {\n gap,\n isCurrentPage,\n separator,\n ...containerProps,\n }\n\n if (!hasBoundaries && isEllipsisPage) {\n hiddenEllipsis.push(item)\n\n return isLastChild ? (\n <BreadcrumbItem key={index} {...props} isLastChild>\n {customEllipsis([item]) ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n ) : null\n }\n\n if (hasBoundaries && isExceed) {\n const lastIndex = items.length - index - 1\n\n if (startBoundaries! <= index && endBoundaries! <= lastIndex) {\n if (startBoundaries === index) {\n return (\n <BreadcrumbItem key={index} {...props}>\n {customEllipsis() ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n )\n } else {\n return null\n }\n }\n }\n\n if (hiddenEllipsis.length) {\n const resolvedEllipsis = customEllipsis(hiddenEllipsis) ?? (\n <BreadcrumbEllipsis />\n )\n\n hiddenEllipsis = []\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...props}>{resolvedEllipsis}</BreadcrumbItem>\n\n <BreadcrumbItem {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n )\n } else {\n return (\n <BreadcrumbItem key={index} {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n )\n }\n })\n }\n }, [\n hasChildren,\n validChildren,\n separator,\n gap,\n items,\n hasBoundaries,\n isExceed,\n startBoundaries,\n endBoundaries,\n customEllipsis,\n ])\n\n return (\n <BreadcrumbProvider value={styles}>\n <ui.nav\n ref={ref}\n className={cx(\"ui-breadcrumb\", className)}\n aria-label=\"Breadcrumb\"\n __css={styles.container}\n {...rest}\n >\n <ui.ol className=\"ui-breadcrumb__list\" {...listProps} __css={css}>\n {cloneChildren}\n </ui.ol>\n </ui.nav>\n </BreadcrumbProvider>\n )\n})\n\nBreadcrumb.displayName = \"Breadcrumb\"\nBreadcrumb.__ui__ = \"Breadcrumb\"\n\ninterface BreadcrumbItemOptions\n extends Pick<BreadcrumbProps, \"gap\" | \"separator\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n /**\n * If `true`, not show separator.\n *\n * @default false\n */\n isLastChild?: boolean\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<HTMLUIProps<\"li\">, \"gap\">,\n BreadcrumbItemOptions {}\n\nexport const BreadcrumbItem = forwardRef<BreadcrumbItemProps, \"li\">(\n (\n {\n className,\n children,\n gap,\n isCurrentPage,\n isLastChild,\n separator,\n ...rest\n },\n ref,\n ) => {\n const styles = useBreadcrumb()\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) => {\n if (child.type === BreadcrumbLink) {\n return cloneElement(child, {\n isCurrentPage,\n })\n }\n\n if (child.type === BreadcrumbSeparator) {\n return cloneElement(child, {\n children: child.props.children || separator,\n gap,\n })\n }\n\n return child\n })\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n ...styles.item,\n }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-breadcrumb__item\", className)}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n {!isLastChild ? (\n <BreadcrumbSeparator gap={gap}>{separator}</BreadcrumbSeparator>\n ) : null}\n </ui.li>\n )\n },\n)\n\nBreadcrumbItem.displayName = \"BreadcrumbItem\"\nBreadcrumbItem.__ui__ = \"BreadcrumbItem\"\n\ninterface BreadcrumbLinkOptions {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n}\n\nexport interface BreadcrumbLinkProps\n extends HTMLUIProps<\"a\">,\n BreadcrumbLinkOptions {}\n\nexport const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, \"a\">(\n ({ className, children, href, isCurrentPage, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n return (\n <ui.a\n ref={ref}\n as={!isCurrentPage ? \"a\" : \"span\"}\n className={cx(\"ui-breadcrumb__link\", className)}\n href={!isCurrentPage ? href : undefined}\n aria-current={isCurrentPage ? \"page\" : undefined}\n __css={styles.link}\n {...rest}\n >\n {children}\n </ui.a>\n )\n },\n)\nBreadcrumbLink.displayName = \"BreadcrumbLink\"\nBreadcrumbLink.__ui__ = \"BreadcrumbLink\"\n\ninterface BreadcrumbSeparatorOptions {\n /**\n * The CSS `margin-inline-start`, and `margin-inline-end` property.\n */\n gap?: CSSUIObject[\"mx\"]\n}\n\nexport interface BreadcrumbSeparatorProps\n extends Omit<HTMLUIProps<\"span\">, \"gap\">,\n BreadcrumbSeparatorOptions {}\n\nexport const BreadcrumbSeparator = forwardRef<BreadcrumbSeparatorProps, \"span\">(\n ({ children, gap: mx, ...rest }, ref) => {\n const styles = useBreadcrumb()\n const css: CSSUIObject = {\n mx,\n ...styles.separator,\n }\n\n return (\n <ui.span\n ref={ref}\n className=\"ui-breadcrumb__item__separator\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.span>\n )\n },\n)\n\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\"\nBreadcrumbSeparator.__ui__ = \"BreadcrumbSeparator\"\n\ninterface BreadcrumbEllipsisOptions {}\n\nexport interface BreadcrumbEllipsisProps\n extends IconProps,\n BreadcrumbEllipsisOptions {}\n\nexport const BreadcrumbEllipsis = forwardRef<BreadcrumbEllipsisProps, \"span\">(\n ({ className, children, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n const css: CSSUIObject = {\n ...styles.ellipsis,\n }\n\n return (\n children ?? (\n <Icon\n ref={ref}\n className={cx(\"ui-breadcrumb__item__ellipsis\", className)}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 36 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-label=\"ellipsis\"\n __css={css}\n {...rest}\n >\n <circle cx=\"10\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"20\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"30\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n </Icon>\n )\n )\n },\n)\n\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\"\nBreadcrumbEllipsis.__ui__ = \"BreadcrumbEllipsis\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,kBAKO;AACP,kBAAqB;AACrB,uBAAyB;AACzB,mBAMO;AACP,mBAA6D;AA4IpB;AA1IzC,IAAM,CAAC,oBAAoB,aAAa,QAAI,4BAEzC;AAAA,EACD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAuDM,IAAM,iBAAa,wBAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,cAAc,KAAK;AAExE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,MAAM;AAAA,IACN,QAAQ,CAAC;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB;AAAA,IACA,GAAG;AAAA,EACL,QAAI,4BAAe,WAAW;AAC9B,MAAI,sBAAkB,2BAAS,gBAAgB;AAC/C,MAAI,oBAAgB,2BAAS,cAAc;AAE3C,MAAI,oBAAoB,EAAG,mBAAkB;AAC7C,MAAI,kBAAkB,EAAG,iBAAgB;AAEzC,MAAI,gBAAiB,yDAAkB;AACvC,MAAI,cAAe,+DAAoB;AAEvC,QAAM,oBAAgB,uBAAS,eAAe,SAAK,uBAAS,aAAa;AACzE,QAAM,WACJ,iBAAiB,kBAAmB,gBAAiB,MAAM;AAE7D,QAAM,MAAmB;AAAA,IACvB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,GAAG,OAAO;AAAA,EACZ;AAEA,QAAM,oBAAgB,+BAA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AEA,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAU;AAAA,QACV,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,oBAAoB,cAAc;AAClC,oBAAoB,SAAS;AAQtB,IAAM,yBAAqB;AAAA,EAChC,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AACzC,UAAM,SAAS,cAAc;AAE7B,UAAM,MAAmB;AAAA,MACvB,GAAG,OAAO;AAAA,IACZ;AAEA,WACE,8BACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,iBAAG,iCAAiC,SAAS;AAAA,QACxD,QAAO;AAAA,QACP,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,aAAY;AAAA,QACZ,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,cAAW;AAAA,QACX,OAAO;AAAA,QACN,GAAG;AAAA,QAEJ;AAAA,sDAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA;AAAA;AAAA,IACpD;AAAA,EAGN;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":["rest","props"]}
|
1
|
+
{"version":3,"sources":["../src/breadcrumb.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n createContext,\n cx,\n getValidChildren,\n isNumber,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement, Fragment, useCallback, useMemo } from \"react\"\n\nconst [BreadcrumbProvider, useBreadcrumb] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: \"BreadcrumbContext\",\n errorMessage: `useBreadcrumb returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" `,\n})\n\nexport interface BreadcrumbGenerateItem extends BreadcrumbLinkProps {\n name?: ReactNode\n isEllipsisPage?: boolean\n containerProps?: Omit<BreadcrumbItemProps, \"isLastChild\">\n}\n\ninterface BreadcrumbOptions {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?:\n | ((props: { items: BreadcrumbGenerateItem[] }) => ReactNode)\n | ReactNode\n /**\n * Number of elements visible on the end(right) edges.\n */\n endBoundaries?: Token<number>\n /**\n * The left and right margin applied to the separator.\n *\n * @default '2'\n */\n gap?: CSSUIProps[\"mx\"]\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbGenerateItem[]\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n */\n startBoundaries?: Token<number>\n /**\n * Props for ol element.\n */\n listProps?: HTMLUIProps<\"ol\">\n}\n\nexport interface BreadcrumbProps\n extends Omit<HTMLUIProps<\"nav\">, \"gap\">,\n ThemeProps<\"Breadcrumb\">,\n BreadcrumbOptions {}\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see Docs https://yamada-ui.com/components/navigation/breadcrumb\n */\nexport const Breadcrumb = forwardRef<BreadcrumbProps, \"nav\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Breadcrumb\", props)\n\n const {\n className,\n children,\n ellipsis,\n endBoundaries: _endBoundaries,\n gap = \"fallback(2, 0.5rem)\",\n items = [],\n separator = \"/\",\n startBoundaries: _startBoundaries,\n listProps,\n ...rest\n } = omitThemeProps(mergedProps)\n let startBoundaries = useValue(_startBoundaries)\n let endBoundaries = useValue(_endBoundaries)\n\n if (startBoundaries === 0) startBoundaries = 1\n if (endBoundaries === 0) endBoundaries = 1\n\n if (startBoundaries) endBoundaries ??= 1\n if (endBoundaries) startBoundaries ??= 1\n\n const hasBoundaries = isNumber(startBoundaries) && isNumber(endBoundaries)\n const isExceed =\n hasBoundaries && startBoundaries! + endBoundaries! < items.length\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n ...styles.container,\n }\n\n const validChildren = getValidChildren(children)\n const hasChildren = validChildren.length\n\n const customEllipsis = useCallback(\n (providedItems?: BreadcrumbGenerateItem[]) => {\n if (!ellipsis) return null\n\n const resolvedItems =\n providedItems ??\n items.slice(startBoundaries!, items.length - endBoundaries!)\n\n return runIfFunc(ellipsis, { items: resolvedItems })\n },\n [ellipsis, endBoundaries, items, startBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n if (hasChildren) {\n return validChildren.map((child, index) =>\n cloneElement(child, {\n gap,\n isLastChild: validChildren.length === index + 1,\n separator,\n }),\n )\n } else {\n let hiddenEllipsis: BreadcrumbGenerateItem[] = []\n\n return items.map((item, index) => {\n const { name, isCurrentPage, isEllipsisPage, containerProps, ...rest } =\n item\n const isLastChild = items.length === index + 1\n const props: BreadcrumbItemProps = {\n gap,\n isCurrentPage,\n separator,\n ...containerProps,\n }\n\n if (!hasBoundaries && isEllipsisPage) {\n hiddenEllipsis.push(item)\n\n return isLastChild ? (\n <BreadcrumbItem key={index} {...props} isLastChild>\n {customEllipsis([item]) ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n ) : null\n }\n\n if (hasBoundaries && isExceed) {\n const lastIndex = items.length - index - 1\n\n if (startBoundaries! <= index && endBoundaries! <= lastIndex) {\n if (startBoundaries === index) {\n return (\n <BreadcrumbItem key={index} {...props}>\n {customEllipsis() ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n )\n } else {\n return null\n }\n }\n }\n\n if (hiddenEllipsis.length) {\n const resolvedEllipsis = customEllipsis(hiddenEllipsis) ?? (\n <BreadcrumbEllipsis />\n )\n\n hiddenEllipsis = []\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...props}>{resolvedEllipsis}</BreadcrumbItem>\n\n <BreadcrumbItem {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n )\n } else {\n return (\n <BreadcrumbItem key={index} {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n )\n }\n })\n }\n }, [\n hasChildren,\n validChildren,\n separator,\n gap,\n items,\n hasBoundaries,\n isExceed,\n startBoundaries,\n endBoundaries,\n customEllipsis,\n ])\n\n return (\n <BreadcrumbProvider value={styles}>\n <ui.nav\n ref={ref}\n className={cx(\"ui-breadcrumb\", className)}\n aria-label=\"Breadcrumb\"\n __css={styles.container}\n {...rest}\n >\n <ui.ol className=\"ui-breadcrumb__list\" {...listProps} __css={css}>\n {cloneChildren}\n </ui.ol>\n </ui.nav>\n </BreadcrumbProvider>\n )\n})\n\nBreadcrumb.displayName = \"Breadcrumb\"\nBreadcrumb.__ui__ = \"Breadcrumb\"\n\ninterface BreadcrumbItemOptions\n extends Pick<BreadcrumbProps, \"gap\" | \"separator\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n /**\n * If `true`, not show separator.\n *\n * @default false\n */\n isLastChild?: boolean\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<HTMLUIProps<\"li\">, \"gap\">,\n BreadcrumbItemOptions {}\n\nexport const BreadcrumbItem = forwardRef<BreadcrumbItemProps, \"li\">(\n (\n {\n className,\n children,\n gap,\n isCurrentPage,\n isLastChild,\n separator,\n ...rest\n },\n ref,\n ) => {\n const styles = useBreadcrumb()\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) => {\n if (child.type === BreadcrumbLink) {\n return cloneElement(child, {\n isCurrentPage,\n })\n }\n\n if (child.type === BreadcrumbSeparator) {\n return cloneElement(child, {\n children: child.props.children || separator,\n gap,\n })\n }\n\n return child\n })\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n ...styles.item,\n }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-breadcrumb__item\", className)}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n {!isLastChild ? (\n <BreadcrumbSeparator gap={gap}>{separator}</BreadcrumbSeparator>\n ) : null}\n </ui.li>\n )\n },\n)\n\nBreadcrumbItem.displayName = \"BreadcrumbItem\"\nBreadcrumbItem.__ui__ = \"BreadcrumbItem\"\n\ninterface BreadcrumbLinkOptions {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n}\n\nexport interface BreadcrumbLinkProps\n extends HTMLUIProps<\"a\">,\n BreadcrumbLinkOptions {}\n\nexport const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, \"a\">(\n ({ href, className, children, isCurrentPage, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n return (\n <ui.a\n ref={ref}\n as={!isCurrentPage ? \"a\" : \"span\"}\n href={!isCurrentPage ? href : undefined}\n className={cx(\"ui-breadcrumb__link\", className)}\n aria-current={isCurrentPage ? \"page\" : undefined}\n __css={styles.link}\n {...rest}\n >\n {children}\n </ui.a>\n )\n },\n)\nBreadcrumbLink.displayName = \"BreadcrumbLink\"\nBreadcrumbLink.__ui__ = \"BreadcrumbLink\"\n\ninterface BreadcrumbSeparatorOptions {\n /**\n * The CSS `margin-inline-start`, and `margin-inline-end` property.\n */\n gap?: CSSUIObject[\"mx\"]\n}\n\nexport interface BreadcrumbSeparatorProps\n extends Omit<HTMLUIProps<\"span\">, \"gap\">,\n BreadcrumbSeparatorOptions {}\n\nexport const BreadcrumbSeparator = forwardRef<BreadcrumbSeparatorProps, \"span\">(\n ({ children, gap: mx, ...rest }, ref) => {\n const styles = useBreadcrumb()\n const css: CSSUIObject = {\n mx,\n ...styles.separator,\n }\n\n return (\n <ui.span\n ref={ref}\n className=\"ui-breadcrumb__item__separator\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.span>\n )\n },\n)\n\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\"\nBreadcrumbSeparator.__ui__ = \"BreadcrumbSeparator\"\n\ninterface BreadcrumbEllipsisOptions {}\n\nexport interface BreadcrumbEllipsisProps\n extends IconProps,\n BreadcrumbEllipsisOptions {}\n\nexport const BreadcrumbEllipsis = forwardRef<BreadcrumbEllipsisProps, \"span\">(\n ({ className, children, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n const css: CSSUIObject = {\n ...styles.ellipsis,\n }\n\n return (\n children ?? (\n <Icon\n ref={ref}\n className={cx(\"ui-breadcrumb__item__ellipsis\", className)}\n aria-label=\"ellipsis\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 36 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n __css={css}\n {...rest}\n >\n <circle cx=\"10\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"20\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"30\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n </Icon>\n )\n )\n },\n)\n\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\"\nBreadcrumbEllipsis.__ui__ = \"BreadcrumbEllipsis\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,kBAKO;AACP,kBAAqB;AACrB,uBAAyB;AACzB,mBAMO;AACP,mBAA6D;AA4IpB;AA1IzC,IAAM,CAAC,oBAAoB,aAAa,QAAI,4BAEzC;AAAA,EACD,MAAM;AAAA,EACN,cAAc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AA,QACd,gBAAe;AAAA,QACf,aAAY;AAAA,QACZ,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,OAAO;AAAA,QACN,GAAG;AAAA,QAEJ;AAAA,sDAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA;AAAA;AAAA,IACpD;AAAA,EAGN;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":["rest","props"]}
|
package/dist/breadcrumb.mjs
CHANGED
@@ -181,15 +181,15 @@ var BreadcrumbItem = forwardRef(
|
|
181
181
|
BreadcrumbItem.displayName = "BreadcrumbItem";
|
182
182
|
BreadcrumbItem.__ui__ = "BreadcrumbItem";
|
183
183
|
var BreadcrumbLink = forwardRef(
|
184
|
-
({ className, children,
|
184
|
+
({ href, className, children, isCurrentPage, ...rest }, ref) => {
|
185
185
|
const styles = useBreadcrumb();
|
186
186
|
return /* @__PURE__ */ jsx(
|
187
187
|
ui.a,
|
188
188
|
{
|
189
189
|
ref,
|
190
190
|
as: !isCurrentPage ? "a" : "span",
|
191
|
-
className: cx("ui-breadcrumb__link", className),
|
192
191
|
href: !isCurrentPage ? href : void 0,
|
192
|
+
className: cx("ui-breadcrumb__link", className),
|
193
193
|
"aria-current": isCurrentPage ? "page" : void 0,
|
194
194
|
__css: styles.link,
|
195
195
|
...rest,
|
@@ -232,13 +232,13 @@ var BreadcrumbEllipsis = forwardRef(
|
|
232
232
|
{
|
233
233
|
ref,
|
234
234
|
className: cx("ui-breadcrumb__item__ellipsis", className),
|
235
|
+
"aria-label": "ellipsis",
|
235
236
|
stroke: "currentColor",
|
236
237
|
strokeLinecap: "round",
|
237
238
|
strokeLinejoin: "round",
|
238
239
|
strokeWidth: "1.5",
|
239
240
|
viewBox: "0 0 36 24",
|
240
241
|
xmlns: "http://www.w3.org/2000/svg",
|
241
|
-
"aria-label": "ellipsis",
|
242
242
|
__css: css,
|
243
243
|
...rest,
|
244
244
|
children: [
|
@@ -260,4 +260,4 @@ export {
|
|
260
260
|
BreadcrumbSeparator,
|
261
261
|
BreadcrumbEllipsis
|
262
262
|
};
|
263
|
-
//# sourceMappingURL=chunk-
|
263
|
+
//# sourceMappingURL=chunk-CIXCLOTL.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/breadcrumb.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n createContext,\n cx,\n getValidChildren,\n isNumber,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement, Fragment, useCallback, useMemo } from \"react\"\n\nconst [BreadcrumbProvider, useBreadcrumb] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: \"BreadcrumbContext\",\n errorMessage: `useBreadcrumb returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" `,\n})\n\nexport interface BreadcrumbGenerateItem extends BreadcrumbLinkProps {\n name?: ReactNode\n isEllipsisPage?: boolean\n containerProps?: Omit<BreadcrumbItemProps, \"isLastChild\">\n}\n\ninterface BreadcrumbOptions {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?:\n | ((props: { items: BreadcrumbGenerateItem[] }) => ReactNode)\n | ReactNode\n /**\n * Number of elements visible on the end(right) edges.\n */\n endBoundaries?: Token<number>\n /**\n * The left and right margin applied to the separator.\n *\n * @default '2'\n */\n gap?: CSSUIProps[\"mx\"]\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbGenerateItem[]\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n */\n startBoundaries?: Token<number>\n /**\n * Props for ol element.\n */\n listProps?: HTMLUIProps<\"ol\">\n}\n\nexport interface BreadcrumbProps\n extends Omit<HTMLUIProps<\"nav\">, \"gap\">,\n ThemeProps<\"Breadcrumb\">,\n BreadcrumbOptions {}\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see Docs https://yamada-ui.com/components/navigation/breadcrumb\n */\nexport const Breadcrumb = forwardRef<BreadcrumbProps, \"nav\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Breadcrumb\", props)\n\n const {\n className,\n children,\n ellipsis,\n endBoundaries: _endBoundaries,\n gap = \"fallback(2, 0.5rem)\",\n items = [],\n separator = \"/\",\n startBoundaries: _startBoundaries,\n listProps,\n ...rest\n } = omitThemeProps(mergedProps)\n let startBoundaries = useValue(_startBoundaries)\n let endBoundaries = useValue(_endBoundaries)\n\n if (startBoundaries === 0) startBoundaries = 1\n if (endBoundaries === 0) endBoundaries = 1\n\n if (startBoundaries) endBoundaries ??= 1\n if (endBoundaries) startBoundaries ??= 1\n\n const hasBoundaries = isNumber(startBoundaries) && isNumber(endBoundaries)\n const isExceed =\n hasBoundaries && startBoundaries! + endBoundaries! < items.length\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n ...styles.container,\n }\n\n const validChildren = getValidChildren(children)\n const hasChildren = validChildren.length\n\n const customEllipsis = useCallback(\n (providedItems?: BreadcrumbGenerateItem[]) => {\n if (!ellipsis) return null\n\n const resolvedItems =\n providedItems ??\n items.slice(startBoundaries!, items.length - endBoundaries!)\n\n return runIfFunc(ellipsis, { items: resolvedItems })\n },\n [ellipsis, endBoundaries, items, startBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n if (hasChildren) {\n return validChildren.map((child, index) =>\n cloneElement(child, {\n gap,\n isLastChild: validChildren.length === index + 1,\n separator,\n }),\n )\n } else {\n let hiddenEllipsis: BreadcrumbGenerateItem[] = []\n\n return items.map((item, index) => {\n const { name, isCurrentPage, isEllipsisPage, containerProps, ...rest } =\n item\n const isLastChild = items.length === index + 1\n const props: BreadcrumbItemProps = {\n gap,\n isCurrentPage,\n separator,\n ...containerProps,\n }\n\n if (!hasBoundaries && isEllipsisPage) {\n hiddenEllipsis.push(item)\n\n return isLastChild ? (\n <BreadcrumbItem key={index} {...props} isLastChild>\n {customEllipsis([item]) ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n ) : null\n }\n\n if (hasBoundaries && isExceed) {\n const lastIndex = items.length - index - 1\n\n if (startBoundaries! <= index && endBoundaries! <= lastIndex) {\n if (startBoundaries === index) {\n return (\n <BreadcrumbItem key={index} {...props}>\n {customEllipsis() ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n )\n } else {\n return null\n }\n }\n }\n\n if (hiddenEllipsis.length) {\n const resolvedEllipsis = customEllipsis(hiddenEllipsis) ?? (\n <BreadcrumbEllipsis />\n )\n\n hiddenEllipsis = []\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...props}>{resolvedEllipsis}</BreadcrumbItem>\n\n <BreadcrumbItem {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n )\n } else {\n return (\n <BreadcrumbItem key={index} {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n )\n }\n })\n }\n }, [\n hasChildren,\n validChildren,\n separator,\n gap,\n items,\n hasBoundaries,\n isExceed,\n startBoundaries,\n endBoundaries,\n customEllipsis,\n ])\n\n return (\n <BreadcrumbProvider value={styles}>\n <ui.nav\n ref={ref}\n className={cx(\"ui-breadcrumb\", className)}\n aria-label=\"Breadcrumb\"\n __css={styles.container}\n {...rest}\n >\n <ui.ol className=\"ui-breadcrumb__list\" {...listProps} __css={css}>\n {cloneChildren}\n </ui.ol>\n </ui.nav>\n </BreadcrumbProvider>\n )\n})\n\nBreadcrumb.displayName = \"Breadcrumb\"\nBreadcrumb.__ui__ = \"Breadcrumb\"\n\ninterface BreadcrumbItemOptions\n extends Pick<BreadcrumbProps, \"gap\" | \"separator\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n /**\n * If `true`, not show separator.\n *\n * @default false\n */\n isLastChild?: boolean\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<HTMLUIProps<\"li\">, \"gap\">,\n BreadcrumbItemOptions {}\n\nexport const BreadcrumbItem = forwardRef<BreadcrumbItemProps, \"li\">(\n (\n {\n className,\n children,\n gap,\n isCurrentPage,\n isLastChild,\n separator,\n ...rest\n },\n ref,\n ) => {\n const styles = useBreadcrumb()\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) => {\n if (child.type === BreadcrumbLink) {\n return cloneElement(child, {\n isCurrentPage,\n })\n }\n\n if (child.type === BreadcrumbSeparator) {\n return cloneElement(child, {\n children: child.props.children || separator,\n gap,\n })\n }\n\n return child\n })\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n ...styles.item,\n }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-breadcrumb__item\", className)}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n {!isLastChild ? (\n <BreadcrumbSeparator gap={gap}>{separator}</BreadcrumbSeparator>\n ) : null}\n </ui.li>\n )\n },\n)\n\nBreadcrumbItem.displayName = \"BreadcrumbItem\"\nBreadcrumbItem.__ui__ = \"BreadcrumbItem\"\n\ninterface BreadcrumbLinkOptions {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n}\n\nexport interface BreadcrumbLinkProps\n extends HTMLUIProps<\"a\">,\n BreadcrumbLinkOptions {}\n\nexport const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, \"a\">(\n ({ className, children, href, isCurrentPage, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n return (\n <ui.a\n ref={ref}\n as={!isCurrentPage ? \"a\" : \"span\"}\n className={cx(\"ui-breadcrumb__link\", className)}\n href={!isCurrentPage ? href : undefined}\n aria-current={isCurrentPage ? \"page\" : undefined}\n __css={styles.link}\n {...rest}\n >\n {children}\n </ui.a>\n )\n },\n)\nBreadcrumbLink.displayName = \"BreadcrumbLink\"\nBreadcrumbLink.__ui__ = \"BreadcrumbLink\"\n\ninterface BreadcrumbSeparatorOptions {\n /**\n * The CSS `margin-inline-start`, and `margin-inline-end` property.\n */\n gap?: CSSUIObject[\"mx\"]\n}\n\nexport interface BreadcrumbSeparatorProps\n extends Omit<HTMLUIProps<\"span\">, \"gap\">,\n BreadcrumbSeparatorOptions {}\n\nexport const BreadcrumbSeparator = forwardRef<BreadcrumbSeparatorProps, \"span\">(\n ({ children, gap: mx, ...rest }, ref) => {\n const styles = useBreadcrumb()\n const css: CSSUIObject = {\n mx,\n ...styles.separator,\n }\n\n return (\n <ui.span\n ref={ref}\n className=\"ui-breadcrumb__item__separator\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.span>\n )\n },\n)\n\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\"\nBreadcrumbSeparator.__ui__ = \"BreadcrumbSeparator\"\n\ninterface BreadcrumbEllipsisOptions {}\n\nexport interface BreadcrumbEllipsisProps\n extends IconProps,\n BreadcrumbEllipsisOptions {}\n\nexport const BreadcrumbEllipsis = forwardRef<BreadcrumbEllipsisProps, \"span\">(\n ({ className, children, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n const css: CSSUIObject = {\n ...styles.ellipsis,\n }\n\n return (\n children ?? (\n <Icon\n ref={ref}\n className={cx(\"ui-breadcrumb__item__ellipsis\", className)}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 36 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-label=\"ellipsis\"\n __css={css}\n {...rest}\n >\n <circle cx=\"10\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"20\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"30\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n </Icon>\n )\n )\n },\n)\n\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\"\nBreadcrumbEllipsis.__ui__ = \"BreadcrumbEllipsis\"\n"],"mappings":";;;AASA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,UAAU,aAAa,eAAe;AA4IpB,cA6B7B,YA7B6B;AA1IzC,IAAM,CAAC,oBAAoB,aAAa,IAAI,cAEzC;AAAA,EACD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAuDM,IAAM,aAAa,WAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,cAAc,KAAK;AAExE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,MAAM;AAAA,IACN,QAAQ,CAAC;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB;AAAA,IACA,GAAG;AAAA,EACL,IAAI,eAAe,WAAW;AAC9B,MAAI,kBAAkB,SAAS,gBAAgB;AAC/C,MAAI,gBAAgB,SAAS,cAAc;AAE3C,MAAI,oBAAoB,EAAG,mBAAkB;AAC7C,MAAI,kBAAkB,EAAG,iBAAgB;AAEzC,MAAI,gBAAiB,yDAAkB;AACvC,MAAI,cAAe,+DAAoB;AAEvC,QAAM,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Ae,SAAS;AAajB,IAAM,sBAAsB;AAAA,EACjC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,KAAK,GAAG,QAAQ;AACvC,UAAM,SAAS,cAAc;AAC7B,UAAM,MAAmB;AAAA,MACvB;AAAA,MACA,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAU;AAAA,QACV,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,oBAAoB,cAAc;AAClC,oBAAoB,SAAS;AAQtB,IAAM,qBAAqB;AAAA,EAChC,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AACzC,UAAM,SAAS,cAAc;AAE7B,UAAM,MAAmB;AAAA,MACvB,GAAG,OAAO;AAAA,IACZ;AAEA,WACE,8BACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,iCAAiC,SAAS;AAAA,QACxD,QAAO;AAAA,QACP,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,aAAY;AAAA,QACZ,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,cAAW;AAAA,QACX,OAAO;AAAA,QACN,GAAG;AAAA,QAEJ;AAAA,8BAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,oBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,oBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA;AAAA;AAAA,IACpD;AAAA,EAGN;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":["rest","props"]}
|
1
|
+
{"version":3,"sources":["../src/breadcrumb.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n createContext,\n cx,\n getValidChildren,\n isNumber,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement, Fragment, useCallback, useMemo } from \"react\"\n\nconst [BreadcrumbProvider, useBreadcrumb] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: \"BreadcrumbContext\",\n errorMessage: `useBreadcrumb returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" `,\n})\n\nexport interface BreadcrumbGenerateItem extends BreadcrumbLinkProps {\n name?: ReactNode\n isEllipsisPage?: boolean\n containerProps?: Omit<BreadcrumbItemProps, \"isLastChild\">\n}\n\ninterface BreadcrumbOptions {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?:\n | ((props: { items: BreadcrumbGenerateItem[] }) => ReactNode)\n | ReactNode\n /**\n * Number of elements visible on the end(right) edges.\n */\n endBoundaries?: Token<number>\n /**\n * The left and right margin applied to the separator.\n *\n * @default '2'\n */\n gap?: CSSUIProps[\"mx\"]\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbGenerateItem[]\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n */\n startBoundaries?: Token<number>\n /**\n * Props for ol element.\n */\n listProps?: HTMLUIProps<\"ol\">\n}\n\nexport interface BreadcrumbProps\n extends Omit<HTMLUIProps<\"nav\">, \"gap\">,\n ThemeProps<\"Breadcrumb\">,\n BreadcrumbOptions {}\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see Docs https://yamada-ui.com/components/navigation/breadcrumb\n */\nexport const Breadcrumb = forwardRef<BreadcrumbProps, \"nav\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Breadcrumb\", props)\n\n const {\n className,\n children,\n ellipsis,\n endBoundaries: _endBoundaries,\n gap = \"fallback(2, 0.5rem)\",\n items = [],\n separator = \"/\",\n startBoundaries: _startBoundaries,\n listProps,\n ...rest\n } = omitThemeProps(mergedProps)\n let startBoundaries = useValue(_startBoundaries)\n let endBoundaries = useValue(_endBoundaries)\n\n if (startBoundaries === 0) startBoundaries = 1\n if (endBoundaries === 0) endBoundaries = 1\n\n if (startBoundaries) endBoundaries ??= 1\n if (endBoundaries) startBoundaries ??= 1\n\n const hasBoundaries = isNumber(startBoundaries) && isNumber(endBoundaries)\n const isExceed =\n hasBoundaries && startBoundaries! + endBoundaries! < items.length\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n ...styles.container,\n }\n\n const validChildren = getValidChildren(children)\n const hasChildren = validChildren.length\n\n const customEllipsis = useCallback(\n (providedItems?: BreadcrumbGenerateItem[]) => {\n if (!ellipsis) return null\n\n const resolvedItems =\n providedItems ??\n items.slice(startBoundaries!, items.length - endBoundaries!)\n\n return runIfFunc(ellipsis, { items: resolvedItems })\n },\n [ellipsis, endBoundaries, items, startBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n if (hasChildren) {\n return validChildren.map((child, index) =>\n cloneElement(child, {\n gap,\n isLastChild: validChildren.length === index + 1,\n separator,\n }),\n )\n } else {\n let hiddenEllipsis: BreadcrumbGenerateItem[] = []\n\n return items.map((item, index) => {\n const { name, isCurrentPage, isEllipsisPage, containerProps, ...rest } =\n item\n const isLastChild = items.length === index + 1\n const props: BreadcrumbItemProps = {\n gap,\n isCurrentPage,\n separator,\n ...containerProps,\n }\n\n if (!hasBoundaries && isEllipsisPage) {\n hiddenEllipsis.push(item)\n\n return isLastChild ? (\n <BreadcrumbItem key={index} {...props} isLastChild>\n {customEllipsis([item]) ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n ) : null\n }\n\n if (hasBoundaries && isExceed) {\n const lastIndex = items.length - index - 1\n\n if (startBoundaries! <= index && endBoundaries! <= lastIndex) {\n if (startBoundaries === index) {\n return (\n <BreadcrumbItem key={index} {...props}>\n {customEllipsis() ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n )\n } else {\n return null\n }\n }\n }\n\n if (hiddenEllipsis.length) {\n const resolvedEllipsis = customEllipsis(hiddenEllipsis) ?? (\n <BreadcrumbEllipsis />\n )\n\n hiddenEllipsis = []\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...props}>{resolvedEllipsis}</BreadcrumbItem>\n\n <BreadcrumbItem {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n )\n } else {\n return (\n <BreadcrumbItem key={index} {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n )\n }\n })\n }\n }, [\n hasChildren,\n validChildren,\n separator,\n gap,\n items,\n hasBoundaries,\n isExceed,\n startBoundaries,\n endBoundaries,\n customEllipsis,\n ])\n\n return (\n <BreadcrumbProvider value={styles}>\n <ui.nav\n ref={ref}\n className={cx(\"ui-breadcrumb\", className)}\n aria-label=\"Breadcrumb\"\n __css={styles.container}\n {...rest}\n >\n <ui.ol className=\"ui-breadcrumb__list\" {...listProps} __css={css}>\n {cloneChildren}\n </ui.ol>\n </ui.nav>\n </BreadcrumbProvider>\n )\n})\n\nBreadcrumb.displayName = \"Breadcrumb\"\nBreadcrumb.__ui__ = \"Breadcrumb\"\n\ninterface BreadcrumbItemOptions\n extends Pick<BreadcrumbProps, \"gap\" | \"separator\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n /**\n * If `true`, not show separator.\n *\n * @default false\n */\n isLastChild?: boolean\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<HTMLUIProps<\"li\">, \"gap\">,\n BreadcrumbItemOptions {}\n\nexport const BreadcrumbItem = forwardRef<BreadcrumbItemProps, \"li\">(\n (\n {\n className,\n children,\n gap,\n isCurrentPage,\n isLastChild,\n separator,\n ...rest\n },\n ref,\n ) => {\n const styles = useBreadcrumb()\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) => {\n if (child.type === BreadcrumbLink) {\n return cloneElement(child, {\n isCurrentPage,\n })\n }\n\n if (child.type === BreadcrumbSeparator) {\n return cloneElement(child, {\n children: child.props.children || separator,\n gap,\n })\n }\n\n return child\n })\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n ...styles.item,\n }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-breadcrumb__item\", className)}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n {!isLastChild ? (\n <BreadcrumbSeparator gap={gap}>{separator}</BreadcrumbSeparator>\n ) : null}\n </ui.li>\n )\n },\n)\n\nBreadcrumbItem.displayName = \"BreadcrumbItem\"\nBreadcrumbItem.__ui__ = \"BreadcrumbItem\"\n\ninterface BreadcrumbLinkOptions {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n}\n\nexport interface BreadcrumbLinkProps\n extends HTMLUIProps<\"a\">,\n BreadcrumbLinkOptions {}\n\nexport const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, \"a\">(\n ({ href, className, children, isCurrentPage, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n return (\n <ui.a\n ref={ref}\n as={!isCurrentPage ? \"a\" : \"span\"}\n href={!isCurrentPage ? href : undefined}\n className={cx(\"ui-breadcrumb__link\", className)}\n aria-current={isCurrentPage ? \"page\" : undefined}\n __css={styles.link}\n {...rest}\n >\n {children}\n </ui.a>\n )\n },\n)\nBreadcrumbLink.displayName = \"BreadcrumbLink\"\nBreadcrumbLink.__ui__ = \"BreadcrumbLink\"\n\ninterface BreadcrumbSeparatorOptions {\n /**\n * The CSS `margin-inline-start`, and `margin-inline-end` property.\n */\n gap?: CSSUIObject[\"mx\"]\n}\n\nexport interface BreadcrumbSeparatorProps\n extends Omit<HTMLUIProps<\"span\">, \"gap\">,\n BreadcrumbSeparatorOptions {}\n\nexport const BreadcrumbSeparator = forwardRef<BreadcrumbSeparatorProps, \"span\">(\n ({ children, gap: mx, ...rest }, ref) => {\n const styles = useBreadcrumb()\n const css: CSSUIObject = {\n mx,\n ...styles.separator,\n }\n\n return (\n <ui.span\n ref={ref}\n className=\"ui-breadcrumb__item__separator\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.span>\n )\n },\n)\n\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\"\nBreadcrumbSeparator.__ui__ = \"BreadcrumbSeparator\"\n\ninterface BreadcrumbEllipsisOptions {}\n\nexport interface BreadcrumbEllipsisProps\n extends IconProps,\n BreadcrumbEllipsisOptions {}\n\nexport const BreadcrumbEllipsis = forwardRef<BreadcrumbEllipsisProps, \"span\">(\n ({ className, children, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n const css: CSSUIObject = {\n ...styles.ellipsis,\n }\n\n return (\n children ?? (\n <Icon\n ref={ref}\n className={cx(\"ui-breadcrumb__item__ellipsis\", className)}\n aria-label=\"ellipsis\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 36 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n __css={css}\n {...rest}\n >\n <circle cx=\"10\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"20\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"30\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n </Icon>\n )\n )\n },\n)\n\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\"\nBreadcrumbEllipsis.__ui__ = \"BreadcrumbEllipsis\"\n"],"mappings":";;;AASA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,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AG,KAAK,GAAG,QAAQ;AACzC,UAAM,SAAS,cAAc;AAE7B,UAAM,MAAmB;AAAA,MACvB,GAAG,OAAO;AAAA,IACZ;AAEA,WACE,8BACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,iCAAiC,SAAS;AAAA,QACxD,cAAW;AAAA,QACX,QAAO;AAAA,QACP,eAAc;AAAA,QACd,gBAAe;AAAA,QACf,aAAY;AAAA,QACZ,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,OAAO;AAAA,QACN,GAAG;AAAA,QAEJ;AAAA,8BAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,oBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,oBAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA;AAAA;AAAA,IACpD;AAAA,EAGN;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":["rest","props"]}
|
package/dist/index.js
CHANGED
@@ -199,15 +199,15 @@ var BreadcrumbItem = (0, import_core.forwardRef)(
|
|
199
199
|
BreadcrumbItem.displayName = "BreadcrumbItem";
|
200
200
|
BreadcrumbItem.__ui__ = "BreadcrumbItem";
|
201
201
|
var BreadcrumbLink = (0, import_core.forwardRef)(
|
202
|
-
({ className, children,
|
202
|
+
({ href, className, children, isCurrentPage, ...rest }, ref) => {
|
203
203
|
const styles = useBreadcrumb();
|
204
204
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
205
205
|
import_core.ui.a,
|
206
206
|
{
|
207
207
|
ref,
|
208
208
|
as: !isCurrentPage ? "a" : "span",
|
209
|
-
className: (0, import_utils.cx)("ui-breadcrumb__link", className),
|
210
209
|
href: !isCurrentPage ? href : void 0,
|
210
|
+
className: (0, import_utils.cx)("ui-breadcrumb__link", className),
|
211
211
|
"aria-current": isCurrentPage ? "page" : void 0,
|
212
212
|
__css: styles.link,
|
213
213
|
...rest,
|
@@ -250,13 +250,13 @@ var BreadcrumbEllipsis = (0, import_core.forwardRef)(
|
|
250
250
|
{
|
251
251
|
ref,
|
252
252
|
className: (0, import_utils.cx)("ui-breadcrumb__item__ellipsis", className),
|
253
|
+
"aria-label": "ellipsis",
|
253
254
|
stroke: "currentColor",
|
254
255
|
strokeLinecap: "round",
|
255
256
|
strokeLinejoin: "round",
|
256
257
|
strokeWidth: "1.5",
|
257
258
|
viewBox: "0 0 36 24",
|
258
259
|
xmlns: "http://www.w3.org/2000/svg",
|
259
|
-
"aria-label": "ellipsis",
|
260
260
|
__css: css,
|
261
261
|
...rest,
|
262
262
|
children: [
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/breadcrumb.tsx"],"sourcesContent":["export {\n Breadcrumb,\n BreadcrumbEllipsis,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbSeparator,\n} from \"./breadcrumb\"\nexport type {\n BreadcrumbEllipsisProps,\n BreadcrumbGenerateItem,\n BreadcrumbItemProps,\n BreadcrumbLinkProps,\n BreadcrumbProps,\n BreadcrumbSeparatorProps,\n} from \"./breadcrumb\"\n","import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n createContext,\n cx,\n getValidChildren,\n isNumber,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement, Fragment, useCallback, useMemo } from \"react\"\n\nconst [BreadcrumbProvider, useBreadcrumb] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: \"BreadcrumbContext\",\n errorMessage: `useBreadcrumb returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" `,\n})\n\nexport interface BreadcrumbGenerateItem extends BreadcrumbLinkProps {\n name?: ReactNode\n isEllipsisPage?: boolean\n containerProps?: Omit<BreadcrumbItemProps, \"isLastChild\">\n}\n\ninterface BreadcrumbOptions {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?:\n | ((props: { items: BreadcrumbGenerateItem[] }) => ReactNode)\n | ReactNode\n /**\n * Number of elements visible on the end(right) edges.\n */\n endBoundaries?: Token<number>\n /**\n * The left and right margin applied to the separator.\n *\n * @default '2'\n */\n gap?: CSSUIProps[\"mx\"]\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbGenerateItem[]\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n */\n startBoundaries?: Token<number>\n /**\n * Props for ol element.\n */\n listProps?: HTMLUIProps<\"ol\">\n}\n\nexport interface BreadcrumbProps\n extends Omit<HTMLUIProps<\"nav\">, \"gap\">,\n ThemeProps<\"Breadcrumb\">,\n BreadcrumbOptions {}\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see Docs https://yamada-ui.com/components/navigation/breadcrumb\n */\nexport const Breadcrumb = forwardRef<BreadcrumbProps, \"nav\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Breadcrumb\", props)\n\n const {\n className,\n children,\n ellipsis,\n endBoundaries: _endBoundaries,\n gap = \"fallback(2, 0.5rem)\",\n items = [],\n separator = \"/\",\n startBoundaries: _startBoundaries,\n listProps,\n ...rest\n } = omitThemeProps(mergedProps)\n let startBoundaries = useValue(_startBoundaries)\n let endBoundaries = useValue(_endBoundaries)\n\n if (startBoundaries === 0) startBoundaries = 1\n if (endBoundaries === 0) endBoundaries = 1\n\n if (startBoundaries) endBoundaries ??= 1\n if (endBoundaries) startBoundaries ??= 1\n\n const hasBoundaries = isNumber(startBoundaries) && isNumber(endBoundaries)\n const isExceed =\n hasBoundaries && startBoundaries! + endBoundaries! < items.length\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n ...styles.container,\n }\n\n const validChildren = getValidChildren(children)\n const hasChildren = validChildren.length\n\n const customEllipsis = useCallback(\n (providedItems?: BreadcrumbGenerateItem[]) => {\n if (!ellipsis) return null\n\n const resolvedItems =\n providedItems ??\n items.slice(startBoundaries!, items.length - endBoundaries!)\n\n return runIfFunc(ellipsis, { items: resolvedItems })\n },\n [ellipsis, endBoundaries, items, startBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n if (hasChildren) {\n return validChildren.map((child, index) =>\n cloneElement(child, {\n gap,\n isLastChild: validChildren.length === index + 1,\n separator,\n }),\n )\n } else {\n let hiddenEllipsis: BreadcrumbGenerateItem[] = []\n\n return items.map((item, index) => {\n const { name, isCurrentPage, isEllipsisPage, containerProps, ...rest } =\n item\n const isLastChild = items.length === index + 1\n const props: BreadcrumbItemProps = {\n gap,\n isCurrentPage,\n separator,\n ...containerProps,\n }\n\n if (!hasBoundaries && isEllipsisPage) {\n hiddenEllipsis.push(item)\n\n return isLastChild ? (\n <BreadcrumbItem key={index} {...props} isLastChild>\n {customEllipsis([item]) ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n ) : null\n }\n\n if (hasBoundaries && isExceed) {\n const lastIndex = items.length - index - 1\n\n if (startBoundaries! <= index && endBoundaries! <= lastIndex) {\n if (startBoundaries === index) {\n return (\n <BreadcrumbItem key={index} {...props}>\n {customEllipsis() ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n )\n } else {\n return null\n }\n }\n }\n\n if (hiddenEllipsis.length) {\n const resolvedEllipsis = customEllipsis(hiddenEllipsis) ?? (\n <BreadcrumbEllipsis />\n )\n\n hiddenEllipsis = []\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...props}>{resolvedEllipsis}</BreadcrumbItem>\n\n <BreadcrumbItem {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n )\n } else {\n return (\n <BreadcrumbItem key={index} {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n )\n }\n })\n }\n }, [\n hasChildren,\n validChildren,\n separator,\n gap,\n items,\n hasBoundaries,\n isExceed,\n startBoundaries,\n endBoundaries,\n customEllipsis,\n ])\n\n return (\n <BreadcrumbProvider value={styles}>\n <ui.nav\n ref={ref}\n className={cx(\"ui-breadcrumb\", className)}\n aria-label=\"Breadcrumb\"\n __css={styles.container}\n {...rest}\n >\n <ui.ol className=\"ui-breadcrumb__list\" {...listProps} __css={css}>\n {cloneChildren}\n </ui.ol>\n </ui.nav>\n </BreadcrumbProvider>\n )\n})\n\nBreadcrumb.displayName = \"Breadcrumb\"\nBreadcrumb.__ui__ = \"Breadcrumb\"\n\ninterface BreadcrumbItemOptions\n extends Pick<BreadcrumbProps, \"gap\" | \"separator\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n /**\n * If `true`, not show separator.\n *\n * @default false\n */\n isLastChild?: boolean\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<HTMLUIProps<\"li\">, \"gap\">,\n BreadcrumbItemOptions {}\n\nexport const BreadcrumbItem = forwardRef<BreadcrumbItemProps, \"li\">(\n (\n {\n className,\n children,\n gap,\n isCurrentPage,\n isLastChild,\n separator,\n ...rest\n },\n ref,\n ) => {\n const styles = useBreadcrumb()\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) => {\n if (child.type === BreadcrumbLink) {\n return cloneElement(child, {\n isCurrentPage,\n })\n }\n\n if (child.type === BreadcrumbSeparator) {\n return cloneElement(child, {\n children: child.props.children || separator,\n gap,\n })\n }\n\n return child\n })\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n ...styles.item,\n }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-breadcrumb__item\", className)}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n {!isLastChild ? (\n <BreadcrumbSeparator gap={gap}>{separator}</BreadcrumbSeparator>\n ) : null}\n </ui.li>\n )\n },\n)\n\nBreadcrumbItem.displayName = \"BreadcrumbItem\"\nBreadcrumbItem.__ui__ = \"BreadcrumbItem\"\n\ninterface BreadcrumbLinkOptions {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n}\n\nexport interface BreadcrumbLinkProps\n extends HTMLUIProps<\"a\">,\n BreadcrumbLinkOptions {}\n\nexport const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, \"a\">(\n ({ className, children, href, isCurrentPage, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n return (\n <ui.a\n ref={ref}\n as={!isCurrentPage ? \"a\" : \"span\"}\n className={cx(\"ui-breadcrumb__link\", className)}\n href={!isCurrentPage ? href : undefined}\n aria-current={isCurrentPage ? \"page\" : undefined}\n __css={styles.link}\n {...rest}\n >\n {children}\n </ui.a>\n )\n },\n)\nBreadcrumbLink.displayName = \"BreadcrumbLink\"\nBreadcrumbLink.__ui__ = \"BreadcrumbLink\"\n\ninterface BreadcrumbSeparatorOptions {\n /**\n * The CSS `margin-inline-start`, and `margin-inline-end` property.\n */\n gap?: CSSUIObject[\"mx\"]\n}\n\nexport interface BreadcrumbSeparatorProps\n extends Omit<HTMLUIProps<\"span\">, \"gap\">,\n BreadcrumbSeparatorOptions {}\n\nexport const BreadcrumbSeparator = forwardRef<BreadcrumbSeparatorProps, \"span\">(\n ({ children, gap: mx, ...rest }, ref) => {\n const styles = useBreadcrumb()\n const css: CSSUIObject = {\n mx,\n ...styles.separator,\n }\n\n return (\n <ui.span\n ref={ref}\n className=\"ui-breadcrumb__item__separator\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.span>\n )\n },\n)\n\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\"\nBreadcrumbSeparator.__ui__ = \"BreadcrumbSeparator\"\n\ninterface BreadcrumbEllipsisOptions {}\n\nexport interface BreadcrumbEllipsisProps\n extends IconProps,\n BreadcrumbEllipsisOptions {}\n\nexport const BreadcrumbEllipsis = forwardRef<BreadcrumbEllipsisProps, \"span\">(\n ({ className, children, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n const css: CSSUIObject = {\n ...styles.ellipsis,\n }\n\n return (\n children ?? (\n <Icon\n ref={ref}\n className={cx(\"ui-breadcrumb__item__ellipsis\", className)}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 36 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-label=\"ellipsis\"\n __css={css}\n {...rest}\n >\n <circle cx=\"10\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"20\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"30\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n </Icon>\n )\n )\n },\n)\n\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\"\nBreadcrumbEllipsis.__ui__ = \"BreadcrumbEllipsis\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSA,kBAKO;AACP,kBAAqB;AACrB,uBAAyB;AACzB,mBAMO;AACP,mBAA6D;AA4IpB;AA1IzC,IAAM,CAAC,oBAAoB,aAAa,QAAI,4BAEzC;AAAA,EACD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAuDM,IAAM,iBAAa,wBAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,cAAc,KAAK;AAExE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AA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AAA,UAClD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA,UAClD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,MAAK,gBAAe,GAAE,KAAI;AAAA;AAAA;AAAA,IACpD;AAAA,EAGN;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;","names":["rest","props"]}
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/breadcrumb.tsx"],"sourcesContent":["export {\n Breadcrumb,\n BreadcrumbEllipsis,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbSeparator,\n} from \"./breadcrumb\"\nexport type {\n BreadcrumbEllipsisProps,\n BreadcrumbGenerateItem,\n BreadcrumbItemProps,\n BreadcrumbLinkProps,\n BreadcrumbProps,\n BreadcrumbSeparatorProps,\n} from \"./breadcrumb\"\n","import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n createContext,\n cx,\n getValidChildren,\n isNumber,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement, Fragment, useCallback, useMemo } from \"react\"\n\nconst [BreadcrumbProvider, useBreadcrumb] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: \"BreadcrumbContext\",\n errorMessage: `useBreadcrumb returned is 'undefined'. Seems you forgot to wrap the components in \"<Breadcrumb />\" `,\n})\n\nexport interface BreadcrumbGenerateItem extends BreadcrumbLinkProps {\n name?: ReactNode\n isEllipsisPage?: boolean\n containerProps?: Omit<BreadcrumbItemProps, \"isLastChild\">\n}\n\ninterface BreadcrumbOptions {\n /**\n * The icon to be used in the ellipsis.\n */\n ellipsis?:\n | ((props: { items: BreadcrumbGenerateItem[] }) => ReactNode)\n | ReactNode\n /**\n * Number of elements visible on the end(right) edges.\n */\n endBoundaries?: Token<number>\n /**\n * The left and right margin applied to the separator.\n *\n * @default '2'\n */\n gap?: CSSUIProps[\"mx\"]\n /**\n * If provided, generate breadcrumb items based on items.\n */\n items?: BreadcrumbGenerateItem[]\n /**\n * The visual separator between each breadcrumb item.\n *\n * @default '/'\n */\n separator?: ReactElement | string\n /**\n * Number of elements visible on the start(left) edges.\n */\n startBoundaries?: Token<number>\n /**\n * Props for ol element.\n */\n listProps?: HTMLUIProps<\"ol\">\n}\n\nexport interface BreadcrumbProps\n extends Omit<HTMLUIProps<\"nav\">, \"gap\">,\n ThemeProps<\"Breadcrumb\">,\n BreadcrumbOptions {}\n\n/**\n * `Breadcrumb` is a component that helps users understand the hierarchy of a website.\n *\n * @see Docs https://yamada-ui.com/components/navigation/breadcrumb\n */\nexport const Breadcrumb = forwardRef<BreadcrumbProps, \"nav\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Breadcrumb\", props)\n\n const {\n className,\n children,\n ellipsis,\n endBoundaries: _endBoundaries,\n gap = \"fallback(2, 0.5rem)\",\n items = [],\n separator = \"/\",\n startBoundaries: _startBoundaries,\n listProps,\n ...rest\n } = omitThemeProps(mergedProps)\n let startBoundaries = useValue(_startBoundaries)\n let endBoundaries = useValue(_endBoundaries)\n\n if (startBoundaries === 0) startBoundaries = 1\n if (endBoundaries === 0) endBoundaries = 1\n\n if (startBoundaries) endBoundaries ??= 1\n if (endBoundaries) startBoundaries ??= 1\n\n const hasBoundaries = isNumber(startBoundaries) && isNumber(endBoundaries)\n const isExceed =\n hasBoundaries && startBoundaries! + endBoundaries! < items.length\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n ...styles.container,\n }\n\n const validChildren = getValidChildren(children)\n const hasChildren = validChildren.length\n\n const customEllipsis = useCallback(\n (providedItems?: BreadcrumbGenerateItem[]) => {\n if (!ellipsis) return null\n\n const resolvedItems =\n providedItems ??\n items.slice(startBoundaries!, items.length - endBoundaries!)\n\n return runIfFunc(ellipsis, { items: resolvedItems })\n },\n [ellipsis, endBoundaries, items, startBoundaries],\n )\n\n const cloneChildren = useMemo(() => {\n if (hasChildren) {\n return validChildren.map((child, index) =>\n cloneElement(child, {\n gap,\n isLastChild: validChildren.length === index + 1,\n separator,\n }),\n )\n } else {\n let hiddenEllipsis: BreadcrumbGenerateItem[] = []\n\n return items.map((item, index) => {\n const { name, isCurrentPage, isEllipsisPage, containerProps, ...rest } =\n item\n const isLastChild = items.length === index + 1\n const props: BreadcrumbItemProps = {\n gap,\n isCurrentPage,\n separator,\n ...containerProps,\n }\n\n if (!hasBoundaries && isEllipsisPage) {\n hiddenEllipsis.push(item)\n\n return isLastChild ? (\n <BreadcrumbItem key={index} {...props} isLastChild>\n {customEllipsis([item]) ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n ) : null\n }\n\n if (hasBoundaries && isExceed) {\n const lastIndex = items.length - index - 1\n\n if (startBoundaries! <= index && endBoundaries! <= lastIndex) {\n if (startBoundaries === index) {\n return (\n <BreadcrumbItem key={index} {...props}>\n {customEllipsis() ?? <BreadcrumbEllipsis />}\n </BreadcrumbItem>\n )\n } else {\n return null\n }\n }\n }\n\n if (hiddenEllipsis.length) {\n const resolvedEllipsis = customEllipsis(hiddenEllipsis) ?? (\n <BreadcrumbEllipsis />\n )\n\n hiddenEllipsis = []\n\n return (\n <Fragment key={index}>\n <BreadcrumbItem {...props}>{resolvedEllipsis}</BreadcrumbItem>\n\n <BreadcrumbItem {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n </Fragment>\n )\n } else {\n return (\n <BreadcrumbItem key={index} {...props} isLastChild={isLastChild}>\n <BreadcrumbLink {...rest}>{name}</BreadcrumbLink>\n </BreadcrumbItem>\n )\n }\n })\n }\n }, [\n hasChildren,\n validChildren,\n separator,\n gap,\n items,\n hasBoundaries,\n isExceed,\n startBoundaries,\n endBoundaries,\n customEllipsis,\n ])\n\n return (\n <BreadcrumbProvider value={styles}>\n <ui.nav\n ref={ref}\n className={cx(\"ui-breadcrumb\", className)}\n aria-label=\"Breadcrumb\"\n __css={styles.container}\n {...rest}\n >\n <ui.ol className=\"ui-breadcrumb__list\" {...listProps} __css={css}>\n {cloneChildren}\n </ui.ol>\n </ui.nav>\n </BreadcrumbProvider>\n )\n})\n\nBreadcrumb.displayName = \"Breadcrumb\"\nBreadcrumb.__ui__ = \"Breadcrumb\"\n\ninterface BreadcrumbItemOptions\n extends Pick<BreadcrumbProps, \"gap\" | \"separator\"> {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n /**\n * If `true`, not show separator.\n *\n * @default false\n */\n isLastChild?: boolean\n}\n\nexport interface BreadcrumbItemProps\n extends Omit<HTMLUIProps<\"li\">, \"gap\">,\n BreadcrumbItemOptions {}\n\nexport const BreadcrumbItem = forwardRef<BreadcrumbItemProps, \"li\">(\n (\n {\n className,\n children,\n gap,\n isCurrentPage,\n isLastChild,\n separator,\n ...rest\n },\n ref,\n ) => {\n const styles = useBreadcrumb()\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) => {\n if (child.type === BreadcrumbLink) {\n return cloneElement(child, {\n isCurrentPage,\n })\n }\n\n if (child.type === BreadcrumbSeparator) {\n return cloneElement(child, {\n children: child.props.children || separator,\n gap,\n })\n }\n\n return child\n })\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n ...styles.item,\n }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-breadcrumb__item\", className)}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n {!isLastChild ? (\n <BreadcrumbSeparator gap={gap}>{separator}</BreadcrumbSeparator>\n ) : null}\n </ui.li>\n )\n },\n)\n\nBreadcrumbItem.displayName = \"BreadcrumbItem\"\nBreadcrumbItem.__ui__ = \"BreadcrumbItem\"\n\ninterface BreadcrumbLinkOptions {\n /**\n * If `true`, change to span element.\n *\n * @default false\n */\n isCurrentPage?: boolean\n}\n\nexport interface BreadcrumbLinkProps\n extends HTMLUIProps<\"a\">,\n BreadcrumbLinkOptions {}\n\nexport const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, \"a\">(\n ({ href, className, children, isCurrentPage, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n return (\n <ui.a\n ref={ref}\n as={!isCurrentPage ? \"a\" : \"span\"}\n href={!isCurrentPage ? href : undefined}\n className={cx(\"ui-breadcrumb__link\", className)}\n aria-current={isCurrentPage ? \"page\" : undefined}\n __css={styles.link}\n {...rest}\n >\n {children}\n </ui.a>\n )\n },\n)\nBreadcrumbLink.displayName = \"BreadcrumbLink\"\nBreadcrumbLink.__ui__ = \"BreadcrumbLink\"\n\ninterface BreadcrumbSeparatorOptions {\n /**\n * The CSS `margin-inline-start`, and `margin-inline-end` property.\n */\n gap?: CSSUIObject[\"mx\"]\n}\n\nexport interface BreadcrumbSeparatorProps\n extends Omit<HTMLUIProps<\"span\">, \"gap\">,\n BreadcrumbSeparatorOptions {}\n\nexport const BreadcrumbSeparator = forwardRef<BreadcrumbSeparatorProps, \"span\">(\n ({ children, gap: mx, ...rest }, ref) => {\n const styles = useBreadcrumb()\n const css: CSSUIObject = {\n mx,\n ...styles.separator,\n }\n\n return (\n <ui.span\n ref={ref}\n className=\"ui-breadcrumb__item__separator\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.span>\n )\n },\n)\n\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\"\nBreadcrumbSeparator.__ui__ = \"BreadcrumbSeparator\"\n\ninterface BreadcrumbEllipsisOptions {}\n\nexport interface BreadcrumbEllipsisProps\n extends IconProps,\n BreadcrumbEllipsisOptions {}\n\nexport const BreadcrumbEllipsis = forwardRef<BreadcrumbEllipsisProps, \"span\">(\n ({ className, children, ...rest }, ref) => {\n const styles = useBreadcrumb()\n\n const css: CSSUIObject = {\n ...styles.ellipsis,\n }\n\n return (\n children ?? (\n <Icon\n ref={ref}\n className={cx(\"ui-breadcrumb__item__ellipsis\", className)}\n aria-label=\"ellipsis\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 36 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n __css={css}\n {...rest}\n >\n <circle cx=\"10\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"20\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n <circle cx=\"30\" cy=\"12\" fill=\"currentColor\" r=\"2\" />\n </Icon>\n )\n )\n },\n)\n\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\"\nBreadcrumbEllipsis.__ui__ = \"BreadcrumbEllipsis\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSA,kBAKO;AACP,kBAAqB;AACrB,uBAAyB;AACzB,mBAMO;AACP,mBAA6D;AA4IpB;AA1IzC,IAAM,CAAC,oBAAoB,aAAa,QAAI,4BAEzC;AAAA,EACD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAuDM,IAAM,iBAAa,wBAAmC,CAAC,OAAO,QAAQ;AAC3E,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,cAAc,KAAK;AAExE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,MAAM;AAAA,IACN,QAAQ,CAAC;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB;AAAA,IACA,GAAG;AAAA,EACL,QAAI,4BAAe,WAAW;AAC9B,MAAI,sBAAkB,2BAAS,gBAAgB;AAC/C,MAAI,oBAAgB,2BAAS,cAAc;AAE3C,MAAI,oBAAoB,EAAG,mBAAkB;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
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@yamada-ui/breadcrumb",
|
3
|
-
"version": "1.3.13-dev-
|
3
|
+
"version": "1.3.13-dev-20241007155115",
|
4
4
|
"description": "Yamada UI breadcrumb component",
|
5
5
|
"keywords": [
|
6
6
|
"yamada",
|
@@ -36,10 +36,10 @@
|
|
36
36
|
"url": "https://github.com/yamada-ui/yamada-ui/issues"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@yamada-ui/core": "1.15.2-dev-
|
40
|
-
"@yamada-ui/icon": "1.1.8-dev-
|
41
|
-
"@yamada-ui/use-value": "1.1.27-dev-
|
42
|
-
"@yamada-ui/utils": "1.5.3-dev-
|
39
|
+
"@yamada-ui/core": "1.15.2-dev-20241007155115",
|
40
|
+
"@yamada-ui/icon": "1.1.8-dev-20241007155115",
|
41
|
+
"@yamada-ui/use-value": "1.1.27-dev-20241007155115",
|
42
|
+
"@yamada-ui/utils": "1.5.3-dev-20241007155115"
|
43
43
|
},
|
44
44
|
"devDependencies": {
|
45
45
|
"clean-package": "2.2.0",
|