@ebertjendustries/cstestwrapper 1.0.2 → 1.0.3

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/index.js CHANGED
@@ -80,7 +80,7 @@ var require_js_tokens = __commonJS({
80
80
  KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
81
81
  KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
82
82
  Newline = RegExp(LineTerminatorSequence.source);
83
- module2.exports = jsTokens2 = function* (input, { jsx: jsx32 = false } = {}) {
83
+ module2.exports = jsTokens2 = function* (input, { jsx: jsx2 = false } = {}) {
84
84
  var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
85
85
  ({ length } = input);
86
86
  lastIndex = 0;
@@ -200,7 +200,7 @@ var require_js_tokens = __commonJS({
200
200
  nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
201
201
  break;
202
202
  case "<":
203
- if (jsx32 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
203
+ if (jsx2 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
204
204
  stack.push({ tag: "JSXTag" });
205
205
  lastIndex += 1;
206
206
  lastSignificantToken = "<";
@@ -1952,8 +1952,8 @@ module.exports = __toCommonJS(index_exports);
1952
1952
 
1953
1953
  // src/components/AbstractComponentTesting.ts
1954
1954
  var import_dom = __toESM(require("@cloudscape-design/components/test-utils/dom"));
1955
- var import_react7 = require("@testing-library/react");
1956
- var import_react8 = require("react");
1955
+ var import_react = require("@testing-library/react");
1956
+ var import_react2 = require("react");
1957
1957
 
1958
1958
  // node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js
1959
1959
  var f = {
@@ -2774,7 +2774,7 @@ function requireReactIs_development() {
2774
2774
  var ContextProvider = REACT_PROVIDER_TYPE;
2775
2775
  var Element2 = REACT_ELEMENT_TYPE;
2776
2776
  var ForwardRef = REACT_FORWARD_REF_TYPE;
2777
- var Fragment2 = REACT_FRAGMENT_TYPE;
2777
+ var Fragment = REACT_FRAGMENT_TYPE;
2778
2778
  var Lazy = REACT_LAZY_TYPE;
2779
2779
  var Memo = REACT_MEMO_TYPE;
2780
2780
  var Portal = REACT_PORTAL_TYPE;
@@ -2842,7 +2842,7 @@ function requireReactIs_development() {
2842
2842
  reactIs_development.ContextProvider = ContextProvider;
2843
2843
  reactIs_development.Element = Element2;
2844
2844
  reactIs_development.ForwardRef = ForwardRef;
2845
- reactIs_development.Fragment = Fragment2;
2845
+ reactIs_development.Fragment = Fragment;
2846
2846
  reactIs_development.Lazy = Lazy;
2847
2847
  reactIs_development.Memo = Memo;
2848
2848
  reactIs_development.Portal = Portal;
@@ -4162,7 +4162,7 @@ function requireJsTokens() {
4162
4162
  KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
4163
4163
  KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
4164
4164
  Newline = RegExp(LineTerminatorSequence.source);
4165
- jsTokens_1 = function* (input, { jsx: jsx32 = false } = {}) {
4165
+ jsTokens_1 = function* (input, { jsx: jsx2 = false } = {}) {
4166
4166
  var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
4167
4167
  ({ length } = input);
4168
4168
  lastIndex = 0;
@@ -4275,7 +4275,7 @@ function requireJsTokens() {
4275
4275
  nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
4276
4276
  break;
4277
4277
  case "<":
4278
- if (jsx32 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
4278
+ if (jsx2 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
4279
4279
  stack.push({ tag: "JSXTag" });
4280
4280
  lastIndex += 1;
4281
4281
  lastSignificantToken = "<";
@@ -13514,7 +13514,7 @@ function getTestName(task, separator = " > ") {
13514
13514
  }
13515
13515
  var now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
13516
13516
  var unixNow = Date.now;
13517
- var { clearTimeout, setTimeout: setTimeout2 } = getSafeTimers();
13517
+ var { clearTimeout, setTimeout } = getSafeTimers();
13518
13518
  var packs = /* @__PURE__ */ new Map();
13519
13519
  var eventsPacks = [];
13520
13520
  var pendingTasksUpdates = [];
@@ -13553,7 +13553,7 @@ function throttle(fn2, ms) {
13553
13553
  pendingCall = void 0;
13554
13554
  return fn2.apply(this, args);
13555
13555
  }
13556
- pendingCall != null ? pendingCall : pendingCall = setTimeout2(() => call2.bind(this)(...args), ms);
13556
+ pendingCall != null ? pendingCall : pendingCall = setTimeout(() => call2.bind(this)(...args), ms);
13557
13557
  };
13558
13558
  }
13559
13559
  var sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100);
@@ -13576,7 +13576,7 @@ function withTimeout(fn2, timeout, isHook = false, stackTraceError, onTimeout) {
13576
13576
  if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) {
13577
13577
  return fn2;
13578
13578
  }
13579
- const { setTimeout: setTimeout3, clearTimeout: clearTimeout2 } = getSafeTimers();
13579
+ const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
13580
13580
  return function runWithTimeout(...args) {
13581
13581
  const startTime = now();
13582
13582
  const runner2 = getRunner();
@@ -13584,7 +13584,7 @@ function withTimeout(fn2, timeout, isHook = false, stackTraceError, onTimeout) {
13584
13584
  runner2._currentTaskTimeout = timeout;
13585
13585
  return new Promise((resolve_, reject_) => {
13586
13586
  var _timer$unref;
13587
- const timer = setTimeout3(() => {
13587
+ const timer = setTimeout2(() => {
13588
13588
  clearTimeout2(timer);
13589
13589
  rejectTimeoutError();
13590
13590
  }, timeout);
@@ -13843,8 +13843,8 @@ function resetModules(modules, resetMocks = false) {
13843
13843
  });
13844
13844
  }
13845
13845
  function waitNextTick() {
13846
- const { setTimeout: setTimeout3 } = getSafeTimers();
13847
- return new Promise((resolve4) => setTimeout3(resolve4, 0));
13846
+ const { setTimeout: setTimeout2 } = getSafeTimers();
13847
+ return new Promise((resolve4) => setTimeout2(resolve4, 0));
13848
13848
  }
13849
13849
  async function waitForImportsToResolve() {
13850
13850
  await waitNextTick();
@@ -14594,7 +14594,7 @@ function requireJsTokens2() {
14594
14594
  KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
14595
14595
  KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
14596
14596
  Newline = RegExp(LineTerminatorSequence.source);
14597
- jsTokens_12 = function* (input, { jsx: jsx32 = false } = {}) {
14597
+ jsTokens_12 = function* (input, { jsx: jsx2 = false } = {}) {
14598
14598
  var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
14599
14599
  ({ length } = input);
14600
14600
  lastIndex = 0;
@@ -14707,7 +14707,7 @@ function requireJsTokens2() {
14707
14707
  nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
14708
14708
  break;
14709
14709
  case "<":
14710
- if (jsx32 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
14710
+ if (jsx2 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
14711
14711
  stack.push({ tag: "JSXTag" });
14712
14712
  lastIndex += 1;
14713
14713
  lastSignificantToken = "<";
@@ -15986,7 +15986,7 @@ function createExpectPoll(expect2) {
15986
15986
  let intervalId;
15987
15987
  let timeoutId;
15988
15988
  let lastError;
15989
- const { setTimeout: setTimeout3, clearTimeout: clearTimeout2 } = getSafeTimers();
15989
+ const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
15990
15990
  const check = async () => {
15991
15991
  try {
15992
15992
  utils_exports.flag(assertion, "_name", key);
@@ -15997,10 +15997,10 @@ function createExpectPoll(expect2) {
15997
15997
  clearTimeout2(timeoutId);
15998
15998
  } catch (err) {
15999
15999
  lastError = err;
16000
- if (!utils_exports.flag(assertion, "_isLastPollAttempt")) intervalId = setTimeout3(check, interval);
16000
+ if (!utils_exports.flag(assertion, "_isLastPollAttempt")) intervalId = setTimeout2(check, interval);
16001
16001
  }
16002
16002
  };
16003
- timeoutId = setTimeout3(() => {
16003
+ timeoutId = setTimeout2(() => {
16004
16004
  clearTimeout2(intervalId);
16005
16005
  utils_exports.flag(assertion, "_isLastPollAttempt", true);
16006
16006
  const rejectWithCause = (cause) => {
@@ -17518,7 +17518,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
17518
17518
  clock.cancelIdleCallback = function cancelIdleCallback(timerId) {
17519
17519
  return clearTimer(clock, timerId, "IdleCallback");
17520
17520
  };
17521
- clock.setTimeout = function setTimeout3(func, timeout) {
17521
+ clock.setTimeout = function setTimeout2(func, timeout) {
17522
17522
  return addTimer(clock, {
17523
17523
  func,
17524
17524
  args: Array.prototype.slice.call(arguments, 2),
@@ -18339,7 +18339,7 @@ function copyStackTrace(target, source) {
18339
18339
  return target;
18340
18340
  }
18341
18341
  function waitFor(callback, options = {}) {
18342
- const { setTimeout: setTimeout3, setInterval, clearTimeout: clearTimeout2, clearInterval } = getSafeTimers();
18342
+ const { setTimeout: setTimeout2, setInterval, clearTimeout: clearTimeout2, clearInterval } = getSafeTimers();
18343
18343
  const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
18344
18344
  const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
18345
18345
  return new Promise((resolve4, reject) => {
@@ -18382,12 +18382,12 @@ function waitFor(callback, options = {}) {
18382
18382
  }
18383
18383
  };
18384
18384
  if (checkCallback() === true) return;
18385
- timeoutId = setTimeout3(handleTimeout, timeout);
18385
+ timeoutId = setTimeout2(handleTimeout, timeout);
18386
18386
  intervalId = setInterval(checkCallback, interval);
18387
18387
  });
18388
18388
  }
18389
18389
  function waitUntil(callback, options = {}) {
18390
- const { setTimeout: setTimeout3, setInterval, clearTimeout: clearTimeout2, clearInterval } = getSafeTimers();
18390
+ const { setTimeout: setTimeout2, setInterval, clearTimeout: clearTimeout2, clearInterval } = getSafeTimers();
18391
18391
  const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
18392
18392
  const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
18393
18393
  return new Promise((resolve4, reject) => {
@@ -18427,7 +18427,7 @@ function waitUntil(callback, options = {}) {
18427
18427
  }
18428
18428
  };
18429
18429
  if (checkCallback() === true) return;
18430
- timeoutId = setTimeout3(onReject, timeout);
18430
+ timeoutId = setTimeout2(onReject, timeout);
18431
18431
  intervalId = setInterval(checkCallback, interval);
18432
18432
  });
18433
18433
  }
@@ -18647,1957 +18647,8 @@ function getImporter(name) {
18647
18647
  // node_modules/vitest/dist/index.js
18648
18648
  var import_expect_type = __toESM(require_dist(), 1);
18649
18649
 
18650
- // node_modules/@ebertjendustries/cswrapper/dist/index.mjs
18651
- var dist_exports2 = {};
18652
- __export(dist_exports2, {
18653
- CSAlert: () => CSAlert,
18654
- CSBox: () => CSBox,
18655
- CSButton: () => CSButton,
18656
- CSCheckbox: () => CSCheckbox,
18657
- CSCopyToClipboard: () => CSCopyToClipboard,
18658
- CSDatePicker: () => CSDatePicker,
18659
- CSEnumMultiselect: () => CSEnumMultiselect,
18660
- CSEnumSegmentedControl: () => CSEnumSegmentedControl,
18661
- CSEnumSelect: () => CSEnumSelect,
18662
- CSEnumTiles: () => CSEnumTiles,
18663
- CSExternalLink: () => CSExternalLink,
18664
- CSFormField: () => CSFormField,
18665
- CSHeader: () => CSHeader,
18666
- CSInput: () => CSInput,
18667
- CSLink: () => CSLink,
18668
- CSMultiselect: () => CSMultiselect,
18669
- CSNumericInput: () => CSNumericInput,
18670
- CSSegmentedControl: () => CSSegmentedControl,
18671
- CSSelect: () => CSSelect,
18672
- CSStatusIndicator: () => CSStatusIndicator,
18673
- CSTextContent: () => CSTextContent,
18674
- CSTextarea: () => CSTextarea,
18675
- CSTimeInput: () => CSTimeInput,
18676
- CSToggle: () => CSToggle,
18677
- CSVEnumRatingView: () => CSVEnumRatingView,
18678
- CSVNoItemsView: () => CSVNoItemsView,
18679
- CSVPriceInputView: () => CSVPriceInputView,
18680
- CSVSearchFilterView: () => CSVSearchFilterView,
18681
- CSVTextPromptModalView: () => CSVTextPromptModalView,
18682
- CSV_ENUM_RATING_VIEW_SPEC: () => CSV_ENUM_RATING_VIEW_SPEC,
18683
- CSV_NO_ITEMS_VIEW_SPEC: () => CSV_NO_ITEMS_VIEW_SPEC,
18684
- CSV_PRICE_INPUT_VIEW_SPEC: () => CSV_PRICE_INPUT_VIEW_SPEC,
18685
- CSV_SEARCH_FILTER_VIEW_SPEC: () => CSV_SEARCH_FILTER_VIEW_SPEC,
18686
- CSV_TEXT_PROMPT_MODAL_VIEW_SPEC: () => CSV_TEXT_PROMPT_MODAL_VIEW_SPEC,
18687
- ChildUtils: () => ChildUtils,
18688
- ControllerState: () => ControllerState,
18689
- DateUtils: () => DateUtils,
18690
- ELEMENT_VALIDITY_LEVEL_FACTORY: () => ELEMENT_VALIDITY_LEVEL_FACTORY,
18691
- ElementValidityLevel: () => ElementValidityLevel,
18692
- EnumFactory: () => EnumFactory,
18693
- FORM_FIELD_ID_SUFFIX: () => FORM_FIELD_ID_SUFFIX,
18694
- FieldProperties: () => FieldProperties,
18695
- FieldSpec: () => FieldSpec,
18696
- FixedWidth: () => FixedWidth,
18697
- FromPropsHelper: () => FromPropsHelper,
18698
- LocalStorageService: () => LocalStorageService,
18699
- LocalisationNamespace: () => LocalisationNamespace,
18700
- Localiser: () => Localiser,
18701
- Log: () => Log,
18702
- MESSAGE_SEVERITY_FACTORY: () => MESSAGE_SEVERITY_FACTORY,
18703
- MessageCTO: () => MessageCTO,
18704
- MessageCodeTO: () => MessageCodeTO,
18705
- MessageService: () => MessageService,
18706
- MessageSeverity: () => MessageSeverity,
18707
- NO_HTTP_CODE: () => NO_HTTP_CODE,
18708
- NSK_CONTENT: () => NSK_CONTENT,
18709
- ObjectWithId: () => ObjectWithId,
18710
- PriceUtils: () => PriceUtils,
18711
- QUERY_SEP: () => QUERY_SEP,
18712
- QUERY_START: () => QUERY_START,
18713
- QueryParamHelper: () => QueryParamHelper,
18714
- REST_CLIENT_LOGGER: () => REST_CLIENT_LOGGER,
18715
- RestClient: () => RestClient,
18716
- RunFunctionResult: () => RunFunctionResult,
18717
- SelectHelper: () => SelectHelper,
18718
- TECHNICAL_CONTROLLER_ID: () => TECHNICAL_CONTROLLER_ID,
18719
- ViewSpec: () => ViewSpec,
18720
- createRestClient: () => createRestClient,
18721
- fatalRunErrorFunction: () => fatalRunErrorFunction,
18722
- filterArrayByIndices: () => filterArrayByIndices,
18723
- getEnumRatingLabel: () => getEnumRatingLabel,
18724
- getEnumRatingValues: () => getEnumRatingValues,
18725
- indexRangeArray: () => indexRangeArray,
18726
- isContentWithMessages: () => isContentWithMessages,
18727
- openInNewTab: () => openInNewTab,
18728
- singleChangeHandlerToMulti: () => singleChangeHandlerToMulti,
18729
- sleep: () => sleep,
18730
- sortArrayByIndices: () => sortArrayByIndices,
18731
- useAWSUIRef: () => useAWSUIRef,
18732
- useControllerDisplayState: () => useControllerDisplayState,
18733
- useHotkey: () => useHotkey,
18734
- useMessages: () => useMessages,
18735
- useTOArrayChangeHandler: () => useTOArrayChangeHandler,
18736
- useTOChangeHandler: () => useTOChangeHandler,
18737
- warnWhenTabIsClosed: () => warnWhenTabIsClosed
18738
- });
18739
- var import_components = require("@cloudscape-design/components");
18740
- var import_components2 = require("@cloudscape-design/components");
18741
- var import_jsx_runtime = require("react/jsx-runtime");
18742
- var import_jsx_runtime2 = require("react/jsx-runtime");
18743
- var import_jsx_runtime3 = require("react/jsx-runtime");
18744
- var import_components3 = require("@cloudscape-design/components");
18745
- var import_jsx_runtime4 = require("react/jsx-runtime");
18746
- var import_components4 = require("@cloudscape-design/components");
18747
- var import_jsx_runtime5 = require("react/jsx-runtime");
18748
- var import_components5 = require("@cloudscape-design/components");
18749
- var import_jsx_runtime6 = require("react/jsx-runtime");
18750
- var import_components6 = require("@cloudscape-design/components");
18751
- var import_jsx_runtime7 = require("react/jsx-runtime");
18752
- var import_components7 = require("@cloudscape-design/components");
18753
- var import_jsx_runtime8 = require("react/jsx-runtime");
18754
- var import_jsx_runtime9 = require("react/jsx-runtime");
18755
- var import_components8 = require("@cloudscape-design/components");
18756
- var import_jsx_runtime10 = require("react/jsx-runtime");
18757
- var import_jsx_runtime11 = require("react/jsx-runtime");
18758
- var import_components9 = require("@cloudscape-design/components");
18759
- var import_jsx_runtime12 = require("react/jsx-runtime");
18760
- var import_jsx_runtime13 = require("react/jsx-runtime");
18761
- var import_components10 = require("@cloudscape-design/components");
18762
- var import_jsx_runtime14 = require("react/jsx-runtime");
18763
- var import_components11 = require("@cloudscape-design/components");
18764
- var import_jsx_runtime15 = require("react/jsx-runtime");
18765
- var import_components12 = require("@cloudscape-design/components");
18766
- var import_jsx_runtime16 = require("react/jsx-runtime");
18767
- var import_components13 = require("@cloudscape-design/components");
18768
- var import_jsx_runtime17 = require("react/jsx-runtime");
18769
- var import_components14 = require("@cloudscape-design/components");
18770
- var import_jsx_runtime18 = require("react/jsx-runtime");
18771
- var import_components15 = require("@cloudscape-design/components");
18772
- var import_jsx_runtime19 = require("react/jsx-runtime");
18773
- var import_components16 = require("@cloudscape-design/components");
18774
- var import_jsx_runtime20 = require("react/jsx-runtime");
18775
- var import_components17 = require("@cloudscape-design/components");
18776
- var import_jsx_runtime21 = require("react/jsx-runtime");
18777
- var import_components18 = require("@cloudscape-design/components");
18778
- var import_jsx_runtime22 = require("react/jsx-runtime");
18779
- var import_components19 = require("@cloudscape-design/components");
18780
- var import_jsx_runtime23 = require("react/jsx-runtime");
18781
- var import_components20 = require("@cloudscape-design/components");
18782
- var import_jsx_runtime24 = require("react/jsx-runtime");
18783
- var import_react_rating = require("@smastrom/react-rating");
18784
- var import_react = require("react");
18785
- var import_jsx_runtime25 = require("react/jsx-runtime");
18786
- var import_components21 = require("@cloudscape-design/components");
18787
- var import_jsx_runtime26 = require("react/jsx-runtime");
18788
- var import_components22 = require("@cloudscape-design/components");
18789
- var import_jsx_runtime27 = require("react/jsx-runtime");
18790
- var import_components23 = require("@cloudscape-design/components");
18791
- var import_jsx_runtime28 = require("react/jsx-runtime");
18792
- var import_components24 = require("@cloudscape-design/components");
18793
- var import_jsx_runtime29 = require("react/jsx-runtime");
18794
- var import_jsx_runtime30 = require("react/jsx-runtime");
18795
- var import_react2 = require("react");
18796
- var import_react3 = require("react");
18797
- var import_react4 = require("react");
18798
- var import_react5 = require("react");
18799
- var import_react6 = require("react");
18800
- var FromPropsHelper = class {
18801
- };
18802
- FromPropsHelper.getBasicProps = (props) => {
18803
- const localisationObject = props.localiser.localiseField(props.fieldSpec.getLocalisationKey(), props.localisationVariables, props.alternateNs);
18804
- const uniqueId = props.fieldSpec.getDataTestId();
18805
- return { localisationObject, uniqueId };
18806
- };
18807
- FromPropsHelper.usesFormField = (props) => {
18808
- const localisation = props.localiser.localiseField(props.fieldSpec.getLocalisationKey(), props.localisationVariables, props.alternateNs);
18809
- return props.formField !== void 0 || (localisation == null ? void 0 : localisation.formField) !== void 0 || props.secondaryControl !== void 0;
18810
- };
18811
- FromPropsHelper.getLocalisedErrorText = (props, value, localiseValidity) => {
18812
- var _a2, _b;
18813
- if (((_a2 = props.formField) == null ? void 0 : _a2.errorText) !== void 0) {
18814
- return (_b = props.formField) == null ? void 0 : _b.errorText;
18815
- }
18816
- const validityLevel = props.fieldSpec.getValueValidityLevel(value);
18817
- return localiseValidity(props.fieldSpec, validityLevel);
18818
- };
18819
- FromPropsHelper.sanitizeValueToString = (value) => {
18820
- if (value === null || value === void 0) {
18821
- return "";
18822
- }
18823
- return value;
18824
- };
18825
- var FORM_FIELD_ID_SUFFIX = "_FORM_FIELD";
18826
- function CSFormField(props) {
18827
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18828
- const formFieldId = uniqueId + FORM_FIELD_ID_SUFFIX;
18829
- if (!FromPropsHelper.usesFormField(props)) {
18830
- return props.children;
18831
- }
18832
- return (
18833
- // IMPORTANT: Order of props determines which one "wins". You can override Elements that are present in the
18834
- // localisation texts via the additional props. For instance, you can pass in
18835
- // non-static localisations that require variable values dynamically.
18836
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
18837
- import_components2.FormField,
18838
- {
18839
- "data-testid": formFieldId,
18840
- ...localisationObject == null ? void 0 : localisationObject.formField,
18841
- ...props.formField,
18842
- secondaryControl: props.secondaryControl,
18843
- children: props.children
18844
- }
18845
- )
18846
- );
18847
- }
18848
- var ChildUtils = class {
18849
- };
18850
- ChildUtils.getChildren = (props, localisationObject) => {
18851
- var _a2, _b;
18852
- const childrenRaw = (_a2 = props.children) != null ? _a2 : localisationObject == null ? void 0 : localisationObject.children;
18853
- const children = props.childrenWrapper ? props.childrenWrapper(childrenRaw) : childrenRaw;
18854
- let finalChildren = props.preventOverflow ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: {
18855
- whiteSpace: "nowrap",
18856
- overflow: "hidden",
18857
- textOverflow: "ellipsis"
18858
- }, children }) : children;
18859
- let formFieldProps = (_b = props.formField) != null ? _b : localisationObject == null ? void 0 : localisationObject.formField;
18860
- if (props.inlineLabel && FromPropsHelper.usesFormField(props)) {
18861
- finalChildren = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexWrap: "nowrap" }, children: [
18862
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: {
18863
- flex: "none",
18864
- fontWeight: "bold",
18865
- paddingRight: "5px"
18866
- }, children: formFieldProps.label + ":" }),
18867
- finalChildren
18868
- ] });
18869
- formFieldProps = { ...formFieldProps, label: void 0 };
18870
- }
18871
- return { children: finalChildren, formProps: { ...props, formField: formFieldProps } };
18872
- };
18873
- function CSAlert(props) {
18874
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18875
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
18876
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
18877
- import_components.Alert,
18878
- {
18879
- "data-testid": uniqueId,
18880
- ...props,
18881
- ...localisationObject,
18882
- children
18883
- }
18884
- ) });
18885
- }
18886
- function CSBox(props) {
18887
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18888
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
18889
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
18890
- import_components3.Box,
18891
- {
18892
- "data-testid": uniqueId,
18893
- ...props,
18894
- ...localisationObject,
18895
- children
18896
- }
18897
- ) });
18898
- }
18899
- function CSButton(props) {
18900
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18901
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
18902
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
18903
- import_components4.Button,
18904
- {
18905
- "data-testid": uniqueId,
18906
- ...props,
18907
- ...localisationObject,
18908
- children
18909
- }
18910
- ) });
18911
- }
18912
- function CSCheckbox(props) {
18913
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18914
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
18915
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
18916
- import_components5.Checkbox,
18917
- {
18918
- "data-testid": uniqueId,
18919
- name: uniqueId,
18920
- controlId: uniqueId,
18921
- onChange: props.onChange ? props.onChange : ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.checked),
18922
- ...props,
18923
- ...localisationObject,
18924
- children
18925
- }
18926
- ) });
18927
- }
18928
- function CSDatePicker(props) {
18929
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18930
- const sanitizeValue = () => {
18931
- return new Date(FromPropsHelper.sanitizeValueToString(props.value)).toISOString().split("T")[0];
18932
- };
18933
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CSFormField, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
18934
- import_components6.DatePicker,
18935
- {
18936
- "data-testid": uniqueId,
18937
- controlId: uniqueId,
18938
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
18939
- ...props,
18940
- ...localisationObject,
18941
- value: sanitizeValue()
18942
- }
18943
- ) });
18944
- }
18945
- function CSMultiselect(props) {
18946
- var _a2, _b;
18947
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
18948
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
18949
- const adaptedOnChange = ({ detail }) => {
18950
- if (props.enableSelectAll || props.enforceSelection) {
18951
- if (detail.selectedOptions.length === 0) {
18952
- props.onChangeValue(props.fieldSpec.key, [props.selectedOptions[0].value]);
18953
- } else {
18954
- props.onChangeValue(props.fieldSpec.key, detail.selectedOptions.map((sel) => sel.value));
18955
- }
18956
- } else {
18957
- props.onChangeValue(props.fieldSpec.key, detail.selectedOptions.map((sel) => sel.value));
18958
- }
18959
- };
18960
- const hideTokens = (_a2 = props.hideTokens) != null ? _a2 : props.tokenLimit !== void 0 && props.tokenLimit === 0;
18961
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
18962
- import_components7.Multiselect,
18963
- {
18964
- "data-testid": uniqueId,
18965
- controlId: uniqueId,
18966
- filteringType: (_b = props.filteringType) != null ? _b : "auto",
18967
- onChange: adaptedOnChange,
18968
- enableSelectAll: true,
18969
- ...props,
18970
- ...localisationObject,
18971
- hideTokens,
18972
- options: props.options
18973
- }
18974
- ) });
18975
- }
18976
- var ObjectWithId = class {
18977
- };
18978
- ObjectWithId.idToString = (objectWithId) => {
18979
- return objectWithId.id ? objectWithId.id.toString() : "<N/A>";
18980
- };
18981
- ObjectWithId.toObjectWithId = (array2, idExtractor) => {
18982
- return array2.map((object2) => ({
18983
- ...object2,
18984
- id: idExtractor(object2)
18985
- }));
18986
- };
18987
- var _SelectHelper = class _SelectHelper2 {
18988
- };
18989
- _SelectHelper.singleSelectOptionWithId = (objects, selectedObjectId, toOptionDefinition) => {
18990
- return _SelectHelper.singleSelectOption(objects, objects.find((importObject) => ObjectWithId.idToString(importObject) === (selectedObjectId == null ? void 0 : selectedObjectId.toString())), toOptionDefinition);
18991
- };
18992
- _SelectHelper.singleSelectOption = (objects, selectedObject, toOptionDefinition) => {
18993
- const options = objects.map((object2) => ({
18994
- value: ObjectWithId.idToString(object2),
18995
- ...toOptionDefinition(object2)
18996
- }));
18997
- const selectedOption = selectedObject === void 0 ? null : _SelectHelper.getSelectedOptions(options, [selectedObject.id])[0];
18998
- return {
18999
- options,
19000
- selectedOption
19001
- };
19002
- };
19003
- _SelectHelper.singleSelectEnum = (enumFactory, selectedEnum, localiser, exclude) => {
19004
- const options = enumFactory.values.filter((enumInstance) => exclude === void 0 || !exclude.includes(enumInstance)).map((enumInstance) => {
19005
- const enumTranslation = localiser.getEnumLocalisation(enumFactory, enumInstance);
19006
- return {
19007
- value: enumInstance.toString(),
19008
- label: enumTranslation.label,
19009
- description: enumTranslation.description
19010
- };
19011
- });
19012
- const selectedOption = selectedEnum === void 0 ? null : _SelectHelper.getSelectedEnumOptions(options, [selectedEnum.toString()])[0];
19013
- return {
19014
- options,
19015
- selectedOption
19016
- };
19017
- };
19018
- _SelectHelper.multiSelectOptions = (objects, selectedObjects, toOptionDefinition) => {
19019
- const options = objects.map((object2) => ({
19020
- value: ObjectWithId.idToString(object2),
19021
- ...toOptionDefinition(object2)
19022
- }));
19023
- const selectedOptions = _SelectHelper.getSelectedOptions(options, selectedObjects.map((s2) => s2.id));
19024
- return {
19025
- options,
19026
- selectedOptions
19027
- };
19028
- };
19029
- _SelectHelper.multiSelectEnums = (enumFactory, selectedEnums, localiser) => {
19030
- const options = enumFactory.values.map((enumInstance) => {
19031
- const enumTranslation = localiser.getEnumLocalisation(enumFactory, enumInstance);
19032
- return {
19033
- value: enumInstance.toString(),
19034
- label: enumTranslation.label,
19035
- description: enumTranslation.description
19036
- };
19037
- });
19038
- const selectedOptions = _SelectHelper.getSelectedEnumOptions(options, selectedEnums);
19039
- return {
19040
- options,
19041
- selectedOptions
19042
- };
19043
- };
19044
- _SelectHelper.getSelectedOptions = (options, selectedIds) => {
19045
- const selectedIdsSet = {};
19046
- selectedIds.forEach((selId) => selId !== void 0 ? selectedIdsSet[selId] = true : null);
19047
- return options.filter((option) => option.value && selectedIdsSet[parseInt(option.value)]);
19048
- };
19049
- _SelectHelper.getSelectedEnumOptions = (options, selectedEnums) => {
19050
- const selectedIdsSet = {};
19051
- selectedEnums.forEach((selId) => selId !== void 0 ? selectedIdsSet[selId.toString()] = true : null);
19052
- return options.filter((option) => option.value && selectedIdsSet[option.value]);
19053
- };
19054
- var SelectHelper = _SelectHelper;
19055
- function CSEnumMultiselect(props) {
19056
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
19057
- CSMultiselect,
19058
- {
19059
- ...SelectHelper.multiSelectEnums(props.factory, props.selectedEnums, props.localiser),
19060
- ...props
19061
- }
19062
- );
19063
- }
19064
- function CSSegmentedControl(props) {
19065
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19066
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19067
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
19068
- import_components8.SegmentedControl,
19069
- {
19070
- "data-testid": uniqueId,
19071
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.selectedId),
19072
- ...props,
19073
- ...localisationObject
19074
- }
19075
- ) });
19076
- }
19077
- function CSEnumSegmentedControl(props) {
19078
- const options = props.factory.values.filter((e) => props.exclude === void 0 || !props.exclude.includes(e)).map((e) => ({
19079
- text: props.localiser.getEnumLabel(props.factory, e),
19080
- id: e.toString()
19081
- }));
19082
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
19083
- CSSegmentedControl,
19084
- {
19085
- selectedId: props.selectedEnum === void 0 ? null : props.selectedEnum.toString(),
19086
- options,
19087
- label: props.formField ? props.formField.label : void 0,
19088
- ...props
19089
- }
19090
- );
19091
- }
19092
- function CSSelect(props) {
19093
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19094
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19095
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
19096
- import_components9.Select,
19097
- {
19098
- "data-testid": uniqueId,
19099
- controlId: uniqueId,
19100
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.selectedOption.value),
19101
- ...props,
19102
- ...localisationObject
19103
- }
19104
- ) });
19105
- }
19106
- function CSEnumSelect(props) {
19107
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19108
- CSSelect,
19109
- {
19110
- ...SelectHelper.singleSelectEnum(props.factory, props.selectedEnum, props.localiser, props.exclude),
19111
- ...props
19112
- }
19113
- );
19114
- }
19115
- function CSEnumTiles(props) {
19116
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19117
- const items = props.factory.values.filter((enumInstance) => props.exclude === void 0 || !props.exclude.includes(enumInstance)).map((enumInstance) => {
19118
- const enumTranslation = props.localiser.getEnumLocalisation(props.factory, enumInstance);
19119
- return {
19120
- value: enumInstance.toString(),
19121
- label: enumTranslation.label,
19122
- description: enumTranslation.description
19123
- };
19124
- });
19125
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
19126
- import_components10.Tiles,
19127
- {
19128
- "data-testid": uniqueId,
19129
- controlId: uniqueId,
19130
- name: uniqueId,
19131
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
19132
- value: props.selectedEnum ? props.selectedEnum.toString() : null,
19133
- items,
19134
- ...props,
19135
- ...localisationObject
19136
- }
19137
- );
19138
- }
19139
- var openInNewTab = (link) => {
19140
- const newWindow = window.open(link, "_blank", "noopener,noreferrer");
19141
- if (newWindow) newWindow.opener = null;
19142
- };
19143
- var warnWhenTabIsClosed = (isDirty) => {
19144
- const handleTabClose = (event) => {
19145
- if (isDirty !== void 0 && !isDirty()) {
19146
- return void 0;
19147
- }
19148
- event.preventDefault();
19149
- return event.returnValue = "Are you sure you want to exit?";
19150
- };
19151
- window.addEventListener("beforeunload", handleTabClose);
19152
- return () => {
19153
- window.removeEventListener("beforeunload", handleTabClose);
19154
- };
19155
- };
19156
- function CSLink(props) {
19157
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19158
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
19159
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19160
- import_components11.Link,
19161
- {
19162
- "data-testid": uniqueId,
19163
- ...props,
19164
- ...localisationObject,
19165
- children
19166
- }
19167
- ) });
19168
- }
19169
- function CSExternalLink(props) {
19170
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CSLink, { ...props, external: true, onFollow: (detail) => detail.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { onClick: () => openInNewTab(props.link), children: props.children }) });
19171
- }
19172
- function CSHeader(props) {
19173
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19174
- const { children } = ChildUtils.getChildren(props, localisationObject);
19175
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
19176
- import_components12.Header,
19177
- {
19178
- "data-testid": uniqueId,
19179
- ...props,
19180
- ...localisationObject,
19181
- children
19182
- }
19183
- );
19184
- }
19185
- function CSInput(props) {
19186
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19187
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19188
- const sanitizedValue = FromPropsHelper.sanitizeValueToString(props.value);
19189
- const errorText = FromPropsHelper.getLocalisedErrorText(props, sanitizedValue, props.localiser.getFieldValidityLocalisationFunction());
19190
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CSFormField, { ...props, formField: { ...formProps, errorText }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
19191
- import_components13.Input,
19192
- {
19193
- "data-testid": uniqueId,
19194
- controlId: uniqueId,
19195
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
19196
- ...props,
19197
- ...localisationObject,
19198
- value: sanitizedValue
19199
- }
19200
- ) });
19201
- }
19202
- function CSNumericInput(props) {
19203
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19204
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19205
- const sanitizeValue = () => {
19206
- if (props.value === void 0 || props.value === null || isNaN(props.value)) {
19207
- return "";
19208
- }
19209
- return FromPropsHelper.sanitizeValueToString(props.value);
19210
- };
19211
- const sanitizedValue = sanitizeValue();
19212
- const errorText = FromPropsHelper.getLocalisedErrorText(props, sanitizedValue, props.localiser.getFieldValidityLocalisationFunction());
19213
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CSFormField, { ...formProps, formField: { ...props.formField, errorText }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
19214
- import_components14.Input,
19215
- {
19216
- "data-testid": uniqueId,
19217
- controlId: uniqueId,
19218
- onChange: ({ detail }) => {
19219
- props.onChangeValue(props.fieldSpec.key, props.step && props.step !== "any" && props.step % 1 === 0 ? parseInt(detail.value) : parseFloat(detail.value));
19220
- },
19221
- ...props,
19222
- ...localisationObject,
19223
- value: sanitizedValue,
19224
- type: "number",
19225
- inputMode: "numeric"
19226
- }
19227
- ) });
19228
- }
19229
- function CSStatusIndicator(props) {
19230
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19231
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
19232
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
19233
- import_components15.StatusIndicator,
19234
- {
19235
- "data-testid": uniqueId,
19236
- ...props,
19237
- ...localisationObject,
19238
- children
19239
- }
19240
- ) });
19241
- }
19242
- function CSTextContent(props) {
19243
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19244
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
19245
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19246
- import_components16.TextContent,
19247
- {
19248
- "data-testid": uniqueId,
19249
- ...props,
19250
- ...localisationObject,
19251
- children
19252
- }
19253
- ) });
19254
- }
19255
- function CSTextarea(props) {
19256
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19257
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19258
- const sanitizedValue = FromPropsHelper.sanitizeValueToString(props.value);
19259
- const errorText = FromPropsHelper.getLocalisedErrorText(props, sanitizedValue, props.localiser.getFieldValidityLocalisationFunction());
19260
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CSFormField, { ...props, formField: { ...formProps, errorText }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19261
- import_components17.Textarea,
19262
- {
19263
- "data-testid": uniqueId,
19264
- controlId: uniqueId,
19265
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
19266
- ...localisationObject,
19267
- ...props,
19268
- value: sanitizedValue
19269
- }
19270
- ) });
19271
- }
19272
- function CSTimeInput(props) {
19273
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19274
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19275
- const defaultFormat = "hh:mm";
19276
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19277
- import_components18.TimeInput,
19278
- {
19279
- "data-testid": uniqueId,
19280
- autoFocus: props.autoFocus,
19281
- onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
19282
- format: props.format ? props.format : defaultFormat,
19283
- placeholder: props.placeholder ? props.placeholder : defaultFormat,
19284
- ...props,
19285
- ...localisationObject
19286
- }
19287
- ) });
19288
- }
19289
- function CSToggle(props) {
19290
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19291
- const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
19292
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
19293
- import_components19.Toggle,
19294
- {
19295
- "data-testid": uniqueId,
19296
- name: uniqueId,
19297
- controlId: uniqueId,
19298
- onChange: props.onChange ? props.onChange : ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.checked),
19299
- ...props,
19300
- ...localisationObject,
19301
- children
19302
- }
19303
- ) });
19304
- }
19305
- function CSCopyToClipboard(props) {
19306
- var _a2, _b;
19307
- const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
19308
- const { formProps } = ChildUtils.getChildren(props, localisationObject);
19309
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CSFormField, { ...formProps, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
19310
- import_components20.CopyToClipboard,
19311
- {
19312
- "data-testid": uniqueId,
19313
- ...props,
19314
- copySuccessText: (_a2 = props.copySuccessText) != null ? _a2 : "",
19315
- copyErrorText: (_b = props.copyErrorText) != null ? _b : "",
19316
- ...localisationObject
19317
- }
19318
- ) });
19319
- }
19320
- var EnumFactory = class {
19321
- constructor(enumName, values) {
19322
- this.enumName = enumName;
19323
- this.values = values;
19324
- if (this.values.length === 0) {
19325
- throw new Error("Empty localized enum array is not allowed here");
19326
- }
19327
- }
19328
- getEnumIndex(instance) {
19329
- return this.values.indexOf(instance);
19330
- }
19331
- };
19332
- var ElementValidityLevel = /* @__PURE__ */ ((ElementValidityLevel2) => {
19333
- ElementValidityLevel2["VALID"] = "VALID";
19334
- ElementValidityLevel2["REQUIRED_VALUE_IS_NOT_PRESENT"] = "REQUIRED_VALUE_IS_NOT_PRESENT";
19335
- ElementValidityLevel2["MAX_LENGTH_EXCEEDED"] = "MAX_LENGTH_EXCEEDED";
19336
- ElementValidityLevel2["LOWER_BOUND_ONLY_TOO_SMALL"] = "LOWER_BOUND_ONLY_TOO_SMALL";
19337
- ElementValidityLevel2["UPPER_BOUND_ONLY_TOO_BIG"] = "UPPER_BOUND_ONLY_TOO_BIG";
19338
- ElementValidityLevel2["BOTH_BOUNDS_OUT_OF_BOUNDS"] = "BOTH_BOUNDS_OUT_OF_BOUNDS";
19339
- return ElementValidityLevel2;
19340
- })(ElementValidityLevel || {});
19341
- var ELEMENT_VALIDITY_LEVEL_FACTORY = new EnumFactory("ElementValidityLevel", Object.values(ElementValidityLevel));
19342
- var DISABLE_LOGGING = false;
19343
- var Log = class _Log {
19344
- constructor(prefix) {
19345
- this.prefix = prefix ? "[" + prefix + "] " : "";
19346
- this.debugLogging = true;
19347
- }
19348
- static toReadableObjectString(object2) {
19349
- return this.toObjectStr(object2, (object22) => JSON.stringify(object22, null, 2));
19350
- }
19351
- static toCompactReadableObjectString(object2, dependencyCharLimit) {
19352
- const str = this.toObjectStr(object2, (object22) => JSON.stringify(object22));
19353
- const maxLen = Math.min(str.length, dependencyCharLimit);
19354
- if (maxLen < str.length) {
19355
- return str.substring(0, maxLen) + " ( ... continued)";
19356
- }
19357
- return str;
19358
- }
19359
- static toObjectStr(object2, stringify2) {
19360
- if (object2 === null) {
19361
- return "null";
19362
- }
19363
- if (object2 === void 0) {
19364
- return "undefined";
19365
- }
19366
- let s2 = stringify2(object2);
19367
- if (s2 === void 0) {
19368
- return "function";
19369
- }
19370
- return s2.replaceAll("\\", "");
19371
- }
19372
- /**
19373
- * log at debugging level
19374
- */
19375
- debug(msg, ...supportingDetails) {
19376
- this.emitLogMessage("debug", msg, supportingDetails);
19377
- }
19378
- /**
19379
- * log at information level
19380
- */
19381
- info(msg, ...supportingDetails) {
19382
- this.emitLogMessage("info", msg, supportingDetails);
19383
- }
19384
- /**
19385
- * log at warning level
19386
- */
19387
- warn(msg, ...supportingDetails) {
19388
- this.emitLogMessage("warn", msg, supportingDetails);
19389
- }
19390
- /**
19391
- * log at error level
19392
- */
19393
- error(msg, ...supportingDetails) {
19394
- this.emitLogMessage("error", msg, supportingDetails);
19395
- }
19396
- object(prefixMsg, object2) {
19397
- this.debug(prefixMsg + " " + _Log.toReadableObjectString(object2));
19398
- }
19399
- effectStart(effectName, msg, dependencies, dependencyCharLimit) {
19400
- let dependenciesSuffix = "";
19401
- if (dependencies) {
19402
- let dependenciesStr = "";
19403
- for (let i = 0; i < dependencies.length; i++) {
19404
- const dependency = dependencies[i];
19405
- dependenciesStr = `${dependenciesStr} Dep[${i}]=<${_Log.toCompactReadableObjectString(dependency, dependencyCharLimit || 60)}>`;
19406
- }
19407
- dependenciesSuffix = (msg.length > 0 ? ", " : "") + "DEPS:" + dependenciesStr;
19408
- }
19409
- this.effect(`start - ${effectName}`, `${msg}${dependenciesSuffix}`);
19410
- }
19411
- effectEnd(effectName) {
19412
- this.debug(`EFFECT(end - ${effectName})`);
19413
- }
19414
- effect(effectName, msg) {
19415
- this.debug(`EFFECT(${effectName}): ${msg}`);
19416
- }
19417
- /**
19418
- * creates a log message with some detailed information
19419
- * @param msgType type of message (debug, info, warn, error)
19420
- * @param msg the message as string
19421
- * @param supportingDetails details that should be logged
19422
- */
19423
- emitLogMessage(msgType, msg, supportingDetails) {
19424
- if (DISABLE_LOGGING) {
19425
- return;
19426
- }
19427
- const logTS = (/* @__PURE__ */ new Date()).toISOString();
19428
- if (!this.debugLogging && msgType === "debug") {
19429
- return;
19430
- }
19431
- if (supportingDetails.length > 0) {
19432
- console[msgType](`${logTS} ${this.prefix}${msg}${supportingDetails}`);
19433
- } else {
19434
- console[msgType](`${logTS} ${this.prefix}${msg}`);
19435
- }
19436
- }
19437
- };
19438
- var LOGGER = new Log("ViewSpec");
19439
- var ViewElementSpec = class {
19440
- constructor(key, instanceId) {
19441
- this.key = key;
19442
- this.instanceId = instanceId;
19443
- }
19444
- getDataTestId() {
19445
- if (this.dataTestId === void 0) {
19446
- const parentDataTestId = this.parent ? this.parent.getDataTestId() : "";
19447
- this.dataTestId = this.instanceId ? `${parentDataTestId}${this.key}${this.instanceId}END` : `${parentDataTestId}${this.key}END`;
19448
- }
19449
- return this.dataTestId;
19450
- }
19451
- getLocalisationKey() {
19452
- if (this.localisationKey === void 0) {
19453
- const keys2 = this.getKeyHierarchy();
19454
- this.localisationKey = this.ns.createKey(...keys2);
19455
- }
19456
- return this.localisationKey;
19457
- }
19458
- getKeyHierarchy() {
19459
- if (this.keyHierarchy === void 0) {
19460
- const parentHierarchy = this.parent ? this.parent.getKeyHierarchy() : [];
19461
- this.keyHierarchy = [...parentHierarchy, this.key];
19462
- }
19463
- return this.keyHierarchy;
19464
- }
19465
- log(prefix) {
19466
- LOGGER.info(`${prefix === void 0 ? "" : prefix}<${this.getDataTestId()}> = ${this.getLocalisationKey()}`);
19467
- }
19468
- };
19469
- var FieldSpec = class _FieldSpec extends ViewElementSpec {
19470
- constructor(key, required, maxLength, minValue, maxValue, customFieldValidator, instanceId) {
19471
- super(key, instanceId);
19472
- this.required = required;
19473
- this.maxLength = maxLength;
19474
- this.minValue = minValue;
19475
- this.maxValue = maxValue;
19476
- this.customFieldValidator = customFieldValidator;
19477
- }
19478
- static getTOValidityLevel(transportObject, elements) {
19479
- if (elements.length === 0) {
19480
- throw Error("At least one field property must be given");
19481
- }
19482
- for (let index2 = 0; index2 < elements.length; index2++) {
19483
- const field = elements[index2];
19484
- const fieldValidity = field.getValueValidityLevel(transportObject[field.key]);
19485
- if (fieldValidity !== "VALID") {
19486
- return fieldValidity;
19487
- }
19488
- }
19489
- return "VALID";
19490
- }
19491
- static isTOValid(transportObject, Elements) {
19492
- return this.getTOValidityLevel(transportObject, Elements) === "VALID";
19493
- }
19494
- static debugLogElementValidityArray(elements, Elements) {
19495
- for (let index2 = 0; index2 < elements.length; index2++) {
19496
- const element = elements[index2];
19497
- _FieldSpec.debugLogElementValidity(element, "idx=" + index2.toString(), Elements);
19498
- }
19499
- }
19500
- static debugLogElementValidity(element, elementId, Elements) {
19501
- for (const field of Elements) {
19502
- const fieldValidity = _FieldSpec.getTOValidityLevel(element, [field]);
19503
- LOGGER.info(`Field validity level, element id = <${elementId}>, field name = <${field.getDataTestId()}>, validity level = <${fieldValidity.toString()}>.`);
19504
- }
19505
- }
19506
- getValueValidityLevel(value) {
19507
- if (this.customFieldValidator) {
19508
- return this.customFieldValidator(this, value);
19509
- }
19510
- const isString = value !== void 0 && value !== null && (typeof value === "string" || value instanceof String);
19511
- const isNumber = value !== void 0 && value !== null && typeof value === "number";
19512
- if (this.required && (value === void 0 || value === null || isString && value.trim().length === 0 || isNumber && isNaN(value))) {
19513
- return "REQUIRED_VALUE_IS_NOT_PRESENT";
19514
- }
19515
- if (isString && this.maxLength !== void 0 && value.length > this.getMaxLength()) {
19516
- return "MAX_LENGTH_EXCEEDED";
19517
- }
19518
- if (isNumber) {
19519
- if (this.minValue !== void 0 && this.maxValue === void 0 && this.minValue > value) {
19520
- return "LOWER_BOUND_ONLY_TOO_SMALL";
19521
- }
19522
- if (this.maxValue !== void 0 && this.minValue === void 0 && this.maxValue < value) {
19523
- return "UPPER_BOUND_ONLY_TOO_BIG";
19524
- }
19525
- if (this.minValue !== void 0 && this.maxValue !== void 0 && (this.minValue > value || this.maxValue < value)) {
19526
- return "BOTH_BOUNDS_OUT_OF_BOUNDS";
19527
- }
19528
- }
19529
- return "VALID";
19530
- }
19531
- getMaxLength() {
19532
- return this.maxLength ? this.maxLength : Number.MAX_SAFE_INTEGER;
19533
- }
19534
- };
19535
- var ViewSpec = class _ViewSpec extends ViewElementSpec {
19536
- constructor(key, ns, instanceId, customViewValidator) {
19537
- super(key, instanceId);
19538
- this.ns = ns;
19539
- if (!customViewValidator) {
19540
- this.viewValidator = () => "VALID";
19541
- } else {
19542
- this.viewValidator = customViewValidator;
19543
- }
19544
- }
19545
- static create(key, ns, elementDefinition, instanceId, parent, customViewValidator) {
19546
- const viewSpec = new _ViewSpec(key, ns, instanceId, customViewValidator);
19547
- viewSpec.parent = parent;
19548
- viewSpec.elements = elementDefinition(viewSpec);
19549
- return viewSpec;
19550
- }
19551
- addField(fieldSpec) {
19552
- fieldSpec.parent = this;
19553
- fieldSpec.ns = this.ns;
19554
- return fieldSpec;
19555
- }
19556
- addFieldFromProps(fieldProps, customFieldValidator, instanceId) {
19557
- const fieldSpec = new FieldSpec(fieldProps.key, fieldProps.required, fieldProps.maxLength, fieldProps.minValue, fieldProps.maxValue, customFieldValidator, instanceId);
19558
- fieldSpec.parent = this;
19559
- fieldSpec.ns = this.ns;
19560
- return fieldSpec;
19561
- }
19562
- addView(viewSpecProvider, key, instanceId) {
19563
- const viewSpec = viewSpecProvider(this, key, instanceId);
19564
- viewSpec.ns = this.ns;
19565
- return viewSpec;
19566
- }
19567
- getAllElements() {
19568
- return Object.values(this.elements);
19569
- }
19570
- getValueValidityLevel(value) {
19571
- return this.viewValidator(this, value);
19572
- }
19573
- logViewSpec() {
19574
- this.log("VIEW :::: ");
19575
- for (const element of Object.values(this.elements)) {
19576
- if (element instanceof ViewElementSpec) {
19577
- element.log(" FIELD :::: ");
19578
- }
19579
- }
19580
- }
19581
- };
19582
- var CSV_ENUM_RATING_VIEW_SPEC = (parent, key, instanceId) => ViewSpec.create(key, parent.ns, (spec) => ({
19583
- rating: spec.addField(new FieldSpec("rating")),
19584
- boxRatingName: spec.addField(new FieldSpec("boxRatingName"))
19585
- }), instanceId, parent);
19586
- function getEnumRatingValues(factory, toOrderNumber) {
19587
- return toOrderNumber ? factory.values.sort((e1, e2) => toOrderNumber(e1) - toOrderNumber(e2)) : factory.values;
19588
- }
19589
- function getEnumRatingLabel(enumInstance, instanceId) {
19590
- return `${instanceId}_${enumInstance.toString()}`;
19591
- }
19592
- function CSVEnumRatingView(props) {
19593
- const spec = props.viewSpec;
19594
- const { elements } = spec;
19595
- const [hoveredValue, setHoveredValue] = (0, import_react.useState)(props.selectedEnum);
19596
- const valuesInOrder = getEnumRatingValues(props.factory, props.toOrderNumber);
19597
- const onHover = (hoveredIndex) => {
19598
- if (hoveredIndex === 0) {
19599
- setHoveredValue(props.selectedEnum);
19600
- } else {
19601
- setHoveredValue(valuesInOrder[hoveredIndex]);
19602
- }
19603
- };
19604
- const itemCount = Math.max(1, Math.min(valuesInOrder.length - 1, 10));
19605
- (0, import_react.useEffect)(() => {
19606
- setHoveredValue(props.selectedEnum);
19607
- }, [props.selectedEnum]);
19608
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(CSFormField, { fieldSpec: elements.rating, localiser: props.localiser, children: [
19609
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
19610
- import_react_rating.Rating,
19611
- {
19612
- "data-testid": elements.rating.getDataTestId(),
19613
- isDisabled: props.disabled,
19614
- style: { maxWidth: 100 },
19615
- items: itemCount,
19616
- value: !props.disabled ? valuesInOrder.indexOf(props.selectedEnum) : 0,
19617
- onHoverChange: onHover,
19618
- onChange: (selectedIndex) => props.onChangeValue(spec.key, valuesInOrder[selectedIndex]),
19619
- invisibleItemLabels: valuesInOrder.slice(1).map((e) => getEnumRatingLabel(e, spec.instanceId))
19620
- }
19621
- ),
19622
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { textAlign: "left", paddingLeft: "5px" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
19623
- CSBox,
19624
- {
19625
- fieldSpec: elements.boxRatingName,
19626
- localiser: props.localiser,
19627
- variant: !props.disabled ? "div" : "small",
19628
- children: hoveredValue !== void 0 ? props.localiser.getEnumLabel(props.factory, hoveredValue) : void 0
19629
- }
19630
- ) })
19631
- ] });
19632
- }
19633
- var CSV_NO_ITEMS_VIEW_SPEC = (ns) => ViewSpec.create("CSVNoItemsView", ns, (spec) => ({
19634
- boxHeading: spec.addField(new FieldSpec("boxHeading")),
19635
- boxBody: spec.addField(new FieldSpec("boxBody"))
19636
- }));
19637
- function CSVNoItemsView(props) {
19638
- const spec = props.viewSpec;
19639
- const { elements } = spec;
19640
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { "data-testid": spec.getDataTestId(), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components21.Box, { textAlign: "center", color: "inherit", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_components21.SpaceBetween, { size: "xxs", direction: "vertical", children: [
19641
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
19642
- CSBox,
19643
- {
19644
- fieldSpec: elements.boxHeading,
19645
- localiser: props.localiser,
19646
- alternateNs: spec.ns,
19647
- variant: "strong",
19648
- color: "inherit",
19649
- children: props.headingText
19650
- }
19651
- ),
19652
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
19653
- CSBox,
19654
- {
19655
- fieldSpec: elements.boxBody,
19656
- localiser: props.localiser,
19657
- alternateNs: spec.ns,
19658
- localisationVariables: { itemType: props.localiser.getEnumLabel(props.factory, props.itemType) },
19659
- variant: "p",
19660
- color: "inherit",
19661
- children: props.bodyText
19662
- }
19663
- ),
19664
- props.bodyNode
19665
- ] }) }) });
19666
- }
19667
- var LOGGER2 = new Log("PriceUtils");
19668
- var _PriceUtils = class _PriceUtils2 {
19669
- };
19670
- _PriceUtils.getFormattedPrice = (locale, price) => {
19671
- if (isNaN(price.priceInCents)) {
19672
- return "-";
19673
- }
19674
- return new Intl.NumberFormat(locale, {
19675
- style: "currency",
19676
- currency: price.currency.toString()
19677
- }).format(price.priceInCents / 100);
19678
- };
19679
- _PriceUtils.sumPrices = (prices, defaultCurrency) => {
19680
- if (prices.length === 0) {
19681
- return { priceInCents: 0, currency: defaultCurrency };
19682
- }
19683
- const currencySet = _PriceUtils.getCurrenciesFromPrices(prices);
19684
- if (currencySet.size > 1) {
19685
- LOGGER2.warn("Different currencies found in price array to be summed - the final price is incorrect!", currencySet);
19686
- }
19687
- const summedPrice = prices.map((pr) => pr.priceInCents).reduce((sum, current) => sum + current);
19688
- return { priceInCents: summedPrice, currency: prices[0].currency };
19689
- };
19690
- _PriceUtils.getCurrenciesFromPrices = (prices) => {
19691
- const currencySet = /* @__PURE__ */ new Set();
19692
- prices.forEach((pr) => currencySet.add(pr.currency));
19693
- return currencySet;
19694
- };
19695
- _PriceUtils.getPriceValidityLevel = (spec, value) => {
19696
- const centsValidity = spec.elements.inputPrice.getValueValidityLevel(value.priceInCents);
19697
- if (centsValidity !== "VALID") {
19698
- return centsValidity;
19699
- }
19700
- return spec.elements.selectCurrency.getValueValidityLevel(value.currency);
19701
- };
19702
- _PriceUtils.parseFormattedPrice = (locale, formattedPrice, currency) => {
19703
- const thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/\p{Number}/gu, "");
19704
- const decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, "");
19705
- const sanitizedPrice = formattedPrice.replace(new RegExp("\\" + thousandSeparator, "g"), "").replace(new RegExp("\\" + decimalSeparator), ".").replace(new RegExp("[^0-9.]", "g"), "").trim();
19706
- const parsedPriceCents = Math.round(100 * parseFloat(sanitizedPrice));
19707
- return { priceInCents: parsedPriceCents, currency };
19708
- };
19709
- _PriceUtils.parseFormattedPriceWithCurrency = (locale, formattedPrice, currencySymbolMapping) => {
19710
- const thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/\p{Number}/gu, "");
19711
- const decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, "");
19712
- const sanitizedPrice = formattedPrice.replace(new RegExp("\\" + thousandSeparator, "g"), "").replace(new RegExp("\\" + decimalSeparator), ".").replace(new RegExp("[^0-9.]", "g"), "").trim();
19713
- const parsedPriceCents = Math.round(100 * parseFloat(sanitizedPrice));
19714
- const supportedCurrencies = Object.keys(currencySymbolMapping);
19715
- const currencySymbolsFound = supportedCurrencies.filter((symbol) => formattedPrice.includes(symbol));
19716
- if (currencySymbolsFound.length > 1) {
19717
- throw new Error(`Multiple currency symbols found in formatter price string ${formattedPrice}, here are the supported currencies: ${supportedCurrencies}`);
19718
- }
19719
- return {
19720
- priceInCents: parsedPriceCents,
19721
- currency: currencySymbolMapping[currencySymbolsFound[0]]
19722
- };
19723
- };
19724
- var PriceUtils = _PriceUtils;
19725
- var CSV_PRICE_INPUT_VIEW_SPEC = (parent, key) => ViewSpec.create(key, parent.ns, (spec) => ({
19726
- inputPrice: spec.addField(new FieldSpec("inputPrice", true, void 0, 0)),
19727
- selectCurrency: spec.addField(new FieldSpec("currency", true)),
19728
- boxPriceDisplay: spec.addField(new FieldSpec("boxPriceDisplay"))
19729
- }), key, parent, PriceUtils.getPriceValidityLevel);
19730
- function CSVPriceInputView(props) {
19731
- const spec = props.viewSpec;
19732
- const { elements } = spec;
19733
- const priceInCents = props.value ? props.value.priceInCents : 0;
19734
- const currency = props.value ? props.value.currency : props.defaultCurrency;
19735
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
19736
- import_components22.Grid,
19737
- {
19738
- gridDefinition: [{ colspan: 4 }, { colspan: { default: 4, xxs: 3 } }, { colspan: { default: 4, xxs: 5 } }],
19739
- disableGutters: true,
19740
- children: [
19741
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
19742
- CSNumericInput,
19743
- {
19744
- fieldSpec: elements.inputPrice,
19745
- value: priceInCents / 100,
19746
- step: 0.01,
19747
- disabled: props.disabled,
19748
- localiser: props.localiser,
19749
- onChangeValue: (propertyName, changedValue) => props.onChange(props.viewSpec.key, {
19750
- priceInCents: parseFloat(changedValue) * 100,
19751
- currency
19752
- })
19753
- }
19754
- ),
19755
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { paddingLeft: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
19756
- CSEnumSelect,
19757
- {
19758
- fieldSpec: elements.selectCurrency,
19759
- localiser: props.localiser,
19760
- factory: props.currencyFactory,
19761
- selectedEnum: currency,
19762
- disabled: props.disabled,
19763
- onChangeValue: (propertyName, changedValue) => props.onChange(props.viewSpec.key, {
19764
- priceInCents,
19765
- currency: changedValue
19766
- }),
19767
- expandToViewport: props.expandToViewport
19768
- }
19769
- ) }),
19770
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { paddingTop: "30px", paddingLeft: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
19771
- CSBox,
19772
- {
19773
- fieldSpec: elements.boxPriceDisplay,
19774
- localiser: props.localiser,
19775
- fontSize: "heading-s",
19776
- fontWeight: "heavy",
19777
- variant: "awsui-key-label",
19778
- children: PriceUtils.getFormattedPrice(props.localiser.language(), { priceInCents, currency })
19779
- }
19780
- ) })
19781
- ]
19782
- }
19783
- );
19784
- }
19785
- var CSV_SEARCH_FILTER_VIEW_SPEC = (parent, key) => ViewSpec.create(key, parent.ns, (spec) => ({
19786
- inputSearch: spec.addField(new FieldSpec("inputSearch")),
19787
- buttonSearch: spec.addField(new FieldSpec("buttonSearch"))
19788
- }), void 0, parent);
19789
- function CSVSearchFilterView(props) {
19790
- const spec = props.viewSpec;
19791
- const { elements } = spec;
19792
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_components23.SpaceBetween, { size: "s", direction: "horizontal", children: [
19793
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { minWidth: "320px" }, children: props.inputSearch === void 0 || typeof props.inputSearch === "string" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
19794
- CSInput,
19795
- {
19796
- fieldSpec: elements.inputSearch,
19797
- localiser: props.localiser,
19798
- autoFocus: true,
19799
- placeholder: props.inputSearch,
19800
- onChangeValue: props.onChangeValue,
19801
- value: props.searchString,
19802
- type: "search"
19803
- }
19804
- ) : props.inputSearch }),
19805
- props.buttonSearch === void 0 || typeof props.buttonSearch === "string" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
19806
- CSButton,
19807
- {
19808
- fieldSpec: elements.buttonSearch,
19809
- localiser: props.localiser,
19810
- variant: "primary",
19811
- iconName: "search",
19812
- onClick: props.onConfirmSearch,
19813
- formAction: "submit",
19814
- loading: props.loading,
19815
- disabled: props.searchDisabled,
19816
- children: props.buttonSearch
19817
- }
19818
- ) : props.buttonSearch
19819
- ] });
19820
- }
19821
- var CSV_TEXT_PROMPT_MODAL_VIEW_SPEC = (parent, key) => ViewSpec.create(key, parent.ns, (spec) => ({
19822
- headerHeading: spec.addField(new FieldSpec("headerHeading")),
19823
- boxBodyText: spec.addField(new FieldSpec("boxBodyText")),
19824
- buttonPrimary: spec.addField(new FieldSpec("buttonPrimary")),
19825
- buttonSecondary: spec.addField(new FieldSpec("buttonSecondary"))
19826
- }), void 0, parent);
19827
- function CSVTextPromptModalView(props) {
19828
- const spec = props.viewSpec;
19829
- const { elements } = spec;
19830
- const secondaryAction = props.onSecondaryAction ? props.buttonSecondary === void 0 || typeof props.buttonSecondary === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
19831
- CSButton,
19832
- {
19833
- fieldSpec: elements.buttonSecondary,
19834
- localiser: props.localiser,
19835
- variant: "normal",
19836
- onClick: props.onSecondaryAction,
19837
- children: props.buttonSecondary
19838
- }
19839
- ) : props.buttonSecondary : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, {});
19840
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
19841
- import_components24.Modal,
19842
- {
19843
- "data-testid": props.viewSpec.getDataTestId(),
19844
- onDismiss: props.onDismiss,
19845
- visible: props.visible,
19846
- header: props.headerHeading === void 0 || typeof props.headerHeading === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
19847
- CSHeader,
19848
- {
19849
- fieldSpec: elements.headerHeading,
19850
- localiser: props.localiser,
19851
- children: props.headerHeading
19852
- }
19853
- ) : props.headerHeading,
19854
- footer: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components24.Box, { float: "right", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components24.SpaceBetween, { direction: "horizontal", size: "l", children: [
19855
- props.buttonPrimary === void 0 || typeof props.buttonPrimary === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
19856
- CSButton,
19857
- {
19858
- fieldSpec: elements.buttonPrimary,
19859
- localiser: props.localiser,
19860
- variant: "primary",
19861
- onClick: props.onPrimaryAction,
19862
- children: props.buttonPrimary
19863
- }
19864
- ) : props.buttonPrimary,
19865
- secondaryAction
19866
- ] }) }),
19867
- children: props.boxBodyText === void 0 || typeof props.boxBodyText === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CSBox, { fieldSpec: elements.boxBodyText, localiser: props.localiser, children: props.boxBodyText }) : props.boxBodyText
19868
- }
19869
- );
19870
- }
19871
- var ControllerState = /* @__PURE__ */ ((ControllerState2) => {
19872
- ControllerState2[ControllerState2["UNMOUNTED"] = 0] = "UNMOUNTED";
19873
- ControllerState2[ControllerState2["INITIALIZING"] = 1] = "INITIALIZING";
19874
- ControllerState2[ControllerState2["NORMAL"] = 2] = "NORMAL";
19875
- ControllerState2[ControllerState2["FATAL_ERROR"] = 3] = "FATAL_ERROR";
19876
- return ControllerState2;
19877
- })(ControllerState || {});
19878
- var DateUtils = class _DateUtils {
19879
- static dateAsString(date) {
19880
- const dd = String(date.getDate()).padStart(2, "0");
19881
- const mm = String(date.getMonth() + 1).padStart(2, "0");
19882
- const yyyy = date.getFullYear();
19883
- return yyyy + "-" + mm + "-" + dd;
19884
- }
19885
- static dateAsDateTimeString(date, language) {
19886
- return date.toLocaleDateString(language) + " " + date.toLocaleTimeString(language);
19887
- }
19888
- static nextSundayAt(hour, minute, second) {
19889
- const today = /* @__PURE__ */ new Date();
19890
- const addDays = 7 - today.getDay();
19891
- const nextSunday = new Date(today.getTime() + addDays * 24 * 60 * 60 * 1e3);
19892
- nextSunday.setHours(hour, minute, second, 0);
19893
- return nextSunday;
19894
- }
19895
- static getCurrentUserTimezone() {
19896
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
19897
- }
19898
- static dateTimeAsUTCISO8601String(date) {
19899
- const hh = String(date.getHours()).padStart(2, "0");
19900
- const MM = String(date.getMinutes()).padStart(2, "0");
19901
- const ss = String(date.getSeconds()).padStart(2, "0");
19902
- return _DateUtils.dateAsString(date) + "T" + hh + ":" + MM + ":" + ss + "Z";
19903
- }
19904
- static currentDateTimeAsUTCISO8601String() {
19905
- const now3 = /* @__PURE__ */ new Date();
19906
- return _DateUtils.dateTimeAsUTCISO8601String(now3);
19907
- }
19908
- static currentDateAsISO8601String() {
19909
- const now3 = /* @__PURE__ */ new Date();
19910
- return _DateUtils.dateAsString(now3);
19911
- }
19912
- static toFormattedLocalizedDate(locale, inputInUTCISO8601, timezone) {
19913
- if (inputInUTCISO8601 === void 0 || inputInUTCISO8601 === null) {
19914
- return "";
19915
- }
19916
- return new Intl.DateTimeFormat(locale, {
19917
- year: "numeric",
19918
- month: "2-digit",
19919
- day: "2-digit",
19920
- hour: "2-digit",
19921
- minute: "2-digit",
19922
- second: "2-digit",
19923
- hour12: false,
19924
- timeZone: timezone
19925
- }).format(new Date(inputInUTCISO8601));
19926
- }
19927
- };
19928
- var FieldProperties = class {
19929
- constructor(key, required, maxLength, minValue, maxValue) {
19930
- this.key = key;
19931
- this.required = required;
19932
- this.maxLength = maxLength;
19933
- this.minValue = minValue;
19934
- this.maxValue = maxValue;
19935
- }
19936
- };
19937
- function FixedWidth(props) {
19938
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { minWidth: props.minWidth, maxWidth: props.maxWidth }, children: props.children });
19939
- }
19940
- var ITEM_SEP = ",";
19941
- var LocalStorageService = class {
19942
- static getItemStringArrayWithDefault(key, defaultValue) {
19943
- const result = this.safeGetItem(key);
19944
- if (result === null) {
19945
- return defaultValue;
19946
- }
19947
- return result.split(ITEM_SEP);
19948
- }
19949
- static getItemEnumArrayWithDefault(enumClass, key, defaultValue) {
19950
- const enumConstantsAsStrings = this.getItemStringArrayWithDefault(key, defaultValue.map((s2) => s2.toString()));
19951
- const keys2 = Object.keys(enumClass);
19952
- const values = Object.values(enumClass);
19953
- const dict = {};
19954
- for (let index2 = 0; index2 < keys2.length; index2++) {
19955
- dict[values[index2]] = keys2[index2];
19956
- }
19957
- return enumConstantsAsStrings.map((val) => dict[val]);
19958
- }
19959
- static setItemEnumArray(key, value) {
19960
- this.setItemStringArray(key, value.map((e) => e.toString()));
19961
- }
19962
- static setItemStringArray(key, value) {
19963
- this.safeSetItem(key, value.join(","));
19964
- }
19965
- static getItemWithDefault(key, defaultValue) {
19966
- const result = this.safeGetItem(key);
19967
- if (result === null) {
19968
- return defaultValue;
19969
- }
19970
- return result;
19971
- }
19972
- static setItem(key, value) {
19973
- return this.safeSetItem(key, value);
19974
- }
19975
- static clear() {
19976
- window.localStorage.clear();
19977
- }
19978
- static setObject(key, value) {
19979
- return this.safeSetItem(key, JSON.stringify(value));
19980
- }
19981
- static getObjectWithDefault(key, defaultValue) {
19982
- const result = this.safeGetItem(key);
19983
- if (result === null) {
19984
- return defaultValue;
19985
- }
19986
- return JSON.parse(result);
19987
- }
19988
- static safeGetItem(key) {
19989
- try {
19990
- return localStorage.getItem(key);
19991
- } catch (error) {
19992
- console.log(`WARNING: could not get item with key ${key} from local storage due to exception: ${error}`);
19993
- return null;
19994
- }
19995
- }
19996
- static safeSetItem(key, value) {
19997
- try {
19998
- return localStorage.setItem(key, value);
19999
- } catch (error) {
20000
- console.log(`WARNING: could not set item with key ${key} and value ${value} in local storage due to exception: ${error}`);
20001
- return null;
20002
- }
20003
- }
20004
- };
20005
- var LocalisationNamespace = class {
20006
- constructor(name) {
20007
- this.name = name;
20008
- }
20009
- /**
20010
- *
20011
- * @param parts The parts. Call this with comma-separated args, e.g. createKey(arg1, arg2, arg3) or with array using following syntax:
20012
- * createKey(...[arg1, arg2, arg3]). DO NOT call it directly with an array!
20013
- * This is WRONG: createKey([arg1, arg2, arg3]). It will treat the array as single arg and call toString() on it.
20014
- */
20015
- createKey(...parts) {
20016
- return this.name + "." + parts.join(".");
20017
- }
20018
- };
20019
- var NSK_CONTENT = "content";
20020
- var Localiser = class {
20021
- constructor(translate, ns) {
20022
- this.translate = translate;
20023
- this.ns = ns;
20024
- }
20025
- getEnumLabel(factory, instance) {
20026
- return this.getEnumLocalisation(factory, instance).label;
20027
- }
20028
- getAllEnumLabels(factory) {
20029
- return factory.values.map((instance) => this.getEnumLabel(factory, instance));
20030
- }
20031
- };
20032
- var MessageSeverity = /* @__PURE__ */ ((MessageSeverity2) => {
20033
- MessageSeverity2["INFO"] = "INFO";
20034
- MessageSeverity2["WARN"] = "WARN";
20035
- MessageSeverity2["ERR"] = "ERR";
20036
- MessageSeverity2["SUCCESS"] = "SUCCESS";
20037
- return MessageSeverity2;
20038
- })(MessageSeverity || {});
20039
- var MESSAGE_SEVERITY_FACTORY = new EnumFactory("MessageSeverity", Object.values(MessageSeverity));
20040
- var MessageCTO = class {
20041
- };
20042
- MessageCTO.TIMESTAMP_PROPS = new FieldProperties("timestamp", true);
20043
- MessageCTO.DETAIL_MESSAGE_PROPS = new FieldProperties("detailMessage", true);
20044
- MessageCTO.CORRELATION_ID_PROPS = new FieldProperties("correlationId", true);
20045
- MessageCTO.OPERATION_PROPS = new FieldProperties("operation", true);
20046
- var MessageCodeTO = class {
20047
- };
20048
- MessageCodeTO.CONTROLLER_ID_PROPS = new FieldProperties("componentId", true);
20049
- MessageCodeTO.HTTP_STATUS_CODE_PROPS = new FieldProperties("httpStatusCode", true);
20050
- MessageCodeTO.LOCAL_CODE_PROPS = new FieldProperties("localCode", true);
20051
- MessageCodeTO.MESSAGE_SEVERITY_PROPS = new FieldProperties("messageSeverity", true);
20052
- MessageCodeTO.UNIQUE_CODE_PROPS = new FieldProperties("uniqueCode", true);
20053
- var TECHNICAL_CONTROLLER_ID = "T";
20054
- var NO_HTTP_CODE = 0;
20055
- var _MessageService = class _MessageService2 {
20056
- static getResponseTOWithMessagesFromUnknownResponse(json, op, status) {
20057
- const response = json !== void 0 && json !== null && json.hasOwnProperty("messages") ? json : _MessageService2.createGenericErrorMessageTO(status, op);
20058
- response.messages.forEach((m2) => m2.operation = op);
20059
- return response;
20060
- }
20061
- static getSuccessContentWithMessagesCTO(json, op) {
20062
- let result = { content: void 0, messages: [] };
20063
- if (json.hasOwnProperty("content")) {
20064
- result.content = json.content;
20065
- }
20066
- if (json.hasOwnProperty("messages")) {
20067
- result.messages = json.messages;
20068
- }
20069
- result.messages.forEach((m2) => m2.operation = op);
20070
- return result;
20071
- }
20072
- static createContentWithMessage(message) {
20073
- return {
20074
- messages: [message],
20075
- content: void 0
20076
- };
20077
- }
20078
- };
20079
- _MessageService.createContentWithSuccessMessage = (operation, message) => {
20080
- return _MessageService.createContentWithMessage(_MessageService.createMessageTO(
20081
- TECHNICAL_CONTROLLER_ID,
20082
- NO_HTTP_CODE.toString(),
20083
- 0,
20084
- message,
20085
- operation,
20086
- "SUCCESS"
20087
- /* SUCCESS */
20088
- ));
20089
- };
20090
- _MessageService.createContentWithoutMessages = (content) => {
20091
- return {
20092
- messages: [],
20093
- content
20094
- };
20095
- };
20096
- _MessageService.createContentWithInfoMessage = (operation, message) => {
20097
- return _MessageService.createContentWithMessage(_MessageService.createMessageTO(
20098
- TECHNICAL_CONTROLLER_ID,
20099
- NO_HTTP_CODE.toString(),
20100
- 0,
20101
- message,
20102
- operation,
20103
- "INFO"
20104
- /* INFO */
20105
- ));
20106
- };
20107
- _MessageService.createGenericErrorMessageTO = (httpStatusCode, operation) => {
20108
- if (_MessageService.isAPIClientCallError(httpStatusCode)) {
20109
- return _MessageService.createContentWithMessage(_MessageService.createMessageTO(TECHNICAL_CONTROLLER_ID, "998", httpStatusCode, "Generic API call client error", operation));
20110
- } else if (_MessageService.isBackendError(httpStatusCode)) {
20111
- return _MessageService.createContentWithMessage(_MessageService.createMessageTO(TECHNICAL_CONTROLLER_ID, "999", httpStatusCode, "Generic backend error", operation));
20112
- } else {
20113
- throw new Error("Calling this methods with any http status code outside 400-599 is not allowed.");
20114
- }
20115
- };
20116
- _MessageService.createCriticalErrorFrontendProcessingMessageTO = (operation, message) => {
20117
- return _MessageService.createMessageTO(TECHNICAL_CONTROLLER_ID, "997", -1, message, operation);
20118
- };
20119
- _MessageService.isAPIClientCallError = (httpStatusCode) => {
20120
- return httpStatusCode >= 400 && httpStatusCode <= 499;
20121
- };
20122
- _MessageService.isBackendError = (httpStatusCode) => {
20123
- return httpStatusCode >= 500 && httpStatusCode <= 599;
20124
- };
20125
- _MessageService.createMessageTO = (componentId, localCode, httpStatusCode, detailMessage, operation, severity) => {
20126
- const message = new MessageCTO();
20127
- message.code = new MessageCodeTO();
20128
- message.code.httpStatusCode = httpStatusCode;
20129
- message.code.componentId = componentId;
20130
- message.code.localCode = localCode;
20131
- message.code.uniqueCode = componentId + localCode;
20132
- message.code.messageSeverity = severity ? severity : "ERR";
20133
- message.operation = operation;
20134
- message.correlationId = "N/A";
20135
- message.timestamp = DateUtils.currentDateTimeAsUTCISO8601String();
20136
- message.detailMessage = detailMessage;
20137
- return message;
20138
- };
20139
- var MessageService = _MessageService;
20140
- var QUERY_START = "?";
20141
- var QUERY_SEP = "&";
20142
- var QueryParamHelper = class {
20143
- static appendQueryParam(query, key, value) {
20144
- let result = query;
20145
- if (!query.includes(QUERY_START)) {
20146
- result = result + QUERY_START;
20147
- }
20148
- if (result[result.length - 1] !== QUERY_START) {
20149
- result = result + QUERY_SEP;
20150
- }
20151
- return result + encodeURIComponent(key) + "=" + encodeURIComponent(value);
20152
- }
20153
- static getQueryParams(queryString) {
20154
- const returnedParams = {};
20155
- if (queryString === void 0 || queryString.length === 0 || !queryString.startsWith(QUERY_START)) {
20156
- return returnedParams;
20157
- }
20158
- queryString = queryString.substring(1);
20159
- const params = queryString.split(QUERY_SEP);
20160
- if (params.length === 0 || params.length === 1 && params[0] === "") {
20161
- return returnedParams;
20162
- }
20163
- params.forEach((param) => {
20164
- const paramRegex = /^(?<key>.*?)=(?<value>.*?)$/;
20165
- const matchArray = param.match(paramRegex);
20166
- if (matchArray !== null && matchArray.groups) {
20167
- const key = decodeURIComponent(matchArray.groups["key"]);
20168
- returnedParams[key] = decodeURIComponent(matchArray.groups["value"]);
20169
- }
20170
- });
20171
- return returnedParams;
20172
- }
20173
- };
20174
- var REST_CLIENT_LOGGER = new Log("RestClient");
20175
- function logStart(logMsg, url) {
20176
- REST_CLIENT_LOGGER.debug("START " + logMsg + " using URL <" + url + "> ...");
20177
- }
20178
- function logDone(logMsg, url) {
20179
- REST_CLIENT_LOGGER.debug("DONE " + logMsg + " using URL <" + url + "> .");
20180
- }
20181
- function logError(logMsg, url) {
20182
- REST_CLIENT_LOGGER.debug("ERROR: ", logMsg, ", using URL <" + url + "> .");
20183
- }
20184
- function createRestClient() {
20185
- return new RestClient("");
20186
- }
20187
- var RestClient = class {
20188
- /**
20189
- * Creates a new REST client.
20190
- * @param baseUrl base URL, so client can be called with relative URLs.
20191
- */
20192
- constructor(baseUrl) {
20193
- this.baseUrl = "";
20194
- if (baseUrl != null) {
20195
- this.baseUrl = baseUrl;
20196
- }
20197
- }
20198
- prepareFetchConfig(method, payload, header = {}) {
20199
- let headers = {
20200
- Accept: "application/json",
20201
- "Content-Type": "application/json",
20202
- ...header
20203
- };
20204
- let config2;
20205
- if (payload) {
20206
- config2 = {
20207
- method,
20208
- headers,
20209
- body: JSON.stringify(payload)
20210
- };
20211
- } else {
20212
- config2 = {
20213
- method,
20214
- headers
20215
- };
20216
- }
20217
- return config2;
20218
- }
20219
- /**
20220
- * Make a GET request on the specified endpoint
20221
- *
20222
- * @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
20223
- * @param {string} operation the operation name for logging.
20224
- * @param {string} headers the HTTP headers to pass.
20225
- */
20226
- get(endpoint, operation, headers) {
20227
- return this.callApi("get", endpoint, null, operation, headers);
20228
- }
20229
- /**
20230
- * Make a PUT request on the specified endpoint
20231
- *
20232
- * @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
20233
- * @param {object} payload the request payload as object.
20234
- * @param {string} operation the operation name for logging.
20235
- */
20236
- put(endpoint, payload, operation) {
20237
- return this.callApi("put", endpoint, payload, operation);
20238
- }
20239
- /**
20240
- * Make a POST request on the specified endpoint
20241
- *
20242
- * @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
20243
- * @param {object} payload the request payload as object.
20244
- * @param {string} operation the operation name for logging.
20245
- */
20246
- post(endpoint, payload, operation) {
20247
- return this.callApi("post", endpoint, payload, operation);
20248
- }
20249
- /**
20250
- * Make a DELETE request on the specified endpoint
20251
- *
20252
- * @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
20253
- * @param {object} payload the request payload as object.
20254
- * @param {string} operation the operation name for logging.
20255
- */
20256
- del(endpoint, payload, operation) {
20257
- return this.callApi("delete", endpoint, payload, operation);
20258
- }
20259
- callApi(method, endpoint = "", payload = null, operation, header) {
20260
- const url = `${this.baseUrl}${endpoint}`;
20261
- const config2 = this.prepareFetchConfig(method, payload, header);
20262
- const op = operation ? operation : "Unknown operation";
20263
- logStart(op, url);
20264
- REST_CLIENT_LOGGER.debug("Calling API - " + method + "," + url);
20265
- REST_CLIENT_LOGGER.object("Payload", payload);
20266
- return new Promise((resolve4, reject) => {
20267
- fetch(url, config2).then((response) => {
20268
- const contentType = response.headers.get("content-type");
20269
- if (contentType && contentType.indexOf("application/json") !== -1) {
20270
- return response.json().then((json) => ({
20271
- status: response.status,
20272
- json
20273
- }));
20274
- } else {
20275
- return response.text().then(() => ({
20276
- status: response.status,
20277
- json: {}
20278
- }));
20279
- }
20280
- }).then((result) => {
20281
- const { status, json } = result;
20282
- if (status >= 400) {
20283
- logError(op, url);
20284
- REST_CLIENT_LOGGER.error("Api call failed with response code " + status + ", response body=" + Log.toReadableObjectString(json));
20285
- const responseWithMessages = MessageService.getResponseTOWithMessagesFromUnknownResponse(json, op, status);
20286
- return reject(responseWithMessages);
20287
- } else {
20288
- logDone(op, url);
20289
- REST_CLIENT_LOGGER.debug("Api call successful " + status + ", response body=" + Log.toReadableObjectString(json));
20290
- if (json === null || json === void 0) {
20291
- const msg = "Invalid response body - must never be null or undefined";
20292
- REST_CLIENT_LOGGER.error(msg);
20293
- const responseWithMessages2 = {
20294
- content: void 0,
20295
- messages: [MessageService.createCriticalErrorFrontendProcessingMessageTO(op, msg)]
20296
- };
20297
- return reject(responseWithMessages2);
20298
- }
20299
- const responseWithMessages = MessageService.getSuccessContentWithMessagesCTO(json, op);
20300
- return resolve4(responseWithMessages);
20301
- }
20302
- }).catch((error) => {
20303
- const msg = "Api call failed with unknown/network error during promise processing " + error;
20304
- REST_CLIENT_LOGGER.error(msg);
20305
- const responseWithMessages = {
20306
- content: void 0,
20307
- messages: [MessageService.createCriticalErrorFrontendProcessingMessageTO(op, msg)]
20308
- };
20309
- return reject(responseWithMessages);
20310
- });
20311
- });
20312
- }
20313
- };
20314
- var RunFunctionResult = class {
20315
- constructor(success, messages, result, resultHistory) {
20316
- this.success = success;
20317
- this.messages = messages;
20318
- this.result = result;
20319
- this.resultHistory = resultHistory;
20320
- }
20321
- };
20322
- var fatalRunErrorFunction = (reason) => {
20323
- throw new Error(`Fatal error - could not handle run failure - reason: ${reason}`);
20324
- };
20325
- function useControllerDisplayState(initialDisplayMode, messages, logger) {
20326
- const [state, setState2] = (0, import_react2.useState)(
20327
- 0
20328
- /* UNMOUNTED */
20329
- );
20330
- const [loadingIndication, setLoadingIndication] = (0, import_react2.useState)({});
20331
- const [modified, setModified] = (0, import_react2.useState)(false);
20332
- const [displayMode, setDisplayMode] = (0, import_react2.useState)(initialDisplayMode);
20333
- const [modalState, setModalState] = (0, import_react2.useState)({
20334
- show: (modalId, confirmFunction) => showModal(modalId, true, confirmFunction),
20335
- hide: (modalId) => showModal(modalId, false)
20336
- });
20337
- const { addMessages } = messages;
20338
- const isLoading = (0, import_react2.useCallback)((service) => {
20339
- return loadingIndication.hasOwnProperty(service.name) && loadingIndication[service.name] === true;
20340
- }, [loadingIndication]);
20341
- const load = (0, import_react2.useCallback)((service) => {
20342
- setLoadingIndication((oldIndication) => ({ ...oldIndication, [service.name]: true }));
20343
- }, []);
20344
- const doneLoading = (0, import_react2.useCallback)((service) => {
20345
- setLoadingIndication((oldIndication) => {
20346
- return { ...oldIndication, [service.name]: false };
20347
- });
20348
- }, []);
20349
- const enterDisplayMode = (0, import_react2.useCallback)((mode) => {
20350
- setDisplayMode((previousMode) => {
20351
- if (mode !== displayMode) {
20352
- logger.info("Entering display mode: ", mode);
20353
- return mode;
20354
- }
20355
- return previousMode;
20356
- });
20357
- }, [displayMode, logger]);
20358
- const showModal = (0, import_react2.useCallback)((modalId, show, confirmFunction) => {
20359
- if (show) {
20360
- setModalState((originalModalState) => {
20361
- if (originalModalState.modalId !== void 0) {
20362
- throw Error("Cannot show multiple modals at the same time");
20363
- }
20364
- return { ...originalModalState, modalId, confirmFunction };
20365
- });
20366
- } else {
20367
- setModalState((originalModalState) => {
20368
- if (originalModalState.modalId === void 0 || originalModalState.modalId !== modalId) {
20369
- throw Error("Cannot hide modal that isn't currently shown");
20370
- }
20371
- return { ...originalModalState, modalId: void 0, confirmFunction: void 0 };
20372
- });
20373
- }
20374
- }, []);
20375
- const run = (0, import_react2.useCallback)(function(service, execute, failureIsFatal, resultHistory) {
20376
- load(service);
20377
- return execute().then((result) => {
20378
- addMessages(result);
20379
- return Promise.resolve(new RunFunctionResult(
20380
- true,
20381
- result.messages,
20382
- result.content,
20383
- resultHistory
20384
- ));
20385
- }).catch((error) => {
20386
- if (failureIsFatal) {
20387
- setState2(
20388
- 3
20389
- /* FATAL_ERROR */
20390
- );
20391
- }
20392
- addMessages(error);
20393
- return Promise.resolve(new RunFunctionResult(false, error.messages, void 0, resultHistory));
20394
- }).finally(() => doneLoading(service));
20395
- }, [addMessages, doneLoading, load]);
20396
- return {
20397
- state,
20398
- setState: setState2,
20399
- setDirty: (0, import_react2.useCallback)(setModified, [setModified]),
20400
- isDirty: () => modified,
20401
- isLoading,
20402
- displayMode,
20403
- enterDisplayMode,
20404
- modalState,
20405
- run
20406
- };
20407
- }
20408
- var indexRangeArray = (length) => {
20409
- return Array.from({ length }, (x, i) => i);
20410
- };
20411
- function filterArrayByIndices(items, indices) {
20412
- return items.filter((value, index2) => indices.includes(index2));
20413
- }
20414
- function sortArrayByIndices(items, indices) {
20415
- return items.filter((value, index2) => indices.includes(index2)).sort((left, right) => indices.indexOf(items.indexOf(left)) - indices.indexOf(items.indexOf(right)));
20416
- }
20417
- var sleep = (delaySeconds) => new Promise((resolve4) => setTimeout(resolve4, delaySeconds));
20418
- function isContentWithMessages(object2) {
20419
- return object2.hasOwnProperty("messages");
20420
- }
20421
- var ArrayStateHandler = class {
20422
- static updateFieldsOfArrayElement(elementToUpdate, currentArrayContent, properties, onChangedArrayElement) {
20423
- const newArrayValue = [...currentArrayContent];
20424
- const affectedElementIndex = newArrayValue.indexOf(elementToUpdate);
20425
- newArrayValue[affectedElementIndex] = { ...elementToUpdate, ...properties };
20426
- if (onChangedArrayElement) {
20427
- onChangedArrayElement([newArrayValue[affectedElementIndex]], newArrayValue);
20428
- }
20429
- return newArrayValue;
20430
- }
20431
- static removeArrayElements(elementsToRemove, currentArrayContent, onRemovedArrayElement) {
20432
- const newArrayValue = [...currentArrayContent.filter((element) => elementsToRemove.indexOf(element) === -1)];
20433
- if (onRemovedArrayElement) {
20434
- onRemovedArrayElement(elementsToRemove, newArrayValue);
20435
- }
20436
- return newArrayValue;
20437
- }
20438
- static addArrayElements(elementsToAdd, currentArrayContent, onAddedArrayElements) {
20439
- const newArrayValue = [...currentArrayContent, ...elementsToAdd];
20440
- if (onAddedArrayElements) {
20441
- onAddedArrayElements(elementsToAdd, newArrayValue);
20442
- }
20443
- return newArrayValue;
20444
- }
20445
- };
20446
- function useTOChangeHandler(logger, toName, setTOState, notifications, setDirty) {
20447
- const onPropertyChangeMulti = (0, import_react3.useCallback)((properties, automaticChange) => {
20448
- logger.debug(`Changing state of the ${toName} Elements ${Object.keys(properties)} for affected element, using change object:`, JSON.stringify(properties));
20449
- setTOState((previousValue) => {
20450
- const newValue = { ...previousValue, ...properties };
20451
- if (notifications && notifications.onChange) {
20452
- for (const propertyName of Object.keys(properties)) {
20453
- const changedValue = properties[propertyName];
20454
- notifications.onChange(newValue, propertyName, changedValue);
20455
- }
20456
- }
20457
- if (previousValue !== void 0 && setDirty !== void 0 && !automaticChange) {
20458
- setDirty(true);
20459
- }
20460
- return newValue;
20461
- });
20462
- }, [logger, notifications, setDirty, setTOState, toName]);
20463
- const onPropertyChange = (0, import_react3.useCallback)((propertyName, changedValue, automaticChange) => {
20464
- onPropertyChangeMulti({ [propertyName]: changedValue }, automaticChange);
20465
- }, [onPropertyChangeMulti]);
20466
- return { onPropertyChange, onPropertyChangeMulti };
20467
- }
20468
- var singleChangeHandlerToMulti = (onPropertyChangeMulti) => {
20469
- return (propertyName, changedValue) => onPropertyChangeMulti({ [propertyName]: changedValue });
20470
- };
20471
- function useTOArrayChangeHandler(logger, toName, setArrayState, handlers, setDirty) {
20472
- const onChangeElement = (0, import_react3.useCallback)((element, properties) => {
20473
- if (element !== void 0) {
20474
- logger.debug(`Changing state of the ${toName} Elements ${Object.keys(properties)} for affected element, using change object:`, JSON.stringify(properties));
20475
- setArrayState((previousValue) => ArrayStateHandler.updateFieldsOfArrayElement(
20476
- element,
20477
- previousValue,
20478
- properties,
20479
- handlers.onChange
20480
- ));
20481
- if (setDirty !== void 0) {
20482
- setDirty(true);
20483
- }
20484
- }
20485
- }, [logger, toName, setArrayState, setDirty, handlers.onChange]);
20486
- const onRemoveElements = (0, import_react3.useCallback)((removedElements) => {
20487
- if (removedElements.length > 0) {
20488
- logger.debug(`Removing ${removedElements.length} elements from array`);
20489
- setArrayState((previousValue) => ArrayStateHandler.removeArrayElements(
20490
- removedElements,
20491
- previousValue,
20492
- handlers.onRemove
20493
- ));
20494
- if (setDirty !== void 0) {
20495
- setDirty(true);
20496
- }
20497
- }
20498
- }, [logger, setArrayState, setDirty, handlers.onRemove]);
20499
- const onAddElements = (0, import_react3.useCallback)((newElements) => {
20500
- if (newElements.length === 0) {
20501
- logger.debug(`Adding no new elements to array`);
20502
- } else {
20503
- logger.debug(`Adding ${newElements.length} elements to array`);
20504
- setArrayState((previousValue) => ArrayStateHandler.addArrayElements(
20505
- newElements,
20506
- previousValue,
20507
- handlers.onAdd
20508
- ));
20509
- if (setDirty !== void 0) {
20510
- setDirty(true);
20511
- }
20512
- }
20513
- }, [logger, setArrayState, setDirty, handlers.onAdd]);
20514
- return { onChangeElement, onRemoveElements, onAddElements };
20515
- }
20516
- function useAWSUIRef() {
20517
- const customRef = (0, import_react4.useRef)(null);
20518
- const isValidRef = () => {
20519
- return customRef !== void 0 && customRef !== null && customRef.current !== void 0 && customRef.current !== null;
20520
- };
20521
- const focus = (0, import_react4.useCallback)(() => {
20522
- if (isValidRef() && customRef.current.focus) {
20523
- customRef.current.focus();
20524
- }
20525
- }, [customRef]);
20526
- const scrollToView = (0, import_react4.useCallback)(() => {
20527
- if (isValidRef() && customRef.current.scrollIntoView) {
20528
- customRef.current.scrollIntoView(true);
20529
- }
20530
- }, [customRef]);
20531
- const scrollToViewRef = (0, import_react4.useCallback)((element) => {
20532
- if (element !== void 0 && element !== null && element.scrollIntoView) {
20533
- element.scrollIntoView({ block: "nearest", behavior: "smooth" });
20534
- }
20535
- }, []);
20536
- return {
20537
- customRef,
20538
- focus,
20539
- scrollToView,
20540
- scrollToViewRef
20541
- };
20542
- }
20543
- var useHotkey = (key, shift, ctrl, alt, callback, node = null) => {
20544
- const callbackRef = (0, import_react5.useRef)(callback);
20545
- (0, import_react5.useLayoutEffect)(() => {
20546
- callbackRef.current = callback;
20547
- });
20548
- const handleKeyPress = (0, import_react5.useCallback)(
20549
- (event) => {
20550
- if (event.key === key && (!shift || event.shiftKey) && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
20551
- callbackRef.current(event);
20552
- }
20553
- },
20554
- [alt, ctrl, key, shift]
20555
- );
20556
- (0, import_react5.useEffect)(() => {
20557
- const targetNode = node != null ? node : document;
20558
- targetNode && targetNode.addEventListener("keydown", handleKeyPress);
20559
- return () => targetNode && targetNode.removeEventListener("keydown", handleKeyPress);
20560
- }, [handleKeyPress, node]);
20561
- };
20562
- function useMessages(LOGGER32) {
20563
- const [messages, setMessages] = (0, import_react6.useState)([]);
20564
- const onDismissMessage = (0, import_react6.useCallback)((message) => {
20565
- const newMessages = messages.filter((existingMsg) => message !== existingMsg);
20566
- setMessages(newMessages);
20567
- }, [messages]);
20568
- const onToggleMessageDetail = (0, import_react6.useCallback)((message) => {
20569
- const idx = messages.indexOf(message);
20570
- const newMessages = [...messages];
20571
- newMessages[idx].showDetails = !newMessages[idx].showDetails;
20572
- setMessages(newMessages);
20573
- }, [messages]);
20574
- const addMessages = (0, import_react6.useCallback)((newMessages) => {
20575
- if (!newMessages.hasOwnProperty("messages")) {
20576
- LOGGER32.error("Given response data structure does not contain messages - probably another runtime error occurred: ", newMessages);
20577
- if (newMessages.hasOwnProperty("stack")) {
20578
- LOGGER32.error("Stack trace: ", newMessages.stack);
20579
- }
20580
- } else {
20581
- const addedMessages = newMessages.messages.map((msg) => {
20582
- return { ...msg, showDetails: false };
20583
- });
20584
- addedMessages.forEach((msg) => LOGGER32.info(`New message = <${msg.detailMessage}`));
20585
- setMessages((oldMessages) => [...oldMessages, ...addedMessages]);
20586
- }
20587
- }, [LOGGER32]);
20588
- const clearMessages = (0, import_react6.useCallback)(() => {
20589
- setMessages([]);
20590
- }, []);
20591
- return {
20592
- messages,
20593
- addMessages,
20594
- onDismissMessage,
20595
- onToggleMessageDetail,
20596
- clearMessages
20597
- };
20598
- }
20599
-
20600
18650
  // src/components/AbstractComponentTesting.ts
