@zag-js/types
Advanced tools
Comparing version 0.0.0-dev-20220617101836 to 0.0.0-dev-20220628115342
@@ -1,2 +0,2 @@ | ||
import type * as React from "react"; | ||
import type { JSX } from "./jsx"; | ||
export declare type Direction = "ltr" | "rtl"; | ||
@@ -36,6 +36,4 @@ export declare type Orientation = "horizontal" | "vertical"; | ||
}; | ||
export declare type Style = React.CSSProperties & { | ||
[prop: string]: string | number | undefined; | ||
}; | ||
export declare type Style = JSX.CSSProperties; | ||
export * from "./prop-types"; | ||
export * from "./controls"; | ||
export type { JSX }; |
@@ -23,5 +23,3 @@ "use strict"; | ||
__export(src_exports, { | ||
createNormalizer: () => createNormalizer, | ||
defineControls: () => defineControls, | ||
normalizeProp: () => normalizeProp | ||
createNormalizer: () => createNormalizer | ||
}); | ||
@@ -38,7 +36,1 @@ module.exports = __toCommonJS(src_exports); | ||
} | ||
var normalizeProp = createNormalizer((v) => v); | ||
// src/controls.ts | ||
function defineControls(config) { | ||
return config; | ||
} |
@@ -1,18 +0,5 @@ | ||
import type * as React from "react"; | ||
import type { JSX } from "./jsx"; | ||
declare type Dict<T = any> = Record<string, T>; | ||
declare type Booleanish = boolean | "true" | "false"; | ||
declare type Omit<T, K extends keyof T> = { | ||
[P in Exclude<keyof T, K>]?: T[P]; | ||
}; | ||
declare type WithStyle<T extends { | ||
style?: any; | ||
}> = Omit<T, "style"> & { | ||
style?: T["style"] & { | ||
[prop: string]: string | number | undefined; | ||
}; | ||
}; | ||
declare type DataAttr = { | ||
"data-uid"?: string; | ||
"data-name"?: string; | ||
"data-ownedby"?: string; | ||
"data-selected"?: Booleanish; | ||
@@ -28,43 +15,31 @@ "data-expanded"?: Booleanish; | ||
"data-disabled"?: Booleanish; | ||
"data-open"?: Booleanish; | ||
"data-checked"?: Booleanish; | ||
"data-pressed"?: Booleanish; | ||
"data-complete"?: Booleanish; | ||
"data-empty"?: Booleanish; | ||
"data-placeholder-shown"?: Booleanish; | ||
"data-half"?: Booleanish; | ||
"data-uid"?: string; | ||
"data-name"?: string; | ||
"data-ownedby"?: string; | ||
"data-type"?: string; | ||
"data-value"?: string | number; | ||
"data-valuetext"?: string; | ||
"data-open"?: Booleanish; | ||
"data-placement"?: string; | ||
"data-orientation"?: "horizontal" | "vertical"; | ||
"data-controls"?: string; | ||
"data-part"?: string; | ||
"data-label"?: string; | ||
"data-checked"?: Booleanish; | ||
"data-pressed"?: Booleanish; | ||
"data-state"?: string | null; | ||
"data-half"?: Booleanish; | ||
"data-value"?: string | number; | ||
"data-orientation"?: "horizontal" | "vertical"; | ||
"data-count"?: number; | ||
"data-controls"?: string; | ||
"data-part"?: string; | ||
"data-index"?: number; | ||
"data-complete"?: Booleanish; | ||
"data-empty"?: Booleanish; | ||
"data-placeholder-shown"?: Booleanish; | ||
}; | ||
declare type JSXElementAttributes = DataAttr & React.HTMLAttributes<HTMLElement>; | ||
declare type JSXButtonAttributes = DataAttr & React.ButtonHTMLAttributes<HTMLButtonElement>; | ||
declare type JSXInputAttributes = DataAttr & React.InputHTMLAttributes<HTMLInputElement>; | ||
declare type JSXLabelAttributes = DataAttr & React.LabelHTMLAttributes<HTMLLabelElement>; | ||
declare type JSXOutputAttributes = DataAttr & React.OutputHTMLAttributes<HTMLOutputElement>; | ||
export declare type PropTypes = Record<"button" | "label" | "input" | "output" | "element", Dict>; | ||
export declare type ReactPropTypes = { | ||
button: JSXButtonAttributes; | ||
label: JSXLabelAttributes; | ||
input: JSXInputAttributes; | ||
output: JSXOutputAttributes; | ||
element: JSXElementAttributes; | ||
export declare type NormalizeProps<T extends PropTypes> = { | ||
[K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K]; | ||
} & { | ||
element(props: DataAttr & JSX.HTMLAttributes<HTMLElement>): T["element"]; | ||
}; | ||
export declare type NormalizeProps = { | ||
button<T extends PropTypes>(props: WithStyle<JSXButtonAttributes>): T["button"]; | ||
label<T extends PropTypes>(props: WithStyle<JSXLabelAttributes>): T["label"]; | ||
input<T extends PropTypes>(props: WithStyle<JSXInputAttributes>): T["input"]; | ||
output<T extends PropTypes>(props: WithStyle<JSXOutputAttributes>): T["output"]; | ||
element<T extends PropTypes>(props: WithStyle<JSXElementAttributes>): T["element"]; | ||
}; | ||
export declare function createNormalizer(fn: (props: Dict) => Dict): NormalizeProps; | ||
export declare const normalizeProp: NormalizeProps; | ||
export declare function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T>; | ||
export {}; |
{ | ||
"name": "@zag-js/types", | ||
"version": "0.0.0-dev-20220617101836", | ||
"version": "0.0.0-dev-20220628115342", | ||
"keywords": [ | ||
@@ -26,2 +26,5 @@ "js", | ||
}, | ||
"dependencies": { | ||
"csstype": "3.1.0" | ||
}, | ||
"scripts": { | ||
@@ -36,2 +39,2 @@ "build:fast": "zag build", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
4929
1
5
126
+ Addedcsstype@3.1.0
+ Addedcsstype@3.1.0(transitive)