Skip to content

Commit

Permalink
chore(release): 1.0.0-alpha.2
Browse files Browse the repository at this point in the history
# [1.0.0-alpha.2](v1.0.0-alpha.1...v1.0.0-alpha.2) (2021-10-29)

### Bug Fixes

* fix broken tests ([0a015eb](0a015eb))

### Features

* require a styles instance as the first argument for hookks ([254bf73](254bf73))

### BREAKING CHANGES

* Requires that the user provide a style instance as the first argument for hooks.
Also removes `DashProvider` and `useDash` utilities.
  • Loading branch information
semantic-release-bot committed Oct 29, 2021
1 parent 0a015eb commit a612eb6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 47 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [1.0.0-alpha.2](https://github.com/dash-ui/react/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2021-10-29)

### Bug Fixes

- fix broken tests ([0a015eb](https://github.com/dash-ui/react/commit/0a015ebe934b3d4f3b2aa1df916acdd45dd1c892))

### Features

- require a styles instance as the first argument for hookks ([254bf73](https://github.com/dash-ui/react/commit/254bf73790e74c43b6a882e283cd356bb9c5c163))

### BREAKING CHANGES

- Requires that the user provide a style instance as the first argument for hooks.
Also removes `DashProvider` and `useDash` utilities.

# [1.0.0-alpha.1](https://github.com/dash-ui/react/compare/v0.9.1...v1.0.0-alpha.1) (2021-10-29)

### Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dash-ui/react",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.2",
"description": "React components and hooks for dash-ui",
"license": "MIT",
"author": "Jared Lunde <[email protected]> (https://jaredLunde.com)",
Expand Down
90 changes: 44 additions & 46 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,39 @@ import type {
Styles,
} from "@dash-ui/styles";
import * as React from "react";
/**
* A hook for consuming dash context from the provider
*/
export declare function useDash(): DashContextValue;
export interface DashContextValue {
/**
* A `styles()` instance
*/
styles: Styles;
}
/**
* The Dash context provider. Use this to control the `styles()` instance
* your app is using.
*
* @param root0
* @param root0.styles
* @param root0.children
*/
export declare function DashProvider({
styles,
children,
}: DashProviderProps): JSX.Element;
export interface DashProviderProps {
/**
* A `styles()` instance. Defaults to the default instance in `@dash-ui/styles`
*/
styles?: Styles;
children?: React.ReactNode;
}
/**
* A component for creating an inline `<style>` tag that is unmounted when
* the component unmounts.
*
* @param root0
* @param root0.css
* @param root0.styles
*/
export declare function Inline({ css: input }: InlineProps): JSX.Element | null;
export interface InlineProps {
export declare function Inline<
Tokens extends DashTokens,
Themes extends DashThemes
>({ styles, css: input }: InlineProps<Tokens, Themes>): JSX.Element | null;
export interface InlineProps<
Tokens extends DashTokens,
Themes extends DashThemes
> {
/**
* A Dash `styles` instance
*/
styles: Styles<Tokens, Themes>;
/**
* The CSS you want to inline in the DOM.
*
* @example
* const Component => <Inline css={({color}) => `html { color: ${color.text}; }`}/>
*/
css: string | StyleCallback | StyleObject;
css: string | StyleCallback<Tokens, Themes> | StyleObject;
}
/**
* A hook for inserting transient global styles into the DOM. These styles
* will be injected when the hook mounts and flushed when the hook unmounts.
*
* @param styles - A Dash `styles` instance
* @param value - Global CSS to inject into the DOM and flush when the hook unmounts
* @param deps - A dependency array that will force the hook to re-insert global styles
* @example
Expand All @@ -73,57 +56,72 @@ export interface InlineProps {
* )
* }
*/
export declare function useGlobal(
value: string | StyleCallback | StyleObject | null | 0 | undefined | false,
export declare function useGlobal<
Tokens extends DashTokens,
Themes extends DashThemes
>(
styles: Styles<Tokens, Themes>,
value:
| string
| StyleCallback<Tokens, Themes>
| StyleObject
| null
| 0
| undefined
| false,
deps?: React.DependencyList
): void;
/**
* A hook for inserting transient CSS tokens into the DOM. These tokens
* will be injected when the hook mounts and flushed when the hook unmounts.
*
* @param styles - A Dash `styles` instance
* @param value - CSS tokens to inject into the DOM and flush when the hook unmounts
* @param deps - A dependency array that will force the hook to re-insert tokens
* @example
* const Component = () => {
* const [userFontSize, setUserFontSize] = React.useState('100%')
*
* useTokens(
* styles,
* {fontSize: userFontSize},
* [userFontSize]
* )
* }
*/
export declare function useTokens(
value: DeepPartial<DashTokens> | Falsy,
export declare function useTokens<
Tokens extends DashTokens,
Themes extends DashThemes
>(
styles: Styles<Tokens, Themes>,
value: Parameters<Styles<Tokens, Themes>["insertTokens"]>[0] | Falsy,
deps?: React.DependencyList
): void;
/**
* A hook for inserting transient CSS theme tokens into the DOM. These tokens
* will be injected when the hook mounts and flushed when the hook unmounts.
*
* @param styles - A Dash `styles` instance
* @param value - Themes to inject into the DOM and flush when the hook unmounts
* @param deps - A dependency array that will force the hook to re-insert themes
* @example
* const Component = () => {
* const [color, setColor] = React.useState('aliceblue')
*
* useThemes(
* styles,
* {
* dark: {color}
* },
* [color]
* )
* }
*/
export declare function useThemes(
value: DeepPartial<DashThemes> | Falsy,
export declare function useThemes<
Tokens extends DashTokens,
Themes extends DashThemes
>(
styles: Styles<Tokens, Themes>,
value: Parameters<Styles<Tokens, Themes>["insertThemes"]>[0] | Falsy,
deps?: React.DependencyList
): void;
declare type DeepPartial<T> = T extends (...args: any[]) => any
? T
: T extends Record<string, any>
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;
export {};

0 comments on commit a612eb6

Please sign in to comment.