@delmaredigital/payload-puck 0.6.27 → 0.6.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.
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  * Width distribution supports equal columns or fr ratios (e.g. 2:1, 1:2, 1:1:2)
14
14
  * for asymmetric layouts.
15
15
  */ import { useId } from 'react';
16
- import { cn, dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
16
+ import { dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
17
17
  import { AnimatedWrapper } from '../AnimatedWrapper.js';
18
18
  import { createPaddingField } from '../../fields/PaddingField.js';
19
19
  import { createBorderField } from '../../fields/BorderField.js';
@@ -221,15 +221,19 @@ export const ColumnsConfig = {
221
221
  const dimensionsResult = responsiveValueToCSS(dimensions, dimensionsValueToCSS, contentClass);
222
222
  const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
223
223
  if (visibilityCSS) mediaQueries.push(visibilityCSS);
224
- const contentClasses = cn('flex flex-col w-full', 'md:grid', contentClass);
225
- const contentStyles = {
226
- gap,
227
- ...dimensionsResult.baseStyles
228
- };
229
224
  if (dimensionsResult.mediaQueryCSS) mediaQueries.push(dimensionsResult.mediaQueryCSS);
225
+ // Self-contained CSS grid — does NOT depend on the consumer's Tailwind
226
+ // generating utility classes. Single column on mobile (stacked); switches to
227
+ // the multi-column template at >=768px via the scoped media query below.
228
+ // NOTE: grid-template-columns must NOT be set inline — an inline style would
229
+ // outrank the @media rule below (inline beats stylesheet, media queries
230
+ // included), pinning the layout to one column. Both the mobile base and the
231
+ // responsive override live in the scoped <style> so the media query can win.
230
232
  const colsTemplate = resolveColumnsTemplate(safeCount, distribution);
231
233
  const gridStyles = {
232
- ...contentStyles,
234
+ display: 'grid',
235
+ gap,
236
+ ...dimensionsResult.baseStyles,
233
237
  '--cols-template': colsTemplate
234
238
  };
235
239
  const slots = [
@@ -250,7 +254,7 @@ export const ColumnsConfig = {
250
254
  style: wrapperStyles,
251
255
  children: [
252
256
  /*#__PURE__*/ _jsx("div", {
253
- className: contentClasses,
257
+ className: contentClass,
254
258
  style: gridStyles,
255
259
  children: slots.slice(0, safeCount).map((Slot, i)=>{
256
260
  const ColumnSlot = Slot;
@@ -259,6 +263,7 @@ export const ColumnsConfig = {
259
263
  }),
260
264
  /*#__PURE__*/ _jsx("style", {
261
265
  children: `
266
+ .${contentClass} { grid-template-columns: 1fr; }
262
267
  @media (min-width: 768px) {
263
268
  .${contentClass} {
264
269
  grid-template-columns: var(--cols-template);
@@ -14,7 +14,7 @@
14
14
  * This is the server-safe variant (slots only, no editor fields). For the full
15
15
  * editor version with fields, use Columns.tsx
16
16
  */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import { cn, dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
17
+ import { dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
18
18
  import { AnimatedWrapper } from '../AnimatedWrapper.js';
19
19
  /** Maximum number of column slots the component declares. */ export const MAX_COLUMNS = 4;
20
20
  const defaultProps = {
@@ -101,18 +101,20 @@ export const ColumnsConfig = {
101
101
  // Visibility media queries
102
102
  const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
103
103
  if (visibilityCSS) mediaQueries.push(visibilityCSS);
104
- // Tailwind: flex column on mobile, grid on md+
105
- const contentClasses = cn('flex flex-col w-full', 'md:grid', contentClass);
106
- const contentStyles = {
107
- gap,
108
- ...dimensionsResult.baseStyles
109
- };
110
104
  if (dimensionsResult.mediaQueryCSS) mediaQueries.push(dimensionsResult.mediaQueryCSS);
111
- // grid-template-columns is dynamic, so drive it from a CSS var and scope the
112
- // media-query rule to this instance's content class (no cross-instance leak).
105
+ // Self-contained CSS grid does NOT depend on the consumer's Tailwind
106
+ // generating utility classes. Single column on mobile (stacked); switches to
107
+ // the multi-column template at >=768px via the scoped media query below.
108
+ // grid-template-columns is dynamic, so drive it from a CSS var.
109
+ // NOTE: grid-template-columns must NOT be set inline — an inline style would
110
+ // outrank the @media rule below (inline beats stylesheet, media queries
111
+ // included), pinning the layout to one column. Both the mobile base and the
112
+ // responsive override live in the scoped <style> so the media query can win.
113
113
  const colsTemplate = resolveColumnsTemplate(safeCount, distribution);
114
114
  const gridStyles = {
115
- ...contentStyles,
115
+ display: 'grid',
116
+ gap,
117
+ ...dimensionsResult.baseStyles,
116
118
  '--cols-template': colsTemplate
117
119
  };
118
120
  const slots = [
@@ -133,7 +135,7 @@ export const ColumnsConfig = {
133
135
  style: wrapperStyles,
134
136
  children: [
135
137
  /*#__PURE__*/ _jsx("div", {
136
- className: contentClasses,
138
+ className: contentClass,
137
139
  style: gridStyles,
138
140
  children: slots.slice(0, safeCount).map((Slot, i)=>{
139
141
  const ColumnSlot = Slot;
@@ -142,6 +144,7 @@ export const ColumnsConfig = {
142
144
  }),
143
145
  /*#__PURE__*/ _jsx("style", {
144
146
  children: `
147
+ .${contentClass} { grid-template-columns: 1fr; }
145
148
  @media (min-width: 768px) {
146
149
  .${contentClass} {
147
150
  grid-template-columns: var(--cols-template);
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  * - gap: Different gap at different breakpoints
15
15
  * - visibility: Show/hide at different breakpoints
16
16
  */ import { useId } from 'react';
17
- import { cn, dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
17
+ import { dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
18
18
  import { AnimatedWrapper } from '../AnimatedWrapper.js';
19
19
  import { createPaddingField } from '../../fields/PaddingField.js';
20
20
  import { createBorderField } from '../../fields/BorderField.js';
@@ -176,19 +176,21 @@ export const GridConfig = {
176
176
  if (visibilityCSS) {
177
177
  mediaQueries.push(visibilityCSS);
178
178
  }
179
- // Tailwind classes for responsive grid: flex column on mobile, grid on md+
180
- const contentClasses = cn('flex flex-col w-full', 'md:grid', contentClass);
181
- // Dynamic styles that need inline (user-controlled values: gap, columns)
182
- const contentStyles = {
183
- gap,
184
- ...dimensionsResult.baseStyles
185
- };
186
179
  if (dimensionsResult.mediaQueryCSS) {
187
180
  mediaQueries.push(dimensionsResult.mediaQueryCSS);
188
181
  }
189
- // Grid template columns must be inline since numColumns is dynamic
182
+ // Self-contained CSS grid does NOT depend on the consumer's Tailwind
183
+ // generating utility classes. Single column on mobile (children stacked);
184
+ // switches to the multi-column track at >=768px via the scoped media query.
185
+ // grid-template-columns is dynamic, so drive the column count from a CSS var.
186
+ // NOTE: grid-template-columns must NOT be set inline — an inline style would
187
+ // outrank the @media rule below (inline beats stylesheet, media queries
188
+ // included), pinning the layout to one column. Both the mobile base and the
189
+ // responsive override live in the scoped <style> so the media query can win.
190
190
  const gridStyles = {
191
- ...contentStyles,
191
+ display: 'grid',
192
+ gap,
193
+ ...dimensionsResult.baseStyles,
192
194
  '--grid-cols': numColumns
193
195
  };
194
196
  // Combine all media queries
@@ -204,13 +206,14 @@ export const GridConfig = {
204
206
  style: wrapperStyles,
205
207
  children: [
206
208
  /*#__PURE__*/ _jsx(Content, {
207
- className: contentClasses,
209
+ className: contentClass,
208
210
  style: gridStyles
209
211
  }),
210
212
  /*#__PURE__*/ _jsx("style", {
211
213
  children: `
214
+ .${contentClass} { grid-template-columns: 1fr; }
212
215
  @media (min-width: 768px) {
213
- .flex.md\\:grid {
216
+ .${contentClass} {
214
217
  grid-template-columns: repeat(var(--grid-cols), 1fr);
215
218
  }
216
219
  }
@@ -14,7 +14,7 @@
14
14
  * - margin: Different margins at different breakpoints
15
15
  * - visibility: Show/hide at different breakpoints
16
16
  */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import { cn, dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
17
+ import { dimensionsValueToCSS, marginValueToCSS, paddingValueToCSS, borderValueToCSS, backgroundValueToCSS, responsiveValueToCSS, visibilityValueToCSS } from '../../fields/shared.js';
18
18
  import { AnimatedWrapper } from '../AnimatedWrapper.js';
19
19
  // Simple ID generator for server-side rendering
20
20
  let idCounter = 0;
@@ -85,19 +85,21 @@ export const GridConfig = {
85
85
  if (visibilityCSS) {
86
86
  mediaQueries.push(visibilityCSS);
87
87
  }
88
- // Tailwind classes for responsive grid: flex column on mobile, grid on md+
89
- const contentClasses = cn('flex flex-col w-full', 'md:grid', contentClass);
90
- // Dynamic styles that need inline (user-controlled values: gap, columns)
91
- const contentStyles = {
92
- gap,
93
- ...dimensionsResult.baseStyles
94
- };
95
88
  if (dimensionsResult.mediaQueryCSS) {
96
89
  mediaQueries.push(dimensionsResult.mediaQueryCSS);
97
90
  }
98
- // Grid template columns must be inline since numColumns is dynamic
91
+ // Self-contained CSS grid does NOT depend on the consumer's Tailwind
92
+ // generating utility classes. Single column on mobile (children stacked);
93
+ // switches to the multi-column track at >=768px via the scoped media query.
94
+ // grid-template-columns is dynamic, so drive the column count from a CSS var.
95
+ // NOTE: grid-template-columns must NOT be set inline — an inline style would
96
+ // outrank the @media rule below (inline beats stylesheet, media queries
97
+ // included), pinning the layout to one column. Both the mobile base and the
98
+ // responsive override live in the scoped <style> so the media query can win.
99
99
  const gridStyles = {
100
- ...contentStyles,
100
+ display: 'grid',
101
+ gap,
102
+ ...dimensionsResult.baseStyles,
101
103
  '--grid-cols': numColumns
102
104
  };
103
105
  // Combine all media queries
@@ -115,13 +117,14 @@ export const GridConfig = {
115
117
  style: wrapperStyles,
116
118
  children: [
117
119
  /*#__PURE__*/ _jsx(ContentSlot, {
118
- className: contentClasses,
120
+ className: contentClass,
119
121
  style: gridStyles
120
122
  }),
121
123
  /*#__PURE__*/ _jsx("style", {
122
124
  children: `
125
+ .${contentClass} { grid-template-columns: 1fr; }
123
126
  @media (min-width: 768px) {
124
- .flex.md\\:grid {
127
+ .${contentClass} {
125
128
  grid-template-columns: repeat(var(--grid-cols), 1fr);
126
129
  }
127
130
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.6.27";
1
+ export declare const VERSION = "0.6.29";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Auto-generated by scripts/generate-version.js - do not edit manually
2
- export const VERSION = '0.6.27';
2
+ export const VERSION = '0.6.29';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delmaredigital/payload-puck",
3
- "version": "0.6.27",
3
+ "version": "0.6.29",
4
4
  "description": "Puck visual page builder plugin for Payload CMS",
5
5
  "type": "module",
6
6
  "license": "MIT",