@flipova/foundation 2.2.1 → 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,14 +3844,84 @@ 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"])
3912
+ };
3913
+ var variants = {
3914
+ default: { dark: "dark", light: "light" },
3915
+ spring: { dark: "spring-dark", light: "spring-light" }
3852
3916
  };
3853
3917
  var ThemeContext = React48.createContext(null);
3854
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
+ }
3855
3925
 
3856
3926
  // components/ui/gluestack-ui-provider/useGluestackColors.ts
3857
3927
  function toCamelCase(str) {
@@ -3870,7 +3940,9 @@ function rgbToHex(rgbString) {
3870
3940
  function useGluestackColors() {
3871
3941
  const { colorScheme } = nativewind.useColorScheme();
3872
3942
  const theme = useMountedColors() ?? colors;
3873
- const palette = theme[colorScheme || "light"];
3943
+ const mounted = useMountedTheme();
3944
+ const palettes = theme;
3945
+ const palette = palettes[mounted?.themeId ?? ""] ?? palettes[colorScheme || "light"] ?? palettes[mounted?.themeIds[0] ?? ""] ?? {};
3874
3946
  const result = {};
3875
3947
  Object.entries(palette).forEach(([key, value]) => {
3876
3948
  const camelKey = toCamelCase(key);
@@ -3901,28 +3973,41 @@ var useGluestackColors2 = useGluestackColors;
3901
3973
  var useCalendarTheme2 = useCalendarTheme;
3902
3974
  function createGluestackUIProvider(theme) {
3903
3975
  const vars2 = theme.config ?? theme.colors;
3976
+ const variantMap = theme.variants;
3977
+ const themeIds = Object.keys(vars2);
3904
3978
  return function ThemedProvider({
3905
3979
  mode = "light",
3980
+ variant,
3906
3981
  ...props
3907
3982
  }) {
3908
3983
  const { colorScheme, setColorScheme } = nativewind.useColorScheme();
3909
3984
  React48.useEffect(() => {
3910
3985
  setColorScheme(mode);
3911
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
+ );
3912
3993
  return /* @__PURE__ */ jsxRuntime.jsx(
3913
3994
  reactNative.View,
3914
3995
  {
3915
3996
  style: [
3916
- vars2[colorScheme],
3997
+ vars2[themeId],
3917
3998
  { flex: 1, height: "100%", width: "100%" },
3918
3999
  props.style
3919
4000
  ],
3920
- children: /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: theme.colors, 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 }) }) }) })
3921
4002
  }
3922
4003
  );
3923
4004
  };
3924
4005
  }
3925
- var GluestackUIProvider = createGluestackUIProvider({ colors, config });
4006
+ var GluestackUIProvider = createGluestackUIProvider({
4007
+ colors,
4008
+ config,
4009
+ variants
4010
+ });
3926
4011
  var gridBaseStyle = nativewindUtils.isWeb ? "grid grid-cols-12" : "box-border flex-row flex-wrap justify-start";
3927
4012
  var gridItemBaseStyle = nativewindUtils.isWeb ? "w-auto col-span-1" : "";
3928
4013
  var gridStyle = nativewindUtils.tva({
@@ -9641,6 +9726,7 @@ exports.ModalContent = ModalContent;
9641
9726
  exports.ModalFooter = ModalFooter;
9642
9727
  exports.ModalHeader = ModalHeader;
9643
9728
  exports.MoonIcon = MoonIcon;
9729
+ exports.MountedThemeContext = MountedThemeContext;
9644
9730
  exports.PaperclipIcon = PaperclipIcon;
9645
9731
  exports.PhoneIcon = PhoneIcon;
9646
9732
  exports.PlayIcon = PlayIcon;
@@ -9734,9 +9820,11 @@ exports.UnlockIcon = UnlockIcon;
9734
9820
  exports.VStack = VStack;
9735
9821
  exports.createGluestackUIProvider = createGluestackUIProvider;
9736
9822
  exports.createIconUI = createIconUI;
9823
+ exports.resolveThemeId = resolveThemeId;
9737
9824
  exports.useCalendarTheme = useCalendarTheme2;
9738
9825
  exports.useGluestackColors = useGluestackColors2;
9739
9826
  exports.useMountedColors = useMountedColors;
9827
+ exports.useMountedTheme = useMountedTheme;
9740
9828
  exports.useToast = useToast;
9741
- //# sourceMappingURL=chunk-JVHJUIXV.js.map
9742
- //# sourceMappingURL=chunk-JVHJUIXV.js.map
9829
+ //# sourceMappingURL=chunk-GD37RFBR.js.map
9830
+ //# sourceMappingURL=chunk-GD37RFBR.js.map