@chayns-components/core 5.0.0-beta.234 → 5.0.0-beta.237

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.
@@ -25,6 +25,10 @@ export type NumberInputProps = {
25
25
  * Callback function that is called when the input gets out of focus
26
26
  */
27
27
  onNumberChange: (newNumber: number | null) => void;
28
+ /**
29
+ * Whether the input is disabled
30
+ */
31
+ isDisabled?: boolean;
28
32
  };
29
33
  declare const NumberInput: FC<NumberInputProps>;
30
34
  export default NumberInput;
@@ -18,7 +18,8 @@ const NumberInput = _ref => {
18
18
  maxNumber = Infinity,
19
19
  number,
20
20
  placeholder,
21
- onNumberChange
21
+ onNumberChange,
22
+ isDisabled
22
23
  } = _ref;
23
24
  const [stringValue, setStringValue] = (0, _react.useState)('');
24
25
  const handleChange = function () {
@@ -100,7 +101,8 @@ const NumberInput = _ref => {
100
101
  value: stringValue,
101
102
  placeholder: placeholder,
102
103
  onBlur: onBlur,
103
- onFocus: onFocus
104
+ onFocus: onFocus,
105
+ isDisabled: isDisabled
104
106
  });
105
107
  };
106
108
  NumberInput.displayName = 'NumberInput';
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_Input","_interopRequireDefault","_number","_number2","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","NumberInput","_ref","isDecimalInput","isMoneyInput","maxNumber","Infinity","number","placeholder","onNumberChange","stringValue","setStringValue","useState","handleChange","newValue","arguments","length","undefined","parsedValue","parseFloatAndRound","toString","formateNumber","onChange","event","target","value","sanitizedValue","replace","NUMBER_CLEAR_REGEX","trim","DECIMAL_TEST","test","parsedNumber","MONEY_TEST","decimals","INTEGER_TEST","Number","onBlur","onFocus","replaceAll","useEffect","createElement","displayName","_default","exports"],"sources":["../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, useEffect, useState } from 'react';\nimport Input from '../input/Input';\nimport { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST, NUMBER_CLEAR_REGEX } from './constants/number';\nimport { formateNumber, parseFloatAndRound } from './utils/number';\n\nexport type NumberInputProps = {\n /**\n * Whether the user can add decimal places. Enables the user to input a zero as first number\n */\n isDecimalInput?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one leading zero\n */\n isMoneyInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * The number that should be displayed formatted in the input field. NOTE: A zero as number is not allowed\n */\n number: number | null;\n /**\n * The placeholder that should be in the input\n */\n placeholder?: string;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onNumberChange: (newNumber: number | null) => void;\n};\n\nconst NumberInput: FC<NumberInputProps> = ({\n isDecimalInput,\n isMoneyInput,\n maxNumber = Infinity,\n number,\n placeholder,\n onNumberChange,\n}) => {\n const [stringValue, setStringValue] = useState<string>('');\n\n const handleChange = (newValue: number | null = null) => {\n if (typeof newValue !== 'number') {\n setStringValue('');\n\n return;\n }\n\n const parsedValue = parseFloatAndRound({ stringValue: newValue?.toString() });\n\n setStringValue(formateNumber({ number: parsedValue }));\n };\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n const sanitizedValue = newValue\n // Removes everything except numbers and commas (decimals should be indicated with a comma)\n .replace(NUMBER_CLEAR_REGEX, '')\n // Calculations need points for decimal indication\n .replace(',', '.');\n\n if (sanitizedValue.trim().length > 0) {\n // Allows numbers, a comma and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(sanitizedValue)) {\n const parsedNumber = parseFloatAndRound({ stringValue: sanitizedValue });\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue.replace('.', ','));\n\n return;\n }\n\n // Allows numbers, a comma and 2 numbers of decimal places\n if (isMoneyInput && MONEY_TEST.test(sanitizedValue)) {\n const parsedNumber = parseFloatAndRound({\n stringValue: sanitizedValue,\n decimals: 2,\n });\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue.replace('.', ','));\n\n return;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (INTEGER_TEST.test(sanitizedValue)) {\n const parsedNumber = Number(sanitizedValue);\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue);\n }\n } else {\n setStringValue('');\n }\n };\n\n const onBlur = () => {\n const sanitizedValue = stringValue.length === 0 ? '0' : stringValue;\n const parsedValue = parseFloatAndRound({ stringValue: sanitizedValue });\n\n setStringValue(\n stringValue.length === 0\n ? ''\n : formateNumber({\n number: parsedValue,\n })\n );\n\n onNumberChange(parsedValue === 0 ? null : parsedValue);\n };\n\n const onFocus = () => {\n setStringValue(stringValue.replaceAll('.', ''));\n };\n\n useEffect(() => {\n handleChange(number);\n }, [number]);\n\n return (\n <Input\n onChange={onChange}\n value={stringValue}\n placeholder={placeholder}\n onBlur={onBlur}\n onFocus={onFocus}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAmE,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,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,SAAAV,wBAAAM,GAAA,E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,CAAC;AAEDrC,WAAW,CAACyC,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAEzB1C,WAAW;AAAA2C,OAAA,CAAA/D,OAAA,GAAA8D,QAAA"}
1
+ {"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_Input","_interopRequireDefault","_number","_number2","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","NumberInput","_ref","isDecimalInput","isMoneyInput","maxNumber","Infinity","number","placeholder","onNumberChange","isDisabled","stringValue","setStringValue","useState","handleChange","newValue","arguments","length","undefined","parsedValue","parseFloatAndRound","toString","formateNumber","onChange","event","target","value","sanitizedValue","replace","NUMBER_CLEAR_REGEX","trim","DECIMAL_TEST","test","parsedNumber","MONEY_TEST","decimals","INTEGER_TEST","Number","onBlur","onFocus","replaceAll","useEffect","createElement","displayName","_default","exports"],"sources":["../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, useEffect, useState } from 'react';\nimport Input from '../input/Input';\nimport { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST, NUMBER_CLEAR_REGEX } from './constants/number';\nimport { formateNumber, parseFloatAndRound } from './utils/number';\n\nexport type NumberInputProps = {\n /**\n * Whether the user can add decimal places. Enables the user to input a zero as first number\n */\n isDecimalInput?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one leading zero\n */\n isMoneyInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * The number that should be displayed formatted in the input field. NOTE: A zero as number is not allowed\n */\n number: number | null;\n /**\n * The placeholder that should be in the input\n */\n placeholder?: string;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onNumberChange: (newNumber: number | null) => void;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n};\n\nconst NumberInput: FC<NumberInputProps> = ({\n isDecimalInput,\n isMoneyInput,\n maxNumber = Infinity,\n number,\n placeholder,\n onNumberChange,\n isDisabled\n}) => {\n const [stringValue, setStringValue] = useState<string>('');\n\n const handleChange = (newValue: number | null = null) => {\n if (typeof newValue !== 'number') {\n setStringValue('');\n\n return;\n }\n\n const parsedValue = parseFloatAndRound({ stringValue: newValue?.toString() });\n\n setStringValue(formateNumber({ number: parsedValue }));\n };\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n const sanitizedValue = newValue\n // Removes everything except numbers and commas (decimals should be indicated with a comma)\n .replace(NUMBER_CLEAR_REGEX, '')\n // Calculations need points for decimal indication\n .replace(',', '.');\n\n if (sanitizedValue.trim().length > 0) {\n // Allows numbers, a comma and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(sanitizedValue)) {\n const parsedNumber = parseFloatAndRound({ stringValue: sanitizedValue });\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue.replace('.', ','));\n\n return;\n }\n\n // Allows numbers, a comma and 2 numbers of decimal places\n if (isMoneyInput && MONEY_TEST.test(sanitizedValue)) {\n const parsedNumber = parseFloatAndRound({\n stringValue: sanitizedValue,\n decimals: 2,\n });\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue.replace('.', ','));\n\n return;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (INTEGER_TEST.test(sanitizedValue)) {\n const parsedNumber = Number(sanitizedValue);\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue);\n }\n } else {\n setStringValue('');\n }\n };\n\n const onBlur = () => {\n const sanitizedValue = stringValue.length === 0 ? '0' : stringValue;\n const parsedValue = parseFloatAndRound({ stringValue: sanitizedValue });\n\n setStringValue(\n stringValue.length === 0\n ? ''\n : formateNumber({\n number: parsedValue,\n })\n );\n\n onNumberChange(parsedValue === 0 ? null : parsedValue);\n };\n\n const onFocus = () => {\n setStringValue(stringValue.replaceAll('.', ''));\n };\n\n useEffect(() => {\n handleChange(number);\n }, [number]);\n\n return (\n <Input\n onChange={onChange}\n value={stringValue}\n placeholder={placeholder}\n onBlur={onBlur}\n onFocus={onFocus}\n isDisabled={isDisabled}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAmE,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,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,SAAAV,wBAAAM,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAA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,EAAC;MAAET,WAAW,EAAEgB;IAAe,CAAC,CAAC;IAEvEf,cAAc,CACVD,WAAW,CAACM,MAAM,KAAK,CAAC,GAClB,EAAE,GACF,IAAAK,sBAAa,EAAC;MACVf,MAAM,EAAEY;IACZ,CAAC,CACX,CAAC;IAEDV,cAAc,CAACU,WAAW,KAAK,CAAC,GAAG,IAAI,GAAGA,WAAW,CAAC;EAC1D,CAAC;EAED,MAAMoB,OAAO,GAAGA,CAAA,KAAM;IAClB3B,cAAc,CAACD,WAAW,CAAC6B,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;EACnD,CAAC;EAED,IAAAC,gBAAS,EAAC,MAAM;IACZ3B,YAAY,CAACP,MAAM,CAAC;EACxB,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,oBACInC,MAAA,CAAAS,OAAA,CAAA6D,aAAA,CAACnE,MAAA,CAAAM,OAAK;IACF0C,QAAQ,EAAEA,QAAS;IACnBG,KAAK,EAAEf,WAAY;IACnBH,WAAW,EAAEA,WAAY;IACzB8B,MAAM,EAAEA,MAAO;IACfC,OAAO,EAAEA,OAAQ;IACjB7B,UAAU,EAAEA;EAAW,CAC1B,CAAC;AAEV,CAAC;AAEDT,WAAW,CAAC0C,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAEzB3C,WAAW;AAAA4C,OAAA,CAAAhE,OAAA,GAAA+D,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextString.js","names":["_react","_interopRequireWildcard","require","_isTobitEmployee","_TextStringProvider","_utils","_TextString","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TextString","_ref","textString","replacements","childrenTagName","children","textStrings","useContext","TextStringContext","text","useMemo","_textStrings$textStri","value","name","fallback","newValue","forEach","_ref2","replacement","replace","childElement","element","createElement","handleClick","useCallback","event","ctrlKey","isTobitEmployee","then","inGroup","selectLanguageToChange","textstringName","StyledTextString","onClick","displayName","_default","exports"],"sources":["../../../src/components/textstring/TextString.tsx"],"sourcesContent":["import React, {\n createElement,\n FC,\n MouseEventHandler,\n ReactHTML,\n ReactNode,\n useCallback,\n useContext,\n useMemo,\n} from 'react';\nimport { isTobitEmployee } from '../../utils/isTobitEmployee';\nimport { TextStringContext } from '../textstring-provider/TextStringProvider';\nimport { selectLanguageToChange } from '../textstring-provider/utils';\nimport { StyledTextString } from './TextString.styles';\nimport type { ITextstring, TextstringReplacement } from './types';\n\nexport type TextStringProps = {\n /**\n * The element that the text should be displayed in.\n */\n children?: ReactNode;\n /**\n * The tag of the HTML element that the text should be displayed in.\n */\n childrenTagName?: keyof ReactHTML;\n /**\n * A part of the text that should be replaced.\n */\n replacements?: TextstringReplacement[];\n /**\n * The text that should be displayed.\n */\n textString: ITextstring;\n};\n\nconst TextString: FC<TextStringProps> = ({\n textString,\n replacements,\n childrenTagName,\n children,\n}) => {\n const textStrings = useContext(TextStringContext);\n\n const text = useMemo(() => {\n const value = textStrings[textString.name] ?? textString.fallback;\n\n if (!replacements) {\n return value;\n }\n\n let newValue = value;\n\n replacements.forEach(({ replacement, key }) => {\n newValue = newValue.replace(key, replacement);\n });\n\n return newValue;\n }, [replacements, textString, textStrings]);\n\n const childElement = useMemo(() => {\n let element = createElement('', null, children);\n\n if (!children) {\n element = createElement(childrenTagName || 'span', null, text);\n }\n\n return element;\n }, [children, childrenTagName, text]);\n\n const handleClick: MouseEventHandler<HTMLDivElement> = useCallback(\n (event) => {\n if (event.ctrlKey) {\n void isTobitEmployee().then((inGroup) => {\n if (inGroup) {\n selectLanguageToChange({\n textstringName: textString.name,\n });\n }\n });\n }\n },\n [textString.name]\n );\n\n return useMemo(\n () => <StyledTextString onClick={handleClick}>{childElement}</StyledTextString>,\n [childElement, handleClick]\n );\n};\n\nTextString.displayName = 'TextString';\n\nexport default TextString;\n"],"mappings":";;;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IAAIA,KAAK,CAACC,OAAO,EAAE;MACf,KAAK,IAAAC,gCAAe,EAAC,CAAC,CAACC,IAAI,CAAEC,OAAO,IAAK;QACrC,IAAIA,OAAO,EAAE;UACT,IAAAC,6BAAsB,EAAC;YACnBC,cAAc,EAAE7B,UAAU,CAACW;UAC/B,CAAC,CAAC;QACN;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,EACD,CAACX,UAAU,CAACW,IAAI,CACpB,CAAC;EAED,OAAO,IAAAH,cAAO,EACV,mBAAMvC,MAAA,CAAAc,OAAA,CAAAqC,aAAA,CAAC7C,WAAA,CAAAuD,gBAAgB;IAACC,OAAO,EAAEV;EAAY,GAAEH,YAA+B,CAAC,EAC/E,CAACA,YAAY,EAAEG,WAAW,CAC9B,CAAC;AACL,CAAC;AAEDvB,UAAU,CAACkC,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAEvBnC,UAAU;AAAAoC,OAAA,CAAAnD,OAAA,GAAAkD,QAAA"}
1
+ {"version":3,"file":"TextString.js","names":["_react","_interopRequireWildcard","require","_isTobitEmployee","_TextStringProvider","_utils","_TextString","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TextString","_ref","textString","replacements","childrenTagName","children","textStrings","useContext","TextStringContext","text","useMemo","_textStrings$textStri","value","name","fallback","newValue","forEach","_ref2","replacement","replace","childElement","element","createElement","handleClick","useCallback","event","ctrlKey","isTobitEmployee","then","inGroup","selectLanguageToChange","textstringName","StyledTextString","onClick","displayName","_default","exports"],"sources":["../../../src/components/textstring/TextString.tsx"],"sourcesContent":["import React, {\n createElement,\n FC,\n MouseEventHandler,\n ReactHTML,\n ReactNode,\n useCallback,\n useContext,\n useMemo,\n} from 'react';\nimport { isTobitEmployee } from '../../utils/isTobitEmployee';\nimport { TextStringContext } from '../textstring-provider/TextStringProvider';\nimport { selectLanguageToChange } from '../textstring-provider/utils';\nimport { StyledTextString } from './TextString.styles';\nimport type { ITextstring, TextstringReplacement } from './types';\nimport { getTextstringValue } from '../../utils/textstring';\n\nexport type TextStringProps = {\n /**\n * The element that the text should be displayed in.\n */\n children?: ReactNode;\n /**\n * The tag of the HTML element that the text should be displayed in.\n */\n childrenTagName?: keyof ReactHTML;\n /**\n * A part of the text that should be replaced.\n */\n replacements?: TextstringReplacement[];\n /**\n * The text that should be displayed.\n */\n textString: ITextstring;\n};\n\nconst TextString: FC<TextStringProps> = ({\n textString,\n replacements,\n childrenTagName,\n children,\n}) => {\n const textStrings = useContext(TextStringContext);\n\n const text = useMemo(() => {\n const value = textStrings[textString.name] ?? textString.fallback;\n\n if (!replacements) {\n return value;\n }\n\n let newValue = value;\n\n replacements.forEach(({ replacement, key }) => {\n newValue = newValue.replace(key, replacement);\n });\n\n return newValue;\n }, [replacements, textString, textStrings]);\n\n const childElement = useMemo(() => {\n let element = createElement('', null, children);\n\n if (!children) {\n element = createElement(childrenTagName || 'span', null, text);\n }\n\n return element;\n }, [children, childrenTagName, text]);\n\n const handleClick: MouseEventHandler<HTMLDivElement> = useCallback(\n (event) => {\n if (event.ctrlKey) {\n void isTobitEmployee().then((inGroup) => {\n if (inGroup) {\n selectLanguageToChange({\n textstringName: textString.name,\n });\n }\n });\n }\n },\n [textString.name]\n );\n\n return useMemo(\n () => <StyledTextString onClick={handleClick}>{childElement}</StyledTextString>,\n [childElement, handleClick]\n );\n};\n\nTextString.displayName = 'TextString';\n\nexport default TextString;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAUA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAuD,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,O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D,CAACX,UAAU,CAACW,IAAI,CACpB,CAAC;EAED,OAAO,IAAAH,cAAO,EACV,mBAAMvC,MAAA,CAAAc,OAAA,CAAAqC,aAAA,CAAC7C,WAAA,CAAAuD,gBAAgB;IAACC,OAAO,EAAEV;EAAY,GAAEH,YAA+B,CAAC,EAC/E,CAACA,YAAY,EAAEG,WAAW,CAC9B,CAAC;AACL,CAAC;AAEDvB,UAAU,CAACkC,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAEvBnC,UAAU;AAAAoC,OAAA,CAAAnD,OAAA,GAAAkD,QAAA"}
package/lib/index.d.ts CHANGED
@@ -42,6 +42,7 @@ export { default as TextArea } from './components/text-area/TextArea';
42
42
  export { default as TextStringProvider } from './components/textstring-provider/TextStringProvider';
43
43
  export { default as TextString } from './components/textstring/TextString';
44
44
  export type { ITextstring as Textstring, TextstringReplacement, } from './components/textstring/types';
45
+ export { getTextstringValue } from './utils/textstring';
45
46
  export { default as Tooltip } from './components/tooltip/Tooltip';
46
47
  export type { FileItem, Image, Meta, Video } from './types/file';
47
48
  export { selectFiles } from './utils/fileDialog';
package/lib/index.js CHANGED
@@ -243,6 +243,12 @@ Object.defineProperty(exports, "Tooltip", {
243
243
  return _Tooltip.default;
244
244
  }
245
245
  });
246
+ Object.defineProperty(exports, "getTextstringValue", {
247
+ enumerable: true,
248
+ get: function () {
249
+ return _textstring.getTextstringValue;
250
+ }
251
+ });
246
252
  Object.defineProperty(exports, "isTobitEmployee", {
247
253
  enumerable: true,
248
254
  get: function () {
@@ -298,6 +304,7 @@ var _SmallWaitCursor = _interopRequireWildcard(require("./components/small-wait-
298
304
  var _TextArea = _interopRequireDefault(require("./components/text-area/TextArea"));
299
305
  var _TextStringProvider = _interopRequireDefault(require("./components/textstring-provider/TextStringProvider"));
300
306
  var _TextString = _interopRequireDefault(require("./components/textstring/TextString"));
307
+ var _textstring = require("./utils/textstring");
301
308
  var _Tooltip = _interopRequireDefault(require("./components/tooltip/Tooltip"));
302
309
  var _fileDialog = require("./utils/fileDialog");
303
310
  var _isTobitEmployee = require("./utils/isTobitEmployee");
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FilterButton","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_NumberInput","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_TextStringProvider","_TextString","_Tooltip","_fileDialog","_isTobitEmployee","_uploadFile","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { WithTheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as DateInfo } from './components/date-info/DateInfo';\nexport { default as FilterButton } from './components/filter-button/FilterButton';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-button/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as Popup } from './components/popup/Popup';\nexport type { PopupRef } from './components/popup/types';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as TextStringProvider } from './components/textstring-provider/TextStringProvider';\nexport { default as TextString } from './components/textstring/TextString';\nexport type {\n ITextstring as Textstring,\n TextstringReplacement,\n} from './components/textstring/types';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport type { FileItem, Image, Meta, Video } from './types/file';\nexport { selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './ut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T,wBAAAa,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,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAAA,SAAAtD,uBAAAgD,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
1
+ {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FilterButton","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_NumberInput","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_TextStringProvider","_TextString","_textstring","_Tooltip","_fileDialog","_isTobitEmployee","_uploadFile","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { WithTheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as DateInfo } from './components/date-info/DateInfo';\nexport { default as FilterButton } from './components/filter-button/FilterButton';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-button/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as Popup } from './components/popup/Popup';\nexport type { PopupRef } from './components/popup/types';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as TextStringProvider } from './components/textstring-provider/TextStringProvider';\nexport { default as TextString } from './components/textstring/TextString';\nexport type {\n ITextstring as Textstring,\n TextstringReplacement,\n} from './components/textstring/types';\nexport { getTextstringValue } from './utils/textstring';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport type { FileItem, Image, Meta, Video } from './types/file';\nexport { selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAAA,SAAAvD,uBAAAiD,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -0,0 +1,6 @@
1
+ import type { ITextstring, TextstringReplacement } from '../components/textstring/types';
2
+ export interface GetTextstringValue {
3
+ textString: ITextstring;
4
+ replacements?: TextstringReplacement[];
5
+ }
6
+ export declare const getTextstringValue: ({ replacements, textString }: GetTextstringValue) => string;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTextstringValue = void 0;
7
+ var _react = require("react");
8
+ var _TextStringProvider = require("../components/textstring-provider/TextStringProvider");
9
+ const getTextstringValue = _ref => {
10
+ var _textStrings$textStri;
11
+ let {
12
+ replacements,
13
+ textString
14
+ } = _ref;
15
+ // Ignore rule to get the textstrings from the library
16
+ // eslint-disable-next-line react-hooks/rules-of-hooks
17
+ const textStrings = (0, _react.useContext)(_TextStringProvider.TextStringContext);
18
+ const value = (_textStrings$textStri = textStrings[textString.name]) !== null && _textStrings$textStri !== void 0 ? _textStrings$textStri : textString.fallback;
19
+ if (!replacements) {
20
+ return value;
21
+ }
22
+ let newValue = value;
23
+ replacements.forEach(_ref2 => {
24
+ let {
25
+ replacement,
26
+ key
27
+ } = _ref2;
28
+ newValue = newValue.replace(key, replacement);
29
+ });
30
+ return newValue;
31
+ };
32
+ exports.getTextstringValue = getTextstringValue;
33
+ //# sourceMappingURL=textstring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textstring.js","names":["_react","require","_TextStringProvider","getTextstringValue","_ref","_textStrings$textStri","replacements","textString","textStrings","useContext","TextStringContext","value","name","fallback","newValue","forEach","_ref2","replacement","key","replace","exports"],"sources":["../../src/utils/textstring.ts"],"sourcesContent":["import type { ITextstring, TextstringReplacement } from '../components/textstring/types';\nimport { useContext } from 'react';\nimport { TextStringContext } from '../components/textstring-provider/TextStringProvider';\n\nexport interface GetTextstringValue {\n textString: ITextstring;\n replacements?: TextstringReplacement[];\n}\n\nexport const getTextstringValue = ({ replacements, textString }: GetTextstringValue) => {\n // Ignore rule to get the textstrings from the library\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const textStrings = useContext(TextStringContext);\n\n const value = textStrings[textString.name] ?? textString.fallback;\n\n if (!replacements) {\n return value;\n }\n\n let newValue = value;\n\n replacements.forEach(({ replacement, key }) => {\n newValue = newValue.replace(key, replacement);\n });\n\n return newValue;\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAOO,MAAME,kBAAkB,GAAGC,IAAA,IAAsD;EAAA,IAAAC,qBAAA;EAAA,IAArD;IAAEC,YAAY;IAAEC;EAA+B,CAAC,GAAAH,IAAA;EAC/E;EACA;EACA,MAAMI,WAAW,GAAG,IAAAC,iBAAU,EAACC,qCAAiB,CAAC;EAEjD,MAAMC,KAAK,IAAAN,qBAAA,GAAGG,WAAW,CAACD,UAAU,CAACK,IAAI,CAAC,cAAAP,qBAAA,cAAAA,qBAAA,GAAIE,UAAU,CAACM,QAAQ;EAEjE,IAAI,CAACP,YAAY,EAAE;IACf,OAAOK,KAAK;EAChB;EAEA,IAAIG,QAAQ,GAAGH,KAAK;EAEpBL,YAAY,CAACS,OAAO,CAACC,KAAA,IAA0B;IAAA,IAAzB;MAAEC,WAAW;MAAEC;IAAI,CAAC,GAAAF,KAAA;IACtCF,QAAQ,GAAGA,QAAQ,CAACK,OAAO,CAACD,GAAG,EAAED,WAAW,CAAC;EACjD,CAAC,CAAC;EAEF,OAAOH,QAAQ;AACnB,CAAC;AAACM,OAAA,CAAAjB,kBAAA,GAAAA,kBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.234",
3
+ "version": "5.0.0-beta.237",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "keywords": [
6
6
  "chayns",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "9596201399ec25c63a018a2282ed1a9e55d96472"
68
+ "gitHead": "f06c5cafbfb258baea4f1d18b2af19c2a1328872"
69
69
  }