@via-profit/ui-kit 0.1.7 → 0.2.1-alpha.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.
Files changed (40) hide show
  1. package/Accordion/index.d.ts +4 -4
  2. package/Autocomplete/AutocompleteContainer.d.ts +1 -1
  3. package/Autocomplete/AutocompleteContainer.js +1 -1
  4. package/Avatar/AvatarBase.d.ts +4 -4
  5. package/Badge/BadgeBase.d.ts +4 -4
  6. package/Button/ButtonBase.d.ts +3 -3
  7. package/Calendar/CalendarCell.js +18 -4
  8. package/Calendar/CalendarMonthCell.js +0 -5
  9. package/Calendar/CalendarYearCell.js +5 -5
  10. package/Calendar/index.d.ts +25 -21
  11. package/Calendar/index.js +89 -82
  12. package/Calendar/reducer.d.ts +4 -1
  13. package/Calendar/reducer.js +27 -3
  14. package/Calendar/use-calendar.js +102 -155
  15. package/DatePicker/index.js +1 -1
  16. package/Highlighted/index.d.ts +3 -3
  17. package/Menu/MenuContainer.d.ts +2 -2
  18. package/Menu/MenuContainer.js +2 -2
  19. package/Menu/index.js +2 -7
  20. package/Modal/BaseModal/RenderModal.d.ts +3 -3
  21. package/Modal/BaseModal/index.d.ts +3 -3
  22. package/Modal/ConfirmBox/index.d.ts +5 -5
  23. package/Modal/Drawer/index.d.ts +5 -5
  24. package/Modal/MessageBox/index.d.ts +5 -5
  25. package/Popper/Popper.d.ts +221 -0
  26. package/Popper/Popper.js +99 -0
  27. package/Popper/PopperContainer.d.ts +2 -0
  28. package/Popper/PopperContainer.js +3 -6
  29. package/Popper/index.d.ts +5 -22
  30. package/Popper/index.js +18 -264
  31. package/Popper/usePopprer.d.ts +25 -0
  32. package/Popper/usePopprer.js +330 -0
  33. package/Selectbox/index.d.ts +8 -8
  34. package/Selectbox/index.js +2 -2
  35. package/Surface/SurfaceContent.js +0 -2
  36. package/Surface/index.d.ts +5 -5
  37. package/Switch/index.d.ts +8 -8
  38. package/TextArea/index.d.ts +7 -7
  39. package/TextField/index.d.ts +7 -7
  40. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { AnchorPos } from './Popper';
