inconel 0.1.12 → 0.1.13

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("react"),j=require("../shared/classNames.cjs");;/* empty css */const B=require("./constants.cjs");;/* empty css */const C=require("./utils.cjs"),I=require("../Svg/Svg.cjs");function O({loading:n=!1,fullWidth:x=!1,variant:y="primary",label:q,buttonType:S,icon:t,iconClassName:M,iconWidth:s,iconHeight:l,iconRight:i=!1,render:v=!0,debounceTime:u,isActive:o,onClick:d,disabled:r,className:g,children:k,size:w="md",pill:A=!1,count:b,progress:f,progressColor:E,...m}){const T=S??y,a=N.useMemo(()=>C.createDebouncedCallback(d,u??0),[d,u]);if(N.useEffect(()=>()=>a.cancel(),[a]),!v)return null;const _=q??k,p=typeof f=="number"?Math.max(0,Math.min(100,f)):null,h=typeof t=="string"&&t?e.jsx("span",{className:j.classNames("inconel-button__icon",i?"inconel-button__icon--right":"inconel-button__icon--left",M),style:{width:s??void 0,height:l??void 0},"aria-hidden":"true",children:e.jsx(I.default,{src:t,renumerateIRIElements:!1,loading:()=>null,fallback:()=>null,beforeInjection:c=>{s&&c.setAttribute("width",String(s)),l&&c.setAttribute("height",String(l)),c.setAttribute("preserveAspectRatio","xMidYMid meet")}})}):null;return e.jsxs("button",{...m,disabled:r||n,"aria-pressed":typeof o=="boolean"?o:m["aria-pressed"],onClick:r||n?void 0:a,className:j.classNames("inconel-button",`inconel-size-${w}`,B.BUTTON_TYPE_CLASS_NAMES[T],x&&"inconel-button--full-width",A&&"inconel-button--pill",n&&"inconel-is-loading",r&&"inconel-is-disabled",o&&"inconel-is-active",g),children:[p!==null&&e.jsx("span",{className:"inconel-button__progress",style:{width:`${p}%`,background:E??void 0}}),n&&e.jsx("span",{className:"inconel-button__spinner","aria-hidden":"true"}),!i&&h,_!==void 0&&e.jsx("span",{className:"inconel-button__title",children:_}),i&&h,b!=null&&e.jsx("span",{className:"inconel-button__count",children:b})]})}exports.Button=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("react"),j=require("../shared/classNames.cjs");;/* empty css */const B=require("./constants.cjs");;/* empty css */const C=require("./utils.cjs"),I=require("../Svg/Svg.cjs");function O({loading:n=!1,fullWidth:x=!1,variant:y="primary",label:q,buttonType:S,icon:t,iconClassName:M,iconWidth:s,iconHeight:l,iconRight:o=!1,render:v=!0,debounceTime:d,isActive:i,onClick:b,disabled:r,className:g,children:k,size:w="md",pill:A=!1,count:f,progress:m,progressColor:E,...p}){const T=S??y,a=N.useMemo(()=>C.createDebouncedCallback(b,d??0),[b,d]);if(N.useEffect(()=>()=>a.cancel(),[a]),!v)return null;const _=q??k,c=typeof m=="number"?Math.max(0,Math.min(100,m)):null,h=typeof t=="string"&&t?e.jsx("span",{className:j.classNames("inconel-button__icon",o?"inconel-button__icon--right":"inconel-button__icon--left",M),style:{width:s??void 0,height:l??void 0},"aria-hidden":"true",children:e.jsx(I.default,{src:t,renumerateIRIElements:!1,loading:()=>null,fallback:()=>null,beforeInjection:u=>{s&&u.setAttribute("width",String(s)),l&&u.setAttribute("height",String(l)),u.setAttribute("preserveAspectRatio","xMidYMid meet")}})}):null;return e.jsxs("button",{...p,disabled:r||n,"aria-pressed":typeof i=="boolean"?i:p["aria-pressed"],onClick:r||n?void 0:a,className:j.classNames("inconel-button",`inconel-size-${w}`,B.BUTTON_TYPE_CLASS_NAMES[T],x&&"inconel-button--full-width",c!==null&&"inconel-button--has-progress",A&&"inconel-button--pill",n&&"inconel-is-loading",r&&"inconel-is-disabled",i&&"inconel-is-active",g),children:[c!==null&&e.jsx("span",{className:"inconel-button__progress",style:{width:`${c}%`,background:E??void 0}}),n&&e.jsx("span",{className:"inconel-button__spinner","aria-hidden":"true"}),!o&&h,_!==void 0&&e.jsx("span",{className:"inconel-button__title",children:_}),o&&h,f!=null&&e.jsx("span",{className:"inconel-button__count",children:f})]})}exports.Button=O;
2
2
  //# sourceMappingURL=Button.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.cjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n type ButtonHTMLAttributes,\n type ReactNode,\n} from 'react'\n\nimport { classNames } from '../shared/classNames'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport { Svg } from '../Svg'\nimport {\n BUTTON_TYPE_CLASS_NAMES,\n type ButtonType,\n} from './constants'\nimport './styles.css'\nimport { createDebouncedCallback } from './utils'\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {\n label?: ReactNode\n buttonType?: ButtonType\n icon?: string | null\n iconClassName?: string\n iconWidth?: number | null\n iconHeight?: number | null\n iconRight?: boolean\n render?: boolean\n debounceTime?: number | null\n isActive?: boolean | null\n onChange?: ButtonHTMLAttributes<HTMLButtonElement>['onChange']\n loading?: boolean\n fullWidth?: boolean\n variant?: 'primary' | 'secondary' | 'danger' | 'ghost' | 'warning' | 'dark'\n size?: ControlSize\n pill?: boolean\n count?: ReactNode\n progress?: number | null\n progressColor?: string | null\n}\n\nexport function Button({\n loading = false,\n fullWidth = false,\n variant = 'primary',\n label,\n buttonType,\n icon,\n iconClassName,\n iconWidth,\n iconHeight,\n iconRight = false,\n render = true,\n debounceTime,\n isActive,\n onClick,\n disabled,\n className,\n children,\n size = 'md',\n pill = false,\n count,\n progress,\n progressColor,\n ...props\n}: ButtonProps) {\n const resolvedType = buttonType ?? variant\n const debouncedClick = useMemo(\n () => createDebouncedCallback(onClick, debounceTime ?? 0),\n [onClick, debounceTime],\n )\n\n useEffect(() => () => debouncedClick.cancel(), [debouncedClick])\n\n if (!render) return null\n\n const content = label ?? children\n const progressWidth =\n typeof progress === 'number' ? Math.max(0, Math.min(100, progress)) : null\n const iconNode = typeof icon === 'string' && icon ? (\n <span\n className={classNames(\n 'inconel-button__icon',\n iconRight\n ? 'inconel-button__icon--right'\n : 'inconel-button__icon--left',\n iconClassName,\n )}\n style={{ width: iconWidth ?? undefined, height: iconHeight ?? undefined }}\n aria-hidden=\"true\"\n >\n <Svg\n src={icon}\n renumerateIRIElements={false}\n loading={() => null}\n fallback={() => null}\n beforeInjection={(svg) => {\n if (iconWidth) svg.setAttribute('width', String(iconWidth))\n if (iconHeight) svg.setAttribute('height', String(iconHeight))\n svg.setAttribute('preserveAspectRatio', 'xMidYMid meet')\n }}\n />\n </span>\n ) : null\n\n return (\n <button\n {...props}\n disabled={disabled || loading}\n aria-pressed={\n typeof isActive === 'boolean' ? isActive : props['aria-pressed']\n }\n onClick={disabled || loading ? undefined : debouncedClick}\n className={classNames(\n 'inconel-button',\n `inconel-size-${size}`,\n BUTTON_TYPE_CLASS_NAMES[resolvedType],\n fullWidth && 'inconel-button--full-width',\n pill && 'inconel-button--pill',\n loading && 'inconel-is-loading',\n disabled && 'inconel-is-disabled',\n isActive && 'inconel-is-active',\n className,\n )}\n >\n {progressWidth !== null && (\n <span\n className=\"inconel-button__progress\"\n style={{\n width: `${progressWidth}%`,\n background: progressColor ?? undefined,\n }}\n />\n )}\n {loading && <span className=\"inconel-button__spinner\" aria-hidden=\"true\" />}\n {!iconRight && iconNode}\n {content !== undefined && (\n <span className=\"inconel-button__title\">{content}</span>\n )}\n {iconRight && iconNode}\n {count != null && <span className=\"inconel-button__count\">{count}</span>}\n </button>\n )\n}\n"],"names":["Button","loading","fullWidth","variant","label","buttonType","icon","iconClassName","iconWidth","iconHeight","iconRight","render","debounceTime","isActive","onClick","disabled","className","children","size","pill","count","progress","progressColor","props","resolvedType","debouncedClick","useMemo","createDebouncedCallback","useEffect","content","progressWidth","iconNode","jsx","classNames","Svg","svg","jsxs","BUTTON_TYPE_CLASS_NAMES"],"mappings":"2UAyCO,SAASA,EAAO,CACrB,QAAAC,EAAU,GACV,UAAAC,EAAY,GACZ,QAAAC,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,cAAc,EAEjE,QAASR,GAAYd,EAAU,OAAYwB,EAC3C,UAAWQ,EAAAA,WACT,iBACA,gBAAgBf,CAAI,GACpBmB,EAAAA,wBAAwBb,CAAY,EACpCtB,GAAa,6BACbiB,GAAQ,uBACRlB,GAAW,qBACXc,GAAY,sBACZF,GAAY,oBACZG,CAAA,EAGD,SAAA,CAAAc,IAAkB,MACjBE,EAAAA,IAAC,OAAA,CACC,UAAU,2BACV,MAAO,CACL,MAAO,GAAGF,CAAa,IACvB,WAAYR,GAAiB,MAAA,CAC/B,CAAA,EAGHrB,GAAW+B,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA0B,cAAY,OAAO,EACxE,CAACtB,GAAaqB,EACdF,IAAY,QACXG,EAAAA,IAAC,OAAA,CAAK,UAAU,wBAAyB,SAAAH,EAAQ,EAElDnB,GAAaqB,EACbX,GAAS,MAAQY,EAAAA,IAAC,OAAA,CAAK,UAAU,wBAAyB,SAAAZ,CAAA,CAAM,CAAA,CAAA,CAAA,CAGvE"}
