@lvce-editor/find-widget-worker 3.7.3 → 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';
@@ -870,6 +871,7 @@ const TargetValue = 'event.target.value';
870
871
 
871
872
  const Tab = 2;
872
873
  const Enter = 3;
874
+ const Escape = 8;
873
875
  const KeyF = 34;
874
876
  const F4 = 60;
875
877
 
@@ -1961,6 +1963,10 @@ const focusPreviousElement = state => {
1961
1963
 
1962
1964
  const getKeyBindings = () => {
1963
1965
  return [{
1966
+ command: 'FindWidget.close',
1967
+ key: Escape,
1968
+ when: FocusFindWidget$1
1969
+ }, {
1964
1970
  command: 'FindWidget.focusNext',
1965
1971
  key: Enter,
1966
1972
  when: FocusFindWidget$1
@@ -2449,10 +2455,14 @@ const getFindMatchCountClassName = (matchCount, hasValue) => {
2449
2455
  return FindWidgetMatchCount;
2450
2456
  };
2451
2457
 
2452
- const getMatchCountVirtualDom = (matchCountText, matchCount, hasValue) => {
2458
+ const getMatchCountVirtualDom = (matchCountText, matchCount, hasValue, hasError = false) => {
2453
2459
  return [{
2454
2460
  childCount: 1,
2455
2461
  className: getFindMatchCountClassName(matchCount, hasValue),
2462
+ ...(hasError && {
2463
+ id: 'FindWidgetInputError',
2464
+ role: Alert
2465
+ }),
2456
2466
  type: Div
2457
2467
  }, text(matchCountText)];
2458
2468
  };
@@ -2484,7 +2494,7 @@ const getSearchFieldButtonVirtualDom = button => {
2484
2494
  }];
2485
2495
  };
2486
2496
 
2487
- 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 = '') => {
2488
2498
  if (outsideButtons.length > 0) {
2489
2499
  throw new Error('outsideButtons are deprecated');
2490
2500
  }
@@ -2506,6 +2516,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2506
2516
  type: TextArea,
2507
2517
  ...(autofocus && {
2508
2518
  autofocus: true
2519
+ }),
2520
+ ...(ariaDescribedBy && {
2521
+ ariaDescribedBy
2522
+ }),
2523
+ ...(ariaInvalid && {
2524
+ ariaInvalid
2509
2525
  })
2510
2526
  }, {
2511
2527
  childCount: insideButtons.length,
@@ -2530,11 +2546,11 @@ const getFindWidgetFindVirtualDom = (matchCountText, buttons, fieldButtons, matc
2530
2546
  childCount: 2,
2531
2547
  className: FindWidgetFind,
2532
2548
  type: Div
2533
- }, ...getSearchFieldVirtualDom(SearchValue, find(), HandleInput, fieldButtons, [], HandleFocus, extraClassName, inputFocused), {
2549
+ }, ...getSearchFieldVirtualDom(SearchValue, find(), HandleInput, fieldButtons, [], HandleFocus, extraClassName, inputFocused, hasError ? 'FindWidgetInputError' : '', hasError ? 'true' : ''), {
2534
2550
  childCount: 1 + buttons.length,
2535
2551
  className: 'FindWidgetActions',
2536
2552
  type: Div
2537
- }, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue), ...buttons.flatMap(getIconButtonVirtualDom)];
2553
+ }, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue, hasError), ...buttons.flatMap(getIconButtonVirtualDom)];
2538
2554
  };
2539
2555
 
2540
2556
  const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons, replaceFieldButtons, replaceInputFocused) => {
@@ -2616,7 +2632,7 @@ const renderContent = (oldState, newState) => {
2616
2632
  useRegularExpression,
2617
2633
  value
2618
2634
  } = newState;
2619
- const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
2635
+ const matchCountText = inputErrorMessage || getMatchCountText(newState.matchIndex, newState.matchCount);
2620
2636
  const {
2621
2637
  findButtonsEnabled,
2622
2638
  replaceButtonsEnabled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "3.7.3",
3
+ "version": "3.7.5",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",