@adamjanicki/ui 1.6.0 → 1.6.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @adamjanicki/ui
2
2
 
3
- **Warning: use at own risk, these are mainly for personal use across my other sites, so while I strive to write good code, there may be bugs!**
3
+ **Warning: use at own risk! These are mainly for personal use across my other sites, so while I strive to write good code, there may be bugs, and I make breaking changes semi-frequently!**
4
4
 
5
5
  ## Installation
6
6
 
@@ -24,7 +24,7 @@ const App = () => {
24
24
 
25
25
  ## Importing CSS
26
26
 
27
- Unfortunately, there was no great way to handle CSS. I often hate how large libraries make it extremely difficult to override CSS without using `!important`, or using inline styles. So, I've decided to just import the CSS directly into your project. Here's an example of how to do it:
27
+ Unfortunately, there was no great way to handle CSS. I often hate how large libraries make it extremely difficult to override CSS without using `!important`, or using inline styles. So, I've decided to just allow importing the CSS directly into your project. Here's an example of how to do it:
28
28
 
29
29
  ```ts
30
30
  import React from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Basic UI components and hooks for React in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/dist/aui.cjs.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");var B={exports:{}},D={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var se;function we(){if(se)return D;se=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(s,o,a){var c=null;if(a!==void 0&&(c=""+a),o.key!==void 0&&(c=""+o.key),"key"in o){a={};for(var f in o)f!=="key"&&(a[f]=o[f])}else a=o;return o=a.ref,{$$typeof:t,type:s,key:c,ref:o!==void 0?o:null,props:a}}return D.Fragment=e,D.jsx=r,D.jsxs=r,D}var F={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var ae;function ye(){return ae||(ae=1,process.env.NODE_ENV!=="production"&&function(){function t(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===xe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case y:return"Fragment";case S:return"Profiler";case v:return"StrictMode";case P:return"Suspense";case k:return"SuspenseList";case he:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case j:return"Portal";case _:return(n.displayName||"Context")+".Provider";case L:return(n._context.displayName||"Context")+".Consumer";case M:var d=n.render;return n=n.displayName,n||(n=d.displayName||d.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case A:return d=n.displayName||null,d!==null?d:t(n.type)||"Memo";case Z:d=n._payload,n=n._init;try{return t(n(d))}catch{}}return null}function e(n){return""+n}function r(n){try{e(n);var d=!1}catch{d=!0}if(d){d=console;var h=d.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return h.call(d,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),e(n)}}function s(n){if(n===y)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===Z)return"<...>";try{var d=t(n);return d?"<"+d+">":"<...>"}catch{return"<...>"}}function o(){var n=q.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function c(n){if(K.call(n,"key")){var d=Object.getOwnPropertyDescriptor(n,"key").get;if(d&&d.isReactWarning)return!1}return n.key!==void 0}function f(n,d){function h(){ee||(ee=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",d))}h.isReactWarning=!0,Object.defineProperty(n,"key",{get:h,configurable:!0})}function m(){var n=t(this.type);return te[n]||(te[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function u(n,d,h,g,$,N,V,X){return h=N.ref,n={$$typeof:T,type:n,key:d,props:N,_owner:$},(h!==void 0?h:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:m}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function E(n,d,h,g,$,N,V,X){var w=d.children;if(w!==void 0)if(g)if(be(w)){for(g=0;g<w.length;g++)R(w[g]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else R(w);if(K.call(d,"key")){w=t(n);var C=Object.keys(d).filter(function(ge){return ge!=="key"});g=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",oe[w+g]||(C=0<C.length?"{"+C.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
- let props = %s;
19
- <%s {...props} />
20
- React keys must be passed directly to JSX without using spread:
21
- let props = %s;
22
- <%s key={someKey} {...props} />`,g,w,C,w),oe[w+g]=!0)}if(w=null,h!==void 0&&(r(h),w=""+h),c(d)&&(r(d.key),w=""+d.key),"key"in d){h={};for(var J in d)J!=="key"&&(h[J]=d[J])}else h=d;return w&&f(h,typeof n=="function"?n.displayName||n.name||"Unknown":n),u(n,w,N,$,o(),h,V,X)}function R(n){typeof n=="object"&&n!==null&&n.$$typeof===T&&n._store&&(n._store.validated=1)}var b=l,T=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),_=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),q=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,be=Array.isArray,H=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(n){return n()}};var ee,te={},re=b.react_stack_bottom_frame.bind(b,a)(),ne=H(s(a)),oe={};F.Fragment=y,F.jsx=function(n,d,h,g,$){var N=1e4>q.recentlyCreatedOwnerStacks++;return E(n,d,h,!1,g,$,N?Error("react-stack-top-frame"):re,N?H(s(n)):ne)},F.jsxs=function(n,d,h,g,$){var N=1e4>q.recentlyCreatedOwnerStacks++;return E(n,d,h,!0,g,$,N?Error("react-stack-top-frame"):re,N?H(s(n)):ne)}}()),F}var ce;function Ee(){return ce||(ce=1,process.env.NODE_ENV==="production"?B.exports=we():B.exports=ye()),B.exports}var i=Ee();function p(...t){return t.filter(Boolean).join(" ")}function G(t,e){try{const r=document.getElementById(t);r&&r.scrollIntoView({behavior:e})}catch{return}}function Re(t,e){if(t===void 0)throw new Error(e||"Unexpected undefined value");return t}const x=l.forwardRef(({layout:t,className:e,style:r,...s},o)=>{const a=ve(t);return i.jsx("div",{...s,className:p(a.className,e),style:{...a.style,...r},ref:o})});function ve(t){if(!t)return{className:void 0,style:void 0};const{axis:e,gap:r,align:s,justify:o,padding:a,margin:c,wrap:f}=t,m={};let u=`aui-flex-${e}`;return s&&(u=p(u,`aui-align-${s}`)),o&&(u=p(u,`aui-justify-${o}`)),f&&(u=p(u,"aui-flex-wrap")),r&&(typeof r=="number"?m.gap=r:u=p(u,`aui-gap-${r}`)),a&&(typeof a=="number"?m.padding=a:u=p(u,`aui-pa-${a}`)),c&&(typeof c=="number"?m.margin=c:u=p(u,`aui-ma-${c}`)),{className:u,style:m}}const U="M94.0908,296.3057c-29.82338,0-54-24.17662-54-54s24.17662-54,54-54c.00237,0,.00475,0,.00712,0c.0017,0,141.65138,0,221.99288,0v-222c0-29.82338,24.17662-54,54-54s54,24.17662,54,54c0,.00237,0,.00475,0,.00712s0,273.40726,0,275.97468c0,.00607,0,.01213,0,.0182c0,29.82338-24.17662,54-54,54h-276Z",je={down:{contents:[i.jsx("path",{d:U,transform:"matrix(.707107 0.707107-.707107 0.707107 165.642289-79.868246)"})]},up:{contents:[i.jsx("path",{d:U,transform:"matrix(-.707107-.707107 0.707107-.707107 346.357711 591.868246)"})]},left:{contents:[i.jsx("path",{d:U,transform:"matrix(-.707107 0.707107-.707107-.707107 591.868246 165.642289)"})]},right:{contents:[i.jsx("path",{d:U,transform:"matrix(.707107-.707107 0.707107 0.707107-79.868246 346.357711)"})]}},Te="0 0 512 512",I=l.forwardRef(({icon:t,className:e,size:r,style:s,...o},a)=>{const{contents:c,viewBox:f}=je[t];return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:f||Te,className:p("aui-icon",e),style:{width:r,height:r,...s},...o,ref:a,children:c.map((m,u)=>i.jsx(l.Fragment,{children:m},u))})}),W=l.forwardRef(({className:t,...e},r)=>i.jsx("button",{...e,className:p("aui-action aui-button",t),ref:r})),z=l.forwardRef(({variant:t,corners:e,className:r,size:s,...o},a)=>i.jsx(W,{...o,className:p(le({variant:t,corners:e,size:s}),r),ref:a})),le=({variant:t="primary",corners:e="rounded",size:r="regular"})=>`aui-button--${t} aui-button-size--${r} aui-corners--${e}`,ue=l.forwardRef((t,e)=>{const{animated:r,duration:s=.25,keepMounted:o=!1,animateTo:a,animateFrom:c,className:f,style:m,...u}=t,[E,R]=l.useState(r||o),[b,T]=l.useState(!1),j=l.useRef(null),y=l.useRef(null),v=()=>{j.current&&(clearTimeout(j.current),j.current=null),y.current&&(cancelAnimationFrame(y.current),y.current=null)};if(l.useEffect(()=>(r&&E&&(v(),y.current=requestAnimationFrame(()=>T(!0))),v),[r,E]),l.useEffect(()=>(r?R(!0):(v(),T(!1),j.current=window.setTimeout(()=>{o||R(!1)},s*1e3)),v),[r,s,o]),!E)return null;const S=b?a:c;return i.jsx(x,{className:p(f,S?.className),style:{transition:`all ${s}s ease-in-out`,...m,...S?.style},...u,ref:e})}),Se=l.forwardRef(({drawers:t,className:e,duration:r,hideDividers:s,...o},a)=>{const[c,f]=l.useState(new Set);return i.jsx(x,{layout:{axis:"y"},...o,className:p("aui-accordion aui-corners--rounded",e),ref:a,children:t.map((m,u)=>i.jsx(ke,{item:m,open:c.has(u),onOpenChange:E=>f(R=>{const b=new Set(R);return E?b.add(u):b.delete(u),b}),duration:r,showDivider:!s&&u<t.length-1},u))})}),ke=({item:t,open:e,onOpenChange:r,duration:s,showDivider:o})=>{const a=l.useRef(null),[c,f]=l.useState(),m=t.content;return l.useEffect(()=>{e&&m&&a.current&&f(a.current.offsetHeight)},[e,m]),i.jsxs(i.Fragment,{children:[i.jsxs(x,{layout:{axis:"y"},children:[i.jsx(W,{onClick:()=>r(!e),children:i.jsxs(x,{layout:{axis:"x",align:"center",gap:"m",padding:"l"},children:[i.jsx(I,{size:12,icon:e?"down":"right",className:"aui-accordion-arrow"}),i.jsx("span",{className:"aui-accordion-label",children:t.label})]})}),i.jsx(ue,{style:{overflow:"hidden"},keepMounted:!0,duration:s,animated:e,animateFrom:{style:{visibility:"hidden",height:0,transform:"translateY(-4px)",opacity:.9}},animateTo:{style:{height:c,transform:"translateY(0)",opacity:1}},children:i.jsx(x,{ref:a,children:m})})]}),o&&i.jsx("hr",{className:"aui-accordion-hr"})]})},Ne=l.forwardRef(({type:t,corners:e="rounded",className:r,...s},o)=>i.jsx(x,{...s,className:p(`aui-alert aui-content--${t} aui-corners--${e}`,r),ref:o})),_e=l.forwardRef(({type:t,className:e,corners:r="rounded",...s},o)=>i.jsx(x,{...s,className:p(`aui-badge aui-content--${t} aui-corners--${r}`,e),ref:o})),Ae=l.forwardRef(({type:t,className:e,...r},s)=>i.jsx(x,{...r,className:p(`aui-content--${t} aui-banner`,e),ref:s})),$e=1,Oe=l.forwardRef(({children:t,className:e,hideArrows:r,hideDots:s,dotProps:o,leftArrowProps:a,rightArrowProps:c,autoplayInterval:f,duration:m,...u},E)=>{m=Math.max(m??$e,.1),f=f?Math.max(m,f):void 0;const R=t.length,[b,T]=l.useState({cur:0,delta:0,animating:!1}),j=l.useRef(null),{cur:y,delta:v,animating:S}=b,L=ie(y+v,R),_=l.useCallback(k=>{S||k===0||T(A=>({...A,delta:k,animating:!0}))},[S]),M=()=>{T(({delta:k,cur:A})=>({delta:k,animating:!1,cur:ie(A+k,R)}))};if(l.useEffect(()=>(f&&(j.current=window.setInterval(()=>{_(1)},f*1e3)),()=>{const k=j.current;j.current=null,k&&clearInterval(k)}),[f,_]),R<=0)return null;const P=S?{transform:`translateX(${-(v/Math.abs(v))*100}%)`,transition:`transform ${m}s ease-in-out`}:void 0;return i.jsxs(x,{...u,className:p("aui-carousel",e),ref:E,children:[i.jsxs(x,{className:"aui-carousel-slider",style:{...P,flexDirection:v>=0?"row":"row-reverse"},onTransitionEnd:M,children:[i.jsx(x,{className:"aui-carousel-item",children:t[y]}),i.jsx(x,{className:"aui-carousel-item","aria-hidden":!0,children:t[L]})]}),R>1&&i.jsxs(i.Fragment,{children:[!r&&i.jsxs(i.Fragment,{children:[i.jsx(z,{className:p("aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow",a?.className),style:{left:8,...a?.style},corners:"pill","aria-label":"previous",onClick:()=>_(-1),children:a?.children??i.jsx(I,{icon:"left",size:12,style:{marginRight:2}})}),i.jsx(z,{className:p("aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow",c?.className),style:{right:8,...c?.style},corners:"pill","aria-label":"next",onClick:()=>_(1),children:c?.children??i.jsx(I,{icon:"right",size:12,style:{marginLeft:2}})})]}),!s&&i.jsx(x,{layout:{axis:"x",align:"center",gap:"xs"},className:"aui-carousel-dots",children:t.map((k,A)=>i.jsx(z,{className:p("aui-carousel-dot",o?.className),corners:"pill",disabled:y===A||S,onClick:()=>_(A-y),style:o?.style},A))})]})]})});function ie(t,e){return(t%e+e)%e}const Ce=({children:t,onClickOutside:e})=>{const r=l.useRef(null),s=l.useRef(!1),o=l.useRef(!1);l.useEffect(()=>{const c=window.setTimeout(()=>{o.current=!0},0);return()=>{clearTimeout(c),o.current=!1}},[]);const a=l.useCallback(c=>{const f=s.current;s.current=!1,!(!o.current||!r.current||f)&&(c.composedPath().includes(r.current)||e(c))},[e]);return l.useEffect(()=>(document.addEventListener("click",a),()=>document.removeEventListener("click",a)),[a]),l.cloneElement(t,{ref:r,onClick:c=>{s.current=!0,t.props?.onClick?.(c)}})},Y={right:45,left:-45},fe={right:-135,left:-225},O=t=>{const{size:e=36,duration:r=.25,double:s,openStyle:o,open:a,style:c,rounded:f,lineHeight:m,...u}=t,E=m||Math.max(1,Math.round(e/20)),R={width:e,height:e,display:"flex",position:"relative",justifyContent:"center",alignItems:"center",transition:`transform ${r}s ease`},b={height:E,width:e*.7,backgroundColor:"currentColor",position:"absolute",transition:`transform ${r}s ease, opacity ${r}s ease`,borderRadius:f?1e4:0},T=l.useMemo(()=>e/(s?7:4),[e,s]),{outer:j,top:y,middle:v,bottom:S}=o,L=a?j:{},_=a?y:{transform:`translateY(-${T}px)`},M=a?S:{transform:`translateY(${T}px)`},P=a?v:{};return i.jsxs(W,{style:{...c,...L,...R},...u,"aria-label":u["aria-label"]||"hamburger","aria-expanded":a,children:[i.jsx("span",{style:{...b,..._}}),!s&&i.jsx("span",{style:{...b,...P}}),i.jsx("span",{style:{...b,...M}})]})},de=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=Y[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},middle:{transform:"scale(0)"},bottom:{transform:c}}},[e]);return i.jsx(O,{...r,openStyle:s})},Le=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=Y[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},bottom:{transform:c}}},[e]);return i.jsx(O,{...r,double:!0,openStyle:s})},Me=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=fe[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},bottom:{transform:c}}},[e]);return i.jsx(O,{...r,double:!0,openStyle:s})},Pe=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=Y[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},bottom:{transform:c},outer:{transform:"rotate(180deg)"}}},[e]);return i.jsx(O,{...r,double:!0,openStyle:s})},De=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=Y[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},middle:{opacity:0},bottom:{transform:c}}},[e]);return i.jsx(O,{...r,openStyle:s})},Fe=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=fe[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},middle:{transform:"scale(0)"},bottom:{transform:c}}},[e]);return i.jsx(O,{...r,openStyle:s})},Ie=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=Y[e],a=`rotate(${o}deg)`,c=`rotate(${-o}deg)`;return{top:{transform:a},middle:{opacity:0},bottom:{transform:c},outer:{transform:"rotate(180deg)"}}},[e]);return i.jsx(O,{...r,openStyle:s})},Ye=l.forwardRef(({className:t,corners:e="rounded",...r},s)=>i.jsx("input",{...r,ref:s,className:p(`aui-input-base aui-input aui-corners--${e}`,t)})),Be=l.forwardRef(({className:t,rows:e=3,corners:r="rounded",...s},o)=>i.jsx("textarea",{...s,ref:o,className:p(`aui-input-base aui-input aui-corners--${r}`,t),rows:e})),Ue=l.forwardRef(({startIcon:t,endIcon:e,className:r,style:s,corners:o="rounded",inputProps:a},c)=>i.jsxs(x,{layout:{axis:"x",align:"center"},className:p(`aui-input aui-icon-input aui-corners--${o}`,r),style:s,ref:c,children:[t,i.jsx("input",{...a,className:p(`aui-input-base aui-corners--${o}`,a?.className)}),e]})),ze=()=>{const t=window.scrollY,e=document.body.style,r=document.documentElement.style,{overflow:s,position:o,top:a,width:c}=e,{scrollBehavior:f}=r;return r.scrollBehavior="auto",e.overflow="hidden",e.position="fixed",e.top=`-${t}px`,e.width="100%",()=>{e.overflow=s,e.position=o,e.top=a,e.width=c,window.scrollTo(0,t),r.scrollBehavior=f}},me=(t=!0)=>{l.useEffect(()=>{if(t)return ze()},[t])},We=t=>{const{onMatch:e,onUnmatch:r,query:s}=t,[o,a]=l.useState(!1);return l.useEffect(()=>{const c=window.matchMedia(s),f=m=>{m.matches?e?.():r?.(),a(m.matches)};return c.addEventListener("change",f),a(c.matches),()=>c.removeEventListener("change",f)},[e,r,s]),o},qe=()=>{const[t,e]=l.useState({scrollX:window.scrollX,scrollY:window.scrollY});return l.useEffect(()=>{const r=()=>{e({scrollX:window.scrollX,scrollY:window.scrollY})};return window.addEventListener("scroll",r),()=>window.removeEventListener("scroll",r)},[]),t},He='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]',pe=(t=!0)=>{const e=l.useRef(null),r=l.useRef(null),s=l.useCallback(()=>{e.current&&(r.current=e.current.querySelectorAll(He))},[]);return l.useEffect(()=>{if(!t||!e.current)return;s();const o=c=>{if(c.key!=="Tab")return;if(!r.current||r.current.length===0)return c.preventDefault();const{activeElement:f}=document,m=r.current[0],u=r.current[r.current.length-1];c.shiftKey&&f===m?(u.focus(),c.preventDefault()):!c.shiftKey&&f===u?(m.focus(),c.preventDefault()):e.current?.contains(f)||((c.shiftKey?u:m).focus(),c.preventDefault())},a=new MutationObserver(s);return a.observe(e.current,{childList:!0,subtree:!0}),document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),a.disconnect()}},[t,s]),e},Ve=(t={})=>{const{active:e=!0,behavior:r,delay:s}=t;l.useEffect(()=>{const o=window.location.hash;if(!e||o?.length<=1)return;const a=o.substring(1);if(s!==void 0){const c=setTimeout(()=>G(a,r),s);return()=>clearTimeout(c)}G(a,r)},[e,r,s])},Xe=t=>{l.useEffect(()=>(window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)),[t])},Je=l.forwardRef(({onClose:t,children:e,className:r,disableEscape:s=!1,visible:o,onMouseDown:a,...c},f)=>{const m=pe(o);return l.useEffect(()=>{const u=E=>{E.key==="Escape"&&t?.()};return s||document.addEventListener("keydown",u),()=>{s||document.removeEventListener("keydown",u)}},[t,s]),i.jsx(x,{layout:{axis:"y",align:"center",justify:"center"},...c,className:p("aui-layer-backdrop",r),onMouseDown:u=>{a?.(u),t?.()},ref:f,children:l.cloneElement(e,{ref:m,onMouseDown:u=>{u.stopPropagation(),e.props?.onMouseDown?.(u)}})})}),Ge=l.forwardRef(({returnFocusOnEscape:t,disableScrollLock:e,...r},s)=>(me(!e),l.useEffect(()=>()=>{const o=document.activeElement;t||o?.blur?.()},[t]),i.jsx(Je,{...r,visible:!0,ref:s}))),Q=l.forwardRef(({LinkElement:t,to:e,className:r,external:s,...o},a)=>{const c={...s?{target:"_blank",rel:"noreferrer noopener"}:{},...o,className:p("aui-action",r)};return t?i.jsx(t,{...c,to:e,ref:a}):i.jsx("a",{...c,href:e,ref:a})}),Qe=l.forwardRef(({className:t,variant:e,corners:r,size:s,...o},a)=>i.jsx(Q,{...o,className:p(le({variant:e,corners:r,size:s}),t),ref:a})),Ze=l.forwardRef(({className:t,...e},r)=>i.jsx(Q,{...e,className:p("aui-link",t),ref:r})),Ke=({className:t,options:e,getOptionLabel:r,corners:s="rounded",style:o,disabled:a,...c},f)=>i.jsxs(x,{className:p("aui-select-container",`aui-corners--${s}`,a?"aui-select-disabled":void 0,t),style:o,children:[i.jsx("select",{...c,ref:f,className:`aui-select aui-corners--${s}`,disabled:a,children:e.map((m,u)=>i.jsx("option",{value:m,children:r?.(m)||m},u))}),i.jsx(I,{icon:"down",className:"aui-select-icon","aria-hidden":!0})]}),et=l.forwardRef(Ke),tt=({className:t,...e})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:p("aui-spinner",t),...e,children:i.jsx("path",{fill:"currentColor",d:"M256,0C114.62,0,0,114.62,0,256S114.62,512,256,512c70.64,0,134.59-28.61,180.91-74.88l-31.11-31.11c-38.35,38.3-91.31,61.99-149.8,61.99-117.08,0-212-94.92-212-212S138.92,44,256,44V0Z"})});exports.Accordion=Se;exports.Alert=Ne;exports.Animated=ue;exports.Badge=_e;exports.Banner=Ae;exports.Box=x;exports.Button=z;exports.ButtonLink=Qe;exports.Carousel=Oe;exports.ClickOutside=Ce;exports.DoubleCross=Le;exports.DoubleFlip=Me;exports.DoubleSpin=Pe;exports.Hamburger=de;exports.Icon=I;exports.IconInput=Ue;exports.Input=Ye;exports.Layer=Ge;exports.Link=Ze;exports.Select=et;exports.Spinner=tt;exports.TextArea=Be;exports.TripleFade=De;exports.TripleFlip=Fe;exports.TriplePrestige=de;exports.TripleSpin=Ie;exports.UnstyledButton=W;exports.UnstyledLink=Q;exports.assertDefined=Re;exports.classNames=p;exports.scrollToId=G;exports.useFocusTrap=pe;exports.useMediaQuery=We;exports.useScroll=qe;exports.useScrollLock=me;exports.useScrollToHash=Ve;exports.useWindowResize=Xe;
package/dist/aui.es.js DELETED
@@ -1,1091 +0,0 @@
1
- import h, { useState as L, useRef as O, useEffect as R, useCallback as ee, cloneElement as ve, useMemo as P, forwardRef as V } from "react";
2
- var W = { exports: {} }, B = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.js
6
- *
7
- * Copyright (c) Meta Platforms, Inc. and affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var le;
13
- function je() {
14
- if (le) return B;
15
- le = 1;
16
- var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
17
- function r(s, o, a) {
18
- var c = null;
19
- if (a !== void 0 && (c = "" + a), o.key !== void 0 && (c = "" + o.key), "key" in o) {
20
- a = {};
21
- for (var u in o)
22
- u !== "key" && (a[u] = o[u]);
23
- } else a = o;
24
- return o = a.ref, {
25
- $$typeof: t,
26
- type: s,
27
- key: c,
28
- ref: o !== void 0 ? o : null,
29
- props: a
30
- };
31
- }
32
- return B.Fragment = e, B.jsx = r, B.jsxs = r, B;
33
- }
34
- var U = {};
35
- /**
36
- * @license React
37
- * react-jsx-runtime.development.js
38
- *
39
- * Copyright (c) Meta Platforms, Inc. and affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- */
44
- var ue;
45
- function Re() {
46
- return ue || (ue = 1, process.env.NODE_ENV !== "production" && function() {
47
- function t(n) {
48
- if (n == null) return null;
49
- if (typeof n == "function")
50
- return n.$$typeof === ge ? null : n.displayName || n.name || null;
51
- if (typeof n == "string") return n;
52
- switch (n) {
53
- case y:
54
- return "Fragment";
55
- case N:
56
- return "Profiler";
57
- case E:
58
- return "StrictMode";
59
- case I:
60
- return "Suspense";
61
- case k:
62
- return "SuspenseList";
63
- case be:
64
- return "Activity";
65
- }
66
- if (typeof n == "object")
67
- switch (typeof n.tag == "number" && console.error(
68
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
- ), n.$$typeof) {
70
- case T:
71
- return "Portal";
72
- case $:
73
- return (n.displayName || "Context") + ".Provider";
74
- case F:
75
- return (n._context.displayName || "Context") + ".Consumer";
76
- case Y:
77
- var d = n.render;
78
- return n = n.displayName, n || (n = d.displayName || d.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
79
- case A:
80
- return d = n.displayName || null, d !== null ? d : t(n.type) || "Memo";
81
- case re:
82
- d = n._payload, n = n._init;
83
- try {
84
- return t(n(d));
85
- } catch {
86
- }
87
- }
88
- return null;
89
- }
90
- function e(n) {
91
- return "" + n;
92
- }
93
- function r(n) {
94
- try {
95
- e(n);
96
- var d = !1;
97
- } catch {
98
- d = !0;
99
- }
100
- if (d) {
101
- d = console;
102
- var p = d.error, b = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
103
- return p.call(
104
- d,
105
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- b
107
- ), e(n);
108
- }
109
- }
110
- function s(n) {
111
- if (n === y) return "<>";
112
- if (typeof n == "object" && n !== null && n.$$typeof === re)
113
- return "<...>";
114
- try {
115
- var d = t(n);
116
- return d ? "<" + d + ">" : "<...>";
117
- } catch {
118
- return "<...>";
119
- }
120
- }
121
- function o() {
122
- var n = X.A;
123
- return n === null ? null : n.getOwner();
124
- }
125
- function a() {
126
- return Error("react-stack-top-frame");
127
- }
128
- function c(n) {
129
- if (ne.call(n, "key")) {
130
- var d = Object.getOwnPropertyDescriptor(n, "key").get;
131
- if (d && d.isReactWarning) return !1;
132
- }
133
- return n.key !== void 0;
134
- }
135
- function u(n, d) {
136
- function p() {
137
- oe || (oe = !0, console.error(
138
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- d
140
- ));
141
- }
142
- p.isReactWarning = !0, Object.defineProperty(n, "key", {
143
- get: p,
144
- configurable: !0
145
- });
146
- }
147
- function f() {
148
- var n = t(this.type);
149
- return se[n] || (se[n] = !0, console.error(
150
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
- )), n = this.props.ref, n !== void 0 ? n : null;
152
- }
153
- function l(n, d, p, b, C, _, G, Z) {
154
- return p = _.ref, n = {
155
- $$typeof: S,
156
- type: n,
157
- key: d,
158
- props: _,
159
- _owner: C
160
- }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(n, "ref", {
161
- enumerable: !1,
162
- get: f
163
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
164
- configurable: !1,
165
- enumerable: !1,
166
- writable: !0,
167
- value: 0
168
- }), Object.defineProperty(n, "_debugInfo", {
169
- configurable: !1,
170
- enumerable: !1,
171
- writable: !0,
172
- value: null
173
- }), Object.defineProperty(n, "_debugStack", {
174
- configurable: !1,
175
- enumerable: !1,
176
- writable: !0,
177
- value: G
178
- }), Object.defineProperty(n, "_debugTask", {
179
- configurable: !1,
180
- enumerable: !1,
181
- writable: !0,
182
- value: Z
183
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
184
- }
185
- function v(n, d, p, b, C, _, G, Z) {
186
- var g = d.children;
187
- if (g !== void 0)
188
- if (b)
189
- if (we(g)) {
190
- for (b = 0; b < g.length; b++)
191
- j(g[b]);
192
- Object.freeze && Object.freeze(g);
193
- } else
194
- console.error(
195
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
196
- );
197
- else j(g);
198
- if (ne.call(d, "key")) {
199
- g = t(n);
200
- var D = Object.keys(d).filter(function(ye) {
201
- return ye !== "key";
202
- });
203
- b = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", ie[g + b] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
204
- `A props object containing a "key" prop is being spread into JSX:
205
- let props = %s;
206
- <%s {...props} />
207
- React keys must be passed directly to JSX without using spread:
208
- let props = %s;
209
- <%s key={someKey} {...props} />`,
210
- b,
211
- g,
212
- D,
213
- g
214
- ), ie[g + b] = !0);
215
- }
216
- if (g = null, p !== void 0 && (r(p), g = "" + p), c(d) && (r(d.key), g = "" + d.key), "key" in d) {
217
- p = {};
218
- for (var Q in d)
219
- Q !== "key" && (p[Q] = d[Q]);
220
- } else p = d;
221
- return g && u(
222
- p,
223
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
224
- ), l(
225
- n,
226
- g,
227
- _,
228
- C,
229
- o(),
230
- p,
231
- G,
232
- Z
233
- );
234
- }
235
- function j(n) {
236
- typeof n == "object" && n !== null && n.$$typeof === S && n._store && (n._store.validated = 1);
237
- }
238
- var x = h, S = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), F = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), I = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), re = Symbol.for("react.lazy"), be = Symbol.for("react.activity"), ge = Symbol.for("react.client.reference"), X = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ne = Object.prototype.hasOwnProperty, we = Array.isArray, J = console.createTask ? console.createTask : function() {
239
- return null;
240
- };
241
- x = {
242
- react_stack_bottom_frame: function(n) {
243
- return n();
244
- }
245
- };
246
- var oe, se = {}, ae = x.react_stack_bottom_frame.bind(
247
- x,
248
- a
249
- )(), ce = J(s(a)), ie = {};
250
- U.Fragment = y, U.jsx = function(n, d, p, b, C) {
251
- var _ = 1e4 > X.recentlyCreatedOwnerStacks++;
252
- return v(
253
- n,
254
- d,
255
- p,
256
- !1,
257
- b,
258
- C,
259
- _ ? Error("react-stack-top-frame") : ae,
260
- _ ? J(s(n)) : ce
261
- );
262
- }, U.jsxs = function(n, d, p, b, C) {
263
- var _ = 1e4 > X.recentlyCreatedOwnerStacks++;
264
- return v(
265
- n,
266
- d,
267
- p,
268
- !0,
269
- b,
270
- C,
271
- _ ? Error("react-stack-top-frame") : ae,
272
- _ ? J(s(n)) : ce
273
- );
274
- };
275
- }()), U;
276
- }
277
- var de;
278
- function Ee() {
279
- return de || (de = 1, process.env.NODE_ENV === "production" ? W.exports = je() : W.exports = Re()), W.exports;
280
- }
281
- var i = Ee();
282
- function m(...t) {
283
- return t.filter(Boolean).join(" ");
284
- }
285
- function fe(t, e) {
286
- try {
287
- const r = document.getElementById(t);
288
- r && r.scrollIntoView({ behavior: e });
289
- } catch {
290
- return;
291
- }
292
- }
293
- function Fe(t, e) {
294
- if (t === void 0)
295
- throw new Error(e || "Unexpected undefined value");
296
- return t;
297
- }
298
- const w = h.forwardRef(
299
- ({ layout: t, className: e, style: r, ...s }, o) => {
300
- const a = Te(t);
301
- return /* @__PURE__ */ i.jsx(
302
- "div",
303
- {
304
- ...s,
305
- className: m(a.className, e),
306
- style: { ...a.style, ...r },
307
- ref: o
308
- }
309
- );
310
- }
311
- );
312
- function Te(t) {
313
- if (!t) return { className: void 0, style: void 0 };
314
- const { axis: e, gap: r, align: s, justify: o, padding: a, margin: c, wrap: u } = t, f = {};
315
- let l = `aui-flex-${e}`;
316
- return s && (l = m(l, `aui-align-${s}`)), o && (l = m(l, `aui-justify-${o}`)), u && (l = m(l, "aui-flex-wrap")), r && (typeof r == "number" ? f.gap = r : l = m(l, `aui-gap-${r}`)), a && (typeof a == "number" ? f.padding = a : l = m(l, `aui-pa-${a}`)), c && (typeof c == "number" ? f.margin = c : l = m(l, `aui-ma-${c}`)), { className: l, style: f };
317
- }
318
- const q = "M94.0908,296.3057c-29.82338,0-54-24.17662-54-54s24.17662-54,54-54c.00237,0,.00475,0,.00712,0c.0017,0,141.65138,0,221.99288,0v-222c0-29.82338,24.17662-54,54-54s54,24.17662,54,54c0,.00237,0,.00475,0,.00712s0,273.40726,0,275.97468c0,.00607,0,.01213,0,.0182c0,29.82338-24.17662,54-54,54h-276Z", Se = {
319
- down: {
320
- contents: [
321
- /* @__PURE__ */ i.jsx(
322
- "path",
323
- {
324
- d: q,
325
- transform: "matrix(.707107 0.707107-.707107 0.707107 165.642289-79.868246)"
326
- }
327
- )
328
- ]
329
- },
330
- up: {
331
- contents: [
332
- /* @__PURE__ */ i.jsx(
333
- "path",
334
- {
335
- d: q,
336
- transform: "matrix(-.707107-.707107 0.707107-.707107 346.357711 591.868246)"
337
- }
338
- )
339
- ]
340
- },
341
- left: {
342
- contents: [
343
- /* @__PURE__ */ i.jsx(
344
- "path",
345
- {
346
- d: q,
347
- transform: "matrix(-.707107 0.707107-.707107-.707107 591.868246 165.642289)"
348
- }
349
- )
350
- ]
351
- },
352
- right: {
353
- contents: [
354
- /* @__PURE__ */ i.jsx(
355
- "path",
356
- {
357
- d: q,
358
- transform: "matrix(.707107-.707107 0.707107 0.707107-79.868246 346.357711)"
359
- }
360
- )
361
- ]
362
- }
363
- }, Ne = "0 0 512 512", H = h.forwardRef(
364
- ({ icon: t, className: e, size: r, style: s, ...o }, a) => {
365
- const { contents: c, viewBox: u } = Se[t];
366
- return /* @__PURE__ */ i.jsx(
367
- "svg",
368
- {
369
- xmlns: "http://www.w3.org/2000/svg",
370
- viewBox: u || Ne,
371
- className: m("aui-icon", e),
372
- style: { width: r, height: r, ...s },
373
- ...o,
374
- ref: a,
375
- children: c.map((f, l) => /* @__PURE__ */ i.jsx(h.Fragment, { children: f }, l))
376
- }
377
- );
378
- }
379
- ), te = h.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i.jsx(
380
- "button",
381
- {
382
- ...e,
383
- className: m("aui-action aui-button", t),
384
- ref: r
385
- }
386
- )), K = h.forwardRef(
387
- ({ variant: t, corners: e, className: r, size: s, ...o }, a) => /* @__PURE__ */ i.jsx(
388
- te,
389
- {
390
- ...o,
391
- className: m(
392
- pe({ variant: t, corners: e, size: s }),
393
- r
394
- ),
395
- ref: a
396
- }
397
- )
398
- ), pe = ({
399
- variant: t = "primary",
400
- corners: e = "rounded",
401
- size: r = "regular"
402
- }) => `aui-button--${t} aui-button-size--${r} aui-corners--${e}`, ke = h.forwardRef((t, e) => {
403
- const {
404
- animated: r,
405
- duration: s = 0.25,
406
- keepMounted: o = !1,
407
- animateTo: a,
408
- animateFrom: c,
409
- className: u,
410
- style: f,
411
- ...l
412
- } = t, [v, j] = L(r || o), [x, S] = L(!1), T = O(null), y = O(null), E = () => {
413
- T.current && (clearTimeout(T.current), T.current = null), y.current && (cancelAnimationFrame(y.current), y.current = null);
414
- };
415
- if (R(() => (r && v && (E(), y.current = requestAnimationFrame(
416
- () => S(!0)
417
- )), E), [r, v]), R(() => (r ? j(!0) : (E(), S(!1), T.current = window.setTimeout(() => {
418
- o || j(!1);
419
- }, s * 1e3)), E), [r, s, o]), !v) return null;
420
- const N = x ? a : c;
421
- return /* @__PURE__ */ i.jsx(
422
- w,
423
- {
424
- className: m(u, N?.className),
425
- style: {
426
- transition: `all ${s}s ease-in-out`,
427
- ...f,
428
- ...N?.style
429
- },
430
- ...l,
431
- ref: e
432
- }
433
- );
434
- }), Ye = h.forwardRef(
435
- ({ drawers: t, className: e, duration: r, hideDividers: s, ...o }, a) => {
436
- const [c, u] = L(/* @__PURE__ */ new Set());
437
- return /* @__PURE__ */ i.jsx(
438
- w,
439
- {
440
- layout: { axis: "y" },
441
- ...o,
442
- className: m("aui-accordion aui-corners--rounded", e),
443
- ref: a,
444
- children: t.map((f, l) => /* @__PURE__ */ i.jsx(
445
- _e,
446
- {
447
- item: f,
448
- open: c.has(l),
449
- onOpenChange: (v) => u((j) => {
450
- const x = new Set(j);
451
- return v ? x.add(l) : x.delete(l), x;
452
- }),
453
- duration: r,
454
- showDivider: !s && l < t.length - 1
455
- },
456
- l
457
- ))
458
- }
459
- );
460
- }
461
- ), _e = ({
462
- item: t,
463
- open: e,
464
- onOpenChange: r,
465
- duration: s,
466
- showDivider: o
467
- }) => {
468
- const a = O(null), [c, u] = L(), f = t.content;
469
- return R(() => {
470
- e && f && a.current && u(a.current.offsetHeight);
471
- }, [e, f]), /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
472
- /* @__PURE__ */ i.jsxs(w, { layout: { axis: "y" }, children: [
473
- /* @__PURE__ */ i.jsx(te, { onClick: () => r(!e), children: /* @__PURE__ */ i.jsxs(w, { layout: { axis: "x", align: "center", gap: "m", padding: "l" }, children: [
474
- /* @__PURE__ */ i.jsx(
475
- H,
476
- {
477
- size: 12,
478
- icon: e ? "down" : "right",
479
- className: "aui-accordion-arrow"
480
- }
481
- ),
482
- /* @__PURE__ */ i.jsx("span", { className: "aui-accordion-label", children: t.label })
483
- ] }) }),
484
- /* @__PURE__ */ i.jsx(
485
- ke,
486
- {
487
- style: { overflow: "hidden" },
488
- keepMounted: !0,
489
- duration: s,
490
- animated: e,
491
- animateFrom: {
492
- style: {
493
- visibility: "hidden",
494
- height: 0,
495
- transform: "translateY(-4px)",
496
- opacity: 0.9
497
- }
498
- },
499
- animateTo: {
500
- style: { height: c, transform: "translateY(0)", opacity: 1 }
501
- },
502
- children: /* @__PURE__ */ i.jsx(w, { ref: a, children: f })
503
- }
504
- )
505
- ] }),
506
- o && /* @__PURE__ */ i.jsx("hr", { className: "aui-accordion-hr" })
507
- ] });
508
- }, Ie = h.forwardRef(
509
- ({ type: t, corners: e = "rounded", className: r, ...s }, o) => /* @__PURE__ */ i.jsx(
510
- w,
511
- {
512
- ...s,
513
- className: m(
514
- `aui-alert aui-content--${t} aui-corners--${e}`,
515
- r
516
- ),
517
- ref: o
518
- }
519
- )
520
- ), Be = h.forwardRef(
521
- ({ type: t, className: e, corners: r = "rounded", ...s }, o) => /* @__PURE__ */ i.jsx(
522
- w,
523
- {
524
- ...s,
525
- className: m(
526
- `aui-badge aui-content--${t} aui-corners--${r}`,
527
- e
528
- ),
529
- ref: o
530
- }
531
- )
532
- ), Ue = h.forwardRef(
533
- ({ type: t, className: e, ...r }, s) => /* @__PURE__ */ i.jsx(
534
- w,
535
- {
536
- ...r,
537
- className: m(`aui-content--${t} aui-banner`, e),
538
- ref: s
539
- }
540
- )
541
- ), $e = 1, ze = h.forwardRef(
542
- ({
543
- children: t,
544
- className: e,
545
- hideArrows: r,
546
- hideDots: s,
547
- dotProps: o,
548
- leftArrowProps: a,
549
- rightArrowProps: c,
550
- autoplayInterval: u,
551
- duration: f,
552
- ...l
553
- }, v) => {
554
- f = Math.max(f ?? $e, 0.1), u = u ? Math.max(f, u) : void 0;
555
- const j = t.length, [x, S] = L({
556
- cur: 0,
557
- delta: 0,
558
- animating: !1
559
- }), T = O(null), { cur: y, delta: E, animating: N } = x, F = me(y + E, j), $ = ee(
560
- (k) => {
561
- N || k === 0 || S((A) => ({
562
- ...A,
563
- delta: k,
564
- animating: !0
565
- }));
566
- },
567
- [N]
568
- ), Y = () => {
569
- S(({ delta: k, cur: A }) => ({
570
- delta: k,
571
- animating: !1,
572
- cur: me(A + k, j)
573
- }));
574
- };
575
- if (R(() => (u && (T.current = window.setInterval(() => {
576
- $(1);
577
- }, u * 1e3)), () => {
578
- const k = T.current;
579
- T.current = null, k && clearInterval(k);
580
- }), [u, $]), j <= 0) return null;
581
- const I = N ? {
582
- transform: `translateX(${-(E / Math.abs(E)) * 100}%)`,
583
- transition: `transform ${f}s ease-in-out`
584
- } : void 0;
585
- return /* @__PURE__ */ i.jsxs(
586
- w,
587
- {
588
- ...l,
589
- className: m("aui-carousel", e),
590
- ref: v,
591
- children: [
592
- /* @__PURE__ */ i.jsxs(
593
- w,
594
- {
595
- className: "aui-carousel-slider",
596
- style: {
597
- ...I,
598
- flexDirection: E >= 0 ? "row" : "row-reverse"
599
- },
600
- onTransitionEnd: Y,
601
- children: [
602
- /* @__PURE__ */ i.jsx(w, { className: "aui-carousel-item", children: t[y] }),
603
- /* @__PURE__ */ i.jsx(w, { className: "aui-carousel-item", "aria-hidden": !0, children: t[F] })
604
- ]
605
- }
606
- ),
607
- j > 1 && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
608
- !r && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
609
- /* @__PURE__ */ i.jsx(
610
- K,
611
- {
612
- className: m(
613
- "aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow",
614
- a?.className
615
- ),
616
- style: { left: 8, ...a?.style },
617
- corners: "pill",
618
- "aria-label": "previous",
619
- onClick: () => $(-1),
620
- children: a?.children ?? /* @__PURE__ */ i.jsx(H, { icon: "left", size: 12, style: { marginRight: 2 } })
621
- }
622
- ),
623
- /* @__PURE__ */ i.jsx(
624
- K,
625
- {
626
- className: m(
627
- "aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow",
628
- c?.className
629
- ),
630
- style: { right: 8, ...c?.style },
631
- corners: "pill",
632
- "aria-label": "next",
633
- onClick: () => $(1),
634
- children: c?.children ?? /* @__PURE__ */ i.jsx(H, { icon: "right", size: 12, style: { marginLeft: 2 } })
635
- }
636
- )
637
- ] }),
638
- !s && /* @__PURE__ */ i.jsx(
639
- w,
640
- {
641
- layout: { axis: "x", align: "center", gap: "xs" },
642
- className: "aui-carousel-dots",
643
- children: t.map((k, A) => /* @__PURE__ */ i.jsx(
644
- K,
645
- {
646
- className: m(
647
- "aui-carousel-dot",
648
- o?.className
649
- ),
650
- corners: "pill",
651
- disabled: y === A || N,
652
- onClick: () => $(A - y),
653
- style: o?.style
654
- },
655
- A
656
- ))
657
- }
658
- )
659
- ] })
660
- ]
661
- }
662
- );
663
- }
664
- );
665
- function me(t, e) {
666
- return (t % e + e) % e;
667
- }
668
- const We = ({
669
- children: t,
670
- onClickOutside: e
671
- }) => {
672
- const r = O(null), s = O(!1), o = O(!1);
673
- R(() => {
674
- const c = window.setTimeout(() => {
675
- o.current = !0;
676
- }, 0);
677
- return () => {
678
- clearTimeout(c), o.current = !1;
679
- };
680
- }, []);
681
- const a = ee(
682
- (c) => {
683
- const u = s.current;
684
- s.current = !1, !(!o.current || !r.current || u) && (c.composedPath().includes(r.current) || e(c));
685
- },
686
- [e]
687
- );
688
- return R(() => (document.addEventListener("click", a), () => document.removeEventListener("click", a)), [a]), ve(t, {
689
- ref: r,
690
- onClick: (c) => {
691
- s.current = !0, t.props?.onClick?.(c);
692
- }
693
- });
694
- }, z = {
695
- right: 45,
696
- left: -45
697
- }, he = {
698
- right: -135,
699
- left: -225
700
- }, M = (t) => {
701
- const {
702
- size: e = 36,
703
- duration: r = 0.25,
704
- double: s,
705
- openStyle: o,
706
- open: a,
707
- style: c,
708
- rounded: u,
709
- lineHeight: f,
710
- ...l
711
- } = t, v = f || Math.max(1, Math.round(e / 20)), j = {
712
- width: e,
713
- height: e,
714
- display: "flex",
715
- position: "relative",
716
- justifyContent: "center",
717
- alignItems: "center",
718
- transition: `transform ${r}s ease`
719
- }, x = {
720
- height: v,
721
- width: e * 0.7,
722
- backgroundColor: "currentColor",
723
- position: "absolute",
724
- transition: `transform ${r}s ease, opacity ${r}s ease`,
725
- borderRadius: u ? 1e4 : 0
726
- }, S = P(
727
- () => e / (s ? 7 : 4),
728
- [e, s]
729
- ), { outer: T, top: y, middle: E, bottom: N } = o, F = a ? T : {}, $ = a ? y : { transform: `translateY(-${S}px)` }, Y = a ? N : { transform: `translateY(${S}px)` }, I = a ? E : {};
730
- return /* @__PURE__ */ i.jsxs(
731
- te,
732
- {
733
- style: { ...c, ...F, ...j },
734
- ...l,
735
- "aria-label": l["aria-label"] || "hamburger",
736
- "aria-expanded": a,
737
- children: [
738
- /* @__PURE__ */ i.jsx("span", { style: { ...x, ...$ } }),
739
- !s && /* @__PURE__ */ i.jsx("span", { style: { ...x, ...I } }),
740
- /* @__PURE__ */ i.jsx("span", { style: { ...x, ...Y } })
741
- ]
742
- }
743
- );
744
- }, qe = (t) => {
745
- const { direction: e = "left", ...r } = t, s = P(() => {
746
- const o = z[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
747
- return {
748
- top: { transform: a },
749
- middle: { transform: "scale(0)" },
750
- bottom: { transform: c }
751
- };
752
- }, [e]);
753
- return /* @__PURE__ */ i.jsx(M, { ...r, openStyle: s });
754
- }, He = (t) => {
755
- const { direction: e = "left", ...r } = t, s = P(() => {
756
- const o = z[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
757
- return {
758
- top: { transform: a },
759
- bottom: { transform: c }
760
- };
761
- }, [e]);
762
- return /* @__PURE__ */ i.jsx(M, { ...r, double: !0, openStyle: s });
763
- }, Ve = (t) => {
764
- const { direction: e = "left", ...r } = t, s = P(() => {
765
- const o = he[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
766
- return {
767
- top: { transform: a },
768
- bottom: { transform: c }
769
- };
770
- }, [e]);
771
- return /* @__PURE__ */ i.jsx(M, { ...r, double: !0, openStyle: s });
772
- }, Xe = (t) => {
773
- const { direction: e = "left", ...r } = t, s = P(() => {
774
- const o = z[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
775
- return {
776
- top: { transform: a },
777
- bottom: { transform: c },
778
- outer: { transform: "rotate(180deg)" }
779
- };
780
- }, [e]);
781
- return /* @__PURE__ */ i.jsx(M, { ...r, double: !0, openStyle: s });
782
- }, Je = (t) => {
783
- const { direction: e = "left", ...r } = t, s = P(() => {
784
- const o = z[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
785
- return {
786
- top: { transform: a },
787
- middle: { opacity: 0 },
788
- bottom: { transform: c }
789
- };
790
- }, [e]);
791
- return /* @__PURE__ */ i.jsx(M, { ...r, openStyle: s });
792
- }, Ge = (t) => {
793
- const { direction: e = "left", ...r } = t, s = P(() => {
794
- const o = he[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
795
- return {
796
- top: { transform: a },
797
- middle: { transform: "scale(0)" },
798
- bottom: { transform: c }
799
- };
800
- }, [e]);
801
- return /* @__PURE__ */ i.jsx(M, { ...r, openStyle: s });
802
- }, Ze = (t) => {
803
- const { direction: e = "left", ...r } = t, s = P(() => {
804
- const o = z[e], a = `rotate(${o}deg)`, c = `rotate(${-o}deg)`;
805
- return {
806
- top: { transform: a },
807
- middle: { opacity: 0 },
808
- bottom: { transform: c },
809
- outer: { transform: "rotate(180deg)" }
810
- };
811
- }, [e]);
812
- return /* @__PURE__ */ i.jsx(M, { ...r, openStyle: s });
813
- }, Qe = V(
814
- ({ className: t, corners: e = "rounded", ...r }, s) => /* @__PURE__ */ i.jsx(
815
- "input",
816
- {
817
- ...r,
818
- ref: s,
819
- className: m(
820
- `aui-input-base aui-input aui-corners--${e}`,
821
- t
822
- )
823
- }
824
- )
825
- ), Ke = V(
826
- ({ className: t, rows: e = 3, corners: r = "rounded", ...s }, o) => /* @__PURE__ */ i.jsx(
827
- "textarea",
828
- {
829
- ...s,
830
- ref: o,
831
- className: m(
832
- `aui-input-base aui-input aui-corners--${r}`,
833
- t
834
- ),
835
- rows: e
836
- }
837
- )
838
- ), et = V(
839
- ({ startIcon: t, endIcon: e, className: r, style: s, corners: o = "rounded", inputProps: a }, c) => /* @__PURE__ */ i.jsxs(
840
- w,
841
- {
842
- layout: { axis: "x", align: "center" },
843
- className: m(
844
- `aui-input aui-icon-input aui-corners--${o}`,
845
- r
846
- ),
847
- style: s,
848
- ref: c,
849
- children: [
850
- t,
851
- /* @__PURE__ */ i.jsx(
852
- "input",
853
- {
854
- ...a,
855
- className: m(
856
- `aui-input-base aui-corners--${o}`,
857
- a?.className
858
- )
859
- }
860
- ),
861
- e
862
- ]
863
- }
864
- )
865
- ), Ae = () => {
866
- const t = window.scrollY, e = document.body.style, r = document.documentElement.style, { overflow: s, position: o, top: a, width: c } = e, { scrollBehavior: u } = r;
867
- return r.scrollBehavior = "auto", e.overflow = "hidden", e.position = "fixed", e.top = `-${t}px`, e.width = "100%", () => {
868
- e.overflow = s, e.position = o, e.top = a, e.width = c, window.scrollTo(0, t), r.scrollBehavior = u;
869
- };
870
- }, Oe = (t = !0) => {
871
- R(() => {
872
- if (t)
873
- return Ae();
874
- }, [t]);
875
- }, tt = (t) => {
876
- const { onMatch: e, onUnmatch: r, query: s } = t, [o, a] = L(!1);
877
- return R(() => {
878
- const c = window.matchMedia(s), u = (f) => {
879
- f.matches ? e?.() : r?.(), a(f.matches);
880
- };
881
- return c.addEventListener("change", u), a(c.matches), () => c.removeEventListener("change", u);
882
- }, [e, r, s]), o;
883
- }, rt = () => {
884
- const [t, e] = L({
885
- scrollX: window.scrollX,
886
- scrollY: window.scrollY
887
- });
888
- return R(() => {
889
- const r = () => {
890
- e({
891
- scrollX: window.scrollX,
892
- scrollY: window.scrollY
893
- });
894
- };
895
- return window.addEventListener("scroll", r), () => window.removeEventListener("scroll", r);
896
- }, []), t;
897
- }, Ce = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]', Pe = (t = !0) => {
898
- const e = O(null), r = O(null), s = ee(() => {
899
- e.current && (r.current = e.current.querySelectorAll(Ce));
900
- }, []);
901
- return R(() => {
902
- if (!t || !e.current) return;
903
- s();
904
- const o = (c) => {
905
- if (c.key !== "Tab") return;
906
- if (!r.current || r.current.length === 0)
907
- return c.preventDefault();
908
- const { activeElement: u } = document, f = r.current[0], l = r.current[r.current.length - 1];
909
- c.shiftKey && u === f ? (l.focus(), c.preventDefault()) : !c.shiftKey && u === l ? (f.focus(), c.preventDefault()) : e.current?.contains(u) || ((c.shiftKey ? l : f).focus(), c.preventDefault());
910
- }, a = new MutationObserver(s);
911
- return a.observe(e.current, { childList: !0, subtree: !0 }), document.addEventListener("keydown", o), () => {
912
- document.removeEventListener("keydown", o), a.disconnect();
913
- };
914
- }, [t, s]), e;
915
- }, nt = (t = {}) => {
916
- const { active: e = !0, behavior: r, delay: s } = t;
917
- R(() => {
918
- const o = window.location.hash;
919
- if (!e || o?.length <= 1) return;
920
- const a = o.substring(1);
921
- if (s !== void 0) {
922
- const c = setTimeout(() => fe(a, r), s);
923
- return () => clearTimeout(c);
924
- }
925
- fe(a, r);
926
- }, [e, r, s]);
927
- }, ot = (t) => {
928
- R(() => (window.addEventListener("resize", t), () => window.removeEventListener("resize", t)), [t]);
929
- }, Le = h.forwardRef(
930
- ({
931
- onClose: t,
932
- children: e,
933
- className: r,
934
- disableEscape: s = !1,
935
- visible: o,
936
- onMouseDown: a,
937
- ...c
938
- }, u) => {
939
- const f = Pe(o);
940
- return R(() => {
941
- const l = (v) => {
942
- v.key === "Escape" && t?.();
943
- };
944
- return s || document.addEventListener("keydown", l), () => {
945
- s || document.removeEventListener("keydown", l);
946
- };
947
- }, [t, s]), /* @__PURE__ */ i.jsx(
948
- w,
949
- {
950
- layout: { axis: "y", align: "center", justify: "center" },
951
- ...c,
952
- className: m("aui-layer-backdrop", r),
953
- onMouseDown: (l) => {
954
- a?.(l), t?.();
955
- },
956
- ref: u,
957
- children: h.cloneElement(e, {
958
- ref: f,
959
- onMouseDown: (l) => {
960
- l.stopPropagation(), e.props?.onMouseDown?.(l);
961
- }
962
- })
963
- }
964
- );
965
- }
966
- ), st = h.forwardRef(
967
- ({ returnFocusOnEscape: t, disableScrollLock: e, ...r }, s) => (Oe(!e), R(
968
- () => () => {
969
- const o = document.activeElement;
970
- t || o?.blur?.();
971
- },
972
- [t]
973
- ), /* @__PURE__ */ i.jsx(Le, { ...r, visible: !0, ref: s }))
974
- ), xe = h.forwardRef(
975
- ({ LinkElement: t, to: e, className: r, external: s, ...o }, a) => {
976
- const c = {
977
- ...s ? { target: "_blank", rel: "noreferrer noopener" } : {},
978
- ...o,
979
- className: m("aui-action", r)
980
- };
981
- return t ? /* @__PURE__ */ i.jsx(t, { ...c, to: e, ref: a }) : /* @__PURE__ */ i.jsx("a", { ...c, href: e, ref: a });
982
- }
983
- ), at = h.forwardRef(({ className: t, variant: e, corners: r, size: s, ...o }, a) => /* @__PURE__ */ i.jsx(
984
- xe,
985
- {
986
- ...o,
987
- className: m(
988
- pe({ variant: e, corners: r, size: s }),
989
- t
990
- ),
991
- ref: a
992
- }
993
- )), ct = h.forwardRef(
994
- ({ className: t, ...e }, r) => /* @__PURE__ */ i.jsx(
995
- xe,
996
- {
997
- ...e,
998
- className: m("aui-link", t),
999
- ref: r
1000
- }
1001
- )
1002
- ), Me = ({
1003
- className: t,
1004
- options: e,
1005
- getOptionLabel: r,
1006
- corners: s = "rounded",
1007
- style: o,
1008
- disabled: a,
1009
- ...c
1010
- }, u) => /* @__PURE__ */ i.jsxs(
1011
- w,
1012
- {
1013
- className: m(
1014
- "aui-select-container",
1015
- `aui-corners--${s}`,
1016
- a ? "aui-select-disabled" : void 0,
1017
- t
1018
- ),
1019
- style: o,
1020
- children: [
1021
- /* @__PURE__ */ i.jsx(
1022
- "select",
1023
- {
1024
- ...c,
1025
- ref: u,
1026
- className: `aui-select aui-corners--${s}`,
1027
- disabled: a,
1028
- children: e.map((f, l) => /* @__PURE__ */ i.jsx("option", { value: f, children: r?.(f) || f }, l))
1029
- }
1030
- ),
1031
- /* @__PURE__ */ i.jsx(H, { icon: "down", className: "aui-select-icon", "aria-hidden": !0 })
1032
- ]
1033
- }
1034
- ), it = V(Me), lt = ({ className: t, ...e }) => (
1035
- // Designed on 2023-08-18
1036
- /* @__PURE__ */ i.jsx(
1037
- "svg",
1038
- {
1039
- xmlns: "http://www.w3.org/2000/svg",
1040
- viewBox: "0 0 512 512",
1041
- className: m("aui-spinner", t),
1042
- ...e,
1043
- children: /* @__PURE__ */ i.jsx(
1044
- "path",
1045
- {
1046
- fill: "currentColor",
1047
- d: "M256,0C114.62,0,0,114.62,0,256S114.62,512,256,512c70.64,0,134.59-28.61,180.91-74.88l-31.11-31.11c-38.35,38.3-91.31,61.99-149.8,61.99-117.08,0-212-94.92-212-212S138.92,44,256,44V0Z"
1048
- }
1049
- )
1050
- }
1051
- )
1052
- );
1053
- export {
1054
- Ye as Accordion,
1055
- Ie as Alert,
1056
- ke as Animated,
1057
- Be as Badge,
1058
- Ue as Banner,
1059
- w as Box,
1060
- K as Button,
1061
- at as ButtonLink,
1062
- ze as Carousel,
1063
- We as ClickOutside,
1064
- He as DoubleCross,
1065
- Ve as DoubleFlip,
1066
- Xe as DoubleSpin,
1067
- qe as Hamburger,
1068
- H as Icon,
1069
- et as IconInput,
1070
- Qe as Input,
1071
- st as Layer,
1072
- ct as Link,
1073
- it as Select,
1074
- lt as Spinner,
1075
- Ke as TextArea,
1076
- Je as TripleFade,
1077
- Ge as TripleFlip,
1078
- qe as TriplePrestige,
1079
- Ze as TripleSpin,
1080
- te as UnstyledButton,
1081
- xe as UnstyledLink,
1082
- Fe as assertDefined,
1083
- m as classNames,
1084
- fe as scrollToId,
1085
- Pe as useFocusTrap,
1086
- tt as useMediaQuery,
1087
- rt as useScroll,
1088
- Oe as useScrollLock,
1089
- nt as useScrollToHash,
1090
- ot as useWindowResize
1091
- };
package/dist/aui.umd.js DELETED
@@ -1,22 +0,0 @@
1
- (function(f,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(f=typeof globalThis<"u"?globalThis:f||self,l(f.Aui={},f.React))})(this,function(f,l){"use strict";var U={exports:{}},M={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var K;function be(){if(K)return M;K=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(s,o,a){var i=null;if(a!==void 0&&(i=""+a),o.key!==void 0&&(i=""+o.key),"key"in o){a={};for(var d in o)d!=="key"&&(a[d]=o[d])}else a=o;return o=a.ref,{$$typeof:t,type:s,key:i,ref:o!==void 0?o:null,props:a}}return M.Fragment=e,M.jsx=r,M.jsxs=r,M}var P={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var ee;function ge(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){function t(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===et?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case E:return"Fragment";case N:return"Profiler";case T:return"StrictMode";case B:return"Suspense";case _:return"SuspenseList";case Ke:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case S:return"Portal";case $:return(n.displayName||"Context")+".Provider";case I:return(n._context.displayName||"Context")+".Consumer";case Y:var m=n.render;return n=n.displayName,n||(n=m.displayName||m.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case R:return m=n.displayName||null,m!==null?m:t(n.type)||"Memo";case ce:m=n._payload,n=n._init;try{return t(n(m))}catch{}}return null}function e(n){return""+n}function r(n){try{e(n);var m=!1}catch{m=!0}if(m){m=console;var b=m.error,y=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return b.call(m,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",y),e(n)}}function s(n){if(n===E)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===ce)return"<...>";try{var m=t(n);return m?"<"+m+">":"<...>"}catch{return"<...>"}}function o(){var n=X.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function i(n){if(ue.call(n,"key")){var m=Object.getOwnPropertyDescriptor(n,"key").get;if(m&&m.isReactWarning)return!1}return n.key!==void 0}function d(n,m){function b(){fe||(fe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",m))}b.isReactWarning=!0,Object.defineProperty(n,"key",{get:b,configurable:!0})}function h(){var n=t(this.type);return de[n]||(de[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function u(n,m,b,y,O,A,G,Q){return b=A.ref,n={$$typeof:k,type:n,key:m,props:A,_owner:O},(b!==void 0?b:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:h}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function v(n,m,b,y,O,A,G,Q){var x=m.children;if(x!==void 0)if(y)if(tt(x)){for(y=0;y<x.length;y++)j(x[y]);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(x);if(ue.call(m,"key")){x=t(n);var L=Object.keys(m).filter(function(rt){return rt!=="key"});y=0<L.length?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}",pe[x+y]||(L=0<L.length?"{"+L.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
- let props = %s;
19
- <%s {...props} />
20
- React keys must be passed directly to JSX without using spread:
21
- let props = %s;
22
- <%s key={someKey} {...props} />`,y,x,L,x),pe[x+y]=!0)}if(x=null,b!==void 0&&(r(b),x=""+b),i(m)&&(r(m.key),x=""+m.key),"key"in m){b={};for(var Z in m)Z!=="key"&&(b[Z]=m[Z])}else b=m;return x&&d(b,typeof n=="function"?n.displayName||n.name||"Unknown":n),u(n,x,A,O,o(),b,G,Q)}function j(n){typeof n=="object"&&n!==null&&n.$$typeof===k&&n._store&&(n._store.validated=1)}var w=l,k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),$=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),ce=Symbol.for("react.lazy"),Ke=Symbol.for("react.activity"),et=Symbol.for("react.client.reference"),X=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=Object.prototype.hasOwnProperty,tt=Array.isArray,J=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(n){return n()}};var fe,de={},me=w.react_stack_bottom_frame.bind(w,a)(),he=J(s(a)),pe={};P.Fragment=E,P.jsx=function(n,m,b,y,O){var A=1e4>X.recentlyCreatedOwnerStacks++;return v(n,m,b,!1,y,O,A?Error("react-stack-top-frame"):me,A?J(s(n)):he)},P.jsxs=function(n,m,b,y,O){var A=1e4>X.recentlyCreatedOwnerStacks++;return v(n,m,b,!0,y,O,A?Error("react-stack-top-frame"):me,A?J(s(n)):he)}}()),P}var te;function we(){return te||(te=1,process.env.NODE_ENV==="production"?U.exports=be():U.exports=ge()),U.exports}var c=we();function p(...t){return t.filter(Boolean).join(" ")}function H(t,e){try{const r=document.getElementById(t);r&&r.scrollIntoView({behavior:e})}catch{return}}function ye(t,e){if(t===void 0)throw new Error(e||"Unexpected undefined value");return t}const g=l.forwardRef(({layout:t,className:e,style:r,...s},o)=>{const a=xe(t);return c.jsx("div",{...s,className:p(a.className,e),style:{...a.style,...r},ref:o})});function xe(t){if(!t)return{className:void 0,style:void 0};const{axis:e,gap:r,align:s,justify:o,padding:a,margin:i,wrap:d}=t,h={};let u=`aui-flex-${e}`;return s&&(u=p(u,`aui-align-${s}`)),o&&(u=p(u,`aui-justify-${o}`)),d&&(u=p(u,"aui-flex-wrap")),r&&(typeof r=="number"?h.gap=r:u=p(u,`aui-gap-${r}`)),a&&(typeof a=="number"?h.padding=a:u=p(u,`aui-pa-${a}`)),i&&(typeof i=="number"?h.margin=i:u=p(u,`aui-ma-${i}`)),{className:u,style:h}}const z="M94.0908,296.3057c-29.82338,0-54-24.17662-54-54s24.17662-54,54-54c.00237,0,.00475,0,.00712,0c.0017,0,141.65138,0,221.99288,0v-222c0-29.82338,24.17662-54,54-54s54,24.17662,54,54c0,.00237,0,.00475,0,.00712s0,273.40726,0,275.97468c0,.00607,0,.01213,0,.0182c0,29.82338-24.17662,54-54,54h-276Z",Ee={down:{contents:[c.jsx("path",{d:z,transform:"matrix(.707107 0.707107-.707107 0.707107 165.642289-79.868246)"})]},up:{contents:[c.jsx("path",{d:z,transform:"matrix(-.707107-.707107 0.707107-.707107 346.357711 591.868246)"})]},left:{contents:[c.jsx("path",{d:z,transform:"matrix(-.707107 0.707107-.707107-.707107 591.868246 165.642289)"})]},right:{contents:[c.jsx("path",{d:z,transform:"matrix(.707107-.707107 0.707107 0.707107-79.868246 346.357711)"})]}},ve="0 0 512 512",D=l.forwardRef(({icon:t,className:e,size:r,style:s,...o},a)=>{const{contents:i,viewBox:d}=Ee[t];return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:d||ve,className:p("aui-icon",e),style:{width:r,height:r,...s},...o,ref:a,children:i.map((h,u)=>c.jsx(l.Fragment,{children:h},u))})}),W=l.forwardRef(({className:t,...e},r)=>c.jsx("button",{...e,className:p("aui-action aui-button",t),ref:r})),q=l.forwardRef(({variant:t,corners:e,className:r,size:s,...o},a)=>c.jsx(W,{...o,className:p(re({variant:t,corners:e,size:s}),r),ref:a})),re=({variant:t="primary",corners:e="rounded",size:r="regular"})=>`aui-button--${t} aui-button-size--${r} aui-corners--${e}`,ne=l.forwardRef((t,e)=>{const{animated:r,duration:s=.25,keepMounted:o=!1,animateTo:a,animateFrom:i,className:d,style:h,...u}=t,[v,j]=l.useState(r||o),[w,k]=l.useState(!1),S=l.useRef(null),E=l.useRef(null),T=()=>{S.current&&(clearTimeout(S.current),S.current=null),E.current&&(cancelAnimationFrame(E.current),E.current=null)};if(l.useEffect(()=>(r&&v&&(T(),E.current=requestAnimationFrame(()=>k(!0))),T),[r,v]),l.useEffect(()=>(r?j(!0):(T(),k(!1),S.current=window.setTimeout(()=>{o||j(!1)},s*1e3)),T),[r,s,o]),!v)return null;const N=w?a:i;return c.jsx(g,{className:p(d,N?.className),style:{transition:`all ${s}s ease-in-out`,...h,...N?.style},...u,ref:e})}),je=l.forwardRef(({drawers:t,className:e,duration:r,hideDividers:s,...o},a)=>{const[i,d]=l.useState(new Set);return c.jsx(g,{layout:{axis:"y"},...o,className:p("aui-accordion aui-corners--rounded",e),ref:a,children:t.map((h,u)=>c.jsx(Te,{item:h,open:i.has(u),onOpenChange:v=>d(j=>{const w=new Set(j);return v?w.add(u):w.delete(u),w}),duration:r,showDivider:!s&&u<t.length-1},u))})}),Te=({item:t,open:e,onOpenChange:r,duration:s,showDivider:o})=>{const a=l.useRef(null),[i,d]=l.useState(),h=t.content;return l.useEffect(()=>{e&&h&&a.current&&d(a.current.offsetHeight)},[e,h]),c.jsxs(c.Fragment,{children:[c.jsxs(g,{layout:{axis:"y"},children:[c.jsx(W,{onClick:()=>r(!e),children:c.jsxs(g,{layout:{axis:"x",align:"center",gap:"m",padding:"l"},children:[c.jsx(D,{size:12,icon:e?"down":"right",className:"aui-accordion-arrow"}),c.jsx("span",{className:"aui-accordion-label",children:t.label})]})}),c.jsx(ne,{style:{overflow:"hidden"},keepMounted:!0,duration:s,animated:e,animateFrom:{style:{visibility:"hidden",height:0,transform:"translateY(-4px)",opacity:.9}},animateTo:{style:{height:i,transform:"translateY(0)",opacity:1}},children:c.jsx(g,{ref:a,children:h})})]}),o&&c.jsx("hr",{className:"aui-accordion-hr"})]})},Se=l.forwardRef(({type:t,corners:e="rounded",className:r,...s},o)=>c.jsx(g,{...s,className:p(`aui-alert aui-content--${t} aui-corners--${e}`,r),ref:o})),ke=l.forwardRef(({type:t,className:e,corners:r="rounded",...s},o)=>c.jsx(g,{...s,className:p(`aui-badge aui-content--${t} aui-corners--${r}`,e),ref:o})),Ne=l.forwardRef(({type:t,className:e,...r},s)=>c.jsx(g,{...r,className:p(`aui-content--${t} aui-banner`,e),ref:s})),_e=1,Ae=l.forwardRef(({children:t,className:e,hideArrows:r,hideDots:s,dotProps:o,leftArrowProps:a,rightArrowProps:i,autoplayInterval:d,duration:h,...u},v)=>{h=Math.max(h??_e,.1),d=d?Math.max(h,d):void 0;const j=t.length,[w,k]=l.useState({cur:0,delta:0,animating:!1}),S=l.useRef(null),{cur:E,delta:T,animating:N}=w,I=oe(E+T,j),$=l.useCallback(_=>{N||_===0||k(R=>({...R,delta:_,animating:!0}))},[N]),Y=()=>{k(({delta:_,cur:R})=>({delta:_,animating:!1,cur:oe(R+_,j)}))};if(l.useEffect(()=>(d&&(S.current=window.setInterval(()=>{$(1)},d*1e3)),()=>{const _=S.current;S.current=null,_&&clearInterval(_)}),[d,$]),j<=0)return null;const B=N?{transform:`translateX(${-(T/Math.abs(T))*100}%)`,transition:`transform ${h}s ease-in-out`}:void 0;return c.jsxs(g,{...u,className:p("aui-carousel",e),ref:v,children:[c.jsxs(g,{className:"aui-carousel-slider",style:{...B,flexDirection:T>=0?"row":"row-reverse"},onTransitionEnd:Y,children:[c.jsx(g,{className:"aui-carousel-item",children:t[E]}),c.jsx(g,{className:"aui-carousel-item","aria-hidden":!0,children:t[I]})]}),j>1&&c.jsxs(c.Fragment,{children:[!r&&c.jsxs(c.Fragment,{children:[c.jsx(q,{className:p("aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow",a?.className),style:{left:8,...a?.style},corners:"pill","aria-label":"previous",onClick:()=>$(-1),children:a?.children??c.jsx(D,{icon:"left",size:12,style:{marginRight:2}})}),c.jsx(q,{className:p("aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow",i?.className),style:{right:8,...i?.style},corners:"pill","aria-label":"next",onClick:()=>$(1),children:i?.children??c.jsx(D,{icon:"right",size:12,style:{marginLeft:2}})})]}),!s&&c.jsx(g,{layout:{axis:"x",align:"center",gap:"xs"},className:"aui-carousel-dots",children:t.map((_,R)=>c.jsx(q,{className:p("aui-carousel-dot",o?.className),corners:"pill",disabled:E===R||N,onClick:()=>$(R-E),style:o?.style},R))})]})]})});function oe(t,e){return(t%e+e)%e}const $e=({children:t,onClickOutside:e})=>{const r=l.useRef(null),s=l.useRef(!1),o=l.useRef(!1);l.useEffect(()=>{const i=window.setTimeout(()=>{o.current=!0},0);return()=>{clearTimeout(i),o.current=!1}},[]);const a=l.useCallback(i=>{const d=s.current;s.current=!1,!(!o.current||!r.current||d)&&(i.composedPath().includes(r.current)||e(i))},[e]);return l.useEffect(()=>(document.addEventListener("click",a),()=>document.removeEventListener("click",a)),[a]),l.cloneElement(t,{ref:r,onClick:i=>{s.current=!0,t.props?.onClick?.(i)}})},F={right:45,left:-45},se={right:-135,left:-225},C=t=>{const{size:e=36,duration:r=.25,double:s,openStyle:o,open:a,style:i,rounded:d,lineHeight:h,...u}=t,v=h||Math.max(1,Math.round(e/20)),j={width:e,height:e,display:"flex",position:"relative",justifyContent:"center",alignItems:"center",transition:`transform ${r}s ease`},w={height:v,width:e*.7,backgroundColor:"currentColor",position:"absolute",transition:`transform ${r}s ease, opacity ${r}s ease`,borderRadius:d?1e4:0},k=l.useMemo(()=>e/(s?7:4),[e,s]),{outer:S,top:E,middle:T,bottom:N}=o,I=a?S:{},$=a?E:{transform:`translateY(-${k}px)`},Y=a?N:{transform:`translateY(${k}px)`},B=a?T:{};return c.jsxs(W,{style:{...i,...I,...j},...u,"aria-label":u["aria-label"]||"hamburger","aria-expanded":a,children:[c.jsx("span",{style:{...w,...$}}),!s&&c.jsx("span",{style:{...w,...B}}),c.jsx("span",{style:{...w,...Y}})]})},ae=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=F[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},middle:{transform:"scale(0)"},bottom:{transform:i}}},[e]);return c.jsx(C,{...r,openStyle:s})},Re=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=F[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},bottom:{transform:i}}},[e]);return c.jsx(C,{...r,double:!0,openStyle:s})},Oe=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=se[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},bottom:{transform:i}}},[e]);return c.jsx(C,{...r,double:!0,openStyle:s})},Ce=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=F[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},bottom:{transform:i},outer:{transform:"rotate(180deg)"}}},[e]);return c.jsx(C,{...r,double:!0,openStyle:s})},Le=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=F[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},middle:{opacity:0},bottom:{transform:i}}},[e]);return c.jsx(C,{...r,openStyle:s})},Me=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=se[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},middle:{transform:"scale(0)"},bottom:{transform:i}}},[e]);return c.jsx(C,{...r,openStyle:s})},Pe=t=>{const{direction:e="left",...r}=t,s=l.useMemo(()=>{const o=F[e],a=`rotate(${o}deg)`,i=`rotate(${-o}deg)`;return{top:{transform:a},middle:{opacity:0},bottom:{transform:i},outer:{transform:"rotate(180deg)"}}},[e]);return c.jsx(C,{...r,openStyle:s})},De=l.forwardRef(({className:t,corners:e="rounded",...r},s)=>c.jsx("input",{...r,ref:s,className:p(`aui-input-base aui-input aui-corners--${e}`,t)})),Fe=l.forwardRef(({className:t,rows:e=3,corners:r="rounded",...s},o)=>c.jsx("textarea",{...s,ref:o,className:p(`aui-input-base aui-input aui-corners--${r}`,t),rows:e})),Ie=l.forwardRef(({startIcon:t,endIcon:e,className:r,style:s,corners:o="rounded",inputProps:a},i)=>c.jsxs(g,{layout:{axis:"x",align:"center"},className:p(`aui-input aui-icon-input aui-corners--${o}`,r),style:s,ref:i,children:[t,c.jsx("input",{...a,className:p(`aui-input-base aui-corners--${o}`,a?.className)}),e]})),Ye=()=>{const t=window.scrollY,e=document.body.style,r=document.documentElement.style,{overflow:s,position:o,top:a,width:i}=e,{scrollBehavior:d}=r;return r.scrollBehavior="auto",e.overflow="hidden",e.position="fixed",e.top=`-${t}px`,e.width="100%",()=>{e.overflow=s,e.position=o,e.top=a,e.width=i,window.scrollTo(0,t),r.scrollBehavior=d}},ie=(t=!0)=>{l.useEffect(()=>{if(t)return Ye()},[t])},Be=t=>{const{onMatch:e,onUnmatch:r,query:s}=t,[o,a]=l.useState(!1);return l.useEffect(()=>{const i=window.matchMedia(s),d=h=>{h.matches?e?.():r?.(),a(h.matches)};return i.addEventListener("change",d),a(i.matches),()=>i.removeEventListener("change",d)},[e,r,s]),o},Ue=()=>{const[t,e]=l.useState({scrollX:window.scrollX,scrollY:window.scrollY});return l.useEffect(()=>{const r=()=>{e({scrollX:window.scrollX,scrollY:window.scrollY})};return window.addEventListener("scroll",r),()=>window.removeEventListener("scroll",r)},[]),t},ze='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]',le=(t=!0)=>{const e=l.useRef(null),r=l.useRef(null),s=l.useCallback(()=>{e.current&&(r.current=e.current.querySelectorAll(ze))},[]);return l.useEffect(()=>{if(!t||!e.current)return;s();const o=i=>{if(i.key!=="Tab")return;if(!r.current||r.current.length===0)return i.preventDefault();const{activeElement:d}=document,h=r.current[0],u=r.current[r.current.length-1];i.shiftKey&&d===h?(u.focus(),i.preventDefault()):!i.shiftKey&&d===u?(h.focus(),i.preventDefault()):e.current?.contains(d)||((i.shiftKey?u:h).focus(),i.preventDefault())},a=new MutationObserver(s);return a.observe(e.current,{childList:!0,subtree:!0}),document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),a.disconnect()}},[t,s]),e},We=(t={})=>{const{active:e=!0,behavior:r,delay:s}=t;l.useEffect(()=>{const o=window.location.hash;if(!e||o?.length<=1)return;const a=o.substring(1);if(s!==void 0){const i=setTimeout(()=>H(a,r),s);return()=>clearTimeout(i)}H(a,r)},[e,r,s])},qe=t=>{l.useEffect(()=>(window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)),[t])},He=l.forwardRef(({onClose:t,children:e,className:r,disableEscape:s=!1,visible:o,onMouseDown:a,...i},d)=>{const h=le(o);return l.useEffect(()=>{const u=v=>{v.key==="Escape"&&t?.()};return s||document.addEventListener("keydown",u),()=>{s||document.removeEventListener("keydown",u)}},[t,s]),c.jsx(g,{layout:{axis:"y",align:"center",justify:"center"},...i,className:p("aui-layer-backdrop",r),onMouseDown:u=>{a?.(u),t?.()},ref:d,children:l.cloneElement(e,{ref:h,onMouseDown:u=>{u.stopPropagation(),e.props?.onMouseDown?.(u)}})})}),Ve=l.forwardRef(({returnFocusOnEscape:t,disableScrollLock:e,...r},s)=>(ie(!e),l.useEffect(()=>()=>{const o=document.activeElement;t||o?.blur?.()},[t]),c.jsx(He,{...r,visible:!0,ref:s}))),V=l.forwardRef(({LinkElement:t,to:e,className:r,external:s,...o},a)=>{const i={...s?{target:"_blank",rel:"noreferrer noopener"}:{},...o,className:p("aui-action",r)};return t?c.jsx(t,{...i,to:e,ref:a}):c.jsx("a",{...i,href:e,ref:a})}),Xe=l.forwardRef(({className:t,variant:e,corners:r,size:s,...o},a)=>c.jsx(V,{...o,className:p(re({variant:e,corners:r,size:s}),t),ref:a})),Je=l.forwardRef(({className:t,...e},r)=>c.jsx(V,{...e,className:p("aui-link",t),ref:r})),Ge=({className:t,options:e,getOptionLabel:r,corners:s="rounded",style:o,disabled:a,...i},d)=>c.jsxs(g,{className:p("aui-select-container",`aui-corners--${s}`,a?"aui-select-disabled":void 0,t),style:o,children:[c.jsx("select",{...i,ref:d,className:`aui-select aui-corners--${s}`,disabled:a,children:e.map((h,u)=>c.jsx("option",{value:h,children:r?.(h)||h},u))}),c.jsx(D,{icon:"down",className:"aui-select-icon","aria-hidden":!0})]}),Qe=l.forwardRef(Ge),Ze=({className:t,...e})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:p("aui-spinner",t),...e,children:c.jsx("path",{fill:"currentColor",d:"M256,0C114.62,0,0,114.62,0,256S114.62,512,256,512c70.64,0,134.59-28.61,180.91-74.88l-31.11-31.11c-38.35,38.3-91.31,61.99-149.8,61.99-117.08,0-212-94.92-212-212S138.92,44,256,44V0Z"})});f.Accordion=je,f.Alert=Se,f.Animated=ne,f.Badge=ke,f.Banner=Ne,f.Box=g,f.Button=q,f.ButtonLink=Xe,f.Carousel=Ae,f.ClickOutside=$e,f.DoubleCross=Re,f.DoubleFlip=Oe,f.DoubleSpin=Ce,f.Hamburger=ae,f.Icon=D,f.IconInput=Ie,f.Input=De,f.Layer=Ve,f.Link=Je,f.Select=Qe,f.Spinner=Ze,f.TextArea=Fe,f.TripleFade=Le,f.TripleFlip=Me,f.TriplePrestige=ae,f.TripleSpin=Pe,f.UnstyledButton=W,f.UnstyledLink=V,f.assertDefined=ye,f.classNames=p,f.scrollToId=H,f.useFocusTrap=le,f.useMediaQuery=Be,f.useScroll=Ue,f.useScrollLock=ie,f.useScrollToHash=We,f.useWindowResize=qe,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
package/vite.config.ts DELETED
@@ -1,23 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
-
4
- export default defineConfig({
5
- plugins: [react()],
6
- build: {
7
- lib: {
8
- entry: "src/index.tsx",
9
- name: "Aui",
10
- formats: ["es", "cjs", "umd"],
11
- fileName: (format) => `aui.${format}.js`,
12
- },
13
- rollupOptions: {
14
- external: ["react", "react-dom"],
15
- output: {
16
- globals: {
17
- react: "React",
18
- "react-dom": "ReactDOM",
19
- },
20
- },
21
- },
22
- },
23
- });