@ssa-ui-kit/core 3.17.0 → 3.19.0

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.
@@ -0,0 +1,12 @@
1
+ import { BreadcrumbSibling } from './types';
2
+ export interface BreadcrumbMenuProps {
3
+ /** Element that opens the menu on hover/click. Must forward a ref. */
4
+ trigger: React.ReactElement;
5
+ /** Navigable options shown inside the menu. */
6
+ items: BreadcrumbSibling[];
7
+ }
8
+ /**
9
+ * A hover/click popover listing navigable routes. Shared by the collapsed `…`
10
+ * crumb and, in the route-aware mode, by crumbs that expose sibling routes.
11
+ */
12
+ export declare const BreadcrumbMenu: ({ trigger, items }: BreadcrumbMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { BreadcrumbsProps } from './types';
2
+ /**
3
+ * Breadcrumbs — navigational trail of the current page's location.
4
+ *
5
+ * Accepts a list of `{ label, to }` items and renders them as react-router
6
+ * links separated by a chevron, with the current (last) crumb shown as a
7
+ * non-navigable, emphasised label. When the trail is longer than `maxItems`
8
+ * it collapses to `first … last`, with the hidden crumbs available from the
9
+ * `…` menu.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <Breadcrumbs
14
+ * maxItems={4}
15
+ * items={[
16
+ * { label: 'Home', to: '/' },
17
+ * { label: 'People', to: '/people' },
18
+ * { label: 'Jane Doe' },
19
+ * ]}
20
+ * />
21
+ * ```
22
+ */
23
+ export declare const Breadcrumbs: ({ items, maxItems, separator, ariaLabel, className, css, }: BreadcrumbsProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ export { Breadcrumbs } from './Breadcrumbs';
2
+ export { BreadcrumbMenu } from './BreadcrumbMenu';
3
+ export { useBreadcrumbs, deriveBreadcrumbs } from './useBreadcrumbs';
4
+ export type { BreadcrumbsProps, BreadcrumbItem, BreadcrumbSibling, } from './types';
5
+ export type { UseBreadcrumbsOptions, BreadcrumbRouteHandle, BreadcrumbMatchContext, } from './useBreadcrumbs';
@@ -0,0 +1,9 @@
1
+ export declare const nav: import("@emotion/react").SerializedStyles;
2
+ export declare const list: import("@emotion/react").SerializedStyles;
3
+ export declare const item: import("@emotion/react").SerializedStyles;
4
+ export declare const separator: import("@emotion/react").SerializedStyles;
5
+ export declare const crumbLink: import("@emotion/react").SerializedStyles;
6
+ export declare const crumbText: import("@emotion/react").SerializedStyles;
7
+ export declare const crumbCurrent: import("@emotion/react").SerializedStyles;
8
+ export declare const menu: import("@emotion/react").SerializedStyles;
9
+ export declare const menuItem: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,57 @@
1
+ import { Interpolation, Theme } from '@emotion/react';
2
+ import { To } from 'react-router-dom';
3
+ import { CommonProps } from '../../types/emotion';
4
+ /**
5
+ * A sibling route option shown in a breadcrumb's hover menu.
6
+ *
7
+ * Reserved for the route-aware mode (Mode 2): when a crumb carries `siblings`,
8
+ * the crumb becomes a hover target that reveals these alternative routes.
9
+ */
10
+ export interface BreadcrumbSibling {
11
+ label: React.ReactNode;
12
+ to: To;
13
+ }
14
+ /**
15
+ * A single breadcrumb entry.
16
+ *
17
+ * In the "dummy" mode you build these by hand. In the future route-aware mode
18
+ * the same shape is produced from the router matches, so the presentational
19
+ * `Breadcrumbs` component never needs to know which mode produced it.
20
+ */
21
+ export interface BreadcrumbItem {
22
+ /** Visible label for the crumb. */
23
+ label: React.ReactNode;
24
+ /**
25
+ * react-router destination. Omit for a non-navigable crumb (e.g. the current
26
+ * page). When present, the crumb navigates via react-router.
27
+ */
28
+ to?: To;
29
+ /**
30
+ * Force the "current page" styling (blue, semibold, non-link). When not set,
31
+ * the last item in the list is treated as current automatically.
32
+ */
33
+ isCurrent?: boolean;
34
+ /** Optional click handler, fired in addition to navigation. */
35
+ onClick?: () => void;
36
+ /**
37
+ * Sibling routes for this crumb. When provided, the crumb reveals a hover
38
+ * menu offering these alternatives. Populated by the route-aware mode.
39
+ */
40
+ siblings?: BreadcrumbSibling[];
41
+ }
42
+ export interface BreadcrumbsProps extends CommonProps {
43
+ /** Ordered list of crumbs, root first, current page last. */
44
+ items: BreadcrumbItem[];
45
+ /**
46
+ * Collapse the trail into `first … last` once the number of items exceeds
47
+ * this value. The collapsed middle crumbs are revealed from the `…` menu.
48
+ * When omitted, the full trail is always shown.
49
+ */
50
+ maxItems?: number;
51
+ /** Custom separator between crumbs. Defaults to a right chevron. */
52
+ separator?: React.ReactNode;
53
+ /** Accessible label for the wrapping `nav`. */
54
+ ariaLabel?: string;
55
+ /** Custom Emotion styles applied to the wrapping `nav`. */
56
+ css?: Interpolation<Theme>;
57
+ }
@@ -0,0 +1,54 @@
1
+ import { RouteObject } from 'react-router-dom';
2
+ import { BreadcrumbItem } from './types';
3
+ /** Context passed to a route's `crumb` resolver function. */
4
+ export interface BreadcrumbMatchContext {
5
+ params: Record<string, string | undefined>;
6
+ pathname: string;
7
+ }
8
+ /**
9
+ * Shape read from a route's `handle` to build its crumb. Attach this to routes
10
+ * in your `createBrowserRouter` config:
11
+ *
12
+ * ```ts
13
+ * { path: 'people', handle: { crumb: 'People' } as BreadcrumbRouteHandle }
14
+ * ```
15
+ */
16
+ export interface BreadcrumbRouteHandle {
17
+ /** Static label, or a resolver receiving the matched params/pathname. */
18
+ crumb?: React.ReactNode | ((ctx: BreadcrumbMatchContext) => React.ReactNode);
19
+ /** Fallback label used when `crumb` is absent (e.g. a page title). */
20
+ title?: React.ReactNode;
21
+ /** Explicitly exclude this route from the trail even if it has a title. */
22
+ hideCrumb?: boolean;
23
+ }
24
+ export interface UseBreadcrumbsOptions {
25
+ /** The route tree — the same array passed to `createBrowserRouter`. */
26
+ routes: RouteObject[];
27
+ /** Path to resolve against. Defaults to the current location. */
28
+ pathname?: string;
29
+ /** Attach sibling routes for the hover menu. Defaults to `true`. */
30
+ includeSiblings?: boolean;
31
+ /**
32
+ * Last-resort label resolver, called when a matched route has no
33
+ * `handle.crumb`/`handle.title`. Return `null`/`undefined` to skip the crumb.
34
+ */
35
+ getLabel?: (route: RouteObject, ctx: BreadcrumbMatchContext) => React.ReactNode;
36
+ }
37
+ /**
38
+ * Pure derivation of breadcrumb items from a route tree and a pathname.
39
+ * Extracted from the hook so it can be unit-tested without a router.
40
+ */
41
+ export declare const deriveBreadcrumbs: (routes: RouteObject[], pathname: string, { includeSiblings, getLabel }?: Partial<UseBreadcrumbsOptions>) => BreadcrumbItem[];
42
+ /**
43
+ * Route-aware breadcrumb builder. Reads the current location, matches it
44
+ * against your route tree, and returns `BreadcrumbItem[]` ready for
45
+ * `<Breadcrumbs>`. Labels come from each route's `handle.crumb`/`handle.title`;
46
+ * sibling routes (other children of a crumb's parent) power the hover menu.
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * const items = useBreadcrumbs({ routes });
51
+ * return <Breadcrumbs items={items} maxItems={4} />;
52
+ * ```
53
+ */
54
+ export declare const useBreadcrumbs: ({ routes, pathname, includeSiblings, getLabel, }: UseBreadcrumbsOptions) => BreadcrumbItem[];
@@ -0,0 +1,17 @@
1
+ import { BreadcrumbItem } from './types';
2
+ /** A rendered slot in the trail: either a real crumb or the collapsed `…`. */
3
+ export type BreadcrumbEntry = {
4
+ type: 'item';
5
+ item: BreadcrumbItem;
6
+ index: number;
7
+ } | {
8
+ type: 'ellipsis';
9
+ items: BreadcrumbItem[];
10
+ };
11
+ /**
12
+ * Collapse the trail to `first … last` when it exceeds `maxItems`, per design.
13
+ * The hidden middle crumbs are returned on the ellipsis entry so they can be
14
+ * offered from its menu. When `maxItems` is falsy or not exceeded, every item
15
+ * is returned as-is.
16
+ */
17
+ export declare const collapseItems: (items: BreadcrumbItem[], maxItems?: number) => BreadcrumbEntry[];
@@ -8,7 +8,7 @@
8
8
  * - **`both`** — a standalone selection (or a one-cell range), fully rounded
9
9
  */
10
10
  export type RangeEdge = 'start' | 'end' | 'both';
11
- export declare const getCellRadius: (rangeEdge: RangeEdge | undefined, isHighlighted: boolean) => "6px" | "6px 0 0 6px" | "0 6px 6px 0" | "0";
11
+ export declare const getCellRadius: (rangeEdge: RangeEdge | undefined, isHighlighted: boolean) => "6px" | "0" | "6px 0 0 6px" | "0 6px 6px 0";
12
12
  /**
13
13
  * Works out which edge of a highlighted range a selected cell sits on.
14
14
  *
@@ -2,6 +2,7 @@ export { default as Button } from './Button';
2
2
  export type * from './Button/types';
3
3
  export * from './ButtonGroup';
4
4
  export * from './IconButton';
5
+ export * from './Breadcrumbs';
5
6
  export { default as Checkbox } from './Checkbox';
6
7
  export * from './Checkbox';
7
8
  export type * from './Checkbox/types';