@7shifts/sous-chef 2.6.0 → 2.8.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/dist/feedback/Spinner/Spinner.d.ts +1 -1
- package/dist/forms/CurrencyField/CurrencyField.d.ts +11 -0
- package/dist/forms/CurrencyField/index.d.ts +1 -0
- package/dist/forms/PercentageField/PercentageField.d.ts +13 -0
- package/dist/forms/PercentageField/index.d.ts +1 -0
- package/dist/forms/SelectField/domain.d.ts +5 -0
- package/dist/forms/index.d.ts +3 -1
- package/dist/icons/components/IconUniversity.d.ts +11 -0
- package/dist/icons/components/index.d.ts +1 -0
- package/dist/index.css +4 -0
- package/dist/index.js +254 -16
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +252 -17
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Props as TextFieldProps } from '../TextField/TextField';
|
|
3
|
+
/**
|
|
4
|
+
* `CurrencyField` is like `TextField` but it auto-format the value when the user leaves the field.
|
|
5
|
+
*
|
|
6
|
+
* At the end, it is just a string formatted nicely. **You are in charge of validating the value and parsing it back to a value that you can use on your application**.
|
|
7
|
+
*/
|
|
8
|
+
declare const CurrencyField: React.ForwardRefExoticComponent<TextFieldProps & {
|
|
9
|
+
currencySymbol: string;
|
|
10
|
+
} & Pick<TextFieldProps, "disabled" | "id" | "caption" | "label" | "error" | "onChange" | "name" | "value" | "onBlur" | "placeholder" | "autoFocus" | "onFocus" | "onKeyDown" | "defaultValue" | "autoComplete" | "maxLength"> & React.RefAttributes<HTMLInputElement>>;
|
|
11
|
+
export default CurrencyField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CurrencyField';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Props as TextFieldProps } from '../TextField/TextField';
|
|
3
|
+
/**
|
|
4
|
+
* `PercentageField` is an extended `TextField` input with validation and formatting in place to properly display percentage values.
|
|
5
|
+
* In its default state it only allows integers between 0 and 100, but it can be configured to allow decimals and negative values.
|
|
6
|
+
*/
|
|
7
|
+
declare const PercentageField: React.ForwardRefExoticComponent<{
|
|
8
|
+
max?: number | undefined;
|
|
9
|
+
min?: number | undefined;
|
|
10
|
+
precision?: number | undefined;
|
|
11
|
+
stepSize?: number | undefined;
|
|
12
|
+
} & Pick<TextFieldProps, "disabled" | "id" | "caption" | "label" | "error" | "onChange" | "name" | "value" | "onBlur" | "placeholder" | "prefix" | "autoFocus" | "onFocus" | "onKeyDown" | "defaultValue" | "autoComplete"> & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export default PercentageField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PercentageField';
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ import DateField from './DateField';
|
|
|
13
13
|
import DateRangeField from './DateRangeField';
|
|
14
14
|
import WeekField from './WeekField';
|
|
15
15
|
import TimeField from './TimeField';
|
|
16
|
-
|
|
16
|
+
import CurrencyField from './CurrencyField';
|
|
17
|
+
import PercentageField from './PercentageField';
|
|
18
|
+
export { Form, FormRow, TextAreaField, TextField, CheckboxField, PillSelectField, RadioGroupField, RadioGroupOption, PasswordField, MultiSelectField, SelectField, DateField, DateRangeField, WeekField, TimeField, CurrencyField, PercentageField, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT };
|
|
17
19
|
export type { PasswordCriteria } from './PasswordField/types';
|
|
18
20
|
export type { SelectOption, SelectOptions } from './SelectField/types';
|
|
19
21
|
export type { FormikType } from './Form/types';
|
|
@@ -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 IconUniversity: {
|
|
8
|
+
(props: Props): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default IconUniversity;
|
|
@@ -109,6 +109,7 @@ export { default as IconTimes } from './IconTimes';
|
|
|
109
109
|
export { default as IconTrash } from './IconTrash';
|
|
110
110
|
export { default as IconUnderline } from './IconUnderline';
|
|
111
111
|
export { default as IconUndo } from './IconUndo';
|
|
112
|
+
export { default as IconUniversity } from './IconUniversity';
|
|
112
113
|
export { default as IconUserComputer } from './IconUserComputer';
|
|
113
114
|
export { default as IconUserLight } from './IconUserLight';
|
|
114
115
|
export { default as IconUserPlus } from './IconUserPlus';
|
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -163,7 +163,7 @@ var Inline = function Inline(props) {
|
|
|
163
163
|
}));
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
var styles$2 = {"spinner":"_2wtfD","rotator":"_2Jprn","spinner--block":"_Jmh8M","path":"_3zucL","dash":"_3ZqYM","path--mint":"_3XYKx","path--disabled":"_1pYbs","path--contrast":"_3ofDF"};
|
|
166
|
+
var styles$2 = {"spinner":"_2wtfD","rotator":"_2Jprn","spinner--block":"_Jmh8M","path":"_3zucL","dash":"_3ZqYM","path--mint":"_3XYKx","path--disabled":"_1pYbs","path--contrast":"_3ofDF","path--pride":"_e0OH1"};
|
|
167
167
|
|
|
168
168
|
var Spinner = function Spinner(_ref) {
|
|
169
169
|
var _classnames;
|
|
@@ -183,7 +183,75 @@ var Spinner = function Spinner(_ref) {
|
|
|
183
183
|
height: size,
|
|
184
184
|
viewBox: "0 0 66 66",
|
|
185
185
|
"data-testid": "spinner"
|
|
186
|
-
}, React__default.createElement("
|
|
186
|
+
}, React__default.createElement("defs", null, React__default.createElement("linearGradient", {
|
|
187
|
+
id: "prideGradient"
|
|
188
|
+
}, React__default.createElement("stop", {
|
|
189
|
+
offset: "0",
|
|
190
|
+
stopColor: "#000000"
|
|
191
|
+
}), React__default.createElement("stop", {
|
|
192
|
+
offset: "0.0500",
|
|
193
|
+
stopColor: "#000000"
|
|
194
|
+
}), React__default.createElement("stop", {
|
|
195
|
+
offset: "0.0501",
|
|
196
|
+
stopColor: "#ffafc7"
|
|
197
|
+
}), React__default.createElement("stop", {
|
|
198
|
+
offset: "0.15",
|
|
199
|
+
stopColor: "#ffafc7"
|
|
200
|
+
}), React__default.createElement("stop", {
|
|
201
|
+
offset: "0.1501",
|
|
202
|
+
stopColor: "#73d7ee"
|
|
203
|
+
}), React__default.createElement("stop", {
|
|
204
|
+
offset: "0.25",
|
|
205
|
+
stopColor: "#73d7ee"
|
|
206
|
+
}), React__default.createElement("stop", {
|
|
207
|
+
offset: "0.2501",
|
|
208
|
+
stopColor: "#613915"
|
|
209
|
+
}), React__default.createElement("stop", {
|
|
210
|
+
offset: "0.35",
|
|
211
|
+
stopColor: "#613915"
|
|
212
|
+
}), React__default.createElement("stop", {
|
|
213
|
+
offset: "0.3501",
|
|
214
|
+
stopColor: "#ffffff"
|
|
215
|
+
}), React__default.createElement("stop", {
|
|
216
|
+
offset: "0.45",
|
|
217
|
+
stopColor: "#ffffff"
|
|
218
|
+
}), React__default.createElement("stop", {
|
|
219
|
+
offset: "0.4501",
|
|
220
|
+
stopColor: "#e50000"
|
|
221
|
+
}), React__default.createElement("stop", {
|
|
222
|
+
offset: "0.55",
|
|
223
|
+
stopColor: "#e50000"
|
|
224
|
+
}), React__default.createElement("stop", {
|
|
225
|
+
offset: "0.5501",
|
|
226
|
+
stopColor: "#ff8d00"
|
|
227
|
+
}), React__default.createElement("stop", {
|
|
228
|
+
offset: "0.65",
|
|
229
|
+
stopColor: "#ff8d00"
|
|
230
|
+
}), React__default.createElement("stop", {
|
|
231
|
+
offset: "0.6501",
|
|
232
|
+
stopColor: "#ddee00"
|
|
233
|
+
}), React__default.createElement("stop", {
|
|
234
|
+
offset: "0.75",
|
|
235
|
+
stopColor: "#ddee00"
|
|
236
|
+
}), React__default.createElement("stop", {
|
|
237
|
+
offset: "0.7501",
|
|
238
|
+
stopColor: "#028121"
|
|
239
|
+
}), React__default.createElement("stop", {
|
|
240
|
+
offset: "0.85",
|
|
241
|
+
stopColor: "#028121"
|
|
242
|
+
}), React__default.createElement("stop", {
|
|
243
|
+
offset: "0.8501",
|
|
244
|
+
stopColor: "#004cff"
|
|
245
|
+
}), React__default.createElement("stop", {
|
|
246
|
+
offset: "0.95",
|
|
247
|
+
stopColor: "#004cff"
|
|
248
|
+
}), React__default.createElement("stop", {
|
|
249
|
+
offset: "0.9501",
|
|
250
|
+
stopColor: "#760088"
|
|
251
|
+
}), React__default.createElement("stop", {
|
|
252
|
+
offset: "1",
|
|
253
|
+
stopColor: "#760088"
|
|
254
|
+
}))), React__default.createElement("circle", {
|
|
187
255
|
className: classnames(styles$2['path'], styles$2["path--" + theme]),
|
|
188
256
|
fill: "none",
|
|
189
257
|
strokeWidth: "6",
|
|
@@ -2735,6 +2803,28 @@ var IconUndo = function IconUndo(props) {
|
|
|
2735
2803
|
|
|
2736
2804
|
IconUndo.displayName = 'IconUndo';
|
|
2737
2805
|
|
|
2806
|
+
var IconUniversity = function IconUniversity(props) {
|
|
2807
|
+
return React__default.createElement("svg", Object.assign({
|
|
2808
|
+
viewBox: "0 0 20 20",
|
|
2809
|
+
fill: "none",
|
|
2810
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2811
|
+
"data-testid": "icon-university",
|
|
2812
|
+
style: getIconStyles(props)
|
|
2813
|
+
}, props), React__default.createElement("g", {
|
|
2814
|
+
clipPath: "url(#icon-university_svg__a)"
|
|
2815
|
+
}, React__default.createElement("path", {
|
|
2816
|
+
d: "M19.375 17.5h-.625v-1.563a.937.937 0 0 0-.938-.937H16.25V8.125H15V15h-2.5V8.125h-1.25V15h-2.5V8.125H7.5V15H5V8.125H3.75V15H2.187a.937.937 0 0 0-.937.938V17.5H.625a.625.625 0 0 0-.625.625v.313a.313.313 0 0 0 .313.312h19.375a.313.313 0 0 0 .312-.313v-.312a.625.625 0 0 0-.625-.625ZM2.5 16.25h15v1.25h-15v-1.25ZM19.698 5.312l-9.105-3.966a1.875 1.875 0 0 0-1.186 0L.302 5.312A.469.469 0 0 0 0 5.752v.343c0 .259.21.468.469.468h.781v.47c0 .258.21.468.469.468H18.28c.26 0 .469-.21.469-.469v-.468h.781c.26 0 .469-.21.469-.47v-.342a.469.469 0 0 0-.302-.439ZM17.5 6.25h-15v-.531L9.842 2.52a.625.625 0 0 1 .316 0L17.5 5.72v.531Z",
|
|
2817
|
+
fill: "currentColor"
|
|
2818
|
+
})), React__default.createElement("defs", null, React__default.createElement("clipPath", {
|
|
2819
|
+
id: "icon-university_svg__a"
|
|
2820
|
+
}, React__default.createElement("path", {
|
|
2821
|
+
fill: "#fff",
|
|
2822
|
+
d: "M0 0h20v20H0z"
|
|
2823
|
+
}))));
|
|
2824
|
+
};
|
|
2825
|
+
|
|
2826
|
+
IconUniversity.displayName = 'IconUniversity';
|
|
2827
|
+
|
|
2738
2828
|
var IconUserComputer = function IconUserComputer(props) {
|
|
2739
2829
|
return React__default.createElement("svg", Object.assign({
|
|
2740
2830
|
viewBox: "0 0 20 20",
|
|
@@ -3609,7 +3699,7 @@ var useFieldControllers = function useFieldControllers(_ref) {
|
|
|
3609
3699
|
return formik.setFieldValue(name, e.target.value);
|
|
3610
3700
|
},
|
|
3611
3701
|
onBlur: _onBlur ? function (e) {
|
|
3612
|
-
|
|
3702
|
+
_onBlur && _onBlur(e.target.value);
|
|
3613
3703
|
currencyBlur();
|
|
3614
3704
|
} : function () {
|
|
3615
3705
|
formik.setFieldTouched(name);
|
|
@@ -4491,7 +4581,7 @@ var useRadioGroupFieldControllers = function useRadioGroupFieldControllers(_ref)
|
|
|
4491
4581
|
error: error !== undefined ? controllers.error : formikState.error,
|
|
4492
4582
|
value: value !== undefined ? controllers.value : formikState.value,
|
|
4493
4583
|
onChange: function onChange(e) {
|
|
4494
|
-
formik.setFieldValue(name, e.target.
|
|
4584
|
+
formik.setFieldValue(name, e.target.value);
|
|
4495
4585
|
_onChange && _onChange(e.target.value);
|
|
4496
4586
|
}
|
|
4497
4587
|
});
|
|
@@ -4869,6 +4959,28 @@ function CustomOption(_ref) {
|
|
|
4869
4959
|
return React__default.createElement(Select.components.Option, Object.assign({}, props), React__default.createElement(CustomComponent, Object.assign({}, props), children));
|
|
4870
4960
|
}
|
|
4871
4961
|
|
|
4962
|
+
var isScrollingTheSelectMenu = function isScrollingTheSelectMenu(element) {
|
|
4963
|
+
if (!isReactSelectElement(element)) {
|
|
4964
|
+
var _element$children;
|
|
4965
|
+
|
|
4966
|
+
return isReactSelectElement(element === null || element === void 0 ? void 0 : (_element$children = element.children) === null || _element$children === void 0 ? void 0 : _element$children[0]);
|
|
4967
|
+
}
|
|
4968
|
+
|
|
4969
|
+
return true;
|
|
4970
|
+
};
|
|
4971
|
+
|
|
4972
|
+
var isReactSelectElement = function isReactSelectElement(element) {
|
|
4973
|
+
var _element$children2;
|
|
4974
|
+
|
|
4975
|
+
var firstOption = element === null || element === void 0 ? void 0 : (_element$children2 = element.children) === null || _element$children2 === void 0 ? void 0 : _element$children2[0];
|
|
4976
|
+
|
|
4977
|
+
if (!firstOption) {
|
|
4978
|
+
return false;
|
|
4979
|
+
}
|
|
4980
|
+
|
|
4981
|
+
return typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
|
|
4982
|
+
};
|
|
4983
|
+
|
|
4872
4984
|
var MultiSelectField = function MultiSelectField(_ref) {
|
|
4873
4985
|
var name = _ref.name,
|
|
4874
4986
|
inputId = _ref.id,
|
|
@@ -4937,10 +5049,7 @@ var MultiSelectField = function MultiSelectField(_ref) {
|
|
|
4937
5049
|
return false;
|
|
4938
5050
|
}
|
|
4939
5051
|
|
|
4940
|
-
|
|
4941
|
-
var firstOption = target.children[0];
|
|
4942
|
-
var isScrollingTheMenu = firstOption && typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
|
|
4943
|
-
return !isScrollingTheMenu;
|
|
5052
|
+
return !isScrollingTheSelectMenu(e.target);
|
|
4944
5053
|
}
|
|
4945
5054
|
}));
|
|
4946
5055
|
};
|
|
@@ -5030,10 +5139,7 @@ var SelectField = function SelectField(_ref) {
|
|
|
5030
5139
|
return false;
|
|
5031
5140
|
}
|
|
5032
5141
|
|
|
5033
|
-
|
|
5034
|
-
var firstOption = target.children[0];
|
|
5035
|
-
var isScrollingTheMenu = firstOption && typeof firstOption.id === 'string' && firstOption.id.includes('react-select');
|
|
5036
|
-
return !isScrollingTheMenu;
|
|
5142
|
+
return !isScrollingTheSelectMenu(e.target);
|
|
5037
5143
|
},
|
|
5038
5144
|
components: {
|
|
5039
5145
|
Option: UserCustomOption ? function (props) {
|
|
@@ -5271,7 +5377,7 @@ var DateField = function DateField(_ref) {
|
|
|
5271
5377
|
inputProps: {
|
|
5272
5378
|
name: name,
|
|
5273
5379
|
id: controllers.id,
|
|
5274
|
-
className: classnames(inputStyles['date-field'], (_classnames = {}, _classnames[inputStyles['date--invalid']] = hasError, _classnames)),
|
|
5380
|
+
className: classnames(inputStyles['date-field'], (_classnames = {}, _classnames[inputStyles['date-field--invalid']] = hasError, _classnames)),
|
|
5275
5381
|
'data-testid': "date-field-" + name,
|
|
5276
5382
|
'aria-describedby': hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
5277
5383
|
'aria-invalid': hasError,
|
|
@@ -5773,7 +5879,7 @@ var WeekField = function WeekField(_ref) {
|
|
|
5773
5879
|
inputProps: {
|
|
5774
5880
|
name: name,
|
|
5775
5881
|
id: controllers.id,
|
|
5776
|
-
className: classnames(inputStyles['date-field'], (_classnames = {}, _classnames[inputStyles['date--invalid']] = hasError, _classnames)),
|
|
5882
|
+
className: classnames(inputStyles['date-field'], (_classnames = {}, _classnames[inputStyles['date-field--invalid']] = hasError, _classnames)),
|
|
5777
5883
|
'data-testid': "week-field-" + name,
|
|
5778
5884
|
'aria-describedby': hasError ? controllers.id + "-error-message" : controllers.id + "-describer",
|
|
5779
5885
|
'aria-invalid': hasError,
|
|
@@ -5819,6 +5925,135 @@ var TimeFieldElement = function TimeFieldElement(_ref, ref) {
|
|
|
5819
5925
|
|
|
5820
5926
|
var TimeField = React.forwardRef(TimeFieldElement);
|
|
5821
5927
|
|
|
5928
|
+
var _excluded$7 = ["currencySymbol"];
|
|
5929
|
+
|
|
5930
|
+
var CurrencyFieldElement = function CurrencyFieldElement(_ref, ref) {
|
|
5931
|
+
var _ref$currencySymbol = _ref.currencySymbol,
|
|
5932
|
+
currencySymbol = _ref$currencySymbol === void 0 ? "$" : _ref$currencySymbol,
|
|
5933
|
+
allOtherProps = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
5934
|
+
|
|
5935
|
+
var _useTextField = useTextField(_extends({}, allOtherProps, {
|
|
5936
|
+
ref: ref
|
|
5937
|
+
})),
|
|
5938
|
+
inputProps = _useTextField.inputProps,
|
|
5939
|
+
fieldProps = _useTextField.fieldProps;
|
|
5940
|
+
|
|
5941
|
+
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
|
|
5942
|
+
prefix: currencySymbol
|
|
5943
|
+
}, React__default.createElement("input", Object.assign({}, inputProps, {
|
|
5944
|
+
type: 'number',
|
|
5945
|
+
inputMode: 'decimal',
|
|
5946
|
+
step: '0.01',
|
|
5947
|
+
min: 0,
|
|
5948
|
+
onKeyDown: function onKeyDown(e) {
|
|
5949
|
+
if (e.key === 'e' || e.key === '-') {
|
|
5950
|
+
e.preventDefault();
|
|
5951
|
+
return;
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
inputProps.onKeyDown(e);
|
|
5955
|
+
},
|
|
5956
|
+
onBlur: function onBlur(e) {
|
|
5957
|
+
e.currentTarget.value = parseFloat(e.currentTarget.value).toFixed(2);
|
|
5958
|
+
inputProps.onChange(e);
|
|
5959
|
+
inputProps.onBlur(e);
|
|
5960
|
+
}
|
|
5961
|
+
}))));
|
|
5962
|
+
};
|
|
5963
|
+
|
|
5964
|
+
var CurrencyField = React.forwardRef(CurrencyFieldElement);
|
|
5965
|
+
|
|
5966
|
+
var _excluded$8 = ["max", "min", "precision", "stepSize"];
|
|
5967
|
+
|
|
5968
|
+
var PercentageElement = function PercentageElement(_ref, ref) {
|
|
5969
|
+
var _ref$max = _ref.max,
|
|
5970
|
+
max = _ref$max === void 0 ? 100 : _ref$max,
|
|
5971
|
+
_ref$min = _ref.min,
|
|
5972
|
+
min = _ref$min === void 0 ? 0 : _ref$min,
|
|
5973
|
+
_ref$precision = _ref.precision,
|
|
5974
|
+
precision = _ref$precision === void 0 ? 0 : _ref$precision,
|
|
5975
|
+
_ref$stepSize = _ref.stepSize,
|
|
5976
|
+
stepSize = _ref$stepSize === void 0 ? 1 : _ref$stepSize,
|
|
5977
|
+
allOtherProps = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
5978
|
+
|
|
5979
|
+
var _useTextField = useTextField(_extends({}, allOtherProps, {
|
|
5980
|
+
ref: ref
|
|
5981
|
+
})),
|
|
5982
|
+
inputProps = _useTextField.inputProps,
|
|
5983
|
+
fieldProps = _useTextField.fieldProps;
|
|
5984
|
+
|
|
5985
|
+
var inputMode = precision > 0 ? 'decimal' : 'numeric';
|
|
5986
|
+
|
|
5987
|
+
var decimalDigitsCount = function decimalDigitsCount(input) {
|
|
5988
|
+
var decimalIndex = input.indexOf('.');
|
|
5989
|
+
return decimalIndex === -1 ? 0 : input.length - decimalIndex - 1;
|
|
5990
|
+
};
|
|
5991
|
+
|
|
5992
|
+
var inputIsValid = function inputIsValid(valueAsString) {
|
|
5993
|
+
if (valueAsString.startsWith('00')) {
|
|
5994
|
+
return false;
|
|
5995
|
+
}
|
|
5996
|
+
|
|
5997
|
+
if (valueAsString === '-' || valueAsString === '.') {
|
|
5998
|
+
return true;
|
|
5999
|
+
}
|
|
6000
|
+
|
|
6001
|
+
if (valueAsString.indexOf('-') > 0) {
|
|
6002
|
+
return false;
|
|
6003
|
+
}
|
|
6004
|
+
|
|
6005
|
+
return decimalDigitsCount(valueAsString) <= precision;
|
|
6006
|
+
};
|
|
6007
|
+
|
|
6008
|
+
var keyPressIsValid = function keyPressIsValid(keyPress, value) {
|
|
6009
|
+
if (keyPress == 'e' || keyPress == '+' || keyPress == '-' && min >= 0) {
|
|
6010
|
+
return false;
|
|
6011
|
+
}
|
|
6012
|
+
|
|
6013
|
+
if (keyPress == '.' && (precision == 0 || Number(value) == max)) {
|
|
6014
|
+
return false;
|
|
6015
|
+
}
|
|
6016
|
+
|
|
6017
|
+
return true;
|
|
6018
|
+
};
|
|
6019
|
+
|
|
6020
|
+
return React__default.createElement(Field, Object.assign({}, fieldProps), React__default.createElement(AffixContainer, {
|
|
6021
|
+
suffix: '%'
|
|
6022
|
+
}, React__default.createElement("input", Object.assign({}, inputProps, {
|
|
6023
|
+
type: 'number',
|
|
6024
|
+
inputMode: inputMode,
|
|
6025
|
+
step: stepSize,
|
|
6026
|
+
max: max,
|
|
6027
|
+
min: min,
|
|
6028
|
+
onKeyDown: function onKeyDown(e) {
|
|
6029
|
+
var value = e.currentTarget.value + e.key;
|
|
6030
|
+
|
|
6031
|
+
if (e.key.length === 1 && (!keyPressIsValid(e.key, value) || !inputIsValid(value))) {
|
|
6032
|
+
e.preventDefault();
|
|
6033
|
+
return;
|
|
6034
|
+
}
|
|
6035
|
+
|
|
6036
|
+
inputProps.onKeyDown(e);
|
|
6037
|
+
},
|
|
6038
|
+
onChange: function onChange(e) {
|
|
6039
|
+
var number = Number(e.target.value);
|
|
6040
|
+
|
|
6041
|
+
if (number > max) {
|
|
6042
|
+
e.target.value = String(max);
|
|
6043
|
+
}
|
|
6044
|
+
|
|
6045
|
+
if (number < min) {
|
|
6046
|
+
e.target.value = String(min);
|
|
6047
|
+
}
|
|
6048
|
+
|
|
6049
|
+
inputProps.onChange(e);
|
|
6050
|
+
inputProps.onBlur(e);
|
|
6051
|
+
}
|
|
6052
|
+
}))));
|
|
6053
|
+
};
|
|
6054
|
+
|
|
6055
|
+
var PercentageField = React.forwardRef(PercentageElement);
|
|
6056
|
+
|
|
5822
6057
|
var styles$u = {"caption":"_1QDLF","label":"_2wiMV","toggle":"_1ui8X","toggle__label":"_1YRJT","toggle__caption":"_1jEiW","toggle__switch":"_3tNyE"};
|
|
5823
6058
|
|
|
5824
6059
|
var Toggle = function Toggle(_ref) {
|
|
@@ -5992,7 +6227,7 @@ var FooterContainer = function FooterContainer(_ref2) {
|
|
|
5992
6227
|
|
|
5993
6228
|
var styles$z = {"badge":"_2f81N","badge--warning":"_2g1GI","badge--danger":"_2zLnM","badge--success":"_27QOo","badge--info":"_2gmsM"};
|
|
5994
6229
|
|
|
5995
|
-
var _excluded$
|
|
6230
|
+
var _excluded$9 = ["children", "theme", "title"];
|
|
5996
6231
|
|
|
5997
6232
|
var Badge = function Badge(_ref, forwardedRef) {
|
|
5998
6233
|
var _classnames;
|
|
@@ -6000,7 +6235,7 @@ var Badge = function Badge(_ref, forwardedRef) {
|
|
|
6000
6235
|
var children = _ref.children,
|
|
6001
6236
|
theme = _ref.theme,
|
|
6002
6237
|
title = _ref.title,
|
|
6003
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6238
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
6004
6239
|
|
|
6005
6240
|
var internalRef = React.useRef(null);
|
|
6006
6241
|
var ref = forwardedRef || internalRef;
|
|
@@ -6135,6 +6370,7 @@ exports.Avatar = Avatar;
|
|
|
6135
6370
|
exports.Badge = Badge$1;
|
|
6136
6371
|
exports.Button = Button$1;
|
|
6137
6372
|
exports.CheckboxField = CheckboxField;
|
|
6373
|
+
exports.CurrencyField = CurrencyField;
|
|
6138
6374
|
exports.DataTable = DataTable;
|
|
6139
6375
|
exports.DataTableCell = DataTableCell;
|
|
6140
6376
|
exports.DataTableEditableCell = DataTableEditableCell;
|
|
@@ -6254,6 +6490,7 @@ exports.IconTimesOctagon = IconTimesOctagon;
|
|
|
6254
6490
|
exports.IconTrash = IconTrash;
|
|
6255
6491
|
exports.IconUnderline = IconUnderline;
|
|
6256
6492
|
exports.IconUndo = IconUndo;
|
|
6493
|
+
exports.IconUniversity = IconUniversity;
|
|
6257
6494
|
exports.IconUserComputer = IconUserComputer;
|
|
6258
6495
|
exports.IconUserLight = IconUserLight;
|
|
6259
6496
|
exports.IconUserPlus = IconUserPlus;
|
|
@@ -6273,6 +6510,7 @@ exports.ModalFooter = ModalFooter;
|
|
|
6273
6510
|
exports.MultiSelectField = MultiSelectField;
|
|
6274
6511
|
exports.PaginationControls = PaginationControls;
|
|
6275
6512
|
exports.PasswordField = PasswordField;
|
|
6513
|
+
exports.PercentageField = PercentageField;
|
|
6276
6514
|
exports.PillSelectField = PillSelectField;
|
|
6277
6515
|
exports.RadioGroupField = RadioGroupField;
|
|
6278
6516
|
exports.RadioGroupOption = RadioGroupOption;
|