@coorpacademy/components 11.33.4 → 11.33.5-alpha.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/es/atom/autocomplete/index.js +2 -2
- package/es/atom/autocomplete/index.js.map +1 -1
- package/es/atom/autocomplete/style.css +4 -4
- package/es/atom/button-link-icon/index.js +1 -1
- package/es/atom/button-link-icon/index.js.map +1 -1
- package/es/atom/button-link-icon/style.css +2 -2
- package/es/atom/button-menu/index.js +1 -1
- package/es/atom/button-menu/index.js.map +1 -1
- package/es/atom/button-menu/style.css +4 -4
- package/es/atom/input-checkbox/index.d.ts.map +1 -1
- package/es/atom/input-checkbox/index.js +1 -1
- package/es/atom/input-checkbox/index.js.map +1 -1
- package/es/atom/input-checkbox/style.css +12 -12
- package/es/atom/input-color/index.js +1 -1
- package/es/atom/input-color/index.js.map +1 -1
- package/es/atom/input-color/style.css +3 -3
- package/es/atom/input-html/index.js +1 -1
- package/es/atom/input-html/index.js.map +1 -1
- package/es/atom/input-html/style.css +3 -3
- package/es/atom/input-switch/index.js +1 -1
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/input-switch/style.css +6 -6
- package/es/atom/input-text/index.js +2 -2
- package/es/atom/input-text/index.js.map +1 -1
- package/es/atom/input-text/style.css +4 -4
- package/es/atom/input-textarea/index.js +2 -2
- package/es/atom/input-textarea/index.js.map +1 -1
- package/es/atom/input-textarea/style.css +5 -5
- package/es/atom/label/index.js +1 -1
- package/es/atom/label/index.js.map +1 -1
- package/es/atom/label/style.css +1 -1
- package/es/atom/life/index.js +1 -1
- package/es/atom/life/index.js.map +1 -1
- package/es/atom/life/style.css +1 -1
- package/es/atom/picture-background/index.js +1 -1
- package/es/atom/picture-background/index.js.map +1 -1
- package/es/atom/picture-background/style.css +1 -1
- package/es/atom/range/handle.css +1 -1
- package/es/atom/range/handle.js +1 -1
- package/es/atom/range/handle.js.map +1 -1
- package/es/atom/select/index.js +1 -1
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +13 -13
- package/es/atom/select-icon/index.js +1 -1
- package/es/atom/select-icon/index.js.map +1 -1
- package/es/atom/select-icon/style.css +1 -1
- package/es/atom/status-item/index.js +1 -1
- package/es/atom/status-item/index.js.map +1 -1
- package/es/atom/status-item/style.css +1 -1
- package/es/atom/tag/index.js +1 -1
- package/es/atom/tag/index.js.map +1 -1
- package/es/atom/tag/style.css +1 -1
- package/es/molecule/brand-create-form/index.js +1 -1
- package/es/molecule/brand-create-form/index.js.map +1 -1
- package/es/molecule/brand-create-form/style.css +4 -4
- package/es/molecule/brand-upload-box/index.js +1 -1
- package/es/molecule/brand-upload-box/index.js.map +1 -1
- package/es/molecule/brand-upload-box/style.css +3 -3
- package/es/molecule/card/customer.css +2 -2
- package/es/molecule/card/customer.d.ts +1 -1
- package/es/molecule/card/customer.js +1 -1
- package/es/molecule/card/customer.js.map +1 -1
- package/es/molecule/card/index.d.ts +1 -1
- package/es/molecule/card/index.js +1 -1
- package/es/molecule/card/index.js.map +1 -1
- package/es/molecule/card/style.css +19 -19
- package/es/molecule/filters/index.js +1 -1
- package/es/molecule/filters/index.js.map +1 -1
- package/es/molecule/filters/style.css +4 -4
- package/es/molecule/hero/index.js +1 -1
- package/es/molecule/hero/index.js.map +1 -1
- package/es/molecule/hero/style.css +10 -10
- package/es/molecule/module-card/index.js +1 -1
- package/es/molecule/module-card/index.js.map +1 -1
- package/es/molecule/module-card/style.css +3 -3
- package/es/molecule/select-multiple/index.js +2 -2
- package/es/molecule/select-multiple/index.js.map +1 -1
- package/es/molecule/select-multiple/style.css +5 -5
- package/es/molecule/theme-image/index.js +1 -1
- package/es/molecule/theme-image/index.js.map +1 -1
- package/es/molecule/theme-image/style.css +4 -4
- package/es/molecule/titled-checkbox/index.js +1 -1
- package/es/molecule/titled-checkbox/index.js.map +1 -1
- package/es/molecule/titled-checkbox/style.css +1 -1
- package/es/organism/brand-analytics/analytics-popin.css +1 -1
- package/es/organism/brand-analytics/analytics-popin.js +1 -1
- package/es/organism/brand-analytics/analytics-popin.js.map +1 -1
- package/es/organism/cards-grid/index.js +1 -1
- package/es/organism/cards-grid/index.js.map +1 -1
- package/es/organism/cards-grid/style.css +1 -1
- package/es/organism/popin/index.js +1 -1
- package/es/organism/popin/index.js.map +1 -1
- package/es/organism/popin/style.css +1 -1
- package/es/organism/resource-browser/index.js +1 -1
- package/es/organism/resource-browser/index.js.map +1 -1
- package/es/organism/resource-browser/style.css +2 -2
- package/es/template/activity/index.js +1 -1
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/style.css +2 -2
- package/es/template/back-office/dashboard-preview/dashboard-popin.css +1 -1
- package/es/template/back-office/dashboard-preview/dashboard-popin.js +1 -1
- package/es/template/back-office/dashboard-preview/dashboard-popin.js.map +1 -1
- package/es/template/external-course/index.js +2 -2
- package/es/template/external-course/index.js.map +1 -1
- package/es/template/external-course/style.css +2 -2
- package/lib/atom/autocomplete/index.js +2 -2
- package/lib/atom/autocomplete/index.js.map +1 -1
- package/lib/atom/autocomplete/style.css +4 -4
- package/lib/atom/button-link-icon/index.js +1 -1
- package/lib/atom/button-link-icon/index.js.map +1 -1
- package/lib/atom/button-link-icon/style.css +2 -2
- package/lib/atom/button-menu/index.js +1 -1
- package/lib/atom/button-menu/index.js.map +1 -1
- package/lib/atom/button-menu/style.css +4 -4
- package/lib/atom/input-checkbox/index.d.ts.map +1 -1
- package/lib/atom/input-checkbox/index.js +1 -1
- package/lib/atom/input-checkbox/index.js.map +1 -1
- package/lib/atom/input-checkbox/style.css +12 -12
- package/lib/atom/input-color/index.js +1 -1
- package/lib/atom/input-color/index.js.map +1 -1
- package/lib/atom/input-color/style.css +3 -3
- package/lib/atom/input-html/index.js +1 -1
- package/lib/atom/input-html/index.js.map +1 -1
- package/lib/atom/input-html/style.css +3 -3
- package/lib/atom/input-switch/index.js +1 -1
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/input-switch/style.css +6 -6
- package/lib/atom/input-text/index.js +2 -2
- package/lib/atom/input-text/index.js.map +1 -1
- package/lib/atom/input-text/style.css +4 -4
- package/lib/atom/input-textarea/index.js +2 -2
- package/lib/atom/input-textarea/index.js.map +1 -1
- package/lib/atom/input-textarea/style.css +5 -5
- package/lib/atom/label/index.js +1 -1
- package/lib/atom/label/index.js.map +1 -1
- package/lib/atom/label/style.css +1 -1
- package/lib/atom/life/index.js +1 -1
- package/lib/atom/life/index.js.map +1 -1
- package/lib/atom/life/style.css +1 -1
- package/lib/atom/picture-background/index.js +1 -1
- package/lib/atom/picture-background/index.js.map +1 -1
- package/lib/atom/picture-background/style.css +1 -1
- package/lib/atom/range/handle.css +1 -1
- package/lib/atom/range/handle.js +1 -1
- package/lib/atom/range/handle.js.map +1 -1
- package/lib/atom/select/index.js +1 -1
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +13 -13
- package/lib/atom/select-icon/index.js +1 -1
- package/lib/atom/select-icon/index.js.map +1 -1
- package/lib/atom/select-icon/style.css +1 -1
- package/lib/atom/status-item/index.js +1 -1
- package/lib/atom/status-item/index.js.map +1 -1
- package/lib/atom/status-item/style.css +1 -1
- package/lib/atom/tag/index.js +1 -1
- package/lib/atom/tag/index.js.map +1 -1
- package/lib/atom/tag/style.css +1 -1
- package/lib/molecule/brand-create-form/index.js +1 -1
- package/lib/molecule/brand-create-form/index.js.map +1 -1
- package/lib/molecule/brand-create-form/style.css +4 -4
- package/lib/molecule/brand-upload-box/index.js +1 -1
- package/lib/molecule/brand-upload-box/index.js.map +1 -1
- package/lib/molecule/brand-upload-box/style.css +3 -3
- package/lib/molecule/card/customer.css +2 -2
- package/lib/molecule/card/customer.d.ts +1 -1
- package/lib/molecule/card/customer.js +1 -1
- package/lib/molecule/card/customer.js.map +1 -1
- package/lib/molecule/card/index.d.ts +1 -1
- package/lib/molecule/card/index.js +1 -1
- package/lib/molecule/card/index.js.map +1 -1
- package/lib/molecule/card/style.css +19 -19
- package/lib/molecule/filters/index.js +1 -1
- package/lib/molecule/filters/index.js.map +1 -1
- package/lib/molecule/filters/style.css +4 -4
- package/lib/molecule/hero/index.js +1 -1
- package/lib/molecule/hero/index.js.map +1 -1
- package/lib/molecule/hero/style.css +10 -10
- package/lib/molecule/module-card/index.js +1 -1
- package/lib/molecule/module-card/index.js.map +1 -1
- package/lib/molecule/module-card/style.css +3 -3
- package/lib/molecule/select-multiple/index.js +2 -2
- package/lib/molecule/select-multiple/index.js.map +1 -1
- package/lib/molecule/select-multiple/style.css +5 -5
- package/lib/molecule/theme-image/index.js +1 -1
- package/lib/molecule/theme-image/index.js.map +1 -1
- package/lib/molecule/theme-image/style.css +4 -4
- package/lib/molecule/titled-checkbox/index.js +1 -1
- package/lib/molecule/titled-checkbox/index.js.map +1 -1
- package/lib/molecule/titled-checkbox/style.css +1 -1
- package/lib/organism/brand-analytics/analytics-popin.css +1 -1
- package/lib/organism/brand-analytics/analytics-popin.js +1 -1
- package/lib/organism/brand-analytics/analytics-popin.js.map +1 -1
- package/lib/organism/cards-grid/index.js +1 -1
- package/lib/organism/cards-grid/index.js.map +1 -1
- package/lib/organism/cards-grid/style.css +1 -1
- package/lib/organism/popin/index.js +1 -1
- package/lib/organism/popin/index.js.map +1 -1
- package/lib/organism/popin/style.css +1 -1
- package/lib/organism/resource-browser/index.js +1 -1
- package/lib/organism/resource-browser/index.js.map +1 -1
- package/lib/organism/resource-browser/style.css +2 -2
- package/lib/template/activity/index.js +1 -1
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/style.css +2 -2
- package/lib/template/back-office/dashboard-preview/dashboard-popin.css +1 -1
- package/lib/template/back-office/dashboard-preview/dashboard-popin.js +1 -1
- package/lib/template/back-office/dashboard-preview/dashboard-popin.js.map +1 -1
- package/lib/template/external-course/index.js +2 -2
- package/lib/template/external-course/index.js.map +1 -1
- package/lib/template/external-course/style.css +2 -2
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import getClassState from '../../util/get-class-state';
|
|
|
11
11
|
import style from './style.css';
|
|
12
12
|
const THEME_STYLE = {
|
|
13
13
|
coorpmanager: style.coorpmanager,
|
|
14
|
-
default: style.
|
|
14
|
+
default: style.defaultStyle
|
|
15
15
|
};
|
|
16
16
|
const renderSuggestion = suggestion => /*#__PURE__*/React.createElement("span", null, suggestion.name);
|
|
17
17
|
const Autocomplete = props => {
|
|
@@ -34,7 +34,7 @@ const Autocomplete = props => {
|
|
|
34
34
|
} = props;
|
|
35
35
|
const mainClass = THEME_STYLE[theme];
|
|
36
36
|
const title = useMemo(() => `${propsTitle}${required ? '*' : ''}`, [propsTitle, required]);
|
|
37
|
-
const className = useMemo(() => getClassState(style.
|
|
37
|
+
const className = useMemo(() => getClassState(style.defaultStyle, style.modified, style.error, modified, error), [modified, error]);
|
|
38
38
|
const handleInput = useCallback(e => {
|
|
39
39
|
onInput(e);
|
|
40
40
|
}, [onInput]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","Autosuggest","PropTypes","classnames","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","getClassState","style","THEME_STYLE","coorpmanager","default","renderSuggestion","suggestion","createElement","name","Autocomplete","props","placeholder","value","description","required","modified","error","errorMessage","suggestions","onInput","_noop","onFetch","onClear","onBlur","onSuggestionSelected","title","propsTitle","theme","mainClass","className","handleInput","e","handleBlur","selectedSuggestion","handleSuggestionsFetchRequested","handleSuggestionsClearRequested","handleSuggestionsSelected","data","inputProps","onChange","descriptionView","toolTipView","infoIconWrapper","infoIcon","descriptionLabel","errorIconView","leftIcon","errorText","dangerouslySetInnerHTML","__html","_isNil","isNoTitle","_isEmpty","noValue","inputContainer","container","input","suggestionsContainer","suggestionsContainerOpen","suggestionsList","suggestionHighlighted","onSuggestionsFetchRequested","onSuggestionsClearRequested","getSuggestionValue","focusInputOnSuggestionClick","propTypes","process","env","NODE_ENV","string","bool","arrayOf","shape","oneOfType","number","oneOf","_keys","func"],"sources":["../../../src/atom/autocomplete/index.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport Autosuggest from 'react-autosuggest';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {noop, isNil, isEmpty, keys} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst THEME_STYLE = {\n coorpmanager: style.coorpmanager,\n default: style.default\n};\n\nconst renderSuggestion = suggestion => <span>{suggestion.name}</span>;\n\nconst Autocomplete = props => {\n const {\n placeholder = '',\n value,\n description,\n required,\n modified = false,\n error = false,\n errorMessage,\n suggestions = [],\n onInput = noop,\n onFetch = noop,\n onClear = noop,\n onBlur = noop,\n onSuggestionSelected = noop,\n title: propsTitle,\n theme = 'default'\n } = props;\n\n const mainClass = THEME_STYLE[theme];\n const title = useMemo(() => `${propsTitle}${required ? '*' : ''}`, [propsTitle, required]);\n const className = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [modified, error]\n );\n\n const handleInput = useCallback(\n e => {\n onInput(e);\n },\n [onInput]\n );\n const handleBlur = useCallback(\n (e, selectedSuggestion) => onBlur(e, selectedSuggestion),\n [onBlur]\n );\n const handleSuggestionsFetchRequested = useCallback(e => onFetch(e), [onFetch]);\n const handleSuggestionsClearRequested = useCallback(e => onClear(e), [onClear]);\n const handleSuggestionsSelected = useCallback(\n (e, data) => onSuggestionSelected(data),\n [onSuggestionSelected]\n );\n\n const inputProps = {\n placeholder,\n value,\n onChange: noop,\n onBlur: handleBlur,\n onInput: handleInput,\n 'data-testid': 'autocomplete-input'\n };\n\n const descriptionView =\n description && theme !== 'coorpmanager' ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const toolTipView =\n description && theme === 'coorpmanager' ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null;\n\n const errorIconView =\n theme === 'coorpmanager' && error ? <ErrorIcon className={style.leftIcon} /> : null;\n\n const errorText =\n theme === 'coorpmanager' && error ? (\n <div\n className={style.errorText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: errorMessage}}\n />\n ) : null;\n return (\n <div className={classnames(mainClass, className, isNil(propsTitle) && style.isNoTitle)}>\n <label>\n <span className={classnames(style.title, isEmpty(value) && style.noValue)}>\n {title}\n {toolTipView}\n </span>\n <div className={style.inputContainer}>\n <Autosuggest\n theme={{\n container: style.container,\n input: style.input,\n suggestionsContainer: style.suggestionsContainer,\n suggestionsContainerOpen: style.suggestionsContainerOpen,\n suggestionsList: style.suggestionsList,\n suggestion: style.suggestion,\n suggestionHighlighted: style.suggestionHighlighted\n }}\n suggestions={suggestions}\n onSuggestionsFetchRequested={handleSuggestionsFetchRequested}\n onSuggestionsClearRequested={handleSuggestionsClearRequested}\n getSuggestionValue={noop}\n renderSuggestion={renderSuggestion}\n inputProps={inputProps}\n focusInputOnSuggestionClick={false}\n onSuggestionSelected={handleSuggestionsSelected}\n />\n {errorIconView}\n {errorText}\n </div>\n </label>\n {descriptionView}\n </div>\n );\n};\n\nAutocomplete.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n description: PropTypes.string,\n required: PropTypes.bool,\n modified: PropTypes.bool,\n error: PropTypes.bool,\n errorMessage: PropTypes.string,\n suggestions: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n })\n ),\n theme: PropTypes.oneOf(keys(THEME_STYLE)),\n onInput: PropTypes.func,\n onFetch: PropTypes.func,\n onClear: PropTypes.func,\n onBlur: PropTypes.func,\n onSuggestionSelected: PropTypes.func\n};\n\nexport default Autocomplete;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,QAAO,OAAO;AACjD,OAAOC,WAAW,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AI;EACvBtD,MAAM,EAAE7B,SAAS,CAACmF,IAAI;EACtBrD,oBAAoB,EAAE9B,SAAS,CAACmF;AAClC,CAAC;AAED,eAAepE,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","Autosuggest","PropTypes","classnames","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","getClassState","style","THEME_STYLE","coorpmanager","default","defaultStyle","renderSuggestion","suggestion","createElement","name","Autocomplete","props","placeholder","value","description","required","modified","error","errorMessage","suggestions","onInput","_noop","onFetch","onClear","onBlur","onSuggestionSelected","title","propsTitle","theme","mainClass","className","handleInput","e","handleBlur","selectedSuggestion","handleSuggestionsFetchRequested","handleSuggestionsClearRequested","handleSuggestionsSelected","data","inputProps","onChange","descriptionView","toolTipView","infoIconWrapper","infoIcon","descriptionLabel","errorIconView","leftIcon","errorText","dangerouslySetInnerHTML","__html","_isNil","isNoTitle","_isEmpty","noValue","inputContainer","container","input","suggestionsContainer","suggestionsContainerOpen","suggestionsList","suggestionHighlighted","onSuggestionsFetchRequested","onSuggestionsClearRequested","getSuggestionValue","focusInputOnSuggestionClick","propTypes","process","env","NODE_ENV","string","bool","arrayOf","shape","oneOfType","number","oneOf","_keys","func"],"sources":["../../../src/atom/autocomplete/index.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport Autosuggest from 'react-autosuggest';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {noop, isNil, isEmpty, keys} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst THEME_STYLE = {\n coorpmanager: style.coorpmanager,\n default: style.defaultStyle\n};\n\nconst renderSuggestion = suggestion => <span>{suggestion.name}</span>;\n\nconst Autocomplete = props => {\n const {\n placeholder = '',\n value,\n description,\n required,\n modified = false,\n error = false,\n errorMessage,\n suggestions = [],\n onInput = noop,\n onFetch = noop,\n onClear = noop,\n onBlur = noop,\n onSuggestionSelected = noop,\n title: propsTitle,\n theme = 'default'\n } = props;\n\n const mainClass = THEME_STYLE[theme];\n const title = useMemo(() => `${propsTitle}${required ? '*' : ''}`, [propsTitle, required]);\n const className = useMemo(\n () => getClassState(style.defaultStyle, style.modified, style.error, modified, error),\n [modified, error]\n );\n\n const handleInput = useCallback(\n e => {\n onInput(e);\n },\n [onInput]\n );\n const handleBlur = useCallback(\n (e, selectedSuggestion) => onBlur(e, selectedSuggestion),\n [onBlur]\n );\n const handleSuggestionsFetchRequested = useCallback(e => onFetch(e), [onFetch]);\n const handleSuggestionsClearRequested = useCallback(e => onClear(e), [onClear]);\n const handleSuggestionsSelected = useCallback(\n (e, data) => onSuggestionSelected(data),\n [onSuggestionSelected]\n );\n\n const inputProps = {\n placeholder,\n value,\n onChange: noop,\n onBlur: handleBlur,\n onInput: handleInput,\n 'data-testid': 'autocomplete-input'\n };\n\n const descriptionView =\n description && theme !== 'coorpmanager' ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const toolTipView =\n description && theme === 'coorpmanager' ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null;\n\n const errorIconView =\n theme === 'coorpmanager' && error ? <ErrorIcon className={style.leftIcon} /> : null;\n\n const errorText =\n theme === 'coorpmanager' && error ? (\n <div\n className={style.errorText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: errorMessage}}\n />\n ) : null;\n return (\n <div className={classnames(mainClass, className, isNil(propsTitle) && style.isNoTitle)}>\n <label>\n <span className={classnames(style.title, isEmpty(value) && style.noValue)}>\n {title}\n {toolTipView}\n </span>\n <div className={style.inputContainer}>\n <Autosuggest\n theme={{\n container: style.container,\n input: style.input,\n suggestionsContainer: style.suggestionsContainer,\n suggestionsContainerOpen: style.suggestionsContainerOpen,\n suggestionsList: style.suggestionsList,\n suggestion: style.suggestion,\n suggestionHighlighted: style.suggestionHighlighted\n }}\n suggestions={suggestions}\n onSuggestionsFetchRequested={handleSuggestionsFetchRequested}\n onSuggestionsClearRequested={handleSuggestionsClearRequested}\n getSuggestionValue={noop}\n renderSuggestion={renderSuggestion}\n inputProps={inputProps}\n focusInputOnSuggestionClick={false}\n onSuggestionSelected={handleSuggestionsSelected}\n />\n {errorIconView}\n {errorText}\n </div>\n </label>\n {descriptionView}\n </div>\n );\n};\n\nAutocomplete.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n description: PropTypes.string,\n required: PropTypes.bool,\n modified: PropTypes.bool,\n error: PropTypes.bool,\n errorMessage: PropTypes.string,\n suggestions: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n })\n ),\n theme: PropTypes.oneOf(keys(THEME_STYLE)),\n onInput: PropTypes.func,\n onFetch: PropTypes.func,\n onClear: PropTypes.func,\n onBlur: PropTypes.func,\n onSuggestionSelected: PropTypes.func\n};\n\nexport default Autocomplete;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,QAAO,OAAO;AACjD,OAAOC,WAAW,MAAM,mBAAmB;AAC3C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,oBAAoB,IAAIC,SAAS,EACjCC,0CAA0C,IAAIC,QAAQ,QACjD,0BAA0B;AACjC,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,WAAW,GAAG;EAClBC,YAAY,EAAEF,KAAK,CAACE,YAAY;EAChCC,OAAO,EAAEH,KAAK,CAACI;AACjB,CAAC;AAED,MAAMC,gBAAgB,GAAGC,UAAU,iBAAIjB,KAAA,CAAAkB,aAAA,eAAOD,UAAU,CAAC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AA,CAAAC,QAAA,oBAAG;EACvB3C,KAAK,EAAEhC,SAAS,CAAC4E,MAAM;EACvB1D,WAAW,EAAElB,SAAS,CAAC4E,MAAM;EAC7BzD,KAAK,EAAEnB,SAAS,CAAC4E,MAAM;EACvBxD,WAAW,EAAEpB,SAAS,CAAC4E,MAAM;EAC7BvD,QAAQ,EAAErB,SAAS,CAAC6E,IAAI;EACxBvD,QAAQ,EAAEtB,SAAS,CAAC6E,IAAI;EACxBtD,KAAK,EAAEvB,SAAS,CAAC6E,IAAI;EACrBrD,YAAY,EAAExB,SAAS,CAAC4E,MAAM;EAC9BnD,WAAW,EAAEzB,SAAS,CAAC8E,OAAO,CAC5B9E,SAAS,CAAC+E,KAAK,CAAC;IACdhE,IAAI,EAAEf,SAAS,CAAC4E,MAAM;IACtBzD,KAAK,EAAEnB,SAAS,CAACgF,SAAS,CAAC,CAAChF,SAAS,CAAC4E,MAAM,EAAE5E,SAAS,CAACiF,MAAM,CAAC;EACjE,CAAC,CACH,CAAC;EACD/C,KAAK,EAAElC,SAAS,CAACkF,KAAK,CAACC,KAAA,CAAK3E,WAAW,CAAC,CAAC;EACzCkB,OAAO,EAAE1B,SAAS,CAACoF,IAAI;EACvBxD,OAAO,EAAE5B,SAAS,CAACoF,IAAI;EACvBvD,OAAO,EAAE7B,SAAS,CAACoF,IAAI;EACvBtD,MAAM,EAAE9B,SAAS,CAACoF,IAAI;EACtBrD,oBAAoB,EAAE/B,SAAS,CAACoF;AAClC,CAAC;AAED,eAAepE,YAAY","ignoreList":[]}
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
@value cm_grey_500 from colors;
|
|
14
14
|
@value cm_grey_700 from colors;
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.defaultStyle {
|
|
17
17
|
display: flex;
|
|
18
18
|
flex-wrap: nowrap;
|
|
19
19
|
align-items: center;
|
|
20
20
|
align-content: center;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.
|
|
23
|
+
.defaultStyle label {
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
26
26
|
height: 50px;
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.error {
|
|
33
|
-
composes:
|
|
33
|
+
composes: defaultStyle;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.modified {
|
|
37
|
-
composes:
|
|
37
|
+
composes: defaultStyle;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.title {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","_getOr","createElement","className","buttonContent","iconName","getSizeStyle","size","small","responsive","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","_getOr","createElement","className","buttonContent","iconName","getSizeStyle","size","small","responsive","defaultStyle","ButtonLinkIcon","props","disabled","dataName","ariaLabel","link","onClick","tooltipPlacement","toolTipIsVisible","setToolTipIsVisible","timer","contentView","styleButton","handleOnClick","handleMouseOver","current","clearTimeout","setTimeout","undefined","handleMouseLeave","TooltipContent","tooltipContentWrapper","Button","_extends","onMouseEnter","onMouseLeave","type","onMouseOver","Fragment","fontSize","anchorId","placement","closeToolTipInformationTextAriaLabel","propTypes","process","env","NODE_ENV","oneOf","string","_keys","func","shape","href","download","bool","target"],"sources":["../../../src/atom/button-link-icon/index.js"],"sourcesContent":["import React, {useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, keys} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {ICONS} from '../../util/button-icons';\nimport FaIcon from '../icon';\nimport Link from '../link';\nimport ToolTip from '../tooltip';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst getButtonContent = (icon, faIcon) => {\n const Icon = getOr(null, icon, ICONS);\n\n if (!Icon && !faIcon) {\n return <div className={style.buttonContent} />;\n }\n\n return (\n <div className={style.buttonContent}>\n {faIcon ? <FaIcon iconName={faIcon} /> : <Icon className={style.icon} />}\n </div>\n );\n};\n\nconst getSizeStyle = size => {\n switch (size) {\n case 'small':\n return style.small;\n case 'responsive':\n return style.responsive;\n default:\n return style.defaultStyle;\n }\n};\n\nconst ButtonLinkIcon = props => {\n const {\n size = 'default',\n disabled,\n icon,\n faIcon,\n 'data-name': dataName,\n 'aria-label': ariaLabel,\n link,\n onClick,\n className,\n tooltipPlacement = 'left'\n } = props;\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const timer = useRef();\n\n const contentView = getButtonContent(icon, faIcon);\n const styleButton = classnames(\n getSizeStyle(size),\n link && style.link,\n disabled && style.disabled,\n className\n );\n\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const handleMouseOver = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setToolTipIsVisible(true);\n timer.current = undefined;\n }, 300);\n }, [timer, setToolTipIsVisible]);\n\n const handleMouseLeave = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n setToolTipIsVisible(false);\n }, [timer, setToolTipIsVisible]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{ariaLabel}</span>,\n [ariaLabel]\n );\n\n const Button = useCallback(\n () =>\n link ? (\n <Link\n {...link}\n {...(ariaLabel\n ? {\n 'data-for': 'button-icon',\n 'data-tip': toolTipIsVisible\n }\n : {})}\n className={styleButton}\n data-name={dataName}\n aria-label={ariaLabel}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {contentView}\n </Link>\n ) : (\n <button\n {...(ariaLabel\n ? {\n 'data-for': 'button-icon',\n 'data-tip': toolTipIsVisible\n }\n : {})}\n type=\"button\"\n aria-label={ariaLabel}\n data-name={dataName}\n data-testid={`button-${dataName}-${className}`}\n className={styleButton}\n onClick={handleOnClick}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n disabled={disabled}\n >\n {contentView}\n </button>\n ),\n [\n link,\n ariaLabel,\n className,\n contentView,\n dataName,\n disabled,\n handleMouseLeave,\n handleMouseOver,\n handleOnClick,\n styleButton,\n toolTipIsVisible\n ]\n );\n\n return (\n <>\n <Button />\n {ariaLabel ? (\n <ToolTip\n fontSize={12}\n anchorId=\"button-icon\"\n toolTipIsVisible={toolTipIsVisible}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={ariaLabel}\n />\n ) : null}\n </>\n );\n};\n\nButtonLinkIcon.propTypes = {\n size: PropTypes.oneOf(['default', 'small', 'responsive']),\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n icon: PropTypes.oneOf(keys(ICONS)),\n faIcon: PropTypes.string,\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n disabled: PropTypes.bool,\n className: PropTypes.string,\n tooltipPlacement: PropTypes.oneOf(['left', 'right', 'top', 'bottom'])\n};\n\nexport default ButtonLinkIcon;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAGC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAO,OAAO;AAC1D,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,OAAOC,MAAM,MAAM,SAAS;AAC5B,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,OAAO,MAAM,YAAY;AAChC;AACA,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAGA,CAACC,IAAI,EAAEC,MAAM,KAAK;EACzC,MAAMC,IAAI,GAAGC,MAAA,CAAM,IAAI,EAAEH,IAAI,EAAEN,KAAK,CAAC;EAErC,IAAI,CAACQ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D,MAAM;EACxBhC,OAAO,EAAE3B,SAAS,CAAC6D,IAAI;EACvBnC,IAAI,EAAE1B,SAAS,CAAC8D,KAAK,CAAC;IACpBC,IAAI,EAAE/D,SAAS,CAAC2D,MAAM;IACtBK,QAAQ,EAAEhE,SAAS,CAACiE,IAAI;IACxBC,MAAM,EAAElE,SAAS,CAAC0D,KAAK,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC;EAChE,CAAC,CAAC;EACFnC,QAAQ,EAAEvB,SAAS,CAACiE,IAAI;EACxBpD,SAAS,EAAEb,SAAS,CAAC2D,MAAM;EAC3B/B,gBAAgB,EAAE5B,SAAS,CAAC0D,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;AACtE,CAAC;AAED,eAAerC,cAAc","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ const Button = props => {
|
|
|
12
12
|
onClick,
|
|
13
13
|
type = 'default'
|
|
14
14
|
} = props;
|
|
15
|
-
const styleButton = classnames(style.button, type === 'default' && style.
|
|
15
|
+
const styleButton = classnames(style.button, type === 'default' && style.defaultStyle, type === 'defaultLeft' && style.defaultLeft, type === 'dangerous' && style.dangerous, type === 'dangerousLeft' && style.dangerousLeft, disabled && style.disabled);
|
|
16
16
|
const handleOnClick = useCallback(() => onClick(), [onClick]);
|
|
17
17
|
return /*#__PURE__*/React.createElement("button", {
|
|
18
18
|
type: "button",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","map","classnames","style","propTypes","buttonPropTypes","Button","props","dataName","disabled","label","onClick","type","styleButton","button","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","map","classnames","style","propTypes","buttonPropTypes","Button","props","dataName","disabled","label","onClick","type","styleButton","button","defaultStyle","defaultLeft","dangerous","dangerousLeft","handleOnClick","createElement","title","className","buttonContent","process","env","NODE_ENV","ButtonMenu","buttons","buildButton","index","_extends","key","buttonList","convert","cap"],"sources":["../../../src/atom/button-menu/index.tsx"],"sourcesContent":["import React, {useMemo, useCallback} from 'react';\nimport map from 'lodash/fp/map';\nimport classnames from 'classnames';\nimport style from './style.css';\nimport propTypes, {ButtonMenuProps, ButtonProps, buttonPropTypes} from './types';\n\nconst Button = (props: ButtonProps) => {\n const {'data-name': dataName, disabled, label, onClick, type = 'default'} = props;\n const styleButton = classnames(\n style.button,\n type === 'default' && style.defaultStyle,\n type === 'defaultLeft' && style.defaultLeft,\n type === 'dangerous' && style.dangerous,\n type === 'dangerousLeft' && style.dangerousLeft,\n disabled && style.disabled\n );\n\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n return (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n data-name={dataName}\n className={styleButton}\n onClick={handleOnClick}\n disabled={disabled}\n >\n <div className={style.buttonContent}>\n <span className={style.label}>{label}</span>\n </div>\n </button>\n );\n};\n\nButton.propTypes = buttonPropTypes;\n\nconst ButtonMenu = (props: ButtonMenuProps) => {\n const {buttons, 'data-name': dataName} = props;\n const buildButton = useCallback((button: ButtonProps, index) => {\n return <Button {...button} key={button.label + index} />;\n }, []);\n\n const buttonList = useMemo(\n // @ts-expect-error (to avoid using map as any)\n () => map.convert({cap: false})(buildButton, buttons),\n [buttons, buildButton]\n );\n\n return <div data-name={dataName}>{buttonList}</div>;\n};\n\nButtonMenu.propTypes = propTypes;\n\nexport default ButtonMenu;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,WAAW,QAAO,OAAO;AACjD,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,SAAS,IAAiCC,eAAe,QAAO,SAAS;AAEhF,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EACrC,MAAM;IAAC,WAAW,EAAEC,QAAQ;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,OAA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oB;IAAM,EAAE,CAAC;EAC1D,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMG,UAAU,GAAGlC,OAAO;EACxB;EACA,MAAME,GAAG,CAACiC,OAAO,CAAC;IAACC,GAAG,EAAE;EAAK,CAAC,CAAC,CAACN,WAAW,EAAED,OAAO,CAAC,EACrD,CAACA,OAAO,EAAEC,WAAW,CACvB,CAAC;EAED,oBAAO/B,KAAA,CAAAsB,aAAA;IAAK,aAAWZ;EAAS,GAAEyB,UAAgB,CAAC;AACrD,CAAC;AAEDN,UAAU,CAACvB,SAAS,GAAAoB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGtB,SAAS;AAEhC,eAAeuB,UAAU","ignoreList":[]}
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
display: block;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
39
|
+
.defaultStyle {
|
|
40
40
|
background-color: cm_grey_100;
|
|
41
41
|
color: cm_grey_900;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.defaultLeft {
|
|
45
|
-
composes:
|
|
45
|
+
composes: defaultStyle;
|
|
46
46
|
justify-content: flex-start;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.
|
|
49
|
+
.defaultStyle:hover {
|
|
50
50
|
background-color: cm_grey_200;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.dangerous {
|
|
54
|
-
composes:
|
|
54
|
+
composes: defaultStyle;
|
|
55
55
|
color: cm_negative_100;
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-checkbox/index.js"],"names":[],"mappings":";AAeA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-checkbox/index.js"],"names":[],"mappings":";AAeA,wDAwDC"}
|
|
@@ -32,7 +32,7 @@ const InputCheckbox = props => {
|
|
|
32
32
|
const handleChange = useCallback(e => onChange(e.target.checked), [onChange]);
|
|
33
33
|
const modifiedClassName = theme === 'coorpmanager' ? style.coorpManagerModified : style.defaultModified;
|
|
34
34
|
const errorClassName = theme === 'coorpmanager' ? style.coorpManagerError : style.defaultError;
|
|
35
|
-
const defaultContainerClassName = theme === 'coorpmanager' ? style.coorpManager : style.
|
|
35
|
+
const defaultContainerClassName = theme === 'coorpmanager' ? style.coorpManager : style.defaultStyle;
|
|
36
36
|
const className = getClassState(defaultContainerClassName, modifiedClassName, errorClassName, modified, error);
|
|
37
37
|
return /*#__PURE__*/React.createElement("label", {
|
|
38
38
|
className: className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","classnames","NovaSolidStatusValidate","CheckIcon","getClassState","style","titleStylesClassNames","inherit","primary","secondary","tertiary","InputCheckbox","props","checked","onChange","_noop","error","disabled","required","titleStyle","modified","theme","title","propsTitle","noLabelMargins","titleStyleClassName","idCheckbox","_uniqueId","handleChange","e","target","modifiedClassName","coorpManagerModified","defaultModified","errorClassName","coorpManagerError","defaultError","defaultContainerClassName","coorpManager","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","classnames","NovaSolidStatusValidate","CheckIcon","getClassState","style","titleStylesClassNames","inherit","primary","secondary","tertiary","InputCheckbox","props","checked","onChange","_noop","error","disabled","required","titleStyle","modified","theme","title","propsTitle","noLabelMargins","titleStyleClassName","idCheckbox","_uniqueId","handleChange","e","target","modifiedClassName","coorpManagerModified","defaultModified","errorClassName","coorpManagerError","defaultError","defaultContainerClassName","coorpManager","defaultStyle","className","createElement","htmlFor","type","checkbox","name","id","label","undefined","icon","propTypes","process","env","NODE_ENV","string","isRequired","bool","func","oneOf","_keys"],"sources":["../../../src/atom/input-checkbox/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {NovaSolidStatusValidate as CheckIcon} from '@coorpacademy/nova-icons';\nimport {keys, noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst titleStylesClassNames = {\n inherit: style.inherit,\n primary: style.primary,\n secondary: style.secondary,\n tertiary: style.tertiary\n};\n\nconst InputCheckbox = props => {\n const {\n checked,\n onChange = noop,\n error,\n disabled,\n required,\n titleStyle = 'primary',\n modified = false,\n theme = 'default',\n title: propsTitle,\n noLabelMargins = false\n } = props;\n\n const titleStyleClassName = titleStylesClassNames[titleStyle];\n const idCheckbox = uniqueId('input-checkbox-');\n const title = `${propsTitle}${required ? '*' : ''}`;\n const handleChange = useCallback(e => onChange(e.target.checked), [onChange]);\n\n const modifiedClassName =\n theme === 'coorpmanager' ? style.coorpManagerModified : style.defaultModified;\n const errorClassName = theme === 'coorpmanager' ? style.coorpManagerError : style.defaultError;\n const defaultContainerClassName =\n theme === 'coorpmanager' ? style.coorpManager : style.defaultStyle;\n\n const className = getClassState(\n defaultContainerClassName,\n modifiedClassName,\n errorClassName,\n modified,\n error\n );\n\n return (\n <label className={className} htmlFor={idCheckbox} data-name=\"checkbox-input-label\">\n <input\n type=\"checkbox\"\n className={style.checkbox}\n name={title}\n id={idCheckbox}\n checked={checked}\n onChange={handleChange}\n disabled={disabled}\n data-name=\"checkbox-input\"\n />\n <div\n data-name=\"checkbox-label\"\n className={classnames(style.label, noLabelMargins ? style.noLabelMargins : undefined)}\n >\n <CheckIcon className={style.icon} />\n </div>\n <span className={titleStyleClassName} title={title}>\n {title}\n </span>\n </label>\n );\n};\n\nInputCheckbox.propTypes = {\n title: PropTypes.string.isRequired,\n disabled: PropTypes.bool,\n required: PropTypes.bool,\n checked: PropTypes.bool,\n error: PropTypes.bool,\n onChange: PropTypes.func,\n modified: PropTypes.bool,\n noLabelMargins: PropTypes.bool,\n theme: PropTypes.oneOf(['coorpmanager', 'default']),\n titleStyle: PropTypes.oneOf(keys(titleStylesClassNames))\n};\n\nexport default InputCheckbox;\n"],"mappings":";;;AAAA,O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xC,KAAK,EAAEhB,SAAS,CAACwD,IAAI;EACrB1C,QAAQ,EAAEd,SAAS,CAACyD,IAAI;EACxBrC,QAAQ,EAAEpB,SAAS,CAACwD,IAAI;EACxBhC,cAAc,EAAExB,SAAS,CAACwD,IAAI;EAC9BnC,KAAK,EAAErB,SAAS,CAAC0D,KAAK,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;EACnDvC,UAAU,EAAEnB,SAAS,CAAC0D,KAAK,CAACC,KAAA,CAAKrD,qBAAqB,CAAC;AACzD,CAAC;AAED,eAAeK,aAAa","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
@value cm_green_50 from colors;
|
|
17
17
|
@value cm_primary_blue from colors;
|
|
18
18
|
|
|
19
|
-
.
|
|
19
|
+
.defaultStyle {
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: row-reverse;
|
|
22
22
|
justify-content: flex-end;
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.defaultError {
|
|
39
|
-
composes:
|
|
39
|
+
composes: defaultStyle;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.defaultModified {
|
|
43
|
-
composes:
|
|
43
|
+
composes: defaultStyle;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.
|
|
46
|
+
.defaultStyle input,
|
|
47
47
|
.coorpManager input {
|
|
48
48
|
display: none;
|
|
49
49
|
}
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
color: white;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.
|
|
58
|
+
.defaultStyle .title {
|
|
59
59
|
font-family: Gilroy;
|
|
60
60
|
font-size: 15px;
|
|
61
61
|
text-transform: none;
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
width: 180px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.
|
|
67
|
-
.
|
|
68
|
-
.
|
|
66
|
+
.defaultStyle .tertiary,
|
|
67
|
+
.defaultStyle .primary,
|
|
68
|
+
.defaultStyle .secondary {
|
|
69
69
|
color: dark;
|
|
70
70
|
background-color: unset;
|
|
71
71
|
}
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
background-color: cm_blue_50;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.
|
|
100
|
+
.defaultStyle .label,
|
|
101
101
|
.coorpManager .label {
|
|
102
102
|
border: solid 1px cm_grey_200;
|
|
103
103
|
background-color: cm_grey_100;
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
position: relative;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
.defaultStyle .label {
|
|
117
117
|
margin-left: 20px;
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
outline: 2px solid battle;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
.
|
|
147
|
+
.defaultStyle .inherit,
|
|
148
148
|
.coorpManager .inherit {
|
|
149
149
|
color: inherit;
|
|
150
150
|
text-overflow: ellipsis;
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
.coorpManager .noLabelMargins,
|
|
157
|
-
.
|
|
157
|
+
.defaultStyle .noLabelMargins {
|
|
158
158
|
margin-right: 0;
|
|
159
159
|
margin-left: 0;
|
|
160
160
|
}
|
|
@@ -19,7 +19,7 @@ const InputColor = props => {
|
|
|
19
19
|
backgroundColor: value
|
|
20
20
|
};
|
|
21
21
|
const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);
|
|
22
|
-
const className = getClassState(style.
|
|
22
|
+
const className = getClassState(style.defaultStyle, style.modified, style.error, modified, error);
|
|
23
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
24
|
className: className
|
|
25
25
|
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputColor","props","title","name","placeholder","value","defaultValue","onChange","_noop","error","description","modified","inlineStyle","backgroundColor","handleChange","e","target","className","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputColor","props","title","name","placeholder","value","defaultValue","onChange","_noop","error","description","modified","inlineStyle","backgroundColor","handleChange","e","target","className","defaultStyle","createElement","type","input","onInput","preview","propTypes","process","env","NODE_ENV","string","isRequired","func","bool"],"sources":["../../../src/atom/input-color/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputColor = props => {\n const {\n title,\n name,\n placeholder,\n value,\n defaultValue,\n onChange = noop,\n error,\n description,\n modified = false\n } = props;\n\n const inlineStyle = {\n backgroundColor: value\n };\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n const className = getClassState(style.defaultStyle, style.modified, style.error, modified, error);\n\n return (\n <div className={className}>\n <label>\n <span className={style.title}>{`${title} `}</span>\n <input\n type=\"text\"\n name={name}\n className={style.input}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n onInput={handleChange}\n onChange={noop}\n />\n <span className={style.preview} style={inlineStyle} />\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nInputColor.propTypes = {\n title: PropTypes.string.isRequired,\n name: PropTypes.string,\n placeholder: PropTypes.string.isRequired,\n defaultValue: PropTypes.string,\n value: PropTypes.string,\n error: PropTypes.string,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool\n};\n\nexport default InputColor;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,OAAO,QAAO,OAAO;AACpC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,UAAU,GAAGC,KAAK,IAAI;EAC1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AAC,QAAA,oBAAG;EACrBzB,KAAK,EAAEL,SAAS,CAAC+B,MAAM,CAACC,UAAU;EAClC1B,IAAI,EAAEN,SAAS,CAAC+B,MAAM;EACtBxB,WAAW,EAAEP,SAAS,CAAC+B,MAAM,CAACC,UAAU;EACxCvB,YAAY,EAAET,SAAS,CAAC+B,MAAM;EAC9BvB,KAAK,EAAER,SAAS,CAAC+B,MAAM;EACvBnB,KAAK,EAAEZ,SAAS,CAAC+B,MAAM;EACvBrB,QAAQ,EAAEV,SAAS,CAACiC,IAAI;EACxBpB,WAAW,EAAEb,SAAS,CAAC+B,MAAM;EAC7BjB,QAAQ,EAAEd,SAAS,CAACkC;AACtB,CAAC;AAED,eAAe/B,UAAU","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@value colors: "../../variables/colors.css";
|
|
2
2
|
@value grey from colors;
|
|
3
3
|
|
|
4
|
-
.
|
|
4
|
+
.defaultStyle {
|
|
5
5
|
composes: default from '../input-text/style.css';
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
.error {
|
|
13
13
|
composes: error from '../input-text/style.css';
|
|
14
|
-
composes:
|
|
14
|
+
composes: defaultStyle;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.modified {
|
|
18
18
|
composes: modified from '../input-text/style.css';
|
|
19
|
-
composes:
|
|
19
|
+
composes: defaultStyle;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.title {
|
|
@@ -31,7 +31,7 @@ const InputHtml = (props, legacyContext) => {
|
|
|
31
31
|
description,
|
|
32
32
|
disabled
|
|
33
33
|
} = props;
|
|
34
|
-
const className = error ? style.error : style.
|
|
34
|
+
const className = error ? style.error : style.defaultStyle;
|
|
35
35
|
const iconContent = !preview ? /*#__PURE__*/React.createElement(PreviewIcon, {
|
|
36
36
|
style: {
|
|
37
37
|
color: mediumColor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","PropTypes","NovaLineBusinessCircleView","PreviewIcon","NovaLineContentEditionPencil2","PencilIcon","Provider","GetSkinFromContext","InputPreview","style","InputHtml","props","legacyContext","value","onChange","_noop","text","setText","preview","setPreview","handleChange","e","_value","target","handlePreview","preventDefault","skin","mediumColor","_getOr","title","placeholder","error","description","disabled","className","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","PropTypes","NovaLineBusinessCircleView","PreviewIcon","NovaLineContentEditionPencil2","PencilIcon","Provider","GetSkinFromContext","InputPreview","style","InputHtml","props","legacyContext","value","onChange","_noop","text","setText","preview","setPreview","handleChange","e","_value","target","handlePreview","preventDefault","skin","mediumColor","_getOr","title","placeholder","error","description","disabled","className","defaultStyle","iconContent","createElement","color","height","contentWrapper","input","toggle","onClick","propTypes","process","env","NODE_ENV","string","bool","func","contextTypes","childContextTypes"],"sources":["../../../src/atom/input-html/index.js"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, getOr} from 'lodash/fp';\nimport {\n NovaLineBusinessCircleView as PreviewIcon,\n NovaLineContentEditionPencil2 as PencilIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport InputPreview from './input-preview';\nimport style from './style.css';\n\nconst InputHtml = (props, legacyContext) => {\n const {value = '', onChange = noop} = props;\n const [text, setText] = useState(value);\n const [preview, setPreview] = useState(true);\n\n const handleChange = useCallback(\n e => {\n const _value = e.target.value;\n setText(_value);\n onChange(_value);\n },\n [onChange]\n );\n\n const handlePreview = useCallback(\n e => {\n e.preventDefault();\n setPreview(!preview);\n },\n [preview, setPreview]\n );\n\n const skin = GetSkinFromContext(legacyContext);\n const mediumColor = getOr('#999999', 'common.medium', skin);\n\n const {title, placeholder, error, description, disabled} = props;\n\n const className = error ? style.error : style.defaultStyle;\n const iconContent = !preview ? (\n <PreviewIcon style={{color: mediumColor}} height={16} />\n ) : (\n <PencilIcon style={{color: mediumColor}} height={16} />\n );\n\n return (\n <div className={className}>\n <label>\n <span className={style.title}>{`${title} `}</span>\n <div className={style.contentWrapper}>\n <InputPreview\n title={title}\n text={text}\n placeholder={placeholder}\n onChange={handleChange}\n disabled={disabled}\n preview={preview}\n className={style.input}\n />\n </div>\n <span\n data-testid={preview ? 'pencil-icon' : 'preview-icon'}\n className={style.toggle}\n onClick={handlePreview}\n >\n {iconContent}\n </span>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nInputHtml.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n disabled: PropTypes.bool,\n value: PropTypes.string,\n error: PropTypes.string,\n onChange: PropTypes.func,\n description: PropTypes.string\n};\n\nInputHtml.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default InputHtml;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,QAAQ,QAAO,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAElC,SACEC,0BAA0B,IAAIC,WAAW,EACzCC,6BAA6B,IAAIC,UAAU,QACtC,0BAA0B;AACjC,OAAOC,QAAQ,IAAGC,kBAAkB,QAAO,aAAa;AACxD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,SAAS,GAAGA,CAACC,KAAK,EAAEC,aAAa,KAAK;EAC1C,MAAM;IAACC,KAAK,GAAG,EAAE;IAAEC,QAAQ,GAAAC;EAAO,CAAC,GAAGJ,KAAK;EAC3C,MAAM,CAACK,IAAI,EAAEC,OAAO,CAAC,GAAGjB,QAAQ,CAACa,KAAK,CAAC;EACvC,MAAM,CAACK,OAAO,EAAEC,UAAU,CAAC,GAAGnB,QAAQ,CAAC,IAAI,CAAC;EAE5C,MAAMoB,YAAY,GAAGrB,WAAW,CAC9BsB,CAAC,IAAI;IACH,MAAMC,MAAM,GAAGD,CAAC,CAACE,MAAM,CAACV,KAAK;IAC7BI,OAAO,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ACbb,IAAI,EAAEA,IAAK;IACXc,WAAW,EAAEA,WAAY;IACzBhB,QAAQ,EAAEM,YAAa;IACvBa,QAAQ,EAAEA,QAAS;IACnBf,OAAO,EAAEA,OAAQ;IACjBgB,SAAS,EAAEzB,KAAK,CAACgC;EAAM,CACxB,CACE,CAAC,eACN3C,KAAA,CAAAuC,aAAA;IACE,eAAanB,OAAO,GAAG,aAAa,GAAG,cAAe;IACtDgB,SAAS,EAAEzB,KAAK,CAACiC,MAAO;IACxBC,OAAO,EAAEnB;EAAc,GAEtBY,WACG,CACD,CAAC,eACRtC,KAAA,CAAAuC,aAAA;IAAKH,SAAS,EAAEzB,KAAK,CAACuB;EAAY,GAAEA,WAAiB,CAClD,CAAC;AAEV,CAAC;AAEDtB,SAAS,CAACkC,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG;EACpBlB,KAAK,EAAE5B,SAAS,CAAC+C,MAAM;EACvBlB,WAAW,EAAE7B,SAAS,CAAC+C,MAAM;EAC7Bf,QAAQ,EAAEhC,SAAS,CAACgD,IAAI;EACxBpC,KAAK,EAAEZ,SAAS,CAAC+C,MAAM;EACvBjB,KAAK,EAAE9B,SAAS,CAAC+C,MAAM;EACvBlC,QAAQ,EAAEb,SAAS,CAACiD,IAAI;EACxBlB,WAAW,EAAE/B,SAAS,CAAC+C;AACzB,CAAC;AAEDtC,SAAS,CAACyC,YAAY,GAAG;EACvBzB,IAAI,EAAEpB,QAAQ,CAAC8C,iBAAiB,CAAC1B;AACnC,CAAC;AAED,eAAehB,SAAS","ignoreList":[]}
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
@value light from colors;
|
|
5
5
|
@value negative from colors;
|
|
6
6
|
|
|
7
|
-
.
|
|
7
|
+
.defaultStyle {
|
|
8
8
|
display: flex;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.error {
|
|
12
|
-
composes:
|
|
12
|
+
composes: defaultStyle;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.
|
|
15
|
+
.defaultStyle label {
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
position: relative;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputSwitch","props","title","name","id","value","disabled","onChange","_noop","description","modified","theme","titlePosition","details","requiredSelection","dataName","ariaLabelledBy","ariaLabel","idSwitch","_uniqueId","isDisabled","handleChange","e","target","checked","titleView","createElement","className","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputSwitch","props","title","name","id","value","disabled","onChange","_noop","description","modified","theme","titlePosition","details","requiredSelection","dataName","ariaLabelledBy","ariaLabel","idSwitch","_uniqueId","isDisabled","handleChange","e","target","checked","titleView","createElement","className","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","defaultStyle","btnSwitchContainer","_extends","type","checkbox","htmlFor","tabIndex","alignedTextContainer","detailsTxt","propTypes","process","env","NODE_ENV","string","bool","func","oneOf"],"sources":["../../../src/atom/input-switch/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left',\n details = '',\n requiredSelection = false,\n 'data-name': dataName,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-label': ariaLabel\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? (\n <span id={`title-view-${dataName}`} className={style.title}>\n {`${title} `}{' '}\n </span>\n ) : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const getClass = () => {\n switch (theme) {\n case 'coorpmanager':\n return {\n defaultClass: style.coorpmanager,\n modifiedClass: style.coorpmanagerModified\n };\n case 'mooc':\n return {\n defaultClass: style.partielUncheck,\n modifiedClass: style.coorpmanagerModified\n };\n default:\n return {defaultClass: style.defaultStyle, modifiedClass: style.modified};\n }\n };\n const {defaultClass, modifiedClass} = getClass();\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}${dataName}`}>\n {titlePosition === 'left' ? titleView : null}\n <div className={requiredSelection ? style.requiredSelection : null}>\n <div className={style.btnSwitchContainer}>\n <input\n {...(ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {})}\n {...(title ? {'aria-labelledby': `title-view-${dataName}`} : {})}\n {...(ariaLabel && !ariaLabelledBy && !title ? {'aria-label': ariaLabel} : {})}\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n aria-labelledby={ariaLabelledBy}\n />\n <label\n htmlFor={idSwitch}\n data-name=\"input-switch-label\"\n tabIndex={0}\n aria-label={ariaLabel}\n title={ariaLabel}\n />\n </div>\n </div>\n <div className={!details ? style.alignedTextContainer : null}>\n {titlePosition === 'right' ? titleView : null}\n {details ? <div className={style.detailsTxt}>{details}</div> : null}\n </div>\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n 'aria-labelledby': PropTypes.string,\n 'aria-label': PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager', 'mooc']),\n details: PropTypes.string,\n 'data-name': PropTypes.string,\n requiredSelection: PropTypes.bool\n};\nexport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,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;EAC3DtC,OAAO,EAAEhB,SAAS,CAACmD,MAAM;EACzB,WAAW,EAAEnD,SAAS,CAACmD,MAAM;EAC7BlC,iBAAiB,EAAEjB,SAAS,CAACoD;AAC/B,CAAC;AACD,eAAejD,WAAW","ignoreList":[]}
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
@value cm_primary_blue from colors;
|
|
11
11
|
@value light_blue from colors;
|
|
12
12
|
|
|
13
|
-
.
|
|
13
|
+
.defaultStyle {
|
|
14
14
|
display: flex;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.modified {
|
|
18
|
-
composes:
|
|
18
|
+
composes: defaultStyle;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.coorpmanager {
|
|
22
|
-
composes:
|
|
22
|
+
composes: defaultStyle;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.coorpmanagerModified {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
composes: coorpmanager;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.
|
|
33
|
+
.defaultStyle label {
|
|
34
34
|
height: 24px;
|
|
35
35
|
position: relative;
|
|
36
36
|
flex-grow: 0;
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
transition: all 0.3s ease;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.
|
|
45
|
+
.defaultStyle label::after {
|
|
46
46
|
position: absolute;
|
|
47
47
|
left: 2px;
|
|
48
48
|
top: 2px;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
background: positive;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.
|
|
85
|
+
.defaultStyle input:checked ~ label::after {
|
|
86
86
|
left: 30px;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -12,7 +12,7 @@ const themeStyle = {
|
|
|
12
12
|
setup: style.setup,
|
|
13
13
|
coorpmanager: style.coorpmanager,
|
|
14
14
|
cockpit: style.cockpit,
|
|
15
|
-
default: style.
|
|
15
|
+
default: style.defaultStyle
|
|
16
16
|
};
|
|
17
17
|
const InputText = props => {
|
|
18
18
|
const {
|
|
@@ -36,7 +36,7 @@ const InputText = props => {
|
|
|
36
36
|
const isCMTheme = theme === 'coorpmanager';
|
|
37
37
|
const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);
|
|
38
38
|
const mainClass = themeStyle[theme];
|
|
39
|
-
const className = getClassState(style.
|
|
39
|
+
const className = getClassState(style.defaultStyle, style.modified, style.error, modified, error);
|
|
40
40
|
const descriptionView = description && theme !== 'coorpmanager' ? /*#__PURE__*/React.createElement("div", {
|
|
41
41
|
className: style.description
|
|
42
42
|
}, description) : null;
|