@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.
Files changed (77) hide show
  1. package/dist/abstractions/KeyboardDismissView.js +3 -0
  2. package/dist/abstractions/KeyboardDismissView.native.js +9 -0
  3. package/dist/abstractions/index.js +1 -0
  4. package/dist/components/actions/ClearLink.js +6 -0
  5. package/dist/components/actions/FloatingMenu.js +1 -1
  6. package/dist/components/calendar/CalendarNav.js +6 -6
  7. package/dist/components/carousel/Carousel.js +48 -0
  8. package/dist/components/carousel/CarouselArrows.js +40 -0
  9. package/dist/components/carousel/CarouselArrows.native.js +40 -0
  10. package/dist/components/carousel/CarouselDots.js +32 -0
  11. package/dist/components/carousel/CarouselDots.native.js +36 -0
  12. package/dist/components/carousel/CarouselHandler.js +86 -0
  13. package/dist/components/carousel/CarouselSlider.js +124 -0
  14. package/dist/components/carousel/CarouselSlider.native.js +121 -0
  15. package/dist/components/carousel/InfiniteCarousel.js +50 -0
  16. package/dist/components/carousel/index.js +6 -0
  17. package/dist/components/form/Form.js +5 -3
  18. package/dist/components/index.js +3 -1
  19. package/dist/components/inputs/DateInput.js +7 -4
  20. package/dist/components/inputs/InputWrapper.js +1 -2
  21. package/dist/components/inputs/Select.js +56 -52
  22. package/dist/components/inputs/TextInput.js +7 -6
  23. package/dist/components/inputs/datePicker/DayPicker.js +71 -23
  24. package/dist/components/inputs/datePicker/MonthPicker.js +61 -32
  25. package/dist/components/inputs/datePicker/QuarterPicker.js +62 -33
  26. package/dist/components/inputs/datePicker/WeekPicker.js +65 -24
  27. package/dist/components/inputs/datePicker/YearPicker.js +69 -40
  28. package/dist/components/keyboard/KeyboardDismissButton.js +3 -0
  29. package/dist/components/keyboard/KeyboardDismissButton.native.js +38 -0
  30. package/dist/components/keyboard/index.js +1 -0
  31. package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +28 -7
  32. package/dist/components/presentation/LabelValue.js +1 -1
  33. package/dist/components/presentation/Result.js +11 -3
  34. package/dist/components/structure/KeyboardAvoidingView.js +9 -2
  35. package/dist/components/theme/ThemePicker.js +7 -12
  36. package/dist/components/theme/ThemeThumb.js +1 -1
  37. package/dist/index.js +1 -0
  38. package/dist/theme/ThemeHandler.js +31 -3
  39. package/package.json +1 -1
  40. package/src/abstractions/KeyboardDismissView.js +3 -0
  41. package/src/abstractions/KeyboardDismissView.native.js +9 -0
  42. package/src/abstractions/index.js +1 -0
  43. package/src/components/actions/ClearLink.js +6 -0
  44. package/src/components/actions/FloatingMenu.js +1 -1
  45. package/src/components/calendar/CalendarNav.js +6 -6
  46. package/src/components/carousel/Carousel.js +48 -0
  47. package/src/components/carousel/CarouselArrows.js +40 -0
  48. package/src/components/carousel/CarouselArrows.native.js +40 -0
  49. package/src/components/carousel/CarouselDots.js +32 -0
  50. package/src/components/carousel/CarouselDots.native.js +36 -0
  51. package/src/components/carousel/CarouselHandler.js +86 -0
  52. package/src/components/carousel/CarouselSlider.js +124 -0
  53. package/src/components/carousel/CarouselSlider.native.js +121 -0
  54. package/src/components/carousel/InfiniteCarousel.js +50 -0
  55. package/src/components/carousel/index.js +6 -0
  56. package/src/components/form/Form.js +2 -0
  57. package/src/components/index.js +2 -0
  58. package/src/components/inputs/DateInput.js +4 -1
  59. package/src/components/inputs/InputWrapper.js +1 -2
  60. package/src/components/inputs/Select.js +19 -15
  61. package/src/components/inputs/TextInput.js +5 -4
  62. package/src/components/inputs/datePicker/DayPicker.js +69 -21
  63. package/src/components/inputs/datePicker/MonthPicker.js +60 -31
  64. package/src/components/inputs/datePicker/QuarterPicker.js +60 -31
  65. package/src/components/inputs/datePicker/WeekPicker.js +63 -22
  66. package/src/components/inputs/datePicker/YearPicker.js +68 -39
  67. package/src/components/keyboard/KeyboardDismissButton.js +3 -0
  68. package/src/components/keyboard/KeyboardDismissButton.native.js +38 -0
  69. package/src/components/keyboard/index.js +1 -0
  70. package/src/components/modals/bottomDrawer/native/BottomDrawer.js +27 -6
  71. package/src/components/presentation/LabelValue.js +1 -1
  72. package/src/components/presentation/Result.js +10 -2
  73. package/src/components/structure/KeyboardAvoidingView.js +9 -2
  74. package/src/components/theme/ThemePicker.js +8 -13
  75. package/src/components/theme/ThemeThumb.js +1 -1
  76. package/src/index.js +1 -0
  77. package/src/theme/ThemeHandler.js +31 -3
