@aglyn/shared-ui-jsx-forms 1.0.0-beta.217 → 1.0.0-beta.219
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-jsx-forms",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.219",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-enums": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-ui-color-picker": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
33
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
34
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.219",
|
|
29
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.219",
|
|
30
|
+
"@aglyn/shared-ui-color-picker": "1.0.0-beta.219",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.219",
|
|
32
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.219",
|
|
33
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.219",
|
|
34
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.219",
|
|
35
35
|
"@data-driven-forms/common": "^4.2.0",
|
|
36
36
|
"@data-driven-forms/react-form-renderer": "^4.2.0",
|
|
37
37
|
"@swc/helpers": "0.5.23",
|
package/src/lib/mapper/select.js
CHANGED
|
@@ -20,7 +20,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
* Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and
|
|
21
21
|
* updated for the current MUI API (`slotProps`-shaped Autocomplete
|
|
22
22
|
* `renderInput` params instead of `inputProps`).
|
|
23
|
-
*/ import { useMemo } from "react";
|
|
23
|
+
*/ import { memo, useMemo, useRef } from "react";
|
|
24
24
|
import { Autocomplete, CircularProgress, TextField } from "@mui/material";
|
|
25
25
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
26
26
|
import DDFSelectImport from "@data-driven-forms/common/select";
|
|
@@ -52,8 +52,8 @@ import { validationError } from "./validation-error.js";
|
|
|
52
52
|
}
|
|
53
53
|
return option;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
let { value, options, label, helperText, validateOnMount, meta, isSearchable, description, isMulti, placeholder = 'Please choose', onInputChange, onSearchInput, isFetching,
|
|
55
|
+
function InternalSelectView(_0) {
|
|
56
|
+
let { value, options, label, helperText, validateOnMount, meta, isSearchable, description, isMulti, placeholder = 'Please choose', onInputChange, onSearchInput, isFetching, noOptionsText, hideSelectedOptions, closeMenuOnSelect: _closeMenuOnSelect, required, onChange, onFocus, onBlur, help, FormFieldGridProps = {}, TextFieldProps: _ref = {} } = _0, { inputProps: textFieldInputProps } = _ref, TextFieldProps = _object_without_properties_loose(_ref, [
|
|
57
57
|
"inputProps"
|
|
58
58
|
]), { inputProps = {}, isClearable, isDisabled, clearable, loadingText = 'Loading...', // @data-driven-forms/common always injects classNamePrefix (a
|
|
59
59
|
// react-select concern) into its SelectComponent; keep it out of the
|
|
@@ -72,7 +72,7 @@ function InternalSelect(_0) {
|
|
|
72
72
|
"onInputChange",
|
|
73
73
|
"onSearchInput",
|
|
74
74
|
"isFetching",
|
|
75
|
-
"
|
|
75
|
+
"noOptionsText",
|
|
76
76
|
"hideSelectedOptions",
|
|
77
77
|
"closeMenuOnSelect",
|
|
78
78
|
"required",
|
|
@@ -143,7 +143,7 @@ function InternalSelect(_0) {
|
|
|
143
143
|
})
|
|
144
144
|
}));
|
|
145
145
|
},
|
|
146
|
-
noOptionsText:
|
|
146
|
+
noOptionsText: noOptionsText,
|
|
147
147
|
/*
|
|
148
148
|
* The REASON travels with the text.
|
|
149
149
|
*
|
|
@@ -166,6 +166,69 @@ function InternalSelect(_0) {
|
|
|
166
166
|
}))
|
|
167
167
|
}));
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Whether the Autocomplete would draw the same thing: every prop the same,
|
|
171
|
+
* except `meta`, which final-form hands over as a new object on every render
|
|
172
|
+
* and which is compared by what it holds.
|
|
173
|
+
*/ function drawsTheSame(previous, next) {
|
|
174
|
+
const keys = new Set([
|
|
175
|
+
...Object.keys(previous),
|
|
176
|
+
...Object.keys(next)
|
|
177
|
+
]);
|
|
178
|
+
for (const key of keys){
|
|
179
|
+
const before = previous[key];
|
|
180
|
+
const after = next[key];
|
|
181
|
+
if (Object.is(before, after)) continue;
|
|
182
|
+
if (key === 'meta' && shallowEqual(before, after)) continue;
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
function shallowEqual(a, b) {
|
|
188
|
+
if (!a || !b || typeof a !== 'object' || typeof b !== 'object') return false;
|
|
189
|
+
const left = a;
|
|
190
|
+
const right = b;
|
|
191
|
+
const keys = Object.keys(left);
|
|
192
|
+
if (keys.length !== Object.keys(right).length) return false;
|
|
193
|
+
return keys.every((key)=>Object.is(left[key], right[key]));
|
|
194
|
+
}
|
|
195
|
+
const MemoizedSelectView = /*#__PURE__*/ memo(InternalSelectView, drawsTheSame);
|
|
196
|
+
/**
|
|
197
|
+
* The select, drawn only when something it draws has changed (AGL-3423).
|
|
198
|
+
*
|
|
199
|
+
* A multiple select is a multiple Autocomplete, which hands its input a new
|
|
200
|
+
* chip array as `startAdornment` on every render; MUI's `InputBase` copies
|
|
201
|
+
* that into its `FormControl` from a passive effect, a state update left
|
|
202
|
+
* pending after every commit the field takes part in. React 19 counts each
|
|
203
|
+
* such commit as a nested update, and keystrokes delivered back to back
|
|
204
|
+
* commit one after another with nothing to clear the count, so the
|
|
205
|
+
* fifty-first throws "Maximum update depth exceeded" (#185). A form that
|
|
206
|
+
* re-renders its fields on every change (a `values` subscription, an owner
|
|
207
|
+
* that keeps the values in state) re-rendered every multi-select with each
|
|
208
|
+
* keystroke in ANY field.
|
|
209
|
+
*
|
|
210
|
+
* So the drawing is memoized, and what defeated a plain `memo` is taken out
|
|
211
|
+
* of the comparison: the handlers, which final-form and the common select
|
|
212
|
+
* rebuild on every render, are called through the latest props instead of
|
|
213
|
+
* compared, and the no-options text is resolved here, where the common
|
|
214
|
+
* select's per-render function for it is called.
|
|
215
|
+
*/ function InternalSelect(props) {
|
|
216
|
+
const latest = useRef(props);
|
|
217
|
+
latest.current = props;
|
|
218
|
+
const handlers = useMemo(()=>({
|
|
219
|
+
onChange: (value)=>latest.current.onChange(value),
|
|
220
|
+
onFocus: (...args)=>latest.current.onFocus == null ? void 0 : latest.current.onFocus.call(latest.current, ...args),
|
|
221
|
+
onBlur: (...args)=>latest.current.onBlur == null ? void 0 : latest.current.onBlur.call(latest.current, ...args),
|
|
222
|
+
onInputChange: (value, reason)=>latest.current.onInputChange == null ? void 0 : latest.current.onInputChange.call(latest.current, value, reason),
|
|
223
|
+
onSearchInput: (value, reason)=>latest.current.onSearchInput == null ? void 0 : latest.current.onSearchInput.call(latest.current, value, reason)
|
|
224
|
+
}), []);
|
|
225
|
+
const { noOptionsMessage } = props, drawn = _object_without_properties_loose(props, [
|
|
226
|
+
"noOptionsMessage"
|
|
227
|
+
]);
|
|
228
|
+
return /*#__PURE__*/ _jsx(MemoizedSelectView, _extends({}, drawn, handlers, {
|
|
229
|
+
noOptionsText: noOptionsMessage && noOptionsMessage()
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
169
232
|
// The common Select's prop types are renderer-version specific; pass through.
|
|
170
233
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
171
234
|
const DDFSelect = DDFSelectImport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/select.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and\n * updated for the current MUI API (`slotProps`-shaped Autocomplete\n * `renderInput` params instead of `inputProps`).\n */\n\nimport { useMemo } from 'react'\n\nimport {\n Autocomplete,\n CircularProgress,\n TextField,\n} from '@mui/material'\n\nimport ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'\n\nimport DDFSelectImport from '@data-driven-forms/common/select'\nimport parseInternalValue from '@data-driven-forms/common/select/parse-internal-value'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport FormFieldGrid, {\n buildFieldClear,\n type FormFieldGridProps,\n} from './form-field-grid'\nimport type { BaseFieldProps, OptionValue, SelectOption, SelectValue } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\nexport interface SelectProps<T = OptionValue> extends BaseFieldProps {\n options?: SelectOption<T>[]\n loadOptions?: (inputValue: string) => Promise<SelectOption<T>[]>\n isSearchable?: boolean\n isMulti?: boolean\n multiple?: boolean\n isClearable?: boolean\n disableClearable?: boolean\n hideSelectedOptions?: boolean\n closeMenuOnSelect?: boolean\n isFetching?: boolean\n noOptionsMessage?: () => string\n noOptionsText?: () => string\n loadingMessage?: string\n loadingText?: string\n placeholder?: string\n /** Offer the reset-to-unset affordance (AGL-2486). */\n clearable?: boolean\n FormFieldGridProps?: FormFieldGridProps\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TextFieldProps?: Record<string, any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n onInputChange?: (value: string, reason?: string) => void\n /**\n * A schema field's own hook on the search box, beside DDF's.\n *\n * `onInputChange` cannot be one. `@data-driven-forms/common/select` owns\n * that prop for its `loadOptions` support and assigns it AFTER spreading the\n * field's props, so a handler declared on a schema field is overwritten\n * before it reaches this component — silently, since a dropdown with a\n * dropped handler still opens, still filters and still selects. A field\n * whose typing was supposed to fetch more simply fetches nothing.\n *\n * This name is not taken, so it survives the spread. Both are called.\n */\n onSearchInput?: (value: string, reason?: string) => void\n}\n\n/** Returns label of the selected option. */\nexport function getOptionLabel<T = OptionValue>(\n option: T | SelectOption<T> | undefined,\n options: SelectOption<T>[],\n): string {\n if (typeof option === 'undefined') {\n return ''\n }\n\n if ((option as unknown) === '') {\n return ''\n }\n\n if (Array.isArray(option) && option.length === 0) {\n return ''\n }\n\n if (typeof option === 'object' && option !== null) {\n return String((option as SelectOption<T>).label)\n }\n\n const item = options.find(({ value }) => value === option)\n return (item && String(item.label)) || ''\n}\n\n/** Creates the DDF select value format. */\nexport function createValue<T = OptionValue>(\n option: T | SelectOption<T> | (T | SelectOption<T>)[] | null,\n isMulti: boolean,\n): T | SelectOption<T> | (T | SelectOption<T>)[] | null | undefined {\n if (isMulti) {\n return Array.isArray(option)\n ? option.map((item) =>\n typeof item === 'object' ? item : ({ value: item } as SelectOption<T>),\n )\n : option\n }\n\n return option\n}\n\ninterface InternalSelectProps<T = OptionValue> {\n value: SelectValue<T>\n options: SelectOption<T>[]\n label?: string\n helperText?: string\n validateOnMount?: boolean\n meta: ExtendedFieldMeta\n isSearchable?: boolean\n description?: string\n isMulti?: boolean\n placeholder?: string\n onInputChange?: (value: string, reason?: string) => void\n onSearchInput?: (value: string, reason?: string) => void\n isFetching?: boolean\n noOptionsMessage?: () => string\n hideSelectedOptions?: boolean\n closeMenuOnSelect?: boolean\n required?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (value: any) => void\n onFocus?: () => void\n onBlur?: () => void\n FormFieldGridProps?: FormFieldGridProps\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TextFieldProps?: Record<string, any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n isClearable?: boolean\n isDisabled?: boolean\n loadingText?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n}\n\nfunction InternalSelect<T = OptionValue>({\n value,\n options,\n label,\n helperText,\n validateOnMount,\n meta,\n isSearchable,\n description,\n isMulti,\n placeholder = 'Please choose',\n onInputChange,\n onSearchInput,\n isFetching,\n noOptionsMessage,\n hideSelectedOptions,\n closeMenuOnSelect: _closeMenuOnSelect,\n required,\n onChange,\n onFocus,\n onBlur,\n help,\n FormFieldGridProps = {},\n TextFieldProps: { inputProps: textFieldInputProps, ...TextFieldProps } = {},\n inputProps = {},\n isClearable,\n isDisabled,\n clearable,\n loadingText = 'Loading...',\n // @data-driven-forms/common always injects classNamePrefix (a\n // react-select concern) into its SelectComponent; keep it out of the\n // Autocomplete spread so it never reaches the DOM (AGL-590).\n classNamePrefix: _classNamePrefix,\n ...rest\n}: InternalSelectProps<T>) {\n const invalid = validationError(meta, validateOnMount)\n // When isMulti is true, parseInternalValue always creates a new array; keep\n // the reference stable across renders.\n const internalValue = useMemo(\n () => parseInternalValue(value, isMulti),\n [value, isMulti],\n )\n\n // Selects ship with `disableClearable` on by default here, so the\n // Autocomplete's own ✕ never appears and a chosen option could not be\n // taken back off (AGL-2486). One affordance for every field type beats\n // flipping that default, which would move the control for some fields\n // and not others.\n const clear = buildFieldClear({\n clearable,\n label,\n hasValue: Array.isArray(internalValue)\n ? internalValue.length > 0\n : internalValue !== undefined &&\n internalValue !== null &&\n internalValue !== '',\n locked: Boolean(isDisabled),\n onClear: () => onChange(createValue(null, !!isMulti)),\n })\n\n return (\n <FormFieldGrid help={help} clear={clear} {...FormFieldGridProps}>\n <Autocomplete\n filterSelectedOptions={hideSelectedOptions}\n disabled={isDisabled}\n disableClearable={isClearable}\n popupIcon={\n isFetching ? (\n <CircularProgress size={20} color=\"inherit\" />\n ) : (\n <ArrowDropDownIcon />\n )\n }\n fullWidth\n loadingText={loadingText}\n {...rest}\n renderInput={(params) => (\n <TextField\n onFocus={onFocus}\n onBlur={onBlur}\n {...params}\n required={required}\n error={!!invalid}\n helperText={\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n }\n label={label}\n margin=\"normal\"\n {...TextFieldProps}\n slotProps={{\n ...params.slotProps,\n ...TextFieldProps.slotProps,\n htmlInput: {\n ...params.slotProps?.htmlInput,\n ...textFieldInputProps,\n ...inputProps,\n readOnly: !isSearchable,\n placeholder:\n !internalValue ||\n (internalValue as unknown[]).length === 0\n ? placeholder\n : undefined,\n },\n }}\n />\n )}\n noOptionsText={noOptionsMessage && noOptionsMessage()}\n /*\n * The REASON travels with the text.\n *\n * Autocomplete emits this for a typed character (`input`), for the\n * field taking its own value back (`reset` — which fires on mount and\n * again on every selection) and for the clear button (`clear`). A\n * handler that treats all three alike cannot tell somebody searching\n * from the field describing itself, and one that spends a read per\n * query would spend one on simply opening the panel.\n */\n onInputChange={(_event, value, reason) => {\n onInputChange?.(value, reason)\n onSearchInput?.(value, reason)\n }}\n options={options}\n multiple={isMulti}\n getOptionLabel={(option) =>\n getOptionLabel(option as T | SelectOption<T>, options)\n }\n value={typeof internalValue === 'undefined' ? null : internalValue}\n onChange={(_event, option) =>\n onChange(createValue(option as SelectOption<T> | null, !!isMulti))\n }\n loading={isFetching}\n />\n </FormFieldGrid>\n )\n}\n\n// The common Select's prop types are renderer-version specific; pass through.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst DDFSelect = DDFSelectImport as React.ComponentType<any>\n\nexport function Select<T = OptionValue>(props: SelectProps<T>) {\n const {\n input,\n isRequired,\n isDisabled,\n isReadOnly,\n disabled,\n multiple,\n isMulti,\n isClearable,\n disableClearable,\n loadingMessage,\n loadingText,\n noOptionsMessage,\n noOptionsText,\n closeMenuOnSelect,\n ...rest\n } = useFieldApi(props)\n\n return (\n <DDFSelect\n {...input}\n isMulti={multiple || isMulti}\n required={isRequired}\n disabled={isDisabled || isReadOnly || disabled}\n disableClearable={!isClearable || disableClearable}\n loadingText={loadingMessage || loadingText}\n noOptionsMessage={noOptionsMessage || noOptionsText}\n closeMenuOnSelect={closeMenuOnSelect}\n {...rest}\n SelectComponent={InternalSelect}\n />\n )\n}\n\nexport default Select\n"],"names":["useMemo","Autocomplete","CircularProgress","TextField","ArrowDropDownIcon","DDFSelectImport","parseInternalValue","useFieldApi","FormFieldGrid","buildFieldClear","validationError","getOptionLabel","option","options","Array","isArray","length","String","label","item","find","value","createValue","isMulti","map","InternalSelect","helperText","validateOnMount","meta","isSearchable","description","placeholder","onInputChange","onSearchInput","isFetching","noOptionsMessage","hideSelectedOptions","closeMenuOnSelect","_closeMenuOnSelect","required","onChange","onFocus","onBlur","help","FormFieldGridProps","TextFieldProps","inputProps","textFieldInputProps","isClearable","isDisabled","clearable","loadingText","classNamePrefix","_classNamePrefix","rest","invalid","internalValue","clear","hasValue","undefined","locked","Boolean","onClear","filterSelectedOptions","disabled","disableClearable","popupIcon","size","color","fullWidth","renderInput","params","error","touched","warning","margin","slotProps","htmlInput","readOnly","noOptionsText","_event","reason","multiple","loading","DDFSelect","Select","props","input","isRequired","isReadOnly","loadingMessage","SelectComponent"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;CAIC,GAED,SAASA,OAAO,QAAQ,QAAO;AAE/B,SACEC,YAAY,EACZC,gBAAgB,EAChBC,SAAS,QACJ,gBAAe;AAEtB,OAAOC,uBAAuB,oCAAmC;AAEjE,OAAOC,qBAAqB,mCAAkC;AAC9D,O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Ae4D,OAAM"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/select.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Ported from `@data-driven-forms/mui-component-mapper` (Apache-2.0) and\n * updated for the current MUI API (`slotProps`-shaped Autocomplete\n * `renderInput` params instead of `inputProps`).\n */\n\nimport { memo, useMemo, useRef } from 'react'\n\nimport {\n Autocomplete,\n CircularProgress,\n TextField,\n} from '@mui/material'\n\nimport ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'\n\nimport DDFSelectImport from '@data-driven-forms/common/select'\nimport parseInternalValue from '@data-driven-forms/common/select/parse-internal-value'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport FormFieldGrid, {\n buildFieldClear,\n type FormFieldGridProps,\n} from './form-field-grid'\nimport type { BaseFieldProps, OptionValue, SelectOption, SelectValue } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\nexport interface SelectProps<T = OptionValue> extends BaseFieldProps {\n options?: SelectOption<T>[]\n loadOptions?: (inputValue: string) => Promise<SelectOption<T>[]>\n isSearchable?: boolean\n isMulti?: boolean\n multiple?: boolean\n isClearable?: boolean\n disableClearable?: boolean\n hideSelectedOptions?: boolean\n closeMenuOnSelect?: boolean\n isFetching?: boolean\n noOptionsMessage?: () => string\n noOptionsText?: () => string\n loadingMessage?: string\n loadingText?: string\n placeholder?: string\n /** Offer the reset-to-unset affordance (AGL-2486). */\n clearable?: boolean\n FormFieldGridProps?: FormFieldGridProps\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TextFieldProps?: Record<string, any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n onInputChange?: (value: string, reason?: string) => void\n /**\n * A schema field's own hook on the search box, beside DDF's.\n *\n * `onInputChange` cannot be one. `@data-driven-forms/common/select` owns\n * that prop for its `loadOptions` support and assigns it AFTER spreading the\n * field's props, so a handler declared on a schema field is overwritten\n * before it reaches this component — silently, since a dropdown with a\n * dropped handler still opens, still filters and still selects. A field\n * whose typing was supposed to fetch more simply fetches nothing.\n *\n * This name is not taken, so it survives the spread. Both are called.\n */\n onSearchInput?: (value: string, reason?: string) => void\n}\n\n/** Returns label of the selected option. */\nexport function getOptionLabel<T = OptionValue>(\n option: T | SelectOption<T> | undefined,\n options: SelectOption<T>[],\n): string {\n if (typeof option === 'undefined') {\n return ''\n }\n\n if ((option as unknown) === '') {\n return ''\n }\n\n if (Array.isArray(option) && option.length === 0) {\n return ''\n }\n\n if (typeof option === 'object' && option !== null) {\n return String((option as SelectOption<T>).label)\n }\n\n const item = options.find(({ value }) => value === option)\n return (item && String(item.label)) || ''\n}\n\n/** Creates the DDF select value format. */\nexport function createValue<T = OptionValue>(\n option: T | SelectOption<T> | (T | SelectOption<T>)[] | null,\n isMulti: boolean,\n): T | SelectOption<T> | (T | SelectOption<T>)[] | null | undefined {\n if (isMulti) {\n return Array.isArray(option)\n ? option.map((item) =>\n typeof item === 'object' ? item : ({ value: item } as SelectOption<T>),\n )\n : option\n }\n\n return option\n}\n\ninterface InternalSelectProps<T = OptionValue> {\n value: SelectValue<T>\n options: SelectOption<T>[]\n label?: string\n helperText?: string\n validateOnMount?: boolean\n meta: ExtendedFieldMeta\n isSearchable?: boolean\n description?: string\n isMulti?: boolean\n placeholder?: string\n onInputChange?: (value: string, reason?: string) => void\n onSearchInput?: (value: string, reason?: string) => void\n isFetching?: boolean\n noOptionsMessage?: () => string\n hideSelectedOptions?: boolean\n closeMenuOnSelect?: boolean\n required?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange: (value: any) => void\n onFocus?: () => void\n onBlur?: () => void\n FormFieldGridProps?: FormFieldGridProps\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n TextFieldProps?: Record<string, any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n isClearable?: boolean\n isDisabled?: boolean\n loadingText?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n}\n\nfunction InternalSelectView<T = OptionValue>({\n value,\n options,\n label,\n helperText,\n validateOnMount,\n meta,\n isSearchable,\n description,\n isMulti,\n placeholder = 'Please choose',\n onInputChange,\n onSearchInput,\n isFetching,\n noOptionsText,\n hideSelectedOptions,\n closeMenuOnSelect: _closeMenuOnSelect,\n required,\n onChange,\n onFocus,\n onBlur,\n help,\n FormFieldGridProps = {},\n TextFieldProps: { inputProps: textFieldInputProps, ...TextFieldProps } = {},\n inputProps = {},\n isClearable,\n isDisabled,\n clearable,\n loadingText = 'Loading...',\n // @data-driven-forms/common always injects classNamePrefix (a\n // react-select concern) into its SelectComponent; keep it out of the\n // Autocomplete spread so it never reaches the DOM (AGL-590).\n classNamePrefix: _classNamePrefix,\n ...rest\n}: InternalSelectProps<T>) {\n const invalid = validationError(meta, validateOnMount)\n // When isMulti is true, parseInternalValue always creates a new array; keep\n // the reference stable across renders.\n const internalValue = useMemo(\n () => parseInternalValue(value, isMulti),\n [value, isMulti],\n )\n\n // Selects ship with `disableClearable` on by default here, so the\n // Autocomplete's own ✕ never appears and a chosen option could not be\n // taken back off (AGL-2486). One affordance for every field type beats\n // flipping that default, which would move the control for some fields\n // and not others.\n const clear = buildFieldClear({\n clearable,\n label,\n hasValue: Array.isArray(internalValue)\n ? internalValue.length > 0\n : internalValue !== undefined &&\n internalValue !== null &&\n internalValue !== '',\n locked: Boolean(isDisabled),\n onClear: () => onChange(createValue(null, !!isMulti)),\n })\n\n return (\n <FormFieldGrid help={help} clear={clear} {...FormFieldGridProps}>\n <Autocomplete\n filterSelectedOptions={hideSelectedOptions}\n disabled={isDisabled}\n disableClearable={isClearable}\n popupIcon={\n isFetching ? (\n <CircularProgress size={20} color=\"inherit\" />\n ) : (\n <ArrowDropDownIcon />\n )\n }\n fullWidth\n loadingText={loadingText}\n {...rest}\n renderInput={(params) => (\n <TextField\n onFocus={onFocus}\n onBlur={onBlur}\n {...params}\n required={required}\n error={!!invalid}\n helperText={\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n }\n label={label}\n margin=\"normal\"\n {...TextFieldProps}\n slotProps={{\n ...params.slotProps,\n ...TextFieldProps.slotProps,\n htmlInput: {\n ...params.slotProps?.htmlInput,\n ...textFieldInputProps,\n ...inputProps,\n readOnly: !isSearchable,\n placeholder:\n !internalValue ||\n (internalValue as unknown[]).length === 0\n ? placeholder\n : undefined,\n },\n }}\n />\n )}\n noOptionsText={noOptionsText}\n /*\n * The REASON travels with the text.\n *\n * Autocomplete emits this for a typed character (`input`), for the\n * field taking its own value back (`reset` — which fires on mount and\n * again on every selection) and for the clear button (`clear`). A\n * handler that treats all three alike cannot tell somebody searching\n * from the field describing itself, and one that spends a read per\n * query would spend one on simply opening the panel.\n */\n onInputChange={(_event, value, reason) => {\n onInputChange?.(value, reason)\n onSearchInput?.(value, reason)\n }}\n options={options}\n multiple={isMulti}\n getOptionLabel={(option) =>\n getOptionLabel(option as T | SelectOption<T>, options)\n }\n value={typeof internalValue === 'undefined' ? null : internalValue}\n onChange={(_event, option) =>\n onChange(createValue(option as SelectOption<T> | null, !!isMulti))\n }\n loading={isFetching}\n />\n </FormFieldGrid>\n )\n}\n\n/**\n * Whether the Autocomplete would draw the same thing: every prop the same,\n * except `meta`, which final-form hands over as a new object on every render\n * and which is compared by what it holds.\n */\nfunction drawsTheSame(\n previous: Record<string, unknown>,\n next: Record<string, unknown>,\n): boolean {\n const keys = new Set([...Object.keys(previous), ...Object.keys(next)])\n for (const key of keys) {\n const before = previous[key]\n const after = next[key]\n if (Object.is(before, after)) continue\n if (key === 'meta' && shallowEqual(before, after)) continue\n return false\n }\n return true\n}\n\nfunction shallowEqual(a: unknown, b: unknown): boolean {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') return false\n const left = a as Record<string, unknown>\n const right = b as Record<string, unknown>\n const keys = Object.keys(left)\n if (keys.length !== Object.keys(right).length) return false\n return keys.every((key) => Object.is(left[key], right[key]))\n}\n\nconst MemoizedSelectView = memo(\n InternalSelectView,\n drawsTheSame,\n) as typeof InternalSelectView\n\n/**\n * The select, drawn only when something it draws has changed (AGL-3423).\n *\n * A multiple select is a multiple Autocomplete, which hands its input a new\n * chip array as `startAdornment` on every render; MUI's `InputBase` copies\n * that into its `FormControl` from a passive effect, a state update left\n * pending after every commit the field takes part in. React 19 counts each\n * such commit as a nested update, and keystrokes delivered back to back\n * commit one after another with nothing to clear the count, so the\n * fifty-first throws \"Maximum update depth exceeded\" (#185). A form that\n * re-renders its fields on every change (a `values` subscription, an owner\n * that keeps the values in state) re-rendered every multi-select with each\n * keystroke in ANY field.\n *\n * So the drawing is memoized, and what defeated a plain `memo` is taken out\n * of the comparison: the handlers, which final-form and the common select\n * rebuild on every render, are called through the latest props instead of\n * compared, and the no-options text is resolved here, where the common\n * select's per-render function for it is called.\n */\nfunction InternalSelect<T = OptionValue>(props: InternalSelectProps<T>) {\n const latest = useRef(props)\n latest.current = props\n const handlers = useMemo(\n () => ({\n onChange: (value: unknown) => latest.current.onChange(value),\n onFocus: (...args: unknown[]) =>\n (latest.current.onFocus as ((...args: unknown[]) => void) | undefined)?.(\n ...args,\n ),\n onBlur: (...args: unknown[]) =>\n (latest.current.onBlur as ((...args: unknown[]) => void) | undefined)?.(\n ...args,\n ),\n onInputChange: (value: string, reason?: string) =>\n latest.current.onInputChange?.(value, reason),\n onSearchInput: (value: string, reason?: string) =>\n latest.current.onSearchInput?.(value, reason),\n }),\n [],\n )\n const { noOptionsMessage, ...drawn } = props\n return (\n <MemoizedSelectView<T>\n {...drawn}\n {...handlers}\n noOptionsText={noOptionsMessage && noOptionsMessage()}\n />\n )\n}\n\n// The common Select's prop types are renderer-version specific; pass through.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst DDFSelect = DDFSelectImport as React.ComponentType<any>\n\nexport function Select<T = OptionValue>(props: SelectProps<T>) {\n const {\n input,\n isRequired,\n isDisabled,\n isReadOnly,\n disabled,\n multiple,\n isMulti,\n isClearable,\n disableClearable,\n loadingMessage,\n loadingText,\n noOptionsMessage,\n noOptionsText,\n closeMenuOnSelect,\n ...rest\n } = useFieldApi(props)\n\n return (\n <DDFSelect\n {...input}\n isMulti={multiple || isMulti}\n required={isRequired}\n disabled={isDisabled || isReadOnly || disabled}\n disableClearable={!isClearable || disableClearable}\n loadingText={loadingMessage || loadingText}\n noOptionsMessage={noOptionsMessage || noOptionsText}\n closeMenuOnSelect={closeMenuOnSelect}\n {...rest}\n SelectComponent={InternalSelect}\n />\n )\n}\n\nexport default Select\n"],"names":["memo","useMemo","useRef","Autocomplete","CircularProgress","TextField","ArrowDropDownIcon","DDFSelectImport","parseInternalValue","useFieldApi","FormFieldGrid","buildFieldClear","validationError","getOptionLabel","option","options","Array","isArray","length","String","label","item","find","value","createValue","isMulti","map","InternalSelectView","helperText","validateOnMount","meta","isSearchable","description","placeholder","onInputChange","onSearchInput","isFetching","noOptionsText","hideSelectedOptions","closeMenuOnSelect","_closeMenuOnSelect","required","onChange","onFocus","onBlur","help","FormFieldGridProps","TextFieldProps","inputProps","textFieldInputProps","isClearable","isDisabled","clearable","loadingText","classNamePrefix","_classNamePrefix","rest","invalid","internalValue","clear","hasValue","undefined","locked","Boolean","onClear","filterSelectedOptions","disabled","disableClearable","popupIcon","size","color","fullWidth","renderInput","params","error","touched","warning","margin","slotProps","htmlInput","readOnly","_event","reason","multiple","loading","drawsTheSame","previous","next","keys","Set","Object","key","before","after","is","shallowEqual","a","b","left","right","every","MemoizedSelectView","InternalSelect","props","latest","current","handlers","args","noOptionsMessage","drawn","DDFSelect","Select","input","isRequired","isReadOnly","loadingMessage","SelectComponent"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;CAIC,GAED,SAASA,IAAI,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AAE7C,SACEC,YAAY,EACZC,gBAAgB,EAChBC,SAAS,QACJ,gBAAe;AAEtB,OAAOC,uBAAuB,oCAAmC;AAEjE,OAAOC,qBAAqB,mCAAkC;AAC9D,OAAOC,wBAAwB,wDAAuD;AAEtF,SAASC,WAAW,QAAQ,iCAA6B;AACzD,OAAOC,iBACLC,eAAe,QAEV,uBAAmB;AAE1B,SAAiCC,eAAe,QAAQ,wBAAoB;AAyC5E,0CAA0C,GAC1C,OAAO,SAASC,eACdC,MAAuC,EACvCC,OAA0B;IAE1B,IAAI,OAAOD,WAAW,aAAa;QACjC,OAAO;IACT;IAEA,IAAI,AAACA,WAAuB,IAAI;QAC9B,OAAO;IACT;IAEA,IAAIE,MAAMC,OAAO,CAACH,WAAWA,OAAOI,MAAM,KAAK,GAAG;QAChD,OAAO;IACT;IAEA,IAAI,OAAOJ,WAAW,YAAYA,WAAW,MAAM;QACjD,OAAOK,OAAO,AAACL,OAA2BM,KAAK;IACjD;IAEA,MAAMC,OAAON,QAAQO,IAAI,CAAC,CAAC,EAAEC,KAAK,EAAE,GAAKA,UAAUT;IACnD,OAAO,AAACO,QAAQF,OAAOE,KAAKD,KAAK,KAAM;AACzC;AAEA,yCAAyC,GACzC,OAAO,SAASI,YACdV,MAA4D,EAC5DW,OAAgB;IAEhB,IAAIA,SAAS;QACX,OAAOT,MAAMC,OAAO,CAACH,UACjBA,OAAOY,GAAG,CAAC,CAACL,OACV,OAAOA,SAAS,WAAWA,OAAQ;gBAAEE,OAAOF;YAAK,KAEnDP;IACN;IAEA,OAAOA;AACT;AAoCA,SAASa,mBAAoC,EAkCpB;QAlCoB,EAC3CJ,KAAK,EACLR,OAAO,EACPK,KAAK,E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