@worldcoin/mini-apps-ui-kit-react 1.0.1 → 1.1.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/Haptic/Haptic.d.ts +23 -0
- package/dist/components/Haptic/Haptic.js +33 -0
- package/dist/components/Haptic/index.d.ts +2 -0
- package/dist/components/Haptic/use-haptics.d.ts +6 -0
- package/dist/components/Haptic/use-haptics.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/lib/haptics.d.ts +2 -1
- package/dist/lib/haptics.js +2 -2
- package/package.json +7 -2
@@ -0,0 +1,23 @@
|
|
1
|
+
import { ImpactStyle, NotificationType } from '../../lib/haptics';
|
2
|
+
type HapticPropsBase = {
|
3
|
+
children: React.ReactNode;
|
4
|
+
asChild?: boolean;
|
5
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
6
|
+
type ImpactHapticProps = HapticPropsBase & {
|
7
|
+
variant: "impact";
|
8
|
+
type: ImpactStyle;
|
9
|
+
};
|
10
|
+
type NotificationHapticProps = HapticPropsBase & {
|
11
|
+
variant: "notification";
|
12
|
+
type: NotificationType;
|
13
|
+
};
|
14
|
+
type SelectionHapticProps = HapticPropsBase & {
|
15
|
+
variant: "selection";
|
16
|
+
type?: never;
|
17
|
+
};
|
18
|
+
type HapticProps = ImpactHapticProps | NotificationHapticProps | SelectionHapticProps;
|
19
|
+
declare function Haptic({ children, variant, type, asChild, onClick, ...props }: HapticProps): import("react/jsx-runtime").JSX.Element;
|
20
|
+
declare namespace Haptic {
|
21
|
+
var displayName: string;
|
22
|
+
}
|
23
|
+
export { Haptic };
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use client";
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
3
|
+
import { Slot } from "../../node_modules/.pnpm/@radix-ui_react-slot@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.js";
|
4
|
+
import haptics from "../../lib/haptics.js";
|
5
|
+
function Haptic({
|
6
|
+
children,
|
7
|
+
variant = "selection",
|
8
|
+
type,
|
9
|
+
asChild,
|
10
|
+
onClick,
|
11
|
+
...props
|
12
|
+
}) {
|
13
|
+
const Component = asChild ? Slot : "div";
|
14
|
+
const handleInteraction = (event) => {
|
15
|
+
onClick == null ? void 0 : onClick(event);
|
16
|
+
switch (variant) {
|
17
|
+
case "impact":
|
18
|
+
haptics.impact(type);
|
19
|
+
break;
|
20
|
+
case "notification":
|
21
|
+
haptics.notification(type);
|
22
|
+
break;
|
23
|
+
case "selection":
|
24
|
+
haptics.selection();
|
25
|
+
break;
|
26
|
+
}
|
27
|
+
};
|
28
|
+
return /* @__PURE__ */ jsx(Component, { onClick: handleInteraction, ...props, children });
|
29
|
+
}
|
30
|
+
Haptic.displayName = "Haptic";
|
31
|
+
export {
|
32
|
+
Haptic
|
33
|
+
};
|
package/dist/index.d.ts
CHANGED
@@ -34,4 +34,5 @@ export { CountryDrawer } from './components/CountryDrawer';
|
|
34
34
|
export { ToggleGroupRoot, ToggleGroupItem } from './components/ToggleGroup';
|
35
35
|
export { Tabs, TabItem } from './components/Tabs';
|
36
36
|
export { LiveFeedback } from './components/LiveFeedback';
|
37
|
+
export { Haptic, useHaptics } from './components/Haptic';
|
37
38
|
export { default as uiKitTailwindPlugin } from './tailwind';
|
package/dist/index.js
CHANGED
@@ -37,6 +37,8 @@ import { CountryDrawer } from "./components/CountryDrawer/CountryDrawer.js";
|
|
37
37
|
import { ToggleGroupItem, ToggleGroupRoot } from "./components/ToggleGroup/ToggleGroup.js";
|
38
38
|
import { TabItem, Tabs } from "./components/Tabs/Tabs.js";
|
39
39
|
import { LiveFeedback } from "./components/LiveFeedback/LiveFeedback.js";
|
40
|
+
import { Haptic } from "./components/Haptic/Haptic.js";
|
41
|
+
import { useHaptics } from "./components/Haptic/use-haptics.js";
|
40
42
|
export {
|
41
43
|
AlertDialog,
|
42
44
|
AlertDialogClose,
|
@@ -66,6 +68,7 @@ export {
|
|
66
68
|
DrawerTrigger,
|
67
69
|
Flag,
|
68
70
|
Form,
|
71
|
+
Haptic,
|
69
72
|
Input,
|
70
73
|
ListItem,
|
71
74
|
LiveFeedback,
|
@@ -93,5 +96,6 @@ export {
|
|
93
96
|
Typography,
|
94
97
|
WalletAddressField,
|
95
98
|
default2 as uiKitTailwindPlugin,
|
99
|
+
useHaptics,
|
96
100
|
useToast
|
97
101
|
};
|
package/dist/lib/haptics.d.ts
CHANGED
@@ -16,7 +16,7 @@ declare global {
|
|
16
16
|
declare const haptics: {
|
17
17
|
notification: (type: NotificationType) => void;
|
18
18
|
selection: () => void;
|
19
|
-
impact: (
|
19
|
+
impact: (type: ImpactStyle) => void;
|
20
20
|
};
|
21
21
|
/**
|
22
22
|
* Wraps a function with haptic feedback
|
@@ -26,3 +26,4 @@ declare const haptics: {
|
|
26
26
|
*/
|
27
27
|
export declare function withHaptics<T extends (...args: any[]) => any>(fn: T | undefined, hapticFn?: () => void): T;
|
28
28
|
export default haptics;
|
29
|
+
export type { NotificationType, ImpactStyle, HapticFeedbackParams };
|
package/dist/lib/haptics.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@worldcoin/mini-apps-ui-kit-react",
|
3
|
-
"version": "1.0
|
3
|
+
"version": "1.1.0",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"module": "dist/index.js",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"peerDependencies": {
|
16
16
|
"react": "^18 || ^19",
|
17
17
|
"react-dom": "^18 || ^19",
|
18
|
-
"tailwindcss": "^3"
|
18
|
+
"tailwindcss": "^3 || ^4"
|
19
19
|
},
|
20
20
|
"peerDependenciesMeta": {
|
21
21
|
"tailwindcss": {
|
@@ -27,6 +27,7 @@
|
|
27
27
|
"@eslint/js": "^9.13.0",
|
28
28
|
"@storybook/addon-essentials": "^8.4.7",
|
29
29
|
"@storybook/addon-interactions": "^8.4.7",
|
30
|
+
"@storybook/addon-mdx-gfm": "^8.6.12",
|
30
31
|
"@storybook/addon-onboarding": "^8.4.7",
|
31
32
|
"@storybook/blocks": "^8.4.7",
|
32
33
|
"@storybook/manager-api": "^8.5.5",
|
@@ -236,6 +237,10 @@
|
|
236
237
|
"types": "./dist/components/CircularState/index.d.ts",
|
237
238
|
"default": "./dist/components/CircularState/index.js"
|
238
239
|
},
|
240
|
+
"./Haptic": {
|
241
|
+
"types": "./dist/components/Haptic/index.d.ts",
|
242
|
+
"default": "./dist/components/Haptic/index.js"
|
243
|
+
},
|
239
244
|
"./tailwind": {
|
240
245
|
"types": "./dist/tailwind/index.d.ts",
|
241
246
|
"import": "./dist/tailwind/index.js",
|