@vielzeug/refine 26.10.1 → 26.10.6

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.
Files changed (56) hide show
  1. package/dist/command-palette.cjs +9 -1
  2. package/dist/command-palette.cjs.map +1 -1
  3. package/dist/command-palette.js +9 -1
  4. package/dist/command-palette.js.map +1 -1
  5. package/dist/core/aria-reflection.cjs +1 -1
  6. package/dist/core/aria-reflection.cjs.map +1 -1
  7. package/dist/core/aria-reflection.d.ts +8 -8
  8. package/dist/core/aria-reflection.d.ts.map +1 -1
  9. package/dist/core/aria-reflection.js +1 -1
  10. package/dist/core/aria-reflection.js.map +1 -1
  11. package/dist/custom-elements.json +4881 -4569
  12. package/dist/frameworks/elements.d.ts +1 -1
  13. package/dist/inputs/index.d.ts +2 -0
  14. package/dist/inputs/index.d.ts.map +1 -1
  15. package/dist/inputs/query-bar/query-bar-grammar.cjs +2 -0
  16. package/dist/inputs/query-bar/query-bar-grammar.cjs.map +1 -0
  17. package/dist/inputs/query-bar/query-bar-grammar.d.ts +85 -0
  18. package/dist/inputs/query-bar/query-bar-grammar.d.ts.map +1 -0
  19. package/dist/inputs/query-bar/query-bar-grammar.js +2 -0
  20. package/dist/inputs/query-bar/query-bar-grammar.js.map +1 -0
  21. package/dist/inputs/query-bar/query-bar.css.cjs +2 -0
  22. package/dist/inputs/query-bar/query-bar.css.cjs.map +1 -0
  23. package/dist/inputs/query-bar/query-bar.css.js +2 -0
  24. package/dist/inputs/query-bar/query-bar.css.js.map +1 -0
  25. package/dist/inputs/query-bar/query-bar.d.ts +68 -0
  26. package/dist/inputs/query-bar/query-bar.d.ts.map +1 -0
  27. package/dist/inputs/query-bar/query-bar.types.d.ts +42 -0
  28. package/dist/inputs/query-bar/query-bar.types.d.ts.map +1 -0
  29. package/dist/navbar.cjs +2 -2
  30. package/dist/navbar.cjs.map +1 -1
  31. package/dist/navbar.js +2 -2
  32. package/dist/navbar.js.map +1 -1
  33. package/dist/overlay/command-palette/command-palette.css.cjs +1 -1
  34. package/dist/overlay/command-palette/command-palette.css.cjs.map +1 -1
  35. package/dist/overlay/command-palette/command-palette.css.js +1 -1
  36. package/dist/overlay/command-palette/command-palette.css.js.map +1 -1
  37. package/dist/overlay/command-palette/command-palette.d.ts +4 -0
  38. package/dist/overlay/command-palette/command-palette.d.ts.map +1 -1
  39. package/dist/overlay/command-palette/command-palette.types.d.ts +10 -0
  40. package/dist/overlay/command-palette/command-palette.types.d.ts.map +1 -1
  41. package/dist/query-bar.cjs +77 -0
  42. package/dist/query-bar.cjs.map +1 -0
  43. package/dist/query-bar.js +77 -0
  44. package/dist/query-bar.js.map +1 -0
  45. package/dist/refine.cjs +112 -29
  46. package/dist/refine.cjs.map +1 -1
  47. package/dist/refine.iife.js +112 -29
  48. package/dist/refine.iife.js.map +1 -1
  49. package/dist/refine.js +112 -29
  50. package/dist/refine.js.map +1 -1
  51. package/dist/tabs.cjs +1 -1
  52. package/dist/tabs.cjs.map +1 -1
  53. package/dist/tabs.js +1 -1
  54. package/dist/tabs.js.map +1 -1
  55. package/dist/types/elements.d.ts +2 -0
  56. package/package.json +25 -18
@@ -1,5 +1,5 @@
1
1
  // Generated from src/types/elements.d.ts. Do not edit directly.
2
2
  import type {} from '../types/elements.js';
3
3
 
4
- export type RefineElementTag = 'ore-accordion' | 'ore-accordion-item' | 'ore-alert' | 'ore-async' | 'ore-avatar' | 'ore-avatar-group' | 'ore-badge' | 'ore-box' | 'ore-breadcrumb' | 'ore-breadcrumb-item' | 'ore-button' | 'ore-button-group' | 'ore-calendar' | 'ore-card' | 'ore-carousel' | 'ore-carousel-slide' | 'ore-chat-message' | 'ore-chat-panel' | 'ore-checkbox' | 'ore-checkbox-group' | 'ore-chip' | 'ore-code-window' | 'ore-column' | 'ore-combobox' | 'ore-combobox-option' | 'ore-command-palette' | 'ore-command-palette-item' | 'ore-cookie-banner' | 'ore-copy-command' | 'ore-counter' | 'ore-datagrid' | 'ore-date-picker' | 'ore-dialog' | 'ore-drawer' | 'ore-file-input' | 'ore-grid' | 'ore-grid-item' | 'ore-icon' | 'ore-input' | 'ore-keyboard-key' | 'ore-keyboard-shortcut' | 'ore-list' | 'ore-list-item' | 'ore-marquee' | 'ore-menu' | 'ore-menu-item' | 'ore-menu-separator' | 'ore-message-composer' | 'ore-navbar' | 'ore-navbar-item' | 'ore-navigation-menu' | 'ore-navigation-menu-item' | 'ore-navigation-menu-panel' | 'ore-number-input' | 'ore-otp-input' | 'ore-pagination' | 'ore-password-strength' | 'ore-popover' | 'ore-progress' | 'ore-qr-code' | 'ore-qr-scanner' | 'ore-radio' | 'ore-radio-group' | 'ore-rank-item' | 'ore-rank-list' | 'ore-rating' | 'ore-select' | 'ore-separator' | 'ore-sidebar' | 'ore-sidebar-group' | 'ore-sidebar-item' | 'ore-skeleton' | 'ore-slider' | 'ore-speech-player' | 'ore-stats' | 'ore-step' | 'ore-stepper' | 'ore-switch' | 'ore-tab-item' | 'ore-tab-panel' | 'ore-table' | 'ore-tabs' | 'ore-td' | 'ore-text' | 'ore-textarea' | 'ore-th' | 'ore-time-picker' | 'ore-toast' | 'ore-tooltip' | 'ore-tr' | 'ore-typing-indicator';
4
+ export type RefineElementTag = 'ore-accordion' | 'ore-accordion-item' | 'ore-alert' | 'ore-async' | 'ore-avatar' | 'ore-avatar-group' | 'ore-badge' | 'ore-box' | 'ore-breadcrumb' | 'ore-breadcrumb-item' | 'ore-button' | 'ore-button-group' | 'ore-calendar' | 'ore-card' | 'ore-carousel' | 'ore-carousel-slide' | 'ore-chat-message' | 'ore-chat-panel' | 'ore-checkbox' | 'ore-checkbox-group' | 'ore-chip' | 'ore-code-window' | 'ore-column' | 'ore-combobox' | 'ore-combobox-option' | 'ore-command-palette' | 'ore-command-palette-item' | 'ore-cookie-banner' | 'ore-copy-command' | 'ore-counter' | 'ore-datagrid' | 'ore-date-picker' | 'ore-dialog' | 'ore-drawer' | 'ore-file-input' | 'ore-grid' | 'ore-grid-item' | 'ore-icon' | 'ore-input' | 'ore-keyboard-key' | 'ore-keyboard-shortcut' | 'ore-list' | 'ore-list-item' | 'ore-marquee' | 'ore-menu' | 'ore-menu-item' | 'ore-menu-separator' | 'ore-message-composer' | 'ore-navbar' | 'ore-navbar-item' | 'ore-navigation-menu' | 'ore-navigation-menu-item' | 'ore-navigation-menu-panel' | 'ore-number-input' | 'ore-otp-input' | 'ore-pagination' | 'ore-password-strength' | 'ore-popover' | 'ore-progress' | 'ore-qr-code' | 'ore-qr-scanner' | 'ore-query-bar' | 'ore-radio' | 'ore-radio-group' | 'ore-rank-item' | 'ore-rank-list' | 'ore-rating' | 'ore-select' | 'ore-separator' | 'ore-sidebar' | 'ore-sidebar-group' | 'ore-sidebar-item' | 'ore-skeleton' | 'ore-slider' | 'ore-speech-player' | 'ore-stats' | 'ore-step' | 'ore-stepper' | 'ore-switch' | 'ore-tab-item' | 'ore-tab-panel' | 'ore-table' | 'ore-tabs' | 'ore-td' | 'ore-text' | 'ore-textarea' | 'ore-th' | 'ore-time-picker' | 'ore-toast' | 'ore-tooltip' | 'ore-tr' | 'ore-typing-indicator';
5
5
  export type RefineElementMap = Pick<HTMLElementTagNameMap, RefineElementTag>;
