chayns-components
Version:
A set of beautiful React components for developing chayns® applications.
119 lines (111 loc) • 8.54 kB
JavaScript
const chalk = require('chalk');
const boxen = require('boxen');
const LOOKUP_OBJECT = {
"Accordion": "chayns-components/dist/esm/react-chayns-accordion/component/Accordion",
"AccordionIntro": "chayns-components/dist/esm/react-chayns-accordion/component/AccordionIntro",
"AmountControl": "chayns-components/dist/esm/react-chayns-amountcontrol/component/AmountControl",
"AnimationWrapper": "chayns-components/dist/esm/react-chayns-animation_wrapper/component/AnimationWrapper",
"Badge": "chayns-components/dist/esm/react-chayns-badge/component/Badge",
"Bubble": "chayns-components/dist/esm/react-chayns-bubble/component/Bubble",
"Button": "chayns-components/dist/esm/react-chayns-button/component/Button",
"ChooseButton": "chayns-components/dist/esm/react-chayns-button/component/ChooseButton",
"Calendar": "chayns-components/dist/esm/react-chayns-calendar/component/Calendar",
"Checkbox": "chayns-components/dist/esm/react-chayns-checkbox/component/Checkbox",
"ColorArea": "chayns-components/dist/esm/react-chayns-color_picker/component/colorArea/ColorArea",
"ColorInput": "chayns-components/dist/esm/react-chayns-color_picker/component/colorInput/ColorInput",
"ColorPicker": "chayns-components/dist/esm/react-chayns-color_picker/component/ColorPicker",
"HueSlider": "chayns-components/dist/esm/react-chayns-color_picker/component/hueSlider/HueSlider",
"TransparencySlider": "chayns-components/dist/esm/react-chayns-color_picker/component/transparencySlider/TransparencySlider",
"ColorScheme": "chayns-components/dist/esm/react-chayns-color_scheme/component/ColorScheme",
"ComboBox": "chayns-components/dist/esm/react-chayns-combobox/component/ComboBox",
"ContextMenu": "chayns-components/dist/esm/react-chayns-contextmenu/component/ContextMenu",
"DateInfo": "chayns-components/dist/esm/react-chayns-dateinfo/component/DateInfo",
"EmojiInput": "chayns-components/dist/esm/react-chayns-emoji_input/component/EmojiInput",
"ExpandableContent": "chayns-components/dist/esm/react-chayns-expandable_content/component/ExpandableContent",
"FileInput": "chayns-components/dist/esm/react-chayns-file_input/component/FileInput",
"FilterButton": "chayns-components/dist/esm/react-chayns-filterbutton/component/FilterButton",
"FormattedInput": "chayns-components/dist/esm/react-chayns-formatted_input/component/FormattedInput",
"DecimalFormatter": "chayns-components/dist/esm/react-chayns-formatted_input/utils/DecimalFormatter",
"Formatter": "chayns-components/dist/esm/react-chayns-formatted_input/utils/Formatter",
"FORMAT_DECIMAL": "chayns-components/dist/esm/react-chayns-formatted_input/utils/instances/formatDecimal",
"FORMAT_INTEGER": "chayns-components/dist/esm/react-chayns-formatted_input/utils/instances/formatInteger",
"FORMAT_PRICE": "chayns-components/dist/esm/react-chayns-formatted_input/utils/instances/formatPrice",
"IntegerFormatter": "chayns-components/dist/esm/react-chayns-formatted_input/utils/IntegerFormatter",
"PriceFormatter": "chayns-components/dist/esm/react-chayns-formatted_input/utils/PriceFormatter",
"Gallery": "chayns-components/dist/esm/react-chayns-gallery/component/Gallery",
"Image": "chayns-components/dist/esm/react-chayns-gallery/component/Image",
"ImageContainer": "chayns-components/dist/esm/react-chayns-gallery/component/ImageContainer",
"getOrientation": "chayns-components/dist/esm/react-chayns-gallery/utils/getOrientation",
"GridCalendar": "chayns-components/dist/esm/react-chayns-gridcalendar/component/GridCalendar",
"Icon": "chayns-components/dist/esm/react-chayns-icon/component/Icon",
"ImageAccordion": "chayns-components/dist/esm/react-chayns-image_accordion/component/ImageAccordion",
"ImageAccordionGroup": "chayns-components/dist/esm/react-chayns-image_accordion/component/ImageAccordionGroup",
"Input": "chayns-components/dist/esm/react-chayns-input/component/Input",
"List": "chayns-components/dist/esm/react-chayns-list/component/List",
"ListItem": "chayns-components/dist/esm/react-chayns-list/component/ListItem",
"Mode": "chayns-components/dist/esm/react-chayns-modeswitch/component/Mode",
"ModeSwitch": "chayns-components/dist/esm/react-chayns-modeswitch/component/ModeSwitch",
"OpeningTimes": "chayns-components/dist/esm/react-chayns-openingtimes/component/OpeningTimes",
"SimpleWrapperContext": "chayns-components/dist/esm/react-chayns-personfinder/component/data/simpleWrapper/SimpleWrapperContext",
"PersonFinder": "chayns-components/dist/esm/react-chayns-personfinder/component/PersonFinder",
"PositionInput": "chayns-components/dist/esm/react-chayns-position_input/component/PositionInput",
"ProgressBar": "chayns-components/dist/esm/react-chayns-progress_bar/component/ProgressBar",
"RadioButton": "chayns-components/dist/esm/react-chayns-radiobutton/component/RadioButton",
"ReceiverInput": "chayns-components/dist/esm/react-chayns-receiverinput/component/ReceiverInput",
"RfidInput": "chayns-components/dist/esm/react-chayns-rfid_input/component/RfidInput",
"ScrollView": "chayns-components/dist/esm/react-chayns-scrollview/component/ScrollView",
"ResultSelection": "chayns-components/dist/esm/react-chayns-searchbox/component/result-selection/ResultSelection",
"SearchBox": "chayns-components/dist/esm/react-chayns-searchbox/component/SearchBox",
"SelectButton": "chayns-components/dist/esm/react-chayns-selectbutton/component/SelectButton",
"SelectListItem": "chayns-components/dist/esm/react-chayns-selectlist/component/SelectItem",
"SelectList": "chayns-components/dist/esm/react-chayns-selectlist/component/SelectList",
"SetupWizardItem": "chayns-components/dist/esm/react-chayns-setupwizard/component/SetupItem",
"SetupWizard": "chayns-components/dist/esm/react-chayns-setupwizard/component/SetupWizard",
"withSetupWizardContext": "chayns-components/dist/esm/react-chayns-setupwizard/component/withSetupWizardContext",
"SharingBar": "chayns-components/dist/esm/react-chayns-sharingbar/component/SharingBar",
"Signature": "chayns-components/dist/esm/react-chayns-signature/component/Signature",
"Slider": "chayns-components/dist/esm/react-chayns-slider/component/Slider",
"SliderButton": "chayns-components/dist/esm/react-chayns-sliderbutton/component/SliderButton",
"SmallWaitCursor": "chayns-components/dist/esm/react-chayns-smallwaitcursor/component/SmallWaitCursor",
"TagInput": "chayns-components/dist/esm/react-chayns-tag_input/component/TagInput",
"TextArea": "chayns-components/dist/esm/react-chayns-textarea/component/TextArea",
"TextString": "chayns-components/dist/esm/react-chayns-textstring/component/TextString",
"Tooltip": "chayns-components/dist/esm/react-chayns-tooltip/component/Tooltip",
"VerificationIcon": "chayns-components/dist/esm/react-chayns-verification_icon/component/VerificationIcon",
"createLinks": "chayns-components/dist/esm/utils/createLinks",
"equalizer": "chayns-components/dist/esm/utils/equalizer",
"imageUpload": "chayns-components/dist/esm/utils/imageUpload",
"OrientationHelper": "chayns-components/dist/esm/utils/OrientationHelper",
"removeHtml": "chayns-components/dist/esm/utils/removeHtml",
"isTobitEmployee": "chayns-components/dist/esm/utils/tobitEmployee"
};
const WARNING = boxen(
`${chalk.bold.yellowBright('WARNING')}
Using ${chalk.cyanBright(
'`babel-plugin-transform-imports`'
)} with the ${chalk.magentaBright('`resolveAbsoluteImport`')} function
from ${chalk.cyanBright(
'`chayns-components`'
)} is no longer needed. While this function still exists,
it basically does nothing and will be removed with the next major version.
Please remove the babel-plugin from your configuration or use our preconfigured
${chalk.greenBright(
'`chayns-toolkit`'
)} (https://github.com/TobitSoftware/chayns-toolkit).`,
{
padding: 1,
margin: { top: 1, bottom: 1 },
borderColor: 'yellowBright',
borderStyle: 'round',
}
);
console.warn(WARNING);
module.exports = function resolveAbsoluteImport(importName) {
const importPath = LOOKUP_OBJECT[importName];
if (!importPath) {
throw new Error(
`Unable to resolve ${importName} from chayns-components. Please check the spelling. If it's not wrong please create an issue (https://github.com/TobitSoftware/chayns-components/issues).`
);
}
return importPath;
};