1
+ {"version":3,"file":"Button.cjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n type ButtonHTMLAttributes,\n type ReactNode,\n} from 'react'\n\nimport { classNames } from '../shared/classNames'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport { Svg } from '../Svg'\nimport {\n BUTTON_TYPE_CLASS_NAMES,\n type ButtonType,\n} from './constants'\nimport './styles.css'\nimport { createDebouncedCallback } from './utils'\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {\n label?: ReactNode\n buttonType?: ButtonType\n icon?: string | null\n iconClassName?: string\n iconWidth?: number | null\n iconHeight?: number | null\n iconRight?: boolean\n render?: boolean\n debounceTime?: number | null\n isActive?: boolean | null\n onChange?: ButtonHTMLAttributes<HTMLButtonElement>['onChange']\n loading?: boolean\n fullWidth?: boolean\n variant?: 'primary' | 'secondary' | 'danger' | 'ghost' | 'warning' | 'dark'\n size?: ControlSize\n pill?: boolean\n count?: ReactNode\n progress?: number | null\n progressColor?: string | null\n}\n\nexport function Button({\n loading = false,\n fullWidth = false,\n variant = 'primary',\n label,\n buttonType,\n icon,\n iconClassName,\n iconWidth,\n iconHeight,\n iconRight = false,\n render = true,\n debounceTime,\n isActive,\n onClick,\n disabled,\n className,\n children,\n size = 'md',\n pill = false,\n count,\n progress,\n progressColor,\n ...props\n}: ButtonProps) {\n const resolvedType = buttonType ?? variant\n const debouncedClick = useMemo(\n () => createDebouncedCallback(onClick, debounceTime ?? 0),\n [onClick, debounceTime],\n )\n\n useEffect(() => () => debouncedClick.cancel(), [debouncedClick])\n\n if (!render) return null\n\n const content = label ?? children\n const progressWidth =\n typeof progress === 'number' ? Math.max(0, Math.min(100, progress)) : null\n const iconNode = typeof icon === 'string' && icon ? (\n <span\n className={classNames(\n 'inconel-button__icon',\n iconRight\n ? 'inconel-button__icon--right'\n : 'inconel-button__icon--left',\n iconClassName,\n )}\n style={{ width: iconWidth ?? undefined, height: iconHeight ?? undefined }}\n aria-hidden=\"true\"\n >\n <Svg\n src={icon}\n renumerateIRIElements={false}\n loading={() => null}\n fallback={() => null}\n beforeInjection={(svg) => {\n if (iconWidth) svg.setAttribute('width', String(iconWidth))\n if (iconHeight) svg.setAttribute('height', String(iconHeight))\n svg.setAttribute('preserveAspectRatio', 'xMidYMid meet')\n }}\n />\n </span>\n ) : null\n\n return (\n <button\n {...props}\n disabled={disabled || loading}\n aria-pressed={\n typeof isActive === 'boolean' ? isActive : props['aria-pressed']\n }\n onClick={disabled || loading ? undefined : debouncedClick}\n className={classNames(\n 'inconel-button',\n `inconel-size-${size}`,\n BUTTON_TYPE_CLASS_NAMES[resolvedType],\n fullWidth && 'inconel-button--full-width',\n progressWidth !== null && 'inconel-button--has-progress',\n pill && 'inconel-button--pill',\n loading && 'inconel-is-loading',\n disabled && 'inconel-is-disabled',\n isActive && 'inconel-is-active',\n className,\n )}\n >\n {progressWidth !== null && (\n <span\n className=\"inconel-button__progress\"\n style={{\n width: `${progressWidth}%`,\n background: progressColor ?? undefined,\n }}\n />\n )}\n {loading && <span className=\"inconel-button__spinner\" aria-hidden=\"true\" />}\n {!iconRight && iconNode}\n {content !== undefined && (\n <span className=\"inconel-button__title\">{content}</span>\n )}\n {iconRight && iconNode}\n {count != null && <span className=\"inconel-button__count\">{count}</span>}\n </button>\n )\n}\n"],"names":["Button","loading","fullWidth","variant","label","buttonType","icon","iconClassName","iconWidth","iconHeight","iconRight","render","debounceTime","isActive","onClick","disabled","className","children","size","pill","count","progress","progressColor","props","resolvedType","debouncedClick","useMemo","createDebouncedCallback","useEffect","content","progressWidth","iconNode","jsx","classNames","Svg","svg","jsxs","BUTTON_TYPE_CLASS_NAMES"],"mappings":"2UAyCO,SAASA,EAAO,CACrB,QAAAC,EAAU,GACV,UAAAC,EAAY,GACZ,QAAAC,EAAU,UACV,MAAAC,EACA,WAAAC,EACA,KAAAC,EACA,cAAAC,EACA,UAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,GACZ,OAAAC,EAAS,GACT,aAAAC,EACA,SAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,KAAAC,EAAO,KACP,KAAAC,EAAO,GACP,MAAAC,EACA,SAAAC,EACA,cAAAC,EACA,GAAGC,CACL,EAAgB,CACd,MAAMC,EAAenB,GAAcF,EAC7BsB,EAAiBC,EAAAA,QACrB,IAAMC,0BAAwBb,EAASF,GAAgB,CAAC,EACxD,CAACE,EAASF,CAAY,CAAA,EAKxB,GAFAgB,EAAAA,UAAU,IAAM,IAAMH,EAAe,SAAU,CAACA,CAAc,CAAC,EAE3D,CAACd,EAAQ,OAAO,KAEpB,MAAMkB,EAAUzB,GAASa,EACnBa,EACJ,OAAOT,GAAa,SAAW,KAAK,IAAI,EAAG,KAAK,IAAI,IAAKA,CAAQ,CAAC,EAAI,KAClEU,EAAW,OAAOzB,GAAS,UAAYA,EAC3C0B,EAAAA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1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),ee=require("react-dom"),S=require("../shared/classNames.cjs");;/* empty css */const q=require("../Button/Button.cjs"),ne=require("../Svg/Svg.cjs");function te({downIconJsx:g,children:C,className:w,buttonClassName:B,onWindowOpen:a,onWindowClose:_=()=>{},buttonClose:$=!1,closeIcon:b,icon:A,downIcon:j,iconWidth:v=20,iconHeight:M=20,showDownIcon:K=!1,style:n={minWidth:200,arrowAlign:"right",arrowPosition:10},portalId:m,isActive:L=!1,buttonClasses:H,trigger:N,filterButtonType:E="ghost",label:O,footerJSX:P,windowTrigger:T=0,disabled:Y=!1,blockWindowClose:x=!1,notificationCount:y,closeOnAction:z=!1}){const[i,l]=o.useState(!1),[F,G]=o.useState({minWidth:n.minWidth}),R=o.useRef(null),u=o.useRef(null),h=o.useRef(x),k=o.useMemo(()=>typeof document>"u"?null:m&&document.getElementById(m)||document.body,[m]),D=t=>{if(h.current)return;const s=typeof t.composedPath=="function"?t.composedPath():[],c=R.current,d=u.current;c&&s.includes(c)||d&&s.includes(d)||(l(!1),a?.(!1),_())},Q=()=>{z&&setTimeout(()=>{h.current||(l(!1),a?.(!1),_())},0)},p=()=>{const t=!i;if(l(t),a?.(t),!u.current)return;const s=u.current.getBoundingClientRect(),c=s.left+window.scrollX,d=s.top+window.scrollY,Z=n.topTolerance??0,J=n.rightTolerance??0,I=n.leftTolerance??0,f={minWidth:n.minWidth,top:`${d+s.height+Z}px`};n.menuPosition==="right"?f.left=`${c-J}px`:n.menuPosition==="left"?f.left=`${c+I}px`:f.left=`${c-v/2}px`,G(f)};o.useEffect(()=>{if(i)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),o.useEffect(()=>{h.current=x},[x]),o.useEffect(()=>{T&&l(!1)},[T]);const U=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),p())},{arrowAlign:V,arrowPosition:W}=n,r={...n};delete r.arrowAlign,delete r.arrowPosition,delete r.menuPosition,delete r.rightTolerance,delete r.leftTolerance,delete r.topTolerance;const X=i&&k?ee.createPortal(e.jsx("div",{ref:R,className:w,children:e.jsxs("div",{style:{...F,...r},className:"inconel-dropdown-box__content",children:[e.jsx("span",{style:{[V??"right"]:W},className:"inconel-dropdown-box__arrow"}),$&&e.jsx(q.Button,{className:"inconel-dropdown-box__remove",icon:b,iconWidth:9,iconHeight:9,variant:E,onClick:()=>{l(!1),a?.(!1)},children:!b&&"×"}),e.jsx("div",{className:"inconel-dropdown-box__body",onClick:Q,children:C}),P&&e.jsx("div",{className:"inconel-dropdown-box__footer",children:P})]})}),k):null;return e.jsxs("div",{ref:u,className:S.classNames("inconel-dropdown-box",w),children:[N?e.jsx("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:U,children:N}):e.jsxs("div",{className:"inconel-dropdown-box__trigger",children:[y!=null&&e.jsx("span",{className:"inconel-dropdown-box__notification",children:y}),e.jsx(q.Button,{label:O,className:S.classNames("inconel-dropdown-box__button",i&&"inconel-is-open",L&&"inconel-is-selected",H,B),icon:A,iconWidth:v,iconHeight:M,variant:E,onClick:p,disabled:Y}),!g&&K&&j&&e.jsx(ne.default,{src:j,className:"inconel-dropdown-box__down-icon"}),g]}),X]})}exports.DropDownBox=te;
2
+ //# sourceMappingURL=DropDownBox.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropDownBox.cjs","sources":["../../../../src/components/DropDownBox/DropDownBox.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { Button, type ButtonProps } from '../Button'\nimport { classNames } from '../shared/classNames'\nimport { Svg } from '../Svg'\nimport './styles.css'\n\nexport interface DropDownBoxStyle extends CSSProperties {\n arrowAlign?: 'left' | 'right'\n arrowPosition?: number\n menuPosition?: 'left' | 'right'\n rightTolerance?: number\n leftTolerance?: number\n topTolerance?: number\n}\n\nexport interface DropDownBoxProps {\n downIconJsx?: ReactNode\n children?: ReactNode\n className?: string\n buttonClassName?: string\n onWindowOpen?: (open: boolean) => void\n onWindowClose?: () => void\n buttonClose?: boolean\n closeIcon?: string | null\n icon?: string | null\n downIcon?: string | null\n iconWidth?: number\n iconHeight?: number\n showDownIcon?: boolean\n style?: DropDownBoxStyle\n portalId?: string\n isActive?: boolean\n buttonClasses?: string\n trigger?: ReactNode\n filterButtonType?: ButtonProps['variant']\n label?: ReactNode\n footerJSX?: ReactNode\n windowTrigger?: number\n disabled?: boolean\n blockWindowClose?: boolean\n notificationCount?: number | null\n closeOnAction?: boolean\n}\n\nexport function DropDownBox({\n downIconJsx,\n children,\n className,\n buttonClassName,\n onWindowOpen,\n onWindowClose = () => {},\n buttonClose = false,\n closeIcon,\n icon,\n downIcon,\n iconWidth = 20,\n iconHeight = 20,\n showDownIcon = false,\n style = { minWidth: 200, arrowAlign: 'right', arrowPosition: 10 },\n portalId,\n isActive = false,\n buttonClasses,\n trigger,\n filterButtonType = 'ghost',\n label,\n footerJSX,\n windowTrigger = 0,\n disabled = false,\n blockWindowClose = false,\n notificationCount,\n closeOnAction = false,\n}: DropDownBoxProps) {\n const [menuOpen, setMenuOpen] = useState(false)\n const [positionStyle, setPositionStyle] = useState<CSSProperties>({\n minWidth: style.minWidth,\n })\n const menuElementRef = useRef<HTMLDivElement>(null)\n const triggerElementRef = useRef<HTMLDivElement>(null)\n const blockWindowCloseRef = useRef(blockWindowClose)\n\n const portalTarget = useMemo(() => {\n if (typeof document === 'undefined') return null\n return (portalId && document.getElementById(portalId)) || document.body\n }, [portalId])\n\n const handleClickClose = (event: MouseEvent) => {\n if (blockWindowCloseRef.current) return\n\n const path =\n typeof event.composedPath === 'function' ? event.composedPath() : []\n const menuElement = menuElementRef.current\n const triggerElement = triggerElementRef.current\n\n if (\n (menuElement && path.includes(menuElement)) ||\n (triggerElement && path.includes(triggerElement))\n ) {\n return\n }\n\n setMenuOpen(false)\n onWindowOpen?.(false)\n onWindowClose()\n }\n\n const handleContentClick = () => {\n if (!closeOnAction) return\n\n setTimeout(() => {\n if (blockWindowCloseRef.current) return\n setMenuOpen(false)\n onWindowOpen?.(false)\n onWindowClose()\n }, 0)\n }\n\n const handleClickOpen = () => {\n const next = !menuOpen\n setMenuOpen(next)\n onWindowOpen?.(next)\n\n if (!triggerElementRef.current) return\n\n const rect = triggerElementRef.current.getBoundingClientRect()\n const x = rect.left + window.scrollX\n const y = rect.top + window.scrollY\n const topTolerance = style.topTolerance ?? 0\n const rightTolerance = style.rightTolerance ?? 0\n const leftTolerance = style.leftTolerance ?? 0\n\n const nextStyle: CSSProperties = {\n minWidth: style.minWidth,\n top: `${y + rect.height + topTolerance}px`,\n }\n\n if (style.menuPosition === 'right') {\n nextStyle.left = `${x - rightTolerance}px`\n } else if (style.menuPosition === 'left') {\n nextStyle.left = `${x + leftTolerance}px`\n } else {\n nextStyle.left = `${x - iconWidth / 2}px`\n }\n\n setPositionStyle(nextStyle)\n }\n\n useEffect(() => {\n if (!menuOpen) return undefined\n document.addEventListener('mousedown', handleClickClose)\n return () => document.removeEventListener('mousedown', handleClickClose)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [menuOpen])\n\n useEffect(() => {\n blockWindowCloseRef.current = blockWindowClose\n }, [blockWindowClose])\n\n useEffect(() => {\n if (windowTrigger) setMenuOpen(false)\n }, [windowTrigger])\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n handleClickOpen()\n }\n }\n\n const { arrowAlign, arrowPosition } = style\n const restStyle: DropDownBoxStyle = { ...style }\n delete restStyle.arrowAlign\n delete restStyle.arrowPosition\n delete restStyle.menuPosition\n delete restStyle.rightTolerance\n delete restStyle.leftTolerance\n delete restStyle.topTolerance\n\n const menu =\n menuOpen && portalTarget\n ? createPortal(\n <div ref={menuElementRef} className={className}>\n <div\n style={{ ...positionStyle, ...restStyle }}\n className=\"inconel-dropdown-box__content\"\n >\n <span\n style={{ [arrowAlign ?? 'right']: arrowPosition }}\n className=\"inconel-dropdown-box__arrow\"\n />\n {buttonClose && (\n <Button\n className=\"inconel-dropdown-box__remove\"\n icon={closeIcon}\n iconWidth={9}\n iconHeight={9}\n variant={filterButtonType}\n onClick={() => {\n setMenuOpen(false)\n onWindowOpen?.(false)\n }}\n >\n {!closeIcon && '×'}\n </Button>\n )}\n <div\n className=\"inconel-dropdown-box__body\"\n onClick={handleContentClick}\n >\n {children}\n </div>\n {footerJSX && (\n <div className=\"inconel-dropdown-box__footer\">{footerJSX}</div>\n )}\n </div>\n </div>,\n portalTarget,\n )\n : null\n\n return (\n <div\n ref={triggerElementRef}\n className={classNames('inconel-dropdown-box', className)}\n >\n {trigger ? (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={handleClickOpen}\n onKeyDown={handleTriggerKeyDown}\n >\n {trigger}\n </div>\n ) : (\n <div className=\"inconel-dropdown-box__trigger\">\n {notificationCount != null && (\n <span className=\"inconel-dropdown-box__notification\">\n {notificationCount}\n </span>\n )}\n <Button\n label={label}\n className={classNames(\n 'inconel-dropdown-box__button',\n menuOpen && 'inconel-is-open',\n isActive && 'inconel-is-selected',\n buttonClasses,\n buttonClassName,\n )}\n icon={icon}\n iconWidth={iconWidth}\n iconHeight={iconHeight}\n variant={filterButtonType}\n onClick={handleClickOpen}\n disabled={disabled}\n />\n {!downIconJsx && showDownIcon && downIcon && (\n <Svg src={downIcon} className=\"inconel-dropdown-box__down-icon\" />\n )}\n {downIconJsx}\n </div>\n )}\n {menu}\n </div>\n )\n}\n"],"names":["DropDownBox","downIconJsx","children","className","buttonClassName","onWindowOpen","onWindowClose","buttonClose","closeIcon","icon","downIcon","iconWidth","iconHeight","showDownIcon","style","portalId","isActive","buttonClasses","trigger","filterButtonType","label","footerJSX","windowTrigger","disabled","blockWindowClose","notificationCount","closeOnAction","menuOpen","setMenuOpen","useState","positionStyle","setPositionStyle","menuElementRef","useRef","triggerElementRef","blockWindowCloseRef","portalTarget","useMemo","handleClickClose","event","path","menuElement","triggerElement","handleContentClick","handleClickOpen","next","rect","x","y","topTolerance","rightTolerance","leftTolerance","nextStyle","useEffect","handleTriggerKeyDown","arrowAlign","arrowPosition","restStyle","menu","createPortal","jsx","jsxs","Button","classNames","Svg"],"mappings":"uSAsDO,SAASA,GAAY,CAC1B,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,aAAAC,EACA,cAAAC,EAAgB,IAAM,CAAC,EACvB,YAAAC,EAAc,GACd,UAAAC,EACA,KAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,GACZ,WAAAC,EAAa,GACb,aAAAC,EAAe,GACf,MAAAC,EAAQ,CAAE,SAAU,IAAK,WAAY,QAAS,cAAe,EAAA,EAC7D,SAAAC,EACA,SAAAC,EAAW,GACX,cAAAC,EACA,QAAAC,EACA,iBAAAC,EAAmB,QACnB,MAAAC,EACA,UAAAC,EACA,cAAAC,EAAgB,EAChB,SAAAC,EAAW,GACX,iBAAAC,EAAmB,GACnB,kBAAAC,EACA,cAAAC,EAAgB,EAClB,EAAqB,CACnB,KAAM,CAACC,EAAUC,CAAW,EAAIC,EAAAA,SAAS,EAAK,EACxC,CAACC,EAAeC,CAAgB,EAAIF,WAAwB,CAChE,SAAUf,EAAM,QAAA,CACjB,EACKkB,EAAiBC,EAAAA,OAAuB,IAAI,EAC5CC,EAAoBD,EAAAA,OAAuB,IAAI,EAC/CE,EAAsBF,EAAAA,OAAOT,CAAgB,EAE7CY,EAAeC,EAAAA,QAAQ,IACvB,OAAO,SAAa,IAAoB,KACpCtB,GAAY,SAAS,eAAeA,CAAQ,GAAM,SAAS,KAClE,CAACA,CAAQ,CAAC,EAEPuB,EAAoBC,GAAsB,CAC9C,GAAIJ,EAAoB,QAAS,OAEjC,MAAMK,EACJ,OAAOD,EAAM,cAAiB,WAAaA,EAAM,aAAA,EAAiB,CAAA,EAC9DE,EAAcT,EAA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AU,gCACZ,SAAA,CAAApC,GAAqB,MACpBmC,EAAAA,IAAC,OAAA,CAAK,UAAU,qCACb,SAAAnC,EACH,EAEFmC,EAAAA,IAACE,EAAAA,OAAA,CACC,MAAA1C,EACA,UAAW2C,EAAAA,WACT,+BACApC,GAAY,kBACZX,GAAY,sBACZC,EACAb,CAAA,EAEF,KAAAK,EACA,UAAAE,EACA,WAAAC,EACA,QAASO,EACT,QAASyB,EACT,SAAArB,CAAA,CAAA,EAED,CAACtB,GAAeY,GAAgBH,SAC9BsD,GAAAA,QAAA,CAAI,IAAKtD,EAAU,UAAU,kCAAkC,EAEjET,CAAA,EACH,EAEDyD,CAAA,CAAA,CAAA,CAGP"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),n=require("react"),w=require("@floating-ui/react"),gt=require("@tanstack/react-virtual"),bt=require("react-dom"),u=require("../shared/classNames.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const ht=require("../FieldFeedback/FieldFeedback.cjs"),yt=require("../../adapters/context.cjs");function xt({id:ve,name:P,label:R,options:M=[],value:ke,onChange:q,optionLabel:L="label",optionValue:A="value",getOptionSearchText:F,isOptionDisabled:B=()=>!1,placeholder:Se,isClearable:ee=!1,isDisabled:we=!1,isReadOnly:je=!1,isRequired:te=!1,isLoading:Ie=!1,loadOptions:h,loadOptionsDebounceMs:ne=250,hint:se,errorMessage:y,asyncErrorMessage:Ee,loadingMessage:Ne,noOptionsMessage:qe,clearButtonLabel:Le,openMenuButtonLabel:Ae,closeMenuButtonLabel:Be,searchLocale:$,menuPortalTarget:C,virtualize:Ce=!1,virtualizationThreshold:De=100,optionHeight:ze=44,className:Oe,classNames:o={},styles:i={},onInputChange:j,onMenuOpen:Ve,onMenuClose:le,autoFocus:Re,selectClassName:re,disabled:Me,isSearchable:Fe=!0,readOnly:$e,defaultValue:He,errorPlace:H,onBlur:Te,setFieldValue:Ue,render:Ye=!0,singleValue:Ke,sortByUppercase:_e,inputClassName:We,labelClassName:Ge,size:ae="md",required:Je},Qe){const m=yt.useInconelAdapters(),oe=Ke!==void 0||re!==void 0||H!==void 0,D=ke??Ue??He??null,Xe=n.useId(),d=ve??`inconel-select-${Xe.replace(/:/g,"")}`,ie=`${d}-label`,ce=`${d}-listbox`,ue=`${d}-message`,de=`${d}-hint`,fe=n.useRef(null),I=n.useRef(null),T=n.useRef(null),[l,me]=n.useState(!1),[p,U]=n.useState(""),[c,f]=n.useState(0),[Ze,Pe]=n.useState(null),[et,pe]=n.useState(!1),[tt,ge]=n.useState(!1);n.useEffect(()=>{if(!h)return;const e=new AbortController,t=window.setTimeout(async()=>{pe(!0),ge(!1);try{const a=await h(p,e.signal);e.signal.aborted||Pe(a)}catch{e.signal.aborted||ge(!0)}finally{e.signal.aborted||pe(!1)}},ne);return()=>{window.clearTimeout(t),e.abort()}},[p,h,ne]);const x=h?Ze??M:M,Y=Ie||et,g=we||!!Me,E=je||!!$e,K=te||!!Je,nt=(H==="in"&&y?String(y):Se)??String(m.translate?.("select","Seçim yapın...")??"Seçim yapın..."),st=qe??m.translate?.("noData","Sonuç bulunamadı.")??"Sonuç bulunamadı.",lt=Ne??m.translate?.("loading","Yükleniyor...")??"Yükleniyor...",rt=Le??String(m.translate?.("clearSelection","Seçimi temizle")??"Seçimi temizle"),at=Ae??String(m.translate?.("openOptions","Seçenekleri aç")??"Seçenekleri aç"),ot=Be??String(m.translate?.("closeOptions","Seçenekleri kapat")??"Seçenekleri kapat"),_=n.useCallback(e=>typeof L=="function"?L(e):String(e[L]),[L]),W=n.useCallback(e=>{if(F)return F(e);const t=_(e);return typeof t=="string"||typeof t=="number"?String(t):""},[_,F]),v=n.useCallback(e=>{const t=typeof A=="function"?A(e):e[A];if(typeof t!="string"&&typeof t!="number")throw new TypeError("optionValue must resolve to a string or number.");return t},[A]),b=D&&typeof D=="object"?v(D):D,G=n.useCallback((e,t)=>{q&&(oe?q(t):q(e,t))},[oe,q]),J=n.useMemo(()=>{const e=new Set;return x.map(v).filter(t=>e.has(t)?!0:(e.add(t),!1))},[x,v]);n.useEffect(()=>{J.length&&console.warn(`Duplicate optionValue found in Select "${R}":`,J)},[J,R]);const Q=[...M,...x].find(e=>v(e)===b),it=Q?W(Q):"",r=n.useMemo(()=>{const e=p.trim().toLocaleLowerCase($);return!e||h?x:x.filter(t=>W(t).toLocaleLowerCase($).includes(e))},[x,W,p,h,$]),{refs:be,floatingStyles:ct}=w.useFloating({open:l,placement:"bottom-start",strategy:C?"fixed":"absolute",whileElementsMounted:w.autoUpdate,middleware:[w.offset(8),w.flip({padding:12}),w.shift({padding:12}),w.size({padding:12,apply({availableHeight:e,rects:t,elements:a}){Object.assign(a.floating.style,{maxHeight:`${Math.min(230,e)}px`,width:`${t.reference.width}px`})}})]}),z=Ce||r.length>=De,O=gt.useVirtualizer({count:r.length,getScrollElement:()=>T.current,estimateSize:()=>ze,overscan:5,enabled:z&&l}),k=n.useCallback(()=>{me(!1),U(""),j?.(""),le?.()},[j,le]),N=()=>{g||E||(l||Ve?.(),me(!0))},V=n.useCallback(()=>{g||E||(G(null,null),U(""),f(0),j?.(""),I.current?.focus())},[g,E,G,j]);n.useImperativeHandle(Qe,()=>({focus:()=>I.current?.focus(),blur:()=>I.current?.blur(),clear:V}),[V]),n.useEffect(()=>{const e=t=>{const a=t.target;!fe.current?.contains(a)&&!T.current?.contains(a)&&k()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[k]),n.useEffect(()=>{c>=r.length&&f(0)},[c,r.length]),n.useEffect(()=>{z&&l&&r[c]&&O.scrollToIndex(c,{align:"auto"})},[c,r,l,z,O]);const he=e=>{B(e)||(G(v(e),e),k(),I.current?.focus())},ut=e=>{if(!r.length)return;let t=c;do t=(t+e+r.length)%r.length;while(B(r[t])&&t!==c);f(t)},X=(e=!1)=>{const t=r.map((a,S)=>({option:a,index:S}));return e&&t.reverse(),t.find(({option:a})=>!B(a))?.index??0},dt=e=>{if(e.key==="Backspace"&&!p&&b!==null&&ee){e.preventDefault(),V();return}if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),l?ut(e.key==="ArrowDown"?1:-1):(N(),f(X(e.key==="ArrowUp")));else if(e.key==="Home"&&l)e.preventDefault(),f(X());else if(e.key==="End"&&l)e.preventDefault(),f(X(!0));else if(e.key==="Enter"&&l){e.preventDefault();const t=r[c];t&&he(t)}else e.key==="Escape"&&l?(e.preventDefault(),k()):e.key==="Tab"&&k()},ye=(e,t,a)=>{const S=v(e),xe=B(e);return s.jsxs("div",{id:`${d}-option-${t}`,role:"option","aria-selected":S===b,"aria-disabled":xe,"aria-posinset":t+1,"aria-setsize":r.length,className:u.classNames("inconel-select-option",t===c&&"inconel-is-active",S===b&&"inconel-is-selected",xe&&"inconel-is-disabled",o.option),style:{...a,...i.option},onMouseEnter:()=>f(t),onMouseDown:pt=>pt.preventDefault(),onClick:()=>he(e),children:[s.jsx("span",{children:_(e)}),S===b&&s.jsx("span",{"aria-hidden":"true",children:"✓"})]},S)},ft=Y?s.jsxs("div",{role:"status",className:u.classNames("inconel-select-message",o.message),style:i.message,children:[s.jsx("span",{className:"inconel-select-spinner","aria-hidden":"true"}),lt]}):tt?s.jsx("div",{role:"alert",className:u.classNames("inconel-select-message inconel-select-message-error",o.message),style:i.message,children:Ee}):r.length===0?s.jsx("div",{className:u.classNames("inconel-select-message",o.message),style:i.message,children:st}):z?s.jsx("div",{role:"presentation",className:"inconel-select-virtual-content",style:{height:O.getTotalSize()},children:O.getVirtualItems().map(e=>ye(r[e.index],e.index,{position:"absolute",top:0,left:0,width:"100%",height:e.size,transform:`translateY(${e.start}px)`}))}):r.map((e,t)=>ye(e,t)),Z=l?s.jsx("div",{ref:e=>{T.current=e,be.setFloating(e)},id:ce,role:"listbox","aria-labelledby":ie,className:u.classNames("inconel-select-menu",C&&"inconel-select-menu-portal",o.menu),style:{...ct,...i.menu},children:ft}):null,mt=y?ue:se?de:void 0;return Ye?s.jsxs("div",{ref:fe,className:u.classNames("inconel-select-field",`inconel-size-${ae}`,`inconel-select-field--${ae}`,Oe,o.root),style:i.root,children:[s.jsxs("label",{id:ie,htmlFor:d,className:u.classNames(o.label,Ge),style:i.label,children:[R,K&&s.jsx("span",{"aria-hidden":"true",children:" *"})]}),s.jsxs("div",{ref:be.setReference,className:u.classNames("inconel-select-control",l&&"inconel-is-open",g&&"inconel-is-disabled",!!y&&"inconel-has-error",o.control),style:i.control,children:[s.jsx("input",{ref:I,id:d,role:"combobox","aria-expanded":l,"aria-controls":ce,"aria-autocomplete":"list","aria-activedescendant":l&&r[c]?`${d}-option-${c}`:void 0,"aria-describedby":mt,"aria-invalid":!!y,"aria-required":te,"aria-busy":Y,required:K,disabled:g,readOnly:E||!Fe,autoFocus:Re,autoComplete:"off",placeholder:nt,value:p||it,className:u.classNames(o.input,We,re),style:i.input,onChange:e=>{const t=_e?e.target.value.toLocaleUpperCase(m.locale??"tr-TR"):e.target.value;U(t),f(0),j?.(t),N()},onClick:N,onFocus:e=>{N(),Q&&!p&&e.currentTarget.select()},onBlur:Te,onKeyDown:dt}),Y&&s.jsx("span",{className:"inconel-select-spinner","aria-hidden":"true"}),ee&&b!==null&&!g&&!E&&s.jsx("button",{type:"button",className:u.classNames("inconel-select-clear",o.clearButton),style:i.clearButton,"aria-label":rt,onClick:V,children:"×"}),s.jsx("button",{type:"button",className:u.classNames("inconel-select-toggle",o.toggleButton),style:i.toggleButton,"aria-label":l?ot:at,"aria-expanded":l,disabled:g,tabIndex:-1,onClick:()=>l?k():N(),children:s.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",width:"20",height:"20",fill:"none",children:s.jsx("path",{d:"m5 7.5 5 5 5-5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),P&&s.jsx("input",{type:"hidden",name:P,value:b??"",required:K}),s.jsx(ht.default,{hint:se,errorMessage:H==="in"?void 0:y,hintId:de,errorId:ue}),C&&Z?bt.createPortal(Z,C):Z]}):null}const vt=n.forwardRef(xt);exports.default=vt;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),n=require("react"),w=require("@floating-ui/react"),gt=require("@tanstack/react-virtual"),bt=require("react-dom"),u=require("../shared/classNames.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const ht=require("../FieldFeedback/FieldFeedback.cjs"),yt=require("../../adapters/context.cjs");function xt({id:ve,name:P,label:j,options:M=[],value:ke,onChange:L,optionLabel:A="label",optionValue:B="value",getOptionSearchText:F,isOptionDisabled:C=()=>!1,placeholder:Se,isClearable:ee=!1,isDisabled:we=!1,isReadOnly:je=!1,isRequired:te=!1,isLoading:Ie=!1,loadOptions:h,loadOptionsDebounceMs:ne=250,hint:se,errorMessage:y,asyncErrorMessage:Ee,loadingMessage:Ne,noOptionsMessage:qe,clearButtonLabel:Le,openMenuButtonLabel:Ae,closeMenuButtonLabel:Be,searchLocale:$,menuPortalTarget:D,virtualize:Ce=!1,virtualizationThreshold:De=100,optionHeight:ze=44,className:Oe,classNames:o={},styles:i={},onInputChange:I,onMenuOpen:Ve,onMenuClose:le,autoFocus:Re,selectClassName:re,disabled:Me,isSearchable:Fe=!0,readOnly:$e,defaultValue:He,errorPlace:H,onBlur:Te,setFieldValue:Ue,render:Ye=!0,singleValue:Ke,sortByUppercase:_e,inputClassName:We,labelClassName:Ge,size:ae="md",required:Je},Qe){const m=yt.useInconelAdapters(),oe=Ke!==void 0||re!==void 0||H!==void 0,z=ke??Ue??He??null,Xe=n.useId(),d=ve??`inconel-select-${Xe.replace(/:/g,"")}`,ie=`${d}-label`,ce=`${d}-listbox`,ue=`${d}-message`,de=`${d}-hint`,fe=n.useRef(null),E=n.useRef(null),T=n.useRef(null),[l,me]=n.useState(!1),[p,U]=n.useState(""),[c,f]=n.useState(0),[Ze,Pe]=n.useState(null),[et,pe]=n.useState(!1),[tt,ge]=n.useState(!1);n.useEffect(()=>{if(!h)return;const e=new AbortController,t=window.setTimeout(async()=>{pe(!0),ge(!1);try{const a=await h(p,e.signal);e.signal.aborted||Pe(a)}catch{e.signal.aborted||ge(!0)}finally{e.signal.aborted||pe(!1)}},ne);return()=>{window.clearTimeout(t),e.abort()}},[p,h,ne]);const x=h?Ze??M:M,Y=Ie||et,g=we||!!Me,N=je||!!$e,K=te||!!Je,nt=(H==="in"&&y?String(y):Se)??String(m.translate?.("select","Seçim yapın...")??"Seçim yapın..."),st=qe??m.translate?.("noData","Sonuç bulunamadı.")??"Sonuç bulunamadı.",lt=Ne??m.translate?.("loading","Yükleniyor...")??"Yükleniyor...",rt=Le??String(m.translate?.("clearSelection","Seçimi temizle")??"Seçimi temizle"),at=Ae??String(m.translate?.("openOptions","Seçenekleri aç")??"Seçenekleri aç"),ot=Be??String(m.translate?.("closeOptions","Seçenekleri kapat")??"Seçenekleri kapat"),_=n.useCallback(e=>typeof A=="function"?A(e):String(e[A]),[A]),W=n.useCallback(e=>{if(F)return F(e);const t=_(e);return typeof t=="string"||typeof t=="number"?String(t):""},[_,F]),v=n.useCallback(e=>{const t=typeof B=="function"?B(e):e[B];if(typeof t!="string"&&typeof t!="number")throw new TypeError("optionValue must resolve to a string or number.");return t},[B]),b=z&&typeof z=="object"?v(z):z,G=n.useCallback((e,t)=>{L&&(oe?L(t):L(e,t))},[oe,L]),J=n.useMemo(()=>{const e=new Set;return x.map(v).filter(t=>e.has(t)?!0:(e.add(t),!1))},[x,v]);n.useEffect(()=>{J.length&&console.warn(`Duplicate optionValue found in Select "${j}":`,J)},[J,j]);const Q=[...M,...x].find(e=>v(e)===b),it=Q?W(Q):"",r=n.useMemo(()=>{const e=p.trim().toLocaleLowerCase($);return!e||h?x:x.filter(t=>W(t).toLocaleLowerCase($).includes(e))},[x,W,p,h,$]),{refs:be,floatingStyles:ct}=w.useFloating({open:l,placement:"bottom-start",strategy:D?"fixed":"absolute",whileElementsMounted:w.autoUpdate,middleware:[w.offset(8),w.flip({padding:12}),w.shift({padding:12}),w.size({padding:12,apply({availableHeight:e,rects:t,elements:a}){Object.assign(a.floating.style,{maxHeight:`${Math.min(230,e)}px`,width:`${t.reference.width}px`})}})]}),O=Ce||r.length>=De,V=gt.useVirtualizer({count:r.length,getScrollElement:()=>T.current,estimateSize:()=>ze,overscan:5,enabled:O&&l}),k=n.useCallback(()=>{me(!1),U(""),I?.(""),le?.()},[I,le]),q=()=>{g||N||(l||Ve?.(),me(!0))},R=n.useCallback(()=>{g||N||(G(null,null),U(""),f(0),I?.(""),E.current?.focus())},[g,N,G,I]);n.useImperativeHandle(Qe,()=>({focus:()=>E.current?.focus(),blur:()=>E.current?.blur(),clear:R}),[R]),n.useEffect(()=>{const e=t=>{const a=t.target;!fe.current?.contains(a)&&!T.current?.contains(a)&&k()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[k]),n.useEffect(()=>{c>=r.length&&f(0)},[c,r.length]),n.useEffect(()=>{O&&l&&r[c]&&V.scrollToIndex(c,{align:"auto"})},[c,r,l,O,V]);const he=e=>{C(e)||(G(v(e),e),k(),E.current?.focus())},ut=e=>{if(!r.length)return;let t=c;do t=(t+e+r.length)%r.length;while(C(r[t])&&t!==c);f(t)},X=(e=!1)=>{const t=r.map((a,S)=>({option:a,index:S}));return e&&t.reverse(),t.find(({option:a})=>!C(a))?.index??0},dt=e=>{if(e.key==="Backspace"&&!p&&b!==null&&ee){e.preventDefault(),R();return}if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),l?ut(e.key==="ArrowDown"?1:-1):(q(),f(X(e.key==="ArrowUp")));else if(e.key==="Home"&&l)e.preventDefault(),f(X());else if(e.key==="End"&&l)e.preventDefault(),f(X(!0));else if(e.key==="Enter"&&l){e.preventDefault();const t=r[c];t&&he(t)}else e.key==="Escape"&&l?(e.preventDefault(),k()):e.key==="Tab"&&k()},ye=(e,t,a)=>{const S=v(e),xe=C(e);return s.jsxs("div",{id:`${d}-option-${t}`,role:"option","aria-selected":S===b,"aria-disabled":xe,"aria-posinset":t+1,"aria-setsize":r.length,className:u.classNames("inconel-select-option",t===c&&"inconel-is-active",S===b&&"inconel-is-selected",xe&&"inconel-is-disabled",o.option),style:{...a,...i.option},onMouseEnter:()=>f(t),onMouseDown:pt=>pt.preventDefault(),onClick:()=>he(e),children:[s.jsx("span",{children:_(e)}),S===b&&s.jsx("span",{"aria-hidden":"true",children:"✓"})]},S)},ft=Y?s.jsxs("div",{role:"status",className:u.classNames("inconel-select-message",o.message),style:i.message,children:[s.jsx("span",{className:"inconel-select-spinner","aria-hidden":"true"}),lt]}):tt?s.jsx("div",{role:"alert",className:u.classNames("inconel-select-message inconel-select-message-error",o.message),style:i.message,children:Ee}):r.length===0?s.jsx("div",{className:u.classNames("inconel-select-message",o.message),style:i.message,children:st}):O?s.jsx("div",{role:"presentation",className:"inconel-select-virtual-content",style:{height:V.getTotalSize()},children:V.getVirtualItems().map(e=>ye(r[e.index],e.index,{position:"absolute",top:0,left:0,width:"100%",height:e.size,transform:`translateY(${e.start}px)`}))}):r.map((e,t)=>ye(e,t)),Z=l?s.jsx("div",{ref:e=>{T.current=e,be.setFloating(e)},id:ce,role:"listbox","aria-labelledby":j?ie:void 0,className:u.classNames("inconel-select-menu",D&&"inconel-select-menu-portal",o.menu),style:{...ct,...i.menu},children:ft}):null,mt=y?ue:se?de:void 0;return Ye?s.jsxs("div",{ref:fe,className:u.classNames("inconel-select-field",`inconel-size-${ae}`,`inconel-select-field--${ae}`,Oe,o.root),style:i.root,children:[j&&s.jsxs("label",{id:ie,htmlFor:d,className:u.classNames(o.label,Ge),style:i.label,children:[j,K&&s.jsx("span",{"aria-hidden":"true",children:" *"})]}),s.jsxs("div",{ref:be.setReference,className:u.classNames("inconel-select-control",l&&"inconel-is-open",g&&"inconel-is-disabled",!!y&&"inconel-has-error",o.control),style:i.control,children:[s.jsx("input",{ref:E,id:d,role:"combobox","aria-expanded":l,"aria-controls":ce,"aria-autocomplete":"list","aria-activedescendant":l&&r[c]?`${d}-option-${c}`:void 0,"aria-describedby":mt,"aria-invalid":!!y,"aria-required":te,"aria-busy":Y,required:K,disabled:g,readOnly:N||!Fe,autoFocus:Re,autoComplete:"off",placeholder:nt,value:p||it,className:u.classNames(o.input,We,re),style:i.input,onChange:e=>{const t=_e?e.target.value.toLocaleUpperCase(m.locale??"tr-TR"):e.target.value;U(t),f(0),I?.(t),q()},onClick:q,onFocus:e=>{q(),Q&&!p&&e.currentTarget.select()},onBlur:Te,onKeyDown:dt}),Y&&s.jsx("span",{className:"inconel-select-spinner","aria-hidden":"true"}),ee&&b!==null&&!g&&!N&&s.jsx("button",{type:"button",className:u.classNames("inconel-select-clear",o.clearButton),style:i.clearButton,"aria-label":rt,onClick:R,children:"×"}),s.jsx("button",{type:"button",className:u.classNames("inconel-select-toggle",o.toggleButton),style:i.toggleButton,"aria-label":l?ot:at,"aria-expanded":l,disabled:g,tabIndex:-1,onClick:()=>l?k():q(),children:s.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",width:"20",height:"20",fill:"none",children:s.jsx("path",{d:"m5 7.5 5 5 5-5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),P&&s.jsx("input",{type:"hidden",name:P,value:b??"",required:K}),s.jsx(ht.default,{hint:se,errorMessage:H==="in"?void 0:y,hintId:de,errorId:ue}),D&&Z?bt.createPortal(Z,D):Z]}):null}const vt=n.forwardRef(xt);exports.default=vt;
2
2
  //# sourceMappingURL=Select.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n size as floatingSize,\n useFloating,\n} from '@floating-ui/react'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport { createPortal } from 'react-dom'\nimport { useInconelAdapters } from '../../adapters'\nimport { classNames as mergeClassNames } from '../shared/classNames'\nimport '../shared/field.css'\nimport '../shared/field-controls.css'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport './styles.css'\n\nimport FieldFeedback from '../FieldFeedback/FieldFeedback'\nimport type { FieldFeedbackContentProps } from '../FieldFeedback/FieldFeedback'\n\nexport type OptionValue = string | number\n\nexport interface SelectHandle {\n focus: () => void\n blur: () => void\n clear: () => void\n}\n\ntype SelectPart =\n | 'root'\n | 'label'\n | 'control'\n | 'input'\n | 'clearButton'\n | 'toggleButton'\n | 'menu'\n | 'option'\n | 'message'\n\nexport type SelectClassNames = Partial<Record<SelectPart, string>>\nexport type SelectStyles = Partial<Record<SelectPart, CSSProperties>>\n\nexport interface SelectProps<T extends object> extends FieldFeedbackContentProps {\n id?: string\n name?: string\n label?: ReactNode\n options?: T[]\n value?: OptionValue | T | null\n onChange?:\n | ((value: OptionValue | null, option: T | null) => void)\n | ((option: T | null) => void)\n optionLabel?: keyof T | ((option: T) => ReactNode)\n optionValue?: keyof T | ((option: T) => OptionValue)\n getOptionSearchText?: (option: T) => string\n isOptionDisabled?: (option: T) => boolean\n placeholder?: string\n isClearable?: boolean\n isDisabled?: boolean\n isReadOnly?: boolean\n isRequired?: boolean\n isLoading?: boolean\n loadOptions?: (inputValue: string, signal: AbortSignal) => Promise<T[]>\n loadOptionsDebounceMs?: number\n asyncErrorMessage?: ReactNode\n loadingMessage?: ReactNode\n noOptionsMessage?: ReactNode\n clearButtonLabel?: string\n openMenuButtonLabel?: string\n closeMenuButtonLabel?: string\n searchLocale?: string\n menuPortalTarget?: HTMLElement | null\n virtualize?: boolean\n virtualizationThreshold?: number\n optionHeight?: number\n className?: string\n classNames?: SelectClassNames\n styles?: SelectStyles\n onInputChange?: (value: string) => void\n onMenuOpen?: () => void\n onMenuClose?: () => void\n autoFocus?: boolean\n selectClassName?: string\n disabled?: boolean\n isSearchable?: boolean\n readOnly?: boolean\n defaultValue?: OptionValue | T | null\n errorPlace?: 'in' | 'out' | string\n onBlur?: () => void\n setFieldValue?: OptionValue | string | null\n render?: boolean\n singleValue?: boolean\n sortByUppercase?: boolean\n selectClassNamePrefix?: string\n menuPlacement?: 'auto' | 'bottom' | 'top'\n maxMenuHeight?: number\n inputClassName?: string\n labelClassName?: string\n size?: ControlSize\n required?: boolean\n components?: Record<string, unknown>\n}\n\nfunction SelectInner<T extends object>(\n {\n id,\n name,\n label,\n options = [],\n value,\n onChange,\n optionLabel = 'label' as keyof T,\n optionValue = 'value' as keyof T,\n getOptionSearchText,\n isOptionDisabled = () => false,\n placeholder,\n isClearable = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n isLoading = false,\n loadOptions,\n loadOptionsDebounceMs = 250,\n hint,\n errorMessage,\n asyncErrorMessage,\n loadingMessage,\n noOptionsMessage,\n clearButtonLabel,\n openMenuButtonLabel,\n closeMenuButtonLabel,\n searchLocale,\n menuPortalTarget,\n virtualize = false,\n virtualizationThreshold = 100,\n optionHeight = 44,\n className,\n classNames = {},\n styles = {},\n onInputChange,\n onMenuOpen,\n onMenuClose,\n autoFocus,\n selectClassName,\n disabled,\n isSearchable = true,\n readOnly,\n defaultValue,\n errorPlace,\n onBlur,\n setFieldValue,\n render = true,\n singleValue,\n sortByUppercase,\n inputClassName,\n labelClassName,\n size = 'md',\n required,\n }: SelectProps<T>,\n forwardedRef: ForwardedRef<SelectHandle>,\n) {\n const adapters = useInconelAdapters()\n const legacyMode =\n singleValue !== undefined ||\n selectClassName !== undefined ||\n errorPlace !== undefined\n const controlledValue = value ?? setFieldValue ?? defaultValue ?? null\n const generatedId = useId()\n const inputId = id ?? `inconel-select-${generatedId.replace(/:/g, '')}`\n const labelId = `${inputId}-label`\n const listboxId = `${inputId}-listbox`\n const messageId = `${inputId}-message`\n const hintId = `${inputId}-hint`\n const rootRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const menuRef = useRef<HTMLDivElement>(null)\n const [isOpen, setIsOpen] = useState(false)\n const [inputValue, setInputValue] = useState('')\n const [activeIndex, setActiveIndex] = useState(0)\n const [asyncOptions, setAsyncOptions] = useState<T[] | null>(null)\n const [isAsyncLoading, setIsAsyncLoading] = useState(false)\n const [hasAsyncError, setHasAsyncError] = useState(false)\n\n useEffect(() => {\n if (!loadOptions) return\n const controller = new AbortController()\n const timeout = window.setTimeout(async () => {\n setIsAsyncLoading(true)\n setHasAsyncError(false)\n try {\n const loadedOptions = await loadOptions(\n inputValue,\n controller.signal,\n )\n if (!controller.signal.aborted) setAsyncOptions(loadedOptions)\n } catch {\n if (!controller.signal.aborted) setHasAsyncError(true)\n } finally {\n if (!controller.signal.aborted) setIsAsyncLoading(false)\n }\n }, loadOptionsDebounceMs)\n\n return () => {\n window.clearTimeout(timeout)\n controller.abort()\n }\n }, [inputValue, loadOptions, loadOptionsDebounceMs])\n\n const availableOptions = loadOptions\n ? (asyncOptions ?? options)\n : options\n const loading = isLoading || isAsyncLoading\n const componentDisabled = isDisabled || Boolean(disabled)\n const componentReadOnly = isReadOnly || Boolean(readOnly)\n const componentRequired = isRequired || Boolean(required)\n const resolvedPlaceholder =\n (errorPlace === 'in' && errorMessage\n ? String(errorMessage)\n : placeholder) ??\n String(adapters.translate?.('select', 'Seçim yapın...') ?? 'Seçim yapın...')\n const resolvedNoOptionsMessage =\n noOptionsMessage ??\n adapters.translate?.('noData', 'Sonuç bulunamadı.') ??\n 'Sonuç bulunamadı.'\n const resolvedLoadingMessage =\n loadingMessage ??\n adapters.translate?.('loading', 'Yükleniyor...') ??\n 'Yükleniyor...'\n const resolvedClearLabel =\n clearButtonLabel ??\n String(adapters.translate?.('clearSelection', 'Seçimi temizle') ?? 'Seçimi temizle')\n const resolvedOpenLabel =\n openMenuButtonLabel ??\n String(adapters.translate?.('openOptions', 'Seçenekleri aç') ?? 'Seçenekleri aç')\n const resolvedCloseLabel =\n closeMenuButtonLabel ??\n String(adapters.translate?.('closeOptions', 'Seçenekleri kapat') ?? 'Seçenekleri kapat')\n\n const getLabel = useCallback(\n (option: T): ReactNode =>\n typeof optionLabel === 'function'\n ? optionLabel(option)\n : String(option[optionLabel]),\n [optionLabel],\n )\n\n const getSearchLabel = useCallback(\n (option: T) => {\n if (getOptionSearchText) return getOptionSearchText(option)\n const renderedLabel = getLabel(option)\n return typeof renderedLabel === 'string' ||\n typeof renderedLabel === 'number'\n ? String(renderedLabel)\n : ''\n },\n [getLabel, getOptionSearchText],\n )\n\n const getValue = useCallback(\n (option: T): OptionValue => {\n const resolvedValue =\n typeof optionValue === 'function'\n ? optionValue(option)\n : option[optionValue]\n\n if (\n typeof resolvedValue !== 'string' &&\n typeof resolvedValue !== 'number'\n ) {\n throw new TypeError('optionValue must resolve to a string or number.')\n }\n return resolvedValue\n },\n [optionValue],\n )\n\n const normalizedValue =\n controlledValue && typeof controlledValue === 'object'\n ? getValue(controlledValue as T)\n : (controlledValue as OptionValue | null)\n\n const emitChange = useCallback(\n (nextValue: OptionValue | null, option: T | null) => {\n if (!onChange) return\n if (legacyMode) {\n ;(onChange as (selected: T | null) => void)(option)\n } else {\n ;(\n onChange as (\n value: OptionValue | null,\n selected: T | null,\n ) => void\n )(nextValue, option)\n }\n },\n [legacyMode, onChange],\n )\n\n const duplicateValues = useMemo(() => {\n const seen = new Set<OptionValue>()\n return availableOptions\n .map(getValue)\n .filter((optionId) => {\n if (seen.has(optionId)) return true\n seen.add(optionId)\n return false\n })\n }, [availableOptions, getValue])\n\n useEffect(() => {\n if (duplicateValues.length) {\n console.warn(\n `Duplicate optionValue found in Select \"${label}\":`,\n duplicateValues,\n )\n }\n }, [duplicateValues, label])\n\n const selectedOption = [...options, ...availableOptions].find(\n (option) => getValue(option) === normalizedValue,\n )\n const selectedLabel = selectedOption ? getSearchLabel(selectedOption) : ''\n\n const filteredOptions = useMemo(() => {\n const query = inputValue.trim().toLocaleLowerCase(searchLocale)\n if (!query || loadOptions) return availableOptions\n return availableOptions.filter((option) =>\n getSearchLabel(option).toLocaleLowerCase(searchLocale).includes(query),\n )\n }, [availableOptions, getSearchLabel, inputValue, loadOptions, searchLocale])\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement: 'bottom-start',\n strategy: menuPortalTarget ? 'fixed' : 'absolute',\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(8),\n flip({ padding: 12 }),\n shift({ padding: 12 }),\n floatingSize({\n padding: 12,\n apply({ availableHeight, rects, elements }) {\n Object.assign(elements.floating.style, {\n maxHeight: `${Math.min(230, availableHeight)}px`,\n width: `${rects.reference.width}px`,\n })\n },\n }),\n ],\n })\n\n const shouldVirtualize =\n virtualize || filteredOptions.length >= virtualizationThreshold\n const virtualizer = useVirtualizer({\n count: filteredOptions.length,\n getScrollElement: () => menuRef.current,\n estimateSize: () => optionHeight,\n overscan: 5,\n enabled: shouldVirtualize && isOpen,\n })\n\n const closeMenu = useCallback(() => {\n setIsOpen(false)\n setInputValue('')\n onInputChange?.('')\n onMenuClose?.()\n }, [onInputChange, onMenuClose])\n\n const openMenu = () => {\n if (componentDisabled || componentReadOnly) return\n if (!isOpen) onMenuOpen?.()\n setIsOpen(true)\n }\n\n const clearSelection = useCallback(() => {\n if (componentDisabled || componentReadOnly) return\n emitChange(null, null)\n setInputValue('')\n setActiveIndex(0)\n onInputChange?.('')\n inputRef.current?.focus()\n }, [componentDisabled, componentReadOnly, emitChange, onInputChange])\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n clear: clearSelection,\n }),\n [clearSelection],\n )\n\n useEffect(() => {\n const closeOnOutsideClick = (event: MouseEvent) => {\n const target = event.target as Node\n if (\n !rootRef.current?.contains(target) &&\n !menuRef.current?.contains(target)\n ) {\n closeMenu()\n }\n }\n\n document.addEventListener('mousedown', closeOnOutsideClick)\n return () => document.removeEventListener('mousedown', closeOnOutsideClick)\n }, [closeMenu])\n\n useEffect(() => {\n if (activeIndex >= filteredOptions.length) setActiveIndex(0)\n }, [activeIndex, filteredOptions.length])\n\n useEffect(() => {\n if (shouldVirtualize && isOpen && filteredOptions[activeIndex]) {\n virtualizer.scrollToIndex(activeIndex, { align: 'auto' })\n }\n }, [\n activeIndex,\n filteredOptions,\n isOpen,\n shouldVirtualize,\n virtualizer,\n ])\n\n const selectOption = (option: T) => {\n if (isOptionDisabled(option)) return\n emitChange(getValue(option), option)\n closeMenu()\n inputRef.current?.focus()\n }\n\n const moveActiveOption = (direction: 1 | -1) => {\n if (!filteredOptions.length) return\n let nextIndex = activeIndex\n do {\n nextIndex =\n (nextIndex + direction + filteredOptions.length) %\n filteredOptions.length\n } while (\n isOptionDisabled(filteredOptions[nextIndex]) &&\n nextIndex !== activeIndex\n )\n setActiveIndex(nextIndex)\n }\n\n const findEnabledIndex = (fromEnd = false) => {\n const entries = filteredOptions.map((option, index) => ({ option, index }))\n if (fromEnd) entries.reverse()\n return entries.find(({ option }) => !isOptionDisabled(option))?.index ?? 0\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (\n event.key === 'Backspace' &&\n !inputValue &&\n normalizedValue !== null &&\n isClearable\n ) {\n event.preventDefault()\n clearSelection()\n return\n }\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n if (!isOpen) {\n openMenu()\n setActiveIndex(findEnabledIndex(event.key === 'ArrowUp'))\n } else {\n moveActiveOption(event.key === 'ArrowDown' ? 1 : -1)\n }\n } else if (event.key === 'Home' && isOpen) {\n event.preventDefault()\n setActiveIndex(findEnabledIndex())\n } else if (event.key === 'End' && isOpen) {\n event.preventDefault()\n setActiveIndex(findEnabledIndex(true))\n } else if (event.key === 'Enter' && isOpen) {\n event.preventDefault()\n const activeOption = filteredOptions[activeIndex]\n if (activeOption) selectOption(activeOption)\n } else if (event.key === 'Escape' && isOpen) {\n event.preventDefault()\n closeMenu()\n } else if (event.key === 'Tab') {\n closeMenu()\n }\n }\n\n const renderOption = (option: T, index: number, style?: CSSProperties) => {\n const optionId = getValue(option)\n const disabled = isOptionDisabled(option)\n return (\n <div\n id={`${inputId}-option-${index}`}\n key={optionId}\n role=\"option\"\n aria-selected={optionId === normalizedValue}\n aria-disabled={disabled}\n aria-posinset={index + 1}\n aria-setsize={filteredOptions.length}\n className={mergeClassNames(\n 'inconel-select-option',\n index === activeIndex && 'inconel-is-active',\n optionId === normalizedValue && 'inconel-is-selected',\n disabled && 'inconel-is-disabled',\n classNames.option,\n )}\n style={{ ...style, ...styles.option }}\n onMouseEnter={() => setActiveIndex(index)}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => selectOption(option)}\n >\n <span>{getLabel(option)}</span>\n {optionId === normalizedValue && <span aria-hidden=\"true\">✓</span>}\n </div>\n )\n }\n\n const menuContent = loading ? (\n <div\n role=\"status\"\n className={mergeClassNames('inconel-select-message', classNames.message)}\n style={styles.message}\n >\n <span className=\"inconel-select-spinner\" aria-hidden=\"true\" />\n {resolvedLoadingMessage}\n </div>\n ) : hasAsyncError ? (\n <div\n role=\"alert\"\n className={mergeClassNames('inconel-select-message inconel-select-message-error', classNames.message)}\n style={styles.message}\n >\n {asyncErrorMessage}\n </div>\n ) : filteredOptions.length === 0 ? (\n <div\n className={mergeClassNames('inconel-select-message', classNames.message)}\n style={styles.message}\n >\n {resolvedNoOptionsMessage}\n </div>\n ) : shouldVirtualize ? (\n <div\n role=\"presentation\"\n className=\"inconel-select-virtual-content\"\n style={{ height: virtualizer.getTotalSize() }}\n >\n {virtualizer.getVirtualItems().map((virtualRow) =>\n renderOption(filteredOptions[virtualRow.index], virtualRow.index, {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n }),\n )}\n </div>\n ) : (\n filteredOptions.map((option, index) => renderOption(option, index))\n )\n\n const menu = isOpen ? (\n <div\n ref={(node) => {\n menuRef.current = node\n refs.setFloating(node)\n }}\n id={listboxId}\n role=\"listbox\"\n aria-labelledby={labelId}\n className={mergeClassNames(\n 'inconel-select-menu',\n menuPortalTarget && 'inconel-select-menu-portal',\n classNames.menu,\n )}\n style={{ ...floatingStyles, ...styles.menu }}\n >\n {menuContent}\n </div>\n ) : null\n\n const describedBy = errorMessage ? messageId : hint ? hintId : undefined\n\n if (!render) return null\n\n return (\n <div\n ref={rootRef}\n className={mergeClassNames(\n 'inconel-select-field',\n `inconel-size-${size}`,\n `inconel-select-field--${size}`,\n className,\n classNames.root,\n )}\n style={styles.root}\n >\n <label\n id={labelId}\n htmlFor={inputId}\n className={mergeClassNames(classNames.label, labelClassName)}\n style={styles.label}\n >\n {label}\n {componentRequired && <span aria-hidden=\"true\"> *</span>}\n </label>\n <div\n ref={refs.setReference}\n className={mergeClassNames(\n 'inconel-select-control',\n isOpen && 'inconel-is-open',\n componentDisabled && 'inconel-is-disabled',\n Boolean(errorMessage) && 'inconel-has-error',\n classNames.control,\n )}\n style={styles.control}\n >\n <input\n ref={inputRef}\n id={inputId}\n role=\"combobox\"\n aria-expanded={isOpen}\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n isOpen && filteredOptions[activeIndex]\n ? `${inputId}-option-${activeIndex}`\n : undefined\n }\n aria-describedby={describedBy}\n aria-invalid={Boolean(errorMessage)}\n aria-required={isRequired}\n aria-busy={loading}\n required={componentRequired}\n disabled={componentDisabled}\n readOnly={componentReadOnly || !isSearchable}\n autoFocus={autoFocus}\n autoComplete=\"off\"\n placeholder={resolvedPlaceholder}\n value={inputValue || selectedLabel}\n className={mergeClassNames(classNames.input, inputClassName, selectClassName)}\n style={styles.input}\n onChange={(event) => {\n const nextInput = sortByUppercase\n ? event.target.value.toLocaleUpperCase(\n adapters.locale ?? 'tr-TR',\n )\n : event.target.value\n setInputValue(nextInput)\n setActiveIndex(0)\n onInputChange?.(nextInput)\n openMenu()\n }}\n onClick={openMenu}\n onFocus={(event) => {\n openMenu()\n if (selectedOption && !inputValue) event.currentTarget.select()\n }}\n onBlur={onBlur}\n onKeyDown={handleKeyDown}\n />\n {loading && <span className=\"inconel-select-spinner\" aria-hidden=\"true\" />}\n {isClearable && normalizedValue !== null && !componentDisabled && !componentReadOnly && (\n <button\n type=\"button\"\n className={mergeClassNames('inconel-select-clear', classNames.clearButton)}\n style={styles.clearButton}\n aria-label={resolvedClearLabel}\n onClick={clearSelection}\n >\n ×\n </button>\n )}\n <button\n type=\"button\"\n className={mergeClassNames('inconel-select-toggle', classNames.toggleButton)}\n style={styles.toggleButton}\n aria-label={isOpen ? resolvedCloseLabel : resolvedOpenLabel}\n aria-expanded={isOpen}\n disabled={componentDisabled}\n tabIndex={-1}\n onClick={() => (isOpen ? closeMenu() : openMenu())}\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n height=\"20\"\n fill=\"none\"\n >\n <path\n d=\"m5 7.5 5 5 5-5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={normalizedValue ?? ''}\n required={componentRequired}\n />\n )}\n <FieldFeedback\n hint={hint}\n errorMessage={errorPlace === 'in' ? undefined : errorMessage}\n hintId={hintId}\n errorId={messageId}\n />\n\n {menuPortalTarget && menu\n ? createPortal(menu, menuPortalTarget)\n : menu}\n </div>\n )\n}\n\nconst Select = forwardRef(SelectInner) as <T extends object>(\n props: SelectProps<T> & { ref?: ForwardedRef<SelectHandle> },\n) => ReactNode\n\nexport default Select\n"],"names":["SelectInner","id","name","label","options","value","onChange","optionLabel","optionValue","getOptionSearchText","isOptionDisabled","placeholder","isClearable","isDisabled","isReadOnly","isRequired","isLoading","loadOptions","loadOptionsDebounceMs","hint","errorMessage","asyncErrorMessage","loadingMessage","noOptionsMessage","clearButtonLabel","openMenuButtonLabel","closeMenuButtonLabel","searchLocale","menuPortalTarget","virtualize","virtualizationThreshold","optionHeight","className","classNames","styles","onInputChange","onMenuOpen","onMenuClose","autoFocus","selectClassName","disabled","isSearchable","readOnly","defaultValue","errorPlace","onBlur","setFieldValue","render","singleValue","sortByUppercase","inputClassName","labelClassName","size","required","forwardedRef","adapters","useInconelAdapters","legacyMode","controlledValue","generatedId","useId","inputId","labelId","listboxId","messageId","hintId","rootRef","useRef","inputRef","menuRef","isOpen","setIsOpen","useState","inputValue","setInputValue","activeIndex","setActiveIndex","asyncOptions","setAsyncOptions","isAsyncLoading","setIsAsyncLoading","hasAsyncError","setHasAsyncError","useEffect","controller","timeout","loadedOptions","availableOptions","loading","componentDisabled","componentReadOnly","componentRequired","resolvedPlaceholder","resolvedNoOptionsMessage","resolvedLoadingMessage","resolvedClearLabel","resolvedOpenLabel","resolvedCloseLabel","getLabel","useCallback","option","getSearchLabel","renderedLabel","getValue","resolvedValue","normalizedValue","emitChange","nextValue","duplicateValues","useMemo","seen","optionId","selectedOption","selectedLabel","filteredOptions","query","refs","floatingStyles","useFloating","autoUpdate","offset","flip","shift","floatingSize","availableHeight","rects","elements","shouldVirtualize","virtualizer","useVirtualizer","closeMenu","openMenu","clearSelection","useImperativeHandle","closeOnOutsideClick","event","target","selectOption","moveActiveOption","direction","nextIndex","findEnabledIndex","fromEnd","entries","index","handleKeyDown","activeOption","renderOption","style","jsxs","mergeClassNames","jsx","menuContent","virtualRow","menu","node","describedBy","nextInput","FieldFeedback","createPortal","Select","forwardRef"],"mappings":"shBAqHA,SAASA,GACP,CACE,GAAAC,GACA,KAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,CAAA,EACV,MAAAC,GACA,SAAAC,EACA,YAAAC,EAAc,QACd,YAAAC,EAAc,QACd,oBAAAC,EACA,iBAAAC,EAAmB,IAAM,GACzB,YAAAC,GACA,YAAAC,GAAc,GACd,WAAAC,GAAa,GACb,WAAAC,GAAa,GACb,WAAAC,GAAa,GACb,UAAAC,GAAY,GACZ,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CACC,cAAY,OACZ,QAAQ,YACR,MAAM,KACN,OAAO,KACP,KAAK,OAEL,SAAAA,EAAAA,IAAC,OAAA,CACC,EAAE,iBACF,OAAO,eACP,YAAY,OACZ,cAAc,QACd,eAAe,OAAA,CAAA,CACjB,CAAA,CACF,CAAA,CACF,CAAA,CAAA,EAGDrJ,GACCqJ,EAAAA,IAAC,QAAA,CACC,KAAK,SACL,KAAArJ,EACA,MAAOuG,GAAmB,GAC1B,SAAUd,CAAA,CAAA,EAGd4D,EAAAA,IAACO,GAAAA,QAAA,CACC,KAAA3I,GACA,aAAcyB,IAAe,KAAO,OAAYxB,EAChD,OAAA6C,GACA,QAASD,EAAA,CAAA,EAGVpC,GAAoB8H,EACjBK,GAAAA,aAAaL,EAAM9H,CAAgB,EACnC8H,CAAA,CAAA,CAAA,EAvIY,IA0ItB,CAEA,MAAMM,GAASC,EAAAA,WAAWjK,EAAW"}
