@react-hive/honey-style 6.1.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.
@@ -1116,14 +1116,40 @@ const createSpacingTransformer = ({ theme }) => {
1116
1116
  __webpack_require__.r(__webpack_exports__);
1117
1117
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1118
1118
  /* harmony export */ createCssRule: () => (/* binding */ createCssRule),
1119
- /* harmony export */ css: () => (/* binding */ css)
1119
+ /* harmony export */ css: () => (/* binding */ css),
1120
+ /* harmony export */ isCssColorProperty: () => (/* binding */ isCssColorProperty),
1121
+ /* harmony export */ isCssSpacingProperty: () => (/* binding */ isCssSpacingProperty)
1120
1122
  /* harmony export */ });
1121
1123
  /* harmony import */ var _react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @react-hive/honey-utils */ "./node_modules/.pnpm/@react-hive+honey-utils@4.0.0/node_modules/@react-hive/honey-utils/dist/index.mjs");
1122
1124
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants */ "./src/constants.ts");
1123
1125
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./src/utils.ts");
1126
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./src/css/constants.ts");
1124
1127
 
1125
1128
 
1126
1129
 
1130
+
1131
+ /**
1132
+ * Checks whether a CSS property is spacing-related.
1133
+ *
1134
+ * Spacing properties include margins, paddings, positional offsets,
1135
+ * and layout gaps, such as `margin`, `paddingLeft`, `top`, and `gap`.
1136
+ *
1137
+ * @param propertyName - The CSS property name to check.
1138
+ *
1139
+ * @returns Returns true if the property is spacing-related.
1140
+ */
1141
+ const isCssSpacingProperty = (propertyName) => _constants__WEBPACK_IMPORTED_MODULE_3__.CSS_SPACING_PROPERTIES.includes(propertyName);
1142
+ /**
1143
+ * Checks whether a CSS property is color-related.
1144
+ *
1145
+ * Color properties include properties that directly define text, background,
1146
+ * border, outline, decoration, shadow, or SVG colors.
1147
+ *
1148
+ * @param propertyName - The CSS property name to check.
1149
+ *
1150
+ * @returns Returns true if the property is color-related.
1151
+ */
1152
+ const isCssColorProperty = (propertyName) => _constants__WEBPACK_IMPORTED_MODULE_3__.CSS_COLOR_PROPERTIES.includes(propertyName);
1127
1153
  const resolveCssInterpolation = (value, context) => {
1128
1154
  if (value === false || (0,_react_hive_honey_utils__WEBPACK_IMPORTED_MODULE_0__.isNilOrEmptyString)(value)) {
1129
1155
  return '';
@@ -1241,6 +1267,8 @@ __webpack_require__.r(__webpack_exports__);
1241
1267
  /* harmony export */ CSS_SPACING_PROPERTIES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_1__.CSS_SPACING_PROPERTIES),
1242
1268
  /* harmony export */ createCssRule: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_3__.createCssRule),
1243
1269
  /* harmony export */ css: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_3__.css),
1270
+ /* harmony export */ isCssColorProperty: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_3__.isCssColorProperty),
1271
+ /* harmony export */ isCssSpacingProperty: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_3__.isCssSpacingProperty),
1244
1272
  /* harmony export */ mediaQuery: () => (/* reexport safe */ _at_rules__WEBPACK_IMPORTED_MODULE_4__.mediaQuery),
1245
1273
  /* harmony export */ processCss: () => (/* reexport safe */ _process_css__WEBPACK_IMPORTED_MODULE_2__.processCss)
1246
1274
  /* harmony export */ });
@@ -1893,6 +1921,60 @@ __webpack_require__.r(__webpack_exports__);
1893
1921
 
1894
1922
 
1895
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
+ */
1896
1978
  const styled = (target, defaultProps, { omitProps } = {}) => {
1897
1979
  return (strings, ...interpolations) => {
1898
1980
  const componentId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.generateId)('hsc');
@@ -2438,6 +2520,8 @@ __webpack_require__.r(__webpack_exports__);
2438
2520
  /* harmony export */ css: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.css),
2439
2521
  /* harmony export */ filterNonHtmlAttrs: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.filterNonHtmlAttrs),
2440
2522
  /* harmony export */ generateId: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.generateId),
2523
+ /* harmony export */ isCssColorProperty: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.isCssColorProperty),
2524
+ /* harmony export */ isCssSpacingProperty: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.isCssSpacingProperty),
2441
2525
  /* harmony export */ isStyledComponent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isStyledComponent),
2442
2526
  /* harmony export */ isThemeColorValue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_8__.isThemeColorValue),
2443
2527
  /* harmony export */ mediaQuery: () => (/* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_5__.mediaQuery),