@telia/teddy 0.4.10 → 0.4.11

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.
@@ -19,6 +19,7 @@ export type RootProps = React.ComponentPropsWithoutRef<'div'> & {
19
19
  drawerSize: 'md' | 'lg';
20
20
  isSimplified?: boolean;
21
21
  currentPath: string | undefined;
22
+ onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>, value?: string) => void;
22
23
  };
23
24
  type RootContext = {
24
25
  selectedMenuItem: string | undefined;
@@ -29,9 +30,9 @@ type RootContext = {
29
30
  setPathname: (v: string) => void;
30
31
  specifiedLink?: string;
31
32
  setSpecifiedLink: (v: string) => void;
32
- } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize'>;
33
+ } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | "onSearchInputChange">;
33
34
  export declare const RootContext: React.Context<RootContext | null>;
34
- export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, currentPath, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
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;
35
36
  export declare namespace Root {
36
37
  var displayName: string;
37
38
  }
@@ -674,7 +674,6 @@ const SearchField = React.forwardRef(
674
674
  {
675
675
  onSubmit: (e) => {
676
676
  var _a, _b;
677
- console.log("Search submitted,111");
678
677
  if (context == null ? void 0 : context.onSearchSubmit) {
679
678
  context.onSearchSubmit(e, (_a = ref.current) == null ? void 0 : _a.value);
680
679
  }
@@ -687,7 +686,19 @@ const SearchField = React.forwardRef(
687
686
  /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Label, { children: "Søk i innhold" }),
688
687
  /* @__PURE__ */ jsxRuntime.jsxs(components_textField_index.TextField.InputGroup, { children: [
689
688
  /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "search" }),
690
- /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Input, { ref: composedRef, placeholder: "Søk her" }),
689
+ /* @__PURE__ */ jsxRuntime.jsx(
690
+ components_textField_index.TextField.Input,
691
+ {
692
+ ref: composedRef,
693
+ onChange: (e) => {
694
+ var _a, _b;
695
+ if (((_a = ref.current) == null ? void 0 : _a.value) && (context == null ? void 0 : context.onSearchInputChange)) {
696
+ context == null ? void 0 : context.onSearchInputChange(e, (_b = ref.current) == null ? void 0 : _b.value);
697
+ }
698
+ },
699
+ placeholder: "Søk her"
700
+ }
701
+ ),
691
702
  /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.ClearButton, {})
692
703
  ] }),
693
704
  /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Button, { variant: "separated", children: "Søk" })
@@ -1197,6 +1208,7 @@ function Root({
1197
1208
  drawerSize = "md",
1198
1209
  isSimplified,
1199
1210
  currentPath,
1211
+ onSearchInputChange,
1200
1212
  ...props
1201
1213
  }) {
1202
1214
  const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
@@ -1241,7 +1253,8 @@ function Root({
1241
1253
  onCartOpenChange,
1242
1254
  drawerSize,
1243
1255
  specifiedLink,
1244
- setSpecifiedLink
1256
+ setSpecifiedLink,
1257
+ onSearchInputChange
1245
1258
  },
1246
1259
  children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
1247
1260
  NavigationMenu,
@@ -653,7 +653,6 @@ const SearchField = React__default.forwardRef(
653
653
  {
654
654
  onSubmit: (e) => {
655
655
  var _a, _b;
656
- console.log("Search submitted,111");
657
656
  if (context == null ? void 0 : context.onSearchSubmit) {
658
657
  context.onSearchSubmit(e, (_a = ref.current) == null ? void 0 : _a.value);
659
658
  }
@@ -666,7 +665,19 @@ const SearchField = React__default.forwardRef(
666
665
  /* @__PURE__ */ jsx(TextField.Label, { children: "Søk i innhold" }),
667
666
  /* @__PURE__ */ jsxs(TextField.InputGroup, { children: [
668
667
  /* @__PURE__ */ jsx(Icon, { name: "search" }),
669
- /* @__PURE__ */ jsx(TextField.Input, { ref: composedRef, placeholder: "Søk her" }),
668
+ /* @__PURE__ */ jsx(
669
+ TextField.Input,
670
+ {
671
+ ref: composedRef,
672
+ onChange: (e) => {
673
+ var _a, _b;
674
+ if (((_a = ref.current) == null ? void 0 : _a.value) && (context == null ? void 0 : context.onSearchInputChange)) {
675
+ context == null ? void 0 : context.onSearchInputChange(e, (_b = ref.current) == null ? void 0 : _b.value);
676
+ }
677
+ },
678
+ placeholder: "Søk her"
679
+ }
680
+ ),
670
681
  /* @__PURE__ */ jsx(TextField.ClearButton, {})
671
682
  ] }),
672
683
  /* @__PURE__ */ jsx(TextField.Button, { variant: "separated", children: "Søk" })
@@ -1176,6 +1187,7 @@ function Root({
1176
1187
  drawerSize = "md",
1177
1188
  isSimplified,
1178
1189
  currentPath,
1190
+ onSearchInputChange,
1179
1191
  ...props
1180
1192
  }) {
1181
1193
  const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath));
@@ -1220,7 +1232,8 @@ function Root({
1220
1232
  onCartOpenChange,
1221
1233
  drawerSize,
1222
1234
  specifiedLink,
1223
- setSpecifiedLink
1235
+ setSpecifiedLink,
1236
+ onSearchInputChange
1224
1237
  },
1225
1238
  children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
1226
1239
  NavigationMenu,
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.4.10",
23
+ "version": "0.4.11",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"