3
+ import { PositionStrategy } from './PopperContainer';
4
+ export interface UsePopperProps {
5
+ readonly anchorElement?: HTMLElement | null;
6
+ readonly anchorPos?: AnchorPos;
7
+ readonly positionStrategy?: PositionStrategy;
8
+ readonly autoFlip?: boolean;
9
+ readonly offset?: number;
10
+ readonly viewportMargin?: number;
11
+ readonly isOpen?: boolean;
12
+ }
13
+ export interface UsePopperResult {
14
+ readonly actualPlacement: AnchorPos;
15
+ readonly style: React.CSSProperties | null;
16
+ readonly popperRef: React.MutableRefObject<HTMLDivElement | null>;
17
+ readonly isVisible: boolean;
18
+ readonly calculatePosition: () => void;
19
+ readonly getTransformOrigin: (placement: AnchorPos) => string;
20
+ readonly setActualPlacement: React.Dispatch<React.SetStateAction<AnchorPos>>;
21
+ readonly setStyle: React.Dispatch<React.SetStateAction<React.CSSProperties | null>>;
22
+ readonly setIsVisible: React.Dispatch<React.SetStateAction<boolean>>;
23
+ }
24
+ export declare const usePopper: ({ anchorElement, anchorPos, positionStrategy, autoFlip, offset, viewportMargin, isOpen, }: UsePopperProps) => UsePopperResult;
25
+ export default usePopper;
@@ -0,0 +1,330 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.usePopper = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const usePopper = ({ anchorElement, anchorPos = 'auto', positionStrategy = 'absolute', autoFlip = true, offset = 0, viewportMargin = 30, isOpen = false, }) => {
9
+ const [actualPlacement, setActualPlacement] = react_1.default.useState(anchorPos);
10
+ const [style, setStyle] = react_1.default.useState(null);
11
+ const [isVisible, setIsVisible] = react_1.default.useState(false);
12
+ const popperRef = react_1.default.useRef(null);
13
+ // Синхронизация actualPlacement с anchorPos
14
+ react_1.default.useEffect(() => {
15
+ if (actualPlacement !== anchorPos) {
16
+ setActualPlacement(anchorPos);
17
+ }
18
+ }, [actualPlacement, anchorPos]);
19
+ const getPositionStyle = react_1.default.useCallback((props) => {
20
+ const { place, anchorRect, popperRect, forViewportCheck = false } = props;
21
+ const [direction, modifier = ''] = place.split('-');
22
+ let left = anchorRect.left;
23
+ let top = anchorRect.top;
24
+ // Вычисляем позицию относительно viewport
25
+ switch (direction) {
26
+ case 'top':
27
+ top = anchorRect.top - popperRect.height - offset;
28
+ if (modifier === 'left' || modifier === 'start') {
29
+ left = anchorRect.left;
30
+ }
31
+ else if (modifier === 'right' || modifier === 'end') {
32
+ left = anchorRect.right - popperRect.width;
33
+ }
34
+ else {
35
+ left = anchorRect.left + (anchorRect.width - popperRect.width) / 2;
36
+ }
37
+ break;
38
+ case 'bottom':
39
+ top = anchorRect.bottom + offset;
40
+ if (modifier === 'left' || modifier === 'start') {
41
+ left = anchorRect.left;
42
+ }
43
+ else if (modifier === 'right' || modifier === 'end') {
44
+ left = anchorRect.right - popperRect.width;
45
+ }
46
+ else {
47
+ left = anchorRect.left + (anchorRect.width - popperRect.width) / 2;
48
+ }
49
+ break;
50
+ case 'left':
51
+ left = anchorRect.left - popperRect.width - offset;
52
+ if (modifier === 'top' || modifier === 'start') {
53
+ top = anchorRect.top;
54
+ }
55
+ else if (modifier === 'bottom' || modifier === 'end') {
56
+ top = anchorRect.bottom - popperRect.height;
57
+ }
58
+ else {
59
+ top = anchorRect.top + (anchorRect.height - popperRect.height) / 2;
60
+ }
61
+ break;
62
+ case 'right':
63
+ left = anchorRect.right + offset;
64
+ if (modifier === 'top' || modifier === 'start') {
65
+ top = anchorRect.top;
66
+ }
67
+ else if (modifier === 'bottom' || modifier === 'end') {
68
+ top = anchorRect.bottom - popperRect.height;
69
+ }
70
+ else {
71
+ top = anchorRect.top + (anchorRect.height - popperRect.height) / 2;
72
+ }
73
+ break;
74
+ default:
75
+ left = anchorRect.left + (anchorRect.width - popperRect.width) / 2;
76
+ top = anchorRect.bottom + offset;
77
+ }
78
+ // Возвращаем viewport координаты для проверки или финальные координаты
79
+ if (forViewportCheck) {
80
+ return { left, top };
81
+ }
82
+ // Для финального позиционирования учитываем стратегию
83
+ if (positionStrategy === 'absolute') {
84
+ return {
85
+ left: left + window.scrollX,
86
+ top: top + window.scrollY,
87
+ };
88
+ }
89
+ return { left, top };
90
+ }, [offset, positionStrategy]);
91
+ const checkIfViewportFits = react_1.default.useCallback((style, popperRect) => {
92
+ const left = style.left;
93
+ const top = style.top;
94
+ const right = left + popperRect.width;
95
+ const bottom = top + popperRect.height;
96
+ const viewportWidth = window.innerWidth;
97
+ const viewportHeight = window.innerHeight;
98
+ const isWithinHorizontal = left >= viewportMargin && right <= viewportWidth - viewportMargin;
99
+ const isWithinVertical = top >= viewportMargin && bottom <= viewportHeight - viewportMargin;
100
+ const hasValidPosition = left >= 0 && top >= 0;
101
+ return hasValidPosition && isWithinHorizontal && isWithinVertical;
102
+ }, [viewportMargin]);
103
+ const placementsOrder = react_1.default.useMemo(() => {
104
+ const basePlacements = {
105
+ top: ['top', 'top-left', 'top-right', 'top-start', 'top-end'],
106
+ bottom: ['bottom', 'bottom-left', 'bottom-right', 'bottom-start', 'bottom-end'],
107
+ left: ['left', 'left-top', 'left-bottom'],
108
+ right: ['right', 'right-top', 'right-bottom'],
109
+ };
110
+ const allPlacements = [
111
+ ...basePlacements.top,
112
+ ...basePlacements.bottom,
113
+ ...basePlacements.left,
114
+ ...basePlacements.right,
115
+ ];
116
+ const order = {};
117
+ allPlacements.forEach(placement => {
118
+ const [direction] = placement.split('-');
119
+ // Приоритет: то же направление > противоположное > остальные
120
+ const opposite = direction === 'top'
121
+ ? 'bottom'
122
+ : direction === 'bottom'
123
+ ? 'top'
124
+ : direction === 'left'
125
+ ? 'right'
126
+ : 'left';
127
+ order[placement] = [
128
+ placement,
129
+ ...basePlacements[direction].filter(p => p !== placement),
130
+ ...(basePlacements[opposite] || []),
131
+ ...(direction !== 'left' && direction !== 'right' ? basePlacements.left : []),
132
+ ...(direction !== 'left' && direction !== 'right' ? basePlacements.right : []),
133
+ ];
134
+ });
135
+ return order;
136
+ }, []);
137
+ const getPreferredPlacements = react_1.default.useCallback((preferredPlacement, anchorRect, popperRect) => {
138
+ // Обработка auto placement
139
+ if (preferredPlacement.startsWith('auto')) {
140
+ const [, preferredDirection = 'bottom'] = preferredPlacement.split('-');
141
+ const allPlacements = [
142
+ 'bottom',
143
+ 'bottom-start',
144
+ 'bottom-end',
145
+ 'bottom-left',
146
+ 'bottom-right',
147
+ 'top',
148
+ 'top-left',
149
+ 'top-right',
150
+ 'top-start',
151
+ 'top-end',
152
+ 'left',
153
+ 'left-top',
154
+ 'left-bottom',
155
+ 'right',
156
+ 'right-top',
157
+ 'right-bottom',
158
+ ];
159
+ // Сортируем: сначала указанное направление
160
+ const sortedPlacements = [...allPlacements].sort((a, b) => {
161
+ const aDir = a.split('-')[0];
162
+ const bDir = b.split('-')[0];
163
+ if (aDir === preferredDirection && bDir !== preferredDirection)
164
+ return -1;
165
+ if (aDir !== preferredDirection && bDir === preferredDirection)
166
+ return 1;
167
+ return 0;
168
+ });
169
+ for (const place of sortedPlacements) {
170
+ const viewportStyle = getPositionStyle({
171
+ place,
172
+ anchorRect,
173
+ popperRect,
174
+ forViewportCheck: true,
175
+ });
176
+ const fits = checkIfViewportFits(viewportStyle, popperRect);
177
+ if (fits) {
178
+ const finalStyle = getPositionStyle({
179
+ place,
180
+ anchorRect,
181
+ popperRect,
182
+ forViewportCheck: false,
183
+ });
184
+ return {
185
+ found: true,
186
+ placement: place,
187
+ style: finalStyle,
188
+ };
189
+ }
190
+ }
191
+ }
192
+ if (!autoFlip) {
193
+ const finalStyle = getPositionStyle({
194
+ place: preferredPlacement,
195
+ anchorRect,
196
+ popperRect,
197
+ forViewportCheck: false,
198
+ });
199
+ return {
200
+ found: false,
201
+ placement: preferredPlacement,
202
+ style: finalStyle,
203
+ };
204
+ }
205
+ const order = placementsOrder[preferredPlacement] || placementsOrder.bottom;
206
+ for (const place of order) {
207
+ const viewportStyle = getPositionStyle({
208
+ place,
209
+ anchorRect,
210
+ popperRect,
211
+ forViewportCheck: true,
212
+ });
213
+ const fits = checkIfViewportFits(viewportStyle, popperRect);
214
+ if (fits) {
215
+ const finalStyle = getPositionStyle({
216
+ place,
217
+ anchorRect,
218
+ popperRect,
219
+ forViewportCheck: false,
220
+ });
221
+ return {
222
+ found: true,
223
+ placement: place,
224
+ style: finalStyle,
225
+ };
226
+ }
227
+ }
228
+ const finalStyle = getPositionStyle({
229
+ place: preferredPlacement,
230
+ anchorRect,
231
+ popperRect,
232
+ forViewportCheck: false,
233
+ });
234
+ return {
235
+ found: false,
236
+ placement: preferredPlacement,
237
+ style: finalStyle,
238
+ };
239
+ }, [autoFlip, getPositionStyle, checkIfViewportFits, placementsOrder]);
240
+ const calculatePosition = react_1.default.useCallback(() => {
241
+ if (!anchorElement || !popperRef.current) {
242
+ return;
243
+ }
244
+ const anchorRect = anchorElement.getBoundingClientRect();
245
+ const popperRect = popperRef.current.getBoundingClientRect();
246
+ const placements = getPreferredPlacements(actualPlacement, anchorRect, popperRect);
247
+ if (placements.found) {
248
+ setActualPlacement(placements.placement);
249
+ setStyle(placements.style);
250
+ }
251
+ else {
252
+ setStyle(placements.style);
253
+ }
254
+ }, [actualPlacement, anchorElement, getPreferredPlacements]);
255
+ const getTransformOrigin = react_1.default.useCallback((placement) => {
256
+ if (placement.startsWith('top'))
257
+ return 'bottom center';
258
+ if (placement.startsWith('bottom'))
259
+ return 'top center';
260
+ if (placement.startsWith('left'))
261
+ return 'right center';
262
+ if (placement.startsWith('right'))
263
+ return 'left center';
264
+ return 'top center';
265
+ }, []);
266
+ // Очистка при закрытии
267
+ react_1.default.useEffect(() => {
268
+ if (!isOpen) {
269
+ setIsVisible(false);
270
+ setStyle(null);
271
+ }
272
+ else if (anchorElement && isOpen && popperRef.current) {
273
+ const anchorRect = anchorElement.getBoundingClientRect();
274
+ const popperRect = popperRef.current.getBoundingClientRect();
275
+ const placements = getPreferredPlacements(actualPlacement, anchorRect, popperRect);
276
+ if (placements.found) {
277
+ setActualPlacement(placements.placement);
278
+ setStyle(placements.style);
279
+ }
280
+ else {
281
+ setStyle(placements.style);
282
+ }
283
+ setIsVisible(true);
284
+ }
285
+ }, [actualPlacement, anchorElement, getPreferredPlacements, isOpen]);
286
+ // Отслеживание скролла
287
+ react_1.default.useEffect(() => {
288
+ const handleEvent = () => {
289
+ if (isOpen) {
290
+ calculatePosition();
291
+ }
292
+ };
293
+ window.addEventListener('scroll', handleEvent);
294
+ return () => {
295
+ window.removeEventListener('scroll', handleEvent);
296
+ };
297
+ }, [calculatePosition, isOpen]);
298
+ // Отслеживание мутаций anchor элемента
299
+ react_1.default.useEffect(() => {
300
+ if (!isOpen || !anchorElement)
301
+ return;
302
+ const observer = new MutationObserver(() => {
303
+ window.requestAnimationFrame(() => {
304
+ calculatePosition();
305
+ });
306
+ });
307
+ observer.observe(anchorElement, {
308
+ attributes: true,
309
+ childList: true,
310
+ subtree: true,
311
+ });
312
+ // eslint-disable-next-line consistent-return
313
+ return () => {
314
+ observer.disconnect();
315
+ };
316
+ }, [isOpen, anchorElement, calculatePosition]);
317
+ return {
318
+ actualPlacement,
319
+ style,
320
+ popperRef,
321
+ isVisible,
322
+ calculatePosition,
323
+ getTransformOrigin,
324
+ setActualPlacement,
325
+ setStyle,
326
+ setIsVisible,
327
+ };
328
+ };
329
+ exports.usePopper = usePopper;
330
+ exports.default = exports.usePopper;
@@ -33,7 +33,7 @@ export interface SelectboxProps<T, Multiple extends boolean | undefined = undefi
33
33
  /**
34
34
  * Anchor position\
35
35
  * \
36
- * Default: `auto-start-end`
36
+ * Default: `bottom`
37
37
  */
