@via-profit/ui-kit 0.1.4 → 0.1.6

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.
@@ -1,28 +1,28 @@
1
- import React from "react";
2
- import { CalendarBodyProps } from "./CalendarBody";
3
- import { CalendarCellProps } from "./CalendarCell";
4
- import { CalendarEmptyCellProps } from "./CalendarEmptyCell";
5
- import { CalendarPaperProps } from "./CalendarPaper";
6
- import { CalendarHeaderProps } from "./CalendarHeader";
7
- import { CalendarWeekRowProps } from "./CalendarWeekRow";
8
- import { CalendarDateContainerProps } from "./CalendarDateContainer";
9
- import { CalendarToolbarProps } from "./CalendarToolbar";
10
- import { CalendarYearsSelectorProps } from "./CalendarYearsSelector";
11
- import { CalendarMonthsSelectorProps } from "./CalendarMonthsSelector";
12
- import { CalendarMonthCellProps } from "./CalendarMonthCell";
13
- import { CalendarYearCellProps } from "./CalendarYearCell";
14
- import { CalendarDayBadgeProps } from "./CalendarDayBadge";
15
- import { CalendarFooterProps } from "./CalendarFooter";
16
- import { CalendarControlButtonProps } from "./CalendarControlButton";
17
- import { CalendarHeadingProps } from "./CalendarHeading";
18
- import { CalendarSubheadingProps } from "./CalendarSubheading";
19
- import { CalendarIconPrevProps } from "./CalendarIconPrev";
20
- import { CalendarIconNextProps } from "./IconChevronRight";
21
- import { CalendarWeekDaysBarProps, WeekNameLabelFormat } from "./CalendarWeekDaysBar";
22
- import { CalendarValue, WeekDayName } from "./use-calendar";
23
- import { CalendarView as CalendarViewName } from "./reducer";
24
- export * from "./use-calendar";
25
- export * from "./CalendarWeekDaysBar";
1
+ import React from 'react';
2
+ import { CalendarBodyProps } from './CalendarBody';
3
+ import { CalendarCellProps } from './CalendarCell';
4
+ import { CalendarEmptyCellProps } from './CalendarEmptyCell';
5
+ import { CalendarPaperProps } from './CalendarPaper';
6
+ import { CalendarHeaderProps } from './CalendarHeader';
7
+ import { CalendarWeekRowProps } from './CalendarWeekRow';
8
+ import { CalendarDateContainerProps } from './CalendarDateContainer';
9
+ import { CalendarToolbarProps } from './CalendarToolbar';
10
+ import { CalendarYearsSelectorProps } from './CalendarYearsSelector';
11
+ import { CalendarMonthsSelectorProps } from './CalendarMonthsSelector';
12
+ import { CalendarMonthCellProps } from './CalendarMonthCell';
13
+ import { CalendarYearCellProps } from './CalendarYearCell';
14
+ import { CalendarDayBadgeProps } from './CalendarDayBadge';
15
+ import { CalendarFooterProps } from './CalendarFooter';
16
+ import { CalendarControlButtonProps } from './CalendarControlButton';
17
+ import { CalendarHeadingProps } from './CalendarHeading';
18
+ import { CalendarSubheadingProps } from './CalendarSubheading';
19
+ import { CalendarIconPrevProps } from './CalendarIconPrev';
20
+ import { CalendarIconNextProps } from './IconChevronRight';
21
+ import { CalendarWeekDaysBarProps, WeekNameLabelFormat } from './CalendarWeekDaysBar';
22
+ import { CalendarValue, WeekDayName } from './use-calendar';
23
+ import { CalendarView as CalendarViewName } from './reducer';
24
+ export * from './use-calendar';
25
+ export * from './CalendarWeekDaysBar';
26
26
  export type CalendarView = CalendarViewName;
