@chayns-components/core 5.0.0-beta.236 → 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.
|
@@ -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":";;;;;;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,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,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;
|
|
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,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,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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\
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA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AAW,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.
|
|
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": "
|
|
68
|
+
"gitHead": "f06c5cafbfb258baea4f1d18b2af19c2a1328872"
|
|
69
69
|
}
|