@orfium/ictinus 4.63.0 → 4.65.0

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.
@@ -256,6 +256,19 @@ CatalogIcon.defaultProps = {
256
256
  xmlns: "http://www.w3.org/2000/svg"
257
257
  };
258
258
 
259
+ var ChannelIcon = function ChannelIcon(props) {
260
+ return (0, _react2.jsx)("svg", props, (0, _react2.jsx)("path", {
261
+ d: "M16.667 6.667H3.334V5h13.333v1.667zm-1.667-5H5v1.666h10V1.667zM18.334 10v6.667c0 .916-.75 1.666-1.667 1.666H3.334c-.917 0-1.667-.75-1.667-1.666V10c0-.917.75-1.667 1.667-1.667h13.333c.917 0 1.667.75 1.667 1.667zm-5 3.333l-5-2.725v5.442l5-2.717z",
262
+ fill: "#0E0E17"
263
+ }));
264
+ };
265
+
266
+ ChannelIcon.defaultProps = {
267
+ viewBox: "0 0 20 20",
268
+ fill: "none",
269
+ xmlns: "http://www.w3.org/2000/svg"
270
+ };
271
+
259
272
  var ChatBubble = function ChatBubble(props) {
260
273
  return (0, _react2.jsx)("svg", props, (0, _react2.jsx)("path", {
261
274
  fillRule: "evenodd",
@@ -1188,6 +1201,37 @@ LegalFilesIcon.defaultProps = {
1188
1201
  xmlns: "http://www.w3.org/2000/svg"
1189
1202
  };
1190
1203
 
1204
+ var LicenceIcon = function LicenceIcon(props) {
1205
+ return (0, _react2.jsx)("svg", props, (0, _react2.jsx)("path", {
1206
+ fillRule: "evenodd",
1207
+ clipRule: "evenodd",
1208
+ d: "M14.678 7.146v2.74l1.988 1.94-1.988 1.827v2.74h-2.69L10 18.333l-1.989-1.94h-2.69v-2.74l-1.988-1.826 1.988-1.941v-2.74h1.755v-5.48L10 3.38l2.924-1.712v5.48h1.754zM10 15a3.333 3.333 0 1 0 0-6.667A3.333 3.333 0 0 0 10 15z",
1209
+ fill: "#000"
1210
+ }));
1211
+ };
1212
+
1213
+ LicenceIcon.defaultProps = {
1214
+ viewBox: "0 0 20 20",
1215
+ fill: "none",
1216
+ xmlns: "http://www.w3.org/2000/svg"
1217
+ };
1218
+
1219
+ var LicencedVideoIcon = function LicencedVideoIcon(props) {
1220
+ return (0, _react2.jsx)("svg", props, (0, _react2.jsx)("path", {
1221
+ d: "M15 9.167c.283 0 .558.025.833.066v-5.9c0-.916-.75-1.666-1.666-1.666h-10c-.917 0-1.667.75-1.667 1.666v13.334c0 .916.75 1.666 1.667 1.666h6.05A5.83 5.83 0 0 1 15 9.166zm-9.167 0V3.333H10v5.834l-2.083-1.25-2.084 1.25z",
1222
+ fill: "#0E0E17"
1223
+ }), (0, _react2.jsx)("path", {
1224
+ d: "M15 10.833A4.168 4.168 0 0 0 10.833 15c0 2.3 1.867 4.167 4.167 4.167S19.167 17.3 19.167 15 17.3 10.833 15 10.833zm-1.042 6.25v-4.166L17.292 15l-3.334 2.083z",
1225
+ fill: "#0E0E17"
1226
+ }));
1227
+ };
1228
+
1229
+ LicencedVideoIcon.defaultProps = {
1230
+ viewBox: "0 0 20 20",
1231
+ fill: "none",
1232
+ xmlns: "http://www.w3.org/2000/svg"
1233
+ };
1234
+
1191
1235
  var LinkedIcon = function LinkedIcon(props) {
1192
1236
  return (0, _react2.jsx)("svg", props, (0, _react2.jsx)("path", {
1193
1237
  fillRule: "evenodd",
@@ -2310,6 +2354,7 @@ var iconSelector = {
2310
2354
  calendarEmpty: CalendarEmptyIcon,
2311
2355
  calendarFilled: CalendarFilledIcon,
2312
2356
  catalog: CatalogIcon,
2357
+ channel: ChannelIcon,
2313
2358
  catalogOverview: CatalogOverviewIcon,
2314
2359
  catalogFiles: CatalogFilesIcon,
2315
2360
  chatBubble: ChatBubble,
@@ -2388,6 +2433,8 @@ var iconSelector = {
2388
2433
  issues: IssuesIcon,
2389
2434
  keyword: KeywordIcon,
2390
2435
  legalFiles: LegalFilesIcon,
2436
+ licence: LicenceIcon,
2437
+ licencedVideo: LicencedVideoIcon,
2391
2438
  linked: LinkedIcon,
2392
2439
  lock: LockIcon,
2393
2440
  mail: MailIcon,
@@ -1 +1 @@
1
- export declare type AcceptedIconNames = 'account' | 'actions' | 'add' | 'alert' | 'analytics' | 'analyticsVideos' | 'ancient' | 'arrowDown' | 'arrowLeft' | 'arrowRight' | 'arrowToLeft' | 'arrowToRight' | 'artist' | 'asset' | 'assetMatching' | 'auto' | 'broadcast' | 'calendarEmpty' | 'calendarFilled' | 'catalog' | 'catalogOverview' | 'catalogFiles' | 'chatBubble' | 'check' | 'checkedList' | 'checkmark' | 'chevronExtraSmallDown' | 'chevronExtraSmallLeft' | 'chevronExtraSmallRight' | 'chevronExtraSmallUp' | 'chevronLargeDown' | 'chevronLargeLeft' | 'chevronLargeRight' | 'chevronLargeUp' | 'chevronSmallDown' | 'chevronSmallLeft' | 'chevronSmallRight' | 'chevronSmallUp' | 'claimList' | 'clock' | 'close' | 'closeTag' | 'cmsProcess' | 'composition' | 'compositionV2' | 'confirmedMatches' | 'conflicts' | 'concert' | 'dashboard' | 'dataset' | 'delete' | 'delivery' | 'details' | 'digitalUse' | 'distribution' | 'dotsVertical' | 'download' | 'duplicate' | 'duplicate2' | 'earnings' | 'earnings2' | 'edit' | 'entities' | 'error' | 'expenses' | 'externalLink' | 'externalLinkV2' | 'fatArrowDown' | 'fatArrowLeft' | 'fatArrowRight' | 'fatArrowUp' | 'file' | 'financialChart' | 'generatedReports' | 'genericFile' | 'genericOrdering' | 'globalItem' | 'heartFill' | 'heartStroke' | 'help' | 'hourglass' | 'income' | 'infoFilled' | 'info' | 'issues' | 'keyword' | 'legalFiles' | 'linked' | 'lock' | 'mail' | 'manual' | 'menu' | 'microphone' | 'minus' | 'moreOptionsHorizontal' | 'moreOptionsVertical' | 'musicNote' | 'myEarnings' | 'notifications' | 'notifications2' | 'oneWay' | 'others' | 'ownershipValidation' | 'pageFirst' | 'pageLast' | 'percentage' | 'plus' | 'policies' | 'process' | 'processManagement' | 'publicPerformance' | 'publisher' | 'recording' | 'recordLabel' | 'recordLabelV2' | 'referenceFile' | 'relations' | 'restore' | 'result' | 'royaltyShares' | 'search' | 'searchMusic' | 'searchThunder' | 'settings' | 'sight' | 'sortAscending' | 'sortDescending' | 'stamp' | 'statements' | 'success' | 'television' | 'thunder' | 'ticTacToeArrow' | 'timeOut' | 'training' | 'triangleDown' | 'triangleLeft' | 'triangleRight' | 'triangleUp' | 'trophy' | 'TVCinema' | 'TVRadio' | 'update' | 'upload' | 'user' | 'userAvatar' | 'users' | 'users2' | 'videoConfirmation' | 'view' | 'warning' | 'works' | 'writer' | 'youtube' | 'refresh' | 'star' | 'pause' | 'resume' | 'restart' | 'entity' | 'playCount' | 'processedLogs' | 'proposed' | 'unpaired' | 'unpairedV2' | 'clockOutlined' | 'userCheck';
1
+ export declare type AcceptedIconNames = 'account' | 'actions' | 'add' | 'alert' | 'analytics' | 'analyticsVideos' | 'ancient' | 'arrowDown' | 'arrowLeft' | 'arrowRight' | 'arrowToLeft' | 'arrowToRight' | 'artist' | 'asset' | 'assetMatching' | 'auto' | 'broadcast' | 'calendarEmpty' | 'calendarFilled' | 'catalog' | 'channel' | 'catalogOverview' | 'catalogFiles' | 'chatBubble' | 'check' | 'checkedList' | 'checkmark' | 'chevronExtraSmallDown' | 'chevronExtraSmallLeft' | 'chevronExtraSmallRight' | 'chevronExtraSmallUp' | 'chevronLargeDown' | 'chevronLargeLeft' | 'chevronLargeRight' | 'chevronLargeUp' | 'chevronSmallDown' | 'chevronSmallLeft' | 'chevronSmallRight' | 'chevronSmallUp' | 'claimList' | 'clock' | 'close' | 'closeTag' | 'cmsProcess' | 'composition' | 'compositionV2' | 'confirmedMatches' | 'conflicts' | 'concert' | 'dashboard' | 'dataset' | 'delete' | 'delivery' | 'details' | 'digitalUse' | 'distribution' | 'dotsVertical' | 'download' | 'duplicate' | 'duplicate2' | 'earnings' | 'earnings2' | 'edit' | 'entities' | 'error' | 'expenses' | 'externalLink' | 'externalLinkV2' | 'fatArrowDown' | 'fatArrowLeft' | 'fatArrowRight' | 'fatArrowUp' | 'file' | 'financialChart' | 'generatedReports' | 'genericFile' | 'genericOrdering' | 'globalItem' | 'heartFill' | 'heartStroke' | 'help' | 'hourglass' | 'income' | 'infoFilled' | 'info' | 'issues' | 'keyword' | 'legalFiles' | 'licence' | 'licencedVideo' | 'linked' | 'lock' | 'mail' | 'manual' | 'menu' | 'microphone' | 'minus' | 'moreOptionsHorizontal' | 'moreOptionsVertical' | 'musicNote' | 'myEarnings' | 'notifications' | 'notifications2' | 'oneWay' | 'others' | 'ownershipValidation' | 'pageFirst' | 'pageLast' | 'percentage' | 'plus' | 'policies' | 'process' | 'processManagement' | 'publicPerformance' | 'publisher' | 'recording' | 'recordLabel' | 'recordLabelV2' | 'referenceFile' | 'relations' | 'restore' | 'result' | 'royaltyShares' | 'search' | 'searchMusic' | 'searchThunder' | 'settings' | 'sight' | 'sortAscending' | 'sortDescending' | 'stamp' | 'statements' | 'success' | 'television' | 'thunder' | 'ticTacToeArrow' | 'timeOut' | 'training' | 'triangleDown' | 'triangleLeft' | 'triangleRight' | 'triangleUp' | 'trophy' | 'TVCinema' | 'TVRadio' | 'update' | 'upload' | 'user' | 'userAvatar' | 'users' | 'users2' | 'videoConfirmation' | 'view' | 'warning' | 'works' | 'writer' | 'youtube' | 'refresh' | 'star' | 'pause' | 'resume' | 'restart' | 'entity' | 'playCount' | 'processedLogs' | 'proposed' | 'unpaired' | 'unpairedV2' | 'clockOutlined' | 'userCheck';
@@ -12,6 +12,7 @@ export declare type SelectOption = {
12
12
  helperText?: string;
13
13
  tooltipInfo?: string;
14
14
  options?: SelectOption[];
15
+ isCreated?: boolean;
15
16
  } & SelectOptionValues;
16
17
  export declare type Props = {
17
18
  /** The function that is used to return the selected options */
@@ -48,6 +49,11 @@ export declare type Props = {
48
49
  /** The selected options in case of multiSelect */
49
50
  /** @TODO merge selectedOption with selectedOptions in v5 */
50
51
  selectedOptions?: SelectOption[];
52
+ /**
53
+ * If true, then in the case of a searched option that is not found in the Options list of MultiSelect,
54
+ * the user can create this option.
55
+ * */
56
+ creatable?: boolean;
51
57
  } & TextFieldProps;
52
58
  declare const Select: React.ForwardRefExoticComponent<{
53
59
  /** The function that is used to return the selected options */
@@ -84,6 +90,11 @@ declare const Select: React.ForwardRefExoticComponent<{
84
90
  /** The selected options in case of multiSelect */
85
91
  /** @TODO merge selectedOption with selectedOptions in v5 */
86
92
  selectedOptions?: SelectOption[] | undefined;
93
+ /**
94
+ * If true, then in the case of a searched option that is not found in the Options list of MultiSelect,
95
+ * the user can create this option.
96
+ * */
97
+ creatable?: boolean | undefined;
87
98
  } & {
88
99
  id?: string | undefined;
89
100
  onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
@@ -35,7 +35,7 @@ var _PositionInScreen = _interopRequireDefault(require("../utils/PositionInScree
35
35
 
36
36
  var _react2 = require("@emotion/react");
37
37
 
38
- var _excluded = ["handleSelectedOption", "defaultValue", "selectedOption", "multi", "options", "isAsync", "isLoading", "asyncSearch", "status", "minCharactersToSearch", "highlightSearch", "isSearchable", "isVirtualized", "styleType", "disabled", "locked", "dataTestId", "onClear", "onOptionDelete", "selectedOptions"];
38
+ var _excluded = ["handleSelectedOption", "defaultValue", "selectedOption", "multi", "options", "isAsync", "isLoading", "asyncSearch", "status", "minCharactersToSearch", "highlightSearch", "isSearchable", "isVirtualized", "styleType", "disabled", "locked", "dataTestId", "onClear", "onOptionDelete", "selectedOptions", "creatable"];
39
39
 
40
40
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
41
 
@@ -88,6 +88,8 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
88
88
  onOptionDelete = _ref.onOptionDelete,
89
89
  _ref$selectedOptions = _ref.selectedOptions,
90
90
  selectedOptions = _ref$selectedOptions === void 0 ? [] : _ref$selectedOptions,
91
+ _ref$creatable = _ref.creatable,
92
+ creatable = _ref$creatable === void 0 ? false : _ref$creatable,
91
93
  restInputProps = _objectWithoutPropertiesLoose(_ref, _excluded);
92
94
 
93
95
  var theme = (0, _useTheme["default"])();
@@ -135,7 +137,14 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
135
137
  if (multi) {
136
138
  handleMultiSelectOptionClick(option);
137
139
  } else {
138
- setInputValue(option);
140
+ if (option.isCreated) {
141
+ setInputValue(_extends({}, option, {
142
+ label: option.value.toString()
143
+ }));
144
+ } else {
145
+ setInputValue(option);
146
+ }
147
+
139
148
  setOpen(false);
140
149
  }
141
150
 
@@ -180,27 +189,45 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
180
189
 
181
190
  var filteredOptions = (0, _react.useMemo)(function () {
182
191
  var optionsToBeFiltered = multi ? availableMultiSelectOptions : options;
192
+ var finalOptions = [];
183
193
 
184
194
  if (isAsync) {
185
- return optionsToBeFiltered;
186
- }
187
-
188
- return optionsToBeFiltered.filter(function (option) {
189
- var _option$options;
195
+ finalOptions.push.apply(finalOptions, optionsToBeFiltered);
196
+ } else {
197
+ finalOptions.push.apply(finalOptions, optionsToBeFiltered.filter(function (option) {
198
+ var _option$options;
190
199
 
191
- return !searchValue || option.label.toLowerCase().includes(searchValue.toLowerCase()) || !!((_option$options = option.options) != null && _option$options.find(function (option) {
192
- return option.label.toLowerCase().includes(searchValue.toLowerCase());
200
+ return !searchValue || option.label.toLowerCase().includes(searchValue.toLowerCase()) || !!((_option$options = option.options) != null && _option$options.find(function (option) {
201
+ return option.label.toLowerCase().includes(searchValue.toLowerCase());
202
+ }));
203
+ }).map(function (option) {
204
+ var _option$options2;
205
+
206
+ return option.label.toLowerCase().includes(searchValue.toLowerCase()) ? option : _extends({}, option, {
207
+ options: (_option$options2 = option.options) == null ? void 0 : _option$options2.filter(function (option) {
208
+ return option.label.toLowerCase().includes(searchValue.toLowerCase());
209
+ })
210
+ });
193
211
  }));
194
- }).map(function (option) {
195
- var _option$options2;
212
+ }
196
213
 
197
- return option.label.toLowerCase().includes(searchValue.toLowerCase()) ? option : _extends({}, option, {
198
- options: (_option$options2 = option.options) == null ? void 0 : _option$options2.filter(function (option) {
199
- return option.label.toLowerCase().includes(searchValue.toLowerCase());
200
- })
201
- });
202
- });
203
- }, [isAsync, multi, availableMultiSelectOptions, options, searchValue]);
214
+ if (creatable) {
215
+ /** Check if the searchValue has an exact result (so no need for "Create..." option) */
216
+ var hasDistinctResult = finalOptions.map(function (item) {
217
+ return item.label.toLowerCase();
218
+ }).includes(searchValue.toLowerCase());
219
+
220
+ if (!hasDistinctResult && searchValue.length > 0) {
221
+ finalOptions.push({
222
+ value: searchValue,
223
+ label: "Create \"" + searchValue + "\"",
224
+ isCreated: true
225
+ });
226
+ }
227
+ }
228
+
229
+ return finalOptions;
230
+ }, [multi, availableMultiSelectOptions, options, isAsync, creatable, searchValue]);
204
231
  var rightIconNameSelector = (0, _react.useMemo)(function () {
205
232
  if (isSearchable) {
206
233
  return searchValue || inputValue.value ? 'close' : 'search';
@@ -250,7 +277,13 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
250
277
  combinedRefs == null ? void 0 : (_combinedRefs$current2 = combinedRefs.current) == null ? void 0 : _combinedRefs$current2.blur();
251
278
  }
252
279
  };
280
+ /**
281
+ * Boolean flag for the case where we have no options but create functionality - so
282
+ * we can hide the Select All option in that case
283
+ */
284
+
253
285
 
286
+ var hasNoOptionsAndIsCreatable = creatable && filteredOptions.length === 1 && filteredOptions[0].isCreated;
254
287
  return (0, _react2.jsx)(_ClickAwayListener["default"], {
255
288
  onClick: function onClick() {
256
289
  setOpen(false);
@@ -305,7 +338,7 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
305
338
  isLoading: isLoading,
306
339
  isVirtualized: isVirtualized,
307
340
  searchTerm: highlightSearch ? searchValue : undefined,
308
- hasSelectAllOption: multi
341
+ hasSelectAllOption: multi && !hasNoOptionsAndIsCreatable
309
342
  }))));
310
343
  });
311
344
 
@@ -59,7 +59,10 @@ var useMultiselectUtils = function useMultiselectUtils(_ref) {
59
59
  setMultiSelectedOpts(multiSelectedOptions.filter(function (opt) {
60
60
  return opt.value !== (option == null ? void 0 : option.value);
61
61
  }));
62
- setAvailableMultiSelectOptions([].concat(availableMultiSelectOptions, [option]));
62
+
63
+ if (!option.isCreated) {
64
+ setAvailableMultiSelectOptions([].concat(availableMultiSelectOptions, [option]));
65
+ }
63
66
 
64
67
  if (onOptionDelete) {
65
68
  onOptionDelete(option);
@@ -70,13 +73,18 @@ var useMultiselectUtils = function useMultiselectUtils(_ref) {
70
73
  setMultiSelectedOpts(multiSelectedOptions.filter(function (opt) {
71
74
  return opt.value !== lastItem.value;
72
75
  }));
73
- setAvailableMultiSelectOptions([].concat(availableMultiSelectOptions, [lastItem]));
76
+
77
+ if (!lastItem.isCreated) {
78
+ setAvailableMultiSelectOptions([].concat(availableMultiSelectOptions, [lastItem]));
79
+ }
74
80
  }
75
81
  }
76
82
  };
77
83
 
78
84
  var handleClearAllOptions = function handleClearAllOptions() {
79
- setAvailableMultiSelectOptions([].concat(availableMultiSelectOptions, multiSelectedOptions));
85
+ setAvailableMultiSelectOptions([].concat(availableMultiSelectOptions, multiSelectedOptions.filter(function (item) {
86
+ return !item.isCreated;
87
+ })));
80
88
  setMultiSelectedOpts([]);
81
89
 
82
90
  if (onClear) {
@@ -101,6 +109,14 @@ var useMultiselectUtils = function useMultiselectUtils(_ref) {
101
109
  setMultiSelectedOpts([].concat(multiSelectedOptions, selected));
102
110
  setAvailableMultiSelectOptions(remaining);
103
111
  setOpen(false);
112
+ } else if (option.isCreated) {
113
+ /** If the option is created internally */
114
+ var newOption = {
115
+ value: option.value,
116
+ label: option.value.toString(),
117
+ isCreated: true
118
+ };
119
+ setMultiSelectedOpts([].concat(multiSelectedOptions, [newOption]));
104
120
  } else {
105
121
  setMultiSelectedOpts([].concat(multiSelectedOptions, [option]));
106
122
  setAvailableMultiSelectOptions(availableMultiSelectOptions.filter(function (opt) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orfium/ictinus",
3
- "version": "4.63.0",
3
+ "version": "4.65.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -120,14 +120,14 @@
120
120
  "react-router-dom": "^5.2.0"
121
121
  },
122
122
  "scripts": {
123
- "prepare": "yarn build && husky install",
123
+ "prepare": "yarn build:lib && husky install",
124
124
  "start": "start-storybook -p 6006",
125
125
  "prebuild": "rimraf dist",
126
126
  "build:partial:style": "cross-env NODE_ENV=production BABEL_ENV=production babel src --config-file ./babelrc.build.json --extensions '.ts' --out-dir ./dist --plugins=babel-plugin-inline-import-data-uri",
127
127
  "build:partial:nostyle": "cross-env NODE_ENV=production BABEL_ENV=production babel src --config-file ./babelrc.build.json --extensions '.ts,.tsx' --out-dir ./dist --plugins=babel-plugin-inline-react-svg --ignore '**/*.style.ts'",
128
128
  "build:partial:types": "tsc --emitDeclarationOnly",
129
- "build": "yarn build:partial:style && yarn build:partial:nostyle && yarn build:partial:types",
130
- "build:storybook": "build-storybook",
129
+ "build:lib": "yarn build:partial:style && yarn build:partial:nostyle && yarn build:partial:types",
130
+ "build": "build-storybook -o build/",
131
131
  "lint": "eslint './src/**/*.{ts,tsx}'",
132
132
  "test": "jest",
133
133
  "test:watch": "jest --watch",