@vaneui/ui 0.2.1-alpha.20250811191248.a18a87d → 0.2.1-alpha.20250813170000.4050860

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.js CHANGED
@@ -94,7 +94,7 @@ const LABEL_CATEGORIES = [...TYPOGRAPHY_FULL, ...LAYOUT_FULL, ...VISUAL_CORE];
94
94
  // Media component categories
95
95
  const IMG_CATEGORIES = [...LAYOUT_CORE, ...VISUAL_CORE, ...VISUAL_DECORATION, ...SHAPE];
96
96
  const COMPONENT = ['button', 'badge', 'chip', 'code', 'card', 'divider', 'container', 'row', 'col', 'stack', 'section',
97
- 'grid3', 'grid4', 'pageTitle', 'sectionTitle', 'title', 'text', 'link', 'list', 'listItem', 'checkbox', 'label', 'img'];
97
+ 'grid2', 'grid3', 'grid4', 'pageTitle', 'sectionTitle', 'title', 'text', 'link', 'list', 'listItem', 'checkbox', 'label', 'img'];
98
98
  const ComponentCategories = {
99
99
  badge: BADGE_CATEGORIES,
100
100
  button: BUTTON_CATEGORIES,
@@ -105,6 +105,7 @@ const ComponentCategories = {
105
105
  col: COL_CATEGORIES,
106
106
  container: CONTAINER_CATEGORIES,
107
107
  divider: DIVIDER_CATEGORIES,
108
+ grid2: GRID_CATEGORIES,
108
109
  grid3: GRID_CATEGORIES,
109
110
  grid4: GRID_CATEGORIES,
110
111
  img: IMG_CATEGORIES,
@@ -4643,6 +4644,9 @@ const gridSubThemes = {
4643
4644
  flexDirection: new DirectionTheme(),
4644
4645
  },
4645
4646
  };
4647
+ const defaultGrid2Theme = new ComponentTheme("div", "grid-cols-1 md:grid-cols-2", gridSubThemes, gridDefaults, GRID_CATEGORIES, (props, defaults) => {
4648
+ return props.href ? "a" : "div";
4649
+ });
4646
4650
  const defaultGrid3Theme = new ComponentTheme("div", "grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults, GRID_CATEGORIES, (props, defaults) => {
4647
4651
  return props.href ? "a" : "div";
4648
4652
  });
@@ -4773,6 +4777,7 @@ const defaultTheme = {
4773
4777
  col: defaultColTheme,
4774
4778
  stack: defaultStackTheme,
4775
4779
  section: defaultSectionTheme,
4780
+ grid2: defaultGrid2Theme,
4776
4781
  grid3: defaultGrid3Theme,
4777
4782
  grid4: defaultGrid4Theme,
4778
4783
  pageTitle: pageTitleTheme,
@@ -4852,12 +4857,17 @@ function applyExtraClassesRecursively(themeObject, extraClassesObject) {
4852
4857
  }
4853
4858
  }
4854
4859
  const ThemeContext = react.createContext(defaultTheme);
4855
- function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extraClasses, themeOverride }) {
4860
+ function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extraClasses, themeOverride, mergeStrategy = 'merge' }) {
4861
+ const parentTheme = react.useContext(ThemeContext);
4856
4862
  const mergedTheme = react.useMemo(() => {
4863
+ // Determine the base theme based on merge strategy
4864
+ const baseTheme = mergeStrategy === 'replace'
4865
+ ? defaultTheme
4866
+ : parentTheme;
4857
4867
  // Always start with a deep clone to ensure isolation
4858
4868
  let finalTheme = themeObject
4859
- ? deepMerge(deepClone(defaultTheme), themeObject)
4860
- : deepClone(defaultTheme);
4869
+ ? deepMerge(deepClone(baseTheme), themeObject)
4870
+ : deepClone(baseTheme);
4861
4871
  if (typeof themeOverride === 'function') {
4862
4872
  const themeToModify = deepClone(finalTheme);
4863
4873
  finalTheme = themeOverride(themeToModify);
@@ -4875,7 +4885,7 @@ function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extra
4875
4885
  applyExtraClassesRecursively(finalTheme, extraClasses);
4876
4886
  }
4877
4887
  return finalTheme;
4878
- }, [themeObject, themeDefaults, extraClasses, themeOverride]);
4888
+ }, [themeObject, themeDefaults, extraClasses, themeOverride, mergeStrategy, parentTheme]);
4879
4889
  return (jsxRuntime.jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
4880
4890
  }
4881
4891
  function useTheme() {
@@ -4969,6 +4979,10 @@ const Row = react.forwardRef(function Row(props, ref) {
4969
4979
  return jsxRuntime.jsx(ThemedComponent, { theme: theme.row, ref: ref, ...props });
4970
4980
  });
4971
4981
 
4982
+ const Grid2 = react.forwardRef(function Grid2(props, ref) {
4983
+ const theme = useTheme();
4984
+ return jsxRuntime.jsx(ThemedComponent, { theme: theme.grid2, ref: ref, ...props });
4985
+ });
4972
4986
  const Grid3 = react.forwardRef(function Grid3(props, ref) {
4973
4987
  const theme = useTheme();
4974
4988
  return jsxRuntime.jsx(ThemedComponent, { theme: theme.grid3, ref: ref, ...props });
@@ -5042,6 +5056,7 @@ exports.Container = Container;
5042
5056
  exports.DIVIDER_CATEGORIES = DIVIDER_CATEGORIES;
5043
5057
  exports.Divider = Divider;
5044
5058
  exports.GRID_CATEGORIES = GRID_CATEGORIES;
5059
+ exports.Grid2 = Grid2;
5045
5060
  exports.Grid3 = Grid3;
5046
5061
  exports.Grid4 = Grid4;
5047
5062
  exports.IMG_CATEGORIES = IMG_CATEGORIES;