@neko-os/ui 0.5.4 → 0.6.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/NekoUI.js +12 -9
- package/dist/abstractions/WindowOverlay.js +3 -0
- package/dist/abstractions/WindowOverlay.native.js +21 -0
- package/dist/abstractions/helpers/storage.js +14 -4
- package/dist/abstractions/helpers/storage.native.js +9 -1
- package/dist/components/feedback/notifications/NotificationsHandler.js +10 -6
- package/dist/components/index.js +3 -1
- package/dist/components/inputs/DateInput.js +10 -6
- package/dist/components/inputs/InputWrapper.js +2 -3
- package/dist/components/inputs/NumberWheelInput.js +50 -0
- package/dist/components/inputs/NumberWheelPicker.js +43 -0
- package/dist/components/inputs/UploadInput.js +4 -4
- package/dist/components/inputs/WheelPicker.js +49 -0
- package/dist/components/inputs/WheelPicker.native.js +88 -0
- package/dist/components/inputs/WheelPicker.web.js +1 -0
- package/dist/components/inputs/dateWheelPicker/DateWheelPicker.js +24 -0
- package/dist/components/inputs/dateWheelPicker/DayWheelPicker.js +48 -0
- package/dist/components/inputs/dateWheelPicker/MonthWheelPicker.js +19 -0
- package/dist/components/inputs/dateWheelPicker/QuarterWheelPicker.js +61 -0
- package/dist/components/inputs/dateWheelPicker/WeekWheelPicker.js +66 -0
- package/dist/components/inputs/dateWheelPicker/YearWheelPicker.js +35 -0
- package/dist/components/inputs/index.js +5 -1
- package/dist/components/inputs/upload/Upload.native.js +60 -52
- package/dist/components/inputs/upload/useUploadState.js +11 -3
- package/dist/components/measurements/FeetInchesInput.js +91 -0
- package/dist/components/measurements/LengthInput.js +32 -0
- package/dist/components/measurements/LengthText.js +10 -0
- package/dist/components/measurements/MeasurementHandler.js +26 -0
- package/dist/components/measurements/WeightInput.js +25 -0
- package/dist/components/measurements/WeightText.js +10 -0
- package/dist/components/measurements/helpers/detectMeasurementSystem.js +15 -0
- package/dist/components/measurements/helpers/detectMeasurementSystem.native.js +9 -0
- package/dist/components/measurements/helpers/index.js +2 -0
- package/dist/components/measurements/helpers/length.js +112 -0
- package/dist/components/measurements/helpers/weight.js +56 -0
- package/dist/components/measurements/index.js +9 -0
- package/dist/components/measurements/useLengthFormatter.js +35 -0
- package/dist/components/measurements/useLocalInputValue.js +32 -0
- package/dist/components/measurements/useWeightFormatter.js +29 -0
- package/dist/components/routing/ReturnButton.js +20 -0
- package/dist/components/routing/ReturnButton.native.js +20 -0
- package/dist/components/routing/ReturnButton.web.js +2 -0
- package/dist/components/routing/ReturnLink.js +25 -0
- package/dist/components/routing/ReturnLink.native.js +25 -0
- package/dist/components/routing/ReturnLink.web.js +2 -0
- package/dist/components/routing/RoutedStepsContent.js +21 -0
- package/dist/components/routing/RoutedStepsContent.native.js +94 -0
- package/dist/components/routing/RoutedStepsContent.web.js +3 -0
- package/dist/components/routing/index.js +3 -0
- package/dist/components/state/StatePresenter.js +1 -1
- package/dist/components/steps/StepsHandler.js +2 -0
- package/dist/components/structure/TopBar.js +18 -16
- package/dist/components/theme/ThemePickerDrawer.js +1 -1
- package/dist/helpers/compress.js +61 -0
- package/dist/helpers/compress.native.js +49 -0
- package/dist/helpers/files.js +7 -0
- package/dist/helpers/files.native.js +55 -0
- package/dist/helpers/index.js +6 -1
- package/dist/helpers/media.js +4 -0
- package/dist/helpers/media.native.js +41 -0
- package/dist/helpers/numbers.js +13 -0
- package/dist/helpers/pickAssets.js +7 -0
- package/dist/helpers/pickAssets.native.js +66 -0
- package/dist/helpers/storage.js +17 -0
- package/dist/i18n/I18n.js +4 -4
- package/dist/index.js +1 -1
- package/dist/responsive/responsiveHooks.js +14 -0
- package/package.json +2 -14
- package/src/NekoUI.js +16 -13
- package/src/abstractions/WindowOverlay.js +3 -0
- package/src/abstractions/WindowOverlay.native.js +21 -0
- package/src/abstractions/helpers/storage.js +13 -3
- package/src/abstractions/helpers/storage.native.js +8 -0
- package/src/components/feedback/notifications/NotificationsHandler.js +12 -8
- package/src/components/index.js +2 -0
- package/src/components/inputs/DateInput.js +8 -4
- package/src/components/inputs/InputWrapper.js +1 -2
- package/src/components/inputs/NumberWheelInput.js +50 -0
- package/src/components/inputs/NumberWheelPicker.js +43 -0
- package/src/components/inputs/UploadInput.js +2 -2
- package/src/components/inputs/WheelPicker.js +49 -0
- package/src/components/inputs/WheelPicker.native.js +88 -0
- package/src/components/inputs/WheelPicker.web.js +1 -0
- package/src/components/inputs/dateWheelPicker/DateWheelPicker.js +24 -0
- package/src/components/inputs/dateWheelPicker/DayWheelPicker.js +48 -0
- package/src/components/inputs/dateWheelPicker/MonthWheelPicker.js +19 -0
- package/src/components/inputs/dateWheelPicker/QuarterWheelPicker.js +61 -0
- package/src/components/inputs/dateWheelPicker/WeekWheelPicker.js +66 -0
- package/src/components/inputs/dateWheelPicker/YearWheelPicker.js +35 -0
- package/src/components/inputs/index.js +4 -0
- package/src/components/inputs/upload/Upload.native.js +58 -50
- package/src/components/inputs/upload/useUploadState.js +11 -3
- package/src/components/measurements/FeetInchesInput.js +91 -0
- package/src/components/measurements/LengthInput.js +32 -0
- package/src/components/measurements/LengthText.js +10 -0
- package/src/components/measurements/MeasurementHandler.js +26 -0
- package/src/components/measurements/WeightInput.js +25 -0
- package/src/components/measurements/WeightText.js +10 -0
- package/src/components/measurements/helpers/detectMeasurementSystem.js +15 -0
- package/src/components/measurements/helpers/detectMeasurementSystem.native.js +9 -0
- package/src/components/measurements/helpers/index.js +2 -0
- package/src/components/measurements/helpers/length.js +112 -0
- package/src/components/measurements/helpers/weight.js +56 -0
- package/src/components/measurements/index.js +9 -0
- package/src/components/measurements/useLengthFormatter.js +35 -0
- package/src/components/measurements/useLocalInputValue.js +32 -0
- package/src/components/measurements/useWeightFormatter.js +29 -0
- package/src/components/routing/ReturnButton.js +20 -0
- package/src/components/routing/ReturnButton.native.js +20 -0
- package/src/components/routing/ReturnButton.web.js +2 -0
- package/src/components/routing/ReturnLink.js +25 -0
- package/src/components/routing/ReturnLink.native.js +25 -0
- package/src/components/routing/ReturnLink.web.js +2 -0
- package/src/components/routing/RoutedStepsContent.js +21 -0
- package/src/components/routing/RoutedStepsContent.native.js +94 -0
- package/src/components/routing/RoutedStepsContent.web.js +3 -0
- package/src/components/routing/index.js +3 -0
- package/src/components/state/StatePresenter.js +1 -1
- package/src/components/steps/StepsHandler.js +2 -0
- package/src/components/structure/TopBar.js +16 -14
- package/src/components/theme/ThemePickerDrawer.js +1 -1
- package/src/helpers/compress.js +61 -0
- package/src/helpers/compress.native.js +49 -0
- package/src/helpers/files.js +7 -0
- package/src/helpers/files.native.js +55 -0
- package/src/helpers/index.js +6 -1
- package/src/helpers/media.js +4 -0
- package/src/helpers/media.native.js +41 -0
- package/src/helpers/numbers.js +13 -0
- package/src/helpers/pickAssets.js +7 -0
- package/src/helpers/pickAssets.native.js +66 -0
- package/src/helpers/storage.js +17 -0
- package/src/i18n/I18n.js +2 -2
- package/src/index.js +1 -1
- package/src/responsive/responsiveHooks.js +14 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var CM_TO_INCH = 0.393701;
|
|
2
|
+
var CM_TO_FOOT = 0.0328084;
|
|
3
|
+
var CM_PER_M = 100;
|
|
4
|
+
var CM_PER_KM = 100000;
|
|
5
|
+
var MI_TO_KM = 1.60934;
|
|
6
|
+
|
|
7
|
+
export function cmToIn(cm) {
|
|
8
|
+
if (!cm) return cm;
|
|
9
|
+
return cm * CM_TO_INCH;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function inToCm(inches) {
|
|
13
|
+
if (!inches) return inches;
|
|
14
|
+
return inches / CM_TO_INCH;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function cmToFt(cm) {
|
|
18
|
+
if (!cm) return cm;
|
|
19
|
+
return cm * CM_TO_FOOT;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function ftToCm(feet) {
|
|
23
|
+
if (!feet) return feet;
|
|
24
|
+
return feet / CM_TO_FOOT;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function cmToFtIn(cm) {
|
|
28
|
+
if (!cm) return false;
|
|
29
|
+
var totalInches = cmToIn(cm);
|
|
30
|
+
var feet = Math.floor(totalInches / 12);
|
|
31
|
+
var inches = Math.round(totalInches % 12);
|
|
32
|
+
if (inches === 12) {
|
|
33
|
+
feet += 1;
|
|
34
|
+
inches = 0;
|
|
35
|
+
}
|
|
36
|
+
return { feet: feet, inches: inches };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function ftInToCm(value) {
|
|
40
|
+
if (!value) return false;
|
|
41
|
+
var _ref = value || {},feet = _ref.feet,inches = _ref.inches;
|
|
42
|
+
var totalInches = (feet || 0) * 12 + (inches || 0);
|
|
43
|
+
return inToCm(totalInches);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function cmToM(cm) {
|
|
47
|
+
if (!cm) return cm;
|
|
48
|
+
return cm / CM_PER_M;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function mToCm(m) {
|
|
52
|
+
if (!m) return m;
|
|
53
|
+
return m * CM_PER_M;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function mToFt(m) {
|
|
57
|
+
if (!m) return m;
|
|
58
|
+
return cmToFt(m * CM_PER_M);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function ftToM(ft) {
|
|
62
|
+
if (!ft) return ft;
|
|
63
|
+
return ftToCm(ft) / CM_PER_M;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function mToFtIn(m) {
|
|
67
|
+
if (!m) return false;
|
|
68
|
+
return cmToFtIn(m * CM_PER_M);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function ftInToM(value) {
|
|
72
|
+
if (!value) return false;
|
|
73
|
+
return ftInToCm(value) / CM_PER_M;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function mToIn(m) {
|
|
77
|
+
if (!m) return m;
|
|
78
|
+
return cmToIn(m * CM_PER_M);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function inToM(inches) {
|
|
82
|
+
if (!inches) return inches;
|
|
83
|
+
return inToCm(inches) / CM_PER_M;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function kmToMi(km) {
|
|
87
|
+
if (!km) return km;
|
|
88
|
+
return km / MI_TO_KM;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function miToKm(mi) {
|
|
92
|
+
if (!mi) return mi;
|
|
93
|
+
return mi * MI_TO_KM;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export var LENGTH_CONVERTERS = {
|
|
97
|
+
cm: {
|
|
98
|
+
'ft+in': { to: cmToFtIn, from: ftInToCm },
|
|
99
|
+
in: { to: cmToIn, from: inToCm },
|
|
100
|
+
ft: { to: cmToFt, from: ftToCm }
|
|
101
|
+
},
|
|
102
|
+
m: {
|
|
103
|
+
ft: { to: mToFt, from: ftToM },
|
|
104
|
+
'ft+in': { to: mToFtIn, from: ftInToM },
|
|
105
|
+
in: { to: mToIn, from: inToM }
|
|
106
|
+
},
|
|
107
|
+
km: {
|
|
108
|
+
mi: { to: kmToMi, from: miToKm }
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export var LENGTH_IMPERIAL_DEFAULTS = { cm: 'ft+in', m: 'ft', km: 'mi' };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var KG_TO_LB = 2.20462;
|
|
2
|
+
var OZ_PER_LB = 16;
|
|
3
|
+
var G_PER_KG = 1000;
|
|
4
|
+
|
|
5
|
+
export function kgToLbs(kg) {
|
|
6
|
+
if (!kg) return kg;
|
|
7
|
+
return kg * KG_TO_LB;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function lbsToKg(lbs) {
|
|
11
|
+
if (!lbs) return lbs;
|
|
12
|
+
return lbs / KG_TO_LB;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function kgToOz(kg) {
|
|
16
|
+
if (!kg) return kg;
|
|
17
|
+
return kg * KG_TO_LB * OZ_PER_LB;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function ozToKg(oz) {
|
|
21
|
+
if (!oz) return oz;
|
|
22
|
+
return oz / (KG_TO_LB * OZ_PER_LB);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function gToOz(g) {
|
|
26
|
+
if (!g) return g;
|
|
27
|
+
return kgToOz(g / G_PER_KG);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function ozToG(oz) {
|
|
31
|
+
if (!oz) return oz;
|
|
32
|
+
return ozToKg(oz) * G_PER_KG;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function gToLbs(g) {
|
|
36
|
+
if (!g) return g;
|
|
37
|
+
return kgToLbs(g / G_PER_KG);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function lbsToG(lbs) {
|
|
41
|
+
if (!lbs) return lbs;
|
|
42
|
+
return lbsToKg(lbs) * G_PER_KG;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export var WEIGHT_CONVERTERS = {
|
|
46
|
+
kg: {
|
|
47
|
+
lbs: { to: kgToLbs, from: lbsToKg },
|
|
48
|
+
oz: { to: kgToOz, from: ozToKg }
|
|
49
|
+
},
|
|
50
|
+
g: {
|
|
51
|
+
oz: { to: gToOz, from: ozToG },
|
|
52
|
+
lbs: { to: gToLbs, from: lbsToG }
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export var WEIGHT_IMPERIAL_DEFAULTS = { kg: 'lbs', g: 'oz' };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./helpers";
|
|
2
|
+
export * from "./MeasurementHandler";
|
|
3
|
+
export * from "./useLengthFormatter";
|
|
4
|
+
export * from "./useWeightFormatter";
|
|
5
|
+
export * from "./LengthText";
|
|
6
|
+
export * from "./WeightText";
|
|
7
|
+
export * from "./FeetInchesInput";
|
|
8
|
+
export * from "./LengthInput";
|
|
9
|
+
export * from "./WeightInput";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LENGTH_CONVERTERS, LENGTH_IMPERIAL_DEFAULTS } from "./helpers/length";
|
|
2
|
+
import { fixedDecimals } from "../../helpers/numbers";
|
|
3
|
+
import { useIsImperial } from "./MeasurementHandler";
|
|
4
|
+
|
|
5
|
+
export function useLengthFormatter()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
{var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},measurementSystem = _ref.measurementSystem,_ref$metricPrecision = _ref.metricPrecision,metricPrecision = _ref$metricPrecision === void 0 ? 'cm' : _ref$metricPrecision,imperialPrecision = _ref.imperialPrecision,withoutSuffix = _ref.withoutSuffix;
|
|
11
|
+
var isImperial = useIsImperial(measurementSystem);
|
|
12
|
+
var impPrec = imperialPrecision || LENGTH_IMPERIAL_DEFAULTS[metricPrecision] || 'ft+in';
|
|
13
|
+
|
|
14
|
+
return function (value) {
|
|
15
|
+
if (!value && value !== 0) return null;
|
|
16
|
+
|
|
17
|
+
if (isImperial) {var _LENGTH_CONVERTERS$me;
|
|
18
|
+
var converter = (_LENGTH_CONVERTERS$me = LENGTH_CONVERTERS[metricPrecision]) == null ? void 0 : _LENGTH_CONVERTERS$me[impPrec];
|
|
19
|
+
if (!converter) return `${fixedDecimals(value)} ${metricPrecision}`;
|
|
20
|
+
|
|
21
|
+
var converted = converter.to(value);
|
|
22
|
+
|
|
23
|
+
if (impPrec === 'ft+in') {
|
|
24
|
+
var v = typeof converted === 'object' ? converted : { feet: 0, inches: 0 };
|
|
25
|
+
return `${v.feet}'${v.inches}"`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (withoutSuffix) return fixedDecimals(converted);
|
|
29
|
+
return `${fixedDecimals(converted)} ${impPrec}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (withoutSuffix) return fixedDecimals(value);
|
|
33
|
+
return `${fixedDecimals(value)} ${metricPrecision}`;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
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 React from 'react';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export function useLocalInputValue(_ref) {var value = _ref.value,formattedValue = _ref.formattedValue,suffix = _ref.suffix,onChange = _ref.onChange,converter = _ref.converter;
|
|
7
|
+
var _React$useState = React.useState(formattedValue),_React$useState2 = _slicedToArray(_React$useState, 2),localValue = _React$useState2[0],setLocalValue = _React$useState2[1];
|
|
8
|
+
var _React$useState3 = React.useState(suffix),_React$useState4 = _slicedToArray(_React$useState3, 2),prevSuffix = _React$useState4[0],setPrevSuffix = _React$useState4[1];
|
|
9
|
+
var lastEmitted = React.useRef(value);
|
|
10
|
+
|
|
11
|
+
if (suffix !== prevSuffix) {
|
|
12
|
+
setPrevSuffix(suffix);
|
|
13
|
+
setLocalValue(formattedValue);
|
|
14
|
+
lastEmitted.current = value;
|
|
15
|
+
} else if (value !== lastEmitted.current) {
|
|
16
|
+
lastEmitted.current = value;
|
|
17
|
+
setLocalValue(formattedValue);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function handleChange(newValue) {
|
|
21
|
+
setLocalValue(newValue);
|
|
22
|
+
if (!newValue && newValue !== 0) {
|
|
23
|
+
lastEmitted.current = newValue;
|
|
24
|
+
return onChange(newValue);
|
|
25
|
+
}
|
|
26
|
+
var converted = converter ? converter.from(newValue) : newValue;
|
|
27
|
+
lastEmitted.current = converted;
|
|
28
|
+
onChange(converted);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return [localValue, handleChange];
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WEIGHT_CONVERTERS, WEIGHT_IMPERIAL_DEFAULTS } from "./helpers/weight";
|
|
2
|
+
import { fixedDecimals } from "../../helpers/numbers";
|
|
3
|
+
import { useIsImperial } from "./MeasurementHandler";
|
|
4
|
+
|
|
5
|
+
export function useWeightFormatter()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
{var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},measurementSystem = _ref.measurementSystem,_ref$metricPrecision = _ref.metricPrecision,metricPrecision = _ref$metricPrecision === void 0 ? 'kg' : _ref$metricPrecision,imperialPrecision = _ref.imperialPrecision,withoutSuffix = _ref.withoutSuffix;
|
|
11
|
+
var isImperial = useIsImperial(measurementSystem);
|
|
12
|
+
var impPrec = imperialPrecision || WEIGHT_IMPERIAL_DEFAULTS[metricPrecision] || 'lbs';
|
|
13
|
+
|
|
14
|
+
return function (value) {
|
|
15
|
+
if (!value && value !== 0) return null;
|
|
16
|
+
|
|
17
|
+
if (isImperial) {var _WEIGHT_CONVERTERS$me;
|
|
18
|
+
var converter = (_WEIGHT_CONVERTERS$me = WEIGHT_CONVERTERS[metricPrecision]) == null ? void 0 : _WEIGHT_CONVERTERS$me[impPrec];
|
|
19
|
+
if (!converter) return `${fixedDecimals(value)} ${metricPrecision}`;
|
|
20
|
+
|
|
21
|
+
var converted = converter.to(value);
|
|
22
|
+
if (withoutSuffix) return fixedDecimals(converted);
|
|
23
|
+
return `${fixedDecimals(converted)} ${impPrec}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (withoutSuffix) return fixedDecimals(value);
|
|
27
|
+
return `${fixedDecimals(value)} ${metricPrecision}`;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/routing/ReturnButton.js";var _excluded = ["icon", "close", "onPress"];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 { Button } from "../actions";import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var useNavigate;
|
|
6
|
+
try {
|
|
7
|
+
useNavigate = require('react-router-dom').useNavigate;
|
|
8
|
+
} catch (_unused) {
|
|
9
|
+
useNavigate = function useNavigate() {return function () {return console.warn('ReturnButton: react-router-dom not installed.');};};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export function ReturnButton(_ref) {var icon = _ref.icon,close = _ref.close,onPress = _ref.onPress,props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
var navigate = useNavigate();
|
|
17
|
+
var name = icon || (close ? 'close-line' : 'arrow-left-s-line');
|
|
18
|
+
|
|
19
|
+
return _jsx(Button, Object.assign({ icon: name, onPress: onPress || function () {return navigate(-1);} }, props));
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/routing/ReturnButton.native.js";var _excluded = ["icon", "close", "onPress"];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 { Button } from "../actions";import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var useNavigation;
|
|
6
|
+
try {
|
|
7
|
+
useNavigation = require('@react-navigation/native').useNavigation;
|
|
8
|
+
} catch (_unused) {
|
|
9
|
+
useNavigation = function useNavigation() {return { goBack: function goBack() {return console.warn('ReturnButton: @react-navigation/native not installed.');} };};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export function ReturnButton(_ref) {var icon = _ref.icon,close = _ref.close,onPress = _ref.onPress,props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
var navigation = useNavigation();
|
|
17
|
+
var name = icon || (close ? 'close-line' : 'arrow-left-s-line');
|
|
18
|
+
|
|
19
|
+
return _jsx(Button, Object.assign({ icon: name, onPress: onPress || function () {return navigation.goBack();} }, props));
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/routing/ReturnLink.js";var _excluded = ["icon", "close", "onPress"];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 { Icon } from "../presentation";
|
|
2
|
+
import { Link } from "../actions";import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var useNavigate;
|
|
7
|
+
try {
|
|
8
|
+
useNavigate = require('react-router-dom').useNavigate;
|
|
9
|
+
} catch (_unused) {
|
|
10
|
+
useNavigate = function useNavigate() {return function () {return console.warn('ReturnLink: react-router-dom not installed.');};};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export function ReturnLink(_ref) {var icon = _ref.icon,close = _ref.close,onPress = _ref.onPress,props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var navigate = useNavigate();
|
|
18
|
+
var name = icon || (close ? 'close-line' : 'arrow-left-s-line');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
_jsx(Link, { onPress: onPress || function () {return navigate(-1);}, children:
|
|
22
|
+
_jsx(Icon, Object.assign({ name: name }, props)) }
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/routing/ReturnLink.native.js";var _excluded = ["icon", "close", "onPress"];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 { Icon } from "../presentation";
|
|
2
|
+
import { Link } from "../actions";import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var useNavigation;
|
|
7
|
+
try {
|
|
8
|
+
useNavigation = require('@react-navigation/native').useNavigation;
|
|
9
|
+
} catch (_unused) {
|
|
10
|
+
useNavigation = function useNavigation() {return { goBack: function goBack() {return console.warn('ReturnLink: @react-navigation/native not installed.');} };};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export function ReturnLink(_ref) {var icon = _ref.icon,close = _ref.close,onPress = _ref.onPress,props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var navigation = useNavigation();
|
|
18
|
+
var name = icon || (close ? 'close-line' : 'arrow-left-s-line');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
_jsx(Link, { onPress: onPress || function () {return navigation.goBack();}, children:
|
|
22
|
+
_jsx(Icon, Object.assign({ name: name }, props)) }
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/routing/RoutedStepsContent.js";var _excluded = ["screenOptions"];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 { ActiveStepContent } from "../steps";
|
|
2
|
+
import { View } from "../structure";import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var warned = false;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export function RoutedStepsContent(_ref) {var screenOptions = _ref.screenOptions,props = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
if (!warned) {
|
|
12
|
+
warned = true;
|
|
13
|
+
console.warn('RoutedStepsContent is native-only (react-navigation). Rendering steps in place on plain web.');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
_jsx(View, Object.assign({ flex: true }, props, { children:
|
|
18
|
+
_jsx(ActiveStepContent, {}) })
|
|
19
|
+
));
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var _excluded = ["screenOptions"];var _this = this,_jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/routing/RoutedStepsContent.native.js";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 { View } from "../structure";
|
|
4
|
+
import { useSteps } from "../steps";import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var NavigationContainer;
|
|
9
|
+
var NavigationIndependentTree;
|
|
10
|
+
var StackActions;
|
|
11
|
+
var createNativeStackNavigator;
|
|
12
|
+
var available = true;
|
|
13
|
+
try {
|
|
14
|
+
var nav = require('@react-navigation/native');
|
|
15
|
+
NavigationContainer = nav.NavigationContainer;
|
|
16
|
+
NavigationIndependentTree = nav.NavigationIndependentTree;
|
|
17
|
+
StackActions = nav.StackActions;
|
|
18
|
+
createNativeStackNavigator = require('@react-navigation/native-stack').createNativeStackNavigator;
|
|
19
|
+
} catch (_unused) {
|
|
20
|
+
available = false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var warned = false;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var stepContent = function stepContent(item) {
|
|
28
|
+
var Content = item.render || item.renderContent || item.Content;
|
|
29
|
+
return Content ? _jsx(Content, {}) : null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export function RoutedStepsContent(_ref) {var _this2 = this;var screenOptions = _ref.screenOptions,props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var _useSteps = useSteps(),items = _useSteps.items,activeIndex = _useSteps.activeIndex,moveToIndex = _useSteps.moveToIndex;
|
|
38
|
+
var navRef = React.useRef(null);
|
|
39
|
+
var Stack = React.useRef(available ? createNativeStackNavigator() : null).current;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
React.useEffect(function () {var _ref$getCurrentRoute;
|
|
47
|
+
var ref = navRef.current;
|
|
48
|
+
if (!(ref != null && ref.isReady != null && ref.isReady())) return;
|
|
49
|
+
var current = Number(ref.getCurrentRoute == null ? void 0 : (_ref$getCurrentRoute = ref.getCurrentRoute()) == null ? void 0 : _ref$getCurrentRoute.name) || 0;
|
|
50
|
+
if (activeIndex === current) return;
|
|
51
|
+
ref.dispatch(
|
|
52
|
+
activeIndex > current ? StackActions.push(String(activeIndex)) : StackActions.popTo(String(activeIndex))
|
|
53
|
+
);
|
|
54
|
+
}, [activeIndex]);
|
|
55
|
+
|
|
56
|
+
if (!available) {
|
|
57
|
+
if (!warned) {
|
|
58
|
+
warned = true;
|
|
59
|
+
console.warn(
|
|
60
|
+
'RoutedStepsContent requires @react-navigation/native and @react-navigation/native-stack; neither is installed.'
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var handleStateChange = function handleStateChange() {var _navRef$current, _navRef$current$getCu;
|
|
69
|
+
var index = Number((_navRef$current = navRef.current) == null ? void 0 : _navRef$current.getCurrentRoute == null ? void 0 : (_navRef$current$getCu = _navRef$current.getCurrentRoute()) == null ? void 0 : _navRef$current$getCu.name) || 0;
|
|
70
|
+
if (index !== activeIndex) moveToIndex(index);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var navigator =
|
|
74
|
+
_jsx(Stack.Navigator, { screenOptions: Object.assign({ headerShown: false }, screenOptions), children:
|
|
75
|
+
items.map(function (item, index) {return (
|
|
76
|
+
_jsx(Stack.Screen, { name: String(index), options: { title: item.label }, children:
|
|
77
|
+
function children() {return stepContent(item);} }, index
|
|
78
|
+
));}
|
|
79
|
+
) }
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
_jsx(View, Object.assign({ flex: true }, props, { children:
|
|
87
|
+
_jsx(NavigationIndependentTree, { children:
|
|
88
|
+
_jsx(NavigationContainer, { ref: navRef, onStateChange: handleStateChange, children:
|
|
89
|
+
navigator }
|
|
90
|
+
) }
|
|
91
|
+
) })
|
|
92
|
+
));
|
|
93
|
+
|
|
94
|
+
}
|
|
@@ -24,7 +24,7 @@ export function StatePresenter(_ref)
|
|
|
24
24
|
if (error) {
|
|
25
25
|
return (
|
|
26
26
|
_jsx(View, Object.assign({ flex: true, center: true }, props, { children:
|
|
27
|
-
_jsx(Result, { type: "error", title: errorTitle, description: errorDescription || error.message }) })
|
|
27
|
+
_jsx(Result, { type: "error", title: errorTitle, description: errorDescription || (typeof error === 'string' ? error : error.message) }) })
|
|
28
28
|
));
|
|
29
29
|
|
|
30
30
|
}
|
|
@@ -8,6 +8,7 @@ export function StepsHandler(_ref) {var children = _ref.children,items = _ref.it
|
|
|
8
8
|
var _React$useState3 = React.useState(0),_React$useState4 = _slicedToArray(_React$useState3, 2),maxIndexReleased = _React$useState4[0],setMaxIndexReleased = _React$useState4[1];
|
|
9
9
|
var _React$useState5 = React.useState(false),_React$useState6 = _slicedToArray(_React$useState5, 2),loading = _React$useState6[0],setLoading = _React$useState6[1];
|
|
10
10
|
var activeStep = items[activeIndex];
|
|
11
|
+
var isFirstStep = activeIndex === 0;
|
|
11
12
|
var isLastStep = activeIndex === items.length - 1;
|
|
12
13
|
|
|
13
14
|
var moveToIndex = function () {var _ref2 = _asyncToGenerator(function* (index) {
|
|
@@ -44,6 +45,7 @@ export function StepsHandler(_ref) {var children = _ref.children,items = _ref.it
|
|
|
44
45
|
activeStep: activeStep,
|
|
45
46
|
maxIndexReleased: maxIndexReleased,
|
|
46
47
|
loading: loading,
|
|
48
|
+
isFirstStep: isFirstStep,
|
|
47
49
|
isLastStep: isLastStep,
|
|
48
50
|
moveToNextStep: moveToNextStep,
|
|
49
51
|
moveToPrevStep: moveToPrevStep
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/structure/TopBar.js";var _excluded = ["right", "left", "WrapperView", "children"];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/TopBar.js";var _excluded = ["title", "subtitle", "right", "left", "WrapperView", "children"];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 { Text } from "../text";
|
|
4
4
|
import { View } from "./View";
|
|
5
5
|
import { useDefaultModifier } from "../../modifiers/default";
|
|
6
6
|
import { useResponsiveConverter } from "../../modifiers/responsiveConverter";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useSafeAreaInsets } from "../../abstractions/helpers/useSafeAreaInsets";
|
|
8
|
+
import { useThemeComponentModifier } from "../../modifiers/themeComponent";import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
var DEFAULT_PROPS = {
|
|
11
|
-
borderB: 'overlayDivider'
|
|
11
|
+
borderB: 'overlayDivider',
|
|
12
|
+
titleProps: {
|
|
13
|
+
center: true,
|
|
14
|
+
size: 'h6',
|
|
15
|
+
numberOfLines: 1
|
|
16
|
+
},
|
|
17
|
+
subtitleProps: {
|
|
18
|
+
center: true,
|
|
19
|
+
size: 'xs',
|
|
20
|
+
numberOfLines: 1
|
|
21
|
+
}
|
|
12
22
|
};
|
|
13
23
|
|
|
14
|
-
export function TopBar(_ref) {var right = _ref.right,left = _ref.left,WrapperView = _ref.WrapperView,children = _ref.children,rootProps = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
export function TopBar(_ref) {var title = _ref.title,subtitle = _ref.subtitle,right = _ref.right,left = _ref.left,WrapperView = _ref.WrapperView,children = _ref.children,rootProps = _objectWithoutProperties(_ref, _excluded);
|
|
15
25
|
var _useSafeAreaInsets = useSafeAreaInsets(),safeTop = _useSafeAreaInsets.top;
|
|
16
26
|
|
|
17
27
|
var _pipe = pipe(
|
|
@@ -19,7 +29,7 @@ export function TopBar(_ref) {var right = _ref.right,left = _ref.left,WrapperVie
|
|
|
19
29
|
useDefaultModifier(DEFAULT_PROPS),
|
|
20
30
|
useResponsiveConverter([])
|
|
21
31
|
)([{}, rootProps]),_pipe2 = _slicedToArray(_pipe, 2),_ = _pipe2[0],props = _pipe2[1];
|
|
22
|
-
var _props$useSafeArea = props.useSafeArea,useSafeArea = _props$useSafeArea === void 0 ? true : _props$useSafeArea,
|
|
32
|
+
var _props$useSafeArea = props.useSafeArea,useSafeArea = _props$useSafeArea === void 0 ? true : _props$useSafeArea,titleProps = props.titleProps,subtitleProps = props.subtitleProps;
|
|
23
33
|
|
|
24
34
|
var hasContent = !!title || !!subtitle || !!children || !!right || !!left;
|
|
25
35
|
|
|
@@ -34,17 +44,9 @@ export function TopBar(_ref) {var right = _ref.right,left = _ref.left,WrapperVie
|
|
|
34
44
|
),
|
|
35
45
|
|
|
36
46
|
_jsxs(View, { center: true, flex: 3, children: [
|
|
37
|
-
children ||
|
|
38
|
-
_jsx(Text, { center: true, h6: true, numberOfLines: 1, children:
|
|
39
|
-
title }
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
subtitle &&
|
|
44
|
-
_jsx(Text, { center: true, xs: true, numberOfLines: 1, children:
|
|
45
|
-
subtitle }
|
|
46
|
-
)] }
|
|
47
|
+
children || _jsx(Text, Object.assign({}, titleProps, { children: title })),
|
|
47
48
|
|
|
49
|
+
subtitle && _jsx(Text, Object.assign({}, subtitleProps, { children: subtitle }))] }
|
|
48
50
|
),
|
|
49
51
|
|
|
50
52
|
_jsx(View, { flex: 1, toRight: true, children:
|
|
@@ -3,7 +3,7 @@ import { ThemePicker } from "./ThemePicker";import { jsx as _jsx } from "react/j
|
|
|
3
3
|
|
|
4
4
|
export function ThemePickerDrawer(_ref) {var open = _ref.open,onClose = _ref.onClose,onChange = _ref.onChange;
|
|
5
5
|
return (
|
|
6
|
-
_jsx(BottomDrawer, { open: open, onClose: onClose, maxWidth: 550, snapPoints: ['
|
|
6
|
+
_jsx(BottomDrawer, { open: open, onClose: onClose, maxWidth: 550, snapPoints: ['60%', '85%'], useSafeArea: false, children:
|
|
7
7
|
_jsx(DrawerScrollView, { padding: "md", children:
|
|
8
8
|
_jsx(ThemePicker, { onChange: onChange }) }
|
|
9
9
|
) }
|