siesa-ui-kit 1.0.12 → 1.0.14
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/dist/components/LookupField/LookupField.d.ts +6 -0
- package/dist/components/LookupField/LookupField.d.ts.map +1 -0
- package/dist/components/LookupField/LookupField.types.d.ts +285 -0
- package/dist/components/LookupField/LookupField.types.d.ts.map +1 -0
- package/dist/components/LookupField/__stories__/DocComponents.d.ts +37 -0
- package/dist/components/LookupField/__stories__/DocComponents.d.ts.map +1 -0
- package/dist/components/LookupField/__stories__/mocks/browser.d.ts +2 -0
- package/dist/components/LookupField/__stories__/mocks/browser.d.ts.map +1 -0
- package/dist/components/LookupField/__stories__/mocks/data.d.ts +38 -0
- package/dist/components/LookupField/__stories__/mocks/data.d.ts.map +1 -0
- package/dist/components/LookupField/__stories__/mocks/handlers.d.ts +3 -0
- package/dist/components/LookupField/__stories__/mocks/handlers.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/index.d.ts +10 -0
- package/dist/components/LookupField/hooks/index.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/useClickOutside.d.ts +11 -0
- package/dist/components/LookupField/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/useDebouncedSearch.d.ts +2 -0
- package/dist/components/LookupField/hooks/useDebouncedSearch.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/useFloatingDropdown.d.ts +38 -0
- package/dist/components/LookupField/hooks/useFloatingDropdown.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/useKeyboardNavigation.d.ts +16 -0
- package/dist/components/LookupField/hooks/useKeyboardNavigation.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/useTranslationSafe.d.ts +9 -0
- package/dist/components/LookupField/hooks/useTranslationSafe.d.ts.map +1 -0
- package/dist/components/LookupField/hooks/useVirtualList.d.ts +40 -0
- package/dist/components/LookupField/hooks/useVirtualList.d.ts.map +1 -0
- package/dist/components/LookupField/index.d.ts +7 -0
- package/dist/components/LookupField/index.d.ts.map +1 -0
- package/dist/components/LookupField/parts/LiveRegion.d.ts +6 -0
- package/dist/components/LookupField/parts/LiveRegion.d.ts.map +1 -0
- package/dist/components/LookupField/parts/SearchInput.d.ts +11 -0
- package/dist/components/LookupField/parts/SearchInput.d.ts.map +1 -0
- package/dist/components/LookupField/services/api.d.ts +23 -0
- package/dist/components/LookupField/services/api.d.ts.map +1 -0
- package/dist/components/LookupField/services/api.types.d.ts +74 -0
- package/dist/components/LookupField/services/api.types.d.ts.map +1 -0
- package/dist/components/LookupField/services/index.d.ts +4 -0
- package/dist/components/LookupField/services/index.d.ts.map +1 -0
- package/dist/components/LookupField/types/filter.types.d.ts +51 -0
- package/dist/components/LookupField/types/filter.types.d.ts.map +1 -0
- package/dist/components/LookupField/utils/cn.d.ts +3 -0
- package/dist/components/LookupField/utils/cn.d.ts.map +1 -0
- package/dist/components/LookupField/utils/filterBuilder.d.ts +35 -0
- package/dist/components/LookupField/utils/filterBuilder.d.ts.map +1 -0
- package/dist/components/LookupField/utils/index.d.ts +4 -0
- package/dist/components/LookupField/utils/index.d.ts.map +1 -0
- package/dist/components/LookupField/utils/templateInterpolation.d.ts +13 -0
- package/dist/components/LookupField/utils/templateInterpolation.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/siesa-ui-kit.cjs +230 -227
- package/dist/siesa-ui-kit.cjs.map +1 -1
- package/dist/siesa-ui-kit.mjs +8567 -2866
- package/dist/siesa-ui-kit.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +16 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LookupFieldProps, LookupFieldRef, LookupRecord } from './LookupField.types';
|
|
2
|
+
import './LookupField.css';
|
|
3
|
+
export declare const LookupField: <TRecord extends LookupRecord = LookupRecord>(props: LookupFieldProps<TRecord> & {
|
|
4
|
+
ref?: React.Ref<LookupFieldRef<TRecord>>;
|
|
5
|
+
}) => React.ReactElement;
|
|
6
|
+
//# sourceMappingURL=LookupField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LookupField.d.ts","sourceRoot":"","sources":["../../../src/components/LookupField/LookupField.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,mBAAmB,CAAA;AA4gC1B,eAAO,MAAM,WAAW,EAAmC,CACzD,OAAO,SAAS,YAAY,GAAG,YAAY,EAE3C,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;CAAE,KAC5E,KAAK,CAAC,YAAY,CAGtB"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import type { FilterExpression, SimpleFilter } from './types/filter.types';
|
|
2
|
+
import type { Fetcher, OrderBy } from './services/api.types';
|
|
3
|
+
/** Generic record type - all records must have an Id (PascalCase standard) */
|
|
4
|
+
export interface LookupRecord {
|
|
5
|
+
Id: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
/** Data passed to onReady callback [UPDATED v0.4 - removed totalRecords] */
|
|
9
|
+
export interface LookupFieldReadyData {
|
|
10
|
+
/** Whether the first page of data has been loaded */
|
|
11
|
+
firstPageLoaded: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Imperative ref methods for programmatic control */
|
|
14
|
+
export interface LookupFieldRef<TRecord extends LookupRecord = LookupRecord> {
|
|
15
|
+
/** Clears the current selection */
|
|
16
|
+
clear: () => void;
|
|
17
|
+
/** Focuses the component trigger */
|
|
18
|
+
focus: () => void;
|
|
19
|
+
/** Forces a fresh data fetch from API */
|
|
20
|
+
reload: () => void;
|
|
21
|
+
/** Returns the currently selected record or null */
|
|
22
|
+
getValue: () => TRecord | null;
|
|
23
|
+
/** Programmatically selects a record by GUID */
|
|
24
|
+
setValue: (Id: string) => void;
|
|
25
|
+
/** Opens the dropdown programmatically */
|
|
26
|
+
open: () => void;
|
|
27
|
+
/** Closes the dropdown programmatically */
|
|
28
|
+
close: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Manually triggers validation and updates internal error state.
|
|
31
|
+
* Use this before form submission to validate required fields.
|
|
32
|
+
* Calls onValidationChange callback with the validation result.
|
|
33
|
+
* @returns true if valid (has selection or not required), false if invalid
|
|
34
|
+
*/
|
|
35
|
+
validate: () => boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Props for LookupField component */
|
|
38
|
+
export interface LookupFieldProps<TRecord extends LookupRecord = LookupRecord> {
|
|
39
|
+
/** Entity name for API endpoint (e.g., 'customers', 'products') */
|
|
40
|
+
entity: string;
|
|
41
|
+
/** Label displayed above the input. Optional when used in table columns where the column header provides the label. */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Fields to display in dropdown options */
|
|
44
|
+
displayFields: (keyof TRecord & string)[];
|
|
45
|
+
/** Currently selected record ID (GUID) or null */
|
|
46
|
+
value: string | null;
|
|
47
|
+
/** Callback when selection changes */
|
|
48
|
+
onChange: (record: TRecord | null, previousRecord: TRecord | null) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Fetcher function for API requests (FR29, FR31).
|
|
51
|
+
* Receives entity name and request, returns the search response.
|
|
52
|
+
* Gives full control over URL construction, HTTP client, headers, etc.
|
|
53
|
+
*
|
|
54
|
+
* Use `createFetcher('/api')` helper for simple cases.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // Using createFetcher helper
|
|
58
|
+
* import { createFetcher } from 'siesa-ui-kit'
|
|
59
|
+
* <LookupField fetcher={createFetcher('/api')} />
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // With auth token
|
|
63
|
+
* <LookupField
|
|
64
|
+
* fetcher={async (entity, request) => {
|
|
65
|
+
* const res = await fetch(`/api/${entity}/search`, {
|
|
66
|
+
* method: 'POST',
|
|
67
|
+
* headers: {
|
|
68
|
+
* 'Content-Type': 'application/json',
|
|
69
|
+
* Authorization: `Bearer ${token}`,
|
|
70
|
+
* },
|
|
71
|
+
* body: JSON.stringify(request),
|
|
72
|
+
* })
|
|
73
|
+
* return res.json()
|
|
74
|
+
* }}
|
|
75
|
+
* />
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // With axios
|
|
79
|
+
* <LookupField
|
|
80
|
+
* fetcher={async (entity, request) => {
|
|
81
|
+
* const { data } = await axios.post(`/api/${entity}/search`, request)
|
|
82
|
+
* return data
|
|
83
|
+
* }}
|
|
84
|
+
* />
|
|
85
|
+
*/
|
|
86
|
+
fetcher: Fetcher;
|
|
87
|
+
/** Show clear button to reset selection (default: true) */
|
|
88
|
+
clearable?: boolean;
|
|
89
|
+
/** Placeholder text when no value selected */
|
|
90
|
+
placeholder?: string;
|
|
91
|
+
/** Additional CSS classes for root element */
|
|
92
|
+
className?: string;
|
|
93
|
+
/** Number of records per page (default: 10) */
|
|
94
|
+
pageSize?: number;
|
|
95
|
+
/** Callback triggered when an API error occurs */
|
|
96
|
+
onError?: (error: Error) => void;
|
|
97
|
+
/** Fields to search against (defaults to displayFields) */
|
|
98
|
+
searchFields?: (keyof TRecord & string)[];
|
|
99
|
+
/**
|
|
100
|
+
* Minimum number of characters required before search is triggered.
|
|
101
|
+
* When user types fewer characters, a message is shown prompting for more input.
|
|
102
|
+
* @default 1
|
|
103
|
+
*/
|
|
104
|
+
minChars?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Single field to display for selected value (priority 3).
|
|
107
|
+
* When set, only this field is shown in the trigger for the selected record.
|
|
108
|
+
* Priority order: renderSelected > displayTemplate > displayValue > all displayFields concatenated
|
|
109
|
+
*/
|
|
110
|
+
displayValue?: keyof TRecord & string;
|
|
111
|
+
/**
|
|
112
|
+
* Template string with {field} placeholders for selected value display (priority 2).
|
|
113
|
+
* Example: "{codigo} - {nombre}" displays "C001 - Acme Corporation"
|
|
114
|
+
* Priority order: renderSelected > displayTemplate > displayValue > all displayFields concatenated
|
|
115
|
+
*/
|
|
116
|
+
displayTemplate?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Custom render function for selected value display (priority 1 - highest).
|
|
119
|
+
* Receives the selected record and returns the string to display.
|
|
120
|
+
* Priority order: renderSelected > displayTemplate > displayValue > all displayFields concatenated
|
|
121
|
+
*/
|
|
122
|
+
renderSelected?: (record: TRecord) => string;
|
|
123
|
+
/**
|
|
124
|
+
* Static filters to apply to all API requests.
|
|
125
|
+
* Accepts simple object format: { activo: true, tipo: "A" }
|
|
126
|
+
* Or expressive AND/OR format: [[{a:1},{a:2}], [{b:true}]]
|
|
127
|
+
*/
|
|
128
|
+
filters?: SimpleFilter | FilterExpression;
|
|
129
|
+
/**
|
|
130
|
+
* Function that returns dynamic filters.
|
|
131
|
+
* Called before each API request.
|
|
132
|
+
* Takes precedence over static `filters` prop when both provided.
|
|
133
|
+
*/
|
|
134
|
+
getFilters?: () => SimpleFilter | FilterExpression;
|
|
135
|
+
/**
|
|
136
|
+
* Array of dependency values that trigger data reload when changed.
|
|
137
|
+
* Use with `getFilters` to implement cascading lookups.
|
|
138
|
+
*
|
|
139
|
+
* **IMPORTANT:** Values must be JSON-serializable (primitives, plain objects, arrays).
|
|
140
|
+
* Do not include functions, circular references, or non-serializable values.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // Reload cities when countryId changes
|
|
144
|
+
* <LookupField
|
|
145
|
+
* entity="cities"
|
|
146
|
+
* getFilters={() => ({ countryId: selectedCountryId })}
|
|
147
|
+
* dependencies={[selectedCountryId]}
|
|
148
|
+
* />
|
|
149
|
+
*/
|
|
150
|
+
dependencies?: unknown[];
|
|
151
|
+
/**
|
|
152
|
+
* Sort order for API results.
|
|
153
|
+
* If not specified, defaults to first displayField ascending.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* // Sort by name descending
|
|
157
|
+
* <LookupField orderBy={{ field: 'nombre', direction: 'desc' }} />
|
|
158
|
+
*/
|
|
159
|
+
orderBy?: OrderBy;
|
|
160
|
+
/**
|
|
161
|
+
* Additional fields to request from API but not display in dropdown.
|
|
162
|
+
* These fields are available in the record passed to onChange and other callbacks.
|
|
163
|
+
* Useful for accessing related data for business logic.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* // Request email and phone for use in form logic
|
|
167
|
+
* <LookupField<Customer>
|
|
168
|
+
* entity="customers"
|
|
169
|
+
* displayFields={['codigo', 'nombre']}
|
|
170
|
+
* bindFields={['email', 'telefono', 'direccion']}
|
|
171
|
+
* onChange={(customer) => {
|
|
172
|
+
* console.log(customer?.email) // Available!
|
|
173
|
+
* }}
|
|
174
|
+
* />
|
|
175
|
+
*/
|
|
176
|
+
bindFields?: (keyof TRecord & string)[];
|
|
177
|
+
/**
|
|
178
|
+
* Makes the component read-only.
|
|
179
|
+
* When true: selected value is displayed, dropdown cannot open, no clear button.
|
|
180
|
+
* Useful for displaying selected values in view-only forms.
|
|
181
|
+
* @default false
|
|
182
|
+
*/
|
|
183
|
+
readOnly?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Completely disables the component.
|
|
186
|
+
* When true:
|
|
187
|
+
* - Cannot receive focus or be clicked
|
|
188
|
+
* - Removed from tab navigation order (tabIndex=-1)
|
|
189
|
+
* - Shows dimmed/grayed appearance (opacity: 0.5)
|
|
190
|
+
* - Clear button is hidden
|
|
191
|
+
* - No events fire (onChange, onFocus, onBlur)
|
|
192
|
+
* - Validation is skipped (always valid)
|
|
193
|
+
*
|
|
194
|
+
* Use this for fields that are not applicable in the current context
|
|
195
|
+
* (e.g., City field disabled until Country is selected).
|
|
196
|
+
*
|
|
197
|
+
* Note: Different from `readOnly` which allows focus for accessibility
|
|
198
|
+
* but prevents editing. Use `readOnly` for view-only forms,
|
|
199
|
+
* use `disabled` for conditionally unavailable fields.
|
|
200
|
+
*
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
disabled?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Indicates validation error state.
|
|
206
|
+
* When true: red border styling applied, aria-invalid="true".
|
|
207
|
+
* Component remains interactive so user can fix the error.
|
|
208
|
+
* @default false
|
|
209
|
+
*/
|
|
210
|
+
error?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Callback when component receives focus.
|
|
213
|
+
* Fires only once when focus enters the component, not on internal focus changes.
|
|
214
|
+
*/
|
|
215
|
+
onFocus?: (currentRecord: TRecord | null) => void;
|
|
216
|
+
/**
|
|
217
|
+
* Callback when component loses focus.
|
|
218
|
+
* Fires only when focus leaves the entire component, not on internal focus moves.
|
|
219
|
+
*/
|
|
220
|
+
onBlur?: (currentRecord: TRecord | null) => void;
|
|
221
|
+
/**
|
|
222
|
+
* Callback when initial data loads.
|
|
223
|
+
* Provides data info and imperative ref for programmatic control.
|
|
224
|
+
* Fires only once per component mount.
|
|
225
|
+
*/
|
|
226
|
+
onReady?: (data: LookupFieldReadyData, ref: LookupFieldRef<TRecord>) => void;
|
|
227
|
+
/**
|
|
228
|
+
* Callback when value prop contains a non-existent GUID.
|
|
229
|
+
* Use to handle cases where a controlled value no longer exists in the database.
|
|
230
|
+
*/
|
|
231
|
+
onInvalidValue?: (Id: string) => void;
|
|
232
|
+
/**
|
|
233
|
+
* Override text displayed when no results are found.
|
|
234
|
+
* Bypasses i18n translation when provided.
|
|
235
|
+
* @default Uses i18n translation for 'noResults' key
|
|
236
|
+
*/
|
|
237
|
+
noResultsText?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Override placeholder text for the search input inside dropdown.
|
|
240
|
+
* Bypasses i18n translation when provided.
|
|
241
|
+
* @default Uses i18n translation for 'placeholder' key
|
|
242
|
+
*/
|
|
243
|
+
searchPlaceholder?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Marks the field as required for form validation.
|
|
246
|
+
* When true: shows asterisk indicator (unless showRequiredIndicator=false),
|
|
247
|
+
* enables validation on blur (unless validateOnBlur=false),
|
|
248
|
+
* and sets aria-required="true" for accessibility.
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
required?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Controls visibility of the required indicator (asterisk).
|
|
254
|
+
* When undefined, defaults to the value of `required` prop.
|
|
255
|
+
* Set to false to hide asterisk even when field is required.
|
|
256
|
+
* Set to true to show asterisk even when field is not required (unusual).
|
|
257
|
+
* @default undefined (follows `required` prop)
|
|
258
|
+
*/
|
|
259
|
+
showRequiredIndicator?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Enables automatic validation when component loses focus.
|
|
262
|
+
* When true and required, validates that a selection exists on blur.
|
|
263
|
+
* Set to false for manual-only validation via ref.validate().
|
|
264
|
+
* @default true
|
|
265
|
+
*/
|
|
266
|
+
validateOnBlur?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Callback fired when validation state changes.
|
|
269
|
+
* Receives true when validation passes, false when it fails.
|
|
270
|
+
* Useful for form-level validation state management.
|
|
271
|
+
*/
|
|
272
|
+
onValidationChange?: (isValid: boolean) => void;
|
|
273
|
+
/**
|
|
274
|
+
* Custom error message to display below the field.
|
|
275
|
+
* When provided, shows a red error message text beneath the input.
|
|
276
|
+
* Useful for form validation messages from external validation libraries.
|
|
277
|
+
* @example
|
|
278
|
+
* <LookupField
|
|
279
|
+
* errorText={formErrors.customer}
|
|
280
|
+
* error={!!formErrors.customer}
|
|
281
|
+
* />
|
|
282
|
+
*/
|
|
283
|
+
errorText?: string;
|
|
284
|
+
}
|
|
285
|
+
//# sourceMappingURL=LookupField.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LookupField.types.d.ts","sourceRoot":"","sources":["../../../src/components/LookupField/LookupField.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type DocBoxType = 'how' | 'tip' | 'example' | 'warning' | 'code' | 'compare';
|
|
3
|
+
interface DocBoxProps {
|
|
4
|
+
type: DocBoxType;
|
|
5
|
+
title: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function DocBox({ type, title, children }: DocBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface CodeBlockProps {
|
|
10
|
+
children: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function CodeBlock({ children }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
interface DemoContainerProps {
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare function DemoContainer({ title, subtitle, children }: DemoContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
interface DemoGridProps {
|
|
20
|
+
cols?: 1 | 2 | 3;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function DemoGrid({ cols, children }: DemoGridProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
interface PropCodeProps {
|
|
25
|
+
code: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function PropCode({ code }: PropCodeProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
interface ResultBoxProps {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export declare function ResultBox({ children }: ResultBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
interface TestTipProps {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
export declare function TestTip({ children }: TestTipProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=DocComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocComponents.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/__stories__/DocComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAE5E,UAAU,WAAW;IACnB,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;CACpB;AAoBD,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,WAAW,2CAO5D;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,cAAc,2CAMrD;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAQ9E;AAED,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAChB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAQ,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAQ7D;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,aAAa,2CAE/C;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,cAAc,2CAErD;AAED,UAAU,YAAY;IACpB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,2CAMjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../src/components/LookupField/__stories__/mocks/browser.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,mCAA2B,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Customer {
|
|
2
|
+
Id: string;
|
|
3
|
+
Codigo: string;
|
|
4
|
+
Nombre: string;
|
|
5
|
+
Email: string;
|
|
6
|
+
Ciudad: string;
|
|
7
|
+
Telefono: string;
|
|
8
|
+
Activo: boolean;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface Product {
|
|
12
|
+
Id: string;
|
|
13
|
+
Codigo: string;
|
|
14
|
+
Nombre: string;
|
|
15
|
+
Precio: number;
|
|
16
|
+
PrecioDisplay: string;
|
|
17
|
+
Categoria: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface City {
|
|
21
|
+
Id: string;
|
|
22
|
+
Codigo: string;
|
|
23
|
+
Nombre: string;
|
|
24
|
+
CountryId: string;
|
|
25
|
+
Activo: boolean;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export interface Country {
|
|
29
|
+
Id: string;
|
|
30
|
+
Codigo: string;
|
|
31
|
+
Nombre: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
export declare const countries: Country[];
|
|
35
|
+
export declare const cities: City[];
|
|
36
|
+
export declare const customers: Customer[];
|
|
37
|
+
export declare const products: Product[];
|
|
38
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../../src/components/LookupField/__stories__/mocks/data.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,SAAS,EAAE,OAAO,EAI9B,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,IAAI,EAQxB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,QAAQ,EAwI/B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,OAAO,EAiE7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/components/LookupField/__stories__/mocks/handlers.ts"],"names":[],"mappings":"AAqHA,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,SAE9C,CAAA;AAED,eAAO,MAAM,QAAQ,6BA2LpB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useDebouncedSearch } from './useDebouncedSearch';
|
|
2
|
+
export { useKeyboardNavigation } from './useKeyboardNavigation';
|
|
3
|
+
export { useTranslationSafe } from './useTranslationSafe';
|
|
4
|
+
export { useClickOutside } from './useClickOutside';
|
|
5
|
+
export { useFloatingDropdown } from './useFloatingDropdown';
|
|
6
|
+
export { useVirtualList } from './useVirtualList';
|
|
7
|
+
export type { UseKeyboardNavigationOptions, UseKeyboardNavigationResult, } from './useKeyboardNavigation';
|
|
8
|
+
export type { UseFloatingDropdownOptions } from './useFloatingDropdown';
|
|
9
|
+
export type { UseVirtualListOptions, UseVirtualListResult } from './useVirtualList';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AACvE,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to detect clicks outside a referenced element.
|
|
4
|
+
* Uses mousedown for immediate detection.
|
|
5
|
+
*
|
|
6
|
+
* @param ref - Reference to the element to monitor
|
|
7
|
+
* @param handler - Callback when click outside occurs
|
|
8
|
+
* @param enabled - Whether the hook is active (default: true)
|
|
9
|
+
*/
|
|
10
|
+
export declare function useClickOutside<T extends HTMLElement>(ref: RefObject<T | null>, handler: (event: MouseEvent) => void, enabled?: boolean): void;
|
|
11
|
+
//# sourceMappingURL=useClickOutside.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClickOutside.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/useClickOutside.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA0B,MAAM,OAAO,CAAA;AAE9D;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EACnD,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,EACxB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACpC,OAAO,GAAE,OAAc,GACtB,IAAI,CAoBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedSearch.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/useDebouncedSearch.ts"],"names":[],"mappings":"AAIA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAoB,GAAG,MAAM,CAcrF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Placement } from '@floating-ui/react';
|
|
2
|
+
export interface UseFloatingDropdownOptions {
|
|
3
|
+
placement?: Placement;
|
|
4
|
+
offsetPx?: number;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook for dropdown positioning using @floating-ui/react.
|
|
9
|
+
* Handles viewport boundary detection and auto-positioning.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFloatingDropdown({ placement, offsetPx, enabled, }?: UseFloatingDropdownOptions): {
|
|
12
|
+
refs: {
|
|
13
|
+
reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
|
|
14
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
15
|
+
setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
16
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
17
|
+
} & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
18
|
+
floatingStyles: import("react").CSSProperties;
|
|
19
|
+
context: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
placement: Placement;
|
|
23
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
24
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
25
|
+
isPositioned: boolean;
|
|
26
|
+
update: () => void;
|
|
27
|
+
floatingStyles: React.CSSProperties;
|
|
28
|
+
open: boolean;
|
|
29
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
|
|
30
|
+
events: import("@floating-ui/react").FloatingEvents;
|
|
31
|
+
dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
|
|
32
|
+
nodeId: string | undefined;
|
|
33
|
+
floatingId: string | undefined;
|
|
34
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
35
|
+
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=useFloatingDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloatingDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/useFloatingDropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAqB,MAAM,oBAAoB,CAAA;AAEhG,MAAM,WAAW,0BAA0B;IACzC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAA0B,EAC1B,QAAY,EACZ,OAAc,GACf,GAAE,0BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BjC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UseKeyboardNavigationOptions<TRecord> {
|
|
2
|
+
records: TRecord[];
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onSelect: (record: TRecord) => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onEscape: () => void;
|
|
7
|
+
onClear: () => void;
|
|
8
|
+
searchQuery: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UseKeyboardNavigationResult {
|
|
11
|
+
highlightedIndex: number;
|
|
12
|
+
setHighlightedIndex: (index: number) => void;
|
|
13
|
+
handleKeyDown: (event: React.KeyboardEvent) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useKeyboardNavigation<TRecord>(options: UseKeyboardNavigationOptions<TRecord>): UseKeyboardNavigationResult;
|
|
16
|
+
//# sourceMappingURL=useKeyboardNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/useKeyboardNavigation.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,4BAA4B,CAAC,OAAO;IACnD,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAA;CACpD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAC3C,OAAO,EAAE,4BAA4B,CAAC,OAAO,CAAC,GAC7C,2BAA2B,CAsF7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
type TFunction = (key: string, params?: Record<string, unknown>) => string;
|
|
3
|
+
interface UseTranslationSafeResult {
|
|
4
|
+
t: TFunction;
|
|
5
|
+
i18n: ReturnType<typeof useTranslation>['i18n'] | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function useTranslationSafe(): UseTranslationSafeResult;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=useTranslationSafe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslationSafe.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/useTranslationSafe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AA6B9C,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAA;AAE1E,UAAU,wBAAwB;IAChC,CAAC,EAAE,SAAS,CAAA;IACZ,IAAI,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CACvD;AAED,wBAAgB,kBAAkB,IAAI,wBAAwB,CAqB7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type VirtualItem } from '@tanstack/react-virtual';
|
|
2
|
+
import { type RefObject } from 'react';
|
|
3
|
+
export interface UseVirtualListOptions {
|
|
4
|
+
/** Total number of items in the list */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Reference to the scrollable container element */
|
|
7
|
+
parentRef: RefObject<HTMLElement | null>;
|
|
8
|
+
/** Height of each item in pixels (default: 36) */
|
|
9
|
+
estimateSize?: number;
|
|
10
|
+
/** Number of extra items to render above/below viewport (default: 5) */
|
|
11
|
+
overscan?: number;
|
|
12
|
+
/** Enable/disable virtualization (default: true) */
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface UseVirtualListResult {
|
|
16
|
+
/** Array of virtual items currently visible (plus overscan) */
|
|
17
|
+
virtualItems: VirtualItem[];
|
|
18
|
+
/** Total height of all items for scrollbar sizing */
|
|
19
|
+
totalSize: number;
|
|
20
|
+
/** Scroll to a specific item index */
|
|
21
|
+
scrollToIndex: (index: number, options?: {
|
|
22
|
+
align?: 'start' | 'center' | 'end' | 'auto';
|
|
23
|
+
}) => void;
|
|
24
|
+
/** Measure element at index (for dynamic heights if needed) */
|
|
25
|
+
measureElement: (element: HTMLElement | null) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook for virtualizing a list of items, rendering only visible items in the DOM.
|
|
29
|
+
* Wraps @tanstack/react-virtual with project-specific defaults.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const { virtualItems, totalSize } = useVirtualList({
|
|
34
|
+
* count: records.length,
|
|
35
|
+
* parentRef: scrollContainerRef,
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function useVirtualList({ count, parentRef, estimateSize, overscan, enabled, }: UseVirtualListOptions): UseVirtualListResult;
|
|
40
|
+
//# sourceMappingURL=useVirtualList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVirtualList.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/hooks/useVirtualList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,OAAO,CAAA;AAQnD,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACxC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACjG,+DAA+D;IAC/D,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,SAAS,EACT,YAAuC,EACvC,QAA2B,EAC3B,OAAc,GACf,EAAE,qBAAqB,GAAG,oBAAoB,CAc9C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { LookupField } from './LookupField';
|
|
2
|
+
export type { LookupFieldProps, LookupRecord, LookupFieldRef, LookupFieldReadyData, } from './LookupField.types';
|
|
3
|
+
export { createFetcher } from './services/api';
|
|
4
|
+
export type { Fetcher, SearchRequest, SearchResponse, OrderBy, } from './services/api.types';
|
|
5
|
+
export { normalizeFilters, buildExpressiveFilter, mergeFilters, } from './utils/filterBuilder';
|
|
6
|
+
export type { FilterExpression, SimpleFilter, FilterCondition, } from './types/filter.types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LookupField/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,oBAAoB,GACrB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,YAAY,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,OAAO,GACR,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,GAChB,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveRegion.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/parts/LiveRegion.tsx"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,eAAe,2CAMtD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface SearchInputProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
listboxId?: string;
|
|
7
|
+
activeDescendantId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SearchInput: import("react").ForwardRefExoticComponent<SearchInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=SearchInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/parts/SearchInput.tsx"],"names":[],"mappings":"AAIA,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,eAAO,MAAM,WAAW,+GAoCtB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Fetcher } from './api.types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a standard fetcher function for a given base URL.
|
|
4
|
+
* Use this helper for simple cases where you just need to specify the API base URL.
|
|
5
|
+
*
|
|
6
|
+
* @param baseUrl - Base URL for the API (e.g., '/api', 'https://api.example.com')
|
|
7
|
+
* @returns A fetcher function compatible with LookupField
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Simple usage
|
|
11
|
+
* const fetcher = createFetcher('/api')
|
|
12
|
+
* <LookupField entity="customers" fetcher={fetcher} />
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // With authentication - wrap createFetcher or create custom fetcher
|
|
16
|
+
* const fetcher = createFetcher('/api', {
|
|
17
|
+
* headers: { Authorization: `Bearer ${token}` }
|
|
18
|
+
* })
|
|
19
|
+
*/
|
|
20
|
+
export declare function createFetcher(baseUrl: string, options?: {
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
}): Fetcher;
|
|
23
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/components/LookupField/services/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAA;AAOzE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC7C,OAAO,CA4BT"}
|