@ews-admin/global-design-system 1.1.27 → 1.5.0
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/README.md +2 -2
- package/dist/index.css +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.css +2 -2
- package/dist/index.esm.js +42 -67
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +42 -67
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32921,29 +32921,23 @@ var isWeb = typeof window !== 'undefined' &&
|
|
|
32921
32921
|
typeof document !== 'undefined';
|
|
32922
32922
|
|
|
32923
32923
|
function cloneObject(data) {
|
|
32924
|
-
let copy;
|
|
32925
|
-
const isArray = Array.isArray(data);
|
|
32926
|
-
const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
|
|
32927
32924
|
if (data instanceof Date) {
|
|
32928
|
-
|
|
32925
|
+
return new Date(data);
|
|
32929
32926
|
}
|
|
32930
|
-
|
|
32931
|
-
|
|
32932
|
-
|
|
32933
|
-
if (!isArray && !isPlainObject(data)) {
|
|
32934
|
-
copy = data;
|
|
32935
|
-
}
|
|
32936
|
-
else {
|
|
32937
|
-
for (const key in data) {
|
|
32938
|
-
if (data.hasOwnProperty(key)) {
|
|
32939
|
-
copy[key] = cloneObject(data[key]);
|
|
32940
|
-
}
|
|
32941
|
-
}
|
|
32942
|
-
}
|
|
32927
|
+
const isFileListInstance = typeof FileList !== 'undefined' && data instanceof FileList;
|
|
32928
|
+
if (isWeb && (data instanceof Blob || isFileListInstance)) {
|
|
32929
|
+
return data;
|
|
32943
32930
|
}
|
|
32944
|
-
|
|
32931
|
+
const isArray = Array.isArray(data);
|
|
32932
|
+
if (!isArray && !(isObject(data) && isPlainObject(data))) {
|
|
32945
32933
|
return data;
|
|
32946
32934
|
}
|
|
32935
|
+
const copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
|
|
32936
|
+
for (const key in data) {
|
|
32937
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
32938
|
+
copy[key] = cloneObject(data[key]);
|
|
32939
|
+
}
|
|
32940
|
+
}
|
|
32947
32941
|
return copy;
|
|
32948
32942
|
}
|
|
32949
32943
|
|
|
@@ -32969,6 +32963,8 @@ var get = (object, path, defaultValue) => {
|
|
|
32969
32963
|
|
|
32970
32964
|
var isBoolean = (value) => typeof value === 'boolean';
|
|
32971
32965
|
|
|
32966
|
+
var isFunction = (value) => typeof value === 'function';
|
|
32967
|
+
|
|
32972
32968
|
var set = (object, path, value) => {
|
|
32973
32969
|
let index = -1;
|
|
32974
32970
|
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
@@ -32996,45 +32992,21 @@ var set = (object, path, value) => {
|
|
|
32996
32992
|
|
|
32997
32993
|
const EVENTS = {
|
|
32998
32994
|
BLUR: 'blur',
|
|
32999
|
-
CHANGE: 'change'
|
|
33000
|
-
};
|
|
32995
|
+
CHANGE: 'change'};
|
|
33001
32996
|
const VALIDATION_MODE = {
|
|
33002
32997
|
all: 'all',
|
|
33003
32998
|
};
|
|
33004
32999
|
|
|
33005
|
-
const HookFormContext = React.createContext(null);
|
|
33006
|
-
HookFormContext.displayName = 'HookFormContext';
|
|
33007
33000
|
/**
|
|
33008
|
-
*
|
|
33009
|
-
*
|
|
33010
|
-
|
|
33011
|
-
|
|
33012
|
-
|
|
33013
|
-
|
|
33014
|
-
*
|
|
33015
|
-
* @example
|
|
33016
|
-
* ```tsx
|
|
33017
|
-
* function App() {
|
|
33018
|
-
* const methods = useForm();
|
|
33019
|
-
* const onSubmit = data => console.log(data);
|
|
33020
|
-
*
|
|
33021
|
-
* return (
|
|
33022
|
-
* <FormProvider {...methods} >
|
|
33023
|
-
* <form onSubmit={methods.handleSubmit(onSubmit)}>
|
|
33024
|
-
* <NestedInput />
|
|
33025
|
-
* <input type="submit" />
|
|
33026
|
-
* </form>
|
|
33027
|
-
* </FormProvider>
|
|
33028
|
-
* );
|
|
33029
|
-
* }
|
|
33030
|
-
*
|
|
33031
|
-
* function NestedInput() {
|
|
33032
|
-
* const { register } = useFormContext(); // retrieve all hook methods
|
|
33033
|
-
* return <input {...register("test")} />;
|
|
33034
|
-
* }
|
|
33035
|
-
* ```
|
|
33001
|
+
* Separate context for `control` to prevent unnecessary rerenders.
|
|
33002
|
+
* Internal hooks that only need control use this instead of full form context.
|
|
33003
|
+
*/
|
|
33004
|
+
const HookFormControlContext = React.createContext(null);
|
|
33005
|
+
HookFormControlContext.displayName = 'HookFormControlContext';
|
|
33006
|
+
/**
|
|
33007
|
+
* @internal Internal hook to access only control from context.
|
|
33036
33008
|
*/
|
|
33037
|
-
const
|
|
33009
|
+
const useFormControlContext = () => React.useContext(HookFormControlContext);
|
|
33038
33010
|
|
|
33039
33011
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
33040
33012
|
const result = {
|
|
@@ -33088,8 +33060,8 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayou
|
|
|
33088
33060
|
* ```
|
|
33089
33061
|
*/
|
|
33090
33062
|
function useFormState(props) {
|
|
33091
|
-
const
|
|
33092
|
-
const { control =
|
|
33063
|
+
const formControl = useFormControlContext();
|
|
33064
|
+
const { control = formControl, disabled, name, exact } = props || {};
|
|
33093
33065
|
const [formState, updateFormState] = React.useState(control._formState);
|
|
33094
33066
|
const _localProxyFormState = React.useRef({
|
|
33095
33067
|
isDirty: false,
|
|
@@ -33135,10 +33107,10 @@ var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
|
33135
33107
|
|
|
33136
33108
|
function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
|
|
33137
33109
|
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
33138
|
-
return object1
|
|
33110
|
+
return Object.is(object1, object2);
|
|
33139
33111
|
}
|
|
33140
33112
|
if (isDateObject(object1) && isDateObject(object2)) {
|
|
33141
|
-
return object1.getTime()
|
|
33113
|
+
return Object.is(object1.getTime(), object2.getTime());
|
|
33142
33114
|
}
|
|
33143
33115
|
const keys1 = Object.keys(object1);
|
|
33144
33116
|
const keys2 = Object.keys(object2);
|
|
@@ -33161,7 +33133,7 @@ function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
|
|
|
33161
33133
|
(isObject(val1) && isObject(val2)) ||
|
|
33162
33134
|
(Array.isArray(val1) && Array.isArray(val2))
|
|
33163
33135
|
? !deepEqual(val1, val2, _internal_visited)
|
|
33164
|
-
: val1
|
|
33136
|
+
: !Object.is(val1, val2)) {
|
|
33165
33137
|
return false;
|
|
33166
33138
|
}
|
|
33167
33139
|
}
|
|
@@ -33186,8 +33158,8 @@ function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
|
|
|
33186
33158
|
* ```
|
|
33187
33159
|
*/
|
|
33188
33160
|
function useWatch(props) {
|
|
33189
|
-
const
|
|
33190
|
-
const { control =
|
|
33161
|
+
const formControl = useFormControlContext();
|
|
33162
|
+
const { control = formControl, name, defaultValue, disabled, exact, compute, } = props || {};
|
|
33191
33163
|
const _defaultValue = React.useRef(defaultValue);
|
|
33192
33164
|
const _compute = React.useRef(compute);
|
|
33193
33165
|
const _computeFormValues = React.useRef(undefined);
|
|
@@ -33280,20 +33252,20 @@ function useWatch(props) {
|
|
|
33280
33252
|
* ```
|
|
33281
33253
|
*/
|
|
33282
33254
|
function useController(props) {
|
|
33283
|
-
const
|
|
33284
|
-
const { name, disabled, control =
|
|
33255
|
+
const formControl = useFormControlContext();
|
|
33256
|
+
const { name, disabled, control = formControl, shouldUnregister, defaultValue, exact = true, } = props;
|
|
33285
33257
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
33286
33258
|
const defaultValueMemo = React.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
33287
33259
|
const value = useWatch({
|
|
33288
33260
|
control,
|
|
33289
33261
|
name,
|
|
33290
33262
|
defaultValue: defaultValueMemo,
|
|
33291
|
-
exact
|
|
33263
|
+
exact,
|
|
33292
33264
|
});
|
|
33293
33265
|
const formState = useFormState({
|
|
33294
33266
|
control,
|
|
33295
33267
|
name,
|
|
33296
|
-
exact
|
|
33268
|
+
exact,
|
|
33297
33269
|
});
|
|
33298
33270
|
const _props = React.useRef(props);
|
|
33299
33271
|
const _previousNameRef = React.useRef(undefined);
|
|
@@ -33341,12 +33313,12 @@ function useController(props) {
|
|
|
33341
33313
|
}), [name, control._formValues]);
|
|
33342
33314
|
const ref = React.useCallback((elm) => {
|
|
33343
33315
|
const field = get(control._fields, name);
|
|
33344
|
-
if (field && elm) {
|
|
33316
|
+
if (field && field._f && elm) {
|
|
33345
33317
|
field._f.ref = {
|
|
33346
|
-
focus: () => elm.focus && elm.focus(),
|
|
33347
|
-
select: () => elm.select && elm.select(),
|
|
33348
|
-
setCustomValidity: (message) => elm.setCustomValidity(message),
|
|
33349
|
-
reportValidity: () => elm.reportValidity(),
|
|
33318
|
+
focus: () => isFunction(elm.focus) && elm.focus(),
|
|
33319
|
+
select: () => isFunction(elm.select) && elm.select(),
|
|
33320
|
+
setCustomValidity: (message) => isFunction(elm.setCustomValidity) && elm.setCustomValidity(message),
|
|
33321
|
+
reportValidity: () => isFunction(elm.reportValidity) && elm.reportValidity(),
|
|
33350
33322
|
};
|
|
33351
33323
|
}
|
|
33352
33324
|
}, [control._fields, name]);
|
|
@@ -33453,6 +33425,9 @@ function useController(props) {
|
|
|
33453
33425
|
*/
|
|
33454
33426
|
const Controller = (props) => props.render(useController(props));
|
|
33455
33427
|
|
|
33428
|
+
const HookFormContext = React.createContext(null);
|
|
33429
|
+
HookFormContext.displayName = 'HookFormContext';
|
|
33430
|
+
|
|
33456
33431
|
function useSelectField({ name, control, options: _options, rules, defaultValue, }) {
|
|
33457
33432
|
const { field, fieldState: { error, invalid }, } = useController({
|
|
33458
33433
|
name,
|