@macrostrat/column-components
Version:
React rendering primitives for stratigraphic columns
1 lines • 2.49 kB
Source Map (JSON)
{"version":3,"file":"util.cjs","sources":["../../src/editor/util.ts"],"sourcesContent":["import h from \"./main.module.scss\";\nimport { format } from \"d3-format\";\nimport Select from \"react-select\";\nimport { ColumnDivision } from \"../context\";\n\nconst LabeledControl = function (props) {\n const { title, children, ...rest } = props;\n delete rest.is;\n return h(\"div.labeled-control\", [\n h(\"label.bp3-label\", null, [\n h.if(title != null)(\"span.label-text\", null, title),\n ]),\n props.is != null ? h(props.is, rest) : null,\n ]);\n};\n\nconst menuStyles = (provided) => ({\n ...provided,\n zIndex: 999,\n});\n\nconst RaisedSelect = (props) =>\n h(Select, { styles: { menu: menuStyles }, ...props });\n\ninterface IntervalEditorTitleProps {\n showID: boolean;\n title: string;\n interval: ColumnDivision;\n heightFormat: string;\n}\n\nconst IntervalEditorTitle = function (props: IntervalEditorTitleProps) {\n let { showID, title, interval, heightFormat } = props;\n const { id, top, bottom } = interval;\n let fmt = (v) => v;\n if (heightFormat != null) {\n fmt = format(heightFormat);\n }\n if (showID == null) {\n showID = true;\n }\n return h(\"div.editor-dialog-title.editor-title\", [\n h(\"h3.title-center\", title),\n h(\"h4.height-range\", `${fmt(bottom)} – ${fmt(top)} m`),\n h(\"h4.id\", null, [\"ID: \", h.if(id != null && showID)(\"code\", id)]),\n ]);\n};\n\nexport { LabeledControl, IntervalEditorTitle, RaisedSelect };\n"],"names":["h","Select","format"],"mappings":";;;;;;;AAKA,MAAM,iBAAiB,SAAU,OAAO;AACtC,QAAM,EAAE,OAAO,UAAU,GAAG,SAAS;AACrC,SAAO,KAAK;AACZ,SAAOA,YAAAA,QAAE,uBAAuB;AAAA,IAC9BA,YAAAA,QAAE,mBAAmB,MAAM;AAAA,MACzBA,YAAAA,QAAE,GAAG,SAAS,IAAI,EAAE,mBAAmB,MAAM,KAAK;AAAA,IAAA,CACnD;AAAA,IACD,MAAM,MAAM,OAAOA,YAAAA,QAAE,MAAM,IAAI,IAAI,IAAI;AAAA,EAAA,CACxC;AACH;AAEA,MAAM,aAAa,CAAC,cAAc;AAAA,EAChC,GAAG;AAAA,EACH,QAAQ;AACV;AAEA,MAAM,eAAe,CAAC,UACpBA,YAAAA,QAAEC,yBAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,GAAG,OAAO;AAStD,MAAM,sBAAsB,SAAU,OAAiC;AACrE,MAAI,EAAE,QAAQ,OAAO,UAAU,iBAAiB;AAChD,QAAM,EAAE,IAAI,KAAK,OAAA,IAAW;AAC5B,MAAI,MAAM,CAAC,MAAM;AACjB,MAAI,gBAAgB,MAAM;AACxB,UAAMC,SAAAA,OAAO,YAAY;AAAA,EAC3B;AACA,MAAI,UAAU,MAAM;AAClB,aAAS;AAAA,EACX;AACA,SAAOF,YAAAA,QAAE,wCAAwC;AAAA,IAC/CA,YAAAA,QAAE,mBAAmB,KAAK;AAAA,IAC1BA,YAAAA,QAAE,mBAAmB,GAAG,IAAI,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI;AAAA,IACrDA,YAAAA,QAAE,SAAS,MAAM,CAAC,QAAQA,YAAAA,QAAE,GAAG,MAAM,QAAQ,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAAA,EAAA,CAClE;AACH;;;;"}