@sebgroup/green-react 2.5.0 → 2.6.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/index.esm.js +393 -327
- package/package.json +4 -4
- package/src/lib/form/button/button.d.ts +8 -8
- package/src/lib/form/buttonGroup/buttonGroup.d.ts +3 -1
- package/src/lib/form/checkbox/checkbox.d.ts +15 -0
- package/src/lib/form/index.d.ts +2 -0
- package/src/lib/form/input/input.d.ts +26 -10
- package/src/lib/form/radioButton/radioButton.d.ts +9 -0
- package/src/lib/form/radioButton/radioGroup.d.ts +2 -1
- package/src/lib/form/textarea/textarea.d.ts +11 -6
- package/src/lib/formItem/formItem.d.ts +5 -4
- package/src/lib/in-page-wizard/inPageWizardStepCard.d.ts +16 -8
- package/src/lib/link/link.d.ts +1 -1
- package/src/lib/modal/modal.d.ts +1 -1
- package/src/lib/form/types.d.ts +0 -27
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useState, useEffect, useRef,
|
|
3
|
-
import { randomId, createDatepicker, months, years,
|
|
2
|
+
import React, { useState, useEffect, useRef, useMemo, useLayoutEffect, forwardRef, useCallback } from 'react';
|
|
3
|
+
import { randomId, createDatepicker, months, years, validateClassName, debounce, delay, sliderColors, getSliderTrackBackground, createStepper } from '@sebgroup/extract';
|
|
4
4
|
import { getScopedTagName, GdsDropdown, GdsOption } from '@sebgroup/green-core';
|
|
5
5
|
import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles';
|
|
6
6
|
import classNames from 'classnames';
|
|
@@ -98,8 +98,9 @@ var global$k =
|
|
|
98
98
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
99
99
|
check(typeof self == 'object' && self) ||
|
|
100
100
|
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
101
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
101
102
|
// eslint-disable-next-line no-new-func -- fallback
|
|
102
|
-
(function () { return this; })() ||
|
|
103
|
+
(function () { return this; })() || Function('return this')();
|
|
103
104
|
|
|
104
105
|
var shared$3 = {exports: {}};
|
|
105
106
|
|
|
@@ -129,10 +130,10 @@ var store$2 = sharedStore;
|
|
|
129
130
|
(shared$3.exports = function (key, value) {
|
|
130
131
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
131
132
|
})('versions', []).push({
|
|
132
|
-
version: '3.33.
|
|
133
|
+
version: '3.33.3',
|
|
133
134
|
mode: 'global',
|
|
134
135
|
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
|
|
135
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.33.
|
|
136
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.33.3/LICENSE',
|
|
136
137
|
source: 'https://github.com/zloirock/core-js'
|
|
137
138
|
});
|
|
138
139
|
|
|
@@ -2461,94 +2462,31 @@ const Datepicker = (options = {}) => {
|
|
|
2461
2462
|
});
|
|
2462
2463
|
};
|
|
2463
2464
|
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
var call$8 = functionCall;
|
|
2483
|
-
var hasOwn$2 = hasOwnProperty_1;
|
|
2484
|
-
var isPrototypeOf$3 = objectIsPrototypeOf;
|
|
2485
|
-
var regExpFlags = regexpFlags;
|
|
2486
|
-
|
|
2487
|
-
var RegExpPrototype$1 = RegExp.prototype;
|
|
2488
|
-
|
|
2489
|
-
var regexpGetFlags = function (R) {
|
|
2490
|
-
var flags = R.flags;
|
|
2491
|
-
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn$2(R, 'flags') && isPrototypeOf$3(RegExpPrototype$1, R)
|
|
2492
|
-
? call$8(regExpFlags, R) : flags;
|
|
2493
|
-
};
|
|
2494
|
-
|
|
2495
|
-
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
2496
|
-
var defineBuiltIn$2 = defineBuiltIn$6;
|
|
2497
|
-
var anObject$5 = anObject$c;
|
|
2498
|
-
var $toString = toString$4;
|
|
2499
|
-
var fails$3 = fails$g;
|
|
2500
|
-
var getRegExpFlags = regexpGetFlags;
|
|
2501
|
-
|
|
2502
|
-
var TO_STRING = 'toString';
|
|
2503
|
-
var RegExpPrototype = RegExp.prototype;
|
|
2504
|
-
var nativeToString = RegExpPrototype[TO_STRING];
|
|
2505
|
-
|
|
2506
|
-
var NOT_GENERIC = fails$3(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
|
|
2507
|
-
// FF44- RegExp#toString has a wrong name
|
|
2508
|
-
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
|
|
2509
|
-
|
|
2510
|
-
// `RegExp.prototype.toString` method
|
|
2511
|
-
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
2512
|
-
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
2513
|
-
defineBuiltIn$2(RegExp.prototype, TO_STRING, function toString() {
|
|
2514
|
-
var R = anObject$5(this);
|
|
2515
|
-
var pattern = $toString(R.source);
|
|
2516
|
-
var flags = $toString(getRegExpFlags(R));
|
|
2517
|
-
return '/' + pattern + '/' + flags;
|
|
2518
|
-
}, { unsafe: true });
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
function Button({
|
|
2522
|
-
children,
|
|
2523
|
-
variant,
|
|
2524
|
-
onClick,
|
|
2525
|
-
disabled,
|
|
2526
|
-
active = false,
|
|
2527
|
-
type = 'button',
|
|
2528
|
-
size,
|
|
2529
|
-
testId
|
|
2530
|
-
}) {
|
|
2531
|
-
var _a;
|
|
2532
|
-
const props = {
|
|
2533
|
-
type,
|
|
2534
|
-
disabled
|
|
2535
|
-
};
|
|
2536
|
-
const classNames = [];
|
|
2537
|
-
if (variant) classNames.push(variant);
|
|
2538
|
-
if (active) classNames.push('active');
|
|
2539
|
-
if (size) classNames.push(size);
|
|
2540
|
-
if (classNames.length) props.className = classNames.join(' ');
|
|
2541
|
-
if (onClick) props.onClick = onClick;
|
|
2542
|
-
return variant == 'close' ? jsx("button", Object.assign({}, props, {
|
|
2543
|
-
"aria-label": (_a = children === null || children === void 0 ? void 0 : children.toString()) !== null && _a !== void 0 ? _a : 'Close',
|
|
2465
|
+
function Button(_a) {
|
|
2466
|
+
var _b;
|
|
2467
|
+
var {
|
|
2468
|
+
className,
|
|
2469
|
+
variant,
|
|
2470
|
+
active = false,
|
|
2471
|
+
type = 'button',
|
|
2472
|
+
size,
|
|
2473
|
+
testId
|
|
2474
|
+
} = _a,
|
|
2475
|
+
otherProps = __rest(_a, ["className", "variant", "active", "type", "size", "testId"]);
|
|
2476
|
+
const buttonClassName = classNames(className, variant, size, {
|
|
2477
|
+
active: active
|
|
2478
|
+
}) || undefined;
|
|
2479
|
+
return variant == 'close' ? jsx("button", Object.assign({
|
|
2480
|
+
className: buttonClassName,
|
|
2481
|
+
"aria-label": (_b = otherProps['aria-label']) !== null && _b !== void 0 ? _b : 'Close',
|
|
2544
2482
|
"data-testid": testId
|
|
2545
|
-
}, {
|
|
2483
|
+
}, otherProps, {
|
|
2546
2484
|
children: jsx("i", {})
|
|
2547
|
-
})) : jsx("button", Object.assign({
|
|
2485
|
+
})) : jsx("button", Object.assign({
|
|
2486
|
+
className: buttonClassName,
|
|
2487
|
+
type: type,
|
|
2548
2488
|
"data-testid": testId
|
|
2549
|
-
},
|
|
2550
|
-
children: children
|
|
2551
|
-
}));
|
|
2489
|
+
}, otherProps));
|
|
2552
2490
|
}
|
|
2553
2491
|
|
|
2554
2492
|
const IconButton = _a => {
|
|
@@ -2571,6 +2509,7 @@ const IconButton = _a => {
|
|
|
2571
2509
|
|
|
2572
2510
|
const ButtonGroup = ({
|
|
2573
2511
|
children,
|
|
2512
|
+
className,
|
|
2574
2513
|
selectedIndex,
|
|
2575
2514
|
variant,
|
|
2576
2515
|
id
|
|
@@ -2587,12 +2526,13 @@ const ButtonGroup = ({
|
|
|
2587
2526
|
onClick: e => {
|
|
2588
2527
|
setSelected(ix);
|
|
2589
2528
|
if (bp.onClick) bp.onClick(e);
|
|
2590
|
-
}
|
|
2529
|
+
},
|
|
2530
|
+
className: classNames(bp.className, className)
|
|
2591
2531
|
});
|
|
2592
2532
|
return props;
|
|
2593
2533
|
});
|
|
2594
2534
|
setButtons(buttonProps);
|
|
2595
|
-
}, [children, selected, variant]);
|
|
2535
|
+
}, [children, selected, variant, className]);
|
|
2596
2536
|
return jsx(Group, Object.assign({
|
|
2597
2537
|
"data-label": "button-group",
|
|
2598
2538
|
id: id
|
|
@@ -2601,6 +2541,52 @@ const ButtonGroup = ({
|
|
|
2601
2541
|
}));
|
|
2602
2542
|
};
|
|
2603
2543
|
|
|
2544
|
+
const useInput = (props, onChanges, onChangeInput) => {
|
|
2545
|
+
const id = useMemo(() => props.id || randomId(), [props.id]);
|
|
2546
|
+
const ref = useRef(null);
|
|
2547
|
+
const onChange = event => {
|
|
2548
|
+
onChanges && onChanges(event);
|
|
2549
|
+
onChangeInput && onChangeInput(event.target.value);
|
|
2550
|
+
};
|
|
2551
|
+
return Object.assign(Object.assign({}, props), {
|
|
2552
|
+
id,
|
|
2553
|
+
ref,
|
|
2554
|
+
onChange
|
|
2555
|
+
});
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2558
|
+
const Checkbox = _a => {
|
|
2559
|
+
var {
|
|
2560
|
+
label,
|
|
2561
|
+
onChange,
|
|
2562
|
+
validator,
|
|
2563
|
+
testId
|
|
2564
|
+
} = _a,
|
|
2565
|
+
props = __rest(_a, ["label", "onChange", "validator", "testId"]);
|
|
2566
|
+
const inputProps = useInput(props, onChange);
|
|
2567
|
+
const labelClassNames = classNames('form-control', validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator));
|
|
2568
|
+
const inputClassNames = classNames(validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator));
|
|
2569
|
+
return jsxs("div", Object.assign({
|
|
2570
|
+
className: "form-group"
|
|
2571
|
+
}, {
|
|
2572
|
+
children: [jsxs("label", Object.assign({
|
|
2573
|
+
htmlFor: inputProps.id,
|
|
2574
|
+
className: labelClassNames
|
|
2575
|
+
}, {
|
|
2576
|
+
children: [label, jsx("input", Object.assign({
|
|
2577
|
+
type: "checkbox",
|
|
2578
|
+
"data-testid": testId
|
|
2579
|
+
}, inputProps, {
|
|
2580
|
+
className: inputClassNames
|
|
2581
|
+
})), jsx("i", {})]
|
|
2582
|
+
})), validator && jsx("span", Object.assign({
|
|
2583
|
+
className: "form-info"
|
|
2584
|
+
}, {
|
|
2585
|
+
children: validator.message
|
|
2586
|
+
}))]
|
|
2587
|
+
}));
|
|
2588
|
+
};
|
|
2589
|
+
|
|
2604
2590
|
/* eslint-disable-next-line */
|
|
2605
2591
|
const validateInputValue = (target, rules, setError) => {
|
|
2606
2592
|
const errorMessage = validateInputValueErrors(rules, target);
|
|
@@ -2716,6 +2702,7 @@ const FormItems = ({
|
|
|
2716
2702
|
onChange: _onFormItemsChanged
|
|
2717
2703
|
}) => {
|
|
2718
2704
|
const {
|
|
2705
|
+
values,
|
|
2719
2706
|
setValues,
|
|
2720
2707
|
setErrors,
|
|
2721
2708
|
setFields,
|
|
@@ -2778,6 +2765,7 @@ const FormItems = ({
|
|
|
2778
2765
|
return /*#__PURE__*/React.cloneElement(children, {
|
|
2779
2766
|
validator: (errors === null || errors === void 0 ? void 0 : errors[name]) && validate,
|
|
2780
2767
|
name,
|
|
2768
|
+
value: values === null || values === void 0 ? void 0 : values[name],
|
|
2781
2769
|
onChange: event => {
|
|
2782
2770
|
if (typeof _onFormItemsChanged === 'function') {
|
|
2783
2771
|
_onFormItemsChanged(event);
|
|
@@ -2851,17 +2839,17 @@ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
|
2851
2839
|
}
|
|
2852
2840
|
};
|
|
2853
2841
|
|
|
2854
|
-
var isPrototypeOf$
|
|
2842
|
+
var isPrototypeOf$3 = objectIsPrototypeOf;
|
|
2855
2843
|
|
|
2856
2844
|
var $TypeError$5 = TypeError;
|
|
2857
2845
|
|
|
2858
2846
|
var anInstance$1 = function (it, Prototype) {
|
|
2859
|
-
if (isPrototypeOf$
|
|
2847
|
+
if (isPrototypeOf$3(Prototype, it)) return it;
|
|
2860
2848
|
throw new $TypeError$5('Incorrect invocation');
|
|
2861
2849
|
};
|
|
2862
2850
|
|
|
2863
2851
|
var uncurryThis$6 = functionUncurryThis;
|
|
2864
|
-
var fails$
|
|
2852
|
+
var fails$3 = fails$g;
|
|
2865
2853
|
var isCallable$5 = isCallable$l;
|
|
2866
2854
|
var classof$1 = classof$4;
|
|
2867
2855
|
var getBuiltIn$2 = getBuiltIn$7;
|
|
@@ -2905,7 +2893,7 @@ isConstructorLegacy.sham = true;
|
|
|
2905
2893
|
|
|
2906
2894
|
// `IsConstructor` abstract operation
|
|
2907
2895
|
// https://tc39.es/ecma262/#sec-isconstructor
|
|
2908
|
-
var isConstructor$1 = !construct || fails$
|
|
2896
|
+
var isConstructor$1 = !construct || fails$3(function () {
|
|
2909
2897
|
var called;
|
|
2910
2898
|
return isConstructorModern(isConstructorModern.call)
|
|
2911
2899
|
|| !isConstructorModern(Object)
|
|
@@ -2924,7 +2912,7 @@ var aConstructor$1 = function (argument) {
|
|
|
2924
2912
|
throw new $TypeError$4(tryToString$2(argument) + ' is not a constructor');
|
|
2925
2913
|
};
|
|
2926
2914
|
|
|
2927
|
-
var anObject$
|
|
2915
|
+
var anObject$6 = anObject$c;
|
|
2928
2916
|
var aConstructor = aConstructor$1;
|
|
2929
2917
|
var isNullOrUndefined$1 = isNullOrUndefined$4;
|
|
2930
2918
|
var wellKnownSymbol$4 = wellKnownSymbol$g;
|
|
@@ -2934,20 +2922,20 @@ var SPECIES$1 = wellKnownSymbol$4('species');
|
|
|
2934
2922
|
// `SpeciesConstructor` abstract operation
|
|
2935
2923
|
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
2936
2924
|
var speciesConstructor$1 = function (O, defaultConstructor) {
|
|
2937
|
-
var C = anObject$
|
|
2925
|
+
var C = anObject$6(O).constructor;
|
|
2938
2926
|
var S;
|
|
2939
|
-
return C === undefined || isNullOrUndefined$1(S = anObject$
|
|
2927
|
+
return C === undefined || isNullOrUndefined$1(S = anObject$6(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
|
|
2940
2928
|
};
|
|
2941
2929
|
|
|
2942
2930
|
var NATIVE_BIND$1 = functionBindNative;
|
|
2943
2931
|
|
|
2944
2932
|
var FunctionPrototype = Function.prototype;
|
|
2945
2933
|
var apply$1 = FunctionPrototype.apply;
|
|
2946
|
-
var call$
|
|
2934
|
+
var call$8 = FunctionPrototype.call;
|
|
2947
2935
|
|
|
2948
2936
|
// eslint-disable-next-line es/no-reflect -- safe
|
|
2949
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$
|
|
2950
|
-
return call$
|
|
2937
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$8.bind(apply$1) : function () {
|
|
2938
|
+
return call$8.apply(apply$1, arguments);
|
|
2951
2939
|
});
|
|
2952
2940
|
|
|
2953
2941
|
var classofRaw = classofRaw$2;
|
|
@@ -2994,8 +2982,8 @@ var global$7 = global$k;
|
|
|
2994
2982
|
var apply = functionApply;
|
|
2995
2983
|
var bind$3 = functionBindContext;
|
|
2996
2984
|
var isCallable$4 = isCallable$l;
|
|
2997
|
-
var hasOwn$
|
|
2998
|
-
var fails$
|
|
2985
|
+
var hasOwn$2 = hasOwnProperty_1;
|
|
2986
|
+
var fails$2 = fails$g;
|
|
2999
2987
|
var html = html$2;
|
|
3000
2988
|
var arraySlice = arraySlice$1;
|
|
3001
2989
|
var createElement = documentCreateElement$2;
|
|
@@ -3015,13 +3003,13 @@ var queue$2 = {};
|
|
|
3015
3003
|
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
3016
3004
|
var $location, defer, channel, port;
|
|
3017
3005
|
|
|
3018
|
-
fails$
|
|
3006
|
+
fails$2(function () {
|
|
3019
3007
|
// Deno throws a ReferenceError on `location` access without `--location` flag
|
|
3020
3008
|
$location = global$7.location;
|
|
3021
3009
|
});
|
|
3022
3010
|
|
|
3023
3011
|
var run = function (id) {
|
|
3024
|
-
if (hasOwn$
|
|
3012
|
+
if (hasOwn$2(queue$2, id)) {
|
|
3025
3013
|
var fn = queue$2[id];
|
|
3026
3014
|
delete queue$2[id];
|
|
3027
3015
|
fn();
|
|
@@ -3082,7 +3070,7 @@ if (!set || !clear) {
|
|
|
3082
3070
|
isCallable$4(global$7.postMessage) &&
|
|
3083
3071
|
!global$7.importScripts &&
|
|
3084
3072
|
$location && $location.protocol !== 'file:' &&
|
|
3085
|
-
!fails$
|
|
3073
|
+
!fails$2(globalPostMessageDefer)
|
|
3086
3074
|
) {
|
|
3087
3075
|
defer = globalPostMessageDefer;
|
|
3088
3076
|
global$7.addEventListener('message', eventListener, false);
|
|
@@ -3321,8 +3309,8 @@ newPromiseCapability$2.f = function (C) {
|
|
|
3321
3309
|
var $$7 = _export;
|
|
3322
3310
|
var IS_NODE = engineIsNode;
|
|
3323
3311
|
var global$3 = global$k;
|
|
3324
|
-
var call$
|
|
3325
|
-
var defineBuiltIn$
|
|
3312
|
+
var call$7 = functionCall;
|
|
3313
|
+
var defineBuiltIn$2 = defineBuiltIn$6;
|
|
3326
3314
|
var setPrototypeOf = objectSetPrototypeOf;
|
|
3327
3315
|
var setToStringTag = setToStringTag$3;
|
|
3328
3316
|
var setSpecies = setSpecies$1;
|
|
@@ -3399,7 +3387,7 @@ var callReaction = function (reaction, state) {
|
|
|
3399
3387
|
if (result === reaction.promise) {
|
|
3400
3388
|
reject(new TypeError$1('Promise-chain cycle'));
|
|
3401
3389
|
} else if (then = isThenable(result)) {
|
|
3402
|
-
call$
|
|
3390
|
+
call$7(then, result, resolve, reject);
|
|
3403
3391
|
} else resolve(result);
|
|
3404
3392
|
} else reject(value);
|
|
3405
3393
|
} catch (error) {
|
|
@@ -3436,7 +3424,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
3436
3424
|
};
|
|
3437
3425
|
|
|
3438
3426
|
var onUnhandled = function (state) {
|
|
3439
|
-
call$
|
|
3427
|
+
call$7(task, global$3, function () {
|
|
3440
3428
|
var promise = state.facade;
|
|
3441
3429
|
var value = state.value;
|
|
3442
3430
|
var IS_UNHANDLED = isUnhandled(state);
|
|
@@ -3459,7 +3447,7 @@ var isUnhandled = function (state) {
|
|
|
3459
3447
|
};
|
|
3460
3448
|
|
|
3461
3449
|
var onHandleUnhandled = function (state) {
|
|
3462
|
-
call$
|
|
3450
|
+
call$7(task, global$3, function () {
|
|
3463
3451
|
var promise = state.facade;
|
|
3464
3452
|
if (IS_NODE) {
|
|
3465
3453
|
process.emit('rejectionHandled', promise);
|
|
@@ -3493,7 +3481,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
3493
3481
|
microtask(function () {
|
|
3494
3482
|
var wrapper = { done: false };
|
|
3495
3483
|
try {
|
|
3496
|
-
call$
|
|
3484
|
+
call$7(then, value,
|
|
3497
3485
|
bind$1(internalResolve, wrapper, state),
|
|
3498
3486
|
bind$1(internalReject, wrapper, state)
|
|
3499
3487
|
);
|
|
@@ -3517,7 +3505,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
3517
3505
|
PromiseConstructor = function Promise(executor) {
|
|
3518
3506
|
anInstance(this, PromisePrototype);
|
|
3519
3507
|
aCallable$3(executor);
|
|
3520
|
-
call$
|
|
3508
|
+
call$7(Internal, this);
|
|
3521
3509
|
var state = getInternalPromiseState(this);
|
|
3522
3510
|
try {
|
|
3523
3511
|
executor(bind$1(internalResolve, state), bind$1(internalReject, state));
|
|
@@ -3544,7 +3532,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
3544
3532
|
|
|
3545
3533
|
// `Promise.prototype.then` method
|
|
3546
3534
|
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
3547
|
-
Internal.prototype = defineBuiltIn$
|
|
3535
|
+
Internal.prototype = defineBuiltIn$2(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
3548
3536
|
var state = getInternalPromiseState(this);
|
|
3549
3537
|
var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
|
|
3550
3538
|
state.parent = true;
|
|
@@ -3577,10 +3565,10 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
3577
3565
|
|
|
3578
3566
|
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
3579
3567
|
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
3580
|
-
defineBuiltIn$
|
|
3568
|
+
defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
3581
3569
|
var that = this;
|
|
3582
3570
|
return new PromiseConstructor(function (resolve, reject) {
|
|
3583
|
-
call$
|
|
3571
|
+
call$7(nativeThen, that, resolve, reject);
|
|
3584
3572
|
}).then(onFulfilled, onRejected);
|
|
3585
3573
|
// https://github.com/zloirock/core-js/issues/640
|
|
3586
3574
|
}, { unsafe: true });
|
|
@@ -3630,9 +3618,9 @@ var getIteratorMethod$2 = function (it) {
|
|
|
3630
3618
|
|| Iterators[classof(it)];
|
|
3631
3619
|
};
|
|
3632
3620
|
|
|
3633
|
-
var call$
|
|
3621
|
+
var call$6 = functionCall;
|
|
3634
3622
|
var aCallable$2 = aCallable$8;
|
|
3635
|
-
var anObject$
|
|
3623
|
+
var anObject$5 = anObject$c;
|
|
3636
3624
|
var tryToString$1 = tryToString$4;
|
|
3637
3625
|
var getIteratorMethod$1 = getIteratorMethod$2;
|
|
3638
3626
|
|
|
@@ -3640,41 +3628,41 @@ var $TypeError$1 = TypeError;
|
|
|
3640
3628
|
|
|
3641
3629
|
var getIterator$1 = function (argument, usingIterator) {
|
|
3642
3630
|
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
|
|
3643
|
-
if (aCallable$2(iteratorMethod)) return anObject$
|
|
3631
|
+
if (aCallable$2(iteratorMethod)) return anObject$5(call$6(iteratorMethod, argument));
|
|
3644
3632
|
throw new $TypeError$1(tryToString$1(argument) + ' is not iterable');
|
|
3645
3633
|
};
|
|
3646
3634
|
|
|
3647
|
-
var call$
|
|
3648
|
-
var anObject$
|
|
3635
|
+
var call$5 = functionCall;
|
|
3636
|
+
var anObject$4 = anObject$c;
|
|
3649
3637
|
var getMethod = getMethod$3;
|
|
3650
3638
|
|
|
3651
3639
|
var iteratorClose$1 = function (iterator, kind, value) {
|
|
3652
3640
|
var innerResult, innerError;
|
|
3653
|
-
anObject$
|
|
3641
|
+
anObject$4(iterator);
|
|
3654
3642
|
try {
|
|
3655
3643
|
innerResult = getMethod(iterator, 'return');
|
|
3656
3644
|
if (!innerResult) {
|
|
3657
3645
|
if (kind === 'throw') throw value;
|
|
3658
3646
|
return value;
|
|
3659
3647
|
}
|
|
3660
|
-
innerResult = call$
|
|
3648
|
+
innerResult = call$5(innerResult, iterator);
|
|
3661
3649
|
} catch (error) {
|
|
3662
3650
|
innerError = true;
|
|
3663
3651
|
innerResult = error;
|
|
3664
3652
|
}
|
|
3665
3653
|
if (kind === 'throw') throw value;
|
|
3666
3654
|
if (innerError) throw innerResult;
|
|
3667
|
-
anObject$
|
|
3655
|
+
anObject$4(innerResult);
|
|
3668
3656
|
return value;
|
|
3669
3657
|
};
|
|
3670
3658
|
|
|
3671
3659
|
var bind = functionBindContext;
|
|
3672
|
-
var call$
|
|
3673
|
-
var anObject$
|
|
3660
|
+
var call$4 = functionCall;
|
|
3661
|
+
var anObject$3 = anObject$c;
|
|
3674
3662
|
var tryToString = tryToString$4;
|
|
3675
3663
|
var isArrayIteratorMethod = isArrayIteratorMethod$1;
|
|
3676
3664
|
var lengthOfArrayLike = lengthOfArrayLike$2;
|
|
3677
|
-
var isPrototypeOf$
|
|
3665
|
+
var isPrototypeOf$2 = objectIsPrototypeOf;
|
|
3678
3666
|
var getIterator = getIterator$1;
|
|
3679
3667
|
var getIteratorMethod = getIteratorMethod$2;
|
|
3680
3668
|
var iteratorClose = iteratorClose$1;
|
|
@@ -3704,7 +3692,7 @@ var iterate$2 = function (iterable, unboundFunction, options) {
|
|
|
3704
3692
|
|
|
3705
3693
|
var callFn = function (value) {
|
|
3706
3694
|
if (AS_ENTRIES) {
|
|
3707
|
-
anObject$
|
|
3695
|
+
anObject$3(value);
|
|
3708
3696
|
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
3709
3697
|
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
3710
3698
|
};
|
|
@@ -3720,20 +3708,20 @@ var iterate$2 = function (iterable, unboundFunction, options) {
|
|
|
3720
3708
|
if (isArrayIteratorMethod(iterFn)) {
|
|
3721
3709
|
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
3722
3710
|
result = callFn(iterable[index]);
|
|
3723
|
-
if (result && isPrototypeOf$
|
|
3711
|
+
if (result && isPrototypeOf$2(ResultPrototype, result)) return result;
|
|
3724
3712
|
} return new Result(false);
|
|
3725
3713
|
}
|
|
3726
3714
|
iterator = getIterator(iterable, iterFn);
|
|
3727
3715
|
}
|
|
3728
3716
|
|
|
3729
3717
|
next = IS_RECORD ? iterable.next : iterator.next;
|
|
3730
|
-
while (!(step = call$
|
|
3718
|
+
while (!(step = call$4(next, iterator)).done) {
|
|
3731
3719
|
try {
|
|
3732
3720
|
result = callFn(step.value);
|
|
3733
3721
|
} catch (error) {
|
|
3734
3722
|
iteratorClose(iterator, 'throw', error);
|
|
3735
3723
|
}
|
|
3736
|
-
if (typeof result == 'object' && result && isPrototypeOf$
|
|
3724
|
+
if (typeof result == 'object' && result && isPrototypeOf$2(ResultPrototype, result)) return result;
|
|
3737
3725
|
} return new Result(false);
|
|
3738
3726
|
};
|
|
3739
3727
|
|
|
@@ -3787,7 +3775,7 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
|
|
|
3787
3775
|
});
|
|
3788
3776
|
|
|
3789
3777
|
var $$6 = _export;
|
|
3790
|
-
var call$
|
|
3778
|
+
var call$3 = functionCall;
|
|
3791
3779
|
var aCallable$1 = aCallable$8;
|
|
3792
3780
|
var newPromiseCapabilityModule$2 = newPromiseCapability$2;
|
|
3793
3781
|
var perform$1 = perform$3;
|
|
@@ -3811,7 +3799,7 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
3811
3799
|
var index = counter++;
|
|
3812
3800
|
var alreadyCalled = false;
|
|
3813
3801
|
remaining++;
|
|
3814
|
-
call$
|
|
3802
|
+
call$3($promiseResolve, C, promise).then(function (value) {
|
|
3815
3803
|
if (alreadyCalled) return;
|
|
3816
3804
|
alreadyCalled = true;
|
|
3817
3805
|
values[index] = value;
|
|
@@ -3830,7 +3818,7 @@ var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
|
|
|
3830
3818
|
var NativePromiseConstructor = promiseNativeConstructor;
|
|
3831
3819
|
var getBuiltIn$1 = getBuiltIn$7;
|
|
3832
3820
|
var isCallable$1 = isCallable$l;
|
|
3833
|
-
var defineBuiltIn = defineBuiltIn$6;
|
|
3821
|
+
var defineBuiltIn$1 = defineBuiltIn$6;
|
|
3834
3822
|
|
|
3835
3823
|
var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
|
|
3836
3824
|
|
|
@@ -3846,12 +3834,12 @@ $$5({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real
|
|
|
3846
3834
|
if (isCallable$1(NativePromiseConstructor)) {
|
|
3847
3835
|
var method = getBuiltIn$1('Promise').prototype['catch'];
|
|
3848
3836
|
if (NativePromisePrototype['catch'] !== method) {
|
|
3849
|
-
defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
3837
|
+
defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
3850
3838
|
}
|
|
3851
3839
|
}
|
|
3852
3840
|
|
|
3853
3841
|
var $$4 = _export;
|
|
3854
|
-
var call$
|
|
3842
|
+
var call$2 = functionCall;
|
|
3855
3843
|
var aCallable = aCallable$8;
|
|
3856
3844
|
var newPromiseCapabilityModule$1 = newPromiseCapability$2;
|
|
3857
3845
|
var perform = perform$3;
|
|
@@ -3868,7 +3856,7 @@ $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
3868
3856
|
var result = perform(function () {
|
|
3869
3857
|
var $promiseResolve = aCallable(C.resolve);
|
|
3870
3858
|
iterate(iterable, function (promise) {
|
|
3871
|
-
call$
|
|
3859
|
+
call$2($promiseResolve, C, promise).then(capability.resolve, reject);
|
|
3872
3860
|
});
|
|
3873
3861
|
});
|
|
3874
3862
|
if (result.error) reject(result.value);
|
|
@@ -3877,7 +3865,7 @@ $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
|
|
|
3877
3865
|
});
|
|
3878
3866
|
|
|
3879
3867
|
var $$3 = _export;
|
|
3880
|
-
var call = functionCall;
|
|
3868
|
+
var call$1 = functionCall;
|
|
3881
3869
|
var newPromiseCapabilityModule = newPromiseCapability$2;
|
|
3882
3870
|
var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
|
|
3883
3871
|
|
|
@@ -3886,17 +3874,17 @@ var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
|
|
|
3886
3874
|
$$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
3887
3875
|
reject: function reject(r) {
|
|
3888
3876
|
var capability = newPromiseCapabilityModule.f(this);
|
|
3889
|
-
call(capability.reject, undefined, r);
|
|
3877
|
+
call$1(capability.reject, undefined, r);
|
|
3890
3878
|
return capability.promise;
|
|
3891
3879
|
}
|
|
3892
3880
|
});
|
|
3893
3881
|
|
|
3894
|
-
var anObject = anObject$c;
|
|
3882
|
+
var anObject$2 = anObject$c;
|
|
3895
3883
|
var isObject = isObject$9;
|
|
3896
3884
|
var newPromiseCapability = newPromiseCapability$2;
|
|
3897
3885
|
|
|
3898
3886
|
var promiseResolve$1 = function (C, x) {
|
|
3899
|
-
anObject(C);
|
|
3887
|
+
anObject$2(C);
|
|
3900
3888
|
if (isObject(x) && x.constructor === C) return x;
|
|
3901
3889
|
var promiseCapability = newPromiseCapability.f(C);
|
|
3902
3890
|
var resolve = promiseCapability.resolve;
|
|
@@ -3927,7 +3915,8 @@ const FormItem = ({
|
|
|
3927
3915
|
inputId,
|
|
3928
3916
|
children,
|
|
3929
3917
|
expandableInfoButtonLabel,
|
|
3930
|
-
role
|
|
3918
|
+
role,
|
|
3919
|
+
rightAlignedFooterInfo
|
|
3931
3920
|
}) => {
|
|
3932
3921
|
const expandableInnerRef = useRef(null);
|
|
3933
3922
|
const expandableRef = useRef(null);
|
|
@@ -4012,140 +4001,27 @@ const FormItem = ({
|
|
|
4012
4001
|
}, {
|
|
4013
4002
|
children: [" ", expandableInfo, " "]
|
|
4014
4003
|
}))
|
|
4015
|
-
})), children,
|
|
4004
|
+
})), children, jsxs("div", Object.assign({
|
|
4016
4005
|
className: "gds-form-item__footer"
|
|
4017
4006
|
}, {
|
|
4018
|
-
children: validator && jsx("span", Object.assign({
|
|
4007
|
+
children: [validator && jsx("span", Object.assign({
|
|
4019
4008
|
className: "form-info"
|
|
4020
4009
|
}, {
|
|
4021
4010
|
children: validator.message
|
|
4022
|
-
}))
|
|
4011
|
+
})), rightAlignedFooterInfo && jsx("span", Object.assign({
|
|
4012
|
+
className: "form-info",
|
|
4013
|
+
style: {
|
|
4014
|
+
textAlign: 'right',
|
|
4015
|
+
width: validator ? 'auto' : '100%'
|
|
4016
|
+
}
|
|
4017
|
+
}, {
|
|
4018
|
+
children: rightAlignedFooterInfo
|
|
4019
|
+
}))]
|
|
4023
4020
|
}))]
|
|
4024
4021
|
}));
|
|
4025
4022
|
};
|
|
4026
4023
|
|
|
4027
|
-
const
|
|
4028
|
-
const id = useMemo(() => props.id || randomId(), [props.id]);
|
|
4029
|
-
const ref = useRef(null);
|
|
4030
|
-
const onChange = event => {
|
|
4031
|
-
onChanges && onChanges(event);
|
|
4032
|
-
onChangeInput && onChangeInput(event.target.value);
|
|
4033
|
-
};
|
|
4034
|
-
return Object.assign(Object.assign({}, props), {
|
|
4035
|
-
id,
|
|
4036
|
-
ref,
|
|
4037
|
-
onChange
|
|
4038
|
-
});
|
|
4039
|
-
};
|
|
4040
|
-
|
|
4041
|
-
const RenderInput = (type, props, onChange, onChangeInput, label, info, validator, expandableInfo, expandableInfoButtonLabel, testId) => {
|
|
4042
|
-
const _a = useInput(props, onChange, onChangeInput),
|
|
4043
|
-
{
|
|
4044
|
-
value
|
|
4045
|
-
} = _a,
|
|
4046
|
-
inputProps = __rest(_a, ["value"]);
|
|
4047
|
-
const propsWithDescription = info ? Object.assign(Object.assign({}, inputProps), {
|
|
4048
|
-
'aria-describedby': `${inputProps.id}_info`
|
|
4049
|
-
}) : inputProps;
|
|
4050
|
-
// Render naked
|
|
4051
|
-
if (!label && !info && !expandableInfo) return jsx("input", Object.assign({
|
|
4052
|
-
type: type,
|
|
4053
|
-
value: value,
|
|
4054
|
-
"data-testid": testId
|
|
4055
|
-
}, propsWithDescription));
|
|
4056
|
-
return jsx(FormItem, Object.assign({
|
|
4057
|
-
validator: validator,
|
|
4058
|
-
labelInformation: info,
|
|
4059
|
-
label: label,
|
|
4060
|
-
expandableInfo: expandableInfo,
|
|
4061
|
-
expandableInfoButtonLabel: expandableInfoButtonLabel,
|
|
4062
|
-
inputId: inputProps.id
|
|
4063
|
-
}, {
|
|
4064
|
-
children: jsx("div", Object.assign({
|
|
4065
|
-
className: "gds-input-wrapper"
|
|
4066
|
-
}, {
|
|
4067
|
-
children: jsx("input", Object.assign({
|
|
4068
|
-
type: type,
|
|
4069
|
-
value: value
|
|
4070
|
-
}, propsWithDescription, {
|
|
4071
|
-
className: validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator),
|
|
4072
|
-
"data-testid": testId
|
|
4073
|
-
}))
|
|
4074
|
-
}))
|
|
4075
|
-
}));
|
|
4076
|
-
};
|
|
4077
|
-
const TextInput = _a => {
|
|
4078
|
-
var {
|
|
4079
|
-
label,
|
|
4080
|
-
info,
|
|
4081
|
-
testId,
|
|
4082
|
-
onChange,
|
|
4083
|
-
onChangeInput,
|
|
4084
|
-
validator,
|
|
4085
|
-
expandableInfo,
|
|
4086
|
-
expandableInfoButtonLabel
|
|
4087
|
-
} = _a,
|
|
4088
|
-
props = __rest(_a, ["label", "info", "testId", "onChange", "onChangeInput", "validator", "expandableInfo", "expandableInfoButtonLabel"]);
|
|
4089
|
-
return RenderInput('text', props, onChange, onChangeInput, label, info, validator, expandableInfo, expandableInfoButtonLabel, testId);
|
|
4090
|
-
};
|
|
4091
|
-
const EmailInput = _a => {
|
|
4092
|
-
var {
|
|
4093
|
-
label,
|
|
4094
|
-
info,
|
|
4095
|
-
onChange,
|
|
4096
|
-
onChangeInput,
|
|
4097
|
-
validator,
|
|
4098
|
-
testId
|
|
4099
|
-
} = _a,
|
|
4100
|
-
props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator", "testId"]);
|
|
4101
|
-
return RenderInput('email', props, onChange, onChangeInput, label, info, validator, testId);
|
|
4102
|
-
};
|
|
4103
|
-
const NumberInput = _a => {
|
|
4104
|
-
var {
|
|
4105
|
-
label,
|
|
4106
|
-
info,
|
|
4107
|
-
onChange,
|
|
4108
|
-
onChangeInput,
|
|
4109
|
-
validator,
|
|
4110
|
-
expandableInfo,
|
|
4111
|
-
expandableInfoButtonLabel,
|
|
4112
|
-
testId
|
|
4113
|
-
} = _a,
|
|
4114
|
-
props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator", "expandableInfo", "expandableInfoButtonLabel", "testId"]);
|
|
4115
|
-
return RenderInput('number', props, onChange, onChangeInput, label, info, validator, expandableInfo, expandableInfoButtonLabel, testId);
|
|
4116
|
-
};
|
|
4117
|
-
const Checkbox = _a => {
|
|
4118
|
-
var {
|
|
4119
|
-
label,
|
|
4120
|
-
onChange,
|
|
4121
|
-
validator,
|
|
4122
|
-
testId
|
|
4123
|
-
} = _a,
|
|
4124
|
-
props = __rest(_a, ["label", "onChange", "validator", "testId"]);
|
|
4125
|
-
const inputProps = useInput(props, onChange);
|
|
4126
|
-
const labelClassNames = classNames('form-control', validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator));
|
|
4127
|
-
const inputClassNames = classNames(validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator));
|
|
4128
|
-
return jsxs("div", Object.assign({
|
|
4129
|
-
className: "form-group"
|
|
4130
|
-
}, {
|
|
4131
|
-
children: [jsxs("label", Object.assign({
|
|
4132
|
-
htmlFor: inputProps.id,
|
|
4133
|
-
className: labelClassNames
|
|
4134
|
-
}, {
|
|
4135
|
-
children: [label, jsx("input", Object.assign({
|
|
4136
|
-
type: "checkbox",
|
|
4137
|
-
"data-testid": testId
|
|
4138
|
-
}, inputProps, {
|
|
4139
|
-
className: inputClassNames
|
|
4140
|
-
})), jsx("i", {})]
|
|
4141
|
-
})), validator && jsx("span", Object.assign({
|
|
4142
|
-
className: "form-info"
|
|
4143
|
-
}, {
|
|
4144
|
-
children: validator.message
|
|
4145
|
-
}))]
|
|
4146
|
-
}));
|
|
4147
|
-
};
|
|
4148
|
-
const RadioButton = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
4024
|
+
const RadioButton = /*#__PURE__*/forwardRef((_a, ref) => {
|
|
4149
4025
|
var {
|
|
4150
4026
|
label,
|
|
4151
4027
|
validator,
|
|
@@ -4155,7 +4031,7 @@ const RadioButton = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
4155
4031
|
const {
|
|
4156
4032
|
id
|
|
4157
4033
|
} = useInput(props);
|
|
4158
|
-
const inputClassNames = classNames(validator);
|
|
4034
|
+
const inputClassNames = classNames(validator && validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator));
|
|
4159
4035
|
return jsxs("label", Object.assign({
|
|
4160
4036
|
htmlFor: id,
|
|
4161
4037
|
className: "form-control"
|
|
@@ -4173,6 +4049,105 @@ const RadioButton = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
4173
4049
|
}));
|
|
4174
4050
|
});
|
|
4175
4051
|
|
|
4052
|
+
const Input = _a => {
|
|
4053
|
+
var {
|
|
4054
|
+
'aria-describedby': ariaDescribedBy,
|
|
4055
|
+
autoComplete = 'off',
|
|
4056
|
+
children,
|
|
4057
|
+
className,
|
|
4058
|
+
testId: dataTestId,
|
|
4059
|
+
expandableInfo,
|
|
4060
|
+
expandableInfoButtonLabel,
|
|
4061
|
+
formatter,
|
|
4062
|
+
id = randomId(),
|
|
4063
|
+
label,
|
|
4064
|
+
info,
|
|
4065
|
+
onChange,
|
|
4066
|
+
unit,
|
|
4067
|
+
role,
|
|
4068
|
+
validator,
|
|
4069
|
+
onChangeInput,
|
|
4070
|
+
value = ''
|
|
4071
|
+
} = _a,
|
|
4072
|
+
props = __rest(_a, ['aria-describedby', "autoComplete", "children", "className", "testId", "expandableInfo", "expandableInfoButtonLabel", "formatter", "id", "label", "info", "onChange", "unit", "role", "validator", "onChangeInput", "value"]);
|
|
4073
|
+
const [uuid] = useState(id);
|
|
4074
|
+
const [localValue, setLocalValue] = useState(value);
|
|
4075
|
+
useEffect(() => {
|
|
4076
|
+
setLocalValue(value);
|
|
4077
|
+
}, [value]);
|
|
4078
|
+
const localOnChange = useCallback(event => {
|
|
4079
|
+
const oldValue = event.target.value;
|
|
4080
|
+
const newValue = formatter ? formatter(oldValue) : oldValue;
|
|
4081
|
+
setLocalValue(newValue);
|
|
4082
|
+
event.target.value = newValue;
|
|
4083
|
+
if (onChange) onChange(event);
|
|
4084
|
+
if (onChangeInput) onChangeInput(newValue);
|
|
4085
|
+
// Fixes bug: React loses caret position when you format the input value
|
|
4086
|
+
if (!formatter || newValue.length > oldValue.length) return;
|
|
4087
|
+
const pointer = event.target.selectionStart;
|
|
4088
|
+
const element = event.target;
|
|
4089
|
+
window.requestAnimationFrame(() => {
|
|
4090
|
+
element.selectionStart = pointer;
|
|
4091
|
+
element.selectionEnd = pointer;
|
|
4092
|
+
});
|
|
4093
|
+
}, [formatter, setLocalValue, onChange, onChangeInput]);
|
|
4094
|
+
const inputAriaDescribedBy = classNames(ariaDescribedBy, {
|
|
4095
|
+
[`gds-expandable-info-${uuid}`]: expandableInfo,
|
|
4096
|
+
[`${uuid}_info`]: info
|
|
4097
|
+
}) || undefined;
|
|
4098
|
+
const inputClassName = classNames(className, validator && validateClassName(validator.indicator)) || undefined;
|
|
4099
|
+
const input = jsx("input", Object.assign({
|
|
4100
|
+
"aria-describedby": inputAriaDescribedBy,
|
|
4101
|
+
autoComplete: autoComplete,
|
|
4102
|
+
className: inputClassName,
|
|
4103
|
+
"data-testid": dataTestId,
|
|
4104
|
+
id: uuid,
|
|
4105
|
+
onChange: localOnChange,
|
|
4106
|
+
role: role,
|
|
4107
|
+
value: localValue
|
|
4108
|
+
}, props));
|
|
4109
|
+
if (!label && !info && !expandableInfo) return input;
|
|
4110
|
+
return jsx(FormItem, Object.assign({
|
|
4111
|
+
expandableInfo: expandableInfo,
|
|
4112
|
+
expandableInfoButtonLabel: expandableInfoButtonLabel,
|
|
4113
|
+
inputId: uuid,
|
|
4114
|
+
label: label,
|
|
4115
|
+
labelInformation: info,
|
|
4116
|
+
role: role
|
|
4117
|
+
}, {
|
|
4118
|
+
children: jsx("div", Object.assign({
|
|
4119
|
+
className: "gds-input-wrapper"
|
|
4120
|
+
}, {
|
|
4121
|
+
children: jsxs(Group, Object.assign({
|
|
4122
|
+
groupBorder: true,
|
|
4123
|
+
groupFocus: true,
|
|
4124
|
+
error: validator && validator.message
|
|
4125
|
+
}, {
|
|
4126
|
+
children: [input, unit && jsx("span", Object.assign({
|
|
4127
|
+
className: `form-text${props.disabled ? ' disabled' : ''}`
|
|
4128
|
+
}, {
|
|
4129
|
+
children: unit
|
|
4130
|
+
})), children]
|
|
4131
|
+
}))
|
|
4132
|
+
}))
|
|
4133
|
+
}));
|
|
4134
|
+
};
|
|
4135
|
+
const TextInput = props => {
|
|
4136
|
+
return jsx(Input, Object.assign({
|
|
4137
|
+
type: "text"
|
|
4138
|
+
}, props));
|
|
4139
|
+
};
|
|
4140
|
+
const EmailInput = props => {
|
|
4141
|
+
return jsx(Input, Object.assign({
|
|
4142
|
+
type: "email"
|
|
4143
|
+
}, props));
|
|
4144
|
+
};
|
|
4145
|
+
const NumberInput = props => {
|
|
4146
|
+
return jsx(Input, Object.assign({
|
|
4147
|
+
type: "number"
|
|
4148
|
+
}, props));
|
|
4149
|
+
};
|
|
4150
|
+
|
|
4176
4151
|
const Text = ({
|
|
4177
4152
|
children
|
|
4178
4153
|
}) => jsx("span", Object.assign({
|
|
@@ -4185,9 +4160,9 @@ var $$1 = _export;
|
|
|
4185
4160
|
var DESCRIPTORS = descriptors;
|
|
4186
4161
|
var global$2 = global$k;
|
|
4187
4162
|
var uncurryThis$2 = functionUncurryThis;
|
|
4188
|
-
var hasOwn = hasOwnProperty_1;
|
|
4163
|
+
var hasOwn$1 = hasOwnProperty_1;
|
|
4189
4164
|
var isCallable = isCallable$l;
|
|
4190
|
-
var isPrototypeOf = objectIsPrototypeOf;
|
|
4165
|
+
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
4191
4166
|
var toString$2 = toString$4;
|
|
4192
4167
|
var defineBuiltInAccessor = defineBuiltInAccessor$2;
|
|
4193
4168
|
var copyConstructorProperties = copyConstructorProperties$2;
|
|
@@ -4203,7 +4178,7 @@ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototy
|
|
|
4203
4178
|
// wrap Symbol constructor for correct work with undefined description
|
|
4204
4179
|
var SymbolWrapper = function Symbol() {
|
|
4205
4180
|
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$2(arguments[0]);
|
|
4206
|
-
var result = isPrototypeOf(SymbolPrototype, this)
|
|
4181
|
+
var result = isPrototypeOf$1(SymbolPrototype, this)
|
|
4207
4182
|
? new NativeSymbol(description)
|
|
4208
4183
|
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
|
|
4209
4184
|
: description === undefined ? NativeSymbol() : NativeSymbol(description);
|
|
@@ -4226,7 +4201,7 @@ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototy
|
|
|
4226
4201
|
configurable: true,
|
|
4227
4202
|
get: function description() {
|
|
4228
4203
|
var symbol = thisSymbolValue(this);
|
|
4229
|
-
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
|
|
4204
|
+
if (hasOwn$1(EmptyStringDescriptionStore, symbol)) return '';
|
|
4230
4205
|
var string = symbolDescriptiveString(symbol);
|
|
4231
4206
|
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace$1(string, regexp, '$1');
|
|
4232
4207
|
return desc === '' ? undefined : desc;
|
|
@@ -4250,7 +4225,7 @@ const RadioGroup = ({
|
|
|
4250
4225
|
validator,
|
|
4251
4226
|
onChangeRadio,
|
|
4252
4227
|
onChange,
|
|
4253
|
-
name,
|
|
4228
|
+
name: propName = randomId(),
|
|
4254
4229
|
horizontal,
|
|
4255
4230
|
children
|
|
4256
4231
|
}) => {
|
|
@@ -4258,11 +4233,11 @@ const RadioGroup = ({
|
|
|
4258
4233
|
if (description) console.warn('"description" prop is deprecated. Please use "labelInformation" instead.');
|
|
4259
4234
|
const [selected, setSelected] = useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected);
|
|
4260
4235
|
const [prevValueSelected, setPrevValueSelected] = useState(valueSelected);
|
|
4236
|
+
const [name] = useState(propName);
|
|
4261
4237
|
if (valueSelected !== prevValueSelected) {
|
|
4262
4238
|
setSelected(valueSelected);
|
|
4263
4239
|
setPrevValueSelected(valueSelected);
|
|
4264
4240
|
}
|
|
4265
|
-
validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator);
|
|
4266
4241
|
const handleOnChange = event => {
|
|
4267
4242
|
if (event.target.value !== selected) {
|
|
4268
4243
|
setSelected(event.target.value);
|
|
@@ -4296,7 +4271,6 @@ const RadioGroup = ({
|
|
|
4296
4271
|
expandableInfoButtonLabel,
|
|
4297
4272
|
role: 'radiogroup'
|
|
4298
4273
|
};
|
|
4299
|
-
if (!name) name = randomId();
|
|
4300
4274
|
const radioGroupWrapperClassNames = classNames('gds-radio-group-wrapper', {
|
|
4301
4275
|
'gds-radio-group-wrapper--horizontal': horizontal
|
|
4302
4276
|
});
|
|
@@ -4306,7 +4280,7 @@ const RadioGroup = ({
|
|
|
4306
4280
|
}, {
|
|
4307
4281
|
children: React.Children.map(children, radioButton => {
|
|
4308
4282
|
return /*#__PURE__*/React.isValidElement(radioButton) ? /*#__PURE__*/React.cloneElement(radioButton, {
|
|
4309
|
-
validator: validator
|
|
4283
|
+
validator: validator,
|
|
4310
4284
|
onChange: handleOnChange,
|
|
4311
4285
|
checked: selected === radioButton.props.value,
|
|
4312
4286
|
name,
|
|
@@ -4317,9 +4291,11 @@ const RadioGroup = ({
|
|
|
4317
4291
|
}));
|
|
4318
4292
|
};
|
|
4319
4293
|
|
|
4320
|
-
const TextArea =
|
|
4294
|
+
const TextArea = _a => {
|
|
4321
4295
|
var {
|
|
4296
|
+
'aria-describedby': ariaDescribedBy,
|
|
4322
4297
|
autoComplete = 'off',
|
|
4298
|
+
className,
|
|
4323
4299
|
expandableInfo,
|
|
4324
4300
|
expandableInfoButtonLabel,
|
|
4325
4301
|
id = randomId(),
|
|
@@ -4330,9 +4306,10 @@ const TextArea = /*#__PURE__*/memo(_a => {
|
|
|
4330
4306
|
rows = 4,
|
|
4331
4307
|
validator,
|
|
4332
4308
|
value,
|
|
4333
|
-
|
|
4309
|
+
testId: dataTestId,
|
|
4310
|
+
maxLength
|
|
4334
4311
|
} = _a,
|
|
4335
|
-
props = __rest(_a, ["autoComplete", "expandableInfo", "expandableInfoButtonLabel", "id", "label", "info", "onChange", "role", "rows", "validator", "value",
|
|
4312
|
+
props = __rest(_a, ['aria-describedby', "autoComplete", "className", "expandableInfo", "expandableInfoButtonLabel", "id", "label", "info", "onChange", "role", "rows", "validator", "value", "testId", "maxLength"]);
|
|
4336
4313
|
const [uuid] = useState(id);
|
|
4337
4314
|
const [localValue, setLocalValue] = useState(value);
|
|
4338
4315
|
useEffect(() => {
|
|
@@ -4342,9 +4319,12 @@ const TextArea = /*#__PURE__*/memo(_a => {
|
|
|
4342
4319
|
setLocalValue(event.target.value);
|
|
4343
4320
|
if (onChange) onChange(event);
|
|
4344
4321
|
}, [setLocalValue, onChange]);
|
|
4345
|
-
const
|
|
4346
|
-
|
|
4347
|
-
|
|
4322
|
+
const inputAriaDescribedBy = classNames(ariaDescribedBy, {
|
|
4323
|
+
[`gds-expandable-info-${uuid}`]: expandableInfo,
|
|
4324
|
+
[`${uuid}_info`]: info
|
|
4325
|
+
}) || undefined;
|
|
4326
|
+
const inputClassName = classNames(className, validator && validateClassName(validator.indicator)) || undefined;
|
|
4327
|
+
const rightAlignedFooterInfo = maxLength ? `${(localValue === null || localValue === void 0 ? void 0 : localValue.length) || 0}/${maxLength}` : undefined;
|
|
4348
4328
|
return jsx(FormItem, Object.assign({
|
|
4349
4329
|
expandableInfo: expandableInfo,
|
|
4350
4330
|
expandableInfoButtonLabel: expandableInfoButtonLabel,
|
|
@@ -4352,25 +4332,27 @@ const TextArea = /*#__PURE__*/memo(_a => {
|
|
|
4352
4332
|
label: label,
|
|
4353
4333
|
labelInformation: info,
|
|
4354
4334
|
role: role,
|
|
4355
|
-
validator: validator
|
|
4335
|
+
validator: validator,
|
|
4336
|
+
rightAlignedFooterInfo: rightAlignedFooterInfo
|
|
4356
4337
|
}, {
|
|
4357
4338
|
children: jsx("div", Object.assign({
|
|
4358
4339
|
className: "gds-input-wrapper"
|
|
4359
4340
|
}, {
|
|
4360
4341
|
children: jsx("textarea", Object.assign({
|
|
4361
|
-
"aria-describedby":
|
|
4342
|
+
"aria-describedby": inputAriaDescribedBy,
|
|
4362
4343
|
autoComplete: autoComplete,
|
|
4363
|
-
className:
|
|
4344
|
+
className: inputClassName,
|
|
4364
4345
|
id: uuid,
|
|
4365
4346
|
onChange: localOnChange,
|
|
4366
4347
|
role: role,
|
|
4367
4348
|
rows: rows,
|
|
4368
4349
|
value: localValue,
|
|
4369
|
-
"data-testid": dataTestId
|
|
4350
|
+
"data-testid": dataTestId,
|
|
4351
|
+
maxLength: maxLength
|
|
4370
4352
|
}, props))
|
|
4371
4353
|
}))
|
|
4372
4354
|
}));
|
|
4373
|
-
}
|
|
4355
|
+
};
|
|
4374
4356
|
|
|
4375
4357
|
const Flexbox = _a => {
|
|
4376
4358
|
var {
|
|
@@ -4410,10 +4392,26 @@ const Flexbox = _a => {
|
|
|
4410
4392
|
}));
|
|
4411
4393
|
};
|
|
4412
4394
|
|
|
4413
|
-
const InPageWizardStepCard =
|
|
4395
|
+
const InPageWizardStepCard = ({
|
|
4396
|
+
editBtnText: _editBtnText = 'Edit',
|
|
4397
|
+
onNextClick,
|
|
4398
|
+
stepStatus,
|
|
4399
|
+
stepText,
|
|
4400
|
+
title,
|
|
4401
|
+
children,
|
|
4402
|
+
dataTestid,
|
|
4403
|
+
hideFooter: _hideFooter = false,
|
|
4404
|
+
nextBtnIcon,
|
|
4405
|
+
nextBtnText: _nextBtnText = 'Next',
|
|
4406
|
+
onEditClick
|
|
4407
|
+
}) => {
|
|
4408
|
+
const sectionClassName = classNames('gds-in-page-wizard-step-card', 'card', {
|
|
4409
|
+
active: stepStatus === 'IsActive',
|
|
4410
|
+
completed: stepStatus === 'IsComplete'
|
|
4411
|
+
});
|
|
4414
4412
|
return jsxs("section", Object.assign({
|
|
4415
|
-
className:
|
|
4416
|
-
"data-testid":
|
|
4413
|
+
className: sectionClassName,
|
|
4414
|
+
"data-testid": dataTestid
|
|
4417
4415
|
}, {
|
|
4418
4416
|
children: [jsxs("header", Object.assign({
|
|
4419
4417
|
className: "gds-in-page-wizard-step-card__header"
|
|
@@ -4425,54 +4423,54 @@ const InPageWizardStepCard = props => {
|
|
|
4425
4423
|
})), jsx("div", Object.assign({
|
|
4426
4424
|
className: "gds-in-page-wizard-step-card__header__progress"
|
|
4427
4425
|
}, {
|
|
4428
|
-
children:
|
|
4426
|
+
children: stepText
|
|
4429
4427
|
})), jsx("div", Object.assign({
|
|
4430
4428
|
className: "gds-in-page-wizard-step-card__header__title"
|
|
4431
4429
|
}, {
|
|
4432
4430
|
children: jsx("h2", Object.assign({
|
|
4433
4431
|
className: "h4"
|
|
4434
4432
|
}, {
|
|
4435
|
-
children:
|
|
4433
|
+
children: title
|
|
4436
4434
|
}))
|
|
4437
|
-
})),
|
|
4435
|
+
})), stepStatus === 'IsComplete' && jsx("div", Object.assign({
|
|
4438
4436
|
className: "gds-in-page-wizard-step-card__header__edit"
|
|
4439
4437
|
}, {
|
|
4440
4438
|
children: jsxs("button", Object.assign({
|
|
4441
4439
|
className: "secondary small",
|
|
4442
|
-
onClick:
|
|
4440
|
+
onClick: onEditClick
|
|
4443
4441
|
}, {
|
|
4444
4442
|
children: [jsx(Edit, {
|
|
4445
4443
|
fill: 'var(--color)',
|
|
4446
4444
|
height: 16,
|
|
4447
4445
|
width: 16
|
|
4448
|
-
}),
|
|
4446
|
+
}), _editBtnText]
|
|
4449
4447
|
}))
|
|
4450
4448
|
}))]
|
|
4451
|
-
})), (
|
|
4449
|
+
})), (stepStatus === 'IsActive' || stepStatus === 'IsComplete') && jsx("div", Object.assign({
|
|
4452
4450
|
className: "gds-in-page-wizard-step-card__content"
|
|
4453
4451
|
}, {
|
|
4454
|
-
children:
|
|
4455
|
-
})),
|
|
4452
|
+
children: children
|
|
4453
|
+
})), stepStatus === 'IsActive' && !_hideFooter && jsx("footer", Object.assign({
|
|
4456
4454
|
className: "gds-in-page-wizard-step-card__footer"
|
|
4457
4455
|
}, {
|
|
4458
4456
|
children: jsxs("button", Object.assign({
|
|
4459
4457
|
className: "primary",
|
|
4460
|
-
onClick:
|
|
4458
|
+
onClick: onNextClick
|
|
4461
4459
|
}, {
|
|
4462
|
-
children: [
|
|
4460
|
+
children: [_nextBtnText, nextBtnIcon]
|
|
4463
4461
|
}))
|
|
4464
|
-
})),
|
|
4465
|
-
className: "gds-in-page-wizard-step-
|
|
4462
|
+
})), stepStatus === 'IsComplete' && !_hideFooter && jsx("footer", Object.assign({
|
|
4463
|
+
className: "gds-in-page-wizard-step-card__footer gds-in-page-wizard-step-card__footer--edit"
|
|
4466
4464
|
}, {
|
|
4467
4465
|
children: jsxs("button", Object.assign({
|
|
4468
4466
|
className: "secondary",
|
|
4469
|
-
onClick:
|
|
4467
|
+
onClick: onEditClick
|
|
4470
4468
|
}, {
|
|
4471
4469
|
children: [jsx(Edit, {
|
|
4472
4470
|
fill: 'var(--color)',
|
|
4473
4471
|
height: 16,
|
|
4474
4472
|
width: 16
|
|
4475
|
-
}),
|
|
4473
|
+
}), _editBtnText]
|
|
4476
4474
|
}))
|
|
4477
4475
|
}))]
|
|
4478
4476
|
}));
|
|
@@ -4481,20 +4479,16 @@ const InPageWizardStepCard = props => {
|
|
|
4481
4479
|
const Link = _a => {
|
|
4482
4480
|
var {
|
|
4483
4481
|
button,
|
|
4484
|
-
children
|
|
4482
|
+
children,
|
|
4483
|
+
className,
|
|
4484
|
+
role
|
|
4485
4485
|
} = _a,
|
|
4486
|
-
|
|
4487
|
-
const
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
className: className
|
|
4493
|
-
}, props);
|
|
4494
|
-
setAnchorProps(newProps);
|
|
4495
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4496
|
-
}, [button]);
|
|
4497
|
-
return jsx("a", Object.assign({}, anchorProps, {
|
|
4486
|
+
otherProps = __rest(_a, ["button", "children", "className", "role"]);
|
|
4487
|
+
const buttonClassName = classNames(className, 'button', typeof button === 'string' && button) || undefined;
|
|
4488
|
+
return jsx("a", Object.assign({
|
|
4489
|
+
className: buttonClassName,
|
|
4490
|
+
role: button ? 'button' : role
|
|
4491
|
+
}, otherProps, {
|
|
4498
4492
|
children: children
|
|
4499
4493
|
}));
|
|
4500
4494
|
};
|
|
@@ -4731,6 +4725,63 @@ const OptionGroup = ({
|
|
|
4731
4725
|
}));
|
|
4732
4726
|
};
|
|
4733
4727
|
|
|
4728
|
+
var anObject$1 = anObject$c;
|
|
4729
|
+
|
|
4730
|
+
// `RegExp.prototype.flags` getter implementation
|
|
4731
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
4732
|
+
var regexpFlags = function () {
|
|
4733
|
+
var that = anObject$1(this);
|
|
4734
|
+
var result = '';
|
|
4735
|
+
if (that.hasIndices) result += 'd';
|
|
4736
|
+
if (that.global) result += 'g';
|
|
4737
|
+
if (that.ignoreCase) result += 'i';
|
|
4738
|
+
if (that.multiline) result += 'm';
|
|
4739
|
+
if (that.dotAll) result += 's';
|
|
4740
|
+
if (that.unicode) result += 'u';
|
|
4741
|
+
if (that.unicodeSets) result += 'v';
|
|
4742
|
+
if (that.sticky) result += 'y';
|
|
4743
|
+
return result;
|
|
4744
|
+
};
|
|
4745
|
+
|
|
4746
|
+
var call = functionCall;
|
|
4747
|
+
var hasOwn = hasOwnProperty_1;
|
|
4748
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
4749
|
+
var regExpFlags = regexpFlags;
|
|
4750
|
+
|
|
4751
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
4752
|
+
|
|
4753
|
+
var regexpGetFlags = function (R) {
|
|
4754
|
+
var flags = R.flags;
|
|
4755
|
+
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
|
|
4756
|
+
? call(regExpFlags, R) : flags;
|
|
4757
|
+
};
|
|
4758
|
+
|
|
4759
|
+
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
4760
|
+
var defineBuiltIn = defineBuiltIn$6;
|
|
4761
|
+
var anObject = anObject$c;
|
|
4762
|
+
var $toString = toString$4;
|
|
4763
|
+
var fails$1 = fails$g;
|
|
4764
|
+
var getRegExpFlags = regexpGetFlags;
|
|
4765
|
+
|
|
4766
|
+
var TO_STRING = 'toString';
|
|
4767
|
+
var RegExpPrototype = RegExp.prototype;
|
|
4768
|
+
var nativeToString = RegExpPrototype[TO_STRING];
|
|
4769
|
+
|
|
4770
|
+
var NOT_GENERIC = fails$1(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
|
|
4771
|
+
// FF44- RegExp#toString has a wrong name
|
|
4772
|
+
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
|
|
4773
|
+
|
|
4774
|
+
// `RegExp.prototype.toString` method
|
|
4775
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
4776
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
4777
|
+
defineBuiltIn(RegExp.prototype, TO_STRING, function toString() {
|
|
4778
|
+
var R = anObject(this);
|
|
4779
|
+
var pattern = $toString(R.source);
|
|
4780
|
+
var flags = $toString(getRegExpFlags(R));
|
|
4781
|
+
return '/' + pattern + '/' + flags;
|
|
4782
|
+
}, { unsafe: true });
|
|
4783
|
+
}
|
|
4784
|
+
|
|
4734
4785
|
const InputWrapper = ({
|
|
4735
4786
|
children,
|
|
4736
4787
|
unitLabel
|
|
@@ -5203,17 +5254,18 @@ const Modal = _a => {
|
|
|
5203
5254
|
const dialogProps = {
|
|
5204
5255
|
id: uuid,
|
|
5205
5256
|
role: 'dialog',
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5257
|
+
'aria-modal': true,
|
|
5258
|
+
'aria-labelledby': headerId,
|
|
5259
|
+
'aria-describedby': bodyId
|
|
5209
5260
|
};
|
|
5261
|
+
let modalContent;
|
|
5210
5262
|
switch (type) {
|
|
5211
5263
|
case 'slideout':
|
|
5212
5264
|
{
|
|
5213
5265
|
let className = undefined;
|
|
5214
|
-
if (size ===
|
|
5215
|
-
if (size ===
|
|
5216
|
-
|
|
5266
|
+
if (size === 'lg') className = 'gds-slide-out--960';
|
|
5267
|
+
if (size === 'md') className = 'gds-slide-out--768';
|
|
5268
|
+
modalContent = jsxs("aside", Object.assign({
|
|
5217
5269
|
className: className
|
|
5218
5270
|
}, dialogProps, {
|
|
5219
5271
|
children: [jsx(ModalHeader, Object.assign({
|
|
@@ -5222,28 +5274,42 @@ const Modal = _a => {
|
|
|
5222
5274
|
id: bodyId
|
|
5223
5275
|
}, props)), jsx(ModalFooter, Object.assign({}, props))]
|
|
5224
5276
|
}));
|
|
5277
|
+
break;
|
|
5225
5278
|
}
|
|
5226
5279
|
case 'takeover':
|
|
5227
5280
|
{
|
|
5228
|
-
|
|
5281
|
+
modalContent = jsxs("main", Object.assign({}, dialogProps, {
|
|
5229
5282
|
children: [jsx(ModalHeader, Object.assign({
|
|
5230
5283
|
id: headerId
|
|
5231
5284
|
}, props)), jsx(ModalBody, Object.assign({
|
|
5232
5285
|
id: bodyId
|
|
5233
5286
|
}, props)), jsx(ModalFooter, Object.assign({}, props))]
|
|
5234
5287
|
}));
|
|
5288
|
+
break;
|
|
5235
5289
|
}
|
|
5236
5290
|
default:
|
|
5237
5291
|
{
|
|
5238
|
-
|
|
5292
|
+
modalContent = jsxs("section", Object.assign({}, dialogProps, {
|
|
5239
5293
|
children: [jsx(ModalHeader, Object.assign({
|
|
5240
5294
|
id: headerId
|
|
5241
5295
|
}, props)), jsx(ModalBody, Object.assign({
|
|
5242
5296
|
id: bodyId
|
|
5243
5297
|
}, props)), jsx(ModalFooter, Object.assign({}, props))]
|
|
5244
5298
|
}));
|
|
5299
|
+
break;
|
|
5245
5300
|
}
|
|
5246
5301
|
}
|
|
5302
|
+
const handleBackdropClick = () => {
|
|
5303
|
+
if (props.onClose) props.onClose(null);
|
|
5304
|
+
};
|
|
5305
|
+
return jsxs(Fragment, {
|
|
5306
|
+
children: [modalContent, jsx("div", {
|
|
5307
|
+
"data-testid": "modal-backdrop",
|
|
5308
|
+
className: "backdrop",
|
|
5309
|
+
onClick: handleBackdropClick,
|
|
5310
|
+
"aria-hidden": "true"
|
|
5311
|
+
})]
|
|
5312
|
+
});
|
|
5247
5313
|
};
|
|
5248
5314
|
|
|
5249
|
-
export { Accordion, AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, CoreDropdown, CoreOption, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItem, FormItems, Group, InPageWizardStepCard, Link, List$1 as List, Modal, Navbar, NumberInput, Option, OptionGroup, RadioButton, RadioGroup,
|
|
5315
|
+
export { Accordion, AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, CoreDropdown, CoreOption, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItem, FormItems, Group, InPageWizardStepCard, Input, Link, List$1 as List, Modal, Navbar, NumberInput, Option, OptionGroup, RadioButton, RadioGroup, Select, Slider, Stepper, Tab, Tabs, Text, TextArea, TextInput, valueList$1 as ValueList };
|