@brand-map/primitives 0.0.0-broken.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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.oxfmtrc.json +35 -0
- package/.oxlintrc.json +166 -0
- package/README.md +78 -0
- package/bun.lock +904 -0
- package/mise.toml +3 -0
- package/package.json +61 -0
- package/src/accordion/accordion.tsx +189 -0
- package/src/accordion/accordion.web.tsx +282 -0
- package/src/accordion/index.ts +2 -0
- package/src/accordion/types.ts +44 -0
- package/src/alert-dialog/alert-dialog.tsx +238 -0
- package/src/alert-dialog/alert-dialog.web.tsx +260 -0
- package/src/alert-dialog/index.ts +2 -0
- package/src/alert-dialog/types.ts +81 -0
- package/src/aspect-ratio/aspect-ratio.tsx +27 -0
- package/src/aspect-ratio/index.ts +1 -0
- package/src/avatar/avatar.tsx +122 -0
- package/src/avatar/index.ts +2 -0
- package/src/avatar/types.ts +20 -0
- package/src/checkbox/checkbox.tsx +95 -0
- package/src/checkbox/checkbox.web.tsx +111 -0
- package/src/checkbox/index.ts +2 -0
- package/src/checkbox/types.ts +14 -0
- package/src/collapsible/collapsible.tsx +98 -0
- package/src/collapsible/collapsible.web.tsx +149 -0
- package/src/collapsible/index.ts +2 -0
- package/src/collapsible/types.ts +23 -0
- package/src/context-menu/context-menu.tsx +616 -0
- package/src/context-menu/context-menu.web.tsx +560 -0
- package/src/context-menu/index.ts +2 -0
- package/src/context-menu/types.ts +136 -0
- package/src/dialog/dialog.tsx +286 -0
- package/src/dialog/dialog.web.tsx +215 -0
- package/src/dialog/index.ts +2 -0
- package/src/dialog/types.ts +92 -0
- package/src/dropdown-menu/dropdown-menu.tsx +575 -0
- package/src/dropdown-menu/dropdown-menu.web.tsx +565 -0
- package/src/dropdown-menu/index.ts +2 -0
- package/src/dropdown-menu/types.ts +121 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use-Isomorphic-layout-effect.tsx +12 -0
- package/src/hooks/use-augmented-ref.tsx +25 -0
- package/src/hooks/use-controllable-state.tsx +70 -0
- package/src/hooks/use-relative-position.tsx +175 -0
- package/src/hover-card/hover-card.tsx +255 -0
- package/src/hover-card/hover-card.web.tsx +161 -0
- package/src/hover-card/index.ts +2 -0
- package/src/hover-card/types.ts +56 -0
- package/src/label/index.ts +2 -0
- package/src/label/label.tsx +36 -0
- package/src/label/label.web.tsx +38 -0
- package/src/label/types.ts +24 -0
- package/src/menubar/index.ts +2 -0
- package/src/menubar/menubar.tsx +602 -0
- package/src/menubar/menubar.web.tsx +575 -0
- package/src/menubar/types.ts +126 -0
- package/src/navigation-menu/index.ts +2 -0
- package/src/navigation-menu/navigation-menu.tsx +302 -0
- package/src/navigation-menu/navigation-menu.web.tsx +259 -0
- package/src/navigation-menu/types.ts +85 -0
- package/src/popover/index.ts +2 -0
- package/src/popover/popover.tsx +279 -0
- package/src/popover/popover.web.tsx +217 -0
- package/src/popover/types.ts +44 -0
- package/src/portal/index.ts +1 -0
- package/src/portal/portal.tsx +56 -0
- package/src/progress/index.ts +2 -0
- package/src/progress/progress.tsx +59 -0
- package/src/progress/progress.web.tsx +46 -0
- package/src/progress/types.ts +14 -0
- package/src/radio-group/index.ts +2 -0
- package/src/radio-group/radio-group.tsx +106 -0
- package/src/radio-group/radio-group.web.tsx +85 -0
- package/src/radio-group/types.ts +24 -0
- package/src/select/index.ts +2 -0
- package/src/select/select.tsx +447 -0
- package/src/select/select.web.tsx +368 -0
- package/src/select/types.ts +145 -0
- package/src/separator/index.ts +2 -0
- package/src/separator/separator.tsx +21 -0
- package/src/separator/types.ts +10 -0
- package/src/slider/index.ts +2 -0
- package/src/slider/slider.tsx +77 -0
- package/src/slider/slider.web.tsx +75 -0
- package/src/slider/types.ts +39 -0
- package/src/slot/index.ts +1 -0
- package/src/slot/slot.tsx +224 -0
- package/src/switch/index.ts +2 -0
- package/src/switch/switch.tsx +49 -0
- package/src/switch/switch.web.tsx +60 -0
- package/src/switch/types.ts +19 -0
- package/src/table/index.ts +1 -0
- package/src/table/table.tsx +121 -0
- package/src/tabs/index.ts +2 -0
- package/src/tabs/tabs.tsx +120 -0
- package/src/tabs/tabs.web.tsx +106 -0
- package/src/tabs/types.ts +37 -0
- package/src/toast/index.ts +2 -0
- package/src/toast/toast.tsx +124 -0
- package/src/toast/types.ts +20 -0
- package/src/toggle/index.ts +2 -0
- package/src/toggle/toggle.tsx +35 -0
- package/src/toggle/toggle.web.tsx +36 -0
- package/src/toggle/types.ts +11 -0
- package/src/toggle-group/index.ts +2 -0
- package/src/toggle-group/toggle-group.tsx +100 -0
- package/src/toggle-group/toggle-group.web.tsx +103 -0
- package/src/toggle-group/types.ts +46 -0
- package/src/toolbar/index.ts +2 -0
- package/src/toolbar/toolbar.tsx +141 -0
- package/src/toolbar/toolbar.web.tsx +158 -0
- package/src/toolbar/types.ts +64 -0
- package/src/tooltip/index.ts +2 -0
- package/src/tooltip/tooltip.tsx +261 -0
- package/src/tooltip/tooltip.web.tsx +175 -0
- package/src/tooltip/types.ts +61 -0
- package/src/types/index.ts +141 -0
- package/src/utils/index.ts +69 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { KeepMountable, PositionedContentProps, PressableRef, RenderPressableProps, RenderViewProps, ViewRef } from "../types";
|
|
2
|
+
|
|
3
|
+
interface SharedRootContext {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (value: boolean) => void;
|
|
6
|
+
openDelay?: number;
|
|
7
|
+
closeDelay?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type RootProps = RenderViewProps & {
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @platform: WEB ONLY
|
|
15
|
+
* @default 700
|
|
16
|
+
*/
|
|
17
|
+
openDelay?: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @platform: WEB ONLY
|
|
21
|
+
* @default 300
|
|
22
|
+
*/
|
|
23
|
+
closeDelay?: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
interface PortalProps extends KeepMountable {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @platform: NATIVE ONLY
|
|
31
|
+
*/
|
|
32
|
+
hostName?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @platform: WEB ONLY
|
|
36
|
+
*/
|
|
37
|
+
container?: HTMLElement | null | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type BackdropProps = KeepMountable &
|
|
41
|
+
RenderPressableProps & {
|
|
42
|
+
closeOnPress?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type TriggerProps = RenderPressableProps;
|
|
46
|
+
type ContentProps = RenderViewProps & PositionedContentProps;
|
|
47
|
+
|
|
48
|
+
type BackdropRef = PressableRef;
|
|
49
|
+
type RootRef = ViewRef;
|
|
50
|
+
type TriggerRef = PressableRef & {
|
|
51
|
+
open: () => void;
|
|
52
|
+
close: () => void;
|
|
53
|
+
};
|
|
54
|
+
type ContentRef = ViewRef;
|
|
55
|
+
|
|
56
|
+
export type { ContentProps, ContentRef, BackdropProps, BackdropRef, PortalProps, SharedRootContext, RootProps, RootRef, TriggerProps, TriggerRef };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Pressable, Text as ReactNativeText } from "react-native";
|
|
3
|
+
|
|
4
|
+
import * as Slot from "../slot";
|
|
5
|
+
|
|
6
|
+
import type { RootProps, TextProps } from "./types";
|
|
7
|
+
|
|
8
|
+
const Root = ({ render, ...props }: RootProps) => {
|
|
9
|
+
if (render) {
|
|
10
|
+
return (
|
|
11
|
+
<Slot.Pressable
|
|
12
|
+
render={render}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return <Pressable {...props} />;
|
|
19
|
+
};
|
|
20
|
+
Root.displayName = "RootNativeLabel";
|
|
21
|
+
|
|
22
|
+
const Text = ({ render, ...props }: TextProps) => {
|
|
23
|
+
if (render) {
|
|
24
|
+
return (
|
|
25
|
+
<Slot.Text
|
|
26
|
+
render={render}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return <ReactNativeText {...props} />;
|
|
33
|
+
};
|
|
34
|
+
Text.displayName = "TextNativeLabel";
|
|
35
|
+
|
|
36
|
+
export { Root, Text };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// import * as Label from "@radix-ui/react-label";
|
|
2
|
+
// import * as React from "react";
|
|
3
|
+
// import { Pressable, Text as RNText } from "react-native";
|
|
4
|
+
|
|
5
|
+
// import * as Slot from "../slot";
|
|
6
|
+
|
|
7
|
+
// import type { RootProps, RootRef, TextProps, TextRef } from "./types";
|
|
8
|
+
|
|
9
|
+
// const Root = React.forwardRef<RootRef, RootProps>(({ tabIndex = -1, ...props }, ref) => {
|
|
10
|
+
//
|
|
11
|
+
// return (
|
|
12
|
+
// <Component
|
|
13
|
+
// ref={ref}
|
|
14
|
+
// tabIndex={tabIndex}
|
|
15
|
+
// {...props}
|
|
16
|
+
// />
|
|
17
|
+
// );
|
|
18
|
+
// });
|
|
19
|
+
// Root.displayName = "RootWebLabel";
|
|
20
|
+
|
|
21
|
+
// const Text = React.forwardRef<TextRef, TextProps>(({ nativeID, htmlFor, ...props }, ref) => {
|
|
22
|
+
// const Component = render ? Slot.Text : RNText;
|
|
23
|
+
// return (
|
|
24
|
+
// <Label.Root
|
|
25
|
+
// render={!htmlFor}
|
|
26
|
+
// id={nativeID}
|
|
27
|
+
// htmlFor={htmlFor}
|
|
28
|
+
// >
|
|
29
|
+
// <Component
|
|
30
|
+
// ref={ref}
|
|
31
|
+
// {...props}
|
|
32
|
+
// />
|
|
33
|
+
// </Label.Root>
|
|
34
|
+
// );
|
|
35
|
+
// });
|
|
36
|
+
// Text.displayName = "TextWebLabel";
|
|
37
|
+
|
|
38
|
+
// export { Root, Text };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ViewStyle } from "react-native";
|
|
2
|
+
|
|
3
|
+
import type { PressableRef, RenderPressableProps, RenderTextProps, TextRef } from "../types";
|
|
4
|
+
|
|
5
|
+
type RootProps = Omit<RenderPressableProps, "children" | "hitSlop" | "style"> & {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: ViewStyle;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type TextProps = RenderTextProps & {
|
|
11
|
+
/**
|
|
12
|
+
* Equivalent to `id` so that the same value can be passed as `aria-labelledby` to the input element.
|
|
13
|
+
*/
|
|
14
|
+
nativeID?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WEB ONLY
|
|
18
|
+
*/
|
|
19
|
+
htmlFor?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type RootRef = PressableRef;
|
|
23
|
+
|
|
24
|
+
export type { RootProps, RootRef, TextProps, TextRef };
|