@bgord/ui 0.7.3 → 0.7.5

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.
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  type UseExitActionAnimationType = string;
3
3
  type UseExitActionOptionsType = {
4
- action: () => void;
4
+ action: () => Promise<void>;
5
5
  animation: UseExitActionAnimationType;
6
6
  };
7
7
  type UseExitActionReturnType = {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{useEffect as z,useRef as Z}from"react";import{useEffect as A}from"react";function S(e,t){A(()=>{if(typeof document>"u")return;function n(r){let o=e.current;if(!o)return;if(o.contains(r.target))if(r.target===o){let{left:i,right:a,top:s,bottom:l}=o.getBoundingClientRect(),p=r instanceof MouseEvent?r.clientX:r.touches[0].clientX,y=r instanceof MouseEvent?r.clientY:r.touches[0].clientY;if(p>=i&&p<=a&&y>=s&&y<=l)return}else return;t(r)}return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t])}import{useState as w}from"react";class m{static EMPTY=void 0;value=m.EMPTY;constructor(e){this.value=m.isEmpty(e)?m.EMPTY:e}get(){return this.value}isEmpty(){return m.isEmpty(this.value)}static isEmpty(e){return e===void 0||e===null||e===""}static compare(e,t){if(m.isEmpty(e)&&m.isEmpty(t))return!0;return e===t}}function Te(e){let t=new m(e.defaultValue),[n,r]=w(t.get()),[o,i]=w(m.isEmpty(t.get())?"":t.get()),a=(l)=>{let p=new m(l).get();r(p),i(m.isEmpty(p)?"":String(p))},s=(l)=>{let p=l.currentTarget,y=p.value;if(i(y),y==="")return r(m.EMPTY);if(!/^\d{4}-\d{2}-\d{2}$/.test(y))return;if(!p.validity.valid)return;r(y)};return{defaultValue:t.get(),value:n,set:a,handleChange:s,clear:()=>a(t.get()),label:{props:{htmlFor:e.name}},input:{props:{id:e.name,name:e.name,value:o,onChange:s}},changed:!m.compare(n,t.get()),unchanged:m.compare(n,t.get()),empty:m.isEmpty(n)}}import M from"react";function xe(e){let[t,n]=M.useState("idle"),r=(a)=>{if(a.preventDefault(),t==="idle")n("exiting")},o=(a)=>{if(a.animationName!==e.animation)return;e.action(),n("gone")},i=t==="exiting"?{"data-animation":e.animation,onAnimationEnd:o}:void 0;return{visible:t!=="gone",attach:i,trigger:r}}import{useMemo as H,useState as F}from"react";var k;((r)=>{r.idle="idle";r.selected="selected";r.error="error"})(k||={});function Ue(e,t){let n=t?.maxSizeBytes??Number.POSITIVE_INFINITY,[r,o]=F(0),[i,a]=F("idle"),[s,l]=F(null);function p(f){let x=f.currentTarget.files;if(!x?.[0])return;let h=x[0];if(h.size>n){a("error");return}if(!t.mimeTypes.includes(h.type)){a("error");return}return l(h),a("selected"),h}function y(){o((f)=>f+1),l(null),a("idle")}let T=H(()=>s?URL.createObjectURL(s):void 0,[s]);function L(f){return f.some((x)=>x===i)}let U={actions:{selectFile:p,clearFile:y},input:{props:{id:e,name:e,multiple:!1,accept:t.mimeTypes.join(",")},key:r},label:{props:{htmlFor:e}},matches:L};if(i==="idle")return{data:null,isError:!1,isIdle:!0,isSelected:!1,state:i,...U};if(i==="selected")return{data:s,isError:!1,isIdle:!1,isSelected:!0,preview:T,state:i,...U};return{data:null,isError:!0,isIdle:!1,isSelected:!1,state:i,...U}}import{useCallback as W,useMemo as q,useRef as X}from"react";import{useEffect as O}from"react";import{tinykeys as P}from"tinykeys";function E(e,t){let n=t?.enabled??!0;O(()=>{if(!n)return;let r=P(window,e);return()=>r()},[e,n])}function Ce(e){let t=X(null),n=W(()=>{if(t.current)t.current.focus()},[]);return E({[e]:n}),q(()=>({ref:t}),[])}import{useCallback as K,useRef as Y}from"react";import{useState as B}from"react";function D({name:e,defaultValue:t=!1}){let[n,r]=B(t);return{on:n,off:!n,enable:()=>r(!0),disable:()=>r(!1),toggle:()=>r((p)=>!p),props:{controller:{"aria-expanded":n?"true":"false","aria-controls":e,role:"button",tabIndex:0},target:{id:e,role:"region","aria-hidden":n?"false":"true"}}}}function C(e){let{on:t,off:n,enable:r,disable:o,toggle:i,props:a,...s}=e;return{toggle:{on:t,off:n,enable:r,disable:o,toggle:i,props:a},rest:s}}function Me(e){let t=e?.enabled??!0,n=D({name:"_internal"}),r=Y(null),o=typeof window<"u"&&"PointerEvent"in window?"pointerenter":"mouseenter",i=typeof window<"u"&&"PointerEvent"in window?"pointerleave":"mouseleave";return{attach:{ref:K((s)=>{let l=r.current;if(l)l.removeEventListener(o,n.enable),l.removeEventListener(i,n.disable);if(r.current=s,s&&t)s.addEventListener(o,n.enable),s.addEventListener(i,n.disable)},[o,i,t,n.enable,n.disable])},hovering:n.on&&t}}import{useCallback as $}from"react";function Oe(){return{onKeyDown:$((t)=>{if(!t.metaKey||t.key!=="Enter")return;t.preventDefault(),t.currentTarget.form?.requestSubmit()},[])}}import{useState as v}from"react";class d{static EMPTY=void 0;value=d.EMPTY;constructor(e){this.value=d.isEmpty(e)?d.EMPTY:e}get(){return this.value}isEmpty(){return d.isEmpty(this.value)}static isEmpty(e){return e===void 0||e===null||Number.isNaN(e)}static compare(e,t){if(d.isEmpty(e)&&d.isEmpty(t))return!0;return e===t}}function Be(e){let t=new d(e.defaultValue),[n,r]=v(t.get()),[o,i]=v(d.isEmpty(t.get())?"":String(t.get())),a=(l)=>{let p=new d(l).get();r(p),i(d.isEmpty(p)?"":String(p))},s=(l)=>{let p=l.currentTarget,y=p.value;if(i(y),y==="")return r(d.EMPTY);let T=p.valueAsNumber;if(!Number.isFinite(T))return;if(!l.currentTarget.validity.valid)return;r(T)};return{defaultValue:t.get(),value:n,set:a,handleChange:s,clear:()=>a(t.get()),label:{props:{htmlFor:e.name}},input:{props:{id:e.name,name:e.name,value:o,onChange:s}},changed:!d.compare(n,t.get()),unchanged:d.compare(n,t.get()),empty:d.isEmpty(n)}}import{useEffect as _}from"react";function V(e=!0){_(()=>{if(typeof document>"u")return;let t=document.body.style.overflow;if(e)document.body.style.overflow="hidden";return()=>{document.body.style.overflow=t}},[e])}import{useState as J}from"react";class u{static EMPTY=void 0;value=u.EMPTY;constructor(e){this.value=u.isEmpty(e)?u.EMPTY:e}get(){return this.value}isEmpty(){return u.isEmpty(this.value)}static isEmpty(e){return e===void 0||e===""||e===null}static compare(e,t){if(u.isEmpty(e)&&u.isEmpty(t))return!0;return e===t}}function ze(e){let t=new u(e.defaultValue),[n,r]=J(t.get()),o=(a)=>r(new u(a).get()),i=(a)=>o(a.currentTarget.value);return{defaultValue:t.get(),value:n,set:o,handleChange:i,clear:()=>o(t.get()),label:{props:{htmlFor:e.name}},input:{props:{id:e.name,name:e.name,value:u.isEmpty(n)?"":n,onChange:i}},changed:!u.compare(n,t.get()),unchanged:u.compare(n,t.get()),empty:u.isEmpty(n)}}function g(){}import{jsx as G}from"react/jsx-runtime";function dt(e){let t=e.locked??!1,{toggle:n,rest:r}=C(e),o=Z(null);return z(()=>{if(e.on)o.current?.showModal();else o.current?.close()},[e.on]),E({Escape:t?g:n.disable}),V(e.on),S(o,t?g:n.disable),G("dialog",{ref:o,tabIndex:0,"aria-modal":"true","data-disp":e.on?"flex":"none","data-dir":"column","data-mx":"auto","data-p":"5","data-position":"fixed","data-z":"2","data-bg":"neutral-900","data-br":"xs","data-backdrop":"stronger","data-animation":"grow-fade-in",...r})}var gt={email:{inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:"false"},password:{new:{autoComplete:"new-password"},current:{autoComplete:"current-password"}},off:{autoComplete:"off",spellCheck:!1}};class N{static async copy(e){let t=e.onSuccess??g;if(!navigator.clipboard)return;await navigator.clipboard.writeText(e.text),t()}}import Q from"js-cookie";class ee{static extractFrom(e){return e.headers.get("cookie")??""}static set(e,t){Q.set(e,t)}}class te{static fromRevision(e){return{"if-match":String(e)}}}function Rt(e){return function(){for(let t of e)t()}}class ne{static allUnchanged(e){return e.every((t)=>t.unchanged)}static allEmpty(e){return e.every((t)=>t.empty)}static anyEmpty(e){return e.some((t)=>t.empty)}static anyUnchanged(e){return e.some((t)=>t.unchanged)}static anyChanged(e){return e.some((t)=>t.changed)}}class re{static input(e){let t=e.required??!0;if(e.min&&!e.max)return{pattern:`.{${e.min}}`,required:t};if(e.min&&e.max)return{pattern:`.{${e.min},${e.max}}`,required:t};if(!e.min&&e.max)return{pattern:`.{,${e.max}}`,required:t};return{pattern:void 0,required:t}}static textarea(e){let t=e.required??!0;if(e.min&&!e.max)return{minLength:e.min,required:t};if(e.min&&e.max)return{minLength:e.min,maxLength:e.max,required:t};if(!e.min&&e.max)return{maxLength:e.max,required:t};return{required:t}}static exact(e){let t=e.required??!0;return{pattern:e.text,required:t}}static date={min:{today:()=>new Date().toISOString().split("T")[0],tomorrow:()=>{let e=new Date;return new Date(e.setDate(e.getDate()+1)).toISOString().split("T")[0]},yesterday:()=>{let e=new Date;return new Date(e.setDate(e.getDate()-1)).toISOString().split("T")[0]}},max:{today:()=>new Date().toISOString().split("T")[0],tomorrow:()=>{let e=new Date;return new Date(e.setDate(e.getDate()+1)).toISOString().split("T")[0]},yesterday:()=>{let e=new Date;return new Date(e.setDate(e.getDate()-1)).toISOString().split("T")[0]}}}}function Ct(){if(typeof window>"u")return;return window}import{polishPlurals as oe}from"polish-plurals";function I(e){if(e.language==="en"){let t=e.plural??`${e.singular}s`;if(e.value===1)return e.singular;return t}if(e.language==="pl"){let t=e.value??1;if(t===1)return e.singular;return oe(e.singular,String(e.plural),String(e.genitive),t)}return console.warn(`[@bgord/frontend] missing pluralization function for language: ${e.language}.`),e.singular}function Lt(e=12){return{times(t){let n=e*t,r={height:{height:c(n)},minHeight:{minHeight:c(n)},maxHeight:{maxHeight:c(n)},width:{width:c(n)},minWidth:{minWidth:c(n)},maxWidth:{maxWidth:c(n)},square:{height:c(n),width:c(n)}},o={height:{style:{height:c(n)}},minHeight:{style:{minHeight:c(n)}},maxHeight:{style:{maxHeight:c(n)}},width:{style:{width:c(n)}},minWidth:{style:{minWidth:c(n)}},maxWidth:{style:{maxWidth:c(n)}},square:{style:{height:c(n),width:c(n)}}};return{px:c(n),raw:n,style:o,...r}}}}function c(e){return`${e}px`}class ie{static get(){return{"time-zone-offset":new Date().getTimezoneOffset().toString()}}}import{createContext as ae,use as b,useCallback as se}from"react";var R=ae({translations:{},language:"en",supportedLanguages:{en:"en"}});function Ot(){let e=b(R);if(e===void 0)throw Error("useTranslations must be used within the TranslationsContext");return se((n,r)=>{let o=e.translations[n];if(!o)return console.warn(`[@bgord/ui] missing translation for key: ${n}`),n;if(!r)return o;return Object.entries(r).reduce((i,[a,s])=>{let l=new RegExp(`{{${a}}}`,"g");return i.replace(l,String(s))},o)},[e.translations])}function le(){let e=b(R);if(e===void 0)throw Error("useLanguage must be used within the TranslationsContext");return e.language}function Pt(){let e=b(R);if(e===void 0)throw Error("useSupportedLanguages must be used within the TranslationsContext");return e.supportedLanguages}function Wt(){let e=le();return(t)=>I({...t,language:e})}class pe{static fromRevision(e){return{"if-match":`W/${e}`}}}export{Ot as useTranslations,D as useToggle,ze as useTextField,Pt as useSupportedLanguages,E as useShortcuts,V as useScrollLock,Wt as usePluralize,Be as useNumberField,Oe as useMetaEnterSubmit,le as useLanguage,Me as useHover,Ce as useFocusKeyboardShortcut,Ue as useFile,xe as useExitAction,Te as useDateField,S as useClickOutside,I as pluralize,g as noop,Ct as getSafeWindow,C as extractUseToggle,Rt as exec,pe as WeakETag,k as UseFileState,R as TranslationsContext,ie as TimeZoneOffset,u as TextField,Lt as Rhythm,d as NumberField,re as Form,ne as Fields,te as ETag,dt as Dialog,m as DateField,ee as Cookies,N as Clipboard,gt as Autocomplete};
1
+ import{useEffect as Z,useRef as G}from"react";import{useEffect as A}from"react";function S(e,t){A(()=>{if(typeof document>"u")return;function n(r){let o=e.current;if(!o)return;if(o.contains(r.target))if(r.target===o){let{left:i,right:a,top:s,bottom:l}=o.getBoundingClientRect(),p=r instanceof MouseEvent?r.clientX:r.touches[0].clientX,y=r instanceof MouseEvent?r.clientY:r.touches[0].clientY;if(p>=i&&p<=a&&y>=s&&y<=l)return}else return;t(r)}return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t])}import{useState as w}from"react";class m{static EMPTY=void 0;value=m.EMPTY;constructor(e){this.value=m.isEmpty(e)?m.EMPTY:e}get(){return this.value}isEmpty(){return m.isEmpty(this.value)}static isEmpty(e){return e===void 0||e===null||e===""}static compare(e,t){if(m.isEmpty(e)&&m.isEmpty(t))return!0;return e===t}}function fe(e){let t=new m(e.defaultValue),[n,r]=w(t.get()),[o,i]=w(m.isEmpty(t.get())?"":t.get()),a=(l)=>{let p=new m(l).get();r(p),i(m.isEmpty(p)?"":String(p))},s=(l)=>{let p=l.currentTarget,y=p.value;if(i(y),y==="")return r(m.EMPTY);if(!/^\d{4}-\d{2}-\d{2}$/.test(y))return;if(!p.validity.valid)return;r(y)};return{defaultValue:t.get(),value:n,set:a,handleChange:s,clear:()=>a(t.get()),label:{props:{htmlFor:e.name}},input:{props:{id:e.name,name:e.name,value:o,onChange:s}},changed:!m.compare(n,t.get()),unchanged:m.compare(n,t.get()),empty:m.isEmpty(n)}}import M from"react";function he(e){let[t,n]=M.useState("idle"),r=(a)=>{if(a.preventDefault(),t==="idle")n("exiting")},o=async(a)=>{if(a.animationName!==e.animation)return;n("gone"),await e.action()},i=t==="exiting"?{"data-animation":e.animation,onAnimationEnd:o}:void 0;return{visible:t!=="gone",attach:i,trigger:r}}import{useMemo as H,useState as F}from"react";var k;((r)=>{r.idle="idle";r.selected="selected";r.error="error"})(k||={});function Fe(e,t){let n=t?.maxSizeBytes??Number.POSITIVE_INFINITY,[r,o]=F(0),[i,a]=F("idle"),[s,l]=F(null);function p(f){let x=f.currentTarget.files;if(!x?.[0])return;let h=x[0];if(h.size>n){a("error");return}if(!t.mimeTypes.includes(h.type)){a("error");return}return l(h),a("selected"),h}function y(){o((f)=>f+1),l(null),a("idle")}let T=H(()=>s?URL.createObjectURL(s):void 0,[s]);function L(f){return f.some((x)=>x===i)}let U={actions:{selectFile:p,clearFile:y},input:{props:{id:e,name:e,multiple:!1,accept:t.mimeTypes.join(",")},key:r},label:{props:{htmlFor:e}},matches:L};if(i==="idle")return{data:null,isError:!1,isIdle:!0,isSelected:!1,state:i,...U};if(i==="selected")return{data:s,isError:!1,isIdle:!1,isSelected:!0,preview:T,state:i,...U};return{data:null,isError:!0,isIdle:!1,isSelected:!1,state:i,...U}}import{useCallback as W,useMemo as q,useRef as X}from"react";import{useEffect as O}from"react";import{tinykeys as P}from"tinykeys";function E(e,t){let n=t?.enabled??!0;O(()=>{if(!n)return;let r=P(window,e);return()=>r()},[e,n])}function ve(e){let t=X(null),n=W(()=>{if(t.current)t.current.focus()},[]);return E({[e]:n}),q(()=>({ref:t}),[])}import{useCallback as K,useRef as Y}from"react";import{useState as B}from"react";function D({name:e,defaultValue:t=!1}){let[n,r]=B(t);return{on:n,off:!n,enable:()=>r(!0),disable:()=>r(!1),toggle:()=>r((p)=>!p),props:{controller:{"aria-expanded":n?"true":"false","aria-controls":e,role:"button",tabIndex:0},target:{id:e,role:"region","aria-hidden":n?"false":"true"}}}}function C(e){let{on:t,off:n,enable:r,disable:o,toggle:i,props:a,...s}=e;return{toggle:{on:t,off:n,enable:r,disable:o,toggle:i,props:a},rest:s}}function He(e){let t=e?.enabled??!0,n=D({name:"_internal"}),r=Y(null),o=typeof window<"u"&&"PointerEvent"in window?"pointerenter":"mouseenter",i=typeof window<"u"&&"PointerEvent"in window?"pointerleave":"mouseleave";return{attach:{ref:K((s)=>{let l=r.current;if(l)l.removeEventListener(o,n.enable),l.removeEventListener(i,n.disable);if(r.current=s,s&&t)s.addEventListener(o,n.enable),s.addEventListener(i,n.disable)},[o,i,t,n.enable,n.disable])},hovering:n.on&&t}}import{useCallback as $}from"react";function Pe(){return{onKeyDown:$((t)=>{if(!t.metaKey||t.key!=="Enter")return;t.preventDefault(),t.currentTarget.form?.requestSubmit()},[])}}import{useState as v}from"react";class d{static EMPTY=void 0;value=d.EMPTY;constructor(e){this.value=d.isEmpty(e)?d.EMPTY:e}get(){return this.value}isEmpty(){return d.isEmpty(this.value)}static isEmpty(e){return e===void 0||e===null||Number.isNaN(e)}static compare(e,t){if(d.isEmpty(e)&&d.isEmpty(t))return!0;return e===t}}function Ke(e){let t=new d(e.defaultValue),[n,r]=v(t.get()),[o,i]=v(d.isEmpty(t.get())?"":String(t.get())),a=(l)=>{let p=new d(l).get();r(p),i(d.isEmpty(p)?"":String(p))},s=(l)=>{let p=l.currentTarget,y=p.value;if(i(y),y==="")return r(d.EMPTY);let T=p.valueAsNumber;if(!Number.isFinite(T))return;if(!l.currentTarget.validity.valid)return;r(T)};return{defaultValue:t.get(),value:n,set:a,handleChange:s,clear:()=>a(t.get()),label:{props:{htmlFor:e.name}},input:{props:{id:e.name,name:e.name,value:o,onChange:s}},changed:!d.compare(n,t.get()),unchanged:d.compare(n,t.get()),empty:d.isEmpty(n)}}import{useEffect as _}from"react";function V(e=!0){_(()=>{if(typeof document>"u")return;let t=document.body.style.overflow;if(e)document.body.style.overflow="hidden";return()=>{document.body.style.overflow=t}},[e])}import{useEffect as J,useState as j}from"react";class u{static EMPTY=void 0;value=u.EMPTY;constructor(e){this.value=u.isEmpty(e)?u.EMPTY:e}get(){return this.value}isEmpty(){return u.isEmpty(this.value)}static isEmpty(e){return e===void 0||e===""||e===null}static compare(e,t){if(u.isEmpty(e)&&u.isEmpty(t))return!0;return e===t}}function Ze(e){let t=new u(e.defaultValue),[n,r]=j(t.get()),o=(a)=>r(new u(a).get()),i=(a)=>o(a.currentTarget.value);return J(()=>{o(t.get())},[e.defaultValue]),{defaultValue:t.get(),value:n,set:o,handleChange:i,clear:()=>o(t.get()),label:{props:{htmlFor:e.name}},input:{props:{id:e.name,name:e.name,value:u.isEmpty(n)?"":n,onChange:i}},changed:!u.compare(n,t.get()),unchanged:u.compare(n,t.get()),empty:u.isEmpty(n)}}function g(){}import{jsx as N}from"react/jsx-runtime";function ut(e){let t=e.locked??!1,{toggle:n,rest:r}=C(e),o=G(null);return Z(()=>{if(e.on)o.current?.showModal();else o.current?.close()},[e.on]),E({Escape:t?g:n.disable}),V(e.on),S(o,t?g:n.disable),N("dialog",{ref:o,tabIndex:0,"aria-modal":"true","data-disp":e.on?"flex":"none","data-dir":"column","data-mx":"auto","data-p":"5","data-position":"fixed","data-z":"2","data-bg":"neutral-900","data-br":"xs","data-backdrop":"stronger","data-animation":"grow-fade-in",...r})}var xt={email:{inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:"false"},password:{new:{autoComplete:"new-password"},current:{autoComplete:"current-password"}},off:{autoComplete:"off",spellCheck:!1}};class Q{static async copy(e){let t=e.onSuccess??g;if(!navigator.clipboard)return;await navigator.clipboard.writeText(e.text),t()}}import ee from"js-cookie";class te{static extractFrom(e){return e.headers.get("cookie")??""}static set(e,t){ee.set(e,t)}}class ne{static fromRevision(e){return{"if-match":String(e)}}}function St(e){return function(){for(let t of e)t()}}class re{static allUnchanged(e){return e.every((t)=>t.unchanged)}static allEmpty(e){return e.every((t)=>t.empty)}static anyEmpty(e){return e.some((t)=>t.empty)}static anyUnchanged(e){return e.some((t)=>t.unchanged)}static anyChanged(e){return e.some((t)=>t.changed)}}class oe{static input(e){let t=e.required??!0;if(e.min&&!e.max)return{pattern:`.{${e.min}}`,required:t};if(e.min&&e.max)return{pattern:`.{${e.min},${e.max}}`,required:t};if(!e.min&&e.max)return{pattern:`.{,${e.max}}`,required:t};return{pattern:void 0,required:t}}static textarea(e){let t=e.required??!0;if(e.min&&!e.max)return{minLength:e.min,required:t};if(e.min&&e.max)return{minLength:e.min,maxLength:e.max,required:t};if(!e.min&&e.max)return{maxLength:e.max,required:t};return{required:t}}static exact(e){let t=e.required??!0;return{pattern:e.text,required:t}}static date={min:{today:()=>new Date().toISOString().split("T")[0],tomorrow:()=>{let e=new Date;return new Date(e.setDate(e.getDate()+1)).toISOString().split("T")[0]},yesterday:()=>{let e=new Date;return new Date(e.setDate(e.getDate()-1)).toISOString().split("T")[0]}},max:{today:()=>new Date().toISOString().split("T")[0],tomorrow:()=>{let e=new Date;return new Date(e.setDate(e.getDate()+1)).toISOString().split("T")[0]},yesterday:()=>{let e=new Date;return new Date(e.setDate(e.getDate()-1)).toISOString().split("T")[0]}}}}function vt(){if(typeof window>"u")return;return window}import{polishPlurals as ie}from"polish-plurals";function I(e){if(e.language==="en"){let t=e.plural??`${e.singular}s`;if(e.value===1)return e.singular;return t}if(e.language==="pl"){let t=e.value??1;if(t===1)return e.singular;return ie(e.singular,String(e.plural),String(e.genitive),t)}return console.warn(`[@bgord/frontend] missing pluralization function for language: ${e.language}.`),e.singular}function At(e=12){return{times(t){let n=e*t,r={height:{height:c(n)},minHeight:{minHeight:c(n)},maxHeight:{maxHeight:c(n)},width:{width:c(n)},minWidth:{minWidth:c(n)},maxWidth:{maxWidth:c(n)},square:{height:c(n),width:c(n)}},o={height:{style:{height:c(n)}},minHeight:{style:{minHeight:c(n)}},maxHeight:{style:{maxHeight:c(n)}},width:{style:{width:c(n)}},minWidth:{style:{minWidth:c(n)}},maxWidth:{style:{maxWidth:c(n)}},square:{style:{height:c(n),width:c(n)}}};return{px:c(n),raw:n,style:o,...r}}}}function c(e){return`${e}px`}class ae{static get(){return{"time-zone-offset":new Date().getTimezoneOffset().toString()}}}import{createContext as se,use as b,useCallback as le}from"react";var R=se({translations:{},language:"en",supportedLanguages:{en:"en"}});function Pt(){let e=b(R);if(e===void 0)throw Error("useTranslations must be used within the TranslationsContext");return le((n,r)=>{let o=e.translations[n];if(!o)return console.warn(`[@bgord/ui] missing translation for key: ${n}`),n;if(!r)return o;return Object.entries(r).reduce((i,[a,s])=>{let l=new RegExp(`{{${a}}}`,"g");return i.replace(l,String(s))},o)},[e.translations])}function pe(){let e=b(R);if(e===void 0)throw Error("useLanguage must be used within the TranslationsContext");return e.language}function Wt(){let e=b(R);if(e===void 0)throw Error("useSupportedLanguages must be used within the TranslationsContext");return e.supportedLanguages}function qt(){let e=pe();return(t)=>I({...t,language:e})}class ce{static fromRevision(e){return{"if-match":`W/${e}`}}}export{Pt as useTranslations,D as useToggle,Ze as useTextField,Wt as useSupportedLanguages,E as useShortcuts,V as useScrollLock,qt as usePluralize,Ke as useNumberField,Pe as useMetaEnterSubmit,pe as useLanguage,He as useHover,ve as useFocusKeyboardShortcut,Fe as useFile,he as useExitAction,fe as useDateField,S as useClickOutside,I as pluralize,g as noop,vt as getSafeWindow,C as extractUseToggle,St as exec,ce as WeakETag,k as UseFileState,R as TranslationsContext,ae as TimeZoneOffset,u as TextField,At as Rhythm,d as NumberField,oe as Form,re as Fields,ne as ETag,ut as Dialog,m as DateField,te as Cookies,Q as Clipboard,xt as Autocomplete};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/ui",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -23,10 +23,10 @@
23
23
  "access": "public"
24
24
  },
25
25
  "devDependencies": {
26
- "@biomejs/biome": "2.3.0",
26
+ "@biomejs/biome": "2.3.2",
27
27
  "@commitlint/cli": "20.1.0",
28
28
  "@commitlint/config-conventional": "20.0.0",
29
- "@happy-dom/global-registrator": "20.0.8",
29
+ "@happy-dom/global-registrator": "20.0.10",
30
30
  "@testing-library/dom": "10.4.1",
31
31
  "@testing-library/jest-dom": "6.9.1",
32
32
  "@testing-library/react": "16.3.0",
@@ -36,8 +36,8 @@
36
36
  "@types/react": "19.2.2",
37
37
  "@types/react-dom": "19.2.2",
38
38
  "cspell": "9.2.2",
39
- "knip": "5.66.3",
40
- "lefthook": "2.0.1",
39
+ "knip": "5.66.4",
40
+ "lefthook": "2.0.2",
41
41
  "only-allow": "1.2.1",
42
42
  "shellcheck": "4.1.0"
43
43
  },