1
+ {"version":3,"file":"Select.cjs","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ForwardedRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n size as floatingSize,\n useFloating,\n} from '@floating-ui/react'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport { createPortal } from 'react-dom'\nimport { useInconelAdapters } from '../../adapters'\nimport { classNames as mergeClassNames } from '../shared/classNames'\nimport '../shared/field.css'\nimport '../shared/field-controls.css'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport './styles.css'\n\nimport FieldFeedback from '../FieldFeedback/FieldFeedback'\nimport type { FieldFeedbackContentProps } from '../FieldFeedback/FieldFeedback'\n\nexport type OptionValue = string | number\n\nexport interface SelectHandle {\n focus: () => void\n blur: () => void\n clear: () => void\n}\n\ntype SelectPart =\n | 'root'\n | 'label'\n | 'control'\n | 'input'\n | 'clearButton'\n | 'toggleButton'\n | 'menu'\n | 'option'\n | 'message'\n\nexport type SelectClassNames = Partial<Record<SelectPart, string>>\nexport type SelectStyles = Partial<Record<SelectPart, CSSProperties>>\n\nexport interface SelectProps<T extends object> extends FieldFeedbackContentProps {\n id?: string\n name?: string\n label?: ReactNode\n options?: T[]\n value?: OptionValue | T | null\n onChange?:\n | ((value: OptionValue | null, option: T | null) => void)\n | ((option: T | null) => void)\n optionLabel?: keyof T | ((option: T) => ReactNode)\n optionValue?: keyof T | ((option: T) => OptionValue)\n getOptionSearchText?: (option: T) => string\n isOptionDisabled?: (option: T) => boolean\n placeholder?: string\n isClearable?: boolean\n isDisabled?: boolean\n isReadOnly?: boolean\n isRequired?: boolean\n isLoading?: boolean\n loadOptions?: (inputValue: string, signal: AbortSignal) => Promise<T[]>\n loadOptionsDebounceMs?: number\n asyncErrorMessage?: ReactNode\n loadingMessage?: ReactNode\n noOptionsMessage?: ReactNode\n clearButtonLabel?: string\n openMenuButtonLabel?: string\n closeMenuButtonLabel?: string\n searchLocale?: string\n menuPortalTarget?: HTMLElement | null\n virtualize?: boolean\n virtualizationThreshold?: number\n optionHeight?: number\n className?: string\n classNames?: SelectClassNames\n styles?: SelectStyles\n onInputChange?: (value: string) => void\n onMenuOpen?: () => void\n onMenuClose?: () => void\n autoFocus?: boolean\n selectClassName?: string\n disabled?: boolean\n isSearchable?: boolean\n readOnly?: boolean\n defaultValue?: OptionValue | T | null\n errorPlace?: 'in' | 'out' | string\n onBlur?: () => void\n setFieldValue?: OptionValue | string | null\n render?: boolean\n singleValue?: boolean\n sortByUppercase?: boolean\n selectClassNamePrefix?: string\n menuPlacement?: 'auto' | 'bottom' | 'top'\n maxMenuHeight?: number\n inputClassName?: string\n labelClassName?: string\n size?: ControlSize\n required?: boolean\n components?: Record<string, unknown>\n}\n\nfunction SelectInner<T extends object>(\n {\n id,\n name,\n label,\n options = [],\n value,\n onChange,\n optionLabel = 'label' as keyof T,\n optionValue = 'value' as keyof T,\n getOptionSearchText,\n isOptionDisabled = () => false,\n placeholder,\n isClearable = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n isLoading = false,\n loadOptions,\n loadOptionsDebounceMs = 250,\n hint,\n errorMessage,\n asyncErrorMessage,\n loadingMessage,\n noOptionsMessage,\n clearButtonLabel,\n openMenuButtonLabel,\n closeMenuButtonLabel,\n searchLocale,\n menuPortalTarget,\n virtualize = false,\n virtualizationThreshold = 100,\n optionHeight = 44,\n className,\n classNames = {},\n styles = {},\n onInputChange,\n onMenuOpen,\n onMenuClose,\n autoFocus,\n selectClassName,\n disabled,\n isSearchable = true,\n readOnly,\n defaultValue,\n errorPlace,\n onBlur,\n setFieldValue,\n render = true,\n singleValue,\n sortByUppercase,\n inputClassName,\n labelClassName,\n size = 'md',\n required,\n }: SelectProps<T>,\n forwardedRef: ForwardedRef<SelectHandle>,\n) {\n const adapters = useInconelAdapters()\n const legacyMode =\n singleValue !== undefined ||\n selectClassName !== undefined ||\n errorPlace !== undefined\n const controlledValue = value ?? setFieldValue ?? defaultValue ?? null\n const generatedId = useId()\n const inputId = id ?? `inconel-select-${generatedId.replace(/:/g, '')}`\n const labelId = `${inputId}-label`\n const listboxId = `${inputId}-listbox`\n const messageId = `${inputId}-message`\n const hintId = `${inputId}-hint`\n const rootRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const menuRef = useRef<HTMLDivElement>(null)\n const [isOpen, setIsOpen] = useState(false)\n const [inputValue, setInputValue] = useState('')\n const [activeIndex, setActiveIndex] = useState(0)\n const [asyncOptions, setAsyncOptions] = useState<T[] | null>(null)\n const [isAsyncLoading, setIsAsyncLoading] = useState(false)\n const [hasAsyncError, setHasAsyncError] = useState(false)\n\n useEffect(() => {\n if (!loadOptions) return\n const controller = new AbortController()\n const timeout = window.setTimeout(async () => {\n setIsAsyncLoading(true)\n setHasAsyncError(false)\n try {\n const loadedOptions = await loadOptions(\n inputValue,\n controller.signal,\n )\n if (!controller.signal.aborted) setAsyncOptions(loadedOptions)\n } catch {\n if (!controller.signal.aborted) setHasAsyncError(true)\n } finally {\n if (!controller.signal.aborted) setIsAsyncLoading(false)\n }\n }, loadOptionsDebounceMs)\n\n return () => {\n window.clearTimeout(timeout)\n controller.abort()\n }\n }, [inputValue, loadOptions, loadOptionsDebounceMs])\n\n const availableOptions = loadOptions\n ? (asyncOptions ?? options)\n : options\n const loading = isLoading || isAsyncLoading\n const componentDisabled = isDisabled || Boolean(disabled)\n const componentReadOnly = isReadOnly || Boolean(readOnly)\n const componentRequired = isRequired || Boolean(required)\n const resolvedPlaceholder =\n (errorPlace === 'in' && errorMessage\n ? String(errorMessage)\n : placeholder) ??\n String(adapters.translate?.('select', 'Seçim yapın...') ?? 'Seçim yapın...')\n const resolvedNoOptionsMessage =\n noOptionsMessage ??\n adapters.translate?.('noData', 'Sonuç bulunamadı.') ??\n 'Sonuç bulunamadı.'\n const resolvedLoadingMessage =\n loadingMessage ??\n adapters.translate?.('loading', 'Yükleniyor...') ??\n 'Yükleniyor...'\n const resolvedClearLabel =\n clearButtonLabel ??\n String(adapters.translate?.('clearSelection', 'Seçimi temizle') ?? 'Seçimi temizle')\n const resolvedOpenLabel =\n openMenuButtonLabel ??\n String(adapters.translate?.('openOptions', 'Seçenekleri aç') ?? 'Seçenekleri aç')\n const resolvedCloseLabel =\n closeMenuButtonLabel ??\n String(adapters.translate?.('closeOptions', 'Seçenekleri kapat') ?? 'Seçenekleri kapat')\n\n const getLabel = useCallback(\n (option: T): ReactNode =>\n typeof optionLabel === 'function'\n ? optionLabel(option)\n : String(option[optionLabel]),\n [optionLabel],\n )\n\n const getSearchLabel = useCallback(\n (option: T) => {\n if (getOptionSearchText) return getOptionSearchText(option)\n const renderedLabel = getLabel(option)\n return typeof renderedLabel === 'string' ||\n typeof renderedLabel === 'number'\n ? String(renderedLabel)\n : ''\n },\n [getLabel, getOptionSearchText],\n )\n\n const getValue = useCallback(\n (option: T): OptionValue => {\n const resolvedValue =\n typeof optionValue === 'function'\n ? optionValue(option)\n : option[optionValue]\n\n if (\n typeof resolvedValue !== 'string' &&\n typeof resolvedValue !== 'number'\n ) {\n throw new TypeError('optionValue must resolve to a string or number.')\n }\n return resolvedValue\n },\n [optionValue],\n )\n\n const normalizedValue =\n controlledValue && typeof controlledValue === 'object'\n ? getValue(controlledValue as T)\n : (controlledValue as OptionValue | null)\n\n const emitChange = useCallback(\n (nextValue: OptionValue | null, option: T | null) => {\n if (!onChange) return\n if (legacyMode) {\n ;(onChange as (selected: T | null) => void)(option)\n } else {\n ;(\n onChange as (\n value: OptionValue | null,\n selected: T | null,\n ) => void\n )(nextValue, option)\n }\n },\n [legacyMode, onChange],\n )\n\n const duplicateValues = useMemo(() => {\n const seen = new Set<OptionValue>()\n return availableOptions\n .map(getValue)\n .filter((optionId) => {\n if (seen.has(optionId)) return true\n seen.add(optionId)\n return false\n })\n }, [availableOptions, getValue])\n\n useEffect(() => {\n if (duplicateValues.length) {\n console.warn(\n `Duplicate optionValue found in Select \"${label}\":`,\n duplicateValues,\n )\n }\n }, [duplicateValues, label])\n\n const selectedOption = [...options, ...availableOptions].find(\n (option) => getValue(option) === normalizedValue,\n )\n const selectedLabel = selectedOption ? getSearchLabel(selectedOption) : ''\n\n const filteredOptions = useMemo(() => {\n const query = inputValue.trim().toLocaleLowerCase(searchLocale)\n if (!query || loadOptions) return availableOptions\n return availableOptions.filter((option) =>\n getSearchLabel(option).toLocaleLowerCase(searchLocale).includes(query),\n )\n }, [availableOptions, getSearchLabel, inputValue, loadOptions, searchLocale])\n\n const { refs, floatingStyles } = useFloating({\n open: isOpen,\n placement: 'bottom-start',\n strategy: menuPortalTarget ? 'fixed' : 'absolute',\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(8),\n flip({ padding: 12 }),\n shift({ padding: 12 }),\n floatingSize({\n padding: 12,\n apply({ availableHeight, rects, elements }) {\n Object.assign(elements.floating.style, {\n maxHeight: `${Math.min(230, availableHeight)}px`,\n width: `${rects.reference.width}px`,\n })\n },\n }),\n ],\n })\n\n const shouldVirtualize =\n virtualize || filteredOptions.length >= virtualizationThreshold\n const virtualizer = useVirtualizer({\n count: filteredOptions.length,\n getScrollElement: () => menuRef.current,\n estimateSize: () => optionHeight,\n overscan: 5,\n enabled: shouldVirtualize && isOpen,\n })\n\n const closeMenu = useCallback(() => {\n setIsOpen(false)\n setInputValue('')\n onInputChange?.('')\n onMenuClose?.()\n }, [onInputChange, onMenuClose])\n\n const openMenu = () => {\n if (componentDisabled || componentReadOnly) return\n if (!isOpen) onMenuOpen?.()\n setIsOpen(true)\n }\n\n const clearSelection = useCallback(() => {\n if (componentDisabled || componentReadOnly) return\n emitChange(null, null)\n setInputValue('')\n setActiveIndex(0)\n onInputChange?.('')\n inputRef.current?.focus()\n }, [componentDisabled, componentReadOnly, emitChange, onInputChange])\n\n useImperativeHandle(\n forwardedRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n clear: clearSelection,\n }),\n [clearSelection],\n )\n\n useEffect(() => {\n const closeOnOutsideClick = (event: MouseEvent) => {\n const target = event.target as Node\n if (\n !rootRef.current?.contains(target) &&\n !menuRef.current?.contains(target)\n ) {\n closeMenu()\n }\n }\n\n document.addEventListener('mousedown', closeOnOutsideClick)\n return () => document.removeEventListener('mousedown', closeOnOutsideClick)\n }, [closeMenu])\n\n useEffect(() => {\n if (activeIndex >= filteredOptions.length) setActiveIndex(0)\n }, [activeIndex, filteredOptions.length])\n\n useEffect(() => {\n if (shouldVirtualize && isOpen && filteredOptions[activeIndex]) {\n virtualizer.scrollToIndex(activeIndex, { align: 'auto' })\n }\n }, [\n activeIndex,\n filteredOptions,\n isOpen,\n shouldVirtualize,\n virtualizer,\n ])\n\n const selectOption = (option: T) => {\n if (isOptionDisabled(option)) return\n emitChange(getValue(option), option)\n closeMenu()\n inputRef.current?.focus()\n }\n\n const moveActiveOption = (direction: 1 | -1) => {\n if (!filteredOptions.length) return\n let nextIndex = activeIndex\n do {\n nextIndex =\n (nextIndex + direction + filteredOptions.length) %\n filteredOptions.length\n } while (\n isOptionDisabled(filteredOptions[nextIndex]) &&\n nextIndex !== activeIndex\n )\n setActiveIndex(nextIndex)\n }\n\n const findEnabledIndex = (fromEnd = false) => {\n const entries = filteredOptions.map((option, index) => ({ option, index }))\n if (fromEnd) entries.reverse()\n return entries.find(({ option }) => !isOptionDisabled(option))?.index ?? 0\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (\n event.key === 'Backspace' &&\n !inputValue &&\n normalizedValue !== null &&\n isClearable\n ) {\n event.preventDefault()\n clearSelection()\n return\n }\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n if (!isOpen) {\n openMenu()\n setActiveIndex(findEnabledIndex(event.key === 'ArrowUp'))\n } else {\n moveActiveOption(event.key === 'ArrowDown' ? 1 : -1)\n }\n } else if (event.key === 'Home' && isOpen) {\n event.preventDefault()\n setActiveIndex(findEnabledIndex())\n } else if (event.key === 'End' && isOpen) {\n event.preventDefault()\n setActiveIndex(findEnabledIndex(true))\n } else if (event.key === 'Enter' && isOpen) {\n event.preventDefault()\n const activeOption = filteredOptions[activeIndex]\n if (activeOption) selectOption(activeOption)\n } else if (event.key === 'Escape' && isOpen) {\n event.preventDefault()\n closeMenu()\n } else if (event.key === 'Tab') {\n closeMenu()\n }\n }\n\n const renderOption = (option: T, index: number, style?: CSSProperties) => {\n const optionId = getValue(option)\n const disabled = isOptionDisabled(option)\n return (\n <div\n id={`${inputId}-option-${index}`}\n key={optionId}\n role=\"option\"\n aria-selected={optionId === normalizedValue}\n aria-disabled={disabled}\n aria-posinset={index + 1}\n aria-setsize={filteredOptions.length}\n className={mergeClassNames(\n 'inconel-select-option',\n index === activeIndex && 'inconel-is-active',\n optionId === normalizedValue && 'inconel-is-selected',\n disabled && 'inconel-is-disabled',\n classNames.option,\n )}\n style={{ ...style, ...styles.option }}\n onMouseEnter={() => setActiveIndex(index)}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => selectOption(option)}\n >\n <span>{getLabel(option)}</span>\n {optionId === normalizedValue && <span aria-hidden=\"true\">✓</span>}\n </div>\n )\n }\n\n const menuContent = loading ? (\n <div\n role=\"status\"\n className={mergeClassNames('inconel-select-message', classNames.message)}\n style={styles.message}\n >\n <span className=\"inconel-select-spinner\" aria-hidden=\"true\" />\n {resolvedLoadingMessage}\n </div>\n ) : hasAsyncError ? (\n <div\n role=\"alert\"\n className={mergeClassNames('inconel-select-message inconel-select-message-error', classNames.message)}\n style={styles.message}\n >\n {asyncErrorMessage}\n </div>\n ) : filteredOptions.length === 0 ? (\n <div\n className={mergeClassNames('inconel-select-message', classNames.message)}\n style={styles.message}\n >\n {resolvedNoOptionsMessage}\n </div>\n ) : shouldVirtualize ? (\n <div\n role=\"presentation\"\n className=\"inconel-select-virtual-content\"\n style={{ height: virtualizer.getTotalSize() }}\n >\n {virtualizer.getVirtualItems().map((virtualRow) =>\n renderOption(filteredOptions[virtualRow.index], virtualRow.index, {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n }),\n )}\n </div>\n ) : (\n filteredOptions.map((option, index) => renderOption(option, index))\n )\n\n const menu = isOpen ? (\n <div\n ref={(node) => {\n menuRef.current = node\n refs.setFloating(node)\n }}\n id={listboxId}\n role=\"listbox\"\n aria-labelledby={label ? labelId : undefined}\n className={mergeClassNames(\n 'inconel-select-menu',\n menuPortalTarget && 'inconel-select-menu-portal',\n classNames.menu,\n )}\n style={{ ...floatingStyles, ...styles.menu }}\n >\n {menuContent}\n </div>\n ) : null\n\n const describedBy = errorMessage ? messageId : hint ? hintId : undefined\n\n if (!render) return null\n\n return (\n <div\n ref={rootRef}\n className={mergeClassNames(\n 'inconel-select-field',\n `inconel-size-${size}`,\n `inconel-select-field--${size}`,\n className,\n classNames.root,\n )}\n style={styles.root}\n >\n {label && (\n <label\n id={labelId}\n htmlFor={inputId}\n className={mergeClassNames(classNames.label, labelClassName)}\n style={styles.label}\n >\n {label}\n {componentRequired && <span aria-hidden=\"true\"> *</span>}\n </label>\n )}\n <div\n ref={refs.setReference}\n className={mergeClassNames(\n 'inconel-select-control',\n isOpen && 'inconel-is-open',\n componentDisabled && 'inconel-is-disabled',\n Boolean(errorMessage) && 'inconel-has-error',\n classNames.control,\n )}\n style={styles.control}\n >\n <input\n ref={inputRef}\n id={inputId}\n role=\"combobox\"\n aria-expanded={isOpen}\n aria-controls={listboxId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n isOpen && filteredOptions[activeIndex]\n ? `${inputId}-option-${activeIndex}`\n : undefined\n }\n aria-describedby={describedBy}\n aria-invalid={Boolean(errorMessage)}\n aria-required={isRequired}\n aria-busy={loading}\n required={componentRequired}\n disabled={componentDisabled}\n readOnly={componentReadOnly || !isSearchable}\n autoFocus={autoFocus}\n autoComplete=\"off\"\n placeholder={resolvedPlaceholder}\n value={inputValue || selectedLabel}\n className={mergeClassNames(classNames.input, inputClassName, selectClassName)}\n style={styles.input}\n onChange={(event) => {\n const nextInput = sortByUppercase\n ? event.target.value.toLocaleUpperCase(\n adapters.locale ?? 'tr-TR',\n )\n : event.target.value\n setInputValue(nextInput)\n setActiveIndex(0)\n onInputChange?.(nextInput)\n openMenu()\n }}\n onClick={openMenu}\n onFocus={(event) => {\n openMenu()\n if (selectedOption && !inputValue) event.currentTarget.select()\n }}\n onBlur={onBlur}\n onKeyDown={handleKeyDown}\n />\n {loading && <span className=\"inconel-select-spinner\" aria-hidden=\"true\" />}\n {isClearable && normalizedValue !== null && !componentDisabled && !componentReadOnly && (\n <button\n type=\"button\"\n className={mergeClassNames('inconel-select-clear', classNames.clearButton)}\n style={styles.clearButton}\n aria-label={resolvedClearLabel}\n onClick={clearSelection}\n >\n ×\n </button>\n )}\n <button\n type=\"button\"\n className={mergeClassNames('inconel-select-toggle', classNames.toggleButton)}\n style={styles.toggleButton}\n aria-label={isOpen ? resolvedCloseLabel : resolvedOpenLabel}\n aria-expanded={isOpen}\n disabled={componentDisabled}\n tabIndex={-1}\n onClick={() => (isOpen ? closeMenu() : openMenu())}\n >\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n height=\"20\"\n fill=\"none\"\n >\n <path\n d=\"m5 7.5 5 5 5-5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={normalizedValue ?? ''}\n required={componentRequired}\n />\n )}\n <FieldFeedback\n hint={hint}\n errorMessage={errorPlace === 'in' ? undefined : errorMessage}\n hintId={hintId}\n errorId={messageId}\n />\n\n {menuPortalTarget && menu\n ? createPortal(menu, menuPortalTarget)\n : menu}\n </div>\n )\n}\n\nconst Select = forwardRef(SelectInner) as <T extends object>(\n props: SelectProps<T> & { ref?: ForwardedRef<SelectHandle> },\n) => ReactNode\n\nexport default Select\n"],"names":["SelectInner","id","name","label","options","value","onChange","optionLabel","optionValue","getOptionSearchText","isOptionDisabled","placeholder","isClearable","isDisabled","isReadOnly","isRequired","isLoading","loadOptions","loadOptionsDebounceMs","hint","errorMessage","asyncErrorMessage","loadingMessage","noOptionsMessage","clearButtonLabel","openMenuButtonLabel","closeMenuButtonLabel","searchLocale","menuPortalTarget","virtualize","virtualizationThreshold","optionHeight","className","classNames","styles","onInputChange","onMenuOpen","onMenuClose","autoFocus","selectClassName","disabled","isSearchable","readOnly","defaultValue","errorPlace","onBlur","setFieldValue","render","singleValue","sortByUppercase","inputClassName","labelClassName","size","required","forwardedRef","adapters","useInconelAdapters","legacyMode","controlledValue","generatedId","useId","inputId","labelId","listboxId","messageId","hintId","rootRef","useRef","inputRef","menuRef","isOpen","setIsOpen","useState","inputValue","setInputValue","activeIndex","setActiveIndex","asyncOptions","setAsyncOptions","isAsyncLoading","setIsAsyncLoading","hasAsyncError","setHasAsyncError","useEffect","controller","timeout","loadedOptions","availableOptions","loading","componentDisabled","componentReadOnly","componentRequired","resolvedPlaceholder","resolvedNoOptionsMessage","resolvedLoadingMessage","resolvedClearLabel","resolvedOpenLabel","resolvedCloseLabel","getLabel","useCallback","option","getSearchLabel","renderedLabel","getValue","resolvedValue","normalizedValue","emitChange","nextValue","duplicateValues","useMemo","seen","optionId","selectedOption","selectedLabel","filteredOptions","query","refs","floatingStyles","useFloating","autoUpdate","offset","flip","shift","floatingSize","availableHeight","rects","elements","shouldVirtualize","virtualizer","useVirtualizer","closeMenu","openMenu","clearSelection","useImperativeHandle","closeOnOutsideClick","event","target","selectOption","moveActiveOption","direction","nextIndex","findEnabledIndex","fromEnd","entries","index","handleKeyDown","activeOption","renderOption","style","jsxs","mergeClassNames","jsx","menuContent","virtualRow","menu","node","describedBy","nextInput","FieldFeedback","createPortal","Select","forwardRef"],"mappings":"shBAqHA,SAASA,GACP,CACE,GAAAC,GACA,KAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,CAAA,EACV,MAAAC,GACA,SAAAC,EACA,YAAAC,EAAc,QACd,YAAAC,EAAc,QACd,oBAAAC,EACA,iBAAAC,EAAmB,IAAM,GACzB,YAAAC,GACA,YAAAC,GAAc,GACd,WAAAC,GAAa,GACb,WAAAC,GAAa,GACb,WAAAC,GAAa,GACb,UAAAC,GAAY,GACZ,YAAAC,EACA,sBAAAC,GAAwB,IACxB,KAAAC,GACA,aAAAC,EACA,kBAAAC,GACA,eAAAC,GACA,iBAAAC,GACA,iBAAAC,GACA,oBAAAC,GACA,qBAAAC,GACA,aAAAC,EACA,iBAAAC,EACA,WAAAC,GAAa,GACb,wBAAAC,GAA0B,IAC1B,aAAAC,GAAe,GACf,UAAAC,GAAA,WACAC,EAAa,CAAA,EACb,OAAAC,EAAS,CAAA,EACT,cAAAC,EACA,WAAAC,GACA,YAAAC,GACA,UAAAC,GACA,gBAAAC,GACA,SAAAC,GACA,aAAAC,GAAe,GACf,SAAAC,GACA,aAA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cyB,IAAe,KAAO,OAAYxB,EAChD,OAAA6C,GACA,QAASD,EAAA,CAAA,EAGVpC,GAAoB8H,EACjBK,GAAAA,aAAaL,EAAM9H,CAAgB,EACnC8H,CAAA,CAAA,CAAA,EAzIY,IA4ItB,CAEA,MAAMM,GAASC,EAAAA,WAAWjK,EAAW"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const e=require("./components/FieldFeedback/FieldFeedback.cjs"),t=require("./components/Input/Input.cjs"),r=require("./components/Select/Select.cjs"),o=require("./components/Svg/Svg.cjs"),i=require("./components/Textarea/Textarea.cjs"),c=require("./components/Badge/Badge.cjs"),n=require("./components/Button/Button.cjs"),u=require("./components/Checkbox/Checkbox.cjs"),l=require("./components/CheckboxGroup/CheckboxGroup.cjs"),a=require("./components/CurrencyInput/CurrencyInput.cjs"),d=require("./components/CustomizableSwitch/CustomizableSwitch.cjs"),s=require("./components/DataGrid/DataGrid.cjs"),p=require("./components/DatePicker/DatePicker.cjs"),q=require("./components/DndFileUpload/DndFileUpload.cjs"),T=require("./components/DotLoader/DotLoader.cjs"),b=require("./components/DragDropUpload/DragDropUpload.cjs"),x=require("./components/ExcelTable/ExcelTable.cjs"),S=require("./components/FileUpload/FileUpload.cjs"),h=require("./components/FileUploadText/FileUploadText.cjs"),I=require("./components/Filter/Filter.cjs"),D=require("./components/HTMLTable/HTMLTable.cjs"),k=require("./components/HtmlEditor/HtmlEditor.cjs"),F=require("./adapters/InconelProvider.cjs"),M=require("./components/InputText/InputText.cjs"),C=require("./components/Loader/Loader.cjs"),L=require("./components/LoaderMini/LoaderMini.cjs"),U=require("./components/Modal/Modal.cjs"),g=require("./components/MultiSelect/MultiSelect.cjs"),O=require("./components/MultiSelectWithCheckbox/MultiSelectWithCheckbox.cjs"),E=require("./components/Option/Option.cjs"),G=require("./components/OptionWithIcon/OptionWithIcon.cjs"),y=require("./components/RadioGroup/RadioGroup.cjs"),m=require("./components/ReadOnly/ReadOnly.cjs"),P=require("./components/SlideTabs/SlideTabs.cjs"),f=require("./components/SocketStatus/SocketStatus.cjs"),v=require("./components/Switch/Switch.cjs"),w=require("./components/Table/Table.cjs"),B=require("./components/Tabs/Tabs.cjs"),H=require("./components/TextEditor/TextEditor.cjs"),R=require("./components/TextInput/TextInput.cjs"),W=require("./components/Tooltip/Tooltip.cjs"),z=require("./adapters/context.cjs");exports.FieldFeedback=e.default;exports.Input=t.default;exports.Select=r.default;exports.Svg=o.default;exports.Textarea=i.default;exports.Badge=c.Badge;exports.Button=n.Button;exports.Checkbox=u.Checkbox;exports.CheckboxGroup=l.CheckboxGroup;exports.CurrencyInput=a.CurrencyInput;exports.CustomizableSwitch=d.CustomizableSwitch;exports.DataGrid=s.DataGrid;exports.DatePicker=p.DatePicker;exports.DndFileUpload=q.DndFileUpload;exports.DotLoader=T.DotLoader;exports.DragDropUpload=b.DragDropUpload;exports.ExcelTable=x.ExcelTable;exports.FileUpload=S.FileUpload;exports.FileUploadText=h.FileUploadText;exports.Filter=I.Filter;exports.HTMLTable=D.HTMLTable;exports.HtmlEditor=k.HtmlEditor;exports.InconelProvider=F.InconelProvider;exports.InputText=M.InputText;exports.Loader=C.Loader;exports.LoaderMini=L.LoaderMini;exports.Modal=U.Modal;exports.MultiSelect=g.MultiSelect;exports.MultiSelectWithCheckbox=O.MultiSelectWithCheckbox;exports.Option=E.Option;exports.OptionWithIcon=G.OptionWithIcon;exports.RadioGroup=y.RadioGroup;exports.ReadOnly=m.ReadOnly;exports.SlideTabs=P.SlideTabs;exports.SocketStatus=f.SocketStatus;exports.Switch=v.Switch;exports.Table=w.Table;exports.Tabs=B.Tabs;exports.TextEditor=H.TextEditor;exports.TextInput=R.TextInput;exports.Tooltip=W.Tooltip;exports.useInconelAdapters=z.useInconelAdapters;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const e=require("./components/FieldFeedback/FieldFeedback.cjs"),t=require("./components/Input/Input.cjs"),r=require("./components/Select/Select.cjs"),o=require("./components/Svg/Svg.cjs"),i=require("./components/Textarea/Textarea.cjs"),n=require("./components/Badge/Badge.cjs"),c=require("./components/Button/Button.cjs"),u=require("./components/Checkbox/Checkbox.cjs"),l=require("./components/CheckboxGroup/CheckboxGroup.cjs"),a=require("./components/CurrencyInput/CurrencyInput.cjs"),d=require("./components/CustomizableSwitch/CustomizableSwitch.cjs"),s=require("./components/DataGrid/DataGrid.cjs"),p=require("./components/DatePicker/DatePicker.cjs"),q=require("./components/DndFileUpload/DndFileUpload.cjs"),T=require("./components/DotLoader/DotLoader.cjs"),b=require("./components/DragDropUpload/DragDropUpload.cjs"),x=require("./components/DropDownBox/DropDownBox.cjs"),S=require("./components/ExcelTable/ExcelTable.cjs"),D=require("./components/FileUpload/FileUpload.cjs"),h=require("./components/FileUploadText/FileUploadText.cjs"),I=require("./components/Filter/Filter.cjs"),k=require("./components/HTMLTable/HTMLTable.cjs"),F=require("./components/HtmlEditor/HtmlEditor.cjs"),M=require("./adapters/InconelProvider.cjs"),C=require("./components/InputText/InputText.cjs"),L=require("./components/Loader/Loader.cjs"),U=require("./components/LoaderMini/LoaderMini.cjs"),g=require("./components/Modal/Modal.cjs"),O=require("./components/MultiSelect/MultiSelect.cjs"),w=require("./components/MultiSelectWithCheckbox/MultiSelectWithCheckbox.cjs"),B=require("./components/Option/Option.cjs"),E=require("./components/OptionWithIcon/OptionWithIcon.cjs"),G=require("./components/RadioGroup/RadioGroup.cjs"),y=require("./components/ReadOnly/ReadOnly.cjs"),m=require("./components/SlideTabs/SlideTabs.cjs"),P=require("./components/SocketStatus/SocketStatus.cjs"),f=require("./components/Switch/Switch.cjs"),v=require("./components/Table/Table.cjs"),H=require("./components/Tabs/Tabs.cjs"),R=require("./components/TextEditor/TextEditor.cjs"),W=require("./components/TextInput/TextInput.cjs"),z=require("./components/Tooltip/Tooltip.cjs"),A=require("./adapters/context.cjs");exports.FieldFeedback=e.default;exports.Input=t.default;exports.Select=r.default;exports.Svg=o.default;exports.Textarea=i.default;exports.Badge=n.Badge;exports.Button=c.Button;exports.Checkbox=u.Checkbox;exports.CheckboxGroup=l.CheckboxGroup;exports.CurrencyInput=a.CurrencyInput;exports.CustomizableSwitch=d.CustomizableSwitch;exports.DataGrid=s.DataGrid;exports.DatePicker=p.DatePicker;exports.DndFileUpload=q.DndFileUpload;exports.DotLoader=T.DotLoader;exports.DragDropUpload=b.DragDropUpload;exports.DropDownBox=x.DropDownBox;exports.ExcelTable=S.ExcelTable;exports.FileUpload=D.FileUpload;exports.FileUploadText=h.FileUploadText;exports.Filter=I.Filter;exports.HTMLTable=k.HTMLTable;exports.HtmlEditor=F.HtmlEditor;exports.InconelProvider=M.InconelProvider;exports.InputText=C.InputText;exports.Loader=L.Loader;exports.LoaderMini=U.LoaderMini;exports.Modal=g.Modal;exports.MultiSelect=O.MultiSelect;exports.MultiSelectWithCheckbox=w.MultiSelectWithCheckbox;exports.Option=B.Option;exports.OptionWithIcon=E.OptionWithIcon;exports.RadioGroup=G.RadioGroup;exports.ReadOnly=y.ReadOnly;exports.SlideTabs=m.SlideTabs;exports.SocketStatus=P.SocketStatus;exports.Switch=f.Switch;exports.Table=v.Table;exports.Tabs=H.Tabs;exports.TextEditor=R.TextEditor;exports.TextInput=W.TextInput;exports.Tooltip=z.Tooltip;exports.useInconelAdapters=A.useInconelAdapters;
2
2
  //# sourceMappingURL=index.cjs.map