elastic-input 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  import { Token } from '../lexer/tokens';
2
-
3
2
  export interface ParenMatch {
4
3
  openStart: number;
5
4
  closeStart: number;
@@ -1,6 +1,5 @@
1
1
  import { Token } from '../lexer/tokens';
2
2
  import { ColorConfig } from '../types';
3
-
4
3
  export type RangePartType = 'bracket' | 'toKeyword' | 'bareValue' | 'quotedValue' | 'wildcard' | 'whitespace';
5
4
  export interface RangePart {
6
5
  type: RangePartType;
@@ -1,6 +1,5 @@
1
1
  import { Token } from '../lexer/tokens';
2
2
  import { ColorConfig } from '../types';
3
-
4
3
  export type RegexPartType = 'delimiter' | 'charClass' | 'groupOpen' | 'groupClose' | 'escape' | 'quantifier' | 'anchor' | 'alternation' | 'text';
5
4
  export interface RegexPart {
6
5
  type: RegexPartType;
@@ -1,5 +1,4 @@
1
1
  import { Token } from './tokens';
2
-
3
2
  export interface LexerOptions {
4
3
  /** Recognize `#name` as SAVED_SEARCH tokens. @default false */
5
4
  savedSearches?: boolean;
@@ -1,6 +1,5 @@
1
1
  import { Token } from '../lexer/tokens';
2
2
  import { ASTNode, ErrorNode } from './ast';
3
-
4
3
  export type CursorContextType = 'FIELD_NAME' | 'FIELD_VALUE' | 'OPERATOR' | 'RANGE' | 'SAVED_SEARCH' | 'HISTORY_REF' | 'EMPTY';
5
4
  export interface CursorContext {
6
5
  type: CursorContextType;
@@ -1,5 +1,4 @@
1
1
  import { ColorConfig, StyleConfig } from '../types';
2
-
3
2
  type Styles = {
4
3
  [key: string]: React.CSSProperties;
5
4
  };
package/dist/types.d.ts CHANGED
@@ -158,6 +158,8 @@ export interface StyleConfig {
158
158
  fontFamily?: string;
159
159
  /** Base font size for the input. */
160
160
  fontSize?: string;
161
+ /** Line height for the input text and placeholder. @default '1.5' */
162
+ lineHeight?: string;
161
163
  /** Minimum height of the input element. */
162
164
  inputMinHeight?: string;
163
165
  /** Padding inside the input element. */
@@ -280,6 +282,12 @@ export interface DropdownConfig {
280
282
  cursorContext: CursorContext;
281
283
  partial: string;
282
284
  }) => React.ReactNode | null | undefined;
285
+ /** Controls the type badge shown in dropdown items.
286
+ * - `false` — hide the badge entirely
287
+ * - `true` (default) — show the raw `suggestion.type` string
288
+ * - callback `(type, suggestion) => ReactNode` — custom render per item; return null to hide
289
+ */
290
+ renderType?: boolean | ((type: string, suggestion: SuggestionItem) => React.ReactNode | null | undefined);
283
291
  }
284
292
  /**
285
293
  * Feature toggles for optional editing behaviors. All default to false except `multiline`.
@@ -1,6 +1,5 @@
1
1
  import { ASTNode } from '../parser/ast';
2
2
  import { Token } from '../lexer/tokens';
3
-
4
3
  export interface SelectionRange {
5
4
  start: number;
6
5
  end: number;
@@ -1,5 +1,4 @@
1
1
  import { ASTNode } from '../parser/ast';
2
-
3
2
  /**
4
3
  * Describes a content value extracted from the AST.
5
4
  *
@@ -1,5 +1,4 @@
1
1
  import { ASTNode } from '../parser/ast';
2
-
3
2
  /** Options for `formatQuery` pretty-printing. */
4
3
  export interface FormatQueryOptions {
5
4
  /** Max length before a line is broken into multiple lines. @default 60 */
@@ -1,5 +1,4 @@
1
1
  import { Token } from '../lexer/tokens';
2
-
3
2
  /**
4
3
  * Determine the selection range for a smart Ctrl+A press.
5
4
  *
@@ -1,5 +1,4 @@
1
1
  import { Token } from '../lexer/tokens';
2
-
3
2
  /**
4
3
  * Normalize typographic/smart characters to their ASCII equivalents.
5
4
  * Handles smart quotes (from Outlook, Word, macOS auto-correct, etc.),
@@ -1,7 +1,6 @@
1
1
  import { ASTNode } from '../parser/ast';
2
2
  import { FieldConfig, ValidateReturn, ValidateValueContext } from '../types';
3
3
  import { ParseDateFn } from './dateValidator';
4
-
5
4
  /** Callback type for external value validation. */
6
5
  export type ValidateValueFn = (context: ValidateValueContext) => ValidateReturn;
7
6
  /** A validation or syntax error with character offsets for squiggly underline display. */
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "elastic-input",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Syntax-aware smart autocomplete input for Elastic query syntax",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/krtools/elastic-input.git"
8
+ "url": "git+https://github.com/krtools/elastic-input.git"
9
9
  },
10
10
  "homepage": "https://github.com/krtools/elastic-input#readme",
11
11
  "bugs": {
@@ -40,7 +40,6 @@
40
40
  "dev": "vite --config vite.demo.config.js",
41
41
  "build": "vite build",
42
42
  "build:demo": "vite build --config vite.demo.config.js",
43
- "deploy:pages": "npm run build:demo && gh-pages -d dist-demo",
44
43
  "test": "vitest run",
45
44
  "test:watch": "vitest",
46
45
  "prepack": "npx tsc --noEmit && npm test && vite build"
@@ -60,15 +59,13 @@
60
59
  "react-dom": ">=16.8.0"
61
60
  },
62
61
  "devDependencies": {
63
- "@changesets/cli": "^2.30.0",
64
62
  "@types/react": "^16.14.0",
65
63
  "@types/react-dom": "^16.9.0",
66
- "gh-pages": "^6.3.0",
67
64
  "react": "^16.14.0",
68
65
  "react-dom": "^16.14.0",
69
66
  "typescript": "^5.3.0",
70
- "vite": "^5.4.0",
71
- "vite-plugin-dts": "^3.9.0",
67
+ "vite": "^8.0.3",
68
+ "vite-plugin-dts": "^4.5.4",
72
69
  "vitest": "^4.1.0"
73
70
  }
74
71
  }