@@ -0,0 +1,50 @@
1
+ var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/carousel/InfiniteCarousel.js";var _excluded = ["value", "onChange", "renderSlide", "min", "max"];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
+
3
+ import { Carousel } from "./Carousel";import { jsx as _jsx } from "react/jsx-runtime";
4
+
5
+ function buildItems(value, min, max, renderSlideRef) {
6
+ var items = [];
7
+ if (min === undefined || value - 1 >= min) {
8
+ items.push({ key: value - 1, render: function render() {return renderSlideRef.current(value - 1);} });
9
+ }
10
+ items.push({ key: value, render: function render() {return renderSlideRef.current(value);} });
11
+ if (max === undefined || value + 1 <= max) {
12
+ items.push({ key: value + 1, render: function render() {return renderSlideRef.current(value + 1);} });
13
+ }
14
+ return items;
15
+ }
16
+
17
+ export function InfiniteCarousel(_ref) {var value = _ref.value,onChange = _ref.onChange,renderSlide = _ref.renderSlide,min = _ref.min,max = _ref.max,carouselProps = _objectWithoutProperties(_ref, _excluded);
18
+ var renderSlideRef = React.useRef(renderSlide);
19
+ renderSlideRef.current = renderSlide;
20
+
21
+ var _React$useState = React.useState(function () {return buildItems(value, min, max, renderSlideRef);}),_React$useState2 = _slicedToArray(_React$useState, 2),items = _React$useState2[0],setItems = _React$useState2[1];
22
+ var _React$useState3 = React.useState(value),_React$useState4 = _slicedToArray(_React$useState3, 2),activeKey = _React$useState4[0],setActiveKey = _React$useState4[1];
23
+
24
+ React.useEffect(function () {
25
+ setItems(buildItems(value, min, max, renderSlideRef));
26
+ setActiveKey(value);
27
+ }, [value, min, max]);
28
+
29
+ var handleChange = React.useCallback(function (key) {
30
+ setActiveKey(key);
31
+ }, []);
32
+
33
+ var handleAfterChange = React.useCallback(
34
+ function (key) {
35
+ if (key !== value) onChange == null ? void 0 : onChange(key);
36
+ },
37
+ [value, onChange]
38
+ );
39
+
40
+ return (
41
+ _jsx(Carousel, Object.assign({
42
+ items: items,
43
+ activeKey: activeKey,
44
+ onChange: handleChange,
45
+ afterChange: handleAfterChange,
46
+ draggable: true },
47
+ carouselProps)
48
+ ));
49
+
50
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./CarouselHandler";
2
+ export * from "./Carousel";
3
+ export * from "./CarouselSlider";
4
+ export * from "./CarouselDots";
5
+ export * from "./CarouselArrows";
6
+ export * from "./InfiniteCarousel";
@@ -1,8 +1,9 @@
1
1
  var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/form/Form.js";var _excluded = ["form", "onSubmit", "onValuesChange", "initialValues", "children", "loading", "disabled"];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
 
3
3
  import { FormWrapperComponent } from "./FormWrapperComponent";
4
+ import { KeyboardDismissButton } from "../keyboard/KeyboardDismissButton";
4
5
  import { LoadingView } from "../state/LoadingView";
5
- import { useNewForm } from "./useNewForm";import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { useNewForm } from "./useNewForm";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
7
 
7
8
  var FormContext = React.createContext(null);
8
9
  export var useFormState = function useFormState() {return React.useContext(FormContext);};
@@ -22,8 +23,9 @@ export function Form(_ref) {var form = _ref.form,onSubmit = _ref.onSubmit,onValu
22
23
  return (
23
24
  _jsx(FormContext.Provider, { value: { loading: loading, disabled: disabled, form: form }, children:
24
25
  _jsx(LoadingView, { active: loading, noWrapper: true, children:
25
- _jsx(FormWrapperComponent, Object.assign({ form: form, onSubmit: onSubmit, gap: "md" }, props, { children:
26
- children })
26
+ _jsxs(FormWrapperComponent, Object.assign({ form: form, onSubmit: onSubmit, gap: "md" }, props, { children: [
27
+ children,
28
+ _jsx(KeyboardDismissButton, {})] })
27
29
  ) }
28
30
  ) }
29
31
  ));
@@ -7,6 +7,7 @@ export * from "./modals";
7
7
  export * from "./text";
8
8
  export * from "./helpers";
9
9
  export * from "./inputs";
10
+ export * from "./keyboard";
10
11
  export * from "./state";
11
12
  export * from "./layout";
12
13
  export * from "./table";
@@ -17,4 +18,5 @@ export * from "./tabs";
17
18
  export * from "./theme";
18
19
  export * from "./sections";
19
20
  export * from "./filter";
20
- export * from "./steps";
21
+ export * from "./steps";
22
+ export * from "./carousel";
@@ -1,4 +1,4 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/DateInput.js";var _excluded = ["ref"],_excluded2 = ["value", "onChange", "min", "max", "onCheckDisabled", "placement", "type", "format", "startsOpen", "useBottomDrawer"];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';
1
+ var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/DateInput.js";var _excluded = ["ref"],_excluded2 = ["value", "onChange", "min", "max", "onCheckDisabled", "placement", "type", "format", "startsOpen", "allowClear", "useBottomDrawer"];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 advancedFormat from 'dayjs/esm/plugin/advancedFormat';
3
3
  import dayjs from 'dayjs';
4
4
  import weekOfYear from 'dayjs/esm/plugin/weekOfYear';
@@ -50,7 +50,8 @@ export function DateInput(_ref2)
50
50
 
51
51
 
52
52
 
53
- {var _value,_this = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,placement = _ref2.placement,_ref2$type = _ref2.type,type = _ref2$type === void 0 ? 'day' : _ref2$type,format = _ref2.format,startsOpen = _ref2.startsOpen,_ref2$useBottomDrawer = _ref2.useBottomDrawer,useBottomDrawer = _ref2$useBottomDrawer === void 0 ? { native: true, sm: true, md: true } : _ref2$useBottomDrawer,props = _objectWithoutProperties(_ref2, _excluded2);
53
+
54
+ {var _value,_this = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,placement = _ref2.placement,_ref2$type = _ref2.type,type = _ref2$type === void 0 ? 'day' : _ref2$type,format = _ref2.format,startsOpen = _ref2.startsOpen,allowClear = _ref2.allowClear,_ref2$useBottomDrawer = _ref2.useBottomDrawer,useBottomDrawer = _ref2$useBottomDrawer === void 0 ? { native: true, sm: true, md: true } : _ref2$useBottomDrawer,props = _objectWithoutProperties(_ref2, _excluded2);
54
55
  useBottomDrawer = useResponsiveValue(useBottomDrawer);
55
56
  format = format || getDateInputDefaultFormat(type);
56
57
  if (value === '') value = undefined;
@@ -91,7 +92,7 @@ export function DateInput(_ref2)
91
92
  trigger: "click",
92
93
  startsOpen: startsOpen,
93
94
  placement: placement || 'bottomLeft',
94
- snapPoints: [350],
95
+ snapPoints: [450],
95
96
  useBottomDrawer: useBottomDrawer,
96
97
  bottomDrawerProps: { contentProps: { padding: 'md' } },
97
98
  watch: [(_value = value) == null ? void 0 : _value.format == null ? void 0 : _value.format('YYYYMMDD')],
@@ -102,7 +103,9 @@ export function DateInput(_ref2)
102
103
  onChange: function onChange(v) {
103
104
  handleChange(v);
104
105
  onClose();
105
- } },
106
+ },
107
+ width: useBottomDrawer ? '100%' : 275,
108
+ allowClear: allowClear },
106
109
  validations, {
107
110
  type: type })
108
111
  ) }
