@sk-web-gui/utils
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -0,1 +1,2 @@ | ||
/// <reference types="react" /> | ||
export type Dict<T = any> = Record<string, T>; | ||
@@ -14,1 +15,36 @@ export type CSSMap = Dict<{ | ||
}; | ||
export interface DefaultProps { | ||
className?: string; | ||
} | ||
export type PropsOf<C extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>> = JSX.LibraryManagedAttributes<C, React.ComponentPropsWithoutRef<C>>; | ||
type AsProp<C extends React.ElementType> = { | ||
/** | ||
* An override of the default HTML tag. | ||
* Can also be another React component. | ||
*/ | ||
as?: C; | ||
}; | ||
/** | ||
* Allows for extending a set of props (`ExtendedProps`) by an overriding set of props | ||
* (`OverrideProps`), ensuring that any duplicates are overridden by the overriding | ||
* set of props. | ||
*/ | ||
export type ExtendableProps<ExtendedProps = object, OverrideProps = object> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>; | ||
/** | ||
* Allows for inheriting the props from the specified element type so that | ||
* props like children, className & style work, as well as element-specific | ||
* attributes like aria roles. The component (`C`) must be passed in. | ||
*/ | ||
export type InheritableElementProps<C extends React.ElementType, Props = object> = ExtendableProps<PropsOf<C>, Props>; | ||
/** | ||
* A more sophisticated version of `InheritableElementProps` where | ||
* the passed in `as` prop will determine which props can be included | ||
*/ | ||
export type PolymorphicComponentProps<C extends React.ElementType, Props = object> = InheritableElementProps<C, Props & AsProp<C>>; | ||
/** * Utility type to extract the `ref` prop from a polymorphic component */ | ||
export type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref']; | ||
/** * A wrapper of `PolymorphicComponentProps` that also includes the `ref` * prop for the polymorphic component */ | ||
export type PolymorphicComponentPropsWithRef<C extends React.ElementType, Props = object> = PolymorphicComponentProps<C, Props> & { | ||
ref?: PolymorphicRef<C>; | ||
}; | ||
export {}; |
{ | ||
"name": "@sk-web-gui/utils", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"sideEffects": false, | ||
@@ -37,13 +37,13 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/color-string": "^1.5.0", | ||
"react": "^17.0.2" | ||
"@types/color-string": "^1.5.2", | ||
"react": "^18.2.0" | ||
}, | ||
"dependencies": { | ||
"clsx": "^1.1.1", | ||
"color-string": "^1.5.5" | ||
"clsx": "^1.2.1", | ||
"color-string": "^1.9.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.8.6" | ||
"react": ">=18.2.0" | ||
}, | ||
"gitHead": "3a72018bb2de73c6e1db1a461cbed02b37e4827e" | ||
"gitHead": "31d25c7a23df03a321f83ac5bf489e23a97c0a86" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
71356
624
Updatedclsx@^1.2.1
Updatedcolor-string@^1.9.1