@ariakit/solid-core 0.0.1 → 0.1.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/CHANGELOG.md +5 -0
- package/as/as/package.json +8 -0
- package/cjs/__chunks/53WPOLZU.cjs +7 -0
- package/cjs/__chunks/AUGTJ473.cjs +7 -0
- package/cjs/__chunks/GVOD7RTZ.cjs +21 -0
- package/cjs/__chunks/JFCGWMZC.cjs +35 -0
- package/cjs/__chunks/RLO4RIGL.cjs +42 -0
- package/cjs/__chunks/T5IUBZJK.cjs +39 -0
- package/cjs/__chunks/V3ZEI37L.cjs +61 -0
- package/cjs/__chunks/V5YR7HBG.cjs +37 -0
- package/cjs/as/as.cjs +7 -0
- package/cjs/as/as.d.cts +30 -0
- package/cjs/as/as.d.ts +30 -0
- package/cjs/focus-trap/focus-trap-region.cjs +68 -0
- package/cjs/focus-trap/focus-trap-region.d.cts +38 -0
- package/cjs/focus-trap/focus-trap-region.d.ts +38 -0
- package/cjs/focus-trap/focus-trap.cjs +11 -0
- package/cjs/focus-trap/focus-trap.d.cts +27 -0
- package/cjs/focus-trap/focus-trap.d.ts +27 -0
- package/cjs/group/group-label-context.cjs +6 -0
- package/cjs/group/group-label-context.d.cts +2 -0
- package/cjs/group/group-label-context.d.ts +2 -0
- package/cjs/group/group-label.cjs +41 -0
- package/cjs/group/group-label.d.cts +34 -0
- package/cjs/group/group-label.d.ts +34 -0
- package/cjs/group/group.cjs +43 -0
- package/cjs/group/group.d.cts +28 -0
- package/cjs/group/group.d.ts +28 -0
- package/cjs/heading/heading-context.cjs +6 -0
- package/cjs/heading/heading-context.d.cts +3 -0
- package/cjs/heading/heading-context.d.ts +3 -0
- package/cjs/heading/heading-level.cjs +23 -0
- package/cjs/heading/heading-level.d.cts +27 -0
- package/cjs/heading/heading-level.d.ts +27 -0
- package/cjs/heading/heading.cjs +45 -0
- package/cjs/heading/heading.d.cts +39 -0
- package/cjs/heading/heading.d.ts +39 -0
- package/cjs/heading/utils.cjs +1 -0
- package/cjs/heading/utils.d.cts +1 -0
- package/cjs/heading/utils.d.ts +1 -0
- package/cjs/role/role.cjs +26 -0
- package/cjs/role/role.d.cts +33 -0
- package/cjs/role/role.d.ts +33 -0
- package/cjs/separator/separator.cjs +30 -0
- package/cjs/separator/separator.d.cts +32 -0
- package/cjs/separator/separator.d.ts +32 -0
- package/cjs/utils/misc.cjs +8 -0
- package/cjs/utils/misc.d.cts +16 -0
- package/cjs/utils/misc.d.ts +16 -0
- package/cjs/utils/reactivity.cjs +12 -0
- package/cjs/utils/reactivity.d.cts +109 -0
- package/cjs/utils/reactivity.d.ts +109 -0
- package/cjs/utils/system.cjs +13 -0
- package/cjs/utils/system.d.cts +45 -0
- package/cjs/utils/system.d.ts +45 -0
- package/cjs/utils/types.cjs +1 -0
- package/cjs/utils/types.d.cts +56 -0
- package/cjs/utils/types.d.ts +56 -0
- package/cjs/visually-hidden/visually-hidden.cjs +10 -0
- package/cjs/visually-hidden/visually-hidden.d.cts +34 -0
- package/cjs/visually-hidden/visually-hidden.d.ts +34 -0
- package/esm/__chunks/I7JSIDPD.js +7 -0
- package/esm/__chunks/ILGMKAYU.js +37 -0
- package/esm/__chunks/NX66AMGW.js +39 -0
- package/esm/__chunks/OKOFCLOZ.js +61 -0
- package/esm/__chunks/QKOHDUFI.js +42 -0
- package/esm/__chunks/SFKMELHD.js +35 -0
- package/esm/__chunks/UKDBTPK5.js +21 -0
- package/esm/__chunks/VOWRNGOM.js +7 -0
- package/esm/as/as.d.ts +30 -0
- package/esm/as/as.js +7 -0
- package/esm/focus-trap/focus-trap-region.d.ts +38 -0
- package/esm/focus-trap/focus-trap-region.js +68 -0
- package/esm/focus-trap/focus-trap.d.ts +27 -0
- package/esm/focus-trap/focus-trap.js +11 -0
- package/esm/group/group-label-context.d.ts +2 -0
- package/esm/group/group-label-context.js +6 -0
- package/esm/group/group-label.d.ts +34 -0
- package/esm/group/group-label.js +41 -0
- package/esm/group/group.d.ts +28 -0
- package/esm/group/group.js +43 -0
- package/esm/heading/heading-context.d.ts +3 -0
- package/esm/heading/heading-context.js +6 -0
- package/esm/heading/heading-level.d.ts +27 -0
- package/esm/heading/heading-level.js +23 -0
- package/esm/heading/heading.d.ts +39 -0
- package/esm/heading/heading.js +45 -0
- package/esm/heading/utils.d.ts +1 -0
- package/esm/heading/utils.js +0 -0
- package/esm/role/role.d.ts +33 -0
- package/esm/role/role.js +26 -0
- package/esm/separator/separator.d.ts +32 -0
- package/esm/separator/separator.js +30 -0
- package/esm/utils/misc.d.ts +16 -0
- package/esm/utils/misc.js +8 -0
- package/esm/utils/reactivity.d.ts +109 -0
- package/esm/utils/reactivity.js +12 -0
- package/esm/utils/system.d.ts +45 -0
- package/esm/utils/system.js +13 -0
- package/esm/utils/types.d.ts +56 -0
- package/esm/utils/types.js +0 -0
- package/esm/visually-hidden/visually-hidden.d.ts +34 -0
- package/esm/visually-hidden/visually-hidden.js +10 -0
- package/focus-trap/focus-trap/package.json +8 -0
- package/focus-trap/focus-trap-region/package.json +8 -0
- package/group/group/package.json +8 -0
- package/group/group-label/package.json +8 -0
- package/group/group-label-context/package.json +8 -0
- package/heading/heading/package.json +8 -0
- package/heading/heading-context/package.json +8 -0
- package/heading/heading-level/package.json +8 -0
- package/heading/utils/package.json +8 -0
- package/index.ts +1 -0
- package/license +21 -0
- package/package.json +181 -6
- package/readme.md +22 -0
- package/role/role/package.json +8 -0
- package/separator/separator/package.json +8 -0
- package/solid/__chunks/ALJQAVR2.jsx +42 -0
- package/solid/__chunks/HBI7B4XO.jsx +52 -0
- package/solid/__chunks/HUX7TBVM.jsx +37 -0
- package/solid/__chunks/KXVBEYOF.jsx +21 -0
- package/solid/__chunks/O5QTZ2VS.jsx +42 -0
- package/solid/__chunks/PIGECGWJ.jsx +40 -0
- package/solid/__chunks/TCHPU5P4.jsx +7 -0
- package/solid/__chunks/VAA446IN.jsx +7 -0
- package/solid/as/as.jsx +7 -0
- package/solid/focus-trap/focus-trap-region.jsx +63 -0
- package/solid/focus-trap/focus-trap.jsx +11 -0
- package/solid/group/group-label-context.jsx +6 -0
- package/solid/group/group-label.jsx +50 -0
- package/solid/group/group.jsx +45 -0
- package/solid/heading/heading-context.jsx +6 -0
- package/solid/heading/heading-level.jsx +22 -0
- package/solid/heading/heading.jsx +52 -0
- package/solid/heading/utils.jsx +0 -0
- package/solid/role/role.jsx +59 -0
- package/solid/separator/separator.jsx +36 -0
- package/solid/utils/misc.jsx +8 -0
- package/solid/utils/reactivity.jsx +12 -0
- package/solid/utils/system.jsx +13 -0
- package/solid/utils/types.jsx +0 -0
- package/solid/visually-hidden/visually-hidden.jsx +10 -0
- package/tsconfig.build.json +4 -0
- package/utils/misc/package.json +8 -0
- package/utils/reactivity/package.json +8 -0
- package/utils/system/package.json +8 -0
- package/utils/types/package.json +8 -0
- package/visually-hidden/visually-hidden/package.json +8 -0
package/esm/role/role.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createHook,
|
|
3
|
+
createInstance
|
|
4
|
+
} from "../__chunks/OKOFCLOZ.js";
|
|
5
|
+
import "../__chunks/QKOHDUFI.js";
|
|
6
|
+
|
|
7
|
+
// src/role/role.tsx
|
|
8
|
+
var TagName = "div";
|
|
9
|
+
var elements = ["a", "button", "details", "dialog", "div", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "img", "input", "label", "li", "nav", "ol", "p", "section", "select", "span", "summary", "textarea", "ul", "svg"];
|
|
10
|
+
var useRole = createHook(function useRole2(props) {
|
|
11
|
+
return props;
|
|
12
|
+
});
|
|
13
|
+
var Role = function Role2(props) {
|
|
14
|
+
return createInstance(TagName, props);
|
|
15
|
+
};
|
|
16
|
+
Object.assign(Role, elements.reduce((acc, element) => {
|
|
17
|
+
acc[element] = function Role3(props) {
|
|
18
|
+
return createInstance(element, props);
|
|
19
|
+
};
|
|
20
|
+
return acc;
|
|
21
|
+
}, {}));
|
|
22
|
+
export {
|
|
23
|
+
Role,
|
|
24
|
+
elements,
|
|
25
|
+
useRole
|
|
26
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ValidComponent } from "solid-js";
|
|
2
|
+
import type { Options, Props } from "../utils/types.ts";
|
|
3
|
+
declare const TagName = "hr";
|
|
4
|
+
type TagName = typeof TagName;
|
|
5
|
+
/**
|
|
6
|
+
* Returns props to create a `Separator` component.
|
|
7
|
+
* @see https://solid.ariakit.org/components/separator
|
|
8
|
+
* @example
|
|
9
|
+
* ```jsx
|
|
10
|
+
* const props = useSeparator({ orientation: "horizontal" });
|
|
11
|
+
* <Role {...props} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const useSeparator: import("../utils/types.ts").Hook<"hr", SeparatorOptions<"hr">>;
|
|
15
|
+
/**
|
|
16
|
+
* Renders a separator element.
|
|
17
|
+
* @see https://solid.ariakit.org/components/separator
|
|
18
|
+
* @example
|
|
19
|
+
* ```jsx
|
|
20
|
+
* <Separator orientation="horizontal" />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const Separator: (props: SeparatorProps) => import("solid-js").JSX.Element;
|
|
24
|
+
export interface SeparatorOptions<_T extends ValidComponent = TagName> extends Options {
|
|
25
|
+
/**
|
|
26
|
+
* The orientation of the separator.
|
|
27
|
+
* @default "horizontal"
|
|
28
|
+
*/
|
|
29
|
+
orientation?: "horizontal" | "vertical";
|
|
30
|
+
}
|
|
31
|
+
export type SeparatorProps<T extends ValidComponent = TagName> = Props<T, SeparatorOptions<T>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createHook,
|
|
3
|
+
createInstance,
|
|
4
|
+
withOptions
|
|
5
|
+
} from "../__chunks/OKOFCLOZ.js";
|
|
6
|
+
import {
|
|
7
|
+
mergeProps
|
|
8
|
+
} from "../__chunks/QKOHDUFI.js";
|
|
9
|
+
|
|
10
|
+
// src/separator/separator.tsx
|
|
11
|
+
var TagName = "hr";
|
|
12
|
+
var useSeparator = createHook(withOptions({
|
|
13
|
+
orientation: "horizontal"
|
|
14
|
+
}, function useSeparator2(props, options) {
|
|
15
|
+
props = mergeProps({
|
|
16
|
+
role: "separator",
|
|
17
|
+
get "aria-orientation"() {
|
|
18
|
+
return options.orientation;
|
|
19
|
+
}
|
|
20
|
+
}, props);
|
|
21
|
+
return props;
|
|
22
|
+
}));
|
|
23
|
+
var Separator = function Separator2(props) {
|
|
24
|
+
const htmlProps = useSeparator(props);
|
|
25
|
+
return createInstance(TagName, htmlProps);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
Separator,
|
|
29
|
+
useSeparator
|
|
30
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MaybeAccessor } from "@solid-primitives/utils";
|
|
2
|
+
import { type Accessor, type ValidComponent } from "solid-js";
|
|
3
|
+
/**
|
|
4
|
+
* Generates a unique ID.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createId(defaultId?: MaybeAccessor<string | undefined>): Accessor<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the tag name by parsing an element.
|
|
9
|
+
* @example
|
|
10
|
+
* function Component(props) {
|
|
11
|
+
* const [ref, setRef] = createSignal();
|
|
12
|
+
* const tagName = extractTagName(ref, "button"); // () => "div"
|
|
13
|
+
* return <div ref={setRef} {...props} />;
|
|
14
|
+
* }
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractTagName(element?: MaybeAccessor<HTMLElement | undefined>, fallback?: ValidComponent): () => string | undefined;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { AnyObject } from "@ariakit/core/utils/types";
|
|
2
|
+
import { type Accessor, type JSX, type Setter } from "solid-js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a stable accessor. Useful when creating derived accessors that
|
|
5
|
+
* depend on a mutable variable that may change later.
|
|
6
|
+
* @example
|
|
7
|
+
* let value = 0;
|
|
8
|
+
* const accessor = stableAccessor(value, (v) => v + 1);
|
|
9
|
+
* value = 100;
|
|
10
|
+
* accessor(); // 1
|
|
11
|
+
*/
|
|
12
|
+
export declare function stableAccessor<T, U>(value: T, callback: (value: T) => U): () => U;
|
|
13
|
+
type NullablyRequired<T> = {
|
|
14
|
+
[P in keyof T & keyof any]: T[P];
|
|
15
|
+
};
|
|
16
|
+
export type ExtractPropsWithDefaultsExtractedProps<P, D extends Partial<R>, R = NullablyRequired<P>> = {
|
|
17
|
+
-readonly [K in keyof R as Extract<K, keyof D>]: D[K] extends undefined ? R[K] : Exclude<R[K], undefined>;
|
|
18
|
+
};
|
|
19
|
+
export type ExtractPropsWithDefaultsRestProps<P, D extends Partial<P>> = Omit<P, keyof D>;
|
|
20
|
+
export type ExtractPropsWithDefaultsReturn<P, D extends Partial<P>> = [
|
|
21
|
+
ExtractPropsWithDefaultsExtractedProps<P, D>,
|
|
22
|
+
ExtractPropsWithDefaultsRestProps<P, D>
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Extracts props from a props object and applies defaults to them. The
|
|
26
|
+
* return value is a tuple of the extracted props and the rest of the props.
|
|
27
|
+
*
|
|
28
|
+
* To extract a prop without a default, set it to `undefined`.
|
|
29
|
+
* @example
|
|
30
|
+
* const [extractedProps, restProps] = extractPropsWithDefaults(
|
|
31
|
+
* props,
|
|
32
|
+
* { orientation: "horizontal" },
|
|
33
|
+
* );
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractPropsWithDefaults<P extends AnyObject, const D extends Partial<P>>(props: P, defaults: D): ExtractPropsWithDefaultsReturn<P, D>;
|
|
36
|
+
/**
|
|
37
|
+
* A ref object that contains the value getter (`value`) and setter (`set`) as
|
|
38
|
+
* properties for convenience. It also has a `reset` method that can be used to
|
|
39
|
+
* set the value to the initial value that was passed, which is `undefined` by
|
|
40
|
+
* default. The `current` getter can be used to obtain the value without
|
|
41
|
+
* tracking it reactively.
|
|
42
|
+
*
|
|
43
|
+
* Created by the `createRef` function.
|
|
44
|
+
* @example
|
|
45
|
+
* const ref = createRef();
|
|
46
|
+
* createEffect(() => {
|
|
47
|
+
* console.log(ref.value);
|
|
48
|
+
* });
|
|
49
|
+
* ref.set(buttonElement);
|
|
50
|
+
* ref.reset();
|
|
51
|
+
*/
|
|
52
|
+
export type RefStore<T> = {
|
|
53
|
+
/**
|
|
54
|
+
* The current value of the ref. It is a non-reactive getter, wrapped with
|
|
55
|
+
* the `untrack` function.
|
|
56
|
+
*
|
|
57
|
+
* **Important note**: since this is a getter, TypeScript might reflect the
|
|
58
|
+
* wrong type in some cases. For example:
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* const ref = createRef<number>(); // ref.current type: number | undefined
|
|
62
|
+
* ref.set(1);
|
|
63
|
+
* console.log(ref.current); // 1
|
|
64
|
+
* if (ref.current) {
|
|
65
|
+
* // ref.current type: number (narrowed by the if statement)
|
|
66
|
+
* console.log(ref.current); // 1
|
|
67
|
+
* ref.set(undefined);
|
|
68
|
+
* // ref.current type: number (wrong!)
|
|
69
|
+
* console.log(ref.current); // undefined
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
current: T;
|
|
74
|
+
/**
|
|
75
|
+
* The getter function for the ref.
|
|
76
|
+
*/
|
|
77
|
+
get: Accessor<T>;
|
|
78
|
+
/**
|
|
79
|
+
* The setter function for the ref.
|
|
80
|
+
*/
|
|
81
|
+
set: Setter<T>;
|
|
82
|
+
/**
|
|
83
|
+
* Resets the ref to the initial value that was passed, which is `undefined`
|
|
84
|
+
* by default.
|
|
85
|
+
*/
|
|
86
|
+
reset: () => void;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Creates a ref object that contains the value getter (`value`) and setter
|
|
90
|
+
* (`set`) as properties for convenience. It also has a `reset` method that
|
|
91
|
+
* can be used to set the value to the initial value that was passed,
|
|
92
|
+
* which is `undefined` by default. The `current` getter can be used to obtain
|
|
93
|
+
* the value without tracking it reactively.
|
|
94
|
+
* @example
|
|
95
|
+
* ```jsx
|
|
96
|
+
* const ref = createRef();
|
|
97
|
+
* createEffect(() => {
|
|
98
|
+
* console.log(ref.value);
|
|
99
|
+
* });
|
|
100
|
+
* <button ref={ref.set}>Button</button>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function createRef<T>(): RefStore<T | undefined>;
|
|
104
|
+
export declare function createRef<T>(initialValue: T): RefStore<T>;
|
|
105
|
+
/**
|
|
106
|
+
* Merges two sets of props.
|
|
107
|
+
*/
|
|
108
|
+
export declare function mergeProps<T extends JSX.HTMLAttributes<any>>(base: T, overrides: T, skipProps?: Array<keyof T>): T;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AnyObject, EmptyObject } from "@ariakit/core/utils/types";
|
|
2
|
+
import { type ValidComponent } from "solid-js";
|
|
3
|
+
import { type ExtractPropsWithDefaultsExtractedProps, type ExtractPropsWithDefaultsRestProps } from "./reactivity.ts";
|
|
4
|
+
import type { HTMLProps, Hook, Options, Props, WrapInstance, WrapInstanceValue } from "./types.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Solid component instance that supports the `render` and
|
|
7
|
+
* `wrapInstance` props.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createInstance(Component: ValidComponent, props: Props<ValidComponent, Options>): import("solid-js").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Returns props with an additional `wrapInstance` prop.
|
|
12
|
+
*/
|
|
13
|
+
export declare function wrapInstance<P, Q = P & {
|
|
14
|
+
wrapInstance: WrapInstance;
|
|
15
|
+
}>(props: P & {
|
|
16
|
+
wrapInstance?: WrapInstance;
|
|
17
|
+
}, element: WrapInstanceValue): Q;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a component hook that accepts props and returns props so they can be
|
|
20
|
+
* passed to a Solid component.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createHook<T extends ValidComponent, P extends AnyObject = EmptyObject>(useProps: (props: Props<T, P>) => HTMLProps<T, P>): Hook<T, P>;
|
|
23
|
+
/**
|
|
24
|
+
* Splits "option props" from the rest in a component hook. Must be called
|
|
25
|
+
* inside `createHook`.
|
|
26
|
+
*
|
|
27
|
+
* The first argument is an object that defines the props that will be extracted,
|
|
28
|
+
* with their default values. To extract a prop without a default, set it to
|
|
29
|
+
* `undefined`.
|
|
30
|
+
*
|
|
31
|
+
* The hook function must be passed as the second argument, and it will receive
|
|
32
|
+
* the rest of the props and the extracted options.
|
|
33
|
+
* @example
|
|
34
|
+
* ```jsx
|
|
35
|
+
* export const useMyComponent = createHook<TagName, MyComponentOptions>(
|
|
36
|
+
* withOptions(
|
|
37
|
+
* { orientation: "horizontal" },
|
|
38
|
+
* function useMyComponent(props, options) {
|
|
39
|
+
* // ...
|
|
40
|
+
* },
|
|
41
|
+
* ),
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function withOptions<T extends ValidComponent, P extends AnyObject, const D extends Partial<ComputedP>, ComputedP extends Props<T, P>>(defaults: D, useProps: (props: ExtractPropsWithDefaultsRestProps<ComputedP, D>, options: ExtractPropsWithDefaultsExtractedProps<ComputedP, D>) => HTMLProps<T, P>): (props: ComputedP) => HTMLProps<T, P>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { AnyObject, EmptyObject } from "@ariakit/core/utils/types";
|
|
2
|
+
import type { Component, ComponentProps, JSX, ParentProps, ValidComponent } from "solid-js";
|
|
3
|
+
/**
|
|
4
|
+
* A value that can be rendered when passed to the `render` prop or the
|
|
5
|
+
* `wrapInstance` prop.
|
|
6
|
+
*/
|
|
7
|
+
export type RenderValue<P extends AnyObject> = JSX.Element | Component<P>;
|
|
8
|
+
/**
|
|
9
|
+
* A value passed to the `wrapInstance` prop.
|
|
10
|
+
*/
|
|
11
|
+
export type WrapInstanceValue = RenderValue<ParentProps>;
|
|
12
|
+
/**
|
|
13
|
+
* The `wrapInstance` prop.
|
|
14
|
+
*/
|
|
15
|
+
export type WrapInstance = Array<WrapInstanceValue>;
|
|
16
|
+
/**
|
|
17
|
+
* Custom props including the `render` prop.
|
|
18
|
+
*/
|
|
19
|
+
export interface Options {
|
|
20
|
+
wrapInstance?: WrapInstance;
|
|
21
|
+
/**
|
|
22
|
+
* Allows the component to be rendered as a different HTML element or Solid
|
|
23
|
+
* component. The value can be an `As` component instance or a function that
|
|
24
|
+
* takes in the original component props and gives back a Solid component
|
|
25
|
+
* instance with the props merged.
|
|
26
|
+
*
|
|
27
|
+
* Check out the [Composition](https://solid.ariakit.org/guide/composition) guide
|
|
28
|
+
* for more details.
|
|
29
|
+
*/
|
|
30
|
+
render?: RenderValue<JSX.HTMLAttributes<any>>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* HTML props based on the element type, excluding custom props.
|
|
34
|
+
* @template T The element type.
|
|
35
|
+
* @template P Custom props.
|
|
36
|
+
* @example
|
|
37
|
+
* type ButtonHTMLProps = HTMLProps<"button", { custom?: boolean }>;
|
|
38
|
+
*/
|
|
39
|
+
export type HTMLProps<T extends ValidComponent, P extends AnyObject = EmptyObject> = Omit<ComponentProps<T>, keyof P> & {
|
|
40
|
+
[index: `data-${string}`]: unknown;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Props based on the element type, including custom props.
|
|
44
|
+
* @template T The element type.
|
|
45
|
+
* @template P Custom props.
|
|
46
|
+
*/
|
|
47
|
+
export type Props<T extends ValidComponent, P extends AnyObject = EmptyObject> = P & HTMLProps<T, P>;
|
|
48
|
+
/**
|
|
49
|
+
* A component hook that supports the `render` prop and returns HTML props based
|
|
50
|
+
* on the element type.
|
|
51
|
+
* @template T The element type.
|
|
52
|
+
* @template P Custom props.
|
|
53
|
+
* @example
|
|
54
|
+
* type UseButton = Hook<"button", { custom?: boolean }>;
|
|
55
|
+
*/
|
|
56
|
+
export type Hook<T extends ValidComponent, P extends AnyObject = EmptyObject> = <ElementType extends ValidComponent = T>(props?: Props<ElementType, P>) => HTMLProps<ElementType, P>;
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ValidComponent } from "solid-js";
|
|
2
|
+
import type { Options, Props } from "../utils/types.ts";
|
|
3
|
+
declare const TagName = "span";
|
|
4
|
+
type TagName = typeof TagName;
|
|
5
|
+
/**
|
|
6
|
+
* Returns props to create a `VisuallyHidden` component. When applying the props
|
|
7
|
+
* returned by this hook to a component, the component will be visually hidden,
|
|
8
|
+
* but still accessible to screen readers.
|
|
9
|
+
* @see https://solid.ariakit.org/components/visually-hidden
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
* const props = useVisuallyHidden();
|
|
13
|
+
* <a href="#">
|
|
14
|
+
* Learn more<Role {...props}> about the Solar System</Role>.
|
|
15
|
+
* </a>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const useVisuallyHidden: import("../utils/types.ts").Hook<"span", VisuallyHiddenOptions<"span">>;
|
|
19
|
+
/**
|
|
20
|
+
* Renders an element that's visually hidden, but still accessible to screen
|
|
21
|
+
* readers.
|
|
22
|
+
* @see https://solid.ariakit.org/components/visually-hidden
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx
|
|
25
|
+
* <a href="#">
|
|
26
|
+
* Learn more<VisuallyHidden> about the Solar System</VisuallyHidden>.
|
|
27
|
+
* </a>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function VisuallyHidden(props: VisuallyHiddenProps): import("solid-js").JSX.Element;
|
|
31
|
+
export interface VisuallyHiddenOptions<_T extends ValidComponent = TagName> extends Options {
|
|
32
|
+
}
|
|
33
|
+
export type VisuallyHiddenProps = Props<TagName, VisuallyHiddenOptions>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ariakit/solid-core/focus-trap/focus-trap-region",
|
|
3
|
+
"private": true,
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"main": "../../cjs/focus-trap/focus-trap-region.cjs",
|
|
6
|
+
"module": "../../esm/focus-trap/focus-trap-region.js",
|
|
7
|
+
"types": "../../cjs/focus-trap/focus-trap-region.d.ts"
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ariakit/solid-core/group/group-label-context",
|
|
3
|
+
"private": true,
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"main": "../../cjs/group/group-label-context.cjs",
|
|
6
|
+
"module": "../../esm/group/group-label-context.js",
|
|
7
|
+
"types": "../../cjs/group/group-label-context.d.ts"
|
|
8
|
+
}
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
package/license
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Diego Haz, Dani Guardiola
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|