@telia/teddy 0.4.11 → 0.4.12

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.
@@ -20,6 +20,7 @@ export type RootProps = React.ComponentPropsWithoutRef<'div'> & {
20
20
  isSimplified?: boolean;
21
21
  currentPath: string | undefined;
22
22
  onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>, value?: string) => void;
23
+ onSearchKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
23
24
  };
24
25
  type RootContext = {
25
26
  selectedMenuItem: string | undefined;
@@ -30,9 +31,9 @@ type RootContext = {
30
31
  setPathname: (v: string) => void;
31
32
  specifiedLink?: string;
32
33
  setSpecifiedLink: (v: string) => void;
33
- } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | "onSearchInputChange">;
34
+ } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | "onSearchInputChange" | 'onSearchKeyDown'>;
34
35
  export declare const RootContext: React.Context<RootContext | null>;
35
- export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, currentPath, onSearchInputChange, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, currentPath, onSearchInputChange, onSearchKeyDown, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
36
37
  export declare namespace Root {
37
38
  var displayName: string;
38
39
  }
@@ -696,6 +696,11 @@ const SearchField = React.forwardRef(
696
696
  context == null ? void 0 : context.onSearchInputChange(e, (_b = ref.current) == null ? void 0 : _b.value);
697
697
  }
698
698
  },
699
+ onKeyDown: (e) => {
700
+ if (context == null ? void 0 : context.onSearchKeyDown) {
701
+ context.onSearchKeyDown(e);
702
+ }
703
+ },
699
704
  placeholder: "Søk her"
700
705
  }
701
706
  ),
@@ -1209,6 +1214,7 @@ function Root({
1209
1214
  isSimplified,
1210
1215
  currentPath,
1211
1216
  onSearchInputChange,
1217
+ onSearchKeyDown,
1212
1218
  ...props
1213
1219
  }) {
1214
1220
  const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
@@ -1254,7 +1260,8 @@ function Root({
1254
1260
  drawerSize,
1255
1261
  specifiedLink,
1256
1262
  setSpecifiedLink,
1257
- onSearchInputChange
1263
+ onSearchInputChange,
1264
+ onSearchKeyDown
1258
1265
  },
1259
1266
  children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
1260
1267
  NavigationMenu,
@@ -675,6 +675,11 @@ const SearchField = React__default.forwardRef(
675
675
  context == null ? void 0 : context.onSearchInputChange(e, (_b = ref.current) == null ? void 0 : _b.value);
676
676
  }
677
677
  },
678
+ onKeyDown: (e) => {
679
+ if (context == null ? void 0 : context.onSearchKeyDown) {
680
+ context.onSearchKeyDown(e);
681
+ }
682
+ },
678
683
  placeholder: "Søk her"
679
684
  }
680
685
  ),
@@ -1188,6 +1193,7 @@ function Root({
1188
1193
  isSimplified,
1189
1194
  currentPath,
1190
1195
  onSearchInputChange,
1196
+ onSearchKeyDown,
1191
1197
  ...props
1192
1198
  }) {
1193
1199
  const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath));
@@ -1233,7 +1239,8 @@ function Root({
1233
1239
  drawerSize,
1234
1240
  specifiedLink,
1235
1241
  setSpecifiedLink,
1236
- onSearchInputChange
1242
+ onSearchInputChange,
1243
+ onSearchKeyDown
1237
1244
  },
1238
1245
  children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
1239
1246
  NavigationMenu,
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.4.11",
23
+ "version": "0.4.12",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"