38
38
  readonly anchorPos?: AnchorPos;
39
39
  /**
@@ -125,31 +125,31 @@ export interface SelectboxOverrides {
125
125
  /**
126
126
  * Container element
127
127
  */
128
- readonly Container?: React.ForwardRefExoticComponent<SelectboxContainerProps & React.RefAttributes<HTMLDivElement>>;
128
+ readonly Container?: React.ComponentType<SelectboxContainerProps & React.RefAttributes<HTMLDivElement>>;
129
129
  /**
130
130
  * Base element
131
131
  */
132
- readonly Button?: React.ForwardRefExoticComponent<SelectboxButtonProps & React.RefAttributes<HTMLButtonElement>>;
132
+ readonly Button?: React.ComponentType<SelectboxButtonProps & React.RefAttributes<HTMLButtonElement>>;
133
133
  /**
134
134
  * Icon
135
135
  */
136
- readonly Icon?: React.ForwardRefExoticComponent<SelectboxChevronIconProps & React.RefAttributes<SVGElement>>;
136
+ readonly Icon?: React.ComponentType<SelectboxChevronIconProps & React.RefAttributes<SVGElement>>;
137
137
  /**
138
138
  * Component for display error text
139
139
  */
140
- readonly ErrorText?: React.ForwardRefExoticComponent<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
140
+ readonly ErrorText?: React.ComponentType<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
141
141
  /**
142
142
  * label component
143
143
  */