@@ -29,6 +29,8 @@ export type { OreOtpInputEvents, OreOtpInputProps } from './otp-input/otp-input'
29
29
  export { OTP_INPUT_TAG } from './otp-input/otp-input';
30
30
  export type { OreQrScannerEvents, OreQrScannerProps, OreQrScannerStatus, QrScannerFactory, } from './qr-scanner/qr-scanner';
31
31
  export { QR_SCANNER_TAG } from './qr-scanner/qr-scanner';
32
+ export { QUERY_BAR_TAG, type QueryDraft, type QueryOption, type QueryState, type QuerySuggestion, type QueryToken, type QueryTokenDef, } from './query-bar/query-bar';
33
+ export type { OreQueryBarEvents, OreQueryBarProps } from './query-bar/query-bar.types';
32
34
  export type { OreRadioEvents, OreRadioProps } from './radio/radio';
33
35
  export { RADIO_TAG } from './radio/radio';
34
36
  export type { OreRadioGroupEvents, OreRadioGroupProps } from './radio-group/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AY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ var e=/^([a-z][a-z0-9-]*):(.*)$/i,lower=e=>e.toLowerCase();function keyIndex(e){return new Map(e.map(e=>[lower(e.key),e]))}function resolveOption(e,t){let n=lower(t);return e.options.find(e=>lower(e.value)===n||lower(e.label)===n)}function draftOf(t,n){let r=e.exec(t);if(!r)return null;let i=n.get(lower(r[1]));return i?{key:i.key,valuePrefix:r[2]}:null}function trailingDraft(e,t,n){if(/\s$/.test(e))return null;let r=draftOf(t[t.length-1]??``,n);if(!r)return null;let i=n.get(lower(r.key));return i&&resolveOption(i,r.valuePrefix)?null:r}function commitToken(e,t,n){let r=[...e.tokens],i=r.findIndex(e=>e.key===t);return i>=0?r[i]={key:t,value:n}:r.push({key:t,value:n}),{text:e.text,tokens:r}}function removeToken(e,t){return{text:e.text,tokens:e.tokens.filter(e=>e.key!==t)}}function tokenValue(e,t){return e.tokens.find(e=>e.key===t)?.value}var hasQueryFilters=e=>e.text.trim()!==``||e.tokens.length>0;function parseQuery(t,n){let r=t.trim();if(r===``)return{draft:null,text:``,tokens:[]};let i=keyIndex(n),a=r.split(/\s+/),o=trailingDraft(t,a,i),s=o?a.slice(0,-1):a,c=[],l=[];for(let t of s){let n=e.exec(t),r=n?i.get(lower(n[1])):void 0,a=r&&n?resolveOption(r,n[2]):void 0;if(r&&a){let e=l.findIndex(e=>e.key===r.key);e>=0?l[e]={key:r.key,value:a.value}:l.push({key:r.key,value:a.value})}else c.push(t)}return{draft:o,text:c.join(` `),tokens:l}}function suggestQuery(e,t){let n=parseQuery(e,t).draft,matches=(e,t)=>lower(t.value).startsWith(e)||lower(t.label).startsWith(e);if(n){let e=keyIndex(t).get(lower(n.key));if(!e)return[];let r=lower(n.valuePrefix);return e.options.filter(e=>matches(r,e)).map(t=>({key:e.key,kind:`value`,label:t.label,value:t.value}))}let r=lower(/\s$/.test(e)||e.trim()===``?``:e.trim().split(/\s+/).pop()??``),i=t.filter(e=>lower(e.key).startsWith(r)||lower(e.label).startsWith(r)).map(e=>({key:e.key,kind:`key`,label:e.label})),a=r===``?[]:t.flatMap(e=>e.options.filter(e=>matches(r,e)).map(t=>({key:e.key,kind:`value`,label:t.label,value:t.value})));return[...i,...a]}exports.commitToken=commitToken,exports.hasQueryFilters=hasQueryFilters,exports.parseQuery=parseQuery,exports.removeToken=removeToken,exports.suggestQuery=suggestQuery,exports.tokenValue=tokenValue;
