@lvce-editor/find-widget-worker 3.7.4 → 3.7.5

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.
@@ -854,6 +854,7 @@ const createMockRpc = ({
854
854
  return mockRpc;
855
855
  };
856
856
 
857
+ const Alert = 'alert';
857
858
  const CheckBox = 'checkbox';
858
859
  const Group = 'group';
859
860
  const None = 'none';
@@ -2454,10 +2455,14 @@ const getFindMatchCountClassName = (matchCount, hasValue) => {
2454
2455
  return FindWidgetMatchCount;
2455
2456
  };
2456
2457
 
2457
- const getMatchCountVirtualDom = (matchCountText, matchCount, hasValue) => {
2458
+ const getMatchCountVirtualDom = (matchCountText, matchCount, hasValue, hasError = false) => {
2458
2459
  return [{
2459
2460
  childCount: 1,
2460
2461
  className: getFindMatchCountClassName(matchCount, hasValue),
2462
+ ...(hasError && {
2463
+ id: 'FindWidgetInputError',
2464
+ role: Alert
2465
+ }),
2461
2466
  type: Div
2462
2467
  }, text(matchCountText)];
2463
2468
  };
@@ -2489,7 +2494,7 @@ const getSearchFieldButtonVirtualDom = button => {
2489
2494
  }];
2490
2495
  };
2491
2496
 
2492
- const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus, extraClassName, autofocus = false) => {
2497
+ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus, extraClassName, autofocus = false, ariaDescribedBy = '', ariaInvalid = '') => {
2493
2498
  if (outsideButtons.length > 0) {
2494
2499
  throw new Error('outsideButtons are deprecated');
2495
2500
  }
@@ -2511,6 +2516,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2511
2516
  type: TextArea,
2512
2517
  ...(autofocus && {
2513
2518
  autofocus: true
2519
+ }),
2520
+ ...(ariaDescribedBy && {
2521
+ ariaDescribedBy
2522
+ }),
2523
+ ...(ariaInvalid && {
2524
+ ariaInvalid
2514
2525
  })
2515
2526
  }, {
2516
2527
  childCount: insideButtons.length,
@@ -2535,11 +2546,11 @@ const getFindWidgetFindVirtualDom = (matchCountText, buttons, fieldButtons, matc
2535
2546
  childCount: 2,
2536
2547
  className: FindWidgetFind,
2537
2548
  type: Div
2538
- }, ...getSearchFieldVirtualDom(SearchValue, find(), HandleInput, fieldButtons, [], HandleFocus, extraClassName, inputFocused), {
2549
+ }, ...getSearchFieldVirtualDom(SearchValue, find(), HandleInput, fieldButtons, [], HandleFocus, extraClassName, inputFocused, hasError ? 'FindWidgetInputError' : '', hasError ? 'true' : ''), {
2539
2550
  childCount: 1 + buttons.length,
2540
2551
  className: 'FindWidgetActions',
2541
2552
  type: Div
2542
- }, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue), ...buttons.flatMap(getIconButtonVirtualDom)];
2553
+ }, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue, hasError), ...buttons.flatMap(getIconButtonVirtualDom)];
2543
2554
  };
2544
2555
 
2545
2556
  const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons, replaceFieldButtons, replaceInputFocused) => {
@@ -2621,7 +2632,7 @@ const renderContent = (oldState, newState) => {
2621
2632
  useRegularExpression,
2622
2633
  value
2623
2634
  } = newState;
2624
- const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
2635
+ const matchCountText = inputErrorMessage || getMatchCountText(newState.matchIndex, newState.matchCount);
2625
2636
  const {
2626
2637
  findButtonsEnabled,
2627
2638
  replaceButtonsEnabled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "3.7.4",
3
+ "version": "3.7.5",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",