@brand-map/primitives 0.0.0-broken.0 → 0.0.0-broken.2

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.
Files changed (69) hide show
  1. package/package.json +2 -9
  2. package/src/accordion/accordion.tsx +17 -17
  3. package/src/accordion/accordion.web.tsx +13 -13
  4. package/src/alert-dialog/alert-dialog.tsx +28 -28
  5. package/src/alert-dialog/alert-dialog.web.tsx +18 -18
  6. package/src/alert-dialog/types.ts +3 -3
  7. package/src/aspect-ratio/aspect-ratio.tsx +3 -3
  8. package/src/avatar/avatar.tsx +10 -10
  9. package/src/avatar/types.ts +2 -2
  10. package/src/checkbox/checkbox.tsx +9 -9
  11. package/src/checkbox/checkbox.web.tsx +8 -8
  12. package/src/collapsible/collapsible.tsx +33 -35
  13. package/src/collapsible/collapsible.web.tsx +9 -9
  14. package/src/context-menu/context-menu.tsx +45 -45
  15. package/src/context-menu/context-menu.web.tsx +44 -44
  16. package/src/dialog/dialog.tsx +11 -11
  17. package/src/dialog/dialog.web.tsx +15 -15
  18. package/src/dialog/types.ts +5 -5
  19. package/src/dropdown-menu/dropdown-menu.tsx +43 -43
  20. package/src/dropdown-menu/dropdown-menu.web.tsx +45 -45
  21. package/src/hooks/use-Isomorphic-layout-effect.tsx +1 -2
  22. package/src/hooks/use-relative-position.tsx +2 -2
  23. package/src/hover-card/hover-card.tsx +40 -42
  24. package/src/hover-card/hover-card.web.tsx +9 -9
  25. package/src/label/label.tsx +3 -4
  26. package/src/label/label.web.tsx +5 -5
  27. package/src/menubar/menubar.tsx +45 -45
  28. package/src/menubar/menubar.web.tsx +47 -47
  29. package/src/navigation-menu/navigation-menu.tsx +23 -23
  30. package/src/navigation-menu/navigation-menu.web.tsx +26 -26
  31. package/src/popover/popover.tsx +20 -20
  32. package/src/popover/popover.web.tsx +14 -14
  33. package/src/progress/progress.tsx +4 -4
  34. package/src/progress/progress.web.tsx +5 -5
  35. package/src/radio-group/radio-group.tsx +11 -11
  36. package/src/radio-group/radio-group.web.tsx +9 -9
  37. package/src/render/index.ts +1 -0
  38. package/src/{slot/slot.tsx → render/render.tsx} +26 -27
  39. package/src/select/select.tsx +28 -28
  40. package/src/select/select.web.tsx +22 -22
  41. package/src/separator/separator.tsx +3 -3
  42. package/src/slider/slider.tsx +8 -8
  43. package/src/slider/slider.web.tsx +6 -6
  44. package/src/switch/switch.context.ts +16 -0
  45. package/src/switch/switch.tsx +68 -38
  46. package/src/switch/switch.web.tsx +9 -9
  47. package/src/switch/types.ts +27 -6
  48. package/src/table/table.tsx +9 -9
  49. package/src/tabs/tabs.tsx +13 -13
  50. package/src/tabs/tabs.web.tsx +10 -10
  51. package/src/toast/toast.tsx +14 -14
  52. package/src/toggle/toggle.tsx +5 -5
  53. package/src/toggle/toggle.web.tsx +5 -5
  54. package/src/toggle-group/toggle-group.tsx +11 -11
  55. package/src/toggle-group/toggle-group.web.tsx +10 -10
  56. package/src/toolbar/toolbar.tsx +12 -12
  57. package/src/toolbar/toolbar.web.tsx +12 -12
  58. package/src/tooltip/tooltip.tsx +17 -17
  59. package/src/tooltip/tooltip.web.tsx +11 -11
  60. package/src/types/index.ts +5 -15
  61. package/tsconfig.json +1 -0
  62. package/.changeset/README.md +0 -8
  63. package/.changeset/config.json +0 -11
  64. package/.oxfmtrc.json +0 -35
  65. package/.oxlintrc.json +0 -166
  66. package/README.md +0 -78
  67. package/bun.lock +0 -904
  68. package/mise.toml +0 -3
  69. package/src/slot/index.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brand-map/primitives",