27
27
  export type CalendarProps<Range extends boolean | undefined = undefined> = {
28
28
  readonly range?: Range;
@@ -82,7 +82,7 @@ export type CalendarProps<Range extends boolean | undefined = undefined> = {
82
82
  * Cell accent color\
83
83
  * **Default:** `primary`
84
84
  */
85
- readonly accentColor?: "primary" | "secondary" | string;
85
+ readonly accentColor?: 'primary' | 'secondary' | string;
86
86
  /**
87
87
  * Tooltip for the Prev month button
88
88
  */
@@ -214,7 +214,7 @@ export interface CalendarOverrides {
214
214
  export type CalendarBadge = {
215
215
  readonly date: Date;
216
216
  readonly badgeContent: React.ReactNode;
217
- readonly accentColor?: "primary" | "secondary" | string;
217
+ readonly accentColor?: 'primary' | 'secondary' | string;
218
218
  };
219
219
  declare const Calendar: <Range_1 extends boolean | undefined = undefined>(props: CalendarProps<Range_1>) => React.ReactNode;
220
220
  export default Calendar;
package/Calendar/index.js CHANGED
@@ -43,9 +43,9 @@ const reducer_1 = require("./reducer");
43
43
  __exportStar(require("./use-calendar"), exports);
44
44
  __exportStar(require("./CalendarWeekDaysBar"), exports);
45
45
  const Calendar = (props) => {
46
- const { minDate = new Date(new Date().getFullYear() - 100, 0, 1, 0, 0, 0), maxDate = new Date(new Date().getFullYear() + 100, 0, 1, 0, 0, 0), weekStartDay = "monday", locale = "ru-RU", displayLeadingZero = false, onChange, badges = [], value, defaultValue, markToday, weekDayLabelFormat = "short", accentColor = "primary", prevMonthButtonTooltip, nextMonthButtonTooltip, changeMonthButtonTooltip, changeYearButtonTooltip, initialView = (0, reducer_1.createDefaultState)(false).calendarCurrentView, resetButtonLabel, toodayButtonLabel, heading, subheading, footer, overrides, range = false } = props;
47
- if (typeof value !== "undefined" && typeof onChange === "undefined") {
48
- throw new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange`.");
46
+ const { minDate = new Date(new Date().getFullYear() - 100, 0, 1, 0, 0, 0), maxDate = new Date(new Date().getFullYear() + 100, 0, 1, 0, 0, 0), weekStartDay = 'monday', locale = 'ru-RU', displayLeadingZero = false, onChange, badges = [], value, defaultValue, markToday, weekDayLabelFormat = 'short', accentColor = 'primary', prevMonthButtonTooltip, nextMonthButtonTooltip, changeMonthButtonTooltip, changeYearButtonTooltip, initialView = (0, reducer_1.createDefaultState)(false).calendarCurrentView, resetButtonLabel, toodayButtonLabel, heading, subheading, footer, overrides, range = false, } = props;
47
+ if (typeof value !== 'undefined' && typeof onChange === 'undefined') {
48
+ throw new Error('You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange`.');
49
49
  }
50
50
  const overridesMap = react_1.default.useMemo(() => ({
51
51
  Body: (overrides === null || overrides === void 0 ? void 0 : overrides.Body) || CalendarBody_1.default,
@@ -67,48 +67,48 @@ const Calendar = (props) => {
67
67
  Subheading: (overrides === null || overrides === void 0 ? void 0 : overrides.Subheading) || CalendarSubheading_1.default,
68
68
  IconPrev: (overrides === null || overrides === void 0 ? void 0 : overrides.IconPrev) || CalendarIconPrev_1.default,
69
69
  IconNext: (overrides === null || overrides === void 0 ? void 0 : overrides.IconNext) || IconChevronRight_1.default,
70
- WeekDaysBar: (overrides === null || overrides === void 0 ? void 0 : overrides.WeekDaysBar) || CalendarWeekDaysBar_1.default
70
+ WeekDaysBar: (overrides === null || overrides === void 0 ? void 0 : overrides.WeekDaysBar) || CalendarWeekDaysBar_1.default,
71
71
  }), [overrides]);
72
- const realValue = react_1.default.useMemo(() => typeof value !== "undefined"
72
+ const realValue = react_1.default.useMemo(() => typeof value !== 'undefined'
73
73
  ? value
74
- : typeof defaultValue !== "undefined"
74
+ : typeof defaultValue !== 'undefined'
75
75
  ? defaultValue
76
76
  : new Date(), [value, defaultValue]);
77
77
  const initialProps = react_1.default.useRef({
78
78
  value: realValue,
79
79
  badges,
80
- initialView
80
+ initialView,
81
81
  });
82
82
  const initialState = Object.assign(Object.assign({}, (0, reducer_1.createDefaultState)(range)), { calendarValue: realValue, calendarDate: Array.isArray(realValue) ? realValue[0] : realValue, calendarCurrentView: initialView });
83
83
  const [state, dispatch] = react_1.default.useReducer(reducer_1.reducer, initialState);
84
- const { isSameDay, getWeeks, getDayLabel, getMonthLabel, getYearLabel, getYearsRange, getMonthsRange } = (0, use_calendar_1.useCalendar)({
84
+ const { isSameDay, getWeeks, getDayLabel, getMonthLabel, getYearLabel, getYearsRange, getMonthsRange, } = (0, use_calendar_1.useCalendar)({
85
85
  minDate,
86
86
  maxDate,
87
87
  weekStartDay,
88
88
  locale,
89
- displayLeadingZero
89
+ displayLeadingZero,
90
90
  });
91
91
  const { calendarCurrentView, calendarViewVariants, calendarValue, calendarDate } = state;
92
92
  /**
93
93
  * Prev and next month buttons
94
94
  */
95
95
  const handleChangeMonthClick = react_1.default.useCallback((type) => () => {
96
- const newDate = type === "prev"
96
+ const newDate = type === 'prev'
97
97
  ? new Date(calendarDate.getFullYear(), calendarDate.getMonth() - 1, 1)
98
98
  : new Date(calendarDate.getFullYear(), calendarDate.getMonth() + 1, 1);
99
- dispatch({ type: "setPartial", payload: { calendarDate: newDate } });
99
+ dispatch({ type: 'setPartial', payload: { calendarDate: newDate } });
100
100
  }, [calendarDate]);
101
101
  /**
102
102
  * Date props was changed
103
103
  */
104
104
  react_1.default.useEffect(() => {
105
- if (typeof value !== "undefined") {
105
+ if (typeof value !== 'undefined') {
106
106
  dispatch({
107
- type: "setPartial",
107
+ type: 'setPartial',
108
108
  payload: {
109
- calendarValue: value
109
+ calendarValue: value,
110
110
  // calendarDate: Array.isArray(value) ? value[0] : value,
111
- }
111
+ },
112
112
  });
113
113
  }
114
114
  }, [value, calendarValue, isSameDay, dispatch]);
@@ -116,12 +116,12 @@ const Calendar = (props) => {
116
116
  * Handle click on Day button
117
117
  */
118
118
  const handleCellDateClick = react_1.default.useCallback((selectedDate) => () => {
119
- if (typeof onChange === "function") {
119
+ if (typeof onChange === 'function') {
120
120
  if (range) {
121
121
  const [fromDate, toDate] = calendarValue;
122
122
  dispatch({
123
- type: "setPartial",
124
- payload: { calendarDate: selectedDate }
123
+ type: 'setPartial',
124
+ payload: { calendarDate: selectedDate },
125
125
  });
126
126
  if (selectedDate.getTime() >= toDate.getTime()) {
127
127
  onChange([fromDate, selectedDate]);
@@ -145,7 +145,7 @@ const Calendar = (props) => {
145
145
  return;
146
146
  }
147
147
  }
148
- throw new Error("Oooops. I don`t know whats is it");
148
+ throw new Error('Oooops. I don`t know whats is it');
149
149
  }
150
150
  else {
151
151
  onChange(selectedDate);
@@ -153,10 +153,10 @@ const Calendar = (props) => {
153
153
  }
154
154
  if (!calendarValue) {
155
155
  dispatch({
156
- type: "setPartial",
156
+ type: 'setPartial',
157
157
  payload: {
158
- calendarValue: selectedDate
159
- }
158
+ calendarValue: selectedDate,
159
+ },
160
160
  });
161
161
  }
162
162
  }, [onChange, calendarValue, range]);
@@ -173,11 +173,11 @@ const Calendar = (props) => {
173
173
  newDate.setMilliseconds(0);
174
174
  if (calendarDate.getFullYear() !== newDate.getFullYear()) {
175
175
  dispatch({
176
- type: "setPartial",
176
+ type: 'setPartial',
177
177
  payload: {
178
178
  calendarDate: newDate,
179
- calendarCurrentView: "days"
180
- }
179
+ calendarCurrentView: 'days',
180
+ },
181
181
  });
182
182
  }
183
183
  }, [calendarDate]);
@@ -193,11 +193,11 @@ const Calendar = (props) => {
193
193
  newDate.setMilliseconds(0);
194
194
  if (calendarDate.getMonth() !== newDate.getMonth()) {
195
195
  dispatch({
196
- type: "setPartial",
196
+ type: 'setPartial',
197
197
  payload: {
198
198
  calendarDate: newDate,
199
- calendarCurrentView: "days"
200
- }
199
+ calendarCurrentView: 'days',
200
+ },
201
201
  });
202
202
  }
203
203
  }, [calendarDate]);
@@ -206,10 +206,10 @@ const Calendar = (props) => {
206
206
  */
207
207
  const handleChangeView = react_1.default.useCallback((selectedView) => () => {
208
208
  dispatch({
209
- type: "setPartial",
209
+ type: 'setPartial',
210
210
  payload: {
211
- calendarCurrentView: selectedView
212
- }
211
+ calendarCurrentView: selectedView,
212
+ },
213
213
  });
214
214
  }, []);
215
215
  /**
@@ -217,14 +217,14 @@ const Calendar = (props) => {
217
217
  */
218
218
  const handleReset = react_1.default.useCallback(() => {
219
219
  dispatch({
220
- type: "setPartial",
220
+ type: 'setPartial',
221
221
  payload: {
222
222
  calendarCurrentView: initialProps.current.initialView,
223
223
  calendarDate: initialProps.current.value,
224
- calendarValue: initialProps.current.value
225
- }
224
+ calendarValue: initialProps.current.value,
225
+ },
226
226
  });
227
- if (typeof onChange === "function") {
227
+ if (typeof onChange === 'function') {
228
228
  onChange(initialProps.current.value);
229
229
  }
230
230
  }, [onChange]);
@@ -238,39 +238,41 @@ const Calendar = (props) => {
238
238
  today.setSeconds(0);
239
239
  today.setMilliseconds(0);
240
240
  dispatch({
241
- type: "setPartial",
241
+ type: 'setPartial',
242
242
  payload: {
243
- calendarDate: today
244
- }
243
+ calendarDate: today,
244
+ },
245
245
  });
246
246
  }, []);
247
247
  return (react_1.default.createElement(overridesMap.Paper, null,
248
248
  react_1.default.createElement(overridesMap.Header, null,
249
- typeof heading !== "undefined" && react_1.default.createElement(overridesMap.Heading, null, heading),
250
- typeof subheading !== "undefined" && (react_1.default.createElement(overridesMap.Subheading, null, subheading)),
249
+ typeof heading !== 'undefined' && react_1.default.createElement(overridesMap.Heading, null, heading),
250
+ typeof subheading !== 'undefined' && (react_1.default.createElement(overridesMap.Subheading, null, subheading)),
251
251
  react_1.default.createElement(overridesMap.Toolbar, null,
252
- react_1.default.createElement(overridesMap.ControlButton, { iconOnly: true, onClick: handleChangeMonthClick("prev"), title: prevMonthButtonTooltip, disabled: calendarCurrentView !== "days" },
252
+ react_1.default.createElement(overridesMap.ControlButton, { iconOnly: true, onClick: handleChangeMonthClick('prev'), title: prevMonthButtonTooltip, disabled: calendarCurrentView !== 'days' },
253
253
  react_1.default.createElement(overridesMap.IconPrev, null)),
254
- react_1.default.createElement(overridesMap.ControlButton, { title: changeMonthButtonTooltip, isActive: calendarCurrentView === "months", disabled: !calendarViewVariants.includes("months"), onClick: handleChangeView(calendarCurrentView === "months" ? "days" : "months") }, getMonthLabel(calendarDate)),
255
- react_1.default.createElement(overridesMap.ControlButton, { isActive: calendarCurrentView === "years", disabled: !calendarViewVariants.includes("years"), title: changeYearButtonTooltip, onClick: handleChangeView(calendarCurrentView === "years" ? "days" : "years") }, getYearLabel(calendarDate)),
256
- react_1.default.createElement(overridesMap.ControlButton, { iconOnly: true, onClick: handleChangeMonthClick("next"), title: nextMonthButtonTooltip, disabled: calendarCurrentView !== "days" },
254
+ react_1.default.createElement(overridesMap.ControlButton, { title: changeMonthButtonTooltip, isActive: calendarCurrentView === 'months', disabled: !calendarViewVariants.includes('months'), onClick: handleChangeView(calendarCurrentView === 'months' ? 'days' : 'months') }, getMonthLabel(calendarDate)),
255
+ react_1.default.createElement(overridesMap.ControlButton, { isActive: calendarCurrentView === 'years', disabled: !calendarViewVariants.includes('years'), title: changeYearButtonTooltip, onClick: handleChangeView(calendarCurrentView === 'years' ? 'days' : 'years') }, getYearLabel(calendarDate)),
256
+ react_1.default.createElement(overridesMap.ControlButton, { iconOnly: true, onClick: handleChangeMonthClick('next'), title: nextMonthButtonTooltip, disabled: calendarCurrentView !== 'days' },
257
257
  react_1.default.createElement(overridesMap.IconNext, null)))),
258
- react_1.default.createElement(overridesMap.WeekDaysBar, { locale: locale, week: getWeeks(calendarDate)[0], format: weekDayLabelFormat || "short" }),
258
+ react_1.default.createElement(overridesMap.WeekDaysBar, { locale: locale, week: getWeeks(calendarDate)[0], format: weekDayLabelFormat || 'short' }),
259
259
  react_1.default.createElement(overridesMap.Body, null,
260
- calendarCurrentView === "years" && (react_1.default.createElement(overridesMap.YearsSelector, null, getYearsRange(minDate, maxDate).map(year => {
260
+ calendarCurrentView === 'years' && (react_1.default.createElement(overridesMap.YearsSelector, null, getYearsRange(minDate, maxDate).map(year => {
261
261
  const a = Array.isArray(calendarValue) ? calendarValue : [calendarValue];
262
262
  const isSelected = a.find(d => d.getFullYear() === year) !== undefined;
263
263
  return (react_1.default.createElement(overridesMap.YearCell, { key: year, accentColor: accentColor, isSelected: isSelected, onClick: handleYearSelected(year) }, getYearLabel(new Date(year, calendarDate.getMonth(), calendarDate.getDate(), 0, 0, 0, 0))));
264
264
  }))),
265
- calendarCurrentView === "months" && (react_1.default.createElement(overridesMap.MonthsSelector, null, getMonthsRange(minDate, maxDate).map(monthIndex => {
265
+ calendarCurrentView === 'months' && (react_1.default.createElement(overridesMap.MonthsSelector, null, getMonthsRange(minDate, maxDate).map(monthIndex => {
266
266
  const a = Array.isArray(calendarValue) ? calendarValue : [calendarValue];
267
267
  const isSelected = a.find(d => d.getMonth() === monthIndex) !== undefined;
268
268
  return (react_1.default.createElement(overridesMap.MonthCell, { key: monthIndex, accentColor: accentColor, isSelected: isSelected, onClick: handleMonthSelected(monthIndex) }, getMonthLabel(new Date(calendarDate.getFullYear(), monthIndex, 1, 0, 0, 0, 0))));
269
269
  }))),
270
- calendarCurrentView === "days" && (react_1.default.createElement(overridesMap.DateContainer, null, getWeeks(calendarDate).map(week => (react_1.default.createElement(overridesMap.WeekRow, { key: week.weekNumber.toString() }, week.days.map(day => {
270
+ calendarCurrentView === 'days' && (react_1.default.createElement(overridesMap.DateContainer, null, getWeeks(calendarDate).map(week => (react_1.default.createElement(overridesMap.WeekRow, { key: week.weekNumber.toString() }, week.days.map(day => {
271
271
  if (day.date.getMonth() === calendarDate.getMonth()) {
272
272
  const badge = badges.find(b => isSameDay(b.date, day.date));
273
- const a = Array.isArray(calendarValue) ? calendarValue : [calendarValue, calendarValue];
273
+ const a = Array.isArray(calendarValue)
274
+ ? calendarValue
275
+ : [calendarValue, calendarValue];
274
276
  const isSelected = isSameDay(a[0], day.date) || isSameDay(a[1], day.date);
275
277
  const fill = Array.isArray(calendarValue)
276
278
  ? day.date.getTime() > calendarValue[0].getTime() &&
@@ -278,15 +280,15 @@ const Calendar = (props) => {
278
280
  : false;
279
281
  return (react_1.default.createElement(overridesMap.Cell, { key: day.date.getTime(), isToday: markToday && day.isToday, isDisabled: day.isDisabled, accentColor: accentColor, isSelected: isSelected, onClick: handleCellDateClick(day.date), fill: fill },
280
282
  getDayLabel(day.date),
281
- typeof badge !== "undefined" && (react_1.default.createElement(overridesMap.DayBadge, { badgeContent: badge.badgeContent, isToday: day.isToday, accentColor: badge.accentColor }))));
283
+ typeof badge !== 'undefined' && (react_1.default.createElement(overridesMap.DayBadge, { badgeContent: badge.badgeContent, isToday: day.isToday, accentColor: badge.accentColor }))));
282
284
  }
283
285
  return react_1.default.createElement(overridesMap.EmptyCell, { key: day.date.getTime() });
284
286
  }))))))),
285
- (typeof resetButtonLabel !== "undefined" ||
286
- typeof toodayButtonLabel !== "undefined" ||
287
- typeof footer !== "undefined") && (react_1.default.createElement(overridesMap.Footer, null,
288
- typeof footer !== "undefined" && react_1.default.createElement(react_1.default.Fragment, null, footer),
289
- typeof toodayButtonLabel !== "undefined" && (react_1.default.createElement(overridesMap.ControlButton, { onClick: handleToday }, toodayButtonLabel)),
290
- typeof resetButtonLabel !== "undefined" && (react_1.default.createElement(overridesMap.ControlButton, { onClick: handleReset }, resetButtonLabel))))));
287
+ (typeof resetButtonLabel !== 'undefined' ||
288
+ typeof toodayButtonLabel !== 'undefined' ||
289
+ typeof footer !== 'undefined') && (react_1.default.createElement(overridesMap.Footer, null,
290
+ typeof footer !== 'undefined' && react_1.default.createElement(react_1.default.Fragment, null, footer),
291
+ typeof toodayButtonLabel !== 'undefined' && (react_1.default.createElement(overridesMap.ControlButton, { onClick: handleToday }, toodayButtonLabel)),
292
+ typeof resetButtonLabel !== 'undefined' && (react_1.default.createElement(overridesMap.ControlButton, { onClick: handleReset }, resetButtonLabel))))));
291
293
  };
292
294
  exports.default = Calendar;
@@ -113,7 +113,7 @@ const ModalWrapper = props => {
113
113
  if (alreadyMounted) {
114
114
  dispatch((0, context_1.actionSetState)({ isOpen: true }));
115
115
  }
116
- }, 15);
116
+ }, 120);
117
117
  return;
118
118
  }
119
119
  /**
@@ -1,4 +1,21 @@
1
1
  import React from 'react';
2
- export type DrawerContainerProps = React.HTMLAttributes<HTMLDivElement>;
3
- declare const _default: React.ForwardRefExoticComponent<DrawerContainerProps & React.RefAttributes<HTMLDivElement>>;
2
+ import { AnchorVariant } from './DrawerInner';
3
+ export type DrawerContainerProps = React.HTMLAttributes<HTMLDivElement> & {
4
+ /**
5
+ * Drawer position\
6
+ * \
7
+ * **Varians:** `bottom` `right` `left` `top`\
8
+ * **Default:** `bottom`
9
+ */
10
+ readonly anchor: AnchorVariant;
11
+ };
12
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
13
+ /**
14
+ * Drawer position\
15
+ * \
16
+ * **Varians:** `bottom` `right` `left` `top`\
17
+ * **Default:** `bottom`
18
+ */
19
+ readonly anchor: AnchorVariant;
20
+ } & React.RefAttributes<HTMLDivElement>>;
4
21
  export default _default;
@@ -1,4 +1,21 @@
1
1
  import React from 'react';
2
- export type DrawerContentProps = React.HTMLAttributes<HTMLDivElement>;
3
- declare const _default: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
2
+ import type { AnchorVariant } from './DrawerInner';
3
+ export type DrawerContentProps = React.HTMLAttributes<HTMLDivElement> & {
4
+ /**
5
+ * Drawer position\
6
+ * \
7
+ * **Varians:** `bottom` `right` `left` `top`\
8
+ * **Default:** `bottom`
9
+ */
10
+ readonly anchor: AnchorVariant;
11
+ };
12
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
13
+ /**
14
+ * Drawer position\
15
+ * \
16
+ * **Varians:** `bottom` `right` `left` `top`\
17
+ * **Default:** `bottom`
18
+ */
19
+ readonly anchor: AnchorVariant;
20
+ } & React.RefAttributes<HTMLDivElement>>;
4
21
  export default _default;
@@ -1,4 +1,21 @@
1
1
  import React from 'react';
2
- export type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;
3
- declare const _default: React.ForwardRefExoticComponent<DrawerFooterProps & React.RefAttributes<HTMLDivElement>>;
2
+ import { AnchorVariant } from './DrawerInner';
3
+ export type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement> & {
4
+ /**
5
+ * Drawer position\
6
+ * \
7
+ * **Varians:** `bottom` `right` `left` `top`\
8
+ * **Default:** `bottom`
9
+ */
10
+ readonly anchor: AnchorVariant;
11
+ };
12
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
13
+ /**
14
+ * Drawer position\
15
+ * \
16
+ * **Varians:** `bottom` `right` `left` `top`\
17
+ * **Default:** `bottom`
18
+ */
19
+ readonly anchor: AnchorVariant;
20
+ } & React.RefAttributes<HTMLDivElement>>;
4
21
  export default _default;
@@ -67,9 +67,9 @@ const Drawer = props => {
67
67
  return (React.createElement(DrawerInner_1.default, Object.assign({ anchor: anchor, dialogID: dialogID, ref: ref }, props), children));
68
68
  }),
69
69
  } }),
70
- React.createElement(overridesMap.Container, null,
70
+ React.createElement(overridesMap.Container, { anchor: anchor },
71
71
  hasHeader && (React.createElement(overridesMap.Header, { showCloseButton: showCloseButton, header: header, onRequestClose: onRequestClose }, toolbar)),
72
- React.createElement(overridesMap.Content, null, children),
73
- hasFooter && React.createElement(overridesMap.Footer, null, footer)))));
72
+ React.createElement(overridesMap.Content, { anchor: anchor }, children),
73
+ hasFooter && React.createElement(overridesMap.Footer, { anchor: anchor }, footer)))));
74
74
  };
