@neko-os/ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/abstractions/KeyboardDismissView.js +3 -0
  2. package/dist/abstractions/KeyboardDismissView.native.js +9 -0
  3. package/dist/components/actions/ClearLink.js +6 -0
  4. package/dist/components/actions/FloatingMenu.js +1 -1
  5. package/dist/components/calendar/CalendarNav.js +6 -6
  6. package/dist/components/carousel/Carousel.js +48 -0
  7. package/dist/components/carousel/CarouselArrows.js +40 -0
  8. package/dist/components/carousel/CarouselArrows.native.js +40 -0
  9. package/dist/components/carousel/CarouselDots.js +32 -0
  10. package/dist/components/carousel/CarouselDots.native.js +36 -0
  11. package/dist/components/carousel/CarouselHandler.js +86 -0
  12. package/dist/components/carousel/CarouselSlider.js +124 -0
  13. package/dist/components/carousel/CarouselSlider.native.js +110 -0
  14. package/dist/components/carousel/InfiniteCarousel.js +50 -0
  15. package/dist/components/carousel/index.js +6 -0
  16. package/dist/components/form/Form.js +5 -3
  17. package/dist/components/index.js +3 -1
  18. package/dist/components/inputs/DateInput.js +7 -4
  19. package/dist/components/inputs/InputWrapper.js +1 -2
  20. package/dist/components/inputs/TextInput.js +7 -6
  21. package/dist/components/inputs/datePicker/DayPicker.js +65 -23
  22. package/dist/components/inputs/datePicker/MonthPicker.js +51 -27
  23. package/dist/components/inputs/datePicker/QuarterPicker.js +52 -28
  24. package/dist/components/inputs/datePicker/WeekPicker.js +59 -24
  25. package/dist/components/inputs/datePicker/YearPicker.js +59 -35
  26. package/dist/components/keyboard/KeyboardDismissButton.js +3 -0
  27. package/dist/components/keyboard/KeyboardDismissButton.native.js +38 -0
  28. package/dist/components/keyboard/index.js +1 -0
  29. package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +28 -7
  30. package/dist/components/presentation/LabelValue.js +1 -1
  31. package/dist/components/presentation/Result.js +11 -3
  32. package/dist/components/structure/KeyboardAvoidingView.js +9 -2
  33. package/dist/components/theme/ThemePicker.js +7 -12
  34. package/dist/components/theme/ThemeThumb.js +1 -1
  35. package/dist/theme/ThemeHandler.js +31 -3
  36. package/package.json +1 -1
  37. package/src/abstractions/KeyboardDismissView.js +3 -0
  38. package/src/abstractions/KeyboardDismissView.native.js +9 -0
  39. package/src/components/actions/ClearLink.js +6 -0
  40. package/src/components/actions/FloatingMenu.js +1 -1
  41. package/src/components/calendar/CalendarNav.js +6 -6
  42. package/src/components/carousel/Carousel.js +48 -0
  43. package/src/components/carousel/CarouselArrows.js +40 -0
  44. package/src/components/carousel/CarouselArrows.native.js +40 -0
  45. package/src/components/carousel/CarouselDots.js +32 -0
  46. package/src/components/carousel/CarouselDots.native.js +36 -0
  47. package/src/components/carousel/CarouselHandler.js +86 -0
  48. package/src/components/carousel/CarouselSlider.js +124 -0
  49. package/src/components/carousel/CarouselSlider.native.js +110 -0
  50. package/src/components/carousel/InfiniteCarousel.js +50 -0
  51. package/src/components/carousel/index.js +6 -0
  52. package/src/components/form/Form.js +2 -0
  53. package/src/components/index.js +2 -0
  54. package/src/components/inputs/DateInput.js +4 -1
  55. package/src/components/inputs/InputWrapper.js +1 -2
  56. package/src/components/inputs/TextInput.js +5 -4
  57. package/src/components/inputs/datePicker/DayPicker.js +63 -21
  58. package/src/components/inputs/datePicker/MonthPicker.js +50 -26
  59. package/src/components/inputs/datePicker/QuarterPicker.js +50 -26
  60. package/src/components/inputs/datePicker/WeekPicker.js +57 -22
  61. package/src/components/inputs/datePicker/YearPicker.js +58 -34
  62. package/src/components/keyboard/KeyboardDismissButton.js +3 -0
  63. package/src/components/keyboard/KeyboardDismissButton.native.js +38 -0
  64. package/src/components/keyboard/index.js +1 -0
  65. package/src/components/modals/bottomDrawer/native/BottomDrawer.js +27 -6
  66. package/src/components/presentation/LabelValue.js +1 -1
  67. package/src/components/presentation/Result.js +10 -2
  68. package/src/components/structure/KeyboardAvoidingView.js +9 -2
  69. package/src/components/theme/ThemePicker.js +8 -13
  70. package/src/components/theme/ThemeThumb.js +1 -1
  71. package/src/theme/ThemeHandler.js +31 -3
