INIT
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
export { default as VisuallyHidden } from "./visually-hidden.svelte";
|
||||
export type * from "./types.js";
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { default as VisuallyHidden } from "./visually-hidden.svelte";
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import type { WithChild } from "../../../internal/types.js";
|
||||
import type { BitsPrimitiveSpanAttributes } from "../../../shared/attributes.js";
|
||||
export type VisuallyHiddenProps = WithChild<BitsPrimitiveSpanAttributes>;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { mergeProps } from "svelte-toolbelt";
|
||||
import type { VisuallyHiddenProps } from "./types.js";
|
||||
import type { StyleProperties } from "../../../shared/index.js";
|
||||
|
||||
let { children, child, ...restProps }: VisuallyHiddenProps = $props();
|
||||
|
||||
const style: StyleProperties = {
|
||||
position: "absolute",
|
||||
border: 0,
|
||||
width: "1px",
|
||||
display: "inline-block",
|
||||
height: "1px",
|
||||
padding: 0,
|
||||
margin: "-1px",
|
||||
overflow: "hidden",
|
||||
clip: "rect(0 0 0 0)",
|
||||
whiteSpace: "nowrap",
|
||||
wordWrap: "normal",
|
||||
};
|
||||
|
||||
const mergedProps = $derived(mergeProps(restProps, { style }));
|
||||
</script>
|
||||
|
||||
{#if child}
|
||||
{@render child({ props: mergedProps })}
|
||||
{:else}
|
||||
<span {...mergedProps}>
|
||||
{@render children?.()}
|
||||
</span>
|
||||
{/if}
|
||||
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import type { VisuallyHiddenProps } from "./types.js";
|
||||
declare const VisuallyHidden: import("svelte").Component<VisuallyHiddenProps, {}, "">;
|
||||
type VisuallyHidden = ReturnType<typeof VisuallyHidden>;
|
||||
export default VisuallyHidden;
|
||||
Reference in New Issue
Block a user