@handijitcom/ui 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/Combobox/index.cjs +1 -1
- package/build/components/Combobox/index.cjs.map +1 -1
- package/build/components/Combobox/index.js +147 -146
- package/build/components/Combobox/index.js.map +1 -1
- package/build/components/Combobox/style.css +1 -1
- package/build/components/FilterToolbar/index.cjs +1 -1
- package/build/components/FilterToolbar/index.cjs.map +1 -1
- package/build/components/FilterToolbar/index.js +34 -36
- package/build/components/FilterToolbar/index.js.map +1 -1
- package/build/components/FilterToolbar/style.css +1 -1
- package/build/components/Popover/style.css +1 -1
- package/build/components/Select/style.css +1 -1
- package/build/styles.css +4 -4
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),r=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),r=require("react"),Ce=require("react-dom"),D=require("react-bootstrap-icons"),we=require("../../constants/breakpoint.constants.cjs"),w=require("../../helpers/class-name.helper.cjs"),Ee=require("../../helpers/component.helper.cjs"),Ie=require("../../helpers/ref.helper.cjs"),R=require("../../helpers/label.helper.cjs"),ne=require("../../helpers/text.helper.cjs"),Me=require("../../hooks/useAsyncSearch.cjs"),Se=require("../../hooks/useListboxNavigation.cjs"),De=require("../../hooks/usePortalSurface.cjs"),Re=require("../../hooks/usePositioning.cjs"),Pe=require("../../hooks/useVirtualList.cjs"),Te=require("../../theme/context.cjs"),ke=require("../BottomSheet/index.cjs"),$e=require("../Spinner/index.cjs"),P=require("../../constants/combobox.constants.cjs"),o={default:{"combobox":"ui-combobox-NtZoV","combobox__trigger":"ui-combobox__trigger-2riRR","combobox__trigger--empty":"ui-combobox__trigger--empty-RxwCq","combobox__trigger--open":"ui-combobox__trigger--open-rw1ZS","combobox__trigger--invalid":"ui-combobox__trigger--invalid-iZgiN","combobox__trigger--readOnly":"ui-combobox__trigger--readOnly-o2wH-","combobox__trigger--sm":"ui-combobox__trigger--sm-2xG91","combobox__trigger--clearable":"ui-combobox__trigger--clearable-shq9I","combobox__chevron":"ui-combobox__chevron-g-QzQ","combobox__leadingIcon":"ui-combobox__leadingIcon-it2xz","combobox__value":"ui-combobox__value-acDlr","combobox__clear":"ui-combobox__clear-EXOsc","combobox__chevron--open":"ui-combobox__chevron--open-9kj1j","combobox__panel":"ui-combobox__panel-srBxl","combobox__search":"ui-combobox__search-THjer","combobox__searchIcon":"ui-combobox__searchIcon-vr4Bg","combobox__searchInput":"ui-combobox__searchInput-JPp5h","combobox__list":"ui-combobox__list-p-eCs","combobox__list--sheet":"ui-combobox__list--sheet-r3MzB","combobox__option":"ui-combobox__option-CLWh-","combobox__option--active":"ui-combobox__option--active--75Vq","combobox__option--selected":"ui-combobox__option--selected-DVFGy","combobox__option--disabled":"ui-combobox__option--disabled-e6VjI","combobox__optionText":"ui-combobox__optionText-Zm0D6","combobox__optionLabel":"ui-combobox__optionLabel-WvT4W","combobox__optionDescription":"ui-combobox__optionDescription-8OEzi","combobox__check":"ui-combobox__check-MKlLz","combobox__empty":"ui-combobox__empty-mZwBq","combobox__srName":"ui-combobox__srName-9PNXF"}},Ae=({options:g,value:v,onChange:B,onBlur:K,labels:d,isSearchHidden:U,onSearch:T,isLoading:V,isDisabled:y,isReadOnly:m,isClearable:z,icon:G,size:le="md",id:ce,required:ie,className:ue,testId:de,"aria-describedby":be,"aria-invalid":Q},F)=>{const{labels:a}=Te.useUi(),j={get search(){var e;return R.resolveLabel("Combobox.searchPlaceholder",d.searchPlaceholder,(e=a==null?void 0:a.combobox)==null?void 0:e.searchPlaceholder)},get empty(){var e;return R.resolveLabel("Combobox.emptyMessage",d.emptyMessage,(e=a==null?void 0:a.combobox)==null?void 0:e.emptyMessage)},get loading(){var e;return R.resolveLabel("Combobox.loadingMessage",d.loadingMessage,(e=a==null?void 0:a.combobox)==null?void 0:e.loadingMessage)},get clear(){var e;return R.resolveLabel("Combobox.clearLabel",d.clearLabel,(e=a==null?void 0:a.combobox)==null?void 0:e.clearLabel)}},me=r.useId(),u=ce??me,k=`${u}-listbox`,$=r.useRef(null),E=r.useRef(null),N=r.useRef(null),A=r.useRef(null),fe=r.useCallback(e=>{E.current=e,Ie.assignRef(F,e)},[F]),[l,W]=r.useState(null),c=l!==null,[q,H]=r.useState(""),[xe,I]=r.useState(null),i=r.useMemo(()=>{if(T||q.trim()==="")return g;const e=q.trim();return g.filter(s=>ne.matchesSearch(s.label,e)||(s.description?ne.matchesSearch(s.description,e):!1))},[g,q,T]),p=g.find(e=>e.value===v)??null;r.useEffect(()=>{p?I(p.label):v===null&&I(null)},[p,v]);const L=(p==null?void 0:p.label)??xe;Me.default(q,c,T,P.SEARCH_DEBOUNCE_MS);const _=r.useCallback(()=>{W(null),H("")},[]),X=r.useCallback(()=>{y||m||(W(window.matchMedia(we.SHEET_MEDIA_QUERY).matches?"sheet":"popover"),H(""))},[y,m]);r.useEffect(()=>{if(l!=="popover")return;const e=s=>{var h,b;const n=s.target;(h=$.current)!=null&&h.contains(n)||(b=N.current)!=null&&b.contains(n)||_()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l,_]);const Y=e=>{e.isDisabled||(I(e.label),B(e.value),_())},J=r.useRef(!1);r.useEffect(()=>{var e;J.current&&!c&&((e=E.current)==null||e.focus()),J.current=c},[c]);const M=Re.default(E,N,{side:"bottom",align:"start",isOpen:c&&l==="popover"}),S=De.default(l==="popover",E,N),Z=l==="popover"&&M.isPositioned;r.useEffect(()=>{var e;Z&&((e=A.current)==null||e.focus({preventScroll:!0}))},[Z]);const{activeIndex:C,setActiveIndex:ee,listRef:he,handleKeyDown:oe}=Se.default({count:i.length,isOpen:c,initialIndex:Math.max(g.findIndex(e=>e.value===v),0),onSelect:e=>{const s=i[e];s&&Y(s)},onClose:_}),pe=i.some(e=>!!e.description),f=l==="popover"&&!pe&&i.length>P.VIRTUAL_THRESHOLD,{scrollRef:_e,range:x,scrollToIndex:te}=Pe.default(i.length,{rowHeight:P.OPTION_HEIGHT,isEnabled:f});r.useEffect(()=>{f&&te(C)},[C,f,te]);const ge=e=>{he.current=e,_e.current=e},ve=oe,ye=e=>{var s;if(!c){["ArrowDown","ArrowUp","Enter"," "].includes(e.key)&&(e.preventDefault(),X());return}!U&&l==="popover"&&((s=A.current)==null||s.focus({preventScroll:!0})),oe(e)},re=r.useRef(l);re.current=l;const je=e=>{var n,h;if(!K||re.current==="sheet")return;const s=e.relatedTarget;s instanceof Node&&((n=$.current)!=null&&n.contains(s)||(h=N.current)!=null&&h.contains(s))||K(e)},Ne=()=>{B(null),I(null)},se=U?null:t.jsxs("div",{className:o.default.combobox__search,children:[t.jsx(D.Search,{"aria-hidden":!0,className:o.default.combobox__searchIcon}),t.jsx("input",{ref:A,type:"text",className:o.default.combobox__searchInput,value:q,placeholder:j.search,autoComplete:"off","aria-autocomplete":"list","aria-controls":k,"aria-activedescendant":i[C]?`${u}-option-${C}`:void 0,"aria-label":j.search,onChange:e=>{H(e.target.value),ee(0)},onKeyDown:ve}),V&&t.jsx($e.default,{size:"sm",label:""})]}),ae=e=>{const s=i.slice(x.start,x.end);return t.jsxs("ul",{ref:ge,id:k,role:"listbox",className:w.cx(o.default.combobox__list,e&&o.default["combobox__list--sheet"]),children:[f&&x.offset>0&&t.jsx("li",{"aria-hidden":!0,style:{height:x.offset}}),s.map((n,h)=>{const b=x.start+h,qe=b===C,O=n.value===v;return t.jsxs("li",{id:`${u}-option-${b}`,role:"option","data-index":b,"aria-setsize":f?i.length:void 0,"aria-posinset":f?b+1:void 0,"aria-selected":O,"aria-disabled":n.isDisabled,className:w.cx(o.default.combobox__option,qe&&o.default["combobox__option--active"],O&&o.default["combobox__option--selected"],n.isDisabled&&o.default["combobox__option--disabled"]),onMouseEnter:()=>ee(b),onMouseDown:Le=>Le.preventDefault(),onClick:()=>Y(n),children:[t.jsxs("span",{className:o.default.combobox__optionText,children:[t.jsx("span",{className:o.default.combobox__optionLabel,children:n.label}),n.description&&t.jsx("span",{className:o.default.combobox__optionDescription,children:n.description})]}),O&&t.jsx(D.CheckLg,{"aria-hidden":!0,className:o.default.combobox__check})]},n.value)}),f&&x.end<i.length&&t.jsx("li",{"aria-hidden":!0,style:{height:(i.length-x.end)*P.OPTION_HEIGHT}}),i.length===0&&t.jsx("li",{className:o.default.combobox__empty,children:V?j.loading:j.empty})]})};return t.jsxs("div",{ref:$,className:w.cx(o.default.combobox,ue),"data-testid":de,onBlur:je,children:[t.jsxs("button",{ref:fe,id:u,type:"button",className:w.cx(o.default.combobox__trigger,le==="sm"&&o.default["combobox__trigger--sm"],!L&&o.default["combobox__trigger--empty"],c&&o.default["combobox__trigger--open"],Q&&o.default["combobox__trigger--invalid"],m&&o.default["combobox__trigger--readOnly"],z&&L&&!y&&!m&&o.default["combobox__trigger--clearable"]),disabled:y,role:"combobox","aria-haspopup":"listbox","aria-expanded":c,"aria-controls":k,"aria-labelledby":L?`${u}-name ${u}-value`:`${u}-name`,"aria-describedby":be,"aria-invalid":Q||void 0,"aria-required":ie||void 0,"aria-readonly":m||void 0,onClick:()=>c?_():X(),onKeyDown:ye,children:[G&&t.jsx("span",{className:o.default.combobox__leadingIcon,"aria-hidden":!0,children:G}),t.jsx("span",{id:`${u}-name`,className:o.default.combobox__srName,children:d.placeholder}),t.jsx("span",{id:`${u}-value`,className:o.default.combobox__value,children:L??d.placeholder}),!m&&t.jsx(D.CaretDownFill,{"aria-hidden":!0,className:w.cx(o.default.combobox__chevron,c&&o.default["combobox__chevron--open"])})]}),z&&L&&!y&&!m&&t.jsx("button",{type:"button",className:o.default.combobox__clear,"aria-label":j.clear,onClick:Ne,children:t.jsx(D.XLg,{"aria-hidden":!0})}),l==="popover"&&S.container&&Ce.createPortal(t.jsxs("div",{ref:N,className:o.default.combobox__panel,...S.attributes,style:{...M.style,...S.style,width:M.anchorWidth||void 0,visibility:M.isPositioned?void 0:"hidden"},children:[se,ae(!1)]}),S.container),l==="sheet"&&t.jsx(ke.default,{title:d.placeholder,closeLabel:d.closeLabel??(a==null?void 0:a.close),onClose:_,toolbar:se??void 0,children:ae(!0)})]})},He=r.forwardRef(Ae),Oe=r.memo(Ee.named(He,"Combobox"));exports.default=Oe;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Combobox/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FocusEvent,\n type ForwardedRef,\n forwardRef,\n type KeyboardEvent,\n memo,\n type ReactElement,\n type Ref,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { CaretDownFill, CheckLg, Search, XLg } from 'react-bootstrap-icons';\n\nimport { SHEET_MEDIA_QUERY } from '../../constants/breakpoint.constants';\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { assignRef } from '../../helpers/ref.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { matchesSearch } from '../../helpers/text.helper';\nimport useAsyncSearch from '../../hooks/useAsyncSearch';\nimport useListboxNavigation from '../../hooks/useListboxNavigation';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\nimport useVirtualList from '../../hooks/useVirtualList';\nimport { useUi } from '../../theme/context';\nimport BottomSheet from '../BottomSheet';\nimport Spinner from '../Spinner';\n\nimport {\n OPTION_HEIGHT,\n SEARCH_DEBOUNCE_MS,\n VIRTUAL_THRESHOLD,\n} from '../../constants/combobox.constants';\nimport { ComboboxOption, ComboboxProps } from '../../types/combobox.type';\n\nimport styles from './index.module.scss';\n\n/*\n * Tipler `types/`e tasindi ama BURADAN da disa aciliyor: cagiranlar (uygulamalar ve testler)\n * `@handijitcom/ui/components/Combobox` yolundan aliyordu…\n */\nexport type { ComboboxLabels, ComboboxOption, ComboboxProps } from '../../types/combobox.type';\n\n/** Aranabilir seçim kutusu. `ref` reaches the trigger (2.2): the element to focus for an error. */\nconst ComboboxBase = <T extends string>(\n {\n options,\n value,\n onChange,\n onBlur,\n labels,\n isSearchHidden,\n onSearch,\n isLoading,\n isDisabled,\n isReadOnly,\n isClearable,\n icon,\n size = 'md',\n id,\n required,\n className,\n testId,\n 'aria-describedby': describedBy,\n 'aria-invalid': isInvalid,\n }: ComboboxProps<T>,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n const { labels: config } = useUi();\n\n /* Metinler TEMBEL cozulur: cizilmeyen bir ogenin metnini istemek yanlis alarm uretiyordu */\n const text = {\n get search() {\n return resolveLabel(\n 'Combobox.searchPlaceholder',\n labels.searchPlaceholder,\n config?.combobox?.searchPlaceholder,\n );\n },\n get empty() {\n return resolveLabel(\n 'Combobox.emptyMessage',\n labels.emptyMessage,\n config?.combobox?.emptyMessage,\n );\n },\n get loading() {\n return resolveLabel(\n 'Combobox.loadingMessage',\n labels.loadingMessage,\n config?.combobox?.loadingMessage,\n );\n },\n get clear() {\n return resolveLabel('Combobox.clearLabel', labels.clearLabel, config?.combobox?.clearLabel);\n },\n };\n\n const generatedId = useId();\n const baseId = id ?? generatedId;\n const listboxId = `${baseId}-listbox`;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n /* The caller's `ref` and the inner one hold the same trigger. */\n const setTrigger = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node;\n assignRef(ref, node);\n },\n [ref],\n );\n\n /*\n * Panel NEREDE acilir: masaustunde tetikleyicinin altinda, dar ekranda ekranin dibinde bir alt\n * sayfada.\n */\n const [openMode, setOpenMode] = useState<'popover' | 'sheet' | null>(null);\n const isOpen = openMode !== null;\n const [query, setQuery] = useState('');\n\n // Sunucu araması sırasında seçili kayıt listeden düşebilir; etiketi hatırlarız ki tetikleyici yer\n // tutucuya dönmesin.\n const [cachedLabel, setCachedLabel] = useState<string | null>(null);\n\n const visibleOptions = useMemo(() => {\n // Sunucu araması: gelen liste zaten filtrelidir, tekrar filtrelenmez.\n if (onSearch || query.trim() === '') return options;\n\n const needle = query.trim();\n return options.filter(\n option =>\n matchesSearch(option.label, needle) ||\n (option.description ? matchesSearch(option.description, needle) : false),\n );\n }, [options, query, onSearch]);\n\n const selectedOption = options.find(option => option.value === value) ?? null;\n\n useEffect(() => {\n if (selectedOption) setCachedLabel(selectedOption.label);\n else if (value === null) setCachedLabel(null);\n }, [selectedOption, value]);\n\n const displayLabel = selectedOption?.label ?? cachedLabel;\n\n useAsyncSearch(query, isOpen, onSearch, SEARCH_DEBOUNCE_MS);\n\n const close = useCallback(() => {\n setOpenMode(null);\n setQuery('');\n }, []);\n\n const open = useCallback(() => {\n if (isDisabled || isReadOnly) return;\n /* A sheet only on a narrow TOUCH screen; a desktop window gets the dropdown at any width. */\n setOpenMode(window.matchMedia(SHEET_MEDIA_QUERY).matches ? 'sheet' : 'popover');\n /*\n * Panel acilinca etkin secenek SECILI olan olur (kancanin `initialIndex`i); kullanici listeyi\n * bastan taramak zorunda kalmaz.\n */\n setQuery('');\n }, [isDisabled, isReadOnly]);\n\n /*\n * Disari tiklamada kapanir. `mousedown` kullanilir: `click` beklerken kullanici surukleyerek\n * secim yaparsa panel kapanmiyordu.\n * ⚠ PANEL ARTIK KOKUN ICINDE DEGIL — portallandi. `rootRef` tek basina bakilsaydi panelin ICINE\n * yapilan `mousedown` \"disari\" sayilir ve panel…\n */\n useEffect(() => {\n if (openMode !== 'popover') return;\n\n const handlePointerDown = (event: globalThis.MouseEvent) => {\n const target = event.target as Node;\n if (rootRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n close();\n };\n\n document.addEventListener('mousedown', handlePointerDown);\n return () => document.removeEventListener('mousedown', handlePointerDown);\n }, [openMode, close]);\n\n /* Odak arama kutusuna YALNIZCA masaustu panelinde verilir. */\n useEffect(() => {\n if (openMode === 'popover') inputRef.current?.focus({ preventScroll: true });\n }, [openMode]);\n\n const selectOption = (option: ComboboxOption<T>) => {\n if (option.isDisabled) return;\n setCachedLabel(option.label);\n onChange(option.value);\n close();\n };\n\n /* Kapaninca odak TETIKLEYICIYE doner. */\n const wasOpenRef = useRef(false);\n useEffect(() => {\n if (wasOpenRef.current && !isOpen) triggerRef.current?.focus();\n wasOpenRef.current = isOpen;\n }, [isOpen]);\n\n /* KLAVYE MODELI `useListboxNavigation`da — `Select`le AYNI kanca. */\n /* PANEL SABIT KONUMLU, MUTLAK DEGIL — gerekce SCSS'te (`.combobox__panel`). */\n const positioning = usePositioning(triggerRef, panelRef, {\n side: 'bottom',\n align: 'start',\n isOpen: isOpen && openMode === 'popover',\n });\n\n /*\n * Panel BODY'e (ya da icinde bulundugu acik `<dialog>`a) portallanir; gerekce\n * `hooks/usePortalSurface.ts`.\n */\n const portal = usePortalSurface(openMode === 'popover', triggerRef, panelRef);\n\n const { activeIndex, setActiveIndex, listRef, handleKeyDown } =\n useListboxNavigation<HTMLUListElement>({\n count: visibleOptions.length,\n isOpen,\n initialIndex: Math.max(\n options.findIndex(option => option.value === value),\n 0,\n ),\n onSelect: index => {\n const option = visibleOptions[index];\n if (option) selectOption(option);\n },\n /* Odagi geri vermek kapanisi izleyen etkinin isi (bkz. `wasOpenRef`). */\n onClose: close,\n });\n\n /* SANALLASTIRMA — ve UC kosulu birden. */\n const hasDescriptions = visibleOptions.some(option => Boolean(option.description));\n const isVirtual =\n openMode === 'popover' && !hasDescriptions && visibleOptions.length > VIRTUAL_THRESHOLD;\n\n const { scrollRef, range, scrollToIndex } = useVirtualList(visibleOptions.length, {\n rowHeight: OPTION_HEIGHT,\n isEnabled: isVirtual,\n });\n\n /* Etkin secenek CIZILMEMIS olabilir: `scrollIntoView` o satirda calismaz. */\n useEffect(() => {\n if (isVirtual) scrollToIndex(activeIndex);\n }, [activeIndex, isVirtual, scrollToIndex]);\n\n /*\n * Iki kanca da AYNI ` `e baglanir: biri etkin secenegi gorunur tutuyor, digeri kaydirmayi\n * olcuyor.\n */\n const attachList = (node: HTMLUListElement | null) => {\n listRef.current = node;\n scrollRef.current = node;\n };\n\n const handleInputKeyDown = handleKeyDown;\n\n /*\n * Olculen ariza: `handleKeyDown` YALNIZCA arama girdisine bagliydi\n * (`onKeyDown={handleInputKeyDown}`) ve `isSearchHidden` iken o girdi hic cizilmiyor.\n * ⚠ ARAMA KUTUSU GIZLIYKEN KLAVYE SOZLESMESI TETIKLEYICIYE GECER.\n */\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n /* Arama kutusu VARSA sozlesme oradadir; tetikleyici yalnizca acar. */\n if (!isSearchHidden) return;\n\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {\n event.preventDefault();\n open();\n }\n return;\n }\n\n handleKeyDown(event);\n };\n\n /*\n * 2.2 `onBlur`: React's focus events bubble through the portal, so the root hears the trigger,\n * the clear button AND the panel. Focus moving between them, or into the open sheet, is not a\n * blur.\n */\n const openModeRef = useRef(openMode);\n openModeRef.current = openMode;\n const handleBlur = (event: FocusEvent<HTMLElement>) => {\n if (!onBlur || openModeRef.current === 'sheet') return;\n const next = event.relatedTarget;\n if (\n next instanceof Node &&\n (rootRef.current?.contains(next) || panelRef.current?.contains(next))\n )\n return;\n onBlur(event);\n };\n\n const clearSelection = () => {\n onChange(null);\n setCachedLabel(null);\n };\n\n /* Arama ve liste IKI YERDE ayni: masaustu panelinde ve alt sayfada. */\n const search = isSearchHidden ? null : (\n <div className={styles.combobox__search}>\n <Search aria-hidden className={styles.combobox__searchIcon} />\n {/*\n * 6.0: arama kutusu bir METİN KUTUSU; `role=\"combobox\"` TETİKLEYİCİDEDİR. İki combobox\n * (tetikleyici + kutu) ekran okuyucuda iki ayrı denetim sayılıyordu. `aria-autocomplete`,\n * `aria-controls` ve `aria-activedescendant` textbox rolünde geçerli (ARIA 1.2).\n */}\n <input\n ref={inputRef}\n type=\"text\"\n className={styles.combobox__searchInput}\n value={query}\n placeholder={text.search}\n autoComplete=\"off\"\n aria-autocomplete=\"list\"\n aria-controls={listboxId}\n aria-activedescendant={\n visibleOptions[activeIndex] ? `${baseId}-option-${activeIndex}` : undefined\n }\n aria-label={text.search}\n onChange={event => {\n setQuery(event.target.value);\n setActiveIndex(0);\n }}\n onKeyDown={handleInputKeyDown}\n />\n {isLoading && <Spinner size=\"sm\" label=\"\" />}\n </div>\n );\n\n const renderList = (isSheet: boolean) => {\n /* Cizilen dilim. */\n const slice = visibleOptions.slice(range.start, range.end);\n\n return (\n <ul\n ref={attachList}\n id={listboxId}\n role=\"listbox\"\n className={cx(styles.combobox__list, isSheet && styles['combobox__list--sheet'])}\n >\n {/*\n Kaydirma cubugu GERCEK boyda olmali: cizilmeyen satirlarin yeri\n korunmazsa 1121 ogelik bir liste 16 satirlik bir cubuk gosterir ve\n kullanici listenin bittigini sanardi. Yukseklik ust ve alt bosluklara\n boluniyor — tek bir mutlak konumlu kutu kullanmak `<ul>`in cocuk\n sozlesmesini bozardi (`role=\"listbox\"` yalnizca `option` bekler).\n */}\n {isVirtual && range.offset > 0 && <li aria-hidden style={{ height: range.offset }} />}\n\n {slice.map((option, sliceIndex) => {\n const index = range.start + sliceIndex;\n const isActive = index === activeIndex;\n const isChosen = option.value === value;\n\n return (\n /* ⚠ `role=\"option\"` ` `NIN KENDISINDE. */\n <li\n key={option.value}\n id={`${baseId}-option-${index}`}\n role=\"option\"\n data-index={index}\n /* EKRAN OKUYUCU GERCEK SAYIYI DUYMALI. */\n aria-setsize={isVirtual ? visibleOptions.length : undefined}\n aria-posinset={isVirtual ? index + 1 : undefined}\n aria-selected={isChosen}\n aria-disabled={option.isDisabled}\n className={cx(\n styles.combobox__option,\n isActive && styles['combobox__option--active'],\n isChosen && styles['combobox__option--selected'],\n option.isDisabled && styles['combobox__option--disabled'],\n )}\n // Fare imleci seçeneğin üstündeyken etkin seçenek de oraya taşınır; iki ayrı vurgu\n // kullanıcıyı şaşırtıyordu.\n onMouseEnter={() => setActiveIndex(index)}\n /*\n * 2.2: pressing an option keeps the focus where it is (the search box, or the\n * trigger when it is hidden). The option is not focusable, so the press used to drop\n * the focus on `<body>` — a blur before the choice even arrived.\n */\n onMouseDown={event => event.preventDefault()}\n onClick={() => selectOption(option)}\n >\n <span className={styles.combobox__optionText}>\n <span className={styles.combobox__optionLabel}>{option.label}</span>\n {option.description && (\n <span className={styles.combobox__optionDescription}>{option.description}</span>\n )}\n </span>\n\n {isChosen && <CheckLg aria-hidden className={styles.combobox__check} />}\n </li>\n );\n })}\n\n {isVirtual && range.end < visibleOptions.length && (\n <li aria-hidden style={{ height: (visibleOptions.length - range.end) * OPTION_HEIGHT }} />\n )}\n\n {visibleOptions.length === 0 && (\n <li className={styles.combobox__empty}>{isLoading ? text.loading : text.empty}</li>\n )}\n </ul>\n );\n };\n\n return (\n <div\n ref={rootRef}\n className={cx(styles.combobox, className)}\n data-testid={testId}\n onBlur={handleBlur}\n >\n <button\n ref={setTrigger}\n id={baseId}\n type=\"button\"\n className={cx(\n styles.combobox__trigger,\n size === 'sm' && styles['combobox__trigger--sm'],\n !displayLabel && styles['combobox__trigger--empty'],\n isOpen && styles['combobox__trigger--open'],\n isInvalid && styles['combobox__trigger--invalid'],\n isReadOnly && styles['combobox__trigger--readOnly'],\n isClearable &&\n displayLabel &&\n !isDisabled &&\n !isReadOnly &&\n styles['combobox__trigger--clearable'],\n )}\n disabled={isDisabled}\n /*\n * 6.0: tetikleyici `role=\"combobox\"` (`Select` ile aynı): kapalıyken de \"açılır seçim\"\n * olarak duyurulur, `aria-expanded` durumu, `aria-controls` listeyi gösterir (kapalıyken\n * hedef DOM'da yok — `aria-expanded=\"false\"` ile geçerli) ve `aria-invalid` bu rolde\n * TANIMLI olduğu için hata artık doğrudan yazılır. Düğme rolünde `aria-invalid` tanımsızdı\n * ve eksen taraması form hatasında ilk hatalı alana odaklanamıyordu (handijit.com D-12).\n */\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={listboxId}\n /*\n * Yerine `aria-labelledby`: once kontrolun ADI (gorunmez span), sonra DEGERI.\n * ⚠ `aria-label` KULLANILMAZ — SECILI DEGERI MASKELIYORDU. `aria-label` elemanin ICERIGININ\n * yerine gecer\n */\n aria-labelledby={displayLabel ? `${baseId}-name ${baseId}-value` : `${baseId}-name`}\n aria-describedby={describedBy}\n aria-invalid={isInvalid || undefined}\n /* Tetikleyici bir `<button>`; yerel `required` yok, karsiligi bu. */\n aria-required={required || undefined}\n aria-readonly={isReadOnly || undefined}\n onClick={() => (isOpen ? close() : open())}\n onKeyDown={handleTriggerKeyDown}\n >\n {icon && (\n <span className={styles.combobox__leadingIcon} aria-hidden>\n {icon}\n </span>\n )}\n\n {/* Kontrolün adı — yalnızca erişilebilirlik ağacında. */}\n <span id={`${baseId}-name`} className={styles.combobox__srName}>\n {labels.placeholder}\n </span>\n\n <span id={`${baseId}-value`} className={styles.combobox__value}>\n {displayLabel ?? labels.placeholder}\n </span>\n\n {/* Dolu caret — gerekcesi `Select` ile ayni. */}\n {/* A read-only combobox does not open: no caret promising a list. */}\n {!isReadOnly && (\n <CaretDownFill\n aria-hidden\n className={cx(styles.combobox__chevron, isOpen && styles['combobox__chevron--open'])}\n />\n )}\n </button>\n\n {/*\n TEMİZLEME DÜĞMESİ TETİKLEYİCİNİN İÇİNDE DEĞİL, KARDEŞİ.\n\n Önce `<button>`ın içinde `role=\"button\" tabIndex={0}` taşıyan bir\n `<span>` olarak duruyordu; dosyadaki yorum \"DOM'da kardeş\" diyordu ama\n kod öyle değildi. Eksen taraması bunu `nested-interactive` olarak\n bildirdi ve sonucu somut: iç içe etkileşimli öğede ekran okuyucular\n yalnızca dıştaki düğmeyi duyurur, içteki çarpıya klavyeyle ulaşılsa bile\n adı okunmaz — yani \"seçimi temizle\" eylemi destek teknolojisi\n kullanıcısı için YOK. Kardeş olarak çizilip tetikleyicinin üzerine\n konumlandırılıyor; görsel yer aynı, ağaçtaki yeri doğru.\n */}\n {isClearable && displayLabel && !isDisabled && !isReadOnly && (\n <button\n type=\"button\"\n className={styles.combobox__clear}\n aria-label={text.clear}\n onClick={clearSelection}\n >\n <XLg aria-hidden />\n </button>\n )}\n\n {/* Masaüstü: tetikleyiciye yapışan panel — DOM'da kökün değil portalın içinde. */}\n {openMode === 'popover' &&\n portal.container &&\n createPortal(\n <div\n ref={panelRef}\n className={styles.combobox__panel}\n {...portal.attributes}\n style={{\n ...positioning.style,\n ...portal.style,\n /*\n * Panel tetikleyiciyle AYNI genislikte: sabit konum + portal onu kapsayicidan\n * kopardigi icin genislik artik miras alinmiyor.\n */\n width: positioning.anchorWidth || undefined,\n /* Ilk karede olcu yok; yanlis yerde bir kare parlamasin. */\n visibility: positioning.isPositioned ? undefined : 'hidden',\n }}\n >\n {search}\n {renderList(false)}\n </div>,\n portal.container,\n )}\n\n {/*\n Dar ekran: alt sayfa. Yapışkan panel telefonda klavye açılınca sıkışıyor\n ve uzun listenin alt ucu ekranın dışında kalıyordu; arama kutusu da\n tetikleyiciyle klavyenin arasına hapsoluyordu. Arama `toolbar`\n yuvasında: başlığın altında sabit kalır, liste altında kayar.\n */}\n {openMode === 'sheet' && (\n <BottomSheet\n title={labels.placeholder}\n closeLabel={labels.closeLabel ?? config?.close}\n onClose={close}\n toolbar={search ?? undefined}\n >\n {renderList(true)}\n </BottomSheet>\n )}\n </div>\n );\n};\n\n/* A generic component keeps its type parameter through `forwardRef` only with this cast. */\nconst Combobox = /*#__PURE__*/ forwardRef(ComboboxBase) as <T extends string>(\n props: ComboboxProps<T> & { ref?: Ref<HTMLButtonElement> },\n) => ReactElement;\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Combobox, 'Combobox')) as typeof Combobox;\n"],"names":["ComboboxBase","options","value","onChange","onBlur","labels","isSearchHidden","onSearch","isLoading","isDisabled","isReadOnly","isClearable","icon","size","id","required","className","testId","describedBy","isInvalid","ref","config","useUi","text","resolveLabel","_a","generatedId","useId","baseId","listboxId","rootRef","useRef","triggerRef","panelRef","inputRef","setTrigger","useCallback","node","assignRef","openMode","setOpenMode","useState","isOpen","query","setQuery","cachedLabel","setCachedLabel","visibleOptions","useMemo","needle","option","matchesSearch","selectedOption","useEffect","displayLabel","useAsyncSearch","SEARCH_DEBOUNCE_MS","close","open","SHEET_MEDIA_QUERY","handlePointerDown","event","target","_b","selectOption","wasOpenRef","positioning","usePositioning","portal","usePortalSurface","activeIndex","setActiveIndex","listRef","handleKeyDown","useListboxNavigation","index","hasDescriptions","isVirtual","VIRTUAL_THRESHOLD","scrollRef","range","scrollToIndex","useVirtualList","OPTION_HEIGHT","attachList","handleInputKeyDown","handleTriggerKeyDown","openModeRef","handleBlur","next","clearSelection","search","styles","jsx","Search","Spinner","renderList","isSheet","slice","jsxs","cx","sliceIndex","isActive","isChosen","CheckLg","CaretDownFill","XLg","createPortal","BottomSheet","Combobox","memo","named"],"mappings":"07BAmDMA,GAAe,CACnB,CACE,QAAAC,EACA,MAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,EACA,eAAAC,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EACA,KAAAC,EACA,KAAAC,GAAO,KACP,GAAAC,GACA,SAAAC,GACA,UAAAC,GACA,OAAAC,GACA,mBAAoBC,GACpB,eAAgBC,CAClB,EACAC,IACG,CACH,KAAM,CAAE,OAAQC,CAAA,EAAWC,SAAA,EAGrBC,EAAO,CACX,IAAI,QAAS,OACX,OAAOC,EAAAA,aACL,6BACAnB,EAAO,mBACPoB,EAAAJ,GAAA,YAAAA,EAAQ,WAAR,YAAAI,EAAkB,iBAAA,CAEtB,EACA,IAAI,OAAQ,OACV,OAAOD,EAAAA,aACL,wBACAnB,EAAO,cACPoB,EAAAJ,GAAA,Y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EAAAA,IAACY,EAAAA,cAAA,CACC,cAAW,GACX,UAAWL,EAAAA,GAAGR,EAAAA,QAAO,kBAAmBlD,GAAUkD,EAAAA,QAAO,yBAAyB,CAAC,CAAA,CAAA,CACrF,CAAA,CAAA,EAgBHjF,GAAe2C,GAAgB,CAAC7C,GAAc,CAACC,GAC9CmF,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWD,EAAAA,QAAO,gBAClB,aAAYrE,EAAK,MACjB,QAASmE,GAET,SAAAG,EAAAA,IAACa,EAAAA,IAAA,CAAI,cAAW,EAAA,CAAC,CAAA,CAAA,EAKpBnE,IAAa,WACZ6B,EAAO,WACPuC,GAAAA,aACER,EAAAA,KAAC,MAAA,CACC,IAAKlE,EACL,UAAW2D,EAAAA,QAAO,gBACjB,GAAGxB,EAAO,WACX,MAAO,CACL,GAAGF,EAAY,MACf,GAAGE,EAAO,MAKV,MAAOF,EAAY,aAAe,OAElC,WAAYA,EAAY,aAAe,OAAY,QAAA,EAGpD,SAAA,CAAAyB,GACAK,GAAW,EAAK,CAAA,CAAA,CAAA,EAEnB5B,EAAO,SAAA,EASV7B,IAAa,SACZsD,EAAAA,IAACe,GAAAA,QAAA,CACC,MAAOvG,EAAO,YACd,WAAYA,EAAO,aAAcgB,GAAA,YAAAA,EAAQ,OACzC,QAASoC,EACT,QAASkC,IAAU,OAElB,YAAW,EAAI,CAAA,CAAA,CAClB,CAAA,CAAA,CAIR,EAGMkB,gBAAoC7G,EAAY,EAItD2E,GAA6BmC,OAAmBC,GAAAA,MAAMF,GAAU,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Combobox/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FocusEvent,\n type ForwardedRef,\n forwardRef,\n type KeyboardEvent,\n memo,\n type ReactElement,\n type Ref,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { CaretDownFill, CheckLg, Search, XLg } from 'react-bootstrap-icons';\n\nimport { SHEET_MEDIA_QUERY } from '../../constants/breakpoint.constants';\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { assignRef } from '../../helpers/ref.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { matchesSearch } from '../../helpers/text.helper';\nimport useAsyncSearch from '../../hooks/useAsyncSearch';\nimport useListboxNavigation from '../../hooks/useListboxNavigation';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\nimport useVirtualList from '../../hooks/useVirtualList';\nimport { useUi } from '../../theme/context';\nimport BottomSheet from '../BottomSheet';\nimport Spinner from '../Spinner';\n\nimport {\n OPTION_HEIGHT,\n SEARCH_DEBOUNCE_MS,\n VIRTUAL_THRESHOLD,\n} from '../../constants/combobox.constants';\nimport { ComboboxOption, ComboboxProps } from '../../types/combobox.type';\n\nimport styles from './index.module.scss';\n\n/*\n * Tipler `types/`e tasindi ama BURADAN da disa aciliyor: cagiranlar (uygulamalar ve testler)\n * `@handijitcom/ui/components/Combobox` yolundan aliyordu…\n */\nexport type { ComboboxLabels, ComboboxOption, ComboboxProps } from '../../types/combobox.type';\n\n/** Aranabilir seçim kutusu. `ref` reaches the trigger (2.2): the element to focus for an error. */\nconst ComboboxBase = <T extends string>(\n {\n options,\n value,\n onChange,\n onBlur,\n labels,\n isSearchHidden,\n onSearch,\n isLoading,\n isDisabled,\n isReadOnly,\n isClearable,\n icon,\n size = 'md',\n id,\n required,\n className,\n testId,\n 'aria-describedby': describedBy,\n 'aria-invalid': isInvalid,\n }: ComboboxProps<T>,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n const { labels: config } = useUi();\n\n /* Metinler TEMBEL cozulur: cizilmeyen bir ogenin metnini istemek yanlis alarm uretiyordu */\n const text = {\n get search() {\n return resolveLabel(\n 'Combobox.searchPlaceholder',\n labels.searchPlaceholder,\n config?.combobox?.searchPlaceholder,\n );\n },\n get empty() {\n return resolveLabel(\n 'Combobox.emptyMessage',\n labels.emptyMessage,\n config?.combobox?.emptyMessage,\n );\n },\n get loading() {\n return resolveLabel(\n 'Combobox.loadingMessage',\n labels.loadingMessage,\n config?.combobox?.loadingMessage,\n );\n },\n get clear() {\n return resolveLabel('Combobox.clearLabel', labels.clearLabel, config?.combobox?.clearLabel);\n },\n };\n\n const generatedId = useId();\n const baseId = id ?? generatedId;\n const listboxId = `${baseId}-listbox`;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n /* The caller's `ref` and the inner one hold the same trigger. */\n const setTrigger = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node;\n assignRef(ref, node);\n },\n [ref],\n );\n\n /*\n * Panel NEREDE acilir: masaustunde tetikleyicinin altinda, dar ekranda ekranin dibinde bir alt\n * sayfada.\n */\n const [openMode, setOpenMode] = useState<'popover' | 'sheet' | null>(null);\n const isOpen = openMode !== null;\n const [query, setQuery] = useState('');\n\n // Sunucu araması sırasında seçili kayıt listeden düşebilir; etiketi hatırlarız ki tetikleyici yer\n // tutucuya dönmesin.\n const [cachedLabel, setCachedLabel] = useState<string | null>(null);\n\n const visibleOptions = useMemo(() => {\n // Sunucu araması: gelen liste zaten filtrelidir, tekrar filtrelenmez.\n if (onSearch || query.trim() === '') return options;\n\n const needle = query.trim();\n return options.filter(\n option =>\n matchesSearch(option.label, needle) ||\n (option.description ? matchesSearch(option.description, needle) : false),\n );\n }, [options, query, onSearch]);\n\n const selectedOption = options.find(option => option.value === value) ?? null;\n\n useEffect(() => {\n if (selectedOption) setCachedLabel(selectedOption.label);\n else if (value === null) setCachedLabel(null);\n }, [selectedOption, value]);\n\n const displayLabel = selectedOption?.label ?? cachedLabel;\n\n useAsyncSearch(query, isOpen, onSearch, SEARCH_DEBOUNCE_MS);\n\n const close = useCallback(() => {\n setOpenMode(null);\n setQuery('');\n }, []);\n\n const open = useCallback(() => {\n if (isDisabled || isReadOnly) return;\n /* A sheet only on a narrow TOUCH screen; a desktop window gets the dropdown at any width. */\n setOpenMode(window.matchMedia(SHEET_MEDIA_QUERY).matches ? 'sheet' : 'popover');\n /*\n * Panel acilinca etkin secenek SECILI olan olur (kancanin `initialIndex`i); kullanici listeyi\n * bastan taramak zorunda kalmaz.\n */\n setQuery('');\n }, [isDisabled, isReadOnly]);\n\n /*\n * Disari tiklamada kapanir. `mousedown` kullanilir: `click` beklerken kullanici surukleyerek\n * secim yaparsa panel kapanmiyordu.\n * ⚠ PANEL ARTIK KOKUN ICINDE DEGIL — portallandi. `rootRef` tek basina bakilsaydi panelin ICINE\n * yapilan `mousedown` \"disari\" sayilir ve panel…\n */\n useEffect(() => {\n if (openMode !== 'popover') return;\n\n const handlePointerDown = (event: globalThis.MouseEvent) => {\n const target = event.target as Node;\n if (rootRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n close();\n };\n\n document.addEventListener('mousedown', handlePointerDown);\n return () => document.removeEventListener('mousedown', handlePointerDown);\n }, [openMode, close]);\n\n const selectOption = (option: ComboboxOption<T>) => {\n if (option.isDisabled) return;\n setCachedLabel(option.label);\n onChange(option.value);\n close();\n };\n\n /* Kapaninca odak TETIKLEYICIYE doner. */\n const wasOpenRef = useRef(false);\n useEffect(() => {\n if (wasOpenRef.current && !isOpen) triggerRef.current?.focus();\n wasOpenRef.current = isOpen;\n }, [isOpen]);\n\n /* KLAVYE MODELI `useListboxNavigation`da — `Select`le AYNI kanca. */\n /* PANEL SABIT KONUMLU, MUTLAK DEGIL — gerekce SCSS'te (`.combobox__panel`). */\n const positioning = usePositioning(triggerRef, panelRef, {\n side: 'bottom',\n align: 'start',\n isOpen: isOpen && openMode === 'popover',\n });\n\n /*\n * Panel BODY'e (ya da icinde bulundugu acik `<dialog>`a) portallanir; gerekce\n * `hooks/usePortalSurface.ts`.\n */\n const portal = usePortalSurface(openMode === 'popover', triggerRef, panelRef);\n\n /*\n * The search box takes the focus ONLY in the desktop panel — and only once the panel is SHOWN.\n * ⚠ STF-24 (3.4.1): the focus used to be given as soon as `openMode` changed. At that moment the\n * panel is `visibility: hidden` (not measured yet) and, inside a `<dialog>`, its top layer\n * (`popover=\"manual\"`) is not open yet, i.e. `display: none`; a browser does not focus a hidden\n * box. The focus stayed on the trigger, typing was ignored and Enter took the first option. Like\n * `Popover` and `Menu`, this waits for `isPositioned`, and it is declared AFTER the effect of\n * `usePortalSurface` that opens the top layer.\n */\n const isPanelShown = openMode === 'popover' && positioning.isPositioned;\n useEffect(() => {\n if (isPanelShown) inputRef.current?.focus({ preventScroll: true });\n }, [isPanelShown]);\n\n const { activeIndex, setActiveIndex, listRef, handleKeyDown } =\n useListboxNavigation<HTMLUListElement>({\n count: visibleOptions.length,\n isOpen,\n initialIndex: Math.max(\n options.findIndex(option => option.value === value),\n 0,\n ),\n onSelect: index => {\n const option = visibleOptions[index];\n if (option) selectOption(option);\n },\n /* Odagi geri vermek kapanisi izleyen etkinin isi (bkz. `wasOpenRef`). */\n onClose: close,\n });\n\n /* SANALLASTIRMA — ve UC kosulu birden. */\n const hasDescriptions = visibleOptions.some(option => Boolean(option.description));\n const isVirtual =\n openMode === 'popover' && !hasDescriptions && visibleOptions.length > VIRTUAL_THRESHOLD;\n\n const { scrollRef, range, scrollToIndex } = useVirtualList(visibleOptions.length, {\n rowHeight: OPTION_HEIGHT,\n isEnabled: isVirtual,\n });\n\n /* Etkin secenek CIZILMEMIS olabilir: `scrollIntoView` o satirda calismaz. */\n useEffect(() => {\n if (isVirtual) scrollToIndex(activeIndex);\n }, [activeIndex, isVirtual, scrollToIndex]);\n\n /*\n * Iki kanca da AYNI ` `e baglanir: biri etkin secenegi gorunur tutuyor, digeri kaydirmayi\n * olcuyor.\n */\n const attachList = (node: HTMLUListElement | null) => {\n listRef.current = node;\n scrollRef.current = node;\n };\n\n const handleInputKeyDown = handleKeyDown;\n\n /*\n * Olculen ariza: `handleKeyDown` YALNIZCA arama girdisine bagliydi\n * (`onKeyDown={handleInputKeyDown}`) ve `isSearchHidden` iken o girdi hic cizilmiyor.\n * ⚠ ARAMA KUTUSU GIZLIYKEN KLAVYE SOZLESMESI TETIKLEYICIYE GECER.\n */\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {\n event.preventDefault();\n open();\n }\n return;\n }\n\n /*\n * With a search box the contract lives there: if the focus is on the trigger while the panel is\n * open, the key is sent on to the box — a typed letter lands in it, arrows and Enter work on the\n * filtered list (3.4.1). The sheet never moves the focus by itself.\n */\n if (!isSearchHidden && openMode === 'popover') inputRef.current?.focus({ preventScroll: true });\n handleKeyDown(event);\n };\n\n /*\n * 2.2 `onBlur`: React's focus events bubble through the portal, so the root hears the trigger,\n * the clear button AND the panel. Focus moving between them, or into the open sheet, is not a\n * blur.\n */\n const openModeRef = useRef(openMode);\n openModeRef.current = openMode;\n const handleBlur = (event: FocusEvent<HTMLElement>) => {\n if (!onBlur || openModeRef.current === 'sheet') return;\n const next = event.relatedTarget;\n if (\n next instanceof Node &&\n (rootRef.current?.contains(next) || panelRef.current?.contains(next))\n )\n return;\n onBlur(event);\n };\n\n const clearSelection = () => {\n onChange(null);\n setCachedLabel(null);\n };\n\n /* Arama ve liste IKI YERDE ayni: masaustu panelinde ve alt sayfada. */\n const search = isSearchHidden ? null : (\n <div className={styles.combobox__search}>\n <Search aria-hidden className={styles.combobox__searchIcon} />\n {/*\n * 6.0: arama kutusu bir METİN KUTUSU; `role=\"combobox\"` TETİKLEYİCİDEDİR. İki combobox\n * (tetikleyici + kutu) ekran okuyucuda iki ayrı denetim sayılıyordu. `aria-autocomplete`,\n * `aria-controls` ve `aria-activedescendant` textbox rolünde geçerli (ARIA 1.2).\n */}\n <input\n ref={inputRef}\n type=\"text\"\n className={styles.combobox__searchInput}\n value={query}\n placeholder={text.search}\n autoComplete=\"off\"\n aria-autocomplete=\"list\"\n aria-controls={listboxId}\n aria-activedescendant={\n visibleOptions[activeIndex] ? `${baseId}-option-${activeIndex}` : undefined\n }\n aria-label={text.search}\n onChange={event => {\n setQuery(event.target.value);\n setActiveIndex(0);\n }}\n onKeyDown={handleInputKeyDown}\n />\n {isLoading && <Spinner size=\"sm\" label=\"\" />}\n </div>\n );\n\n const renderList = (isSheet: boolean) => {\n /* Cizilen dilim. */\n const slice = visibleOptions.slice(range.start, range.end);\n\n return (\n <ul\n ref={attachList}\n id={listboxId}\n role=\"listbox\"\n className={cx(styles.combobox__list, isSheet && styles['combobox__list--sheet'])}\n >\n {/*\n Kaydirma cubugu GERCEK boyda olmali: cizilmeyen satirlarin yeri\n korunmazsa 1121 ogelik bir liste 16 satirlik bir cubuk gosterir ve\n kullanici listenin bittigini sanardi. Yukseklik ust ve alt bosluklara\n boluniyor — tek bir mutlak konumlu kutu kullanmak `<ul>`in cocuk\n sozlesmesini bozardi (`role=\"listbox\"` yalnizca `option` bekler).\n */}\n {isVirtual && range.offset > 0 && <li aria-hidden style={{ height: range.offset }} />}\n\n {slice.map((option, sliceIndex) => {\n const index = range.start + sliceIndex;\n const isActive = index === activeIndex;\n const isChosen = option.value === value;\n\n return (\n /* ⚠ `role=\"option\"` ` `NIN KENDISINDE. */\n <li\n key={option.value}\n id={`${baseId}-option-${index}`}\n role=\"option\"\n data-index={index}\n /* EKRAN OKUYUCU GERCEK SAYIYI DUYMALI. */\n aria-setsize={isVirtual ? visibleOptions.length : undefined}\n aria-posinset={isVirtual ? index + 1 : undefined}\n aria-selected={isChosen}\n aria-disabled={option.isDisabled}\n className={cx(\n styles.combobox__option,\n isActive && styles['combobox__option--active'],\n isChosen && styles['combobox__option--selected'],\n option.isDisabled && styles['combobox__option--disabled'],\n )}\n // Fare imleci seçeneğin üstündeyken etkin seçenek de oraya taşınır; iki ayrı vurgu\n // kullanıcıyı şaşırtıyordu.\n onMouseEnter={() => setActiveIndex(index)}\n /*\n * 2.2: pressing an option keeps the focus where it is (the search box, or the\n * trigger when it is hidden). The option is not focusable, so the press used to drop\n * the focus on `<body>` — a blur before the choice even arrived.\n */\n onMouseDown={event => event.preventDefault()}\n onClick={() => selectOption(option)}\n >\n <span className={styles.combobox__optionText}>\n <span className={styles.combobox__optionLabel}>{option.label}</span>\n {option.description && (\n <span className={styles.combobox__optionDescription}>{option.description}</span>\n )}\n </span>\n\n {isChosen && <CheckLg aria-hidden className={styles.combobox__check} />}\n </li>\n );\n })}\n\n {isVirtual && range.end < visibleOptions.length && (\n <li aria-hidden style={{ height: (visibleOptions.length - range.end) * OPTION_HEIGHT }} />\n )}\n\n {visibleOptions.length === 0 && (\n <li className={styles.combobox__empty}>{isLoading ? text.loading : text.empty}</li>\n )}\n </ul>\n );\n };\n\n return (\n <div\n ref={rootRef}\n className={cx(styles.combobox, className)}\n data-testid={testId}\n onBlur={handleBlur}\n >\n <button\n ref={setTrigger}\n id={baseId}\n type=\"button\"\n className={cx(\n styles.combobox__trigger,\n size === 'sm' && styles['combobox__trigger--sm'],\n !displayLabel && styles['combobox__trigger--empty'],\n isOpen && styles['combobox__trigger--open'],\n isInvalid && styles['combobox__trigger--invalid'],\n isReadOnly && styles['combobox__trigger--readOnly'],\n isClearable &&\n displayLabel &&\n !isDisabled &&\n !isReadOnly &&\n styles['combobox__trigger--clearable'],\n )}\n disabled={isDisabled}\n /*\n * 6.0: tetikleyici `role=\"combobox\"` (`Select` ile aynı): kapalıyken de \"açılır seçim\"\n * olarak duyurulur, `aria-expanded` durumu, `aria-controls` listeyi gösterir (kapalıyken\n * hedef DOM'da yok — `aria-expanded=\"false\"` ile geçerli) ve `aria-invalid` bu rolde\n * TANIMLI olduğu için hata artık doğrudan yazılır. Düğme rolünde `aria-invalid` tanımsızdı\n * ve eksen taraması form hatasında ilk hatalı alana odaklanamıyordu (handijit.com D-12).\n */\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={listboxId}\n /*\n * Yerine `aria-labelledby`: once kontrolun ADI (gorunmez span), sonra DEGERI.\n * ⚠ `aria-label` KULLANILMAZ — SECILI DEGERI MASKELIYORDU. `aria-label` elemanin ICERIGININ\n * yerine gecer\n */\n aria-labelledby={displayLabel ? `${baseId}-name ${baseId}-value` : `${baseId}-name`}\n aria-describedby={describedBy}\n aria-invalid={isInvalid || undefined}\n /* Tetikleyici bir `<button>`; yerel `required` yok, karsiligi bu. */\n aria-required={required || undefined}\n aria-readonly={isReadOnly || undefined}\n onClick={() => (isOpen ? close() : open())}\n onKeyDown={handleTriggerKeyDown}\n >\n {icon && (\n <span className={styles.combobox__leadingIcon} aria-hidden>\n {icon}\n </span>\n )}\n\n {/* Kontrolün adı — yalnızca erişilebilirlik ağacında. */}\n <span id={`${baseId}-name`} className={styles.combobox__srName}>\n {labels.placeholder}\n </span>\n\n <span id={`${baseId}-value`} className={styles.combobox__value}>\n {displayLabel ?? labels.placeholder}\n </span>\n\n {/* Dolu caret — gerekcesi `Select` ile ayni. */}\n {/* A read-only combobox does not open: no caret promising a list. */}\n {!isReadOnly && (\n <CaretDownFill\n aria-hidden\n className={cx(styles.combobox__chevron, isOpen && styles['combobox__chevron--open'])}\n />\n )}\n </button>\n\n {/*\n TEMİZLEME DÜĞMESİ TETİKLEYİCİNİN İÇİNDE DEĞİL, KARDEŞİ.\n\n Önce `<button>`ın içinde `role=\"button\" tabIndex={0}` taşıyan bir\n `<span>` olarak duruyordu; dosyadaki yorum \"DOM'da kardeş\" diyordu ama\n kod öyle değildi. Eksen taraması bunu `nested-interactive` olarak\n bildirdi ve sonucu somut: iç içe etkileşimli öğede ekran okuyucular\n yalnızca dıştaki düğmeyi duyurur, içteki çarpıya klavyeyle ulaşılsa bile\n adı okunmaz — yani \"seçimi temizle\" eylemi destek teknolojisi\n kullanıcısı için YOK. Kardeş olarak çizilip tetikleyicinin üzerine\n konumlandırılıyor; görsel yer aynı, ağaçtaki yeri doğru.\n */}\n {isClearable && displayLabel && !isDisabled && !isReadOnly && (\n <button\n type=\"button\"\n className={styles.combobox__clear}\n aria-label={text.clear}\n onClick={clearSelection}\n >\n <XLg aria-hidden />\n </button>\n )}\n\n {/* Masaüstü: tetikleyiciye yapışan panel — DOM'da kökün değil portalın içinde. */}\n {openMode === 'popover' &&\n portal.container &&\n createPortal(\n <div\n ref={panelRef}\n className={styles.combobox__panel}\n {...portal.attributes}\n style={{\n ...positioning.style,\n ...portal.style,\n /*\n * Panel tetikleyiciyle AYNI genislikte: sabit konum + portal onu kapsayicidan\n * kopardigi icin genislik artik miras alinmiyor.\n */\n width: positioning.anchorWidth || undefined,\n /* Ilk karede olcu yok; yanlis yerde bir kare parlamasin. */\n visibility: positioning.isPositioned ? undefined : 'hidden',\n }}\n >\n {search}\n {renderList(false)}\n </div>,\n portal.container,\n )}\n\n {/*\n Dar ekran: alt sayfa. Yapışkan panel telefonda klavye açılınca sıkışıyor\n ve uzun listenin alt ucu ekranın dışında kalıyordu; arama kutusu da\n tetikleyiciyle klavyenin arasına hapsoluyordu. Arama `toolbar`\n yuvasında: başlığın altında sabit kalır, liste altında kayar.\n */}\n {openMode === 'sheet' && (\n <BottomSheet\n title={labels.placeholder}\n closeLabel={labels.closeLabel ?? config?.close}\n onClose={close}\n toolbar={search ?? undefined}\n >\n {renderList(true)}\n </BottomSheet>\n )}\n </div>\n );\n};\n\n/* A generic component keeps its type parameter through `forwardRef` only with this cast. */\nconst Combobox = /*#__PURE__*/ forwardRef(ComboboxBase) as <T extends string>(\n props: ComboboxProps<T> & { ref?: Ref<HTMLButtonElement> },\n) => ReactElement;\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Combobox, 'Combobox')) as typeof Combobox;\n"],"names":["ComboboxBase","options","value","onChange","onBlur","labels","isSearchHidden","onSearch","isLoading","isDisabled","isReadOnly","isClearable","icon","size","id","required","className","testId","describedBy","isInvalid","ref","config","useUi","text","resolveLabel","_a","generatedId","useId","baseId","listboxId","rootRef","useRef","triggerRef","panelRef","inputRef","setTrigger","useCallback","node","assignRef","openMode","setOpenMode","useState","isOpen","query","setQuery","cachedLabel","setCachedLabel","visibleOptions","useMemo","needle","option","matchesSearch","selectedOption","useEffect","displayLabel","useAsyncSearch","SEARCH_DEBOUNCE_MS","close","open","SHEET_MEDIA_QUERY","handlePointerDown","event","target","_b","selectOption","wasOpenRef","positioning","usePositioning","portal","usePortalSurface","isPanelShown","activeIndex","setActiveIndex","listRef","handleKeyDown","useListboxNavigation","index","hasDescriptions","isVirtual","VIRTUAL_THRESHOLD","scrollRef","range","scrollToIndex","useVirtualList","OPTION_HEIGHT","attachList","handleInputKeyDown","handleTriggerKeyDown","openModeRef","handleBlur","next","clearSelection","search","styles","jsx","Search","Spinner","renderList","isSheet","slice","jsxs","cx","sliceIndex","isActive","isChosen","CheckLg","CaretDownFill","XLg","createPortal","BottomSheet","Combobox","memo","named"],"mappings":"07BAmDMA,GAAe,CACnB,CACE,QAAAC,EACA,MAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,EACA,eAAAC,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EACA,KAAAC,EACA,KAAAC,GAAO,KACP,GAAAC,GACA,SAAAC,GACA,UAAAC,GACA,OAAAC,GACA,mBAAoBC,GACpB,eAAgBC,CAClB,EACAC,IACG,CACH,KAAM,CAAE,OAAQC,CAAA,EAAWC,SAAA,EAGrBC,EAAO,CACX,IAAI,QAAS,OACX,OAAOC,EAAAA,aACL,6BACAnB,EAAO,mBACPoB,EAAAJ,GAAA,YAAAA,EAAQ,WAAR,YAAAI,EAAkB,iBAAA,CAEtB,EACA,IAAI,OAAQ,OACV,OAAOD,EAAAA,aACL,wBACAnB,EAAO,cACPoB,EAAAJ,GAAA,YAAAA,EAAQ,WAAR,YAAAI,EAAkB,YAAA,CAEtB,EACA,IAAI,SAAU,OACZ,OAAOD,EAAAA,aACL,0BACAnB,EAAO,gBACPoB,EAAAJ,GAAA,YAAAA,EAAQ,WAAR,YAAAI,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