@via-profit/ui-kit 0.2.1-alpha.1 → 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.
Files changed (138) hide show
  1. package/Autocomplete/AutocompleteContainer.d.ts +33 -6
  2. package/Autocomplete/AutocompleteContainer.js +28 -24
  3. package/Autocomplete/AutocompleteItem.d.ts +1 -1
  4. package/Autocomplete/AutocompleteTextField.d.ts +3 -0
  5. package/Autocomplete/AutocompleteTextField.js +63 -1
  6. package/Autocomplete/OverrideMenuList.d.ts +4 -0
  7. package/Autocomplete/OverrideMenuList.js +39 -0
  8. package/Autocomplete/context.d.ts +9 -1
  9. package/Autocomplete/context.js +15 -1
  10. package/Autocomplete/index.js +9 -10
  11. package/Autocomplete2/Autocomplete2.d.ts +12 -0
  12. package/Autocomplete2/Autocomplete2.js +83 -0
  13. package/Autocomplete2/Autocomplete2TextField.d.ts +7 -0
  14. package/Autocomplete2/Autocomplete2TextField.js +39 -0
  15. package/Autocomplete2/index.d.ts +2 -0
  16. package/Autocomplete2/index.js +7 -0
  17. package/Avatar/index.js +1 -1
  18. package/Badge/BadgeDeleteButton.js +6 -6
  19. package/Badge/BadgeOutlined.js +2 -2
  20. package/Badge/BadgeStandard.js +1 -1
  21. package/Button/ButtonOutlined.js +1 -1
  22. package/Button/ButtonPlain.js +1 -1
  23. package/Button/ButtonStandard.js +4 -11
  24. package/Calendar/CalendarCell.js +6 -2
  25. package/Calendar/CalendarComponent.d.ts +226 -0
  26. package/Calendar/CalendarComponent.js +572 -0
  27. package/Calendar/CalendarControlButton.js +16 -9
  28. package/Calendar/CalendarDayBadge.js +1 -1
  29. package/Calendar/CalendarEmptyCell.d.ts +2 -2
  30. package/Calendar/CalendarEmptyCell.js +8 -3
  31. package/Calendar/CalendarHeading.js +2 -1
  32. package/Calendar/CalendarSubheading.js +3 -2
  33. package/Calendar/CalendarWeekDayCell.d.ts +10 -0
  34. package/Calendar/CalendarWeekDayCell.js +32 -0
  35. package/Calendar/CalendarWeekDayWeekNumber.d.ts +7 -0
  36. package/Calendar/CalendarWeekDayWeekNumber.js +38 -0
  37. package/Calendar/CalendarWeekRow.d.ts +2 -2
  38. package/Calendar/CalendarWeekRow.js +2 -1
  39. package/Calendar/CalendarWeekRowButton.d.ts +13 -0
  40. package/Calendar/CalendarWeekRowButton.js +31 -0
  41. package/Calendar/CalendarYearsSelector.d.ts +39 -1
  42. package/Calendar/CalendarYearsSelector.js +52 -16
  43. package/Calendar/IconChevronDown.d.ts +3 -0
  44. package/Calendar/IconChevronDown.js +31 -0
  45. package/Calendar/index.d.ts +7 -224
  46. package/Calendar/index.js +19 -281
  47. package/Calendar/use-calendar.d.ts +1 -1
  48. package/Color/Color.d.ts +138 -0
  49. package/Color/Color.js +324 -0
  50. package/Color/ColorGenerator.d.ts +29 -0
  51. package/Color/ColorGenerator.js +141 -0
  52. package/Color/ColorParser.d.ts +20 -0
  53. package/Color/ColorParser.js +284 -0
  54. package/Color/index.d.ts +4 -122
  55. package/Color/index.js +18 -473
  56. package/DatePicker/index.d.ts +2 -17
  57. package/DatePicker/index.js +47 -61
  58. package/DatePicker/useDatePickerFormat.js +5 -5
  59. package/ErrorBoundary/Fallback.d.ts +3 -0
  60. package/ErrorBoundary/Fallback.js +51 -0
  61. package/ErrorBoundary/RenderError.d.ts +6 -0
  62. package/ErrorBoundary/RenderError.js +80 -0
  63. package/ErrorBoundary/index.d.ts +7 -11
  64. package/ErrorBoundary/index.js +4 -51
  65. package/LoadingIndicator/Spinner.d.ts +5 -3
  66. package/LoadingIndicator/Spinner.js +61 -32
  67. package/LoadingIndicator/index.d.ts +3 -3
  68. package/LoadingIndicator/index.js +15 -2
  69. package/MaskedField/index.d.ts +1 -1
  70. package/MaskedField/index.js +11 -10
  71. package/Menu/AutoHeightWrapper.d.ts +6 -0
  72. package/Menu/AutoHeightWrapper.js +43 -0
  73. package/Menu/MeasuredItem.d.ts +10 -0
  74. package/Menu/MeasuredItem.js +51 -0
  75. package/Menu/MenuContainer.d.ts +51 -18
  76. package/Menu/MenuContainer.js +18 -11
  77. package/Menu/MenuItem.d.ts +24 -7
  78. package/Menu/MenuItem.js +13 -6
  79. package/Menu/MenuList.d.ts +4 -2
  80. package/Menu/MenuList.js +26 -6
  81. package/Menu/VirtualizedItem.d.ts +22 -0
  82. package/Menu/VirtualizedItem.js +69 -0
  83. package/Menu/VirtualizedList.d.ts +18 -0
  84. package/Menu/VirtualizedList.js +28 -0
  85. package/Menu/VirtualizedListComponent.d.ts +20 -0
  86. package/Menu/VirtualizedListComponent.js +305 -0
  87. package/Menu/index.d.ts +3 -1
  88. package/Menu/index.js +2 -0
  89. package/Popper/Popper.d.ts +7 -80
  90. package/Popper/Popper.js +26 -12
  91. package/Popper/PopperContainer.js +1 -1
  92. package/Popper/usePopprer.d.ts +88 -3
  93. package/Popper/usePopprer.js +240 -65
  94. package/Selectbox/SelectboxButton.d.ts +5 -0
  95. package/Selectbox/SelectboxButton.js +48 -8
  96. package/Selectbox/SelectboxButtonWrapper.d.ts +2 -0
  97. package/Selectbox/SelectboxButtonWrapper.js +1 -17
  98. package/Selectbox/SelectboxMenu.d.ts +12 -0
  99. package/Selectbox/SelectboxMenu.js +50 -0
  100. package/Selectbox/index.d.ts +5 -5
  101. package/Selectbox/index.js +115 -97
  102. package/Surface/index.js +1 -1
  103. package/Swiper/Swiper.d.ts +44 -0
  104. package/Swiper/Swiper.js +139 -0
  105. package/Swiper/SwiperContainer.d.ts +7 -0
  106. package/Swiper/SwiperContainer.js +14 -0
  107. package/Swiper/SwiperSlide.d.ts +7 -0
  108. package/Swiper/SwiperSlide.js +55 -0
  109. package/Swiper/SwiperTrack.d.ts +14 -0
  110. package/Swiper/SwiperTrack.js +58 -0
  111. package/Swiper/SwiperWrapper.d.ts +14 -0
  112. package/Swiper/SwiperWrapper.js +60 -0
  113. package/Swiper/index.d.ts +7 -0
  114. package/Swiper/index.js +26 -0
  115. package/Switch/SwitchDot.js +1 -1
  116. package/Switch/SwitchTrack.js +1 -1
  117. package/TextField/TextFieldContainer.d.ts +2 -2
  118. package/TextField/TextFieldContainer.js +5 -3
  119. package/TextField/TextFieldErrorText.d.ts +2 -2
  120. package/TextField/TextFieldErrorText.js +5 -4
  121. package/TextField/TextFieldIconWrapper.d.ts +3 -3
  122. package/TextField/TextFieldIconWrapper.js +5 -3
  123. package/TextField/TextFieldInput.d.ts +2 -2
  124. package/TextField/TextFieldInput.js +6 -4
  125. package/TextField/TextFieldInputWrapper.d.ts +2 -2
  126. package/TextField/TextFieldInputWrapper.js +5 -3
  127. package/TextField/TextFieldLabel.d.ts +2 -2
  128. package/TextField/TextFieldLabel.js +5 -3
  129. package/TextField/TextFieldLabelAsterisk.d.ts +2 -2
  130. package/TextField/TextFieldLabelAsterisk.js +5 -3
  131. package/TextField/index.d.ts +8 -1
  132. package/TextField/index.js +49 -22
  133. package/ThemeProvider/createTheme.js +2 -2
  134. package/package.json +1 -1
  135. package/Calendar/reducer.d.ts +0 -17
  136. package/Calendar/reducer.js +0 -50
  137. /package/Calendar/{IconChevronRight.d.ts → CalendarIconNext.d.ts} +0 -0
  138. /package/Calendar/{IconChevronRight.js → CalendarIconNext.js} +0 -0
