@react-hive/honey-style 6.2.0 → 7.0.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/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +54 -0
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styled.d.ts +68 -7
- package/package.json +1 -1
package/dist/index.dev.cjs
CHANGED
|
@@ -1921,6 +1921,60 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1921
1921
|
|
|
1922
1922
|
|
|
1923
1923
|
|
|
1924
|
+
/**
|
|
1925
|
+
* Creates a Honey-styled component from an HTML element or React component.
|
|
1926
|
+
*
|
|
1927
|
+
* The returned function accepts a tagged template literal with static CSS and dynamic
|
|
1928
|
+
* interpolations. Interpolations receive the resolved styled context, including the
|
|
1929
|
+
* current theme, default props, and props passed to the component.
|
|
1930
|
+
*
|
|
1931
|
+
* The generated component supports the polymorphic `as` prop, so the rendered element
|
|
1932
|
+
* can be changed while preserving the native props of the selected element.
|
|
1933
|
+
*
|
|
1934
|
+
* Default props can be provided as either an object or a resolver function. Props passed
|
|
1935
|
+
* directly to the rendered styled component override default props.
|
|
1936
|
+
*
|
|
1937
|
+
* @template TargetProps - The custom props available to style interpolations.
|
|
1938
|
+
* @template Target - The base HTML element or React component used for rendering.
|
|
1939
|
+
* @template OverrideTarget - The default polymorphic element used for public prop inference.
|
|
1940
|
+
*
|
|
1941
|
+
* @param target - The base HTML element or React component to style.
|
|
1942
|
+
* @param defaultProps - Optional default props or a function that resolves default props from context.
|
|
1943
|
+
* @param options - Optional styled component options.
|
|
1944
|
+
*
|
|
1945
|
+
* @returns A tagged template function that creates a styled component.
|
|
1946
|
+
*
|
|
1947
|
+
* @example
|
|
1948
|
+
* ```tsx
|
|
1949
|
+
* const Box = styled('div')`
|
|
1950
|
+
* color: red;
|
|
1951
|
+
* `;
|
|
1952
|
+
*
|
|
1953
|
+
* <Box data-testid="box">Content</Box>
|
|
1954
|
+
* ```
|
|
1955
|
+
*
|
|
1956
|
+
* @example
|
|
1957
|
+
* ```tsx
|
|
1958
|
+
* const Button = styled<{ variant: 'primary' | 'secondary' }, 'button'>('button')`
|
|
1959
|
+
* ${({ variant }) => css`
|
|
1960
|
+
* color: ${variant === 'primary' ? 'white' : 'black'};
|
|
1961
|
+
* `}
|
|
1962
|
+
* `;
|
|
1963
|
+
*
|
|
1964
|
+
* <Button variant="primary" type="button" />
|
|
1965
|
+
* ```
|
|
1966
|
+
*
|
|
1967
|
+
* @example
|
|
1968
|
+
* ```tsx
|
|
1969
|
+
* const LinkBox = styled('div')`
|
|
1970
|
+
* color: blue;
|
|
1971
|
+
* `;
|
|
1972
|
+
*
|
|
1973
|
+
* <LinkBox as="a" href="https://example.com">
|
|
1974
|
+
* Link
|
|
1975
|
+
* </LinkBox>
|
|
1976
|
+
* ```
|
|
1977
|
+
*/
|
|
1924
1978
|
const styled = (target, defaultProps, { omitProps } = {}) => {
|
|
1925
1979
|
return (strings, ...interpolations) => {
|
|
1926
1980
|
const componentId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.generateId)('hsc');
|