@@ -1,9 +1,11 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/WeekPicker.js";var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled"];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';
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,29 @@ 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
- export function WeekPicker(_ref) {var _value2,_value3,_value4,_this = this;var value = _ref.value,onChange = _ref.onChange,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled,props = _objectWithoutProperties(_ref, _excluded);
16
- var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
17
- 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];
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
- var handleChange = function handleChange(v) {
26
- var newValue = v.startOf('week');
27
- setLocalValue(newValue);
28
- onChange == null ? void 0 : onChange(newValue);
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
- var _useCalendarDays = useCalendarDays(currentMonth),cells = _useCalendarDays.cells;
28
+ function MonthWeeks(_ref) {var _this = this;var month = _ref.month,selectedValue = _ref.selectedValue,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
29
+ var _useCalendarDays = useCalendarDays(month),cells = _useCalendarDays.cells;
32
30
  var weeks = splitEvery(7, cells);
33
31
 
34
32
  return (
35
- _jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
36
- _jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
33
+ _jsxs(View, { children: [
37
34
  _jsx(WeekDaysBar, {}),
38
-
39
35
  _jsx(View, { colSpan: 24 / 7, gap: "sm", children:
40
36
  weeks.map(function (week, wi) {
41
37
  var firstDay = week.find(identity);
42
- var dateVal = currentMonth.date(firstDay);
43
- var isActive = !!value && !!firstDay && dateVal.isSame(value, 'week');
38
+ var dateVal = month.date(firstDay);
39
+ var isActive = !!selectedValue && !!firstDay && dateVal.isSame(selectedValue, 'week');
44
40
  var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
45
41
 
46
42
  return (
@@ -48,13 +44,13 @@ export function WeekPicker(_ref) {var _value2,_value3,_value4,_this = this;var v
48
44
 
49
45
  fullW: true,
50
46
  br: "md",
51
- onPress: function onPress() {return !!firstDay && handleChange(dateVal);},
47
+ onPress: function onPress() {return !!firstDay && onSelect(dateVal);},
52
48
  bg: isActive && 'primary',
53
49
  disabled: disabled, children:
54
50
 
55
51
  _jsx(Row, { colSpan: 24 / 7, gap: "sm", children:
56
52
  week.map(function (day, i) {
57
- var dateVal = currentMonth.date(day);
53
+ var dateVal = month.date(day);
58
54
 
59
55
  return (
60
56
  _jsx(Col, { className: "day-cell", center: true, ratio: 1, children:
@@ -68,7 +64,46 @@ export function WeekPicker(_ref) {var _value2,_value3,_value4,_this = this;var v
68
64
  ));
69
65
 
70
66
  }) }
71
- )] })
67
+ )] }
68
+ ));
69
+
70
+ }
71
+
72
+ export function WeekPicker(_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);
73
+ var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
74
+ 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];
75
+ value = value === undefined ? localValue : value;
76
+
77
+ React.useEffect(function () {var _value;
78
+ setLocalValue(value);
79
+ if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentMonth(value.startOf('month'));
80
+ }, [(_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()]);
81
+
82
+ var handleChange = function handleChange(v) {
83
+ var newValue = v.startOf('week');
84
+ setLocalValue(newValue);
85
+ onChange == null ? void 0 : onChange(newValue);
86
+ };
87
+
88
+ var monthValue = toMonthValue(currentMonth);
89
+ var minMonth = min ? toMonthValue(dayjs(min).startOf('month')) : undefined;
90
+ var maxMonth = max ? toMonthValue(dayjs(max).startOf('month')) : undefined;
91
+
92
+ var renderSlide = function renderSlide(v) {return (
93
+ _jsx(MonthWeeks, { month: fromMonthValue(v), selectedValue: value, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
94
+
95
+
96
+ return (
97
+ _jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
98
+ _jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
99
+ _jsx(InfiniteCarousel, {
100
+ value: monthValue,
101
+ onChange: function onChange(v) {return setCurrentMonth(fromMonthValue(v));},
102
+ renderSlide: renderSlide,
103
+ min: minMonth,
104
+ max: maxMonth }
105
+ ),
106
+ _jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
72
107
  ));
73
108
 
74
109
  }
@@ -1,31 +1,67 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/YearPicker.js";var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled"];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';
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 getDecade(value) {
15
- var year = dayjs(value || undefined).year();
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
- export function YearPicker(_ref) {var _value2,_this = this;var value = _ref.value,onChange = _ref.onChange,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled,props = _objectWithoutProperties(_ref, _excluded);
20
+ function decadeFromIndex(i) {
21
+ return dayjs().year(i * 10).startOf('year');
22
+ }
23
+
24
+ function DecadeGrid(_ref) {var _this = this;var decadeIndex = _ref.decadeIndex,selectedValue = _ref.selectedValue,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
25
+ var decadeStart = decadeFromIndex(decadeIndex);
26
+ var years = range(decadeStart.year(), decadeStart.year() + 10);
27
+
28
+ return (
29
+ _jsx(Grid, { colSpan: 12, gap: "xs", children:
30
+ years.map(function (year) {
31
+ var dateVal = decadeStart.year(year);
32
+ var isActive = !!selectedValue && dateVal.isSame(selectedValue, 'week');
33
+ var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
34
+
35
+ return (
36
+ _jsx(Col, { children:
37
+ _jsx(Link, {
38
+ fullW: true,
39
+ br: "md",
40
+ padding: "sm",
41
+ onPress: function onPress() {return onSelect(dateVal);},
42
+ bg: isActive && 'primary',
43
+ disabled: disabled, children:
44
+
45
+ _jsx(Text, { text2: !isActive, strong: isActive, center: true, children:
46
+ dateVal.year() }
47
+ ) }
48
+ ) }, year
49
+ ));
50
+
51
+ }) }
52
+ ));
53
+
54
+ }
55
+
56
+ export function YearPicker(_ref2) {var _value2,_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
57
  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 getDecade(value);}),_React$useState4 = _slicedToArray(_React$useState3, 2),currentDecade = _React$useState4[0],setCurrentDecade = _React$useState4[1];
58
+ var _React$useState3 = React.useState(function () {return getDecadeIndex(value);}),_React$useState4 = _slicedToArray(_React$useState3, 2),currentDecade = _React$useState4[0],setCurrentDecade = _React$useState4[1];
23
59
 
24
60
  value = value === undefined ? localValue : value;
25
61
 
26
62
  React.useEffect(function () {var _value;
27
63
  setLocalValue(value);
28
- if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentDecade(getDecade(value));
64
+ if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentDecade(getDecadeIndex(value));
29
65
  }, [(_value2 = value) == null ? void 0 : _value2.year == null ? void 0 : _value2.year()]);
30
66
 
31
67
  var handleChange = function handleChange(v) {
@@ -34,37 +70,25 @@ export function YearPicker(_ref) {var _value2,_this = this;var value = _ref.valu
34
70
  onChange == null ? void 0 : onChange(newValue);
35
71
  };
36
72
 
37
- var years = range(currentDecade.year(), currentDecade.year() + 10);
73
+ var minDecade = min ? getDecadeIndex(min) : undefined;
74
+ var maxDecade = max ? getDecadeIndex(max) : undefined;
75
+
76
+ var renderSlide = function renderSlide(v) {return (
77
+ _jsx(DecadeGrid, { decadeIndex: v, selectedValue: value, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
78
+
38
79
 
39
80
  return (
40
81
  _jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
41
- _jsx(CalendarNav, { value: currentDecade, onChange: setCurrentDecade, level: "decade" }),
82
+ _jsx(CalendarNav, { value: decadeFromIndex(currentDecade), onChange: function onChange(v) {return setCurrentDecade(getDecadeIndex(v));}, level: "decade" }),
42
83
  _jsx(Divider, {}),
43
-
44
- _jsx(Grid, { colSpan: 12, gap: "xs", children:
45
- years.map(function (year) {
46
- var dateVal = currentDecade.year(year);
47
- var isActive = !!value && dateVal.isSame(value, 'week');
48
- var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
49
-
50
- return (
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
- )] })
84
+ _jsx(InfiniteCarousel, {
85
+ value: currentDecade,
86
+ onChange: setCurrentDecade,
87
+ renderSlide: renderSlide,
88
+ min: minDecade,
89
+ max: maxDecade }
90
+ ),
91
+ _jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
68
92
  ));
69
93
 
70
94
  }
@@ -0,0 +1,3 @@
1
+ export function KeyboardDismissButton() {
2
+ return false;
3
+ }
@@ -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
- {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$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);
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 currentHeight = SCREEN_HEIGHT - translateY.value;
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: translateY.value }],
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, { children: [
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 || 'text3'
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";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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({ h4: true, center: true }, textProps, titleProps, { children:
57
+ _jsx(Text, Object.assign({ size: size, center: true, color: "text2" }, textProps, titleProps, { children:
50
58
  title })
51
59
  ),
52
60
  !!description &&
@@ -1,6 +1,7 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/structure/KeyboardAvoidingView.js";var _excluded = ["children", "keyboardVerticalOffset"];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 { pipe } from 'ramda';
1
+ var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/structure/KeyboardAvoidingView.js";var _excluded = ["children", "keyboardVerticalOffset", "dismissOnTap"];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 { pipe } from 'ramda';
2
2
 
3
3
  import { AbsKeyboardAvoidingView } from "../../abstractions/KeyboardAvoidingView";
4
+ import { AbsKeyboardDismissView } from "../../abstractions/KeyboardDismissView";
4
5
  import { Platform } from "../../abstractions/Platform";
5
6
  import { useSafeAreaInsets } from "../../abstractions/helpers/useSafeAreaInsets";
6
7
  import { useAnimationModifier } from "../../modifiers/animation";
@@ -19,7 +20,7 @@ import { useSizeModifier } from "../../modifiers/size";
19
20
  import { useStateModifier } from "../../modifiers/state";
20
21
  import { useThemeComponentModifier } from "../../modifiers/themeComponent";import { jsx as _jsx } from "react/jsx-runtime";
21
22
 
22
- export function KeyboardAvoidingView(_ref) {var children = _ref.children,_ref$keyboardVertical = _ref.keyboardVerticalOffset,keyboardVerticalOffset = _ref$keyboardVertical === void 0 ? 0 : _ref$keyboardVertical,rootProps = _objectWithoutProperties(_ref, _excluded);
23
+ export function KeyboardAvoidingView(_ref) {var children = _ref.children,_ref$keyboardVertical = _ref.keyboardVerticalOffset,keyboardVerticalOffset = _ref$keyboardVertical === void 0 ? 0 : _ref$keyboardVertical,_ref$dismissOnTap = _ref.dismissOnTap,dismissOnTap = _ref$dismissOnTap === void 0 ? true : _ref$dismissOnTap,rootProps = _objectWithoutProperties(_ref, _excluded);
23
24
  var _useSafeAreaInsets = useSafeAreaInsets(),bottom = _useSafeAreaInsets.bottom;
24
25
 
25
26
  var _pipe = pipe(
@@ -46,7 +47,13 @@ export function KeyboardAvoidingView(_ref) {var children = _ref.children,_ref$ke
46
47
  keyboardVerticalOffset: keyboardVerticalOffset + bottom },
47
48
  props, { children:
48
49
 
50
+ dismissOnTap ?
51
+ _jsx(AbsKeyboardDismissView, { style: { flex: 1 }, children:
52
+ children }
53
+ ) :
54
+
49
55
  children })
56
+
50
57
  ));
51
58
 
52
59
  }
@@ -1,25 +1,20 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/theme/ThemePicker.js";import { mapObjIndexed, mergeDeepRight, values, pipe, filter } from 'ramda';
1
+ var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/theme/ThemePicker.js";import { mapObjIndexed, values, pipe, reject, propEq } from 'ramda';
2
2
 
3
- import { DEFAULT_THEMES, useThemeHandler } from "../../theme";
3
+ import { useAllThemes, useThemeHandler } from "../../theme";
4
4
  import { IconLabel } from "../presentation";
5
5
  import { Link } from "../actions";
6
6
  import { Picker } from "../inputs";
7
7
  import { ThemeThumb } from "./ThemeThumb";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
 
9
- export function ThemePicker(_ref) {var _this = this;var _onChange = _ref.onChange,onlyKeys = _ref.onlyKeys,hideKeys = _ref.hideKeys;
10
- var _useThemeHandler = useThemeHandler(),activeThemeKey = _useThemeHandler.activeThemeKey,themes = _useThemeHandler.themes,onChangeTheme = _useThemeHandler.onChangeTheme;
9
+ export function ThemePicker(_ref) {var _this = this;var _onChange = _ref.onChange;
10
+ var _useThemeHandler = useThemeHandler(),activeThemeKey = _useThemeHandler.activeThemeKey,onChangeTheme = _useThemeHandler.onChangeTheme;
11
+ var allThemes = useAllThemes();
11
12
 
12
13
  var options = pipe(
13
- mergeDeepRight(DEFAULT_THEMES),
14
14
  mapObjIndexed(function (obj, key) {return Object.assign({}, obj, { value: key, key: key });}),
15
15
  values,
16
- filter(function (item) {
17
- if (item.value === '_all') return false;
18
- if (onlyKeys && onlyKeys.includes(item.value)) return true;
19
- if (hideKeys && hideKeys.includes(item.value)) return false;
20
- return true;
21
- })
22
- )(themes);
16
+ reject(propEq('_all', 'value'))
17
+ )(allThemes);
23
18
 
24
19
  return (
25
20
  _jsx(Picker, {
@@ -4,7 +4,7 @@ import { useResponsiveValue } from "../../responsive";
4
4
  import { useThemeHandler } from "../../theme";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
 
6
6
  export function ThemeThumb(_ref) {var value = _ref.value;
7
- var _useThemeHandler = useThemeHandler(),themes = _useThemeHandler.themes;
7
+ var _useThemeHandler = useThemeHandler(),themes = _useThemeHandler.rawThemesParam;
8
8
  var _useFormattedTheme = useFormattedTheme(themes, value),colors = _useFormattedTheme.colors,label = _useFormattedTheme.label;
9
9
  var isMobile = useResponsiveValue({ smd: true, df: false });
10
10
 
@@ -1,7 +1,8 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/theme/ThemeHandler.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;}import { mergeDeepRight } from 'ramda';
1
+ var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/theme/ThemeHandler.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;}import { keys, mergeDeepRight, omit, pick, pickBy } from 'ramda';
2
2
  import React from 'react';
3
3
 
4
4
  import { DEFAULT_LIGHT_THEME } from "./default/lightTheme";
5
+ import { DEFAULT_THEMES } from "./default/themes";
5
6
  import { getThemeValue } from "./helpers/relatedScales";
6
7
  import { useFormattedTheme } from "./format/formatTheme";import { jsx as _jsx } from "react/jsx-runtime";
7
8
 
@@ -52,8 +53,33 @@ export function useMergeThemeComponent(name, props) {
52
53
  var themeProps = useThemeComponent(name);
53
54
  return mergeDeepRight(themeProps, props);
54
55
  }
56
+ export function useAllThemes() {
57
+ var _useThemeHandler2 = useThemeHandler(),disableDefaultThemes = _useThemeHandler2.disableDefaultThemes,enableOnlyThemes = _useThemeHandler2.enableOnlyThemes,rawThemesParam = _useThemeHandler2.rawThemesParam;
58
+ var themes = rawThemesParam || {};
59
+ var themesParamKeys = keys(themes);
60
+
61
+ var allThemes = mergeDeepRight(DEFAULT_THEMES, themes);
62
+ if (disableDefaultThemes === true) {
63
+ allThemes = pickBy(function (_, key) {return themesParamKeys.includes(key);}, allThemes);
64
+ } else if (disableDefaultThemes != null && disableDefaultThemes.length) {
65
+ allThemes = omit(disableDefaultThemes, allThemes);
66
+ }
67
+ if (enableOnlyThemes != null && enableOnlyThemes.length) {
68
+ allThemes = pick(enableOnlyThemes, allThemes);
69
+ }
70
+
71
+ return allThemes;
72
+ }
73
+
74
+ export function ThemeHandler(_ref)
75
+
76
+
77
+
78
+
79
+
80
+
55
81
 
56
- export function ThemeHandler(_ref) {var breakpoints = _ref.breakpoints,themes = _ref.themes,initTheme = _ref.initTheme,onChangeTheme = _ref.onChangeTheme,children = _ref.children;
82
+ {var breakpoints = _ref.breakpoints,themes = _ref.themes,initTheme = _ref.initTheme,onChangeTheme = _ref.onChangeTheme,children = _ref.children,disableDefaultThemes = _ref.disableDefaultThemes,enableOnlyThemes = _ref.enableOnlyThemes;
57
83
  var _React$useState = React.useState(false),_React$useState2 = _slicedToArray(_React$useState, 2),themePickerOpen = _React$useState2[0],setThemePickerOpen = _React$useState2[1];
58
84
  var openThemePicker = function openThemePicker() {return setThemePickerOpen(true);};
59
85
  var _React$useState3 = React.useState(initTheme || 'light'),_React$useState4 = _slicedToArray(_React$useState3, 2),activeThemeKey = _React$useState4[0],setActiveThemeKey = _React$useState4[1];
@@ -66,7 +92,9 @@ export function ThemeHandler(_ref) {var breakpoints = _ref.breakpoints,themes =
66
92
 
67
93
  var value = {
68
94
  theme: theme,
69
- themes: themes,
95
+ rawThemesParam: themes,
96
+ disableDefaultThemes: disableDefaultThemes,
97
+ enableOnlyThemes: enableOnlyThemes,
70
98
  activeThemeKey: activeThemeKey,
71
99
  toggleTheme: toggleTheme,
72
100
  themePickerOpen: themePickerOpen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neko-os/ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "author": "Christian Storch <ccstorch@gmail.com>",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -0,0 +1,3 @@
1
+ export function AbsKeyboardDismissView({ children }) {
2
+ return children
3
+ }