@@ -57,14 +57,14 @@ const BadgeOutlined = (props, ref) => {
57
57
  case typeof color === 'undefined':
58
58
  case color === 'default':
59
59
  return {
60
- $color: new Color_1.default(theme.color.textPrimary),
60
+ $color: Color_1.default.fromString(theme.color.textPrimary.toString()),
61
61
  $background: theme.color.textPrimary.lighten(100),
62
62
  };
63
63
  case typeof color === 'string': {
64
64
  let c = theme.color.textPrimary;
65
65
  try {
66
66
  if (color) {
67
- c = new Color_1.default(color);
67
+ c = Color_1.default.fromString(color);
68
68
  }
69
69
  }
70
70
  catch (err) {
@@ -73,7 +73,7 @@ const BadgeStandard = (props, ref) => {
73
73
  let $background = theme.color.surface;
74
74
  try {
75
75
  if (color) {
76
- $background = new Color_1.default(color);
76
+ $background = Color_1.default.fromString(color);
77
77
  }
78
78
  }
79
79
  catch (err) {
@@ -70,7 +70,7 @@ const ButtonOutlined = (props, ref) => {
70
70
  let c = theme.color.textPrimary;
71
71
  try {
72
72
  if (color) {
73
- c = new Color_1.default(color);
73
+ c = Color_1.default.fromString(color);
74
74
  }
75
75
  }
76
76
  catch (err) {
@@ -71,7 +71,7 @@ const ButtonPlain = (props, ref) => {
71
71
  let $color = theme.color.textPrimary;
72
72
  try {
73
73
  if (color) {
74
- $color = new Color_1.default(color);
74
+ $color = Color_1.default.fromString(color);
75
75
  }
76
76
  }
77
77
  catch (err) {
@@ -31,19 +31,12 @@ const StyledStandardButton = (0, styled_1.default)(ButtonBase_1.default) `
31
31
  background-color: ${({ $background, disabled }) => {
32
32
  switch (true) {
33
33
  case disabled:
34
- return $background.darken(10).toString();
35
- default:
36
- return $background.toString();
37
- }
38
- }};
39
- ${({ $background }) => {
40
- switch (true) {
41
- case $background.getLuminance() > 0.49:
42
- return $background.darken(40).alpha(0.8).toString();
34
+ return $background.darken(40).toString();
43
35
  default:
44
- return $background.darken(20).alpha(0.5).toString();
36
+ return $background.darken(10).toString();
45
37
  }
46
38
  }};
39
+
47
40
  ${({ disabled, $background, theme }) => !disabled &&
48
41
  (0, react_2.css) `
49
42
  &:hover {
@@ -86,7 +79,7 @@ const ButtonStandard = (props, ref) => {
86
79
  let $background = theme.color.surface;
87
80
  try {
88
81
  if (color) {
89
- $background = new Color_1.default(color);
82
+ $background = Color_1.default.fromString(color);
90
83
  }
91
84
  }
92
85
  catch (err) {
@@ -25,17 +25,21 @@ const Btn = (0, styled_1.default)(Button_1.default) `
25
25
  font-size: 0.8em;
26
26
  width: 3em;
27
27
  height: 3em;
28
+ padding: 1em;
28
29
  margin: 0;
29
30
  min-width: 0;
30
31
  outline: none;
31
32
  position: relative;
33
+ color: ${({ theme, $isSelected }) => $isSelected
34
+ ? theme.color.accentPrimaryContrast.toString()
35
+ : theme.color.textPrimary.toString()};
32
36
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
33
37
  ${({ $fill, theme, $isSelected }) => $fill &&
34
38
  !$isSelected &&
35
39
  (0, react_2.css) `
36
- background-color: none;
40
+ background-color: transparent;
37
41
  position: relative;
38
-
42
+ color: ${theme.color.accentPrimaryContrast.toString()};
39
43
  &:before {
40
44
  position: absolute;
41
45
  border-radius: ${theme.shape.radiusFactor * 0.8}em;
@@ -0,0 +1,226 @@
1
+ import React from 'react';
2
+ import { CalendarBodyProps } from './CalendarBody';
3
+ import { CalendarCellProps } from './CalendarCell';
4
+ import { CalendarWeekCellProps } from './CalendarWeekDayCell';
5
+ import { CalendarEmptyCellProps } from './CalendarEmptyCell';
6
+ import { CalendarWeekRowButtonProps } from './CalendarWeekRowButton';
7
+ import { CalendarWeekDayWeekNumberProps } from './CalendarWeekDayWeekNumber';
8
+ import { CalendarPaperProps } from './CalendarPaper';
9
+ import { CalendarHeaderProps } from './CalendarHeader';
10
+ import { CalendarWeekRowProps } from './CalendarWeekRow';
11
+ import { CalendarDateContainerProps } from './CalendarDateContainer';
12
+ import { CalendarToolbarProps } from './CalendarToolbar';
13
+ import { CalendarYearsSelectorProps } from './CalendarYearsSelector';
14
+ import { CalendarMonthsSelectorProps } from './CalendarMonthsSelector';
15
+ import { CalendarMonthCellProps } from './CalendarMonthCell';
16
+ import { CalendarDayBadgeProps } from './CalendarDayBadge';
17
+ import { CalendarFooterProps } from './CalendarFooter';
18
+ import { CalendarControlButtonProps } from './CalendarControlButton';
19
+ import { CalendarHeadingProps } from './CalendarHeading';
20
+ import { CalendarSubheadingProps } from './CalendarSubheading';
21
+ import { CalendarIconPrevProps } from './CalendarIconPrev';
22
+ import { CalendarIconNextProps } from './CalendarIconNext';
23
+ import { CalendarWeekDaysBarProps, WeekNameLabelFormat } from './CalendarWeekDaysBar';
24
+ import { CalendarValue, WeekDayName } from './use-calendar';
25
+ export * from './use-calendar';
26
+ export * from './CalendarWeekDaysBar';
27
+ export type CalendarView = 'days' | 'months' | 'years' | 'weeks';
28
+ export type CalendarOnChange<IsRangeValue extends boolean | undefined = undefined> = (dates: CalendarValue<IsRangeValue>) => void;
29
+ export type CalendarProps<IsRangeValue extends boolean | undefined = undefined> = {
30
+ readonly range?: IsRangeValue;
31
+ /**
32
+ * Selected date
33
+ */
34
+ readonly value?: CalendarValue<IsRangeValue>;
35
+ /**
36
+ * selected value if your component should not be controlled
37
+ */
38
+ readonly defaultValue?: CalendarValue<IsRangeValue>;
39
+ /**
40
+ * It will be called at the moment of selecting the given
41
+ */
42
+ readonly onChange: CalendarOnChange<IsRangeValue>;
43
+ /**
44
+ * calendar locale\
45
+ * **Default:** `ru-RU`
46
+ */
47
+ readonly locale?: string;
48
+ /**
49
+ * array of badges
50
+ */
51
+ readonly badges?: readonly CalendarBadge[];
52
+ /**
53
+ * Minimum date limit\
54
+ * **Default:** -100 year
55
+
56
+ */
57
+ readonly minDate?: Date;
58
+ /**
59
+ * Maximum date limit\
60
+ * **Default:** +100 year
61
+ */
62
+ readonly maxDate?: Date;
63
+ /**
64
+ * The day the week starts from\
65
+ * **Default:** `monday`
66
+ */
67
+ readonly weekStartDay?: WeekDayName;
68
+ /**
69
+ * Int weekday format\
70
+ * **Default:** `short`
71
+ */
72
+ readonly weekDayLabelFormat?: WeekNameLabelFormat;
73
+ /**
74
+ * Display days with leading zero
75
+ * **Default:** `false`
76
+ */
77
+ readonly displayLeadingZero?: boolean;
78
+ /**
79
+ * Mark current day cell\
80
+ * **Default:** `true`
81
+ */
82
+ readonly markToday?: boolean;
83
+ /**
84
+ * Cell accent color\
85
+ * **Default:** `primary`
86
+ */
87
+ readonly accentColor?: 'primary' | 'secondary' | string;
88
+ /**
89
+ * Label for the Reset button. If label passed, then button will be rendered
90
+ */
91
+ readonly resetButtonLabel?: string;
92
+ /**
93
+ * Label for the Today button. If label passed, then button will be rendered
94
+ */
95
+ readonly todayButtonLabel?: string;
96
+ /**
97
+ * Heading
98
+ */
99
+ readonly heading?: React.ReactNode;
100
+ /**
101
+ * Subheading
102
+ */
103
+ readonly subheading?: React.ReactNode;
104
+ /**
105
+ * Initial name of the view\
106
+ * **Default:** `days`
107
+ */
108
+ readonly initialView?: CalendarView;
109
+ readonly view?: CalendarView;
110
+ /**
111
+ * Posibility calendar views list
112
+ */
113
+ readonly views?: readonly CalendarView[];
114
+ /**
115
+ * Custom footer elements
116
+ */
117
+ readonly footer?: React.ReactNode;
118
+ /**
119
+ * Overridable components map
120
+ */
121
+ readonly overrides?: CalendarOverrides;
122
+ };
123
+ export interface CalendarOverrides {
124
+ /**
125
+ * Element container
126
+ */
127
+ readonly Body?: React.ComponentType<CalendarBodyProps & React.RefAttributes<HTMLDivElement>>;
128
+ /**
129
+ * Day element
130
+ */
131
+ readonly Cell?: React.ComponentType<CalendarCellProps & React.RefAttributes<HTMLButtonElement>>;
132
+ /**
133
+ * Day element
134
+ */
135
+ readonly WeekDayCell?: React.ComponentType<CalendarWeekCellProps & React.RefAttributes<HTMLSpanElement>>;
136
+ /**
137
+ * Number of the week in weeks selector
138
+ */
139
+ readonly WeekDayWeekNumber?: React.ComponentType<CalendarWeekDayWeekNumberProps & React.RefAttributes<HTMLSpanElement>>;
140
+ /**
141
+ * The button to select the week in the `weeks` view
142
+ */
143
+ readonly WeekRowButton?: React.ComponentType<CalendarWeekRowButtonProps & React.RefAttributes<HTMLButtonElement>>;
144
+ /**
145
+ * Empty cell element
146
+ */
147
+ readonly EmptyCell?: React.ComponentType<CalendarEmptyCellProps & React.RefAttributes<HTMLButtonElement>>;
148
+ /**
149
+ * Common container element
150
+ */
151
+ readonly Paper?: React.ComponentType<CalendarPaperProps & React.RefAttributes<HTMLDivElement>>;
152
+ /**
153
+ * Header wrapper element
154
+ */
155
+ readonly Header?: React.ComponentType<CalendarHeaderProps & React.RefAttributes<HTMLDivElement>>;
156
+ /**
157
+ * Week row container element
158
+ */
159
+ readonly WeekRow?: React.ComponentType<CalendarWeekRowProps & React.RefAttributes<HTMLDivElement>>;
160
+ /**
161
+ * Days wrapper element
162
+ */
163
+ readonly DateContainer?: React.ComponentType<CalendarDateContainerProps & React.RefAttributes<HTMLDivElement>>;
164
+ /**
165
+ * Toolbar wrapper element
166
+ */
167
+ readonly Toolbar?: React.ComponentType<CalendarToolbarProps & React.RefAttributes<HTMLDivElement>>;
168
+ /**
169
+ * Years list element (year view)
170
+ */
171
+ readonly YearsSelector?: React.ComponentType<CalendarYearsSelectorProps & React.RefAttributes<HTMLDivElement>>;
172
+ /**
173
+ * Monthes list element (month view)
174
+ */
175
+ readonly MonthsSelector?: React.ComponentType<CalendarMonthsSelectorProps & React.RefAttributes<HTMLDivElement>>;
176
+ /**
177
+ * Month cell element in monthes list
178
+ */
179
+ readonly MonthCell?: React.ComponentType<CalendarMonthCellProps & React.RefAttributes<HTMLButtonElement>>;
180
+ /**
181
+ * Badge of the day cell element
182
+ */
183
+ readonly DayBadge?: React.ComponentType<CalendarDayBadgeProps & React.RefAttributes<HTMLSpanElement>>;
184
+ /**
185
+ * Footer container element
186
+ */
187
+ readonly Footer?: React.ComponentType<CalendarFooterProps & React.RefAttributes<HTMLDivElement>>;
188
+ /**
189
+ * Common button element
190
+ */
191
+ readonly ControlButton?: React.ComponentType<CalendarControlButtonProps & React.RefAttributes<HTMLButtonElement>>;
192
+ /**
193
+ * Heading element
194
+ */
195
+ readonly Heading?: React.ComponentType<CalendarHeadingProps & React.RefAttributes<HTMLDivElement>>;
196
+ /**
197
+ * Subheading element
198
+ */
199
+ readonly Subheading?: React.ComponentType<CalendarSubheadingProps & React.RefAttributes<HTMLDivElement>>;
200
+ /**
201
+ * Prev icon element in prev month button
202
+ */
203
+ readonly IconPrev?: React.ComponentType<CalendarIconPrevProps & React.RefAttributes<SVGElement>>;
204
+ /**
205
+ * Next icon element in next month button
206
+ */
207
+ readonly IconNext?: React.ComponentType<CalendarIconNextProps & React.RefAttributes<SVGElement>>;
208
+ /**
209
+ * Weeks bar element
210
+ */
211
+ readonly WeekDaysBar?: React.ComponentType<CalendarWeekDaysBarProps & React.RefAttributes<HTMLDivElement>>;
212
+ }
213
+ export type CalendarBadge = {
214
+ readonly date: Date;
215
+ readonly badgeContent: React.ReactNode;
216
+ readonly accentColor?: 'primary' | 'secondary' | string;
217
+ };
218
+ export type CalendarRef<IsRangeValue extends boolean | undefined = undefined> = {
219
+ readonly setView: (view: CalendarView) => void;
220
+ readonly getActiveView: () => CalendarView;
221
+ readonly setValue: (value: CalendarValue<IsRangeValue>) => void;
222
+ readonly setCalendarDate: (date: Date) => void;
223
+ readonly reset: () => void;
224
+ };
225
+ declare const CalendarComponent: React.ForwardRefExoticComponent<CalendarProps<boolean | undefined> & React.RefAttributes<CalendarRef<boolean | undefined>>>;
226
+ export { CalendarComponent };