@kbach/react 0.6.47 → 0.6.48

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.
@@ -3837,6 +3837,16 @@ var _resizeModeMap = {
3837
3837
  "center": "none",
3838
3838
  "repeat": "none"
3839
3839
  };
3840
+ var PLACEHOLDER_RULE_CLASS = "kbach-ph";
3841
+ var _placeholderRuleInjected = false;
3842
+ function ensurePlaceholderColorRuleInjected() {
3843
+ if (_placeholderRuleInjected || typeof document === "undefined") return;
3844
+ _placeholderRuleInjected = true;
3845
+ const style = document.createElement("style");
3846
+ style.setAttribute("data-kbach-placeholder", "");
3847
+ style.textContent = `.${PLACEHOLDER_RULE_CLASS}::placeholder{color:var(--kbach-ph-color)}`;
3848
+ document.head.appendChild(style);
3849
+ }
3840
3850
  function transformToWebProps(originalName, tag, props) {
3841
3851
  const out = {};
3842
3852
  const isPressable = _pressableNames.has(originalName);
@@ -3844,6 +3854,7 @@ function transformToWebProps(originalName, tag, props) {
3844
3854
  const isImage = originalName === "Image" || originalName === "ImageBackground";
3845
3855
  const isScrollable = originalName === "ScrollView" || originalName === "FlatList" || originalName === "SectionList";
3846
3856
  let pendingStyle = null;
3857
+ let pendingClassName = null;
3847
3858
  for (const [k, v] of Object.entries(props)) {
3848
3859
  if (_rnOnlyProps.has(k)) continue;
3849
3860
  if (k === "onPress") {
@@ -3867,6 +3878,22 @@ function transformToWebProps(originalName, tag, props) {
3867
3878
  if (!("onChange" in props)) out.onChange = (e) => v(e.target.value);
3868
3879
  continue;
3869
3880
  }
3881
+ if (k === "onSubmitEditing") {
3882
+ if (!("onKeyDown" in props)) {
3883
+ out.onKeyDown = (e) => {
3884
+ if (e.key === "Enter") v();
3885
+ };
3886
+ }
3887
+ continue;
3888
+ }
3889
+ if (k === "placeholderTextColor") {
3890
+ if (v) {
3891
+ ensurePlaceholderColorRuleInjected();
3892
+ pendingClassName = PLACEHOLDER_RULE_CLASS;
3893
+ pendingStyle = { ...pendingStyle ?? {}, "--kbach-ph-color": v };
3894
+ }
3895
+ continue;
3896
+ }
3870
3897
  if (k === "secureTextEntry") {
3871
3898
  if (v && !("type" in props)) out.type = "password";
3872
3899
  continue;
@@ -3928,6 +3955,9 @@ function transformToWebProps(originalName, tag, props) {
3928
3955
  if (pendingStyle) {
3929
3956
  out.style = out.style ? { ...pendingStyle, ...out.style } : pendingStyle;
3930
3957
  }
3958
+ if (pendingClassName) {
3959
+ out.className = out.className ? `${out.className} ${pendingClassName}` : pendingClassName;
3960
+ }
3931
3961
  if (isPressable && !out.role) out.role = "button";
3932
3962
  if (isImage && tag === "img" && out.alt == null) out.alt = "";
3933
3963
  return out;
@@ -26,7 +26,7 @@ import {
26
26
  transformToWebProps,
27
27
  useConditionalGlobalDarkMode,
28
28
  useConditionalWidth
29
- } from "./chunk-5HY7Z2PS.mjs";
29
+ } from "./chunk-CFUH3CUD.mjs";
30
30
 
31
31
  // src/jsx-runtime.tsx
32
32
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
package/dist/index.js CHANGED
@@ -716,6 +716,16 @@ var _resizeModeMap = {
716
716
  "center": "none",
717
717
  "repeat": "none"
718
718
  };
719
+ var PLACEHOLDER_RULE_CLASS = "kbach-ph";
720
+ var _placeholderRuleInjected = false;
721
+ function ensurePlaceholderColorRuleInjected() {
722
+ if (_placeholderRuleInjected || typeof document === "undefined") return;
723
+ _placeholderRuleInjected = true;
724
+ const style = document.createElement("style");
725
+ style.setAttribute("data-kbach-placeholder", "");
726
+ style.textContent = `.${PLACEHOLDER_RULE_CLASS}::placeholder{color:var(--kbach-ph-color)}`;
727
+ document.head.appendChild(style);
728
+ }
719
729
  function transformToWebProps(originalName, tag, props) {
720
730
  const out = {};
721
731
  const isPressable = _pressableNames.has(originalName);
@@ -723,6 +733,7 @@ function transformToWebProps(originalName, tag, props) {
723
733
  const isImage = originalName === "Image" || originalName === "ImageBackground";
724
734
  const isScrollable = originalName === "ScrollView" || originalName === "FlatList" || originalName === "SectionList";
725
735
  let pendingStyle = null;
736
+ let pendingClassName = null;
726
737
  for (const [k, v] of Object.entries(props)) {
727
738
  if (_rnOnlyProps.has(k)) continue;
728
739
  if (k === "onPress") {
@@ -746,6 +757,22 @@ function transformToWebProps(originalName, tag, props) {
746
757
  if (!("onChange" in props)) out.onChange = (e) => v(e.target.value);
747
758
  continue;
748
759
  }
760
+ if (k === "onSubmitEditing") {
761
+ if (!("onKeyDown" in props)) {
762
+ out.onKeyDown = (e) => {
763
+ if (e.key === "Enter") v();
764
+ };
765
+ }
766
+ continue;
767
+ }
768
+ if (k === "placeholderTextColor") {
769
+ if (v) {
770
+ ensurePlaceholderColorRuleInjected();
771
+ pendingClassName = PLACEHOLDER_RULE_CLASS;
772
+ pendingStyle = { ...pendingStyle ?? {}, "--kbach-ph-color": v };
773
+ }
774
+ continue;
775
+ }
749
776
  if (k === "secureTextEntry") {
750
777
  if (v && !("type" in props)) out.type = "password";
751
778
  continue;
@@ -807,6 +834,9 @@ function transformToWebProps(originalName, tag, props) {
807
834
  if (pendingStyle) {
808
835
  out.style = out.style ? { ...pendingStyle, ...out.style } : pendingStyle;
809
836
  }
837
+ if (pendingClassName) {
838
+ out.className = out.className ? `${out.className} ${pendingClassName}` : pendingClassName;
839
+ }
810
840
  if (isPressable && !out.role) out.role = "button";
811
841
  if (isImage && tag === "img" && out.alt == null) out.alt = "";
812
842
  return out;
package/dist/index.mjs CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  useGlobalDarkMode,
49
49
  useGlobalWidth,
50
50
  useSyncExternalStore
51
- } from "./chunk-5HY7Z2PS.mjs";
51
+ } from "./chunk-CFUH3CUD.mjs";
52
52
 
53
53
  // src/context.tsx
54
54
  import { createContext, useContext } from "react";
@@ -500,6 +500,16 @@ var _resizeModeMap = {
500
500
  "center": "none",
501
501
  "repeat": "none"
502
502
  };
503
+ var PLACEHOLDER_RULE_CLASS = "kbach-ph";
504
+ var _placeholderRuleInjected = false;
505
+ function ensurePlaceholderColorRuleInjected() {
506
+ if (_placeholderRuleInjected || typeof document === "undefined") return;
507
+ _placeholderRuleInjected = true;
508
+ const style = document.createElement("style");
509
+ style.setAttribute("data-kbach-placeholder", "");
510
+ style.textContent = `.${PLACEHOLDER_RULE_CLASS}::placeholder{color:var(--kbach-ph-color)}`;
511
+ document.head.appendChild(style);
512
+ }
503
513
  function transformToWebProps(originalName, tag, props) {
504
514
  const out = {};
505
515
  const isPressable = _pressableNames.has(originalName);
@@ -507,6 +517,7 @@ function transformToWebProps(originalName, tag, props) {
507
517
  const isImage = originalName === "Image" || originalName === "ImageBackground";
508
518
  const isScrollable = originalName === "ScrollView" || originalName === "FlatList" || originalName === "SectionList";
509
519
  let pendingStyle = null;
520
+ let pendingClassName = null;
510
521
  for (const [k, v] of Object.entries(props)) {
511
522
  if (_rnOnlyProps.has(k)) continue;
512
523
  if (k === "onPress") {
@@ -530,6 +541,22 @@ function transformToWebProps(originalName, tag, props) {
530
541
  if (!("onChange" in props)) out.onChange = (e) => v(e.target.value);
531
542
  continue;
532
543
  }
544
+ if (k === "onSubmitEditing") {
545
+ if (!("onKeyDown" in props)) {
546
+ out.onKeyDown = (e) => {
547
+ if (e.key === "Enter") v();
548
+ };
549
+ }
550
+ continue;
551
+ }
552
+ if (k === "placeholderTextColor") {
553
+ if (v) {
554
+ ensurePlaceholderColorRuleInjected();
555
+ pendingClassName = PLACEHOLDER_RULE_CLASS;
556
+ pendingStyle = { ...pendingStyle ?? {}, "--kbach-ph-color": v };
557
+ }
558
+ continue;
559
+ }
533
560
  if (k === "secureTextEntry") {
534
561
  if (v && !("type" in props)) out.type = "password";
535
562
  continue;
@@ -591,6 +618,9 @@ function transformToWebProps(originalName, tag, props) {
591
618
  if (pendingStyle) {
592
619
  out.style = out.style ? { ...pendingStyle, ...out.style } : pendingStyle;
593
620
  }
621
+ if (pendingClassName) {
622
+ out.className = out.className ? `${out.className} ${pendingClassName}` : pendingClassName;
623
+ }
594
624
  if (isPressable && !out.role) out.role = "button";
595
625
  if (isImage && tag === "img" && out.alt == null) out.alt = "";
596
626
  return out;
@@ -3,8 +3,8 @@ import {
3
3
  Fragment,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-WW3NH5W2.mjs";
7
- import "./chunk-5HY7Z2PS.mjs";
6
+ } from "./chunk-YI75WFHE.mjs";
7
+ import "./chunk-CFUH3CUD.mjs";
8
8
 
9
9
  // src/jsx-dev-runtime.tsx
10
10
  function jsxDEV(type, props, key, isStaticChildren, source, self) {
@@ -506,6 +506,16 @@ var _resizeModeMap = {
506
506
  "center": "none",
507
507
  "repeat": "none"
508
508
  };
509
+ var PLACEHOLDER_RULE_CLASS = "kbach-ph";
510
+ var _placeholderRuleInjected = false;
511
+ function ensurePlaceholderColorRuleInjected() {
512
+ if (_placeholderRuleInjected || typeof document === "undefined") return;
513
+ _placeholderRuleInjected = true;
514
+ const style = document.createElement("style");
515
+ style.setAttribute("data-kbach-placeholder", "");
516
+ style.textContent = `.${PLACEHOLDER_RULE_CLASS}::placeholder{color:var(--kbach-ph-color)}`;
517
+ document.head.appendChild(style);
518
+ }
509
519
  function transformToWebProps(originalName, tag, props) {
510
520
  const out = {};
511
521
  const isPressable = _pressableNames.has(originalName);
@@ -513,6 +523,7 @@ function transformToWebProps(originalName, tag, props) {
513
523
  const isImage = originalName === "Image" || originalName === "ImageBackground";
514
524
  const isScrollable = originalName === "ScrollView" || originalName === "FlatList" || originalName === "SectionList";
515
525
  let pendingStyle = null;
526
+ let pendingClassName = null;
516
527
  for (const [k, v] of Object.entries(props)) {
517
528
  if (_rnOnlyProps.has(k)) continue;
518
529
  if (k === "onPress") {
@@ -536,6 +547,22 @@ function transformToWebProps(originalName, tag, props) {
536
547
  if (!("onChange" in props)) out.onChange = (e) => v(e.target.value);
537
548
  continue;
538
549
  }
550
+ if (k === "onSubmitEditing") {
551
+ if (!("onKeyDown" in props)) {
552
+ out.onKeyDown = (e) => {
553
+ if (e.key === "Enter") v();
554
+ };
555
+ }
556
+ continue;
557
+ }
558
+ if (k === "placeholderTextColor") {
559
+ if (v) {
560
+ ensurePlaceholderColorRuleInjected();
561
+ pendingClassName = PLACEHOLDER_RULE_CLASS;
562
+ pendingStyle = { ...pendingStyle ?? {}, "--kbach-ph-color": v };
563
+ }
564
+ continue;
565
+ }
539
566
  if (k === "secureTextEntry") {
540
567
  if (v && !("type" in props)) out.type = "password";
541
568
  continue;
@@ -597,6 +624,9 @@ function transformToWebProps(originalName, tag, props) {
597
624
  if (pendingStyle) {
598
625
  out.style = out.style ? { ...pendingStyle, ...out.style } : pendingStyle;
599
626
  }
627
+ if (pendingClassName) {
628
+ out.className = out.className ? `${out.className} ${pendingClassName}` : pendingClassName;
629
+ }
600
630
  if (isPressable && !out.role) out.role = "button";
601
631
  if (isImage && tag === "img" && out.alt == null) out.alt = "";
602
632
  return out;
@@ -4,10 +4,10 @@ import {
4
4
  _invalidateDefaultFontCache,
5
5
  jsx,
6
6
  jsxs
7
- } from "./chunk-WW3NH5W2.mjs";
7
+ } from "./chunk-YI75WFHE.mjs";
8
8
  import {
9
9
  registerWebElement
10
- } from "./chunk-5HY7Z2PS.mjs";
10
+ } from "./chunk-CFUH3CUD.mjs";
11
11
  export {
12
12
  Fragment,
13
13
  _invalidateDefaultFontCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.6.47",
3
+ "version": "0.6.48",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "license": "MIT",
6
6
  "repository": {