@ark-ui/solid 3.0.0-5 → 3.0.0-6
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/cjs/index.js +14 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +14 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/source/components/clipboard/clipboard-indicator.jsx +0 -1
- package/dist/source/components/factory.jsx +8 -11
- package/dist/source/components/presence/index.js +4 -5
- package/dist/source/providers/environment/{environment.jsx → environment-provider.jsx} +4 -4
- package/dist/source/providers/environment/index.js +1 -1
- package/dist/source/providers/environment/use-environment-context.js +1 -1
- package/dist/types/components/checkbox/checkbox-hidden-input.d.ts +1 -1
- package/dist/types/components/factory.d.ts +2 -3
- package/dist/types/components/presence/index.d.ts +4 -6
- package/dist/types/providers/environment/{environment.d.ts → environment-provider.d.ts} +2 -2
- package/dist/types/providers/environment/index.d.ts +1 -1
- package/dist/types/providers/environment/use-environment-context.d.ts +4 -1
- package/dist/types/providers/locale/locale-provider.d.ts +2 -1
- package/package.json +3 -3
|
@@ -7,7 +7,6 @@ export const ClipboardIndicator = (props) => {
|
|
|
7
7
|
const [indicatorProps, localProps] = createSplitProps()(props, ['copied']);
|
|
8
8
|
const api = useClipboardContext();
|
|
9
9
|
const mergedProps = mergeProps(api().getIndicatorProps({ copied: api().copied }), localProps);
|
|
10
|
-
// @ts-expect-error TODO fix
|
|
11
10
|
const getChildren = children(() => localProps.children);
|
|
12
11
|
return (<ark.div {...mergedProps}>
|
|
13
12
|
<Show when={api().copied} fallback={getChildren()}>
|
|
@@ -3,20 +3,17 @@ import { splitProps } from 'solid-js';
|
|
|
3
3
|
import { Dynamic } from 'solid-js/web';
|
|
4
4
|
const withAsProp = (Component) => {
|
|
5
5
|
const ArkComponent = (props) => {
|
|
6
|
-
const [localProps,
|
|
6
|
+
const [localProps, parentProps] = splitProps(props, ['asChild']);
|
|
7
7
|
if (localProps.asChild) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const fn = (userProps) => {
|
|
13
|
-
const [, restProps] = splitProps(otherProps, ['children', 'ref']);
|
|
14
|
-
return { ref: otherProps.ref, ...mergeProps(restProps, userProps) };
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
const propsFn = (userProps) => {
|
|
10
|
+
const [, restProps] = splitProps(parentProps, ['ref']);
|
|
11
|
+
return { ref: parentProps.ref, ...mergeProps(restProps, userProps) };
|
|
15
12
|
};
|
|
16
|
-
return
|
|
13
|
+
return localProps.asChild(propsFn);
|
|
17
14
|
}
|
|
18
|
-
//
|
|
19
|
-
return <Dynamic component={Component} {...
|
|
15
|
+
// @ts-expect-error
|
|
16
|
+
return <Dynamic component={Component} {...parentProps}/>;
|
|
20
17
|
};
|
|
21
18
|
return ArkComponent;
|
|
22
19
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { Presence, PresenceProvider, splitPresenceProps, usePresence, usePresenceContext };
|
|
1
|
+
export { Presence } from './presence';
|
|
2
|
+
export { splitPresenceProps } from './split-presence-props';
|
|
3
|
+
export { usePresence } from './use-presence';
|
|
4
|
+
export { PresenceProvider, usePresenceContext, } from './use-presence-context';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDocument, getWindow } from '@zag-js/dom-query';
|
|
2
2
|
import { Show, createMemo, createSignal } from 'solid-js';
|
|
3
3
|
import { runIfFn } from '../../utils/run-if-fn';
|
|
4
|
-
import {
|
|
5
|
-
export const
|
|
4
|
+
import { EnvironmentContextProvider } from './use-environment-context';
|
|
5
|
+
export const EnvironmentProvider = (props) => {
|
|
6
6
|
const [spanRef, setSpanRef] = createSignal();
|
|
7
7
|
const getRootNode = () => runIfFn(props.value) ?? spanRef()?.ownerDocument ?? document;
|
|
8
8
|
const environment = createMemo(() => ({
|
|
@@ -10,10 +10,10 @@ export const Environment = (props) => {
|
|
|
10
10
|
getDocument: () => getDocument(getRootNode()),
|
|
11
11
|
getWindow: () => getWindow(getRootNode()),
|
|
12
12
|
}));
|
|
13
|
-
return (<
|
|
13
|
+
return (<EnvironmentContextProvider value={environment}>
|
|
14
14
|
{props.children}
|
|
15
15
|
<Show when={!props.value}>
|
|
16
16
|
<span hidden ref={setSpanRef}/>
|
|
17
17
|
</Show>
|
|
18
|
-
</
|
|
18
|
+
</EnvironmentContextProvider>);
|
|
19
19
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { EnvironmentProvider } from './environment-provider';
|
|
2
2
|
export { useEnvironmentContext, } from './use-environment-context';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from '../../utils/create-context';
|
|
2
|
-
export const [
|
|
2
|
+
export const [EnvironmentContextProvider, useEnvironmentContext] = createContext({
|
|
3
3
|
hookName: 'useEnvironmentContext',
|
|
4
4
|
providerName: '<EnvironmentProvider />',
|
|
5
5
|
strict: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type HTMLArkProps } from '../factory';
|
|
2
|
-
export interface CheckboxHiddenInputProps extends HTMLArkProps<'
|
|
2
|
+
export interface CheckboxHiddenInputProps extends HTMLArkProps<'input'> {
|
|
3
3
|
}
|
|
4
4
|
export declare const CheckboxHiddenInput: (props: CheckboxHiddenInputProps) => import("solid-js").JSX.Element;
|
|
@@ -4,10 +4,9 @@ type ElementType = keyof JSX.IntrinsicElements;
|
|
|
4
4
|
type JsxElements = {
|
|
5
5
|
[E in ElementType]: ArkComponent<E>;
|
|
6
6
|
};
|
|
7
|
-
type
|
|
7
|
+
type ParentProps<T extends ElementType> = (userProps?: JSX.IntrinsicElements[T]) => JSX.HTMLAttributes<any>;
|
|
8
8
|
type PolymorphicProps<T extends ElementType> = {
|
|
9
|
-
asChild?:
|
|
10
|
-
children?: JSX.Element | ((props: PropsFn<T>) => JSX.Element);
|
|
9
|
+
asChild?: (props: ParentProps<T>) => JSX.Element;
|
|
11
10
|
};
|
|
12
11
|
type HTMLArkProps<E extends ElementType> = Assign<ComponentProps<E>, PolymorphicProps<E>>;
|
|
13
12
|
type ArkComponent<E extends ElementType> = (props: HTMLArkProps<E>) => JSX.Element;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { Presence, PresenceProvider, splitPresenceProps, usePresence, usePresenceContext };
|
|
6
|
-
export type { PresenceProps, UsePresenceContext, UsePresenceProps, UsePresenceReturn };
|
|
1
|
+
export { Presence, type PresenceProps } from './presence';
|
|
2
|
+
export { splitPresenceProps } from './split-presence-props';
|
|
3
|
+
export { type UsePresenceProps, type UsePresenceReturn, usePresence } from './use-presence';
|
|
4
|
+
export { PresenceProvider, type UsePresenceContext, usePresenceContext, } from './use-presence-context';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import { type RootNode } from './use-environment-context';
|
|
3
|
-
export interface
|
|
3
|
+
export interface EnvironmentProviderProps {
|
|
4
4
|
children?: JSX.Element;
|
|
5
5
|
value?: RootNode | (() => RootNode);
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const EnvironmentProvider: (props: EnvironmentProviderProps) => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { EnvironmentProvider, type EnvironmentProviderProps } from './environment-provider';
|
|
2
2
|
export { useEnvironmentContext, type EnvironmentContext, type RootNode, } from './use-environment-context';
|
|
@@ -4,15 +4,18 @@ export interface EnvironmentContext {
|
|
|
4
4
|
/**
|
|
5
5
|
* The root node of the application.
|
|
6
6
|
* This is used to determine the window and document objects.
|
|
7
|
+
* @default document
|
|
7
8
|
*/
|
|
8
9
|
getRootNode(): RootNode;
|
|
9
10
|
/**
|
|
10
11
|
* The document context for the root node.
|
|
12
|
+
* @default document
|
|
11
13
|
*/
|
|
12
14
|
getDocument(): Document;
|
|
13
15
|
/**
|
|
14
16
|
* The window context for the root node.
|
|
17
|
+
* @default window
|
|
15
18
|
*/
|
|
16
19
|
getWindow(): Window & typeof globalThis;
|
|
17
20
|
}
|
|
18
|
-
export declare const
|
|
21
|
+
export declare const EnvironmentContextProvider: import("solid-js").ContextProviderComponent<Accessor<EnvironmentContext>>, useEnvironmentContext: () => Accessor<EnvironmentContext>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/solid",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-6",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for Solid, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accordion",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"sideEffects": false,
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@ark-ui/anatomy": "3.
|
|
83
|
+
"@ark-ui/anatomy": "3.1.0",
|
|
84
84
|
"@zag-js/accordion": "0.50.0",
|
|
85
85
|
"@zag-js/avatar": "0.50.0",
|
|
86
86
|
"@zag-js/carousel": "0.50.0",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"devDependencies": {
|
|
123
123
|
"@biomejs/biome": "1.7.3",
|
|
124
124
|
"@release-it/keep-a-changelog": "5.0.0",
|
|
125
|
-
"@solidjs/testing-library": "0.8.
|
|
125
|
+
"@solidjs/testing-library": "0.8.8",
|
|
126
126
|
"@storybook/addon-a11y": "8.1.1",
|
|
127
127
|
"@storybook/addon-essentials": "8.1.1",
|
|
128
128
|
"@testing-library/dom": "10.1.0",
|