@wordpress/dataviews 7.0.1-next.0f6f9d12c.0 → 7.0.1-next.f34ab90e9.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/build/components/dataviews-item-actions/index.js +1 -10
  3. package/build/components/dataviews-item-actions/index.js.map +1 -1
  4. package/build/dataform-controls/boolean.js +15 -7
  5. package/build/dataform-controls/boolean.js.map +1 -1
  6. package/build/dataform-controls/email.js +14 -7
  7. package/build/dataform-controls/email.js.map +1 -1
  8. package/build/dataform-controls/integer.js +14 -7
  9. package/build/dataform-controls/integer.js.map +1 -1
  10. package/build/dataform-controls/text.js +14 -7
  11. package/build/dataform-controls/text.js.map +1 -1
  12. package/build/dataforms-layouts/panel/dropdown.js +124 -0
  13. package/build/dataforms-layouts/panel/dropdown.js.map +1 -0
  14. package/build/dataforms-layouts/panel/index.js +19 -127
  15. package/build/dataforms-layouts/panel/index.js.map +1 -1
  16. package/build/dataforms-layouts/panel/modal.js +125 -0
  17. package/build/dataforms-layouts/panel/modal.js.map +1 -0
  18. package/build/normalize-form-fields.js +3 -2
  19. package/build/normalize-form-fields.js.map +1 -1
  20. package/build/types.js.map +1 -1
  21. package/build-module/components/dataviews-item-actions/index.js +1 -10
  22. package/build-module/components/dataviews-item-actions/index.js.map +1 -1
  23. package/build-module/dataform-controls/boolean.js +15 -7
  24. package/build-module/dataform-controls/boolean.js.map +1 -1
  25. package/build-module/dataform-controls/email.js +15 -8
  26. package/build-module/dataform-controls/email.js.map +1 -1
  27. package/build-module/dataform-controls/integer.js +15 -8
  28. package/build-module/dataform-controls/integer.js.map +1 -1
  29. package/build-module/dataform-controls/text.js +15 -8
  30. package/build-module/dataform-controls/text.js.map +1 -1
  31. package/build-module/dataforms-layouts/panel/dropdown.js +118 -0
  32. package/build-module/dataforms-layouts/panel/dropdown.js.map +1 -0
  33. package/build-module/dataforms-layouts/panel/index.js +23 -131
  34. package/build-module/dataforms-layouts/panel/index.js.map +1 -1
  35. package/build-module/dataforms-layouts/panel/modal.js +119 -0
  36. package/build-module/dataforms-layouts/panel/modal.js.map +1 -0
  37. package/build-module/normalize-form-fields.js +3 -2
  38. package/build-module/normalize-form-fields.js.map +1 -1
  39. package/build-module/types.js.map +1 -1
  40. package/build-style/style-rtl.css +4 -0
  41. package/build-style/style.css +4 -0
  42. package/build-types/components/dataform/stories/index.story.d.ts +58 -25
  43. package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
  44. package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
  45. package/build-types/dataform-controls/boolean.d.ts.map +1 -1
  46. package/build-types/dataform-controls/email.d.ts.map +1 -1
  47. package/build-types/dataform-controls/integer.d.ts.map +1 -1
  48. package/build-types/dataform-controls/text.d.ts.map +1 -1
  49. package/build-types/dataforms-layouts/panel/dropdown.d.ts +14 -0
  50. package/build-types/dataforms-layouts/panel/dropdown.d.ts.map +1 -0
  51. package/build-types/dataforms-layouts/panel/index.d.ts.map +1 -1
  52. package/build-types/dataforms-layouts/panel/modal.d.ts +13 -0
  53. package/build-types/dataforms-layouts/panel/modal.d.ts.map +1 -0
  54. package/build-types/normalize-form-fields.d.ts.map +1 -1
  55. package/build-types/types.d.ts +2 -0
  56. package/build-types/types.d.ts.map +1 -1
  57. package/build-wp/index.js +394 -178
  58. package/package.json +15 -15
  59. package/src/components/dataform/stories/index.story.tsx +354 -219
  60. package/src/components/dataviews-item-actions/index.tsx +7 -16
  61. package/src/dataform-controls/boolean.tsx +24 -10
  62. package/src/dataform-controls/email.tsx +24 -11
  63. package/src/dataform-controls/integer.tsx +27 -13
  64. package/src/dataform-controls/text.tsx +24 -11
  65. package/src/dataforms-layouts/panel/dropdown.tsx +160 -0
  66. package/src/dataforms-layouts/panel/index.tsx +28 -172
  67. package/src/dataforms-layouts/panel/modal.tsx +165 -0
  68. package/src/dataforms-layouts/panel/style.scss +4 -0
  69. package/src/normalize-form-fields.ts +1 -0
  70. package/src/test/dataform.tsx +169 -0
  71. package/src/test/normalize-form-fields.ts +15 -3
  72. package/src/types.ts +2 -0
  73. package/tsconfig.tsbuildinfo +1 -1
