@lichens-innovation/react-native-common 3.1.0 → 3.3.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/components/drop-down-selector/drop-down-selector.d.ts +1 -0
- package/dist/components/drop-down-selector/drop-down-selector.js +23 -14
- package/dist/components/drop-down-selector/drop-down-selector.js.map +1 -1
- package/dist/components/drop-down-selector/drop-down-selector.utils.d.ts +22 -0
- package/dist/components/drop-down-selector/drop-down-selector.utils.js +37 -0
- package/dist/components/drop-down-selector/drop-down-selector.utils.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/orientation-aware-tabs/index.d.ts +2 -0
- package/dist/components/layout/orientation-aware-tabs/index.js +3 -0
- package/dist/components/layout/orientation-aware-tabs/index.js.map +1 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tab-button.d.ts +9 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tab-button.js +40 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tab-button.js.map +1 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.d.ts +15 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.js +40 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.js.map +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.d.ts +3 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.js +80 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.js.map +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.types.d.ts +20 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.types.js +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.types.js.map +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.utils.d.ts +2 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.utils.js +23 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.utils.js.map +1 -0
- package/dist/components/layout/resizable/index.d.ts +2 -0
- package/dist/components/layout/resizable/index.js +2 -0
- package/dist/components/layout/resizable/index.js.map +1 -1
- package/dist/components/layout/resizable/vertical-resizable-overlay-view.types.d.ts +3 -3
- package/dist/components/layout/resizable/vertical-resizable-split-view.types.d.ts +3 -3
- package/dist/components/voice-recognition/index.d.ts +2 -0
- package/dist/components/voice-recognition/index.js +3 -0
- package/dist/components/voice-recognition/index.js.map +1 -0
- package/dist/components/voice-recognition/voice-recognition-text-input.d.ts +10 -0
- package/dist/components/voice-recognition/voice-recognition-text-input.js +104 -0
- package/dist/components/voice-recognition/voice-recognition-text-input.js.map +1 -0
- package/dist/components/voice-recognition/voice-recognition.utils.d.ts +7 -0
- package/dist/components/voice-recognition/voice-recognition.utils.js +24 -0
- package/dist/components/voice-recognition/voice-recognition.utils.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-window-orientation.d.ts +3 -0
- package/dist/hooks/use-window-orientation.js +10 -0
- package/dist/hooks/use-window-orientation.js.map +1 -0
- package/dist/i18n/en/common.json +1 -0
- package/dist/i18n/fr/common.json +1 -0
- package/package.json +3 -1
|
@@ -4,46 +4,55 @@ import { StyleSheet, View } from 'react-native';
|
|
|
4
4
|
import { Dropdown } from 'react-native-element-dropdown';
|
|
5
5
|
import { Text } from 'react-native-paper';
|
|
6
6
|
import { useAppTheme } from '../../theme/theme';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const [isFocus, setIsFocus] = useState(false);
|
|
7
|
+
import { getBorderColor, getLabelColor, getTextColor } from './drop-down-selector.utils';
|
|
8
|
+
export const DropDownSelector = ({ label, value, onChange, isError, options, placeholder, searchPlaceholder, disabled, }) => {
|
|
9
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
11
10
|
const hasLabel = !!label;
|
|
12
|
-
const styles = useStyles({
|
|
13
|
-
return (_jsxs(View, { children: [hasLabel && (_jsx(Text, { variant: 'bodySmall', style:
|
|
11
|
+
const styles = useStyles({ isFocused, disabled, isError });
|
|
12
|
+
return (_jsxs(View, { children: [hasLabel && (_jsx(Text, { variant: 'bodySmall', style: styles.dropdownTitle, children: label })), _jsx(Dropdown, { style: styles.dropdown, autoScroll: false, placeholderStyle: styles.placeholderStyle, selectedTextStyle: styles.selectedTextStyle, inputSearchStyle: styles.inputSearchStyle, iconStyle: styles.iconStyle, data: options, search: false, maxHeight: 300, labelField: "label", valueField: "value", placeholder: isFocused ? '' : placeholder, searchPlaceholder: searchPlaceholder, value: value, disable: disabled, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onChange: ({ value }) => {
|
|
14
13
|
onChange(value);
|
|
15
|
-
|
|
14
|
+
setIsFocused(false);
|
|
16
15
|
} })] }));
|
|
17
16
|
};
|
|
18
|
-
const useStyles = ({
|
|
17
|
+
const useStyles = ({ isFocused, disabled, isError }) => {
|
|
19
18
|
const theme = useAppTheme();
|
|
19
|
+
const { surface, surfaceDisabled } = theme.colors;
|
|
20
|
+
const isDisabled = disabled === true;
|
|
21
|
+
const isFocusedAndEnabled = isFocused && !isDisabled;
|
|
22
|
+
// Priority: error > disabled > focus > normal
|
|
23
|
+
const labelColor = getLabelColor({ theme, isError: !!isError, isDisabled, isFocusedAndEnabled });
|
|
24
|
+
const borderColor = getBorderColor({ theme, isError: !!isError, isDisabled, isFocused });
|
|
25
|
+
const borderWidth = isFocusedAndEnabled ? 2 : 1;
|
|
26
|
+
const backgroundColor = isDisabled ? surfaceDisabled : 'transparent';
|
|
27
|
+
const textColor = getTextColor({ theme, isFocused, isDisabled });
|
|
20
28
|
return StyleSheet.create({
|
|
21
29
|
dropdownTitle: {
|
|
22
30
|
position: 'absolute',
|
|
23
31
|
top: -theme.spacing(1),
|
|
24
32
|
left: theme.spacing(1),
|
|
25
|
-
backgroundColor:
|
|
33
|
+
backgroundColor: surface,
|
|
26
34
|
paddingHorizontal: theme.spacing(0.75),
|
|
27
|
-
color:
|
|
35
|
+
color: labelColor,
|
|
28
36
|
zIndex: 1,
|
|
29
37
|
},
|
|
30
38
|
dropdown: {
|
|
31
39
|
height: 50,
|
|
32
|
-
borderColor
|
|
33
|
-
borderWidth
|
|
40
|
+
borderColor,
|
|
41
|
+
borderWidth,
|
|
34
42
|
borderRadius: theme.roundness,
|
|
35
43
|
paddingHorizontal: theme.spacing(1),
|
|
44
|
+
backgroundColor,
|
|
36
45
|
},
|
|
37
46
|
icon: {
|
|
38
47
|
marginRight: 5,
|
|
39
48
|
},
|
|
40
49
|
placeholderStyle: {
|
|
41
50
|
fontSize: 16,
|
|
42
|
-
color:
|
|
51
|
+
color: textColor,
|
|
43
52
|
},
|
|
44
53
|
selectedTextStyle: {
|
|
45
54
|
fontSize: 16,
|
|
46
|
-
color:
|
|
55
|
+
color: textColor,
|
|
47
56
|
paddingLeft: theme.spacing(1),
|
|
48
57
|
},
|
|
49
58
|
iconStyle: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop-down-selector.js","sourceRoot":"","sources":["../../../src/components/drop-down-selector/drop-down-selector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"drop-down-selector.js","sourceRoot":"","sources":["../../../src/components/drop-down-selector/drop-down-selector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB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SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;IAEjE,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,aAAa,EAAE;YACb,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,eAAe,EAAE,OAAO;YACxB,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACtC,KAAK,EAAE,UAAU;YACjB,MAAM,EAAE,CAAC;SACV;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,EAAE;YACV,WAAW;YACX,WAAW;YACX,YAAY,EAAE,KAAK,CAAC,SAAS;YAC7B,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACnC,eAAe;SAChB;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,CAAC;SACf;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,SAAS;SACjB;QACD,iBAAiB,EAAE;YACjB,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;SAC9B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;QACD,gBAAgB,EAAE;YAChB,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppTheme } from '~/theme';
|
|
2
|
+
interface GetTextColorArgs {
|
|
3
|
+
theme: AppTheme;
|
|
4
|
+
isFocused: boolean;
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const getTextColor: ({ theme, isFocused, isDisabled }: GetTextColorArgs) => string;
|
|
8
|
+
interface GetLabelColorArgs {
|
|
9
|
+
theme: AppTheme;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
isDisabled: boolean;
|
|
12
|
+
isFocusedAndEnabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const getLabelColor: ({ theme, isError, isDisabled, isFocusedAndEnabled }: GetLabelColorArgs) => string;
|
|
15
|
+
interface GetBorderColorArgs {
|
|
16
|
+
theme: AppTheme;
|
|
17
|
+
isError: boolean;
|
|
18
|
+
isDisabled: boolean;
|
|
19
|
+
isFocused: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const getBorderColor: ({ theme, isError, isDisabled, isFocused }: GetBorderColorArgs) => string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const getTextColor = ({ theme, isFocused, isDisabled }) => {
|
|
2
|
+
const { onSurfaceDisabled, primary, secondary } = theme.colors;
|
|
3
|
+
if (isDisabled) {
|
|
4
|
+
return onSurfaceDisabled;
|
|
5
|
+
}
|
|
6
|
+
if (isFocused) {
|
|
7
|
+
return primary;
|
|
8
|
+
}
|
|
9
|
+
return secondary;
|
|
10
|
+
};
|
|
11
|
+
export const getLabelColor = ({ theme, isError, isDisabled, isFocusedAndEnabled }) => {
|
|
12
|
+
const { error, onSurfaceDisabled, primary, onSurface } = theme.colors;
|
|
13
|
+
if (isError) {
|
|
14
|
+
return error;
|
|
15
|
+
}
|
|
16
|
+
if (isDisabled) {
|
|
17
|
+
return onSurfaceDisabled;
|
|
18
|
+
}
|
|
19
|
+
if (isFocusedAndEnabled) {
|
|
20
|
+
return primary;
|
|
21
|
+
}
|
|
22
|
+
return onSurface;
|
|
23
|
+
};
|
|
24
|
+
export const getBorderColor = ({ theme, isError, isDisabled, isFocused }) => {
|
|
25
|
+
const { error, surfaceDisabled, primary, outline } = theme.colors;
|
|
26
|
+
if (isError) {
|
|
27
|
+
return error;
|
|
28
|
+
}
|
|
29
|
+
if (isDisabled) {
|
|
30
|
+
return surfaceDisabled;
|
|
31
|
+
}
|
|
32
|
+
if (isFocused) {
|
|
33
|
+
return primary;
|
|
34
|
+
}
|
|
35
|
+
return outline;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=drop-down-selector.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-down-selector.utils.js","sourceRoot":"","sources":["../../../src/components/drop-down-selector/drop-down-selector.utils.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAoB,EAAE,EAAE;IACjF,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAE/D,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAqB,EAAE,EAAE;IACtG,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAEtE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAsB,EAAE,EAAE;IAC9F,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAElE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/orientation-aware-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TabTriggerSlotProps } from 'expo-router/ui';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
export type OrientationAwareTabButtonProps = TabTriggerSlotProps & {
|
|
4
|
+
icon: string;
|
|
5
|
+
title: string;
|
|
6
|
+
activeColor: string;
|
|
7
|
+
isLabelHidden?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const OrientationAwareTabButton: FunctionComponent<OrientationAwareTabButtonProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Pressable, StyleSheet } from 'react-native';
|
|
14
|
+
import { Text } from 'react-native-paper';
|
|
15
|
+
import { useIsLandscape } from '../../../hooks/use-window-orientation';
|
|
16
|
+
import { useAppTheme } from '../../../theme/theme';
|
|
17
|
+
import { TabBarIcon } from '../../tab-bar-icon';
|
|
18
|
+
export const OrientationAwareTabButton = (_a) => {
|
|
19
|
+
var { icon, title, activeColor, isFocused, isLabelHidden = false } = _a, props = __rest(_a, ["icon", "title", "activeColor", "isFocused", "isLabelHidden"]);
|
|
20
|
+
const theme = useAppTheme();
|
|
21
|
+
const styles = useStyles();
|
|
22
|
+
const isLabelVisible = !isLabelHidden;
|
|
23
|
+
const color = isFocused ? activeColor : theme.colors.onSurfaceDisabled;
|
|
24
|
+
return (_jsxs(Pressable, Object.assign({}, props, { style: [styles.tabButton], children: [_jsx(TabBarIcon, { name: icon, color: color }), isLabelVisible && (_jsx(Text, { variant: "bodySmall", style: { color }, children: title }))] })));
|
|
25
|
+
};
|
|
26
|
+
const useStyles = () => {
|
|
27
|
+
const theme = useAppTheme();
|
|
28
|
+
const isLandscape = useIsLandscape();
|
|
29
|
+
const padding = theme.spacing(0.5);
|
|
30
|
+
return StyleSheet.create({
|
|
31
|
+
tabButton: {
|
|
32
|
+
flex: 1,
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
paddingLeft: isLandscape ? padding : 0,
|
|
36
|
+
paddingTop: isLandscape ? 0 : padding,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=orientation-aware-tab-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orientation-aware-tab-button.js","sourceRoot":"","sources":["../../../../src/components/layout/orientation-aware-tabs/orientation-aware-tab-button.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,MAAM,CAAC,MAAM,yBAAyB,GAAsD,CAAC,EAO5F,EAAE,EAAE;QAPwF,EAC3F,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,aAAa,GAAG,KAAK,OAEtB,EADI,KAAK,cANmF,8DAO5F,CADS;IAER,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,cAAc,GAAY,CAAC,aAAa,CAAC;IAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAEvE,OAAO,CACL,MAAC,SAAS,oBAAK,KAAK,IAAE,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,aAC7C,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAI,EAEvC,cAAc,IAAI,CACjB,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YACvC,KAAK,GACD,CACR,KACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEnC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;SACtC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export type TabItem = {
|
|
4
|
+
name: string;
|
|
5
|
+
href: string;
|
|
6
|
+
title: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
};
|
|
9
|
+
export type OrientationAwareTabsLayoutProps = {
|
|
10
|
+
tabs: TabItem[];
|
|
11
|
+
activeColor?: string;
|
|
12
|
+
containerStyle?: ViewStyle;
|
|
13
|
+
tabListStyle?: ViewStyle;
|
|
14
|
+
};
|
|
15
|
+
export declare const OrientationAwareTabsLayout: FunctionComponent<OrientationAwareTabsLayoutProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TabList, Tabs, TabSlot, TabTrigger } from 'expo-router/ui';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
import { useIsLandscape } from '../../../hooks/use-window-orientation';
|
|
6
|
+
import { useAppTheme } from '../../../theme/theme';
|
|
7
|
+
import { OrientationAwareTabButton } from './orientation-aware-tab-button';
|
|
8
|
+
export const OrientationAwareTabsLayout = ({ tabs, activeColor, containerStyle, tabListStyle, }) => {
|
|
9
|
+
const theme = useAppTheme();
|
|
10
|
+
const styles = useStyles();
|
|
11
|
+
const isLandscape = useIsLandscape();
|
|
12
|
+
return (_jsxs(Tabs, { style: [styles.tabsContainer, containerStyle], children: [_jsx(TabSlot, { style: styles.tabSlot }), _jsx(TabList, { style: [styles.tabList, tabListStyle], children: tabs.map((tab) => (_jsx(TabTrigger, { name: tab.name, href: tab.href, asChild: true, children: _jsx(OrientationAwareTabButton, { isLabelHidden: isLandscape, icon: tab.icon, title: tab.title, activeColor: activeColor !== null && activeColor !== void 0 ? activeColor : theme.colors.primary }) }, tab.name))) })] }));
|
|
13
|
+
};
|
|
14
|
+
const useStyles = () => {
|
|
15
|
+
const theme = useAppTheme();
|
|
16
|
+
const { bottom, right } = useSafeAreaInsets();
|
|
17
|
+
const minPadding = theme.spacing(0.5);
|
|
18
|
+
const isLandscape = useIsLandscape();
|
|
19
|
+
return StyleSheet.create({
|
|
20
|
+
tabsContainer: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
flexDirection: isLandscape ? 'row' : 'column',
|
|
23
|
+
},
|
|
24
|
+
tabSlot: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
},
|
|
27
|
+
tabList: {
|
|
28
|
+
backgroundColor: theme.colors.backdrop,
|
|
29
|
+
justifyContent: 'space-around',
|
|
30
|
+
flexDirection: isLandscape ? 'column' : 'row',
|
|
31
|
+
paddingBottom: isLandscape ? minPadding : bottom,
|
|
32
|
+
paddingRight: isLandscape ? right : minPadding,
|
|
33
|
+
borderTopWidth: isLandscape ? undefined : StyleSheet.hairlineWidth,
|
|
34
|
+
borderTopColor: isLandscape ? undefined : theme.colors.outline,
|
|
35
|
+
borderLeftWidth: isLandscape ? StyleSheet.hairlineWidth : undefined,
|
|
36
|
+
borderLeftColor: isLandscape ? theme.colors.outline : undefined,
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=orientation-aware-tabs-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orientation-aware-tabs-layout.js","sourceRoot":"","sources":["../../../../src/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAgB3E,MAAM,CAAC,MAAM,0BAA0B,GAAuD,CAAC,EAC7F,IAAI,EACJ,WAAW,EACX,cAAc,EACd,YAAY,GACb,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,aACjD,KAAC,OAAO,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,GAAI,EAElC,KAAC,OAAO,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,YAC3C,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACjB,KAAC,UAAU,IAAgB,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,kBAChE,KAAC,yBAAyB,IACxB,aAAa,EAAE,WAAW,EAC1B,IAAI,EAAE,GAAG,CAAC,IAAI,EACd,KAAK,EAAE,GAAG,CAAC,KAAK,EAChB,WAAW,EA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,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SAChE;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import { isDevelopment } from '../../../utils';
|
|
7
|
+
import { validateResizableSplitViewProps } from './horizontal-resizable-split-view.utils';
|
|
8
|
+
const DRAG_HANDLE_WIDTH = 20;
|
|
9
|
+
const DEFAULT_ANIMATION_CONFIG = { damping: 25, stiffness: 300, mass: 0.8 };
|
|
10
|
+
export const HorizontalResizableSplitView = (props) => {
|
|
11
|
+
if (isDevelopment())
|
|
12
|
+
validateResizableSplitViewProps(props);
|
|
13
|
+
const { leftContent, rightContent, initialLeftRatio = 0.5, minLeftRatio = 0.15, maxLeftRatio = 0.85, handleContainerStyle, handleStyle, hideHandle = false, } = props;
|
|
14
|
+
// Track measured container width
|
|
15
|
+
const [isReady, setIsReady] = useState(false);
|
|
16
|
+
// Shared values for animation
|
|
17
|
+
const leftSectionWidth = useSharedValue(0);
|
|
18
|
+
const minWidth = useSharedValue(0);
|
|
19
|
+
const maxWidth = useSharedValue(0);
|
|
20
|
+
const startX = useSharedValue(0);
|
|
21
|
+
const isDragging = useSharedValue(false);
|
|
22
|
+
// Handle container layout measurement
|
|
23
|
+
const handleLayout = useCallback((event) => {
|
|
24
|
+
const { width } = event.nativeEvent.layout;
|
|
25
|
+
if (width > 0 && !isReady) {
|
|
26
|
+
minWidth.value = width * minLeftRatio;
|
|
27
|
+
maxWidth.value = width * maxLeftRatio;
|
|
28
|
+
leftSectionWidth.value = width * initialLeftRatio;
|
|
29
|
+
setIsReady(true);
|
|
30
|
+
}
|
|
31
|
+
}, [minLeftRatio, maxLeftRatio, initialLeftRatio, minWidth, maxWidth, leftSectionWidth, isReady]);
|
|
32
|
+
const panGesture = Gesture.Pan()
|
|
33
|
+
.onStart(() => {
|
|
34
|
+
startX.value = leftSectionWidth.value;
|
|
35
|
+
isDragging.value = true;
|
|
36
|
+
})
|
|
37
|
+
.onUpdate((event) => {
|
|
38
|
+
const newWidth = startX.value + event.translationX;
|
|
39
|
+
leftSectionWidth.value = Math.max(minWidth.value, Math.min(newWidth, maxWidth.value));
|
|
40
|
+
})
|
|
41
|
+
.onEnd(() => {
|
|
42
|
+
isDragging.value = false;
|
|
43
|
+
});
|
|
44
|
+
const leftSectionAnimatedStyle = useAnimatedStyle(() => ({ width: leftSectionWidth.value }));
|
|
45
|
+
const dragHandleContainerAnimatedStyle = useAnimatedStyle(() => ({
|
|
46
|
+
left: leftSectionWidth.value - DRAG_HANDLE_WIDTH / 2,
|
|
47
|
+
}));
|
|
48
|
+
const dragHandleAnimatedStyle = useAnimatedStyle(() => ({
|
|
49
|
+
transform: [{ scale: withSpring(isDragging.value ? 1.2 : 1, DEFAULT_ANIMATION_CONFIG) }],
|
|
50
|
+
}));
|
|
51
|
+
return (_jsxs(View, { style: [styles.container], onLayout: handleLayout, children: [_jsx(Animated.View, { style: [styles.leftSection, leftSectionAnimatedStyle], children: leftContent }), !hideHandle && (_jsx(GestureDetector, { gesture: panGesture, children: _jsx(Animated.View, { style: [styles.handleContainer, handleContainerStyle, dragHandleContainerAnimatedStyle], children: _jsx(Animated.View, { style: [styles.handle, handleStyle, dragHandleAnimatedStyle] }) }) })), _jsx(View, { style: [styles.rightSection], children: rightContent })] }));
|
|
52
|
+
};
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
container: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
},
|
|
58
|
+
leftSection: {
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
},
|
|
61
|
+
rightSection: {
|
|
62
|
+
flex: 1,
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
},
|
|
65
|
+
handleContainer: {
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: 0,
|
|
68
|
+
bottom: 0,
|
|
69
|
+
width: DRAG_HANDLE_WIDTH,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
},
|
|
73
|
+
handle: {
|
|
74
|
+
width: 4,
|
|
75
|
+
height: 40,
|
|
76
|
+
backgroundColor: '#888888',
|
|
77
|
+
borderRadius: 2,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=horizontal-resizable-split-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal-resizable-split-view.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/horizontal-resizable-split-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACtE,OAAO,EAAqB,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,QAAQ,EAAE,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAE1F,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,wBAAwB,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAE5E,MAAM,CAAC,MAAM,4BAA4B,GAAyD,CAAC,KAAK,EAAE,EAAE;IAC1G,IAAI,aAAa,EAAE;QAAE,+BAA+B,CAAC,KAA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AAiB,EAElG,CAAC,UAAU,IAAI,CACd,KAAC,eAAe,IAAC,OAAO,EAAE,UAAU,YAClC,KAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,eAAe,EAAE,oBAAoB,EAAE,gCAAgC,CAAC,YACpG,KAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,uBAAuB,CAAC,GAAI,GACjE,GACA,CACnB,EAED,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,YAAG,YAAY,GAAQ,IACpD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;KACrB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,QAAQ;KACnB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;IACD,eAAe,EAAE;QACf,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,CAAC;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface HorizontalResizableSplitViewProps {
|
|
4
|
+
/** Content to display in the left section */
|
|
5
|
+
leftContent: ReactNode;
|
|
6
|
+
/** Content to display in the right section */
|
|
7
|
+
rightContent: ReactNode;
|
|
8
|
+
/** Initial proportion for the left section (0 to 1). Default: 0.5 */
|
|
9
|
+
initialLeftRatio?: number;
|
|
10
|
+
/** Minimum proportion for the left section (0 to 1). Default: 0.15 */
|
|
11
|
+
minLeftRatio?: number;
|
|
12
|
+
/** Maximum proportion for the left section (0 to 1). Default: 0.85 */
|
|
13
|
+
maxLeftRatio?: number;
|
|
14
|
+
/** Style for the drag handle container */
|
|
15
|
+
handleContainerStyle?: StyleProp<ViewStyle>;
|
|
16
|
+
/** Style for the drag handle bar */
|
|
17
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
18
|
+
/** Whether to hide the drag handle. Default: false */
|
|
19
|
+
hideHandle?: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=horizontal-resizable-split-view.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal-resizable-split-view.types.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/horizontal-resizable-split-view.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isNullish } from '@lichens-innovation/ts-common';
|
|
2
|
+
export const validateResizableSplitViewProps = (props) => {
|
|
3
|
+
const { initialLeftRatio, minLeftRatio, maxLeftRatio } = props;
|
|
4
|
+
if (!isNullish(initialLeftRatio)) {
|
|
5
|
+
if (initialLeftRatio < 0 || initialLeftRatio > 1)
|
|
6
|
+
throw new Error(`initialLeftRatio must be between 0 and 1. Provided: ${initialLeftRatio}`);
|
|
7
|
+
}
|
|
8
|
+
if (!isNullish(minLeftRatio)) {
|
|
9
|
+
if (minLeftRatio < 0 || minLeftRatio > 1)
|
|
10
|
+
throw new Error(`minLeftRatio must be between 0 and 1. Provided: ${minLeftRatio}`);
|
|
11
|
+
}
|
|
12
|
+
if (!isNullish(maxLeftRatio)) {
|
|
13
|
+
if (maxLeftRatio < 0 || maxLeftRatio > 1)
|
|
14
|
+
throw new Error(`maxLeftRatio must be between 0 and 1. Provided: ${maxLeftRatio}`);
|
|
15
|
+
}
|
|
16
|
+
if (!isNullish(minLeftRatio) && !isNullish(maxLeftRatio) && minLeftRatio >= maxLeftRatio)
|
|
17
|
+
throw new Error(`minLeftRatio must be less than maxLeftRatio. Provided: ${JSON.stringify({ minLeftRatio, maxLeftRatio })}`);
|
|
18
|
+
if (!isNullish(initialLeftRatio) && !isNullish(minLeftRatio) && initialLeftRatio < minLeftRatio)
|
|
19
|
+
throw new Error(`initialLeftRatio must be >= minLeftRatio. Provided: ${JSON.stringify({ initialLeftRatio, minLeftRatio })}`);
|
|
20
|
+
if (!isNullish(initialLeftRatio) && !isNullish(maxLeftRatio) && initialLeftRatio > maxLeftRatio)
|
|
21
|
+
throw new Error(`initialLeftRatio must be <= maxLeftRatio. Provided: ${JSON.stringify({ initialLeftRatio, maxLeftRatio })}`);
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=horizontal-resizable-split-view.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal-resizable-split-view.utils.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/horizontal-resizable-split-view.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,KAAwC,EAAE,EAAE;IAC1F,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/D,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACjC,IAAI,gBAAgB,GAAG,CAAC,IAAI,gBAAgB,GAAG,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,uDAAuD,gBAAgB,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,IAAI,YAAY,GAAG,CAAC,IAAI,YAAY,GAAG,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,mDAAmD,YAAY,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,IAAI,YAAY,GAAG,CAAC,IAAI,YAAY,GAAG,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,mDAAmD,YAAY,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,YAAY;QACtF,MAAM,IAAI,KAAK,CACb,0DAA0D,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,EAAE,CAC3G,CAAC;IAEJ,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,gBAAgB,GAAG,YAAY;QAC7F,MAAM,IAAI,KAAK,CACb,uDAAuD,IAAI,CAAC,SAAS,CAAC,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAC,EAAE,CAC5G,CAAC;IAEJ,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,gBAAgB,GAAG,YAAY;QAC7F,MAAM,IAAI,KAAK,CACb,uDAAuD,IAAI,CAAC,SAAS,CAAC,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAC,EAAE,CAC5G,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export type VerticalResizableOverlayViewAnchorType = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
4
4
|
export interface VerticalResizableOverlayViewProps {
|
|
5
5
|
/** Content to display in the overlay section (foreground, on top) */
|
|
@@ -20,9 +20,9 @@ export interface VerticalResizableOverlayViewProps {
|
|
|
20
20
|
/** Aspect ratio (width/height) for the foreground content. If provided, width will be calculated based on height */
|
|
21
21
|
foregroundContentAspectRatio?: number;
|
|
22
22
|
/** Style for the drag handle container */
|
|
23
|
-
handleContainerStyle?: ViewStyle
|
|
23
|
+
handleContainerStyle?: StyleProp<ViewStyle>;
|
|
24
24
|
/** Style for the drag handle bar */
|
|
25
|
-
handleStyle?: ViewStyle
|
|
25
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
26
26
|
/** Whether to hide the drag handle. Default: false */
|
|
27
27
|
hideHandle?: boolean;
|
|
28
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export interface VerticalResizableSplitViewProps {
|
|
4
4
|
/** Content to display in the top section */
|
|
5
5
|
topContent: ReactNode;
|
|
@@ -12,9 +12,9 @@ export interface VerticalResizableSplitViewProps {
|
|
|
12
12
|
/** Maximum proportion for the top section (0 to 1). Default: 0.85 */
|
|
13
13
|
maxTopRatio?: number;
|
|
14
14
|
/** Style for the drag handle container */
|
|
15
|
-
handleContainerStyle?: ViewStyle
|
|
15
|
+
handleContainerStyle?: StyleProp<ViewStyle>;
|
|
16
16
|
/** Style for the drag handle bar */
|
|
17
|
-
handleStyle?: ViewStyle
|
|
17
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
18
18
|
/** Whether to hide the drag handle. Default: false */
|
|
19
19
|
hideHandle?: boolean;
|
|
20
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/voice-recognition/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { TextInputProps } from 'react-native-paper';
|
|
3
|
+
interface VoiceRecognitionTextInputProps extends TextInputProps {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
7
|
+
onValueSubmit: (value: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const VoiceRecognitionTextInput: FunctionComponent<VoiceRecognitionTextInputProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { isBlank, isNotBlank } from '@lichens-innovation/ts-common';
|
|
14
|
+
import { ExpoSpeechRecognitionModule, useSpeechRecognitionEvent } from 'expo-speech-recognition';
|
|
15
|
+
import { useState } from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import { Keyboard, StyleSheet, View } from 'react-native';
|
|
18
|
+
import { IconButton, TextInput } from 'react-native-paper';
|
|
19
|
+
import { logger } from '../../logger/logger';
|
|
20
|
+
import { useAppTheme } from '../../theme/theme';
|
|
21
|
+
import { buildFinalValue, ensureVoiceRecognitionPermissions } from './voice-recognition.utils';
|
|
22
|
+
export const VoiceRecognitionTextInput = (_a) => {
|
|
23
|
+
var { label, value, onValueChange, onValueSubmit } = _a, rest = __rest(_a, ["label", "value", "onValueChange", "onValueSubmit"]);
|
|
24
|
+
const styles = useStyles();
|
|
25
|
+
const [isRecording, setIsRecording] = useState(false);
|
|
26
|
+
const [recordingValue, setRecordingValue] = useState('');
|
|
27
|
+
const { t } = useTranslation();
|
|
28
|
+
const speechToTextLanguageCode = t('common:speechToTextLanguageCode');
|
|
29
|
+
const finalValue = buildFinalValue({ query: value, recordingValue });
|
|
30
|
+
const triggerOnSearch = () => {
|
|
31
|
+
Keyboard.dismiss();
|
|
32
|
+
onValueSubmit(finalValue.trim());
|
|
33
|
+
setIsRecording(false);
|
|
34
|
+
setRecordingValue('');
|
|
35
|
+
};
|
|
36
|
+
useSpeechRecognitionEvent('result', (event) => {
|
|
37
|
+
if (!isRecording)
|
|
38
|
+
return;
|
|
39
|
+
const transcript = event.results[0].transcript;
|
|
40
|
+
if (isNotBlank(transcript)) {
|
|
41
|
+
setRecordingValue(transcript);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
useSpeechRecognitionEvent('error', (event) => {
|
|
45
|
+
const { error, message } = event;
|
|
46
|
+
logger.error(`[useSpeechRecognitionEvent] error: ${error} - ${message}`);
|
|
47
|
+
setIsRecording(false);
|
|
48
|
+
setRecordingValue('');
|
|
49
|
+
});
|
|
50
|
+
const handleStartRecording = async () => {
|
|
51
|
+
const hasPermissions = await ensureVoiceRecognitionPermissions();
|
|
52
|
+
if (!hasPermissions)
|
|
53
|
+
return;
|
|
54
|
+
setIsRecording(true);
|
|
55
|
+
setRecordingValue('');
|
|
56
|
+
Keyboard.dismiss();
|
|
57
|
+
ExpoSpeechRecognitionModule.start({
|
|
58
|
+
lang: speechToTextLanguageCode,
|
|
59
|
+
interimResults: true,
|
|
60
|
+
continuous: true,
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const handleStopRecording = async () => {
|
|
64
|
+
if (!isRecording)
|
|
65
|
+
return;
|
|
66
|
+
setIsRecording(false);
|
|
67
|
+
ExpoSpeechRecognitionModule.stop();
|
|
68
|
+
if (isNotBlank(recordingValue)) {
|
|
69
|
+
onValueChange(buildFinalValue({ query: value, recordingValue }));
|
|
70
|
+
}
|
|
71
|
+
setRecordingValue('');
|
|
72
|
+
};
|
|
73
|
+
const toggleRecording = () => {
|
|
74
|
+
if (isRecording) {
|
|
75
|
+
handleStopRecording();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
handleStartRecording();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const clearValue = () => {
|
|
82
|
+
onValueChange('');
|
|
83
|
+
setRecordingValue('');
|
|
84
|
+
};
|
|
85
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(TextInput, Object.assign({}, rest, { style: styles.textInput, label: label, value: finalValue, readOnly: isRecording, onChangeText: onValueChange, multiline: true, numberOfLines: 4, left: _jsx(TextInput.Icon, { icon: isRecording ? 'stop' : 'microphone-outline', onPress: toggleRecording }), right: _jsx(TextInput.Icon, { icon: "close", onPress: clearValue, disabled: isBlank(finalValue) }) })), _jsx(View, { style: styles.actionsContainer, children: _jsx(IconButton, { icon: "send", onPress: triggerOnSearch, disabled: isBlank(finalValue), iconColor: styles.sendIcon.color }) })] }));
|
|
86
|
+
};
|
|
87
|
+
const useStyles = () => {
|
|
88
|
+
const theme = useAppTheme();
|
|
89
|
+
return StyleSheet.create({
|
|
90
|
+
container: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
},
|
|
93
|
+
textInput: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
},
|
|
96
|
+
actionsContainer: {
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
},
|
|
99
|
+
sendIcon: {
|
|
100
|
+
color: theme.colors.primary,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=voice-recognition-text-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-recognition-text-input.js","sourceRoot":"","sources":["../../../src/components/voice-recognition/voice-recognition-text-input.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAS/F,MAAM,CAAC,MAAM,yBAAyB,GAAsD,CAAC,EAM5F,EAAE,EAAE;QANwF,EAC3F,KAAK,EACL,KAAK,EACL,aAAa,EACb,aAAa,OAEd,EADI,IAAI,cALoF,oDAM5F,CADQ;IAEP,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IA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3B,SAAS,EAAE,IAAI,EACf,aAAa,EAAE,CAAC,EAChB,IAAI,EAAE,KAAC,SAAS,CAAC,IAAI,IAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,EAAE,OAAO,EAAE,eAAe,GAAI,EACrG,KAAK,EAAE,KAAC,SAAS,CAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,GAAI,IAC1F,EAEF,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,gBAAgB,YAClC,KAAC,UAAU,IACT,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAC7B,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,GAChC,GACG,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAE5B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;SACrB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;SACR;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;SACrB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;SAC5B;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface BuildFinalValueArgs {
|
|
2
|
+
query: string;
|
|
3
|
+
recordingValue: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const buildFinalValue: ({ query, recordingValue }: BuildFinalValueArgs) => string;
|
|
6
|
+
export declare const ensureVoiceRecognitionPermissions: () => Promise<boolean>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isNotBlank } from '@lichens-innovation/ts-common';
|
|
2
|
+
import { ExpoSpeechRecognitionModule } from 'expo-speech-recognition';
|
|
3
|
+
import { logger } from '../../logger/logger';
|
|
4
|
+
export const buildFinalValue = ({ query, recordingValue }) => {
|
|
5
|
+
return [query, recordingValue].filter(isNotBlank).join(' ');
|
|
6
|
+
};
|
|
7
|
+
export const ensureVoiceRecognitionPermissions = async () => {
|
|
8
|
+
try {
|
|
9
|
+
const permissions = await ExpoSpeechRecognitionModule.getPermissionsAsync();
|
|
10
|
+
if (!permissions.granted) {
|
|
11
|
+
const result = await ExpoSpeechRecognitionModule.requestPermissionsAsync();
|
|
12
|
+
if (!result.granted) {
|
|
13
|
+
logger.info('[ensureVoiceRecognitionPermissions] Permissions not granted', result);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
logger.error('[ensureVoiceRecognitionPermissions] Error getting permissions', e);
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=voice-recognition.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-recognition.utils.js","sourceRoot":"","sources":["../../../src/components/voice-recognition/voice-recognition.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK,EAAE,cAAc,EAAuB,EAAU,EAAE;IACxF,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAK,IAAsB,EAAE;IAC5E,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,2BAA2B,CAAC,mBAAmB,EAAE,CAAC;QAC5E,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,uBAAuB,EAAE,CAAC;YAE3E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,6DAA6D,EAAE,MAAM,CAAC,CAAC;gBACnF,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,CAAC,+DAA+D,EAAE,CAAC,CAAC,CAAC;QACjF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useWindowDimensions } from 'react-native';
|
|
2
|
+
export const useWindowOrientation = () => {
|
|
3
|
+
const { width, height } = useWindowDimensions();
|
|
4
|
+
return width > height ? 'landscape' : 'portrait';
|
|
5
|
+
};
|
|
6
|
+
export const useIsLandscape = () => {
|
|
7
|
+
const orientation = useWindowOrientation();
|
|
8
|
+
return orientation === 'landscape';
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-window-orientation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-window-orientation.js","sourceRoot":"","sources":["../../src/hooks/use-window-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAsB,EAAE;IAC1D,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAChD,OAAO,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAY,EAAE;IAC1C,MAAM,WAAW,GAAG,oBAAoB,EAAE,CAAC;IAC3C,OAAO,WAAW,KAAK,WAAW,CAAC;AACrC,CAAC,CAAC"}
|
package/dist/i18n/en/common.json
CHANGED
package/dist/i18n/fr/common.json
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Lichens Innovation React Native Expo shared components, utilities, hooks and services",
|
|
4
4
|
"repository": "https://github.com/Lichens-Innovation/react-native-common",
|
|
5
5
|
"author": "Lichens Innovation",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.3.0",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"expo-router": "~6.0.10",
|
|
83
83
|
"expo-secure-store": "~15.0.7",
|
|
84
84
|
"expo-sharing": "~14.0.7",
|
|
85
|
+
"expo-speech-recognition": "~3.0.1",
|
|
85
86
|
"expo-splash-screen": "~31.0.10",
|
|
86
87
|
"expo-sqlite": "~16.0.8",
|
|
87
88
|
"expo-status-bar": "~3.0.8",
|
|
@@ -143,6 +144,7 @@
|
|
|
143
144
|
"expo-router": ">=6.0.10",
|
|
144
145
|
"expo-secure-store": ">=15.0.7",
|
|
145
146
|
"expo-sharing": ">=14.0.7",
|
|
147
|
+
"expo-speech-recognition": ">=3.0.1",
|
|
146
148
|
"expo-splash-screen": ">=31.0.10",
|
|
147
149
|
"expo-sqlite": ">=16.0.8",
|
|
148
150
|
"expo-status-bar": ">=3.0.8",
|