@stenajs-webui/core 23.12.10 → 23.12.11
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/util/Slot.d.ts +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +176 -157
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Slot merges its own props onto its single child element rather than rendering
|
|
6
|
+
* a DOM element of its own. This enables the "asChild" pattern, where a
|
|
7
|
+
* component delegates rendering to whatever element the caller provides.
|
|
8
|
+
*
|
|
9
|
+
* Props are applied in this order (later wins):
|
|
10
|
+
* 1. Slot's own props (e.g. className, event handlers, ref)
|
|
11
|
+
* 2. Child's own props (so the caller always has the final say on things like href, to, onClick)
|
|
12
|
+
*
|
|
13
|
+
* classNames from both sides are merged so that design-system styles
|
|
14
|
+
* are always applied alongside any classes the child brings.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* A NavBarLink that renders a React Router <Link> but keeps its own styles:
|
|
18
|
+
* <NavBarLink asChild>
|
|
19
|
+
* <Link to="/dashboard">Dashboard</Link>
|
|
20
|
+
* </NavBarLink>
|
|
21
|
+
*/
|
|
22
|
+
export declare const Slot: import("react").ForwardRefExoticComponent<SlotProps & import("react").RefAttributes<HTMLElement>>;
|
|
23
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./components/layout/indent/Indent";
|
|
|
9
9
|
export * from "./components/layout/spacing/Spacing";
|
|
10
10
|
export * from "./components/layout/space/Space";
|
|
11
11
|
export * from "./components/util/Nest";
|
|
12
|
+
export * from "./components/util/Slot";
|
|
12
13
|
export * from "./accessibility/accessible-font-size-detector/AccessibleFontSizeProvider";
|
|
13
14
|
export * from "./accessibility/accessible-font-size-detector/UseAccessibleFontSizeContext";
|
|
14
15
|
export * from "./accessibility/screen-reader-only-text/ScreenReaderOnlyText";
|