3
- "version": "0.0.0-broken.0",
3
+ "version": "0.0.0-broken.2",
4
4
  "exports": {
5
5
  "./accordion": "./src/accordion/index.ts",
6
6
  "./alert-dialog": "./src/alert-dialog/index.ts",
@@ -23,7 +23,7 @@
23
23
  "./select": "./src/select/index.ts",
24
24
  "./separator": "./src/separator/index.ts",
25
25
  "./slider": "./src/slider/index.ts",
26
- "./slot": "./src/slot/index.ts",
26
+ "./render": "./src/render/index.ts",
27
27
  "./switch": "./src/switch/index.ts",
28
28
  "./table": "./src/table/index.ts",
29
29
  "./tabs": "./src/tabs/index.ts",
@@ -38,21 +38,14 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "scripts": {
42
- "version-bump": "npx changeset && npx changeset version"
43
- },
44
41
  "dependencies": {
45
42
  "react": "^19.2.4",
46
43
  "react-native": "^0.83.1",
47
44
  "zustand": "^5.0.10"
48
45
  },
49
46
  "devDependencies": {
50
- "@changesets/cli": "^2.29.8",
51
47
  "@tsconfig/react-native": "^3.0.9",
52
- "@types/jest": "^30.0.0",
53
48
  "@types/react": "^19.2.10",
54
- "oxfmt": "^0.27.0",
55
- "oxlint": "^1.42.0",
56
49
  "typescript": "^5.9.3"
57
50
  },
58
51
  "engines": {
@@ -1,12 +1,12 @@
1
- import * as React from "react";
1
+ import { createContext, forwardRef, useContext, useId } from "react";
2
2
  import { type GestureResponderEvent } from "react-native";
3
3
 
4
4
  import { useControllableState } from "../hooks";
5
- import * as Slot from "../slot";
5
+ import * as Render from "../render";
6
6
 
7
7
  import type { ContentProps, ContentRef, HeaderProps, HeaderRef, ItemProps, ItemRef, RootContext, RootProps, RootRef, TriggerProps, TriggerRef } from "./types";
8
8
 
9
- const AccordionContext = React.createContext<RootContext | null>(null);
9
+ const AccordionContext = createContext<RootContext | null>(null);
10
10
 
11
11
  /**
12
12
  * @xample
@@ -20,7 +20,7 @@ const AccordionContext = React.createContext<RootContext | null>(null);
20
20
  * ...
21
21
  * </Root>
22
22
  */
23
- const Root = React.forwardRef<RootRef, RootProps>(
23
+ const Root = forwardRef<RootRef, RootProps>(
24
24
  ({ render, multiple = false, disabled = false, collapsible = true, value: valueProp, onValueChange: onValueChangeProps, defaultValue, ...props }, ref) => {
25
25
  const [value = [], onValueChange] = useControllableState({
26
26
  prop: valueProp,
@@ -41,7 +41,7 @@ const Root = React.forwardRef<RootRef, RootProps>(
41
41
  {typeof render === "function" ? (
42
42
  <>{render(props, { disabled: disabled, multiple, value })}</>
43
43
  ) : (
44
- <Slot.View
44
+ <Render.View
45
45
  ref={ref}
46
46
  render={render}
47
47
  {...props}
@@ -54,18 +54,18 @@ const Root = React.forwardRef<RootRef, RootProps>(
54
54
  Root.displayName = "RootNativeAccordion";
55
55
 
56
56
  function useRootContext() {
57
- const context = React.useContext(AccordionContext);
57
+ const context = useContext(AccordionContext);
58
58
  if (!context) {
59
59
  throw new Error("Accordion compound components cannot be rendered outside the Accordion component");
60
60
  }
61
61
  return context;
62
62
  }
63
63
 
64
- const AccordionItemContext = React.createContext<(ItemProps & { nativeID: string; open: boolean }) | null>(null);
64
+ const AccordionItemContext = createContext<(ItemProps & { nativeID: string; open: boolean }) | null>(null);
65
65
 
66
- const Item = React.forwardRef<ItemRef, ItemProps>(({ render, value, disabled, ...props }, ref) => {
66
+ const Item = forwardRef<ItemRef, ItemProps>(({ render, value, disabled, ...props }, ref) => {
67
67
  const { value: rootValue } = useRootContext();
68
- const nativeID = React.useId();
68
+ const nativeID = useId();
69
69
  const open = isItemExpanded(rootValue, value);
70
70
 
71
71
  return (
@@ -73,7 +73,7 @@ const Item = React.forwardRef<ItemRef, ItemProps>(({ render, value, disabled, ..
73
73
  {typeof render === "function" ? (
74
74
  <>{render(props, { open })}</>
75
75
  ) : (
76
- <Slot.View
76
+ <Render.View
77
77
  ref={ref}
78
78
  {...props}
79
79
  />
@@ -84,19 +84,19 @@ const Item = React.forwardRef<ItemRef, ItemProps>(({ render, value, disabled, ..
84
84
  Item.displayName = "ItemNativeAccordion";
85
85
 
86
86
  function useItemContext() {
87
- const context = React.useContext(AccordionItemContext);
87
+ const context = useContext(AccordionItemContext);
88
88
  if (!context) {
89
89
  throw new Error("AccordionItem compound components cannot be rendered outside the AccordionItem component");
90
90
  }
91
91
  return context;
92
92
  }
93
93
 
94
- const Header = React.forwardRef<HeaderRef, HeaderProps>(({ ...props }, ref) => {
94
+ const Header = forwardRef<HeaderRef, HeaderProps>(({ ...props }, ref) => {
95
95
  const { disabled: rootDisabled } = useRootContext();
96
96
  const { disabled: itemDisabled, open } = useItemContext();
97
97
 
98
98
  return (
99
- <Slot.View
99
+ <Render.View
100
100
  ref={ref}
101
101
  role="heading"
102
102
  aria-expanded={open}
@@ -107,7 +107,7 @@ const Header = React.forwardRef<HeaderRef, HeaderProps>(({ ...props }, ref) => {
107
107
  });
108
108
  Header.displayName = "HeaderNativeAccordion";
109
109
 
110
- const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ render, onPress: onPressProp, disabled: disabledProp, ...props }, ref) => {
110
+ const Trigger = forwardRef<TriggerRef, TriggerProps>(({ render, onPress: onPressProp, disabled: disabledProp, ...props }, ref) => {
111
111
  const { disabled: rootDisabled, multiple, onValueChange, value: rootValue, collapsible } = useRootContext();
112
112
  const { nativeID, disabled: itemDisabled, value, open } = useItemContext();
113
113
 
@@ -139,7 +139,7 @@ const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ render, onPress: o
139
139
  }
140
140
 
141
141
  return (
142
- <Slot.Pressable
142
+ <Render.Pressable
143
143
  ref={ref}
144
144
  nativeID={nativeID}
145
145
  aria-disabled={isDisabled}
@@ -156,7 +156,7 @@ const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ render, onPress: o
156
156
  });
157
157
  Trigger.displayName = "TriggerNativeAccordion";
158
158
 
159
- const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
159
+ const Content = forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
160
160
  const { multiple } = useRootContext();
161
161
  const { nativeID, open } = useItemContext();
162
162
 
@@ -167,7 +167,7 @@ const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...pr
167
167
  }
168
168
 
169
169
  return (
170
- <Slot.View
170
+ <Render.View
171
171
  ref={ref}
172
172
  aria-hidden={!(keepMounted || open)}
173
173
  aria-labelledby={nativeID}
@@ -1,14 +1,14 @@
1
1
  // import { useAugmentedRef, useControllableState, useIsomorphicLayoutEffect } from "../hooks";
2
- // import * as Slot from "../slot";
2
+ // import * as Render from "../render";
3
3
  // import * as Accordion from "@radix-ui/react-accordion";
4
- // import * as React from "react";
4
+ //
5
5
  // import { Pressable, View } from "react-native";
6
6
 
7
7
  // import type { ContentProps, ContentRef, HeaderProps, HeaderRef, ItemProps, ItemRef, RootProps, RootRef, TriggerProps, TriggerRef } from "./types";
8
8
 
9
- // const AccordionContext = React.createContext<RootProps | null>(null);
9
+ // const AccordionContext = createContext<RootProps | null>(null);
10
10
 
11
- // const Root = React.forwardRef<RootRef, RootProps>(
11
+ // const Root = forwardRef<RootRef, RootProps>(
12
12
  // (
13
13
  // { render, value: valueProp, onValueChange: onValueChangeProps, defaultValue, type, disabled, dir, orientation = "vertical", collapsible, ...props },
14
14
  // ref,
@@ -56,16 +56,16 @@
56
56
  // Root.displayName = "RootWebAccordion";
57
57
 
58
58
  // function useRootContext() {
59
- // const context = React.useContext(AccordionContext);
59
+ // const context = useContext(AccordionContext);
60
60
  // if (!context) {
61
61
  // throw new Error("Accordion compound components cannot be rendered outside the Accordion component");
62
62
  // }
63
63
  // return context;
64
64
  // }
65
65
 
66
- // const AccordionItemContext = React.createContext<(ItemProps & { isExpanded: boolean }) | null>(null);
66
+ // const AccordionItemContext = createContext<(ItemProps & { isExpanded: boolean }) | null>(null);
67
67
 
68
- // const Item = React.forwardRef<ItemRef, ItemProps>(({ value: itemValue, disabled, ...props }, ref) => {
68
+ // const Item = forwardRef<ItemRef, ItemProps>(({ value: itemValue, disabled, ...props }, ref) => {
69
69
  // const augmentedRef = useAugmentedRef({ ref });
70
70
  // const { value, orientation, disabled: disabledRoot } = useRootContext();
71
71
 
@@ -115,14 +115,14 @@
115
115
  // Item.displayName = "ItemWebAccordion";
116
116
 
117
117
  // function useItemContext() {
118
- // const context = React.useContext(AccordionItemContext);
118
+ // const context = useContext(AccordionItemContext);
119
119
  // if (!context) {
120
120
  // throw new Error("AccordionItem compound components cannot be rendered outside the AccordionItem component");
121
121
  // }
122
122
  // return context;
123
123
  // }
124
124
 
125
- // const Header = React.forwardRef<HeaderRef, HeaderProps>(({ ...props }, ref) => {
125
+ // const Header = forwardRef<HeaderRef, HeaderProps>(({ ...props }, ref) => {
126
126
  // const augmentedRef = useAugmentedRef({ ref });
127
127
  // const { disabled, isExpanded } = useItemContext();
128
128
  // const { orientation, disabled: disabledRoot } = useRootContext();
@@ -167,7 +167,7 @@
167
167
  // opacity: 0,
168
168
  // };
169
169
 
170
- // const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ disabled: disabledProp, ...props }, ref) => {
170
+ // const Trigger = forwardRef<TriggerRef, TriggerProps>(({ disabled: disabledProp, ...props }, ref) => {
171
171
  // const { disabled: disabledRoot } = useRootContext();
172
172
  // const { disabled, isExpanded } = useItemContext();
173
173
  // const triggerRef = React.useRef<HTMLButtonElement>(null);
@@ -218,13 +218,13 @@
218
218
  // role="button"
219
219
  // disabled={isDisabled}
220
220
  // {...props}
221
- // onPress={(ev) => {
221
+ // onPress={(event) => {
222
222
  // if (triggerRef.current && !isDisabled) {
223
223
  // triggerRef.current.disabled = false;
224
224
  // triggerRef.current.click();
225
225
  // triggerRef.current.disabled = true;
226
226
  // }
227
- // props.onPress?.(ev);
227
+ // props.onPress?.(event);
228
228
  // }}
229
229
  // />
230
230
  // </Accordion.Trigger>
@@ -234,7 +234,7 @@
234
234
 
235
235
  // Trigger.displayName = "TriggerWebAccordion";
236
236
 
237
- // const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
237
+ // const Content = forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
238
238
  // const augmentedRef = useAugmentedRef({ ref });
239
239
 
240
240
  // const { orientation, disabled: disabledRoot } = useRootContext();
@@ -1,9 +1,9 @@
1
- import * as React from "react";
1
+ import { createContext, forwardRef, useId, useContext, useEffect } from "react";
2
2
  import { BackHandler, Pressable, Text, View, type GestureResponderEvent } from "react-native";
3
3
 
4
4
  import { useControllableState } from "../hooks";
5
5
  import { Portal as RNPPortal } from "../portal";
6
- import * as Slot from "../slot";
6
+ import * as Render from "../render";
7
7
 
8
8
  import type {
9
9
  ActionProps,
@@ -26,10 +26,10 @@ import type {
26
26
  TriggerRef,
27
27
  } from "./types";
28
28
 
29
- const AlertDialogContext = React.createContext<(RootContext & { nativeID: string }) | null>(null);
29
+ const AlertDialogContext = createContext<(RootContext & { nativeID: string }) | null>(null);
30
30
 
31
- const Root = React.forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
32
- const nativeID = React.useId();
31
+ const Root = forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
32
+ const nativeID = useId();
33
33
  const [open = false, onOpenChange] = useControllableState({
34
34
  prop: openProp,
35
35
  defaultProp: defaultOpen,
@@ -44,7 +44,7 @@ const Root = React.forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen
44
44
  nativeID,
45
45
  }}
46
46
  >
47
- <Slot.View
47
+ <Render.View
48
48
  ref={ref}
49
49
  {...viewProps}
50
50
  />
@@ -55,23 +55,23 @@ const Root = React.forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen
55
55
  Root.displayName = "RootNativeAlertDialog";
56
56
 
57
57
  function useRootContext() {
58
- const context = React.useContext(AlertDialogContext);
58
+ const context = useContext(AlertDialogContext);
59
59
  if (!context) {
60
60
  throw new Error("AlertDialog compound components cannot be rendered outside the AlertDialog component");
61
61
  }
62
62
  return context;
63
63
  }
64
64
 
65
- const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
65
+ const Trigger = forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
66
66
  const { open: value, onOpenChange } = useRootContext();
67
67
 
68
- function onPress(ev: GestureResponderEvent) {
68
+ function onPress(event: GestureResponderEvent) {
69
69
  onOpenChange(!value);
70
- onPressProp?.(ev);
70
+ onPressProp?.(event);
71
71
  }
72
72
 
73
73
  return (
74
- <Slot.Pressable
74
+ <Render.Pressable
75
75
  ref={ref}
76
76
  aria-disabled={disabled ?? undefined}
77
77
  role="button"
@@ -106,7 +106,7 @@ function Portal({ keepMounted, hostName, children }: PortalProps) {
106
106
  );
107
107
  }
108
108
 
109
- const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
109
+ const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
110
110
  const { open: value } = useRootContext();
111
111
 
112
112
  if (!keepMounted) {
@@ -116,7 +116,7 @@ const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ..
116
116
  }
117
117
 
118
118
  return (
119
- <Slot.View
119
+ <Render.View
120
120
  ref={ref}
121
121
  {...props}
122
122
  />
@@ -125,10 +125,10 @@ const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ..
125
125
 
126
126
  Backdrop.displayName = "BackdropNativeAlertDialog";
127
127
 
128
- const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
128
+ const Content = forwardRef<ContentRef, ContentProps>(({ keepMounted, ...props }, ref) => {
129
129
  const { open: value, nativeID, onOpenChange } = useRootContext();
130
130
 
131
- React.useEffect(() => {
131
+ useEffect(() => {
132
132
  const backHandler = BackHandler.addEventListener("hardwareBackPress", () => {
133
133
  onOpenChange(false);
134
134
  return true;
@@ -146,7 +146,7 @@ const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...pr
146
146
  }
147
147
 
148
148
  return (
149
- <Slot.View
149
+ <Render.View
150
150
  ref={ref}
151
151
  role="alertdialog"
152
152
  nativeID={nativeID}
@@ -160,17 +160,17 @@ const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, ...pr
160
160
 
161
161
  Content.displayName = "ContentNativeAlertDialog";
162
162
 
163
- const Cancel = React.forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
163
+ const Cancel = forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
164
164
  const { onOpenChange } = useRootContext();
165
165
 
166
- function onPress(ev: GestureResponderEvent) {
166
+ function onPress(event: GestureResponderEvent) {
167
167
  if (disabled) return;
168
168
  onOpenChange(false);
169
- onPressProp?.(ev);
169
+ onPressProp?.(event);
170
170
  }
171
171
 
172
172
  return (
173
- <Slot.Pressable
173
+ <Render.Pressable
174
174
  ref={ref}
175
175
  aria-disabled={disabled ?? undefined}
176
176
  role="button"
@@ -183,17 +183,17 @@ const Cancel = React.forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp,
183
183
 
184
184
  Cancel.displayName = "CloseNativeAlertDialog";
185
185
 
186
- const Action = React.forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
186
+ const Action = forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp, disabled = false, ...props }, ref) => {
187
187
  const { onOpenChange } = useRootContext();
188
188
 
189
- function onPress(ev: GestureResponderEvent) {
189
+ function onPress(event: GestureResponderEvent) {
190
190
  if (disabled) return;
191
191
  onOpenChange(false);
192
- onPressProp?.(ev);
192
+ onPressProp?.(event);
193
193
  }
194
194
 
195
195
  return (
196
- <Slot.Pressable
196
+ <Render.Pressable
197
197
  ref={ref}
198
198
  aria-disabled={disabled ?? undefined}
199
199
  role="button"
@@ -206,11 +206,11 @@ const Action = React.forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp,
206
206
 
207
207
  Action.displayName = "ActionNativeAlertDialog";
208
208
 
209
- const Title = React.forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
209
+ const Title = forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
210
210
  const { nativeID } = useRootContext();
211
211
 
212
212
  return (
213
- <Slot.Text
213
+ <Render.Text
214
214
  ref={ref}
215
215
  role="heading"
216
216
  nativeID={`${nativeID}_label`}
@@ -221,11 +221,11 @@ const Title = React.forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
221
221
 
222
222
  Title.displayName = "TitleNativeAlertDialog";
223
223
 
224
- const Description = React.forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
224
+ const Description = forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
225
225
  const { nativeID } = useRootContext();
226
226
 
227
227
  return (
228
- <Slot.Text
228
+ <Render.Text
229
229
  ref={ref}
230
230
  nativeID={`${nativeID}_desc`}
231
231
  {...props}
@@ -1,7 +1,7 @@
1
1
  // import { useAugmentedRef, useControllableState, useIsomorphicLayoutEffect } from "../hooks";
2
- // import * as Slot from "../slot";
2
+ // import * as Render from "../render";
3
3
  // import * as AlertDialog from "@radix-ui/react-alert-dialog";
4
- // import * as React from "react";
4
+ //
5
5
  // import { Pressable, Text, View, type GestureResponderEvent } from "react-native";
6
6
 
7
7
  // import type {
@@ -25,9 +25,9 @@
25
25
  // TriggerRef,
26
26
  // } from "./types";
27
27
 
28
- // const AlertDialogContext = React.createContext<RootContext | null>(null);
28
+ // const AlertDialogContext = createContext<RootContext | null>(null);
29
29
 
30
- // const Root = React.forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
30
+ // const Root = forwardRef<RootRef, RootProps>(({ open: openProp, defaultOpen, onOpenChange: onOpenChangeProp, ...viewProps }, ref) => {
31
31
  // const [open = false, onOpenChange] = useControllableState({
32
32
  // prop: openProp,
33
33
  // defaultProp: defaultOpen,
@@ -53,19 +53,19 @@
53
53
  // Root.displayName = "RootAlertWebDialog";
54
54
 
55
55
  // function useRootContext() {
56
- // const context = React.useContext(AlertDialogContext);
56
+ // const context = useContext(AlertDialogContext);
57
57
  // if (!context) {
58
58
  // throw new Error("AlertDialog compound components cannot be rendered outside the AlertDialog component");
59
59
  // }
60
60
  // return context;
61
61
  // }
62
62
 
63
- // const Trigger = React.forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, role: _role, disabled, ...props }, ref) => {
63
+ // const Trigger = forwardRef<TriggerRef, TriggerProps>(({ onPress: onPressProp, role: _role, disabled, ...props }, ref) => {
64
64
  // const augmentedRef = useAugmentedRef({ ref });
65
65
  // const { onOpenChange, open } = useRootContext();
66
- // function onPress(ev: GestureResponderEvent) {
66
+ // function onPress(event: GestureResponderEvent) {
67
67
  // if (onPressProp) {
68
- // onPressProp(ev);
68
+ // onPressProp(event);
69
69
  // }
70
70
  // onOpenChange(!open);
71
71
  // }
@@ -107,7 +107,7 @@
107
107
  // );
108
108
  // }
109
109
 
110
- // const Backdrop = React.forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
110
+ // const Backdrop = forwardRef<BackdropRef, BackdropProps>(({ keepMounted, ...props }, ref) => {
111
111
  //
112
112
  // return (
113
113
  // <AlertDialog.Backdrop keepMounted={keepMounted}>
@@ -121,7 +121,7 @@
121
121
 
122
122
  // Backdrop.displayName = "BackdropAlertWebDialog";
123
123
 
124
- // const Content = React.forwardRef<ContentRef, ContentProps>(({ keepMounted, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }, ref) => {
124
+ // const Content = forwardRef<ContentRef, ContentProps>(({ keepMounted, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, ...props }, ref) => {
125
125
  // const augmentedRef = useAugmentedRef({ ref });
126
126
  // const { open } = useRootContext();
127
127
 
@@ -151,13 +151,13 @@
151
151
 
152
152
  // Content.displayName = "ContentAlertWebDialog";
153
153
 
154
- // const Cancel = React.forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
154
+ // const Cancel = forwardRef<CancelRef, CancelProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
155
155
  // const augmentedRef = useAugmentedRef({ ref });
156
156
  // const { onOpenChange, open } = useRootContext();
157
157
 
158
- // function onPress(ev: GestureResponderEvent) {
158
+ // function onPress(event: GestureResponderEvent) {
159
159
  // if (onPressProp) {
160
- // onPressProp(ev);
160
+ // onPressProp(event);
161
161
  // }
162
162
  // onOpenChange(!open);
163
163
  // }
@@ -190,13 +190,13 @@
190
190
 
191
191
  // Cancel.displayName = "CancelAlertWebDialog";
192
192
 
193
- // const Action = React.forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
193
+ // const Action = forwardRef<ActionRef, ActionProps>(({ onPress: onPressProp, disabled, ...props }, ref) => {
194
194
  // const augmentedRef = useAugmentedRef({ ref });
195
195
  // const { onOpenChange, open } = useRootContext();
196
196
 
197
- // function onPress(ev: GestureResponderEvent) {
197
+ // function onPress(event: GestureResponderEvent) {
198
198
  // if (onPressProp) {
199
- // onPressProp(ev);
199
+ // onPressProp(event);
200
200
  // }
201
201
  // onOpenChange(!open);
202
202
  // }
@@ -229,7 +229,7 @@
229
229
 
230
230
  // Action.displayName = "ActionAlertWebDialog";
231
231
 
232
- // const Title = React.forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
232
+ // const Title = forwardRef<TitleRef, TitleProps>(({ ...props }, ref) => {
233
233
  //
234
234
  // return (
235
235
  // <AlertDialog.Title render>
@@ -243,7 +243,7 @@
243
243
 
244
244
  // Title.displayName = "TitleAlertWebDialog";
245
245
 
246
- // const Description = React.forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
246
+ // const Description = forwardRef<DescriptionRef, DescriptionProps>(({ ...props }, ref) => {
247
247
  //
248
248
  // return (
249
249
  // <AlertDialog.Description render>
@@ -31,17 +31,17 @@ type ContentProps = KeepMountable &
31
31
  /**
32
32
  * @platform: WEB ONLY
33
33
  */
34
- onOpenAutoFocus?: (ev: Event) => void;
34
+ onOpenAutoFocus?: (event: Event) => void;
35
35
 
36
36
  /**
37
37
  * @platform: WEB ONLY
38
38
  */
39
- onCloseAutoFocus?: (ev: Event) => void;
39
+ onCloseAutoFocus?: (event: Event) => void;
40
40
 
41
41
  /**
42
42
  * @platform: WEB ONLY
43
43
  */
44
- onEscapeKeyDown?: (ev: Event) => void;
44
+ onEscapeKeyDown?: (event: Event) => void;
45
45
  };
46
46
 
47
47
  type TriggerProps = RenderPressableProps;
@@ -1,7 +1,7 @@
1
- import * as React from "react";
1
+ import { forwardRef, Component } from "react";
2
2
  import { View, type ViewStyle } from "react-native";
3
3
 
4
- import * as Slot from "../slot";
4
+ import * as Render from "../render";
5
5
  import type { RenderViewProps, ViewRef } from "../types";
6
6
 
7
7
  type RootProps = Omit<RenderViewProps, "style"> & {
@@ -11,7 +11,7 @@ type RootProps = Omit<RenderViewProps, "style"> & {
11
11
 
12
12
  type RootRef = ViewRef;
13
13
 
14
- const Root = React.forwardRef<RootRef, RootProps>(({ ratio = 1, style, ...props }, ref) => {
14
+ const Root = forwardRef<RootRef, RootProps>(({ ratio = 1, style, ...props }, ref) => {
15
15
  return (
16
16
  <Component
17
17
  ref={ref}
@@ -1,8 +1,8 @@
1
- import * as React from "react";
1
+ import { createContext, forwardRef, useState, useContext, useCallback } from "react";
2
2
  import { type ImageErrorEventData, type ImageLoadEventData, type ImageSourcePropType, type NativeSyntheticEvent, Image as RNImage, View } from "react-native";
3
3
 
4
4
  import { useIsomorphicLayoutEffect } from "../hooks";
5
- import * as Slot from "../slot";
5
+ import * as Render from "../render";
6
6
 
7
7
  import type { FallbackProps, FallbackRef, ImageProps, ImageRef, RootProps, RootRef } from "./types";
8
8
 
@@ -13,10 +13,10 @@ interface RootContextInterface extends RootProps {
13
13
  setStatus: (status: AvatarState) => void;
14
14
  }
15
15
 
16
- const RootContext = React.createContext<RootContextInterface | null>(null);
16
+ const RootContext = createContext<RootContextInterface | null>(null);
17
17
 
18
- const Root = React.forwardRef<RootRef, RootProps>(({ alt, ...viewProps }, ref) => {
19
- const [status, setStatus] = React.useState<AvatarState>("error");
18
+ const Root = forwardRef<RootRef, RootProps>(({ alt, ...viewProps }, ref) => {
19
+ const [status, setStatus] = useState<AvatarState>("error");
20
20
 
21
21
  return (
22
22
  <RootContext.Provider value={{ alt, status, setStatus }}>
@@ -31,14 +31,14 @@ const Root = React.forwardRef<RootRef, RootProps>(({ alt, ...viewProps }, ref) =
31
31
  Root.displayName = "RootAvatar";
32
32
 
33
33
  function useRootContext() {
34
- const context = React.useContext(RootContext);
34
+ const context = useContext(RootContext);
35
35
  if (!context) {
36
36
  throw new Error("Avatar compound components cannot be rendered outside the Avatar component");
37
37
  }
38
38
  return context;
39
39
  }
40
40
 
41
- const Image = React.forwardRef<ImageRef, ImageProps>(({ onLoad: onLoadProps, onError: onErrorProps, onLoadingStatusChange, ...props }, ref) => {
41
+ const Image = forwardRef<ImageRef, ImageProps>(({ onLoad: onLoadProps, onError: onErrorProps, onLoadingStatusChange, ...props }, ref) => {
42
42
  const { alt, setStatus, status } = useRootContext();
43
43
 
44
44
  useIsomorphicLayoutEffect(() => {
@@ -51,7 +51,7 @@ const Image = React.forwardRef<ImageRef, ImageProps>(({ onLoad: onLoadProps, onE
51
51
  };
52
52
  }, [props?.source]);
53
53
 
54
- const onLoad = React.useCallback(
54
+ const onLoad = useCallback(
55
55
  (e: NativeSyntheticEvent<ImageLoadEventData>) => {
56
56
  setStatus("loaded");
57
57
  onLoadingStatusChange?.("loaded");
@@ -60,7 +60,7 @@ const Image = React.forwardRef<ImageRef, ImageProps>(({ onLoad: onLoadProps, onE
60
60
  [onLoadProps],
61
61
  );
62
62
 
63
- const onError = React.useCallback(
63
+ const onError = useCallback(
64
64
  (e: NativeSyntheticEvent<ImageErrorEventData>) => {
65
65
  setStatus("error");
66
66
  onLoadingStatusChange?.("error");
@@ -86,7 +86,7 @@ const Image = React.forwardRef<ImageRef, ImageProps>(({ onLoad: onLoadProps, onE
86
86
 
87
87
  Image.displayName = "ImageAvatar";
88
88
 
89
- const Fallback = React.forwardRef<FallbackRef, FallbackProps>(({ ...props }, ref) => {
89
+ const Fallback = forwardRef<FallbackRef, FallbackProps>(({ ...props }, ref) => {
90
90
  const { alt, status } = useRootContext();
91
91
 
92
92
  if (status !== "error") {
@@ -1,12 +1,12 @@
1
1
  import type { Image } from "react-native";
2
2
 
3
- import type { ComponentPropsWithRender, RenderViewProps, ViewRef } from "../types";
3
+ import type { BrandMapUIComponentProps, RenderViewProps, ViewRef } from "../types";
4
4
 
5
5
  type RootProps = RenderViewProps & {
6
6
  alt: string;
7
7
  };
8
8
 
9
- type ImageProps = Omit<ComponentPropsWithRender<typeof Image>, "alt"> & {
9
+ type ImageProps = Omit<BrandMapUIComponentProps<typeof Image>, "alt"> & {
10
10
  children?: React.ReactNode;
11
11
  onLoadingStatusChange?: (status: "error" | "loaded") => void;
12
12
  };