@7shifts/sous-chef 2.12.0 → 2.13.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.
- package/dist/forms/AsyncSelectField/AsyncSelectField.d.ts +3 -1
- package/dist/icons/components/IconReply.d.ts +11 -0
- package/dist/icons/components/index.d.ts +1 -0
- package/dist/index.js +62 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +62 -7
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Props as SelectProps } from '../SelectField/SelectField';
|
|
2
2
|
import { AsyncSelectOptions } from './types';
|
|
3
3
|
declare type Props<T> = {
|
|
4
|
-
/** It is a function that takes the input search as parameter and returns a Promise with all the options and if there are more options to load. */
|
|
4
|
+
/** It is a function that takes the input search as parameter and returns a Promise with all the options and if there are more options to load. If it brings all the options on the first load, it won't call the `loadOptions` to perform the search. */
|
|
5
5
|
loadOptions: (inputValue: string) => Promise<AsyncSelectOptions<T>>;
|
|
6
|
+
/** It fires `loadOptions` again if this key value changes. Used when it depends on other fields to load its options */
|
|
7
|
+
key?: string | number;
|
|
6
8
|
} & Omit<SelectProps<T>, 'options'>;
|
|
7
9
|
/**
|
|
8
10
|
* Component to make possible choose from async options. It looks exactly as the [SelectField](./?path=/docs/forms-selectfield--default) but, this one handle asynchronous options.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconSize } from '../types';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
size?: IconSize;
|
|
5
|
+
color?: string;
|
|
6
|
+
} & React.SVGProps<SVGSVGElement>;
|
|
7
|
+
declare const IconReply: {
|
|
8
|
+
(props: Props): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default IconReply;
|
|
@@ -91,6 +91,7 @@ export { default as IconPlus } from './IconPlus';
|
|
|
91
91
|
export { default as IconPrint } from './IconPrint';
|
|
92
92
|
export { default as IconQuestionCircle } from './IconQuestionCircle';
|
|
93
93
|
export { default as IconRepeat } from './IconRepeat';
|
|
94
|
+
export { default as IconReply } from './IconReply';
|
|
94
95
|
export { default as IconSearch } from './IconSearch';
|
|
95
96
|
export { default as IconSignOut } from './IconSignOut';
|
|
96
97
|
export { default as IconSitemap } from './IconSitemap';
|
package/dist/index.js
CHANGED
|
@@ -2509,6 +2509,21 @@ var IconRepeat = function IconRepeat(props) {
|
|
|
2509
2509
|
|
|
2510
2510
|
IconRepeat.displayName = 'IconRepeat';
|
|
2511
2511
|
|
|
2512
|
+
var IconReply = function IconReply(props) {
|
|
2513
|
+
return React__default.createElement("svg", Object.assign({
|
|
2514
|
+
viewBox: "0 0 20 20",
|
|
2515
|
+
fill: "none",
|
|
2516
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2517
|
+
"data-testid": "icon-reply",
|
|
2518
|
+
style: getIconStyles(props)
|
|
2519
|
+
}, props), React__default.createElement("path", {
|
|
2520
|
+
d: "m.788 9.854 5.893 6.161c.828.866 2.307.288 2.307-.926v-2.94c5.17.06 7.335.56 6.067 5.058-.28.988.852 1.749 1.663 1.156 1.115-.815 2.985-2.665 2.985-5.845 0-5.729-5.175-6.731-10.715-6.798V2.77c0-1.215-1.48-1.79-2.307-.926L.788 8.003a1.34 1.34 0 0 0 0 1.851Zm.775-1.11 5.893-6.161a.268.268 0 0 1 .461.185v4.018c5.26 0 10.714.374 10.714 5.732 0 2.49-1.339 4.09-2.545 4.972 1.719-6.093-2.43-6.418-8.169-6.418v4.017a.268.268 0 0 1-.461.186L1.563 9.114a.267.267 0 0 1 0-.37Z",
|
|
2521
|
+
fill: "currentColor"
|
|
2522
|
+
}));
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2525
|
+
IconReply.displayName = 'IconReply';
|
|
2526
|
+
|
|
2512
2527
|
var IconSearch = function IconSearch(props) {
|
|
2513
2528
|
return React__default.createElement("svg", Object.assign({
|
|
2514
2529
|
viewBox: "0 0 20 20",
|
|
@@ -3219,7 +3234,7 @@ var getLocalTranslation = function getLocalTranslation(key) {
|
|
|
3219
3234
|
|
|
3220
3235
|
if (translationParts.length > 1) {
|
|
3221
3236
|
var literal = translationParts[1];
|
|
3222
|
-
return literal.charAt(0).toUpperCase() + literal.slice(1).toLowerCase().
|
|
3237
|
+
return literal.charAt(0).toUpperCase() + literal.slice(1).toLowerCase().replace(/_/g, ' ');
|
|
3223
3238
|
}
|
|
3224
3239
|
|
|
3225
3240
|
return key;
|
|
@@ -5293,14 +5308,55 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
|
|
|
5293
5308
|
hasMoreOptionsFirstLoad = _useState2[0],
|
|
5294
5309
|
setHasMoreOptionsFirstLoad = _useState2[1];
|
|
5295
5310
|
|
|
5311
|
+
var _useState3 = React.useState(false),
|
|
5312
|
+
hasFirstLoadPerformed = _useState3[0],
|
|
5313
|
+
setHasFirstLoadPerformed = _useState3[1];
|
|
5314
|
+
|
|
5315
|
+
var _useState4 = React.useState(null),
|
|
5316
|
+
localOptions = _useState4[0],
|
|
5317
|
+
setLocalOptions = _useState4[1];
|
|
5318
|
+
|
|
5319
|
+
var ref = React.useRef(null);
|
|
5320
|
+
|
|
5321
|
+
var handleInternalSearch = function handleInternalSearch(inputValue, callback) {
|
|
5322
|
+
if (!localOptions) {
|
|
5323
|
+
return;
|
|
5324
|
+
}
|
|
5325
|
+
|
|
5326
|
+
var filteredOptions = localOptions.filter(function (option) {
|
|
5327
|
+
return option.label.toLowerCase().includes(inputValue.toLocaleLowerCase());
|
|
5328
|
+
});
|
|
5329
|
+
callback(filteredOptions);
|
|
5330
|
+
};
|
|
5331
|
+
|
|
5296
5332
|
var handleLoadOptions = function handleLoadOptions(inputValue, callback) {
|
|
5297
5333
|
if (hasMoreOptions) {
|
|
5298
5334
|
setHasMoreOptions(false);
|
|
5299
5335
|
}
|
|
5300
5336
|
|
|
5301
|
-
|
|
5337
|
+
if (localOptions) {
|
|
5338
|
+
handleInternalSearch(inputValue, callback);
|
|
5339
|
+
return;
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5342
|
+
loadOptions(inputValue).then(function (_ref2) {
|
|
5343
|
+
var _ref$current;
|
|
5344
|
+
|
|
5302
5345
|
var hasMore = _ref2.hasMore,
|
|
5303
5346
|
options = _ref2.options;
|
|
5347
|
+
|
|
5348
|
+
if (ref.current && inputValue !== (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current['state']['inputValue'])) {
|
|
5349
|
+
return;
|
|
5350
|
+
}
|
|
5351
|
+
|
|
5352
|
+
if (!hasFirstLoadPerformed) {
|
|
5353
|
+
setHasFirstLoadPerformed(true);
|
|
5354
|
+
|
|
5355
|
+
if (!hasMore) {
|
|
5356
|
+
setLocalOptions(options);
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5304
5360
|
setHasMoreOptions(hasMore);
|
|
5305
5361
|
|
|
5306
5362
|
if (hasMoreOptionsFirstLoad === undefined) {
|
|
@@ -5308,7 +5364,6 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
|
|
|
5308
5364
|
}
|
|
5309
5365
|
|
|
5310
5366
|
callback(options);
|
|
5311
|
-
return options;
|
|
5312
5367
|
});
|
|
5313
5368
|
};
|
|
5314
5369
|
|
|
@@ -5332,9 +5387,9 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
|
|
|
5332
5387
|
cacheOptions: false,
|
|
5333
5388
|
defaultOptions: true,
|
|
5334
5389
|
loadOptions: lodashEs.debounce(handleLoadOptions, 500, {
|
|
5335
|
-
leading: true
|
|
5336
|
-
|
|
5337
|
-
|
|
5390
|
+
leading: true
|
|
5391
|
+
}),
|
|
5392
|
+
ref: ref
|
|
5338
5393
|
}))));
|
|
5339
5394
|
};
|
|
5340
5395
|
|
|
@@ -6904,6 +6959,7 @@ exports.IconPlus = IconPlus;
|
|
|
6904
6959
|
exports.IconPrint = IconPrint;
|
|
6905
6960
|
exports.IconQuestionCircle = IconQuestionCircle;
|
|
6906
6961
|
exports.IconRepeat = IconRepeat;
|
|
6962
|
+
exports.IconReply = IconReply;
|
|
6907
6963
|
exports.IconSearch = IconSearch;
|
|
6908
6964
|
exports.IconSignOut = IconSignOut;
|
|
6909
6965
|
exports.IconSitemap = IconSitemap;
|