@via-profit/ui-kit 0.1.8 → 0.2.1-alpha.3
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/Accordion/index.d.ts +4 -4
- package/Autocomplete/AutocompleteContainer.d.ts +34 -7
- package/Autocomplete/AutocompleteContainer.js +28 -24
- package/Autocomplete/AutocompleteItem.d.ts +1 -1
- package/Autocomplete/AutocompleteTextField.d.ts +3 -0
- package/Autocomplete/AutocompleteTextField.js +63 -1
- package/Autocomplete/OverrideMenuList.d.ts +4 -0
- package/Autocomplete/OverrideMenuList.js +39 -0
- package/Autocomplete/context.d.ts +9 -1
- package/Autocomplete/context.js +15 -1
- package/Autocomplete/index.js +9 -10
- package/Autocomplete2/Autocomplete2.d.ts +12 -0
- package/Autocomplete2/Autocomplete2.js +83 -0
- package/Autocomplete2/Autocomplete2TextField.d.ts +7 -0
- package/Autocomplete2/Autocomplete2TextField.js +39 -0
- package/Autocomplete2/index.d.ts +2 -0
- package/Autocomplete2/index.js +7 -0
- package/Avatar/AvatarBase.d.ts +4 -4
- package/Avatar/index.js +1 -1
- package/Badge/BadgeBase.d.ts +4 -4
- package/Badge/BadgeDeleteButton.js +6 -6
- package/Badge/BadgeOutlined.js +2 -2
- package/Badge/BadgeStandard.js +1 -1
- package/Button/ButtonBase.d.ts +3 -3
- package/Button/ButtonOutlined.js +1 -1
- package/Button/ButtonPlain.js +1 -1
- package/Button/ButtonStandard.js +4 -11
- package/Calendar/CalendarCell.js +22 -4
- package/Calendar/CalendarComponent.d.ts +226 -0
- package/Calendar/CalendarComponent.js +572 -0
- package/Calendar/CalendarControlButton.js +16 -9
- package/Calendar/CalendarDayBadge.js +1 -1
- package/Calendar/CalendarEmptyCell.d.ts +2 -2
- package/Calendar/CalendarEmptyCell.js +8 -3
- package/Calendar/CalendarHeading.js +2 -1
- package/Calendar/CalendarMonthCell.js +0 -5
- package/Calendar/CalendarSubheading.js +3 -2
- package/Calendar/CalendarWeekDayCell.d.ts +10 -0
- package/Calendar/CalendarWeekDayCell.js +32 -0
- package/Calendar/CalendarWeekDayWeekNumber.d.ts +7 -0
- package/Calendar/CalendarWeekDayWeekNumber.js +38 -0
- package/Calendar/CalendarWeekRow.d.ts +2 -2
- package/Calendar/CalendarWeekRow.js +2 -1
- package/Calendar/CalendarWeekRowButton.d.ts +13 -0
- package/Calendar/CalendarWeekRowButton.js +31 -0
- package/Calendar/CalendarYearCell.js +5 -5
- package/Calendar/CalendarYearsSelector.d.ts +39 -1
- package/Calendar/CalendarYearsSelector.js +52 -16
- package/Calendar/IconChevronDown.d.ts +3 -0
- package/Calendar/IconChevronDown.js +31 -0
- package/Calendar/index.d.ts +7 -220
- package/Calendar/index.js +19 -274
- package/Calendar/use-calendar.d.ts +1 -1
- package/Calendar/use-calendar.js +102 -155
- package/Color/Color.d.ts +138 -0
- package/Color/Color.js +324 -0
- package/Color/ColorGenerator.d.ts +29 -0
- package/Color/ColorGenerator.js +141 -0
- package/Color/ColorParser.d.ts +20 -0
- package/Color/ColorParser.js +284 -0
- package/Color/index.d.ts +4 -122
- package/Color/index.js +18 -473
- package/DatePicker/index.d.ts +2 -17
- package/DatePicker/index.js +47 -61
- package/DatePicker/useDatePickerFormat.js +5 -5
- package/ErrorBoundary/Fallback.d.ts +3 -0
- package/ErrorBoundary/Fallback.js +51 -0
- package/ErrorBoundary/RenderError.d.ts +6 -0
- package/ErrorBoundary/RenderError.js +80 -0
- package/ErrorBoundary/index.d.ts +7 -11
- package/ErrorBoundary/index.js +4 -51
- package/Highlighted/index.d.ts +3 -3
- package/LoadingIndicator/Spinner.d.ts +5 -3
- package/LoadingIndicator/Spinner.js +61 -32
- package/LoadingIndicator/index.d.ts +3 -3
- package/LoadingIndicator/index.js +15 -2
- package/MaskedField/index.d.ts +1 -1
- package/MaskedField/index.js +11 -10
- package/Menu/AutoHeightWrapper.d.ts +6 -0
- package/Menu/AutoHeightWrapper.js +43 -0
- package/Menu/MeasuredItem.d.ts +10 -0
- package/Menu/MeasuredItem.js +51 -0
- package/Menu/MenuContainer.d.ts +53 -20
- package/Menu/MenuContainer.js +18 -11
- package/Menu/MenuItem.d.ts +24 -7
- package/Menu/MenuItem.js +13 -6
- package/Menu/MenuList.d.ts +4 -2
- package/Menu/MenuList.js +26 -6
- package/Menu/VirtualizedItem.d.ts +22 -0
- package/Menu/VirtualizedItem.js +69 -0
- package/Menu/VirtualizedList.d.ts +18 -0
- package/Menu/VirtualizedList.js +28 -0
- package/Menu/VirtualizedListComponent.d.ts +20 -0
- package/Menu/VirtualizedListComponent.js +305 -0
- package/Menu/index.d.ts +3 -1
- package/Menu/index.js +4 -7
- package/Modal/BaseModal/RenderModal.d.ts +3 -3
- package/Modal/BaseModal/index.d.ts +3 -3
- package/Modal/ConfirmBox/index.d.ts +5 -5
- package/Modal/Drawer/index.d.ts +5 -5
- package/Modal/MessageBox/index.d.ts +5 -5
- package/Popper/Popper.d.ts +148 -0
- package/Popper/Popper.js +113 -0
- package/Popper/PopperContainer.d.ts +2 -0
- package/Popper/PopperContainer.js +3 -6
- package/Popper/index.d.ts +5 -22
- package/Popper/index.js +18 -264
- package/Popper/usePopprer.d.ts +110 -0
- package/Popper/usePopprer.js +505 -0
- package/Selectbox/SelectboxButton.d.ts +5 -0
- package/Selectbox/SelectboxButton.js +48 -8
- package/Selectbox/SelectboxButtonWrapper.d.ts +2 -0
- package/Selectbox/SelectboxButtonWrapper.js +1 -17
- package/Selectbox/SelectboxMenu.d.ts +12 -0
- package/Selectbox/SelectboxMenu.js +50 -0
- package/Selectbox/index.d.ts +13 -13
- package/Selectbox/index.js +115 -97
- package/Surface/index.d.ts +5 -5
- package/Surface/index.js +1 -1
- package/Swiper/Swiper.d.ts +44 -0
- package/Swiper/Swiper.js +139 -0
- package/Swiper/SwiperContainer.d.ts +7 -0
- package/Swiper/SwiperContainer.js +14 -0
- package/Swiper/SwiperSlide.d.ts +7 -0
- package/Swiper/SwiperSlide.js +55 -0
- package/Swiper/SwiperTrack.d.ts +14 -0
- package/Swiper/SwiperTrack.js +58 -0
- package/Swiper/SwiperWrapper.d.ts +14 -0
- package/Swiper/SwiperWrapper.js +60 -0
- package/Swiper/index.d.ts +7 -0
- package/Swiper/index.js +26 -0
- package/Switch/SwitchDot.js +1 -1
- package/Switch/SwitchTrack.js +1 -1
- package/Switch/index.d.ts +8 -8
- package/TextArea/index.d.ts +7 -7
- package/TextField/TextFieldContainer.d.ts +2 -2
- package/TextField/TextFieldContainer.js +5 -3
- package/TextField/TextFieldErrorText.d.ts +2 -2
- package/TextField/TextFieldErrorText.js +5 -4
- package/TextField/TextFieldIconWrapper.d.ts +3 -3
- package/TextField/TextFieldIconWrapper.js +5 -3
- package/TextField/TextFieldInput.d.ts +2 -2
- package/TextField/TextFieldInput.js +6 -4
- package/TextField/TextFieldInputWrapper.d.ts +2 -2
- package/TextField/TextFieldInputWrapper.js +5 -3
- package/TextField/TextFieldLabel.d.ts +2 -2
- package/TextField/TextFieldLabel.js +5 -3
- package/TextField/TextFieldLabelAsterisk.d.ts +2 -2
- package/TextField/TextFieldLabelAsterisk.js +5 -3
- package/TextField/index.d.ts +15 -8
- package/TextField/index.js +49 -22
- package/ThemeProvider/createTheme.js +2 -2
- package/package.json +1 -1
- package/Calendar/reducer.d.ts +0 -14
- package/Calendar/reducer.js +0 -26
- /package/Calendar/{IconChevronRight.d.ts → CalendarIconNext.d.ts} +0 -0
- /package/Calendar/{IconChevronRight.js → CalendarIconNext.js} +0 -0
package/TextField/index.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ import { TextFieldInputWrapperProps } from './TextFieldInputWrapper';
|
|
|
6
6
|
import { TextFieldInputProps } from './TextFieldInput';
|
|
7
7
|
import { TextFieldErrorTextProps } from './TextFieldErrorText';
|
|
8
8
|
import { TextFieldIconWrapperProps } from './TextFieldIconWrapper';
|
|
9
|
+
export * from './TextFieldContainer';
|
|
10
|
+
export * from './TextFieldLabel';
|
|
11
|
+
export * from './TextFieldLabelAsterisk';
|
|
12
|
+
export * from './TextFieldInputWrapper';
|
|
13
|
+
export * from './TextFieldInput';
|
|
14
|
+
export * from './TextFieldErrorText';
|
|
15
|
+
export * from './TextFieldIconWrapper';
|
|
9
16
|
export interface TextFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
10
17
|
/**
|
|
11
18
|
* If true then `errorText` value will be displayed under the TextField element
|
|
@@ -50,31 +57,31 @@ export interface TextFieldOverrides {
|
|
|
50
57
|
/**
|
|
51
58
|
* Native `input` component
|
|
52
59
|
*/
|
|
53
|
-
readonly Input?: React.
|
|
60
|
+
readonly Input?: React.ComponentType<TextFieldInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
54
61
|
/**
|
|
55
62
|
* Component for display error text
|
|
56
63
|
*/
|
|
57
|
-
readonly ErrorText?: React.
|
|
64
|
+
readonly ErrorText?: React.ComponentType<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
|
|
58
65
|
/**
|
|
59
66
|
* Icons wrapper component
|
|
60
67
|
*/
|
|
61
|
-
readonly IconWrapper?: React.
|
|
68
|
+
readonly IconWrapper?: React.ComponentType<TextFieldIconWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
62
69
|
/**
|
|
63
70
|
* input field wrapper component
|
|
64
71
|
*/
|
|
65
|
-
readonly InputWrapper?: React.
|
|
72
|
+
readonly InputWrapper?: React.ComponentType<TextFieldInputWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
66
73
|
/**
|
|
67
74
|
* label component
|
|
68
75
|
*/
|
|
69
|
-
readonly Label?: React.
|
|
76
|
+
readonly Label?: React.ComponentType<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
70
77
|
/**
|
|
71
78
|
* label asterisk component
|
|
72
79
|
*/
|
|
73
|
-
readonly Asterisk?: React.
|
|
80
|
+
readonly Asterisk?: React.ComponentType<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
|
|
74
81
|
/**
|
|
75
82
|
* label component
|
|
76
83
|
*/
|
|
77
|
-
readonly Container?: React.
|
|
84
|
+
readonly Container?: React.ComponentType<TextFieldContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
78
85
|
}
|
|
79
|
-
declare const _default: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLDivElement
|
|
86
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLDivElement>>>;
|
|
80
87
|
export default _default;
|
package/TextField/index.js
CHANGED
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
25
28
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
29
|
var t = {};
|
|
27
30
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -45,7 +48,23 @@ const TextFieldInputWrapper_1 = __importDefault(require("./TextFieldInputWrapper
|
|
|
45
48
|
const TextFieldInput_1 = __importDefault(require("./TextFieldInput"));
|
|
46
49
|
const TextFieldErrorText_1 = __importDefault(require("./TextFieldErrorText"));
|
|
47
50
|
const TextFieldIconWrapper_1 = __importDefault(require("./TextFieldIconWrapper"));
|
|
48
|
-
|
|
51
|
+
__exportStar(require("./TextFieldContainer"), exports);
|
|
52
|
+
__exportStar(require("./TextFieldLabel"), exports);
|
|
53
|
+
__exportStar(require("./TextFieldLabelAsterisk"), exports);
|
|
54
|
+
__exportStar(require("./TextFieldInputWrapper"), exports);
|
|
55
|
+
__exportStar(require("./TextFieldInput"), exports);
|
|
56
|
+
__exportStar(require("./TextFieldErrorText"), exports);
|
|
57
|
+
__exportStar(require("./TextFieldIconWrapper"), exports);
|
|
58
|
+
const defailtOverrides = {
|
|
59
|
+
Label: TextFieldLabel_1.default,
|
|
60
|
+
Input: TextFieldInput_1.default,
|
|
61
|
+
Asterisk: TextFieldLabelAsterisk_1.default,
|
|
62
|
+
Container: TextFieldContainer_1.default,
|
|
63
|
+
ErrorText: TextFieldErrorText_1.default,
|
|
64
|
+
IconWrapper: TextFieldIconWrapper_1.default,
|
|
65
|
+
InputWrapper: TextFieldInputWrapper_1.default,
|
|
66
|
+
};
|
|
67
|
+
const TextField = React.forwardRef((props, ref) => {
|
|
49
68
|
const { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = props, nativeInputProps = __rest(props, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
|
|
50
69
|
const [focused, setFocused] = React.useState(false);
|
|
51
70
|
const inputID = React.useMemo(() => {
|
|
@@ -53,19 +72,21 @@ const TextField = (props, ref) => {
|
|
|
53
72
|
return id;
|
|
54
73
|
}
|
|
55
74
|
const u = Date.now().toString(16) + Math.random().toString(16) + '0'.repeat(16);
|
|
56
|
-
|
|
75
|
+
return [
|
|
57
76
|
u.substring(0, 8),
|
|
58
77
|
u.substring(8, 12),
|
|
59
78
|
'4000-8' + u.substring(13, 16),
|
|
60
79
|
u.substring(16, 28),
|
|
61
80
|
].join('-');
|
|
62
|
-
return guid;
|
|
63
81
|
}, [id]);
|
|
82
|
+
const stableOnChange = React.useCallback(onChange ? onChange : () => undefined, [onChange]); // уже есть
|
|
83
|
+
// const stableOnFocus = React.useCallback(onFocus, [onFocus]); // уже есть
|
|
84
|
+
// const stableOnBlur = React.useCallback(onBlur, [onBlur]); // уже есть
|
|
64
85
|
const inputChange = React.useCallback(event => {
|
|
65
|
-
if (
|
|
66
|
-
|
|
86
|
+
if (stableOnChange) {
|
|
87
|
+
stableOnChange(event);
|
|
67
88
|
}
|
|
68
|
-
}, [
|
|
89
|
+
}, [stableOnChange]);
|
|
69
90
|
const inputFocus = React.useCallback(event => {
|
|
70
91
|
setFocused(true);
|
|
71
92
|
if (typeof onFocus === 'function') {
|
|
@@ -80,23 +101,29 @@ const TextField = (props, ref) => {
|
|
|
80
101
|
}, [onBlur]);
|
|
81
102
|
const hasStartIcon = React.useMemo(() => typeof startIcon !== 'undefined' && startIcon !== null, [startIcon]);
|
|
82
103
|
const hasEndIcon = React.useMemo(() => typeof endIcon !== 'undefined' && endIcon !== null, [endIcon]);
|
|
83
|
-
const overridesMap = React.useMemo(() => ({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
const overridesMap = React.useMemo(() => (Object.assign(Object.assign({}, defailtOverrides), overrides)), [overrides]);
|
|
105
|
+
const renderAsterisk = React.useCallback(() => {
|
|
106
|
+
if (!requiredAsterisk) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return (React.createElement(overridesMap.Asterisk, null, typeof requiredAsterisk === 'boolean' ? '*' : requiredAsterisk));
|
|
110
|
+
}, [overridesMap, requiredAsterisk]);
|
|
111
|
+
const renderLabel = React.useCallback(() => {
|
|
112
|
+
if (!label) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return (React.createElement(overridesMap.Label, { htmlFor: inputID, error: error },
|
|
94
116
|
label,
|
|
95
|
-
|
|
117
|
+
renderAsterisk()));
|
|
118
|
+
}, [error, inputID, label, overridesMap, renderAsterisk]);
|
|
119
|
+
const renderIcon = React.useCallback((position, icon) => (React.createElement(overridesMap.IconWrapper, { position: position }, icon)), [overridesMap]);
|
|
120
|
+
return (React.createElement(overridesMap.Container, { ref: ref, fullWidth: fullWidth, className: className, style: style, focused: focused },
|
|
121
|
+
renderLabel(),
|
|
96
122
|
React.createElement(overridesMap.InputWrapper, { error: error, focused: focused, fullWidth: fullWidth },
|
|
97
|
-
hasStartIcon && (
|
|
123
|
+
hasStartIcon && renderIcon('start', startIcon),
|
|
98
124
|
React.createElement(overridesMap.Input, Object.assign({}, nativeInputProps, { hasStartIcon: hasStartIcon, hasEndIcon: hasEndIcon, ref: inputRef, id: inputID, onChange: inputChange, onFocus: inputFocus, onBlur: inputBlur })),
|
|
99
|
-
hasEndIcon && (
|
|
125
|
+
hasEndIcon && renderIcon('end', endIcon)),
|
|
100
126
|
React.createElement(overridesMap.ErrorText, { error: error }, errorText)));
|
|
101
|
-
};
|
|
102
|
-
|
|
127
|
+
});
|
|
128
|
+
TextField.displayName = 'TextField';
|
|
129
|
+
exports.default = React.memo(TextField);
|
|
@@ -39,9 +39,9 @@ const createTheme = overrides => {
|
|
|
39
39
|
successContrast: '#ffffff',
|
|
40
40
|
};
|
|
41
41
|
Object.entries(Object.assign(Object.assign({}, defaultColors), color)).forEach(([colorName, colorValue]) => {
|
|
42
|
-
theme.color[colorName] =
|
|
42
|
+
theme.color[colorName] = Color_1.default.fromString(colorValue);
|
|
43
43
|
});
|
|
44
|
-
theme.color.test =
|
|
44
|
+
theme.color.test = Color_1.default.fromString('red');
|
|
45
45
|
return theme;
|
|
46
46
|
};
|
|
47
47
|
exports.createTheme = createTheme;
|
package/package.json
CHANGED
package/Calendar/reducer.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CalendarValue } from './use-calendar';
|
|
2
|
-
export type State<Range extends boolean | undefined = undefined> = {
|
|
3
|
-
readonly calendarDate: Date;
|
|
4
|
-
readonly calendarValue: CalendarValue<Range>;
|
|
5
|
-
readonly calendarCurrentView: CalendarView;
|
|
6
|
-
readonly calendarViewVariants: readonly CalendarView[];
|
|
7
|
-
};
|
|
8
|
-
export type CalendarView = 'days' | 'months' | 'years';
|
|
9
|
-
export declare const createDefaultState: <Range_1 extends boolean | undefined = undefined>(range?: Range_1 | undefined) => State<Range_1>;
|
|
10
|
-
export type Action<Range extends boolean | undefined = undefined> = {
|
|
11
|
-
readonly type: 'setPartial';
|
|
12
|
-
readonly payload: Partial<State<Range>>;
|
|
13
|
-
};
|
|
14
|
-
export declare const reducer: <Range_1 extends boolean | undefined = undefined>(state: State<Range_1>, action: Action<Range_1>) => State<Range_1>;
|
package/Calendar/reducer.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reducer = exports.createDefaultState = void 0;
|
|
4
|
-
const createDefaultState = (range) => {
|
|
5
|
-
const currentDate = new Date();
|
|
6
|
-
const nextDate = new Date();
|
|
7
|
-
nextDate.setDate(nextDate.getDate() + 3);
|
|
8
|
-
return {
|
|
9
|
-
calendarValue: range
|
|
10
|
-
? [currentDate, nextDate]
|
|
11
|
-
: new Date(),
|
|
12
|
-
calendarDate: range ? currentDate : new Date(),
|
|
13
|
-
calendarCurrentView: 'days',
|
|
14
|
-
calendarViewVariants: ['years', 'months', 'days'],
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
exports.createDefaultState = createDefaultState;
|
|
18
|
-
const reducer = (state, action) => {
|
|
19
|
-
switch (action.type) {
|
|
20
|
-
case 'setPartial':
|
|
21
|
-
return Object.assign(Object.assign({}, state), action.payload);
|
|
22
|
-
default:
|
|
23
|
-
return state;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.reducer = reducer;
|
|
File without changes
|
|
File without changes
|