@aglyn/shared-ui-jsx-forms 1.21.0 → 1.22.1

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.21.0",
3
+ "version": "1.22.1",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,16 +25,16 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/shared-data-enums": "1.21.0",
29
- "@aglyn/shared-data-mdi": "1.21.0",
30
- "@aglyn/shared-ui-color-picker": "1.21.0",
31
- "@aglyn/shared-ui-jsx": "1.21.0",
32
- "@aglyn/shared-ui-theme": "1.21.0",
33
- "@aglyn/shared-util-tools": "1.21.0",
34
- "@aglyn/shared-util-vendor": "1.21.0",
35
- "@data-driven-forms/common": "^4.2.0",
36
- "@data-driven-forms/react-form-renderer": "^4.2.0",
37
- "@swc/helpers": "0.5.23",
28
+ "@aglyn/shared-data-enums": "1.22.1",
29
+ "@aglyn/shared-data-mdi": "1.22.1",
30
+ "@aglyn/shared-ui-color-picker": "1.22.1",
31
+ "@aglyn/shared-ui-jsx": "1.22.1",
32
+ "@aglyn/shared-ui-theme": "1.22.1",
33
+ "@aglyn/shared-util-tools": "1.22.1",
34
+ "@aglyn/shared-util-vendor": "1.22.1",
35
+ "@data-driven-forms/common": "^4.2.3",
36
+ "@data-driven-forms/react-form-renderer": "^4.2.3",
37
+ "@swc/helpers": "0.5.24",
38
38
  "clsx": "^2.1.1",
39
39
  "lodash-es": "^4.18.1"
40
40
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/constants/flags.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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\nexport enum FieldComponentType {\n /** Per-breakpoint span/offset row; persists one string (AGL-2486). */\n BREAKPOINT_SPAN = 'breakpoint-span',\n BUTTON = 'button',\n CHECKBOX = 'checkbox',\n COLOR_PICKER = 'color-picker',\n /** Thickness + line style for a border shorthand; one string (AGL-2486). */\n CSS_BORDER = 'css-border',\n /** Number + unit editor for a CSS length; persists one string (AGL-1219). */\n CSS_DIMENSION = 'css-dimension',\n /** Fill type + angle + colour stops; persists one CSS string (AGL-1331). */\n CSS_GRADIENT = 'css-gradient',\n /** Row-and-column grid for the Table element (AGL-2543). */\n DATA_TABLE = 'data-table',\n DATE_PICKER = 'date-picker',\n DUAL_LIST_SELECT = 'dual-list-select',\n FIELD_ARRAY = 'field-array',\n ICON_PICKER = 'icon-picker',\n INPUT_ADDON_BUTTON_GROUP = 'input-addon-button-group',\n INPUT_ADDON_GROUP = 'input-addon-group',\n PLAIN_TEXT = 'plain-text',\n /** Named presets with a raw escape hatch (AGL-2486). */\n PRESET_CHOICE = 'preset-choice',\n RADIO = 'radio',\n SELECT = 'select',\n SLIDER = 'slider',\n SUB_FORM = 'sub-form',\n SWITCH = 'switch',\n TAB_ITEM = 'tab-item',\n TABS = 'tabs',\n TEXT_FIELD = 'text-field',\n TEXTAREA = 'textarea',\n /** Theme-scale combo box that still accepts a raw value (AGL-2486). */\n THEME_SCALE = 'theme-scale',\n TIME_PICKER = 'time-picker',\n TOGGLE_BUTTON = 'toggle-button',\n /** Open/closed switch and from/to times per weekday; one hours string. */\n WEEKLY_HOURS = 'weekly-hours',\n WIZARD = 'wizard',\n}\n\nexport enum FieldValidatorType {\n EXACT_LENGTH = 'exact-length',\n MAX_LENGTH = 'max-length',\n MAX_NUMBER_VALUE = 'max-number-value',\n MIN_ITEMS = 'min-items',\n MIN_LENGTH = 'min-length',\n MIN_NUMBER_VALUE = 'min-number-value',\n PATTERN = 'pattern',\n REQUIRED = 'required',\n URL = 'url',\n}\n\nexport enum FieldDataType {\n BOOLEAN = 'boolean',\n FLOAT = 'float',\n INTEGER = 'integer',\n NUMBER = 'number',\n STRING = 'string',\n}\n"],"names":["FieldComponentType","FieldValidatorType","FieldDataType"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAO,IAAA,AAAKA,4CAAAA;IACV,oEAAoE;;;;IAKpE,0EAA0E;IAE1E,2EAA2E;IAE3E,0EAA0E;IAE1E,0DAA0D;;;;;;;;IAS1D,sDAAsD;;;;;;;;;;IAWtD,qEAAqE;;;IAIrE,wEAAwE;;WApC9DA;MAuCX;AAED,OAAO,IAAA,AAAKC,4CAAAA;;;;;;;;;;WAAAA;MAUX;AAED,OAAO,IAAA,AAAKC,uCAAAA;;;;;;WAAAA;MAMX"}
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/constants/flags.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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\nexport enum FieldComponentType {\n /** Per-breakpoint span/offset row; persists one string (AGL-2486). */\n BREAKPOINT_SPAN = 'breakpoint-span',\n BUTTON = 'button',\n CHECKBOX = 'checkbox',\n COLOR_PICKER = 'color-picker',\n /** Thickness + line style for a border shorthand; one string (AGL-2486). */\n CSS_BORDER = 'css-border',\n /** Number + unit editor for a CSS length; persists one string (AGL-1219). */\n CSS_DIMENSION = 'css-dimension',\n /** Fill type + angle + colour stops; persists one CSS string (AGL-1331). */\n CSS_GRADIENT = 'css-gradient',\n /** Row-and-column grid for the Table element (AGL-2543). */\n DATA_TABLE = 'data-table',\n DATE_PICKER = 'date-picker',\n DUAL_LIST_SELECT = 'dual-list-select',\n FIELD_ARRAY = 'field-array',\n ICON_PICKER = 'icon-picker',\n INPUT_ADDON_BUTTON_GROUP = 'input-addon-button-group',\n INPUT_ADDON_GROUP = 'input-addon-group',\n PLAIN_TEXT = 'plain-text',\n /** Named presets with a raw escape hatch (AGL-2486). */\n PRESET_CHOICE = 'preset-choice',\n RADIO = 'radio',\n SELECT = 'select',\n SLIDER = 'slider',\n SUB_FORM = 'sub-form',\n SWITCH = 'switch',\n TAB_ITEM = 'tab-item',\n TABS = 'tabs',\n TEXT_FIELD = 'text-field',\n TEXTAREA = 'textarea',\n /** Theme-scale combo box that still accepts a raw value (AGL-2486). */\n THEME_SCALE = 'theme-scale',\n TIME_PICKER = 'time-picker',\n TOGGLE_BUTTON = 'toggle-button',\n /** Open/closed switch and from/to times per weekday; one hours string. */\n WEEKLY_HOURS = 'weekly-hours',\n WIZARD = 'wizard',\n}\n\nexport enum FieldValidatorType {\n EXACT_LENGTH = 'exact-length',\n MAX_LENGTH = 'max-length',\n MAX_NUMBER_VALUE = 'max-number-value',\n MIN_ITEMS = 'min-items',\n MIN_LENGTH = 'min-length',\n MIN_NUMBER_VALUE = 'min-number-value',\n PATTERN = 'pattern',\n REQUIRED = 'required',\n URL = 'url',\n}\n\nexport enum FieldDataType {\n BOOLEAN = 'boolean',\n FLOAT = 'float',\n INTEGER = 'integer',\n NUMBER = 'number',\n STRING = 'string',\n}\n"],"names":["FieldComponentType","FieldValidatorType","FieldDataType"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAO,IAAA,AAAKA;IACV,oEAAoE;;;;IAKpE,0EAA0E;IAE1E,2EAA2E;IAE3E,0EAA0E;IAE1E,0DAA0D;;;;;;;;IAS1D,sDAAsD;;;;;;;;;;IAWtD,qEAAqE;;;IAIrE,wEAAwE;;;MAGzE;AAED,OAAO,IAAA,AAAKC;;;;;;;;;;;MAUX;AAED,OAAO,IAAA,AAAKC;;;;;;;MAMX"}
@@ -31,6 +31,7 @@ import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
31
31
  // (AGL-3201).
