@synertech/ui 0.47.0 → 0.47.1
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/.claude/skills/use-synertech-ui/SKILL.md +16 -0
- package/dist/components/breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/footer/FooterLink.cjs +1 -1
- package/dist/components/footer/FooterLink.js +1 -1
- package/dist/components/footer/FooterSocial.cjs +1 -1
- package/dist/components/footer/FooterSocial.js +1 -1
- package/dist/components/header/Header.cjs +1 -1
- package/dist/components/header/Header.js +1 -1
- package/dist/components/help-button/HelpButton.cjs +5 -5
- package/dist/components/help-button/HelpButton.js +6 -6
- package/dist/components/help-button/sanitize-html.cjs +1 -0
- package/dist/components/help-button/sanitize-html.js +1 -0
- package/dist/components/sidebar/Sidebar.cjs +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/index.d.cts +52 -3
- package/dist/index.d.ts +52 -3
- package/dist/lib/safe-href.cjs +1 -0
- package/dist/lib/safe-href.js +1 -0
- package/package.json +1 -1
|
@@ -402,6 +402,14 @@ import { Breadcrumb } from "@synertech/ui";
|
|
|
402
402
|
/>
|
|
403
403
|
```
|
|
404
404
|
|
|
405
|
+
Une adresse ne fait un lien que si elle est en `http:`, `https:`, `mailto:`,
|
|
406
|
+
`tel:` ou relative : le `href` d'un element de `Breadcrumb`, de `Header` (et
|
|
407
|
+
son `logoHref`), d'un `SidebarItem`, d'un `FooterLink` ou d'un
|
|
408
|
+
`FooterSocialLink`. Toute autre (`javascript:`, `data:`, `sms:`...) laisse le
|
|
409
|
+
texte sans lien, un `SidebarItem` devient un bouton, et la console le signale
|
|
410
|
+
une fois. Un `rel` passe a `FooterLink external` ou a `FooterSocialLink`
|
|
411
|
+
s'ajoute a `noopener noreferrer` au lieu de le remplacer.
|
|
412
|
+
|
|
405
413
|
### Pagination
|
|
406
414
|
|
|
407
415
|
```tsx
|
|
@@ -1434,6 +1442,14 @@ import { HelpButton, WithHelpButton } from "@synertech/ui";
|
|
|
1434
1442
|
</WithHelpButton>
|
|
1435
1443
|
```
|
|
1436
1444
|
|
|
1445
|
+
Sans `markdown`, une chaine est du HTML reduit a sa mise en forme : titres,
|
|
1446
|
+
paragraphes, listes, liens, code, citations, tableaux. `<style>`, formulaires,
|
|
1447
|
+
champs, boutons et images sont retires, comme les attributs `class`, `style`,
|
|
1448
|
+
`id` et `name` ; un lien ne garde qu'une adresse `http:`, `https:`, `mailto:`,
|
|
1449
|
+
`tel:` ou relative. En Markdown non plus, une image (``) n'est pas
|
|
1450
|
+
affichee. Une aide qui a besoin d'autre chose (une image, un composant) se
|
|
1451
|
+
passe en noeud React, rendu tel quel.
|
|
1452
|
+
|
|
1437
1453
|
### Detachable
|
|
1438
1454
|
|
|
1439
1455
|
```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var B=(n,r)=>{for(var l in r)d(n,l,{get:r[l],enumerable:!0})},I=(n,r,l,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of C(r))!v.call(n,s)&&s!==l&&d(n,s,{get:()=>r[s],enumerable:!(i=k(r,s))||i.enumerable});return n};var R=n=>I(d({},"__esModule",{value:!0}),n);var z={};B(z,{Breadcrumb:()=>L});module.exports=R(z);var t=require("../../lib/cn.cjs"),u=require("../../lib/server-labels.cjs"),b=require("../../lib/safe-href.cjs"),e=require("react/jsx-runtime"),P={sm:"text-xs",md:"text-sm",lg:"text-base"};function L({items:n,separator:r="/",size:l="md",maxItems:i,itemColor:s="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:f="text-gray-700 font-medium dark:text-gray-200",separatorColor:p="text-gray-500 dark:text-gray-400",className:h,...N}){let m=n,x=!1;if(i&&n.length>i){x=!0;let a=n[0],o=n.slice(-(i-1));m=[a,...o]}return(0,e.jsx)("nav",{"aria-label":u.serverUILabels.breadcrumbLabel,className:(0,t.cn)("inline-flex items-center",P[l],h),...N,children:(0,e.jsx)("ol",{className:"inline-flex items-center space-x-1 md:space-x-2",children:m.map((a,o)=>{let c=o===m.length-1,y=x&&o===1,g=(0,b.componentHref)("Breadcrumb",a.href);return(0,e.jsxs)("li",{className:"inline-flex items-center",children:[y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:(0,t.cn)("mx-1 select-none",p),children:"..."}),(0,e.jsx)("span",{className:(0,t.cn)("mx-1 select-none",p),"aria-hidden":"true",children:r})]}),g||a.onClick?(0,e.jsxs)("a",{href:g,onClick:a.onClick,className:(0,t.cn)("inline-flex items-center gap-1.5 transition-colors",c?f:s),"aria-current":c?"page":void 0,children:[a.icon&&(0,e.jsx)("span",{className:"inline-flex","aria-hidden":"true",children:a.icon}),(0,e.jsx)("span",{children:a.label})]}):(0,e.jsxs)("span",{className:(0,t.cn)("inline-flex items-center gap-1.5",c?f:s),"aria-current":c?"page":void 0,children:[a.icon&&(0,e.jsx)("span",{className:"inline-flex","aria-hidden":"true",children:a.icon}),(0,e.jsx)("span",{children:a.label})]}),!c&&(0,e.jsx)("span",{className:(0,t.cn)("mx-2 select-none",p),"aria-hidden":"true",children:r})]},a.href??a.label)})})})}0&&(module.exports={Breadcrumb});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as n}from"../../lib/cn.js";import{serverUILabels as
|
|
1
|
+
import{cn as n}from"../../lib/cn.js";import{serverUILabels as N}from"../../lib/server-labels.js";import{componentHref as y}from"../../lib/safe-href.js";import{Fragment as C,jsx as a,jsxs as l}from"react/jsx-runtime";var k={sm:"text-xs",md:"text-sm",lg:"text-base"};function R({items:s,separator:p="/",size:g="md",maxItems:i,itemColor:m="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:d="text-gray-700 font-medium dark:text-gray-200",separatorColor:c="text-gray-500 dark:text-gray-400",className:u,...b}){let o=s,f=!1;if(i&&s.length>i){f=!0;let e=s[0],t=s.slice(-(i-1));o=[e,...t]}return a("nav",{"aria-label":N.breadcrumbLabel,className:n("inline-flex items-center",k[g],u),...b,children:a("ol",{className:"inline-flex items-center space-x-1 md:space-x-2",children:o.map((e,t)=>{let r=t===o.length-1,h=f&&t===1,x=y("Breadcrumb",e.href);return l("li",{className:"inline-flex items-center",children:[h&&l(C,{children:[a("span",{className:n("mx-1 select-none",c),children:"..."}),a("span",{className:n("mx-1 select-none",c),"aria-hidden":"true",children:p})]}),x||e.onClick?l("a",{href:x,onClick:e.onClick,className:n("inline-flex items-center gap-1.5 transition-colors",r?d:m),"aria-current":r?"page":void 0,children:[e.icon&&a("span",{className:"inline-flex","aria-hidden":"true",children:e.icon}),a("span",{children:e.label})]}):l("span",{className:n("inline-flex items-center gap-1.5",r?d:m),"aria-current":r?"page":void 0,children:[e.icon&&a("span",{className:"inline-flex","aria-hidden":"true",children:e.icon}),a("span",{children:e.label})]}),!r&&a("span",{className:n("mx-2 select-none",c),"aria-hidden":"true",children:p})]},e.href??e.label)})})})}export{R as Breadcrumb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var k=(o,e)=>{for(var t in e)i(o,t,{get:e[t],enumerable:!0})},c=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!h.call(o,r)&&r!==t&&i(o,r,{get:()=>e[r],enumerable:!(n=l(e,r))||n.enumerable});return o};var g=o=>c(i({},"__esModule",{value:!0}),o);var x={};k(x,{FooterLink:()=>f});module.exports=g(x);var p=require("../../lib/cn.cjs"),a=require("../../lib/safe-href.cjs"),s=require("react/jsx-runtime");function f({external:o=!1,href:e,rel:t,className:n,children:r,...m}){return(0,s.jsx)("a",{className:(0,p.cn)("text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",n),target:o?"_blank":void 0,...m,href:(0,a.componentHref)("FooterLink",e),rel:o?(0,a.mergeRel)(t,"noopener noreferrer"):t,children:r})}f.displayName="FooterLink";0&&(module.exports={FooterLink});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as
|
|
1
|
+
import{cn as i}from"../../lib/cn.js";import{componentHref as p,mergeRel as f}from"../../lib/safe-href.js";import{jsx as m}from"react/jsx-runtime";function s({external:e=!1,href:t,rel:o,className:r,children:n,...a}){return m("a",{className:i("text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",r),target:e?"_blank":void 0,...a,href:p("FooterLink",t),rel:e?f(o,"noopener noreferrer"):o,children:n})}s.displayName="FooterLink";export{s as FooterLink};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var r in e)n(o,r,{get:e[r],enumerable:!0})},x=(o,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of f(e))!h.call(o,t)&&t!==r&&n(o,t,{get:()=>e[t],enumerable:!(i=m(e,t))||i.enumerable});return o};var F=o=>x(n({},"__esModule",{value:!0}),o);var S={};g(S,{FooterSocial:()=>p,FooterSocialLink:()=>s});module.exports=F(S);var l=require("../../lib/cn.cjs"),a=require("../../lib/safe-href.cjs"),c=require("react/jsx-runtime");function p({className:o,children:e,...r}){return(0,c.jsx)("div",{className:(0,l.cn)("flex items-center gap-4",o),...r,children:e})}p.displayName="FooterSocial";function s({icon:o,label:e,href:r,rel:i,className:t,...d}){return(0,c.jsx)("a",{className:(0,l.cn)("text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",t),target:"_blank","aria-label":e,...d,href:(0,a.componentHref)("FooterSocialLink",r),rel:(0,a.mergeRel)(i,"noopener noreferrer"),children:o})}s.displayName="FooterSocialLink";0&&(module.exports={FooterSocial,FooterSocialLink});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as
|
|
1
|
+
import{cn as t}from"../../lib/cn.js";import{componentHref as c,mergeRel as p}from"../../lib/safe-href.js";import{jsx as i}from"react/jsx-runtime";function s({className:e,children:o,...r}){return i("div",{className:t("flex items-center gap-4",e),...r,children:o})}s.displayName="FooterSocial";function d({icon:e,label:o,href:r,rel:a,className:n,...l}){return i("a",{className:t("text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",n),target:"_blank","aria-label":o,...l,href:c("FooterSocialLink",r),rel:p(a,"noopener noreferrer"),children:e})}d.displayName="FooterSocialLink";export{s as FooterSocial,d as FooterSocialLink};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var k=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var se=(o,n)=>{for(var c in n)k(o,c,{get:n[c],enumerable:!0})},le=(o,n,c,d)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of oe(n))!ne.call(o,l)&&l!==c&&k(o,l,{get:()=>n[l],enumerable:!(d=te(n,l))||d.enumerable});return o};var de=o=>le(k({},"__esModule",{value:!0}),o);var ie={};se(ie,{Header:()=>ce});module.exports=de(ie);var h=require("react"),s=require("../../lib/cn.cjs"),f=require("../../lib/safe-href.cjs"),R=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime");function ce({logo:o,logoHref:n="/",onLogoClick:c,navItems:d=[],actions:l,rightContent:p,variant:a="default",size:m="md",backgroundColor:g,textColor:j,hoverColor:D,navItemTextColor:O,navItemHoverColor:T,navItemBgHover:W,navItemActiveColor:z,sticky:Q=!1,fixed:_=!1,showSearch:N=!1,onSearch:w,searchPlaceholder:q,menuLabel:A,className:E,containerClassName:F}){let C=(0,R.useUILabels)(),u=q??C.headerSearchPlaceholder,[b,U]=(0,h.useState)(!1),[L,G]=(0,h.useState)(null),[x,H]=(0,h.useState)(""),J=()=>{U(!b)},K=r=>{G(L===r?null:r)},M=r=>{r.preventDefault(),w&&w(x)},V=(0,s.cn)(Q&&"sticky top-0 z-50",_&&"fixed top-0 left-0 right-0 z-50"),X=(0,s.cn)(a==="default"&&!g&&"bg-gray-900 text-white",a==="transparent"&&!g&&"bg-transparent",a==="bordered"&&!g&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",a==="shadow"&&!g&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),Y=(0,s.cn)(m==="sm"&&"py-2",m==="md"&&"py-4",m==="lg"&&"py-6"),Z=g||"",$=j||"",ee=D||"",re=(0,s.cn)(V,X,Y,Z,$,E),I=(r,i,y=!1)=>{let ae=r.children&&r.children.length>0,B=L===i,v=(0,s.cn)("px-4 py-2 transition-colors flex items-center gap-2",y?"block w-full text-left":"inline-flex",r.active&&"font-semibold border-b-2",r.active&&(z||"border-current"),O||(a==="default"||a==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),T||ee||(a==="default"||a==="transparent"?"hover:text-white":"hover:text-synertech-primary-600 dark:hover:text-synertech-primary-400"),W||"");if(ae)return(0,e.jsxs)("div",{className:y?"w-full":"relative",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>K(i),className:v,children:[r.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:r.icon}),(0,e.jsx)("span",{children:r.label}),r.badge&&(0,e.jsx)("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:r.badge}),(0,e.jsx)("svg",{className:(0,s.cn)("w-4 h-4 transition-transform",B&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),B&&(0,e.jsx)("div",{className:(0,s.cn)("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",y?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:r.children?.map(t=>(0,e.jsx)("a",{href:(0,f.componentHref)("Header",t.href),onClick:t.onClick,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[t.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:t.icon}),(0,e.jsx)("span",{children:t.label}),t.badge&&(0,e.jsx)("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:t.badge}),t.external&&(0,e.jsx)("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},t.href??t.label))})]},r.href??r.label);let P=(0,e.jsxs)(e.Fragment,{children:[r.icon&&(0,e.jsx)("span",{className:"w-5 h-5",children:r.icon}),(0,e.jsx)("span",{children:r.label}),r.badge&&(0,e.jsx)("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:r.badge}),r.external&&(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return r.onClick?(0,e.jsx)("button",{type:"button",onClick:r.onClick,className:v,children:P},r.href??r.label):(0,e.jsx)("a",{href:(0,f.componentHref)("Header",r.href),target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,className:v,children:P},r.href??r.label)},S=(0,f.componentHref)("Header",n);return(0,e.jsxs)("header",{className:re,children:[(0,e.jsxs)("nav",{className:(0,s.cn)("container mx-auto flex items-center justify-between px-4",F),children:[o&&(0,e.jsx)("div",{className:"flex items-center",children:S?(0,e.jsx)("a",{href:S,onClick:c,className:"flex items-center hover:opacity-80 transition-opacity",children:o}):(0,e.jsx)("div",{className:"flex items-center",children:o})}),N&&(0,e.jsx)("form",{onSubmit:M,className:"hidden md:flex flex-1 max-w-md mx-8",children:(0,e.jsx)("input",{type:"search","aria-label":u,value:x,onChange:r=>H(r.target.value),placeholder:u,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 text-gray-900 placeholder-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-400"})}),(0,e.jsx)("div",{className:"hidden md:flex items-center gap-2",children:d.map((r,i)=>I(r,i,!1))}),(l||p)&&(0,e.jsxs)("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[l,p]}),d.length>0&&(0,e.jsx)("div",{className:"md:hidden",children:(0,e.jsx)("button",{type:"button",className:(0,s.cn)("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",a==="default"||a==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:J,"aria-label":A??C.headerToggleMenu,"aria-expanded":b,children:(0,e.jsx)("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),b&&d.length>0&&(0,e.jsx)("div",{className:(0,s.cn)("md:hidden border-t animate-in slide-in-from-top duration-300",a==="default"||a==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:(0,e.jsxs)("div",{className:"flex flex-col py-2 px-4",children:[N&&(0,e.jsx)("form",{onSubmit:M,className:"mb-4",children:(0,e.jsx)("input",{type:"search","aria-label":u,value:x,onChange:r=>H(r.target.value),placeholder:u,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 text-gray-900 placeholder-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-400"})}),d.map((r,i)=>I(r,i,!0)),(l||p)&&(0,e.jsxs)("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[l,p]})]})})]})}0&&(module.exports={Header});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useState as x}from"react";import{cn as
|
|
1
|
+
"use client";import{useState as x}from"react";import{cn as o}from"../../lib/cn.js";import{componentHref as y}from"../../lib/safe-href.js";import{useUILabels as ae}from"../../lib/i18n.js";import{Fragment as te,jsx as r,jsxs as n}from"react/jsx-runtime";function de({logo:p,logoHref:B="/",onLogoClick:P,navItems:d=[],actions:c,rightContent:i,variant:a="default",size:u="md",backgroundColor:l,textColor:R,hoverColor:j,navItemTextColor:D,navItemHoverColor:O,navItemBgHover:T,navItemActiveColor:W,sticky:z=!1,fixed:Q=!1,showSearch:v=!1,onSearch:k,searchPlaceholder:_,menuLabel:q,className:A,containerClassName:E}){let N=ae(),g=_??N.headerSearchPlaceholder,[h,F]=x(!1),[w,U]=x(null),[f,C]=x(""),G=()=>{F(!h)},J=e=>{U(w===e?null:e)},L=e=>{e.preventDefault(),k&&k(f)},K=o(z&&"sticky top-0 z-50",Q&&"fixed top-0 left-0 right-0 z-50"),V=o(a==="default"&&!l&&"bg-gray-900 text-white",a==="transparent"&&!l&&"bg-transparent",a==="bordered"&&!l&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",a==="shadow"&&!l&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),X=o(u==="sm"&&"py-2",u==="md"&&"py-4",u==="lg"&&"py-6"),Y=l||"",Z=R||"",$=j||"",ee=o(K,V,X,Y,Z,A),H=(e,s,m=!1)=>{let re=e.children&&e.children.length>0,I=w===s,b=o("px-4 py-2 transition-colors flex items-center gap-2",m?"block w-full text-left":"inline-flex",e.active&&"font-semibold border-b-2",e.active&&(W||"border-current"),D||(a==="default"||a==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),O||$||(a==="default"||a==="transparent"?"hover:text-white":"hover:text-synertech-primary-600 dark:hover:text-synertech-primary-400"),T||"");if(re)return n("div",{className:m?"w-full":"relative",children:[n("button",{type:"button",onClick:()=>J(s),className:b,children:[e.icon&&r("span",{className:"w-5 h-5",children:e.icon}),r("span",{children:e.label}),e.badge&&r("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:e.badge}),r("svg",{className:o("w-4 h-4 transition-transform",I&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),I&&r("div",{className:o("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",m?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:e.children?.map(t=>r("a",{href:y("Header",t.href),onClick:t.onClick,target:t.external?"_blank":void 0,rel:t.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:n("div",{className:"flex items-center gap-2",children:[t.icon&&r("span",{className:"w-5 h-5",children:t.icon}),r("span",{children:t.label}),t.badge&&r("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:t.badge}),t.external&&r("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},t.href??t.label))})]},e.href??e.label);let S=n(te,{children:[e.icon&&r("span",{className:"w-5 h-5",children:e.icon}),r("span",{children:e.label}),e.badge&&r("span",{className:"bg-red-600 text-white text-xs px-2 py-0.5 rounded-full",children:e.badge}),e.external&&r("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return e.onClick?r("button",{type:"button",onClick:e.onClick,className:b,children:S},e.href??e.label):r("a",{href:y("Header",e.href),target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:b,children:S},e.href??e.label)},M=y("Header",B);return n("header",{className:ee,children:[n("nav",{className:o("container mx-auto flex items-center justify-between px-4",E),children:[p&&r("div",{className:"flex items-center",children:M?r("a",{href:M,onClick:P,className:"flex items-center hover:opacity-80 transition-opacity",children:p}):r("div",{className:"flex items-center",children:p})}),v&&r("form",{onSubmit:L,className:"hidden md:flex flex-1 max-w-md mx-8",children:r("input",{type:"search","aria-label":g,value:f,onChange:e=>C(e.target.value),placeholder:g,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 text-gray-900 placeholder-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-400"})}),r("div",{className:"hidden md:flex items-center gap-2",children:d.map((e,s)=>H(e,s,!1))}),(c||i)&&n("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[c,i]}),d.length>0&&r("div",{className:"md:hidden",children:r("button",{type:"button",className:o("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",a==="default"||a==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:G,"aria-label":q??N.headerToggleMenu,"aria-expanded":h,children:r("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:r("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),h&&d.length>0&&r("div",{className:o("md:hidden border-t animate-in slide-in-from-top duration-300",a==="default"||a==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:n("div",{className:"flex flex-col py-2 px-4",children:[v&&r("form",{onSubmit:L,className:"mb-4",children:r("input",{type:"search","aria-label":g,value:f,onChange:e=>C(e.target.value),placeholder:g,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-synertech-primary-500 text-gray-900 placeholder-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-400"})}),d.map((e,s)=>H(e,s,!0)),(c||i)&&n("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[c,i]})]})})]})}export{de as Header};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";"use client";var j=Object.create;var E=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(t
|
|
2
|
-
${
|
|
1
|
+
"use strict";"use client";var j=Object.create;var E=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(r,t)=>{for(var n in t)E(r,n,{get:t[n],enumerable:!0})},P=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of J(t))!X.call(r,l)&&l!==n&&E(r,l,{get:()=>t[l],enumerable:!(i=F(t,l))||i.enumerable});return r};var W=(r,t,n)=>(n=r!=null?j(Q(r)):{},P(t||!r||!r.__esModule?E(n,"default",{value:r,enumerable:!0}):n,r)),Z=r=>P(E({},"__esModule",{value:!0}),r);var ge={};Y(ge,{HelpButton:()=>$,WithHelpButton:()=>ue});module.exports=Z(ge);var a=require("react"),z=W(require("react-markdown"),1),A=W(require("remark-gfm"),1),D=require("../../lib/i18n.cjs"),U=require("./sanitize-html.cjs"),e=require("react/jsx-runtime"),ee=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,e.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),te=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,e.jsx)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,e.jsx)("polyline",{points:"7 3 7 8 15 8"})]}),re=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,e.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),oe=(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,e.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),ae=(0,e.jsxs)("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),(0,e.jsx)("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),ne={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},se={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},le={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},ie=[A.default],de=["img"],ce={h1:({node:r,...t})=>(0,e.jsx)("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...t}),h2:({node:r,...t})=>(0,e.jsx)("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...t}),h3:({node:r,...t})=>(0,e.jsx)("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...t}),p:({node:r,...t})=>(0,e.jsx)("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({node:r,...t})=>(0,e.jsx)("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({node:r,...t})=>(0,e.jsx)("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({node:r,className:t,children:n,...i})=>!t?.includes("language-")?(0,e.jsx)("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...i,children:n}):(0,e.jsx)("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...i,children:n}),pre:({node:r,...t})=>(0,e.jsx)("pre",{className:"my-2",...t}),a:({node:r,...t})=>(0,e.jsx)("a",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 hover:underline",...t}),strong:({node:r,...t})=>(0,e.jsx)("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({node:r,...t})=>(0,e.jsx)("em",{className:"italic",...t}),blockquote:({node:r,...t})=>(0,e.jsx)("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...t})};function $({content:r,markdown:t=!1,position:n="bottom",size:i="sm",className:l="",visible:C=!0,editable:f=!1,onSave:m,onReset:u,width:B="md",title:p,markdownEditor:h,markdownEditorUnavailableLabel:_,labels:R}){let o=(0,D.useUILabels)(R),[y,L]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),[v,b]=(0,a.useState)(""),[M,k]=(0,a.useState)(!1),[S,s]=(0,a.useState)(null),I=(0,a.useRef)(null),T=(0,a.useRef)(null),H=(0,a.useRef)(null),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!y)return;let g=w=>{I.current&&!I.current.contains(w.target)&&T.current&&!T.current.contains(w.target)&&(c||L(!1))},O=w=>{w.key==="Escape"&&(c?(x(!1),b("")):L(!1))};return document.addEventListener("mousedown",g),document.addEventListener("keydown",O),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",O)}},[y,c]),(0,a.useEffect)(()=>{c&&H.current&&H.current.focus()},[c]),(0,a.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let K=(0,a.useCallback)(()=>{b(typeof r=="string"?r:""),x(!0),s(null)},[r]),G=(0,a.useCallback)(()=>{x(!1),b(""),s(null)},[]),q=(0,a.useCallback)(async()=>{if(!m){s({type:"error",text:o.helpButtonNoSave});return}k(!0);try{await m(v)?(s({type:"success",text:o.helpButtonSaved}),x(!1),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>s(null),2e3)):s({type:"error",text:o.helpButtonSaveError})}catch{s({type:"error",text:o.helpButtonSaveError})}finally{k(!1)}},[v,m,o]),V=(0,a.useCallback)(async()=>{if(u&&confirm(o.helpButtonResetConfirm)){k(!0);try{await u()?(s({type:"success",text:o.helpButtonResetDone}),x(!1),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>s(null),2e3)):s({type:"error",text:o.helpButtonResetError})}catch{s({type:"error",text:o.helpButtonResetError})}finally{k(!1)}}},[u,o]),N=r;return C?(0,e.jsxs)("div",{className:"relative inline-flex items-center",children:[(0,e.jsx)("button",{type:"button",ref:I,onClick:()=>L(!y),className:`
|
|
2
|
+
${ne[i]}
|
|
3
3
|
inline-flex items-center justify-center
|
|
4
4
|
rounded-full border border-gray-300 dark:border-gray-600
|
|
5
5
|
bg-white dark:bg-gray-800
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
transition-all duration-150
|
|
12
12
|
focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50
|
|
13
13
|
${l}
|
|
14
|
-
`,"aria-label":
|
|
15
|
-
absolute z-50 ${
|
|
14
|
+
`,"aria-label":o.helpButtonShow,"aria-expanded":y,children:(0,e.jsx)("span",{className:"font-medium",children:"?"})}),y&&(0,e.jsxs)("div",{ref:T,className:`
|
|
15
|
+
absolute z-50 ${se[n]}
|
|
16
16
|
${le[B]} max-h-[80vh] overflow-hidden flex flex-col
|
|
17
17
|
bg-white dark:bg-gray-900
|
|
18
18
|
border border-gray-200 dark:border-gray-700
|
|
19
19
|
rounded-xl shadow-xl
|
|
20
20
|
text-sm text-gray-700 dark:text-gray-300
|
|
21
21
|
animate-in fade-in-0 zoom-in-95 duration-150
|
|
22
|
-
`,role:"tooltip",children:[(p||f)&&(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:p&&(0,e.jsx)("h3",{className:"text-sm font-semibold",children:p})}),f&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:q,disabled:
|
|
22
|
+
`,role:"tooltip",children:[(p||f)&&(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:p&&(0,e.jsx)("h3",{className:"text-sm font-semibold",children:p})}),f&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:q,disabled:M,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:o.helpButtonSave,children:M?ae:te}),(0,e.jsx)("button",{type:"button",onClick:G,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:o.helpButtonCancel,children:re}),u&&(0,e.jsx)("button",{type:"button",onClick:V,disabled:M,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:o.helpButtonReset,children:oe})]}):(0,e.jsx)("button",{type:"button",onClick:K,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:o.helpButtonEdit,children:ee})})]}),S&&(0,e.jsx)("div",{className:`px-4 py-2 text-xs ${S.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:S.text}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:c?t?h?(0,e.jsx)(h,{value:v,onChange:b,placeholder:o.markdownEditorPlaceholder}):(0,e.jsx)("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:_??o.markdownEditorUnavailable}):(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("textarea",{ref:H,"aria-label":o.helpButtonContent,value:v,onChange:g=>b(g.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:o.helpButtonContentPlaceholder})}):typeof N=="string"?(0,e.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:t?(0,e.jsx)(z.default,{remarkPlugins:ie,components:ce,disallowedElements:de,children:N}):(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:(0,U.sanitizeHelpHtml)(N)}})}):N})]})]}):null}function ue({children:r,content:t,markdown:n=!1,position:i="bottom",size:l="sm",visible:C=!0,editable:f=!1,onSave:m,onReset:u,width:B="md",title:p,className:h,markdownEditor:_,markdownEditorUnavailableLabel:R,labels:o}){return(0,e.jsxs)("div",{className:"inline-flex items-center gap-2.5",children:[r,(0,e.jsx)($,{content:t,markdown:n,position:i,size:l,visible:C,editable:f,onSave:m,onReset:u,width:B,title:p,className:h,markdownEditor:_,markdownEditorUnavailableLabel:R,labels:o})]})}0&&(module.exports={HelpButton,WithHelpButton});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use client";import{useState as
|
|
2
|
-
${Y[
|
|
1
|
+
"use client";import{useState as b,useRef as C,useEffect as W,useCallback as B}from"react";import K from"react-markdown";import G from"remark-gfm";import{useUILabels as q}from"../../lib/i18n.js";import{sanitizeHelpHtml as V}from"./sanitize-html.js";import{Fragment as ne,jsx as e,jsxs as n}from"react/jsx-runtime";var j=n("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),F=n("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e("polyline",{points:"17 21 17 13 7 13 7 21"}),e("polyline",{points:"7 3 7 8 15 8"})]}),J=n("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Q=n("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("polyline",{points:"1 4 1 10 7 10"}),e("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),X=n("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),e("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),Y={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},Z={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},ee={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},te=[G],re=["img"],oe={h1:({node:o,...t})=>e("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...t}),h2:({node:o,...t})=>e("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...t}),h3:({node:o,...t})=>e("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...t}),p:({node:o,...t})=>e("p",{className:"my-1 text-gray-700 dark:text-gray-300",...t}),ul:({node:o,...t})=>e("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),ol:({node:o,...t})=>e("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...t}),code:({node:o,className:t,children:i,...d})=>!t?.includes("language-")?e("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...d,children:i}):e("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...d,children:i}),pre:({node:o,...t})=>e("pre",{className:"my-2",...t}),a:({node:o,...t})=>e("a",{className:"text-synertech-primary-600 dark:text-synertech-primary-400 hover:underline",...t}),strong:({node:o,...t})=>e("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...t}),em:({node:o,...t})=>e("em",{className:"italic",...t}),blockquote:({node:o,...t})=>e("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...t})};function ae({content:o,markdown:t=!1,position:i="bottom",size:d="sm",className:f="",visible:_=!0,editable:h=!1,onSave:g,onReset:c,width:R="md",title:m,markdownEditor:v,markdownEditorUnavailableLabel:L,labels:M}){let r=q(M),[p,S]=b(!1),[l,y]=b(!1),[k,x]=b(""),[I,N]=b(!1),[T,a]=b(null),H=C(null),O=C(null),P=C(null),s=C(null);W(()=>{if(!p)return;let u=E=>{H.current&&!H.current.contains(E.target)&&O.current&&!O.current.contains(E.target)&&(l||S(!1))},z=E=>{E.key==="Escape"&&(l?(y(!1),x("")):S(!1))};return document.addEventListener("mousedown",u),document.addEventListener("keydown",z),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",z)}},[p,l]),W(()=>{l&&P.current&&P.current.focus()},[l]),W(()=>()=>{s.current&&clearTimeout(s.current)},[]);let A=B(()=>{x(typeof o=="string"?o:""),y(!0),a(null)},[o]),D=B(()=>{y(!1),x(""),a(null)},[]),U=B(async()=>{if(!g){a({type:"error",text:r.helpButtonNoSave});return}N(!0);try{await g(k)?(a({type:"success",text:r.helpButtonSaved}),y(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(null),2e3)):a({type:"error",text:r.helpButtonSaveError})}catch{a({type:"error",text:r.helpButtonSaveError})}finally{N(!1)}},[k,g,r]),$=B(async()=>{if(c&&confirm(r.helpButtonResetConfirm)){N(!0);try{await c()?(a({type:"success",text:r.helpButtonResetDone}),y(!1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(null),2e3)):a({type:"error",text:r.helpButtonResetError})}catch{a({type:"error",text:r.helpButtonResetError})}finally{N(!1)}}},[c,r]),w=o;return _?n("div",{className:"relative inline-flex items-center",children:[e("button",{type:"button",ref:H,onClick:()=>S(!p),className:`
|
|
2
|
+
${Y[d]}
|
|
3
3
|
inline-flex items-center justify-center
|
|
4
4
|
rounded-full border border-gray-300 dark:border-gray-600
|
|
5
5
|
bg-white dark:bg-gray-800
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
hover:border-gray-400 dark:hover:border-gray-500
|
|
11
11
|
transition-all duration-150
|
|
12
12
|
focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50
|
|
13
|
-
${
|
|
14
|
-
`,"aria-label":r.helpButtonShow,"aria-expanded":
|
|
13
|
+
${f}
|
|
14
|
+
`,"aria-label":r.helpButtonShow,"aria-expanded":p,children:e("span",{className:"font-medium",children:"?"})}),p&&n("div",{ref:O,className:`
|
|
15
15
|
absolute z-50 ${Z[i]}
|
|
16
|
-
${ee[
|
|
16
|
+
${ee[R]} max-h-[80vh] overflow-hidden flex flex-col
|
|
17
17
|
bg-white dark:bg-gray-900
|
|
18
18
|
border border-gray-200 dark:border-gray-700
|
|
19
19
|
rounded-xl shadow-xl
|
|
20
20
|
text-sm text-gray-700 dark:text-gray-300
|
|
21
21
|
animate-in fade-in-0 zoom-in-95 duration-150
|
|
22
|
-
`,role:"tooltip",children:[(
|
|
22
|
+
`,role:"tooltip",children:[(m||h)&&n("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[e("div",{className:"flex items-center gap-2",children:m&&e("h3",{className:"text-sm font-semibold",children:m})}),h&&e("div",{className:"flex items-center gap-1",children:l?n(ne,{children:[e("button",{type:"button",onClick:U,disabled:I,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-700 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonSave,children:I?X:F}),e("button",{type:"button",onClick:D,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonCancel,children:J}),c&&e("button",{type:"button",onClick:$,disabled:I,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-700 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:r.helpButtonReset,children:Q})]}):e("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:r.helpButtonEdit,children:j})})]}),T&&e("div",{className:`px-4 py-2 text-xs ${T.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400"}`,children:T.text}),e("div",{className:"flex-1 overflow-y-auto p-4",children:l?t?v?e(v,{value:k,onChange:x,placeholder:r.markdownEditorPlaceholder}):e("p",{role:"alert",className:"p-3 text-sm text-gray-500 dark:text-gray-400",children:L??r.markdownEditorUnavailable}):e("div",{className:"space-y-2",children:e("textarea",{ref:P,"aria-label":r.helpButtonContent,value:k,onChange:u=>x(u.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-synertech-primary-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:r.helpButtonContentPlaceholder})}):typeof w=="string"?e("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:t?e(K,{remarkPlugins:te,components:oe,disallowedElements:re,children:w}):e("div",{dangerouslySetInnerHTML:{__html:V(w)}})}):w})]})]}):null}function ue({children:o,content:t,markdown:i=!1,position:d="bottom",size:f="sm",visible:_=!0,editable:h=!1,onSave:g,onReset:c,width:R="md",title:m,className:v,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:r}){return n("div",{className:"inline-flex items-center gap-2.5",children:[o,e(ae,{content:t,markdown:i,position:d,size:f,visible:_,editable:h,onSave:g,onReset:c,width:R,title:m,className:v,markdownEditor:L,markdownEditorUnavailableLabel:M,labels:r})]})}export{ae as HelpButton,ue as WithHelpButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},f=(t,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!p.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(l=c(e,r))||l.enumerable});return t};var L=(t,e,n)=>(n=t!=null?a(h(t)):{},f(e||!t||!t.__esModule?i(n,"default",{value:t,enumerable:!0}):n,t)),T=t=>f(i({},"__esModule",{value:!0}),t);var y={};A(y,{sanitizeHelpHtml:()=>S});module.exports=T(y);var u=L(require("dompurify"),1),s=require("../../lib/safe-href.cjs"),b=["h1","h2","h3","h4","h5","h6","p","br","hr","blockquote","pre","div","span","ul","ol","li","table","thead","tbody","tr","th","td","a","strong","b","em","i","del","s","code","kbd"],g={ALLOWED_TAGS:b,ALLOWED_ATTR:["href","title"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1};function m(t){try{let e=new URL(t,window.location.href);return(e.protocol==="http:"||e.protocol==="https:")&&e.origin!==window.location.origin}catch{return!1}}function _(t){if(t.nodeType!==1)return;let e=t,n=e.getAttribute("href");if(n!==null){if(e.tagName!=="A"||(0,s.safeHref)(n)===void 0){e.removeAttribute("href");return}m(n)&&e.setAttribute("rel","noopener noreferrer")}}var o=null;function w(){if(o)return o;if(typeof window>"u")return null;let t=(0,u.default)(window);return t.isSupported?(t.addHook("afterSanitizeAttributes",_),o=t,o):null}function S(t){let e=w();return e?e.sanitize(t,g):""}0&&(module.exports={sanitizeHelpHtml});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import i from"dompurify";import{safeHref as o}from"../../lib/safe-href.js";var l=["h1","h2","h3","h4","h5","h6","p","br","hr","blockquote","pre","div","span","ul","ol","li","table","thead","tbody","tr","th","td","a","strong","b","em","i","del","s","code","kbd"],f={ALLOWED_TAGS:l,ALLOWED_ATTR:["href","title"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1};function u(e){try{let t=new URL(e,window.location.href);return(t.protocol==="http:"||t.protocol==="https:")&&t.origin!==window.location.origin}catch{return!1}}function s(e){if(e.nodeType!==1)return;let t=e,r=t.getAttribute("href");if(r!==null){if(t.tagName!=="A"||o(r)===void 0){t.removeAttribute("href");return}u(r)&&t.setAttribute("rel","noopener noreferrer")}}var n=null;function a(){if(n)return n;if(typeof window>"u")return null;let e=i(window);return e.isSupported?(e.addHook("afterSanitizeAttributes",s),n=e,n):null}function h(e){let t=a();return t?t.sanitize(e,f):""}export{h as sanitizeHelpHtml};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var T=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var ee=(t,r)=>{for(var a in r)T(t,a,{get:r[a],enumerable:!0})},te=(t,r,a,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Z(r))!_.call(t,s)&&s!==a&&T(t,s,{get:()=>r[s],enumerable:!(n=K(r,s))||n.enumerable});return t};var re=t=>te(T({},"__esModule",{value:!0}),t);var ge={};ee(ge,{Sidebar:()=>se,SidebarContent:()=>de,SidebarFooter:()=>ce,SidebarGroup:()=>ue,SidebarHeader:()=>le,SidebarItem:()=>pe,SidebarSubMenu:()=>be,SidebarToggle:()=>fe,useSidebar:()=>ae});module.exports=re(ge);var o=require("react"),j=require("../../hooks/useDialogA11y.cjs"),i=require("../../lib/cn.cjs"),M=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),E=(0,o.createContext)(null);function v(){let t=(0,o.useContext)(E);if(!t)throw new Error("Sidebar sub-components must be used within <Sidebar>");return t}function ae(){return v()}var oe=({className:t})=>(0,e.jsx)("svg",{className:(0,i.cn)("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})}),ne=({className:t})=>(0,e.jsx)("svg",{className:(0,i.cn)("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),ie=({className:t})=>(0,e.jsx)("svg",{className:(0,i.cn)("w-5 h-5",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})});function B({text:t,position:r,children:a}){let[n,s]=(0,o.useState)(!1),[c,f]=(0,o.useState)({top:0,left:0}),u=(0,o.useRef)(null);return(0,e.jsxs)("div",{ref:u,onMouseEnter:()=>{if(u.current){let d=u.current.getBoundingClientRect();f({top:d.top+d.height/2,left:r==="left"?d.right+8:d.left-8})}s(!0)},onMouseLeave:()=>s(!1),className:"relative",children:[a,n&&(0,e.jsx)("div",{className:(0,i.cn)("fixed z-[9999] px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900 dark:bg-gray-700 rounded-md shadow-lg whitespace-nowrap pointer-events-none",r==="right"&&"-translate-x-full"),style:{top:c.top,left:c.left,transform:`translateY(-50%)${r==="right"?" translateX(-100%)":""}`},role:"tooltip",children:t})]})}function se({collapsed:t,defaultCollapsed:r=!1,onCollapsedChange:a,expandedWidth:n=260,collapsedWidth:s=64,position:c="left",variant:f="default",mobileBreakpoint:u=768,mobileOpen:x,onMobileOpenChange:d,className:m,"aria-label":p,closeLabel:N,trapFocus:g=!0,initialFocus:S,returnFocus:w,lockScroll:C=!0,children:O}){let G=(0,M.useUILabels)(),D=(0,o.useRef)(null),F=(0,o.useRef)(null),[q,Q]=(0,o.useState)(r),[W,R]=(0,o.useState)(!1),[b,$]=(0,o.useState)(!1),L=t!==void 0,k=L?t:q,y=x!==void 0,h=y?x:W;(0,o.useEffect)(()=>{if(typeof window.matchMedia!="function")return;let l=window.matchMedia(`(max-width: ${u}px)`),I=A=>{$(A.matches),A.matches||(y||R(!1),d?.(!1))};return I(l),l.addEventListener("change",I),()=>l.removeEventListener("change",I)},[u,y,d]);let U=(0,o.useCallback)(()=>{if(b){let l=!h;y||R(l),d?.(l)}else{let l=!k;L||Q(l),a?.(l)}},[b,h,k,y,L,d,a]),P=(0,o.useCallback)(()=>{y||R(!1),d?.(!1)},[y,d]);(0,o.useEffect)(()=>{let l=F.current;l&&(b&&!h?(l.setAttribute("inert",""),l.setAttribute("aria-hidden","true")):(l.removeAttribute("inert"),l.removeAttribute("aria-hidden")))},[b,h]);let{dialogRef:X,dialogProps:Y}=(0,j.useDialogA11y)({open:b&&h,onClose:P,trapFocus:g,initialFocus:S,returnFocus:w,lockScroll:C,keepInteractive:[D]}),J={default:"bg-white dark:bg-gray-900",bordered:(0,i.cn)("bg-white dark:bg-gray-900",c==="left"?"border-r border-gray-200 dark:border-gray-700":"border-l border-gray-200 dark:border-gray-700"),floating:"bg-white dark:bg-gray-900 m-3 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700"},H=k&&!b?s:n,V=(0,e.jsx)("aside",{className:(0,i.cn)("flex flex-col h-full overflow-hidden transition-[width] duration-200 ease-in-out",J[f],m),style:{width:b?n:H,minWidth:b?n:H},"data-testid":"sidebar","data-collapsed":k&&!b,"data-mobile":b,"data-position":c,children:O}),z={collapsed:k&&!b,isMobile:b,mobileOpen:h,position:c,variant:f,expandedWidth:n,collapsedWidth:s,toggle:U,closeMobile:P,closeLabel:N};return b?(0,e.jsxs)(E.Provider,{value:z,children:[h&&(0,e.jsx)("div",{ref:D,className:"fixed inset-0 z-40 bg-black/50 transition-opacity",onClick:P,"aria-hidden":"true","data-testid":"sidebar-overlay"}),(0,e.jsx)("div",{ref:l=>{F.current=l,X.current=l},...Y,"aria-label":p??G.sidebar,className:(0,i.cn)("fixed top-0 z-50 h-full transition-transform duration-200 ease-in-out focus:outline-none",c==="left"?"left-0":"right-0",h?"translate-x-0":c==="left"?"-translate-x-full":"translate-x-full"),children:V})]}):(0,e.jsx)(E.Provider,{value:z,children:V})}function le({className:t,children:r}){let a=v(),n=(0,M.useUILabels)();return(0,e.jsxs)("div",{className:(0,i.cn)("flex items-center shrink-0 px-4 h-14 overflow-hidden",a.collapsed&&"justify-center px-2",t),"data-testid":"sidebar-header",children:[r,a.isMobile&&a.mobileOpen&&(0,e.jsx)("button",{type:"button",onClick:a.closeMobile,className:"ml-auto p-1 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer","aria-label":a.closeLabel??n.closeSidebar,children:(0,e.jsx)(ie,{})})]})}function de({className:t,children:r}){return(0,e.jsx)("div",{className:(0,i.cn)("flex-1 overflow-y-auto overflow-x-hidden py-2",t),"data-testid":"sidebar-content",children:r})}function ce({className:t,children:r}){let a=v();return(0,e.jsx)("div",{className:(0,i.cn)("shrink-0 border-t border-gray-200 dark:border-gray-700 px-4 py-3 overflow-hidden",a.collapsed&&"px-2 flex justify-center",t),"data-testid":"sidebar-footer",children:r})}function ue({label:t,className:r,children:a}){let n=v();return(0,e.jsxs)("div",{className:(0,i.cn)("py-2",r),"data-testid":"sidebar-group",children:[t&&!n.collapsed&&(0,e.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:t}),t&&n.collapsed&&(0,e.jsx)("div",{className:"mx-auto my-1 w-6 border-t border-gray-200 dark:border-gray-700"}),(0,e.jsx)("div",{className:"space-y-0.5 px-2",children:a})]})}function pe({icon:t,label:r,badge:a,badgeColor:n="bg-synertech-primary-600 text-synertech-on-primary",active:s=!1,disabled:c=!1,href:f,onClick:u,tooltip:x,className:d}){let m=v(),p=m.collapsed,N=x??r,g=(0,e.jsxs)(e.Fragment,{children:[t&&(0,e.jsx)("span",{className:(0,i.cn)("shrink-0 w-5 h-5",p&&"w-5 h-5"),children:t}),!p&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"flex-1 truncate",children:r}),a!=null&&(0,e.jsx)("span",{className:(0,i.cn)("shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1",n),children:a})]}),p&&a!==void 0&&a!==null&&(0,e.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-synertech-primary-600"})]}),S=(0,i.cn)("relative flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full",p?"justify-center px-2 py-2.5":"px-3 py-2",s?"bg-synertech-primary-50 text-synertech-primary-700 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",c&&"opacity-50 pointer-events-none",!c&&"cursor-pointer",d),w=()=>{c||(u?.(),m.isMobile&&m.closeMobile())},C=f?(0,e.jsx)("a",{href:c?void 0:f,className:S,onClick:w,"aria-current":s?"page":void 0,"data-testid":"sidebar-item",children:g}):(0,e.jsx)("button",{type:"button",className:S,onClick:w,disabled:c,"aria-current":s?"page":void 0,"data-testid":"sidebar-item",children:g});return p?(0,e.jsx)(B,{text:N,position:m.position,children:C}):C}function be({icon:t,label:r,badge:a,defaultOpen:n=!1,className:s,children:c}){let f=v(),[u,x]=(0,o.useState)(n),d=(0,o.useRef)(null),[m,p]=(0,o.useState)(n?void 0:0),N=(0,o.useRef)(!0);return(0,o.useEffect)(()=>{if(N.current){N.current=!1,p(u?void 0:0);return}if(u){let g=d.current;if(g){p(g.scrollHeight);let S=setTimeout(()=>p(void 0),200);return()=>clearTimeout(S)}}else{let g=d.current;g&&(p(g.scrollHeight),requestAnimationFrame(()=>p(0)))}},[u]),f.collapsed?(0,e.jsx)(B,{text:r,position:f.position,children:(0,e.jsxs)("button",{type:"button",className:(0,i.cn)("relative flex items-center justify-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-2 py-2.5","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer",s),onClick:()=>{f.toggle(),x(!0)},"data-testid":"sidebar-submenu-trigger",children:[t&&(0,e.jsx)("span",{className:"shrink-0 w-5 h-5",children:t}),a!=null&&(0,e.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-synertech-primary-600"})]})}):(0,e.jsxs)("div",{className:s,"data-testid":"sidebar-submenu",children:[(0,e.jsxs)("button",{type:"button",className:(0,i.cn)("flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-3 py-2","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"),onClick:()=>x(!u),"aria-expanded":u,"data-testid":"sidebar-submenu-trigger",children:[t&&(0,e.jsx)("span",{className:"shrink-0 w-5 h-5",children:t}),(0,e.jsx)("span",{className:"flex-1 truncate text-left",children:r}),a!=null&&(0,e.jsx)("span",{className:"shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1 bg-synertech-primary-600 text-synertech-on-primary",children:a}),(0,e.jsx)(ne,{className:(0,i.cn)("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",u&&"rotate-180")})]}),(0,e.jsx)("div",{className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:m===void 0?"auto":m},children:(0,e.jsx)("div",{ref:d,className:"pl-4 py-0.5",children:c})})]})}function fe({className:t}){let r=v(),a=(0,M.useUILabels)(),n=r.isMobile?r.mobileOpen?r.closeLabel??a.closeSidebar:a.openSidebar:r.collapsed?a.expandSidebar:a.collapseSidebar;return(0,e.jsx)("button",{type:"button",onClick:r.toggle,className:(0,i.cn)("p-1.5 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer",t),"aria-label":n,"data-testid":"sidebar-toggle",children:(0,e.jsx)(oe,{className:(0,i.cn)("transition-transform duration-200",r.collapsed&&"rotate-180",r.position==="right"&&!r.collapsed&&"rotate-180",r.position==="right"&&r.collapsed&&"rotate-0")})})}0&&(module.exports={Sidebar,SidebarContent,SidebarFooter,SidebarGroup,SidebarHeader,SidebarItem,SidebarSubMenu,SidebarToggle,useSidebar});
|
|
1
|
+
"use strict";"use client";var E=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(t,r)=>{for(var a in r)E(t,a,{get:r[a],enumerable:!0})},re=(t,r,a,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of _(r))!ee.call(t,s)&&s!==a&&E(t,s,{get:()=>r[s],enumerable:!(n=Z(r,s))||n.enumerable});return t};var ae=t=>re(E({},"__esModule",{value:!0}),t);var me={};te(me,{Sidebar:()=>le,SidebarContent:()=>ce,SidebarFooter:()=>ue,SidebarGroup:()=>pe,SidebarHeader:()=>de,SidebarItem:()=>be,SidebarSubMenu:()=>fe,SidebarToggle:()=>ge,useSidebar:()=>oe});module.exports=ae(me);var o=require("react"),B=require("../../hooks/useDialogA11y.cjs"),i=require("../../lib/cn.cjs"),O=require("../../lib/safe-href.cjs"),R=require("../../lib/i18n.cjs"),e=require("react/jsx-runtime"),H=(0,o.createContext)(null);function v(){let t=(0,o.useContext)(H);if(!t)throw new Error("Sidebar sub-components must be used within <Sidebar>");return t}function oe(){return v()}var ne=({className:t})=>(0,e.jsx)("svg",{className:(0,i.cn)("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})}),ie=({className:t})=>(0,e.jsx)("svg",{className:(0,i.cn)("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),se=({className:t})=>(0,e.jsx)("svg",{className:(0,i.cn)("w-5 h-5",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})});function G({text:t,position:r,children:a}){let[n,s]=(0,o.useState)(!1),[c,f]=(0,o.useState)({top:0,left:0}),u=(0,o.useRef)(null);return(0,e.jsxs)("div",{ref:u,onMouseEnter:()=>{if(u.current){let d=u.current.getBoundingClientRect();f({top:d.top+d.height/2,left:r==="left"?d.right+8:d.left-8})}s(!0)},onMouseLeave:()=>s(!1),className:"relative",children:[a,n&&(0,e.jsx)("div",{className:(0,i.cn)("fixed z-[9999] px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900 dark:bg-gray-700 rounded-md shadow-lg whitespace-nowrap pointer-events-none",r==="right"&&"-translate-x-full"),style:{top:c.top,left:c.left,transform:`translateY(-50%)${r==="right"?" translateX(-100%)":""}`},role:"tooltip",children:t})]})}function le({collapsed:t,defaultCollapsed:r=!1,onCollapsedChange:a,expandedWidth:n=260,collapsedWidth:s=64,position:c="left",variant:f="default",mobileBreakpoint:u=768,mobileOpen:x,onMobileOpenChange:d,className:m,"aria-label":p,closeLabel:N,trapFocus:g=!0,initialFocus:S,returnFocus:w,lockScroll:C=!0,children:M}){let q=(0,R.useUILabels)(),D=(0,o.useRef)(null),F=(0,o.useRef)(null),[Q,W]=(0,o.useState)(r),[$,L]=(0,o.useState)(!1),[b,U]=(0,o.useState)(!1),P=t!==void 0,k=P?t:Q,y=x!==void 0,h=y?x:$;(0,o.useEffect)(()=>{if(typeof window.matchMedia!="function")return;let l=window.matchMedia(`(max-width: ${u}px)`),T=j=>{U(j.matches),j.matches||(y||L(!1),d?.(!1))};return T(l),l.addEventListener("change",T),()=>l.removeEventListener("change",T)},[u,y,d]);let X=(0,o.useCallback)(()=>{if(b){let l=!h;y||L(l),d?.(l)}else{let l=!k;P||W(l),a?.(l)}},[b,h,k,y,P,d,a]),I=(0,o.useCallback)(()=>{y||L(!1),d?.(!1)},[y,d]);(0,o.useEffect)(()=>{let l=F.current;l&&(b&&!h?(l.setAttribute("inert",""),l.setAttribute("aria-hidden","true")):(l.removeAttribute("inert"),l.removeAttribute("aria-hidden")))},[b,h]);let{dialogRef:Y,dialogProps:J}=(0,B.useDialogA11y)({open:b&&h,onClose:I,trapFocus:g,initialFocus:S,returnFocus:w,lockScroll:C,keepInteractive:[D]}),K={default:"bg-white dark:bg-gray-900",bordered:(0,i.cn)("bg-white dark:bg-gray-900",c==="left"?"border-r border-gray-200 dark:border-gray-700":"border-l border-gray-200 dark:border-gray-700"),floating:"bg-white dark:bg-gray-900 m-3 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700"},V=k&&!b?s:n,z=(0,e.jsx)("aside",{className:(0,i.cn)("flex flex-col h-full overflow-hidden transition-[width] duration-200 ease-in-out",K[f],m),style:{width:b?n:V,minWidth:b?n:V},"data-testid":"sidebar","data-collapsed":k&&!b,"data-mobile":b,"data-position":c,children:M}),A={collapsed:k&&!b,isMobile:b,mobileOpen:h,position:c,variant:f,expandedWidth:n,collapsedWidth:s,toggle:X,closeMobile:I,closeLabel:N};return b?(0,e.jsxs)(H.Provider,{value:A,children:[h&&(0,e.jsx)("div",{ref:D,className:"fixed inset-0 z-40 bg-black/50 transition-opacity",onClick:I,"aria-hidden":"true","data-testid":"sidebar-overlay"}),(0,e.jsx)("div",{ref:l=>{F.current=l,Y.current=l},...J,"aria-label":p??q.sidebar,className:(0,i.cn)("fixed top-0 z-50 h-full transition-transform duration-200 ease-in-out focus:outline-none",c==="left"?"left-0":"right-0",h?"translate-x-0":c==="left"?"-translate-x-full":"translate-x-full"),children:z})]}):(0,e.jsx)(H.Provider,{value:A,children:z})}function de({className:t,children:r}){let a=v(),n=(0,R.useUILabels)();return(0,e.jsxs)("div",{className:(0,i.cn)("flex items-center shrink-0 px-4 h-14 overflow-hidden",a.collapsed&&"justify-center px-2",t),"data-testid":"sidebar-header",children:[r,a.isMobile&&a.mobileOpen&&(0,e.jsx)("button",{type:"button",onClick:a.closeMobile,className:"ml-auto p-1 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer","aria-label":a.closeLabel??n.closeSidebar,children:(0,e.jsx)(se,{})})]})}function ce({className:t,children:r}){return(0,e.jsx)("div",{className:(0,i.cn)("flex-1 overflow-y-auto overflow-x-hidden py-2",t),"data-testid":"sidebar-content",children:r})}function ue({className:t,children:r}){let a=v();return(0,e.jsx)("div",{className:(0,i.cn)("shrink-0 border-t border-gray-200 dark:border-gray-700 px-4 py-3 overflow-hidden",a.collapsed&&"px-2 flex justify-center",t),"data-testid":"sidebar-footer",children:r})}function pe({label:t,className:r,children:a}){let n=v();return(0,e.jsxs)("div",{className:(0,i.cn)("py-2",r),"data-testid":"sidebar-group",children:[t&&!n.collapsed&&(0,e.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:t}),t&&n.collapsed&&(0,e.jsx)("div",{className:"mx-auto my-1 w-6 border-t border-gray-200 dark:border-gray-700"}),(0,e.jsx)("div",{className:"space-y-0.5 px-2",children:a})]})}function be({icon:t,label:r,badge:a,badgeColor:n="bg-synertech-primary-600 text-synertech-on-primary",active:s=!1,disabled:c=!1,href:f,onClick:u,tooltip:x,className:d}){let m=v(),p=m.collapsed,N=x??r,g=(0,e.jsxs)(e.Fragment,{children:[t&&(0,e.jsx)("span",{className:(0,i.cn)("shrink-0 w-5 h-5",p&&"w-5 h-5"),children:t}),!p&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"flex-1 truncate",children:r}),a!=null&&(0,e.jsx)("span",{className:(0,i.cn)("shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1",n),children:a})]}),p&&a!==void 0&&a!==null&&(0,e.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-synertech-primary-600"})]}),S=(0,i.cn)("relative flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full",p?"justify-center px-2 py-2.5":"px-3 py-2",s?"bg-synertech-primary-50 text-synertech-primary-700 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",c&&"opacity-50 pointer-events-none",!c&&"cursor-pointer",d),w=()=>{c||(u?.(),m.isMobile&&m.closeMobile())},C=(0,O.componentHref)("SidebarItem",f),M=C?(0,e.jsx)("a",{href:c?void 0:C,className:S,onClick:w,"aria-current":s?"page":void 0,"data-testid":"sidebar-item",children:g}):(0,e.jsx)("button",{type:"button",className:S,onClick:w,disabled:c,"aria-current":s?"page":void 0,"data-testid":"sidebar-item",children:g});return p?(0,e.jsx)(G,{text:N,position:m.position,children:M}):M}function fe({icon:t,label:r,badge:a,defaultOpen:n=!1,className:s,children:c}){let f=v(),[u,x]=(0,o.useState)(n),d=(0,o.useRef)(null),[m,p]=(0,o.useState)(n?void 0:0),N=(0,o.useRef)(!0);return(0,o.useEffect)(()=>{if(N.current){N.current=!1,p(u?void 0:0);return}if(u){let g=d.current;if(g){p(g.scrollHeight);let S=setTimeout(()=>p(void 0),200);return()=>clearTimeout(S)}}else{let g=d.current;g&&(p(g.scrollHeight),requestAnimationFrame(()=>p(0)))}},[u]),f.collapsed?(0,e.jsx)(G,{text:r,position:f.position,children:(0,e.jsxs)("button",{type:"button",className:(0,i.cn)("relative flex items-center justify-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-2 py-2.5","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer",s),onClick:()=>{f.toggle(),x(!0)},"data-testid":"sidebar-submenu-trigger",children:[t&&(0,e.jsx)("span",{className:"shrink-0 w-5 h-5",children:t}),a!=null&&(0,e.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-synertech-primary-600"})]})}):(0,e.jsxs)("div",{className:s,"data-testid":"sidebar-submenu",children:[(0,e.jsxs)("button",{type:"button",className:(0,i.cn)("flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-3 py-2","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"),onClick:()=>x(!u),"aria-expanded":u,"data-testid":"sidebar-submenu-trigger",children:[t&&(0,e.jsx)("span",{className:"shrink-0 w-5 h-5",children:t}),(0,e.jsx)("span",{className:"flex-1 truncate text-left",children:r}),a!=null&&(0,e.jsx)("span",{className:"shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1 bg-synertech-primary-600 text-synertech-on-primary",children:a}),(0,e.jsx)(ie,{className:(0,i.cn)("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",u&&"rotate-180")})]}),(0,e.jsx)("div",{className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:m===void 0?"auto":m},children:(0,e.jsx)("div",{ref:d,className:"pl-4 py-0.5",children:c})})]})}function ge({className:t}){let r=v(),a=(0,R.useUILabels)(),n=r.isMobile?r.mobileOpen?r.closeLabel??a.closeSidebar:a.openSidebar:r.collapsed?a.expandSidebar:a.collapseSidebar;return(0,e.jsx)("button",{type:"button",onClick:r.toggle,className:(0,i.cn)("p-1.5 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer",t),"aria-label":n,"data-testid":"sidebar-toggle",children:(0,e.jsx)(ne,{className:(0,i.cn)("transition-transform duration-200",r.collapsed&&"rotate-180",r.position==="right"&&!r.collapsed&&"rotate-180",r.position==="right"&&r.collapsed&&"rotate-0")})})}0&&(module.exports={Sidebar,SidebarContent,SidebarFooter,SidebarGroup,SidebarHeader,SidebarItem,SidebarSubMenu,SidebarToggle,useSidebar});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createContext as ee,useContext as te,useState as v,useCallback as
|
|
1
|
+
"use client";import{createContext as ee,useContext as te,useState as v,useCallback as G,useEffect as H,useRef as C}from"react";import{useDialogA11y as re}from"../../hooks/useDialogA11y.js";import{cn as o}from"../../lib/cn.js";import{componentHref as ae}from"../../lib/safe-href.js";import{useUILabels as F}from"../../lib/i18n.js";import{Fragment as q,jsx as e,jsxs as m}from"react/jsx-runtime";var D=ee(null);function N(){let t=te(D);if(!t)throw new Error("Sidebar sub-components must be used within <Sidebar>");return t}function pe(){return N()}var oe=({className:t})=>e("svg",{className:o("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})}),ne=({className:t})=>e("svg",{className:o("w-4 h-4",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),ie=({className:t})=>e("svg",{className:o("w-5 h-5",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})});function Q({text:t,position:a,children:r}){let[n,p]=v(!1),[l,b]=v({top:0,left:0}),d=C(null);return m("div",{ref:d,onMouseEnter:()=>{if(d.current){let s=d.current.getBoundingClientRect();b({top:s.top+s.height/2,left:a==="left"?s.right+8:s.left-8})}p(!0)},onMouseLeave:()=>p(!1),className:"relative",children:[r,n&&e("div",{className:o("fixed z-[9999] px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900 dark:bg-gray-700 rounded-md shadow-lg whitespace-nowrap pointer-events-none",a==="right"&&"-translate-x-full"),style:{top:l.top,left:l.left,transform:`translateY(-50%)${a==="right"?" translateX(-100%)":""}`},role:"tooltip",children:t})]})}function be({collapsed:t,defaultCollapsed:a=!1,onCollapsedChange:r,expandedWidth:n=260,collapsedWidth:p=64,position:l="left",variant:b="default",mobileBreakpoint:d=768,mobileOpen:x,onMobileOpenChange:s,className:g,"aria-label":c,closeLabel:S,trapFocus:f=!0,initialFocus:k,returnFocus:M,lockScroll:R=!0,children:L}){let W=F(),V=C(null),z=C(null),[$,U]=v(a),[X,P]=v(!1),[u,Y]=v(!1),I=t!==void 0,w=I?t:$,y=x!==void 0,h=y?x:X;H(()=>{if(typeof window.matchMedia!="function")return;let i=window.matchMedia(`(max-width: ${d}px)`),E=O=>{Y(O.matches),O.matches||(y||P(!1),s?.(!1))};return E(i),i.addEventListener("change",E),()=>i.removeEventListener("change",E)},[d,y,s]);let J=G(()=>{if(u){let i=!h;y||P(i),s?.(i)}else{let i=!w;I||U(i),r?.(i)}},[u,h,w,y,I,s,r]),T=G(()=>{y||P(!1),s?.(!1)},[y,s]);H(()=>{let i=z.current;i&&(u&&!h?(i.setAttribute("inert",""),i.setAttribute("aria-hidden","true")):(i.removeAttribute("inert"),i.removeAttribute("aria-hidden")))},[u,h]);let{dialogRef:K,dialogProps:Z}=re({open:u&&h,onClose:T,trapFocus:f,initialFocus:k,returnFocus:M,lockScroll:R,keepInteractive:[V]}),_={default:"bg-white dark:bg-gray-900",bordered:o("bg-white dark:bg-gray-900",l==="left"?"border-r border-gray-200 dark:border-gray-700":"border-l border-gray-200 dark:border-gray-700"),floating:"bg-white dark:bg-gray-900 m-3 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700"},A=w&&!u?p:n,j=e("aside",{className:o("flex flex-col h-full overflow-hidden transition-[width] duration-200 ease-in-out",_[b],g),style:{width:u?n:A,minWidth:u?n:A},"data-testid":"sidebar","data-collapsed":w&&!u,"data-mobile":u,"data-position":l,children:L}),B={collapsed:w&&!u,isMobile:u,mobileOpen:h,position:l,variant:b,expandedWidth:n,collapsedWidth:p,toggle:J,closeMobile:T,closeLabel:S};return u?m(D.Provider,{value:B,children:[h&&e("div",{ref:V,className:"fixed inset-0 z-40 bg-black/50 transition-opacity",onClick:T,"aria-hidden":"true","data-testid":"sidebar-overlay"}),e("div",{ref:i=>{z.current=i,K.current=i},...Z,"aria-label":c??W.sidebar,className:o("fixed top-0 z-50 h-full transition-transform duration-200 ease-in-out focus:outline-none",l==="left"?"left-0":"right-0",h?"translate-x-0":l==="left"?"-translate-x-full":"translate-x-full"),children:j})]}):e(D.Provider,{value:B,children:j})}function fe({className:t,children:a}){let r=N(),n=F();return m("div",{className:o("flex items-center shrink-0 px-4 h-14 overflow-hidden",r.collapsed&&"justify-center px-2",t),"data-testid":"sidebar-header",children:[a,r.isMobile&&r.mobileOpen&&e("button",{type:"button",onClick:r.closeMobile,className:"ml-auto p-1 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer","aria-label":r.closeLabel??n.closeSidebar,children:e(ie,{})})]})}function ge({className:t,children:a}){return e("div",{className:o("flex-1 overflow-y-auto overflow-x-hidden py-2",t),"data-testid":"sidebar-content",children:a})}function me({className:t,children:a}){let r=N();return e("div",{className:o("shrink-0 border-t border-gray-200 dark:border-gray-700 px-4 py-3 overflow-hidden",r.collapsed&&"px-2 flex justify-center",t),"data-testid":"sidebar-footer",children:a})}function xe({label:t,className:a,children:r}){let n=N();return m("div",{className:o("py-2",a),"data-testid":"sidebar-group",children:[t&&!n.collapsed&&e("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:t}),t&&n.collapsed&&e("div",{className:"mx-auto my-1 w-6 border-t border-gray-200 dark:border-gray-700"}),e("div",{className:"space-y-0.5 px-2",children:r})]})}function he({icon:t,label:a,badge:r,badgeColor:n="bg-synertech-primary-600 text-synertech-on-primary",active:p=!1,disabled:l=!1,href:b,onClick:d,tooltip:x,className:s}){let g=N(),c=g.collapsed,S=x??a,f=m(q,{children:[t&&e("span",{className:o("shrink-0 w-5 h-5",c&&"w-5 h-5"),children:t}),!c&&m(q,{children:[e("span",{className:"flex-1 truncate",children:a}),r!=null&&e("span",{className:o("shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1",n),children:r})]}),c&&r!==void 0&&r!==null&&e("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-synertech-primary-600"})]}),k=o("relative flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full",c?"justify-center px-2 py-2.5":"px-3 py-2",p?"bg-synertech-primary-50 text-synertech-primary-700 dark:bg-synertech-primary-900/30 dark:text-synertech-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",l&&"opacity-50 pointer-events-none",!l&&"cursor-pointer",s),M=()=>{l||(d?.(),g.isMobile&&g.closeMobile())},R=ae("SidebarItem",b),L=R?e("a",{href:l?void 0:R,className:k,onClick:M,"aria-current":p?"page":void 0,"data-testid":"sidebar-item",children:f}):e("button",{type:"button",className:k,onClick:M,disabled:l,"aria-current":p?"page":void 0,"data-testid":"sidebar-item",children:f});return c?e(Q,{text:S,position:g.position,children:L}):L}function ye({icon:t,label:a,badge:r,defaultOpen:n=!1,className:p,children:l}){let b=N(),[d,x]=v(n),s=C(null),[g,c]=v(n?void 0:0),S=C(!0);return H(()=>{if(S.current){S.current=!1,c(d?void 0:0);return}if(d){let f=s.current;if(f){c(f.scrollHeight);let k=setTimeout(()=>c(void 0),200);return()=>clearTimeout(k)}}else{let f=s.current;f&&(c(f.scrollHeight),requestAnimationFrame(()=>c(0)))}},[d]),b.collapsed?e(Q,{text:a,position:b.position,children:m("button",{type:"button",className:o("relative flex items-center justify-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-2 py-2.5","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer",p),onClick:()=>{b.toggle(),x(!0)},"data-testid":"sidebar-submenu-trigger",children:[t&&e("span",{className:"shrink-0 w-5 h-5",children:t}),r!=null&&e("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-synertech-primary-600"})]})}):m("div",{className:p,"data-testid":"sidebar-submenu",children:[m("button",{type:"button",className:o("flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-3 py-2","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"),onClick:()=>x(!d),"aria-expanded":d,"data-testid":"sidebar-submenu-trigger",children:[t&&e("span",{className:"shrink-0 w-5 h-5",children:t}),e("span",{className:"flex-1 truncate text-left",children:a}),r!=null&&e("span",{className:"shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1 bg-synertech-primary-600 text-synertech-on-primary",children:r}),e(ne,{className:o("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",d&&"rotate-180")})]}),e("div",{className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:g===void 0?"auto":g},children:e("div",{ref:s,className:"pl-4 py-0.5",children:l})})]})}function ve({className:t}){let a=N(),r=F(),n=a.isMobile?a.mobileOpen?a.closeLabel??r.closeSidebar:r.openSidebar:a.collapsed?r.expandSidebar:r.collapseSidebar;return e("button",{type:"button",onClick:a.toggle,className:o("p-1.5 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer",t),"aria-label":n,"data-testid":"sidebar-toggle",children:e(oe,{className:o("transition-transform duration-200",a.collapsed&&"rotate-180",a.position==="right"&&!a.collapsed&&"rotate-180",a.position==="right"&&a.collapsed&&"rotate-0")})})}export{be as Sidebar,ge as SidebarContent,me as SidebarFooter,xe as SidebarGroup,fe as SidebarHeader,he as SidebarItem,ye as SidebarSubMenu,ve as SidebarToggle,pe as useSidebar};
|
package/dist/index.d.cts
CHANGED
|
@@ -895,6 +895,11 @@ declare namespace Banner {
|
|
|
895
895
|
|
|
896
896
|
interface BreadcrumbItem {
|
|
897
897
|
label: string;
|
|
898
|
+
/**
|
|
899
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
900
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
901
|
+
* and the console says so once.
|
|
902
|
+
*/
|
|
898
903
|
href?: string;
|
|
899
904
|
icon?: ReactNode;
|
|
900
905
|
onClick?: () => void;
|
|
@@ -4498,6 +4503,11 @@ declare const NumberInput: react.ForwardRefExoticComponent<NumberInputProps & re
|
|
|
4498
4503
|
|
|
4499
4504
|
interface NavItem {
|
|
4500
4505
|
label: string;
|
|
4506
|
+
/**
|
|
4507
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
4508
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
4509
|
+
* and the console says so once.
|
|
4510
|
+
*/
|
|
4501
4511
|
href?: string;
|
|
4502
4512
|
icon?: ReactNode;
|
|
4503
4513
|
badge?: string | number;
|
|
@@ -4508,6 +4518,11 @@ interface NavItem {
|
|
|
4508
4518
|
}
|
|
4509
4519
|
interface HeaderProps {
|
|
4510
4520
|
logo?: ReactNode;
|
|
4521
|
+
/**
|
|
4522
|
+
* Where the logo leads. Any other address than an `http:`, `https:`,
|
|
4523
|
+
* `mailto:`, `tel:` or relative one (`javascript:`…) leaves the logo
|
|
4524
|
+
* without a link.
|
|
4525
|
+
*/
|
|
4511
4526
|
logoHref?: string;
|
|
4512
4527
|
onLogoClick?: () => void;
|
|
4513
4528
|
navItems?: NavItem[];
|
|
@@ -4535,6 +4550,15 @@ interface HeaderProps {
|
|
|
4535
4550
|
declare function Header({ logo, logoHref, onLogoClick, navItems, actions, rightContent, variant, size, backgroundColor, textColor, hoverColor, navItemTextColor, navItemHoverColor, navItemBgHover, navItemActiveColor, sticky, fixed, showSearch, onSearch, searchPlaceholder: searchPlaceholderProp, menuLabel, className, containerClassName, }: HeaderProps): react_jsx_runtime.JSX.Element;
|
|
4536
4551
|
|
|
4537
4552
|
interface HelpButtonProps {
|
|
4553
|
+
/**
|
|
4554
|
+
* What the bubble shows: a node as it is, a string as Markdown under
|
|
4555
|
+
* `markdown`, and as HTML otherwise. That HTML keeps the formatting Markdown
|
|
4556
|
+
* produces — headings, paragraphs, lists, links, code, quotes, tables — and
|
|
4557
|
+
* nothing else: `<style>`, forms and their fields, images and frames are
|
|
4558
|
+
* dropped, and so are `class`, `style`, `id` and `name`. A link keeps an
|
|
4559
|
+
* `http:`, `https:`, `mailto:`, `tel:` or relative address. Neither mode
|
|
4560
|
+
* shows an image: a help that needs one is given as a node.
|
|
4561
|
+
*/
|
|
4538
4562
|
content: string | ReactNode;
|
|
4539
4563
|
markdown?: boolean;
|
|
4540
4564
|
position?: "top" | "bottom" | "left" | "right";
|
|
@@ -5224,7 +5248,11 @@ interface SidebarItemProps {
|
|
|
5224
5248
|
active?: boolean;
|
|
5225
5249
|
/** Disabled state */
|
|
5226
5250
|
disabled?: boolean;
|
|
5227
|
-
/**
|
|
5251
|
+
/**
|
|
5252
|
+
* Where the item leads, rendered as a link. Any other address than an
|
|
5253
|
+
* `http:`, `https:`, `mailto:`, `tel:` or relative one (`javascript:`…)
|
|
5254
|
+
* leaves it a button, and the console says so once.
|
|
5255
|
+
*/
|
|
5228
5256
|
href?: string;
|
|
5229
5257
|
/** Click handler */
|
|
5230
5258
|
onClick?: () => void;
|
|
@@ -5592,9 +5620,19 @@ declare namespace FooterColumn {
|
|
|
5592
5620
|
}
|
|
5593
5621
|
|
|
5594
5622
|
interface FooterLinkProps extends ComponentPropsWithoutRef<"a"> {
|
|
5623
|
+
/**
|
|
5624
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
5625
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
5626
|
+
* and the console says so once.
|
|
5627
|
+
*/
|
|
5628
|
+
href?: string;
|
|
5629
|
+
/**
|
|
5630
|
+
* Opens the link in a new tab, with `noopener noreferrer` added to the
|
|
5631
|
+
* `rel` it is given.
|
|
5632
|
+
*/
|
|
5595
5633
|
external?: boolean;
|
|
5596
5634
|
}
|
|
5597
|
-
declare function FooterLink({ external, className, children, ...props }: FooterLinkProps): react_jsx_runtime.JSX.Element;
|
|
5635
|
+
declare function FooterLink({ external, href, rel, className, children, ...props }: FooterLinkProps): react_jsx_runtime.JSX.Element;
|
|
5598
5636
|
declare namespace FooterLink {
|
|
5599
5637
|
var displayName: string;
|
|
5600
5638
|
}
|
|
@@ -5612,6 +5650,17 @@ interface FooterSocialProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
5612
5650
|
children?: ReactNode;
|
|
5613
5651
|
}
|
|
5614
5652
|
interface FooterSocialLinkProps extends ComponentPropsWithoutRef<"a"> {
|
|
5653
|
+
/**
|
|
5654
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
5655
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
5656
|
+
* and the console says so once.
|
|
5657
|
+
*/
|
|
5658
|
+
href?: string;
|
|
5659
|
+
/**
|
|
5660
|
+
* Added to `noopener noreferrer`, which the link always carries: it opens
|
|
5661
|
+
* in a new tab.
|
|
5662
|
+
*/
|
|
5663
|
+
rel?: string;
|
|
5615
5664
|
icon: ReactNode;
|
|
5616
5665
|
label: string;
|
|
5617
5666
|
}
|
|
@@ -5619,7 +5668,7 @@ declare function FooterSocial({ className, children, ...props }: FooterSocialPro
|
|
|
5619
5668
|
declare namespace FooterSocial {
|
|
5620
5669
|
var displayName: string;
|
|
5621
5670
|
}
|
|
5622
|
-
declare function FooterSocialLink({ icon, label, className, ...props }: FooterSocialLinkProps): react_jsx_runtime.JSX.Element;
|
|
5671
|
+
declare function FooterSocialLink({ icon, label, href, rel, className, ...props }: FooterSocialLinkProps): react_jsx_runtime.JSX.Element;
|
|
5623
5672
|
declare namespace FooterSocialLink {
|
|
5624
5673
|
var displayName: string;
|
|
5625
5674
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -895,6 +895,11 @@ declare namespace Banner {
|
|
|
895
895
|
|
|
896
896
|
interface BreadcrumbItem {
|
|
897
897
|
label: string;
|
|
898
|
+
/**
|
|
899
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
900
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
901
|
+
* and the console says so once.
|
|
902
|
+
*/
|
|
898
903
|
href?: string;
|
|
899
904
|
icon?: ReactNode;
|
|
900
905
|
onClick?: () => void;
|
|
@@ -4498,6 +4503,11 @@ declare const NumberInput: react.ForwardRefExoticComponent<NumberInputProps & re
|
|
|
4498
4503
|
|
|
4499
4504
|
interface NavItem {
|
|
4500
4505
|
label: string;
|
|
4506
|
+
/**
|
|
4507
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
4508
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
4509
|
+
* and the console says so once.
|
|
4510
|
+
*/
|
|
4501
4511
|
href?: string;
|
|
4502
4512
|
icon?: ReactNode;
|
|
4503
4513
|
badge?: string | number;
|
|
@@ -4508,6 +4518,11 @@ interface NavItem {
|
|
|
4508
4518
|
}
|
|
4509
4519
|
interface HeaderProps {
|
|
4510
4520
|
logo?: ReactNode;
|
|
4521
|
+
/**
|
|
4522
|
+
* Where the logo leads. Any other address than an `http:`, `https:`,
|
|
4523
|
+
* `mailto:`, `tel:` or relative one (`javascript:`…) leaves the logo
|
|
4524
|
+
* without a link.
|
|
4525
|
+
*/
|
|
4511
4526
|
logoHref?: string;
|
|
4512
4527
|
onLogoClick?: () => void;
|
|
4513
4528
|
navItems?: NavItem[];
|
|
@@ -4535,6 +4550,15 @@ interface HeaderProps {
|
|
|
4535
4550
|
declare function Header({ logo, logoHref, onLogoClick, navItems, actions, rightContent, variant, size, backgroundColor, textColor, hoverColor, navItemTextColor, navItemHoverColor, navItemBgHover, navItemActiveColor, sticky, fixed, showSearch, onSearch, searchPlaceholder: searchPlaceholderProp, menuLabel, className, containerClassName, }: HeaderProps): react_jsx_runtime.JSX.Element;
|
|
4536
4551
|
|
|
4537
4552
|
interface HelpButtonProps {
|
|
4553
|
+
/**
|
|
4554
|
+
* What the bubble shows: a node as it is, a string as Markdown under
|
|
4555
|
+
* `markdown`, and as HTML otherwise. That HTML keeps the formatting Markdown
|
|
4556
|
+
* produces — headings, paragraphs, lists, links, code, quotes, tables — and
|
|
4557
|
+
* nothing else: `<style>`, forms and their fields, images and frames are
|
|
4558
|
+
* dropped, and so are `class`, `style`, `id` and `name`. A link keeps an
|
|
4559
|
+
* `http:`, `https:`, `mailto:`, `tel:` or relative address. Neither mode
|
|
4560
|
+
* shows an image: a help that needs one is given as a node.
|
|
4561
|
+
*/
|
|
4538
4562
|
content: string | ReactNode;
|
|
4539
4563
|
markdown?: boolean;
|
|
4540
4564
|
position?: "top" | "bottom" | "left" | "right";
|
|
@@ -5224,7 +5248,11 @@ interface SidebarItemProps {
|
|
|
5224
5248
|
active?: boolean;
|
|
5225
5249
|
/** Disabled state */
|
|
5226
5250
|
disabled?: boolean;
|
|
5227
|
-
/**
|
|
5251
|
+
/**
|
|
5252
|
+
* Where the item leads, rendered as a link. Any other address than an
|
|
5253
|
+
* `http:`, `https:`, `mailto:`, `tel:` or relative one (`javascript:`…)
|
|
5254
|
+
* leaves it a button, and the console says so once.
|
|
5255
|
+
*/
|
|
5228
5256
|
href?: string;
|
|
5229
5257
|
/** Click handler */
|
|
5230
5258
|
onClick?: () => void;
|
|
@@ -5592,9 +5620,19 @@ declare namespace FooterColumn {
|
|
|
5592
5620
|
}
|
|
5593
5621
|
|
|
5594
5622
|
interface FooterLinkProps extends ComponentPropsWithoutRef<"a"> {
|
|
5623
|
+
/**
|
|
5624
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
5625
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
5626
|
+
* and the console says so once.
|
|
5627
|
+
*/
|
|
5628
|
+
href?: string;
|
|
5629
|
+
/**
|
|
5630
|
+
* Opens the link in a new tab, with `noopener noreferrer` added to the
|
|
5631
|
+
* `rel` it is given.
|
|
5632
|
+
*/
|
|
5595
5633
|
external?: boolean;
|
|
5596
5634
|
}
|
|
5597
|
-
declare function FooterLink({ external, className, children, ...props }: FooterLinkProps): react_jsx_runtime.JSX.Element;
|
|
5635
|
+
declare function FooterLink({ external, href, rel, className, children, ...props }: FooterLinkProps): react_jsx_runtime.JSX.Element;
|
|
5598
5636
|
declare namespace FooterLink {
|
|
5599
5637
|
var displayName: string;
|
|
5600
5638
|
}
|
|
@@ -5612,6 +5650,17 @@ interface FooterSocialProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
5612
5650
|
children?: ReactNode;
|
|
5613
5651
|
}
|
|
5614
5652
|
interface FooterSocialLinkProps extends ComponentPropsWithoutRef<"a"> {
|
|
5653
|
+
/**
|
|
5654
|
+
* Where it leads. An `http:`, `https:`, `mailto:`, `tel:` or relative address
|
|
5655
|
+
* makes a link; any other (`javascript:`, `data:`…) leaves it without one,
|
|
5656
|
+
* and the console says so once.
|
|
5657
|
+
*/
|
|
5658
|
+
href?: string;
|
|
5659
|
+
/**
|
|
5660
|
+
* Added to `noopener noreferrer`, which the link always carries: it opens
|
|
5661
|
+
* in a new tab.
|
|
5662
|
+
*/
|
|
5663
|
+
rel?: string;
|
|
5615
5664
|
icon: ReactNode;
|
|
5616
5665
|
label: string;
|
|
5617
5666
|
}
|
|
@@ -5619,7 +5668,7 @@ declare function FooterSocial({ className, children, ...props }: FooterSocialPro
|
|
|
5619
5668
|
declare namespace FooterSocial {
|
|
5620
5669
|
var displayName: string;
|
|
5621
5670
|
}
|
|
5622
|
-
declare function FooterSocialLink({ icon, label, className, ...props }: FooterSocialLinkProps): react_jsx_runtime.JSX.Element;
|
|
5671
|
+
declare function FooterSocialLink({ icon, label, href, rel, className, ...props }: FooterSocialLinkProps): react_jsx_runtime.JSX.Element;
|
|
5623
5672
|
declare namespace FooterSocialLink {
|
|
5624
5673
|
var displayName: string;
|
|
5625
5674
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var l=(n,e)=>{for(var t in e)r(n,t,{get:e[t],enumerable:!0})},a=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of f(e))!c.call(n,s)&&s!==t&&r(n,s,{get:()=>e[s],enumerable:!(i=d(e,s))||i.enumerable});return n};var h=n=>a(r({},"__esModule",{value:!0}),n);var C={};l(C,{componentHref:()=>S,mergeRel:()=>E,safeHref:()=>w});module.exports=h(C);var g=new Set(["http","https","mailto","tel"]),p=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,m=/^([a-z][a-z\d+.-]*):/i;function w(n){return n==null?void 0:o(n)===void 0?n:void 0}function o(n){let e=m.exec(n.replace(p,""));if(!e)return;let t=e[1].toLowerCase();return g.has(t)?void 0:t}var u=new Set;function S(n,e){if(e==null)return;let t=o(e);if(t===void 0)return e;let i=`${n} ${t}`;u.has(i)||(u.add(i),console.warn(`[@synertech/ui] ${n} renders no link for a "${t}:" address. Only http:, https:, mailto:, tel: and addresses without a scheme are followed; the text is shown without its link.`))}function E(n,e){let t=(n??"").split(/\s+/).filter(Boolean),i=new Set(t.map(s=>s.toLowerCase()));for(let s of e.split(" "))i.has(s)||t.push(s);return t.join(" ")}0&&(module.exports={componentHref,mergeRel,safeHref});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=new Set(["http","https","mailto","tel"]),d=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,f=/^([a-z][a-z\d+.-]*):/i;function c(e){return e==null?void 0:u(e)===void 0?e:void 0}function u(e){let t=f.exec(e.replace(d,""));if(!t)return;let n=t[1].toLowerCase();return o.has(n)?void 0:n}var r=new Set;function l(e,t){if(t==null)return;let n=u(t);if(n===void 0)return t;let s=`${e} ${n}`;r.has(s)||(r.add(s),console.warn(`[@synertech/ui] ${e} renders no link for a "${n}:" address. Only http:, https:, mailto:, tel: and addresses without a scheme are followed; the text is shown without its link.`))}function a(e,t){let n=(e??"").split(/\s+/).filter(Boolean),s=new Set(n.map(i=>i.toLowerCase()));for(let i of t.split(" "))s.has(i)||n.push(i);return n.join(" ")}export{l as componentHref,a as mergeRel,c as safeHref};
|