@panneau/fields 5.0.0-alpha.4 → 5.0.0-alpha.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/README.md +67 -21
- package/dist/duration/DurationField.css +11 -0
- package/dist/duration/DurationField.d.ts +26 -0
- package/dist/duration/DurationField.d.ts.map +1 -0
- package/dist/duration/DurationField.js +129 -0
- package/dist/duration/DurationField.js.map +1 -0
- package/dist/duration/DurationField.module.js +12 -0
- package/dist/duration/DurationField.module.js.map +1 -0
- package/dist/duration/index.d.ts +2 -0
- package/dist/duration/index.d.ts.map +1 -0
- package/dist/duration/index.js +1 -0
- package/dist/embed/EmbedField.css +60 -0
- package/dist/embed/EmbedField.d.ts +20 -0
- package/dist/embed/EmbedField.d.ts.map +1 -0
- package/dist/embed/EmbedField.js +130 -0
- package/dist/embed/EmbedField.js.map +1 -0
- package/dist/embed/EmbedField.module.js +22 -0
- package/dist/embed/EmbedField.module.js.map +1 -0
- package/dist/embed/index.d.ts +3 -0
- package/dist/embed/index.d.ts.map +1 -0
- package/dist/embed/index.js +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/json/JsonField.css +7 -0
- package/dist/json/JsonField.d.ts +22 -0
- package/dist/json/JsonField.d.ts.map +1 -0
- package/dist/json/JsonField.js +125 -0
- package/dist/json/JsonField.js.map +1 -0
- package/dist/json/JsonField.module.js +8 -0
- package/dist/json/JsonField.module.js.map +1 -0
- package/dist/json/index.d.ts +2 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/index.js +1 -0
- package/dist/localized/LocalizedField.d.ts.map +1 -1
- package/dist/localized/LocalizedField.js +1 -0
- package/dist/localized/LocalizedField.js.map +1 -1
- package/dist/location/LocationField.css +54 -0
- package/dist/location/LocationField.d.ts +31 -0
- package/dist/location/LocationField.d.ts.map +1 -0
- package/dist/location/LocationField.js +350 -0
- package/dist/location/LocationField.js.map +1 -0
- package/dist/location/LocationField.module.js +22 -0
- package/dist/location/LocationField.module.js.map +1 -0
- package/dist/location/LocationMap.d.ts +25 -0
- package/dist/location/LocationMap.d.ts.map +1 -0
- package/dist/location/LocationMap.js +115 -0
- package/dist/location/LocationMap.js.map +1 -0
- package/dist/location/index.d.ts +5 -0
- package/dist/location/index.d.ts.map +1 -0
- package/dist/location/index.js +4 -0
- package/dist/location/leafletCss.d.ts +2 -0
- package/dist/location/leafletCss.d.ts.map +1 -0
- package/dist/location/leafletCss.js +6 -0
- package/dist/location/leafletCss.js.map +1 -0
- package/dist/location/nominatim.d.ts +17 -0
- package/dist/location/nominatim.d.ts.map +1 -0
- package/dist/location/nominatim.js +50 -0
- package/dist/location/nominatim.js.map +1 -0
- package/dist/location/types.d.ts +40 -0
- package/dist/location/types.d.ts.map +1 -0
- package/dist/range/RangeField.d.ts +22 -0
- package/dist/range/RangeField.d.ts.map +1 -0
- package/dist/range/RangeField.js +132 -0
- package/dist/range/RangeField.js.map +1 -0
- package/dist/range/index.d.ts +2 -0
- package/dist/range/index.d.ts.map +1 -0
- package/dist/range/index.js +1 -0
- package/dist/relation/RelationField.d.ts.map +1 -1
- package/dist/relation/RelationField.js +24 -24
- package/dist/relation/RelationField.js.map +1 -1
- package/dist/shared/DefinitionField.d.ts +3 -1
- package/dist/shared/DefinitionField.d.ts.map +1 -1
- package/dist/shared/DefinitionField.js +80 -72
- package/dist/shared/DefinitionField.js.map +1 -1
- package/dist/shared/builtIn.d.ts +1 -0
- package/dist/shared/builtIn.d.ts.map +1 -1
- package/dist/shared/builtIn.js +16 -1
- package/dist/shared/builtIn.js.map +1 -1
- package/dist/shared/check.d.ts +27 -0
- package/dist/shared/check.d.ts.map +1 -0
- package/dist/shared/check.js +18 -0
- package/dist/shared/check.js.map +1 -0
- package/dist/shared/context.d.ts +18 -3
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/context.js +31 -19
- package/dist/shared/context.js.map +1 -1
- package/dist/shared/embed.d.ts +19 -0
- package/dist/shared/embed.d.ts.map +1 -0
- package/dist/shared/embed.js +14 -0
- package/dist/shared/embed.js.map +1 -0
- package/dist/shared/types.d.ts +2 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/slug/SlugField.css +18 -0
- package/dist/slug/SlugField.d.ts +31 -3
- package/dist/slug/SlugField.d.ts.map +1 -1
- package/dist/slug/SlugField.js +231 -159
- package/dist/slug/SlugField.js.map +1 -1
- package/dist/slug/SlugField.module.js +14 -0
- package/dist/slug/SlugField.module.js.map +1 -0
- package/dist/slug/index.d.ts +1 -1
- package/dist/slug/index.d.ts.map +1 -1
- package/dist/slug/index.js +1 -1
- package/dist/tags/TagsField.d.ts +17 -0
- package/dist/tags/TagsField.d.ts.map +1 -0
- package/dist/tags/TagsField.js +120 -0
- package/dist/tags/TagsField.js.map +1 -0
- package/dist/tags/index.d.ts +2 -0
- package/dist/tags/index.d.ts.map +1 -0
- package/dist/tags/index.js +1 -0
- package/dist/tel/TelField.d.ts +11 -0
- package/dist/tel/TelField.d.ts.map +1 -0
- package/dist/tel/TelField.js +87 -0
- package/dist/tel/TelField.js.map +1 -0
- package/dist/tel/index.d.ts +2 -0
- package/dist/tel/index.d.ts.map +1 -0
- package/dist/tel/index.js +1 -0
- package/package.json +41 -4
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/location/leafletCss.ts
|
|
2
|
+
var LEAFLET_CSS = ".leaflet-pane,\r\n.leaflet-tile,\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow,\r\n.leaflet-tile-container,\r\n.leaflet-pane > svg,\r\n.leaflet-pane > canvas,\r\n.leaflet-zoom-box,\r\n.leaflet-image-layer,\r\n.leaflet-layer {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n }\r\n.leaflet-container {\r\n overflow: hidden;\r\n }\r\n.leaflet-tile,\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n user-select: none;\r\n -webkit-user-drag: none;\r\n }\r\n.leaflet-tile::selection {\r\n background: transparent;\r\n}\r\n.leaflet-safari .leaflet-tile {\r\n image-rendering: -webkit-optimize-contrast;\r\n }\r\n.leaflet-safari .leaflet-tile-container {\r\n width: 1600px;\r\n height: 1600px;\r\n -webkit-transform-origin: 0 0;\r\n }\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow {\r\n display: block;\r\n }\r\n.leaflet-container .leaflet-overlay-pane svg {\r\n max-width: none !important;\r\n max-height: none !important;\r\n }\r\n.leaflet-container .leaflet-marker-pane img,\r\n.leaflet-container .leaflet-shadow-pane img,\r\n.leaflet-container .leaflet-tile-pane img,\r\n.leaflet-container img.leaflet-image-layer,\r\n.leaflet-container .leaflet-tile {\r\n max-width: none !important;\r\n max-height: none !important;\r\n width: auto;\r\n padding: 0;\r\n }\r\n.leaflet-container img.leaflet-tile {\r\n mix-blend-mode: plus-lighter;\r\n}\r\n.leaflet-container.leaflet-touch-zoom {\r\n -ms-touch-action: pan-x pan-y;\r\n touch-action: pan-x pan-y;\r\n }\r\n.leaflet-container.leaflet-touch-drag {\r\n -ms-touch-action: pinch-zoom;\r\n touch-action: none;\r\n touch-action: pinch-zoom;\r\n}\r\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\r\n -ms-touch-action: none;\r\n touch-action: none;\r\n}\r\n.leaflet-container {\r\n -webkit-tap-highlight-color: transparent;\r\n}\r\n.leaflet-container a {\r\n -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\r\n}\r\n.leaflet-tile {\r\n filter: inherit;\r\n visibility: hidden;\r\n }\r\n.leaflet-tile-loaded {\r\n visibility: inherit;\r\n }\r\n.leaflet-zoom-box {\r\n width: 0;\r\n height: 0;\r\n -moz-box-sizing: border-box;\r\n box-sizing: border-box;\r\n z-index: 800;\r\n }\r\n.leaflet-overlay-pane svg {\r\n -moz-user-select: none;\r\n }\r\n.leaflet-pane { z-index: 400; }\r\n.leaflet-tile-pane { z-index: 200; }\r\n.leaflet-overlay-pane { z-index: 400; }\r\n.leaflet-shadow-pane { z-index: 500; }\r\n.leaflet-marker-pane { z-index: 600; }\r\n.leaflet-tooltip-pane { z-index: 650; }\r\n.leaflet-popup-pane { z-index: 700; }\r\n.leaflet-map-pane canvas { z-index: 100; }\r\n.leaflet-map-pane svg { z-index: 200; }\r\n.leaflet-vml-shape {\r\n width: 1px;\r\n height: 1px;\r\n }\r\n.lvml {\r\n behavior: url(#default#VML);\r\n display: inline-block;\r\n position: absolute;\r\n }\r\n.leaflet-control {\r\n position: relative;\r\n z-index: 800;\r\n pointer-events: visiblePainted; \r\n pointer-events: auto;\r\n }\r\n.leaflet-top,\r\n.leaflet-bottom {\r\n position: absolute;\r\n z-index: 1000;\r\n pointer-events: none;\r\n }\r\n.leaflet-top {\r\n top: 0;\r\n }\r\n.leaflet-right {\r\n right: 0;\r\n }\r\n.leaflet-bottom {\r\n bottom: 0;\r\n }\r\n.leaflet-left {\r\n left: 0;\r\n }\r\n.leaflet-control {\r\n float: left;\r\n clear: both;\r\n }\r\n.leaflet-right .leaflet-control {\r\n float: right;\r\n }\r\n.leaflet-top .leaflet-control {\r\n margin-top: 10px;\r\n }\r\n.leaflet-bottom .leaflet-control {\r\n margin-bottom: 10px;\r\n }\r\n.leaflet-left .leaflet-control {\r\n margin-left: 10px;\r\n }\r\n.leaflet-right .leaflet-control {\r\n margin-right: 10px;\r\n }\r\n.leaflet-fade-anim .leaflet-popup {\r\n opacity: 0;\r\n -webkit-transition: opacity 0.2s linear;\r\n -moz-transition: opacity 0.2s linear;\r\n transition: opacity 0.2s linear;\r\n }\r\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\r\n opacity: 1;\r\n }\r\n.leaflet-zoom-animated {\r\n -webkit-transform-origin: 0 0;\r\n -ms-transform-origin: 0 0;\r\n transform-origin: 0 0;\r\n }\r\nsvg.leaflet-zoom-animated {\r\n will-change: transform;\r\n}\r\n.leaflet-zoom-anim .leaflet-zoom-animated {\r\n -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\r\n -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\r\n transition: transform 0.25s cubic-bezier(0,0,0.25,1);\r\n }\r\n.leaflet-zoom-anim .leaflet-tile,\r\n.leaflet-pan-anim .leaflet-tile {\r\n -webkit-transition: none;\r\n -moz-transition: none;\r\n transition: none;\r\n }\r\n.leaflet-zoom-anim .leaflet-zoom-hide {\r\n visibility: hidden;\r\n }\r\n.leaflet-interactive {\r\n cursor: pointer;\r\n }\r\n.leaflet-grab {\r\n cursor: -webkit-grab;\r\n cursor: -moz-grab;\r\n cursor: grab;\r\n }\r\n.leaflet-crosshair,\r\n.leaflet-crosshair .leaflet-interactive {\r\n cursor: crosshair;\r\n }\r\n.leaflet-popup-pane,\r\n.leaflet-control {\r\n cursor: auto;\r\n }\r\n.leaflet-dragging .leaflet-grab,\r\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\r\n.leaflet-dragging .leaflet-marker-draggable {\r\n cursor: move;\r\n cursor: -webkit-grabbing;\r\n cursor: -moz-grabbing;\r\n cursor: grabbing;\r\n }\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow,\r\n.leaflet-image-layer,\r\n.leaflet-pane > svg path,\r\n.leaflet-tile-container {\r\n pointer-events: none;\r\n }\r\n.leaflet-marker-icon.leaflet-interactive,\r\n.leaflet-image-layer.leaflet-interactive,\r\n.leaflet-pane > svg path.leaflet-interactive,\r\nsvg.leaflet-image-layer.leaflet-interactive path {\r\n pointer-events: visiblePainted; \r\n pointer-events: auto;\r\n }\r\n.leaflet-container {\r\n background: #ddd;\r\n outline-offset: 1px;\r\n }\r\n.leaflet-container a {\r\n color: #0078A8;\r\n }\r\n.leaflet-zoom-box {\r\n border: 2px dotted #38f;\r\n background: rgba(255,255,255,0.5);\r\n }\r\n.leaflet-container {\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-size: 12px;\r\n font-size: 0.75rem;\r\n line-height: 1.5;\r\n }\r\n.leaflet-bar {\r\n box-shadow: 0 1px 5px rgba(0,0,0,0.65);\r\n border-radius: 4px;\r\n }\r\n.leaflet-bar a {\r\n background-color: #fff;\r\n border-bottom: 1px solid #ccc;\r\n width: 26px;\r\n height: 26px;\r\n line-height: 26px;\r\n display: block;\r\n text-align: center;\r\n text-decoration: none;\r\n color: black;\r\n }\r\n.leaflet-bar a,\r\n.leaflet-control-layers-toggle {\r\n background-position: 50% 50%;\r\n background-repeat: no-repeat;\r\n display: block;\r\n }\r\n.leaflet-bar a:hover,\r\n.leaflet-bar a:focus {\r\n background-color: #f4f4f4;\r\n }\r\n.leaflet-bar a:first-child {\r\n border-top-left-radius: 4px;\r\n border-top-right-radius: 4px;\r\n }\r\n.leaflet-bar a:last-child {\r\n border-bottom-left-radius: 4px;\r\n border-bottom-right-radius: 4px;\r\n border-bottom: none;\r\n }\r\n.leaflet-bar a.leaflet-disabled {\r\n cursor: default;\r\n background-color: #f4f4f4;\r\n color: #bbb;\r\n }\r\n.leaflet-touch .leaflet-bar a {\r\n width: 30px;\r\n height: 30px;\r\n line-height: 30px;\r\n }\r\n.leaflet-touch .leaflet-bar a:first-child {\r\n border-top-left-radius: 2px;\r\n border-top-right-radius: 2px;\r\n }\r\n.leaflet-touch .leaflet-bar a:last-child {\r\n border-bottom-left-radius: 2px;\r\n border-bottom-right-radius: 2px;\r\n }\r\n.leaflet-control-zoom-in,\r\n.leaflet-control-zoom-out {\r\n font: bold 18px 'Lucida Console', Monaco, monospace;\r\n text-indent: 1px;\r\n }\r\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\r\n font-size: 22px;\r\n }\r\n.leaflet-control-layers {\r\n box-shadow: 0 1px 5px rgba(0,0,0,0.4);\r\n background: #fff;\r\n border-radius: 5px;\r\n }\r\n.leaflet-control-layers-toggle {\r\n background-image: url(images/layers.png);\r\n width: 36px;\r\n height: 36px;\r\n }\r\n.leaflet-retina .leaflet-control-layers-toggle {\r\n background-image: url(images/layers-2x.png);\r\n background-size: 26px 26px;\r\n }\r\n.leaflet-touch .leaflet-control-layers-toggle {\r\n width: 44px;\r\n height: 44px;\r\n }\r\n.leaflet-control-layers .leaflet-control-layers-list,\r\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\r\n display: none;\r\n }\r\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\r\n display: block;\r\n position: relative;\r\n }\r\n.leaflet-control-layers-expanded {\r\n padding: 6px 10px 6px 6px;\r\n color: #333;\r\n background: #fff;\r\n }\r\n.leaflet-control-layers-scrollbar {\r\n overflow-y: scroll;\r\n overflow-x: hidden;\r\n padding-right: 5px;\r\n }\r\n.leaflet-control-layers-selector {\r\n margin-top: 2px;\r\n position: relative;\r\n top: 1px;\r\n }\r\n.leaflet-control-layers label {\r\n display: block;\r\n font-size: 13px;\r\n font-size: 1.08333em;\r\n }\r\n.leaflet-control-layers-separator {\r\n height: 0;\r\n border-top: 1px solid #ddd;\r\n margin: 5px -10px 5px -6px;\r\n }\r\n.leaflet-default-icon-path { \r\n background-image: url(images/marker-icon.png);\r\n }\r\n.leaflet-container .leaflet-control-attribution {\r\n background: #fff;\r\n background: rgba(255, 255, 255, 0.8);\r\n margin: 0;\r\n }\r\n.leaflet-control-attribution,\r\n.leaflet-control-scale-line {\r\n padding: 0 5px;\r\n color: #333;\r\n line-height: 1.4;\r\n }\r\n.leaflet-control-attribution a {\r\n text-decoration: none;\r\n }\r\n.leaflet-control-attribution a:hover,\r\n.leaflet-control-attribution a:focus {\r\n text-decoration: underline;\r\n }\r\n.leaflet-attribution-flag {\r\n display: inline !important;\r\n vertical-align: baseline !important;\r\n width: 1em;\r\n height: 0.6669em;\r\n }\r\n.leaflet-left .leaflet-control-scale {\r\n margin-left: 5px;\r\n }\r\n.leaflet-bottom .leaflet-control-scale {\r\n margin-bottom: 5px;\r\n }\r\n.leaflet-control-scale-line {\r\n border: 2px solid #777;\r\n border-top: none;\r\n line-height: 1.1;\r\n padding: 2px 5px 1px;\r\n white-space: nowrap;\r\n -moz-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background: rgba(255, 255, 255, 0.8);\r\n text-shadow: 1px 1px #fff;\r\n }\r\n.leaflet-control-scale-line:not(:first-child) {\r\n border-top: 2px solid #777;\r\n border-bottom: none;\r\n margin-top: -2px;\r\n }\r\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\r\n border-bottom: 2px solid #777;\r\n }\r\n.leaflet-touch .leaflet-control-attribution,\r\n.leaflet-touch .leaflet-control-layers,\r\n.leaflet-touch .leaflet-bar {\r\n box-shadow: none;\r\n }\r\n.leaflet-touch .leaflet-control-layers,\r\n.leaflet-touch .leaflet-bar {\r\n border: 2px solid rgba(0,0,0,0.2);\r\n background-clip: padding-box;\r\n }\r\n.leaflet-popup {\r\n position: absolute;\r\n text-align: center;\r\n margin-bottom: 20px;\r\n }\r\n.leaflet-popup-content-wrapper {\r\n padding: 1px;\r\n text-align: left;\r\n border-radius: 12px;\r\n }\r\n.leaflet-popup-content {\r\n margin: 13px 24px 13px 20px;\r\n line-height: 1.3;\r\n font-size: 13px;\r\n font-size: 1.08333em;\r\n min-height: 1px;\r\n }\r\n.leaflet-popup-content p {\r\n margin: 17px 0;\r\n margin: 1.3em 0;\r\n }\r\n.leaflet-popup-tip-container {\r\n width: 40px;\r\n height: 20px;\r\n position: absolute;\r\n left: 50%;\r\n margin-top: -1px;\r\n margin-left: -20px;\r\n overflow: hidden;\r\n pointer-events: none;\r\n }\r\n.leaflet-popup-tip {\r\n width: 17px;\r\n height: 17px;\r\n padding: 1px;\r\n margin: -10px auto 0;\r\n pointer-events: auto;\r\n -webkit-transform: rotate(45deg);\r\n -moz-transform: rotate(45deg);\r\n -ms-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n.leaflet-popup-content-wrapper,\r\n.leaflet-popup-tip {\r\n background: white;\r\n color: #333;\r\n box-shadow: 0 3px 14px rgba(0,0,0,0.4);\r\n }\r\n.leaflet-container a.leaflet-popup-close-button {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n border: none;\r\n text-align: center;\r\n width: 24px;\r\n height: 24px;\r\n font: 16px/24px Tahoma, Verdana, sans-serif;\r\n color: #757575;\r\n text-decoration: none;\r\n background: transparent;\r\n }\r\n.leaflet-container a.leaflet-popup-close-button:hover,\r\n.leaflet-container a.leaflet-popup-close-button:focus {\r\n color: #585858;\r\n }\r\n.leaflet-popup-scrolled {\r\n overflow: auto;\r\n }\r\n.leaflet-oldie .leaflet-popup-content-wrapper {\r\n -ms-zoom: 1;\r\n }\r\n.leaflet-oldie .leaflet-popup-tip {\r\n width: 24px;\r\n margin: 0 auto;\r\n -ms-filter: \"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\";\r\n filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\r\n }\r\n.leaflet-oldie .leaflet-control-zoom,\r\n.leaflet-oldie .leaflet-control-layers,\r\n.leaflet-oldie .leaflet-popup-content-wrapper,\r\n.leaflet-oldie .leaflet-popup-tip {\r\n border: 1px solid #999;\r\n }\r\n.leaflet-div-icon {\r\n background: #fff;\r\n border: 1px solid #666;\r\n }\r\n.leaflet-tooltip {\r\n position: absolute;\r\n padding: 6px;\r\n background-color: #fff;\r\n border: 1px solid #fff;\r\n border-radius: 3px;\r\n color: #222;\r\n white-space: nowrap;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n pointer-events: none;\r\n box-shadow: 0 1px 3px rgba(0,0,0,0.4);\r\n }\r\n.leaflet-tooltip.leaflet-interactive {\r\n cursor: pointer;\r\n pointer-events: auto;\r\n }\r\n.leaflet-tooltip-top:before,\r\n.leaflet-tooltip-bottom:before,\r\n.leaflet-tooltip-left:before,\r\n.leaflet-tooltip-right:before {\r\n position: absolute;\r\n pointer-events: none;\r\n border: 6px solid transparent;\r\n background: transparent;\r\n content: \"\";\r\n }\r\n.leaflet-tooltip-bottom {\r\n margin-top: 6px;\r\n}\r\n.leaflet-tooltip-top {\r\n margin-top: -6px;\r\n}\r\n.leaflet-tooltip-bottom:before,\r\n.leaflet-tooltip-top:before {\r\n left: 50%;\r\n margin-left: -6px;\r\n }\r\n.leaflet-tooltip-top:before {\r\n bottom: 0;\r\n margin-bottom: -12px;\r\n border-top-color: #fff;\r\n }\r\n.leaflet-tooltip-bottom:before {\r\n top: 0;\r\n margin-top: -12px;\r\n margin-left: -6px;\r\n border-bottom-color: #fff;\r\n }\r\n.leaflet-tooltip-left {\r\n margin-left: -6px;\r\n}\r\n.leaflet-tooltip-right {\r\n margin-left: 6px;\r\n}\r\n.leaflet-tooltip-left:before,\r\n.leaflet-tooltip-right:before {\r\n top: 50%;\r\n margin-top: -6px;\r\n }\r\n.leaflet-tooltip-left:before {\r\n right: 0;\r\n margin-right: -12px;\r\n border-left-color: #fff;\r\n }\r\n.leaflet-tooltip-right:before {\r\n left: 0;\r\n margin-left: -12px;\r\n border-right-color: #fff;\r\n }\r\n@media print {\r\n .leaflet-control {\r\n -webkit-print-color-adjust: exact;\r\n print-color-adjust: exact;\r\n }\r\n }";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { LEAFLET_CSS };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=leafletCss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leafletCss.js","names":[],"sources":["../../src/location/leafletCss.ts"],"sourcesContent":["// The stylesheet of Leaflet 1.9.4 (BSD-2-Clause, (c) Volodymyr Agafonkin and CloudMade), without\n// its comments: Leaflet's own classes, injected once when a map first shows. Regenerate it from\n// leaflet/dist/leaflet.css when Leaflet is updated.\nexport const LEAFLET_CSS =\n '.leaflet-pane,\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-tile-container,\\r\\n.leaflet-pane > svg,\\r\\n.leaflet-pane > canvas,\\r\\n.leaflet-zoom-box,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-layer {\\r\\n\\tposition: absolute;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\toverflow: hidden;\\r\\n\\t}\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\t-webkit-user-select: none;\\r\\n\\t -moz-user-select: none;\\r\\n\\t user-select: none;\\r\\n\\t -webkit-user-drag: none;\\r\\n\\t}\\r\\n.leaflet-tile::selection {\\r\\n\\tbackground: transparent;\\r\\n}\\r\\n.leaflet-safari .leaflet-tile {\\r\\n\\timage-rendering: -webkit-optimize-contrast;\\r\\n\\t}\\r\\n.leaflet-safari .leaflet-tile-container {\\r\\n\\twidth: 1600px;\\r\\n\\theight: 1600px;\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-overlay-pane svg {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-marker-pane img,\\r\\n.leaflet-container .leaflet-shadow-pane img,\\r\\n.leaflet-container .leaflet-tile-pane img,\\r\\n.leaflet-container img.leaflet-image-layer,\\r\\n.leaflet-container .leaflet-tile {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\twidth: auto;\\r\\n\\tpadding: 0;\\r\\n\\t}\\r\\n.leaflet-container img.leaflet-tile {\\r\\n\\tmix-blend-mode: plus-lighter;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: pan-x pan-y;\\r\\n\\ttouch-action: pan-x pan-y;\\r\\n\\t}\\r\\n.leaflet-container.leaflet-touch-drag {\\r\\n\\t-ms-touch-action: pinch-zoom;\\r\\n\\ttouch-action: none;\\r\\n\\ttouch-action: pinch-zoom;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: none;\\r\\n\\ttouch-action: none;\\r\\n}\\r\\n.leaflet-container {\\r\\n\\t-webkit-tap-highlight-color: transparent;\\r\\n}\\r\\n.leaflet-container a {\\r\\n\\t-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\\r\\n}\\r\\n.leaflet-tile {\\r\\n\\tfilter: inherit;\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-tile-loaded {\\r\\n\\tvisibility: inherit;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\twidth: 0;\\r\\n\\theight: 0;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tz-index: 800;\\r\\n\\t}\\r\\n.leaflet-overlay-pane svg {\\r\\n\\t-moz-user-select: none;\\r\\n\\t}\\r\\n.leaflet-pane { z-index: 400; }\\r\\n.leaflet-tile-pane { z-index: 200; }\\r\\n.leaflet-overlay-pane { z-index: 400; }\\r\\n.leaflet-shadow-pane { z-index: 500; }\\r\\n.leaflet-marker-pane { z-index: 600; }\\r\\n.leaflet-tooltip-pane { z-index: 650; }\\r\\n.leaflet-popup-pane { z-index: 700; }\\r\\n.leaflet-map-pane canvas { z-index: 100; }\\r\\n.leaflet-map-pane svg { z-index: 200; }\\r\\n.leaflet-vml-shape {\\r\\n\\twidth: 1px;\\r\\n\\theight: 1px;\\r\\n\\t}\\r\\n.lvml {\\r\\n\\tbehavior: url(#default#VML);\\r\\n\\tdisplay: inline-block;\\r\\n\\tposition: absolute;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tposition: relative;\\r\\n\\tz-index: 800;\\r\\n\\tpointer-events: visiblePainted; \\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-top,\\r\\n.leaflet-bottom {\\r\\n\\tposition: absolute;\\r\\n\\tz-index: 1000;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-top {\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-right {\\r\\n\\tright: 0;\\r\\n\\t}\\r\\n.leaflet-bottom {\\r\\n\\tbottom: 0;\\r\\n\\t}\\r\\n.leaflet-left {\\r\\n\\tleft: 0;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tfloat: left;\\r\\n\\tclear: both;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tfloat: right;\\r\\n\\t}\\r\\n.leaflet-top .leaflet-control {\\r\\n\\tmargin-top: 10px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control {\\r\\n\\tmargin-bottom: 10px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control {\\r\\n\\tmargin-left: 10px;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tmargin-right: 10px;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-popup {\\r\\n\\topacity: 0;\\r\\n\\t-webkit-transition: opacity 0.2s linear;\\r\\n\\t -moz-transition: opacity 0.2s linear;\\r\\n\\t transition: opacity 0.2s linear;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\\r\\n\\topacity: 1;\\r\\n\\t}\\r\\n.leaflet-zoom-animated {\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t -ms-transform-origin: 0 0;\\r\\n\\t transform-origin: 0 0;\\r\\n\\t}\\r\\nsvg.leaflet-zoom-animated {\\r\\n\\twill-change: transform;\\r\\n}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\t-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t transition: transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-tile,\\r\\n.leaflet-pan-anim .leaflet-tile {\\r\\n\\t-webkit-transition: none;\\r\\n\\t -moz-transition: none;\\r\\n\\t transition: none;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-hide {\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\t}\\r\\n.leaflet-grab {\\r\\n\\tcursor: -webkit-grab;\\r\\n\\tcursor: -moz-grab;\\r\\n\\tcursor: grab;\\r\\n\\t}\\r\\n.leaflet-crosshair,\\r\\n.leaflet-crosshair .leaflet-interactive {\\r\\n\\tcursor: crosshair;\\r\\n\\t}\\r\\n.leaflet-popup-pane,\\r\\n.leaflet-control {\\r\\n\\tcursor: auto;\\r\\n\\t}\\r\\n.leaflet-dragging .leaflet-grab,\\r\\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\\r\\n.leaflet-dragging .leaflet-marker-draggable {\\r\\n\\tcursor: move;\\r\\n\\tcursor: -webkit-grabbing;\\r\\n\\tcursor: -moz-grabbing;\\r\\n\\tcursor: grabbing;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-pane > svg path,\\r\\n.leaflet-tile-container {\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-marker-icon.leaflet-interactive,\\r\\n.leaflet-image-layer.leaflet-interactive,\\r\\n.leaflet-pane > svg path.leaflet-interactive,\\r\\nsvg.leaflet-image-layer.leaflet-interactive path {\\r\\n\\tpointer-events: visiblePainted; \\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\tbackground: #ddd;\\r\\n\\toutline-offset: 1px;\\r\\n\\t}\\r\\n.leaflet-container a {\\r\\n\\tcolor: #0078A8;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\tborder: 2px dotted #38f;\\r\\n\\tbackground: rgba(255,255,255,0.5);\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\tfont-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\\r\\n\\tfont-size: 12px;\\r\\n\\tfont-size: 0.75rem;\\r\\n\\tline-height: 1.5;\\r\\n\\t}\\r\\n.leaflet-bar {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.65);\\r\\n\\tborder-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a {\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder-bottom: 1px solid #ccc;\\r\\n\\twidth: 26px;\\r\\n\\theight: 26px;\\r\\n\\tline-height: 26px;\\r\\n\\tdisplay: block;\\r\\n\\ttext-align: center;\\r\\n\\ttext-decoration: none;\\r\\n\\tcolor: black;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-position: 50% 50%;\\r\\n\\tbackground-repeat: no-repeat;\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-bar a:hover,\\r\\n.leaflet-bar a:focus {\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\t}\\r\\n.leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 4px;\\r\\n\\tborder-top-right-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 4px;\\r\\n\\tborder-bottom-right-radius: 4px;\\r\\n\\tborder-bottom: none;\\r\\n\\t}\\r\\n.leaflet-bar a.leaflet-disabled {\\r\\n\\tcursor: default;\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\tcolor: #bbb;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a {\\r\\n\\twidth: 30px;\\r\\n\\theight: 30px;\\r\\n\\tline-height: 30px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 2px;\\r\\n\\tborder-top-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 2px;\\r\\n\\tborder-bottom-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-control-zoom-in,\\r\\n.leaflet-control-zoom-out {\\r\\n\\tfont: bold 18px \\'Lucida Console\\', Monaco, monospace;\\r\\n\\ttext-indent: 1px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\\r\\n\\tfont-size: 22px;\\r\\n\\t}\\r\\n.leaflet-control-layers {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.4);\\r\\n\\tbackground: #fff;\\r\\n\\tborder-radius: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(images/layers.png);\\r\\n\\twidth: 36px;\\r\\n\\theight: 36px;\\r\\n\\t}\\r\\n.leaflet-retina .leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(images/layers-2x.png);\\r\\n\\tbackground-size: 26px 26px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers-toggle {\\r\\n\\twidth: 44px;\\r\\n\\theight: 44px;\\r\\n\\t}\\r\\n.leaflet-control-layers .leaflet-control-layers-list,\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\\r\\n\\tdisplay: none;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\\r\\n\\tdisplay: block;\\r\\n\\tposition: relative;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded {\\r\\n\\tpadding: 6px 10px 6px 6px;\\r\\n\\tcolor: #333;\\r\\n\\tbackground: #fff;\\r\\n\\t}\\r\\n.leaflet-control-layers-scrollbar {\\r\\n\\toverflow-y: scroll;\\r\\n\\toverflow-x: hidden;\\r\\n\\tpadding-right: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-selector {\\r\\n\\tmargin-top: 2px;\\r\\n\\tposition: relative;\\r\\n\\ttop: 1px;\\r\\n\\t}\\r\\n.leaflet-control-layers label {\\r\\n\\tdisplay: block;\\r\\n\\tfont-size: 13px;\\r\\n\\tfont-size: 1.08333em;\\r\\n\\t}\\r\\n.leaflet-control-layers-separator {\\r\\n\\theight: 0;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\tmargin: 5px -10px 5px -6px;\\r\\n\\t}\\r\\n.leaflet-default-icon-path { \\r\\n\\tbackground-image: url(images/marker-icon.png);\\r\\n\\t}\\r\\n.leaflet-container .leaflet-control-attribution {\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.8);\\r\\n\\tmargin: 0;\\r\\n\\t}\\r\\n.leaflet-control-attribution,\\r\\n.leaflet-control-scale-line {\\r\\n\\tpadding: 0 5px;\\r\\n\\tcolor: #333;\\r\\n\\tline-height: 1.4;\\r\\n\\t}\\r\\n.leaflet-control-attribution a {\\r\\n\\ttext-decoration: none;\\r\\n\\t}\\r\\n.leaflet-control-attribution a:hover,\\r\\n.leaflet-control-attribution a:focus {\\r\\n\\ttext-decoration: underline;\\r\\n\\t}\\r\\n.leaflet-attribution-flag {\\r\\n\\tdisplay: inline !important;\\r\\n\\tvertical-align: baseline !important;\\r\\n\\twidth: 1em;\\r\\n\\theight: 0.6669em;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control-scale {\\r\\n\\tmargin-left: 5px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control-scale {\\r\\n\\tmargin-bottom: 5px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line {\\r\\n\\tborder: 2px solid #777;\\r\\n\\tborder-top: none;\\r\\n\\tline-height: 1.1;\\r\\n\\tpadding: 2px 5px 1px;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tbackground: rgba(255, 255, 255, 0.8);\\r\\n\\ttext-shadow: 1px 1px #fff;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child) {\\r\\n\\tborder-top: 2px solid #777;\\r\\n\\tborder-bottom: none;\\r\\n\\tmargin-top: -2px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\\r\\n\\tborder-bottom: 2px solid #777;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-attribution,\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tbox-shadow: none;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tborder: 2px solid rgba(0,0,0,0.2);\\r\\n\\tbackground-clip: padding-box;\\r\\n\\t}\\r\\n.leaflet-popup {\\r\\n\\tposition: absolute;\\r\\n\\ttext-align: center;\\r\\n\\tmargin-bottom: 20px;\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper {\\r\\n\\tpadding: 1px;\\r\\n\\ttext-align: left;\\r\\n\\tborder-radius: 12px;\\r\\n\\t}\\r\\n.leaflet-popup-content {\\r\\n\\tmargin: 13px 24px 13px 20px;\\r\\n\\tline-height: 1.3;\\r\\n\\tfont-size: 13px;\\r\\n\\tfont-size: 1.08333em;\\r\\n\\tmin-height: 1px;\\r\\n\\t}\\r\\n.leaflet-popup-content p {\\r\\n\\tmargin: 17px 0;\\r\\n\\tmargin: 1.3em 0;\\r\\n\\t}\\r\\n.leaflet-popup-tip-container {\\r\\n\\twidth: 40px;\\r\\n\\theight: 20px;\\r\\n\\tposition: absolute;\\r\\n\\tleft: 50%;\\r\\n\\tmargin-top: -1px;\\r\\n\\tmargin-left: -20px;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-popup-tip {\\r\\n\\twidth: 17px;\\r\\n\\theight: 17px;\\r\\n\\tpadding: 1px;\\r\\n\\tmargin: -10px auto 0;\\r\\n\\tpointer-events: auto;\\r\\n\\t-webkit-transform: rotate(45deg);\\r\\n\\t -moz-transform: rotate(45deg);\\r\\n\\t -ms-transform: rotate(45deg);\\r\\n\\t transform: rotate(45deg);\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper,\\r\\n.leaflet-popup-tip {\\r\\n\\tbackground: white;\\r\\n\\tcolor: #333;\\r\\n\\tbox-shadow: 0 3px 14px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button {\\r\\n\\tposition: absolute;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tborder: none;\\r\\n\\ttext-align: center;\\r\\n\\twidth: 24px;\\r\\n\\theight: 24px;\\r\\n\\tfont: 16px/24px Tahoma, Verdana, sans-serif;\\r\\n\\tcolor: #757575;\\r\\n\\ttext-decoration: none;\\r\\n\\tbackground: transparent;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button:hover,\\r\\n.leaflet-container a.leaflet-popup-close-button:focus {\\r\\n\\tcolor: #585858;\\r\\n\\t}\\r\\n.leaflet-popup-scrolled {\\r\\n\\toverflow: auto;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper {\\r\\n\\t-ms-zoom: 1;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\twidth: 24px;\\r\\n\\tmargin: 0 auto;\\r\\n\\t-ms-filter: \"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\";\\r\\n\\tfilter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-control-zoom,\\r\\n.leaflet-oldie .leaflet-control-layers,\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper,\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\tborder: 1px solid #999;\\r\\n\\t}\\r\\n.leaflet-div-icon {\\r\\n\\tbackground: #fff;\\r\\n\\tborder: 1px solid #666;\\r\\n\\t}\\r\\n.leaflet-tooltip {\\r\\n\\tposition: absolute;\\r\\n\\tpadding: 6px;\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder: 1px solid #fff;\\r\\n\\tborder-radius: 3px;\\r\\n\\tcolor: #222;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-webkit-user-select: none;\\r\\n\\t-moz-user-select: none;\\r\\n\\t-ms-user-select: none;\\r\\n\\tuser-select: none;\\r\\n\\tpointer-events: none;\\r\\n\\tbox-shadow: 0 1px 3px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-tooltip.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before,\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tposition: absolute;\\r\\n\\tpointer-events: none;\\r\\n\\tborder: 6px solid transparent;\\r\\n\\tbackground: transparent;\\r\\n\\tcontent: \"\";\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom {\\r\\n\\tmargin-top: 6px;\\r\\n}\\r\\n.leaflet-tooltip-top {\\r\\n\\tmargin-top: -6px;\\r\\n}\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tbottom: 0;\\r\\n\\tmargin-bottom: -12px;\\r\\n\\tborder-top-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom:before {\\r\\n\\ttop: 0;\\r\\n\\tmargin-top: -12px;\\r\\n\\tmargin-left: -6px;\\r\\n\\tborder-bottom-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-left {\\r\\n\\tmargin-left: -6px;\\r\\n}\\r\\n.leaflet-tooltip-right {\\r\\n\\tmargin-left: 6px;\\r\\n}\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\ttop: 50%;\\r\\n\\tmargin-top: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-left:before {\\r\\n\\tright: 0;\\r\\n\\tmargin-right: -12px;\\r\\n\\tborder-left-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tleft: 0;\\r\\n\\tmargin-left: -12px;\\r\\n\\tborder-right-color: #fff;\\r\\n\\t}\\r\\n@media print {\\r\\n\\t.leaflet-control {\\r\\n\\t\\t-webkit-print-color-adjust: exact;\\r\\n\\t\\tprint-color-adjust: exact;\\r\\n\\t\\t}\\r\\n\\t}';\n"],"mappings":";AAGA,IAAa,cACT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GeocodingSource } from './types';
|
|
2
|
+
export interface NominatimSourceOptions {
|
|
3
|
+
/** The Nominatim server. Defaults to OpenStreetMap's, whose policy allows one request a second. */
|
|
4
|
+
endpoint?: string;
|
|
5
|
+
/** An email, which OpenStreetMap's server asks of apps that send many requests. */
|
|
6
|
+
email?: string;
|
|
7
|
+
/** Limits the search to these countries (`['ca']`). */
|
|
8
|
+
countryCodes?: readonly string[];
|
|
9
|
+
/** Most results of a search. Defaults to 5. */
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An address search on Nominatim, OpenStreetMap's geocoder. Fine for an admin panel: its public
|
|
14
|
+
* server allows one request a second and no heavy use. For more, run a server or use a service.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createNominatimSource({ endpoint, email, countryCodes, limit, }?: NominatimSourceOptions): GeocodingSource;
|
|
17
|
+
//# sourceMappingURL=nominatim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nominatim.d.ts","sourceRoot":"","sources":["../../src/location/nominatim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACnC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAiBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,QAAgD,EAChD,KAAK,EACL,YAAY,EACZ,KAAS,GACZ,GAAE,sBAA2B,GAAG,eAAe,CAgD/C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/location/nominatim.ts
|
|
2
|
+
function toResult(place) {
|
|
3
|
+
const lat = Number(place.lat);
|
|
4
|
+
const lng = Number(place.lon);
|
|
5
|
+
if (typeof place.display_name !== "string" || Number.isNaN(lat) || Number.isNaN(lng)) return null;
|
|
6
|
+
return {
|
|
7
|
+
label: place.display_name,
|
|
8
|
+
lat,
|
|
9
|
+
lng
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An address search on Nominatim, OpenStreetMap's geocoder. Fine for an admin panel: its public
|
|
14
|
+
* server allows one request a second and no heavy use. For more, run a server or use a service.
|
|
15
|
+
*/
|
|
16
|
+
function createNominatimSource({ endpoint = "https://nominatim.openstreetmap.org", email, countryCodes, limit = 5 } = {}) {
|
|
17
|
+
const base = endpoint.replace(/\/$/, "");
|
|
18
|
+
const request = async (path, params, { signal, locale }) => {
|
|
19
|
+
const query = new URLSearchParams({
|
|
20
|
+
format: "jsonv2",
|
|
21
|
+
...params
|
|
22
|
+
});
|
|
23
|
+
if (email !== void 0) query.set("email", email);
|
|
24
|
+
if (locale !== void 0) query.set("accept-language", locale);
|
|
25
|
+
const response = await fetch(`${base}${path}?${query}`, { signal });
|
|
26
|
+
if (!response.ok) throw new Error(`Nominatim answered ${response.status}.`);
|
|
27
|
+
return response.json();
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
async search(text, options) {
|
|
31
|
+
const places = await request("/search", {
|
|
32
|
+
q: text,
|
|
33
|
+
limit: String(limit),
|
|
34
|
+
...countryCodes !== void 0 && countryCodes.length > 0 ? { countrycodes: countryCodes.join(",") } : {}
|
|
35
|
+
}, options);
|
|
36
|
+
return Array.isArray(places) ? places.flatMap((place) => toResult(place) ?? []) : [];
|
|
37
|
+
},
|
|
38
|
+
async reverse({ lat, lng }, options) {
|
|
39
|
+
const place = await request("/reverse", {
|
|
40
|
+
lat: String(lat),
|
|
41
|
+
lon: String(lng)
|
|
42
|
+
}, options);
|
|
43
|
+
return place !== null && typeof place === "object" ? toResult(place) : null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { createNominatimSource };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=nominatim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nominatim.js","names":[],"sources":["../../src/location/nominatim.ts"],"sourcesContent":["import type { GeocodingResult, GeocodingSource } from './types';\n\nexport interface NominatimSourceOptions {\n /** The Nominatim server. Defaults to OpenStreetMap's, whose policy allows one request a second. */\n endpoint?: string;\n /** An email, which OpenStreetMap's server asks of apps that send many requests. */\n email?: string;\n /** Limits the search to these countries (`['ca']`). */\n countryCodes?: readonly string[];\n /** Most results of a search. Defaults to 5. */\n limit?: number;\n}\n\ninterface NominatimPlace {\n display_name?: unknown;\n lat?: unknown;\n lon?: unknown;\n}\n\nfunction toResult(place: NominatimPlace): GeocodingResult | null {\n const lat = Number(place.lat);\n const lng = Number(place.lon);\n if (typeof place.display_name !== 'string' || Number.isNaN(lat) || Number.isNaN(lng)) {\n return null;\n }\n return { label: place.display_name, lat, lng };\n}\n\n/**\n * An address search on Nominatim, OpenStreetMap's geocoder. Fine for an admin panel: its public\n * server allows one request a second and no heavy use. For more, run a server or use a service.\n */\nexport function createNominatimSource({\n endpoint = 'https://nominatim.openstreetmap.org',\n email,\n countryCodes,\n limit = 5,\n}: NominatimSourceOptions = {}): GeocodingSource {\n const base = endpoint.replace(/\\/$/, '');\n const request = async (\n path: string,\n params: Record<string, string>,\n { signal, locale }: { signal: AbortSignal; locale?: string },\n ): Promise<unknown> => {\n const query = new URLSearchParams({ format: 'jsonv2', ...params });\n if (email !== undefined) {\n query.set('email', email);\n }\n if (locale !== undefined) {\n query.set('accept-language', locale);\n }\n const response = await fetch(`${base}${path}?${query}`, { signal });\n if (!response.ok) {\n throw new Error(`Nominatim answered ${response.status}.`);\n }\n return response.json();\n };\n return {\n async search(text, options) {\n const places = await request(\n '/search',\n {\n q: text,\n limit: String(limit),\n ...(countryCodes !== undefined && countryCodes.length > 0\n ? { countrycodes: countryCodes.join(',') }\n : {}),\n },\n options,\n );\n return Array.isArray(places)\n ? places.flatMap((place: NominatimPlace) => toResult(place) ?? [])\n : [];\n },\n async reverse({ lat, lng }, options) {\n const place = await request(\n '/reverse',\n { lat: String(lat), lon: String(lng) },\n options,\n );\n return place !== null && typeof place === 'object'\n ? toResult(place as NominatimPlace)\n : null;\n },\n };\n}\n"],"mappings":";AAmBA,SAAS,SAAS,OAA+C;CAC7D,MAAM,MAAM,OAAO,MAAM,GAAG;CAC5B,MAAM,MAAM,OAAO,MAAM,GAAG;CAC5B,IAAI,OAAO,MAAM,iBAAiB,YAAY,OAAO,MAAM,GAAG,KAAK,OAAO,MAAM,GAAG,GAC/E,OAAO;CAEX,OAAO;EAAE,OAAO,MAAM;EAAc;EAAK;CAAI;AACjD;;;;;AAMA,SAAgB,sBAAsB,EAClC,WAAW,uCACX,OACA,cACA,QAAQ,MACgB,CAAC,GAAoB;CAC7C,MAAM,OAAO,SAAS,QAAQ,OAAO,EAAE;CACvC,MAAM,UAAU,OACZ,MACA,QACA,EAAE,QAAQ,aACS;EACnB,MAAM,QAAQ,IAAI,gBAAgB;GAAE,QAAQ;GAAU,GAAG;EAAO,CAAC;EACjE,IAAI,UAAU,KAAA,GACV,MAAM,IAAI,SAAS,KAAK;EAE5B,IAAI,WAAW,KAAA,GACX,MAAM,IAAI,mBAAmB,MAAM;EAEvC,MAAM,WAAW,MAAM,MAAM,GAAG,OAAO,KAAI,GAAI,SAAS,EAAE,OAAO,CAAC;EAClE,IAAI,CAAC,SAAS,IACV,MAAM,IAAI,MAAM,sBAAsB,SAAS,OAAM,EAAG;EAE5D,OAAO,SAAS,KAAK;CACzB;CACA,OAAO;EACH,MAAM,OAAO,MAAM,SAAS;GACxB,MAAM,SAAS,MAAM,QACjB,WACA;IACI,GAAG;IACH,OAAO,OAAO,KAAK;IACnB,GAAI,iBAAiB,KAAA,KAAa,aAAa,SAAS,IAClD,EAAE,cAAc,aAAa,KAAK,GAAG,EAAE,IACvC,CAAC;GACX,GACA,OACJ;GACA,OAAO,MAAM,QAAQ,MAAM,IACrB,OAAO,SAAS,UAA0B,SAAS,KAAK,KAAK,CAAA,CAAE,IAC/D,CAAA;EACV;EACA,MAAM,QAAQ,EAAE,KAAK,OAAO,SAAS;GACjC,MAAM,QAAQ,MAAM,QAChB,YACA;IAAE,KAAK,OAAO,GAAG;IAAG,KAAK,OAAO,GAAG;GAAE,GACrC,OACJ;GACA,OAAO,UAAU,QAAQ,OAAO,UAAU,WACpC,SAAS,KAAuB,IAChC;EACV;CACJ;AACJ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** A place an address search found: what it shows, and its point. */
|
|
2
|
+
export interface GeocodingResult {
|
|
3
|
+
label: string;
|
|
4
|
+
lat: number;
|
|
5
|
+
lng: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Where `location` fields search addresses (decision 0033). Projects bring their own: a service
|
|
9
|
+
* with a key, their backend, or `createNominatimSource()` for small volumes.
|
|
10
|
+
*/
|
|
11
|
+
export interface GeocodingSource {
|
|
12
|
+
/** The places that match an address or a name, best first. */
|
|
13
|
+
search(query: string, options: {
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
locale?: string;
|
|
16
|
+
}): Promise<GeocodingResult[]>;
|
|
17
|
+
/** The address of a point, to fill it in when the point is placed on the map. Optional. */
|
|
18
|
+
reverse?(point: {
|
|
19
|
+
lat: number;
|
|
20
|
+
lng: number;
|
|
21
|
+
}, options: {
|
|
22
|
+
signal: AbortSignal;
|
|
23
|
+
locale?: string;
|
|
24
|
+
}): Promise<GeocodingResult | null>;
|
|
25
|
+
}
|
|
26
|
+
/** Raster tiles of the maps of `location` fields. */
|
|
27
|
+
export interface MapTiles {
|
|
28
|
+
/** URL template of the tiles: `https://tile.openstreetmap.org/{z}/{x}/{y}.png`. */
|
|
29
|
+
url: string;
|
|
30
|
+
/** The credit the tiles ask for, as HTML. */
|
|
31
|
+
attribution: string;
|
|
32
|
+
/** Highest zoom of the tiles. Defaults to 19. */
|
|
33
|
+
maxZoom?: number;
|
|
34
|
+
}
|
|
35
|
+
/** The tiles and the address search of the maps of `location` fields. */
|
|
36
|
+
export interface MapsConfig {
|
|
37
|
+
tiles?: MapTiles;
|
|
38
|
+
geocoding?: GeocodingSource;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/location/types.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,8DAA8D;IAC9D,MAAM,CACF,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAClD,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAC9B,2FAA2F;IAC3F,OAAO,CAAC,CACJ,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EACnC,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAClD,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CACtC;AAED,qDAAqD;AACrD,MAAM,WAAW,QAAQ;IACrB,mFAAmF;IACnF,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACvB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FieldEntryProps, FieldProps } from '../shared/types';
|
|
3
|
+
export interface RangeFieldProps extends FieldProps<number> {
|
|
4
|
+
/** The start of the slider. Defaults to 0. */
|
|
5
|
+
min?: number;
|
|
6
|
+
/** The end of the slider. Defaults to 100. */
|
|
7
|
+
max?: number;
|
|
8
|
+
/** Step of the slider and of the arrow keys. Defaults to 1. */
|
|
9
|
+
step?: number;
|
|
10
|
+
/** Format of the number shown, for the locale. */
|
|
11
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
12
|
+
/** Content after the number: a unit. */
|
|
13
|
+
suffix?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** A number on a slider. It is `null` until the slider is moved. */
|
|
16
|
+
export declare function RangeField({ value, onChange, onBlur, min, max, disabled, readOnly, required, autoFocus: _autoFocus, id: _id, ...props }: RangeFieldProps): import("react").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* The `range` type: its ends from the `min` and `max` rules (0 and 100 without them), and
|
|
19
|
+
* settings `step`, `decimals` and `suffix`, as for `number`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function RangeFieldEntry(props: FieldEntryProps): import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=RangeField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeField.d.ts","sourceRoot":"","sources":["../../src/range/RangeField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,WAAW,eAAgB,SAAQ,UAAU,CAAC,MAAM,CAAC;IACvD,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,aAAa,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IACzC,wCAAwC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAO,EACP,GAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EAAE,UAAU,EACrB,EAAE,EAAE,GAAG,EACP,GAAG,KAAK,EACX,EAAE,eAAe,+BAajB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,+BAsBrD"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { getFieldProps, getRuleNumber, getSetting, isNumber, isString } from "../shared/entry.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Slider } from "@panneau/ui";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/range/RangeField.tsx
|
|
6
|
+
/** A number on a slider. It is `null` until the slider is moved. */
|
|
7
|
+
function RangeField({ value, onChange, onBlur, min = 0, max = 100, disabled, readOnly, required, autoFocus: _autoFocus, id: _id, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Slider, {
|
|
9
|
+
...props,
|
|
10
|
+
value: value ?? null,
|
|
11
|
+
onChange: (next) => onChange?.(next),
|
|
12
|
+
onChangeEnd: () => onBlur?.(),
|
|
13
|
+
minValue: min,
|
|
14
|
+
maxValue: max,
|
|
15
|
+
isDisabled: disabled === true || readOnly === true,
|
|
16
|
+
isRequired: required
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The `range` type: its ends from the `min` and `max` rules (0 and 100 without them), and
|
|
21
|
+
* settings `step`, `decimals` and `suffix`, as for `number`.
|
|
22
|
+
*/
|
|
23
|
+
function RangeFieldEntry(props) {
|
|
24
|
+
const $ = c(33);
|
|
25
|
+
const { field } = props;
|
|
26
|
+
let t0;
|
|
27
|
+
if ($[0] !== field) {
|
|
28
|
+
t0 = getRuleNumber(field, "min");
|
|
29
|
+
$[0] = field;
|
|
30
|
+
$[1] = t0;
|
|
31
|
+
} else t0 = $[1];
|
|
32
|
+
const min = t0;
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[2] !== field) {
|
|
35
|
+
t1 = getRuleNumber(field, "max");
|
|
36
|
+
$[2] = field;
|
|
37
|
+
$[3] = t1;
|
|
38
|
+
} else t1 = $[3];
|
|
39
|
+
const max = t1;
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[4] !== field) {
|
|
42
|
+
t2 = getSetting(field, "step", isNumber);
|
|
43
|
+
$[4] = field;
|
|
44
|
+
$[5] = t2;
|
|
45
|
+
} else t2 = $[5];
|
|
46
|
+
const step = t2;
|
|
47
|
+
let t3;
|
|
48
|
+
if ($[6] !== field) {
|
|
49
|
+
t3 = getSetting(field, "decimals", isNumber);
|
|
50
|
+
$[6] = field;
|
|
51
|
+
$[7] = t3;
|
|
52
|
+
} else t3 = $[7];
|
|
53
|
+
const decimals = t3;
|
|
54
|
+
let t4;
|
|
55
|
+
if ($[8] !== field) {
|
|
56
|
+
t4 = getSetting(field, "suffix", isString);
|
|
57
|
+
$[8] = field;
|
|
58
|
+
$[9] = t4;
|
|
59
|
+
} else t4 = $[9];
|
|
60
|
+
const suffix = t4;
|
|
61
|
+
let t5;
|
|
62
|
+
if ($[10] !== props) {
|
|
63
|
+
t5 = getFieldProps(props);
|
|
64
|
+
$[10] = props;
|
|
65
|
+
$[11] = t5;
|
|
66
|
+
} else t5 = $[11];
|
|
67
|
+
let fieldProps;
|
|
68
|
+
if ($[12] !== t5) {
|
|
69
|
+
const { placeholder: _placeholder, ...t6 } = t5;
|
|
70
|
+
fieldProps = t6;
|
|
71
|
+
$[12] = t5;
|
|
72
|
+
$[13] = fieldProps;
|
|
73
|
+
} else fieldProps = $[13];
|
|
74
|
+
const t6 = isNumber(props.value) ? props.value : null;
|
|
75
|
+
let t7;
|
|
76
|
+
if ($[14] !== min) {
|
|
77
|
+
t7 = min !== void 0 ? { min } : {};
|
|
78
|
+
$[14] = min;
|
|
79
|
+
$[15] = t7;
|
|
80
|
+
} else t7 = $[15];
|
|
81
|
+
let t8;
|
|
82
|
+
if ($[16] !== max) {
|
|
83
|
+
t8 = max !== void 0 ? { max } : {};
|
|
84
|
+
$[16] = max;
|
|
85
|
+
$[17] = t8;
|
|
86
|
+
} else t8 = $[17];
|
|
87
|
+
let t9;
|
|
88
|
+
if ($[18] !== step) {
|
|
89
|
+
t9 = step !== void 0 ? { step } : {};
|
|
90
|
+
$[18] = step;
|
|
91
|
+
$[19] = t9;
|
|
92
|
+
} else t9 = $[19];
|
|
93
|
+
let t10;
|
|
94
|
+
if ($[20] !== decimals) {
|
|
95
|
+
t10 = decimals !== void 0 ? { formatOptions: { maximumFractionDigits: decimals } } : {};
|
|
96
|
+
$[20] = decimals;
|
|
97
|
+
$[21] = t10;
|
|
98
|
+
} else t10 = $[21];
|
|
99
|
+
let t11;
|
|
100
|
+
if ($[22] !== suffix) {
|
|
101
|
+
t11 = suffix !== void 0 ? { suffix } : {};
|
|
102
|
+
$[22] = suffix;
|
|
103
|
+
$[23] = t11;
|
|
104
|
+
} else t11 = $[23];
|
|
105
|
+
let t12;
|
|
106
|
+
if ($[24] !== fieldProps || $[25] !== props.onChange || $[26] !== t10 || $[27] !== t11 || $[28] !== t6 || $[29] !== t7 || $[30] !== t8 || $[31] !== t9) {
|
|
107
|
+
t12 = /* @__PURE__ */ jsx(RangeField, {
|
|
108
|
+
...fieldProps,
|
|
109
|
+
value: t6,
|
|
110
|
+
onChange: props.onChange,
|
|
111
|
+
...t7,
|
|
112
|
+
...t8,
|
|
113
|
+
...t9,
|
|
114
|
+
...t10,
|
|
115
|
+
...t11
|
|
116
|
+
});
|
|
117
|
+
$[24] = fieldProps;
|
|
118
|
+
$[25] = props.onChange;
|
|
119
|
+
$[26] = t10;
|
|
120
|
+
$[27] = t11;
|
|
121
|
+
$[28] = t6;
|
|
122
|
+
$[29] = t7;
|
|
123
|
+
$[30] = t8;
|
|
124
|
+
$[31] = t9;
|
|
125
|
+
$[32] = t12;
|
|
126
|
+
} else t12 = $[32];
|
|
127
|
+
return t12;
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { RangeField, RangeFieldEntry };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=RangeField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeField.js","names":["_c"],"sources":["../../src/range/RangeField.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Slider } from '@panneau/ui';\n\nimport { getFieldProps, getRuleNumber, getSetting, isNumber, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface RangeFieldProps extends FieldProps<number> {\n /** The start of the slider. Defaults to 0. */\n min?: number;\n /** The end of the slider. Defaults to 100. */\n max?: number;\n /** Step of the slider and of the arrow keys. Defaults to 1. */\n step?: number;\n /** Format of the number shown, for the locale. */\n formatOptions?: Intl.NumberFormatOptions;\n /** Content after the number: a unit. */\n suffix?: ReactNode;\n}\n\n/** A number on a slider. It is `null` until the slider is moved. */\nexport function RangeField({\n value,\n onChange,\n onBlur,\n min = 0,\n max = 100,\n disabled,\n readOnly,\n required,\n autoFocus: _autoFocus,\n id: _id,\n ...props\n}: RangeFieldProps) {\n return (\n <Slider\n {...props}\n value={value ?? null}\n onChange={(next) => onChange?.(next)}\n onChangeEnd={() => onBlur?.()}\n minValue={min}\n maxValue={max}\n isDisabled={disabled === true || readOnly === true}\n isRequired={required}\n />\n );\n}\n\n/**\n * The `range` type: its ends from the `min` and `max` rules (0 and 100 without them), and\n * settings `step`, `decimals` and `suffix`, as for `number`.\n */\nexport function RangeFieldEntry(props: FieldEntryProps) {\n const { field } = props;\n const min = getRuleNumber(field, 'min');\n const max = getRuleNumber(field, 'max');\n const step = getSetting(field, 'step', isNumber);\n const decimals = getSetting(field, 'decimals', isNumber);\n const suffix = getSetting(field, 'suffix', isString);\n const { placeholder: _placeholder, ...fieldProps } = getFieldProps(props);\n return (\n <RangeField\n {...fieldProps}\n value={isNumber(props.value) ? props.value : null}\n onChange={props.onChange}\n {...(min !== undefined ? { min } : {})}\n {...(max !== undefined ? { max } : {})}\n {...(step !== undefined ? { step } : {})}\n {...(decimals !== undefined\n ? { formatOptions: { maximumFractionDigits: decimals } }\n : {})}\n {...(suffix !== undefined ? { suffix } : {})}\n />\n );\n}\n"],"mappings":";;;;;;AAqBA,SAAgB,WAAW,EACvB,OACA,UACA,QACA,MAAM,GACN,MAAM,KACN,UACA,UACA,UACA,WAAW,YACX,IAAI,KACJ,GAAG,SACa;CAChB,OACI,oBAAC,QAAD;EACI,GAAI;EACJ,OAAO,SAAS;EAChB,WAAW,SAAS,WAAW,IAAI;EACnC,mBAAmB,SAAS;EAC5B,UAAU;EACV,UAAU;EACV,YAAY,aAAa,QAAQ,aAAa;EAC9C,YAAY;CAAS,CAAA;AAGjC;;;;;AAMA,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;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,MAAA,EAAA;CAAA,OAXF;AAWE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/range/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RangeField, RangeFieldEntry } from "./RangeField.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationField.d.ts","sourceRoot":"","sources":["../../src/relation/RelationField.tsx"],"names":[],"mappings":"AASA,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMnE,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,cAAc,GAAG,IAAI,EAC7B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,EAAE,OAAc,EAAE,KAAW,EAAE,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5E;IAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAmCpD;AAED,yDAAyD;AACzD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACzF,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM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KAAK,EAAE,eAAe,+BAUxD"}
|
|
@@ -273,28 +273,28 @@ function RelationFieldEntry(props) {
|
|
|
273
273
|
$[1] = t0;
|
|
274
274
|
} else t0 = $[1];
|
|
275
275
|
const references = t0;
|
|
276
|
+
const resource = typeof field.resource === "string" ? field.resource : "";
|
|
276
277
|
let t1;
|
|
277
278
|
if ($[2] !== props) {
|
|
278
279
|
t1 = getFieldProps(props);
|
|
279
280
|
$[2] = props;
|
|
280
281
|
$[3] = t1;
|
|
281
282
|
} else t1 = $[3];
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
t3 = {
|
|
283
|
+
let t2;
|
|
284
|
+
if ($[4] !== resource || $[5] !== t1) {
|
|
285
|
+
t2 = {
|
|
286
286
|
...t1,
|
|
287
|
-
resource
|
|
287
|
+
resource
|
|
288
288
|
};
|
|
289
|
-
$[4] =
|
|
290
|
-
$[5] =
|
|
291
|
-
$[6] =
|
|
292
|
-
} else
|
|
293
|
-
const shared =
|
|
289
|
+
$[4] = resource;
|
|
290
|
+
$[5] = t1;
|
|
291
|
+
$[6] = t2;
|
|
292
|
+
} else t2 = $[6];
|
|
293
|
+
const shared = t2;
|
|
294
294
|
if (field.multiple === true) {
|
|
295
|
-
let
|
|
295
|
+
let t3;
|
|
296
296
|
if ($[7] !== props.onChange || $[8] !== references || $[9] !== shared) {
|
|
297
|
-
|
|
297
|
+
t3 = /* @__PURE__ */ jsx(RelationField, {
|
|
298
298
|
...shared,
|
|
299
299
|
multiple: true,
|
|
300
300
|
value: references,
|
|
@@ -303,24 +303,24 @@ function RelationFieldEntry(props) {
|
|
|
303
303
|
$[7] = props.onChange;
|
|
304
304
|
$[8] = references;
|
|
305
305
|
$[9] = shared;
|
|
306
|
-
$[10] =
|
|
307
|
-
} else
|
|
308
|
-
return
|
|
306
|
+
$[10] = t3;
|
|
307
|
+
} else t3 = $[10];
|
|
308
|
+
return t3;
|
|
309
309
|
}
|
|
310
|
-
const
|
|
311
|
-
let
|
|
312
|
-
if ($[11] !== props.onChange || $[12] !== shared || $[13] !==
|
|
313
|
-
|
|
310
|
+
const t3 = references[0] ?? null;
|
|
311
|
+
let t4;
|
|
312
|
+
if ($[11] !== props.onChange || $[12] !== shared || $[13] !== t3) {
|
|
313
|
+
t4 = /* @__PURE__ */ jsx(RelationField, {
|
|
314
314
|
...shared,
|
|
315
|
-
value:
|
|
315
|
+
value: t3,
|
|
316
316
|
onChange: props.onChange
|
|
317
317
|
});
|
|
318
318
|
$[11] = props.onChange;
|
|
319
319
|
$[12] = shared;
|
|
320
|
-
$[13] =
|
|
321
|
-
$[14] =
|
|
322
|
-
} else
|
|
323
|
-
return
|
|
320
|
+
$[13] = t3;
|
|
321
|
+
$[14] = t4;
|
|
322
|
+
} else t4 = $[14];
|
|
323
|
+
return t4;
|
|
324
324
|
}
|
|
325
325
|
//#endregion
|
|
326
326
|
export { RelationField, RelationFieldEntry, useRelationSearch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationField.js","names":["X","text","reference","item","entry","onChange","itemId","references","_c","styles","_Fragment"],"sources":["../../src/relation/RelationField.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport { ComboBox, Fieldset, IconButton, usePanneauIntl } from '@panneau/ui';\n\nimport { useFieldsContext } from '../shared/context';\nimport { cx } from '../shared/cx';\nimport { getFieldProps } from '../shared/entry';\nimport { messages } from '../shared/messages';\nimport {\n type RelationReference,\n type RelationSource,\n toReferences,\n useRelationReferences,\n} from '../shared/relation';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\nimport styles from './RelationField.module.css';\n\n/** The id of the \"Create “…”\" option of the picker. */\nconst CREATE_ID = '\\u0000create';\n\n/** Results of a search in a relation source, as it types. */\nexport function useRelationSearch(\n source: RelationSource | null,\n resource: string,\n query: string,\n { enabled = true, delay = 250 }: { enabled?: boolean; delay?: number } = {},\n): { items: RelationReference[]; isLoading: boolean } {\n const [state, setState] = useState<{\n key: string;\n items: RelationReference[];\n isLoading: boolean;\n }>({ key: '', items: [], isLoading: false });\n const key = `${resource}\\u0000${query}`;\n\n useEffect(() => {\n if (source === null || !enabled) {\n return undefined;\n }\n const controller = new AbortController();\n const timer = setTimeout(() => {\n setState((current) => ({ ...current, key, isLoading: true }));\n source\n .search(resource, query, { signal: controller.signal })\n .then((items) => {\n if (!controller.signal.aborted) {\n setState({ key, items, isLoading: false });\n }\n })\n .catch(() => {\n if (!controller.signal.aborted) {\n setState({ key, items: [], isLoading: false });\n }\n });\n }, delay);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [source, resource, query, key, enabled, delay]);\n\n return { items: state.items, isLoading: state.isLoading || state.key !== key };\n}\n\n/** Props of both single and multiple relation fields. */\nexport interface RelationFieldBaseProps extends Omit<FieldProps<never>, 'value' | 'onChange'> {\n /** Id of the related resource, passed to the source. */\n resource: string;\n /** Where to search. Defaults to the fields context's. Without one, the field is read-only. */\n source?: RelationSource | null;\n /**\n * Creates an item from the typed text, offered as \"Create “…”\" in the picker: it can open a\n * dialog, and resolves with the new reference, or `null` when nothing was created. Defaults to\n * the source's `create()`. `null` turns creating off.\n */\n onCreate?: ((text: string) => Promise<RelationReference | null>) | null;\n placeholder?: string;\n controlClassName?: string;\n}\n\nexport interface SingleRelationFieldProps extends RelationFieldBaseProps {\n multiple?: false;\n value?: RelationReference | null;\n onChange?: (value: RelationReference | null) => void;\n}\n\nexport interface MultipleRelationFieldProps extends RelationFieldBaseProps {\n multiple: true;\n value?: readonly RelationReference[] | null;\n /** Called with the references. An empty list is `null`. */\n onChange?: (value: RelationReference[] | null) => void;\n}\n\nexport type RelationFieldProps = SingleRelationFieldProps | MultipleRelationFieldProps;\n\nfunction References({\n references,\n onRemove,\n removeLabel,\n}: {\n references: readonly RelationReference[];\n onRemove?: (reference: RelationReference) => void;\n removeLabel: (reference: RelationReference) => string;\n}) {\n return (\n <ul className={cx(styles.selected, onRemove === undefined && styles.readOnly)}>\n {references.map((reference) => (\n <li key={reference.id} className={styles.reference}>\n <span className={styles.referenceLabel}>{reference.label}</span>\n {onRemove !== undefined ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={removeLabel(reference)}\n showTooltip={false}\n onPress={() => onRemove(reference)}\n />\n ) : null}\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * A reference to an item of another resource, or several with `multiple`, picked by searching a\n * `RelationSource`. Values are references (`{ id, label }`), as items carry them; plain ids get\n * their labels from the source's `resolve()`. When the source can `create()` (or with `onCreate`),\n * the picker offers to create an item from the typed text. Without a source, the field shows its\n * references and can't change them.\n */\nexport function RelationField(props: RelationFieldProps) {\n const intl = usePanneauIntl();\n const context = useFieldsContext();\n const source = props.source === undefined ? context.relationSource : props.source;\n const {\n resource,\n label,\n description,\n errors,\n disabled,\n readOnly,\n required,\n placeholder = intl.formatMessage(messages.search),\n onBlur,\n name,\n id,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n } = props;\n const selected = useRelationReferences(source, resource, toReferences(props.value));\n const [query, setQuery] = useState<string | null>(null);\n const [creating, setCreating] = useState(false);\n const [createError, setCreateError] = useState<string | null>(null);\n const editable = source !== null && disabled !== true && readOnly !== true;\n const { items: found, isLoading: searching } = useRelationSearch(\n source,\n resource,\n query ?? '',\n { enabled: editable },\n );\n const sourceCreate = source?.create;\n const create =\n props.onCreate !== undefined\n ? props.onCreate\n : sourceCreate !== undefined && source?.canCreate?.(resource) !== false\n ? (text: string) => sourceCreate.call(source, resource, text)\n : null;\n const text = (query ?? '').trim();\n const offersCreate =\n create !== null &&\n text !== '' &&\n !searching &&\n ![...found, ...selected].some(\n (item) =>\n item.label.toLocaleLowerCase(intl.locale) === text.toLocaleLowerCase(intl.locale),\n );\n const items = offersCreate\n ? [\n ...found,\n { id: CREATE_ID, label: intl.formatMessage(messages.createRelation, { text }) },\n ]\n : found;\n const isLoading = searching || creating;\n const allErrors = createError !== null ? [...(errors ?? []), createError] : errors;\n /** Creates an item from the text, then adds its reference with `add`. */\n const createFrom = (add: (reference: RelationReference) => void) => {\n if (create === null) {\n return;\n }\n setCreating(true);\n setCreateError(null);\n create(text)\n .then((reference) => {\n if (reference !== null) {\n add(reference);\n setQuery(null);\n }\n })\n .catch(() =>\n setCreateError(intl.formatMessage(messages.createRelationFailed, { text })),\n )\n .finally(() => setCreating(false));\n };\n const removeLabel = (reference: RelationReference) =>\n `${intl.formatMessage(messages.remove)} ${reference.label}`;\n const chrome = {\n legend: label,\n errors: allErrors,\n isRequired: required,\n className,\n legendClassName: labelClassName,\n descriptionClassName,\n errorsClassName,\n };\n\n if (!editable) {\n return (\n <Fieldset\n {...chrome}\n description={\n source === null && disabled !== true && readOnly !== true ? (\n <>\n {description} {intl.formatMessage(messages.relationUnavailable)}\n </>\n ) : (\n description\n )\n }\n >\n {selected.length > 0 ? (\n <References references={selected} removeLabel={removeLabel} />\n ) : (\n <span className={styles.none}>{intl.formatMessage(messages.noRelation)}</span>\n )}\n </Fieldset>\n );\n }\n\n const comboLabel = typeof label === 'string' ? label : props['aria-label'];\n\n if (props.multiple === true) {\n const { onChange } = props;\n const set = (next: RelationReference[]) => onChange?.(next.length > 0 ? next : null);\n return (\n <Fieldset {...chrome} description={description}>\n <div className={styles.multiple}>\n {selected.length > 0 ? (\n <References\n references={selected}\n removeLabel={removeLabel}\n onRemove={(reference) =>\n set(selected.filter((entry) => entry.id !== reference.id))\n }\n />\n ) : null}\n <ComboBox\n aria-label={comboLabel}\n items={items\n .filter((item) => !selected.some((entry) => entry.id === item.id))\n .map((item) => ({ id: item.id, label: item.label }))}\n value={null}\n inputValue={query ?? ''}\n onInputChange={setQuery}\n onChange={(itemId) => {\n if (itemId === CREATE_ID) {\n createFrom((reference) => set([...selected, reference]));\n return;\n }\n const reference = found.find((item) => item.id === itemId);\n if (reference !== undefined) {\n set([...selected, reference]);\n setQuery(null);\n }\n }}\n isLoading={isLoading}\n placeholder={placeholder}\n emptyMessage={intl.formatMessage(messages.noResults)}\n {...(onBlur !== undefined ? { onBlur: () => onBlur() } : {})}\n {...(name !== undefined ? { name } : {})}\n {...(id !== undefined ? { id } : {})}\n {...(controlClassName !== undefined ? { controlClassName } : {})}\n />\n </div>\n </Fieldset>\n );\n }\n\n const { onChange } = props;\n const current = selected[0] ?? null;\n // The selected reference is among the items, so that the combo box knows its label.\n const shown =\n current !== null && !items.some((item) => item.id === current.id)\n ? [current, ...items]\n : items;\n return (\n <ComboBox\n label={label}\n description={description}\n errors={allErrors}\n isRequired={required}\n className={className}\n labelClassName={labelClassName}\n descriptionClassName={descriptionClassName}\n errorsClassName={errorsClassName}\n {...(controlClassName !== undefined ? { controlClassName } : {})}\n {...(props['aria-label'] !== undefined ? { 'aria-label': props['aria-label'] } : {})}\n items={shown.map((item) => ({ id: item.id, label: item.label }))}\n value={current?.id ?? null}\n inputValue={query ?? current?.label ?? ''}\n onInputChange={(text) => {\n setQuery(text);\n if (text === '' && current !== null) {\n onChange?.(null);\n }\n }}\n onChange={(itemId) => {\n if (itemId === CREATE_ID) {\n createFrom((reference) => onChange?.(reference));\n return;\n }\n setQuery(null);\n if (itemId === null) {\n return;\n }\n const reference = shown.find((item) => item.id === itemId) ?? null;\n if (reference?.id !== current?.id) {\n onChange?.(reference);\n }\n }}\n isLoading={isLoading}\n placeholder={placeholder}\n emptyMessage={intl.formatMessage(messages.noResults)}\n {...(onBlur !== undefined\n ? {\n onBlur: () => {\n setQuery(null);\n onBlur();\n },\n }\n : { onBlur: () => setQuery(null) })}\n {...(name !== undefined ? { name } : {})}\n {...(id !== undefined ? { id } : {})}\n />\n );\n}\n\n/** The `relation` type: `resource` and `multiple`. Items search the fields context's source. */\nexport function RelationFieldEntry(props: FieldEntryProps) {\n const { field } = props;\n const references = toReferences(props.value);\n const shared = { ...getFieldProps(props), resource: field.resource ?? '' };\n if (field.multiple === true) {\n return <RelationField {...shared} multiple value={references} onChange={props.onChange} />;\n }\n return <RelationField {...shared} value={references[0] ?? null} onChange={props.onChange} />;\n}\n"],"mappings":";;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sB,UAAA,MAAK;GAAS,CAAA;GAAI,EAAA,KAAA,MAAA;GAAA,EAAA,KAAA;GAAA,EAAA,KAAA;GAAA,EAAA,MAAA;EAAA,OAAA,KAAA,EAAA;EAAA,OAAnF;CAAmF;CAErD,MAAA,KAAA,WAAU,MAAV;CAAqB,IAAA;CAAA,IAAA,EAAA,QAAA,MAAA,YAAA,EAAA,QAAA,UAAA,EAAA,QAAA,IAAA;EAAvD,KAAA,oBAAC,eAAD;GAAc,GAAK;GAAe,OAAA;GAAiC,UAAA,MAAK;EAAS,CAAA;EAAI,EAAA,MAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAArF;AAAqF"}
|
|
1
|
+
{"version":3,"file":"RelationField.js","names":["X","text","reference","item","entry","onChange","itemId","references","_c","styles","_Fragment"],"sources":["../../src/relation/RelationField.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport { ComboBox, Fieldset, IconButton, usePanneauIntl } from '@panneau/ui';\n\nimport { useFieldsContext } from '../shared/context';\nimport { cx } from '../shared/cx';\nimport { getFieldProps } from '../shared/entry';\nimport { messages } from '../shared/messages';\nimport {\n type RelationReference,\n type RelationSource,\n toReferences,\n useRelationReferences,\n} from '../shared/relation';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\nimport styles from './RelationField.module.css';\n\n/** The id of the \"Create “…”\" option of the picker. */\nconst CREATE_ID = '\\u0000create';\n\n/** Results of a search in a relation source, as it types. */\nexport function useRelationSearch(\n source: RelationSource | null,\n resource: string,\n query: string,\n { enabled = true, delay = 250 }: { enabled?: boolean; delay?: number } = {},\n): { items: RelationReference[]; isLoading: boolean } {\n const [state, setState] = useState<{\n key: string;\n items: RelationReference[];\n isLoading: boolean;\n }>({ key: '', items: [], isLoading: false });\n const key = `${resource}\\u0000${query}`;\n\n useEffect(() => {\n if (source === null || !enabled) {\n return undefined;\n }\n const controller = new AbortController();\n const timer = setTimeout(() => {\n setState((current) => ({ ...current, key, isLoading: true }));\n source\n .search(resource, query, { signal: controller.signal })\n .then((items) => {\n if (!controller.signal.aborted) {\n setState({ key, items, isLoading: false });\n }\n })\n .catch(() => {\n if (!controller.signal.aborted) {\n setState({ key, items: [], isLoading: false });\n }\n });\n }, delay);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [source, resource, query, key, enabled, delay]);\n\n return { items: state.items, isLoading: state.isLoading || state.key !== key };\n}\n\n/** Props of both single and multiple relation fields. */\nexport interface RelationFieldBaseProps extends Omit<FieldProps<never>, 'value' | 'onChange'> {\n /** Id of the related resource, passed to the source. */\n resource: string;\n /** Where to search. Defaults to the fields context's. Without one, the field is read-only. */\n source?: RelationSource | null;\n /**\n * Creates an item from the typed text, offered as \"Create “…”\" in the picker: it can open a\n * dialog, and resolves with the new reference, or `null` when nothing was created. Defaults to\n * the source's `create()`. `null` turns creating off.\n */\n onCreate?: ((text: string) => Promise<RelationReference | null>) | null;\n placeholder?: string;\n controlClassName?: string;\n}\n\nexport interface SingleRelationFieldProps extends RelationFieldBaseProps {\n multiple?: false;\n value?: RelationReference | null;\n onChange?: (value: RelationReference | null) => void;\n}\n\nexport interface MultipleRelationFieldProps extends RelationFieldBaseProps {\n multiple: true;\n value?: readonly RelationReference[] | null;\n /** Called with the references. An empty list is `null`. */\n onChange?: (value: RelationReference[] | null) => void;\n}\n\nexport type RelationFieldProps = SingleRelationFieldProps | MultipleRelationFieldProps;\n\nfunction References({\n references,\n onRemove,\n removeLabel,\n}: {\n references: readonly RelationReference[];\n onRemove?: (reference: RelationReference) => void;\n removeLabel: (reference: RelationReference) => string;\n}) {\n return (\n <ul className={cx(styles.selected, onRemove === undefined && styles.readOnly)}>\n {references.map((reference) => (\n <li key={reference.id} className={styles.reference}>\n <span className={styles.referenceLabel}>{reference.label}</span>\n {onRemove !== undefined ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={removeLabel(reference)}\n showTooltip={false}\n onPress={() => onRemove(reference)}\n />\n ) : null}\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * A reference to an item of another resource, or several with `multiple`, picked by searching a\n * `RelationSource`. Values are references (`{ id, label }`), as items carry them; plain ids get\n * their labels from the source's `resolve()`. When the source can `create()` (or with `onCreate`),\n * the picker offers to create an item from the typed text. Without a source, the field shows its\n * references and can't change them.\n */\nexport function RelationField(props: RelationFieldProps) {\n const intl = usePanneauIntl();\n const context = useFieldsContext();\n const source = props.source === undefined ? context.relationSource : props.source;\n const {\n resource,\n label,\n description,\n errors,\n disabled,\n readOnly,\n required,\n placeholder = intl.formatMessage(messages.search),\n onBlur,\n name,\n id,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n } = props;\n const selected = useRelationReferences(source, resource, toReferences(props.value));\n const [query, setQuery] = useState<string | null>(null);\n const [creating, setCreating] = useState(false);\n const [createError, setCreateError] = useState<string | null>(null);\n const editable = source !== null && disabled !== true && readOnly !== true;\n const { items: found, isLoading: searching } = useRelationSearch(\n source,\n resource,\n query ?? '',\n { enabled: editable },\n );\n const sourceCreate = source?.create;\n const create =\n props.onCreate !== undefined\n ? props.onCreate\n : sourceCreate !== undefined && source?.canCreate?.(resource) !== false\n ? (text: string) => sourceCreate.call(source, resource, text)\n : null;\n const text = (query ?? '').trim();\n const offersCreate =\n create !== null &&\n text !== '' &&\n !searching &&\n ![...found, ...selected].some(\n (item) =>\n item.label.toLocaleLowerCase(intl.locale) === text.toLocaleLowerCase(intl.locale),\n );\n const items = offersCreate\n ? [\n ...found,\n { id: CREATE_ID, label: intl.formatMessage(messages.createRelation, { text }) },\n ]\n : found;\n const isLoading = searching || creating;\n const allErrors = createError !== null ? [...(errors ?? []), createError] : errors;\n /** Creates an item from the text, then adds its reference with `add`. */\n const createFrom = (add: (reference: RelationReference) => void) => {\n if (create === null) {\n return;\n }\n setCreating(true);\n setCreateError(null);\n create(text)\n .then((reference) => {\n if (reference !== null) {\n add(reference);\n setQuery(null);\n }\n })\n .catch(() =>\n setCreateError(intl.formatMessage(messages.createRelationFailed, { text })),\n )\n .finally(() => setCreating(false));\n };\n const removeLabel = (reference: RelationReference) =>\n `${intl.formatMessage(messages.remove)} ${reference.label}`;\n const chrome = {\n legend: label,\n errors: allErrors,\n isRequired: required,\n className,\n legendClassName: labelClassName,\n descriptionClassName,\n errorsClassName,\n };\n\n if (!editable) {\n return (\n <Fieldset\n {...chrome}\n description={\n source === null && disabled !== true && readOnly !== true ? (\n <>\n {description} {intl.formatMessage(messages.relationUnavailable)}\n </>\n ) : (\n description\n )\n }\n >\n {selected.length > 0 ? (\n <References references={selected} removeLabel={removeLabel} />\n ) : (\n <span className={styles.none}>{intl.formatMessage(messages.noRelation)}</span>\n )}\n </Fieldset>\n );\n }\n\n const comboLabel = typeof label === 'string' ? label : props['aria-label'];\n\n if (props.multiple === true) {\n const { onChange } = props;\n const set = (next: RelationReference[]) => onChange?.(next.length > 0 ? next : null);\n return (\n <Fieldset {...chrome} description={description}>\n <div className={styles.multiple}>\n {selected.length > 0 ? (\n <References\n references={selected}\n removeLabel={removeLabel}\n onRemove={(reference) =>\n set(selected.filter((entry) => entry.id !== reference.id))\n }\n />\n ) : null}\n <ComboBox\n aria-label={comboLabel}\n items={items\n .filter((item) => !selected.some((entry) => entry.id === item.id))\n .map((item) => ({ id: item.id, label: item.label }))}\n value={null}\n inputValue={query ?? ''}\n onInputChange={setQuery}\n onChange={(itemId) => {\n if (itemId === CREATE_ID) {\n createFrom((reference) => set([...selected, reference]));\n return;\n }\n const reference = found.find((item) => item.id === itemId);\n if (reference !== undefined) {\n set([...selected, reference]);\n setQuery(null);\n }\n }}\n isLoading={isLoading}\n placeholder={placeholder}\n emptyMessage={intl.formatMessage(messages.noResults)}\n {...(onBlur !== undefined ? { onBlur: () => onBlur() } : {})}\n {...(name !== undefined ? { name } : {})}\n {...(id !== undefined ? { id } : {})}\n {...(controlClassName !== undefined ? { controlClassName } : {})}\n />\n </div>\n </Fieldset>\n );\n }\n\n const { onChange } = props;\n const current = selected[0] ?? null;\n // The selected reference is among the items, so that the combo box knows its label.\n const shown =\n current !== null && !items.some((item) => item.id === current.id)\n ? [current, ...items]\n : items;\n return (\n <ComboBox\n label={label}\n description={description}\n errors={allErrors}\n isRequired={required}\n className={className}\n labelClassName={labelClassName}\n descriptionClassName={descriptionClassName}\n errorsClassName={errorsClassName}\n {...(controlClassName !== undefined ? { controlClassName } : {})}\n {...(props['aria-label'] !== undefined ? { 'aria-label': props['aria-label'] } : {})}\n items={shown.map((item) => ({ id: item.id, label: item.label }))}\n value={current?.id ?? null}\n inputValue={query ?? current?.label ?? ''}\n onInputChange={(text) => {\n setQuery(text);\n if (text === '' && current !== null) {\n onChange?.(null);\n }\n }}\n onChange={(itemId) => {\n if (itemId === CREATE_ID) {\n createFrom((reference) => onChange?.(reference));\n return;\n }\n setQuery(null);\n if (itemId === null) {\n return;\n }\n const reference = shown.find((item) => item.id === itemId) ?? null;\n if (reference?.id !== current?.id) {\n onChange?.(reference);\n }\n }}\n isLoading={isLoading}\n placeholder={placeholder}\n emptyMessage={intl.formatMessage(messages.noResults)}\n {...(onBlur !== undefined\n ? {\n onBlur: () => {\n setQuery(null);\n onBlur();\n },\n }\n : { onBlur: () => setQuery(null) })}\n {...(name !== undefined ? { name } : {})}\n {...(id !== undefined ? { id } : {})}\n />\n );\n}\n\n/** The `relation` type: `resource` and `multiple`. Items search the fields context's source. */\nexport function RelationFieldEntry(props: FieldEntryProps) {\n const { field } = props;\n const references = toReferences(props.value);\n // A relation names one resource: `lintDefinition()` reports a list (only `media` fields take one).\n const resource = typeof field.resource === 'string' ? field.resource : '';\n const shared = { ...getFieldProps(props), resource };\n if (field.multiple === true) {\n return <RelationField {...shared} multiple value={references} onChange={props.onChange} />;\n }\n return <RelationField {...shared} value={references[0] ?? null} onChange={props.onChange} />;\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,IAAM,YAAY;;AAGlB,SAAgB,kBACZ,QACA,UAC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,MAAA;GAAA,EAAA,KAAA;GAAA,EAAA,KAAA;GAAA,EAAA,MAAA;EAAA,OAAA,KAAA,EAAA;EAAA,OAAnF;CAAmF;CAErD,MAAA,KAAA,WAAU,MAAV;CAAqB,IAAA;CAAA,IAAA,EAAA,QAAA,MAAA,YAAA,EAAA,QAAA,UAAA,EAAA,QAAA,IAAA;EAAvD,KAAA,oBAAC,eAAD;GAAc,GAAK;GAAe,OAAA;GAAiC,UAAA,MAAK;EAAS,CAAA;EAAI,EAAA,MAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAArF;AAAqF"}
|
|
@@ -12,6 +12,8 @@ export interface NestedFieldProps {
|
|
|
12
12
|
errors?: readonly string[];
|
|
13
13
|
/** The object the field belongs to, for conditions and generated values. */
|
|
14
14
|
parentValue?: unknown;
|
|
15
|
+
/** The locale of the value, in a localized field. */
|
|
16
|
+
locale?: string;
|
|
15
17
|
disabled?: boolean;
|
|
16
18
|
readOnly?: boolean;
|
|
17
19
|
className?: string;
|
|
@@ -22,7 +24,7 @@ export interface NestedFieldProps {
|
|
|
22
24
|
* one, it uses `value` and `onChange`, and hides itself when its `visibleWhen` condition on the
|
|
23
25
|
* parent value is false.
|
|
24
26
|
*/
|
|
25
|
-
export declare function NestedField({ field, path, value, onChange, onBlur, errors, parentValue, disabled, readOnly, className, }: NestedFieldProps): import("react").JSX.Element | null;
|
|
27
|
+
export declare function NestedField({ field, path, value, onChange, onBlur, errors, parentValue, locale, disabled, readOnly, className, }: NestedFieldProps): import("react").JSX.Element | null;
|
|
26
28
|
/**
|
|
27
29
|
* Renders a field of the definition with the entry of its type: from the fields context, or a
|
|
28
30
|
* built-in one. A localized field renders an input per locale. A type without an entry renders a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefinitionField.d.ts","sourceRoot":"","sources":["../../src/shared/DefinitionField.tsx"],"names":[],"mappings":"AAAA,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