@corva/ui 3.53.0-9 → 3.54.0-0
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/assets/24e85195c257f1a487266abb9fc7a2bf.png +0 -0
- package/assets/573240ce4ae3f03b1dcda59a6122d385.png +0 -0
- package/assets/611a0b004a47e773eef650c39e484dde.png +0 -0
- package/assets/637021239e939e67a50264c22fdad2cf.png +0 -0
- package/assets/9fd5109325b72bf1dea0d2984b0478b8.png +0 -0
- package/assets/c901dbd37bce6a412f2c0f0ceecfea1d.png +0 -0
- package/cjs-bundle/components/AppIcon/assets/CompletionAppIcon.js +1 -1
- package/cjs-bundle/components/AppIcon/assets/CompletionAppIconBe.js +1 -1
- package/cjs-bundle/components/AppIcon/assets/DrillingAppIcon.js +1 -1
- package/cjs-bundle/components/AppIcon/assets/DrillingAppIconBe.js +1 -1
- package/cjs-bundle/components/AppIcon/assets/InterventionAppIcon.js +2 -0
- package/cjs-bundle/components/AppIcon/assets/InterventionAppIcon.js.map +1 -0
- package/cjs-bundle/components/AppIcon/assets/NoSegmentAppIcon.js +1 -1
- package/cjs-bundle/components/AppIcon/assets/NoSegmentAppIconBeIdle.js +1 -1
- package/cjs-bundle/components/AppIcon/utils.js +1 -1
- package/cjs-bundle/components/AppIcon/utils.js.map +1 -1
- package/cjs-bundle/components/Drillstring/DrillstringDetail/DrillstringDetail.js +1 -1
- package/cjs-bundle/components/Drillstring/DrillstringDetail/DrillstringDetail.js.map +1 -1
- package/cjs-bundle/components/FeedItem/feedItemTypes/BhaFeedItem/components/BhaSchematic.js +1 -1
- package/cjs-bundle/components/FeedItem/feedItemTypes/BhaFeedItem/components/BhaSchematic.js.map +1 -1
- package/cjs-bundle/components/FeedItem/feedItemTypes/BhaFeedItem/components/Info.js +1 -1
- package/cjs-bundle/components/FeedItem/feedItemTypes/BhaFeedItem/components/Info.js.map +1 -1
- package/cjs-bundle/components/FeedItem/feedItemTypes/FluidReportFeedItem.js +1 -1
- package/cjs-bundle/components/FeedItem/feedItemTypes/FluidReportFeedItem.js.map +1 -1
- package/cjs-bundle/components/FileUploadIconButton.js +1 -1
- package/cjs-bundle/components/FileUploadIconButton.js.map +1 -1
- package/cjs-bundle/components/UserMention/index.js +1 -1
- package/cjs-bundle/components/UserMention/index.js.map +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.scss.js +1 -1
- package/components/AppIcon/assets/CompletionAppIcon.d.ts.map +1 -1
- package/components/AppIcon/assets/CompletionAppIcon.js +1 -1
- package/components/AppIcon/assets/CompletionAppIconBe.d.ts.map +1 -1
- package/components/AppIcon/assets/CompletionAppIconBe.js +1 -1
- package/components/AppIcon/assets/DrillingAppIcon.d.ts.map +1 -1
- package/components/AppIcon/assets/DrillingAppIcon.js +1 -1
- package/components/AppIcon/assets/DrillingAppIconBe.d.ts.map +1 -1
- package/components/AppIcon/assets/DrillingAppIconBe.js +1 -1
- package/components/AppIcon/assets/InterventionAppIcon.d.ts +4 -0
- package/components/AppIcon/assets/InterventionAppIcon.d.ts.map +1 -0
- package/components/AppIcon/assets/InterventionAppIcon.js +2 -0
- package/components/AppIcon/assets/InterventionAppIcon.js.map +1 -0
- package/components/AppIcon/assets/NoSegmentAppIcon.d.ts.map +1 -1
- package/components/AppIcon/assets/NoSegmentAppIcon.js +1 -1
- package/components/AppIcon/assets/NoSegmentAppIconBeIdle.d.ts.map +1 -1
- package/components/AppIcon/assets/NoSegmentAppIconBeIdle.js +1 -1
- package/components/AppIcon/utils.d.ts.map +1 -1
- package/components/AppIcon/utils.js +1 -1
- package/components/AppIcon/utils.js.map +1 -1
- package/components/Drillstring/DrillstringDetail/DrillstringDetail.d.ts +8 -4
- package/components/Drillstring/DrillstringDetail/DrillstringDetail.d.ts.map +1 -1
- package/components/Drillstring/DrillstringDetail/DrillstringDetail.js +1 -1
- package/components/Drillstring/DrillstringDetail/DrillstringDetail.js.map +1 -1
- package/components/FeedItem/feedItemTypes/BhaFeedItem/components/BhaSchematic.d.ts +1 -1
- package/components/FeedItem/feedItemTypes/BhaFeedItem/components/BhaSchematic.js +1 -1
- package/components/FeedItem/feedItemTypes/BhaFeedItem/components/BhaSchematic.js.map +1 -1
- package/components/FeedItem/feedItemTypes/BhaFeedItem/components/Info.js +1 -1
- package/components/FeedItem/feedItemTypes/BhaFeedItem/components/Info.js.map +1 -1
- package/components/FeedItem/feedItemTypes/FluidReportFeedItem.js +1 -1
- package/components/FeedItem/feedItemTypes/FluidReportFeedItem.js.map +1 -1
- package/components/FileUploadIconButton.d.ts +3 -1
- package/components/FileUploadIconButton.d.ts.map +1 -1
- package/components/FileUploadIconButton.js +1 -1
- package/components/FileUploadIconButton.js.map +1 -1
- package/components/UserMention/index.js +1 -1
- package/components/UserMention/index.js.map +1 -1
- package/componentsV2/Autocomplete/Autocomplete.scss.js +1 -1
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/assets/3f1e09e6e814329ccfc22c5f2fb49320.png +0 -0
- package/assets/747c045c9381addbc4c6aecd531ccbff.png +0 -0
- package/assets/9f235cc0306a992ec6aecee01ad6956b.png +0 -0
- package/assets/cc3725c7d2b2258f38e3e25e49ce0a53.png +0 -0
- package/assets/dad8511026615181e47069625c14a00d.png +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useMemo as e}from"react";import{shape as i,number as t,string as r,arrayOf as n}from"prop-types";import a from"classnames";import{makeStyles as o,Grid as c,Typography as s}from"@material-ui/core";import d from"@material-ui/core/colors/blue";import{getUnitDisplay as l,convertValue as m}from"../../../utils/convert.js";import{ctop as u}from"../../../utils/FluidCheckUtils.js";import{jsxs as p,jsx as f}from"react/jsx-runtime";var y="fluidReportActivity",h=o((function(e){return{density:{color:d[300]},unit:{color:e.palette.grey[400],marginLeft:5},oneLineText:{display:"flex",alignItems:"center"},title:{color:e.palette.grey[400]},columnWithMargin:{marginRight:40}}})),v=function(i){var t=i.feedItem.context.fluid_report.data,r=t.depth,n=t.mud_type,o=t.mud_density,d=t.viscosity,v=d.pv,R=void 0===v?"":v,g=d.yp,q=void 0===g?"":g,N=d.rpm_readings,_=h(),x=u(r,"length","ft"),b=x?x.formatNumeral("0,0"):"-",F=l("length"),L=m(+o,"density","ppg").formatNumeral("0,0.00"),T=l("density"),j=l("yp"),P=Number.isFinite(R)?R.fixFloat(3):R,I=Number.isFinite(q)?q.fixFloat(3):q,M=e((function(){var e=N.length-1;return N.reduce((function(i,t,r){var n=r===e?"":", ",a="".concat(t.rpm,"/").concat(t.dial_reading);return"".concat(i).concat(a).concat(n)}),"")}),[N]);return p(c,{container:!0,
|
|
1
|
+
import{useMemo as e}from"react";import{shape as i,number as t,string as r,arrayOf as n}from"prop-types";import a from"classnames";import{makeStyles as o,Grid as c,Typography as s}from"@material-ui/core";import d from"@material-ui/core/colors/blue";import{getUnitDisplay as l,convertValue as m}from"../../../utils/convert.js";import{ctop as u}from"../../../utils/FluidCheckUtils.js";import{jsxs as p,jsx as f}from"react/jsx-runtime";var y="fluidReportActivity",h=o((function(e){return{density:{color:d[300]},unit:{color:e.palette.grey[400],marginLeft:5},oneLineText:{display:"flex",alignItems:"center"},title:{color:e.palette.grey[400]},columnWithMargin:{marginRight:40}}})),v=function(i){var t=i.feedItem.context.fluid_report.data,r=t.depth,n=t.mud_type,o=t.mud_density,d=t.viscosity,v=d.pv,R=void 0===v?"":v,g=d.yp,q=void 0===g?"":g,N=d.rpm_readings,_=h(),x=u(r,"length","ft"),b=x?x.formatNumeral("0,0"):"-",F=l("length"),L=m(+o,"density","ppg").formatNumeral("0,0.00"),T=l("density"),j=l("yp"),P=Number.isFinite(R)?R.fixFloat(3):R,I=Number.isFinite(q)?q.fixFloat(3):q,M=e((function(){var e=N.length-1;return N.reduce((function(i,t,r){var n=r===e?"":", ",a="".concat(t.rpm,"/").concat(t.dial_reading);return"".concat(i).concat(a).concat(n)}),"")}),[N]);return p(c,{container:!0,justify:"flex-start",children:[p(c,{item:!0,className:_.columnWithMargin,children:[f(s,{variant:"body2",children:"Density"}),p(s,{variant:"h6","data-testid":"".concat(y,"_density"),className:a(_.density,_.oneLineText),children:[L,p(s,{component:"span",variant:"caption",className:_.unit,children:["(",T,")"]})]}),p(s,{className:_.oneLineText,children:[b,p(s,{component:"span",variant:"caption",className:_.unit,children:["(",F,")"]})," / ",n]})]}),p(c,{item:!0,children:[p(s,{variant:"body2","data-testid":"".concat(y,"_viscosity"),className:_.oneLineText,children:[f(s,{variant:"span",className:_.title,children:"PV: "}),"".concat(P," ").concat("cP"," / YP: ").concat(I),f(s,{component:"span",variant:"caption",className:_.unit,children:j})]}),f(s,{variant:"body2",className:_.title,children:"Rheometer Readings (RPM/Dial Reading):"}),f(s,{variant:"body2","data-testid":"".concat(y,"_rheometerReadings"),children:M})]})]})};v.propTypes={feedItem:i({context:i({fluid_report:i({data:i({depth:t.isRequired,mud_type:r.isRequired,mud_density:t.isRequired,viscosity:i({pv:t.isRequired,yp:t.isRequired,rpm_readings:n(i({id:r.isRequired,dial_reading:t.isRequired,rpm:t.isRequired})).isRequired}).isRequired}).isRequired}).isRequired}).isRequired}).isRequired};export{v as default};
|
|
2
2
|
//# sourceMappingURL=FluidReportFeedItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FluidReportFeedItem.js","sources":["../../../../src/components/FeedItem/feedItemTypes/FluidReportFeedItem.js"],"sourcesContent":["import { useMemo } from 'react';\nimport { shape, number, string, arrayOf } from 'prop-types';\nimport classNames from 'classnames';\nimport { Typography, Grid, makeStyles } from '@material-ui/core';\nimport blue from '@material-ui/core/colors/blue';\n\nimport { convertValue, getUnitDisplay } from '~/utils/convert';\nimport { ctop } from '~/utils/FluidCheckUtils';\n\nconst PAGE_NAME = 'fluidReportActivity';\n\nconst useStyles = makeStyles(theme => ({\n density: {\n color: blue[300],\n },\n unit: {\n color: theme.palette.grey[400],\n marginLeft: 5,\n },\n oneLineText: {\n display: 'flex',\n alignItems: 'center',\n },\n title: {\n color: theme.palette.grey[400],\n },\n columnWithMargin: {\n marginRight: 40,\n },\n}));\n\nconst FluidReportFeedItem = ({\n feedItem: {\n context: {\n fluid_report: {\n data: {\n depth: depthNotConverted,\n mud_type: mudType,\n mud_density: mudDensity,\n viscosity: { pv = '', yp = '', rpm_readings: rpmReadings },\n },\n },\n },\n },\n}) => {\n const classes = useStyles();\n\n const depth = ctop(depthNotConverted, 'length', 'ft');\n const depthString = depth ? depth.formatNumeral('0,0') : '-';\n const depthUnit = getUnitDisplay('length');\n\n const convertedMudDensity = convertValue(+mudDensity, 'density', 'ppg');\n const mudDensityFormatted = convertedMudDensity.formatNumeral('0,0.00');\n const densityUnit = getUnitDisplay('density');\n\n const pvUnit = 'cP';\n const ypUnit = getUnitDisplay('yp');\n const pvFormatted = Number.isFinite(pv) ? pv.fixFloat(3) : pv;\n const ypFormatted = Number.isFinite(yp) ? yp.fixFloat(3) : yp;\n\n const rheometerReadingsString = useMemo(() => {\n const rpmReadingsLastItemIndex = rpmReadings.length - 1;\n\n return rpmReadings.reduce((resultString, reading, index) => {\n const commaString = index === rpmReadingsLastItemIndex ? '' : ', ';\n const readingString = `${reading.rpm}/${reading.dial_reading}`;\n return `${resultString}${readingString}${commaString}`;\n }, '');\n }, [rpmReadings]);\n\n return (\n <Grid container
|
|
1
|
+
{"version":3,"file":"FluidReportFeedItem.js","sources":["../../../../src/components/FeedItem/feedItemTypes/FluidReportFeedItem.js"],"sourcesContent":["import { useMemo } from 'react';\nimport { shape, number, string, arrayOf } from 'prop-types';\nimport classNames from 'classnames';\nimport { Typography, Grid, makeStyles } from '@material-ui/core';\nimport blue from '@material-ui/core/colors/blue';\n\nimport { convertValue, getUnitDisplay } from '~/utils/convert';\nimport { ctop } from '~/utils/FluidCheckUtils';\n\nconst PAGE_NAME = 'fluidReportActivity';\n\nconst useStyles = makeStyles(theme => ({\n density: {\n color: blue[300],\n },\n unit: {\n color: theme.palette.grey[400],\n marginLeft: 5,\n },\n oneLineText: {\n display: 'flex',\n alignItems: 'center',\n },\n title: {\n color: theme.palette.grey[400],\n },\n columnWithMargin: {\n marginRight: 40,\n },\n}));\n\nconst FluidReportFeedItem = ({\n feedItem: {\n context: {\n fluid_report: {\n data: {\n depth: depthNotConverted,\n mud_type: mudType,\n mud_density: mudDensity,\n viscosity: { pv = '', yp = '', rpm_readings: rpmReadings },\n },\n },\n },\n },\n}) => {\n const classes = useStyles();\n\n const depth = ctop(depthNotConverted, 'length', 'ft');\n const depthString = depth ? depth.formatNumeral('0,0') : '-';\n const depthUnit = getUnitDisplay('length');\n\n const convertedMudDensity = convertValue(+mudDensity, 'density', 'ppg');\n const mudDensityFormatted = convertedMudDensity.formatNumeral('0,0.00');\n const densityUnit = getUnitDisplay('density');\n\n const pvUnit = 'cP';\n const ypUnit = getUnitDisplay('yp');\n const pvFormatted = Number.isFinite(pv) ? pv.fixFloat(3) : pv;\n const ypFormatted = Number.isFinite(yp) ? yp.fixFloat(3) : yp;\n\n const rheometerReadingsString = useMemo(() => {\n const rpmReadingsLastItemIndex = rpmReadings.length - 1;\n\n return rpmReadings.reduce((resultString, reading, index) => {\n const commaString = index === rpmReadingsLastItemIndex ? '' : ', ';\n const readingString = `${reading.rpm}/${reading.dial_reading}`;\n return `${resultString}${readingString}${commaString}`;\n }, '');\n }, [rpmReadings]);\n\n return (\n <Grid container justify=\"flex-start\">\n <Grid item className={classes.columnWithMargin}>\n <Typography variant=\"body2\">Density</Typography>\n <Typography\n variant=\"h6\"\n data-testid={`${PAGE_NAME}_density`}\n className={classNames(classes.density, classes.oneLineText)}\n >\n {mudDensityFormatted}\n <Typography component=\"span\" variant=\"caption\" className={classes.unit}>\n ({densityUnit})\n </Typography>\n </Typography>\n <Typography className={classes.oneLineText}>\n {depthString}\n <Typography component=\"span\" variant=\"caption\" className={classes.unit}>\n ({depthUnit})\n </Typography>\n / {mudType}\n </Typography>\n </Grid>\n <Grid item>\n <Typography\n variant=\"body2\"\n data-testid={`${PAGE_NAME}_viscosity`}\n className={classes.oneLineText}\n >\n <Typography variant=\"span\" className={classes.title}>\n PV: \n </Typography>\n {`${pvFormatted} ${pvUnit} / YP: ${ypFormatted}`}\n <Typography component=\"span\" variant=\"caption\" className={classes.unit}>\n {ypUnit}\n </Typography>\n </Typography>\n <Typography variant=\"body2\" className={classes.title}>\n Rheometer Readings (RPM/Dial Reading):\n </Typography>\n <Typography variant=\"body2\" data-testid={`${PAGE_NAME}_rheometerReadings`}>\n {rheometerReadingsString}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\nFluidReportFeedItem.propTypes = {\n feedItem: shape({\n context: shape({\n fluid_report: shape({\n data: shape({\n depth: number.isRequired,\n mud_type: string.isRequired,\n mud_density: number.isRequired,\n viscosity: shape({\n pv: number.isRequired,\n yp: number.isRequired,\n rpm_readings: arrayOf(\n shape({\n id: string.isRequired,\n dial_reading: number.isRequired,\n rpm: number.isRequired,\n })\n ).isRequired,\n }).isRequired,\n }).isRequired,\n }).isRequired,\n }).isRequired,\n }).isRequired,\n};\n\nexport default FluidReportFeedItem;\n"],"names":["PAGE_NAME","useStyles","makeStyles","theme","density","color","blue","unit","palette","grey","marginLeft","oneLineText","display","alignItems","title","columnWithMargin","marginRight","FluidReportFeedItem","_ref","_ref$feedItem$context","feedItem","context","fluid_report","data","depthNotConverted","depth","mudType","mud_type","mudDensity","mud_density","_ref$feedItem$context2","viscosity","_ref$feedItem$context3","pv","_ref$feedItem$context4","yp","rpmReadings","rpm_readings","classes","ctop","depthString","formatNumeral","depthUnit","getUnitDisplay","mudDensityFormatted","convertValue","densityUnit","ypUnit","pvFormatted","Number","isFinite","fixFloat","ypFormatted","rheometerReadingsString","useMemo","rpmReadingsLastItemIndex","length","reduce","resultString","reading","index","commaString","readingString","rpm","dial_reading","concat","_jsxs","Grid","container","justify","children","item","className","_jsx","Typography","variant","classNames","component","pvUnit","propTypes","shape","number","isRequired","string","arrayOf","id"],"mappings":"gbASA,IAAMA,EAAY,sBAEZC,EAAYC,GAAW,SAAAC,GAAK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/C,GAAI8C,EAAOC,WACX7C,aAAc+C,EACZJ,EAAM,CACJK,GAAIF,EAAOD,WACXlB,aAAciB,EAAOC,WACrBnB,IAAKkB,EAAOC,cAEdA,aACDA,aACFA,aACFA,aACFA,aACFA"}
|
|
@@ -25,7 +25,7 @@ declare class FileUploadIconButton extends PureComponent<any, any, any> {
|
|
|
25
25
|
declare namespace FileUploadIconButton {
|
|
26
26
|
namespace propTypes {
|
|
27
27
|
let additionalFields: PropTypes.Requireable<PropTypes.ReactNodeLike[]>;
|
|
28
|
-
let classes: PropTypes.
|
|
28
|
+
let classes: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
29
29
|
let tooltipProps: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
30
30
|
let disableRipple: PropTypes.Requireable<boolean>;
|
|
31
31
|
let disabled: PropTypes.Requireable<boolean>;
|
|
@@ -41,6 +41,8 @@ declare namespace FileUploadIconButton {
|
|
|
41
41
|
namespace defaultProps {
|
|
42
42
|
let additionalFields_1: never[];
|
|
43
43
|
export { additionalFields_1 as additionalFields };
|
|
44
|
+
let classes_1: {};
|
|
45
|
+
export { classes_1 as classes };
|
|
44
46
|
let disableRipple_1: boolean;
|
|
45
47
|
export { disableRipple_1 as disableRipple };
|
|
46
48
|
let disabled_1: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploadIconButton.d.ts","sourceRoot":"","sources":["../../src/components/FileUploadIconButton.js"],"names":[],"mappings":"AAeA,2CAA4C,yBAAyB,CAAC;;AAEtE;IACE,wBAgBC;IAbC;;;;;;;MAUC;IAED,0CAA4B;IAG9B,8BAcE;IAEF,UAAU,uBAAkB,UAG1B;IAEF,eAAsB,SAAI,EAAE,aAAQ,mBA4BlC;IAEF,aAAc,SAAI,EAAE,SAAI,UAEtB;IAEF,aAAa,UAAK,UAqBhB;IAEF,oBAKC;IAED,+CAEE;IAEF,cAAe,YAAO,EAAE,aAAQ,EAAE,aAAQ,UAMxC;IAEF,kCA2BC;IAED,sBAwBC;CACF
|
|
1
|
+
{"version":3,"file":"FileUploadIconButton.d.ts","sourceRoot":"","sources":["../../src/components/FileUploadIconButton.js"],"names":[],"mappings":"AAeA,2CAA4C,yBAAyB,CAAC;;AAEtE;IACE,wBAgBC;IAbC;;;;;;;MAUC;IAED,0CAA4B;IAG9B,8BAcE;IAEF,UAAU,uBAAkB,UAG1B;IAEF,eAAsB,SAAI,EAAE,aAAQ,mBA4BlC;IAEF,aAAc,SAAI,EAAE,SAAI,UAEtB;IAEF,aAAa,UAAK,UAqBhB;IAEF,oBAKC;IAED,+CAEE;IAEF,cAAe,YAAO,EAAE,aAAQ,EAAE,aAAQ,UAMxC;IAEF,kCA2BC;IAED,sBAwBC;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA3LwC,OAAO;sBAC1B,YAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import
|
|
1
|
+
import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import n from"@babel/runtime/helpers/possibleConstructorReturn";import l from"@babel/runtime/helpers/getPrototypeOf";import a from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/regenerator";import{createRef as p,PureComponent as u}from"react";import d from"prop-types";import c from"react-s3-uploader/s3upload";import f from"@material-ui/core/CircularProgress";import h from"@material-ui/icons/PhotoCamera";import m from"./PostPreviewDialog/index.js";import b from"./Icons/AttachIcon.js";import g from"./IconButton/index.js";import{getS3DownloadLink as F,getS3SignedUrl as v}from"../clients/jsonApi/index.js";import{isNativeDetected as U}from"../utils/mobileDetect.js";import{jsxs as P,jsx as y,Fragment as S}from"react/jsx-runtime";function O(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function w(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?O(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):O(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function j(e){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,o=l(e);if(r){var i=l(this).constructor;t=Reflect.construct(o,arguments,i)}else t=o.apply(this,arguments);return n(this,t)}}var D="data-file-upload-button",I=function(n){i(d,u);var l=j(d);function d(t){var i,n;return r(this,d),i=l.call(this,t),a(o(i),"onFinish",e(s.mark((function e(){var r;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F(i.state.s3FileName);case 2:r=e.sent,i.setState({currentUpload:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:i.props.openPreviewDialogOnUpload,s3FileUrl:r.url},(function(){i.props.onFinish&&i.props.onFinish(i.state.s3FileUrl,i.state.s3FileName,i.state.s3FileSize)}));case 4:case"end":return e.stop()}}),e)})))),a(o(i),"onError",(function(e){i.props.onError&&i.props.onError(e),console.error(e)})),a(o(i),"getSignedUrl",(n=e(s.mark((function e(r,t){var o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,v(r.name,r.type);case 3:o=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),i.setState({uploadingFileToS3:null,currentUpload:null},(function(){i.onError(e.t0.message)})),e.abrupt("return");case 10:i.setState({s3FileUrl:o.signed_url,s3FileName:o.file_name,s3FileSize:r.size}),t(w(w({},o),{},{signedUrl:o.signed_url}));case 12:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,r){return n.apply(this,arguments)})),a(o(i),"preprocess",(function(e,r){r(e)})),a(o(i),"uploadFile",(function(e){if(e.target.files[0]){i.clearUpload();var r=new c({fileElement:i.fileInput.current,getSignedUrl:i.getSignedUrl,preprocess:i.preprocess,onProgress:function(){},onFinishS3Put:i.onFinish,onError:i.onError});i.setState({uploadingFileToS3:!0,currentUpload:{uploader:r}})}})),a(o(i),"handleCloseFileUploadPreviewDialog",(function(){i.setState({openFileUploadPreviewDialog:!1})})),a(o(i),"handleShare",(function(e,r,t){i.setState({openFileUploadPreviewDialog:!1},(function(){i.props.handleShare&&i.props.handleShare(e,r,t)}))})),i.state={currentUpload:null,s3FileUrl:null,s3FileName:null,s3FileSize:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:!1},i.fileInput=p(),i}return t(d,[{key:"clearUpload",value:function(){var e=this.state.currentUpload;e&&e.uploader&&e.uploader.abortUpload()}},{key:"renderUploadButton",value:function(){var e=U?h:b,r=a({},"data-file-upload-button","");return P("label",w(w({htmlFor:this.props.inputId},r),{},{children:[y("input",{ref:this.fileInput,id:this.props.inputId,type:"file",disabled:this.props.disabled,onChange:this.uploadFile,style:{display:"none"}}),y(g,{"data-testid":"".concat("fileUpload","_attachFileButton"),"aria-label":"File Upload",disabled:this.props.disabled,component:this.props.disabled?"button":"span",className:this.props.fileUploadIconClassName,disableRipple:this.props.disableRipple,tooltipProps:this.props.tooltipProps,children:y(e,{})})]}))}},{key:"render",value:function(){return P(S,{children:[this.state.uploadingFileToS3?y(f,{"data-testid":"generic_uploadProgress",size:18}):this.renderUploadButton(),this.state.openFileUploadPreviewDialog&&y(m,{open:this.state.openFileUploadPreviewDialog,fileUrl:this.state.s3FileUrl,fileName:this.state.s3FileName,fileSize:this.state.s3FileSize,handleShare:this.handleShare,handleClose:this.handleCloseFileUploadPreviewDialog,additionalFields:this.props.additionalFields,requiredFields:this.props.requiredFields,message:this.props.message})]})}}]),d}();I.propTypes={additionalFields:d.arrayOf(d.node),classes:d.shape({}),tooltipProps:d.shape({}),disableRipple:d.bool,disabled:d.bool,fileUploadIconClassName:d.string,handleShare:d.func,inputId:d.string,message:d.string,onError:d.func,onFinish:d.func,openPreviewDialogOnUpload:d.bool,requiredFields:d.arrayOf(d.string)},I.defaultProps={additionalFields:[],classes:{},disableRipple:!1,disabled:!1,fileUploadIconClassName:void 0,handleShare:void 0,inputId:"icon-button-file",message:void 0,onError:void 0,onFinish:void 0,openPreviewDialogOnUpload:!0,requiredFields:[],tooltipProps:{title:"Attach File"}};export{D as FILE_UPLOAD_BUTTON_DATA_ATTR,I as default};
|
|
2
2
|
//# sourceMappingURL=FileUploadIconButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploadIconButton.js","sources":["../../src/components/FileUploadIconButton.js"],"sourcesContent":["import { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport S3Upload from 'react-s3-uploader/s3upload';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport PhotoCameraIcon from '@material-ui/icons/PhotoCamera';\n\nimport PostPreviewDialog from '~components/PostPreviewDialog';\nimport AttachIcon from '~components/Icons/AttachIcon';\nimport IconButton from '~components/IconButton';\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'fileUpload';\n\n// Data attr helps to identify the select file action; Is used to prevent the tooltip from closing\nexport const FILE_UPLOAD_BUTTON_DATA_ATTR = 'data-file-upload-button';\n\nclass FileUploadIconButton extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n currentUpload: null,\n\n s3FileUrl: null,\n s3FileName: null,\n s3FileSize: null,\n\n uploadingFileToS3: false,\n\n openFileUploadPreviewDialog: false,\n };\n\n this.fileInput = createRef();\n }\n\n onFinish = async () => {\n const s3DownloadLinkResponse = await getS3DownloadLink(this.state.s3FileName);\n this.setState(\n {\n currentUpload: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: this.props.openPreviewDialogOnUpload,\n s3FileUrl: s3DownloadLinkResponse.url,\n },\n () => {\n if (this.props.onFinish)\n this.props.onFinish(this.state.s3FileUrl, this.state.s3FileName, this.state.s3FileSize);\n }\n );\n };\n\n onError = fileUploadingError => {\n if (this.props.onError) this.props.onError(fileUploadingError);\n console.error(fileUploadingError);\n };\n\n getSignedUrl = async (file, callback) => {\n let data;\n try {\n data = await getS3SignedUrl(file.name, file.type);\n } catch (e) {\n this.setState(\n {\n uploadingFileToS3: null,\n currentUpload: null,\n },\n () => {\n this.onError(e.message);\n }\n );\n return;\n }\n\n this.setState({\n s3FileUrl: data.signed_url,\n s3FileName: data.file_name,\n s3FileSize: file.size,\n });\n\n // NOTE: Add node for 'signedUrl' which is the expected name by uploader component\n callback({\n ...data,\n signedUrl: data.signed_url,\n });\n };\n\n preprocess = (file, next) => {\n next(file);\n };\n\n uploadFile = event => {\n if (!event.target.files[0]) {\n return;\n }\n\n this.clearUpload();\n const uploader = new S3Upload({\n fileElement: this.fileInput.current,\n getSignedUrl: this.getSignedUrl,\n preprocess: this.preprocess,\n onProgress: () => {}, // NOTE: Prevents logging to console\n onFinishS3Put: this.onFinish,\n onError: this.onError,\n });\n\n this.setState({\n uploadingFileToS3: true,\n currentUpload: {\n uploader,\n },\n });\n };\n\n clearUpload() {\n const { currentUpload } = this.state;\n if (currentUpload && currentUpload.uploader) {\n currentUpload.uploader.abortUpload();\n }\n }\n\n handleCloseFileUploadPreviewDialog = () => {\n this.setState({ openFileUploadPreviewDialog: false });\n };\n\n handleShare = (comment, fileName, fileSize) => {\n this.setState({ openFileUploadPreviewDialog: false }, () => {\n if (this.props.handleShare) {\n this.props.handleShare(comment, fileName, fileSize);\n }\n });\n };\n\n renderUploadButton() {\n const Icon = isNativeDetected ? PhotoCameraIcon : AttachIcon;\n const labelDataAttributes = { [FILE_UPLOAD_BUTTON_DATA_ATTR]: '' };\n\n return (\n <label htmlFor={this.props.inputId} {...labelDataAttributes}>\n <input\n ref={this.fileInput}\n id={this.props.inputId}\n type=\"file\"\n disabled={this.props.disabled}\n onChange={this.uploadFile}\n style={{ display: 'none' }}\n />\n <IconButton\n data-testid={`${PAGE_NAME}_attachFileButton`}\n aria-label=\"File Upload\"\n disabled={this.props.disabled}\n component={this.props.disabled ? 'button' : 'span'}\n className={this.props.fileUploadIconClassName}\n disableRipple={this.props.disableRipple}\n tooltipProps={this.props.tooltipProps}\n >\n <Icon />\n </IconButton>\n </label>\n );\n }\n\n render() {\n return (\n <>\n {this.state.uploadingFileToS3 ? (\n <CircularProgress data-testid=\"generic_uploadProgress\" size={18} />\n ) : (\n this.renderUploadButton()\n )}\n\n {this.state.openFileUploadPreviewDialog && (\n <PostPreviewDialog\n open={this.state.openFileUploadPreviewDialog}\n fileUrl={this.state.s3FileUrl}\n fileName={this.state.s3FileName}\n fileSize={this.state.s3FileSize}\n handleShare={this.handleShare}\n handleClose={this.handleCloseFileUploadPreviewDialog}\n additionalFields={this.props.additionalFields}\n requiredFields={this.props.requiredFields}\n message={this.props.message}\n />\n )}\n </>\n );\n }\n}\n\nFileUploadIconButton.propTypes = {\n additionalFields: PropTypes.arrayOf(PropTypes.node),\n classes: PropTypes.shape({}).isRequired,\n tooltipProps: PropTypes.shape({}),\n disableRipple: PropTypes.bool,\n disabled: PropTypes.bool,\n fileUploadIconClassName: PropTypes.string,\n handleShare: PropTypes.func,\n inputId: PropTypes.string,\n message: PropTypes.string,\n onError: PropTypes.func,\n onFinish: PropTypes.func,\n openPreviewDialogOnUpload: PropTypes.bool,\n requiredFields: PropTypes.arrayOf(PropTypes.string),\n};\n\nFileUploadIconButton.defaultProps = {\n additionalFields: [],\n disableRipple: false,\n disabled: false,\n fileUploadIconClassName: undefined,\n handleShare: undefined,\n inputId: 'icon-button-file',\n message: undefined,\n onError: undefined,\n onFinish: undefined,\n openPreviewDialogOnUpload: true,\n requiredFields: [],\n tooltipProps: { title: 'Attach File' },\n};\n\nexport default FileUploadIconButton;\n"],"names":["FILE_UPLOAD_BUTTON_DATA_ATTR","FileUploadIconButton","_PureComponent","_inherits","PureComponent","_super","_createSuper","props","_this","_ref2","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","s3DownloadLinkResponse","wrap","_context","prev","next","getS3DownloadLink","state","s3FileName","sent","setState","currentUpload","uploadingFileToS3","openFileUploadPreviewDialog","openPreviewDialogOnUpload","s3FileUrl","url","onFinish","s3FileSize","stop","fileUploadingError","onError","console","error","_callee2","file","callback","data","_context2","getS3SignedUrl","name","type","t0","message","abrupt","signed_url","file_name","size","signedUrl","_x","_x2","apply","arguments","event","target","files","clearUpload","uploader","S3Upload","fileElement","fileInput","current","getSignedUrl","preprocess","onProgress","onFinishS3Put","comment","fileName","fileSize","handleShare","createRef","_createClass","key","value","abortUpload","Icon","isNativeDetected","PhotoCameraIcon","AttachIcon","labelDataAttributes","_jsxs","_objectSpread","htmlFor","inputId","children","_jsx","ref","id","disabled","onChange","uploadFile","style","display","IconButton","concat","component","className","fileUploadIconClassName","disableRipple","tooltipProps","_Fragment","CircularProgress","renderUploadButton","PostPreviewDialog","open","fileUrl","handleClose","handleCloseFileUploadPreviewDialog","additionalFields","requiredFields","propTypes","PropTypes","arrayOf","node","classes","shape","isRequired","bool","string","func","defaultProps","undefined","title"],"mappings":"k+DAYA,IAGaA,EAA+B,0BAEtCC,EAAoB,SAAAC,GAAAC,EAAAF,EAASG,GAAT,IAAAC,EAAAC,EAAAL,GACxB,SAAAA,EAAYM,GAAO,IAAAC,EAuCJC,EAxBgB,OAfZC,EAAAC,KAAAV,GACjBO,EAAAH,EAAAO,KAAAD,KAAMJ,GAAOM,EAiBJC,EAAAN,GAAA,WAAAO,EAAAC,EAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAA,OAAAH,EAAAI,MA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AAM,CAAA,GAAIC,WAC7BjB,aAAcY,EAAUI,MAAM,IAC9BjB,cAAea,EAAUM,KACzB7B,SAAUuB,EAAUM,KACpBpB,wBAAyBc,EAAUO,OACnCjD,YAAa0C,EAAUQ,KACvBpC,QAAS4B,EAAUO,OACnB3E,QAASoE,EAAUO,OACnBvF,QAASgF,EAAUQ,KACnB5F,SAAUoF,EAAUQ,KACpB/F,0BAA2BuF,EAAUM,KACrCR,eAAgBE,EAAUC,QAAQD,EAAUO,SAG9C7H,EAAqB+H,aAAe,CAClCZ,iBAAkB,GAClBV,eAAe,EACfV,UAAU,EACVS,6BAAyBwB,EACzBpD,iBAAaoD,EACbtC,QAAS,mBACTxC,aAAS8E,EACT1F,aAAS0F,EACT9F,cAAU8F,EACVjG,2BAA2B,EAC3BqF,eAAgB,GAChBV,aAAc,CAAEuB,MAAO"}
|
|
1
|
+
{"version":3,"file":"FileUploadIconButton.js","sources":["../../src/components/FileUploadIconButton.js"],"sourcesContent":["import { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport S3Upload from 'react-s3-uploader/s3upload';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport PhotoCameraIcon from '@material-ui/icons/PhotoCamera';\n\nimport PostPreviewDialog from '~components/PostPreviewDialog';\nimport AttachIcon from '~components/Icons/AttachIcon';\nimport IconButton from '~components/IconButton';\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'fileUpload';\n\n// Data attr helps to identify the select file action; Is used to prevent the tooltip from closing\nexport const FILE_UPLOAD_BUTTON_DATA_ATTR = 'data-file-upload-button';\n\nclass FileUploadIconButton extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n currentUpload: null,\n\n s3FileUrl: null,\n s3FileName: null,\n s3FileSize: null,\n\n uploadingFileToS3: false,\n\n openFileUploadPreviewDialog: false,\n };\n\n this.fileInput = createRef();\n }\n\n onFinish = async () => {\n const s3DownloadLinkResponse = await getS3DownloadLink(this.state.s3FileName);\n this.setState(\n {\n currentUpload: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: this.props.openPreviewDialogOnUpload,\n s3FileUrl: s3DownloadLinkResponse.url,\n },\n () => {\n if (this.props.onFinish)\n this.props.onFinish(this.state.s3FileUrl, this.state.s3FileName, this.state.s3FileSize);\n }\n );\n };\n\n onError = fileUploadingError => {\n if (this.props.onError) this.props.onError(fileUploadingError);\n console.error(fileUploadingError);\n };\n\n getSignedUrl = async (file, callback) => {\n let data;\n try {\n data = await getS3SignedUrl(file.name, file.type);\n } catch (e) {\n this.setState(\n {\n uploadingFileToS3: null,\n currentUpload: null,\n },\n () => {\n this.onError(e.message);\n }\n );\n return;\n }\n\n this.setState({\n s3FileUrl: data.signed_url,\n s3FileName: data.file_name,\n s3FileSize: file.size,\n });\n\n // NOTE: Add node for 'signedUrl' which is the expected name by uploader component\n callback({\n ...data,\n signedUrl: data.signed_url,\n });\n };\n\n preprocess = (file, next) => {\n next(file);\n };\n\n uploadFile = event => {\n if (!event.target.files[0]) {\n return;\n }\n\n this.clearUpload();\n const uploader = new S3Upload({\n fileElement: this.fileInput.current,\n getSignedUrl: this.getSignedUrl,\n preprocess: this.preprocess,\n onProgress: () => {}, // NOTE: Prevents logging to console\n onFinishS3Put: this.onFinish,\n onError: this.onError,\n });\n\n this.setState({\n uploadingFileToS3: true,\n currentUpload: {\n uploader,\n },\n });\n };\n\n clearUpload() {\n const { currentUpload } = this.state;\n if (currentUpload && currentUpload.uploader) {\n currentUpload.uploader.abortUpload();\n }\n }\n\n handleCloseFileUploadPreviewDialog = () => {\n this.setState({ openFileUploadPreviewDialog: false });\n };\n\n handleShare = (comment, fileName, fileSize) => {\n this.setState({ openFileUploadPreviewDialog: false }, () => {\n if (this.props.handleShare) {\n this.props.handleShare(comment, fileName, fileSize);\n }\n });\n };\n\n renderUploadButton() {\n const Icon = isNativeDetected ? PhotoCameraIcon : AttachIcon;\n const labelDataAttributes = { [FILE_UPLOAD_BUTTON_DATA_ATTR]: '' };\n\n return (\n <label htmlFor={this.props.inputId} {...labelDataAttributes}>\n <input\n ref={this.fileInput}\n id={this.props.inputId}\n type=\"file\"\n disabled={this.props.disabled}\n onChange={this.uploadFile}\n style={{ display: 'none' }}\n />\n <IconButton\n data-testid={`${PAGE_NAME}_attachFileButton`}\n aria-label=\"File Upload\"\n disabled={this.props.disabled}\n component={this.props.disabled ? 'button' : 'span'}\n className={this.props.fileUploadIconClassName}\n disableRipple={this.props.disableRipple}\n tooltipProps={this.props.tooltipProps}\n >\n <Icon />\n </IconButton>\n </label>\n );\n }\n\n render() {\n return (\n <>\n {this.state.uploadingFileToS3 ? (\n <CircularProgress data-testid=\"generic_uploadProgress\" size={18} />\n ) : (\n this.renderUploadButton()\n )}\n\n {this.state.openFileUploadPreviewDialog && (\n <PostPreviewDialog\n open={this.state.openFileUploadPreviewDialog}\n fileUrl={this.state.s3FileUrl}\n fileName={this.state.s3FileName}\n fileSize={this.state.s3FileSize}\n handleShare={this.handleShare}\n handleClose={this.handleCloseFileUploadPreviewDialog}\n additionalFields={this.props.additionalFields}\n requiredFields={this.props.requiredFields}\n message={this.props.message}\n />\n )}\n </>\n );\n }\n}\n\nFileUploadIconButton.propTypes = {\n additionalFields: PropTypes.arrayOf(PropTypes.node),\n classes: PropTypes.shape({}),\n tooltipProps: PropTypes.shape({}),\n disableRipple: PropTypes.bool,\n disabled: PropTypes.bool,\n fileUploadIconClassName: PropTypes.string,\n handleShare: PropTypes.func,\n inputId: PropTypes.string,\n message: PropTypes.string,\n onError: PropTypes.func,\n onFinish: PropTypes.func,\n openPreviewDialogOnUpload: PropTypes.bool,\n requiredFields: PropTypes.arrayOf(PropTypes.string),\n};\n\nFileUploadIconButton.defaultProps = {\n additionalFields: [],\n classes: {},\n disableRipple: false,\n disabled: false,\n fileUploadIconClassName: undefined,\n handleShare: undefined,\n inputId: 'icon-button-file',\n message: undefined,\n onError: undefined,\n onFinish: undefined,\n openPreviewDialogOnUpload: true,\n requiredFields: [],\n tooltipProps: { title: 'Attach File' },\n};\n\nexport default FileUploadIconButton;\n"],"names":["FILE_UPLOAD_BUTTON_DATA_ATTR","FileUploadIconButton","_PureComponent","_inherits","PureComponent","_super","_createSuper","props","_this","_ref2","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","s3DownloadLinkResponse","wrap","_context","prev","next","getS3DownloadLink","state","s3FileName","sent","setState","currentUpload","uploadingFileToS3","openFileUploadPreviewDialog","openPreviewDialogOnUpload","s3FileUrl","url","onFinish","s3FileSize","stop","fileUploadingError","onError","console","error","_callee2","file","callback","data","_context2","getS3SignedUrl","name","type","t0","message","abrupt","signed_url","file_name","size","signedUrl","_x","_x2","apply","arguments","event","target","files","clearUpload","uploader","S3Upload","fileElement","fileInput","current","getSignedUrl","preprocess","onProgress","onFinishS3Put","comment","fileName","fileSize","handleShare","createRef","_createClass","key","value","abortUpload","Icon","isNativeDetected","PhotoCameraIcon","AttachIcon","labelDataAttributes","_jsxs","_objectSpread","htmlFor","inputId","children","_jsx","ref","id","disabled","onChange","uploadFile","style","display","IconButton","concat","component","className","fileUploadIconClassName","disableRipple","tooltipProps","_Fragment","CircularProgress","renderUploadButton","PostPreviewDialog","open","fileUrl","handleClose","handleCloseFileUploadPreviewDialog","additionalFields","requiredFields","propTypes","PropTypes","arrayOf","node","classes","shape","bool","string","func","defaultProps","undefined","title"],"mappings":"k+DAYA,IAGaA,EAA+B,0BAEtCC,EAAoB,SAAAC,GAAAC,EAAAF,EAASG,GAAT,IAAAC,EAAAC,EAAAL,GACxB,SAAAA,EAAYM,GAAO,IAAAC,EAuCJC,EAxBgB,OAfZC,EAAAC,KAAAV,GACjBO,EAAAH,EAAAO,KAAAD,KAAMJ,GAAOM,EAiBJC,EAAAN,GAAA,WAAAO,EAAAC,EAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAA,OAAAH,EAAAI,MAAA,SAA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zBhB,aAAcY,EAAUI,MAAM,IAC9BjB,cAAea,EAAUK,KACzB5B,SAAUuB,EAAUK,KACpBnB,wBAAyBc,EAAUM,OACnChD,YAAa0C,EAAUO,KACvBnC,QAAS4B,EAAUM,OACnB1E,QAASoE,EAAUM,OACnBtF,QAASgF,EAAUO,KACnB3F,SAAUoF,EAAUO,KACpB9F,0BAA2BuF,EAAUK,KACrCP,eAAgBE,EAAUC,QAAQD,EAAUM,SAG9C5H,EAAqB8H,aAAe,CAClCX,iBAAkB,GAClBM,QAAS,CAAE,EACXhB,eAAe,EACfV,UAAU,EACVS,6BAAyBuB,EACzBnD,iBAAamD,EACbrC,QAAS,mBACTxC,aAAS6E,EACTzF,aAASyF,EACT7F,cAAU6F,EACVhG,2BAA2B,EAC3BqF,eAAgB,GAChBV,aAAc,CAAEsB,MAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import{useEffect as o,useCallback as n}from"react";import{debounce as r}from"lodash";import t from"prop-types";import{withStyles as s}from"@material-ui/core/styles";import{MentionsInput as i,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import{handleFetchUsers as u}from"./utils/index.js";import{USER_MARKUP as c}from"./constants.js";import p from"./style.css.js";import{AvatarComponent as m}from"../Avatar/index.js";import"../../permissions/PermissionsContext.js";import{PERMISSIONS as f}from"../../permissions/constants/index.js";import"@babel/runtime/helpers/slicedToArray";import{withPermissionsHOC as g}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import{jsx as d,jsxs as b}from"react/jsx-runtime";function y(e,o){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),n.push.apply(n,r)}return n}function h(o){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?y(Object(r),!0).forEach((function(n){e(o,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}))}return o}var v={backgroundColor:l[100]},j={color:"#00bcd4"},_={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},w=h(h({},_),{},{input:{color:"#fff",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),O=h(h({},_),{},{input:{color:"#000"}}),P=function(e){var t=e.onChange,s=e.singleLine,l=e.suggestionsPortalHost,f=e.value,g=e.inputRef,y=e.classes,_=e.style,P=e.withLightTheme,C=e.placeholder,S=e.onMount,x=e.onKeyDown,
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{useEffect as o,useCallback as n}from"react";import{debounce as r}from"lodash";import t from"prop-types";import{withStyles as s}from"@material-ui/core/styles";import{MentionsInput as i,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import{handleFetchUsers as u}from"./utils/index.js";import{USER_MARKUP as c}from"./constants.js";import p from"./style.css.js";import{AvatarComponent as m}from"../Avatar/index.js";import"../../permissions/PermissionsContext.js";import{PERMISSIONS as f}from"../../permissions/constants/index.js";import"@babel/runtime/helpers/slicedToArray";import{withPermissionsHOC as g}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import{jsx as d,jsxs as b}from"react/jsx-runtime";function y(e,o){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),n.push.apply(n,r)}return n}function h(o){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?y(Object(r),!0).forEach((function(n){e(o,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}))}return o}var v={backgroundColor:l[100]},j={color:"#00bcd4"},_={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},w=h(h({},_),{},{input:{color:"#fff",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),O=h(h({},_),{},{input:{color:"#000"}}),P=function(e){var t=e.onChange,s=e.singleLine,l=e.suggestionsPortalHost,f=e.value,g=e.inputRef,y=e.classes,_=e.style,P=e.withLightTheme,C=e.placeholder,S=e.onMount,x=e.onKeyDown,A=e.onKeyUp,D=e.onFocus,F=e.onBlur,K=e.autoFocus,R=e.disabled,L=e.companyId,N=e.currentUser,T=e.isCompanySelectVisible,U=e.mentionProps,k=e.allowSuggestionsAboveCursor;o(S,[]);var H=n(r((function(e,o){var n=T&&N&&N.company_id!==L?[N.company_id,L]:null;u(e,o,n)}),400),[L]),I=Object.assign(P?O:w,_);return d(i,{value:f,onChange:function(e,o){t(o)},singleLine:s,allowSpaceInQuery:!0,classNames:p,placeholder:C,suggestionsPortalHost:l,inputRef:g,style:I,onKeyDown:x,onKeyUp:A,autoFocus:K,onFocus:D,onBlur:F,disabled:R,allowSuggestionsAboveCursor:k,children:d(a,h({markup:c,renderSuggestion:function(e){return function(e,o){return b("div",{className:p.mention__suggestion,children:[d(m,{alt:e.display,displayName:e.display,className:o.avatar,imgSrc:e.photo}),b("div",{className:p.mention__suggestion__info,children:[d("span",{"data-testid":"".concat("userMention","_name_").concat(e.display),className:p.mention__suggestion__info__name,children:e.display}),e.title&&d("span",{className:p.mention__suggestion__info__group,children:e.title})]})]})}(e,y)},trigger:"@",data:H,displayTransform:function(e,o){return"@".concat(o)},style:P?v:j,appendSpaceOnAdd:!0},U))})};P.propTypes={onChange:t.func,singleLine:t.bool,suggestionsPortalHost:t.shape({current:t.instanceOf(Element)}),value:t.string,inputRef:t.shape({}),classes:t.shape({avatar:t.string.isRequired}).isRequired,withLightTheme:t.bool,placeholder:t.string,style:t.shape({}),mentionProps:t.shape({}),onMount:t.func,onKeyDown:t.func,onKeyUp:t.func,onFocus:t.func,onBlur:t.func,autoFocus:t.bool,disabled:t.bool,currentUser:t.shape({company_id:t.number.isRequired}),companyId:t.number,isCompanySelectVisible:t.bool.isRequired,allowSuggestionsAboveCursor:t.bool},P.defaultProps={onChange:function(){},singleLine:!1,suggestionsPortalHost:null,value:"",inputRef:null,withLightTheme:!1,placeholder:"Mention people using '@'",style:{suggestions:{list:{background:"#414141"},item:{color:"white",height:30,"&focused":{backgroundColor:"rgba(255, 255, 255, 0.08)"}}}},mentionProps:{},onMount:function(){},onKeyDown:function(){},onKeyUp:function(){},onFocus:function(){},onBlur:function(){},autoFocus:!0,disabled:!1,allowSuggestionsAboveCursor:!1,companyId:null,currentUser:null};var C=g({isCompanySelectVisible:f.companySelectorView})(s({avatar:{height:45,width:45,border:"1.5px solid #fff"}})(P));export{C as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/UserMention/index.js"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { debounce } from 'lodash';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { MentionsInput, Mention } from 'react-mentions';\nimport blue from '@material-ui/core/colors/blue';\n\nimport { handleFetchUsers } from './utils';\nimport { USER_MARKUP } from './constants';\n\nimport styles from './style.css';\n\nimport Avatar from '~components/Avatar';\nimport { withPermissionsHOC, PERMISSIONS } from '~/permissions';\n\nconst PAGE_NAME = 'userMention';\n\nconst muiStyles = {\n avatar: {\n height: 45,\n width: 45,\n border: '1.5px solid #fff',\n },\n};\n\nconst mentionLightStyle = {\n backgroundColor: blue[100],\n};\nconst mentionDarkStyle = {\n color: '#00bcd4',\n};\n\n// NOTE: IMPORTANT! 'input', 'mention' and 'highliter' should always have same font/latter/height/line etc values\nconst inputStyles = {\n suggestions: {\n item: {\n '&focused': {\n backgroundColor: 'rgba(0, 0, 0, 0.08)',\n },\n },\n },\n};\n\nconst darkThemeInputStyles = {\n ...inputStyles,\n input: {\n color: '#fff',\n caretColor: '#fff',\n zIndex: 1,\n },\n highlighter: {\n color: '#fff',\n },\n};\n\nconst lightThemeInputStyles = {\n ...inputStyles,\n input: { color: '#000' },\n};\n\nconst renderSuggestion = (entry, classes) => (\n <div className={styles.mention__suggestion}>\n <Avatar\n alt={entry.display}\n displayName={entry.display}\n className={classes.avatar}\n imgSrc={entry.photo}\n />\n <div className={styles.mention__suggestion__info}>\n <span\n data-testid={`${PAGE_NAME}_name_${entry.display}`}\n className={styles.mention__suggestion__info__name}\n >\n {entry.display}\n </span>\n {entry.title && (\n <span className={styles.mention__suggestion__info__group}>{entry.title}</span>\n )}\n </div>\n </div>\n);\n\nconst UserMention = ({\n onChange,\n singleLine,\n suggestionsPortalHost,\n value,\n inputRef,\n classes,\n style,\n withLightTheme,\n placeholder,\n onMount,\n onKeyDown,\n onKeyUp,\n onFocus,\n onBlur,\n autoFocus,\n disabled,\n companyId,\n currentUser,\n isCompanySelectVisible,\n mentionProps,\n allowSuggestionsAboveCursor,\n}) => {\n useEffect(onMount, []);\n\n const fetchUsers = (search, callback) => {\n const companyIds =\n isCompanySelectVisible && currentUser && currentUser.company_id !== companyId\n ? [currentUser.company_id, companyId]\n : null;\n\n handleFetchUsers(search, callback, companyIds);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = Object.assign(\n withLightTheme ? lightThemeInputStyles : darkThemeInputStyles,\n style\n );\n\n return (\n <MentionsInput\n value={value}\n onChange={onInputChange}\n singleLine={singleLine}\n allowSpaceInQuery\n classNames={styles}\n placeholder={placeholder}\n suggestionsPortalHost={suggestionsPortalHost}\n inputRef={inputRef}\n style={themedStyle}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n autoFocus={autoFocus}\n onFocus={onFocus}\n onBlur={onBlur}\n disabled={disabled}\n allowSuggestionsAboveCursor={allowSuggestionsAboveCursor}\n >\n <Mention\n markup={USER_MARKUP}\n renderSuggestion={entry => renderSuggestion(entry, classes)}\n trigger=\"@\"\n data={debouncedUsersFetch}\n displayTransform={(id, display) => `@${display}`}\n style={withLightTheme ? mentionLightStyle : mentionDarkStyle}\n appendSpaceOnAdd\n {...mentionProps}\n />\n </MentionsInput>\n );\n};\n\nUserMention.propTypes = {\n onChange: PropTypes.func,\n singleLine: PropTypes.bool,\n suggestionsPortalHost: PropTypes.shape({\n current: PropTypes.instanceOf(Element),\n }),\n value: PropTypes.string,\n inputRef: PropTypes.shape({}),\n classes: PropTypes.shape({\n avatar: PropTypes.string.isRequired,\n }).isRequired,\n withLightTheme: PropTypes.bool,\n placeholder: PropTypes.string,\n style: PropTypes.shape({}),\n mentionProps: PropTypes.shape({}),\n onMount: PropTypes.func,\n onKeyDown: PropTypes.func,\n onKeyUp: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n currentUser: PropTypes.shape({\n company_id: PropTypes.number.isRequired,\n })
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/UserMention/index.js"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { debounce } from 'lodash';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { MentionsInput, Mention } from 'react-mentions';\nimport blue from '@material-ui/core/colors/blue';\n\nimport { handleFetchUsers } from './utils';\nimport { USER_MARKUP } from './constants';\n\nimport styles from './style.css';\n\nimport Avatar from '~components/Avatar';\nimport { withPermissionsHOC, PERMISSIONS } from '~/permissions';\n\nconst PAGE_NAME = 'userMention';\n\nconst muiStyles = {\n avatar: {\n height: 45,\n width: 45,\n border: '1.5px solid #fff',\n },\n};\n\nconst mentionLightStyle = {\n backgroundColor: blue[100],\n};\nconst mentionDarkStyle = {\n color: '#00bcd4',\n};\n\n// NOTE: IMPORTANT! 'input', 'mention' and 'highliter' should always have same font/latter/height/line etc values\nconst inputStyles = {\n suggestions: {\n item: {\n '&focused': {\n backgroundColor: 'rgba(0, 0, 0, 0.08)',\n },\n },\n },\n};\n\nconst darkThemeInputStyles = {\n ...inputStyles,\n input: {\n color: '#fff',\n caretColor: '#fff',\n zIndex: 1,\n },\n highlighter: {\n color: '#fff',\n },\n};\n\nconst lightThemeInputStyles = {\n ...inputStyles,\n input: { color: '#000' },\n};\n\nconst renderSuggestion = (entry, classes) => (\n <div className={styles.mention__suggestion}>\n <Avatar\n alt={entry.display}\n displayName={entry.display}\n className={classes.avatar}\n imgSrc={entry.photo}\n />\n <div className={styles.mention__suggestion__info}>\n <span\n data-testid={`${PAGE_NAME}_name_${entry.display}`}\n className={styles.mention__suggestion__info__name}\n >\n {entry.display}\n </span>\n {entry.title && (\n <span className={styles.mention__suggestion__info__group}>{entry.title}</span>\n )}\n </div>\n </div>\n);\n\nconst UserMention = ({\n onChange,\n singleLine,\n suggestionsPortalHost,\n value,\n inputRef,\n classes,\n style,\n withLightTheme,\n placeholder,\n onMount,\n onKeyDown,\n onKeyUp,\n onFocus,\n onBlur,\n autoFocus,\n disabled,\n companyId,\n currentUser,\n isCompanySelectVisible,\n mentionProps,\n allowSuggestionsAboveCursor,\n}) => {\n useEffect(onMount, []);\n\n const fetchUsers = (search, callback) => {\n const companyIds =\n isCompanySelectVisible && currentUser && currentUser.company_id !== companyId\n ? [currentUser.company_id, companyId]\n : null;\n\n handleFetchUsers(search, callback, companyIds);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = Object.assign(\n withLightTheme ? lightThemeInputStyles : darkThemeInputStyles,\n style\n );\n\n return (\n <MentionsInput\n value={value}\n onChange={onInputChange}\n singleLine={singleLine}\n allowSpaceInQuery\n classNames={styles}\n placeholder={placeholder}\n suggestionsPortalHost={suggestionsPortalHost}\n inputRef={inputRef}\n style={themedStyle}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n autoFocus={autoFocus}\n onFocus={onFocus}\n onBlur={onBlur}\n disabled={disabled}\n allowSuggestionsAboveCursor={allowSuggestionsAboveCursor}\n >\n <Mention\n markup={USER_MARKUP}\n renderSuggestion={entry => renderSuggestion(entry, classes)}\n trigger=\"@\"\n data={debouncedUsersFetch}\n displayTransform={(id, display) => `@${display}`}\n style={withLightTheme ? mentionLightStyle : mentionDarkStyle}\n appendSpaceOnAdd\n {...mentionProps}\n />\n </MentionsInput>\n );\n};\n\nUserMention.propTypes = {\n onChange: PropTypes.func,\n singleLine: PropTypes.bool,\n suggestionsPortalHost: PropTypes.shape({\n current: PropTypes.instanceOf(Element),\n }),\n value: PropTypes.string,\n inputRef: PropTypes.shape({}),\n classes: PropTypes.shape({\n avatar: PropTypes.string.isRequired,\n }).isRequired,\n withLightTheme: PropTypes.bool,\n placeholder: PropTypes.string,\n style: PropTypes.shape({}),\n mentionProps: PropTypes.shape({}),\n onMount: PropTypes.func,\n onKeyDown: PropTypes.func,\n onKeyUp: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n currentUser: PropTypes.shape({\n company_id: PropTypes.number.isRequired,\n }),\n companyId: PropTypes.number,\n isCompanySelectVisible: PropTypes.bool.isRequired,\n allowSuggestionsAboveCursor: PropTypes.bool,\n};\n\nUserMention.defaultProps = {\n onChange: () => undefined,\n singleLine: false,\n suggestionsPortalHost: null,\n value: '',\n inputRef: null,\n withLightTheme: false,\n placeholder: \"Mention people using '@'\",\n style: {\n suggestions: {\n list: {\n background: '#414141',\n },\n item: {\n color: 'white',\n height: 30,\n '&focused': {\n backgroundColor: 'rgba(255, 255, 255, 0.08)',\n },\n },\n },\n },\n mentionProps: {},\n onMount: () => undefined,\n onKeyDown: () => undefined,\n onKeyUp: () => undefined,\n onFocus: () => undefined,\n onBlur: () => undefined,\n autoFocus: true,\n disabled: false,\n allowSuggestionsAboveCursor: false,\n companyId: null,\n currentUser: null,\n};\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","blue","mentionDarkStyle","color","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","onChange","singleLine","suggestionsPortalHost","value","inputRef","classes","style","withLightTheme","placeholder","onMount","onKeyDown","onKeyUp","onFocus","onBlur","autoFocus","disabled","companyId","currentUser","isCompanySelectVisible","mentionProps","allowSuggestionsAboveCursor","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","Object","assign","_jsx","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","Mention","_objectSpread","markup","USER_MARKUP","renderSuggestion","entry","_jsxs","className","mention__suggestion","Avatar","alt","display","displayName","avatar","imgSrc","photo","mention__suggestion__info","concat","mention__suggestion__info__name","title","mention__suggestion__info__group","trigger","data","displayTransform","id","appendSpaceOnAdd","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","defaultProps","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"+/CAeA,IAUMA,EAAoB,CACxBC,gBAAiBC,EAAK,MAElBC,EAAmB,CACvBC,MAAO,WAIHC,EAAc,CAClBC,YAAa,CACXC,KAAM,CACJ,WAAY,CACVN,gBAAiB,0BAMnBO,SACDH,GAAW,CAAA,EAAA,CACdI,MAAO,CACLL,MAAO,OACPM,WAAY,OACZC,OAAQ,GAEVC,YAAa,CACXR,MAAO,UAILS,SACDR,GAAW,CAAA,EAAA,CACdI,MAAO,CAAEL,MAAO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AAM,CACJH,MAAO,QACP6F,OAAQ,GACR,WAAY,CACVhG,gBAAiB,gCAKzBkC,aAAc,CAAE,EAChBV,QAAS,WAAe,EACxBC,UAAW,WAAe,EAC1BC,QAAS,WAAe,EACxBC,QAAS,WAAe,EACxBC,OAAQ,WAAe,EACvBC,WAAW,EACXC,UAAU,EACVK,6BAA6B,EAC7BJ,UAAW,KACXC,YAAa,MAGf,IAAAiE,EAAeC,EAAmB,CAAEjE,uBAAwBkE,EAAYC,qBAAzDF,CACbG,EAlNgB,CAChBhC,OAAQ,CACN2B,OAAQ,GACRM,MAAO,GACPC,OAAQ,qBA8MVF,CAAsBxF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from'./../../ext-esm/style-inject/dist/style-inject.es.js';var o={spacing:"8",root:"Autocomplete_root__4SidE",paper:"Autocomplete_paper__Vq6DC",sticky:"Autocomplete_sticky__0-eTa",menuItem:"Autocomplete_menuItem__c2Qka",listboxScrolled:"Autocomplete_listboxScrolled__n34NV",checkboxSmall:"Autocomplete_checkboxSmall__TjdiN",checkboxMedium:"Autocomplete_checkboxMedium__LUbff",selectedValue:"Autocomplete_selectedValue__iGHNh",selectedValueChip:"Autocomplete_selectedValueChip__5QOEK",inputContainer:"Autocomplete_inputContainer__RKk5j",prefix:"Autocomplete_prefix__WzSbL",input:"Autocomplete_input__FHTVO",withArrow:"Autocomplete_withArrow__pNaNX",withClear:"Autocomplete_withClear__RGtWV",suffix:"Autocomplete_suffix__y3P7i",readOnlyInput:"Autocomplete_readOnlyInput__mD5xQ"};t('.Autocomplete_root__4SidE{width:100%}.Autocomplete_root__4SidE .MuiAutocomplete-endAdornment{display:contents}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator{margin:0;padding:0;visibility:visible}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator .MuiTouchRipple-root,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator .MuiTouchRipple-root{display:none}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator{background-color:transparent!important;transition:transform .15s cubic-bezier(.4,0,.2,1),color .15s cubic-bezier(.4,0,.2,1)}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator svg,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator svg{display:block}.Autocomplete_root__4SidE .MuiInputAdornment-positionStart{max-width:70%}.Autocomplete_paper__Vq6DC{--corvaui-background:var(--palette-background-b-9);background-color:var(--palette-background-b-9)!important;box-shadow:0 8px 24px 0 rgba(0,0,0,.24)!important;display:flex;flex-flow:column wrap;margin:8px 0;max-height:40vh;overflow:hidden;padding:0;position:relative}.Autocomplete_paper__Vq6DC:before{background:linear-gradient(180deg,rgb(from var(--corvaui-background) r g b/1) 0,rgb(from var(--corvaui-background) r g b/0) 100%);content:"";height:8px;inset:0 10px auto 0;position:absolute;z-index:1}.Autocomplete_paper__Vq6DC:after{background:linear-gradient(0deg,rgb(from var(--corvaui-background) r g b/1) 0,rgb(from var(--corvaui-background) r g b/0) 100%);content:"";height:8px;inset:auto 10px 0 0;position:absolute;z-index:1}.Autocomplete_paper__Vq6DC:has(.Autocomplete_sticky__0-eTa){padding-top:8px}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox{flex:0 1 auto;max-height:unset;padding:8px 0}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox,.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox li{width:100%}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox:has(.Autocomplete_sticky__0-eTa){padding-top:0}.Autocomplete_paper__Vq6DC li.MuiAutocomplete-option{background:var(--corvaui-background)!important;display:block;padding:0 16px!important;z-index:1}.Autocomplete_paper__Vq6DC li.MuiAutocomplete-option[data-focus=true] .Autocomplete_menuItem__c2Qka{background-color:rgb(from var(--palette-primary-text-1) r g b/.08)}.Autocomplete_paper__Vq6DC li.MuiAutocomplete-option:has(.Autocomplete_sticky__0-eTa){left:0;position:sticky;top:0}.Autocomplete_paper__Vq6DC .Autocomplete_sticky__0-eTa{border-bottom:1px solid rgb(from var(--palette-primary-text-1) r g b/.25);overflow:visible}.Autocomplete_paper__Vq6DC .Autocomplete_listboxScrolled__n34NV .Autocomplete_sticky__0-eTa:after{background:linear-gradient(0deg,rgb(from var(--corvaui-background) r g b/0) 0,rgb(from var(--corvaui-background) r g b/1) 100%);content:"";height:8px;inset:100% 0 auto 0;margin-top:1px;position:absolute}.Autocomplete_paper__Vq6DC .MuiAutocomplete-noOptions{align-items:center;color:var(--palette-primary-text-6);display:flex;font-size:12px;font-style:italic;justify-content:center;min-height:31px;padding:0}.Autocomplete_paper__Vq6DC .MuiAutocomplete-groupLabel{background:var(--corvaui-background)!important;color:var(--palette-primary-text-7);font-size:12px;font-weight:400;line-height:16px}.Autocomplete_paper__Vq6DC .MuiAutocomplete-groupLabel:not(:empty){padding-top:8px}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox li+li .MuiAutocomplete-groupLabel:not(:empty){margin-top:8px}.Autocomplete_checkboxSmall__TjdiN{margin-right:-8px}.Autocomplete_checkboxMedium__LUbff{margin-right:-12px}.Autocomplete_selectedValue__iGHNh{overflow:hidden}.Autocomplete_selectedValueChip__5QOEK{flex:0 0 auto;margin:-3px 0;max-width:calc(33% - 8px)}.Autocomplete_inputContainer__RKk5j{flex-wrap:wrap;position:relative;row-gap:14px}.Autocomplete_inputContainer__RKk5j .Autocomplete_selectedValue__iGHNh{max-width:50%}.Autocomplete_prefix__WzSbL{display:contents}.Autocomplete_input__FHTVO{flex:1 1;max-width:100%;min-width:150px}.Autocomplete_withArrow__pNaNX .Autocomplete_input__FHTVO,.Autocomplete_withClear__RGtWV .Autocomplete_input__FHTVO{padding-right:24px}.Autocomplete_withArrow__pNaNX.Autocomplete_withClear__RGtWV .Autocomplete_input__FHTVO{padding-right:48px}.Autocomplete_suffix__y3P7i{bottom:calc(var(--corvaui-textinput-inputheight)/2 + 6px);height:var(--corvaui-textinput-inputheight);position:absolute;right:7px;transform:translateY(50%)}.Autocomplete_readOnlyInput__mD5xQ{cursor:inherit}');export{o as default};
|
|
1
|
+
import t from'./../../ext-esm/style-inject/dist/style-inject.es.js';var o={spacing:"8",root:"Autocomplete_root__4SidE",paper:"Autocomplete_paper__Vq6DC",sticky:"Autocomplete_sticky__0-eTa",menuItem:"Autocomplete_menuItem__c2Qka",listboxScrolled:"Autocomplete_listboxScrolled__n34NV",checkboxSmall:"Autocomplete_checkboxSmall__TjdiN",checkboxMedium:"Autocomplete_checkboxMedium__LUbff",selectedValue:"Autocomplete_selectedValue__iGHNh",selectedValueChip:"Autocomplete_selectedValueChip__5QOEK",inputContainer:"Autocomplete_inputContainer__RKk5j",prefix:"Autocomplete_prefix__WzSbL",input:"Autocomplete_input__FHTVO",withArrow:"Autocomplete_withArrow__pNaNX",withClear:"Autocomplete_withClear__RGtWV",suffix:"Autocomplete_suffix__y3P7i",readOnlyInput:"Autocomplete_readOnlyInput__mD5xQ"};t('.Autocomplete_root__4SidE{width:100%}.Autocomplete_root__4SidE .MuiAutocomplete-endAdornment{display:contents}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator{margin:0;padding:0;visibility:visible}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator .MuiTouchRipple-root,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator .MuiTouchRipple-root{display:none}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator{background-color:transparent!important;transition:transform .15s cubic-bezier(.4,0,.2,1),color .15s cubic-bezier(.4,0,.2,1)}.Autocomplete_root__4SidE .MuiAutocomplete-clearIndicator svg,.Autocomplete_root__4SidE .MuiAutocomplete-popupIndicator svg{display:block}.Autocomplete_root__4SidE .MuiInputAdornment-positionStart{max-width:70%}.Autocomplete_paper__Vq6DC{--corvaui-background:var(--palette-background-b-9);background-color:var(--palette-background-b-9)!important;box-shadow:0 8px 24px 0 rgba(0,0,0,.24)!important;display:flex;flex-flow:column wrap;margin:8px 0;max-height:40vh;overflow:hidden;padding:0;position:relative}.Autocomplete_paper__Vq6DC:before{background:linear-gradient(180deg,rgb(from var(--corvaui-background) r g b/1) 0,rgb(from var(--corvaui-background) r g b/0) 100%);content:"";height:8px;inset:0 10px auto 0;position:absolute;z-index:1}.Autocomplete_paper__Vq6DC:after{background:linear-gradient(0deg,rgb(from var(--corvaui-background) r g b/1) 0,rgb(from var(--corvaui-background) r g b/0) 100%);content:"";height:8px;inset:auto 10px 0 0;position:absolute;z-index:1}.Autocomplete_paper__Vq6DC:has(.Autocomplete_sticky__0-eTa){padding-top:8px}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox{flex:0 1 auto;max-height:unset;padding:8px 0}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox,.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox li{width:100%}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox:has(.Autocomplete_sticky__0-eTa){padding-top:0}.Autocomplete_paper__Vq6DC li.MuiAutocomplete-option{background:var(--corvaui-background)!important;display:block;padding:0 16px!important;z-index:1}.Autocomplete_paper__Vq6DC li.MuiAutocomplete-option[data-focus=true] .Autocomplete_menuItem__c2Qka{background-color:rgb(from var(--palette-primary-text-1) r g b/.08)}.Autocomplete_paper__Vq6DC li.MuiAutocomplete-option:has(.Autocomplete_sticky__0-eTa){left:0;position:sticky;top:0}.Autocomplete_paper__Vq6DC .Autocomplete_sticky__0-eTa{border-bottom:1px solid rgb(from var(--palette-primary-text-1) r g b/.25);overflow:visible}.Autocomplete_paper__Vq6DC .Autocomplete_listboxScrolled__n34NV .Autocomplete_sticky__0-eTa:after{background:linear-gradient(0deg,rgb(from var(--corvaui-background) r g b/0) 0,rgb(from var(--corvaui-background) r g b/1) 100%);content:"";height:8px;inset:100% 0 auto 0;margin-top:1px;position:absolute}.Autocomplete_paper__Vq6DC .MuiAutocomplete-noOptions{align-items:center;color:var(--palette-primary-text-6);display:flex;font-size:12px;font-style:italic;justify-content:center;min-height:31px;padding:0}.Autocomplete_paper__Vq6DC .MuiAutocomplete-groupLabel{background:var(--corvaui-background)!important;color:var(--palette-primary-text-7);font-size:12px;font-weight:400;line-height:16px}.Autocomplete_paper__Vq6DC .MuiAutocomplete-groupLabel:not(:empty){padding-top:8px}.Autocomplete_paper__Vq6DC .MuiAutocomplete-listbox li+li .MuiAutocomplete-groupLabel:not(:empty){margin-top:8px}.Autocomplete_checkboxSmall__TjdiN{margin-right:-8px}.Autocomplete_checkboxMedium__LUbff{margin-right:-12px}.Autocomplete_selectedValue__iGHNh{max-width:100%;overflow:hidden}.Autocomplete_selectedValueChip__5QOEK{flex:0 0 auto;margin:-3px 0;max-width:calc(33% - 8px)}.Autocomplete_inputContainer__RKk5j{flex-wrap:wrap;position:relative;row-gap:14px}.Autocomplete_inputContainer__RKk5j .Autocomplete_selectedValue__iGHNh{font-size:inherit;line-height:inherit;max-width:50%}.Autocomplete_prefix__WzSbL{display:contents}.Autocomplete_input__FHTVO{flex:1 1;max-width:100%;min-width:150px}.Autocomplete_withArrow__pNaNX .Autocomplete_input__FHTVO,.Autocomplete_withClear__RGtWV .Autocomplete_input__FHTVO{padding-right:24px}.Autocomplete_withArrow__pNaNX.Autocomplete_withClear__RGtWV .Autocomplete_input__FHTVO{padding-right:48px}.Autocomplete_suffix__y3P7i{bottom:calc(var(--corvaui-textinput-inputheight)/2 + 6px);height:var(--corvaui-textinput-inputheight);position:absolute;right:7px;transform:translateY(50%)}.Autocomplete_readOnlyInput__mD5xQ{cursor:inherit}');export{o as default};
|
|
2
2
|
//# sourceMappingURL=Autocomplete.scss.js.map
|
package/mcp-server/server.mjs
CHANGED