@@ -65,8 +65,7 @@ export function InputWrapper(_ref)
65
65
  _jsxs(View, Object.assign({
66
66
  className: "neko-input-wrapper",
67
67
  height: multiline ? undefined : size,
68
- minHeight: multiline ? size : undefined,
69
- paddingV: multiline ? 'sm' : undefined,
68
+ minHeight: multiline ? 1.5 * size : undefined,
70
69
  onPress: handlePress,
71
70
  borderColor: borderColor,
72
71
  onMouseEnter: function onMouseEnter() {return setHover(true);},
@@ -2,6 +2,7 @@ var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/compon
2
2
  import React from 'react';
3
3
 
4
4
  import { Icon, IconLabel } from "../presentation";
5
+ import { KeyboardDismissButton } from "../keyboard";
5
6
  import { Link } from "../actions";
6
7
  import { LinkInput } from "./LinkInput";
7
8
  import { Picker, getOptionLabel, searchOptions } from "./Picker";
@@ -134,58 +135,61 @@ export function Select(_ref2)
134
135
  maxHeight: popoverMaxHeight },
135
136
  popoverProps, {
136
137
  renderContent: function renderContent(_ref3) {var onClose = _ref3.onClose;return (
137
- _jsx(Picker, Object.assign({
138
- row: false,
139
- options: searchOptions(options, search, { labelKey: labelKey }),
140
- value: value,
141
- gap: 0,
142
- maxHeight: !useBottomDrawer && popoverMaxHeight,
143
- useFlatList: true,
144
- onlyOnScreen: true,
145
- itemMinHeight: 30,
146
- onChange: function onChange(v, option) {
147
- handleChange(v, option);
148
- if (!multiple) {
149
- setFocus(false);
150
- onClose();
151
- }
152
- } },
153
- pickerProps, {
154
- renderHeader:
155
- useBottomDrawer && useSearch ?
156
- function () {return (
157
- _jsxs(_Fragment, { children: [
158
- _jsx(View, { padding: "md", paddingB: "xs", children:
159
- _jsx(TextInput, {
160
- prefixIcon: "search-line",
161
- prefixIconColor: "text4",
162
- value: search,
163
- onChange: handleChangeSearch }
164
- ) }
165
- ),
166
- renderHeader == null ? void 0 : renderHeader()] }
167
- ));} :
168
-
169
- renderHeader,
170
-
171
- renderOption: function renderOption(_ref4) {var option = _ref4.option,selected = _ref4.selected,onChange = _ref4.onChange;return (
172
- _jsxs(Link, {
173
- row: true,
174
- paddingH: useBottomDrawer ? 'md' : 'sm',
175
- paddingV: "xs",
176
- minHeight: useBottomDrawer ? 'xl' : 'md',
177
- gap: "sm",
178
- onMouseDown: function onMouseDown(e) {return !!multiple && e.preventDefault();},
179
- onPress: onChange,
180
- centerV: true,
181
- bg: selected && 'primary_op10', children: [
182
-
183
- _jsx(View, { flex: true, row: true, children:
184
- finalRenderOption({ option: option, labelKey: labelKey, selected: selected }) }
185
- ),
186
- selected && _jsx(Icon, { name: "checkbox-circle-fill", primary: true })] }
187
- ));} })
188
-
138
+ _jsxs(_Fragment, { children: [
139
+ useBottomDrawer && useSearch && _jsx(KeyboardDismissButton, {}),
140
+ _jsx(Picker, Object.assign({
141
+ row: false,
142
+ options: searchOptions(options, search, { labelKey: labelKey }),
143
+ value: value,
144
+ gap: 0,
145
+ maxHeight: !useBottomDrawer && popoverMaxHeight,
146
+ useFlatList: true,
147
+ onlyOnScreen: true,
148
+ itemMinHeight: 30,
149
+ onChange: function onChange(v, option) {
150
+ handleChange(v, option);
151
+ if (!multiple) {
152
+ setFocus(false);
153
+ onClose();
154
+ }
155
+ } },
156
+ pickerProps, {
157
+ renderHeader:
158
+ useBottomDrawer && useSearch ?
159
+ _jsxs(_Fragment, { children: [
160
+ _jsx(View, { padding: "md", paddingB: "xs", children:
161
+ _jsx(TextInput, {
162
+ prefixIcon: "search-line",
163
+ prefixIconColor: "text4",
164
+ value: search,
165
+ onChange: handleChangeSearch }
166
+ ) }
167
+ ),
168
+ renderHeader == null ? void 0 : renderHeader()] }
169
+ ) :
170
+
171
+ renderHeader,
172
+
173
+
174
+ renderOption: function renderOption(_ref4) {var option = _ref4.option,selected = _ref4.selected,onChange = _ref4.onChange;return (
175
+ _jsxs(Link, {
176
+ row: true,
177
+ paddingH: useBottomDrawer ? 'md' : 'sm',
178
+ paddingV: "xs",
179
+ minHeight: useBottomDrawer ? 'xl' : 'md',
180
+ gap: "sm",
181
+ onMouseDown: function onMouseDown(e) {return !!multiple && e.preventDefault();},
182
+ onPress: onChange,
183
+ centerV: true,
184
+ bg: selected && 'primary_op10', children: [
185
+
186
+ _jsx(View, { flex: true, row: true, children:
187
+ finalRenderOption({ option: option, labelKey: labelKey, selected: selected }) }
188
+ ),
189
+ selected && _jsx(Icon, { name: "checkbox-circle-fill", primary: true })] }
190
+ ));} })
191
+
192
+ )] }
189
193
  ));}, children:
190
194
 
191
195
 
@@ -1,20 +1,21 @@
1
1
  var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/TextInput.js";var _excluded = ["onChange", "multiline", "rows"];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 { AbsTextInput } from "../../abstractions/TextInput";
2
2
  import { InputWrapper } from "./InputWrapper";
3
- import { useColors } from "../../theme/ThemeHandler";import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useColors } from "../../theme/ThemeHandler";
4
+ import { useSpaces } from "../../theme";import { jsx as _jsx } from "react/jsx-runtime";
4
5
 
5
6
  export function TextInput(_ref) {var onChange = _ref.onChange,multiline = _ref.multiline,rows = _ref.rows,props = _objectWithoutProperties(_ref, _excluded);
6
7
  var colors = useColors();
8
+ var spaces = useSpaces();
7
9
 
8
10
  var STYLE = Object.assign({
9
11
  width: '100%',
10
12
  borderWidth: 0,
11
13
  background: 'transparent',
12
14
  outline: 'none',
13
- color: colors.text },
14
-
15
-
16
-
17
- multiline ? { resize: 'none' } : { height: '100%' });
15
+ color: colors.text,
16
+ flex: 1,
17
+ height: '100%' },
18
+ multiline ? { paddingTop: spaces.sm, resize: 'none', flex: 1, textAlignVertical: 'top' } : {});
18
19
 
19
20
 
20
21
  return (
@@ -1,9 +1,11 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/DayPicker.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 React from 'react';
1
+ var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled", "allowClear"];var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/DayPicker.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
 
4
4
  import { CalendarNav } from "../../calendar/CalendarNav";
5
+ import { ClearLink } from "../../actions/ClearLink";
5
6
  import { Col } from "../../structure/Col";
6
7
  import { Grid } from "../../structure/Row";
8
+ import { InfiniteCarousel } from "../../carousel/InfiniteCarousel";
7
9
  import { Link } from "../../actions/Link";
8
10
  import { Text } from "../../text/Text";
9
11
  import { View } from "../../structure/View";
@@ -11,33 +13,29 @@ import { WeekDaysBar } from "../../calendar/WeekDaysBar";
11
13
  import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";
12
14
  import { useCalendarDays } from "../../calendar/_helpers/calendarDays";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
15
 
14
- export function DayPicker(_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);
15
- if (!!value) value = dayjs(value);
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;
16
+ function toMonthValue(date) {
17
+ return date.year() * 12 + date.month();
18
+ }
19
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()]);
20
+ function fromMonthValue(v) {
21
+ return dayjs().
22
+ year(Math.floor(v / 12)).
23
+ month(v % 12).
24
+ startOf('month');
25
+ }
24
26
 
25
- var handleChange = function handleChange(v) {
26
- setLocalValue(v);
27
- onChange == null ? void 0 : onChange(v);
28
- };
29
-
30
- var _useCalendarDays = useCalendarDays(currentMonth),cells = _useCalendarDays.cells;
27
+ var MonthDays = React.memo(function MonthDays(_ref) {var _this = this;var monthValue = _ref.monthValue,selectedKey = _ref.selectedKey,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
28
+ var month = fromMonthValue(monthValue);
29
+ var selectedValue = selectedKey ? dayjs(selectedKey) : null;
30
+ var _useCalendarDays = useCalendarDays(month),cells = _useCalendarDays.cells;
31
31
 
32
32
  return (
33
- _jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
34
- _jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
33
+ _jsxs(View, { children: [
35
34
  _jsx(WeekDaysBar, {}),
36
-
37
35
  _jsx(Grid, { className: "neko-day-picker-days", colSpan: 24 / 7, gap: "sm", children:
38
36
  cells.map(function (day, i) {
39
- var dateVal = currentMonth.date(day);
40
- var isActive = !!value && !!day && dateVal.isSame(value, 'day');
37
+ var dateVal = month.date(day);
38
+ var isActive = !!selectedValue && !!day && dateVal.isSame(selectedValue, 'day');
41
39
  var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
42
40
 
43
41
  return (
@@ -47,7 +45,7 @@ export function DayPicker(_ref) {var _value2,_value3,_value4,_this = this;var va
47
45
  fullW: true,
48
46
  center: true,
49
47
  br: "md",
50
- onPress: function onPress() {return !!day && handleChange(dateVal);},
48
+ onPress: function onPress() {return !!day && onSelect(dateVal);},
51
49
  bg: isActive && 'primary',
52
50
  disabled: disabled, children:
53
51
 
@@ -58,7 +56,57 @@ export function DayPicker(_ref) {var _value2,_value3,_value4,_this = this;var va
58
56
  ));
59
57
 
60
58
  }) }
61
- )] })
59
+ )] }
60
+ ));
61
+
62
+ });
63
+
64
+ export function DayPicker(_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);
65
+ if (!!value) value = dayjs(value);
66
+ var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
67
+ 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];
68
+ value = value === undefined ? localValue : value;
69
+
70
+ React.useEffect(function () {var _value;
71
+ setLocalValue(value);
72
+ if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentMonth(value.startOf('month'));
73
+ }, [(_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()]);
74
+
75
+ var handleChange = React.useCallback(
76
+ function (v) {
77
+ setLocalValue(v);
78
+ onChange == null ? void 0 : onChange(v);
79
+ },
80
+ [onChange]
81
+ );
82
+
83
+ var monthValue = toMonthValue(currentMonth);
84
+ var minMonth = min ? toMonthValue(dayjs(min).startOf('month')) : undefined;
85
+ var maxMonth = max ? toMonthValue(dayjs(max).startOf('month')) : undefined;
86
+ var selectedKey = (_value5 = value) == null ? void 0 : _value5.valueOf == null ? void 0 : _value5.valueOf();
87
+
88
+ var renderSlide = function renderSlide(v) {return (
89
+ _jsx(MonthDays, {
90
+ monthValue: v,
91
+ selectedKey: selectedKey,
92
+ onSelect: handleChange,
93
+ min: min,
94
+ max: max,
95
+ onCheckDisabled: onCheckDisabled }
96
+ ));};
97
+
98
+
99
+ return (
100
+ _jsxs(View, Object.assign({ className: "neko-day-picker", width: 275, maxW: 350 }, props, { children: [
101
+ _jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
102
+ _jsx(InfiniteCarousel, {
103
+ value: monthValue,
104
+ onChange: function onChange(v) {return setCurrentMonth(fromMonthValue(v));},
105
+ renderSlide: renderSlide,
106
+ min: minMonth,
107
+ max: maxMonth }
108
+ ),
109
+ _jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
62
110
  ));
63
111
 
64
112
  }
@@ -1,10 +1,12 @@
1
- var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/MonthPicker.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 React from 'react';
1
+ var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled", "allowClear"];var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/MonthPicker.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
 
4
4
  import { CalendarNav } from "../../calendar/CalendarNav";
5
+ import { ClearLink } from "../../actions/ClearLink";
5
6
  import { Col } from "../../structure/Col";
6
7
  import { Divider } from "../../helpers";
7
8
  import { Grid } from "../../structure/Row";
9
+ import { InfiniteCarousel } from "../../carousel/InfiniteCarousel";
8
10
  import { Link } from "../../actions/Link";
9
11
  import { Text } from "../../text/Text";
10
12
  import { View } from "../../structure/View";
@@ -12,7 +14,39 @@ import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";import { j
12
14
 
13
15
  var months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
14
16
 
15
- export function MonthPicker(_ref) {var _value2,_value3,_this = this;var value = _ref.value,onChange = _ref.onChange,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled,props = _objectWithoutProperties(_ref, _excluded);
17
+ var MonthGrid = React.memo(function MonthGrid(_ref) {var _this = this;var year = _ref.year,selectedKey = _ref.selectedKey,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
18
+ var yearDate = dayjs().year(year).startOf('year');
19
+ var selectedValue = selectedKey ? dayjs(selectedKey) : null;
20
+
21
+ return (
22
+ _jsx(Grid, { colSpan: 8, gap: "xs", children:
23
+ months.map(function (month) {
24
+ var dateVal = yearDate.month(month);
25
+ var isActive = !!selectedValue && dateVal.isSame(selectedValue, 'month');
26
+ var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
27
+
28
+ return (
29
+ _jsx(Col, { children:
30
+ _jsx(Link, {
31
+ fullW: true,
32
+ br: "md",
33
+ padding: "sm",
34
+ onPress: function onPress() {return onSelect(dateVal);},
35
+ bg: isActive && 'primary',
36
+ disabled: disabled, children:
37
+
38
+ _jsx(Text, { text2: !isActive, strong: isActive, center: true, children:
39
+ dateVal.format('MMM') }
40
+ ) }
41
+ ) }, month
42
+ ));
43
+
44
+ }) }
45
+ ));
46
+
47
+ });
48
+
49
+ export function MonthPicker(_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);
16
50
  var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
17
51
  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];
18
52
  value = value === undefined ? localValue : value;
@@ -22,41 +56,36 @@ export function MonthPicker(_ref) {var _value2,_value3,_this = this;var value =
22
56
  if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentYear(value.startOf('year'));
23
57
  }, [(_value2 = value) == null ? void 0 : _value2.month == null ? void 0 : _value2.month(), (_value3 = value) == null ? void 0 : _value3.year == null ? void 0 : _value3.year()]);
24
58
 
25
- var handleChange = function handleChange(v) {
26
- var newValue = v.startOf('month');
27
- setLocalValue(newValue);
28
- onChange == null ? void 0 : onChange(newValue);
29
- };
59
+ var handleChange = React.useCallback(
60
+ function (v) {
61
+ var newValue = v.startOf('month');
62
+ setLocalValue(newValue);
63
+ onChange == null ? void 0 : onChange(newValue);
64
+ },
65
+ [onChange]
66
+ );
67
+
68
+ var yearValue = currentYear.year();
69
+ var minYear = min ? dayjs(min).year() : undefined;
70
+ var maxYear = max ? dayjs(max).year() : undefined;
71
+ var selectedKey = (_value4 = value) == null ? void 0 : _value4.valueOf == null ? void 0 : _value4.valueOf();
72
+
73
+ var renderSlide = function renderSlide(v) {return (
74
+ _jsx(MonthGrid, { year: v, selectedKey: selectedKey, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
75
+
30
76
 
31
77
  return (
32
78
  _jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
33
79
  _jsx(CalendarNav, { value: currentYear, onChange: setCurrentYear, level: "year" }),
34
80
  _jsx(Divider, {}),
35
-
36
- _jsx(Grid, { colSpan: 8, gap: "xs", children:
37
- months.map(function (month) {
38
- var dateVal = currentYear.month(month);
39
- var isActive = !!value && dateVal.isSame(value, 'week');
40
- var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
41
-
42
- return (
43
- _jsx(Col, { children:
44
- _jsx(Link, {
45
- fullW: true,
46
- br: "md",
47
- padding: "sm",
48
- onPress: function onPress() {return handleChange(dateVal);},
49
- bg: isActive && 'primary',
50
- disabled: disabled, children:
51
-
52
- _jsx(Text, { text2: !isActive, strong: isActive, center: true, children:
53
- dateVal.format('MMM') }
54
- ) }
55
- ) }, month
56
- ));
57
-
58
- }) }
59
- )] })
81
+ _jsx(InfiniteCarousel, {
82
+ value: yearValue,
83
+ onChange: function onChange(v) {return setCurrentYear(dayjs().year(v).startOf('year'));},
84
+ renderSlide: renderSlide,
85
+ min: minYear,
86
+ max: maxYear }
87
+ ),
88
+ _jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
60
89
  ));
61
90
 
62
91
  }