@codeplex-qwik/ui 0.0.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/index.css +0 -0
- package/index.d.ts +17 -0
- package/index.js +190 -0
- package/index.mjs +1055 -0
- package/lib/alert/alert.d.ts +12 -0
- package/lib/avatar/avatar.d.ts +15 -0
- package/lib/badge/badge.d.ts +13 -0
- package/lib/banner/banner.d.ts +13 -0
- package/lib/button/button.d.ts +12 -0
- package/lib/card/card.d.ts +13 -0
- package/lib/input-helper/input-helper.d.ts +8 -0
- package/lib/jumbotron/jumbotron.d.ts +16 -0
- package/lib/kbd/kbd.d.ts +7 -0
- package/lib/label/requirements-popup.d.ts +5 -0
- package/lib/label/smart-label.d.ts +8 -0
- package/lib/progress/progress.d.ts +18 -0
- package/lib/rating/rating.d.ts +14 -0
- package/lib/spinner/spinner.d.ts +13 -0
- package/lib/toast/toast.d.ts +13 -0
- package/lib/tooltip/tooltip.d.ts +13 -0
- package/lib/ui.d.ts +2 -0
- package/package.json +20 -0
package/index.css
ADDED
|
File without changes
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './lib/ui';
|
|
2
|
+
export * from './lib/button/button';
|
|
3
|
+
export * from './lib/badge/badge';
|
|
4
|
+
export * from './lib/spinner/spinner';
|
|
5
|
+
export * from './lib/kbd/kbd';
|
|
6
|
+
export * from './lib/avatar/avatar';
|
|
7
|
+
export * from './lib/label/smart-label';
|
|
8
|
+
export * from './lib/label/requirements-popup';
|
|
9
|
+
export * from './lib/card/card';
|
|
10
|
+
export * from './lib/jumbotron/jumbotron';
|
|
11
|
+
export * from './lib/banner/banner';
|
|
12
|
+
export * from './lib/alert/alert';
|
|
13
|
+
export * from './lib/tooltip/tooltip';
|
|
14
|
+
export * from './lib/toast/toast';
|
|
15
|
+
export * from './lib/progress/progress';
|
|
16
|
+
export * from './lib/rating/rating';
|
|
17
|
+
export * from './lib/input-helper/input-helper';
|
package/index.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),z={};function S(){return e.jsx("div",{className:z.container,children:e.jsx("h1",{children:"Welcome to Ui!"})})}const N=p.forwardRef(({variant:l="primary",size:t="md",disabled:r=!1,fullWidth:a=!1,loading:n=!1,leftIcon:s,rightIcon:o,type:x="button",className:c="",children:d,...i},b)=>{const u="inline-flex items-center justify-center gap-2 rounded-lg border text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors transition-shadow",g={primary:"bg-blue-600 border-blue-600 text-white hover:bg-blue-700 hover:border-blue-700 active:bg-blue-800 dark:bg-blue-500 dark:border-blue-500 dark:hover:bg-blue-600",secondary:"bg-gray-100 border-gray-200 text-gray-900 hover:bg-gray-200 hover:border-gray-300 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-50 dark:hover:bg-gray-700",outline:"bg-transparent border-gray-300 text-gray-900 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-50 dark:hover:bg-gray-800",ghost:"bg-transparent border-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-100 dark:hover:bg-gray-800",danger:"bg-red-600 border-red-600 text-white hover:bg-red-700 hover:border-red-700 active:bg-red-800 dark:bg-red-500 dark:border-red-500 dark:hover:bg-red-600",success:"bg-emerald-600 border-emerald-600 text-white hover:bg-emerald-700 hover:border-emerald-700 active:bg-emerald-800 dark:bg-emerald-500 dark:border-emerald-500 dark:hover:bg-emerald-600"},f={xs:"px-2 py-1 text-[11px]",sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"},m=a?"w-full":"w-full sm:w-auto",h=r||n,y=[u,g[l],f[t],m,n?"cursor-wait":"",c].filter(Boolean).join(" ");return e.jsxs("button",{ref:b,type:x,className:y,disabled:h,"aria-busy":n?"true":"false",...i,children:[n&&e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center",children:e.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border-[2px] border-white/40 border-t-white dark:border-t-gray-100"})}),!n&&s&&e.jsx("span",{className:"text-sm leading-none",children:s}),e.jsx("span",{className:"inline-flex items-center justify-center",children:d}),!n&&o&&e.jsx("span",{className:"text-sm leading-none",children:o})]})});N.displayName="CodeplexButton";const C=p.forwardRef(({label:l,variant:t="neutral",size:r="md",pill:a=!0,iconLeft:n,iconRight:s,className:o="",onClick:x,...c},d)=>{const i="inline-flex items-center gap-1 font-medium border whitespace-nowrap select-none",b=r==="sm"?"text-[11px] px-2 py-0.5":"text-xs px-2.5 py-1",u=a?"rounded-full":"rounded-md",g=t==="primary"?"bg-blue-50 text-blue-700 border-blue-100 dark:bg-blue-900/40 dark:text-blue-200 dark:border-blue-800":t==="secondary"?"bg-purple-50 text-purple-700 border-purple-100 dark:bg-purple-900/40 dark:text-purple-200 dark:border-purple-800":t==="success"?"bg-emerald-50 text-emerald-700 border-emerald-100 dark:bg-emerald-900/40 dark:text-emerald-200 dark:border-emerald-800":t==="warning"?"bg-amber-50 text-amber-700 border-amber-100 dark:bg-amber-900/40 dark:text-amber-200 dark:border-amber-800":t==="danger"?"bg-red-50 text-red-700 border-red-100 dark:bg-red-900/40 dark:text-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-200 dark:border-gray-700",f=x?"cursor-pointer hover:brightness-95 transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1":"",m=x?"button":"span";return e.jsxs(m,{ref:d,type:x?"button":void 0,className:`
|
|
2
|
+
${i}
|
|
3
|
+
${b}
|
|
4
|
+
${u}
|
|
5
|
+
${g}
|
|
6
|
+
${f}
|
|
7
|
+
${o}
|
|
8
|
+
`,onClick:x,...c,children:[n&&e.jsx("span",{className:"text-xs",children:n}),e.jsx("span",{children:l}),s&&e.jsx("span",{className:"text-xs",children:s})]})});C.displayName="CodeplexBadge";const L=({size:l="md",color:t="primary",type:r="border",label:a,labelPosition:n="right",fullScreen:s=!1,className:o=""})=>{const x={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8",xl:"w-12 h-12"},c={primary:"text-blue-600 dark:text-blue-500",white:"text-white",gray:"text-gray-400 dark:text-gray-300",success:"text-emerald-600 dark:text-emerald-500",danger:"text-red-600 dark:text-red-500",warning:"text-yellow-500"},d=()=>{const b=x[l],u=c[t];return r==="dots"?e.jsxs("div",{className:`flex items-center justify-center gap-1 ${u} ${o}`,children:[e.jsx("div",{className:`${l==="xl"?"w-3 h-3":"w-1.5 h-1.5"} bg-current rounded-full animate-bounce [animation-delay:-0.3s]`}),e.jsx("div",{className:`${l==="xl"?"w-3 h-3":"w-1.5 h-1.5"} bg-current rounded-full animate-bounce [animation-delay:-0.15s]`}),e.jsx("div",{className:`${l==="xl"?"w-3 h-3":"w-1.5 h-1.5"} bg-current rounded-full animate-bounce`})]}):r==="ping"?e.jsxs("span",{className:`relative flex ${b} ${o}`,children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-current opacity-75 ${u}`}),e.jsx("span",{className:`relative inline-flex rounded-full h-full w-full bg-current ${u}`})]}):e.jsxs("svg",{className:`animate-spin ${b} ${u} ${o}`,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})},i=e.jsxs("div",{role:"status",className:`
|
|
9
|
+
inline-flex items-center
|
|
10
|
+
${n==="bottom"?"flex-col gap-3":"flex-row gap-2"}
|
|
11
|
+
`,children:[d(),a&&e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:a}),!a&&e.jsx("span",{className:"sr-only",children:"Cargando..."})]});return s?e.jsx("div",{className:"fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm transition-opacity",children:i}):i},I=({keys:l,size:t="md",className:r="",children:a,...n})=>{const s=t==="sm"?"text-[10px] px-1.5 py-0.5":t==="lg"?"text-xs px-2.5 py-1.5":"text-[11px] px-2 py-1",o="inline-flex items-center justify-center rounded border border-gray-300 bg-gray-50 text-gray-800 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-100 font-mono shadow-sm";return l&&l.length>0?e.jsx("span",{className:`inline-flex items-center gap-1 ${r}`,...n,children:l.map((x,c)=>e.jsx("kbd",{className:`${o} ${s}`,children:x},x+c))}):e.jsx("kbd",{className:`${o} ${s} ${r}`,...n,children:a})},A=({src:l,alt:t,name:r,size:a="md",shape:n="circle",status:s="none",showBorder:o=!1,showInitialsFallback:x=!0,className:c="",...d})=>{const i=a==="xs"?"w-6 h-6 text-[10px]":a==="sm"?"w-8 h-8 text-xs":a==="lg"?"w-12 h-12 text-base":a==="xl"?"w-16 h-16 text-lg":"w-10 h-10 text-sm",b=n==="rounded"?"rounded-lg":"rounded-full",u=o?"ring-2 ring-white dark:ring-gray-900":"",g=s==="online"?"bg-emerald-500":s==="busy"?"bg-red-500":s==="away"?"bg-amber-400":s==="offline"?"bg-gray-400 dark:bg-gray-500":"bg-transparent",f=s!=="none",m=(r||t||"?").trim().split(" ").filter(Boolean).slice(0,2).map(y=>y[0]?.toUpperCase()).join("")||"?",h=s==="online"?"En línea":s==="busy"?"Ocupado":s==="away"?"Ausente":s==="offline"?"Desconectado":void 0;return e.jsxs("div",{className:`relative inline-flex ${c}`,"aria-label":r,...d,children:[l?e.jsx("img",{src:l,alt:t||r||"Avatar",className:`
|
|
12
|
+
${i}
|
|
13
|
+
${b}
|
|
14
|
+
object-cover
|
|
15
|
+
bg-gray-200 dark:bg-gray-700
|
|
16
|
+
${u}
|
|
17
|
+
`}):x?e.jsx("div",{className:`
|
|
18
|
+
${i}
|
|
19
|
+
${b}
|
|
20
|
+
inline-flex items-center justify-center
|
|
21
|
+
bg-gray-200 text-gray-700
|
|
22
|
+
dark:bg-gray-700 dark:text-gray-100
|
|
23
|
+
font-medium
|
|
24
|
+
${u}
|
|
25
|
+
`,role:"img","aria-label":r,children:m}):e.jsx("div",{className:`
|
|
26
|
+
${i}
|
|
27
|
+
${b}
|
|
28
|
+
bg-gray-200 dark:bg-gray-700
|
|
29
|
+
${u}
|
|
30
|
+
`,role:"img","aria-label":r}),f&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`
|
|
31
|
+
absolute bottom-0 right-0
|
|
32
|
+
inline-flex items-center justify-center
|
|
33
|
+
rounded-full
|
|
34
|
+
border-2 border-white dark:border-gray-900
|
|
35
|
+
${a==="xs"?"w-2.5 h-2.5":"w-3 h-3"}
|
|
36
|
+
${g}
|
|
37
|
+
`,"aria-hidden":"true"}),h&&e.jsx("span",{className:"sr-only",children:h})]})]})},$=({requirements:l,className:t=""})=>{const[r,a]=p.useState(!1),n=p.useRef(null),s=p.useId(),o=d=>{d.stopPropagation(),d.preventDefault(),a(!r)},x=()=>a(!0),c=()=>a(!1);return p.useEffect(()=>{const d=i=>{r&&n.current&&!n.current.contains(i.target)&&a(!1)};return document.addEventListener("click",d),()=>{document.removeEventListener("click",d)}},[r]),e.jsxs("div",{ref:n,className:`relative inline-flex items-center ml-0.5 align-top ${t}`,onMouseEnter:x,onMouseLeave:c,children:[e.jsx("button",{type:"button",onClick:o,"aria-expanded":r,"aria-controls":s,"aria-label":"Ver requisitos",className:`
|
|
38
|
+
group flex items-center justify-center
|
|
39
|
+
text-red-500 dark:text-red-400
|
|
40
|
+
font-bold text-lg leading-none
|
|
41
|
+
cursor-help select-none
|
|
42
|
+
transition-transform duration-200
|
|
43
|
+
focus:outline-none focus:text-red-600 dark:focus:text-red-300
|
|
44
|
+
${r?"scale-110":"hover:scale-110"}
|
|
45
|
+
`,children:"*"}),r&&e.jsxs("div",{id:s,className:`
|
|
46
|
+
absolute bottom-full left-0 mb-1.5 z-[100]
|
|
47
|
+
/* Responsive Width: Fijo en desktop, limitado al viewport en móvil */
|
|
48
|
+
w-64 max-w-[85vw] sm:max-w-xs
|
|
49
|
+
bg-white dark:bg-gray-800
|
|
50
|
+
border border-gray-200 dark:border-gray-700
|
|
51
|
+
rounded-lg shadow-xl
|
|
52
|
+
animate-in fade-in zoom-in-95 slide-in-from-bottom-1 duration-150
|
|
53
|
+
origin-bottom-left
|
|
54
|
+
`,onClick:d=>d.stopPropagation(),children:[e.jsx("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-700/50 bg-gray-50/80 dark:bg-gray-800/80 rounded-t-lg backdrop-blur-sm",children:e.jsxs("h4",{className:"text-[10px] font-bold text-gray-500 dark:text-gray-400 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Requisitos"]})}),e.jsx("ul",{className:"p-1.5 space-y-0.5",children:l.map((d,i)=>e.jsxs("li",{className:`
|
|
55
|
+
flex items-start gap-2 px-2 py-1.5 rounded
|
|
56
|
+
text-xs text-gray-600 dark:text-gray-300
|
|
57
|
+
hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors
|
|
58
|
+
`,children:[e.jsx("span",{className:"text-blue-500 dark:text-blue-400 mt-[2px]",children:"•"}),e.jsx("span",{className:"leading-snug",children:d})]},i))}),e.jsx("div",{className:"absolute -bottom-1 left-1.5 w-2 h-2 bg-white dark:bg-gray-800 border-b border-r border-gray-200 dark:border-gray-700 rotate-45"})]})]})},E=({htmlFor:l,label:t,required:r,requirements:a,className:n="",children:s,...o})=>e.jsxs("div",{className:`flex items-center gap-2 mb-1.5 ${n}`,...o,children:[e.jsx("label",{htmlFor:l,className:"text-sm font-medium text-gray-800 dark:text-gray-100 cursor-pointer select-none",children:t}),r&&(a&&a.length>0?e.jsx($,{requirements:a}):e.jsx("span",{className:"text-xs text-red-500 font-bold select-none",title:"Campo obligatorio",children:"*"})),s]}),O=({variant:l="default",padding:t="md",hoverable:r=!1,clickable:a=!1,className:n="",media:s,header:o,footer:x,children:c,...d})=>{const i=l==="outline"?"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700":l==="soft"?"bg-gray-50 dark:bg-gray-800/70 border border-gray-100 dark:border-gray-700/60":"bg-white dark:bg-gray-800 border border-gray-100 dark:border-gray-800",b=t==="none"?"p-0":t==="sm"?"p-3":t==="lg"?"p-6":"p-4",u=a?"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60":"",g=r||a?"transition-shadow transition-transform hover:shadow-md hover:-translate-y-[1px]":"transition-shadow";return e.jsxs("article",{className:`
|
|
59
|
+
relative
|
|
60
|
+
rounded-xl
|
|
61
|
+
shadow-sm
|
|
62
|
+
${i}
|
|
63
|
+
${b}
|
|
64
|
+
${g}
|
|
65
|
+
${u}
|
|
66
|
+
${n}
|
|
67
|
+
`,...d,children:[s,o,c,x]})},V=({eyebrow:l,title:t,subtitle:r,align:a="left",primaryLabel:n,secondaryLabel:s,onPrimary:o,onSecondary:x,fullHeight:c=!1,backgroundImageUrl:d,darkOverlay:i=!0,className:b="",children:u,...g})=>{const f=a==="center"?"text-center items-center":"text-left items-start",m=!!d;return e.jsxs("section",{className:`
|
|
68
|
+
relative overflow-hidden
|
|
69
|
+
border border-gray-200/80 dark:border-gray-700/80
|
|
70
|
+
rounded-2xl
|
|
71
|
+
px-6 py-10 md:px-10 md:py-14
|
|
72
|
+
shadow-sm
|
|
73
|
+
flex
|
|
74
|
+
${c?"min-h-[60vh]":""}
|
|
75
|
+
${m?"bg-cover bg-center":"bg-gradient-to-b from-white to-gray-50 dark:from-gray-900 dark:to-gray-950"}
|
|
76
|
+
${b}
|
|
77
|
+
`,style:m?{backgroundImage:`url(${d})`}:void 0,...g,children:[m&&i&&e.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[1px]"}),e.jsxs("div",{className:`
|
|
78
|
+
relative z-10
|
|
79
|
+
max-w-3xl mx-auto flex flex-col gap-6
|
|
80
|
+
${f}
|
|
81
|
+
`,children:[l&&e.jsx("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-blue-50 text-blue-700 dark:bg-blue-900/60 dark:text-blue-100",children:l}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsx("h1",{className:`
|
|
82
|
+
text-3xl md:text-4xl lg:text-5xl font-extrabold tracking-tight
|
|
83
|
+
${m?"text-white":"text-gray-900 dark:text-white"}
|
|
84
|
+
`,children:t}),r&&e.jsx("p",{className:`
|
|
85
|
+
text-base md:text-lg max-w-2xl
|
|
86
|
+
${m?"text-gray-100/90":"text-gray-600 dark:text-gray-300"}
|
|
87
|
+
`,children:r})]}),(n||s)&&e.jsxs("div",{className:`
|
|
88
|
+
flex flex-wrap gap-3 mt-2
|
|
89
|
+
${a==="center"?"justify-center":"justify-start"}
|
|
90
|
+
`,children:[n&&o&&e.jsx("button",{type:"button",className:"inline-flex items-center justify-center px-4 py-2.5 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",onClick:o,children:n}),s&&x&&e.jsx("button",{type:"button",className:`
|
|
91
|
+
inline-flex items-center justify-center px-4 py-2.5 text-sm font-semibold rounded-lg border
|
|
92
|
+
${m?"border-white/60 text-white bg-white/5 hover:bg-white/10":"border-gray-300 text-gray-700 bg-white hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-100 dark:hover:bg-gray-700"}
|
|
93
|
+
focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
|
|
94
|
+
`,onClick:x,children:s})]}),u]})]})},Z={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/30 dark:text-blue-100 dark:border-blue-800/60",success:"bg-emerald-50 text-emerald-800 border-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-100 dark:border-emerald-800/60",warning:"bg-amber-50 text-amber-800 border-amber-200 dark:bg-amber-900/30 dark:text-amber-100 dark:border-amber-800/60",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/30 dark:text-red-100 dark:border-red-800/60",neutral:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-900/40 dark:text-gray-100 dark:border-gray-700"},T=({title:l,description:t,variant:r="info",icon:a,dismissible:n=!1,open:s,onClose:o,fullWidth:x=!0,className:c="",children:d,...i})=>{const[b,u]=p.useState(!0);if(!(s!==void 0?s:b))return null;const f=Z[r],m=a??(r==="success"?"✅":r==="warning"?"⚠️":r==="error"?"⛔":r==="neutral"?"💡":"ℹ️"),h=r==="error"||r==="warning"?"alert":"status",y=()=>{s===void 0&&u(!1),o&&o()};return e.jsx("div",{className:x?"w-full":"inline-flex",...i,children:e.jsxs("div",{className:`
|
|
95
|
+
flex w-full items-start gap-3 border rounded-lg px-4 py-3
|
|
96
|
+
shadow-sm ${f} ${c}
|
|
97
|
+
`,role:h,children:[m&&e.jsx("div",{className:"mt-0.5 text-xl shrink-0","aria-hidden":"true",children:m}),e.jsxs("div",{className:"flex-1 min-w-0",children:[l&&e.jsx("p",{className:"text-sm font-semibold leading-5 truncate",children:l}),t&&e.jsx("p",{className:"mt-0.5 text-xs sm:text-sm leading-5",children:t}),d]}),n&&e.jsx("button",{type:"button",className:"shrink-0 p-1.5 rounded-md hover:bg-black/5 dark:hover:bg-white/10 focus:outline-none focus:ring-2 focus:ring-offset-1 focus:ring-blue-500",onClick:y,"aria-label":"Cerrar aviso",children:e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
|
|
98
|
+
1.414L11.414 10l4.293 4.293a1 1 0 01-1.414
|
|
99
|
+
1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586
|
|
100
|
+
10 4.293 5.707a1 1 0 010-1.414z`,clipRule:"evenodd"})})})]})})},H=({variant:l="info",title:t,description:r,icon:a,dismissible:n=!1,open:s,onClose:o,className:x="",children:c,...d})=>{const[i,b]=p.useState(!0);if(!(s!==void 0?s:i))return null;const g=a??(l==="success"?"✅":l==="warning"?"⚠️":l==="danger"?"⛔":"ℹ️"),f=l==="success"?"border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-800/70 dark:bg-emerald-900/30 dark:text-emerald-50":l==="warning"?"border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-800/70 dark:bg-amber-900/30 dark:text-amber-50":l==="danger"?"border-red-200 bg-red-50 text-red-900 dark:border-red-800/70 dark:bg-red-900/30 dark:text-red-50":"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800/70 dark:bg-blue-900/30 dark:text-blue-50",m=()=>{s===void 0&&b(!1),o&&o()};return e.jsx("div",{role:"alert",className:`
|
|
101
|
+
w-full mb-3
|
|
102
|
+
rounded-lg border
|
|
103
|
+
px-3 py-3.5 sm:px-4 sm:py-3.5
|
|
104
|
+
${f}
|
|
105
|
+
${x}
|
|
106
|
+
`,...d,children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5 sm:mt-0 text-lg sm:text-xl",children:g}),e.jsxs("div",{className:"flex-1 min-w-0 text-xs sm:text-sm leading-relaxed",children:[t&&e.jsx("p",{className:"font-semibold mb-0.5 sm:mb-1 truncate",children:t}),r&&e.jsx("p",{className:"text-[11px] sm:text-xs md:text-sm opacity-90",children:r}),c]}),n&&e.jsx("button",{type:"button",className:`
|
|
107
|
+
self-start sm:self-center
|
|
108
|
+
-mr-1 sm:ml-2
|
|
109
|
+
inline-flex h-7 w-7 items-center justify-center
|
|
110
|
+
rounded-md
|
|
111
|
+
text-xs sm:text-sm
|
|
112
|
+
hover:bg-black/5 dark:hover:bg-white/10
|
|
113
|
+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-blue-500
|
|
114
|
+
`,"aria-label":"Cerrar alerta",onClick:m,children:"✕"})]})})},P=({content:l,side:t="top",delayMs:r=200,arrow:a=!0,disabled:n=!1,className:s="",onOpenChange:o,children:x})=>{const[c,d]=p.useState(!1),i=p.useRef(null),b=p.useId(),u=y=>{d(y),o&&o(y)},g=()=>{n||(i.current&&(clearTimeout(i.current),i.current=null),i.current=window.setTimeout(()=>{u(!0)},r))},f=()=>{i.current&&(clearTimeout(i.current),i.current=null),u(!1)};p.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const m={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"},h={top:"bottom-[-4px] left-1/2 -translate-x-1/2 border-b border-r",bottom:"top-[-4px] left-1/2 -translate-x-1/2 border-t border-l",left:"right-[-4px] top-1/2 -translate-y-1/2 border-t border-r",right:"left-[-4px] top-1/2 -translate-y-1/2 border-b border-l"};return e.jsxs("span",{className:`relative inline-flex ${s}`,onMouseEnter:g,onMouseLeave:f,onFocus:g,onBlur:f,"aria-describedby":c?b:void 0,children:[x,!n&&c&&e.jsx("div",{id:b,role:"tooltip",className:`
|
|
115
|
+
absolute z-50
|
|
116
|
+
${m[t]}
|
|
117
|
+
animate-in fade-in zoom-in-95 duration-200
|
|
118
|
+
min-w-max
|
|
119
|
+
`,children:e.jsxs("div",{className:`
|
|
120
|
+
relative
|
|
121
|
+
px-3 py-2
|
|
122
|
+
text-xs font-medium text-white
|
|
123
|
+
bg-gray-900 dark:bg-gray-700
|
|
124
|
+
rounded-md shadow-lg
|
|
125
|
+
pointer-events-none
|
|
126
|
+
`,children:[l,a&&e.jsx("div",{className:`
|
|
127
|
+
absolute w-2 h-2
|
|
128
|
+
bg-gray-900 dark:bg-gray-700
|
|
129
|
+
rotate-45
|
|
130
|
+
${h[t]}
|
|
131
|
+
`})]})})]})},W=({open:l,variant:t="info",title:r,subtitle:a,position:n="bottom-right",showIcon:s=!0,dismissible:o=!0,onClose:x})=>{if(!l)return null;const c=t==="success"?"bg-emerald-50 text-emerald-900 border-emerald-200 dark:bg-emerald-900/40 dark:text-emerald-50 dark:border-emerald-700":t==="warning"?"bg-amber-50 text-amber-900 border-amber-200 dark:bg-amber-900/40 dark:text-amber-50 dark:border-amber-700":t==="error"?"bg-red-50 text-red-900 border-red-200 dark:bg-red-900/40 dark:text-red-50 dark:border-red-700":"bg-blue-50 text-blue-900 border-blue-200 dark:bg-blue-900/40 dark:text-blue-50 dark:border-blue-700",d=t==="success"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/80 dark:text-emerald-100":t==="warning"?"bg-amber-100 text-amber-700 dark:bg-amber-900/80 dark:text-amber-100":t==="error"?"bg-red-100 text-red-700 dark:bg-red-900/80 dark:text-red-100":"bg-blue-100 text-blue-700 dark:bg-blue-900/80 dark:text-blue-100",i=()=>t==="success"?e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2Zm4.3 8.3-4.58 4.59a1 1 0 0 1-1.42 0L7.7 12.29a1 1 0 0 1 1.4-1.42l1.9 1.89 3.88-3.88a1 1 0 1 1 1.42 1.42Z"})}):t==="warning"?e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2Zm1 13h-2v-2h2Zm0-4h-2V7h2Z"})}):t==="error"?e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2Zm3.71 12.29a1 1 0 1 1-1.42 1.42L12 13.41l-2.29 2.3a1 1 0 0 1-1.42-1.42L10.59 12 8.3 9.71a1 1 0 0 1 1.42-1.42L12 10.59l2.29-2.3a1 1 0 0 1 1.42 1.42L13.41 12Z"})}):e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2Zm1 14h-2v-4h2Zm0-6h-2V8h2Z"})}),b=()=>{switch(n){case"top-left":return`
|
|
132
|
+
top-4 inset-x-2
|
|
133
|
+
sm:inset-x-auto sm:top-4 sm:left-4
|
|
134
|
+
flex justify-center sm:justify-start
|
|
135
|
+
`;case"top-center":return`
|
|
136
|
+
top-4 inset-x-2
|
|
137
|
+
flex justify-center
|
|
138
|
+
`;case"top-right":return`
|
|
139
|
+
top-4 inset-x-2
|
|
140
|
+
sm:inset-x-auto sm:top-4 sm:right-4
|
|
141
|
+
flex justify-center sm:justify-end
|
|
142
|
+
`;case"bottom-left":return`
|
|
143
|
+
bottom-4 inset-x-2
|
|
144
|
+
sm:inset-x-auto sm:bottom-4 sm:left-4
|
|
145
|
+
flex justify-center sm:justify-start
|
|
146
|
+
`;case"bottom-center":return`
|
|
147
|
+
bottom-4 inset-x-2
|
|
148
|
+
flex justify-center
|
|
149
|
+
`;default:return`
|
|
150
|
+
bottom-4 inset-x-2
|
|
151
|
+
sm:inset-x-auto sm:bottom-4 sm:right-4
|
|
152
|
+
flex justify-center sm:justify-end
|
|
153
|
+
`}},u=t==="error"||t==="warning"?"alert":"status";return e.jsx("div",{className:`
|
|
154
|
+
fixed z-50 pointer-events-none
|
|
155
|
+
${b()}
|
|
156
|
+
`,"aria-live":u==="alert"?"assertive":"polite","aria-atomic":"true",children:e.jsxs("div",{className:`
|
|
157
|
+
max-w-sm w-full
|
|
158
|
+
rounded-lg border shadow-lg
|
|
159
|
+
px-4 py-3
|
|
160
|
+
flex items-start gap-3
|
|
161
|
+
${c}
|
|
162
|
+
pointer-events-auto
|
|
163
|
+
`,role:u,children:[s&&e.jsx("div",{className:`
|
|
164
|
+
mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center
|
|
165
|
+
rounded-full
|
|
166
|
+
${d}
|
|
167
|
+
`,children:e.jsx(i,{})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold truncate",children:r}),a&&e.jsx("p",{className:"mt-0.5 text-xs sm:text-sm text-current/90 break-words",children:a})]}),o&&x&&e.jsx("button",{type:"button",className:"ml-2 inline-flex text-xs text-current/70 hover:text-current focus:outline-none focus:ring-2 focus:ring-current/40 rounded","aria-label":"Cerrar notificación",onClick:x,children:"✕"})]})})},q=({value:l=0,max:t=100,label:r,showPercentage:a=!1,labelInside:n=!1,labelAlign:s="left",striped:o=!1,animated:x=!1,indeterminate:c=!1,size:d="md",variant:i="primary",className:b="",...u})=>{const g=Math.max(0,Math.min(l,t)),f=Math.round(g/t*100),m={xs:"h-1.5 text-[0px]",sm:"h-2.5 text-[10px]",md:"h-4 text-xs",lg:"h-6 text-sm",xl:"h-8 text-base"},h={primary:"bg-blue-600 dark:bg-blue-500",success:"bg-emerald-500 dark:bg-emerald-400",warning:"bg-amber-500 dark:bg-amber-400",danger:"bg-red-600 dark:bg-red-500",neutral:"bg-gray-600 dark:bg-gray-500",gradient:"bg-gradient-to-r from-blue-500 to-purple-600 dark:from-blue-400 dark:to-purple-500"},y=o||x||c?{backgroundImage:"linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)",backgroundSize:"1rem 1rem"}:{},v=x||c?"animate-[progress-stripes_1s_linear_infinite]":"",j=()=>n||!r&&!a?null:e.jsxs("div",{className:`flex mb-1 ${s==="center"?"justify-center":s==="right"?"justify-end":"justify-between"}`,children:[r&&e.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300 mr-2",children:r}),a&&e.jsx("span",{className:`text-xs font-semibold text-gray-700 dark:text-gray-200 ${s==="center"||s==="right"?"ml-2":""}`,children:c?"":`${f}%`})]});return e.jsxs("div",{className:`w-full ${b}`,...u,children:[j(),e.jsx("div",{className:`w-full bg-gray-200 rounded-full dark:bg-gray-700 overflow-hidden ${m[d]}`,children:e.jsxs("div",{className:`
|
|
168
|
+
h-full rounded-full
|
|
169
|
+
relative overflow-hidden
|
|
170
|
+
flex items-center justify-center
|
|
171
|
+
text-white font-medium leading-none
|
|
172
|
+
transition-all duration-500 ease-out
|
|
173
|
+
${h[i]}
|
|
174
|
+
${c?"w-full origin-left animate-pulse":""}
|
|
175
|
+
`,style:{width:c?"100%":`${f}%`},role:"progressbar","aria-valuenow":c?void 0:g,"aria-valuemin":0,"aria-valuemax":t,"aria-label":r||"Progress bar",children:[(o||x||c)&&e.jsx("div",{className:`absolute inset-0 w-full h-full z-0 ${v}`,style:y}),n&&!c&&d!=="xs"&&e.jsxs("span",{className:"relative z-10 px-2 truncate drop-shadow-sm",children:[r," ",a?` ${f}%`:""]})]})})]})},F=({value:l=0,max:t=5,readOnly:r=!1,size:a="md",variant:n="warning",showValue:s=!1,tooltips:o=[],className:x="",onChange:c})=>{const[d,i]=p.useState(null),b={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8",xl:"w-10 h-10"},g={warning:"text-yellow-400",primary:"text-blue-500",danger:"text-red-500",success:"text-emerald-500"}[n],f="text-gray-300 dark:text-gray-600",m=w=>{r||!c||c(w)},h=w=>{r||i(w)},y=()=>{r||i(null)},v=d??l,j=d&&o.length>=d?o[d-1]:null;return e.jsxs("div",{className:`inline-flex flex-col ${x}`,children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"flex items-center",onMouseLeave:y,role:r?"img":"slider","aria-label":"Rating","aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":v,"aria-valuetext":j||`${v} de ${t}`,children:Array.from({length:t},(w,M)=>{const k=M+1,B=k<=v,R=d===k;return e.jsx("button",{type:"button",disabled:r,onClick:()=>m(k),onMouseEnter:()=>h(k),"aria-label":`Calificar ${k} estrellas`,className:`
|
|
176
|
+
relative
|
|
177
|
+
transition-transform duration-200 ease-out
|
|
178
|
+
focus:outline-none focus-visible:scale-110
|
|
179
|
+
${r?"cursor-default":"cursor-pointer hover:scale-110"}
|
|
180
|
+
${b[a]}
|
|
181
|
+
${B?g:f}
|
|
182
|
+
${R&&!r?"scale-125":""}
|
|
183
|
+
`,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-full h-full drop-shadow-sm",children:e.jsx("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z",clipRule:"evenodd"})})},k)})}),s&&e.jsxs("span",{className:"ml-2 text-sm font-medium text-gray-600 dark:text-gray-300",children:[l,"/",t]})]}),o.length>0&&e.jsx("div",{className:"h-5 mt-1",children:e.jsx("span",{className:`
|
|
184
|
+
text-xs font-medium transition-opacity duration-300
|
|
185
|
+
${j?"opacity-100":"opacity-0"}
|
|
186
|
+
${n==="danger"?"text-red-600":n==="success"?"text-emerald-600":"text-gray-500 dark:text-gray-400"}
|
|
187
|
+
`,children:j||"Select"})})]})},_=({helperText:l,error:t,value:r,maxLength:a,showCount:n})=>{const s=r?.toString().length||0,o=!!t,x=a?s>=a*.9:!1,c=a?s>=a:!1;return!l&&!t&&!n?null:e.jsxs("div",{className:"flex items-start justify-between mt-1.5 px-1 gap-4",children:[e.jsx("div",{className:"flex-1 min-w-0",children:o?e.jsxs("p",{className:"text-xs font-medium text-red-500 flex items-center gap-1 animate-in slide-in-from-left-1 duration-200",children:[e.jsx("svg",{className:"w-3 h-3 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),t]}):l?e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 leading-tight",children:l}):null}),n&&a&&e.jsxs("div",{className:`
|
|
188
|
+
text-[10px] font-mono font-medium transition-colors duration-300
|
|
189
|
+
${o||c?"text-red-500":x?"text-amber-500":"text-gray-400 dark:text-gray-500"}
|
|
190
|
+
`,children:[s,"/",a]})]})};exports.CodeplexAlert=H;exports.CodeplexAvatar=A;exports.CodeplexBadge=C;exports.CodeplexBanner=T;exports.CodeplexButton=N;exports.CodeplexCard=O;exports.CodeplexInputHelper=_;exports.CodeplexJumbotron=V;exports.CodeplexKbd=I;exports.CodeplexProgress=q;exports.CodeplexRating=F;exports.CodeplexRequirementsPopup=$;exports.CodeplexSmartLabel=E;exports.CodeplexSpinner=L;exports.CodeplexToast=W;exports.CodeplexTooltip=P;exports.Ui=S;
|