@chayns-components/emoji-input 5.0.0-beta.128 → 5.0.0-beta.129
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/lib/components/emoji-input/EmojiInput.styles.js +4 -0
- package/lib/components/emoji-input/EmojiInput.styles.js.map +1 -1
- package/lib/constants/regex.d.ts +0 -1
- package/lib/constants/regex.js +3 -5
- package/lib/constants/regex.js.map +1 -1
- package/lib/utils/text.js +1 -10
- package/lib/utils/text.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiInput.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_font","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledEmojiInput","styled","div","_ref","theme","_ref2","isDisabled","_ref3","exports","StyledEmojiInputContent","_ref4","isRightElementGiven","css","StyledEmojiInputEditor","_ref5","text","getFontFamily","_ref6","placeholder","_ref7","_ref8","_ref9","StyledEmojiInputRightWrapper"],"sources":["../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css } from 'styled-components';\nimport { getFontFamily } from '../../utils/font';\nimport type { EmojiInputProps } from './EmojiInput';\n\ntype StyledEmojiInputProps = WithTheme<Pick<EmojiInputProps, 'isDisabled'>>;\n\nexport const StyledEmojiInput = styled.div<StyledEmojiInputProps>`\n align-items: center;\n background-color: ${({ theme }: StyledEmojiInputProps) => theme['100']};\n border-radius: 3px;\n display: flex;\n min-height: 42px;\n opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)};\n pointer-events: ${({ isDisabled }) => (isDisabled ? 'none' : 'initial')};\n position: relative;\n transition: opacity 0.3s ease;\n`;\n\ntype StyledEmojiInputContentProps = {\n isRightElementGiven: boolean;\n};\n\nexport const StyledEmojiInputContent = styled.div<StyledEmojiInputContentProps>`\n align-items: end;\n border: 1px solid rgba(160, 160, 160, 0.3);\n border-radius: 3px;\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n padding: 8px 10px;\n\n ${({ isRightElementGiven }) =>\n isRightElementGiven &&\n css`\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right-width: 0;\n `}\n`;\n\ntype StyledEmojiInputEditorProps = WithTheme<Pick<EmojiInputProps, 'placeholder'>>;\n\nexport const StyledEmojiInputEditor = styled.div<StyledEmojiInputEditorProps>`\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme.text};\n flex: 1 1 auto;\n font-family: ${getFontFamily};\n max-height: 210px;\n overflow-y: scroll;\n word-break: break-word;\n\n // This fixes a bug where the field is not editable in certain browsers.\n // This is for example the case on iOS 15 or older.\n -webkit-user-modify: read-write;\n -webkit-user-select: text;\n\n &:empty:not(:focus):before {\n content: '${({ placeholder }) => placeholder}';\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme['006']};\n pointer-events: none;\n }\n\n lc_mention {\n font-weight: bold;\n }\n\n // Styles for custom scrollbar\n ::-webkit-scrollbar {\n width: 5px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: rgba(\n ${({ theme }: StyledEmojiInputEditorProps) => theme['text-rgb']},\n 0.15\n );\n border-radius: 20px;\n }\n\n // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are\n // only supported in Firefox:\n * {\n scrollbar-color: rgba(\n ${({ theme }: StyledEmojiInputEditorProps) => theme['text-rgb']},\n 0.15\n )\n transparent;\n scrollbar-width: thin;\n }\n`;\n\nexport const StyledEmojiInputRightWrapper = styled.div`\n align-self: stretch;\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n flex: 0 0 auto;\n overflow: hidden;\n`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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcgB,KAAA;EAAA,IAAC;IAAEhB;EAAmC,CAAC,GAAAgB,KAAA;EAAA,OAAKhB,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBiB,KAAA;EAAA,IAAC;IAAEjB;EAAmC,CAAC,GAAAiB,KAAA;EAAA,OAAKjB,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAChF;AACA;AACA;AACA;AACA;AACA,CAAC;AAACI,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AAEK,MAAMS,4BAA4B,GAAGrB,yBAAM,CAACC,GAAI;AACvD;AACA;AACA;AACA;AACA;AACA,CAAC;AAACM,OAAA,CAAAc,4BAAA,GAAAA,4BAAA"}
|
|
1
|
+
{"version":3,"file":"EmojiInput.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_font","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledEmojiInput","styled","div","_ref","theme","_ref2","isDisabled","_ref3","exports","StyledEmojiInputContent","_ref4","isRightElementGiven","css","StyledEmojiInputEditor","_ref5","text","getFontFamily","_ref6","placeholder","_ref7","_ref8","_ref9","StyledEmojiInputRightWrapper"],"sources":["../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css } from 'styled-components';\nimport { getFontFamily } from '../../utils/font';\nimport type { EmojiInputProps } from './EmojiInput';\n\ntype StyledEmojiInputProps = WithTheme<Pick<EmojiInputProps, 'isDisabled'>>;\n\nexport const StyledEmojiInput = styled.div<StyledEmojiInputProps>`\n align-items: center;\n background-color: ${({ theme }: StyledEmojiInputProps) => theme['100']};\n border-radius: 3px;\n display: flex;\n min-height: 42px;\n opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)};\n pointer-events: ${({ isDisabled }) => (isDisabled ? 'none' : 'initial')};\n position: relative;\n transition: opacity 0.3s ease;\n`;\n\ntype StyledEmojiInputContentProps = {\n isRightElementGiven: boolean;\n};\n\nexport const StyledEmojiInputContent = styled.div<StyledEmojiInputContentProps>`\n align-items: end;\n border: 1px solid rgba(160, 160, 160, 0.3);\n border-radius: 3px;\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n padding: 8px 10px;\n\n ${({ isRightElementGiven }) =>\n isRightElementGiven &&\n css`\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right-width: 0;\n `}\n`;\n\ntype StyledEmojiInputEditorProps = WithTheme<Pick<EmojiInputProps, 'placeholder'>>;\n\nexport const StyledEmojiInputEditor = styled.div<StyledEmojiInputEditorProps>`\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme.text};\n flex: 1 1 auto;\n font-family: ${getFontFamily};\n max-height: 210px;\n overflow-y: scroll;\n word-break: break-word;\n\n // This fixes a bug where the field is not editable in certain browsers.\n // This is for example the case on iOS 15 or older.\n -webkit-user-modify: read-write;\n -webkit-user-select: text;\n\n &:empty:not(:focus):before {\n content: '${({ placeholder }) => placeholder}';\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme['006']};\n pointer-events: none;\n }\n\n lc_mention {\n font-weight: bold;\n\n span {\n opacity: 0.5;\n }\n }\n\n // Styles for custom scrollbar\n ::-webkit-scrollbar {\n width: 5px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: rgba(\n ${({ theme }: StyledEmojiInputEditorProps) => theme['text-rgb']},\n 0.15\n );\n border-radius: 20px;\n }\n\n // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are\n // only supported in Firefox:\n * {\n scrollbar-color: rgba(\n ${({ theme }: StyledEmojiInputEditorProps) => theme['text-rgb']},\n 0.15\n )\n transparent;\n scrollbar-width: thin;\n }\n`;\n\nexport const StyledEmojiInputRightWrapper = styled.div`\n align-self: stretch;\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n flex: 0 0 auto;\n overflow: hidden;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAiD,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,G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AA;EAAA,IAAC;IAAEC;EAAY,CAAC,GAAAD,KAAA;EAAA,OAAKC,WAAW;AAAA,CAAC;AACrD,iBAAiBC,KAAA;EAAA,IAAC;IAAEf;EAAmC,CAAC,GAAAe,KAAA;EAAA,OAAKf,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcgB,KAAA;EAAA,IAAC;IAAEhB;EAAmC,CAAC,GAAAgB,KAAA;EAAA,OAAKhB,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBiB,KAAA;EAAA,IAAC;IAAEjB;EAAmC,CAAC,GAAAiB,KAAA;EAAA,OAAKjB,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAChF;AACA;AACA;AACA;AACA;AACA,CAAC;AAACI,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AAEK,MAAMS,4BAA4B,GAAGrB,yBAAM,CAACC,GAAI;AACvD;AACA;AACA;AACA;AACA;AACA,CAAC;AAACM,OAAA,CAAAc,4BAAA,GAAAA,4BAAA"}
|
package/lib/constants/regex.d.ts
CHANGED
package/lib/constants/regex.js
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.HTML_LC_MENTION_REGEX = exports.BB_LC_MENTION_REGEX =
|
|
7
|
-
const BB_LC_MENTION_REGEX = /\[lc_mention(
|
|
6
|
+
exports.HTML_LC_MENTION_REGEX = exports.BB_LC_MENTION_REGEX = void 0;
|
|
7
|
+
const BB_LC_MENTION_REGEX = /\[lc_mention.+?id="([^"]+?)"](.+?)\[\/lc_mention]/g;
|
|
8
8
|
exports.BB_LC_MENTION_REGEX = BB_LC_MENTION_REGEX;
|
|
9
|
-
const
|
|
10
|
-
exports.BB_LC_MENTION_ID_REGEX = BB_LC_MENTION_ID_REGEX;
|
|
11
|
-
const HTML_LC_MENTION_REGEX = /<lc_mention.+?id="([^"]+?)">([^<]+?)<\/lc_mention>/g;
|
|
9
|
+
const HTML_LC_MENTION_REGEX = /<lc_mention.+?id="([^"]+?)">(?:<span.*?<\/span>)*(.+?)<\/lc_mention>/g;
|
|
12
10
|
exports.HTML_LC_MENTION_REGEX = HTML_LC_MENTION_REGEX;
|
|
13
11
|
//# sourceMappingURL=regex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.js","names":["BB_LC_MENTION_REGEX","exports","
|
|
1
|
+
{"version":3,"file":"regex.js","names":["BB_LC_MENTION_REGEX","exports","HTML_LC_MENTION_REGEX"],"sources":["../../src/constants/regex.ts"],"sourcesContent":["export const BB_LC_MENTION_REGEX = /\\[lc_mention.+?id=\"([^\"]+?)\"](.+?)\\[\\/lc_mention]/g;\n\nexport const HTML_LC_MENTION_REGEX =\n /<lc_mention.+?id=\"([^\"]+?)\">(?:<span.*?<\\/span>)*(.+?)<\\/lc_mention>/g;\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAG,oDAAoD;AAACC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AAEjF,MAAME,qBAAqB,GAC9B,uEAAuE;AAACD,OAAA,CAAAC,qBAAA,GAAAA,qBAAA"}
|
package/lib/utils/text.js
CHANGED
|
@@ -5,18 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.convertQuotes = exports.convertHTMLToBBCodes = exports.convertBBCodesToHTML = void 0;
|
|
7
7
|
var _regex = require("../constants/regex");
|
|
8
|
-
const replaceWithLcMentionHTML = (lcMention, text) => {
|
|
9
|
-
let attributes = '';
|
|
10
|
-
const idMatches = lcMention.match(_regex.BB_LC_MENTION_ID_REGEX);
|
|
11
|
-
const match = idMatches === null || idMatches === void 0 ? void 0 : idMatches[1];
|
|
12
|
-
if (match) {
|
|
13
|
-
attributes += `id="${match}"`;
|
|
14
|
-
}
|
|
15
|
-
return `<lc_mention contenteditable="false" ${attributes}>${text}</lc_mention>`;
|
|
16
|
-
};
|
|
17
8
|
const convertBBCodesToHTML = text => {
|
|
18
9
|
let result = text;
|
|
19
|
-
result = result.replace(_regex.BB_LC_MENTION_REGEX,
|
|
10
|
+
result = result.replace(_regex.BB_LC_MENTION_REGEX, '<lc_mention contenteditable="false" id="$1"><span>@</span>$2</lc_mention>');
|
|
20
11
|
return result;
|
|
21
12
|
};
|
|
22
13
|
exports.convertBBCodesToHTML = convertBBCodesToHTML;
|
package/lib/utils/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":["_regex","require","
|
|
1
|
+
{"version":3,"file":"text.js","names":["_regex","require","convertBBCodesToHTML","text","result","replace","BB_LC_MENTION_REGEX","exports","convertHTMLToBBCodes","HTML_LC_MENTION_REGEX","convertQuotes","regexForQuotes","regexForQuoteStart","formattedQuotes","match","startsWith","String","fromCharCode"],"sources":["../../src/utils/text.ts"],"sourcesContent":["import { BB_LC_MENTION_REGEX, HTML_LC_MENTION_REGEX } from '../constants/regex';\n\nexport const convertBBCodesToHTML = (text: string) => {\n let result = text;\n\n result = result.replace(\n BB_LC_MENTION_REGEX,\n '<lc_mention contenteditable=\"false\" id=\"$1\"><span>@</span>$2</lc_mention>'\n );\n\n return result;\n};\n\nexport const convertHTMLToBBCodes = (text: string) => {\n let result = text;\n\n result = result.replace(HTML_LC_MENTION_REGEX, '[lc_mention id=\"$1\"]$2[/lc_mention]');\n\n return result;\n};\n\nexport const convertQuotes = (text: string) => {\n const regexForQuotes =\n /(?<=[\\s<>]|^)(\"(?=\\w)|(?<=\\w)\")(?=[\\s<>]|$)|(?<=[^\\w\\s\\u{1F000}-\\u{1F9FF}])(?![^<]*>)(\"(?![^<]*>[^<]*<\\/lc_mention>)(?=\\w)|(?<=[^\\w\\s\\u{1F000}-\\u{1F9FF}])(?![^<]*>)(\"(?![^<]*>[^<]*<\\/lc_mention>)(?=\\^)|(?<=[^\\w\\s\\u{1F000}-\\u{1F9FF}])(?![^<]*>)(\"(?![^<]*>[^<]*<\\/lc_mention>)(?<=[^\\w\\s\\u{1F000}-\\u{1F9FF}]))))/gu;\n\n const regexForQuoteStart = /„(\\s|$)/g;\n\n const formattedQuotes = text.replace(regexForQuotes, (match) => {\n if (match.startsWith(' ') || text.startsWith(match)) {\n return match.startsWith(' ')\n ? ` ${String.fromCharCode(8222)}`\n : String.fromCharCode(8222);\n }\n return String.fromCharCode(8220);\n });\n\n return formattedQuotes.replace(regexForQuoteStart, '\"');\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,oBAAoB,GAAIC,IAAY,IAAK;EAClD,IAAIC,MAAM,GAAGD,IAAI;EAEjBC,MAAM,GAAGA,MAAM,CAACC,OAAO,CACnBC,0BAAmB,EACnB,2EAA2E,CAC9E;EAED,OAAOF,MAAM;AACjB,CAAC;AAACG,OAAA,CAAAL,oBAAA,GAAAA,oBAAA;AAEK,MAAMM,oBAAoB,GAAIL,IAAY,IAAK;EAClD,IAAIC,MAAM,GAAGD,IAAI;EAEjBC,MAAM,GAAGA,MAAM,CAACC,OAAO,CAACI,4BAAqB,EAAE,qCAAqC,CAAC;EAErF,OAAOL,MAAM;AACjB,CAAC;AAACG,OAAA,CAAAC,oBAAA,GAAAA,oBAAA;AAEK,MAAME,aAAa,GAAIP,IAAY,IAAK;EAC3C,MAAMQ,cAAc,GAChB,wTAAwT;EAE5T,MAAMC,kBAAkB,GAAG,UAAU;EAErC,MAAMC,eAAe,GAAGV,IAAI,CAACE,OAAO,CAACM,cAAc,EAAGG,KAAK,IAAK;IAC5D,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAIZ,IAAI,CAACY,UAAU,CAACD,KAAK,CAAC,EAAE;MACjD,OAAOA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,GACrB,IAAGC,MAAM,CAACC,YAAY,CAAC,IAAI,CAAE,EAAC,GAC/BD,MAAM,CAACC,YAAY,CAAC,IAAI,CAAC;IACnC;IACA,OAAOD,MAAM,CAACC,YAAY,CAAC,IAAI,CAAC;EACpC,CAAC,CAAC;EAEF,OAAOJ,eAAe,CAACR,OAAO,CAACO,kBAAkB,EAAE,GAAG,CAAC;AAC3D,CAAC;AAACL,OAAA,CAAAG,aAAA,GAAAA,aAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/emoji-input",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.129",
|
|
4
4
|
"description": "Input field that supports HTML elements and emojis",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chayns",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "d2407a43bc52426e1d39341e53f6a63a76720dab"
|
|
72
72
|
}
|