bootstrap-rn 0.4.10 → 0.4.12
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/lib/module/components/close/CloseButton.js +1 -1
- package/lib/module/components/close/CloseButton.js.map +1 -1
- package/lib/module/components/collapse/Collapse.js +1 -0
- package/lib/module/components/collapse/Collapse.js.map +1 -1
- package/lib/module/components/forms/FormCheckInput.js +1 -5
- package/lib/module/components/forms/FormCheckInput.js.map +1 -1
- package/lib/module/components/forms/Picker.js +24 -35
- package/lib/module/components/forms/Picker.js.map +1 -1
- package/lib/module/components/forms/PickerItem.js +1 -9
- package/lib/module/components/forms/PickerItem.js.map +1 -1
- package/lib/module/components/forms/Radio.js +1 -0
- package/lib/module/components/forms/Radio.js.map +1 -1
- package/lib/module/components/forms/internals/{FormCheckInputNative.js → FormCheckInput.js} +4 -4
- package/lib/module/components/forms/internals/FormCheckInput.js.map +1 -0
- package/lib/module/components/forms/internals/{FormCheckInputWeb.js → FormCheckInput.web.js} +4 -4
- package/lib/module/components/forms/internals/FormCheckInput.web.js.map +1 -0
- package/lib/module/components/forms/internals/{PickerNative.js → Picker.js} +4 -4
- package/lib/module/components/forms/internals/Picker.js.map +1 -0
- package/lib/module/components/forms/internals/{PickerWeb.js → Picker.web.js} +4 -4
- package/lib/module/components/forms/internals/Picker.web.js.map +1 -0
- package/lib/module/components/forms/internals/{PickerNativeItem.js → PickerItem.js} +3 -3
- package/lib/module/components/forms/internals/PickerItem.js.map +1 -0
- package/lib/module/components/forms/internals/{PickerWebItem.js → PickerItem.web.js} +3 -3
- package/lib/module/components/forms/internals/PickerItem.web.js.map +1 -0
- package/lib/module/components/helpers/Portal.js +20 -1
- package/lib/module/components/helpers/Portal.js.map +1 -1
- package/lib/module/components/helpers/Portal.web.js +10 -2
- package/lib/module/components/helpers/Portal.web.js.map +1 -1
- package/lib/module/components/helpers/PortalHost.web.js +4 -1
- package/lib/module/components/helpers/PortalHost.web.js.map +1 -1
- package/lib/module/components/list-group/ListGroup.js +1 -0
- package/lib/module/components/list-group/ListGroup.js.map +1 -1
- package/lib/module/components/navbar/NavbarToggler.js +1 -1
- package/lib/module/components/navbar/NavbarToggler.js.map +1 -1
- package/lib/module/components/popover/Popover.js +1 -0
- package/lib/module/components/popover/Popover.js.map +1 -1
- package/lib/module/components/progress/Progress.js +1 -0
- package/lib/module/components/progress/Progress.js.map +1 -1
- package/lib/module/components/tooltip/Tooltip.js +1 -0
- package/lib/module/components/tooltip/Tooltip.js.map +1 -1
- package/lib/module/components/type/Paragraph.js +2 -2
- package/lib/module/components/type/Paragraph.js.map +1 -1
- package/lib/module/hooks/useBackground.js +167 -4
- package/lib/module/hooks/useBackground.js.map +1 -1
- package/lib/module/hooks/{useBackgroundWeb.js → useBackground.web.js} +2 -2
- package/lib/module/hooks/useBackground.web.js.map +1 -0
- package/lib/module/hooks/useOverlay.web.js +6 -1
- package/lib/module/hooks/useOverlay.web.js.map +1 -1
- package/lib/module/hooks/usePortalRegistry.js +26 -0
- package/lib/module/hooks/usePortalRegistry.js.map +1 -0
- package/lib/typescript/components/collapse/Collapse.d.ts +5 -0
- package/lib/typescript/components/collapse/Collapse.d.ts.map +1 -1
- package/lib/typescript/components/forms/FormCheckInput.d.ts +0 -1
- package/lib/typescript/components/forms/FormCheckInput.d.ts.map +1 -1
- package/lib/typescript/components/forms/Picker.d.ts +0 -1
- package/lib/typescript/components/forms/Picker.d.ts.map +1 -1
- package/lib/typescript/components/forms/PickerItem.d.ts.map +1 -1
- package/lib/typescript/components/forms/Radio.d.ts +5 -0
- package/lib/typescript/components/forms/Radio.d.ts.map +1 -1
- package/lib/typescript/components/forms/internals/FormCheckInput.d.ts +10 -0
- package/lib/typescript/components/forms/internals/FormCheckInput.d.ts.map +1 -0
- package/lib/typescript/components/forms/internals/FormCheckInput.web.d.ts +10 -0
- package/lib/typescript/components/forms/internals/FormCheckInput.web.d.ts.map +1 -0
- package/lib/typescript/components/forms/internals/Picker.d.ts +10 -0
- package/lib/typescript/components/forms/internals/Picker.d.ts.map +1 -0
- package/lib/typescript/components/forms/internals/Picker.web.d.ts +10 -0
- package/lib/typescript/components/forms/internals/Picker.web.d.ts.map +1 -0
- package/lib/typescript/components/forms/internals/PickerItem.d.ts +10 -0
- package/lib/typescript/components/forms/internals/PickerItem.d.ts.map +1 -0
- package/lib/typescript/components/forms/internals/PickerItem.web.d.ts +10 -0
- package/lib/typescript/components/forms/internals/PickerItem.web.d.ts.map +1 -0
- package/lib/typescript/components/helpers/Portal.d.ts +2 -1
- package/lib/typescript/components/helpers/Portal.d.ts.map +1 -1
- package/lib/typescript/components/helpers/Portal.web.d.ts +2 -1
- package/lib/typescript/components/helpers/Portal.web.d.ts.map +1 -1
- package/lib/typescript/components/list-group/ListGroup.d.ts +3 -0
- package/lib/typescript/components/list-group/ListGroup.d.ts.map +1 -1
- package/lib/typescript/components/list-group/ListGroupContext.d.ts +2 -2
- package/lib/typescript/components/list-group/ListGroupContext.d.ts.map +1 -1
- package/lib/typescript/components/popover/Popover.d.ts +4 -0
- package/lib/typescript/components/popover/Popover.d.ts.map +1 -1
- package/lib/typescript/components/progress/Progress.d.ts +4 -0
- package/lib/typescript/components/progress/Progress.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/Tooltip.d.ts +4 -0
- package/lib/typescript/components/tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/components/type/Paragraph.d.ts +2 -2
- package/lib/typescript/components/type/Paragraph.d.ts.map +1 -1
- package/lib/typescript/hooks/useBackground.d.ts +8 -4
- package/lib/typescript/hooks/useBackground.d.ts.map +1 -1
- package/lib/typescript/hooks/useBackground.web.d.ts +6 -0
- package/lib/typescript/hooks/useBackground.web.d.ts.map +1 -0
- package/lib/typescript/hooks/useOverlay.web.d.ts +5 -2
- package/lib/typescript/hooks/useOverlay.web.d.ts.map +1 -1
- package/lib/typescript/hooks/usePortalRegistry.d.ts +2 -0
- package/lib/typescript/hooks/usePortalRegistry.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/buttons/Button.tsx +380 -380
- package/src/components/collapse/Collapse.tsx +1 -0
- package/src/components/forms/FormCheckInput.tsx +1 -10
- package/src/components/forms/Input.tsx +219 -219
- package/src/components/forms/Picker.tsx +24 -40
- package/src/components/forms/PickerItem.tsx +1 -12
- package/src/components/forms/Radio.tsx +1 -0
- package/src/components/forms/RadioContext.ts +13 -13
- package/src/components/forms/internals/{FormCheckInputNative.tsx → FormCheckInput.tsx} +4 -4
- package/src/components/forms/internals/{FormCheckInputWeb.tsx → FormCheckInput.web.tsx} +4 -4
- package/src/components/forms/internals/{PickerNative.tsx → Picker.tsx} +3 -5
- package/src/components/forms/internals/{PickerWeb.tsx → Picker.web.tsx} +3 -3
- package/src/components/forms/internals/{PickerNativeItem.tsx → PickerItem.tsx} +3 -5
- package/src/components/forms/internals/{PickerWebItem.tsx → PickerItem.web.tsx} +3 -5
- package/src/components/forms/internals/PickerNativeContext.ts +14 -14
- package/src/components/helpers/Portal.tsx +16 -2
- package/src/components/helpers/Portal.web.tsx +16 -4
- package/src/components/helpers/PortalHost.web.tsx +1 -1
- package/src/components/list-group/ListGroup.tsx +1 -0
- package/src/components/list-group/ListGroupContext.ts +11 -11
- package/src/components/popover/Popover.tsx +1 -0
- package/src/components/popover/PopoverContext.ts +13 -13
- package/src/components/progress/Progress.tsx +1 -0
- package/src/components/tooltip/Tooltip.tsx +1 -0
- package/src/components/tooltip/TooltipContext.ts +13 -13
- package/src/components/type/Paragraph.tsx +2 -2
- package/src/hooks/useBackground.tsx +203 -4
- package/src/hooks/{useBackgroundWeb.tsx → useBackground.web.tsx} +1 -1
- package/src/hooks/useOverlay.web.ts +20 -3
- package/src/hooks/usePortalRegistry.ts +36 -0
- package/lib/module/components/forms/PickerContext.js +0 -7
- package/lib/module/components/forms/PickerContext.js.map +0 -1
- package/lib/module/components/forms/internals/FormCheckInputNative.js.map +0 -1
- package/lib/module/components/forms/internals/FormCheckInputWeb.js.map +0 -1
- package/lib/module/components/forms/internals/PickerNative.js.map +0 -1
- package/lib/module/components/forms/internals/PickerNativeItem.js.map +0 -1
- package/lib/module/components/forms/internals/PickerWeb.js.map +0 -1
- package/lib/module/components/forms/internals/PickerWebItem.js.map +0 -1
- package/lib/module/hooks/useBackgroundNative.js +0 -170
- package/lib/module/hooks/useBackgroundNative.js.map +0 -1
- package/lib/module/hooks/useBackgroundWeb.js.map +0 -1
- package/lib/typescript/components/forms/PickerContext.d.ts +0 -7
- package/lib/typescript/components/forms/PickerContext.d.ts.map +0 -1
- package/lib/typescript/components/forms/internals/FormCheckInputNative.d.ts +0 -10
- package/lib/typescript/components/forms/internals/FormCheckInputNative.d.ts.map +0 -1
- package/lib/typescript/components/forms/internals/FormCheckInputWeb.d.ts +0 -10
- package/lib/typescript/components/forms/internals/FormCheckInputWeb.d.ts.map +0 -1
- package/lib/typescript/components/forms/internals/PickerNative.d.ts +0 -10
- package/lib/typescript/components/forms/internals/PickerNative.d.ts.map +0 -1
- package/lib/typescript/components/forms/internals/PickerNativeItem.d.ts +0 -10
- package/lib/typescript/components/forms/internals/PickerNativeItem.d.ts.map +0 -1
- package/lib/typescript/components/forms/internals/PickerWeb.d.ts +0 -10
- package/lib/typescript/components/forms/internals/PickerWeb.d.ts.map +0 -1
- package/lib/typescript/components/forms/internals/PickerWebItem.d.ts +0 -10
- package/lib/typescript/components/forms/internals/PickerWebItem.d.ts.map +0 -1
- package/lib/typescript/hooks/useBackgroundNative.d.ts +0 -9
- package/lib/typescript/hooks/useBackgroundNative.d.ts.map +0 -1
- package/lib/typescript/hooks/useBackgroundWeb.d.ts +0 -6
- package/lib/typescript/hooks/useBackgroundWeb.d.ts.map +0 -1
- package/src/components/forms/PickerContext.ts +0 -11
- package/src/hooks/useBackgroundNative.tsx +0 -204
|
@@ -9,7 +9,7 @@ import useBackground from '../../../hooks/useBackground';
|
|
|
9
9
|
import type { PressableRef } from '../../Pressable';
|
|
10
10
|
import type { FormCheckInputProps } from '../FormCheckInput';
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface BaseFormCheckInputProps extends FormCheckInputProps {
|
|
13
13
|
style: ViewStyle[];
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -38,8 +38,8 @@ const Input = ({
|
|
|
38
38
|
}: InputProps & React.RefAttributes<HTMLInputElement>) =>
|
|
39
39
|
createElement('input', { ...props, ref, style: [styles.reboot, style] });
|
|
40
40
|
|
|
41
|
-
function
|
|
42
|
-
props:
|
|
41
|
+
function FormCheckInput(
|
|
42
|
+
props: BaseFormCheckInputProps & React.RefAttributes<PressableRef>,
|
|
43
43
|
) {
|
|
44
44
|
const {
|
|
45
45
|
ref,
|
|
@@ -76,4 +76,4 @@ function FormCheckInputWeb(
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export default
|
|
79
|
+
export default FormCheckInput;
|
|
@@ -15,7 +15,7 @@ import PickerNativeContext from './PickerNativeContext';
|
|
|
15
15
|
import type { PickerProps, MenuComponentProps } from '../Picker';
|
|
16
16
|
import type { PickerItemProps } from '../PickerItem';
|
|
17
17
|
|
|
18
|
-
export interface
|
|
18
|
+
export interface BasePickerProps extends PickerProps {
|
|
19
19
|
style: TextStyle[];
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -107,9 +107,7 @@ function DefaultMenuComponent({
|
|
|
107
107
|
}
|
|
108
108
|
/* eslint-enable */
|
|
109
109
|
|
|
110
|
-
function
|
|
111
|
-
props: PickerNativeProps & React.RefAttributes<PressableRef>,
|
|
112
|
-
) {
|
|
110
|
+
function Picker(props: BasePickerProps & React.RefAttributes<PressableRef>) {
|
|
113
111
|
const {
|
|
114
112
|
ref,
|
|
115
113
|
children,
|
|
@@ -193,4 +191,4 @@ function PickerNative(
|
|
|
193
191
|
);
|
|
194
192
|
}
|
|
195
193
|
|
|
196
|
-
export default
|
|
194
|
+
export default Picker;
|
|
@@ -10,7 +10,7 @@ import PickerWebContext from './PickerWebContext';
|
|
|
10
10
|
import type { PickerProps } from '../Picker';
|
|
11
11
|
import type { PressableRef } from '../../Pressable';
|
|
12
12
|
|
|
13
|
-
interface
|
|
13
|
+
interface BasePickerProps extends PickerProps {
|
|
14
14
|
style: TextStyle[];
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -33,7 +33,7 @@ const getOptionStyle = (
|
|
|
33
33
|
return null;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
function Picker(props: BasePickerProps & React.RefAttributes<PressableRef>) {
|
|
37
37
|
const {
|
|
38
38
|
ref,
|
|
39
39
|
children,
|
|
@@ -83,4 +83,4 @@ function PickerWeb(props: PickerWebProps & React.RefAttributes<PressableRef>) {
|
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export default
|
|
86
|
+
export default Picker;
|
|
@@ -10,7 +10,7 @@ import useForcedContext from '../../../hooks/useForcedContext';
|
|
|
10
10
|
import PickerNativeContext from './PickerNativeContext';
|
|
11
11
|
import { ViewProps, ViewRef } from '../../View';
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface PickerItemProps extends ViewProps {
|
|
14
14
|
label: string;
|
|
15
15
|
value: string;
|
|
16
16
|
disabled?: boolean;
|
|
@@ -24,9 +24,7 @@ const styles = StyleSheet.create({
|
|
|
24
24
|
itemDisabled: css``,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
function
|
|
28
|
-
props: PickerNativeItemProps & React.RefAttributes<ViewRef>,
|
|
29
|
-
) {
|
|
27
|
+
function PickerItem(props: PickerItemProps & React.RefAttributes<ViewRef>) {
|
|
30
28
|
const { ref, label, value, disabled = false } = props;
|
|
31
29
|
|
|
32
30
|
const { selectedValue, handleValueChange } =
|
|
@@ -54,4 +52,4 @@ function PickerNativeItem(
|
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
export default
|
|
55
|
+
export default PickerItem;
|
|
@@ -7,15 +7,13 @@ import useForcedContext from '../../../hooks/useForcedContext';
|
|
|
7
7
|
import PickerWebContext from './PickerWebContext';
|
|
8
8
|
import type { ViewProps, ViewRef } from '../../View';
|
|
9
9
|
|
|
10
|
-
export interface
|
|
10
|
+
export interface PickerItemProps extends ViewProps {
|
|
11
11
|
label: string;
|
|
12
12
|
value: string;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
function
|
|
17
|
-
props: PickerWebItemProps & React.RefAttributes<ViewRef>,
|
|
18
|
-
) {
|
|
16
|
+
function PickerItem(props: PickerItemProps & React.RefAttributes<ViewRef>) {
|
|
19
17
|
const { ref, label, value, disabled = false } = props;
|
|
20
18
|
|
|
21
19
|
const { optionColor } = useForcedContext(PickerWebContext);
|
|
@@ -31,4 +29,4 @@ function PickerWebItem(
|
|
|
31
29
|
);
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
export default
|
|
32
|
+
export default PickerItem;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
type PickerNativeContextType = {
|
|
4
|
-
selectedValue?: string | null | undefined;
|
|
5
|
-
handleValueChange: (value: string) => void;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const PickerNativeContext = React.createContext<PickerNativeContextType | null>(
|
|
9
|
-
null,
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
PickerNativeContext.displayName = 'PickerNativeContext';
|
|
13
|
-
|
|
14
|
-
export default PickerNativeContext;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type PickerNativeContextType = {
|
|
4
|
+
selectedValue?: string | null | undefined;
|
|
5
|
+
handleValueChange: (value: string) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const PickerNativeContext = React.createContext<PickerNativeContextType | null>(
|
|
9
|
+
null,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
PickerNativeContext.displayName = 'PickerNativeContext';
|
|
13
|
+
|
|
14
|
+
export default PickerNativeContext;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Portal as BasePortal } from '@rn-primitives/portal';
|
|
3
|
+
import usePortalRegistry from '../../hooks/usePortalRegistry';
|
|
4
|
+
import TextStyleContext from '../../style/TextStyleContext';
|
|
2
5
|
|
|
3
6
|
export interface PortalProps {
|
|
4
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
5
7
|
name: string;
|
|
6
8
|
hostName?: string;
|
|
7
9
|
children: React.ReactNode;
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
function Portal({ name, hostName, children }: PortalProps) {
|
|
13
|
+
usePortalRegistry(name, hostName);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<BasePortal name={name} hostName={hostName}>
|
|
17
|
+
<TextStyleContext.Provider value={null}>
|
|
18
|
+
{children}
|
|
19
|
+
</TextStyleContext.Provider>
|
|
20
|
+
</BasePortal>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
export default Portal;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { useLayoutEffect, useState } from 'react';
|
|
1
|
+
import React, { useLayoutEffect, useState } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
+
import usePortalRegistry from '../../hooks/usePortalRegistry';
|
|
4
|
+
import TextStyleContext from '../../style/TextStyleContext';
|
|
3
5
|
|
|
4
6
|
export interface PortalProps {
|
|
5
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
6
7
|
name: string;
|
|
7
8
|
hostName?: string;
|
|
8
9
|
children: React.ReactNode;
|
|
@@ -10,11 +11,17 @@ export interface PortalProps {
|
|
|
10
11
|
|
|
11
12
|
const DEFAULT_PORTAL_HOST = 'INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME';
|
|
12
13
|
|
|
13
|
-
function Portal({
|
|
14
|
+
function Portal({
|
|
15
|
+
name,
|
|
16
|
+
hostName = DEFAULT_PORTAL_HOST,
|
|
17
|
+
children,
|
|
18
|
+
}: PortalProps) {
|
|
14
19
|
const [element, setElement] = useState(() =>
|
|
15
20
|
document.getElementById(hostName),
|
|
16
21
|
);
|
|
17
22
|
|
|
23
|
+
usePortalRegistry(name, hostName);
|
|
24
|
+
|
|
18
25
|
// Retry lookup after mount, before paint, in case the host element
|
|
19
26
|
// was not yet committed to the DOM during the initial render.
|
|
20
27
|
useLayoutEffect(() => {
|
|
@@ -36,7 +43,12 @@ function Portal({ hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
|
|
|
36
43
|
return null;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
return createPortal(
|
|
46
|
+
return createPortal(
|
|
47
|
+
<TextStyleContext.Provider value={null}>
|
|
48
|
+
{children}
|
|
49
|
+
</TextStyleContext.Provider>,
|
|
50
|
+
element,
|
|
51
|
+
);
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
export default Portal;
|
|
@@ -8,7 +8,7 @@ export interface PortalHostProps {
|
|
|
8
8
|
const DEFAULT_PORTAL_HOST = 'INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME';
|
|
9
9
|
|
|
10
10
|
function PortalHost({ name = DEFAULT_PORTAL_HOST }: PortalHostProps) {
|
|
11
|
-
return <View id={name} />;
|
|
11
|
+
return <View id={name} style={{ position: 'absolute' }} />;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export default PortalHost;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
flush?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const ListGroupContext = React.createContext<ListGroupContextType | null>(null);
|
|
8
|
-
|
|
9
|
-
ListGroupContext.displayName = 'ListGroupContext';
|
|
10
|
-
|
|
11
|
-
export default ListGroupContext;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ListGroupContextType = {
|
|
4
|
+
flush?: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const ListGroupContext = React.createContext<ListGroupContextType | null>(null);
|
|
8
|
+
|
|
9
|
+
ListGroupContext.displayName = 'ListGroupContext';
|
|
10
|
+
|
|
11
|
+
export default ListGroupContext;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { OverlayPlacement } from '../../types';
|
|
3
|
-
|
|
4
|
-
type PopoverContextType = {
|
|
5
|
-
placement: OverlayPlacement;
|
|
6
|
-
floating?: boolean;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const PopoverContext = React.createContext<PopoverContextType | null>(null);
|
|
10
|
-
|
|
11
|
-
PopoverContext.displayName = 'PopoverContext';
|
|
12
|
-
|
|
13
|
-
export default PopoverContext;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OverlayPlacement } from '../../types';
|
|
3
|
+
|
|
4
|
+
type PopoverContextType = {
|
|
5
|
+
placement: OverlayPlacement;
|
|
6
|
+
floating?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const PopoverContext = React.createContext<PopoverContextType | null>(null);
|
|
10
|
+
|
|
11
|
+
PopoverContext.displayName = 'PopoverContext';
|
|
12
|
+
|
|
13
|
+
export default PopoverContext;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { OverlayPlacement } from '../../types';
|
|
3
|
-
|
|
4
|
-
type TooltipContextType = {
|
|
5
|
-
placement: OverlayPlacement;
|
|
6
|
-
floating?: boolean;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const TooltipContext = React.createContext<TooltipContextType | null>(null);
|
|
10
|
-
|
|
11
|
-
TooltipContext.displayName = 'TooltipContext';
|
|
12
|
-
|
|
13
|
-
export default TooltipContext;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OverlayPlacement } from '../../types';
|
|
3
|
+
|
|
4
|
+
type TooltipContextType = {
|
|
5
|
+
placement: OverlayPlacement;
|
|
6
|
+
floating?: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const TooltipContext = React.createContext<TooltipContextType | null>(null);
|
|
10
|
+
|
|
11
|
+
TooltipContext.displayName = 'TooltipContext';
|
|
12
|
+
|
|
13
|
+
export default TooltipContext;
|
|
@@ -21,7 +21,7 @@ const styles = StyleSheet.create({
|
|
|
21
21
|
`,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function Paragraph(props: ParagraphProps & React.RefAttributes<TextRef>) {
|
|
25
25
|
const { ref, children, lead, style, ...elementProps } = props;
|
|
26
26
|
|
|
27
27
|
const classes = getStyles(styles, ['paragraph', lead && '.lead']);
|
|
@@ -37,4 +37,4 @@ function Heading(props: ParagraphProps & React.RefAttributes<TextRef>) {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export default
|
|
40
|
+
export default Paragraph;
|
|
@@ -1,5 +1,204 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { I18nManager, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { SvgXml } from 'react-native-svg';
|
|
4
|
+
import type { BaseStyle } from '../types';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
type Position = 'center' | 'left' | 'right' | 'top' | 'bottom';
|
|
7
|
+
|
|
8
|
+
type BackgroundSize = 'cover' | 'contain' | { width: number; height: number };
|
|
9
|
+
|
|
10
|
+
type BackgroundResult = {
|
|
11
|
+
containerStyle: BaseStyle;
|
|
12
|
+
objectStyle: BaseStyle;
|
|
13
|
+
xml: string | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
container: { overflow: 'hidden' },
|
|
18
|
+
object: { aspectRatio: 1 },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const horizontalPositions = {
|
|
22
|
+
left: (offset: number = 0) => ({
|
|
23
|
+
alignItems: I18nManager.isRTL ? 'flex-end' : 'flex-start',
|
|
24
|
+
paddingLeft: offset,
|
|
25
|
+
}),
|
|
26
|
+
right: (offset: number = 0) => ({
|
|
27
|
+
alignItems: I18nManager.isRTL ? 'flex-start' : 'flex-end',
|
|
28
|
+
paddingRight: offset,
|
|
29
|
+
}),
|
|
30
|
+
center: (offset?: number) => {
|
|
31
|
+
if (offset !== undefined) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
top: undefined,
|
|
40
|
+
bottom: undefined,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const verticalPositions = {
|
|
44
|
+
top: (offset: number = 0) => ({
|
|
45
|
+
justifyContent: 'flex-start',
|
|
46
|
+
paddingTop: offset,
|
|
47
|
+
}),
|
|
48
|
+
bottom: (offset: number = 0) => ({
|
|
49
|
+
justifyContent: 'flex-end',
|
|
50
|
+
paddingBottom: offset,
|
|
51
|
+
}),
|
|
52
|
+
center: (offset?: number) => {
|
|
53
|
+
if (offset !== undefined) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
left: undefined,
|
|
62
|
+
right: undefined,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getXml = (value: string) => {
|
|
66
|
+
const match = value.match(/^url\("data:image\/svg\+xml,(.*?)"\)$/);
|
|
67
|
+
|
|
68
|
+
if (!match) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return decodeURIComponent(match[1]);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const transforms = {
|
|
76
|
+
backgroundSize(value: BackgroundSize) {
|
|
77
|
+
if (value === 'cover') {
|
|
78
|
+
return {
|
|
79
|
+
width: '100%',
|
|
80
|
+
// TODO: Support cover for views with height > width.
|
|
81
|
+
// height: '100%',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (value === 'contain') {
|
|
86
|
+
return {
|
|
87
|
+
width: '100%',
|
|
88
|
+
height: '100%',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const { width, height = width } = value;
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
width,
|
|
96
|
+
height,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
backgroundPosition(value: Position) {
|
|
100
|
+
if (value === 'center') {
|
|
101
|
+
return {
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const horizontalPosition = horizontalPositions[value];
|
|
108
|
+
|
|
109
|
+
if (horizontalPosition !== undefined) {
|
|
110
|
+
return {
|
|
111
|
+
...horizontalPosition(),
|
|
112
|
+
justifyContent: 'center',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const verticalPosition = verticalPositions[value];
|
|
117
|
+
|
|
118
|
+
if (verticalPosition) {
|
|
119
|
+
return {
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
...verticalPosition(),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return null;
|
|
126
|
+
},
|
|
127
|
+
backgroundPositionX(
|
|
128
|
+
value: Position | { position: Position; offset: number },
|
|
129
|
+
) {
|
|
130
|
+
const { position = 'left', offset } =
|
|
131
|
+
typeof value === 'object'
|
|
132
|
+
? value
|
|
133
|
+
: { position: value, offset: undefined };
|
|
134
|
+
|
|
135
|
+
const horizontalPosition = horizontalPositions[position];
|
|
136
|
+
|
|
137
|
+
if (!horizontalPosition) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return horizontalPosition(offset);
|
|
142
|
+
},
|
|
143
|
+
backgroundPositionY(
|
|
144
|
+
value: Position | { position: Position; offset: number },
|
|
145
|
+
) {
|
|
146
|
+
const { position = 'top', offset } =
|
|
147
|
+
typeof value === 'object'
|
|
148
|
+
? value
|
|
149
|
+
: { position: value, offset: undefined };
|
|
150
|
+
|
|
151
|
+
const verticalPosition = verticalPositions[position];
|
|
152
|
+
|
|
153
|
+
if (!verticalPosition) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return verticalPosition(offset);
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export default function useBackground(style: BaseStyle[]) {
|
|
162
|
+
const flattenedStyle = StyleSheet.flatten(style);
|
|
163
|
+
|
|
164
|
+
const background: BackgroundResult = {
|
|
165
|
+
containerStyle: {},
|
|
166
|
+
objectStyle: {},
|
|
167
|
+
xml: null,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
Object.entries(flattenedStyle).forEach(([key, value]) => {
|
|
171
|
+
if (!value) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (key === 'backgroundImage') {
|
|
176
|
+
background.xml = getXml(value);
|
|
177
|
+
} else if (key === 'backgroundSize') {
|
|
178
|
+
Object.assign(background.objectStyle, transforms[key](value));
|
|
179
|
+
} else if (
|
|
180
|
+
key === 'backgroundPosition' ||
|
|
181
|
+
key === 'backgroundPositionX' ||
|
|
182
|
+
key === 'backgroundPositionY'
|
|
183
|
+
) {
|
|
184
|
+
Object.assign(background.containerStyle, transforms[key](value));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
style: flattenedStyle,
|
|
190
|
+
element: (
|
|
191
|
+
<View
|
|
192
|
+
style={[
|
|
193
|
+
StyleSheet.absoluteFill,
|
|
194
|
+
styles.container,
|
|
195
|
+
background.containerStyle,
|
|
196
|
+
]}
|
|
197
|
+
>
|
|
198
|
+
<View style={[styles.object, background.objectStyle]}>
|
|
199
|
+
{background.xml && <SvgXml xml={background.xml} />}
|
|
200
|
+
</View>
|
|
201
|
+
</View>
|
|
202
|
+
),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
@@ -102,7 +102,7 @@ const resolveBackgroundPosition = (style: BackgroundWebStyle) => {
|
|
|
102
102
|
return `${valueX} ${valueY}`;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export default function
|
|
105
|
+
export default function useBackground(style: BaseStyle[]) {
|
|
106
106
|
const flattenedStyle = StyleSheet.flatten(style);
|
|
107
107
|
|
|
108
108
|
const backgroundStyle: BaseStyle = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLProps, useId, useMemo, useRef } from 'react';
|
|
2
|
-
import { I18nManager } from 'react-native';
|
|
2
|
+
import { GestureResponderEvent, I18nManager } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
useFloating,
|
|
5
5
|
arrow,
|
|
@@ -61,10 +61,27 @@ const getAlignedPlacement = (
|
|
|
61
61
|
|
|
62
62
|
const transformReferenceProps =
|
|
63
63
|
(handle: UseInteractionsReturn['getReferenceProps']) =>
|
|
64
|
-
(
|
|
64
|
+
(
|
|
65
|
+
props:
|
|
66
|
+
| (HTMLProps<Element> & { onPress?: (event: unknown) => void })
|
|
67
|
+
| undefined,
|
|
68
|
+
) => {
|
|
69
|
+
const handlePress = props?.onPress;
|
|
65
70
|
const { onClick, ...referenceProps } = handle(props);
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
const handleClick = onClick as
|
|
73
|
+
| ((event: GestureResponderEvent) => void)
|
|
74
|
+
| undefined;
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
...referenceProps,
|
|
78
|
+
onPress: handlePress
|
|
79
|
+
? (event: GestureResponderEvent) => {
|
|
80
|
+
handleClick?.(event);
|
|
81
|
+
handlePress(event);
|
|
82
|
+
}
|
|
83
|
+
: handleClick,
|
|
84
|
+
};
|
|
68
85
|
};
|
|
69
86
|
|
|
70
87
|
export default function useOverlay({
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_PORTAL_HOST = 'INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME';
|
|
4
|
+
|
|
5
|
+
const registry = new Map<string, Set<string>>();
|
|
6
|
+
|
|
7
|
+
export default function usePortalRegistry(
|
|
8
|
+
name: string,
|
|
9
|
+
hostName: string = DEFAULT_PORTAL_HOST,
|
|
10
|
+
) {
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
|
+
let names = registry.get(hostName);
|
|
13
|
+
|
|
14
|
+
if (!names) {
|
|
15
|
+
names = new Set();
|
|
16
|
+
registry.set(hostName, names);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (names.has(name)) {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.warn(
|
|
22
|
+
`Portal: A portal with name "${name}" is already registered on host "${hostName}".`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
names.add(name);
|
|
27
|
+
|
|
28
|
+
return () => {
|
|
29
|
+
names.delete(name);
|
|
30
|
+
|
|
31
|
+
if (names.size === 0) {
|
|
32
|
+
registry.delete(hostName);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}, [name, hostName]);
|
|
36
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","PickerContext","createContext","displayName"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/forms/PickerContext.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAMzB,MAAMC,aAAa,gBAAGD,KAAK,CAACE,aAAa,CAA2B,IAAI,CAAC;AAEzED,aAAa,CAACE,WAAW,GAAG,eAAe;AAE3C,eAAeF,aAAa","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Pressable","useBackground","jsx","_jsx","FormCheckInputNative","props","ref","type","value","onValueChange","handleValueChange","onFocus","onBlur","hitSlop","disabled","style","id","inputBackground","role","onPress","children","element"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/forms/internals/FormCheckInputNative.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,SAAS,MAAwB,oBAAiB;AACzD,OAAOC,aAAa,MAAM,iCAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOzD,SAASC,oBAAoBA,CAC3BC,KAAoE,EACpE;EACA,MAAM;IACJC,GAAG;IACHC,IAAI;IACJC,KAAK;IACLC,aAAa,EAAEC,iBAAiB;IAChCC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;IAClBC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;IACjBC,OAAO,GAAG,CAAC;IACXC,QAAQ,GAAG,KAAK;IAChBC,KAAK;IACLC;EACF,CAAC,GAAGX,KAAK;EAET,MAAMY,eAAe,GAAGhB,aAAa,CAACc,KAAK,CAAC;EAE5C,oBACEZ,IAAA,CAACH,SAAS;IACRM,GAAG,EAAEA,GAAI;IACTY,IAAI,EAAEX,IAAK;IACX,gBAAcC,KAAM;IACpBW,OAAO,EAAEA,CAAA,KAAM;MACb,IAAIT,iBAAiB,EAAEA,iBAAiB,CAAC,CAACF,KAAK,CAAC;IAClD,CAAE;IACFG,OAAO,EAAEA,OAAQ;IACjBC,MAAM,EAAEA,MAAO;IACfC,OAAO,EAAEA,OAAQ;IACjBC,QAAQ,EAAEA,QAAS;IACnBC,KAAK,EAAEE,eAAe,CAACF,KAAM;IAC7BC,EAAE,EAAEA,EAAG;IAAAI,QAAA,EAENH,eAAe,CAACI;EAAO,CACf,CAAC;AAEhB;AAEA,eAAejB,oBAAoB","ignoreList":[]}
|