2
+ //# sourceMappingURL=query-bar-grammar.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar-grammar.cjs","names":[],"sources":["../../../src/inputs/query-bar/query-bar-grammar.ts"],"sourcesContent":["/**\n * The query-bar grammar: one search language for a field that accepts free text and\n * `key:value` tokens together (GitHub's pull-request search is the reference UX).\n * A surface decides which keys exist and which values they accept by passing a\n * vocabulary; the bar turns committed tokens into removable pills and keeps free\n * text in the field.\n *\n * This module is pure: no DOM, no framework, no locale access. Consumers build a\n * vocabulary from their own lists (localized where the labels are localized), pass\n * it in, and consume the resulting state. Token keys are locale-stable (`author:`\n * stays `author:` in German) while the vocabulary's labels stay localized.\n *\n * Semantics:\n * - A complete `key:value` fragment resolves against the vocabulary (value or label,\n * case-insensitive) and commits immediately — the bar moves it out of the field\n * into a removable pill.\n * - Unknown keys and unresolved values degrade to free text, never errors.\n * - One value per key: a second token for the same key replaces the first in place.\n * - The last fragment is a draft while the caret is inside it: `author:al…` stays\n * out of the free text so partial tokens never leak into the live search, and it\n * drives the suggestion list instead.\n */\n\n/** One selectable value of a token key. */\nexport interface QueryOption {\n label: string;\n value: string;\n}\n\n/** A vocabulary entry: the token key, its display name, and its accepted values. */\nexport interface QueryTokenDef {\n key: string;\n label: string;\n options: QueryOption[];\n}\n\n/** A committed `key:value` filter. */\nexport interface QueryToken {\n key: string;\n value: string;\n}\n\n/** The bar's whole state: free text plus committed tokens. */\nexport interface QueryState {\n text: string;\n tokens: QueryToken[];\n}\n\n/** A `key:…` fragment still being composed at the end of the field. */\nexport interface QueryDraft {\n key: string;\n valuePrefix: string;\n}\n\n/** What parsing extracted from the raw field content. */\nexport interface ParsedQuery {\n draft: QueryDraft | null;\n text: string;\n tokens: QueryToken[];\n}\n\n/** A suggestion the dropdown offers: pick a key to compose, or a value to commit. */\nexport type QuerySuggestion =\n | { key: string; kind: 'key'; label: string }\n | { key: string; kind: 'value'; label: string; value: string };\n\nconst TOKEN_SYNTAX = /^([a-z][a-z0-9-]*):(.*)$/i;\n\nconst lower = (value: string): string => value.toLowerCase();\n\nfunction keyIndex(vocabulary: readonly QueryTokenDef[]): Map<string, QueryTokenDef> {\n return new Map(vocabulary.map((def) => [lower(def.key), def]));\n}\n\n/** Resolves a typed value against a key's options: exact, case-insensitive, by value or label. */\nfunction resolveOption(def: QueryTokenDef, raw: string): QueryOption | undefined {\n const needle = lower(raw);\n return def.options.find((option) => lower(option.value) === needle || lower(option.label) === needle);\n}\n\n/** The trailing `key:…` fragment if it opens a known key, `null` for plain words. */\nfunction draftOf(fragment: string, index: Map<string, QueryTokenDef>): QueryDraft | null {\n const match = TOKEN_SYNTAX.exec(fragment);\n if (!match) return null;\n const def = index.get(lower(match[1]));\n return def ? { key: def.key, valuePrefix: match[2] } : null;\n}\n\n/**\n * The trailing fragment as a draft: a known key whose value is still being composed.\n * A fragment that already resolves to a whole option is NOT a draft — typing\n * `author:alice` commits the token immediately instead of waiting for a space.\n */\nfunction trailingDraft(input: string, fragments: string[], index: Map<string, QueryTokenDef>): QueryDraft | null {\n if (/\\s$/.test(input)) return null;\n const candidate = draftOf(fragments[fragments.length - 1] ?? '', index);\n if (!candidate) return null;\n const def = index.get(lower(candidate.key));\n return def && resolveOption(def, candidate.valuePrefix) ? null : candidate;\n}\n\n/** One value per key: a second token replaces the first and keeps the pill's slot. */\nexport function commitToken(state: QueryState, key: string, value: string): QueryState {\n const tokens = [...state.tokens];\n const slot = tokens.findIndex((token) => token.key === key);\n if (slot >= 0) tokens[slot] = { key, value };\n else tokens.push({ key, value });\n return { text: state.text, tokens };\n}\n\nexport function removeToken(state: QueryState, key: string): QueryState {\n return { text: state.text, tokens: state.tokens.filter((token) => token.key !== key) };\n}\n\nexport function tokenValue(state: QueryState, key: string): string | undefined {\n return state.tokens.find((token) => token.key === key)?.value;\n}\n\nexport const hasQueryFilters = (state: QueryState): boolean => state.text.trim() !== '' || state.tokens.length > 0;\n\n/**\n * Splits a raw field into free text, committed tokens, and the trailing draft.\n * The draft only exists while the input does not end in whitespace and the last\n * fragment is an unfinished `key:…` — a finished fragment is either a token or text.\n */\nexport function parseQuery(input: string, vocabulary: readonly QueryTokenDef[]): ParsedQuery {\n const trimmed = input.trim();\n if (trimmed === '') return { draft: null, text: '', tokens: [] };\n\n const index = keyIndex(vocabulary);\n const fragments = trimmed.split(/\\s+/);\n const draft = trailingDraft(input, fragments, index);\n const complete = draft ? fragments.slice(0, -1) : fragments;\n\n const text: string[] = [];\n const tokens: QueryToken[] = [];\n for (const fragment of complete) {\n const match = TOKEN_SYNTAX.exec(fragment);\n const def = match ? index.get(lower(match[1])) : undefined;\n const option = def && match ? resolveOption(def, match[2]) : undefined;\n if (def && option) {\n const slot = tokens.findIndex((token) => token.key === def.key);\n if (slot >= 0) tokens[slot] = { key: def.key, value: option.value };\n else tokens.push({ key: def.key, value: option.value });\n } else {\n text.push(fragment);\n }\n }\n return { draft, text: text.join(' '), tokens };\n}\n\n/**\n * The dropdown's offers for the current field:\n * - inside a `key:…` draft: that key's options whose value or label matches the prefix;\n * - otherwise: the vocabulary's keys whose name matches the word being typed, plus\n * any option across all keys that reads like that word (so typing `ali` offers\n * `author:Alice` directly — the tap-first path).\n */\nexport function suggestQuery(input: string, vocabulary: readonly QueryTokenDef[]): QuerySuggestion[] {\n const draft = parseQuery(input, vocabulary).draft;\n const matches = (needle: string, option: QueryOption): boolean =>\n lower(option.value).startsWith(needle) || lower(option.label).startsWith(needle);\n\n if (draft) {\n const def = keyIndex(vocabulary).get(lower(draft.key));\n if (!def) return [];\n const needle = lower(draft.valuePrefix);\n return def.options\n .filter((option) => matches(needle, option))\n .map((option) => ({ key: def.key, kind: 'value', label: option.label, value: option.value }));\n }\n\n // The word being typed: none once the field ends in whitespace (focus fresh on a\n // finished query), so the dropdown falls back to listing the vocabulary's keys.\n const fragment = /\\s$/.test(input) || input.trim() === '' ? '' : (input.trim().split(/\\s+/).pop() ?? '');\n const needle = lower(fragment);\n const keys: QuerySuggestion[] = vocabulary\n .filter((def) => lower(def.key).startsWith(needle) || lower(def.label).startsWith(needle))\n .map((def) => ({ key: def.key, kind: 'key', label: def.label }));\n const values: QuerySuggestion[] =\n needle === ''\n ? []\n : vocabulary.flatMap((def) =>\n def.options\n .filter((option) => matches(needle, option))\n .map((option) => ({ key: def.key, kind: 'value', label: option.label, value: option.value })),\n );\n return [...keys, ...values];\n}\n"],"mappings":"AAkEA,IAAM,EAAe,4BAEf,MAAS,GAA0B,EAAM,YAAY,EAE3D,SAAS,SAAS,EAAkE,CAClF,OAAO,IAAI,IAAI,EAAW,IAAK,GAAQ,CAAC,MAAM,EAAI,GAAG,EAAG,CAAG,CAAC,CAAC,CAC/D,CAGA,SAAS,cAAc,EAAoB,EAAsC,CAC/E,IAAM,EAAS,MAAM,CAAG,EACxB,OAAO,EAAI,QAAQ,KAAM,GAAW,MAAM,EAAO,KAAK,IAAM,GAAU,MAAM,EAAO,KAAK,IAAM,CAAM,CACtG,CAGA,SAAS,QAAQ,EAAkB,EAAsD,CACvF,IAAM,EAAQ,EAAa,KAAK,CAAQ,EACxC,GAAI,CAAC,EAAO,OAAO,KACnB,IAAM,EAAM,EAAM,IAAI,MAAM,EAAM,EAAE,CAAC,EACrC,OAAO,EAAM,CAAE,IAAK,EAAI,IAAK,YAAa,EAAM,EAAG,EAAI,IACzD,CAOA,SAAS,cAAc,EAAe,EAAqB,EAAsD,CAC/G,GAAI,MAAM,KAAK,CAAK,EAA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,CAAC,WAAW,CAAM,CAAC,CAAC,CACzF,IAAK,IAAS,CAAE,IAAK,EAAI,IAAK,KAAM,MAAO,MAAO,EAAI,KAAM,EAAE,EAC3D,EACJ,IAAW,GACP,CAAC,EACD,EAAW,QAAS,GAClB,EAAI,QACD,OAAQ,GAAW,QAAQ,EAAQ,CAAM,CAAC,CAAC,CAC3C,IAAK,IAAY,CAAE,IAAK,EAAI,IAAK,KAAM,QAAS,MAAO,EAAO,MAAO,MAAO,EAAO,KAAM,EAAE,CAChG,EACN,MAAO,CAAC,GAAG,EAAM,GAAG,CAAM,CAC5B"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The query-bar grammar: one search language for a field that accepts free text and
3
+ * `key:value` tokens together (GitHub's pull-request search is the reference UX).
4
+ * A surface decides which keys exist and which values they accept by passing a
5
+ * vocabulary; the bar turns committed tokens into removable pills and keeps free
6
+ * text in the field.
7
+ *
8
+ * This module is pure: no DOM, no framework, no locale access. Consumers build a
9
+ * vocabulary from their own lists (localized where the labels are localized), pass
10
+ * it in, and consume the resulting state. Token keys are locale-stable (`author:`
11
+ * stays `author:` in German) while the vocabulary's labels stay localized.
12
+ *
13
+ * Semantics:
14
+ * - A complete `key:value` fragment resolves against the vocabulary (value or label,
15
+ * case-insensitive) and commits immediately — the bar moves it out of the field
16
+ * into a removable pill.
17
+ * - Unknown keys and unresolved values degrade to free text, never errors.
18
+ * - One value per key: a second token for the same key replaces the first in place.
19
+ * - The last fragment is a draft while the caret is inside it: `author:al…` stays
20
+ * out of the free text so partial tokens never leak into the live search, and it
21
+ * drives the suggestion list instead.
22
+ */
23
+ /** One selectable value of a token key. */
24
+ export interface QueryOption {
25
+ label: string;
26
+ value: string;
27
+ }
28
+ /** A vocabulary entry: the token key, its display name, and its accepted values. */
29
+ export interface QueryTokenDef {
30
+ key: string;
31
+ label: string;
32
+ options: QueryOption[];
33
+ }
34
+ /** A committed `key:value` filter. */
35
+ export interface QueryToken {
36
+ key: string;
37
+ value: string;
38
+ }
39
+ /** The bar's whole state: free text plus committed tokens. */
40
+ export interface QueryState {
41
+ text: string;
42
+ tokens: QueryToken[];
43
+ }
44
+ /** A `key:…` fragment still being composed at the end of the field. */
45
+ export interface QueryDraft {
46
+ key: string;
47
+ valuePrefix: string;
48
+ }
49
+ /** What parsing extracted from the raw field content. */
50
+ export interface ParsedQuery {
51
+ draft: QueryDraft | null;
52
+ text: string;
53
+ tokens: QueryToken[];
54
+ }
55
+ /** A suggestion the dropdown offers: pick a key to compose, or a value to commit. */
56
+ export type QuerySuggestion = {
57
+ key: string;
58
+ kind: 'key';
59
+ label: string;
60
+ } | {
61
+ key: string;
62
+ kind: 'value';
63
+ label: string;
64
+ value: string;
65
+ };
66
+ /** One value per key: a second token replaces the first and keeps the pill's slot. */
67
+ export declare function commitToken(state: QueryState, key: string, value: string): QueryState;
68
+ export declare function removeToken(state: QueryState, key: string): QueryState;
69
+ export declare function tokenValue(state: QueryState, key: string): string | undefined;
70
+ export declare const hasQueryFilters: (state: QueryState) => boolean;
71
+ /**
72
+ * Splits a raw field into free text, committed tokens, and the trailing draft.
73
+ * The draft only exists while the input does not end in whitespace and the last
74
+ * fragment is an unfinished `key:…` — a finished fragment is either a token or text.
75
+ */
76
+ export declare function parseQuery(input: string, vocabulary: readonly QueryTokenDef[]): ParsedQuery;
77
+ /**
78
+ * The dropdown's offers for the current field:
79
+ * - inside a `key:…` draft: that key's options whose value or label matches the prefix;
80
+ * - otherwise: the vocabulary's keys whose name matches the word being typed, plus
81
+ * any option across all keys that reads like that word (so typing `ali` offers
82
+ * `author:Alice` directly — the tap-first path).
83
+ */
84
+ export declare function suggestQuery(input: string, vocabulary: readonly QueryTokenDef[]): QuerySuggestion[];
85
+ //# sourceMappingURL=query-bar-grammar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar-grammar.d.ts","sourceRoot":"","sources":["../../../src/inputs/query-bar/query-bar-grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;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U,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7E;AAED,eAAO,MAAM,eAAe,GAAI,OAAO,UAAU,KAAG,OAA8D,CAAC;AAEnH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,WAAW,CAwB3F;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,eAAe,EAAE,CA8BnG"}
@@ -0,0 +1,2 @@
1
+ var e=/^([a-z][a-z0-9-]*):(.*)$/i,lower=e=>e.toLowerCase();function keyIndex(e){return new Map(e.map(e=>[lower(e.key),e]))}function resolveOption(e,t){let n=lower(t);return e.options.find(e=>lower(e.value)===n||lower(e.label)===n)}function draftOf(t,n){let r=e.exec(t);if(!r)return null;let i=n.get(lower(r[1]));return i?{key:i.key,valuePrefix:r[2]}:null}function trailingDraft(e,t,n){if(/\s$/.test(e))return null;let r=draftOf(t[t.length-1]??``,n);if(!r)return null;let i=n.get(lower(r.key));return i&&resolveOption(i,r.valuePrefix)?null:r}function commitToken(e,t,n){let r=[...e.tokens],i=r.findIndex(e=>e.key===t);return i>=0?r[i]={key:t,value:n}:r.push({key:t,value:n}),{text:e.text,tokens:r}}function removeToken(e,t){return{text:e.text,tokens:e.tokens.filter(e=>e.key!==t)}}function tokenValue(e,t){return e.tokens.find(e=>e.key===t)?.value}var hasQueryFilters=e=>e.text.trim()!==``||e.tokens.length>0;function parseQuery(t,n){let r=t.trim();if(r===``)return{draft:null,text:``,tokens:[]};let i=keyIndex(n),a=r.split(/\s+/),o=trailingDraft(t,a,i),s=o?a.slice(0,-1):a,c=[],l=[];for(let t of s){let n=e.exec(t),r=n?i.get(lower(n[1])):void 0,a=r&&n?resolveOption(r,n[2]):void 0;if(r&&a){let e=l.findIndex(e=>e.key===r.key);e>=0?l[e]={key:r.key,value:a.value}:l.push({key:r.key,value:a.value})}else c.push(t)}return{draft:o,text:c.join(` `),tokens:l}}function suggestQuery(e,t){let n=parseQuery(e,t).draft,matches=(e,t)=>lower(t.value).startsWith(e)||lower(t.label).startsWith(e);if(n){let e=keyIndex(t).get(lower(n.key));if(!e)return[];let r=lower(n.valuePrefix);return e.options.filter(e=>matches(r,e)).map(t=>({key:e.key,kind:`value`,label:t.label,value:t.value}))}let r=lower(/\s$/.test(e)||e.trim()===``?``:e.trim().split(/\s+/).pop()??``),i=t.filter(e=>lower(e.key).startsWith(r)||lower(e.label).startsWith(r)).map(e=>({key:e.key,kind:`key`,label:e.label})),a=r===``?[]:t.flatMap(e=>e.options.filter(e=>matches(r,e)).map(t=>({key:e.key,kind:`value`,label:t.label,value:t.value})));return[...i,...a]}export{commitToken,hasQueryFilters,parseQuery,removeToken,suggestQuery,tokenValue};
2
+ //# sourceMappingURL=query-bar-grammar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar-grammar.js","names":[],"sources":["../../../src/inputs/query-bar/query-bar-grammar.ts"],"sourcesContent":["/**\n * The query-bar grammar: one search language for a field that accepts free text and\n * `key:value` tokens together (GitHub's pull-request search is the reference UX).\n * A surface decides which keys exist and which values they accept by passing a\n * vocabulary; the bar turns committed tokens into removable pills and keeps free\n * text in the field.\n *\n * This module is pure: no DOM, no framework, no locale access. Consumers build a\n * vocabulary from their own lists (localized where the labels are localized), pass\n * it in, and consume the resulting state. Token keys are locale-stable (`author:`\n * stays `author:` in German) while the vocabulary's labels stay localized.\n *\n * Semantics:\n * - A complete `key:value` fragment resolves against the vocabulary (value or label,\n * case-insensitive) and commits immediately — the bar moves it out of the field\n * into a removable pill.\n * - Unknown keys and unresolved values degrade to free text, never errors.\n * - One value per key: a second token for the same key replaces the first in place.\n * - The last fragment is a draft while the caret is inside it: `author:al…` stays\n * out of the free text so partial tokens never leak into the live search, and it\n * drives the suggestion list instead.\n */\n\n/** One selectable value of a token key. */\nexport interface QueryOption {\n label: string;\n value: string;\n}\n\n/** A vocabulary entry: the token key, its display name, and its accepted values. */\nexport interface QueryTokenDef {\n key: string;\n label: string;\n options: QueryOption[];\n}\n\n/** A committed `key:value` filter. */\nexport interface QueryToken {\n key: string;\n value: string;\n}\n\n/** The bar's whole state: free text plus committed tokens. */\nexport interface QueryState {\n text: string;\n tokens: QueryToken[];\n}\n\n/** A `key:…` fragment still being composed at the end of the field. */\nexport interface QueryDraft {\n key: string;\n valuePrefix: string;\n}\n\n/** What parsing extracted from the raw field content. */\nexport interface ParsedQuery {\n draft: QueryDraft | null;\n text: string;\n tokens: QueryToken[];\n}\n\n/** A suggestion the dropdown offers: pick a key to compose, or a value to commit. */\nexport type QuerySuggestion =\n | { key: string; kind: 'key'; label: string }\n | { key: string; kind: 'value'; label: string; value: string };\n\nconst TOKEN_SYNTAX = /^([a-z][a-z0-9-]*):(.*)$/i;\n\nconst lower = (value: string): string => value.toLowerCase();\n\nfunction keyIndex(vocabulary: readonly QueryTokenDef[]): Map<string, QueryTokenDef> {\n return new Map(vocabulary.map((def) => [lower(def.key), def]));\n}\n\n/** Resolves a typed value against a key's options: exact, case-insensitive, by value or label. */\nfunction resolveOption(def: QueryTokenDef, raw: string): QueryOption | undefined {\n const needle = lower(raw);\n return def.options.find((option) => lower(option.value) === needle || lower(option.label) === needle);\n}\n\n/** The trailing `key:…` fragment if it opens a known key, `null` for plain words. */\nfunction draftOf(fragment: string, index: Map<string, QueryTokenDef>): QueryDraft | null {\n const match = TOKEN_SYNTAX.exec(fragment);\n if (!match) return null;\n const def = index.get(lower(match[1]));\n return def ? { key: def.key, valuePrefix: match[2] } : null;\n}\n\n/**\n * The trailing fragment as a draft: a known key whose value is still being composed.\n * A fragment that already resolves to a whole option is NOT a draft — typing\n * `author:alice` commits the token immediately instead of waiting for a space.\n */\nfunction trailingDraft(input: string, fragments: string[], index: Map<string, QueryTokenDef>): QueryDraft | null {\n if (/\\s$/.test(input)) return null;\n const candidate = draftOf(fragments[fragments.length - 1] ?? '', index);\n if (!candidate) return null;\n const def = index.get(lower(candidate.key));\n return def && resolveOption(def, candidate.valuePrefix) ? null : candidate;\n}\n\n/** One value per key: a second token replaces the first and keeps the pill's slot. */\nexport function commitToken(state: QueryState, key: string, value: string): QueryState {\n const tokens = [...state.tokens];\n const slot = tokens.findIndex((token) => token.key === key);\n if (slot >= 0) tokens[slot] = { key, value };\n else tokens.push({ key, value });\n return { text: state.text, tokens };\n}\n\nexport function removeToken(state: QueryState, key: string): QueryState {\n return { text: state.text, tokens: state.tokens.filter((token) => token.key !== key) };\n}\n\nexport function tokenValue(state: QueryState, key: string): string | undefined {\n return state.tokens.find((token) => token.key === key)?.value;\n}\n\nexport const hasQueryFilters = (state: QueryState): boolean => state.text.trim() !== '' || state.tokens.length > 0;\n\n/**\n * Splits a raw field into free text, committed tokens, and the trailing draft.\n * The draft only exists while the input does not end in whitespace and the last\n * fragment is an unfinished `key:…` — a finished fragment is either a token or text.\n */\nexport function parseQuery(input: string, vocabulary: readonly QueryTokenDef[]): ParsedQuery {\n const trimmed = input.trim();\n if (trimmed === '') return { draft: null, text: '', tokens: [] };\n\n const index = keyIndex(vocabulary);\n const fragments = trimmed.split(/\\s+/);\n const draft = trailingDraft(input, fragments, index);\n const complete = draft ? fragments.slice(0, -1) : fragments;\n\n const text: string[] = [];\n const tokens: QueryToken[] = [];\n for (const fragment of complete) {\n const match = TOKEN_SYNTAX.exec(fragment);\n const def = match ? index.get(lower(match[1])) : undefined;\n const option = def && match ? resolveOption(def, match[2]) : undefined;\n if (def && option) {\n const slot = tokens.findIndex((token) => token.key === def.key);\n if (slot >= 0) tokens[slot] = { key: def.key, value: option.value };\n else tokens.push({ key: def.key, value: option.value });\n } else {\n text.push(fragment);\n }\n }\n return { draft, text: text.join(' '), tokens };\n}\n\n/**\n * The dropdown's offers for the current field:\n * - inside a `key:…` draft: that key's options whose value or label matches the prefix;\n * - otherwise: the vocabulary's keys whose name matches the word being typed, plus\n * any option across all keys that reads like that word (so typing `ali` offers\n * `author:Alice` directly — the tap-first path).\n */\nexport function suggestQuery(input: string, vocabulary: readonly QueryTokenDef[]): QuerySuggestion[] {\n const draft = parseQuery(input, vocabulary).draft;\n const matches = (needle: string, option: QueryOption): boolean =>\n lower(option.value).startsWith(needle) || lower(option.label).startsWith(needle);\n\n if (draft) {\n const def = keyIndex(vocabulary).get(lower(draft.key));\n if (!def) return [];\n const needle = lower(draft.valuePrefix);\n return def.options\n .filter((option) => matches(needle, option))\n .map((option) => ({ key: def.key, kind: 'value', label: option.label, value: option.value }));\n }\n\n // The word being typed: none once the field ends in whitespace (focus fresh on a\n // finished query), so the dropdown falls back to listing the vocabulary's keys.\n const fragment = /\\s$/.test(input) || input.trim() === '' ? '' : (input.trim().split(/\\s+/).pop() ?? '');\n const needle = lower(fragment);\n const keys: QuerySuggestion[] = vocabulary\n .filter((def) => lower(def.key).startsWith(needle) || lower(def.label).startsWith(needle))\n .map((def) => ({ key: def.key, kind: 'key', label: def.label }));\n const values: QuerySuggestion[] =\n needle === ''\n ? []\n : vocabulary.flatMap((def) =>\n def.options\n .filter((option) => matches(needle, option))\n .map((option) => ({ key: def.key, kind: 'value', label: option.label, value: option.value })),\n );\n return [...keys, ...values];\n}\n"],"mappings":"AAkEA,IAAM,EAAe,4BAEf,MAAS,GAA0B,EAAM,YAAY,EAE3D,SAAS,SAAS,EAAkE,CAClF,OAAO,IAAI,IAAI,EAAW,IAAK,GAAQ,CAAC,MAAM,EAAI,GAAG,EAAG,CAAG,CAAC,CAAC,CAC/D,CAGA,SAAS,cAAc,EAAoB,EAAsC,CAC/E,IAAM,EAAS,MAAM,CAAG,EACxB,OAAO,EAAI,QAAQ,KAAM,GAAW,MAAM,EAAO,KAAK,IAAM,GAAU,MAAM,EAAO,KAAK,IAAM,CAAM,CACtG,CAGA,SAAS,QAAQ,EAAkB,EAAsD,CACvF,IAAM,EAAQ,EAAa,KAAK,CAAQ,EACxC,GAAI,CAAC,EAAO,OAA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EAAM,KAAK,IAAM,GAAK,GAAM,EAAM,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,GAAK,EACxE,EACvB,EAA0B,EAC7B,OAAQ,GAAQ,MAAM,EAAI,GAAG,CAAC,CAAC,WAAW,CAAM,GAAK,MAAM,EAAI,KAAK,CAAC,CAAC,WAAW,CAAM,CAAC,CAAC,CACzF,IAAK,IAAS,CAAE,IAAK,EAAI,IAAK,KAAM,MAAO,MAAO,EAAI,KAAM,EAAE,EAC3D,EACJ,IAAW,GACP,CAAC,EACD,EAAW,QAAS,GAClB,EAAI,QACD,OAAQ,GAAW,QAAQ,EAAQ,CAAM,CAAC,CAAC,CAC3C,IAAK,IAAY,CAAE,IAAK,EAAI,IAAK,KAAM,QAAS,MAAO,EAAO,MAAO,MAAO,EAAO,KAAM,EAAE,CAChG,EACN,MAAO,CAAC,GAAG,EAAM,GAAG,CAAM,CAC5B"}
@@ -0,0 +1,2 @@
1
+ var e=`@layer refine.base{:host{--_dropdown-bg:var(--combobox-dropdown-bg,var(--color-canvas));--_dropdown-border-color:var(--combobox-dropdown-border-color,var(--color-contrast-200));--_option-hover-bg:var(--combobox-option-hover-bg,var(--color-contrast-100));--_option-focus-bg:var(--combobox-option-focus-bg,color-mix(in oklch, var(--_theme-base) 12%, var(--color-contrast-100)));min-width:var(--query-bar-min-width,12rem);flex-direction:column;align-items:stretch;display:inline-flex}.trigger::part(input){cursor:text}.trigger::part(field){height:auto;min-height:var(--input-height,var(--size-10))}.trigger::part(input-row){row-gap:var(--size-1);flex-wrap:wrap;align-items:center}.prefix{display:contents}.prefix>ore-icon{color:var(--text-color-tertiary);flex-shrink:0}.prefix>ore-icon:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){margin-right:var(--size-1)}.prefix>ore-icon:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){margin-left:var(--size-1)}.pills{display:contents}.prefix ore-chip{flex:none}.prefix ore-chip:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){margin-right:var(--size-1)}.prefix ore-chip:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){margin-left:var(--size-1)}.suffix{gap:var(--size-1);flex-shrink:0;align-items:center;display:flex}.clear-btn{color:var(--color-contrast-400);cursor:pointer;background:0 0;border:0;flex-shrink:0;align-items:center;padding:0;display:inline-flex}.clear-btn[hidden]{display:none}.clear-btn:hover{color:var(--color-contrast-600)}.clear-btn:focus-visible{outline:var(--border-2) solid var(--_theme-focus);outline-offset:var(--border);border-radius:var(--rounded-sm)}.dropdown{z-index:calc(var(--z-popover,1000) + 1);box-sizing:border-box;min-width:var(--query-bar-dropdown-min-width,16rem);max-width:var(--query-bar-dropdown-max-width,min(28rem, calc(100vw - var(--size-4))));max-height:min(16rem,50dvh);padding:var(--size-1);overscroll-behavior:contain;pointer-events:none;scrollbar-width:thin;background:var(--_dropdown-bg);border:var(--border) solid var(--_dropdown-border-color);border-radius:var(--_radius);box-shadow:var(--shadow-lg);opacity:0;-webkit-backdrop-filter:blur(var(--blur-md));backdrop-filter:blur(var(--blur-md));transform:translateY(var(--overlay-enter-translate-y));transition:var(--_motion-transition,opacity var(--transition-fast), transform var(--transition-fast), display var(--transition-fast) allow-discrete);margin:0;position:fixed;inset:0 auto auto 0;overflow-y:auto}.dropdown:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){text-align:left}.dropdown:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){text-align:right}.dropdown[data-open]{pointer-events:auto;opacity:1;transform:translateY(0)}@starting-style{.dropdown[data-open]{opacity:0;transform:translateY(var(--overlay-enter-translate-y))}}.option{box-sizing:border-box;gap:var(--size-2);height:var(--query-bar-option-height,36px);padding:var(--size-1) var(--size-2-5);font-size:var(--text-sm);line-height:var(--leading-normal);cursor:pointer;border-radius:var(--rounded-sm);transition:background var(--transition-fast), color var(--transition-fast);align-items:baseline;display:flex}.option:hover{background:var(--_option-hover-bg)}.option[data-focused]{color:var(--_theme-base);background:var(--_option-focus-bg)}.no-match{box-sizing:border-box;height:var(--query-bar-option-height,36px);padding:var(--size-1) var(--size-2-5);font-size:var(--text-sm);line-height:var(--leading-normal);color:var(--text-color-tertiary);border-radius:var(--rounded-sm);align-items:center;display:flex}.option-label{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;overflow:hidden}.option-meta{text-overflow:ellipsis;min-width:0;font-size:var(--text-xs);color:var(--text-color-tertiary);white-space:nowrap;flex:1;overflow:hidden}.option-meta:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){text-align:right}.option-meta:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){text-align:left}}`;exports.default=e;
2
+ //# sourceMappingURL=query-bar.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar.css.cjs","names":[],"sources":["../../../src/inputs/query-bar/query-bar.css?inline"],"sourcesContent":["@layer refine.base {\n :host {\n --_dropdown-bg: var(--combobox-dropdown-bg, var(--color-canvas));\n --_dropdown-border-color: var(--combobox-dropdown-border-color, var(--color-contrast-200));\n --_option-hover-bg: var(--combobox-option-hover-bg, var(--color-contrast-100));\n --_option-focus-bg: var(\n --combobox-option-focus-bg,\n color-mix(in oklch, var(--_theme-base) 12%, var(--color-contrast-100))\n );\n\n display: inline-flex;\n flex-direction: column;\n align-items: stretch;\n min-width: var(--query-bar-min-width, 12rem);\n }\n\n :host([open]) {\n /* Nothing yet: the open state is reflected for consumer styling. */\n }\n\n /* ore-input cursor override so the field still feels like a text input */\n .trigger::part(input) {\n cursor: text;\n }\n\n /* Allow the field to grow vertically when pills wrap to multiple rows. */\n .trigger::part(field) {\n height: auto;\n min-height: var(--input-height, var(--size-10));\n }\n\n /* Wrap pills + input across rows; the suffix stays on the input's row.\n Only row-gap is set here: spacing between pills is handled via margin on\n ore-chip so the empty prefix adds no extra offset. */\n .trigger::part(input-row) {\n flex-wrap: wrap;\n row-gap: var(--size-1);\n align-items: center;\n }\n\n /* ========================================\n Prefix: search icon + pill tokens\n ======================================== */\n\n /* display:contents removes the prefix wrapper from the flex layout so the\n icon and chips become direct flex items of input-row. */\n .prefix {\n display: contents;\n }\n\n .prefix > ore-icon {\n flex-shrink: 0;\n margin-inline-end: var(--size-1);\n color: var(--text-color-tertiary);\n }\n\n /* .pills is also display:contents so individual ore-chip elements are the\n direct flex items, wrapping inline with the search input. */\n .pills {\n display: contents;\n }\n\n /* Trailing space after each chip covers both inter-chip spacing and\n the gap between the last chip and the search input. Pills never shrink:\n they keep their readable size and wrap instead. */\n .prefix ore-chip {\n flex: none;\n margin-inline-end: var(--size-1);\n }\n\n /* ========================================\n Suffix: clear button\n ======================================== */\n\n .suffix {\n display: flex;\n flex-shrink: 0;\n gap: var(--size-1);\n align-items: center;\n }\n\n .clear-btn {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n padding: 0;\n color: var(--color-contrast-400);\n cursor: pointer;\n background: none;\n border: 0;\n }\n\n .clear-btn[hidden] {\n display: none;\n }\n\n .clear-btn:hover {\n color: var(--color-contrast-600);\n }\n\n .clear-btn:focus-visible {\n outline: var(--border-2) solid var(--_theme-focus);\n outline-offset: var(--border);\n border-radius: var(--rounded-sm);\n }\n\n /* ========================================\n Dropdown / Listbox\n ======================================== */\n\n .dropdown {\n position: fixed;\n inset: 0 auto auto 0;\n z-index: calc(var(--z-popover, 1000) + 1);\n box-sizing: border-box;\n min-width: var(--query-bar-dropdown-min-width, 16rem);\n max-width: var(--query-bar-dropdown-max-width, min(28rem, calc(100vw - var(--size-4))));\n max-height: min(16rem, 50dvh);\n padding: var(--size-1);\n margin: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n text-align: start;\n pointer-events: none;\n scrollbar-width: thin;\n background: var(--_dropdown-bg);\n border: var(--border) solid var(--_dropdown-border-color);\n border-radius: var(--_radius);\n box-shadow: var(--shadow-lg);\n opacity: 0;\n backdrop-filter: blur(var(--blur-md));\n transform: translateY(var(--overlay-enter-translate-y));\n transition: var(\n --_motion-transition,\n opacity var(--transition-fast),\n transform var(--transition-fast),\n display var(--transition-fast) allow-discrete\n );\n }\n\n .dropdown[data-open] {\n pointer-events: auto;\n opacity: 1;\n transform: translateY(0);\n\n @starting-style {\n opacity: 0;\n transform: translateY(var(--overlay-enter-translate-y));\n }\n }\n\n /* ========================================\n Suggestion rows\n ======================================== */\n\n .option {\n box-sizing: border-box;\n display: flex;\n gap: var(--size-2);\n align-items: baseline;\n height: var(--query-bar-option-height, 36px);\n padding: var(--size-1) var(--size-2-5);\n font-size: var(--text-sm);\n line-height: var(--leading-normal);\n cursor: pointer;\n border-radius: var(--rounded-sm);\n transition:\n background var(--transition-fast),\n color var(--transition-fast);\n }\n\n .option:hover {\n background: var(--_option-hover-bg);\n }\n\n .option[data-focused] {\n color: var(--_theme-base);\n background: var(--_option-focus-bg);\n }\n\n /* The muted dead-draft row: explains the degradation instead of closing silently.\n Follows the combobox \"no-results\" presentation pattern. */\n .no-match {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n height: var(--query-bar-option-height, 36px);\n padding: var(--size-1) var(--size-2-5);\n font-size: var(--text-sm);\n line-height: var(--leading-normal);\n color: var(--text-color-tertiary);\n border-radius: var(--rounded-sm);\n }\n\n .option-label {\n flex: 0 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* The muted second column names the dimension a value belongs to, or the\n `key:` syntax a key suggestion inserts. */\n .option-meta {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--text-xs);\n color: var(--text-color-tertiary);\n text-align: end;\n white-space: nowrap;\n }\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ var e=`@layer refine.base{:host{--_dropdown-bg:var(--combobox-dropdown-bg,var(--color-canvas));--_dropdown-border-color:var(--combobox-dropdown-border-color,var(--color-contrast-200));--_option-hover-bg:var(--combobox-option-hover-bg,var(--color-contrast-100));--_option-focus-bg:var(--combobox-option-focus-bg,color-mix(in oklch, var(--_theme-base) 12%, var(--color-contrast-100)));min-width:var(--query-bar-min-width,12rem);flex-direction:column;align-items:stretch;display:inline-flex}.trigger::part(input){cursor:text}.trigger::part(field){height:auto;min-height:var(--input-height,var(--size-10))}.trigger::part(input-row){row-gap:var(--size-1);flex-wrap:wrap;align-items:center}.prefix{display:contents}.prefix>ore-icon{color:var(--text-color-tertiary);flex-shrink:0}.prefix>ore-icon:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){margin-right:var(--size-1)}.prefix>ore-icon:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){margin-left:var(--size-1)}.pills{display:contents}.prefix ore-chip{flex:none}.prefix ore-chip:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){margin-right:var(--size-1)}.prefix ore-chip:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){margin-left:var(--size-1)}.suffix{gap:var(--size-1);flex-shrink:0;align-items:center;display:flex}.clear-btn{color:var(--color-contrast-400);cursor:pointer;background:0 0;border:0;flex-shrink:0;align-items:center;padding:0;display:inline-flex}.clear-btn[hidden]{display:none}.clear-btn:hover{color:var(--color-contrast-600)}.clear-btn:focus-visible{outline:var(--border-2) solid var(--_theme-focus);outline-offset:var(--border);border-radius:var(--rounded-sm)}.dropdown{z-index:calc(var(--z-popover,1000) + 1);box-sizing:border-box;min-width:var(--query-bar-dropdown-min-width,16rem);max-width:var(--query-bar-dropdown-max-width,min(28rem, calc(100vw - var(--size-4))));max-height:min(16rem,50dvh);padding:var(--size-1);overscroll-behavior:contain;pointer-events:none;scrollbar-width:thin;background:var(--_dropdown-bg);border:var(--border) solid var(--_dropdown-border-color);border-radius:var(--_radius);box-shadow:var(--shadow-lg);opacity:0;-webkit-backdrop-filter:blur(var(--blur-md));backdrop-filter:blur(var(--blur-md));transform:translateY(var(--overlay-enter-translate-y));transition:var(--_motion-transition,opacity var(--transition-fast), transform var(--transition-fast), display var(--transition-fast) allow-discrete);margin:0;position:fixed;inset:0 auto auto 0;overflow-y:auto}.dropdown:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){text-align:left}.dropdown:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){text-align:right}.dropdown[data-open]{pointer-events:auto;opacity:1;transform:translateY(0)}@starting-style{.dropdown[data-open]{opacity:0;transform:translateY(var(--overlay-enter-translate-y))}}.option{box-sizing:border-box;gap:var(--size-2);height:var(--query-bar-option-height,36px);padding:var(--size-1) var(--size-2-5);font-size:var(--text-sm);line-height:var(--leading-normal);cursor:pointer;border-radius:var(--rounded-sm);transition:background var(--transition-fast), color var(--transition-fast);align-items:baseline;display:flex}.option:hover{background:var(--_option-hover-bg)}.option[data-focused]{color:var(--_theme-base);background:var(--_option-focus-bg)}.no-match{box-sizing:border-box;height:var(--query-bar-option-height,36px);padding:var(--size-1) var(--size-2-5);font-size:var(--text-sm);line-height:var(--leading-normal);color:var(--text-color-tertiary);border-radius:var(--rounded-sm);align-items:center;display:flex}.option-label{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;overflow:hidden}.option-meta{text-overflow:ellipsis;min-width:0;font-size:var(--text-xs);color:var(--text-color-tertiary);white-space:nowrap;flex:1;overflow:hidden}.option-meta:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){text-align:right}.option-meta:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){text-align:left}}`;export{e as default};
2
+ //# sourceMappingURL=query-bar.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar.css.js","names":[],"sources":["../../../src/inputs/query-bar/query-bar.css?inline"],"sourcesContent":["@layer refine.base {\n :host {\n --_dropdown-bg: var(--combobox-dropdown-bg, var(--color-canvas));\n --_dropdown-border-color: var(--combobox-dropdown-border-color, var(--color-contrast-200));\n --_option-hover-bg: var(--combobox-option-hover-bg, var(--color-contrast-100));\n --_option-focus-bg: var(\n --combobox-option-focus-bg,\n color-mix(in oklch, var(--_theme-base) 12%, var(--color-contrast-100))\n );\n\n display: inline-flex;\n flex-direction: column;\n align-items: stretch;\n min-width: var(--query-bar-min-width, 12rem);\n }\n\n :host([open]) {\n /* Nothing yet: the open state is reflected for consumer styling. */\n }\n\n /* ore-input cursor override so the field still feels like a text input */\n .trigger::part(input) {\n cursor: text;\n }\n\n /* Allow the field to grow vertically when pills wrap to multiple rows. */\n .trigger::part(field) {\n height: auto;\n min-height: var(--input-height, var(--size-10));\n }\n\n /* Wrap pills + input across rows; the suffix stays on the input's row.\n Only row-gap is set here: spacing between pills is handled via margin on\n ore-chip so the empty prefix adds no extra offset. */\n .trigger::part(input-row) {\n flex-wrap: wrap;\n row-gap: var(--size-1);\n align-items: center;\n }\n\n /* ========================================\n Prefix: search icon + pill tokens\n ======================================== */\n\n /* display:contents removes the prefix wrapper from the flex layout so the\n icon and chips become direct flex items of input-row. */\n .prefix {\n display: contents;\n }\n\n .prefix > ore-icon {\n flex-shrink: 0;\n margin-inline-end: var(--size-1);\n color: var(--text-color-tertiary);\n }\n\n /* .pills is also display:contents so individual ore-chip elements are the\n direct flex items, wrapping inline with the search input. */\n .pills {\n display: contents;\n }\n\n /* Trailing space after each chip covers both inter-chip spacing and\n the gap between the last chip and the search input. Pills never shrink:\n they keep their readable size and wrap instead. */\n .prefix ore-chip {\n flex: none;\n margin-inline-end: var(--size-1);\n }\n\n /* ========================================\n Suffix: clear button\n ======================================== */\n\n .suffix {\n display: flex;\n flex-shrink: 0;\n gap: var(--size-1);\n align-items: center;\n }\n\n .clear-btn {\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n padding: 0;\n color: var(--color-contrast-400);\n cursor: pointer;\n background: none;\n border: 0;\n }\n\n .clear-btn[hidden] {\n display: none;\n }\n\n .clear-btn:hover {\n color: var(--color-contrast-600);\n }\n\n .clear-btn:focus-visible {\n outline: var(--border-2) solid var(--_theme-focus);\n outline-offset: var(--border);\n border-radius: var(--rounded-sm);\n }\n\n /* ========================================\n Dropdown / Listbox\n ======================================== */\n\n .dropdown {\n position: fixed;\n inset: 0 auto auto 0;\n z-index: calc(var(--z-popover, 1000) + 1);\n box-sizing: border-box;\n min-width: var(--query-bar-dropdown-min-width, 16rem);\n max-width: var(--query-bar-dropdown-max-width, min(28rem, calc(100vw - var(--size-4))));\n max-height: min(16rem, 50dvh);\n padding: var(--size-1);\n margin: 0;\n overflow-y: auto;\n overscroll-behavior: contain;\n text-align: start;\n pointer-events: none;\n scrollbar-width: thin;\n background: var(--_dropdown-bg);\n border: var(--border) solid var(--_dropdown-border-color);\n border-radius: var(--_radius);\n box-shadow: var(--shadow-lg);\n opacity: 0;\n backdrop-filter: blur(var(--blur-md));\n transform: translateY(var(--overlay-enter-translate-y));\n transition: var(\n --_motion-transition,\n opacity var(--transition-fast),\n transform var(--transition-fast),\n display var(--transition-fast) allow-discrete\n );\n }\n\n .dropdown[data-open] {\n pointer-events: auto;\n opacity: 1;\n transform: translateY(0);\n\n @starting-style {\n opacity: 0;\n transform: translateY(var(--overlay-enter-translate-y));\n }\n }\n\n /* ========================================\n Suggestion rows\n ======================================== */\n\n .option {\n box-sizing: border-box;\n display: flex;\n gap: var(--size-2);\n align-items: baseline;\n height: var(--query-bar-option-height, 36px);\n padding: var(--size-1) var(--size-2-5);\n font-size: var(--text-sm);\n line-height: var(--leading-normal);\n cursor: pointer;\n border-radius: var(--rounded-sm);\n transition:\n background var(--transition-fast),\n color var(--transition-fast);\n }\n\n .option:hover {\n background: var(--_option-hover-bg);\n }\n\n .option[data-focused] {\n color: var(--_theme-base);\n background: var(--_option-focus-bg);\n }\n\n /* The muted dead-draft row: explains the degradation instead of closing silently.\n Follows the combobox \"no-results\" presentation pattern. */\n .no-match {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n height: var(--query-bar-option-height, 36px);\n padding: var(--size-1) var(--size-2-5);\n font-size: var(--text-sm);\n line-height: var(--leading-normal);\n color: var(--text-color-tertiary);\n border-radius: var(--rounded-sm);\n }\n\n .option-label {\n flex: 0 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* The muted second column names the dimension a value belongs to, or the\n `key:` syntax a key suggestion inserts. */\n .option-meta {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--text-xs);\n color: var(--text-color-tertiary);\n text-align: end;\n white-space: nowrap;\n }\n}\n"],"mappings":""}
@@ -0,0 +1,68 @@
1
+ export { CHIP_TAG } from '../../feedback/chip/chip';
2
+ export { INPUT_TAG } from '../input/input';
3
+ export type { OreQueryBarEvents, OreQueryBarProps } from './query-bar.types';
4
+ export * from './query-bar-grammar';
5
+ /**
6
+ * A search field that accepts free text and `key:value` tokens together, in the
7
+ * grammar GitHub's pull-request search made familiar. Committed tokens render as
8
+ * removable pills inside the field; a suggestion dropdown lists the vocabulary's
9
+ * keys and matching values while typing, so phones never need to type a colon.
10
+ *
11
+ * The bar is state-driven: `vocabulary` defines the token keys and their accepted
12
+ * values, `state` carries `{ text, tokens }`, and every edit emits `input` +
13
+ * `change` with the new state readable from the element's `state` property. Omit
14
+ * `state` for uncontrolled use. External `state` writes whose `tokens` array is
15
+ * identical to the current one are treated as echoes — only token changes are
16
+ * adopted — so text-only round-trips never wipe the field's live draft.
17
+ *
18
+ * The dropdown opens while the field holds focus (and reopens on typing after
19
+ * Escape) and overlays the page from the top layer. Picking a key suggestion
20
+ * starts composing `key:`; picking a value commits its pill. Typing a complete
21
+ * `key:value` commits immediately. Backspace on an empty field removes the last
22
+ * pill. A draft whose value matches nothing shows a "searching as text" row
23
+ * instead of closing; on blur, a bare `key:` fragment reverts and a dead draft
24
+ * degrades into the searched text, so the field never carries silent residue.
25
+ *
26
+ * @element ore-query-bar
27
+ *
28
+ * @attr {string} label - Accessible name for the entry field
29
+ * @attr {string} placeholder - Field placeholder, typically the surface's search hint
30
+ * @attr {string} error - Inline error under the field
31
+ * @attr {string} helper - Helper text under the field
32
+ * @attr {boolean} hide-label - Hide the visible label while keeping its accessible name
33
+ * @attr {boolean} clearable - Show a clear (×) button; it clears the free text only
34
+ * @attr {boolean} disabled - Disable the whole bar
35
+ * @attr {string} size - Field size: 'sm' | 'md' | 'lg'
36
+ * @attr {string} rounded - Field radius: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full'
37
+ * @attr {string} variant - Field variant: 'flat' | 'solid' | 'bordered' | 'outline' | 'ghost'
38
+ *
39
+ * @prop {QueryState} state - The controlled query state; write a new object to apply external changes
40
+ * @prop {QueryTokenDef[]} vocabulary - The token vocabulary
41
+ *
42
+ * @fires input - The query changed; read the new state from the `state` property
43
+ * @fires change - Same as `input`
44
+ * @fires open-change - The suggestion dropdown opened or closed. detail: { open, reason }
45
+ *
46
+ * @part wrapper - The ore-input field host
47
+ * @part dropdown - The suggestion dropdown container
48
+ * @cssprop --query-bar-min-width - Minimum host width (default 12rem)
49
+ * @cssprop --query-bar-icon-size - Leading search icon size (default 16px)
50
+ * @cssprop --query-bar-option-height - Suggestion row height (default 36px)
51
+ * @cssprop --query-bar-dropdown-min-width - Dropdown panel minimum width (default 16rem)
52
+ * @cssprop --query-bar-dropdown-max-width - Dropdown panel maximum width (default 28rem, viewport-capped)
53
+ * @cssprop --chip-* - Pill styling (see ore-chip)
54
+ * @cssprop --combobox-dropdown-* - Dropdown panel and option styling (see ore-combobox)
55
+ *
56
+ * @example
57
+ * ```html
58
+ * <ore-query-bar id="bar" label="Search issues" placeholder="Title, author or label…" clearable>
59
+ * </ore-query-bar>
60
+ * <script>
61
+ * bar.vocabulary = [
62
+ * { key: 'author', label: 'Author', options: [{ label: 'Alice', value: 'alice' }] },
63
+ * ];
64
+ * </script>
65
+ * ```
66
+ */
67
+ export declare const QUERY_BAR_TAG: "ore-query-bar";
68
+ //# sourceMappingURL=query-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar.d.ts","sourceRoot":"","sources":["../../../src/inputs/query-bar/query-bar.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,cAAc,qBAAqB,CAAC;AAKpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,aAAa,EAAG,eAAwB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { QueryState, QueryToken, QueryTokenDef } from './query-bar-grammar';
2
+ /** Component properties for `ore-query-bar`. */
3
+ export type OreQueryBarProps = {
4
+ /** Show the field's own clear (×) button; it clears the free text only. */
5
+ clearable?: boolean;
6
+ /** Disable the whole bar: field, suggestions, and pill removal. */
7
+ disabled?: boolean;
8
+ /** Inline error under the field, e.g. a server-side search-length message. */
9
+ error?: string;
10
+ /** Helper text under the field. */
11
+ helper?: string;
12
+ /** Hide the visible label while keeping its accessible name. */
13
+ 'hide-label'?: boolean;
14
+ /** Accessible name for the entry field. */
15
+ label?: string;
16
+ /** Field placeholder, typically the surface's search hint. */
17
+ placeholder?: string;
18
+ /** Border radius: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full'. */
19
+ rounded?: string;
20
+ /** Component size: 'sm' | 'md' | 'lg'. */
21
+ size?: string;
22
+ /** The controlled query state. Omit for uncontrolled use; write a new object (with a
23
+ * different `tokens` array) to apply external changes such as deep-link presets. */
24
+ state?: QueryState;
25
+ /** Field variant: 'flat' | 'solid' | 'bordered' | 'outline' | 'ghost'. */
26
+ variant?: string;
27
+ /** The token vocabulary: which keys exist and which values each accepts. */
28
+ vocabulary?: QueryTokenDef[];
29
+ };
30
+ export type OreQueryBarEvents = {
31
+ /** The query changed: free text edited, a token committed, or a token removed. */
32
+ change: void;
33
+ /** Same as `change`; read the new query from the host's `state` property. */
34
+ input: void;
35
+ /** The suggestion dropdown opened or closed. detail: { open, reason } */
36
+ 'open-change': {
37
+ open: boolean;
38
+ reason: string;
39
+ };
40
+ };
41
+ export type { QueryState, QueryToken, QueryTokenDef };
42
+ //# sourceMappingURL=query-bar.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bar.types.d.ts","sourceRoot":"","sources":["../../../src/inputs/query-bar/query-bar.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjF,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;yFACqF;IACrF,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kFAAkF;IAClF,MAAM,EAAE,IAAI,CAAC;IACb,6EAA6E;IAC7E,KAAK,EAAE,IAAI,CAAC;IACZ,yEAAyE;IACzE,aAAa,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC"}
package/dist/navbar.cjs CHANGED
@@ -48,7 +48,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
48
48
  <slot name="mobile-menu"></slot>
49
49
  </div>
50
50
  </nav>
51
- `},styles:[n.colorThemeMixin,n.elevationMixin,t.roundedVariantMixin,e.coarsePointerMixin,e.reducedMotionMixin,r.frostVariantMixin(`.navbar`),s.default]});var p=`ore-navbar-item`;(0,u.define)(p,{props:{active:u.prop.bool(!1),ariaLabel:u.prop.string(),disabled:u.prop.bool(!1),href:u.prop.string(),"icon-only":u.prop.bool(!1),rel:u.prop.string(),target:u.prop.string()},setup(e){let t=(0,u.useSlots)(),hasIcon=()=>t.has(`icon`).value,hasEnd=()=>t.has(`end`).value,n=(0,u.inject)(d);(0,u.bind)({attr:{"navbar-mobile":()=>n?.isMobile.value?!0:void 0,"navbar-mobile-open":()=>n?.mobileMenuOpen.value?!0:void 0}});let isLink=()=>!!e.href.value&&!e.disabled.value,r=(0,c.computed)(()=>a.computeSafeRel(e.rel.value,e.target.value)),closeMobileMenuIfOpen=()=>{n?.mobileMenuOpen.value&&n.closeMobileMenu()},renderItemContent=()=>u.html`
51
+ `},styles:[n.colorThemeMixin,n.elevationMixin,t.roundedVariantMixin,e.coarsePointerMixin,e.reducedMotionMixin,r.frostVariantMixin(`.navbar`),s.default]});var p=`ore-navbar-item`;(0,u.define)(p,{props:{active:u.prop.bool(!1),ariaLabel:u.prop.string(),disabled:u.prop.bool(!1),href:u.prop.string(),"icon-only":u.prop.bool(!1),rel:u.prop.string(),target:u.prop.string()},setup(e){let t=(0,u.useSlots)(),hasIcon=()=>t.has(`icon`).value,hasEnd=()=>t.has(`end`).value,n=(0,u.inject)(d);(0,u.bind)({attr:{"navbar-mobile":()=>n?.isMobile.value?!0:void 0,"navbar-mobile-open":()=>n?.mobileMenuOpen.value?!0:void 0}});let isLink=()=>!!e.href.value&&!e.disabled.value,r=(0,c.computed)(()=>a.computeSafeRel(e.rel.value,e.target.value)),i=(0,c.computed)(()=>{if(!e.active.value)return null;let t=e.href.value;return t!==void 0&&t.startsWith(`#`)?`location`:`page`}),closeMobileMenuIfOpen=()=>{n?.mobileMenuOpen.value&&n.closeMobileMenu()},renderItemContent=()=>u.html`
52
52
  <span class="item-icon" part="item-icon" ?hidden=${()=>!hasIcon()} aria-hidden="true">
53
53
  <slot name="icon"></slot>
54
54
  </span>
@@ -65,7 +65,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
65
65
  rel="${r}"
66
66
  target="${e.target}"
67
67
  aria-label="${()=>e.ariaLabel.value??null}"
68
- aria-current="${()=>e.active.value?`page`:null}"
68
+ aria-current="${i}"
69
69
  @click=${closeMobileMenuIfOpen}>
70
70
  ${renderItemContent()}
71
71
  </a>