75
75
  exports.default = Drawer;
@@ -1,8 +1,12 @@
1
1
  import React from 'react';
2
2
  export type SurfaceContainerProps = React.HTMLAttributes<HTMLDivElement> & {
3
3
  readonly inline?: boolean;
4
+ readonly rounded?: boolean;
5
+ readonly noPadding?: boolean;
4
6
  };
5
7
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
8
  readonly inline?: boolean | undefined;
9
+ readonly rounded?: boolean | undefined;
10
+ readonly noPadding?: boolean | undefined;
7
11
  } & React.RefAttributes<HTMLDivElement>>;
8
12
  export default _default;
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
- export type SurfaceHeaderProps = React.HTMLAttributes<HTMLDivElement>;
3
- declare const _default: React.ForwardRefExoticComponent<SurfaceHeaderProps & React.RefAttributes<HTMLDivElement>>;
2
+ export type SurfaceHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
3
+ readonly noPadding?: boolean;
4
+ };
5
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
+ readonly noPadding?: boolean | undefined;
7
+ } & React.RefAttributes<HTMLDivElement>>;
4
8
  export default _default;
@@ -17,14 +17,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const react_1 = __importDefault(require("react"));
18
18
  const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const StyledHeader = styled_1.default.div `
20
- padding: 1rem 1rem 0 1rem;
20
+ padding: ${({ $noPadding }) => ($noPadding ? '0' : '1rem 1rem 0 1rem')};
21
21
  font-size: 1.3rem;
22
22
  font-weight: 600;
23
23
  border-top-left-radius: inherit;
24
24
  border-top-right-radius: inherit;
25
25
  `;
