@alkimi.org/ui-kit 0.12.6 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/COMPONENTS.md +222 -2
- package/dist/{chunk-3TLCOZ5R.js → chunk-24EJLBGD.js} +2 -2
- package/dist/chunk-24EJLBGD.js.map +1 -0
- package/dist/chunk-372VUZFE.js.map +1 -1
- package/dist/chunk-3BVMHDYA.js.map +1 -1
- package/dist/{chunk-GRXC46JC.js → chunk-3DUPSGEY.js} +2 -2
- package/dist/chunk-3DUPSGEY.js.map +1 -0
- package/dist/{chunk-DMMKR6TY.js → chunk-3N5K4X23.js} +2 -2
- package/dist/chunk-3N5K4X23.js.map +1 -0
- package/dist/chunk-3PEPOFYU.js.map +1 -1
- package/dist/{chunk-DATWXRPT.mjs → chunk-4DRIPZWE.mjs} +2 -2
- package/dist/{chunk-BV7RXRSL.js → chunk-53P3PXF7.js} +2 -2
- package/dist/chunk-53P3PXF7.js.map +1 -0
- package/dist/chunk-5L5DM2X5.js.map +1 -1
- package/dist/chunk-5X26XR44.js.map +1 -1
- package/dist/chunk-73MWZSJI.js +3 -0
- package/dist/chunk-73MWZSJI.js.map +1 -0
- package/dist/chunk-7SOZ6MOV.js.map +1 -1
- package/dist/chunk-ALSJLUSL.js +3 -0
- package/dist/chunk-ALSJLUSL.js.map +1 -0
- package/dist/chunk-C4GUY2JQ.js +3 -0
- package/dist/chunk-C4GUY2JQ.js.map +1 -0
- package/dist/chunk-CT2CRYC2.js.map +1 -1
- package/dist/chunk-DEWWZMYC.js.map +1 -1
- package/dist/chunk-EBNJXPHG.js.map +1 -1
- package/dist/{chunk-UAUSYTY4.mjs → chunk-EDOMXQSZ.mjs} +2 -2
- package/dist/{chunk-UAUSYTY4.mjs.map → chunk-EDOMXQSZ.mjs.map} +1 -1
- package/dist/chunk-EIM5R7AJ.js.map +1 -1
- package/dist/chunk-EJTY2ABY.js.map +1 -1
- package/dist/{chunk-QMJVRGPB.mjs → chunk-EOFZPG26.mjs} +2 -2
- package/dist/{chunk-QMJVRGPB.mjs.map → chunk-EOFZPG26.mjs.map} +1 -1
- package/dist/chunk-ETE5IUMO.js +3 -0
- package/dist/chunk-ETE5IUMO.js.map +1 -0
- package/dist/chunk-FUYXCJOQ.js.map +1 -1
- package/dist/chunk-I5INE4KG.js.map +1 -1
- package/dist/{chunk-RKRTEMMZ.js → chunk-IJRJBDSO.js} +2 -2
- package/dist/chunk-IJRJBDSO.js.map +1 -0
- package/dist/{chunk-XQILGD5B.js → chunk-IJVB2BVO.js} +2 -2
- package/dist/chunk-IJVB2BVO.js.map +1 -0
- package/dist/{chunk-DKMCJGI4.mjs → chunk-JD2CTTZW.mjs} +2 -2
- package/dist/chunk-JOEQLSHD.js +32 -0
- package/dist/chunk-JOEQLSHD.js.map +1 -0
- package/dist/{chunk-PD43W3YN.mjs → chunk-JYA3425I.mjs} +2 -2
- package/dist/chunk-KN2ZJ5E6.mjs +3 -0
- package/dist/chunk-KN2ZJ5E6.mjs.map +1 -0
- package/dist/{chunk-574USYNO.mjs → chunk-MKZJL4AD.mjs} +2 -2
- package/dist/{chunk-574USYNO.mjs.map → chunk-MKZJL4AD.mjs.map} +1 -1
- package/dist/{chunk-DHHZMQ72.js → chunk-NCBOTFZQ.js} +2 -2
- package/dist/chunk-NCBOTFZQ.js.map +1 -0
- package/dist/chunk-NHM7DO42.mjs +3 -0
- package/dist/chunk-NHM7DO42.mjs.map +1 -0
- package/dist/chunk-OLF2HLRF.mjs +3 -0
- package/dist/chunk-OLF2HLRF.mjs.map +1 -0
- package/dist/chunk-QOEM7ZRV.mjs +3 -0
- package/dist/chunk-QOEM7ZRV.mjs.map +1 -0
- package/dist/{chunk-BLHKJHNV.mjs → chunk-QZKQORLQ.mjs} +2 -2
- package/dist/chunk-QZKQORLQ.mjs.map +1 -0
- package/dist/chunk-RJMIOBXZ.js.map +1 -1
- package/dist/chunk-RRAIGAHU.js.map +1 -1
- package/dist/{chunk-KLU33CJI.mjs → chunk-RUEPYIWM.mjs} +2 -2
- package/dist/{chunk-7J2ETVGK.js → chunk-SPGHRCUD.js} +2 -2
- package/dist/chunk-SPGHRCUD.js.map +1 -0
- package/dist/chunk-TDMRUCR6.js.map +1 -1
- package/dist/chunk-TUADTU4Z.mjs +32 -0
- package/dist/chunk-TUADTU4Z.mjs.map +1 -0
- package/dist/chunk-UJZP6L4S.js.map +1 -1
- package/dist/chunk-ULIOO55I.js.map +1 -1
- package/dist/chunk-UNR6ATUH.js.map +1 -1
- package/dist/chunk-UW73WIQU.js +3 -0
- package/dist/chunk-UW73WIQU.js.map +1 -0
- package/dist/chunk-VBPIXXIA.js.map +1 -1
- package/dist/chunk-VGPTOLNX.mjs +3 -0
- package/dist/chunk-VGPTOLNX.mjs.map +1 -0
- package/dist/chunk-WFD523CV.js.map +1 -1
- package/dist/chunk-WYRD4UAK.js.map +1 -1
- package/dist/{chunk-USPGZYMV.js → chunk-XUVA7BXG.js} +2 -2
- package/dist/chunk-XUVA7BXG.js.map +1 -0
- package/dist/chunk-XVF3OJWZ.js +3 -0
- package/dist/chunk-XVF3OJWZ.js.map +1 -0
- package/dist/chunk-XY6RUEAT.mjs +3 -0
- package/dist/chunk-XY6RUEAT.mjs.map +1 -0
- package/dist/chunk-XYO4VLMF.js.map +1 -1
- package/dist/{chunk-LQMOWEA7.js → chunk-YE7OOLWB.js} +2 -2
- package/dist/chunk-YE7OOLWB.js.map +1 -0
- package/dist/{chunk-TYRJ7CQV.mjs → chunk-YIVVQTGD.mjs} +2 -2
- package/dist/chunk-YSIF7HA3.mjs +3 -0
- package/dist/chunk-YSIF7HA3.mjs.map +1 -0
- package/dist/chunk-Z5V4P3EC.js.map +1 -1
- package/dist/components/GeometricFluidGrid.js.map +1 -1
- package/dist/components/GlitchLink.js.map +1 -1
- package/dist/components/PixelLoad.js.map +1 -1
- package/dist/components/TextDecoder.js.map +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/breadcrumb.mjs.map +1 -1
- package/dist/components/button.d.mts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/button.mjs +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/calendar.mjs +1 -1
- package/dist/components/card.js +2 -31
- package/dist/components/card.js.map +1 -1
- package/dist/components/card.mjs +1 -30
- package/dist/components/card.mjs.map +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.d.mts +19 -2
- package/dist/components/combobox.d.ts +19 -2
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/combobox.mjs +1 -1
- package/dist/components/command.d.mts +1 -1
- package/dist/components/command.d.ts +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/command.js.map +1 -1
- package/dist/components/command.mjs +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-picker.mjs +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/date-range-picker.mjs +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dialog.mjs +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/drawer.mjs +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-upload.js +1 -1
- package/dist/components/file-upload.js.map +1 -1
- package/dist/components/file-upload.mjs +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/input.mjs +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.js +2 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progress.mjs +1 -1
- package/dist/components/progress.mjs.map +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/sidebar.mjs +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slider.js.map +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/slider.mjs.map +1 -1
- package/dist/components/switch.js +2 -2
- package/dist/components/switch.js.map +1 -1
- package/dist/components/switch.mjs +1 -1
- package/dist/components/switch.mjs.map +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tree-select.js +1 -1
- package/dist/components/tree-select.js.map +1 -1
- package/dist/components/tree-select.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3TLCOZ5R.js.map +0 -1
- package/dist/chunk-4UISHS25.mjs +0 -3
- package/dist/chunk-4UISHS25.mjs.map +0 -1
- package/dist/chunk-7FUNOEYE.mjs +0 -3
- package/dist/chunk-7FUNOEYE.mjs.map +0 -1
- package/dist/chunk-7J2ETVGK.js.map +0 -1
- package/dist/chunk-BLHKJHNV.mjs.map +0 -1
- package/dist/chunk-BV7RXRSL.js.map +0 -1
- package/dist/chunk-DHHZMQ72.js.map +0 -1
- package/dist/chunk-DMMKR6TY.js.map +0 -1
- package/dist/chunk-GRXC46JC.js.map +0 -1
- package/dist/chunk-K4GMCVHO.js +0 -3
- package/dist/chunk-K4GMCVHO.js.map +0 -1
- package/dist/chunk-LQMOWEA7.js.map +0 -1
- package/dist/chunk-NEOUFWZN.mjs +0 -3
- package/dist/chunk-NEOUFWZN.mjs.map +0 -1
- package/dist/chunk-ODXDXJ72.js +0 -3
- package/dist/chunk-ODXDXJ72.js.map +0 -1
- package/dist/chunk-RKRTEMMZ.js.map +0 -1
- package/dist/chunk-USPGZYMV.js.map +0 -1
- package/dist/chunk-XQILGD5B.js.map +0 -1
- /package/dist/{chunk-DATWXRPT.mjs.map → chunk-4DRIPZWE.mjs.map} +0 -0
- /package/dist/{chunk-DKMCJGI4.mjs.map → chunk-JD2CTTZW.mjs.map} +0 -0
- /package/dist/{chunk-PD43W3YN.mjs.map → chunk-JYA3425I.mjs.map} +0 -0
- /package/dist/{chunk-KLU33CJI.mjs.map → chunk-RUEPYIWM.mjs.map} +0 -0
- /package/dist/{chunk-TYRJ7CQV.mjs.map → chunk-YIVVQTGD.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-UNR6ATUH.js","../src/components/sheet.tsx"],"names":["Sheet","SheetTrigger","SheetClose","SheetPortal","SheetOverlay","className","props","ref","jsx","cn","sheetVariants","cva","SheetContent","side","children","jsxs","X","SheetHeader","SheetFooter","SheetTitle","SheetDescription"],"mappings":"AAAA,uWAAY;AACZ,sDAAuC,uECChB,oGACS,kEACO,2CACrB,+CAgBhB,IAZIA,CAAAA,CAAuB,CAAA,CAAA,IAAA,CAEvBC,CAAAA,aAA8B,CAAA,CAAA,OAAA,CAE9BC,CAAAA,aAA4B,CAAA,CAAA,KAAA,CAE5BC,CAAAA,aAA6B,CAAA,CAAA,MAAA,CAE7BC,CAAAA,aAAqB,CAAA,CAAA,UAAA,CAGzB,CAAC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,CAAS,CAAA,CACvD,GAAGC,CAAAA,CACN,CACD,CAAA,CACDc,CAAAA,CAAiB,WAAA,CAA6B,CAAA,CAAA,WAAA,CAAY,WAAA,CAAA,qJAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-UNR6ATUH.js","sourcesContent":[null,"\"use client\"\n\nimport * as React from \"react\"\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Sheet = SheetPrimitive.Root\n\nconst SheetTrigger = SheetPrimitive.Trigger\n\nconst SheetClose = SheetPrimitive.Close\n\nconst SheetPortal = SheetPrimitive.Portal\n\nconst SheetOverlay = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className\n )}\n {...props}\n ref={ref}\n />\n))\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName\n\nconst sheetVariants = cva(\n \"fixed z-50 gap-4 bg-sheet p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-500\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n }\n)\n\ninterface SheetContentProps\n extends\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {}\n\nconst SheetContent = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(({ side = \"right\", className, children, ...props }, ref) => (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...props}\n >\n {children}\n <SheetPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPortal>\n))\nSheetContent.displayName = SheetPrimitive.Content.displayName\n\nconst SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className\n )}\n {...props}\n />\n)\nSheetHeader.displayName = \"SheetHeader\"\n\nconst SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className\n )}\n {...props}\n />\n)\nSheetFooter.displayName = \"SheetFooter\"\n\nconst SheetTitle = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold text-primary-accent\", className)}\n {...props}\n />\n))\nSheetTitle.displayName = SheetPrimitive.Title.displayName\n\nconst SheetDescription = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n))\nSheetDescription.displayName = SheetPrimitive.Description.displayName\n\nexport {\n Sheet,\n SheetPortal,\n SheetOverlay,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
var _chunkULIOO55Ijs = require('./chunk-ULIOO55I.js');var _chunkSPGHRCUDjs = require('./chunk-SPGHRCUD.js');var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var v = _interopRequireWildcard(_react);var _lucidereact = require('lucide-react');var _jsxruntime = require('react/jsx-runtime');function ne({selectedOptions:m,onRemove:s,showRemoveIcon:p=!0,disabled:b=!1,className:d,chipClassName:x}){if(m.length===0)return null;let h=(t,c)=>{c.preventDefault(),c.stopPropagation(),_optionalChain([s, 'optionalCall', _2 => _2(t)])};return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:m.map(t=>_jsxruntime.jsxs.call(void 0, "div",{className:_chunkFUYXCJOQjs.a.call(void 0, "inline-flex items-center gap-2 rounded-3xl border bg-transparent px-2 lg:px-3 py-1.5 text-sm",b&&"opacity-50 cursor-not-allowed pointer-events-none",d,x),style:{borderColor:t.color||"var(--border)"},children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate text-xs font-medium",style:{color:t.color},children:t.label}),p&&!b&&s&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:c=>h(t.value,c),children:_jsxruntime.jsx.call(void 0, _lucidereact.X,{className:"size-3.5 cursor-pointer opacity-70 hover:opacity-100",style:{color:t.color}})})]},t.value))})}function ie({options:m=[],groups:s,value:p,onValueChange:b,placeholder:d="Select option...",searchPlaceholder:x="Search...",emptyMessage:h="No option found.",disabled:t=!1,disableLabelControls:c=!1,className:W,error:X=!1,multiple:$=!1,values:l=[],onValuesChange:C,variant:j="default",searchable:q=!0,onTriggerClick:w,showChipRemoveIcon:F=!0,triggerProps:J,externalChipsOnly:K=!1}){let[N,P]=v.useState(!1),n=j==="metrics",f=n?!0:$,R=v.useMemo(()=>s?s.flatMap(e=>e.options):m,[s,m]),k=R.find(e=>e.value===p),i=R.filter(e=>l.includes(e.value)),Q=e=>{if(f){let r=l.includes(e)?l.filter(u=>u!==e):[...l,e];_optionalChain([C, 'optionalCall', _3 => _3(r)])}else _optionalChain([b, 'optionalCall', _4 => _4(e===p?"":e)]),P(!1)},U=(e,r)=>{r.preventDefault(),r.stopPropagation();let u=l.filter(_=>_!==e);_optionalChain([C, 'optionalCall', _5 => _5(u)])},V=()=>n?d:f?i.length===0?d:i.length===1?i[0].label:`${i.length} selected`:k?k.label:d,O=e=>{let r=f?l.includes(e.value):p===e.value;return _jsxruntime.jsxs.call(void 0, _chunkSPGHRCUDjs.h,{value:e.value,onSelect:Q,className:"rounded-[12px]",children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:e.label}),_jsxruntime.jsx.call(void 0, _lucidereact.Check,{className:_chunkFUYXCJOQjs.a.call(void 0, "ml-auto h-4 w-4 shrink-0",r?"opacity-100":"opacity-0")})]},e.value)},M=()=>n||!f||i.length===0?null:_jsxruntime.jsx.call(void 0, "div",{className:"px-2 py-1.5",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-wrap gap-1",children:i.map(e=>_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs",children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:e.label}),_jsxruntime.jsx.call(void 0, _lucidereact.X,{className:"h-3 w-3 cursor-pointer",onClick:r=>U(e.value,r)})]},e.value))})}),Y=()=>{if(!n||K||i.length===0)return null;let e=F&&!t&&!c;return _jsxruntime.jsx.call(void 0, ne,{selectedOptions:i,onRemove:e?Z:void 0,showRemoveIcon:e,disabled:t||c})},Z=e=>{let r=l.filter(u=>u!==e);_optionalChain([C, 'optionalCall', _6 => _6(r)])},S=_jsxruntime.jsxs.call(void 0, _chunkULIOO55Ijs.a,{open:N,onOpenChange:P,children:[_jsxruntime.jsx.call(void 0, _chunkULIOO55Ijs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",role:"combobox","aria-expanded":N,disabled:t,...J,onClick:w?e=>{e.preventDefault(),w()}:void 0,className:_chunkFUYXCJOQjs.a.call(void 0, "cursor-pointer flex h-8 lg:h-9 items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-2 lg:px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50",!n&&"my-2 w-full",n&&"w-auto gap-2",!p&&!l.length&&"text-secondary-text",X&&"border-destructive-foreground focus-visible:ring-destructive-foreground",n&&"bg-muted text-primary-accent hover:bg-muted/20 border-muted text-xs font-medium",W),children:[n&&_jsxruntime.jsx.call(void 0, _lucidereact.Plus,{className:"h-4 w-4 shrink-0"}),_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:V()}),!n&&_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),_jsxruntime.jsx.call(void 0, _chunkULIOO55Ijs.c,{className:"overflow-hidden rounded-xl p-0",align:"start",style:n?{minWidth:200}:{width:"var(--radix-popover-trigger-width)"},children:_jsxruntime.jsxs.call(void 0, _chunkSPGHRCUDjs.a,{children:[q&&_jsxruntime.jsx.call(void 0, _chunkSPGHRCUDjs.c,{placeholder:x}),_jsxruntime.jsxs.call(void 0, _chunkSPGHRCUDjs.d,{children:[_jsxruntime.jsx.call(void 0, _chunkSPGHRCUDjs.e,{children:h}),s?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[M(),s.map(e=>_jsxruntime.jsx.call(void 0, _chunkSPGHRCUDjs.f,{heading:e.label,children:e.options.map(O)},e.label))]}):_jsxruntime.jsxs.call(void 0, _chunkSPGHRCUDjs.f,{children:[M(),m.map(O)]})]})]})})]});return n?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-wrap items-center gap-2",children:[S,Y()]}):S}exports.a = ne; exports.b = ie;
|
|
3
|
+
//# sourceMappingURL=chunk-UW73WIQU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-UW73WIQU.js","../src/components/combobox.tsx"],"names":["ComboboxChips","selectedOptions","onRemove","showRemoveIcon","disabled","className","chipClassName","handleRemove","value","e","jsx","Fragment","option","jsxs","cn","X","Combobox","options","groups","onValueChange","placeholder","searchPlaceholder","emptyMessage","disableLabelControls","error","multiple","values","onValuesChange","variant","searchable","onTriggerClick","showChipRemoveIcon","triggerProps","externalChipsOnly","open","setOpen","isMetrics","effectiveMultiple","allOptions","g","selectedOption","handleSelect","currentValue","newValues","v","handleRemoveValue","valueToRemove","getDisplayText"],"mappings":"AAAA,22BAAY;AACZ,sDAAq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AAUmB,CAAAA,CACrCnB,CAAAA,CAAgB,MAAA,GAAW,CAAA,CAAUA,CAAAA,CAAgB,CAAC,CAAA,CAAE,KAAA,CACrD,CAAA,EAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-UW73WIQU.js","sourcesContent":[null,"import * as React from \"react\"\nimport { Check, ChevronDown, Plus, X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"@/components/command\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/popover\"\n\nexport interface ComboboxOption {\n value: string\n label: string\n color?: string\n}\n\nexport interface ComboboxGroup {\n label: string\n options: ComboboxOption[]\n}\n\nexport interface ComboboxProps {\n options?: ComboboxOption[]\n groups?: ComboboxGroup[]\n value?: string\n onValueChange?: (value: string) => void\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n disabled?: boolean\n disableLabelControls?: boolean\n className?: string\n error?: boolean\n multiple?: boolean\n values?: string[]\n onValuesChange?: (values: string[]) => void\n variant?: \"default\" | \"metrics\"\n searchable?: boolean\n onTriggerClick?: () => void\n showChipRemoveIcon?: boolean\n triggerProps?: React.ButtonHTMLAttributes<HTMLButtonElement>\n /** When true, external chips are not rendered inside the Combobox. Use ComboboxChips to render them externally. */\n externalChipsOnly?: boolean\n}\n\nexport interface ComboboxChipsProps {\n /** The selected options to display as chips */\n selectedOptions: ComboboxOption[]\n /** Callback when a chip is removed */\n onRemove?: (value: string) => void\n /** Whether to show the remove icon on chips */\n showRemoveIcon?: boolean\n /** Whether the chips are disabled */\n disabled?: boolean\n /** Additional class name for the chip container */\n className?: string\n /** Additional class name for individual chips */\n chipClassName?: string\n}\n\nexport function ComboboxChips({\n selectedOptions,\n onRemove,\n showRemoveIcon = true,\n disabled = false,\n className,\n chipClassName,\n}: ComboboxChipsProps) {\n if (selectedOptions.length === 0) return null\n\n const handleRemove = (value: string, e: React.MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n onRemove?.(value)\n }\n\n return (\n <>\n {selectedOptions.map((option) => (\n <div\n key={option.value}\n className={cn(\n \"inline-flex items-center gap-2 rounded-3xl border bg-transparent px-2 lg:px-3 py-1.5 text-sm\",\n disabled && \"opacity-50 cursor-not-allowed pointer-events-none\",\n className,\n chipClassName\n )}\n style={{ borderColor: option.color || \"var(--border)\" }}\n >\n <span\n className=\"truncate text-xs font-medium\"\n style={{ color: option.color }}\n >\n {option.label}\n </span>\n {showRemoveIcon && !disabled && onRemove && (\n <button\n type=\"button\"\n onClick={(e) => handleRemove(option.value, e)}\n >\n <X\n className=\"size-3.5 cursor-pointer opacity-70 hover:opacity-100\"\n style={{ color: option.color }}\n />\n </button>\n )}\n </div>\n ))}\n </>\n )\n}\n\nexport function Combobox({\n options = [],\n groups,\n value,\n onValueChange,\n placeholder = \"Select option...\",\n searchPlaceholder = \"Search...\",\n emptyMessage = \"No option found.\",\n disabled = false,\n disableLabelControls = false,\n className,\n error = false,\n multiple = false,\n values = [],\n onValuesChange,\n variant = \"default\",\n searchable = true,\n onTriggerClick,\n showChipRemoveIcon = true,\n triggerProps,\n externalChipsOnly = false,\n}: ComboboxProps) {\n const [open, setOpen] = React.useState(false)\n const isMetrics = variant === \"metrics\"\n const effectiveMultiple = isMetrics ? true : multiple\n\n const allOptions = React.useMemo(() => {\n if (groups) return groups.flatMap((g) => g.options)\n return options\n }, [groups, options])\n\n const selectedOption = allOptions.find((option) => option.value === value)\n const selectedOptions = allOptions.filter((option) =>\n values.includes(option.value)\n )\n\n const handleSelect = (currentValue: string) => {\n if (effectiveMultiple) {\n const newValues = values.includes(currentValue)\n ? values.filter((v) => v !== currentValue)\n : [...values, currentValue]\n onValuesChange?.(newValues)\n } else {\n onValueChange?.(currentValue === value ? \"\" : currentValue)\n setOpen(false)\n }\n }\n\n const handleRemoveValue = (valueToRemove: string, e: React.MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n const newValues = values.filter((v) => v !== valueToRemove)\n onValuesChange?.(newValues)\n }\n\n const getDisplayText = () => {\n if (isMetrics) return placeholder\n if (effectiveMultiple) {\n if (selectedOptions.length === 0) return placeholder\n if (selectedOptions.length === 1) return selectedOptions[0].label\n return `${selectedOptions.length} selected`\n }\n return selectedOption ? selectedOption.label : placeholder\n }\n\n const renderOption = (option: ComboboxOption) => {\n const isSelected = effectiveMultiple\n ? values.includes(option.value)\n : value === option.value\n\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n onSelect={handleSelect}\n className=\"rounded-[12px]\"\n >\n <span className=\"truncate\">{option.label}</span>\n <Check\n className={cn(\n \"ml-auto h-4 w-4 shrink-0\",\n isSelected ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n </CommandItem>\n )\n }\n\n const renderSelectedChips = () => {\n if (isMetrics || !effectiveMultiple || selectedOptions.length === 0)\n return null\n\n return (\n <div className=\"px-2 py-1.5\">\n <div className=\"flex flex-wrap gap-1\">\n {selectedOptions.map((option) => (\n <div\n key={option.value}\n className=\"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs\"\n >\n <span className=\"truncate\">{option.label}</span>\n <X\n className=\"h-3 w-3 cursor-pointer\"\n onClick={(e) => handleRemoveValue(option.value, e)}\n />\n </div>\n ))}\n </div>\n </div>\n )\n }\n\n const renderExternalChips = () => {\n if (!isMetrics || externalChipsOnly || selectedOptions.length === 0)\n return null\n\n const canRemove = showChipRemoveIcon && !disabled && !disableLabelControls\n\n return (\n <ComboboxChips\n selectedOptions={selectedOptions}\n onRemove={canRemove ? handleRemoveChip : undefined}\n showRemoveIcon={canRemove}\n disabled={disabled || disableLabelControls}\n />\n )\n }\n\n const handleRemoveChip = (valueToRemove: string) => {\n const newValues = values.filter((v) => v !== valueToRemove)\n onValuesChange?.(newValues)\n }\n\n const popover = (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n disabled={disabled}\n {...triggerProps}\n onClick={\n onTriggerClick\n ? (e) => {\n e.preventDefault()\n onTriggerClick()\n }\n : undefined\n }\n className={cn(\n \"cursor-pointer flex h-8 lg:h-9 items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-2 lg:px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50\",\n !isMetrics && \"my-2 w-full\",\n isMetrics && \"w-auto gap-2\",\n !value && !values.length && \"text-secondary-text\",\n error &&\n \"border-destructive-foreground focus-visible:ring-destructive-foreground\",\n isMetrics &&\n \"bg-muted text-primary-accent hover:bg-muted/20 border-muted text-xs font-medium\",\n className\n )}\n >\n {isMetrics && <Plus className=\"h-4 w-4 shrink-0\" />}\n <span className=\"truncate\">{getDisplayText()}</span>\n {!isMetrics && (\n <ChevronDown className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n )}\n </button>\n </PopoverTrigger>\n <PopoverContent\n className=\"overflow-hidden rounded-xl p-0\"\n align=\"start\"\n style={\n isMetrics\n ? { minWidth: 200 }\n : { width: \"var(--radix-popover-trigger-width)\" }\n }\n >\n <Command>\n {searchable && <CommandInput placeholder={searchPlaceholder} />}\n <CommandList>\n <CommandEmpty>{emptyMessage}</CommandEmpty>\n {groups ? (\n <>\n {renderSelectedChips()}\n {groups.map((group) => (\n <CommandGroup key={group.label} heading={group.label}>\n {group.options.map(renderOption)}\n </CommandGroup>\n ))}\n </>\n ) : (\n <CommandGroup>\n {renderSelectedChips()}\n {options.map(renderOption)}\n </CommandGroup>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n\n if (isMetrics) {\n return (\n <div className=\"flex flex-wrap items-center gap-2\">\n {popover}\n {renderExternalChips()}\n </div>\n )\n }\n\n return popover\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-VBPIXXIA.js","../src/components/tabs.tsx"],"names":["Tabs","TabsList","forwardRef","className","props","ref","indicatorStyle","setIndicatorStyle","useState","listRef","useRef","useEffect","updateIndicator","activeTab","listRect","tabRect","observer","combinedRef","useCallback","node","jsxs","cn","jsx"],"mappings":"AAAA,uWAAY;AACZ,sDAAkC,8FCDH,8BAGsC,+CAsEjE,IApEEA,CAAAA,CAAqB,CAAA,CAAA,IAAA,CAErBC,CAAAA,aAAWC,+BAAAA,CAGd,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAGC,CAAAA,CAAAA,EAAQ,CAClC,GAAM,CAACC,CAAAA,CAAgBC,CAAiB,CAAA,CAAIC,6BAAAA,CAC1C,IAAA,CAAM,CAAA,CACN,KAAA,CAAO,CACT,CAAC,CAAA,CACKC,CAAAA,CAAUC,2BAAAA,IAA2B,CAAA,CAE3CC,8BAAAA,CAAU,CAAA,EAAM,CACd,IAAMC,CAAAA,CAAkB,CAAA,CAAA,EAAM,CAC5B,EAAA,CAAI,CAACH,CAAAA,CAAQ,OAAA,CAAS,MAAA,CAEtB,IAAMI,CAAAA,CAAYJ,CAAAA,CAAQ,OAAA,CAAQ,aAAA,CAChC,uBACF,CAAA,CAEA,EAAA,CAAII,CAAAA,CAAW,CACb,IAAMC,CAAAA,CAAWL,CAAAA,CAAQ,OAAA,CAAQ,qBAAA,CAAsB,CAAA,CACjDM,CAAAA,CAAUF,CAAAA,CAAU,qBAAA,CAAsB,CAAA,CAEhDN,CAAAA,CAAkB,CAChB,IAAA,CAAMQ,CAAAA,CAAQ,IAAA,CAAOD,CAAAA,CAAS,IAAA,CAC9B,KAAA,CAAOC,CAAAA,CAAQ,KACjB,CAAC,CACH,CACF,CAAA,CAEAH,CAAAA,CAAgB,CAAA,CAGhB,IAAMI,CAAAA,CAAW,IAAI,gBAAA,CAAiBJ,CAAe,CAAA,CAErD,OAAIH,CAAAA,CAAQ,OAAA,EACVO,CAAAA,CAAS,OAAA,CAAQP,CAAAA,CAAQ,OAAA,CAAS,CAChC,UAAA,CAAY,CAAA,CAAA,CACZ,eAAA,CAAiB,CAAC,YAAY,CAAA,CAC9B,OAAA,CAAS,CAAA,CACX,CAAC,CAAA,CAIH,MAAA,CAAO,gBAAA,CAAiB,QAAA,CAAUG,CAAe,CAAA,CAE1C,CAAA,CAAA,EAAM,CACXI,CAAAA,CAAS,UAAA,CAAW,CAAA,CACpB,MAAA,CAAO,mBAAA,CAAoB,QAAA,CAAUJ,CAAe,CACtD,CACF,CAAA,CAAG,CAAC,CAAC,CAAA,CAGL,IAAMK,CAAAA,CAAcC,gCAAAA,CACjBC,EAAgC,CAC7BV,CAAAA,CAA0D,OAAA,CAAUU,CAAAA,CAElE,OAAOd,CAAAA,EAAQ,UAAA,CACjBA,CAAAA,CAAIc,CAAI,CAAA,CACCd,CAAAA,EAAAA,CACPA,CAAAA,CAAsD,OAAA,CAAUc,CAAAA,CAEtE,CAAA,CACA,CAACd,CAAG,CACN,CAAA,CAEA,OACEe,8BAAAA,CAAe,CAAA,IAAA,CAAd,CACC,GAAA,CAAKH,CAAAA,CACL,SAAA,CAAWI,gCAAAA,uGACT,CACAlB,CACF,CAAA,CACC,GAAGC,CAAAA,CAGJ,QAAA,CAAA,CAAAkB,6BAAAA,MAAC,CAAA,CACC,SAAA,CAAU,yGAAA,CACV,KAAA,CAAO,CACL,IAAA,CAAM,CAAA,EAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-VBPIXXIA.js","sourcesContent":[null,"import * as TabsPrimitive from \"@radix-ui/react-tabs\"\n\nimport { cn } from \"@/lib/utils\"\nimport { forwardRef, useCallback, useEffect, useRef, useState } from \"react\"\n\nconst Tabs = TabsPrimitive.Root\n\nconst TabsList = forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const [indicatorStyle, setIndicatorStyle] = useState({\n left: 0,\n width: 0,\n })\n const listRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const updateIndicator = () => {\n if (!listRef.current) return\n\n const activeTab = listRef.current.querySelector(\n '[data-state=\"active\"]'\n ) as HTMLElement\n\n if (activeTab) {\n const listRect = listRef.current.getBoundingClientRect()\n const tabRect = activeTab.getBoundingClientRect()\n\n setIndicatorStyle({\n left: tabRect.left - listRect.left,\n width: tabRect.width,\n })\n }\n }\n\n updateIndicator()\n\n // Use MutationObserver to detect when data-state changes\n const observer = new MutationObserver(updateIndicator)\n\n if (listRef.current) {\n observer.observe(listRef.current, {\n attributes: true,\n attributeFilter: [\"data-state\"],\n subtree: true,\n })\n }\n\n // Also update on window resize\n window.addEventListener(\"resize\", updateIndicator)\n\n return () => {\n observer.disconnect()\n window.removeEventListener(\"resize\", updateIndicator)\n }\n }, [])\n\n // Combine refs\n const combinedRef = useCallback(\n (node: HTMLDivElement | null) => {\n ;(listRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n\n if (typeof ref === \"function\") {\n ref(node)\n } else if (ref) {\n ;(ref as React.MutableRefObject<HTMLDivElement | null>).current = node\n }\n },\n [ref]\n )\n\n return (\n <TabsPrimitive.List\n ref={combinedRef}\n className={cn(\n \"relative inline-flex items-center justify-center rounded-4xl bg-muted p-1 gap-1 text-muted-foreground\",\n className\n )}\n {...props}\n >\n {/* Animated indicator */}\n <span\n className=\"absolute h-[calc(100%-0.5rem)] rounded-4xl bg-background shadow-sm transition-all duration-200 ease-out\"\n style={{\n left: `${indicatorStyle.left}px`,\n width: `${indicatorStyle.width}px`,\n }}\n />\n {props.children}\n </TabsPrimitive.List>\n )\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"cursor-pointer relative inline-flex items-center justify-center whitespace-nowrap data-[state=inactive]:not-disabled:hover:bg-secondary rounded-4xl px-3 py-1 text-sm font-medium ring-offset-background transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=active]:text-foreground z-10\",\n className\n )}\n {...props}\n />\n))\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n className\n )}\n {...props}\n />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as o}from"./chunk-S5TKCF6T.mjs";import*as n from"react";import*as e from"@radix-ui/react-slider";import{jsx as l,jsxs as v}from"react/jsx-runtime";function b({className:s,defaultValue:i,value:r,min:t=0,max:a=100,...d}){let c=n.useMemo(()=>Array.isArray(r)?r:Array.isArray(i)?i:[t,a],[r,i,t,a]);return v(e.Root,{"data-slot":"slider",defaultValue:i,value:r,min:t,max:a,className:o("data-vertical:min-h-40 relative py-2 flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:w-auto data-vertical:flex-col",s),...d,children:[l(e.Track,{"data-slot":"slider-track",className:"bg-muted rounded-full h-1.5 w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1 relative grow overflow-hidden",children:l(e.Range,{"data-slot":"slider-range",className:"bg-accent absolute select-none h-full data-[orientation=vertical]:w-full"})}),Array.from({length:c.length},(f,m)=>l(e.Thumb,{"data-slot":"slider-thumb",className:"border-ring ring-ring/50 relative size-5 rounded-full border bg-primary-accent transition-[color,box-shadow] after:absolute after:-inset-2 hover:ring-[3px] focus-visible:ring-[3px] focus-visible:outline-hidden active:ring-[3px] block shrink-0 select-none disabled:pointer-events-none disabled:opacity-50"},m))]})}export{b as a};
|
|
3
|
+
//# sourceMappingURL=chunk-VGPTOLNX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/slider.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as SliderPrimitive from \"@radix-ui/react-slider\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Slider({\n className,\n defaultValue,\n value,\n min = 0,\n max = 100,\n ...props\n}: React.ComponentProps<typeof SliderPrimitive.Root>) {\n const _values = React.useMemo(\n () =>\n Array.isArray(value)\n ? value\n : Array.isArray(defaultValue)\n ? defaultValue\n : [min, max],\n [value, defaultValue, min, max]\n )\n\n return (\n <SliderPrimitive.Root\n data-slot=\"slider\"\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n className={cn(\n \"data-vertical:min-h-40 relative py-2 flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:w-auto data-vertical:flex-col\",\n className\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className=\"bg-muted rounded-full h-1.5 w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1 relative grow overflow-hidden\"\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"bg-accent absolute select-none h-full data-[orientation=vertical]:w-full\"\n />\n </SliderPrimitive.Track>\n {Array.from({ length: _values.length }, (_, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n key={index}\n className=\"border-ring ring-ring/50 relative size-5 rounded-full border bg-primary-accent transition-[color,box-shadow] after:absolute after:-inset-2 hover:ring-[3px] focus-visible:ring-[3px] focus-visible:outline-hidden active:ring-[3px] block shrink-0 select-none disabled:pointer-events-none disabled:opacity-50\"\n />\n ))}\n </SliderPrimitive.Root>\n )\n}\n\nexport { Slider }\n"],"mappings":";yCAEA,UAAYA,MAAW,QACvB,UAAYC,MAAqB,yBAuB7B,OAgBI,OAAAC,EAhBJ,QAAAC,MAAA,oBAnBJ,SAASC,EAAO,CACd,UAAAC,EACA,aAAAC,EACA,MAAAC,EACA,IAAAC,EAAM,EACN,IAAAC,EAAM,IACN,GAAGC,CACL,EAAsD,CACpD,IAAMC,EAAgB,UACpB,IACE,MAAM,QAAQJ,CAAK,EACfA,EACA,MAAM,QAAQD,CAAY,EACxBA,EACA,CAACE,EAAKC,CAAG,EACjB,CAACF,EAAOD,EAAcE,EAAKC,CAAG,CAChC,EAEA,OACEN,EAAiB,OAAhB,CACC,YAAU,SACV,aAAcG,EACd,MAAOC,EACP,IAAKC,EACL,IAAKC,EACL,UAAWG,EACT,iLACAP,CACF,EACC,GAAGK,EAEJ,UAAAR,EAAiB,QAAhB,CACC,YAAU,eACV,UAAU,sIAEV,SAAAA,EAAiB,QAAhB,CACC,YAAU,eACV,UAAU,2EACZ,EACF,EACC,MAAM,KAAK,CAAE,OAAQS,EAAQ,MAAO,EAAG,CAACE,EAAGC,IAC1CZ,EAAiB,QAAhB,CACC,YAAU,eAEV,UAAU,mTADLY,CAEP,CACD,GACH,CAEJ","names":["React","SliderPrimitive","jsx","jsxs","Slider","className","defaultValue","value","min","max","props","_values","cn","_","index"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/admin/Desktop/PROJECTS/alkimi-ui-kit/dist/chunk-WFD523CV.js","../src/components/PixelLoad.tsx"],"names":["isStaticImageData","src","getImageSrc","PixelLoad","alt","duration","steps","className","onAnimationComplete","objectFit","containerRef","useRef","canvasRef","status","setStatus","useState","dimensions","setDimensions","imageSrc","drawFull","useCallback","ctx","img","w","h","imgRatio","containerRatio","drawW","drawH","drawX","drawY","drawPixelated","pixelSize","sw","sh","runAnimation","minPixelSize","intervalMs","currentStep","animate","progress","useEffect","container","updateDimensions","width","height","resizeObserver","canvas","jsxs"],"mappings":"AAAA,ylBAAY;ACGZ,8BAA8D,+CAyM1D,SAzLKA,CAAAA,CAAkBC,CAAAA,CAAuC,CAChE,OAAO,OAAOA,CAAAA,EAAQ,QAAA,EAAY,KAAA,GAASA,CAC7C,CAEA,SAASC,CAAAA,CAAYD,CAAAA,CAAuB,CAC1C,OAAOD,CAAAA,CAAkBC,CAAG,CAAA,CAAIA,CAAAA,CAAI,GAAA,CAAMA,CAC5C,CAEO,SAASE,CAAAA,CAAU,CACxB,GAAA,CAAAF,CAAAA,CACA,GAAA,CAAAG,CAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,GAAA,CACX,KAAA,CAAAC,CAAAA,CAAQ,EAAA,CACR,SAAA,CAAAC,CAAAA,CACA,mBAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CAAY,OACd,CAAA,CAAgC,CAC9B,IAAMC,CAAAA,CAAeC,2BAAAA,IAA2B,CAAA,CAC1CC,CAAAA,CAAYD,2BAAAA,IAA8B,CAAA,CAC1C,CAACE,CAAAA,CAAQC,CAAS,CAAA,CAAIC,6BAAAA,SAAmC,CAAA,CACzD,CAACC,CAAAA,CAAYC,CAAa,CAAA,CAAIF,6BAAAA,IAGtB,CAAA,CAERG,CAAAA,CAAWhB,CAAAA,CAAYD,CAAG,CAAA,CAE1BkB,CAAAA,CAAWC,gCAAAA,CAEbC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAAAA,EACS,CACTH,CAAAA,CAAI,qBAAA,CAAwB,CAAA,CAAA,CAC5BA,CAAAA,CAAI,SAAA,CAAU,CAAA,CAAG,CAAA,CAAGE,CAAAA,CAAGC,CAAC,CAAA,CAExB,IAAMC,CAAAA,CAAWH,CAAAA,CAAI,YAAA,CAAeA,CAAAA,CAAI,aA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,EAA0BH,CAAAA,EAAa,EAAE,CAAA,CAAA","file":"/Users/admin/Desktop/PROJECTS/alkimi-ui-kit/dist/chunk-WFD523CV.js","sourcesContent":[null,"\"use client\"\n\nimport { type StaticImageData } from \"next/image\"\nimport { JSX, useCallback, useEffect, useRef, useState } from \"react\"\n\ntype PixelLoadStatus = \"loading\" | \"animating\" | \"complete\"\n\ntype ImageSrc = string | StaticImageData\n\nexport interface PixelLoadProps {\n src: ImageSrc\n alt: string\n duration?: number\n steps?: number\n className?: string\n onAnimationComplete?: () => void\n objectFit?: \"contain\" | \"cover\" | \"fill\" | \"none\" | \"scale-down\"\n}\n\nfunction isStaticImageData(src: ImageSrc): src is StaticImageData {\n return typeof src === \"object\" && \"src\" in src\n}\n\nfunction getImageSrc(src: ImageSrc): string {\n return isStaticImageData(src) ? src.src : src\n}\n\nexport function PixelLoad({\n src,\n alt,\n duration = 600,\n steps = 15,\n className,\n onAnimationComplete,\n objectFit = \"cover\",\n}: PixelLoadProps): JSX.Element {\n const containerRef = useRef<HTMLDivElement>(null)\n const canvasRef = useRef<HTMLCanvasElement>(null)\n const [status, setStatus] = useState<PixelLoadStatus>(\"loading\")\n const [dimensions, setDimensions] = useState<{\n width: number\n height: number\n } | null>(null)\n\n const imageSrc = getImageSrc(src)\n\n const drawFull = useCallback(\n (\n ctx: CanvasRenderingContext2D,\n img: HTMLImageElement,\n w: number,\n h: number\n ): void => {\n ctx.imageSmoothingEnabled = true\n ctx.clearRect(0, 0, w, h)\n\n const imgRatio = img.naturalWidth / img.naturalHeight\n const containerRatio = w / h\n\n let drawW: number\n let drawH: number\n let drawX: number\n let drawY: number\n\n if (objectFit === \"contain\") {\n if (imgRatio > containerRatio) {\n drawW = w\n drawH = w / imgRatio\n } else {\n drawH = h\n drawW = h * imgRatio\n }\n drawX = (w - drawW) / 2\n drawY = (h - drawH) / 2\n } else {\n if (imgRatio > containerRatio) {\n drawH = h\n drawW = h * imgRatio\n } else {\n drawW = w\n drawH = w / imgRatio\n }\n drawX = (w - drawW) / 2\n drawY = (h - drawH) / 2\n }\n\n ctx.drawImage(img, drawX, drawY, drawW, drawH)\n },\n [objectFit]\n )\n\n const drawPixelated = useCallback(\n (\n ctx: CanvasRenderingContext2D,\n img: HTMLImageElement,\n pixelSize: number,\n w: number,\n h: number\n ): void => {\n ctx.imageSmoothingEnabled = false\n\n const sw = Math.max(1, Math.floor(w / pixelSize))\n const sh = Math.max(1, Math.floor(h / pixelSize))\n\n ctx.clearRect(0, 0, w, h)\n ctx.drawImage(img, 0, 0, sw, sh)\n ctx.drawImage(canvasRef.current!, 0, 0, sw, sh, 0, 0, w, h)\n },\n []\n )\n\n const runAnimation = useCallback(\n (\n ctx: CanvasRenderingContext2D,\n img: HTMLImageElement,\n w: number,\n h: number\n ): void => {\n const minPixelSize = Math.max(w, h) / 4\n const intervalMs = duration / steps\n let currentStep = 0\n\n setStatus(\"animating\")\n\n const animate = (): void => {\n const progress = currentStep / steps\n const pixelSize = Math.max(1, Math.floor(minPixelSize * (1 - progress)))\n\n if (pixelSize <= 1) {\n drawFull(ctx, img, w, h)\n } else {\n drawPixelated(ctx, img, pixelSize, w, h)\n }\n\n currentStep++\n\n if (currentStep <= steps) {\n window.setTimeout(animate, intervalMs)\n } else {\n drawFull(ctx, img, w, h)\n setStatus(\"complete\")\n onAnimationComplete?.()\n }\n }\n\n animate()\n },\n [duration, steps, drawPixelated, drawFull, onAnimationComplete]\n )\n\n useEffect(() => {\n const container = containerRef.current\n if (!container) return\n\n const updateDimensions = (): void => {\n const { width, height } = container.getBoundingClientRect()\n setDimensions({ width: Math.floor(width), height: Math.floor(height) })\n }\n\n const resizeObserver = new ResizeObserver(updateDimensions)\n resizeObserver.observe(container)\n updateDimensions()\n\n return (): void => {\n resizeObserver.disconnect()\n }\n }, [])\n\n useEffect(() => {\n if (!dimensions) return\n\n if (dimensions.width <= 0 || dimensions.height <= 0) return\n\n const canvas = canvasRef.current\n if (!canvas) return\n\n const ctx = canvas.getContext(\"2d\")\n if (!ctx) return\n\n canvas.width = dimensions.width\n canvas.height = dimensions.height\n\n const img = new window.Image()\n img.crossOrigin = \"anonymous\"\n\n img.onload = (): void => {\n const minPixelSize = Math.max(dimensions.width, dimensions.height) / 4\n drawPixelated(ctx, img, minPixelSize, dimensions.width, dimensions.height)\n runAnimation(ctx, img, dimensions.width, dimensions.height)\n }\n\n img.onerror = (): void => {\n console.error(\"PixelLoad: Failed to load image\")\n }\n\n img.src = imageSrc\n\n return (): void => {\n img.onload = null\n img.onerror = null\n }\n }, [imageSrc, dimensions, runAnimation, drawPixelated])\n\n return (\n <div\n ref={containerRef}\n className={`relative w-full h-full ${className || \"\"}`}\n >\n <canvas\n ref={canvasRef}\n className=\"absolute top-0 left-0 w-full h-full\"\n style={{ objectFit }}\n role=\"img\"\n aria-label={alt}\n />\n {status === \"complete\" && (\n <img\n src={imageSrc}\n alt={alt}\n className=\"sr-only\"\n aria-hidden\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-WFD523CV.js","../src/components/PixelLoad.tsx"],"names":["isStaticImageData","src","getImageSrc","PixelLoad","alt","duration","steps","className","onAnimationComplete","objectFit","containerRef","useRef","canvasRef","status","setStatus","useState","dimensions","setDimensions","imageSrc","drawFull","useCallback","ctx","img","w","h","imgRatio","containerRatio","drawW","drawH","drawX","drawY","drawPixelated","pixelSize","sw","sh","runAnimation","minPixelSize","intervalMs","currentStep","animate","progress","useEffect","container","updateDimensions","width","height","resizeObserver","canvas","jsxs"],"mappings":"AAAA,ylBAAY;ACGZ,8BAA8D,+CAyM1D,SAzLKA,CAAAA,CAAkBC,CAAAA,CAAuC,CAChE,OAAO,OAAOA,CAAAA,EAAQ,QAAA,EAAY,KAAA,GAASA,CAC7C,CAEA,SAASC,CAAAA,CAAYD,CAAAA,CAAuB,CAC1C,OAAOD,CAAAA,CAAkBC,CAAG,CAAA,CAAIA,CAAAA,CA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CACvB,OAAAA,CAAAA,CAAI,WAAA,CAAc,WAAA,CAElBA,CAAAA,CAAI,MAAA,CAAS,CAAA,CAAA,EAAY,CACvB,IAAMc,CAAAA,CAAe,IAAA,CAAK,GAAA,CAAIpB,CAAAA,CAAW,KAAA,CAAOA,CAAAA,CAAW,MAAM,CAAA,CAAI,CAAA,CACrEe,CAAAA,CAAcV,CAAAA,CAAKC,CAAAA,CAAKc,CAAAA,CAAcpB,CAAAA,CAAW,KAAA,CAAOA,CAAAA,CAAW,MAAM,CAAA,CACzEmB,CAAAA,CAAad,CAAAA,CAAKC,CAAAA,CAAKN,CAAAA,CAAW,KAAA,CAAOA,CAAAA,CAAW,MAAM,CAC5D,CAAA,CAEAM,CAAAA,CAAI,OAAA,CAAU,CAAA,CAAA,EAAY,CACxB,OAAA,CAAQ,KAAA,CAAM,iCAAiC,CACjD,CAAA,CAEAA,CAAAA,CAAI,GAAA,CAAMJ,CAAAA,CAEH,CAAA,CAAA,EAAY,CACjBI,CAAAA,CAAI,MAAA,CAAS,IAAA,CACbA,CAAAA,CAAI,OAAA,CAAU,IAChB,CACF,CAAA,CAAG,CAACJ,CAAAA,CAAUF,CAAAA,CAAYmB,CAAAA,CAAcJ,CAAa,CAAC,CAAA,CAGpDiB,8BAAAA,KAAC,CAAA,CACC,GAAA,CAAKtC,CAAAA,CACL,SAAA,CAAW,CAAA,uBAAA,EAA0BH,CAAAA,EAAa,EAAE,CAAA,CAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-WFD523CV.js","sourcesContent":[null,"\"use client\"\n\nimport { type StaticImageData } from \"next/image\"\nimport { JSX, useCallback, useEffect, useRef, useState } from \"react\"\n\ntype PixelLoadStatus = \"loading\" | \"animating\" | \"complete\"\n\ntype ImageSrc = string | StaticImageData\n\nexport interface PixelLoadProps {\n src: ImageSrc\n alt: string\n duration?: number\n steps?: number\n className?: string\n onAnimationComplete?: () => void\n objectFit?: \"contain\" | \"cover\" | \"fill\" | \"none\" | \"scale-down\"\n}\n\nfunction isStaticImageData(src: ImageSrc): src is StaticImageData {\n return typeof src === \"object\" && \"src\" in src\n}\n\nfunction getImageSrc(src: ImageSrc): string {\n return isStaticImageData(src) ? src.src : src\n}\n\nexport function PixelLoad({\n src,\n alt,\n duration = 600,\n steps = 15,\n className,\n onAnimationComplete,\n objectFit = \"cover\",\n}: PixelLoadProps): JSX.Element {\n const containerRef = useRef<HTMLDivElement>(null)\n const canvasRef = useRef<HTMLCanvasElement>(null)\n const [status, setStatus] = useState<PixelLoadStatus>(\"loading\")\n const [dimensions, setDimensions] = useState<{\n width: number\n height: number\n } | null>(null)\n\n const imageSrc = getImageSrc(src)\n\n const drawFull = useCallback(\n (\n ctx: CanvasRenderingContext2D,\n img: HTMLImageElement,\n w: number,\n h: number\n ): void => {\n ctx.imageSmoothingEnabled = true\n ctx.clearRect(0, 0, w, h)\n\n const imgRatio = img.naturalWidth / img.naturalHeight\n const containerRatio = w / h\n\n let drawW: number\n let drawH: number\n let drawX: number\n let drawY: number\n\n if (objectFit === \"contain\") {\n if (imgRatio > containerRatio) {\n drawW = w\n drawH = w / imgRatio\n } else {\n drawH = h\n drawW = h * imgRatio\n }\n drawX = (w - drawW) / 2\n drawY = (h - drawH) / 2\n } else {\n if (imgRatio > containerRatio) {\n drawH = h\n drawW = h * imgRatio\n } else {\n drawW = w\n drawH = w / imgRatio\n }\n drawX = (w - drawW) / 2\n drawY = (h - drawH) / 2\n }\n\n ctx.drawImage(img, drawX, drawY, drawW, drawH)\n },\n [objectFit]\n )\n\n const drawPixelated = useCallback(\n (\n ctx: CanvasRenderingContext2D,\n img: HTMLImageElement,\n pixelSize: number,\n w: number,\n h: number\n ): void => {\n ctx.imageSmoothingEnabled = false\n\n const sw = Math.max(1, Math.floor(w / pixelSize))\n const sh = Math.max(1, Math.floor(h / pixelSize))\n\n ctx.clearRect(0, 0, w, h)\n ctx.drawImage(img, 0, 0, sw, sh)\n ctx.drawImage(canvasRef.current!, 0, 0, sw, sh, 0, 0, w, h)\n },\n []\n )\n\n const runAnimation = useCallback(\n (\n ctx: CanvasRenderingContext2D,\n img: HTMLImageElement,\n w: number,\n h: number\n ): void => {\n const minPixelSize = Math.max(w, h) / 4\n const intervalMs = duration / steps\n let currentStep = 0\n\n setStatus(\"animating\")\n\n const animate = (): void => {\n const progress = currentStep / steps\n const pixelSize = Math.max(1, Math.floor(minPixelSize * (1 - progress)))\n\n if (pixelSize <= 1) {\n drawFull(ctx, img, w, h)\n } else {\n drawPixelated(ctx, img, pixelSize, w, h)\n }\n\n currentStep++\n\n if (currentStep <= steps) {\n window.setTimeout(animate, intervalMs)\n } else {\n drawFull(ctx, img, w, h)\n setStatus(\"complete\")\n onAnimationComplete?.()\n }\n }\n\n animate()\n },\n [duration, steps, drawPixelated, drawFull, onAnimationComplete]\n )\n\n useEffect(() => {\n const container = containerRef.current\n if (!container) return\n\n const updateDimensions = (): void => {\n const { width, height } = container.getBoundingClientRect()\n setDimensions({ width: Math.floor(width), height: Math.floor(height) })\n }\n\n const resizeObserver = new ResizeObserver(updateDimensions)\n resizeObserver.observe(container)\n updateDimensions()\n\n return (): void => {\n resizeObserver.disconnect()\n }\n }, [])\n\n useEffect(() => {\n if (!dimensions) return\n\n if (dimensions.width <= 0 || dimensions.height <= 0) return\n\n const canvas = canvasRef.current\n if (!canvas) return\n\n const ctx = canvas.getContext(\"2d\")\n if (!ctx) return\n\n canvas.width = dimensions.width\n canvas.height = dimensions.height\n\n const img = new window.Image()\n img.crossOrigin = \"anonymous\"\n\n img.onload = (): void => {\n const minPixelSize = Math.max(dimensions.width, dimensions.height) / 4\n drawPixelated(ctx, img, minPixelSize, dimensions.width, dimensions.height)\n runAnimation(ctx, img, dimensions.width, dimensions.height)\n }\n\n img.onerror = (): void => {\n console.error(\"PixelLoad: Failed to load image\")\n }\n\n img.src = imageSrc\n\n return (): void => {\n img.onload = null\n img.onerror = null\n }\n }, [imageSrc, dimensions, runAnimation, drawPixelated])\n\n return (\n <div\n ref={containerRef}\n className={`relative w-full h-full ${className || \"\"}`}\n >\n <canvas\n ref={canvasRef}\n className=\"absolute top-0 left-0 w-full h-full\"\n style={{ objectFit }}\n role=\"img\"\n aria-label={alt}\n />\n {status === \"complete\" && (\n <img\n src={imageSrc}\n alt={alt}\n className=\"sr-only\"\n aria-hidden\n />\n )}\n </div>\n )\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-WYRD4UAK.js","../src/components/checkbox.tsx"],"names":["Checkbox","className","props","ref","jsx","cn","jsxs","Check","Minus"],"mappings":"AAAA,uWAAY;AACZ,sDAAuC,uECChB,0GACY,2CACN,+CAgBzB,IAZEA,CAAAA,CAAiB,CAAA,CAAA,UAAA,CAGrB,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAGC,CAAAA,CAAAA,EAC1BC,6BAAAA,CAAmB,CAAA,IAAA,CAAlB,CACC,GAAA,CAAKD,CAAAA,CACL,SAAA,CAAWE,gCAAAA,8fACT,CACAJ,CACF,CAAA,CACC,GAAGC,CAAAA,CAEJ,QAAA,CAAAI,8BAAAA,CAAmB,CAAA,SAAA,CAAlB,CACC,SAAA,CAAWD,gCAAAA,+CAAkD,CAAA,CAE7D,QAAA,CAAA,CAAAD,6BAAAA,kBAACG,CAAA,CAAM,SAAA,CAAU,iDAAA,CAAkD,CAAA,CACnEH,6BAAAA,kBAACI,CAAA,CAAM,SAAA,CAAU,uDAAA,CAAwD,CAAA,CAAA,CAC3E,CAAA,CACF,CACD,CAAA,CACDR,CAAAA,CAAS,WAAA,CAAgC,CAAA,CAAA,IAAA,CAAK,WAAA,CAAA,cAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-WYRD4UAK.js","sourcesContent":[null,"\"use client\"\n\nimport * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { Check, Minus } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"group peer h-4 w-4 bg-background shrink-0 rounded-xs border border-accent-muted ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-accent data-[state=checked]:border-accent data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-accent data-[state=indeterminate]:border-accent data-[state=indeterminate]:text-primary-foreground\",\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n className={cn(\"flex items-center justify-center text-current\")}\n >\n <Check className=\"h-4 w-4 group-data-[state=indeterminate]:hidden\" />\n <Minus className=\"h-4 w-4 hidden group-data-[state=indeterminate]:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n))\nCheckbox.displayName = CheckboxPrimitive.Root.displayName\n\nexport { Checkbox }\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
var
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
var _chunkIJVB2BVOjs = require('./chunk-IJVB2BVO.js');var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var n = _interopRequireWildcard(_react);var _lucidereact = require('lucide-react');var _jsxruntime = require('react/jsx-runtime');var H=n.forwardRef(({accept:o,maxSize:s,multiple:f=!1,onFilesChange:m,error:h,disabled:l,className:D,description:g},y)=>{let[F,d]=n.useState(!1),[i,v]=n.useState([]),c=n.useRef(null),R=e=>{e.preventDefault(),e.stopPropagation(),l||d(!0)},C=e=>{e.preventDefault(),e.stopPropagation(),d(!1)},E=e=>{e.preventDefault(),e.stopPropagation()},U=e=>!(s&&e.size>s),x=e=>{if(!e)return;let t=Array.from(e).filter(U),u=f?[...i,...t]:t.slice(0,1);v(u),_optionalChain([m, 'optionalCall', _ => _(u)])},k=e=>{e.preventDefault(),e.stopPropagation(),d(!1),!l&&x(e.dataTransfer.files)},w=()=>{l||_optionalChain([c, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.click, 'call', _4 => _4()])},L=e=>{x(e.target.files),c.current&&(c.current.value="")},M=e=>{let t=i.filter((u,$)=>$!==e);v(t),_optionalChain([m, 'optionalCall', _5 => _5(t)])},b=e=>e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`,P=e=>e.split(",").map(t=>t.trim()).map(t=>t.includes("/*")?t.replace("/*","").toUpperCase():t.startsWith(".")?t.slice(1).toUpperCase():t.includes("/")?t.split("/")[1].toUpperCase():t.toUpperCase());return _jsxruntime.jsxs.call(void 0, "div",{ref:y,className:_chunkFUYXCJOQjs.a.call(void 0, "w-full",D),children:[_jsxruntime.jsxs.call(void 0, "div",{onClick:w,onDragEnter:R,onDragLeave:C,onDragOver:E,onDrop:k,className:_chunkFUYXCJOQjs.a.call(void 0, "flex my-2 flex-col items-center justify-center gap-3 rounded-lg border border-border bg-background px-6 py-4 text-center transition-all cursor-pointer active:opacity-50",F&&"bg-secondary",h?"border-destructive-foreground":"border-border hover:bg-secondary",l&&"cursor-not-allowed opacity-50"),children:[_jsxruntime.jsx.call(void 0, "span",{className:_chunkIJVB2BVOjs.a.call(void 0, {variant:"outline",size:"icon"}),children:_jsxruntime.jsx.call(void 0, _lucidereact.Upload,{size:16,className:_chunkFUYXCJOQjs.a.call(void 0, "text-primary-accent")})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsxs.call(void 0, "p",{className:"text-sm text-secondary-text",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-primary-accent",children:"Click to upload"})," or drag and drop"]}),(o||s)&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs text-secondary-text",children:[o&&P(o).join(", "),o&&s&&" ",s&&`up to ${b(s)}`]}),g&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-secondary-text",children:g})]})]}),_jsxruntime.jsx.call(void 0, "input",{ref:c,type:"file",accept:o,multiple:f,onChange:L,disabled:l,className:"hidden"}),i.length>0&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-3 space-y-2",children:i.map((e,t)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between rounded-2xl border border-border bg-background px-4 py-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _lucidereact.File,{className:"h-5 w-5 text-secondary-text"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm text-primary-accent truncate max-w-[200px]",children:e.name}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs text-secondary-text",children:b(e.size)})]})]}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>M(t),className:"rounded-full p-1 hover:bg-secondary active:opacity-50 transition-colors",children:_jsxruntime.jsx.call(void 0, _lucidereact.X,{className:"h-4 w-4 text-secondary-text"})})]},`${e.name}-${t}`))})]})});H.displayName="FileUpload";exports.a = H;
|
|
3
|
+
//# sourceMappingURL=chunk-XUVA7BXG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-XUVA7BXG.js","../src/components/file-upload.tsx"],"names":["FileUpload","accept","maxSize","multiple","onFilesChange","error","disabled","className","description","ref","isDragging","setIsDragging","files","setFiles","inputRef","handleDragEnter","handleDragLeave","handleDragOver","validateFile","file","handleFiles","newFiles","validFiles","updatedFiles","handleDrop","handleClick","handleInputChange","removeFile","index","_","i","formatFileSize","bytes"],"mappings":"AAAA,22BAAY;AACZ,sDAAuC,sDAAwC,uECDxD,2CACS,+CA0JpB,IAhINA,CAAAA,CAAmB,CAAA,CAAA,UAAA,CACvB,CACE,CACE,MAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,CAAA,CAAA,CACX,aAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAA,CACAC,CAAAA,CAAAA,EACG,CACH,GAAM,CAACC,CAAAA,CAAYC,CAAa,CAAA,CAAU,CAAA,CAAA,QAAA,CAAS,CAAA,CAAK,CAAA,CAClD,CAACC,CAAAA,CAAOC,CAAQ,CAAA,CAAU,CAAA,CAAA,QAAA,CAAiB,CAAC,CAAC,CAAA,CAC7CC,CAAAA,CAAiB,CAAA,CAAA,MAAA,CAAyB,IAAI,CAAA,CAE9CC,CAAAA,CAAmB,CAAA,EAAuB,CAC9C,CAAA,CAAE,cAAA,CAAe,CAAA,CACjB,CAAA,CAAE,eAAA,CAAgB,CAAA,CACbT,CAAAA,EAAUK,CAAAA,CAAc,CAAA,CAAI,CAC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,CAAAA,CAAS,OAAA,EAAA,CAASA,CAAAA,CAAS,OAAA,CAAQ,KAAA,CAAQ,EAAA,CACjD,CAAA,CAEMa,CAAAA,CAAcC,CAAAA,EAAkB,CACpC,IAAML,CAAAA,CAAeX,CAAAA,CAAM,MAAA,CAAO,CAACiB,CAAAA,CAAGC,CAAAA,CAAAA,EAAMA,CAAAA,GAAMF,CAAK,CAAA,CACvDf,CAAAA,CAASU,CAAY,CAAA,iBACrBnB,CAAAA,0BAAAA,CAAgBmB,CAAY,GAC9B,CAAA,CAEMQ,CAAAA,CAAkBC,CAAAA,EAClBA,CAAAA,CAAQ,IAAA,CAAa,CAAA,EAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-XUVA7BXG.js","sourcesContent":[null,"import * as React from \"react\"\nimport { Upload, X, File } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"./button\"\n\nexport interface FileUploadProps {\n /** Accepted file formats (e.g., \".png,.jpg,.pdf\" or \"image/*\") */\n accept?: string\n /** Maximum file size in bytes */\n maxSize?: number\n /** Allow multiple files */\n multiple?: boolean\n /** Callback when files are selected */\n onFilesChange?: (files: File[]) => void\n /** Error state */\n error?: boolean\n /** Disabled state */\n disabled?: boolean\n /** Custom class name */\n className?: string\n /** Placeholder text */\n placeholder?: string\n /** Description text (e.g., \"PNG, JPG up to 10MB\") */\n description?: string\n}\n\nconst FileUpload = React.forwardRef<HTMLDivElement, FileUploadProps>(\n (\n {\n accept,\n maxSize,\n multiple = false,\n onFilesChange,\n error,\n disabled,\n className,\n description,\n },\n ref\n ) => {\n const [isDragging, setIsDragging] = React.useState(false)\n const [files, setFiles] = React.useState<File[]>([])\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n const handleDragEnter = (e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n if (!disabled) setIsDragging(true)\n }\n\n const handleDragLeave = (e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragging(false)\n }\n\n const handleDragOver = (e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n }\n\n const validateFile = (file: File): boolean => {\n if (maxSize && file.size > maxSize) {\n return false\n }\n return true\n }\n\n const handleFiles = (newFiles: FileList | null) => {\n if (!newFiles) return\n\n const validFiles = Array.from(newFiles).filter(validateFile)\n const updatedFiles = multiple\n ? [...files, ...validFiles]\n : validFiles.slice(0, 1)\n\n setFiles(updatedFiles)\n onFilesChange?.(updatedFiles)\n }\n\n const handleDrop = (e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragging(false)\n\n if (disabled) return\n handleFiles(e.dataTransfer.files)\n }\n\n const handleClick = () => {\n if (!disabled) inputRef.current?.click()\n }\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n handleFiles(e.target.files)\n if (inputRef.current) inputRef.current.value = \"\"\n }\n\n const removeFile = (index: number) => {\n const updatedFiles = files.filter((_, i) => i !== index)\n setFiles(updatedFiles)\n onFilesChange?.(updatedFiles)\n }\n\n const formatFileSize = (bytes: number): string => {\n if (bytes < 1024) return `${bytes} B`\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`\n return `${Math.round(bytes / (1024 * 1024))} MB`\n }\n\n const formatAcceptedTypes = (acceptStr: string): string[] => {\n return acceptStr\n .split(\",\")\n .map((type) => type.trim())\n .map((type) => {\n // Handle wildcards like \"image/*\"\n if (type.includes(\"/*\")) {\n return type.replace(\"/*\", \"\").toUpperCase()\n }\n // Handle extensions like \".png\"\n if (type.startsWith(\".\")) {\n return type.slice(1).toUpperCase()\n }\n // Handle MIME types like \"image/png\"\n if (type.includes(\"/\")) {\n return type.split(\"/\")[1].toUpperCase()\n }\n return type.toUpperCase()\n })\n }\n\n return (\n <div ref={ref} className={cn(\"w-full\", className)}>\n <div\n onClick={handleClick}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n className={cn(\n \"flex my-2 flex-col items-center justify-center gap-3 rounded-lg border border-border bg-background px-6 py-4 text-center transition-all cursor-pointer active:opacity-50\",\n isDragging && \"bg-secondary\",\n error\n ? \"border-destructive-foreground\"\n : \"border-border hover:bg-secondary\",\n disabled && \"cursor-not-allowed opacity-50\"\n )}\n >\n <span\n className={buttonVariants({\n variant: \"outline\",\n size: \"icon\",\n })}\n >\n <Upload size={16} className={cn(\"text-primary-accent\")} />\n </span>\n\n <div className=\"flex flex-col gap-1\">\n <p className=\"text-sm text-secondary-text\">\n <span className=\"text-primary-accent\">Click to upload</span> or\n drag and drop\n </p>\n {(accept || maxSize) && (\n <p className=\"text-xs text-secondary-text\">\n {accept && formatAcceptedTypes(accept).join(\", \")}\n {accept && maxSize && \" \"}\n {maxSize && `up to ${formatFileSize(maxSize)}`}\n </p>\n )}\n {description && (\n <p className=\"text-xs text-secondary-text\">{description}</p>\n )}\n </div>\n </div>\n\n <input\n ref={inputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleInputChange}\n disabled={disabled}\n className=\"hidden\"\n />\n\n {files.length > 0 && (\n <div className=\"mt-3 space-y-2\">\n {files.map((file, index) => (\n <div\n key={`${file.name}-${index}`}\n className=\"flex items-center justify-between rounded-2xl border border-border bg-background px-4 py-2\"\n >\n <div className=\"flex items-center gap-3\">\n <File className=\"h-5 w-5 text-secondary-text\" />\n <div className=\"flex flex-col\">\n <span className=\"text-sm text-primary-accent truncate max-w-[200px]\">\n {file.name}\n </span>\n <span className=\"text-xs text-secondary-text\">\n {formatFileSize(file.size)}\n </span>\n </div>\n </div>\n <button\n type=\"button\"\n onClick={() => removeFile(index)}\n className=\"rounded-full p-1 hover:bg-secondary active:opacity-50 transition-colors\"\n >\n <X className=\"h-4 w-4 text-secondary-text\" />\n </button>\n </div>\n ))}\n </div>\n )}\n </div>\n )\n }\n)\nFileUpload.displayName = \"FileUpload\"\n\nexport { FileUpload }\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
|
|
2
|
+
var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var r = _interopRequireWildcard(_react);var _jsxruntime = require('react/jsx-runtime');var l=r.forwardRef(({className:t,type:o,error:n,...i},s)=>_jsxruntime.jsx.call(void 0, "input",{type:o,className:_chunkFUYXCJOQjs.a.call(void 0, "flex my-2 h-8 lg:h-9 w-full rounded-3xl border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-secondary-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n?"border-destructive-foreground focus-visible:ring-destructive-foreground":"border-border",t),ref:s,...i}));l.displayName="Input";exports.a = l;
|
|
3
|
+
//# sourceMappingURL=chunk-XVF3OJWZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-XVF3OJWZ.js","../src/components/input.tsx"],"names":["Input","className","type","error","props","ref","jsx","cn"],"mappings":"AAAA,uWAAY;AACZ,sDAAuC,uECDhB,+CAWjB,IAHAA,CAAAA,CAAc,CAAA,CAAA,UAAA,CAClB,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,IAAA,CAAAC,CAAAA,CAAM,KAAA,CAAAC,CAAAA,CAAO,GAAGC,CAAM,CAAA,CAAGC,CAAAA,CAAAA,EAEnCC,6BAAAA,OAAC,CAAA,CACC,IAAA,CAAMJ,CAAAA,CACN,SAAA,CAAWK,gCAAAA,kYACT,CACAJ,CAAAA,CACI,yEAAA,CACA,eAAA,CACJF,CACF,CAAA,CACA,GAAA,CAAKI,CAAAA,CACJ,GAAGD,CAAAA,CACN,CAGN,CAAA,CACAJ,CAAAA,CAAM,WAAA,CAAc,OAAA,CAAA,cAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-XVF3OJWZ.js","sourcesContent":[null,"import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n error?: boolean\n}\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, error, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex my-2 h-8 lg:h-9 w-full rounded-3xl border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-secondary-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n error\n ? \"border-destructive-foreground focus-visible:ring-destructive-foreground\"\n : \"border-border\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as o}from"./chunk-S5TKCF6T.mjs";import*as t from"react";import*as r from"@radix-ui/react-progress";import{jsx as e}from"react/jsx-runtime";var f=t.forwardRef(({className:i,value:s,color:a,...l},m)=>e(r.Root,{ref:m,className:o("relative h-2 w-full overflow-hidden rounded-full bg-progress-bg",i),...l,children:e(r.Indicator,{className:"h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(s||0)}%)`,backgroundColor:a??"var(--accent)"}})}));f.displayName=r.Root.displayName;export{f as a};
|
|
3
|
+
//# sourceMappingURL=chunk-XY6RUEAT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/progress.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {\n color?: string\n }\n>(({ className, value, color, ...props }, ref) => (\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\n \"relative h-2 w-full overflow-hidden rounded-full bg-progress-bg\",\n className\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className=\"h-full w-full flex-1 transition-all\"\n style={{\n transform: `translateX(-${100 - (value || 0)}%)`,\n backgroundColor: color ?? \"var(--accent)\",\n }}\n />\n </ProgressPrimitive.Root>\n))\nProgress.displayName = ProgressPrimitive.Root.displayName\n\nexport { Progress }\n"],"mappings":";yCAEA,UAAYA,MAAW,QACvB,UAAYC,MAAuB,2BAkB/B,cAAAC,MAAA,oBAdJ,IAAMC,EAAiB,aAKrB,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAO,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IACxCN,EAAmB,OAAlB,CACC,IAAKM,EACL,UAAWC,EACT,kEACAL,CACF,EACC,GAAGG,EAEJ,SAAAL,EAAmB,YAAlB,CACC,UAAU,sCACV,MAAO,CACL,UAAW,eAAe,KAAOG,GAAS,EAAE,KAC5C,gBAAiBC,GAAS,eAC5B,EACF,EACF,CACD,EACDH,EAAS,YAAgC,OAAK","names":["React","ProgressPrimitive","jsx","Progress","className","value","color","props","ref","cn"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-XYO4VLMF.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-XYO4VLMF.js"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
var _chunkWYRD4UAKjs = require('./chunk-WYRD4UAK.js');var _chunkULIOO55Ijs = require('./chunk-ULIOO55I.js');var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var i = _interopRequireWildcard(_react);var _lucidereact = require('lucide-react');var _jsxruntime = require('react/jsx-runtime');function M(e){let n=[e.value];if(e.children)for(let a of e.children)n.push(...M(a));return n}function $(e,n){if(!e.children||e.children.length===0)return n.has(e.value)?"checked":"unchecked";let a=M(e),r=a.filter(l=>n.has(l)).length;return r===0?"unchecked":r===a.length?"checked":"indeterminate"}function J(e,n){let a=n.toLowerCase().trim();if(!a)return e;let r=[];for(let l of e){let f=l.label.toLowerCase().includes(a);if(l.children&&l.children.length>0){let h=J(l.children,n);f?r.push(l):h&&h.length>0&&r.push({...l,children:h})}else f&&r.push(l)}return r.length>0?r:null}function le(e,n){let a=n.toLowerCase().trim(),r=new Set;function l(f){let h=!1;for(let g of f){let w=g.label.toLowerCase().includes(a),S=!1;g.children&&(S=l(g.children)),(w||S)&&(r.add(g.value),h=!0)}return h}return l(e),r}function N(e,n){for(let a of e){if(a.value===n)return a;if(a.children){let r=N(a.children,n);if(r)return r}}}function Q(e){let n=new Set;for(let a of e)if(a.children&&a.children.length>0){n.add(a.value);for(let r of Q(a.children))n.add(r)}return n}function oe(e,n){if(!n)return e;let a=n.toLowerCase().trim();if(!a)return e;let r=e.toLowerCase().indexOf(a);return r===-1?e:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e.slice(0,r),_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold underline",children:e.slice(r,r+a.length)}),e.slice(r+a.length)]})}function W({node:e,depth:n,multiple:a,selectedSet:r,expandedValues:l,focusedValue:f,onToggleExpand:h,onSelect:g,onFocus:w,searchTerm:S}){let V=e.children&&e.children.length>0,y=l.has(e.value),v=a?$(e,r):r.has(e.value)?"checked":"unchecked",A=n*20;return _jsxruntime.jsxs.call(void 0, "div",{role:"treeitem","aria-expanded":V?y:void 0,"aria-selected":v==="checked",children:[_jsxruntime.jsxs.call(void 0, "div",{className:_chunkFUYXCJOQjs.a.call(void 0, "relative flex items-center gap-2 rounded-sm px-2 py-1.5 my-0.5 text-sm cursor-pointer select-none outline-none active:opacity-50","hover:bg-muted",v==="checked"&&!a&&"bg-muted"),style:{paddingLeft:`${8+A}px`},onClick:()=>g(e),onFocus:()=>w(e.value),"data-tree-value":e.value,tabIndex:f===e.value?0:-1,children:[V?_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"h-4 w-4 shrink-0 flex items-center justify-center rounded-sm hover:bg-secondary active:opacity-50",onClick:m=>{m.stopPropagation(),h(e.value)},"aria-label":y?`Collapse ${e.label}`:`Expand ${e.label}`,tabIndex:-1,children:y?_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown,{className:"h-3.5 w-3.5"}):_jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight,{className:"h-3.5 w-3.5"})}):_jsxruntime.jsx.call(void 0, "span",{className:"h-4 w-4 shrink-0"}),a?_jsxruntime.jsx.call(void 0, _chunkWYRD4UAKjs.a,{checked:v==="checked"?!0:v==="indeterminate"?"indeterminate":!1,onCheckedChange:()=>g(e),onClick:m=>m.stopPropagation(),className:"shrink-0","aria-label":e.label}):_jsxruntime.jsx.call(void 0, _lucidereact.Check,{className:_chunkFUYXCJOQjs.a.call(void 0, "h-4 w-4 shrink-0",v==="checked"?"opacity-100":"opacity-0")}),_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:oe(e.label,S)})]}),V&&y&&_jsxruntime.jsx.call(void 0, "div",{role:"group",children:e.children.map(m=>_jsxruntime.jsx.call(void 0, W,{node:m,depth:n+1,multiple:a,selectedSet:r,expandedValues:l,focusedValue:f,onToggleExpand:h,onSelect:g,onFocus:w,searchTerm:S},m.value))})]})}function ge({nodes:e,value:n,onValueChange:a,multiple:r=!1,values:l=[],onValuesChange:f,placeholder:h="Select...",searchPlaceholder:g="Search...",emptyMessage:w="No results found.",disabled:S=!1,className:V,error:y=!1,defaultExpandedValues:v,expandAll:A=!1}){let[m,B]=i.useState(!1),[b,K]=i.useState(""),[p,k]=i.useState(null),[D,L]=i.useState(()=>A?Q(e):v?new Set(v):new Set),P=i.useRef(null),I=i.useRef(null),C=i.useMemo(()=>new Set(r?l:n?[n]:[]),[r,l,n]),F=i.useMemo(()=>b?J(e,b):e,[e,b]);i.useEffect(()=>{if(b){P.current||(P.current=new Set(D));let t=le(e,b);L(t)}else P.current&&(L(P.current),P.current=null)},[b,e]);let Y=i.useCallback(t=>{B(t),t||(K(""),k(null))},[]),T=i.useCallback(t=>{L(s=>{let d=new Set(s);return d.has(t)?d.delete(t):d.add(t),d})},[]),H=i.useCallback(t=>{if(r){let s=M(t),d=$(t,C),c;if(d==="checked"){let u=new Set(s);c=l.filter(R=>!u.has(R))}else{let u=s.filter(R=>!C.has(R));c=[...l,...u]}_optionalChain([f, 'optionalCall', _2 => _2(c)])}else{if(t.children&&t.children.length>0){T(t.value);return}let d=t.value===n?"":t.value;_optionalChain([a, 'optionalCall', _3 => _3(d)]),B(!1)}},[r,l,n,C,f,a,T]),Z=i.useCallback((t,s)=>{s.preventDefault(),s.stopPropagation();let d=N(e,t);if(d){let c=new Set(M(d)),u=l.filter(R=>!c.has(R));_optionalChain([f, 'optionalCall', _4 => _4(u)])}},[e,l,f]),q=i.useMemo(()=>{if(!r)return[];let t=[];function s(d){for(let c of d){let u=$(c,C);u==="checked"?t.push(c.value):u==="indeterminate"&&c.children&&s(c.children)}}return s(e),t},[e,C,r]),O=i.useCallback(()=>I.current?Array.from(I.current.querySelectorAll("[data-tree-value]")):[],[]),_=i.useCallback(t=>{let s=O(),d=s.findIndex(c=>c.dataset.treeValue===p);switch(t.key){case"ArrowDown":{t.preventDefault();let c=Math.min(d+1,s.length-1),u=_optionalChain([s, 'access', _5 => _5[c], 'optionalAccess', _6 => _6.dataset, 'access', _7 => _7.treeValue]);u&&(k(u),_optionalChain([s, 'access', _8 => _8[c], 'optionalAccess', _9 => _9.focus, 'call', _10 => _10()]));break}case"ArrowUp":{t.preventDefault();let c=Math.max(d-1,0),u=_optionalChain([s, 'access', _11 => _11[c], 'optionalAccess', _12 => _12.dataset, 'access', _13 => _13.treeValue]);u&&(k(u),_optionalChain([s, 'access', _14 => _14[c], 'optionalAccess', _15 => _15.focus, 'call', _16 => _16()]));break}case"ArrowRight":{if(t.preventDefault(),p){let c=N(e,p);if(_optionalChain([c, 'optionalAccess', _17 => _17.children, 'optionalAccess', _18 => _18.length]))if(!D.has(p))T(p);else{let u=c.children[0].value;k(u),requestAnimationFrame(()=>{_optionalChain([O, 'call', _19 => _19(), 'access', _20 => _20.find, 'call', _21 => _21(re=>re.dataset.treeValue===u), 'optionalAccess', _22 => _22.focus, 'call', _23 => _23()])})}}break}case"ArrowLeft":{t.preventDefault(),p&&D.has(p)&&T(p);break}case"Enter":case" ":{if(t.preventDefault(),p){let c=N(e,p);c&&H(c)}break}case"Home":{t.preventDefault();let c=_optionalChain([s, 'access', _24 => _24[0], 'optionalAccess', _25 => _25.dataset, 'access', _26 => _26.treeValue]);c&&(k(c),_optionalChain([s, 'access', _27 => _27[0], 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]));break}case"End":{t.preventDefault();let c=_optionalChain([s, 'access', _30 => _30[s.length-1], 'optionalAccess', _31 => _31.dataset, 'access', _32 => _32.treeValue]);c&&(k(c),_optionalChain([s, 'access', _33 => _33[s.length-1], 'optionalAccess', _34 => _34.focus, 'call', _35 => _35()]));break}}},[p,e,D,O,T,H]),ee=()=>r?l.length===0?h:l.length===1?_nullishCoalesce(_optionalChain([N, 'call', _36 => _36(e,l[0]), 'optionalAccess', _37 => _37.label]), () => (l[0])):`${l.length} selected`:n?_nullishCoalesce(_optionalChain([N, 'call', _38 => _38(e,n), 'optionalAccess', _39 => _39.label]), () => (n)):h,te=()=>{if(!r||q.length===0)return null;let t=q.map(s=>N(e,s)).filter(Boolean);return _jsxruntime.jsx.call(void 0, "div",{className:"max-h-[100px] overflow-y-auto px-2 py-1.5 border-b border-border",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-wrap gap-1",children:t.map(s=>_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs",children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate max-w-[120px]",children:s.label}),_jsxruntime.jsx.call(void 0, _lucidereact.X,{className:"h-3 w-3 cursor-pointer shrink-0",onClick:d=>Z(s.value,d),"aria-label":`Remove ${s.label}`})]},s.value))})})};return _jsxruntime.jsxs.call(void 0, _chunkULIOO55Ijs.a,{open:m,onOpenChange:Y,children:[_jsxruntime.jsx.call(void 0, _chunkULIOO55Ijs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",role:"combobox","aria-expanded":m,"aria-haspopup":"tree",disabled:S,className:_chunkFUYXCJOQjs.a.call(void 0, "cursor-pointer flex my-2 h-9 w-full items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50",!n&&!l.length&&"text-secondary-text",y&&"border-destructive-foreground focus-visible:ring-destructive-foreground",V),children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:ee()}),_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),_jsxruntime.jsxs.call(void 0, _chunkULIOO55Ijs.c,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center border-b px-3",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),_jsxruntime.jsx.call(void 0, "input",{value:b,onChange:t=>K(t.target.value),placeholder:g,className:"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50","aria-label":"Search tree"})]}),te(),_jsxruntime.jsx.call(void 0, "div",{className:"max-h-[300px] overflow-y-auto",children:F&&F.length>0?_jsxruntime.jsx.call(void 0, "div",{ref:I,role:"tree","aria-label":"Options",className:"p-1",onKeyDown:_,children:F.map(t=>_jsxruntime.jsx.call(void 0, W,{node:t,depth:0,multiple:r,selectedSet:C,expandedValues:D,focusedValue:p,onToggleExpand:T,onSelect:H,onFocus:k,searchTerm:b},t.value))}):_jsxruntime.jsx.call(void 0, "div",{className:"py-6 text-center text-sm text-muted-foreground",children:w})})]})]})}exports.a = ge;
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
var _chunkWYRD4UAKjs = require('./chunk-WYRD4UAK.js');var _chunkULIOO55Ijs = require('./chunk-ULIOO55I.js');var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var i = _interopRequireWildcard(_react);var _lucidereact = require('lucide-react');var _jsxruntime = require('react/jsx-runtime');function M(e){let n=[e.value];if(e.children)for(let a of e.children)n.push(...M(a));return n}function $(e,n){if(!e.children||e.children.length===0)return n.has(e.value)?"checked":"unchecked";let a=M(e),r=a.filter(l=>n.has(l)).length;return r===0?"unchecked":r===a.length?"checked":"indeterminate"}function J(e,n){let a=n.toLowerCase().trim();if(!a)return e;let r=[];for(let l of e){let f=l.label.toLowerCase().includes(a);if(l.children&&l.children.length>0){let h=J(l.children,n);f?r.push(l):h&&h.length>0&&r.push({...l,children:h})}else f&&r.push(l)}return r.length>0?r:null}function le(e,n){let a=n.toLowerCase().trim(),r=new Set;function l(f){let h=!1;for(let g of f){let w=g.label.toLowerCase().includes(a),S=!1;g.children&&(S=l(g.children)),(w||S)&&(r.add(g.value),h=!0)}return h}return l(e),r}function N(e,n){for(let a of e){if(a.value===n)return a;if(a.children){let r=N(a.children,n);if(r)return r}}}function Q(e){let n=new Set;for(let a of e)if(a.children&&a.children.length>0){n.add(a.value);for(let r of Q(a.children))n.add(r)}return n}function oe(e,n){if(!n)return e;let a=n.toLowerCase().trim();if(!a)return e;let r=e.toLowerCase().indexOf(a);return r===-1?e:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e.slice(0,r),_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold underline",children:e.slice(r,r+a.length)}),e.slice(r+a.length)]})}function W({node:e,depth:n,multiple:a,selectedSet:r,expandedValues:l,focusedValue:f,onToggleExpand:h,onSelect:g,onFocus:w,searchTerm:S}){let V=e.children&&e.children.length>0,y=l.has(e.value),v=a?$(e,r):r.has(e.value)?"checked":"unchecked",A=n*20;return _jsxruntime.jsxs.call(void 0, "div",{role:"treeitem","aria-expanded":V?y:void 0,"aria-selected":v==="checked",children:[_jsxruntime.jsxs.call(void 0, "div",{className:_chunkFUYXCJOQjs.a.call(void 0, "relative flex items-center gap-2 rounded-sm px-2 py-1.5 my-0.5 text-sm cursor-pointer select-none outline-none active:opacity-50","hover:bg-muted",v==="checked"&&!a&&"bg-muted"),style:{paddingLeft:`${8+A}px`},onClick:()=>g(e),onFocus:()=>w(e.value),"data-tree-value":e.value,tabIndex:f===e.value?0:-1,children:[V?_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"h-4 w-4 shrink-0 flex items-center justify-center rounded-sm hover:bg-secondary active:opacity-50",onClick:m=>{m.stopPropagation(),h(e.value)},"aria-label":y?`Collapse ${e.label}`:`Expand ${e.label}`,tabIndex:-1,children:y?_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown,{className:"h-3.5 w-3.5"}):_jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight,{className:"h-3.5 w-3.5"})}):_jsxruntime.jsx.call(void 0, "span",{className:"h-4 w-4 shrink-0"}),a?_jsxruntime.jsx.call(void 0, _chunkWYRD4UAKjs.a,{checked:v==="checked"?!0:v==="indeterminate"?"indeterminate":!1,onCheckedChange:()=>g(e),onClick:m=>m.stopPropagation(),className:"shrink-0","aria-label":e.label}):_jsxruntime.jsx.call(void 0, _lucidereact.Check,{className:_chunkFUYXCJOQjs.a.call(void 0, "h-4 w-4 shrink-0",v==="checked"?"opacity-100":"opacity-0")}),_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:oe(e.label,S)})]}),V&&y&&_jsxruntime.jsx.call(void 0, "div",{role:"group",children:e.children.map(m=>_jsxruntime.jsx.call(void 0, W,{node:m,depth:n+1,multiple:a,selectedSet:r,expandedValues:l,focusedValue:f,onToggleExpand:h,onSelect:g,onFocus:w,searchTerm:S},m.value))})]})}function ge({nodes:e,value:n,onValueChange:a,multiple:r=!1,values:l=[],onValuesChange:f,placeholder:h="Select...",searchPlaceholder:g="Search...",emptyMessage:w="No results found.",disabled:S=!1,className:V,error:y=!1,defaultExpandedValues:v,expandAll:A=!1}){let[m,B]=i.useState(!1),[b,K]=i.useState(""),[p,k]=i.useState(null),[D,L]=i.useState(()=>A?Q(e):v?new Set(v):new Set),P=i.useRef(null),I=i.useRef(null),C=i.useMemo(()=>new Set(r?l:n?[n]:[]),[r,l,n]),F=i.useMemo(()=>b?J(e,b):e,[e,b]);i.useEffect(()=>{if(b){P.current||(P.current=new Set(D));let t=le(e,b);L(t)}else P.current&&(L(P.current),P.current=null)},[b,e]);let Y=i.useCallback(t=>{B(t),t||(K(""),k(null))},[]),T=i.useCallback(t=>{L(s=>{let d=new Set(s);return d.has(t)?d.delete(t):d.add(t),d})},[]),H=i.useCallback(t=>{if(r){let s=M(t),d=$(t,C),c;if(d==="checked"){let u=new Set(s);c=l.filter(R=>!u.has(R))}else{let u=s.filter(R=>!C.has(R));c=[...l,...u]}_optionalChain([f, 'optionalCall', _2 => _2(c)])}else{if(t.children&&t.children.length>0){T(t.value);return}let d=t.value===n?"":t.value;_optionalChain([a, 'optionalCall', _3 => _3(d)]),B(!1)}},[r,l,n,C,f,a,T]),Z=i.useCallback((t,s)=>{s.preventDefault(),s.stopPropagation();let d=N(e,t);if(d){let c=new Set(M(d)),u=l.filter(R=>!c.has(R));_optionalChain([f, 'optionalCall', _4 => _4(u)])}},[e,l,f]),q=i.useMemo(()=>{if(!r)return[];let t=[];function s(d){for(let c of d){let u=$(c,C);u==="checked"?t.push(c.value):u==="indeterminate"&&c.children&&s(c.children)}}return s(e),t},[e,C,r]),O=i.useCallback(()=>I.current?Array.from(I.current.querySelectorAll("[data-tree-value]")):[],[]),_=i.useCallback(t=>{let s=O(),d=s.findIndex(c=>c.dataset.treeValue===p);switch(t.key){case"ArrowDown":{t.preventDefault();let c=Math.min(d+1,s.length-1),u=_optionalChain([s, 'access', _5 => _5[c], 'optionalAccess', _6 => _6.dataset, 'access', _7 => _7.treeValue]);u&&(k(u),_optionalChain([s, 'access', _8 => _8[c], 'optionalAccess', _9 => _9.focus, 'call', _10 => _10()]));break}case"ArrowUp":{t.preventDefault();let c=Math.max(d-1,0),u=_optionalChain([s, 'access', _11 => _11[c], 'optionalAccess', _12 => _12.dataset, 'access', _13 => _13.treeValue]);u&&(k(u),_optionalChain([s, 'access', _14 => _14[c], 'optionalAccess', _15 => _15.focus, 'call', _16 => _16()]));break}case"ArrowRight":{if(t.preventDefault(),p){let c=N(e,p);if(_optionalChain([c, 'optionalAccess', _17 => _17.children, 'optionalAccess', _18 => _18.length]))if(!D.has(p))T(p);else{let u=c.children[0].value;k(u),requestAnimationFrame(()=>{_optionalChain([O, 'call', _19 => _19(), 'access', _20 => _20.find, 'call', _21 => _21(re=>re.dataset.treeValue===u), 'optionalAccess', _22 => _22.focus, 'call', _23 => _23()])})}}break}case"ArrowLeft":{t.preventDefault(),p&&D.has(p)&&T(p);break}case"Enter":case" ":{if(t.preventDefault(),p){let c=N(e,p);c&&H(c)}break}case"Home":{t.preventDefault();let c=_optionalChain([s, 'access', _24 => _24[0], 'optionalAccess', _25 => _25.dataset, 'access', _26 => _26.treeValue]);c&&(k(c),_optionalChain([s, 'access', _27 => _27[0], 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]));break}case"End":{t.preventDefault();let c=_optionalChain([s, 'access', _30 => _30[s.length-1], 'optionalAccess', _31 => _31.dataset, 'access', _32 => _32.treeValue]);c&&(k(c),_optionalChain([s, 'access', _33 => _33[s.length-1], 'optionalAccess', _34 => _34.focus, 'call', _35 => _35()]));break}}},[p,e,D,O,T,H]),ee=()=>r?l.length===0?h:l.length===1?_nullishCoalesce(_optionalChain([N, 'call', _36 => _36(e,l[0]), 'optionalAccess', _37 => _37.label]), () => (l[0])):`${l.length} selected`:n?_nullishCoalesce(_optionalChain([N, 'call', _38 => _38(e,n), 'optionalAccess', _39 => _39.label]), () => (n)):h,te=()=>{if(!r||q.length===0)return null;let t=q.map(s=>N(e,s)).filter(Boolean);return _jsxruntime.jsx.call(void 0, "div",{className:"max-h-[100px] overflow-y-auto px-2 py-1.5 border-b border-border",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-wrap gap-1",children:t.map(s=>_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs",children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate max-w-[120px]",children:s.label}),_jsxruntime.jsx.call(void 0, _lucidereact.X,{className:"h-3 w-3 cursor-pointer shrink-0",onClick:d=>Z(s.value,d),"aria-label":`Remove ${s.label}`})]},s.value))})})};return _jsxruntime.jsxs.call(void 0, _chunkULIOO55Ijs.a,{open:m,onOpenChange:Y,children:[_jsxruntime.jsx.call(void 0, _chunkULIOO55Ijs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",role:"combobox","aria-expanded":m,"aria-haspopup":"tree",disabled:S,className:_chunkFUYXCJOQjs.a.call(void 0, "cursor-pointer flex my-2 h-8 lg:h-9 w-full items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50",!n&&!l.length&&"text-secondary-text",y&&"border-destructive-foreground focus-visible:ring-destructive-foreground",V),children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:ee()}),_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),_jsxruntime.jsxs.call(void 0, _chunkULIOO55Ijs.c,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center border-b px-3",children:[_jsxruntime.jsx.call(void 0, _lucidereact.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),_jsxruntime.jsx.call(void 0, "input",{value:b,onChange:t=>K(t.target.value),placeholder:g,className:"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50","aria-label":"Search tree"})]}),te(),_jsxruntime.jsx.call(void 0, "div",{className:"max-h-[300px] overflow-y-auto",children:F&&F.length>0?_jsxruntime.jsx.call(void 0, "div",{ref:I,role:"tree","aria-label":"Options",className:"p-1",onKeyDown:_,children:F.map(t=>_jsxruntime.jsx.call(void 0, W,{node:t,depth:0,multiple:r,selectedSet:C,expandedValues:D,focusedValue:p,onToggleExpand:T,onSelect:H,onFocus:k,searchTerm:b},t.value))}):_jsxruntime.jsx.call(void 0, "div",{className:"py-6 text-center text-sm text-muted-foreground",children:w})})]})]})}exports.a = ge;
|
|
3
|
+
//# sourceMappingURL=chunk-YE7OOLWB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-YE7OOLWB.js","../src/components/tree-select.tsx"],"names":["getAllDescendantValues","node","values","child","getCheckState","selectedSet","descendants","selectedCount","v","filterTree","nodes","searchTerm","term","result","labelMatches","filteredChildren","getValuesOfMatchingNodes","walk","nodeList","hasMatch","childHasMatch","findNodeByValue","value","found","collectAllBranchValues","renderHighlightedLabel","label","index","jsxs","Fragment","jsx","TreeNodeItem","depth","multiple","expandedValues","focusedValue","onToggleExpand","onSelect","onFocus","hasChildren","isExpanded","checkState","indentPx","cn"],"mappings":"AAAA,+8BAAY;AACZ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,QAAA,CAAA,CAAAb,8BAAAA,KAAC,CAAA,CACC,SAAA,CAAWe,gCAAAA,kIACT,CACA,gBAAA,CACAF,CAAAA,GAAe,SAAA,EAAa,CAACR,CAAAA,EAAY,UAG3C,CAAA,CACA,KAAA,CAAO,CAAE,WAAA,CAAa,CAAA,EAAA","file":"/Users/aktoriukas/Documents/Projects/alkimi/alkimi-ui-kit/dist/chunk-YE7OOLWB.js","sourcesContent":[null,"\"use client\"\n\nimport * as React from \"react\"\nimport { Check, ChevronDown, ChevronRight, Search, X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Checkbox } from \"@/components/checkbox\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/popover\"\n\n// --- Public types ---\n\nexport interface TreeSelectNode {\n value: string\n label: string\n children?: TreeSelectNode[]\n}\n\nexport interface TreeSelectProps {\n nodes: TreeSelectNode[]\n value?: string\n onValueChange?: (value: string) => void\n multiple?: boolean\n values?: string[]\n onValuesChange?: (values: string[]) => void\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n disabled?: boolean\n className?: string\n error?: boolean\n defaultExpandedValues?: string[]\n expandAll?: boolean\n}\n\n// --- Internal types ---\n\ntype CheckState = \"checked\" | \"indeterminate\" | \"unchecked\"\n\n// --- Utility functions ---\n\nfunction getAllDescendantValues(node: TreeSelectNode): string[] {\n const values: string[] = [node.value]\n if (node.children) {\n for (const child of node.children) {\n values.push(...getAllDescendantValues(child))\n }\n }\n return values\n}\n\nfunction getCheckState(\n node: TreeSelectNode,\n selectedSet: Set<string>\n): CheckState {\n if (!node.children || node.children.length === 0) {\n return selectedSet.has(node.value) ? \"checked\" : \"unchecked\"\n }\n\n const descendants = getAllDescendantValues(node)\n const selectedCount = descendants.filter((v) => selectedSet.has(v)).length\n\n if (selectedCount === 0) return \"unchecked\"\n if (selectedCount === descendants.length) return \"checked\"\n return \"indeterminate\"\n}\n\nfunction filterTree(\n nodes: TreeSelectNode[],\n searchTerm: string\n): TreeSelectNode[] | null {\n const term = searchTerm.toLowerCase().trim()\n if (!term) return nodes\n\n const result: TreeSelectNode[] = []\n\n for (const node of nodes) {\n const labelMatches = node.label.toLowerCase().includes(term)\n\n if (node.children && node.children.length > 0) {\n const filteredChildren = filterTree(node.children, searchTerm)\n\n if (labelMatches) {\n result.push(node)\n } else if (filteredChildren && filteredChildren.length > 0) {\n result.push({ ...node, children: filteredChildren })\n }\n } else if (labelMatches) {\n result.push(node)\n }\n }\n\n return result.length > 0 ? result : null\n}\n\nfunction getValuesOfMatchingNodes(\n nodes: TreeSelectNode[],\n searchTerm: string\n): Set<string> {\n const term = searchTerm.toLowerCase().trim()\n const result = new Set<string>()\n\n function walk(nodeList: TreeSelectNode[]): boolean {\n let hasMatch = false\n for (const node of nodeList) {\n const labelMatches = node.label.toLowerCase().includes(term)\n let childHasMatch = false\n\n if (node.children) {\n childHasMatch = walk(node.children)\n }\n\n if (labelMatches || childHasMatch) {\n result.add(node.value)\n hasMatch = true\n }\n }\n return hasMatch\n }\n\n walk(nodes)\n return result\n}\n\nfunction findNodeByValue(\n nodes: TreeSelectNode[],\n value: string\n): TreeSelectNode | undefined {\n for (const node of nodes) {\n if (node.value === value) return node\n if (node.children) {\n const found = findNodeByValue(node.children, value)\n if (found) return found\n }\n }\n return undefined\n}\n\nfunction collectAllBranchValues(nodes: TreeSelectNode[]): Set<string> {\n const result = new Set<string>()\n for (const node of nodes) {\n if (node.children && node.children.length > 0) {\n result.add(node.value)\n for (const v of collectAllBranchValues(node.children)) {\n result.add(v)\n }\n }\n }\n return result\n}\n\nfunction renderHighlightedLabel(\n label: string,\n searchTerm: string\n): React.ReactNode {\n if (!searchTerm) return label\n\n const term = searchTerm.toLowerCase().trim()\n if (!term) return label\n\n const index = label.toLowerCase().indexOf(term)\n if (index === -1) return label\n\n return (\n <>\n {label.slice(0, index)}\n <span className=\"font-semibold underline\">\n {label.slice(index, index + term.length)}\n </span>\n {label.slice(index + term.length)}\n </>\n )\n}\n\n// --- TreeNodeItem (internal) ---\n\ninterface TreeNodeItemProps {\n node: TreeSelectNode\n depth: number\n multiple: boolean\n selectedSet: Set<string>\n expandedValues: Set<string>\n focusedValue: string | null\n onToggleExpand: (value: string) => void\n onSelect: (node: TreeSelectNode) => void\n onFocus: (value: string) => void\n searchTerm: string\n}\n\nfunction TreeNodeItem({\n node,\n depth,\n multiple,\n selectedSet,\n expandedValues,\n focusedValue,\n onToggleExpand,\n onSelect,\n onFocus,\n searchTerm,\n}: TreeNodeItemProps) {\n const hasChildren = node.children && node.children.length > 0\n const isExpanded = expandedValues.has(node.value)\n const checkState = multiple\n ? getCheckState(node, selectedSet)\n : selectedSet.has(node.value)\n ? \"checked\"\n : \"unchecked\"\n\n const indentPx = depth * 20\n\n return (\n <div\n role=\"treeitem\"\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-selected={checkState === \"checked\"}\n >\n <div\n className={cn(\n \"relative flex items-center gap-2 rounded-sm px-2 py-1.5 my-0.5 text-sm cursor-pointer select-none outline-none active:opacity-50\",\n \"hover:bg-muted\",\n checkState === \"checked\" && !multiple && \"bg-muted\"\n // This adds a focus ring when the node is focused, but it's not needed for the tree-select component.\n // focusedValue === node.value && \"z-10 ring-2 ring-ring\"\n )}\n style={{ paddingLeft: `${8 + indentPx}px` }}\n onClick={() => onSelect(node)}\n onFocus={() => onFocus(node.value)}\n data-tree-value={node.value}\n tabIndex={focusedValue === node.value ? 0 : -1}\n >\n {hasChildren ? (\n <button\n type=\"button\"\n className=\"h-4 w-4 shrink-0 flex items-center justify-center rounded-sm hover:bg-secondary active:opacity-50\"\n onClick={(e) => {\n e.stopPropagation()\n onToggleExpand(node.value)\n }}\n aria-label={\n isExpanded ? `Collapse ${node.label}` : `Expand ${node.label}`\n }\n tabIndex={-1}\n >\n {isExpanded ? (\n <ChevronDown className=\"h-3.5 w-3.5\" />\n ) : (\n <ChevronRight className=\"h-3.5 w-3.5\" />\n )}\n </button>\n ) : (\n <span className=\"h-4 w-4 shrink-0\" />\n )}\n\n {multiple ? (\n <Checkbox\n checked={\n checkState === \"checked\"\n ? true\n : checkState === \"indeterminate\"\n ? \"indeterminate\"\n : false\n }\n onCheckedChange={() => onSelect(node)}\n onClick={(e) => e.stopPropagation()}\n className=\"shrink-0\"\n aria-label={node.label}\n />\n ) : (\n <Check\n className={cn(\n \"h-4 w-4 shrink-0\",\n checkState === \"checked\" ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n )}\n\n <span className=\"truncate\">\n {renderHighlightedLabel(node.label, searchTerm)}\n </span>\n </div>\n\n {hasChildren && isExpanded && (\n <div role=\"group\">\n {node.children!.map((child) => (\n <TreeNodeItem\n key={child.value}\n node={child}\n depth={depth + 1}\n multiple={multiple}\n selectedSet={selectedSet}\n expandedValues={expandedValues}\n focusedValue={focusedValue}\n onToggleExpand={onToggleExpand}\n onSelect={onSelect}\n onFocus={onFocus}\n searchTerm={searchTerm}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// --- TreeSelect (main component) ---\n\nexport function TreeSelect({\n nodes,\n value,\n onValueChange,\n multiple = false,\n values = [],\n onValuesChange,\n placeholder = \"Select...\",\n searchPlaceholder = \"Search...\",\n emptyMessage = \"No results found.\",\n disabled = false,\n className,\n error = false,\n defaultExpandedValues,\n expandAll = false,\n}: TreeSelectProps) {\n const [open, setOpen] = React.useState(false)\n const [searchTerm, setSearchTerm] = React.useState(\"\")\n const [focusedValue, setFocusedValue] = React.useState<string | null>(null)\n const [expandedValues, setExpandedValues] = React.useState<Set<string>>(\n () => {\n if (expandAll) return collectAllBranchValues(nodes)\n if (defaultExpandedValues) return new Set(defaultExpandedValues)\n return new Set<string>()\n }\n )\n\n const preSearchExpandedRef = React.useRef<Set<string> | null>(null)\n const treeRef = React.useRef<HTMLDivElement>(null)\n\n const selectedSet = React.useMemo(\n () => new Set(multiple ? values : value ? [value] : []),\n [multiple, values, value]\n )\n\n const filteredNodes = React.useMemo(\n () => (searchTerm ? filterTree(nodes, searchTerm) : nodes),\n [nodes, searchTerm]\n )\n\n // Auto-expand matching ancestors during search\n React.useEffect(() => {\n if (searchTerm) {\n if (!preSearchExpandedRef.current) {\n preSearchExpandedRef.current = new Set(expandedValues)\n }\n const matchingAncestors = getValuesOfMatchingNodes(nodes, searchTerm)\n setExpandedValues(matchingAncestors)\n } else if (preSearchExpandedRef.current) {\n setExpandedValues(preSearchExpandedRef.current)\n preSearchExpandedRef.current = null\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchTerm, nodes])\n\n const handleOpenChange = React.useCallback((isOpen: boolean) => {\n setOpen(isOpen)\n if (!isOpen) {\n setSearchTerm(\"\")\n setFocusedValue(null)\n }\n }, [])\n\n const handleToggleExpand = React.useCallback((nodeValue: string) => {\n setExpandedValues((prev) => {\n const next = new Set(prev)\n if (next.has(nodeValue)) {\n next.delete(nodeValue)\n } else {\n next.add(nodeValue)\n }\n return next\n })\n }, [])\n\n const handleSelect = React.useCallback(\n (node: TreeSelectNode) => {\n if (multiple) {\n const allDescendants = getAllDescendantValues(node)\n const currentState = getCheckState(node, selectedSet)\n\n let newValues: string[]\n if (currentState === \"checked\") {\n const toRemove = new Set(allDescendants)\n newValues = values.filter((v) => !toRemove.has(v))\n } else {\n const toAdd = allDescendants.filter((v) => !selectedSet.has(v))\n newValues = [...values, ...toAdd]\n }\n onValuesChange?.(newValues)\n } else {\n // Single-select: clicking a parent toggles expand instead of selecting\n const hasChildren = node.children && node.children.length > 0\n if (hasChildren) {\n handleToggleExpand(node.value)\n return\n }\n const newValue = node.value === value ? \"\" : node.value\n onValueChange?.(newValue)\n setOpen(false)\n }\n },\n [\n multiple,\n values,\n value,\n selectedSet,\n onValuesChange,\n onValueChange,\n handleToggleExpand,\n ]\n )\n\n const handleRemoveChip = React.useCallback(\n (chipValue: string, e: React.MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n const node = findNodeByValue(nodes, chipValue)\n if (node) {\n const toRemove = new Set(getAllDescendantValues(node))\n const newValues = values.filter((v) => !toRemove.has(v))\n onValuesChange?.(newValues)\n }\n },\n [nodes, values, onValuesChange]\n )\n\n // Smart chips: minimal set representing the selection\n const chipValues = React.useMemo(() => {\n if (!multiple) return []\n\n const chips: string[] = []\n\n function walk(nodeList: TreeSelectNode[]) {\n for (const node of nodeList) {\n const state = getCheckState(node, selectedSet)\n if (state === \"checked\") {\n chips.push(node.value)\n } else if (state === \"indeterminate\" && node.children) {\n walk(node.children)\n }\n }\n }\n\n walk(nodes)\n return chips\n }, [nodes, selectedSet, multiple])\n\n // Keyboard navigation\n const getVisibleNodes = React.useCallback((): HTMLElement[] => {\n if (!treeRef.current) return []\n return Array.from(treeRef.current.querySelectorAll(\"[data-tree-value]\"))\n }, [])\n\n const handleTreeKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n const visibleNodes = getVisibleNodes()\n const currentIndex = visibleNodes.findIndex(\n (el) => el.dataset.treeValue === focusedValue\n )\n\n switch (e.key) {\n case \"ArrowDown\": {\n e.preventDefault()\n const nextIndex = Math.min(currentIndex + 1, visibleNodes.length - 1)\n const nextValue = visibleNodes[nextIndex]?.dataset.treeValue\n if (nextValue) {\n setFocusedValue(nextValue)\n visibleNodes[nextIndex]?.focus()\n }\n break\n }\n case \"ArrowUp\": {\n e.preventDefault()\n const prevIndex = Math.max(currentIndex - 1, 0)\n const prevValue = visibleNodes[prevIndex]?.dataset.treeValue\n if (prevValue) {\n setFocusedValue(prevValue)\n visibleNodes[prevIndex]?.focus()\n }\n break\n }\n case \"ArrowRight\": {\n e.preventDefault()\n if (focusedValue) {\n const node = findNodeByValue(nodes, focusedValue)\n if (node?.children?.length) {\n if (!expandedValues.has(focusedValue)) {\n handleToggleExpand(focusedValue)\n } else {\n const firstChildValue = node.children[0].value\n setFocusedValue(firstChildValue)\n requestAnimationFrame(() => {\n const els = getVisibleNodes()\n const el = els.find(\n (n) => n.dataset.treeValue === firstChildValue\n )\n el?.focus()\n })\n }\n }\n }\n break\n }\n case \"ArrowLeft\": {\n e.preventDefault()\n if (focusedValue && expandedValues.has(focusedValue)) {\n handleToggleExpand(focusedValue)\n }\n break\n }\n case \"Enter\":\n case \" \": {\n e.preventDefault()\n if (focusedValue) {\n const node = findNodeByValue(nodes, focusedValue)\n if (node) handleSelect(node)\n }\n break\n }\n case \"Home\": {\n e.preventDefault()\n const firstValue = visibleNodes[0]?.dataset.treeValue\n if (firstValue) {\n setFocusedValue(firstValue)\n visibleNodes[0]?.focus()\n }\n break\n }\n case \"End\": {\n e.preventDefault()\n const lastValue =\n visibleNodes[visibleNodes.length - 1]?.dataset.treeValue\n if (lastValue) {\n setFocusedValue(lastValue)\n visibleNodes[visibleNodes.length - 1]?.focus()\n }\n break\n }\n }\n },\n [\n focusedValue,\n nodes,\n expandedValues,\n getVisibleNodes,\n handleToggleExpand,\n handleSelect,\n ]\n )\n\n const getDisplayText = () => {\n if (multiple) {\n if (values.length === 0) return placeholder\n if (values.length === 1) {\n const node = findNodeByValue(nodes, values[0])\n return node?.label ?? values[0]\n }\n return `${values.length} selected`\n }\n if (value) {\n const node = findNodeByValue(nodes, value)\n return node?.label ?? value\n }\n return placeholder\n }\n\n const renderSelectedChips = () => {\n if (!multiple || chipValues.length === 0) return null\n\n const chipNodes = chipValues\n .map((v) => findNodeByValue(nodes, v))\n .filter(Boolean) as TreeSelectNode[]\n\n return (\n <div className=\"max-h-[100px] overflow-y-auto px-2 py-1.5 border-b border-border\">\n <div className=\"flex flex-wrap gap-1\">\n {chipNodes.map((node) => (\n <div\n key={node.value}\n className=\"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs\"\n >\n <span className=\"truncate max-w-[120px]\">{node.label}</span>\n <X\n className=\"h-3 w-3 cursor-pointer shrink-0\"\n onClick={(e) => handleRemoveChip(node.value, e)}\n aria-label={`Remove ${node.label}`}\n />\n </div>\n ))}\n </div>\n </div>\n )\n }\n\n return (\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n disabled={disabled}\n className={cn(\n \"cursor-pointer flex my-2 h-8 lg:h-9 w-full items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:opacity-50 disabled:cursor-not-allowed disabled:opacity-50\",\n !value && !values.length && \"text-secondary-text\",\n error &&\n \"border-destructive-foreground focus-visible:ring-destructive-foreground\",\n className\n )}\n >\n <span className=\"truncate\">{getDisplayText()}</span>\n <ChevronDown className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n className=\"p-0\"\n align=\"start\"\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n >\n <div className=\"flex items-center border-b px-3\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <input\n value={searchTerm}\n onChange={(e) => setSearchTerm(e.target.value)}\n placeholder={searchPlaceholder}\n className=\"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Search tree\"\n />\n </div>\n\n {renderSelectedChips()}\n\n <div className=\"max-h-[300px] overflow-y-auto\">\n {filteredNodes && filteredNodes.length > 0 ? (\n <div\n ref={treeRef}\n role=\"tree\"\n aria-label=\"Options\"\n className=\"p-1\"\n onKeyDown={handleTreeKeyDown}\n >\n {filteredNodes.map((node) => (\n <TreeNodeItem\n key={node.value}\n node={node}\n depth={0}\n multiple={multiple}\n selectedSet={selectedSet}\n expandedValues={expandedValues}\n focusedValue={focusedValue}\n onToggleExpand={handleToggleExpand}\n onSelect={handleSelect}\n onFocus={setFocusedValue}\n searchTerm={searchTerm}\n />\n ))}\n </div>\n ) : (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">\n {emptyMessage}\n </div>\n )}\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as Y,b as J,c as Q,d as Z}from"./chunk-QC5MA4WL.mjs";import{a as j}from"./chunk-YBV4CPVD.mjs";import{a as $,f as W,g as U,i as q,j as X}from"./chunk-QVMQ55JW.mjs";import{a as _}from"./chunk-CNRZOMR4.mjs";import{a as K}from"./chunk-NEOUFWZN.mjs";import{a as z,b as D}from"./chunk-BLHKJHNV.mjs";import{a as o}from"./chunk-S5TKCF6T.mjs";import*as e from"react";import{Slot as w}from"@radix-ui/react-slot";import{cva as ie}from"class-variance-authority";import{PanelLeft as se,X as de,Menu as le}from"lucide-react";import{Fragment as k,jsx as r,jsxs as u}from"react/jsx-runtime";var ce="sidebar_state",pe=3600*24*7,be="16.75rem",ee="23rem",ue="calc(3rem + 0.75rem)",fe="b",me="55px",ae=e.createContext(null),te=e.createContext(!1);function y(){let a=e.useContext(ae);if(!a)throw new Error("useSidebar must be used within a SidebarProvider.");return a}var ge=e.forwardRef(({defaultOpen:a=!0,open:t,onOpenChange:n,bannerHeight:i=me,className:s,style:c,children:p,...d},R)=>{let[v,b]=e.useState(!1),[g,C]=e.useState(a),[x,S]=e.useState(!1),[m,N]=e.useState(!1),[M,h]=e.useState(a),I=t??M,E=e.useCallback(l=>{let f=typeof l=="function"?l(I):l;n?n(f):h(f),document.cookie=`${ce}=${f}; path=/; max-age=${pe}`},[n,I]),T=e.useCallback(()=>{E(l=>!l)},[E]),A=e.useCallback(()=>{let l=getComputedStyle(document.documentElement).getPropertyValue("--breakpoint-md").trim();l&&window.matchMedia(`(min-width: ${l})`).matches||b(f=>!f)},[b]);e.useEffect(()=>{let l=f=>{f.key===fe&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),T())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[T]);let O=I?"expanded":"collapsed",L=e.useRef([]),V=e.Children.toArray(p),B=V.filter(l=>e.isValidElement(l)&&l.type?.displayName==="SidebarBanner"),ne=V.filter(l=>!e.isValidElement(l)||l.type?.displayName!=="SidebarBanner");B.length>0&&m&&(L.current=B);let G=B.length>0,P=G&&m,H=!P&&L.current.length>0,F=G,oe=e.useMemo(()=>({state:O,isOpen:g,setOpen:E,openMobile:v,setOpenMobile:b,toggleSidebar:T,toggleMobileSidebar:A,setIsFullyOpen:C,isAnimating:x,setIsAnimating:S,isBannerClosing:H,bannerVisible:m,setBannerVisible:N}),[O,g,E,v,b,T,A,C,x,S,H,m]);return r(ae.Provider,{value:oe,children:r(Y,{delayDuration:0,children:r("div",{style:{"--sidebar-width":be,"--sidebar-width-icon":ue,"--sidebar-top":P?i:"0px",...c},className:o("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",F&&"flex-col",s),ref:R,...d,children:F?u(k,{children:[r("div",{className:"relative overflow-hidden transition-[height] duration-200 ease-linear",style:{height:P?i:"0px"},children:r("div",{className:"fixed top-0 left-0 right-0 z-20 w-full transition-transform duration-200 ease-linear data-[state=closed]:-translate-y-full",style:{height:i},"data-state":P?"open":"closed",onTransitionEnd:()=>{H&&(L.current=[])},children:B})}),r("div",{className:"flex flex-1",children:ne})]}):p})})})});ge.displayName="SidebarProvider";var ve=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"banner",className:o("w-full",a),...t}));ve.displayName="SidebarBanner";var he=e.forwardRef(({side:a="left",variant:t="sidebar",collapsible:n="offcanvas",className:i,children:s,...c},p)=>{let{state:d,openMobile:R,setOpenMobile:v,setIsFullyOpen:b,setIsAnimating:g,isBannerClosing:C}=y(),x=e.useRef(null),S=e.useRef(!0);return e.useEffect(()=>{let m=x.current;if(!m)return;if(S.current){S.current=!1,b(d==="expanded"),g(!1);return}g(!0);let N=setTimeout(()=>{b(d==="expanded"),g(!1)},300),M=h=>{h.target===m&&(h.propertyName==="left"||h.propertyName==="right"||h.propertyName==="width")&&(clearTimeout(N),b(d==="expanded"),g(!1))};return m.addEventListener("transitionend",M),()=>{m.removeEventListener("transitionend",M),clearTimeout(N)}},[d,b,g]),n==="none"?r("aside",{className:o("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",i),ref:p,...c,children:s}):u(k,{children:[r($,{open:R,onOpenChange:v,children:u(W,{"data-sidebar":"sidebar","data-mobile":"true",className:"md:hidden bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{width:ee,maxWidth:ee},side:a,children:[u(U,{className:"sr-only",children:[r(q,{children:"Sidebar"}),r(X,{children:"Displays the mobile sidebar."})]}),r(te.Provider,{value:!0,children:r("div",{className:"flex h-full w-full flex-col",children:s})})]})}),u("aside",{ref:p,className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":a,children:[r("div",{className:o("w-(--sidebar-width) transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),r("div",{ref:x,"data-banner-closing":C,className:o("fixed z-10 hidden w-(--sidebar-width) transition-[left,right,width,top,height] duration-200 ease-linear md:flex","top-(--sidebar-top) h-[calc(100svh-var(--sidebar-top))]",a==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",i),...c,children:r("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:r("div",{className:"flex flex-col my-2.5 ml-2.5 rounded-2xl border bg-sidebar border-sidebar-border flex-1 min-h-0",children:s})})})]})]})});he.displayName="Sidebar";var re=e.forwardRef(({className:a,onClick:t,...n},i)=>{let{toggleSidebar:s,toggleMobileSidebar:c,openMobile:p}=y();return u(k,{children:[u(D,{"data-sidebar":"trigger",variant:"ghost",size:"icon",className:o("md:hidden bg-transparent hover:bg-transparent",a),onClick:d=>{t?.(d),c()},...n,children:[p?r("span",{className:o(z({variant:"secondary",size:"icon"})),children:r(de,{size:16})}):r("span",{className:o(z({variant:"outline",size:"icon"})),children:r(le,{size:16})}),r("span",{className:"sr-only",children:"Toggle Sidebar"})]}),u(D,{ref:i,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:o("hidden md:inline-flex h-7 w-7",a),onClick:d=>{t?.(d),s()},...n,children:[r("span",{className:"rounded-full p-2",children:r(se,{size:16})}),r("span",{className:"sr-only",children:"Toggle Sidebar"})]})]})});re.displayName="SidebarTrigger";var Re=e.forwardRef(({className:a,...t},n)=>{let{toggleSidebar:i}=y();return r("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:i,title:"Toggle Sidebar",className:o("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",a),...t})});Re.displayName="SidebarRail";var xe=e.memo(e.forwardRef(({className:a,...t},n)=>r("main",{ref:n,className:o("relative flex min-w-0 w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",a),...t})));xe.displayName="SidebarInset";var Se=e.forwardRef(({className:a,...t},n)=>r(K,{ref:n,"data-sidebar":"input",className:o("h-8 w-full bg-sidebar shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",a),...t}));Se.displayName="SidebarInput";var we=e.forwardRef(({className:a,showTrigger:t=!1,children:n,...i},s)=>{let{state:c}=y(),p=e.useContext(te),d=c==="collapsed"&&!p;return u("div",{ref:s,"data-sidebar":"header",className:o("flex w-full gap-2 p-2 items-center",d?"justify-center items-center":"justify-between items-start",a),...i,children:[!d&&r("div",{className:"transition-all duration-200 w-full h-fit flex justify-between overflow-hidden",children:r("div",{className:"whitespace-nowrap",children:n})}),t&&r(re,{})]})});we.displayName="SidebarHeader";var ye=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"footer",className:o("flex flex-col gap-2 p-2",a),...t}));ye.displayName="SidebarFooter";var Ce=e.forwardRef(({className:a,...t},n)=>r(j,{ref:n,"data-sidebar":"separator",className:o("mx-2 w-auto bg-border",a),...t}));Ce.displayName="SidebarSeparator";var Ne=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"content",className:o("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden p-2",a),...t}));Ne.displayName="SidebarContent";var Me=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"group",className:o("relative flex w-full min-w-0 flex-col","group-data-[collapsible=icon]:p-0",a),...t}));Me.displayName="SidebarGroup";var Ee=e.forwardRef(({className:a,asChild:t=!1,...n},i)=>r(t?w:"div",{ref:i,"data-sidebar":"group-label",className:o("flex h-8 shrink-0 items-center rounded-md text-xs font-medium text-secondary-text outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",a),...n}));Ee.displayName="SidebarGroupLabel";var Te=e.forwardRef(({className:a,asChild:t=!1,...n},i)=>r(t?w:"button",{ref:i,"data-sidebar":"group-action",className:o("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",a),...n}));Te.displayName="SidebarGroupAction";var Be=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"group-content",className:o("w-full text-sm",a),...t}));Be.displayName="SidebarGroupContent";var Pe=e.forwardRef(({className:a,...t},n)=>r("ul",{ref:n,"data-sidebar":"menu",className:o("flex w-full min-w-0 flex-col gap-1",a),...t}));Pe.displayName="SidebarMenu";var Ie=e.forwardRef(({className:a,...t},n)=>r("li",{ref:n,"data-sidebar":"menu-item",className:o("group/menu-item relative",a),...t}));Ie.displayName="SidebarMenuItem";var Le=ie("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"",outline:"bg-sidebar shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),He=e.forwardRef(({asChild:a=!1,isActive:t=!1,variant:n="default",size:i="default",tooltip:s,className:c,...p},d)=>{let R=a?w:"button",{state:v}=y(),b=r(R,{ref:d,"data-sidebar":"menu-button","data-size":i,"data-active":t,className:o(Le({variant:n,size:i}),c),...p});return s?(typeof s=="string"&&(s={children:s}),u(J,{children:[r(Q,{asChild:!0,children:b}),r(Z,{side:"right",align:"center",hidden:v!=="collapsed",...s})]})):b});He.displayName="SidebarMenuButton";var ze=e.forwardRef(({className:a,asChild:t=!1,showOnHover:n=!1,...i},s)=>r(t?w:"button",{ref:s,"data-sidebar":"menu-action",className:o("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-base-accent-foreground md:opacity-0",a),...i}));ze.displayName="SidebarMenuAction";var De=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"menu-badge",className:o("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",a),...t}));De.displayName="SidebarMenuBadge";var _e=e.forwardRef(({className:a,showIcon:t=!1,...n},i)=>{let s=e.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return u("div",{ref:i,"data-sidebar":"menu-skeleton",className:o("flex h-8 items-center gap-2 rounded-md px-2",a),...n,children:[t&&r(_,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),r(_,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});_e.displayName="SidebarMenuSkeleton";var ke=e.forwardRef(({className:a,...t},n)=>r("ul",{ref:n,"data-sidebar":"menu-sub",className:o("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",a),...t}));ke.displayName="SidebarMenuSub";var Ae=e.forwardRef(({...a},t)=>r("li",{ref:t,...a}));Ae.displayName="SidebarMenuSubItem";var Oe=e.forwardRef(({asChild:a=!1,size:t="md",isActive:n,className:i,...s},c)=>r(a?w:"a",{ref:c,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:o("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",i),...s}));Oe.displayName="SidebarMenuSubButton";export{y as a,ge as b,ve as c,he as d,re as e,Re as f,xe as g,Se as h,we as i,ye as j,Ce as k,Ne as l,Me as m,Ee as n,Te as o,Be as p,Pe as q,Ie as r,He as s,ze as t,De as u,_e as v,ke as w,Ae as x,Oe as y};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as Y,b as J,c as Q,d as Z}from"./chunk-QC5MA4WL.mjs";import{a as j}from"./chunk-YBV4CPVD.mjs";import{a as $,f as W,g as U,i as q,j as X}from"./chunk-QVMQ55JW.mjs";import{a as _}from"./chunk-CNRZOMR4.mjs";import{a as K}from"./chunk-YSIF7HA3.mjs";import{a as z,b as D}from"./chunk-QZKQORLQ.mjs";import{a as o}from"./chunk-S5TKCF6T.mjs";import*as e from"react";import{Slot as w}from"@radix-ui/react-slot";import{cva as ie}from"class-variance-authority";import{PanelLeft as se,X as de,Menu as le}from"lucide-react";import{Fragment as k,jsx as r,jsxs as u}from"react/jsx-runtime";var ce="sidebar_state",pe=3600*24*7,be="16.75rem",ee="23rem",ue="calc(3rem + 0.75rem)",fe="b",me="55px",ae=e.createContext(null),te=e.createContext(!1);function y(){let a=e.useContext(ae);if(!a)throw new Error("useSidebar must be used within a SidebarProvider.");return a}var ge=e.forwardRef(({defaultOpen:a=!0,open:t,onOpenChange:n,bannerHeight:i=me,className:s,style:c,children:p,...d},R)=>{let[v,b]=e.useState(!1),[g,C]=e.useState(a),[x,S]=e.useState(!1),[m,N]=e.useState(!1),[M,h]=e.useState(a),I=t??M,E=e.useCallback(l=>{let f=typeof l=="function"?l(I):l;n?n(f):h(f),document.cookie=`${ce}=${f}; path=/; max-age=${pe}`},[n,I]),T=e.useCallback(()=>{E(l=>!l)},[E]),A=e.useCallback(()=>{let l=getComputedStyle(document.documentElement).getPropertyValue("--breakpoint-md").trim();l&&window.matchMedia(`(min-width: ${l})`).matches||b(f=>!f)},[b]);e.useEffect(()=>{let l=f=>{f.key===fe&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),T())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[T]);let O=I?"expanded":"collapsed",L=e.useRef([]),V=e.Children.toArray(p),B=V.filter(l=>e.isValidElement(l)&&l.type?.displayName==="SidebarBanner"),ne=V.filter(l=>!e.isValidElement(l)||l.type?.displayName!=="SidebarBanner");B.length>0&&m&&(L.current=B);let G=B.length>0,P=G&&m,H=!P&&L.current.length>0,F=G,oe=e.useMemo(()=>({state:O,isOpen:g,setOpen:E,openMobile:v,setOpenMobile:b,toggleSidebar:T,toggleMobileSidebar:A,setIsFullyOpen:C,isAnimating:x,setIsAnimating:S,isBannerClosing:H,bannerVisible:m,setBannerVisible:N}),[O,g,E,v,b,T,A,C,x,S,H,m]);return r(ae.Provider,{value:oe,children:r(Y,{delayDuration:0,children:r("div",{style:{"--sidebar-width":be,"--sidebar-width-icon":ue,"--sidebar-top":P?i:"0px",...c},className:o("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",F&&"flex-col",s),ref:R,...d,children:F?u(k,{children:[r("div",{className:"relative overflow-hidden transition-[height] duration-200 ease-linear",style:{height:P?i:"0px"},children:r("div",{className:"fixed top-0 left-0 right-0 z-20 w-full transition-transform duration-200 ease-linear data-[state=closed]:-translate-y-full",style:{height:i},"data-state":P?"open":"closed",onTransitionEnd:()=>{H&&(L.current=[])},children:B})}),r("div",{className:"flex flex-1",children:ne})]}):p})})})});ge.displayName="SidebarProvider";var ve=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"banner",className:o("w-full",a),...t}));ve.displayName="SidebarBanner";var he=e.forwardRef(({side:a="left",variant:t="sidebar",collapsible:n="offcanvas",className:i,children:s,...c},p)=>{let{state:d,openMobile:R,setOpenMobile:v,setIsFullyOpen:b,setIsAnimating:g,isBannerClosing:C}=y(),x=e.useRef(null),S=e.useRef(!0);return e.useEffect(()=>{let m=x.current;if(!m)return;if(S.current){S.current=!1,b(d==="expanded"),g(!1);return}g(!0);let N=setTimeout(()=>{b(d==="expanded"),g(!1)},300),M=h=>{h.target===m&&(h.propertyName==="left"||h.propertyName==="right"||h.propertyName==="width")&&(clearTimeout(N),b(d==="expanded"),g(!1))};return m.addEventListener("transitionend",M),()=>{m.removeEventListener("transitionend",M),clearTimeout(N)}},[d,b,g]),n==="none"?r("aside",{className:o("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",i),ref:p,...c,children:s}):u(k,{children:[r($,{open:R,onOpenChange:v,children:u(W,{"data-sidebar":"sidebar","data-mobile":"true",className:"md:hidden bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{width:ee,maxWidth:ee},side:a,children:[u(U,{className:"sr-only",children:[r(q,{children:"Sidebar"}),r(X,{children:"Displays the mobile sidebar."})]}),r(te.Provider,{value:!0,children:r("div",{className:"flex h-full w-full flex-col",children:s})})]})}),u("aside",{ref:p,className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?n:"","data-variant":t,"data-side":a,children:[r("div",{className:o("w-(--sidebar-width) transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),r("div",{ref:x,"data-banner-closing":C,className:o("fixed z-10 hidden w-(--sidebar-width) transition-[left,right,width,top,height] duration-200 ease-linear md:flex","top-(--sidebar-top) h-[calc(100svh-var(--sidebar-top))]",a==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",i),...c,children:r("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:r("div",{className:"flex flex-col my-2.5 ml-2.5 rounded-2xl border bg-sidebar border-sidebar-border flex-1 min-h-0",children:s})})})]})]})});he.displayName="Sidebar";var re=e.forwardRef(({className:a,onClick:t,...n},i)=>{let{toggleSidebar:s,toggleMobileSidebar:c,openMobile:p}=y();return u(k,{children:[u(D,{"data-sidebar":"trigger",variant:"ghost",size:"icon",className:o("md:hidden bg-transparent hover:bg-transparent",a),onClick:d=>{t?.(d),c()},...n,children:[p?r("span",{className:o(z({variant:"secondary",size:"icon"})),children:r(de,{size:16})}):r("span",{className:o(z({variant:"outline",size:"icon"})),children:r(le,{size:16})}),r("span",{className:"sr-only",children:"Toggle Sidebar"})]}),u(D,{ref:i,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:o("hidden md:inline-flex h-7 w-7",a),onClick:d=>{t?.(d),s()},...n,children:[r("span",{className:"rounded-full p-2",children:r(se,{size:16})}),r("span",{className:"sr-only",children:"Toggle Sidebar"})]})]})});re.displayName="SidebarTrigger";var Re=e.forwardRef(({className:a,...t},n)=>{let{toggleSidebar:i}=y();return r("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:i,title:"Toggle Sidebar",className:o("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",a),...t})});Re.displayName="SidebarRail";var xe=e.memo(e.forwardRef(({className:a,...t},n)=>r("main",{ref:n,className:o("relative flex min-w-0 w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",a),...t})));xe.displayName="SidebarInset";var Se=e.forwardRef(({className:a,...t},n)=>r(K,{ref:n,"data-sidebar":"input",className:o("h-8 w-full bg-sidebar shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",a),...t}));Se.displayName="SidebarInput";var we=e.forwardRef(({className:a,showTrigger:t=!1,children:n,...i},s)=>{let{state:c}=y(),p=e.useContext(te),d=c==="collapsed"&&!p;return u("div",{ref:s,"data-sidebar":"header",className:o("flex w-full gap-2 p-2 items-center",d?"justify-center items-center":"justify-between items-start",a),...i,children:[!d&&r("div",{className:"transition-all duration-200 w-full h-fit flex justify-between overflow-hidden",children:r("div",{className:"whitespace-nowrap",children:n})}),t&&r(re,{})]})});we.displayName="SidebarHeader";var ye=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"footer",className:o("flex flex-col gap-2 p-2",a),...t}));ye.displayName="SidebarFooter";var Ce=e.forwardRef(({className:a,...t},n)=>r(j,{ref:n,"data-sidebar":"separator",className:o("mx-2 w-auto bg-border",a),...t}));Ce.displayName="SidebarSeparator";var Ne=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"content",className:o("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden p-2",a),...t}));Ne.displayName="SidebarContent";var Me=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"group",className:o("relative flex w-full min-w-0 flex-col","group-data-[collapsible=icon]:p-0",a),...t}));Me.displayName="SidebarGroup";var Ee=e.forwardRef(({className:a,asChild:t=!1,...n},i)=>r(t?w:"div",{ref:i,"data-sidebar":"group-label",className:o("flex h-8 shrink-0 items-center rounded-md text-xs font-medium text-secondary-text outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",a),...n}));Ee.displayName="SidebarGroupLabel";var Te=e.forwardRef(({className:a,asChild:t=!1,...n},i)=>r(t?w:"button",{ref:i,"data-sidebar":"group-action",className:o("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",a),...n}));Te.displayName="SidebarGroupAction";var Be=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"group-content",className:o("w-full text-sm",a),...t}));Be.displayName="SidebarGroupContent";var Pe=e.forwardRef(({className:a,...t},n)=>r("ul",{ref:n,"data-sidebar":"menu",className:o("flex w-full min-w-0 flex-col gap-1",a),...t}));Pe.displayName="SidebarMenu";var Ie=e.forwardRef(({className:a,...t},n)=>r("li",{ref:n,"data-sidebar":"menu-item",className:o("group/menu-item relative",a),...t}));Ie.displayName="SidebarMenuItem";var Le=ie("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"",outline:"bg-sidebar shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),He=e.forwardRef(({asChild:a=!1,isActive:t=!1,variant:n="default",size:i="default",tooltip:s,className:c,...p},d)=>{let R=a?w:"button",{state:v}=y(),b=r(R,{ref:d,"data-sidebar":"menu-button","data-size":i,"data-active":t,className:o(Le({variant:n,size:i}),c),...p});return s?(typeof s=="string"&&(s={children:s}),u(J,{children:[r(Q,{asChild:!0,children:b}),r(Z,{side:"right",align:"center",hidden:v!=="collapsed",...s})]})):b});He.displayName="SidebarMenuButton";var ze=e.forwardRef(({className:a,asChild:t=!1,showOnHover:n=!1,...i},s)=>r(t?w:"button",{ref:s,"data-sidebar":"menu-action",className:o("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-base-accent-foreground md:opacity-0",a),...i}));ze.displayName="SidebarMenuAction";var De=e.forwardRef(({className:a,...t},n)=>r("div",{ref:n,"data-sidebar":"menu-badge",className:o("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",a),...t}));De.displayName="SidebarMenuBadge";var _e=e.forwardRef(({className:a,showIcon:t=!1,...n},i)=>{let s=e.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return u("div",{ref:i,"data-sidebar":"menu-skeleton",className:o("flex h-8 items-center gap-2 rounded-md px-2",a),...n,children:[t&&r(_,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),r(_,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});_e.displayName="SidebarMenuSkeleton";var ke=e.forwardRef(({className:a,...t},n)=>r("ul",{ref:n,"data-sidebar":"menu-sub",className:o("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",a),...t}));ke.displayName="SidebarMenuSub";var Ae=e.forwardRef(({...a},t)=>r("li",{ref:t,...a}));Ae.displayName="SidebarMenuSubItem";var Oe=e.forwardRef(({asChild:a=!1,size:t="md",isActive:n,className:i,...s},c)=>r(a?w:"a",{ref:c,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:o("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",i),...s}));Oe.displayName="SidebarMenuSubButton";export{y as a,ge as b,ve as c,he as d,re as e,Re as f,xe as g,Se as h,we as i,ye as j,Ce as k,Ne as l,Me as m,Ee as n,Te as o,Be as p,Pe as q,Ie as r,He as s,ze as t,De as u,_e as v,ke as w,Ae as x,Oe as y};
|
|
3
|
+
//# sourceMappingURL=chunk-YIVVQTGD.mjs.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as e}from"./chunk-S5TKCF6T.mjs";import*as r from"react";import{jsx as d}from"react/jsx-runtime";var l=r.forwardRef(({className:t,type:o,error:n,...i},s)=>d("input",{type:o,className:e("flex my-2 h-8 lg:h-9 w-full rounded-3xl border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-secondary-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n?"border-destructive-foreground focus-visible:ring-destructive-foreground":"border-border",t),ref:s,...i}));l.displayName="Input";export{l as a};
|
|
3
|
+
//# sourceMappingURL=chunk-YSIF7HA3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/input.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n error?: boolean\n}\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, error, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex my-2 h-8 lg:h-9 w-full rounded-3xl border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-secondary-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n error\n ? \"border-destructive-foreground focus-visible:ring-destructive-foreground\"\n : \"border-border\",\n className\n )}\n ref={ref}\n {...props}\n />\n )\n }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n"],"mappings":";yCAAA,UAAYA,MAAW,QAWjB,cAAAC,MAAA,oBAHN,IAAMC,EAAc,aAClB,CAAC,CAAE,UAAAC,EAAW,KAAAC,EAAM,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IAEnCN,EAAC,SACC,KAAMG,EACN,UAAWI,EACT,mYACAH,EACI,0EACA,gBACJF,CACF,EACA,IAAKI,EACJ,GAAGD,EACN,CAGN,EACAJ,EAAM,YAAc","names":["React","jsx","Input","className","type","error","props","ref","cn"]}
|