@handijitcom/ui 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/build/components/SearchField/index.cjs +2 -0
- package/build/components/SearchField/index.cjs.map +1 -0
- package/build/components/SearchField/index.d.cts +84 -0
- package/build/components/SearchField/index.d.ts +84 -0
- package/build/components/SearchField/index.js +209 -0
- package/build/components/SearchField/index.js.map +1 -0
- package/build/components/SearchField/style.css +1 -0
- package/build/index.cjs +1 -1
- package/build/index.d.cts +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +95 -93
- package/build/index.js.map +1 -1
- package/build/styles.css +2 -0
- package/build/types/theme.type.d.cts +9 -0
- package/build/types/theme.type.d.ts +9 -0
- package/build/types/types/theme.type.d.cts +9 -0
- package/build/types/types/theme.type.d.ts +9 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -420,6 +420,7 @@ either. Labels are given **once**, on the provider:
|
|
|
420
420
|
numberType: 'Tür',
|
|
421
421
|
number: 'Numara',
|
|
422
422
|
},
|
|
423
|
+
searchField: { clear: 'Aramayı temizle', loading: 'Aranıyor…', results: count => `${count} öneri` },
|
|
423
424
|
rating: {
|
|
424
425
|
srLabel: (value, count) => `5 üzerinden ${value}${count ? `, ${count} değerlendirme` : ''}`,
|
|
425
426
|
starCount: star => `${star} yıldız`,
|
|
@@ -1056,6 +1057,43 @@ with one flat hover; counts and the selection count are plain secondary figures.
|
|
|
1056
1057
|
**Summaries.** `TotalsList` for money totals; `DescriptionList` (`/chat`) takes
|
|
1057
1058
|
`valueAlign="end"` to set values against the end edge in tabular figures.
|
|
1058
1059
|
|
|
1060
|
+
### Storefront search (3.9)
|
|
1061
|
+
|
|
1062
|
+
`SearchField` is a header's search: a search field (icon, clear button, never a caret) in a GET
|
|
1063
|
+
`<form role="search">` that works without JavaScript — Enter loads `action?name=query` — with
|
|
1064
|
+
grouped suggestions in a raised panel (`shadow-2`) as wide as the field. It is a combobox: ↑/↓ move
|
|
1065
|
+
through every group (`aria-activedescendant`), Enter opens the active suggestion or submits the
|
|
1066
|
+
query, Escape closes the panel and then clears the field, a press outside or leaving it closes.
|
|
1067
|
+
Group labels use the label text style; the matched part of each label is set in semibold
|
|
1068
|
+
(`highlight`, the typed query by default; Turkish case rules). The component does not fetch: the
|
|
1069
|
+
app answers `onQueryChange` (debounced by `debounceMs`) with `groups` and `isLoading`.
|
|
1070
|
+
|
|
1071
|
+
```tsx
|
|
1072
|
+
<SearchField
|
|
1073
|
+
label="Parça ara"
|
|
1074
|
+
action="/arama"
|
|
1075
|
+
placeholder="Parça no, ürün, kategori, araç tipi"
|
|
1076
|
+
defaultQuery={q}
|
|
1077
|
+
onQueryChange={setQuery}
|
|
1078
|
+
debounceMs={200}
|
|
1079
|
+
groups={[
|
|
1080
|
+
{
|
|
1081
|
+
id: 'numbers',
|
|
1082
|
+
label: 'Parça numaraları',
|
|
1083
|
+
items: [
|
|
1084
|
+
{ id: '1', label: '428959612', description: 'Ön far (sol)', href: '/parca/on-far-sol' },
|
|
1085
|
+
],
|
|
1086
|
+
},
|
|
1087
|
+
{ id: 'products', label: 'Ürünler', items: products.map(toItem) },
|
|
1088
|
+
]}
|
|
1089
|
+
isLoading={isLoading}
|
|
1090
|
+
emptyMessage="Sonuç yok"
|
|
1091
|
+
footer={<TextLink href={`/arama?q=${encodeURIComponent(query)}`}>Tüm sonuçları gör</TextLink>}
|
|
1092
|
+
hasShortcut
|
|
1093
|
+
size="lg"
|
|
1094
|
+
/>
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1059
1097
|
### B2B product parts (3.8)
|
|
1060
1098
|
|
|
1061
1099
|
A parts catalogue's product in a grid, a list and a table, from the same parts — so a stock state, a
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),l=require("react"),U=require("react-bootstrap-icons"),O=require("../../helpers/class-name.helper.cjs"),ie=require("../../helpers/component.helper.cjs"),E=require("../../helpers/label.helper.cjs"),re=require("../../theme/context.cjs"),le=require("../IconButton/index.cjs"),ce=require("../Kbd/index.cjs"),oe=require("../Link/index.cjs"),de=require("../Spinner/index.cjs"),s={default:{"search":"ui-search-Abzqh","search__field":"ui-search__field-MzkYm","search__icon":"ui-search__icon-m1IlV","search__input":"ui-search__input-RgrxP","search__clear":"ui-search__clear--CN6D","search__hint":"ui-search__hint--ZH5p","search--lg":"ui-search--lg-pVRxQ","panel":"ui-panel-R34tt","panel__list":"ui-panel__list-qIxEJ","panel__state":"ui-panel__state-MCdll","panel__footer":"ui-panel__footer-ZsdOn","group":"ui-group-i-uv3","group__label":"ui-group__label-UhHAP","option":"ui-option-50fEl","option--active":"ui-option--active-v0s-d","option__media":"ui-option__media-x9T0F","option__media--image":"ui-option__media--image-RUh5j","option__text":"ui-option__text-FUX-q","option__label":"ui-option__label-ECvUx","option__description":"ui-option__description-i3O-z","option__mark":"ui-option__mark-E7qwn","srOnly":"ui-srOnly-eUiCZ"}},ue=a=>a instanceof HTMLElement&&(a.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(a.tagName)),fe=(a,g)=>{const h=g.trim().toLocaleLowerCase("tr"),o=h?a.toLocaleLowerCase("tr").indexOf(h):-1;return o<0?a:n.jsxs(n.Fragment,{children:[a.slice(0,o),n.jsx("mark",{className:s.default.option__mark,children:a.slice(o,o+h.length)}),a.slice(o+h.length)]})},me=({label:a,name:g="q",action:h,query:o,defaultQuery:b="",onQueryChange:_,debounceMs:S=0,placeholder:z,groups:B=[],highlight:H,isLoading:w=!1,emptyMessage:y,footer:q,onSelect:D,onSubmit:I,hasShortcut:j=!1,size:X="md",labels:i,id:G,className:J,testId:V})=>{const{labels:L}=re.useUi(),r=L==null?void 0:L.searchField,x=l.useId(),W=G??`${x}-input`,M=`${x}-list`,K=l.useRef(null),F=l.useRef(null),T=l.useRef(void 0),[Y,Z]=l.useState(b),[$,d]=l.useState(!1),[v,N]=l.useState(-1),p=o??Y,u=B.flatMap(e=>e.items.map(t=>({item:t,group:e}))),Q=p.trim()!=="",P=!w&&u.length===0,f=$&&Q&&(w||u.length>0||y!==void 0||q!==void 0),R=e=>`${x}-option-${e}`;l.useEffect(()=>()=>window.clearTimeout(T.current),[]),l.useEffect(()=>{if(!$)return;const e=t=>{var c;(c=K.current)!=null&&c.contains(t.target)||d(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[$]),l.useEffect(()=>{if(!j)return;const e=t=>{var k;const c=(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()==="k",m=t.key==="/"&&!t.metaKey&&!t.ctrlKey&&!ue(t.target);!c&&!m||(t.preventDefault(),(k=F.current)==null||k.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[j]);const A=e=>{o===void 0&&Z(e),N(-1),window.clearTimeout(T.current),S>0?T.current=window.setTimeout(()=>_==null?void 0:_(e),S):_==null||_(e)},ee=e=>{d(!0),A(e.target.value)},te=()=>{var e;A(""),(e=F.current)==null||e.focus()},se=e=>{var t;if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),d(!0),u.length===0)return;const c=e.key==="ArrowDown"?1:-1;N(m=>m<0&&c<0?u.length-1:(m+c+u.length)%u.length);return}if(e.key==="Enter"&&f&&v>=0){e.preventDefault(),(t=document.getElementById(R(v)))==null||t.click();return}e.key==="Escape"&&(f?(e.preventDefault(),d(!1),N(-1)):p!==""&&(e.preventDefault(),A("")))},ne=e=>{var t;(t=K.current)!=null&&t.contains(e.relatedTarget)||d(!1)},ae=H??p;let C=-1;return n.jsxs("form",{ref:K,role:"search",method:"get",action:h,className:O.cx(s.default.search,s.default[`search--${X}`],J),"data-testid":V,onSubmit:e=>I==null?void 0:I(p,e),onBlur:ne,children:[n.jsxs("div",{className:s.default.search__field,children:[n.jsx(U.Search,{"aria-hidden":!0,className:s.default.search__icon}),n.jsx("input",{ref:F,id:W,type:"search",name:g,value:p,placeholder:z,"aria-label":a,role:"combobox","aria-autocomplete":"list","aria-expanded":f,"aria-controls":f?M:void 0,"aria-activedescendant":f&&v>=0?R(v):void 0,"aria-keyshortcuts":j?"/ Control+K Meta+K":void 0,autoComplete:"off",enterKeyHint:"search",className:s.default.search__input,onChange:ee,onFocus:()=>d(!0),onClick:()=>d(!0),onKeyDown:se}),p!==""?n.jsx(le.default,{icon:n.jsx(U.XLg,{"aria-hidden":!0}),label:E.resolveLabel("SearchField.labels.clear",i==null?void 0:i.clear,r==null?void 0:r.clear),size:"sm",className:s.default.search__clear,onClick:te}):j&&n.jsx(ce.default,{keys:["/"],"aria-hidden":!0,className:s.default.search__hint})]}),n.jsx("span",{role:"status",className:s.default.srOnly,children:f&&(w?E.resolveLabel("SearchField.labels.loading",i==null?void 0:i.loading,r==null?void 0:r.loading):E.resolveFormatter("SearchField.labels.results",(i==null?void 0:i.results)??(r==null?void 0:r.results),u.length))}),f&&n.jsxs("div",{className:s.default.panel,children:[u.length>0&&n.jsx("div",{id:M,role:"listbox","aria-label":a,className:s.default.panel__list,children:B.filter(e=>e.items.length>0).map(e=>n.jsxs("div",{role:"group","aria-labelledby":`${x}-group-${e.id}`,className:s.default.group,children:[n.jsx("span",{id:`${x}-group-${e.id}`,className:s.default.group__label,children:e.label}),e.items.map(t=>{C+=1;const c=C,m=c===v;return l.createElement(oe.default,{...t.linkProps,key:t.id,id:R(c),href:t.href,role:"option","aria-selected":m,tabIndex:-1,className:O.cx(s.default.option,m&&s.default["option--active"]),onMouseDown:k=>k.preventDefault(),onMouseMove:()=>N(c),onClick:()=>{D==null||D(t,e),d(!1)}},(t.image??t.icon)&&n.jsx("span",{"aria-hidden":!0,className:O.cx(s.default.option__media,t.image!==void 0&&s.default["option__media--image"]),children:t.image??t.icon}),n.jsxs("span",{className:s.default.option__text,children:[n.jsx("span",{className:s.default.option__label,children:fe(t.label,ae)}),t.description&&n.jsx("span",{className:s.default.option__description,children:t.description})]}))})]},e.id))}),w&&n.jsxs("p",{className:s.default.panel__state,children:[n.jsx(de.default,{size:"sm",label:""}),E.resolveLabel("SearchField.labels.loading",i==null?void 0:i.loading,r==null?void 0:r.loading)]}),P&&y!==void 0&&n.jsx("p",{className:s.default.panel__state,children:y}),q!==void 0&&n.jsx("div",{className:s.default.panel__footer,children:q})]})]})},he=l.memo(ie.named(me,"SearchField"));exports.default=he;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEvent,\n type FocusEvent,\n type FormEvent,\n type KeyboardEvent,\n memo,\n type ReactNode,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { Search, XLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport type { UiLinkExtraProps } from '../../types/link.type';\nimport type { Formatter } from '../../types/theme.type';\nimport IconButton from '../IconButton';\nimport Kbd from '../Kbd';\nimport UiLink from '../Link';\nimport Spinner from '../Spinner';\n\nimport styles from './index.module.scss';\n\n/** One suggestion: a part number, a product, a category, a vehicle type. */\nexport type SearchFieldItem = {\n id: string;\n label: string;\n /** One line under the label (\"IVECO · 428959612\"). */\n description?: string;\n href: string;\n /** A small icon before the label. */\n icon?: ReactNode;\n /** A 32px thumbnail (an `<img alt=\"\">`); wins over `icon`. */\n image?: ReactNode;\n linkProps?: UiLinkExtraProps;\n};\n\n/** A titled group of suggestions (\"Parça numaraları\", \"Ürünler\", \"Kategoriler\"). */\nexport type SearchFieldGroup = {\n id: string;\n label: string;\n items: SearchFieldItem[];\n};\n\nexport type SearchFieldLabels = {\n /** The clear button (\"Aramayı temizle\"). */\n clear: string;\n /** Read and shown while suggestions load (\"Aranıyor…\"). */\n loading: string;\n /** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */\n results: Formatter<[count: number]>;\n};\n\ntype Props = {\n /** The field's accessible name (\"Parça ara\"); not shown — the placeholder and icon say it. */\n label: string;\n /** The query parameter of the GET form; default `q`. */\n name?: string;\n /** The results page the form submits to (`/arama`); the current page by default. */\n action?: string;\n /** Controlled query. */\n query?: string;\n /** Uncontrolled starting query (the `q` of the current results page). */\n defaultQuery?: string;\n /** Called as the query changes — after `debounceMs` of quiet when that is given. */\n onQueryChange?: (query: string) => void;\n /** Waits this long after the last keystroke before `onQueryChange`. Default 0 (every change). */\n debounceMs?: number;\n placeholder?: string;\n /** The suggestions; empty groups are not drawn. */\n groups?: SearchFieldGroup[];\n /** The text marked in each label; the typed query by default. */\n highlight?: string;\n isLoading?: boolean;\n /** Shown in the panel when a query has no suggestion (\"Sonuç yok\"). */\n emptyMessage?: ReactNode;\n /** Under the suggestions: \"Tüm sonuçları gör\". */\n footer?: ReactNode;\n /** A suggestion was chosen (before its link navigates). */\n onSelect?: (item: SearchFieldItem, group: SearchFieldGroup) => void;\n /**\n * The form is submitted with the typed query (Enter without a chosen suggestion). Call\n * `event.preventDefault()` to route it yourself; otherwise the browser loads `action?name=query`.\n */\n onSubmit?: (query: string, event: FormEvent<HTMLFormElement>) => void;\n /** \"/\" and Ctrl/⌘ K focus the field; a \"/\" hint shows while it is empty. */\n hasShortcut?: boolean;\n /** `md` 40px (default), `lg` 48px for a storefront header. */\n size?: 'md' | 'lg';\n labels?: Partial<SearchFieldLabels>;\n id?: string;\n className?: string;\n testId?: string;\n};\n\ntype Entry = { item: SearchFieldItem; group: SearchFieldGroup };\n\nconst isEditable = (target: EventTarget | null): boolean =>\n target instanceof HTMLElement &&\n (target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName));\n\n/** The label with the first match of `term` marked (Turkish case rules: \"i\" finds \"İ\"). */\nconst highlighted = (label: string, term: string): ReactNode => {\n const needle = term.trim().toLocaleLowerCase('tr');\n const start = needle ? label.toLocaleLowerCase('tr').indexOf(needle) : -1;\n if (start < 0) return label;\n\n return (\n <>\n {label.slice(0, start)}\n <mark className={styles.option__mark}>{label.slice(start, start + needle.length)}</mark>\n {label.slice(start + needle.length)}\n </>\n );\n};\n\n/**\n * SearchField (3.9) — a storefront's search: a search field (icon, clear button, no caret) in a\n * GET form that works without JavaScript, with grouped suggestions in a raised panel under it.\n * A combobox: ↑/↓ move through every group, Enter opens the active suggestion or submits the\n * query, Escape closes the panel and then clears the field; a press outside or leaving it closes.\n * @example\n * <SearchField label=\"Parça ara\" action=\"/arama\" placeholder=\"Parça no, ürün, araç tipi\"\n * groups={groups} isLoading={isLoading} onQueryChange={setQuery} debounceMs={200}\n * emptyMessage=\"Sonuç yok\" footer={<TextLink href={`/arama?q=${query}`}>Tüm sonuçları gör</TextLink>} hasShortcut />\n */\nconst SearchField = ({\n label,\n name = 'q',\n action,\n query: controlled,\n defaultQuery = '',\n onQueryChange,\n debounceMs = 0,\n placeholder,\n groups = [],\n highlight,\n isLoading = false,\n emptyMessage,\n footer,\n onSelect,\n onSubmit,\n hasShortcut = false,\n size = 'md',\n labels: labelProps,\n id,\n className,\n testId,\n}: Props) => {\n const { labels: config } = useUi();\n const text = config?.searchField;\n const baseId = useId();\n const inputId = id ?? `${baseId}-input`;\n const listId = `${baseId}-list`;\n const rootRef = useRef<HTMLFormElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const timerRef = useRef<number | undefined>(undefined);\n\n const [own, setOwn] = useState(defaultQuery);\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const value = controlled ?? own;\n\n const entries: Entry[] = groups.flatMap(group => group.items.map(item => ({ item, group })));\n const hasQuery = value.trim() !== '';\n const isEmpty = !isLoading && entries.length === 0;\n const isShown =\n isOpen &&\n hasQuery &&\n (isLoading || entries.length > 0 || emptyMessage !== undefined || footer !== undefined);\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n useEffect(() => () => window.clearTimeout(timerRef.current), []);\n\n /* A press outside the field and its panel closes the panel. */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: PointerEvent) => {\n if (!rootRef.current?.contains(event.target as Node)) setIsOpen(false);\n };\n document.addEventListener('pointerdown', handlePointerDown);\n\n return () => document.removeEventListener('pointerdown', handlePointerDown);\n }, [isOpen]);\n\n /* \"/\" (outside another field) and Ctrl/⌘ K bring the focus here. */\n useEffect(() => {\n if (!hasShortcut) return;\n\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n const isCommand = (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k';\n const isSlash =\n event.key === '/' && !event.metaKey && !event.ctrlKey && !isEditable(event.target);\n if (!isCommand && !isSlash) return;\n\n event.preventDefault();\n inputRef.current?.focus();\n };\n document.addEventListener('keydown', handleKeyDown);\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [hasShortcut]);\n\n const change = (next: string) => {\n if (controlled === undefined) setOwn(next);\n setActiveIndex(-1);\n window.clearTimeout(timerRef.current);\n if (debounceMs > 0)\n timerRef.current = window.setTimeout(() => onQueryChange?.(next), debounceMs);\n else onQueryChange?.(next);\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setIsOpen(true);\n change(event.target.value);\n };\n\n const clear = () => {\n change('');\n inputRef.current?.focus();\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n setIsOpen(true);\n if (entries.length === 0) return;\n const step = event.key === 'ArrowDown' ? 1 : -1;\n setActiveIndex(current =>\n current < 0 && step < 0\n ? entries.length - 1\n : (current + step + entries.length) % entries.length,\n );\n return;\n }\n\n if (event.key === 'Enter' && isShown && activeIndex >= 0) {\n /* The suggestion's own link navigates (through the app's router link, when it has one). */\n event.preventDefault();\n document.getElementById(optionId(activeIndex))?.click();\n return;\n }\n\n if (event.key === 'Escape') {\n if (isShown) {\n event.preventDefault();\n setIsOpen(false);\n setActiveIndex(-1);\n } else if (value !== '') {\n event.preventDefault();\n change('');\n }\n }\n };\n\n /* Leaving the field and its panel (Tab) closes the panel. */\n const handleBlur = (event: FocusEvent<HTMLFormElement>) => {\n if (!rootRef.current?.contains(event.relatedTarget as Node | null)) setIsOpen(false);\n };\n\n const term = highlight ?? value;\n let index = -1;\n\n return (\n <form\n ref={rootRef}\n role=\"search\"\n method=\"get\"\n action={action}\n className={cx(styles.search, styles[`search--${size}`], className)}\n data-testid={testId}\n onSubmit={event => onSubmit?.(value, event)}\n onBlur={handleBlur}\n >\n <div className={styles.search__field}>\n <Search aria-hidden className={styles.search__icon} />\n <input\n ref={inputRef}\n id={inputId}\n type=\"search\"\n name={name}\n value={value}\n placeholder={placeholder}\n aria-label={label}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={isShown}\n aria-controls={isShown ? listId : undefined}\n aria-activedescendant={isShown && activeIndex >= 0 ? optionId(activeIndex) : undefined}\n aria-keyshortcuts={hasShortcut ? '/ Control+K Meta+K' : undefined}\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n className={styles.search__input}\n onChange={handleChange}\n onFocus={() => setIsOpen(true)}\n onClick={() => setIsOpen(true)}\n onKeyDown={handleKeyDown}\n />\n {value !== '' ? (\n <IconButton\n icon={<XLg aria-hidden />}\n label={resolveLabel('SearchField.labels.clear', labelProps?.clear, text?.clear)}\n size=\"sm\"\n className={styles.search__clear}\n onClick={clear}\n />\n ) : (\n hasShortcut && <Kbd keys={['/']} aria-hidden className={styles.search__hint} />\n )}\n </div>\n\n <span role=\"status\" className={styles.srOnly}>\n {isShown &&\n (isLoading\n ? resolveLabel('SearchField.labels.loading', labelProps?.loading, text?.loading)\n : resolveFormatter(\n 'SearchField.labels.results',\n labelProps?.results ?? text?.results,\n entries.length,\n ))}\n </span>\n\n {isShown && (\n <div className={styles.panel}>\n {entries.length > 0 && (\n <div id={listId} role=\"listbox\" aria-label={label} className={styles.panel__list}>\n {groups\n .filter(group => group.items.length > 0)\n .map(group => (\n <div\n key={group.id}\n role=\"group\"\n aria-labelledby={`${baseId}-group-${group.id}`}\n className={styles.group}\n >\n <span id={`${baseId}-group-${group.id}`} className={styles.group__label}>\n {group.label}\n </span>\n {group.items.map(item => {\n index += 1;\n const position = index;\n const isActive = position === activeIndex;\n\n return (\n <UiLink\n {...item.linkProps}\n key={item.id}\n id={optionId(position)}\n href={item.href}\n role=\"option\"\n aria-selected={isActive}\n tabIndex={-1}\n className={cx(styles.option, isActive && styles['option--active'])}\n /* The focus stays in the field: the list is driven from there. */\n onMouseDown={(event: { preventDefault: () => void }) =>\n event.preventDefault()\n }\n onMouseMove={() => setActiveIndex(position)}\n onClick={() => {\n onSelect?.(item, group);\n setIsOpen(false);\n }}\n >\n {(item.image ?? item.icon) && (\n <span\n aria-hidden\n className={cx(\n styles.option__media,\n item.image !== undefined && styles['option__media--image'],\n )}\n >\n {item.image ?? item.icon}\n </span>\n )}\n <span className={styles.option__text}>\n <span className={styles.option__label}>\n {highlighted(item.label, term)}\n </span>\n {item.description && (\n <span className={styles.option__description}>{item.description}</span>\n )}\n </span>\n </UiLink>\n );\n })}\n </div>\n ))}\n </div>\n )}\n\n {isLoading && (\n <p className={styles.panel__state}>\n <Spinner size=\"sm\" label=\"\" />\n {resolveLabel('SearchField.labels.loading', labelProps?.loading, text?.loading)}\n </p>\n )}\n {isEmpty && emptyMessage !== undefined && (\n <p className={styles.panel__state}>{emptyMessage}</p>\n )}\n {footer !== undefined && <div className={styles.panel__footer}>{footer}</div>}\n </div>\n )}\n </form>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(SearchField, 'SearchField'),\n) as typeof SearchField;\n"],"names":["isEditable","target","highlighted","label","term","needle","start","jsxs","Fragment","jsx","styles","SearchField","name","action","controlled","defaultQuery","onQueryChange","debounceMs","placeholder","groups","highlight","isLoading","emptyMessage","footer","onSelect","onSubmit","hasShortcut","size","labelProps","id","className","testId","config","useUi","text","baseId","useId","inputId","listId","rootRef","useRef","inputRef","timerRef","own","setOwn","useState","isOpen","setIsOpen","activeIndex","setActiveIndex","value","entries","group","item","hasQuery","isEmpty","isShown","optionId","index","useEffect","handlePointerDown","event","_a","handleKeyDown","isCommand","isSlash","change","next","handleChange","clear","step","current","handleBlur","cx","Search","IconButton","XLg","resolveLabel","Kbd","resolveFormatter","position","isActive","createElement","UiLink","Spinner","memo","named"],"mappings":"qjBAuGMA,GAAcC,GAClBA,aAAkB,cACjBA,EAAO,mBAAqB,CAAC,QAAS,WAAY,QAAQ,EAAE,SAASA,EAAO,OAAO,GAGhFC,GAAc,CAACC,EAAeC,IAA4B,CAC9D,MAAMC,EAASD,EAAK,KAAA,EAAO,kBAAkB,IAAI,EAC3CE,EAAQD,EAASF,EAAM,kBAAkB,IAAI,EAAE,QAAQE,CAAM,EAAI,GACvE,OAAIC,EAAQ,EAAUH,EAGpBI,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAL,EAAM,MAAM,EAAGG,CAAK,EACrBG,EAAAA,IAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,aAAe,SAAAP,EAAM,MAAMG,EAAOA,EAAQD,EAAO,MAAM,CAAA,CAAE,EAChFF,EAAM,MAAMG,EAAQD,EAAO,MAAM,CAAA,EACpC,CAEJ,EAYMM,GAAc,CAAC,CACnB,MAAAR,EACA,KAAAS,EAAO,IACP,OAAAC,EACA,MAAOC,EACP,aAAAC,EAAe,GACf,cAAAC,EACA,WAAAC,EAAa,EACb,YAAAC,EACA,OAAAC,EAAS,CAAA,EACT,UAAAC,EACA,UAAAC,EAAY,GACZ,aAAAC,EACA,OAAAC,EACA,SAAAC,EACA,SAAAC,EACA,YAAAC,EAAc,GACd,KAAAC,EAAO,KACP,OAAQC,EACR,GAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,KAAM,CAAE,OAAQC,CAAA,EAAWC,SAAA,EACrBC,EAAOF,G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AAAA,KACbC,GAAAA,MAAM3E,GAAa,aAAa,CAChD"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { FormEvent, ReactNode } from 'react';
|
|
2
|
+
import { UiLinkExtraProps } from '../../types/link.type.cjs';
|
|
3
|
+
import { Formatter } from '../../types/theme.type.cjs';
|
|
4
|
+
/** One suggestion: a part number, a product, a category, a vehicle type. */
|
|
5
|
+
export type SearchFieldItem = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
/** One line under the label ("IVECO · 428959612"). */
|
|
9
|
+
description?: string;
|
|
10
|
+
href: string;
|
|
11
|
+
/** A small icon before the label. */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** A 32px thumbnail (an `<img alt="">`); wins over `icon`. */
|
|
14
|
+
image?: ReactNode;
|
|
15
|
+
linkProps?: UiLinkExtraProps;
|
|
16
|
+
};
|
|
17
|
+
/** A titled group of suggestions ("Parça numaraları", "Ürünler", "Kategoriler"). */
|
|
18
|
+
export type SearchFieldGroup = {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
items: SearchFieldItem[];
|
|
22
|
+
};
|
|
23
|
+
export type SearchFieldLabels = {
|
|
24
|
+
/** The clear button ("Aramayı temizle"). */
|
|
25
|
+
clear: string;
|
|
26
|
+
/** Read and shown while suggestions load ("Aranıyor…"). */
|
|
27
|
+
loading: string;
|
|
28
|
+
/** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */
|
|
29
|
+
results: Formatter<[count: number]>;
|
|
30
|
+
};
|
|
31
|
+
type Props = {
|
|
32
|
+
/** The field's accessible name ("Parça ara"); not shown — the placeholder and icon say it. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** The query parameter of the GET form; default `q`. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** The results page the form submits to (`/arama`); the current page by default. */
|
|
37
|
+
action?: string;
|
|
38
|
+
/** Controlled query. */
|
|
39
|
+
query?: string;
|
|
40
|
+
/** Uncontrolled starting query (the `q` of the current results page). */
|
|
41
|
+
defaultQuery?: string;
|
|
42
|
+
/** Called as the query changes — after `debounceMs` of quiet when that is given. */
|
|
43
|
+
onQueryChange?: (query: string) => void;
|
|
44
|
+
/** Waits this long after the last keystroke before `onQueryChange`. Default 0 (every change). */
|
|
45
|
+
debounceMs?: number;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
/** The suggestions; empty groups are not drawn. */
|
|
48
|
+
groups?: SearchFieldGroup[];
|
|
49
|
+
/** The text marked in each label; the typed query by default. */
|
|
50
|
+
highlight?: string;
|
|
51
|
+
isLoading?: boolean;
|
|
52
|
+
/** Shown in the panel when a query has no suggestion ("Sonuç yok"). */
|
|
53
|
+
emptyMessage?: ReactNode;
|
|
54
|
+
/** Under the suggestions: "Tüm sonuçları gör". */
|
|
55
|
+
footer?: ReactNode;
|
|
56
|
+
/** A suggestion was chosen (before its link navigates). */
|
|
57
|
+
onSelect?: (item: SearchFieldItem, group: SearchFieldGroup) => void;
|
|
58
|
+
/**
|
|
59
|
+
* The form is submitted with the typed query (Enter without a chosen suggestion). Call
|
|
60
|
+
* `event.preventDefault()` to route it yourself; otherwise the browser loads `action?name=query`.
|
|
61
|
+
*/
|
|
62
|
+
onSubmit?: (query: string, event: FormEvent<HTMLFormElement>) => void;
|
|
63
|
+
/** "/" and Ctrl/⌘ K focus the field; a "/" hint shows while it is empty. */
|
|
64
|
+
hasShortcut?: boolean;
|
|
65
|
+
/** `md` 40px (default), `lg` 48px for a storefront header. */
|
|
66
|
+
size?: 'md' | 'lg';
|
|
67
|
+
labels?: Partial<SearchFieldLabels>;
|
|
68
|
+
id?: string;
|
|
69
|
+
className?: string;
|
|
70
|
+
testId?: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* SearchField (3.9) — a storefront's search: a search field (icon, clear button, no caret) in a
|
|
74
|
+
* GET form that works without JavaScript, with grouped suggestions in a raised panel under it.
|
|
75
|
+
* A combobox: ↑/↓ move through every group, Enter opens the active suggestion or submits the
|
|
76
|
+
* query, Escape closes the panel and then clears the field; a press outside or leaving it closes.
|
|
77
|
+
* @example
|
|
78
|
+
* <SearchField label="Parça ara" action="/arama" placeholder="Parça no, ürün, araç tipi"
|
|
79
|
+
* groups={groups} isLoading={isLoading} onQueryChange={setQuery} debounceMs={200}
|
|
80
|
+
* emptyMessage="Sonuç yok" footer={<TextLink href={`/arama?q=${query}`}>Tüm sonuçları gör</TextLink>} hasShortcut />
|
|
81
|
+
*/
|
|
82
|
+
declare const SearchField: ({ label, name, action, query: controlled, defaultQuery, onQueryChange, debounceMs, placeholder, groups, highlight, isLoading, emptyMessage, footer, onSelect, onSubmit, hasShortcut, size, labels: labelProps, id, className, testId, }: Props) => import("react").JSX.Element;
|
|
83
|
+
declare const _default: typeof SearchField;
|
|
84
|
+
export default _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { FormEvent, ReactNode } from 'react';
|
|
2
|
+
import { UiLinkExtraProps } from '../../types/link.type.js';
|
|
3
|
+
import { Formatter } from '../../types/theme.type.js';
|
|
4
|
+
/** One suggestion: a part number, a product, a category, a vehicle type. */
|
|
5
|
+
export type SearchFieldItem = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
/** One line under the label ("IVECO · 428959612"). */
|
|
9
|
+
description?: string;
|
|
10
|
+
href: string;
|
|
11
|
+
/** A small icon before the label. */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** A 32px thumbnail (an `<img alt="">`); wins over `icon`. */
|
|
14
|
+
image?: ReactNode;
|
|
15
|
+
linkProps?: UiLinkExtraProps;
|
|
16
|
+
};
|
|
17
|
+
/** A titled group of suggestions ("Parça numaraları", "Ürünler", "Kategoriler"). */
|
|
18
|
+
export type SearchFieldGroup = {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
items: SearchFieldItem[];
|
|
22
|
+
};
|
|
23
|
+
export type SearchFieldLabels = {
|
|
24
|
+
/** The clear button ("Aramayı temizle"). */
|
|
25
|
+
clear: string;
|
|
26
|
+
/** Read and shown while suggestions load ("Aranıyor…"). */
|
|
27
|
+
loading: string;
|
|
28
|
+
/** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */
|
|
29
|
+
results: Formatter<[count: number]>;
|
|
30
|
+
};
|
|
31
|
+
type Props = {
|
|
32
|
+
/** The field's accessible name ("Parça ara"); not shown — the placeholder and icon say it. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** The query parameter of the GET form; default `q`. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** The results page the form submits to (`/arama`); the current page by default. */
|
|
37
|
+
action?: string;
|
|
38
|
+
/** Controlled query. */
|
|
39
|
+
query?: string;
|
|
40
|
+
/** Uncontrolled starting query (the `q` of the current results page). */
|
|
41
|
+
defaultQuery?: string;
|
|
42
|
+
/** Called as the query changes — after `debounceMs` of quiet when that is given. */
|
|
43
|
+
onQueryChange?: (query: string) => void;
|
|
44
|
+
/** Waits this long after the last keystroke before `onQueryChange`. Default 0 (every change). */
|
|
45
|
+
debounceMs?: number;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
/** The suggestions; empty groups are not drawn. */
|
|
48
|
+
groups?: SearchFieldGroup[];
|
|
49
|
+
/** The text marked in each label; the typed query by default. */
|
|
50
|
+
highlight?: string;
|
|
51
|
+
isLoading?: boolean;
|
|
52
|
+
/** Shown in the panel when a query has no suggestion ("Sonuç yok"). */
|
|
53
|
+
emptyMessage?: ReactNode;
|
|
54
|
+
/** Under the suggestions: "Tüm sonuçları gör". */
|
|
55
|
+
footer?: ReactNode;
|
|
56
|
+
/** A suggestion was chosen (before its link navigates). */
|
|
57
|
+
onSelect?: (item: SearchFieldItem, group: SearchFieldGroup) => void;
|
|
58
|
+
/**
|
|
59
|
+
* The form is submitted with the typed query (Enter without a chosen suggestion). Call
|
|
60
|
+
* `event.preventDefault()` to route it yourself; otherwise the browser loads `action?name=query`.
|
|
61
|
+
*/
|
|
62
|
+
onSubmit?: (query: string, event: FormEvent<HTMLFormElement>) => void;
|
|
63
|
+
/** "/" and Ctrl/⌘ K focus the field; a "/" hint shows while it is empty. */
|
|
64
|
+
hasShortcut?: boolean;
|
|
65
|
+
/** `md` 40px (default), `lg` 48px for a storefront header. */
|
|
66
|
+
size?: 'md' | 'lg';
|
|
67
|
+
labels?: Partial<SearchFieldLabels>;
|
|
68
|
+
id?: string;
|
|
69
|
+
className?: string;
|
|
70
|
+
testId?: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* SearchField (3.9) — a storefront's search: a search field (icon, clear button, no caret) in a
|
|
74
|
+
* GET form that works without JavaScript, with grouped suggestions in a raised panel under it.
|
|
75
|
+
* A combobox: ↑/↓ move through every group, Enter opens the active suggestion or submits the
|
|
76
|
+
* query, Escape closes the panel and then clears the field; a press outside or leaving it closes.
|
|
77
|
+
* @example
|
|
78
|
+
* <SearchField label="Parça ara" action="/arama" placeholder="Parça no, ürün, araç tipi"
|
|
79
|
+
* groups={groups} isLoading={isLoading} onQueryChange={setQuery} debounceMs={200}
|
|
80
|
+
* emptyMessage="Sonuç yok" footer={<TextLink href={`/arama?q=${query}`}>Tüm sonuçları gör</TextLink>} hasShortcut />
|
|
81
|
+
*/
|
|
82
|
+
declare const SearchField: ({ label, name, action, query: controlled, defaultQuery, onQueryChange, debounceMs, placeholder, groups, highlight, isLoading, emptyMessage, footer, onSelect, onSubmit, hasShortcut, size, labels: labelProps, id, className, testId, }: Props) => import("react").JSX.Element;
|
|
83
|
+
declare const _default: typeof SearchField;
|
|
84
|
+
export default _default;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, jsx as i, Fragment as oe } from "react/jsx-runtime";
|
|
3
|
+
import { memo as ce, useId as le, useRef as B, useState as C, useEffect as U, createElement as de } from "react";
|
|
4
|
+
import { Search as me, XLg as fe } from "react-bootstrap-icons";
|
|
5
|
+
import { cx as M } from "../../helpers/class-name.helper.js";
|
|
6
|
+
import { named as ue } from "../../helpers/component.helper.js";
|
|
7
|
+
import { resolveLabel as j, resolveFormatter as he } from "../../helpers/label.helper.js";
|
|
8
|
+
import { useUi as pe } from "../../theme/context.js";
|
|
9
|
+
import _e from "../IconButton/index.js";
|
|
10
|
+
import we from "../Kbd/index.js";
|
|
11
|
+
import ve from "../Link/index.js";
|
|
12
|
+
import Ne from "../Spinner/index.js";
|
|
13
|
+
const n = {"search":"ui-search-Abzqh","search__field":"ui-search__field-MzkYm","search__icon":"ui-search__icon-m1IlV","search__input":"ui-search__input-RgrxP","search__clear":"ui-search__clear--CN6D","search__hint":"ui-search__hint--ZH5p","search--lg":"ui-search--lg-pVRxQ","panel":"ui-panel-R34tt","panel__list":"ui-panel__list-qIxEJ","panel__state":"ui-panel__state-MCdll","panel__footer":"ui-panel__footer-ZsdOn","group":"ui-group-i-uv3","group__label":"ui-group__label-UhHAP","option":"ui-option-50fEl","option--active":"ui-option--active-v0s-d","option__media":"ui-option__media-x9T0F","option__media--image":"ui-option__media--image-RUh5j","option__text":"ui-option__text-FUX-q","option__label":"ui-option__label-ECvUx","option__description":"ui-option__description-i3O-z","option__mark":"ui-option__mark-E7qwn","srOnly":"ui-srOnly-eUiCZ"};
|
|
14
|
+
const ke = (a) => a instanceof HTMLElement && (a.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(a.tagName)), ye = (a, g) => {
|
|
15
|
+
const h = g.trim().toLocaleLowerCase("tr"), c = h ? a.toLocaleLowerCase("tr").indexOf(h) : -1;
|
|
16
|
+
return c < 0 ? a : /* @__PURE__ */ u(oe, { children: [
|
|
17
|
+
a.slice(0, c),
|
|
18
|
+
/* @__PURE__ */ i("mark", { className: n.option__mark, children: a.slice(c, c + h.length) }),
|
|
19
|
+
a.slice(c + h.length)
|
|
20
|
+
] });
|
|
21
|
+
}, Ee = ({
|
|
22
|
+
label: a,
|
|
23
|
+
name: g = "q",
|
|
24
|
+
action: h,
|
|
25
|
+
query: c,
|
|
26
|
+
defaultQuery: X = "",
|
|
27
|
+
onQueryChange: p,
|
|
28
|
+
debounceMs: q = 0,
|
|
29
|
+
placeholder: G,
|
|
30
|
+
groups: z = [],
|
|
31
|
+
highlight: J,
|
|
32
|
+
isLoading: N = !1,
|
|
33
|
+
emptyMessage: D,
|
|
34
|
+
footer: I,
|
|
35
|
+
onSelect: K,
|
|
36
|
+
onSubmit: L,
|
|
37
|
+
hasShortcut: k = !1,
|
|
38
|
+
size: V = "md",
|
|
39
|
+
labels: s,
|
|
40
|
+
id: W,
|
|
41
|
+
className: Y,
|
|
42
|
+
testId: Z
|
|
43
|
+
}) => {
|
|
44
|
+
const { labels: F } = pe(), r = F == null ? void 0 : F.searchField, w = le(), b = W ?? `${w}-input`, H = `${w}-list`, T = B(null), $ = B(null), A = B(void 0), [Q, P] = C(X), [x, l] = C(!1), [v, y] = C(-1), _ = c ?? Q, d = z.flatMap((e) => e.items.map((t) => ({ item: t, group: e }))), ee = _.trim() !== "", te = !N && d.length === 0, m = x && ee && (N || d.length > 0 || D !== void 0 || I !== void 0), O = (e) => `${w}-option-${e}`;
|
|
45
|
+
U(() => () => window.clearTimeout(A.current), []), U(() => {
|
|
46
|
+
if (!x) return;
|
|
47
|
+
const e = (t) => {
|
|
48
|
+
var o;
|
|
49
|
+
(o = T.current) != null && o.contains(t.target) || l(!1);
|
|
50
|
+
};
|
|
51
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
52
|
+
}, [x]), U(() => {
|
|
53
|
+
if (!k) return;
|
|
54
|
+
const e = (t) => {
|
|
55
|
+
var E;
|
|
56
|
+
const o = (t.metaKey || t.ctrlKey) && t.key.toLowerCase() === "k", f = t.key === "/" && !t.metaKey && !t.ctrlKey && !ke(t.target);
|
|
57
|
+
!o && !f || (t.preventDefault(), (E = $.current) == null || E.focus());
|
|
58
|
+
};
|
|
59
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
60
|
+
}, [k]);
|
|
61
|
+
const R = (e) => {
|
|
62
|
+
c === void 0 && P(e), y(-1), window.clearTimeout(A.current), q > 0 ? A.current = window.setTimeout(() => p == null ? void 0 : p(e), q) : p == null || p(e);
|
|
63
|
+
}, ne = (e) => {
|
|
64
|
+
l(!0), R(e.target.value);
|
|
65
|
+
}, ie = () => {
|
|
66
|
+
var e;
|
|
67
|
+
R(""), (e = $.current) == null || e.focus();
|
|
68
|
+
}, ae = (e) => {
|
|
69
|
+
var t;
|
|
70
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
71
|
+
if (e.preventDefault(), l(!0), d.length === 0) return;
|
|
72
|
+
const o = e.key === "ArrowDown" ? 1 : -1;
|
|
73
|
+
y(
|
|
74
|
+
(f) => f < 0 && o < 0 ? d.length - 1 : (f + o + d.length) % d.length
|
|
75
|
+
);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (e.key === "Enter" && m && v >= 0) {
|
|
79
|
+
e.preventDefault(), (t = document.getElementById(O(v))) == null || t.click();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
e.key === "Escape" && (m ? (e.preventDefault(), l(!1), y(-1)) : _ !== "" && (e.preventDefault(), R("")));
|
|
83
|
+
}, se = (e) => {
|
|
84
|
+
var t;
|
|
85
|
+
(t = T.current) != null && t.contains(e.relatedTarget) || l(!1);
|
|
86
|
+
}, re = J ?? _;
|
|
87
|
+
let S = -1;
|
|
88
|
+
return /* @__PURE__ */ u(
|
|
89
|
+
"form",
|
|
90
|
+
{
|
|
91
|
+
ref: T,
|
|
92
|
+
role: "search",
|
|
93
|
+
method: "get",
|
|
94
|
+
action: h,
|
|
95
|
+
className: M(n.search, n[`search--${V}`], Y),
|
|
96
|
+
"data-testid": Z,
|
|
97
|
+
onSubmit: (e) => L == null ? void 0 : L(_, e),
|
|
98
|
+
onBlur: se,
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ u("div", { className: n.search__field, children: [
|
|
101
|
+
/* @__PURE__ */ i(me, { "aria-hidden": !0, className: n.search__icon }),
|
|
102
|
+
/* @__PURE__ */ i(
|
|
103
|
+
"input",
|
|
104
|
+
{
|
|
105
|
+
ref: $,
|
|
106
|
+
id: b,
|
|
107
|
+
type: "search",
|
|
108
|
+
name: g,
|
|
109
|
+
value: _,
|
|
110
|
+
placeholder: G,
|
|
111
|
+
"aria-label": a,
|
|
112
|
+
role: "combobox",
|
|
113
|
+
"aria-autocomplete": "list",
|
|
114
|
+
"aria-expanded": m,
|
|
115
|
+
"aria-controls": m ? H : void 0,
|
|
116
|
+
"aria-activedescendant": m && v >= 0 ? O(v) : void 0,
|
|
117
|
+
"aria-keyshortcuts": k ? "/ Control+K Meta+K" : void 0,
|
|
118
|
+
autoComplete: "off",
|
|
119
|
+
enterKeyHint: "search",
|
|
120
|
+
className: n.search__input,
|
|
121
|
+
onChange: ne,
|
|
122
|
+
onFocus: () => l(!0),
|
|
123
|
+
onClick: () => l(!0),
|
|
124
|
+
onKeyDown: ae
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
_ !== "" ? /* @__PURE__ */ i(
|
|
128
|
+
_e,
|
|
129
|
+
{
|
|
130
|
+
icon: /* @__PURE__ */ i(fe, { "aria-hidden": !0 }),
|
|
131
|
+
label: j("SearchField.labels.clear", s == null ? void 0 : s.clear, r == null ? void 0 : r.clear),
|
|
132
|
+
size: "sm",
|
|
133
|
+
className: n.search__clear,
|
|
134
|
+
onClick: ie
|
|
135
|
+
}
|
|
136
|
+
) : k && /* @__PURE__ */ i(we, { keys: ["/"], "aria-hidden": !0, className: n.search__hint })
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ i("span", { role: "status", className: n.srOnly, children: m && (N ? j("SearchField.labels.loading", s == null ? void 0 : s.loading, r == null ? void 0 : r.loading) : he(
|
|
139
|
+
"SearchField.labels.results",
|
|
140
|
+
(s == null ? void 0 : s.results) ?? (r == null ? void 0 : r.results),
|
|
141
|
+
d.length
|
|
142
|
+
)) }),
|
|
143
|
+
m && /* @__PURE__ */ u("div", { className: n.panel, children: [
|
|
144
|
+
d.length > 0 && /* @__PURE__ */ i("div", { id: H, role: "listbox", "aria-label": a, className: n.panel__list, children: z.filter((e) => e.items.length > 0).map((e) => /* @__PURE__ */ u(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
role: "group",
|
|
148
|
+
"aria-labelledby": `${w}-group-${e.id}`,
|
|
149
|
+
className: n.group,
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ i("span", { id: `${w}-group-${e.id}`, className: n.group__label, children: e.label }),
|
|
152
|
+
e.items.map((t) => {
|
|
153
|
+
S += 1;
|
|
154
|
+
const o = S, f = o === v;
|
|
155
|
+
return /* @__PURE__ */ de(
|
|
156
|
+
ve,
|
|
157
|
+
{
|
|
158
|
+
...t.linkProps,
|
|
159
|
+
key: t.id,
|
|
160
|
+
id: O(o),
|
|
161
|
+
href: t.href,
|
|
162
|
+
role: "option",
|
|
163
|
+
"aria-selected": f,
|
|
164
|
+
tabIndex: -1,
|
|
165
|
+
className: M(n.option, f && n["option--active"]),
|
|
166
|
+
onMouseDown: (E) => E.preventDefault(),
|
|
167
|
+
onMouseMove: () => y(o),
|
|
168
|
+
onClick: () => {
|
|
169
|
+
K == null || K(t, e), l(!1);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
(t.image ?? t.icon) && /* @__PURE__ */ i(
|
|
173
|
+
"span",
|
|
174
|
+
{
|
|
175
|
+
"aria-hidden": !0,
|
|
176
|
+
className: M(
|
|
177
|
+
n.option__media,
|
|
178
|
+
t.image !== void 0 && n["option__media--image"]
|
|
179
|
+
),
|
|
180
|
+
children: t.image ?? t.icon
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ u("span", { className: n.option__text, children: [
|
|
184
|
+
/* @__PURE__ */ i("span", { className: n.option__label, children: ye(t.label, re) }),
|
|
185
|
+
t.description && /* @__PURE__ */ i("span", { className: n.option__description, children: t.description })
|
|
186
|
+
] })
|
|
187
|
+
);
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
e.id
|
|
192
|
+
)) }),
|
|
193
|
+
N && /* @__PURE__ */ u("p", { className: n.panel__state, children: [
|
|
194
|
+
/* @__PURE__ */ i(Ne, { size: "sm", label: "" }),
|
|
195
|
+
j("SearchField.labels.loading", s == null ? void 0 : s.loading, r == null ? void 0 : r.loading)
|
|
196
|
+
] }),
|
|
197
|
+
te && D !== void 0 && /* @__PURE__ */ i("p", { className: n.panel__state, children: D }),
|
|
198
|
+
I !== void 0 && /* @__PURE__ */ i("div", { className: n.panel__footer, children: I })
|
|
199
|
+
] })
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
}, Be = /* @__PURE__ */ ce(
|
|
204
|
+
/* @__PURE__ */ ue(Ee, "SearchField")
|
|
205
|
+
);
|
|
206
|
+
export {
|
|
207
|
+
Be as default
|
|
208
|
+
};
|
|
209
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ChangeEvent,\n type FocusEvent,\n type FormEvent,\n type KeyboardEvent,\n memo,\n type ReactNode,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { Search, XLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport type { UiLinkExtraProps } from '../../types/link.type';\nimport type { Formatter } from '../../types/theme.type';\nimport IconButton from '../IconButton';\nimport Kbd from '../Kbd';\nimport UiLink from '../Link';\nimport Spinner from '../Spinner';\n\nimport styles from './index.module.scss';\n\n/** One suggestion: a part number, a product, a category, a vehicle type. */\nexport type SearchFieldItem = {\n id: string;\n label: string;\n /** One line under the label (\"IVECO · 428959612\"). */\n description?: string;\n href: string;\n /** A small icon before the label. */\n icon?: ReactNode;\n /** A 32px thumbnail (an `<img alt=\"\">`); wins over `icon`. */\n image?: ReactNode;\n linkProps?: UiLinkExtraProps;\n};\n\n/** A titled group of suggestions (\"Parça numaraları\", \"Ürünler\", \"Kategoriler\"). */\nexport type SearchFieldGroup = {\n id: string;\n label: string;\n items: SearchFieldItem[];\n};\n\nexport type SearchFieldLabels = {\n /** The clear button (\"Aramayı temizle\"). */\n clear: string;\n /** Read and shown while suggestions load (\"Aranıyor…\"). */\n loading: string;\n /** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */\n results: Formatter<[count: number]>;\n};\n\ntype Props = {\n /** The field's accessible name (\"Parça ara\"); not shown — the placeholder and icon say it. */\n label: string;\n /** The query parameter of the GET form; default `q`. */\n name?: string;\n /** The results page the form submits to (`/arama`); the current page by default. */\n action?: string;\n /** Controlled query. */\n query?: string;\n /** Uncontrolled starting query (the `q` of the current results page). */\n defaultQuery?: string;\n /** Called as the query changes — after `debounceMs` of quiet when that is given. */\n onQueryChange?: (query: string) => void;\n /** Waits this long after the last keystroke before `onQueryChange`. Default 0 (every change). */\n debounceMs?: number;\n placeholder?: string;\n /** The suggestions; empty groups are not drawn. */\n groups?: SearchFieldGroup[];\n /** The text marked in each label; the typed query by default. */\n highlight?: string;\n isLoading?: boolean;\n /** Shown in the panel when a query has no suggestion (\"Sonuç yok\"). */\n emptyMessage?: ReactNode;\n /** Under the suggestions: \"Tüm sonuçları gör\". */\n footer?: ReactNode;\n /** A suggestion was chosen (before its link navigates). */\n onSelect?: (item: SearchFieldItem, group: SearchFieldGroup) => void;\n /**\n * The form is submitted with the typed query (Enter without a chosen suggestion). Call\n * `event.preventDefault()` to route it yourself; otherwise the browser loads `action?name=query`.\n */\n onSubmit?: (query: string, event: FormEvent<HTMLFormElement>) => void;\n /** \"/\" and Ctrl/⌘ K focus the field; a \"/\" hint shows while it is empty. */\n hasShortcut?: boolean;\n /** `md` 40px (default), `lg` 48px for a storefront header. */\n size?: 'md' | 'lg';\n labels?: Partial<SearchFieldLabels>;\n id?: string;\n className?: string;\n testId?: string;\n};\n\ntype Entry = { item: SearchFieldItem; group: SearchFieldGroup };\n\nconst isEditable = (target: EventTarget | null): boolean =>\n target instanceof HTMLElement &&\n (target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName));\n\n/** The label with the first match of `term` marked (Turkish case rules: \"i\" finds \"İ\"). */\nconst highlighted = (label: string, term: string): ReactNode => {\n const needle = term.trim().toLocaleLowerCase('tr');\n const start = needle ? label.toLocaleLowerCase('tr').indexOf(needle) : -1;\n if (start < 0) return label;\n\n return (\n <>\n {label.slice(0, start)}\n <mark className={styles.option__mark}>{label.slice(start, start + needle.length)}</mark>\n {label.slice(start + needle.length)}\n </>\n );\n};\n\n/**\n * SearchField (3.9) — a storefront's search: a search field (icon, clear button, no caret) in a\n * GET form that works without JavaScript, with grouped suggestions in a raised panel under it.\n * A combobox: ↑/↓ move through every group, Enter opens the active suggestion or submits the\n * query, Escape closes the panel and then clears the field; a press outside or leaving it closes.\n * @example\n * <SearchField label=\"Parça ara\" action=\"/arama\" placeholder=\"Parça no, ürün, araç tipi\"\n * groups={groups} isLoading={isLoading} onQueryChange={setQuery} debounceMs={200}\n * emptyMessage=\"Sonuç yok\" footer={<TextLink href={`/arama?q=${query}`}>Tüm sonuçları gör</TextLink>} hasShortcut />\n */\nconst SearchField = ({\n label,\n name = 'q',\n action,\n query: controlled,\n defaultQuery = '',\n onQueryChange,\n debounceMs = 0,\n placeholder,\n groups = [],\n highlight,\n isLoading = false,\n emptyMessage,\n footer,\n onSelect,\n onSubmit,\n hasShortcut = false,\n size = 'md',\n labels: labelProps,\n id,\n className,\n testId,\n}: Props) => {\n const { labels: config } = useUi();\n const text = config?.searchField;\n const baseId = useId();\n const inputId = id ?? `${baseId}-input`;\n const listId = `${baseId}-list`;\n const rootRef = useRef<HTMLFormElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const timerRef = useRef<number | undefined>(undefined);\n\n const [own, setOwn] = useState(defaultQuery);\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const value = controlled ?? own;\n\n const entries: Entry[] = groups.flatMap(group => group.items.map(item => ({ item, group })));\n const hasQuery = value.trim() !== '';\n const isEmpty = !isLoading && entries.length === 0;\n const isShown =\n isOpen &&\n hasQuery &&\n (isLoading || entries.length > 0 || emptyMessage !== undefined || footer !== undefined);\n const optionId = (index: number) => `${baseId}-option-${index}`;\n\n useEffect(() => () => window.clearTimeout(timerRef.current), []);\n\n /* A press outside the field and its panel closes the panel. */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: PointerEvent) => {\n if (!rootRef.current?.contains(event.target as Node)) setIsOpen(false);\n };\n document.addEventListener('pointerdown', handlePointerDown);\n\n return () => document.removeEventListener('pointerdown', handlePointerDown);\n }, [isOpen]);\n\n /* \"/\" (outside another field) and Ctrl/⌘ K bring the focus here. */\n useEffect(() => {\n if (!hasShortcut) return;\n\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n const isCommand = (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k';\n const isSlash =\n event.key === '/' && !event.metaKey && !event.ctrlKey && !isEditable(event.target);\n if (!isCommand && !isSlash) return;\n\n event.preventDefault();\n inputRef.current?.focus();\n };\n document.addEventListener('keydown', handleKeyDown);\n\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [hasShortcut]);\n\n const change = (next: string) => {\n if (controlled === undefined) setOwn(next);\n setActiveIndex(-1);\n window.clearTimeout(timerRef.current);\n if (debounceMs > 0)\n timerRef.current = window.setTimeout(() => onQueryChange?.(next), debounceMs);\n else onQueryChange?.(next);\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setIsOpen(true);\n change(event.target.value);\n };\n\n const clear = () => {\n change('');\n inputRef.current?.focus();\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n setIsOpen(true);\n if (entries.length === 0) return;\n const step = event.key === 'ArrowDown' ? 1 : -1;\n setActiveIndex(current =>\n current < 0 && step < 0\n ? entries.length - 1\n : (current + step + entries.length) % entries.length,\n );\n return;\n }\n\n if (event.key === 'Enter' && isShown && activeIndex >= 0) {\n /* The suggestion's own link navigates (through the app's router link, when it has one). */\n event.preventDefault();\n document.getElementById(optionId(activeIndex))?.click();\n return;\n }\n\n if (event.key === 'Escape') {\n if (isShown) {\n event.preventDefault();\n setIsOpen(false);\n setActiveIndex(-1);\n } else if (value !== '') {\n event.preventDefault();\n change('');\n }\n }\n };\n\n /* Leaving the field and its panel (Tab) closes the panel. */\n const handleBlur = (event: FocusEvent<HTMLFormElement>) => {\n if (!rootRef.current?.contains(event.relatedTarget as Node | null)) setIsOpen(false);\n };\n\n const term = highlight ?? value;\n let index = -1;\n\n return (\n <form\n ref={rootRef}\n role=\"search\"\n method=\"get\"\n action={action}\n className={cx(styles.search, styles[`search--${size}`], className)}\n data-testid={testId}\n onSubmit={event => onSubmit?.(value, event)}\n onBlur={handleBlur}\n >\n <div className={styles.search__field}>\n <Search aria-hidden className={styles.search__icon} />\n <input\n ref={inputRef}\n id={inputId}\n type=\"search\"\n name={name}\n value={value}\n placeholder={placeholder}\n aria-label={label}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={isShown}\n aria-controls={isShown ? listId : undefined}\n aria-activedescendant={isShown && activeIndex >= 0 ? optionId(activeIndex) : undefined}\n aria-keyshortcuts={hasShortcut ? '/ Control+K Meta+K' : undefined}\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n className={styles.search__input}\n onChange={handleChange}\n onFocus={() => setIsOpen(true)}\n onClick={() => setIsOpen(true)}\n onKeyDown={handleKeyDown}\n />\n {value !== '' ? (\n <IconButton\n icon={<XLg aria-hidden />}\n label={resolveLabel('SearchField.labels.clear', labelProps?.clear, text?.clear)}\n size=\"sm\"\n className={styles.search__clear}\n onClick={clear}\n />\n ) : (\n hasShortcut && <Kbd keys={['/']} aria-hidden className={styles.search__hint} />\n )}\n </div>\n\n <span role=\"status\" className={styles.srOnly}>\n {isShown &&\n (isLoading\n ? resolveLabel('SearchField.labels.loading', labelProps?.loading, text?.loading)\n : resolveFormatter(\n 'SearchField.labels.results',\n labelProps?.results ?? text?.results,\n entries.length,\n ))}\n </span>\n\n {isShown && (\n <div className={styles.panel}>\n {entries.length > 0 && (\n <div id={listId} role=\"listbox\" aria-label={label} className={styles.panel__list}>\n {groups\n .filter(group => group.items.length > 0)\n .map(group => (\n <div\n key={group.id}\n role=\"group\"\n aria-labelledby={`${baseId}-group-${group.id}`}\n className={styles.group}\n >\n <span id={`${baseId}-group-${group.id}`} className={styles.group__label}>\n {group.label}\n </span>\n {group.items.map(item => {\n index += 1;\n const position = index;\n const isActive = position === activeIndex;\n\n return (\n <UiLink\n {...item.linkProps}\n key={item.id}\n id={optionId(position)}\n href={item.href}\n role=\"option\"\n aria-selected={isActive}\n tabIndex={-1}\n className={cx(styles.option, isActive && styles['option--active'])}\n /* The focus stays in the field: the list is driven from there. */\n onMouseDown={(event: { preventDefault: () => void }) =>\n event.preventDefault()\n }\n onMouseMove={() => setActiveIndex(position)}\n onClick={() => {\n onSelect?.(item, group);\n setIsOpen(false);\n }}\n >\n {(item.image ?? item.icon) && (\n <span\n aria-hidden\n className={cx(\n styles.option__media,\n item.image !== undefined && styles['option__media--image'],\n )}\n >\n {item.image ?? item.icon}\n </span>\n )}\n <span className={styles.option__text}>\n <span className={styles.option__label}>\n {highlighted(item.label, term)}\n </span>\n {item.description && (\n <span className={styles.option__description}>{item.description}</span>\n )}\n </span>\n </UiLink>\n );\n })}\n </div>\n ))}\n </div>\n )}\n\n {isLoading && (\n <p className={styles.panel__state}>\n <Spinner size=\"sm\" label=\"\" />\n {resolveLabel('SearchField.labels.loading', labelProps?.loading, text?.loading)}\n </p>\n )}\n {isEmpty && emptyMessage !== undefined && (\n <p className={styles.panel__state}>{emptyMessage}</p>\n )}\n {footer !== undefined && <div className={styles.panel__footer}>{footer}</div>}\n </div>\n )}\n </form>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(SearchField, 'SearchField'),\n) as typeof SearchField;\n"],"names":["isEditable","target","highlighted","label","term","needle","start","jsxs","Fragment","jsx","styles","SearchField","name","action","controlled","defaultQuery","onQueryChange","debounceMs","placeholder","groups","highlight","isLoading","emptyMessage","footer","onSelect","onSubmit","hasShortcut","size","labelProps","id","className","testId","config","useUi","text","baseId","useId","inputId","listId","rootRef","useRef","inputRef","timerRef","own","setOwn","useState","isOpen","setIsOpen","activeIndex","setActiveIndex","value","entries","group","item","hasQuery","isEmpty","isShown","optionId","index","useEffect","handlePointerDown","event","_a","handleKeyDown","isCommand","isSlash","change","next","handleChange","clear","step","current","handleBlur","cx","Search","IconButton","XLg","resolveLabel","Kbd","resolveFormatter","position","isActive","createElement","UiLink","Spinner","memo","named"],"mappings":";;;;;;;;;;;;;AAuGA,MAAMA,KAAa,CAACC,MAClBA,aAAkB,gBACjBA,EAAO,qBAAqB,CAAC,SAAS,YAAY,QAAQ,EAAE,SAASA,EAAO,OAAO,IAGhFC,KAAc,CAACC,GAAeC,MAA4B;AAC9D,QAAMC,IAASD,EAAK,KAAA,EAAO,kBAAkB,IAAI,GAC3CE,IAAQD,IAASF,EAAM,kBAAkB,IAAI,EAAE,QAAQE,CAAM,IAAI;AACvE,SAAIC,IAAQ,IAAUH,IAGpB,gBAAAI,EAAAC,IAAA,EACG,UAAA;AAAA,IAAAL,EAAM,MAAM,GAAGG,CAAK;AAAA,IACrB,gBAAAG,EAAC,QAAA,EAAK,WAAWC,EAAO,cAAe,UAAAP,EAAM,MAAMG,GAAOA,IAAQD,EAAO,MAAM,EAAA,CAAE;AAAA,IAChFF,EAAM,MAAMG,IAAQD,EAAO,MAAM;AAAA,EAAA,GACpC;AAEJ,GAYMM,KAAc,CAA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-0,0 +1 @@
|
|
|
1
|
+
@layer ui{.ui-search-Abzqh{position:relative;width:100%;min-width:0;margin:0}.ui-search__field-MzkYm{position:relative;display:flex;align-items:center}.ui-search__icon-m1IlV{position:absolute;inset-inline-start:var(--hd-space-3);font-size:18px;color:var(--hd-text-2);pointer-events:none}.ui-search__input-RgrxP{width:100%;font-family:var(--hd-font-body);font-size:var(--hd-type-body-size);line-height:var(--hd-type-h4-line-height);color:var(--hd-text);background-color:var(--hd-bg-surface);border:1px solid var(--hd-border-control);border-radius:var(--hd-radius-sm);padding:var(--hd-space-2) var(--hd-space-3);min-height:40px}@media (max-width: 640px){.ui-search__input-RgrxP{min-height:44px;font-size:max(16px,var(--hd-type-body-size))}}@media (hover: none) and (pointer: coarse){.ui-search__input-RgrxP{min-height:44px;font-size:max(16px,var(--hd-type-body-size))}}.ui-search__input-RgrxP{transition:border-color var(--hd-duration-fast) var(--hd-ease-standard),box-shadow var(--hd-duration-fast) var(--hd-ease-standard)}.ui-search__input-RgrxP::placeholder{color:var(--ui-placeholder, var(--hd-text-3))}.ui-search__input-RgrxP:hover:not(:disabled):not([aria-invalid=true]){border-color:color-mix(in oklab,var(--hd-border-control),var(--hd-text) 40%)}.ui-search__input-RgrxP:focus{outline:none;border-color:var(--ui-ring-color, var(--hd-focus));box-shadow:0 0 0 3px color-mix(in srgb,var(--hd-focus) 32%,transparent)}.ui-search__input-RgrxP:disabled{background-color:var(--hd-bg-raised);border-color:var(--hd-border);cursor:not-allowed;color:var(--hd-text-3)}@media (forced-colors: active){.ui-search__input-RgrxP:disabled{color:GrayText;border-color:GrayText}}.ui-search__input-RgrxP[aria-invalid=true]{border-color:var(--hd-danger-solid)}.ui-search__input-RgrxP[aria-invalid=true]:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--hd-danger-solid) 28%,transparent)}@media (prefers-reduced-motion: reduce){.ui-search__input-RgrxP{transition:none}}.ui-search__input-RgrxP{padding-inline:calc(var(--hd-space-3) + 18px + var(--hd-space-2)) calc(var(--hd-space-2) + 32px);-webkit-appearance:none;-moz-appearance:none;appearance:none}.ui-search__input-RgrxP::-webkit-search-cancel-button,.ui-search__input-RgrxP::-webkit-search-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}.ui-search__clear--CN6D,.ui-search__hint--ZH5p{position:absolute;inset-inline-end:var(--hd-space-2)}.ui-search__field-MzkYm:focus-within .ui-search__hint--ZH5p{display:none}.ui-search--lg-pVRxQ .ui-search__input-RgrxP{min-height:48px;font-size:max(16px,var(--hd-type-body-size))}.ui-panel-R34tt{position:absolute;inset-inline-start:0;top:calc(100% + var(--hd-space-1));z-index:var(--hd-z-dropdown);width:100%;min-width:min(20rem,100vw - 32px);max-height:min(70vh,30rem);overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-overlay);box-shadow:var(--hd-shadow-2);animation:var(--ui-anim-fade-in-down) var(--hd-duration-fast) var(--hd-ease-enter);scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-panel-R34tt::-webkit-scrollbar{width:8px;height:8px}.ui-panel-R34tt::-webkit-scrollbar-track{background:transparent}.ui-panel-R34tt::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-panel-R34tt::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}@media (prefers-reduced-motion: reduce){.ui-panel-R34tt{animation:none}}.ui-panel__list-qIxEJ{display:flex;flex-direction:column;gap:var(--hd-space-2);padding:var(--hd-space-2)}.ui-panel__state-MCdll{display:flex;align-items:center;gap:var(--hd-space-2);margin:0;padding:var(--hd-space-3) var(--hd-space-4);font-size:var(--hd-type-small-size);color:var(--hd-text-2)}.ui-panel__footer-ZsdOn{padding:var(--hd-space-3) var(--hd-space-4);border-block-start:1px solid var(--hd-border);font-size:var(--hd-type-small-size)}.ui-group-i-uv3{display:flex;flex-direction:column;gap:2px}.ui-group__label-UhHAP{font-family:var(--ui-overline-font, var(--hd-font-body));font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);line-height:var(--hd-type-h4-line-height);letter-spacing:var(--ui-overline-tracking, normal);text-transform:var(--ui-overline-transform, none);color:var(--hd-text-2);padding:var(--hd-space-1) var(--hd-space-2);font-size:var(--hd-type-caption-size)}.ui-option-50fEl{display:flex;align-items:center;gap:var(--hd-space-3);min-height:40px;padding:var(--hd-space-2);border-radius:var(--hd-radius-sm);color:var(--hd-text);font-size:var(--hd-type-small-size);text-decoration:none;cursor:pointer}.ui-option--active-v0s-d{background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-option__media-x9T0F{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;color:var(--hd-text-2);font-size:16px}.ui-option__media--image-RUh5j{width:32px;height:32px;overflow:hidden;border-radius:var(--hd-radius-xs);background-color:var(--hd-bg-raised)}.ui-option__media--image-RUh5j>img{width:100%;height:100%;object-fit:contain}.ui-option__text-FUX-q{display:flex;flex:1;flex-direction:column;min-width:0}.ui-option__label-ECvUx,.ui-option__description-i3O-z{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;display:block}.ui-option__description-i3O-z{font-size:var(--hd-type-caption-size);color:var(--hd-text-2)}.ui-option__mark-E7qwn{background:none;color:inherit;font-weight:var(--hd-font-weight-semibold)}@media (forced-colors: active){.ui-option--active-v0s-d{forced-color-adjust:none;background-color:Highlight;color:HighlightText}}.ui-srOnly-eUiCZ{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
|
package/build/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./theme/UiProvider.cjs"),q=require("./theme/UiThemeScript.cjs"),T=require("./theme/context.cjs"),n=require("@handijitcom/ui/design"),S=require("./helpers/focus.helper.cjs"),C=require("./hooks/useAnnounce.cjs"),E=require("./hooks/useUiTheme.cjs"),P=require("./hooks/useUiTokens.cjs"),B=require("./hooks/useStickToBottom.cjs"),b=require("./hooks/useListboxNavigation.cjs"),A=require("./hooks/usePositioning.cjs"),I=require("./hooks/useVirtualList.cjs"),R=require("./enums/ui-variant.enum.cjs"),g=require("./enums/ui-size.enum.cjs"),e=require("./constants/breakpoint.constants.cjs"),a=require("./helpers/text.helper.cjs"),y=require("./components/Button/index.cjs"),h=require("./components/IconButton/index.cjs"),M=require("./components/TextLink/index.cjs"),D=require("./components/Tooltip/index.cjs"),c=require("./components/Menu/index.cjs"),O=require("./components/Popover/index.cjs"),k=require("./components/Chip/index.cjs"),F=require("./components/ChipGroup/index.cjs"),L=require("./components/Combobox/index.cjs"),U=require("./components/SegmentedControl/index.cjs"),H=require("./components/Select/index.cjs"),v=require("./components/Checkbox/index.cjs"),N=require("./components/Switch/index.cjs"),w=require("./components/Radio/index.cjs"),G=require("./components/RadioCard/index.cjs"),K=require("./components/RangeSlider/index.cjs"),Q=require("./components/RatingInput/index.cjs"),V=require("./components/QuantityStepper/index.cjs"),Y=require("./components/TableCheckbox/index.cjs"),j=require("./components/Input/index.cjs"),z=require("./components/PasswordInput/index.cjs"),J=require("./components/ScaledInput/index.cjs"),W=require("./components/MoneyInput/index.cjs"),X=require("./components/QuantityInput/index.cjs"),Z=require("./components/RateInput/index.cjs"),$=require("./components/PercentInput/index.cjs"),ee=require("./components/TagInput/index.cjs"),te=require("./components/Textarea/index.cjs"),d=require("./components/DateField/index.cjs"),ne=require("./components/Field/index.cjs"),oe=require("./components/FileUpload/index.cjs"),re=require("./components/Heading/index.cjs"),ie=require("./components/Text/index.cjs"),ue=require("./components/Alert/index.cjs"),ae=require("./components/Avatar/index.cjs"),ce=require("./components/Badge/index.cjs"),de=require("./components/Breadcrumb/index.cjs"),t=require("./components/Card/index.cjs"),se=require("./components/Carousel/index.cjs"),le=require("./components/CodeBadge/index.cjs"),_e=require("./components/Kbd/index.cjs"),pe=require("./components/StatusDot/index.cjs"),me=require("./components/CopyField/index.cjs"),fe=require("./components/Divider/index.cjs"),o=require("./components/Directory/index.cjs"),xe=require("./components/EmptyState/index.cjs"),qe=require("./components/PageHeader/index.cjs"),i=require("./components/Panel/index.cjs"),Te=require("./components/Price/index.cjs"),Se=require("./components/Rating/index.cjs"),Ce=require("./components/SectionHeader/index.cjs"),Ee=require("./components/ScrollArea/index.cjs"),r=require("./components/Skeleton/index.cjs"),Pe=require("./components/Stat/index.cjs"),Be=require("./components/StatCard/index.cjs"),be=require("./components/SummaryCard/index.cjs"),Ae=require("./components/TotalsList/index.cjs"),s=require("./components/Progress/index.cjs"),Ie=require("./components/Spinner/index.cjs"),l=require("./components/Toast/index.cjs"),Re=require("./components/ToastPortal/index.cjs"),ge=require("./components/Accordion/index.cjs"),ye=require("./components/Disclosure/index.cjs"),he=require("./components/Steps/index.cjs"),Me=require("./components/Tabs/index.cjs"),De=require("./components/Tile/index.cjs"),Oe=require("./components/Timeline/index.cjs"),ke=require("./components/AddToCart/index.cjs"),Fe=require("./components/PartNumberList/index.cjs"),Le=require("./components/ProductCard/index.cjs"),Ue=require("./components/ProductRow/index.cjs"),He=require("./components/SpecTable/index.cjs"),ve=require("./components/StatusCell/index.cjs"),Ne=require("./components/StockStatus/index.cjs"),we=require("./components/VehicleTypeList/index.cjs"),_=require("./components/BrandSurface/index.cjs"),Ge=require("./components/Eyebrow/index.cjs"),Ke=require("./components/StatStrip/index.cjs"),Qe=require("./components/BottomSheet/index.cjs"),Ve=require("./components/Modal/index.cjs"),Ye=require("./components/CommandPalette/index.cjs"),je=require("./components/ConfirmDialog/index.cjs"),ze=require("./components/Drawer/index.cjs"),Je=require("./components/PromptDialog/index.cjs"),p=require("./components/Table/index.cjs"),m=require("./components/DataTable/index.cjs"),We=require("./components/DataTableColumnMenu/index.cjs"),Xe=require("./components/Gallery/index.cjs"),Ze=require("./components/TreeSelect/index.cjs"),$e=require("./components/NotificationCenter/index.cjs"),et=require("./components/BulkPasteInput/index.cjs"),tt=require("./helpers/bulk-paste.helper.cjs"),nt=require("./components/AppShell/index.cjs"),ot=require("./components/UserMenu/index.cjs"),f=require("./components/FilterBar/index.cjs"),rt=require("./components/Pagination/index.cjs"),it=require("./components/FacetSidebar/index.cjs"),ut=require("./components/FacetSection/index.cjs"),at=require("./components/AppliedFilters/index.cjs"),ct=require("./components/FilterToolbar/index.cjs"),dt=require("./components/SortableList/index.cjs"),st=require("./components/CodeText/index.cjs"),lt=require("./components/BrandLockup/index.cjs"),_t=require("./components/StickyActionBar/index.cjs"),pt=require("./components/CompareTray/index.cjs"),mt=require("./components/ProductCarousel/index.cjs"),ft=require("./components/MegaMenu/index.cjs"),xt=require("./components/ProductRow/columns.cjs"),u=require("./components/AppShell/Nav.cjs");exports.UiProvider=x.default;exports.UiThemeScript=q.default;exports.useUi=T.useUi;Object.defineProperty(exports,"THEME_ATTRIBUTE",{enumerable:!0,get:()=>n.THEME_ATTRIBUTE});Object.defineProperty(exports,"THEME_BOOT_SCRIPT",{enumerable:!0,get:()=>n.THEME_BOOT_SCRIPT});Object.defineProperty(exports,"THEME_BOOT_SCRIPT_HASH",{enumerable:!0,get:()=>n.THEME_BOOT_SCRIPT_HASH});Object.defineProperty(exports,"THEME_STORAGE_KEY",{enumerable:!0,get:()=>n.THEME_STORAGE_KEY});exports.hasOpenSurface=S.hasOpenSurface;exports.useAnnounce=C.default;exports.useUiTheme=E.default;exports.useUiTokens=P.default;exports.useStickToBottom=B.default;exports.useListboxNavigation=b.default;exports.usePositioning=A.default;exports.useVirtualList=I.default;exports.UIVariant=R.default;exports.UISize=g.default;exports.ABOVE_MOBILE_MEDIA_QUERY=e.ABOVE_MOBILE_MEDIA_QUERY;exports.ABOVE_TABLET_MEDIA_QUERY=e.ABOVE_TABLET_MEDIA_QUERY;exports.MOBILE_BREAKPOINT=e.MOBILE_BREAKPOINT;exports.SHEET_MEDIA_QUERY=e.SHEET_MEDIA_QUERY;exports.TABLET_BREAKPOINT=e.TABLET_BREAKPOINT;exports.TABLET_PORTRAIT_BREAKPOINT=e.TABLET_PORTRAIT_BREAKPOINT;exports.matchesSearch=a.matchesSearch;exports.normalizeSearchTerm=a.normalizeSearchTerm;exports.Button=y.default;exports.IconButton=h.default;exports.TextLink=M.default;exports.Tooltip=D.default;exports.ContextMenu=c.ContextMenu;exports.Menu=c.default;exports.Popover=O.default;exports.Chip=k.default;exports.ChipGroup=F.default;exports.Combobox=L.default;exports.SegmentedControl=U.default;exports.Select=H.default;exports.Checkbox=v.default;exports.Switch=N.default;exports.Radio=w.default;exports.RadioCard=G.default;exports.RangeSlider=K.default;exports.RatingInput=Q.default;exports.QuantityStepper=V.default;exports.TableCheckbox=Y.default;exports.Input=j.default;exports.PasswordInput=z.default;exports.ScaledInput=J.default;exports.MoneyInput=W.default;exports.QuantityInput=X.default;exports.RateInput=Z.default;exports.PercentInput=$.default;exports.TagInput=ee.default;exports.Textarea=te.default;exports.DateField=d.default;exports.DateRange=d.DateRange;exports.Field=ne.default;exports.FileUpload=oe.default;exports.Heading=re.default;exports.Text=ie.default;exports.Alert=ue.default;exports.Avatar=ae.default;exports.Badge=ce.default;exports.Breadcrumb=de.default;exports.Card=t.default;exports.CardBody=t.CardBody;exports.CardFooter=t.CardFooter;exports.CardMedia=t.CardMedia;exports.CardOverlay=t.CardOverlay;exports.Carousel=se.default;exports.CodeBadge=le.default;exports.Kbd=_e.default;exports.StatusDot=pe.default;exports.CopyField=me.default;exports.Divider=fe.default;exports.Directory=o.default;exports.DirectoryGroup=o.DirectoryGroup;exports.DirectoryJump=o.DirectoryJump;exports.DirectoryRow=o.DirectoryRow;exports.EmptyState=xe.default;exports.PageHeader=qe.default;exports.Panel=i.default;exports.PanelForm=i.PanelForm;exports.PanelRow=i.PanelRow;exports.Price=Te.default;exports.Rating=Se.default;exports.SectionHeader=Ce.default;exports.ScrollArea=Ee.default;exports.Skeleton=r.default;exports.SkeletonCard=r.SkeletonCard;exports.SkeletonRows=r.SkeletonRows;exports.SkeletonTable=r.SkeletonTable;exports.Stat=Pe.default;exports.StatCard=Be.default;exports.SummaryCard=be.default;exports.TotalsList=Ae.default;exports.Progress=s.default;exports.ProgressCircle=s.ProgressCircle;exports.Spinner=Ie.default;exports.ToastHub=l.default;exports.toast=l.toast;exports.ToastPortal=Re.default;exports.Accordion=ge.default;exports.Disclosure=ye.default;exports.Steps=he.default;exports.Tabs=Me.default;exports.Tile=De.default;exports.Timeline=Oe.default;exports.AddToCart=ke.default;exports.PartNumberList=Fe.default;exports.ProductCard=Le.default;exports.ProductRow=Ue.default;exports.SpecTable=He.default;exports.StatusCell=ve.default;exports.StockStatus=Ne.default;exports.VehicleTypeList=we.default;exports.BrandBlueprint=_.BrandBlueprint;exports.BrandSurface=_.default;exports.Eyebrow=Ge.default;exports.StatStrip=Ke.default;exports.BottomSheet=Qe.default;exports.Modal=Ve.default;exports.CommandPalette=Ye.default;exports.ConfirmDialog=je.default;exports.Drawer=ze.default;exports.PromptDialog=Je.default;exports.Table=p.default;exports.TableScroller=p.TableScroller;exports.DataTable=m.default;exports.DataTableRow=m.DataTableRow;exports.DataTableColumnMenu=We.default;exports.Gallery=Xe.default;exports.TreeSelect=Ze.default;exports.NotificationCenter=$e.default;exports.BulkPasteInput=et.default;exports.parseBulkPaste=tt.parseBulkPaste;exports.AppShell=nt.default;exports.UserMenu=ot.default;exports.FilterBar=f.default;exports.FilterBarField=f.FilterBarField;exports.Pagination=rt.default;exports.FacetSidebar=it.default;exports.FacetSection=ut.default;exports.AppliedFilters=at.default;exports.FilterToolbar=ct.default;exports.SortableList=dt.default;exports.CodeText=st.default;exports.BrandLockup=lt.default;exports.StickyActionBar=_t.default;exports.CompareTray=pt.default;exports.ProductCarousel=mt.default;exports.MegaMenu=ft.default;exports.productColumns=xt.default;exports.AppShellNav=u.AppShellNav;exports.AppShellNavGroup=u.AppShellNavGroup;exports.AppShellNavItem=u.AppShellNavItem;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./theme/UiProvider.cjs"),q=require("./theme/UiThemeScript.cjs"),T=require("./theme/context.cjs"),n=require("@handijitcom/ui/design"),S=require("./helpers/focus.helper.cjs"),C=require("./hooks/useAnnounce.cjs"),E=require("./hooks/useUiTheme.cjs"),P=require("./hooks/useUiTokens.cjs"),B=require("./hooks/useStickToBottom.cjs"),b=require("./hooks/useListboxNavigation.cjs"),A=require("./hooks/usePositioning.cjs"),I=require("./hooks/useVirtualList.cjs"),R=require("./enums/ui-variant.enum.cjs"),g=require("./enums/ui-size.enum.cjs"),e=require("./constants/breakpoint.constants.cjs"),a=require("./helpers/text.helper.cjs"),y=require("./components/Button/index.cjs"),h=require("./components/IconButton/index.cjs"),M=require("./components/TextLink/index.cjs"),D=require("./components/Tooltip/index.cjs"),c=require("./components/Menu/index.cjs"),O=require("./components/Popover/index.cjs"),k=require("./components/Chip/index.cjs"),F=require("./components/ChipGroup/index.cjs"),L=require("./components/Combobox/index.cjs"),U=require("./components/SegmentedControl/index.cjs"),H=require("./components/Select/index.cjs"),v=require("./components/Checkbox/index.cjs"),N=require("./components/Switch/index.cjs"),w=require("./components/Radio/index.cjs"),G=require("./components/RadioCard/index.cjs"),K=require("./components/RangeSlider/index.cjs"),Q=require("./components/RatingInput/index.cjs"),V=require("./components/QuantityStepper/index.cjs"),Y=require("./components/TableCheckbox/index.cjs"),j=require("./components/Input/index.cjs"),z=require("./components/PasswordInput/index.cjs"),J=require("./components/ScaledInput/index.cjs"),W=require("./components/MoneyInput/index.cjs"),X=require("./components/QuantityInput/index.cjs"),Z=require("./components/RateInput/index.cjs"),$=require("./components/PercentInput/index.cjs"),ee=require("./components/TagInput/index.cjs"),te=require("./components/Textarea/index.cjs"),d=require("./components/DateField/index.cjs"),ne=require("./components/Field/index.cjs"),oe=require("./components/FileUpload/index.cjs"),re=require("./components/Heading/index.cjs"),ie=require("./components/Text/index.cjs"),ue=require("./components/Alert/index.cjs"),ae=require("./components/Avatar/index.cjs"),ce=require("./components/Badge/index.cjs"),de=require("./components/Breadcrumb/index.cjs"),t=require("./components/Card/index.cjs"),se=require("./components/Carousel/index.cjs"),le=require("./components/CodeBadge/index.cjs"),_e=require("./components/Kbd/index.cjs"),pe=require("./components/StatusDot/index.cjs"),me=require("./components/CopyField/index.cjs"),fe=require("./components/Divider/index.cjs"),o=require("./components/Directory/index.cjs"),xe=require("./components/EmptyState/index.cjs"),qe=require("./components/PageHeader/index.cjs"),i=require("./components/Panel/index.cjs"),Te=require("./components/Price/index.cjs"),Se=require("./components/Rating/index.cjs"),Ce=require("./components/SectionHeader/index.cjs"),Ee=require("./components/ScrollArea/index.cjs"),r=require("./components/Skeleton/index.cjs"),Pe=require("./components/Stat/index.cjs"),Be=require("./components/StatCard/index.cjs"),be=require("./components/SummaryCard/index.cjs"),Ae=require("./components/TotalsList/index.cjs"),s=require("./components/Progress/index.cjs"),Ie=require("./components/Spinner/index.cjs"),l=require("./components/Toast/index.cjs"),Re=require("./components/ToastPortal/index.cjs"),ge=require("./components/Accordion/index.cjs"),ye=require("./components/Disclosure/index.cjs"),he=require("./components/Steps/index.cjs"),Me=require("./components/Tabs/index.cjs"),De=require("./components/Tile/index.cjs"),Oe=require("./components/Timeline/index.cjs"),ke=require("./components/AddToCart/index.cjs"),Fe=require("./components/PartNumberList/index.cjs"),Le=require("./components/ProductCard/index.cjs"),Ue=require("./components/ProductRow/index.cjs"),He=require("./components/SearchField/index.cjs"),ve=require("./components/SpecTable/index.cjs"),Ne=require("./components/StatusCell/index.cjs"),we=require("./components/StockStatus/index.cjs"),Ge=require("./components/VehicleTypeList/index.cjs"),_=require("./components/BrandSurface/index.cjs"),Ke=require("./components/Eyebrow/index.cjs"),Qe=require("./components/StatStrip/index.cjs"),Ve=require("./components/BottomSheet/index.cjs"),Ye=require("./components/Modal/index.cjs"),je=require("./components/CommandPalette/index.cjs"),ze=require("./components/ConfirmDialog/index.cjs"),Je=require("./components/Drawer/index.cjs"),We=require("./components/PromptDialog/index.cjs"),p=require("./components/Table/index.cjs"),m=require("./components/DataTable/index.cjs"),Xe=require("./components/DataTableColumnMenu/index.cjs"),Ze=require("./components/Gallery/index.cjs"),$e=require("./components/TreeSelect/index.cjs"),et=require("./components/NotificationCenter/index.cjs"),tt=require("./components/BulkPasteInput/index.cjs"),nt=require("./helpers/bulk-paste.helper.cjs"),ot=require("./components/AppShell/index.cjs"),rt=require("./components/UserMenu/index.cjs"),f=require("./components/FilterBar/index.cjs"),it=require("./components/Pagination/index.cjs"),ut=require("./components/FacetSidebar/index.cjs"),at=require("./components/FacetSection/index.cjs"),ct=require("./components/AppliedFilters/index.cjs"),dt=require("./components/FilterToolbar/index.cjs"),st=require("./components/SortableList/index.cjs"),lt=require("./components/CodeText/index.cjs"),_t=require("./components/BrandLockup/index.cjs"),pt=require("./components/StickyActionBar/index.cjs"),mt=require("./components/CompareTray/index.cjs"),ft=require("./components/ProductCarousel/index.cjs"),xt=require("./components/MegaMenu/index.cjs"),qt=require("./components/ProductRow/columns.cjs"),u=require("./components/AppShell/Nav.cjs");exports.UiProvider=x.default;exports.UiThemeScript=q.default;exports.useUi=T.useUi;Object.defineProperty(exports,"THEME_ATTRIBUTE",{enumerable:!0,get:()=>n.THEME_ATTRIBUTE});Object.defineProperty(exports,"THEME_BOOT_SCRIPT",{enumerable:!0,get:()=>n.THEME_BOOT_SCRIPT});Object.defineProperty(exports,"THEME_BOOT_SCRIPT_HASH",{enumerable:!0,get:()=>n.THEME_BOOT_SCRIPT_HASH});Object.defineProperty(exports,"THEME_STORAGE_KEY",{enumerable:!0,get:()=>n.THEME_STORAGE_KEY});exports.hasOpenSurface=S.hasOpenSurface;exports.useAnnounce=C.default;exports.useUiTheme=E.default;exports.useUiTokens=P.default;exports.useStickToBottom=B.default;exports.useListboxNavigation=b.default;exports.usePositioning=A.default;exports.useVirtualList=I.default;exports.UIVariant=R.default;exports.UISize=g.default;exports.ABOVE_MOBILE_MEDIA_QUERY=e.ABOVE_MOBILE_MEDIA_QUERY;exports.ABOVE_TABLET_MEDIA_QUERY=e.ABOVE_TABLET_MEDIA_QUERY;exports.MOBILE_BREAKPOINT=e.MOBILE_BREAKPOINT;exports.SHEET_MEDIA_QUERY=e.SHEET_MEDIA_QUERY;exports.TABLET_BREAKPOINT=e.TABLET_BREAKPOINT;exports.TABLET_PORTRAIT_BREAKPOINT=e.TABLET_PORTRAIT_BREAKPOINT;exports.matchesSearch=a.matchesSearch;exports.normalizeSearchTerm=a.normalizeSearchTerm;exports.Button=y.default;exports.IconButton=h.default;exports.TextLink=M.default;exports.Tooltip=D.default;exports.ContextMenu=c.ContextMenu;exports.Menu=c.default;exports.Popover=O.default;exports.Chip=k.default;exports.ChipGroup=F.default;exports.Combobox=L.default;exports.SegmentedControl=U.default;exports.Select=H.default;exports.Checkbox=v.default;exports.Switch=N.default;exports.Radio=w.default;exports.RadioCard=G.default;exports.RangeSlider=K.default;exports.RatingInput=Q.default;exports.QuantityStepper=V.default;exports.TableCheckbox=Y.default;exports.Input=j.default;exports.PasswordInput=z.default;exports.ScaledInput=J.default;exports.MoneyInput=W.default;exports.QuantityInput=X.default;exports.RateInput=Z.default;exports.PercentInput=$.default;exports.TagInput=ee.default;exports.Textarea=te.default;exports.DateField=d.default;exports.DateRange=d.DateRange;exports.Field=ne.default;exports.FileUpload=oe.default;exports.Heading=re.default;exports.Text=ie.default;exports.Alert=ue.default;exports.Avatar=ae.default;exports.Badge=ce.default;exports.Breadcrumb=de.default;exports.Card=t.default;exports.CardBody=t.CardBody;exports.CardFooter=t.CardFooter;exports.CardMedia=t.CardMedia;exports.CardOverlay=t.CardOverlay;exports.Carousel=se.default;exports.CodeBadge=le.default;exports.Kbd=_e.default;exports.StatusDot=pe.default;exports.CopyField=me.default;exports.Divider=fe.default;exports.Directory=o.default;exports.DirectoryGroup=o.DirectoryGroup;exports.DirectoryJump=o.DirectoryJump;exports.DirectoryRow=o.DirectoryRow;exports.EmptyState=xe.default;exports.PageHeader=qe.default;exports.Panel=i.default;exports.PanelForm=i.PanelForm;exports.PanelRow=i.PanelRow;exports.Price=Te.default;exports.Rating=Se.default;exports.SectionHeader=Ce.default;exports.ScrollArea=Ee.default;exports.Skeleton=r.default;exports.SkeletonCard=r.SkeletonCard;exports.SkeletonRows=r.SkeletonRows;exports.SkeletonTable=r.SkeletonTable;exports.Stat=Pe.default;exports.StatCard=Be.default;exports.SummaryCard=be.default;exports.TotalsList=Ae.default;exports.Progress=s.default;exports.ProgressCircle=s.ProgressCircle;exports.Spinner=Ie.default;exports.ToastHub=l.default;exports.toast=l.toast;exports.ToastPortal=Re.default;exports.Accordion=ge.default;exports.Disclosure=ye.default;exports.Steps=he.default;exports.Tabs=Me.default;exports.Tile=De.default;exports.Timeline=Oe.default;exports.AddToCart=ke.default;exports.PartNumberList=Fe.default;exports.ProductCard=Le.default;exports.ProductRow=Ue.default;exports.SearchField=He.default;exports.SpecTable=ve.default;exports.StatusCell=Ne.default;exports.StockStatus=we.default;exports.VehicleTypeList=Ge.default;exports.BrandBlueprint=_.BrandBlueprint;exports.BrandSurface=_.default;exports.Eyebrow=Ke.default;exports.StatStrip=Qe.default;exports.BottomSheet=Ve.default;exports.Modal=Ye.default;exports.CommandPalette=je.default;exports.ConfirmDialog=ze.default;exports.Drawer=Je.default;exports.PromptDialog=We.default;exports.Table=p.default;exports.TableScroller=p.TableScroller;exports.DataTable=m.default;exports.DataTableRow=m.DataTableRow;exports.DataTableColumnMenu=Xe.default;exports.Gallery=Ze.default;exports.TreeSelect=$e.default;exports.NotificationCenter=et.default;exports.BulkPasteInput=tt.default;exports.parseBulkPaste=nt.parseBulkPaste;exports.AppShell=ot.default;exports.UserMenu=rt.default;exports.FilterBar=f.default;exports.FilterBarField=f.FilterBarField;exports.Pagination=it.default;exports.FacetSidebar=ut.default;exports.FacetSection=at.default;exports.AppliedFilters=ct.default;exports.FilterToolbar=dt.default;exports.SortableList=st.default;exports.CodeText=lt.default;exports.BrandLockup=_t.default;exports.StickyActionBar=pt.default;exports.CompareTray=mt.default;exports.ProductCarousel=ft.default;exports.MegaMenu=xt.default;exports.productColumns=qt.default;exports.AppShellNav=u.AppShellNav;exports.AppShellNavGroup=u.AppShellNavGroup;exports.AppShellNavItem=u.AppShellNavItem;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/build/index.d.cts
CHANGED
|
@@ -91,6 +91,7 @@ export { default as AddToCart } from './components/AddToCart/index.cjs';
|
|
|
91
91
|
export { default as PartNumberList, type PartNumberItem } from './components/PartNumberList/index.cjs';
|
|
92
92
|
export { default as ProductCard } from './components/ProductCard/index.cjs';
|
|
93
93
|
export { default as ProductRow, productColumns, type ProductColumnsOptions, type ProductField, type ProductRowData, } from './components/ProductRow/index.cjs';
|
|
94
|
+
export { default as SearchField, type SearchFieldGroup, type SearchFieldItem, type SearchFieldLabels, } from './components/SearchField/index.cjs';
|
|
94
95
|
export { default as SpecTable, type SpecItem } from './components/SpecTable/index.cjs';
|
|
95
96
|
export { default as StatusCell, type StatusFlag, type StatusFlagTone, } from './components/StatusCell/index.cjs';
|
|
96
97
|
export { default as StockStatus, type StockBreakdownItem, type StockTone, } from './components/StockStatus/index.cjs';
|
package/build/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ export { default as AddToCart } from './components/AddToCart/index.js';
|
|
|
91
91
|
export { default as PartNumberList, type PartNumberItem } from './components/PartNumberList/index.js';
|
|
92
92
|
export { default as ProductCard } from './components/ProductCard/index.js';
|
|
93
93
|
export { default as ProductRow, productColumns, type ProductColumnsOptions, type ProductField, type ProductRowData, } from './components/ProductRow/index.js';
|
|
94
|
+
export { default as SearchField, type SearchFieldGroup, type SearchFieldItem, type SearchFieldLabels, } from './components/SearchField/index.js';
|
|
94
95
|
export { default as SpecTable, type SpecItem } from './components/SpecTable/index.js';
|
|
95
96
|
export { default as StatusCell, type StatusFlag, type StatusFlagTone, } from './components/StatusCell/index.js';
|
|
96
97
|
export { default as StockStatus, type StockBreakdownItem, type StockTone, } from './components/StockStatus/index.js';
|
package/build/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { default as P } from "./hooks/useStickToBottom.js";
|
|
|
10
10
|
import { default as I } from "./hooks/useListboxNavigation.js";
|
|
11
11
|
import { default as b } from "./hooks/usePositioning.js";
|
|
12
12
|
import { default as g } from "./hooks/useVirtualList.js";
|
|
13
|
-
import { default as
|
|
13
|
+
import { default as D } from "./enums/ui-variant.enum.js";
|
|
14
14
|
import { default as y } from "./enums/ui-size.enum.js";
|
|
15
15
|
import { ABOVE_MOBILE_MEDIA_QUERY as k, ABOVE_TABLET_MEDIA_QUERY as F, MOBILE_BREAKPOINT as L, SHEET_MEDIA_QUERY as U, TABLET_BREAKPOINT as H, TABLET_PORTRAIT_BREAKPOINT as v } from "./constants/breakpoint.constants.js";
|
|
16
16
|
import { matchesSearch as N, normalizeSearchTerm as G } from "./helpers/text.helper.js";
|
|
@@ -33,8 +33,8 @@ import { default as Be } from "./components/RangeSlider/index.js";
|
|
|
33
33
|
import { default as Ae } from "./components/RatingInput/index.js";
|
|
34
34
|
import { default as Re } from "./components/QuantityStepper/index.js";
|
|
35
35
|
import { default as _e } from "./components/TableCheckbox/index.js";
|
|
36
|
-
import { default as
|
|
37
|
-
import { default as
|
|
36
|
+
import { default as he } from "./components/Input/index.js";
|
|
37
|
+
import { default as Me } from "./components/PasswordInput/index.js";
|
|
38
38
|
import { default as Oe } from "./components/ScaledInput/index.js";
|
|
39
39
|
import { default as Fe } from "./components/MoneyInput/index.js";
|
|
40
40
|
import { default as Ue } from "./components/QuantityInput/index.js";
|
|
@@ -58,7 +58,7 @@ import { default as Pt } from "./components/Kbd/index.js";
|
|
|
58
58
|
import { default as It } from "./components/StatusDot/index.js";
|
|
59
59
|
import { default as bt } from "./components/CopyField/index.js";
|
|
60
60
|
import { default as gt } from "./components/Divider/index.js";
|
|
61
|
-
import { default as
|
|
61
|
+
import { default as Dt, DirectoryGroup as Mt, DirectoryJump as yt, DirectoryRow as Ot } from "./components/Directory/index.js";
|
|
62
62
|
import { default as Ft } from "./components/EmptyState/index.js";
|
|
63
63
|
import { default as Ut } from "./components/PageHeader/index.js";
|
|
64
64
|
import { default as vt, PanelForm as wt, PanelRow as Nt } from "./components/Panel/index.js";
|
|
@@ -80,68 +80,69 @@ import { default as Pa } from "./components/Disclosure/index.js";
|
|
|
80
80
|
import { default as Ia } from "./components/Steps/index.js";
|
|
81
81
|
import { default as ba } from "./components/Tabs/index.js";
|
|
82
82
|
import { default as ga } from "./components/Tile/index.js";
|
|
83
|
-
import { default as
|
|
83
|
+
import { default as Da } from "./components/Timeline/index.js";
|
|
84
84
|
import { default as ya } from "./components/AddToCart/index.js";
|
|
85
85
|
import { default as ka } from "./components/PartNumberList/index.js";
|
|
86
86
|
import { default as La } from "./components/ProductCard/index.js";
|
|
87
87
|
import { default as Ha } from "./components/ProductRow/index.js";
|
|
88
|
-
import { default as wa } from "./components/
|
|
89
|
-
import { default as Ga } from "./components/
|
|
90
|
-
import { default as Qa } from "./components/
|
|
91
|
-
import { default as Ya } from "./components/
|
|
92
|
-
import {
|
|
93
|
-
import { default as Wa } from "./components/
|
|
94
|
-
import { default as Za } from "./components/
|
|
95
|
-
import { default as er } from "./components/
|
|
96
|
-
import { default as ar } from "./components/
|
|
97
|
-
import { default as or } from "./components/
|
|
98
|
-
import { default as lr } from "./components/
|
|
99
|
-
import { default as pr } from "./components/
|
|
100
|
-
import { default as sr } from "./components/
|
|
101
|
-
import { default as xr
|
|
102
|
-
import { default as
|
|
103
|
-
import { default as Cr } from "./components/
|
|
104
|
-
import { default as Br } from "./components/
|
|
105
|
-
import { default as Ar } from "./components/
|
|
106
|
-
import { default as Rr } from "./components/
|
|
107
|
-
import { default as _r } from "./components/
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import { default as Or } from "./components/
|
|
111
|
-
import { default as Fr
|
|
112
|
-
import { default as Hr } from "./components/
|
|
113
|
-
import { default as wr } from "./components/
|
|
114
|
-
import { default as Gr } from "./components/
|
|
115
|
-
import { default as Qr } from "./components/
|
|
116
|
-
import { default as Yr } from "./components/
|
|
117
|
-
import { default as Jr } from "./components/
|
|
118
|
-
import { default as qr } from "./components/
|
|
119
|
-
import { default as Xr } from "./components/
|
|
120
|
-
import { default as $r } from "./components/
|
|
121
|
-
import { default as to } from "./components/
|
|
122
|
-
import { default as ro } from "./components/
|
|
123
|
-
import { default as fo } from "./components/
|
|
124
|
-
import { default as uo } from "./components/
|
|
125
|
-
import {
|
|
88
|
+
import { default as wa } from "./components/SearchField/index.js";
|
|
89
|
+
import { default as Ga } from "./components/SpecTable/index.js";
|
|
90
|
+
import { default as Qa } from "./components/StatusCell/index.js";
|
|
91
|
+
import { default as Ya } from "./components/StockStatus/index.js";
|
|
92
|
+
import { default as Ja } from "./components/VehicleTypeList/index.js";
|
|
93
|
+
import { BrandBlueprint as qa, default as Wa } from "./components/BrandSurface/index.js";
|
|
94
|
+
import { default as Za } from "./components/Eyebrow/index.js";
|
|
95
|
+
import { default as er } from "./components/StatStrip/index.js";
|
|
96
|
+
import { default as ar } from "./components/BottomSheet/index.js";
|
|
97
|
+
import { default as or } from "./components/Modal/index.js";
|
|
98
|
+
import { default as lr } from "./components/CommandPalette/index.js";
|
|
99
|
+
import { default as pr } from "./components/ConfirmDialog/index.js";
|
|
100
|
+
import { default as sr } from "./components/Drawer/index.js";
|
|
101
|
+
import { default as xr } from "./components/PromptDialog/index.js";
|
|
102
|
+
import { default as nr, TableScroller as Tr } from "./components/Table/index.js";
|
|
103
|
+
import { default as cr, DataTableRow as Cr } from "./components/DataTable/index.js";
|
|
104
|
+
import { default as Br } from "./components/DataTableColumnMenu/index.js";
|
|
105
|
+
import { default as Ar } from "./components/Gallery/index.js";
|
|
106
|
+
import { default as Rr } from "./components/TreeSelect/index.js";
|
|
107
|
+
import { default as _r } from "./components/NotificationCenter/index.js";
|
|
108
|
+
import { default as hr } from "./components/BulkPasteInput/index.js";
|
|
109
|
+
import { parseBulkPaste as Mr } from "./helpers/bulk-paste.helper.js";
|
|
110
|
+
import { default as Or } from "./components/AppShell/index.js";
|
|
111
|
+
import { default as Fr } from "./components/UserMenu/index.js";
|
|
112
|
+
import { default as Ur, FilterBarField as Hr } from "./components/FilterBar/index.js";
|
|
113
|
+
import { default as wr } from "./components/Pagination/index.js";
|
|
114
|
+
import { default as Gr } from "./components/FacetSidebar/index.js";
|
|
115
|
+
import { default as Qr } from "./components/FacetSection/index.js";
|
|
116
|
+
import { default as Yr } from "./components/AppliedFilters/index.js";
|
|
117
|
+
import { default as Jr } from "./components/FilterToolbar/index.js";
|
|
118
|
+
import { default as qr } from "./components/SortableList/index.js";
|
|
119
|
+
import { default as Xr } from "./components/CodeText/index.js";
|
|
120
|
+
import { default as $r } from "./components/BrandLockup/index.js";
|
|
121
|
+
import { default as to } from "./components/StickyActionBar/index.js";
|
|
122
|
+
import { default as ro } from "./components/CompareTray/index.js";
|
|
123
|
+
import { default as fo } from "./components/ProductCarousel/index.js";
|
|
124
|
+
import { default as uo } from "./components/MegaMenu/index.js";
|
|
125
|
+
import { default as so } from "./components/ProductRow/columns.js";
|
|
126
|
+
import { AppShellNav as xo, AppShellNavGroup as io, AppShellNavItem as no } from "./components/AppShell/Nav.js";
|
|
126
127
|
export {
|
|
127
128
|
k as ABOVE_MOBILE_MEDIA_QUERY,
|
|
128
129
|
F as ABOVE_TABLET_MEDIA_QUERY,
|
|
129
130
|
Ea as Accordion,
|
|
130
131
|
ya as AddToCart,
|
|
131
132
|
rt as Alert,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
Or as AppShell,
|
|
134
|
+
xo as AppShellNav,
|
|
135
|
+
io as AppShellNavGroup,
|
|
136
|
+
no as AppShellNavItem,
|
|
137
|
+
Yr as AppliedFilters,
|
|
137
138
|
ft as Avatar,
|
|
138
139
|
ut as Badge,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
ar as BottomSheet,
|
|
141
|
+
qa as BrandBlueprint,
|
|
142
|
+
$r as BrandLockup,
|
|
143
|
+
Wa as BrandSurface,
|
|
143
144
|
dt as Breadcrumb,
|
|
144
|
-
|
|
145
|
+
hr as BulkPasteInput,
|
|
145
146
|
Q as Button,
|
|
146
147
|
mt as Card,
|
|
147
148
|
xt as CardBody,
|
|
@@ -153,61 +154,61 @@ export {
|
|
|
153
154
|
ae as Chip,
|
|
154
155
|
oe as ChipGroup,
|
|
155
156
|
Et as CodeBadge,
|
|
156
|
-
|
|
157
|
+
Xr as CodeText,
|
|
157
158
|
le as Combobox,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
lr as CommandPalette,
|
|
160
|
+
ro as CompareTray,
|
|
161
|
+
pr as ConfirmDialog,
|
|
161
162
|
X as ContextMenu,
|
|
162
163
|
bt as CopyField,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
cr as DataTable,
|
|
165
|
+
Br as DataTableColumnMenu,
|
|
166
|
+
Cr as DataTableRow,
|
|
166
167
|
ze as DateField,
|
|
167
168
|
Je as DateRange,
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
Dt as Directory,
|
|
170
|
+
Mt as DirectoryGroup,
|
|
170
171
|
yt as DirectoryJump,
|
|
171
172
|
Ot as DirectoryRow,
|
|
172
173
|
Pa as Disclosure,
|
|
173
174
|
gt as Divider,
|
|
174
|
-
|
|
175
|
+
sr as Drawer,
|
|
175
176
|
Ft as EmptyState,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
Za as Eyebrow,
|
|
178
|
+
Qr as FacetSection,
|
|
179
|
+
Gr as FacetSidebar,
|
|
179
180
|
qe as Field,
|
|
180
181
|
Xe as FileUpload,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
Ur as FilterBar,
|
|
183
|
+
Hr as FilterBarField,
|
|
184
|
+
Jr as FilterToolbar,
|
|
185
|
+
Ar as Gallery,
|
|
185
186
|
$e as Heading,
|
|
186
187
|
Y as IconButton,
|
|
187
|
-
|
|
188
|
+
he as Input,
|
|
188
189
|
Pt as Kbd,
|
|
189
190
|
L as MOBILE_BREAKPOINT,
|
|
190
|
-
|
|
191
|
+
uo as MegaMenu,
|
|
191
192
|
Z as Menu,
|
|
192
|
-
|
|
193
|
+
or as Modal,
|
|
193
194
|
Fe as MoneyInput,
|
|
194
|
-
|
|
195
|
+
_r as NotificationCenter,
|
|
195
196
|
Ut as PageHeader,
|
|
196
|
-
|
|
197
|
+
wr as Pagination,
|
|
197
198
|
vt as Panel,
|
|
198
199
|
wt as PanelForm,
|
|
199
200
|
Nt as PanelRow,
|
|
200
201
|
ka as PartNumberList,
|
|
201
|
-
|
|
202
|
+
Me as PasswordInput,
|
|
202
203
|
Ne as PercentInput,
|
|
203
204
|
ee as Popover,
|
|
204
205
|
Kt as Price,
|
|
205
206
|
La as ProductCard,
|
|
206
|
-
|
|
207
|
+
fo as ProductCarousel,
|
|
207
208
|
Ha as ProductRow,
|
|
208
209
|
da as Progress,
|
|
209
210
|
sa as ProgressCircle,
|
|
210
|
-
|
|
211
|
+
xr as PromptDialog,
|
|
211
212
|
Ue as QuantityInput,
|
|
212
213
|
Re as QuantityStepper,
|
|
213
214
|
Se as Radio,
|
|
@@ -219,6 +220,7 @@ export {
|
|
|
219
220
|
U as SHEET_MEDIA_QUERY,
|
|
220
221
|
Oe as ScaledInput,
|
|
221
222
|
jt as ScrollArea,
|
|
223
|
+
wa as SearchField,
|
|
222
224
|
zt as SectionHeader,
|
|
223
225
|
pe as SegmentedControl,
|
|
224
226
|
se as Select,
|
|
@@ -226,17 +228,17 @@ export {
|
|
|
226
228
|
Xt as SkeletonCard,
|
|
227
229
|
Zt as SkeletonRows,
|
|
228
230
|
$t as SkeletonTable,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
+
qr as SortableList,
|
|
232
|
+
Ga as SpecTable,
|
|
231
233
|
xa as Spinner,
|
|
232
234
|
ta as Stat,
|
|
233
235
|
ra as StatCard,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
er as StatStrip,
|
|
237
|
+
Qa as StatusCell,
|
|
236
238
|
It as StatusDot,
|
|
237
239
|
Ia as Steps,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
to as StickyActionBar,
|
|
241
|
+
Ya as StockStatus,
|
|
240
242
|
fa as SummaryCard,
|
|
241
243
|
ne as Switch,
|
|
242
244
|
H as TABLET_BREAKPOINT,
|
|
@@ -245,32 +247,32 @@ export {
|
|
|
245
247
|
d as THEME_BOOT_SCRIPT,
|
|
246
248
|
s as THEME_BOOT_SCRIPT_HASH,
|
|
247
249
|
m as THEME_STORAGE_KEY,
|
|
248
|
-
|
|
250
|
+
nr as Table,
|
|
249
251
|
_e as TableCheckbox,
|
|
250
|
-
|
|
252
|
+
Tr as TableScroller,
|
|
251
253
|
ba as Tabs,
|
|
252
254
|
Ke as TagInput,
|
|
253
255
|
tt as Text,
|
|
254
256
|
J as TextLink,
|
|
255
257
|
Ve as Textarea,
|
|
256
258
|
ga as Tile,
|
|
257
|
-
|
|
259
|
+
Da as Timeline,
|
|
258
260
|
na as ToastHub,
|
|
259
261
|
ca as ToastPortal,
|
|
260
262
|
q as Tooltip,
|
|
261
263
|
ua as TotalsList,
|
|
262
|
-
|
|
264
|
+
Rr as TreeSelect,
|
|
263
265
|
y as UISize,
|
|
264
|
-
|
|
266
|
+
D as UIVariant,
|
|
265
267
|
a as UiProvider,
|
|
266
268
|
o as UiThemeScript,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
Fr as UserMenu,
|
|
270
|
+
Ja as VehicleTypeList,
|
|
269
271
|
i as hasOpenSurface,
|
|
270
272
|
N as matchesSearch,
|
|
271
273
|
G as normalizeSearchTerm,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
+
Mr as parseBulkPaste,
|
|
275
|
+
so as productColumns,
|
|
274
276
|
Ta as toast,
|
|
275
277
|
T as useAnnounce,
|
|
276
278
|
I as useListboxNavigation,
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/styles.css
CHANGED
|
@@ -144,6 +144,8 @@
|
|
|
144
144
|
|
|
145
145
|
@layer ui{.ui-scrollArea-Ly-yT{scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-scrollArea-Ly-yT::-webkit-scrollbar{width:8px;height:8px}.ui-scrollArea-Ly-yT::-webkit-scrollbar-track{background:transparent}.ui-scrollArea-Ly-yT::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-scrollArea-Ly-yT::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-scrollArea-Ly-yT{position:relative;overscroll-behavior:contain}.ui-scrollArea--vertical-2ujC7{overflow-y:auto;overflow-x:hidden}.ui-scrollArea--horizontal-e9pu-{overflow-x:auto;overflow-y:hidden}.ui-scrollArea--both-lv-8W{overflow:auto}.ui-scrollArea-Ly-yT:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-scrollArea--fade-01Bbm{--ui-scroll-fade-start: 0px;--ui-scroll-fade-end: 0px}.ui-scrollArea--fade-01Bbm[data-fade-start]{--ui-scroll-fade-start: var(--hd-space-4)}.ui-scrollArea--fade-01Bbm[data-fade-end]{--ui-scroll-fade-end: var(--hd-space-4)}.ui-scrollArea--fade-01Bbm.ui-scrollArea--vertical-2ujC7{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--ui-scroll-fade-start),#000 calc(100% - var(--ui-scroll-fade-end)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--ui-scroll-fade-start),#000 calc(100% - var(--ui-scroll-fade-end)),transparent 100%)}.ui-scrollArea--fade-01Bbm.ui-scrollArea--horizontal-e9pu-{-webkit-mask-image:linear-gradient(to right,transparent 0,#000 var(--ui-scroll-fade-start),#000 calc(100% - var(--ui-scroll-fade-end)),transparent 100%);mask-image:linear-gradient(to right,transparent 0,#000 var(--ui-scroll-fade-start),#000 calc(100% - var(--ui-scroll-fade-end)),transparent 100%)}}
|
|
146
146
|
|
|
147
|
+
@layer ui{.ui-search-Abzqh{position:relative;width:100%;min-width:0;margin:0}.ui-search__field-MzkYm{position:relative;display:flex;align-items:center}.ui-search__icon-m1IlV{position:absolute;inset-inline-start:var(--hd-space-3);font-size:18px;color:var(--hd-text-2);pointer-events:none}.ui-search__input-RgrxP{width:100%;font-family:var(--hd-font-body);font-size:var(--hd-type-body-size);line-height:var(--hd-type-h4-line-height);color:var(--hd-text);background-color:var(--hd-bg-surface);border:1px solid var(--hd-border-control);border-radius:var(--hd-radius-sm);padding:var(--hd-space-2) var(--hd-space-3);min-height:40px}@media (max-width: 640px){.ui-search__input-RgrxP{min-height:44px;font-size:max(16px,var(--hd-type-body-size))}}@media (hover: none) and (pointer: coarse){.ui-search__input-RgrxP{min-height:44px;font-size:max(16px,var(--hd-type-body-size))}}.ui-search__input-RgrxP{transition:border-color var(--hd-duration-fast) var(--hd-ease-standard),box-shadow var(--hd-duration-fast) var(--hd-ease-standard)}.ui-search__input-RgrxP::placeholder{color:var(--ui-placeholder, var(--hd-text-3))}.ui-search__input-RgrxP:hover:not(:disabled):not([aria-invalid=true]){border-color:color-mix(in oklab,var(--hd-border-control),var(--hd-text) 40%)}.ui-search__input-RgrxP:focus{outline:none;border-color:var(--ui-ring-color, var(--hd-focus));box-shadow:0 0 0 3px color-mix(in srgb,var(--hd-focus) 32%,transparent)}.ui-search__input-RgrxP:disabled{background-color:var(--hd-bg-raised);border-color:var(--hd-border);cursor:not-allowed;color:var(--hd-text-3)}@media (forced-colors: active){.ui-search__input-RgrxP:disabled{color:GrayText;border-color:GrayText}}.ui-search__input-RgrxP[aria-invalid=true]{border-color:var(--hd-danger-solid)}.ui-search__input-RgrxP[aria-invalid=true]:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--hd-danger-solid) 28%,transparent)}@media (prefers-reduced-motion: reduce){.ui-search__input-RgrxP{transition:none}}.ui-search__input-RgrxP{padding-inline:calc(var(--hd-space-3) + 18px + var(--hd-space-2)) calc(var(--hd-space-2) + 32px);-webkit-appearance:none;-moz-appearance:none;appearance:none}.ui-search__input-RgrxP::-webkit-search-cancel-button,.ui-search__input-RgrxP::-webkit-search-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}.ui-search__clear--CN6D,.ui-search__hint--ZH5p{position:absolute;inset-inline-end:var(--hd-space-2)}.ui-search__field-MzkYm:focus-within .ui-search__hint--ZH5p{display:none}.ui-search--lg-pVRxQ .ui-search__input-RgrxP{min-height:48px;font-size:max(16px,var(--hd-type-body-size))}.ui-panel-R34tt{position:absolute;inset-inline-start:0;top:calc(100% + var(--hd-space-1));z-index:var(--hd-z-dropdown);width:100%;min-width:min(20rem,100vw - 32px);max-height:min(70vh,30rem);overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-overlay);box-shadow:var(--hd-shadow-2);animation:var(--ui-anim-fade-in-down) var(--hd-duration-fast) var(--hd-ease-enter);scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-panel-R34tt::-webkit-scrollbar{width:8px;height:8px}.ui-panel-R34tt::-webkit-scrollbar-track{background:transparent}.ui-panel-R34tt::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-panel-R34tt::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}@media (prefers-reduced-motion: reduce){.ui-panel-R34tt{animation:none}}.ui-panel__list-qIxEJ{display:flex;flex-direction:column;gap:var(--hd-space-2);padding:var(--hd-space-2)}.ui-panel__state-MCdll{display:flex;align-items:center;gap:var(--hd-space-2);margin:0;padding:var(--hd-space-3) var(--hd-space-4);font-size:var(--hd-type-small-size);color:var(--hd-text-2)}.ui-panel__footer-ZsdOn{padding:var(--hd-space-3) var(--hd-space-4);border-block-start:1px solid var(--hd-border);font-size:var(--hd-type-small-size)}.ui-group-i-uv3{display:flex;flex-direction:column;gap:2px}.ui-group__label-UhHAP{font-family:var(--ui-overline-font, var(--hd-font-body));font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);line-height:var(--hd-type-h4-line-height);letter-spacing:var(--ui-overline-tracking, normal);text-transform:var(--ui-overline-transform, none);color:var(--hd-text-2);padding:var(--hd-space-1) var(--hd-space-2);font-size:var(--hd-type-caption-size)}.ui-option-50fEl{display:flex;align-items:center;gap:var(--hd-space-3);min-height:40px;padding:var(--hd-space-2);border-radius:var(--hd-radius-sm);color:var(--hd-text);font-size:var(--hd-type-small-size);text-decoration:none;cursor:pointer}.ui-option--active-v0s-d{background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-option__media-x9T0F{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:20px;color:var(--hd-text-2);font-size:16px}.ui-option__media--image-RUh5j{width:32px;height:32px;overflow:hidden;border-radius:var(--hd-radius-xs);background-color:var(--hd-bg-raised)}.ui-option__media--image-RUh5j>img{width:100%;height:100%;object-fit:contain}.ui-option__text-FUX-q{display:flex;flex:1;flex-direction:column;min-width:0}.ui-option__label-ECvUx,.ui-option__description-i3O-z{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;display:block}.ui-option__description-i3O-z{font-size:var(--hd-type-caption-size);color:var(--hd-text-2)}.ui-option__mark-E7qwn{background:none;color:inherit;font-weight:var(--hd-font-weight-semibold)}@media (forced-colors: active){.ui-option--active-v0s-d{forced-color-adjust:none;background-color:Highlight;color:HighlightText}}.ui-srOnly-eUiCZ{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
|
|
148
|
+
|
|
147
149
|
@layer ui{.ui-header-a08Jh{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--hd-space-4);flex-wrap:wrap}.ui-header__text-ArJkA{display:flex;flex-direction:column;gap:var(--hd-space-1);min-width:0}.ui-header__overline-X5Epo{font-family:var(--ui-overline-font, var(--hd-font-body));font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);line-height:var(--hd-type-h4-line-height);letter-spacing:var(--ui-overline-tracking, normal);text-transform:var(--ui-overline-transform, none);color:var(--hd-text-2)}.ui-header__overline--as-written-gc4XJ{letter-spacing:normal;text-transform:none}.ui-header__title-nQQQJ{font-family:var(--hd-font-display);font-size:var(--hd-type-title-3-size);font-weight:var(--hd-type-title-3-weight);font-stretch:var(--hd-type-title-3-stretch);line-height:var(--hd-type-title-3-line-height);letter-spacing:var(--hd-type-title-3-letter-spacing);color:var(--hd-text);margin:0}.ui-header__description-08oCr{font-size:var(--hd-type-small-size);color:var(--hd-text-2);line-height:var(--hd-type-body-line-height);max-width:68ch;margin:0}.ui-header__action-xsxQF{flex-shrink:0}.ui-header--sm-mIJWZ .ui-header__title-nQQQJ{font-size:var(--hd-type-h4-size)}.ui-header--lg-QBLIz .ui-header__title-nQQQJ{font-size:var(--hd-type-h2-size)}}
|
|
148
150
|
|
|
149
151
|
@layer ui{.ui-segmented-qo2Bw{display:inline-flex;padding:3px;border-radius:var(--hd-radius-sm);background-color:var(--hd-bg-raised);border:1px solid var(--hd-border-control)}.ui-segmented--sm-7tUry{font-size:var(--hd-type-caption-size)}.ui-segmented--md-PiSqt{font-size:var(--hd-type-small-size)}.ui-segmented-qo2Bw[aria-invalid=true]{border-color:var(--hd-danger-solid)}.ui-segmented__item-mqRNZ{display:flex;align-items:center;gap:var(--hd-space-2);position:relative}.ui-segmented__item-mqRNZ:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:max(100%,44px);height:max(100%,44px)}.ui-segmented__item-mqRNZ{justify-content:center;min-width:0;padding:var(--hd-space-2) var(--hd-space-3);border:none;border-radius:calc(var(--hd-radius-sm) - 3px);background:none;cursor:pointer;font-family:var(--hd-font-body);font-size:inherit;font-weight:var(--hd-font-weight-medium);color:var(--hd-text-2);white-space:nowrap;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),color var(--hd-duration-fast) var(--hd-ease-standard)}.ui-segmented--sm-7tUry .ui-segmented__item-mqRNZ{padding:var(--hd-space-1) var(--hd-space-2)}.ui-segmented__item-mqRNZ:hover:not(:disabled):not(.ui-segmented__item--selected-r7CLj){color:var(--hd-text)}.ui-segmented--readOnly-V0PUH .ui-segmented__item-mqRNZ{cursor:default}.ui-segmented--readOnly-V0PUH .ui-segmented__item-mqRNZ:hover:not(.ui-segmented__item--selected-r7CLj){color:var(--hd-text-2)}.ui-segmented__item-mqRNZ:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -1px)}.ui-segmented__item--selected-r7CLj{background-color:var(--hd-bg-overlay);color:var(--hd-text);box-shadow:var(--hd-shadow-1)}.ui-segmented__item-mqRNZ:disabled{color:var(--hd-text-3);cursor:not-allowed}@media (prefers-reduced-motion: reduce){.ui-segmented__item-mqRNZ{transition:none}}.ui-segmented__icon-C9CT-{display:inline-flex;flex-shrink:0;font-size:16px}.ui-segmented__label-NVXBv{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}}
|
|
@@ -268,6 +268,15 @@ export type UiLabels = Partial<{
|
|
|
268
268
|
numberType: string;
|
|
269
269
|
number: string;
|
|
270
270
|
}>;
|
|
271
|
+
/** `SearchField` (3.9). */
|
|
272
|
+
searchField: Partial<{
|
|
273
|
+
/** The clear button ("Aramayı temizle"). */
|
|
274
|
+
clear: string;
|
|
275
|
+
/** Read and shown while suggestions load ("Aranıyor…"). */
|
|
276
|
+
loading: string;
|
|
277
|
+
/** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */
|
|
278
|
+
results: Formatter<[count: number]>;
|
|
279
|
+
}>;
|
|
271
280
|
/** `BulkPasteInput` (3.1). */
|
|
272
281
|
bulkPaste: Partial<{
|
|
273
282
|
/** Parsed rows, e.g. `count => count + ' satır okundu'`. */
|
|
@@ -268,6 +268,15 @@ export type UiLabels = Partial<{
|
|
|
268
268
|
numberType: string;
|
|
269
269
|
number: string;
|
|
270
270
|
}>;
|
|
271
|
+
/** `SearchField` (3.9). */
|
|
272
|
+
searchField: Partial<{
|
|
273
|
+
/** The clear button ("Aramayı temizle"). */
|
|
274
|
+
clear: string;
|
|
275
|
+
/** Read and shown while suggestions load ("Aranıyor…"). */
|
|
276
|
+
loading: string;
|
|
277
|
+
/** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */
|
|
278
|
+
results: Formatter<[count: number]>;
|
|
279
|
+
}>;
|
|
271
280
|
/** `BulkPasteInput` (3.1). */
|
|
272
281
|
bulkPaste: Partial<{
|
|
273
282
|
/** Parsed rows, e.g. `count => count + ' satır okundu'`. */
|
|
@@ -268,6 +268,15 @@ export type UiLabels = Partial<{
|
|
|
268
268
|
numberType: string;
|
|
269
269
|
number: string;
|
|
270
270
|
}>;
|
|
271
|
+
/** `SearchField` (3.9). */
|
|
272
|
+
searchField: Partial<{
|
|
273
|
+
/** The clear button ("Aramayı temizle"). */
|
|
274
|
+
clear: string;
|
|
275
|
+
/** Read and shown while suggestions load ("Aranıyor…"). */
|
|
276
|
+
loading: string;
|
|
277
|
+
/** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */
|
|
278
|
+
results: Formatter<[count: number]>;
|
|
279
|
+
}>;
|
|
271
280
|
/** `BulkPasteInput` (3.1). */
|
|
272
281
|
bulkPaste: Partial<{
|
|
273
282
|
/** Parsed rows, e.g. `count => count + ' satır okundu'`. */
|
|
@@ -268,6 +268,15 @@ export type UiLabels = Partial<{
|
|
|
268
268
|
numberType: string;
|
|
269
269
|
number: string;
|
|
270
270
|
}>;
|
|
271
|
+
/** `SearchField` (3.9). */
|
|
272
|
+
searchField: Partial<{
|
|
273
|
+
/** The clear button ("Aramayı temizle"). */
|
|
274
|
+
clear: string;
|
|
275
|
+
/** Read and shown while suggestions load ("Aranıyor…"). */
|
|
276
|
+
loading: string;
|
|
277
|
+
/** Read when suggestions arrive, e.g. `count => count + ' öneri'`. */
|
|
278
|
+
results: Formatter<[count: number]>;
|
|
279
|
+
}>;
|
|
271
280
|
/** `BulkPasteInput` (3.1). */
|
|
272
281
|
bulkPaste: Partial<{
|
|
273
282
|
/** Parsed rows, e.g. `count => count + ' satır okundu'`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handijitcom/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Accessible React component library on SCSS Modules, themed by its own design tokens (@handijitcom/ui/design): light and dark from one set of --hd-* tokens, a CSP-ready theme boot script, and Bootstrap Icons for iconography.",
|
|
5
5
|
"author": "Ahmet ilhan <ahmetilhan.dev@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -756,6 +756,16 @@
|
|
|
756
756
|
"default": "./build/components/ScrollArea/index.cjs"
|
|
757
757
|
}
|
|
758
758
|
},
|
|
759
|
+
"./search-field": {
|
|
760
|
+
"import": {
|
|
761
|
+
"types": "./build/components/SearchField/index.d.ts",
|
|
762
|
+
"default": "./build/components/SearchField/index.js"
|
|
763
|
+
},
|
|
764
|
+
"require": {
|
|
765
|
+
"types": "./build/components/SearchField/index.d.cts",
|
|
766
|
+
"default": "./build/components/SearchField/index.cjs"
|
|
767
|
+
}
|
|
768
|
+
},
|
|
759
769
|
"./section-header": {
|
|
760
770
|
"import": {
|
|
761
771
|
"types": "./build/components/SectionHeader/index.d.ts",
|