@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.
- package/dist/abstractions/KeyboardDismissView.js +3 -0
- package/dist/abstractions/KeyboardDismissView.native.js +9 -0
- package/dist/components/actions/ClearLink.js +6 -0
- package/dist/components/actions/FloatingMenu.js +1 -1
- package/dist/components/calendar/CalendarNav.js +6 -6
- package/dist/components/carousel/Carousel.js +48 -0
- package/dist/components/carousel/CarouselArrows.js +40 -0
- package/dist/components/carousel/CarouselArrows.native.js +40 -0
- package/dist/components/carousel/CarouselDots.js +32 -0
- package/dist/components/carousel/CarouselDots.native.js +36 -0
- package/dist/components/carousel/CarouselHandler.js +86 -0
- package/dist/components/carousel/CarouselSlider.js +124 -0
- package/dist/components/carousel/CarouselSlider.native.js +110 -0
- package/dist/components/carousel/InfiniteCarousel.js +50 -0
- package/dist/components/carousel/index.js +6 -0
- package/dist/components/form/Form.js +5 -3
- package/dist/components/index.js +3 -1
- package/dist/components/inputs/DateInput.js +7 -4
- package/dist/components/inputs/InputWrapper.js +1 -2
- package/dist/components/inputs/TextInput.js +7 -6
- package/dist/components/inputs/datePicker/DayPicker.js +65 -23
- package/dist/components/inputs/datePicker/MonthPicker.js +51 -27
- package/dist/components/inputs/datePicker/QuarterPicker.js +52 -28
- package/dist/components/inputs/datePicker/WeekPicker.js +59 -24
- package/dist/components/inputs/datePicker/YearPicker.js +59 -35
- package/dist/components/keyboard/KeyboardDismissButton.js +3 -0
- package/dist/components/keyboard/KeyboardDismissButton.native.js +38 -0
- package/dist/components/keyboard/index.js +1 -0
- package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +28 -7
- package/dist/components/presentation/LabelValue.js +1 -1
- package/dist/components/presentation/Result.js +11 -3
- package/dist/components/structure/KeyboardAvoidingView.js +9 -2
- package/dist/components/theme/ThemePicker.js +7 -12
- package/dist/components/theme/ThemeThumb.js +1 -1
- package/dist/theme/ThemeHandler.js +31 -3
- package/package.json +1 -1
- package/src/abstractions/KeyboardDismissView.js +3 -0
- package/src/abstractions/KeyboardDismissView.native.js +9 -0
- package/src/components/actions/ClearLink.js +6 -0
- package/src/components/actions/FloatingMenu.js +1 -1
- package/src/components/calendar/CalendarNav.js +6 -6
- package/src/components/carousel/Carousel.js +48 -0
- package/src/components/carousel/CarouselArrows.js +40 -0
- package/src/components/carousel/CarouselArrows.native.js +40 -0
- package/src/components/carousel/CarouselDots.js +32 -0
- package/src/components/carousel/CarouselDots.native.js +36 -0
- package/src/components/carousel/CarouselHandler.js +86 -0
- package/src/components/carousel/CarouselSlider.js +124 -0
- package/src/components/carousel/CarouselSlider.native.js +110 -0
- package/src/components/carousel/InfiniteCarousel.js +50 -0
- package/src/components/carousel/index.js +6 -0
- package/src/components/form/Form.js +2 -0
- package/src/components/index.js +2 -0
- package/src/components/inputs/DateInput.js +4 -1
- package/src/components/inputs/InputWrapper.js +1 -2
- package/src/components/inputs/TextInput.js +5 -4
- package/src/components/inputs/datePicker/DayPicker.js +63 -21
- package/src/components/inputs/datePicker/MonthPicker.js +50 -26
- package/src/components/inputs/datePicker/QuarterPicker.js +50 -26
- package/src/components/inputs/datePicker/WeekPicker.js +57 -22
- package/src/components/inputs/datePicker/YearPicker.js +58 -34
- package/src/components/keyboard/KeyboardDismissButton.js +3 -0
- package/src/components/keyboard/KeyboardDismissButton.native.js +38 -0
- package/src/components/keyboard/index.js +1 -0
- package/src/components/modals/bottomDrawer/native/BottomDrawer.js +27 -6
- package/src/components/presentation/LabelValue.js +1 -1
- package/src/components/presentation/Result.js +10 -2
- package/src/components/structure/KeyboardAvoidingView.js +9 -2
- package/src/components/theme/ThemePicker.js +8 -13
- package/src/components/theme/ThemeThumb.js +1 -1
- package/src/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
|
+
}
|
|
@@ -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
|
-
|
|
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
|
));
|
package/dist/components/index.js
CHANGED
|
@@ -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
|
-
|
|
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: [
|
|
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);},
|
|
@@ -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";
|
|
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";
|
|
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,27 @@ 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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
function fromMonthValue(v) {
|
|
21
|
+
return dayjs().
|
|
22
|
+
year(Math.floor(v / 12)).
|
|
23
|
+
month(v % 12).
|
|
24
|
+
startOf('month');
|
|
25
|
+
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
onChange == null ? void 0 : onChange(v);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var _useCalendarDays = useCalendarDays(currentMonth),cells = _useCalendarDays.cells;
|
|
27
|
+
function MonthDays(_ref) {var _this = this;var month = _ref.month,selectedValue = _ref.selectedValue,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
|
|
28
|
+
var _useCalendarDays = useCalendarDays(month),cells = _useCalendarDays.cells;
|
|
31
29
|
|
|
32
30
|
return (
|
|
33
|
-
_jsxs(View,
|
|
34
|
-
_jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
|
|
31
|
+
_jsxs(View, { children: [
|
|
35
32
|
_jsx(WeekDaysBar, {}),
|
|
36
|
-
|
|
37
33
|
_jsx(Grid, { className: "neko-day-picker-days", colSpan: 24 / 7, gap: "sm", children:
|
|
38
34
|
cells.map(function (day, i) {
|
|
39
|
-
var dateVal =
|
|
40
|
-
var isActive = !!
|
|
35
|
+
var dateVal = month.date(day);
|
|
36
|
+
var isActive = !!selectedValue && !!day && dateVal.isSame(selectedValue, 'day');
|
|
41
37
|
var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
|
|
42
38
|
|
|
43
39
|
return (
|
|
@@ -47,7 +43,7 @@ export function DayPicker(_ref) {var _value2,_value3,_value4,_this = this;var va
|
|
|
47
43
|
fullW: true,
|
|
48
44
|
center: true,
|
|
49
45
|
br: "md",
|
|
50
|
-
onPress: function onPress() {return !!day &&
|
|
46
|
+
onPress: function onPress() {return !!day && onSelect(dateVal);},
|
|
51
47
|
bg: isActive && 'primary',
|
|
52
48
|
disabled: disabled, children:
|
|
53
49
|
|
|
@@ -58,7 +54,53 @@ export function DayPicker(_ref) {var _value2,_value3,_value4,_this = this;var va
|
|
|
58
54
|
));
|
|
59
55
|
|
|
60
56
|
}) }
|
|
61
|
-
)] }
|
|
57
|
+
)] }
|
|
58
|
+
));
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function DayPicker(_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);
|
|
63
|
+
if (!!value) value = dayjs(value);
|
|
64
|
+
var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
65
|
+
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];
|
|
66
|
+
value = value === undefined ? localValue : value;
|
|
67
|
+
|
|
68
|
+
React.useEffect(function () {var _value;
|
|
69
|
+
setLocalValue(value);
|
|
70
|
+
if ((_value = value) != null && _value.isValid != null && _value.isValid()) setCurrentMonth(value.startOf('month'));
|
|
71
|
+
}, [(_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()]);
|
|
72
|
+
|
|
73
|
+
var handleChange = function handleChange(v) {
|
|
74
|
+
setLocalValue(v);
|
|
75
|
+
onChange == null ? void 0 : onChange(v);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var monthValue = toMonthValue(currentMonth);
|
|
79
|
+
var minMonth = min ? toMonthValue(dayjs(min).startOf('month')) : undefined;
|
|
80
|
+
var maxMonth = max ? toMonthValue(dayjs(max).startOf('month')) : undefined;
|
|
81
|
+
|
|
82
|
+
var renderSlide = function renderSlide(v) {return (
|
|
83
|
+
_jsx(MonthDays, {
|
|
84
|
+
month: fromMonthValue(v),
|
|
85
|
+
selectedValue: value,
|
|
86
|
+
onSelect: handleChange,
|
|
87
|
+
min: min,
|
|
88
|
+
max: max,
|
|
89
|
+
onCheckDisabled: onCheckDisabled }
|
|
90
|
+
));};
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
_jsxs(View, Object.assign({ className: "neko-day-picker", width: 275, maxW: 350 }, props, { children: [
|
|
95
|
+
_jsx(CalendarNav, { value: currentMonth, onChange: setCurrentMonth }),
|
|
96
|
+
_jsx(InfiniteCarousel, {
|
|
97
|
+
value: monthValue,
|
|
98
|
+
onChange: function onChange(v) {return setCurrentMonth(fromMonthValue(v));},
|
|
99
|
+
renderSlide: renderSlide,
|
|
100
|
+
min: minMonth,
|
|
101
|
+
max: maxMonth }
|
|
102
|
+
),
|
|
103
|
+
_jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
|
|
62
104
|
));
|
|
63
105
|
|
|
64
106
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/MonthPicker.js";
|
|
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,38 @@ 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
|
-
|
|
17
|
+
function MonthGrid(_ref) {var _this = this;var year = _ref.year,selectedValue = _ref.selectedValue,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
|
|
18
|
+
var yearDate = dayjs().year(year).startOf('year');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
_jsx(Grid, { colSpan: 8, gap: "xs", children:
|
|
22
|
+
months.map(function (month) {
|
|
23
|
+
var dateVal = yearDate.month(month);
|
|
24
|
+
var isActive = !!selectedValue && dateVal.isSame(selectedValue, 'week');
|
|
25
|
+
var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
_jsx(Col, { children:
|
|
29
|
+
_jsx(Link, {
|
|
30
|
+
fullW: true,
|
|
31
|
+
br: "md",
|
|
32
|
+
padding: "sm",
|
|
33
|
+
onPress: function onPress() {return onSelect(dateVal);},
|
|
34
|
+
bg: isActive && 'primary',
|
|
35
|
+
disabled: disabled, children:
|
|
36
|
+
|
|
37
|
+
_jsx(Text, { text2: !isActive, strong: isActive, center: true, children:
|
|
38
|
+
dateVal.format('MMM') }
|
|
39
|
+
) }
|
|
40
|
+
) }, month
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
}) }
|
|
44
|
+
));
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function MonthPicker(_ref2) {var _value2,_value3,_this2 = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,allowClear = _ref2.allowClear,props = _objectWithoutProperties(_ref2, _excluded);
|
|
16
49
|
var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
17
50
|
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
51
|
value = value === undefined ? localValue : value;
|
|
@@ -28,35 +61,26 @@ export function MonthPicker(_ref) {var _value2,_value3,_this = this;var value =
|
|
|
28
61
|
onChange == null ? void 0 : onChange(newValue);
|
|
29
62
|
};
|
|
30
63
|
|
|
64
|
+
var yearValue = currentYear.year();
|
|
65
|
+
var minYear = min ? dayjs(min).year() : undefined;
|
|
66
|
+
var maxYear = max ? dayjs(max).year() : undefined;
|
|
67
|
+
|
|
68
|
+
var renderSlide = function renderSlide(v) {return (
|
|
69
|
+
_jsx(MonthGrid, { year: v, selectedValue: value, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
|
|
70
|
+
|
|
71
|
+
|
|
31
72
|
return (
|
|
32
73
|
_jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
|
|
33
74
|
_jsx(CalendarNav, { value: currentYear, onChange: setCurrentYear, level: "year" }),
|
|
34
75
|
_jsx(Divider, {}),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
)] })
|
|
76
|
+
_jsx(InfiniteCarousel, {
|
|
77
|
+
value: yearValue,
|
|
78
|
+
onChange: function onChange(v) {return setCurrentYear(dayjs().year(v).startOf('year'));},
|
|
79
|
+
renderSlide: renderSlide,
|
|
80
|
+
min: minYear,
|
|
81
|
+
max: maxYear }
|
|
82
|
+
),
|
|
83
|
+
_jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
|
|
60
84
|
));
|
|
61
85
|
|
|
62
86
|
}
|
|
@@ -1,21 +1,54 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/QuarterPicker.js";
|
|
1
|
+
var _excluded = ["value", "onChange", "min", "max", "onCheckDisabled", "allowClear"];var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/inputs/datePicker/QuarterPicker.js";function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import React from 'react';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import quarterOfYear from 'dayjs/esm/plugin/quarterOfYear';
|
|
4
4
|
|
|
5
5
|
import { CalendarNav } from "../../calendar/CalendarNav";
|
|
6
|
+
import { ClearLink } from "../../actions/ClearLink";
|
|
6
7
|
import { Col } from "../../structure/Col";
|
|
7
8
|
import { Divider } from "../../helpers";
|
|
8
9
|
import { Grid } from "../../structure/Row";
|
|
10
|
+
import { InfiniteCarousel } from "../../carousel/InfiniteCarousel";
|
|
9
11
|
import { Link } from "../../actions/Link";
|
|
10
12
|
import { Text } from "../../text/Text";
|
|
11
13
|
import { View } from "../../structure/View";
|
|
12
|
-
import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";import {
|
|
14
|
+
import { isDateDisabled } from "../../calendar/_helpers/dateDisabled";import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
15
|
|
|
14
16
|
dayjs.extend(quarterOfYear);
|
|
15
17
|
|
|
16
18
|
var quarters = [1, 2, 3, 4];
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
function QuarterGrid(_ref) {var _this = this;var year = _ref.year,selectedValue = _ref.selectedValue,onSelect = _ref.onSelect,min = _ref.min,max = _ref.max,onCheckDisabled = _ref.onCheckDisabled;
|
|
21
|
+
var yearDate = dayjs().year(year).startOf('year');
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
_jsx(Grid, { colSpan: 6, gap: "xs", children:
|
|
25
|
+
quarters.map(function (quarter) {
|
|
26
|
+
var dateVal = yearDate.quarter(quarter);
|
|
27
|
+
var isActive = !!selectedValue && dateVal.isSame(selectedValue, 'week');
|
|
28
|
+
var disabled = isDateDisabled(dateVal, { min: min, max: max, onCheckDisabled: onCheckDisabled });
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
_jsx(Col, { children:
|
|
32
|
+
_jsx(Link, {
|
|
33
|
+
fullW: true,
|
|
34
|
+
br: "md",
|
|
35
|
+
padding: "sm",
|
|
36
|
+
onPress: function onPress() {return onSelect(dateVal);},
|
|
37
|
+
bg: isActive && 'primary',
|
|
38
|
+
disabled: disabled, children:
|
|
39
|
+
|
|
40
|
+
_jsxs(Text, { text2: !isActive, strong: isActive, center: true, children: ["Q",
|
|
41
|
+
dateVal.quarter()] }
|
|
42
|
+
) }
|
|
43
|
+
) }, quarter
|
|
44
|
+
));
|
|
45
|
+
|
|
46
|
+
}) }
|
|
47
|
+
));
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function QuarterPicker(_ref2) {var _value2,_value3,_this2 = this;var value = _ref2.value,onChange = _ref2.onChange,min = _ref2.min,max = _ref2.max,onCheckDisabled = _ref2.onCheckDisabled,allowClear = _ref2.allowClear,props = _objectWithoutProperties(_ref2, _excluded);
|
|
19
52
|
var _React$useState = React.useState(value),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
20
53
|
var _React$useState3 = React.useState(function () {return dayjs(value || undefined).startOf('year');}),_React$useState4 = _slicedToArray(_React$useState3, 2),currentYear = _React$useState4[0],setCurrentYear = _React$useState4[1];
|
|
21
54
|
value = value === undefined ? localValue : value;
|
|
@@ -31,35 +64,26 @@ export function QuarterPicker(_ref) {var _value2,_value3,_this = this;var value
|
|
|
31
64
|
onChange == null ? void 0 : onChange(newValue);
|
|
32
65
|
};
|
|
33
66
|
|
|
67
|
+
var yearValue = currentYear.year();
|
|
68
|
+
var minYear = min ? dayjs(min).year() : undefined;
|
|
69
|
+
var maxYear = max ? dayjs(max).year() : undefined;
|
|
70
|
+
|
|
71
|
+
var renderSlide = function renderSlide(v) {return (
|
|
72
|
+
_jsx(QuarterGrid, { year: v, selectedValue: value, onSelect: handleChange, min: min, max: max, onCheckDisabled: onCheckDisabled }));};
|
|
73
|
+
|
|
74
|
+
|
|
34
75
|
return (
|
|
35
76
|
_jsxs(View, Object.assign({ className: "neko-day-picker", width: 275 }, props, { children: [
|
|
36
77
|
_jsx(CalendarNav, { value: currentYear, onChange: setCurrentYear, level: "year" }),
|
|
37
78
|
_jsx(Divider, {}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_jsx(Col, { children:
|
|
47
|
-
_jsx(Link, {
|
|
48
|
-
fullW: true,
|
|
49
|
-
br: "md",
|
|
50
|
-
padding: "sm",
|
|
51
|
-
onPress: function onPress() {return handleChange(dateVal);},
|
|
52
|
-
bg: isActive && 'primary',
|
|
53
|
-
disabled: disabled, children:
|
|
54
|
-
|
|
55
|
-
_jsxs(Text, { text2: !isActive, strong: isActive, center: true, children: ["Q",
|
|
56
|
-
dateVal.quarter()] }
|
|
57
|
-
) }
|
|
58
|
-
) }, quarter
|
|
59
|
-
));
|
|
60
|
-
|
|
61
|
-
}) }
|
|
62
|
-
)] })
|
|
79
|
+
_jsx(InfiniteCarousel, {
|
|
80
|
+
value: yearValue,
|
|
81
|
+
onChange: function onChange(v) {return setCurrentYear(dayjs().year(v).startOf('year'));},
|
|
82
|
+
renderSlide: renderSlide,
|
|
83
|
+
min: minYear,
|
|
84
|
+
max: maxYear }
|
|
85
|
+
),
|
|
86
|
+
_jsx(ClearLink, { hide: !allowClear, value: value, onChange: onChange })] })
|
|
63
87
|
));
|
|
64
88
|
|
|
65
89
|
}
|