@citygross/components 0.8.180 → 0.8.181
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/build/@types/components/Nav/Nav.d.ts +4 -3
- package/build/@types/components/SearchBar/SearchBar.d.ts +4 -4
- package/build/@types/components/SearchBar/SearchBar.styles.d.ts +1 -0
- package/build/cjs/components/src/components/Nav/Nav.js +3 -5
- package/build/cjs/components/src/components/Nav/Nav.js.map +1 -1
- package/build/cjs/components/src/components/SearchBar/SearchBar.js +18 -16
- package/build/cjs/components/src/components/SearchBar/SearchBar.js.map +1 -1
- package/build/cjs/components/src/components/SearchBar/SearchBar.styles.js +3 -1
- package/build/cjs/components/src/components/SearchBar/SearchBar.styles.js.map +1 -1
- package/build/es/components/src/components/Nav/Nav.js +3 -5
- package/build/es/components/src/components/Nav/Nav.js.map +1 -1
- package/build/es/components/src/components/SearchBar/SearchBar.js +19 -17
- package/build/es/components/src/components/SearchBar/SearchBar.js.map +1 -1
- package/build/es/components/src/components/SearchBar/SearchBar.styles.js +3 -2
- package/build/es/components/src/components/SearchBar/SearchBar.styles.js.map +1 -1
- package/package.json +2 -2
|
@@ -14,8 +14,9 @@ export declare type TNav = {
|
|
|
14
14
|
searchCancelLabel?: React.ReactNode;
|
|
15
15
|
searchContainerRef: React.RefObject<HTMLDivElement>;
|
|
16
16
|
searchIcon?: React.ReactNode;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
searchInputLabel?: string;
|
|
18
|
+
searchInputRefDesktop: React.RefObject<HTMLInputElement>;
|
|
19
|
+
searchInputRefMobile: React.RefObject<HTMLInputElement>;
|
|
19
20
|
searchIsOpen?: boolean;
|
|
20
21
|
searchOnChange?: ChangeEventHandler<HTMLInputElement>;
|
|
21
22
|
searchOnSubmit?: () => void;
|
|
@@ -24,4 +25,4 @@ export declare type TNav = {
|
|
|
24
25
|
searchValue?: string;
|
|
25
26
|
topPosition?: number;
|
|
26
27
|
};
|
|
27
|
-
export declare const Nav: ({ closeSearch, height, inputIcon, logo, mainLinks, maxWidth, mobileTopPosition, onSearchBlur, onSearchClick, overlayTopPosition, rightContent, searchCancelLabel, searchContainerRef, searchIcon,
|
|
28
|
+
export declare const Nav: ({ closeSearch, height, inputIcon, logo, mainLinks, maxWidth, mobileTopPosition, onSearchBlur, onSearchClick, overlayTopPosition, rightContent, searchCancelLabel, searchContainerRef, searchIcon, searchInputLabel, searchInputRefDesktop, searchInputRefMobile, searchIsOpen, searchOnChange, searchOnSubmit, searchPlaceHolder, searchResultElement, searchValue, topPosition }: TNav) => JSX.Element;
|
|
@@ -5,11 +5,11 @@ export declare type TSearchBar = styles.TSearchInput & {
|
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
inputIcon?: React.ReactNode;
|
|
8
|
-
inputRef?: React.RefObject<HTMLInputElement>;
|
|
9
8
|
isOpen?: boolean;
|
|
10
9
|
mobileTopPosition?: number;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
searchInputLabel?: string;
|
|
11
|
+
searchInputRefDesktop: React.RefObject<HTMLInputElement>;
|
|
12
|
+
searchInputRefMobile: React.RefObject<HTMLInputElement>;
|
|
13
13
|
searchOnSubmit?: () => void;
|
|
14
14
|
} & InputHTMLAttributes<HTMLInputElement>;
|
|
15
|
-
export declare const SearchBar: ({ activeBorderColor, cancelLabel, children, flexGrow, icon, inputIcon,
|
|
15
|
+
export declare const SearchBar: ({ activeBorderColor, cancelLabel, children, flexGrow, icon, inputIcon, inputSize, isOpen, isValid, mobileTopPosition, searchInputLabel, searchInputRefDesktop, searchInputRefMobile, searchOnSubmit, ...props }: TSearchBar) => JSX.Element;
|
|
@@ -20,4 +20,5 @@ export declare const MobileSearchFormContainer: import("styled-components").Styl
|
|
|
20
20
|
export declare const SearchForm: import("styled-components").StyledComponent<"form", import("styled-components").DefaultTheme, TSearchInput, never>;
|
|
21
21
|
export declare const MobileSearchIconContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
22
22
|
export declare const SearchLeftIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
23
|
+
export declare const HiddenLabel: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {}, never>;
|
|
23
24
|
export {};
|
|
@@ -14,7 +14,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
14
|
|
|
15
15
|
var Nav = function (_a) {
|
|
16
16
|
var _b, _c, _d, _e;
|
|
17
|
-
var closeSearch = _a.closeSearch, height = _a.height, inputIcon = _a.inputIcon, logo = _a.logo, mainLinks = _a.mainLinks, maxWidth = _a.maxWidth, mobileTopPosition = _a.mobileTopPosition, onSearchBlur = _a.onSearchBlur, onSearchClick = _a.onSearchClick, overlayTopPosition = _a.overlayTopPosition, rightContent = _a.rightContent, searchCancelLabel = _a.searchCancelLabel, searchContainerRef = _a.searchContainerRef, searchIcon = _a.searchIcon,
|
|
17
|
+
var closeSearch = _a.closeSearch, height = _a.height, inputIcon = _a.inputIcon, logo = _a.logo, mainLinks = _a.mainLinks, maxWidth = _a.maxWidth, mobileTopPosition = _a.mobileTopPosition, onSearchBlur = _a.onSearchBlur, onSearchClick = _a.onSearchClick, overlayTopPosition = _a.overlayTopPosition, rightContent = _a.rightContent, searchCancelLabel = _a.searchCancelLabel, searchContainerRef = _a.searchContainerRef, searchIcon = _a.searchIcon, searchInputLabel = _a.searchInputLabel, searchInputRefDesktop = _a.searchInputRefDesktop, searchInputRefMobile = _a.searchInputRefMobile, searchIsOpen = _a.searchIsOpen, searchOnChange = _a.searchOnChange, searchOnSubmit = _a.searchOnSubmit, searchPlaceHolder = _a.searchPlaceHolder, searchResultElement = _a.searchResultElement, searchValue = _a.searchValue, topPosition = _a.topPosition;
|
|
18
18
|
var navContainerRef = React.useRef(null);
|
|
19
19
|
var navChildContainerRef = React.useRef(null);
|
|
20
20
|
var navRef = React.useRef(null);
|
|
@@ -51,9 +51,7 @@ var Nav = function (_a) {
|
|
|
51
51
|
setLocalWidth(width);
|
|
52
52
|
};
|
|
53
53
|
React.useEffect(function () {
|
|
54
|
-
var debounce = setTimeout(function () {
|
|
55
|
-
checkWidth === null || checkWidth === void 0 ? void 0 : checkWidth();
|
|
56
|
-
}, 300);
|
|
54
|
+
var debounce = setTimeout(function () { return checkWidth === null || checkWidth === void 0 ? void 0 : checkWidth(); }, 300);
|
|
57
55
|
return function () {
|
|
58
56
|
clearTimeout(debounce);
|
|
59
57
|
};
|
|
@@ -100,7 +98,7 @@ var Nav = function (_a) {
|
|
|
100
98
|
? 'closed'
|
|
101
99
|
: 'open', initial: "open" }, (_e = mainLinks === null || mainLinks === void 0 ? void 0 : mainLinks.slice(0, (mainLinks === null || mainLinks === void 0 ? void 0 : mainLinks.length) - elToRemove)) === null || _e === void 0 ? void 0 : _e.map(function (link) { return link; })),
|
|
102
100
|
React__default["default"].createElement(Nav_styles.SearchContainer, { isOpen: searchIsOpen, ref: searchContainerRef },
|
|
103
|
-
React__default["default"].createElement(SearchBar.SearchBar, { cancelLabel: searchCancelLabel, flexGrow: true, icon: searchIcon, inputIcon: inputIcon,
|
|
101
|
+
React__default["default"].createElement(SearchBar.SearchBar, { cancelLabel: searchCancelLabel, flexGrow: true, icon: searchIcon, inputIcon: inputIcon, isOpen: searchIsOpen, mobileTopPosition: mobileTopPosition, onBlur: onSearchBlur, onChange: searchOnChange, onClick: function () { return onSearchClick === null || onSearchClick === void 0 ? void 0 : onSearchClick(); }, onKeyDown: function (e) { return e.key === 'Enter' && (onSearchClick === null || onSearchClick === void 0 ? void 0 : onSearchClick()); }, placeholder: searchPlaceHolder, searchInputLabel: searchInputLabel, searchInputRefDesktop: searchInputRefDesktop, searchInputRefMobile: searchInputRefMobile, searchOnSubmit: searchOnSubmit, value: searchValue }, searchResultElement))),
|
|
104
102
|
rightContent)),
|
|
105
103
|
React__default["default"].createElement(Nav_styles.SearchResultOverlay, { show: searchIsOpen, overlayTopPosition: overlayTopPosition })));
|
|
106
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nav.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Nav.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -15,7 +15,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
15
15
|
|
|
16
16
|
var SearchBar = function (_a) {
|
|
17
17
|
var _b;
|
|
18
|
-
var activeBorderColor = _a.activeBorderColor, cancelLabel = _a.cancelLabel, children = _a.children, flexGrow = _a.flexGrow, icon = _a.icon, inputIcon = _a.inputIcon,
|
|
18
|
+
var activeBorderColor = _a.activeBorderColor, cancelLabel = _a.cancelLabel, children = _a.children, flexGrow = _a.flexGrow, icon = _a.icon, inputIcon = _a.inputIcon, _c = _a.inputSize, inputSize = _c === void 0 ? 'medium' : _c, isOpen = _a.isOpen, isValid = _a.isValid, mobileTopPosition = _a.mobileTopPosition, searchInputLabel = _a.searchInputLabel, searchInputRefDesktop = _a.searchInputRefDesktop, searchInputRefMobile = _a.searchInputRefMobile, searchOnSubmit = _a.searchOnSubmit, props = _tslib.__rest(_a, ["activeBorderColor", "cancelLabel", "children", "flexGrow", "icon", "inputIcon", "inputSize", "isOpen", "isValid", "mobileTopPosition", "searchInputLabel", "searchInputRefDesktop", "searchInputRefMobile", "searchOnSubmit"]);
|
|
19
19
|
var width = utils.useWindowSize().width;
|
|
20
20
|
var theme = styled.useTheme();
|
|
21
21
|
var isMobile = theme.constants && width < ((_b = theme.constants) === null || _b === void 0 ? void 0 : _b.headerBreakpoint);
|
|
@@ -45,28 +45,30 @@ var SearchBar = function (_a) {
|
|
|
45
45
|
transition: { duration: 0.1, delay: 0.1, ease: 'linear' }
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var handleSubmit = function (e) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
searchOnSubmit === null || searchOnSubmit === void 0 ? void 0 : searchOnSubmit();
|
|
51
|
+
};
|
|
52
|
+
var renderInputField = function (id, ref) { return (React__default["default"].createElement(SearchBar_styles.SearchInput, _tslib.__assign({ activeBorderColor: activeBorderColor, "aria-describedby": "search-help", "aria-haspopup": "dialog", flexGrow: flexGrow, id: id, inputSize: inputSize, isValid: isValid, ref: ref }, props))); };
|
|
48
53
|
return (React__default["default"].createElement(React.Fragment, null,
|
|
49
54
|
React__default["default"].createElement(ScreenReader.ScreenReader, { id: "search-help", string: "S\u00F6kf\u00F6rslag kommer visas medan du skriver" }),
|
|
50
|
-
React__default["default"].createElement(SearchBar_styles.SearchBarContainer, { activeBorderColor: activeBorderColor, flexGrow: flexGrow, inputSize: inputSize, isOpen: isOpen, role: "search" },
|
|
51
|
-
React__default["default"].createElement(SearchBar_styles.SearchForm, { hideInMobile: true, isOpen: isOpen, onSubmit: function (e) {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
searchOnSubmit === null || searchOnSubmit === void 0 ? void 0 : searchOnSubmit();
|
|
54
|
-
} },
|
|
55
|
-
React__default["default"].createElement(SearchBar_styles.SearchLeftIcon, null, inputIcon),
|
|
56
|
-
React__default["default"].createElement(SearchBar_styles.SearchInput, _tslib.__assign({ activeBorderColor: activeBorderColor, "aria-describedby": "search-help", "aria-haspopup": "dialog", "aria-hidden": isMobile, autoComplete: "off", "data-form-type": "other", "data-lpignore": "true", flexGrow: flexGrow, id: "search-input-desktop", inputSize: inputSize, isValid: isValid, ref: inputRef, value: value }, props)),
|
|
57
|
-
cancelLabel && (React__default["default"].createElement(SearchBar_styles.SearchRightLabel, { animate: isOpen ? 'open' : 'closed', initial: "closed", onClick: function (e) { return e.stopPropagation(); }, variants: iconVariants }, cancelLabel))),
|
|
55
|
+
React__default["default"].createElement(SearchBar_styles.SearchBarContainer, { activeBorderColor: activeBorderColor, flexGrow: flexGrow, inputSize: inputSize, isOpen: isOpen, role: "search" }, isMobile ? (React__default["default"].createElement(React.Fragment, null,
|
|
58
56
|
React__default["default"].createElement(SearchBar_styles.MobileSearchIconContainer, null,
|
|
59
57
|
React__default["default"].createElement(SearchBar_styles.SearchLeftIcon, null, icon)),
|
|
60
|
-
React__default["default"].createElement(SearchBar_styles.SearchResultContainer, { animate: isOpen ? 'open' : 'closed', initial: "closed", isOpen: isOpen, mobileTopPosition: mobileTopPosition,
|
|
58
|
+
React__default["default"].createElement(SearchBar_styles.SearchResultContainer, { animate: isOpen ? 'open' : 'closed', initial: "closed", isOpen: isOpen, mobileTopPosition: mobileTopPosition, variants: resultVariants },
|
|
61
59
|
React__default["default"].createElement(SearchBar_styles.MobileSearchFormContainer, null,
|
|
62
|
-
React__default["default"].createElement(SearchBar_styles.SearchForm, { onSubmit:
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
searchOnSubmit === null || searchOnSubmit === void 0 ? void 0 : searchOnSubmit();
|
|
65
|
-
} },
|
|
60
|
+
React__default["default"].createElement(SearchBar_styles.SearchForm, { onSubmit: handleSubmit },
|
|
66
61
|
React__default["default"].createElement(SearchBar_styles.SearchLeftIcon, null, inputIcon),
|
|
67
|
-
React__default["default"].createElement(SearchBar_styles.
|
|
62
|
+
React__default["default"].createElement(SearchBar_styles.HiddenLabel, { htmlFor: "search-input-mobile" }, searchInputLabel || 'Sök'),
|
|
63
|
+
renderInputField('search-input-mobile', searchInputRefMobile),
|
|
68
64
|
cancelLabel && (React__default["default"].createElement(SearchBar_styles.SearchRightLabel, { onClick: function (e) { return e.stopPropagation(); } }, cancelLabel)))),
|
|
69
|
-
children)))
|
|
65
|
+
children))) : (React__default["default"].createElement(React.Fragment, null,
|
|
66
|
+
React__default["default"].createElement(SearchBar_styles.SearchForm, { isOpen: isOpen, onSubmit: handleSubmit },
|
|
67
|
+
React__default["default"].createElement(SearchBar_styles.SearchLeftIcon, null, inputIcon),
|
|
68
|
+
React__default["default"].createElement(SearchBar_styles.HiddenLabel, { htmlFor: "search-input-desktop" }, searchInputLabel || 'Sök'),
|
|
69
|
+
renderInputField('search-input-desktop', searchInputRefDesktop),
|
|
70
|
+
cancelLabel && (React__default["default"].createElement(SearchBar_styles.SearchRightLabel, { animate: isOpen ? 'open' : 'closed', initial: "closed", onClick: function (e) { return e.stopPropagation(); }, variants: iconVariants }, cancelLabel))),
|
|
71
|
+
React__default["default"].createElement(SearchBar_styles.SearchResultContainer, { animate: isOpen ? 'open' : 'closed', initial: "closed", isOpen: isOpen, mobileTopPosition: mobileTopPosition, variants: resultVariants }, children))))));
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
exports.SearchBar = SearchBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -128,8 +128,10 @@ var MobileSearchIconContainer = styled__default["default"].div(templateObject_7
|
|
|
128
128
|
return (_b = theme.constants) === null || _b === void 0 ? void 0 : _b.headerBreakpoint;
|
|
129
129
|
});
|
|
130
130
|
var SearchLeftIcon = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
|
|
131
|
-
var
|
|
131
|
+
var HiddenLabel = styled__default["default"].label(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n"], ["\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n"])));
|
|
132
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
132
133
|
|
|
134
|
+
exports.HiddenLabel = HiddenLabel;
|
|
133
135
|
exports.MobileSearchFormContainer = MobileSearchFormContainer;
|
|
134
136
|
exports.MobileSearchIconContainer = MobileSearchIconContainer;
|
|
135
137
|
exports.SearchBarContainer = SearchBarContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchBar.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ import { Nav as Nav$1, NavContainer, NavChildContainer, NavMainLinks, SearchCont
|
|
|
6
6
|
|
|
7
7
|
var Nav = function (_a) {
|
|
8
8
|
var _b, _c, _d, _e;
|
|
9
|
-
var closeSearch = _a.closeSearch, height = _a.height, inputIcon = _a.inputIcon, logo = _a.logo, mainLinks = _a.mainLinks, maxWidth = _a.maxWidth, mobileTopPosition = _a.mobileTopPosition, onSearchBlur = _a.onSearchBlur, onSearchClick = _a.onSearchClick, overlayTopPosition = _a.overlayTopPosition, rightContent = _a.rightContent, searchCancelLabel = _a.searchCancelLabel, searchContainerRef = _a.searchContainerRef, searchIcon = _a.searchIcon,
|
|
9
|
+
var closeSearch = _a.closeSearch, height = _a.height, inputIcon = _a.inputIcon, logo = _a.logo, mainLinks = _a.mainLinks, maxWidth = _a.maxWidth, mobileTopPosition = _a.mobileTopPosition, onSearchBlur = _a.onSearchBlur, onSearchClick = _a.onSearchClick, overlayTopPosition = _a.overlayTopPosition, rightContent = _a.rightContent, searchCancelLabel = _a.searchCancelLabel, searchContainerRef = _a.searchContainerRef, searchIcon = _a.searchIcon, searchInputLabel = _a.searchInputLabel, searchInputRefDesktop = _a.searchInputRefDesktop, searchInputRefMobile = _a.searchInputRefMobile, searchIsOpen = _a.searchIsOpen, searchOnChange = _a.searchOnChange, searchOnSubmit = _a.searchOnSubmit, searchPlaceHolder = _a.searchPlaceHolder, searchResultElement = _a.searchResultElement, searchValue = _a.searchValue, topPosition = _a.topPosition;
|
|
10
10
|
var navContainerRef = useRef(null);
|
|
11
11
|
var navChildContainerRef = useRef(null);
|
|
12
12
|
var navRef = useRef(null);
|
|
@@ -43,9 +43,7 @@ var Nav = function (_a) {
|
|
|
43
43
|
setLocalWidth(width);
|
|
44
44
|
};
|
|
45
45
|
useEffect(function () {
|
|
46
|
-
var debounce = setTimeout(function () {
|
|
47
|
-
checkWidth === null || checkWidth === void 0 ? void 0 : checkWidth();
|
|
48
|
-
}, 300);
|
|
46
|
+
var debounce = setTimeout(function () { return checkWidth === null || checkWidth === void 0 ? void 0 : checkWidth(); }, 300);
|
|
49
47
|
return function () {
|
|
50
48
|
clearTimeout(debounce);
|
|
51
49
|
};
|
|
@@ -92,7 +90,7 @@ var Nav = function (_a) {
|
|
|
92
90
|
? 'closed'
|
|
93
91
|
: 'open', initial: "open" }, (_e = mainLinks === null || mainLinks === void 0 ? void 0 : mainLinks.slice(0, (mainLinks === null || mainLinks === void 0 ? void 0 : mainLinks.length) - elToRemove)) === null || _e === void 0 ? void 0 : _e.map(function (link) { return link; })),
|
|
94
92
|
React.createElement(SearchContainer, { isOpen: searchIsOpen, ref: searchContainerRef },
|
|
95
|
-
React.createElement(SearchBar, { cancelLabel: searchCancelLabel, flexGrow: true, icon: searchIcon, inputIcon: inputIcon,
|
|
93
|
+
React.createElement(SearchBar, { cancelLabel: searchCancelLabel, flexGrow: true, icon: searchIcon, inputIcon: inputIcon, isOpen: searchIsOpen, mobileTopPosition: mobileTopPosition, onBlur: onSearchBlur, onChange: searchOnChange, onClick: function () { return onSearchClick === null || onSearchClick === void 0 ? void 0 : onSearchClick(); }, onKeyDown: function (e) { return e.key === 'Enter' && (onSearchClick === null || onSearchClick === void 0 ? void 0 : onSearchClick()); }, placeholder: searchPlaceHolder, searchInputLabel: searchInputLabel, searchInputRefDesktop: searchInputRefDesktop, searchInputRefMobile: searchInputRefMobile, searchOnSubmit: searchOnSubmit, value: searchValue }, searchResultElement))),
|
|
96
94
|
rightContent)),
|
|
97
95
|
React.createElement(SearchResultOverlay, { show: searchIsOpen, overlayTopPosition: overlayTopPosition })));
|
|
98
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nav.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Nav.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,11 +3,11 @@ import React, { Fragment } from 'react';
|
|
|
3
3
|
import { useWindowSize } from '@citygross/utils';
|
|
4
4
|
import { useTheme } from 'styled-components';
|
|
5
5
|
import { ScreenReader } from '../ScreenReader/ScreenReader.js';
|
|
6
|
-
import { SearchBarContainer,
|
|
6
|
+
import { SearchBarContainer, MobileSearchIconContainer, SearchLeftIcon, SearchResultContainer, MobileSearchFormContainer, SearchForm, HiddenLabel, SearchRightLabel, SearchInput } from './SearchBar.styles.js';
|
|
7
7
|
|
|
8
8
|
var SearchBar = function (_a) {
|
|
9
9
|
var _b;
|
|
10
|
-
var activeBorderColor = _a.activeBorderColor, cancelLabel = _a.cancelLabel, children = _a.children, flexGrow = _a.flexGrow, icon = _a.icon, inputIcon = _a.inputIcon,
|
|
10
|
+
var activeBorderColor = _a.activeBorderColor, cancelLabel = _a.cancelLabel, children = _a.children, flexGrow = _a.flexGrow, icon = _a.icon, inputIcon = _a.inputIcon, _c = _a.inputSize, inputSize = _c === void 0 ? 'medium' : _c, isOpen = _a.isOpen, isValid = _a.isValid, mobileTopPosition = _a.mobileTopPosition, searchInputLabel = _a.searchInputLabel, searchInputRefDesktop = _a.searchInputRefDesktop, searchInputRefMobile = _a.searchInputRefMobile, searchOnSubmit = _a.searchOnSubmit, props = __rest(_a, ["activeBorderColor", "cancelLabel", "children", "flexGrow", "icon", "inputIcon", "inputSize", "isOpen", "isValid", "mobileTopPosition", "searchInputLabel", "searchInputRefDesktop", "searchInputRefMobile", "searchOnSubmit"]);
|
|
11
11
|
var width = useWindowSize().width;
|
|
12
12
|
var theme = useTheme();
|
|
13
13
|
var isMobile = theme.constants && width < ((_b = theme.constants) === null || _b === void 0 ? void 0 : _b.headerBreakpoint);
|
|
@@ -37,28 +37,30 @@ var SearchBar = function (_a) {
|
|
|
37
37
|
transition: { duration: 0.1, delay: 0.1, ease: 'linear' }
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
var handleSubmit = function (e) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
searchOnSubmit === null || searchOnSubmit === void 0 ? void 0 : searchOnSubmit();
|
|
43
|
+
};
|
|
44
|
+
var renderInputField = function (id, ref) { return (React.createElement(SearchInput, __assign({ activeBorderColor: activeBorderColor, "aria-describedby": "search-help", "aria-haspopup": "dialog", flexGrow: flexGrow, id: id, inputSize: inputSize, isValid: isValid, ref: ref }, props))); };
|
|
40
45
|
return (React.createElement(Fragment, null,
|
|
41
46
|
React.createElement(ScreenReader, { id: "search-help", string: "S\u00F6kf\u00F6rslag kommer visas medan du skriver" }),
|
|
42
|
-
React.createElement(SearchBarContainer, { activeBorderColor: activeBorderColor, flexGrow: flexGrow, inputSize: inputSize, isOpen: isOpen, role: "search" },
|
|
43
|
-
React.createElement(SearchForm, { hideInMobile: true, isOpen: isOpen, onSubmit: function (e) {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
searchOnSubmit === null || searchOnSubmit === void 0 ? void 0 : searchOnSubmit();
|
|
46
|
-
} },
|
|
47
|
-
React.createElement(SearchLeftIcon, null, inputIcon),
|
|
48
|
-
React.createElement(SearchInput, __assign({ activeBorderColor: activeBorderColor, "aria-describedby": "search-help", "aria-haspopup": "dialog", "aria-hidden": isMobile, autoComplete: "off", "data-form-type": "other", "data-lpignore": "true", flexGrow: flexGrow, id: "search-input-desktop", inputSize: inputSize, isValid: isValid, ref: inputRef, value: value }, props)),
|
|
49
|
-
cancelLabel && (React.createElement(SearchRightLabel, { animate: isOpen ? 'open' : 'closed', initial: "closed", onClick: function (e) { return e.stopPropagation(); }, variants: iconVariants }, cancelLabel))),
|
|
47
|
+
React.createElement(SearchBarContainer, { activeBorderColor: activeBorderColor, flexGrow: flexGrow, inputSize: inputSize, isOpen: isOpen, role: "search" }, isMobile ? (React.createElement(Fragment, null,
|
|
50
48
|
React.createElement(MobileSearchIconContainer, null,
|
|
51
49
|
React.createElement(SearchLeftIcon, null, icon)),
|
|
52
|
-
React.createElement(SearchResultContainer, { animate: isOpen ? 'open' : 'closed', initial: "closed", isOpen: isOpen, mobileTopPosition: mobileTopPosition,
|
|
50
|
+
React.createElement(SearchResultContainer, { animate: isOpen ? 'open' : 'closed', initial: "closed", isOpen: isOpen, mobileTopPosition: mobileTopPosition, variants: resultVariants },
|
|
53
51
|
React.createElement(MobileSearchFormContainer, null,
|
|
54
|
-
React.createElement(SearchForm, { onSubmit:
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
searchOnSubmit === null || searchOnSubmit === void 0 ? void 0 : searchOnSubmit();
|
|
57
|
-
} },
|
|
52
|
+
React.createElement(SearchForm, { onSubmit: handleSubmit },
|
|
58
53
|
React.createElement(SearchLeftIcon, null, inputIcon),
|
|
59
|
-
React.createElement(
|
|
54
|
+
React.createElement(HiddenLabel, { htmlFor: "search-input-mobile" }, searchInputLabel || 'Sök'),
|
|
55
|
+
renderInputField('search-input-mobile', searchInputRefMobile),
|
|
60
56
|
cancelLabel && (React.createElement(SearchRightLabel, { onClick: function (e) { return e.stopPropagation(); } }, cancelLabel)))),
|
|
61
|
-
children)))
|
|
57
|
+
children))) : (React.createElement(Fragment, null,
|
|
58
|
+
React.createElement(SearchForm, { isOpen: isOpen, onSubmit: handleSubmit },
|
|
59
|
+
React.createElement(SearchLeftIcon, null, inputIcon),
|
|
60
|
+
React.createElement(HiddenLabel, { htmlFor: "search-input-desktop" }, searchInputLabel || 'Sök'),
|
|
61
|
+
renderInputField('search-input-desktop', searchInputRefDesktop),
|
|
62
|
+
cancelLabel && (React.createElement(SearchRightLabel, { animate: isOpen ? 'open' : 'closed', initial: "closed", onClick: function (e) { return e.stopPropagation(); }, variants: iconVariants }, cancelLabel))),
|
|
63
|
+
React.createElement(SearchResultContainer, { animate: isOpen ? 'open' : 'closed', initial: "closed", isOpen: isOpen, mobileTopPosition: mobileTopPosition, variants: resultVariants }, children))))));
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
export { SearchBar };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -120,7 +120,8 @@ var MobileSearchIconContainer = styled.div(templateObject_7 || (templateObject_7
|
|
|
120
120
|
return (_b = theme.constants) === null || _b === void 0 ? void 0 : _b.headerBreakpoint;
|
|
121
121
|
});
|
|
122
122
|
var SearchLeftIcon = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
|
|
123
|
-
var
|
|
123
|
+
var HiddenLabel = styled.label(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n"], ["\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n width: 1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n"])));
|
|
124
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
124
125
|
|
|
125
|
-
export { MobileSearchFormContainer, MobileSearchIconContainer, SearchBarContainer, SearchForm, SearchInput, SearchLeftIcon, SearchResultContainer, SearchRightLabel };
|
|
126
|
+
export { HiddenLabel, MobileSearchFormContainer, MobileSearchIconContainer, SearchBarContainer, SearchForm, SearchInput, SearchLeftIcon, SearchResultContainer, SearchRightLabel };
|
|
126
127
|
//# sourceMappingURL=SearchBar.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchBar.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.181",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./build/cjs/components/src/index.js",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"react-slick": "^0.30.1",
|
|
75
75
|
"slick-carousel": "^1.8.1"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "37fb8e046406f8b43352beb8d6dcea0995d062f8"
|
|
78
78
|
}
|