@bzync/rui 0.0.5 → 0.0.8
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 +5 -0
- package/dist/autocomplete-D6z5B-WU.cjs +1 -0
- package/dist/{autocomplete-BgKbj6M4.js → autocomplete-bgySuP8X.js} +149 -142
- package/dist/calendar-CQumLNgS.cjs +1 -0
- package/dist/{calendar-j2_zvum1.js → calendar-nkYCMEy3.js} +9 -9
- package/dist/charts-Cot5lCgC.cjs +1 -0
- package/dist/{charts-CxEy2c3M.js → charts-Dscl6UC3.js} +122 -145
- package/dist/cn-B6R3HKzx.cjs +1 -0
- package/dist/{cn-DpgY2leY.js → cn-BJyZJP-y.js} +389 -389
- package/dist/{component-styles-Bgy44fc8.js → component-styles-C2CbHEEA.js} +2 -2
- package/dist/component-styles-DY4wigiq.cjs +1 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.cjs +1 -1
- package/dist/components/alert.js +3 -3
- package/dist/components/aspect-ratio.cjs +1 -1
- package/dist/components/aspect-ratio.js +1 -1
- package/dist/components/auth-backdrop.cjs +1 -1
- package/dist/components/auth-backdrop.d.ts +4 -1
- package/dist/components/auth-backdrop.js +12 -8
- package/dist/components/autocomplete/dropdown.d.ts +4 -1
- package/dist/components/autocomplete/multi-trigger.d.ts +3 -1
- package/dist/components/autocomplete/single-trigger.d.ts +3 -1
- package/dist/components/autocomplete/types.d.ts +15 -0
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar-group.cjs +1 -1
- package/dist/components/avatar-group.js +1 -1
- package/dist/components/avatar.cjs +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/billing-interval-toggle.cjs +1 -1
- package/dist/components/billing-interval-toggle.d.ts +4 -6
- package/dist/components/billing-interval-toggle.js +26 -19
- package/dist/components/blockquote.cjs +1 -1
- package/dist/components/blockquote.js +3 -3
- package/dist/components/breadcrumb.cjs +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.cjs +1 -1
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.js +79 -36
- package/dist/components/calendar.cjs +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.js +14 -14
- package/dist/components/card.cjs +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts.cjs +1 -1
- package/dist/components/charts.js +1 -1
- package/dist/components/checkbox.cjs +1 -1
- package/dist/components/checkbox.js +3 -3
- package/dist/components/code.cjs +3 -3
- package/dist/components/code.js +4 -4
- package/dist/components/command.cjs +1 -1
- package/dist/components/command.d.ts +8 -1
- package/dist/components/command.js +84 -83
- package/dist/components/confirm-dialog.cjs +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -1
- package/dist/components/confirm-dialog.js +37 -31
- package/dist/components/copy-button.cjs +1 -1
- package/dist/components/copy-button.js +3 -2
- package/dist/components/currency.cjs +1 -1
- package/dist/components/currency.js +1 -1
- package/dist/components/datatable/types.d.ts +4 -0
- package/dist/components/datatable.cjs +1 -1
- package/dist/components/datatable.d.ts +1 -5
- package/dist/components/datatable.js +1 -1
- package/dist/components/datepicker.cjs +1 -1
- package/dist/components/datepicker.d.ts +3 -3
- package/dist/components/datepicker.js +234 -105
- package/dist/components/description-list.cjs +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/divider.cjs +1 -1
- package/dist/components/divider.js +1 -1
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.d.ts +6 -1
- package/dist/components/drawer.js +128 -2
- package/dist/components/dropdown-menu-panel.cjs +1 -0
- package/dist/components/dropdown-menu-panel.d.ts +24 -0
- package/dist/components/dropdown-menu-panel.js +84 -0
- package/dist/components/dropdown-menu.cjs +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -1
- package/dist/components/dropdown-menu.js +38 -93
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.ts +5 -1
- package/dist/components/empty-state.js +9 -9
- package/dist/components/error-state.cjs +1 -1
- package/dist/components/error-state.js +2 -2
- package/dist/components/file-upload.cjs +1 -1
- package/dist/components/file-upload.js +4 -4
- package/dist/components/form-field.cjs +1 -1
- package/dist/components/form-field.d.ts +9 -0
- package/dist/components/form-field.js +49 -14
- package/dist/components/info-button.cjs +1 -1
- package/dist/components/info-button.d.ts +5 -3
- package/dist/components/info-button.js +33 -29
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.cjs +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/label.cjs +1 -1
- package/dist/components/label.js +2 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link.cjs +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.d.ts +8 -1
- package/dist/components/modal.js +74 -120
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.js +2 -2
- package/dist/components/number-input.cjs +1 -1
- package/dist/components/number-input.js +3 -3
- package/dist/components/otp-input.cjs +1 -1
- package/dist/components/otp-input.js +2 -2
- package/dist/components/overlay.cjs +1 -0
- package/dist/components/overlay.d.ts +52 -0
- package/dist/components/overlay.js +87 -0
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.d.ts +2 -1
- package/dist/components/popover.js +41 -40
- package/dist/components/progressbar.cjs +1 -1
- package/dist/components/progressbar.js +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.js +3 -3
- package/dist/components/rating.cjs +1 -1
- package/dist/components/rating.js +3 -3
- package/dist/components/richtext.cjs +1 -1
- package/dist/components/richtext.js +2 -2
- package/dist/components/scroll-area.cjs +1 -1
- package/dist/components/scroll-area.js +3 -3
- package/dist/components/select/option-list.d.ts +3 -1
- package/dist/components/select/types.d.ts +4 -0
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/seo.cjs +1 -1
- package/dist/components/seo.js +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.d.ts +14 -1
- package/dist/components/skeleton.js +56 -4
- package/dist/components/slider.cjs +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slot.cjs +1 -0
- package/dist/components/slot.d.ts +12 -0
- package/dist/components/slot.js +16 -0
- package/dist/components/snackbar-viewport.cjs +1 -0
- package/dist/components/snackbar-viewport.d.ts +27 -0
- package/dist/components/snackbar-viewport.js +181 -0
- package/dist/components/snackbar.cjs +1 -1
- package/dist/components/snackbar.d.ts +5 -1
- package/dist/components/snackbar.js +36 -200
- package/dist/components/spinner.cjs +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/stat.cjs +1 -1
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.cjs +1 -1
- package/dist/components/status-dot.js +1 -1
- package/dist/components/stepper.cjs +1 -1
- package/dist/components/stepper.js +5 -5
- package/dist/components/switch.cjs +1 -1
- package/dist/components/switch.js +37 -43
- package/dist/components/table.cjs +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.cjs +1 -1
- package/dist/components/tabs.d.ts +6 -4
- package/dist/components/tabs.js +51 -81
- package/dist/components/tag.cjs +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/terminal.cjs +1 -1
- package/dist/components/terminal.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +3 -3
- package/dist/components/theme-provider.cjs +1 -1
- package/dist/components/theme-provider.js +1 -1
- package/dist/components/theme-toggle.cjs +1 -1
- package/dist/components/theme-toggle.js +27 -3
- package/dist/components/time-picker.cjs +1 -1
- package/dist/components/time-picker.d.ts +2 -0
- package/dist/components/time-picker.js +206 -148
- package/dist/components/timeline.cjs +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/toggle.cjs +1 -1
- package/dist/components/toggle.js +2 -2
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.d.ts +2 -1
- package/dist/components/tooltip.js +37 -36
- package/dist/components/tree.cjs +1 -1
- package/dist/components/tree.js +1 -1
- package/dist/components/typography.cjs +1 -1
- package/dist/components/typography.d.ts +2 -3
- package/dist/components/typography.js +37 -24
- package/dist/components/visually-hidden.cjs +1 -0
- package/dist/components/visually-hidden.d.ts +16 -0
- package/dist/components/visually-hidden.js +13 -0
- package/dist/{datatable-yBN4M3UV.js → datatable-BJoZMrKI.js} +6 -6
- package/dist/datatable-t0U7t_xh.cjs +1 -0
- package/dist/icons-Dfetr1L2.cjs +1 -0
- package/dist/icons-Dk7VZ4Ph.js +51 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +126 -99
- package/dist/lib/cn.d.ts +13 -1
- package/dist/lib/component-styles.d.ts +14 -2
- package/dist/lib/icons.d.ts +12 -0
- package/dist/lib/motion.d.ts +58 -0
- package/dist/motion-B2shivEB.cjs +1 -0
- package/dist/motion-gnRzFS5f.js +62 -0
- package/dist/select-ByjnuEcE.cjs +1 -0
- package/dist/{select-ClWrcj3R.js → select-CiMzLhUK.js} +128 -122
- package/dist/styles.css +1 -1
- package/dist/{terminal-CpraMs50.cjs → terminal-1U0ftG3i.cjs} +2 -2
- package/dist/{terminal-BOR2cFi1.js → terminal-VXdxVoAv.js} +4 -4
- package/dist/use-focus-trap-CPLT49gN.cjs +1 -0
- package/dist/use-focus-trap-CS6BXJAB.js +77 -0
- package/dist/{utils-CQ8pvCtk.js → utils-DEw5mQrH.js} +1 -1
- package/dist/{utils-DOFJTw8o.cjs → utils-MnnCTelh.cjs} +1 -1
- package/package.json +56 -9
- package/dist/autocomplete-Bk4pRQ2R.cjs +0 -1
- package/dist/calendar-CUXpVrVE.cjs +0 -1
- package/dist/charts-UDqS1BH1.cjs +0 -1
- package/dist/cn-BdjraxxU.cjs +0 -1
- package/dist/component-styles-DOUctc8_.cjs +0 -1
- package/dist/createLucideIcon-DDY8HuQR.js +0 -42
- package/dist/createLucideIcon-b_X_3fj-.cjs +0 -1
- package/dist/datatable-rzDgQ3r6.cjs +0 -1
- package/dist/drawer-CTeBsYrO.cjs +0 -1
- package/dist/drawer-ixuzyLVS.js +0 -189
- package/dist/select-BFwx--uK.cjs +0 -1
- package/dist/theme-toggle-Bb0BYo51.js +0 -71
- package/dist/theme-toggle-Cld8tktJ.cjs +0 -1
package/README.md
CHANGED
|
@@ -72,6 +72,11 @@ The component documentation and live demos are published to
|
|
|
72
72
|
the latest documentation through GitHub Pages; maintainers can also run the
|
|
73
73
|
**Deploy documentation** workflow manually from the Actions tab.
|
|
74
74
|
|
|
75
|
+
## Maintainer
|
|
76
|
+
|
|
77
|
+
`@bzync/rui` is maintained by [Rayan Reynaldo](https://www.bzync.com), Founder of Bzync
|
|
78
|
+
([www.bzync.com](https://www.bzync.com)).
|
|
79
|
+
|
|
75
80
|
## Support
|
|
76
81
|
|
|
77
82
|
If `@bzync/rui` is useful to you, you can support its continued development on
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./cn-B6R3HKzx.cjs"),t=require("./component-styles-DY4wigiq.cjs"),n=require("./utils-MnnCTelh.cjs"),r=require("./use-event-callback-Du9_9eAi.cjs");let i=require("framer-motion"),a=require("react"),o=require("react/jsx-runtime"),s=require("react-dom");var c=({size:e=12})=>(0,o.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,o.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),l=()=>(0,o.jsxs)(`svg`,{className:`animate-spin shrink-0 w-3.5 h-3.5 text-slate-500`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,o.jsx)(`circle`,{className:`opacity-20`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`}),(0,o.jsx)(`path`,{className:`opacity-70`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]});function u({text:e,query:t}){if(!t)return(0,o.jsx)(o.Fragment,{children:e});let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?(0,o.jsx)(o.Fragment,{children:e}):(0,o.jsxs)(o.Fragment,{children:[e.slice(0,n),(0,o.jsx)(`mark`,{className:`bg-accent-500/25 text-accent-700 dark:text-accent-200 rounded-sm not-italic`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function d({inputRef:n,inputId:r,listId:i,open:a,activeIdx:s,inputText:u,prefix:d,placeholder:f,disabled:p,error:m,loading:h,showClear:g,onInputChange:_,onFocus:v,onKeyDown:y,onClear:b,messageId:x,inputProps:S,className:C,inputClassName:w}){return(0,o.jsxs)(`div`,{className:e.t(`flex h-9 items-center gap-2 rounded-[var(--radius-md)] px-3`,t.t,m&&`border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25`,p&&`opacity-50 cursor-not-allowed`,C),children:[d&&(0,o.jsx)(`span`,{className:`text-slate-500 shrink-0 text-sm`,children:d}),(0,o.jsx)(`input`,{...S,ref:n,id:r,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":a,"aria-controls":i,"aria-activedescendant":s>=0?`${i}-opt-${s}`:void 0,"aria-invalid":m?!0:void 0,"aria-describedby":x,autoComplete:`off`,value:u,onChange:_,onFocus:v,onKeyDown:y,placeholder:f,disabled:p,className:e.t(`flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed`,w)}),h&&(0,o.jsx)(l,{}),g&&!h&&(0,o.jsx)(`button`,{type:`button`,onClick:b,className:`shrink-0 text-slate-500 hover:text-slate-600 dark:hover:text-slate-300 cursor-pointer transition-colors`,children:(0,o.jsx)(c,{})})]})}function f({inputRef:n,inputId:r,listId:i,open:a,activeIdx:s,inputText:u,prefix:d,placeholder:f,disabled:p,error:m,loading:h,showClear:g,selected:_,onContainerClick:v,onInputChange:y,onFocus:b,onKeyDown:x,onRemove:S,onClearAll:C,messageId:w,inputProps:T,className:ee,inputClassName:E}){return(0,o.jsxs)(`div`,{onClick:v,className:e.t(`flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-[var(--radius-md)] px-2.5 py-1.5 cursor-text`,t.t,m&&`border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25`,p&&`opacity-50 cursor-not-allowed`,ee),children:[d&&(0,o.jsx)(`span`,{className:`text-slate-500 shrink-0 text-sm`,children:d}),_.map(e=>(0,o.jsxs)(`span`,{className:`inline-flex max-w-[200px] items-center gap-1 rounded-md border border-border bg-surface-muted px-2 py-0.5 text-xs font-medium text-foreground`,children:[e.icon&&(0,o.jsx)(`span`,{className:`shrink-0 text-slate-500 dark:text-slate-400`,children:e.icon}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label}),(0,o.jsx)(`button`,{type:`button`,tabIndex:-1,onMouseDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),S(e)},disabled:p,className:`shrink-0 text-slate-500 dark:text-slate-400 hover:text-foreground transition-colors cursor-pointer ml-0.5`,"aria-label":`Remove ${e.label}`,children:(0,o.jsx)(c,{size:10})})]},String(e.value))),(0,o.jsx)(`input`,{...T,ref:n,id:r,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":a,"aria-controls":i,"aria-activedescendant":s>=0?`${i}-opt-${s}`:void 0,"aria-invalid":m?!0:void 0,"aria-describedby":w,autoComplete:`off`,value:u,onChange:y,onFocus:b,onKeyDown:x,placeholder:_.length===0?f:void 0,disabled:p,className:e.t(`flex-1 min-w-[80px] bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed py-0.5`,E)}),(0,o.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[h&&(0,o.jsx)(l,{}),g&&!h&&(0,o.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:e=>{e.stopPropagation(),C()},className:`text-slate-500 hover:text-slate-600 dark:hover:text-slate-300 transition-colors`,"aria-label":`Clear all`,children:(0,o.jsx)(c,{})}),_.length>0&&(0,o.jsx)(`span`,{className:`text-[10px] font-medium text-slate-500 tabular-nums`,children:_.length})]})]})}function p({listRef:t,listId:n,open:r,pos:a,multiple:c,loading:d,filtered:f,emptyMessage:p,activeIdx:m,setActiveIdx:h,inputText:g,selectedValues:_,singleValue:v,onSelectSingle:y,onToggleMulti:b,className:x,optionClassName:S,loadingClassName:C,emptyClassName:w}){return typeof document>`u`?null:(0,s.createPortal)((0,o.jsx)(i.AnimatePresence,{children:r&&a&&(0,o.jsx)(i.motion.ul,{ref:t,id:n,role:`listbox`,"aria-multiselectable":c,initial:{opacity:0,y:a.placement===`bottom`?-4:4},animate:{opacity:1,y:0},exit:{opacity:0,y:a.placement===`bottom`?-4:4},transition:{duration:.13},style:{position:`fixed`,top:a.top,left:a.left,width:a.width,maxHeight:a.maxHeight},className:e.t(`z-[110] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-surface-raised py-1 shadow-floating`,x),children:d?(0,o.jsxs)(`li`,{className:e.t(`px-4 py-3 text-sm text-slate-600 flex items-center gap-2`,C),children:[(0,o.jsx)(l,{}),`Loading…`]}):f.length===0?(0,o.jsx)(`li`,{className:e.t(`px-4 py-3 text-sm text-slate-600`,w),children:p}):f.map((t,r)=>{let i=r===m,a=c?_.includes(t.value):t.value===v;return(0,o.jsxs)(`li`,{id:`${n}-opt-${r}`,role:`option`,"aria-selected":a,onMouseDown:e=>e.preventDefault(),onClick:()=>c?b(t):y(t),onMouseEnter:()=>h(r),className:e.t(`flex min-h-9 items-center gap-3 px-3 py-2 cursor-pointer transition-colors`,i&&`bg-surface-muted`,a&&!i&&`bg-accent-50 dark:bg-accent-500/10`,S),children:[t.icon&&(0,o.jsx)(`span`,{className:`shrink-0 text-slate-500 dark:text-slate-400`,children:t.icon}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`p`,{className:e.t(`text-sm`,a?`text-accent-700 dark:text-accent-300 font-medium`:`text-foreground`),children:(0,o.jsx)(u,{text:t.label,query:g})}),t.description&&(0,o.jsx)(`p`,{className:`text-xs text-slate-500 mt-0.5 truncate`,children:t.description})]}),a&&(0,o.jsx)(`svg`,{"aria-hidden":`true`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-accent-600 shrink-0`,children:(0,o.jsx)(`path`,{d:`m20 6-11 11-5-5`})})]},String(t.value))})})}),document.body)}function m(i,s){let{options:c,inputValue:l,onInputChange:u,label:m,hint:h,error:g,prefix:_,clearable:v=!0,loading:y=!1,emptyMessage:b=`No results`,maxVisible:x=8,className:S,wrapperClassName:C,triggerClassName:w,inputClassName:T,labelClassName:ee,messageClassName:E,listClassName:te,optionClassName:ne,loadingClassName:re,emptyClassName:ie,placeholder:D,disabled:O,id:ae,multiple:k,unstyled:oe=!1,...se}=i,{value:ce,onSelect:le,onDeselect:ue,...A}=se,de=(0,a.useId)(),j=ae??de,M=`${j}-list`,N=`${j}-message`,[fe,pe]=(0,a.useState)(``),P=l===void 0?fe:l,me=r.t(e=>u?.(e)),F=(0,a.useCallback)(e=>{l===void 0?pe(e):me(e)},[l,me]),[he,I]=(0,a.useState)([]),L=(0,a.useMemo)(()=>{if(!k)return[];let e=i;return e.value===void 0?he:c.filter(t=>e.value.includes(t.value))},[k,c,i,he]),R=(0,a.useMemo)(()=>L.map(e=>e.value),[L]),[z,B]=(0,a.useState)(!1),[V,H]=(0,a.useState)(-1),U=(0,a.useRef)(null),W=(0,a.useRef)(null),G=(0,a.useRef)(null),[K,q]=(0,a.useState)(``),J=(0,a.useMemo)(()=>{let e=K.trim().toLowerCase();return c.filter(t=>!t.disabled&&t.label.toLowerCase().includes(e)).slice(0,x)},[c,K,x]),Y=(0,a.useCallback)(e=>{i.onSelect?.(e),F(e.label),B(!1),H(-1)},[i,F]),ge=(0,a.useCallback)(e=>{let t=i,n=[...L,e];t.value===void 0&&I(n),t.onSelect?.(e,n),F(``),H(-1),W.current?.focus()},[L,i,F]),X=(0,a.useCallback)(e=>{let t=i,n=L.filter(t=>t.value!==e.value);t.value===void 0&&I(n),t.onDeselect?.(e,n)},[L,i]),Z=(0,a.useCallback)(e=>{R.includes(e.value)?X(e):ge(e)},[R,X,ge]),_e=(0,a.useCallback)(()=>{F(``),i.onSelect?.({value:``,label:``}),B(!1)},[i,F]),ve=(0,a.useCallback)(()=>{i.value===void 0&&I([]),F(``)},[i,F]),ye=(0,a.useCallback)(e=>{if(k&&e.key===`Backspace`&&P===``&&L.length>0){X(L[L.length-1]);return}if(!z){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(B(!0),q(``));return}if(e.key===`ArrowDown`)e.preventDefault(),H(e=>Math.min(e+1,J.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),H(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=J[V];if(!t)return;k?Z(t):Y(t)}else e.key===`Escape`&&(B(!1),H(-1))},[k,P,L,z,J,V,Z,Y,X]);(0,a.useEffect)(()=>{V<0||!G.current||G.current.children[V]?.scrollIntoView({block:`nearest`})},[V]),(0,a.useEffect)(()=>{function e(e){let t=e.target;!U.current?.contains(t)&&!G.current?.contains(t)&&B(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let be=k?void 0:i.value,xe=!!(!k&&v&&P.length>0&&!O),Se=!!(k&&v&&(L.length>0||P.length>0)&&!O),Ce=n.o(z,U),Q=(0,a.useCallback)(e=>{F(e.target.value),q(e.target.value),B(!0),H(-1)},[F]),$=(0,a.useCallback)(()=>{B(!0),q(``)},[]);return oe?(0,o.jsxs)(`div`,{ref:U,className:e.t(S,C),children:[(0,o.jsx)(`input`,{ref:s,id:j,value:P,onChange:Q,placeholder:D,disabled:O}),z&&(0,o.jsx)(`ul`,{ref:G,id:M,className:te,children:J.map(e=>(0,o.jsx)(`li`,{onClick:()=>k?Z(e):Y(e),children:e.label},String(e.value)))})]}):(0,o.jsxs)(`div`,{ref:U,className:e.t(`relative`,t.o,C,S),children:[m&&(0,o.jsxs)(`label`,{htmlFor:j,className:e.t(`text-xs font-semibold leading-5 text-foreground`,ee),children:[m,se.required&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 text-destructive`,children:`*`}),(0,o.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})]}),!k&&(0,o.jsx)(d,{inputRef:s,inputId:j,listId:M,open:z,activeIdx:V,inputText:P,prefix:_,placeholder:D,disabled:O,error:g,loading:y,showClear:xe,onInputChange:Q,onFocus:$,onKeyDown:ye,onClear:_e,messageId:g||h?N:void 0,inputProps:A,className:w,inputClassName:T}),k&&(0,o.jsx)(f,{inputRef:e=>{W.current=e,typeof s==`function`?s(e):s&&(s.current=e)},inputId:j,listId:M,open:z,activeIdx:V,inputText:P,prefix:_,placeholder:D,disabled:O,error:g,loading:y,showClear:Se,selected:L,onContainerClick:()=>{O||(W.current?.focus(),B(!0),q(``))},onInputChange:Q,onFocus:$,onKeyDown:ye,onRemove:X,onClearAll:ve,messageId:g||h?N:void 0,inputProps:A,className:w,inputClassName:T}),(0,o.jsx)(p,{listRef:G,listId:M,open:z,pos:Ce,multiple:k,loading:y,filtered:J,emptyMessage:b,activeIdx:V,setActiveIdx:H,inputText:K,selectedValues:R,singleValue:be,onSelectSingle:Y,onToggleMulti:Z,className:te,optionClassName:ne,loadingClassName:re,emptyClassName:ie}),g&&(0,o.jsx)(`p`,{id:N,"aria-live":`polite`,className:e.t(`text-xs leading-5 text-destructive`,E),children:g}),h&&!g&&(0,o.jsx)(`p`,{id:N,className:e.t(`text-xs leading-5 text-muted-foreground`,E),children:h})]})}var h=(0,a.forwardRef)(m);Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./cn-
|
|
2
|
-
import { o as t, t as n } from "./component-styles-
|
|
3
|
-
import { o as r } from "./utils-
|
|
1
|
+
import { t as e } from "./cn-BJyZJP-y.js";
|
|
2
|
+
import { o as t, t as n } from "./component-styles-C2CbHEEA.js";
|
|
3
|
+
import { o as r } from "./utils-DEw5mQrH.js";
|
|
4
4
|
import { t as i } from "./use-event-callback-DGkfO_uu.js";
|
|
5
5
|
import { AnimatePresence as a, motion as o } from "framer-motion";
|
|
6
6
|
import { forwardRef as s, useCallback as c, useEffect as l, useId as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
@@ -40,7 +40,7 @@ function b({ text: e, query: t }) {
|
|
|
40
40
|
return n === -1 ? /* @__PURE__ */ h(m, { children: e }) : /* @__PURE__ */ g(m, { children: [
|
|
41
41
|
e.slice(0, n),
|
|
42
42
|
/* @__PURE__ */ h("mark", {
|
|
43
|
-
className: "bg-
|
|
43
|
+
className: "bg-accent-500/25 text-accent-700 dark:text-accent-200 rounded-sm not-italic",
|
|
44
44
|
children: e.slice(n, n + t.length)
|
|
45
45
|
}),
|
|
46
46
|
e.slice(n + t.length)
|
|
@@ -48,9 +48,9 @@ function b({ text: e, query: t }) {
|
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/components/autocomplete/single-trigger.tsx
|
|
51
|
-
function x({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputText: s, prefix: c, placeholder: l, disabled: u, error: d, loading: f, showClear: p, onInputChange: m, onFocus: _, onKeyDown: b, onClear: x, messageId: S, inputProps: C }) {
|
|
51
|
+
function x({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputText: s, prefix: c, placeholder: l, disabled: u, error: d, loading: f, showClear: p, onInputChange: m, onFocus: _, onKeyDown: b, onClear: x, messageId: S, inputProps: C, className: w, inputClassName: T }) {
|
|
52
52
|
return /* @__PURE__ */ g("div", {
|
|
53
|
-
className: e("flex h-9 items-center gap-2 rounded-[var(--radius-md)] px-3", n, d && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/
|
|
53
|
+
className: e("flex h-9 items-center gap-2 rounded-[var(--radius-md)] px-3", n, d && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25", u && "opacity-50 cursor-not-allowed", w),
|
|
54
54
|
children: [
|
|
55
55
|
c && /* @__PURE__ */ h("span", {
|
|
56
56
|
className: "text-slate-500 shrink-0 text-sm",
|
|
@@ -74,7 +74,7 @@ function x({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputTex
|
|
|
74
74
|
onKeyDown: b,
|
|
75
75
|
placeholder: l,
|
|
76
76
|
disabled: u,
|
|
77
|
-
className: "flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed"
|
|
77
|
+
className: e("flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed", T)
|
|
78
78
|
}),
|
|
79
79
|
f && /* @__PURE__ */ h(y, {}),
|
|
80
80
|
p && !f && /* @__PURE__ */ h("button", {
|
|
@@ -88,10 +88,10 @@ function x({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputTex
|
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/components/autocomplete/multi-trigger.tsx
|
|
91
|
-
function S({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputText: s, prefix: c, placeholder: l, disabled: u, error: d, loading: f, showClear: p, selected: m, onContainerClick: _, onInputChange: b, onFocus: x, onKeyDown: S, onRemove: C, onClearAll: w, messageId: T, inputProps: E }) {
|
|
91
|
+
function S({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputText: s, prefix: c, placeholder: l, disabled: u, error: d, loading: f, showClear: p, selected: m, onContainerClick: _, onInputChange: b, onFocus: x, onKeyDown: S, onRemove: C, onClearAll: w, messageId: T, inputProps: E, className: ee, inputClassName: D }) {
|
|
92
92
|
return /* @__PURE__ */ g("div", {
|
|
93
93
|
onClick: _,
|
|
94
|
-
className: e("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-[var(--radius-md)] px-2.5 py-1.5 cursor-text", n, d && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/
|
|
94
|
+
className: e("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-[var(--radius-md)] px-2.5 py-1.5 cursor-text", n, d && "border-destructive/60 hover:border-destructive/70 focus-within:border-destructive focus-within:ring-destructive/25", u && "opacity-50 cursor-not-allowed", ee),
|
|
95
95
|
children: [
|
|
96
96
|
c && /* @__PURE__ */ h("span", {
|
|
97
97
|
className: "text-slate-500 shrink-0 text-sm",
|
|
@@ -116,7 +116,7 @@ function S({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputTex
|
|
|
116
116
|
t.stopPropagation(), C(e);
|
|
117
117
|
},
|
|
118
118
|
disabled: u,
|
|
119
|
-
className: "shrink-0 text-slate-500 dark:text-slate-400 hover:text-
|
|
119
|
+
className: "shrink-0 text-slate-500 dark:text-slate-400 hover:text-foreground transition-colors cursor-pointer ml-0.5",
|
|
120
120
|
"aria-label": `Remove ${e.label}`,
|
|
121
121
|
children: /* @__PURE__ */ h(v, { size: 10 })
|
|
122
122
|
})
|
|
@@ -140,7 +140,7 @@ function S({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputTex
|
|
|
140
140
|
onKeyDown: S,
|
|
141
141
|
placeholder: m.length === 0 ? l : void 0,
|
|
142
142
|
disabled: u,
|
|
143
|
-
className: "flex-1 min-w-[80px] bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed py-0.5"
|
|
143
|
+
className: e("flex-1 min-w-[80px] bg-transparent text-sm text-foreground placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed py-0.5", D)
|
|
144
144
|
}),
|
|
145
145
|
/* @__PURE__ */ g("span", {
|
|
146
146
|
className: "ml-auto flex items-center gap-1.5 shrink-0",
|
|
@@ -167,7 +167,7 @@ function S({ inputRef: t, inputId: r, listId: i, open: a, activeIdx: o, inputTex
|
|
|
167
167
|
}
|
|
168
168
|
//#endregion
|
|
169
169
|
//#region src/components/autocomplete/dropdown.tsx
|
|
170
|
-
function C({ listRef: t, listId: n, open: r, pos: i, multiple: s, loading: c, filtered: l, emptyMessage: u, activeIdx: d, setActiveIdx: f, inputText: p, selectedValues: m, singleValue: v, onSelectSingle: x, onToggleMulti: S, className: C }) {
|
|
170
|
+
function C({ listRef: t, listId: n, open: r, pos: i, multiple: s, loading: c, filtered: l, emptyMessage: u, activeIdx: d, setActiveIdx: f, inputText: p, selectedValues: m, singleValue: v, onSelectSingle: x, onToggleMulti: S, className: C, optionClassName: w, loadingClassName: T, emptyClassName: E }) {
|
|
171
171
|
return typeof document > "u" ? null : _(/* @__PURE__ */ h(a, { children: r && i && /* @__PURE__ */ h(o.ul, {
|
|
172
172
|
ref: t,
|
|
173
173
|
id: n,
|
|
@@ -195,10 +195,10 @@ function C({ listRef: t, listId: n, open: r, pos: i, multiple: s, loading: c, fi
|
|
|
195
195
|
},
|
|
196
196
|
className: e("z-[110] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-surface-raised py-1 shadow-floating", C),
|
|
197
197
|
children: c ? /* @__PURE__ */ g("li", {
|
|
198
|
-
className: "px-4 py-3 text-sm text-slate-600 flex items-center gap-2",
|
|
198
|
+
className: e("px-4 py-3 text-sm text-slate-600 flex items-center gap-2", T),
|
|
199
199
|
children: [/* @__PURE__ */ h(y, {}), "Loading…"]
|
|
200
200
|
}) : l.length === 0 ? /* @__PURE__ */ h("li", {
|
|
201
|
-
className: "px-4 py-3 text-sm text-slate-600",
|
|
201
|
+
className: e("px-4 py-3 text-sm text-slate-600", E),
|
|
202
202
|
children: u
|
|
203
203
|
}) : l.map((t, r) => {
|
|
204
204
|
let i = r === d, a = s ? m.includes(t.value) : t.value === v;
|
|
@@ -209,7 +209,7 @@ function C({ listRef: t, listId: n, open: r, pos: i, multiple: s, loading: c, fi
|
|
|
209
209
|
onMouseDown: (e) => e.preventDefault(),
|
|
210
210
|
onClick: () => s ? S(t) : x(t),
|
|
211
211
|
onMouseEnter: () => f(r),
|
|
212
|
-
className: e("flex min-h-9 items-center gap-3 px-3 py-2 cursor-pointer transition-colors", i && "bg-surface-muted", a && !i && "bg-accent-50 dark:bg-accent-500/10"),
|
|
212
|
+
className: e("flex min-h-9 items-center gap-3 px-3 py-2 cursor-pointer transition-colors", i && "bg-surface-muted", a && !i && "bg-accent-50 dark:bg-accent-500/10", w),
|
|
213
213
|
children: [
|
|
214
214
|
t.icon && /* @__PURE__ */ h("span", {
|
|
215
215
|
className: "shrink-0 text-slate-500 dark:text-slate-400",
|
|
@@ -249,118 +249,118 @@ function C({ listRef: t, listId: n, open: r, pos: i, multiple: s, loading: c, fi
|
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region src/components/autocomplete.tsx
|
|
251
251
|
function w(n, a) {
|
|
252
|
-
let { options: o, inputValue: s, onInputChange: _, label: v, hint: y, error: b, prefix: w, clearable: T = !0, loading: E = !1, emptyMessage: ee = "No results", maxVisible:
|
|
253
|
-
s === void 0 ?
|
|
254
|
-
}, [s,
|
|
255
|
-
if (!
|
|
252
|
+
let { options: o, inputValue: s, onInputChange: _, label: v, hint: y, error: b, prefix: w, clearable: T = !0, loading: E = !1, emptyMessage: ee = "No results", maxVisible: D = 8, className: te, wrapperClassName: ne, triggerClassName: re, inputClassName: ie, labelClassName: ae, messageClassName: oe, listClassName: se, optionClassName: ce, loadingClassName: le, emptyClassName: ue, placeholder: O, disabled: k, id: de, multiple: A, unstyled: fe = !1, ...pe } = n, { value: me, onSelect: he, onDeselect: ge, ..._e } = pe, ve = u(), j = de ?? ve, M = `${j}-list`, N = `${j}-message`, [ye, be] = p(""), P = s === void 0 ? ye : s, xe = i((e) => _?.(e)), F = c((e) => {
|
|
253
|
+
s === void 0 ? be(e) : xe(e);
|
|
254
|
+
}, [s, xe]), [Se, I] = p([]), L = d(() => {
|
|
255
|
+
if (!A) return [];
|
|
256
256
|
let e = n;
|
|
257
|
-
return e.value === void 0 ?
|
|
257
|
+
return e.value === void 0 ? Se : o.filter((t) => e.value.includes(t.value));
|
|
258
258
|
}, [
|
|
259
|
-
|
|
259
|
+
A,
|
|
260
260
|
o,
|
|
261
261
|
n,
|
|
262
|
-
|
|
263
|
-
]),
|
|
264
|
-
let e =
|
|
265
|
-
return o.filter((t) => !t.disabled && t.label.toLowerCase().includes(e)).slice(0,
|
|
262
|
+
Se
|
|
263
|
+
]), R = d(() => L.map((e) => e.value), [L]), [z, B] = p(!1), [V, H] = p(-1), U = f(null), W = f(null), G = f(null), [K, q] = p(""), J = d(() => {
|
|
264
|
+
let e = K.trim().toLowerCase();
|
|
265
|
+
return o.filter((t) => !t.disabled && t.label.toLowerCase().includes(e)).slice(0, D);
|
|
266
266
|
}, [
|
|
267
267
|
o,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
]),
|
|
271
|
-
n.onSelect?.(e),
|
|
272
|
-
}, [n,
|
|
273
|
-
let t = n, r = [...
|
|
274
|
-
t.value === void 0 &&
|
|
268
|
+
K,
|
|
269
|
+
D
|
|
270
|
+
]), Y = c((e) => {
|
|
271
|
+
n.onSelect?.(e), F(e.label), B(!1), H(-1);
|
|
272
|
+
}, [n, F]), Ce = c((e) => {
|
|
273
|
+
let t = n, r = [...L, e];
|
|
274
|
+
t.value === void 0 && I(r), t.onSelect?.(e, r), F(""), H(-1), W.current?.focus();
|
|
275
275
|
}, [
|
|
276
|
-
|
|
276
|
+
L,
|
|
277
277
|
n,
|
|
278
|
-
|
|
279
|
-
]),
|
|
280
|
-
let t = n, r =
|
|
281
|
-
t.value === void 0 &&
|
|
282
|
-
}, [
|
|
283
|
-
|
|
278
|
+
F
|
|
279
|
+
]), X = c((e) => {
|
|
280
|
+
let t = n, r = L.filter((t) => t.value !== e.value);
|
|
281
|
+
t.value === void 0 && I(r), t.onDeselect?.(e, r);
|
|
282
|
+
}, [L, n]), Z = c((e) => {
|
|
283
|
+
R.includes(e.value) ? X(e) : Ce(e);
|
|
284
284
|
}, [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
]),
|
|
289
|
-
|
|
285
|
+
R,
|
|
286
|
+
X,
|
|
287
|
+
Ce
|
|
288
|
+
]), we = c(() => {
|
|
289
|
+
F(""), n.onSelect?.({
|
|
290
290
|
value: "",
|
|
291
291
|
label: ""
|
|
292
|
-
}),
|
|
293
|
-
}, [n,
|
|
294
|
-
n.value === void 0 &&
|
|
295
|
-
}, [n,
|
|
296
|
-
if (
|
|
297
|
-
|
|
292
|
+
}), B(!1);
|
|
293
|
+
}, [n, F]), Te = c(() => {
|
|
294
|
+
n.value === void 0 && I([]), F("");
|
|
295
|
+
}, [n, F]), Ee = c((e) => {
|
|
296
|
+
if (A && e.key === "Backspace" && P === "" && L.length > 0) {
|
|
297
|
+
X(L[L.length - 1]);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
if (!
|
|
301
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (
|
|
300
|
+
if (!z) {
|
|
301
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (B(!0), q(""));
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
if (e.key === "ArrowDown") e.preventDefault(),
|
|
305
|
-
else if (e.key === "ArrowUp") e.preventDefault(),
|
|
304
|
+
if (e.key === "ArrowDown") e.preventDefault(), H((e) => Math.min(e + 1, J.length - 1));
|
|
305
|
+
else if (e.key === "ArrowUp") e.preventDefault(), H((e) => Math.max(e - 1, 0));
|
|
306
306
|
else if (e.key === "Enter") {
|
|
307
307
|
e.preventDefault();
|
|
308
|
-
let t =
|
|
308
|
+
let t = J[V];
|
|
309
309
|
if (!t) return;
|
|
310
|
-
|
|
311
|
-
} else e.key === "Escape" && (
|
|
310
|
+
A ? Z(t) : Y(t);
|
|
311
|
+
} else e.key === "Escape" && (B(!1), H(-1));
|
|
312
312
|
}, [
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
A,
|
|
314
|
+
P,
|
|
315
|
+
L,
|
|
316
|
+
z,
|
|
317
|
+
J,
|
|
318
|
+
V,
|
|
319
|
+
Z,
|
|
317
320
|
Y,
|
|
318
|
-
|
|
319
|
-
Q,
|
|
320
|
-
X,
|
|
321
|
-
Z
|
|
321
|
+
X
|
|
322
322
|
]);
|
|
323
323
|
l(() => {
|
|
324
|
-
|
|
325
|
-
}, [
|
|
324
|
+
V < 0 || !G.current || G.current.children[V]?.scrollIntoView({ block: "nearest" });
|
|
325
|
+
}, [V]), l(() => {
|
|
326
326
|
function e(e) {
|
|
327
327
|
let t = e.target;
|
|
328
|
-
!
|
|
328
|
+
!U.current?.contains(t) && !G.current?.contains(t) && B(!1);
|
|
329
329
|
}
|
|
330
330
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
331
331
|
}, []);
|
|
332
|
-
let
|
|
333
|
-
|
|
334
|
-
}, [
|
|
335
|
-
|
|
332
|
+
let De = A ? void 0 : n.value, Oe = !!(!A && T && P.length > 0 && !k), ke = !!(A && T && (L.length > 0 || P.length > 0) && !k), Ae = r(z, U), Q = c((e) => {
|
|
333
|
+
F(e.target.value), q(e.target.value), B(!0), H(-1);
|
|
334
|
+
}, [F]), $ = c(() => {
|
|
335
|
+
B(!0), q("");
|
|
336
336
|
}, []);
|
|
337
|
-
return
|
|
338
|
-
ref:
|
|
339
|
-
className: e(
|
|
337
|
+
return fe ? /* @__PURE__ */ g("div", {
|
|
338
|
+
ref: U,
|
|
339
|
+
className: e(te, ne),
|
|
340
340
|
children: [/* @__PURE__ */ h("input", {
|
|
341
341
|
ref: a,
|
|
342
|
+
id: j,
|
|
343
|
+
value: P,
|
|
344
|
+
onChange: Q,
|
|
345
|
+
placeholder: O,
|
|
346
|
+
disabled: k
|
|
347
|
+
}), z && /* @__PURE__ */ h("ul", {
|
|
348
|
+
ref: G,
|
|
342
349
|
id: M,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
disabled: O
|
|
347
|
-
}), B && /* @__PURE__ */ h("ul", {
|
|
348
|
-
ref: K,
|
|
349
|
-
id: N,
|
|
350
|
-
className: ie,
|
|
351
|
-
children: Y.map((e) => /* @__PURE__ */ h("li", {
|
|
352
|
-
onClick: () => k ? Q(e) : X(e),
|
|
350
|
+
className: se,
|
|
351
|
+
children: J.map((e) => /* @__PURE__ */ h("li", {
|
|
352
|
+
onClick: () => A ? Z(e) : Y(e),
|
|
353
353
|
children: e.label
|
|
354
354
|
}, String(e.value)))
|
|
355
355
|
})]
|
|
356
356
|
}) : /* @__PURE__ */ g("div", {
|
|
357
|
-
ref:
|
|
358
|
-
className: e("relative", t,
|
|
357
|
+
ref: U,
|
|
358
|
+
className: e("relative", t, ne, te),
|
|
359
359
|
children: [
|
|
360
360
|
v && /* @__PURE__ */ g("label", {
|
|
361
|
-
htmlFor:
|
|
362
|
-
className: "text-xs font-semibold leading-5 text-foreground",
|
|
363
|
-
children: [v,
|
|
361
|
+
htmlFor: j,
|
|
362
|
+
className: e("text-xs font-semibold leading-5 text-foreground", ae),
|
|
363
|
+
children: [v, pe.required && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
364
364
|
"aria-hidden": "true",
|
|
365
365
|
className: "ml-1 text-destructive",
|
|
366
366
|
children: "*"
|
|
@@ -369,80 +369,87 @@ function w(n, a) {
|
|
|
369
369
|
children: " (required)"
|
|
370
370
|
})] })]
|
|
371
371
|
}),
|
|
372
|
-
!
|
|
372
|
+
!A && /* @__PURE__ */ h(x, {
|
|
373
373
|
inputRef: a,
|
|
374
|
-
inputId:
|
|
375
|
-
listId:
|
|
376
|
-
open:
|
|
377
|
-
activeIdx:
|
|
378
|
-
inputText:
|
|
374
|
+
inputId: j,
|
|
375
|
+
listId: M,
|
|
376
|
+
open: z,
|
|
377
|
+
activeIdx: V,
|
|
378
|
+
inputText: P,
|
|
379
379
|
prefix: w,
|
|
380
|
-
placeholder:
|
|
381
|
-
disabled:
|
|
380
|
+
placeholder: O,
|
|
381
|
+
disabled: k,
|
|
382
382
|
error: b,
|
|
383
383
|
loading: E,
|
|
384
|
-
showClear:
|
|
385
|
-
onInputChange:
|
|
386
|
-
onFocus:
|
|
387
|
-
onKeyDown:
|
|
388
|
-
onClear:
|
|
389
|
-
messageId: b || y ?
|
|
390
|
-
inputProps:
|
|
384
|
+
showClear: Oe,
|
|
385
|
+
onInputChange: Q,
|
|
386
|
+
onFocus: $,
|
|
387
|
+
onKeyDown: Ee,
|
|
388
|
+
onClear: we,
|
|
389
|
+
messageId: b || y ? N : void 0,
|
|
390
|
+
inputProps: _e,
|
|
391
|
+
className: re,
|
|
392
|
+
inputClassName: ie
|
|
391
393
|
}),
|
|
392
|
-
|
|
394
|
+
A && /* @__PURE__ */ h(S, {
|
|
393
395
|
inputRef: (e) => {
|
|
394
|
-
|
|
396
|
+
W.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
|
|
395
397
|
},
|
|
396
|
-
inputId:
|
|
397
|
-
listId:
|
|
398
|
-
open:
|
|
399
|
-
activeIdx:
|
|
400
|
-
inputText:
|
|
398
|
+
inputId: j,
|
|
399
|
+
listId: M,
|
|
400
|
+
open: z,
|
|
401
|
+
activeIdx: V,
|
|
402
|
+
inputText: P,
|
|
401
403
|
prefix: w,
|
|
402
|
-
placeholder:
|
|
403
|
-
disabled:
|
|
404
|
+
placeholder: O,
|
|
405
|
+
disabled: k,
|
|
404
406
|
error: b,
|
|
405
407
|
loading: E,
|
|
406
|
-
showClear:
|
|
407
|
-
selected:
|
|
408
|
+
showClear: ke,
|
|
409
|
+
selected: L,
|
|
408
410
|
onContainerClick: () => {
|
|
409
|
-
|
|
411
|
+
k || (W.current?.focus(), B(!0), q(""));
|
|
410
412
|
},
|
|
411
|
-
onInputChange:
|
|
412
|
-
onFocus:
|
|
413
|
-
onKeyDown:
|
|
414
|
-
onRemove:
|
|
415
|
-
onClearAll:
|
|
416
|
-
messageId: b || y ?
|
|
417
|
-
inputProps:
|
|
413
|
+
onInputChange: Q,
|
|
414
|
+
onFocus: $,
|
|
415
|
+
onKeyDown: Ee,
|
|
416
|
+
onRemove: X,
|
|
417
|
+
onClearAll: Te,
|
|
418
|
+
messageId: b || y ? N : void 0,
|
|
419
|
+
inputProps: _e,
|
|
420
|
+
className: re,
|
|
421
|
+
inputClassName: ie
|
|
418
422
|
}),
|
|
419
423
|
/* @__PURE__ */ h(C, {
|
|
420
|
-
listRef:
|
|
421
|
-
listId:
|
|
422
|
-
open:
|
|
423
|
-
pos:
|
|
424
|
-
multiple:
|
|
424
|
+
listRef: G,
|
|
425
|
+
listId: M,
|
|
426
|
+
open: z,
|
|
427
|
+
pos: Ae,
|
|
428
|
+
multiple: A,
|
|
425
429
|
loading: E,
|
|
426
|
-
filtered:
|
|
430
|
+
filtered: J,
|
|
427
431
|
emptyMessage: ee,
|
|
428
|
-
activeIdx:
|
|
429
|
-
setActiveIdx:
|
|
430
|
-
inputText:
|
|
431
|
-
selectedValues:
|
|
432
|
-
singleValue:
|
|
433
|
-
onSelectSingle:
|
|
434
|
-
onToggleMulti:
|
|
435
|
-
className:
|
|
432
|
+
activeIdx: V,
|
|
433
|
+
setActiveIdx: H,
|
|
434
|
+
inputText: K,
|
|
435
|
+
selectedValues: R,
|
|
436
|
+
singleValue: De,
|
|
437
|
+
onSelectSingle: Y,
|
|
438
|
+
onToggleMulti: Z,
|
|
439
|
+
className: se,
|
|
440
|
+
optionClassName: ce,
|
|
441
|
+
loadingClassName: le,
|
|
442
|
+
emptyClassName: ue
|
|
436
443
|
}),
|
|
437
444
|
b && /* @__PURE__ */ h("p", {
|
|
438
|
-
id:
|
|
445
|
+
id: N,
|
|
439
446
|
"aria-live": "polite",
|
|
440
|
-
className: "text-xs leading-5 text-destructive",
|
|
447
|
+
className: e("text-xs leading-5 text-destructive", oe),
|
|
441
448
|
children: b
|
|
442
449
|
}),
|
|
443
450
|
y && !b && /* @__PURE__ */ h("p", {
|
|
444
|
-
id:
|
|
445
|
-
className: "text-xs leading-5 text-muted-foreground",
|
|
451
|
+
id: N,
|
|
452
|
+
className: e("text-xs leading-5 text-muted-foreground", oe),
|
|
446
453
|
children: y
|
|
447
454
|
})
|
|
448
455
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./cn-B6R3HKzx.cjs"),t=require("./component-styles-DY4wigiq.cjs");let n=require("framer-motion"),r=require("react"),i=require("react/jsx-runtime");var a=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c={blue:`bg-blue-500/12 text-blue-400 border-blue-500/20`,green:`bg-emerald-500/12 text-emerald-400 border-emerald-500/20`,red:`bg-red-500/12 text-red-400 border-red-500/20`,yellow:`bg-amber-500/12 text-amber-400 border-amber-500/20`,purple:`bg-violet-500/12 text-violet-400 border-violet-500/20`,orange:`bg-orange-500/12 text-orange-400 border-orange-500/20`};function l(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function u(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function d(e){let t=new Date(e);return t.setDate(t.getDate()-t.getDay()),t}var f={enter:e=>({opacity:0,x:e*16}),center:{opacity:1,x:0},exit:e=>({opacity:0,x:e*-16})};function p({viewDate:t,today:n,value:r,events:o,onSelect:s,onEventClick:u,isDateDisabled:d,onEventCreate:f,onEventDelete:p,editingId:m,onEditToggle:h,onUpdateTitle:g}){let _=t.getFullYear(),v=t.getMonth(),y=new Date(_,v+1,0).getDate(),b=new Date(_,v,1).getDay(),x=[...Array(b).fill(null),...Array.from({length:y},(e,t)=>new Date(_,v,t+1))];for(;x.length%7!=0;)x.push(null);function S(e){return o.filter(t=>l(t.date,e))}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{role:`row`,className:`grid grid-cols-7 border-b border-border`,children:a.map(e=>(0,i.jsx)(`div`,{role:`columnheader`,className:`py-2.5 text-center text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e},e))}),(0,i.jsx)(`div`,{role:`grid`,className:`grid grid-cols-7`,style:{gridTemplateRows:`repeat(${x.length/7}, minmax(80px, 1fr))`},children:x.map((t,a)=>{let o=a%7==6,h=a>=x.length-7;if(!t)return(0,i.jsx)(`div`,{role:`gridcell`,className:e.t(`border-black/6 dark:border-white/6 bg-black/[0.015] dark:bg-white/[0.015]`,!o&&`border-r`,!h&&`border-b`)},`e${a}`);let g=S(t),_=n?l(t,n):!1,y=r?l(t,r):!1,b=t.getMonth()===v,C=d?.(t)??!1;return(0,i.jsxs)(`div`,{role:`gridcell`,tabIndex:C?void 0:0,"aria-label":t.toLocaleDateString(void 0,{dateStyle:`full`}),"aria-disabled":C||void 0,"aria-selected":y,onClick:()=>!C&&s(t),onKeyDown:e=>{!C&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s(t))},className:e.t(`p-1.5 transition-colors group/cell`,`border-border focus-visible:z-10 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-focus-ring/35`,!o&&`border-r`,!h&&`border-b`,!b&&`bg-black/[0.015] dark:bg-white/[0.015]`,C?`cursor-not-allowed opacity-40`:`cursor-pointer hover:bg-surface-muted`),children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,i.jsx)(`span`,{className:e.t(`w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium`,y?`bg-primary text-primary-foreground`:_?`border border-accent-500/50 text-accent-600 dark:text-accent-300`:b?`text-slate-700 dark:text-slate-200`:`text-slate-400 dark:text-slate-600`),children:t.getDate()}),f&&!C&&(0,i.jsx)(`button`,{type:`button`,"aria-label":`Add event on ${t.toLocaleDateString()}`,onClick:e=>{e.stopPropagation(),f(t)},className:`opacity-0 group-hover/cell:opacity-100 focus:opacity-100 w-5 h-5 rounded-md bg-primary text-primary-foreground flex items-center justify-center text-[10px] hover:bg-primary-hover transition-opacity`,children:`+`})]}),(0,i.jsxs)(`div`,{className:`space-y-0.5`,children:[g.slice(0,2).map(t=>{let n=m===t.id;return(0,i.jsxs)(`div`,{className:e.t(`group/ev flex items-center gap-0.5 rounded border px-1 py-0.5`,c[t.color??`blue`],n&&`ring-1 ring-focus-ring`),children:[(0,i.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),u?.(t)},className:`min-w-0 flex-1 truncate text-left text-[10px] font-medium`,children:[t.time&&(0,i.jsx)(`span`,{className:`opacity-60 mr-1`,children:t.time}),t.title]}),p&&(0,i.jsx)(`button`,{type:`button`,"aria-label":`Delete ${t.title}`,onClick:e=>{e.stopPropagation(),p(t.id)},className:`flex size-4 shrink-0 items-center justify-center rounded text-[10px] leading-none opacity-60 hover:bg-muted hover:opacity-100`,children:`×`})]},t.id)}),g.length>2&&(0,i.jsxs)(`p`,{className:`text-[10px] text-slate-500 px-1`,children:[`+`,g.length-2,` more`]})]})]},t.toISOString())})})]})}function m({viewDate:t,today:n,value:r,events:a,onSelect:s,onEventClick:f,isDateDisabled:p,onEventCreate:m,onEventDelete:h,editingId:g,onEditToggle:_,onUpdateTitle:v}){let y=d(t),b=Array.from({length:7},(e,t)=>u(y,t));function x(e){return a.filter(t=>l(t.date,e))}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{role:`row`,className:`grid grid-cols-7 border-b border-border`,children:b.map(t=>{let a=n?l(t,n):!1,c=r?l(t,r):!1,u=p?.(t)??!1;return(0,i.jsxs)(`div`,{role:`gridcell`,tabIndex:u?void 0:0,"aria-selected":c,"aria-disabled":u||void 0,"aria-label":t.toLocaleDateString(void 0,{dateStyle:`full`}),onClick:()=>!u&&s(t),onKeyDown:e=>{!u&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s(t))},className:e.t(`group/whead flex flex-col items-center gap-1 py-3 transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-focus-ring/35`,u?`cursor-not-allowed opacity-40`:`cursor-pointer hover:bg-surface-muted`),children:[(0,i.jsx)(`span`,{className:`text-[10px] font-semibold text-slate-400 dark:text-slate-500 uppercase tracking-wide`,children:o[t.getDay()]}),(0,i.jsx)(`span`,{className:e.t(`w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold transition-colors`,c?`bg-primary text-primary-foreground`:a?`border border-accent-500/50 text-accent-600 dark:text-accent-300`:`text-slate-700 dark:text-slate-200`),children:t.getDate()}),m&&!u&&(0,i.jsx)(`button`,{type:`button`,"aria-label":`Add event on ${t.toLocaleDateString()}`,onClick:e=>{e.stopPropagation(),m(t)},className:`opacity-0 group-hover/whead:opacity-100 focus:opacity-100 h-5 px-1.5 rounded-md bg-primary text-primary-foreground text-[10px] hover:bg-primary-hover`,children:`+ Add`})]},t.toISOString())})}),(0,i.jsx)(`div`,{className:`grid grid-cols-7 min-h-[200px]`,children:b.map((t,n)=>{let r=x(t),a=n===6,o=p?.(t)??!1;return(0,i.jsx)(`div`,{role:`gridcell`,tabIndex:o?void 0:0,"aria-disabled":o||void 0,"aria-label":`${t.toLocaleDateString(void 0,{dateStyle:`full`})} events`,onClick:()=>!o&&s(t),onKeyDown:e=>{!o&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s(t))},className:e.t(`space-y-1.5 p-2 transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-focus-ring/35`,!a&&`border-r border-border`,o?`cursor-not-allowed opacity-40`:`cursor-pointer hover:bg-surface-muted/70`),children:r.map(t=>(0,i.jsxs)(`div`,{className:e.t(`group/wev flex items-start gap-1 rounded-[var(--radius-md)] border px-2 py-1.5`,c[t.color??`blue`],g===t.id&&`ring-1 ring-focus-ring`),children:[(0,i.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f?.(t)},className:`min-w-0 flex-1 text-left`,children:[t.time&&(0,i.jsx)(`div`,{className:`text-[10px] opacity-60 mb-0.5`,children:t.time}),(0,i.jsx)(`div`,{className:`text-xs font-medium truncate`,children:t.title})]}),h&&(0,i.jsx)(`button`,{type:`button`,"aria-label":`Delete ${t.title}`,onClick:e=>{e.stopPropagation(),h(t.id)},className:`flex size-5 shrink-0 items-center justify-center rounded text-xs opacity-60 hover:bg-muted hover:opacity-100`,children:`×`})]},t.id))},t.toISOString())})})]})}function h({value:a,defaultValue:o=null,onChange:c,events:l,defaultEvents:h=[],onEventsChange:g,onEventClick:_,onEventCreate:v,onEventUpdate:y,onEventDelete:b,editable:x=!1,view:S,defaultView:C=`month`,onViewChange:ee,viewDate:w,defaultViewDate:T,onViewDateChange:te,minDate:E,maxDate:D,disabledDates:O,className:ne}){let[re,ie]=(0,r.useState)(null),[ae,oe]=(0,r.useState)(o),[se,ce]=(0,r.useState)(C),[k,A]=(0,r.useState)(T??null),[le,ue]=(0,r.useState)(()=>l??h),[j,M]=(0,r.useState)(1),[N,P]=(0,r.useState)(null),[F,I]=(0,r.useState)(``),[L,de]=(0,r.useState)(`blue`),[R,z]=(0,r.useState)(`09:00`),[B,V]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=new Date;ie(e),T===void 0&&w===void 0&&A(new Date(e.getFullYear(),e.getMonth(),1))},[]),(0,r.useEffect)(()=>{w===void 0&&T!==void 0&&k===null&&A(T?new Date(T):null)},[T]);let fe=a===void 0?ae:a,H=S===void 0?se:S,U=w===void 0?k:w,W=l!==void 0,G=W?l:le;function K(e){return!!(E&&e<new Date(E.getFullYear(),E.getMonth(),E.getDate())||D&&e>new Date(D.getFullYear(),D.getMonth(),D.getDate(),23,59,59,999)||O?.(e))}function pe(e){S===void 0&&ce(e),ee?.(e)}function q(e){e!==null&&(w===void 0&&A(e),te?.(e))}function J(e){K(e)||(a===void 0&&oe(e),c?.(e))}function me(e){return e&&(H===`month`?new Date(e.getFullYear(),e.getMonth()-1,1):u(e,-7))}function he(e){return e&&(H===`month`?new Date(e.getFullYear(),e.getMonth()+1,1):u(e,7))}function ge(){M(-1),q(me(U))}function _e(){M(1),q(he(U))}function ve(){let e=new Date;M(0),q(new Date(e.getFullYear(),e.getMonth(),1)),J(e)}function Y(e){W||ue(e),g?.(e)}function X(e,t){if(K(e))return;let n={id:typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():String(Date.now()+Math.random()),title:t?.trim()||F.trim()||`New event`,date:new Date(e),color:L,time:R||void 0};Y([...G,n]),v?.(n),P(null),I(``),z(`09:00`)}function Z(e){Y(G.filter(t=>t.id!==e)),b?.(e),B===e&&V(null)}function Q(e){Y(G.map(t=>t.id===e.id?e:t)),y?.(e),V(null)}function ye(e){x&&V(t=>t===e.id?null:e.id),_?.(e)}let $=``;if(U){if(H===`month`)$=`${s[U.getMonth()]} ${U.getFullYear()}`;else{let e=d(U),t=u(e,6);$=e.getMonth()===t.getMonth()?`${s[e.getMonth()].slice(0,3)} ${e.getDate()} \u2013 ${t.getDate()}, ${e.getFullYear()}`:`${s[e.getMonth()].slice(0,3)} ${e.getDate()} \u2013 ${s[t.getMonth()].slice(0,3)} ${t.getDate()}, ${e.getFullYear()}`}}let be=x||!!v||!!y||!!b||!!g,xe={today:re,value:fe,events:G,onSelect:J,onEventClick:ye,onEventCreate:be?e=>P(e):void 0,onEventDelete:be||b?Z:void 0,onEventUpdate:y,editingId:B,onEditToggle:e=>V(t=>t===e?null:e),onUpdateTitle:(e,t)=>{let n=G.find(t=>t.id===e);n&&Q({...n,title:t})},minDate:E,maxDate:D,disabledDates:O,isDateDisabled:K},Se=U?`${H}-${U.toISOString()}`:null;return(0,i.jsxs)(`div`,{className:e.t(`flex flex-col overflow-hidden rounded-[var(--radius-lg)] border border-border bg-surface`,ne),children:[(0,i.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-3 sm:px-4`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:ge,"aria-label":`Previous ${H}`,className:e.t(t.c,`size-8`),children:(0,i.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m15 18-6-6 6-6`})})}),(0,i.jsx)(`button`,{type:`button`,onClick:_e,"aria-label":`Next ${H}`,className:e.t(t.c,`size-8`),children:(0,i.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m9 18 6-6-6-6`})})})]}),(0,i.jsx)(`span`,{"aria-live":`polite`,className:`min-w-[9rem] flex-1 select-none text-sm font-semibold text-foreground`,children:$}),(0,i.jsx)(`button`,{type:`button`,onClick:ve,className:e.t(`h-8 rounded-[var(--radius-md)] border border-border px-3 text-xs font-medium text-muted-foreground transition-colors hover:border-border-strong hover:bg-muted hover:text-foreground`,t.s),children:`Today`}),(0,i.jsx)(`div`,{role:`group`,"aria-label":`Calendar view`,className:`flex overflow-hidden rounded-[var(--radius-md)] border border-border`,children:[`month`,`week`].map(n=>(0,i.jsx)(`button`,{type:`button`,onClick:()=>pe(n),"aria-pressed":H===n,className:e.t(`h-8 px-3 text-xs capitalize transition-colors focus-visible:z-10`,t.s,H===n?`bg-muted text-foreground font-medium`:`text-muted-foreground hover:bg-surface-muted hover:text-foreground`),children:n},n))})]}),N&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border bg-warning/8 px-3 py-3 sm:px-4`,children:[(0,i.jsxs)(`span`,{className:`text-xs font-medium text-foreground`,children:[`New event on `,N.toLocaleDateString(),`:`]}),(0,i.jsx)(`input`,{autoFocus:!0,value:F,onChange:e=>I(e.target.value),onKeyDown:e=>{e.key===`Enter`&&X(N),e.key===`Escape`&&(P(null),I(``),z(`09:00`))},placeholder:`Event title`,className:`h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25`}),(0,i.jsx)(`input`,{type:`time`,value:R,onChange:e=>z(e.target.value),className:`h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25`}),(0,i.jsxs)(`select`,{"aria-label":`Event color`,value:L,onChange:e=>de(e.target.value),className:`h-7 rounded-[var(--radius-md)] border border-border bg-surface px-2 text-xs text-foreground`,children:[(0,i.jsx)(`option`,{value:`blue`,children:`Blue`}),(0,i.jsx)(`option`,{value:`green`,children:`Green`}),(0,i.jsx)(`option`,{value:`red`,children:`Red`}),(0,i.jsx)(`option`,{value:`yellow`,children:`Yellow`}),(0,i.jsx)(`option`,{value:`purple`,children:`Purple`}),(0,i.jsx)(`option`,{value:`orange`,children:`Orange`})]}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>X(N),className:`h-7 px-3 rounded-md bg-primary text-xs font-medium text-primary-foreground hover:bg-primary-hover`,children:`Add`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>{P(null),I(``),z(`09:00`)},className:`h-7 rounded-[var(--radius-md)] border border-border bg-surface px-2.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:`Cancel`})]}),B&&(()=>{let e=G.find(e=>e.id===B);return e?(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border bg-surface-muted px-3 py-3 sm:px-4`,children:[(0,i.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:`Edit event:`}),(0,i.jsx)(`input`,{autoFocus:!0,defaultValue:e.title,onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value,r=document.getElementById(`cal-edit-time-${e.id}`)?.value??e.time??``;n.trim()&&Q({...e,title:n.trim(),time:r||void 0})}t.key===`Escape`&&V(null)},id:`cal-edit-${e.id}`,placeholder:`Title`,className:`h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25`}),(0,i.jsx)(`input`,{type:`time`,defaultValue:e.time??``,id:`cal-edit-time-${e.id}`,className:`h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>{let t=document.getElementById(`cal-edit-${e.id}`),n=document.getElementById(`cal-edit-time-${e.id}`),r=t?.value??e.title,i=n?.value??``;r.trim()&&Q({...e,title:r.trim(),time:i||void 0})},className:`h-7 px-3 rounded-md bg-primary text-xs font-medium text-primary-foreground hover:bg-primary-hover`,children:`Save`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>Z(e.id),className:`h-7 rounded-[var(--radius-md)] bg-destructive px-2.5 text-xs font-medium text-destructive-foreground hover:bg-destructive-hover`,children:`Delete`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>V(null),className:`h-7 rounded-[var(--radius-md)] border border-border bg-surface px-2.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:`Cancel`})]}):null})(),(0,i.jsx)(`div`,{className:`relative flex-1 overflow-x-auto`,children:(0,i.jsx)(`div`,{className:`min-w-[42rem]`,children:(0,i.jsx)(n.AnimatePresence,{mode:`popLayout`,initial:!1,custom:j,children:Se!==null&&U!==null&&(0,i.jsx)(n.motion.div,{custom:j,variants:f,initial:`enter`,animate:`center`,exit:`exit`,transition:{duration:.18,ease:`easeInOut`},children:H===`month`?(0,i.jsx)(p,{viewDate:U,...xe}):(0,i.jsx)(m,{viewDate:U,...xe})},Se)})})})]})}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./cn-
|
|
2
|
-
import { c as t, s as n } from "./component-styles-
|
|
1
|
+
import { t as e } from "./cn-BJyZJP-y.js";
|
|
2
|
+
import { c as t, s as n } from "./component-styles-C2CbHEEA.js";
|
|
3
3
|
import { AnimatePresence as r, motion as i } from "framer-motion";
|
|
4
4
|
import { useEffect as a, useState as o } from "react";
|
|
5
5
|
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -103,7 +103,7 @@ function v({ viewDate: t, today: n, value: r, events: i, onSelect: a, onEventCli
|
|
|
103
103
|
onKeyDown: (e) => {
|
|
104
104
|
!S && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t));
|
|
105
105
|
},
|
|
106
|
-
className: e("p-1.5 transition-colors group/cell", "border-border focus-visible:z-10 focus-visible:outline-none focus-visible:ring-
|
|
106
|
+
className: e("p-1.5 transition-colors group/cell", "border-border focus-visible:z-10 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-focus-ring/35", !s && "border-r", !u && "border-b", !x && "bg-black/[0.015] dark:bg-white/[0.015]", S ? "cursor-not-allowed opacity-40" : "cursor-pointer hover:bg-surface-muted"),
|
|
107
107
|
children: [/* @__PURE__ */ l("div", {
|
|
108
108
|
className: "flex items-center justify-between mb-1",
|
|
109
109
|
children: [/* @__PURE__ */ c("span", {
|
|
@@ -179,7 +179,7 @@ function y({ viewDate: t, today: n, value: r, events: i, onSelect: a, onEventCli
|
|
|
179
179
|
onKeyDown: (e) => {
|
|
180
180
|
!s && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t));
|
|
181
181
|
},
|
|
182
|
-
className: e("group/whead flex flex-col items-center gap-1 py-3 transition-colors focus-visible:outline-none focus-visible:ring-
|
|
182
|
+
className: e("group/whead flex flex-col items-center gap-1 py-3 transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-focus-ring/35", s ? "cursor-not-allowed opacity-40" : "cursor-pointer hover:bg-surface-muted"),
|
|
183
183
|
children: [
|
|
184
184
|
/* @__PURE__ */ c("span", {
|
|
185
185
|
className: "text-[10px] font-semibold text-slate-400 dark:text-slate-500 uppercase tracking-wide",
|
|
@@ -214,7 +214,7 @@ function y({ viewDate: t, today: n, value: r, events: i, onSelect: a, onEventCli
|
|
|
214
214
|
onKeyDown: (e) => {
|
|
215
215
|
!s && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t));
|
|
216
216
|
},
|
|
217
|
-
className: e("space-y-1.5 p-2 transition-colors focus-visible:outline-none focus-visible:ring-
|
|
217
|
+
className: e("space-y-1.5 p-2 transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-focus-ring/35", !i && "border-r border-border", s ? "cursor-not-allowed opacity-40" : "cursor-pointer hover:bg-surface-muted/70"),
|
|
218
218
|
children: r.map((t) => /* @__PURE__ */ l("div", {
|
|
219
219
|
className: e("group/wev flex items-start gap-1 rounded-[var(--radius-md)] border px-2 py-1.5", p[t.color ?? "blue"], v === t.id && "ring-1 ring-focus-ring"),
|
|
220
220
|
children: [/* @__PURE__ */ l("button", {
|
|
@@ -423,13 +423,13 @@ function b({ value: s, defaultValue: u = null, onChange: d, events: p, defaultEv
|
|
|
423
423
|
e.key === "Enter" && Ce(P), e.key === "Escape" && (F(null), L(""), B("09:00"));
|
|
424
424
|
},
|
|
425
425
|
placeholder: "Event title",
|
|
426
|
-
className: "h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-
|
|
426
|
+
className: "h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25"
|
|
427
427
|
}),
|
|
428
428
|
/* @__PURE__ */ c("input", {
|
|
429
429
|
type: "time",
|
|
430
430
|
value: z,
|
|
431
431
|
onChange: (e) => B(e.target.value),
|
|
432
|
-
className: "h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-
|
|
432
|
+
className: "h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25"
|
|
433
433
|
}),
|
|
434
434
|
/* @__PURE__ */ l("select", {
|
|
435
435
|
"aria-label": "Event color",
|
|
@@ -504,13 +504,13 @@ function b({ value: s, defaultValue: u = null, onChange: d, events: p, defaultEv
|
|
|
504
504
|
},
|
|
505
505
|
id: `cal-edit-${e.id}`,
|
|
506
506
|
placeholder: "Title",
|
|
507
|
-
className: "h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-
|
|
507
|
+
className: "h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25"
|
|
508
508
|
}),
|
|
509
509
|
/* @__PURE__ */ c("input", {
|
|
510
510
|
type: "time",
|
|
511
511
|
defaultValue: e.time ?? "",
|
|
512
512
|
id: `cal-edit-time-${e.id}`,
|
|
513
|
-
className: "h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-
|
|
513
|
+
className: "h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-[3px] focus:ring-focus-ring/25"
|
|
514
514
|
}),
|
|
515
515
|
/* @__PURE__ */ c("button", {
|
|
516
516
|
type: "button",
|