@corva/ui 3.74.1 → 3.74.2
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/cjs-bundle/components/UserMention/index.js +1 -1
- package/cjs-bundle/components/UserMention/index.js.map +1 -1
- package/components/UserMention/index.js +1 -1
- package/components/UserMention/index.js.map +1 -1
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("react"),o=require("lodash"),t=require("prop-types"),i=require("@material-ui/core/styles"),n=require("react-mentions"),s=require("@material-ui/core/colors/blue"),a=require("./utils/index.js"),l=require("../../utils/links.js"),u=require("./constants.js"),c=require("./style.css.js"),d=require("../Avatar/index.js");require("../../permissions/PermissionsContext.js");var p=require("../../permissions/constants/index.js");require("@babel/runtime/helpers/slicedToArray");var f=require("../../permissions/withPermissionsHOC.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("../../clients/jsonApi/index.js"),require("../../permissions/ProvidePermissions.js");var g=require("react/jsx-runtime");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=m(e),h=m(t);function v(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),o.push.apply(o,t)}return o}function y(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?v(Object(o),!0).forEach((function(r){b.default(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var j={backgroundColor:m(s).default[100]},_={color:"#00bcd4"},q={color:"var(--palette-info-light)",backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.04)",outline:"1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)",borderRadius:"4px"},P
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("react"),o=require("lodash"),t=require("prop-types"),i=require("@material-ui/core/styles"),n=require("react-mentions"),s=require("@material-ui/core/colors/blue"),a=require("./utils/index.js"),l=require("../../utils/links.js"),u=require("./constants.js"),c=require("./style.css.js"),d=require("../Avatar/index.js");require("../../permissions/PermissionsContext.js");var p=require("../../permissions/constants/index.js");require("@babel/runtime/helpers/slicedToArray");var f=require("../../permissions/withPermissionsHOC.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("../../clients/jsonApi/index.js"),require("../../permissions/ProvidePermissions.js");var g=require("react/jsx-runtime");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=m(e),h=m(t);function v(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),o.push.apply(o,t)}return o}function y(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?v(Object(o),!0).forEach((function(r){b.default(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var j={backgroundColor:m(s).default[100]},_={color:"#00bcd4"},q={color:"var(--palette-info-light)",backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.04)",outline:"1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)",borderRadius:"4px"},P=/(?!)/,w=[],x={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},O=y(y({},x),{},{input:{color:"#fff",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),C=y(y({},x),{},{input:{color:"#000"}}),S=function(e){var t=e.onChange,i=void 0===t?R:t,s=e.singleLine,p=void 0!==s&&s,f=e.suggestionsPortalHost,m=void 0===f?null:f,b=e.value,h=void 0===b?"":b,v=e.inputRef,x=void 0===v?null:v,S=e.classes,K=e.style,L=void 0===K?k:K,I=e.withLightTheme,D=void 0!==I&&I,F=e.placeholder,H=void 0===F?"Mention people using '@'":F,V=e.onMount,B=void 0===V?U:V,Q=e.onKeyDown,z=void 0===Q?E:Q,G=e.onKeyUp,J=void 0===G?M:G,W=e.onFocus,X=void 0===W?N:W,Y=e.onBlur,Z=void 0===Y?T:Y,$=e.autoFocus,ee=void 0===$||$,re=e.disabled,oe=void 0!==re&&re,te=e.companyId,ie=void 0===te?null:te,ne=e.currentUser,se=void 0===ne?null:ne,ae=e.isCompanySelectVisible,le=e.mentionProps,ue=void 0===le?A:le,ce=e.allowSuggestionsAboveCursor,de=void 0!==ce&&ce,pe=e.allowEmptyQuery,fe=void 0!==pe&&pe,ge=e.highlightLinks,me=void 0!==ge&≥r.useEffect(B,[]);var be=r.useCallback(o.debounce((function(e,r){var o=ae&&se&&se.company_id!==ie?[se.company_id,ie]:null;a.handleFetchUsers(e,r,o,fe)}),400),[ie,fe]),he=y(y({},D?C:O),L);if(me){var ve,ye=null===(ve=he.input)||void 0===ve?void 0:ve.color;he.input=y(y({caretColor:ye},he.input),{},{color:"transparent"}),he.highlighter=y(y({color:ye},he.highlighter),{},{substring:{visibility:"visible"}})}return g.jsxs(n.MentionsInput,{value:h,onChange:function(e,r){i(r)},singleLine:p,allowSpaceInQuery:!0,classNames:c,placeholder:H,suggestionsPortalHost:m,inputRef:x,style:he,onKeyDown:z,onKeyUp:J,autoFocus:ee,onFocus:X,onBlur:Z,disabled:oe,allowSuggestionsAboveCursor:de,children:[g.jsx(n.Mention,y({markup:u.USER_MARKUP,renderSuggestion:function(e){return function(e,r){return g.jsxs("div",{className:c.mention__suggestion,children:[g.jsx(d.AvatarComponent,{alt:e.display,displayName:e.display,className:r.avatar,imgSrc:e.photo}),g.jsxs("div",{className:c.mention__suggestion__info,children:[g.jsx("span",{"data-testid":"".concat("userMention","_name_").concat(e.display),className:c.mention__suggestion__info__name,children:e.display}),e.title&&g.jsx("span",{className:c.mention__suggestion__info__group,children:e.title})]})]})}(e,S)},trigger:"@",data:be,displayTransform:function(e,r){return"@".concat(r)},style:D?j:_,appendSpaceOnAdd:!0},ue)),me&&g.jsx(n.Mention,{markup:u.LINK_MARKUP,regex:l.URL_CAPTURE_PATTERN,trigger:P,data:w,displayTransform:function(e){return e},style:q})]})};S.propTypes={onChange:h.default.func,singleLine:h.default.bool,suggestionsPortalHost:h.default.shape({current:h.default.instanceOf(Element)}),value:h.default.string,inputRef:h.default.shape({}),classes:h.default.shape({avatar:h.default.string.isRequired}).isRequired,withLightTheme:h.default.bool,placeholder:h.default.string,style:h.default.shape({}),mentionProps:h.default.shape({}),onMount:h.default.func,onKeyDown:h.default.func,onKeyUp:h.default.func,onFocus:h.default.func,onBlur:h.default.func,autoFocus:h.default.bool,disabled:h.default.bool,currentUser:h.default.shape({company_id:h.default.number.isRequired}),companyId:h.default.number,isCompanySelectVisible:h.default.bool.isRequired,allowSuggestionsAboveCursor:h.default.bool,highlightLinks:h.default.bool,allowEmptyQuery:h.default.bool};var R=function(){},k={suggestions:{list:{background:"#414141"},item:{color:"white",height:30,"&focused":{backgroundColor:"rgba(255, 255, 255, 0.08)"}}}},A={},U=function(){},E=function(){},M=function(){},N=function(){},T=function(){},K=f.withPermissionsHOC({isCompanySelectVisible:p.PERMISSIONS.companySelectorView})(i.withStyles({avatar:{height:45,width:45,border:"1.5px solid #fff"}})(S));module.exports=K;
|
|
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';\n\nimport { URL_CAPTURE_PATTERN } from '~/utils/links';\nimport { USER_MARKUP, LINK_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// Matches the mirror token in `LinkedText`, which react-mentions cannot share as a class.\n// Off the palette, not literal white, or the tint vanishes against a light theme.\nconst linkStyle = {\n color: 'var(--palette-info-light)',\n backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.04)',\n // Outline, not border: a border takes space and would shift the text.\n outline: '1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)',\n borderRadius: '4px',\n};\n\n// This mention exists to paint existing text, never to offer a suggestion.\nconst NEVER_TRIGGERS = /$^/;\nconst NO_SUGGESTIONS = [];\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 = DEFAULT_USER_MENTION_ON_CHANGE,\n singleLine = false,\n suggestionsPortalHost = null,\n value = '',\n inputRef = null,\n classes,\n style = DEFAULT_USER_MENTION_STYLE,\n withLightTheme = false,\n placeholder = \"Mention people using '@'\",\n onMount = DEFAULT_USER_MENTION_ON_MOUNT,\n onKeyDown = DEFAULT_USER_MENTION_ON_KEY_DOWN,\n onKeyUp = DEFAULT_USER_MENTION_ON_KEY_UP,\n onFocus = DEFAULT_USER_MENTION_ON_FOCUS,\n onBlur = DEFAULT_USER_MENTION_ON_BLUR,\n autoFocus = true,\n disabled = false,\n companyId = null,\n currentUser = null,\n isCompanySelectVisible,\n mentionProps = DEFAULT_USER_MENTION_MENTION_PROPS,\n allowSuggestionsAboveCursor = false,\n allowEmptyQuery = false,\n highlightLinks = false,\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, allowEmptyQuery);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId, allowEmptyQuery]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = {\n ...(withLightTheme ? lightThemeInputStyles : darkThemeInputStyles),\n ...style,\n };\n\n // react-mentions paints the text in the textarea and keeps the highlighter behind it, so a\n // mention's colour never shows through. Handing the text to the highlighter instead is what\n // lets a link carry the same token as the plain textareas do.\n if (highlightLinks) {\n const textColor = themedStyle.input?.color;\n\n themedStyle.input = { caretColor: textColor, ...themedStyle.input, color: 'transparent' };\n themedStyle.highlighter = {\n color: textColor,\n ...themedStyle.highlighter,\n substring: { visibility: 'visible' },\n };\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\n {/* Highlight only: a `regex` makes react-mentions style matching text without any markup\n of its own, so the url stays exactly as typed in the value it hands back. */}\n {highlightLinks && (\n <Mention\n markup={LINK_MARKUP}\n regex={URL_CAPTURE_PATTERN}\n trigger={NEVER_TRIGGERS}\n data={NO_SUGGESTIONS}\n displayTransform={display => display}\n style={linkStyle}\n />\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 highlightLinks: PropTypes.bool,\n /** Show default users when only \"@\" is typed, instead of waiting for a search term. */\n allowEmptyQuery: PropTypes.bool,\n};\n\nconst DEFAULT_USER_MENTION_ON_CHANGE = () => undefined;\n\nconst DEFAULT_USER_MENTION_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\nconst DEFAULT_USER_MENTION_MENTION_PROPS = {};\nconst DEFAULT_USER_MENTION_ON_MOUNT = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_DOWN = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_UP = () => undefined;\nconst DEFAULT_USER_MENTION_ON_FOCUS = () => undefined;\nconst DEFAULT_USER_MENTION_ON_BLUR = () => undefined;\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","mentionDarkStyle","color","linkStyle","outline","borderRadius","NEVER_TRIGGERS","NO_SUGGESTIONS","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","_ref$onChange","onChange","DEFAULT_USER_MENTION_ON_CHANGE","_ref$singleLine","singleLine","_ref$suggestionsPorta","suggestionsPortalHost","_ref$value","value","_ref$inputRef","inputRef","classes","_ref$style","style","DEFAULT_USER_MENTION_STYLE","_ref$withLightTheme","withLightTheme","_ref$placeholder","placeholder","_ref$onMount","onMount","DEFAULT_USER_MENTION_ON_MOUNT","_ref$onKeyDown","onKeyDown","DEFAULT_USER_MENTION_ON_KEY_DOWN","_ref$onKeyUp","onKeyUp","DEFAULT_USER_MENTION_ON_KEY_UP","_ref$onFocus","onFocus","DEFAULT_USER_MENTION_ON_FOCUS","_ref$onBlur","onBlur","DEFAULT_USER_MENTION_ON_BLUR","_ref$autoFocus","autoFocus","_ref$disabled","disabled","_ref$companyId","companyId","_ref$currentUser","currentUser","isCompanySelectVisible","_ref$mentionProps","mentionProps","DEFAULT_USER_MENTION_MENTION_PROPS","_ref$allowSuggestions","allowSuggestionsAboveCursor","_ref$allowEmptyQuery","allowEmptyQuery","_ref$highlightLinks","highlightLinks","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","_themedStyle$input","textColor","_objectSpread","substring","visibility","_jsxs","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","_jsx","Mention","markup","USER_MARKUP","renderSuggestion","entry","className","mention__suggestion","Avatar","alt","display","displayName","avatar","imgSrc","photo","jsxs","mention__suggestion__info","jsx","concat","mention__suggestion__info__name","title","mention__suggestion__info__group","trigger","data","displayTransform","id","appendSpaceOnAdd","LINK_MARKUP","regex","URL_CAPTURE_PATTERN","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"o9CAiBA,IAUMA,EAAoB,CACxBC,qBAAqB,QAAC,MAElBC,EAAmB,CACvBC,MAAO,WAKHC,EAAY,CAChBD,MAAO,4BACPF,gBAAiB,uDAEjBI,QAAS,iEACTC,aAAc,OAIVC,EAAiB,KACjBC,EAAiB,GAGjBC,EAAc,CAClBC,YAAa,CACXC,KAAM,CACJ,WAAY,CACVV,gBAAiB,0BAMnBW,SACDH,GAAW,CAAA,EAAA,CACdI,MAAO,CACLV,MAAO,OACPW,WAAY,OACZC,OAAQ,GAEVC,YAAa,CACXb,MAAO,UAILc,SACDR,GAAW,CAAA,EAAA,CACdI,MAAO,CAAEV,MAAO,UAyBZe,EAAc,SAwBdC,GAAA,IAAAC,EAAAD,EAvBJE,SAAAA,aAAWC,EAA8BF,EAAAG,EAAAJ,EACzCK,WAAAA,cAAkBD,EAAAE,EAAAN,EAClBO,sBAAAA,aAAwB,KAAID,EAAAE,EAAAR,EAC5BS,MAAAA,aAAQ,GAAED,EAAAE,EAAA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AAA,EACrCxB,EAAgC,WAAe,EAC/CG,EAAmC,WAAe,EAClDG,EAAiC,WAAe,EAChDG,EAAgC,WAAe,EAC/CG,EAA+B,WAAe,EAEpDsF,EAAeC,qBAAmB,CAAE9E,uBAAwB+E,EAAWA,YAACC,qBAAzDF,CACbG,EAAUA,WArPM,CAChBpC,OAAQ,CACN+B,OAAQ,GACRM,MAAO,GACPC,OAAQ,qBAiPVF,CAAsB7H"}
|
|
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';\n\nimport { URL_CAPTURE_PATTERN } from '~/utils/links';\nimport { USER_MARKUP, LINK_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// Matches the mirror token in `LinkedText`, which react-mentions cannot share as a class.\n// Off the palette, not literal white, or the tint vanishes against a light theme.\nconst linkStyle = {\n color: 'var(--palette-info-light)',\n backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.04)',\n // Outline, not border: a border takes space and would shift the text.\n outline: '1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)',\n borderRadius: '4px',\n};\n\n// This mention exists to paint existing text, never to offer a suggestion.\n// `/$^/` looks like it never matches but matches the empty string, and react-mentions then reads\n// capture groups this regex does not have — every caret at the start of an empty composer threw.\nconst NEVER_TRIGGERS = /(?!)/;\nconst NO_SUGGESTIONS = [];\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 = DEFAULT_USER_MENTION_ON_CHANGE,\n singleLine = false,\n suggestionsPortalHost = null,\n value = '',\n inputRef = null,\n classes,\n style = DEFAULT_USER_MENTION_STYLE,\n withLightTheme = false,\n placeholder = \"Mention people using '@'\",\n onMount = DEFAULT_USER_MENTION_ON_MOUNT,\n onKeyDown = DEFAULT_USER_MENTION_ON_KEY_DOWN,\n onKeyUp = DEFAULT_USER_MENTION_ON_KEY_UP,\n onFocus = DEFAULT_USER_MENTION_ON_FOCUS,\n onBlur = DEFAULT_USER_MENTION_ON_BLUR,\n autoFocus = true,\n disabled = false,\n companyId = null,\n currentUser = null,\n isCompanySelectVisible,\n mentionProps = DEFAULT_USER_MENTION_MENTION_PROPS,\n allowSuggestionsAboveCursor = false,\n allowEmptyQuery = false,\n highlightLinks = false,\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, allowEmptyQuery);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId, allowEmptyQuery]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = {\n ...(withLightTheme ? lightThemeInputStyles : darkThemeInputStyles),\n ...style,\n };\n\n // react-mentions paints the text in the textarea and keeps the highlighter behind it, so a\n // mention's colour never shows through. Handing the text to the highlighter instead is what\n // lets a link carry the same token as the plain textareas do.\n if (highlightLinks) {\n const textColor = themedStyle.input?.color;\n\n themedStyle.input = { caretColor: textColor, ...themedStyle.input, color: 'transparent' };\n themedStyle.highlighter = {\n color: textColor,\n ...themedStyle.highlighter,\n substring: { visibility: 'visible' },\n };\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\n {/* Highlight only: a `regex` makes react-mentions style matching text without any markup\n of its own, so the url stays exactly as typed in the value it hands back. */}\n {highlightLinks && (\n <Mention\n markup={LINK_MARKUP}\n regex={URL_CAPTURE_PATTERN}\n trigger={NEVER_TRIGGERS}\n data={NO_SUGGESTIONS}\n displayTransform={display => display}\n style={linkStyle}\n />\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 highlightLinks: PropTypes.bool,\n /** Show default users when only \"@\" is typed, instead of waiting for a search term. */\n allowEmptyQuery: PropTypes.bool,\n};\n\nconst DEFAULT_USER_MENTION_ON_CHANGE = () => undefined;\n\nconst DEFAULT_USER_MENTION_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\nconst DEFAULT_USER_MENTION_MENTION_PROPS = {};\nconst DEFAULT_USER_MENTION_ON_MOUNT = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_DOWN = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_UP = () => undefined;\nconst DEFAULT_USER_MENTION_ON_FOCUS = () => undefined;\nconst DEFAULT_USER_MENTION_ON_BLUR = () => undefined;\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","mentionDarkStyle","color","linkStyle","outline","borderRadius","NEVER_TRIGGERS","NO_SUGGESTIONS","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","_ref$onChange","onChange","DEFAULT_USER_MENTION_ON_CHANGE","_ref$singleLine","singleLine","_ref$suggestionsPorta","suggestionsPortalHost","_ref$value","value","_ref$inputRef","inputRef","classes","_ref$style","style","DEFAULT_USER_MENTION_STYLE","_ref$withLightTheme","withLightTheme","_ref$placeholder","placeholder","_ref$onMount","onMount","DEFAULT_USER_MENTION_ON_MOUNT","_ref$onKeyDown","onKeyDown","DEFAULT_USER_MENTION_ON_KEY_DOWN","_ref$onKeyUp","onKeyUp","DEFAULT_USER_MENTION_ON_KEY_UP","_ref$onFocus","onFocus","DEFAULT_USER_MENTION_ON_FOCUS","_ref$onBlur","onBlur","DEFAULT_USER_MENTION_ON_BLUR","_ref$autoFocus","autoFocus","_ref$disabled","disabled","_ref$companyId","companyId","_ref$currentUser","currentUser","isCompanySelectVisible","_ref$mentionProps","mentionProps","DEFAULT_USER_MENTION_MENTION_PROPS","_ref$allowSuggestions","allowSuggestionsAboveCursor","_ref$allowEmptyQuery","allowEmptyQuery","_ref$highlightLinks","highlightLinks","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","_themedStyle$input","textColor","_objectSpread","substring","visibility","_jsxs","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","_jsx","Mention","markup","USER_MARKUP","renderSuggestion","entry","className","mention__suggestion","Avatar","alt","display","displayName","avatar","imgSrc","photo","jsxs","mention__suggestion__info","jsx","concat","mention__suggestion__info__name","title","mention__suggestion__info__group","trigger","data","displayTransform","id","appendSpaceOnAdd","LINK_MARKUP","regex","URL_CAPTURE_PATTERN","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"o9CAiBA,IAUMA,EAAoB,CACxBC,qBAAqB,QAAC,MAElBC,EAAmB,CACvBC,MAAO,WAKHC,EAAY,CAChBD,MAAO,4B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6E,EAAS,QAACC,KACnB3E,OAAQ0E,EAAS,QAACC,KAClBxE,UAAWuE,EAAS,QAACE,KACrBvE,SAAUqE,EAAS,QAACE,KAEpBnE,YAAaiE,EAAS,QAACG,MAAM,CAC3BlD,WAAY+C,EAAAA,QAAUS,OAAOD,aAE/B3E,UAAWmE,EAAS,QAACS,OACrBzE,uBAAwBgE,EAAAA,QAAUE,KAAKM,WACvCnE,4BAA6B2D,EAAS,QAACE,KACvCzD,eAAgBuD,EAAS,QAACE,KAE1B3D,gBAAiByD,EAAS,QAACE,MAG7B,IAAM1G,EAAiC,WAAe,EAEhDY,EAA6B,CACjCxB,YAAa,CACX8H,KAAM,CACJC,WAAY,WAEd9H,KAAM,CACJR,MAAO,QACPuI,OAAQ,GACR,WAAY,CACVzI,gBAAiB,gCAMnBgE,EAAqC,CAAA,EACrCxB,EAAgC,WAAe,EAC/CG,EAAmC,WAAe,EAClDG,EAAiC,WAAe,EAChDG,EAAgC,WAAe,EAC/CG,EAA+B,WAAe,EAEpDsF,EAAeC,qBAAmB,CAAE9E,uBAAwB+E,EAAWA,YAACC,qBAAzDF,CACbG,EAAUA,WAvPM,CAChBpC,OAAQ,CACN+B,OAAQ,GACRM,MAAO,GACPC,OAAQ,qBAmPVF,CAAsB7H"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"@babel/runtime/helpers/defineProperty";import{useEffect as e,useCallback as r}from"react";import{debounce as i}from"lodash";import n from"prop-types";import{withStyles as t}from"@material-ui/core/styles";import{MentionsInput as s,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import{handleFetchUsers as u}from"./utils/index.js";import{URL_CAPTURE_PATTERN as c}from"../../utils/links.js";import{USER_MARKUP as p,LINK_MARKUP as m}from"./constants.js";import d from"./style.css.js";import{AvatarComponent as g}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 b}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import{jsxs as h,jsx as y}from"react/jsx-runtime";function v(o,e){var r=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.push.apply(r,i)}return r}function j(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?v(Object(i),!0).forEach((function(r){o(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(i,o))}))}return e}var _={backgroundColor:l[100]},w={color:"#00bcd4"},O={color:"var(--palette-info-light)",backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.04)",outline:"1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)",borderRadius:"4px"},P
|
|
1
|
+
import o from"@babel/runtime/helpers/defineProperty";import{useEffect as e,useCallback as r}from"react";import{debounce as i}from"lodash";import n from"prop-types";import{withStyles as t}from"@material-ui/core/styles";import{MentionsInput as s,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import{handleFetchUsers as u}from"./utils/index.js";import{URL_CAPTURE_PATTERN as c}from"../../utils/links.js";import{USER_MARKUP as p,LINK_MARKUP as m}from"./constants.js";import d from"./style.css.js";import{AvatarComponent as g}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 b}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import{jsxs as h,jsx as y}from"react/jsx-runtime";function v(o,e){var r=Object.keys(o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(o);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.push.apply(r,i)}return r}function j(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?v(Object(i),!0).forEach((function(r){o(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(i,o))}))}return e}var _={backgroundColor:l[100]},w={color:"#00bcd4"},O={color:"var(--palette-info-light)",backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.04)",outline:"1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)",borderRadius:"4px"},P=/(?!)/,C=[],x={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},S=j(j({},x),{},{input:{color:"#fff",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),k=j(j({},x),{},{input:{color:"#000"}}),R=function(o){var n=o.onChange,t=void 0===n?A:n,l=o.singleLine,f=void 0!==l&&l,b=o.suggestionsPortalHost,v=void 0===b?null:b,x=o.value,R=void 0===x?"":x,U=o.inputRef,q=void 0===U?null:U,H=o.classes,I=o.style,M=void 0===I?D:I,V=o.withLightTheme,B=void 0!==V&&V,Q=o.placeholder,z=void 0===Q?"Mention people using '@'":Q,G=o.onMount,J=void 0===G?N:G,W=o.onKeyDown,X=void 0===W?T:W,Y=o.onKeyUp,Z=void 0===Y?F:Y,$=o.onFocus,oo=void 0===$?K:$,eo=o.onBlur,ro=void 0===eo?E:eo,io=o.autoFocus,no=void 0===io||io,to=o.disabled,so=void 0!==to&&to,ao=o.companyId,lo=void 0===ao?null:ao,uo=o.currentUser,co=void 0===uo?null:uo,po=o.isCompanySelectVisible,mo=o.mentionProps,go=void 0===mo?L:mo,fo=o.allowSuggestionsAboveCursor,bo=void 0!==fo&&fo,ho=o.allowEmptyQuery,yo=void 0!==ho&&ho,vo=o.highlightLinks,jo=void 0!==vo&&vo;e(J,[]);var _o=r(i((function(o,e){var r=po&&co&&co.company_id!==lo?[co.company_id,lo]:null;u(o,e,r,yo)}),400),[lo,yo]),wo=j(j({},B?k:S),M);if(jo){var Oo,Po=null===(Oo=wo.input)||void 0===Oo?void 0:Oo.color;wo.input=j(j({caretColor:Po},wo.input),{},{color:"transparent"}),wo.highlighter=j(j({color:Po},wo.highlighter),{},{substring:{visibility:"visible"}})}return h(s,{value:R,onChange:function(o,e){t(e)},singleLine:f,allowSpaceInQuery:!0,classNames:d,placeholder:z,suggestionsPortalHost:v,inputRef:q,style:wo,onKeyDown:X,onKeyUp:Z,autoFocus:no,onFocus:oo,onBlur:ro,disabled:so,allowSuggestionsAboveCursor:bo,children:[y(a,j({markup:p,renderSuggestion:function(o){return function(o,e){return h("div",{className:d.mention__suggestion,children:[y(g,{alt:o.display,displayName:o.display,className:e.avatar,imgSrc:o.photo}),h("div",{className:d.mention__suggestion__info,children:[y("span",{"data-testid":"".concat("userMention","_name_").concat(o.display),className:d.mention__suggestion__info__name,children:o.display}),o.title&&y("span",{className:d.mention__suggestion__info__group,children:o.title})]})]})}(o,H)},trigger:"@",data:_o,displayTransform:function(o,e){return"@".concat(e)},style:B?_:w,appendSpaceOnAdd:!0},go)),jo&&y(a,{markup:m,regex:c,trigger:P,data:C,displayTransform:function(o){return o},style:O})]})};R.propTypes={onChange:n.func,singleLine:n.bool,suggestionsPortalHost:n.shape({current:n.instanceOf(Element)}),value:n.string,inputRef:n.shape({}),classes:n.shape({avatar:n.string.isRequired}).isRequired,withLightTheme:n.bool,placeholder:n.string,style:n.shape({}),mentionProps:n.shape({}),onMount:n.func,onKeyDown:n.func,onKeyUp:n.func,onFocus:n.func,onBlur:n.func,autoFocus:n.bool,disabled:n.bool,currentUser:n.shape({company_id:n.number.isRequired}),companyId:n.number,isCompanySelectVisible:n.bool.isRequired,allowSuggestionsAboveCursor:n.bool,highlightLinks:n.bool,allowEmptyQuery:n.bool};var A=function(){},D={suggestions:{list:{background:"#414141"},item:{color:"white",height:30,"&focused":{backgroundColor:"rgba(255, 255, 255, 0.08)"}}}},L={},N=function(){},T=function(){},F=function(){},K=function(){},E=function(){},U=b({isCompanySelectVisible:f.companySelectorView})(t({avatar:{height:45,width:45,border:"1.5px solid #fff"}})(R));export{U 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';\n\nimport { URL_CAPTURE_PATTERN } from '~/utils/links';\nimport { USER_MARKUP, LINK_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// Matches the mirror token in `LinkedText`, which react-mentions cannot share as a class.\n// Off the palette, not literal white, or the tint vanishes against a light theme.\nconst linkStyle = {\n color: 'var(--palette-info-light)',\n backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.04)',\n // Outline, not border: a border takes space and would shift the text.\n outline: '1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)',\n borderRadius: '4px',\n};\n\n// This mention exists to paint existing text, never to offer a suggestion.\nconst NEVER_TRIGGERS = /$^/;\nconst NO_SUGGESTIONS = [];\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 = DEFAULT_USER_MENTION_ON_CHANGE,\n singleLine = false,\n suggestionsPortalHost = null,\n value = '',\n inputRef = null,\n classes,\n style = DEFAULT_USER_MENTION_STYLE,\n withLightTheme = false,\n placeholder = \"Mention people using '@'\",\n onMount = DEFAULT_USER_MENTION_ON_MOUNT,\n onKeyDown = DEFAULT_USER_MENTION_ON_KEY_DOWN,\n onKeyUp = DEFAULT_USER_MENTION_ON_KEY_UP,\n onFocus = DEFAULT_USER_MENTION_ON_FOCUS,\n onBlur = DEFAULT_USER_MENTION_ON_BLUR,\n autoFocus = true,\n disabled = false,\n companyId = null,\n currentUser = null,\n isCompanySelectVisible,\n mentionProps = DEFAULT_USER_MENTION_MENTION_PROPS,\n allowSuggestionsAboveCursor = false,\n allowEmptyQuery = false,\n highlightLinks = false,\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, allowEmptyQuery);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId, allowEmptyQuery]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = {\n ...(withLightTheme ? lightThemeInputStyles : darkThemeInputStyles),\n ...style,\n };\n\n // react-mentions paints the text in the textarea and keeps the highlighter behind it, so a\n // mention's colour never shows through. Handing the text to the highlighter instead is what\n // lets a link carry the same token as the plain textareas do.\n if (highlightLinks) {\n const textColor = themedStyle.input?.color;\n\n themedStyle.input = { caretColor: textColor, ...themedStyle.input, color: 'transparent' };\n themedStyle.highlighter = {\n color: textColor,\n ...themedStyle.highlighter,\n substring: { visibility: 'visible' },\n };\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\n {/* Highlight only: a `regex` makes react-mentions style matching text without any markup\n of its own, so the url stays exactly as typed in the value it hands back. */}\n {highlightLinks && (\n <Mention\n markup={LINK_MARKUP}\n regex={URL_CAPTURE_PATTERN}\n trigger={NEVER_TRIGGERS}\n data={NO_SUGGESTIONS}\n displayTransform={display => display}\n style={linkStyle}\n />\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 highlightLinks: PropTypes.bool,\n /** Show default users when only \"@\" is typed, instead of waiting for a search term. */\n allowEmptyQuery: PropTypes.bool,\n};\n\nconst DEFAULT_USER_MENTION_ON_CHANGE = () => undefined;\n\nconst DEFAULT_USER_MENTION_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\nconst DEFAULT_USER_MENTION_MENTION_PROPS = {};\nconst DEFAULT_USER_MENTION_ON_MOUNT = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_DOWN = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_UP = () => undefined;\nconst DEFAULT_USER_MENTION_ON_FOCUS = () => undefined;\nconst DEFAULT_USER_MENTION_ON_BLUR = () => undefined;\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","blue","mentionDarkStyle","color","linkStyle","outline","borderRadius","NEVER_TRIGGERS","NO_SUGGESTIONS","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","_ref$onChange","onChange","DEFAULT_USER_MENTION_ON_CHANGE","_ref$singleLine","singleLine","_ref$suggestionsPorta","suggestionsPortalHost","_ref$value","value","_ref$inputRef","inputRef","classes","_ref$style","style","DEFAULT_USER_MENTION_STYLE","_ref$withLightTheme","withLightTheme","_ref$placeholder","placeholder","_ref$onMount","onMount","DEFAULT_USER_MENTION_ON_MOUNT","_ref$onKeyDown","onKeyDown","DEFAULT_USER_MENTION_ON_KEY_DOWN","_ref$onKeyUp","onKeyUp","DEFAULT_USER_MENTION_ON_KEY_UP","_ref$onFocus","onFocus","DEFAULT_USER_MENTION_ON_FOCUS","_ref$onBlur","onBlur","DEFAULT_USER_MENTION_ON_BLUR","_ref$autoFocus","autoFocus","_ref$disabled","disabled","_ref$companyId","companyId","_ref$currentUser","currentUser","isCompanySelectVisible","_ref$mentionProps","mentionProps","DEFAULT_USER_MENTION_MENTION_PROPS","_ref$allowSuggestions","allowSuggestionsAboveCursor","_ref$allowEmptyQuery","allowEmptyQuery","_ref$highlightLinks","highlightLinks","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","_themedStyle$input","textColor","_objectSpread","substring","visibility","_jsxs","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","_jsx","Mention","markup","USER_MARKUP","renderSuggestion","entry","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","LINK_MARKUP","regex","URL_CAPTURE_PATTERN","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"2kDAiBA,IAUMA,EAAoB,CACxBC,gBAAiBC,EAAK,MAElBC,EAAmB,CACvBC,MAAO,WAKHC,EAAY,CAChBD,MAAO,4BACPH,gBAAiB,uDAEjBK,QAAS,iEACTC,aAAc,OAIVC,EAAiB,KACjBC,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gBAAiBuD,EAAUE,MAG7B,IAAMxG,EAAiC,WAAe,EAEhDY,EAA6B,CACjCxB,YAAa,CACX4H,KAAM,CACJC,WAAY,WAEd5H,KAAM,CACJR,MAAO,QACPqI,OAAQ,GACR,WAAY,CACVxI,gBAAiB,gCAMnBiE,EAAqC,CAAA,EACrCxB,EAAgC,WAAe,EAC/CG,EAAmC,WAAe,EAClDG,EAAiC,WAAe,EAChDG,EAAgC,WAAe,EAC/CG,EAA+B,WAAe,EAEpDoF,EAAeC,EAAmB,CAAE5E,uBAAwB6E,EAAYC,qBAAzDF,CACbG,EArPgB,CAChBlC,OAAQ,CACN6B,OAAQ,GACRM,MAAO,GACPC,OAAQ,qBAiPVF,CAAsB3H"}
|
|
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';\n\nimport { URL_CAPTURE_PATTERN } from '~/utils/links';\nimport { USER_MARKUP, LINK_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// Matches the mirror token in `LinkedText`, which react-mentions cannot share as a class.\n// Off the palette, not literal white, or the tint vanishes against a light theme.\nconst linkStyle = {\n color: 'var(--palette-info-light)',\n backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.04)',\n // Outline, not border: a border takes space and would shift the text.\n outline: '1px solid rgb(from var(--palette-primary-text-1) r g b / 0.16)',\n borderRadius: '4px',\n};\n\n// This mention exists to paint existing text, never to offer a suggestion.\n// `/$^/` looks like it never matches but matches the empty string, and react-mentions then reads\n// capture groups this regex does not have — every caret at the start of an empty composer threw.\nconst NEVER_TRIGGERS = /(?!)/;\nconst NO_SUGGESTIONS = [];\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 = DEFAULT_USER_MENTION_ON_CHANGE,\n singleLine = false,\n suggestionsPortalHost = null,\n value = '',\n inputRef = null,\n classes,\n style = DEFAULT_USER_MENTION_STYLE,\n withLightTheme = false,\n placeholder = \"Mention people using '@'\",\n onMount = DEFAULT_USER_MENTION_ON_MOUNT,\n onKeyDown = DEFAULT_USER_MENTION_ON_KEY_DOWN,\n onKeyUp = DEFAULT_USER_MENTION_ON_KEY_UP,\n onFocus = DEFAULT_USER_MENTION_ON_FOCUS,\n onBlur = DEFAULT_USER_MENTION_ON_BLUR,\n autoFocus = true,\n disabled = false,\n companyId = null,\n currentUser = null,\n isCompanySelectVisible,\n mentionProps = DEFAULT_USER_MENTION_MENTION_PROPS,\n allowSuggestionsAboveCursor = false,\n allowEmptyQuery = false,\n highlightLinks = false,\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, allowEmptyQuery);\n };\n\n const debouncedUsersFetch = useCallback(debounce(fetchUsers, 400), [companyId, allowEmptyQuery]);\n\n const onInputChange = (event, newValue) => {\n onChange(newValue);\n };\n\n const themedStyle = {\n ...(withLightTheme ? lightThemeInputStyles : darkThemeInputStyles),\n ...style,\n };\n\n // react-mentions paints the text in the textarea and keeps the highlighter behind it, so a\n // mention's colour never shows through. Handing the text to the highlighter instead is what\n // lets a link carry the same token as the plain textareas do.\n if (highlightLinks) {\n const textColor = themedStyle.input?.color;\n\n themedStyle.input = { caretColor: textColor, ...themedStyle.input, color: 'transparent' };\n themedStyle.highlighter = {\n color: textColor,\n ...themedStyle.highlighter,\n substring: { visibility: 'visible' },\n };\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\n {/* Highlight only: a `regex` makes react-mentions style matching text without any markup\n of its own, so the url stays exactly as typed in the value it hands back. */}\n {highlightLinks && (\n <Mention\n markup={LINK_MARKUP}\n regex={URL_CAPTURE_PATTERN}\n trigger={NEVER_TRIGGERS}\n data={NO_SUGGESTIONS}\n displayTransform={display => display}\n style={linkStyle}\n />\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 highlightLinks: PropTypes.bool,\n /** Show default users when only \"@\" is typed, instead of waiting for a search term. */\n allowEmptyQuery: PropTypes.bool,\n};\n\nconst DEFAULT_USER_MENTION_ON_CHANGE = () => undefined;\n\nconst DEFAULT_USER_MENTION_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\nconst DEFAULT_USER_MENTION_MENTION_PROPS = {};\nconst DEFAULT_USER_MENTION_ON_MOUNT = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_DOWN = () => undefined;\nconst DEFAULT_USER_MENTION_ON_KEY_UP = () => undefined;\nconst DEFAULT_USER_MENTION_ON_FOCUS = () => undefined;\nconst DEFAULT_USER_MENTION_ON_BLUR = () => undefined;\n\nexport default withPermissionsHOC({ isCompanySelectVisible: PERMISSIONS.companySelectorView })(\n withStyles(muiStyles)(UserMention)\n);\n"],"names":["mentionLightStyle","backgroundColor","blue","mentionDarkStyle","color","linkStyle","outline","borderRadius","NEVER_TRIGGERS","NO_SUGGESTIONS","inputStyles","suggestions","item","darkThemeInputStyles","input","caretColor","zIndex","highlighter","lightThemeInputStyles","UserMention","_ref","_ref$onChange","onChange","DEFAULT_USER_MENTION_ON_CHANGE","_ref$singleLine","singleLine","_ref$suggestionsPorta","suggestionsPortalHost","_ref$value","value","_ref$inputRef","inputRef","classes","_ref$style","style","DEFAULT_USER_MENTION_STYLE","_ref$withLightTheme","withLightTheme","_ref$placeholder","placeholder","_ref$onMount","onMount","DEFAULT_USER_MENTION_ON_MOUNT","_ref$onKeyDown","onKeyDown","DEFAULT_USER_MENTION_ON_KEY_DOWN","_ref$onKeyUp","onKeyUp","DEFAULT_USER_MENTION_ON_KEY_UP","_ref$onFocus","onFocus","DEFAULT_USER_MENTION_ON_FOCUS","_ref$onBlur","onBlur","DEFAULT_USER_MENTION_ON_BLUR","_ref$autoFocus","autoFocus","_ref$disabled","disabled","_ref$companyId","companyId","_ref$currentUser","currentUser","isCompanySelectVisible","_ref$mentionProps","mentionProps","DEFAULT_USER_MENTION_MENTION_PROPS","_ref$allowSuggestions","allowSuggestionsAboveCursor","_ref$allowEmptyQuery","allowEmptyQuery","_ref$highlightLinks","highlightLinks","useEffect","debouncedUsersFetch","useCallback","debounce","search","callback","companyIds","company_id","handleFetchUsers","themedStyle","_themedStyle$input","textColor","_objectSpread","substring","visibility","_jsxs","MentionsInput","event","newValue","allowSpaceInQuery","classNames","styles","children","_jsx","Mention","markup","USER_MARKUP","renderSuggestion","entry","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","LINK_MARKUP","regex","URL_CAPTURE_PATTERN","propTypes","PropTypes","func","bool","shape","current","instanceOf","Element","string","isRequired","number","list","background","height","UserMention$1","withPermissionsHOC","PERMISSIONS","companySelectorView","withStyles","width","border"],"mappings":"2kDAiBA,IAUMA,EAAoB,CACxBC,gBAAiBC,EAAK,MAElBC,EAAmB,CACvBC,MAAO,WAKHC,EAAY,CAChBD,MAAO,4BACPH,gBAAiB,uDAEjBK,QAAS,iEACTC,aAAc,OAMVC,EAAiB,OACjBC,EAAiB,GAGjBC,EAAc,CAClBC,YAAa,CACXC,KAAM,CACJ,WAAY,CACVX,gBAAiB,0BAMnBY,SACDH,GAAW,CAAA,EAAA,CACdI,MAAO,CACLV,MAAO,OACPW,WAAY,OACZC,OAAQ,GAEVC,YAAa,CACXb,MAAO,UAILc,SACDR,GAAW,CAAA,EAAA,CACdI,MAAO,CAAEV,MAAO,UAyBZe,EAAc,SAwBdC,GAAA,IAAAC,EAAAD,EAvBJE,SAAAA,aAAWC,EAA8BF,EAAAG,EAAAJ,EACzCK,WAAAA,cAAkBD,EAAAE,EAAAN,EAClBO,sBAAAA,aAAwB,KAAID,EAAAE,EAAAR,EAC5BS,MAAAA,aAAQ,GAAED,EAAAE,EAAAV,EACVW,SAAAA,aAAW,KAAID,EACfE,IAAAA,QAAOC,EAAAb,EACPc,MAAAA,aAAQC,EAA0BF,EAAAG,EAAAhB,EAClCiB,eAAAA,cAAsBD,EAAAE,EAAAlB,EACtBmB,YAAAA,aAAc,2BAA0BD,EAAAE,EAAApB,EACxCqB,QAAAA,aAAUC,EAA6BF,EAAAG,EAAAvB,EACvCwB,UAAAA,aAAYC,EAAgCF,EAAAG,EAAA1B,EAC5C2B,QAAAA,aAAUC,EAA8BF,EAAAG,EAAA7B,EACxC8B,QAAAA,cAAUC,EAA6BF,EAAAG,GAAAhC,EACvCiC,OAAAA,eAASC,EAA4BF,GAAAG,GAAAnC,EACrCoC,UAAAA,gBAAgBD,GAAAE,GAAArC,EAChBsC,SAAAA,gBAAgBD,GAAAE,GAAAvC,EAChBwC,UAAAA,eAAY,KAAID,GAAAE,GAAAzC,EAChB0C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