@codeleap/web 5.4.4 → 5.4.5
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/components/ActionIcon/types.d.ts +1 -1
- package/dist/components/Checkbox/index.js +14 -10
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/types.d.ts +4 -2
- package/dist/components/DatePicker/components/DayContent.d.ts +11 -0
- package/dist/components/DatePicker/components/DayContent.js +43 -0
- package/dist/components/DatePicker/components/DayContent.js.map +1 -0
- package/dist/components/DatePicker/components/OuterInput.js +2 -2
- package/dist/components/DatePicker/components/OuterInput.js.map +1 -1
- package/dist/components/DatePicker/components/YearContent.d.ts +9 -0
- package/dist/components/DatePicker/components/YearContent.js +33 -0
- package/dist/components/DatePicker/components/YearContent.js.map +1 -0
- package/dist/components/DatePicker/components/index.d.ts +2 -0
- package/dist/components/DatePicker/components/index.js +2 -0
- package/dist/components/DatePicker/components/index.js.map +1 -1
- package/dist/components/DatePicker/index.js +10 -33
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/types.d.ts +5 -6
- package/dist/components/InputBase/index.d.ts +2 -5
- package/dist/components/InputBase/index.js +19 -11
- package/dist/components/InputBase/index.js.map +1 -1
- package/dist/components/InputBase/types.d.ts +2 -1
- package/dist/components/InputBase/useInputBase.d.ts +60 -0
- package/dist/components/InputBase/useInputBase.js +55 -0
- package/dist/components/InputBase/useInputBase.js.map +1 -0
- package/dist/components/InputBase/useInputBasePartialStyles.d.ts +2 -0
- package/dist/components/InputBase/useInputBasePartialStyles.js +40 -0
- package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -0
- package/dist/components/Modal/index.d.ts +0 -3
- package/dist/components/Modal/index.js +35 -52
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.d.ts +0 -4
- package/dist/components/NumberIncrement/index.js +18 -124
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/types.d.ts +5 -6
- package/dist/components/NumberIncrement/useNumberIncrement.d.ts +60 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js +115 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
- package/dist/components/RadioInput/index.js +14 -14
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/types.d.ts +9 -9
- package/dist/components/SearchInput/index.js +1 -1
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/Select/index.js +5 -7
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.d.ts +2 -8
- package/dist/components/Select/styles.js.map +1 -1
- package/dist/components/Select/types.d.ts +10 -9
- package/dist/components/Slider/index.js +16 -46
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/types.d.ts +4 -2
- package/dist/components/Switch/index.js +13 -11
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/types.d.ts +4 -2
- package/dist/components/TextEditor/index.js +7 -14
- package/dist/components/TextEditor/index.js.map +1 -1
- package/dist/components/TextEditor/types.d.ts +2 -3
- package/dist/components/TextInput/index.js +31 -92
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/types.d.ts +8 -7
- package/dist/components/TextInput/useTextInput.d.ts +90 -0
- package/dist/components/TextInput/useTextInput.js +74 -0
- package/dist/components/TextInput/useTextInput.js.map +1 -0
- package/dist/lib/tools/index.d.ts +0 -1
- package/dist/lib/tools/index.js +0 -1
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tools/modal.d.ts +2 -2
- package/dist/lib/tools/modal.js +5 -4
- package/dist/lib/tools/modal.js.map +1 -1
- package/dist/types/utility.d.ts +1 -1
- package/package.json +17 -19
- package/package.json.bak +1 -3
- package/src/components/ActionIcon/types.ts +1 -1
- package/src/components/Checkbox/index.tsx +23 -9
- package/src/components/Checkbox/types.ts +4 -2
- package/src/components/DatePicker/components/DayContent.tsx +52 -0
- package/src/components/DatePicker/components/OuterInput.tsx +1 -2
- package/src/components/DatePicker/components/YearContent.tsx +39 -0
- package/src/components/DatePicker/components/index.tsx +2 -0
- package/src/components/DatePicker/index.tsx +33 -84
- package/src/components/DatePicker/types.ts +5 -6
- package/src/components/InputBase/index.tsx +9 -8
- package/src/components/InputBase/types.ts +2 -1
- package/src/components/InputBase/useInputBase.ts +56 -0
- package/src/components/InputBase/useInputBasePartialStyles.ts +37 -0
- package/src/components/Modal/index.tsx +64 -64
- package/src/components/Modal/types.ts +0 -4
- package/src/components/NumberIncrement/index.tsx +44 -141
- package/src/components/NumberIncrement/types.ts +5 -6
- package/src/components/NumberIncrement/useNumberIncrement.ts +149 -0
- package/src/components/RadioInput/index.tsx +32 -17
- package/src/components/RadioInput/types.ts +16 -15
- package/src/components/SearchInput/index.tsx +1 -1
- package/src/components/Select/index.tsx +6 -11
- package/src/components/Select/styles.ts +2 -2
- package/src/components/Select/types.ts +10 -9
- package/src/components/Slider/index.tsx +28 -52
- package/src/components/Slider/types.ts +4 -2
- package/src/components/Switch/index.tsx +19 -8
- package/src/components/Switch/types.ts +4 -2
- package/src/components/TextEditor/index.tsx +6 -14
- package/src/components/TextEditor/types.ts +2 -3
- package/src/components/TextInput/index.tsx +54 -103
- package/src/components/TextInput/types.ts +8 -7
- package/src/components/TextInput/useTextInput.ts +101 -0
- package/src/lib/tools/index.ts +0 -1
- package/src/lib/tools/modal.ts +3 -3
- package/src/types/utility.ts +1 -1
- package/dist/lib/tools/navigation/index.d.ts +0 -58
- package/dist/lib/tools/navigation/index.js +0 -235
- package/dist/lib/tools/navigation/index.js.map +0 -1
- package/dist/lib/tools/navigation/types.d.ts +0 -32
- package/dist/lib/tools/navigation/types.js +0 -3
- package/dist/lib/tools/navigation/types.js.map +0 -1
- package/src/lib/tools/navigation/index.tsx +0 -282
- package/src/lib/tools/navigation/types.ts +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/TextInput/index.tsx"],"names":[],"mapp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S,CAAC,QAAQ,mCAAO,qBAAS,CAAC,QAAQ,UAAE,OAAO,EAAE,aAAa,EAAE,WAAW,SAAC,CAAA;AACjF,iBAAS,CAAC,WAAW,GAAG,SAAS,CAAA;AAEjC,iBAAS,CAAC,gBAAgB,GAAG,UAAsB,MAAS;IAC1D,OAAO,iBAAiF,CAAA;AAC1F,CAAC,CAAA;AAED,iBAAS,CAAC,YAAY,GAAG;IACvB,UAAU,EAAE,wBAAmC;IAC/C,WAAW,EAAE,yBAAoC;IACjD,OAAO,EAAE,IAAI;CACI,CAAA;AAEnB,mCAAgB,CAAC,iBAAiB,CAAC,iBAAS,CAAC,CAAA"}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { FormTypes, yup } from '@codeleap/deprecated';
|
|
2
1
|
import { TouchableProps } from '../Touchable';
|
|
3
2
|
import { AppIcon, StyledProp } from '@codeleap/styles';
|
|
4
3
|
import { InputBaseProps } from '../InputBase';
|
|
5
4
|
import { HTMLProps } from '../../types';
|
|
6
5
|
import { TextInputComposition } from './styles';
|
|
6
|
+
import { Field } from '@codeleap/form';
|
|
7
|
+
import { AnyFunction } from '@codeleap/types';
|
|
7
8
|
type NativeTextInputProps = HTMLProps<'input'>;
|
|
8
|
-
export type TextInputProps = Omit<InputBaseProps, 'style'> & Omit<NativeTextInputProps, 'value' | 'crossOrigin' | 'ref' | 'style'> & {
|
|
9
|
+
export type TextInputProps = Omit<InputBaseProps, 'style' | 'ref'> & Omit<NativeTextInputProps, 'value' | 'crossOrigin' | 'ref' | 'style'> & {
|
|
9
10
|
style?: StyledProp<TextInputComposition>;
|
|
10
11
|
password?: boolean;
|
|
11
|
-
validate?: FormTypes.ValidatorWithoutForm<string> | yup.Schema<string>;
|
|
12
12
|
debugName?: string;
|
|
13
13
|
visibilityToggle?: boolean;
|
|
14
|
-
value?: NativeTextInputProps['value'];
|
|
15
14
|
multiline?: boolean;
|
|
16
15
|
onPress?: TouchableProps['onPress'];
|
|
17
|
-
onChangeText?: (textValue: string) => void;
|
|
18
16
|
caretColor?: string;
|
|
19
17
|
focused?: boolean;
|
|
20
|
-
|
|
18
|
+
forceError?: string;
|
|
21
19
|
rows?: number;
|
|
22
20
|
masking?: TextInputMaskingProps;
|
|
23
21
|
visibleIcon?: AppIcon;
|
|
24
22
|
hiddenIcon?: AppIcon;
|
|
23
|
+
field?: Field<string, any, any>;
|
|
24
|
+
value?: string;
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
25
26
|
};
|
|
26
27
|
export type InputRef = {
|
|
27
28
|
isTextInput?: boolean;
|
|
@@ -47,7 +48,7 @@ export type MaskProps = {
|
|
|
47
48
|
maskChar?: string;
|
|
48
49
|
formatChars?: Record<string, FormatChar>;
|
|
49
50
|
alwaysShowMask?: boolean;
|
|
50
|
-
validator?:
|
|
51
|
+
validator?: AnyFunction;
|
|
51
52
|
maskType?: 'BRL' | 'INTERNATIONAL';
|
|
52
53
|
getRawValue?: (value: any) => string;
|
|
53
54
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputProps } from './types';
|
|
3
|
+
export declare function useTextInput(props: Partial<TextInputProps>): {
|
|
4
|
+
maskProps: import("./types").MaskProps & {
|
|
5
|
+
notSaveFormatted: boolean;
|
|
6
|
+
};
|
|
7
|
+
isMultiline: boolean;
|
|
8
|
+
isMasked: boolean;
|
|
9
|
+
isFocused: boolean;
|
|
10
|
+
secureTextEntry: boolean;
|
|
11
|
+
handleBlur: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
|
|
12
|
+
handleFocus: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
|
|
13
|
+
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
fieldHandle: Partial<{
|
|
15
|
+
validation: {
|
|
16
|
+
onInputBlurred(): void;
|
|
17
|
+
hasBlurred: boolean;
|
|
18
|
+
hasChanged: boolean;
|
|
19
|
+
startedUnset: boolean;
|
|
20
|
+
isSet: boolean;
|
|
21
|
+
isInvalid: boolean;
|
|
22
|
+
isValid: boolean;
|
|
23
|
+
message: any;
|
|
24
|
+
showError: boolean;
|
|
25
|
+
isUnset: boolean;
|
|
26
|
+
validation: import("@codeleap/form").ValidationResult<any, unknown>;
|
|
27
|
+
value: unknown;
|
|
28
|
+
};
|
|
29
|
+
value: unknown;
|
|
30
|
+
setValue: (to: unknown) => void;
|
|
31
|
+
changed: boolean;
|
|
32
|
+
representation: any;
|
|
33
|
+
options: import("@codeleap/form").FieldOptions<unknown, any>;
|
|
34
|
+
}> | {
|
|
35
|
+
validation: {
|
|
36
|
+
onInputBlurred(): void;
|
|
37
|
+
hasBlurred: boolean;
|
|
38
|
+
hasChanged: boolean;
|
|
39
|
+
startedUnset: boolean;
|
|
40
|
+
isSet: boolean;
|
|
41
|
+
isInvalid: boolean;
|
|
42
|
+
isValid: boolean;
|
|
43
|
+
message: any;
|
|
44
|
+
showError: boolean;
|
|
45
|
+
isUnset: boolean;
|
|
46
|
+
validation: import("@codeleap/form").ValidationResult<any, unknown>;
|
|
47
|
+
value: string;
|
|
48
|
+
};
|
|
49
|
+
value: string;
|
|
50
|
+
setValue: (to: string) => void;
|
|
51
|
+
changed: boolean;
|
|
52
|
+
representation: any;
|
|
53
|
+
options: import("@codeleap/form").FieldOptions<string, any>;
|
|
54
|
+
};
|
|
55
|
+
validation: {
|
|
56
|
+
onInputBlurred(): void;
|
|
57
|
+
hasBlurred: boolean;
|
|
58
|
+
hasChanged: boolean;
|
|
59
|
+
startedUnset: boolean;
|
|
60
|
+
isSet: boolean;
|
|
61
|
+
isInvalid: boolean;
|
|
62
|
+
isValid: boolean;
|
|
63
|
+
message: any;
|
|
64
|
+
showError: boolean;
|
|
65
|
+
isUnset: boolean;
|
|
66
|
+
validation: import("@codeleap/form").ValidationResult<any, unknown>;
|
|
67
|
+
value: unknown;
|
|
68
|
+
} | {
|
|
69
|
+
onInputBlurred(): void;
|
|
70
|
+
hasBlurred: boolean;
|
|
71
|
+
hasChanged: boolean;
|
|
72
|
+
startedUnset: boolean;
|
|
73
|
+
isSet: boolean;
|
|
74
|
+
isInvalid: boolean;
|
|
75
|
+
isValid: boolean;
|
|
76
|
+
message: any;
|
|
77
|
+
showError: boolean;
|
|
78
|
+
isUnset: boolean;
|
|
79
|
+
validation: import("@codeleap/form").ValidationResult<any, unknown>;
|
|
80
|
+
value: string;
|
|
81
|
+
};
|
|
82
|
+
innerInputRef: React.MutableRefObject<HTMLInputElement>;
|
|
83
|
+
wrapperRef: React.MutableRefObject<HTMLDivElement>;
|
|
84
|
+
errorMessage: any;
|
|
85
|
+
toggleSecureTextEntry: () => void;
|
|
86
|
+
hasMultipleLines: boolean;
|
|
87
|
+
hasError: string | true;
|
|
88
|
+
inputValue: string;
|
|
89
|
+
onInputValueChange: (value: string) => void;
|
|
90
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTextInput = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var types_1 = require("@codeleap/types");
|
|
6
|
+
var mask_1 = require("./mask");
|
|
7
|
+
var useInputBase_1 = require("../InputBase/useInputBase");
|
|
8
|
+
var form_1 = require("@codeleap/form");
|
|
9
|
+
function useTextInput(props) {
|
|
10
|
+
var _a;
|
|
11
|
+
var onFocus = props.onFocus, onBlur = props.onBlur, field = props.field, masking = props.masking, isMultiline = props.multiline, forceError = props.forceError, value = props.value, onValueChange = props.onValueChange, providedRows = props.rows;
|
|
12
|
+
var _b = (0, react_1.useState)(false), isFocused = _b[0], setIsFocused = _b[1];
|
|
13
|
+
var _c = (0, react_1.useState)(true), secureTextEntry = _c[0], setSecureTextEntry = _c[1];
|
|
14
|
+
var toggleSecureTextEntry = function () { return setSecureTextEntry(function (s) { return !s; }); };
|
|
15
|
+
var isMasked = !types_1.TypeGuards.isNil(masking);
|
|
16
|
+
var maskProps = (0, react_1.useMemo)(function () {
|
|
17
|
+
return isMasked ? (0, mask_1.getMaskInputProps)({ masking: masking }) : null;
|
|
18
|
+
}, [masking]);
|
|
19
|
+
var _d = (0, useInputBase_1.useInputBase)(field, form_1.fields.text, { value: value, onValueChange: onValueChange }, {
|
|
20
|
+
revealValue: function () {
|
|
21
|
+
setSecureTextEntry(false);
|
|
22
|
+
},
|
|
23
|
+
hideValue: function () {
|
|
24
|
+
setSecureTextEntry(true);
|
|
25
|
+
},
|
|
26
|
+
toggleValueVisibility: function () {
|
|
27
|
+
toggleSecureTextEntry();
|
|
28
|
+
},
|
|
29
|
+
}, [setSecureTextEntry]), fieldHandle = _d.fieldHandle, validation = _d.validation, innerInputRef = _d.innerInputRef, wrapperRef = _d.wrapperRef, onInputValueChange = _d.onInputValueChange, inputValue = _d.inputValue;
|
|
30
|
+
var handleBlur = (0, react_1.useCallback)(function (e) {
|
|
31
|
+
var _a;
|
|
32
|
+
(_a = validation === null || validation === void 0 ? void 0 : validation.onInputBlurred) === null || _a === void 0 ? void 0 : _a.call(validation);
|
|
33
|
+
setIsFocused(false);
|
|
34
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
35
|
+
}, [validation === null || validation === void 0 ? void 0 : validation.onInputBlurred, onBlur]);
|
|
36
|
+
var handleFocus = (0, react_1.useCallback)(function (e) {
|
|
37
|
+
setIsFocused(true);
|
|
38
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
39
|
+
}, [onFocus]);
|
|
40
|
+
var handleChange = (0, react_1.useCallback)(function (event) {
|
|
41
|
+
var _a;
|
|
42
|
+
var inputValue = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value;
|
|
43
|
+
var value = isMasked && (maskProps === null || maskProps === void 0 ? void 0 : maskProps.notSaveFormatted)
|
|
44
|
+
? maskProps === null || maskProps === void 0 ? void 0 : maskProps.getRawValue(inputValue)
|
|
45
|
+
: inputValue;
|
|
46
|
+
onInputValueChange(value);
|
|
47
|
+
}, [onInputValueChange]);
|
|
48
|
+
var rows = providedRows !== null && providedRows !== void 0 ? providedRows : (isMultiline ? 2 : undefined);
|
|
49
|
+
var hasMultipleLines = isMultiline && (((_a = String(inputValue)) === null || _a === void 0 ? void 0 : _a.includes('\n')) || !!rows);
|
|
50
|
+
var hasError = (validation === null || validation === void 0 ? void 0 : validation.showError) || forceError;
|
|
51
|
+
var errorMessage = (validation === null || validation === void 0 ? void 0 : validation.message) || forceError;
|
|
52
|
+
return {
|
|
53
|
+
maskProps: maskProps,
|
|
54
|
+
isMultiline: isMultiline,
|
|
55
|
+
isMasked: isMasked,
|
|
56
|
+
isFocused: isFocused,
|
|
57
|
+
secureTextEntry: secureTextEntry,
|
|
58
|
+
handleBlur: handleBlur,
|
|
59
|
+
handleFocus: handleFocus,
|
|
60
|
+
handleChange: handleChange,
|
|
61
|
+
fieldHandle: fieldHandle,
|
|
62
|
+
validation: validation,
|
|
63
|
+
innerInputRef: innerInputRef,
|
|
64
|
+
wrapperRef: wrapperRef,
|
|
65
|
+
errorMessage: errorMessage,
|
|
66
|
+
toggleSecureTextEntry: toggleSecureTextEntry,
|
|
67
|
+
hasMultipleLines: hasMultipleLines,
|
|
68
|
+
hasError: hasError,
|
|
69
|
+
inputValue: inputValue || '',
|
|
70
|
+
onInputValueChange: onInputValueChange,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
exports.useTextInput = useTextInput;
|
|
74
|
+
//# sourceMappingURL=useTextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextInput.js","sourceRoot":"","sources":["../../../src/components/TextInput/useTextInput.ts"],"names":[],"mappings":";;;AAAA,+BAA6D;AAE7D,yCAA4C;AAC5C,+BAA0C;AAC1C,0DAAwD;AACxD,uCAAuC;AAEvC,SAAgB,YAAY,CAAC,KAA8B;;IAEvD,IAAA,OAAO,GASL,KAAK,QATA,EACP,MAAM,GAQJ,KAAK,OARD,EACN,KAAK,GAOH,KAA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KAAI,CAAC,CAAC,IAAI,CAAC,CAAA;IAEtF,IAAM,QAAQ,GAAG,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,KAAI,UAAU,CAAA;IAEpD,IAAM,YAAY,GAAG,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,KAAI,UAAU,CAAA;IAEtD,OAAO;QACL,SAAS,WAAA;QACT,WAAW,aAAA;QACX,QAAQ,UAAA;QACR,SAAS,WAAA;QACT,eAAe,iBAAA;QACf,UAAU,YAAA;QACV,WAAW,aAAA;QACX,YAAY,cAAA;QACZ,WAAW,aAAA;QACX,UAAU,YAAA;QACV,aAAa,eAAA;QACb,UAAU,YAAA;QACV,YAAY,cAAA;QACZ,qBAAqB,uBAAA;QACrB,gBAAgB,kBAAA;QAChB,QAAQ,UAAA;QACR,UAAU,EAAE,UAAU,IAAI,EAAE;QAC5B,kBAAkB,oBAAA;KACnB,CAAA;AACH,CAAC;AA7FD,oCA6FC"}
|
package/dist/lib/tools/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./navigation"), exports);
|
|
18
17
|
__exportStar(require("./localStorage"), exports);
|
|
19
18
|
__exportStar(require("./mediaQuery"), exports);
|
|
20
19
|
__exportStar(require("./modal"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,+CAA4B;AAC5B,0CAAuB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const modalsState: import("@codeleap/store").GlobalState<{
|
|
2
|
-
currentModal:
|
|
3
|
-
indexes:
|
|
2
|
+
currentModal: string | null;
|
|
3
|
+
indexes: Record<string, number>;
|
|
4
4
|
}>;
|
|
5
5
|
export declare function modalInferIndexes(visible: boolean, id: string): void;
|
|
6
6
|
export declare function modalScrollLock(to: boolean, modalIdentifier: string): void;
|
package/dist/lib/tools/modal.js
CHANGED
|
@@ -17,7 +17,8 @@ var store_1 = require("@codeleap/store");
|
|
|
17
17
|
var overlapIndex = 99;
|
|
18
18
|
exports.modalsState = (0, store_1.globalState)({ currentModal: null, indexes: {} });
|
|
19
19
|
function modalInferIndexes(visible, id) {
|
|
20
|
-
var
|
|
20
|
+
var _a;
|
|
21
|
+
var indexes = __assign({}, (_a = exports.modalsState.value) === null || _a === void 0 ? void 0 : _a.indexes);
|
|
21
22
|
if (!visible) {
|
|
22
23
|
indexes[id] = overlapIndex;
|
|
23
24
|
}
|
|
@@ -34,8 +35,8 @@ function modalInferIndexes(visible, id) {
|
|
|
34
35
|
}
|
|
35
36
|
exports.modalInferIndexes = modalInferIndexes;
|
|
36
37
|
function modalScrollLock(to, modalIdentifier) {
|
|
37
|
-
var _a;
|
|
38
|
-
var modalId = exports.modalsState.value.currentModal;
|
|
38
|
+
var _a, _b;
|
|
39
|
+
var modalId = (_a = exports.modalsState.value) === null || _a === void 0 ? void 0 : _a.currentModal;
|
|
39
40
|
var alreadyDifferentOpenedModal = !types_1.TypeGuards.isNil(modalId) && modalIdentifier !== modalId;
|
|
40
41
|
if (alreadyDifferentOpenedModal)
|
|
41
42
|
return;
|
|
@@ -46,7 +47,7 @@ function modalScrollLock(to, modalIdentifier) {
|
|
|
46
47
|
else if (!types_1.TypeGuards.isNil(modalId) && to === false) {
|
|
47
48
|
exports.modalsState.set({ currentModal: null });
|
|
48
49
|
}
|
|
49
|
-
var htmlStyle = (
|
|
50
|
+
var htmlStyle = (_b = document === null || document === void 0 ? void 0 : document.documentElement) === null || _b === void 0 ? void 0 : _b.style;
|
|
50
51
|
if (htmlStyle.overflowX !== 'hidden') {
|
|
51
52
|
htmlStyle.overflowX = 'hidden';
|
|
52
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/lib/tools/modal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,yCAA6C;AAE7C,IAAM,YAAY,GAAG,EAAE,CAAA;AAEV,QAAA,WAAW,GAAG,IAAA,mBAAW,
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/lib/tools/modal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,yCAA6C;AAE7C,IAAM,YAAY,GAAG,EAAE,CAAA;AAEV,QAAA,WAAW,GAAG,IAAA,mBAAW,EAAmE,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;AAE7I,SAAgB,iBAAiB,CAAC,OAAgB,EAAE,EAAU;;IAC5D,IAAM,OAAO,gBAAQ,MAAA,mBAAW,CAAC,KAAK,0CAAE,OAAO,CAAE,CAAA;IAEjD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,EAAE,CAAC,GAAG,YAAY,CAAA;KAC3B;SAAM;QACL,IAAI,YAAY,GAAG,CAAC,CAAA;QAEpB,KAAK,IAAM,GAAG,IAAI,OAAO,EAAE;YACzB,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,EAAE;gBAC/B,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;aAC5B;SACF;QAED,OAAO,CAAC,EAAE,CAAC,GAAG,YAAY,GAAG,YAAY,CAAA;KAC1C;IAED,mBAAW,CAAC,GAAG,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;AAC9B,CAAC;AAlBD,8CAkBC;AAED,SAAgB,eAAe,CAAC,EAAW,EAAE,eAAuB;;IAClE,IAAI,OAAO,GAAG,MAAA,mBAAW,CAAC,KAAK,0CAAE,YAAY,CAAA;IAE7C,IAAM,2BAA2B,GAAG,CAAC,kBAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,eAAe,KAAK,OAAO,CAAA;IAE7F,IAAI,2BAA2B;QAAE,OAAM;IAEvC,IAAI,kBAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;QAC5C,mBAAW,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CAAA;QAClD,OAAO,GAAG,eAAe,CAAA;KAC1B;SAAM,IAAI,CAAC,kBAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,KAAK,EAAE;QACrD,mBAAW,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;KACxC;IAED,IAAM,SAAS,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,eAAe,0CAAE,KAAK,CAAA;IAElD,IAAI,SAAS,CAAC,SAAS,KAAK,QAAQ,EAAE;QACpC,SAAS,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC/B;IAED,IAAI,EAAE,EAAE;QACN,SAAS,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC/B;SAAM,IAAI,eAAe,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,EAAE;QACtD,SAAS,CAAC,SAAS,GAAG,MAAM,CAAA;KAC7B;AACH,CAAC;AAzBD,0CAyBC"}
|
package/dist/types/utility.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type ComponentWithDefaultProps<P> = ((props: P) => JSX.Element) & {
|
|
|
31
31
|
defaultProps?: Partial<P>;
|
|
32
32
|
};
|
|
33
33
|
export type ComponentCommonProps = {
|
|
34
|
-
debugName
|
|
34
|
+
debugName?: string;
|
|
35
35
|
};
|
|
36
36
|
export type SelectProperties<T extends Record<string | number | symbol, any>, K extends keyof T> = {
|
|
37
37
|
[P in K]: T[K];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/web",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/config": "5.4.
|
|
13
|
-
"@codeleap/
|
|
14
|
-
"@codeleap/
|
|
15
|
-
"@codeleap/
|
|
16
|
-
"@codeleap/
|
|
17
|
-
"@codeleap/
|
|
18
|
-
"@codeleap/
|
|
19
|
-
"@codeleap/
|
|
20
|
-
"@codeleap/store": "5.4.4",
|
|
12
|
+
"@codeleap/config": "5.4.5",
|
|
13
|
+
"@codeleap/hooks": "5.4.5",
|
|
14
|
+
"@codeleap/i18n": "5.4.5",
|
|
15
|
+
"@codeleap/logger": "5.4.5",
|
|
16
|
+
"@codeleap/query": "5.4.5",
|
|
17
|
+
"@codeleap/types": "5.4.5",
|
|
18
|
+
"@codeleap/utils": "5.4.5",
|
|
19
|
+
"@codeleap/store": "5.4.5",
|
|
21
20
|
"@types/react-slick": "^0.23.13"
|
|
22
21
|
},
|
|
23
22
|
"scripts": {
|
|
@@ -46,15 +45,14 @@
|
|
|
46
45
|
"uuid": "^8.3.2"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
|
-
"@codeleap/types": "5.4.
|
|
50
|
-
"@codeleap/utils": "5.4.
|
|
51
|
-
"@codeleap/hooks": "5.4.
|
|
52
|
-
"@codeleap/
|
|
53
|
-
"@codeleap/
|
|
54
|
-
"@codeleap/
|
|
55
|
-
"@codeleap/
|
|
56
|
-
"@codeleap/
|
|
57
|
-
"@codeleap/store": "5.4.4",
|
|
48
|
+
"@codeleap/types": "5.4.5",
|
|
49
|
+
"@codeleap/utils": "5.4.5",
|
|
50
|
+
"@codeleap/hooks": "5.4.5",
|
|
51
|
+
"@codeleap/i18n": "5.4.5",
|
|
52
|
+
"@codeleap/query": "5.4.5",
|
|
53
|
+
"@codeleap/logger": "5.4.5",
|
|
54
|
+
"@codeleap/styles": "5.4.5",
|
|
55
|
+
"@codeleap/store": "5.4.5",
|
|
58
56
|
"@emotion/react": "11.10.6",
|
|
59
57
|
"@reach/router": "^1.3.4",
|
|
60
58
|
"axios": "^1.7.9",
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/web",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@codeleap/config": "workspace:*",
|
|
13
|
-
"@codeleap/deprecated": "workspace:*",
|
|
14
13
|
"@codeleap/hooks": "workspace:*",
|
|
15
14
|
"@codeleap/i18n": "workspace:*",
|
|
16
15
|
"@codeleap/logger": "workspace:*",
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
"@codeleap/types": "workspace:*",
|
|
50
49
|
"@codeleap/utils": "workspace:*",
|
|
51
50
|
"@codeleap/hooks": "workspace:*",
|
|
52
|
-
"@codeleap/deprecated": "workspace:*",
|
|
53
51
|
"@codeleap/i18n": "workspace:*",
|
|
54
52
|
"@codeleap/query": "workspace:*",
|
|
55
53
|
"@codeleap/logger": "workspace:*",
|
|
@@ -5,7 +5,7 @@ import { IconProps } from '../Icon'
|
|
|
5
5
|
import { AppIcon, StyledProp } from '@codeleap/styles'
|
|
6
6
|
|
|
7
7
|
export type ActionIconProps =
|
|
8
|
-
Omit<TouchableProps, 'style'> &
|
|
8
|
+
Omit<TouchableProps, 'style' | 'debugName'> &
|
|
9
9
|
ComponentCommonProps &
|
|
10
10
|
{
|
|
11
11
|
iconProps?: Partial<IconProps>
|
|
@@ -8,6 +8,8 @@ import { AnyRecord, AppIcon, IJSX, mergeStyles, StyledComponentProps } from '@co
|
|
|
8
8
|
import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
|
|
9
9
|
import { CheckboxParts } from './styles'
|
|
10
10
|
import { TypeGuards } from '@codeleap/types'
|
|
11
|
+
import { useInputBase } from '../InputBase/useInputBase'
|
|
12
|
+
import { fields } from '@codeleap/form'
|
|
11
13
|
|
|
12
14
|
export * from './styles'
|
|
13
15
|
export * from './types'
|
|
@@ -25,9 +27,10 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
25
27
|
|
|
26
28
|
const {
|
|
27
29
|
style,
|
|
28
|
-
value,
|
|
29
30
|
disabled,
|
|
30
31
|
debugName,
|
|
32
|
+
field,
|
|
33
|
+
value,
|
|
31
34
|
onValueChange,
|
|
32
35
|
checkboxOnLeft,
|
|
33
36
|
checkIcon,
|
|
@@ -35,6 +38,13 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
35
38
|
|
|
36
39
|
const styles = useStylesFor(Checkbox.styleRegistryName, style)
|
|
37
40
|
|
|
41
|
+
const {
|
|
42
|
+
validation,
|
|
43
|
+
wrapperRef,
|
|
44
|
+
inputValue,
|
|
45
|
+
onInputValueChange,
|
|
46
|
+
} = useInputBase(field, fields.boolean, { value, onValueChange })
|
|
47
|
+
|
|
38
48
|
const boxAnimation = useAnimatedVariantStyles({
|
|
39
49
|
variantStyles: styles,
|
|
40
50
|
animatedProperties: ['box:unchecked', 'box:disabled', 'box:checked', 'box:disabled-checked', 'box:disabled-unchecked'],
|
|
@@ -42,16 +52,16 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
42
52
|
'worklet'
|
|
43
53
|
let disabledStyle = {}
|
|
44
54
|
if (disabled) {
|
|
45
|
-
disabledStyle =
|
|
55
|
+
disabledStyle = inputValue ? styles['box:disabled-checked'] : styles['box:disabled-unchecked']
|
|
46
56
|
}
|
|
47
|
-
const style =
|
|
57
|
+
const style = inputValue ? styles['box:checked'] : styles['box:unchecked']
|
|
48
58
|
|
|
49
59
|
return {
|
|
50
60
|
...style,
|
|
51
61
|
...disabledStyle,
|
|
52
62
|
}
|
|
53
63
|
},
|
|
54
|
-
dependencies: [
|
|
64
|
+
dependencies: [inputValue, disabled],
|
|
55
65
|
})
|
|
56
66
|
|
|
57
67
|
const checkmarkWrapperAnimation = useAnimatedVariantStyles({
|
|
@@ -67,15 +77,15 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
67
77
|
'worklet'
|
|
68
78
|
let disabledStyle = {}
|
|
69
79
|
if (disabled) {
|
|
70
|
-
disabledStyle =
|
|
80
|
+
disabledStyle = inputValue ? styles['checkmarkWrapper:disabled-checked'] : styles['checkmarkWrapper:disabled-unchecked']
|
|
71
81
|
}
|
|
72
|
-
const style =
|
|
82
|
+
const style = inputValue ? styles['checkmarkWrapper:checked'] : styles['checkmarkWrapper:unchecked']
|
|
73
83
|
return {
|
|
74
84
|
...style,
|
|
75
85
|
...disabledStyle,
|
|
76
86
|
}
|
|
77
87
|
},
|
|
78
|
-
dependencies: [
|
|
88
|
+
dependencies: [inputValue, disabled],
|
|
79
89
|
})
|
|
80
90
|
|
|
81
91
|
// @ts-expect-error __props is ICSS
|
|
@@ -83,14 +93,14 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
83
93
|
|
|
84
94
|
const handleChange = (e) => {
|
|
85
95
|
if (disabled) return
|
|
86
|
-
if (!TypeGuards.isFunction(
|
|
96
|
+
if (!TypeGuards.isFunction(onInputValueChange)) return
|
|
87
97
|
|
|
88
98
|
const isSpaceBarClick = e?.keyCode === 32
|
|
89
99
|
const isEnterKey = e?.key === 'Enter'
|
|
90
100
|
const isClick = e?.type === 'click'
|
|
91
101
|
|
|
92
102
|
if (isClick || e?.keyCode === 13 || isSpaceBarClick || isEnterKey) {
|
|
93
|
-
|
|
103
|
+
onInputValueChange?.(!inputValue)
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
|
|
@@ -105,9 +115,13 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
105
115
|
checkmark: getStyles('checkmark'),
|
|
106
116
|
}
|
|
107
117
|
|
|
118
|
+
const hasError = validation?.showError
|
|
119
|
+
|
|
108
120
|
return (
|
|
109
121
|
<InputBase
|
|
110
122
|
{...inputBaseProps}
|
|
123
|
+
ref={wrapperRef}
|
|
124
|
+
error={hasError ? validation?.message : null}
|
|
111
125
|
debugName={debugName}
|
|
112
126
|
style={styles}
|
|
113
127
|
order={_checkboxOnLeft ? reversedOrder : InputBaseDefaultOrder}
|
|
@@ -2,14 +2,16 @@ import { CheckboxComposition } from './styles'
|
|
|
2
2
|
import { InputBaseProps } from '../InputBase'
|
|
3
3
|
import { ComponentCommonProps } from '../../types'
|
|
4
4
|
import { AppIcon, StyledProp } from '@codeleap/styles'
|
|
5
|
+
import { BooleanField } from '@codeleap/form'
|
|
5
6
|
|
|
6
7
|
export type CheckboxProps =
|
|
7
8
|
Pick<InputBaseProps, 'disabled' | 'label'> &
|
|
8
9
|
ComponentCommonProps &
|
|
9
10
|
{
|
|
10
11
|
style?: StyledProp<CheckboxComposition>
|
|
11
|
-
value: boolean
|
|
12
|
-
onValueChange: (value: boolean) => void
|
|
13
12
|
checkboxOnLeft?: boolean
|
|
14
13
|
checkIcon?: AppIcon
|
|
14
|
+
field?: BooleanField<any>
|
|
15
|
+
value?: boolean
|
|
16
|
+
onValueChange?: (value: boolean) => void
|
|
15
17
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { DayComponentProps, DatePickerProps } from '../types'
|
|
3
|
+
import { TypeGuards } from '@codeleap/types'
|
|
4
|
+
import { DatePickerComposition } from '../styles'
|
|
5
|
+
import { View } from '../../View'
|
|
6
|
+
import { Text } from '../../Text'
|
|
7
|
+
import { useInputBasePartialStyles } from '../../InputBase/useInputBasePartialStyles';
|
|
8
|
+
import { StyleRecord } from '@codeleap/styles'
|
|
9
|
+
|
|
10
|
+
type Props = DayComponentProps & {
|
|
11
|
+
minDate: DatePickerProps['minDate']
|
|
12
|
+
maxDate: DatePickerProps['maxDate']
|
|
13
|
+
styles: StyleRecord<DatePickerComposition>
|
|
14
|
+
component: DatePickerProps['dayComponent']
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const DayContent = (props: Props) => {
|
|
18
|
+
const { value, date: providedDate, minDate, maxDate, styles, component: Component, day } = props
|
|
19
|
+
|
|
20
|
+
const date = dayjs(providedDate).format('DD MMM YYYY');
|
|
21
|
+
const dateValue = value ? dayjs(value).format('DD MMM YYYY') : ''
|
|
22
|
+
|
|
23
|
+
const isSelected = date === dateValue
|
|
24
|
+
|
|
25
|
+
const isDisabled = [
|
|
26
|
+
dayjs(providedDate).isBefore(dayjs(minDate)),
|
|
27
|
+
dayjs(providedDate).isAfter(dayjs(maxDate))
|
|
28
|
+
].some(Boolean)
|
|
29
|
+
|
|
30
|
+
const partialStyles = useInputBasePartialStyles(styles, ['dayWrapper', 'day'], {
|
|
31
|
+
selected: isSelected,
|
|
32
|
+
disabled: !isSelected && isDisabled,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
if (TypeGuards.isFunction(Component)) {
|
|
36
|
+
return (
|
|
37
|
+
<Component
|
|
38
|
+
{...props}
|
|
39
|
+
value={value}
|
|
40
|
+
disabled={isDisabled}
|
|
41
|
+
selected={isSelected}
|
|
42
|
+
styles={styles}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={partialStyles?.dayWrapper}>
|
|
49
|
+
<Text style={partialStyles?.day} text={String(day)} />
|
|
50
|
+
</View>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { TextInput } from '../../components'
|
|
2
2
|
import { DatePickerProps } from '../types'
|
|
3
3
|
|
|
4
|
-
export const OuterInput: DatePickerProps['outerInputComponent'] = ({
|
|
4
|
+
export const OuterInput: DatePickerProps['outerInputComponent'] = ({ hideInput, ...props }) => {
|
|
5
5
|
if (hideInput) {
|
|
6
6
|
return null
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<TextInput
|
|
11
|
-
validate={!focused && props?.validate}
|
|
12
11
|
debugName='DatePicker - OuterInputComponent'
|
|
13
12
|
masking={{
|
|
14
13
|
type: 'custom',
|