feat(breadcrumb)!: integrate Breadcrumb with v11 (#1956)

This commit is contained in:
Eric Liu 2024-04-21 12:14:51 -07:00 committed by GitHub
commit 1600308614
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 94 additions and 154 deletions

View file

@ -1,27 +1,20 @@
import type { SvelteComponentTyped } from "svelte";
import type { BreadcrumbSkeletonProps } from "./BreadcrumbSkeleton.svelte";
import type { SvelteHTMLElements } from "svelte/elements";
export interface BreadcrumbProps extends BreadcrumbSkeletonProps {
type RestProps = SvelteHTMLElements["nav"];
export interface BreadcrumbProps extends RestProps {
/**
* Set to `true` to hide the breadcrumb trailing slash
* @default false
*/
noTrailingSlash?: boolean;
/**
* Set to `true` to display skeleton state
* @default false
*/
skeleton?: boolean;
[key: `data-${string}`]: any;
}
export default class Breadcrumb extends SvelteComponentTyped<
BreadcrumbProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
Record<string, any>,
{ default: {} }
> {}

View file

@ -5,7 +5,8 @@ type RestProps = SvelteHTMLElements["li"];
export interface BreadcrumbItemProps extends RestProps {
/**
* Set the `href` to use an anchor link
* Set the `href` to use an anchor link.
* The `Link` component is used if `href` is set.
* @default undefined
*/
href?: string;
@ -27,5 +28,9 @@ export default class BreadcrumbItem extends SvelteComponentTyped<
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{ default: { props?: { ["aria-current"]?: string; class: "bx--link" } } }
{
default: {
props?: Pick<AriaAttributes, "aria-current"> & { class: "bx--link" };
};
}
> {}

View file

@ -21,11 +21,6 @@ export interface BreadcrumbSkeletonProps extends RestProps {
export default class BreadcrumbSkeleton extends SvelteComponentTyped<
BreadcrumbSkeletonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
Record<string, any>,
{}
> {}