144
- readonly Label?: React.ForwardRefExoticComponent<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
144
+ readonly Label?: React.ComponentType<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
145
145
  /**
146
146
  * label asterisk component
147
147
  */
148
- readonly Asterisk?: React.ForwardRefExoticComponent<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
148
+ readonly Asterisk?: React.ComponentType<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
149
149
  /**
150
150
  * button wrapper component
151
151
  */
152
- readonly ButtonWrapper?: React.ForwardRefExoticComponent<SelectboxButtonWrapperProps & React.RefAttributes<HTMLDivElement>>;
152
+ readonly ButtonWrapper?: React.ComponentType<SelectboxButtonWrapperProps & React.RefAttributes<HTMLDivElement>>;
153
153
  }
154
154
  export type Children<T> = (data: {
155
155
  item: T;
@@ -29,7 +29,7 @@ const TextFieldErrorText_1 = __importDefault(require("../TextField/TextFieldErro
29
29
  const SelectboxButtonWrapper_1 = __importDefault(require("./SelectboxButtonWrapper"));
30
30
  const SelectboxContainer_1 = __importDefault(require("./SelectboxContainer"));
31
31
  const Selectbox = react_1.default.forwardRef((props, ref) => {
32
- const { items, value, multiple, isOpen = false, isLoading = false, anchorPos = 'auto-start-end', fullWidth = false, children, onChange, selectedItemToString, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides, id, label, onFocus, requiredAsterisk, error, errorText, notSetLabel = 'Not set' } = props, nativeButtonProps = __rest(props, ["items", "value", "multiple", "isOpen", "isLoading", "anchorPos", "fullWidth", "children", "onChange", "selectedItemToString", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides", "id", "label", "onFocus", "requiredAsterisk", "error", "errorText", "notSetLabel"]);
32
+ const { items, value, multiple, isOpen = false, isLoading = false, anchorPos = 'bottom', fullWidth = false, children, onChange, selectedItemToString, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides, id, label, onFocus, requiredAsterisk, error, errorText, notSetLabel = 'Not set' } = props, nativeButtonProps = __rest(props, ["items", "value", "multiple", "isOpen", "isLoading", "anchorPos", "fullWidth", "children", "onChange", "selectedItemToString", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides", "id", "label", "onFocus", "requiredAsterisk", "error", "errorText", "notSetLabel"]);
33
33
  const menuRef = react_1.default.useRef(null);
34
34
  const overridesMap = react_1.default.useMemo(() => ({
35
35
  Button: (overrides === null || overrides === void 0 ? void 0 : overrides.Button) || SelectboxButton_1.default,
@@ -117,7 +117,7 @@ const Selectbox = react_1.default.forwardRef((props, ref) => {
117
117
  if (typeof onChange === 'function') {
118
118
  onChange(item);
119
119
  }
120
- }, closeOnSelect: multiple ? false : true, onRequestClose: evt => {
120
+ }, closeOnSelect: !multiple, onRequestClose: evt => {
121
121
  if ((evt === null || evt === void 0 ? void 0 : evt.target) !== anchorElement) {
122
122
  onRequestClose(evt);
123
123
  anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.focus();
@@ -19,10 +19,8 @@ const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const react_2 = require("@emotion/react");
20
20
  const StyledContent = styled_1.default.div `
21
21
  flex: 1;
22
- overflow: auto;
23
22
  ${({ $noPadding }) => (typeof $noPadding === 'undefined' || $noPadding === false) &&
24
23
  (0, react_2.css) `
25
- overflow: visible;
26
24
  padding: 1.4rem 1rem 1rem 1rem;
27
25
  `}
28
26
 
@@ -39,23 +39,23 @@ export interface SurfaceOverrides {
39
39
  /**
40
40
  * Surface container component
41
41
  */
42
- readonly Container?: React.ForwardRefExoticComponent<SurfaceContainerProps & React.RefAttributes<HTMLDivElement>>;
42
+ readonly Container?: React.ComponentType<SurfaceContainerProps & React.RefAttributes<HTMLDivElement>>;
43
43
  /**
44
44
  * Surface header component
45
45
  */
46
- readonly Header?: React.ForwardRefExoticComponent<SurfaceHeaderProps & React.RefAttributes<HTMLDivElement>>;
46
+ readonly Header?: React.ComponentType<SurfaceHeaderProps & React.RefAttributes<HTMLDivElement>>;
47
47
  /**
48
48
  * Surface subheader component
49
49
  */
50
- readonly Subheader?: React.ForwardRefExoticComponent<SurfaceSubheaderProps & React.RefAttributes<HTMLDivElement>>;
50
+ readonly Subheader?: React.ComponentType<SurfaceSubheaderProps & React.RefAttributes<HTMLDivElement>>;
51
51
  /**
52
52
  * Surface content component
53
53
  */
54
- readonly Content?: React.ForwardRefExoticComponent<SurfaceContentProps & React.RefAttributes<HTMLDivElement>>;
54
+ readonly Content?: React.ComponentType<SurfaceContentProps & React.RefAttributes<HTMLDivElement>>;
55
55
  /**
56
56
  * Surface footer component
57
57
  */
58
- readonly Footer?: React.ForwardRefExoticComponent<SurfaceFooterProps & React.RefAttributes<HTMLDivElement>>;
58
+ readonly Footer?: React.ComponentType<SurfaceFooterProps & React.RefAttributes<HTMLDivElement>>;
59
59
  }
60
60
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
61
61
  readonly children: React.ReactNode | React.ReactNode[];
package/Switch/index.d.ts CHANGED
@@ -58,35 +58,35 @@ export interface SwitchOverrides {
58
58
  /**
59
59
  * Element container
60
60
  */
61
- readonly Container?: React.ForwardRefExoticComponent<SwitchContainerProps & React.RefAttributes<HTMLSpanElement>>;
61
+ readonly Container?: React.ComponentType<SwitchContainerProps & React.RefAttributes<HTMLSpanElement>>;
62
62
  /**
63
63
  * Element toggle
64
64
  */
65
- readonly ToggleWrapper?: React.ForwardRefExoticComponent<SwitchToggleWrapperProps & React.RefAttributes<HTMLSpanElement>>;
65
+ readonly ToggleWrapper?: React.ComponentType<SwitchToggleWrapperProps & React.RefAttributes<HTMLSpanElement>>;
66
66
  /**
67
67
  * text wrapper
68
68
  */
69
- readonly TextWrapper?: React.ForwardRefExoticComponent<SwitchTextWrapperProps & React.RefAttributes<HTMLSpanElement>>;
69
+ readonly TextWrapper?: React.ComponentType<SwitchTextWrapperProps & React.RefAttributes<HTMLSpanElement>>;
70
70
  /**
71
71
  * Dot wrapper
72
72
  */
73
- readonly Dot?: React.ForwardRefExoticComponent<SwitchDotProps & React.RefAttributes<HTMLSpanElement>>;
73
+ readonly Dot?: React.ComponentType<SwitchDotProps & React.RefAttributes<HTMLSpanElement>>;
74
74
  /**
75
75
  * Toggle track wrapper
76
76
  */
77
- readonly Track?: React.ForwardRefExoticComponent<SwitchTrackProps & React.RefAttributes<HTMLSpanElement>>;
77
+ readonly Track?: React.ComponentType<SwitchTrackProps & React.RefAttributes<HTMLSpanElement>>;
78
78
  /**
79
79
  * error text wrapper
80
80
  */
81
- readonly ErrorText?: React.ForwardRefExoticComponent<SwitchErrorTextProps & React.RefAttributes<HTMLSpanElement>>;
81
+ readonly ErrorText?: React.ComponentType<SwitchErrorTextProps & React.RefAttributes<HTMLSpanElement>>;
82
82
  /**
83
83
  * error text wrapper
84
84
  */
85
- readonly Asterisk?: React.ForwardRefExoticComponent<SwitchAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
85
+ readonly Asterisk?: React.ComponentType<SwitchAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
86
86
  /**
87
87
  * the main cwitch wrapper
88
88
  */
89
- readonly Wrapper?: React.ForwardRefExoticComponent<SwitchWrapperProps & React.RefAttributes<HTMLSpanElement>>;
89
+ readonly Wrapper?: React.ComponentType<SwitchWrapperProps & React.RefAttributes<HTMLSpanElement>>;
90
90
  }
91
91
  declare const _default: React.ForwardRefExoticComponent<Omit<SwitchToggleWrapperProps, "onChange" | "disabled" | "checked"> & {
92
92
  /**
@@ -50,31 +50,31 @@ export interface TextAreaOverrides {
50
50
  /**
51
51
  * Native `input` component
52
52
  */
53
- readonly Input?: React.ForwardRefExoticComponent<TextAreaInputProps & React.RefAttributes<HTMLTextAreaElement>>;
53
+ readonly Input?: React.ComponentType<TextAreaInputProps & React.RefAttributes<HTMLTextAreaElement>>;
54
54
  /**
55
55
  * Component for display error text
56
56
  */
57
- readonly ErrorText?: React.ForwardRefExoticComponent<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
57
+ readonly ErrorText?: React.ComponentType<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
58
58
  /**
59
59
  * Icons wrapper component
60
60
  */
61
- readonly IconWrapper?: React.ForwardRefExoticComponent<TextAreaIconWrapperProps & React.RefAttributes<HTMLDivElement>>;
61
+ readonly IconWrapper?: React.ComponentType<TextAreaIconWrapperProps & React.RefAttributes<HTMLDivElement>>;
62
62
  /**
63
63
  * input field wrapper component
64
64
  */
65
- readonly InputWrapper?: React.ForwardRefExoticComponent<TextFieldInputWrapperProps & React.RefAttributes<HTMLDivElement>>;
65
+ readonly InputWrapper?: React.ComponentType<TextFieldInputWrapperProps & React.RefAttributes<HTMLDivElement>>;
66
66
  /**
67
67
  * label component
68
68
  */
69
- readonly Label?: React.ForwardRefExoticComponent<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
69
+ readonly Label?: React.ComponentType<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
70
70
  /**
71
71
  * label asterisk component
72
72
  */
73
- readonly Asterisk?: React.ForwardRefExoticComponent<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
73
+ readonly Asterisk?: React.ComponentType<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
74
74
  /**
75
75
  * label component
76
76
  */
77
- readonly Container?: React.ForwardRefExoticComponent<TextFieldContainerProps & React.RefAttributes<HTMLDivElement>>;
77
+ readonly Container?: React.ComponentType<TextFieldContainerProps & React.RefAttributes<HTMLDivElement>>;
78
78
  }
79
79
  declare const _default: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLDivElement>>;
80
80
  export default _default;
@@ -50,31 +50,31 @@ export interface TextFieldOverrides {
50
50
  /**
51
51
  * Native `input` component
52
52
  */
53
- readonly Input?: React.ForwardRefExoticComponent<TextFieldInputProps & React.RefAttributes<HTMLInputElement>>;
53
+ readonly Input?: React.ComponentType<TextFieldInputProps & React.RefAttributes<HTMLInputElement>>;
54
54
  /**
55
55
  * Component for display error text
56
56
  */
57
- readonly ErrorText?: React.ForwardRefExoticComponent<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
57
+ readonly ErrorText?: React.ComponentType<TextFieldErrorTextProps & React.RefAttributes<HTMLDivElement>>;
58
58
  /**
59
59
  * Icons wrapper component
60
60
  */
61
- readonly IconWrapper?: React.ForwardRefExoticComponent<TextFieldIconWrapperProps & React.RefAttributes<HTMLDivElement>>;
61
+ readonly IconWrapper?: React.ComponentType<TextFieldIconWrapperProps & React.RefAttributes<HTMLDivElement>>;
62
62
  /**
63
63
  * input field wrapper component
64
64
  */
65
- readonly InputWrapper?: React.ForwardRefExoticComponent<TextFieldInputWrapperProps & React.RefAttributes<HTMLDivElement>>;
65
+ readonly InputWrapper?: React.ComponentType<TextFieldInputWrapperProps & React.RefAttributes<HTMLDivElement>>;
66
66
  /**
67
67
  * label component
68
68
  */
69
- readonly Label?: React.ForwardRefExoticComponent<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
69
+ readonly Label?: React.ComponentType<TextFieldLabelProps & React.RefAttributes<HTMLLabelElement>>;
70
70
  /**
71
71
  * label asterisk component
72
72
  */
73
- readonly Asterisk?: React.ForwardRefExoticComponent<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
73
+ readonly Asterisk?: React.ComponentType<TextFieldLabelAsteriskProps & React.RefAttributes<HTMLSpanElement>>;
74
74
  /**
75
75
  * label component
76
76
  */
77
- readonly Container?: React.ForwardRefExoticComponent<TextFieldContainerProps & React.RefAttributes<HTMLDivElement>>;
77
+ readonly Container?: React.ComponentType<TextFieldContainerProps & React.RefAttributes<HTMLDivElement>>;
78
78
  }
79
79
  declare const _default: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLDivElement>>;
80
80
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@via-profit/ui-kit",
3
- "version": "0.1.7",
3
+ "version": "0.2.1-alpha.1",
4
4
  "description": "UI Kit",
5
5
  "repository": {
6
6
  "type": "git",