expo-interface 0.1.0 → 0.2.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/README.md +282 -180
- package/package.json +39 -13
- package/src/alert/alert.css +49 -0
- package/src/alert/index.android.tsx +68 -0
- package/src/alert/index.ios.tsx +47 -0
- package/src/alert/index.tsx +60 -0
- package/src/alert/shared.ts +10 -0
- package/src/alert/types.ts +58 -0
- package/src/button/button.css +6 -0
- package/src/button/index.android.tsx +9 -2
- package/src/button/index.ios.tsx +8 -3
- package/src/button/index.tsx +19 -1
- package/src/button/types.ts +7 -0
- package/src/checkbox/checkbox.css +29 -0
- package/src/checkbox/index.android.tsx +54 -0
- package/src/checkbox/index.ios.tsx +50 -0
- package/src/checkbox/index.tsx +50 -0
- package/src/checkbox/types.ts +27 -0
- package/src/collapsible/collapsible.css +32 -0
- package/src/collapsible/index.android.tsx +34 -0
- package/src/collapsible/index.ios.tsx +31 -0
- package/src/collapsible/index.tsx +41 -0
- package/src/collapsible/shared.ts +21 -0
- package/src/collapsible/types.ts +24 -0
- package/src/color-picker/color-picker.css +66 -0
- package/src/color-picker/index.android.tsx +117 -0
- package/src/color-picker/index.ios.tsx +33 -0
- package/src/color-picker/index.tsx +62 -0
- package/src/color-picker/shared.ts +204 -0
- package/src/color-picker/sheet.tsx +432 -0
- package/src/color-picker/types.ts +34 -0
- package/src/context-menu/index.android.tsx +27 -0
- package/src/context-menu/index.ios.tsx +22 -0
- package/src/context-menu/index.tsx +56 -0
- package/src/date-time/index.android.tsx +3 -2
- package/src/divider/divider.css +16 -0
- package/src/divider/index.android.tsx +26 -0
- package/src/divider/index.ios.tsx +18 -0
- package/src/divider/index.tsx +21 -0
- package/src/divider/types.ts +20 -0
- package/src/field-group/field-group.css +23 -7
- package/src/field-group/index.android.tsx +22 -22
- package/src/field-group/index.web.tsx +2 -2
- package/src/gauge/gauge.css +200 -0
- package/src/gauge/index.android.tsx +212 -0
- package/src/gauge/index.ios.tsx +40 -0
- package/src/gauge/index.tsx +165 -0
- package/src/gauge/shared.ts +79 -0
- package/src/gauge/types.ts +64 -0
- package/src/index.ts +24 -3
- package/src/menu/index.android.tsx +66 -0
- package/src/menu/index.ios.tsx +72 -0
- package/src/menu/index.tsx +30 -0
- package/src/menu/list.tsx +98 -0
- package/src/menu/menu.css +83 -0
- package/src/menu/types.ts +60 -0
- package/src/picker/index.android.tsx +3 -2
- package/src/progress/index.android.tsx +23 -9
- package/src/progress/index.ios.tsx +7 -6
- package/src/progress/index.tsx +43 -6
- package/src/progress/progress.css +33 -0
- package/src/progress/types.ts +23 -6
- package/src/screen/header.tsx +1 -0
- package/src/segmented/index.android.tsx +67 -0
- package/src/segmented/index.ios.tsx +47 -0
- package/src/segmented/index.tsx +58 -0
- package/src/segmented/segmented.css +55 -0
- package/src/segmented/types.ts +31 -0
- package/src/slider/index.android.tsx +87 -0
- package/src/slider/index.ios.tsx +64 -0
- package/src/slider/index.tsx +55 -0
- package/src/slider/slider.css +30 -0
- package/src/slider/types.ts +39 -0
- package/src/stepper/index.android.tsx +58 -0
- package/src/stepper/index.ios.tsx +55 -0
- package/src/stepper/index.tsx +47 -0
- package/src/stepper/shared.ts +17 -0
- package/src/stepper/stepper.css +61 -0
- package/src/stepper/types.ts +35 -0
- package/src/switch/index.tsx +2 -0
- package/src/text-field/shared.ts +2 -0
- package/src/tooltip/index.android.tsx +23 -0
- package/src/tooltip/index.ios.tsx +17 -0
- package/src/tooltip/index.tsx +41 -0
- package/src/tooltip/tooltip.css +40 -0
- package/src/tooltip/types.ts +25 -0
- package/src/link.ts +0 -36
- package/src/qr/index.tsx +0 -26
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* The trigger is an unstyled <button> so it can carry `interestfor`. */
|
|
2
|
+
.ui-tooltip {
|
|
3
|
+
-webkit-appearance: none;
|
|
4
|
+
appearance: none;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
border: none;
|
|
10
|
+
background: transparent;
|
|
11
|
+
color: inherit;
|
|
12
|
+
font: inherit;
|
|
13
|
+
cursor: default;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ui-tooltip:focus-visible {
|
|
17
|
+
outline: 2px solid var(--color-tint);
|
|
18
|
+
outline-offset: 2px;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Native hint popover, anchored above the trigger and flipping below. */
|
|
23
|
+
.ui-tooltip__hint {
|
|
24
|
+
inset: auto;
|
|
25
|
+
margin: 0;
|
|
26
|
+
margin-block: 6px;
|
|
27
|
+
padding: 6px 10px;
|
|
28
|
+
border: none;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
background: var(--color-label);
|
|
31
|
+
color: var(--color-background);
|
|
32
|
+
font-family: var(--font-display);
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
line-height: 16px;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
|
|
38
|
+
position-area: top;
|
|
39
|
+
position-try-fallbacks: flip-block;
|
|
40
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {ReactNode} from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cross-platform tooltip: a short hint attached to a piece of content.
|
|
5
|
+
*
|
|
6
|
+
* - Web: a native `popover="hint"` shown by the Interest Invoker API
|
|
7
|
+
* (`interestfor` — hover, keyboard focus or touch long-press), laid out with
|
|
8
|
+
* CSS anchor positioning; browsers without it fall back to the `title`
|
|
9
|
+
* attribute, the platform's built-in tooltip.
|
|
10
|
+
* - Android: the Jetpack Compose Material 3 `TooltipBox` / `PlainTooltip`
|
|
11
|
+
* shown on long-press.
|
|
12
|
+
* - iOS: iOS has no tooltip idiom; `children` render as-is and `text` is
|
|
13
|
+
* exposed to VoiceOver as an accessibility hint.
|
|
14
|
+
*
|
|
15
|
+
* `children` should be non-interactive content (an icon, a label): the web
|
|
16
|
+
* trigger is a `<button>`, and buttons can't nest.
|
|
17
|
+
*/
|
|
18
|
+
export interface TooltipProps {
|
|
19
|
+
/** Hint text. */
|
|
20
|
+
text: string;
|
|
21
|
+
/** Content the tooltip is attached to. Must be native (`@expo/ui`) content on Android. */
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
/** Identifier used to locate the trigger in end-to-end tests. */
|
|
24
|
+
testID?: string;
|
|
25
|
+
}
|
package/src/link.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {Platform, Share} from 'react-native';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Opens the native share sheet (iOS/Android) or the Web Share API.
|
|
5
|
-
* Falls back silently if the user cancels or sharing is unavailable.
|
|
6
|
-
*/
|
|
7
|
-
export async function shareUrl(url: string, message?: string) {
|
|
8
|
-
try {
|
|
9
|
-
if (Platform.OS === 'ios') {
|
|
10
|
-
await Share.share({url, message});
|
|
11
|
-
} else {
|
|
12
|
-
await Share.share({message: message ? `${message}\n${url}` : url});
|
|
13
|
-
}
|
|
14
|
-
} catch {
|
|
15
|
-
// Cancelled or unsupported — nothing to do.
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Copies text to the clipboard. Uses the Web Clipboard API on web; on native,
|
|
21
|
-
* where no clipboard module is linked, falls back to the share sheet.
|
|
22
|
-
* Resolves to `true` when copied to the clipboard.
|
|
23
|
-
*/
|
|
24
|
-
export async function copyText(text: string): Promise<boolean> {
|
|
25
|
-
const clipboard = globalThis.navigator?.clipboard;
|
|
26
|
-
if (Platform.OS === 'web' && clipboard) {
|
|
27
|
-
try {
|
|
28
|
-
await clipboard.writeText(text);
|
|
29
|
-
return true;
|
|
30
|
-
} catch {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
await shareUrl(text);
|
|
35
|
-
return false;
|
|
36
|
-
}
|
package/src/qr/index.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {useMemo} from 'react';
|
|
2
|
-
import {Image} from 'expo-image';
|
|
3
|
-
import qrcode from 'qrcode-generator';
|
|
4
|
-
|
|
5
|
-
export interface QRCodeProps {
|
|
6
|
-
/** Value encoded in the QR code. */
|
|
7
|
-
value: string;
|
|
8
|
-
/** Rendered width/height in points. */
|
|
9
|
-
size?: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function QRCode({value, size = 200}: QRCodeProps) {
|
|
13
|
-
const uri = useMemo(() => {
|
|
14
|
-
const qr = qrcode(0, 'M');
|
|
15
|
-
qr.addData(value);
|
|
16
|
-
qr.make();
|
|
17
|
-
return qr.createDataURL(8, 2);
|
|
18
|
-
}, [value]);
|
|
19
|
-
return (
|
|
20
|
-
<Image
|
|
21
|
-
source={{uri}}
|
|
22
|
-
style={{width: size, height: size, borderRadius: 12}}
|
|
23
|
-
contentFit="contain"
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
}
|