@knitui/components 0.8.1 → 0.10.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.
Files changed (125) hide show
  1. package/lib/commonjs/ActionIcon/ActionIcon.js +4 -2
  2. package/lib/commonjs/ActionIcon/ActionIcon.js.map +1 -1
  3. package/lib/commonjs/Affix/Affix.js +3 -1
  4. package/lib/commonjs/Affix/Affix.js.map +1 -1
  5. package/lib/commonjs/Button/Button.js +38 -3
  6. package/lib/commonjs/Button/Button.js.map +1 -1
  7. package/lib/commonjs/CloseButton/CloseButton.js +7 -0
  8. package/lib/commonjs/CloseButton/CloseButton.js.map +1 -1
  9. package/lib/commonjs/Modal/modal-base.js +4 -2
  10. package/lib/commonjs/Modal/modal-base.js.map +1 -1
  11. package/lib/commonjs/Pill/Pill.js +1 -1
  12. package/lib/commonjs/Popover/Popover.shared.js +3 -1
  13. package/lib/commonjs/Popover/Popover.shared.js.map +1 -1
  14. package/lib/commonjs/Portal/OverlayHost.js +147 -0
  15. package/lib/commonjs/Portal/OverlayHost.js.map +1 -0
  16. package/lib/commonjs/Portal/index.js +25 -0
  17. package/lib/commonjs/Portal/index.js.map +1 -1
  18. package/lib/commonjs/SegmentedControl/SegmentedControl.js +7 -1
  19. package/lib/commonjs/SegmentedControl/SegmentedControl.js.map +1 -1
  20. package/lib/commonjs/Tabs/Tabs.js +8 -1
  21. package/lib/commonjs/Tabs/Tabs.js.map +1 -1
  22. package/lib/commonjs/Tooltip/Tooltip.js +3 -1
  23. package/lib/commonjs/Tooltip/Tooltip.js.map +1 -1
  24. package/lib/commonjs/floating/platform.js +4 -1
  25. package/lib/commonjs/floating/platform.js.map +1 -1
  26. package/lib/commonjs/floating/platform.native.js +15 -5
  27. package/lib/commonjs/floating/platform.native.js.map +1 -1
  28. package/lib/commonjs/floating/use-position.js +9 -3
  29. package/lib/commonjs/floating/use-position.js.map +1 -1
  30. package/lib/commonjs/index.js +24 -0
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/internal/control-icon-size.js +5 -1
  33. package/lib/commonjs/internal/control-icon-size.js.map +1 -1
  34. package/lib/commonjs/internal/control-metrics.js +13 -9
  35. package/lib/commonjs/internal/control-metrics.js.map +1 -1
  36. package/lib/commonjs/internal/style-props.js +36 -6
  37. package/lib/commonjs/internal/style-props.js.map +1 -1
  38. package/lib/module/ActionIcon/ActionIcon.js +5 -3
  39. package/lib/module/ActionIcon/ActionIcon.js.map +1 -1
  40. package/lib/module/Affix/Affix.js +4 -2
  41. package/lib/module/Affix/Affix.js.map +1 -1
  42. package/lib/module/Button/Button.js +40 -5
  43. package/lib/module/Button/Button.js.map +1 -1
  44. package/lib/module/CloseButton/CloseButton.js +8 -1
  45. package/lib/module/CloseButton/CloseButton.js.map +1 -1
  46. package/lib/module/Modal/modal-base.js +5 -3
  47. package/lib/module/Modal/modal-base.js.map +1 -1
  48. package/lib/module/Pill/Pill.js +1 -1
  49. package/lib/module/Popover/Popover.shared.js +4 -2
  50. package/lib/module/Popover/Popover.shared.js.map +1 -1
  51. package/lib/module/Portal/OverlayHost.js +138 -0
  52. package/lib/module/Portal/OverlayHost.js.map +1 -0
  53. package/lib/module/Portal/index.js +5 -0
  54. package/lib/module/Portal/index.js.map +1 -1
  55. package/lib/module/SegmentedControl/SegmentedControl.js +9 -3
  56. package/lib/module/SegmentedControl/SegmentedControl.js.map +1 -1
  57. package/lib/module/Tabs/Tabs.js +9 -2
  58. package/lib/module/Tabs/Tabs.js.map +1 -1
  59. package/lib/module/Tooltip/Tooltip.js +4 -2
  60. package/lib/module/Tooltip/Tooltip.js.map +1 -1
  61. package/lib/module/floating/platform.js +4 -1
  62. package/lib/module/floating/platform.js.map +1 -1
  63. package/lib/module/floating/platform.native.js +15 -5
  64. package/lib/module/floating/platform.native.js.map +1 -1
  65. package/lib/module/floating/use-position.js +9 -3
  66. package/lib/module/floating/use-position.js.map +1 -1
  67. package/lib/module/index.js +1 -1
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/internal/control-icon-size.js +5 -1
  70. package/lib/module/internal/control-icon-size.js.map +1 -1
  71. package/lib/module/internal/control-metrics.js +13 -9
  72. package/lib/module/internal/control-metrics.js.map +1 -1
  73. package/lib/module/internal/style-props.js +33 -4
  74. package/lib/module/internal/style-props.js.map +1 -1
  75. package/lib/typescript/ActionIcon/ActionIcon.d.ts +5 -0
  76. package/lib/typescript/ActionIcon/ActionIcon.d.ts.map +1 -1
  77. package/lib/typescript/Affix/Affix.d.ts.map +1 -1
  78. package/lib/typescript/Button/Button.d.ts +6 -0
  79. package/lib/typescript/Button/Button.d.ts.map +1 -1
  80. package/lib/typescript/CloseButton/CloseButton.d.ts.map +1 -1
  81. package/lib/typescript/Input/shared.d.ts +3 -3
  82. package/lib/typescript/Modal/modal-base.d.ts.map +1 -1
  83. package/lib/typescript/Popover/Popover.shared.d.ts.map +1 -1
  84. package/lib/typescript/Portal/OverlayHost.d.ts +46 -0
  85. package/lib/typescript/Portal/OverlayHost.d.ts.map +1 -0
  86. package/lib/typescript/Portal/index.d.ts +6 -1
  87. package/lib/typescript/Portal/index.d.ts.map +1 -1
  88. package/lib/typescript/Portal/types.d.ts +10 -0
  89. package/lib/typescript/Portal/types.d.ts.map +1 -1
  90. package/lib/typescript/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  91. package/lib/typescript/Tabs/Tabs.d.ts.map +1 -1
  92. package/lib/typescript/Tooltip/Tooltip.d.ts.map +1 -1
  93. package/lib/typescript/floating/platform.d.ts +1 -1
  94. package/lib/typescript/floating/platform.d.ts.map +1 -1
  95. package/lib/typescript/floating/platform.native.d.ts +7 -1
  96. package/lib/typescript/floating/platform.native.d.ts.map +1 -1
  97. package/lib/typescript/floating/use-position.d.ts.map +1 -1
  98. package/lib/typescript/index.d.ts +1 -1
  99. package/lib/typescript/index.d.ts.map +1 -1
  100. package/lib/typescript/internal/control-icon-size.d.ts.map +1 -1
  101. package/lib/typescript/internal/control-metrics.d.ts +13 -9
  102. package/lib/typescript/internal/control-metrics.d.ts.map +1 -1
  103. package/lib/typescript/internal/style-props.d.ts +23 -4
  104. package/lib/typescript/internal/style-props.d.ts.map +1 -1
  105. package/package.json +19 -19
  106. package/src/ActionIcon/ActionIcon.tsx +10 -3
  107. package/src/Affix/Affix.tsx +4 -2
  108. package/src/Button/Button.tsx +69 -19
  109. package/src/CloseButton/CloseButton.tsx +7 -1
  110. package/src/Modal/modal-base.tsx +5 -3
  111. package/src/Pill/Pill.tsx +1 -1
  112. package/src/Popover/Popover.shared.tsx +4 -2
  113. package/src/Portal/OverlayHost.tsx +141 -0
  114. package/src/Portal/index.ts +11 -1
  115. package/src/Portal/types.ts +11 -0
  116. package/src/SegmentedControl/SegmentedControl.tsx +8 -2
  117. package/src/Tabs/Tabs.tsx +9 -1
  118. package/src/Tooltip/Tooltip.tsx +4 -2
  119. package/src/floating/platform.native.ts +13 -4
  120. package/src/floating/platform.ts +3 -0
  121. package/src/floating/use-position.tsx +13 -3
  122. package/src/index.ts +5 -0
  123. package/src/internal/control-icon-size.ts +5 -1
  124. package/src/internal/control-metrics.ts +13 -9
  125. package/src/internal/style-props.ts +32 -4
