@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.
Files changed (103) hide show
  1. package/es/atom/radio-group/index.d.ts +13 -7
  2. package/es/atom/radio-group/index.d.ts.map +1 -1
  3. package/es/atom/radio-group/index.js +51 -0
  4. package/es/atom/radio-group/index.js.map +1 -1
  5. package/es/atom/radio-group/style.css +37 -0
  6. package/es/molecule/assignment-status-tag/index.d.ts.map +1 -1
  7. package/es/molecule/assignment-status-tag/index.js +5 -0
  8. package/es/molecule/assignment-status-tag/index.js.map +1 -1
  9. package/es/molecule/draggable-list/index.d.ts +6 -0
  10. package/es/molecule/setup-section/index.d.ts +6 -0
  11. package/es/molecule/setup-sections/index.d.ts +6 -0
  12. package/es/organism/assignment-audience/index.d.ts +23 -11
  13. package/es/organism/assignment-audience/index.d.ts.map +1 -1
  14. package/es/organism/assignment-audience/index.js +100 -59
  15. package/es/organism/assignment-audience/index.js.map +1 -1
  16. package/es/organism/assignment-audience/types.d.ts +39 -15
  17. package/es/organism/assignment-audience/types.d.ts.map +1 -1
  18. package/es/organism/assignment-audience/types.js +17 -5
  19. package/es/organism/assignment-audience/types.js.map +1 -1
  20. package/es/organism/assignment-audience/upload-result.d.ts.map +1 -1
  21. package/es/organism/assignment-audience/upload-result.js +4 -7
  22. package/es/organism/assignment-audience/upload-result.js.map +1 -1
  23. package/es/organism/brand-learning-priorities/index.d.ts +6 -0
  24. package/es/organism/header-with-actions/index.d.ts +13 -4
  25. package/es/organism/header-with-actions/index.d.ts.map +1 -1
  26. package/es/organism/header-with-actions/index.js +31 -6
  27. package/es/organism/header-with-actions/index.js.map +1 -1
  28. package/es/organism/header-with-actions/style.css +42 -0
  29. package/es/organism/header-with-actions/types.d.ts +24 -6
  30. package/es/organism/header-with-actions/types.d.ts.map +1 -1
  31. package/es/organism/header-with-actions/types.js +7 -2
  32. package/es/organism/header-with-actions/types.js.map +1 -1
  33. package/es/template/back-office/brand-update/index.d.ts +40 -4
  34. package/es/template/back-office/brand-update/index.d.ts.map +1 -1
  35. package/es/template/back-office/brand-update/index.js +19 -4
  36. package/es/template/back-office/brand-update/index.js.map +1 -1
  37. package/es/template/back-office/brand-update/style.css +18 -0
  38. package/lib/atom/radio-group/index.d.ts +13 -7
  39. package/lib/atom/radio-group/index.d.ts.map +1 -1
  40. package/lib/atom/radio-group/index.js +51 -0
  41. package/lib/atom/radio-group/index.js.map +1 -1
  42. package/lib/atom/radio-group/style.css +37 -0
  43. package/lib/molecule/assignment-status-tag/index.d.ts.map +1 -1
  44. package/lib/molecule/assignment-status-tag/index.js +5 -0
  45. package/lib/molecule/assignment-status-tag/index.js.map +1 -1
  46. package/lib/molecule/draggable-list/index.d.ts +6 -0
  47. package/lib/molecule/setup-section/index.d.ts +6 -0
  48. package/lib/molecule/setup-sections/index.d.ts +6 -0
  49. package/lib/organism/assignment-audience/index.d.ts +23 -11
  50. package/lib/organism/assignment-audience/index.d.ts.map +1 -1
  51. package/lib/organism/assignment-audience/index.js +100 -59
  52. package/lib/organism/assignment-audience/index.js.map +1 -1
  53. package/lib/organism/assignment-audience/types.d.ts +39 -15
  54. package/lib/organism/assignment-audience/types.d.ts.map +1 -1
  55. package/lib/organism/assignment-audience/types.js +17 -5
  56. package/lib/organism/assignment-audience/types.js.map +1 -1
  57. package/lib/organism/assignment-audience/upload-result.d.ts.map +1 -1
  58. package/lib/organism/assignment-audience/upload-result.js +3 -7
  59. package/lib/organism/assignment-audience/upload-result.js.map +1 -1
  60. package/lib/organism/brand-learning-priorities/index.d.ts +6 -0
  61. package/lib/organism/header-with-actions/index.d.ts +13 -4
  62. package/lib/organism/header-with-actions/index.d.ts.map +1 -1
  63. package/lib/organism/header-with-actions/index.js +31 -6
  64. package/lib/organism/header-with-actions/index.js.map +1 -1
  65. package/lib/organism/header-with-actions/style.css +42 -0
  66. package/lib/organism/header-with-actions/types.d.ts +24 -6
  67. package/lib/organism/header-with-actions/types.d.ts.map +1 -1
  68. package/lib/organism/header-with-actions/types.js +7 -2
  69. package/lib/organism/header-with-actions/types.js.map +1 -1
  70. package/lib/template/back-office/brand-update/index.d.ts +40 -4
  71. package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
  72. package/lib/template/back-office/brand-update/index.js +19 -4
  73. package/lib/template/back-office/brand-update/index.js.map +1 -1
  74. package/lib/template/back-office/brand-update/style.css +18 -0
  75. package/locales/bs/global.json +2 -2
  76. package/locales/cs/global.json +2 -2
  77. package/locales/de/global.json +2 -2
  78. package/locales/es/global.json +2 -2
  79. package/locales/et/global.json +2 -2
  80. package/locales/fi/global.json +2 -2
  81. package/locales/fr/global.json +2 -2
  82. package/locales/hr/global.json +2 -2
  83. package/locales/hu/global.json +2 -2
  84. package/locales/hy/global.json +2 -2
  85. package/locales/it/global.json +2 -2
  86. package/locales/ja/global.json +2 -2
  87. package/locales/ko/global.json +2 -2
  88. package/locales/lt/global.json +2 -2
  89. package/locales/nl/global.json +2 -2
  90. package/locales/pl/global.json +2 -2
  91. package/locales/pt/global.json +2 -2
  92. package/locales/ro/global.json +2 -2
  93. package/locales/ru/global.json +2 -2
  94. package/locales/sk/global.json +2 -2
  95. package/locales/sl/global.json +2 -2
  96. package/locales/sv/global.json +2 -2
  97. package/locales/tl/global.json +2 -2
  98. package/locales/tr/global.json +2 -2
  99. package/locales/uk/global.json +2 -2
  100. package/locales/vi/global.json +2 -2
  101. package/locales/zh/global.json +2 -2
  102. package/locales/zh_TW/global.json +2 -2
  103. 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","RadioGroup","props","context","list","onChange","color","className","theme","skin","borderColor","_get2","mainClass","items","_map2","itemProps","createElement","key","value","classnames","container","contextTypes","Provider","childContextTypes","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","shape","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 RadioGroup = (props, context) => {\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 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,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,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,MAAA,CAAAO,OAAA,CAAAgC,aAAA;IAAKT,SAAS,EAAE,IAAAY,mBAAU,EAAC,CAACP,SAAS,EAAEb,cAAK,CAACqB,SAAS,EAAEb,SAAS,CAAC,CAAE;IAACR,KAAK,EAAE;MAACW;IAAW;EAAE,GACvFG,KACE,CAAC;AAEV,CAAC;AAEDZ,UAAU,CAACoB,YAAY,GAAG;EACxBZ,IAAI,EAAEa,iBAAQ,CAACC,iBAAiB,CAACd;AACnC,CAAC;AAEDR,UAAU,CAACuB,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG;EACrBrB,KAAK,EAAEsB,kBAAS,CAACC,MAAM;EACvBrB,KAAK,EAAEoB,kBAAS,CAACC,MAAM;EACvBtB,SAAS,EAAEqB,kBAAS,CAACC,MAAM;EAC3BzB,IAAI,EAAEwB,kBAAS,CAACE,OAAO,CAACF,kBAAS,CAACG,KAAK,CAACC,aAAI,CAACR,SAAS,CAAC,CAAC;EACxDnB,QAAQ,EAAEuB,kBAAS,CAACK;AACtB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEaiB,UAAU","ignoreList":[]}
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,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAE1B,MAAMO,UAAU,GAAG;EACjBC,KAAK,EAAEC,cAAK,CAACD,KAAK;EAClBE,YAAY,EAAED,cAAK,CAACC;AACtB,CAAC;AAED,MAAMC,sBAAsB,GAAGA,CAAC;EAACC,OAAO;EAAEC,KAAK;EAAEC,QAAQ;EAAE,YAAY,EAAEC;AAAS,CAAC,KAAK;EACtF,MAAMC,QAAQ,GAAGC,SAAS,IAAI;IAC5B,IAAIA,SAAS,K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,EAAEvB,SAAS,CAAC,CAAE;IAAC1B,KAAK,EAAE;MAAC0C;IAAW;EAAE,GACvFG,KACE,CAAC;AAEV,CAAC;AAEDV,UAAU,CAACe,YAAY,GAAG;EACxBT,IAAI,EAAEU,iBAAQ,CAACC,iBAAiB,CAACX;AACnC,CAAC;AAEDN,UAAU,CAACkB,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG;EACrBjB,KAAK,EAAEkB,kBAAS,CAACC,MAAM;EACvBlB,KAAK,EAAEiB,kBAAS,CAACC,MAAM;EACvBhC,SAAS,EAAE+B,kBAAS,CAACC,MAAM;EAC3BvD,OAAO,EAAEsD,kBAAS,CAACE,OAAO,CACxBF,kBAAS,CAACG,KAAK,CAAC;IACd1B,KAAK,EAAEuB,kBAAS,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;AA2BrE,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"}
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,IAAA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,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGH,cAAS;AAAC,IAAAI,QAAA,GAAAb,OAAA,CAAAnB,OAAA,GAE3BwB,mBAAmB","ignoreList":[]}
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
- everyone: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
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").Validator<NonNullable<import("prop-types").InferProps<{
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").Validator<NonNullable<import("prop-types").InferProps<{
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").Validator<NonNullable<import("prop-types").InferProps<{
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").Validator<NonNullable<import("prop-types").InferProps<{
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":";AASA,OAAoC,EAClC,uBAAuB,EAGxB,MAAM,SAAS,CAAC;AAwDjB,QAAA,MAAM,kBAAkB;kGASrB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqMzB,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
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 disabled = everyone.value;
74
- const loading = upload.status === 'loading';
75
- const {
76
- onChange: onEveryoneChange
77
- } = everyone;
78
- const {
79
- options: populationOptions,
80
- onChange: onPopulationsChange
81
- } = populations;
82
- const {
83
- onUpload,
84
- onRemove: onRemoveFile
85
- } = upload;
86
- const {
87
- value = '',
88
- suggestions = [],
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 (disabled || loading || !file) return;
106
- onUpload(file);
107
- }, [disabled, loading, onUpload]);
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 (onRemoveFile) onRemoveFile();
112
- }, [onRemoveFile]);
113
- const availableSuggestions = (0, _react.useMemo)(() => suggestions.filter(suggestion => !selected.some(learner => learner.id === suggestion.id)), [suggestions, 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 => () => onRemove(id), [onRemove]);
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(Block, {
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
- onChange: onEveryoneChange,
170
+ disabled: disabled,
171
+ onChange: handleEveryoneChange,
139
172
  theme: "coorpmanager",
140
173
  "data-name": "assignment-everyone",
141
174
  "aria-label": everyone.label
142
- }), disabled ? /*#__PURE__*/_react.default.createElement("p", {
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: disabled,
147
- "aria-describedby": disabled && disabledExplanation ? explanationId : undefined,
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: 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: disabled ? 'none' : 'times',
170
- ariaLabel: disabled ? undefined : chipLabel(populations.removeLabel, option.name),
171
- onClick: disabled ? undefined : handleRemovePopulation(option.value)
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: disabled ? undefined : {
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, upload) : /*#__PURE__*/_react.default.createElement(_inputFileDraggable.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: 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.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
261
+ }), (selected?.length || 0) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
221
262
  className: _style.default.chips
222
- }, selected.map(learner => /*#__PURE__*/_react.default.createElement(_chip.default, {
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: disabled ? 'none' : 'times',
228
- ariaLabel: disabled ? undefined : chipLabel(individuals.removeLabel, learner.label),
229
- onClick: disabled ? undefined : handleRemove(learner.id)
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;