@kbach/react-native 1.0.0-beta.28 → 1.0.0-beta.29

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.
@@ -10,13 +10,13 @@ import {
10
10
  subscribeDynamicTokens,
11
11
  subscribeGlobalDarkMode,
12
12
  toggleGlobalDarkMode
13
- } from "./chunk-TNMCSVJ5.mjs";
13
+ } from "./chunk-2RXP6YSV.mjs";
14
14
  import {
15
15
  defaultTheme,
16
16
  getTheme,
17
17
  resolveClassName,
18
18
  setTheme
19
- } from "./chunk-NJZIH3NL.mjs";
19
+ } from "./chunk-B36TKRB6.mjs";
20
20
 
21
21
  // src/config.ts
22
22
  function parseHexRgb(hex) {
@@ -216,9 +216,36 @@ import { useSyncExternalStore as useSyncExternalStore2 } from "react";
216
216
  function useDynamicToken(name) {
217
217
  return useSyncExternalStore2(subscribeDynamicTokens, () => getDynamicToken(name));
218
218
  }
219
+
220
+ // src/clsx.ts
221
+ function clsx(...inputs) {
222
+ let out = "";
223
+ for (const input of inputs) {
224
+ const piece = resolveClassValue(input);
225
+ if (piece) out = out ? `${out} ${piece}` : piece;
226
+ }
227
+ return out;
228
+ }
229
+ function resolveClassValue(value) {
230
+ if (!value) return "";
231
+ const type = typeof value;
232
+ if (type === "string" || type === "number" || type === "bigint") return String(value);
233
+ if (Array.isArray(value)) return clsx(...value);
234
+ if (type === "object") {
235
+ let out = "";
236
+ for (const key in value) {
237
+ if (Object.prototype.hasOwnProperty.call(value, key) && value[key]) {
238
+ out = out ? `${out} ${key}` : key;
239
+ }
240
+ }
241
+ return out;
242
+ }
243
+ return "";
244
+ }
219
245
  export {
220
246
  ThemeProvider,
221
247
  applyKbachConfig,
248
+ clsx,
222
249
  defaultTheme,
223
250
  deleteDynamicToken,
224
251
  getDynamicToken,
@@ -653,7 +653,12 @@ function ReactiveElement({
653
653
  }
654
654
  const states = { hover: isHovered, focus: isFocused, disabled: hostRest.disabled === true };
655
655
  const finalStyle = hostType === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed, layoutOverrides, states) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false, layoutOverrides, states);
656
- return makeElement(isStaticChildren, hostType, { ...hostRestWithLayout, style: finalStyle }, elementKey);
656
+ return makeElement(
657
+ isStaticChildren,
658
+ hostType,
659
+ { ...hostRestWithLayout, className: classStrRaw, style: finalStyle },
660
+ elementKey
661
+ );
657
662
  }
658
663
  function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
659
664
  if (type === null || typeof type === "symbol" || !rawProps) {
@@ -672,7 +677,7 @@ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
672
677
  }
673
678
  const staticStates = { hover: false, focus: false, disabled: rest.disabled === true };
674
679
  const finalStyle = type === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed, void 0, staticStates) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false, void 0, staticStates);
675
- return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
680
+ return makeElement(isStaticChildren, type, { ...rest, className: classStrRaw, style: finalStyle }, key);
676
681
  }
677
682
  function createJsxFunctions(resolveStyle2) {
678
683
  function jsx2(type, props, key) {
@@ -721,7 +726,10 @@ function resolveLength(theme, parsed) {
721
726
  }
722
727
  function resolveNegatableLength(theme, parsed) {
723
728
  if (!parsed.negative) return resolveLength(theme, parsed);
724
- if (parsed.isArbitrary) return null;
729
+ if (parsed.isArbitrary) {
730
+ const value2 = parsed.value;
731
+ return value2 === null ? null : `calc(${value2} * -1)`;
732
+ }
725
733
  const value = parsed.value;
726
734
  if (value === null) return null;
727
735
  const px = spacingPx(theme, value);