@ews-admin/global-design-system 1.1.16 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts +1 -1
- package/dist/components/SearchAutocomplete/SearchAutocomplete.d.ts.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.css +2 -2
- package/dist/index.esm.js +60 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +60 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SearchAutocomplete/SearchAutocomplete.tsx +2 -4
- package/dist/assets/doctor.png +0 -0
- package/dist/assets/favicon.ico +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/assets/logoAssets.d.ts +0 -11
- package/dist/assets/logoAssets.d.ts.map +0 -1
- package/dist/assets/logoWhite.png +0 -0
- package/dist/assets/patient.png +0 -0
- package/dist/components/DoctorForm/DoctorForm.d.ts +0 -11
- package/dist/components/DoctorForm/DoctorForm.d.ts.map +0 -1
- package/dist/components/DoctorForm/index.d.ts +0 -3
- package/dist/components/DoctorForm/index.d.ts.map +0 -1
- package/dist/components/Logo/logoAssets.d.ts +0 -1
- package/dist/components/Logo/logoAssets.d.ts.map +0 -1
- package/dist/icons/ArrowRightIcon.d.ts +0 -4
- package/dist/icons/ArrowRightIcon.d.ts.map +0 -1
- package/dist/icons/CheckIcon.d.ts +0 -4
- package/dist/icons/CheckIcon.d.ts.map +0 -1
- package/dist/icons/EyeIcon.d.ts +0 -4
- package/dist/icons/EyeIcon.d.ts.map +0 -1
- package/dist/icons/EyeOffIcon.d.ts +0 -4
- package/dist/icons/EyeOffIcon.d.ts.map +0 -1
- package/dist/icons/SearchIcon.d.ts +0 -4
- package/dist/icons/SearchIcon.d.ts.map +0 -1
- package/dist/public/doctor.png +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/image/doctor.png +0 -0
- package/dist/public/image/logo.png +0 -0
- package/dist/public/image/logoWhite.png +0 -0
- package/dist/public/image/patient.png +0 -0
- package/dist/public/logo.png +0 -0
- package/dist/public/logoWhite.png +0 -0
- package/dist/public/patient.png +0 -0
- package/dist/styles/theme-variables.css +0 -62
- package/dist/types/doctor.d.ts +0 -144
- package/dist/types/doctor.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1103,33 +1103,68 @@ function useWatch(props) {
|
|
|
1103
1103
|
const _defaultValue = React.useRef(defaultValue);
|
|
1104
1104
|
const _compute = React.useRef(compute);
|
|
1105
1105
|
const _computeFormValues = React.useRef(undefined);
|
|
1106
|
+
const _prevControl = React.useRef(control);
|
|
1107
|
+
const _prevName = React.useRef(name);
|
|
1106
1108
|
_compute.current = compute;
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
else {
|
|
1126
|
-
updateValue(formValues);
|
|
1109
|
+
const [value, updateValue] = React.useState(() => {
|
|
1110
|
+
const defaultValue = control._getWatch(name, _defaultValue.current);
|
|
1111
|
+
return _compute.current ? _compute.current(defaultValue) : defaultValue;
|
|
1112
|
+
});
|
|
1113
|
+
const getCurrentOutput = React.useCallback((values) => {
|
|
1114
|
+
const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
|
|
1115
|
+
return _compute.current ? _compute.current(formValues) : formValues;
|
|
1116
|
+
}, [control._formValues, control._names, name]);
|
|
1117
|
+
const refreshValue = React.useCallback((values) => {
|
|
1118
|
+
if (!disabled) {
|
|
1119
|
+
const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
|
|
1120
|
+
if (_compute.current) {
|
|
1121
|
+
const computedFormValues = _compute.current(formValues);
|
|
1122
|
+
if (!deepEqual(computedFormValues, _computeFormValues.current)) {
|
|
1123
|
+
updateValue(computedFormValues);
|
|
1124
|
+
_computeFormValues.current = computedFormValues;
|
|
1127
1125
|
}
|
|
1128
1126
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1127
|
+
else {
|
|
1128
|
+
updateValue(formValues);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}, [control._formValues, control._names, disabled, name]);
|
|
1132
|
+
useIsomorphicLayoutEffect(() => {
|
|
1133
|
+
if (_prevControl.current !== control ||
|
|
1134
|
+
!deepEqual(_prevName.current, name)) {
|
|
1135
|
+
_prevControl.current = control;
|
|
1136
|
+
_prevName.current = name;
|
|
1137
|
+
refreshValue();
|
|
1138
|
+
}
|
|
1139
|
+
return control._subscribe({
|
|
1140
|
+
name,
|
|
1141
|
+
formState: {
|
|
1142
|
+
values: true,
|
|
1143
|
+
},
|
|
1144
|
+
exact,
|
|
1145
|
+
callback: (formState) => {
|
|
1146
|
+
refreshValue(formState.values);
|
|
1147
|
+
},
|
|
1148
|
+
});
|
|
1149
|
+
}, [control, exact, name, refreshValue]);
|
|
1131
1150
|
React.useEffect(() => control._removeUnmounted());
|
|
1132
|
-
|
|
1151
|
+
// If name or control changed for this render, synchronously reflect the
|
|
1152
|
+
// latest value so callers (like useController) see the correct value
|
|
1153
|
+
// immediately on the same render.
|
|
1154
|
+
// Optimize: Check control reference first before expensive deepEqual
|
|
1155
|
+
const controlChanged = _prevControl.current !== control;
|
|
1156
|
+
const prevName = _prevName.current;
|
|
1157
|
+
// Cache the computed output to avoid duplicate calls within the same render
|
|
1158
|
+
// We include shouldReturnImmediate in deps to ensure proper recomputation
|
|
1159
|
+
const computedOutput = React.useMemo(() => {
|
|
1160
|
+
if (disabled) {
|
|
1161
|
+
return null;
|
|
1162
|
+
}
|
|
1163
|
+
const nameChanged = !controlChanged && !deepEqual(prevName, name);
|
|
1164
|
+
const shouldReturnImmediate = controlChanged || nameChanged;
|
|
1165
|
+
return shouldReturnImmediate ? getCurrentOutput() : null;
|
|
1166
|
+
}, [disabled, controlChanged, name, prevName, getCurrentOutput]);
|
|
1167
|
+
return computedOutput !== null ? computedOutput : value;
|
|
1133
1168
|
}
|
|
1134
1169
|
|
|
1135
1170
|
/**
|
|
@@ -1257,7 +1292,7 @@ function useController(props) {
|
|
|
1257
1292
|
};
|
|
1258
1293
|
updateMounted(name, true);
|
|
1259
1294
|
if (_shouldUnregisterField) {
|
|
1260
|
-
const value = cloneObject(get(control._options.defaultValues, name));
|
|
1295
|
+
const value = cloneObject(get(control._options.defaultValues, name, _props.current.defaultValue));
|
|
1261
1296
|
set(control._defaultValues, name, value);
|
|
1262
1297
|
if (isUndefined(get(control._formValues, name))) {
|
|
1263
1298
|
set(control._formValues, name, value);
|
|
@@ -1454,7 +1489,7 @@ function SearchAutocomplete({ onSelect, selectedId, searchFunction, getEntityByI
|
|
|
1454
1489
|
console.log(`Selected entity with ID: ${entity.id}`);
|
|
1455
1490
|
setSelectedEntity(entity);
|
|
1456
1491
|
setSearchTerm(getDisplayValue(entity));
|
|
1457
|
-
onSelect(entity.id);
|
|
1492
|
+
onSelect(entity.id, entity);
|
|
1458
1493
|
setShowDropdown(false);
|
|
1459
1494
|
};
|
|
1460
1495
|
const handleClearSelection = () => {
|