@lincyaw/aegis-ui 0.15.0 → 0.16.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.
- package/dist/components/ui/Breadcrumb.cjs +1 -1
- package/dist/components/ui/Breadcrumb.cjs.map +1 -1
- package/dist/components/ui/Breadcrumb.d.ts +11 -1
- package/dist/components/ui/Breadcrumb.js +26 -17
- package/dist/components/ui/Breadcrumb.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime");;/* empty css */const g=require("./linkComponent.cjs"),_=require("../../locale/useStrings.cjs");function p({items:s,className:t,ariaLabel:l,linkComponent:u}){const o=_.useStrings(),b=["aegis-breadcrumb",t??""].filter(Boolean).join(" "),d=u??g.DefaultLink,i=s.some(e=>e.current!==void 0);return r.jsx("nav",{"aria-label":l??o.breadcrumb,className:b,children:r.jsx("ol",{className:"aegis-breadcrumb__list",children:s.map((e,c)=>{const n=c===s.length-1,a=i?e.current===!0:n,m=e.to!==void 0&&(i||!n);return r.jsxs("li",{className:"aegis-breadcrumb__item",children:[m&&e.to!==void 0?r.jsx(d,{to:e.to,className:a?"aegis-breadcrumb__link aegis-breadcrumb__link--current":"aegis-breadcrumb__link","aria-current":a?"page":void 0,children:e.label}):r.jsx("span",{className:a?"aegis-breadcrumb__text aegis-breadcrumb__text--current":"aegis-breadcrumb__text","aria-current":a?"page":void 0,children:e.label}),!n&&r.jsx("span",{className:"aegis-breadcrumb__sep","aria-hidden":"true",children:"/"})]},c)})})})}exports.Breadcrumb=p;
|
|
2
2
|
//# sourceMappingURL=Breadcrumb.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.cjs","sources":["../../../src/components/ui/Breadcrumb.tsx"],"sourcesContent":["import { type ReactElement, type ReactNode } from 'react';\n\nimport { useStrings } from '../../locale';\nimport './Breadcrumb.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Optional destination. If omitted, the item renders as plain text. */\n to?: string;\n}\n\ninterface BreadcrumbProps {\n items: BreadcrumbItem[];\n className?: string;\n /**\n * Component used to render linked breadcrumb items. Defaults to an\n * unstyled `<a href>`. Sub-apps using a router should pass their\n * Link adapter here.\n */\n linkComponent?: LinkComponent;\n}\n\nexport function Breadcrumb({\n items,\n className,\n linkComponent,\n}: BreadcrumbProps): ReactElement {\n const strings = useStrings();\n const cls = ['aegis-breadcrumb', className ?? ''].filter(Boolean).join(' ');\n const LinkImpl = linkComponent ?? DefaultLink;\n\n return (\n <nav aria-label={strings.breadcrumb} className={cls}>\n <ol className=\"aegis-breadcrumb__list\">\n {items.map((item, idx) => {\n const isLast = idx === items.length - 1;\n return (\n <li key={idx} className=\"aegis-breadcrumb__item\">\n {item.to
|
|
1
|
+
{"version":3,"file":"Breadcrumb.cjs","sources":["../../../src/components/ui/Breadcrumb.tsx"],"sourcesContent":["import { type ReactElement, type ReactNode } from 'react';\n\nimport { useStrings } from '../../locale';\nimport './Breadcrumb.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Optional destination. If omitted, the item renders as plain text. */\n to?: string;\n /**\n * Marks the item as the current page: `aria-current=\"page\"` and main ink.\n * When no item sets it, the last item is the current page and renders as\n * text. Once any item sets it, every item with `to` renders as a link,\n * the last included, and only the items set to `true` are current, so a\n * trail can end at a page other than the one shown.\n */\n current?: boolean;\n}\n\ninterface BreadcrumbProps {\n items: BreadcrumbItem[];\n className?: string;\n /** Accessible name of the navigation. Defaults to the locale's `breadcrumb`. */\n ariaLabel?: string;\n /**\n * Component used to render linked breadcrumb items. Defaults to an\n * unstyled `<a href>`. Sub-apps using a router should pass their\n * Link adapter here.\n */\n linkComponent?: LinkComponent;\n}\n\nexport function Breadcrumb({\n items,\n className,\n ariaLabel,\n linkComponent,\n}: BreadcrumbProps): ReactElement {\n const strings = useStrings();\n const cls = ['aegis-breadcrumb', className ?? ''].filter(Boolean).join(' ');\n const LinkImpl = linkComponent ?? DefaultLink;\n const explicit = items.some((item) => item.current !== undefined);\n\n return (\n <nav aria-label={ariaLabel ?? strings.breadcrumb} className={cls}>\n <ol className=\"aegis-breadcrumb__list\">\n {items.map((item, idx) => {\n const isLast = idx === items.length - 1;\n const isCurrent = explicit ? item.current === true : isLast;\n const linked = item.to !== undefined && (explicit || !isLast);\n return (\n <li key={idx} className=\"aegis-breadcrumb__item\">\n {linked && item.to !== undefined ? (\n <LinkImpl\n to={item.to}\n className={\n isCurrent\n ? 'aegis-breadcrumb__link aegis-breadcrumb__link--current'\n : 'aegis-breadcrumb__link'\n }\n aria-current={isCurrent ? 'page' : undefined}\n >\n {item.label}\n </LinkImpl>\n ) : (\n <span\n className={\n isCurrent\n ? 'aegis-breadcrumb__text aegis-breadcrumb__text--current'\n : 'aegis-breadcrumb__text'\n }\n aria-current={isCurrent ? 'page' : undefined}\n >\n {item.label}\n </span>\n )}\n {!isLast && (\n <span className=\"aegis-breadcrumb__sep\" aria-hidden=\"true\">\n /\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"names":["Breadcrumb","items","className","ariaLabel","linkComponent","strings","useStrings","cls","LinkImpl","DefaultLink","explicit","item","jsx","idx","isLast","isCurrent","linked","jsxs"],"mappings":"qOAiCO,SAASA,EAAW,CACzB,MAAAC,EACA,UAAAC,EACA,UAAAC,EAAA,cACAC,CACF,EAAkC,CAChC,MAAMC,EAAUC,EAAAA,WAAA,EACVC,EAAM,CAAC,mBAAoBL,GAAa,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EACpEM,EAAWJ,GAAiBK,EAAAA,YAC5BC,EAAWT,EAAM,KAAMU,GAASA,EAAK,UAAY,MAAS,EAEhE,aACG,MAAA,CAAI,aAAYR,GAAaE,EAAQ,WAAY,UAAWE,EAC3D,SAAAK,EAAAA,IAAC,KAAA,CAAG,UAAU,yBACX,SAAAX,EAAM,IAAI,CAACU,EAAME,IAAQ,CACxB,MAAMC,EAASD,IAAQZ,EAAM,OAAS,EAChCc,EAAYL,EAAWC,EAAK,UAAY,GAAOG,EAC/CE,EAASL,EAAK,KAAO,SAAcD,GAAY,CAACI,GACtD,OACEG,EAAAA,KAAC,KAAA,CAAa,UAAU,yBACrB,SAAA,CAAAD,GAAUL,EAAK,KAAO,OACrBC,EAAAA,IAACJ,EAAA,CACC,GAAIG,EAAK,GACT,UACEI,EACI,yDACA,yBAEN,eAAcA,EAAY,OAAS,OAElC,SAAAJ,EAAK,KAAA,CAAA,EAGRC,EAAAA,IAAC,OAAA,CACC,UACEG,EACI,yDACA,yBAEN,eAAcA,EAAY,OAAS,OAElC,SAAAJ,EAAK,KAAA,CAAA,EAGT,CAACG,GACAF,MAAC,OAAA,CAAK,UAAU,wBAAwB,cAAY,OAAO,SAAA,GAAA,CAE3D,CAAA,CAAA,EA5BKC,CA8BT,CAEJ,CAAC,EACH,EACF,CAEJ"}
|
|
@@ -4,10 +4,20 @@ export interface BreadcrumbItem {
|
|
|
4
4
|
label: ReactNode;
|
|
5
5
|
/** Optional destination. If omitted, the item renders as plain text. */
|
|
6
6
|
to?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Marks the item as the current page: `aria-current="page"` and main ink.
|
|
9
|
+
* When no item sets it, the last item is the current page and renders as
|
|
10
|
+
* text. Once any item sets it, every item with `to` renders as a link,
|
|
11
|
+
* the last included, and only the items set to `true` are current, so a
|
|
12
|
+
* trail can end at a page other than the one shown.
|
|
13
|
+
*/
|
|
14
|
+
current?: boolean;
|
|
7
15
|
}
|
|
8
16
|
interface BreadcrumbProps {
|
|
9
17
|
items: BreadcrumbItem[];
|
|
10
18
|
className?: string;
|
|
19
|
+
/** Accessible name of the navigation. Defaults to the locale's `breadcrumb`. */
|
|
20
|
+
ariaLabel?: string;
|
|
11
21
|
/**
|
|
12
22
|
* Component used to render linked breadcrumb items. Defaults to an
|
|
13
23
|
* unstyled `<a href>`. Sub-apps using a router should pass their
|
|
@@ -15,5 +25,5 @@ interface BreadcrumbProps {
|
|
|
15
25
|
*/
|
|
16
26
|
linkComponent?: LinkComponent;
|
|
17
27
|
}
|
|
18
|
-
export declare function Breadcrumb({ items, className, linkComponent, }: BreadcrumbProps): ReactElement;
|
|
28
|
+
export declare function Breadcrumb({ items, className, ariaLabel, linkComponent, }: BreadcrumbProps): ReactElement;
|
|
19
29
|
export {};
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as _ } from "react/jsx-runtime";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { DefaultLink as
|
|
4
|
-
import { useStrings as
|
|
5
|
-
function
|
|
3
|
+
import { DefaultLink as g } from "./linkComponent.js";
|
|
4
|
+
import { useStrings as p } from "../../locale/useStrings.js";
|
|
5
|
+
function x({
|
|
6
6
|
items: s,
|
|
7
|
-
className:
|
|
8
|
-
|
|
7
|
+
className: t,
|
|
8
|
+
ariaLabel: l,
|
|
9
|
+
linkComponent: o
|
|
9
10
|
}) {
|
|
10
|
-
const
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
11
|
+
const b = p(), u = ["aegis-breadcrumb", t ?? ""].filter(Boolean).join(" "), d = o ?? g, i = s.some((r) => r.current !== void 0);
|
|
12
|
+
return /* @__PURE__ */ e("nav", { "aria-label": l ?? b.breadcrumb, className: u, children: /* @__PURE__ */ e("ol", { className: "aegis-breadcrumb__list", children: s.map((r, n) => {
|
|
13
|
+
const c = n === s.length - 1, a = i ? r.current === !0 : c, m = r.to !== void 0 && (i || !c);
|
|
14
|
+
return /* @__PURE__ */ _("li", { className: "aegis-breadcrumb__item", children: [
|
|
15
|
+
m && r.to !== void 0 ? /* @__PURE__ */ e(
|
|
16
|
+
d,
|
|
17
|
+
{
|
|
18
|
+
to: r.to,
|
|
19
|
+
className: a ? "aegis-breadcrumb__link aegis-breadcrumb__link--current" : "aegis-breadcrumb__link",
|
|
20
|
+
"aria-current": a ? "page" : void 0,
|
|
21
|
+
children: r.label
|
|
22
|
+
}
|
|
23
|
+
) : /* @__PURE__ */ e(
|
|
15
24
|
"span",
|
|
16
25
|
{
|
|
17
|
-
className:
|
|
18
|
-
"aria-current":
|
|
19
|
-
children:
|
|
26
|
+
className: a ? "aegis-breadcrumb__text aegis-breadcrumb__text--current" : "aegis-breadcrumb__text",
|
|
27
|
+
"aria-current": a ? "page" : void 0,
|
|
28
|
+
children: r.label
|
|
20
29
|
}
|
|
21
30
|
),
|
|
22
|
-
!
|
|
23
|
-
] },
|
|
31
|
+
!c && /* @__PURE__ */ e("span", { className: "aegis-breadcrumb__sep", "aria-hidden": "true", children: "/" })
|
|
32
|
+
] }, n);
|
|
24
33
|
}) }) });
|
|
25
34
|
}
|
|
26
35
|
export {
|
|
27
|
-
|
|
36
|
+
x as Breadcrumb
|
|
28
37
|
};
|
|
29
38
|
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.js","sources":["../../../src/components/ui/Breadcrumb.tsx"],"sourcesContent":["import { type ReactElement, type ReactNode } from 'react';\n\nimport { useStrings } from '../../locale';\nimport './Breadcrumb.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Optional destination. If omitted, the item renders as plain text. */\n to?: string;\n}\n\ninterface BreadcrumbProps {\n items: BreadcrumbItem[];\n className?: string;\n /**\n * Component used to render linked breadcrumb items. Defaults to an\n * unstyled `<a href>`. Sub-apps using a router should pass their\n * Link adapter here.\n */\n linkComponent?: LinkComponent;\n}\n\nexport function Breadcrumb({\n items,\n className,\n linkComponent,\n}: BreadcrumbProps): ReactElement {\n const strings = useStrings();\n const cls = ['aegis-breadcrumb', className ?? ''].filter(Boolean).join(' ');\n const LinkImpl = linkComponent ?? DefaultLink;\n\n return (\n <nav aria-label={strings.breadcrumb} className={cls}>\n <ol className=\"aegis-breadcrumb__list\">\n {items.map((item, idx) => {\n const isLast = idx === items.length - 1;\n return (\n <li key={idx} className=\"aegis-breadcrumb__item\">\n {item.to
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","sources":["../../../src/components/ui/Breadcrumb.tsx"],"sourcesContent":["import { type ReactElement, type ReactNode } from 'react';\n\nimport { useStrings } from '../../locale';\nimport './Breadcrumb.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\nexport interface BreadcrumbItem {\n label: ReactNode;\n /** Optional destination. If omitted, the item renders as plain text. */\n to?: string;\n /**\n * Marks the item as the current page: `aria-current=\"page\"` and main ink.\n * When no item sets it, the last item is the current page and renders as\n * text. Once any item sets it, every item with `to` renders as a link,\n * the last included, and only the items set to `true` are current, so a\n * trail can end at a page other than the one shown.\n */\n current?: boolean;\n}\n\ninterface BreadcrumbProps {\n items: BreadcrumbItem[];\n className?: string;\n /** Accessible name of the navigation. Defaults to the locale's `breadcrumb`. */\n ariaLabel?: string;\n /**\n * Component used to render linked breadcrumb items. Defaults to an\n * unstyled `<a href>`. Sub-apps using a router should pass their\n * Link adapter here.\n */\n linkComponent?: LinkComponent;\n}\n\nexport function Breadcrumb({\n items,\n className,\n ariaLabel,\n linkComponent,\n}: BreadcrumbProps): ReactElement {\n const strings = useStrings();\n const cls = ['aegis-breadcrumb', className ?? ''].filter(Boolean).join(' ');\n const LinkImpl = linkComponent ?? DefaultLink;\n const explicit = items.some((item) => item.current !== undefined);\n\n return (\n <nav aria-label={ariaLabel ?? strings.breadcrumb} className={cls}>\n <ol className=\"aegis-breadcrumb__list\">\n {items.map((item, idx) => {\n const isLast = idx === items.length - 1;\n const isCurrent = explicit ? item.current === true : isLast;\n const linked = item.to !== undefined && (explicit || !isLast);\n return (\n <li key={idx} className=\"aegis-breadcrumb__item\">\n {linked && item.to !== undefined ? (\n <LinkImpl\n to={item.to}\n className={\n isCurrent\n ? 'aegis-breadcrumb__link aegis-breadcrumb__link--current'\n : 'aegis-breadcrumb__link'\n }\n aria-current={isCurrent ? 'page' : undefined}\n >\n {item.label}\n </LinkImpl>\n ) : (\n <span\n className={\n isCurrent\n ? 'aegis-breadcrumb__text aegis-breadcrumb__text--current'\n : 'aegis-breadcrumb__text'\n }\n aria-current={isCurrent ? 'page' : undefined}\n >\n {item.label}\n </span>\n )}\n {!isLast && (\n <span className=\"aegis-breadcrumb__sep\" aria-hidden=\"true\">\n /\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"names":["Breadcrumb","items","className","ariaLabel","linkComponent","strings","useStrings","cls","LinkImpl","DefaultLink","explicit","item","jsx","idx","isLast","isCurrent","linked","jsxs"],"mappings":";;;;AAiCO,SAASA,EAAW;AAAA,EACzB,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,GAAkC;AAChC,QAAMC,IAAUC,EAAA,GACVC,IAAM,CAAC,oBAAoBL,KAAa,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GACpEM,IAAWJ,KAAiBK,GAC5BC,IAAWT,EAAM,KAAK,CAACU,MAASA,EAAK,YAAY,MAAS;AAEhE,2BACG,OAAA,EAAI,cAAYR,KAAaE,EAAQ,YAAY,WAAWE,GAC3D,UAAA,gBAAAK,EAAC,MAAA,EAAG,WAAU,0BACX,UAAAX,EAAM,IAAI,CAACU,GAAME,MAAQ;AACxB,UAAMC,IAASD,MAAQZ,EAAM,SAAS,GAChCc,IAAYL,IAAWC,EAAK,YAAY,KAAOG,GAC/CE,IAASL,EAAK,OAAO,WAAcD,KAAY,CAACI;AACtD,WACE,gBAAAG,EAAC,MAAA,EAAa,WAAU,0BACrB,UAAA;AAAA,MAAAD,KAAUL,EAAK,OAAO,SACrB,gBAAAC;AAAA,QAACJ;AAAA,QAAA;AAAA,UACC,IAAIG,EAAK;AAAA,UACT,WACEI,IACI,2DACA;AAAA,UAEN,gBAAcA,IAAY,SAAS;AAAA,UAElC,UAAAJ,EAAK;AAAA,QAAA;AAAA,MAAA,IAGR,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WACEG,IACI,2DACA;AAAA,UAEN,gBAAcA,IAAY,SAAS;AAAA,UAElC,UAAAJ,EAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAGT,CAACG,KACA,gBAAAF,EAAC,QAAA,EAAK,WAAU,yBAAwB,eAAY,QAAO,UAAA,IAAA,CAE3D;AAAA,IAAA,EAAA,GA5BKC,CA8BT;AAAA,EAEJ,CAAC,GACH,GACF;AAEJ;"}
|