18651
+ var import_cswrapper = require("@ebertjendustries/cswrapper");
20601
18652
  var AbstractComponentTesting = class _AbstractComponentTesting {
20602
18653
  constructor(elementSpec, view, findFunction) {
20603
18654
  this.elementSpec = elementSpec;
@@ -20651,7 +18702,7 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
20651
18702
  }
20652
18703
  }
20653
18704
  awaitElement() {
20654
- return import_react7.screen.findByTestId(this.elementSpec.getDataTestId());
18705
+ return import_react.screen.findByTestId(this.elementSpec.getDataTestId());
20655
18706
  }
20656
18707
  async awaitPresent() {
20657
18708
  globalExpect(await this.awaitElement()).toBeInTheDocument();
@@ -20669,7 +18720,7 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
20669
18720
  _AbstractComponentTesting.expectDisabled(this.getElement(), this.msgForExpect());
20670
18721
  }
20671
18722
  click() {
20672
- (0, import_react8.act)(() => {
18723
+ (0, import_react2.act)(() => {
20673
18724
  const element = this.assertElement(this.elementSpec.getDataTestId(), (dataTestId) => _AbstractComponentTesting.doFindElement(dataTestId, this.findFunction));
20674
18725
  element.click();
20675
18726
  });
@@ -20691,10 +18742,10 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
20691
18742
  globalExpect(this.getElement(), this.msgForExpect()).toHaveTextContent(text);
20692
18743
  }
20693
18744
  async awaitNotPresent() {
20694
- await (0, import_react7.waitForElementToBeRemoved)(() => this.queryElement());
18745
+ await (0, import_react.waitForElementToBeRemoved)(() => this.queryElement());
20695
18746
  }
20696
18747
  getFormFieldWrapper() {
20697
- return _AbstractComponentTesting.doFindElement(this.elementSpec.getDataTestId() + FORM_FIELD_ID_SUFFIX, (dataTestId) => (0, import_dom.default)().findFormField(dataTestId));
18748
+ return _AbstractComponentTesting.doFindElement(this.elementSpec.getDataTestId() + import_cswrapper.FORM_FIELD_ID_SUFFIX, (dataTestId) => (0, import_dom.default)().findFormField(dataTestId));
20698
18749
  }
20699
18750
  assertElement(dataTestId, getterFunction) {
20700
18751
  const element = getterFunction(dataTestId);
@@ -20717,7 +18768,9 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
20717
18768
  };
20718
18769
 
20719
18770
  // src/components/AbstractInputTesting.ts
20720
- var import_react9 = require("@testing-library/react");
18771
+ var import_react3 = require("@testing-library/react");
18772
+ var import_cswrapper2 = require("@ebertjendustries/cswrapper");
18773
+ var import_cswrapper3 = require("@ebertjendustries/cswrapper");
20721
18774
  var AbstractInputTesting = class extends AbstractComponentTesting {
20722
18775
  clear() {
20723
18776
  this.setStringValue("");
@@ -20727,12 +18780,12 @@ var AbstractInputTesting = class extends AbstractComponentTesting {
20727
18780
  this.setStringValue(inputValue);
20728
18781
  const localiser = this.view.getLocaliser();
20729
18782
  const fieldValidityFunction = localiser.getFieldValidityLocalisationFunction();
20730
- await this.expectErrorMessage(fieldValidityFunction(this.elementSpec, ElementValidityLevel.MAX_LENGTH_EXCEEDED));
18783
+ await this.expectErrorMessage(fieldValidityFunction(this.elementSpec, import_cswrapper2.ElementValidityLevel.MAX_LENGTH_EXCEEDED));
20731
18784
  }
20732
18785
  async awaitMandatoryMissing() {
20733
18786
  const localiser = this.view.getLocaliser();
20734
18787
  const fieldValidityFunction = localiser.getFieldValidityLocalisationFunction();
20735
- await this.expectErrorMessage(fieldValidityFunction(new FieldSpec("", true), ElementValidityLevel.REQUIRED_VALUE_IS_NOT_PRESENT));
18788
+ await this.expectErrorMessage(fieldValidityFunction(new import_cswrapper3.FieldSpec("", true), import_cswrapper2.ElementValidityLevel.REQUIRED_VALUE_IS_NOT_PRESENT));
20736
18789
  }
20737
18790
  expectEmpty() {
20738
18791
  globalExpect(this.getNativeHTMLInput()).toHaveValue(null);
@@ -20748,14 +18801,14 @@ var AbstractInputTesting = class extends AbstractComponentTesting {
20748
18801
  globalExpect(this.getNativeHTMLInput()).toBeDisabled();
20749
18802
  }
20750
18803
  async expectErrorMessage(message) {
20751
- await (0, import_react9.waitFor)(() => globalExpect(this.getFormFieldWrapper().findError()).not.toBeNull());
18804
+ await (0, import_react3.waitFor)(() => globalExpect(this.getFormFieldWrapper().findError()).not.toBeNull());
20752
18805
  globalExpect(this.getFormFieldWrapper().findError().getElement()).toHaveTextContent(message);
20753
18806
  }
20754
18807
  };
20755
18808
 
20756
18809
  // src/components/AbstractSelectTesting.ts
20757
- var import_react10 = require("@testing-library/react");
20758
- var import_react11 = require("react");
18810
+ var import_react4 = require("@testing-library/react");
18811
+ var import_react5 = require("react");
20759
18812
  var AbstractSelectTesting = class extends AbstractComponentTesting {
20760
18813
  constructor(fieldSpec, view, findFunction, expandToViewport) {
20761
18814
  super(fieldSpec, view, findFunction);
@@ -20823,7 +18876,7 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
20823
18876
  const selectWrapper = await this.openDropdown();
20824
18877
  for (let index2 = 0; index2 < sortedIndices.length; index2++) {
20825
18878
  const clickedIndex = sortedIndices[index2];
20826
- (0, import_react11.act)(() => selectWrapper.selectOption(clickedIndex + 1, this.getOptions()));
18879
+ (0, import_react5.act)(() => selectWrapper.selectOption(clickedIndex + 1, this.getOptions()));
20827
18880
  }
20828
18881
  await this.closeDropdown(selectWrapper);
20829
18882
  }
@@ -20852,14 +18905,14 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
20852
18905
  }
20853
18906
  async openDropdown() {
20854
18907
  const selectWrapper = this.getElementWrapper();
20855
- (0, import_react11.act)(() => selectWrapper.openDropdown());
20856
- await (0, import_react10.waitFor)(() => globalExpect(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect()).toBeGreaterThan(0));
18908
+ (0, import_react5.act)(() => selectWrapper.openDropdown());
18909
+ await (0, import_react4.waitFor)(() => globalExpect(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect()).toBeGreaterThan(0));
20857
18910
  return selectWrapper;
20858
18911
  }
20859
18912
  async closeDropdown(selectWrapper) {
20860
- (0, import_react11.act)(() => selectWrapper.closeDropdown(this.getOptions()));
18913
+ (0, import_react5.act)(() => selectWrapper.closeDropdown(this.getOptions()));
20861
18914
  if (!this.expandToViewport) {
20862
- await (0, import_react10.waitFor)(() => globalExpect(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect()).toBe(0));
18915
+ await (0, import_react4.waitFor)(() => globalExpect(this.getDropdown(selectWrapper).findOptions().length, this.msgForExpect()).toBe(0));
20863
18916
  }
20864
18917
  }
20865
18918
  async awaitHasSelectedEntryCount(selectedEntryCount, totalEntryCount) {
@@ -20885,6 +18938,9 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
20885
18938
  }
20886
18939
  };
20887
18940
 
18941
+ // src/views/AbstractViewTesting.tsx
18942
+ var import_cswrapper6 = require("@ebertjendustries/cswrapper");
18943
+
20888
18944
  // src/components/MultiselectTesting.ts
20889
18945
  var import_dom2 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
20890
18946
  var MultiselectTesting = class extends AbstractSelectTesting {
@@ -20911,14 +18967,15 @@ var SelectTesting = class extends AbstractSelectTesting {
20911
18967
 
20912
18968
  // src/components/InputTesting.ts
20913
18969
  var import_dom4 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
20914
- var import_react12 = require("react");
18970
+ var import_react6 = require("react");
18971
+ var import_cswrapper4 = require("@ebertjendustries/cswrapper");
20915
18972
  var StringInputTesting = class extends AbstractInputTesting {
20916
18973
  constructor(fieldSpec, view) {
20917
18974
  super(fieldSpec, view, (selector) => (0, import_dom4.default)().findInput(selector));
20918
18975
  this.view = view;
20919
18976
  }
20920
18977
  setStringValue(value) {
20921
- (0, import_react12.act)(() => {
18978
+ (0, import_react6.act)(() => {
20922
18979
  this.getElementWrapper().setInputValue(value === void 0 ? "" : value);
20923
18980
  });
20924
18981
  }
@@ -20935,7 +18992,7 @@ var NumberInputTesting = class extends AbstractInputTesting {
20935
18992
  this.view = view;
20936
18993
  }
20937
18994
  setStringValue(value) {
20938
- (0, import_react12.act)(() => {
18995
+ (0, import_react6.act)(() => {
20939
18996
  if (typeof value === "number") {
20940
18997
  this.getElementWrapper().setInputValue(value.toString());
20941
18998
  } else {
@@ -20948,7 +19005,7 @@ var NumberInputTesting = class extends AbstractInputTesting {
20948
19005
  this.setStringValue(inputValue.toString());
20949
19006
  const localiser = this.view.getLocaliser();
20950
19007
  const fieldValidityFunction = localiser.getFieldValidityLocalisationFunction();
20951
- await this.expectErrorMessage(fieldValidityFunction(this.elementSpec, ElementValidityLevel.LOWER_BOUND_ONLY_TOO_SMALL));
19008
+ await this.expectErrorMessage(fieldValidityFunction(this.elementSpec, import_cswrapper4.ElementValidityLevel.LOWER_BOUND_ONLY_TOO_SMALL));
20952
19009
  }
20953
19010
  expectValue(value) {
20954
19011
  globalExpect(this.getNativeHTMLInput()).toHaveValue(value === void 0 ? null : value);
@@ -20963,7 +19020,7 @@ var DatePickerTesting = class extends AbstractInputTesting {
20963
19020
  this.view = view;
20964
19021
  }
20965
19022
  setStringValue(value) {
20966
- (0, import_react12.act)(() => {
19023
+ (0, import_react6.act)(() => {
20967
19024
  this.getElementWrapper().setInputValue(value === void 0 ? "" : value.replaceAll("-", "/"));
20968
19025
  });
20969
19026
  }
@@ -20981,8 +19038,8 @@ var DatePickerTesting = class extends AbstractInputTesting {
20981
19038
 
20982
19039
  // src/components/TableTesting.ts
20983
19040
  var import_dom5 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
20984
- var import_react13 = require("@testing-library/react");
20985
- var import_react14 = require("react");
19041
+ var import_react7 = require("@testing-library/react");
19042
+ var import_react8 = require("react");
20986
19043
  var TableTesting = class extends AbstractComponentTesting {
20987
19044
  constructor(fieldSpec, view) {
20988
19045
  super(fieldSpec, view, (selector) => (0, import_dom5.default)().findTable(selector));
@@ -20996,7 +19053,7 @@ var TableTesting = class extends AbstractComponentTesting {
20996
19053
  return this.getElementWrapper().findRows().length;
20997
19054
  }
20998
19055
  selectAllItems() {
20999
- (0, import_react14.act)(() => this.getElementWrapper().findSelectAllTrigger().click());
19056
+ (0, import_react8.act)(() => this.getElementWrapper().findSelectAllTrigger().click());
21000
19057
  }
21001
19058
  expectSelectedItems(selectedRowIndices) {
21002
19059
  const allItems = this.getElementWrapper().findRows();
@@ -21022,7 +19079,7 @@ var TableTesting = class extends AbstractComponentTesting {
21022
19079
  for (let i = 0; i < clickedRowIndices.length; i++) {
21023
19080
  const clickedIndex = clickedRowIndices[i];
21024
19081
  const selectionArea = this.assertElement((clickedIndex + 1).toString(), () => this.getElementWrapper().findRowSelectionArea(clickedIndex + 1));
21025
- (0, import_react14.act)(() => {
19082
+ (0, import_react8.act)(() => {
21026
19083
  selectionArea.click();
21027
19084
  });
21028
19085
  }
@@ -21062,15 +19119,15 @@ var TableTesting = class extends AbstractComponentTesting {
21062
19119
  }
21063
19120
  }
21064
19121
  async awaitLoading() {
21065
- await (0, import_react13.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).not.toBeNull());
19122
+ await (0, import_react7.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).not.toBeNull());
21066
19123
  }
21067
19124
  async awaitNotLoading() {
21068
- await (0, import_react13.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).toBeNull());
19125
+ await (0, import_react7.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).toBeNull());
21069
19126
  }
21070
19127
  changeColumnSorting(columnHeader) {
21071
19128
  const column = this.getElementWrapper().findColumnHeaders().findIndex((header) => header.getElement().textContent === columnHeader);
21072
19129
  const sortButton = this.getElementWrapper().findColumnSortingArea(column + 1);
21073
- (0, import_react14.act)(() => sortButton.click());
19130
+ (0, import_react8.act)(() => sortButton.click());
21074
19131
  }
21075
19132
  expectSortedBy(columnHeader, desc) {
21076
19133
  const descSorted = this.getElementWrapper().findDescSortedColumn();
@@ -21084,58 +19141,58 @@ var TableTesting = class extends AbstractComponentTesting {
21084
19141
  }
21085
19142
  }
21086
19143
  async editCell(rowIndex, colIndex, editSteps, findLeaveButton) {
21087
- await (0, import_react13.waitFor)(() => globalExpect(this.getElementWrapper().findEditCellButton(rowIndex + 1, colIndex + 1)).not.toBeNull());
21088
- (0, import_react14.act)(() => this.getElementWrapper().findEditCellButton(rowIndex + 1, colIndex + 1).click());
21089
- await (0, import_react13.waitFor)(() => globalExpect(findLeaveButton()).not.toBeNull());
19144
+ await (0, import_react7.waitFor)(() => globalExpect(this.getElementWrapper().findEditCellButton(rowIndex + 1, colIndex + 1)).not.toBeNull());
19145
+ (0, import_react8.act)(() => this.getElementWrapper().findEditCellButton(rowIndex + 1, colIndex + 1).click());
19146
+ await (0, import_react7.waitFor)(() => globalExpect(findLeaveButton()).not.toBeNull());
21090
19147
  await editSteps();
21091
- (0, import_react14.act)(() => findLeaveButton().click());
21092
- await (0, import_react13.waitFor)(() => globalExpect(this.getElementWrapper().findEditCellButton(rowIndex + 1, colIndex + 1)).not.toBeNull());
19148
+ (0, import_react8.act)(() => findLeaveButton().click());
19149
+ await (0, import_react7.waitFor)(() => globalExpect(this.getElementWrapper().findEditCellButton(rowIndex + 1, colIndex + 1)).not.toBeNull());
21093
19150
  }
21094
19151
  };
21095
19152
 
21096
19153
  // src/components/WizardTesting.ts
21097
19154
  var import_dom6 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21098
- var import_react15 = require("react");
19155
+ var import_react9 = require("react");
21099
19156
  var WizardTesting = class extends AbstractComponentTesting {
21100
19157
  constructor(fieldSpec, view) {
21101
19158
  super(fieldSpec, view, (selector) => (0, import_dom6.default)().findWizard(selector));
21102
19159
  this.view = view;
21103
19160
  }
21104
19161
  cancel() {
21105
- (0, import_react15.act)(() => this.getElementWrapper().findCancelButton().click());
19162
+ (0, import_react9.act)(() => this.getElementWrapper().findCancelButton().click());
21106
19163
  }
21107
19164
  skip() {
21108
19165
  const skipButton = this.assertElement(this.elementSpec.getDataTestId() + "SkipButton", () => this.getElementWrapper().findSkipToButton());
21109
- (0, import_react15.act)(() => skipButton.click());
19166
+ (0, import_react9.act)(() => skipButton.click());
21110
19167
  }
21111
19168
  prev() {
21112
19169
  const prevButton = this.assertElement(this.elementSpec.getDataTestId() + "PrevButton", () => this.getElementWrapper().findPreviousButton());
21113
- (0, import_react15.act)(() => prevButton.click());
19170
+ (0, import_react9.act)(() => prevButton.click());
21114
19171
  }
21115
19172
  next() {
21116
- (0, import_react15.act)(() => this.getElementWrapper().findPrimaryButton().click());
19173
+ (0, import_react9.act)(() => this.getElementWrapper().findPrimaryButton().click());
21117
19174
  }
21118
19175
  confirm() {
21119
19176
  this.next();
21120
19177
  }
21121
19178
  goToStep(stepIndex) {
21122
- (0, import_react15.act)(() => this.getElementWrapper().findMenuNavigationLinks()[stepIndex].click());
19179
+ (0, import_react9.act)(() => this.getElementWrapper().findMenuNavigationLinks()[stepIndex].click());
21123
19180
  }
21124
19181
  };
21125
19182
 
21126
19183
  // src/components/ButtonTesting.ts
21127
19184
  var import_dom7 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21128
- var import_react16 = require("@testing-library/react");
19185
+ var import_react10 = require("@testing-library/react");
21129
19186
  var ButtonTesting = class extends AbstractComponentTesting {
21130
19187
  constructor(fieldSpec, view) {
21131
19188
  super(fieldSpec, view, (selector) => (0, import_dom7.default)().findButton(selector));
21132
19189
  this.view = view;
21133
19190
  }
21134
19191
  async awaitLoading() {
21135
- await (0, import_react16.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingIndicator()).not.toBeNull());
19192
+ await (0, import_react10.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingIndicator()).not.toBeNull());
21136
19193
  }
21137
19194
  async awaitNotLoading() {
21138
- await (0, import_react16.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingIndicator()).toBeNull());
19195
+ await (0, import_react10.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingIndicator()).toBeNull());
21139
19196
  }
21140
19197
  async clickAndWaitForLoadingDone() {
21141
19198
  this.click();
@@ -21146,20 +19203,20 @@ var ButtonTesting = class extends AbstractComponentTesting {
21146
19203
 
21147
19204
  // src/components/ButtonDropdownTesting.ts
21148
19205
  var import_dom8 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21149
- var import_react17 = require("@testing-library/react");
21150
- var import_react18 = require("react");
19206
+ var import_react11 = require("@testing-library/react");
19207
+ var import_react12 = require("react");
21151
19208
  var ButtonDropdownTesting = class extends AbstractComponentTesting {
21152
19209
  constructor(fieldSpec, view) {
21153
19210
  super(fieldSpec, view, (selector) => (0, import_dom8.default)().findButtonDropdown(selector));
21154
19211
  this.view = view;
21155
19212
  }
21156
19213
  async openDropdown() {
21157
- (0, import_react18.act)(() => this.getElementWrapper().openDropdown());
21158
- await (0, import_react17.waitFor)(() => globalExpect(this.getDropdown()).not.toBeNull());
19214
+ (0, import_react12.act)(() => this.getElementWrapper().openDropdown());
19215
+ await (0, import_react11.waitFor)(() => globalExpect(this.getDropdown()).not.toBeNull());
21159
19216
  }
21160
19217
  async clickItem(dataTestId) {
21161
19218
  await this.openDropdown();
21162
- (0, import_react18.act)(() => {
19219
+ (0, import_react12.act)(() => {
21163
19220
  this.getElementWrapper().findItemById(dataTestId).click();
21164
19221
  });
21165
19222
  }
@@ -21170,8 +19227,8 @@ var ButtonDropdownTesting = class extends AbstractComponentTesting {
21170
19227
 
21171
19228
  // src/components/ModalTesting.ts
21172
19229
  var import_dom9 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21173
- var import_react19 = require("@testing-library/react");
21174
- var import_react20 = require("react");
19230
+ var import_react13 = require("@testing-library/react");
19231
+ var import_react14 = require("react");
21175
19232
  var ModalTesting = class extends AbstractComponentTesting {
21176
19233
  constructor(viewSpec, view) {
21177
19234
  super(viewSpec, view, (selector) => (0, import_dom9.default)().findModal(selector));
@@ -21184,13 +19241,13 @@ var ModalTesting = class extends AbstractComponentTesting {
21184
19241
  globalExpect(this.getElementWrapper().isVisible()).toBeTruthy();
21185
19242
  }
21186
19243
  async awaitVisible() {
21187
- return (0, import_react19.waitFor)(() => globalExpect(this.getElementWrapper().isVisible()).toBeTruthy());
19244
+ return (0, import_react13.waitFor)(() => globalExpect(this.getElementWrapper().isVisible()).toBeTruthy());
21188
19245
  }
21189
19246
  async awaitHidden() {
21190
- return (0, import_react19.waitFor)(() => globalExpect(this.getElementWrapper().isVisible()).toBeFalsy());
19247
+ return (0, import_react13.waitFor)(() => globalExpect(this.getElementWrapper().isVisible()).toBeFalsy());
21191
19248
  }
21192
19249
  dismiss() {
21193
- (0, import_react20.act)(() => {
19250
+ (0, import_react14.act)(() => {
21194
19251
  this.getElementWrapper().findDismissButton().click();
21195
19252
  });
21196
19253
  }
@@ -21198,19 +19255,20 @@ var ModalTesting = class extends AbstractComponentTesting {
21198
19255
 
21199
19256
  // src/components/RatingTesting.ts
21200
19257
  var import_dom10 = require("@cloudscape-design/test-utils-core/dom");
21201
- var import_react21 = require("@testing-library/react");
21202
- var import_react22 = require("react");
19258
+ var import_react15 = require("@testing-library/react");
19259
+ var import_react16 = require("react");
19260
+ var import_cswrapper5 = require("@ebertjendustries/cswrapper");
21203
19261
  var RatingTesting = class extends AbstractComponentTesting {
21204
19262
  constructor(viewSpec, view, factory, toOrderNumber) {
21205
19263
  super(viewSpec, view, () => {
21206
- const element = import_react21.screen.queryByLabelText(getEnumRatingValues(factory, toOrderNumber)[0].toString());
19264
+ const element = import_react15.screen.queryByLabelText((0, import_cswrapper5.getEnumRatingValues)(factory, toOrderNumber)[0].toString());
21207
19265
  if (element === null) {
21208
19266
  return null;
21209
19267
  }
21210
19268
  return new import_dom10.ElementWrapper(element);
21211
19269
  });
21212
19270
  this.view = view;
21213
- this.enumValuesInOrder = getEnumRatingValues(factory, toOrderNumber);
19271
+ this.enumValuesInOrder = (0, import_cswrapper5.getEnumRatingValues)(factory, toOrderNumber);
21214
19272
  }
21215
19273
  static mockBoundingBox() {
21216
19274
  window.SVGElement.prototype.getBBox = () => ({
@@ -21232,15 +19290,15 @@ var RatingTesting = class extends AbstractComponentTesting {
21232
19290
  }
21233
19291
  }
21234
19292
  select(selectedEnum) {
21235
- (0, import_react22.act)(() => {
19293
+ (0, import_react16.act)(() => {
21236
19294
  this.getByLabelText(selectedEnum).click();
21237
19295
  });
21238
19296
  }
21239
19297
  unselectAll() {
21240
- (0, import_react22.act)(() => {
19298
+ (0, import_react16.act)(() => {
21241
19299
  this.getByLabelText(this.enumValuesInOrder[1]).click();
21242
19300
  });
21243
- (0, import_react22.act)(() => {
19301
+ (0, import_react16.act)(() => {
21244
19302
  this.getByLabelText(this.enumValuesInOrder[1]).click();
21245
19303
  });
21246
19304
  }
@@ -21251,20 +19309,20 @@ var RatingTesting = class extends AbstractComponentTesting {
21251
19309
  AbstractComponentTesting.expectDisabled(this.getByLabelText(this.enumValuesInOrder[1]), this.msgForExpect());
21252
19310
  }
21253
19311
  getByLabelText(enumInstance) {
21254
- return import_react21.screen.getByLabelText(getEnumRatingLabel(enumInstance, this.elementSpec.instanceId));
19312
+ return import_react15.screen.getByLabelText((0, import_cswrapper5.getEnumRatingLabel)(enumInstance, this.elementSpec.instanceId));
21255
19313
  }
21256
19314
  };
21257
19315
 
21258
19316
  // src/components/CheckboxTesting.ts
21259
19317
  var import_dom11 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21260
- var import_react23 = require("react");
19318
+ var import_react17 = require("react");
21261
19319
  var CheckboxTesting = class extends AbstractComponentTesting {
21262
19320
  constructor(fieldSpec, view) {
21263
19321
  super(fieldSpec, view, (selector) => (0, import_dom11.default)().findCheckbox(selector));
21264
19322
  this.view = view;
21265
19323
  }
21266
19324
  click() {
21267
- (0, import_react23.act)(() => {
19325
+ (0, import_react17.act)(() => {
21268
19326
  this.getElementWrapper().findNativeInput().click();
21269
19327
  });
21270
19328
  }
@@ -21322,7 +19380,7 @@ var BoxTesting = class extends AbstractComponentTesting {
21322
19380
 
21323
19381
  // src/components/CollectionPreferencesTesting.ts
21324
19382
  var import_dom14 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21325
- var import_react24 = require("react");
19383
+ var import_react18 = require("react");
21326
19384
  var CollectionPreferencesSetting = class {
21327
19385
  };
21328
19386
  var CollectionPreferencesTesting = class extends AbstractComponentTesting {
@@ -21352,13 +19410,13 @@ var CollectionPreferencesTesting = class extends AbstractComponentTesting {
21352
19410
  const modal = this.openPreferencesModal();
21353
19411
  if (preferences.pageSize !== void 0) {
21354
19412
  const pageSizeIndex = this.getPageSizeIndex(preferences.pageSize);
21355
- (0, import_react24.act)(() => modal.findPageSizePreference().findOptions()[pageSizeIndex].findLabel().click());
19413
+ (0, import_react18.act)(() => modal.findPageSizePreference().findOptions()[pageSizeIndex].findLabel().click());
21356
19414
  }
21357
19415
  if (preferences.stickFirstColumns !== void 0) {
21358
- (0, import_react24.act)(() => modal.findStickyColumnsPreference("first").findRadioGroup().findButtons()[preferences.stickFirstColumns].findNativeInput().click());
19416
+ (0, import_react18.act)(() => modal.findStickyColumnsPreference("first").findRadioGroup().findButtons()[preferences.stickFirstColumns].findNativeInput().click());
21359
19417
  }
21360
19418
  if (preferences.stickLastColumns !== void 0) {
21361
- (0, import_react24.act)(() => modal.findStickyColumnsPreference("last").findRadioGroup().findButtons()[preferences.stickLastColumns].findNativeInput().click());
19419
+ (0, import_react18.act)(() => modal.findStickyColumnsPreference("last").findRadioGroup().findButtons()[preferences.stickLastColumns].findNativeInput().click());
21362
19420
  }
21363
19421
  this.editCheckboxSetting(preferences.wrapLines, modal.findWrapLinesPreference());
21364
19422
  this.editCheckboxSetting(preferences.stripedRows, modal.findStripedRowsPreference());
@@ -21366,15 +19424,15 @@ var CollectionPreferencesTesting = class extends AbstractComponentTesting {
21366
19424
  this.confirmPreferencesModal();
21367
19425
  }
21368
19426
  openPreferencesModal() {
21369
- (0, import_react24.act)(() => this.getElementWrapper().findTriggerButton().click());
19427
+ (0, import_react18.act)(() => this.getElementWrapper().findTriggerButton().click());
21370
19428
  globalExpect(this.getElementWrapper().findModal()).not.toBeNull();
21371
19429
  return this.getElementWrapper().findModal();
21372
19430
  }
21373
19431
  confirmPreferencesModal() {
21374
- (0, import_react24.act)(() => this.getElementWrapper().findModal().findConfirmButton().click());
19432
+ (0, import_react18.act)(() => this.getElementWrapper().findModal().findConfirmButton().click());
21375
19433
  }
21376
19434
  cancelPreferencesModal() {
21377
- (0, import_react24.act)(() => this.getElementWrapper().findModal().findCancelButton().click());
19435
+ (0, import_react18.act)(() => this.getElementWrapper().findModal().findCancelButton().click());
21378
19436
  }
21379
19437
  getPageSizeIndex(pageSize) {
21380
19438
  const pageSizeIndex = this.supportedPageSizes.indexOf(pageSize);
@@ -21386,7 +19444,7 @@ var CollectionPreferencesTesting = class extends AbstractComponentTesting {
21386
19444
  editCheckboxSetting(settingValue, checkbox) {
21387
19445
  if (settingValue !== void 0) {
21388
19446
  if (settingValue !== checkbox.findNativeInput().getElement().checked) {
21389
- (0, import_react24.act)(() => checkbox.findNativeInput().click());
19447
+ (0, import_react18.act)(() => checkbox.findNativeInput().click());
21390
19448
  }
21391
19449
  }
21392
19450
  }
@@ -21412,14 +19470,14 @@ var LinkTesting = class extends AbstractComponentTesting {
21412
19470
 
21413
19471
  // src/components/ToggleTesting.ts
21414
19472
  var import_dom16 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21415
- var import_react25 = require("react");
19473
+ var import_react19 = require("react");
21416
19474
  var ToggleTesting = class extends AbstractComponentTesting {
21417
19475
  constructor(fieldSpec, view) {
21418
19476
  super(fieldSpec, view, (selector) => (0, import_dom16.default)().findToggle(selector));
21419
19477
  this.view = view;
21420
19478
  }
21421
19479
  click() {
21422
- (0, import_react25.act)(() => {
19480
+ (0, import_react19.act)(() => {
21423
19481
  this.getElementWrapper().findNativeInput().click();
21424
19482
  });
21425
19483
  }
@@ -21439,18 +19497,18 @@ var ToggleTesting = class extends AbstractComponentTesting {
21439
19497
 
21440
19498
  // src/components/FlashbarTesting.ts
21441
19499
  var import_dom17 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21442
- var import_react26 = require("@testing-library/react");
19500
+ var import_react20 = require("@testing-library/react");
21443
19501
  var FlashbarTesting = class extends AbstractComponentTesting {
21444
19502
  constructor(fieldSpec, view) {
21445
19503
  super(fieldSpec, view, (selector) => (0, import_dom17.default)().findFlashbar(selector));
21446
19504
  this.view = view;
21447
19505
  }
21448
19506
  async awaitMessages() {
21449
- await (0, import_react26.waitFor)(() => globalExpect(this.getElementWrapper().findItems().length).toBeGreaterThan(0));
19507
+ await (0, import_react20.waitFor)(() => globalExpect(this.getElementWrapper().findItems().length).toBeGreaterThan(0));
21450
19508
  const wrappers = this.getElementWrapper().findItems();
21451
19509
  for (let index2 = 0; index2 < wrappers.length; index2++) {
21452
19510
  const wrapper29 = wrappers[index2];
21453
- await (0, import_react26.waitFor)(() => globalExpect(wrapper29.findContent()).not.toBeNull());
19511
+ await (0, import_react20.waitFor)(() => globalExpect(wrapper29.findContent()).not.toBeNull());
21454
19512
  }
21455
19513
  }
21456
19514
  expectMessagePresentCount(text, count, headerMessage) {
@@ -21481,8 +19539,8 @@ var FlashbarTesting = class extends AbstractComponentTesting {
21481
19539
 
21482
19540
  // src/components/SegmentedControlTesting.ts
21483
19541
  var import_dom18 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21484
- var import_react27 = require("@testing-library/react");
21485
- var import_react28 = require("react");
19542
+ var import_react21 = require("@testing-library/react");
19543
+ var import_react22 = require("react");
21486
19544
  var SegmentedControlTesting = class extends AbstractComponentTesting {
21487
19545
  constructor(fieldSpec, view, factory) {
21488
19546
  super(fieldSpec, view, (selector) => (0, import_dom18.default)().findSegmentedControl(selector));
@@ -21493,10 +19551,10 @@ var SegmentedControlTesting = class extends AbstractComponentTesting {
21493
19551
  await this.select(this.factory.values.findIndex((value) => value === enumValue));
21494
19552
  }
21495
19553
  async select(index2) {
21496
- (0, import_react28.act)(() => {
19554
+ (0, import_react22.act)(() => {
21497
19555
  this.getElementWrapper().findSegments()[index2].click();
21498
19556
  });
21499
- await (0, import_react27.waitFor)(() => globalExpect(this.getElementWrapper().findSelectedSegment().getElement()).toStrictEqual(this.getElementWrapper().findSegments()[index2].getElement()));
19557
+ await (0, import_react21.waitFor)(() => globalExpect(this.getElementWrapper().findSelectedSegment().getElement()).toStrictEqual(this.getElementWrapper().findSegments()[index2].getElement()));
21500
19558
  }
21501
19559
  expectSelected(index2) {
21502
19560
  const selectedElement = this.getElementWrapper().findSelectedSegment();
@@ -21551,8 +19609,8 @@ var StatusIndicatorTesting = class extends AbstractComponentTesting {
21551
19609
 
21552
19610
  // src/components/CardsTesting.ts
21553
19611
  var import_dom21 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21554
- var import_react29 = require("@testing-library/react");
21555
- var import_react30 = require("react");
19612
+ var import_react23 = require("@testing-library/react");
19613
+ var import_react24 = require("react");
21556
19614
  var CardsTesting = class extends AbstractComponentTesting {
21557
19615
  constructor(fieldSpec, view) {
21558
19616
  super(fieldSpec, view, (selector) => (0, import_dom21.default)().findCards(selector));
@@ -21580,8 +19638,8 @@ var CardsTesting = class extends AbstractComponentTesting {
21580
19638
  this.getElementWrapper().findLoadingText();
21581
19639
  }
21582
19640
  async awaitLoadingText(expectedText) {
21583
- await (0, import_react29.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText().getElement()).toHaveTextContent(expectedText));
21584
- return (0, import_react29.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).toBeNull());
19641
+ await (0, import_react23.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText().getElement()).toHaveTextContent(expectedText));
19642
+ return (0, import_react23.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).toBeNull());
21585
19643
  }
21586
19644
  clickItems(clickedItemIndices) {
21587
19645
  const allItems = this.getElementWrapper().findItems();
@@ -21589,7 +19647,7 @@ var CardsTesting = class extends AbstractComponentTesting {
21589
19647
  if (clickedItemIndices.indexOf(index2) !== -1) {
21590
19648
  const item = allItems[index2];
21591
19649
  const selectionArea = this.assertElement("none", () => item.findSelectionArea());
21592
- (0, import_react30.act)(() => {
19650
+ (0, import_react24.act)(() => {
21593
19651
  selectionArea.click();
21594
19652
  });
21595
19653
  }
@@ -21602,23 +19660,23 @@ var CardsTesting = class extends AbstractComponentTesting {
21602
19660
  return this.getElementWrapper().findItems().length;
21603
19661
  }
21604
19662
  async awaitLoading() {
21605
- await (0, import_react29.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).not.toBeNull());
19663
+ await (0, import_react23.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).not.toBeNull());
21606
19664
  }
21607
19665
  async awaitNotLoading() {
21608
- await (0, import_react29.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).toBeNull());
19666
+ await (0, import_react23.waitFor)(() => globalExpect(this.getElementWrapper().findLoadingText()).toBeNull());
21609
19667
  }
21610
19668
  };
21611
19669
 
21612
19670
  // src/components/TextareaTesting.ts
21613
19671
  var import_dom22 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21614
- var import_react31 = require("react");
19672
+ var import_react25 = require("react");
21615
19673
  var TextareaTesting = class extends AbstractInputTesting {
21616
19674
  constructor(fieldSpec, view) {
21617
19675
  super(fieldSpec, view, (selector) => (0, import_dom22.default)().findTextarea(selector));
21618
19676
  this.view = view;
21619
19677
  }
21620
19678
  setStringValue(value) {
21621
- (0, import_react31.act)(() => {
19679
+ (0, import_react25.act)(() => {
21622
19680
  this.getElementWrapper().setTextareaValue(value);
21623
19681
  });
21624
19682
  }
@@ -21632,7 +19690,7 @@ var TextareaTesting = class extends AbstractInputTesting {
21632
19690
 
21633
19691
  // src/components/TabsTesting.ts
21634
19692
  var import_dom23 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21635
- var import_react32 = require("react");
19693
+ var import_react26 = require("react");
21636
19694
  var TabsTesting = class extends AbstractComponentTesting {
21637
19695
  constructor(fieldSpec, view) {
21638
19696
  super(fieldSpec, view, (selector) => (0, import_dom23.default)().findTabs(selector));
@@ -21648,7 +19706,7 @@ var TabsTesting = class extends AbstractComponentTesting {
21648
19706
  selectTab(index2) {
21649
19707
  const tabLinkByIndex = this.getElementWrapper().findTabLinkByIndex(index2 + 1);
21650
19708
  this.assertTabAtIndex(tabLinkByIndex, index2);
21651
- (0, import_react32.act)(() => {
19709
+ (0, import_react26.act)(() => {
21652
19710
  tabLinkByIndex.click();
21653
19711
  });
21654
19712
  }
@@ -21682,7 +19740,7 @@ var TextContentTesting = class extends AbstractComponentTesting {
21682
19740
 
21683
19741
  // src/components/PaginationTesting.ts
21684
19742
  var import_dom26 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21685
- var import_react33 = require("react");
19743
+ var import_react27 = require("react");
21686
19744
  var PaginationTesting = class extends AbstractComponentTesting {
21687
19745
  constructor(fieldSpec, view) {
21688
19746
  super(fieldSpec, view, (selector) => (0, import_dom26.default)().findPagination(selector));
@@ -21698,16 +19756,16 @@ var PaginationTesting = class extends AbstractComponentTesting {
21698
19756
  const nextButton = this.getElementWrapper().findNextPageButton();
21699
19757
  const prevButton = this.getElementWrapper().findPreviousPageButton();
21700
19758
  if (toIndex === fromIndex + 1) {
21701
- (0, import_react33.act)(() => nextButton.click());
19759
+ (0, import_react27.act)(() => nextButton.click());
21702
19760
  } else if (toIndex === fromIndex - 1) {
21703
- (0, import_react33.act)(() => prevButton.click());
19761
+ (0, import_react27.act)(() => prevButton.click());
21704
19762
  } else {
21705
19763
  const pageIndexTo = (toIndex + 1).toString();
21706
19764
  const pageNumbersWithIndex = this.getElementWrapper().findPageNumbers().filter((pageNumber) => pageNumber.getElement().textContent === pageIndexTo);
21707
19765
  if (pageNumbersWithIndex.length !== 1) {
21708
19766
  throw new Error(`Expected page index ${pageIndexTo} not displayed currently in pagination component! Here are the currently displayed page numbers: ${this.getElementWrapper().findPageNumbers().map((n2) => n2.getElement().textContent)}`);
21709
19767
  }
21710
- (0, import_react33.act)(() => pageNumbersWithIndex[0].click());
19768
+ (0, import_react27.act)(() => pageNumbersWithIndex[0].click());
21711
19769
  }
21712
19770
  }
21713
19771
  };
@@ -21723,20 +19781,20 @@ var FormTesting = class extends AbstractComponentTesting {
21723
19781
 
21724
19782
  // src/components/ProgressBarTesting.ts
21725
19783
  var import_dom28 = __toESM(require("@cloudscape-design/components/test-utils/dom"));
21726
- var import_react34 = require("@testing-library/react");
19784
+ var import_react28 = require("@testing-library/react");
21727
19785
  var ProgressBarTesting = class extends AbstractComponentTesting {
21728
19786
  constructor(fieldSpec, view) {
21729
19787
  super(fieldSpec, view, (selector) => (0, import_dom28.default)().findProgressBar(selector));
21730
19788
  this.view = view;
21731
19789
  }
21732
19790
  async awaitPercentageDisplay(text) {
21733
- await (0, import_react34.waitFor)(() => globalExpect(this.getElementWrapper().findPercentageText()).not.toBeNull());
19791
+ await (0, import_react28.waitFor)(() => globalExpect(this.getElementWrapper().findPercentageText()).not.toBeNull());
21734
19792
  const percentageText = this.getElementWrapper().findPercentageText();
21735
- await (0, import_react34.waitFor)(() => globalExpect(percentageText.findTextContent()).not.toBeNull());
21736
- await (0, import_react34.waitFor)(() => globalExpect(percentageText.findTextContent().getElement()).toHaveTextContent(text.toString()));
19793
+ await (0, import_react28.waitFor)(() => globalExpect(percentageText.findTextContent()).not.toBeNull());
19794
+ await (0, import_react28.waitFor)(() => globalExpect(percentageText.findTextContent().getElement()).toHaveTextContent(text.toString()));
21737
19795
  }
21738
19796
  async awaitResultText(text) {
21739
- await (0, import_react34.waitFor)(() => globalExpect(this.getElementWrapper().findResultText().findTextContent().getElement()).toHaveTextContent(text));
19797
+ await (0, import_react28.waitFor)(() => globalExpect(this.getElementWrapper().findResultText().findTextContent().getElement()).toHaveTextContent(text));
21740
19798
  }
21741
19799
  };
21742
19800
 
@@ -21847,7 +19905,7 @@ var TestingFactory = class {
21847
19905
  };
21848
19906
 
21849
19907
  // src/views/AbstractViewTesting.tsx
21850
- var import_react35 = require("@testing-library/react");
19908
+ var import_react29 = require("@testing-library/react");
21851
19909
  var import_fs = require("fs");
21852
19910
  var import_user_event = __toESM(require("@testing-library/user-event"));
21853
19911
  var AbstractViewTesting = class {
@@ -21862,10 +19920,10 @@ var AbstractViewTesting = class {
21862
19920
  return this.testLocalisation.getLocaliser(this.namespace);
21863
19921
  }
21864
19922
  fromSpec(componentSpec, testElements) {
21865
- return ViewSpec.create(componentSpec.key, componentSpec.ns, (spec) => testElements(componentSpec.elements, this.factory));
19923
+ return import_cswrapper6.ViewSpec.create(componentSpec.key, componentSpec.ns, (spec) => testElements(componentSpec.elements, this.factory));
21866
19924
  }
21867
19925
  printDOM() {
21868
- const dom = (0, import_react35.prettyDOM)(void 0, 1e7, { highlight: false });
19926
+ const dom = (0, import_react29.prettyDOM)(void 0, 1e7, { highlight: false });
21869
19927
  if (dom) {
21870
19928
  (0, import_fs.writeFileSync)("./DOM.txt", dom.toString());
21871
19929
  }
@@ -21879,7 +19937,7 @@ var AbstractViewTesting = class {
21879
19937
  await this.factory.form(viewSpec).awaitPresent();
21880
19938
  }
21881
19939
  expectViewNotPresent(viewSpec) {
21882
- globalExpect(import_react35.screen.queryByTestId(viewSpec.getDataTestId())).not.toBeInTheDocument();
19940
+ globalExpect(import_react29.screen.queryByTestId(viewSpec.getDataTestId())).not.toBeInTheDocument();
21883
19941
  }
21884
19942
  translate(key, variables, alternateNs) {
21885
19943
  return this.getLocaliser().localiseKey(key, variables, alternateNs);
@@ -21893,17 +19951,18 @@ var AbstractViewTesting = class {
21893
19951
  };
21894
19952
 
21895
19953
  // src/views/CSVNoItemsViewTesting.tsx
19954
+ var import_cswrapper7 = require("@ebertjendustries/cswrapper");
21896
19955
  var CSVNoItemsViewTesting = class extends AbstractViewTesting {
21897
19956
  constructor(namespace, viewSpec, entityTypeFactory, testLocalisation) {
21898
19957
  super(namespace, viewSpec, testLocalisation);
21899
19958
  this.entityTypeFactory = entityTypeFactory;
21900
- this.noItemsView = this.fromSpec(CSV_NO_ITEMS_VIEW_SPEC(this.namespace), (elements, factory) => ({
19959
+ this.noItemsView = this.fromSpec((0, import_cswrapper7.CSV_NO_ITEMS_VIEW_SPEC)(this.namespace), (elements, factory) => ({
21901
19960
  boxHeading: factory.box(elements.boxHeading),
21902
19961
  boxBody: factory.box(elements.boxBody)
21903
19962
  }));
21904
19963
  }
21905
19964
  async awaitPresent() {
21906
- await this.waitForView(CSV_NO_ITEMS_VIEW_SPEC(this.namespace));
19965
+ await this.waitForView((0, import_cswrapper7.CSV_NO_ITEMS_VIEW_SPEC)(this.namespace));
21907
19966
  this.expectPresent();
21908
19967
  }
21909
19968
  async awaitNotPresent() {
@@ -21921,19 +19980,21 @@ var CSVNoItemsViewTesting = class extends AbstractViewTesting {
21921
19980
  };
21922
19981
 
21923
19982
  // src/views/CSVPriceInputViewTesting.tsx
19983
+ var import_cswrapper8 = require("@ebertjendustries/cswrapper");
19984
+ var import_cswrapper9 = require("@ebertjendustries/cswrapper");
21924
19985
  var CSVPriceInputViewTesting = class extends AbstractViewTesting {
21925
19986
  constructor(namespace, viewSpec, testLocalisation, currencyFactory, expandToViewport) {
21926
19987
  super(namespace, viewSpec, testLocalisation);
21927
19988
  this.currencyFactory = currencyFactory;
21928
19989
  this.expandToViewport = expandToViewport;
21929
- this.csvPriceInputView = this.fromSpec(CSV_PRICE_INPUT_VIEW_SPEC(this.parent, this.viewSpec.key), (elements, factory) => ({
19990
+ this.csvPriceInputView = this.fromSpec((0, import_cswrapper8.CSV_PRICE_INPUT_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
21930
19991
  amountInput: factory.numberInput(elements.inputPrice),
21931
19992
  currencyInput: factory.select(elements.selectCurrency, this.expandToViewport),
21932
19993
  displayBox: factory.box(elements.boxPriceDisplay)
21933
19994
  }));
21934
19995
  }
21935
19996
  expectDisplayPrice(price) {
21936
- this.csvPriceInputView.elements.displayBox.expectContent(PriceUtils.getFormattedPrice("en", price));
19997
+ this.csvPriceInputView.elements.displayBox.expectContent(import_cswrapper9.PriceUtils.getFormattedPrice("en", price));
21937
19998
  }
21938
19999
  async setPrice(price) {
21939
20000
  if (isNaN(price.priceInCents)) {
@@ -21956,10 +20017,11 @@ var CSVPriceInputViewTesting = class extends AbstractViewTesting {
21956
20017
  };
21957
20018
 
21958
20019
  // src/views/CSVSearchFilterViewTesting.tsx
20020
+ var import_cswrapper10 = require("@ebertjendustries/cswrapper");
21959
20021
  var CSVSearchFilterViewTesting = class extends AbstractViewTesting {
21960
20022
  constructor(namespace, viewSpec, testLocalisation) {
21961
20023
  super(namespace, viewSpec, testLocalisation);
21962
- this.csvSearchFilterView = this.fromSpec(CSV_SEARCH_FILTER_VIEW_SPEC(this.parent, this.viewSpec.key), (elements, factory) => ({
20024
+ this.csvSearchFilterView = this.fromSpec((0, import_cswrapper10.CSV_SEARCH_FILTER_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
21963
20025
  searchTextFilter: factory.stringInput(elements.inputSearch),
21964
20026
  searchButton: factory.button(elements.buttonSearch)
21965
20027
  }));
@@ -21994,10 +20056,11 @@ var CSVSearchFilterViewTesting = class extends AbstractViewTesting {
21994
20056
  };
21995
20057
 
21996
20058
  // src/views/CSVTextPromptModalViewTesting.tsx
20059
+ var import_cswrapper11 = require("@ebertjendustries/cswrapper");
21997
20060
  var CSVTextPromptModalViewTesting = class extends AbstractViewTesting {
21998
20061
  constructor(namespace, viewSpec, testLocalisation) {
21999
20062
  super(namespace, viewSpec, testLocalisation);
22000
- this.csvTextPromptModalView = this.fromSpec(CSV_TEXT_PROMPT_MODAL_VIEW_SPEC(this.parent, this.viewSpec.key), (elements, factory) => ({
20063
+ this.csvTextPromptModalView = this.fromSpec((0, import_cswrapper11.CSV_TEXT_PROMPT_MODAL_VIEW_SPEC)(this.parent, this.viewSpec.key), (elements, factory) => ({
22001
20064
  headerHeading: factory.header(elements.headerHeading),
22002
20065
  boxBodyText: factory.box(elements.boxBodyText),
22003
20066
  buttonPrimary: factory.button(elements.buttonPrimary),
@@ -22071,7 +20134,11 @@ var MockBrowserAPIs = class {
22071
20134
 
22072
20135
  // src/mocks/MockRestClient.ts
22073
20136
  var import_console = require("console");
22074
- var LOGGER3 = new Log("RestClientMock");
20137
+ var import_cswrapper12 = require("@ebertjendustries/cswrapper");
20138
+ var import_cswrapper13 = require("@ebertjendustries/cswrapper");
20139
+ var RealRestClient = __toESM(require("@ebertjendustries/cswrapper"));
20140
+ var import_cswrapper14 = require("@ebertjendustries/cswrapper");
20141
+ var LOGGER = new import_cswrapper12.Log("RestClientMock");
22075
20142
  var MockResponseStore = class {
22076
20143
  constructor(parentUUID) {
22077
20144
  this.parentUUID = parentUUID;
@@ -22116,8 +20183,8 @@ var MockResponseStore = class {
22116
20183
  };
22117
20184
  function setupRestClientMock(controllerSpec) {
22118
20185
  const mockRestClient = new MockRestClient(controllerSpec.key);
22119
- const mock = vi.spyOn(dist_exports2, "createRestClient");
22120
- LOGGER3.info(`Setting up mock rest client with key ${controllerSpec.key}.`);
20186
+ const mock = vi.spyOn(RealRestClient, "createRestClient");
20187
+ LOGGER.info(`Setting up mock rest client with key ${controllerSpec.key}.`);
22121
20188
  mock.mockImplementation(() => {
22122
20189
  return mockRestClient;
22123
20190
  });
@@ -22130,7 +20197,7 @@ var MockRestClient = class {
22130
20197
  this.post = vi.fn();
22131
20198
  this.del = vi.fn();
22132
20199
  this.uuid = "<" + crypto.randomUUID().split("-")[4] + ">";
22133
- LOGGER3.info(`Instantiating mock rest client with name ${name} and UUID ${this.uuid}.`);
20200
+ LOGGER.info(`Instantiating mock rest client with name ${name} and UUID ${this.uuid}.`);
22134
20201
  this.getResponseValues = new MockResponseStore(this.uuid);
22135
20202
  this.putResponseValues = new MockResponseStore(this.uuid);
22136
20203
  this.postResponseValues = new MockResponseStore(this.uuid);
@@ -22147,19 +20214,19 @@ var MockRestClient = class {
22147
20214
  this.deleteResponseValues.expectAllCalled(hard);
22148
20215
  }
22149
20216
  addGetResponse(url, response, delayInMilliseconds) {
22150
- LOGGER3.info(`${this.uuid} Configuring GET ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
20217
+ LOGGER.info(`${this.uuid} Configuring GET ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
22151
20218
  this.getResponseValues.addResponse(url, response, delayInMilliseconds);
22152
20219
  }
22153
20220
  addPutResponse(url, response, delayInMilliseconds) {
22154
- LOGGER3.info(`${this.uuid} Configuring PUT ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
20221
+ LOGGER.info(`${this.uuid} Configuring PUT ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
22155
20222
  this.putResponseValues.addResponse(url, response, delayInMilliseconds);
22156
20223
  }
22157
20224
  addPostResponse(url, response, delayInMilliseconds) {
22158
- LOGGER3.info(`${this.uuid} Configuring POST ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
20225
+ LOGGER.info(`${this.uuid} Configuring POST ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
22159
20226
  this.postResponseValues.addResponse(url, response, delayInMilliseconds);
22160
20227
  }
22161
20228
  addDeleteResponse(url, response, delayInMilliseconds) {
22162
- LOGGER3.info(`${this.uuid} Configuring DELETE ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
20229
+ LOGGER.info(`${this.uuid} Configuring DELETE ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
22163
20230
  this.deleteResponseValues.addResponse(url, response, delayInMilliseconds);
22164
20231
  }
22165
20232
  getDelayForLogging(delayInMilliseconds) {
@@ -22184,9 +20251,9 @@ var MockRestClient = class {
22184
20251
  const response = val.response;
22185
20252
  const delayInMilliseconds = val.delay;
22186
20253
  if (delayInMilliseconds !== void 0) {
22187
- await sleep(delayInMilliseconds);
20254
+ await (0, import_cswrapper13.sleep)(delayInMilliseconds);
22188
20255
  }
22189
- if (response !== null && response !== void 0 && isContentWithMessages(response)) {
20256
+ if (response !== null && response !== void 0 && (0, import_cswrapper14.isContentWithMessages)(response)) {
22190
20257
  return Promise.reject(response);
22191
20258
  }
22192
20259
  return this.mockImpl(response, endpoint, payload, operation, header);
@@ -22194,10 +20261,10 @@ var MockRestClient = class {
22194
20261
  );
22195
20262
  }
22196
20263
  mockImpl(returnValue, endpoint, payload, operation, header) {
22197
- LOGGER3.debug(`${this.uuid} -----------> Mock REST API call <---------------`);
22198
- LOGGER3.debug(`${this.uuid} Calling REST API endpoint ${endpoint} with operation ${operation} and header <${header}>`);
20264
+ LOGGER.debug(`${this.uuid} -----------> Mock REST API call <---------------`);
20265
+ LOGGER.debug(`${this.uuid} Calling REST API endpoint ${endpoint} with operation ${operation} and header <${header}>`);
22199
20266
  const returnPromise = Promise.resolve({ content: returnValue, messages: [] });
22200
- LOGGER3.debug(`${this.uuid} DONE calling REST API endpoint ${endpoint} with operation ${operation} and header ${header}`);
20267
+ LOGGER.debug(`${this.uuid} DONE calling REST API endpoint ${endpoint} with operation ${operation} and header ${header}`);
22201
20268
  return returnPromise;
22202
20269
  }
22203
20270
  };
@@ -22337,11 +20404,11 @@ var MockServerBuilder = class _MockServerBuilder {
22337
20404
  };
22338
20405
 
22339
20406
  // src/utils/ViewTestWrapper.tsx
22340
- var import_react36 = require("react");
22341
- var import_jsx_runtime31 = require("react/jsx-runtime");
20407
+ var import_react30 = require("react");
20408
+ var import_jsx_runtime = require("react/jsx-runtime");
22342
20409
  function ViewTestWrapper(props) {
22343
- const [value, setValue] = (0, import_react36.useState)(props.initialValue);
22344
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: props.view(value, (propertyName, changedValue) => setValue(changedValue)) });
20410
+ const [value, setValue] = (0, import_react30.useState)(props.initialValue);
20411
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: props.view(value, (propertyName, changedValue) => setValue(changedValue)) });
22345
20412
  }
22346
20413
  // Annotate the CommonJS export names for ESM import in node:
22347
20414
  0 && (module.exports = {