@thecb/components 6.0.0-beta.19 → 6.0.0-beta.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "6.0.0-beta.19",
3
+ "version": "6.0.0-beta.21",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -78,6 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@babel/runtime": "^7.15.4",
81
+ "core-js": "^3.22.5",
81
82
  "formatted-input": "^1.0.0",
82
83
  "framer-motion": "^1.11.0",
83
84
  "numeral": "^2.0.6",
@@ -4,6 +4,8 @@ import Text from "../text";
4
4
  import { noop } from "../../../util/general";
5
5
  import DropdownIcon from "./DropdownIcon";
6
6
  import styled from "styled-components";
7
+ // support for Array.prototype.at() in older browsers
8
+ import "core-js/proposals/relative-indexing-method";
7
9
 
8
10
  import {
9
11
  WHITE,
@@ -94,7 +96,7 @@ const Dropdown = ({
94
96
  widthFitOptions = false,
95
97
  disabled,
96
98
  hasTitles = false,
97
- autoEraseTypeAhead = true, // legacy behavior as of 05/22
99
+ autoEraseTypeAhead = true,
98
100
  ariaLabelledby,
99
101
  autocompleteValue = "" // autofill item for browsers, like country-name or address-level1 for state
100
102
  }) => {
@@ -173,9 +175,8 @@ const Dropdown = ({
173
175
  break;
174
176
  case "End":
175
177
  e.preventDefault();
176
- optionRefs.current[
177
- optionRefs?.current?.length ?? 0 - 1
178
- ].current.focus();
178
+ console.log("option refs current", optionRefs.current);
179
+ optionRefs.current.at(-1).current.focus();
179
180
  break;
180
181
  case "Escape":
181
182
  if (isOpen) {
@@ -302,7 +303,7 @@ const Dropdown = ({
302
303
  console.log("input change event", e.target);
303
304
  console.log("input change event value", e.target.value);
304
305
  // support autofill and copy/paste
305
- if (e.tarvet.value !== inputValue) {
306
+ if (e.target.value !== inputValue) {
306
307
  setInputValue(e.target.value);
307
308
  }
308
309
  }}