@dmitryvim/form-builder 0.4.0 → 0.5.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.
package/dist/esm/index.js CHANGED
@@ -419,6 +419,20 @@ function ensureThemingHooks(doc) {
419
419
  min-height: var(--fb-slide-card-min-height);
420
420
  padding: var(--fb-slide-card-padding);
421
421
  }
422
+ /* Slides-mode outer grid. Responsive by design \u2014 column count derives from
423
+ container width and --fb-slide-min-width, not from a schema "columns" prop.
424
+ min(100%, ...) prevents the card from overflowing a narrow container.
425
+ Override per-form: set --fb-slide-min-width / --fb-slides-gap on any
426
+ ancestor (theme, host CSS, or the form root). */
427
+ .fb-container-slides {
428
+ display: grid;
429
+ gap: var(--fb-slides-gap, 14px);
430
+ align-items: stretch;
431
+ grid-template-columns: repeat(
432
+ auto-fit,
433
+ minmax(min(100%, var(--fb-slide-min-width, 280px)), 1fr)
434
+ );
435
+ }
422
436
  [data-fb-label-row] > label {
423
437
  font-size: var(--fb-label-section-font-size);
424
438
  letter-spacing: var(--fb-label-section-letter-spacing);
@@ -6790,10 +6804,7 @@ function renderSingleContainerElement(element, ctx, wrapper, pathKey) {
6790
6804
  containerWrap.appendChild(itemsWrap);
6791
6805
  wrapper.appendChild(containerWrap);
6792
6806
  }
6793
- function getChildWrapperClass(isSlides, columns) {
6794
- if (isSlides) {
6795
- return "fb-row";
6796
- }
6807
+ function getChildWrapperClass(columns) {
6797
6808
  const cols = columns || 1;
6798
6809
  return cols === 1 ? "fb-row" : `grid grid-cols-${cols} gap-2`;
6799
6810
  }
@@ -6838,9 +6849,6 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
6838
6849
  const isSlides = element.displayMode === "slides";
6839
6850
  if (isSlides) {
6840
6851
  itemsWrap.className = "fb-container-slides";
6841
- const slideCols = element.columns;
6842
- const gridTemplateColumns = typeof slideCols === "number" && slideCols > 0 ? `repeat(${slideCols}, 1fr)` : "repeat(auto-fit, minmax(280px, 1fr))";
6843
- itemsWrap.style.cssText = `display:grid;grid-template-columns:${gridTemplateColumns};gap:var(--fb-slides-gap, 14px);align-items:start;`;
6844
6852
  } else {
6845
6853
  itemsWrap.className = "fb-row";
6846
6854
  }
@@ -6876,7 +6884,9 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
6876
6884
  item.setAttribute("data-fb-slide-card", "");
6877
6885
  }
6878
6886
  const childWrapper = document.createElement("div");
6879
- childWrapper.className = getChildWrapperClass(isSlides, element.columns);
6887
+ childWrapper.className = getChildWrapperClass(
6888
+ isSlides ? void 0 : element.columns
6889
+ );
6880
6890
  element.elements.forEach((child) => {
6881
6891
  if (child.type !== "markdown" && (child.hidden || child.type === "hidden")) {
6882
6892
  childWrapper.appendChild(
@@ -6942,16 +6952,9 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
6942
6952
  item.setAttribute("data-fb-slide-card", "");
6943
6953
  }
6944
6954
  const childWrapper = document.createElement("div");
6945
- if (isSlides) {
6946
- childWrapper.className = "fb-row";
6947
- } else {
6948
- const columns = element.columns || 1;
6949
- if (columns === 1) {
6950
- childWrapper.className = "fb-row";
6951
- } else {
6952
- childWrapper.className = `grid grid-cols-${columns} gap-2`;
6953
- }
6954
- }
6955
+ childWrapper.className = getChildWrapperClass(
6956
+ isSlides ? void 0 : element.columns
6957
+ );
6955
6958
  element.elements.forEach((child) => {
6956
6959
  if (child.type !== "markdown" && (child.hidden || child.type === "hidden")) {
6957
6960
  const prefillVal = prefillObj?.[child.key] ?? ("default" in child ? child.default : null) ?? null;
@@ -6989,16 +6992,9 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
6989
6992
  item.setAttribute("data-fb-slide-card", "");
6990
6993
  }
6991
6994
  const childWrapper = document.createElement("div");
6992
- if (isSlides) {
6993
- childWrapper.className = "fb-row";
6994
- } else {
6995
- const columns = element.columns || 1;
6996
- if (columns === 1) {
6997
- childWrapper.className = "fb-row";
6998
- } else {
6999
- childWrapper.className = `grid grid-cols-${columns} gap-2`;
7000
- }
7001
- }
6995
+ childWrapper.className = getChildWrapperClass(
6996
+ isSlides ? void 0 : element.columns
6997
+ );
7002
6998
  element.elements.forEach((child) => {
7003
6999
  if (child.type !== "markdown" && (child.hidden || child.type === "hidden")) {
7004
7000
  childWrapper.appendChild(
@@ -7027,7 +7023,6 @@ function renderMultipleContainerElement(element, ctx, wrapper, _pathKey) {
7027
7023
  containerWrap.appendChild(itemsWrap);
7028
7024
  if (!containerIsReadonly) {
7029
7025
  if (isSlides) {
7030
- itemsWrap.style.alignItems = "stretch";
7031
7026
  const handle = createSlideAddTile(handleAddItem, {
7032
7027
  label: element.addLabel
7033
7028
  });