@telia/teddy 0.4.10 → 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.
|
@@ -19,6 +19,8 @@ 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;
|
|
23
|
+
onSearchKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
22
24
|
};
|
|
23
25
|
type RootContext = {
|
|
24
26
|
selectedMenuItem: string | undefined;
|
|
@@ -29,9 +31,9 @@ type RootContext = {
|
|
|
29
31
|
setPathname: (v: string) => void;
|
|
30
32
|
specifiedLink?: string;
|
|
31
33
|
setSpecifiedLink: (v: string) => void;
|
|
32
|
-
} & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize'>;
|
|
34
|
+
} & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | "onSearchInputChange" | 'onSearchKeyDown'>;
|
|
33
35
|
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;
|
|
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;
|
|
35
37
|
export declare namespace Root {
|
|
36
38
|
var displayName: string;
|
|
37
39
|
}
|
|
@@ -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,24 @@ 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(
|
|
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
|
+
onKeyDown: (e) => {
|
|
700
|
+
if (context == null ? void 0 : context.onSearchKeyDown) {
|
|
701
|
+
context.onSearchKeyDown(e);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
placeholder: "Søk her"
|
|
705
|
+
}
|
|
706
|
+
),
|
|
691
707
|
/* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.ClearButton, {})
|
|
692
708
|
] }),
|
|
693
709
|
/* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Button, { variant: "separated", children: "Søk" })
|
|
@@ -1197,6 +1213,8 @@ function Root({
|
|
|
1197
1213
|
drawerSize = "md",
|
|
1198
1214
|
isSimplified,
|
|
1199
1215
|
currentPath,
|
|
1216
|
+
onSearchInputChange,
|
|
1217
|
+
onSearchKeyDown,
|
|
1200
1218
|
...props
|
|
1201
1219
|
}) {
|
|
1202
1220
|
const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
|
|
@@ -1241,7 +1259,9 @@ function Root({
|
|
|
1241
1259
|
onCartOpenChange,
|
|
1242
1260
|
drawerSize,
|
|
1243
1261
|
specifiedLink,
|
|
1244
|
-
setSpecifiedLink
|
|
1262
|
+
setSpecifiedLink,
|
|
1263
|
+
onSearchInputChange,
|
|
1264
|
+
onSearchKeyDown
|
|
1245
1265
|
},
|
|
1246
1266
|
children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1247
1267
|
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,24 @@ 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(
|
|
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
|
+
onKeyDown: (e) => {
|
|
679
|
+
if (context == null ? void 0 : context.onSearchKeyDown) {
|
|
680
|
+
context.onSearchKeyDown(e);
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
placeholder: "Søk her"
|
|
684
|
+
}
|
|
685
|
+
),
|
|
670
686
|
/* @__PURE__ */ jsx(TextField.ClearButton, {})
|
|
671
687
|
] }),
|
|
672
688
|
/* @__PURE__ */ jsx(TextField.Button, { variant: "separated", children: "Søk" })
|
|
@@ -1176,6 +1192,8 @@ function Root({
|
|
|
1176
1192
|
drawerSize = "md",
|
|
1177
1193
|
isSimplified,
|
|
1178
1194
|
currentPath,
|
|
1195
|
+
onSearchInputChange,
|
|
1196
|
+
onSearchKeyDown,
|
|
1179
1197
|
...props
|
|
1180
1198
|
}) {
|
|
1181
1199
|
const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath));
|
|
@@ -1220,7 +1238,9 @@ function Root({
|
|
|
1220
1238
|
onCartOpenChange,
|
|
1221
1239
|
drawerSize,
|
|
1222
1240
|
specifiedLink,
|
|
1223
|
-
setSpecifiedLink
|
|
1241
|
+
setSpecifiedLink,
|
|
1242
|
+
onSearchInputChange,
|
|
1243
|
+
onSearchKeyDown
|
|
1224
1244
|
},
|
|
1225
1245
|
children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
|
|
1226
1246
|
NavigationMenu,
|