@reykjavik/hanna-react 0.10.124 → 0.10.125

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.
@@ -8,6 +8,8 @@ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
8
8
  const i18n_1 = require("@reykjavik/hanna-utils/i18n");
9
9
  const SearchInput_js_1 = tslib_1.__importDefault(require("./SearchInput.js"));
10
10
  const utils_js_1 = require("./utils.js");
11
+ /** Change methods/types that should update the input value */
12
+ const inputChangeMethods = new Set(['type', 'enter', 'click']);
11
13
  exports.defaultAutosuggestSearchTexts = {
12
14
  is: {
13
15
  label: 'Leit á vefnum',
@@ -76,7 +78,10 @@ const AutosuggestSearch = (props) => {
76
78
  }, inputProps: {
77
79
  ref: inputRef,
78
80
  value: inputValue,
79
- onChange: (_, { newValue }) => {
81
+ onChange: (_, { newValue, method }) => {
82
+ if (!inputChangeMethods.has(method)) {
83
+ return;
84
+ }
80
85
  onInput(newValue);
81
86
  setInputValue(newValue);
82
87
  },
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.10.125
8
+
9
+ _2024-04-10_
10
+
11
+ - fix: Stop updating `AutosuggestSearch` input value on up/down arrow keys
12
+
7
13
  ## 0.10.124
8
14
 
9
15
  _2024-04-05_
@@ -86,7 +92,7 @@ _2023-12-08_
86
92
 
87
93
  - feat: Add component `MainMenu2`
88
94
  - feat: Make `Datepicker` more flexible when parsing manual input strings –
89
- adds several, localized default formats.
95
+ adds several, localized default formats
90
96
  - feat: Add accessibility helper component `FocusTrap`
91
97
  - Decouple all mobile-menu toggling logic from the `Layout` component
92
98
  - feat: Deprecate `useFormatMonitor` media flags `*Hamburger`, `*Topmenu`
@@ -217,7 +223,7 @@ _2023-09-04_
217
223
  - feat: Add props `wrapperProps` to `CarouselStepper`
218
224
  - feat: Remove defeault/implicit seen-effect styling from all
219
225
  components(except `SeenEffect`, `BgBox` and `CenterColumn`) — flag
220
- `startSeen` prop as deprecated.
226
+ `startSeen` prop as deprecated
221
227
  - fix: Export type `MultiselectOption`, deprecate `MultiSelectOption`
222
228
 
223
229
  ## 0.10.101
@@ -302,7 +308,7 @@ _2023-06-01_
302
308
  _2023-05-25_
303
309
 
304
310
  - feat(ts): Export utility type `HtmlProps` from `utils` module — for adding
305
- HTML attributes (including `data-*`) to React components.
311
+ HTML attributes (including `data-*`) to React components
306
312
  - fix: Update dependencies to fix esm–cjs import resolution errors
307
313
 
308
314
  ## 0.10.87
@@ -368,9 +374,9 @@ _2023-02-08_
368
374
 
369
375
  - feat: Automatically close "Hamburger menu" when user clicks `MainMenu` links
370
376
  - feat: Support `MainMenuProps.onItemClick` `MainMenuItem.onClick` returning
371
- `false` to prevent auto-closing of "Hamburger menu".
377
+ `false` to prevent auto-closing of "Hamburger menu"
372
378
  - feat: Add `useHannaUIState` hook to "utils" — exposing `isHamburgerMenuOpen`
373
- and `closeHamburgerMenu()`.
379
+ and `closeHamburgerMenu()`
374
380
  - fix: Toggle `MainMenu` mega panels on repeated top-level link clicks
375
381
  - fix: Close the currently open `MainMenu` mega panels on intra-link click
376
382
  - fix: Close `ContactBubble` on intra-link/button click
@@ -435,7 +441,7 @@ _2022-11-23_
435
441
 
436
442
  - feat: Add prop `onFilesRejected` to `FileInputProps`
437
443
  - feat: Add prop `itemCount` for all Carousel-related components with
438
- `children` — drop requirement for children to be an Array.
444
+ `children` — drop requirement for children to be an Array
439
445
  - feat(ts): Export `ArticleCardsItemProps`, deprecate `ArticleCardProps`
440
446
  - feat(ts): Only allow either `align="right"` or `fullWidth` on `BasicTable`
441
447
  - feat: Make `SiteSearchAutocompleteProps.renderSuggestion` optional
@@ -471,7 +477,7 @@ _2022-09-28_
471
477
  _2022-09-27_
472
478
 
473
479
  - feat: Add controlled props `open` and `onToggle` to `AccordionList` — it now
474
- supports either [controlled or uncontrolled](./README-conventions.md) use.
480
+ supports either [controlled or uncontrolled](./README-conventions.md) use
475
481
  - fix: Squash `useMixedControlState` bugs/misbehavior and improve its typing
476
482
 
477
483
  ## 0.10.68
@@ -499,7 +505,7 @@ _2022-09-14_
499
505
  - fix(ts): Make `PullQuote` & `BlockQuote`'s `by` prop required for `byHref`
500
506
  - fix(ts): Remove accidentally exposed props on several `*Cards` components —
501
507
  these props were never supported and were either a no-op, or resulted in
502
- unstyled garbage.
508
+ unstyled garbage
503
509
 
504
510
  ## 0.10.66
505
511
 
@@ -536,7 +542,7 @@ _2022-08-23_
536
542
  _2022-08-11_
537
543
 
538
544
  - feat: Add mouse-cursor scroll controls for `Carousel`-related components —
539
- Remove mousewheel hijacking behavior.
545
+ Remove mousewheel hijacking behavior
540
546
  - fix: `startSeen` hiding components with `html.before-sprinkling` present
541
547
 
542
548
  ## 0.10.60
@@ -544,7 +550,7 @@ _2022-08-11_
544
550
  _2022-06-24_
545
551
 
546
552
  - fix: Add missing prop `checkOrigin` on `IframeBlock` (default: `false`)
547
- - fix: Support "uncontrolled" use of `CheckboxGroup`, `RadioGroup`, et al.
553
+ - fix: Support "uncontrolled" use of `CheckboxGroup`, `RadioGroup`, et al
548
554
  - fix: Change build to only export CommonJS
549
555
 
550
556
  ## 0.10.59
@@ -573,7 +579,7 @@ _2022-06-07_
573
579
 
574
580
  - **IMPORTANT** feat: Rename package to `@reykjavik/hanna-react` — this means
575
581
  `@hugsmidjan_is/hanna-react` will not receive any more updates. The library
576
- is otherwise the same, with the same compatibility.
582
+ is otherwise the same, with the same compatibility
577
583
  - feat: Add `@reykjavik/hanna-utils` as dependency
578
584
  - feat: Deprecate the `assets` exports (instead use
579
585
  `@reykjavik/hanna-utils/assets`)
@@ -700,7 +706,7 @@ _2022-03-22_
700
706
 
701
707
  - fix: Attempt to Better capture weird `Selectbox` edge cases — Where the
702
708
  browser (or React) snap value to something unexpected because of mismatching
703
- value and/or options.
709
+ value and/or options
704
710
 
705
711
  ## 0.10.32 – 0.10.34
706
712
 
@@ -752,7 +758,7 @@ _2022-03-09_
752
758
  - feat: Deprecate the `event` argument for `Alert`'s `onClose` callback
753
759
  - feat: Add prop `align?: 'right'` to `ButtonBar`
754
760
  - fix: Make `FileInput` image previews (thumbnails) more resilient overall
755
- - fix: Plug memory-leaks caused by `FileInput` image thumbnails.
761
+ - fix: Plug memory-leaks caused by `FileInput` image thumbnails
756
762
  - fix: Add support for "uncontrolled" use of `TextInput` and `Selectbox`
757
763
  - fix: Suppress React's dev warning about preact compatibility workarounds
758
764
 
@@ -788,7 +794,7 @@ _2022-02-28_
788
794
  - feat: `ButtonPrimary`, `ButtonSecondary`, `ButtonTertiary`:
789
795
  - feat: Add prop `variant` with "destructive" option
790
796
  - feat: Add prop `size` — deprecate prop `small`. Primary and Secondary
791
- buttons now have a `wide` size variant.
797
+ buttons now have a `wide` size variant
792
798
 
793
799
  ## 0.10.22
794
800
 
@@ -870,7 +876,7 @@ _2021-10-22_
870
876
  - feat: Add component `RelatedLinks`
871
877
  - feat: Add component `ContentImage`
872
878
  - feat: Add component `ArticleMeta`
873
- - feat: Add component `FooterBadges` for logos/badges/etc.
879
+ - feat: Add component `FooterBadges` for logos/badges/etc
874
880
  - feat: Add seen-effect props to `CenterColumn`
875
881
  - feat: Export type `ProcessOverviewItemProps`
876
882
  - feat: Export type `FooterInfoProps`, add prop `modifier` to
@@ -1088,7 +1094,7 @@ _2020-10-07_
1088
1094
  - target: **Hanna 0.7** markup patterns
1089
1095
  - `Tabs` changes:
1090
1096
  - **BREAKING** feat: Make `Tabs` a "controlled"-only component — with no
1091
- internal "activated" state.
1097
+ internal "activated" state
1092
1098
  - **BREAKING** feat: Rename type `TabsProps` to `TablistProps`
1093
1099
  - **BREAKING** feat: Drop `defaultActiveIdx` prop from `TablistProps`
1094
1100
  - feat: Add props `activeIdx`, `role`, `activateOnFocus`, `aria-label`,
@@ -5,6 +5,8 @@ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
5
5
  import { getTexts } from '@reykjavik/hanna-utils/i18n';
6
6
  import SearchInput from './SearchInput.js';
7
7
  import { useMixedControlState } from './utils.js';
8
+ /** Change methods/types that should update the input value */
9
+ const inputChangeMethods = new Set(['type', 'enter', 'click']);
8
10
  export const defaultAutosuggestSearchTexts = {
9
11
  is: {
10
12
  label: 'Leit á vefnum',
@@ -73,7 +75,10 @@ export const AutosuggestSearch = (props) => {
73
75
  }, inputProps: {
74
76
  ref: inputRef,
75
77
  value: inputValue,
76
- onChange: (_, { newValue }) => {
78
+ onChange: (_, { newValue, method }) => {
79
+ if (!inputChangeMethods.has(method)) {
80
+ return;
81
+ }
77
82
  onInput(newValue);
78
83
  setInputValue(newValue);
79
84
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/hanna-react",
3
- "version": "0.10.124",
3
+ "version": "0.10.125",
4
4
  "author": "Reykjavík (http://www.reykjavik.is)",
5
5
  "contributors": [
6
6
  "Hugsmiðjan ehf (http://www.hugsmidjan.is)",