visits-style 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dialog/index.d.ts +2 -2
- package/dist/components/Toast/types.d.ts +4 -6
- package/dist/elements/Spinner/index.d.ts +1 -3
- package/dist/elements/index.d.ts +1 -1
- package/dist/forms/Select/index.d.ts +8 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +120 -111
- package/package.json +1 -1
|
@@ -21,9 +21,9 @@ export interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
21
21
|
* 未指定の場合は、スタイルを全部外した状態で表示されます
|
|
22
22
|
* */
|
|
23
23
|
size?: 'small' | 'medium' | 'large';
|
|
24
|
-
/**
|
|
24
|
+
/** openの値を実際に変更するコールバック */
|
|
25
25
|
onOpenChange?: (open: boolean) => void;
|
|
26
|
-
/** モーダルのtransition exit
|
|
26
|
+
/** モーダルのtransition exitが完了した時に発火されるコールバック */
|
|
27
27
|
onExited?: () => void;
|
|
28
28
|
/**
|
|
29
29
|
* モーダルの背景からのpaddingを指定します。
|
|
@@ -48,15 +48,13 @@ export interface ToasterProps {
|
|
|
48
48
|
max?: number;
|
|
49
49
|
ListItem?: FunctionComponent<ToastItemProps>;
|
|
50
50
|
/**
|
|
51
|
-
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)
|
|
52
|
-
* ただし、loading状態はspinnerを表示します
|
|
51
|
+
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)
|
|
53
52
|
*/
|
|
54
|
-
icons?: Record<
|
|
53
|
+
icons?: Record<ToastType, ReactNode>;
|
|
55
54
|
}
|
|
56
55
|
export interface ToastContextType {
|
|
57
56
|
/**
|
|
58
|
-
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)
|
|
59
|
-
* ただし、loading状態はspinnerを表示します
|
|
57
|
+
* 表示するToastのタイプに使うアイコンを指定(未指定の場合はアイコンは表示されません)
|
|
60
58
|
*/
|
|
61
|
-
icons?: Record<
|
|
59
|
+
icons?: Record<ToastType, ReactNode>;
|
|
62
60
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
/** サイズ */
|
|
4
|
-
size?: number;
|
|
5
3
|
label?: string;
|
|
6
4
|
}
|
|
7
|
-
export default function Spinner({
|
|
5
|
+
export default function Spinner({ label, ...rest }: Props): import("react").JSX.Element;
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Base } from './Base';
|
|
1
|
+
export { default as Base, element, type BaseProps } from './Base';
|
|
2
2
|
export { default as Skeleton } from './Skeleton';
|
|
3
3
|
export { default as Button, type ButtonProps, varientButton } from './Button';
|
|
4
4
|
export { default as ButtonGroup } from './Button/ButtonGroup';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { Props as PopoverProps } from '../../components/Popover';
|
|
2
3
|
type OptionType<T> = {
|
|
3
4
|
value: T;
|
|
4
5
|
label: string;
|
|
@@ -29,14 +30,20 @@ export interface Props<T> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
29
30
|
override?: boolean;
|
|
30
31
|
/** クリアボタン、矢印アイコンの領域のdivのスタイルのカスタム指定 */
|
|
31
32
|
buttonAreaStyle?: string;
|
|
33
|
+
/** ボタンの文字のスタイルのカスタム指定 */
|
|
34
|
+
labelStyle?: string;
|
|
32
35
|
/** section(stringのみで区域を区切った場合)を使うときのスタイルのカスタム指定 */
|
|
33
36
|
sectionLabelStyle?: string;
|
|
34
37
|
/** 各選択肢のスタイルのカスタム指定 */
|
|
35
38
|
optionStyle?: string;
|
|
39
|
+
/** Popoverのスタイルのカスタム指定 */
|
|
40
|
+
popoverStyle?: string;
|
|
36
41
|
/** 選択を取り消すボタンのaria-label */
|
|
37
42
|
clearLabelText?: string;
|
|
43
|
+
/** Popoverの表示位置 */
|
|
44
|
+
popoverPosition?: PopoverProps['position'];
|
|
38
45
|
}
|
|
39
|
-
export default function Select<T = unknown>({ className, placeholder, options, error, disabled, value, maxHeight, arrowIcon, closeIcon, checkIcon, onChange, onClear, renderItem, sectionLabelStyle, buttonAreaStyle, clearLabelText, optionStyle, ...rest }: Props<T>): import("react").JSX.Element;
|
|
46
|
+
export default function Select<T = unknown>({ className, placeholder, options, error, disabled, value, maxHeight, arrowIcon, closeIcon, checkIcon, onChange, onClear, renderItem, sectionLabelStyle, buttonAreaStyle, clearLabelText, optionStyle, popoverStyle, popoverPosition, labelStyle, ...rest }: Props<T>): import("react").JSX.Element;
|
|
40
47
|
interface SelectItemProps<T> {
|
|
41
48
|
className?: string;
|
|
42
49
|
value: T;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("clsx");c=s(c,1);let l=require("tailwind-merge"),u=require("react"),d=require("react/jsx-runtime"),f=require("@floating-ui/react"),p=require("react-dom");var m=c.default;function h(e,t){return t?(0,l.twMerge)(e,t):e}function g({as:e,classList:t=[],className:n,override:r,...i}){let a=(0,u.useMemo)(()=>r?n:h(m(t),n),[t,n,r]);return(0,u.createElement)(e||`div`,{className:a,...i})}function _(e){return(0,d.jsx)(g,{as:`label`,classList:[`leading-none peer-disabled:opacity-70`],...e})}function v({label:e,children:t,required:n,htmlFor:r,error:i,help:a,helpBefore:o,innerClass:s,...c}){let l=(0,u.useMemo)(()=>m(`font-medium`,n?`after:content-["*"] after:text-danger after:text-sm after:pl-0.5`:``),[n]);return(0,d.jsxs)(g,{classList:`flex flex-col space-y-2`,...c,children:[e?(0,d.jsx)(_,{className:l,htmlFor:r,children:e}):null,a&&o?(0,d.jsx)(`p`,{className:`text-xs text-muted pb-2`,children:a}):null,(0,d.jsx)(`div`,{className:s,children:y(t,!!i)}),a&&!o&&!i?(0,d.jsx)(`p`,{className:`text-xs text-muted`,children:a}):null,i?(0,d.jsx)(`p`,{className:`text-xs text-danger`,children:i}):null]})}function y(e,t){let n=u.Children.count(e);if(!n)return null;if(n===1)return(0,u.cloneElement)(e,{error:t});let r=u.Children.toArray(e);return r[0]=(0,u.cloneElement)(r[0],{error:t}),r}function b({error:e,...t}){return(0,d.jsx)(g,{as:`fieldset`,classList:[`flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted`,`[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none`,e?`border-danger hover:border-danger-fore`:`border-input`],...t})}function x({type:e,error:t,...n}){return(0,d.jsx)(g,{as:`input`,type:e,classList:[`flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted`,`disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2`,t?`border-danger hover:border-danger-fore focus-visible:ring-danger`:`border-input not-disabled:hover:border-input-fore focus-visible:ring-ring`,e===`file`?`file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground`:null],...n})}function S({error:e,...t}){return(0,d.jsx)(g,{as:`textarea`,classList:[`flex rounded-md border bg-background px-3 py-2 w-full`,`disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring`,e?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`],...t})}function C(){return(0,d.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`30`,height:`30`,viewBox:`0 0 30 30`,children:(0,d.jsx)(`rect`,{width:`20`,height:`3`,y:`13.5`,x:`4.5`,fill:`currentColor`,stroke:`none`,rx:`2`})})}function w({checked:e,indeterminate:t,id:n,name:r,onChange:i,value:a,checkIcon:o,error:s,...c}){let l=()=>{c.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`checkbox`,id:n||r,classList:[`inline-flex justify-center items-center border w-4.5 h-4.5 rounded`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,{"border-danger hover:border-danger-fore":s,"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":!s&&e,"border-input not-disabled:hover:border-input-fore":!s&&!e}],onClick:l,"aria-checked":e,...c,children:[e?o:null,t&&!e?(0,d.jsx)(C,{}):null,(0,d.jsx)(`input`,{type:`checkbox`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:l,disabled:c.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}var T=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?u.useLayoutEffect:u.useEffect;function E({children:e,container:t,disabled:n}){let[r,i]=(0,u.useState)(null);return T(()=>{if(!t){let e=document.getElementById(`visits-style-portals`);return e||(e=document.createElement(`div`),e.id=`visits-style-portals`,document.body.appendChild(e)),i(e)}i(t)},[t]),n||!r?null:(0,p.createPortal)(e,r)}function D(e){e&&(e.stopPropagation(),e.preventDefault())}var O={open:150,close:75};function k({ref:e,position:t,label:n,children:r,disabled:i,offset:a={x:0,y:6},onOpen:o,onClose:s,onManualClose:c,timeout:l=O,override:p,zIndex:m=9996,role:h,...g}){let[_,v]=(0,u.useState)(!1),y=(0,f.useId)(),b=(0,u.useRef)(o),x=(0,u.useRef)(s),{refs:S,floatingStyles:C,context:w}=(0,f.useFloating)({nodeId:y,placement:t,middleware:[(0,f.shift)(),(0,f.flip)({fallbackAxisSideDirection:`end`}),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],open:_,onOpenChange:e=>{e?b.current?.(S.reference.current,S.floating.current):x.current?.(S.reference.current,S.floating.current),v(e)},whileElementsMounted:f.autoUpdate}),{isMounted:T,styles:k}=(0,f.useTransitionStyles)(w,{duration:l,initial({side:e}){let t=``;return t=e===`top`?`translateY(5%) scale(0.95)`:e===`bottom`?`translateY(-5%) scale(0.95)`:e===`left`?`translateX(5%) scale(0.95)`:`translateX(-5%) scale(0.95)`,{opacity:0,transform:t}}}),j=(0,u.useCallback)(e=>{if(D(e),c)return c();v(!1),x.current?.(S.reference.current,S.floating.current)},[c]);(0,u.useEffect)(()=>{if(i&&_)return v(!1)},[i,_]),(0,u.useImperativeHandle)(e,()=>({open:()=>{v(!0),b.current?.(S.reference.current,S.floating.current)},close:()=>{v(!1),x.current?.(S.reference.current,S.floating.current)}}),[]);let{getFloatingProps:M,getReferenceProps:N}=(0,f.useInteractions)([(0,f.useClick)(w,{enabled:!i})]);return b.current=o,x.current=s,(0,d.jsxs)(d.Fragment,{children:[(0,u.cloneElement)(u.Children.only(n),N({ref:S.setReference,tabIndex:0,role:`button`,"aria-expanded":_,disabled:i,onClick:D})),(0,d.jsx)(E,{disabled:i||!T,children:(0,d.jsx)(f.FloatingOverlay,{"data-testid":`vs-popover-shadow`,onClick:j,style:{zIndex:m},autoFocus:!0,children:(0,d.jsx)(`div`,{role:h||`region`,ref:S.setFloating,style:C,children:(0,d.jsx)(A,{override:p,styles:k,...M({...g,onClick:D}),children:r})})})})]})}function A({override:e,styles:t,style:n={},...r}){return(0,d.jsx)(g,{classList:[`z-20 w-auto h-auto outline-none transition-transform ease-in-out`,e?null:`border border-accent rounded-md shadow-lg p-1 bg-background`],style:{...t,...n},...r})}function j({className:e,placeholder:t=``,options:n=[],error:r,disabled:i,value:a,maxHeight:o=408,arrowIcon:s,closeIcon:c,checkIcon:l,onChange:f,onClear:p,renderItem:m,sectionLabelStyle:h,buttonAreaStyle:_,clearLabelText:v,optionStyle:y,...b}){let x=(0,u.useRef)(null),[S,C]=(0,u.useState)(0),w=(0,u.useMemo)(()=>Array.isArray(a),[]),T=(0,u.useCallback)(e=>{f?.(e),w||x.current?.close()},[f,w]),E=(0,u.useCallback)(e=>Array.isArray(a)?a.indexOf(e)>-1:a===e,[a]),D=(0,u.useMemo)(()=>{let e={},t=n.filter(e=>typeof e!=`string`);for(let n=0,r=t.length;n<r;n+=1){let r=t[n];e[`${r.value}`]=r.label}return e},[n]),O=(0,u.useMemo)(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;let e=[...a].sort(),n=[];for(let t=0,r=e.length;t<r;t+=1)n[t]=D[`${e[t]}`]||``;return n.filter(Boolean).join(`,`)||t}return D[`${a}`]||t},[t,a,D]),A=(0,u.useMemo)(()=>a==null?!0:Array.isArray(a)?!a.length:!1,[a]),j=(0,u.useCallback)((e,t)=>m?typeof e==`string`?m(e,{index:t,selected:!1,onChange:()=>{}}):m(e,{index:t,selected:E(e.value),onChange:()=>T(e.value)}):typeof e==`string`?(0,d.jsx)(g,{as:`h5`,classList:[`font-normal py-1 px-2 text-muted`],className:h,children:e},`optionheader-${t}`):(0,d.jsx)(M,{selected:E(e.value),onChange:T,checkIcon:l,className:y,...e},e.label),[m,T,E,h,y,l]);return(0,d.jsx)(k,{label:(0,d.jsxs)(g,{as:`button`,type:`button`,classList:[`flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer`,`disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring`,r?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`],className:e,disabled:i,...b,children:[(0,d.jsx)(g,{as:`span`,classList:[`overflow-hidden text-ellipsis whitespace-nowrap`,A?`text-muted`:`text-text`],children:O}),(0,d.jsxs)(g,{classList:`relative flex items-center space-x-2`,className:_,children:[p&&!A?(0,d.jsx)(`div`,{tabIndex:-1,role:`button`,className:`size-6 p-1.5 rounded hover:bg-accent cursor-pointer`,"aria-label":v,onKeyDown:e=>{(e.key===`Enter`||e.key===`Space`)&&p()},onClick:e=>{e.stopPropagation(),p()},children:c}):null,s]})]}),ref:x,onOpen:e=>C(e?.getBoundingClientRect().width||0),disabled:i,children:(0,d.jsx)(`ul`,{className:`overflow-y-auto flex flex-col`,role:`listbox`,style:{minWidth:S,maxWidth:`calc(100vw - 3rem)`,maxHeight:o},children:n.map(j)})})}function M({className:e,value:t,label:n,selected:r,checkIcon:i,onChange:a}){return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`option`,classList:`flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer`,className:e,"aria-selected":r,onClick:()=>a?.(t),children:[r&&i?i:(0,d.jsx)(`div`,{className:`w-5 h-1 mr-1`}),n]})}function N({checked:e,className:t,id:n,name:r,onChange:i,value:a,error:o,...s}){let c=()=>{s.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`radio`,id:n||r,classList:[`relative inline-flex justify-center items-center border w-4.5 h-4.5 rounded-full`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore`,o?`border-danger`:`border-input`,e?`[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input`:``],className:t,onClick:c,"aria-checked":e,...s,children:[(0,d.jsx)(`i`,{className:`block w-2.5 h-2.5 rounded-full transition-transform`,style:{transform:e?``:`scale(0.8)`,opacity:+!!e}}),(0,d.jsx)(`input`,{type:`radio`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function P({checked:e,onChange:t,value:n,id:r,name:i,error:a,ref:o,...s}){let c=()=>{s.disabled||t?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`switch`,id:r||i,classList:[`inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50`,`w-11`,e?`bg-primary disabled:bg-text`:`bg-input`],onClick:c,"aria-checked":e,"aria-invalid":a,...s,children:[(0,d.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform`,style:{transform:e?`translateX(100%)`:``}}),(0,d.jsx)(`input`,{ref:o,type:`checkbox`,"aria-hidden":`true`,name:i,checked:e,value:n,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function F({header:e,show:t,children:n,timeout:r=300,...i}){let a=(0,u.useRef)(null),o=(0,u.useRef)(0),s=(0,u.useRef)(0),c=(0,u.useRef)(!0);return(0,u.useEffect)(()=>{s.current=r},[r]),T(()=>{if(!a.current)return;if(a.current.style.overflow=`hidden`,a.current.style.opacity=`1`,c.current){c.current=!1,a.current.style.height=t?`auto`:`0px`,t?window.requestAnimationFrame(()=>{a.current&&(o.current=a.current.offsetHeight)}):(window.requestAnimationFrame(()=>{a.current&&(a.current.style.height=`auto`,o.current=a.current.offsetHeight,a.current.style.height=`0px`)}),a.current.style.opacity=`0`);return}t||(a.current.style.height=`${o.current}px`);let e=[];e[0]=window.requestAnimationFrame(()=>{e[1]=window.requestAnimationFrame(()=>{a.current&&(a.current.style.height=`${t?o.current:0}px`,a.current.style.opacity=t?`1`:`0`)})});let n,r=()=>{a.current&&(t?(a.current.style.height=`auto`,a.current.style.overflow=``,a.current.style.opacity=``,window.requestAnimationFrame(()=>{a.current&&(o.current=a.current.offsetHeight)})):a.current.style.height=`0px`)};return s.current===0?r():n=window.setTimeout(r,s.current),()=>{e.forEach(window.cancelAnimationFrame),n&&window.clearTimeout(n)}},[t]),(0,d.jsxs)(`div`,{...i,children:[e,(0,d.jsx)(`div`,{className:`transition-all ease-in-out overflow-hidden`,role:`region`,"aria-hidden":!t,ref:a,style:{transitionDuration:`${r}ms`},children:n})]})}var I=(0,u.forwardRef)(({children:e,position:t=`bottom`,label:n,className:r,timeout:i=150,offset:a={x:0,y:6},clientPoint:o=!1,disabled:s},c)=>{let[l,p]=(0,u.useState)(!1),m=(0,f.useId)(),{refs:h,floatingStyles:g,context:_}=(0,f.useFloating)({nodeId:m,open:l,placement:t,middleware:[(0,f.shift)(),(0,f.flip)(),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],whileElementsMounted:s?void 0:f.autoUpdate,onOpenChange:p}),{getReferenceProps:v,getFloatingProps:y}=(0,f.useInteractions)([(0,f.useHover)(_,{enabled:!s}),(0,f.useClientPoint)(_,{enabled:o})]),{isMounted:b,styles:x}=(0,f.useTransitionStyles)(_,{duration:i,initial:{opacity:0,transform:`scale(0.8)`}});(0,u.useImperativeHandle)(c,()=>({floating:h.floating,reference:h.reference,open:()=>p(!0),close:()=>p(!1)})),(0,u.useEffect)(()=>{s&&p(!1)},[s]);let S=typeof e==`string`?(0,d.jsx)(`span`,{children:e}):e;return(0,d.jsxs)(d.Fragment,{children:[(0,u.cloneElement)(u.Children.only(S),{ref:h.setReference,...v()}),(0,d.jsx)(E,{disabled:s||!b,children:(0,d.jsx)(`div`,{role:`tooltip`,className:`z-9999`,ref:h.setFloating,...y({style:g}),children:(0,d.jsx)(L,{className:r,style:x,children:n})})})]})});I.displayName=`Tooltip`;var L=(0,u.forwardRef)(({className:e,custom:t,...n},r)=>{let i=(0,u.useMemo)(()=>h(m(`relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre`,t?null:`border border-accent rounded shadow-md px-3 py-1 bg-background`),e),[e,t]);return(0,d.jsx)(`div`,{ref:r,className:i,...n})});L.displayName=`TooltipContent`;function R({variant:e,size:t}){return m(`inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto`,{"bg-primary text-inverted hover:bg-primary-fore":!e||e===`primary`,"bg-info text-inverted hover:bg-info-fore":e===`info`,"bg-warn text-inverted hover:bg-warn-fore":e===`warn`,"bg-danger text-inverted hover:bg-danger-fore":e===`danger`,"hover:bg-accent":e===`ghost`,"hover:underline":e===`link`,"border border-input hover:bg-accent":e===`outline`},{"px-2 py-1":!t,"p-1.5":t===`icon`})}function z({size:e,variant:t,className:n,...r}){let i=(0,u.useMemo)(()=>h(R({size:e,variant:t}),n),[e,t,n]);return(0,d.jsx)(`button`,{className:i,type:`button`,...r})}var B={open:150,close:75};function V({open:e,children:t,timeout:n=B,padding:r=`0.85rem`,verticalAlign:i=`center`,closeOnOverlay:a,closeOnEsc:o,onExited:s,className:c,onOpenChange:l,size:p,...h}){let g=(0,u.useRef)(s),_=(0,u.useRef)(!1),v=(0,f.useId)(),{refs:y,context:b}=(0,f.useFloating)({open:e,onOpenChange:l,nodeId:v}),{getFloatingProps:x}=(0,f.useInteractions)([(0,f.useDismiss)(b,{enabled:o,escapeKey:o,outsidePress:!1})]),{isMounted:S,styles:C}=(0,f.useTransitionStyles)(b,{duration:n,initial:{opacity:0,transform:`scale(0.8)`}});(0,u.useEffect)(()=>{_.current!==S&&(_.current=S,!S&&g.current?.())},[S]);let w=(0,u.useCallback)(()=>{a&&l?.(!1)},[l,a]);g.current=s;let T=(0,u.useMemo)(()=>m(`grid bg-backdrop z-40 justify-items-center transition ease-in-out`,{"place-items-start items-start":i===`start`,"place-items-end":i===`end`,"place-items-center":i===`center`||!i}),[i]);return(0,d.jsx)(E,{disabled:!S,children:(0,d.jsx)(f.FloatingOverlay,{className:T,"data-testid":`vs-dialog-overlay`,onClick:w,style:{padding:r,opacity:C.opacity},lockScroll:!0,children:(0,d.jsx)(H,{ref:y.setFloating,className:c,role:`dialog`,size:p,onClick:D,...x({...h,style:C}),children:t})})})}function H({size:e,...t}){return(0,d.jsx)(g,{classList:[e?`flex flex-col bg-background shadow-lg p-5 rounded`:null,{"w-full max-w-dialog-sm":e===`small`,"w-full max-w-dialog-md":e===`medium`,"w-full max-w-dialog-lg":e===`large`}],...t})}function U(e){return(0,d.jsx)(g,{classList:`inline-block animate-pulse rounded-md bg-accent`,...e})}function W(e){return(0,d.jsx)(g,{role:`group`,classList:[`flex items-center justify-center`,`[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr`,`**:first:border-r-0 **:last:border-l-0`],...e})}function G({size:e=20,label:t=`Loading...`,...n}){return(0,d.jsxs)(`div`,{role:`status`,...n,children:[(0,d.jsxs)(`svg`,{"aria-hidden":`true`,className:`text-accent animate-spin fill-primary`,width:e,height:e,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`path`,{d:`M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z`,fill:`currentFill`})]}),(0,d.jsx)(`span`,{className:`sr-only`,children:t})]})}function K({value:e,max:t,...n}){let r=(0,u.useMemo)(()=>e?Math.min(100,Math.round(e/t*100)):0,[e,t]);return(0,d.jsx)(g,{role:`progressbar`,classList:`relative overflow-hidden rounded-full bg-primary`,"aria-valuemax":t,"aria-valuemin":0,...n,children:(0,d.jsx)(g,{className:`h-full w-full flex-1 bg-input transition-all origin-right`,style:{transform:`translateX(${r}%)`}})})}function q({orientation:e=`horizontal`,...t}){return(0,d.jsx)(g,{as:`hr`,role:`none`,classList:[`border-0 p-0 shrink-0 bg-input`,e===`horizontal`?`h-px w-full`:`w-px h-full`],...t})}var J={open:250,close:150};function Y({open:e,timeout:t=J,onOpenChange:n,position:r=`right`,overlay:i,onExited:a,onOpen:o,...s}){let c=(0,f.useId)(),l=(0,u.useRef)(!1),p=(0,u.useRef)(o),m=(0,u.useRef)(a),{refs:h,context:_}=(0,f.useFloating)({open:e,onOpenChange:n,nodeId:c}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(_,{duration:t,initial(){let e=`translateX(75%)`;return r===`left`?e=`translateX(-75%)`:r===`top`?e=`translateY(-75%)`:r===`bottom`&&(e=`translateY(75%)`),{opacity:0,transform:e}}});return(0,u.useEffect)(()=>{if(l.current!==v){if(l.current=v,v){p.current?.();return}m.current?.()}},[v]),m.current=a,p.current=o,(0,d.jsxs)(E,{disabled:!v,children:[i?(0,d.jsx)(f.FloatingOverlay,{className:`bg-backdrop`,style:{opacity:y.opacity},onClick:()=>n?.(!1)}):null,(0,d.jsx)(g,{ref:h.setFloating,role:`dialog`,classList:[`fixed transition-transform z-30`,{"top-0 right-0 h-full max-h-screen":r===`right`,"top-0 left-0 h-full max-h-screen":r===`left`,"top-0 left-0 right-0 w-full max-w-screen":r===`top`,"bottom-0 left-0 right-0 w-full max-w-screen":r===`bottom`}],style:y,children:(0,d.jsx)(ee,{...s})})]})}function ee(e){return(0,d.jsx)(g,{classList:`relative bg-background min-w-full min-h-full border border-input shadow-lg`,...e})}function X({type:e,label:t,message:n}){let{icons:r}=ne();return(0,d.jsxs)(`div`,{className:`flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2`,children:[e?(0,d.jsxs)(`figure`,{className:`mr-2`,children:[e===`success`&&r?.success?r.success:null,e===`info`&&r?.info?r.info:null,e===`error`&&r?.error?r.error:null,e===`warn`&&r?.warn?r.warn:null,e===`loading`?(0,d.jsx)(G,{size:20}):null]}):null,(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`p`,{className:`font-medium leading-none`,children:t}),n?(0,d.jsx)(`p`,{children:n}):null]})]})}function Z(){}var Q=new class{notify=Z;lastId=0;subscribe=e=>(this.notify=e,()=>{this.notify=Z});add=(e,t={})=>{this.lastId+=1;let n=`${this.lastId}`;return this.notify({id:n,type:`add`,config:{id:n,label:e,...t}}),n};update=(e,t)=>{this.notify({id:e,type:`update`,config:t})};remove=e=>{this.notify({id:e,type:`remove`})};clear=()=>{this.lastId=0}};function te({id:e,type:t,index:n,duration:r=5e3,className:i,children:a,inverted:o,timeout:s=250,max:l=3}){let p=(0,u.useRef)(!1),[m,h]=(0,u.useState)(!1),{context:g,refs:_}=(0,f.useFloating)({open:m,onOpenChange:h,nodeId:e}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(g,{duration:s,initial:{opacity:0,transform:`translateY(${o?``:`-`}50%)`}});(0,u.useLayoutEffect)(()=>{h(n<=l)},[n,l]),(0,u.useEffect)(()=>{p.current!==v&&(v||Q.remove(e),p.current=v)},[v,e]),(0,u.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>h(!1),r);return()=>window.clearTimeout(e)},[r,e]);let b=(0,u.useCallback)(()=>{t!==`loading`&&h(!1)},[t]),x=(0,u.useMemo)(()=>(0,c.default)(`relative flex w-fit transition-transform ease-in-out cursor-pointer`,i),[i]);return v?(0,d.jsx)(`li`,{role:`log`,tabIndex:-1,ref:_.setFloating,className:x,style:y,onClick:b,children:a}):null}var $=(0,u.createContext)({});function ne(){return(0,u.useContext)($)}function re({className:e,offset:t={},position:n=`top-left`,max:r,ListItem:i=X,icons:a}){let o=(0,u.useMemo)(()=>{let e={position:`fixed`,...t};return Object.keys(t).length||(n.indexOf(`top`)>-1?e.top=`16px`:n.indexOf(`bottom`)>-1&&(e.bottom=`16px`),n.indexOf(`left`)>-1?e.left=`16px`:n.indexOf(`right`)>-1&&(e.right=`16px`)),n.indexOf(`left`)>-1?e.alignItems=`flex-start`:n.indexOf(`right`)>-1?e.alignItems=`flex-end`:(e.left=`50%`,e.alignItems=`center`,e.transform=`translateX(-50%)`),e},[t,n]),s=(0,u.useMemo)(()=>(0,c.default)(`flex flex-col z-40 overflow-hidden`,e),[e]),l=(0,u.useMemo)(()=>n?.startsWith(`bottom`)||!1,[n]),f=(0,u.useRef)(new Map),[p,m]=(0,u.useState)([]),h=(0,u.useState)(0)[1];T(()=>Q.subscribe(e=>{(0,u.startTransition)(()=>{if(e.type===`add`)f.current.set(e.id,e.config),m(t=>[...t,e.id]);else if(e.type===`remove`){if(!f.current.delete(e.id))return;m(t=>{let n=new Set(t);return n.has(e.id)?(n.delete(e.id),Array.from(n)):t})}else if(e.type===`update`){let t=f.current.get(e.id);if(!t)return;f.current.set(e.id,{...t,...e.config}),h(e=>e+1)}})}),[]);let g=(0,u.useMemo)(()=>({icons:a}),[a]),_=p.length;return(0,d.jsx)(E,{children:(0,d.jsx)(`ol`,{className:s,style:o,"aria-live":`polite`,children:(0,d.jsx)($.Provider,{value:g,children:p.map((e,t)=>{let n=f.current.get(e);if(!n)return null;let{className:a,duration:o,...s}=n;return(0,d.jsx)(te,{id:e,index:_-t,className:a,duration:o,inverted:l,max:r,children:(0,u.createElement)(i,s)},e)})})})})}exports.Accordion=F,exports.Base=g,exports.Button=z,exports.ButtonGroup=W,exports.Checkbox=w,exports.Dialog=V,exports.Divider=q,exports.FormField=v,exports.FormLabel=_,exports.Input=x,exports.InputField=b,exports.Popover=k,exports.Portal=E,exports.Progress=K,exports.Radio=N,exports.Select=j,exports.Sheet=Y,exports.Skeleton=U,exports.Spinner=G,exports.Switch=P,exports.Textarea=S,exports.Toast=re,exports.ToastItem=X,exports.Tooltip=I,exports.cn=m,exports.merge=h,exports.toast=Q,exports.varientButton=R;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("clsx");c=s(c,1);let l=require("tailwind-merge"),u=require("react"),d=require("react/jsx-runtime"),f=require("@floating-ui/react"),p=require("react-dom");var m=c.default;function h(e,t){return t?(0,l.twMerge)(e,t):e}function g({as:e,classList:t=[],className:n,override:r,...i}){let a=(0,u.useMemo)(()=>r?n:h(m(t),n),[t,n,r]);return(0,u.createElement)(e||`div`,{className:a,...i})}function _(e,t){let n=({className:n,...r})=>{let i=(0,u.useMemo)(()=>h(m(t),n),[n]);return(0,u.createElement)(e,{className:i,...r})};return n.displayName=`Styled${typeof e==`string`?e:`Component`}`,n}function v(e){return(0,d.jsx)(g,{as:`label`,classList:[`leading-none peer-disabled:opacity-70`],...e})}function y({label:e,children:t,required:n,htmlFor:r,error:i,help:a,helpBefore:o,innerClass:s,...c}){let l=(0,u.useMemo)(()=>m(`font-medium`,n?`after:content-["*"] after:text-danger after:text-sm after:pl-0.5`:``),[n]);return(0,d.jsxs)(g,{classList:`flex flex-col space-y-2`,...c,children:[e?(0,d.jsx)(v,{className:l,htmlFor:r,children:e}):null,a&&o?(0,d.jsx)(`p`,{className:`text-xs text-muted pb-2`,children:a}):null,(0,d.jsx)(`div`,{className:s,children:b(t,!!i)}),a&&!o&&!i?(0,d.jsx)(`p`,{className:`text-xs text-muted`,children:a}):null,i?(0,d.jsx)(`p`,{className:`text-xs text-danger`,children:i}):null]})}function b(e,t){let n=u.Children.count(e);if(!n)return null;if(n===1)return(0,u.cloneElement)(e,{error:t});let r=u.Children.toArray(e);return r[0]=(0,u.cloneElement)(r[0],{error:t}),r}function x({error:e,...t}){return(0,d.jsx)(g,{as:`fieldset`,classList:[`flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted`,`[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none`,e?`border-danger hover:border-danger-fore`:`border-input`],...t})}function S({type:e,error:t,...n}){return(0,d.jsx)(g,{as:`input`,type:e,classList:[`flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted`,`disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2`,t?`border-danger hover:border-danger-fore focus-visible:ring-danger`:`border-input not-disabled:hover:border-input-fore focus-visible:ring-ring`,e===`file`?`file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground`:null],...n})}function C({error:e,...t}){return(0,d.jsx)(g,{as:`textarea`,classList:[`flex rounded-md border bg-background px-3 py-2 w-full`,`disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring`,e?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`],...t})}function w(){return(0,d.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`30`,height:`30`,viewBox:`0 0 30 30`,children:(0,d.jsx)(`rect`,{width:`20`,height:`3`,y:`13.5`,x:`4.5`,fill:`currentColor`,stroke:`none`,rx:`2`})})}function T({checked:e,indeterminate:t,id:n,name:r,onChange:i,value:a,checkIcon:o,error:s,...c}){let l=()=>{c.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`checkbox`,id:n||r,classList:[`inline-flex justify-center items-center border w-4.5 h-4.5 rounded`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,{"border-danger hover:border-danger-fore":s,"bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input":!s&&e,"border-input not-disabled:hover:border-input-fore":!s&&!e}],onClick:l,"aria-checked":e,...c,children:[e?o:null,t&&!e?(0,d.jsx)(w,{}):null,(0,d.jsx)(`input`,{type:`checkbox`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:l,disabled:c.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}var E=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?u.useLayoutEffect:u.useEffect;function D({children:e,container:t,disabled:n}){let[r,i]=(0,u.useState)(null);return E(()=>{if(!t){let e=document.getElementById(`visits-style-portals`);return e||(e=document.createElement(`div`),e.id=`visits-style-portals`,document.body.appendChild(e)),i(e)}i(t)},[t]),n||!r?null:(0,p.createPortal)(e,r)}function O(e){e&&(e.stopPropagation(),e.preventDefault())}var k={open:150,close:75};function A({ref:e,position:t,label:n,children:r,disabled:i,offset:a={x:0,y:6},onOpen:o,onClose:s,onManualClose:c,timeout:l=k,override:p,zIndex:m=9996,role:h,...g}){let[_,v]=(0,u.useState)(!1),y=(0,f.useId)(),b=(0,u.useRef)(o),x=(0,u.useRef)(s),{refs:S,floatingStyles:C,context:w}=(0,f.useFloating)({nodeId:y,placement:t,middleware:[(0,f.shift)(),(0,f.flip)({fallbackAxisSideDirection:`end`}),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],open:_,onOpenChange:e=>{e?b.current?.(S.reference.current,S.floating.current):x.current?.(S.reference.current,S.floating.current),v(e)},whileElementsMounted:f.autoUpdate}),{isMounted:T,styles:E}=(0,f.useTransitionStyles)(w,{duration:l,initial({side:e}){let t=``;return t=e===`top`?`translateY(5%) scale(0.95)`:e===`bottom`?`translateY(-5%) scale(0.95)`:e===`left`?`translateX(5%) scale(0.95)`:`translateX(-5%) scale(0.95)`,{opacity:0,transform:t}}}),A=(0,u.useCallback)(e=>{if(O(e),c)return c();v(!1),x.current?.(S.reference.current,S.floating.current)},[c]);(0,u.useEffect)(()=>{if(i&&_)return v(!1)},[i,_]),(0,u.useImperativeHandle)(e,()=>({open:()=>{v(!0),b.current?.(S.reference.current,S.floating.current)},close:()=>{v(!1),x.current?.(S.reference.current,S.floating.current)}}),[]);let{getFloatingProps:M,getReferenceProps:N}=(0,f.useInteractions)([(0,f.useClick)(w,{enabled:!i})]);return b.current=o,x.current=s,(0,d.jsxs)(d.Fragment,{children:[(0,u.cloneElement)(u.Children.only(n),N({ref:S.setReference,tabIndex:0,role:`button`,"aria-expanded":_,disabled:i,onClick:O})),(0,d.jsx)(D,{disabled:i||!T,children:(0,d.jsx)(f.FloatingOverlay,{"data-testid":`vs-popover-shadow`,onClick:A,style:{zIndex:m},autoFocus:!0,children:(0,d.jsx)(`div`,{role:h||`region`,ref:S.setFloating,style:C,children:(0,d.jsx)(j,{override:p,styles:E,...M({...g,onClick:O}),children:r})})})})]})}function j({override:e,styles:t,style:n={},...r}){return(0,d.jsx)(g,{classList:[`z-20 w-auto h-auto outline-none transition-transform ease-in-out`,e?null:`border border-accent rounded-md shadow-lg p-1 bg-background`],style:{...t,...n},...r})}function M({className:e,placeholder:t=``,options:n=[],error:r,disabled:i,value:a,maxHeight:o=408,arrowIcon:s,closeIcon:c,checkIcon:l,onChange:f,onClear:p,renderItem:m,sectionLabelStyle:h,buttonAreaStyle:_,clearLabelText:v,optionStyle:y,popoverStyle:b,popoverPosition:x,labelStyle:S,...C}){let w=(0,u.useRef)(null),[T,E]=(0,u.useState)(0),D=(0,u.useMemo)(()=>Array.isArray(a),[]),O=(0,u.useCallback)(e=>{f?.(e),D||w.current?.close()},[f,D]),k=(0,u.useCallback)(e=>Array.isArray(a)?a.indexOf(e)>-1:a===e,[a]),j=(0,u.useMemo)(()=>{let e={},t=n.filter(e=>typeof e!=`string`);for(let n=0,r=t.length;n<r;n+=1){let r=t[n];e[`${r.value}`]=r.label}return e},[n]),M=(0,u.useMemo)(()=>{if(!a)return t;if(Array.isArray(a)){if(!a.length)return t;let e=[...a].sort(),n=[];for(let t=0,r=e.length;t<r;t+=1)n[t]=j[`${e[t]}`]||``;return n.filter(Boolean).join(`,`)||t}return j[`${a}`]||t},[t,a,j]),P=(0,u.useMemo)(()=>a==null?!0:Array.isArray(a)?!a.length:!1,[a]),F=(0,u.useCallback)((e,t)=>m?typeof e==`string`?m(e,{index:t,selected:!1,onChange:()=>{}}):m(e,{index:t,selected:k(e.value),onChange:()=>O(e.value)}):typeof e==`string`?(0,d.jsx)(g,{as:`h5`,classList:[`font-normal py-1 px-2 text-muted`],className:h,children:e},`optionheader-${t}`):(0,d.jsx)(N,{selected:k(e.value),onChange:O,checkIcon:l,className:y,...e},e.label),[m,O,k,h,y,l]);return(0,d.jsx)(A,{label:(0,d.jsxs)(g,{as:`button`,type:`button`,classList:[`flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer`,`disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring`,r?`border-danger hover:border-danger-fore`:`border-input not-disabled:hover:border-input-fore`],className:e,disabled:i,...C,children:[(0,d.jsx)(g,{as:`span`,classList:[`overflow-hidden text-ellipsis whitespace-nowrap`,P?`text-muted`:`text-text`],className:S,children:M}),(0,d.jsxs)(g,{classList:`relative flex items-center space-x-2`,className:_,children:[p&&!P?(0,d.jsx)(`div`,{tabIndex:-1,role:`button`,className:`size-6 p-1.5 rounded hover:bg-accent cursor-pointer`,"aria-label":v,onKeyDown:e=>{(e.key===`Enter`||e.key===`Space`)&&p()},onClick:e=>{e.stopPropagation(),p()},children:c}):null,s]})]}),ref:w,onOpen:e=>E(e?.getBoundingClientRect().width||0),className:b,position:x,disabled:i,children:(0,d.jsx)(`ul`,{className:`overflow-y-auto flex flex-col`,role:`listbox`,style:{minWidth:T,maxWidth:`calc(100vw - 3rem)`,maxHeight:o},children:n.map(F)})})}function N({className:e,value:t,label:n,selected:r,checkIcon:i,onChange:a}){return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`option`,classList:`flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer`,className:e,"aria-selected":r,onClick:()=>a?.(t),children:[r&&(i||i===null)?i:(0,d.jsx)(`div`,{className:`w-5 h-1 mr-1`}),n]})}function P({checked:e,className:t,id:n,name:r,onChange:i,value:a,error:o,...s}){let c=()=>{s.disabled||i?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`radio`,id:n||r,classList:[`relative inline-flex justify-center items-center border w-4.5 h-4.5 rounded-full`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore`,o?`border-danger`:`border-input`,e?`[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input`:``],className:t,onClick:c,"aria-checked":e,...s,children:[(0,d.jsx)(`i`,{className:`block w-2.5 h-2.5 rounded-full transition-transform`,style:{transform:e?``:`scale(0.8)`,opacity:+!!e}}),(0,d.jsx)(`input`,{type:`radio`,"aria-hidden":`true`,name:r,checked:e,value:a,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function F({checked:e,onChange:t,value:n,id:r,name:i,error:a,ref:o,...s}){let c=()=>{s.disabled||t?.(!e)};return(0,d.jsxs)(g,{as:`button`,type:`button`,role:`switch`,id:r||i,classList:[`inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50`,`w-11`,e?`bg-primary disabled:bg-text`:`bg-input`],onClick:c,"aria-checked":e,"aria-invalid":a,...s,children:[(0,d.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform`,style:{transform:e?`translateX(100%)`:``}}),(0,d.jsx)(`input`,{ref:o,type:`checkbox`,"aria-hidden":`true`,name:i,checked:e,value:n,onChange:c,disabled:s.disabled,style:{position:`absolute`,pointerEvents:`none`,top:0,left:0,width:1,height:1,opacity:0}})]})}function I({header:e,show:t,children:n,timeout:r=300,...i}){let a=(0,u.useRef)(null),o=(0,u.useRef)(0),s=(0,u.useRef)(0),c=(0,u.useRef)(!0);return(0,u.useEffect)(()=>{s.current=r},[r]),E(()=>{if(!a.current)return;if(a.current.style.overflow=`hidden`,a.current.style.opacity=`1`,c.current){c.current=!1,a.current.style.height=t?`auto`:`0px`,t?window.requestAnimationFrame(()=>{a.current&&(o.current=a.current.offsetHeight)}):(window.requestAnimationFrame(()=>{a.current&&(a.current.style.height=`auto`,o.current=a.current.offsetHeight,a.current.style.height=`0px`)}),a.current.style.opacity=`0`);return}t||(a.current.style.height=`${o.current}px`);let e=[];e[0]=window.requestAnimationFrame(()=>{e[1]=window.requestAnimationFrame(()=>{a.current&&(a.current.style.height=`${t?o.current:0}px`,a.current.style.opacity=t?`1`:`0`)})});let n,r=()=>{a.current&&(t?(a.current.style.height=`auto`,a.current.style.overflow=``,a.current.style.opacity=``,window.requestAnimationFrame(()=>{a.current&&(o.current=a.current.offsetHeight)})):a.current.style.height=`0px`)};return s.current===0?r():n=window.setTimeout(r,s.current),()=>{e.forEach(window.cancelAnimationFrame),n&&window.clearTimeout(n)}},[t]),(0,d.jsxs)(`div`,{...i,children:[e,(0,d.jsx)(`div`,{className:`transition-all ease-in-out overflow-hidden`,role:`region`,"aria-hidden":!t,ref:a,style:{transitionDuration:`${r}ms`},children:n})]})}var L=(0,u.forwardRef)(({children:e,position:t=`bottom`,label:n,className:r,timeout:i=150,offset:a={x:0,y:6},clientPoint:o=!1,disabled:s},c)=>{let[l,p]=(0,u.useState)(!1),m=(0,f.useId)(),{refs:h,floatingStyles:g,context:_}=(0,f.useFloating)({nodeId:m,open:l,placement:t,middleware:[(0,f.shift)(),(0,f.flip)(),(0,f.offset)({mainAxis:a.y,crossAxis:a.x})],whileElementsMounted:s?void 0:f.autoUpdate,onOpenChange:p}),{getReferenceProps:v,getFloatingProps:y}=(0,f.useInteractions)([(0,f.useHover)(_,{enabled:!s}),(0,f.useClientPoint)(_,{enabled:o})]),{isMounted:b,styles:x}=(0,f.useTransitionStyles)(_,{duration:i,initial:{opacity:0,transform:`scale(0.8)`}});(0,u.useImperativeHandle)(c,()=>({floating:h.floating,reference:h.reference,open:()=>p(!0),close:()=>p(!1)})),(0,u.useEffect)(()=>{s&&p(!1)},[s]);let S=typeof e==`string`?(0,d.jsx)(`span`,{children:e}):e;return(0,d.jsxs)(d.Fragment,{children:[(0,u.cloneElement)(u.Children.only(S),{ref:h.setReference,...v()}),(0,d.jsx)(D,{disabled:s||!b,children:(0,d.jsx)(`div`,{role:`tooltip`,className:`z-9999`,ref:h.setFloating,...y({style:g}),children:(0,d.jsx)(R,{className:r,style:x,children:n})})})]})});L.displayName=`Tooltip`;var R=(0,u.forwardRef)(({className:e,custom:t,...n},r)=>{let i=(0,u.useMemo)(()=>h(m(`relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre`,t?null:`border border-accent rounded shadow-md px-3 py-1 bg-background`),e),[e,t]);return(0,d.jsx)(`div`,{ref:r,className:i,...n})});R.displayName=`TooltipContent`;function z({variant:e,size:t}){return m(`inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto`,{"bg-primary text-inverted hover:bg-primary-fore":!e||e===`primary`,"bg-info text-inverted hover:bg-info-fore":e===`info`,"bg-warn text-inverted hover:bg-warn-fore":e===`warn`,"bg-danger text-inverted hover:bg-danger-fore":e===`danger`,"hover:bg-accent":e===`ghost`,"hover:underline":e===`link`,"border border-input hover:bg-accent":e===`outline`},{"px-2 py-1":t!==`icon`,"p-1.5":t===`icon`})}function B({size:e,variant:t,className:n,...r}){let i=(0,u.useMemo)(()=>h(z({size:e,variant:t}),n),[e,t,n]);return(0,d.jsx)(`button`,{className:i,type:`button`,...r})}var V={open:150,close:75};function H({open:e,children:t,timeout:n=V,padding:r=`0.85rem`,verticalAlign:i=`center`,closeOnOverlay:a,closeOnEsc:o,onExited:s,className:c,onOpenChange:l,size:p,...h}){let g=(0,u.useRef)(s),_=(0,u.useRef)(!1),v=(0,f.useId)(),{refs:y,context:b}=(0,f.useFloating)({open:e,onOpenChange:l,nodeId:v}),{getFloatingProps:x}=(0,f.useInteractions)([(0,f.useDismiss)(b,{enabled:o,escapeKey:o,outsidePress:!1})]),{isMounted:S,styles:C}=(0,f.useTransitionStyles)(b,{duration:n,initial:{opacity:0,transform:`scale(0.8)`}});(0,u.useEffect)(()=>{_.current!==S&&(_.current=S,!S&&g.current?.())},[S]);let w=(0,u.useCallback)(()=>{a&&l?.(!1)},[l,a]);g.current=s;let T=(0,u.useMemo)(()=>m(`grid bg-backdrop z-40 justify-items-center transition ease-in-out`,{"place-items-start items-start":i===`start`,"place-items-end":i===`end`,"place-items-center":i===`center`||!i}),[i]);return(0,d.jsx)(D,{disabled:!S,children:(0,d.jsx)(f.FloatingOverlay,{className:T,"data-testid":`vs-dialog-overlay`,onClick:w,style:{padding:r,opacity:C.opacity},lockScroll:!0,children:(0,d.jsx)(U,{ref:y.setFloating,className:c,role:`dialog`,size:p,onClick:O,...x({...h,style:C}),children:t})})})}function U({size:e,...t}){return(0,d.jsx)(g,{classList:[e?`flex flex-col bg-background shadow-lg p-5 rounded`:null,{"w-full max-w-dialog-sm":e===`small`,"w-full max-w-dialog-md":e===`medium`,"w-full max-w-dialog-lg":e===`large`}],...t})}function W(e){return(0,d.jsx)(g,{classList:`inline-block animate-pulse rounded-md bg-accent`,...e})}function G(e){return(0,d.jsx)(g,{role:`group`,classList:[`flex items-center justify-center`,`[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr`,`**:first:border-r-0 **:last:border-l-0`],...e})}function K({label:e=`Loading...`,...t}){return(0,d.jsxs)(g,{as:`svg`,classList:`fill-accent animate-spin text-primary`,"aria-label":e,"aria-hidden":`true`,width:`32`,height:`32`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...t,children:[(0,d.jsx)(`path`,{d:`M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z`,fill:`currentFill`}),(0,d.jsx)(`path`,{d:`M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z`,fill:`currentColor`})]})}function q({value:e,max:t,...n}){let r=(0,u.useMemo)(()=>e?Math.min(100,Math.round(e/t*100)):0,[e,t]);return(0,d.jsx)(g,{role:`progressbar`,classList:`relative overflow-hidden rounded-full bg-primary`,"aria-valuemax":t,"aria-valuemin":0,...n,children:(0,d.jsx)(g,{className:`h-full w-full flex-1 bg-input transition-all origin-right`,style:{transform:`translateX(${r}%)`}})})}function J({orientation:e=`horizontal`,...t}){return(0,d.jsx)(g,{as:`hr`,role:`none`,classList:[`border-0 p-0 shrink-0 bg-input`,e===`horizontal`?`h-px w-full`:`w-px h-full`],...t})}var Y={open:250,close:150};function ee({open:e,timeout:t=Y,onOpenChange:n,position:r=`right`,overlay:i,onExited:a,onOpen:o,...s}){let c=(0,f.useId)(),l=(0,u.useRef)(!1),p=(0,u.useRef)(o),m=(0,u.useRef)(a),{refs:h,context:_}=(0,f.useFloating)({open:e,onOpenChange:n,nodeId:c}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(_,{duration:t,initial(){let e=`translateX(75%)`;return r===`left`?e=`translateX(-75%)`:r===`top`?e=`translateY(-75%)`:r===`bottom`&&(e=`translateY(75%)`),{opacity:0,transform:e}}});return(0,u.useEffect)(()=>{if(l.current!==v){if(l.current=v,v){p.current?.();return}m.current?.()}},[v]),m.current=a,p.current=o,(0,d.jsxs)(D,{disabled:!v,children:[i?(0,d.jsx)(f.FloatingOverlay,{className:`bg-backdrop`,style:{opacity:y.opacity},onClick:()=>n?.(!1)}):null,(0,d.jsx)(g,{ref:h.setFloating,role:`dialog`,classList:[`fixed transition-transform z-30`,{"top-0 right-0 h-full max-h-screen":r===`right`,"top-0 left-0 h-full max-h-screen":r===`left`,"top-0 left-0 right-0 w-full max-w-screen":r===`top`,"bottom-0 left-0 right-0 w-full max-w-screen":r===`bottom`}],style:y,children:(0,d.jsx)(te,{...s})})]})}function te(e){return(0,d.jsx)(g,{classList:`relative bg-background min-w-full min-h-full border border-input shadow-lg`,...e})}function X({type:e,label:t,message:n}){let{icons:r}=re();return(0,d.jsxs)(`div`,{className:`flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2`,children:[e?(0,d.jsxs)(`figure`,{className:`mr-2`,children:[e===`success`&&r?.success?r.success:null,e===`info`&&r?.info?r.info:null,e===`error`&&r?.error?r.error:null,e===`warn`&&r?.warn?r.warn:null,e===`loading`?r?.loading:null]}):null,(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`p`,{className:`font-medium leading-none`,children:t}),n?(0,d.jsx)(`p`,{children:n}):null]})]})}function Z(){}var Q=new class{notify=Z;lastId=0;subscribe=e=>(this.notify=e,()=>{this.notify=Z});add=(e,t={})=>{this.lastId+=1;let n=`${this.lastId}`;return this.notify({id:n,type:`add`,config:{id:n,label:e,...t}}),n};update=(e,t)=>{this.notify({id:e,type:`update`,config:t})};remove=e=>{this.notify({id:e,type:`remove`})};clear=()=>{this.lastId=0}};function ne({id:e,type:t,index:n,duration:r=5e3,className:i,children:a,inverted:o,timeout:s=250,max:l=3}){let p=(0,u.useRef)(!1),[m,h]=(0,u.useState)(!1),{context:g,refs:_}=(0,f.useFloating)({open:m,onOpenChange:h,nodeId:e}),{isMounted:v,styles:y}=(0,f.useTransitionStyles)(g,{duration:s,initial:{opacity:0,transform:`translateY(${o?``:`-`}50%)`}});(0,u.useLayoutEffect)(()=>{h(n<=l)},[n,l]),(0,u.useEffect)(()=>{p.current!==v&&(v||Q.remove(e),p.current=v)},[v,e]),(0,u.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>h(!1),r);return()=>window.clearTimeout(e)},[r,e]);let b=(0,u.useCallback)(()=>{t!==`loading`&&h(!1)},[t]),x=(0,u.useMemo)(()=>(0,c.default)(`relative flex w-fit transition-transform ease-in-out cursor-pointer`,i),[i]);return v?(0,d.jsx)(`li`,{role:`log`,tabIndex:-1,ref:_.setFloating,className:x,style:y,onClick:b,children:a}):null}var $=(0,u.createContext)({});function re(){return(0,u.useContext)($)}function ie({className:e,offset:t={},position:n=`top-left`,max:r,ListItem:i=X,icons:a}){let o=(0,u.useMemo)(()=>{let e={position:`fixed`,...t};return Object.keys(t).length||(n.indexOf(`top`)>-1?e.top=`16px`:n.indexOf(`bottom`)>-1&&(e.bottom=`16px`),n.indexOf(`left`)>-1?e.left=`16px`:n.indexOf(`right`)>-1&&(e.right=`16px`)),n.indexOf(`left`)>-1?e.alignItems=`flex-start`:n.indexOf(`right`)>-1?e.alignItems=`flex-end`:(e.left=`50%`,e.alignItems=`center`,e.transform=`translateX(-50%)`),e},[t,n]),s=(0,u.useMemo)(()=>(0,c.default)(`flex flex-col z-40 overflow-hidden`,e),[e]),l=(0,u.useMemo)(()=>n?.startsWith(`bottom`)||!1,[n]),f=(0,u.useRef)(new Map),[p,m]=(0,u.useState)([]),h=(0,u.useState)(0)[1];E(()=>Q.subscribe(e=>{(0,u.startTransition)(()=>{if(e.type===`add`)f.current.set(e.id,e.config),m(t=>[...t,e.id]);else if(e.type===`remove`){if(!f.current.delete(e.id))return;m(t=>{let n=new Set(t);return n.has(e.id)?(n.delete(e.id),Array.from(n)):t})}else if(e.type===`update`){let t=f.current.get(e.id);if(!t)return;f.current.set(e.id,{...t,...e.config}),h(e=>e+1)}})}),[]);let g=(0,u.useMemo)(()=>({icons:a}),[a]),_=p.length;return(0,d.jsx)(D,{children:(0,d.jsx)(`ol`,{className:s,style:o,"aria-live":`polite`,children:(0,d.jsx)($.Provider,{value:g,children:p.map((e,t)=>{let n=f.current.get(e);if(!n)return null;let{className:a,duration:o,...s}=n;return(0,d.jsx)(ne,{id:e,index:_-t,className:a,duration:o,inverted:l,max:r,children:(0,u.createElement)(i,s)},e)})})})})}exports.Accordion=I,exports.Base=g,exports.Button=B,exports.ButtonGroup=G,exports.Checkbox=T,exports.Dialog=H,exports.Divider=J,exports.FormField=y,exports.FormLabel=v,exports.Input=S,exports.InputField=x,exports.Popover=A,exports.Portal=D,exports.Progress=q,exports.Radio=P,exports.Select=M,exports.Sheet=ee,exports.Skeleton=W,exports.Spinner=K,exports.Switch=F,exports.Textarea=C,exports.Toast=ie,exports.ToastItem=X,exports.Tooltip=L,exports.cn=m,exports.element=_,exports.merge=h,exports.toast=Q,exports.varientButton=z;
|
package/dist/index.es.js
CHANGED
|
@@ -22,9 +22,19 @@ function F({ as: e, classList: t = [], className: n, override: r, ...i }) {
|
|
|
22
22
|
...i
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
function I(e, t) {
|
|
26
|
+
let n = ({ className: n, ...r }) => {
|
|
27
|
+
let i = p(() => P(N(t), n), [n]);
|
|
28
|
+
return a(e, {
|
|
29
|
+
className: i,
|
|
30
|
+
...r
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return n.displayName = `Styled${typeof e == "string" ? e : "Component"}`, n;
|
|
34
|
+
}
|
|
25
35
|
//#endregion
|
|
26
36
|
//#region src/forms/Field/FormLabel.tsx
|
|
27
|
-
function
|
|
37
|
+
function L(e) {
|
|
28
38
|
return /* @__PURE__ */ _(F, {
|
|
29
39
|
as: "label",
|
|
30
40
|
classList: ["leading-none peer-disabled:opacity-70"],
|
|
@@ -33,13 +43,13 @@ function I(e) {
|
|
|
33
43
|
}
|
|
34
44
|
//#endregion
|
|
35
45
|
//#region src/forms/Field/FormField.tsx
|
|
36
|
-
function
|
|
46
|
+
function R({ label: e, children: t, required: n, htmlFor: r, error: i, help: a, helpBefore: o, innerClass: s, ...c }) {
|
|
37
47
|
let l = p(() => N("font-medium", n ? "after:content-[\"*\"] after:text-danger after:text-sm after:pl-0.5" : ""), [n]);
|
|
38
48
|
return /* @__PURE__ */ v(F, {
|
|
39
49
|
classList: "flex flex-col space-y-2",
|
|
40
50
|
...c,
|
|
41
51
|
children: [
|
|
42
|
-
e ? /* @__PURE__ */ _(
|
|
52
|
+
e ? /* @__PURE__ */ _(L, {
|
|
43
53
|
className: l,
|
|
44
54
|
htmlFor: r,
|
|
45
55
|
children: e
|
|
@@ -50,7 +60,7 @@ function L({ label: e, children: t, required: n, htmlFor: r, error: i, help: a,
|
|
|
50
60
|
}) : null,
|
|
51
61
|
/* @__PURE__ */ _("div", {
|
|
52
62
|
className: s,
|
|
53
|
-
children:
|
|
63
|
+
children: z(t, !!i)
|
|
54
64
|
}),
|
|
55
65
|
a && !o && !i ? /* @__PURE__ */ _("p", {
|
|
56
66
|
className: "text-xs text-muted",
|
|
@@ -63,7 +73,7 @@ function L({ label: e, children: t, required: n, htmlFor: r, error: i, help: a,
|
|
|
63
73
|
]
|
|
64
74
|
});
|
|
65
75
|
}
|
|
66
|
-
function
|
|
76
|
+
function z(e, t) {
|
|
67
77
|
let i = n.count(e);
|
|
68
78
|
if (!i) return null;
|
|
69
79
|
if (i === 1) return r(e, { error: t });
|
|
@@ -72,7 +82,7 @@ function R(e, t) {
|
|
|
72
82
|
}
|
|
73
83
|
//#endregion
|
|
74
84
|
//#region src/forms/Field/InputField.tsx
|
|
75
|
-
function
|
|
85
|
+
function ee({ error: e, ...t }) {
|
|
76
86
|
return /* @__PURE__ */ _(F, {
|
|
77
87
|
as: "fieldset",
|
|
78
88
|
classList: [
|
|
@@ -113,7 +123,7 @@ function V({ error: e, ...t }) {
|
|
|
113
123
|
}
|
|
114
124
|
//#endregion
|
|
115
125
|
//#region src/forms/Checkbox/index.tsx
|
|
116
|
-
function
|
|
126
|
+
function H() {
|
|
117
127
|
return /* @__PURE__ */ _("svg", {
|
|
118
128
|
xmlns: "http://www.w3.org/2000/svg",
|
|
119
129
|
width: "30",
|
|
@@ -130,7 +140,7 @@ function ee() {
|
|
|
130
140
|
})
|
|
131
141
|
});
|
|
132
142
|
}
|
|
133
|
-
function
|
|
143
|
+
function U({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a, checkIcon: o, error: s, ...c }) {
|
|
134
144
|
let l = () => {
|
|
135
145
|
c.disabled || i?.(!e);
|
|
136
146
|
};
|
|
@@ -153,7 +163,7 @@ function H({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a
|
|
|
153
163
|
...c,
|
|
154
164
|
children: [
|
|
155
165
|
e ? o : null,
|
|
156
|
-
t && !e ? /* @__PURE__ */ _(
|
|
166
|
+
t && !e ? /* @__PURE__ */ _(H, {}) : null,
|
|
157
167
|
/* @__PURE__ */ _("input", {
|
|
158
168
|
type: "checkbox",
|
|
159
169
|
"aria-hidden": "true",
|
|
@@ -177,12 +187,12 @@ function H({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a
|
|
|
177
187
|
}
|
|
178
188
|
//#endregion
|
|
179
189
|
//#region src/hooks/useIsomorphicLayoutEffect.ts
|
|
180
|
-
var
|
|
190
|
+
var W = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? f : u;
|
|
181
191
|
//#endregion
|
|
182
192
|
//#region src/components/Portal/index.tsx
|
|
183
|
-
function
|
|
193
|
+
function G({ children: e, container: t, disabled: n }) {
|
|
184
194
|
let [r, i] = h(null);
|
|
185
|
-
return
|
|
195
|
+
return W(() => {
|
|
186
196
|
if (!t) {
|
|
187
197
|
let e = document.getElementById("visits-style-portals");
|
|
188
198
|
return e || (e = document.createElement("div"), e.id = "visits-style-portals", document.body.appendChild(e)), i(e);
|
|
@@ -192,7 +202,7 @@ function W({ children: e, container: t, disabled: n }) {
|
|
|
192
202
|
}
|
|
193
203
|
//#endregion
|
|
194
204
|
//#region src/utils/stopPropagation.ts
|
|
195
|
-
function
|
|
205
|
+
function K(e) {
|
|
196
206
|
e && (e.stopPropagation(), e.preventDefault());
|
|
197
207
|
}
|
|
198
208
|
//#endregion
|
|
@@ -201,11 +211,11 @@ var te = {
|
|
|
201
211
|
open: 150,
|
|
202
212
|
close: 75
|
|
203
213
|
};
|
|
204
|
-
function
|
|
214
|
+
function q({ ref: e, position: t, label: i, children: a, disabled: o, offset: s = {
|
|
205
215
|
x: 0,
|
|
206
216
|
y: 6
|
|
207
217
|
}, onOpen: l, onClose: f, onManualClose: p, timeout: T = te, override: E, zIndex: O = 9996, role: M, ...N }) {
|
|
208
|
-
let [P, F] = h(!1), I = k(), L = m(l), R = m(f), { refs: z, floatingStyles:
|
|
218
|
+
let [P, F] = h(!1), I = k(), L = m(l), R = m(f), { refs: z, floatingStyles: ee, context: B } = D({
|
|
209
219
|
nodeId: I,
|
|
210
220
|
placement: t,
|
|
211
221
|
middleware: [
|
|
@@ -221,7 +231,7 @@ function K({ ref: e, position: t, label: i, children: a, disabled: o, offset: s
|
|
|
221
231
|
e ? L.current?.(z.reference.current, z.floating.current) : R.current?.(z.reference.current, z.floating.current), F(e);
|
|
222
232
|
},
|
|
223
233
|
whileElementsMounted: b
|
|
224
|
-
}), { isMounted:
|
|
234
|
+
}), { isMounted: V, styles: H } = j(B, {
|
|
225
235
|
duration: T,
|
|
226
236
|
initial({ side: e }) {
|
|
227
237
|
let t = "";
|
|
@@ -231,7 +241,7 @@ function K({ ref: e, position: t, label: i, children: a, disabled: o, offset: s
|
|
|
231
241
|
};
|
|
232
242
|
}
|
|
233
243
|
}), U = c((e) => {
|
|
234
|
-
if (
|
|
244
|
+
if (K(e), p) return p();
|
|
235
245
|
F(!1), R.current?.(z.reference.current, z.floating.current);
|
|
236
246
|
}, [p]);
|
|
237
247
|
u(() => {
|
|
@@ -244,16 +254,16 @@ function K({ ref: e, position: t, label: i, children: a, disabled: o, offset: s
|
|
|
244
254
|
F(!1), R.current?.(z.reference.current, z.floating.current);
|
|
245
255
|
}
|
|
246
256
|
}), []);
|
|
247
|
-
let { getFloatingProps:
|
|
257
|
+
let { getFloatingProps: W, getReferenceProps: q } = A([w(B, { enabled: !o })]);
|
|
248
258
|
return L.current = l, R.current = f, /* @__PURE__ */ v(g, { children: [r(n.only(i), q({
|
|
249
259
|
ref: z.setReference,
|
|
250
260
|
tabIndex: 0,
|
|
251
261
|
role: "button",
|
|
252
262
|
"aria-expanded": P,
|
|
253
263
|
disabled: o,
|
|
254
|
-
onClick:
|
|
255
|
-
})), /* @__PURE__ */ _(
|
|
256
|
-
disabled: o || !
|
|
264
|
+
onClick: K
|
|
265
|
+
})), /* @__PURE__ */ _(G, {
|
|
266
|
+
disabled: o || !V,
|
|
257
267
|
children: /* @__PURE__ */ _(y, {
|
|
258
268
|
"data-testid": "vs-popover-shadow",
|
|
259
269
|
onClick: U,
|
|
@@ -262,13 +272,13 @@ function K({ ref: e, position: t, label: i, children: a, disabled: o, offset: s
|
|
|
262
272
|
children: /* @__PURE__ */ _("div", {
|
|
263
273
|
role: M || "region",
|
|
264
274
|
ref: z.setFloating,
|
|
265
|
-
style:
|
|
275
|
+
style: ee,
|
|
266
276
|
children: /* @__PURE__ */ _(ne, {
|
|
267
277
|
override: E,
|
|
268
278
|
styles: H,
|
|
269
|
-
...
|
|
279
|
+
...W({
|
|
270
280
|
...N,
|
|
271
|
-
onClick:
|
|
281
|
+
onClick: K
|
|
272
282
|
}),
|
|
273
283
|
children: a
|
|
274
284
|
})
|
|
@@ -288,57 +298,57 @@ function ne({ override: e, styles: t, style: n = {}, ...r }) {
|
|
|
288
298
|
}
|
|
289
299
|
//#endregion
|
|
290
300
|
//#region src/forms/Select/index.tsx
|
|
291
|
-
function
|
|
292
|
-
let
|
|
293
|
-
d?.(e),
|
|
294
|
-
}, [d,
|
|
301
|
+
function re({ className: e, placeholder: t = "", options: n = [], error: r, disabled: i, value: a, maxHeight: o = 408, arrowIcon: s, closeIcon: l, checkIcon: u, onChange: d, onClear: f, renderItem: g, sectionLabelStyle: y, buttonAreaStyle: b, clearLabelText: x, optionStyle: S, popoverStyle: C, popoverPosition: w, labelStyle: T, ...E }) {
|
|
302
|
+
let D = m(null), [O, k] = h(0), A = p(() => Array.isArray(a), []), j = c((e) => {
|
|
303
|
+
d?.(e), A || D.current?.close();
|
|
304
|
+
}, [d, A]), M = c((e) => Array.isArray(a) ? a.indexOf(e) > -1 : a === e, [a]), N = p(() => {
|
|
295
305
|
let e = {}, t = n.filter((e) => typeof e != "string");
|
|
296
306
|
for (let n = 0, r = t.length; n < r; n += 1) {
|
|
297
307
|
let r = t[n];
|
|
298
308
|
e[`${r.value}`] = r.label;
|
|
299
309
|
}
|
|
300
310
|
return e;
|
|
301
|
-
}, [n]),
|
|
311
|
+
}, [n]), P = p(() => {
|
|
302
312
|
if (!a) return t;
|
|
303
313
|
if (Array.isArray(a)) {
|
|
304
314
|
if (!a.length) return t;
|
|
305
315
|
let e = [...a].sort(), n = [];
|
|
306
|
-
for (let t = 0, r = e.length; t < r; t += 1) n[t] =
|
|
316
|
+
for (let t = 0, r = e.length; t < r; t += 1) n[t] = N[`${e[t]}`] || "";
|
|
307
317
|
return n.filter(Boolean).join(",") || t;
|
|
308
318
|
}
|
|
309
|
-
return
|
|
319
|
+
return N[`${a}`] || t;
|
|
310
320
|
}, [
|
|
311
321
|
t,
|
|
312
322
|
a,
|
|
313
|
-
|
|
314
|
-
]),
|
|
323
|
+
N
|
|
324
|
+
]), I = p(() => a == null ? !0 : Array.isArray(a) ? !a.length : !1, [a]), L = c((e, t) => g ? typeof e == "string" ? g(e, {
|
|
315
325
|
index: t,
|
|
316
326
|
selected: !1,
|
|
317
327
|
onChange: () => {}
|
|
318
328
|
}) : g(e, {
|
|
319
329
|
index: t,
|
|
320
|
-
selected:
|
|
321
|
-
onChange: () =>
|
|
330
|
+
selected: M(e.value),
|
|
331
|
+
onChange: () => j(e.value)
|
|
322
332
|
}) : typeof e == "string" ? /* @__PURE__ */ _(F, {
|
|
323
333
|
as: "h5",
|
|
324
334
|
classList: ["font-normal py-1 px-2 text-muted"],
|
|
325
335
|
className: y,
|
|
326
336
|
children: e
|
|
327
|
-
}, `optionheader-${t}`) : /* @__PURE__ */ _(
|
|
328
|
-
selected:
|
|
329
|
-
onChange:
|
|
337
|
+
}, `optionheader-${t}`) : /* @__PURE__ */ _(ie, {
|
|
338
|
+
selected: M(e.value),
|
|
339
|
+
onChange: j,
|
|
330
340
|
checkIcon: u,
|
|
331
341
|
className: S,
|
|
332
342
|
...e
|
|
333
343
|
}, e.label), [
|
|
334
344
|
g,
|
|
335
|
-
|
|
336
|
-
|
|
345
|
+
j,
|
|
346
|
+
M,
|
|
337
347
|
y,
|
|
338
348
|
S,
|
|
339
349
|
u
|
|
340
350
|
]);
|
|
341
|
-
return /* @__PURE__ */ _(
|
|
351
|
+
return /* @__PURE__ */ _(q, {
|
|
342
352
|
label: /* @__PURE__ */ v(F, {
|
|
343
353
|
as: "button",
|
|
344
354
|
type: "button",
|
|
@@ -349,15 +359,16 @@ function q({ className: e, placeholder: t = "", options: n = [], error: r, disab
|
|
|
349
359
|
],
|
|
350
360
|
className: e,
|
|
351
361
|
disabled: i,
|
|
352
|
-
...
|
|
362
|
+
...E,
|
|
353
363
|
children: [/* @__PURE__ */ _(F, {
|
|
354
364
|
as: "span",
|
|
355
|
-
classList: ["overflow-hidden text-ellipsis whitespace-nowrap",
|
|
356
|
-
|
|
365
|
+
classList: ["overflow-hidden text-ellipsis whitespace-nowrap", I ? "text-muted" : "text-text"],
|
|
366
|
+
className: T,
|
|
367
|
+
children: P
|
|
357
368
|
}), /* @__PURE__ */ v(F, {
|
|
358
369
|
classList: "relative flex items-center space-x-2",
|
|
359
370
|
className: b,
|
|
360
|
-
children: [f && !
|
|
371
|
+
children: [f && !I ? /* @__PURE__ */ _("div", {
|
|
361
372
|
tabIndex: -1,
|
|
362
373
|
role: "button",
|
|
363
374
|
className: "size-6 p-1.5 rounded hover:bg-accent cursor-pointer",
|
|
@@ -372,22 +383,24 @@ function q({ className: e, placeholder: t = "", options: n = [], error: r, disab
|
|
|
372
383
|
}) : null, s]
|
|
373
384
|
})]
|
|
374
385
|
}),
|
|
375
|
-
ref:
|
|
376
|
-
onOpen: (e) =>
|
|
386
|
+
ref: D,
|
|
387
|
+
onOpen: (e) => k(e?.getBoundingClientRect().width || 0),
|
|
388
|
+
className: C,
|
|
389
|
+
position: w,
|
|
377
390
|
disabled: i,
|
|
378
391
|
children: /* @__PURE__ */ _("ul", {
|
|
379
392
|
className: "overflow-y-auto flex flex-col",
|
|
380
393
|
role: "listbox",
|
|
381
394
|
style: {
|
|
382
|
-
minWidth:
|
|
395
|
+
minWidth: O,
|
|
383
396
|
maxWidth: "calc(100vw - 3rem)",
|
|
384
397
|
maxHeight: o
|
|
385
398
|
},
|
|
386
|
-
children: n.map(
|
|
399
|
+
children: n.map(L)
|
|
387
400
|
})
|
|
388
401
|
});
|
|
389
402
|
}
|
|
390
|
-
function
|
|
403
|
+
function ie({ className: e, value: t, label: n, selected: r, checkIcon: i, onChange: a }) {
|
|
391
404
|
return /* @__PURE__ */ v(F, {
|
|
392
405
|
as: "button",
|
|
393
406
|
type: "button",
|
|
@@ -396,12 +409,12 @@ function re({ className: e, value: t, label: n, selected: r, checkIcon: i, onCha
|
|
|
396
409
|
className: e,
|
|
397
410
|
"aria-selected": r,
|
|
398
411
|
onClick: () => a?.(t),
|
|
399
|
-
children: [r && i ? i : /* @__PURE__ */ _("div", { className: "w-5 h-1 mr-1" }), n]
|
|
412
|
+
children: [r && (i || i === null) ? i : /* @__PURE__ */ _("div", { className: "w-5 h-1 mr-1" }), n]
|
|
400
413
|
});
|
|
401
414
|
}
|
|
402
415
|
//#endregion
|
|
403
416
|
//#region src/forms/Radio/index.tsx
|
|
404
|
-
function
|
|
417
|
+
function ae({ checked: e, className: t, id: n, name: r, onChange: i, value: a, error: o, ...s }) {
|
|
405
418
|
let c = () => {
|
|
406
419
|
s.disabled || i?.(!e);
|
|
407
420
|
};
|
|
@@ -448,7 +461,7 @@ function ie({ checked: e, className: t, id: n, name: r, onChange: i, value: a, e
|
|
|
448
461
|
}
|
|
449
462
|
//#endregion
|
|
450
463
|
//#region src/forms/Switch/index.tsx
|
|
451
|
-
function
|
|
464
|
+
function oe({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref: o, ...s }) {
|
|
452
465
|
let c = () => {
|
|
453
466
|
s.disabled || t?.(!e);
|
|
454
467
|
};
|
|
@@ -493,11 +506,11 @@ function ae({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref:
|
|
|
493
506
|
}
|
|
494
507
|
//#endregion
|
|
495
508
|
//#region src/components/Accordion/index.tsx
|
|
496
|
-
function
|
|
509
|
+
function se({ header: e, show: t, children: n, timeout: r = 300, ...i }) {
|
|
497
510
|
let a = m(null), o = m(0), s = m(0), c = m(!0);
|
|
498
511
|
return u(() => {
|
|
499
512
|
s.current = r;
|
|
500
|
-
}, [r]),
|
|
513
|
+
}, [r]), W(() => {
|
|
501
514
|
if (!a.current) return;
|
|
502
515
|
if (a.current.style.overflow = "hidden", a.current.style.opacity = "1", c.current) {
|
|
503
516
|
c.current = !1, a.current.style.height = t ? "auto" : "0px", t ? window.requestAnimationFrame(() => {
|
|
@@ -573,7 +586,7 @@ var J = o(({ children: e, position: t = "bottom", label: i, className: a, timeou
|
|
|
573
586
|
return /* @__PURE__ */ v(g, { children: [r(n.only(L), {
|
|
574
587
|
ref: w.setReference,
|
|
575
588
|
...N()
|
|
576
|
-
}), /* @__PURE__ */ _(
|
|
589
|
+
}), /* @__PURE__ */ _(G, {
|
|
577
590
|
disabled: l || !F,
|
|
578
591
|
children: /* @__PURE__ */ _("div", {
|
|
579
592
|
role: "tooltip",
|
|
@@ -610,11 +623,11 @@ function X({ variant: e, size: t }) {
|
|
|
610
623
|
"hover:underline": e === "link",
|
|
611
624
|
"border border-input hover:bg-accent": e === "outline"
|
|
612
625
|
}, {
|
|
613
|
-
"px-2 py-1":
|
|
626
|
+
"px-2 py-1": t !== "icon",
|
|
614
627
|
"p-1.5": t === "icon"
|
|
615
628
|
});
|
|
616
629
|
}
|
|
617
|
-
function
|
|
630
|
+
function ce({ size: e, variant: t, className: n, ...r }) {
|
|
618
631
|
let i = p(() => P(X({
|
|
619
632
|
size: e,
|
|
620
633
|
variant: t
|
|
@@ -631,11 +644,11 @@ function se({ size: e, variant: t, className: n, ...r }) {
|
|
|
631
644
|
}
|
|
632
645
|
//#endregion
|
|
633
646
|
//#region src/components/Dialog/index.tsx
|
|
634
|
-
var
|
|
647
|
+
var le = {
|
|
635
648
|
open: 150,
|
|
636
649
|
close: 75
|
|
637
650
|
};
|
|
638
|
-
function
|
|
651
|
+
function ue({ open: e, children: t, timeout: n = le, padding: r = "0.85rem", verticalAlign: i = "center", closeOnOverlay: a, closeOnEsc: o, onExited: s, className: l, onOpenChange: d, size: f, ...h }) {
|
|
639
652
|
let g = m(s), v = m(!1), b = k(), { refs: x, context: S } = D({
|
|
640
653
|
open: e,
|
|
641
654
|
onOpenChange: d,
|
|
@@ -663,7 +676,7 @@ function le({ open: e, children: t, timeout: n = ce, padding: r = "0.85rem", ver
|
|
|
663
676
|
"place-items-end": i === "end",
|
|
664
677
|
"place-items-center": i === "center" || !i
|
|
665
678
|
}), [i]);
|
|
666
|
-
return /* @__PURE__ */ _(
|
|
679
|
+
return /* @__PURE__ */ _(G, {
|
|
667
680
|
disabled: !w,
|
|
668
681
|
children: /* @__PURE__ */ _(y, {
|
|
669
682
|
className: M,
|
|
@@ -674,12 +687,12 @@ function le({ open: e, children: t, timeout: n = ce, padding: r = "0.85rem", ver
|
|
|
674
687
|
opacity: T.opacity
|
|
675
688
|
},
|
|
676
689
|
lockScroll: !0,
|
|
677
|
-
children: /* @__PURE__ */ _(
|
|
690
|
+
children: /* @__PURE__ */ _(de, {
|
|
678
691
|
ref: x.setFloating,
|
|
679
692
|
className: l,
|
|
680
693
|
role: "dialog",
|
|
681
694
|
size: f,
|
|
682
|
-
onClick:
|
|
695
|
+
onClick: K,
|
|
683
696
|
...C({
|
|
684
697
|
...h,
|
|
685
698
|
style: T
|
|
@@ -689,7 +702,7 @@ function le({ open: e, children: t, timeout: n = ce, padding: r = "0.85rem", ver
|
|
|
689
702
|
})
|
|
690
703
|
});
|
|
691
704
|
}
|
|
692
|
-
function
|
|
705
|
+
function de({ size: e, ...t }) {
|
|
693
706
|
return /* @__PURE__ */ _(F, {
|
|
694
707
|
classList: [e ? "flex flex-col bg-background shadow-lg p-5 rounded" : null, {
|
|
695
708
|
"w-full max-w-dialog-sm": e === "small",
|
|
@@ -701,7 +714,7 @@ function ue({ size: e, ...t }) {
|
|
|
701
714
|
}
|
|
702
715
|
//#endregion
|
|
703
716
|
//#region src/elements/Skeleton/index.tsx
|
|
704
|
-
function
|
|
717
|
+
function fe(e) {
|
|
705
718
|
return /* @__PURE__ */ _(F, {
|
|
706
719
|
classList: "inline-block animate-pulse rounded-md bg-accent",
|
|
707
720
|
...e
|
|
@@ -709,7 +722,7 @@ function de(e) {
|
|
|
709
722
|
}
|
|
710
723
|
//#endregion
|
|
711
724
|
//#region src/elements/Button/ButtonGroup.tsx
|
|
712
|
-
function
|
|
725
|
+
function pe(e) {
|
|
713
726
|
return /* @__PURE__ */ _(F, {
|
|
714
727
|
role: "group",
|
|
715
728
|
classList: [
|
|
@@ -722,34 +735,30 @@ function fe(e) {
|
|
|
722
735
|
}
|
|
723
736
|
//#endregion
|
|
724
737
|
//#region src/elements/Spinner/index.tsx
|
|
725
|
-
function
|
|
726
|
-
return /* @__PURE__ */ v(
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
})]
|
|
744
|
-
}), /* @__PURE__ */ _("span", {
|
|
745
|
-
className: "sr-only",
|
|
746
|
-
children: t
|
|
738
|
+
function me({ label: e = "Loading...", ...t }) {
|
|
739
|
+
return /* @__PURE__ */ v(F, {
|
|
740
|
+
as: "svg",
|
|
741
|
+
classList: "fill-accent animate-spin text-primary",
|
|
742
|
+
"aria-label": e,
|
|
743
|
+
"aria-hidden": "true",
|
|
744
|
+
width: "32",
|
|
745
|
+
height: "32",
|
|
746
|
+
viewBox: "0 0 100 101",
|
|
747
|
+
fill: "none",
|
|
748
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
749
|
+
...t,
|
|
750
|
+
children: [/* @__PURE__ */ _("path", {
|
|
751
|
+
d: "M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z",
|
|
752
|
+
fill: "currentFill"
|
|
753
|
+
}), /* @__PURE__ */ _("path", {
|
|
754
|
+
d: "M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z",
|
|
755
|
+
fill: "currentColor"
|
|
747
756
|
})]
|
|
748
757
|
});
|
|
749
758
|
}
|
|
750
759
|
//#endregion
|
|
751
760
|
//#region src/elements/Progress/index.tsx
|
|
752
|
-
function
|
|
761
|
+
function he({ value: e, max: t, ...n }) {
|
|
753
762
|
let r = p(() => e ? Math.min(100, Math.round(e / t * 100)) : 0, [e, t]);
|
|
754
763
|
return /* @__PURE__ */ _(F, {
|
|
755
764
|
role: "progressbar",
|
|
@@ -765,7 +774,7 @@ function pe({ value: e, max: t, ...n }) {
|
|
|
765
774
|
}
|
|
766
775
|
//#endregion
|
|
767
776
|
//#region src/elements/Divider/index.tsx
|
|
768
|
-
function
|
|
777
|
+
function ge({ orientation: e = "horizontal", ...t }) {
|
|
769
778
|
return /* @__PURE__ */ _(F, {
|
|
770
779
|
as: "hr",
|
|
771
780
|
role: "none",
|
|
@@ -775,11 +784,11 @@ function me({ orientation: e = "horizontal", ...t }) {
|
|
|
775
784
|
}
|
|
776
785
|
//#endregion
|
|
777
786
|
//#region src/components/Sheet/index.tsx
|
|
778
|
-
var
|
|
787
|
+
var _e = {
|
|
779
788
|
open: 250,
|
|
780
789
|
close: 150
|
|
781
790
|
};
|
|
782
|
-
function
|
|
791
|
+
function ve({ open: e, timeout: t = _e, onOpenChange: n, position: r = "right", overlay: i, onExited: a, onOpen: o, ...s }) {
|
|
783
792
|
let c = k(), l = m(!1), d = m(o), f = m(a), { refs: p, context: h } = D({
|
|
784
793
|
open: e,
|
|
785
794
|
onOpenChange: n,
|
|
@@ -802,7 +811,7 @@ function ge({ open: e, timeout: t = he, onOpenChange: n, position: r = "right",
|
|
|
802
811
|
}
|
|
803
812
|
f.current?.();
|
|
804
813
|
}
|
|
805
|
-
}, [g]), f.current = a, d.current = o, /* @__PURE__ */ v(
|
|
814
|
+
}, [g]), f.current = a, d.current = o, /* @__PURE__ */ v(G, {
|
|
806
815
|
disabled: !g,
|
|
807
816
|
children: [i ? /* @__PURE__ */ _(y, {
|
|
808
817
|
className: "bg-backdrop",
|
|
@@ -818,11 +827,11 @@ function ge({ open: e, timeout: t = he, onOpenChange: n, position: r = "right",
|
|
|
818
827
|
"bottom-0 left-0 right-0 w-full max-w-screen": r === "bottom"
|
|
819
828
|
}],
|
|
820
829
|
style: b,
|
|
821
|
-
children: /* @__PURE__ */ _(
|
|
830
|
+
children: /* @__PURE__ */ _(ye, { ...s })
|
|
822
831
|
})]
|
|
823
832
|
});
|
|
824
833
|
}
|
|
825
|
-
function
|
|
834
|
+
function ye(e) {
|
|
826
835
|
return /* @__PURE__ */ _(F, {
|
|
827
836
|
classList: "relative bg-background min-w-full min-h-full border border-input shadow-lg",
|
|
828
837
|
...e
|
|
@@ -830,8 +839,8 @@ function _e(e) {
|
|
|
830
839
|
}
|
|
831
840
|
//#endregion
|
|
832
841
|
//#region src/components/Toast/ToastItem.tsx
|
|
833
|
-
function
|
|
834
|
-
let { icons: r } =
|
|
842
|
+
function Z({ type: e, label: t, message: n }) {
|
|
843
|
+
let { icons: r } = Se();
|
|
835
844
|
return /* @__PURE__ */ v("div", {
|
|
836
845
|
className: "flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",
|
|
837
846
|
children: [e ? /* @__PURE__ */ v("figure", {
|
|
@@ -841,7 +850,7 @@ function Q({ type: e, label: t, message: n }) {
|
|
|
841
850
|
e === "info" && r?.info ? r.info : null,
|
|
842
851
|
e === "error" && r?.error ? r.error : null,
|
|
843
852
|
e === "warn" && r?.warn ? r.warn : null,
|
|
844
|
-
e === "loading" ?
|
|
853
|
+
e === "loading" ? r?.loading : null
|
|
845
854
|
]
|
|
846
855
|
}) : null, /* @__PURE__ */ v("div", {
|
|
847
856
|
className: "space-y-2",
|
|
@@ -854,12 +863,12 @@ function Q({ type: e, label: t, message: n }) {
|
|
|
854
863
|
}
|
|
855
864
|
//#endregion
|
|
856
865
|
//#region src/components/Toast/observer.ts
|
|
857
|
-
function
|
|
866
|
+
function Q() {}
|
|
858
867
|
var $ = new class {
|
|
859
|
-
notify =
|
|
868
|
+
notify = Q;
|
|
860
869
|
lastId = 0;
|
|
861
870
|
subscribe = (e) => (this.notify = e, () => {
|
|
862
|
-
this.notify =
|
|
871
|
+
this.notify = Q;
|
|
863
872
|
});
|
|
864
873
|
add = (e, t = {}) => {
|
|
865
874
|
this.lastId += 1;
|
|
@@ -893,7 +902,7 @@ var $ = new class {
|
|
|
893
902
|
}();
|
|
894
903
|
//#endregion
|
|
895
904
|
//#region src/components/Toast/ToastFloat.tsx
|
|
896
|
-
function
|
|
905
|
+
function be({ id: t, type: n, index: r, duration: i = 5e3, className: a, children: o, inverted: s, timeout: l = 250, max: d = 3 }) {
|
|
897
906
|
let g = m(!1), [v, y] = h(!1), { context: b, refs: x } = D({
|
|
898
907
|
open: v,
|
|
899
908
|
onOpenChange: y,
|
|
@@ -929,11 +938,11 @@ function ye({ id: t, type: n, index: r, duration: i = 5e3, className: a, childre
|
|
|
929
938
|
}
|
|
930
939
|
//#endregion
|
|
931
940
|
//#region src/components/Toast/index.tsx
|
|
932
|
-
var
|
|
933
|
-
function
|
|
934
|
-
return l(
|
|
941
|
+
var xe = i({});
|
|
942
|
+
function Se() {
|
|
943
|
+
return l(xe);
|
|
935
944
|
}
|
|
936
|
-
function
|
|
945
|
+
function Ce({ className: t, offset: n = {}, position: r = "top-left", max: i, ListItem: o = Z, icons: c }) {
|
|
937
946
|
let l = p(() => {
|
|
938
947
|
let e = {
|
|
939
948
|
position: "fixed",
|
|
@@ -941,7 +950,7 @@ function Se({ className: t, offset: n = {}, position: r = "top-left", max: i, Li
|
|
|
941
950
|
};
|
|
942
951
|
return Object.keys(n).length || (r.indexOf("top") > -1 ? e.top = "16px" : r.indexOf("bottom") > -1 && (e.bottom = "16px"), r.indexOf("left") > -1 ? e.left = "16px" : r.indexOf("right") > -1 && (e.right = "16px")), r.indexOf("left") > -1 ? e.alignItems = "flex-start" : r.indexOf("right") > -1 ? e.alignItems = "flex-end" : (e.left = "50%", e.alignItems = "center", e.transform = "translateX(-50%)"), e;
|
|
943
952
|
}, [n, r]), u = p(() => e("flex flex-col z-40 overflow-hidden", t), [t]), d = p(() => r?.startsWith("bottom") || !1, [r]), f = m(/* @__PURE__ */ new Map()), [g, v] = h([]), y = h(0)[1];
|
|
944
|
-
|
|
953
|
+
W(() => $.subscribe((e) => {
|
|
945
954
|
s(() => {
|
|
946
955
|
if (e.type === "add") f.current.set(e.id, e.config), v((t) => [...t, e.id]);
|
|
947
956
|
else if (e.type === "remove") {
|
|
@@ -961,17 +970,17 @@ function Se({ className: t, offset: n = {}, position: r = "top-left", max: i, Li
|
|
|
961
970
|
});
|
|
962
971
|
}), []);
|
|
963
972
|
let b = p(() => ({ icons: c }), [c]), x = g.length;
|
|
964
|
-
return /* @__PURE__ */ _(
|
|
973
|
+
return /* @__PURE__ */ _(G, { children: /* @__PURE__ */ _("ol", {
|
|
965
974
|
className: u,
|
|
966
975
|
style: l,
|
|
967
976
|
"aria-live": "polite",
|
|
968
|
-
children: /* @__PURE__ */ _(
|
|
977
|
+
children: /* @__PURE__ */ _(xe.Provider, {
|
|
969
978
|
value: b,
|
|
970
979
|
children: g.map((e, t) => {
|
|
971
980
|
let n = f.current.get(e);
|
|
972
981
|
if (!n) return null;
|
|
973
982
|
let { className: r, duration: s, ...c } = n;
|
|
974
|
-
return /* @__PURE__ */ _(
|
|
983
|
+
return /* @__PURE__ */ _(be, {
|
|
975
984
|
id: e,
|
|
976
985
|
index: x - t,
|
|
977
986
|
className: r,
|
|
@@ -985,4 +994,4 @@ function Se({ className: t, offset: n = {}, position: r = "top-left", max: i, Li
|
|
|
985
994
|
}) });
|
|
986
995
|
}
|
|
987
996
|
//#endregion
|
|
988
|
-
export {
|
|
997
|
+
export { se as Accordion, F as Base, ce as Button, pe as ButtonGroup, U as Checkbox, ue as Dialog, ge as Divider, R as FormField, L as FormLabel, B as Input, ee as InputField, q as Popover, G as Portal, he as Progress, ae as Radio, re as Select, ve as Sheet, fe as Skeleton, me as Spinner, oe as Switch, V as Textarea, Ce as Toast, Z as ToastItem, J as Tooltip, N as cn, I as element, P as merge, $ as toast, X as varientButton };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/visits-works/visits-style.git"
|
|
6
6
|
},
|
|
7
7
|
"homepage": "https://github.com/visits-works/visits-style",
|
|
8
|
-
"version": "2.2.
|
|
8
|
+
"version": "2.2.3",
|
|
9
9
|
"description": "VISITS Technologiesのreactデザインコンポーネント",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"main": "./dist/index.cjs.js",
|