@kbach/react 0.3.0 → 0.3.1

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.d.mts CHANGED
@@ -149,16 +149,12 @@ interface ColorScale {
149
149
  }
150
150
  interface ColorsAPI {
151
151
  /**
152
- * Apply opacity to any CSS color string (hex, rgb, rgba).
153
- * `colors.alpha('#3b82f6', 50)` → `'rgba(59,130,246,0.5)'`
154
- * `colors.alpha('rgb(0,0,0)', 10)` → `'rgba(0,0,0,0.1)'`
155
- */
156
- alpha(color: string, opacity: number): string;
157
- /**
158
- * Index access returns a ColorScale for palette families or a string for flat colors.
159
- * Supports shade numbers (`colors.blue[6]`), slash opacity (`colors.blue['6/50']`),
160
- * and flat colors with opacity (`colors['white/20']`).
152
+ * Pass any CSS color through, optionally applying an opacity (0–100).
153
+ * - `colors.alpha('#3b82f6', 50)` → `'rgba(59,130,246,0.5)'`
154
+ * - `colors.alpha('rgb(0,0,0)', 10)` → `'rgba(0,0,0,0.1)'`
155
+ * - `colors.alpha('rgba(0,0,0,0.5)')` → `'rgba(0,0,0,0.5)'` (passthrough)
161
156
  */
157
+ readonly alpha: (color: string, opacity?: number) => string;
162
158
  [color: string]: any;
163
159
  }
164
160
  declare function wrapColors(rawColors: ThemeColors): ColorsAPI;
package/dist/index.d.ts CHANGED
@@ -149,16 +149,12 @@ interface ColorScale {
149
149
  }
150
150
  interface ColorsAPI {
151
151
  /**
152
- * Apply opacity to any CSS color string (hex, rgb, rgba).
153
- * `colors.alpha('#3b82f6', 50)` → `'rgba(59,130,246,0.5)'`
154
- * `colors.alpha('rgb(0,0,0)', 10)` → `'rgba(0,0,0,0.1)'`
155
- */
156
- alpha(color: string, opacity: number): string;
157
- /**
158
- * Index access returns a ColorScale for palette families or a string for flat colors.
159
- * Supports shade numbers (`colors.blue[6]`), slash opacity (`colors.blue['6/50']`),
160
- * and flat colors with opacity (`colors['white/20']`).
152
+ * Pass any CSS color through, optionally applying an opacity (0–100).
153
+ * - `colors.alpha('#3b82f6', 50)` → `'rgba(59,130,246,0.5)'`
154
+ * - `colors.alpha('rgb(0,0,0)', 10)` → `'rgba(0,0,0,0.1)'`
155
+ * - `colors.alpha('rgba(0,0,0,0.5)')` → `'rgba(0,0,0,0.5)'` (passthrough)
161
156
  */
157
+ readonly alpha: (color: string, opacity?: number) => string;
162
158
  [color: string]: any;
163
159
  }
164
160
  declare function wrapColors(rawColors: ThemeColors): ColorsAPI;
package/dist/index.js CHANGED
@@ -103,7 +103,7 @@ function makeShadeProxy(shades) {
103
103
  }
104
104
  function wrapColors(rawColors) {
105
105
  const cache = /* @__PURE__ */ new Map();
106
- const alpha = (color, opacity) => applyOpacity(color, opacity);
106
+ const alpha = (color, opacity) => opacity === void 0 ? color : applyOpacity(color, opacity);
107
107
  return new Proxy({ alpha }, {
108
108
  get(_, prop) {
109
109
  const key = String(prop);
package/dist/index.mjs CHANGED
@@ -64,7 +64,7 @@ function makeShadeProxy(shades) {
64
64
  }
65
65
  function wrapColors(rawColors) {
66
66
  const cache = /* @__PURE__ */ new Map();
67
- const alpha = (color, opacity) => applyOpacity(color, opacity);
67
+ const alpha = (color, opacity) => opacity === void 0 ? color : applyOpacity(color, opacity);
68
68
  return new Proxy({ alpha }, {
69
69
  get(_, prop) {
70
70
  const key = String(prop);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",