freemium-ui 2.1.0-alpha.2 → 2.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/buildspec.yml +22 -0
- package/lib/Accordion-CxJ6ztSZ.js +77 -0
- package/lib/Accordion.d.ts +3 -3
- package/lib/Accordion.js +1 -1
- package/lib/Alert-BPH8XYOU.js +42 -0
- package/lib/Alert.d.ts +3 -3
- package/lib/Alert.js +1 -1
- package/lib/AutoComplete-CdBtOUqN.js +1 -0
- package/lib/AutoComplete.d.ts +3 -3
- package/lib/AutoComplete.js +1 -1
- package/lib/BoxedRadio-C6ryVJ-a.js +106 -0
- package/lib/BoxedRadio.d.ts +3 -2
- package/lib/BoxedRadio.js +1 -1
- package/lib/Button-38TrTrqS.js +41 -0
- package/lib/Button.d.ts +1 -1
- package/lib/Button.js +1 -1
- package/lib/ButtonDropdown-D1xgUjUG.js +19 -0
- package/lib/ButtonDropdown.d.ts +3 -3
- package/lib/ButtonDropdown.js +1 -1
- package/lib/Calendar-tmPfKbba.js +40 -0
- package/lib/Calendar.d.ts +1 -1
- package/lib/Calendar.js +1 -1
- package/lib/Checkbox-U3_actBa.js +51 -0
- package/lib/Checkbox.d.ts +3 -3
- package/lib/Checkbox.js +1 -1
- package/lib/ChevronUp-D_QXlMGy.js +1 -0
- package/lib/Combination-DRFSmqCF.js +1 -0
- package/lib/Confirmation-BhQHgouL.js +60 -0
- package/lib/Confirmation.d.ts +3 -3
- package/lib/Confirmation.js +1 -1
- package/lib/Cross-CgQhiy9a.js +1 -0
- package/lib/CustomizeColumns-BsRW9qk_.js +280 -0
- package/lib/Drawer-DQ0GjtiZ.js +43 -0
- package/lib/Drawer.d.ts +3 -3
- package/lib/Drawer.js +1 -1
- package/lib/Dropdown-CpOK0ioT.js +1 -0
- package/lib/Dropdown.d.ts +2 -1
- package/lib/Dropdown.js +1 -1
- package/lib/ErrorText-CXW7fI-6.js +8 -0
- package/lib/Info-f8YJOuUB.js +1 -0
- package/lib/Input.js +1 -1
- package/lib/Loader-DG6kODGn.js +11 -0
- package/lib/Loader.d.ts +3 -3
- package/lib/Loader.js +1 -1
- package/lib/Menu-Ca_uMNaw.js +1 -0
- package/lib/Menu.d.ts +4 -4
- package/lib/Menu.js +1 -1
- package/lib/Modal-D06mc76N.js +28 -0
- package/lib/Modal.d.ts +3 -3
- package/lib/Modal.js +1 -1
- package/lib/MultiSelectDropdown-D9xmLJJi.js +22 -0
- package/lib/MultiSelectDropdown.d.ts +3 -3
- package/lib/MultiSelectDropdown.js +1 -1
- package/lib/Pickers.d.ts +8 -8
- package/lib/Pickers.js +1 -1
- package/lib/Popover-CLUM02h3.js +32 -0
- package/lib/Popover.d.ts +3 -3
- package/lib/Popover.js +1 -1
- package/lib/Radio.d.ts +3 -3
- package/lib/Radio.js +1 -1
- package/lib/RadioGroup-D7JRiUe2.js +48 -0
- package/lib/Reorder-CU3gxznN.js +18 -0
- package/lib/Reorder.d.ts +3 -3
- package/lib/Reorder.js +1 -1
- package/lib/SortDropdown-DnRo1b3N.js +1 -0
- package/lib/SortDropdown.d.ts +3 -3
- package/lib/SortDropdown.js +1 -1
- package/lib/Table-D7KHCXPF.js +1 -0
- package/lib/Table.d.ts +3 -3
- package/lib/Table.js +1 -1
- package/lib/Tabs-Bg_F04qX.js +35 -0
- package/lib/Tabs.d.ts +3 -3
- package/lib/Tabs.js +1 -1
- package/lib/Tag-DKiVRzO2.js +57 -0
- package/lib/Tag.d.ts +1 -1
- package/lib/Tag.js +1 -1
- package/lib/TextArea-CojwXjXn.js +117 -0
- package/lib/ThemeProvider-D_TuxYL2.js +6 -0
- package/lib/ThemeProvider.d.ts +1 -1
- package/lib/ThemeProvider.js +1 -1
- package/lib/TickIcon-D8ryFR8A.js +1 -0
- package/lib/TimePicker-ChjG0ldT.js +420 -0
- package/lib/Toast.d.ts +2 -1
- package/lib/Toast.js +1 -1
- package/lib/ToastProvider-CjuJZDwB.js +107 -0
- package/lib/Toggle-D2210zUX.js +69 -0
- package/lib/Toggle.d.ts +3 -3
- package/lib/Toggle.js +1 -1
- package/lib/Tooltip-B8SNaMr7.js +37 -0
- package/lib/Tooltip.d.ts +3 -3
- package/lib/Tooltip.js +1 -1
- package/lib/Typography-B6f3UubR.js +10 -0
- package/lib/Typography.d.ts +1 -1
- package/lib/Typography.js +1 -1
- package/lib/WorkspaceTable-DzWFlI1y.js +1 -0
- package/lib/WorkspaceTable.d.ts +3 -3
- package/lib/WorkspaceTable.js +1 -1
- package/lib/allPaths-BGLT3REd.js +1 -0
- package/lib/allPathsLoader-BG8m5249.js +1 -0
- package/lib/index-B3ttnEEs.js +105 -0
- package/lib/index-Bw1WW_qt.js +1 -0
- package/lib/{index-CE1du0xY.js → index-CoSaDZpU.js} +1 -1
- package/lib/index-DP7HoUNK.js +1 -0
- package/lib/{index-M1OtTK_a.js → index-DYTeP_YW.js} +1 -1
- package/lib/index.d.ts +37 -152
- package/lib/index.js +11 -1
- package/lib/keyframes-0CSXUjw0.js +218 -0
- package/lib/rollup.config.d.ts.map +1 -1
- package/lib/splitPathsBySizeLoader-DiQmEHEe.js +1 -0
- package/lib/styled-components.browser.esm-8fYqm7jD.js +1 -0
- package/lib/styles-Bt3yA8NC.js +244 -0
- package/lib/styles-C_4H_GA0.js +61 -0
- package/lib/use-toasts-BHAC_cxV.js +1 -0
- package/package.json +3 -13
- package/lib/Accordion-GfcA3ZgZ.js +0 -1
- package/lib/Alert-CGy153ht.js +0 -1
- package/lib/AutoComplete-b66h_NUS.js +0 -1
- package/lib/BoxedRadio-D85xdSfZ.js +0 -1
- package/lib/Button-C2GQK5Zh.js +0 -1
- package/lib/ButtonDropdown-C7hte6jt.js +0 -1
- package/lib/Calendar-DXLwGw8x.js +0 -1
- package/lib/Checkbox-CmvqP6CF.js +0 -1
- package/lib/ChevronUp-DRezNiXX.js +0 -1
- package/lib/Combination-BnXRbEZN.js +0 -1
- package/lib/Confirmation-DrgDPGEA.js +0 -1
- package/lib/Cross-DdS-LVsP.js +0 -1
- package/lib/CustomizeColumns-C4n2OJYM.js +0 -1
- package/lib/Drawer-Cmp0KQ1Q.js +0 -1
- package/lib/Dropdown-COa39M_7.js +0 -1
- package/lib/ErrorText-Dx5455lJ.js +0 -1
- package/lib/Info-B1WTvfBE.js +0 -1
- package/lib/Loader-4OVmuWEs.js +0 -1
- package/lib/Menu-D4-ZsZLq.js +0 -1
- package/lib/Modal-CSiFmKti.js +0 -1
- package/lib/MultiSelectDropdown-kQGphHeJ.js +0 -1
- package/lib/Popover-aB29KjFO.js +0 -1
- package/lib/QuillEditor.d.ts +0 -29
- package/lib/QuillEditor.js +0 -1
- package/lib/README.md +0 -87
- package/lib/RadioGroup-Bsa_3Ql9.js +0 -1
- package/lib/Reorder-0k-SbTSk.js +0 -1
- package/lib/SortDropdown-BZflsvUQ.js +0 -1
- package/lib/Table-Pye13AY-.js +0 -1
- package/lib/Tabs-Dbv9GKzK.js +0 -1
- package/lib/Tag-0QcI7IQK.js +0 -1
- package/lib/TextArea-DAiKr3Eo.js +0 -1
- package/lib/ThemeProvider-xbEFisIa.js +0 -1
- package/lib/TickIcon-Bf575C6Y.js +0 -1
- package/lib/TimePicker-CSjxqxLC.js +0 -1
- package/lib/ToastProvider-Crm67sLo.js +0 -1
- package/lib/Toggle-DHCe0fpc.js +0 -1
- package/lib/Tooltip-CMUfHK_x.js +0 -1
- package/lib/Typography-W1bHgokt.js +0 -1
- package/lib/WorkspaceTable-DxMfXQNC.js +0 -1
- package/lib/_commonjsHelpers-lGe4XDVY.js +0 -1
- package/lib/allPaths-Dx4FPkk6.js +0 -1
- package/lib/allPathsLoader-joEwOfzx.js +0 -1
- package/lib/index-1TMKcHYv.js +0 -1
- package/lib/index-C9JIXGfH.js +0 -1
- package/lib/index-DnaNxNje.js +0 -1
- package/lib/isTypedArray-CZN823zL.js +0 -1
- package/lib/keyframes-CyBRv3OJ.js +0 -1
- package/lib/package.json +0 -217
- package/lib/splitPathsBySizeLoader-1R-16f2n.js +0 -1
- package/lib/styled-components.browser.esm-89g2oVoD.js +0 -1
- package/lib/styles-DRQuy2Oc.js +0 -1
- package/lib/styles-Ga0MfVzP.js +0 -1
- package/lib/use-toasts-DsMERYYR.js +0 -1
package/lib/Toast.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
import React$1 from 'react';
|
|
3
4
|
|
|
4
5
|
type ToastTypes = 'success' | 'warning' | 'error' | 'info';
|
|
@@ -51,7 +52,7 @@ interface ToastContextType {
|
|
|
51
52
|
interface ToastProviderProps extends Pick<ToastContextType, 'retainOnHover' | 'retainOnWindowBlur'> {
|
|
52
53
|
children: React$1.ReactNode;
|
|
53
54
|
}
|
|
54
|
-
declare const ToastProvider: ({ children, retainOnHover, retainOnWindowBlur, }: ToastProviderProps) =>
|
|
55
|
+
declare const ToastProvider: ({ children, retainOnHover, retainOnWindowBlur, }: ToastProviderProps) => react_jsx_runtime.JSX.Element;
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* useToasts is a custom hook that returns the toasts and a function to add a new toast.
|
package/lib/Toast.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{T as ToastProvider}from"./ToastProvider-
|
|
1
|
+
export{T as ToastProvider}from"./ToastProvider-CjuJZDwB.js";export{u as useToasts}from"./use-toasts-BHAC_cxV.js";import"./styled-components.browser.esm-8fYqm7jD.js";import"react";import"./index-DP7HoUNK.js";import"react-dom";import"./index-CMYH5FSo.js";import"./index-D4pfkNFk.js";import"./index-BCBGGtXO.js";import"./index-BJXW8qXz.js";import"./index-CGIN8I3H.js";import"./index-BrmsftDQ.js";import"./index-9P5loDNm.js";import"./keyframes-0CSXUjw0.js";import"./index-Bw1WW_qt.js";import"./index-B3ttnEEs.js";import"./Cross-CgQhiy9a.js";import"./Info-f8YJOuUB.js";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import{u as e,a as t,e as n,j as o}from"./styled-components.browser.esm-8fYqm7jD.js";import r,{useState as s,useEffect as a,useRef as i,createElement as l,useCallback as c,forwardRef as d,useMemo as p,Fragment as u}from"react";import{g as m}from"./index-DP7HoUNK.js";import{createPortal as w}from"react-dom";import{$ as x,a as f,_ as v,d as h}from"./index-CMYH5FSo.js";import{a as y,$ as C}from"./index-D4pfkNFk.js";import{$ as g}from"./index-BJXW8qXz.js";import{$ as T,b as E,c as b}from"./index-BCBGGtXO.js";import{b as L,c as P,a as j}from"./index-CGIN8I3H.js";import{$}from"./index-BrmsftDQ.js";import{a as k}from"./index-9P5loDNm.js";import{y as S,z as R}from"./keyframes-0CSXUjw0.js";import{Z as D,h as M}from"./index-Bw1WW_qt.js";import{T as I}from"./index-B3ttnEEs.js";import{C as F}from"./Cross-CgQhiy9a.js";import{I as _}from"./Info-f8YJOuUB.js";const N=e=>{const t=document.createElement("div");return t.setAttribute("id",e),t},A="ToastProvider",[O,K,z]=g("Toast"),[Z,B]=T("Toast",[z]),[V,H]=Z(A),W=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:r="right",swipeThreshold:a=50,children:d}=e,[p,u]=s(null),[m,w]=s(0),x=i(!1),f=i(!1);return l(O.Provider,{scope:t},l(V,{scope:t,label:n,duration:o,swipeDirection:r,swipeThreshold:a,toastCount:m,viewport:p,onViewportChange:u,onToastAdd:c((()=>w((e=>e+1))),[]),onToastRemove:c((()=>w((e=>e-1))),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:f},d))};W.propTypes={label:e=>e.label&&"string"==typeof e.label&&!e.label.trim()?Error(`Invalid prop \`label\` supplied to \`${A}\`. Expected non-empty \`string\`.`):null};const q=["F8"],U="toast.viewportPause",X="toast.viewportResume",Y=d(((e,t)=>{const{__scopeToast:n,hotkey:o=q,label:r="Notifications ({hotkey})",...s}=e,d=H("ToastViewport",n),p=K(n),u=i(null),m=i(null),w=i(null),h=i(null),y=x(t,h,d.onViewportChange),C=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=d.toastCount>0;a((()=>{const e=e=>{var t;o.every((t=>e[t]||e.code===t))&&(null===(t=h.current)||void 0===t||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[o]),a((()=>{const e=u.current,t=h.current;if(g&&e&&t){const n=()=>{if(!d.isClosePausedRef.current){const e=new CustomEvent(U);t.dispatchEvent(e),d.isClosePausedRef.current=!0}},o=()=>{if(d.isClosePausedRef.current){const e=new CustomEvent(X);t.dispatchEvent(e),d.isClosePausedRef.current=!1}},r=t=>{!e.contains(t.relatedTarget)&&o()},s=()=>{e.contains(document.activeElement)||o()};return e.addEventListener("focusin",n),e.addEventListener("focusout",r),e.addEventListener("pointermove",n),e.addEventListener("pointerleave",s),window.addEventListener("blur",n),window.addEventListener("focus",o),()=>{e.removeEventListener("focusin",n),e.removeEventListener("focusout",r),e.removeEventListener("pointermove",n),e.removeEventListener("pointerleave",s),window.removeEventListener("blur",n),window.removeEventListener("focus",o)}}}),[g,d.isClosePausedRef]);const T=c((({tabbingDirection:e})=>{const t=p().map((t=>{const n=t.ref.current,o=[n,...pe(n)];return"forwards"===e?o:o.reverse()}));return("forwards"===e?t.reverse():t).flat()}),[p]);return a((()=>{const e=h.current;if(e){const t=t=>{if("Tab"===t.key&&!(t.altKey||t.ctrlKey||t.metaKey)){const s=document.activeElement,a=t.shiftKey;var n;if(t.target===e&&a)return void(null===(n=m.current)||void 0===n||n.focus());const i=T({tabbingDirection:a?"backwards":"forwards"}),l=i.findIndex((e=>e===s));var o,r;ue(i.slice(l+1))?t.preventDefault():a?null===(o=m.current)||void 0===o||o.focus():null===(r=w.current)||void 0===r||r.focus()}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}}),[p,T]),l(L,{ref:u,role:"region","aria-label":r.replace("{hotkey}",C),tabIndex:-1,style:{pointerEvents:g?void 0:"none"}},g&&l(G,{ref:m,onFocusFromOutsideViewport:()=>{ue(T({tabbingDirection:"forwards"}))}}),l(O.Slot,{scope:n},l(f.ol,v({tabIndex:-1},s,{ref:y}))),g&&l(G,{ref:w,onFocusFromOutsideViewport:()=>{ue(T({tabbingDirection:"backwards"}))}}))})),G=d(((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...r}=e,s=H("ToastFocusProxy",n);return l(k,v({"aria-hidden":!0,tabIndex:0},r,{ref:t,style:{position:"fixed"},onFocus:e=>{var t;(null===(t=s.viewport)||void 0===t||!t.contains(e.relatedTarget))&&o()}}))})),J="Toast",Q=d(((e,t)=>{const{forceMount:n,open:o,defaultOpen:r,onOpenChange:s,...a}=e,[i=!0,c]=y({prop:o,defaultProp:r,onChange:s});return l($,{present:n||i},l(ne,v({open:i},a,{ref:t,onClose:()=>c(!1),onPause:E(e.onPause),onResume:E(e.onResume),onSwipeStart:C(e.onSwipeStart,(e=>{e.currentTarget.setAttribute("data-swipe","start")})),onSwipeMove:C(e.onSwipeMove,(e=>{const{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",t+"px"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",n+"px")})),onSwipeCancel:C(e.onSwipeCancel,(e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")})),onSwipeEnd:C(e.onSwipeEnd,(e=>{const{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",t+"px"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",n+"px"),c(!1)}))})))})),[ee,te]=Z(J,{onClose(){}}),ne=d(((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:r,open:d,onClose:m,onEscapeKeyDown:h,onPause:y,onResume:g,onSwipeStart:T,onSwipeMove:b,onSwipeCancel:L,onSwipeEnd:j,...$}=e,k=H(J,n),[S,R]=s(null),D=x(t,(e=>R(e))),M=i(null),I=i(null),F=r||k.duration,_=i(0),N=i(F),A=i(0),{onToastAdd:K,onToastRemove:z}=k,Z=E((()=>{var e;(null==S?void 0:S.contains(document.activeElement))&&(null===(e=k.viewport)||void 0===e||e.focus()),m()})),B=c((e=>{e&&e!==1/0&&(window.clearTimeout(A.current),_.current=(new Date).getTime(),A.current=window.setTimeout(Z,e))}),[Z]);a((()=>{const e=k.viewport;if(e){const t=()=>{B(N.current),null==g||g()},n=()=>{const e=(new Date).getTime()-_.current;N.current=N.current-e,window.clearTimeout(A.current),null==y||y()};return e.addEventListener(U,n),e.addEventListener(X,t),()=>{e.removeEventListener(U,n),e.removeEventListener(X,t)}}}),[k.viewport,F,y,g,B]),a((()=>{d&&!k.isClosePausedRef.current&&B(F)}),[d,F,k.isClosePausedRef,B]),a((()=>(K(),()=>z())),[K,z]);const V=p((()=>S?le(S):null),[S]);return k.viewport?l(u,null,V&&l(oe,{__scopeToast:n,role:"status","aria-live":"foreground"===o?"assertive":"polite","aria-atomic":!0},V),l(ee,{scope:n,onClose:Z},w(l(O.ItemSlot,{scope:n},l(P,{asChild:!0,onEscapeKeyDown:C(h,(()=>{k.isFocusedToastEscapeKeyDownRef.current||Z(),k.isFocusedToastEscapeKeyDownRef.current=!1}))},l(f.li,v({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":d?"open":"closed","data-swipe-direction":k.swipeDirection},$,{ref:D,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:C(e.onKeyDown,(e=>{"Escape"===e.key&&(null==h||h(e.nativeEvent),e.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,Z()))})),onPointerDown:C(e.onPointerDown,(e=>{0===e.button&&(M.current={x:e.clientX,y:e.clientY})})),onPointerMove:C(e.onPointerMove,(e=>{if(!M.current)return;const t=e.clientX-M.current.x,n=e.clientY-M.current.y,o=!!I.current,r=["left","right"].includes(k.swipeDirection),s=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,a=r?s(0,t):0,i=r?0:s(0,n),l="touch"===e.pointerType?10:2,c={x:a,y:i},d={originalEvent:e,delta:c};o?(I.current=c,ce("toast.swipeMove",b,d,{discrete:!1})):de(c,k.swipeDirection,l)?(I.current=c,ce("toast.swipeStart",T,d,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>l||Math.abs(n)>l)&&(M.current=null)})),onPointerUp:C(e.onPointerUp,(e=>{const t=I.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),I.current=null,M.current=null,t){const n=e.currentTarget,o={originalEvent:e,delta:t};de(t,k.swipeDirection,k.swipeThreshold)?ce("toast.swipeEnd",j,o,{discrete:!0}):ce("toast.swipeCancel",L,o,{discrete:!0}),n.addEventListener("click",(e=>e.preventDefault()),{once:!0})}}))})))),k.viewport))):null}));ne.propTypes={type:e=>e.type&&!["foreground","background"].includes(e.type)?Error(`Invalid prop \`type\` supplied to \`${J}\`. Expected \`foreground | background\`.`):null};const oe=e=>{const{__scopeToast:t,children:n,...o}=e,r=H(J,t),[i,c]=s(!1),[d,p]=s(!1);return function(e=(()=>{})){const t=E(e);b((()=>{let e=0,n=0;return e=window.requestAnimationFrame((()=>n=window.requestAnimationFrame(t))),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}}),[t])}((()=>c(!0))),a((()=>{const e=window.setTimeout((()=>p(!0)),1e3);return()=>window.clearTimeout(e)}),[]),d?null:l(j,{asChild:!0},l(k,o,i&&l(u,null,r.label," ",n)))},re=d(((e,t)=>{const{__scopeToast:n,...o}=e;return l(f.div,v({},o,{ref:t}))})),se=d(((e,t)=>{const{altText:n,...o}=e;return n?l(ie,{altText:n,asChild:!0},l(ae,v({},o,{ref:t}))):null}));se.propTypes={altText:e=>e.altText?null:Error("Missing prop `altText` expected on `ToastAction`")};const ae=d(((e,t)=>{const{__scopeToast:n,...o}=e,r=te("ToastClose",n);return l(ie,{asChild:!0},l(f.button,v({type:"button"},o,{ref:t,onClick:C(e.onClick,r.onClose)})))})),ie=d(((e,t)=>{const{__scopeToast:n,altText:o,...r}=e;return l(f.div,v({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0},r,{ref:t}))}));function le(e){const t=[];return Array.from(e.childNodes).forEach((e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&!e.ariaHidden&&!e.hidden&&"none"!==e.style.display)if(""===e.dataset.radixToastAnnounceExclude){const n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...le(e))})),t}function ce(e,t,n,{discrete:o}){const r=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?h(r,s):r.dispatchEvent(s)}const de=(e,t,n=0)=>{const o=Math.abs(e.x),r=Math.abs(e.y),s=o>r;return"left"===t||"right"===t?s&&o>n:!s&&r>n};function pe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type||0>e.tabIndex?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});for(;n.nextNode();)t.push(n.currentNode);return t}function ue(e){const t=document.activeElement;return e.some((e=>e===t||(e.focus(),document.activeElement!==t)))}const me=Y,we=Q,xe=re,fe=se,ve=e(W)``;e.div`
|
|
2
|
+
border-top: 4px solid;
|
|
3
|
+
`;const he=e(we)`
|
|
4
|
+
direction: ${({theme:e})=>e.direction};
|
|
5
|
+
&[data-state='open']:nth-last-of-type(1) {
|
|
6
|
+
z-index: ${({theme:e})=>(e.zIndex.snackbar||D.snackbar)-1};
|
|
7
|
+
opacity: 1 !important;
|
|
8
|
+
transform: translate3d(0px, 0px, 0px) scale(1);
|
|
9
|
+
}
|
|
10
|
+
&[data-state='open']:nth-last-of-type(2) {
|
|
11
|
+
z-index: ${({theme:e})=>(e.zIndex.snackbar||D.snackbar)-2};
|
|
12
|
+
opacity: 0.8 !important;
|
|
13
|
+
box-shadow: 0px 2px 9px ${({theme:e})=>M(e.colors.shadow,.1)};
|
|
14
|
+
transform: translate3d(0px, 15%, 0px) scale(0.95);
|
|
15
|
+
}
|
|
16
|
+
&[data-state='open']:nth-last-of-type(3) {
|
|
17
|
+
z-index: ${({theme:e})=>(e.zIndex.snackbar||D.snackbar)-3};
|
|
18
|
+
opacity: 0.6 !important;
|
|
19
|
+
box-shadow: 0px 2px 9px ${({theme:e})=>M(e.colors.shadow,.1)};
|
|
20
|
+
transform: translate3d(0px, 30%, 0px) scale(0.9);
|
|
21
|
+
}
|
|
22
|
+
&[data-state='open']:nth-last-of-type(4) {
|
|
23
|
+
z-index: ${({theme:e})=>(e.zIndex.snackbar||D.snackbar)-4};
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transform: translate3d(0px, 0, 0px) scale(0.85);
|
|
26
|
+
}
|
|
27
|
+
&[data-state='open']:not(:nth-last-of-type(1)),
|
|
28
|
+
&[data-state='open']:not(:nth-last-of-type(2)),
|
|
29
|
+
&[data-state='open']:not(:nth-last-of-type(3)),
|
|
30
|
+
&[data-state='open']:not(:nth-last-of-type(4)) {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
}
|
|
33
|
+
&[data-state='open'] {
|
|
34
|
+
animation-name: ${S};
|
|
35
|
+
}
|
|
36
|
+
animation-duration: ${({theme:e})=>e.transitions.duration.standard};
|
|
37
|
+
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeIn};
|
|
38
|
+
will-change: transform, opacity;
|
|
39
|
+
position: absolute;
|
|
40
|
+
order: ${({toastIndex:e})=>e+1};
|
|
41
|
+
background: ${({theme:e})=>e.colors.fill.surface};
|
|
42
|
+
border: 1px solid ${({theme:e})=>e.colors.border.light};
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
box-shadow:
|
|
45
|
+
0px 2px 16px ${({theme:e})=>M(e.colors.shadow,.16)},
|
|
46
|
+
0px 2px 4px ${({theme:e})=>M(e.colors.shadow,.06)};
|
|
47
|
+
|
|
48
|
+
width: 400px;
|
|
49
|
+
transition: all 0.3s ease-in-out;
|
|
50
|
+
`,ye=e(xe)`
|
|
51
|
+
text-align: ${({theme:e})=>"ltr"===e.direction?"left":"right"};
|
|
52
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
53
|
+
font-size: ${({theme:e})=>e.typography.primary.fontSize};
|
|
54
|
+
font-weight: 500;
|
|
55
|
+
line-height: ${({theme:e})=>e.typography.primary.lineHeight};
|
|
56
|
+
color: ${({theme:e})=>e.colors.text.primary};
|
|
57
|
+
flex: 1;
|
|
58
|
+
`,Ce=e(fe)``,ge=e(me)`
|
|
59
|
+
position: fixed;
|
|
60
|
+
top: 16px;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
align-items: ${({theme:e})=>e.components.toast.position};
|
|
64
|
+
right: ${({theme:e})=>"end"===e.components.toast.position?"16px":"unset"};
|
|
65
|
+
left: ${({theme:e})=>"start"===e.components.toast.position?"16px":"center"===e.components.toast.position?"50%":"unset"};
|
|
66
|
+
margin: 0;
|
|
67
|
+
list-style: none;
|
|
68
|
+
z-index: ${({theme:e})=>e.zIndex.snackbar||D.snackbar};
|
|
69
|
+
outline: none;
|
|
70
|
+
width: fit-content;
|
|
71
|
+
padding: 0;
|
|
72
|
+
&:hover {
|
|
73
|
+
gap: 8px;
|
|
74
|
+
li[data-state='open']:nth-last-of-type(1) {
|
|
75
|
+
opacity: 1 !important;
|
|
76
|
+
transform: translate3d(0px 0px, 0px) scale(1) !important;
|
|
77
|
+
}
|
|
78
|
+
li[data-state='open']:nth-last-of-type(2) {
|
|
79
|
+
opacity: 1 !important;
|
|
80
|
+
transform: translate3d(0px, calc(100% + 8px), 0px) scale(1) !important;
|
|
81
|
+
}
|
|
82
|
+
li[data-state='open']:nth-last-of-type(3) {
|
|
83
|
+
opacity: 1 !important;
|
|
84
|
+
transform: translate3d(0px, calc(200% + 16px), 0px) scale(1) !important;
|
|
85
|
+
}
|
|
86
|
+
.ToastProgress {
|
|
87
|
+
animation-play-state: paused;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`,Te=e.div`
|
|
91
|
+
direction: ${({theme:e})=>e.direction};
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
padding: 16px;
|
|
95
|
+
gap: 8px;
|
|
96
|
+
`,Ee=e.div`
|
|
97
|
+
height: 4px;
|
|
98
|
+
background-color: ${({theme:e,toastType:t="success"})=>e.colors.text.semantic[t]};
|
|
99
|
+
border-radius: 4px 4px 0 0;
|
|
100
|
+
|
|
101
|
+
${({delay:e,windowState:n})=>"none"===e?"width: 100%;":t`
|
|
102
|
+
width: 0%;
|
|
103
|
+
animation: ${R} ${e}ms linear
|
|
104
|
+
${"focus"===n?"running":"paused"};
|
|
105
|
+
will-change: width;
|
|
106
|
+
`}
|
|
107
|
+
`,be=r.createContext({toasts:[],windowState:"focus",retainOnHover:!0,retainOnWindowBlur:!1,addToast:()=>{},updateToasts:()=>{}}),Le=e=>{const t=n();return o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16C12.4183 16 16 12.4183 16 8C16 5.87827 15.1571 3.84344 13.6569 2.34315C12.1566 0.842855 10.1217 0 8 0ZM8 14.6C4.35492 14.6 1.4 11.6451 1.4 8C1.4 4.35492 4.35492 1.4 8 1.4C11.6451 1.4 14.6 4.35492 14.6 8C14.5945 11.6428 11.6428 14.5945 8 14.6ZM9 8L10.82 6.17L10.83 6.18C11.1061 5.90386 11.1061 5.45614 10.83 5.18C10.5539 4.90386 10.1061 4.90386 9.83 5.18L8 7L6.18 5.17C5.90386 4.89386 5.45614 4.89386 5.18 5.17C4.90386 5.44614 4.90386 5.89386 5.18 6.17L7 8L5.17 9.82C4.89386 10.0961 4.89386 10.5439 5.17 10.82C5.44614 11.0961 5.89386 11.0961 6.17 10.82L8 9L9.83 10.83C10.1061 11.1061 10.5539 11.1061 10.83 10.83C11.1061 10.5539 11.1061 10.1061 10.83 9.83L9 8Z",fill:t.colors.text.semantic.error})})},Pe=e=>{const t=n();return o.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 7.87827 17.1571 5.84344 15.6569 4.34315C14.1566 2.84286 12.1217 2 10 2ZM9.99999 16.6C6.35491 16.6 3.39999 13.6451 3.39999 10C3.39999 6.35493 6.35491 3.40001 9.99999 3.40001C13.6451 3.40001 16.6 6.35493 16.6 10C16.5945 13.6428 13.6428 16.5945 9.99999 16.6ZM14.0045 7.83C14.0045 7.64099 13.927 7.46025 13.79 7.33C13.5144 7.06199 13.0756 7.06199 12.8 7.33L9 11.18L7.21 9.41C7.03137 9.23136 6.771 9.1616 6.52699 9.22698C6.28297 9.29237 6.09237 9.48297 6.02699 9.72698C5.9616 9.971 6.03137 10.2314 6.21 10.41L8.45 12.67C8.7268 12.9446 9.1732 12.9446 9.45 12.67L13.79 8.33C13.927 8.19974 14.0045 8.01901 14.0045 7.83Z",fill:t.colors.text.semantic.success})})},je=e=>{const t=n();return o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 10C2 5.58172 5.58172 2 10 2C12.1217 2 14.1566 2.84286 15.6569 4.34315C17.1571 5.84344 18 7.87827 18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10ZM3.39999 10C3.39999 13.6451 6.35491 16.6 9.99999 16.6C13.6428 16.5945 16.5945 13.6428 16.6 10C16.6 6.35493 13.6451 3.40001 9.99999 3.40001C6.35491 3.40001 3.39999 6.35493 3.39999 10Z",fill:t.colors.text.semantic.warning}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12.8668C9 12.3145 9.44771 11.8668 10 11.8668C10.5523 11.8668 11 12.3145 11 12.8668C11 13.4191 10.5523 13.8668 10 13.8668C9.44771 13.8668 9 13.4191 9 12.8668ZM9.99951 10.9268C10.387 10.9268 10.7012 10.6127 10.7012 10.2252V6.48847C10.7012 6.10096 10.387 5.78681 9.99951 5.78681C9.612 5.78681 9.29785 6.10096 9.29785 6.48847V10.2252C9.29785 10.6127 9.612 10.9268 9.99951 10.9268Z",fill:t.colors.text.semantic.warning})]})},$e=({index:e,customIcon:t,id:s,fixed:a,text:i,showProgress:l=!1,delay:c=3e3,type:d="info"})=>{const p=n(),{updateToasts:u,windowState:m,retainOnWindowBlur:w,retainOnHover:x}=r.useContext(be)??{},f=r.useRef(null),[v,h]=r.useState(!1);r.useEffect((()=>{const e=window.setTimeout((()=>{a||v&&x||w||u((e=>e.filter((e=>e.id!==s))))}),c);return()=>clearTimeout(e)}),[c,a,s,u,v,x,w]);const y={success:o.jsx(Pe,{fill:p.colors.text.semantic.success}),warning:o.jsx(je,{fill:p.colors.text.semantic.warning}),error:o.jsx(Le,{fill:p.colors.text.semantic.error}),info:o.jsx(_,{fill:p.colors.text.semantic.info})};return o.jsx(o.Fragment,{children:o.jsxs(he,{role:"alert","aria-live":"polite",ref:f,toastType:d,dir:p.direction,style:a||!l?{borderTop:"none"}:void 0,toastIndex:e,className:("ToastRoot Toast-"+(s??"")).trim(),duration:a?1/0:c,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),onOpenChange:e=>{e||u((e=>e.filter((e=>e.id!==s))))},children:[o.jsx(Ee,{className:"ToastProgress",windowState:m,toastType:d,delay:!a&&l?c:"none"}),o.jsxs(Te,{children:[t??y[d],o.jsx(ye,{className:"ToastTitle",children:i}),o.jsx(Ce,{className:"ToastAction",asChild:!0,altText:"Close","aria-label":"Close",children:o.jsx(I,{children:o.jsx(F,{fill:p.colors.text.primary})})})]})]})})},ke=()=>{const e=((e=m())=>{const t="ui-"+e,{isBrowser:n}=(()=>{const[e,t]=s(!1);return a((()=>{t(!("undefined"==typeof window||!window.document||!window.document.createElement))}),[]),{isBrowser:e,isServer:!e}})(),[o,r]=s(n?N(t):null);return a((()=>{const e=document.querySelector("#"+t),n=e||N(t);e||document.body.appendChild(n),r(n)}),[]),o})("toast"),{toasts:t}=r.useContext(be)??{};return e?w(o.jsx(o.Fragment,{children:o.jsxs(ve,{swipeDirection:"up",children:[t.map(((e,t)=>o.jsx($e,{...e,index:t},"Toast-"+e.id))),o.jsx(ge,{className:"ToastViewport"})]})}),e):null},Se=({children:e,retainOnHover:t=!0,retainOnWindowBlur:n=!1})=>{const[s,a]=r.useState("focus"),[i,l]=r.useState([]),c=r.useCallback((e=>{l((t=>[{...e,id:m(),state:"open"},...t]))}),[]),d=r.useCallback((e=>{l((t=>e(t)))}),[]),p=r.useMemo((()=>({toasts:i,addToast:c,windowState:s,updateToasts:d,retainOnWindowBlur:n,retainOnHover:t})),[i,c,s,d,t,n]);return r.useEffect((()=>(window.addEventListener&&n&&(window.addEventListener("focus",(()=>{a("focus")}),!1),window.addEventListener("blur",(()=>{a("blur")}),!1)),()=>{n&&(window.removeEventListener("focus",(()=>{})),window.removeEventListener("blur",(()=>{})))})),[n]),o.jsxs(be.Provider,{value:p,children:[o.jsx(ke,{}),e]})};export{Se as T,be as a};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import{u as e,e as o,j as t}from"./styled-components.browser.esm-8fYqm7jD.js";import{$ as r,a,_ as s}from"./index-CMYH5FSo.js";import{forwardRef as n,useState as i,useRef as d,createElement as c,useEffect as h}from"react";import{a as l,$ as m}from"./index-D4pfkNFk.js";import{$ as p}from"./index-BCBGGtXO.js";import{$ as f}from"./index-DZzFKxNs.js";import{$ as u}from"./index-Bj96NGNJ.js";import{C as b}from"./Cross-CgQhiy9a.js";import{T as g}from"./TickIcon-D8ryFR8A.js";const x="Switch",[w,k]=p(x),[$,v]=w(x),j=n(((e,o)=>{const{__scopeSwitch:t,name:n,checked:h,defaultChecked:p,required:f,disabled:u,value:b="on",onCheckedChange:g,...x}=e,[w,k]=i(null),v=r(o,(e=>k(e))),j=d(!1),C=!w||!!w.closest("form"),[z=!1,q]=l({prop:h,defaultProp:p,onChange:g});return c($,{scope:t,checked:z,disabled:u},c(a.button,s({type:"button",role:"switch","aria-checked":z,"aria-required":f,"data-state":y(z),"data-disabled":u?"":void 0,disabled:u,value:b},x,{ref:v,onClick:m(e.onClick,(e=>{q((e=>!e)),C&&(j.current=e.isPropagationStopped(),j.current||e.stopPropagation())}))})),C&&c(T,{control:w,bubbles:!j.current,name:n,value:b,checked:z,required:f,disabled:u,style:{transform:"translateX(-100%)"}}))})),T=e=>{const{control:o,checked:t,bubbles:r=!0,...a}=e,n=d(null),i=f(t),l=u(o);return h((()=>{const e=n.current,o=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(o,"checked").set;if(i!==t&&a){const o=new Event("click",{bubbles:r});a.call(e,t),e.dispatchEvent(o)}}),[i,t,r]),c("input",s({type:"checkbox","aria-hidden":!0,defaultChecked:t},a,{tabIndex:-1,ref:n,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function y(e){return e?"checked":"unchecked"}const C=n(((e,o)=>{const{__scopeSwitch:t,...r}=e,n=v("SwitchThumb",t);return c(a.span,s({"data-state":y(n.checked),"data-disabled":n.disabled?"":void 0},r,{ref:o}))})),z={sm:{width:28,height:12,thumb:16,offTransform:[-2,-2],onTransform:[14,-2]},md:{width:36,height:16,thumb:20,offTransform:[-2,-2],onTransform:[18,-2]},lg:{width:44,height:20,thumb:24,offTransform:[-2,-2],onTransform:[22,-2]}},q=e(j)`
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
outline: 0;
|
|
5
|
+
border: none;
|
|
6
|
+
position: relative;
|
|
7
|
+
width: ${({size:e})=>z[e].width}px;
|
|
8
|
+
height: ${({size:e})=>z[e].height}px;
|
|
9
|
+
border-radius: ${({size:e})=>z[e].height/2}px;
|
|
10
|
+
direction: ltr !important;
|
|
11
|
+
&[data-disabled] {
|
|
12
|
+
opacity: 0.5;
|
|
13
|
+
}
|
|
14
|
+
&[data-state='unchecked'] {
|
|
15
|
+
background-color: ${({theme:e})=>e.colors.border.hover};
|
|
16
|
+
&:focus {
|
|
17
|
+
span {
|
|
18
|
+
box-shadow: 0 0 0 1px ${({theme:e})=>e.colors.border.hover};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
&[data-state='checked'] {
|
|
23
|
+
background-color: ${({theme:e})=>e.colors.common.accent};
|
|
24
|
+
&:focus {
|
|
25
|
+
span {
|
|
26
|
+
box-shadow: 0 0 0 1px ${({theme:e})=>e.colors.border.active};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`,E=e(C)`
|
|
31
|
+
display: grid;
|
|
32
|
+
place-content: center;
|
|
33
|
+
width: ${({size:e})=>z[e].thumb}px;
|
|
34
|
+
height: ${({size:e})=>z[e].thumb}px;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
direction: ltr !important;
|
|
37
|
+
background-color: ${({theme:e})=>e.colors.common.white};
|
|
38
|
+
transition: transform 100ms;
|
|
39
|
+
transform: translate(
|
|
40
|
+
${({theme:e,size:o})=>("ltr"===e.direction?z[o].offTransform:z[o].onTransform).map((e=>e+"px")).join(",")}
|
|
41
|
+
) !important;
|
|
42
|
+
will-change: transform;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
&[data-state='unchecked']:not([data-disabled]) {
|
|
45
|
+
&:hover {
|
|
46
|
+
box-shadow: 0 0 0 3px ${({theme:e})=>e.colors.border.hover}30;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
&[data-state='unchecked'] {
|
|
50
|
+
border: 1px solid ${({theme:e})=>e.colors.border.hover};
|
|
51
|
+
svg.toggle-on {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
&[data-state='checked']:not([data-disabled]) {
|
|
56
|
+
&:hover {
|
|
57
|
+
box-shadow: 0 0 0 3px ${({theme:e})=>e.colors.border.active}30;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
&[data-state='checked'] {
|
|
61
|
+
transform: translate(
|
|
62
|
+
${({theme:e,size:o})=>("ltr"===e.direction?z[o].onTransform:z[o].offTransform).map((e=>e+"px")).join(",")}
|
|
63
|
+
) !important;
|
|
64
|
+
border: 1px solid ${({theme:e})=>e.colors.common.accent};
|
|
65
|
+
svg.toggle-off {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`,P={sm:{width:6,height:4.3},md:{width:8,height:5.73},lg:{width:10,height:7.16}},S={sm:{width:4.5,height:4.5},md:{width:6,height:6},lg:{width:8,height:8}},_=({handleChange:e,hasIcon:r=!1,on:a,isErrored:s,isRequired:n,size:i="md",thumbProps:d,...c})=>{const h=o();return t.jsx(q,{checked:a,onCheckedChange:o=>{e?.(o)},required:n,"aria-required":n,size:i,...c,children:t.jsxs(E,{...d,size:i,children:[r&&t.jsx(g,{fill:h.colors.common.accent,className:"toggle-on",...P[i]}),r&&t.jsx(b,{fill:h.colors.text.primary,className:"toggle-off",...S[i]})]})})};export{_ as T};
|
package/lib/Toggle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
type ToggleSizes = 'sm' | 'md' | 'lg';
|
|
5
5
|
interface ToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -30,6 +30,6 @@ interface ToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
30
30
|
/**
|
|
31
31
|
* Toggle component is used to show a toggle to the user. It is used to show a switch to the user. It can be used to show a switch to the user.
|
|
32
32
|
*/
|
|
33
|
-
declare const Toggle: ({ handleChange, hasIcon, on, isErrored, isRequired, size, thumbProps, ...rest }: ToggleProps) =>
|
|
33
|
+
declare const Toggle: ({ handleChange, hasIcon, on, isErrored, isRequired, size, thumbProps, ...rest }: ToggleProps) => react_jsx_runtime.JSX.Element;
|
|
34
34
|
|
|
35
|
-
export {
|
|
35
|
+
export { type ToggleProps, type ToggleSizes, Toggle as default };
|
package/lib/Toggle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{T as
|
|
1
|
+
export{T as default}from"./Toggle-D2210zUX.js";import"./styled-components.browser.esm-8fYqm7jD.js";import"react";import"./index-CMYH5FSo.js";import"react-dom";import"./index-D4pfkNFk.js";import"./index-BCBGGtXO.js";import"./index-DZzFKxNs.js";import"./index-Bj96NGNJ.js";import"./Cross-CgQhiy9a.js";import"./TickIcon-D8ryFR8A.js";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import{u as e,e as t,j as n}from"./styled-components.browser.esm-8fYqm7jD.js";import{T as o}from"./index-B3ttnEEs.js";import{$ as r,_ as i,a,c as s}from"./index-CMYH5FSo.js";import{useState as l,useRef as c,useEffect as d,createElement as p,useCallback as u,useMemo as m,forwardRef as h}from"react";import{a as g,$ as y}from"./index-D4pfkNFk.js";import{$ as x}from"./index-BCBGGtXO.js";import{a as f,$ as v}from"./index-CGIN8I3H.js";import{$ as b}from"./index-DE6Djr2P.js";import{$ as T,a as w,b as C,c as _,d as $}from"./index-BtogZdFr.js";import{$ as j}from"./index-BrmsftDQ.js";import{$ as E}from"./index-9P5loDNm.js";import{s as D,q as P,r as L,u as O,a as M}from"./keyframes-0CSXUjw0.js";const[k,I]=x("Tooltip",[T]),H=T(),F=700,A="tooltip.open",[B,N]=k("TooltipProvider"),R="Tooltip",[z,K]=k(R),X="TooltipTrigger",Y=h(((e,t)=>{const{__scopeTooltip:n,...o}=e,s=K(X,n),l=N(X,n),m=H(n),h=c(null),g=r(t,h,s.onTriggerChange),x=c(!1),f=c(!1),v=u((()=>x.current=!1),[]);return d((()=>()=>document.removeEventListener("pointerup",v)),[v]),p(C,i({asChild:!0},m),p(a.button,i({"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute},o,{ref:g,onPointerMove:y(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(f.current||l.isPointerInTransitRef.current||(s.onTriggerEnter(),f.current=!0))})),onPointerLeave:y(e.onPointerLeave,(()=>{s.onTriggerLeave(),f.current=!1})),onPointerDown:y(e.onPointerDown,(()=>{x.current=!0,document.addEventListener("pointerup",v,{once:!0})})),onFocus:y(e.onFocus,(()=>{x.current||s.onOpen()})),onBlur:y(e.onBlur,s.onClose),onClick:y(e.onClick,s.onClose)})))})),q="TooltipPortal",[S,W]=k(q,{forceMount:void 0}),G="TooltipContent",J=h(((e,t)=>{const n=W(G,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...a}=e,s=K(G,e.__scopeTooltip);return p(j,{present:o||s.open},p(s.disableHoverableContent?Z:Q,i({side:r},a,{ref:t})))})),Q=h(((e,t)=>{const n=K(G,e.__scopeTooltip),o=N(G,e.__scopeTooltip),a=c(null),s=r(t,a),[m,h]=l(null),{trigger:g,onClose:y}=n,x=a.current,{onPointerInTransitChange:f}=o,v=u((()=>{h(null),f(!1)}),[f]),b=u(((e,t)=>{const n={x:e.clientX,y:e.clientY},o=function(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return o}(n,function(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,o,r,i)){case i:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),r=function(e){const t=e.slice();return t.sort(((e,t)=>t.x>e.x?-1:e.x>t.x?1:t.y>e.y?-1:e.y>t.y?1:0)),function(e){if(1>=e.length)return e.slice();const t=[];for(let n=0;e.length>n;n++){const o=e[n];for(;t.length>=2;){const e=t[t.length-1],n=t[t.length-2];if((e.y-n.y)*(o.x-n.x)>(e.x-n.x)*(o.y-n.y))break;t.pop()}t.push(o)}t.pop();const n=[];for(let t=e.length-1;t>=0;t--){const o=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if((e.y-t.y)*(o.x-t.x)>(e.x-t.x)*(o.y-t.y))break;n.pop()}n.push(o)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...o,...function(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}(t.getBoundingClientRect())]);h(r),f(!0)}),[f]);return d((()=>()=>v()),[v]),d((()=>{if(g&&x){const e=e=>b(e,x),t=e=>b(e,g);return g.addEventListener("pointerleave",e),x.addEventListener("pointerleave",t),()=>{g.removeEventListener("pointerleave",e),x.removeEventListener("pointerleave",t)}}}),[g,x,b,v]),d((()=>{if(m){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},o=(null==g?void 0:g.contains(t))||(null==x?void 0:x.contains(t)),r=!function(e,t){const{x:n,y:o}=e;let r=!1;for(let e=0,i=t.length-1;t.length>e;i=e++){const a=t[e].x,s=t[e].y,l=t[i].y;s>o!=l>o&&(t[i].x-a)*(o-s)/(l-s)+a>n&&(r=!r)}return r}(n,m);o?v():r&&(v(),y())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[g,x,m,y,v]),p(Z,i({},e,{ref:s}))})),[U,V]=k(R,{isInside:!1}),Z=h(((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=e,u=K(G,n),m=H(n),{onClose:h}=u;return d((()=>(document.addEventListener(A,h),()=>document.removeEventListener(A,h))),[h]),d((()=>{if(u.trigger){const e=e=>{const t=e.target;null!=t&&t.contains(u.trigger)&&h()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[u.trigger,h]),p(v,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:h},p(_,i({"data-state":u.stateAttribute},m,c,{ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),p(s,null,o),p(U,{scope:n,isInside:!0},p(E,{id:u.contentId,role:"tooltip"},r||o))))})),ee=Y,te=J,ne=e(h(((e,t)=>{const{__scopeTooltip:n,...o}=e,r=H(n);return V("TooltipArrow",n).isInside?null:p($,i({},r,o,{ref:t}))})))`
|
|
2
|
+
fill: ${({theme:e})=>e.colors.fill.inverse};
|
|
3
|
+
`,oe=e(te)`
|
|
4
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
5
|
+
font-size: ${({theme:e})=>e.typography.secondary.fontSize};
|
|
6
|
+
font-weight: ${({theme:e})=>e.typography.fontWeight["semi-bold"]};
|
|
7
|
+
line-height: ${({theme:e})=>e.typography.secondary.lineHeight};
|
|
8
|
+
color: ${({theme:e})=>e.colors.text.inverse};
|
|
9
|
+
background-color: ${({theme:e})=>e.colors.fill.inverse};
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
padding: 2px 8px;
|
|
12
|
+
user-select: none;
|
|
13
|
+
animation-duration: ${({theme:e})=>e.transitions.duration.standard};
|
|
14
|
+
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeIn};
|
|
15
|
+
will-change: transform, opacity;
|
|
16
|
+
&[data-state='instant-open'][data-side='top'],
|
|
17
|
+
&[data-state='delayed-open'][data-side='top'] {
|
|
18
|
+
animation-name: ${D};
|
|
19
|
+
}
|
|
20
|
+
&[data-state='instant-open'][data-side='right'],
|
|
21
|
+
&[data-state='delayed-open'][data-side='right'] {
|
|
22
|
+
animation-name: ${P};
|
|
23
|
+
}
|
|
24
|
+
&[data-state='instant-open'][data-side='bottom'],
|
|
25
|
+
&[data-state='delayed-open'][data-side='bottom'] {
|
|
26
|
+
animation-name: ${L};
|
|
27
|
+
}
|
|
28
|
+
&[data-state='instant-open'][data-side='left'],
|
|
29
|
+
&[data-state='delayed-open'][data-side='left'] {
|
|
30
|
+
animation-name: ${O};
|
|
31
|
+
}
|
|
32
|
+
&[data-state='closed'] {
|
|
33
|
+
animation-name: ${M};
|
|
34
|
+
}
|
|
35
|
+
`,re=e((e=>{const{__scopeTooltip:t,delayDuration:n=F,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:i}=e,[a,s]=l(!0),m=c(!1),h=c(0);return d((()=>{const e=h.current;return()=>window.clearTimeout(e)}),[]),p(B,{scope:t,isOpenDelayed:a,delayDuration:n,onOpen:u((()=>{window.clearTimeout(h.current),s(!1)}),[]),onClose:u((()=>{window.clearTimeout(h.current),h.current=window.setTimeout((()=>s(!0)),o)}),[o]),isPointerInTransitRef:m,onPointerInTransitChange:u((e=>{m.current=e}),[]),disableHoverableContent:r},i)}))``,ie=e((e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=e,h=N(R,e.__scopeTooltip),y=H(t),[x,f]=l(null),v=b(),T=c(0),C=null!=a?a:h.disableHoverableContent,_=null!=s?s:h.delayDuration,$=c(!1),[j=!1,E]=g({prop:o,defaultProp:r,onChange:e=>{e?(h.onOpen(),document.dispatchEvent(new CustomEvent(A))):h.onClose(),null==i||i(e)}}),D=m((()=>j?$.current?"delayed-open":"instant-open":"closed"),[j]),P=u((()=>{window.clearTimeout(T.current),$.current=!1,E(!0)}),[E]),L=u((()=>{window.clearTimeout(T.current),E(!1)}),[E]),O=u((()=>{window.clearTimeout(T.current),T.current=window.setTimeout((()=>{$.current=!0,E(!0)}),_)}),[_,E]);return d((()=>()=>window.clearTimeout(T.current)),[]),p(w,y,p(z,{scope:t,contentId:v,open:j,stateAttribute:D,trigger:x,onTriggerChange:f,onTriggerEnter:u((()=>{h.isOpenDelayed?O():P()}),[h.isOpenDelayed,O,P]),onTriggerLeave:u((()=>{C?L():window.clearTimeout(T.current)}),[L,C]),onOpen:P,onClose:L,disableHoverableContent:C},n))}))``,ae=e(ee)`
|
|
36
|
+
color: inherit;
|
|
37
|
+
`,se=e((e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,i=K(q,t);return p(S,{scope:t,forceMount:n},p(j,{present:n||i.open},p(f,{asChild:!0,container:r},o)))}))``,le=({position:e="bottom",label:r,html:i,style:a={},children:s,className:l="",disabled:c=!1,delay:d=300,arrow:p=!0,providerProps:u,rootProps:m})=>{const h=t(),[g="bottom",y="center"]=e.split("-");return n.jsx(re,{delayDuration:d,...u,children:n.jsxs(ie,{...m,open:!c&&void 0,children:[n.jsx(ae,{className:"TooltipTrigger",asChild:!0,"aria-label":"string"==typeof s?s:"TooltipTrigger",type:"button",children:n.jsx(o,{className:l,type:"button",children:s})}),n.jsx(se,{children:n.jsxs(oe,{forceMount:!0,"data-tooltip-content":!0,className:"TooltipContent",style:a,sideOffset:5,"aria-disabled":c,"aria-live":"polite",side:g,align:y,dir:h.direction,children:[n.jsx(n.Fragment,i?{children:i}:{children:r??""}),p&&n.jsx(ne,{})]})})]})})};export{le as T};
|
package/lib/Tooltip.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import { TooltipProviderProps, TooltipProps as TooltipProps$1, TooltipArrowProps } from '@radix-ui/react-tooltip';
|
|
4
4
|
|
|
5
5
|
type TooltipPosition = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
@@ -48,6 +48,6 @@ interface TooltipProps {
|
|
|
48
48
|
* It is used to show additional information or actions.
|
|
49
49
|
* It can be used to show a hint, a warning, or any other content.
|
|
50
50
|
*/
|
|
51
|
-
declare const Tooltip: ({ position, label, html, style, children, className, disabled, delay, arrow, providerProps, rootProps, }: TooltipProps) =>
|
|
51
|
+
declare const Tooltip: ({ position, label, html, style, children, className, disabled, delay, arrow, providerProps, rootProps, }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
52
52
|
|
|
53
|
-
export {
|
|
53
|
+
export { type TooltipAlign, type TooltipPosition, type TooltipProps, type TooltipSide, Tooltip as default };
|
package/lib/Tooltip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{T as
|
|
1
|
+
export{T as default}from"./Tooltip-B8SNaMr7.js";import"./styled-components.browser.esm-8fYqm7jD.js";import"react";import"./index-B3ttnEEs.js";import"./index-CMYH5FSo.js";import"react-dom";import"./index-Bw1WW_qt.js";import"./keyframes-0CSXUjw0.js";import"./index-D4pfkNFk.js";import"./index-BCBGGtXO.js";import"./index-CGIN8I3H.js";import"./index-DE6Djr2P.js";import"./index-BtogZdFr.js";import"./index-Bj96NGNJ.js";import"./index-BrmsftDQ.js";import"./index-9P5loDNm.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{u as t,j as e}from"./styled-components.browser.esm-8fYqm7jD.js";import r from"react";const i=t.span`
|
|
2
|
+
direction: ${({theme:t})=>t.direction};
|
|
3
|
+
color: ${({theme:t})=>t.colors.text.primary};
|
|
4
|
+
font-family: ${({theme:t})=>t.typography.fontFamily};
|
|
5
|
+
font-weight: ${({theme:t,weight:e})=>t.typography.fontWeight[e]};
|
|
6
|
+
font-size: ${({theme:t,variant:e})=>t.typography[e].fontSize};
|
|
7
|
+
line-height: ${({theme:t,variant:e})=>t.typography[e].lineHeight};
|
|
8
|
+
text-transform: ${({variant:t})=>"caption"===t?"uppercase":"none"};
|
|
9
|
+
-webkit-font-smoothing: antialiased;
|
|
10
|
+
`,o=r.forwardRef((({children:t,variant:r="primary",weight:o="regular",...a},n)=>e.jsx(i,{variant:r,weight:o,ref:n,...a,children:t})));export{o as T};
|
package/lib/Typography.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ interface TypographyProps extends React.HtmlHTMLAttributes<HTMLSpanElement> {
|
|
|
17
17
|
*/
|
|
18
18
|
declare const Typography: React$1.ForwardRefExoticComponent<TypographyProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { type TypographyProps, type TypographyVariantType, type TypographyWeightType, Typography as default };
|
package/lib/Typography.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{T as
|
|
1
|
+
export{T as default}from"./Typography-B6f3UubR.js";import"./styled-components.browser.esm-8fYqm7jD.js";import"react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e,j as n}from"./styled-components.browser.esm-8fYqm7jD.js";import a from"react";import{M as s,u as i,T as l,a as o,b as t,c as r,d as c,C as d,e as g,f as h,g as m,h as x,S as p,i as j,j as u,k as C,l as b,m as f,n as y,o as S,p as w,B as P,q as k,r as v,s as M,t as N,v as I,w as R}from"./CustomizeColumns-BsRW9qk_.js";import{B as O}from"./Button-38TrTrqS.js";import{C as F}from"./Checkbox-U3_actBa.js";import{L as T}from"./Loader-DG6kODGn.js";import{M as A}from"./Menu-Ca_uMNaw.js";import"./styles-C_4H_GA0.js";import{P as D}from"./Popover-CLUM02h3.js";import{T as z}from"./Typography-B6f3UubR.js";const B=B=>{const{data:H,columns:L,showFooter:$=!1,infoComponent:G,isLoading:V,isFetching:W,emptyComponent:E,loadingComponent:q,headerComponent:K,filterComponent:J,hideTableOnEmpty:Q,hideTopPagination:U,hideFilters:X,isFilterOpenByDefault:Y=!0,showTableOnLoading:Z,hideLoaderOnTopPagination:_,showWorkspaceActions:ee,count:ne,isWSOpen:ae=!0,pageIndex:se=0,pageSize:ie=20,enablePreviousPage:le,enableNextPage:oe,hideColumnSettings:te=!0,hideBottomPagination:re,rowMenuOptions:ce,onPreviousPageClick:de,isDisableActionMenu:ge=!1,onNextPageClick:he,disableRowSelect:me,hideSelectAllInTable:xe,onSelectAllRows:pe,onRowSelect:je,onMenuOptionSelect:ue,onRowClick:Ce,columnOrder:be,setColumnOrder:fe,setHiddenColumns:ye,hiddenColumns:Se,selectedRowIds:we={},setSelectedRowIds:Pe,dataKey:ke="id",cellPropGetter:ve,setPageIndex:Me,rowPropGetter:Ne,translationTexts:Ie}=B,Re=e(),[Oe,Fe]=a.useState(!!Y),Te=I(),Ae=-1===ne||void 0===ne,De=a.useMemo((()=>[...me?[]:[{id:"select",header:({table:e})=>xe?n.jsx("div",{className:"table-checkbox-header"}):n.jsx(F,{className:"table-checkbox",checked:e.getIsSomeRowsSelected()?"indeterminate":e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onCheckedChange:n=>{e.toggleAllPageRowsSelected(!0===n),pe?.(!0===n)}}),cell:({row:e})=>n.jsx(F,{className:"table-checkbox",checked:e.getIsSelected(),disabled:!e.getCanSelect(),indeterminate:e.getIsSomeSelected(),onCheckedChange:n=>{e.toggleSelected(!0===n),je?.(e.original,!0===n)}})}],...L.map((e=>Te.accessor(e.id,{header:e.Header,id:e.id??e.Header,cell:n=>e.accessorFn(n.row.original)}))),...ce?[{id:"rowMenuOptions",header:()=>n.jsx("div",{id:"more-actions-header"}),cell:({row:e})=>n.jsx(A,{trigger:n.jsx(s,{className:"more-actions",fill:"currentcolor"}),disableMenu:ge,options:ce(e.original)||[],onSelect:n=>{n.id&&ue?.(n.id,e.original)},side:"bottom",align:"rtl"===Re.direction?"start":"end"})}]:[]]),[L,me,xe,Re.colors.text.primary]),ze=a.useMemo((()=>{const e={};return L.forEach((n=>{e[n.id]=!(Se??[]).includes(n.id)})),e}),[L,Se]),Be=a.useMemo((()=>({pageIndex:se,pageSize:ie})),[ie,se]),He=i({data:H,columns:De,getRowId:e=>e?.[ke]??"id",getCoreRowModel:R(),state:{columnOrder:be,columnVisibility:ze,rowSelection:we,pagination:Be},initialState:{columnPinning:{left:["select"],right:["rowMenuOptions"]}},onPaginationChange:e=>{let n=Be;n="function"==typeof e?e(Be):e,Me?.(n.pageIndex)},onColumnVisibilityChange:e=>{let n=ze;n="function"==typeof e?e(ze):e,ye?.(Object.keys(n).filter((e=>!n[e])))},onColumnOrderChange:e=>{let n=be??[];n="function"==typeof e?e(be??[]):e,fe?.(n)},onRowSelectionChange:e=>{let n=we;n="function"==typeof e?e(we):e,Pe?.(n)},enableRowSelection:!0,manualPagination:!0,rowCount:Ae?-1:ne}),{getPageCount:Le,getRowModel:$e,getState:Ge,getCanNextPage:Ve,getCanPreviousPage:We,getPageOptions:Ee,previousPage:qe,setPageIndex:Ke,nextPage:Je,lastPage:Qe,firstPage:Ue}=He,{rows:Xe}=$e(),{pagination:{pageIndex:Ye,pageSize:Ze}}=Ge(),_e=Ye*Ze+(Ye<Le()-1?Ze:Xe.length),en=He.getAllColumns().filter((e=>e.getIsVisible())).length+(me?0:1)+(ce?1:0);return n.jsxs(l,{className:"TableContainer",children:[ee&&n.jsxs(o,{className:"table-actions",children:[n.jsx(t,{className:"table-header-component",children:K??null}),!!ae&&n.jsx(r,{className:"table-header-dropdown-pagination",children:n.jsx(c,{className:"pagination-actions",children:!U&&n.jsxs(n.Fragment,{children:[n.jsx(z,{variant:"primary",className:"pagination-text",children:V&&!_?n.jsx(T,{size:"small"}):n.jsx(n.Fragment,{children:H.length>0?`${Ye*Ze+1} - ${_e} ${Ie?.of||"of"} ${Ae?Xe.length>0?""+(Ie?.many||"Many"):"-":ne??Xe.length??"-"}`:null})}),n.jsx(O,{variant:"secondary",className:"table-pagination-button",onClick:e=>{de?.(),Ae||qe()},disabled:Ae?!le:!We()||V||W,children:n.jsx(d,{fill:Re.colors.text.primary})}),n.jsx(O,{variant:"secondary",className:"table-pagination-button",onClick:e=>{he?.(),Ae||Je()},disabled:Ae?!oe:!Ve()||V||W,children:n.jsx(g,{fill:Re.colors.text.primary})})]})})})]}),!!ae&&n.jsxs(h,{children:[n.jsxs(m,{className:"table-wrapper",children:[G&&n.jsx(x,{children:G}),n.jsx(n.Fragment,V&&!Z?{children:q}:{children:0===Xe.length&&Q?n.jsx(n.Fragment,{children:E}):n.jsx(p,{children:n.jsxs(j,{children:[!te&&n.jsx(D,{align:"end",avoidCollisions:!0,side:"top",trigger:n.jsx(u,{fill:"currentcolor"}),children:n.jsx(C,{table:He})}),n.jsx(b,{children:He.getHeaderGroups().map((e=>n.jsx(f,{children:e.headers.map((e=>n.jsx(y,{children:e.isPlaceholder?null:S(e.column.columnDef.header,e.getContext())},e.id)))},e.id)))}),n.jsxs(w,{children:[W&&!V&&n.jsx(P,{children:n.jsx(T,{})}),Xe.map((e=>n.jsx(f,{$isSelected:e.getIsSelected(),...Ne?.(e.original),children:e.getVisibleCells().map((a=>n.jsx(k,{onClick:()=>{Ce?.(e.original,a.column.columnDef)},...ve?.(a),children:S(a.column.columnDef.cell,a.getContext())},a.id)))},e.id)))]}),$&&n.jsx(v,{children:He.getFooterGroups().map((e=>n.jsx(f,{children:e.headers.map((e=>n.jsx(y,{children:e.isPlaceholder?null:S(e.column.columnDef.footer,e.getContext())},e.id)))},e.id)))}),!re&&n.jsx(v,{children:n.jsx(f,{children:n.jsx(y,{colSpan:en,children:n.jsxs(M,{className:"table-pagination",children:[n.jsx(O,{variant:"secondary",onClick:()=>{Ue()},disabled:!We()||V||W,children:"<<"}),n.jsx(O,{variant:"secondary",onClick:()=>{qe()},disabled:!We()||V||W,children:"<"}),Ye+1>2&&n.jsxs(n.Fragment,{children:[n.jsx(O,{variant:"secondary",onClick:()=>{Ue()},disabled:V||W,children:"1"}),Ye+1-3!=0&&n.jsx(O,{variant:"secondary",disabled:!0,children:"..."})]}),Ee().map((e=>[e-2,e-1,e,e+1,e+2].includes(Ye+1)&&n.jsx(O,{variant:"secondary",className:Ye+1===e+1?"active":"",onClick:()=>{Ke?.(e)},disabled:V||W,children:e+1},e))),Math.ceil(H.length/Ze)-2>Ye+2&&n.jsxs(n.Fragment,{children:[Ye+2+3!==Math.ceil(H.length/Ze)&&n.jsx(O,{variant:"secondary",disabled:!0,children:"..."}),n.jsx(O,{variant:"secondary",onClick:()=>{Ke?.(Math.ceil(H.length/Ze)-1)},disabled:V||W,children:Math.ceil(H.length/Ze)})]}),n.jsx(O,{variant:"secondary",onClick:()=>{Je()},disabled:!Ve()||V||W,children:">"}),n.jsx(O,{variant:"secondary",onClick:()=>{Qe()},disabled:!Ve()||V||W,children:">>"})]})})})})]})})})]}),!X&&Oe&&J&&n.jsx(N,{children:J})]})]})};export{B as W};
|
package/lib/WorkspaceTable.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import { CoreOptions, ColumnDef, Cell, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
import { MenuItemProps as MenuItemProps$1 } from '@radix-ui/react-dropdown-menu';
|
|
5
5
|
|
|
@@ -80,6 +80,6 @@ interface WorkspaceTableProps<T extends WorkspaceRowDataType> {
|
|
|
80
80
|
/**
|
|
81
81
|
* Table component is used to display data in a tabular format. It is used to show data in a structured manner. It can be used to show data in a grid format.
|
|
82
82
|
*/
|
|
83
|
-
declare const WorkspaceTable: <T extends WorkspaceRowDataType = WorkspaceRowDataType>(props: WorkspaceTableProps<T>) =>
|
|
83
|
+
declare const WorkspaceTable: <T extends WorkspaceRowDataType = WorkspaceRowDataType>(props: WorkspaceTableProps<T>) => react_jsx_runtime.JSX.Element;
|
|
84
84
|
|
|
85
|
-
export { type WorkspaceRowDataType,
|
|
85
|
+
export { type WorkspaceRowDataType, type WorkspaceTableProps, WorkspaceTable as default };
|
package/lib/WorkspaceTable.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{W as
|
|
1
|
+
export{W as default}from"./WorkspaceTable-DzWFlI1y.js";import"./styled-components.browser.esm-8fYqm7jD.js";import"react";import"./CustomizeColumns-BsRW9qk_.js";import"./index-B3ttnEEs.js";import"./index-CMYH5FSo.js";import"react-dom";import"./index-Bw1WW_qt.js";import"./keyframes-0CSXUjw0.js";import"./ChevronUp-D_QXlMGy.js";import"./Button-38TrTrqS.js";import"./Checkbox-U3_actBa.js";import"./index-BCBGGtXO.js";import"./index-D4pfkNFk.js";import"./index-DZzFKxNs.js";import"./index-Bj96NGNJ.js";import"./index-BrmsftDQ.js";import"./TickIcon-D8ryFR8A.js";import"./Cross-CgQhiy9a.js";import"./TextArea-CojwXjXn.js";import"./ErrorText-CXW7fI-6.js";import"./Popover-CLUM02h3.js";import"./index-CGIN8I3H.js";import"./Combination-DRFSmqCF.js";import"./index-DE6Djr2P.js";import"./index-BtogZdFr.js";import"./Reorder-CU3gxznN.js";import"./index-DP7HoUNK.js";import"./Typography-B6f3UubR.js";import"./Loader-DG6kODGn.js";import"./Menu-Ca_uMNaw.js";import"./styles-C_4H_GA0.js";import"./index-BJXW8qXz.js";import"./index-BxvGNAuC.js";import"./index-DUUx2Zie.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as r}from"./index-vF1T43J4.js";import{I as i}from"./index-CnAkUJK8.js";import{p as o,I as t}from"./TimePicker-ChjG0ldT.js";import"./styled-components.browser.esm-8fYqm7jD.js";import"react";import"./index-DP7HoUNK.js";import"./index-B3ttnEEs.js";import"./index-CMYH5FSo.js";import"react-dom";import"./index-Bw1WW_qt.js";import"./keyframes-0CSXUjw0.js";import"./ErrorText-CXW7fI-6.js";import"./Button-38TrTrqS.js";import"./styles-Bt3yA8NC.js";import"./index-D4pfkNFk.js";import"./index-BCBGGtXO.js";import"./index-BJXW8qXz.js";import"./index-BxvGNAuC.js";import"./index-CGIN8I3H.js";import"./Combination-DRFSmqCF.js";import"./index-DE6Djr2P.js";import"./index-BtogZdFr.js";import"./index-Bj96NGNJ.js";import"./index-DZzFKxNs.js";import"./index-9P5loDNm.js";import"./ChevronUp-D_QXlMGy.js";import"./Dropdown-CpOK0ioT.js";import"./Cross-CgQhiy9a.js";import"./TickIcon-D8ryFR8A.js";import"./TextArea-CojwXjXn.js";import"./Loader-DG6kODGn.js";function s(s,m){var p=o(s);return m===t.STANDARD?r[p]:i[p]}function m(r){return o(r)}export{r as IconSvgPaths16,i as IconSvgPaths20,s as getIconPaths,m as iconNameToPathsRecordKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,b as r}from"./styled-components.browser.esm-8fYqm7jD.js";import"react";var e=function(e,o){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,import("./allPaths-BGLT3REd.js")];case 1:return[2,(0,t.sent().getIconPaths)(e,o)]}}))}))};export{e as allPathsLoader};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import{a as e,_ as t}from"./index-CMYH5FSo.js";import{forwardRef as o,createElement as i}from"react";import{u as a,a as n}from"./styled-components.browser.esm-8fYqm7jD.js";import{h as r,Z as l}from"./index-Bw1WW_qt.js";import{b as h,a as m}from"./keyframes-0CSXUjw0.js";const s=a(o(((o,a)=>i(e.label,t({},o,{ref:a,onMouseDown:e=>{var t;null===(t=o.onMouseDown)||void 0===t||t.call(o,e),!e.defaultPrevented&&e.detail>1&&e.preventDefault()}})))))`
|
|
2
|
+
color: ${({theme:e})=>e.colors.text.secondary};
|
|
3
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
4
|
+
direction: ${({theme:e})=>e.direction};
|
|
5
|
+
font-size: 12px;
|
|
6
|
+
font-style: normal;
|
|
7
|
+
font-weight: 600;
|
|
8
|
+
line-height: 20px;
|
|
9
|
+
display: flex;
|
|
10
|
+
margin-bottom: 4px;
|
|
11
|
+
`,p=a.label`
|
|
12
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
13
|
+
color: ${({theme:e,disabled:t})=>t?e.colors.text.disabled:e.colors.text.primary};
|
|
14
|
+
margin: 0 8px;
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
font-weight: ${({theme:e})=>e.typography.fontWeight.regular};
|
|
17
|
+
font-size: ${({theme:e})=>e.typography.secondary.fontSize};
|
|
18
|
+
line-height: ${({theme:e})=>e.typography.secondary.lineHeight};
|
|
19
|
+
display: flex;
|
|
20
|
+
`,d=a.div`
|
|
21
|
+
color: ${({theme:e})=>"dark"===e.mode?e.colors.text.primary:e.colors.text.error};
|
|
22
|
+
margin-left: ${({theme:e})=>"ltr"===e.direction?"2px":"unset"};
|
|
23
|
+
margin-right: ${({theme:e})=>"rtl"===e.direction?"2px":"unset"};
|
|
24
|
+
`,g=a.button`
|
|
25
|
+
margin: 0;
|
|
26
|
+
padding: 0;
|
|
27
|
+
width: 20px;
|
|
28
|
+
height: 20px;
|
|
29
|
+
border: none;
|
|
30
|
+
background: none;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
`,y=a.a`
|
|
36
|
+
font-weight: ${({theme:e})=>e.typography.fontWeight["semi-bold"]};
|
|
37
|
+
font-size: ${({theme:e})=>e.typography.primary.fontSize};
|
|
38
|
+
line-height: ${({theme:e})=>e.typography.primary.lineHeight};
|
|
39
|
+
color: ${({theme:e})=>e.colors.text.link};
|
|
40
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
41
|
+
text-decoration: unset;
|
|
42
|
+
:hover {
|
|
43
|
+
text-decoration: underline;
|
|
44
|
+
}
|
|
45
|
+
`,f=a.div`
|
|
46
|
+
flex: 1;
|
|
47
|
+
padding: 32px;
|
|
48
|
+
height: 100%;
|
|
49
|
+
cursor: default;
|
|
50
|
+
`,c=a.div`
|
|
51
|
+
background-color: ${({theme:e})=>"dark"===e.mode?e.colors.fill.medium:e.colors.fill.base};
|
|
52
|
+
display: flex;
|
|
53
|
+
padding: 16px;
|
|
54
|
+
gap: 12px;
|
|
55
|
+
justify-content: flex-end;
|
|
56
|
+
`,x=a.h1`
|
|
57
|
+
color: ${({theme:e})=>e.colors.text.primary};
|
|
58
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
59
|
+
font-size: ${({theme:e})=>e.typography.heading3.fontSize};
|
|
60
|
+
font-weight: ${({theme:e})=>e.typography.fontWeight["semi-bold"]};
|
|
61
|
+
line-height: ${({theme:e})=>e.typography.heading3.lineHeight};
|
|
62
|
+
margin: 0 0 12px 0;
|
|
63
|
+
`,$=a.div`
|
|
64
|
+
color: ${({theme:e})=>e.colors.text.primary};
|
|
65
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
66
|
+
font-size: ${({theme:e})=>e.typography.heading.fontSize};
|
|
67
|
+
font-weight: ${({theme:e})=>e.typography.fontWeight.regular};
|
|
68
|
+
line-height: ${({theme:e})=>e.typography.heading.lineHeight};
|
|
69
|
+
margin: 0 0 16px 0;
|
|
70
|
+
`,u=a.div`
|
|
71
|
+
color: ${({theme:e})=>e.colors.text.primary};
|
|
72
|
+
font-family: ${({theme:e})=>e.typography.fontFamily};
|
|
73
|
+
font-size: ${({theme:e})=>e.typography.primary.fontSize};
|
|
74
|
+
font-weight: ${({theme:e})=>e.typography.fontWeight.regular};
|
|
75
|
+
line-height: ${({theme:e})=>e.typography.primary.lineHeight};
|
|
76
|
+
`,b=a.button.attrs((e=>({"aria-label":e["aria-label"]||"Trigger Button"})))`
|
|
77
|
+
border: none;
|
|
78
|
+
padding: 0;
|
|
79
|
+
margin: 0;
|
|
80
|
+
width: fit-content;
|
|
81
|
+
background: inherit;
|
|
82
|
+
color: inherit;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
display: grid;
|
|
85
|
+
place-content: center;
|
|
86
|
+
`,z=n`
|
|
87
|
+
background-color: ${({theme:e})=>"dark"===e.mode?r(e.colors.scrim,.5):r(e.colors.common.black,.25)};
|
|
88
|
+
position: fixed;
|
|
89
|
+
inset: 0;
|
|
90
|
+
z-index: ${({theme:e})=>(e.zIndex.modal||l.modal)-1};
|
|
91
|
+
animation-duration: ${({theme:e})=>e.transitions.duration.standard};
|
|
92
|
+
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeIn};
|
|
93
|
+
&[data-state='open'] {
|
|
94
|
+
animation-name: ${h};
|
|
95
|
+
}
|
|
96
|
+
&[data-state='closed'] {
|
|
97
|
+
animation-name: ${m};
|
|
98
|
+
}
|
|
99
|
+
`,w=n`
|
|
100
|
+
position: fixed;
|
|
101
|
+
background: ${({theme:e})=>e.colors.fill.surface};
|
|
102
|
+
box-shadow: ${({theme:e})=>`${"dark"===e.mode?"0 0 4px 0":"0 2px 18px 0"} ${r(e.colors.shadow,.2)}`};
|
|
103
|
+
outline: none;
|
|
104
|
+
z-index: ${({theme:e})=>e.zIndex.modal||l.modal};
|
|
105
|
+
`;export{f as C,y as F,p as I,d as R,s as S,b as T,g as a,c as b,x as c,$ as d,u as e,z as f,w as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o="#12344d",e="#264966",r="#bedbf5",d="#dff0ff",i="#384551",a="#475867",l="#647a8e",n="#7b8e9f",t="#92a2b1",c="#cfd7df",s="#ebeff3",p="#f5f7f9",b="#f7f9fa",g="#008969",x="#00a886",f="#1cb697",m="#2c5cc5",h="#2e6ed8",k="#2e8efa",u="#459ffc",C="#bbdcfe",B="#e5f2fd",v="#c82124",z="#d72d30",_="#e43538",$="#ff473e",y="#ff5959",S="#f2797b",F="#f89fa1",W="#ffd0d6",H="#e86f25",T="#f48928",w="#f69a3c",I="#000000",O="#ffffff",j={light_mild:"#ffffff",light_normal:"#f6f7f8",light_bold:"#eceff1",dark_mild:"#0b0c0d",dark_normal:"#141617",dark_bold:"#191a1c"},E="-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial, sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'",U=(o,e=1)=>{let r=e,d=o.replace(/^#/,"");8===o.length||4===o.length?(r=parseInt(o.slice(-2),16)/255,d=o.slice(0,-2)):3===d.length&&(d=d.replace(/(.)/g,"$1$1"));const[i,a,l]=[0,2,4].map((o=>parseInt(d.slice(o,o+2),16)));return`rgba(${i}, ${a}, ${l}, ${r.toFixed(2)})`},A={popover:900,dropdown:900,mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},D={mode:"light",direction:"ltr",breakpoints:{keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"},colors:{common:{black:I,white:O,accent:m},text:{link:m,primary:o,secondary:a,disabled:n,placeholder:t,error:z,inverse:O,semantic:{success:x,warning:T,error:$,info:k}},fill:{base:p,medium:s,dark:c,surface:O,inverse:o,hover:s,disabled:s,hilight:B},semantic:{error:{bg:"#ffecf0",border:W},warning:{bg:"#fef1e1",border:"#fddbb5"},info:{bg:B,border:C},success:{bg:"#e0f5f1",border:"#b4e5da"}},border:{light:s,normal:c,divider:c,hover:t,active:m,disabled:s,error:z},shadow:o,scrim:o},typography:{fontFamily:E,fontWeight:{bold:700,"semi-bold":600,regular:400},primary:{fontSize:"14px",fontWeight:400,lineHeight:1.5},secondary:{fontSize:"12px",fontWeight:400,lineHeight:1.5},heading:{fontSize:"16px",fontWeight:400,lineHeight:1.25},heading1:{fontSize:"44px",fontWeight:400,lineHeight:1.25},heading2:{fontSize:"32px",fontWeight:400,lineHeight:1.25},heading3:{fontSize:"24px",fontWeight:400,lineHeight:1.25},heading4:{fontSize:"18px",fontWeight:400,lineHeight:1.25},caption:{fontSize:"12px",fontWeight:400,lineHeight:1}},shadows:["none",`0px 2px 1px -1px ${U(I,.2)},0px 1px 1px 0px ${U(I,.14)},0px 1px 3px 0px ${U(I,.12)}`,`0px 3px 1px -2px ${U(I,.2)},0px 2px 2px 0px ${U(I,.14)},0px 1px 5px 0px ${U(I,.12)}`,`0px 3px 3px -2px ${U(I,.2)},0px 3px 4px 0px ${U(I,.14)},0px 1px 8px 0px ${U(I,.12)}`],transitions:{easing:{easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.16, 1, 0.3, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},duration:{short:"250ms",standard:"300ms",complex:"450ms"}},zIndex:A,components:{toast:{position:"center"},button:{primary:{backgroundFrom:e,backgroundTo:o,color:O,disabledColor:b,activeBackgroundColor:e,hoverColor:o,borderColor:o,activeBorderColor:o,disabledBorderColor:n,disabledBackgroundFrom:t,disabledBackgroundTo:n},secondary:{backgroundFrom:O,backgroundTo:p,color:o,disabledColor:t,activeBackgroundColor:p,hoverColor:p,borderColor:c,activeBorderColor:p,disabledBorderColor:c,disabledBackgroundFrom:s,disabledBackgroundTo:s},danger:{backgroundFrom:z,backgroundTo:v,color:O,disabledColor:W,activeBackgroundColor:z,hoverColor:v,borderColor:v,activeBorderColor:F,disabledBorderColor:S,disabledBackgroundFrom:F,disabledBackgroundTo:S},link:{backgroundFrom:O,backgroundTo:O,color:m,disabledColor:C,activeBackgroundColor:p,hoverColor:s,borderColor:O,activeBorderColor:p,disabledBorderColor:O,disabledBackgroundFrom:O,disabledBackgroundTo:O}}}},Z={mode:"dark",direction:"ltr",breakpoints:{keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"},colors:{common:{black:j.dark_mild,white:O,accent:u},text:{link:u,primary:c,secondary:t,disabled:l,placeholder:n,error:y,inverse:I,semantic:{success:f,warning:w,error:y,info:u}},fill:{base:j.dark_bold,medium:j.dark_normal,dark:c,surface:j.dark_mild,inverse:r,hover:a,disabled:s,hilight:B},semantic:{error:{bg:U(_,.2),border:$},warning:{bg:U(H,.2),border:T},info:{bg:U(h,.2),border:k},success:{bg:U(g,.2),border:x}},border:{light:i,normal:l,divider:i,hover:l,active:u,disabled:s,error:$},shadow:d,scrim:o},typography:{fontFamily:E,fontWeight:{bold:700,"semi-bold":600,regular:400},primary:{fontSize:"14px",fontWeight:400,lineHeight:1.5},secondary:{fontSize:"12px",fontWeight:400,lineHeight:1.5},heading:{fontSize:"16px",fontWeight:400,lineHeight:1.25},heading1:{fontSize:"44px",fontWeight:400,lineHeight:1.25},heading2:{fontSize:"32px",fontWeight:400,lineHeight:1.25},heading3:{fontSize:"24px",fontWeight:400,lineHeight:1.25},heading4:{fontSize:"18px",fontWeight:400,lineHeight:1.25},caption:{fontSize:"12px",fontWeight:400,lineHeight:1}},shadows:["none",`0px 2px 1px -1px ${U(o,.2)},0px 1px 1px 0px ${U(o,.14)},0px 1px 3px 0px ${U(o,.12)}`,`0px 3px 1px -2px ${U(o,.2)},0px 2px 2px 0px ${U(o,.14)},0px 1px 5px 0px ${U(o,.12)}`,`0px 3px 3px -2px ${U(o,.2)},0px 3px 4px 0px ${U(o,.14)},0px 1px 8px 0px ${U(o,.12)}`],transitions:{easing:{easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.16, 1, 0.3, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},duration:{short:"250ms",standard:"300ms",complex:"450ms"}},zIndex:A,components:{toast:{position:"center"},button:{primary:{backgroundFrom:r,backgroundTo:r,color:I,disabledColor:I,activeBackgroundColor:d,hoverColor:d,borderColor:d,activeBorderColor:d,disabledBorderColor:d,disabledBackgroundFrom:r,disabledBackgroundTo:r},secondary:{backgroundFrom:j.dark_mild,backgroundTo:j.dark_mild,color:c,disabledColor:l,activeBackgroundColor:j.dark_normal,hoverColor:j.dark_normal,borderColor:i,activeBorderColor:i,disabledBorderColor:i,disabledBackgroundFrom:j.dark_bold,disabledBackgroundTo:j.dark_bold},danger:{backgroundFrom:y,backgroundTo:y,color:I,disabledColor:W,activeBackgroundColor:y,hoverColor:S,borderColor:S,activeBorderColor:z,disabledBorderColor:S,disabledBackgroundFrom:y,disabledBackgroundTo:y},link:{backgroundFrom:j.dark_mild,backgroundTo:j.dark_mild,color:u,disabledColor:C,activeBackgroundColor:j.dark_mild,hoverColor:j.dark_mild,borderColor:"transparent",activeBorderColor:u,disabledBorderColor:"transparent",disabledBackgroundFrom:j.dark_mild,disabledBackgroundTo:j.dark_mild}}}};var G=Object.freeze({__proto__:null,Z_INDEX:A,dark:Z,hextoRGB:U,light:D});export{A as Z,U as h,G as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as o,$ as r}from"./index-CMYH5FSo.js";import{forwardRef as n,createElement as a,useRef as t,useEffect as d,useState as i}from"react";import{a as s,$ as c}from"./index-D4pfkNFk.js";import{$ as u}from"./index-BCBGGtXO.js";import{$ as l,a as p,b as m}from"./index-DUUx2Zie.js";import{$ as b}from"./index-BxvGNAuC.js";import{$ as f}from"./index-Bj96NGNJ.js";import{$ as v}from"./index-DZzFKxNs.js";import{$ as k}from"./index-BrmsftDQ.js";const h="Radio",[y,w]=u(h),[C
|
|
1
|
+
import{_ as e,a as o,$ as r}from"./index-CMYH5FSo.js";import{forwardRef as n,createElement as a,useRef as t,useEffect as d,useState as i}from"react";import{a as s,$ as c}from"./index-D4pfkNFk.js";import{$ as u}from"./index-BCBGGtXO.js";import{$ as l,a as p,b as m}from"./index-DUUx2Zie.js";import{$ as b}from"./index-BxvGNAuC.js";import{$ as f}from"./index-Bj96NGNJ.js";import{$ as v}from"./index-DZzFKxNs.js";import{$ as k}from"./index-BrmsftDQ.js";const h="Radio",[y,w]=u(h),[x,C]=y(h),_=n(((n,d)=>{const{__scopeRadio:s,name:u,checked:l=!1,required:p,disabled:m,value:b="on",onCheck:f,...v}=n,[k,h]=i(null),y=r(d,(e=>h(e))),w=t(!1),C=!k||!!k.closest("form");return a(x,{scope:s,checked:l,disabled:m},a(o.button,e({type:"button",role:"radio","aria-checked":l,"data-state":j(l),"data-disabled":m?"":void 0,disabled:m,value:b},v,{ref:y,onClick:c(n.onClick,(e=>{l||null==f||f(),C&&(w.current=e.isPropagationStopped(),w.current||e.stopPropagation())}))})),C&&a(R,{control:k,bubbles:!w.current,name:u,value:b,checked:l,required:p,disabled:m,style:{transform:"translateX(-100%)"}}))})),g=n(((r,n)=>{const{__scopeRadio:t,forceMount:d,...i}=r,s=C("RadioIndicator",t);return a(k,{present:d||s.checked},a(o.span,e({"data-state":j(s.checked),"data-disabled":s.disabled?"":void 0},i,{ref:n})))})),R=o=>{const{control:r,checked:n,bubbles:i=!0,...s}=o,c=t(null),u=v(n),l=f(r);return d((()=>{const e=c.current,o=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(o,"checked").set;if(u!==n&&r){const o=new Event("click",{bubbles:i});r.call(e,n),e.dispatchEvent(o)}}),[u,n,i]),a("input",e({type:"radio","aria-hidden":!0,defaultChecked:n},s,{tabIndex:-1,ref:c,style:{...o.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function j(e){return e?"checked":"unchecked"}const E=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$="RadioGroup",[q,L]=u($,[l,w]),G=l(),A=w(),[D,I]=q($),P=n(((r,n)=>{const{__scopeRadioGroup:t,name:d,defaultValue:i,value:c,required:u=!1,disabled:l=!1,orientation:m,dir:f,loop:v=!0,onValueChange:k,...h}=r,y=G(t),w=b(f),[x,C]=s({prop:c,defaultProp:i,onChange:k});return a(D,{scope:t,name:d,required:u,disabled:l,value:x,onValueChange:C},a(p,e({asChild:!0},y,{orientation:m,dir:w,loop:v}),a(o.div,e({role:"radiogroup","aria-required":u,"aria-orientation":m,"data-disabled":l?"":void 0,dir:w},h,{ref:n}))))})),V=n(((o,n)=>{const{__scopeRadioGroup:i,disabled:s,...u}=o,l=I("RadioGroupItem",i),p=l.disabled||s,b=G(i),f=A(i),v=t(null),k=r(n,v),h=l.value===u.value,y=t(!1);return d((()=>{const e=e=>{E.includes(e.key)&&(y.current=!0)},o=()=>y.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",o),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",o)}}),[]),a(m,e({asChild:!0},b,{focusable:!p,active:h}),a(_,e({disabled:p,required:l.required,checked:h},f,u,{name:l.name,ref:k,onCheck:()=>l.onValueChange(u.value),onKeyDown:c((e=>{"Enter"===e.key&&e.preventDefault()})),onFocus:c(u.onFocus,(()=>{var e;y.current&&(null===(e=v.current)||void 0===e||e.click())}))})))})),F=n(((o,r)=>{const{__scopeRadioGroup:n,...t}=o,d=A(n);return a(g,e({},d,t,{ref:r}))}));export{P as $,F as a,V as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=()=>Math.random().toString(32).slice(2,10),e="fui:debug",t=(()=>{if("undefined"==typeof window||!window||"undefined"==typeof localStorage||!localStorage)return{};const o=localStorage.getItem(e);return JSON.parse(o??"{}")})(),n=(o,n)=>{t.log&&console.log(`${e}:${o}`,n)};export{n as a,o as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as o,$ as e,a as n,b as t}from"./index-CMYH5FSo.js";import{forwardRef as r,createElement as a,useRef as s,useEffect as i,Fragment as l,useCallback as c,Children as u}from"react";import{$ as p,a as d}from"./index-D4pfkNFk.js";import{$ as f,a as g}from"./index-BCBGGtXO.js";import{$ as D}from"./index-DE6Djr2P.js";import{$ as m,a as _}from"./index-CGIN8I3H.js";import{h as v,$ as C,a as O,R as h}from"./Combination-
|
|
1
|
+
import{_ as o,$ as e,a as n,b as t}from"./index-CMYH5FSo.js";import{forwardRef as r,createElement as a,useRef as s,useEffect as i,Fragment as l,useCallback as c,Children as u}from"react";import{$ as p,a as d}from"./index-D4pfkNFk.js";import{$ as f,a as g}from"./index-BCBGGtXO.js";import{$ as D}from"./index-DE6Djr2P.js";import{$ as m,a as _}from"./index-CGIN8I3H.js";import{h as v,$ as C,a as O,R as h}from"./Combination-DRFSmqCF.js";import{$ as b}from"./index-BrmsftDQ.js";const F="Dialog",[I,y]=f(F),[P,A]=I(F),M="DialogPortal",[R,$]=I(M,{forceMount:void 0}),j="DialogOverlay",x=r(((e,n)=>{const t=$(j,e.__scopeDialog),{forceMount:r=t.forceMount,...s}=e,i=A(j,e.__scopeDialog);return i.modal?a(b,{present:r||i.open},a(E,o({},s,{ref:n}))):null})),E=r(((e,r)=>{const{__scopeDialog:s,...i}=e,l=A(j,s);return a(h,{as:t,allowPinchZoom:!0,shards:[l.contentRef]},a(n.div,o({"data-state":q(l.open)},i,{ref:r,style:{pointerEvents:"auto",...i.style}})))})),w="DialogContent",k=r(((e,n)=>{const t=$(w,e.__scopeDialog),{forceMount:r=t.forceMount,...s}=e,i=A(w,e.__scopeDialog);return a(b,{present:r||i.open},a(i.modal?T:N,o({},s,{ref:n})))})),T=r(((n,t)=>{const r=A(w,n.__scopeDialog),l=s(null),c=e(t,r.contentRef,l);return i((()=>{const o=l.current;if(o)return v(o)}),[]),a(K,o({},n,{ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(n.onCloseAutoFocus,(o=>{var e;o.preventDefault(),null===(e=r.triggerRef.current)||void 0===e||e.focus()})),onPointerDownOutside:p(n.onPointerDownOutside,(o=>{const e=o.detail.originalEvent;(2===e.button||0===e.button&&!0===e.ctrlKey)&&o.preventDefault()})),onFocusOutside:p(n.onFocusOutside,(o=>o.preventDefault()))}))})),N=r(((e,n)=>{const t=A(w,e.__scopeDialog),r=s(!1),i=s(!1);return a(K,o({},e,{ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var n,a;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented||(r.current||null===(a=t.triggerRef.current)||void 0===a||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var n,a;null===(n=e.onInteractOutside)||void 0===n||n.call(e,o),o.defaultPrevented||(r.current=!0,"pointerdown"===o.detail.originalEvent.type&&(i.current=!0)),(null===(a=t.triggerRef.current)||void 0===a?void 0:a.contains(o.target))&&o.preventDefault(),"focusin"===o.detail.originalEvent.type&&i.current&&o.preventDefault()}}))})),K=r(((n,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:u,...p}=n,d=A(w,r),f=s(null),g=e(t,f);return C(),a(l,null,a(O,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:c,onUnmountAutoFocus:u},a(m,o({role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":q(d.open)},p,{ref:g,onDismiss:()=>d.onOpenChange(!1)}))),!1)})),S="DialogTitle",U=r(((e,t)=>{const{__scopeDialog:r,...s}=e,i=A(S,r);return a(n.h2,o({id:i.titleId},s,{ref:t}))})),W=r(((e,t)=>{const{__scopeDialog:r,...s}=e,i=A("DialogDescription",r);return a(n.p,o({id:i.descriptionId},s,{ref:t}))})),Z=r(((e,t)=>{const{__scopeDialog:r,...s}=e,i=A("DialogClose",r);return a(n.button,o({type:"button"},s,{ref:t,onClick:p(e.onClick,(()=>i.onOpenChange(!1)))}))}));function q(o){return o?"open":"closed"}const[z,B]=g("DialogTitleWarning",{contentName:w,titleName:S,docsSlug:"dialog"}),G=o=>{const{__scopeDialog:e,children:n,open:t,defaultOpen:r,onOpenChange:i,modal:l=!0}=o,u=s(null),p=s(null),[f=!1,g]=d({prop:t,defaultProp:r,onChange:i});return a(P,{scope:e,triggerRef:u,contentRef:p,contentId:D(),titleId:D(),descriptionId:D(),open:f,onOpenChange:g,onOpenToggle:c((()=>g((o=>!o))),[g]),modal:l},n)},H=o=>{const{__scopeDialog:e,forceMount:n,children:t,container:r}=o,s=A(M,e);return a(R,{scope:e,forceMount:n},u.map(t,(o=>a(b,{present:n||s.open},a(_,{asChild:!0,container:r},o)))))},J=x,L=k,Q=U,V=W,X=Z;export{y as $,G as a,H as b,J as c,z as d,L as e,Q as f,V as g,X as h};
|