@flipova/foundation 2.2.0 → 2.3.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.
@@ -3844,12 +3844,86 @@ var colors = {
3844
3844
  "--error-foreground": "255 255 255",
3845
3845
  "--info": "14 165 233",
3846
3846
  "--info-foreground": "255 255 255"
3847
+ },
3848
+ "spring-light": {
3849
+ "--background": "240 253 244",
3850
+ "--foreground": "20 83 45",
3851
+ "--card": "255 255 255",
3852
+ "--card-foreground": "20 83 45",
3853
+ "--popover": "255 255 255",
3854
+ "--popover-foreground": "20 83 45",
3855
+ "--primary": "22 163 74",
3856
+ "--primary-foreground": "255 255 255",
3857
+ "--secondary": "34 197 94",
3858
+ "--secondary-foreground": "255 255 255",
3859
+ "--muted": "220 252 231",
3860
+ "--muted-foreground": "21 128 61",
3861
+ "--accent": "187 247 208",
3862
+ "--accent-foreground": "20 83 45",
3863
+ "--destructive": "220 38 38",
3864
+ "--destructive-foreground": "255 255 255",
3865
+ "--border": "187 247 208",
3866
+ "--input": "187 247 208",
3867
+ "--ring": "74 222 128",
3868
+ "--success": "22 163 74",
3869
+ "--success-foreground": "255 255 255",
3870
+ "--warning": "217 119 6",
3871
+ "--warning-foreground": "255 255 255",
3872
+ "--error": "220 38 38",
3873
+ "--error-foreground": "255 255 255",
3874
+ "--info": "2 132 199",
3875
+ "--info-foreground": "255 255 255"
3876
+ },
3877
+ "spring-dark": {
3878
+ "--background": "5 46 22",
3879
+ "--foreground": "240 253 244",
3880
+ "--card": "20 83 45",
3881
+ "--card-foreground": "240 253 244",
3882
+ "--popover": "20 83 45",
3883
+ "--popover-foreground": "240 253 244",
3884
+ "--primary": "74 222 128",
3885
+ "--primary-foreground": "5 46 22",
3886
+ "--secondary": "134 239 172",
3887
+ "--secondary-foreground": "5 46 22",
3888
+ "--muted": "20 83 45",
3889
+ "--muted-foreground": "187 247 208",
3890
+ "--accent": "22 101 52",
3891
+ "--accent-foreground": "240 253 244",
3892
+ "--destructive": "239 68 68",
3893
+ "--destructive-foreground": "255 255 255",
3894
+ "--border": "22 101 52",
3895
+ "--input": "22 101 52",
3896
+ "--ring": "134 239 172",
3897
+ "--success": "74 222 128",
3898
+ "--success-foreground": "5 46 22",
3899
+ "--warning": "251 191 36",
3900
+ "--warning-foreground": "5 46 22",
3901
+ "--error": "248 113 113",
3902
+ "--error-foreground": "5 46 22",
3903
+ "--info": "56 189 248",
3904
+ "--info-foreground": "5 46 22"
3847
3905
  }
3848
3906
  };
3849
3907
  var config = {
3850
- light: nativewind.vars(colors.light),
3851
- dark: nativewind.vars(colors.dark)
3908
+ light: nativewind.vars(colors["light"]),
3909
+ dark: nativewind.vars(colors["dark"]),
3910
+ "spring-light": nativewind.vars(colors["spring-light"]),
3911
+ "spring-dark": nativewind.vars(colors["spring-dark"])
3852
3912
  };
3913
+ var variants = {
3914
+ default: { dark: "dark", light: "light" },
3915
+ spring: { dark: "spring-dark", light: "spring-light" }
3916
+ };
3917
+ var ThemeContext = React48.createContext(null);
3918
+ var useMountedColors = () => React48.useContext(ThemeContext);
3919
+ var MountedThemeContext = React48.createContext(null);
3920
+ var useMountedTheme = () => React48.useContext(MountedThemeContext);
3921
+ function resolveThemeId(variants2, variant, mode) {
3922
+ const mapped = variant ? variants2?.[variant]?.[mode] : void 0;
3923
+ return mapped ?? mode;
3924
+ }
3925
+
3926
+ // components/ui/gluestack-ui-provider/useGluestackColors.ts
3853
3927
  function toCamelCase(str) {
3854
3928
  return str.replace(/^--/, "").replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
3855
3929
  }
@@ -3865,9 +3939,12 @@ function rgbToHex(rgbString) {
3865
3939
  }
