@clicktap/ui 0.14.19 → 0.14.25

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.
Files changed (198) hide show
  1. package/components/ContextMenu/ContextMenu.js +1 -1
  2. package/components/Dialog/Dialog.js +1 -1
  3. package/components/DialogTrigger/DialogTrigger.js +1 -1
  4. package/components/Drawer/Drawer.js +1 -1
  5. package/components/ModalOverlay/ModalOverlay.js +1 -1
  6. package/components/PinInput/PinInput.js +1 -1
  7. package/components/Select/Select.js +1 -1
  8. package/components/Tabs/Tabs.context.d.ts +3 -0
  9. package/package.json +1 -1
  10. package/components/Accordion/Accordion.tsx +0 -82
  11. package/components/Accordion/index.ts +0 -3
  12. package/components/Avatar/Avatar.stories.tsx +0 -99
  13. package/components/Avatar/Avatar.tsx +0 -120
  14. package/components/Avatar/Avatar.types.ts +0 -3
  15. package/components/Avatar/AvatarGroup/AvatarGroup.tsx +0 -32
  16. package/components/Avatar/AvatarGroup/AvatarGroup.types.ts +0 -8
  17. package/components/Avatar/index.ts +0 -4
  18. package/components/Badge/Badge.stories.tsx +0 -72
  19. package/components/Badge/Badge.tsx +0 -169
  20. package/components/Badge/Badge.types.ts +0 -3
  21. package/components/Badge/index.ts +0 -2
  22. package/components/Breadcrumbs/BreadcrumbEllipsis.tsx +0 -47
  23. package/components/Breadcrumbs/BreadcrumbEllipsis.types.ts +0 -5
  24. package/components/Breadcrumbs/BreadcrumbItem.tsx +0 -23
  25. package/components/Breadcrumbs/BreadcrumbItem.types.ts +0 -3
  26. package/components/Breadcrumbs/BreadcrumbLink.tsx +0 -30
  27. package/components/Breadcrumbs/BreadcrumbLink.types.ts +0 -3
  28. package/components/Breadcrumbs/BreadcrumbSeparator.tsx +0 -41
  29. package/components/Breadcrumbs/BreadcrumbSeparator.types.ts +0 -9
  30. package/components/Breadcrumbs/Breadcrumbs.tsx +0 -28
  31. package/components/Breadcrumbs/Breadcrumbs.types.ts +0 -6
  32. package/components/Breadcrumbs/index.ts +0 -10
  33. package/components/Button/Button.tsx +0 -72
  34. package/components/Button/Button.types.ts +0 -7
  35. package/components/Button/index.ts +0 -2
  36. package/components/Card/Card.tsx +0 -15
  37. package/components/Card/Card.types.ts +0 -3
  38. package/components/Card/index.ts +0 -2
  39. package/components/Checkbox/Checkbox.tsx +0 -122
  40. package/components/Checkbox/Checkbox.types.ts +0 -15
  41. package/components/Checkbox/index.ts +0 -2
  42. package/components/Collapsible/Collapsible.tsx +0 -34
  43. package/components/Collapsible/Collapsible.types.ts +0 -5
  44. package/components/Collapsible/CollapsibleTrigger.tsx +0 -57
  45. package/components/Collapsible/CollapsibleTrigger.types.ts +0 -14
  46. package/components/Collapsible/index.ts +0 -10
  47. package/components/Container/Container.tsx +0 -26
  48. package/components/Container/Container.types.ts +0 -3
  49. package/components/Container/index.ts +0 -2
  50. package/components/ContextMenu/ContextMenu.tsx +0 -74
  51. package/components/ContextMenu/ContextMenu.types.ts +0 -17
  52. package/components/ContextMenu/index.ts +0 -2
  53. package/components/CreditCardExpirationInput/CreditCardExpirationInput.tsx +0 -115
  54. package/components/CreditCardExpirationInput/CreditCardExpirationInput.types.ts +0 -10
  55. package/components/CreditCardExpirationInput/index.ts +0 -2
  56. package/components/CreditCardInput/CreditCardInput.tsx +0 -147
  57. package/components/CreditCardInput/CreditCardInput.types.ts +0 -12
  58. package/components/CreditCardInput/index.ts +0 -2
  59. package/components/DateInput/DateInput.tsx +0 -81
  60. package/components/DateInput/DateInput.types.ts +0 -15
  61. package/components/DateInput/index.ts +0 -2
  62. package/components/DateTimeFormat/DateTimeFormat.tsx +0 -16
  63. package/components/DateTimeFormat/DateTimeFormat.types.ts +0 -7
  64. package/components/DateTimeFormat/index.ts +0 -2
  65. package/components/Dialog/Dialog.tsx +0 -65
  66. package/components/Dialog/Dialog.types.ts +0 -9
  67. package/components/Dialog/index.ts +0 -2
  68. package/components/DialogTrigger/DialogTrigger.tsx +0 -45
  69. package/components/DialogTrigger/DialogTrigger.types.ts +0 -6
  70. package/components/DialogTrigger/index.ts +0 -5
  71. package/components/Divider/Divider.stories.tsx +0 -37
  72. package/components/Divider/Divider.tsx +0 -34
  73. package/components/Divider/Divider.types.ts +0 -5
  74. package/components/Divider/index.ts +0 -2
  75. package/components/DobInput/DobInput.tsx +0 -120
  76. package/components/DobInput/index.ts +0 -2
  77. package/components/Drawer/Drawer.tsx +0 -126
  78. package/components/Drawer/Drawer.types.ts +0 -11
  79. package/components/Drawer/index.ts +0 -2
  80. package/components/Icon/Account.tsx +0 -50
  81. package/components/Icon/Cart.tsx +0 -43
  82. package/components/Icon/Checkmark.tsx +0 -34
  83. package/components/Icon/Cross.tsx +0 -36
  84. package/components/Icon/DownArrow.tsx +0 -23
  85. package/components/Icon/Hamburger.tsx +0 -23
  86. package/components/Icon/Icon.types.ts +0 -8
  87. package/components/Icon/LinkArrow.tsx +0 -32
  88. package/components/Icon/Minus.tsx +0 -20
  89. package/components/Icon/Plus.tsx +0 -20
  90. package/components/Icon/Search.tsx +0 -36
  91. package/components/Icon/Trash.tsx +0 -27
  92. package/components/Icon/Verified.tsx +0 -20
  93. package/components/Icon/index.ts +0 -14
  94. package/components/Image/Image.tsx +0 -32
  95. package/components/Image/index.ts +0 -2
  96. package/components/Input/Input.tsx +0 -109
  97. package/components/Input/Input.types.ts +0 -17
  98. package/components/Input/index.ts +0 -2
  99. package/components/Link/Link.stories.tsx +0 -96
  100. package/components/Link/Link.tsx +0 -39
  101. package/components/Link/Link.types.ts +0 -3
  102. package/components/Link/index.ts +0 -2
  103. package/components/Loader/CircularEasing.tsx +0 -66
  104. package/components/Loader/CircularEasing.types.ts +0 -8
  105. package/components/Loader/Pulse.tsx +0 -45
  106. package/components/Loader/Pulse.types.ts +0 -5
  107. package/components/Loader/index.ts +0 -4
  108. package/components/Menu/ContextMenu.tsx +0 -83
  109. package/components/Menu/Menu.tsx +0 -143
  110. package/components/Menu/Menu.types.ts +0 -44
  111. package/components/Menu/index.ts +0 -4
  112. package/components/Meter/Meter.stories.tsx +0 -111
  113. package/components/Meter/Meter.tsx +0 -68
  114. package/components/Meter/Meter.types.ts +0 -10
  115. package/components/Meter/index.ts +0 -2
  116. package/components/Modal/Modal.tsx +0 -16
  117. package/components/Modal/Modal.types.ts +0 -6
  118. package/components/Modal/index.ts +0 -2
  119. package/components/ModalOverlay/ModalOverlay.tsx +0 -121
  120. package/components/ModalOverlay/ModalOverlay.types.ts +0 -18
  121. package/components/ModalOverlay/index.ts +0 -2
  122. package/components/NumberFormat/NumberFormat.tsx +0 -19
  123. package/components/NumberFormat/NumberFormat.types.ts +0 -8
  124. package/components/NumberFormat/index.ts +0 -2
  125. package/components/NumberInput/NumberInput.tsx +0 -164
  126. package/components/NumberInput/NumberInput.types.ts +0 -22
  127. package/components/NumberInput/index.ts +0 -2
  128. package/components/NumberTicker/DigitResolver.tsx +0 -119
  129. package/components/NumberTicker/DigitResolver.types.ts +0 -18
  130. package/components/NumberTicker/NumberTicker.tsx +0 -56
  131. package/components/NumberTicker/NumberTicker.types.ts +0 -96
  132. package/components/NumberTicker/hooks/useColumnTransition.ts +0 -36
  133. package/components/NumberTicker/hooks/useNumberDelta.ts +0 -19
  134. package/components/NumberTicker/hooks/useNumberTicker.ts +0 -36
  135. package/components/NumberTicker/index.ts +0 -10
  136. package/components/Pagination/Pagination.tsx +0 -44
  137. package/components/Pagination/index.ts +0 -2
  138. package/components/PasswordCheck/PasswordCheck.tsx +0 -59
  139. package/components/PasswordCheck/PasswordCheck.types.ts +0 -4
  140. package/components/PasswordCheck/PasswordCheck.utils.ts +0 -47
  141. package/components/PasswordCheck/index.ts +0 -2
  142. package/components/PhoneInput/PhoneInput.tsx +0 -191
  143. package/components/PhoneInput/index.ts +0 -2
  144. package/components/PinInput/PinInput.tsx +0 -318
  145. package/components/PinInput/PinInput.types.ts +0 -21
  146. package/components/PinInput/index.ts +0 -2
  147. package/components/Progressbar/CircularProgressbar.tsx +0 -71
  148. package/components/Progressbar/CircularProgressbar.types.ts +0 -10
  149. package/components/Progressbar/LinearProgressbar.tsx +0 -75
  150. package/components/Progressbar/LinearProgressbar.types.ts +0 -11
  151. package/components/Progressbar/index.ts +0 -4
  152. package/components/Radio/Radio.tsx +0 -88
  153. package/components/Radio/Radio.types.ts +0 -16
  154. package/components/Radio/index.ts +0 -2
  155. package/components/RadioGroup/RadioGroup.tsx +0 -49
  156. package/components/RadioGroup/RadioGroup.types.ts +0 -7
  157. package/components/RadioGroup/index.ts +0 -2
  158. package/components/Select/Option.tsx +0 -32
  159. package/components/Select/Option.types.ts +0 -3
  160. package/components/Select/Select.tsx +0 -272
  161. package/components/Select/Select.types.ts +0 -48
  162. package/components/Select/index.ts +0 -8
  163. package/components/Skeleton/Skeleton.tsx +0 -15
  164. package/components/Skeleton/Skeleton.types.ts +0 -3
  165. package/components/Skeleton/index.ts +0 -2
  166. package/components/Slider/Slider.tsx +0 -110
  167. package/components/Slider/Slider.types.ts +0 -11
  168. package/components/Slider/index.ts +0 -2
  169. package/components/Switch/Switch.tsx +0 -63
  170. package/components/Switch/Switch.types.ts +0 -8
  171. package/components/Switch/index.ts +0 -2
  172. package/components/Table/Table.tsx +0 -52
  173. package/components/Table/Table.types.ts +0 -22
  174. package/components/Table/index.ts +0 -2
  175. package/components/Tabs/Tab.tsx +0 -118
  176. package/components/Tabs/Tab.types.ts +0 -10
  177. package/components/Tabs/TabList.tsx +0 -51
  178. package/components/Tabs/TabList.types.ts +0 -12
  179. package/components/Tabs/TabPanel.tsx +0 -19
  180. package/components/Tabs/TabPanel.types.ts +0 -3
  181. package/components/Tabs/Tabs.context.tsx +0 -9
  182. package/components/Tabs/Tabs.tsx +0 -39
  183. package/components/Tabs/Tabs.types.ts +0 -3
  184. package/components/Tabs/index.ts +0 -9
  185. package/components/TimeInput/TimeInput.stories.tsx +0 -125
  186. package/components/TimeInput/TimeInput.tsx +0 -81
  187. package/components/TimeInput/TimeInput.types.ts +0 -15
  188. package/components/TimeInput/index.ts +0 -2
  189. package/components/ToggleButton/ToggleButton.stories.tsx +0 -89
  190. package/components/ToggleButton/ToggleButton.tsx +0 -69
  191. package/components/ToggleButton/ToggleButton.types.ts +0 -6
  192. package/components/ToggleButton/index.ts +0 -2
  193. package/components/Tooltip/Tooltip.tsx +0 -59
  194. package/components/Tooltip/Tooltip.types.ts +0 -3
  195. package/components/Tooltip/index.ts +0 -2
  196. package/components/UploadImage/UploadImage.tsx +0 -206
  197. package/components/UploadImage/UploadImage.types.ts +0 -15
  198. package/components/UploadImage/index.ts +0 -2
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{Popover as x,Menu as h}from"react-aria-components";import{forwardRef as c}from"react";import{motion as _}from"framer-motion";import{cn as m}from"../../utils/cn.js";const b=c(({style:o,...e},n)=>{const r=typeof o=="function"?o(e):o;return t(x,{...e,ref:n,style:r})}),l=_.create(b);function P({children:o,key:e,onAction:n,setAnimation:r,animation:d="hidden",className:a,classNames:i,...u}){return t(l,{className:m("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-56","bg-white","border border-solid border-slate-300",a),isExiting:d==="hidden",onAnimationComplete:f=>{r(p=>f==="hidden"&&p==="hidden"?"unmounted":p)},variants:{hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},initial:"hidden",animate:d,...u,children:t(h,{className:m("outline-none",i==null?void 0:i.menu),onAction:n,children:o})},e)}export{P as ContextMenu,P as default};
1
+ import{jsx as r}from"react/jsx-runtime";import{Popover as v,Menu as h}from"react-aria-components";import{forwardRef as w}from"react";import{motion as c}from"framer-motion";import{cn as d}from"../../utils/cn.js";const a=w(({style:o,...e},t)=>{const i=typeof o=="function"?o(e):o;return r(v,{...e,ref:t,style:i})});let p=null;function y(){return typeof window>"u"?null:(p||(p=c.create(a)),p)}function E({children:o,key:e,onAction:t,setAnimation:i,animation:u="hidden",className:_,classNames:n,...f}){const m=y(),x=d("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-56","bg-white","border border-solid border-slate-300",_);return m?r(m,{className:x,isExiting:u==="hidden",onAnimationComplete:b=>{i(l=>b==="hidden"&&l==="hidden"?"unmounted":l)},variants:{hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},initial:"hidden",animate:u,...f,children:r(h,{className:d("outline-none",n==null?void 0:n.menu),onAction:t,children:o})},e):r(a,{className:x,...f,children:r(h,{className:d("outline-none",n==null?void 0:n.menu),onAction:t,children:o})},e)}export{E as ContextMenu,E as default};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{forwardRef as i}from"react";import{Dialog as s}from"react-aria-components";import{motion as l}from"framer-motion";import{cn as m}from"../../utils/cn.js";const f=i(({style:a,animationVariants:o,...r},t)=>{const n=typeof a=="function"?a(r):a;return e(s,{...r,ref:t,style:n})}),c=l.create(f);function x({className:a,children:o,animationVariants:r,...t}){return e(c,{className:m("p-8 outline-0 max-w-max w-screen absolute top-2/4 left-2/4","shadow-[0_8px_24px_rgba(0,0,0,0.1)] rounded-lg bg-white border border-solid border-slate-400","transform -translate-x-1/2 -translate-y-1/2",a),...t,variants:r||{hidden:{transform:"translate(-50%, -50%) scale(0.8)",transition:{ease:"backIn"}},visible:{transform:"translate(-50%, -50%) scale(1)",transition:{ease:"backOut"}}},children:o})}export{x as Dialog,x as default};
1
+ import{jsx as i}from"react/jsx-runtime";import{forwardRef as f}from"react";import{Dialog as m}from"react-aria-components";import{motion as u}from"framer-motion";import{cn as c}from"../../utils/cn.js";const l=f(({style:o,animationVariants:a,...t},n)=>{const r=typeof o=="function"?o(t):o;return i(m,{...t,ref:n,style:r})});let e=null;function d(){return typeof window>"u"?null:(e||(e=u.create(l)),e)}function D({className:o,children:a,animationVariants:t,...n}){const r=d(),s={className:c("p-8 outline-0 max-w-max w-screen absolute top-2/4 left-2/4","shadow-[0_8px_24px_rgba(0,0,0,0.1)] rounded-lg bg-white border border-solid border-slate-400","transform -translate-x-1/2 -translate-y-1/2",o),...n};return r?i(r,{...s,variants:t||{hidden:{transform:"translate(-50%, -50%) scale(0.8)",transition:{ease:"backIn"}},visible:{transform:"translate(-50%, -50%) scale(1)",transition:{ease:"backOut"}}},children:a}):i(l,{...s,children:a})}export{D as Dialog,D as default};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{createContext as s,useContext as m,useState as u,useMemo as l}from"react";import{DialogTrigger as c}from"react-aria-components";const i=s({animation:"unmounted",setAnimation:()=>{},onOpenChange:()=>{}}),x=()=>m(i);function C(r){const[e,n]=u("unmounted"),o=g=>{n(g?"visible":"hidden")},a=l(()=>({animation:e,setAnimation:n,onOpenChange:o}),[e]);return t(i.Provider,{value:a,children:t(c,{...r,onOpenChange:o})})}export{C as DialogTrigger,C as default,x as useDialogTrigger};
1
+ import{jsx as r}from"react/jsx-runtime";import{createContext as u,useContext as c,useState as l,useMemo as d}from"react";import{DialogTrigger as f}from"react-aria-components";const a=u({animation:"unmounted",setAnimation:()=>{},onOpenChange:()=>{}}),D=()=>c(a);function T(g){const{onOpenChange:o,...s}=g,[e,n]=l("unmounted"),t=i=>{n(i?"visible":"hidden"),o==null||o(i)},m=d(()=>({animation:e,setAnimation:n,onOpenChange:t}),[e,o]);return r(a.Provider,{value:m,children:r(f,{...s,onOpenChange:t})})}export{T as DialogTrigger,T as default,D as useDialogTrigger};
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{forwardRef as s}from"react";import{Dialog as n}from"react-aria-components";import{motion as d}from"framer-motion";import{cn as b}from"../../utils/cn.js";const m={top:{hidden:{y:"-100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},bottom:{hidden:{y:"100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},right:{hidden:{x:"100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}},left:{hidden:{x:"-100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}}},h=s(({style:t,size:r="20rem",...e},a)=>{const o=typeof t=="function"?t(e):{...t,"--drawer-size":`${r}`};return i(n,{...e,ref:a,style:o})}),l=d.create(h);function g({direction:t="right",children:r,className:e,animationVariants:a,...o}){return i(l,{className:b("fixed p-8 outline-0 bg-white","border-solid border-slate-200","max-w-full max-h-[var(--visual-viewport-height)]",t==="top"&&"top-0 left-0 right-0 bottom-auto border-b shadow-[0_8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",t==="right"&&"top-0 left-auto bottom-0 right-0 border-l shadow-[-8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",t==="bottom"&&"bottom-0 left-0 right-0 top-auto border-t shadow-[0_-8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",t==="left"&&"top-0 bottom-0 left-0 right-auto border-r shadow-[8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",e),"data-direction":t,variants:a||m[t],...o,children:r})}export{g as Drawer,g as default};
1
+ import{jsx as n}from"react/jsx-runtime";import{forwardRef as l}from"react";import{Dialog as m}from"react-aria-components";import{motion as p}from"framer-motion";import{cn as u}from"../../utils/cn.js";const b={top:{hidden:{y:"-100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},bottom:{hidden:{y:"100%",transition:{ease:"easeIn"}},visible:{y:0,transition:{ease:"easeOut"}}},right:{hidden:{x:"100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}},left:{hidden:{x:"-100%",transition:{ease:"easeIn"}},visible:{x:0,transition:{ease:"easeOut"}}}},f=l(({style:t,size:e="20rem",...r},o)=>{const a=typeof t=="function"?t(r):{...t,"--drawer-size":`${e}`};return n(m,{...r,ref:o,style:a})});let i=null;function w(){return typeof window>"u"?null:(i||(i=p.create(f)),i)}function c({direction:t="right",children:e,className:r,animationVariants:o,...a}){const s=w(),d={className:u("fixed p-8 outline-0 bg-white","border-solid border-slate-200","max-w-full max-h-[var(--visual-viewport-height)]",t==="top"&&"top-0 left-0 right-0 bottom-auto border-b shadow-[0_8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",t==="right"&&"top-0 left-auto bottom-0 right-0 border-l shadow-[-8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",t==="bottom"&&"bottom-0 left-0 right-0 top-auto border-t shadow-[0_-8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]",t==="left"&&"top-0 bottom-0 left-0 right-auto border-r shadow-[8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]",r),"data-direction":t,...a};return s?n(s,{variants:o||b[t],...d,children:e}):n(f,{...d,children:e})}export{c as Drawer,c as default};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{forwardRef as p,useId as v}from"react";import{ModalOverlay as y}from"react-aria-components";import{motion as h,AnimatePresence as b}from"framer-motion";import{useDialogTrigger as x}from"../DialogTrigger/DialogTrigger.js";import{cn as M}from"../../utils/cn.js";const O=p(({style:i,...e},t)=>{const n=typeof i=="function"?i(e):i;return o(y,{...e,ref:t,style:n})}),g=h.create(O);function a({animate:i,animation:e,setAnimation:t,className:n,animationVariants:d,children:l,...m}){const s=v(),{key:c,...f}=m;return o(g,{isExiting:e==="hidden",onAnimationComplete:u=>{t(r=>u==="hidden"&&r==="hidden"?"unmounted":r)},variants:d||{hidden:{opacity:0,backdropFilter:"blur(0px)",transition:{delay:.08}},visible:{opacity:1,backdropFilter:"blur(8px)"}},initial:"hidden",animate:i,exit:"hidden",className:M("bg-black/30","fixed top-0 left-0","z-50","w-screen h-[var(--visual-viewport-height)]",n),...f,children:l},c||s)}function j(i){const{isOpen:e}=i,{animation:t,setAnimation:n}=x();return e!==void 0?o(b,{children:e&&o(a,{...i,animate:"visible",animation:t,setAnimation:n})}):o(a,{...i,animate:t,animation:t,setAnimation:n})}export{j as ModalOverlay,j as default};
1
+ import{jsx as t}from"react/jsx-runtime";import{forwardRef as h,useId as b}from"react";import{ModalOverlay as c}from"react-aria-components";import{AnimatePresence as O,motion as g}from"framer-motion";import{useDialogTrigger as x}from"../DialogTrigger/DialogTrigger.js";import{cn as w}from"../../utils/cn.js";const k=h(({style:i,...e},n)=>{const o=typeof i=="function"?i(e):i;return t(c,{...e,ref:n,style:o})});let r=null;function A(){return typeof window>"u"?null:(r||(r=g.create(k)),r)}function s({animate:i,animation:e,setAnimation:n,className:o,animationVariants:f,children:a,...u}){const p=b(),d=A(),{key:v,...y}=u,l={className:w("bg-black/30","fixed top-0 left-0","z-50","w-screen h-[var(--visual-viewport-height)]",o),...y};return d?t(d,{isExiting:e==="hidden",onAnimationComplete:M=>{n(m=>M==="hidden"&&m==="hidden"?"unmounted":m)},variants:f||{hidden:{opacity:0,backdropFilter:"blur(0px)",transition:{delay:.08}},visible:{opacity:1,backdropFilter:"blur(8px)"}},initial:"hidden",animate:i,exit:"hidden",...l,children:a},v||p):t(c,{...l,children:a})}function D(i){const{isOpen:e}=i,{animation:n,setAnimation:o}=x();return e!==void 0?t(O,{children:e&&t(s,{...i,animate:"visible",animation:n,setAnimation:o})}):t(s,{...i,animate:n,animation:n,setAnimation:o})}export{D as ModalOverlay,D as default};
@@ -1 +1 @@
1
- import{jsxs as T,jsx as s}from"react/jsx-runtime";import{useState as j,useRef as J,useEffect as z}from"react";import{Group as M,Label as U,TextField as E,Input as K,Text as Z,FieldError as H}from"react-aria-components";import{cn as f}from"../../utils/cn.js";function q({description:D,errorMessage:P,isDisabled:k=!1,isInvalid:A=!1,isMasked:L=!1,isRequired:V=!0,label:$,length:c=6,name:h,onChange:w,value:v="",type:I="numeric",validationBehavior:m="native",className:F,classNames:r,...R}){const[S,W]=j(v),[i,g]=j(Array(c).fill("")),a=J([]);z(()=>{a.current=a.current.slice(0,c)},[c]),z(()=>{const t=i.join("");W(t),w&&w(t)},[w,i]);const B=t=>{var l,o;const e=t.target.value,u=Number(t.target.getAttribute("data-pin-input-index"));e!==""&&u<i.length-1&&((o=(l=a.current)==null?void 0:l[u+1])==null||o.focus());const d=i.map((x,p)=>p===u?e:x);g(d)},C=t=>{var l,o,x,p;const e=Number(t.currentTarget.getAttribute("data-pin-input-index"));if(t.ctrlKey||t.metaKey)return;const u=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Control","Alt","Meta","Shift","Tab","Enter","Escape"],d={alpha:/^[a-z]$/i,alphanumeric:/^[a-z0-9]$/i,numeric:/^[0-9]$/i};if(!t.key.match(d[I])&&!u.includes(t.key)&&t.preventDefault(),i[e]===""&&e>0&&t.key==="Backspace"){const b=i.map((n,y)=>y===e-1?"":n);g(b),(o=(l=a.current)==null?void 0:l[e-1])==null||o.focus(),t.preventDefault()}if(i[e]===""&&e<i.length-1&&t.key==="Delete"){const b=i.map((n,y)=>y===e+1?"":n);g(b),(p=(x=a.current)==null?void 0:x[e+1])==null||p.focus(),t.preventDefault()}},G=t=>{var p,b;const e=Number(t.currentTarget.getAttribute("data-pin-input-index"));t.preventDefault();const u=(p=t.clipboardData)==null?void 0:p.getData("text");if(!u)return;const d=u.split("").filter(n=>{switch(I){case"alpha":return/^[a-zA-Z]$/.test(n);case"alphanumeric":return/^[a-z0-9]$/i.test(n);case"numeric":default:return/^[0-9]$/.test(n)}});if(d.length===0)return;const l=[...i];let o=e;for(let n=0;n<d.length&&e+n<c;n++)l[e+n]=d[n],o=e+n;g(l);const x=o+1<c?o+1:c-1;(b=a.current[x])==null||b.focus()};return T(M,{className:f("flex flex-wrap gap-2",F),"aria-label":$,...R,children:[s(U,{className:f("flex text-slate-500 text-sm grow shrink-0 basis-full",r==null?void 0:r.label),children:$}),i.map((t,e)=>s(E,{className:f("flex flex-col w-full flex-1 text-slate-900",r==null?void 0:r.inputWrap),"aria-label":`Pin Input Digit ${e+1}`,isDisabled:k,isInvalid:A,isRequired:V,validationBehavior:m,children:s(K,{className:f("border-solid border border-slate-300 rounded-md","text-sm text-slate-900 placeholder-slate-400 text-center","h-10 px-2 py-0 m-0 w-full","bg-white","transition-all duration-200 ease-in-out","hover:border-slate-400","focus:outline-2 focus:outline focus:outline-slate-200 focus:border-slate-400","disabled:border-slate-200 disabled:bg-slate-100","invalid:border-red-500 invalid:bg-red-100 invalid:text-red-600","invalid:hover:border-red-600 invalid:focus:border-red-600 invalid:focus:outline-red-200",r==null?void 0:r.input),onChange:B,onKeyDown:C,onPaste:G,type:L?"password":"text",ref:u=>{u&&(a.current[e]=u)},value:t,maxLength:1,name:h&&`${h}-${e}`,"data-pin-input-index":e})},`pin-input-${e}`)),T(E,{className:f("flex flex-row flex-wrap grow shrink-0 basis-full",r==null?void 0:r.textWrap),"aria-label":"Pin Input",isDisabled:k,isInvalid:A,isRequired:V,validationBehavior:m,children:[h&&s(K,{type:"hidden",name:h,value:S}),D&&s(Z,{className:f("flex text-slate-500 text-sm grow shrink-0 basis-full",r==null?void 0:r.description),slot:"description",children:D}),s(H,{className:f("flex text-red-500 text-sm grow shrink-0 basis-full",r==null?void 0:r.error),children:P})]})]})}export{q as PinInput,q as default};
1
+ import{jsxs as T,jsx as h}from"react/jsx-runtime";import{useState as z,useRef as G,useEffect as U}from"react";import{Group as Z,Label as v,TextField as K,Input as H,Text as P}from"react-aria-components";import{cn as b}from"../../utils/cn.js";function C({description:m,errorMessage:y,isDisabled:A=!1,isInvalid:D=!1,isMasked:E=!1,isRequired:I=!0,label:$,length:s=6,name:M,onChange:f,value:L="",type:j="numeric",validationBehavior:J="native",className:R,classNames:r,...S}){const[Q,g]=z(L),[o,V]=z(Array(s).fill("")),x=G([]);U(()=>{x.current=x.current.slice(0,s)},[s]);const W=e=>{var l,d;const t=e.target.value,n=Number(e.target.getAttribute("data-pin-input-index"));t!==""&&n<o.length-1&&((d=(l=x.current)==null?void 0:l[n+1])==null||d.focus());const p=o.map((w,u)=>u===n?t:w);V(p);const a=p.join("");g(a),f&&f(a)},B=e=>{var a,l,d,w;const t=Number(e.currentTarget.getAttribute("data-pin-input-index"));if(e.ctrlKey||e.metaKey)return;const n=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Control","Alt","Meta","Shift","Tab","Enter","Escape"],p={alpha:/^[a-z]$/i,alphanumeric:/^[a-z0-9]$/i,numeric:/^[0-9]$/i};if(!e.key.match(p[j])&&!n.includes(e.key)&&e.preventDefault(),o[t]===""&&t>0&&e.key==="Backspace"){const u=o.map((i,k)=>k===t-1?"":i);V(u),(l=(a=x.current)==null?void 0:a[t-1])==null||l.focus(),e.preventDefault();const c=u.join("");g(c),f&&f(c)}if(o[t]===""&&t<o.length-1&&e.key==="Delete"){const u=o.map((i,k)=>k===t+1?"":i);V(u),(w=(d=x.current)==null?void 0:d[t+1])==null||w.focus(),e.preventDefault();const c=u.join("");g(c),f&&f(c)}},F=e=>{var u,c;const t=Number(e.currentTarget.getAttribute("data-pin-input-index"));e.preventDefault();const n=(u=e.clipboardData)==null?void 0:u.getData("text");if(!n)return;const p=n.split("").filter(i=>{switch(j){case"alpha":return/^[a-zA-Z]$/.test(i);case"alphanumeric":return/^[a-z0-9]$/i.test(i);case"numeric":default:return/^[0-9]$/.test(i)}});if(p.length===0)return;const a=[...o];let l=t;for(let i=0;i<p.length&&t+i<s;i++)a[t+i]=p[i],l=t+i;V(a);const d=a.join("");g(d),f&&f(d);const w=l+1<s?l+1:s-1;(c=x.current[w])==null||c.focus()};return T(Z,{className:b("flex flex-wrap gap-2",R),"aria-label":$,...S,children:[h(v,{className:b("flex text-slate-500 text-sm grow shrink-0 basis-full",r==null?void 0:r.label),children:$}),o.map((e,t)=>h(K,{className:b("flex flex-col w-full flex-1 text-slate-900",r==null?void 0:r.inputWrap),"aria-label":`Pin Input Digit ${t+1}`,isDisabled:A,isInvalid:D,isRequired:I,validationBehavior:J,children:h(H,{className:b("border-solid border border-slate-300 rounded-md","text-sm text-slate-900 placeholder-slate-400 text-center","h-10 px-2 py-0 m-0 w-full","bg-white","transition-all duration-200 ease-in-out","hover:border-slate-400","focus:outline-2 focus:outline focus:outline-slate-200 focus:border-slate-400","disabled:border-slate-200 disabled:bg-slate-100","invalid:border-red-500 invalid:bg-red-100 invalid:text-red-600","invalid:hover:border-red-600 invalid:focus:border-red-600 invalid:focus:outline-red-200",r==null?void 0:r.input),onChange:W,onKeyDown:B,onPaste:F,type:E?"password":"text",autoComplete:"one-time-code",ref:n=>{n&&(x.current[t]=n)},value:e,maxLength:1,"data-pin-input-index":t})},`pin-input-${t}`)),T(K,{className:b("flex flex-row flex-wrap grow shrink-0 basis-full",r==null?void 0:r.textWrap),"aria-label":"Pin Input",isDisabled:A,isInvalid:D,isRequired:I,validationBehavior:J,children:[m&&h(P,{className:b("flex text-slate-500 text-sm grow shrink-0 basis-full",r==null?void 0:r.description),slot:"description",children:m}),D&&y&&typeof y=="string"&&h(P,{className:b("flex text-red-500 text-sm grow shrink-0 basis-full",r==null?void 0:r.error),slot:"errorMessage",children:y})]})]})}export{C as PinInput,C as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as v,Fragment as P}from"react/jsx-runtime";import{Popover as j,ComboBox as m,Label as A,Input as D,Button as E,Text as F,FieldError as M,ListBox as T}from"react-aria-components";import{forwardRef as w,useState as g}from"react";import{motion as R}from"framer-motion";import{cn as o}from"../../utils/cn.js";import{Pulse as U}from"../Loader/Pulse.js";const W=w((d,i)=>e(j,{...d,ref:i})),q=R.create(W);function z({buttonIcon:d,...i}){return d?typeof d=="function"?d(i):d:e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o("transition-all ease-in-out duration-200",i.isOpen?"rotate-180":"rotate-0"),children:e("path",{d:"M6 9L12 15L18 9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o(["stroke-slate-900",i.isDisabled&&"stroke-slate-400",i.isInvalid&&"stroke-red-500"])})})}function G({listBoxComponent:d,children:i,...r}){return e(d||T,{...r,children:i})}function H({label:d,description:i,errorMessage:r,children:u,placeholder:C,key:B,isLoading:a,slots:n,popoverPortalContainer:c,popoverOffset:_,selectedKey:x,className:k,classNames:t,autoComplete:y,...b},L){const[l,f]=g("unmounted"),[h,S]=g(!1);return e(m,{onOpenChange:()=>{f(l==="visible"?"hidden":"visible"),S(!h)},isDisabled:b.isDisabled||a,"data-has-value":!!x,selectedKey:x,...b,className:o("flex flex-col","w-full",k),children:I=>v(P,{children:[e(A,{className:o("flex","text-xs text-slate-500",t==null?void 0:t.label),children:d}),v("div",{className:o("flex","relative","w-full",t==null?void 0:t.comboBoxContainer),children:[e(D,{placeholder:C,className:o("border border-solid border-slate-300","text-sm text-slate-900","py-0 px-2","h-10 w-full","m-0","rounded-md","bg-white","transition-all ease-in-out duration-200","data-[hovered]:border-slate-400","data-[focused]:border-slate-400 data-[focused]:outline data-[focused]:outline-2 data-[focused]:outline-slate-200"," data-[disabled]:bg-slate-100 data-[disabled]:border-slate-300",a?"data-[disabled]:text-slate-900":"data-[disabled]:text-slate-500","data-[invalid]:border-red-500 data-[invalid]:bg-red-100 data-[invalid]:text-red-600","data-[invalid]:data-[hovered]:border-red-600","data-[invalid]:data-[focused]:border-red-600 data-[invalid]:data-[focused]:outline data-[invalid]:data-[focused]:outline-2 data-[invalid]:data-[focused]:outline-red-200","data-[invalid]:placeholder:text-slate-400",t==null?void 0:t.input),ref:L,autoComplete:y}),a?e("div",{className:o("absolute top-2 right-2","block",t==null?void 0:t.loader),children:(n==null?void 0:n.loadingIcon)||e(U,{})}):e(E,{className:o("absolute top-2 right-0","block","border-none","bg-none",t==null?void 0:t.arrowButton),children:e(z,{buttonIcon:n==null?void 0:n.buttonIcon,...I})})]}),i&&e(F,{slot:"description",className:o("flex","text-xs","text-slate-500",t==null?void 0:t.description),children:i}),e(M,{className:o("flex","text-xs","text-red-500",t==null?void 0:t.errorMessage),children:r}),e(q,{isOpen:h,isExiting:l==="hidden",offset:_,UNSTABLE_portalContainer:c,onAnimationComplete:O=>{f(p=>O==="hidden"&&p==="hidden"?"unmounted":p)},variants:{hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},initial:"hidden",animate:l,className:o("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-[var(--trigger-width)]","bg-white","border border-solid border-slate-300",t==null?void 0:t.listContainer),children:e(G,{listBoxComponent:n==null?void 0:n.listBoxComponent,className:o("max-h-80","overflow-y-scroll",t==null?void 0:t.list),children:u})},B)]})})}const $=w(H);export{$ as Select,$ as default};
1
+ import{jsx as e,jsxs as _,Fragment as j}from"react/jsx-runtime";import{Popover as D,ComboBox as F,Label as T,Input as U,Button as R,Text as W,FieldError as q,ListBox as z}from"react-aria-components";import{forwardRef as L,useState as y}from"react";import{motion as G}from"framer-motion";import{cn as o}from"../../utils/cn.js";import{Pulse as H}from"../Loader/Pulse.js";const S=L((d,n)=>e(D,{...d,ref:n}));let f=null;function J(){return typeof window>"u"?null:(f||(f=G.create(S)),f)}function Q({buttonIcon:d,...n}){return d?typeof d=="function"?d(n):d:e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o("transition-all ease-in-out duration-200",n.isOpen?"rotate-180":"rotate-0"),children:e("path",{d:"M6 9L12 15L18 9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o(["stroke-slate-900",n.isDisabled&&"stroke-slate-400",n.isInvalid&&"stroke-red-500"])})})}function k({listBoxComponent:d,children:n,...r}){return e(d||z,{...r,children:n})}function V({label:d,description:n,errorMessage:r,children:a,placeholder:I,key:b,isLoading:l,slots:i,popoverPortalContainer:p,popoverOffset:h,selectedKey:v,className:M,classNames:t,autoComplete:O,...w},m){const[u,g]=y("unmounted"),[x,A]=y(!1),C=J(),B=o("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-[var(--trigger-width)]","bg-white","border border-solid border-slate-300",t==null?void 0:t.listContainer);return e(F,{onOpenChange:()=>{g(u==="visible"?"hidden":"visible"),A(!x)},isDisabled:w.isDisabled||l,"data-has-value":!!v,selectedKey:v,...w,className:o("flex flex-col","w-full",M),children:E=>_(j,{children:[e(T,{className:o("flex","text-xs text-slate-500",t==null?void 0:t.label),children:d}),_("div",{className:o("flex","relative","w-full",t==null?void 0:t.comboBoxContainer),children:[e(U,{placeholder:I,className:o("border border-solid border-slate-300","text-sm text-slate-900","py-0 px-2","h-10 w-full","m-0","rounded-md","bg-white","transition-all ease-in-out duration-200","data-[hovered]:border-slate-400","data-[focused]:border-slate-400 data-[focused]:outline data-[focused]:outline-2 data-[focused]:outline-slate-200"," data-[disabled]:bg-slate-100 data-[disabled]:border-slate-300",l?"data-[disabled]:text-slate-900":"data-[disabled]:text-slate-500","data-[invalid]:border-red-500 data-[invalid]:bg-red-100 data-[invalid]:text-red-600","data-[invalid]:data-[hovered]:border-red-600","data-[invalid]:data-[focused]:border-red-600 data-[invalid]:data-[focused]:outline data-[invalid]:data-[focused]:outline-2 data-[invalid]:data-[focused]:outline-red-200","data-[invalid]:placeholder:text-slate-400",t==null?void 0:t.input),ref:m,autoComplete:O}),l?e("div",{className:o("absolute top-2 right-2","block",t==null?void 0:t.loader),children:(i==null?void 0:i.loadingIcon)||e(H,{})}):e(R,{className:o("absolute top-2 right-0","block","border-none","bg-none",t==null?void 0:t.arrowButton),children:e(Q,{buttonIcon:i==null?void 0:i.buttonIcon,...E})})]}),n&&e(W,{slot:"description",className:o("flex","text-xs","text-slate-500",t==null?void 0:t.description),children:n}),e(q,{className:o("flex","text-xs","text-red-500",t==null?void 0:t.errorMessage),children:r}),C?e(C,{isOpen:x,isExiting:u==="hidden",offset:h,UNSTABLE_portalContainer:p,onAnimationComplete:P=>{g(c=>P==="hidden"&&c==="hidden"?"unmounted":c)},variants:{hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},initial:"hidden",animate:u,className:B,children:e(k,{listBoxComponent:i==null?void 0:i.listBoxComponent,className:o("max-h-80","overflow-y-scroll",t==null?void 0:t.list),children:a})},b):e(S,{isOpen:x,offset:h,UNSTABLE_portalContainer:p,className:B,children:e(k,{listBoxComponent:i==null?void 0:i.listBoxComponent,className:o("max-h-80","overflow-y-scroll",t==null?void 0:t.list),children:a})},b)]})})}const s=L(V);export{s as Select,s as default};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const TabsOrientationContext: React.Context<'horizontal' | 'vertical'>;
3
+ export default TabsOrientationContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clicktap/ui",
3
- "version": "0.14.19",
3
+ "version": "0.14.25",
4
4
  "private": false,
5
5
  "author": "Clicktap",
6
6
  "description": "A library of React UI components and low-level hooks.",
@@ -1,82 +0,0 @@
1
- 'use client';
2
-
3
- import { Accordion as NextUiAccordion } from '@nextui-org/accordion';
4
- import type { AccordionProps } from '@nextui-org/accordion';
5
- import { cn } from '../../utils/cn';
6
- import { DownArrow } from '../Icon/DownArrow';
7
-
8
- export function Accordion({
9
- children,
10
- variant,
11
- isCompact,
12
- className,
13
- itemClasses,
14
- ...props
15
- }: AccordionProps) {
16
- return (
17
- <NextUiAccordion
18
- variant={variant}
19
- isCompact={isCompact}
20
- dividerProps={{
21
- className: cn(
22
- 'my-2 border-solid border-slate-200',
23
- variant === 'shadow' && 'border-slate-300'
24
- ),
25
- }}
26
- className={cn(
27
- 'px-0',
28
- variant === 'bordered' && [
29
- 'px-4 py-4 rounded-xl border-2 border-slate-200',
30
- ],
31
- variant === 'shadow' && [
32
- 'px-4 py-4 rounded-xl bg-slate-100 shadow-slate-200 border border-slate-200',
33
- ],
34
- className
35
- )}
36
- itemClasses={{
37
- base: cn(
38
- 'w-full py-2',
39
- 'data-[disabled="true"]:pointer-events-none data-[disabled="true"]:opacity-50',
40
- variant === 'bordered' && ['rounded-xl py-0'],
41
- variant === 'splitted' && [
42
- 'flex flex-col bg-slate-100 rounded-xl border border-slate-200',
43
- ],
44
- isCompact && 'py-0',
45
- itemClasses?.base
46
- ),
47
- trigger: cn(
48
- 'w-full h-full flex items-center gap-3 py-0 appearance-none cursor-pointer select-none',
49
- 'data-[focus-visible="true"]:outline-2 data-[focus-visible="true"]:outline data-[focus-visible="true"]:outline-slate-100',
50
- 'bg-transparent text-inherit',
51
- isCompact && ['py-2'],
52
- itemClasses?.trigger
53
- ),
54
- title: cn(
55
- 'text-xl font-semibold',
56
- isCompact && 'text-base',
57
- itemClasses?.title
58
- ),
59
- subtitle: cn(
60
- 'text-base',
61
- isCompact && 'text-sm',
62
- itemClasses?.subtitle
63
- ),
64
- titleWrapper: cn('text-left', itemClasses?.titleWrapper),
65
- startContent: cn('shrink-0', itemClasses?.startContent),
66
- content: cn([isCompact ? 'py-1' : 'py-2'], itemClasses?.content),
67
- indicator: itemClasses?.indicator,
68
- heading: itemClasses?.heading,
69
- }}
70
- // eslint-disable-next-line react/jsx-props-no-spreading
71
- {...props}
72
- >
73
- {children}
74
- </NextUiAccordion>
75
- );
76
- }
77
-
78
- export default Accordion;
79
-
80
- export function AccordionItemArrow() {
81
- return <DownArrow className="w-4 h-4" />;
82
- }
@@ -1,3 +0,0 @@
1
- export { Accordion, AccordionItemArrow } from './Accordion';
2
- export { AccordionItem } from '@nextui-org/accordion';
3
- export type { AccordionProps } from '@nextui-org/accordion';
@@ -1,99 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { Avatar } from './Avatar';
4
- import type { AvatarProps } from './Avatar.types';
5
- import { AvatarGroup } from './AvatarGroup/AvatarGroup';
6
- import type { AvatarGroupProps } from './AvatarGroup/AvatarGroup.types';
7
-
8
- function Layout({ children }: { children: ReactNode }) {
9
- return children;
10
- }
11
-
12
- function AvatarExample(props: AvatarProps) {
13
- return (
14
- <Layout>
15
- {/* eslint-disable-next-line react/jsx-props-no-spreading */}
16
- <Avatar {...props} />
17
- </Layout>
18
- );
19
- }
20
-
21
- function AvatarGroupExample(props: AvatarGroupProps) {
22
- return (
23
- <Layout>
24
- {/* eslint-disable-next-line react/jsx-props-no-spreading */}
25
- <AvatarGroup {...props}>
26
- <Avatar src="https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg" />
27
- <Avatar src="https://i.pravatar.cc/150?u=a042581f4e29026704d" />
28
- <Avatar src="https://i.pravatar.cc/150?u=a04258114e29026702d" />
29
- <Avatar src="https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg" />
30
- <Avatar src="https://i.pravatar.cc/150?u=a042581f4e29026704d" />
31
- <Avatar src="https://i.pravatar.cc/150?u=a04258114e29026702d" />
32
- </AvatarGroup>
33
- </Layout>
34
- );
35
- }
36
-
37
- type Story = StoryObj<typeof Avatar>;
38
- type StoryGroup = StoryObj<typeof AvatarGroup>;
39
-
40
- const meta: Meta<typeof Layout> = {
41
- component: Layout,
42
- };
43
-
44
- export default meta;
45
-
46
- export const AvatarComponent: Story = {
47
- name: 'Avatar',
48
- render: AvatarExample,
49
- argTypes: {
50
- src: {
51
- control: 'text',
52
- },
53
- name: {
54
- control: 'text',
55
- },
56
- size: {
57
- options: ['sm', 'md', 'lg'],
58
- control: 'radio',
59
- },
60
- showFallback: {
61
- control: 'boolean',
62
- },
63
- radius: {
64
- options: ['sm', 'md', 'lg', 'none', 'full'],
65
- control: 'radio',
66
- },
67
- isBordered: {
68
- control: 'boolean',
69
- },
70
- isDisabled: {
71
- control: 'boolean',
72
- },
73
- isFocusable: {
74
- control: 'boolean',
75
- },
76
- },
77
- args: {
78
- src: 'https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg',
79
- name: 'Avatar',
80
- size: 'md',
81
- showFallback: false,
82
- radius: 'full',
83
- isBordered: false,
84
- isDisabled: false,
85
- isFocusable: false,
86
- },
87
- };
88
- export const AvatarGroupComponent: StoryGroup = {
89
- name: 'Avatar Group',
90
- render: AvatarGroupExample,
91
- argTypes: {
92
- isGrid: {
93
- control: 'boolean',
94
- },
95
- },
96
- args: {
97
- isGrid: false,
98
- },
99
- };
@@ -1,120 +0,0 @@
1
- 'use client';
2
-
3
- import { useAvatarGroupContext, Avatar as UiAvatar } from '@nextui-org/avatar';
4
- import { cn } from '../../utils/cn';
5
- import type { AvatarProps } from './Avatar.types';
6
-
7
- export function Avatar({
8
- icon,
9
- className,
10
- isDisabled,
11
- size,
12
- classNames,
13
- isBordered,
14
- radius,
15
- ...props
16
- }: AvatarProps) {
17
- const avatarGroupContext = useAvatarGroupContext();
18
- return (
19
- <div
20
- className={cn(
21
- 'group',
22
- 'z-10',
23
- 'first:ms-0',
24
- !avatarGroupContext?.isGrid && !!avatarGroupContext && '-ms-2',
25
- className
26
- )}
27
- >
28
- <UiAvatar
29
- // eslint-disable-next-line react/jsx-props-no-spreading
30
- {...props}
31
- isDisabled={isDisabled}
32
- size={size}
33
- radius={radius}
34
- isBordered={isBordered}
35
- className={cn(
36
- !avatarGroupContext?.isGrid &&
37
- !!avatarGroupContext &&
38
- 'group-hover:-translate-y-3.5',
39
- 'transition-transform duration-300 ease-in-out',
40
- 'bg-slate-100',
41
- 'flex items-center justify-center',
42
- 'relative',
43
- 'z-10',
44
- 'overflow-hidden',
45
- isDisabled ? 'opacity-50' : 'opacity-100',
46
- [
47
- size === 'sm' && 'h-8',
48
- size === 'md' && 'h-10',
49
- size === 'lg' && 'h-12',
50
- size === 'sm' && 'w-8',
51
- size === 'md' && 'w-10',
52
- size === 'lg' && 'w-12',
53
- ],
54
- [
55
- radius === 'full' && 'rounded-full',
56
- radius === 'lg' && 'rounded-2xl',
57
- radius === 'md' && 'rounded-xl',
58
- radius === 'sm' && 'rounded-lg',
59
- radius === 'none' && 'rounded-none',
60
- ],
61
- isBordered &&
62
- 'shadow-[#fff_0px_0px_0px_2px,_#f1f5f9_0px_0px_0px_4px,_#00000000_0px_0px_0px_0px]',
63
- classNames?.base
64
- )}
65
- classNames={{
66
- icon: cn(
67
- 'data-[loaded=true]:opacity-100 opacity-0',
68
- 'absolute',
69
- 'w-full',
70
- 'h-full',
71
- 'overflow-hidden',
72
- 'object-cover',
73
- 'object-center',
74
- 'transition-opacity ease-in-out duration-500',
75
- classNames?.icon
76
- ),
77
- name: cn(
78
- 'flex items-center justify-center',
79
- 'absolute top-1/2 left-1/2',
80
- '-translate-x-1/2 -translate-y-1/2',
81
- 'text-xs text-center',
82
- 'max-w-full',
83
- 'overflow-hidden',
84
- classNames?.name
85
- ),
86
- fallback: cn(
87
- 'flex items-center justify-center',
88
- 'absolute top-1/2 left-1/2',
89
- '-translate-x-1/2 -translate-y-1/2',
90
- 'text-xs text-center',
91
- 'max-w-full',
92
- 'overflow-hidden',
93
- classNames?.fallback
94
- ),
95
- }}
96
- icon={
97
- icon || (
98
- <svg
99
- width="24"
100
- height="24"
101
- viewBox="0 0 24 24"
102
- fill="none"
103
- xmlns="http://www.w3.org/2000/svg"
104
- >
105
- <path
106
- d="M20 21C20 19.6044 20 18.9067 19.8278 18.3389C19.44 17.0605 18.4395 16.06 17.1611 15.6722C16.5933 15.5 15.8956 15.5 14.5 15.5H9.5C8.10444 15.5 7.40665 15.5 6.83886 15.6722C5.56045 16.06 4.56004 17.0605 4.17224 18.3389C4 18.9067 4 19.6044 4 21M16.5 7.5C16.5 9.98528 14.4853 12 12 12C9.51472 12 7.5 9.98528 7.5 7.5C7.5 5.01472 9.51472 3 12 3C14.4853 3 16.5 5.01472 16.5 7.5Z"
107
- stroke="black"
108
- strokeWidth="2"
109
- strokeLinecap="round"
110
- strokeLinejoin="round"
111
- />
112
- </svg>
113
- )
114
- }
115
- />
116
- </div>
117
- );
118
- }
119
-
120
- export default Avatar;
@@ -1,3 +0,0 @@
1
- import type { AvatarProps as NextAvatarProps } from '@nextui-org/avatar';
2
-
3
- export type AvatarProps = Omit<NextAvatarProps, 'color'>;
@@ -1,32 +0,0 @@
1
- 'use client';
2
-
3
- import { AvatarGroup as UIAvatarGroup } from '@nextui-org/avatar';
4
- import type { PropsWithChildren } from 'react';
5
- import { cn } from '../../../utils/cn';
6
- import type { AvatarGroupProps } from './AvatarGroup.types';
7
-
8
- export function AvatarGroup({
9
- children,
10
- isGrid,
11
- renderCount,
12
- className,
13
- }: PropsWithChildren<AvatarGroupProps>) {
14
- return (
15
- <UIAvatarGroup
16
- isGrid={isGrid}
17
- max={0}
18
- renderCount={renderCount ?? undefined}
19
- className={cn(
20
- isGrid ? 'inline-grid' : 'flex',
21
- isGrid ? 'gap-3' : 'gap-0',
22
- 'grid-cols-4',
23
- 'items-center',
24
- className
25
- )}
26
- >
27
- {children}
28
- </UIAvatarGroup>
29
- );
30
- }
31
-
32
- export default AvatarGroup;
@@ -1,8 +0,0 @@
1
- import type { AvatarGroupProps as NextAvatarGroupProps } from '@nextui-org/avatar';
2
-
3
- export type AvatarGroupProps = Pick<
4
- NextAvatarGroupProps,
5
- 'isGrid' | 'renderCount'
6
- > & {
7
- className?: string;
8
- };
@@ -1,4 +0,0 @@
1
- export { Avatar } from './Avatar';
2
- export { AvatarGroup } from './AvatarGroup/AvatarGroup';
3
- export type { AvatarProps } from './Avatar.types';
4
- export type { AvatarGroupProps } from './AvatarGroup/AvatarGroup.types';
@@ -1,72 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Badge } from './Badge';
3
- import type { BadgeProps } from './Badge.types';
4
- import { Avatar } from '../Avatar/Avatar';
5
-
6
- type Story = StoryObj<typeof Badge>;
7
-
8
- function Component(props: BadgeProps) {
9
- return (
10
- <Badge {...props}>
11
- <Avatar name="Regular" radius="md" />
12
- </Badge>
13
- );
14
- }
15
-
16
- const meta: Meta<typeof Component> = {
17
- component: Component,
18
- };
19
-
20
- export default meta;
21
-
22
- export const Example: Story = {
23
- render: Component,
24
- argTypes: {
25
- content: {
26
- control: 'text',
27
- },
28
- variant: {
29
- options: ['shadow', 'flat', 'solid', 'faded'],
30
- control: 'radio',
31
- },
32
- size: {
33
- options: ['sm', 'md', 'lg'],
34
- control: 'radio',
35
- },
36
- placement: {
37
- options: ['top-right', 'bottom-right', 'bottom-left', 'top-left'],
38
- control: 'radio',
39
- },
40
- shape: {
41
- options: ['circle', 'rectangle'],
42
- control: 'radio',
43
- },
44
- isInvisible: {
45
- control: 'boolean',
46
- },
47
- isOneChar: {
48
- control: 'boolean',
49
- },
50
- isDot: {
51
- control: 'boolean',
52
- },
53
- disableAnimation: {
54
- control: 'boolean',
55
- },
56
- showOutline: {
57
- control: 'boolean',
58
- },
59
- },
60
- args: {
61
- content: '5',
62
- variant: 'solid',
63
- size: 'md',
64
- placement: 'top-right',
65
- shape: 'rectangle',
66
- isInvisible: false,
67
- isOneChar: false,
68
- isDot: false,
69
- disableAnimation: false,
70
- showOutline: true,
71
- },
72
- };