32
32
  import DDFSelectImport, { parseInternalValue } from "@data-driven-forms/common/select";
33
33
  import { useFieldApi } from "../vendor/data-driven-forms.js";
34
+ import { emptyValuesEqual } from "../utils/empty-values-equal.js";
34
35
  import FormFieldGrid, { buildFieldClear } from "./form-field-grid.js";
35
36
  import { validationError } from "./validation-error.js";
36
37
  /** Returns label of the selected option. */ export function getOptionLabel(option, options) {
@@ -238,7 +239,12 @@ const MemoizedSelectView = /*#__PURE__*/ memo(InternalSelectView, drawsTheSame);
238
239
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
239
240
  const DDFSelect = DDFSelectImport;
240
241
  export function Select(props) {
241
- const _useFieldApi = useFieldApi(props), { input, isRequired, isDisabled, isReadOnly, disabled, multiple, isMulti, isClearable, disableClearable, loadingMessage, loadingText, noOptionsMessage, noOptionsText, closeMenuOnSelect } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
242
+ const _useFieldApi = useFieldApi(_extends({}, props, {
243
+ // A cleared box equals the `''` its stored copy reseeds (AGL-4047).
244
+ FieldProps: _extends({
245
+ isEqual: emptyValuesEqual
246
+ }, props.FieldProps)
247
+ })), { input, isRequired, isDisabled, isReadOnly, disabled, multiple, isMulti, isClearable, disableClearable, loadingMessage, loadingText, noOptionsMessage, noOptionsText, closeMenuOnSelect } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
242
248
  "input",
243
249
  "isRequired",
244
250
  "isDisabled",
@@ -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 { 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\n// Both from the FOLDER entry, whose `module` field is the ESM build. The deep\n// file `select/parse-internal-value` is CommonJS whose default export sits on\n// `exports.default`, and a bundler reading this package's ESM output under\n// Node's rules hands a default import the whole `exports` object, so the\n// published editor threw \"is not a function\" the moment a select rendered\n// (AGL-3201).\nimport DDFSelectImport, { parseInternalValue } from '@data-driven-forms/common/select'\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,8EAA8E;AAC9E,8EAA8E;AAC9E,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,cAAc;AACd,OAAOC,mBAAmBC,kBAAkB,QAAQ,mCAAkC;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,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,MAA5BsE,OAAOC,OAAO,EAAiBlF,OAAO2D;YACxC/C,eAAe,CAACZ,OAAe2D,SAC7BsB,OAAOC,OAAO,CAACtE,aAAa,oBAA5BqE,OAAOC,OAAO,CAACtE,aAAa,MAA5BqE,OAAOC,OAAO,EAAiBlF,OAAO2D;QAC1C,CAAA,GACA,EAAE;IAEJ,MAAM,EAAE0B,gBAAgB,EAAY,GAAGL,OAAVM,yCAAUN;;;IACvC,qBACE,KAACF,iCACKQ,OACAH;QACJrE,eAAeuE,oBAAoBA;;AAGzC;AAEA,8EAA8E;AAC9E,8DAA8D;AAC9D,MAAME,YAAYvG;AAElB,OAAO,SAASwG,OAAwBR,KAAqB;IAC3D,MAgBI9F,eAAAA,YAAY8F,QAhBV,EACJS,KAAK,EACLC,UAAU,EACV9D,UAAU,EACV+D,UAAU,EACVhD,QAAQ,EACRiB,QAAQ,EACR1D,OAAO,EACPyB,WAAW,EACXiB,gBAAgB,EAChBgD,cAAc,EACd9D,WAAW,EACXuD,gBAAgB,EAChBvE,aAAa,EACbE,iBAAiB,EAElB,GAAG9B,cADC+C,wCACD/C;;;;;;;;;;;;;;;;IAEJ,qBACE,KAACqG,wBACKE;QACJvF,SAAS0D,YAAY1D;QACrBgB,UAAUwE;QACV/C,UAAUf,cAAc+D,cAAchD;QACtCC,kBAAkB,CAACjB,eAAeiB;QAClCd,aAAa8D,kBAAkB9D;QAC/BuD,kBAAkBA,oBAAoBvE;QACtCE,mBAAmBA;OACfiB;QACJ4D,iBAAiBd;;AAGvB;AAEA,eAAeS,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\n// Both from the FOLDER entry, whose `module` field is the ESM build. The deep\n// file `select/parse-internal-value` is CommonJS whose default export sits on\n// `exports.default`, and a bundler reading this package's ESM output under\n// Node's rules hands a default import the whole `exports` object, so the\n// published editor threw \"is not a function\" the moment a select rendered\n// (AGL-3201).\nimport DDFSelectImport, { parseInternalValue } from '@data-driven-forms/common/select'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport { emptyValuesEqual } from '../utils/empty-values-equal'\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({\n ...props,\n // A cleared box equals the `''` its stored copy reseeds (AGL-4047).\n FieldProps: { isEqual: emptyValuesEqual, ...props.FieldProps },\n })\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","emptyValuesEqual","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","FieldProps","isEqual","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,8EAA8E;AAC9E,8EAA8E;AAC9E,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,cAAc;AACd,OAAOC,mBAAmBC,kBAAkB,QAAQ,mCAAkC;AAEtF,SAASC,WAAW,QAAQ,iCAA6B;AACzD,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,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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OAAOC,OAAO,EAAiBlF,OAAO2D;YACxC/C,eAAe,CAACZ,OAAe2D,SAC7BsB,OAAOC,OAAO,CAACtE,aAAa,oBAA5BqE,OAAOC,OAAO,CAACtE,aAAa,MAA5BqE,OAAOC,OAAO,EAAiBlF,OAAO2D;QAC1C,CAAA,GACA,EAAE;IAEJ,MAAM,EAAE0B,gBAAgB,EAAY,GAAGL,OAAVM,yCAAUN;;;IACvC,qBACE,KAACF,iCACKQ,OACAH;QACJrE,eAAeuE,oBAAoBA;;AAGzC;AAEA,8EAA8E;AAC9E,8DAA8D;AAC9D,MAAME,YAAYxG;AAElB,OAAO,SAASyG,OAAwBR,KAAqB;IAC3D,MAgBI/F,eAAAA,YAAY,aACX+F;QACH,oEAAoE;QACpES,YAAY;YAAEC,SAASxG;WAAqB8F,MAAMS,UAAU;SAnBxD,EACJE,KAAK,EACLC,UAAU,EACVhE,UAAU,EACViE,UAAU,EACVlD,QAAQ,EACRiB,QAAQ,EACR1D,OAAO,EACPyB,WAAW,EACXiB,gBAAgB,EAChBkD,cAAc,EACdhE,WAAW,EACXuD,gBAAgB,EAChBvE,aAAa,EACbE,iBAAiB,EAElB,GAAG/B,cADCgD,wCACDhD;;;;;;;;;;;;;;;;IAMJ,qBACE,KAACsG,wBACKI;QACJzF,SAAS0D,YAAY1D;QACrBgB,UAAU0E;QACVjD,UAAUf,cAAciE,cAAclD;QACtCC,kBAAkB,CAACjB,eAAeiB;QAClCd,aAAagE,kBAAkBhE;QAC/BuD,kBAAkBA,oBAAoBvE;QACtCE,mBAAmBA;OACfiB;QACJ8D,iBAAiBhB;;AAGvB;AAEA,eAAeS,OAAM"}
@@ -21,10 +21,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
21
21
  * updated for the current MUI API (`slotProps` instead of `inputProps`).
22
22
  */ import { TextField as MuiTextField } from "@mui/material";
23
23
  import { useFieldApi } from "../vendor/data-driven-forms.js";
24
+ import { emptyValuesEqual } from "../utils/empty-values-equal.js";
24
25
  import FormFieldGrid, { buildFieldClear } from "./form-field-grid.js";
25
26
  import { validationError } from "./validation-error.js";
26
27
  export const TextField = (props)=>{
27
- const _useFieldApi = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, inputProps, InputProps, help, clearable, FormFieldGridProps = {}, type } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
28
+ const _useFieldApi = useFieldApi(_extends({}, props, {
29
+ // A cleared box equals the `''` its stored copy reseeds (AGL-4047).
30
+ FieldProps: _extends({
31
+ isEqual: emptyValuesEqual
32
+ }, props.FieldProps)
33
+ })), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, inputProps, InputProps, help, clearable, FormFieldGridProps = {}, type } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
28
34
  "input",
29
35
  "isReadOnly",
30
36
  "isDisabled",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/text-field.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` instead of `inputProps`).\n */\n\nimport { TextField as MuiTextField } from '@mui/material'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport FormFieldGrid, {\n buildFieldClear,\n type FormFieldGridProps,\n} from './form-field-grid'\nimport type { BaseFieldProps } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\nexport interface TextFieldProps extends BaseFieldProps {\n placeholder?: string\n /** Offer the reset-to-unset affordance (AGL-2486). */\n clearable?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n /**\n * Props for the MUI Input slot (adornments, etc.). Kept under the legacy\n * `InputProps` name because schemas author it that way via `resolveProps`;\n * routed into `slotProps.input` here so it never reaches the DOM.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InputProps?: Record<string, any>\n FormFieldGridProps?: FormFieldGridProps\n}\n\nexport const TextField = (props: TextFieldProps) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n inputProps,\n InputProps,\n help,\n clearable,\n FormFieldGridProps = {},\n type,\n ...rest\n } = useFieldApi(props)\n const invalid = validationError(meta as ExtendedFieldMeta, validateOnMount)\n // A date, time or color input paints its own placeholder whether or not it\n // holds a value, so a floating label would sit on top of `mm/dd/yyyy` — the\n // same rule the classic text field applies (AGL-2486).\n const alwaysFilled =\n type === 'date' ||\n type === 'time' ||\n type === 'datetime-local' ||\n type === 'month' ||\n type === 'week' ||\n type === 'color'\n // `!== ''` and friends spelled out: `0` is a value an author typed and\n // this repo has `strictNullChecks` off, so a falsy test would hide the\n // clear button on it (AGL-2486).\n const clear = buildFieldClear({\n clearable,\n label,\n hasValue:\n input.value !== '' && input.value !== undefined && input.value !== null,\n locked: Boolean(isDisabled || isReadOnly),\n onClear: () => input.onChange(''),\n })\n\n return (\n <FormFieldGrid help={help} clear={clear} {...FormFieldGridProps}>\n <MuiTextField\n {...input}\n fullWidth\n error={!!invalid}\n helperText={\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n }\n disabled={isDisabled}\n label={label}\n placeholder={placeholder}\n required={isRequired}\n type={type}\n slotProps={{\n input: { readOnly: isReadOnly, ...InputProps },\n htmlInput: { ...inputProps },\n ...(alwaysFilled ? { inputLabel: { shrink: true } } : {}),\n }}\n {...rest}\n />\n </FormFieldGrid>\n )\n}\n\nexport default TextField\n"],"names":["TextField","MuiTextField","useFieldApi","FormFieldGrid","buildFieldClear","validationError","props","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","inputProps","InputProps","help","clearable","FormFieldGridProps","type","rest","invalid","alwaysFilled","clear","hasValue","value","undefined","locked","Boolean","onClear","onChange","fullWidth","error","touched","warning","disabled","required","slotProps","readOnly","htmlInput","inputLabel","shrink"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAED,SAASA,aAAaC,YAAY,QAAQ,gBAAe;AAEzD,SAASC,WAAW,QAAQ,iCAA6B;AACzD,OAAOC,iBACLC,eAAe,QAEV,uBAAmB;AAE1B,SAAiCC,eAAe,QAAQ,wBAAoB;AAkB5E,OAAO,MAAML,YAAY,CAACM;IACxB,MAkBIJ,eAAAA,YAAYI,QAlBV,EACJC,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,SAAS,EACTC,qBAAqB,CAAC,CAAC,EACvBC,IAAI,EAEL,GAAGpB,cADCqB,wCACDrB;;;;;;;;;;;;;;;;;;IACJ,MAAMsB,UAAUnB,gBAAgBW,MAA2BD;IAC3D,2EAA2E;IAC3E,4EAA4E;IAC5E,uDAAuD;IACvD,MAAMU,eACJH,SAAS,UACTA,SAAS,UACTA,SAAS,oBACTA,SAAS,WACTA,SAAS,UACTA,SAAS;IACX,uEAAuE;IACvE,uEAAuE;IACvE,iCAAiC;IACjC,MAAMI,QAAQtB,gBAAgB;QAC5BgB;QACAR;QACAe,UACEpB,MAAMqB,KAAK,KAAK,MAAMrB,MAAMqB,KAAK,KAAKC,aAAatB,MAAMqB,KAAK,KAAK;QACrEE,QAAQC,QAAQtB,cAAcD;QAC9BwB,SAAS,IAAMzB,MAAM0B,QAAQ,CAAC;IAChC;IAEA,qBACE,KAAC9B;QAAcgB,MAAMA;QAAMO,OAAOA;OAAWL;kBAC3C,cAAA,KAACpB,2BACKM;YACJ2B,SAAS;YACTC,OAAO,CAAC,CAACX;YACTX,YACEW,WACC,AAACR,CAAAA,KAAKoB,OAAO,IAAIrB,eAAc,KAAMC,KAAKqB,OAAO,IAClDxB,cACAC;YAEFwB,UAAU7B;YACVG,OAAOA;YACPF,aAAaA;YACb6B,UAAU5B;YACVW,MAAMA;YACNkB,WAAW;gBACTjC,OAAO;oBAAEkC,UAAUjC;mBAAeU;gBAClCwB,WAAW,aAAKzB;eACZQ,eAAe;gBAAEkB,YAAY;oBAAEC,QAAQ;gBAAK;YAAE,IAAI,CAAC;WAErDrB;;AAIZ,EAAC;AAED,eAAevB,UAAS"}
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/text-field.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` instead of `inputProps`).\n */\n\nimport { TextField as MuiTextField } from '@mui/material'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport { emptyValuesEqual } from '../utils/empty-values-equal'\nimport FormFieldGrid, {\n buildFieldClear,\n type FormFieldGridProps,\n} from './form-field-grid'\nimport type { BaseFieldProps } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\nexport interface TextFieldProps extends BaseFieldProps {\n placeholder?: string\n /** Offer the reset-to-unset affordance (AGL-2486). */\n clearable?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n /**\n * Props for the MUI Input slot (adornments, etc.). Kept under the legacy\n * `InputProps` name because schemas author it that way via `resolveProps`;\n * routed into `slotProps.input` here so it never reaches the DOM.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InputProps?: Record<string, any>\n FormFieldGridProps?: FormFieldGridProps\n}\n\nexport const TextField = (props: TextFieldProps) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n inputProps,\n InputProps,\n help,\n clearable,\n FormFieldGridProps = {},\n type,\n ...rest\n } = useFieldApi({\n ...props,\n // A cleared box equals the `''` its stored copy reseeds (AGL-4047).\n FieldProps: { isEqual: emptyValuesEqual, ...props.FieldProps },\n })\n const invalid = validationError(meta as ExtendedFieldMeta, validateOnMount)\n // A date, time or color input paints its own placeholder whether or not it\n // holds a value, so a floating label would sit on top of `mm/dd/yyyy` — the\n // same rule the classic text field applies (AGL-2486).\n const alwaysFilled =\n type === 'date' ||\n type === 'time' ||\n type === 'datetime-local' ||\n type === 'month' ||\n type === 'week' ||\n type === 'color'\n // `!== ''` and friends spelled out: `0` is a value an author typed and\n // this repo has `strictNullChecks` off, so a falsy test would hide the\n // clear button on it (AGL-2486).\n const clear = buildFieldClear({\n clearable,\n label,\n hasValue:\n input.value !== '' && input.value !== undefined && input.value !== null,\n locked: Boolean(isDisabled || isReadOnly),\n onClear: () => input.onChange(''),\n })\n\n return (\n <FormFieldGrid help={help} clear={clear} {...FormFieldGridProps}>\n <MuiTextField\n {...input}\n fullWidth\n error={!!invalid}\n helperText={\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n }\n disabled={isDisabled}\n label={label}\n placeholder={placeholder}\n required={isRequired}\n type={type}\n slotProps={{\n input: { readOnly: isReadOnly, ...InputProps },\n htmlInput: { ...inputProps },\n ...(alwaysFilled ? { inputLabel: { shrink: true } } : {}),\n }}\n {...rest}\n />\n </FormFieldGrid>\n )\n}\n\nexport default TextField\n"],"names":["TextField","MuiTextField","useFieldApi","emptyValuesEqual","FormFieldGrid","buildFieldClear","validationError","props","FieldProps","isEqual","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","inputProps","InputProps","help","clearable","FormFieldGridProps","type","rest","invalid","alwaysFilled","clear","hasValue","value","undefined","locked","Boolean","onClear","onChange","fullWidth","error","touched","warning","disabled","required","slotProps","readOnly","htmlInput","inputLabel","shrink"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAED,SAASA,aAAaC,YAAY,QAAQ,gBAAe;AAEzD,SAASC,WAAW,QAAQ,iCAA6B;AACzD,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,OAAOC,iBACLC,eAAe,QAEV,uBAAmB;AAE1B,SAAiCC,eAAe,QAAQ,wBAAoB;AAkB5E,OAAO,MAAMN,YAAY,CAACO;IACxB,MAkBIL,eAAAA,YAAY,aACXK;QACH,oEAAoE;QACpEC,YAAY;YAAEC,SAASN;WAAqBI,MAAMC,UAAU;SArBxD,EACJE,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,UAAU,EACVC,UAAU,EACVC,IAAI,EACJC,SAAS,EACTC,qBAAqB,CAAC,CAAC,EACvBC,IAAI,EAEL,GAAGvB,cADCwB,wCACDxB;;;;;;;;;;;;;;;;;;IAKJ,MAAMyB,UAAUrB,gBAAgBa,MAA2BD;IAC3D,2EAA2E;IAC3E,4EAA4E;IAC5E,uDAAuD;IACvD,MAAMU,eACJH,SAAS,UACTA,SAAS,UACTA,SAAS,oBACTA,SAAS,WACTA,SAAS,UACTA,SAAS;IACX,uEAAuE;IACvE,uEAAuE;IACvE,iCAAiC;IACjC,MAAMI,QAAQxB,gBAAgB;QAC5BkB;QACAR;QACAe,UACEpB,MAAMqB,KAAK,KAAK,MAAMrB,MAAMqB,KAAK,KAAKC,aAAatB,MAAMqB,KAAK,KAAK;QACrEE,QAAQC,QAAQtB,cAAcD;QAC9BwB,SAAS,IAAMzB,MAAM0B,QAAQ,CAAC;IAChC;IAEA,qBACE,KAAChC;QAAckB,MAAMA;QAAMO,OAAOA;OAAWL;kBAC3C,cAAA,KAACvB,2BACKS;YACJ2B,SAAS;YACTC,OAAO,CAAC,CAACX;YACTX,YACEW,WACC,AAACR,CAAAA,KAAKoB,OAAO,IAAIrB,eAAc,KAAMC,KAAKqB,OAAO,IAClDxB,cACAC;YAEFwB,UAAU7B;YACVG,OAAOA;YACPF,aAAaA;YACb6B,UAAU5B;YACVW,MAAMA;YACNkB,WAAW;gBACTjC,OAAO;oBAAEkC,UAAUjC;mBAAeU;gBAClCwB,WAAW,aAAKzB;eACZQ,eAAe;gBAAEkB,YAAY;oBAAEC,QAAQ;gBAAK;YAAE,IAAI,CAAC;WAErDrB;;AAIZ,EAAC;AAED,eAAe1B,UAAS"}
@@ -21,10 +21,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
21
21
  * updated for the current MUI API (`slotProps` instead of `inputProps`).
22
22
  */ import { TextField as MuiTextField } from "@mui/material";
23
23
  import { useFieldApi } from "../vendor/data-driven-forms.js";
24
+ import { emptyValuesEqual } from "../utils/empty-values-equal.js";
24
25
  import FormFieldGrid from "./form-field-grid.js";
25
26
  import { validationError } from "./validation-error.js";
26
27
  export const Textarea = (props)=>{
27
- const _useFieldApi = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, help, FormFieldGridProps = {}, inputProps = {}, TextFieldProps = {} } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
28
+ const _useFieldApi = useFieldApi(_extends({}, props, {
29
+ // A cleared box equals the `''` its stored copy reseeds (AGL-4047).
30
+ FieldProps: _extends({
31
+ isEqual: emptyValuesEqual
32
+ }, props.FieldProps)
33
+ })), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, help, FormFieldGridProps = {}, inputProps = {}, TextFieldProps = {} } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
28
34
  "input",
29
35
  "isReadOnly",
30
36
  "isDisabled",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/textarea.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` instead of `inputProps`).\n */\n\nimport {\n TextField as MuiTextField,\n type TextFieldProps as MuiTextFieldProps,\n} from '@mui/material'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport FormFieldGrid, { type FormFieldGridProps } from './form-field-grid'\nimport type { BaseFieldProps } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\nexport interface TextareaProps extends BaseFieldProps {\n placeholder?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n FormFieldGridProps?: FormFieldGridProps\n TextFieldProps?: Omit<\n MuiTextFieldProps,\n 'name' | 'value' | 'onChange' | 'onBlur' | 'onFocus'\n >\n}\n\nexport const Textarea = (props: TextareaProps) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n help,\n FormFieldGridProps = {},\n inputProps = {},\n TextFieldProps = {},\n ...rest\n } = useFieldApi(props)\n\n const invalid = validationError(meta as ExtendedFieldMeta, validateOnMount)\n\n return (\n <FormFieldGrid help={help} {...FormFieldGridProps}>\n <MuiTextField\n {...input}\n fullWidth\n error={!!invalid}\n helperText={\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n }\n disabled={isDisabled}\n label={label}\n placeholder={placeholder}\n required={isRequired}\n slotProps={{\n input: { readOnly: isReadOnly },\n htmlInput: { ...inputProps },\n }}\n {...TextFieldProps}\n {...rest}\n multiline\n />\n </FormFieldGrid>\n )\n}\n\nexport default Textarea\n"],"names":["TextField","MuiTextField","useFieldApi","FormFieldGrid","validationError","Textarea","props","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","help","FormFieldGridProps","inputProps","TextFieldProps","rest","invalid","fullWidth","error","touched","warning","disabled","required","slotProps","readOnly","htmlInput","multiline"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAED,SACEA,aAAaC,YAAY,QAEpB,gBAAe;AAEtB,SAASC,WAAW,QAAQ,iCAA6B;AACzD,OAAOC,mBAAgD,uBAAmB;AAE1E,SAAiCC,eAAe,QAAQ,wBAAoB;AAa5E,OAAO,MAAMC,WAAW,CAACC;IACvB,MAgBIJ,eAAAA,YAAYI,QAhBV,EACJC,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,IAAI,EACJC,qBAAqB,CAAC,CAAC,EACvBC,aAAa,CAAC,CAAC,EACfC,iBAAiB,CAAC,CAAC,EAEpB,GAAGlB,cADCmB,wCACDnB;;;;;;;;;;;;;;;;IAEJ,MAAMoB,UAAUlB,gBAAgBY,MAA2BD;IAE3D,qBACE,KAACZ;QAAcc,MAAMA;OAAUC;kBAC7B,cAAA,KAACjB,2BACKM;YACJgB,SAAS;YACTC,OAAO,CAAC,CAACF;YACTT,YACES,WACC,AAACN,CAAAA,KAAKS,OAAO,IAAIV,eAAc,KAAMC,KAAKU,OAAO,IAClDb,cACAC;YAEFa,UAAUlB;YACVG,OAAOA;YACPF,aAAaA;YACbkB,UAAUjB;YACVkB,WAAW;gBACTtB,OAAO;oBAAEuB,UAAUtB;gBAAW;gBAC9BuB,WAAW,aAAKZ;YAClB;WACIC,gBACAC;YACJW,SAAS;;;AAIjB,EAAC;AAED,eAAe3B,SAAQ"}
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/mapper/textarea.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` instead of `inputProps`).\n */\n\nimport {\n TextField as MuiTextField,\n type TextFieldProps as MuiTextFieldProps,\n} from '@mui/material'\n\nimport { useFieldApi } from '../vendor/data-driven-forms'\nimport { emptyValuesEqual } from '../utils/empty-values-equal'\nimport FormFieldGrid, { type FormFieldGridProps } from './form-field-grid'\nimport type { BaseFieldProps } from './types'\nimport { type ExtendedFieldMeta, validationError } from './validation-error'\n\nexport interface TextareaProps extends BaseFieldProps {\n placeholder?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputProps?: Record<string, any>\n FormFieldGridProps?: FormFieldGridProps\n TextFieldProps?: Omit<\n MuiTextFieldProps,\n 'name' | 'value' | 'onChange' | 'onBlur' | 'onFocus'\n >\n}\n\nexport const Textarea = (props: TextareaProps) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n help,\n FormFieldGridProps = {},\n inputProps = {},\n TextFieldProps = {},\n ...rest\n } = useFieldApi({\n ...props,\n // A cleared box equals the `''` its stored copy reseeds (AGL-4047).\n FieldProps: { isEqual: emptyValuesEqual, ...props.FieldProps },\n })\n\n const invalid = validationError(meta as ExtendedFieldMeta, validateOnMount)\n\n return (\n <FormFieldGrid help={help} {...FormFieldGridProps}>\n <MuiTextField\n {...input}\n fullWidth\n error={!!invalid}\n helperText={\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n }\n disabled={isDisabled}\n label={label}\n placeholder={placeholder}\n required={isRequired}\n slotProps={{\n input: { readOnly: isReadOnly },\n htmlInput: { ...inputProps },\n }}\n {...TextFieldProps}\n {...rest}\n multiline\n />\n </FormFieldGrid>\n )\n}\n\nexport default Textarea\n"],"names":["TextField","MuiTextField","useFieldApi","emptyValuesEqual","FormFieldGrid","validationError","Textarea","props","FieldProps","isEqual","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","help","FormFieldGridProps","inputProps","TextFieldProps","rest","invalid","fullWidth","error","touched","warning","disabled","required","slotProps","readOnly","htmlInput","multiline"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GAED,SACEA,aAAaC,YAAY,QAEpB,gBAAe;AAEtB,SAASC,WAAW,QAAQ,iCAA6B;AACzD,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,OAAOC,mBAAgD,uBAAmB;AAE1E,SAAiCC,eAAe,QAAQ,wBAAoB;AAa5E,OAAO,MAAMC,WAAW,CAACC;IACvB,MAgBIL,eAAAA,YAAY,aACXK;QACH,oEAAoE;QACpEC,YAAY;YAAEC,SAASN;WAAqBI,MAAMC,UAAU;SAnBxD,EACJE,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,IAAI,EACJC,qBAAqB,CAAC,CAAC,EACvBC,aAAa,CAAC,CAAC,EACfC,iBAAiB,CAAC,CAAC,EAEpB,GAAGrB,cADCsB,wCACDtB;;;;;;;;;;;;;;;;IAMJ,MAAMuB,UAAUpB,gBAAgBc,MAA2BD;IAE3D,qBACE,KAACd;QAAcgB,MAAMA;OAAUC;kBAC7B,cAAA,KAACpB,2BACKS;YACJgB,SAAS;YACTC,OAAO,CAAC,CAACF;YACTT,YACES,WACC,AAACN,CAAAA,KAAKS,OAAO,IAAIV,eAAc,KAAMC,KAAKU,OAAO,IAClDb,cACAC;YAEFa,UAAUlB;YACVG,OAAOA;YACPF,aAAaA;YACbkB,UAAUjB;YACVkB,WAAW;gBACTtB,OAAO;oBAAEuB,UAAUtB;gBAAW;gBAC9BuB,WAAW,aAAKZ;YAClB;WACIC,gBACAC;YACJW,SAAS;;;AAIjB,EAAC;AAED,eAAe7B,SAAQ"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Whether two values of a text-like field are the same to the person looking
19
+ * at it (AGL-4047): an empty box is an empty box, whether final-form holds it
20
+ * as `undefined` (its default parse of `''`, and the renderer's clearedValue
21
+ * for an emptied field), `null`, or the `''` a stored copy seeds back.
22
+ *
23
+ * final-form's own compare is `===`, so a field cleared and saved stayed
24
+ * dirty against the `''` its stored copy reseeded, and the card kept saying
25
+ * "Update" over a form that held exactly what was stored. Anything else is
26
+ * still compared with `===`, the default it replaces.
27
+ */
28
+ export declare function emptyValuesEqual(a: unknown, b: unknown): boolean;
29
+ export default emptyValuesEqual;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Whether two values of a text-like field are the same to the person looking
18
+ * at it (AGL-4047): an empty box is an empty box, whether final-form holds it
19
+ * as `undefined` (its default parse of `''`, and the renderer's clearedValue
20
+ * for an emptied field), `null`, or the `''` a stored copy seeds back.
21
+ *
22
+ * final-form's own compare is `===`, so a field cleared and saved stayed
23
+ * dirty against the `''` its stored copy reseeded, and the card kept saying
24
+ * "Update" over a form that held exactly what was stored. Anything else is
25
+ * still compared with `===`, the default it replaces.
26
+ */ export function emptyValuesEqual(a, b) {
27
+ return a === b || isEmptyValue(a) && isEmptyValue(b);
28
+ }
29
+ const isEmptyValue = (value)=>value === undefined || value === null || value === '';
30
+ export default emptyValuesEqual;
31
+
32
+ //# sourceMappingURL=empty-values-equal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/utils/empty-values-equal.ts"],"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 * Whether two values of a text-like field are the same to the person looking\n * at it (AGL-4047): an empty box is an empty box, whether final-form holds it\n * as `undefined` (its default parse of `''`, and the renderer's clearedValue\n * for an emptied field), `null`, or the `''` a stored copy seeds back.\n *\n * final-form's own compare is `===`, so a field cleared and saved stayed\n * dirty against the `''` its stored copy reseeded, and the card kept saying\n * \"Update\" over a form that held exactly what was stored. Anything else is\n * still compared with `===`, the default it replaces.\n */\nexport function emptyValuesEqual(a: unknown, b: unknown): boolean {\n return a === b || (isEmptyValue(a) && isEmptyValue(b))\n}\n\nconst isEmptyValue = (value: unknown): boolean => value === undefined || value === null || value === ''\n\nexport default emptyValuesEqual\n"],"names":["emptyValuesEqual","a","b","isEmptyValue","value","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GACD,OAAO,SAASA,iBAAiBC,CAAU,EAAEC,CAAU;IACrD,OAAOD,MAAMC,KAAMC,aAAaF,MAAME,aAAaD;AACrD;AAEA,MAAMC,eAAe,CAACC,QAA4BA,UAAUC,aAAaD,UAAU,QAAQA,UAAU;AAErG,eAAeJ,iBAAgB"}