@digitransit-component/digitransit-component-favourite-bar 1.0.5 → 1.0.6
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 +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
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),h=f(i),v=f(s),y=f(r),m=f(a),x=f(l),b=f(u),w=f(d),O=f(c);function k(){return k=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},k.apply(this,arguments)}function P(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 T(e,t){return T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},T(e,t)}function E(e){return E="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},E(e)}function I(e,t){return!t||"object"!==E(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 R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var S={"button-shared":"styles_button-shared__UhMAY","favourite-container":"styles_favourite-container__T2P-O","favourite-content":"styles_favourite-content__5n7Tr",expandButton:"styles_expandButton__PhrPs","shimmer-shared":"styles_shimmer-shared__BranE",shimmer:"styles_shimmer__EV1Ad",icon:"styles_icon__dj-4I",place:"styles_place__ohVrz",home:"styles_home__W5zJX",school:"styles_school__0LjbC",sport:"styles_sport__8S2Er",shopping:"styles_shopping__gPluY",work:"styles_work__PjFJi","favourite-location":"styles_favourite-location__tkF6A",name:"styles_name__1-VJE",address:"styles_address__NJDgF",plus:"styles_plus__t5jGk",arrow:"styles_arrow__YDUFt",rotate:"styles_rotate__UiOQe","favourite-suggestion-container":"styles_favourite-suggestion-container__yOpVc",divider:"styles_divider__y4bPB","favourite-suggestion-list":"styles_favourite-suggestion-list__qG-OZ","favourite-suggestion-item":"styles_favourite-suggestion-item__g5bxM",highlighted:"styles_highlighted__cPaRf",custom:"styles_custom__YOOqF"};!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__UhMAY, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs {\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__UhMAY:hover, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr:hover, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs:hover {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); }\n\n.styles_shimmer-shared__BranE, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr > button, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs > button {\n display: flex;\n align-items: center;\n overflow: hidden; }\n .styles_shimmer-shared__BranE .styles_shimmer__EV1Ad, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr > button .styles_shimmer__EV1Ad, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs > button .styles_shimmer__EV1Ad {\n border-radius: 5px; }\n\n.styles_favourite-container__T2P-O {\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__T2P-O .styles_favourite-content__5n7Tr {\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__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I {\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__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I {\n flex-shrink: 0; } }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I svg {\n width: 20px;\n height: 20px;\n position: relative;\n left: 2px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_place__ohVrz svg {\n width: 24px;\n height: 24px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_home__W5zJX svg, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_school__0LjbC svg, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_sport__8S2Er svg, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_shopping__gPluY svg {\n width: 18px;\n height: 18px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_work__PjFJi svg {\n width: 20px;\n height: 20px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A {\n white-space: nowrap;\n overflow: hidden;\n text-align: start;\n width: 100%;\n flex-direction: row; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A .styles_name__1-VJE {\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__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A .styles_name__1-VJE:empty {\n margin-top: 0; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A .styles_address__NJDgF {\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__T2P-O .styles_expandButton__PhrPs {\n height: 100%;\n width: 42px;\n flex-shrink: 0;\n overflow: hidden; }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs > button {\n justify-content: center; }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs.styles_plus__t5jGk svg {\n width: 16px;\n height: 16px; }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs.styles_arrow__YDUFt svg {\n width: 19px;\n height: 19px;\n transform: rotate(90deg); }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs.styles_arrow__YDUFt.styles_rotate__UiOQe svg {\n transform: rotate(-90deg); }\n\n.styles_favourite-suggestion-container__yOpVc {\n position: relative;\n display: flex;\n justify-content: center;\n padding-top: 9px; }\n .styles_favourite-suggestion-container__yOpVc .styles_divider__y4bPB {\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__yOpVc .styles_favourite-suggestion-list__qG-OZ {\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__yOpVc .styles_favourite-suggestion-item__g5bxM {\n cursor: pointer; }\n .styles_favourite-suggestion-container__yOpVc .styles_favourite-suggestion-item__g5bxM.styles_highlighted__cPaRf {\n background-color: #F4F4F5; }\n .styles_favourite-suggestion-container__yOpVc .styles_favourite-suggestion-item__g5bxM.styles_custom__YOOqF {\n font-size: 15px;\n font-weight: var(--font-weight-medium);\n letter-spacing: -0.5; }\n");var A={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","favourites-list":"Favourites list",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ö","favourites-list":"Suosikit lista",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","favourites-list":"Favoritlista",edit:"Redigera","open-favourites":"Öppna favoriter",home:"Hem",work:"Arbete"}};function F(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=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return I(this,n)}}h.default.init({fallbackLng:"fi",defaultNS:"translation",interpolation:{escapeValue:!1}});var L=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("button",{type:"button",tabIndex:"0",className:g.default(S["favourite-content"],S[t]),onClick:n,onKeyDown:function(e){return L(e)&&n()},"aria-label":l},p.default.createElement(b.default,{active:r,className:S.shimmer},p.default.createElement("span",{className:g.default(S.icon,S[o])},p.default.createElement(O.default,{img:o,color:a})),p.default.createElement("div",{className:S["favourite-location"]},p.default.createElement("div",{className:S.name},i),p.default.createElement("div",{className:S.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&&T(e,t)}(s,e);var t,n,o,i=F(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()}}),(function(){var e,n;t.state.listOpen?null===(e=t.firstItemRef.current)||void 0===e||e.focus():null===(n=t.expandListRef.current)||void 0===n||n.focus()}))},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(L(e))s?t.suggestionSelected():t.toggleList();else if("Escape"===r||27===r)s&&t.toggleList();else if(("ArrowUp"===r||38===r)&&t.props.favourites.length>0){var a=0===i?o.length+1:i-1;t.highlightSuggestion(a)}else if(("ArrowDown"===r||40===r)&&t.props.favourites.length>0){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("div",{tabIndex:"0",key:"favourite-suggestion-item-".concat(n),id:s,className:g.default(S["favourite-suggestion-item"],r&&S.highlighted),onMouseEnter:function(){return t.highlightSuggestion(n)},onClick:t.suggestionSelected,onKeyDown:function(e){return t.handleKeyDown(e)},"aria-selected":r,role:"option",ref:0===n?t.firstItemRef:"",autoFocus:r},p.default.createElement(w.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"}];return 0===t.props.favourites.length?e:[].concat(e,[{name:h.default.t("edit"),selectedIconId:"edit",iconColor: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(),t.firstItemRef=p.default.createRef(),Object.keys(A).forEach((function(e){h.default.addResourceBundle(e,"translation",A[e])})),t}return t=s,o=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.favourites,o=e.favourites;return m.default(v.default(o,n,y.default))&&m.default(v.default(n,o,y.default))&&y.default(o,n)&&!m.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:S["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("button",{type:"button",className:g.default(S.expandButton,S[f],a&&S.rotate),ref:this.expandListRef,id:"favourite-expand-button",onKeyDown:function(t){return e.handleKeyDown(t)},onClick:function(){return e.toggleList()},tabIndex:"0","aria-pressed":this.state.listOpen,"aria-label":h.default.t("open-favourites"),"aria-owns":l.map((function(e,t){return"favourite-suggestion-list--item-".concat(t)})).join(" "),"aria-activedescendant":a?"favourite-suggestion-list--item-".concat(u):void 0},p.default.createElement(b.default,{active:o},p.default.createElement(O.default,{img:f,color:this.props.color})))),p.default.createElement("div",{className:S["favourite-suggestion-container"]},a&&p.default.createElement("div",{className:S["favourite-suggestion-list"],id:"favourite-suggestion-list",ref:this.suggestionListRef,role:"listbox","aria-label":h.default.t("favourites-list")},l.map((function(t,n){return e.renderSuggestion(k({},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:S.divider}),this.getCustomSuggestions().map((function(t,n){return e.renderSuggestion(k({},t,{iconColor:e.props.color}),l.length+n,"favouriteCustom")})))))}}])&&P(t.prototype,n),o&&P(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),v=f(s),y=f(r),m=f(a),x=f(l),b=f(u),w=f(d),O=f(c);function k(){return k=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},k.apply(this,arguments)}function P(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 T(e,t){return T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},T(e,t)}function E(e){return E="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},E(e)}function I(e,t){return!t||"object"!==E(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 R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var S={"button-shared":"styles_button-shared__UhMAY","favourite-container":"styles_favourite-container__T2P-O","favourite-content":"styles_favourite-content__5n7Tr",expandButton:"styles_expandButton__PhrPs","shimmer-shared":"styles_shimmer-shared__BranE",shimmer:"styles_shimmer__EV1Ad",icon:"styles_icon__dj-4I",place:"styles_place__ohVrz",home:"styles_home__W5zJX",school:"styles_school__0LjbC",sport:"styles_sport__8S2Er",shopping:"styles_shopping__gPluY",work:"styles_work__PjFJi","favourite-location":"styles_favourite-location__tkF6A",name:"styles_name__1-VJE",address:"styles_address__NJDgF",plus:"styles_plus__t5jGk",arrow:"styles_arrow__YDUFt",rotate:"styles_rotate__UiOQe","favourite-suggestion-container":"styles_favourite-suggestion-container__yOpVc",divider:"styles_divider__y4bPB","favourite-suggestion-list":"styles_favourite-suggestion-list__qG-OZ","favourite-suggestion-item":"styles_favourite-suggestion-item__g5bxM",highlighted:"styles_highlighted__cPaRf",custom:"styles_custom__YOOqF"};!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__UhMAY, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs {\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__UhMAY:hover, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr:hover, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs:hover {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); }\n\n.styles_shimmer-shared__BranE, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr > div, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs > div {\n display: flex;\n align-items: center;\n overflow: hidden; }\n .styles_shimmer-shared__BranE .styles_shimmer__EV1Ad, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr > div .styles_shimmer__EV1Ad, .styles_favourite-container__T2P-O .styles_expandButton__PhrPs > div .styles_shimmer__EV1Ad {\n border-radius: 5px; }\n\n.styles_favourite-container__T2P-O {\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__T2P-O .styles_favourite-content__5n7Tr {\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__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I {\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__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I {\n flex-shrink: 0; } }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I svg {\n width: 20px;\n height: 20px;\n position: relative;\n left: 2px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_place__ohVrz svg {\n width: 24px;\n height: 24px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_home__W5zJX svg, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_school__0LjbC svg, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_sport__8S2Er svg, .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_shopping__gPluY svg {\n width: 18px;\n height: 18px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_icon__dj-4I.styles_work__PjFJi svg {\n width: 20px;\n height: 20px; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A {\n white-space: nowrap;\n overflow: hidden;\n text-align: start;\n width: 100%;\n flex-direction: row; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A .styles_name__1-VJE {\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__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A .styles_name__1-VJE:empty {\n margin-top: 0; }\n .styles_favourite-container__T2P-O .styles_favourite-content__5n7Tr .styles_favourite-location__tkF6A .styles_address__NJDgF {\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__T2P-O .styles_expandButton__PhrPs {\n height: 100%;\n width: 42px;\n flex-shrink: 0;\n overflow: hidden; }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs > div {\n justify-content: center; }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs.styles_plus__t5jGk svg {\n width: 16px;\n height: 16px; }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs.styles_arrow__YDUFt svg {\n width: 19px;\n height: 19px;\n transform: rotate(90deg); }\n .styles_favourite-container__T2P-O .styles_expandButton__PhrPs.styles_arrow__YDUFt.styles_rotate__UiOQe svg {\n transform: rotate(-90deg); }\n\n.styles_favourite-suggestion-container__yOpVc {\n position: relative;\n display: flex;\n justify-content: center;\n padding-top: 9px; }\n .styles_favourite-suggestion-container__yOpVc .styles_divider__y4bPB {\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__yOpVc .styles_favourite-suggestion-list__qG-OZ {\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__yOpVc .styles_favourite-suggestion-item__g5bxM {\n cursor: pointer; }\n .styles_favourite-suggestion-container__yOpVc .styles_favourite-suggestion-item__g5bxM.styles_highlighted__cPaRf {\n background-color: #F4F4F5; }\n .styles_favourite-suggestion-container__yOpVc .styles_favourite-suggestion-item__g5bxM.styles_custom__YOOqF {\n font-size: 15px;\n font-weight: var(--font-weight-medium);\n letter-spacing: -0.5; }\n");var A={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","favourites-list":"Favourites list",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ö","favourites-list":"Suosikit lista",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","favourites-list":"Favoritlista",edit:"Redigera","open-favourites":"Öppna favoriter",home:"Hem",work:"Arbete"}};function F(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=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return I(this,n)}}h.default.init({fallbackLng:"fi",defaultNS:"translation",interpolation:{escapeValue:!1}});var L=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("button",{type:"button",tabIndex:"0",className:g.default(S["favourite-content"],S[t]),onClick:n,onKeyDown:function(e){return L(e)&&n()},"aria-label":l},p.default.createElement(b.default,{active:r,className:S.shimmer},p.default.createElement("span",{className:g.default(S.icon,S[o])},p.default.createElement(O.default,{img:o,color:a})),p.default.createElement("div",{className:S["favourite-location"]},p.default.createElement("div",{className:S.name},i),p.default.createElement("div",{className:S.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&&T(e,t)}(s,e);var t,n,o,i=F(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()}}),(function(){var e,n;t.state.listOpen?null===(e=t.firstItemRef.current)||void 0===e||e.focus():null===(n=t.expandListRef.current)||void 0===n||n.focus()}))},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(L(e))s?t.suggestionSelected():t.toggleList();else if("Escape"===r||27===r)s&&t.toggleList();else if(("ArrowUp"===r||38===r)&&t.props.favourites.length>0){var a=0===i?o.length+1:i-1;t.highlightSuggestion(a)}else if(("ArrowDown"===r||40===r)&&t.props.favourites.length>0){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("div",{tabIndex:"0",key:"favourite-suggestion-item-".concat(n),id:s,className:g.default(S["favourite-suggestion-item"],r&&S.highlighted),onMouseEnter:function(){return t.highlightSuggestion(n)},onClick:t.suggestionSelected,onKeyDown:function(e){return t.handleKeyDown(e)},"aria-selected":r,role:"option",ref:0===n?t.firstItemRef:"",autoFocus:r},p.default.createElement(w.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"}];return 0===t.props.favourites.length?e:[].concat(e,[{name:h.default.t("edit"),selectedIconId:"edit",iconColor: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(),t.firstItemRef=p.default.createRef(),Object.keys(A).forEach((function(e){h.default.addResourceBundle(e,"translation",A[e])})),t}return t=s,o=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.favourites,o=e.favourites;return m.default(v.default(o,n,y.default))&&m.default(v.default(n,o,y.default))&&y.default(o,n)&&!m.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:S["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("button",{type:"button",className:g.default(S.expandButton,S[f],a&&S.rotate),ref:this.expandListRef,id:"favourite-expand-button",onKeyDown:function(t){return e.handleKeyDown(t)},onClick:function(){return e.toggleList()},tabIndex:"0","aria-pressed":this.state.listOpen,"aria-label":h.default.t("open-favourites"),"aria-owns":l.map((function(e,t){return"favourite-suggestion-list--item-".concat(t)})).join(" "),"aria-activedescendant":a?"favourite-suggestion-list--item-".concat(u):void 0},p.default.createElement(b.default,{active:o},p.default.createElement(O.default,{img:f,color:this.props.color})))),p.default.createElement("div",{className:S["favourite-suggestion-container"]},a&&p.default.createElement("div",{className:S["favourite-suggestion-list"],id:"favourite-suggestion-list",ref:this.suggestionListRef,role:"listbox","aria-label":h.default.t("favourites-list")},l.map((function(t,n){return e.renderSuggestion(k({},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:S.divider}),this.getCustomSuggestions().map((function(t,n){return e.renderSuggestion(k({},t,{iconColor:e.props.color}),l.length+n,"favouriteCustom")})))))}}])&&P(t.prototype,n),o&&P(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 'favourites-list': 'Favourites list',\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 'favourites-list': 'Suosikit lista',\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 'favourites-list': 'Favoritlista',\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 <button\n type=\"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 </button>\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 this.firstItemRef = 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(\n prevState => ({\n listOpen: !prevState.listOpen,\n highlightedIndex: 0,\n timestamp: new Date().getTime(),\n }),\n () => {\n if (this.state.listOpen) {\n this.firstItemRef.current?.focus();\n } else {\n this.expandListRef.current?.focus();\n }\n },\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 (\n (key === 'ArrowUp' || key === 38) &&\n this.props.favourites.length > 0\n ) {\n const next =\n highlightedIndex === 0 ? favourites.length + 1 : highlightedIndex - 1;\n this.highlightSuggestion(next);\n } else if (\n (key === 'ArrowDown' || key === 40) &&\n this.props.favourites.length > 0\n ) {\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 <div\n tabIndex=\"0\"\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 onKeyDown={e => this.handleKeyDown(e)}\n aria-selected={selected}\n role=\"option\"\n ref={index === 0 ? this.firstItemRef : ''}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={selected}\n >\n <SuggestionItem\n item={item}\n iconColor={this.props.color}\n className={className}\n fontWeights={this.props.fontWeights}\n />\n </div>\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 },\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 },\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 <button\n type=\"button\"\n className={cx(styles.expandButton, styles[expandIcon], {\n [styles.rotate]: listOpen,\n })}\n ref={this.expandListRef}\n id=\"favourite-expand-button\"\n onKeyDown={e => this.handleKeyDown(e)}\n onClick={() => this.toggleList()}\n tabIndex=\"0\"\n aria-pressed={this.state.listOpen}\n aria-label={i18next.t('open-favourites')}\n aria-owns={favourites\n .map((_, i) => `favourite-suggestion-list--item-${i}`)\n .join(' ')}\n aria-activedescendant={\n listOpen\n ? `favourite-suggestion-list--item-${highlightedIndex}`\n : undefined\n }\n >\n <Shimmer active={isLoading}>\n <Icon img={expandIcon} color={this.props.color} />\n </Shimmer>\n </button>\n {/* eslint-enable jsx-a11y/role-supports-aria-props */}\n </div>\n <div className={styles['favourite-suggestion-container']}>\n {listOpen && (\n <div\n className={styles['favourite-suggestion-list']}\n id=\"favourite-suggestion-list\"\n ref={this.suggestionListRef}\n role=\"listbox\"\n aria-label={i18next.t('favourites-list')}\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 </div>\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","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","firstItemRef","current","focus","expandListRef","highlightSuggestion","index","handleClickOutside","suggestionListRef","contains","suggestionSelected","favourites","onClickFavourite","onAddPlace","onEdit","handleKeyDown","next","renderSuggestion","item","undefined","id","selected","highlighted","onMouseEnter","role","autoFocus","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","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,GA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ErBsB,KAAMvB,UAAUG,OAEhBzB,UAAWsB,UAAUI,KAErBzB,MAAOqB,UAAUG,OAEjBqD,YAAaxD,UAAU6F,MAAM,CAE3BlB,OAAQ3E,UAAUiG"}
|
|
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 'favourites-list': 'Favourites list',\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 'favourites-list': 'Suosikit lista',\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 'favourites-list': 'Favoritlista',\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 <button\n type=\"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 </button>\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 this.firstItemRef = 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(\n prevState => ({\n listOpen: !prevState.listOpen,\n highlightedIndex: 0,\n timestamp: new Date().getTime(),\n }),\n () => {\n if (this.state.listOpen) {\n this.firstItemRef.current?.focus();\n } else {\n this.expandListRef.current?.focus();\n }\n },\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 (\n (key === 'ArrowUp' || key === 38) &&\n this.props.favourites.length > 0\n ) {\n const next =\n highlightedIndex === 0 ? favourites.length + 1 : highlightedIndex - 1;\n this.highlightSuggestion(next);\n } else if (\n (key === 'ArrowDown' || key === 40) &&\n this.props.favourites.length > 0\n ) {\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 <div\n tabIndex=\"0\"\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 onKeyDown={e => this.handleKeyDown(e)}\n aria-selected={selected}\n role=\"option\"\n ref={index === 0 ? this.firstItemRef : ''}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={selected}\n >\n <SuggestionItem\n item={item}\n iconColor={this.props.color}\n className={className}\n fontWeights={this.props.fontWeights}\n />\n </div>\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 },\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 },\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 <button\n type=\"button\"\n className={cx(styles.expandButton, styles[expandIcon], {\n [styles.rotate]: listOpen,\n })}\n ref={this.expandListRef}\n id=\"favourite-expand-button\"\n onKeyDown={e => this.handleKeyDown(e)}\n onClick={() => this.toggleList()}\n tabIndex=\"0\"\n aria-pressed={this.state.listOpen}\n aria-label={i18next.t('open-favourites')}\n aria-owns={favourites\n .map((_, i) => `favourite-suggestion-list--item-${i}`)\n .join(' ')}\n aria-activedescendant={\n listOpen\n ? `favourite-suggestion-list--item-${highlightedIndex}`\n : undefined\n }\n >\n <Shimmer active={isLoading}>\n <Icon img={expandIcon} color={this.props.color} />\n </Shimmer>\n </button>\n {/* eslint-enable jsx-a11y/role-supports-aria-props */}\n </div>\n <div className={styles['favourite-suggestion-container']}>\n {listOpen && (\n <div\n className={styles['favourite-suggestion-list']}\n id=\"favourite-suggestion-list\"\n ref={this.suggestionListRef}\n role=\"listbox\"\n aria-label={i18next.t('favourites-list')}\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 </div>\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","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","firstItemRef","current","focus","expandListRef","highlightSuggestion","index","handleClickOutside","suggestionListRef","contains","suggestionSelected","favourites","onClickFavourite","onAddPlace","onEdit","handleKeyDown","next","renderSuggestion","item","undefined","id","selected","highlighted","onMouseEnter","role","autoFocus","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","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,EA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AOuG,UAChDhL,KAAKgJ,uBAAuB0B,KAAI,SAACrC,EAAMZ,UACtC2C,EAAKhC,sBAEEC,GACHS,UAAWsB,EAAKlK,MAAMgE,QAExB4D,EAAWrI,OAASgI,EACpB,8BR1cAxH,EAAkBiG,EAAYtG,UAAWuG,GACrDC,GAAanG,EAAkBiG,EAAaE,MQ6EvB9B,UAAM2G,WAA3BrF,EAgDGsF,aAAe,CACpBnD,iBAAkB,iBAAO,IACzBC,WAAY,iBAAO,IACnBC,OAAQ,iBAAO,IACfoC,UAAW,iBAAO,IAClBE,UAAW,iBAAO,IAClBzD,KAAM,KACN7C,WAAW,EACXC,MAAO,UACP6E,YAAa,CACXmB,OAAQ,MA1DRtE,EA8DG0E,yBAA2B,mBACb,yBACD,wBACA,yBACC,2BACC,8BACE,kDApEpB1E,EACGN,UAAY,CAYjBwC,WAAYvC,UAAU4F,QACpB5F,UAAU6F,MAAM,CACdhG,QAASG,UAAUG,OACnB2F,OAAQ9F,UAAUG,OAClB4F,IAAK/F,UAAUG,OACf6F,IAAKhG,UAAUiG,OACfrG,KAAMI,UAAUG,OAChB+F,IAAKlG,UAAUiG,OACftC,eAAgB3D,UAAUG,OAC1BgG,YAAanG,UAAUG,UAEzBD,WAEFsC,iBAAkBxC,UAAUC,KAE5BwC,WAAYzC,UAAUC,KAEtByC,OAAQ1C,UAAUC,KAElB6E,UAAW9E,UAAUC,KAErB+E,UAAWhF,UAAUC,KAErBsB,KAAMvB,UAAUG,OAEhBzB,UAAWsB,UAAUI,KAErBzB,MAAOqB,UAAUG,OAEjBqD,YAAaxD,UAAU6F,MAAM,CAE3BlB,OAAQ3E,UAAUiG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitransit-component/digitransit-component-favourite-bar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "digitransit-component favourite-bar module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"prop-types": "^15.7.2",
|
|
40
40
|
"react": "^16.13.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "df0a0ca2820c2e56fc317a857c8775cb386b1e6d"
|
|
43
43
|
}
|