@neko-os/ui 0.4.0 → 0.5.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.
- package/dist/abstractions/KeyboardDismissView.js +3 -0
- package/dist/abstractions/KeyboardDismissView.native.js +9 -0
- package/dist/abstractions/index.js +1 -0
- package/dist/components/actions/ClearLink.js +6 -0
- package/dist/components/actions/FloatingMenu.js +1 -1
- package/dist/components/calendar/CalendarNav.js +6 -6
- package/dist/components/carousel/Carousel.js +48 -0
- package/dist/components/carousel/CarouselArrows.js +40 -0
- package/dist/components/carousel/CarouselArrows.native.js +40 -0
- package/dist/components/carousel/CarouselDots.js +32 -0
- package/dist/components/carousel/CarouselDots.native.js +36 -0
- package/dist/components/carousel/CarouselHandler.js +86 -0
- package/dist/components/carousel/CarouselSlider.js +124 -0
- package/dist/components/carousel/CarouselSlider.native.js +121 -0
- package/dist/components/carousel/InfiniteCarousel.js +50 -0
- package/dist/components/carousel/index.js +6 -0
- package/dist/components/form/Form.js +5 -3
- package/dist/components/index.js +3 -1
- package/dist/components/inputs/DateInput.js +7 -4
- package/dist/components/inputs/InputWrapper.js +1 -2
- package/dist/components/inputs/Select.js +56 -52
- package/dist/components/inputs/TextInput.js +7 -6
- package/dist/components/inputs/datePicker/DayPicker.js +71 -23
- package/dist/components/inputs/datePicker/MonthPicker.js +61 -32
- package/dist/components/inputs/datePicker/QuarterPicker.js +62 -33
- package/dist/components/inputs/datePicker/WeekPicker.js +65 -24
- package/dist/components/inputs/datePicker/YearPicker.js +69 -40
- package/dist/components/keyboard/KeyboardDismissButton.js +3 -0
- package/dist/components/keyboard/KeyboardDismissButton.native.js +38 -0
- package/dist/components/keyboard/index.js +1 -0
- package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +28 -7
- package/dist/components/presentation/LabelValue.js +1 -1
- package/dist/components/presentation/Result.js +11 -3
- package/dist/components/structure/KeyboardAvoidingView.js +9 -2
- package/dist/components/theme/ThemePicker.js +7 -12
- package/dist/components/theme/ThemeThumb.js +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/ThemeHandler.js +31 -3
- package/package.json +1 -1
- package/src/abstractions/KeyboardDismissView.js +3 -0
- package/src/abstractions/KeyboardDismissView.native.js +9 -0
- package/src/abstractions/index.js +1 -0
- package/src/components/actions/ClearLink.js +6 -0
- package/src/components/actions/FloatingMenu.js +1 -1
- package/src/components/calendar/CalendarNav.js +6 -6
- package/src/components/carousel/Carousel.js +48 -0
- package/src/components/carousel/CarouselArrows.js +40 -0
- package/src/components/carousel/CarouselArrows.native.js +40 -0
- package/src/components/carousel/CarouselDots.js +32 -0
- package/src/components/carousel/CarouselDots.native.js +36 -0
- package/src/components/carousel/CarouselHandler.js +86 -0
- package/src/components/carousel/CarouselSlider.js +124 -0
- package/src/components/carousel/CarouselSlider.native.js +121 -0
- package/src/components/carousel/InfiniteCarousel.js +50 -0
- package/src/components/carousel/index.js +6 -0
- package/src/components/form/Form.js +2 -0
- package/src/components/index.js +2 -0
- package/src/components/inputs/DateInput.js +4 -1
- package/src/components/inputs/InputWrapper.js +1 -2
- package/src/components/inputs/Select.js +19 -15
- package/src/components/inputs/TextInput.js +5 -4
- package/src/components/inputs/datePicker/DayPicker.js +69 -21
- package/src/components/inputs/datePicker/MonthPicker.js +60 -31
- package/src/components/inputs/datePicker/QuarterPicker.js +60 -31
- package/src/components/inputs/datePicker/WeekPicker.js +63 -22
- package/src/components/inputs/datePicker/YearPicker.js +68 -39
- package/src/components/keyboard/KeyboardDismissButton.js +3 -0
- package/src/components/keyboard/KeyboardDismissButton.native.js +38 -0
- package/src/components/keyboard/index.js +1 -0
- package/src/components/modals/bottomDrawer/native/BottomDrawer.js +27 -6
- package/src/components/presentation/LabelValue.js +1 -1
- package/src/components/presentation/Result.js +10 -2
- package/src/components/structure/KeyboardAvoidingView.js +9 -2
- package/src/components/theme/ThemePicker.js +8 -13
- package/src/components/theme/ThemeThumb.js +1 -1
- package/src/index.js +1 -0
- package/src/theme/ThemeHandler.js +31 -3
|
@@ -1,21 +1,55 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/QuarterPicker.js";
|
|
1
|
+
var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled", "allowClear"];var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/QuarterPicker.js";function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import React from 'react';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import quarterOfYear from 'dayjs/esm/plugin/quarterOfYear';
|
|
4
4
|
|
|
5
5
|
import { CalendarNav } from "../../calendar/CalendarNav";
|
|
6
|
+
import { ClearLink } from "../../actions/ClearLink";
|
|
6
7
|
import { Col } from "../../structure/Col";
|
|
7
8
|
import { Divider } from "../../helpers";
|
|
8
9
|
import { Grid } from "../../structure/Row";
|
|
10
|
+
import { InfiniteCarousel } from "../../carousel/InfiniteCarousel";
|
|
9
11
|
import { Link } from "../../actions/Link";
|
|
10
12
|
import { Text } from "../../text/Text";
|
|
11
13
|
import { View } from "../../structure/View";
|
|
12
|
-
import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";import {
|
|
14
|
+
import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
15
|
|
|
14
16
|
dayjs.extend(quarterOfYear);
|
|
15
17
|
|
|
16
18
|
var quarters = [1, 2, 3, 4];
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
var QuarterGrid = React.memo(function QuarterGrid(_ref) {var _this = this;var year = _ref.year,selectedKey = _ref.selectedKey,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
|
|
21
|
+
var yearDate = dayjs().year(year).startOf('year');
|
|
22
|
+
var selectedValue = selectedKey ? dayjs(selectedKey) : null;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
_jsx(Grid, { colSpan: 6, gap: "xs", children:
|
|
26
|
+
quarters.map(function (quarter) {
|
|
27
|
+
var dateVal = yearDate.quarter(quarter);
|
|
28
|
+
var isActive = !!selectedValue && dateVal.isSame(selectedValue, 'quarter');
|
|
29
|
+
var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
_jsx(Col, { children:
|
|
33
|
+
_jsx(Link, {
|
|
34
|
+
fullW: true,
|
|
35
|
+
br: "md",
|
|
36
|
+
padding: "sm",
|
|
37
|
+
onPress: function onPress() {return onSelect(dateVal);},
|
|
38
|
+
bg: isActive && 'primary',
|
|
39
|
+
disabled: disabled, children:
|
|
40
|
+
|
|
41
|
+
_jsxs(Text, { text2: !isActive, strong: isActive, center: true, children: ["Q",
|
|
42
|
+
dateVal.quarter()] }
|
|
43
|
+
) }
|
|
44
|
+
) }, quarter
|
|
45
|
+
));
|
|
46
|
+
|
|
47
|
+
}) }
|
|
48
|
+
));
|
|
49
|
+
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export function QuarterPicker(_ref2) {var _value2,_value3,_value4,_this2 = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,allowClear = _ref2.allowClear,props = _objectWithoutProperties(_ref2, _excluded);
|
|
19
53
|
var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
20
54
|
var _React$useState3 = React.useState(function () {return dayjs(value || undefined).startOf('year');}),_React$useState4 = _slicedToArray(_React$useState3, 2),currentYear = _React$useState4[0],setCurrentYear = _React$useState4[1];
|
|
21
55
|
value = value === undefined ? localValue : value;
|
|
@@ -25,41 +59,36 @@ export function QuarterPicker(_ref) {var _value2,_value3,_this = this;var value
|
|
|
25
59
|
if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentYear(value.startOf('year'));
|
|
26
60
|
}, [(_value2 = value) == null ? void 0 : _value2.quarter == null ? void 0 : _value2.quarter(), (_value3 = value) == null ? void 0 : _value3.year == null ? void 0 : _value3.year()]);
|
|
27
61
|
|
|
28
|
-
var handleChange =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
62
|
+
var handleChange = React.useCallback(
|
|
63
|
+
function (v) {
|
|
64
|
+
var newValue = v.startOf('quarter');
|
|
65
|
+
setLocalValue(newValue);
|
|
66
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
67
|
+
},
|
|
68
|
+
[onChange]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
var yearValue = currentYear.year();
|
|
72
|
+
var minYear = min ? dayjs(min).year() : undefined;
|
|
73
|
+
var maxYear = max ? dayjs(max).year() : undefined;
|
|
74
|
+
var selectedKey = (_value4 = value) == null ? void 0 : _value4.valueOf == null ? void 0 : _value4.valueOf();
|
|
75
|
+
|
|
76
|
+
var renderSlide = function renderSlide(v) {return (
|
|
77
|
+
_jsx(QuarterGrid, { year: v, selectedKey: selectedKey, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
|
|
78
|
+
|
|
33
79
|
|
|
34
80
|
return (
|
|
35
81
|
_jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
|
|
36
82
|
_jsx(CalendarNav, { value: currentYear, onChange: setCurrentYear, level: "year" }),
|
|
37
83
|
_jsx(Divider, {}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_jsx(Col, { children:
|
|
47
|
-
_jsx(Link, {
|
|
48
|
-
fullW: true,
|
|
49
|
-
br: "md",
|
|
50
|
-
padding: "sm",
|
|
51
|
-
onPress: function onPress() {return handleChange(dateVal);},
|
|
52
|
-
bg: isActive && 'primary',
|
|
53
|
-
disabled: disabled, children:
|
|
54
|
-
|
|
55
|
-
_jsxs(Text, { text2: !isActive, strong: isActive, center: true, children: ["Q",
|
|
56
|
-
dateVal.quarter()] }
|
|
57
|
-
) }
|
|
58
|
-
) }, quarter
|
|
59
|
-
));
|
|
60
|
-
|
|
61
|
-
}) }
|
|
62
|
-
)] })
|
|
84
|
+
_jsx(InfiniteCarousel, {
|
|
85
|
+
value: yearValue,
|
|
86
|
+
onChange: function onChange(v) {return setCurrentYear(dayjs().year(v).startOf('year'));},
|
|
87
|
+
renderSlide: renderSlide,
|
|
88
|
+
min: minYear,
|
|
89
|
+
max: maxYear }
|
|
90
|
+
),
|
|
91
|
+
_jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
|
|
63
92
|
));
|
|
64
93
|
|
|
65
94
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/WeekPicker.js";
|
|
1
|
+
var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled", "allowClear"];var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/WeekPicker.js";function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { splitEvery, identity } from 'ramda';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
|
|
5
5
|
import { CalendarNav } from "../../calendar/CalendarNav";
|
|
6
|
+
import { ClearLink } from "../../actions/ClearLink";
|
|
6
7
|
import { Col } from "../../structure/Col";
|
|
8
|
+
import { InfiniteCarousel } from "../../carousel/InfiniteCarousel";
|
|
7
9
|
import { Link } from "../../actions/Link";
|
|
8
10
|
import { Row } from "../../structure/Row";
|
|
9
11
|
import { Text } from "../../text/Text";
|
|
@@ -12,35 +14,31 @@ import { WeekDaysBar } from "../../calendar/WeekDaysBar";
|
|
|
12
14
|
import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";
|
|
13
15
|
import { useCalendarDays } from "../../calendar/_helpers/calendarDays";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
value = value === undefined ? localValue : value;
|
|
19
|
-
|
|
20
|
-
React.useEffect(function () {var _value;
|
|
21
|
-
setLocalValue(value);
|
|
22
|
-
if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentMonth(value.startOf('month'));
|
|
23
|
-
}, [(_value2 = value) == null ? void 0 : _value2.day == null ? void 0 : _value2.day(), (_value3 = value) == null ? void 0 : _value3.month == null ? void 0 : _value3.month(), (_value4 = value) == null ? void 0 : _value4.year == null ? void 0 : _value4.year()]);
|
|
17
|
+
function toMonthValue(date) {
|
|
18
|
+
return date.year() * 12 + date.month();
|
|
19
|
+
}
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
function fromMonthValue(v) {
|
|
22
|
+
return dayjs().
|
|
23
|
+
year(Math.floor(v / 12)).
|
|
24
|
+
month(v % 12).
|
|
25
|
+
startOf('month');
|
|
26
|
+
}
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
var MonthWeeks = React.memo(function MonthWeeks(_ref) {var _this = this;var monthValue = _ref.monthValue,selectedKey = _ref.selectedKey,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
|
|
29
|
+
var month = fromMonthValue(monthValue);
|
|
30
|
+
var selectedValue = selectedKey ? dayjs(selectedKey) : null;
|
|
31
|
+
var _useCalendarDays = useCalendarDays(month),cells = _useCalendarDays.cells;
|
|
32
32
|
var weeks = splitEvery(7, cells);
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
_jsxs(View,
|
|
36
|
-
_jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
|
|
35
|
+
_jsxs(View, { children: [
|
|
37
36
|
_jsx(WeekDaysBar, {}),
|
|
38
|
-
|
|
39
37
|
_jsx(View, { colSpan: 24 / 7, gap: "sm", children:
|
|
40
38
|
weeks.map(function (week, wi) {
|
|
41
39
|
var firstDay = week.find(identity);
|
|
42
|
-
var dateVal =
|
|
43
|
-
var isActive = !!
|
|
40
|
+
var dateVal = month.date(firstDay);
|
|
41
|
+
var isActive = !!selectedValue && !!firstDay && dateVal.isSame(selectedValue, 'week');
|
|
44
42
|
var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
|
|
45
43
|
|
|
46
44
|
return (
|
|
@@ -48,13 +46,13 @@ export function WeekPicker(_ref) {var _value2,_value3,_value4,_this = this;var v
|
|
|
48
46
|
|
|
49
47
|
fullW: true,
|
|
50
48
|
br: "md",
|
|
51
|
-
onPress: function onPress() {return !!firstDay &&
|
|
49
|
+
onPress: function onPress() {return !!firstDay && onSelect(dateVal);},
|
|
52
50
|
bg: isActive && 'primary',
|
|
53
51
|
disabled: disabled, children:
|
|
54
52
|
|
|
55
53
|
_jsx(Row, { colSpan: 24 / 7, gap: "sm", children:
|
|
56
54
|
week.map(function (day, i) {
|
|
57
|
-
var dateVal =
|
|
55
|
+
var dateVal = month.date(day);
|
|
58
56
|
|
|
59
57
|
return (
|
|
60
58
|
_jsx(Col, { className: "day-cell", center: true, ratio: 1, children:
|
|
@@ -68,7 +66,50 @@ export function WeekPicker(_ref) {var _value2,_value3,_value4,_this = this;var v
|
|
|
68
66
|
));
|
|
69
67
|
|
|
70
68
|
}) }
|
|
71
|
-
)] }
|
|
69
|
+
)] }
|
|
70
|
+
));
|
|
71
|
+
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export function WeekPicker(_ref2) {var _value2,_value3,_value4,_value5,_this2 = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,allowClear = _ref2.allowClear,props = _objectWithoutProperties(_ref2, _excluded);
|
|
75
|
+
var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
76
|
+
var _React$useState3 = React.useState(function () {return dayjs(value || undefined).startOf('month');}),_React$useState4 = _slicedToArray(_React$useState3, 2),currentMonth = _React$useState4[0],setCurrentMonth = _React$useState4[1];
|
|
77
|
+
value = value === undefined ? localValue : value;
|
|
78
|
+
|
|
79
|
+
React.useEffect(function () {var _value;
|
|
80
|
+
setLocalValue(value);
|
|
81
|
+
if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentMonth(value.startOf('month'));
|
|
82
|
+
}, [(_value2 = value) == null ? void 0 : _value2.day == null ? void 0 : _value2.day(), (_value3 = value) == null ? void 0 : _value3.month == null ? void 0 : _value3.month(), (_value4 = value) == null ? void 0 : _value4.year == null ? void 0 : _value4.year()]);
|
|
83
|
+
|
|
84
|
+
var handleChange = React.useCallback(
|
|
85
|
+
function (v) {
|
|
86
|
+
var newValue = v.startOf('week');
|
|
87
|
+
setLocalValue(newValue);
|
|
88
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
89
|
+
},
|
|
90
|
+
[onChange]
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
var monthValue = toMonthValue(currentMonth);
|
|
94
|
+
var minMonth = min ? toMonthValue(dayjs(min).startOf('month')) : undefined;
|
|
95
|
+
var maxMonth = max ? toMonthValue(dayjs(max).startOf('month')) : undefined;
|
|
96
|
+
var selectedKey = (_value5 = value) == null ? void 0 : _value5.valueOf == null ? void 0 : _value5.valueOf();
|
|
97
|
+
|
|
98
|
+
var renderSlide = function renderSlide(v) {return (
|
|
99
|
+
_jsx(MonthWeeks, { monthValue: v, selectedKey: selectedKey, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
_jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
|
|
104
|
+
_jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
|
|
105
|
+
_jsx(InfiniteCarousel, {
|
|
106
|
+
value: monthValue,
|
|
107
|
+
onChange: function onChange(v) {return setCurrentMonth(fromMonthValue(v));},
|
|
108
|
+
renderSlide: renderSlide,
|
|
109
|
+
min: minMonth,
|
|
110
|
+
max: maxMonth }
|
|
111
|
+
),
|
|
112
|
+
_jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
|
|
72
113
|
));
|
|
73
114
|
|
|
74
115
|
}
|
|
@@ -1,70 +1,99 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/YearPicker.js";
|
|
1
|
+
var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled", "allowClear"];var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/YearPicker.js";function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { range } from 'ramda';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
|
|
5
5
|
import { CalendarNav } from "../../calendar/CalendarNav";
|
|
6
|
+
import { ClearLink } from "../../actions/ClearLink";
|
|
6
7
|
import { Col } from "../../structure/Col";
|
|
7
8
|
import { Divider } from "../../helpers";
|
|
8
9
|
import { Grid } from "../../structure/Row";
|
|
10
|
+
import { InfiniteCarousel } from "../../carousel/InfiniteCarousel";
|
|
9
11
|
import { Link } from "../../actions/Link";
|
|
10
12
|
import { Text } from "../../text/Text";
|
|
11
13
|
import { View } from "../../structure/View";
|
|
12
14
|
import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
15
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
var decadeStartYear = Math.floor(year / 10) * 10;
|
|
17
|
-
return dayjs().year(decadeStartYear).startOf('year');
|
|
16
|
+
function getDecadeIndex(value) {
|
|
17
|
+
return Math.floor(dayjs(value || undefined).year() / 10);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function decadeFromIndex(i) {
|
|
21
|
+
return dayjs().year(i * 10).startOf('year');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var DecadeGrid = React.memo(function DecadeGrid(_ref) {var _this = this;var decadeIndex = _ref.decadeIndex,selectedKey = _ref.selectedKey,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
|
|
25
|
+
var decadeStart = decadeFromIndex(decadeIndex);
|
|
26
|
+
var selectedValue = selectedKey ? dayjs(selectedKey) : null;
|
|
27
|
+
var years = range(decadeStart.year(), decadeStart.year() + 10);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
_jsx(Grid, { colSpan: 12, gap: "xs", children:
|
|
31
|
+
years.map(function (year) {
|
|
32
|
+
var dateVal = decadeStart.year(year);
|
|
33
|
+
var isActive = !!selectedValue && dateVal.isSame(selectedValue, 'year');
|
|
34
|
+
var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
_jsx(Col, { children:
|
|
38
|
+
_jsx(Link, {
|
|
39
|
+
fullW: true,
|
|
40
|
+
br: "md",
|
|
41
|
+
padding: "sm",
|
|
42
|
+
onPress: function onPress() {return onSelect(dateVal);},
|
|
43
|
+
bg: isActive && 'primary',
|
|
44
|
+
disabled: disabled, children:
|
|
45
|
+
|
|
46
|
+
_jsx(Text, { text2: !isActive, strong: isActive, center: true, children:
|
|
47
|
+
dateVal.year() }
|
|
48
|
+
) }
|
|
49
|
+
) }, year
|
|
50
|
+
));
|
|
51
|
+
|
|
52
|
+
}) }
|
|
53
|
+
));
|
|
54
|
+
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export function YearPicker(_ref2) {var _value2,_value3,_this2 = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,allowClear = _ref2.allowClear,props = _objectWithoutProperties(_ref2, _excluded);
|
|
21
58
|
var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
22
|
-
var _React$useState3 = React.useState(function () {return
|
|
59
|
+
var _React$useState3 = React.useState(function () {return getDecadeIndex(value);}),_React$useState4 = _slicedToArray(_React$useState3, 2),currentDecade = _React$useState4[0],setCurrentDecade = _React$useState4[1];
|
|
23
60
|
|
|
24
61
|
value = value === undefined ? localValue : value;
|
|
25
62
|
|
|
26
63
|
React.useEffect(function () {var _value;
|
|
27
64
|
setLocalValue(value);
|
|
28
|
-
if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentDecade(
|
|
65
|
+
if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentDecade(getDecadeIndex(value));
|
|
29
66
|
}, [(_value2 = value) == null ? void 0 : _value2.year == null ? void 0 : _value2.year()]);
|
|
30
67
|
|
|
31
|
-
var handleChange =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
68
|
+
var handleChange = React.useCallback(
|
|
69
|
+
function (v) {
|
|
70
|
+
var newValue = v.startOf('year');
|
|
71
|
+
setLocalValue(newValue);
|
|
72
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
73
|
+
},
|
|
74
|
+
[onChange]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
var minDecade = min ? getDecadeIndex(min) : undefined;
|
|
78
|
+
var maxDecade = max ? getDecadeIndex(max) : undefined;
|
|
79
|
+
var selectedKey = (_value3 = value) == null ? void 0 : _value3.valueOf == null ? void 0 : _value3.valueOf();
|
|
80
|
+
|
|
81
|
+
var renderSlide = function renderSlide(v) {return (
|
|
82
|
+
_jsx(DecadeGrid, { decadeIndex: v, selectedKey: selectedKey, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
|
|
36
83
|
|
|
37
|
-
var years = range(currentDecade.year(), currentDecade.year() + 10);
|
|
38
84
|
|
|
39
85
|
return (
|
|
40
86
|
_jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
|
|
41
|
-
_jsx(CalendarNav, { value: currentDecade, onChange: setCurrentDecade, level: "decade" }),
|
|
87
|
+
_jsx(CalendarNav, { value: decadeFromIndex(currentDecade), onChange: function onChange(v) {return setCurrentDecade(getDecadeIndex(v));}, level: "decade" }),
|
|
42
88
|
_jsx(Divider, {}),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_jsx(Col, { children:
|
|
52
|
-
_jsx(Link, {
|
|
53
|
-
fullW: true,
|
|
54
|
-
br: "md",
|
|
55
|
-
padding: "sm",
|
|
56
|
-
onPress: function onPress() {return handleChange(dateVal);},
|
|
57
|
-
bg: isActive && 'primary',
|
|
58
|
-
disabled: disabled, children:
|
|
59
|
-
|
|
60
|
-
_jsx(Text, { text2: !isActive, strong: isActive, center: true, children:
|
|
61
|
-
dateVal.year() }
|
|
62
|
-
) }
|
|
63
|
-
) }, year
|
|
64
|
-
));
|
|
65
|
-
|
|
66
|
-
}) }
|
|
67
|
-
)] })
|
|
89
|
+
_jsx(InfiniteCarousel, {
|
|
90
|
+
value: currentDecade,
|
|
91
|
+
onChange: setCurrentDecade,
|
|
92
|
+
renderSlide: renderSlide,
|
|
93
|
+
min: minDecade,
|
|
94
|
+
max: maxDecade }
|
|
95
|
+
),
|
|
96
|
+
_jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
|
|
68
97
|
));
|
|
69
98
|
|
|
70
99
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/keyboard/KeyboardDismissButton.native.js";import { Keyboard } from "react-native-web";
|
|
2
|
+
import Animated, { useAnimatedKeyboard, useAnimatedStyle, KeyboardState, withTiming } from 'react-native-reanimated';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
|
|
5
|
+
import { Button } from "../actions";import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
var STATIC_STYLE = { position: 'absolute', right: 5, zIndex: 1000 };
|
|
8
|
+
|
|
9
|
+
export function KeyboardDismissButton() {
|
|
10
|
+
var keyboard = useAnimatedKeyboard();
|
|
11
|
+
var _useSafeAreaInsets = useSafeAreaInsets(),bottomInset = _useSafeAreaInsets.bottom;
|
|
12
|
+
|
|
13
|
+
var animatedStyle = useAnimatedStyle(function () {
|
|
14
|
+
var isVisible = keyboard.height.value > 0;
|
|
15
|
+
return {
|
|
16
|
+
bottom: keyboard.height.value - bottomInset + 10,
|
|
17
|
+
opacity: keyboard.state.value === KeyboardState.CLOSING ? withTiming(0, { duration: 150 }) : isVisible ? 1 : 0,
|
|
18
|
+
pointerEvents: isVisible ? 'auto' : 'none'
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
_jsx(Animated.View, { style: [STATIC_STYLE, animatedStyle], children:
|
|
24
|
+
_jsx(Button, {
|
|
25
|
+
icon: "arrow-down-box-line",
|
|
26
|
+
onPress: Keyboard.dismiss,
|
|
27
|
+
ratio: 1,
|
|
28
|
+
shadow: true,
|
|
29
|
+
overlayBG: true,
|
|
30
|
+
sm: true,
|
|
31
|
+
opacity: 0.85,
|
|
32
|
+
iconProps: { size: 'md' },
|
|
33
|
+
border: true,
|
|
34
|
+
borderColor: "divider" }
|
|
35
|
+
) }
|
|
36
|
+
));
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./KeyboardDismissButton";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/modals/bottomDrawer/native/BottomDrawer.js";var _excluded = ["children", "render", "setRender", "open", "onClose", "snapPoints", "useSafeArea", "enableOverScroll", "enableHandlePanningGesture", "enableContentPanningGesture", "animationConfig", "hideHandle", "contentProps"],_excluded2 = ["open"];function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _iterableToArray(r) {if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);}function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { GestureDetector, Gesture, GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/modals/bottomDrawer/native/BottomDrawer.js";var _excluded = ["children", "render", "setRender", "open", "onClose", "snapPoints", "useSafeArea", "enableOverScroll", "enableHandlePanningGesture", "enableContentPanningGesture", "keyboardBehavior", "animationConfig", "hideHandle", "contentProps"],_excluded2 = ["open"];function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _iterableToArray(r) {if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);}function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { GestureDetector, Gesture, GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
2
2
|
import { Modal, Dimensions, StyleSheet, BackHandler, Platform } from "react-native-web";
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import Animated, {
|
|
5
5
|
useSharedValue,
|
|
6
6
|
useAnimatedStyle,
|
|
7
|
+
useAnimatedKeyboard,
|
|
8
|
+
KeyboardState,
|
|
7
9
|
withSpring,
|
|
8
10
|
runOnJS } from
|
|
9
11
|
'react-native-reanimated';
|
|
@@ -38,12 +40,14 @@ function InnerContent(_ref)
|
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
|
|
44
|
+
{var children = _ref.children,render = _ref.render,setRender = _ref.setRender,open = _ref.open,onClose = _ref.onClose,_ref$snapPoints = _ref.snapPoints,snapPoints = _ref$snapPoints === void 0 ? ['50%'] : _ref$snapPoints,_ref$useSafeArea = _ref.useSafeArea,useSafeArea = _ref$useSafeArea === void 0 ? true : _ref$useSafeArea,_ref$enableOverScroll = _ref.enableOverScroll,enableOverScroll = _ref$enableOverScroll === void 0 ? true : _ref$enableOverScroll,_ref$enableHandlePann = _ref.enableHandlePanningGesture,enableHandlePanningGesture = _ref$enableHandlePann === void 0 ? true : _ref$enableHandlePann,_ref$enableContentPan = _ref.enableContentPanningGesture,enableContentPanningGesture = _ref$enableContentPan === void 0 ? true : _ref$enableContentPan,_ref$keyboardBehavior = _ref.keyboardBehavior,keyboardBehavior = _ref$keyboardBehavior === void 0 ? 'interactive' : _ref$keyboardBehavior,_ref$animationConfig = _ref.animationConfig,animationConfig = _ref$animationConfig === void 0 ? { damping: 50, stiffness: 500, mass: 0.3, overshootClamping: true, restDisplacementThreshold: 10, restSpeedThreshold: 10 } : _ref$animationConfig,hideHandle = _ref.hideHandle,contentProps = _ref.contentProps,props = _objectWithoutProperties(_ref, _excluded);
|
|
42
45
|
var _Dimensions$get = Dimensions.get('window'),SCREEN_HEIGHT = _Dimensions$get.height;
|
|
43
46
|
var insets = useSafeAreaInsets();
|
|
44
47
|
var bottomInset = useSafeArea ? insets.bottom : 0;
|
|
45
48
|
|
|
46
49
|
var colors = useColors();
|
|
50
|
+
var keyboard = useAnimatedKeyboard();
|
|
47
51
|
|
|
48
52
|
var translateY = useSharedValue(SCREEN_HEIGHT);
|
|
49
53
|
var snapIndex = useSharedValue(0);
|
|
@@ -122,12 +126,10 @@ function InnerContent(_ref)
|
|
|
122
126
|
var currentPosition = SCREEN_HEIGHT - translateY.value;
|
|
123
127
|
var shouldClose =
|
|
124
128
|
!!handleClose && (
|
|
125
|
-
|
|
126
129
|
velocityY.value > 1500 ||
|
|
127
130
|
velocityY.value > 800 && currentPosition < minSnapPoint ||
|
|
128
131
|
currentPosition < minSnapPoint * 0.35);
|
|
129
132
|
|
|
130
|
-
|
|
131
133
|
if (shouldClose) {
|
|
132
134
|
runOnJS(handleClose)();
|
|
133
135
|
} else {
|
|
@@ -148,10 +150,28 @@ function InnerContent(_ref)
|
|
|
148
150
|
handleClose]
|
|
149
151
|
);
|
|
150
152
|
|
|
153
|
+
var topInset = insets.top;
|
|
151
154
|
var animatedSheetStyle = useAnimatedStyle(function () {
|
|
152
|
-
var
|
|
155
|
+
var kbShift = 0;
|
|
156
|
+
|
|
157
|
+
var kbVisible = keyboard.state.value === KeyboardState.OPEN || keyboard.state.value === KeyboardState.OPENING;
|
|
158
|
+
if (keyboardBehavior !== 'none' && kbVisible) {
|
|
159
|
+
var kbHeight = keyboard.height.value;
|
|
160
|
+
|
|
161
|
+
if (keyboardBehavior === 'interactive') {
|
|
162
|
+
|
|
163
|
+
var maxShift = Math.max(0, translateY.value - topInset);
|
|
164
|
+
kbShift = Math.min(kbHeight, maxShift);
|
|
165
|
+
} else if (keyboardBehavior === 'extend') {
|
|
166
|
+
|
|
167
|
+
kbShift = Math.max(0, translateY.value - topInset);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
var adjustedY = translateY.value - kbShift;
|
|
172
|
+
var currentHeight = SCREEN_HEIGHT - adjustedY;
|
|
153
173
|
return {
|
|
154
|
-
transform: [{ translateY:
|
|
174
|
+
transform: [{ translateY: adjustedY }],
|
|
155
175
|
maxHeight: currentHeight
|
|
156
176
|
};
|
|
157
177
|
});
|
|
@@ -199,7 +219,8 @@ function InnerContent(_ref)
|
|
|
199
219
|
marginL: "auto",
|
|
200
220
|
marginR: "auto",
|
|
201
221
|
fullW: true },
|
|
202
|
-
props, {
|
|
222
|
+
props, {
|
|
223
|
+
minH: minSnapPoint, children: [
|
|
203
224
|
|
|
204
225
|
_jsx(DrawerHandle, { hide: hideHandle }),
|
|
205
226
|
_jsx(View, Object.assign({ flex: true }, contentProps, { children:
|
|
@@ -18,7 +18,7 @@ var DEFAULT_PROPS = function DEFAULT_PROPS(_ref) {var _ref2 = _slicedToArray(_re
|
|
|
18
18
|
labelProps: {
|
|
19
19
|
size: moveScale(sizeCode, !vertical ? 0 : -2),
|
|
20
20
|
moveIconSizeScale: !vertical ? -1 : -2,
|
|
21
|
-
color: color || '
|
|
21
|
+
color: color || 'text2'
|
|
22
22
|
},
|
|
23
23
|
valueProps: {
|
|
24
24
|
size: sizeCode,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/presentation/Result.js";var _excluded = ["type", "icon", "iconColor", "title", "description", "footer", "titleProps", "descriptionProps", "textProps", "iconProps"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { Divider } from "../helpers/Separator";
|
|
2
2
|
import { Icon } from "./Icon";
|
|
3
3
|
import { Text } from "../text/Text";
|
|
4
|
-
import { View } from "../structure/View";
|
|
4
|
+
import { View } from "../structure/View";
|
|
5
|
+
import { useResponsiveValue } from "../../responsive";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
6
|
|
|
6
7
|
export var RESULT_TYPES = {
|
|
7
8
|
error: {
|
|
@@ -22,6 +23,12 @@ export var RESULT_TYPES = {
|
|
|
22
23
|
info: {
|
|
23
24
|
icon: 'information-2-fill',
|
|
24
25
|
color: 'blue'
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
empty: {
|
|
29
|
+
icon: 'inbox-line',
|
|
30
|
+
color: 'text4',
|
|
31
|
+
opacity: 0.7
|
|
25
32
|
}
|
|
26
33
|
};
|
|
27
34
|
|
|
@@ -41,12 +48,13 @@ export function Result(_ref)
|
|
|
41
48
|
var typeProps = RESULT_TYPES[type] || {};
|
|
42
49
|
icon = icon || typeProps.icon;
|
|
43
50
|
iconColor = iconColor || typeProps.color || 'primary';
|
|
51
|
+
var size = useResponsiveValue({ lgu: 'h4', df: 'h5' });
|
|
44
52
|
|
|
45
53
|
return (
|
|
46
|
-
_jsxs(View, Object.assign({ className: "neko-result", center: true, padding: "lg" }, props, { children: [
|
|
54
|
+
_jsxs(View, Object.assign({ className: "neko-result", center: true, padding: "lg", opacity: typeProps.opacity }, props, { children: [
|
|
47
55
|
!!icon && _jsx(Icon, Object.assign({ name: icon, color: iconColor, size: 42, primary: true }, iconProps)),
|
|
48
56
|
!!icon && _jsx(Divider, { height: 10 }),
|
|
49
|
-
_jsx(Text, Object.assign({
|
|
57
|
+
_jsx(Text, Object.assign({ size: size, center: true, color: "text2" }, textProps, titleProps, { children:
|
|
50
58
|
title })
|
|
51
59
|
),
|
|
52
60
|
!!description &&
|