package/build-wp/index.js CHANGED
@@ -5315,7 +5315,7 @@ function addContainer(ariaLive = "polite") {
5315
5315
  const container = document.createElement("div");
5316
5316
  container.id = `a11y-speak-${ariaLive}`;
5317
5317
  container.className = "a11y-speak-region";
5318
- container.setAttribute("style", "position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;");
5318
+ container.setAttribute("style", "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;");
5319
5319
  container.setAttribute("aria-live", ariaLive);
5320
5320
  container.setAttribute("aria-relevant", "additions text");
5321
5321
  container.setAttribute("aria-atomic", "true");
@@ -5335,8 +5335,8 @@ function addIntroText() {
5335
5335
  introText.id = "a11y-speak-intro-text";
5336
5336
  introText.className = "a11y-speak-intro-text";
5337
5337
  introText.textContent = __3("Notifications");
5338
- introText.setAttribute("style", "position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;");
5339
- introText.setAttribute("hidden", "hidden");
5338
+ introText.setAttribute("style", "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;");
5339
+ introText.setAttribute("hidden", "");
5340
5340
  const {
5341
5341
  body
5342
5342
  } = document;
@@ -12515,15 +12515,41 @@ var DateRangeCalendar = ({
12515
12515
 
12516
12516
  // ../components/build-module/validated-form-controls/control-with-error.js
12517
12517
  import { __ as __15 } from "@wordpress/i18n";
12518
- import { Fragment as _Fragment11, jsxs as _jsxs32, jsx as _jsx134 } from "react/jsx-runtime";
12518
+
12519
+ // ../components/build-module/validated-form-controls/validity-indicator.js
12520
+ import clsx28 from "clsx";
12521
+ import { jsx as _jsx134, jsxs as _jsxs32 } from "react/jsx-runtime";
12522
+ function ValidityIndicator({
12523
+ type,
12524
+ message
12525
+ }) {
12526
+ const ICON = {
12527
+ valid: published_default,
12528
+ invalid: error_default
12529
+ };
12530
+ return /* @__PURE__ */ _jsxs32("p", {
12531
+ className: clsx28("components-validated-control__indicator", `is-${type}`),
12532
+ children: [type === "validating" ? /* @__PURE__ */ _jsx134(spinner_default, {
12533
+ className: "components-validated-control__indicator-spinner"
12534
+ }) : /* @__PURE__ */ _jsx134(icon_default2, {
12535
+ className: "components-validated-control__indicator-icon",
12536
+ icon: ICON[type],
12537
+ size: 16,
12538
+ fill: "currentColor"
12539
+ }), message]
12540
+ });
12541
+ }
12542
+
12543
+ // ../components/build-module/validated-form-controls/control-with-error.js
12544
+ import { Fragment as _Fragment11, jsxs as _jsxs33, jsx as _jsx135 } from "react/jsx-runtime";
12519
12545
  function appendRequiredIndicator(label, required, markWhenOptional) {
12520
12546
  if (required && !markWhenOptional) {
12521
- return /* @__PURE__ */ _jsxs32(_Fragment11, {
12547
+ return /* @__PURE__ */ _jsxs33(_Fragment11, {
12522
12548
  children: [label, " ", `(${__15("Required")})`]
12523
12549
  });
12524
12550
  }
12525
12551
  if (!required && markWhenOptional) {
12526
- return /* @__PURE__ */ _jsxs32(_Fragment11, {
12552
+ return /* @__PURE__ */ _jsxs33(_Fragment11, {
12527
12553
  children: [label, " ", `(${__15("Optional")})`]
12528
12554
  });
12529
12555
  }
@@ -12532,11 +12558,13 @@ function appendRequiredIndicator(label, required, markWhenOptional) {
12532
12558
  function UnforwardedControlWithError({
12533
12559
  required,
12534
12560
  markWhenOptional,
12535
- customValidator,
12561
+ onValidate,
12562
+ customValidity,
12536
12563
  getValidityTarget,
12537
12564
  children
12538
12565
  }, forwardedRef) {
12539
12566
  const [errorMessage, setErrorMessage] = useState();
12567
+ const [statusMessage, setStatusMessage] = useState();
12540
12568
  const [isTouched, setIsTouched] = useState(false);
12541
12569
  useEffect(() => {
12542
12570
  const validityTarget = getValidityTarget();
@@ -12546,12 +12574,45 @@ function UnforwardedControlWithError({
12546
12574
  validityTarget?.removeEventListener("invalid", showValidationMessage);
12547
12575
  };
12548
12576
  });
12549
- const validate = () => {
12550
- const message = customValidator?.();
12577
+ useEffect(() => {
12578
+ if (!isTouched) {
12579
+ return;
12580
+ }
12551
12581
  const validityTarget = getValidityTarget();
12552
- validityTarget?.setCustomValidity(message !== null && message !== void 0 ? message : "");
12553
- setErrorMessage(validityTarget?.validationMessage);
12554
- };
12582
+ if (!customValidity?.type) {
12583
+ validityTarget?.setCustomValidity("");
12584
+ setErrorMessage(validityTarget?.validationMessage);
12585
+ setStatusMessage(void 0);
12586
+ return;
12587
+ }
12588
+ switch (customValidity.type) {
12589
+ case "validating": {
12590
+ const timer = setTimeout(() => {
12591
+ setStatusMessage({
12592
+ type: "validating",
12593
+ message: customValidity.message
12594
+ });
12595
+ }, 1e3);
12596
+ return () => clearTimeout(timer);
12597
+ }
12598
+ case "valid": {
12599
+ validityTarget?.setCustomValidity("");
12600
+ setErrorMessage(validityTarget?.validationMessage);
12601
+ setStatusMessage({
12602
+ type: "valid",
12603
+ message: customValidity.message
12604
+ });
12605
+ return;
12606
+ }
12607
+ case "invalid": {
12608
+ var _customValidity$messa;
12609
+ validityTarget?.setCustomValidity((_customValidity$messa = customValidity.message) !== null && _customValidity$messa !== void 0 ? _customValidity$messa : "");
12610
+ setErrorMessage(validityTarget?.validationMessage);
12611
+ setStatusMessage(void 0);
12612
+ return void 0;
12613
+ }
12614
+ }
12615
+ }, [isTouched, customValidity?.type, customValidity?.message, getValidityTarget]);
12555
12616
  const onBlur = (event) => {
12556
12617
  if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
12557
12618
  setIsTouched(true);
@@ -12562,24 +12623,24 @@ function UnforwardedControlWithError({
12562
12623
  }
12563
12624
  return;
12564
12625
  }
12565
- validate();
12626
+ onValidate?.();
12566
12627
  }
12567
12628
  };
12568
12629
  const onChange = (...args) => {
12569
12630
  children.props.onChange?.(...args);
12570
12631
  if (isTouched || errorMessage) {
12571
- validate();
12632
+ onValidate?.();
12572
12633
  }
12573
12634
  };
12574
12635
  const onKeyDown = (event) => {
12575
12636
  if (event.key === "Enter") {
12576
- validate();
12637
+ onValidate?.();
12577
12638
  }
12578
12639
  };
12579
12640
  return (
12580
12641
  // Disable reason: Just listening to a bubbled event, not for interaction.
12581
12642
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
12582
- /* @__PURE__ */ _jsxs32("div", {
12643
+ /* @__PURE__ */ _jsxs33("div", {
12583
12644
  className: "components-validated-control",
12584
12645
  ref: forwardedRef,
12585
12646
  onBlur,
@@ -12588,17 +12649,15 @@ function UnforwardedControlWithError({
12588
12649
  label: appendRequiredIndicator(children.props.label, required, markWhenOptional),
12589
12650
  onChange,
12590
12651
  required
12591
- }), /* @__PURE__ */ _jsx134("div", {
12652
+ }), /* @__PURE__ */ _jsxs33("div", {
12592
12653
  "aria-live": "polite",
12593
- children: errorMessage && /* @__PURE__ */ _jsxs32("p", {
12594
- className: "components-validated-control__error",
12595
- children: [/* @__PURE__ */ _jsx134(icon_default2, {
12596
- className: "components-validated-control__error-icon",
12597
- icon: error_default,
12598
- size: 16,
12599
- fill: "currentColor"
12600
- }), errorMessage]
12601
- })
12654
+ children: [errorMessage && /* @__PURE__ */ _jsx135(ValidityIndicator, {
12655
+ type: "invalid",
12656
+ message: errorMessage
12657
+ }), !errorMessage && statusMessage && /* @__PURE__ */ _jsx135(ValidityIndicator, {
12658
+ type: statusMessage.type,
12659
+ message: statusMessage.message
12660
+ })]
12602
12661
  })]
12603
12662
  })
12604
12663
  );
@@ -12606,10 +12665,11 @@ function UnforwardedControlWithError({
12606
12665
  var ControlWithError = forwardRef(UnforwardedControlWithError);
12607
12666
 
12608
12667
  // ../components/build-module/validated-form-controls/components/number-control.js
12609
- import { jsx as _jsx135 } from "react/jsx-runtime";
12668
+ import { jsx as _jsx136 } from "react/jsx-runtime";
12610
12669
  var UnforwardedValidatedNumberControl = ({
12611
12670
  required,
12612
- customValidator,
12671
+ onValidate,
12672
+ customValidity,
12613
12673
  onChange,
12614
12674
  markWhenOptional,
12615
12675
  ...restProps
@@ -12617,14 +12677,15 @@ var UnforwardedValidatedNumberControl = ({
12617
12677
  const validityTargetRef = useRef(null);
12618
12678
  const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
12619
12679
  const valueRef = useRef(restProps.value);
12620
- return /* @__PURE__ */ _jsx135(ControlWithError, {
12680
+ return /* @__PURE__ */ _jsx136(ControlWithError, {
12621
12681
  required,
12622
12682
  markWhenOptional,
12623
- customValidator: () => {
12624
- return customValidator?.(valueRef.current);
12683
+ onValidate: () => {
12684
+ return onValidate?.(valueRef.current);
12625
12685
  },
12686
+ customValidity,
12626
12687
  getValidityTarget: () => validityTargetRef.current,
12627
- children: /* @__PURE__ */ _jsx135(number_control_default, {
12688
+ children: /* @__PURE__ */ _jsx136(number_control_default, {
12628
12689
  __next40pxDefaultSize: true,
12629
12690
  ref: mergedRefs,
12630
12691
  onChange: (value, ...args) => {
@@ -12638,10 +12699,11 @@ var UnforwardedValidatedNumberControl = ({
12638
12699
  var ValidatedNumberControl = forwardRef(UnforwardedValidatedNumberControl);
12639
12700
 
12640
12701
  // ../components/build-module/validated-form-controls/components/text-control.js
12641
- import { jsx as _jsx136 } from "react/jsx-runtime";
12702
+ import { jsx as _jsx137 } from "react/jsx-runtime";
12642
12703
  var UnforwardedValidatedTextControl = ({
12643
12704
  required,
12644
- customValidator,
12705
+ onValidate,
12706
+ customValidity,
12645
12707
  onChange,
12646
12708
  markWhenOptional,
12647
12709
  ...restProps
@@ -12649,14 +12711,15 @@ var UnforwardedValidatedTextControl = ({
12649
12711
  const validityTargetRef = useRef(null);
12650
12712
  const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
12651
12713
  const valueRef = useRef(restProps.value);
12652
- return /* @__PURE__ */ _jsx136(ControlWithError, {
12714
+ return /* @__PURE__ */ _jsx137(ControlWithError, {
12653
12715
  required,
12654
12716
  markWhenOptional,
12655
- customValidator: () => {
12656
- return customValidator?.(valueRef.current);
12717
+ onValidate: () => {
12718
+ return onValidate?.(valueRef.current);
12657
12719
  },
12720
+ customValidity,
12658
12721
  getValidityTarget: () => validityTargetRef.current,
12659
- children: /* @__PURE__ */ _jsx136(text_control_default, {
12722
+ children: /* @__PURE__ */ _jsx137(text_control_default, {
12660
12723
  __next40pxDefaultSize: true,
12661
12724
  __nextHasNoMarginBottom: true,
12662
12725
  ref: mergedRefs,
@@ -12671,10 +12734,11 @@ var UnforwardedValidatedTextControl = ({
12671
12734
  var ValidatedTextControl = forwardRef(UnforwardedValidatedTextControl);
12672
12735
 
12673
12736
  // ../components/build-module/validated-form-controls/components/toggle-control.js
12674
- import { jsx as _jsx137 } from "react/jsx-runtime";
12737
+ import { jsx as _jsx138 } from "react/jsx-runtime";
12675
12738
  var UnforwardedValidatedToggleControl = ({
12676
12739
  required,
12677
- customValidator,
12740
+ onValidate,
12741
+ customValidity,
12678
12742
  onChange,
12679
12743
  markWhenOptional,
12680
12744
  ...restProps
@@ -12687,14 +12751,15 @@ var UnforwardedValidatedToggleControl = ({
12687
12751
  validityTargetRef.current.required = required !== null && required !== void 0 ? required : false;
12688
12752
  }
12689
12753
  }, [required]);
12690
- return /* @__PURE__ */ _jsx137(ControlWithError, {
12754
+ return /* @__PURE__ */ _jsx138(ControlWithError, {
12691
12755
  required,
12692
12756
  markWhenOptional,
12693
- customValidator: () => {
12694
- return customValidator?.(valueRef.current);
12757
+ onValidate: () => {
12758
+ return onValidate?.(valueRef.current);
12695
12759
  },
12760
+ customValidity,
12696
12761
  getValidityTarget: () => validityTargetRef.current,
12697
- children: /* @__PURE__ */ _jsx137(toggle_control_default, {
12762
+ children: /* @__PURE__ */ _jsx138(toggle_control_default, {
12698
12763
  __nextHasNoMarginBottom: true,
12699
12764
  ref: mergedRefs,
12700
12765
  onChange: (value) => {
@@ -12937,13 +13002,13 @@ var dataviews_context_default = DataViewsContext;
12937
13002
  import { __ as __21, _x } from "@wordpress/i18n";
12938
13003
 
12939
13004
  // src/components/dataviews-filters/filter.tsx
12940
- import clsx29 from "clsx";
13005
+ import clsx30 from "clsx";
12941
13006
  import { __ as __18, sprintf as sprintf5 } from "@wordpress/i18n";
12942
13007
 
12943
13008
  // src/components/dataviews-filters/search-widget.tsx
12944
13009
  import * as Ariakit21 from "@ariakit/react";
12945
13010
  import removeAccents2 from "remove-accents";
12946
- import clsx28 from "clsx";
13011
+ import clsx29 from "clsx";
12947
13012
  import { __ as __17, sprintf as sprintf4 } from "@wordpress/i18n";
12948
13013
 
12949
13014
  // src/components/dataviews-filters/utils.ts
@@ -12982,7 +13047,7 @@ var MultiSelectionOption = ({ selected }) => {
12982
13047
  return /* @__PURE__ */ jsx(
12983
13048
  "span",
12984
13049
  {
12985
- className: clsx28(
13050
+ className: clsx29(
12986
13051
  "dataviews-filters__search-widget-listitem-multi-selection",
12987
13052
  { "is-selected": selected }
12988
13053
  ),
@@ -12994,7 +13059,7 @@ var SingleSelectionOption = ({ selected }) => {
12994
13059
  return /* @__PURE__ */ jsx(
12995
13060
  "span",
12996
13061
  {
12997
- className: clsx28(
13062
+ className: clsx29(
12998
13063
  "dataviews-filters__search-widget-listitem-single-selection",
12999
13064
  { "is-selected": selected }
13000
13065
  )
@@ -13714,7 +13779,7 @@ function Filter({
13714
13779
  children: /* @__PURE__ */ jsx3(
13715
13780
  "div",
13716
13781
  {
13717
- className: clsx29(
13782
+ className: clsx30(
13718
13783
  "dataviews-filters__summary-chip",
13719
13784
  {
13720
13785
  "has-reset": canResetOrRemove,
@@ -13759,7 +13824,7 @@ function Filter({
13759
13824
  children: /* @__PURE__ */ jsx3(
13760
13825
  "button",
13761
13826
  {
13762
- className: clsx29(
13827
+ className: clsx30(
13763
13828
  "dataviews-filters__summary-chip-remove",
13764
13829
  { "has-values": hasValues }
13765
13830
  ),
@@ -14109,7 +14174,7 @@ import { __ as __33 } from "@wordpress/i18n";
14109
14174
  import { __ as __32, isRTL as isRTL9 } from "@wordpress/i18n";
14110
14175
 
14111
14176
  // src/dataviews-layouts/table/index.tsx
14112
- import clsx30 from "clsx";
14177
+ import clsx31 from "clsx";
14113
14178
  import { __ as __27, sprintf as sprintf8 } from "@wordpress/i18n";
14114
14179
 
14115
14180
  // src/components/dataviews-selection-checkbox/index.tsx
@@ -14250,16 +14315,6 @@ function ItemActions({
14250
14315
  }
14251
14316
  );
14252
14317
  }
14253
- if (primaryActions.length === eligibleActions.length) {
14254
- return /* @__PURE__ */ jsx8(
14255
- PrimaryActions,
14256
- {
14257
- item: item2,
14258
- actions: primaryActions,
14259
- registry
14260
- }
14261
- );
14262
- }
14263
14318
  return /* @__PURE__ */ jsxs5(
14264
14319
  component_default9,
14265
14320
  {
@@ -14279,7 +14334,7 @@ function ItemActions({
14279
14334
  registry
14280
14335
  }
14281
14336
  ),
14282
- /* @__PURE__ */ jsx8(
14337
+ primaryActions.length < eligibleActions.length && /* @__PURE__ */ jsx8(
14283
14338
  CompactItemActions,
14284
14339
  {
14285
14340
  item: item2,
@@ -15044,7 +15099,7 @@ function TableColumnField({
15044
15099
  if (!field) {
15045
15100
  return null;
15046
15101
  }
15047
- const className = clsx30("dataviews-view-table__cell-content-wrapper", {
15102
+ const className = clsx31("dataviews-view-table__cell-content-wrapper", {
15048
15103
  "dataviews-view-table__cell-align-end": align === "end",
15049
15104
  "dataviews-view-table__cell-align-center": align === "center"
15050
15105
  });
@@ -15092,7 +15147,7 @@ function TableRow({
15092
15147
  return /* @__PURE__ */ jsxs9(
15093
15148
  "tr",
15094
15149
  {
15095
- className: clsx30("dataviews-view-table__row", {
15150
+ className: clsx31("dataviews-view-table__row", {
15096
15151
  "is-selected": hasPossibleBulkAction && isSelected,
15097
15152
  "is-hovered": isHovered,
15098
15153
  "has-bulk-actions": hasPossibleBulkAction
@@ -15182,7 +15237,7 @@ function TableRow({
15182
15237
  /* @__PURE__ */ jsx13(
15183
15238
  "td",
15184
15239
  {
15185
- className: clsx30("dataviews-view-table__actions-column", {
15240
+ className: clsx31("dataviews-view-table__actions-column", {
15186
15241
  "dataviews-view-table__actions-column--sticky": true,
15187
15242
  "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
15188
15243
  }),
@@ -15271,7 +15326,7 @@ function ViewTable({
15271
15326
  /* @__PURE__ */ jsxs9(
15272
15327
  "table",
15273
15328
  {
15274
- className: clsx30("dataviews-view-table", className, {
15329
+ className: clsx31("dataviews-view-table", className, {
15275
15330
  [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
15276
15331
  view.layout.density
15277
15332
  )
@@ -15347,7 +15402,7 @@ function ViewTable({
15347
15402
  !!actions?.length && /* @__PURE__ */ jsx13(
15348
15403
  "th",
15349
15404
  {
15350
- className: clsx30(
15405
+ className: clsx31(
15351
15406
  "dataviews-view-table__actions-column",
15352
15407
  {
15353
15408
  "dataviews-view-table__actions-column--sticky": true,
@@ -15427,7 +15482,7 @@ function ViewTable({
15427
15482
  /* @__PURE__ */ jsxs9(
15428
15483
  "div",
15429
15484
  {
15430
- className: clsx30({
15485
+ className: clsx31({
15431
15486
  "dataviews-loading": isLoading,
15432
15487
  "dataviews-no-results": !hasData && !isLoading
15433
15488
  }),
@@ -15443,7 +15498,7 @@ function ViewTable({
15443
15498
  var table_default = ViewTable;
15444
15499
 
15445
15500
  // src/dataviews-layouts/grid/index.tsx
15446
- import clsx31 from "clsx";
15501
+ import clsx32 from "clsx";
15447
15502
  import { __ as __28, sprintf as sprintf9 } from "@wordpress/i18n";
15448
15503
  import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
15449
15504
  var { Badge: Badge2 } = unlock3(privateApis);
@@ -15506,7 +15561,7 @@ function GridItem({
15506
15561
  component_default14,
15507
15562
  {
15508
15563
  spacing: 0,
15509
- className: clsx31("dataviews-view-grid__card", {
15564
+ className: clsx32("dataviews-view-grid__card", {
15510
15565
  "is-selected": hasBulkAction && isSelected
15511
15566
  }),
15512
15567
  onClickCapture: (event) => {
@@ -15714,7 +15769,7 @@ function ViewGrid({
15714
15769
  /* @__PURE__ */ jsx14(
15715
15770
  "div",
15716
15771
  {
15717
- className: clsx31(
15772
+ className: clsx32(
15718
15773
  "dataviews-view-grid",
15719
15774
  className
15720
15775
  ),
@@ -15757,7 +15812,7 @@ function ViewGrid({
15757
15812
  hasData && !dataByGroup && /* @__PURE__ */ jsx14(
15758
15813
  "div",
15759
15814
  {
15760
- className: clsx31("dataviews-view-grid", className),
15815
+ className: clsx32("dataviews-view-grid", className),
15761
15816
  style: {
15762
15817
  gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax(${usedPreviewSize}px, 1fr))`
15763
15818
  },
@@ -15797,7 +15852,7 @@ function ViewGrid({
15797
15852
  !hasData && /* @__PURE__ */ jsx14(
15798
15853
  "div",
15799
15854
  {
15800
- className: clsx31({
15855
+ className: clsx32({
15801
15856
  "dataviews-loading": isLoading,
15802
15857
  "dataviews-no-results": !isLoading
15803
15858
  }),
@@ -15811,7 +15866,7 @@ function ViewGrid({
15811
15866
  var grid_default = ViewGrid;
15812
15867
 
15813
15868
  // src/dataviews-layouts/list/index.tsx
15814
- import clsx32 from "clsx";
15869
+ import clsx33 from "clsx";
15815
15870
  import { __ as __29 } from "@wordpress/i18n";
15816
15871
  import { useRegistry as useRegistry3 } from "@wordpress/data";
15817
15872
  import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
@@ -16017,7 +16072,7 @@ function ListItem({
16017
16072
  )
16018
16073
  ),
16019
16074
  role: infiniteScrollEnabled ? "article" : "row",
16020
- className: clsx32({
16075
+ className: clsx33({
16021
16076
  "is-selected": isSelected,
16022
16077
  "is-hovered": isHovered
16023
16078
  }),
@@ -16205,7 +16260,7 @@ function ViewList(props) {
16205
16260
  return /* @__PURE__ */ jsx15(
16206
16261
  "div",
16207
16262
  {
16208
- className: clsx32({
16263
+ className: clsx33({
16209
16264
  "dataviews-loading": isLoading,
16210
16265
  "dataviews-no-results": !hasData && !isLoading
16211
16266
  }),
@@ -16219,7 +16274,7 @@ function ViewList(props) {
16219
16274
  {
16220
16275
  id: baseId,
16221
16276
  render: /* @__PURE__ */ jsx15("div", {}),
16222
- className: clsx32("dataviews-view-list", className),
16277
+ className: clsx33("dataviews-view-list", className),
16223
16278
  role: view.infiniteScrollEnabled ? "feed" : "grid",
16224
16279
  activeId: activeCompositeId,
16225
16280
  setActiveId: setActiveCompositeId,
@@ -16629,7 +16684,7 @@ var DataViewsSearch = memo(function Search({ label }) {
16629
16684
  var dataviews_search_default = DataViewsSearch;
16630
16685
 
16631
16686
  // src/components/dataviews-view-config/index.tsx
16632
- import clsx33 from "clsx";
16687
+ import clsx34 from "clsx";
16633
16688
  import { __ as __37, _x as _x4, sprintf as sprintf11 } from "@wordpress/i18n";
16634
16689
 
16635
16690
  // src/components/dataviews-view-config/infinite-scroll-toggle.tsx
@@ -16927,7 +16982,7 @@ function FieldItem({
16927
16982
  component_default9,
16928
16983
  {
16929
16984
  expanded: true,
16930
- className: clsx33(
16985
+ className: clsx34(
16931
16986
  "dataviews-field-control__field",
16932
16987
  `dataviews-field-control__field-${field.id}`,
16933
16988
  // The actions are hidden when the mouse is not hovering the item, or focus
@@ -17791,7 +17846,7 @@ function Checkbox({
17791
17846
  }
17792
17847
 
17793
17848
  // src/dataform-controls/relative-date-control.tsx
17794
- import clsx34 from "clsx";
17849
+ import clsx35 from "clsx";
17795
17850
  import { __ as __47 } from "@wordpress/i18n";
17796
17851
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
17797
17852
  var TIME_UNITS_OPTIONS = {
@@ -17835,7 +17890,7 @@ function RelativeDateControl({
17835
17890
  {
17836
17891
  id,
17837
17892
  __nextHasNoMarginBottom: true,
17838
- className: clsx34(className, "dataviews-controls__relative-date"),
17893
+ className: clsx35(className, "dataviews-controls__relative-date"),
17839
17894
  label,
17840
17895
  hideLabelFromVision,
17841
17896
  children: /* @__PURE__ */ jsxs16(component_default9, { spacing: 2.5, children: [
@@ -18340,6 +18395,7 @@ function Email({
18340
18395
  }) {
18341
18396
  const { id, label, placeholder, description } = field;
18342
18397
  const value = field.getValue({ item: data });
18398
+ const [customValidity, setCustomValidity] = useState(void 0);
18343
18399
  const onChangeControl = useCallback(
18344
18400
  (newValue) => onChange({
18345
18401
  [id]: newValue
@@ -18350,18 +18406,24 @@ function Email({
18350
18406
  ValidatedTextControl2,
18351
18407
  {
18352
18408
  required: !!field.isValid?.required,
18353
- customValidator: (newValue) => {
18354
- if (field.isValid?.custom) {
18355
- return field.isValid.custom(
18356
- {
18357
- ...data,
18358
- [id]: newValue
18359
- },
18360
- field
18361
- );
18409
+ onValidate: (newValue) => {
18410
+ const message = field.isValid?.custom?.(
18411
+ {
18412
+ ...data,
18413
+ [id]: newValue
18414
+ },
18415
+ field
18416
+ );
18417
+ if (message) {
18418
+ setCustomValidity({
18419
+ type: "invalid",
18420
+ message
18421
+ });
18422
+ return;
18362
18423
  }
18363
- return null;
18424
+ setCustomValidity(void 0);
18364
18425
  },
18426
+ customValidity,
18365
18427
  type: "email",
18366
18428
  label,
18367
18429
  placeholder,
@@ -18439,6 +18501,7 @@ function Integer({
18439
18501
  }) {
18440
18502
  const { id, label, description } = field;
18441
18503
  const value = field.getValue({ item: data }) ?? "";
18504
+ const [customValidity, setCustomValidity] = useState(void 0);
18442
18505
  const onChangeControl = useCallback(
18443
18506
  (newValue) => {
18444
18507
  onChange({
@@ -18465,18 +18528,24 @@ function Integer({
18465
18528
  ValidatedNumberControl2,
18466
18529
  {
18467
18530
  required: !!field.isValid?.required,
18468
- customValidator: (newValue) => {
18469
- if (field.isValid?.custom) {
18470
- return field.isValid.custom(
18471
- {
18472
- ...data,
18473
- [id]: [void 0, "", null].includes(newValue) ? void 0 : Number(newValue)
18474
- },
18475
- field
18476
- );
18531
+ onValidate: (newValue) => {
18532
+ const message = field.isValid?.custom?.(
18533
+ {
18534
+ ...data,
18535
+ [id]: [void 0, "", null].includes(newValue) ? void 0 : Number(newValue)
18536
+ },
18537
+ field
18538
+ );
18539
+ if (message) {
18540
+ setCustomValidity({
18541
+ type: "invalid",
18542
+ message
18543
+ });
18544
+ return;
18477
18545
  }
18478
- return null;
18546
+ setCustomValidity(void 0);
18479
18547
  },
18548
+ customValidity,
18480
18549
  label,
18481
18550
  help: description,
18482
18551
  value,
@@ -18578,6 +18647,7 @@ function Text3({
18578
18647
  }) {
18579
18648
  const { id, label, placeholder, description } = field;
18580
18649
  const value = field.getValue({ item: data });
18650
+ const [customValidity, setCustomValidity] = useState(void 0);
18581
18651
  const onChangeControl = useCallback(
18582
18652
  (newValue) => onChange({
18583
18653
  [id]: newValue
@@ -18588,18 +18658,24 @@ function Text3({
18588
18658
  ValidatedTextControl3,
18589
18659
  {
18590
18660
  required: !!field.isValid?.required,
18591
- customValidator: (newValue) => {
18592
- if (field.isValid?.custom) {
18593
- return field.isValid.custom(
18594
- {
18595
- ...data,
18596
- [id]: newValue
18597
- },
18598
- field
18599
- );
18661
+ onValidate: (newValue) => {
18662
+ const message = field.isValid?.custom?.(
18663
+ {
18664
+ ...data,
18665
+ [id]: newValue
18666
+ },
18667
+ field
18668
+ );
18669
+ if (message) {
18670
+ setCustomValidity({
18671
+ type: "invalid",
18672
+ message
18673
+ });
18674
+ return;
18600
18675
  }
18601
- return null;
18676
+ setCustomValidity(void 0);
18602
18677
  },
18678
+ customValidity,
18603
18679
  label,
18604
18680
  placeholder,
18605
18681
  value: value ?? "",
@@ -18667,22 +18743,29 @@ function Boolean2({
18667
18743
  hideLabelFromVision
18668
18744
  }) {
18669
18745
  const { id, getValue, label } = field;
18746
+ const [customValidity, setCustomValidity] = useState(void 0);
18670
18747
  return /* @__PURE__ */ jsx34(
18671
18748
  ValidatedToggleControl2,
18672
18749
  {
18673
18750
  required: !!field.isValid.required,
18674
- customValidator: (newValue) => {
18675
- if (field.isValid?.custom) {
18676
- return field.isValid.custom(
18677
- {
18678
- ...data,
18679
- [id]: newValue
18680
- },
18681
- field
18682
- );
18751
+ onValidate: (newValue) => {
18752
+ const message = field.isValid?.custom?.(
18753
+ {
18754
+ ...data,
18755
+ [id]: newValue
18756
+ },
18757
+ field
18758
+ );
18759
+ if (message) {
18760
+ setCustomValidity({
18761
+ type: "invalid",
18762
+ message
18763
+ });
18764
+ return;
18683
18765
  }
18684
- return null;
18766
+ setCustomValidity(void 0);
18685
18767
  },
18768
+ customValidity,
18686
18769
  hidden: hideLabelFromVision,
18687
18770
  __nextHasNoMarginBottom: true,
18688
18771
  label,
@@ -19109,7 +19192,7 @@ function DataFormProvider({
19109
19192
  var dataform_context_default = DataFormContext;
19110
19193
 
19111
19194
  // src/dataforms-layouts/regular/index.tsx
19112
- import clsx35 from "clsx";
19195
+ import clsx36 from "clsx";
19113
19196
 
19114
19197
  // src/dataforms-layouts/is-combined-field.ts
19115
19198
  function isCombinedField(field) {
@@ -19131,7 +19214,8 @@ function normalizeLayout(layout) {
19131
19214
  } else if (layout?.type === "panel") {
19132
19215
  normalizedLayout = {
19133
19216
  type: "panel",
19134
- labelPosition: layout?.labelPosition ?? "side"
19217
+ labelPosition: layout?.labelPosition ?? "side",
19218
+ openAs: layout?.openAs ?? "dropdown"
19135
19219
  };
19136
19220
  } else if (layout?.type === "card") {
19137
19221
  if (layout.withHeader === false) {
@@ -19218,7 +19302,7 @@ function FormRegularField({
19218
19302
  /* @__PURE__ */ jsx38(
19219
19303
  "div",
19220
19304
  {
19221
- className: clsx35(
19305
+ className: clsx36(
19222
19306
  "dataforms-layouts-regular__field-label",
19223
19307
  `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
19224
19308
  ),
@@ -19264,7 +19348,9 @@ function FormRegularField({
19264
19348
  }
19265
19349
 
19266
19350
  // src/dataforms-layouts/panel/index.tsx
19267
- import clsx36 from "clsx";
19351
+ import clsx37 from "clsx";
19352
+
19353
+ // src/dataforms-layouts/panel/dropdown.tsx
19268
19354
  import { sprintf as sprintf12, __ as __51, _x as _x5 } from "@wordpress/i18n";
19269
19355
  import { Fragment as Fragment11, jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
19270
19356
  function DropdownHeader({
@@ -19381,6 +19467,146 @@ function PanelDropdown({
19381
19467
  }
19382
19468
  );
19383
19469
  }
19470
+ var dropdown_default2 = PanelDropdown;
19471
+
19472
+ // src/dataforms-layouts/panel/modal.tsx
19473
+ import { __ as __52, sprintf as sprintf13, _x as _x6 } from "@wordpress/i18n";
19474
+ import { Fragment as Fragment12, jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
19475
+ function ModalContent({
19476
+ data,
19477
+ form,
19478
+ fieldLabel,
19479
+ onChange,
19480
+ onClose
19481
+ }) {
19482
+ const [changes, setChanges] = useState({});
19483
+ const onApply = () => {
19484
+ onChange(changes);
19485
+ onClose();
19486
+ };
19487
+ const handleOnChange = (value) => {
19488
+ setChanges((prev) => ({ ...prev, ...value }));
19489
+ };
19490
+ const displayData = { ...data, ...changes };
19491
+ return /* @__PURE__ */ jsxs23(
19492
+ modal_default,
19493
+ {
19494
+ className: "dataforms-layouts-panel__modal",
19495
+ onRequestClose: onClose,
19496
+ isFullScreen: false,
19497
+ title: fieldLabel,
19498
+ size: "medium",
19499
+ children: [
19500
+ /* @__PURE__ */ jsx40(
19501
+ DataFormLayout,
19502
+ {
19503
+ data: displayData,
19504
+ form,
19505
+ onChange: handleOnChange,
19506
+ children: (FieldLayout, nestedField) => /* @__PURE__ */ jsx40(
19507
+ FieldLayout,
19508
+ {
19509
+ data: displayData,
19510
+ field: nestedField,
19511
+ onChange: handleOnChange,
19512
+ hideLabelFromVision: (form?.fields ?? []).length < 2
19513
+ },
19514
+ nestedField.id
19515
+ )
19516
+ }
19517
+ ),
19518
+ /* @__PURE__ */ jsxs23(
19519
+ component_default9,
19520
+ {
19521
+ className: "dataforms-layouts-panel__modal-footer",
19522
+ spacing: 3,
19523
+ children: [
19524
+ /* @__PURE__ */ jsx40(component_default6, {}),
19525
+ /* @__PURE__ */ jsx40(
19526
+ button_default,
19527
+ {
19528
+ variant: "tertiary",
19529
+ onClick: onClose,
19530
+ __next40pxDefaultSize: true,
19531
+ children: __52("Cancel")
19532
+ }
19533
+ ),
19534
+ /* @__PURE__ */ jsx40(
19535
+ button_default,
19536
+ {
19537
+ variant: "primary",
19538
+ onClick: onApply,
19539
+ __next40pxDefaultSize: true,
19540
+ children: __52("Apply")
19541
+ }
19542
+ )
19543
+ ]
19544
+ }
19545
+ )
19546
+ ]
19547
+ }
19548
+ );
19549
+ }
19550
+ function PanelModal({
19551
+ fieldDefinition,
19552
+ labelPosition,
19553
+ data,
19554
+ onChange,
19555
+ field
19556
+ }) {
19557
+ const [isOpen, setIsOpen] = useState(false);
19558
+ const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
19559
+ const form = useMemo(
19560
+ () => ({
19561
+ layout: DEFAULT_LAYOUT,
19562
+ fields: isCombinedField(field) ? field.children : (
19563
+ // If not explicit children return the field id itself.
19564
+ [{ id: field.id }]
19565
+ )
19566
+ }),
19567
+ [field]
19568
+ );
19569
+ return /* @__PURE__ */ jsxs23(Fragment12, { children: [
19570
+ /* @__PURE__ */ jsx40(
19571
+ button_default,
19572
+ {
19573
+ className: "dataforms-layouts-modal__field-control",
19574
+ size: "compact",
19575
+ variant: ["none", "top"].includes(labelPosition) ? "link" : "tertiary",
19576
+ "aria-expanded": isOpen,
19577
+ "aria-label": sprintf13(
19578
+ // translators: %s: Field name.
19579
+ _x6("Edit %s", "field"),
19580
+ fieldLabel || ""
19581
+ ),
19582
+ onClick: () => setIsOpen(true),
19583
+ disabled: fieldDefinition.readOnly === true,
19584
+ accessibleWhenDisabled: true,
19585
+ children: /* @__PURE__ */ jsx40(
19586
+ fieldDefinition.render,
19587
+ {
19588
+ item: data,
19589
+ field: fieldDefinition
19590
+ }
19591
+ )
19592
+ }
19593
+ ),
19594
+ isOpen && /* @__PURE__ */ jsx40(
19595
+ ModalContent,
19596
+ {
19597
+ data,
19598
+ form,
19599
+ fieldLabel: fieldLabel ?? "",
19600
+ onChange,
19601
+ onClose: () => setIsOpen(false)
19602
+ }
19603
+ )
19604
+ ] });
19605
+ }
19606
+ var modal_default2 = PanelModal;
19607
+
19608
+ // src/dataforms-layouts/panel/index.tsx
19609
+ import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
19384
19610
  function FormPanelField({
19385
19611
  data,
19386
19612
  field,
@@ -19411,14 +19637,34 @@ function FormPanelField({
19411
19637
  type: "panel"
19412
19638
  });
19413
19639
  const labelPosition = layout.labelPosition;
19414
- const labelClassName = clsx36(
19640
+ const labelClassName = clsx37(
19415
19641
  "dataforms-layouts-panel__field-label",
19416
19642
  `dataforms-layouts-panel__field-label--label-position-${labelPosition}`
19417
19643
  );
19418
19644
  const fieldLabel = isCombinedField(field) ? field.label : fieldDefinition?.label;
19645
+ const renderedControl = layout.openAs === "modal" ? /* @__PURE__ */ jsx41(
19646
+ modal_default2,
19647
+ {
19648
+ field,
19649
+ fieldDefinition,
19650
+ data,
19651
+ onChange,
19652
+ labelPosition
19653
+ }
19654
+ ) : /* @__PURE__ */ jsx41(
19655
+ dropdown_default2,
19656
+ {
19657
+ field,
19658
+ popoverAnchor,
19659
+ fieldDefinition,
19660
+ data,
19661
+ onChange,
19662
+ labelPosition
19663
+ }
19664
+ );
19419
19665
  if (labelPosition === "top") {
19420
- return /* @__PURE__ */ jsxs22(component_default14, { className: "dataforms-layouts-panel__field", spacing: 0, children: [
19421
- /* @__PURE__ */ jsx39(
19666
+ return /* @__PURE__ */ jsxs24(component_default14, { className: "dataforms-layouts-panel__field", spacing: 0, children: [
19667
+ /* @__PURE__ */ jsx41(
19422
19668
  "div",
19423
19669
  {
19424
19670
  className: labelClassName,
@@ -19426,57 +19672,27 @@ function FormPanelField({
19426
19672
  children: fieldLabel
19427
19673
  }
19428
19674
  ),
19429
- /* @__PURE__ */ jsx39("div", { className: "dataforms-layouts-panel__field-control", children: /* @__PURE__ */ jsx39(
19430
- PanelDropdown,
19431
- {
19432
- field,
19433
- popoverAnchor,
19434
- fieldDefinition,
19435
- data,
19436
- onChange,
19437
- labelPosition
19438
- }
19439
- ) })
19675
+ /* @__PURE__ */ jsx41("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl })
19440
19676
  ] });
19441
19677
  }
19442
19678
  if (labelPosition === "none") {
19443
- return /* @__PURE__ */ jsx39("div", { className: "dataforms-layouts-panel__field", children: /* @__PURE__ */ jsx39(
19444
- PanelDropdown,
19445
- {
19446
- field,
19447
- popoverAnchor,
19448
- fieldDefinition,
19449
- data,
19450
- onChange,
19451
- labelPosition
19452
- }
19453
- ) });
19679
+ return /* @__PURE__ */ jsx41("div", { className: "dataforms-layouts-panel__field", children: renderedControl });
19454
19680
  }
19455
- return /* @__PURE__ */ jsxs22(
19681
+ return /* @__PURE__ */ jsxs24(
19456
19682
  component_default9,
19457
19683
  {
19458
19684
  ref: setPopoverAnchor,
19459
19685
  className: "dataforms-layouts-panel__field",
19460
19686
  children: [
19461
- /* @__PURE__ */ jsx39("div", { className: labelClassName, children: fieldLabel }),
19462
- /* @__PURE__ */ jsx39("div", { className: "dataforms-layouts-panel__field-control", children: /* @__PURE__ */ jsx39(
19463
- PanelDropdown,
19464
- {
19465
- field,
19466
- popoverAnchor,
19467
- fieldDefinition,
19468
- data,
19469
- onChange,
19470
- labelPosition
19471
- }
19472
- ) })
19687
+ /* @__PURE__ */ jsx41("div", { className: labelClassName, children: fieldLabel }),
19688
+ /* @__PURE__ */ jsx41("div", { className: "dataforms-layouts-panel__field-control", children: renderedControl })
19473
19689
  ]
19474
19690
  }
19475
19691
  );
19476
19692
  }
19477
19693
 
19478
19694
  // src/dataforms-layouts/card/index.tsx
19479
- import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
19695
+ import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
19480
19696
  function useCollapsibleCard(initialIsOpen = true) {
19481
19697
  const [isOpen, setIsOpen] = useState(initialIsOpen);
19482
19698
  const toggle = useCallback(() => {
@@ -19486,7 +19702,7 @@ function useCollapsibleCard(initialIsOpen = true) {
19486
19702
  ({
19487
19703
  children,
19488
19704
  ...props
19489
- }) => /* @__PURE__ */ jsxs23(
19705
+ }) => /* @__PURE__ */ jsxs25(
19490
19706
  component_default21,
19491
19707
  {
19492
19708
  ...props,
@@ -19496,7 +19712,7 @@ function useCollapsibleCard(initialIsOpen = true) {
19496
19712
  ...props.style
19497
19713
  },
19498
19714
  children: [
19499
- /* @__PURE__ */ jsx40(
19715
+ /* @__PURE__ */ jsx42(
19500
19716
  "div",
19501
19717
  {
19502
19718
  style: {
@@ -19508,7 +19724,7 @@ function useCollapsibleCard(initialIsOpen = true) {
19508
19724
  children
19509
19725
  }
19510
19726
  ),
19511
- /* @__PURE__ */ jsx40(
19727
+ /* @__PURE__ */ jsx42(
19512
19728
  button_default,
19513
19729
  {
19514
19730
  __next40pxDefaultSize: true,
@@ -19548,11 +19764,11 @@ function FormCardField({
19548
19764
  );
19549
19765
  if (isCombinedField(field)) {
19550
19766
  const withHeader2 = !!field.label && layout.withHeader;
19551
- return /* @__PURE__ */ jsxs23(component_default18, { className: "dataforms-layouts-card__field", children: [
19552
- withHeader2 && /* @__PURE__ */ jsx40(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-label", children: field.label }),
19767
+ return /* @__PURE__ */ jsxs25(component_default18, { className: "dataforms-layouts-card__field", children: [
19768
+ withHeader2 && /* @__PURE__ */ jsx42(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-label", children: field.label }),
19553
19769
  (isOpen || !withHeader2) && // If it doesn't have a header, keep it open.
19554
19770
  // Otherwise, the card will not be visible.
19555
- /* @__PURE__ */ jsx40(component_default20, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ jsx40(
19771
+ /* @__PURE__ */ jsx42(component_default20, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ jsx42(
19556
19772
  DataFormLayout,
19557
19773
  {
19558
19774
  data,
@@ -19573,11 +19789,11 @@ function FormCardField({
19573
19789
  return null;
19574
19790
  }
19575
19791
  const withHeader = !!fieldDefinition.label && layout.withHeader;
19576
- return /* @__PURE__ */ jsxs23(component_default18, { className: "dataforms-layouts-card__field", children: [
19577
- withHeader && /* @__PURE__ */ jsx40(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-label", children: fieldDefinition.label }),
19792
+ return /* @__PURE__ */ jsxs25(component_default18, { className: "dataforms-layouts-card__field", children: [
19793
+ withHeader && /* @__PURE__ */ jsx42(CollapsibleCardHeader, { className: "dataforms-layouts-card__field-label", children: fieldDefinition.label }),
19578
19794
  (isOpen || !withHeader) && // If it doesn't have a header, keep it open.
19579
19795
  // Otherwise, the card will not be visible.
19580
- /* @__PURE__ */ jsx40(component_default20, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ jsx40(
19796
+ /* @__PURE__ */ jsx42(component_default20, { className: "dataforms-layouts-card__field-control", children: /* @__PURE__ */ jsx42(
19581
19797
  RegularLayout,
19582
19798
  {
19583
19799
  data,
@@ -19609,7 +19825,7 @@ function getFormFieldLayout(type) {
19609
19825
  }
19610
19826
 
19611
19827
  // src/dataforms-layouts/data-form-layout.tsx
19612
- import { jsx as jsx41 } from "react/jsx-runtime";
19828
+ import { jsx as jsx43 } from "react/jsx-runtime";
19613
19829
  function DataFormLayout({
19614
19830
  data,
19615
19831
  form,
@@ -19627,7 +19843,7 @@ function DataFormLayout({
19627
19843
  () => normalizeFormFields(form),
19628
19844
  [form]
19629
19845
  );
19630
- return /* @__PURE__ */ jsx41(component_default14, { spacing: form.layout?.type === "panel" ? 2 : 4, children: normalizedFormFields.map((formField) => {
19846
+ return /* @__PURE__ */ jsx43(component_default14, { spacing: form.layout?.type === "panel" ? 2 : 4, children: normalizedFormFields.map((formField) => {
19631
19847
  const FieldLayout = getFormFieldLayout(formField.layout.type)?.component;
19632
19848
  if (!FieldLayout) {
19633
19849
  return null;
@@ -19639,7 +19855,7 @@ function DataFormLayout({
19639
19855
  if (children) {
19640
19856
  return children(FieldLayout, formField);
19641
19857
  }
19642
- return /* @__PURE__ */ jsx41(
19858
+ return /* @__PURE__ */ jsx43(
19643
19859
  FieldLayout,
19644
19860
  {
19645
19861
  data,
@@ -19652,7 +19868,7 @@ function DataFormLayout({
19652
19868
  }
19653
19869
 
19654
19870
  // src/components/dataform/index.tsx
19655
- import { jsx as jsx42 } from "react/jsx-runtime";
19871
+ import { jsx as jsx44 } from "react/jsx-runtime";
19656
19872
  function DataForm({
19657
19873
  data,
19658
19874
  form,
@@ -19666,7 +19882,7 @@ function DataForm({
19666
19882
  if (!form.fields) {
19667
19883
  return null;
19668
19884
  }
19669
- return /* @__PURE__ */ jsx42(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ jsx42(DataFormLayout, { data, form, onChange }) });
19885
+ return /* @__PURE__ */ jsx44(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ jsx44(DataFormLayout, { data, form, onChange }) });
19670
19886
  }
19671
19887
 
19672
19888
  // src/filter-and-sort-data-view.ts