@coorpacademy/components 11.14.22 → 11.14.24-alpha.7
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.d.ts +3 -1
- package/es/atom/autocomplete/index.d.ts.map +1 -1
- package/es/atom/autocomplete/index.js +45 -17
- package/es/atom/autocomplete/index.js.map +1 -1
- package/es/atom/autocomplete/style.css +150 -1
- package/es/atom/input-switch/index.d.ts.map +1 -1
- package/es/atom/input-switch/index.js +3 -1
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/molecule/brand-form-group/index.d.ts +3 -1
- package/es/molecule/select-multiple/style.css +1 -1
- package/es/organism/brand-form/index.d.ts +4 -1
- package/es/organism/brand-form/index.d.ts.map +1 -1
- package/es/organism/brand-form/index.js +17 -7
- package/es/organism/brand-form/index.js.map +1 -1
- package/es/organism/user-preferences/index.js +3 -1
- package/es/organism/user-preferences/index.js.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +4 -1
- package/es/template/back-office/brand-update/index.d.ts +4 -1
- package/lib/atom/autocomplete/index.d.ts +3 -1
- package/lib/atom/autocomplete/index.d.ts.map +1 -1
- package/lib/atom/autocomplete/index.js +48 -16
- package/lib/atom/autocomplete/index.js.map +1 -1
- package/lib/atom/autocomplete/style.css +150 -1
- package/lib/atom/input-switch/index.d.ts.map +1 -1
- package/lib/atom/input-switch/index.js +3 -1
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/molecule/brand-form-group/index.d.ts +3 -1
- package/lib/molecule/select-multiple/style.css +1 -1
- package/lib/organism/brand-form/index.d.ts +4 -1
- package/lib/organism/brand-form/index.d.ts.map +1 -1
- package/lib/organism/brand-form/index.js +18 -7
- package/lib/organism/brand-form/index.js.map +1 -1
- package/lib/organism/user-preferences/index.js +3 -1
- package/lib/organism/user-preferences/index.js.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +4 -1
- package/lib/template/back-office/brand-update/index.d.ts +4 -1
- package/locales/.mtslconfig.json +1 -0
- package/package.json +2 -2
|
@@ -9,11 +9,13 @@ declare namespace Autocomplete {
|
|
|
9
9
|
const required: PropTypes.Requireable<boolean>;
|
|
10
10
|
const modified: PropTypes.Requireable<boolean>;
|
|
11
11
|
const error: PropTypes.Requireable<boolean>;
|
|
12
|
+
const errorMessage: PropTypes.Requireable<string>;
|
|
12
13
|
const suggestions: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
13
14
|
name: PropTypes.Requireable<string>;
|
|
14
15
|
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
15
16
|
}> | null | undefined)[]>;
|
|
16
|
-
const
|
|
17
|
+
const theme: PropTypes.Requireable<string>;
|
|
18
|
+
const onInput: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
19
|
const onFetch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
20
|
const onClear: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
21
|
const onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/autocomplete/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/autocomplete/index.js"],"names":[],"mappings":";AAgBA,uDA8FC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import _keys from "lodash/fp/keys";
|
|
2
|
+
import _isEmpty from "lodash/fp/isEmpty";
|
|
1
3
|
import _isNil from "lodash/fp/isNil";
|
|
2
4
|
import _noop from "lodash/fp/noop";
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
6
|
import Autosuggest from 'react-autosuggest';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import classnames from 'classnames';
|
|
9
|
+
import { NovaSolidStatusClose as ErrorIcon } from '@coorpacademy/nova-icons';
|
|
7
10
|
import getClassState from '../../util/get-class-state';
|
|
8
11
|
import style from './style.css';
|
|
12
|
+
const THEME_STYLE = {
|
|
13
|
+
coorpmanager: style.coorpmanager,
|
|
14
|
+
default: style.default
|
|
15
|
+
};
|
|
9
16
|
|
|
10
17
|
const renderSuggestion = suggestion => /*#__PURE__*/React.createElement("span", null, suggestion.name);
|
|
11
18
|
|
|
@@ -17,32 +24,51 @@ const Autocomplete = props => {
|
|
|
17
24
|
required,
|
|
18
25
|
modified = false,
|
|
19
26
|
error = false,
|
|
27
|
+
errorMessage,
|
|
20
28
|
suggestions = [],
|
|
21
|
-
|
|
29
|
+
onInput = _noop,
|
|
22
30
|
onFetch = _noop,
|
|
23
31
|
onClear = _noop,
|
|
24
32
|
onBlur = _noop,
|
|
25
33
|
onSuggestionSelected = _noop,
|
|
26
|
-
title: propsTitle
|
|
34
|
+
title: propsTitle,
|
|
35
|
+
theme = 'default'
|
|
27
36
|
} = props;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
37
|
+
const mainClass = THEME_STYLE[theme];
|
|
38
|
+
const title = useMemo(() => `${propsTitle}${required ? '*' : ''}`, [propsTitle, required]);
|
|
39
|
+
const className = useMemo(() => getClassState(style.default, style.modified, style.error, modified, error), [modified, error]);
|
|
40
|
+
const handleInput = useCallback(e => {
|
|
41
|
+
onInput(e);
|
|
42
|
+
}, [onInput]);
|
|
43
|
+
const handleBlur = useCallback((e, selectedSuggestion) => onBlur(e, selectedSuggestion), [onBlur]);
|
|
44
|
+
const handleSuggestionsFetchRequested = useCallback(e => onFetch(e), [onFetch]);
|
|
45
|
+
const handleSuggestionsClearRequested = useCallback(e => onClear(e), [onClear]);
|
|
46
|
+
const handleSuggestionsSelected = useCallback((e, data) => onSuggestionSelected(data), [onSuggestionSelected]);
|
|
35
47
|
const inputProps = {
|
|
36
48
|
placeholder,
|
|
37
49
|
value,
|
|
38
|
-
onChange:
|
|
39
|
-
onBlur: handleBlur
|
|
50
|
+
onChange: _noop,
|
|
51
|
+
onBlur: handleBlur,
|
|
52
|
+
onInput: handleInput,
|
|
53
|
+
'data-testid': 'autocomplete-input'
|
|
40
54
|
};
|
|
55
|
+
const errorIconView = theme === 'coorpmanager' && error ? /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
56
|
+
className: style.leftIcon
|
|
57
|
+
}) : null;
|
|
58
|
+
const errorText = theme === 'coorpmanager' && error ? /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: style.errorText // eslint-disable-next-line react/no-danger
|
|
60
|
+
,
|
|
61
|
+
dangerouslySetInnerHTML: {
|
|
62
|
+
__html: errorMessage
|
|
63
|
+
}
|
|
64
|
+
}) : null;
|
|
41
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className: classnames(className, _isNil(
|
|
66
|
+
className: classnames(mainClass, className, _isNil(propsTitle) && style.isNoTitle)
|
|
43
67
|
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("span", {
|
|
44
|
-
className: style.title
|
|
45
|
-
}, title), /*#__PURE__*/React.createElement("div",
|
|
68
|
+
className: classnames(style.title, _isEmpty(value) && style.noValue)
|
|
69
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: style.inputContainer
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Autosuggest, {
|
|
46
72
|
theme: {
|
|
47
73
|
container: style.container,
|
|
48
74
|
input: style.input,
|
|
@@ -60,7 +86,7 @@ const Autocomplete = props => {
|
|
|
60
86
|
inputProps: inputProps,
|
|
61
87
|
focusInputOnSuggestionClick: false,
|
|
62
88
|
onSuggestionSelected: handleSuggestionsSelected
|
|
63
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
}), errorIconView, errorText)), /*#__PURE__*/React.createElement("div", {
|
|
64
90
|
className: style.description
|
|
65
91
|
}, description));
|
|
66
92
|
};
|
|
@@ -73,11 +99,13 @@ Autocomplete.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
73
99
|
required: PropTypes.bool,
|
|
74
100
|
modified: PropTypes.bool,
|
|
75
101
|
error: PropTypes.bool,
|
|
102
|
+
errorMessage: PropTypes.string,
|
|
76
103
|
suggestions: PropTypes.arrayOf(PropTypes.shape({
|
|
77
104
|
name: PropTypes.string,
|
|
78
105
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
79
106
|
})),
|
|
80
|
-
|
|
107
|
+
theme: PropTypes.oneOf(_keys(THEME_STYLE)),
|
|
108
|
+
onInput: PropTypes.func,
|
|
81
109
|
onFetch: PropTypes.func,
|
|
82
110
|
onClear: PropTypes.func,
|
|
83
111
|
onBlur: PropTypes.func,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","Autosuggest","PropTypes","classnames","getClassState","style","renderSuggestion","suggestion","name","Autocomplete","props","placeholder","value","description","required","modified","error","suggestions","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","Autosuggest","PropTypes","classnames","NovaSolidStatusClose","ErrorIcon","getClassState","style","THEME_STYLE","coorpmanager","default","renderSuggestion","suggestion","name","Autocomplete","props","placeholder","value","description","required","modified","error","errorMessage","suggestions","onInput","onFetch","onClear","onBlur","onSuggestionSelected","title","propsTitle","theme","mainClass","className","handleInput","e","handleBlur","selectedSuggestion","handleSuggestionsFetchRequested","handleSuggestionsClearRequested","handleSuggestionsSelected","data","inputProps","onChange","errorIconView","leftIcon","errorText","__html","isNoTitle","noValue","inputContainer","container","input","suggestionsContainer","suggestionsContainerOpen","suggestionsList","suggestionHighlighted","propTypes","string","bool","arrayOf","shape","oneOfType","number","oneOf","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 {NovaSolidStatusClose as ErrorIcon} 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 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)}>{title}</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 <div className={style.description}>{description}</div>\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,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,QAA0C,OAA1C;AACA,OAAOC,WAAP,MAAwB,mBAAxB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,oBAAoB,IAAIC,SAAhC,QAAgD,0BAAhD;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,WAAW,GAAG;EAClBC,YAAY,EAAEF,KAAK,CAACE,YADF;EAElBC,OAAO,EAAEH,KAAK,CAACG;AAFG,CAApB;;AAKA,MAAMC,gBAAgB,GAAGC,UAAU,iBAAI,kCAAOA,UAAU,CAACC,IAAlB,CAAvC;;AAEA,MAA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BxC,OAAO,EAAEvB,SAAS,CAAC+D,IAjBI;EAkBvBvC,OAAO,EAAExB,SAAS,CAAC+D,IAlBI;EAmBvBtC,MAAM,EAAEzB,SAAS,CAAC+D,IAnBK;EAoBvBrC,oBAAoB,EAAE1B,SAAS,CAAC+D;AApBT,CAAzB;AAuBA,eAAenD,YAAf"}
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
@value dark from colors;
|
|
6
6
|
@value medium from colors;
|
|
7
7
|
@value white from colors;
|
|
8
|
+
@value cm_positive_100 from colors;
|
|
9
|
+
@value cm_negative_100 from colors;
|
|
10
|
+
@value cm_grey_100 from colors;
|
|
11
|
+
@value cm_grey_150 from colors;
|
|
12
|
+
@value cm_grey_400 from colors;
|
|
13
|
+
@value cm_grey_700 from colors;
|
|
8
14
|
|
|
9
15
|
.default {
|
|
10
16
|
display: flex;
|
|
@@ -127,4 +133,147 @@
|
|
|
127
133
|
|
|
128
134
|
.suggestionHighlighted {
|
|
129
135
|
background-color: #ddd;
|
|
130
|
-
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/******************************* coorpmanager theme ***************************************/
|
|
139
|
+
|
|
140
|
+
.coorpmanager {
|
|
141
|
+
width: 100%;
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: flex-start;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
flex-wrap: nowrap;
|
|
146
|
+
position: relative;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.coorpmanager label {
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 100%;
|
|
152
|
+
margin-right: 0;
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: flex-start;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
position: relative;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.coorpmanager .title {
|
|
160
|
+
flex-grow: 0;
|
|
161
|
+
font-family: Gilroy;
|
|
162
|
+
font-size: 10px;
|
|
163
|
+
font-weight: bold;
|
|
164
|
+
font-stretch: normal;
|
|
165
|
+
font-style: normal;
|
|
166
|
+
line-height: 1.2;
|
|
167
|
+
letter-spacing: normal;
|
|
168
|
+
text-align: left;
|
|
169
|
+
z-index: 1;
|
|
170
|
+
color: cm_grey_400;
|
|
171
|
+
width: auto;
|
|
172
|
+
transition: all 0.25s linear;
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: row;
|
|
176
|
+
flex-wrap: nowrap;
|
|
177
|
+
position: absolute;
|
|
178
|
+
top: 7px;
|
|
179
|
+
left: 16px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.coorpmanager .title.noValue{
|
|
183
|
+
font-size: 14px;
|
|
184
|
+
font-weight: 500;
|
|
185
|
+
color: cm_grey_700;
|
|
186
|
+
top: 14px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.coorpmanager:focus-within .title.noValue {
|
|
190
|
+
font-size: 10px;
|
|
191
|
+
font-weight: bold;
|
|
192
|
+
color: cm_grey_400;
|
|
193
|
+
top: 7px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.coorpmanager .inputContainer {
|
|
197
|
+
width: 100%
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.coorpmanager input {
|
|
201
|
+
width: 100%;
|
|
202
|
+
height: 44px;
|
|
203
|
+
margin: 0px;
|
|
204
|
+
display: flex;
|
|
205
|
+
align-items: flex-start;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
flex-grow: 0;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
background-color: cm_grey_100;
|
|
210
|
+
box-sizing: border-box;
|
|
211
|
+
border: none;
|
|
212
|
+
border-radius: 7px;
|
|
213
|
+
color: cm_grey_700;
|
|
214
|
+
font-family: Gilroy;
|
|
215
|
+
font-size: 14px;
|
|
216
|
+
font-weight: 500;
|
|
217
|
+
font-stretch: normal;
|
|
218
|
+
font-style: normal;
|
|
219
|
+
line-height: 44px;
|
|
220
|
+
letter-spacing: normal;
|
|
221
|
+
outline: none;
|
|
222
|
+
padding: 19px 30px 5px 16px;
|
|
223
|
+
text-align: left;
|
|
224
|
+
transition: all 0.25s linear;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.coorpmanager .suggestionsContainerOpen {
|
|
228
|
+
width: 100%;
|
|
229
|
+
margin-left: 0;
|
|
230
|
+
border-radius: 7px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.coorpmanager:focus-within input::placeholder {
|
|
234
|
+
color: cm_grey_400;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.coorpmanager .suggestionsList {
|
|
238
|
+
border-radius: 7px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.coorpmanager .suggestionHighlighted {
|
|
242
|
+
border-radius: 5px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.coorpmanager input::placeholder {
|
|
246
|
+
color: transparent;
|
|
247
|
+
transition: color 0.25s linear;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.coorpmanager input:hover {
|
|
251
|
+
background-color: cm_grey_150;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.coorpmanager.error .leftIcon {
|
|
255
|
+
background-color: cm_negative_100;
|
|
256
|
+
color: white;
|
|
257
|
+
border-radius: 50%;
|
|
258
|
+
padding: 2px;
|
|
259
|
+
width: 10px;
|
|
260
|
+
height: 10px;
|
|
261
|
+
position: absolute;
|
|
262
|
+
right: 17px;
|
|
263
|
+
top: 14px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.coorpmanager .errorText {
|
|
267
|
+
flex-grow: 0;
|
|
268
|
+
opacity: 0.5;
|
|
269
|
+
font-family: Gilroy;
|
|
270
|
+
font-size: 10px;
|
|
271
|
+
font-weight: 500;
|
|
272
|
+
font-stretch: normal;
|
|
273
|
+
font-style: normal;
|
|
274
|
+
line-height: 1.2;
|
|
275
|
+
letter-spacing: normal;
|
|
276
|
+
text-align: left;
|
|
277
|
+
padding-top: 8px;
|
|
278
|
+
color: cm_negative_100;
|
|
279
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-switch/index.js"],"names":[],"mappings":";AAMA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-switch/index.js"],"names":[],"mappings":";AAMA,sDAsFC"}
|
|
@@ -91,7 +91,9 @@ const InputSwitch = props => {
|
|
|
91
91
|
})), /*#__PURE__*/React.createElement("label", {
|
|
92
92
|
htmlFor: idSwitch,
|
|
93
93
|
"data-name": "input-switch-label",
|
|
94
|
-
tabIndex: 0
|
|
94
|
+
tabIndex: 0,
|
|
95
|
+
"aria-label": ariaLabel,
|
|
96
|
+
title: ariaLabel
|
|
95
97
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
96
98
|
className: !details ? style.alignedTextContainer : null
|
|
97
99
|
}, titlePosition === 'right' ? titleView : null, details ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","dataName","ariaLabelledBy","ariaLabel","idSwitch","isDisabled","handleChange","e","target","checked","titleView","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","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.default, 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
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","dataName","ariaLabelledBy","ariaLabel","idSwitch","isDisabled","handleChange","e","target","checked","titleView","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","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.default, 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 default InputSwitch;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,KADI;IAEJC,IAFI;IAGJC,EAHI;IAIJC,KAJI;IAKJC,QALI;IAMJC,QAAQ,QANJ;IAOJC,WAPI;IAQJC,QAAQ,GAAG,KARP;IASJC,KAAK,GAAG,SATJ;IAUJC,aAAa,GAAG,MAVZ;IAWJC,OAAO,GAAG,EAXN;IAYJC,iBAAiB,GAAG,KAZhB;IAaJ,aAAaC,QAbT;IAcJ,mBAAmBC,cAdf;IAeJ,cAAcC;EAfV,IAgBFf,KAhBJ;;EAkBA,MAAMgB,QAAQ,GAAGb,EAAE,IAAI,UAAS,eAAT,CAAvB;;EACA,MAAMc,UAAU,GAAGZ,QAAQ,GAAG,UAAH,GAAgB,EAA3C;EACA,MAAMa,YAAY,GAAGvB,OAAO,CAAC,MAAMwB,CAAC,IAAIb,QAAQ,CAACa,CAAC,CAACC,MAAF,CAASC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Q,EAAEZ,SAAS,CAAC0C,IAVE;EAWtB5B,aAAa,EAAEd,SAAS,CAAC4C,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CAXO;EAYtB/B,KAAK,EAAEb,SAAS,CAAC4C,KAAV,CAAgB,CAAC,SAAD,EAAY,cAAZ,EAA4B,MAA5B,CAAhB,CAZe;EAatB7B,OAAO,EAAEf,SAAS,CAACyC,MAbG;EActB,aAAazC,SAAS,CAACyC,MAdD;EAetBzB,iBAAiB,EAAEhB,SAAS,CAAC0C;AAfP,CAAxB;AAiBA,eAAevC,WAAf"}
|
|
@@ -33,11 +33,13 @@ declare namespace BrandFormGroup {
|
|
|
33
33
|
required: PropTypes.Requireable<boolean>;
|
|
34
34
|
modified: PropTypes.Requireable<boolean>;
|
|
35
35
|
error: PropTypes.Requireable<boolean>;
|
|
36
|
+
errorMessage: PropTypes.Requireable<string>;
|
|
36
37
|
suggestions: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
37
38
|
name: PropTypes.Requireable<string>;
|
|
38
39
|
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
39
40
|
}> | null | undefined)[]>;
|
|
40
|
-
|
|
41
|
+
theme: PropTypes.Requireable<string>;
|
|
42
|
+
onInput: PropTypes.Requireable<(...args: any[]) => any>;
|
|
41
43
|
onFetch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
44
|
onClear: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
45
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -63,11 +63,13 @@ declare namespace BrandForm {
|
|
|
63
63
|
required: PropTypes.Requireable<boolean>;
|
|
64
64
|
modified: PropTypes.Requireable<boolean>;
|
|
65
65
|
error: PropTypes.Requireable<boolean>;
|
|
66
|
+
errorMessage: PropTypes.Requireable<string>;
|
|
66
67
|
suggestions: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
67
68
|
name: PropTypes.Requireable<string>;
|
|
68
69
|
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
69
70
|
}> | null | undefined)[]>;
|
|
70
|
-
|
|
71
|
+
theme: PropTypes.Requireable<string>;
|
|
72
|
+
onInput: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
73
|
onFetch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
74
|
onClear: PropTypes.Requireable<(...args: any[]) => any>;
|
|
73
75
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -510,6 +512,7 @@ declare namespace BrandForm {
|
|
|
510
512
|
}>>;
|
|
511
513
|
export { tooltip_1 as tooltip };
|
|
512
514
|
export const isLoading: PropTypes.Requireable<boolean>;
|
|
515
|
+
export const theme: PropTypes.Requireable<string>;
|
|
513
516
|
}
|
|
514
517
|
}
|
|
515
518
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/brand-form/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/brand-form/index.js"],"names":[],"mappings":";AA6DA,kEA+EC"}
|
|
@@ -5,11 +5,12 @@ import { NovaCompositionNavigationArrowLeft as ArrowLeft } from '@coorpacademy/n
|
|
|
5
5
|
import BrandFormGroup from '../../molecule/brand-form-group';
|
|
6
6
|
import Provider from '../../atom/provider';
|
|
7
7
|
import Button from '../../atom/button';
|
|
8
|
+
import ButtonLink from '../../atom/button-link';
|
|
8
9
|
import Link from '../../atom/link';
|
|
9
10
|
import Loader from '../../atom/loader';
|
|
10
11
|
import style from './style.css';
|
|
11
12
|
|
|
12
|
-
const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor) => {
|
|
13
|
+
const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor, theme) => {
|
|
13
14
|
if (!onSubmit && !onReset) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
@@ -19,7 +20,14 @@ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip,
|
|
|
19
20
|
"data-tip": tooltip.title,
|
|
20
21
|
"data-for": "submitButton",
|
|
21
22
|
className: style.saveButton
|
|
22
|
-
}, /*#__PURE__*/React.createElement(
|
|
23
|
+
}, theme === 'cm' ? /*#__PURE__*/React.createElement(ButtonLink, {
|
|
24
|
+
type: "primary",
|
|
25
|
+
label: submitValue,
|
|
26
|
+
disabled: disabledSubmit,
|
|
27
|
+
"data-testid": "submit-button",
|
|
28
|
+
buttonType: "submit",
|
|
29
|
+
onClick: onSubmit
|
|
30
|
+
}) : /*#__PURE__*/React.createElement(Button, {
|
|
23
31
|
type: "submit",
|
|
24
32
|
disabled: disabledSubmit,
|
|
25
33
|
submitValue: submitValue
|
|
@@ -39,7 +47,7 @@ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip,
|
|
|
39
47
|
}, submitButton, resetButton);
|
|
40
48
|
};
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
const BrandForm = (props, context) => {
|
|
43
51
|
const {
|
|
44
52
|
groups,
|
|
45
53
|
disabled,
|
|
@@ -51,7 +59,8 @@ function BrandForm(props, context) {
|
|
|
51
59
|
resetValue,
|
|
52
60
|
back,
|
|
53
61
|
tooltip,
|
|
54
|
-
isLoading
|
|
62
|
+
isLoading,
|
|
63
|
+
theme
|
|
55
64
|
} = props;
|
|
56
65
|
const {
|
|
57
66
|
skin
|
|
@@ -76,7 +85,7 @@ function BrandForm(props, context) {
|
|
|
76
85
|
key: index
|
|
77
86
|
}, /*#__PURE__*/React.createElement(BrandFormGroup, group));
|
|
78
87
|
});
|
|
79
|
-
const buttonSection = buildButtonSection(onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor);
|
|
88
|
+
const buttonSection = buildButtonSection(onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor, theme);
|
|
80
89
|
const handleSubmit = useMemo(() => e => {
|
|
81
90
|
e.preventDefault();
|
|
82
91
|
return onSubmit(e);
|
|
@@ -95,7 +104,7 @@ function BrandForm(props, context) {
|
|
|
95
104
|
onReset: handleReset,
|
|
96
105
|
className: style.form
|
|
97
106
|
}, brandGroups, buttonSection));
|
|
98
|
-
}
|
|
107
|
+
};
|
|
99
108
|
|
|
100
109
|
BrandForm.contextTypes = {
|
|
101
110
|
skin: Provider.childContextTypes.skin
|
|
@@ -123,7 +132,8 @@ BrandForm.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
123
132
|
title: PropTypes.string,
|
|
124
133
|
place: PropTypes.string
|
|
125
134
|
}),
|
|
126
|
-
isLoading: PropTypes.bool
|
|
135
|
+
isLoading: PropTypes.bool,
|
|
136
|
+
theme: PropTypes.string
|
|
127
137
|
} : {};
|
|
128
138
|
export default BrandForm;
|
|
129
139
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","NovaCompositionNavigationArrowLeft","ArrowLeft","BrandFormGroup","Provider","Button","Link","Loader","style","buildButtonSection","onSubmit","submitValue","onReset","resetValue","tooltip","disabled","isModified","isPending","darkColor","disabledSubmit","submitButton","title","saveButton","cancelBackground","backgroundColor","resetButton","buttons","BrandForm","props","context","groups","back","isLoading","skin","backView","color","arrowBack","link","backDesc","desc","brandGroups","map","group","index","buttonSection","handleSubmit","e","preventDefault","handleReset","loaderContainer","loader","form","contextTypes","childContextTypes","defaultProps","place","propTypes","arrayOf","shape","isRequired","bool","func","children","href","string"],"sources":["../../../src/organism/brand-form/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowLeft as ArrowLeft} from '@coorpacademy/nova-icons';\nimport BrandFormGroup from '../../molecule/brand-form-group';\nimport Provider from '../../atom/provider';\nimport Button from '../../atom/button';\nimport Link from '../../atom/link';\nimport Loader from '../../atom/loader';\nimport style from './style.css';\n\nconst buildButtonSection = (\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor\n) => {\n if (!onSubmit && !onReset) {\n return null;\n }\n\n const disabledSubmit = disabled || isPending || !isModified;\n const submitButton = onSubmit ? (\n <div data-tip={tooltip.title} data-for=\"submitButton\" className={style.saveButton}>\n <Button type=\"submit\" disabled={disabledSubmit} submitValue={submitValue} />\n </div>\n ) : null;\n\n const cancelBackground = {backgroundColor: darkColor};\n\n const resetButton = onReset ? (\n <div className={style.resetButton}>\n <Button type=\"reset\" submitValue={resetValue} style={cancelBackground} />\n </div>\n ) : null;\n\n return (\n <div className={style.buttons}>\n {submitButton}\n {resetButton}\n </div>\n );\n};\
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","NovaCompositionNavigationArrowLeft","ArrowLeft","BrandFormGroup","Provider","Button","ButtonLink","Link","Loader","style","buildButtonSection","onSubmit","submitValue","onReset","resetValue","tooltip","disabled","isModified","isPending","darkColor","theme","disabledSubmit","submitButton","title","saveButton","cancelBackground","backgroundColor","resetButton","buttons","BrandForm","props","context","groups","back","isLoading","skin","backView","color","arrowBack","link","backDesc","desc","brandGroups","map","group","index","buttonSection","handleSubmit","e","preventDefault","handleReset","loaderContainer","loader","form","contextTypes","childContextTypes","defaultProps","place","propTypes","arrayOf","shape","isRequired","bool","func","children","href","string"],"sources":["../../../src/organism/brand-form/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowLeft as ArrowLeft} from '@coorpacademy/nova-icons';\nimport BrandFormGroup from '../../molecule/brand-form-group';\nimport Provider from '../../atom/provider';\nimport Button from '../../atom/button';\nimport ButtonLink from '../../atom/button-link';\nimport Link from '../../atom/link';\nimport Loader from '../../atom/loader';\nimport style from './style.css';\n\nconst buildButtonSection = (\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor,\n theme\n) => {\n if (!onSubmit && !onReset) {\n return null;\n }\n\n const disabledSubmit = disabled || isPending || !isModified;\n const submitButton = onSubmit ? (\n <div data-tip={tooltip.title} data-for=\"submitButton\" className={style.saveButton}>\n {theme === 'cm' ? (\n <ButtonLink\n type=\"primary\"\n label={submitValue}\n disabled={disabledSubmit}\n data-testid=\"submit-button\"\n buttonType=\"submit\"\n onClick={onSubmit}\n />\n ) : (\n <Button type=\"submit\" disabled={disabledSubmit} submitValue={submitValue} />\n )}\n </div>\n ) : null;\n\n const cancelBackground = {backgroundColor: darkColor};\n\n const resetButton = onReset ? (\n <div className={style.resetButton}>\n <Button type=\"reset\" submitValue={resetValue} style={cancelBackground} />\n </div>\n ) : null;\n\n return (\n <div className={style.buttons}>\n {submitButton}\n {resetButton}\n </div>\n );\n};\nconst BrandForm = (props, context) => {\n const {\n groups,\n disabled,\n isModified,\n isPending,\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n back,\n tooltip,\n isLoading,\n theme\n } = props;\n const {skin} = context;\n const darkColor = get('common.dark', skin);\n\n const backView = back ? (\n <p className={style.back}>\n <ArrowLeft style={{color: darkColor}} className={style.arrowBack} />\n <Link href={back.link} className={style.backDesc}>\n {back.desc}\n </Link>\n </p>\n ) : null;\n\n const brandGroups = groups.map((group, index) => {\n return (\n <div className={style.group} key={index}>\n <BrandFormGroup {...group} />\n </div>\n );\n });\n\n const buttonSection = buildButtonSection(\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor,\n theme\n );\n\n const handleSubmit = useMemo(\n () => e => {\n e.preventDefault();\n return onSubmit(e);\n },\n [onSubmit]\n );\n\n const handleReset = useMemo(\n () => e => {\n e.preventDefault();\n return onReset(e);\n },\n [onReset]\n );\n\n return (\n <div>\n {backView}\n {isLoading ? (\n <div className={style.loaderContainer}>\n <Loader className={style.loader} theme=\"coorpmanager\" />\n </div>\n ) : (\n <form onSubmit={handleSubmit} onReset={handleReset} className={style.form}>\n {brandGroups}\n {buttonSection}\n </form>\n )}\n </div>\n );\n};\n\nBrandForm.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBrandForm.defaultProps = {\n tooltip: {\n title: '',\n place: 'top'\n }\n};\n\nBrandForm.propTypes = {\n groups: PropTypes.arrayOf(PropTypes.shape(BrandFormGroup.propTypes)).isRequired,\n disabled: PropTypes.bool,\n isModified: PropTypes.bool,\n isPending: PropTypes.bool,\n onSubmit: PropTypes.func,\n submitValue: Button.propTypes.submitValue,\n onReset: PropTypes.func,\n resetValue: Button.propTypes.submitValue,\n back: PropTypes.shape({\n desc: Link.propTypes.children,\n link: Link.propTypes.href\n }),\n tooltip: PropTypes.shape({\n title: PropTypes.string,\n place: PropTypes.string\n }),\n isLoading: PropTypes.bool,\n theme: PropTypes.string\n};\n\nexport default BrandForm;\n"],"mappings":";AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,cAAP,MAA2B,iCAA3B;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,kBAAkB,GAAG,CACzBC,QADyB,EAEzBC,WAFyB,EAGzBC,OAHyB,EAIzBC,UAJyB,EAKzBC,OALyB,EAMzBC,QANyB,EAOzBC,UAPyB,EAQzBC,SARyB,EASzBC,SATyB,EAUzBC,KAVyB,KAWtB;EACH,IAAI,CAACT,QAAD,IAAa,CAACE,OAAlB,EAA2B;IACzB,OAAO,IAAP;EACD;;EAED,MAAMQ,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,SAAS,EAAElC,SAAS,CAAC8D,IAjBD;EAkBpB1C,KAAK,EAAEpB,SAAS,CAACkE;AAlBG,CAAtB;AAqBA,eAAerC,SAAf"}
|
|
@@ -25,7 +25,9 @@ const Settings = (props, legacyContext) => {
|
|
|
25
25
|
|
|
26
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
27
|
className: style.settings
|
|
28
|
-
}, /*#__PURE__*/React.createElement(InputSwitch,
|
|
28
|
+
}, /*#__PURE__*/React.createElement(InputSwitch, _extends({}, settings, {
|
|
29
|
+
'aria-label': label
|
|
30
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
29
31
|
className: style.label,
|
|
30
32
|
tabIndex: 0
|
|
31
33
|
}, label), isEmpty(description) ? null : /*#__PURE__*/React.createElement(ToolTip, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","isEmpty","map","Provider","GetTranslateFromContext","ToolTip","InputSwitch","style","Settings","props","legacyContext","translate","label","description","moreInfoAriaLabel","settings","infoIconTooltip","propTypes","string","isRequired","contextTypes","childContextTypes","UserPreferences","preferences","groupAriaLabel","arrayOf","shape"],"sources":["../../../src/organism/user-preferences/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip from '../../atom/tooltip';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst Settings = (props, legacyContext) => {\n const translate = GetTranslateFromContext(legacyContext);\n const {label, description, moreInfoAriaLabel, ...settings} = props;\n return (\n <div className={style.settings}>\n <InputSwitch {...settings} />\n <span className={style.label} tabIndex={0}>\n {label}\n </span>\n {isEmpty(description) ? null : (\n <ToolTip\n TooltipContent={description}\n closeToolTipInformationTextAriaLabel={translate(\n 'Press the escape key to close the information text'\n )}\n data-testid=\"user-preferences-tooltip\"\n aria-label={moreInfoAriaLabel}\n iconContainerClassName={style.infoIconTooltip}\n fontSize={12}\n />\n )}\n </div>\n );\n};\n\nSettings.propTypes = {\n ...InputSwitch.propTypes,\n label: PropTypes.string.isRequired,\n description: PropTypes.string\n};\n\nSettings.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nconst UserPreferences = props => {\n const {preferences, moreInfoAriaLabel, groupAriaLabel} = props;\n\n return (\n <form>\n <div className={style.preferences} role=\"group\" aria-label={groupAriaLabel} tabIndex={0}>\n {map(\n settings => (\n <Settings {...settings} key={settings.label} moreInfoAriaLabel={moreInfoAriaLabel} />\n ),\n preferences\n )}\n </div>\n </form>\n );\n};\n\nUserPreferences.propTypes = {\n preferences: PropTypes.arrayOf(PropTypes.shape(Settings.propTypes)),\n moreInfoAriaLabel: PropTypes.string,\n groupAriaLabel: PropTypes.string\n};\n\nexport default UserPreferences;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,QAAP,IAAkBC,uBAAlB,QAAgD,qBAAhD;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EACzC,MAAMC,SAAS,GAAGP,uBAAuB,CAACM,aAAD,CAAzC;;EACA,MAAM;IAACE,KAAD;IAAQC,WAAR;IAAqBC;EAArB,IAAuDL,KAA7D;EAAA,MAAiDM,QAAjD,iCAA6DN,KAA7D;;EACA,oBACE;IAAK,SAAS,EAAEF,KAAK,CAACQ;EAAtB,gBACE,oBAAC,WAAD,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","isEmpty","map","Provider","GetTranslateFromContext","ToolTip","InputSwitch","style","Settings","props","legacyContext","translate","label","description","moreInfoAriaLabel","settings","infoIconTooltip","propTypes","string","isRequired","contextTypes","childContextTypes","UserPreferences","preferences","groupAriaLabel","arrayOf","shape"],"sources":["../../../src/organism/user-preferences/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip from '../../atom/tooltip';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst Settings = (props, legacyContext) => {\n const translate = GetTranslateFromContext(legacyContext);\n const {label, description, moreInfoAriaLabel, ...settings} = props;\n return (\n <div className={style.settings}>\n <InputSwitch {...{...settings, 'aria-label': label}} />\n <span className={style.label} tabIndex={0}>\n {label}\n </span>\n {isEmpty(description) ? null : (\n <ToolTip\n TooltipContent={description}\n closeToolTipInformationTextAriaLabel={translate(\n 'Press the escape key to close the information text'\n )}\n data-testid=\"user-preferences-tooltip\"\n aria-label={moreInfoAriaLabel}\n iconContainerClassName={style.infoIconTooltip}\n fontSize={12}\n />\n )}\n </div>\n );\n};\n\nSettings.propTypes = {\n ...InputSwitch.propTypes,\n label: PropTypes.string.isRequired,\n description: PropTypes.string\n};\n\nSettings.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nconst UserPreferences = props => {\n const {preferences, moreInfoAriaLabel, groupAriaLabel} = props;\n\n return (\n <form>\n <div className={style.preferences} role=\"group\" aria-label={groupAriaLabel} tabIndex={0}>\n {map(\n settings => (\n <Settings {...settings} key={settings.label} moreInfoAriaLabel={moreInfoAriaLabel} />\n ),\n preferences\n )}\n </div>\n </form>\n );\n};\n\nUserPreferences.propTypes = {\n preferences: PropTypes.arrayOf(PropTypes.shape(Settings.propTypes)),\n moreInfoAriaLabel: PropTypes.string,\n groupAriaLabel: PropTypes.string\n};\n\nexport default UserPreferences;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,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