26
26
  const SurfaceHeader = (props, ref) => {
27
- const { children } = props, nativeProps = __rest(props, ["children"]);
28
- return (react_1.default.createElement(StyledHeader, Object.assign({}, nativeProps, { ref: ref }), children));
27
+ const { children, noPadding } = props, nativeProps = __rest(props, ["children", "noPadding"]);
28
+ return (react_1.default.createElement(StyledHeader, Object.assign({ "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
29
29
  };
30
30
  exports.default = react_1.default.forwardRef(SurfaceHeader);
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
- export type SurfaceSubheaderProps = React.HTMLAttributes<HTMLDivElement>;
3
- declare const _default: React.ForwardRefExoticComponent<SurfaceSubheaderProps & React.RefAttributes<HTMLDivElement>>;
2
+ export type SurfaceSubheaderProps = React.HTMLAttributes<HTMLDivElement> & {
3
+ readonly noPadding?: boolean;
4
+ };
5
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
+ readonly noPadding?: boolean | undefined;
7
+ } & React.RefAttributes<HTMLDivElement>>;
4
8
  export default _default;
@@ -17,13 +17,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const react_1 = __importDefault(require("react"));
18
18
  const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const StyledHeader = styled_1.default.div `
20
- padding: 0.5em 1rem 0 1rem;
20
+ padding: ${({ $noPadding }) => ($noPadding ? '0' : '0.5em 1rem 0 1rem')};
21
21
  font-size: 0.9rem;
22
22
  font-weight: 200;
23
23
  color: ${({ theme }) => theme.color.textSecondary.toString()};
24
24
  `;
25
25
  const SurfaceSubheader = (props, ref) => {
26
- const { children } = props, nativeProps = __rest(props, ["children"]);
27
- return (react_1.default.createElement(StyledHeader, Object.assign({}, nativeProps, { ref: ref }), children));
26
+ const { children, noPadding } = props, nativeProps = __rest(props, ["children", "noPadding"]);
27
+ return (react_1.default.createElement(StyledHeader, Object.assign({ "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
28
28
  };
29
29
  exports.default = react_1.default.forwardRef(SurfaceSubheader);
@@ -22,6 +22,14 @@ export type SurfaceProps = React.HTMLAttributes<HTMLDivElement> & {
22
22
  * If true then surface will be inline-flex element, and the flex otherwise
23
23
  */
24
24
  readonly inline?: boolean;
25
+ /**
26
+ * The surface will be rounded
27
+ */
28
+ readonly rounded?: boolean;
29
+ /**
30
+ * If true then surface does not contin any paddings
31
+ */
32
+ readonly noPadding?: boolean;
25
33
  /**
26
34
  * Overridable components map
27
35
  */
@@ -67,6 +75,14 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
67
75
  * If true then surface will be inline-flex element, and the flex otherwise
68
76
  */
69
77
  readonly inline?: boolean | undefined;
78
+ /**
79
+ * The surface will be rounded
80
+ */
81
+ readonly rounded?: boolean | undefined;
82
+ /**
83
+ * If true then surface does not contin any paddings
84
+ */
85
+ readonly noPadding?: boolean | undefined;
70
86
  /**
71
87
  * Overridable components map
72
88
  */
package/Surface/index.js CHANGED
@@ -44,7 +44,7 @@ const SurfaceSubheader_1 = __importDefault(require("./SurfaceSubheader"));
44
44
  const SurfaceContent_1 = __importDefault(require("./SurfaceContent"));
45
45
  const SurfaceFooter_1 = __importDefault(require("./SurfaceFooter"));
46
46
  const Surface = (props, ref) => {
47
- const { children, header, subheader, footer, inline, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "footer", "inline", "overrides"]);
47
+ const { children, header, subheader, footer, inline, noPadding, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "footer", "inline", "noPadding", "overrides"]);
48
48
  const hasFooter = typeof footer !== 'undefined' && footer !== null;
49
49
  const hasHeader = typeof header !== 'undefined' && header !== null;
50
50
  const hasSubheader = typeof subheader !== 'undefined' && subheader !== null;
@@ -58,10 +58,10 @@ const Surface = (props, ref) => {
58
58
  if (!hasHeader && hasSubheader) {
59
59
  console.warn(`[@via-profit/ui-kit] Surface component. If you use a subheader, then you should add a header`);
60
60
  }
61
- return (React.createElement(overridesMap.Container, Object.assign({}, nativeProps, { inline: inline, ref: ref }),
62
- hasHeader && React.createElement(overridesMap.Header, null, header),
63
- hasSubheader && React.createElement(overridesMap.Subheader, null, subheader),
64
- React.createElement(overridesMap.Content, null, children),
65
- hasFooter && React.createElement(overridesMap.Footer, null, footer)));
61
+ return (React.createElement(overridesMap.Container, Object.assign({}, nativeProps, { inline: inline, noPadding: noPadding, ref: ref }),
62
+ hasHeader && React.createElement(overridesMap.Header, { noPadding: noPadding }, header),
63
+ hasSubheader && (React.createElement(overridesMap.Subheader, { noPadding: noPadding }, subheader)),
64
+ React.createElement(overridesMap.Content, { noPadding: noPadding }, children),
65
+ hasFooter && React.createElement(overridesMap.Footer, { noPadding: noPadding }, footer)));
66
66
  };
67
67
  exports.default = React.forwardRef(Surface);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@via-profit/ui-kit",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "UI Kit",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,10 +22,10 @@
22
22
  "access": "public"
23
23
  },
24
24
  "peerDependencies": {
25
- "@emotion/react": "^11.10.6",
26
- "@emotion/styled": "^11.10.6",
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0"
25
+ "@emotion/react": ">=11.10.6",
26
+ "@emotion/styled": ">=11.10.6",
27
+ "react": ">=18.2.0",
28
+ "react-dom": ">=18.2.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/cli": "^7.23.4",