@digitransit-component/digitransit-component-favourite-bar 0.2.15 → 0.2.16

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/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("react"),require("classnames"),require("i18next"),require("lodash/differenceWith"),require("lodash/isEqual"),require("lodash/isEmpty"),require("lodash/escapeRegExp"),require("@hsl-fi/shimmer"),require("@digitransit-component/digitransit-component-suggestion-item"),require("@digitransit-component/digitransit-component-icon")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","classnames","i18next","lodash/differenceWith","lodash/isEqual","lodash/isEmpty","lodash/escapeRegExp","@hsl-fi/shimmer","@digitransit-component/digitransit-component-suggestion-item","@digitransit-component/digitransit-component-icon"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@digitransit-component/digitransit-component-favourite-bar"]={},e.PropTypes,e.React,e.cx,e.i18next,e.differenceWith,e.isEqual,e.isEmpty,e.escapeRegExp,e.Shimmer,e.SuggestionItem,e.Icon)}(this,(function(e,t,n,o,i,s,r,a,l,u,d,c){"use strict";function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=f(t),p=f(n),g=f(o),m=f(i),h=f(s),v=f(r),y=f(a),x=f(l),w=f(u),b=f(d),k=f(c);function E(){return E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},E.apply(this,arguments)}function q(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function O(e,t){return O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},O(e,t)}function Z(e){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(e)}function L(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}var R={"button-shared":"styles_button-shared__2PvDc","favourite-container":"styles_favourite-container__3qOXZ","favourite-content":"styles_favourite-content__Kmt8p",expandButton:"styles_expandButton__LsEZu","shimmer-shared":"styles_shimmer-shared__3jR0c",shimmer:"styles_shimmer__2JVcb",icon:"styles_icon__gq2jz",place:"styles_place__39zw2",home:"styles_home__2rr1f",school:"styles_school__3DEvY",sport:"styles_sport__2nCvA",shopping:"styles_shopping__3GCTg",work:"styles_work__R9421","favourite-location":"styles_favourite-location__3X3GW",name:"styles_name__2zYXi",address:"styles_address__3MFZL",plus:"styles_plus__2kRMe",arrow:"styles_arrow__14KB0",rotate:"styles_rotate__1muwV","favourite-suggestion-container":"styles_favourite-suggestion-container__3WZFg",divider:"styles_divider__13iXF","favourite-suggestion-list":"styles_favourite-suggestion-list__2U8Vq","favourite-suggestion-item":"styles_favourite-suggestion-item__iEbqw",highlighted:"styles_highlighted__2PFnH",custom:"styles_custom__3RMaa"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".styles_button-shared__2PvDc, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu {\n background-color: #ffffff;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-align: center;\n align-items: center;\n border-radius: 5px;\n border: 1px solid #d9d9d9;\n cursor: pointer; }\n .styles_button-shared__2PvDc:hover, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p:hover, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu:hover {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); }\n\n.styles_shimmer-shared__3jR0c, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p > div, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu > div {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden; }\n .styles_shimmer-shared__3jR0c .styles_shimmer__2JVcb, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p > div .styles_shimmer__2JVcb, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu > div .styles_shimmer__2JVcb {\n border-radius: 5px; }\n\n.styles_favourite-container__3qOXZ {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 1;\n width: 100%;\n height: 50px;\n -ms-flex-negative: 1;\n flex-shrink: 1;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: center;\n align-items: center; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p {\n width: auto;\n min-width: 0;\n -ms-flex: 1;\n flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n height: 100%;\n position: relative;\n margin-right: 8px;\n overflow: hidden; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz {\n display: -ms-flexbox;\n display: flex;\n width: 50px;\n height: 100%;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 1;\n flex-shrink: 1; }\n @media screen and (min-width: 375px) {\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz {\n -ms-flex-negative: 0;\n flex-shrink: 0; } }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz svg {\n width: 20px;\n height: 20px;\n position: relative;\n left: 2px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_place__39zw2 svg {\n width: 24px;\n height: 24px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_home__2rr1f svg, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_school__3DEvY svg, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_sport__2nCvA svg, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_shopping__3GCTg svg {\n width: 18px;\n height: 18px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_work__R9421 svg {\n width: 20px;\n height: 20px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW {\n white-space: nowrap;\n overflow: hidden;\n text-align: start;\n width: 100%;\n -ms-flex-direction: row;\n flex-direction: row; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW .styles_name__2zYXi {\n font-family: 'Gotham Rounded A', 'Gotham Rounded B', 'Roboto', Arial, Georgia, Serif;\n font-size: 15px;\n margin-right: 6px;\n font-weight: var(--font-weight-medium);\n font-stretch: normal;\n font-style: normal;\n line-height: 1;\n letter-spacing: -0.6px;\n color: #333333;\n margin-top: 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW .styles_name__2zYXi:empty {\n margin-top: 0; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW .styles_address__3MFZL {\n font-family: 'Gotham Rounded A', 'Gotham Rounded B', 'Roboto', Arial, Georgia, Serif;\n font-size: 12px;\n margin-right: 6px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.67;\n letter-spacing: -0.48px;\n color: #666666;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu {\n height: 100%;\n width: 42px;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n overflow: hidden; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu > div {\n -ms-flex-pack: center;\n justify-content: center; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu.styles_plus__2kRMe svg {\n width: 16px;\n height: 16px; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu.styles_arrow__14KB0 svg {\n width: 19px;\n height: 19px;\n transform: rotate(90deg); }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu.styles_arrow__14KB0.styles_rotate__1muwV svg {\n transform: rotate(-90deg); }\n\n.styles_favourite-suggestion-container__3WZFg {\n position: relative;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-pack: center;\n justify-content: center;\n padding-top: 9px; }\n .styles_favourite-suggestion-container__3WZFg .styles_divider__13iXF {\n display: block;\n height: 6px;\n background-color: #f4f4f5;\n border-top: 1px solid rgba(0, 0, 0, 0.1); }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-list__2U8Vq {\n max-height: 30vh;\n list-style-type: none;\n padding: 0;\n position: absolute;\n z-index: 20;\n width: 100%;\n margin: 0 auto;\n border-radius: 5px;\n box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.16);\n border: solid 1px rgba(0, 0, 0, 0.1);\n background-color: #ffffff;\n overflow-x: hidden;\n overflow-y: scroll; }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-item__iEbqw {\n cursor: pointer; }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-item__iEbqw.styles_highlighted__2PFnH {\n background-color: #F4F4F5; }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-item__iEbqw.styles_custom__3RMaa {\n font-size: 15px;\n font-weight: var(--font-weight-medium);\n letter-spacing: -0.5; }\n");var X={de:{"add-favourite":"Füge Favorit hinzu","add-home":"Setze Zuhause","add-place":"Setze Ort","add-work":"Setze Arbeitsort",edit:"Bearbeiten","open-favourites":"Öffne Favoriten",home:"Zuhause",work:"Arbeit"},en:{"add-destination":"Set as destination","add-favourite":"Add favourite","add-home":"Add home","add-place":"Add place","add-work":"Add work",edit:"Edit","open-favourites":"Open favourites",home:"Home",work:"Work"},fi:{"add-destination":"Aseta määränpääksi","add-favourite":"Lisää suosikki","add-home":"Lisää koti","add-place":"Lisää paikka","add-work":"Lisää työ",edit:"Muokkaa","open-favourites":"Avaa suosikit",home:"Koti",work:"Työ"},sv:{"add-destination":"Ställa in som destination","add-favourite":"Lägg till favorit","add-home":"Lägg till hem","add-place":"Lägg till plats","add-work":"Lägg till arbete",edit:"Redigera","open-favourites":"Öppna favoriter",home:"Hem",work:"Arbete"}};function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=I(e);if(t){var i=I(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return L(this,n)}}m.default.init({fallbackLng:"fi",defaultNS:"translation",interpolation:{escapeValue:!1}});var F=function(e){var t=e&&(e.key||e.which||e.keyCode)||"";return!(!t||![13," ","Spacebar"].concat([32,"Enter"]).includes(t))&&(e.preventDefault(),!0)},j=function(e){var t=e.className,n=e.clickItem,o=e.iconId,i=e.text,s=e.label,r=e.isLoading,a=e.color,l=""===s?i:"".concat(i," ").concat(s," ").concat(m.default.t("add-destination"));return p.default.createElement("div",{role:"button",tabIndex:"0",className:g.default(R["favourite-content"],R[t]),onClick:n,onKeyDown:function(e){return F(e)&&n()},"aria-label":l},p.default.createElement(w.default,{active:r,className:R.shimmer},p.default.createElement("span",{className:g.default(R.icon,R[o])},p.default.createElement(k.default,{img:o,color:a})),p.default.createElement("div",{className:R["favourite-location"]},p.default.createElement("div",{className:R.name},i),p.default.createElement("div",{className:R.address},s))))};"production"!==process.env.NODE_ENV&&(j.propTypes={clickItem:_.default.func.isRequired,className:_.default.string,iconId:_.default.string,text:_.default.string,label:_.default.string,isLoading:_.default.bool,color:_.default.string.isRequired});var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&O(e,t)}(s,e);var t,n,o,i=S(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this,e)).toggleList=function(){var e=(new Date).getTime()-t.state.timestamp;m.default.language!==t.props.lang&&m.default.changeLanguage(t.props.lang),e>200&&t.setState((function(e){return{listOpen:!e.listOpen,highlightedIndex:0,timestamp:(new Date).getTime()}}))},t.highlightSuggestion=function(e){t.setState({highlightedIndex:e})},t.handleClickOutside=function(e){t.suggestionListRef.current&&t.expandListRef.current&&!t.suggestionListRef.current.contains(e.target)&&!t.expandListRef.current.contains(e.target)&&t.setState({listOpen:!1})},t.suggestionSelected=function(){var e=t.state,n=e.favourites,o=e.highlightedIndex;o<n.length?t.props.onClickFavourite(n[o]):o===n.length?t.props.onAddPlace():o===n.length+1&&t.props.onEdit(),t.toggleList()},t.handleKeyDown=function(e){var n=t.state,o=n.favourites,i=n.highlightedIndex,s=n.listOpen,r=e&&(e.key||e.which||e.keyCode)||"";if(F(e))s?t.suggestionSelected():t.toggleList();else if("Escape"===r||27===r)s&&t.toggleList();else if("ArrowUp"===r||38===r){var a=0===i?o.length+1:i-1;t.highlightSuggestion(a)}else if("ArrowDown"===r||40===r){var l=i===o.length+1?0:i+1;t.highlightSuggestion(l)}else"Tab"!==r&&9!==r||t.setState({listOpen:!1})},t.renderSuggestion=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=t.state.highlightedIndex,s="favourite-suggestion-list--item-".concat(n),r=i===n;return p.default.createElement("li",{key:"favourite-suggestion-item-".concat(n),id:s,className:g.default(R["favourite-suggestion-item"],r&&R.highlighted),onMouseEnter:function(){return t.highlightSuggestion(n)},onClick:t.suggestionSelected,"aria-selected":r,role:"option"},p.default.createElement(b.default,{item:e,iconColor:t.props.color,className:o,fontWeights:t.props.fontWeights}))},t.getCustomSuggestions=function(){var e=[{name:m.default.t("add-place"),selectedIconId:"favourite",color:t.props.color}];return 0===t.props.favourites.length?e:[].concat(e,[{name:m.default.t("edit"),selectedIconId:"edit",iconColor:t.props.color,color:t.props.color}])},t.state={listOpen:!1,highlightedIndex:0,firstFavourite:e.favourites[0]||null,secondFavourite:e.favourites[1]||null,favourites:e.favourites.slice(2,e.favourites.length),timestamp:0},t.expandListRef=p.default.createRef(),t.suggestionListRef=p.default.createRef(),Object.keys(X).forEach((function(e){m.default.addResourceBundle(e,"translation",X[e])})),t}return t=s,o=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.favourites,o=e.favourites;return y.default(h.default(o,n,v.default))&&y.default(h.default(n,o,v.default))&&v.default(o,n)&&!y.default(o)?null:{firstFavourite:o[0]||null,secondFavourite:o[1]||null,favourites:o.slice(2,o.length)}}}],(n=[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.handleClickOutside)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.handleClickOutside)}},{key:"render",value:function(){var e=this,t=this.props,n=t.onClickFavourite,o=t.isLoading,i=t.fontWeights,r=this.state,a=r.listOpen,l=r.favourites,u=r.highlightedIndex,d=r.firstFavourite,c=r.secondFavourite,f=0===this.props.favourites.length?"plus":"arrow";return m.default.language!==this.props.lang&&m.default.changeLanguage(this.props.lang),p.default.createElement("div",{style:{"--font-weight-medium":i.medium}},p.default.createElement("div",{className:R["favourite-container"]},p.default.createElement(j,{text:d&&(d.name||d.address&&d.address.split(",")[0])||m.default.t("add-home"),label:d&&d.address||"",clickItem:function(){return d?n(d):e.props.onAddHome()},iconId:d&&d.selectedIconId?s.FavouriteIconIdToNameMap[d.selectedIconId]:"home",isLoading:o,color:this.props.color}),p.default.createElement(j,{text:c&&(c.name||c.address&&c.address.split(",")[0])||m.default.t("add-work"),label:c&&c.address||"",clickItem:function(){return c?n(c):e.props.onAddWork()},iconId:c&&c.selectedIconId?s.FavouriteIconIdToNameMap[c.selectedIconId]:"work",isLoading:o,color:this.props.color}),p.default.createElement("div",{className:g.default(R.expandButton,R[f],a&&R.rotate),ref:this.expandListRef,id:"favourite-expand-button",onFocus:function(){return e.toggleList()},onKeyDown:function(t){return e.handleKeyDown(t)},onClick:function(){return e.toggleList()},tabIndex:"0",role:"listbox","aria-label":m.default.t("open-favourites"),"aria-owns":l.map((function(e,t){return"favourite-suggestion-list--item-".concat(t)})).join(" "),"aria-activedescendant":"favourite-suggestion-list--item-".concat(u)},p.default.createElement(w.default,{active:o},p.default.createElement(k.default,{img:f,color:this.props.color})))),p.default.createElement("div",{className:R["favourite-suggestion-container"]},a&&p.default.createElement("ul",{className:R["favourite-suggestion-list"],id:"favourite-suggestion-list",ref:this.suggestionListRef},l.map((function(t,n){return e.renderSuggestion(E({},t,{address:t.address?t.address.replace(new RegExp("".concat(x.default(t.name),"(,)?( )?")),""):"",iconColor:e.props.color}),n)})),l.length>0&&p.default.createElement("div",{className:R.divider}),this.getCustomSuggestions().map((function(t,n){return e.renderSuggestion(E({},t,{iconColor:e.props.color}),l.length+n,"favouriteCustom")})))))}}])&&q(t.prototype,n),o&&q(t,o),s}(p.default.Component);C.defaultProps={onClickFavourite:function(){return{}},onAddPlace:function(){return{}},onEdit:function(){return{}},onAddHome:function(){return{}},onAddWork:function(){return{}},lang:"fi",isLoading:!1,color:"#007ac9",fontWeights:{medium:500}},C.FavouriteIconIdToNameMap={"icon-icon_place":"place","icon-icon_home":"home","icon-icon_work":"work","icon-icon_sport":"sport","icon-icon_school":"school","icon-icon_shopping":"shopping"},"production"!==process.env.NODE_ENV&&(C.propTypes={favourites:_.default.arrayOf(_.default.shape({address:_.default.string,gtfsId:_.default.string,gid:_.default.string,lat:_.default.number,name:_.default.string,lon:_.default.number,selectedIconId:_.default.string,favouriteId:_.default.string})).isRequired,onClickFavourite:_.default.func,onAddPlace:_.default.func,onEdit:_.default.func,onAddHome:_.default.func,onAddWork:_.default.func,lang:_.default.string,isLoading:_.default.bool,color:_.default.string,fontWeights:_.default.shape({medium:_.default.number})}),e.default=C,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("react"),require("classnames"),require("i18next"),require("lodash/differenceWith"),require("lodash/isEqual"),require("lodash/isEmpty"),require("lodash/escapeRegExp"),require("@hsl-fi/shimmer"),require("@digitransit-component/digitransit-component-suggestion-item"),require("@digitransit-component/digitransit-component-icon")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","classnames","i18next","lodash/differenceWith","lodash/isEqual","lodash/isEmpty","lodash/escapeRegExp","@hsl-fi/shimmer","@digitransit-component/digitransit-component-suggestion-item","@digitransit-component/digitransit-component-icon"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@digitransit-component/digitransit-component-favourite-bar"]={},e.PropTypes,e.React,e.cx,e.i18next,e.differenceWith,e.isEqual,e.isEmpty,e.escapeRegExp,e.Shimmer,e.SuggestionItem,e.Icon)}(this,(function(e,t,n,o,i,s,r,a,l,u,d,c){"use strict";function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=f(t),p=f(n),g=f(o),h=f(i),m=f(s),v=f(r),y=f(a),x=f(l),w=f(u),b=f(d),k=f(c);function E(){return E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},E.apply(this,arguments)}function q(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function O(e,t){return O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},O(e,t)}function Z(e){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(e)}function L(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}var R={"button-shared":"styles_button-shared__2PvDc","favourite-container":"styles_favourite-container__3qOXZ","favourite-content":"styles_favourite-content__Kmt8p",expandButton:"styles_expandButton__LsEZu","shimmer-shared":"styles_shimmer-shared__3jR0c",shimmer:"styles_shimmer__2JVcb",icon:"styles_icon__gq2jz",place:"styles_place__39zw2",home:"styles_home__2rr1f",school:"styles_school__3DEvY",sport:"styles_sport__2nCvA",shopping:"styles_shopping__3GCTg",work:"styles_work__R9421","favourite-location":"styles_favourite-location__3X3GW",name:"styles_name__2zYXi",address:"styles_address__3MFZL",plus:"styles_plus__2kRMe",arrow:"styles_arrow__14KB0",rotate:"styles_rotate__1muwV","favourite-suggestion-container":"styles_favourite-suggestion-container__3WZFg",divider:"styles_divider__13iXF","favourite-suggestion-list":"styles_favourite-suggestion-list__2U8Vq","favourite-suggestion-item":"styles_favourite-suggestion-item__iEbqw",highlighted:"styles_highlighted__2PFnH",custom:"styles_custom__3RMaa"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".styles_button-shared__2PvDc, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu {\n background-color: #ffffff;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n border-radius: 5px;\n border: 1px solid #d9d9d9;\n cursor: pointer; }\n .styles_button-shared__2PvDc:hover, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p:hover, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu:hover {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); }\n\n.styles_shimmer-shared__3jR0c, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p > div, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu > div {\n display: flex;\n align-items: center;\n overflow: hidden; }\n .styles_shimmer-shared__3jR0c .styles_shimmer__2JVcb, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p > div .styles_shimmer__2JVcb, .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu > div .styles_shimmer__2JVcb {\n border-radius: 5px; }\n\n.styles_favourite-container__3qOXZ {\n display: flex;\n position: relative;\n z-index: 1;\n width: 100%;\n height: 50px;\n flex-shrink: 1;\n flex-direction: row;\n justify-content: space-between;\n align-items: center; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p {\n width: auto;\n min-width: 0;\n flex: 1;\n flex-grow: 1;\n height: 100%;\n position: relative;\n margin-right: 8px;\n overflow: hidden; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz {\n display: flex;\n width: 50px;\n height: 100%;\n justify-content: center;\n align-items: center;\n flex-shrink: 1; }\n @media screen and (min-width: 375px) {\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz {\n flex-shrink: 0; } }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz svg {\n width: 20px;\n height: 20px;\n position: relative;\n left: 2px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_place__39zw2 svg {\n width: 24px;\n height: 24px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_home__2rr1f svg, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_school__3DEvY svg, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_sport__2nCvA svg, .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_shopping__3GCTg svg {\n width: 18px;\n height: 18px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_icon__gq2jz.styles_work__R9421 svg {\n width: 20px;\n height: 20px; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW {\n white-space: nowrap;\n overflow: hidden;\n text-align: start;\n width: 100%;\n flex-direction: row; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW .styles_name__2zYXi {\n font-family: 'Gotham Rounded A', 'Gotham Rounded B', 'Roboto', Arial, Georgia, Serif;\n font-size: 15px;\n margin-right: 6px;\n font-weight: var(--font-weight-medium);\n font-stretch: normal;\n font-style: normal;\n line-height: 1;\n letter-spacing: -0.6px;\n color: #333333;\n margin-top: 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW .styles_name__2zYXi:empty {\n margin-top: 0; }\n .styles_favourite-container__3qOXZ .styles_favourite-content__Kmt8p .styles_favourite-location__3X3GW .styles_address__3MFZL {\n font-family: 'Gotham Rounded A', 'Gotham Rounded B', 'Roboto', Arial, Georgia, Serif;\n font-size: 12px;\n margin-right: 6px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.67;\n letter-spacing: -0.48px;\n color: #666666;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu {\n height: 100%;\n width: 42px;\n flex-shrink: 0;\n overflow: hidden; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu > div {\n justify-content: center; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu.styles_plus__2kRMe svg {\n width: 16px;\n height: 16px; }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu.styles_arrow__14KB0 svg {\n width: 19px;\n height: 19px;\n transform: rotate(90deg); }\n .styles_favourite-container__3qOXZ .styles_expandButton__LsEZu.styles_arrow__14KB0.styles_rotate__1muwV svg {\n transform: rotate(-90deg); }\n\n.styles_favourite-suggestion-container__3WZFg {\n position: relative;\n display: flex;\n justify-content: center;\n padding-top: 9px; }\n .styles_favourite-suggestion-container__3WZFg .styles_divider__13iXF {\n display: block;\n height: 6px;\n background-color: #f4f4f5;\n border-top: 1px solid rgba(0, 0, 0, 0.1); }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-list__2U8Vq {\n max-height: 30vh;\n list-style-type: none;\n padding: 0;\n position: absolute;\n z-index: 20;\n width: 100%;\n margin: 0 auto;\n border-radius: 5px;\n box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.16);\n border: solid 1px rgba(0, 0, 0, 0.1);\n background-color: #ffffff;\n overflow-x: hidden;\n overflow-y: scroll; }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-item__iEbqw {\n cursor: pointer; }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-item__iEbqw.styles_highlighted__2PFnH {\n background-color: #F4F4F5; }\n .styles_favourite-suggestion-container__3WZFg .styles_favourite-suggestion-item__iEbqw.styles_custom__3RMaa {\n font-size: 15px;\n font-weight: var(--font-weight-medium);\n letter-spacing: -0.5; }\n");var X={de:{"add-favourite":"Füge Favorit hinzu","add-home":"Setze Zuhause","add-place":"Setze Ort","add-work":"Setze Arbeitsort",edit:"Bearbeiten","open-favourites":"Öffne Favoriten",home:"Zuhause",work:"Arbeit"},en:{"add-destination":"Set as destination","add-favourite":"Add favourite","add-home":"Add home","add-place":"Add place","add-work":"Add work",edit:"Edit","open-favourites":"Open favourites",home:"Home",work:"Work"},fi:{"add-destination":"Aseta määränpääksi","add-favourite":"Lisää suosikki","add-home":"Lisää koti","add-place":"Lisää paikka","add-work":"Lisää työ",edit:"Muokkaa","open-favourites":"Avaa suosikit",home:"Koti",work:"Työ"},sv:{"add-destination":"Ställa in som destination","add-favourite":"Lägg till favorit","add-home":"Lägg till hem","add-place":"Lägg till plats","add-work":"Lägg till arbete",edit:"Redigera","open-favourites":"Öppna favoriter",home:"Hem",work:"Arbete"}};function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=I(e);if(t){var i=I(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return L(this,n)}}h.default.init({fallbackLng:"fi",defaultNS:"translation",interpolation:{escapeValue:!1}});var F=function(e){var t=e&&(e.key||e.which||e.keyCode)||"";return!(!t||![13," ","Spacebar"].concat([32,"Enter"]).includes(t))&&(e.preventDefault(),!0)},j=function(e){var t=e.className,n=e.clickItem,o=e.iconId,i=e.text,s=e.label,r=e.isLoading,a=e.color,l=""===s?i:"".concat(i," ").concat(s," ").concat(h.default.t("add-destination"));return p.default.createElement("div",{role:"button",tabIndex:"0",className:g.default(R["favourite-content"],R[t]),onClick:n,onKeyDown:function(e){return F(e)&&n()},"aria-label":l},p.default.createElement(w.default,{active:r,className:R.shimmer},p.default.createElement("span",{className:g.default(R.icon,R[o])},p.default.createElement(k.default,{img:o,color:a})),p.default.createElement("div",{className:R["favourite-location"]},p.default.createElement("div",{className:R.name},i),p.default.createElement("div",{className:R.address},s))))};"production"!==process.env.NODE_ENV&&(j.propTypes={clickItem:_.default.func.isRequired,className:_.default.string,iconId:_.default.string,text:_.default.string,label:_.default.string,isLoading:_.default.bool,color:_.default.string.isRequired});var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&O(e,t)}(s,e);var t,n,o,i=S(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this,e)).toggleList=function(){var e=(new Date).getTime()-t.state.timestamp;h.default.language!==t.props.lang&&h.default.changeLanguage(t.props.lang),e>200&&t.setState((function(e){return{listOpen:!e.listOpen,highlightedIndex:0,timestamp:(new Date).getTime()}}))},t.highlightSuggestion=function(e){t.setState({highlightedIndex:e})},t.handleClickOutside=function(e){t.suggestionListRef.current&&t.expandListRef.current&&!t.suggestionListRef.current.contains(e.target)&&!t.expandListRef.current.contains(e.target)&&t.setState({listOpen:!1})},t.suggestionSelected=function(){var e=t.state,n=e.favourites,o=e.highlightedIndex;o<n.length?t.props.onClickFavourite(n[o]):o===n.length?t.props.onAddPlace():o===n.length+1&&t.props.onEdit(),t.toggleList()},t.handleKeyDown=function(e){var n=t.state,o=n.favourites,i=n.highlightedIndex,s=n.listOpen,r=e&&(e.key||e.which||e.keyCode)||"";if(F(e))s?t.suggestionSelected():t.toggleList();else if("Escape"===r||27===r)s&&t.toggleList();else if("ArrowUp"===r||38===r){var a=0===i?o.length+1:i-1;t.highlightSuggestion(a)}else if("ArrowDown"===r||40===r){var l=i===o.length+1?0:i+1;t.highlightSuggestion(l)}else"Tab"!==r&&9!==r||t.setState({listOpen:!1})},t.renderSuggestion=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=t.state.highlightedIndex,s="favourite-suggestion-list--item-".concat(n),r=i===n;return p.default.createElement("li",{key:"favourite-suggestion-item-".concat(n),id:s,className:g.default(R["favourite-suggestion-item"],r&&R.highlighted),onMouseEnter:function(){return t.highlightSuggestion(n)},onClick:t.suggestionSelected,"aria-selected":r,role:"option"},p.default.createElement(b.default,{item:e,iconColor:t.props.color,className:o,fontWeights:t.props.fontWeights}))},t.getCustomSuggestions=function(){var e=[{name:h.default.t("add-place"),selectedIconId:"favourite",color:t.props.color}];return 0===t.props.favourites.length?e:[].concat(e,[{name:h.default.t("edit"),selectedIconId:"edit",iconColor:t.props.color,color:t.props.color}])},t.state={listOpen:!1,highlightedIndex:0,firstFavourite:e.favourites[0]||null,secondFavourite:e.favourites[1]||null,favourites:e.favourites.slice(2,e.favourites.length),timestamp:0},t.expandListRef=p.default.createRef(),t.suggestionListRef=p.default.createRef(),Object.keys(X).forEach((function(e){h.default.addResourceBundle(e,"translation",X[e])})),t}return t=s,o=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.favourites,o=e.favourites;return y.default(m.default(o,n,v.default))&&y.default(m.default(n,o,v.default))&&v.default(o,n)&&!y.default(o)?null:{firstFavourite:o[0]||null,secondFavourite:o[1]||null,favourites:o.slice(2,o.length)}}}],(n=[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.handleClickOutside)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.handleClickOutside)}},{key:"render",value:function(){var e=this,t=this.props,n=t.onClickFavourite,o=t.isLoading,i=t.fontWeights,r=this.state,a=r.listOpen,l=r.favourites,u=r.highlightedIndex,d=r.firstFavourite,c=r.secondFavourite,f=0===this.props.favourites.length?"plus":"arrow";return h.default.language!==this.props.lang&&h.default.changeLanguage(this.props.lang),p.default.createElement("div",{style:{"--font-weight-medium":i.medium}},p.default.createElement("div",{className:R["favourite-container"]},p.default.createElement(j,{text:d&&(d.name||d.address&&d.address.split(",")[0])||h.default.t("add-home"),label:d&&d.address||"",clickItem:function(){return d?n(d):e.props.onAddHome()},iconId:d&&d.selectedIconId?s.FavouriteIconIdToNameMap[d.selectedIconId]:"home",isLoading:o,color:this.props.color}),p.default.createElement(j,{text:c&&(c.name||c.address&&c.address.split(",")[0])||h.default.t("add-work"),label:c&&c.address||"",clickItem:function(){return c?n(c):e.props.onAddWork()},iconId:c&&c.selectedIconId?s.FavouriteIconIdToNameMap[c.selectedIconId]:"work",isLoading:o,color:this.props.color}),p.default.createElement("div",{className:g.default(R.expandButton,R[f],a&&R.rotate),ref:this.expandListRef,id:"favourite-expand-button",onFocus:function(){return e.toggleList()},onKeyDown:function(t){return e.handleKeyDown(t)},onClick:function(){return e.toggleList()},tabIndex:"0",role:"listbox","aria-label":h.default.t("open-favourites"),"aria-owns":l.map((function(e,t){return"favourite-suggestion-list--item-".concat(t)})).join(" "),"aria-activedescendant":"favourite-suggestion-list--item-".concat(u)},p.default.createElement(w.default,{active:o},p.default.createElement(k.default,{img:f,color:this.props.color})))),p.default.createElement("div",{className:R["favourite-suggestion-container"]},a&&p.default.createElement("ul",{className:R["favourite-suggestion-list"],id:"favourite-suggestion-list",ref:this.suggestionListRef},l.map((function(t,n){return e.renderSuggestion(E({},t,{address:t.address?t.address.replace(new RegExp("".concat(x.default(t.name),"(,)?( )?")),""):"",iconColor:e.props.color}),n)})),l.length>0&&p.default.createElement("div",{className:R.divider}),this.getCustomSuggestions().map((function(t,n){return e.renderSuggestion(E({},t,{iconColor:e.props.color}),l.length+n,"favouriteCustom")})))))}}])&&q(t.prototype,n),o&&q(t,o),s}(p.default.Component);C.defaultProps={onClickFavourite:function(){return{}},onAddPlace:function(){return{}},onEdit:function(){return{}},onAddHome:function(){return{}},onAddWork:function(){return{}},lang:"fi",isLoading:!1,color:"#007ac9",fontWeights:{medium:500}},C.FavouriteIconIdToNameMap={"icon-icon_place":"place","icon-icon_home":"home","icon-icon_work":"work","icon-icon_sport":"sport","icon-icon_school":"school","icon-icon_shopping":"shopping"},"production"!==process.env.NODE_ENV&&(C.propTypes={favourites:_.default.arrayOf(_.default.shape({address:_.default.string,gtfsId:_.default.string,gid:_.default.string,lat:_.default.number,name:_.default.string,lon:_.default.number,selectedIconId:_.default.string,favouriteId:_.default.string})).isRequired,onClickFavourite:_.default.func,onAddPlace:_.default.func,onEdit:_.default.func,onAddHome:_.default.func,onAddWork:_.default.func,lang:_.default.string,isLoading:_.default.bool,color:_.default.string,fontWeights:_.default.shape({medium:_.default.number})}),e.default=C,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../../../node_modules/style-inject/dist/style-inject.es.js","../src/helpers/translations.js","../src/index.js","../../../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","const translations = {\n de: {\n 'add-favourite': 'Füge Favorit hinzu',\n 'add-home': 'Setze Zuhause',\n 'add-place': 'Setze Ort',\n 'add-work': 'Setze Arbeitsort',\n edit: 'Bearbeiten',\n 'open-favourites': 'Öffne Favoriten',\n home: 'Zuhause',\n work: 'Arbeit',\n },\n en: {\n 'add-destination': 'Set as destination',\n 'add-favourite': 'Add favourite',\n 'add-home': 'Add home',\n 'add-place': 'Add place',\n 'add-work': 'Add work',\n edit: 'Edit',\n 'open-favourites': 'Open favourites',\n home: 'Home',\n work: 'Work',\n },\n fi: {\n 'add-destination': 'Aseta määränpääksi',\n 'add-favourite': 'Lisää suosikki',\n 'add-home': 'Lisää koti',\n 'add-place': 'Lisää paikka',\n 'add-work': 'Lisää työ',\n edit: 'Muokkaa',\n 'open-favourites': 'Avaa suosikit',\n home: 'Koti',\n work: 'Työ',\n },\n sv: {\n 'add-destination': 'Ställa in som destination',\n 'add-favourite': 'Lägg till favorit',\n 'add-home': 'Lägg till hem',\n 'add-place': 'Lägg till plats',\n 'add-work': 'Lägg till arbete',\n edit: 'Redigera',\n 'open-favourites': 'Öppna favoriter',\n home: 'Hem',\n work: 'Arbete',\n },\n};\n\nexport default translations;\n","import PropTypes from 'prop-types';\nimport React from 'react';\nimport cx from 'classnames';\nimport i18next from 'i18next';\nimport differenceWith from 'lodash/differenceWith';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport escapeRegExp from 'lodash/escapeRegExp';\nimport Shimmer from '@hsl-fi/shimmer';\nimport SuggestionItem from '@digitransit-component/digitransit-component-suggestion-item';\nimport Icon from '@digitransit-component/digitransit-component-icon';\nimport styles from './helpers/styles.scss';\nimport translations from './helpers/translations';\n\ni18next.init({\n fallbackLng: 'fi',\n defaultNS: 'translation',\n interpolation: {\n escapeValue: false, // not needed for react as it escapes by default\n },\n});\n\nconst isKeyboardSelectionEvent = event => {\n const space = [13, ' ', 'Spacebar'];\n const enter = [32, 'Enter'];\n const key = (event && (event.key || event.which || event.keyCode)) || '';\n if (!key || !space.concat(enter).includes(key)) {\n return false;\n }\n event.preventDefault();\n return true;\n};\n\nconst FavouriteLocation = ({\n className,\n clickItem,\n iconId,\n text,\n label,\n isLoading,\n color,\n}) => {\n const ariaLabel =\n label === '' ? text : `${text} ${label} ${i18next.t('add-destination')}`;\n return (\n <div\n role=\"button\"\n tabIndex=\"0\"\n className={cx(styles['favourite-content'], styles[className])}\n onClick={clickItem}\n onKeyDown={e => isKeyboardSelectionEvent(e) && clickItem()}\n aria-label={ariaLabel}\n >\n <Shimmer active={isLoading} className={styles.shimmer}>\n <span className={cx(styles.icon, styles[iconId])}>\n <Icon img={iconId} color={color} />\n </span>\n <div className={styles['favourite-location']}>\n <div className={styles.name}>{text}</div>\n <div className={styles.address}>{label}</div>\n </div>\n </Shimmer>\n </div>\n );\n};\n\nFavouriteLocation.propTypes = {\n clickItem: PropTypes.func.isRequired,\n className: PropTypes.string,\n iconId: PropTypes.string,\n text: PropTypes.string,\n label: PropTypes.string,\n isLoading: PropTypes.bool,\n color: PropTypes.string.isRequired,\n};\n\n/**\n * FavouriteBar renders favourites. FavouriteBar displays the first two favourites, the rest are shown in a list.\n * @example\n * <FavouriteBar\n * favourites={favourites}\n * onClickFavourite={onClickFavourite}\n * onAddPlace={this.addPlace}\n * onAddHome={this.addHome}\n * onAddWork={this.addWork}\n * lang={this.props.lang}\n * isLoading={this.props.isLoading}\n * />\n */\nclass FavouriteBar extends React.Component {\n static propTypes = {\n /** Required. Array of favourites, favourite object contains following properties.\n * @type {Array<object>}\n * @property {string} address\n * @property {string} gtfsId\n * @property {string} gid\n * @property {number} lat\n * @property {number} lon\n * @property {string} name\n * @property {string} selectedIconId\n * @property {string} favouriteId\n */\n favourites: PropTypes.arrayOf(\n PropTypes.shape({\n address: PropTypes.string,\n gtfsId: PropTypes.string,\n gid: PropTypes.string,\n lat: PropTypes.number,\n name: PropTypes.string,\n lon: PropTypes.number,\n selectedIconId: PropTypes.string,\n favouriteId: PropTypes.string,\n }),\n ).isRequired,\n /** Optional. Function for clicking favourites. */\n onClickFavourite: PropTypes.func,\n /** Optional. Function for selecting \"Add place\" from suggestions. */\n onAddPlace: PropTypes.func,\n /** Optional. Function for selected \"Edit\" from suggestions. */\n onEdit: PropTypes.func,\n /** Optional. Function for \"Add home\" button. */\n onAddHome: PropTypes.func,\n /** Optional. Function for \"Add work\" button. */\n onAddWork: PropTypes.func,\n /** Optional. Language, fi, en or sv. */\n lang: PropTypes.string,\n /** Optional. Whether to show loading animation, true or false. */\n isLoading: PropTypes.bool,\n /** Optional. Default value is '#007ac9'. */\n color: PropTypes.string,\n /** Optional. */\n fontWeights: PropTypes.shape({\n /** Default value is 500. */\n medium: PropTypes.number,\n }),\n };\n\n static defaultProps = {\n onClickFavourite: () => ({}),\n onAddPlace: () => ({}),\n onEdit: () => ({}),\n onAddHome: () => ({}),\n onAddWork: () => ({}),\n lang: 'fi',\n isLoading: false,\n color: '#007ac9',\n fontWeights: {\n medium: 500,\n },\n };\n\n static FavouriteIconIdToNameMap = {\n 'icon-icon_place': 'place',\n 'icon-icon_home': 'home',\n 'icon-icon_work': 'work',\n 'icon-icon_sport': 'sport',\n 'icon-icon_school': 'school',\n 'icon-icon_shopping': 'shopping',\n };\n\n constructor(props) {\n super(props);\n this.state = {\n listOpen: false,\n highlightedIndex: 0,\n firstFavourite: props.favourites[0] || null,\n secondFavourite: props.favourites[1] || null,\n favourites: props.favourites.slice(2, props.favourites.length),\n timestamp: 0,\n };\n this.expandListRef = React.createRef();\n this.suggestionListRef = React.createRef();\n Object.keys(translations).forEach(lang => {\n i18next.addResourceBundle(lang, 'translation', translations[lang]);\n });\n }\n\n componentDidMount() {\n document.addEventListener('mousedown', this.handleClickOutside);\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { favourites } = prevState;\n const nextFavourites = nextProps.favourites;\n if (\n !isEmpty(differenceWith(nextFavourites, favourites, isEqual)) ||\n !isEmpty(differenceWith(favourites, nextFavourites, isEqual)) ||\n !isEqual(nextFavourites, favourites) ||\n isEmpty(nextFavourites)\n ) {\n return {\n firstFavourite: nextFavourites[0] || null,\n secondFavourite: nextFavourites[1] || null,\n favourites: nextFavourites.slice(2, nextFavourites.length),\n };\n }\n return null;\n }\n\n componentWillUnmount() {\n document.removeEventListener('mousedown', this.handleClickOutside);\n }\n\n toggleList = () => {\n const eventDiff = new Date().getTime() - this.state.timestamp;\n if (i18next.language !== this.props.lang) {\n i18next.changeLanguage(this.props.lang);\n }\n if (eventDiff > 200) {\n this.setState(prevState => ({\n listOpen: !prevState.listOpen,\n highlightedIndex: 0,\n timestamp: new Date().getTime(),\n }));\n }\n };\n\n highlightSuggestion = index => {\n this.setState({ highlightedIndex: index });\n };\n\n handleClickOutside = event => {\n if (\n this.suggestionListRef.current &&\n this.expandListRef.current &&\n !this.suggestionListRef.current.contains(event.target) &&\n !this.expandListRef.current.contains(event.target)\n ) {\n this.setState({\n listOpen: false,\n });\n }\n };\n\n suggestionSelected = () => {\n const { favourites, highlightedIndex } = this.state;\n if (highlightedIndex < favourites.length) {\n this.props.onClickFavourite(favourites[highlightedIndex]);\n } else if (highlightedIndex === favourites.length) {\n this.props.onAddPlace();\n } else if (highlightedIndex === favourites.length + 1) {\n this.props.onEdit();\n }\n this.toggleList();\n };\n\n handleKeyDown = event => {\n const { favourites, highlightedIndex, listOpen } = this.state;\n const key = (event && (event.key || event.which || event.keyCode)) || '';\n if (isKeyboardSelectionEvent(event)) {\n if (!listOpen) {\n this.toggleList();\n } else {\n this.suggestionSelected();\n }\n } else if (key === 'Escape' || key === 27) {\n if (listOpen) {\n this.toggleList();\n }\n } else if (key === 'ArrowUp' || key === 38) {\n const next =\n highlightedIndex === 0 ? favourites.length + 1 : highlightedIndex - 1;\n this.highlightSuggestion(next);\n } else if (key === 'ArrowDown' || key === 40) {\n const next =\n highlightedIndex === favourites.length + 1 ? 0 : highlightedIndex + 1;\n this.highlightSuggestion(next);\n } else if (key === 'Tab' || key === 9) {\n this.setState({ listOpen: false });\n }\n };\n\n renderSuggestion = (item, index, className = undefined) => {\n const { highlightedIndex } = this.state;\n const id = `favourite-suggestion-list--item-${index}`;\n const selected = highlightedIndex === index;\n /* eslint-disable jsx-a11y/click-events-have-key-events */\n // The key event is handled by the button that opens the dropdown\n return (\n <li\n key={`favourite-suggestion-item-${index}`}\n id={id}\n className={cx(\n styles['favourite-suggestion-item'],\n selected ? styles.highlighted : '',\n )}\n onMouseEnter={() => this.highlightSuggestion(index)}\n onClick={this.suggestionSelected}\n aria-selected={selected}\n role=\"option\"\n >\n <SuggestionItem\n item={item}\n iconColor={this.props.color}\n className={className}\n fontWeights={this.props.fontWeights}\n />\n </li>\n );\n /* eslint-enable jsx-a11y/click-events-have-key-events */\n };\n\n getCustomSuggestions = () => {\n const customSuggestions = [\n {\n name: i18next.t('add-place'),\n selectedIconId: 'favourite',\n color: this.props.color,\n },\n ];\n if (this.props.favourites.length === 0) {\n return customSuggestions;\n }\n return [\n ...customSuggestions,\n {\n name: i18next.t('edit'),\n selectedIconId: 'edit',\n iconColor: this.props.color,\n color: this.props.color,\n },\n ];\n };\n\n render() {\n const { onClickFavourite, isLoading, fontWeights } = this.props;\n const {\n listOpen,\n favourites,\n highlightedIndex,\n firstFavourite,\n secondFavourite,\n } = this.state;\n const expandIcon = this.props.favourites.length === 0 ? 'plus' : 'arrow';\n\n if (i18next.language !== this.props.lang) {\n i18next.changeLanguage(this.props.lang);\n }\n\n return (\n <div style={{ '--font-weight-medium': fontWeights.medium }}>\n <div className={styles['favourite-container']}>\n <FavouriteLocation\n text={\n (firstFavourite &&\n (firstFavourite.name ||\n (firstFavourite.address &&\n firstFavourite.address.split(',')[0]))) ||\n i18next.t('add-home')\n }\n label={(firstFavourite && firstFavourite.address) || ''}\n clickItem={() =>\n firstFavourite\n ? onClickFavourite(firstFavourite)\n : this.props.onAddHome()\n }\n iconId={\n firstFavourite && firstFavourite.selectedIconId\n ? FavouriteBar.FavouriteIconIdToNameMap[\n firstFavourite.selectedIconId\n ]\n : 'home'\n }\n isLoading={isLoading}\n color={this.props.color}\n />\n <FavouriteLocation\n text={\n (secondFavourite &&\n (secondFavourite.name ||\n (secondFavourite.address &&\n secondFavourite.address.split(',')[0]))) ||\n i18next.t('add-work')\n }\n label={(secondFavourite && secondFavourite.address) || ''}\n clickItem={() =>\n secondFavourite\n ? onClickFavourite(secondFavourite)\n : this.props.onAddWork()\n }\n iconId={\n secondFavourite && secondFavourite.selectedIconId\n ? FavouriteBar.FavouriteIconIdToNameMap[\n secondFavourite.selectedIconId\n ]\n : 'work'\n }\n isLoading={isLoading}\n color={this.props.color}\n />\n {/* eslint-disable jsx-a11y/role-supports-aria-props */}\n <div\n className={cx(styles.expandButton, styles[expandIcon], {\n [styles.rotate]: listOpen,\n })}\n ref={this.expandListRef}\n id=\"favourite-expand-button\"\n onFocus={() => this.toggleList()}\n onKeyDown={e => this.handleKeyDown(e)}\n onClick={() => this.toggleList()}\n tabIndex=\"0\"\n role=\"listbox\"\n aria-label={i18next.t('open-favourites')}\n aria-owns={favourites\n .map((_, i) => `favourite-suggestion-list--item-${i}`)\n .join(' ')}\n aria-activedescendant={`favourite-suggestion-list--item-${highlightedIndex}`}\n >\n <Shimmer active={isLoading}>\n <Icon img={expandIcon} color={this.props.color} />\n </Shimmer>\n </div>\n {/* eslint-enable jsx-a11y/role-supports-aria-props */}\n </div>\n <div className={styles['favourite-suggestion-container']}>\n {listOpen && (\n <ul\n className={styles['favourite-suggestion-list']}\n id=\"favourite-suggestion-list\"\n ref={this.suggestionListRef}\n >\n {favourites.map((item, index) =>\n this.renderSuggestion(\n {\n ...item,\n address: item.address\n ? item.address.replace(\n new RegExp(`${escapeRegExp(item.name)}(,)?( )?`),\n '',\n )\n : '',\n iconColor: this.props.color,\n },\n index,\n ),\n )}\n {favourites.length > 0 && <div className={styles.divider} />}\n {this.getCustomSuggestions().map((item, index) =>\n this.renderSuggestion(\n {\n ...item,\n iconColor: this.props.color,\n },\n favourites.length + index,\n 'favouriteCustom',\n ),\n )}\n </ul>\n )}\n </div>\n </div>\n );\n }\n}\n\nexport default FavouriteBar;\n","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}"],"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","_defineProperties","props","descriptor","enumerable","configurable","writable","defineProperty","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_typeof","obj","Symbol","iterator","constructor","_possibleConstructorReturn","self","ReferenceError","assertThisInitialized","_getPrototypeOf","getPrototypeOf","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","translations","de","edit","home","work","en","fi","sv","init","fallbackLng","defaultNS","interpolation","escapeValue","isKeyboardSelectionEvent","event","which","keyCode","concat","includes","preventDefault","FavouriteLocation","className","clickItem","iconId","text","label","isLoading","color","ariaLabel","i18next","t","React","role","tabIndex","cx","styles","onClick","onKeyDown","e","Shimmer","active","shimmer","icon","Icon","img","name","address","process","propTypes","PropTypes","func","isRequired","string","bool","FavouriteBar","subClass","superClass","TypeError","create","value","Constructor","protoProps","staticProps","instance","toggleList","eventDiff","Date","getTime","_this","state","timestamp","language","lang","changeLanguage","setState","prevState","listOpen","highlightedIndex","highlightSuggestion","index","handleClickOutside","suggestionListRef","current","expandListRef","contains","suggestionSelected","favourites","onClickFavourite","onAddPlace","onEdit","handleKeyDown","next","renderSuggestion","item","undefined","id","selected","highlighted","onMouseEnter","SuggestionItem","iconColor","fontWeights","getCustomSuggestions","customSuggestions","selectedIconId","firstFavourite","secondFavourite","slice","createRef","keys","forEach","addResourceBundle","nextProps","nextFavourites","isEmpty","differenceWith","isEqual","addEventListener","removeEventListener","expandIcon","medium","split","_this2","onAddHome","FavouriteIconIdToNameMap","onAddWork","expandButton","rotate","onFocus","map","_","join","replace","RegExp","escapeRegExp","divider","Component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,CACd7F,QAASG,UAAUG,OACnBwF,OAAQ3F,UAAUG,OAClByF,IAAK5F,UAAUG,OACf0F,IAAK7F,UAAU8F,OACflG,KAAMI,UAAUG,OAChB4F,IAAK/F,UAAU8F,OACfvC,eAAgBvD,UAAUG,OAC1B6F,YAAahG,UAAUG,UAEzBD,WAEFoC,iBAAkBtC,UAAUC,KAE5BsC,WAAYvC,UAAUC,KAEtBuC,OAAQxC,UAAUC,KAElByE,UAAW1E,UAAUC,KAErB2E,UAAW5E,UAAUC,KAErBsB,KAAMvB,UAAUG,OAEhB1B,UAAWuB,UAAUI,KAErB1B,MAAOsB,UAAUG,OAEjBiD,YAAapD,UAAU0F,MAAM,CAE3BnB,OAAQvE,UAAU8F"}
1
+ {"version":3,"file":"index.js","sources":["../../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../../../node_modules/style-inject/dist/style-inject.es.js","../src/helpers/translations.js","../src/index.js","../../../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","const translations = {\n de: {\n 'add-favourite': 'Füge Favorit hinzu',\n 'add-home': 'Setze Zuhause',\n 'add-place': 'Setze Ort',\n 'add-work': 'Setze Arbeitsort',\n edit: 'Bearbeiten',\n 'open-favourites': 'Öffne Favoriten',\n home: 'Zuhause',\n work: 'Arbeit',\n },\n en: {\n 'add-destination': 'Set as destination',\n 'add-favourite': 'Add favourite',\n 'add-home': 'Add home',\n 'add-place': 'Add place',\n 'add-work': 'Add work',\n edit: 'Edit',\n 'open-favourites': 'Open favourites',\n home: 'Home',\n work: 'Work',\n },\n fi: {\n 'add-destination': 'Aseta määränpääksi',\n 'add-favourite': 'Lisää suosikki',\n 'add-home': 'Lisää koti',\n 'add-place': 'Lisää paikka',\n 'add-work': 'Lisää työ',\n edit: 'Muokkaa',\n 'open-favourites': 'Avaa suosikit',\n home: 'Koti',\n work: 'Työ',\n },\n sv: {\n 'add-destination': 'Ställa in som destination',\n 'add-favourite': 'Lägg till favorit',\n 'add-home': 'Lägg till hem',\n 'add-place': 'Lägg till plats',\n 'add-work': 'Lägg till arbete',\n edit: 'Redigera',\n 'open-favourites': 'Öppna favoriter',\n home: 'Hem',\n work: 'Arbete',\n },\n};\n\nexport default translations;\n","import PropTypes from 'prop-types';\nimport React from 'react';\nimport cx from 'classnames';\nimport i18next from 'i18next';\nimport differenceWith from 'lodash/differenceWith';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport escapeRegExp from 'lodash/escapeRegExp';\nimport Shimmer from '@hsl-fi/shimmer';\nimport SuggestionItem from '@digitransit-component/digitransit-component-suggestion-item';\nimport Icon from '@digitransit-component/digitransit-component-icon';\nimport styles from './helpers/styles.scss';\nimport translations from './helpers/translations';\n\ni18next.init({\n fallbackLng: 'fi',\n defaultNS: 'translation',\n interpolation: {\n escapeValue: false, // not needed for react as it escapes by default\n },\n});\n\nconst isKeyboardSelectionEvent = event => {\n const space = [13, ' ', 'Spacebar'];\n const enter = [32, 'Enter'];\n const key = (event && (event.key || event.which || event.keyCode)) || '';\n if (!key || !space.concat(enter).includes(key)) {\n return false;\n }\n event.preventDefault();\n return true;\n};\n\nconst FavouriteLocation = ({\n className,\n clickItem,\n iconId,\n text,\n label,\n isLoading,\n color,\n}) => {\n const ariaLabel =\n label === '' ? text : `${text} ${label} ${i18next.t('add-destination')}`;\n return (\n <div\n role=\"button\"\n tabIndex=\"0\"\n className={cx(styles['favourite-content'], styles[className])}\n onClick={clickItem}\n onKeyDown={e => isKeyboardSelectionEvent(e) && clickItem()}\n aria-label={ariaLabel}\n >\n <Shimmer active={isLoading} className={styles.shimmer}>\n <span className={cx(styles.icon, styles[iconId])}>\n <Icon img={iconId} color={color} />\n </span>\n <div className={styles['favourite-location']}>\n <div className={styles.name}>{text}</div>\n <div className={styles.address}>{label}</div>\n </div>\n </Shimmer>\n </div>\n );\n};\n\nFavouriteLocation.propTypes = {\n clickItem: PropTypes.func.isRequired,\n className: PropTypes.string,\n iconId: PropTypes.string,\n text: PropTypes.string,\n label: PropTypes.string,\n isLoading: PropTypes.bool,\n color: PropTypes.string.isRequired,\n};\n\n/**\n * FavouriteBar renders favourites. FavouriteBar displays the first two favourites, the rest are shown in a list.\n * @example\n * <FavouriteBar\n * favourites={favourites}\n * onClickFavourite={onClickFavourite}\n * onAddPlace={this.addPlace}\n * onAddHome={this.addHome}\n * onAddWork={this.addWork}\n * lang={this.props.lang}\n * isLoading={this.props.isLoading}\n * />\n */\nclass FavouriteBar extends React.Component {\n static propTypes = {\n /** Required. Array of favourites, favourite object contains following properties.\n * @type {Array<object>}\n * @property {string} address\n * @property {string} gtfsId\n * @property {string} gid\n * @property {number} lat\n * @property {number} lon\n * @property {string} name\n * @property {string} selectedIconId\n * @property {string} favouriteId\n */\n favourites: PropTypes.arrayOf(\n PropTypes.shape({\n address: PropTypes.string,\n gtfsId: PropTypes.string,\n gid: PropTypes.string,\n lat: PropTypes.number,\n name: PropTypes.string,\n lon: PropTypes.number,\n selectedIconId: PropTypes.string,\n favouriteId: PropTypes.string,\n }),\n ).isRequired,\n /** Optional. Function for clicking favourites. */\n onClickFavourite: PropTypes.func,\n /** Optional. Function for selecting \"Add place\" from suggestions. */\n onAddPlace: PropTypes.func,\n /** Optional. Function for selected \"Edit\" from suggestions. */\n onEdit: PropTypes.func,\n /** Optional. Function for \"Add home\" button. */\n onAddHome: PropTypes.func,\n /** Optional. Function for \"Add work\" button. */\n onAddWork: PropTypes.func,\n /** Optional. Language, fi, en or sv. */\n lang: PropTypes.string,\n /** Optional. Whether to show loading animation, true or false. */\n isLoading: PropTypes.bool,\n /** Optional. Default value is '#007ac9'. */\n color: PropTypes.string,\n /** Optional. */\n fontWeights: PropTypes.shape({\n /** Default value is 500. */\n medium: PropTypes.number,\n }),\n };\n\n static defaultProps = {\n onClickFavourite: () => ({}),\n onAddPlace: () => ({}),\n onEdit: () => ({}),\n onAddHome: () => ({}),\n onAddWork: () => ({}),\n lang: 'fi',\n isLoading: false,\n color: '#007ac9',\n fontWeights: {\n medium: 500,\n },\n };\n\n static FavouriteIconIdToNameMap = {\n 'icon-icon_place': 'place',\n 'icon-icon_home': 'home',\n 'icon-icon_work': 'work',\n 'icon-icon_sport': 'sport',\n 'icon-icon_school': 'school',\n 'icon-icon_shopping': 'shopping',\n };\n\n constructor(props) {\n super(props);\n this.state = {\n listOpen: false,\n highlightedIndex: 0,\n firstFavourite: props.favourites[0] || null,\n secondFavourite: props.favourites[1] || null,\n favourites: props.favourites.slice(2, props.favourites.length),\n timestamp: 0,\n };\n this.expandListRef = React.createRef();\n this.suggestionListRef = React.createRef();\n Object.keys(translations).forEach(lang => {\n i18next.addResourceBundle(lang, 'translation', translations[lang]);\n });\n }\n\n componentDidMount() {\n document.addEventListener('mousedown', this.handleClickOutside);\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const { favourites } = prevState;\n const nextFavourites = nextProps.favourites;\n if (\n !isEmpty(differenceWith(nextFavourites, favourites, isEqual)) ||\n !isEmpty(differenceWith(favourites, nextFavourites, isEqual)) ||\n !isEqual(nextFavourites, favourites) ||\n isEmpty(nextFavourites)\n ) {\n return {\n firstFavourite: nextFavourites[0] || null,\n secondFavourite: nextFavourites[1] || null,\n favourites: nextFavourites.slice(2, nextFavourites.length),\n };\n }\n return null;\n }\n\n componentWillUnmount() {\n document.removeEventListener('mousedown', this.handleClickOutside);\n }\n\n toggleList = () => {\n const eventDiff = new Date().getTime() - this.state.timestamp;\n if (i18next.language !== this.props.lang) {\n i18next.changeLanguage(this.props.lang);\n }\n if (eventDiff > 200) {\n this.setState(prevState => ({\n listOpen: !prevState.listOpen,\n highlightedIndex: 0,\n timestamp: new Date().getTime(),\n }));\n }\n };\n\n highlightSuggestion = index => {\n this.setState({ highlightedIndex: index });\n };\n\n handleClickOutside = event => {\n if (\n this.suggestionListRef.current &&\n this.expandListRef.current &&\n !this.suggestionListRef.current.contains(event.target) &&\n !this.expandListRef.current.contains(event.target)\n ) {\n this.setState({\n listOpen: false,\n });\n }\n };\n\n suggestionSelected = () => {\n const { favourites, highlightedIndex } = this.state;\n if (highlightedIndex < favourites.length) {\n this.props.onClickFavourite(favourites[highlightedIndex]);\n } else if (highlightedIndex === favourites.length) {\n this.props.onAddPlace();\n } else if (highlightedIndex === favourites.length + 1) {\n this.props.onEdit();\n }\n this.toggleList();\n };\n\n handleKeyDown = event => {\n const { favourites, highlightedIndex, listOpen } = this.state;\n const key = (event && (event.key || event.which || event.keyCode)) || '';\n if (isKeyboardSelectionEvent(event)) {\n if (!listOpen) {\n this.toggleList();\n } else {\n this.suggestionSelected();\n }\n } else if (key === 'Escape' || key === 27) {\n if (listOpen) {\n this.toggleList();\n }\n } else if (key === 'ArrowUp' || key === 38) {\n const next =\n highlightedIndex === 0 ? favourites.length + 1 : highlightedIndex - 1;\n this.highlightSuggestion(next);\n } else if (key === 'ArrowDown' || key === 40) {\n const next =\n highlightedIndex === favourites.length + 1 ? 0 : highlightedIndex + 1;\n this.highlightSuggestion(next);\n } else if (key === 'Tab' || key === 9) {\n this.setState({ listOpen: false });\n }\n };\n\n renderSuggestion = (item, index, className = undefined) => {\n const { highlightedIndex } = this.state;\n const id = `favourite-suggestion-list--item-${index}`;\n const selected = highlightedIndex === index;\n /* eslint-disable jsx-a11y/click-events-have-key-events */\n // The key event is handled by the button that opens the dropdown\n return (\n <li\n key={`favourite-suggestion-item-${index}`}\n id={id}\n className={cx(\n styles['favourite-suggestion-item'],\n selected ? styles.highlighted : '',\n )}\n onMouseEnter={() => this.highlightSuggestion(index)}\n onClick={this.suggestionSelected}\n aria-selected={selected}\n role=\"option\"\n >\n <SuggestionItem\n item={item}\n iconColor={this.props.color}\n className={className}\n fontWeights={this.props.fontWeights}\n />\n </li>\n );\n /* eslint-enable jsx-a11y/click-events-have-key-events */\n };\n\n getCustomSuggestions = () => {\n const customSuggestions = [\n {\n name: i18next.t('add-place'),\n selectedIconId: 'favourite',\n color: this.props.color,\n },\n ];\n if (this.props.favourites.length === 0) {\n return customSuggestions;\n }\n return [\n ...customSuggestions,\n {\n name: i18next.t('edit'),\n selectedIconId: 'edit',\n iconColor: this.props.color,\n color: this.props.color,\n },\n ];\n };\n\n render() {\n const { onClickFavourite, isLoading, fontWeights } = this.props;\n const {\n listOpen,\n favourites,\n highlightedIndex,\n firstFavourite,\n secondFavourite,\n } = this.state;\n const expandIcon = this.props.favourites.length === 0 ? 'plus' : 'arrow';\n\n if (i18next.language !== this.props.lang) {\n i18next.changeLanguage(this.props.lang);\n }\n\n return (\n <div style={{ '--font-weight-medium': fontWeights.medium }}>\n <div className={styles['favourite-container']}>\n <FavouriteLocation\n text={\n (firstFavourite &&\n (firstFavourite.name ||\n (firstFavourite.address &&\n firstFavourite.address.split(',')[0]))) ||\n i18next.t('add-home')\n }\n label={(firstFavourite && firstFavourite.address) || ''}\n clickItem={() =>\n firstFavourite\n ? onClickFavourite(firstFavourite)\n : this.props.onAddHome()\n }\n iconId={\n firstFavourite && firstFavourite.selectedIconId\n ? FavouriteBar.FavouriteIconIdToNameMap[\n firstFavourite.selectedIconId\n ]\n : 'home'\n }\n isLoading={isLoading}\n color={this.props.color}\n />\n <FavouriteLocation\n text={\n (secondFavourite &&\n (secondFavourite.name ||\n (secondFavourite.address &&\n secondFavourite.address.split(',')[0]))) ||\n i18next.t('add-work')\n }\n label={(secondFavourite && secondFavourite.address) || ''}\n clickItem={() =>\n secondFavourite\n ? onClickFavourite(secondFavourite)\n : this.props.onAddWork()\n }\n iconId={\n secondFavourite && secondFavourite.selectedIconId\n ? FavouriteBar.FavouriteIconIdToNameMap[\n secondFavourite.selectedIconId\n ]\n : 'work'\n }\n isLoading={isLoading}\n color={this.props.color}\n />\n {/* eslint-disable jsx-a11y/role-supports-aria-props */}\n <div\n className={cx(styles.expandButton, styles[expandIcon], {\n [styles.rotate]: listOpen,\n })}\n ref={this.expandListRef}\n id=\"favourite-expand-button\"\n onFocus={() => this.toggleList()}\n onKeyDown={e => this.handleKeyDown(e)}\n onClick={() => this.toggleList()}\n tabIndex=\"0\"\n role=\"listbox\"\n aria-label={i18next.t('open-favourites')}\n aria-owns={favourites\n .map((_, i) => `favourite-suggestion-list--item-${i}`)\n .join(' ')}\n aria-activedescendant={`favourite-suggestion-list--item-${highlightedIndex}`}\n >\n <Shimmer active={isLoading}>\n <Icon img={expandIcon} color={this.props.color} />\n </Shimmer>\n </div>\n {/* eslint-enable jsx-a11y/role-supports-aria-props */}\n </div>\n <div className={styles['favourite-suggestion-container']}>\n {listOpen && (\n <ul\n className={styles['favourite-suggestion-list']}\n id=\"favourite-suggestion-list\"\n ref={this.suggestionListRef}\n >\n {favourites.map((item, index) =>\n this.renderSuggestion(\n {\n ...item,\n address: item.address\n ? item.address.replace(\n new RegExp(`${escapeRegExp(item.name)}(,)?( )?`),\n '',\n )\n : '',\n iconColor: this.props.color,\n },\n index,\n ),\n )}\n {favourites.length > 0 && <div className={styles.divider} />}\n {this.getCustomSuggestions().map((item, index) =>\n this.renderSuggestion(\n {\n ...item,\n iconColor: this.props.color,\n },\n favourites.length + index,\n 'favouriteCustom',\n ),\n )}\n </ul>\n )}\n </div>\n </div>\n );\n }\n}\n\nexport default FavouriteBar;\n","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}"],"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","_defineProperties","props","descriptor","enumerable","configurable","writable","defineProperty","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_typeof","obj","Symbol","iterator","constructor","_possibleConstructorReturn","self","ReferenceError","assertThisInitialized","_getPrototypeOf","getPrototypeOf","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","translations","de","edit","home","work","en","fi","sv","init","fallbackLng","defaultNS","interpolation","escapeValue","isKeyboardSelectionEvent","event","which","keyCode","concat","includes","preventDefault","FavouriteLocation","className","clickItem","iconId","text","label","isLoading","color","ariaLabel","i18next","t","React","role","tabIndex","cx","styles","onClick","onKeyDown","e","Shimmer","active","shimmer","icon","Icon","img","name","address","process","propTypes","PropTypes","func","isRequired","string","bool","FavouriteBar","subClass","superClass","TypeError","create","value","Constructor","protoProps","staticProps","instance","toggleList","eventDiff","Date","getTime","_this","state","timestamp","language","lang","changeLanguage","setState","prevState","listOpen","highlightedIndex","highlightSuggestion","index","handleClickOutside","suggestionListRef","current","expandListRef","contains","suggestionSelected","favourites","onClickFavourite","onAddPlace","onEdit","handleKeyDown","next","renderSuggestion","item","undefined","id","selected","highlighted","onMouseEnter","SuggestionItem","iconColor","fontWeights","getCustomSuggestions","customSuggestions","selectedIconId","firstFavourite","secondFavourite","slice","createRef","keys","forEach","addResourceBundle","nextProps","nextFavourites","isEmpty","differenceWith","isEqual","addEventListener","removeEventListener","expandIcon","medium","split","_this2","onAddHome","FavouriteIconIdToNameMap","onAddWork","expandButton","rotate","onFocus","map","_","join","replace","RegExp","escapeRegExp","divider","Component","defaultProps","arrayOf","shape","gtfsId","gid","lat","number","lon","favouriteId"],"mappings":"krCAAe,SAASA,IAetB,OAdAA,EAAWC,OAAOC,QAAU,SAAUC,GACpC,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CACzC,IAAIG,EAASF,UAAUD,GAEvB,IAAK,IAAII,KAAOD,EACVN,OAAOQ,UAAUC,eAAeC,KAAKJ,EAAQC,KAC/CL,EAAOK,GAAOD,EAAOC,IAK3B,OAAOL,GAGFH,EAASY,MAAMC,KAAMR,WCf9B,SAASS,EAAkBX,EAAQY,GACjC,IAAK,IAAIX,EAAI,EAAGA,EAAIW,EAAMT,OAAQF,IAAK,CACrC,IAAIY,EAAaD,EAAMX,GACvBY,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDlB,OAAOmB,eAAejB,EAAQa,EAAWR,IAAKQ,ICNnC,SAASK,EAAgBC,EAAGC,GAMzC,OALAF,EAAkBpB,OAAOuB,gBAAkB,SAAyBF,EAAGC,GAErE,OADAD,EAAEG,UAAYF,EACPD,GAGFD,EAAgBC,EAAGC,GCNb,SAASG,EAAQC,GAa9B,OATED,EADoB,mBAAXE,QAAoD,iBAApBA,OAAOC,SACtC,SAAiBF,GACzB,cAAcA,GAGN,SAAiBA,GACzB,OAAOA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOnB,UAAY,gBAAkBkB,GAItHD,EAAQC,GCXF,SAASI,EAA2BC,EAAMrB,GACvD,OAAIA,GAA2B,WAAlBe,EAAQf,IAAsC,mBAATA,ECHrC,SAAg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AM,KACN9C,WAAW,EACXC,MAAO,UACP0E,YAAa,CACXmB,OAAQ,MA1DRlE,EA8DGsE,yBAA2B,mBACb,yBACD,wBACA,yBACC,2BACC,8BACE,kDApEpBtE,EACGN,UAAY,CAYjBsC,WAAYrC,UAAUyF,QACpBzF,UAAU0F,MAAM,CACd7F,QAASG,UAAUG,OACnBwF,OAAQ3F,UAAUG,OAClByF,IAAK5F,UAAUG,OACf0F,IAAK7F,UAAU8F,OACflG,KAAMI,UAAUG,OAChB4F,IAAK/F,UAAU8F,OACfvC,eAAgBvD,UAAUG,OAC1B6F,YAAahG,UAAUG,UAEzBD,WAEFoC,iBAAkBtC,UAAUC,KAE5BsC,WAAYvC,UAAUC,KAEtBuC,OAAQxC,UAAUC,KAElByE,UAAW1E,UAAUC,KAErB2E,UAAW5E,UAAUC,KAErBsB,KAAMvB,UAAUG,OAEhB1B,UAAWuB,UAAUI,KAErB1B,MAAOsB,UAAUG,OAEjBiD,YAAapD,UAAU0F,MAAM,CAE3BnB,OAAQvE,UAAU8F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitransit-component/digitransit-component-favourite-bar",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "digitransit-component favourite-bar module",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -28,8 +28,8 @@
28
28
  "author": "Digitransit Authors",
29
29
  "license": "(AGPL-3.0 OR EUPL-1.2)",
30
30
  "peerDependencies": {
31
- "@digitransit-component/digitransit-component-icon": "^0.1.13",
32
- "@digitransit-component/digitransit-component-suggestion-item": "^0.2.15",
31
+ "@digitransit-component/digitransit-component-icon": "^0.1.14",
32
+ "@digitransit-component/digitransit-component-suggestion-item": "^0.2.16",
33
33
  "@hsl-fi/sass": "^0.2.0",
34
34
  "@hsl-fi/shimmer": "0.1.0",
35
35
  "classnames": "2.2.6",
@@ -39,5 +39,5 @@
39
39
  "prop-types": "^15.7.2",
40
40
  "react": "^16.13.0"
41
41
  },
42
- "gitHead": "56226ce779d313868c7adad1fbbba4a1ceca9faa"
42
+ "gitHead": "603820a6925ae59a815c4cdfa6d63c37143fcea1"
43
43
  }