@@ -231,13 +231,13 @@ export declare const squareSizeRoundedVariant: {
231
231
  readonly minWidth: "$sm";
232
232
  readonly width: "$sm";
233
233
  readonly height: "$sm";
234
- readonly borderRadius: "$sm";
234
+ readonly borderRadius: "$md";
235
235
  };
236
236
  readonly md: {
237
237
  readonly minWidth: "$md";
238
238
  readonly width: "$md";
239
239
  readonly height: "$md";
240
- readonly borderRadius: "$sm";
240
+ readonly borderRadius: "$md";
241
241
  };
242
242
  readonly lg: {
243
243
  readonly minWidth: "$lg";
@@ -370,7 +370,7 @@ export declare const controlFontVariant: {
370
370
  readonly fontSize: "$xs";
371
371
  };
372
372
  readonly md: {
373
- readonly fontSize: "$md";
373
+ readonly fontSize: "$sm";
374
374
  };
375
375
  readonly lg: {
376
376
  readonly fontSize: "$lg";
@@ -858,6 +858,25 @@ export declare const webButton: () => {
858
858
  render?: "button";
859
859
  type?: string;
860
860
  };
861
+ /**
862
+ * {@link WEB_BUTTON_PROPS}, or — when the control NAVIGATES — a real `<a href>`
863
+ * with `role="link"`. A control that goes somewhere must be a link on web, or
864
+ * middle-click / ⌘-click / "copy link" / the hover URL preview all silently fail;
865
+ * wrapping a `<button>` in an `<a>` instead nests interactive content (an axe
866
+ * `nested-interactive` failure). So the button-like frames take `href` and swap
867
+ * their host element here. Native has no link host: `href` is dropped there and
868
+ * the caller's `onPress` does the navigating.
869
+ *
870
+ * The anchor keeps the browser's default click behaviour; an app that routes
871
+ * in-app cancels it itself (e.g. `preventDefault` in a capture-phase click
872
+ * handler for plain clicks, letting modified clicks through).
873
+ */
874
+ export declare const webButtonOrLink: (href: string | undefined) => {
875
+ render?: "button" | "a";
876
+ type?: string;
877
+ href?: string;
878
+ role?: "link";
879
+ };
861
880
  /**
862
881
  * Web-only reset for the native `<button>` user-agent `text-align: center`.
863
882
  * Returned as a raw `style` fragment to spread onto the element's `style` prop —
@@ -1080,7 +1099,7 @@ export declare const kbdSizeVariant: {
1080
1099
  readonly borderRadius: "$sm";
1081
1100
  };
1082
1101
  readonly md: {
1083
- readonly fontSize: "$md";
1102
+ readonly fontSize: "$sm";
1084
1103
  readonly paddingHorizontal: "$md";
1085
1104
  readonly paddingVertical: 6;
1086
1105
  readonly borderRadius: "$sm";
@@ -1 +1 @@
1
- {"version":3,"file":"style-props.d.ts","sourceRoot":"","sources":["../../../src/internal/style-props.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,cAAc,EAAS,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,OAAO,EAAE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;;;;;;;;;;;;;;;;;;;;;;CACf,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,iBAAiB;8BACX,MAAM;oBAA2B,SAAS,CAAC,YAAY,CAAC;;8BACxD,MAAM;oBAA2B,SAAS,CAAC,YAAY,CAAC;;CACjE,CAAC;AAEX,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB;8BACV,MAAM;mBAA0B,SAAS,CAAC,WAAW,CAAC;;CAC/D,CAAC;AAEX,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB;8BACd,MAAM;uBAA8B,SAAS,CAAC,eAAe,CAAC;;CACvE,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3E,mFAAmF;AACnF,eAAO,MAAM,eAAe;8BACT,MAAM;kBAAyB,QAAQ;;CAChD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knitui/components",
3
- "version": "0.8.1",
3
+ "version": "0.10.0",
4
4
  "description": "Cross-platform (React Native + Web) component kit for Knit UI.",
5
5
  "license": "MIT",
6
6
  "author": "The Haus <joost@the.haus>",
@@ -60,10 +60,10 @@
60
60
  ],
61
61
  "sideEffects": false,
62
62
  "dependencies": {
63
- "expo-image": "~57.0.1",
64
- "@knitui/core": "0.8.1",
65
- "@knitui/hooks": "0.8.1",
66
- "@knitui/icons": "0.8.1"
63
+ "expo-image": "~57.0.5",
64
+ "@knitui/core": "0.10.0",
65
+ "@knitui/hooks": "0.10.0",
66
+ "@knitui/icons": "0.10.0"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "*",
@@ -90,27 +90,27 @@
90
90
  },
91
91
  "devDependencies": {
92
92
  "@babel/core": "^7.25.0",
93
- "@playwright/test": "^1.50.0",
94
- "@storybook/addon-docs": "^10.5.5",
95
- "@storybook/react-vite": "^10.5.5",
96
- "@tamagui/build": "^2.4.6",
97
- "@testing-library/jest-dom": "^6.6.3",
98
- "@testing-library/react": "^16.1.0",
99
- "@testing-library/user-event": "^14.5.2",
93
+ "@playwright/test": "^1.63.0",
94
+ "@storybook/addon-docs": "^10.6.0",
95
+ "@storybook/react-vite": "^10.6.0",
96
+ "@tamagui/build": "2.7.7",
97
+ "@testing-library/jest-dom": "^7.0.1",
98
+ "@testing-library/react": "^16.3.3",
99
+ "@testing-library/user-event": "^14.6.7",
100
100
  "@types/jest": "^29.5.12",
101
- "@types/react": "~19.2.0",
102
- "@vitejs/plugin-react": "^6.0.4",
101
+ "@types/react": "~19.2.18",
102
+ "@vitejs/plugin-react": "^6.1.1",
103
103
  "babel-jest": "^29.7.0",
104
- "babel-preset-expo": "^57.0.5",
104
+ "babel-preset-expo": "^57.0.12",
105
105
  "jest": "^29.7.0",
106
106
  "jest-environment-jsdom": "^29.7.0",
107
107
  "react": "19.2.3",
108
108
  "react-dom": "19.2.3",
109
- "react-native": "0.86.2",
110
- "react-native-builder-bob": "^0.43.0",
109
+ "react-native": "0.86.3",
110
+ "react-native-builder-bob": "^0.43.1",
111
111
  "react-native-web": "~0.21.0",
112
- "storybook": "^10.5.3",
113
- "vite": "^8.1.5"
112
+ "storybook": "^10.6.0",
113
+ "vite": "^8.3.0"
114
114
  },
115
115
  "react-native-builder-bob": {
116
116
  "source": "src",
@@ -17,7 +17,7 @@ import {
17
17
  radiusVariant,
18
18
  type SizeKey,
19
19
  squareSizeRoundedVariant,
20
- webButton,
20
+ webButtonOrLink,
21
21
  webCursor,
22
22
  } from "../internal/style-props";
23
23
  import { slotStyles, type SlotStyles } from "../internal/styles";
@@ -227,6 +227,11 @@ const ACTION_ICON_SLOT_KEYS = [
227
227
  ] as const satisfies readonly (keyof ActionIconStyles)[];
228
228
 
229
229
  export interface ActionIconProps extends GetProps<typeof ActionIconFrame> {
230
+ /**
231
+ * Destination — renders a real `<a href>` (`role="link"`) on web; ignored on
232
+ * native and while disabled/loading. See `Button`'s `href`.
233
+ */
234
+ href?: string;
230
235
  /** If set, a `Loader` is shown instead of the icon and interaction is blocked. */
231
236
  loading?: boolean;
232
237
  /**
@@ -253,6 +258,7 @@ const ActionIconComponent = ActionIconFrame.styleable<ActionIconProps>(
253
258
  loaderProps,
254
259
  styles,
255
260
  gradient,
261
+ href,
256
262
  variant = "filled",
257
263
  size = "md",
258
264
  ...rest
@@ -278,8 +284,9 @@ const ActionIconComponent = ActionIconFrame.styleable<ActionIconProps>(
278
284
  {...grad.frameProps}
279
285
  {...rest}
280
286
  aria-disabled={isDisabled || undefined}
281
- // Real focusable `<button>` on web so the `:focus-visible` outline fires.
282
- {...webButton()}
287
+ // Real focusable `<button>` on web so the `:focus-visible` outline fires —
288
+ // or a real `<a href>` when the control navigates (`href`).
289
+ {...webButtonOrLink(isDisabled ? undefined : href)}
283
290
  >
284
291
  {grad.layer}
285
292
  {loading ? (
@@ -4,7 +4,7 @@ import { type GetProps, isWeb, styled } from "@knitui/core";
4
4
 
5
5
  import { Box } from "../Box";
6
6
  import { shadowVariant } from "../internal/style-props";
7
- import { Portal } from "../Portal";
7
+ import { Portal, useOverlayHost } from "../Portal";
8
8
 
9
9
  /** Default screen `z-index` for the Affix layer (mirrors Mantine's `modal`). */
10
10
  const DEFAULT_Z_INDEX = 200;
@@ -68,6 +68,8 @@ export const Affix = AffixFrame.styleable<AffixProps>(function Affix(props, ref)
68
68
  position = { bottom: 0, right: 0 },
69
69
  ...rest
70
70
  } = props;
71
+ // The nearest scoped `OverlayHost` (a native modal screen), else "root".
72
+ const overlayHost = useOverlayHost();
71
73
 
72
74
  const frame = (
73
75
  <AffixFrame
@@ -86,5 +88,5 @@ export const Affix = AffixFrame.styleable<AffixProps>(function Affix(props, ref)
86
88
  />
87
89
  );
88
90
 
89
- return withinPortal ? <Portal hostName="root">{frame}</Portal> : frame;
91
+ return withinPortal ? <Portal hostName={overlayHost}>{frame}</Portal> : frame;
90
92
  });
@@ -27,7 +27,7 @@ import {
27
27
  pressScaleStyle,
28
28
  radiusVariant,
29
29
  type SizeKey,
30
- WEB_BUTTON_PROPS,
30
+ webButtonOrLink,
31
31
  webCursor,
32
32
  } from "../internal/style-props";
33
33
  import { slotStyles, type SlotStyles } from "../internal/styles";
@@ -189,6 +189,12 @@ const BUTTON_SLOT_KEYS = [
189
189
  type ButtonFrameProps = Omit<GetProps<typeof ButtonFrame>, "disabled">;
190
190
 
191
191
  export interface ButtonProps extends ButtonFrameProps {
192
+ /**
193
+ * Destination — renders the button as a real `<a href>` (`role="link"`) on web,
194
+ * so middle-click and ⌘-click open a new tab. Ignored on native (navigate in
195
+ * `onPress`) and while `disabled`/`loading` (a disabled link is not a link).
196
+ */
197
+ href?: string;
192
198
  disabled?: boolean;
193
199
  loading?: boolean;
194
200
  /**
@@ -219,6 +225,7 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
219
225
  styles,
220
226
  nativeID,
221
227
  gradient,
228
+ href,
222
229
  size = "md",
223
230
  variant = "filled",
224
231
  ...rest
@@ -254,20 +261,27 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
254
261
  // Loader replaces that icon, so it takes the SAME canonical in-control icon px
255
262
  // (`controlIconSize`) — reading with the icon's weight, not the full control
256
263
  // height. `loaderProps.size` still overrides this.
257
- const left = loading ? (
258
- <Loader
259
- size={controlIconSize(size)}
260
- type="oval"
261
- theme="gray"
262
- {...s.merge("loader", loaderProps)}
263
- />
264
- ) : leftContent != null ? (
265
- <ButtonSection {...s.merge("left", slots.Left?.props)}>
266
- <ControlIconProvider size={size} variant={variant}>
267
- {leftContent}
268
- </ControlIconProvider>
269
- </ButtonSection>
270
- ) : null;
264
+ // With NO left visual there is no slot for the loader to take over, and
265
+ // prepending one grew the button by icon + gap mid-press (a Save that jumps
266
+ // wider as you tap it). So it overlays instead: the label and right section
267
+ // stay in the layout at `opacity: 0` — keeping the exact width — and the loader
268
+ // sits centred on top. With a left visual the swap keeps the width already.
269
+ const overlayLoader = !!loading && leftContent == null;
270
+ const left =
271
+ loading && !overlayLoader ? (
272
+ <Loader
273
+ size={controlIconSize(size)}
274
+ type="oval"
275
+ theme="gray"
276
+ {...s.merge("loader", loaderProps)}
277
+ />
278
+ ) : leftContent != null ? (
279
+ <ButtonSection {...s.merge("left", slots.Left?.props)}>
280
+ <ControlIconProvider size={size} variant={variant}>
281
+ {leftContent}
282
+ </ControlIconProvider>
283
+ </ButtonSection>
284
+ ) : null;
271
285
  const right =
272
286
  rightContent != null ? (
273
287
  <ButtonSection {...s.merge("right", slots.Right?.props)}>
@@ -292,13 +306,49 @@ const ButtonComponent = ButtonFrame.styleable<ButtonProps>(function Button(props
292
306
  {...rest}
293
307
  aria-disabled={isDisabled || undefined}
294
308
  {...nativeIdProps}
295
- // Real focusable `<button>` on web so the `:focus-visible` outline fires.
296
- {...WEB_BUTTON_PROPS}
309
+ // Real focusable `<button>` on web so the `:focus-visible` outline fires —
310
+ // or a real `<a href>` when the button navigates (`href`).
311
+ {...webButtonOrLink(isDisabled ? undefined : href)}
297
312
  >
298
313
  {grad.layer}
299
314
  {left}
300
- {renderTextChild(label, LabelText)}
301
- {right}
315
+ {overlayLoader ? (
316
+ <>
317
+ <Box
318
+ flexDirection="row"
319
+ alignItems="center"
320
+ gap="$sm"
321
+ // Invisible, NOT aria-hidden: the label is still the button's name
322
+ // while it loads.
323
+ opacity={0}
324
+ >
325
+ {renderTextChild(label, LabelText)}
326
+ {right}
327
+ </Box>
328
+ <Box
329
+ position="absolute"
330
+ top={0}
331
+ right={0}
332
+ bottom={0}
333
+ left={0}
334
+ alignItems="center"
335
+ justifyContent="center"
336
+ pointerEvents="none"
337
+ >
338
+ <Loader
339
+ size={controlIconSize(size)}
340
+ type="oval"
341
+ theme="gray"
342
+ {...s.merge("loader", loaderProps)}
343
+ />
344
+ </Box>
345
+ </>
346
+ ) : (
347
+ <>
348
+ {renderTextChild(label, LabelText)}
349
+ {right}
350
+ </>
351
+ )}
302
352
  </ButtonFrame>
303
353
  );
304
354
  });
@@ -9,7 +9,7 @@ import { ControlIconProvider } from "../internal/ControlIconProvider";
9
9
  import { type GradientValue, useGradient } from "../internal/gradient";
10
10
  import { usePressScale } from "../internal/motion";
11
11
  import { renderTextChild } from "../internal/render-text-child";
12
- import { fontSizePassthroughVariant } from "../internal/style-props";
12
+ import { fontSizePassthroughVariant, WEB_BUTTON_PROPS } from "../internal/style-props";
13
13
  import { slotStyles, type SlotStyles } from "../internal/styles";
14
14
 
15
15
  const CloseButtonFrame = styled(ActionIcon.Frame, {
@@ -123,6 +123,12 @@ const CloseButtonComponent = CloseButtonFrame.styleable<CloseButtonProps>(
123
123
  {...press}
124
124
  {...grad.frameProps}
125
125
  {...rest}
126
+ aria-disabled={rest.disabled || undefined}
127
+ // A real focusable `<button>` on web, like `ActionIcon` (whose frame this
128
+ // is). Without it CloseButton was a `<div role="button">`: never a tab
129
+ // stop, so the inherited focus ring could not fire and every dismiss ✕
130
+ // in a consumer app was mouse-only.
131
+ {...WEB_BUTTON_PROPS}
126
132
  >
127
133
  {grad.layer}
128
134
  {icon ?? (
@@ -8,7 +8,7 @@ import type { CloseButtonProps } from "../CloseButton";
8
8
  import { type MotionPreset, type MotionPresetName, useMotionPreset } from "../internal/motion";
9
9
  import { slotStyles, type SlotStyles } from "../internal/styles";
10
10
  import { Overlay, type OverlayProps } from "../Overlay";
11
- import { Portal } from "../Portal";
11
+ import { Portal, useOverlayHost } from "../Portal";
12
12
  import { ModalBaseInner } from "./modal-base-inner";
13
13
 
14
14
  /**
@@ -195,6 +195,8 @@ export function ModalBase(props: ModalBaseProps) {
195
195
  // the active theme across the portal boundary (on web the content's DOM moves
196
196
  // into the root host, losing any nested `<Theme>` ancestor's class).
197
197
  const themeName = useThemeName();
198
+ // The nearest scoped `OverlayHost` (a native modal screen), else "root".
199
+ const overlayHost = useOverlayHost();
198
200
 
199
201
  // Trap keyboard focus within the content while opened; the returned ref
200
202
  // attaches to the positioning layer. `useFocusTrap` is itself a no-op on
@@ -298,7 +300,7 @@ export function ModalBase(props: ModalBaseProps) {
298
300
  // `keepMounted` stays in the tree and toggles `display` — entrance animates but
299
301
  // there is no exit (the node never leaves), mirroring `Dialog`/`Popover`.
300
302
  if (keepMounted) {
301
- return <Portal hostName={withinPortal ? "root" : undefined}>{layer}</Portal>;
303
+ return <Portal hostName={withinPortal ? overlayHost : undefined}>{layer}</Portal>;
302
304
  }
303
305
 
304
306
  // Default: `AnimatePresence` holds the whole layer (scrim + content) in the tree
@@ -310,7 +312,7 @@ export function ModalBase(props: ModalBaseProps) {
310
312
  return (
311
313
  <AnimatePresence>
312
314
  {opened ? (
313
- <Portal key="modal-layer" hostName={withinPortal ? "root" : undefined}>
315
+ <Portal key="modal-layer" hostName={withinPortal ? overlayHost : undefined}>
314
316
  {layer}
315
317
  </Portal>
316
318
  ) : null}
package/src/Pill/Pill.tsx CHANGED
@@ -74,7 +74,7 @@ const PillFrame = styled(Box, {
74
74
  size: controlGapVariant,
75
75
  radius: radiusVariant,
76
76
  disabled: {
77
- true: { opacity: 0.5, pointerEvents: "none" },
77
+ true: { opacity: 0.6, pointerEvents: "none" },
78
78
  },
79
79
  } as const,
80
80
 
@@ -38,7 +38,7 @@ import { useOverlayChrome } from "../internal/overlay-chrome";
38
38
  import { shadowVariant } from "../internal/style-props";
39
39
  import { type SlotStyles } from "../internal/styles";
40
40
  import { type OverlayProps } from "../Overlay";
41
- import { Portal } from "../Portal";
41
+ import { Portal, useOverlayHost } from "../Portal";
42
42
  import {
43
43
  type OverlayTransitionConfig,
44
44
  useOverlayTransition,
@@ -712,6 +712,8 @@ export const PopoverDropdownView = PopoverDropdownFrame.styleable<PopoverDropdow
712
712
  // variables ($background/$color/…) would otherwise resolve to the root theme.
713
713
  // (Mirrors `@tamagui/portal` wrapping its portal in `<TamaguiRoot theme={…}>`.)
714
714
  const themeName = useThemeName();
715
+ // The nearest scoped `OverlayHost` (a native modal screen), else "root".
716
+ const overlayHost = useOverlayHost();
715
717
  // Enter/exit animation via the shared `Transition` engine. It owns the lazy
716
718
  // mount/unmount (so the dropdown now animates OUT before unmounting, not just
717
719
  // in) and honours reduced motion (duration collapses to 0). Positioning,
@@ -739,7 +741,7 @@ export const PopoverDropdownView = PopoverDropdownFrame.styleable<PopoverDropdow
739
741
  const transitionStyle = waitingForPosition ? { ...t.style, opacity: 0 } : t.style;
740
742
 
741
743
  return (
742
- <Portal hostName={ctx.withinPortal ? "root" : undefined}>
744
+ <Portal hostName={ctx.withinPortal ? overlayHost : undefined}>
743
745
  <Theme name={themeName}>
744
746
  {/* Keep the scrim and the dropdown frame as direct siblings (rather
745
747
  than hoisting the scrim above `<Theme>`) so their z-indices compare
@@ -0,0 +1,141 @@
1
+ import * as React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { PortalHost } from "react-native-teleport";
4
+
5
+ import type { OverlayHostProps } from "./types";
6
+
7
+ /** The full-screen host `@knitui/core`'s `<Provider>` mounts (via `PortalProvider`). */
8
+ export const ROOT_OVERLAY_HOST = "root";
9
+
10
+ type OverlayHostContextValue = {
11
+ /** Host name the kit's overlays teleport into. */
12
+ name: string;
13
+ /** Nesting depth: 0 for the root host, +1 per enclosing {@link OverlayHost}. */
14
+ depth: number;
15
+ /**
16
+ * The view wrapping the scoped host, so the native floating engine can measure
17
+ * the host's window origin. `null` for the root host (it sits at the window
18
+ * origin by construction).
19
+ */
20
+ frameRef: React.RefObject<View | null> | null;
21
+ };
22
+
23
+ const ROOT_VALUE: OverlayHostContextValue = { name: ROOT_OVERLAY_HOST, depth: 0, frameRef: null };
24
+
25
+ const OverlayHostContext = React.createContext<OverlayHostContextValue>(ROOT_VALUE);
26
+
27
+ // ---------------------------------------------------------------------------
28
+ // Mounted-host registry — backs `useTopmostOverlayHost`. Module-level because
29
+ // the question it answers ("which host is on top right now?") is asked by
30
+ // app-global singletons (a toast layer) that sit OUTSIDE every scoped host.
31
+ // ---------------------------------------------------------------------------
32
+
33
+ type Entry = { name: string; depth: number; seq: number };
34
+
35
+ let entries: Entry[] = [];
36
+ let seq = 0;
37
+ const listeners = new Set<() => void>();
38
+
39
+ function subscribe(listener: () => void): () => void {
40
+ listeners.add(listener);
41
+ return () => {
42
+ listeners.delete(listener);
43
+ };
44
+ }
45
+
46
+ /** Deepest host wins; among equals, the most recently mounted one. */
47
+ function getTopmost(): string {
48
+ let top: Entry | undefined;
49
+ for (const e of entries) {
50
+ if (!top || e.depth > top.depth || (e.depth === top.depth && e.seq > top.seq)) top = e;
51
+ }
52
+ return top?.name ?? ROOT_OVERLAY_HOST;
53
+ }
54
+
55
+ function register(name: string, depth: number): () => void {
56
+ const entry: Entry = { name, depth, seq: ++seq };
57
+ entries = [...entries, entry];
58
+ listeners.forEach((l) => l());
59
+ return () => {
60
+ entries = entries.filter((e) => e !== entry);
61
+ listeners.forEach((l) => l());
62
+ };
63
+ }
64
+
65
+ /**
66
+ * A **scoped** portal host. Mounts a `PortalHost` named `name` over its
67
+ * children (an absolute fill of the parent) and tells every kit overlay rendered
68
+ * inside it — `Popover`/`Menu`/`Combobox`/date-picker dropdowns, `Tooltip`,
69
+ * `Modal`/`Drawer`, `Affix`, a modal `Sheet` — to teleport there instead of into
70
+ * the app-wide `"root"` host.
71
+ *
72
+ * Use it to wrap a screen that the platform presents in its own native container
73
+ * (an iOS `formSheet` / `fullScreenModal`, an Android dialog): the root host
74
+ * lives in the window underneath, so without a scope those overlays would draw
75
+ * BEHIND the modal.
76
+ *
77
+ * Nothing changes outside an `OverlayHost` — overlays keep using `"root"`.
78
+ * Names must be unique among mounted hosts (a route key is a good suffix).
79
+ *
80
+ * @example
81
+ * ```tsx
82
+ * <OverlayHost name={`modal:${route.key}`}>
83
+ * <FiltersScreen />
84
+ * </OverlayHost>
85
+ * ```
86
+ */
87
+ export function OverlayHost({ name, children }: OverlayHostProps) {
88
+ const parent = React.useContext(OverlayHostContext);
89
+ const depth = parent.depth + 1;
90
+ const frameRef = React.useRef<View>(null);
91
+
92
+ const value = React.useMemo<OverlayHostContextValue>(
93
+ () => ({ name, depth, frameRef }),
94
+ [name, depth],
95
+ );
96
+
97
+ React.useEffect(() => register(name, depth), [name, depth]);
98
+
99
+ return (
100
+ <OverlayHostContext.Provider value={value}>
101
+ {children}
102
+ {/* After the children, so teleported overlays paint above the screen.
103
+ `box-none`: the empty host must never swallow touches meant for the
104
+ screen beneath it. `collapsable={false}` keeps the wrapper a real
105
+ native view so it can be measured. */}
106
+ <View ref={frameRef} collapsable={false} style={styles.frame}>
107
+ <PortalHost name={name} style={StyleSheet.absoluteFill} />
108
+ </View>
109
+ </OverlayHostContext.Provider>
110
+ );
111
+ }
112
+
113
+ const styles = StyleSheet.create({
114
+ frame: { position: "absolute", top: 0, right: 0, bottom: 0, left: 0, pointerEvents: "box-none" },
115
+ });
116
+
117
+ /**
118
+ * The host name overlays at this point in the tree should teleport into:
119
+ * the nearest {@link OverlayHost}'s, else `"root"`. The kit's own overlays read
120
+ * it; use it for a custom `<Portal hostName={useOverlayHost()}>`.
121
+ */
122
+ export function useOverlayHost(): string {
123
+ return React.useContext(OverlayHostContext).name;
124
+ }
125
+
126
+ /**
127
+ * The name of the top-most MOUNTED {@link OverlayHost} anywhere in the app, else
128
+ * `"root"`. For app-global overlays rendered OUTSIDE any scope — e.g. one toast
129
+ * layer near the app root — that should still show above whatever modal is up.
130
+ */
131
+ export function useTopmostOverlayHost(): string {
132
+ return React.useSyncExternalStore(subscribe, getTopmost, getTopmost);
133
+ }
134
+
135
+ /**
136
+ * @internal The scoped host's measurable frame (or `null` under the root host),
137
+ * for the native floating engine's container-origin math.
138
+ */
139
+ export function useOverlayHostFrame(): React.RefObject<View | null> | null {
140
+ return React.useContext(OverlayHostContext).frameRef;
141
+ }
@@ -1,4 +1,10 @@
1
- export type { PortalHostProps, PortalProps, PortalProviderProps } from "./types";
1
+ export {
2
+ OverlayHost,
3
+ ROOT_OVERLAY_HOST,
4
+ useOverlayHost,
5
+ useTopmostOverlayHost,
6
+ } from "./OverlayHost";
7
+ export type { OverlayHostProps, PortalHostProps, PortalProps, PortalProviderProps } from "./types";
2
8
  /**
3
9
  * Portal system — a thin re-export of `react-native-teleport`.
4
10
  *
@@ -14,6 +20,10 @@ export type { PortalHostProps, PortalProps, PortalProviderProps } from "./types"
14
20
  * to render inline in place (the no-teleport fallback).
15
21
  * - Add extra mount points with `<PortalHost name="…" />` and target them by name.
16
22
  * - `usePortal(hostName)` exposes `{ isHostAvailable, removePortal }`.
23
+ * - Wrap a natively presented modal screen in `<OverlayHost name="…">` so the
24
+ * kit's overlays inside it teleport into THAT host rather than `"root"` (which
25
+ * lives in the window underneath the modal). They read the host through
26
+ * `useOverlayHost()`; `useTopmostOverlayHost()` serves app-global layers.
17
27
  *
18
28
  * @see https://kirillzyusko.github.io/react-native-teleport
19
29
  */
@@ -45,3 +45,14 @@ export type PortalHostProps = {
45
45
  export type PortalProviderProps = {
46
46
  children: React.ReactNode;
47
47
  };
48
+
49
+ /**
50
+ * Props for {@link OverlayHost} — a scoped portal host that kit overlays inside
51
+ * it teleport into instead of the app-wide `"root"` host.
52
+ */
53
+ export type OverlayHostProps = {
54
+ /** Unique host name (among mounted hosts). Overlays inside target it automatically. */
55
+ name: string;
56
+ /** The subtree whose overlays should draw into this host. */
57
+ children?: React.ReactNode;
58
+ };