@bricks-toolkit/toolkit 0.1.0 → 0.1.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/Button.types-BsQYqZml.d.ts +27 -0
- package/dist/Button.types-D-srlWFf.d.mts +27 -0
- package/dist/TextInput.types-DRI8HQza.d.mts +32 -0
- package/dist/TextInput.types-DRI8HQza.d.ts +32 -0
- package/dist/Tooltip.types-PbUasE3C.d.mts +36 -0
- package/dist/Tooltip.types-PbUasE3C.d.ts +36 -0
- package/dist/avatar/index.cjs +1 -0
- package/dist/avatar/index.d.mts +29 -0
- package/dist/avatar/index.d.ts +29 -0
- package/dist/avatar/index.mjs +1 -0
- package/dist/badge/index.cjs +1 -0
- package/dist/badge/index.d.mts +57 -0
- package/dist/badge/index.d.ts +57 -0
- package/dist/badge/index.mjs +1 -0
- package/dist/breadcrumbs/index.cjs +1 -0
- package/dist/breadcrumbs/index.d.mts +32 -0
- package/dist/breadcrumbs/index.d.ts +32 -0
- package/dist/breadcrumbs/index.mjs +1 -0
- package/dist/button/index.cjs +2 -0
- package/dist/button/index.d.mts +8 -0
- package/dist/button/index.d.ts +8 -0
- package/dist/button/index.mjs +2 -0
- package/dist/card/index.cjs +1 -0
- package/dist/card/index.d.mts +42 -0
- package/dist/card/index.d.ts +42 -0
- package/dist/card/index.mjs +1 -0
- package/dist/checkbox/index.cjs +1 -0
- package/dist/checkbox/index.d.mts +36 -0
- package/dist/checkbox/index.d.ts +36 -0
- package/dist/checkbox/index.mjs +1 -0
- package/dist/combo-box/index.cjs +1 -0
- package/dist/combo-box/index.d.mts +62 -0
- package/dist/combo-box/index.d.ts +62 -0
- package/dist/combo-box/index.mjs +1 -0
- package/dist/date-picker/index.cjs +2 -0
- package/dist/date-picker/index.d.mts +32 -0
- package/dist/date-picker/index.d.ts +32 -0
- package/dist/date-picker/index.mjs +2 -0
- package/dist/dialog/index.cjs +1 -0
- package/dist/dialog/index.d.mts +61 -0
- package/dist/dialog/index.d.ts +61 -0
- package/dist/dialog/index.mjs +1 -0
- package/dist/dropdown-menu/index.cjs +1 -0
- package/dist/dropdown-menu/index.d.mts +34 -0
- package/dist/dropdown-menu/index.d.ts +34 -0
- package/dist/dropdown-menu/index.mjs +1 -0
- package/dist/email/index.cjs +2 -0
- package/dist/email/index.d.mts +38 -0
- package/dist/email/index.d.ts +38 -0
- package/dist/email/index.mjs +2 -0
- package/dist/file-upload/index.cjs +1 -0
- package/dist/file-upload/index.d.mts +27 -0
- package/dist/file-upload/index.d.ts +27 -0
- package/dist/file-upload/index.mjs +1 -0
- package/dist/header/index.cjs +2 -0
- package/dist/header/index.d.mts +28 -0
- package/dist/header/index.d.ts +28 -0
- package/dist/header/index.mjs +2 -0
- package/dist/icon-button/index.cjs +2 -0
- package/dist/icon-button/index.d.mts +16 -0
- package/dist/icon-button/index.d.ts +16 -0
- package/dist/icon-button/index.mjs +2 -0
- package/dist/image/index.cjs +1 -0
- package/dist/image/index.d.mts +48 -0
- package/dist/image/index.d.ts +48 -0
- package/dist/image/index.mjs +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.mts +141 -0
- package/dist/index.mjs +2 -0
- package/dist/link/index.cjs +1 -0
- package/dist/link/index.d.mts +25 -0
- package/dist/link/index.d.ts +25 -0
- package/dist/link/index.mjs +1 -0
- package/dist/loader/index.cjs +2 -0
- package/dist/loader/index.d.mts +21 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.mjs +2 -0
- package/dist/modal/index.cjs +1 -0
- package/dist/modal/index.d.mts +116 -0
- package/dist/modal/index.d.ts +116 -0
- package/dist/modal/index.mjs +1 -0
- package/dist/multi-select/index.cjs +2 -0
- package/dist/multi-select/index.d.mts +59 -0
- package/dist/multi-select/index.d.ts +59 -0
- package/dist/multi-select/index.mjs +2 -0
- package/dist/otp-input/index.cjs +1 -0
- package/dist/otp-input/index.d.mts +57 -0
- package/dist/otp-input/index.d.ts +57 -0
- package/dist/otp-input/index.mjs +1 -0
- package/dist/password-input/index.cjs +2 -0
- package/dist/password-input/index.d.mts +32 -0
- package/dist/password-input/index.d.ts +32 -0
- package/dist/password-input/index.mjs +2 -0
- package/dist/phone/index.cjs +2 -0
- package/dist/phone/index.d.mts +41 -0
- package/dist/phone/index.d.ts +41 -0
- package/dist/phone/index.mjs +2 -0
- package/dist/radio-button/index.cjs +1 -0
- package/dist/radio-button/index.d.mts +56 -0
- package/dist/radio-button/index.d.ts +56 -0
- package/dist/radio-button/index.mjs +1 -0
- package/dist/search-input/index.cjs +2 -0
- package/dist/search-input/index.d.mts +22 -0
- package/dist/search-input/index.d.ts +22 -0
- package/dist/search-input/index.mjs +2 -0
- package/dist/select/index.cjs +2 -0
- package/dist/select/index.d.mts +36 -0
- package/dist/select/index.d.ts +36 -0
- package/dist/select/index.mjs +2 -0
- package/dist/sidebar/index.cjs +1 -0
- package/dist/sidebar/index.d.mts +96 -0
- package/dist/sidebar/index.d.ts +96 -0
- package/dist/sidebar/index.mjs +1 -0
- package/dist/skeleton/index.cjs +1 -0
- package/dist/skeleton/index.d.mts +76 -0
- package/dist/skeleton/index.d.ts +76 -0
- package/dist/skeleton/index.mjs +1 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/dist/table/index.cjs +1 -0
- package/dist/table/index.d.mts +92 -0
- package/dist/table/index.d.ts +92 -0
- package/dist/table/index.mjs +1 -0
- package/dist/tabs/index.cjs +2 -0
- package/dist/tabs/index.d.mts +26 -0
- package/dist/tabs/index.d.ts +26 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/text-input/index.cjs +2 -0
- package/dist/text-input/index.d.mts +7 -0
- package/dist/text-input/index.d.ts +7 -0
- package/dist/text-input/index.mjs +2 -0
- package/dist/theme-provider/index.cjs +1 -0
- package/dist/theme-provider/index.d.mts +122 -0
- package/dist/theme-provider/index.d.ts +122 -0
- package/dist/theme-provider/index.mjs +1 -0
- package/dist/time-picker/index.cjs +2 -0
- package/dist/time-picker/index.d.mts +32 -0
- package/dist/time-picker/index.d.ts +32 -0
- package/dist/time-picker/index.mjs +2 -0
- package/dist/toaster/index.cjs +1 -0
- package/dist/toaster/index.d.mts +28 -0
- package/dist/toaster/index.d.ts +28 -0
- package/dist/toaster/index.mjs +1 -0
- package/dist/tooltip/index.cjs +1 -0
- package/dist/tooltip/index.d.mts +7 -0
- package/dist/tooltip/index.d.ts +7 -0
- package/dist/tooltip/index.mjs +1 -0
- package/package.json +56 -54
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useId,useState}from'react';import {EyeSlashIcon,EyeIcon}from'@heroicons/react/24/outline';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function t(...r){return twMerge(clsx(r))}var oe={xs:"h-6 px-2 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-3 text-sm",lg:"h-11 px-4 text-base",xl:"h-12 px-4 text-lg"},de={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},ae={default:"rounded-md border bg-surface shadow-sm focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none focus:ring-0",unstyled:"border-0 bg-transparent p-0 focus:outline-none focus:ring-0"},ie={default:{default:"border-border focus:border-primary focus:ring-primary/40",filled:"focus:border-primary focus:ring-primary/40",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error focus:ring-error/20",filled:"bg-error/5 focus:border-error focus:ring-error/20",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success focus:ring-success/20",filled:"bg-success/5 focus:border-success focus:ring-success/20",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning focus:ring-warning/20",filled:"bg-warning/5 focus:border-warning focus:ring-warning/20",flushed:"border-warning focus:border-warning",unstyled:""}},ce={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"};function ue(r,s,d,o){if(r==="error"&&s)return s;if(r==="success"&&d)return d;if(r==="warning"&&o)return o}function V({children:r,side:s}){return jsx("span",{"aria-hidden":"true",className:t("inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",s==="left"?"rounded-l-md border-r-0":"rounded-r-md border-l-0"),children:r})}var le=forwardRef(function({label:s,required:d=false,helperText:o,errorMessage:z,successMessage:B,warningMessage:H,variant:p="default",size:m="md",state:a="default",fullWidth:g=true,leftElement:b,rightElement:x,prefix:w,suffix:y,wrapperClassName:K,inputGroupClassName:j,inputClassName:$,labelClassName:F,helperClassName:h,id:D,disabled:I,className:T,isLoading:u,showPasswordToggle:v=true,value:U,onChange:q,onKeyUp:P,onKeyDown:N,...G},J){let O=useId(),i=D??O,R=`${i}-helper`,k=`${i}-state`,C=`${i}-capslock`,[l,Q]=useState(false),[S,E]=useState(false),W=n=>{E(n.getModifierState("CapsLock")),P&&P(n);},X=n=>{E(n.getModifierState("CapsLock")),N&&N(n);},L=b!==void 0,A=x!==void 0||!!u||v,f=ue(a,z,B,H),Y=[o?R:null,f?k:null,S?C:null].filter(Boolean).join(" ")||void 0,Z=()=>u?jsxs("svg",{className:"animate-spin h-5 w-5 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):v?jsx("button",{type:"button",tabIndex:-1,onClick:()=>{Q(n=>!n);},className:"flex items-center justify-center rounded-full text-text-muted hover:text-text transition focus:outline-none w-6 h-6","aria-label":l?"Hide password":"Show password",children:l?jsx(EyeSlashIcon,{className:"w-5 h-5"}):jsx(EyeIcon,{className:"w-5 h-5"})}):x;return jsxs("div",{className:t("flex flex-col gap-1",g?"w-full":"w-fit",K,T),children:[s!==void 0&&jsxs("label",{htmlFor:i,className:t("font-black leading-none mb-2 text-text uppercase tracking-widest",de[m],F),children:[s,d&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxs("div",{className:t("flex items-stretch transition-all duration-150 overflow-hidden",ae[p],ie[a][p],g?"w-full":"w-fit","focus-within:ring-4 focus-within:ring-primary/20 focus-within:border-primary",I&&"opacity-50 cursor-not-allowed bg-surface-secondary",j),children:[w!==void 0&&jsx(V,{side:"left",children:w}),jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[L&&jsx("div",{className:"pl-3 flex-shrink-0 flex items-center justify-center",children:b}),jsx("div",{className:"flex-1 min-w-0 h-full",children:jsx("input",{ref:J,...G,id:i,disabled:!!I||!!u,type:l?"text":"password",value:U,onChange:q,onKeyUp:W,onKeyDown:X,"aria-invalid":a==="error"?true:void 0,"aria-describedby":Y,"aria-required":d,className:t("w-full bg-transparent border-0 focus:outline-none focus:ring-0 outline-none h-full",oe[m],$),style:{paddingLeft:L?"0.5rem":void 0,paddingRight:A?"0.5rem":void 0}})}),A&&jsx("div",{className:"pr-3 flex-shrink-0 flex items-center justify-center text-text-secondary",style:{width:"2.5rem"},children:Z()})]}),y!==void 0&&jsx(V,{side:"right",children:y})]}),o!==void 0&&jsx("p",{id:R,className:t("text-xs leading-tight text-text-muted",h),children:o}),S&&jsx("p",{id:C,className:"text-xs leading-tight text-warning font-black uppercase tracking-widest",children:"Caps Lock is on"}),f!==void 0&&jsx("p",{id:k,role:a==="error"?"alert":void 0,className:t("text-xs leading-tight mt-1",ce[a],h),children:f})]})});le.displayName="PasswordInput";
|
|
2
|
+
export{le as PasswordInput};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),solid=require('@heroicons/react/20/solid'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function n(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var w=[{name:"Afghanistan",id:"AF",dialCode:"+93",maxLength:9,flag:"\u{1F1E6}\u{1F1EB}"},{name:"Albania",id:"AL",dialCode:"+355",maxLength:9,flag:"\u{1F1E6}\u{1F1F1}"},{name:"Algeria",id:"DZ",dialCode:"+213",maxLength:9,flag:"\u{1F1E9}\u{1F1FF}"},{name:"Andorra",id:"AD",dialCode:"+376",maxLength:6,flag:"\u{1F1E6}\u{1F1E9}"},{name:"Angola",id:"AO",dialCode:"+244",maxLength:9,flag:"\u{1F1E6}\u{1F1F4}"},{name:"Argentina",id:"AR",dialCode:"+54",maxLength:10,flag:"\u{1F1E6}\u{1F1F7}"},{name:"Armenia",id:"AM",dialCode:"+374",maxLength:8,flag:"\u{1F1E6}\u{1F1F2}"},{name:"Australia",id:"AU",dialCode:"+61",maxLength:9,flag:"\u{1F1E6}\u{1F1FA}"},{name:"Austria",id:"AT",dialCode:"+43",maxLength:13,flag:"\u{1F1E6}\u{1F1F9}"},{name:"Azerbaijan",id:"AZ",dialCode:"+994",maxLength:9,flag:"\u{1F1E6}\u{1F1FF}"},{name:"Bahrain",id:"BH",dialCode:"+973",maxLength:8,flag:"\u{1F1E7}\u{1F1ED}"},{name:"Bangladesh",id:"BD",dialCode:"+880",maxLength:10,flag:"\u{1F1E7}\u{1F1E9}"},{name:"Belarus",id:"BY",dialCode:"+375",maxLength:9,flag:"\u{1F1E7}\u{1F1FE}"},{name:"Belgium",id:"BE",dialCode:"+32",maxLength:9,flag:"\u{1F1E7}\u{1F1EA}"},{name:"Bolivia",id:"BO",dialCode:"+591",maxLength:8,flag:"\u{1F1E7}\u{1F1F4}"},{name:"Bosnia and Herzegovina",id:"BA",dialCode:"+387",maxLength:8,flag:"\u{1F1E7}\u{1F1E6}"},{name:"Brazil",id:"BR",dialCode:"+55",maxLength:11,flag:"\u{1F1E7}\u{1F1F7}"},{name:"Bulgaria",id:"BG",dialCode:"+359",maxLength:9,flag:"\u{1F1E7}\u{1F1EC}"},{name:"Cambodia",id:"KH",dialCode:"+855",maxLength:9,flag:"\u{1F1F0}\u{1F1ED}"},{name:"Canada",id:"CA",dialCode:"+1",maxLength:10,flag:"\u{1F1E8}\u{1F1E6}"},{name:"Chile",id:"CL",dialCode:"+56",maxLength:9,flag:"\u{1F1E8}\u{1F1F1}"},{name:"China",id:"CN",dialCode:"+86",maxLength:11,flag:"\u{1F1E8}\u{1F1F3}"},{name:"Colombia",id:"CO",dialCode:"+57",maxLength:10,flag:"\u{1F1E8}\u{1F1F4}"},{name:"Costa Rica",id:"CR",dialCode:"+506",maxLength:8,flag:"\u{1F1E8}\u{1F1F7}"},{name:"Croatia",id:"HR",dialCode:"+385",maxLength:9,flag:"\u{1F1ED}\u{1F1F7}"},{name:"Cuba",id:"CU",dialCode:"+53",maxLength:8,flag:"\u{1F1E8}\u{1F1FA}"},{name:"Cyprus",id:"CY",dialCode:"+357",maxLength:8,flag:"\u{1F1E8}\u{1F1FE}"},{name:"Czech Republic",id:"CZ",dialCode:"+420",maxLength:9,flag:"\u{1F1E8}\u{1F1FF}"},{name:"Denmark",id:"DK",dialCode:"+45",maxLength:8,flag:"\u{1F1E9}\u{1F1F0}"},{name:"Ecuador",id:"EC",dialCode:"+593",maxLength:9,flag:"\u{1F1EA}\u{1F1E8}"},{name:"Egypt",id:"EG",dialCode:"+20",maxLength:10,flag:"\u{1F1EA}\u{1F1EC}"},{name:"Estonia",id:"EE",dialCode:"+372",maxLength:8,flag:"\u{1F1EA}\u{1F1EA}"},{name:"Ethiopia",id:"ET",dialCode:"+251",maxLength:9,flag:"\u{1F1EA}\u{1F1F9}"},{name:"Finland",id:"FI",dialCode:"+358",maxLength:10,flag:"\u{1F1EB}\u{1F1EE}"},{name:"France",id:"FR",dialCode:"+33",maxLength:9,flag:"\u{1F1EB}\u{1F1F7}"},{name:"Georgia",id:"GE",dialCode:"+995",maxLength:9,flag:"\u{1F1EC}\u{1F1EA}"},{name:"Germany",id:"DE",dialCode:"+49",maxLength:11,flag:"\u{1F1E9}\u{1F1EA}"},{name:"Ghana",id:"GH",dialCode:"+233",maxLength:9,flag:"\u{1F1EC}\u{1F1ED}"},{name:"Greece",id:"GR",dialCode:"+30",maxLength:10,flag:"\u{1F1EC}\u{1F1F7}"},{name:"Guatemala",id:"GT",dialCode:"+502",maxLength:8,flag:"\u{1F1EC}\u{1F1F9}"},{name:"Hong Kong",id:"HK",dialCode:"+852",maxLength:8,flag:"\u{1F1ED}\u{1F1F0}"},{name:"Hungary",id:"HU",dialCode:"+36",maxLength:9,flag:"\u{1F1ED}\u{1F1FA}"},{name:"Iceland",id:"IS",dialCode:"+354",maxLength:7,flag:"\u{1F1EE}\u{1F1F8}"},{name:"India",id:"IN",dialCode:"+91",maxLength:10,flag:"\u{1F1EE}\u{1F1F3}"},{name:"Indonesia",id:"ID",dialCode:"+62",maxLength:12,flag:"\u{1F1EE}\u{1F1E9}"},{name:"Iran",id:"IR",dialCode:"+98",maxLength:10,flag:"\u{1F1EE}\u{1F1F7}"},{name:"Iraq",id:"IQ",dialCode:"+964",maxLength:10,flag:"\u{1F1EE}\u{1F1F6}"},{name:"Ireland",id:"IE",dialCode:"+353",maxLength:9,flag:"\u{1F1EE}\u{1F1EA}"},{name:"Israel",id:"IL",dialCode:"+972",maxLength:9,flag:"\u{1F1EE}\u{1F1F1}"},{name:"Italy",id:"IT",dialCode:"+39",maxLength:10,flag:"\u{1F1EE}\u{1F1F9}"},{name:"Japan",id:"JP",dialCode:"+81",maxLength:10,flag:"\u{1F1EF}\u{1F1F5}"},{name:"Jordan",id:"JO",dialCode:"+962",maxLength:9,flag:"\u{1F1EF}\u{1F1F4}"},{name:"Kazakhstan",id:"KZ",dialCode:"+7",maxLength:10,flag:"\u{1F1F0}\u{1F1FF}"},{name:"Kenya",id:"KE",dialCode:"+254",maxLength:9,flag:"\u{1F1F0}\u{1F1EA}"},{name:"Kuwait",id:"KW",dialCode:"+965",maxLength:8,flag:"\u{1F1F0}\u{1F1FC}"},{name:"Latvia",id:"LV",dialCode:"+371",maxLength:8,flag:"\u{1F1F1}\u{1F1FB}"},{name:"Lebanon",id:"LB",dialCode:"+961",maxLength:8,flag:"\u{1F1F1}\u{1F1E7}"},{name:"Lithuania",id:"LT",dialCode:"+370",maxLength:8,flag:"\u{1F1F1}\u{1F1F9}"},{name:"Luxembourg",id:"LU",dialCode:"+352",maxLength:9,flag:"\u{1F1F1}\u{1F1FA}"},{name:"Macau",id:"MO",dialCode:"+853",maxLength:8,flag:"\u{1F1F2}\u{1F1F4}"},{name:"Malaysia",id:"MY",dialCode:"+60",maxLength:10,flag:"\u{1F1F2}\u{1F1FE}"},{name:"Mexico",id:"MX",dialCode:"+52",maxLength:10,flag:"\u{1F1F2}\u{1F1FD}"},{name:"Morocco",id:"MA",dialCode:"+212",maxLength:9,flag:"\u{1F1F2}\u{1F1E6}"},{name:"Myanmar",id:"MM",dialCode:"+95",maxLength:9,flag:"\u{1F1F2}\u{1F1F2}"},{name:"Nepal",id:"NP",dialCode:"+977",maxLength:10,flag:"\u{1F1F3}\u{1F1F5}"},{name:"Netherlands",id:"NL",dialCode:"+31",maxLength:9,flag:"\u{1F1F3}\u{1F1F1}"},{name:"New Zealand",id:"NZ",dialCode:"+64",maxLength:9,flag:"\u{1F1F3}\u{1F1FF}"},{name:"Nigeria",id:"NG",dialCode:"+234",maxLength:10,flag:"\u{1F1F3}\u{1F1EC}"},{name:"Norway",id:"NO",dialCode:"+47",maxLength:8,flag:"\u{1F1F3}\u{1F1F4}"},{name:"Oman",id:"OM",dialCode:"+968",maxLength:8,flag:"\u{1F1F4}\u{1F1F2}"},{name:"Pakistan",id:"PK",dialCode:"+92",maxLength:10,flag:"\u{1F1F5}\u{1F1F0}"},{name:"Panama",id:"PA",dialCode:"+507",maxLength:8,flag:"\u{1F1F5}\u{1F1E6}"},{name:"Paraguay",id:"PY",dialCode:"+595",maxLength:9,flag:"\u{1F1F5}\u{1F1FE}"},{name:"Peru",id:"PE",dialCode:"+51",maxLength:9,flag:"\u{1F1F5}\u{1F1EA}"},{name:"Philippines",id:"PH",dialCode:"+63",maxLength:10,flag:"\u{1F1F5}\u{1F1ED}"},{name:"Poland",id:"PL",dialCode:"+48",maxLength:9,flag:"\u{1F1F5}\u{1F1F1}"},{name:"Portugal",id:"PT",dialCode:"+351",maxLength:9,flag:"\u{1F1F5}\u{1F1F9}"},{name:"Qatar",id:"QA",dialCode:"+974",maxLength:8,flag:"\u{1F1F6}\u{1F1E6}"},{name:"Romania",id:"RO",dialCode:"+40",maxLength:9,flag:"\u{1F1F7}\u{1F1F4}"},{name:"Russia",id:"RU",dialCode:"+7",maxLength:10,flag:"\u{1F1F7}\u{1F1FA}"},{name:"Saudi Arabia",id:"SA",dialCode:"+966",maxLength:9,flag:"\u{1F1F8}\u{1F1E6}"},{name:"Serbia",id:"RS",dialCode:"+381",maxLength:9,flag:"\u{1F1F7}\u{1F1F8}"},{name:"Singapore",id:"SG",dialCode:"+65",maxLength:8,flag:"\u{1F1F8}\u{1F1EC}"},{name:"Slovakia",id:"SK",dialCode:"+421",maxLength:9,flag:"\u{1F1F8}\u{1F1F0}"},{name:"Slovenia",id:"SI",dialCode:"+386",maxLength:8,flag:"\u{1F1F8}\u{1F1EE}"},{name:"South Africa",id:"ZA",dialCode:"+27",maxLength:9,flag:"\u{1F1FF}\u{1F1E6}"},{name:"South Korea",id:"KR",dialCode:"+82",maxLength:10,flag:"\u{1F1F0}\u{1F1F7}"},{name:"Spain",id:"ES",dialCode:"+34",maxLength:9,flag:"\u{1F1EA}\u{1F1F8}"},{name:"Sri Lanka",id:"LK",dialCode:"+94",maxLength:9,flag:"\u{1F1F1}\u{1F1F0}"},{name:"Sweden",id:"SE",dialCode:"+46",maxLength:9,flag:"\u{1F1F8}\u{1F1EA}"},{name:"Switzerland",id:"CH",dialCode:"+41",maxLength:9,flag:"\u{1F1E8}\u{1F1ED}"},{name:"Syria",id:"SY",dialCode:"+963",maxLength:9,flag:"\u{1F1F8}\u{1F1FE}"},{name:"Taiwan",id:"TW",dialCode:"+886",maxLength:9,flag:"\u{1F1F9}\u{1F1FC}"},{name:"Thailand",id:"TH",dialCode:"+66",maxLength:9,flag:"\u{1F1F9}\u{1F1ED}"},{name:"Tunisia",id:"TN",dialCode:"+216",maxLength:8,flag:"\u{1F1F9}\u{1F1F3}"},{name:"Turkey",id:"TR",dialCode:"+90",maxLength:10,flag:"\u{1F1F9}\u{1F1F7}"},{name:"Ukraine",id:"UA",dialCode:"+380",maxLength:9,flag:"\u{1F1FA}\u{1F1E6}"},{name:"United Arab Emirates",id:"AE",dialCode:"+971",maxLength:9,flag:"\u{1F1E6}\u{1F1EA}"},{name:"United Kingdom",id:"GB",dialCode:"+44",maxLength:10,flag:"\u{1F1EC}\u{1F1E7}"},{name:"United States",id:"US",dialCode:"+1",maxLength:10,flag:"\u{1F1FA}\u{1F1F8}"},{name:"Uruguay",id:"UY",dialCode:"+598",maxLength:8,flag:"\u{1F1FA}\u{1F1FE}"},{name:"Uzbekistan",id:"UZ",dialCode:"+998",maxLength:9,flag:"\u{1F1FA}\u{1F1FF}"},{name:"Venezuela",id:"VE",dialCode:"+58",maxLength:10,flag:"\u{1F1FB}\u{1F1EA}"},{name:"Vietnam",id:"VN",dialCode:"+84",maxLength:9,flag:"\u{1F1FB}\u{1F1F3}"},{name:"Yemen",id:"YE",dialCode:"+967",maxLength:9,flag:"\u{1F1FE}\u{1F1EA}"}];var ve={xs:"h-6 text-xs",sm:"h-8 text-sm",md:"h-10 text-sm",lg:"h-11 text-base",xl:"h-12 text-lg"},Pe={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},Se={default:"rounded-md border border-border bg-surface shadow-sm focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",filled:"rounded-md border border-transparent bg-surface-secondary focus-within:bg-surface focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",flushed:"rounded-none border-0 border-b border-border bg-transparent focus-within:border-primary transition-all",unstyled:"border-0 bg-transparent p-0"},Ee={default:{default:"border-border focus-within:border-primary focus-within:ring-primary/40",filled:"focus-within:border-primary focus-within:ring-primary/40",flushed:"border-border focus-within:border-primary",unstyled:""},error:{default:"border-error focus-within:border-error focus-within:ring-error/20",filled:"bg-error/5 focus-within:border-error focus-within:ring-error/20",flushed:"border-error focus-within:border-error",unstyled:""},success:{default:"border-success focus-within:border-success focus-within:ring-success/20",filled:"bg-success/5 focus-within:border-success focus-within:ring-success/20",flushed:"border-success focus-within:border-success",unstyled:""},warning:{default:"border-warning focus-within:border-warning focus-within:ring-warning/20",filled:"bg-warning/5 border-warning focus-within:border-warning focus-within:ring-warning/20",flushed:"border-warning focus-within:border-warning",unstyled:""}},Ie={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"},Re="cursor-not-allowed opacity-50 bg-surface-secondary [&_*]:cursor-not-allowed";function Ae(o,l,s,r){if(o==="error"&&l)return l;if(o==="success"&&s)return s;if(o==="warning"&&r)return r}var Be=react.forwardRef(function({label:l,required:s=false,helperText:r,errorMessage:Z,successMessage:F,warningMessage:j,variant:u="default",size:R="md",state:J="default",fullWidth:A=true,leftElement:B,rightElement:M,prefix:m,suffix:c,wrapperClassName:Q,inputGroupClassName:W,inputClassName:X,labelClassName:$,helperClassName:k,id:q,disabled:h,className:_,clearable:ee,isLoading:x,value:T,defaultValue:ae,onChange:z,showFlag:ne=true,defaultCountryCode:K="+91",autoComplete:te="tel",...de},ie){let oe=react.useId(),C=q??oe,H=`${C}-helper`,U=`${C}-state`,[V,N]=react.useState(null),[g,p]=react.useState(false),[v,P]=react.useState(""),S=react.useRef(null),[re,le]=react.useState(ae??{countryCode:K,phoneNumber:""}),O=T!==void 0,t=O?T:re,b=w.find(e=>e.dialCode===t.countryCode)??w[0],G=b?.maxLength??15,D=ee&&t.phoneNumber.length>0,se=B!==void 0,me=M!==void 0||!!D||!!x,f=V?"error":J,E=Ae(f,V??Z,F,j),ge=[r?H:null,E?U:null].filter(Boolean).join(" ")||void 0,L=e=>{O||le(e),z&&z(e);},fe=e=>{let d=e.target.value,I=d.replace(/\D/g,"");N(I!==d?"Only numbers are allowed":null),!(I.length>G)&&L({...t,phoneNumber:I});},ue=()=>{N(null),L({...t,phoneNumber:""});};react.useEffect(()=>{if(!g)return;let e=d=>{S.current&&!S.current.contains(d.target)&&p(false);};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e);}},[g]);let Y=w.filter(e=>e.name.toLowerCase().includes(v.toLowerCase())||e.dialCode.includes(v)),ce=()=>x?jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):D?jsxRuntime.jsx("button",{type:"button",onClick:ue,disabled:h,className:"flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-hover p-0.5 transition-all duration-fast disabled:cursor-not-allowed","aria-label":"Clear input",children:jsxRuntime.jsx(solid.XMarkIcon,{className:"w-4 h-4"})}):M,he=m!==void 0||u==="flushed"||u==="unstyled"?"":"rounded-l-md";return jsxRuntime.jsxs("div",{className:n("flex flex-col gap-1",A?"w-full":"w-fit",Q,_),children:[l!==void 0&&jsxRuntime.jsxs("label",{htmlFor:C,className:n("font-black leading-none text-text mb-2 uppercase tracking-widest",Pe[R],$),children:[l,s&&jsxRuntime.jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxRuntime.jsxs("div",{className:n("flex items-stretch",A?"w-full":"w-fit",W),children:[m!==void 0&&jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-l-md border border-r-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",children:m}),jsxRuntime.jsxs("div",{ref:S,className:n("relative flex flex-1 items-stretch",ve[R],Se[u],Ee[f][u],h?Re:"",m!==void 0&&c!==void 0?"rounded-none":m!==void 0?"rounded-l-none":c!==void 0?"rounded-r-none":""),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(!g);},disabled:!!h||!!x,className:n("relative flex items-center justify-center flex-shrink-0 px-2 sm:px-3 text-text bg-surface-secondary border-r border-border hover:bg-hover active:bg-active transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:z-10 disabled:cursor-not-allowed",he),children:[ne&&b&&jsxRuntime.jsx("span",{className:"mr-1.5 text-base sm:text-lg opacity-90",children:b.flag}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:b?.dialCode??K}),jsxRuntime.jsx(solid.ChevronDownIcon,{className:n("w-3.5 h-3.5 ml-1.5 text-text-secondary transition-transform",g&&"rotate-180")})]}),g&&jsxRuntime.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 rounded-md border border-border bg-surface p-1 shadow-lg z-dropdown flex flex-col animate-in fade-in zoom-in-95 duration-fast",children:[jsxRuntime.jsx("div",{className:"px-2 py-1.5 pb-2 sticky top-0 bg-surface z-10 border-b border-divider",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search country...",className:"w-full text-sm bg-transparent px-1 focus:outline-none text-text placeholder:text-text-muted",value:v,onChange:e=>{P(e.target.value);},onKeyDown:e=>{e.stopPropagation();}})}),jsxRuntime.jsx("ul",{role:"listbox",className:"max-h-56 overflow-y-auto overflow-x-hidden p-1 scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",children:Y.length>0?Y.map(e=>jsxRuntime.jsxs("li",{role:"option",tabIndex:0,"aria-selected":t.countryCode===e.dialCode,className:n("flex items-center px-2 py-1.5 text-sm rounded-sm cursor-pointer transition-colors outline-none focus:bg-hover active:bg-active",t.countryCode===e.dialCode?"bg-primary/10 text-primary font-medium":"text-text"),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),L({...t,countryCode:e.dialCode}),p(false),P(""));},onClick:()=>{L({...t,countryCode:e.dialCode}),p(false),P("");},children:[jsxRuntime.jsx("span",{className:"mr-2 text-base",children:e.flag}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:e.name}),jsxRuntime.jsx("span",{className:n("text-xs ml-2",t.countryCode===e.dialCode?"text-primary/70":"text-text-muted"),children:e.dialCode})]},e.id)):jsxRuntime.jsx("li",{className:"px-2 py-3 text-center text-sm text-text-muted",children:"No countries found"})})]}),se&&jsxRuntime.jsx("div",{className:"flex items-center pl-3",children:jsxRuntime.jsx("span",{className:"text-text-secondary flex items-center justify-center",children:B})}),jsxRuntime.jsx("input",{ref:ie,...de,id:C,disabled:!!h||!!x,type:"tel",inputMode:"numeric",value:t.phoneNumber,onChange:fe,autoComplete:te,"aria-invalid":f==="error"?true:void 0,"aria-describedby":ge,"aria-required":s,maxLength:G,className:n("flex-1 w-full bg-transparent border-none outline-none focus:ring-0 focus:outline-none focus:border-none focus-visible:ring-0 focus-visible:outline-none px-3 min-w-0 transition-colors duration-150 disabled:cursor-not-allowed",X)}),me&&jsxRuntime.jsx("div",{className:"flex items-center pr-3",children:jsxRuntime.jsx("span",{className:"text-text-secondary flex items-center justify-center",children:ce()})})]}),c!==void 0&&jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-r-md border border-l-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",children:c})]}),r!==void 0&&jsxRuntime.jsx("p",{id:H,className:n("text-xs leading-tight text-text-muted",k),children:r}),E!==void 0&&jsxRuntime.jsx("p",{id:U,role:f==="error"?"alert":void 0,className:n("text-xs leading-tight mt-1",Ie[f],k),children:E})]})});Be.displayName="Phone";
|
|
2
|
+
exports.Phone=Be;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type PhoneVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
|
|
4
|
+
type PhoneSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type PhoneState = 'default' | 'error' | 'success' | 'warning';
|
|
6
|
+
interface PhoneValue {
|
|
7
|
+
countryCode: string;
|
|
8
|
+
phoneNumber: string;
|
|
9
|
+
}
|
|
10
|
+
interface PhoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type' | 'value' | 'defaultValue' | 'onChange'> {
|
|
11
|
+
value?: PhoneValue;
|
|
12
|
+
defaultValue?: PhoneValue;
|
|
13
|
+
onChange?: (value: PhoneValue) => void;
|
|
14
|
+
showFlag?: boolean;
|
|
15
|
+
defaultCountryCode?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
helperText?: string;
|
|
19
|
+
errorMessage?: string;
|
|
20
|
+
successMessage?: string;
|
|
21
|
+
warningMessage?: string;
|
|
22
|
+
variant?: PhoneVariant;
|
|
23
|
+
size?: PhoneSize;
|
|
24
|
+
state?: PhoneState;
|
|
25
|
+
fullWidth?: boolean;
|
|
26
|
+
leftElement?: ReactNode;
|
|
27
|
+
rightElement?: ReactNode;
|
|
28
|
+
prefix?: ReactNode;
|
|
29
|
+
suffix?: ReactNode;
|
|
30
|
+
wrapperClassName?: string;
|
|
31
|
+
inputGroupClassName?: string;
|
|
32
|
+
inputClassName?: string;
|
|
33
|
+
labelClassName?: string;
|
|
34
|
+
helperClassName?: string;
|
|
35
|
+
clearable?: boolean;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare const Phone: React.ForwardRefExoticComponent<PhoneProps & React.RefAttributes<HTMLInputElement>>;
|
|
40
|
+
|
|
41
|
+
export { Phone, type PhoneProps, type PhoneSize, type PhoneState, type PhoneValue, type PhoneVariant };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type PhoneVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
|
|
4
|
+
type PhoneSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type PhoneState = 'default' | 'error' | 'success' | 'warning';
|
|
6
|
+
interface PhoneValue {
|
|
7
|
+
countryCode: string;
|
|
8
|
+
phoneNumber: string;
|
|
9
|
+
}
|
|
10
|
+
interface PhoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type' | 'value' | 'defaultValue' | 'onChange'> {
|
|
11
|
+
value?: PhoneValue;
|
|
12
|
+
defaultValue?: PhoneValue;
|
|
13
|
+
onChange?: (value: PhoneValue) => void;
|
|
14
|
+
showFlag?: boolean;
|
|
15
|
+
defaultCountryCode?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
helperText?: string;
|
|
19
|
+
errorMessage?: string;
|
|
20
|
+
successMessage?: string;
|
|
21
|
+
warningMessage?: string;
|
|
22
|
+
variant?: PhoneVariant;
|
|
23
|
+
size?: PhoneSize;
|
|
24
|
+
state?: PhoneState;
|
|
25
|
+
fullWidth?: boolean;
|
|
26
|
+
leftElement?: ReactNode;
|
|
27
|
+
rightElement?: ReactNode;
|
|
28
|
+
prefix?: ReactNode;
|
|
29
|
+
suffix?: ReactNode;
|
|
30
|
+
wrapperClassName?: string;
|
|
31
|
+
inputGroupClassName?: string;
|
|
32
|
+
inputClassName?: string;
|
|
33
|
+
labelClassName?: string;
|
|
34
|
+
helperClassName?: string;
|
|
35
|
+
clearable?: boolean;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare const Phone: React.ForwardRefExoticComponent<PhoneProps & React.RefAttributes<HTMLInputElement>>;
|
|
40
|
+
|
|
41
|
+
export { Phone, type PhoneProps, type PhoneSize, type PhoneState, type PhoneValue, type PhoneVariant };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useId,useState,useRef,useEffect}from'react';import {ChevronDownIcon,XMarkIcon}from'@heroicons/react/20/solid';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function n(...o){return twMerge(clsx(o))}var w=[{name:"Afghanistan",id:"AF",dialCode:"+93",maxLength:9,flag:"\u{1F1E6}\u{1F1EB}"},{name:"Albania",id:"AL",dialCode:"+355",maxLength:9,flag:"\u{1F1E6}\u{1F1F1}"},{name:"Algeria",id:"DZ",dialCode:"+213",maxLength:9,flag:"\u{1F1E9}\u{1F1FF}"},{name:"Andorra",id:"AD",dialCode:"+376",maxLength:6,flag:"\u{1F1E6}\u{1F1E9}"},{name:"Angola",id:"AO",dialCode:"+244",maxLength:9,flag:"\u{1F1E6}\u{1F1F4}"},{name:"Argentina",id:"AR",dialCode:"+54",maxLength:10,flag:"\u{1F1E6}\u{1F1F7}"},{name:"Armenia",id:"AM",dialCode:"+374",maxLength:8,flag:"\u{1F1E6}\u{1F1F2}"},{name:"Australia",id:"AU",dialCode:"+61",maxLength:9,flag:"\u{1F1E6}\u{1F1FA}"},{name:"Austria",id:"AT",dialCode:"+43",maxLength:13,flag:"\u{1F1E6}\u{1F1F9}"},{name:"Azerbaijan",id:"AZ",dialCode:"+994",maxLength:9,flag:"\u{1F1E6}\u{1F1FF}"},{name:"Bahrain",id:"BH",dialCode:"+973",maxLength:8,flag:"\u{1F1E7}\u{1F1ED}"},{name:"Bangladesh",id:"BD",dialCode:"+880",maxLength:10,flag:"\u{1F1E7}\u{1F1E9}"},{name:"Belarus",id:"BY",dialCode:"+375",maxLength:9,flag:"\u{1F1E7}\u{1F1FE}"},{name:"Belgium",id:"BE",dialCode:"+32",maxLength:9,flag:"\u{1F1E7}\u{1F1EA}"},{name:"Bolivia",id:"BO",dialCode:"+591",maxLength:8,flag:"\u{1F1E7}\u{1F1F4}"},{name:"Bosnia and Herzegovina",id:"BA",dialCode:"+387",maxLength:8,flag:"\u{1F1E7}\u{1F1E6}"},{name:"Brazil",id:"BR",dialCode:"+55",maxLength:11,flag:"\u{1F1E7}\u{1F1F7}"},{name:"Bulgaria",id:"BG",dialCode:"+359",maxLength:9,flag:"\u{1F1E7}\u{1F1EC}"},{name:"Cambodia",id:"KH",dialCode:"+855",maxLength:9,flag:"\u{1F1F0}\u{1F1ED}"},{name:"Canada",id:"CA",dialCode:"+1",maxLength:10,flag:"\u{1F1E8}\u{1F1E6}"},{name:"Chile",id:"CL",dialCode:"+56",maxLength:9,flag:"\u{1F1E8}\u{1F1F1}"},{name:"China",id:"CN",dialCode:"+86",maxLength:11,flag:"\u{1F1E8}\u{1F1F3}"},{name:"Colombia",id:"CO",dialCode:"+57",maxLength:10,flag:"\u{1F1E8}\u{1F1F4}"},{name:"Costa Rica",id:"CR",dialCode:"+506",maxLength:8,flag:"\u{1F1E8}\u{1F1F7}"},{name:"Croatia",id:"HR",dialCode:"+385",maxLength:9,flag:"\u{1F1ED}\u{1F1F7}"},{name:"Cuba",id:"CU",dialCode:"+53",maxLength:8,flag:"\u{1F1E8}\u{1F1FA}"},{name:"Cyprus",id:"CY",dialCode:"+357",maxLength:8,flag:"\u{1F1E8}\u{1F1FE}"},{name:"Czech Republic",id:"CZ",dialCode:"+420",maxLength:9,flag:"\u{1F1E8}\u{1F1FF}"},{name:"Denmark",id:"DK",dialCode:"+45",maxLength:8,flag:"\u{1F1E9}\u{1F1F0}"},{name:"Ecuador",id:"EC",dialCode:"+593",maxLength:9,flag:"\u{1F1EA}\u{1F1E8}"},{name:"Egypt",id:"EG",dialCode:"+20",maxLength:10,flag:"\u{1F1EA}\u{1F1EC}"},{name:"Estonia",id:"EE",dialCode:"+372",maxLength:8,flag:"\u{1F1EA}\u{1F1EA}"},{name:"Ethiopia",id:"ET",dialCode:"+251",maxLength:9,flag:"\u{1F1EA}\u{1F1F9}"},{name:"Finland",id:"FI",dialCode:"+358",maxLength:10,flag:"\u{1F1EB}\u{1F1EE}"},{name:"France",id:"FR",dialCode:"+33",maxLength:9,flag:"\u{1F1EB}\u{1F1F7}"},{name:"Georgia",id:"GE",dialCode:"+995",maxLength:9,flag:"\u{1F1EC}\u{1F1EA}"},{name:"Germany",id:"DE",dialCode:"+49",maxLength:11,flag:"\u{1F1E9}\u{1F1EA}"},{name:"Ghana",id:"GH",dialCode:"+233",maxLength:9,flag:"\u{1F1EC}\u{1F1ED}"},{name:"Greece",id:"GR",dialCode:"+30",maxLength:10,flag:"\u{1F1EC}\u{1F1F7}"},{name:"Guatemala",id:"GT",dialCode:"+502",maxLength:8,flag:"\u{1F1EC}\u{1F1F9}"},{name:"Hong Kong",id:"HK",dialCode:"+852",maxLength:8,flag:"\u{1F1ED}\u{1F1F0}"},{name:"Hungary",id:"HU",dialCode:"+36",maxLength:9,flag:"\u{1F1ED}\u{1F1FA}"},{name:"Iceland",id:"IS",dialCode:"+354",maxLength:7,flag:"\u{1F1EE}\u{1F1F8}"},{name:"India",id:"IN",dialCode:"+91",maxLength:10,flag:"\u{1F1EE}\u{1F1F3}"},{name:"Indonesia",id:"ID",dialCode:"+62",maxLength:12,flag:"\u{1F1EE}\u{1F1E9}"},{name:"Iran",id:"IR",dialCode:"+98",maxLength:10,flag:"\u{1F1EE}\u{1F1F7}"},{name:"Iraq",id:"IQ",dialCode:"+964",maxLength:10,flag:"\u{1F1EE}\u{1F1F6}"},{name:"Ireland",id:"IE",dialCode:"+353",maxLength:9,flag:"\u{1F1EE}\u{1F1EA}"},{name:"Israel",id:"IL",dialCode:"+972",maxLength:9,flag:"\u{1F1EE}\u{1F1F1}"},{name:"Italy",id:"IT",dialCode:"+39",maxLength:10,flag:"\u{1F1EE}\u{1F1F9}"},{name:"Japan",id:"JP",dialCode:"+81",maxLength:10,flag:"\u{1F1EF}\u{1F1F5}"},{name:"Jordan",id:"JO",dialCode:"+962",maxLength:9,flag:"\u{1F1EF}\u{1F1F4}"},{name:"Kazakhstan",id:"KZ",dialCode:"+7",maxLength:10,flag:"\u{1F1F0}\u{1F1FF}"},{name:"Kenya",id:"KE",dialCode:"+254",maxLength:9,flag:"\u{1F1F0}\u{1F1EA}"},{name:"Kuwait",id:"KW",dialCode:"+965",maxLength:8,flag:"\u{1F1F0}\u{1F1FC}"},{name:"Latvia",id:"LV",dialCode:"+371",maxLength:8,flag:"\u{1F1F1}\u{1F1FB}"},{name:"Lebanon",id:"LB",dialCode:"+961",maxLength:8,flag:"\u{1F1F1}\u{1F1E7}"},{name:"Lithuania",id:"LT",dialCode:"+370",maxLength:8,flag:"\u{1F1F1}\u{1F1F9}"},{name:"Luxembourg",id:"LU",dialCode:"+352",maxLength:9,flag:"\u{1F1F1}\u{1F1FA}"},{name:"Macau",id:"MO",dialCode:"+853",maxLength:8,flag:"\u{1F1F2}\u{1F1F4}"},{name:"Malaysia",id:"MY",dialCode:"+60",maxLength:10,flag:"\u{1F1F2}\u{1F1FE}"},{name:"Mexico",id:"MX",dialCode:"+52",maxLength:10,flag:"\u{1F1F2}\u{1F1FD}"},{name:"Morocco",id:"MA",dialCode:"+212",maxLength:9,flag:"\u{1F1F2}\u{1F1E6}"},{name:"Myanmar",id:"MM",dialCode:"+95",maxLength:9,flag:"\u{1F1F2}\u{1F1F2}"},{name:"Nepal",id:"NP",dialCode:"+977",maxLength:10,flag:"\u{1F1F3}\u{1F1F5}"},{name:"Netherlands",id:"NL",dialCode:"+31",maxLength:9,flag:"\u{1F1F3}\u{1F1F1}"},{name:"New Zealand",id:"NZ",dialCode:"+64",maxLength:9,flag:"\u{1F1F3}\u{1F1FF}"},{name:"Nigeria",id:"NG",dialCode:"+234",maxLength:10,flag:"\u{1F1F3}\u{1F1EC}"},{name:"Norway",id:"NO",dialCode:"+47",maxLength:8,flag:"\u{1F1F3}\u{1F1F4}"},{name:"Oman",id:"OM",dialCode:"+968",maxLength:8,flag:"\u{1F1F4}\u{1F1F2}"},{name:"Pakistan",id:"PK",dialCode:"+92",maxLength:10,flag:"\u{1F1F5}\u{1F1F0}"},{name:"Panama",id:"PA",dialCode:"+507",maxLength:8,flag:"\u{1F1F5}\u{1F1E6}"},{name:"Paraguay",id:"PY",dialCode:"+595",maxLength:9,flag:"\u{1F1F5}\u{1F1FE}"},{name:"Peru",id:"PE",dialCode:"+51",maxLength:9,flag:"\u{1F1F5}\u{1F1EA}"},{name:"Philippines",id:"PH",dialCode:"+63",maxLength:10,flag:"\u{1F1F5}\u{1F1ED}"},{name:"Poland",id:"PL",dialCode:"+48",maxLength:9,flag:"\u{1F1F5}\u{1F1F1}"},{name:"Portugal",id:"PT",dialCode:"+351",maxLength:9,flag:"\u{1F1F5}\u{1F1F9}"},{name:"Qatar",id:"QA",dialCode:"+974",maxLength:8,flag:"\u{1F1F6}\u{1F1E6}"},{name:"Romania",id:"RO",dialCode:"+40",maxLength:9,flag:"\u{1F1F7}\u{1F1F4}"},{name:"Russia",id:"RU",dialCode:"+7",maxLength:10,flag:"\u{1F1F7}\u{1F1FA}"},{name:"Saudi Arabia",id:"SA",dialCode:"+966",maxLength:9,flag:"\u{1F1F8}\u{1F1E6}"},{name:"Serbia",id:"RS",dialCode:"+381",maxLength:9,flag:"\u{1F1F7}\u{1F1F8}"},{name:"Singapore",id:"SG",dialCode:"+65",maxLength:8,flag:"\u{1F1F8}\u{1F1EC}"},{name:"Slovakia",id:"SK",dialCode:"+421",maxLength:9,flag:"\u{1F1F8}\u{1F1F0}"},{name:"Slovenia",id:"SI",dialCode:"+386",maxLength:8,flag:"\u{1F1F8}\u{1F1EE}"},{name:"South Africa",id:"ZA",dialCode:"+27",maxLength:9,flag:"\u{1F1FF}\u{1F1E6}"},{name:"South Korea",id:"KR",dialCode:"+82",maxLength:10,flag:"\u{1F1F0}\u{1F1F7}"},{name:"Spain",id:"ES",dialCode:"+34",maxLength:9,flag:"\u{1F1EA}\u{1F1F8}"},{name:"Sri Lanka",id:"LK",dialCode:"+94",maxLength:9,flag:"\u{1F1F1}\u{1F1F0}"},{name:"Sweden",id:"SE",dialCode:"+46",maxLength:9,flag:"\u{1F1F8}\u{1F1EA}"},{name:"Switzerland",id:"CH",dialCode:"+41",maxLength:9,flag:"\u{1F1E8}\u{1F1ED}"},{name:"Syria",id:"SY",dialCode:"+963",maxLength:9,flag:"\u{1F1F8}\u{1F1FE}"},{name:"Taiwan",id:"TW",dialCode:"+886",maxLength:9,flag:"\u{1F1F9}\u{1F1FC}"},{name:"Thailand",id:"TH",dialCode:"+66",maxLength:9,flag:"\u{1F1F9}\u{1F1ED}"},{name:"Tunisia",id:"TN",dialCode:"+216",maxLength:8,flag:"\u{1F1F9}\u{1F1F3}"},{name:"Turkey",id:"TR",dialCode:"+90",maxLength:10,flag:"\u{1F1F9}\u{1F1F7}"},{name:"Ukraine",id:"UA",dialCode:"+380",maxLength:9,flag:"\u{1F1FA}\u{1F1E6}"},{name:"United Arab Emirates",id:"AE",dialCode:"+971",maxLength:9,flag:"\u{1F1E6}\u{1F1EA}"},{name:"United Kingdom",id:"GB",dialCode:"+44",maxLength:10,flag:"\u{1F1EC}\u{1F1E7}"},{name:"United States",id:"US",dialCode:"+1",maxLength:10,flag:"\u{1F1FA}\u{1F1F8}"},{name:"Uruguay",id:"UY",dialCode:"+598",maxLength:8,flag:"\u{1F1FA}\u{1F1FE}"},{name:"Uzbekistan",id:"UZ",dialCode:"+998",maxLength:9,flag:"\u{1F1FA}\u{1F1FF}"},{name:"Venezuela",id:"VE",dialCode:"+58",maxLength:10,flag:"\u{1F1FB}\u{1F1EA}"},{name:"Vietnam",id:"VN",dialCode:"+84",maxLength:9,flag:"\u{1F1FB}\u{1F1F3}"},{name:"Yemen",id:"YE",dialCode:"+967",maxLength:9,flag:"\u{1F1FE}\u{1F1EA}"}];var ve={xs:"h-6 text-xs",sm:"h-8 text-sm",md:"h-10 text-sm",lg:"h-11 text-base",xl:"h-12 text-lg"},Pe={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},Se={default:"rounded-md border border-border bg-surface shadow-sm focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",filled:"rounded-md border border-transparent bg-surface-secondary focus-within:bg-surface focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",flushed:"rounded-none border-0 border-b border-border bg-transparent focus-within:border-primary transition-all",unstyled:"border-0 bg-transparent p-0"},Ee={default:{default:"border-border focus-within:border-primary focus-within:ring-primary/40",filled:"focus-within:border-primary focus-within:ring-primary/40",flushed:"border-border focus-within:border-primary",unstyled:""},error:{default:"border-error focus-within:border-error focus-within:ring-error/20",filled:"bg-error/5 focus-within:border-error focus-within:ring-error/20",flushed:"border-error focus-within:border-error",unstyled:""},success:{default:"border-success focus-within:border-success focus-within:ring-success/20",filled:"bg-success/5 focus-within:border-success focus-within:ring-success/20",flushed:"border-success focus-within:border-success",unstyled:""},warning:{default:"border-warning focus-within:border-warning focus-within:ring-warning/20",filled:"bg-warning/5 border-warning focus-within:border-warning focus-within:ring-warning/20",flushed:"border-warning focus-within:border-warning",unstyled:""}},Ie={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"},Re="cursor-not-allowed opacity-50 bg-surface-secondary [&_*]:cursor-not-allowed";function Ae(o,l,s,r){if(o==="error"&&l)return l;if(o==="success"&&s)return s;if(o==="warning"&&r)return r}var Be=forwardRef(function({label:l,required:s=false,helperText:r,errorMessage:Z,successMessage:F,warningMessage:j,variant:u="default",size:R="md",state:J="default",fullWidth:A=true,leftElement:B,rightElement:M,prefix:m,suffix:c,wrapperClassName:Q,inputGroupClassName:W,inputClassName:X,labelClassName:$,helperClassName:k,id:q,disabled:h,className:_,clearable:ee,isLoading:x,value:T,defaultValue:ae,onChange:z,showFlag:ne=true,defaultCountryCode:K="+91",autoComplete:te="tel",...de},ie){let oe=useId(),C=q??oe,H=`${C}-helper`,U=`${C}-state`,[V,N]=useState(null),[g,p]=useState(false),[v,P]=useState(""),S=useRef(null),[re,le]=useState(ae??{countryCode:K,phoneNumber:""}),O=T!==void 0,t=O?T:re,b=w.find(e=>e.dialCode===t.countryCode)??w[0],G=b?.maxLength??15,D=ee&&t.phoneNumber.length>0,se=B!==void 0,me=M!==void 0||!!D||!!x,f=V?"error":J,E=Ae(f,V??Z,F,j),ge=[r?H:null,E?U:null].filter(Boolean).join(" ")||void 0,L=e=>{O||le(e),z&&z(e);},fe=e=>{let d=e.target.value,I=d.replace(/\D/g,"");N(I!==d?"Only numbers are allowed":null),!(I.length>G)&&L({...t,phoneNumber:I});},ue=()=>{N(null),L({...t,phoneNumber:""});};useEffect(()=>{if(!g)return;let e=d=>{S.current&&!S.current.contains(d.target)&&p(false);};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e);}},[g]);let Y=w.filter(e=>e.name.toLowerCase().includes(v.toLowerCase())||e.dialCode.includes(v)),ce=()=>x?jsxs("svg",{className:"animate-spin h-4 w-4 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):D?jsx("button",{type:"button",onClick:ue,disabled:h,className:"flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-hover p-0.5 transition-all duration-fast disabled:cursor-not-allowed","aria-label":"Clear input",children:jsx(XMarkIcon,{className:"w-4 h-4"})}):M,he=m!==void 0||u==="flushed"||u==="unstyled"?"":"rounded-l-md";return jsxs("div",{className:n("flex flex-col gap-1",A?"w-full":"w-fit",Q,_),children:[l!==void 0&&jsxs("label",{htmlFor:C,className:n("font-black leading-none text-text mb-2 uppercase tracking-widest",Pe[R],$),children:[l,s&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxs("div",{className:n("flex items-stretch",A?"w-full":"w-fit",W),children:[m!==void 0&&jsx("span",{className:"inline-flex items-center rounded-l-md border border-r-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",children:m}),jsxs("div",{ref:S,className:n("relative flex flex-1 items-stretch",ve[R],Se[u],Ee[f][u],h?Re:"",m!==void 0&&c!==void 0?"rounded-none":m!==void 0?"rounded-l-none":c!==void 0?"rounded-r-none":""),children:[jsxs("button",{type:"button",onClick:()=>{p(!g);},disabled:!!h||!!x,className:n("relative flex items-center justify-center flex-shrink-0 px-2 sm:px-3 text-text bg-surface-secondary border-r border-border hover:bg-hover active:bg-active transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:z-10 disabled:cursor-not-allowed",he),children:[ne&&b&&jsx("span",{className:"mr-1.5 text-base sm:text-lg opacity-90",children:b.flag}),jsx("span",{className:"text-sm font-medium",children:b?.dialCode??K}),jsx(ChevronDownIcon,{className:n("w-3.5 h-3.5 ml-1.5 text-text-secondary transition-transform",g&&"rotate-180")})]}),g&&jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 rounded-md border border-border bg-surface p-1 shadow-lg z-dropdown flex flex-col animate-in fade-in zoom-in-95 duration-fast",children:[jsx("div",{className:"px-2 py-1.5 pb-2 sticky top-0 bg-surface z-10 border-b border-divider",children:jsx("input",{type:"text",placeholder:"Search country...",className:"w-full text-sm bg-transparent px-1 focus:outline-none text-text placeholder:text-text-muted",value:v,onChange:e=>{P(e.target.value);},onKeyDown:e=>{e.stopPropagation();}})}),jsx("ul",{role:"listbox",className:"max-h-56 overflow-y-auto overflow-x-hidden p-1 scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",children:Y.length>0?Y.map(e=>jsxs("li",{role:"option",tabIndex:0,"aria-selected":t.countryCode===e.dialCode,className:n("flex items-center px-2 py-1.5 text-sm rounded-sm cursor-pointer transition-colors outline-none focus:bg-hover active:bg-active",t.countryCode===e.dialCode?"bg-primary/10 text-primary font-medium":"text-text"),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),L({...t,countryCode:e.dialCode}),p(false),P(""));},onClick:()=>{L({...t,countryCode:e.dialCode}),p(false),P("");},children:[jsx("span",{className:"mr-2 text-base",children:e.flag}),jsx("span",{className:"flex-1 truncate",children:e.name}),jsx("span",{className:n("text-xs ml-2",t.countryCode===e.dialCode?"text-primary/70":"text-text-muted"),children:e.dialCode})]},e.id)):jsx("li",{className:"px-2 py-3 text-center text-sm text-text-muted",children:"No countries found"})})]}),se&&jsx("div",{className:"flex items-center pl-3",children:jsx("span",{className:"text-text-secondary flex items-center justify-center",children:B})}),jsx("input",{ref:ie,...de,id:C,disabled:!!h||!!x,type:"tel",inputMode:"numeric",value:t.phoneNumber,onChange:fe,autoComplete:te,"aria-invalid":f==="error"?true:void 0,"aria-describedby":ge,"aria-required":s,maxLength:G,className:n("flex-1 w-full bg-transparent border-none outline-none focus:ring-0 focus:outline-none focus:border-none focus-visible:ring-0 focus-visible:outline-none px-3 min-w-0 transition-colors duration-150 disabled:cursor-not-allowed",X)}),me&&jsx("div",{className:"flex items-center pr-3",children:jsx("span",{className:"text-text-secondary flex items-center justify-center",children:ce()})})]}),c!==void 0&&jsx("span",{className:"inline-flex items-center rounded-r-md border border-l-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",children:c})]}),r!==void 0&&jsx("p",{id:H,className:n("text-xs leading-tight text-text-muted",k),children:r}),E!==void 0&&jsx("p",{id:U,role:f==="error"?"alert":void 0,className:n("text-xs leading-tight mt-1",Ie[f],k),children:E})]})});Be.displayName="Phone";
|
|
2
|
+
export{Be as Phone};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function t(...n){return tailwindMerge.twMerge(clsx.clsx(n))}var k={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},q={sm:"text-xs",md:"text-sm",lg:"text-sm"},G={default:"border-border text-accent focus:ring-accent/40 checked:border-accent checked:bg-accent",error:"border-error text-error focus:ring-error/20 checked:border-error checked:bg-error",success:"border-success text-success focus:ring-success/20 checked:border-success checked:bg-success",warning:"border-warning text-warning focus:ring-warning/20 checked:border-warning checked:bg-warning"},J={default:"text-text-muted",error:"text-error font-medium",success:"text-success font-medium",warning:"text-warning font-medium"};function Q(n,s,d,r){if(n==="error"&&s)return s;if(n==="success"&&d)return d;if(n==="warning"&&r)return r}var y=react.forwardRef(function({label:s,required:d=false,helperText:r,errorMessage:B,successMessage:v,warningMessage:E,size:o="md",state:c="default",className:I,wrapperClassName:S,inputClassName:N,labelClassName:M,helperClassName:m,id:C,disabled:p,onClick:g,onPointerDown:b,onKeyDown:R,...T},P){let H=react.useId(),u=C??H,x=`${u}-helper`,h=`${u}-state`,l=Q(c,B,v,E),L=[r?x:null,l?h:null].filter(Boolean).join(" ")||void 0,f=react.useRef(false),D=e=>{f.current=e.currentTarget.checked,b&&b(e);},V=e=>{(e.key===" "||e.key==="Enter")&&(f.current=e.currentTarget.checked),R&&R(e);},F=e=>{if(f.current){e.currentTarget.checked=false;let w=Reflect.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked")?.set;w&&Reflect.apply(w,e.currentTarget,[false]);let K=new Event("change",{bubbles:true});e.currentTarget.dispatchEvent(K);}g&&g(e);};return jsxRuntime.jsxs("div",{className:t("flex flex-col gap-1",S,I),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsxs("div",{className:t("flex items-center justify-center shrink-0 relative",k[o]),children:[jsxRuntime.jsx("input",{ref:P,...T,id:u,type:"radio",disabled:p,"aria-invalid":c==="error"?true:void 0,"aria-describedby":L,required:d,onClick:F,onPointerDown:D,onKeyDown:V,className:t("peer m-0 appearance-none rounded-full border bg-surface transition-all overflow-hidden focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface disabled:cursor-not-allowed disabled:bg-surface-secondary disabled:border-border disabled:checked:bg-border",k[o],G[c],N)}),jsxRuntime.jsx("span",{className:"pointer-events-none absolute h-[1em] w-[1em] rounded-full text-[0.4em] text-text-inverse opacity-0 transition-opacity peer-checked:bg-current peer-checked:opacity-100 peer-disabled:peer-checked:bg-text-muted/40"})]}),s!==void 0&&jsxRuntime.jsxs("label",{htmlFor:u,className:t("font-bold leading-none text-text mt-[0.125rem] select-none uppercase tracking-widest",p&&"opacity-50 cursor-not-allowed",q[o],M),children:[s,d&&jsxRuntime.jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]})]}),(r!==void 0||l!==void 0)&&jsxRuntime.jsxs("div",{className:t("ml-6",o==="sm"&&"ml-6",o==="md"&&"ml-7",o==="lg"&&"ml-8"),children:[r!==void 0&&jsxRuntime.jsx("p",{id:x,className:t("text-xs leading-tight text-text-muted font-medium",m),children:r}),l!==void 0&&jsxRuntime.jsx("p",{id:h,role:c==="error"?"alert":void 0,className:t("text-xs leading-tight mt-1 font-medium",J[c],m),children:l})]})]})});y.displayName="RadioButton";exports.RadioButton=y;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type RadioButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type RadioButtonState = 'default' | 'error' | 'success' | 'warning';
|
|
5
|
+
interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
6
|
+
/**
|
|
7
|
+
* Optional label displayed next to the radio button.
|
|
8
|
+
*/
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Helper text displayed below the radio button.
|
|
12
|
+
*/
|
|
13
|
+
helperText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Error message displayed when state is 'error'.
|
|
16
|
+
*/
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Success message displayed when state is 'success'.
|
|
20
|
+
*/
|
|
21
|
+
successMessage?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Warning message displayed when state is 'warning'.
|
|
24
|
+
*/
|
|
25
|
+
warningMessage?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The size of the radio button and label.
|
|
28
|
+
* @default 'md'
|
|
29
|
+
*/
|
|
30
|
+
size?: RadioButtonSize;
|
|
31
|
+
/**
|
|
32
|
+
* The validation state of the radio button.
|
|
33
|
+
* @default 'default'
|
|
34
|
+
*/
|
|
35
|
+
state?: RadioButtonState;
|
|
36
|
+
/**
|
|
37
|
+
* Additional class applied to the outer wrapper element.
|
|
38
|
+
*/
|
|
39
|
+
wrapperClassName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Additional class applied to the input element itself.
|
|
42
|
+
*/
|
|
43
|
+
inputClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additional class applied to the label text element.
|
|
46
|
+
*/
|
|
47
|
+
labelClassName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Additional class applied to the helper/state message element.
|
|
50
|
+
*/
|
|
51
|
+
helperClassName?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
55
|
+
|
|
56
|
+
export { RadioButton, type RadioButtonProps, type RadioButtonSize, type RadioButtonState };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type RadioButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type RadioButtonState = 'default' | 'error' | 'success' | 'warning';
|
|
5
|
+
interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
6
|
+
/**
|
|
7
|
+
* Optional label displayed next to the radio button.
|
|
8
|
+
*/
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Helper text displayed below the radio button.
|
|
12
|
+
*/
|
|
13
|
+
helperText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Error message displayed when state is 'error'.
|
|
16
|
+
*/
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Success message displayed when state is 'success'.
|
|
20
|
+
*/
|
|
21
|
+
successMessage?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Warning message displayed when state is 'warning'.
|
|
24
|
+
*/
|
|
25
|
+
warningMessage?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The size of the radio button and label.
|
|
28
|
+
* @default 'md'
|
|
29
|
+
*/
|
|
30
|
+
size?: RadioButtonSize;
|
|
31
|
+
/**
|
|
32
|
+
* The validation state of the radio button.
|
|
33
|
+
* @default 'default'
|
|
34
|
+
*/
|
|
35
|
+
state?: RadioButtonState;
|
|
36
|
+
/**
|
|
37
|
+
* Additional class applied to the outer wrapper element.
|
|
38
|
+
*/
|
|
39
|
+
wrapperClassName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Additional class applied to the input element itself.
|
|
42
|
+
*/
|
|
43
|
+
inputClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additional class applied to the label text element.
|
|
46
|
+
*/
|
|
47
|
+
labelClassName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Additional class applied to the helper/state message element.
|
|
50
|
+
*/
|
|
51
|
+
helperClassName?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
55
|
+
|
|
56
|
+
export { RadioButton, type RadioButtonProps, type RadioButtonSize, type RadioButtonState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {forwardRef,useId,useRef}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function t(...n){return twMerge(clsx(n))}var k={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},q={sm:"text-xs",md:"text-sm",lg:"text-sm"},G={default:"border-border text-accent focus:ring-accent/40 checked:border-accent checked:bg-accent",error:"border-error text-error focus:ring-error/20 checked:border-error checked:bg-error",success:"border-success text-success focus:ring-success/20 checked:border-success checked:bg-success",warning:"border-warning text-warning focus:ring-warning/20 checked:border-warning checked:bg-warning"},J={default:"text-text-muted",error:"text-error font-medium",success:"text-success font-medium",warning:"text-warning font-medium"};function Q(n,s,d,r){if(n==="error"&&s)return s;if(n==="success"&&d)return d;if(n==="warning"&&r)return r}var y=forwardRef(function({label:s,required:d=false,helperText:r,errorMessage:B,successMessage:v,warningMessage:E,size:o="md",state:c="default",className:I,wrapperClassName:S,inputClassName:N,labelClassName:M,helperClassName:m,id:C,disabled:p,onClick:g,onPointerDown:b,onKeyDown:R,...T},P){let H=useId(),u=C??H,x=`${u}-helper`,h=`${u}-state`,l=Q(c,B,v,E),L=[r?x:null,l?h:null].filter(Boolean).join(" ")||void 0,f=useRef(false),D=e=>{f.current=e.currentTarget.checked,b&&b(e);},V=e=>{(e.key===" "||e.key==="Enter")&&(f.current=e.currentTarget.checked),R&&R(e);},F=e=>{if(f.current){e.currentTarget.checked=false;let w=Reflect.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked")?.set;w&&Reflect.apply(w,e.currentTarget,[false]);let K=new Event("change",{bubbles:true});e.currentTarget.dispatchEvent(K);}g&&g(e);};return jsxs("div",{className:t("flex flex-col gap-1",S,I),children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:t("flex items-center justify-center shrink-0 relative",k[o]),children:[jsx("input",{ref:P,...T,id:u,type:"radio",disabled:p,"aria-invalid":c==="error"?true:void 0,"aria-describedby":L,required:d,onClick:F,onPointerDown:D,onKeyDown:V,className:t("peer m-0 appearance-none rounded-full border bg-surface transition-all overflow-hidden focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface disabled:cursor-not-allowed disabled:bg-surface-secondary disabled:border-border disabled:checked:bg-border",k[o],G[c],N)}),jsx("span",{className:"pointer-events-none absolute h-[1em] w-[1em] rounded-full text-[0.4em] text-text-inverse opacity-0 transition-opacity peer-checked:bg-current peer-checked:opacity-100 peer-disabled:peer-checked:bg-text-muted/40"})]}),s!==void 0&&jsxs("label",{htmlFor:u,className:t("font-bold leading-none text-text mt-[0.125rem] select-none uppercase tracking-widest",p&&"opacity-50 cursor-not-allowed",q[o],M),children:[s,d&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]})]}),(r!==void 0||l!==void 0)&&jsxs("div",{className:t("ml-6",o==="sm"&&"ml-6",o==="md"&&"ml-7",o==="lg"&&"ml-8"),children:[r!==void 0&&jsx("p",{id:x,className:t("text-xs leading-tight text-text-muted font-medium",m),children:r}),l!==void 0&&jsx("p",{id:h,role:c==="error"?"alert":void 0,className:t("text-xs leading-tight mt-1 font-medium",J[c],m),children:l})]})]})});y.displayName="RadioButton";export{y as RadioButton};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),outline=require('@heroicons/react/24/outline'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function o(...r){return tailwindMerge.twMerge(clsx.clsx(r))}var ce={xs:"h-6 px-2 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-3 text-sm",lg:"h-11 px-4 text-base",xl:"h-12 px-4 text-lg"},le={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},pe={default:"rounded-md border border-border bg-surface shadow-sm focus:outline-none",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none",unstyled:"border-0 bg-transparent p-0 focus:outline-none"},fe={default:{default:"border-border focus:border-primary",filled:"focus:border-primary",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error",filled:"bg-error/5 focus:border-error",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success",filled:"bg-success/5 focus:border-success",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning",filled:"bg-warning/5 focus:border-warning",flushed:"border-warning focus:border-warning",unstyled:""}},me={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"};function xe(r,n,d,t){if(r==="error"&&n)return n;if(r==="success"&&d)return d;if(r==="warning"&&t)return t}function G({children:r,side:n}){return jsxRuntime.jsx("span",{"aria-hidden":"true",className:o("inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",n==="left"?"rounded-l-md border-r-0":"rounded-r-md border-l-0"),children:r})}var v=react.forwardRef(function({label:n,required:d=false,helperText:t,errorMessage:x,successMessage:E,warningMessage:S,variant:b="default",size:g="md",state:s="default",fullWidth:l=true,leftElement:h,rightElement:w,prefix:p,suffix:f,wrapperClassName:L,inputGroupClassName:A,inputClassName:u,labelClassName:q,helperClassName:V,id:J,disabled:k,className:Q,clearable:U,isLoading:R,multiline:i,rows:W=4,type:I="text",value:y,onChange:N,...P},c){let Y=react.useId(),T=J??Y,z=`${T}-helper`,B=`${T}-state`,[M,Z]=react.useState(I),j=I==="password",D=U&&(typeof y=="string"||typeof y=="number")&&String(y).length>0,F=h!==void 0,K=w!==void 0||!!D||!!R||j,H=xe(s,x,E,S),_=[t?z:null,H?B:null].filter(Boolean).join(" ")||void 0,ee=()=>{let a=c&&typeof c=="object"&&"current"in c?c.current:null;if(a){Object.getOwnPropertyDescriptor((i?window.HTMLTextAreaElement:window.HTMLInputElement).prototype,"value")?.set?.call(a,"");let $=new Event("input",{bubbles:true});a.dispatchEvent($);}else N&&N({target:{value:""},currentTarget:{value:""},preventDefault:()=>{},stopPropagation:()=>{}});},te=()=>R?jsxRuntime.jsxs("svg",{className:"animate-spin h-5 w-5 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):D?jsxRuntime.jsx("button",{type:"button",onClick:ee,className:"flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-interaction-hover p-0.5 transition w-6 h-6 border-0 bg-transparent cursor-pointer","aria-label":"Clear input",children:jsxRuntime.jsx(outline.XMarkIcon,{className:"w-[18px] h-[18px]"})}):j?jsxRuntime.jsx("button",{type:"button",onClick:()=>{Z(a=>a==="password"?"text":"password");},className:"flex items-center justify-center rounded-full text-text-muted hover:text-text transition w-6 h-6 border-0 bg-transparent cursor-pointer","aria-label":M==="password"?"Show password":"Hide password",children:M==="password"?jsxRuntime.jsx(outline.EyeIcon,{className:"w-5 h-5"}):jsxRuntime.jsx(outline.EyeSlashIcon,{className:"w-5 h-5"})}):w,O={id:T,disabled:!!k||!!R,value:y,onChange:N,"aria-invalid":s==="error"?true:void 0,"aria-describedby":_,"aria-required":d,className:o("w-full bg-transparent border-0 focus:outline-none focus:ring-0 outline-none h-full",!i&&ce[g],i&&"py-3 px-4 resize-none",I==="number"&&"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",u),style:{paddingLeft:F?"0.5rem":void 0,paddingRight:K?"0.5rem":void 0},...P};return jsxRuntime.jsxs("div",{className:o("flex flex-col gap-1",l?"w-full":"w-fit",L,Q),children:[n!==void 0&&jsxRuntime.jsxs("label",{htmlFor:T,className:o("font-black leading-none text-text mb-2 uppercase tracking-widest",le[g],q),children:[n,d&&jsxRuntime.jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxRuntime.jsxs("div",{className:o("flex items-stretch transition-all duration-150 overflow-hidden",pe[b],fe[s][b],l?"w-full":"w-fit","focus-within:ring-4 focus-within:ring-primary/20 focus-within:border-primary",k&&"opacity-50 cursor-not-allowed bg-surface-secondary",i&&"h-auto",A),children:[p!==void 0&&jsxRuntime.jsx(G,{side:"left",children:p}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[F&&jsxRuntime.jsx("div",{className:o("pl-3 shrink-0 flex items-center justify-center",i&&"self-start mt-3"),"aria-hidden":"true",children:h}),jsxRuntime.jsx("div",{className:"flex-1 min-w-0 h-full",children:i?jsxRuntime.jsx("textarea",{ref:c,rows:W,...O}):jsxRuntime.jsx("input",{ref:c,type:M,...O,onKeyDown:a=>{I==="number"&&["e","E","+"].includes(a.key)&&a.preventDefault(),P.onKeyDown?.(a);}})}),K&&jsxRuntime.jsx("div",{className:o("pr-3 shrink-0 flex items-center justify-center text-text-secondary",i&&"self-start mt-3"),style:{width:"2.5rem"},"aria-hidden":"true",children:te()})]}),f!==void 0&&jsxRuntime.jsx(G,{side:"right",children:f})]}),t!==void 0&&jsxRuntime.jsx("p",{id:z,className:o("text-xs leading-tight text-text-muted ",V),children:t}),H!==void 0&&jsxRuntime.jsx("p",{id:B,role:s==="error"?"alert":void 0,className:o("text-xs leading-tight mt-1",me[s],V),children:H})]})});v.displayName="TextInput";var we=react.forwardRef(({debounce:r=300,onDebouncedChange:n,onChange:d,value:t,defaultValue:x,clearable:E=true,leftElement:S,...b},g)=>{let[s,l]=react.useState(t??x??""),[h,w]=react.useState(t),[p,f]=react.useState(String(t??x??""));return t!==h&&(l(t??""),w(t),f(String(t??""))),react.useEffect(()=>{if(String(s)===p)return;let u=setTimeout(()=>{n&&(n(String(s)),f(String(s)));},r);return ()=>{clearTimeout(u);}},[s,r,n,p]),jsxRuntime.jsx(v,{...b,ref:g,value:s,onChange:u=>{l(u.target.value),d&&d(u);},clearable:E,leftElement:S??jsxRuntime.jsx(outline.MagnifyingGlassIcon,{className:"w-[18px] h-[18px] text-text-muted"}),type:"text"})});we.displayName="SearchInput";
|
|
2
|
+
exports.SearchInput=we;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { T as TextInputProps } from '../TextInput.types-DRI8HQza.mjs';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
interface SearchInputProps extends TextInputProps {
|
|
5
|
+
/**
|
|
6
|
+
* The delay in milliseconds before the onDebouncedChange callback is called.
|
|
7
|
+
* @default 300
|
|
8
|
+
*/
|
|
9
|
+
debounce?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Callback function called after the debounce delay with the current input value.
|
|
12
|
+
*/
|
|
13
|
+
onDebouncedChange?: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* SearchInput component - A debounced input field for search functionality.
|
|
18
|
+
* Built on top of TextInput, it includes a search icon by default and handles debouncing.
|
|
19
|
+
*/
|
|
20
|
+
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
21
|
+
|
|
22
|
+
export { SearchInput, type SearchInputProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { T as TextInputProps } from '../TextInput.types-DRI8HQza.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
interface SearchInputProps extends TextInputProps {
|
|
5
|
+
/**
|
|
6
|
+
* The delay in milliseconds before the onDebouncedChange callback is called.
|
|
7
|
+
* @default 300
|
|
8
|
+
*/
|
|
9
|
+
debounce?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Callback function called after the debounce delay with the current input value.
|
|
12
|
+
*/
|
|
13
|
+
onDebouncedChange?: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* SearchInput component - A debounced input field for search functionality.
|
|
18
|
+
* Built on top of TextInput, it includes a search icon by default and handles debouncing.
|
|
19
|
+
*/
|
|
20
|
+
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
21
|
+
|
|
22
|
+
export { SearchInput, type SearchInputProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useId,useState,useEffect}from'react';import {MagnifyingGlassIcon,XMarkIcon,EyeIcon,EyeSlashIcon}from'@heroicons/react/24/outline';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function o(...r){return twMerge(clsx(r))}var ce={xs:"h-6 px-2 text-xs",sm:"h-8 px-3 text-sm",md:"h-10 px-3 text-sm",lg:"h-11 px-4 text-base",xl:"h-12 px-4 text-lg"},le={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},pe={default:"rounded-md border border-border bg-surface shadow-sm focus:outline-none",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none",unstyled:"border-0 bg-transparent p-0 focus:outline-none"},fe={default:{default:"border-border focus:border-primary",filled:"focus:border-primary",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error",filled:"bg-error/5 focus:border-error",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success",filled:"bg-success/5 focus:border-success",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning",filled:"bg-warning/5 focus:border-warning",flushed:"border-warning focus:border-warning",unstyled:""}},me={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"};function xe(r,n,d,t){if(r==="error"&&n)return n;if(r==="success"&&d)return d;if(r==="warning"&&t)return t}function G({children:r,side:n}){return jsx("span",{"aria-hidden":"true",className:o("inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",n==="left"?"rounded-l-md border-r-0":"rounded-r-md border-l-0"),children:r})}var v=forwardRef(function({label:n,required:d=false,helperText:t,errorMessage:x,successMessage:E,warningMessage:S,variant:b="default",size:g="md",state:s="default",fullWidth:l=true,leftElement:h,rightElement:w,prefix:p,suffix:f,wrapperClassName:L,inputGroupClassName:A,inputClassName:u,labelClassName:q,helperClassName:V,id:J,disabled:k,className:Q,clearable:U,isLoading:R,multiline:i,rows:W=4,type:I="text",value:y,onChange:N,...P},c){let Y=useId(),T=J??Y,z=`${T}-helper`,B=`${T}-state`,[M,Z]=useState(I),j=I==="password",D=U&&(typeof y=="string"||typeof y=="number")&&String(y).length>0,F=h!==void 0,K=w!==void 0||!!D||!!R||j,H=xe(s,x,E,S),_=[t?z:null,H?B:null].filter(Boolean).join(" ")||void 0,ee=()=>{let a=c&&typeof c=="object"&&"current"in c?c.current:null;if(a){Object.getOwnPropertyDescriptor((i?window.HTMLTextAreaElement:window.HTMLInputElement).prototype,"value")?.set?.call(a,"");let $=new Event("input",{bubbles:true});a.dispatchEvent($);}else N&&N({target:{value:""},currentTarget:{value:""},preventDefault:()=>{},stopPropagation:()=>{}});},te=()=>R?jsxs("svg",{className:"animate-spin h-5 w-5 text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):D?jsx("button",{type:"button",onClick:ee,className:"flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-interaction-hover p-0.5 transition w-6 h-6 border-0 bg-transparent cursor-pointer","aria-label":"Clear input",children:jsx(XMarkIcon,{className:"w-[18px] h-[18px]"})}):j?jsx("button",{type:"button",onClick:()=>{Z(a=>a==="password"?"text":"password");},className:"flex items-center justify-center rounded-full text-text-muted hover:text-text transition w-6 h-6 border-0 bg-transparent cursor-pointer","aria-label":M==="password"?"Show password":"Hide password",children:M==="password"?jsx(EyeIcon,{className:"w-5 h-5"}):jsx(EyeSlashIcon,{className:"w-5 h-5"})}):w,O={id:T,disabled:!!k||!!R,value:y,onChange:N,"aria-invalid":s==="error"?true:void 0,"aria-describedby":_,"aria-required":d,className:o("w-full bg-transparent border-0 focus:outline-none focus:ring-0 outline-none h-full",!i&&ce[g],i&&"py-3 px-4 resize-none",I==="number"&&"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",u),style:{paddingLeft:F?"0.5rem":void 0,paddingRight:K?"0.5rem":void 0},...P};return jsxs("div",{className:o("flex flex-col gap-1",l?"w-full":"w-fit",L,Q),children:[n!==void 0&&jsxs("label",{htmlFor:T,className:o("font-black leading-none text-text mb-2 uppercase tracking-widest",le[g],q),children:[n,d&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxs("div",{className:o("flex items-stretch transition-all duration-150 overflow-hidden",pe[b],fe[s][b],l?"w-full":"w-fit","focus-within:ring-4 focus-within:ring-primary/20 focus-within:border-primary",k&&"opacity-50 cursor-not-allowed bg-surface-secondary",i&&"h-auto",A),children:[p!==void 0&&jsx(G,{side:"left",children:p}),jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[F&&jsx("div",{className:o("pl-3 shrink-0 flex items-center justify-center",i&&"self-start mt-3"),"aria-hidden":"true",children:h}),jsx("div",{className:"flex-1 min-w-0 h-full",children:i?jsx("textarea",{ref:c,rows:W,...O}):jsx("input",{ref:c,type:M,...O,onKeyDown:a=>{I==="number"&&["e","E","+"].includes(a.key)&&a.preventDefault(),P.onKeyDown?.(a);}})}),K&&jsx("div",{className:o("pr-3 shrink-0 flex items-center justify-center text-text-secondary",i&&"self-start mt-3"),style:{width:"2.5rem"},"aria-hidden":"true",children:te()})]}),f!==void 0&&jsx(G,{side:"right",children:f})]}),t!==void 0&&jsx("p",{id:z,className:o("text-xs leading-tight text-text-muted ",V),children:t}),H!==void 0&&jsx("p",{id:B,role:s==="error"?"alert":void 0,className:o("text-xs leading-tight mt-1",me[s],V),children:H})]})});v.displayName="TextInput";var we=forwardRef(({debounce:r=300,onDebouncedChange:n,onChange:d,value:t,defaultValue:x,clearable:E=true,leftElement:S,...b},g)=>{let[s,l]=useState(t??x??""),[h,w]=useState(t),[p,f]=useState(String(t??x??""));return t!==h&&(l(t??""),w(t),f(String(t??""))),useEffect(()=>{if(String(s)===p)return;let u=setTimeout(()=>{n&&(n(String(s)),f(String(s)));},r);return ()=>{clearTimeout(u);}},[s,r,n,p]),jsx(v,{...b,ref:g,value:s,onChange:u=>{l(u.target.value),d&&d(u);},clearable:E,leftElement:S??jsx(MagnifyingGlassIcon,{className:"w-[18px] h-[18px] text-text-muted"}),type:"text"})});we.displayName="SearchInput";
|
|
2
|
+
export{we as SearchInput};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),solid=require('@heroicons/react/20/solid'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function o(...r){return tailwindMerge.twMerge(clsx.clsx(r))}var Q={xs:"h-6 py-0 pl-2 pr-8 text-xs",sm:"h-8 py-0 pl-3 pr-8 text-sm",md:"h-10 py-0 pl-3 pr-10 text-sm",lg:"h-11 py-0 pl-4 pr-10 text-base",xl:"h-12 py-0 pl-4 pr-12 text-lg"},T={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},W={default:"rounded-md border border-border bg-surface shadow-sm focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0 appearance-none transition-all duration-normal",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0 appearance-none transition-all duration-normal",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none focus:ring-0 appearance-none transition-all duration-normal",unstyled:"border-0 bg-transparent p-0 focus:outline-none focus:ring-0 appearance-none"},Y={default:{default:"border-border focus:border-primary focus:ring-primary/40",filled:"focus:border-primary focus:ring-primary/40",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error focus:ring-error/20",filled:"bg-error/5 focus:border-error focus:ring-error/20",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success focus:ring-success/20",filled:"bg-success/5 focus:border-success focus:ring-success/20",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning focus:ring-warning/20",filled:"bg-warning/5 focus:border-warning focus:ring-warning/20",flushed:"border-warning focus:border-warning",unstyled:""}},Z={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"},_="disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-surface-secondary";function ee(r,t){return r?{xs:"pl-6",sm:"pl-8",md:"pl-9",lg:"pl-10",xl:"pl-11"}[t]:""}function re(r,t,n,s){if(r==="error"&&t)return t;if(r==="success"&&n)return n;if(r==="warning"&&s)return s}function N({children:r,side:t,size:n,pointerEvents:s=false}){return jsxRuntime.jsx("span",{"aria-hidden":"true",className:o("absolute top-1/2 -translate-y-1/2 text-text-secondary flex items-center justify-center",!s&&"pointer-events-none",t==="left"?"left-3":"right-3",{xs:"w-3.5 h-3.5",sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5"}[n]),children:r})}var te=()=>jsxRuntime.jsx(solid.ChevronUpDownIcon,{className:"w-full h-full","aria-hidden":"true"}),C=react.forwardRef(function({label:t,required:n=false,helperText:s,errorMessage:p,successMessage:z,warningMessage:I,variant:g="default",size:l="md",state:a="default",fullWidth:m=true,leftElement:b,rightElement:i,wrapperClassName:P,inputGroupClassName:A,inputClassName:V,labelClassName:k,helperClassName:x,id:B,disabled:E,className:M,isLoading:S,options:y=[],placeholder:h,children:H,...D},F){let L=react.useId(),d=B??L,w=`${d}-helper`,v=`${d}-state`,R=b!==void 0,u=re(a,p,z,I),$=[s?w:null,u?v:null].filter(Boolean).join(" ")||void 0,j=()=>S?jsxRuntime.jsxs("svg",{className:"animate-spin h-full w-full text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):i!==void 0?i:jsxRuntime.jsx(te,{}),J=jsxRuntime.jsxs("select",{...D,ref:F,id:d,disabled:!!E||!!S,"aria-invalid":a==="error"?true:void 0,"aria-describedby":$,"aria-required":n,className:o("w-full transition-colors duration-150",Q[l],W[g],Y[a][g],_,ee(R,l),V),children:[h&&jsxRuntime.jsx("option",{value:"",disabled:true,hidden:true,children:h}),y.length>0?y.map((f,O)=>jsxRuntime.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},O)):H]});return jsxRuntime.jsxs("div",{className:o("flex flex-col gap-1",m?"w-full":"w-fit",P,M),children:[t!==void 0&&jsxRuntime.jsxs("label",{htmlFor:d,className:o("font-black leading-none text-text mt-1 uppercase tracking-widest",T[l],k),children:[t,n&&jsxRuntime.jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsxRuntime.jsx("div",{className:o("flex items-stretch",m?"w-full":"w-fit",A),children:jsxRuntime.jsxs("div",{className:"relative flex flex-1 items-center",children:[R&&jsxRuntime.jsx(N,{side:"left",size:l,children:b}),jsxRuntime.jsx("div",{className:"flex-1",children:J}),jsxRuntime.jsx(N,{side:"right",size:l,pointerEvents:!i,children:j()})]})}),s!==void 0&&jsxRuntime.jsx("p",{id:w,className:o("text-xs leading-tight text-text-muted",x),children:s}),u!==void 0&&jsxRuntime.jsx("p",{id:v,role:a==="error"?"alert":void 0,className:o("text-xs leading-tight mt-1",Z[a],x),children:u})]})});C.displayName="Select";
|
|
2
|
+
exports.Select=C;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SelectHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type SelectVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
|
|
4
|
+
type SelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type SelectState = 'default' | 'error' | 'success' | 'warning';
|
|
6
|
+
interface SelectOption {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string | number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
12
|
+
label?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
helperText?: string;
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
warningMessage?: string;
|
|
18
|
+
variant?: SelectVariant;
|
|
19
|
+
size?: SelectSize;
|
|
20
|
+
state?: SelectState;
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
leftElement?: ReactNode;
|
|
23
|
+
rightElement?: ReactNode;
|
|
24
|
+
wrapperClassName?: string;
|
|
25
|
+
inputGroupClassName?: string;
|
|
26
|
+
inputClassName?: string;
|
|
27
|
+
labelClassName?: string;
|
|
28
|
+
helperClassName?: string;
|
|
29
|
+
isLoading?: boolean;
|
|
30
|
+
options?: SelectOption[];
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
35
|
+
|
|
36
|
+
export { Select, type SelectOption, type SelectProps, type SelectSize, type SelectState, type SelectVariant };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SelectHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type SelectVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
|
|
4
|
+
type SelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type SelectState = 'default' | 'error' | 'success' | 'warning';
|
|
6
|
+
interface SelectOption {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string | number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
12
|
+
label?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
helperText?: string;
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
warningMessage?: string;
|
|
18
|
+
variant?: SelectVariant;
|
|
19
|
+
size?: SelectSize;
|
|
20
|
+
state?: SelectState;
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
leftElement?: ReactNode;
|
|
23
|
+
rightElement?: ReactNode;
|
|
24
|
+
wrapperClassName?: string;
|
|
25
|
+
inputGroupClassName?: string;
|
|
26
|
+
inputClassName?: string;
|
|
27
|
+
labelClassName?: string;
|
|
28
|
+
helperClassName?: string;
|
|
29
|
+
isLoading?: boolean;
|
|
30
|
+
options?: SelectOption[];
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
35
|
+
|
|
36
|
+
export { Select, type SelectOption, type SelectProps, type SelectSize, type SelectState, type SelectVariant };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {forwardRef,useId}from'react';import {ChevronUpDownIcon}from'@heroicons/react/20/solid';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';function o(...r){return twMerge(clsx(r))}var Q={xs:"h-6 py-0 pl-2 pr-8 text-xs",sm:"h-8 py-0 pl-3 pr-8 text-sm",md:"h-10 py-0 pl-3 pr-10 text-sm",lg:"h-11 py-0 pl-4 pr-10 text-base",xl:"h-12 py-0 pl-4 pr-12 text-lg"},T={xs:"text-xs",sm:"text-xs",md:"text-sm",lg:"text-sm",xl:"text-base"},W={default:"rounded-md border border-border bg-surface shadow-sm focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0 appearance-none transition-all duration-normal",filled:"rounded-md border border-transparent bg-surface-secondary focus:bg-surface focus:outline-none focus:ring-2 focus:ring-primary/40 focus:ring-offset-0 appearance-none transition-all duration-normal",flushed:"rounded-none border-0 border-b border-border bg-transparent focus:outline-none focus:ring-0 appearance-none transition-all duration-normal",unstyled:"border-0 bg-transparent p-0 focus:outline-none focus:ring-0 appearance-none"},Y={default:{default:"border-border focus:border-primary focus:ring-primary/40",filled:"focus:border-primary focus:ring-primary/40",flushed:"border-border focus:border-primary",unstyled:""},error:{default:"border-error focus:border-error focus:ring-error/20",filled:"bg-error/5 focus:border-error focus:ring-error/20",flushed:"border-error focus:border-error",unstyled:""},success:{default:"border-success focus:border-success focus:ring-success/20",filled:"bg-success/5 focus:border-success focus:ring-success/20",flushed:"border-success focus:border-success",unstyled:""},warning:{default:"border-warning focus:border-warning focus:ring-warning/20",filled:"bg-warning/5 focus:border-warning focus:ring-warning/20",flushed:"border-warning focus:border-warning",unstyled:""}},Z={default:"text-text-muted",error:"text-error",success:"text-success",warning:"text-warning"},_="disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-surface-secondary";function ee(r,t){return r?{xs:"pl-6",sm:"pl-8",md:"pl-9",lg:"pl-10",xl:"pl-11"}[t]:""}function re(r,t,n,s){if(r==="error"&&t)return t;if(r==="success"&&n)return n;if(r==="warning"&&s)return s}function N({children:r,side:t,size:n,pointerEvents:s=false}){return jsx("span",{"aria-hidden":"true",className:o("absolute top-1/2 -translate-y-1/2 text-text-secondary flex items-center justify-center",!s&&"pointer-events-none",t==="left"?"left-3":"right-3",{xs:"w-3.5 h-3.5",sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5"}[n]),children:r})}var te=()=>jsx(ChevronUpDownIcon,{className:"w-full h-full","aria-hidden":"true"}),C=forwardRef(function({label:t,required:n=false,helperText:s,errorMessage:p,successMessage:z,warningMessage:I,variant:g="default",size:l="md",state:a="default",fullWidth:m=true,leftElement:b,rightElement:i,wrapperClassName:P,inputGroupClassName:A,inputClassName:V,labelClassName:k,helperClassName:x,id:B,disabled:E,className:M,isLoading:S,options:y=[],placeholder:h,children:H,...D},F){let L=useId(),d=B??L,w=`${d}-helper`,v=`${d}-state`,R=b!==void 0,u=re(a,p,z,I),$=[s?w:null,u?v:null].filter(Boolean).join(" ")||void 0,j=()=>S?jsxs("svg",{className:"animate-spin h-full w-full text-text-muted",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):i!==void 0?i:jsx(te,{}),J=jsxs("select",{...D,ref:F,id:d,disabled:!!E||!!S,"aria-invalid":a==="error"?true:void 0,"aria-describedby":$,"aria-required":n,className:o("w-full transition-colors duration-150",Q[l],W[g],Y[a][g],_,ee(R,l),V),children:[h&&jsx("option",{value:"",disabled:true,hidden:true,children:h}),y.length>0?y.map((f,O)=>jsx("option",{value:f.value,disabled:f.disabled,children:f.label},O)):H]});return jsxs("div",{className:o("flex flex-col gap-1",m?"w-full":"w-fit",P,M),children:[t!==void 0&&jsxs("label",{htmlFor:d,className:o("font-black leading-none text-text mt-1 uppercase tracking-widest",T[l],k),children:[t,n&&jsx("span",{"aria-hidden":"true",className:"ml-1 text-error",children:"*"})]}),jsx("div",{className:o("flex items-stretch",m?"w-full":"w-fit",A),children:jsxs("div",{className:"relative flex flex-1 items-center",children:[R&&jsx(N,{side:"left",size:l,children:b}),jsx("div",{className:"flex-1",children:J}),jsx(N,{side:"right",size:l,pointerEvents:!i,children:j()})]})}),s!==void 0&&jsx("p",{id:w,className:o("text-xs leading-tight text-text-muted",x),children:s}),u!==void 0&&jsx("p",{id:v,role:a==="error"?"alert":void 0,className:o("text-xs leading-tight mt-1",Z[a],x),children:u})]})});C.displayName="Select";
|
|
2
|
+
export{C as Select};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),outline=require('@heroicons/react/24/outline'),jsxRuntime=require('react/jsx-runtime');function a(...s){return tailwindMerge.twMerge(clsx.clsx(s))}var C=({groups:s,isCollapsed:I,onToggleCollapse:u,logo:m,footer:x,className:N,glass:k=false,width:E=288,collapsedWidth:R=80,showToggleButton:L=false,togglePosition:p="center",position:l="left",centerIcons:A=true,classNames:o={},styles:n={},renderItem:f})=>{let[B,j]=react.useState(false),[z,G]=react.useState({}),r=I??B,M=()=>{let e=!r;u?u(e):j(e);},P=e=>{G(d=>({...d,[e]:!d[e]}));},D=r?R:E,h=(e,d=0)=>{if(e.hidden)return null;if(f)return jsxRuntime.jsx("div",{children:f(e,r)},e.id);let c=e.items&&e.items.length>0,v=z[e.id]??!!e.isExpanded,y=e.component??"button",V=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.icon&&jsxRuntime.jsx("span",{className:a("shrink-0 transition-colors duration-normal",e.isActive?"text-text-inverse":"text-text-muted group-hover:text-text",r&&A&&"mx-auto",o.itemIcon),style:n.itemIcon,children:e.icon}),!r&&jsxRuntime.jsx("span",{className:a("truncate",o.itemLabel),style:n.itemLabel,children:e.label}),!r&&jsxRuntime.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.badge&&jsxRuntime.jsx("span",{className:"shrink-0",children:e.badge}),c&&jsxRuntime.jsx(outline.ChevronDownIcon,{className:a("w-4 h-4 transition-transform duration-normal",v&&"rotate-180")})]}),r&&jsxRuntime.jsx("div",{className:"absolute left-full ml-2 px-2 py-1 bg-surface-secondary border border-border rounded shadow-lg text-xs opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity z-index-tooltip whitespace-nowrap text-text",children:e.label})]});return jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(y,{type:y==="button"?"button":void 0,onClick:b=>{c&&!r&&(b.preventDefault(),P(e.id)),e.onClick?.();},className:a("w-full flex items-center gap-4 transition-all duration-normal group relative text-base rounded-lg",d===0?"px-4 py-3":"px-3 py-2 pl-10",e.isActive?"bg-black text-text-inverse shadow-md shadow-black/20 font-bold":"text-text-secondary hover:bg-hover hover:text-text",r&&"justify-center px-0",e.isActive&&o.itemActive,r&&o.itemCollapsed,o.item),style:n.item,title:r?e.label:void 0,...e.componentProps??{},children:V}),c&&v&&!r&&jsxRuntime.jsx("div",{className:"mt-1 space-y-1",children:e.items?.map(b=>h(b,d+1))})]},e.id)},J=L&&jsxRuntime.jsx("button",{onClick:M,className:a("absolute z-index-popover flex items-center justify-center w-8 h-8 rounded-full bg-surface border border-border shadow-sm hover:shadow-md transition-all duration-normal hover:bg-hover text-text-muted hover:text-text",l==="left"?"-right-4":"-left-4",p==="top"&&"top-12",p==="center"&&"top-1/2 -translate-y-1/2",p==="bottom"&&"bottom-12",o.toggleButton),style:n.toggleButton,"aria-label":r?"Expand sidebar":"Collapse sidebar",children:r?l==="left"?jsxRuntime.jsx(outline.ChevronRightIcon,{className:"w-4 h-4"}):jsxRuntime.jsx(outline.ChevronLeftIcon,{className:"w-4 h-4"}):l==="left"?jsxRuntime.jsx(outline.ChevronLeftIcon,{className:"w-4 h-4"}):jsxRuntime.jsx(outline.ChevronRightIcon,{className:"w-4 h-4"})});return jsxRuntime.jsxs("aside",{className:a("flex flex-col h-full bg-surface transition-all duration-slow ease-in-out z-index-sticky shadow-premium relative",l==="right"&&"border-l border-border",l==="left"&&"border-r border-border",k&&"glass",o.root,N),style:{width:D,...n.root},children:[J,m&&jsxRuntime.jsx("div",{className:a("flex items-center px-6 pt-10 pb-6",r&&"justify-center px-0",o.header),style:n.header,children:m}),jsxRuntime.jsx("div",{className:a("flex-1 overflow-y-auto overflow-x-hidden px-4 py-6 space-y-10 custom-scrollbar",o.content),style:n.content,children:s.map(e=>e.hidden?null:jsxRuntime.jsxs("div",{className:a("space-y-4",o.group),style:n.group,children:[e.label&&!r&&jsxRuntime.jsx("h3",{className:a("px-2 text-xs font-bold text-text-muted uppercase tracking-wider",o.groupLabel),style:n.groupLabel,children:e.label}),jsxRuntime.jsx("div",{className:"space-y-1",children:e.items.map(d=>h(d))})]},e.id))}),x&&jsxRuntime.jsx("div",{className:a("p-6 mt-auto border-t border-border/50",r&&"flex justify-center px-0",o.footer),style:n.footer,children:x})]})};C.displayName="Sidebar";exports.Sidebar=C;
|