3866
3940
  function useGluestackColors() {
3867
3941
  const { colorScheme } = nativewind.useColorScheme();
3868
- const theme = colors[colorScheme || "light"];
3942
+ const theme = useMountedColors() ?? colors;
3943
+ const mounted = useMountedTheme();
3944
+ const palettes = theme;
3945
+ const palette = palettes[mounted?.themeId ?? ""] ?? palettes[colorScheme || "light"] ?? palettes[mounted?.themeIds[0] ?? ""] ?? {};
3869
3946
  const result = {};
3870
- Object.entries(theme).forEach(([key, value]) => {
3947
+ Object.entries(palette).forEach(([key, value]) => {
3871
3948
  const camelKey = toCamelCase(key);
3872
3949
  result[camelKey] = rgbToHex(value);
3873
3950
  });
@@ -3895,28 +3972,42 @@ function useCalendarTheme() {
3895
3972
  var useGluestackColors2 = useGluestackColors;
3896
3973
  var useCalendarTheme2 = useCalendarTheme;
3897
3974
  function createGluestackUIProvider(theme) {
3975
+ const vars2 = theme.config ?? theme.colors;
3976
+ const variantMap = theme.variants;
3977
+ const themeIds = Object.keys(vars2);
3898
3978
  return function ThemedProvider({
3899
3979
  mode = "light",
3980
+ variant,
3900
3981
  ...props
3901
3982
  }) {
3902
3983
  const { colorScheme, setColorScheme } = nativewind.useColorScheme();
3903
3984
  React48.useEffect(() => {
3904
3985
  setColorScheme(mode);
3905
3986
  }, [mode]);
3987
+ const resolvedMode = mode === "system" ? colorScheme ?? "light" : mode;
3988
+ const themeId = resolveThemeId(variantMap, variant, resolvedMode);
3989
+ const mountedTheme = React48__default.default.useMemo(
3990
+ () => ({ themeId, themeIds }),
3991
+ [themeId, themeIds]
3992
+ );
3906
3993
  return /* @__PURE__ */ jsxRuntime.jsx(
3907
3994
  reactNative.View,
3908
3995
  {
3909
3996
  style: [
3910
- theme[colorScheme],
3997
+ vars2[themeId],
3911
3998
  { flex: 1, height: "100%", width: "100%" },
3912
3999
  props.style
3913
4000
  ],
3914
- children: /* @__PURE__ */ jsxRuntime.jsx(creator$d.OverlayProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(creator$o.ToastProvider, { children: props.children }) })
4001
+ children: /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: theme.colors, children: /* @__PURE__ */ jsxRuntime.jsx(MountedThemeContext.Provider, { value: mountedTheme, children: /* @__PURE__ */ jsxRuntime.jsx(creator$d.OverlayProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(creator$o.ToastProvider, { children: props.children }) }) }) })
3915
4002
  }
3916
4003
  );
3917
4004
  };
3918
4005
  }
3919
- var GluestackUIProvider = createGluestackUIProvider(config);
4006
+ var GluestackUIProvider = createGluestackUIProvider({
4007
+ colors,
4008
+ config,
4009
+ variants
4010
+ });
3920
4011
  var gridBaseStyle = nativewindUtils.isWeb ? "grid grid-cols-12" : "box-border flex-row flex-wrap justify-start";
3921
4012
  var gridItemBaseStyle = nativewindUtils.isWeb ? "w-auto col-span-1" : "";
3922
4013
  var gridStyle = nativewindUtils.tva({
@@ -9635,6 +9726,7 @@ exports.ModalContent = ModalContent;
9635
9726
  exports.ModalFooter = ModalFooter;
9636
9727
  exports.ModalHeader = ModalHeader;
9637
9728
  exports.MoonIcon = MoonIcon;
9729
+ exports.MountedThemeContext = MountedThemeContext;
9638
9730
  exports.PaperclipIcon = PaperclipIcon;
9639
9731
  exports.PhoneIcon = PhoneIcon;
9640
9732
  exports.PlayIcon = PlayIcon;
@@ -9706,6 +9798,7 @@ exports.TabsTriggerText = TabsTriggerText;
9706
9798
  exports.Text = Text21;
9707
9799
  exports.Textarea = Textarea;
9708
9800
  exports.TextareaInput = TextareaInput;
9801
+ exports.ThemeContext = ThemeContext;
9709
9802
  exports.ThreeDotsIcon = ThreeDotsIcon;
9710
9803
  exports.Toast = Toast;
9711
9804
  exports.ToastDescription = ToastDescription;
@@ -9727,8 +9820,11 @@ exports.UnlockIcon = UnlockIcon;
9727
9820
  exports.VStack = VStack;
9728
9821
  exports.createGluestackUIProvider = createGluestackUIProvider;
9729
9822
  exports.createIconUI = createIconUI;
9823
+ exports.resolveThemeId = resolveThemeId;
9730
9824
  exports.useCalendarTheme = useCalendarTheme2;
9731
9825
  exports.useGluestackColors = useGluestackColors2;
9826
+ exports.useMountedColors = useMountedColors;
9827
+ exports.useMountedTheme = useMountedTheme;
9732
9828
  exports.useToast = useToast;
9733
- //# sourceMappingURL=chunk-TDW7UKG6.js.map
9734
- //# sourceMappingURL=chunk-TDW7UKG6.js.map
9829
+ //# sourceMappingURL=chunk-GD37RFBR.js.map
9830
+ //# sourceMappingURL=chunk-GD37RFBR.js.map