@coorpacademy/components 11.41.0 → 11.42.1
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/radio-group/index.d.ts +13 -7
- package/es/atom/radio-group/index.d.ts.map +1 -1
- package/es/atom/radio-group/index.js +51 -0
- package/es/atom/radio-group/index.js.map +1 -1
- package/es/atom/radio-group/style.css +37 -0
- package/es/molecule/assignment-status-tag/index.d.ts.map +1 -1
- package/es/molecule/assignment-status-tag/index.js +5 -0
- package/es/molecule/assignment-status-tag/index.js.map +1 -1
- package/es/molecule/draggable-list/index.d.ts +6 -0
- package/es/molecule/setup-section/index.d.ts +6 -0
- package/es/molecule/setup-sections/index.d.ts +6 -0
- package/es/organism/assignment-audience/index.d.ts +23 -11
- package/es/organism/assignment-audience/index.d.ts.map +1 -1
- package/es/organism/assignment-audience/index.js +100 -59
- package/es/organism/assignment-audience/index.js.map +1 -1
- package/es/organism/assignment-audience/types.d.ts +39 -15
- package/es/organism/assignment-audience/types.d.ts.map +1 -1
- package/es/organism/assignment-audience/types.js +17 -5
- package/es/organism/assignment-audience/types.js.map +1 -1
- package/es/organism/assignment-audience/upload-result.d.ts.map +1 -1
- package/es/organism/assignment-audience/upload-result.js +4 -7
- package/es/organism/assignment-audience/upload-result.js.map +1 -1
- package/es/organism/brand-learning-priorities/index.d.ts +6 -0
- package/es/organism/header-with-actions/index.d.ts +13 -4
- package/es/organism/header-with-actions/index.d.ts.map +1 -1
- package/es/organism/header-with-actions/index.js +31 -6
- package/es/organism/header-with-actions/index.js.map +1 -1
- package/es/organism/header-with-actions/style.css +42 -0
- package/es/organism/header-with-actions/types.d.ts +24 -6
- package/es/organism/header-with-actions/types.d.ts.map +1 -1
- package/es/organism/header-with-actions/types.js +7 -2
- package/es/organism/header-with-actions/types.js.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +40 -4
- package/es/template/back-office/brand-update/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.js +19 -4
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/back-office/brand-update/style.css +18 -0
- package/lib/atom/radio-group/index.d.ts +13 -7
- package/lib/atom/radio-group/index.d.ts.map +1 -1
- package/lib/atom/radio-group/index.js +51 -0
- package/lib/atom/radio-group/index.js.map +1 -1
- package/lib/atom/radio-group/style.css +37 -0
- package/lib/molecule/assignment-status-tag/index.d.ts.map +1 -1
- package/lib/molecule/assignment-status-tag/index.js +5 -0
- package/lib/molecule/assignment-status-tag/index.js.map +1 -1
- package/lib/molecule/draggable-list/index.d.ts +6 -0
- package/lib/molecule/setup-section/index.d.ts +6 -0
- package/lib/molecule/setup-sections/index.d.ts +6 -0
- package/lib/organism/assignment-audience/index.d.ts +23 -11
- package/lib/organism/assignment-audience/index.d.ts.map +1 -1
- package/lib/organism/assignment-audience/index.js +100 -59
- package/lib/organism/assignment-audience/index.js.map +1 -1
- package/lib/organism/assignment-audience/types.d.ts +39 -15
- package/lib/organism/assignment-audience/types.d.ts.map +1 -1
- package/lib/organism/assignment-audience/types.js +17 -5
- package/lib/organism/assignment-audience/types.js.map +1 -1
- package/lib/organism/assignment-audience/upload-result.d.ts.map +1 -1
- package/lib/organism/assignment-audience/upload-result.js +3 -7
- package/lib/organism/assignment-audience/upload-result.js.map +1 -1
- package/lib/organism/brand-learning-priorities/index.d.ts +6 -0
- package/lib/organism/header-with-actions/index.d.ts +13 -4
- package/lib/organism/header-with-actions/index.d.ts.map +1 -1
- package/lib/organism/header-with-actions/index.js +31 -6
- package/lib/organism/header-with-actions/index.js.map +1 -1
- package/lib/organism/header-with-actions/style.css +42 -0
- package/lib/organism/header-with-actions/types.d.ts +24 -6
- package/lib/organism/header-with-actions/types.d.ts.map +1 -1
- package/lib/organism/header-with-actions/types.js +7 -2
- package/lib/organism/header-with-actions/types.js.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +40 -4
- package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.js +19 -4
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/back-office/brand-update/style.css +18 -0
- package/locales/bs/global.json +2 -2
- package/locales/cs/global.json +2 -2
- package/locales/de/global.json +2 -2
- package/locales/es/global.json +2 -2
- package/locales/et/global.json +2 -2
- package/locales/fi/global.json +2 -2
- package/locales/fr/global.json +2 -2
- package/locales/hr/global.json +2 -2
- package/locales/hu/global.json +2 -2
- package/locales/hy/global.json +2 -2
- package/locales/it/global.json +2 -2
- package/locales/ja/global.json +2 -2
- package/locales/ko/global.json +2 -2
- package/locales/lt/global.json +2 -2
- package/locales/nl/global.json +2 -2
- package/locales/pl/global.json +2 -2
- package/locales/pt/global.json +2 -2
- package/locales/ro/global.json +2 -2
- package/locales/ru/global.json +2 -2
- package/locales/sk/global.json +2 -2
- package/locales/sl/global.json +2 -2
- package/locales/sv/global.json +2 -2
- package/locales/tl/global.json +2 -2
- package/locales/tr/global.json +2 -2
- package/locales/uk/global.json +2 -2
- package/locales/vi/global.json +2 -2
- package/locales/zh/global.json +2 -2
- package/locales/zh_TW/global.json +2 -2
- package/package.json +2 -2
|
@@ -16,7 +16,52 @@ const themeStyle = {
|
|
|
16
16
|
setup: _style.default.setup,
|
|
17
17
|
coorpmanager: _style.default.coorpmanager
|
|
18
18
|
};
|
|
19
|
+
const renderSegmentedControl = ({
|
|
20
|
+
options,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
'aria-label': ariaLabel
|
|
24
|
+
}) => {
|
|
25
|
+
const activate = nextValue => {
|
|
26
|
+
if (nextValue !== value) onChange(nextValue);
|
|
27
|
+
};
|
|
28
|
+
function handleClick(event) {
|
|
29
|
+
activate(event.currentTarget.value);
|
|
30
|
+
}
|
|
31
|
+
function handleKeyDown(event) {
|
|
32
|
+
const {
|
|
33
|
+
key,
|
|
34
|
+
currentTarget
|
|
35
|
+
} = event;
|
|
36
|
+
if (!['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(key)) return;
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
const index = options.findIndex(option => option.value === currentTarget.value);
|
|
39
|
+
const direction = key === 'ArrowRight' || key === 'ArrowDown' ? 1 : -1;
|
|
40
|
+
const destination = (index + direction + options.length) % options.length;
|
|
41
|
+
currentTarget.parentElement.children[destination].focus();
|
|
42
|
+
activate(options[destination].value);
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
role: "radiogroup",
|
|
46
|
+
"aria-label": ariaLabel,
|
|
47
|
+
className: _style.default.segmented
|
|
48
|
+
}, options.map(option => /*#__PURE__*/_react.default.createElement("button", {
|
|
49
|
+
key: option.value,
|
|
50
|
+
type: "button",
|
|
51
|
+
role: "radio",
|
|
52
|
+
value: option.value,
|
|
53
|
+
"aria-checked": option.value === value,
|
|
54
|
+
tabIndex: option.value === value ? 0 : -1,
|
|
55
|
+
className: _style.default.segmentedOption,
|
|
56
|
+
onClick: handleClick,
|
|
57
|
+
onKeyDown: handleKeyDown
|
|
58
|
+
}, option.label)));
|
|
59
|
+
};
|
|
19
60
|
const RadioGroup = (props, context) => {
|
|
61
|
+
const {
|
|
62
|
+
options
|
|
63
|
+
} = props;
|
|
64
|
+
if (options) return renderSegmentedControl(props);
|
|
20
65
|
const {
|
|
21
66
|
list = [],
|
|
22
67
|
onChange,
|
|
@@ -51,6 +96,12 @@ RadioGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
51
96
|
color: _propTypes.default.string,
|
|
52
97
|
theme: _propTypes.default.string,
|
|
53
98
|
className: _propTypes.default.string,
|
|
99
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
100
|
+
label: _propTypes.default.string.isRequired,
|
|
101
|
+
value: _propTypes.default.string.isRequired
|
|
102
|
+
})),
|
|
103
|
+
value: _propTypes.default.string,
|
|
104
|
+
'aria-label': _propTypes.default.string,
|
|
54
105
|
list: _propTypes.default.arrayOf(_propTypes.default.shape(_item.default.propTypes)),
|
|
55
106
|
onChange: _propTypes.default.func
|
|
56
107
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_classnames","_interopRequireDefault","require","_react","_propTypes","_provider","_style","_item","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","themeStyle","setup","style","coorpmanager","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_classnames","_interopRequireDefault","require","_react","_propTypes","_provider","_style","_item","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","themeStyle","setup","style","coorpmanager","renderSegmentedControl","options","value","onChange","ariaLabel","activate","nextValue","handleClick","event","currentTarget","handleKeyDown","key","includes","preventDefault","index","findIndex","option","direction","destination","parentElement","children","focus","createElement","role","className","segmented","map","type","tabIndex","segmentedOption","onClick","onKeyDown","label","RadioGroup","props","context","list","color","theme","skin","borderColor","_get2","mainClass","items","_map2","itemProps","classnames","container","contextTypes","Provider","childContextTypes","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","shape","isRequired","Item","func","_default","exports"],"sources":["../../../src/atom/radio-group/index.js"],"sourcesContent":["import classnames from 'classnames';\nimport React from 'react';\nimport {get, map} from 'lodash/fp';\nimport PropTypes from 'prop-types';\nimport Provider from '../provider';\nimport style from './style.css';\n\nimport Item from './item';\n\nconst themeStyle = {\n setup: style.setup,\n coorpmanager: style.coorpmanager\n};\n\nconst renderSegmentedControl = ({options, value, onChange, 'aria-label': ariaLabel}) => {\n const activate = nextValue => {\n if (nextValue !== value) onChange(nextValue);\n };\n function handleClick(event) {\n activate(event.currentTarget.value);\n }\n\n function handleKeyDown(event) {\n const {key, currentTarget} = event;\n if (!['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(key)) return;\n event.preventDefault();\n const index = options.findIndex(option => option.value === currentTarget.value);\n const direction = key === 'ArrowRight' || key === 'ArrowDown' ? 1 : -1;\n const destination = (index + direction + options.length) % options.length;\n currentTarget.parentElement.children[destination].focus();\n activate(options[destination].value);\n }\n\n return (\n <div role=\"radiogroup\" aria-label={ariaLabel} className={style.segmented}>\n {options.map(option => (\n <button\n key={option.value}\n type=\"button\"\n role=\"radio\"\n value={option.value}\n aria-checked={option.value === value}\n tabIndex={option.value === value ? 0 : -1}\n className={style.segmentedOption}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {option.label}\n </button>\n ))}\n </div>\n );\n};\n\nconst RadioGroup = (props, context) => {\n const {options} = props;\n if (options) return renderSegmentedControl(props);\n const {list = [], onChange, color, className, theme = 'setup'} = props;\n const {skin} = context;\n const borderColor = color || get('common.primary', skin);\n const mainClass = themeStyle[theme];\n const items = map(itemProps => {\n return (\n <Item {...itemProps} color={color} theme={theme} onChange={onChange} key={itemProps.value} />\n );\n }, list);\n\n return (\n <div className={classnames([mainClass, style.container, className])} style={{borderColor}}>\n {items}\n </div>\n );\n};\n\nRadioGroup.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nRadioGroup.propTypes = {\n color: PropTypes.string,\n theme: PropTypes.string,\n className: PropTypes.string,\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string.isRequired,\n value: PropTypes.string.isRequired\n })\n ),\n value: PropTypes.string,\n 'aria-label': PropTypes.string,\n list: PropTypes.arrayOf(PropTypes.shape(Item.propTypes)),\n onChange: PropTypes.func\n};\n\nexport default RadioGroup;\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CA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S,CAACC,MAAM,CAACG,UAAU;IAClCzD,KAAK,EAAEqD,kBAAS,CAACC,MAAM,CAACG;EAC1B,CAAC,CACH,CAAC;EACDzD,KAAK,EAAEqD,kBAAS,CAACC,MAAM;EACvB,YAAY,EAAED,kBAAS,CAACC,MAAM;EAC9BpB,IAAI,EAAEmB,kBAAS,CAACE,OAAO,CAACF,kBAAS,CAACG,KAAK,CAACE,aAAI,CAACT,SAAS,CAAC,CAAC;EACxDhD,QAAQ,EAAEoD,kBAAS,CAACM;AACtB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAEakD,UAAU","ignoreList":[]}
|
|
@@ -17,3 +17,40 @@
|
|
|
17
17
|
margin: 0px auto;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
|
|
21
|
+
@value colors: "../../variables/colors.css";
|
|
22
|
+
@value cm_primary_blue, cm_blue_50, cm_grey_400 from colors;
|
|
23
|
+
|
|
24
|
+
.segmented {
|
|
25
|
+
composes: container;
|
|
26
|
+
flex-wrap: nowrap;
|
|
27
|
+
border: 0;
|
|
28
|
+
height: 36px;
|
|
29
|
+
gap: 4px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.segmentedOption {
|
|
33
|
+
composes: label from "./item.css";
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
height: 36px;
|
|
37
|
+
padding: 8px 16px;
|
|
38
|
+
border: 0;
|
|
39
|
+
border-radius: 5px;
|
|
40
|
+
background: transparent;
|
|
41
|
+
color: cm_grey_400;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
font-weight: bold;
|
|
44
|
+
line-height: 1.43;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.segmentedOption[aria-checked="true"] {
|
|
49
|
+
color: cm_primary_blue;
|
|
50
|
+
background: cm_blue_50;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.segmentedOption:focus {
|
|
54
|
+
outline: 2px solid cm_primary_blue;
|
|
55
|
+
outline-offset: 2px;
|
|
56
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/assignment-status-tag/index.tsx"],"names":[],"mappings":";AAIA,OAAkB,EAAC,wBAAwB,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/assignment-status-tag/index.tsx"],"names":[],"mappings":";AAIA,OAAkB,EAAC,wBAAwB,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAgCrE,eAAO,MAAM,mBAAmB,UAAkB,CAAC;AAEnD,eAAO,MAAM,oBAAoB,YAAa,MAAM,GAAG,IAAI,KAAG,OACI,CAAC;AAEnE,QAAA,MAAM,mBAAmB;wBAAqB,wBAAwB;;;;;CAErE,CAAC;AAIF,eAAe,mBAAmB,CAAC"}
|
|
@@ -16,6 +16,11 @@ const TAG_TYPES = {
|
|
|
16
16
|
active: 'success',
|
|
17
17
|
ended: 'default',
|
|
18
18
|
disabled: 'warning',
|
|
19
|
+
// Login resolution in an audience upload
|
|
20
|
+
loginValid: 'success',
|
|
21
|
+
loginUnknown: 'failure',
|
|
22
|
+
loginAmbiguous: 'warning',
|
|
23
|
+
loginInactive: 'warning',
|
|
19
24
|
// List-row information tags: « Ongoing changes », « N modules unavailable »
|
|
20
25
|
ongoingChanges: 'progress',
|
|
21
26
|
unavailable: 'warning',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_has","_keys","_tag","_types","e","__esModule","default","TAG_TYPES","draft","upcoming","active","ended","disabled","ongoingChanges","unavailable","processing","syncError","assigned","inProgress","completed","removed","dueSoon","overdue","late","ASSIGNMENT_TAG_KEYS","exports","keys","getAssignmentTagType","status","has","AssignmentStatusTag","label","createElement","type","propTypes","process","env","NODE_ENV","_default"],"sources":["../../../src/molecule/assignment-status-tag/index.tsx"],"sourcesContent":["import React from 'react';\nimport has from 'lodash/fp/has';\nimport keys from 'lodash/fp/keys';\nimport Tag from '../../atom/tag';\nimport propTypes, {AssignmentStatusTagProps, TagType} from './types';\n\n// One status vocabulary for every assignment surface. Labels come from the consumer.\nconst TAG_TYPES: Record<string, TagType> = {\n // Assignment lifecycle: edit-page and tracking headers only, never on a list row\n draft: 'progress',\n upcoming: 'info',\n active: 'success',\n ended: 'default',\n disabled: 'warning',\n // List-row information tags: « Ongoing changes », « N modules unavailable »\n ongoingChanges: 'progress',\n unavailable: 'warning',\n // Sync, only when not up to date: there is no \"up to date\" key\n processing: 'progress',\n syncError: 'failure',\n // Learner row in the tracking table; \"completed late\" is a computed flag, not a status\n assigned: 'default',\n inProgress: 'info',\n completed: 'success',\n removed: 'default',\n // Computed learner flags\n dueSoon: 'warning',\n overdue: 'failure',\n late: 'warning'\n};\n\nexport const ASSIGNMENT_TAG_KEYS = keys(TAG_TYPES);\n\nexport const getAssignmentTagType = (status?: string | null): TagType =>\n status && has(status, TAG_TYPES) ? TAG_TYPES[status] : 'default';\n\nconst AssignmentStatusTag = ({status, label}: AssignmentStatusTagProps) => (\n <Tag type={getAssignmentTagType(status)} label={label} />\n);\n\nAssignmentStatusTag.propTypes = propTypes;\n\nexport default AssignmentStatusTag;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAqE,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErE;AACA,MAAMG,SAAkC,GAAG;EACzC;EACAC,KAAK,EAAE,UAAU;EACjBC,QAAQ,EAAE,MAAM;EAChBC,MAAM,EAAE,SAAS;EACjBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,SAAS;EACnB;EACAC,cAAc,EAAE,UAAU;EAC1BC,WAAW,EAAE,SAAS;EACtB;EACAC,UAAU,EAAE,UAAU;EACtBC,SAAS,EAAE,SAAS;EACpB;EACAC,QAAQ,EAAE,SAAS;EACnBC,UAAU,EAAE,MAAM;EAClBC,SAAS,EAAE,SAAS;EACpBC,OAAO,EAAE,SAAS;EAClB;EACAC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,aAAI,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_has","_keys","_tag","_types","e","__esModule","default","TAG_TYPES","draft","upcoming","active","ended","disabled","loginValid","loginUnknown","loginAmbiguous","loginInactive","ongoingChanges","unavailable","processing","syncError","assigned","inProgress","completed","removed","dueSoon","overdue","late","ASSIGNMENT_TAG_KEYS","exports","keys","getAssignmentTagType","status","has","AssignmentStatusTag","label","createElement","type","propTypes","process","env","NODE_ENV","_default"],"sources":["../../../src/molecule/assignment-status-tag/index.tsx"],"sourcesContent":["import React from 'react';\nimport has from 'lodash/fp/has';\nimport keys from 'lodash/fp/keys';\nimport Tag from '../../atom/tag';\nimport propTypes, {AssignmentStatusTagProps, TagType} from './types';\n\n// One status vocabulary for every assignment surface. Labels come from the consumer.\nconst TAG_TYPES: Record<string, TagType> = {\n // Assignment lifecycle: edit-page and tracking headers only, never on a list row\n draft: 'progress',\n upcoming: 'info',\n active: 'success',\n ended: 'default',\n disabled: 'warning',\n // Login resolution in an audience upload\n loginValid: 'success',\n loginUnknown: 'failure',\n loginAmbiguous: 'warning',\n loginInactive: 'warning',\n // List-row information tags: « Ongoing changes », « N modules unavailable »\n ongoingChanges: 'progress',\n unavailable: 'warning',\n // Sync, only when not up to date: there is no \"up to date\" key\n processing: 'progress',\n syncError: 'failure',\n // Learner row in the tracking table; \"completed late\" is a computed flag, not a status\n assigned: 'default',\n inProgress: 'info',\n completed: 'success',\n removed: 'default',\n // Computed learner flags\n dueSoon: 'warning',\n overdue: 'failure',\n late: 'warning'\n};\n\nexport const ASSIGNMENT_TAG_KEYS = keys(TAG_TYPES);\n\nexport const getAssignmentTagType = (status?: string | null): TagType =>\n status && has(status, TAG_TYPES) ? TAG_TYPES[status] : 'default';\n\nconst AssignmentStatusTag = ({status, label}: AssignmentStatusTagProps) => (\n <Tag type={getAssignmentTagType(status)} label={label} />\n);\n\nAssignmentStatusTag.propTypes = propTypes;\n\nexport default AssignmentStatusTag;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAqE,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErE;AACA,MAAMG,SAAkC,GAAG;EACzC;EACAC,KAAK,EAAE,UAAU;EACjBC,QAAQ,EAAE,MAAM;EAChBC,MAAM,EAAE,SAAS;EACjBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,SAAS;EACnB;EACAC,UAAU,EAAE,SAAS;EACrBC,YAAY,EAAE,SAAS;EACvBC,cAAc,EAAE,SAAS;EACzBC,aAAa,EAAE,SAAS;EACxB;EACAC,cAAc,EAAE,UAAU;EAC1BC,WAAW,EAAE,SAAS;EACtB;EACAC,UAAU,EAAE,UAAU;EACtBC,SAAS,EAAE,SAAS;EACpB;EACAC,QAAQ,EAAE,SAAS;EACnBC,UAAU,EAAE,MAAM;EAClBC,SAAS,EAAE,SAAS;EACpBC,OAAO,EAAE,SAAS;EAClB;EACAC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,aAAI,EAACvB,SAAS,CAAC;AAE3C,MAAMwB,oBAAoB,GAAIC,MAAsB,IACzDA,MAAM,IAAI,IAAAC,YAAG,EAACD,MAAM,EAAEzB,SAAS,CAAC,GAAGA,SAAS,CAACyB,MAAM,CAAC,GAAG,SAAS;AAACH,OAAA,CAAAE,oBAAA,GAAAA,oBAAA;AAEnE,MAAMG,mBAAmB,GAAGA,CAAC;EAACF,MAAM;EAAEG;AAA+B,CAAC,kBACpEtC,MAAA,CAAAS,OAAA,CAAA8B,aAAA,CAAClC,IAAA,CAAAI,OAAG;EAAC+B,IAAI,EAAEN,oBAAoB,CAACC,MAAM,CAAE;EAACG,KAAK,EAAEA;AAAM,CAAE,CACzD;AAEDD,mBAAmB,CAACI,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGH,cAAS;AAAC,IAAAI,QAAA,GAAAb,OAAA,CAAAvB,OAAA,GAE3B4B,mBAAmB","ignoreList":[]}
|
|
@@ -130,6 +130,12 @@ declare namespace DraggableList {
|
|
|
130
130
|
color: PropTypes.Requireable<string>;
|
|
131
131
|
theme: PropTypes.Requireable<string>;
|
|
132
132
|
className: PropTypes.Requireable<string>;
|
|
133
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
134
|
+
label: PropTypes.Validator<string>;
|
|
135
|
+
value: PropTypes.Validator<string>;
|
|
136
|
+
}> | null | undefined)[]>;
|
|
137
|
+
value: PropTypes.Requireable<string>;
|
|
138
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
133
139
|
list: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
134
140
|
color: PropTypes.Requireable<string>;
|
|
135
141
|
value: PropTypes.Validator<string>;
|
|
@@ -85,6 +85,12 @@ declare namespace ContentTypesToggler {
|
|
|
85
85
|
color: PropTypes.Requireable<string>;
|
|
86
86
|
theme: PropTypes.Requireable<string>;
|
|
87
87
|
className: PropTypes.Requireable<string>;
|
|
88
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
89
|
+
label: PropTypes.Validator<string>;
|
|
90
|
+
value: PropTypes.Validator<string>;
|
|
91
|
+
}> | null | undefined)[]>;
|
|
92
|
+
value: PropTypes.Requireable<string>;
|
|
93
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
88
94
|
list: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
89
95
|
color: PropTypes.Requireable<string>;
|
|
90
96
|
value: PropTypes.Validator<string>;
|
|
@@ -33,6 +33,12 @@ declare namespace SetupSections {
|
|
|
33
33
|
color: PropTypes.Requireable<string>;
|
|
34
34
|
theme: PropTypes.Requireable<string>;
|
|
35
35
|
className: PropTypes.Requireable<string>;
|
|
36
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
37
|
+
label: PropTypes.Validator<string>;
|
|
38
|
+
value: PropTypes.Validator<string>;
|
|
39
|
+
}> | null | undefined)[]>;
|
|
40
|
+
value: PropTypes.Requireable<string>;
|
|
41
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
36
42
|
list: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
37
43
|
color: PropTypes.Requireable<string>;
|
|
38
44
|
value: PropTypes.Validator<string>;
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AssignmentAudienceProps } from './types';
|
|
3
3
|
declare const AssignmentAudience: {
|
|
4
|
-
({ title, subtitle, disabledExplanation, everyone, populations, upload, individuals, total }: AssignmentAudienceProps): JSX.Element;
|
|
4
|
+
({ title, subtitle, disabledExplanation, everyone, team, invalidTargets, invalidLabel, error, disabled, populations, upload, individuals, total }: AssignmentAudienceProps): JSX.Element;
|
|
5
5
|
propTypes: {
|
|
6
6
|
title: import("prop-types").Validator<string>;
|
|
7
7
|
subtitle: import("prop-types").Requireable<string>;
|
|
8
8
|
disabledExplanation: import("prop-types").Requireable<string>;
|
|
9
|
-
|
|
9
|
+
team: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
10
|
+
label: import("prop-types").Validator<string>;
|
|
11
|
+
name: import("prop-types").Validator<string>;
|
|
12
|
+
}>>;
|
|
13
|
+
invalidTargets: import("prop-types").Requireable<(import("prop-types").InferProps<{
|
|
14
|
+
ref: import("prop-types").Validator<string>;
|
|
15
|
+
label: import("prop-types").Validator<string>;
|
|
16
|
+
onRemove: import("prop-types").Validator<(...args: any[]) => any>;
|
|
17
|
+
}> | null | undefined)[]>;
|
|
18
|
+
invalidLabel: import("prop-types").Requireable<string>;
|
|
19
|
+
error: import("prop-types").Requireable<string>;
|
|
20
|
+
disabled: import("prop-types").Requireable<boolean>;
|
|
21
|
+
everyone: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
10
22
|
title: import("prop-types").Requireable<string>;
|
|
11
23
|
label: import("prop-types").Validator<string>;
|
|
12
24
|
value: import("prop-types").Validator<boolean>;
|
|
13
25
|
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
14
|
-
}
|
|
15
|
-
populations: import("prop-types").
|
|
26
|
+
}>>;
|
|
27
|
+
populations: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
16
28
|
title: import("prop-types").Requireable<string>;
|
|
17
29
|
subtitle: import("prop-types").Requireable<string>;
|
|
18
30
|
label: import("prop-types").Requireable<string>;
|
|
@@ -24,8 +36,8 @@ declare const AssignmentAudience: {
|
|
|
24
36
|
}> | null | undefined)[]>;
|
|
25
37
|
removeLabel: import("prop-types").Requireable<string>;
|
|
26
38
|
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
27
|
-
}
|
|
28
|
-
upload: import("prop-types").
|
|
39
|
+
}>>;
|
|
40
|
+
upload: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
29
41
|
title: import("prop-types").Requireable<string>;
|
|
30
42
|
subtitle: import("prop-types").Requireable<string>;
|
|
31
43
|
templateLink: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
@@ -62,8 +74,8 @@ declare const AssignmentAudience: {
|
|
|
62
74
|
}>>;
|
|
63
75
|
removeLabel: import("prop-types").Requireable<string>;
|
|
64
76
|
onRemove: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
65
|
-
}
|
|
66
|
-
individuals: import("prop-types").
|
|
77
|
+
}>>;
|
|
78
|
+
individuals: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
67
79
|
title: import("prop-types").Requireable<string>;
|
|
68
80
|
placeholder: import("prop-types").Requireable<string>;
|
|
69
81
|
value: import("prop-types").Requireable<string>;
|
|
@@ -81,11 +93,11 @@ declare const AssignmentAudience: {
|
|
|
81
93
|
onSearch: import("prop-types").Validator<(...args: any[]) => any>;
|
|
82
94
|
onAdd: import("prop-types").Validator<(...args: any[]) => any>;
|
|
83
95
|
onRemove: import("prop-types").Validator<(...args: any[]) => any>;
|
|
84
|
-
}
|
|
85
|
-
total: import("prop-types").
|
|
96
|
+
}>>;
|
|
97
|
+
total: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
86
98
|
label: import("prop-types").Validator<string>;
|
|
87
99
|
detail: import("prop-types").Requireable<string>;
|
|
88
|
-
}
|
|
100
|
+
}>>;
|
|
89
101
|
};
|
|
90
102
|
};
|
|
91
103
|
export default AssignmentAudience;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/assignment-audience/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/assignment-audience/index.tsx"],"names":[],"mappings":";AAUA,OAAoC,EAClC,uBAAuB,EAGxB,MAAM,SAAS,CAAC;AAwDjB,QAAA,MAAM,kBAAkB;uJAcrB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4RzB,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
|
|
@@ -6,6 +6,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
6
6
|
var _uniqueId = _interopRequireDefault(require("lodash/fp/uniqueId"));
|
|
7
7
|
var _inputSwitch = _interopRequireDefault(require("../../atom/input-switch"));
|
|
8
8
|
var _selectMultiple = _interopRequireDefault(require("../../molecule/select-multiple"));
|
|
9
|
+
var _banner = _interopRequireDefault(require("../../molecule/banner"));
|
|
9
10
|
var _inputFileDraggable = _interopRequireDefault(require("../../atom/input-file-draggable"));
|
|
10
11
|
var _autocomplete = _interopRequireDefault(require("../../atom/autocomplete"));
|
|
11
12
|
var _title = _interopRequireDefault(require("../../atom/title"));
|
|
@@ -16,6 +17,7 @@ var _style = _interopRequireDefault(require("./style.css"));
|
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
21
|
// ButtonLink is full width by default: in the Title row it would squeeze the title column.
|
|
20
22
|
const FIT_CONTENT = {
|
|
21
23
|
width: 'fit-content'
|
|
@@ -65,60 +67,62 @@ const AssignmentAudience = ({
|
|
|
65
67
|
subtitle,
|
|
66
68
|
disabledExplanation,
|
|
67
69
|
everyone,
|
|
70
|
+
team,
|
|
71
|
+
invalidTargets,
|
|
72
|
+
invalidLabel,
|
|
73
|
+
error,
|
|
74
|
+
disabled = false,
|
|
68
75
|
populations,
|
|
69
76
|
upload,
|
|
70
77
|
individuals,
|
|
71
78
|
total
|
|
72
79
|
}) => {
|
|
73
|
-
const
|
|
74
|
-
const loading = upload
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
selected = [],
|
|
90
|
-
onSearch,
|
|
91
|
-
onAdd,
|
|
92
|
-
onRemove
|
|
93
|
-
} = individuals;
|
|
80
|
+
const sourcesDisabled = disabled || Boolean(everyone?.value);
|
|
81
|
+
const loading = upload?.status === 'loading';
|
|
82
|
+
const onEveryoneChange = everyone?.onChange;
|
|
83
|
+
const handleEveryoneChange = (0, _react.useCallback)(nextValue => {
|
|
84
|
+
if (!disabled) onEveryoneChange?.(nextValue);
|
|
85
|
+
}, [disabled, onEveryoneChange]);
|
|
86
|
+
const populationOptions = populations?.options;
|
|
87
|
+
const onPopulationsChange = populations?.onChange;
|
|
88
|
+
const onUpload = upload?.onUpload;
|
|
89
|
+
const onRemoveFile = upload?.onRemove;
|
|
90
|
+
const value = individuals?.value || '';
|
|
91
|
+
const suggestions = individuals?.suggestions;
|
|
92
|
+
const selected = individuals?.selected;
|
|
93
|
+
const onSearch = individuals?.onSearch;
|
|
94
|
+
const onAdd = individuals?.onAdd;
|
|
95
|
+
const onRemove = individuals?.onRemove;
|
|
94
96
|
const explanationId = (0, _react.useMemo)(() => (0, _uniqueId.default)('assignment-audience-explanation-'), []);
|
|
95
|
-
const handlePopulations = (0, _react.useCallback)(choices => onPopulationsChange(populationOptions.filter(option => choices.some(choice => choice.value === option.value)).map(option => ({
|
|
97
|
+
const handlePopulations = (0, _react.useCallback)(choices => !sourcesDisabled && onPopulationsChange?.((populationOptions || []).filter(option => choices.some(choice => choice.value === option.value)).map(option => ({
|
|
96
98
|
...option,
|
|
97
99
|
selected: true
|
|
98
|
-
}))), [populationOptions, onPopulationsChange]);
|
|
99
|
-
const selectedPopulations = (0, _react.useMemo)(() => populationOptions.filter(option => option.selected), [populationOptions]);
|
|
100
|
-
const handleRemovePopulation = (0, _react.useCallback)(populationValue => () => onPopulationsChange(selectedPopulations.filter(option => option.value !== populationValue)), [selectedPopulations, onPopulationsChange]);
|
|
100
|
+
}))), [sourcesDisabled, populationOptions, onPopulationsChange]);
|
|
101
|
+
const selectedPopulations = (0, _react.useMemo)(() => (populationOptions || []).filter(option => option.selected), [populationOptions]);
|
|
102
|
+
const handleRemovePopulation = (0, _react.useCallback)(populationValue => () => !sourcesDisabled && onPopulationsChange?.(selectedPopulations.filter(option => option.value !== populationValue)), [sourcesDisabled, selectedPopulations, onPopulationsChange]);
|
|
101
103
|
|
|
102
104
|
// The native input receives both a browse and a drop, and fires change for each.
|
|
103
105
|
const handleFileChange = (0, _react.useCallback)(event => {
|
|
104
106
|
const file = event.target.files && event.target.files[0];
|
|
105
|
-
if (
|
|
106
|
-
onUpload(file);
|
|
107
|
-
}, [
|
|
107
|
+
if (sourcesDisabled || loading || !file) return;
|
|
108
|
+
onUpload?.(file);
|
|
109
|
+
}, [sourcesDisabled, loading, onUpload]);
|
|
108
110
|
|
|
109
111
|
// The loader's cross cancels the check: the file is dropped, as with Remove.
|
|
110
112
|
const handleCancelCheck = (0, _react.useCallback)(() => {
|
|
111
|
-
if (
|
|
112
|
-
}, [onRemoveFile]);
|
|
113
|
-
const availableSuggestions = (0, _react.useMemo)(() => suggestions.filter(suggestion => !selected
|
|
114
|
-
const handleSearch = (0, _react.useCallback)(event => onSearch(event.target.value), [onSearch]);
|
|
113
|
+
if (!sourcesDisabled) onRemoveFile?.();
|
|
114
|
+
}, [sourcesDisabled, onRemoveFile]);
|
|
115
|
+
const availableSuggestions = (0, _react.useMemo)(() => sourcesDisabled ? [] : (suggestions || []).filter(suggestion => !selected?.some(learner => learner.id === suggestion.id)), [sourcesDisabled, suggestions, selected]);
|
|
116
|
+
const handleSearch = (0, _react.useCallback)(event => !sourcesDisabled && onSearch?.(event.target.value), [sourcesDisabled, onSearch]);
|
|
115
117
|
const handleAdd = (0, _react.useCallback)(({
|
|
116
118
|
suggestion
|
|
117
119
|
}) => {
|
|
118
120
|
const learner = availableSuggestions.find(item => item.id === suggestion.value);
|
|
119
|
-
if (learner) onAdd(learner);
|
|
120
|
-
}, [availableSuggestions, onAdd]);
|
|
121
|
-
const handleRemove = (0, _react.useCallback)(id => () =>
|
|
121
|
+
if (!sourcesDisabled && learner) onAdd?.(learner);
|
|
122
|
+
}, [sourcesDisabled, availableSuggestions, onAdd]);
|
|
123
|
+
const handleRemove = (0, _react.useCallback)(id => () => {
|
|
124
|
+
if (!sourcesDisabled) onRemove?.(id);
|
|
125
|
+
}, [sourcesDisabled, onRemove]);
|
|
122
126
|
return /*#__PURE__*/_react.default.createElement("section", {
|
|
123
127
|
className: _style.default.container,
|
|
124
128
|
"data-name": "assignment-audience",
|
|
@@ -129,25 +133,54 @@ const AssignmentAudience = ({
|
|
|
129
133
|
title: title,
|
|
130
134
|
subtitle: subtitle,
|
|
131
135
|
headingLevel: 2
|
|
132
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
136
|
+
}), error ? /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
+
role: "alert"
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_banner.default, {
|
|
139
|
+
type: "error",
|
|
140
|
+
message: error
|
|
141
|
+
})) : null, team ? /*#__PURE__*/_react.default.createElement(Block, {
|
|
142
|
+
name: "team"
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement(_chip.default, {
|
|
144
|
+
text: team.label,
|
|
145
|
+
subText: team.name,
|
|
146
|
+
customIcon: "none"
|
|
147
|
+
})) : null, invalidTargets?.length ? /*#__PURE__*/_react.default.createElement("fieldset", {
|
|
148
|
+
disabled: disabled,
|
|
149
|
+
className: _style.default.sources,
|
|
150
|
+
"data-name": "invalid-targets"
|
|
151
|
+
}, invalidTargets.map(target => /*#__PURE__*/_react.default.createElement("div", {
|
|
152
|
+
key: target.ref,
|
|
153
|
+
"data-target-ref": target.ref
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(_banner.default, {
|
|
155
|
+
type: "error",
|
|
156
|
+
message: invalidLabel ? `${target.label}: ${invalidLabel}` : target.label,
|
|
157
|
+
cta: [{
|
|
158
|
+
type: 'button',
|
|
159
|
+
label: 'Remove',
|
|
160
|
+
action: () => {
|
|
161
|
+
if (!disabled) target.onRemove();
|
|
162
|
+
}
|
|
163
|
+
}]
|
|
164
|
+
})))) : null, everyone ? /*#__PURE__*/_react.default.createElement(Block, {
|
|
133
165
|
name: "everyone",
|
|
134
166
|
title: everyone.title
|
|
135
167
|
}, /*#__PURE__*/_react.default.createElement(_inputSwitch.default, {
|
|
136
168
|
title: everyone.label,
|
|
137
169
|
value: everyone.value,
|
|
138
|
-
|
|
170
|
+
disabled: disabled,
|
|
171
|
+
onChange: handleEveryoneChange,
|
|
139
172
|
theme: "coorpmanager",
|
|
140
173
|
"data-name": "assignment-everyone",
|
|
141
174
|
"aria-label": everyone.label
|
|
142
|
-
}),
|
|
175
|
+
}), everyone.value ? /*#__PURE__*/_react.default.createElement("p", {
|
|
143
176
|
id: explanationId,
|
|
144
177
|
className: _style.default.explanation
|
|
145
|
-
}, disabledExplanation) : null), /*#__PURE__*/_react.default.createElement("fieldset", {
|
|
146
|
-
disabled:
|
|
147
|
-
"aria-describedby":
|
|
178
|
+
}, disabledExplanation) : null) : null, /*#__PURE__*/_react.default.createElement("fieldset", {
|
|
179
|
+
disabled: sourcesDisabled,
|
|
180
|
+
"aria-describedby": everyone?.value && disabledExplanation ? explanationId : undefined,
|
|
148
181
|
className: _style.default.sources,
|
|
149
182
|
"data-name": "audience-sources"
|
|
150
|
-
}, /*#__PURE__*/_react.default.createElement(Block, {
|
|
183
|
+
}, populations ? /*#__PURE__*/_react.default.createElement(Block, {
|
|
151
184
|
name: "populations",
|
|
152
185
|
title: populations.title,
|
|
153
186
|
subtitle: populations.subtitle
|
|
@@ -156,7 +189,7 @@ const AssignmentAudience = ({
|
|
|
156
189
|
options: populations.options,
|
|
157
190
|
multiple: true,
|
|
158
191
|
theme: "coorpmanager",
|
|
159
|
-
disabled:
|
|
192
|
+
disabled: sourcesDisabled,
|
|
160
193
|
onChange: handlePopulations
|
|
161
194
|
}), selectedPopulations.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
162
195
|
className: _style.default.chips,
|
|
@@ -166,21 +199,21 @@ const AssignmentAudience = ({
|
|
|
166
199
|
text: option.name,
|
|
167
200
|
subText: option.count === undefined ? undefined : `${option.count}`,
|
|
168
201
|
selected: true,
|
|
169
|
-
customIcon:
|
|
170
|
-
ariaLabel:
|
|
171
|
-
onClick:
|
|
172
|
-
}))) : null), /*#__PURE__*/_react.default.createElement(Block, {
|
|
202
|
+
customIcon: sourcesDisabled ? 'none' : 'times',
|
|
203
|
+
ariaLabel: sourcesDisabled ? undefined : chipLabel(populations.removeLabel, option.name),
|
|
204
|
+
onClick: sourcesDisabled ? undefined : handleRemovePopulation(option.value)
|
|
205
|
+
}))) : null) : null, upload ? /*#__PURE__*/_react.default.createElement(Block, {
|
|
173
206
|
name: "upload",
|
|
174
207
|
title: upload.title,
|
|
175
208
|
subtitle: upload.subtitle,
|
|
176
209
|
button: upload.templateLink ? {
|
|
177
210
|
type: 'text',
|
|
178
211
|
label: upload.templateLink.label,
|
|
179
|
-
link:
|
|
212
|
+
link: sourcesDisabled ? undefined : {
|
|
180
213
|
href: upload.templateLink.href,
|
|
181
214
|
download: true
|
|
182
215
|
},
|
|
183
|
-
disabled,
|
|
216
|
+
disabled: sourcesDisabled,
|
|
184
217
|
'data-name': 'upload-template-link',
|
|
185
218
|
customStyle: FIT_CONTENT
|
|
186
219
|
} : undefined
|
|
@@ -191,7 +224,15 @@ const AssignmentAudience = ({
|
|
|
191
224
|
"aria-busy": loading,
|
|
192
225
|
"aria-live": "polite",
|
|
193
226
|
"data-name": "upload-dropzone"
|
|
194
|
-
}, upload.status === 'done' ? /*#__PURE__*/_react.default.createElement(_uploadResult.default,
|
|
227
|
+
}, upload.status === 'done' ? /*#__PURE__*/_react.default.createElement(_uploadResult.default, _extends({}, upload, {
|
|
228
|
+
onRemove: upload.onRemove ? handleCancelCheck : undefined,
|
|
229
|
+
report: upload.report ? {
|
|
230
|
+
...upload.report,
|
|
231
|
+
onDownload: () => {
|
|
232
|
+
if (!sourcesDisabled) upload.report?.onDownload();
|
|
233
|
+
}
|
|
234
|
+
} : undefined
|
|
235
|
+
})) : /*#__PURE__*/_react.default.createElement(_inputFileDraggable.default, {
|
|
195
236
|
name: "assignment-audience-file",
|
|
196
237
|
filesTypes: ACCEPTED_FILES,
|
|
197
238
|
description: upload.dropzone?.description,
|
|
@@ -200,11 +241,11 @@ const AssignmentAudience = ({
|
|
|
200
241
|
dragAndDropLabel: upload.dropzone?.dropLabel,
|
|
201
242
|
loadingLabel: upload.dropzone?.loadingLabel,
|
|
202
243
|
loading: loading,
|
|
203
|
-
disabled:
|
|
244
|
+
disabled: sourcesDisabled,
|
|
204
245
|
error: upload.status === 'error' ? upload.error : '',
|
|
205
246
|
onChange: handleFileChange,
|
|
206
247
|
onReset: handleCancelCheck
|
|
207
|
-
})))), /*#__PURE__*/_react.default.createElement(Block, {
|
|
248
|
+
})))) : null, individuals ? /*#__PURE__*/_react.default.createElement(Block, {
|
|
208
249
|
name: "individuals",
|
|
209
250
|
title: individuals.title
|
|
210
251
|
}, /*#__PURE__*/_react.default.createElement(_autocomplete.default, {
|
|
@@ -217,17 +258,17 @@ const AssignmentAudience = ({
|
|
|
217
258
|
})),
|
|
218
259
|
onInput: handleSearch,
|
|
219
260
|
onSuggestionSelected: handleAdd
|
|
220
|
-
}), selected
|
|
261
|
+
}), (selected?.length || 0) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
221
262
|
className: _style.default.chips
|
|
222
|
-
}, selected
|
|
263
|
+
}, selected?.map(learner => /*#__PURE__*/_react.default.createElement(_chip.default, {
|
|
223
264
|
key: learner.id,
|
|
224
265
|
text: learner.label,
|
|
225
266
|
subText: learner.login,
|
|
226
267
|
selected: true,
|
|
227
|
-
customIcon:
|
|
228
|
-
ariaLabel:
|
|
229
|
-
onClick:
|
|
230
|
-
}))) : null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
268
|
+
customIcon: sourcesDisabled ? 'none' : 'times',
|
|
269
|
+
ariaLabel: sourcesDisabled ? undefined : chipLabel(individuals.removeLabel, learner.label),
|
|
270
|
+
onClick: sourcesDisabled ? undefined : handleRemove(learner.id)
|
|
271
|
+
}))) : null) : null), total ? /*#__PURE__*/_react.default.createElement("div", {
|
|
231
272
|
className: _style.default.total,
|
|
232
273
|
"data-name": "estimated-audience",
|
|
233
274
|
"aria-live": "polite"
|
|
@@ -235,7 +276,7 @@ const AssignmentAudience = ({
|
|
|
235
276
|
className: _style.default.totalLabel
|
|
236
277
|
}, total.label), total.detail ? /*#__PURE__*/_react.default.createElement("span", {
|
|
237
278
|
className: _style.default.muted
|
|
238
|
-
}, total.detail) : null));
|
|
279
|
+
}, total.detail) : null) : null);
|
|
239
280
|
};
|
|
240
281
|
AssignmentAudience.propTypes = process.env.NODE_ENV !== "production" ? _types.default : {};
|
|
241
282
|
var _default = exports.default = AssignmentAudience;
|