colibri-ui 0.8.84 → 0.8.87
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/Accordion.module.css +4 -0
- package/Accordion/index.js +15 -23
- package/Autocomplete/Autocomplete.js +101 -132
- package/Avatar/Avatar.module.css +6 -0
- package/Avatar/index.js +102 -89
- package/Badge/Badge.module.css +2 -1
- package/Badge/Control/index.js +5 -3
- package/Badge/index.js +16 -16
- package/Button/index.js +23 -20
- package/Button/tokens.js +2 -2
- package/Calendar/Calendar.js +171 -269
- package/Card/Card.js +26 -32
- package/Checkbox/index.js +46 -43
- package/Chip/Chip.module.css +2 -1
- package/Chip/index.js +15 -15
- package/ClickOutside/index.js +10 -13
- package/CodeField/CodeField.js +113 -170
- package/Counter/Counter.module.css +2 -1
- package/Counter/index.js +21 -20
- package/Datepicker/components/DatePicker/index.js +81 -102
- package/Datepicker/index.js +17 -16
- package/DotsLoader/index.js +23 -15
- package/Drawer/Drawer.js +84 -98
- package/Drawer/Drawer.module.css +2 -1
- package/Drawer/index.props.d.ts +2 -0
- package/Dropdown/index.js +55 -68
- package/Dropzone/Dropzone.js +78 -168
- package/Dropzone/Dropzone.module.css +2 -1
- package/Editable/Editable.js +44 -57
- package/Grid/Item/index.js +11 -13
- package/Grid/index.js +15 -21
- package/Icons/ArrowNext.js +7 -8
- package/Icons/Cart.js +7 -8
- package/Icons/Check.js +7 -8
- package/Icons/Chevron.js +7 -8
- package/Icons/Close.js +6 -6
- package/Icons/Copy.js +7 -8
- package/Icons/Cross.js +6 -6
- package/Icons/CrossFill.js +7 -8
- package/Icons/Edit.js +7 -8
- package/Icons/Exit.js +7 -8
- package/Icons/EyeClosed.js +7 -8
- package/Icons/EyeOpen.js +7 -8
- package/Icons/Help.js +6 -6
- package/Icons/Info.js +7 -8
- package/Icons/Minus.js +7 -8
- package/Icons/More.js +7 -8
- package/Icons/Plus.js +7 -8
- package/Icons/Setting.js +7 -8
- package/Icons/Shield.js +7 -8
- package/Icons/Trash.js +7 -8
- package/Icons/User.js +7 -8
- package/Image/Image.module.css +4 -0
- package/Image/index.d.ts +1 -1
- package/Image/index.js +44 -37
- package/Input/index.d.ts +1 -1
- package/Input/index.js +37 -25
- package/Input/index.props.d.ts +1 -1
- package/InputRadio/index.js +32 -24
- package/List/List.js +81 -76
- package/Menu/Menu.module.css +2 -1
- package/Menu/components/MenuItem/index.js +17 -14
- package/Menu/index.js +22 -23
- package/Modal/components/Body/index.js +9 -8
- package/Modal/components/Close/Close.module.css +4 -0
- package/Modal/components/Close/index.js +13 -14
- package/Modal/components/Content/index.js +5 -6
- package/Modal/components/Footer/index.js +5 -3
- package/Modal/components/Header/index.js +13 -12
- package/Modal/components/Title/index.js +10 -9
- package/Modal/context.js +3 -3
- package/Modal/index.js +46 -68
- package/MultiSelect/components/MenuOverlay/index.js +48 -61
- package/MultiSelect/components/MenuOverlayItem/index.js +13 -14
- package/MultiSelect/index.js +72 -100
- package/MultiSelect/index.module.css +2 -1
- package/MultiSelect/utils/index.js +8 -18
- package/NumberInput/NumberInput.js +80 -112
- package/Portal/index.js +6 -10
- package/Progress/Progress.js +45 -58
- package/RadioGroup/Radio.js +29 -32
- package/RadioGroup/index.js +43 -46
- package/Rating/Rating.js +50 -63
- package/Select/components/MenuOverlay/index.js +16 -25
- package/Select/components/MenuOverlayItem/index.js +13 -11
- package/Select/index.js +39 -48
- package/Select/index.module.css +2 -1
- package/Separator/index.js +5 -6
- package/Sheet/Sheet.js +98 -122
- package/Sheet/Sheet.module.css +4 -2
- package/Sheet/index.props.d.ts +2 -0
- package/Skeleton/index.js +25 -30
- package/Slider/Slider.js +83 -119
- package/Status/index.js +17 -18
- package/Switch/Switch.module.css +2 -1
- package/Switch/index.js +22 -15
- package/TabsMenu/Tab/Tab.js +14 -10
- package/TabsMenu/Tab/Tab.module.css +2 -1
- package/TabsMenu/index.js +25 -26
- package/TabsPanels/Panel/index.js +6 -4
- package/TabsPanels/index.js +13 -10
- package/TextArea/index.d.ts +1 -1
- package/TextArea/index.js +30 -19
- package/Theme/breakpoints.js +5 -11
- package/Theme/colors/theme_buenos_aires.js +14 -14
- package/Theme/colors/theme_jaipur.js +14 -14
- package/Theme/global.css +0 -1
- package/Theme/index.js +1 -1
- package/TimeSelect/Label/index.js +11 -13
- package/TimeSelect/helpers.js +23 -42
- package/TimeSelect/index.js +32 -38
- package/Tooltip/index.js +36 -42
- package/Typography/Typography.module.css +1365 -0
- package/Typography/index.js +24 -13
- package/Typography/index.props.d.ts +13 -1
- package/base/BaseInput/index.js +10 -8
- package/base/FormField/index.d.ts +1 -1
- package/base/FormField/index.js +27 -22
- package/base/FormField/index.props.d.ts +4 -0
- package/base/InputRoot/index.js +27 -27
- package/esm/Accordion/Accordion.module.css +4 -0
- package/esm/Accordion/index.js +15 -21
- package/esm/Autocomplete/Autocomplete.js +101 -130
- package/esm/Avatar/Avatar.module.css +6 -0
- package/esm/Avatar/index.js +102 -88
- package/esm/Badge/Badge.module.css +2 -1
- package/esm/Badge/Control/index.js +5 -3
- package/esm/Badge/index.js +16 -15
- package/esm/Button/index.js +23 -19
- package/esm/Button/tokens.js +2 -2
- package/esm/Calendar/Calendar.js +171 -267
- package/esm/Card/Card.js +26 -32
- package/esm/Checkbox/index.js +46 -42
- package/esm/Chip/Chip.module.css +2 -1
- package/esm/Chip/index.js +15 -14
- package/esm/ClickOutside/index.js +10 -13
- package/esm/CodeField/CodeField.js +113 -169
- package/esm/Counter/Counter.module.css +2 -1
- package/esm/Counter/index.js +21 -19
- package/esm/Datepicker/components/DatePicker/index.js +81 -101
- package/esm/Datepicker/index.js +17 -16
- package/esm/DotsLoader/index.js +23 -14
- package/esm/Drawer/Drawer.js +84 -97
- package/esm/Drawer/Drawer.module.css +2 -1
- package/esm/Drawer/index.props.d.ts +2 -0
- package/esm/Dropdown/index.js +55 -66
- package/esm/Dropzone/Dropzone.js +78 -165
- package/esm/Dropzone/Dropzone.module.css +2 -1
- package/esm/Editable/Editable.js +44 -56
- package/esm/Grid/Item/index.js +11 -12
- package/esm/Grid/index.js +15 -21
- package/esm/Icons/ArrowNext.js +7 -8
- package/esm/Icons/Cart.js +7 -8
- package/esm/Icons/Check.js +7 -8
- package/esm/Icons/Chevron.js +7 -8
- package/esm/Icons/Close.js +6 -6
- package/esm/Icons/Copy.js +7 -8
- package/esm/Icons/Cross.js +6 -6
- package/esm/Icons/CrossFill.js +7 -8
- package/esm/Icons/Edit.js +7 -8
- package/esm/Icons/Exit.js +7 -8
- package/esm/Icons/EyeClosed.js +7 -8
- package/esm/Icons/EyeOpen.js +7 -8
- package/esm/Icons/Help.js +6 -6
- package/esm/Icons/Info.js +7 -8
- package/esm/Icons/Minus.js +7 -8
- package/esm/Icons/More.js +7 -8
- package/esm/Icons/Plus.js +7 -8
- package/esm/Icons/Setting.js +7 -8
- package/esm/Icons/Shield.js +7 -8
- package/esm/Icons/Trash.js +7 -8
- package/esm/Icons/User.js +7 -8
- package/esm/Image/Image.module.css +4 -0
- package/esm/Image/index.d.ts +1 -1
- package/esm/Image/index.js +44 -36
- package/esm/Input/index.d.ts +1 -1
- package/esm/Input/index.js +38 -26
- package/esm/Input/index.props.d.ts +1 -1
- package/esm/InputRadio/index.js +32 -23
- package/esm/List/List.js +81 -75
- package/esm/Menu/Menu.module.css +2 -1
- package/esm/Menu/components/MenuItem/index.js +17 -13
- package/esm/Menu/index.js +22 -23
- package/esm/Modal/components/Body/index.js +9 -7
- package/esm/Modal/components/Close/Close.module.css +4 -0
- package/esm/Modal/components/Close/index.js +13 -14
- package/esm/Modal/components/Content/index.js +5 -6
- package/esm/Modal/components/Footer/index.js +5 -3
- package/esm/Modal/components/Header/index.js +13 -11
- package/esm/Modal/components/Title/index.js +10 -9
- package/esm/Modal/context.js +3 -3
- package/esm/Modal/index.js +50 -70
- package/esm/MultiSelect/components/MenuOverlay/index.js +48 -60
- package/esm/MultiSelect/components/MenuOverlayItem/index.js +13 -14
- package/esm/MultiSelect/index.js +72 -97
- package/esm/MultiSelect/index.module.css +2 -1
- package/esm/MultiSelect/utils/index.js +8 -14
- package/esm/NumberInput/NumberInput.js +80 -111
- package/esm/Portal/index.js +6 -9
- package/esm/Progress/Progress.js +45 -58
- package/esm/RadioGroup/Radio.js +29 -32
- package/esm/RadioGroup/index.js +43 -45
- package/esm/Rating/Rating.js +50 -63
- package/esm/Select/components/MenuOverlay/index.js +16 -24
- package/esm/Select/components/MenuOverlayItem/index.js +13 -11
- package/esm/Select/index.js +39 -46
- package/esm/Select/index.module.css +2 -1
- package/esm/Separator/index.js +5 -6
- package/esm/Sheet/Sheet.js +98 -120
- package/esm/Sheet/Sheet.module.css +4 -2
- package/esm/Sheet/index.props.d.ts +2 -0
- package/esm/Skeleton/index.js +25 -30
- package/esm/Slider/Slider.js +83 -119
- package/esm/Status/index.js +17 -17
- package/esm/Switch/Switch.module.css +2 -1
- package/esm/Switch/index.js +22 -14
- package/esm/TabsMenu/Tab/Tab.js +14 -9
- package/esm/TabsMenu/Tab/Tab.module.css +2 -1
- package/esm/TabsMenu/index.js +25 -26
- package/esm/TabsPanels/Panel/index.js +6 -4
- package/esm/TabsPanels/index.js +13 -10
- package/esm/TextArea/index.d.ts +1 -1
- package/esm/TextArea/index.js +31 -20
- package/esm/Theme/breakpoints.js +5 -11
- package/esm/Theme/colors/theme_buenos_aires.js +14 -14
- package/esm/Theme/colors/theme_jaipur.js +14 -14
- package/esm/Theme/global.css +0 -1
- package/esm/Theme/index.js +1 -1
- package/esm/TimeSelect/Label/index.js +11 -13
- package/esm/TimeSelect/helpers.js +22 -37
- package/esm/TimeSelect/index.js +32 -38
- package/esm/Tooltip/index.js +36 -41
- package/esm/Typography/Typography.module.css +1365 -0
- package/esm/Typography/index.js +24 -12
- package/esm/Typography/index.props.d.ts +13 -1
- package/esm/base/BaseInput/index.js +10 -8
- package/esm/base/FormField/index.d.ts +1 -1
- package/esm/base/FormField/index.js +27 -21
- package/esm/base/FormField/index.props.d.ts +4 -0
- package/esm/base/InputRoot/index.js +27 -26
- package/esm/helpers/date/index.js +4 -8
- package/esm/hooks/useMediaSizes/index.js +9 -15
- package/esm/hooks/useModalStack/index.js +6 -9
- package/esm/hooks/useOnClickOutside/index.js +6 -6
- package/esm/hooks/useScrollLock/index.js +10 -9
- package/esm/hooks/useTrapFocus/index.js +8 -10
- package/esm/index.d.ts +1 -1
- package/esm/lib/keyboard.js +2 -4
- package/helpers/date/index.js +21 -32
- package/hooks/useMediaSizes/index.js +9 -15
- package/hooks/useModalStack/index.js +6 -9
- package/hooks/useOnClickOutside/index.js +6 -6
- package/hooks/useScrollLock/index.js +10 -9
- package/hooks/useTrapFocus/index.js +8 -10
- package/index.d.ts +1 -1
- package/lib/keyboard.js +2 -4
- package/package.json +5 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
3
|
var tslib = require('tslib');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var index$4 = require('../../../Dropdown/index.js');
|
|
@@ -15,92 +14,74 @@ var Calendar = require('../../../Calendar/Calendar.js');
|
|
|
15
14
|
|
|
16
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
|
|
18
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
|
|
19
17
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
20
18
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
const calendarSizeByDatepickerSize = {
|
|
23
21
|
l: "s",
|
|
24
22
|
m: "xs",
|
|
25
23
|
s: "xs"
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
var DatePicker = function DatePicker(_a) {
|
|
25
|
+
const CalendarIcon = () => (/*#__PURE__*/React__default.default.createElement("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
fill: "none",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
className: styles__default.default["calendar-icon"],
|
|
30
|
+
strokeWidth: 1.5,
|
|
31
|
+
stroke: "currentColor"
|
|
32
|
+
}, /*#__PURE__*/React__default.default.createElement("path", {
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round",
|
|
35
|
+
d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"
|
|
36
|
+
})));
|
|
37
|
+
const DatePicker = _a => {
|
|
42
38
|
var _b;
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onChangeDate = _a.onChangeDate,
|
|
62
|
-
onChangeRange = _a.onChangeRange,
|
|
39
|
+
var {
|
|
40
|
+
className,
|
|
41
|
+
endPlaceholder,
|
|
42
|
+
hasError,
|
|
43
|
+
hint,
|
|
44
|
+
label,
|
|
45
|
+
placeholder,
|
|
46
|
+
required,
|
|
47
|
+
selectedDate = "",
|
|
48
|
+
selectedRange = ["", ""],
|
|
49
|
+
selectionMode = "single",
|
|
50
|
+
size = "m",
|
|
51
|
+
defaultVisibleMonth,
|
|
52
|
+
monthsToShow,
|
|
53
|
+
startPlaceholder,
|
|
54
|
+
onChangeDate,
|
|
55
|
+
onChangeRange
|
|
56
|
+
} = _a,
|
|
63
57
|
calendarProps = tslib.__rest(_a, ["className", "endPlaceholder", "hasError", "hint", "label", "placeholder", "required", "selectedDate", "selectedRange", "selectionMode", "size", "defaultVisibleMonth", "monthsToShow", "startPlaceholder", "onChangeDate", "onChangeRange"]);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_useState6 = _slicedToArray__default.default(_useState5, 2),
|
|
74
|
-
isOpen = _useState6[0],
|
|
75
|
-
setIsOpen = _useState6[1];
|
|
76
|
-
var calendarValue = React.useMemo(function () {
|
|
77
|
-
return date ? index.parse(date) : null;
|
|
78
|
-
}, [date]);
|
|
79
|
-
var calendarRangeValue = React.useMemo(function () {
|
|
80
|
-
return [range[0] ? index.parse(range[0]) : null, range[1] ? index.parse(range[1]) : null];
|
|
81
|
-
}, [range]);
|
|
82
|
-
var calendarSize = calendarSizeByDatepickerSize[size];
|
|
83
|
-
var visibleMonth = (_b = calendarValue !== null && calendarValue !== void 0 ? calendarValue : calendarRangeValue[0]) !== null && _b !== void 0 ? _b : new Date();
|
|
84
|
-
var isRangeMode = selectionMode === "range";
|
|
85
|
-
React.useEffect(function () {
|
|
58
|
+
const [date, setDate] = React.useState(selectedDate);
|
|
59
|
+
const [range, setRange] = React.useState(selectedRange);
|
|
60
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
61
|
+
const calendarValue = React.useMemo(() => date ? index.parse(date) : null, [date]);
|
|
62
|
+
const calendarRangeValue = React.useMemo(() => [range[0] ? index.parse(range[0]) : null, range[1] ? index.parse(range[1]) : null], [range]);
|
|
63
|
+
const calendarSize = calendarSizeByDatepickerSize[size];
|
|
64
|
+
const visibleMonth = (_b = calendarValue !== null && calendarValue !== void 0 ? calendarValue : calendarRangeValue[0]) !== null && _b !== void 0 ? _b : new Date();
|
|
65
|
+
const isRangeMode = selectionMode === "range";
|
|
66
|
+
React.useEffect(() => {
|
|
86
67
|
setDate(selectedDate);
|
|
87
68
|
}, [selectedDate]);
|
|
88
|
-
React.useEffect(
|
|
69
|
+
React.useEffect(() => {
|
|
89
70
|
setRange(selectedRange);
|
|
90
71
|
}, [selectedRange]);
|
|
91
|
-
|
|
92
|
-
|
|
72
|
+
const handleDateChange = nextDate => {
|
|
73
|
+
const nextValue = index.toISODate(nextDate);
|
|
93
74
|
setDate(nextValue);
|
|
94
75
|
setIsOpen(false);
|
|
95
76
|
onChangeDate === null || onChangeDate === void 0 ? void 0 : onChangeDate(nextValue);
|
|
96
77
|
};
|
|
97
|
-
|
|
98
|
-
|
|
78
|
+
const handleRangeChange = nextRange => {
|
|
79
|
+
const nextValue = [nextRange[0] ? index.toISODate(nextRange[0]) : "", nextRange[1] ? index.toISODate(nextRange[1]) : ""];
|
|
99
80
|
setRange(nextValue);
|
|
100
81
|
if (nextValue[0] && nextValue[1]) setIsOpen(false);
|
|
101
82
|
onChangeRange === null || onChangeRange === void 0 ? void 0 : onChangeRange(nextValue);
|
|
102
83
|
};
|
|
103
|
-
|
|
84
|
+
const renderCalendar = () => {
|
|
104
85
|
if (isRangeMode) {
|
|
105
86
|
return /*#__PURE__*/React__default.default.createElement(Calendar.Calendar, Object.assign({}, calendarProps, {
|
|
106
87
|
className: className,
|
|
@@ -122,42 +103,40 @@ var DatePicker = function DatePicker(_a) {
|
|
|
122
103
|
onChange: handleDateChange
|
|
123
104
|
}));
|
|
124
105
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
})));
|
|
160
|
-
};
|
|
106
|
+
const renderRangeInput = () => (/*#__PURE__*/React__default.default.createElement("div", {
|
|
107
|
+
className: styles__default.default["range-input"]
|
|
108
|
+
}, /*#__PURE__*/React__default.default.createElement(index$1.InputRoot, {
|
|
109
|
+
className: styles__default.default["range-control-start"],
|
|
110
|
+
disabled: false,
|
|
111
|
+
hasError: hasError,
|
|
112
|
+
size: size
|
|
113
|
+
}, /*#__PURE__*/React__default.default.createElement(index$2.BaseInput, {
|
|
114
|
+
"aria-expanded": isOpen,
|
|
115
|
+
"aria-haspopup": "true",
|
|
116
|
+
"aria-invalid": hasError,
|
|
117
|
+
autoComplete: "off",
|
|
118
|
+
maxLength: 10,
|
|
119
|
+
placeholder: startPlaceholder !== null && startPlaceholder !== void 0 ? startPlaceholder : placeholder,
|
|
120
|
+
readOnly: true,
|
|
121
|
+
required: required,
|
|
122
|
+
value: index.toDMYDate(range[0])
|
|
123
|
+
})), /*#__PURE__*/React__default.default.createElement(index$1.InputRoot, {
|
|
124
|
+
className: styles__default.default["range-control-end"],
|
|
125
|
+
disabled: false,
|
|
126
|
+
endIcon: /*#__PURE__*/React__default.default.createElement(CalendarIcon, null),
|
|
127
|
+
hasError: hasError,
|
|
128
|
+
size: size
|
|
129
|
+
}, /*#__PURE__*/React__default.default.createElement(index$2.BaseInput, {
|
|
130
|
+
"aria-expanded": isOpen,
|
|
131
|
+
"aria-haspopup": "true",
|
|
132
|
+
"aria-invalid": hasError,
|
|
133
|
+
autoComplete: "off",
|
|
134
|
+
maxLength: 10,
|
|
135
|
+
placeholder: endPlaceholder !== null && endPlaceholder !== void 0 ? endPlaceholder : placeholder,
|
|
136
|
+
readOnly: true,
|
|
137
|
+
required: required,
|
|
138
|
+
value: index.toDMYDate(range[1])
|
|
139
|
+
}))));
|
|
161
140
|
return /*#__PURE__*/React__default.default.createElement(index$3.FormField, {
|
|
162
141
|
label: label,
|
|
163
142
|
required: required,
|
package/Datepicker/index.js
CHANGED
|
@@ -12,22 +12,23 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
12
12
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
13
13
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
const Datepicker = _a => {
|
|
16
|
+
var {
|
|
17
|
+
className,
|
|
18
|
+
endPlaceholder,
|
|
19
|
+
hasError,
|
|
20
|
+
hint,
|
|
21
|
+
label,
|
|
22
|
+
placeholder,
|
|
23
|
+
required,
|
|
24
|
+
selectedDate,
|
|
25
|
+
selectedRange,
|
|
26
|
+
selectionMode,
|
|
27
|
+
size = "m",
|
|
28
|
+
startPlaceholder,
|
|
29
|
+
onChangeDate,
|
|
30
|
+
onChangeRange
|
|
31
|
+
} = _a,
|
|
31
32
|
calendarProps = tslib.__rest(_a, ["className", "endPlaceholder", "hasError", "hint", "label", "placeholder", "required", "selectedDate", "selectedRange", "selectionMode", "size", "startPlaceholder", "onChangeDate", "onChangeRange"]);
|
|
32
33
|
return /*#__PURE__*/React__default.default.createElement("div", {
|
|
33
34
|
className: clsx__default.default(styles__default.default.root, className)
|
package/DotsLoader/index.js
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
3
|
var React = require('react');
|
|
5
4
|
var clsx = require('clsx');
|
|
6
5
|
var styles = require('./DotsLoader.module.css');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
8
|
|
|
10
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
|
|
11
9
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
12
10
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
13
11
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
}
|
|
13
|
+
const DotsLoader = () => (/*#__PURE__*/React__default.default.createElement("div", {
|
|
14
|
+
className: styles__default.default.wrapper
|
|
15
|
+
}, /*#__PURE__*/React__default.default.createElement("div", {
|
|
16
|
+
className: clsx__default.default({
|
|
17
|
+
[styles__default.default.dot]: true,
|
|
18
|
+
[styles__default.default.dot_first]: true
|
|
19
|
+
})
|
|
20
|
+
}), /*#__PURE__*/React__default.default.createElement("div", {
|
|
21
|
+
className: clsx__default.default({
|
|
22
|
+
[styles__default.default.dot]: true,
|
|
23
|
+
[styles__default.default.dot_second]: true
|
|
24
|
+
})
|
|
25
|
+
}), /*#__PURE__*/React__default.default.createElement("div", {
|
|
26
|
+
className: clsx__default.default({
|
|
27
|
+
[styles__default.default.dot]: true,
|
|
28
|
+
[styles__default.default.dot_third]: true
|
|
29
|
+
})
|
|
30
|
+
}), /*#__PURE__*/React__default.default.createElement("div", {
|
|
31
|
+
className: clsx__default.default({
|
|
32
|
+
[styles__default.default.dot]: true,
|
|
33
|
+
[styles__default.default.dot_fourth]: true
|
|
34
|
+
})
|
|
35
|
+
})));
|
|
28
36
|
|
|
29
37
|
exports.DotsLoader = DotsLoader;
|
package/Drawer/Drawer.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
3
|
var tslib = require('tslib');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var ReactDOM = require('react-dom');
|
|
@@ -8,71 +7,55 @@ var styles = require('./Drawer.module.css');
|
|
|
8
7
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
|
|
11
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
|
|
12
10
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
11
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className = _a.className,
|
|
58
|
-
style = _a.style,
|
|
59
|
-
children = _a.children,
|
|
60
|
-
rest = tslib.__rest(_a, ["opened", "placement", "width", "height", "offset", "zIndex", "asModal", "withBlur", "closeOnEsc", "closeOnOverlayClick", "borderRadius", "customBackgroundColor", "customContentBackgroundColor", "animationInfo", "initialFocusRef", "focusAfterRef", "portalContainer", "onClose", "onEscKeyDown", "onOverlayClick", "className", "style", "children"]);
|
|
61
|
-
var panelRef = React.useRef(null);
|
|
62
|
-
var previousFocus = React.useRef(null);
|
|
63
|
-
var _useState = React.useState(opened),
|
|
64
|
-
_useState2 = _slicedToArray__default.default(_useState, 2),
|
|
65
|
-
rendered = _useState2[0],
|
|
66
|
-
setRendered = _useState2[1];
|
|
67
|
-
var _useState3 = React.useState(false),
|
|
68
|
-
_useState4 = _slicedToArray__default.default(_useState3, 2),
|
|
69
|
-
closing = _useState4[0],
|
|
70
|
-
setClosing = _useState4[1];
|
|
71
|
-
var setPanelRef = function setPanelRef(element) {
|
|
13
|
+
const cx = (...classNames) => classNames.filter(Boolean).join(" ");
|
|
14
|
+
const toSize = (value, fallback) => value === undefined ? fallback : typeof value === "number" ? `${value}px` : value;
|
|
15
|
+
const toOffset = value => typeof value === "number" ? `${value}px` : value;
|
|
16
|
+
const focusableSelector = ["a[href]", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", '[tabindex]:not([tabindex="-1"])'].join(",");
|
|
17
|
+
const Drawer = /*#__PURE__*/React.forwardRef(function DrawerRoot(_a, forwardedRef) {
|
|
18
|
+
var {
|
|
19
|
+
opened,
|
|
20
|
+
placement = "right",
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
offset = [0, 0],
|
|
24
|
+
zIndex = 1000,
|
|
25
|
+
asModal = true,
|
|
26
|
+
withBlur = false,
|
|
27
|
+
closeOnEsc = true,
|
|
28
|
+
closeOnOverlayClick = true,
|
|
29
|
+
borderRadius = "none",
|
|
30
|
+
customBackgroundColor,
|
|
31
|
+
customContentBackgroundColor,
|
|
32
|
+
animationInfo,
|
|
33
|
+
initialFocusRef,
|
|
34
|
+
focusAfterRef,
|
|
35
|
+
portalContainer,
|
|
36
|
+
onClose,
|
|
37
|
+
onClosed,
|
|
38
|
+
onEscKeyDown,
|
|
39
|
+
onOverlayClick,
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
children
|
|
43
|
+
} = _a,
|
|
44
|
+
rest = tslib.__rest(_a, ["opened", "placement", "width", "height", "offset", "zIndex", "asModal", "withBlur", "closeOnEsc", "closeOnOverlayClick", "borderRadius", "customBackgroundColor", "customContentBackgroundColor", "animationInfo", "initialFocusRef", "focusAfterRef", "portalContainer", "onClose", "onClosed", "onEscKeyDown", "onOverlayClick", "className", "style", "children"]);
|
|
45
|
+
const panelRef = React.useRef(null);
|
|
46
|
+
const previousFocus = React.useRef(null);
|
|
47
|
+
const [rendered, setRendered] = React.useState(opened);
|
|
48
|
+
const [closing, setClosing] = React.useState(false);
|
|
49
|
+
// The latest callback without restarting the closing timer.
|
|
50
|
+
const onClosedRef = React.useRef(onClosed);
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
onClosedRef.current = onClosed;
|
|
53
|
+
}, [onClosed]);
|
|
54
|
+
const setPanelRef = element => {
|
|
72
55
|
panelRef.current = element;
|
|
73
56
|
if (typeof forwardedRef === "function") forwardedRef(element);else if (forwardedRef) forwardedRef.current = element;
|
|
74
57
|
};
|
|
75
|
-
React.useEffect(
|
|
58
|
+
React.useEffect(() => {
|
|
76
59
|
if (opened) {
|
|
77
60
|
setRendered(true);
|
|
78
61
|
setClosing(false);
|
|
@@ -80,40 +63,40 @@ var Drawer = /*#__PURE__*/React.forwardRef(function DrawerRoot(_a, forwardedRef)
|
|
|
80
63
|
}
|
|
81
64
|
if (!rendered) return;
|
|
82
65
|
setClosing(true);
|
|
83
|
-
|
|
66
|
+
const timeout = window.setTimeout(() => {
|
|
67
|
+
var _a;
|
|
84
68
|
setRendered(false);
|
|
85
69
|
setClosing(false);
|
|
70
|
+
(_a = onClosedRef.current) === null || _a === void 0 ? void 0 : _a.call(onClosedRef);
|
|
86
71
|
}, 200);
|
|
87
|
-
return
|
|
88
|
-
return window.clearTimeout(timeout);
|
|
89
|
-
};
|
|
72
|
+
return () => window.clearTimeout(timeout);
|
|
90
73
|
}, [opened, rendered]);
|
|
91
|
-
React.useEffect(
|
|
74
|
+
React.useEffect(() => {
|
|
92
75
|
if (!opened || typeof document === "undefined") return;
|
|
93
76
|
previousFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
const previousOverflow = document.body.style.overflow;
|
|
78
|
+
const focusAfterElement = focusAfterRef === null || focusAfterRef === void 0 ? void 0 : focusAfterRef.current;
|
|
96
79
|
if (asModal) document.body.style.overflow = "hidden";
|
|
97
|
-
|
|
80
|
+
const focusFrame = window.requestAnimationFrame(() => {
|
|
98
81
|
var _a, _b, _c, _d;
|
|
99
|
-
|
|
82
|
+
const firstFocusable = (_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector);
|
|
100
83
|
(_d = (_c = (_b = initialFocusRef === null || initialFocusRef === void 0 ? void 0 : initialFocusRef.current) !== null && _b !== void 0 ? _b : firstFocusable) !== null && _c !== void 0 ? _c : panelRef.current) === null || _d === void 0 ? void 0 : _d.focus();
|
|
101
84
|
});
|
|
102
|
-
|
|
85
|
+
const handleKeyDown = event => {
|
|
103
86
|
if (event.key === "Escape" && closeOnEsc) {
|
|
104
87
|
onEscKeyDown === null || onEscKeyDown === void 0 ? void 0 : onEscKeyDown(event);
|
|
105
88
|
if (!event.defaultPrevented) onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
106
89
|
return;
|
|
107
90
|
}
|
|
108
91
|
if (!asModal || event.key !== "Tab" || !panelRef.current) return;
|
|
109
|
-
|
|
92
|
+
const focusable = Array.from(panelRef.current.querySelectorAll(focusableSelector));
|
|
110
93
|
if (!focusable.length) {
|
|
111
94
|
event.preventDefault();
|
|
112
95
|
panelRef.current.focus();
|
|
113
96
|
return;
|
|
114
97
|
}
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
const first = focusable[0];
|
|
99
|
+
const last = focusable[focusable.length - 1];
|
|
117
100
|
if (event.shiftKey && document.activeElement === first) {
|
|
118
101
|
event.preventDefault();
|
|
119
102
|
last.focus();
|
|
@@ -123,7 +106,7 @@ var Drawer = /*#__PURE__*/React.forwardRef(function DrawerRoot(_a, forwardedRef)
|
|
|
123
106
|
}
|
|
124
107
|
};
|
|
125
108
|
document.addEventListener("keydown", handleKeyDown);
|
|
126
|
-
return
|
|
109
|
+
return () => {
|
|
127
110
|
var _a;
|
|
128
111
|
window.cancelAnimationFrame(focusFrame);
|
|
129
112
|
document.removeEventListener("keydown", handleKeyDown);
|
|
@@ -132,8 +115,8 @@ var Drawer = /*#__PURE__*/React.forwardRef(function DrawerRoot(_a, forwardedRef)
|
|
|
132
115
|
};
|
|
133
116
|
}, [opened, asModal, closeOnEsc, focusAfterRef, initialFocusRef, onClose, onEscKeyDown]);
|
|
134
117
|
if (!rendered || typeof document === "undefined") return null;
|
|
135
|
-
|
|
136
|
-
|
|
118
|
+
const sidePlacement = placement === "left" || placement === "right";
|
|
119
|
+
const panelStyle = Object.assign(Object.assign({}, style), {
|
|
137
120
|
"--drawer-width": toSize(width, sidePlacement ? "100%" : "100vw"),
|
|
138
121
|
"--drawer-height": toSize(height, sidePlacement ? "100dvh" : "100%"),
|
|
139
122
|
"--drawer-offset-x": toOffset(offset[0]),
|
|
@@ -143,21 +126,21 @@ var Drawer = /*#__PURE__*/React.forwardRef(function DrawerRoot(_a, forwardedRef)
|
|
|
143
126
|
"--drawer-enter-animation": animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.enter,
|
|
144
127
|
"--drawer-exit-animation": animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.exit
|
|
145
128
|
});
|
|
146
|
-
|
|
129
|
+
const drawer = /*#__PURE__*/React__default.default.createElement("div", Object.assign({}, rest, {
|
|
147
130
|
className: cx(styles__default.default.root, !asModal && styles__default.default["non-modal"], closing && styles__default.default.closing, className),
|
|
148
131
|
style: {
|
|
149
|
-
zIndex
|
|
132
|
+
zIndex
|
|
150
133
|
}
|
|
151
134
|
}), asModal && (/*#__PURE__*/React__default.default.createElement("div", {
|
|
152
135
|
className: cx(styles__default.default.overlay, withBlur && styles__default.default["overlay-blur"]),
|
|
153
136
|
"aria-hidden": "true",
|
|
154
|
-
onClick:
|
|
137
|
+
onClick: event => {
|
|
155
138
|
onOverlayClick === null || onOverlayClick === void 0 ? void 0 : onOverlayClick(event);
|
|
156
139
|
if (closeOnOverlayClick && !event.defaultPrevented) onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
157
140
|
}
|
|
158
141
|
})), /*#__PURE__*/React__default.default.createElement("div", {
|
|
159
142
|
ref: setPanelRef,
|
|
160
|
-
className: cx(styles__default.default.panel, styles__default.default[placement], styles__default.default[
|
|
143
|
+
className: cx(styles__default.default.panel, styles__default.default[placement], styles__default.default[`radius-${borderRadius}`]),
|
|
161
144
|
style: panelStyle,
|
|
162
145
|
role: "dialog",
|
|
163
146
|
"aria-modal": asModal || undefined,
|
|
@@ -170,19 +153,18 @@ var Drawer = /*#__PURE__*/React.forwardRef(function DrawerRoot(_a, forwardedRef)
|
|
|
170
153
|
}, children)));
|
|
171
154
|
return /*#__PURE__*/ReactDOM.createPortal(drawer, portalContainer !== null && portalContainer !== void 0 ? portalContainer : document.body);
|
|
172
155
|
});
|
|
173
|
-
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
children = _a.children,
|
|
156
|
+
const DrawerHeader = /*#__PURE__*/React.forwardRef(function DrawerHeaderRoot(_a, ref) {
|
|
157
|
+
var {
|
|
158
|
+
actions,
|
|
159
|
+
hasClose = true,
|
|
160
|
+
closePlacement = "right",
|
|
161
|
+
closeAriaLabel = "Close",
|
|
162
|
+
onClose,
|
|
163
|
+
className,
|
|
164
|
+
children
|
|
165
|
+
} = _a,
|
|
184
166
|
rest = tslib.__rest(_a, ["actions", "hasClose", "closePlacement", "closeAriaLabel", "onClose", "className", "children"]);
|
|
185
|
-
|
|
167
|
+
const closeButton = hasClose && (/*#__PURE__*/React__default.default.createElement("button", {
|
|
186
168
|
className: styles__default.default["close-button"],
|
|
187
169
|
type: "button",
|
|
188
170
|
"aria-label": closeAriaLabel,
|
|
@@ -202,18 +184,22 @@ var DrawerHeader = /*#__PURE__*/React.forwardRef(function DrawerHeaderRoot(_a, r
|
|
|
202
184
|
className: styles__default.default.actions
|
|
203
185
|
}, actions), closePlacement === "right" && closeButton);
|
|
204
186
|
});
|
|
205
|
-
|
|
206
|
-
var
|
|
207
|
-
|
|
187
|
+
const DrawerContent = /*#__PURE__*/React.forwardRef(function DrawerContentRoot(_a, ref) {
|
|
188
|
+
var {
|
|
189
|
+
className,
|
|
190
|
+
children
|
|
191
|
+
} = _a,
|
|
208
192
|
rest = tslib.__rest(_a, ["className", "children"]);
|
|
209
193
|
return /*#__PURE__*/React__default.default.createElement("div", Object.assign({}, rest, {
|
|
210
194
|
ref: ref,
|
|
211
195
|
className: cx(styles__default.default.content, className)
|
|
212
196
|
}), children);
|
|
213
197
|
});
|
|
214
|
-
|
|
215
|
-
var
|
|
216
|
-
|
|
198
|
+
const DrawerFooter = /*#__PURE__*/React.forwardRef(function DrawerFooterRoot(_a, ref) {
|
|
199
|
+
var {
|
|
200
|
+
className,
|
|
201
|
+
children
|
|
202
|
+
} = _a,
|
|
217
203
|
rest = tslib.__rest(_a, ["className", "children"]);
|
|
218
204
|
return /*#__PURE__*/React__default.default.createElement("div", Object.assign({}, rest, {
|
|
219
205
|
ref: ref,
|
package/Drawer/Drawer.module.css
CHANGED
package/Drawer/index.props.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onAni
|
|
|
24
24
|
focusAfterRef?: RefObject<HTMLElement | null>;
|
|
25
25
|
portalContainer?: HTMLElement | null;
|
|
26
26
|
onClose?: () => void;
|
|
27
|
+
/** Called once the closing animation has finished and the drawer is removed. */
|
|
28
|
+
onClosed?: () => void;
|
|
27
29
|
onEscKeyDown?: (event: KeyboardEvent) => void;
|
|
28
30
|
onOverlayClick?: MouseEventHandler<HTMLDivElement>;
|
|
29
31
|
}
|