@lifesg/web-frontend-engine 2.0.0-alpha.14 → 2.0.0-alpha.15
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/chunks/file-upload-manager.0aff8783.js +2 -0
- package/chunks/file-upload-manager.0aff8783.js.map +1 -0
- package/chunks/{index.05ab1493.js → index.5ecdba9b.js} +2 -2
- package/chunks/{index.05ab1493.js.map → index.5ecdba9b.js.map} +1 -1
- package/chunks/{index.f04f81fc.js → index.8a87a6dc.js} +40 -38
- package/chunks/{index.f04f81fc.js.map → index.8a87a6dc.js.map} +1 -1
- package/chunks/{index.6b027386.js → index.db73ce95.js} +2 -2
- package/chunks/{index.6b027386.js.map → index.db73ce95.js.map} +1 -1
- package/chunks/{location-modal.0c8b2886.js → location-modal.9772cb44.js} +2 -2
- package/chunks/{location-modal.0c8b2886.js.map → location-modal.9772cb44.js.map} +1 -1
- package/cjs/chunks/file-upload-manager.e48ffe50.js +2 -0
- package/cjs/chunks/file-upload-manager.e48ffe50.js.map +1 -0
- package/cjs/chunks/{index.10607639.js → index.377e18d0.js} +2 -2
- package/cjs/chunks/{index.10607639.js.map → index.377e18d0.js.map} +1 -1
- package/cjs/chunks/{index.da017b56.js → index.4bd4aaf3.js} +40 -38
- package/cjs/chunks/{index.da017b56.js.map → index.4bd4aaf3.js.map} +1 -1
- package/cjs/chunks/{index.f0805635.js → index.decb145e.js} +2 -2
- package/cjs/chunks/{index.f0805635.js.map → index.decb145e.js.map} +1 -1
- package/cjs/chunks/{location-modal.683d72a9.js → location-modal.101c9d40.js} +2 -2
- package/cjs/chunks/{location-modal.683d72a9.js.map → location-modal.101c9d40.js.map} +1 -1
- package/cjs/index.js +1 -1
- package/components/custom/filter/filter-checkbox/types.d.ts +1 -1
- package/components/fields/file-upload/file-upload-manager.d.ts +1 -0
- package/components/fields/file-upload/types.d.ts +1 -0
- package/index.js +1 -1
- package/package.json +3 -3
- package/chunks/file-upload-manager.a72f8d0e.js +0 -2
- package/chunks/file-upload-manager.a72f8d0e.js.map +0 -1
- package/cjs/chunks/file-upload-manager.74adb996.js +0 -2
- package/cjs/chunks/file-upload-manager.74adb996.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var t=require("react/jsx-runtime"),e=require("@lifesg/react-design-system/modal"),n=require("@lifesg/react-design-system/theme"),i=require("./index.
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),e=require("@lifesg/react-design-system/modal"),n=require("@lifesg/react-design-system/theme"),i=require("./index.4bd4aaf3.js"),o=require("react"),r=require("styled-components");require("@lifesg/react-design-system/markup");var s=require("react-dom/server"),a=require("@lifesg/react-design-system/typography"),l=require("@lifesg/react-icons/navigation"),h=require("@lifesg/react-icons/navigation-fill"),c=require("@lifesg/react-icons/pin-fill"),u=require("@lifesg/react-design-system/card"),d=require("@lifesg/react-icons/cross"),p=require("@lifesg/react-icons/magnifier"),f=require("@lifesg/react-design-system/button");function m(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}require("@lifesg/react-design-system/alert"),require("@lifesg/react-design-system/layout"),require("@lifesg/react-design-system/box-container"),require("@lifesg/react-design-system/divider"),require("@lifesg/react-design-system/v2_media"),require("@lifesg/react-design-system/text-list"),require("@lifesg/react-design-system/popover-v2"),require("@lifesg/react-icons"),require("@lifesg/react-design-system/tab"),require("@lifesg/react-icons/plus-circle-fill"),require("@lifesg/react-design-system/button-with-icon"),require("@lifesg/react-design-system/error-display"),require("@lifesg/react-design-system/filter"),require("@lifesg/react-design-system/uneditable-section"),require("@lifesg/react-design-system/timeline"),require("@lifesg/react-design-system/form"),require("@lifesg/react-design-system/checkbox"),require("@lifesg/react-design-system/toggle"),require("@lifesg/react-design-system/file-upload"),require("@lifesg/react-design-system/icon-button"),require("@lifesg/react-icons/bin"),require("@lifesg/react-icons/eraser"),require("@lifesg/react-icons/pencil"),require("@lifesg/react-icons/pencil-stroke"),require("@lifesg/react-icons/plus"),require("@lifesg/react-icons/exclamation-triangle"),require("@lifesg/react-design-system/image-button"),require("@lifesg/react-design-system/radio-button"),require("@lifesg/react-design-system/v2_layout");var _=m(r),g=m(s);const v="https://assets.life.gov.sg/web-frontend-engine/img/common/no-network.png";var y={exports:{}};
|
|
2
2
|
/* @preserve
|
|
3
3
|
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
|
4
4
|
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
|
@@ -343,4 +343,4 @@
|
|
|
343
343
|
max-width: 16.5rem;
|
|
344
344
|
}
|
|
345
345
|
`,dt=({id:e,cachedImage:n,refreshNetwork:o})=>t.jsxs(at,{id:i.TestHelper.generateId(e,"no-internet-connectivity"),"data-testid":i.TestHelper.generateId(e,"no-internet-connectivity"),children:[t.jsx(lt,{src:n,alt:"no-connectivity"}),t.jsx(ht,{weight:"semibold",children:"No connection found"}),t.jsx(ct,{children:"Check your internet connection and try again."}),t.jsx(ut,{onClick:o,children:"Try again"})]});exports.default=({id:s="location-modal",className:a,formValues:l,showLocationModal:h,mapPanZoom:c,interactiveMapPinIconUrl:u,reverseGeoCodeEndpoint:d,convertLatLngToXYEndpoint:p,gettingCurrentLocationFetchMessage:f,mapBannerText:m,mustHavePostalCode:_,locationModalStyles:g,onClose:y,onConfirm:x,updateFormValues:b,locationListTitle:w,locationSelectionMode:L,disableSearch:P,addressFieldPlaceholder:T,searchBarIcon:M,bufferRadius:z})=>{const[I,Z]=o.useState("double"),[B,O]=o.useState({}),[A,j]=o.useState([]),[N,R]=o.useState(!0),[D,H]=o.useState(!1),{dispatchFieldEvent:F,addFieldEventListener:$,removeFieldEventListener:W}=i.useFieldEvent(),[q,V]=o.useState(!0),[G,U]=o.useState(!1),[K,Y]=o.useState(!1),[X,J]=o.useState(!1),[Q,tt]=o.useState(),et=o.useRef(!0),nt=o.useContext(r.ThemeContext),it=o.useCallback(((t,e)=>{Z((n=>"double"===n||e&&n!==e?n:t))}),[]),ot=o.useCallback((async()=>{H(!0);if(!!F("get-current-location",s)){const t={};try{t.payload=await i.GeoLocationHelper.getCurrentLocation()}catch(e){t.errors=e}return F("set-current-location",s,t),t.payload}}),[F,s]),rt=o.useCallback((()=>{O(l||{})}),[l]),at=o.useCallback((()=>{et.current=!0,y()}),[y]),lt=o.useCallback((()=>{rt(),at()}),[at,rt]),ht=o.useCallback((t=>{const e=i.lodash.exports.isEmpty(t?.detail)?B:t?.detail;x(e),at()}),[at,x,B]),ct=()=>{!F("before-hide-permission-modal",s)||U(!1)};o.useEffect((()=>{const t={"error-end":t=>{const e=t.detail?.payload?.errorType;if(e)switch(e){case"OneMapError":case"GetLocationTimeoutError":at()}},"set-selectable-pins":t=>{const e=t.detail.pins;Array.isArray(e)?j(e):Y(!0)},"confirm-location":ht,"hide-permission-modal":()=>{U(!1)},"dismiss-location-modal":lt,"trigger-get-current-location":ot};return Object.entries(t).forEach((([t,e])=>{$(t,s,e)})),()=>{Object.entries(t).forEach((([t,e])=>{W(t,s,e)}))}}),[$,ot,lt,at,ht,s,W]),o.useEffect((()=>{if(!window)return;const t=matchMedia(`(max-width: ${n.Breakpoint["lg-max"]({theme:nt})}px)`);Z(t.matches?"map":"double");const e=()=>V(!0),i=()=>V(!1),o=t=>{Z(t.matches?"map":"double")};return window.addEventListener("online",e),window.addEventListener("offline",i),t.addEventListener("change",o),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i),t.removeEventListener("change",o)}}),[]),o.useEffect((()=>{if(!h)return void Z((t=>"double"!==t?"map":t));(async()=>{const{lat:t,lng:e}=l||{};t||e?et.current&&F("get-selectable-pins",s,{lat:t,lng:e}):await ot(),et.current=!1})()}),[F,l,ot,s,h]),o.useEffect((()=>{i.lodash.exports.isEmpty(B)||it("map","search")}),[B,D,it]),o.useEffect((()=>{O(l||{})}),[l]);return t.jsxs(t.Fragment,{children:[t.jsx(E,{src:v,alt:"no internet connectivity"}),t.jsx(e.Modal,{id:i.TestHelper.generateId(s,"modal",h?"show":"hide"),className:`${a}-location-modal`,show:h,children:t.jsx(k,{id:i.TestHelper.generateId(s,"modal-box"),className:`${a}-modal-box`,showCloseButton:!1,locationModalStyles:g,children:q?t.jsxs(t.Fragment,{children:[t.jsx(st,{id:s,className:a,onCancel:lt,onConfirm:()=>{!F("click-confirm-location",s,B)||ht()},updateFormValues:b,gettingCurrentLocation:D,panelInputMode:I,selectedAddressInfo:B,mapPickedLatLng:Q,formValues:l,onChangeSelectedAddressInfo:O,handleApiErrors:t=>{const e=(e,n)=>{!F("error",s,{payload:{errorType:e},errors:t})||n()};H(!1),t instanceof i.OneMapError?e("OneMapError",(()=>{rt(),Y(!0)})):(R(!1),t instanceof i.GeolocationPositionErrorWrapper&&t?.code?.toString()===GeolocationPositionError.TIMEOUT.toString()?e("GetLocationTimeoutError",(()=>{J(!0)})):e("GetLocationError",(()=>{U(!0)})))},onGetLocationCallback:()=>{H(!1),R(!0)},setSinglePanelMode:it,showLocationModal:h,reverseGeoCodeEndpoint:d,convertLatLngToXYEndpoint:p,gettingCurrentLocationFetchMessage:f,mustHavePostalCode:_,locationListTitle:w,restrictLocationSelection:"pins-only"===L,selectablePins:A,disableSearch:P,addressFieldPlaceholder:T,searchBarIcon:M,bufferRadius:z}),t.jsx(C,{id:s,className:a,panelInputMode:I,locationAvailable:N,gettingCurrentLocation:D,showLocationModal:h,selectedLocationCoord:{lat:B.lat,lng:B.lng},getCurrentLocation:ot,onMapCenterChange:t=>{tt(t)},interactiveMapPinIconUrl:u,mapPanZoom:c,mapBannerText:m,disableSelectionFromMap:"pins-only"===L,disableCurrLocationMarker:"pins-only"===L,selectablePins:A})]}):t.jsx(dt,{id:s,cachedImage:v,refreshNetwork:()=>{try{navigator.onLine&&V(!0)}catch(t){}}})})}),(()=>{if(q&&h)return K?t.jsx(i.Prompt,{id:i.TestHelper.generateId(s,"onemap-error"),"data-testid":i.TestHelper.generateId(s,"onemap-error"),title:"Map not available",size:"large",show:!0,image:t.jsx(S,{src:"https://assets.life.gov.sg/web-frontend-engine/img/common/error.svg"}),description:t.jsxs(i.Description,{weight:"regular",children:["Sorry, there was a problem with the map. You’ll not be able to enter the location right now. Please try again later.",t.jsx("br",{}),t.jsx("br",{}),"Do note that you’ll not be able to submit your report without entering the location."]}),buttons:[{id:"ok",title:"OK",onClick:()=>{Y(!1),at()}}]}):G?t.jsx(i.Prompt,{id:i.TestHelper.generateId(s,"get-location-error"),"data-testid":i.TestHelper.generateId(s,"get-location-error"),title:"Enable location settings",size:"large",show:!0,description:"We need your permission to determine your location. Enable location access in your browser and device settings, or enter your location manually.",buttons:[{id:"ok",title:"OK",onClick:ct}]}):X?t.jsx(i.Prompt,{id:i.TestHelper.generateId(s,"get-location-timeout-error"),"data-testid":i.TestHelper.generateId(s,"get-location-timeout-error"),title:"Something went wrong",size:"large",show:!0,image:t.jsx(S,{src:"https://assets.life.gov.sg/web-frontend-engine/img/icons/get-location-timeout.svg"}),description:t.jsx(i.Description,{weight:"regular",children:"It’s taking longer than expected to retrieve your location. Please exit the map and try again."}),buttons:[{id:"ok",title:"OK",onClick:()=>{J(!1),at()}}]}):void 0})()]})};
|
|
346
|
-
//# sourceMappingURL=location-modal.
|
|
346
|
+
//# sourceMappingURL=location-modal.101c9d40.js.map
|