@wordpress/dataviews 13.0.0 → 13.1.1-next.v.202603161435.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/CHANGELOG.md +25 -0
- package/README.md +2 -1
- package/build/components/dataform-controls/date.cjs +11 -1
- package/build/components/dataform-controls/date.cjs.map +2 -2
- package/build/components/dataform-controls/datetime.cjs +23 -32
- package/build/components/dataform-controls/datetime.cjs.map +2 -2
- package/build/components/dataform-controls/utils/relative-date-control.cjs +2 -1
- package/build/components/dataform-controls/utils/relative-date-control.cjs.map +2 -2
- package/build/components/dataform-layouts/normalize-form.cjs +19 -1
- package/build/components/dataform-layouts/normalize-form.cjs.map +2 -2
- package/build/components/dataform-layouts/panel/index.cjs +1 -1
- package/build/components/dataform-layouts/panel/index.cjs.map +2 -2
- package/build/components/dataform-layouts/panel/modal.cjs +4 -3
- package/build/components/dataform-layouts/panel/modal.cjs.map +2 -2
- package/build/components/dataviews-layout/index.cjs +12 -3
- package/build/components/dataviews-layout/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/grid/composite-grid.cjs +5 -1
- package/build/components/dataviews-layouts/grid/composite-grid.cjs.map +2 -2
- package/build/components/dataviews-layouts/index.cjs +3 -3
- package/build/components/dataviews-layouts/index.cjs.map +3 -3
- package/build/components/dataviews-layouts/picker-grid/index.cjs +13 -2
- package/build/components/dataviews-layouts/picker-grid/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/index.cjs +98 -89
- package/build/components/dataviews-layouts/table/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/{use-is-horizontal-scroll-end.cjs → use-scroll-state.cjs} +29 -33
- package/build/components/dataviews-layouts/table/use-scroll-state.cjs.map +7 -0
- package/build/components/dataviews-layouts/utils/density-picker.cjs.map +2 -2
- package/build/components/dataviews-layouts/utils/grid-config-options.cjs +45 -0
- package/build/components/dataviews-layouts/utils/grid-config-options.cjs.map +7 -0
- package/build/dataviews/index.cjs +12 -8
- package/build/dataviews/index.cjs.map +2 -2
- package/build/dataviews-picker/index.cjs +1 -1
- package/build/dataviews-picker/index.cjs.map +2 -2
- package/build/types/dataform.cjs.map +1 -1
- package/build/types/dataviews.cjs.map +1 -1
- package/build-module/components/dataform-controls/date.mjs +11 -1
- package/build-module/components/dataform-controls/date.mjs.map +2 -2
- package/build-module/components/dataform-controls/datetime.mjs +24 -33
- package/build-module/components/dataform-controls/datetime.mjs.map +2 -2
- package/build-module/components/dataform-controls/utils/relative-date-control.mjs +2 -1
- package/build-module/components/dataform-controls/utils/relative-date-control.mjs.map +2 -2
- package/build-module/components/dataform-layouts/normalize-form.mjs +19 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/index.mjs +1 -1
- package/build-module/components/dataform-layouts/panel/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/modal.mjs +4 -3
- package/build-module/components/dataform-layouts/panel/modal.mjs.map +2 -2
- package/build-module/components/dataviews-layout/index.mjs +12 -3
- package/build-module/components/dataviews-layout/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs +5 -1
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/index.mjs +3 -3
- package/build-module/components/dataviews-layouts/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/picker-grid/index.mjs +13 -2
- package/build-module/components/dataviews-layouts/picker-grid/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/index.mjs +98 -89
- package/build-module/components/dataviews-layouts/table/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/use-scroll-state.mjs +46 -0
- package/build-module/components/dataviews-layouts/table/use-scroll-state.mjs.map +7 -0
- package/build-module/components/dataviews-layouts/utils/density-picker.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/utils/grid-config-options.mjs +14 -0
- package/build-module/components/dataviews-layouts/utils/grid-config-options.mjs.map +7 -0
- package/build-module/dataviews/index.mjs +12 -8
- package/build-module/dataviews/index.mjs.map +2 -2
- package/build-module/dataviews-picker/index.mjs +1 -1
- package/build-module/dataviews-picker/index.mjs.map +2 -2
- package/build-style/style-rtl.css +47 -5
- package/build-style/style.css +47 -5
- package/build-types/components/dataform-controls/date.d.ts.map +1 -1
- package/build-types/components/dataform-controls/datetime.d.ts.map +1 -1
- package/build-types/components/dataform-controls/utils/relative-date-control.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/normalize-form.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/modal.d.ts.map +1 -1
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/grid/composite-grid.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/index.d.ts +3 -3
- package/build-types/components/dataviews-layouts/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/picker-grid/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/table/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/table/use-scroll-state.d.ts +25 -0
- package/build-types/components/dataviews-layouts/table/use-scroll-state.d.ts.map +1 -0
- package/build-types/components/dataviews-layouts/utils/density-picker.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/utils/grid-config-options.d.ts +2 -0
- package/build-types/components/dataviews-layouts/utils/grid-config-options.d.ts.map +1 -0
- package/build-types/dataform/stories/index.story.d.ts +26 -1
- package/build-types/dataform/stories/index.story.d.ts.map +1 -1
- package/build-types/dataform/stories/layout-panel.d.ts +3 -1
- package/build-types/dataform/stories/layout-panel.d.ts.map +1 -1
- package/build-types/dataviews/index.d.ts.map +1 -1
- package/build-types/dataviews/stories/empty.d.ts +1 -2
- package/build-types/dataviews/stories/empty.d.ts.map +1 -1
- package/build-types/dataviews/stories/free-composition.d.ts.map +1 -1
- package/build-types/dataviews/stories/index.story.d.ts +7 -10
- package/build-types/dataviews/stories/index.story.d.ts.map +1 -1
- package/build-types/dataviews/stories/infinite-scroll.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-activity.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-custom.d.ts +3 -1
- package/build-types/dataviews/stories/layout-custom.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-grid.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-list.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-table.d.ts.map +1 -1
- package/build-types/dataviews/stories/with-card.d.ts +3 -1
- package/build-types/dataviews/stories/with-card.d.ts.map +1 -1
- package/build-types/types/dataform.d.ts +17 -2
- package/build-types/types/dataform.d.ts.map +1 -1
- package/build-types/types/dataviews.d.ts +8 -0
- package/build-types/types/dataviews.d.ts.map +1 -1
- package/build-wp/index.js +869 -856
- package/package.json +16 -16
- package/src/components/dataform-controls/date.tsx +11 -1
- package/src/components/dataform-controls/datetime.tsx +28 -44
- package/src/components/dataform-controls/utils/relative-date-control.tsx +2 -1
- package/src/components/dataform-layouts/normalize-form.ts +24 -1
- package/src/components/dataform-layouts/panel/index.tsx +1 -1
- package/src/components/dataform-layouts/panel/modal.tsx +7 -3
- package/src/components/dataform-layouts/panel/style.scss +1 -1
- package/src/components/dataform-layouts/test/normalize-form.ts +98 -5
- package/src/components/dataviews-layout/index.tsx +41 -19
- package/src/components/dataviews-layout/style.scss +8 -0
- package/src/components/dataviews-layouts/grid/composite-grid.tsx +7 -1
- package/src/components/dataviews-layouts/grid/style.scss +18 -2
- package/src/components/dataviews-layouts/index.ts +3 -3
- package/src/components/dataviews-layouts/picker-grid/index.tsx +17 -2
- package/src/components/dataviews-layouts/picker-grid/style.scss +10 -0
- package/src/components/dataviews-layouts/table/index.tsx +11 -5
- package/src/components/dataviews-layouts/table/style.scss +13 -0
- package/src/components/dataviews-layouts/table/use-scroll-state.ts +79 -0
- package/src/components/dataviews-layouts/utils/density-picker.tsx +12 -2
- package/src/components/dataviews-layouts/utils/grid-config-options.tsx +14 -0
- package/src/components/dataviews-layouts/utils/grid-items.scss +9 -1
- package/src/dataform/stories/index.story.tsx +15 -0
- package/src/dataform/stories/layout-panel.tsx +19 -4
- package/src/dataviews/index.tsx +17 -9
- package/src/dataviews/stories/empty.tsx +1 -3
- package/src/dataviews/stories/free-composition.tsx +32 -34
- package/src/dataviews/stories/index.story.tsx +14 -8
- package/src/dataviews/stories/infinite-scroll.tsx +0 -6
- package/src/dataviews/stories/layout-activity.tsx +1 -0
- package/src/dataviews/stories/layout-custom.tsx +7 -3
- package/src/dataviews/stories/layout-grid.tsx +1 -0
- package/src/dataviews/stories/layout-list.tsx +1 -0
- package/src/dataviews/stories/layout-table.tsx +1 -0
- package/src/dataviews/stories/style.css +0 -5
- package/src/dataviews/stories/with-card.tsx +6 -2
- package/src/dataviews/style.scss +0 -1
- package/src/dataviews/test/dataviews.tsx +42 -1
- package/src/dataviews-picker/index.tsx +1 -1
- package/src/style.scss +1 -0
- package/src/types/dataform.ts +15 -2
- package/src/types/dataviews.ts +10 -0
- package/build/components/dataviews-layouts/table/use-is-horizontal-scroll-end.cjs.map +0 -7
- package/build-module/components/dataviews-layouts/table/use-is-horizontal-scroll-end.mjs +0 -50
- package/build-module/components/dataviews-layouts/table/use-is-horizontal-scroll-end.mjs.map +0 -7
- package/build-types/components/dataviews-layouts/table/use-is-horizontal-scroll-end.d.ts +0 -19
- package/build-types/components/dataviews-layouts/table/use-is-horizontal-scroll-end.d.ts.map +0 -1
- package/src/components/dataviews-layouts/table/use-is-horizontal-scroll-end.ts +0 -82
package/build-wp/index.js
CHANGED
|
@@ -734,7 +734,41 @@ function useConstrainedTabbing() {
|
|
|
734
734
|
var use_constrained_tabbing_default = useConstrainedTabbing;
|
|
735
735
|
|
|
736
736
|
// ../compose/build-module/hooks/use-copy-to-clipboard/index.mjs
|
|
737
|
-
|
|
737
|
+
async function copyToClipboard(text, trigger) {
|
|
738
|
+
if (!trigger) {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
const { ownerDocument } = trigger;
|
|
742
|
+
if (!ownerDocument) {
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
const { defaultView } = ownerDocument;
|
|
746
|
+
try {
|
|
747
|
+
if (defaultView?.navigator?.clipboard?.writeText) {
|
|
748
|
+
await defaultView.navigator.clipboard.writeText(text);
|
|
749
|
+
return true;
|
|
750
|
+
}
|
|
751
|
+
const textarea = ownerDocument.createElement("textarea");
|
|
752
|
+
textarea.value = text;
|
|
753
|
+
textarea.setAttribute("readonly", "");
|
|
754
|
+
textarea.style.position = "fixed";
|
|
755
|
+
textarea.style.left = "-9999px";
|
|
756
|
+
textarea.style.top = "-9999px";
|
|
757
|
+
ownerDocument.body.appendChild(textarea);
|
|
758
|
+
textarea.select();
|
|
759
|
+
const success = ownerDocument.execCommand("copy");
|
|
760
|
+
textarea.remove();
|
|
761
|
+
return success;
|
|
762
|
+
} catch {
|
|
763
|
+
return false;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function clearSelection(trigger) {
|
|
767
|
+
if ("focus" in trigger && typeof trigger.focus === "function") {
|
|
768
|
+
trigger.focus();
|
|
769
|
+
}
|
|
770
|
+
trigger.ownerDocument?.defaultView?.getSelection()?.removeAllRanges();
|
|
771
|
+
}
|
|
738
772
|
function useUpdatedRef(value) {
|
|
739
773
|
const ref = useRef(value);
|
|
740
774
|
useLayoutEffect(() => {
|
|
@@ -746,19 +780,24 @@ function useCopyToClipboard(text, onSuccess) {
|
|
|
746
780
|
const textRef = useUpdatedRef(text);
|
|
747
781
|
const onSuccessRef = useUpdatedRef(onSuccess);
|
|
748
782
|
return useRefEffect((node) => {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
783
|
+
let isActive = true;
|
|
784
|
+
const handleClick = async () => {
|
|
785
|
+
const textToCopy = typeof textRef.current === "function" ? textRef.current() : textRef.current || "";
|
|
786
|
+
const success = await copyToClipboard(textToCopy, node);
|
|
787
|
+
if (!isActive) {
|
|
788
|
+
return;
|
|
752
789
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
790
|
+
if (success) {
|
|
791
|
+
clearSelection(node);
|
|
792
|
+
if (onSuccessRef.current) {
|
|
793
|
+
onSuccessRef.current();
|
|
794
|
+
}
|
|
758
795
|
}
|
|
759
|
-
}
|
|
796
|
+
};
|
|
797
|
+
node.addEventListener("click", handleClick);
|
|
760
798
|
return () => {
|
|
761
|
-
|
|
799
|
+
isActive = false;
|
|
800
|
+
node.removeEventListener("click", handleClick);
|
|
762
801
|
};
|
|
763
802
|
}, []);
|
|
764
803
|
}
|
|
@@ -1255,10 +1294,10 @@ function useObservableValue(map, name) {
|
|
|
1255
1294
|
// ../ui/build-module/badge/badge.mjs
|
|
1256
1295
|
import { useRender, mergeProps } from "@base-ui/react";
|
|
1257
1296
|
import clsx from "clsx";
|
|
1258
|
-
if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='
|
|
1297
|
+
if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='d16010fae9']")) {
|
|
1259
1298
|
const style = document.createElement("style");
|
|
1260
|
-
style.setAttribute("data-wp-hash", "
|
|
1261
|
-
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-sm,12px);font-weight:var(--wpds-font-weight-regular,400);line-height:var(--wpds-font-line-height-xs,16px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6bd);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee994);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c5f7cc);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral,#
|
|
1299
|
+
style.setAttribute("data-wp-hash", "d16010fae9");
|
|
1300
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-sm,12px);font-weight:var(--wpds-font-weight-regular,400);line-height:var(--wpds-font-line-height-xs,16px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6bd);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee994);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c5f7cc);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#d8d8d8);color:var(--wpds-color-fg-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}'));
|
|
1262
1301
|
document.head.appendChild(style);
|
|
1263
1302
|
}
|
|
1264
1303
|
var style_default = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" };
|
|
@@ -1298,7 +1337,7 @@ function addContainer(ariaLive = "polite") {
|
|
|
1298
1337
|
container.className = "a11y-speak-region";
|
|
1299
1338
|
container.setAttribute(
|
|
1300
1339
|
"style",
|
|
1301
|
-
"position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
|
|
1340
|
+
"position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;word-break:normal !important;"
|
|
1302
1341
|
);
|
|
1303
1342
|
container.setAttribute("aria-live", ariaLive);
|
|
1304
1343
|
container.setAttribute("aria-relevant", "additions text");
|
|
@@ -1319,7 +1358,7 @@ function addIntroText() {
|
|
|
1319
1358
|
introText.textContent = __2("Notifications");
|
|
1320
1359
|
introText.setAttribute(
|
|
1321
1360
|
"style",
|
|
1322
|
-
"position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
|
|
1361
|
+
"position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;word-break:normal !important;"
|
|
1323
1362
|
);
|
|
1324
1363
|
introText.setAttribute("hidden", "");
|
|
1325
1364
|
const { body } = document;
|
|
@@ -1765,7 +1804,7 @@ var dataviews_context_default = DataViewsContext;
|
|
|
1765
1804
|
import { __ as __35, isRTL as isRTL12 } from "@wordpress/i18n";
|
|
1766
1805
|
|
|
1767
1806
|
// src/components/dataviews-layouts/table/index.tsx
|
|
1768
|
-
import
|
|
1807
|
+
import clsx32 from "clsx";
|
|
1769
1808
|
import { __ as __23, sprintf as sprintf6, isRTL as isRTL10 } from "@wordpress/i18n";
|
|
1770
1809
|
|
|
1771
1810
|
// ../components/build-module/composite/index.mjs
|
|
@@ -2753,7 +2792,7 @@ function UnforwardedTooltip(props, ref) {
|
|
|
2753
2792
|
alternative: "`placement` prop"
|
|
2754
2793
|
});
|
|
2755
2794
|
}
|
|
2756
|
-
computedPlacement = computedPlacement || "
|
|
2795
|
+
computedPlacement = computedPlacement || "top";
|
|
2757
2796
|
const tooltipStore = Ariakit8.useTooltipStore({
|
|
2758
2797
|
placement: computedPlacement,
|
|
2759
2798
|
showTimeout: delay
|
|
@@ -2989,7 +3028,8 @@ var visuallyHidden = {
|
|
|
2989
3028
|
padding: 0,
|
|
2990
3029
|
position: "absolute",
|
|
2991
3030
|
width: "1px",
|
|
2992
|
-
wordWrap: "normal"
|
|
3031
|
+
wordWrap: "normal",
|
|
3032
|
+
wordBreak: "normal"
|
|
2993
3033
|
};
|
|
2994
3034
|
|
|
2995
3035
|
// ../components/build-module/view/component.mjs
|
|
@@ -12371,97 +12411,9 @@ var {
|
|
|
12371
12411
|
unlock: unlock2
|
|
12372
12412
|
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/components");
|
|
12373
12413
|
|
|
12374
|
-
// ../components/build-module/
|
|
12414
|
+
// ../components/build-module/badge/index.mjs
|
|
12375
12415
|
import clsx30 from "clsx";
|
|
12376
12416
|
import { jsx as _jsx107, jsxs as _jsxs32 } from "react/jsx-runtime";
|
|
12377
|
-
function Avatar({
|
|
12378
|
-
className: className2,
|
|
12379
|
-
src,
|
|
12380
|
-
name,
|
|
12381
|
-
label,
|
|
12382
|
-
badge = false,
|
|
12383
|
-
size: size3 = "default",
|
|
12384
|
-
borderColor: borderColor2,
|
|
12385
|
-
status,
|
|
12386
|
-
statusIndicator,
|
|
12387
|
-
style,
|
|
12388
|
-
...props
|
|
12389
|
-
}) {
|
|
12390
|
-
const showBadge = badge && !!name;
|
|
12391
|
-
const initials = name ? name.split(/\s+/).slice(0, 2).map((word) => word[0]).join("").toUpperCase() : void 0;
|
|
12392
|
-
const customProperties = {
|
|
12393
|
-
...style,
|
|
12394
|
-
...src ? {
|
|
12395
|
-
"--components-avatar-url": `url(${src})`
|
|
12396
|
-
} : {},
|
|
12397
|
-
...borderColor2 ? {
|
|
12398
|
-
"--components-avatar-outline-color": borderColor2
|
|
12399
|
-
} : {}
|
|
12400
|
-
};
|
|
12401
|
-
const avatar = /* @__PURE__ */ _jsxs32("div", {
|
|
12402
|
-
className: clsx30("components-avatar", className2, {
|
|
12403
|
-
"has-avatar-border-color": !!borderColor2,
|
|
12404
|
-
"has-src": !!src,
|
|
12405
|
-
"has-badge": showBadge,
|
|
12406
|
-
"is-small": size3 === "small",
|
|
12407
|
-
"has-status": !!status,
|
|
12408
|
-
[`is-${status}`]: !!status
|
|
12409
|
-
}),
|
|
12410
|
-
style: customProperties,
|
|
12411
|
-
role: "img",
|
|
12412
|
-
"aria-label": name,
|
|
12413
|
-
...props,
|
|
12414
|
-
children: [/* @__PURE__ */ _jsxs32("span", {
|
|
12415
|
-
className: "components-avatar__image",
|
|
12416
|
-
children: [!src && initials, !!status && !!statusIndicator && /* @__PURE__ */ _jsx107("span", {
|
|
12417
|
-
className: "components-avatar__status-indicator",
|
|
12418
|
-
children: /* @__PURE__ */ _jsx107(icon_default2, {
|
|
12419
|
-
icon: statusIndicator
|
|
12420
|
-
})
|
|
12421
|
-
})]
|
|
12422
|
-
}), showBadge && /* @__PURE__ */ _jsx107("span", {
|
|
12423
|
-
className: "components-avatar__name",
|
|
12424
|
-
children: label || name
|
|
12425
|
-
})]
|
|
12426
|
-
});
|
|
12427
|
-
if (name && (!showBadge || label)) {
|
|
12428
|
-
return /* @__PURE__ */ _jsx107(tooltip_default, {
|
|
12429
|
-
text: name,
|
|
12430
|
-
children: avatar
|
|
12431
|
-
});
|
|
12432
|
-
}
|
|
12433
|
-
return avatar;
|
|
12434
|
-
}
|
|
12435
|
-
var component_default24 = Avatar;
|
|
12436
|
-
|
|
12437
|
-
// ../components/build-module/avatar-group/component.mjs
|
|
12438
|
-
import clsx31 from "clsx";
|
|
12439
|
-
import { jsx as _jsx108, jsxs as _jsxs33 } from "react/jsx-runtime";
|
|
12440
|
-
function AvatarGroup({
|
|
12441
|
-
className: className2,
|
|
12442
|
-
max = 3,
|
|
12443
|
-
children,
|
|
12444
|
-
...props
|
|
12445
|
-
}) {
|
|
12446
|
-
const childArray = Children.toArray(children);
|
|
12447
|
-
const visible = childArray.slice(0, max);
|
|
12448
|
-
const overflowCount = childArray.length - max;
|
|
12449
|
-
return /* @__PURE__ */ _jsxs33("div", {
|
|
12450
|
-
role: "group",
|
|
12451
|
-
className: clsx31("components-avatar-group", className2),
|
|
12452
|
-
...props,
|
|
12453
|
-
children: [visible, overflowCount > 0 && /* @__PURE__ */ _jsx108("span", {
|
|
12454
|
-
className: "components-avatar-group__overflow",
|
|
12455
|
-
"aria-label": `${overflowCount} more`,
|
|
12456
|
-
children: `+${overflowCount}`
|
|
12457
|
-
})]
|
|
12458
|
-
});
|
|
12459
|
-
}
|
|
12460
|
-
var component_default25 = AvatarGroup;
|
|
12461
|
-
|
|
12462
|
-
// ../components/build-module/badge/index.mjs
|
|
12463
|
-
import clsx32 from "clsx";
|
|
12464
|
-
import { jsx as _jsx109, jsxs as _jsxs34 } from "react/jsx-runtime";
|
|
12465
12417
|
function contextBasedIcon(intent = "default") {
|
|
12466
12418
|
switch (intent) {
|
|
12467
12419
|
case "info":
|
|
@@ -12484,20 +12436,20 @@ function Badge3({
|
|
|
12484
12436
|
}) {
|
|
12485
12437
|
const icon = contextBasedIcon(intent);
|
|
12486
12438
|
const hasIcon = !!icon;
|
|
12487
|
-
return /* @__PURE__ */
|
|
12488
|
-
className:
|
|
12439
|
+
return /* @__PURE__ */ _jsx107("span", {
|
|
12440
|
+
className: clsx30("components-badge", className2, {
|
|
12489
12441
|
[`is-${intent}`]: intent,
|
|
12490
12442
|
"has-icon": hasIcon
|
|
12491
12443
|
}),
|
|
12492
12444
|
...props,
|
|
12493
|
-
children: /* @__PURE__ */
|
|
12445
|
+
children: /* @__PURE__ */ _jsxs32("span", {
|
|
12494
12446
|
className: "components-badge__flex-wrapper",
|
|
12495
|
-
children: [hasIcon && /* @__PURE__ */
|
|
12447
|
+
children: [hasIcon && /* @__PURE__ */ _jsx107(icon_default2, {
|
|
12496
12448
|
icon,
|
|
12497
12449
|
size: 16,
|
|
12498
12450
|
fill: "currentColor",
|
|
12499
12451
|
className: "components-badge__icon"
|
|
12500
|
-
}), /* @__PURE__ */
|
|
12452
|
+
}), /* @__PURE__ */ _jsx107("span", {
|
|
12501
12453
|
className: "components-badge__content",
|
|
12502
12454
|
children
|
|
12503
12455
|
})]
|
|
@@ -12514,9 +12466,9 @@ import { DayPicker } from "react-day-picker";
|
|
|
12514
12466
|
import { enUS } from "react-day-picker/locale";
|
|
12515
12467
|
|
|
12516
12468
|
// ../components/build-module/calendar/utils/day-cell.mjs
|
|
12517
|
-
import { jsx as
|
|
12469
|
+
import { jsx as _jsx108, jsxs as _jsxs33 } from "react/jsx-runtime";
|
|
12518
12470
|
var PreviewDashStartAndEnd = () => {
|
|
12519
|
-
return /* @__PURE__ */
|
|
12471
|
+
return /* @__PURE__ */ _jsx108("svg", {
|
|
12520
12472
|
viewBox: "0 0 32 32",
|
|
12521
12473
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12522
12474
|
fill: "none",
|
|
@@ -12524,13 +12476,13 @@ var PreviewDashStartAndEnd = () => {
|
|
|
12524
12476
|
strokeDasharray: "3.7677",
|
|
12525
12477
|
strokeDashoffset: "3.2",
|
|
12526
12478
|
strokeWidth: "1",
|
|
12527
|
-
children: /* @__PURE__ */
|
|
12479
|
+
children: /* @__PURE__ */ _jsx108("path", {
|
|
12528
12480
|
d: "M29.5,0.5 h-27 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h27 a2,2 0 0 0 2,-2 v-27 a2,2 0 0 0 -2,-2"
|
|
12529
12481
|
})
|
|
12530
12482
|
});
|
|
12531
12483
|
};
|
|
12532
12484
|
var PreviewDashStart = () => {
|
|
12533
|
-
return /* @__PURE__ */
|
|
12485
|
+
return /* @__PURE__ */ _jsx108("svg", {
|
|
12534
12486
|
viewBox: "0 0 32 32",
|
|
12535
12487
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12536
12488
|
fill: "none",
|
|
@@ -12538,13 +12490,13 @@ var PreviewDashStart = () => {
|
|
|
12538
12490
|
strokeDasharray: "3.84516",
|
|
12539
12491
|
strokeDashoffset: "1.9226",
|
|
12540
12492
|
strokeWidth: "1",
|
|
12541
|
-
children: /* @__PURE__ */
|
|
12493
|
+
children: /* @__PURE__ */ _jsx108("path", {
|
|
12542
12494
|
d: "M32,0.5 h-29.5 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h30"
|
|
12543
12495
|
})
|
|
12544
12496
|
});
|
|
12545
12497
|
};
|
|
12546
12498
|
var PreviewDashMiddle = () => {
|
|
12547
|
-
return /* @__PURE__ */
|
|
12499
|
+
return /* @__PURE__ */ _jsxs33("svg", {
|
|
12548
12500
|
viewBox: "0 0 32 32",
|
|
12549
12501
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12550
12502
|
fill: "none",
|
|
@@ -12552,12 +12504,12 @@ var PreviewDashMiddle = () => {
|
|
|
12552
12504
|
strokeDasharray: "3.9 4",
|
|
12553
12505
|
strokeDashoffset: "2",
|
|
12554
12506
|
strokeWidth: "1",
|
|
12555
|
-
children: [/* @__PURE__ */
|
|
12507
|
+
children: [/* @__PURE__ */ _jsx108("line", {
|
|
12556
12508
|
x1: "0",
|
|
12557
12509
|
y1: "0.5",
|
|
12558
12510
|
x2: "100",
|
|
12559
12511
|
y2: "0.5"
|
|
12560
|
-
}), /* @__PURE__ */
|
|
12512
|
+
}), /* @__PURE__ */ _jsx108("line", {
|
|
12561
12513
|
x1: "0",
|
|
12562
12514
|
y1: "31.5",
|
|
12563
12515
|
x2: "100",
|
|
@@ -12566,7 +12518,7 @@ var PreviewDashMiddle = () => {
|
|
|
12566
12518
|
});
|
|
12567
12519
|
};
|
|
12568
12520
|
var PreviewDashEnd = () => {
|
|
12569
|
-
return /* @__PURE__ */
|
|
12521
|
+
return /* @__PURE__ */ _jsx108("svg", {
|
|
12570
12522
|
viewBox: "0 0 32 32",
|
|
12571
12523
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12572
12524
|
fill: "none",
|
|
@@ -12574,7 +12526,7 @@ var PreviewDashEnd = () => {
|
|
|
12574
12526
|
strokeDasharray: "3.84516",
|
|
12575
12527
|
strokeDashoffset: "1.9226",
|
|
12576
12528
|
strokeWidth: "1",
|
|
12577
|
-
children: /* @__PURE__ */
|
|
12529
|
+
children: /* @__PURE__ */ _jsx108("path", {
|
|
12578
12530
|
d: "M0,0.5 h29.5 a2,2 0 0 1 2,2 v27 a2,2 0 0 1 -2,2 h-29.5"
|
|
12579
12531
|
})
|
|
12580
12532
|
});
|
|
@@ -12596,9 +12548,9 @@ function Day(props) {
|
|
|
12596
12548
|
} else if (modifiers.preview) {
|
|
12597
12549
|
PreviewDash = PreviewDashMiddle;
|
|
12598
12550
|
}
|
|
12599
|
-
return /* @__PURE__ */
|
|
12551
|
+
return /* @__PURE__ */ _jsxs33("td", {
|
|
12600
12552
|
...tdProps,
|
|
12601
|
-
children: [PreviewDash && /* @__PURE__ */
|
|
12553
|
+
children: [PreviewDash && /* @__PURE__ */ _jsx108(PreviewDash, {}), children]
|
|
12602
12554
|
});
|
|
12603
12555
|
}
|
|
12604
12556
|
|
|
@@ -12607,6 +12559,7 @@ var CLASSNAMES = {
|
|
|
12607
12559
|
root: "components-calendar",
|
|
12608
12560
|
day: "components-calendar__day",
|
|
12609
12561
|
day_button: "components-calendar__day-button",
|
|
12562
|
+
outside: "components-calendar__day--outside",
|
|
12610
12563
|
caption_label: "components-calendar__caption-label",
|
|
12611
12564
|
button_next: "components-calendar__button-next",
|
|
12612
12565
|
button_previous: "components-calendar__button-previous",
|
|
@@ -12794,7 +12747,7 @@ var useLocalizationProps = ({
|
|
|
12794
12747
|
};
|
|
12795
12748
|
|
|
12796
12749
|
// ../components/build-module/calendar/date-calendar/index.mjs
|
|
12797
|
-
import { jsx as
|
|
12750
|
+
import { jsx as _jsx109 } from "react/jsx-runtime";
|
|
12798
12751
|
var DateCalendar = ({
|
|
12799
12752
|
defaultSelected,
|
|
12800
12753
|
selected: selectedProp,
|
|
@@ -12817,7 +12770,7 @@ var DateCalendar = ({
|
|
|
12817
12770
|
value: selectedProp,
|
|
12818
12771
|
onChange
|
|
12819
12772
|
});
|
|
12820
|
-
return /* @__PURE__ */
|
|
12773
|
+
return /* @__PURE__ */ _jsx109(DayPicker, {
|
|
12821
12774
|
...COMMON_PROPS,
|
|
12822
12775
|
...localizationProps,
|
|
12823
12776
|
...props,
|
|
@@ -12832,7 +12785,7 @@ var DateCalendar = ({
|
|
|
12832
12785
|
import { differenceInCalendarDays } from "date-fns";
|
|
12833
12786
|
import { DayPicker as DayPicker2, rangeContainsModifiers } from "react-day-picker";
|
|
12834
12787
|
import { enUS as enUS2 } from "react-day-picker/locale";
|
|
12835
|
-
import { jsx as
|
|
12788
|
+
import { jsx as _jsx110 } from "react/jsx-runtime";
|
|
12836
12789
|
function usePreviewRange({
|
|
12837
12790
|
selected,
|
|
12838
12791
|
hoveredDate,
|
|
@@ -12938,7 +12891,7 @@ var DateRangeCalendar = ({
|
|
|
12938
12891
|
preview_end: previewRange?.to
|
|
12939
12892
|
};
|
|
12940
12893
|
}, [previewRange]);
|
|
12941
|
-
return /* @__PURE__ */
|
|
12894
|
+
return /* @__PURE__ */ _jsx110(DayPicker2, {
|
|
12942
12895
|
...COMMON_PROPS,
|
|
12943
12896
|
...localizationProps,
|
|
12944
12897
|
...props,
|
|
@@ -12961,8 +12914,8 @@ var DateRangeCalendar = ({
|
|
|
12961
12914
|
import { __ as __17 } from "@wordpress/i18n";
|
|
12962
12915
|
|
|
12963
12916
|
// ../components/build-module/validated-form-controls/validity-indicator.mjs
|
|
12964
|
-
import
|
|
12965
|
-
import { jsx as
|
|
12917
|
+
import clsx31 from "clsx";
|
|
12918
|
+
import { jsx as _jsx111, jsxs as _jsxs34 } from "react/jsx-runtime";
|
|
12966
12919
|
function ValidityIndicator({
|
|
12967
12920
|
type,
|
|
12968
12921
|
message
|
|
@@ -12971,11 +12924,11 @@ function ValidityIndicator({
|
|
|
12971
12924
|
valid: published_default,
|
|
12972
12925
|
invalid: error_default
|
|
12973
12926
|
};
|
|
12974
|
-
return /* @__PURE__ */
|
|
12975
|
-
className:
|
|
12976
|
-
children: [type === "validating" ? /* @__PURE__ */
|
|
12927
|
+
return /* @__PURE__ */ _jsxs34("p", {
|
|
12928
|
+
className: clsx31("components-validated-control__indicator", `is-${type}`),
|
|
12929
|
+
children: [type === "validating" ? /* @__PURE__ */ _jsx111(spinner_default, {
|
|
12977
12930
|
className: "components-validated-control__indicator-spinner"
|
|
12978
|
-
}) : /* @__PURE__ */
|
|
12931
|
+
}) : /* @__PURE__ */ _jsx111(icon_default2, {
|
|
12979
12932
|
className: "components-validated-control__indicator-icon",
|
|
12980
12933
|
icon: ICON[type],
|
|
12981
12934
|
size: 16,
|
|
@@ -12985,15 +12938,15 @@ function ValidityIndicator({
|
|
|
12985
12938
|
}
|
|
12986
12939
|
|
|
12987
12940
|
// ../components/build-module/validated-form-controls/control-with-error.mjs
|
|
12988
|
-
import { Fragment as _Fragment13, jsxs as
|
|
12941
|
+
import { Fragment as _Fragment13, jsxs as _jsxs35, jsx as _jsx112 } from "react/jsx-runtime";
|
|
12989
12942
|
function appendRequiredIndicator(label, required, markWhenOptional) {
|
|
12990
12943
|
if (required && !markWhenOptional) {
|
|
12991
|
-
return /* @__PURE__ */
|
|
12944
|
+
return /* @__PURE__ */ _jsxs35(_Fragment13, {
|
|
12992
12945
|
children: [label, " ", `(${__17("Required")})`]
|
|
12993
12946
|
});
|
|
12994
12947
|
}
|
|
12995
12948
|
if (!required && markWhenOptional) {
|
|
12996
|
-
return /* @__PURE__ */
|
|
12949
|
+
return /* @__PURE__ */ _jsxs35(_Fragment13, {
|
|
12997
12950
|
children: [label, " ", `(${__17("Optional")})`]
|
|
12998
12951
|
});
|
|
12999
12952
|
}
|
|
@@ -13097,27 +13050,27 @@ function UnforwardedControlWithError({
|
|
|
13097
13050
|
};
|
|
13098
13051
|
const message = () => {
|
|
13099
13052
|
if (errorMessage) {
|
|
13100
|
-
return /* @__PURE__ */
|
|
13053
|
+
return /* @__PURE__ */ _jsx112(ValidityIndicator, {
|
|
13101
13054
|
type: "invalid",
|
|
13102
13055
|
message: errorMessage
|
|
13103
13056
|
});
|
|
13104
13057
|
}
|
|
13105
13058
|
if (statusMessage?.type) {
|
|
13106
|
-
return /* @__PURE__ */
|
|
13059
|
+
return /* @__PURE__ */ _jsx112(ValidityIndicator, {
|
|
13107
13060
|
type: statusMessage.type,
|
|
13108
13061
|
message: statusMessage.message
|
|
13109
13062
|
});
|
|
13110
13063
|
}
|
|
13111
13064
|
return null;
|
|
13112
13065
|
};
|
|
13113
|
-
return /* @__PURE__ */
|
|
13066
|
+
return /* @__PURE__ */ _jsxs35("div", {
|
|
13114
13067
|
className,
|
|
13115
13068
|
ref: forwardedRef,
|
|
13116
13069
|
onBlur,
|
|
13117
13070
|
children: [cloneElement(children, {
|
|
13118
13071
|
label: appendRequiredIndicator(children.props.label, required, markWhenOptional),
|
|
13119
13072
|
required
|
|
13120
|
-
}), /* @__PURE__ */
|
|
13073
|
+
}), /* @__PURE__ */ _jsx112("div", {
|
|
13121
13074
|
"aria-live": "polite",
|
|
13122
13075
|
children: showMessage && message()
|
|
13123
13076
|
})]
|
|
@@ -13127,7 +13080,7 @@ var ControlWithError = forwardRef(UnforwardedControlWithError);
|
|
|
13127
13080
|
ControlWithError.displayName = "ControlWithError";
|
|
13128
13081
|
|
|
13129
13082
|
// ../components/build-module/validated-form-controls/components/checkbox-control.mjs
|
|
13130
|
-
import { jsx as
|
|
13083
|
+
import { jsx as _jsx113 } from "react/jsx-runtime";
|
|
13131
13084
|
var UnforwardedValidatedCheckboxControl = ({
|
|
13132
13085
|
required,
|
|
13133
13086
|
customValidity,
|
|
@@ -13136,13 +13089,13 @@ var UnforwardedValidatedCheckboxControl = ({
|
|
|
13136
13089
|
}, forwardedRef) => {
|
|
13137
13090
|
const validityTargetRef = useRef(null);
|
|
13138
13091
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13139
|
-
return /* @__PURE__ */
|
|
13092
|
+
return /* @__PURE__ */ _jsx113(ControlWithError, {
|
|
13140
13093
|
required,
|
|
13141
13094
|
markWhenOptional,
|
|
13142
13095
|
ref: mergedRefs,
|
|
13143
13096
|
customValidity,
|
|
13144
13097
|
getValidityTarget: () => validityTargetRef.current?.querySelector('input[type="checkbox"]'),
|
|
13145
|
-
children: /* @__PURE__ */
|
|
13098
|
+
children: /* @__PURE__ */ _jsx113(
|
|
13146
13099
|
checkbox_control_default,
|
|
13147
13100
|
{
|
|
13148
13101
|
...restProps
|
|
@@ -13154,7 +13107,7 @@ var ValidatedCheckboxControl = forwardRef(UnforwardedValidatedCheckboxControl);
|
|
|
13154
13107
|
ValidatedCheckboxControl.displayName = "ValidatedCheckboxControl";
|
|
13155
13108
|
|
|
13156
13109
|
// ../components/build-module/validated-form-controls/components/combobox-control.mjs
|
|
13157
|
-
import { jsx as
|
|
13110
|
+
import { jsx as _jsx114 } from "react/jsx-runtime";
|
|
13158
13111
|
var UnforwardedValidatedComboboxControl = ({
|
|
13159
13112
|
required,
|
|
13160
13113
|
customValidity,
|
|
@@ -13171,13 +13124,13 @@ var UnforwardedValidatedComboboxControl = ({
|
|
|
13171
13124
|
}, [required]);
|
|
13172
13125
|
return (
|
|
13173
13126
|
// TODO: Bug - Missing value error is not cleared immediately on change, waits for blur.
|
|
13174
|
-
/* @__PURE__ */
|
|
13127
|
+
/* @__PURE__ */ _jsx114(ControlWithError, {
|
|
13175
13128
|
required,
|
|
13176
13129
|
markWhenOptional,
|
|
13177
13130
|
ref: mergedRefs,
|
|
13178
13131
|
customValidity,
|
|
13179
13132
|
getValidityTarget: () => validityTargetRef.current?.querySelector('input[role="combobox"]'),
|
|
13180
|
-
children: /* @__PURE__ */
|
|
13133
|
+
children: /* @__PURE__ */ _jsx114(combobox_control_default, {
|
|
13181
13134
|
__next40pxDefaultSize: true,
|
|
13182
13135
|
...restProps
|
|
13183
13136
|
})
|
|
@@ -13188,7 +13141,7 @@ var ValidatedComboboxControl = forwardRef(UnforwardedValidatedComboboxControl);
|
|
|
13188
13141
|
ValidatedComboboxControl.displayName = "ValidatedComboboxControl";
|
|
13189
13142
|
|
|
13190
13143
|
// ../components/build-module/validated-form-controls/components/form-token-field.mjs
|
|
13191
|
-
import { jsx as
|
|
13144
|
+
import { jsx as _jsx115, jsxs as _jsxs36 } from "react/jsx-runtime";
|
|
13192
13145
|
var UnforwardedValidatedFormTokenField = ({
|
|
13193
13146
|
required,
|
|
13194
13147
|
customValidity,
|
|
@@ -13196,19 +13149,19 @@ var UnforwardedValidatedFormTokenField = ({
|
|
|
13196
13149
|
...restProps
|
|
13197
13150
|
}, forwardedRef) => {
|
|
13198
13151
|
const validityTargetRef = useRef(null);
|
|
13199
|
-
return /* @__PURE__ */
|
|
13152
|
+
return /* @__PURE__ */ _jsxs36("div", {
|
|
13200
13153
|
className: "components-validated-control__wrapper-with-error-delegate",
|
|
13201
13154
|
ref: forwardedRef,
|
|
13202
|
-
children: [/* @__PURE__ */
|
|
13155
|
+
children: [/* @__PURE__ */ _jsx115(ControlWithError, {
|
|
13203
13156
|
required,
|
|
13204
13157
|
markWhenOptional,
|
|
13205
13158
|
customValidity,
|
|
13206
13159
|
getValidityTarget: () => validityTargetRef.current,
|
|
13207
|
-
children: /* @__PURE__ */
|
|
13160
|
+
children: /* @__PURE__ */ _jsx115(FormTokenField, {
|
|
13208
13161
|
__next40pxDefaultSize: true,
|
|
13209
13162
|
...restProps
|
|
13210
13163
|
})
|
|
13211
|
-
}), /* @__PURE__ */
|
|
13164
|
+
}), /* @__PURE__ */ _jsx115("input", {
|
|
13212
13165
|
className: "components-validated-control__error-delegate",
|
|
13213
13166
|
type: "text",
|
|
13214
13167
|
ref: validityTargetRef,
|
|
@@ -13227,7 +13180,7 @@ var ValidatedFormTokenField = forwardRef(UnforwardedValidatedFormTokenField);
|
|
|
13227
13180
|
ValidatedFormTokenField.displayName = "ValidatedFormTokenField";
|
|
13228
13181
|
|
|
13229
13182
|
// ../components/build-module/validated-form-controls/components/input-control.mjs
|
|
13230
|
-
import { jsx as
|
|
13183
|
+
import { jsx as _jsx116 } from "react/jsx-runtime";
|
|
13231
13184
|
var UnforwardedValidatedInputControl = ({
|
|
13232
13185
|
required,
|
|
13233
13186
|
customValidity,
|
|
@@ -13236,12 +13189,12 @@ var UnforwardedValidatedInputControl = ({
|
|
|
13236
13189
|
}, forwardedRef) => {
|
|
13237
13190
|
const validityTargetRef = useRef(null);
|
|
13238
13191
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13239
|
-
return /* @__PURE__ */
|
|
13192
|
+
return /* @__PURE__ */ _jsx116(ControlWithError, {
|
|
13240
13193
|
required,
|
|
13241
13194
|
markWhenOptional,
|
|
13242
13195
|
customValidity,
|
|
13243
13196
|
getValidityTarget: () => validityTargetRef.current,
|
|
13244
|
-
children: /* @__PURE__ */
|
|
13197
|
+
children: /* @__PURE__ */ _jsx116(input_control_default, {
|
|
13245
13198
|
__next40pxDefaultSize: true,
|
|
13246
13199
|
ref: mergedRefs,
|
|
13247
13200
|
...restProps
|
|
@@ -13252,7 +13205,7 @@ var ValidatedInputControl = forwardRef(UnforwardedValidatedInputControl);
|
|
|
13252
13205
|
ValidatedInputControl.displayName = "ValidatedInputControl";
|
|
13253
13206
|
|
|
13254
13207
|
// ../components/build-module/validated-form-controls/components/number-control.mjs
|
|
13255
|
-
import { jsx as
|
|
13208
|
+
import { jsx as _jsx117 } from "react/jsx-runtime";
|
|
13256
13209
|
var UnforwardedValidatedNumberControl = ({
|
|
13257
13210
|
required,
|
|
13258
13211
|
customValidity,
|
|
@@ -13261,12 +13214,12 @@ var UnforwardedValidatedNumberControl = ({
|
|
|
13261
13214
|
}, forwardedRef) => {
|
|
13262
13215
|
const validityTargetRef = useRef(null);
|
|
13263
13216
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13264
|
-
return /* @__PURE__ */
|
|
13217
|
+
return /* @__PURE__ */ _jsx117(ControlWithError, {
|
|
13265
13218
|
required,
|
|
13266
13219
|
markWhenOptional,
|
|
13267
13220
|
customValidity,
|
|
13268
13221
|
getValidityTarget: () => validityTargetRef.current,
|
|
13269
|
-
children: /* @__PURE__ */
|
|
13222
|
+
children: /* @__PURE__ */ _jsx117(number_control_default, {
|
|
13270
13223
|
__next40pxDefaultSize: true,
|
|
13271
13224
|
ref: mergedRefs,
|
|
13272
13225
|
...restProps
|
|
@@ -13277,7 +13230,7 @@ var ValidatedNumberControl = forwardRef(UnforwardedValidatedNumberControl);
|
|
|
13277
13230
|
ValidatedNumberControl.displayName = "ValidatedNumberControl";
|
|
13278
13231
|
|
|
13279
13232
|
// ../components/build-module/validated-form-controls/components/radio-control.mjs
|
|
13280
|
-
import { jsx as
|
|
13233
|
+
import { jsx as _jsx118 } from "react/jsx-runtime";
|
|
13281
13234
|
var UnforwardedValidatedRadioControl = ({
|
|
13282
13235
|
required,
|
|
13283
13236
|
customValidity,
|
|
@@ -13286,13 +13239,13 @@ var UnforwardedValidatedRadioControl = ({
|
|
|
13286
13239
|
}, forwardedRef) => {
|
|
13287
13240
|
const validityTargetRef = useRef(null);
|
|
13288
13241
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13289
|
-
return /* @__PURE__ */
|
|
13242
|
+
return /* @__PURE__ */ _jsx118(ControlWithError, {
|
|
13290
13243
|
required,
|
|
13291
13244
|
markWhenOptional,
|
|
13292
13245
|
ref: mergedRefs,
|
|
13293
13246
|
customValidity,
|
|
13294
13247
|
getValidityTarget: () => validityTargetRef.current?.querySelector('input[type="radio"]'),
|
|
13295
|
-
children: /* @__PURE__ */
|
|
13248
|
+
children: /* @__PURE__ */ _jsx118(radio_control_default, {
|
|
13296
13249
|
...restProps
|
|
13297
13250
|
})
|
|
13298
13251
|
});
|
|
@@ -13301,7 +13254,7 @@ var ValidatedRadioControl = forwardRef(UnforwardedValidatedRadioControl);
|
|
|
13301
13254
|
ValidatedRadioControl.displayName = "ValidatedRadioControl";
|
|
13302
13255
|
|
|
13303
13256
|
// ../components/build-module/validated-form-controls/components/select-control.mjs
|
|
13304
|
-
import { jsx as
|
|
13257
|
+
import { jsx as _jsx119 } from "react/jsx-runtime";
|
|
13305
13258
|
var UnforwardedValidatedSelectControl = ({
|
|
13306
13259
|
required,
|
|
13307
13260
|
customValidity,
|
|
@@ -13310,12 +13263,12 @@ var UnforwardedValidatedSelectControl = ({
|
|
|
13310
13263
|
}, forwardedRef) => {
|
|
13311
13264
|
const validityTargetRef = useRef(null);
|
|
13312
13265
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13313
|
-
return /* @__PURE__ */
|
|
13266
|
+
return /* @__PURE__ */ _jsx119(ControlWithError, {
|
|
13314
13267
|
required,
|
|
13315
13268
|
markWhenOptional,
|
|
13316
13269
|
customValidity,
|
|
13317
13270
|
getValidityTarget: () => validityTargetRef.current,
|
|
13318
|
-
children: /* @__PURE__ */
|
|
13271
|
+
children: /* @__PURE__ */ _jsx119(select_control_default, {
|
|
13319
13272
|
__next40pxDefaultSize: true,
|
|
13320
13273
|
ref: mergedRefs,
|
|
13321
13274
|
...restProps
|
|
@@ -13326,7 +13279,7 @@ var ValidatedSelectControl = forwardRef(UnforwardedValidatedSelectControl);
|
|
|
13326
13279
|
ValidatedSelectControl.displayName = "ValidatedSelectControl";
|
|
13327
13280
|
|
|
13328
13281
|
// ../components/build-module/validated-form-controls/components/text-control.mjs
|
|
13329
|
-
import { jsx as
|
|
13282
|
+
import { jsx as _jsx120 } from "react/jsx-runtime";
|
|
13330
13283
|
var UnforwardedValidatedTextControl = ({
|
|
13331
13284
|
required,
|
|
13332
13285
|
customValidity,
|
|
@@ -13335,12 +13288,12 @@ var UnforwardedValidatedTextControl = ({
|
|
|
13335
13288
|
}, forwardedRef) => {
|
|
13336
13289
|
const validityTargetRef = useRef(null);
|
|
13337
13290
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13338
|
-
return /* @__PURE__ */
|
|
13291
|
+
return /* @__PURE__ */ _jsx120(ControlWithError, {
|
|
13339
13292
|
required,
|
|
13340
13293
|
markWhenOptional,
|
|
13341
13294
|
customValidity,
|
|
13342
13295
|
getValidityTarget: () => validityTargetRef.current,
|
|
13343
|
-
children: /* @__PURE__ */
|
|
13296
|
+
children: /* @__PURE__ */ _jsx120(text_control_default, {
|
|
13344
13297
|
__next40pxDefaultSize: true,
|
|
13345
13298
|
ref: mergedRefs,
|
|
13346
13299
|
...restProps
|
|
@@ -13351,7 +13304,7 @@ var ValidatedTextControl = forwardRef(UnforwardedValidatedTextControl);
|
|
|
13351
13304
|
ValidatedTextControl.displayName = "ValidatedTextControl";
|
|
13352
13305
|
|
|
13353
13306
|
// ../components/build-module/validated-form-controls/components/textarea-control.mjs
|
|
13354
|
-
import { jsx as
|
|
13307
|
+
import { jsx as _jsx121 } from "react/jsx-runtime";
|
|
13355
13308
|
var UnforwardedValidatedTextareaControl = ({
|
|
13356
13309
|
required,
|
|
13357
13310
|
customValidity,
|
|
@@ -13360,12 +13313,12 @@ var UnforwardedValidatedTextareaControl = ({
|
|
|
13360
13313
|
}, forwardedRef) => {
|
|
13361
13314
|
const validityTargetRef = useRef(null);
|
|
13362
13315
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13363
|
-
return /* @__PURE__ */
|
|
13316
|
+
return /* @__PURE__ */ _jsx121(ControlWithError, {
|
|
13364
13317
|
required,
|
|
13365
13318
|
markWhenOptional,
|
|
13366
13319
|
customValidity,
|
|
13367
13320
|
getValidityTarget: () => validityTargetRef.current,
|
|
13368
|
-
children: /* @__PURE__ */
|
|
13321
|
+
children: /* @__PURE__ */ _jsx121(textarea_control_default, {
|
|
13369
13322
|
ref: mergedRefs,
|
|
13370
13323
|
...restProps
|
|
13371
13324
|
})
|
|
@@ -13375,7 +13328,7 @@ var ValidatedTextareaControl = forwardRef(UnforwardedValidatedTextareaControl);
|
|
|
13375
13328
|
ValidatedTextareaControl.displayName = "ValidatedTextareaControl";
|
|
13376
13329
|
|
|
13377
13330
|
// ../components/build-module/validated-form-controls/components/toggle-control.mjs
|
|
13378
|
-
import { jsx as
|
|
13331
|
+
import { jsx as _jsx122 } from "react/jsx-runtime";
|
|
13379
13332
|
var UnforwardedValidatedToggleControl = ({
|
|
13380
13333
|
required,
|
|
13381
13334
|
customValidity,
|
|
@@ -13384,12 +13337,12 @@ var UnforwardedValidatedToggleControl = ({
|
|
|
13384
13337
|
}, forwardedRef) => {
|
|
13385
13338
|
const validityTargetRef = useRef(null);
|
|
13386
13339
|
const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
|
|
13387
|
-
return /* @__PURE__ */
|
|
13340
|
+
return /* @__PURE__ */ _jsx122(ControlWithError, {
|
|
13388
13341
|
required,
|
|
13389
13342
|
markWhenOptional,
|
|
13390
13343
|
customValidity,
|
|
13391
13344
|
getValidityTarget: () => validityTargetRef.current,
|
|
13392
|
-
children: /* @__PURE__ */
|
|
13345
|
+
children: /* @__PURE__ */ _jsx122(toggle_control_default, {
|
|
13393
13346
|
ref: mergedRefs,
|
|
13394
13347
|
required,
|
|
13395
13348
|
...restProps
|
|
@@ -13400,7 +13353,7 @@ var ValidatedToggleControl = forwardRef(UnforwardedValidatedToggleControl);
|
|
|
13400
13353
|
ValidatedToggleControl.displayName = "ValidatedToggleControl";
|
|
13401
13354
|
|
|
13402
13355
|
// ../components/build-module/validated-form-controls/components/toggle-group-control.mjs
|
|
13403
|
-
import { jsx as
|
|
13356
|
+
import { jsx as _jsx123, jsxs as _jsxs37 } from "react/jsx-runtime";
|
|
13404
13357
|
var UnforwardedValidatedToggleGroupControl = ({
|
|
13405
13358
|
required,
|
|
13406
13359
|
customValidity,
|
|
@@ -13409,19 +13362,19 @@ var UnforwardedValidatedToggleGroupControl = ({
|
|
|
13409
13362
|
}, forwardedRef) => {
|
|
13410
13363
|
const validityTargetRef = useRef(null);
|
|
13411
13364
|
const nameAttr = useId();
|
|
13412
|
-
return /* @__PURE__ */
|
|
13365
|
+
return /* @__PURE__ */ _jsxs37("div", {
|
|
13413
13366
|
className: "components-validated-control__wrapper-with-error-delegate",
|
|
13414
|
-
children: [/* @__PURE__ */
|
|
13367
|
+
children: [/* @__PURE__ */ _jsx123(ControlWithError, {
|
|
13415
13368
|
required,
|
|
13416
13369
|
markWhenOptional,
|
|
13417
13370
|
customValidity,
|
|
13418
13371
|
getValidityTarget: () => validityTargetRef.current,
|
|
13419
|
-
children: /* @__PURE__ */
|
|
13372
|
+
children: /* @__PURE__ */ _jsx123(component_default10, {
|
|
13420
13373
|
__next40pxDefaultSize: true,
|
|
13421
13374
|
ref: forwardedRef,
|
|
13422
13375
|
...restProps
|
|
13423
13376
|
})
|
|
13424
|
-
}), /* @__PURE__ */
|
|
13377
|
+
}), /* @__PURE__ */ _jsx123("input", {
|
|
13425
13378
|
className: "components-validated-control__error-delegate",
|
|
13426
13379
|
type: "radio",
|
|
13427
13380
|
ref: validityTargetRef,
|
|
@@ -13444,8 +13397,6 @@ ValidatedToggleGroupControl.displayName = "ValidatedToggleGroupControl";
|
|
|
13444
13397
|
var privateApis = {};
|
|
13445
13398
|
lock2(privateApis, {
|
|
13446
13399
|
__experimentalPopoverLegacyPositionToPlacement: positionToPlacement,
|
|
13447
|
-
Avatar: component_default24,
|
|
13448
|
-
AvatarGroup: component_default25,
|
|
13449
13400
|
ComponentsContext,
|
|
13450
13401
|
Tabs,
|
|
13451
13402
|
Theme: theme_default,
|
|
@@ -14498,7 +14449,7 @@ function ColumnPrimary({
|
|
|
14498
14449
|
}
|
|
14499
14450
|
var column_primary_default = ColumnPrimary;
|
|
14500
14451
|
|
|
14501
|
-
// src/components/dataviews-layouts/table/use-
|
|
14452
|
+
// src/components/dataviews-layouts/table/use-scroll-state.ts
|
|
14502
14453
|
import { isRTL as isRTL9 } from "@wordpress/i18n";
|
|
14503
14454
|
var isScrolledToEnd = (element) => {
|
|
14504
14455
|
if (isRTL9()) {
|
|
@@ -14507,40 +14458,37 @@ var isScrolledToEnd = (element) => {
|
|
|
14507
14458
|
}
|
|
14508
14459
|
return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
|
|
14509
14460
|
};
|
|
14510
|
-
function
|
|
14461
|
+
function useScrollState({
|
|
14511
14462
|
scrollContainerRef,
|
|
14512
|
-
|
|
14463
|
+
enabledHorizontal = false
|
|
14513
14464
|
}) {
|
|
14514
14465
|
const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = useState(false);
|
|
14515
|
-
const
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14466
|
+
const [isVerticallyScrolled, setIsVerticallyScrolled] = useState(false);
|
|
14467
|
+
const handleScroll = useCallback(() => {
|
|
14468
|
+
const scrollContainer = scrollContainerRef.current;
|
|
14469
|
+
if (!scrollContainer) {
|
|
14470
|
+
return;
|
|
14471
|
+
}
|
|
14472
|
+
if (enabledHorizontal) {
|
|
14473
|
+
setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
|
|
14474
|
+
}
|
|
14475
|
+
setIsVerticallyScrolled(scrollContainer.scrollTop > 0);
|
|
14476
|
+
}, [scrollContainerRef, enabledHorizontal]);
|
|
14524
14477
|
useEffect(() => {
|
|
14525
|
-
if (typeof window === "undefined" || !
|
|
14478
|
+
if (typeof window === "undefined" || !scrollContainerRef.current) {
|
|
14526
14479
|
return () => {
|
|
14527
14480
|
};
|
|
14528
14481
|
}
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
);
|
|
14534
|
-
window.addEventListener("resize", handleIsHorizontalScrollEnd);
|
|
14482
|
+
const scrollContainer = scrollContainerRef.current;
|
|
14483
|
+
handleScroll();
|
|
14484
|
+
scrollContainer.addEventListener("scroll", handleScroll);
|
|
14485
|
+
window.addEventListener("resize", handleScroll);
|
|
14535
14486
|
return () => {
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
handleIsHorizontalScrollEnd
|
|
14539
|
-
);
|
|
14540
|
-
window.removeEventListener("resize", handleIsHorizontalScrollEnd);
|
|
14487
|
+
scrollContainer.removeEventListener("scroll", handleScroll);
|
|
14488
|
+
window.removeEventListener("resize", handleScroll);
|
|
14541
14489
|
};
|
|
14542
|
-
}, [scrollContainerRef,
|
|
14543
|
-
return isHorizontalScrollEnd;
|
|
14490
|
+
}, [scrollContainerRef, enabledHorizontal, handleScroll]);
|
|
14491
|
+
return { isHorizontalScrollEnd, isVerticallyScrolled };
|
|
14544
14492
|
}
|
|
14545
14493
|
|
|
14546
14494
|
// src/components/dataviews-layouts/utils/get-data-by-group.ts
|
|
@@ -14701,7 +14649,7 @@ function TableColumnField({
|
|
|
14701
14649
|
if (!field) {
|
|
14702
14650
|
return null;
|
|
14703
14651
|
}
|
|
14704
|
-
const className2 =
|
|
14652
|
+
const className2 = clsx32("dataviews-view-table__cell-content-wrapper", {
|
|
14705
14653
|
"dataviews-view-table__cell-align-end": align === "end",
|
|
14706
14654
|
"dataviews-view-table__cell-align-center": align === "center"
|
|
14707
14655
|
});
|
|
@@ -14742,7 +14690,7 @@ function TableRow({
|
|
|
14742
14690
|
return /* @__PURE__ */ jsxs6(
|
|
14743
14691
|
"tr",
|
|
14744
14692
|
{
|
|
14745
|
-
className:
|
|
14693
|
+
className: clsx32("dataviews-view-table__row", {
|
|
14746
14694
|
"is-selected": hasPossibleBulkAction && isSelected,
|
|
14747
14695
|
"has-bulk-actions": hasPossibleBulkAction
|
|
14748
14696
|
}),
|
|
@@ -14828,7 +14776,7 @@ function TableRow({
|
|
|
14828
14776
|
/* @__PURE__ */ jsx45(
|
|
14829
14777
|
"td",
|
|
14830
14778
|
{
|
|
14831
|
-
className:
|
|
14779
|
+
className: clsx32("dataviews-view-table__actions-column", {
|
|
14832
14780
|
"dataviews-view-table__actions-column--sticky": true,
|
|
14833
14781
|
"dataviews-view-table__actions-column--stuck": isActionsColumnSticky
|
|
14834
14782
|
}),
|
|
@@ -14871,9 +14819,9 @@ function ViewTable({
|
|
|
14871
14819
|
}
|
|
14872
14820
|
});
|
|
14873
14821
|
const tableNoticeId = useId();
|
|
14874
|
-
const isHorizontalScrollEnd =
|
|
14822
|
+
const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({
|
|
14875
14823
|
scrollContainerRef: containerRef,
|
|
14876
|
-
|
|
14824
|
+
enabledHorizontal: !!actions?.length
|
|
14877
14825
|
});
|
|
14878
14826
|
const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
|
|
14879
14827
|
if (nextHeaderMenuToFocus) {
|
|
@@ -14933,7 +14881,7 @@ function ViewTable({
|
|
|
14933
14881
|
return /* @__PURE__ */ jsx45(
|
|
14934
14882
|
"div",
|
|
14935
14883
|
{
|
|
14936
|
-
className:
|
|
14884
|
+
className: clsx32("dataviews-no-results", {
|
|
14937
14885
|
"is-refreshing": isDelayedLoading
|
|
14938
14886
|
}),
|
|
14939
14887
|
id: tableNoticeId,
|
|
@@ -14945,7 +14893,7 @@ function ViewTable({
|
|
|
14945
14893
|
/* @__PURE__ */ jsxs6(
|
|
14946
14894
|
"table",
|
|
14947
14895
|
{
|
|
14948
|
-
className:
|
|
14896
|
+
className: clsx32("dataviews-view-table", className2, {
|
|
14949
14897
|
[`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
|
|
14950
14898
|
view.layout.density
|
|
14951
14899
|
),
|
|
@@ -14963,10 +14911,10 @@ function ViewTable({
|
|
|
14963
14911
|
columns.map((column, index) => /* @__PURE__ */ jsx45(
|
|
14964
14912
|
"col",
|
|
14965
14913
|
{
|
|
14966
|
-
className:
|
|
14914
|
+
className: clsx32(
|
|
14967
14915
|
`dataviews-view-table__col-${column}`,
|
|
14968
14916
|
{
|
|
14969
|
-
"dataviews-view-table__col-
|
|
14917
|
+
"dataviews-view-table__col-expand": !hasPrimaryColumn && index === columns.length - 1
|
|
14970
14918
|
}
|
|
14971
14919
|
)
|
|
14972
14920
|
},
|
|
@@ -14983,97 +14931,106 @@ function ViewTable({
|
|
|
14983
14931
|
children: /* @__PURE__ */ jsx45(PropertiesSection, { showLabel: false })
|
|
14984
14932
|
}
|
|
14985
14933
|
),
|
|
14986
|
-
/* @__PURE__ */ jsx45(
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
{
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14934
|
+
/* @__PURE__ */ jsx45(
|
|
14935
|
+
"thead",
|
|
14936
|
+
{
|
|
14937
|
+
className: clsx32({
|
|
14938
|
+
"dataviews-view-table__thead--stuck": isVerticallyScrolled
|
|
14939
|
+
}),
|
|
14940
|
+
onContextMenu: handleHeaderContextMenu,
|
|
14941
|
+
children: /* @__PURE__ */ jsxs6("tr", { className: "dataviews-view-table__row", children: [
|
|
14942
|
+
hasBulkActions && /* @__PURE__ */ jsx45(
|
|
14943
|
+
"th",
|
|
14995
14944
|
{
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
14945
|
+
className: "dataviews-view-table__checkbox-column",
|
|
14946
|
+
scope: "col",
|
|
14947
|
+
onContextMenu: handleHeaderContextMenu,
|
|
14948
|
+
children: /* @__PURE__ */ jsx45(
|
|
14949
|
+
BulkSelectionCheckbox,
|
|
14950
|
+
{
|
|
14951
|
+
selection,
|
|
14952
|
+
onChangeSelection,
|
|
14953
|
+
data,
|
|
14954
|
+
actions,
|
|
14955
|
+
getItemId
|
|
14956
|
+
}
|
|
14957
|
+
)
|
|
15001
14958
|
}
|
|
15002
|
-
)
|
|
15003
|
-
}
|
|
15004
|
-
),
|
|
15005
|
-
hasPrimaryColumn && /* @__PURE__ */ jsx45("th", { scope: "col", children: titleField && /* @__PURE__ */ jsx45(
|
|
15006
|
-
column_header_menu_default,
|
|
15007
|
-
{
|
|
15008
|
-
ref: headerMenuRef(
|
|
15009
|
-
titleField.id,
|
|
15010
|
-
0
|
|
15011
14959
|
),
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
"aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
|
|
15043
|
-
scope: "col",
|
|
15044
|
-
children: /* @__PURE__ */ jsx45(
|
|
15045
|
-
column_header_menu_default,
|
|
14960
|
+
hasPrimaryColumn && /* @__PURE__ */ jsx45("th", { scope: "col", children: titleField && /* @__PURE__ */ jsx45(
|
|
14961
|
+
column_header_menu_default,
|
|
14962
|
+
{
|
|
14963
|
+
ref: headerMenuRef(
|
|
14964
|
+
titleField.id,
|
|
14965
|
+
0
|
|
14966
|
+
),
|
|
14967
|
+
fieldId: titleField.id,
|
|
14968
|
+
view,
|
|
14969
|
+
fields,
|
|
14970
|
+
onChangeView,
|
|
14971
|
+
onHide,
|
|
14972
|
+
setOpenedFilter,
|
|
14973
|
+
canMove: false,
|
|
14974
|
+
canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false,
|
|
14975
|
+
canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true
|
|
14976
|
+
}
|
|
14977
|
+
) }),
|
|
14978
|
+
columns.map((column, index) => {
|
|
14979
|
+
const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
|
|
14980
|
+
const field = fields.find(
|
|
14981
|
+
(f) => f.id === column
|
|
14982
|
+
);
|
|
14983
|
+
const effectiveAlign = getEffectiveAlign(
|
|
14984
|
+
align,
|
|
14985
|
+
field?.type
|
|
14986
|
+
);
|
|
14987
|
+
const canInsertOrMove = view.layout?.enableMoving ?? true;
|
|
14988
|
+
return /* @__PURE__ */ jsx45(
|
|
14989
|
+
"th",
|
|
15046
14990
|
{
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
14991
|
+
style: {
|
|
14992
|
+
width,
|
|
14993
|
+
maxWidth,
|
|
14994
|
+
minWidth,
|
|
14995
|
+
textAlign: effectiveAlign
|
|
14996
|
+
},
|
|
14997
|
+
"aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
|
|
14998
|
+
scope: "col",
|
|
14999
|
+
children: /* @__PURE__ */ jsx45(
|
|
15000
|
+
column_header_menu_default,
|
|
15001
|
+
{
|
|
15002
|
+
ref: headerMenuRef(column, index),
|
|
15003
|
+
fieldId: column,
|
|
15004
|
+
view,
|
|
15005
|
+
fields,
|
|
15006
|
+
onChangeView,
|
|
15007
|
+
onHide,
|
|
15008
|
+
setOpenedFilter,
|
|
15009
|
+
canMove: canInsertOrMove,
|
|
15010
|
+
canInsertLeft: canInsertOrMove,
|
|
15011
|
+
canInsertRight: canInsertOrMove
|
|
15012
|
+
}
|
|
15013
|
+
)
|
|
15014
|
+
},
|
|
15015
|
+
column
|
|
15016
|
+
);
|
|
15017
|
+
}),
|
|
15018
|
+
!!actions?.length && /* @__PURE__ */ jsx45(
|
|
15019
|
+
"th",
|
|
15068
15020
|
{
|
|
15069
|
-
|
|
15070
|
-
|
|
15021
|
+
className: clsx32(
|
|
15022
|
+
"dataviews-view-table__actions-column",
|
|
15023
|
+
{
|
|
15024
|
+
"dataviews-view-table__actions-column--sticky": true,
|
|
15025
|
+
"dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
|
|
15026
|
+
}
|
|
15027
|
+
),
|
|
15028
|
+
children: /* @__PURE__ */ jsx45("span", { className: "dataviews-view-table-header", children: __23("Actions") })
|
|
15071
15029
|
}
|
|
15072
|
-
)
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
] }) }),
|
|
15030
|
+
)
|
|
15031
|
+
] })
|
|
15032
|
+
}
|
|
15033
|
+
),
|
|
15077
15034
|
hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
|
|
15078
15035
|
([groupName, groupItems]) => /* @__PURE__ */ jsxs6("tbody", { children: [
|
|
15079
15036
|
/* @__PURE__ */ jsx45("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ jsx45(
|
|
@@ -15146,11 +15103,11 @@ function ViewTable({
|
|
|
15146
15103
|
var table_default = ViewTable;
|
|
15147
15104
|
|
|
15148
15105
|
// src/components/dataviews-layouts/grid/index.tsx
|
|
15149
|
-
import
|
|
15106
|
+
import clsx34 from "clsx";
|
|
15150
15107
|
import { __ as __26, sprintf as sprintf8 } from "@wordpress/i18n";
|
|
15151
15108
|
|
|
15152
15109
|
// src/components/dataviews-layouts/grid/composite-grid.tsx
|
|
15153
|
-
import
|
|
15110
|
+
import clsx33 from "clsx";
|
|
15154
15111
|
import { __ as __25, sprintf as sprintf7 } from "@wordpress/i18n";
|
|
15155
15112
|
|
|
15156
15113
|
// src/components/dataviews-layouts/grid/preview-size-picker.tsx
|
|
@@ -15267,7 +15224,7 @@ var GridItem = forwardRef(function GridItem2({
|
|
|
15267
15224
|
direction: "column",
|
|
15268
15225
|
...props,
|
|
15269
15226
|
ref,
|
|
15270
|
-
className:
|
|
15227
|
+
className: clsx33(
|
|
15271
15228
|
props.className,
|
|
15272
15229
|
"dataviews-view-grid__row__gridcell",
|
|
15273
15230
|
"dataviews-view-grid__card",
|
|
@@ -15296,7 +15253,7 @@ var GridItem = forwardRef(function GridItem2({
|
|
|
15296
15253
|
isItemClickable: isItemClickable2,
|
|
15297
15254
|
onClickItem,
|
|
15298
15255
|
renderItemLink,
|
|
15299
|
-
className:
|
|
15256
|
+
className: clsx33("dataviews-view-grid__media", {
|
|
15300
15257
|
"dataviews-view-grid__media--placeholder": !rendersMediaField
|
|
15301
15258
|
}),
|
|
15302
15259
|
...mediaA11yProps,
|
|
@@ -15457,7 +15414,11 @@ function CompositeGrid({
|
|
|
15457
15414
|
Composite2,
|
|
15458
15415
|
{
|
|
15459
15416
|
role: isInfiniteScroll ? "feed" : "grid",
|
|
15460
|
-
className:
|
|
15417
|
+
className: clsx33("dataviews-view-grid", className2, {
|
|
15418
|
+
[`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
|
|
15419
|
+
view.layout.density
|
|
15420
|
+
)
|
|
15421
|
+
}),
|
|
15461
15422
|
focusWrap: true,
|
|
15462
15423
|
"aria-busy": isLoading,
|
|
15463
15424
|
"aria-rowcount": isInfiniteScroll ? void 0 : totalRows,
|
|
@@ -15551,7 +15512,7 @@ function ViewGrid({
|
|
|
15551
15512
|
return /* @__PURE__ */ jsx48(
|
|
15552
15513
|
"div",
|
|
15553
15514
|
{
|
|
15554
|
-
className:
|
|
15515
|
+
className: clsx34("dataviews-no-results", {
|
|
15555
15516
|
"is-refreshing": isDelayedLoading
|
|
15556
15517
|
}),
|
|
15557
15518
|
children: empty
|
|
@@ -15559,7 +15520,7 @@ function ViewGrid({
|
|
|
15559
15520
|
);
|
|
15560
15521
|
}
|
|
15561
15522
|
const gridProps = {
|
|
15562
|
-
className:
|
|
15523
|
+
className: clsx34(className2, {
|
|
15563
15524
|
"is-refreshing": !isInfiniteScroll && isDelayedLoading
|
|
15564
15525
|
}),
|
|
15565
15526
|
inert: !isInfiniteScroll && !!isLoading ? "true" : void 0,
|
|
@@ -15619,7 +15580,7 @@ function ViewGrid({
|
|
|
15619
15580
|
var grid_default = ViewGrid;
|
|
15620
15581
|
|
|
15621
15582
|
// src/components/dataviews-layouts/list/index.tsx
|
|
15622
|
-
import
|
|
15583
|
+
import clsx35 from "clsx";
|
|
15623
15584
|
import { __ as __27, sprintf as sprintf9 } from "@wordpress/i18n";
|
|
15624
15585
|
import { useRegistry as useRegistry3 } from "@wordpress/data";
|
|
15625
15586
|
import { Fragment as Fragment7, jsx as jsx49, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
@@ -15831,7 +15792,7 @@ function ListItem({
|
|
|
15831
15792
|
)
|
|
15832
15793
|
),
|
|
15833
15794
|
role: infiniteScrollEnabled ? "article" : "row",
|
|
15834
|
-
className:
|
|
15795
|
+
className: clsx35({
|
|
15835
15796
|
"is-selected": isSelected,
|
|
15836
15797
|
"is-hovered": isHovered
|
|
15837
15798
|
}),
|
|
@@ -16046,7 +16007,7 @@ function ViewList(props) {
|
|
|
16046
16007
|
return /* @__PURE__ */ jsx49(
|
|
16047
16008
|
"div",
|
|
16048
16009
|
{
|
|
16049
|
-
className:
|
|
16010
|
+
className: clsx35("dataviews-no-results", {
|
|
16050
16011
|
"is-refreshing": isDelayedLoading
|
|
16051
16012
|
}),
|
|
16052
16013
|
children: empty
|
|
@@ -16069,7 +16030,7 @@ function ViewList(props) {
|
|
|
16069
16030
|
{
|
|
16070
16031
|
direction: "column",
|
|
16071
16032
|
gap: "lg",
|
|
16072
|
-
className:
|
|
16033
|
+
className: clsx35("dataviews-view-list", className2),
|
|
16073
16034
|
children: Array.from(dataByGroup.entries()).map(
|
|
16074
16035
|
([groupName, groupItems]) => /* @__PURE__ */ jsxs9(
|
|
16075
16036
|
Stack,
|
|
@@ -16120,7 +16081,7 @@ function ViewList(props) {
|
|
|
16120
16081
|
ref: compositeRef,
|
|
16121
16082
|
id: baseId,
|
|
16122
16083
|
render: /* @__PURE__ */ jsx49("div", {}),
|
|
16123
|
-
className:
|
|
16084
|
+
className: clsx35("dataviews-view-list", className2, {
|
|
16124
16085
|
[`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
|
|
16125
16086
|
view.layout.density
|
|
16126
16087
|
),
|
|
@@ -16158,7 +16119,7 @@ function ViewList(props) {
|
|
|
16158
16119
|
}
|
|
16159
16120
|
|
|
16160
16121
|
// src/components/dataviews-layouts/activity/index.tsx
|
|
16161
|
-
import
|
|
16122
|
+
import clsx37 from "clsx";
|
|
16162
16123
|
|
|
16163
16124
|
// src/components/dataviews-layouts/activity/activity-group.tsx
|
|
16164
16125
|
import { __ as __28, sprintf as sprintf10 } from "@wordpress/i18n";
|
|
@@ -16198,7 +16159,7 @@ function ActivityGroup({
|
|
|
16198
16159
|
}
|
|
16199
16160
|
|
|
16200
16161
|
// src/components/dataviews-layouts/activity/activity-item.tsx
|
|
16201
|
-
import
|
|
16162
|
+
import clsx36 from "clsx";
|
|
16202
16163
|
import { useRegistry as useRegistry4 } from "@wordpress/data";
|
|
16203
16164
|
import { jsx as jsx51, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
16204
16165
|
function ActivityItem(props) {
|
|
@@ -16271,7 +16232,7 @@ function ActivityItem(props) {
|
|
|
16271
16232
|
role: infiniteScrollEnabled ? "article" : void 0,
|
|
16272
16233
|
"aria-posinset": posinset,
|
|
16273
16234
|
"aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
|
|
16274
|
-
className:
|
|
16235
|
+
className: clsx36(
|
|
16275
16236
|
"dataviews-view-activity__item",
|
|
16276
16237
|
density === "compact" && "is-compact",
|
|
16277
16238
|
density === "balanced" && "is-balanced",
|
|
@@ -16410,7 +16371,7 @@ function ViewActivity(props) {
|
|
|
16410
16371
|
return /* @__PURE__ */ jsx52(
|
|
16411
16372
|
"div",
|
|
16412
16373
|
{
|
|
16413
|
-
className:
|
|
16374
|
+
className: clsx37("dataviews-no-results", {
|
|
16414
16375
|
"is-refreshing": isDelayedLoading
|
|
16415
16376
|
}),
|
|
16416
16377
|
children: empty
|
|
@@ -16418,7 +16379,7 @@ function ViewActivity(props) {
|
|
|
16418
16379
|
);
|
|
16419
16380
|
}
|
|
16420
16381
|
const isInert = !isInfiniteScroll && !!isLoading;
|
|
16421
|
-
const wrapperClassName =
|
|
16382
|
+
const wrapperClassName = clsx37("dataviews-view-activity", className2, {
|
|
16422
16383
|
"is-refreshing": !isInfiniteScroll && isDelayedLoading
|
|
16423
16384
|
});
|
|
16424
16385
|
const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : [];
|
|
@@ -16467,7 +16428,7 @@ function ViewActivity(props) {
|
|
|
16467
16428
|
}
|
|
16468
16429
|
|
|
16469
16430
|
// src/components/dataviews-layouts/picker-grid/index.tsx
|
|
16470
|
-
import
|
|
16431
|
+
import clsx39 from "clsx";
|
|
16471
16432
|
import { __ as __31, sprintf as sprintf12 } from "@wordpress/i18n";
|
|
16472
16433
|
|
|
16473
16434
|
// src/components/dataviews-picker-footer/index.tsx
|
|
@@ -16735,14 +16696,14 @@ function DataViewsPickerFooter() {
|
|
|
16735
16696
|
}
|
|
16736
16697
|
|
|
16737
16698
|
// src/components/dataviews-layouts/utils/grid-items.tsx
|
|
16738
|
-
import
|
|
16699
|
+
import clsx38 from "clsx";
|
|
16739
16700
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
16740
16701
|
var GridItems = forwardRef(({ className: className2, previewSize, ...props }, ref) => {
|
|
16741
16702
|
return /* @__PURE__ */ jsx55(
|
|
16742
16703
|
"div",
|
|
16743
16704
|
{
|
|
16744
16705
|
ref,
|
|
16745
|
-
className:
|
|
16706
|
+
className: clsx38("dataviews-view-grid-items", className2),
|
|
16746
16707
|
style: {
|
|
16747
16708
|
gridTemplateColumns: previewSize && `repeat(auto-fill, minmax(${previewSize}px, 1fr))`
|
|
16748
16709
|
},
|
|
@@ -16790,7 +16751,7 @@ function GridItem3({
|
|
|
16790
16751
|
role: "option",
|
|
16791
16752
|
"aria-posinset": posinset,
|
|
16792
16753
|
"aria-setsize": setsize,
|
|
16793
|
-
className:
|
|
16754
|
+
className: clsx39("dataviews-view-picker-grid__card", {
|
|
16794
16755
|
"is-selected": isSelected
|
|
16795
16756
|
}),
|
|
16796
16757
|
"aria-selected": isSelected,
|
|
@@ -17000,9 +16961,14 @@ function ViewPickerGrid({
|
|
|
17000
16961
|
orientation: "horizontal",
|
|
17001
16962
|
role: "listbox",
|
|
17002
16963
|
"aria-multiselectable": isMultiselect,
|
|
17003
|
-
className:
|
|
16964
|
+
className: clsx39(
|
|
17004
16965
|
"dataviews-view-picker-grid",
|
|
17005
|
-
className2
|
|
16966
|
+
className2,
|
|
16967
|
+
{
|
|
16968
|
+
[`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
|
|
16969
|
+
view.layout.density
|
|
16970
|
+
)
|
|
16971
|
+
}
|
|
17006
16972
|
),
|
|
17007
16973
|
"aria-label": itemListLabel,
|
|
17008
16974
|
render: ({ children, ...props }) => /* @__PURE__ */ jsx56(
|
|
@@ -17070,9 +17036,15 @@ function ViewPickerGrid({
|
|
|
17070
17036
|
render: /* @__PURE__ */ jsx56(
|
|
17071
17037
|
GridItems,
|
|
17072
17038
|
{
|
|
17073
|
-
className:
|
|
17039
|
+
className: clsx39(
|
|
17074
17040
|
"dataviews-view-picker-grid",
|
|
17075
|
-
className2
|
|
17041
|
+
className2,
|
|
17042
|
+
{
|
|
17043
|
+
[`has-${view.layout?.density}-density`]: view.layout?.density && [
|
|
17044
|
+
"compact",
|
|
17045
|
+
"comfortable"
|
|
17046
|
+
].includes(view.layout.density)
|
|
17047
|
+
}
|
|
17076
17048
|
),
|
|
17077
17049
|
previewSize: usedPreviewSize,
|
|
17078
17050
|
"aria-busy": isLoading,
|
|
@@ -17118,7 +17090,7 @@ function ViewPickerGrid({
|
|
|
17118
17090
|
!hasData && /* @__PURE__ */ jsx56(
|
|
17119
17091
|
"div",
|
|
17120
17092
|
{
|
|
17121
|
-
className:
|
|
17093
|
+
className: clsx39({
|
|
17122
17094
|
"dataviews-loading": isLoading,
|
|
17123
17095
|
"dataviews-no-results": !isLoading
|
|
17124
17096
|
}),
|
|
@@ -17132,7 +17104,7 @@ function ViewPickerGrid({
|
|
|
17132
17104
|
var picker_grid_default = ViewPickerGrid;
|
|
17133
17105
|
|
|
17134
17106
|
// src/components/dataviews-layouts/picker-table/index.tsx
|
|
17135
|
-
import
|
|
17107
|
+
import clsx40 from "clsx";
|
|
17136
17108
|
import { __ as __32, sprintf as sprintf13 } from "@wordpress/i18n";
|
|
17137
17109
|
import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
17138
17110
|
function TableColumnField2({
|
|
@@ -17145,7 +17117,7 @@ function TableColumnField2({
|
|
|
17145
17117
|
if (!field) {
|
|
17146
17118
|
return null;
|
|
17147
17119
|
}
|
|
17148
|
-
const className2 =
|
|
17120
|
+
const className2 = clsx40("dataviews-view-table__cell-content-wrapper", {
|
|
17149
17121
|
"dataviews-view-table__cell-align-end": align === "end",
|
|
17150
17122
|
"dataviews-view-table__cell-align-center": align === "center"
|
|
17151
17123
|
});
|
|
@@ -17188,7 +17160,7 @@ function TableRow2({
|
|
|
17188
17160
|
render: ({ children, ...props }) => /* @__PURE__ */ jsx57(
|
|
17189
17161
|
"tr",
|
|
17190
17162
|
{
|
|
17191
|
-
className:
|
|
17163
|
+
className: clsx40("dataviews-view-table__row", {
|
|
17192
17164
|
"is-selected": isSelected,
|
|
17193
17165
|
"is-hovered": isHovered
|
|
17194
17166
|
}),
|
|
@@ -17333,7 +17305,7 @@ function ViewPickerTable({
|
|
|
17333
17305
|
/* @__PURE__ */ jsxs16(
|
|
17334
17306
|
"table",
|
|
17335
17307
|
{
|
|
17336
|
-
className:
|
|
17308
|
+
className: clsx40(
|
|
17337
17309
|
"dataviews-view-table",
|
|
17338
17310
|
"dataviews-view-picker-table",
|
|
17339
17311
|
className2,
|
|
@@ -17494,7 +17466,7 @@ function ViewPickerTable({
|
|
|
17494
17466
|
/* @__PURE__ */ jsxs16(
|
|
17495
17467
|
"div",
|
|
17496
17468
|
{
|
|
17497
|
-
className:
|
|
17469
|
+
className: clsx40({
|
|
17498
17470
|
"dataviews-loading": isLoading,
|
|
17499
17471
|
"dataviews-no-results": !hasData && !isLoading
|
|
17500
17472
|
}),
|
|
@@ -17509,9 +17481,64 @@ function ViewPickerTable({
|
|
|
17509
17481
|
}
|
|
17510
17482
|
var picker_table_default = ViewPickerTable;
|
|
17511
17483
|
|
|
17484
|
+
// src/components/dataviews-layouts/utils/density-picker.tsx
|
|
17485
|
+
import { __ as __33, _x as _x2 } from "@wordpress/i18n";
|
|
17486
|
+
import { jsx as jsx58, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
17487
|
+
function DensityPicker() {
|
|
17488
|
+
const context = useContext(dataviews_context_default);
|
|
17489
|
+
const view = context.view;
|
|
17490
|
+
return /* @__PURE__ */ jsxs17(
|
|
17491
|
+
component_default10,
|
|
17492
|
+
{
|
|
17493
|
+
size: "__unstable-large",
|
|
17494
|
+
label: __33("Density"),
|
|
17495
|
+
value: view.layout?.density || "balanced",
|
|
17496
|
+
onChange: (value) => {
|
|
17497
|
+
context.onChangeView({
|
|
17498
|
+
...view,
|
|
17499
|
+
layout: {
|
|
17500
|
+
...view.layout,
|
|
17501
|
+
density: value
|
|
17502
|
+
}
|
|
17503
|
+
});
|
|
17504
|
+
},
|
|
17505
|
+
isBlock: true,
|
|
17506
|
+
children: [
|
|
17507
|
+
/* @__PURE__ */ jsx58(
|
|
17508
|
+
component_default12,
|
|
17509
|
+
{
|
|
17510
|
+
value: "comfortable",
|
|
17511
|
+
label: _x2(
|
|
17512
|
+
"Comfortable",
|
|
17513
|
+
"Density option for DataView layout"
|
|
17514
|
+
)
|
|
17515
|
+
},
|
|
17516
|
+
"comfortable"
|
|
17517
|
+
),
|
|
17518
|
+
/* @__PURE__ */ jsx58(
|
|
17519
|
+
component_default12,
|
|
17520
|
+
{
|
|
17521
|
+
value: "balanced",
|
|
17522
|
+
label: _x2("Balanced", "Density option for DataView layout")
|
|
17523
|
+
},
|
|
17524
|
+
"balanced"
|
|
17525
|
+
),
|
|
17526
|
+
/* @__PURE__ */ jsx58(
|
|
17527
|
+
component_default12,
|
|
17528
|
+
{
|
|
17529
|
+
value: "compact",
|
|
17530
|
+
label: _x2("Compact", "Density option for DataView layout")
|
|
17531
|
+
},
|
|
17532
|
+
"compact"
|
|
17533
|
+
)
|
|
17534
|
+
]
|
|
17535
|
+
}
|
|
17536
|
+
);
|
|
17537
|
+
}
|
|
17538
|
+
|
|
17512
17539
|
// src/components/dataviews-layouts/utils/preview-size-picker.tsx
|
|
17513
|
-
import { __ as
|
|
17514
|
-
import { jsx as
|
|
17540
|
+
import { __ as __34 } from "@wordpress/i18n";
|
|
17541
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
17515
17542
|
var imageSizes2 = [
|
|
17516
17543
|
{
|
|
17517
17544
|
value: 120,
|
|
@@ -17554,12 +17581,12 @@ function PreviewSizePicker() {
|
|
|
17554
17581
|
value: index
|
|
17555
17582
|
};
|
|
17556
17583
|
});
|
|
17557
|
-
return /* @__PURE__ */
|
|
17584
|
+
return /* @__PURE__ */ jsx59(
|
|
17558
17585
|
range_control_default,
|
|
17559
17586
|
{
|
|
17560
17587
|
__next40pxDefaultSize: true,
|
|
17561
17588
|
showTooltip: false,
|
|
17562
|
-
label:
|
|
17589
|
+
label: __34("Preview size"),
|
|
17563
17590
|
value: previewSizeToUse,
|
|
17564
17591
|
min: 0,
|
|
17565
17592
|
max: breakValues.length - 1,
|
|
@@ -17579,59 +17606,13 @@ function PreviewSizePicker() {
|
|
|
17579
17606
|
);
|
|
17580
17607
|
}
|
|
17581
17608
|
|
|
17582
|
-
// src/components/dataviews-layouts/utils/
|
|
17583
|
-
import {
|
|
17584
|
-
|
|
17585
|
-
|
|
17586
|
-
|
|
17587
|
-
|
|
17588
|
-
|
|
17589
|
-
component_default10,
|
|
17590
|
-
{
|
|
17591
|
-
size: "__unstable-large",
|
|
17592
|
-
label: __34("Density"),
|
|
17593
|
-
value: view.layout?.density || "balanced",
|
|
17594
|
-
onChange: (value) => {
|
|
17595
|
-
context.onChangeView({
|
|
17596
|
-
...view,
|
|
17597
|
-
layout: {
|
|
17598
|
-
...view.layout,
|
|
17599
|
-
density: value
|
|
17600
|
-
}
|
|
17601
|
-
});
|
|
17602
|
-
},
|
|
17603
|
-
isBlock: true,
|
|
17604
|
-
children: [
|
|
17605
|
-
/* @__PURE__ */ jsx59(
|
|
17606
|
-
component_default12,
|
|
17607
|
-
{
|
|
17608
|
-
value: "comfortable",
|
|
17609
|
-
label: _x2(
|
|
17610
|
-
"Comfortable",
|
|
17611
|
-
"Density option for DataView layout"
|
|
17612
|
-
)
|
|
17613
|
-
},
|
|
17614
|
-
"comfortable"
|
|
17615
|
-
),
|
|
17616
|
-
/* @__PURE__ */ jsx59(
|
|
17617
|
-
component_default12,
|
|
17618
|
-
{
|
|
17619
|
-
value: "balanced",
|
|
17620
|
-
label: _x2("Balanced", "Density option for DataView layout")
|
|
17621
|
-
},
|
|
17622
|
-
"balanced"
|
|
17623
|
-
),
|
|
17624
|
-
/* @__PURE__ */ jsx59(
|
|
17625
|
-
component_default12,
|
|
17626
|
-
{
|
|
17627
|
-
value: "compact",
|
|
17628
|
-
label: _x2("Compact", "Density option for DataView layout")
|
|
17629
|
-
},
|
|
17630
|
-
"compact"
|
|
17631
|
-
)
|
|
17632
|
-
]
|
|
17633
|
-
}
|
|
17634
|
-
);
|
|
17609
|
+
// src/components/dataviews-layouts/utils/grid-config-options.tsx
|
|
17610
|
+
import { Fragment as Fragment11, jsx as jsx60, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
17611
|
+
function GridConfigOptions() {
|
|
17612
|
+
return /* @__PURE__ */ jsxs18(Fragment11, { children: [
|
|
17613
|
+
/* @__PURE__ */ jsx60(DensityPicker, {}),
|
|
17614
|
+
/* @__PURE__ */ jsx60(PreviewSizePicker, {})
|
|
17615
|
+
] });
|
|
17635
17616
|
}
|
|
17636
17617
|
|
|
17637
17618
|
// src/components/dataviews-layouts/index.ts
|
|
@@ -17648,7 +17629,7 @@ var VIEW_LAYOUTS = [
|
|
|
17648
17629
|
label: __35("Grid"),
|
|
17649
17630
|
component: grid_default,
|
|
17650
17631
|
icon: category_default,
|
|
17651
|
-
viewConfigOptions:
|
|
17632
|
+
viewConfigOptions: GridConfigOptions
|
|
17652
17633
|
},
|
|
17653
17634
|
{
|
|
17654
17635
|
type: LAYOUT_LIST,
|
|
@@ -17669,7 +17650,7 @@ var VIEW_LAYOUTS = [
|
|
|
17669
17650
|
label: __35("Grid"),
|
|
17670
17651
|
component: picker_grid_default,
|
|
17671
17652
|
icon: category_default,
|
|
17672
|
-
viewConfigOptions:
|
|
17653
|
+
viewConfigOptions: GridConfigOptions,
|
|
17673
17654
|
isPicker: true
|
|
17674
17655
|
},
|
|
17675
17656
|
{
|
|
@@ -17683,13 +17664,13 @@ var VIEW_LAYOUTS = [
|
|
|
17683
17664
|
];
|
|
17684
17665
|
|
|
17685
17666
|
// src/components/dataviews-filters/filter.tsx
|
|
17686
|
-
import
|
|
17667
|
+
import clsx42 from "clsx";
|
|
17687
17668
|
import { __ as __38, sprintf as sprintf16 } from "@wordpress/i18n";
|
|
17688
17669
|
|
|
17689
17670
|
// src/components/dataviews-filters/search-widget.tsx
|
|
17690
17671
|
import * as Ariakit21 from "@ariakit/react";
|
|
17691
17672
|
import removeAccents2 from "remove-accents";
|
|
17692
|
-
import
|
|
17673
|
+
import clsx41 from "clsx";
|
|
17693
17674
|
import { __ as __36, sprintf as sprintf14 } from "@wordpress/i18n";
|
|
17694
17675
|
|
|
17695
17676
|
// src/components/dataviews-filters/utils.ts
|
|
@@ -17748,7 +17729,7 @@ function useElements({
|
|
|
17748
17729
|
}
|
|
17749
17730
|
|
|
17750
17731
|
// src/components/dataviews-filters/search-widget.tsx
|
|
17751
|
-
import { jsx as
|
|
17732
|
+
import { jsx as jsx61, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
17752
17733
|
function normalizeSearchInput(input = "") {
|
|
17753
17734
|
return removeAccents2(input.trim().toLowerCase());
|
|
17754
17735
|
}
|
|
@@ -17765,22 +17746,22 @@ function generateFilterElementCompositeItemId(prefix, filterElementValue) {
|
|
|
17765
17746
|
return `${prefix}-${filterElementValue}`;
|
|
17766
17747
|
}
|
|
17767
17748
|
var MultiSelectionOption = ({ selected }) => {
|
|
17768
|
-
return /* @__PURE__ */
|
|
17749
|
+
return /* @__PURE__ */ jsx61(
|
|
17769
17750
|
"span",
|
|
17770
17751
|
{
|
|
17771
|
-
className:
|
|
17752
|
+
className: clsx41(
|
|
17772
17753
|
"dataviews-filters__search-widget-listitem-multi-selection",
|
|
17773
17754
|
{ "is-selected": selected }
|
|
17774
17755
|
),
|
|
17775
|
-
children: selected && /* @__PURE__ */
|
|
17756
|
+
children: selected && /* @__PURE__ */ jsx61(icon_default2, { icon: check_default })
|
|
17776
17757
|
}
|
|
17777
17758
|
);
|
|
17778
17759
|
};
|
|
17779
17760
|
var SingleSelectionOption = ({ selected }) => {
|
|
17780
|
-
return /* @__PURE__ */
|
|
17761
|
+
return /* @__PURE__ */ jsx61(
|
|
17781
17762
|
"span",
|
|
17782
17763
|
{
|
|
17783
|
-
className:
|
|
17764
|
+
className: clsx41(
|
|
17784
17765
|
"dataviews-filters__search-widget-listitem-single-selection",
|
|
17785
17766
|
{ "is-selected": selected }
|
|
17786
17767
|
)
|
|
@@ -17802,7 +17783,7 @@ function ListBox({ view, filter, onChangeView }) {
|
|
|
17802
17783
|
(f) => f.field === filter.field
|
|
17803
17784
|
);
|
|
17804
17785
|
const currentValue = getCurrentValue(filter, currentFilter);
|
|
17805
|
-
return /* @__PURE__ */
|
|
17786
|
+
return /* @__PURE__ */ jsx61(
|
|
17806
17787
|
Composite2,
|
|
17807
17788
|
{
|
|
17808
17789
|
virtualFocus: true,
|
|
@@ -17826,18 +17807,18 @@ function ListBox({ view, filter, onChangeView }) {
|
|
|
17826
17807
|
);
|
|
17827
17808
|
}
|
|
17828
17809
|
},
|
|
17829
|
-
render: /* @__PURE__ */
|
|
17830
|
-
children: filter.elements.map((element) => /* @__PURE__ */
|
|
17810
|
+
render: /* @__PURE__ */ jsx61(Composite2.Typeahead, {}),
|
|
17811
|
+
children: filter.elements.map((element) => /* @__PURE__ */ jsxs19(
|
|
17831
17812
|
Composite2.Hover,
|
|
17832
17813
|
{
|
|
17833
|
-
render: /* @__PURE__ */
|
|
17814
|
+
render: /* @__PURE__ */ jsx61(
|
|
17834
17815
|
Composite2.Item,
|
|
17835
17816
|
{
|
|
17836
17817
|
id: generateFilterElementCompositeItemId(
|
|
17837
17818
|
baseId,
|
|
17838
17819
|
element.value
|
|
17839
17820
|
),
|
|
17840
|
-
render: /* @__PURE__ */
|
|
17821
|
+
render: /* @__PURE__ */ jsx61(
|
|
17841
17822
|
"div",
|
|
17842
17823
|
{
|
|
17843
17824
|
"aria-label": element.label,
|
|
@@ -17884,19 +17865,19 @@ function ListBox({ view, filter, onChangeView }) {
|
|
|
17884
17865
|
}
|
|
17885
17866
|
),
|
|
17886
17867
|
children: [
|
|
17887
|
-
filter.singleSelection && /* @__PURE__ */
|
|
17868
|
+
filter.singleSelection && /* @__PURE__ */ jsx61(
|
|
17888
17869
|
SingleSelectionOption,
|
|
17889
17870
|
{
|
|
17890
17871
|
selected: currentValue === element.value
|
|
17891
17872
|
}
|
|
17892
17873
|
),
|
|
17893
|
-
!filter.singleSelection && /* @__PURE__ */
|
|
17874
|
+
!filter.singleSelection && /* @__PURE__ */ jsx61(
|
|
17894
17875
|
MultiSelectionOption,
|
|
17895
17876
|
{
|
|
17896
17877
|
selected: currentValue.includes(element.value)
|
|
17897
17878
|
}
|
|
17898
17879
|
),
|
|
17899
|
-
/* @__PURE__ */
|
|
17880
|
+
/* @__PURE__ */ jsx61(
|
|
17900
17881
|
"span",
|
|
17901
17882
|
{
|
|
17902
17883
|
className: "dataviews-filters__search-widget-listitem-value",
|
|
@@ -17924,7 +17905,7 @@ function ComboboxList2({ view, filter, onChangeView }) {
|
|
|
17924
17905
|
(item2) => normalizeSearchInput(item2.label).includes(normalizedSearch)
|
|
17925
17906
|
);
|
|
17926
17907
|
}, [filter.elements, deferredSearchValue]);
|
|
17927
|
-
return /* @__PURE__ */
|
|
17908
|
+
return /* @__PURE__ */ jsxs19(
|
|
17928
17909
|
Ariakit21.ComboboxProvider,
|
|
17929
17910
|
{
|
|
17930
17911
|
selectedValue: currentValue,
|
|
@@ -17956,15 +17937,15 @@ function ComboboxList2({ view, filter, onChangeView }) {
|
|
|
17956
17937
|
},
|
|
17957
17938
|
setValue: setSearchValue,
|
|
17958
17939
|
children: [
|
|
17959
|
-
/* @__PURE__ */
|
|
17960
|
-
/* @__PURE__ */
|
|
17940
|
+
/* @__PURE__ */ jsxs19("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
|
|
17941
|
+
/* @__PURE__ */ jsx61(
|
|
17961
17942
|
Ariakit21.ComboboxLabel,
|
|
17962
17943
|
{
|
|
17963
|
-
render: /* @__PURE__ */
|
|
17944
|
+
render: /* @__PURE__ */ jsx61(component_default2, { children: __36("Search items") }),
|
|
17964
17945
|
children: __36("Search items")
|
|
17965
17946
|
}
|
|
17966
17947
|
),
|
|
17967
|
-
/* @__PURE__ */
|
|
17948
|
+
/* @__PURE__ */ jsx61(
|
|
17968
17949
|
Ariakit21.Combobox,
|
|
17969
17950
|
{
|
|
17970
17951
|
autoSelect: "always",
|
|
@@ -17972,16 +17953,16 @@ function ComboboxList2({ view, filter, onChangeView }) {
|
|
|
17972
17953
|
className: "dataviews-filters__search-widget-filter-combobox__input"
|
|
17973
17954
|
}
|
|
17974
17955
|
),
|
|
17975
|
-
/* @__PURE__ */
|
|
17956
|
+
/* @__PURE__ */ jsx61("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ jsx61(icon_default2, { icon: search_default }) })
|
|
17976
17957
|
] }),
|
|
17977
|
-
/* @__PURE__ */
|
|
17958
|
+
/* @__PURE__ */ jsxs19(
|
|
17978
17959
|
Ariakit21.ComboboxList,
|
|
17979
17960
|
{
|
|
17980
17961
|
className: "dataviews-filters__search-widget-filter-combobox-list",
|
|
17981
17962
|
alwaysVisible: true,
|
|
17982
17963
|
children: [
|
|
17983
17964
|
matches.map((element) => {
|
|
17984
|
-
return /* @__PURE__ */
|
|
17965
|
+
return /* @__PURE__ */ jsxs19(
|
|
17985
17966
|
Ariakit21.ComboboxItem,
|
|
17986
17967
|
{
|
|
17987
17968
|
resetValueOnSelect: false,
|
|
@@ -17991,13 +17972,13 @@ function ComboboxList2({ view, filter, onChangeView }) {
|
|
|
17991
17972
|
setValueOnClick: false,
|
|
17992
17973
|
focusOnHover: true,
|
|
17993
17974
|
children: [
|
|
17994
|
-
filter.singleSelection && /* @__PURE__ */
|
|
17975
|
+
filter.singleSelection && /* @__PURE__ */ jsx61(
|
|
17995
17976
|
SingleSelectionOption,
|
|
17996
17977
|
{
|
|
17997
17978
|
selected: currentValue === element.value
|
|
17998
17979
|
}
|
|
17999
17980
|
),
|
|
18000
|
-
!filter.singleSelection && /* @__PURE__ */
|
|
17981
|
+
!filter.singleSelection && /* @__PURE__ */ jsx61(
|
|
18001
17982
|
MultiSelectionOption,
|
|
18002
17983
|
{
|
|
18003
17984
|
selected: currentValue.includes(
|
|
@@ -18005,20 +17986,20 @@ function ComboboxList2({ view, filter, onChangeView }) {
|
|
|
18005
17986
|
)
|
|
18006
17987
|
}
|
|
18007
17988
|
),
|
|
18008
|
-
/* @__PURE__ */
|
|
17989
|
+
/* @__PURE__ */ jsxs19(
|
|
18009
17990
|
"span",
|
|
18010
17991
|
{
|
|
18011
17992
|
className: "dataviews-filters__search-widget-listitem-value",
|
|
18012
17993
|
title: element.label,
|
|
18013
17994
|
children: [
|
|
18014
|
-
/* @__PURE__ */
|
|
17995
|
+
/* @__PURE__ */ jsx61(
|
|
18015
17996
|
Ariakit21.ComboboxItemValue,
|
|
18016
17997
|
{
|
|
18017
17998
|
className: "dataviews-filters__search-widget-filter-combobox-item-value",
|
|
18018
17999
|
value: element.label
|
|
18019
18000
|
}
|
|
18020
18001
|
),
|
|
18021
|
-
!!element.description && /* @__PURE__ */
|
|
18002
|
+
!!element.description && /* @__PURE__ */ jsx61("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
|
|
18022
18003
|
]
|
|
18023
18004
|
}
|
|
18024
18005
|
)
|
|
@@ -18027,7 +18008,7 @@ function ComboboxList2({ view, filter, onChangeView }) {
|
|
|
18027
18008
|
element.value
|
|
18028
18009
|
);
|
|
18029
18010
|
}),
|
|
18030
|
-
!matches.length && /* @__PURE__ */
|
|
18011
|
+
!matches.length && /* @__PURE__ */ jsx61("p", { children: __36("No results found") })
|
|
18031
18012
|
]
|
|
18032
18013
|
}
|
|
18033
18014
|
)
|
|
@@ -18041,18 +18022,18 @@ function SearchWidget(props) {
|
|
|
18041
18022
|
getElements: props.filter.getElements
|
|
18042
18023
|
});
|
|
18043
18024
|
if (isLoading) {
|
|
18044
|
-
return /* @__PURE__ */
|
|
18025
|
+
return /* @__PURE__ */ jsx61("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ jsx61(spinner_default, {}) });
|
|
18045
18026
|
}
|
|
18046
18027
|
if (elements.length === 0) {
|
|
18047
|
-
return /* @__PURE__ */
|
|
18028
|
+
return /* @__PURE__ */ jsx61("div", { className: "dataviews-filters__search-widget-no-elements", children: __36("No elements found") });
|
|
18048
18029
|
}
|
|
18049
18030
|
const Widget = elements.length > 10 ? ComboboxList2 : ListBox;
|
|
18050
|
-
return /* @__PURE__ */
|
|
18031
|
+
return /* @__PURE__ */ jsx61(Widget, { ...props, filter: { ...props.filter, elements } });
|
|
18051
18032
|
}
|
|
18052
18033
|
|
|
18053
18034
|
// src/components/dataviews-filters/input-widget.tsx
|
|
18054
18035
|
import fastDeepEqual2 from "fast-deep-equal/es6/index.js";
|
|
18055
|
-
import { jsx as
|
|
18036
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
18056
18037
|
function InputWidget({
|
|
18057
18038
|
filter,
|
|
18058
18039
|
view,
|
|
@@ -18116,13 +18097,13 @@ function InputWidget({
|
|
|
18116
18097
|
if (!field || !field.Edit || !currentFilter) {
|
|
18117
18098
|
return null;
|
|
18118
18099
|
}
|
|
18119
|
-
return /* @__PURE__ */
|
|
18100
|
+
return /* @__PURE__ */ jsx62(
|
|
18120
18101
|
component_default3,
|
|
18121
18102
|
{
|
|
18122
18103
|
className: "dataviews-filters__user-input-widget",
|
|
18123
18104
|
gap: 2.5,
|
|
18124
18105
|
direction: "column",
|
|
18125
|
-
children: /* @__PURE__ */
|
|
18106
|
+
children: /* @__PURE__ */ jsx62(
|
|
18126
18107
|
field.Edit,
|
|
18127
18108
|
{
|
|
18128
18109
|
hideLabelFromVision: true,
|
|
@@ -18140,10 +18121,10 @@ function InputWidget({
|
|
|
18140
18121
|
import { subDays, subWeeks, subMonths, subYears } from "date-fns";
|
|
18141
18122
|
import { __ as __37, sprintf as sprintf15 } from "@wordpress/i18n";
|
|
18142
18123
|
import { getDate } from "@wordpress/date";
|
|
18143
|
-
import { jsx as
|
|
18124
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
18144
18125
|
var filterTextWrappers = {
|
|
18145
|
-
Name: /* @__PURE__ */
|
|
18146
|
-
Value: /* @__PURE__ */
|
|
18126
|
+
Name: /* @__PURE__ */ jsx63("span", { className: "dataviews-filters__summary-filter-text-name" }),
|
|
18127
|
+
Value: /* @__PURE__ */ jsx63("span", { className: "dataviews-filters__summary-filter-text-value" })
|
|
18147
18128
|
};
|
|
18148
18129
|
function getRelativeDate(value, unit) {
|
|
18149
18130
|
switch (unit) {
|
|
@@ -18679,7 +18660,7 @@ var isSingleSelectionOperator = (name) => OPERATORS.filter((op) => op.selection
|
|
|
18679
18660
|
var isRegisteredOperator = (name) => OPERATORS.some((op) => op.name === name);
|
|
18680
18661
|
|
|
18681
18662
|
// src/components/dataviews-filters/filter.tsx
|
|
18682
|
-
import { jsx as
|
|
18663
|
+
import { jsx as jsx64, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
18683
18664
|
var ENTER = "Enter";
|
|
18684
18665
|
var SPACE = " ";
|
|
18685
18666
|
var FilterText = ({
|
|
@@ -18713,7 +18694,7 @@ function OperatorSelector({
|
|
|
18713
18694
|
(_filter) => _filter.field === filter.field
|
|
18714
18695
|
);
|
|
18715
18696
|
const value = currentFilter?.operator || filter.operators[0];
|
|
18716
|
-
return operatorOptions.length > 1 && /* @__PURE__ */
|
|
18697
|
+
return operatorOptions.length > 1 && /* @__PURE__ */ jsxs20(
|
|
18717
18698
|
Stack,
|
|
18718
18699
|
{
|
|
18719
18700
|
direction: "row",
|
|
@@ -18722,8 +18703,8 @@ function OperatorSelector({
|
|
|
18722
18703
|
className: "dataviews-filters__summary-operators-container",
|
|
18723
18704
|
align: "center",
|
|
18724
18705
|
children: [
|
|
18725
|
-
/* @__PURE__ */
|
|
18726
|
-
/* @__PURE__ */
|
|
18706
|
+
/* @__PURE__ */ jsx64(component_default4, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
|
|
18707
|
+
/* @__PURE__ */ jsx64(
|
|
18727
18708
|
select_control_default,
|
|
18728
18709
|
{
|
|
18729
18710
|
className: "dataviews-filters__summary-operators-filter-select",
|
|
@@ -18849,7 +18830,7 @@ function Filter({
|
|
|
18849
18830
|
const isLocked = filterInView?.isLocked;
|
|
18850
18831
|
const hasValues = !isLocked && filterInView?.value !== void 0;
|
|
18851
18832
|
const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
|
|
18852
|
-
return /* @__PURE__ */
|
|
18833
|
+
return /* @__PURE__ */ jsx64(
|
|
18853
18834
|
dropdown_default,
|
|
18854
18835
|
{
|
|
18855
18836
|
defaultOpen: openedFilter === filter.field,
|
|
@@ -18858,8 +18839,8 @@ function Filter({
|
|
|
18858
18839
|
onClose: () => {
|
|
18859
18840
|
toggleRef.current?.focus();
|
|
18860
18841
|
},
|
|
18861
|
-
renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */
|
|
18862
|
-
/* @__PURE__ */
|
|
18842
|
+
renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ jsxs20("div", { className: "dataviews-filters__summary-chip-container", children: [
|
|
18843
|
+
/* @__PURE__ */ jsx64(
|
|
18863
18844
|
tooltip_default,
|
|
18864
18845
|
{
|
|
18865
18846
|
text: sprintf16(
|
|
@@ -18868,10 +18849,10 @@ function Filter({
|
|
|
18868
18849
|
filter.name.toLowerCase()
|
|
18869
18850
|
),
|
|
18870
18851
|
placement: "top",
|
|
18871
|
-
children: /* @__PURE__ */
|
|
18852
|
+
children: /* @__PURE__ */ jsx64(
|
|
18872
18853
|
"div",
|
|
18873
18854
|
{
|
|
18874
|
-
className:
|
|
18855
|
+
className: clsx42(
|
|
18875
18856
|
"dataviews-filters__summary-chip",
|
|
18876
18857
|
{
|
|
18877
18858
|
"has-reset": canResetOrRemove,
|
|
@@ -18896,7 +18877,7 @@ function Filter({
|
|
|
18896
18877
|
"aria-pressed": isOpen,
|
|
18897
18878
|
"aria-expanded": isOpen,
|
|
18898
18879
|
ref: toggleRef,
|
|
18899
|
-
children: /* @__PURE__ */
|
|
18880
|
+
children: /* @__PURE__ */ jsx64(
|
|
18900
18881
|
FilterText,
|
|
18901
18882
|
{
|
|
18902
18883
|
activeElements,
|
|
@@ -18908,15 +18889,15 @@ function Filter({
|
|
|
18908
18889
|
)
|
|
18909
18890
|
}
|
|
18910
18891
|
),
|
|
18911
|
-
canResetOrRemove && /* @__PURE__ */
|
|
18892
|
+
canResetOrRemove && /* @__PURE__ */ jsx64(
|
|
18912
18893
|
tooltip_default,
|
|
18913
18894
|
{
|
|
18914
18895
|
text: isPrimary ? __38("Reset") : __38("Remove"),
|
|
18915
18896
|
placement: "top",
|
|
18916
|
-
children: /* @__PURE__ */
|
|
18897
|
+
children: /* @__PURE__ */ jsx64(
|
|
18917
18898
|
"button",
|
|
18918
18899
|
{
|
|
18919
|
-
className:
|
|
18900
|
+
className: clsx42(
|
|
18920
18901
|
"dataviews-filters__summary-chip-remove",
|
|
18921
18902
|
{ "has-values": hasValues }
|
|
18922
18903
|
),
|
|
@@ -18934,16 +18915,16 @@ function Filter({
|
|
|
18934
18915
|
toggleRef.current?.focus();
|
|
18935
18916
|
}
|
|
18936
18917
|
},
|
|
18937
|
-
children: /* @__PURE__ */
|
|
18918
|
+
children: /* @__PURE__ */ jsx64(icon_default2, { icon: close_small_default })
|
|
18938
18919
|
}
|
|
18939
18920
|
)
|
|
18940
18921
|
}
|
|
18941
18922
|
)
|
|
18942
18923
|
] }),
|
|
18943
18924
|
renderContent: () => {
|
|
18944
|
-
return /* @__PURE__ */
|
|
18945
|
-
/* @__PURE__ */
|
|
18946
|
-
commonProps.filter.hasElements ? /* @__PURE__ */
|
|
18925
|
+
return /* @__PURE__ */ jsxs20(Stack, { direction: "column", justify: "flex-start", children: [
|
|
18926
|
+
/* @__PURE__ */ jsx64(OperatorSelector, { ...commonProps }),
|
|
18927
|
+
commonProps.filter.hasElements ? /* @__PURE__ */ jsx64(
|
|
18947
18928
|
SearchWidget,
|
|
18948
18929
|
{
|
|
18949
18930
|
...commonProps,
|
|
@@ -18952,7 +18933,7 @@ function Filter({
|
|
|
18952
18933
|
elements
|
|
18953
18934
|
}
|
|
18954
18935
|
}
|
|
18955
|
-
) : /* @__PURE__ */
|
|
18936
|
+
) : /* @__PURE__ */ jsx64(InputWidget, { ...commonProps, fields })
|
|
18956
18937
|
] });
|
|
18957
18938
|
}
|
|
18958
18939
|
}
|
|
@@ -18961,7 +18942,7 @@ function Filter({
|
|
|
18961
18942
|
|
|
18962
18943
|
// src/components/dataviews-filters/add-filter.tsx
|
|
18963
18944
|
import { __ as __39 } from "@wordpress/i18n";
|
|
18964
|
-
import { jsx as
|
|
18945
|
+
import { jsx as jsx65, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
18965
18946
|
var { Menu: Menu7 } = unlock3(privateApis);
|
|
18966
18947
|
function AddFilterMenu({
|
|
18967
18948
|
filters,
|
|
@@ -18971,10 +18952,10 @@ function AddFilterMenu({
|
|
|
18971
18952
|
triggerProps
|
|
18972
18953
|
}) {
|
|
18973
18954
|
const inactiveFilters = filters.filter((filter) => !filter.isVisible);
|
|
18974
|
-
return /* @__PURE__ */
|
|
18975
|
-
/* @__PURE__ */
|
|
18976
|
-
/* @__PURE__ */
|
|
18977
|
-
return /* @__PURE__ */
|
|
18955
|
+
return /* @__PURE__ */ jsxs21(Menu7, { children: [
|
|
18956
|
+
/* @__PURE__ */ jsx65(Menu7.TriggerButton, { ...triggerProps }),
|
|
18957
|
+
/* @__PURE__ */ jsx65(Menu7.Popover, { children: inactiveFilters.map((filter) => {
|
|
18958
|
+
return /* @__PURE__ */ jsx65(
|
|
18978
18959
|
Menu7.Item,
|
|
18979
18960
|
{
|
|
18980
18961
|
onClick: () => {
|
|
@@ -18992,7 +18973,7 @@ function AddFilterMenu({
|
|
|
18992
18973
|
]
|
|
18993
18974
|
});
|
|
18994
18975
|
},
|
|
18995
|
-
children: /* @__PURE__ */
|
|
18976
|
+
children: /* @__PURE__ */ jsx65(Menu7.ItemLabel, { children: filter.name })
|
|
18996
18977
|
},
|
|
18997
18978
|
filter.field
|
|
18998
18979
|
);
|
|
@@ -19004,11 +18985,11 @@ function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
|
|
|
19004
18985
|
return null;
|
|
19005
18986
|
}
|
|
19006
18987
|
const inactiveFilters = filters.filter((filter) => !filter.isVisible);
|
|
19007
|
-
return /* @__PURE__ */
|
|
18988
|
+
return /* @__PURE__ */ jsx65(
|
|
19008
18989
|
AddFilterMenu,
|
|
19009
18990
|
{
|
|
19010
18991
|
triggerProps: {
|
|
19011
|
-
render: /* @__PURE__ */
|
|
18992
|
+
render: /* @__PURE__ */ jsx65(
|
|
19012
18993
|
button_default,
|
|
19013
18994
|
{
|
|
19014
18995
|
accessibleWhenDisabled: true,
|
|
@@ -19029,7 +19010,7 @@ var add_filter_default = forwardRef(AddFilter);
|
|
|
19029
19010
|
|
|
19030
19011
|
// src/components/dataviews-filters/reset-filters.tsx
|
|
19031
19012
|
import { __ as __40 } from "@wordpress/i18n";
|
|
19032
|
-
import { jsx as
|
|
19013
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
19033
19014
|
function ResetFilter({
|
|
19034
19015
|
filters,
|
|
19035
19016
|
view,
|
|
@@ -19041,7 +19022,7 @@ function ResetFilter({
|
|
|
19041
19022
|
const isDisabled = !view.search && !view.filters?.some(
|
|
19042
19023
|
(_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
|
|
19043
19024
|
);
|
|
19044
|
-
return /* @__PURE__ */
|
|
19025
|
+
return /* @__PURE__ */ jsx66(
|
|
19045
19026
|
button_default,
|
|
19046
19027
|
{
|
|
19047
19028
|
disabled: isDisabled,
|
|
@@ -19113,12 +19094,12 @@ function useFilters(fields, view) {
|
|
|
19113
19094
|
var use_filters_default = useFilters;
|
|
19114
19095
|
|
|
19115
19096
|
// src/components/dataviews-filters/filters.tsx
|
|
19116
|
-
import { jsx as
|
|
19097
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
19117
19098
|
function Filters({ className: className2 }) {
|
|
19118
19099
|
const { fields, view, onChangeView, openedFilter, setOpenedFilter } = useContext(dataviews_context_default);
|
|
19119
19100
|
const addFilterRef = useRef(null);
|
|
19120
19101
|
const filters = use_filters_default(fields, view);
|
|
19121
|
-
const addFilter = /* @__PURE__ */
|
|
19102
|
+
const addFilter = /* @__PURE__ */ jsx67(
|
|
19122
19103
|
add_filter_default,
|
|
19123
19104
|
{
|
|
19124
19105
|
filters,
|
|
@@ -19135,7 +19116,7 @@ function Filters({ className: className2 }) {
|
|
|
19135
19116
|
}
|
|
19136
19117
|
const filterComponents = [
|
|
19137
19118
|
...visibleFilters.map((filter) => {
|
|
19138
|
-
return /* @__PURE__ */
|
|
19119
|
+
return /* @__PURE__ */ jsx67(
|
|
19139
19120
|
Filter,
|
|
19140
19121
|
{
|
|
19141
19122
|
filter,
|
|
@@ -19151,7 +19132,7 @@ function Filters({ className: className2 }) {
|
|
|
19151
19132
|
addFilter
|
|
19152
19133
|
];
|
|
19153
19134
|
filterComponents.push(
|
|
19154
|
-
/* @__PURE__ */
|
|
19135
|
+
/* @__PURE__ */ jsx67(
|
|
19155
19136
|
ResetFilter,
|
|
19156
19137
|
{
|
|
19157
19138
|
filters,
|
|
@@ -19161,7 +19142,7 @@ function Filters({ className: className2 }) {
|
|
|
19161
19142
|
"reset-filters"
|
|
19162
19143
|
)
|
|
19163
19144
|
);
|
|
19164
|
-
return /* @__PURE__ */
|
|
19145
|
+
return /* @__PURE__ */ jsx67(
|
|
19165
19146
|
Stack,
|
|
19166
19147
|
{
|
|
19167
19148
|
direction: "row",
|
|
@@ -19178,7 +19159,7 @@ var filters_default = memo(Filters);
|
|
|
19178
19159
|
|
|
19179
19160
|
// src/components/dataviews-filters/toggle.tsx
|
|
19180
19161
|
import { __ as __41, _x as _x3 } from "@wordpress/i18n";
|
|
19181
|
-
import { Fragment as
|
|
19162
|
+
import { Fragment as Fragment12, jsx as jsx68, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
19182
19163
|
function FiltersToggle() {
|
|
19183
19164
|
const {
|
|
19184
19165
|
filters,
|
|
@@ -19219,7 +19200,7 @@ function FiltersToggle() {
|
|
|
19219
19200
|
const hasPrimaryOrLockedFilters = filters.some(
|
|
19220
19201
|
(filter) => filter.isPrimary || filter.isLocked
|
|
19221
19202
|
);
|
|
19222
|
-
const buttonComponent = /* @__PURE__ */
|
|
19203
|
+
const buttonComponent = /* @__PURE__ */ jsx68(
|
|
19223
19204
|
button_default,
|
|
19224
19205
|
{
|
|
19225
19206
|
ref: buttonRef,
|
|
@@ -19231,7 +19212,7 @@ function FiltersToggle() {
|
|
|
19231
19212
|
...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
|
|
19232
19213
|
}
|
|
19233
19214
|
);
|
|
19234
|
-
return /* @__PURE__ */
|
|
19215
|
+
return /* @__PURE__ */ jsx68("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ jsx68(
|
|
19235
19216
|
AddFilterMenu,
|
|
19236
19217
|
{
|
|
19237
19218
|
filters,
|
|
@@ -19240,7 +19221,7 @@ function FiltersToggle() {
|
|
|
19240
19221
|
setOpenedFilter,
|
|
19241
19222
|
triggerProps: { render: buttonComponent }
|
|
19242
19223
|
}
|
|
19243
|
-
) : /* @__PURE__ */
|
|
19224
|
+
) : /* @__PURE__ */ jsx68(
|
|
19244
19225
|
FilterVisibilityToggle,
|
|
19245
19226
|
{
|
|
19246
19227
|
buttonRef,
|
|
@@ -19260,27 +19241,27 @@ function FilterVisibilityToggle({
|
|
|
19260
19241
|
},
|
|
19261
19242
|
[buttonRef]
|
|
19262
19243
|
);
|
|
19263
|
-
return /* @__PURE__ */
|
|
19244
|
+
return /* @__PURE__ */ jsxs22(Fragment12, { children: [
|
|
19264
19245
|
children,
|
|
19265
|
-
!!filtersCount && /* @__PURE__ */
|
|
19246
|
+
!!filtersCount && /* @__PURE__ */ jsx68("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
|
|
19266
19247
|
] });
|
|
19267
19248
|
}
|
|
19268
19249
|
var toggle_default = FiltersToggle;
|
|
19269
19250
|
|
|
19270
19251
|
// src/components/dataviews-filters/filters-toggled.tsx
|
|
19271
|
-
import { jsx as
|
|
19252
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
19272
19253
|
function FiltersToggled(props) {
|
|
19273
19254
|
const { isShowingFilter } = useContext(dataviews_context_default);
|
|
19274
19255
|
if (!isShowingFilter) {
|
|
19275
19256
|
return null;
|
|
19276
19257
|
}
|
|
19277
|
-
return /* @__PURE__ */
|
|
19258
|
+
return /* @__PURE__ */ jsx69(filters_default, { ...props });
|
|
19278
19259
|
}
|
|
19279
19260
|
var filters_toggled_default = FiltersToggled;
|
|
19280
19261
|
|
|
19281
19262
|
// src/components/dataviews-layout/index.tsx
|
|
19282
19263
|
import { __ as __42 } from "@wordpress/i18n";
|
|
19283
|
-
import { jsx as
|
|
19264
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
19284
19265
|
function DataViewsLayout({ className: className2 }) {
|
|
19285
19266
|
const {
|
|
19286
19267
|
actions = [],
|
|
@@ -19299,15 +19280,22 @@ function DataViewsLayout({ className: className2 }) {
|
|
|
19299
19280
|
isItemClickable: isItemClickable2,
|
|
19300
19281
|
renderItemLink,
|
|
19301
19282
|
defaultLayouts,
|
|
19302
|
-
|
|
19283
|
+
containerRef,
|
|
19284
|
+
empty = /* @__PURE__ */ jsx70("p", { children: __42("No results") })
|
|
19303
19285
|
} = useContext(dataviews_context_default);
|
|
19286
|
+
const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, {
|
|
19287
|
+
delay: 200
|
|
19288
|
+
});
|
|
19304
19289
|
if (!hasInitiallyLoaded) {
|
|
19305
|
-
|
|
19290
|
+
if (!isDelayedInitialLoading) {
|
|
19291
|
+
return null;
|
|
19292
|
+
}
|
|
19293
|
+
return /* @__PURE__ */ jsx70("div", { className: "dataviews-loading", children: /* @__PURE__ */ jsx70("p", { children: /* @__PURE__ */ jsx70(spinner_default, {}) }) });
|
|
19306
19294
|
}
|
|
19307
19295
|
const ViewComponent = VIEW_LAYOUTS.find(
|
|
19308
19296
|
(v) => v.type === view.type && defaultLayouts[v.type]
|
|
19309
19297
|
)?.component;
|
|
19310
|
-
return /* @__PURE__ */
|
|
19298
|
+
return /* @__PURE__ */ jsx70("div", { className: "dataviews-layout__container", ref: containerRef, children: /* @__PURE__ */ jsx70(
|
|
19311
19299
|
ViewComponent,
|
|
19312
19300
|
{
|
|
19313
19301
|
className: className2,
|
|
@@ -19327,12 +19315,12 @@ function DataViewsLayout({ className: className2 }) {
|
|
|
19327
19315
|
view,
|
|
19328
19316
|
empty
|
|
19329
19317
|
}
|
|
19330
|
-
);
|
|
19318
|
+
) });
|
|
19331
19319
|
}
|
|
19332
19320
|
|
|
19333
19321
|
// src/components/dataviews-footer/index.tsx
|
|
19334
|
-
import
|
|
19335
|
-
import { jsx as
|
|
19322
|
+
import clsx43 from "clsx";
|
|
19323
|
+
import { jsx as jsx71, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
19336
19324
|
var EMPTY_ARRAY5 = [];
|
|
19337
19325
|
function DataViewsFooter() {
|
|
19338
19326
|
const {
|
|
@@ -19350,24 +19338,24 @@ function DataViewsFooter() {
|
|
|
19350
19338
|
if (!isRefreshing && (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions)) {
|
|
19351
19339
|
return null;
|
|
19352
19340
|
}
|
|
19353
|
-
return (!!totalItems || isRefreshing) && /* @__PURE__ */
|
|
19341
|
+
return (!!totalItems || isRefreshing) && /* @__PURE__ */ jsx71(
|
|
19354
19342
|
"div",
|
|
19355
19343
|
{
|
|
19356
19344
|
className: "dataviews-footer",
|
|
19357
19345
|
inert: isRefreshing ? "true" : void 0,
|
|
19358
|
-
children: /* @__PURE__ */
|
|
19346
|
+
children: /* @__PURE__ */ jsxs23(
|
|
19359
19347
|
Stack,
|
|
19360
19348
|
{
|
|
19361
19349
|
direction: "row",
|
|
19362
19350
|
justify: "end",
|
|
19363
19351
|
align: "center",
|
|
19364
|
-
className:
|
|
19352
|
+
className: clsx43("dataviews-footer__content", {
|
|
19365
19353
|
"is-refreshing": isDelayedRefreshing
|
|
19366
19354
|
}),
|
|
19367
19355
|
gap: "sm",
|
|
19368
19356
|
children: [
|
|
19369
|
-
hasBulkActions && /* @__PURE__ */
|
|
19370
|
-
/* @__PURE__ */
|
|
19357
|
+
hasBulkActions && /* @__PURE__ */ jsx71(BulkActionsFooter, {}),
|
|
19358
|
+
/* @__PURE__ */ jsx71(dataviews_pagination_default, {})
|
|
19371
19359
|
]
|
|
19372
19360
|
}
|
|
19373
19361
|
)
|
|
@@ -19377,7 +19365,7 @@ function DataViewsFooter() {
|
|
|
19377
19365
|
|
|
19378
19366
|
// src/components/dataviews-search/index.tsx
|
|
19379
19367
|
import { __ as __43 } from "@wordpress/i18n";
|
|
19380
|
-
import { jsx as
|
|
19368
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
19381
19369
|
var DataViewsSearch = memo(function Search({ label }) {
|
|
19382
19370
|
const { view, onChangeView } = useContext(dataviews_context_default);
|
|
19383
19371
|
const [search, setSearch, debouncedSearch] = useDebouncedInput(
|
|
@@ -19404,7 +19392,7 @@ var DataViewsSearch = memo(function Search({ label }) {
|
|
|
19404
19392
|
}
|
|
19405
19393
|
}, [debouncedSearch]);
|
|
19406
19394
|
const searchLabel = label || __43("Search");
|
|
19407
|
-
return /* @__PURE__ */
|
|
19395
|
+
return /* @__PURE__ */ jsx72(
|
|
19408
19396
|
search_control_default,
|
|
19409
19397
|
{
|
|
19410
19398
|
className: "dataviews-search",
|
|
@@ -19423,7 +19411,7 @@ import { __ as __45, _x as _x4 } from "@wordpress/i18n";
|
|
|
19423
19411
|
|
|
19424
19412
|
// src/components/dataviews-view-config/infinite-scroll-toggle.tsx
|
|
19425
19413
|
import { __ as __44 } from "@wordpress/i18n";
|
|
19426
|
-
import { jsx as
|
|
19414
|
+
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
19427
19415
|
function InfiniteScrollToggle() {
|
|
19428
19416
|
const context = useContext(dataviews_context_default);
|
|
19429
19417
|
const { view, onChangeView } = context;
|
|
@@ -19431,7 +19419,7 @@ function InfiniteScrollToggle() {
|
|
|
19431
19419
|
if (!context.hasInfiniteScrollHandler) {
|
|
19432
19420
|
return null;
|
|
19433
19421
|
}
|
|
19434
|
-
return /* @__PURE__ */
|
|
19422
|
+
return /* @__PURE__ */ jsx73(
|
|
19435
19423
|
toggle_control_default,
|
|
19436
19424
|
{
|
|
19437
19425
|
label: __44("Enable infinite scroll"),
|
|
@@ -19450,7 +19438,7 @@ function InfiniteScrollToggle() {
|
|
|
19450
19438
|
}
|
|
19451
19439
|
|
|
19452
19440
|
// src/components/dataviews-view-config/index.tsx
|
|
19453
|
-
import { Fragment as
|
|
19441
|
+
import { Fragment as Fragment13, jsx as jsx74, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
19454
19442
|
var { Menu: Menu8 } = unlock3(privateApis);
|
|
19455
19443
|
var DATAVIEWS_CONFIG_POPOVER_PROPS = {
|
|
19456
19444
|
className: "dataviews-config__popover",
|
|
@@ -19464,11 +19452,11 @@ function ViewTypeMenu() {
|
|
|
19464
19452
|
return null;
|
|
19465
19453
|
}
|
|
19466
19454
|
const activeView = VIEW_LAYOUTS.find((v) => view.type === v.type);
|
|
19467
|
-
return /* @__PURE__ */
|
|
19468
|
-
/* @__PURE__ */
|
|
19455
|
+
return /* @__PURE__ */ jsxs24(Menu8, { children: [
|
|
19456
|
+
/* @__PURE__ */ jsx74(
|
|
19469
19457
|
Menu8.TriggerButton,
|
|
19470
19458
|
{
|
|
19471
|
-
render: /* @__PURE__ */
|
|
19459
|
+
render: /* @__PURE__ */ jsx74(
|
|
19472
19460
|
button_default,
|
|
19473
19461
|
{
|
|
19474
19462
|
size: "compact",
|
|
@@ -19478,14 +19466,14 @@ function ViewTypeMenu() {
|
|
|
19478
19466
|
)
|
|
19479
19467
|
}
|
|
19480
19468
|
),
|
|
19481
|
-
/* @__PURE__ */
|
|
19469
|
+
/* @__PURE__ */ jsx74(Menu8.Popover, { children: availableLayouts.map((layout) => {
|
|
19482
19470
|
const config = VIEW_LAYOUTS.find(
|
|
19483
19471
|
(v) => v.type === layout
|
|
19484
19472
|
);
|
|
19485
19473
|
if (!config) {
|
|
19486
19474
|
return null;
|
|
19487
19475
|
}
|
|
19488
|
-
return /* @__PURE__ */
|
|
19476
|
+
return /* @__PURE__ */ jsx74(
|
|
19489
19477
|
Menu8.RadioItem,
|
|
19490
19478
|
{
|
|
19491
19479
|
value: layout,
|
|
@@ -19512,7 +19500,7 @@ function ViewTypeMenu() {
|
|
|
19512
19500
|
}
|
|
19513
19501
|
warning("Invalid dataview");
|
|
19514
19502
|
},
|
|
19515
|
-
children: /* @__PURE__ */
|
|
19503
|
+
children: /* @__PURE__ */ jsx74(Menu8.ItemLabel, { children: config.label })
|
|
19516
19504
|
},
|
|
19517
19505
|
layout
|
|
19518
19506
|
);
|
|
@@ -19532,7 +19520,7 @@ function SortFieldControl() {
|
|
|
19532
19520
|
};
|
|
19533
19521
|
});
|
|
19534
19522
|
}, [fields]);
|
|
19535
|
-
return /* @__PURE__ */
|
|
19523
|
+
return /* @__PURE__ */ jsx74(
|
|
19536
19524
|
select_control_default,
|
|
19537
19525
|
{
|
|
19538
19526
|
__next40pxDefaultSize: true,
|
|
@@ -19564,7 +19552,7 @@ function SortDirectionControl() {
|
|
|
19564
19552
|
if (!value && view.sort?.field) {
|
|
19565
19553
|
value = "desc";
|
|
19566
19554
|
}
|
|
19567
|
-
return /* @__PURE__ */
|
|
19555
|
+
return /* @__PURE__ */ jsx74(
|
|
19568
19556
|
component_default10,
|
|
19569
19557
|
{
|
|
19570
19558
|
className: "dataviews-view-config__sort-direction",
|
|
@@ -19590,7 +19578,7 @@ function SortDirectionControl() {
|
|
|
19590
19578
|
warning("Invalid direction");
|
|
19591
19579
|
},
|
|
19592
19580
|
children: SORTING_DIRECTIONS.map((direction) => {
|
|
19593
|
-
return /* @__PURE__ */
|
|
19581
|
+
return /* @__PURE__ */ jsx74(
|
|
19594
19582
|
component_default13,
|
|
19595
19583
|
{
|
|
19596
19584
|
value: direction,
|
|
@@ -19609,7 +19597,7 @@ function ItemsPerPageControl() {
|
|
|
19609
19597
|
if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) {
|
|
19610
19598
|
return null;
|
|
19611
19599
|
}
|
|
19612
|
-
return /* @__PURE__ */
|
|
19600
|
+
return /* @__PURE__ */ jsx74(
|
|
19613
19601
|
component_default10,
|
|
19614
19602
|
{
|
|
19615
19603
|
__next40pxDefaultSize: true,
|
|
@@ -19626,7 +19614,7 @@ function ItemsPerPageControl() {
|
|
|
19626
19614
|
});
|
|
19627
19615
|
},
|
|
19628
19616
|
children: config.perPageSizes.map((value) => {
|
|
19629
|
-
return /* @__PURE__ */
|
|
19617
|
+
return /* @__PURE__ */ jsx74(
|
|
19630
19618
|
component_default12,
|
|
19631
19619
|
{
|
|
19632
19620
|
value,
|
|
@@ -19644,7 +19632,7 @@ function ResetViewButton() {
|
|
|
19644
19632
|
return null;
|
|
19645
19633
|
}
|
|
19646
19634
|
const isDisabled = onReset === false;
|
|
19647
|
-
return /* @__PURE__ */
|
|
19635
|
+
return /* @__PURE__ */ jsx74(
|
|
19648
19636
|
button_default,
|
|
19649
19637
|
{
|
|
19650
19638
|
variant: "tertiary",
|
|
@@ -19671,7 +19659,7 @@ function DataviewsViewConfigDropdown() {
|
|
|
19671
19659
|
(layout) => layout.type === view.type
|
|
19672
19660
|
);
|
|
19673
19661
|
const isModified = typeof onReset === "function";
|
|
19674
|
-
return /* @__PURE__ */
|
|
19662
|
+
return /* @__PURE__ */ jsx74(
|
|
19675
19663
|
dropdown_default,
|
|
19676
19664
|
{
|
|
19677
19665
|
expandOnMobile: true,
|
|
@@ -19680,8 +19668,8 @@ function DataviewsViewConfigDropdown() {
|
|
|
19680
19668
|
id: popoverId
|
|
19681
19669
|
},
|
|
19682
19670
|
renderToggle: ({ onToggle, isOpen }) => {
|
|
19683
|
-
return /* @__PURE__ */
|
|
19684
|
-
/* @__PURE__ */
|
|
19671
|
+
return /* @__PURE__ */ jsxs24("div", { className: "dataviews-view-config__toggle-wrapper", children: [
|
|
19672
|
+
/* @__PURE__ */ jsx74(
|
|
19685
19673
|
button_default,
|
|
19686
19674
|
{
|
|
19687
19675
|
size: "compact",
|
|
@@ -19695,22 +19683,22 @@ function DataviewsViewConfigDropdown() {
|
|
|
19695
19683
|
"aria-controls": popoverId
|
|
19696
19684
|
}
|
|
19697
19685
|
),
|
|
19698
|
-
isModified && /* @__PURE__ */
|
|
19686
|
+
isModified && /* @__PURE__ */ jsx74("span", { className: "dataviews-view-config__modified-indicator" })
|
|
19699
19687
|
] });
|
|
19700
19688
|
},
|
|
19701
|
-
renderContent: () => /* @__PURE__ */
|
|
19689
|
+
renderContent: () => /* @__PURE__ */ jsx74(
|
|
19702
19690
|
dropdown_content_wrapper_default,
|
|
19703
19691
|
{
|
|
19704
19692
|
paddingSize: "medium",
|
|
19705
19693
|
className: "dataviews-config__popover-content-wrapper",
|
|
19706
|
-
children: /* @__PURE__ */
|
|
19694
|
+
children: /* @__PURE__ */ jsxs24(
|
|
19707
19695
|
Stack,
|
|
19708
19696
|
{
|
|
19709
19697
|
direction: "column",
|
|
19710
19698
|
className: "dataviews-view-config",
|
|
19711
19699
|
gap: "xl",
|
|
19712
19700
|
children: [
|
|
19713
|
-
/* @__PURE__ */
|
|
19701
|
+
/* @__PURE__ */ jsxs24(
|
|
19714
19702
|
Stack,
|
|
19715
19703
|
{
|
|
19716
19704
|
direction: "row",
|
|
@@ -19718,7 +19706,7 @@ function DataviewsViewConfigDropdown() {
|
|
|
19718
19706
|
align: "center",
|
|
19719
19707
|
className: "dataviews-view-config__header",
|
|
19720
19708
|
children: [
|
|
19721
|
-
/* @__PURE__ */
|
|
19709
|
+
/* @__PURE__ */ jsx74(
|
|
19722
19710
|
component_default16,
|
|
19723
19711
|
{
|
|
19724
19712
|
level: 2,
|
|
@@ -19726,27 +19714,27 @@ function DataviewsViewConfigDropdown() {
|
|
|
19726
19714
|
children: __45("Appearance")
|
|
19727
19715
|
}
|
|
19728
19716
|
),
|
|
19729
|
-
/* @__PURE__ */
|
|
19717
|
+
/* @__PURE__ */ jsx74(ResetViewButton, {})
|
|
19730
19718
|
]
|
|
19731
19719
|
}
|
|
19732
19720
|
),
|
|
19733
|
-
/* @__PURE__ */
|
|
19734
|
-
/* @__PURE__ */
|
|
19721
|
+
/* @__PURE__ */ jsxs24(Stack, { direction: "column", gap: "lg", children: [
|
|
19722
|
+
/* @__PURE__ */ jsxs24(
|
|
19735
19723
|
Stack,
|
|
19736
19724
|
{
|
|
19737
19725
|
direction: "row",
|
|
19738
19726
|
gap: "sm",
|
|
19739
19727
|
className: "dataviews-view-config__sort-controls",
|
|
19740
19728
|
children: [
|
|
19741
|
-
/* @__PURE__ */
|
|
19742
|
-
/* @__PURE__ */
|
|
19729
|
+
/* @__PURE__ */ jsx74(SortFieldControl, {}),
|
|
19730
|
+
/* @__PURE__ */ jsx74(SortDirectionControl, {})
|
|
19743
19731
|
]
|
|
19744
19732
|
}
|
|
19745
19733
|
),
|
|
19746
|
-
!!activeLayout?.viewConfigOptions && /* @__PURE__ */
|
|
19747
|
-
/* @__PURE__ */
|
|
19748
|
-
/* @__PURE__ */
|
|
19749
|
-
/* @__PURE__ */
|
|
19734
|
+
!!activeLayout?.viewConfigOptions && /* @__PURE__ */ jsx74(activeLayout.viewConfigOptions, {}),
|
|
19735
|
+
/* @__PURE__ */ jsx74(InfiniteScrollToggle, {}),
|
|
19736
|
+
/* @__PURE__ */ jsx74(ItemsPerPageControl, {}),
|
|
19737
|
+
/* @__PURE__ */ jsx74(PropertiesSection, {})
|
|
19750
19738
|
] })
|
|
19751
19739
|
]
|
|
19752
19740
|
}
|
|
@@ -19757,9 +19745,9 @@ function DataviewsViewConfigDropdown() {
|
|
|
19757
19745
|
);
|
|
19758
19746
|
}
|
|
19759
19747
|
function _DataViewsViewConfig() {
|
|
19760
|
-
return /* @__PURE__ */
|
|
19761
|
-
/* @__PURE__ */
|
|
19762
|
-
/* @__PURE__ */
|
|
19748
|
+
return /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
19749
|
+
/* @__PURE__ */ jsx74(ViewTypeMenu, {}),
|
|
19750
|
+
/* @__PURE__ */ jsx74(DataviewsViewConfigDropdown, {})
|
|
19763
19751
|
] });
|
|
19764
19752
|
}
|
|
19765
19753
|
var DataViewsViewConfig = memo(_DataViewsViewConfig);
|
|
@@ -19789,7 +19777,7 @@ function getCustomValidity(isValid, validity) {
|
|
|
19789
19777
|
}
|
|
19790
19778
|
|
|
19791
19779
|
// src/components/dataform-controls/checkbox.tsx
|
|
19792
|
-
import { jsx as
|
|
19780
|
+
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
19793
19781
|
var { ValidatedCheckboxControl: ValidatedCheckboxControl2 } = unlock3(privateApis);
|
|
19794
19782
|
function Checkbox({
|
|
19795
19783
|
field,
|
|
@@ -19805,7 +19793,7 @@ function Checkbox({
|
|
|
19805
19793
|
setValue({ item: data, value: !getValue({ item: data }) })
|
|
19806
19794
|
);
|
|
19807
19795
|
}, [data, getValue, onChange, setValue]);
|
|
19808
|
-
return /* @__PURE__ */
|
|
19796
|
+
return /* @__PURE__ */ jsx75(
|
|
19809
19797
|
ValidatedCheckboxControl2,
|
|
19810
19798
|
{
|
|
19811
19799
|
required: !!field.isValid?.required,
|
|
@@ -19821,7 +19809,7 @@ function Checkbox({
|
|
|
19821
19809
|
}
|
|
19822
19810
|
|
|
19823
19811
|
// src/components/dataform-controls/combobox.tsx
|
|
19824
|
-
import { jsx as
|
|
19812
|
+
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
19825
19813
|
var { ValidatedComboboxControl: ValidatedComboboxControl2 } = unlock3(privateApis);
|
|
19826
19814
|
function Combobox2({
|
|
19827
19815
|
data,
|
|
@@ -19841,9 +19829,9 @@ function Combobox2({
|
|
|
19841
19829
|
getElements: field.getElements
|
|
19842
19830
|
});
|
|
19843
19831
|
if (isLoading) {
|
|
19844
|
-
return /* @__PURE__ */
|
|
19832
|
+
return /* @__PURE__ */ jsx76(spinner_default, {});
|
|
19845
19833
|
}
|
|
19846
|
-
return /* @__PURE__ */
|
|
19834
|
+
return /* @__PURE__ */ jsx76(
|
|
19847
19835
|
ValidatedComboboxControl2,
|
|
19848
19836
|
{
|
|
19849
19837
|
required: !!field.isValid?.required,
|
|
@@ -19862,14 +19850,13 @@ function Combobox2({
|
|
|
19862
19850
|
}
|
|
19863
19851
|
|
|
19864
19852
|
// src/components/dataform-controls/datetime.tsx
|
|
19865
|
-
import { format } from "date-fns";
|
|
19866
19853
|
import { __ as __47 } from "@wordpress/i18n";
|
|
19867
|
-
import { getSettings } from "@wordpress/date";
|
|
19854
|
+
import { dateI18n, getDate as getDate3, getSettings } from "@wordpress/date";
|
|
19868
19855
|
|
|
19869
19856
|
// src/components/dataform-controls/utils/relative-date-control.tsx
|
|
19870
|
-
import
|
|
19857
|
+
import clsx44 from "clsx";
|
|
19871
19858
|
import { __ as __46 } from "@wordpress/i18n";
|
|
19872
|
-
import { jsx as
|
|
19859
|
+
import { jsx as jsx77, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
19873
19860
|
var TIME_UNITS_OPTIONS = {
|
|
19874
19861
|
[OPERATOR_IN_THE_PAST]: [
|
|
19875
19862
|
{ value: "days", label: __46("Days") },
|
|
@@ -19893,7 +19880,7 @@ function RelativeDateControl({
|
|
|
19893
19880
|
operator
|
|
19894
19881
|
}) {
|
|
19895
19882
|
const options2 = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
|
|
19896
|
-
const { id, label, getValue, setValue } = field;
|
|
19883
|
+
const { id, label, description, getValue, setValue } = field;
|
|
19897
19884
|
const fieldValue = getValue({ item: data });
|
|
19898
19885
|
const { value: relValue = "", unit = options2[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
|
|
19899
19886
|
const onChangeValue = useCallback(
|
|
@@ -19914,15 +19901,16 @@ function RelativeDateControl({
|
|
|
19914
19901
|
),
|
|
19915
19902
|
[onChange, setValue, data, relValue]
|
|
19916
19903
|
);
|
|
19917
|
-
return /* @__PURE__ */
|
|
19904
|
+
return /* @__PURE__ */ jsx77(
|
|
19918
19905
|
base_control_default,
|
|
19919
19906
|
{
|
|
19920
19907
|
id,
|
|
19921
|
-
className:
|
|
19908
|
+
className: clsx44(className2, "dataviews-controls__relative-date"),
|
|
19922
19909
|
label,
|
|
19923
19910
|
hideLabelFromVision,
|
|
19924
|
-
|
|
19925
|
-
|
|
19911
|
+
help: description,
|
|
19912
|
+
children: /* @__PURE__ */ jsxs25(Stack, { direction: "row", gap: "sm", children: [
|
|
19913
|
+
/* @__PURE__ */ jsx77(
|
|
19926
19914
|
number_control_default,
|
|
19927
19915
|
{
|
|
19928
19916
|
__next40pxDefaultSize: true,
|
|
@@ -19934,7 +19922,7 @@ function RelativeDateControl({
|
|
|
19934
19922
|
onChange: onChangeValue
|
|
19935
19923
|
}
|
|
19936
19924
|
),
|
|
19937
|
-
/* @__PURE__ */
|
|
19925
|
+
/* @__PURE__ */ jsx77(
|
|
19938
19926
|
select_control_default,
|
|
19939
19927
|
{
|
|
19940
19928
|
className: "dataviews-controls__relative-date-unit",
|
|
@@ -19963,16 +19951,13 @@ function parseDateTime(dateTimeString) {
|
|
|
19963
19951
|
}
|
|
19964
19952
|
|
|
19965
19953
|
// src/components/dataform-controls/datetime.tsx
|
|
19966
|
-
import { jsx as
|
|
19954
|
+
import { jsx as jsx78, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
19967
19955
|
var { DateCalendar: DateCalendar2, ValidatedInputControl: ValidatedInputControl2 } = unlock3(privateApis);
|
|
19968
|
-
var formatDateTime = (
|
|
19969
|
-
if (!
|
|
19956
|
+
var formatDateTime = (value) => {
|
|
19957
|
+
if (!value) {
|
|
19970
19958
|
return "";
|
|
19971
19959
|
}
|
|
19972
|
-
|
|
19973
|
-
return date;
|
|
19974
|
-
}
|
|
19975
|
-
return format(date, "yyyy-MM-dd'T'HH:mm");
|
|
19960
|
+
return dateI18n("Y-m-d\\TH:i", getDate3(value));
|
|
19976
19961
|
};
|
|
19977
19962
|
function CalendarDateTimeControl({
|
|
19978
19963
|
data,
|
|
@@ -20007,17 +19992,14 @@ function CalendarDateTimeControl({
|
|
|
20007
19992
|
(newDate) => {
|
|
20008
19993
|
let dateTimeValue;
|
|
20009
19994
|
if (newDate) {
|
|
20010
|
-
|
|
19995
|
+
const wpDate = dateI18n("Y-m-d", newDate);
|
|
19996
|
+
let wpTime;
|
|
20011
19997
|
if (value) {
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
finalDateTime.setHours(currentDateTime.getHours());
|
|
20016
|
-
finalDateTime.setMinutes(
|
|
20017
|
-
currentDateTime.getMinutes()
|
|
20018
|
-
);
|
|
20019
|
-
}
|
|
19998
|
+
wpTime = dateI18n("H:i", getDate3(value));
|
|
19999
|
+
} else {
|
|
20000
|
+
wpTime = dateI18n("H:i", newDate);
|
|
20020
20001
|
}
|
|
20002
|
+
const finalDateTime = getDate3(`${wpDate}T${wpTime}`);
|
|
20021
20003
|
dateTimeValue = finalDateTime.toISOString();
|
|
20022
20004
|
onChangeCallback(dateTimeValue);
|
|
20023
20005
|
if (validationTimeoutRef.current) {
|
|
@@ -20043,7 +20025,7 @@ function CalendarDateTimeControl({
|
|
|
20043
20025
|
const handleManualDateTimeChange = useCallback(
|
|
20044
20026
|
(newValue) => {
|
|
20045
20027
|
if (newValue) {
|
|
20046
|
-
const dateTime =
|
|
20028
|
+
const dateTime = getDate3(newValue);
|
|
20047
20029
|
onChangeCallback(dateTime.toISOString());
|
|
20048
20030
|
const parsedDate = parseDateTime(dateTime.toISOString());
|
|
20049
20031
|
if (parsedDate) {
|
|
@@ -20066,27 +20048,15 @@ function CalendarDateTimeControl({
|
|
|
20066
20048
|
} else if (!isValid?.required && markWhenOptional && !hideLabelFromVision) {
|
|
20067
20049
|
displayLabel = `${label} (${__47("Optional")})`;
|
|
20068
20050
|
}
|
|
20069
|
-
return /* @__PURE__ */
|
|
20051
|
+
return /* @__PURE__ */ jsx78(
|
|
20070
20052
|
base_control_default,
|
|
20071
20053
|
{
|
|
20072
20054
|
id,
|
|
20073
20055
|
label: displayLabel,
|
|
20074
20056
|
help: description,
|
|
20075
20057
|
hideLabelFromVision,
|
|
20076
|
-
children: /* @__PURE__ */
|
|
20077
|
-
/* @__PURE__ */
|
|
20078
|
-
DateCalendar2,
|
|
20079
|
-
{
|
|
20080
|
-
style: { width: "100%" },
|
|
20081
|
-
selected: value ? parseDateTime(value) || void 0 : void 0,
|
|
20082
|
-
onSelect: onSelectDate,
|
|
20083
|
-
month: calendarMonth,
|
|
20084
|
-
onMonthChange: setCalendarMonth,
|
|
20085
|
-
timeZone: timezoneString || void 0,
|
|
20086
|
-
weekStartsOn
|
|
20087
|
-
}
|
|
20088
|
-
),
|
|
20089
|
-
/* @__PURE__ */ jsx77(
|
|
20058
|
+
children: /* @__PURE__ */ jsxs26(Stack, { direction: "column", gap: "lg", children: [
|
|
20059
|
+
/* @__PURE__ */ jsx78(
|
|
20090
20060
|
ValidatedInputControl2,
|
|
20091
20061
|
{
|
|
20092
20062
|
ref: inputControlRef,
|
|
@@ -20096,11 +20066,21 @@ function CalendarDateTimeControl({
|
|
|
20096
20066
|
type: "datetime-local",
|
|
20097
20067
|
label: __47("Date time"),
|
|
20098
20068
|
hideLabelFromVision: true,
|
|
20099
|
-
value:
|
|
20100
|
-
parseDateTime(value) || void 0
|
|
20101
|
-
) : "",
|
|
20069
|
+
value: formatDateTime(value),
|
|
20102
20070
|
onChange: handleManualDateTimeChange
|
|
20103
20071
|
}
|
|
20072
|
+
),
|
|
20073
|
+
/* @__PURE__ */ jsx78(
|
|
20074
|
+
DateCalendar2,
|
|
20075
|
+
{
|
|
20076
|
+
style: { width: "100%" },
|
|
20077
|
+
selected: value ? parseDateTime(value) || void 0 : void 0,
|
|
20078
|
+
onSelect: onSelectDate,
|
|
20079
|
+
month: calendarMonth,
|
|
20080
|
+
onMonthChange: setCalendarMonth,
|
|
20081
|
+
timeZone: timezoneString || void 0,
|
|
20082
|
+
weekStartsOn
|
|
20083
|
+
}
|
|
20104
20084
|
)
|
|
20105
20085
|
] })
|
|
20106
20086
|
}
|
|
@@ -20116,7 +20096,7 @@ function DateTime({
|
|
|
20116
20096
|
validity
|
|
20117
20097
|
}) {
|
|
20118
20098
|
if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
|
|
20119
|
-
return /* @__PURE__ */
|
|
20099
|
+
return /* @__PURE__ */ jsx78(
|
|
20120
20100
|
RelativeDateControl,
|
|
20121
20101
|
{
|
|
20122
20102
|
className: "dataviews-controls__datetime",
|
|
@@ -20128,7 +20108,7 @@ function DateTime({
|
|
|
20128
20108
|
}
|
|
20129
20109
|
);
|
|
20130
20110
|
}
|
|
20131
|
-
return /* @__PURE__ */
|
|
20111
|
+
return /* @__PURE__ */ jsx78(
|
|
20132
20112
|
CalendarDateTimeControl,
|
|
20133
20113
|
{
|
|
20134
20114
|
data,
|
|
@@ -20142,9 +20122,9 @@ function DateTime({
|
|
|
20142
20122
|
}
|
|
20143
20123
|
|
|
20144
20124
|
// src/components/dataform-controls/date.tsx
|
|
20145
|
-
import
|
|
20125
|
+
import clsx45 from "clsx";
|
|
20146
20126
|
import {
|
|
20147
|
-
format
|
|
20127
|
+
format,
|
|
20148
20128
|
isValid as isValidDate2,
|
|
20149
20129
|
subMonths as subMonths2,
|
|
20150
20130
|
subDays as subDays2,
|
|
@@ -20153,20 +20133,20 @@ import {
|
|
|
20153
20133
|
startOfYear
|
|
20154
20134
|
} from "date-fns";
|
|
20155
20135
|
import { __ as __48 } from "@wordpress/i18n";
|
|
20156
|
-
import { getDate as
|
|
20157
|
-
import { jsx as
|
|
20136
|
+
import { getDate as getDate4, getSettings as getSettings2 } from "@wordpress/date";
|
|
20137
|
+
import { jsx as jsx79, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
20158
20138
|
var { DateCalendar: DateCalendar3, DateRangeCalendar: DateRangeCalendar2 } = unlock3(privateApis);
|
|
20159
20139
|
var DATE_PRESETS = [
|
|
20160
20140
|
{
|
|
20161
20141
|
id: "today",
|
|
20162
20142
|
label: __48("Today"),
|
|
20163
|
-
getValue: () =>
|
|
20143
|
+
getValue: () => getDate4(null)
|
|
20164
20144
|
},
|
|
20165
20145
|
{
|
|
20166
20146
|
id: "yesterday",
|
|
20167
20147
|
label: __48("Yesterday"),
|
|
20168
20148
|
getValue: () => {
|
|
20169
|
-
const today =
|
|
20149
|
+
const today = getDate4(null);
|
|
20170
20150
|
return subDays2(today, 1);
|
|
20171
20151
|
}
|
|
20172
20152
|
},
|
|
@@ -20174,7 +20154,7 @@ var DATE_PRESETS = [
|
|
|
20174
20154
|
id: "past-week",
|
|
20175
20155
|
label: __48("Past week"),
|
|
20176
20156
|
getValue: () => {
|
|
20177
|
-
const today =
|
|
20157
|
+
const today = getDate4(null);
|
|
20178
20158
|
return subDays2(today, 7);
|
|
20179
20159
|
}
|
|
20180
20160
|
},
|
|
@@ -20182,7 +20162,7 @@ var DATE_PRESETS = [
|
|
|
20182
20162
|
id: "past-month",
|
|
20183
20163
|
label: __48("Past month"),
|
|
20184
20164
|
getValue: () => {
|
|
20185
|
-
const today =
|
|
20165
|
+
const today = getDate4(null);
|
|
20186
20166
|
return subMonths2(today, 1);
|
|
20187
20167
|
}
|
|
20188
20168
|
}
|
|
@@ -20192,7 +20172,7 @@ var DATE_RANGE_PRESETS = [
|
|
|
20192
20172
|
id: "last-7-days",
|
|
20193
20173
|
label: __48("Last 7 days"),
|
|
20194
20174
|
getValue: () => {
|
|
20195
|
-
const today =
|
|
20175
|
+
const today = getDate4(null);
|
|
20196
20176
|
return [subDays2(today, 7), today];
|
|
20197
20177
|
}
|
|
20198
20178
|
},
|
|
@@ -20200,7 +20180,7 @@ var DATE_RANGE_PRESETS = [
|
|
|
20200
20180
|
id: "last-30-days",
|
|
20201
20181
|
label: __48("Last 30 days"),
|
|
20202
20182
|
getValue: () => {
|
|
20203
|
-
const today =
|
|
20183
|
+
const today = getDate4(null);
|
|
20204
20184
|
return [subDays2(today, 30), today];
|
|
20205
20185
|
}
|
|
20206
20186
|
},
|
|
@@ -20208,7 +20188,7 @@ var DATE_RANGE_PRESETS = [
|
|
|
20208
20188
|
id: "month-to-date",
|
|
20209
20189
|
label: __48("Month to date"),
|
|
20210
20190
|
getValue: () => {
|
|
20211
|
-
const today =
|
|
20191
|
+
const today = getDate4(null);
|
|
20212
20192
|
return [startOfMonth(today), today];
|
|
20213
20193
|
}
|
|
20214
20194
|
},
|
|
@@ -20216,7 +20196,7 @@ var DATE_RANGE_PRESETS = [
|
|
|
20216
20196
|
id: "last-year",
|
|
20217
20197
|
label: __48("Last year"),
|
|
20218
20198
|
getValue: () => {
|
|
20219
|
-
const today =
|
|
20199
|
+
const today = getDate4(null);
|
|
20220
20200
|
return [subYears2(today, 1), today];
|
|
20221
20201
|
}
|
|
20222
20202
|
},
|
|
@@ -20224,7 +20204,7 @@ var DATE_RANGE_PRESETS = [
|
|
|
20224
20204
|
id: "year-to-date",
|
|
20225
20205
|
label: __48("Year to date"),
|
|
20226
20206
|
getValue: () => {
|
|
20227
|
-
const today =
|
|
20207
|
+
const today = getDate4(null);
|
|
20228
20208
|
return [startOfYear(today), today];
|
|
20229
20209
|
}
|
|
20230
20210
|
}
|
|
@@ -20233,14 +20213,14 @@ var parseDate = (dateString) => {
|
|
|
20233
20213
|
if (!dateString) {
|
|
20234
20214
|
return null;
|
|
20235
20215
|
}
|
|
20236
|
-
const parsed =
|
|
20216
|
+
const parsed = getDate4(dateString);
|
|
20237
20217
|
return parsed && isValidDate2(parsed) ? parsed : null;
|
|
20238
20218
|
};
|
|
20239
20219
|
var formatDate = (date) => {
|
|
20240
20220
|
if (!date) {
|
|
20241
20221
|
return "";
|
|
20242
20222
|
}
|
|
20243
|
-
return typeof date === "string" ? date :
|
|
20223
|
+
return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
|
|
20244
20224
|
};
|
|
20245
20225
|
function ValidatedDateControl({
|
|
20246
20226
|
field,
|
|
@@ -20312,17 +20292,17 @@ function ValidatedDateControl({
|
|
|
20312
20292
|
setIsTouched(true);
|
|
20313
20293
|
}
|
|
20314
20294
|
};
|
|
20315
|
-
return /* @__PURE__ */
|
|
20295
|
+
return /* @__PURE__ */ jsxs27("div", { onBlur, children: [
|
|
20316
20296
|
children,
|
|
20317
|
-
/* @__PURE__ */
|
|
20297
|
+
/* @__PURE__ */ jsx79("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ jsxs27(
|
|
20318
20298
|
"p",
|
|
20319
20299
|
{
|
|
20320
|
-
className:
|
|
20300
|
+
className: clsx45(
|
|
20321
20301
|
"components-validated-control__indicator",
|
|
20322
20302
|
customValidity.type === "invalid" ? "is-invalid" : void 0
|
|
20323
20303
|
),
|
|
20324
20304
|
children: [
|
|
20325
|
-
/* @__PURE__ */
|
|
20305
|
+
/* @__PURE__ */ jsx79(
|
|
20326
20306
|
icon_default2,
|
|
20327
20307
|
{
|
|
20328
20308
|
className: "components-validated-control__indicator-icon",
|
|
@@ -20348,6 +20328,7 @@ function CalendarDateControl({
|
|
|
20348
20328
|
const {
|
|
20349
20329
|
id,
|
|
20350
20330
|
label,
|
|
20331
|
+
description,
|
|
20351
20332
|
setValue,
|
|
20352
20333
|
getValue,
|
|
20353
20334
|
isValid,
|
|
@@ -20371,7 +20352,7 @@ function CalendarDateControl({
|
|
|
20371
20352
|
);
|
|
20372
20353
|
const onSelectDate = useCallback(
|
|
20373
20354
|
(newDate) => {
|
|
20374
|
-
const dateValue = newDate ?
|
|
20355
|
+
const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
|
|
20375
20356
|
onChangeCallback(dateValue);
|
|
20376
20357
|
setSelectedPresetId(null);
|
|
20377
20358
|
setIsTouched(true);
|
|
@@ -20412,7 +20393,7 @@ function CalendarDateControl({
|
|
|
20412
20393
|
} else if (!isValid?.required && markWhenOptional) {
|
|
20413
20394
|
displayLabel = `${label} (${__48("Optional")})`;
|
|
20414
20395
|
}
|
|
20415
|
-
return /* @__PURE__ */
|
|
20396
|
+
return /* @__PURE__ */ jsx79(
|
|
20416
20397
|
ValidatedDateControl,
|
|
20417
20398
|
{
|
|
20418
20399
|
field,
|
|
@@ -20420,15 +20401,16 @@ function CalendarDateControl({
|
|
|
20420
20401
|
inputRefs: validityTargetRef,
|
|
20421
20402
|
isTouched,
|
|
20422
20403
|
setIsTouched,
|
|
20423
|
-
children: /* @__PURE__ */
|
|
20404
|
+
children: /* @__PURE__ */ jsx79(
|
|
20424
20405
|
base_control_default,
|
|
20425
20406
|
{
|
|
20426
20407
|
id,
|
|
20427
20408
|
className: "dataviews-controls__date",
|
|
20428
20409
|
label: displayLabel,
|
|
20410
|
+
help: description,
|
|
20429
20411
|
hideLabelFromVision,
|
|
20430
|
-
children: /* @__PURE__ */
|
|
20431
|
-
/* @__PURE__ */
|
|
20412
|
+
children: /* @__PURE__ */ jsxs27(Stack, { direction: "column", gap: "lg", children: [
|
|
20413
|
+
/* @__PURE__ */ jsxs27(
|
|
20432
20414
|
Stack,
|
|
20433
20415
|
{
|
|
20434
20416
|
direction: "row",
|
|
@@ -20438,7 +20420,7 @@ function CalendarDateControl({
|
|
|
20438
20420
|
children: [
|
|
20439
20421
|
DATE_PRESETS.map((preset) => {
|
|
20440
20422
|
const isSelected = selectedPresetId === preset.id;
|
|
20441
|
-
return /* @__PURE__ */
|
|
20423
|
+
return /* @__PURE__ */ jsx79(
|
|
20442
20424
|
button_default,
|
|
20443
20425
|
{
|
|
20444
20426
|
className: "dataviews-controls__date-preset",
|
|
@@ -20451,7 +20433,7 @@ function CalendarDateControl({
|
|
|
20451
20433
|
preset.id
|
|
20452
20434
|
);
|
|
20453
20435
|
}),
|
|
20454
|
-
/* @__PURE__ */
|
|
20436
|
+
/* @__PURE__ */ jsx79(
|
|
20455
20437
|
button_default,
|
|
20456
20438
|
{
|
|
20457
20439
|
className: "dataviews-controls__date-preset",
|
|
@@ -20466,7 +20448,7 @@ function CalendarDateControl({
|
|
|
20466
20448
|
]
|
|
20467
20449
|
}
|
|
20468
20450
|
),
|
|
20469
|
-
/* @__PURE__ */
|
|
20451
|
+
/* @__PURE__ */ jsx79(
|
|
20470
20452
|
input_control_default,
|
|
20471
20453
|
{
|
|
20472
20454
|
__next40pxDefaultSize: true,
|
|
@@ -20479,7 +20461,7 @@ function CalendarDateControl({
|
|
|
20479
20461
|
required: !!field.isValid?.required
|
|
20480
20462
|
}
|
|
20481
20463
|
),
|
|
20482
|
-
/* @__PURE__ */
|
|
20464
|
+
/* @__PURE__ */ jsx79(
|
|
20483
20465
|
DateCalendar3,
|
|
20484
20466
|
{
|
|
20485
20467
|
style: { width: "100%" },
|
|
@@ -20505,7 +20487,14 @@ function CalendarDateRangeControl({
|
|
|
20505
20487
|
markWhenOptional,
|
|
20506
20488
|
validity
|
|
20507
20489
|
}) {
|
|
20508
|
-
const {
|
|
20490
|
+
const {
|
|
20491
|
+
id,
|
|
20492
|
+
label,
|
|
20493
|
+
description,
|
|
20494
|
+
getValue,
|
|
20495
|
+
setValue,
|
|
20496
|
+
format: fieldFormat
|
|
20497
|
+
} = field;
|
|
20509
20498
|
let value;
|
|
20510
20499
|
const fieldValue = getValue({ item: data });
|
|
20511
20500
|
if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
|
|
@@ -20600,7 +20589,7 @@ function CalendarDateRangeControl({
|
|
|
20600
20589
|
} else if (!field.isValid?.required && markWhenOptional) {
|
|
20601
20590
|
displayLabel = `${label} (${__48("Optional")})`;
|
|
20602
20591
|
}
|
|
20603
|
-
return /* @__PURE__ */
|
|
20592
|
+
return /* @__PURE__ */ jsx79(
|
|
20604
20593
|
ValidatedDateControl,
|
|
20605
20594
|
{
|
|
20606
20595
|
field,
|
|
@@ -20608,15 +20597,16 @@ function CalendarDateRangeControl({
|
|
|
20608
20597
|
inputRefs: [fromInputRef, toInputRef],
|
|
20609
20598
|
isTouched,
|
|
20610
20599
|
setIsTouched,
|
|
20611
|
-
children: /* @__PURE__ */
|
|
20600
|
+
children: /* @__PURE__ */ jsx79(
|
|
20612
20601
|
base_control_default,
|
|
20613
20602
|
{
|
|
20614
20603
|
id,
|
|
20615
20604
|
className: "dataviews-controls__date",
|
|
20616
20605
|
label: displayLabel,
|
|
20606
|
+
help: description,
|
|
20617
20607
|
hideLabelFromVision,
|
|
20618
|
-
children: /* @__PURE__ */
|
|
20619
|
-
/* @__PURE__ */
|
|
20608
|
+
children: /* @__PURE__ */ jsxs27(Stack, { direction: "column", gap: "lg", children: [
|
|
20609
|
+
/* @__PURE__ */ jsxs27(
|
|
20620
20610
|
Stack,
|
|
20621
20611
|
{
|
|
20622
20612
|
direction: "row",
|
|
@@ -20626,7 +20616,7 @@ function CalendarDateRangeControl({
|
|
|
20626
20616
|
children: [
|
|
20627
20617
|
DATE_RANGE_PRESETS.map((preset) => {
|
|
20628
20618
|
const isSelected = selectedPresetId === preset.id;
|
|
20629
|
-
return /* @__PURE__ */
|
|
20619
|
+
return /* @__PURE__ */ jsx79(
|
|
20630
20620
|
button_default,
|
|
20631
20621
|
{
|
|
20632
20622
|
className: "dataviews-controls__date-preset",
|
|
@@ -20639,7 +20629,7 @@ function CalendarDateRangeControl({
|
|
|
20639
20629
|
preset.id
|
|
20640
20630
|
);
|
|
20641
20631
|
}),
|
|
20642
|
-
/* @__PURE__ */
|
|
20632
|
+
/* @__PURE__ */ jsx79(
|
|
20643
20633
|
button_default,
|
|
20644
20634
|
{
|
|
20645
20635
|
className: "dataviews-controls__date-preset",
|
|
@@ -20654,7 +20644,7 @@ function CalendarDateRangeControl({
|
|
|
20654
20644
|
]
|
|
20655
20645
|
}
|
|
20656
20646
|
),
|
|
20657
|
-
/* @__PURE__ */
|
|
20647
|
+
/* @__PURE__ */ jsxs27(
|
|
20658
20648
|
Stack,
|
|
20659
20649
|
{
|
|
20660
20650
|
direction: "row",
|
|
@@ -20662,7 +20652,7 @@ function CalendarDateRangeControl({
|
|
|
20662
20652
|
justify: "space-between",
|
|
20663
20653
|
className: "dataviews-controls__date-range-inputs",
|
|
20664
20654
|
children: [
|
|
20665
|
-
/* @__PURE__ */
|
|
20655
|
+
/* @__PURE__ */ jsx79(
|
|
20666
20656
|
input_control_default,
|
|
20667
20657
|
{
|
|
20668
20658
|
__next40pxDefaultSize: true,
|
|
@@ -20675,7 +20665,7 @@ function CalendarDateRangeControl({
|
|
|
20675
20665
|
required: !!field.isValid?.required
|
|
20676
20666
|
}
|
|
20677
20667
|
),
|
|
20678
|
-
/* @__PURE__ */
|
|
20668
|
+
/* @__PURE__ */ jsx79(
|
|
20679
20669
|
input_control_default,
|
|
20680
20670
|
{
|
|
20681
20671
|
__next40pxDefaultSize: true,
|
|
@@ -20691,7 +20681,7 @@ function CalendarDateRangeControl({
|
|
|
20691
20681
|
]
|
|
20692
20682
|
}
|
|
20693
20683
|
),
|
|
20694
|
-
/* @__PURE__ */
|
|
20684
|
+
/* @__PURE__ */ jsx79(
|
|
20695
20685
|
DateRangeCalendar2,
|
|
20696
20686
|
{
|
|
20697
20687
|
style: { width: "100%" },
|
|
@@ -20719,7 +20709,7 @@ function DateControl({
|
|
|
20719
20709
|
validity
|
|
20720
20710
|
}) {
|
|
20721
20711
|
if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
|
|
20722
|
-
return /* @__PURE__ */
|
|
20712
|
+
return /* @__PURE__ */ jsx79(
|
|
20723
20713
|
RelativeDateControl,
|
|
20724
20714
|
{
|
|
20725
20715
|
className: "dataviews-controls__date",
|
|
@@ -20732,7 +20722,7 @@ function DateControl({
|
|
|
20732
20722
|
);
|
|
20733
20723
|
}
|
|
20734
20724
|
if (operator === OPERATOR_BETWEEN) {
|
|
20735
|
-
return /* @__PURE__ */
|
|
20725
|
+
return /* @__PURE__ */ jsx79(
|
|
20736
20726
|
CalendarDateRangeControl,
|
|
20737
20727
|
{
|
|
20738
20728
|
data,
|
|
@@ -20744,7 +20734,7 @@ function DateControl({
|
|
|
20744
20734
|
}
|
|
20745
20735
|
);
|
|
20746
20736
|
}
|
|
20747
|
-
return /* @__PURE__ */
|
|
20737
|
+
return /* @__PURE__ */ jsx79(
|
|
20748
20738
|
CalendarDateControl,
|
|
20749
20739
|
{
|
|
20750
20740
|
data,
|
|
@@ -20758,7 +20748,7 @@ function DateControl({
|
|
|
20758
20748
|
}
|
|
20759
20749
|
|
|
20760
20750
|
// src/components/dataform-controls/select.tsx
|
|
20761
|
-
import { jsx as
|
|
20751
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
20762
20752
|
var { ValidatedSelectControl: ValidatedSelectControl2 } = unlock3(privateApis);
|
|
20763
20753
|
function Select2({
|
|
20764
20754
|
data,
|
|
@@ -20780,9 +20770,9 @@ function Select2({
|
|
|
20780
20770
|
getElements: field.getElements
|
|
20781
20771
|
});
|
|
20782
20772
|
if (isLoading) {
|
|
20783
|
-
return /* @__PURE__ */
|
|
20773
|
+
return /* @__PURE__ */ jsx80(spinner_default, {});
|
|
20784
20774
|
}
|
|
20785
|
-
return /* @__PURE__ */
|
|
20775
|
+
return /* @__PURE__ */ jsx80(
|
|
20786
20776
|
ValidatedSelectControl2,
|
|
20787
20777
|
{
|
|
20788
20778
|
required: !!field.isValid?.required,
|
|
@@ -20801,7 +20791,7 @@ function Select2({
|
|
|
20801
20791
|
}
|
|
20802
20792
|
|
|
20803
20793
|
// src/components/dataform-controls/adaptive-select.tsx
|
|
20804
|
-
import { jsx as
|
|
20794
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
20805
20795
|
var ELEMENTS_THRESHOLD = 10;
|
|
20806
20796
|
function AdaptiveSelect(props) {
|
|
20807
20797
|
const { field } = props;
|
|
@@ -20810,13 +20800,13 @@ function AdaptiveSelect(props) {
|
|
|
20810
20800
|
getElements: field.getElements
|
|
20811
20801
|
});
|
|
20812
20802
|
if (elements.length >= ELEMENTS_THRESHOLD) {
|
|
20813
|
-
return /* @__PURE__ */
|
|
20803
|
+
return /* @__PURE__ */ jsx81(Combobox2, { ...props });
|
|
20814
20804
|
}
|
|
20815
|
-
return /* @__PURE__ */
|
|
20805
|
+
return /* @__PURE__ */ jsx81(Select2, { ...props });
|
|
20816
20806
|
}
|
|
20817
20807
|
|
|
20818
20808
|
// src/components/dataform-controls/utils/validated-input.tsx
|
|
20819
|
-
import { jsx as
|
|
20809
|
+
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
20820
20810
|
var { ValidatedInputControl: ValidatedInputControl3 } = unlock3(privateApis);
|
|
20821
20811
|
function ValidatedText({
|
|
20822
20812
|
data,
|
|
@@ -20840,7 +20830,7 @@ function ValidatedText({
|
|
|
20840
20830
|
),
|
|
20841
20831
|
[data, setValue, onChange]
|
|
20842
20832
|
);
|
|
20843
|
-
return /* @__PURE__ */
|
|
20833
|
+
return /* @__PURE__ */ jsx82(
|
|
20844
20834
|
ValidatedInputControl3,
|
|
20845
20835
|
{
|
|
20846
20836
|
required: !!isValid.required,
|
|
@@ -20864,7 +20854,7 @@ function ValidatedText({
|
|
|
20864
20854
|
}
|
|
20865
20855
|
|
|
20866
20856
|
// src/components/dataform-controls/email.tsx
|
|
20867
|
-
import { jsx as
|
|
20857
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
20868
20858
|
function Email({
|
|
20869
20859
|
data,
|
|
20870
20860
|
field,
|
|
@@ -20873,7 +20863,7 @@ function Email({
|
|
|
20873
20863
|
markWhenOptional,
|
|
20874
20864
|
validity
|
|
20875
20865
|
}) {
|
|
20876
|
-
return /* @__PURE__ */
|
|
20866
|
+
return /* @__PURE__ */ jsx83(
|
|
20877
20867
|
ValidatedText,
|
|
20878
20868
|
{
|
|
20879
20869
|
...{
|
|
@@ -20884,14 +20874,14 @@ function Email({
|
|
|
20884
20874
|
markWhenOptional,
|
|
20885
20875
|
validity,
|
|
20886
20876
|
type: "email",
|
|
20887
|
-
prefix: /* @__PURE__ */
|
|
20877
|
+
prefix: /* @__PURE__ */ jsx83(input_prefix_wrapper_default, { variant: "icon", children: /* @__PURE__ */ jsx83(icon_default2, { icon: envelope_default }) })
|
|
20888
20878
|
}
|
|
20889
20879
|
}
|
|
20890
20880
|
);
|
|
20891
20881
|
}
|
|
20892
20882
|
|
|
20893
20883
|
// src/components/dataform-controls/telephone.tsx
|
|
20894
|
-
import { jsx as
|
|
20884
|
+
import { jsx as jsx84 } from "react/jsx-runtime";
|
|
20895
20885
|
function Telephone({
|
|
20896
20886
|
data,
|
|
20897
20887
|
field,
|
|
@@ -20900,7 +20890,7 @@ function Telephone({
|
|
|
20900
20890
|
markWhenOptional,
|
|
20901
20891
|
validity
|
|
20902
20892
|
}) {
|
|
20903
|
-
return /* @__PURE__ */
|
|
20893
|
+
return /* @__PURE__ */ jsx84(
|
|
20904
20894
|
ValidatedText,
|
|
20905
20895
|
{
|
|
20906
20896
|
...{
|
|
@@ -20911,14 +20901,14 @@ function Telephone({
|
|
|
20911
20901
|
markWhenOptional,
|
|
20912
20902
|
validity,
|
|
20913
20903
|
type: "tel",
|
|
20914
|
-
prefix: /* @__PURE__ */
|
|
20904
|
+
prefix: /* @__PURE__ */ jsx84(input_prefix_wrapper_default, { variant: "icon", children: /* @__PURE__ */ jsx84(icon_default2, { icon: mobile_default }) })
|
|
20915
20905
|
}
|
|
20916
20906
|
}
|
|
20917
20907
|
);
|
|
20918
20908
|
}
|
|
20919
20909
|
|
|
20920
20910
|
// src/components/dataform-controls/url.tsx
|
|
20921
|
-
import { jsx as
|
|
20911
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
20922
20912
|
function Url({
|
|
20923
20913
|
data,
|
|
20924
20914
|
field,
|
|
@@ -20927,7 +20917,7 @@ function Url({
|
|
|
20927
20917
|
markWhenOptional,
|
|
20928
20918
|
validity
|
|
20929
20919
|
}) {
|
|
20930
|
-
return /* @__PURE__ */
|
|
20920
|
+
return /* @__PURE__ */ jsx85(
|
|
20931
20921
|
ValidatedText,
|
|
20932
20922
|
{
|
|
20933
20923
|
...{
|
|
@@ -20938,7 +20928,7 @@ function Url({
|
|
|
20938
20928
|
markWhenOptional,
|
|
20939
20929
|
validity,
|
|
20940
20930
|
type: "url",
|
|
20941
|
-
prefix: /* @__PURE__ */
|
|
20931
|
+
prefix: /* @__PURE__ */ jsx85(input_prefix_wrapper_default, { variant: "icon", children: /* @__PURE__ */ jsx85(icon_default2, { icon: link_default }) })
|
|
20942
20932
|
}
|
|
20943
20933
|
}
|
|
20944
20934
|
);
|
|
@@ -20946,7 +20936,7 @@ function Url({
|
|
|
20946
20936
|
|
|
20947
20937
|
// src/components/dataform-controls/utils/validated-number.tsx
|
|
20948
20938
|
import { __ as __49 } from "@wordpress/i18n";
|
|
20949
|
-
import { jsx as
|
|
20939
|
+
import { jsx as jsx86, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
20950
20940
|
var { ValidatedNumberControl: ValidatedNumberControl2 } = unlock3(privateApis);
|
|
20951
20941
|
function toNumberOrEmpty(value) {
|
|
20952
20942
|
if (value === "" || value === void 0) {
|
|
@@ -20970,12 +20960,12 @@ function BetweenControls({
|
|
|
20970
20960
|
(newValue) => onChange([min, toNumberOrEmpty(newValue)]),
|
|
20971
20961
|
[onChange, min]
|
|
20972
20962
|
);
|
|
20973
|
-
return /* @__PURE__ */
|
|
20963
|
+
return /* @__PURE__ */ jsx86(
|
|
20974
20964
|
base_control_default,
|
|
20975
20965
|
{
|
|
20976
20966
|
help: __49("The max. value must be greater than the min. value."),
|
|
20977
|
-
children: /* @__PURE__ */
|
|
20978
|
-
/* @__PURE__ */
|
|
20967
|
+
children: /* @__PURE__ */ jsxs28(component_default3, { direction: "row", gap: 4, children: [
|
|
20968
|
+
/* @__PURE__ */ jsx86(
|
|
20979
20969
|
number_control_default,
|
|
20980
20970
|
{
|
|
20981
20971
|
label: __49("Min."),
|
|
@@ -20987,7 +20977,7 @@ function BetweenControls({
|
|
|
20987
20977
|
step
|
|
20988
20978
|
}
|
|
20989
20979
|
),
|
|
20990
|
-
/* @__PURE__ */
|
|
20980
|
+
/* @__PURE__ */ jsx86(
|
|
20991
20981
|
number_control_default,
|
|
20992
20982
|
{
|
|
20993
20983
|
label: __49("Max."),
|
|
@@ -21048,7 +21038,7 @@ function ValidatedNumber({
|
|
|
21048
21038
|
)) {
|
|
21049
21039
|
valueBetween = value;
|
|
21050
21040
|
}
|
|
21051
|
-
return /* @__PURE__ */
|
|
21041
|
+
return /* @__PURE__ */ jsx86(
|
|
21052
21042
|
BetweenControls,
|
|
21053
21043
|
{
|
|
21054
21044
|
value: valueBetween,
|
|
@@ -21058,7 +21048,7 @@ function ValidatedNumber({
|
|
|
21058
21048
|
}
|
|
21059
21049
|
);
|
|
21060
21050
|
}
|
|
21061
|
-
return /* @__PURE__ */
|
|
21051
|
+
return /* @__PURE__ */ jsx86(
|
|
21062
21052
|
ValidatedNumberControl2,
|
|
21063
21053
|
{
|
|
21064
21054
|
required: !!isValid.required,
|
|
@@ -21078,19 +21068,19 @@ function ValidatedNumber({
|
|
|
21078
21068
|
}
|
|
21079
21069
|
|
|
21080
21070
|
// src/components/dataform-controls/integer.tsx
|
|
21081
|
-
import { jsx as
|
|
21071
|
+
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
21082
21072
|
function Integer(props) {
|
|
21083
|
-
return /* @__PURE__ */
|
|
21073
|
+
return /* @__PURE__ */ jsx87(ValidatedNumber, { ...props });
|
|
21084
21074
|
}
|
|
21085
21075
|
|
|
21086
21076
|
// src/components/dataform-controls/number.tsx
|
|
21087
|
-
import { jsx as
|
|
21077
|
+
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
21088
21078
|
function Number2(props) {
|
|
21089
|
-
return /* @__PURE__ */
|
|
21079
|
+
return /* @__PURE__ */ jsx88(ValidatedNumber, { ...props });
|
|
21090
21080
|
}
|
|
21091
21081
|
|
|
21092
21082
|
// src/components/dataform-controls/radio.tsx
|
|
21093
|
-
import { jsx as
|
|
21083
|
+
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
21094
21084
|
var { ValidatedRadioControl: ValidatedRadioControl2 } = unlock3(privateApis);
|
|
21095
21085
|
function Radio2({
|
|
21096
21086
|
data,
|
|
@@ -21111,9 +21101,9 @@ function Radio2({
|
|
|
21111
21101
|
[data, onChange, setValue]
|
|
21112
21102
|
);
|
|
21113
21103
|
if (isLoading) {
|
|
21114
|
-
return /* @__PURE__ */
|
|
21104
|
+
return /* @__PURE__ */ jsx89(spinner_default, {});
|
|
21115
21105
|
}
|
|
21116
|
-
return /* @__PURE__ */
|
|
21106
|
+
return /* @__PURE__ */ jsx89(
|
|
21117
21107
|
ValidatedRadioControl2,
|
|
21118
21108
|
{
|
|
21119
21109
|
required: !!field.isValid?.required,
|
|
@@ -21130,7 +21120,7 @@ function Radio2({
|
|
|
21130
21120
|
}
|
|
21131
21121
|
|
|
21132
21122
|
// src/components/dataform-controls/text.tsx
|
|
21133
|
-
import { jsx as
|
|
21123
|
+
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
21134
21124
|
function Text3({
|
|
21135
21125
|
data,
|
|
21136
21126
|
field,
|
|
@@ -21141,7 +21131,7 @@ function Text3({
|
|
|
21141
21131
|
validity
|
|
21142
21132
|
}) {
|
|
21143
21133
|
const { prefix, suffix } = config || {};
|
|
21144
|
-
return /* @__PURE__ */
|
|
21134
|
+
return /* @__PURE__ */ jsx90(
|
|
21145
21135
|
ValidatedText,
|
|
21146
21136
|
{
|
|
21147
21137
|
...{
|
|
@@ -21159,7 +21149,7 @@ function Text3({
|
|
|
21159
21149
|
}
|
|
21160
21150
|
|
|
21161
21151
|
// src/components/dataform-controls/toggle.tsx
|
|
21162
|
-
import { jsx as
|
|
21152
|
+
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
21163
21153
|
var { ValidatedToggleControl: ValidatedToggleControl2 } = unlock3(privateApis);
|
|
21164
21154
|
function Toggle({
|
|
21165
21155
|
field,
|
|
@@ -21175,7 +21165,7 @@ function Toggle({
|
|
|
21175
21165
|
setValue({ item: data, value: !getValue({ item: data }) })
|
|
21176
21166
|
);
|
|
21177
21167
|
}, [onChange, setValue, data, getValue]);
|
|
21178
|
-
return /* @__PURE__ */
|
|
21168
|
+
return /* @__PURE__ */ jsx91(
|
|
21179
21169
|
ValidatedToggleControl2,
|
|
21180
21170
|
{
|
|
21181
21171
|
required: !!isValid.required,
|
|
@@ -21191,7 +21181,7 @@ function Toggle({
|
|
|
21191
21181
|
}
|
|
21192
21182
|
|
|
21193
21183
|
// src/components/dataform-controls/textarea.tsx
|
|
21194
|
-
import { jsx as
|
|
21184
|
+
import { jsx as jsx92 } from "react/jsx-runtime";
|
|
21195
21185
|
var { ValidatedTextareaControl: ValidatedTextareaControl2 } = unlock3(privateApis);
|
|
21196
21186
|
function Textarea({
|
|
21197
21187
|
data,
|
|
@@ -21209,7 +21199,7 @@ function Textarea({
|
|
|
21209
21199
|
(newValue) => onChange(setValue({ item: data, value: newValue })),
|
|
21210
21200
|
[data, onChange, setValue]
|
|
21211
21201
|
);
|
|
21212
|
-
return /* @__PURE__ */
|
|
21202
|
+
return /* @__PURE__ */ jsx92(
|
|
21213
21203
|
ValidatedTextareaControl2,
|
|
21214
21204
|
{
|
|
21215
21205
|
required: !!isValid.required,
|
|
@@ -21230,7 +21220,7 @@ function Textarea({
|
|
|
21230
21220
|
}
|
|
21231
21221
|
|
|
21232
21222
|
// src/components/dataform-controls/toggle-group.tsx
|
|
21233
|
-
import { jsx as
|
|
21223
|
+
import { jsx as jsx93 } from "react/jsx-runtime";
|
|
21234
21224
|
var { ValidatedToggleGroupControl: ValidatedToggleGroupControl2 } = unlock3(privateApis);
|
|
21235
21225
|
function ToggleGroup({
|
|
21236
21226
|
data,
|
|
@@ -21251,13 +21241,13 @@ function ToggleGroup({
|
|
|
21251
21241
|
getElements: field.getElements
|
|
21252
21242
|
});
|
|
21253
21243
|
if (isLoading) {
|
|
21254
|
-
return /* @__PURE__ */
|
|
21244
|
+
return /* @__PURE__ */ jsx93(spinner_default, {});
|
|
21255
21245
|
}
|
|
21256
21246
|
if (elements.length === 0) {
|
|
21257
21247
|
return null;
|
|
21258
21248
|
}
|
|
21259
21249
|
const selectedOption = elements.find((el) => el.value === value);
|
|
21260
|
-
return /* @__PURE__ */
|
|
21250
|
+
return /* @__PURE__ */ jsx93(
|
|
21261
21251
|
ValidatedToggleGroupControl2,
|
|
21262
21252
|
{
|
|
21263
21253
|
required: !!field.isValid?.required,
|
|
@@ -21270,7 +21260,7 @@ function ToggleGroup({
|
|
|
21270
21260
|
onChange: onChangeControl,
|
|
21271
21261
|
value,
|
|
21272
21262
|
hideLabelFromVision,
|
|
21273
|
-
children: elements.map((el) => /* @__PURE__ */
|
|
21263
|
+
children: elements.map((el) => /* @__PURE__ */ jsx93(
|
|
21274
21264
|
component_default12,
|
|
21275
21265
|
{
|
|
21276
21266
|
label: el.label,
|
|
@@ -21283,7 +21273,7 @@ function ToggleGroup({
|
|
|
21283
21273
|
}
|
|
21284
21274
|
|
|
21285
21275
|
// src/components/dataform-controls/array.tsx
|
|
21286
|
-
import { jsx as
|
|
21276
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
21287
21277
|
var { ValidatedFormTokenField: ValidatedFormTokenField2 } = unlock3(privateApis);
|
|
21288
21278
|
function ArrayControl({
|
|
21289
21279
|
data,
|
|
@@ -21321,9 +21311,9 @@ function ArrayControl({
|
|
|
21321
21311
|
[onChange, setValue, data]
|
|
21322
21312
|
);
|
|
21323
21313
|
if (isLoading) {
|
|
21324
|
-
return /* @__PURE__ */
|
|
21314
|
+
return /* @__PURE__ */ jsx94(spinner_default, {});
|
|
21325
21315
|
}
|
|
21326
|
-
return /* @__PURE__ */
|
|
21316
|
+
return /* @__PURE__ */ jsx94(
|
|
21327
21317
|
ValidatedFormTokenField2,
|
|
21328
21318
|
{
|
|
21329
21319
|
required: !!isValid?.required,
|
|
@@ -21361,9 +21351,9 @@ function ArrayControl({
|
|
|
21361
21351
|
const element = elements.find(
|
|
21362
21352
|
(el) => el.value === item2
|
|
21363
21353
|
);
|
|
21364
|
-
return /* @__PURE__ */
|
|
21354
|
+
return /* @__PURE__ */ jsx94("span", { children: element?.label || item2 });
|
|
21365
21355
|
}
|
|
21366
|
-
return /* @__PURE__ */
|
|
21356
|
+
return /* @__PURE__ */ jsx94("span", { children: item2 });
|
|
21367
21357
|
}
|
|
21368
21358
|
}
|
|
21369
21359
|
);
|
|
@@ -21372,28 +21362,28 @@ function ArrayControl({
|
|
|
21372
21362
|
// src/components/dataform-controls/color.tsx
|
|
21373
21363
|
import { colord as colord7 } from "colord";
|
|
21374
21364
|
import { __ as __50 } from "@wordpress/i18n";
|
|
21375
|
-
import { jsx as
|
|
21365
|
+
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
21376
21366
|
var { ValidatedInputControl: ValidatedInputControl4 } = unlock3(privateApis);
|
|
21377
21367
|
var ColorPickerDropdown = ({
|
|
21378
21368
|
color,
|
|
21379
21369
|
onColorChange
|
|
21380
21370
|
}) => {
|
|
21381
21371
|
const validColor = color && colord7(color).isValid() ? color : "#ffffff";
|
|
21382
|
-
return /* @__PURE__ */
|
|
21372
|
+
return /* @__PURE__ */ jsx95(
|
|
21383
21373
|
dropdown_default,
|
|
21384
21374
|
{
|
|
21385
21375
|
className: "dataviews-controls__color-picker-dropdown",
|
|
21386
21376
|
popoverProps: { resize: false },
|
|
21387
|
-
renderToggle: ({ onToggle }) => /* @__PURE__ */
|
|
21377
|
+
renderToggle: ({ onToggle }) => /* @__PURE__ */ jsx95(
|
|
21388
21378
|
button_default,
|
|
21389
21379
|
{
|
|
21390
21380
|
onClick: onToggle,
|
|
21391
21381
|
"aria-label": __50("Open color picker"),
|
|
21392
21382
|
size: "small",
|
|
21393
|
-
icon: () => /* @__PURE__ */
|
|
21383
|
+
icon: () => /* @__PURE__ */ jsx95(color_indicator_default, { colorValue: validColor })
|
|
21394
21384
|
}
|
|
21395
21385
|
),
|
|
21396
|
-
renderContent: () => /* @__PURE__ */
|
|
21386
|
+
renderContent: () => /* @__PURE__ */ jsx95(dropdown_content_wrapper_default, { paddingSize: "none", children: /* @__PURE__ */ jsx95(
|
|
21397
21387
|
LegacyAdapter,
|
|
21398
21388
|
{
|
|
21399
21389
|
color: validColor,
|
|
@@ -21426,7 +21416,7 @@ function Color({
|
|
|
21426
21416
|
},
|
|
21427
21417
|
[data, onChange, setValue]
|
|
21428
21418
|
);
|
|
21429
|
-
return /* @__PURE__ */
|
|
21419
|
+
return /* @__PURE__ */ jsx95(
|
|
21430
21420
|
ValidatedInputControl4,
|
|
21431
21421
|
{
|
|
21432
21422
|
required: !!field.isValid?.required,
|
|
@@ -21439,7 +21429,7 @@ function Color({
|
|
|
21439
21429
|
onChange: handleInputChange,
|
|
21440
21430
|
hideLabelFromVision,
|
|
21441
21431
|
type: "text",
|
|
21442
|
-
prefix: /* @__PURE__ */
|
|
21432
|
+
prefix: /* @__PURE__ */ jsx95(input_prefix_wrapper_default, { variant: "control", children: /* @__PURE__ */ jsx95(
|
|
21443
21433
|
ColorPickerDropdown,
|
|
21444
21434
|
{
|
|
21445
21435
|
color: value,
|
|
@@ -21452,7 +21442,7 @@ function Color({
|
|
|
21452
21442
|
|
|
21453
21443
|
// src/components/dataform-controls/password.tsx
|
|
21454
21444
|
import { __ as __51 } from "@wordpress/i18n";
|
|
21455
|
-
import { jsx as
|
|
21445
|
+
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
21456
21446
|
function Password({
|
|
21457
21447
|
data,
|
|
21458
21448
|
field,
|
|
@@ -21465,7 +21455,7 @@ function Password({
|
|
|
21465
21455
|
const toggleVisibility = useCallback(() => {
|
|
21466
21456
|
setIsVisible((prev) => !prev);
|
|
21467
21457
|
}, []);
|
|
21468
|
-
return /* @__PURE__ */
|
|
21458
|
+
return /* @__PURE__ */ jsx96(
|
|
21469
21459
|
ValidatedText,
|
|
21470
21460
|
{
|
|
21471
21461
|
...{
|
|
@@ -21476,7 +21466,7 @@ function Password({
|
|
|
21476
21466
|
markWhenOptional,
|
|
21477
21467
|
validity,
|
|
21478
21468
|
type: isVisible2 ? "text" : "password",
|
|
21479
|
-
suffix: /* @__PURE__ */
|
|
21469
|
+
suffix: /* @__PURE__ */ jsx96(input_suffix_wrapper_default, { variant: "control", children: /* @__PURE__ */ jsx96(
|
|
21480
21470
|
button_default,
|
|
21481
21471
|
{
|
|
21482
21472
|
icon: isVisible2 ? unseen_default : seen_default,
|
|
@@ -21496,7 +21486,7 @@ function hasElements(field) {
|
|
|
21496
21486
|
}
|
|
21497
21487
|
|
|
21498
21488
|
// src/components/dataform-controls/index.tsx
|
|
21499
|
-
import { jsx as
|
|
21489
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
21500
21490
|
var FORM_CONTROLS = {
|
|
21501
21491
|
adaptiveSelect: AdaptiveSelect,
|
|
21502
21492
|
array: ArrayControl,
|
|
@@ -21528,7 +21518,7 @@ function createConfiguredControl(config) {
|
|
|
21528
21518
|
return null;
|
|
21529
21519
|
}
|
|
21530
21520
|
return function ConfiguredControl(props) {
|
|
21531
|
-
return /* @__PURE__ */
|
|
21521
|
+
return /* @__PURE__ */ jsx97(BaseControlType, { ...props, config: controlConfig });
|
|
21532
21522
|
};
|
|
21533
21523
|
}
|
|
21534
21524
|
function getControl(field, fallback) {
|
|
@@ -21626,13 +21616,13 @@ function RenderFromElements({
|
|
|
21626
21616
|
}
|
|
21627
21617
|
|
|
21628
21618
|
// src/field-types/utils/render-default.tsx
|
|
21629
|
-
import { jsx as
|
|
21619
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
21630
21620
|
function render2({
|
|
21631
21621
|
item: item2,
|
|
21632
21622
|
field
|
|
21633
21623
|
}) {
|
|
21634
21624
|
if (field.hasElements) {
|
|
21635
|
-
return /* @__PURE__ */
|
|
21625
|
+
return /* @__PURE__ */ jsx98(RenderFromElements, { item: item2, field });
|
|
21636
21626
|
}
|
|
21637
21627
|
return field.getValueFormatted({ item: item2, field });
|
|
21638
21628
|
}
|
|
@@ -21783,7 +21773,7 @@ function isValidMax(item2, field) {
|
|
|
21783
21773
|
}
|
|
21784
21774
|
|
|
21785
21775
|
// src/field-types/integer.tsx
|
|
21786
|
-
var
|
|
21776
|
+
var format2 = {
|
|
21787
21777
|
separatorThousand: ","
|
|
21788
21778
|
};
|
|
21789
21779
|
function getValueFormatted2({
|
|
@@ -21800,7 +21790,7 @@ function getValueFormatted2({
|
|
|
21800
21790
|
}
|
|
21801
21791
|
let formatInteger;
|
|
21802
21792
|
if (field.type !== "integer") {
|
|
21803
|
-
formatInteger =
|
|
21793
|
+
formatInteger = format2;
|
|
21804
21794
|
} else {
|
|
21805
21795
|
formatInteger = field.format;
|
|
21806
21796
|
}
|
|
@@ -21852,7 +21842,7 @@ var integer_default = {
|
|
|
21852
21842
|
OPERATOR_IS_ALL,
|
|
21853
21843
|
OPERATOR_IS_NOT_ALL
|
|
21854
21844
|
],
|
|
21855
|
-
format:
|
|
21845
|
+
format: format2,
|
|
21856
21846
|
getValueFormatted: getValueFormatted2,
|
|
21857
21847
|
validate: {
|
|
21858
21848
|
required: isValidRequired,
|
|
@@ -21865,7 +21855,7 @@ var integer_default = {
|
|
|
21865
21855
|
|
|
21866
21856
|
// src/field-types/number.tsx
|
|
21867
21857
|
import { __ as __54 } from "@wordpress/i18n";
|
|
21868
|
-
var
|
|
21858
|
+
var format3 = {
|
|
21869
21859
|
separatorThousand: ",",
|
|
21870
21860
|
separatorDecimal: ".",
|
|
21871
21861
|
decimals: 2
|
|
@@ -21884,7 +21874,7 @@ function getValueFormatted3({
|
|
|
21884
21874
|
}
|
|
21885
21875
|
let formatNumber;
|
|
21886
21876
|
if (field.type !== "number") {
|
|
21887
|
-
formatNumber =
|
|
21877
|
+
formatNumber = format3;
|
|
21888
21878
|
} else {
|
|
21889
21879
|
formatNumber = field.format;
|
|
21890
21880
|
}
|
|
@@ -21935,7 +21925,7 @@ var number_default = {
|
|
|
21935
21925
|
OPERATOR_IS_ALL,
|
|
21936
21926
|
OPERATOR_IS_NOT_ALL
|
|
21937
21927
|
],
|
|
21938
|
-
format:
|
|
21928
|
+
format: format3,
|
|
21939
21929
|
getValueFormatted: getValueFormatted3,
|
|
21940
21930
|
validate: {
|
|
21941
21931
|
required: isValidRequired,
|
|
@@ -21980,8 +21970,8 @@ var text_default = {
|
|
|
21980
21970
|
};
|
|
21981
21971
|
|
|
21982
21972
|
// src/field-types/datetime.tsx
|
|
21983
|
-
import { dateI18n, getDate as
|
|
21984
|
-
var
|
|
21973
|
+
import { dateI18n as dateI18n2, getDate as getDate5, getSettings as getSettings3 } from "@wordpress/date";
|
|
21974
|
+
var format4 = {
|
|
21985
21975
|
datetime: getSettings3().formats.datetime,
|
|
21986
21976
|
weekStartsOn: getSettings3().l10n.startOfWeek
|
|
21987
21977
|
};
|
|
@@ -21995,11 +21985,11 @@ function getValueFormatted4({
|
|
|
21995
21985
|
}
|
|
21996
21986
|
let formatDatetime;
|
|
21997
21987
|
if (field.type !== "datetime") {
|
|
21998
|
-
formatDatetime =
|
|
21988
|
+
formatDatetime = format4;
|
|
21999
21989
|
} else {
|
|
22000
21990
|
formatDatetime = field.format;
|
|
22001
21991
|
}
|
|
22002
|
-
return
|
|
21992
|
+
return dateI18n2(formatDatetime.datetime, getDate5(value));
|
|
22003
21993
|
}
|
|
22004
21994
|
var sort = (a, b, direction) => {
|
|
22005
21995
|
const timeA = new Date(a).getTime();
|
|
@@ -22033,7 +22023,7 @@ var datetime_default = {
|
|
|
22033
22023
|
OPERATOR_IN_THE_PAST,
|
|
22034
22024
|
OPERATOR_OVER
|
|
22035
22025
|
],
|
|
22036
|
-
format:
|
|
22026
|
+
format: format4,
|
|
22037
22027
|
getValueFormatted: getValueFormatted4,
|
|
22038
22028
|
validate: {
|
|
22039
22029
|
required: isValidRequired,
|
|
@@ -22042,8 +22032,8 @@ var datetime_default = {
|
|
|
22042
22032
|
};
|
|
22043
22033
|
|
|
22044
22034
|
// src/field-types/date.tsx
|
|
22045
|
-
import { dateI18n as
|
|
22046
|
-
var
|
|
22035
|
+
import { dateI18n as dateI18n3, getDate as getDate6, getSettings as getSettings4 } from "@wordpress/date";
|
|
22036
|
+
var format5 = {
|
|
22047
22037
|
date: getSettings4().formats.date,
|
|
22048
22038
|
weekStartsOn: getSettings4().l10n.startOfWeek
|
|
22049
22039
|
};
|
|
@@ -22057,11 +22047,11 @@ function getValueFormatted5({
|
|
|
22057
22047
|
}
|
|
22058
22048
|
let formatDate2;
|
|
22059
22049
|
if (field.type !== "date") {
|
|
22060
|
-
formatDate2 =
|
|
22050
|
+
formatDate2 = format5;
|
|
22061
22051
|
} else {
|
|
22062
22052
|
formatDate2 = field.format;
|
|
22063
22053
|
}
|
|
22064
|
-
return
|
|
22054
|
+
return dateI18n3(formatDate2.date, getDate6(value));
|
|
22065
22055
|
}
|
|
22066
22056
|
var sort2 = (a, b, direction) => {
|
|
22067
22057
|
const timeA = new Date(a).getTime();
|
|
@@ -22097,7 +22087,7 @@ var date_default = {
|
|
|
22097
22087
|
OPERATOR_OVER,
|
|
22098
22088
|
OPERATOR_BETWEEN
|
|
22099
22089
|
],
|
|
22100
|
-
format:
|
|
22090
|
+
format: format5,
|
|
22101
22091
|
getValueFormatted: getValueFormatted5,
|
|
22102
22092
|
validate: {
|
|
22103
22093
|
required: isValidRequired,
|
|
@@ -22311,17 +22301,17 @@ var telephone_default = {
|
|
|
22311
22301
|
// src/field-types/color.tsx
|
|
22312
22302
|
import { colord as colord8 } from "colord";
|
|
22313
22303
|
import { __ as __57 } from "@wordpress/i18n";
|
|
22314
|
-
import { jsx as
|
|
22304
|
+
import { jsx as jsx99, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
22315
22305
|
function render4({ item: item2, field }) {
|
|
22316
22306
|
if (field.hasElements) {
|
|
22317
|
-
return /* @__PURE__ */
|
|
22307
|
+
return /* @__PURE__ */ jsx99(RenderFromElements, { item: item2, field });
|
|
22318
22308
|
}
|
|
22319
22309
|
const value = get_value_formatted_default_default({ item: item2, field });
|
|
22320
22310
|
if (!value || !colord8(value).isValid()) {
|
|
22321
22311
|
return value;
|
|
22322
22312
|
}
|
|
22323
|
-
return /* @__PURE__ */
|
|
22324
|
-
/* @__PURE__ */
|
|
22313
|
+
return /* @__PURE__ */ jsxs29("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
22314
|
+
/* @__PURE__ */ jsx99(
|
|
22325
22315
|
"div",
|
|
22326
22316
|
{
|
|
22327
22317
|
style: {
|
|
@@ -22334,7 +22324,7 @@ function render4({ item: item2, field }) {
|
|
|
22334
22324
|
}
|
|
22335
22325
|
}
|
|
22336
22326
|
),
|
|
22337
|
-
/* @__PURE__ */
|
|
22327
|
+
/* @__PURE__ */ jsx99("span", { children: value })
|
|
22338
22328
|
] });
|
|
22339
22329
|
}
|
|
22340
22330
|
function isValidCustom6(item2, field) {
|
|
@@ -22617,7 +22607,7 @@ function useData(data, isLoading, paginationInfo) {
|
|
|
22617
22607
|
}
|
|
22618
22608
|
|
|
22619
22609
|
// src/dataviews/index.tsx
|
|
22620
|
-
import { Fragment as
|
|
22610
|
+
import { Fragment as Fragment14, jsx as jsx100, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
22621
22611
|
var defaultGetItemId = (item2) => item2.id;
|
|
22622
22612
|
var defaultIsItemClickable = () => true;
|
|
22623
22613
|
var EMPTY_ARRAY6 = [];
|
|
@@ -22629,8 +22619,8 @@ function DefaultUI({
|
|
|
22629
22619
|
search = true,
|
|
22630
22620
|
searchLabel = void 0
|
|
22631
22621
|
}) {
|
|
22632
|
-
return /* @__PURE__ */
|
|
22633
|
-
/* @__PURE__ */
|
|
22622
|
+
return /* @__PURE__ */ jsxs30(Fragment14, { children: [
|
|
22623
|
+
/* @__PURE__ */ jsxs30(
|
|
22634
22624
|
Stack,
|
|
22635
22625
|
{
|
|
22636
22626
|
direction: "row",
|
|
@@ -22639,7 +22629,7 @@ function DefaultUI({
|
|
|
22639
22629
|
className: "dataviews__view-actions",
|
|
22640
22630
|
gap: "xs",
|
|
22641
22631
|
children: [
|
|
22642
|
-
/* @__PURE__ */
|
|
22632
|
+
/* @__PURE__ */ jsxs30(
|
|
22643
22633
|
Stack,
|
|
22644
22634
|
{
|
|
22645
22635
|
direction: "row",
|
|
@@ -22647,21 +22637,21 @@ function DefaultUI({
|
|
|
22647
22637
|
gap: "sm",
|
|
22648
22638
|
className: "dataviews__search",
|
|
22649
22639
|
children: [
|
|
22650
|
-
search && /* @__PURE__ */
|
|
22651
|
-
/* @__PURE__ */
|
|
22640
|
+
search && /* @__PURE__ */ jsx100(dataviews_search_default, { label: searchLabel }),
|
|
22641
|
+
/* @__PURE__ */ jsx100(toggle_default, {})
|
|
22652
22642
|
]
|
|
22653
22643
|
}
|
|
22654
22644
|
),
|
|
22655
|
-
/* @__PURE__ */
|
|
22656
|
-
/* @__PURE__ */
|
|
22645
|
+
/* @__PURE__ */ jsxs30(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: [
|
|
22646
|
+
/* @__PURE__ */ jsx100(dataviews_view_config_default, {}),
|
|
22657
22647
|
header
|
|
22658
22648
|
] })
|
|
22659
22649
|
]
|
|
22660
22650
|
}
|
|
22661
22651
|
),
|
|
22662
|
-
/* @__PURE__ */
|
|
22663
|
-
/* @__PURE__ */
|
|
22664
|
-
/* @__PURE__ */
|
|
22652
|
+
/* @__PURE__ */ jsx100(filters_toggled_default, { className: "dataviews-filters__container" }),
|
|
22653
|
+
/* @__PURE__ */ jsx100(DataViewsLayout, {}),
|
|
22654
|
+
/* @__PURE__ */ jsx100(DataViewsFooter, {})
|
|
22665
22655
|
] });
|
|
22666
22656
|
}
|
|
22667
22657
|
function DataViews({
|
|
@@ -22733,8 +22723,13 @@ function DataViews({
|
|
|
22733
22723
|
setIsShowingFilter(true);
|
|
22734
22724
|
}
|
|
22735
22725
|
}, [hasPrimaryOrLockedFilters, isShowingFilter]);
|
|
22726
|
+
const {
|
|
22727
|
+
data: displayData,
|
|
22728
|
+
paginationInfo: displayPaginationInfo,
|
|
22729
|
+
hasInitiallyLoaded
|
|
22730
|
+
} = useData(data, isLoading, paginationInfo);
|
|
22736
22731
|
useEffect(() => {
|
|
22737
|
-
if (!view.infiniteScrollEnabled || !containerRef.current) {
|
|
22732
|
+
if (!hasInitiallyLoaded || !view.infiniteScrollEnabled || !containerRef.current) {
|
|
22738
22733
|
return;
|
|
22739
22734
|
}
|
|
22740
22735
|
const handleScroll = throttle((event) => {
|
|
@@ -22752,7 +22747,11 @@ function DataViews({
|
|
|
22752
22747
|
container.removeEventListener("scroll", handleScroll);
|
|
22753
22748
|
handleScroll.cancel();
|
|
22754
22749
|
};
|
|
22755
|
-
}, [
|
|
22750
|
+
}, [
|
|
22751
|
+
hasInitiallyLoaded,
|
|
22752
|
+
infiniteScrollHandler,
|
|
22753
|
+
view.infiniteScrollEnabled
|
|
22754
|
+
]);
|
|
22756
22755
|
const defaultLayouts = useMemo(
|
|
22757
22756
|
() => Object.fromEntries(
|
|
22758
22757
|
Object.entries(defaultLayoutsProperty).filter(
|
|
@@ -22765,15 +22764,10 @@ function DataViews({
|
|
|
22765
22764
|
),
|
|
22766
22765
|
[defaultLayoutsProperty]
|
|
22767
22766
|
);
|
|
22768
|
-
const {
|
|
22769
|
-
data: displayData,
|
|
22770
|
-
paginationInfo: displayPaginationInfo,
|
|
22771
|
-
hasInitiallyLoaded
|
|
22772
|
-
} = useData(data, isLoading, paginationInfo);
|
|
22773
22767
|
if (!defaultLayouts[view.type]) {
|
|
22774
22768
|
return null;
|
|
22775
22769
|
}
|
|
22776
|
-
return /* @__PURE__ */
|
|
22770
|
+
return /* @__PURE__ */ jsx100(
|
|
22777
22771
|
dataviews_context_default.Provider,
|
|
22778
22772
|
{
|
|
22779
22773
|
value: {
|
|
@@ -22806,7 +22800,7 @@ function DataViews({
|
|
|
22806
22800
|
hasInfiniteScrollHandler: !!infiniteScrollHandler,
|
|
22807
22801
|
onReset
|
|
22808
22802
|
},
|
|
22809
|
-
children: /* @__PURE__ */
|
|
22803
|
+
children: /* @__PURE__ */ jsx100("div", { className: "dataviews-wrapper", children: children ?? /* @__PURE__ */ jsx100(
|
|
22810
22804
|
DefaultUI,
|
|
22811
22805
|
{
|
|
22812
22806
|
header,
|
|
@@ -22831,7 +22825,7 @@ DataViewsSubComponents.Footer = DataViewsFooter;
|
|
|
22831
22825
|
var dataviews_default = DataViewsSubComponents;
|
|
22832
22826
|
|
|
22833
22827
|
// src/dataviews-picker/index.tsx
|
|
22834
|
-
import { Fragment as
|
|
22828
|
+
import { Fragment as Fragment15, jsx as jsx101, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
22835
22829
|
var isItemClickable = () => false;
|
|
22836
22830
|
var dataViewsPickerLayouts = VIEW_LAYOUTS.filter(
|
|
22837
22831
|
(viewLayout) => viewLayout.isPicker
|
|
@@ -22842,8 +22836,8 @@ function DefaultUI2({
|
|
|
22842
22836
|
search = true,
|
|
22843
22837
|
searchLabel = void 0
|
|
22844
22838
|
}) {
|
|
22845
|
-
return /* @__PURE__ */
|
|
22846
|
-
/* @__PURE__ */
|
|
22839
|
+
return /* @__PURE__ */ jsxs31(Fragment15, { children: [
|
|
22840
|
+
/* @__PURE__ */ jsxs31(
|
|
22847
22841
|
Stack,
|
|
22848
22842
|
{
|
|
22849
22843
|
direction: "row",
|
|
@@ -22852,7 +22846,7 @@ function DefaultUI2({
|
|
|
22852
22846
|
className: "dataviews__view-actions",
|
|
22853
22847
|
gap: "xs",
|
|
22854
22848
|
children: [
|
|
22855
|
-
/* @__PURE__ */
|
|
22849
|
+
/* @__PURE__ */ jsxs31(
|
|
22856
22850
|
Stack,
|
|
22857
22851
|
{
|
|
22858
22852
|
direction: "row",
|
|
@@ -22860,18 +22854,18 @@ function DefaultUI2({
|
|
|
22860
22854
|
justify: "start",
|
|
22861
22855
|
className: "dataviews__search",
|
|
22862
22856
|
children: [
|
|
22863
|
-
search && /* @__PURE__ */
|
|
22864
|
-
/* @__PURE__ */
|
|
22857
|
+
search && /* @__PURE__ */ jsx101(dataviews_search_default, { label: searchLabel }),
|
|
22858
|
+
/* @__PURE__ */ jsx101(toggle_default, {})
|
|
22865
22859
|
]
|
|
22866
22860
|
}
|
|
22867
22861
|
),
|
|
22868
|
-
/* @__PURE__ */
|
|
22862
|
+
/* @__PURE__ */ jsx101(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx101(dataviews_view_config_default, {}) })
|
|
22869
22863
|
]
|
|
22870
22864
|
}
|
|
22871
22865
|
),
|
|
22872
|
-
/* @__PURE__ */
|
|
22873
|
-
/* @__PURE__ */
|
|
22874
|
-
/* @__PURE__ */
|
|
22866
|
+
/* @__PURE__ */ jsx101(filters_toggled_default, { className: "dataviews-filters__container" }),
|
|
22867
|
+
/* @__PURE__ */ jsx101(DataViewsLayout, {}),
|
|
22868
|
+
/* @__PURE__ */ jsx101(DataViewsPickerFooter, {})
|
|
22875
22869
|
] });
|
|
22876
22870
|
}
|
|
22877
22871
|
function DataViewsPicker({
|
|
@@ -22962,7 +22956,7 @@ function DataViewsPicker({
|
|
|
22962
22956
|
if (!defaultLayouts[view.type]) {
|
|
22963
22957
|
return null;
|
|
22964
22958
|
}
|
|
22965
|
-
return /* @__PURE__ */
|
|
22959
|
+
return /* @__PURE__ */ jsx101(
|
|
22966
22960
|
dataviews_context_default.Provider,
|
|
22967
22961
|
{
|
|
22968
22962
|
value: {
|
|
@@ -22992,7 +22986,7 @@ function DataViewsPicker({
|
|
|
22992
22986
|
hasInitiallyLoaded: true,
|
|
22993
22987
|
hasInfiniteScrollHandler: !!infiniteScrollHandler
|
|
22994
22988
|
},
|
|
22995
|
-
children: /* @__PURE__ */
|
|
22989
|
+
children: /* @__PURE__ */ jsx101("div", { className: "dataviews-picker-wrapper", children: children ?? /* @__PURE__ */ jsx101(DefaultUI2, { search, searchLabel }) })
|
|
22996
22990
|
}
|
|
22997
22991
|
);
|
|
22998
22992
|
}
|
|
@@ -23009,7 +23003,7 @@ DataViewsPickerSubComponents.ViewConfig = DataviewsViewConfigDropdown;
|
|
|
23009
23003
|
var dataviews_picker_default = DataViewsPickerSubComponents;
|
|
23010
23004
|
|
|
23011
23005
|
// src/components/dataform-context/index.tsx
|
|
23012
|
-
import { jsx as
|
|
23006
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
23013
23007
|
var DataFormContext = createContext({
|
|
23014
23008
|
fields: []
|
|
23015
23009
|
});
|
|
@@ -23018,14 +23012,15 @@ function DataFormProvider({
|
|
|
23018
23012
|
fields,
|
|
23019
23013
|
children
|
|
23020
23014
|
}) {
|
|
23021
|
-
return /* @__PURE__ */
|
|
23015
|
+
return /* @__PURE__ */ jsx102(DataFormContext.Provider, { value: { fields }, children });
|
|
23022
23016
|
}
|
|
23023
23017
|
var dataform_context_default = DataFormContext;
|
|
23024
23018
|
|
|
23025
23019
|
// src/components/dataform-layouts/regular/index.tsx
|
|
23026
|
-
import
|
|
23020
|
+
import clsx46 from "clsx";
|
|
23027
23021
|
|
|
23028
23022
|
// src/components/dataform-layouts/normalize-form.ts
|
|
23023
|
+
import { __ as __58 } from "@wordpress/i18n";
|
|
23029
23024
|
var DEFAULT_LAYOUT = {
|
|
23030
23025
|
type: "regular",
|
|
23031
23026
|
labelPosition: "top"
|
|
@@ -23051,10 +23046,27 @@ function normalizeLayout(layout) {
|
|
|
23051
23046
|
} else if (layout?.type === "panel") {
|
|
23052
23047
|
const summary = layout.summary ?? [];
|
|
23053
23048
|
const normalizedSummary = Array.isArray(summary) ? summary : [summary];
|
|
23049
|
+
const openAs = layout?.openAs;
|
|
23050
|
+
let normalizedOpenAs;
|
|
23051
|
+
if (typeof openAs === "object" && openAs.type === "modal") {
|
|
23052
|
+
normalizedOpenAs = {
|
|
23053
|
+
type: "modal",
|
|
23054
|
+
applyLabel: openAs.applyLabel?.trim() || __58("Apply"),
|
|
23055
|
+
cancelLabel: openAs.cancelLabel?.trim() || __58("Cancel")
|
|
23056
|
+
};
|
|
23057
|
+
} else if (openAs === "modal") {
|
|
23058
|
+
normalizedOpenAs = {
|
|
23059
|
+
type: "modal",
|
|
23060
|
+
applyLabel: __58("Apply"),
|
|
23061
|
+
cancelLabel: __58("Cancel")
|
|
23062
|
+
};
|
|
23063
|
+
} else {
|
|
23064
|
+
normalizedOpenAs = { type: "dropdown" };
|
|
23065
|
+
}
|
|
23054
23066
|
normalizedLayout = {
|
|
23055
23067
|
type: "panel",
|
|
23056
23068
|
labelPosition: layout?.labelPosition ?? "side",
|
|
23057
|
-
openAs:
|
|
23069
|
+
openAs: normalizedOpenAs,
|
|
23058
23070
|
summary: normalizedSummary,
|
|
23059
23071
|
editVisibility: layout?.editVisibility ?? "on-hover"
|
|
23060
23072
|
};
|
|
@@ -23126,15 +23138,15 @@ function normalizeForm(form) {
|
|
|
23126
23138
|
var normalize_form_default = normalizeForm;
|
|
23127
23139
|
|
|
23128
23140
|
// src/components/dataform-layouts/regular/index.tsx
|
|
23129
|
-
import { Fragment as
|
|
23141
|
+
import { Fragment as Fragment16, jsx as jsx103, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
23130
23142
|
function Header2({ title }) {
|
|
23131
|
-
return /* @__PURE__ */
|
|
23143
|
+
return /* @__PURE__ */ jsx103(
|
|
23132
23144
|
Stack,
|
|
23133
23145
|
{
|
|
23134
23146
|
direction: "column",
|
|
23135
23147
|
className: "dataforms-layouts-regular__header",
|
|
23136
23148
|
gap: "lg",
|
|
23137
|
-
children: /* @__PURE__ */
|
|
23149
|
+
children: /* @__PURE__ */ jsx103(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ jsx103(component_default16, { level: 2, size: 13, children: title }) })
|
|
23138
23150
|
}
|
|
23139
23151
|
);
|
|
23140
23152
|
}
|
|
@@ -23156,9 +23168,9 @@ function FormRegularField({
|
|
|
23156
23168
|
[field]
|
|
23157
23169
|
);
|
|
23158
23170
|
if (!!field.children) {
|
|
23159
|
-
return /* @__PURE__ */
|
|
23160
|
-
!hideLabelFromVision && field.label && /* @__PURE__ */
|
|
23161
|
-
/* @__PURE__ */
|
|
23171
|
+
return /* @__PURE__ */ jsxs32(Fragment16, { children: [
|
|
23172
|
+
!hideLabelFromVision && field.label && /* @__PURE__ */ jsx103(Header2, { title: field.label }),
|
|
23173
|
+
/* @__PURE__ */ jsx103(
|
|
23162
23174
|
DataFormLayout,
|
|
23163
23175
|
{
|
|
23164
23176
|
data,
|
|
@@ -23177,30 +23189,30 @@ function FormRegularField({
|
|
|
23177
23189
|
return null;
|
|
23178
23190
|
}
|
|
23179
23191
|
if (labelPosition === "side") {
|
|
23180
|
-
return /* @__PURE__ */
|
|
23192
|
+
return /* @__PURE__ */ jsxs32(
|
|
23181
23193
|
Stack,
|
|
23182
23194
|
{
|
|
23183
23195
|
direction: "row",
|
|
23184
23196
|
className: "dataforms-layouts-regular__field",
|
|
23185
23197
|
gap: "sm",
|
|
23186
23198
|
children: [
|
|
23187
|
-
/* @__PURE__ */
|
|
23199
|
+
/* @__PURE__ */ jsx103(
|
|
23188
23200
|
"div",
|
|
23189
23201
|
{
|
|
23190
|
-
className:
|
|
23202
|
+
className: clsx46(
|
|
23191
23203
|
"dataforms-layouts-regular__field-label",
|
|
23192
23204
|
`dataforms-layouts-regular__field-label--label-position-${labelPosition}`
|
|
23193
23205
|
),
|
|
23194
|
-
children: /* @__PURE__ */
|
|
23206
|
+
children: /* @__PURE__ */ jsx103(base_control_default.VisualLabel, { children: fieldDefinition.label })
|
|
23195
23207
|
}
|
|
23196
23208
|
),
|
|
23197
|
-
/* @__PURE__ */
|
|
23209
|
+
/* @__PURE__ */ jsx103("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ jsx103(
|
|
23198
23210
|
fieldDefinition.render,
|
|
23199
23211
|
{
|
|
23200
23212
|
item: data,
|
|
23201
23213
|
field: fieldDefinition
|
|
23202
23214
|
}
|
|
23203
|
-
) : /* @__PURE__ */
|
|
23215
|
+
) : /* @__PURE__ */ jsx103(
|
|
23204
23216
|
fieldDefinition.Edit,
|
|
23205
23217
|
{
|
|
23206
23218
|
data,
|
|
@@ -23216,16 +23228,16 @@ function FormRegularField({
|
|
|
23216
23228
|
}
|
|
23217
23229
|
);
|
|
23218
23230
|
}
|
|
23219
|
-
return /* @__PURE__ */
|
|
23220
|
-
!hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */
|
|
23221
|
-
/* @__PURE__ */
|
|
23231
|
+
return /* @__PURE__ */ jsx103("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ jsx103(Fragment16, { children: /* @__PURE__ */ jsxs32(Fragment16, { children: [
|
|
23232
|
+
!hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ jsx103(base_control_default.VisualLabel, { children: fieldDefinition.label }),
|
|
23233
|
+
/* @__PURE__ */ jsx103(
|
|
23222
23234
|
fieldDefinition.render,
|
|
23223
23235
|
{
|
|
23224
23236
|
item: data,
|
|
23225
23237
|
field: fieldDefinition
|
|
23226
23238
|
}
|
|
23227
23239
|
)
|
|
23228
|
-
] }) }) : /* @__PURE__ */
|
|
23240
|
+
] }) }) : /* @__PURE__ */ jsx103(
|
|
23229
23241
|
fieldDefinition.Edit,
|
|
23230
23242
|
{
|
|
23231
23243
|
data,
|
|
@@ -23240,16 +23252,15 @@ function FormRegularField({
|
|
|
23240
23252
|
|
|
23241
23253
|
// src/components/dataform-layouts/panel/modal.tsx
|
|
23242
23254
|
import deepMerge2 from "deepmerge";
|
|
23243
|
-
import { __ as __59 } from "@wordpress/i18n";
|
|
23244
23255
|
|
|
23245
23256
|
// src/components/dataform-layouts/panel/summary-button.tsx
|
|
23246
|
-
import
|
|
23257
|
+
import clsx48 from "clsx";
|
|
23247
23258
|
import { sprintf as sprintf17, _x as _x5 } from "@wordpress/i18n";
|
|
23248
23259
|
|
|
23249
23260
|
// src/components/dataform-layouts/panel/utils/get-label-classname.ts
|
|
23250
|
-
import
|
|
23261
|
+
import clsx47 from "clsx";
|
|
23251
23262
|
function getLabelClassName(labelPosition, showError) {
|
|
23252
|
-
return
|
|
23263
|
+
return clsx47(
|
|
23253
23264
|
"dataforms-layouts-panel__field-label",
|
|
23254
23265
|
`dataforms-layouts-panel__field-label--label-position-${labelPosition}`,
|
|
23255
23266
|
{ "has-error": showError }
|
|
@@ -23258,10 +23269,10 @@ function getLabelClassName(labelPosition, showError) {
|
|
|
23258
23269
|
var get_label_classname_default = getLabelClassName;
|
|
23259
23270
|
|
|
23260
23271
|
// src/components/dataform-layouts/panel/utils/get-label-content.tsx
|
|
23261
|
-
import { jsx as
|
|
23272
|
+
import { jsx as jsx104, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
23262
23273
|
function getLabelContent(showError, errorMessage, fieldLabel) {
|
|
23263
|
-
return showError ? /* @__PURE__ */
|
|
23264
|
-
/* @__PURE__ */
|
|
23274
|
+
return showError ? /* @__PURE__ */ jsx104(tooltip_default, { text: errorMessage, placement: "top", children: /* @__PURE__ */ jsxs33("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [
|
|
23275
|
+
/* @__PURE__ */ jsx104(icon_default2, { icon: error_default, size: 16 }),
|
|
23265
23276
|
fieldLabel
|
|
23266
23277
|
] }) }) : fieldLabel;
|
|
23267
23278
|
}
|
|
@@ -23303,7 +23314,7 @@ function getFirstValidationError(validity) {
|
|
|
23303
23314
|
var get_first_validation_error_default = getFirstValidationError;
|
|
23304
23315
|
|
|
23305
23316
|
// src/components/dataform-layouts/panel/summary-button.tsx
|
|
23306
|
-
import { jsx as
|
|
23317
|
+
import { jsx as jsx105, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
23307
23318
|
function SummaryButton({
|
|
23308
23319
|
data,
|
|
23309
23320
|
field,
|
|
@@ -23320,7 +23331,7 @@ function SummaryButton({
|
|
|
23320
23331
|
const showError = touched && !!errorMessage;
|
|
23321
23332
|
const labelClassName = get_label_classname_default(labelPosition, showError);
|
|
23322
23333
|
const labelContent = get_label_content_default(showError, errorMessage, fieldLabel);
|
|
23323
|
-
const className2 =
|
|
23334
|
+
const className2 = clsx48(
|
|
23324
23335
|
"dataforms-layouts-panel__field-trigger",
|
|
23325
23336
|
`dataforms-layouts-panel__field-trigger--label-${labelPosition}`,
|
|
23326
23337
|
{
|
|
@@ -23355,7 +23366,7 @@ function SummaryButton({
|
|
|
23355
23366
|
onClick();
|
|
23356
23367
|
}
|
|
23357
23368
|
};
|
|
23358
|
-
return /* @__PURE__ */
|
|
23369
|
+
return /* @__PURE__ */ jsxs34(
|
|
23359
23370
|
"div",
|
|
23360
23371
|
{
|
|
23361
23372
|
ref: rowRef,
|
|
@@ -23363,14 +23374,14 @@ function SummaryButton({
|
|
|
23363
23374
|
onClick: !disabled ? handleRowClick : void 0,
|
|
23364
23375
|
onKeyDown: !disabled ? handleKeyDown : void 0,
|
|
23365
23376
|
children: [
|
|
23366
|
-
labelPosition !== "none" && /* @__PURE__ */
|
|
23367
|
-
labelPosition === "none" && showError && /* @__PURE__ */
|
|
23368
|
-
/* @__PURE__ */
|
|
23377
|
+
labelPosition !== "none" && /* @__PURE__ */ jsx105("span", { className: labelClassName, children: labelContent }),
|
|
23378
|
+
labelPosition === "none" && showError && /* @__PURE__ */ jsx105(tooltip_default, { text: errorMessage, placement: "top", children: /* @__PURE__ */ jsx105("span", { className: "dataforms-layouts-panel__field-label-error-content", children: /* @__PURE__ */ jsx105(icon_default2, { icon: error_default, size: 16 }) }) }),
|
|
23379
|
+
/* @__PURE__ */ jsx105(
|
|
23369
23380
|
"span",
|
|
23370
23381
|
{
|
|
23371
23382
|
id: `${controlId}`,
|
|
23372
23383
|
className: "dataforms-layouts-panel__field-control",
|
|
23373
|
-
children: summaryFields.length > 1 ? /* @__PURE__ */
|
|
23384
|
+
children: summaryFields.length > 1 ? /* @__PURE__ */ jsx105(
|
|
23374
23385
|
"span",
|
|
23375
23386
|
{
|
|
23376
23387
|
style: {
|
|
@@ -23380,11 +23391,11 @@ function SummaryButton({
|
|
|
23380
23391
|
width: "100%",
|
|
23381
23392
|
gap: "2px"
|
|
23382
23393
|
},
|
|
23383
|
-
children: summaryFields.map((summaryField) => /* @__PURE__ */
|
|
23394
|
+
children: summaryFields.map((summaryField) => /* @__PURE__ */ jsx105(
|
|
23384
23395
|
"span",
|
|
23385
23396
|
{
|
|
23386
23397
|
style: { width: "100%" },
|
|
23387
|
-
children: /* @__PURE__ */
|
|
23398
|
+
children: /* @__PURE__ */ jsx105(
|
|
23388
23399
|
summaryField.render,
|
|
23389
23400
|
{
|
|
23390
23401
|
item: data,
|
|
@@ -23395,7 +23406,7 @@ function SummaryButton({
|
|
|
23395
23406
|
summaryField.id
|
|
23396
23407
|
))
|
|
23397
23408
|
}
|
|
23398
|
-
) : summaryFields.map((summaryField) => /* @__PURE__ */
|
|
23409
|
+
) : summaryFields.map((summaryField) => /* @__PURE__ */ jsx105(
|
|
23399
23410
|
summaryField.render,
|
|
23400
23411
|
{
|
|
23401
23412
|
item: data,
|
|
@@ -23405,7 +23416,7 @@ function SummaryButton({
|
|
|
23405
23416
|
))
|
|
23406
23417
|
}
|
|
23407
23418
|
),
|
|
23408
|
-
!disabled && /* @__PURE__ */
|
|
23419
|
+
!disabled && /* @__PURE__ */ jsx105(
|
|
23409
23420
|
button_default,
|
|
23410
23421
|
{
|
|
23411
23422
|
className: "dataforms-layouts-panel__field-trigger-icon",
|
|
@@ -23426,7 +23437,7 @@ function SummaryButton({
|
|
|
23426
23437
|
// src/hooks/use-form-validity.ts
|
|
23427
23438
|
import deepMerge from "deepmerge";
|
|
23428
23439
|
import fastDeepEqual3 from "fast-deep-equal/es6/index.js";
|
|
23429
|
-
import { __ as
|
|
23440
|
+
import { __ as __59 } from "@wordpress/i18n";
|
|
23430
23441
|
function isFormValid(formValidity) {
|
|
23431
23442
|
if (!formValidity) {
|
|
23432
23443
|
return true;
|
|
@@ -23556,7 +23567,7 @@ function handleElementsValidationAsync(promise, formField, promiseHandler) {
|
|
|
23556
23567
|
{
|
|
23557
23568
|
elements: {
|
|
23558
23569
|
type: "invalid",
|
|
23559
|
-
message:
|
|
23570
|
+
message: __59("Could not validate elements.")
|
|
23560
23571
|
}
|
|
23561
23572
|
},
|
|
23562
23573
|
[...path, formField.id]
|
|
@@ -23575,7 +23586,7 @@ function handleElementsValidationAsync(promise, formField, promiseHandler) {
|
|
|
23575
23586
|
{
|
|
23576
23587
|
elements: {
|
|
23577
23588
|
type: "invalid",
|
|
23578
|
-
message:
|
|
23589
|
+
message: __59(
|
|
23579
23590
|
"Value must be one of the elements."
|
|
23580
23591
|
)
|
|
23581
23592
|
}
|
|
@@ -23601,7 +23612,7 @@ function handleElementsValidationAsync(promise, formField, promiseHandler) {
|
|
|
23601
23612
|
if (error instanceof Error) {
|
|
23602
23613
|
errorMessage = error.message;
|
|
23603
23614
|
} else {
|
|
23604
|
-
errorMessage = String(error) ||
|
|
23615
|
+
errorMessage = String(error) || __59(
|
|
23605
23616
|
"Unknown error when running elements validation asynchronously."
|
|
23606
23617
|
);
|
|
23607
23618
|
}
|
|
@@ -23660,7 +23671,7 @@ function handleCustomValidationAsync(promise, formField, promiseHandler) {
|
|
|
23660
23671
|
{
|
|
23661
23672
|
custom: {
|
|
23662
23673
|
type: "invalid",
|
|
23663
|
-
message:
|
|
23674
|
+
message: __59("Validation could not be processed.")
|
|
23664
23675
|
}
|
|
23665
23676
|
},
|
|
23666
23677
|
[...path, formField.id]
|
|
@@ -23675,7 +23686,7 @@ function handleCustomValidationAsync(promise, formField, promiseHandler) {
|
|
|
23675
23686
|
if (error instanceof Error) {
|
|
23676
23687
|
errorMessage = error.message;
|
|
23677
23688
|
} else {
|
|
23678
|
-
errorMessage = String(error) ||
|
|
23689
|
+
errorMessage = String(error) || __59(
|
|
23679
23690
|
"Unknown error when running custom validation asynchronously."
|
|
23680
23691
|
);
|
|
23681
23692
|
}
|
|
@@ -23704,7 +23715,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23704
23715
|
return {
|
|
23705
23716
|
pattern: {
|
|
23706
23717
|
type: "invalid",
|
|
23707
|
-
message:
|
|
23718
|
+
message: __59("Value does not match the required pattern.")
|
|
23708
23719
|
}
|
|
23709
23720
|
};
|
|
23710
23721
|
}
|
|
@@ -23712,7 +23723,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23712
23723
|
return {
|
|
23713
23724
|
min: {
|
|
23714
23725
|
type: "invalid",
|
|
23715
|
-
message:
|
|
23726
|
+
message: __59("Value is below the minimum.")
|
|
23716
23727
|
}
|
|
23717
23728
|
};
|
|
23718
23729
|
}
|
|
@@ -23720,7 +23731,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23720
23731
|
return {
|
|
23721
23732
|
max: {
|
|
23722
23733
|
type: "invalid",
|
|
23723
|
-
message:
|
|
23734
|
+
message: __59("Value is above the maximum.")
|
|
23724
23735
|
}
|
|
23725
23736
|
};
|
|
23726
23737
|
}
|
|
@@ -23728,7 +23739,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23728
23739
|
return {
|
|
23729
23740
|
minLength: {
|
|
23730
23741
|
type: "invalid",
|
|
23731
|
-
message:
|
|
23742
|
+
message: __59("Value is too short.")
|
|
23732
23743
|
}
|
|
23733
23744
|
};
|
|
23734
23745
|
}
|
|
@@ -23736,7 +23747,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23736
23747
|
return {
|
|
23737
23748
|
maxLength: {
|
|
23738
23749
|
type: "invalid",
|
|
23739
|
-
message:
|
|
23750
|
+
message: __59("Value is too long.")
|
|
23740
23751
|
}
|
|
23741
23752
|
};
|
|
23742
23753
|
}
|
|
@@ -23744,7 +23755,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23744
23755
|
return {
|
|
23745
23756
|
elements: {
|
|
23746
23757
|
type: "invalid",
|
|
23747
|
-
message:
|
|
23758
|
+
message: __59("Value must be one of the elements.")
|
|
23748
23759
|
}
|
|
23749
23760
|
};
|
|
23750
23761
|
}
|
|
@@ -23767,7 +23778,7 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23767
23778
|
if (error instanceof Error) {
|
|
23768
23779
|
errorMessage = error.message;
|
|
23769
23780
|
} else {
|
|
23770
|
-
errorMessage = String(error) ||
|
|
23781
|
+
errorMessage = String(error) || __59("Unknown error when running custom validation.");
|
|
23771
23782
|
}
|
|
23772
23783
|
return {
|
|
23773
23784
|
custom: {
|
|
@@ -23794,14 +23805,14 @@ function validateFormField(item2, formField, promiseHandler) {
|
|
|
23794
23805
|
);
|
|
23795
23806
|
fieldValidity.elements = {
|
|
23796
23807
|
type: "validating",
|
|
23797
|
-
message:
|
|
23808
|
+
message: __59("Validating\u2026")
|
|
23798
23809
|
};
|
|
23799
23810
|
}
|
|
23800
23811
|
if (customError instanceof Promise) {
|
|
23801
23812
|
handleCustomValidationAsync(customError, formField, promiseHandler);
|
|
23802
23813
|
fieldValidity.custom = {
|
|
23803
23814
|
type: "validating",
|
|
23804
|
-
message:
|
|
23815
|
+
message: __59("Validating\u2026")
|
|
23805
23816
|
};
|
|
23806
23817
|
}
|
|
23807
23818
|
if (Object.keys(fieldValidity).length > 0) {
|
|
@@ -23993,7 +24004,7 @@ function useFieldFromFormField(field) {
|
|
|
23993
24004
|
var use_field_from_form_field_default = useFieldFromFormField;
|
|
23994
24005
|
|
|
23995
24006
|
// src/components/dataform-layouts/panel/modal.tsx
|
|
23996
|
-
import { Fragment as
|
|
24007
|
+
import { Fragment as Fragment17, jsx as jsx106, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
23997
24008
|
function ModalContent({
|
|
23998
24009
|
data,
|
|
23999
24010
|
field,
|
|
@@ -24002,6 +24013,8 @@ function ModalContent({
|
|
|
24002
24013
|
onClose,
|
|
24003
24014
|
touched
|
|
24004
24015
|
}) {
|
|
24016
|
+
const { openAs } = field.layout;
|
|
24017
|
+
const { applyLabel, cancelLabel } = openAs;
|
|
24005
24018
|
const { fields } = useContext(dataform_context_default);
|
|
24006
24019
|
const [changes, setChanges] = useState({});
|
|
24007
24020
|
const modalData = useMemo(() => {
|
|
@@ -24048,7 +24061,7 @@ function ModalContent({
|
|
|
24048
24061
|
const contentRef = useRef(null);
|
|
24049
24062
|
const mergedRef = useMergeRefs([focusOnMountRef, contentRef]);
|
|
24050
24063
|
useReportValidity(contentRef, touched);
|
|
24051
|
-
return /* @__PURE__ */
|
|
24064
|
+
return /* @__PURE__ */ jsxs35(
|
|
24052
24065
|
modal_default,
|
|
24053
24066
|
{
|
|
24054
24067
|
className: "dataforms-layouts-panel__modal",
|
|
@@ -24057,14 +24070,14 @@ function ModalContent({
|
|
|
24057
24070
|
title: fieldLabel,
|
|
24058
24071
|
size: "medium",
|
|
24059
24072
|
children: [
|
|
24060
|
-
/* @__PURE__ */
|
|
24073
|
+
/* @__PURE__ */ jsx106("div", { ref: mergedRef, children: /* @__PURE__ */ jsx106(
|
|
24061
24074
|
DataFormLayout,
|
|
24062
24075
|
{
|
|
24063
24076
|
data: modalData,
|
|
24064
24077
|
form,
|
|
24065
24078
|
onChange: handleOnChange,
|
|
24066
24079
|
validity,
|
|
24067
|
-
children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */
|
|
24080
|
+
children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ jsx106(
|
|
24068
24081
|
FieldLayout,
|
|
24069
24082
|
{
|
|
24070
24083
|
data: modalData,
|
|
@@ -24078,30 +24091,30 @@ function ModalContent({
|
|
|
24078
24091
|
)
|
|
24079
24092
|
}
|
|
24080
24093
|
) }),
|
|
24081
|
-
/* @__PURE__ */
|
|
24094
|
+
/* @__PURE__ */ jsxs35(
|
|
24082
24095
|
Stack,
|
|
24083
24096
|
{
|
|
24084
24097
|
direction: "row",
|
|
24085
24098
|
className: "dataforms-layouts-panel__modal-footer",
|
|
24086
24099
|
gap: "md",
|
|
24087
24100
|
children: [
|
|
24088
|
-
/* @__PURE__ */
|
|
24089
|
-
/* @__PURE__ */
|
|
24101
|
+
/* @__PURE__ */ jsx106(component_default6, { style: { flex: 1 } }),
|
|
24102
|
+
/* @__PURE__ */ jsx106(
|
|
24090
24103
|
button_default,
|
|
24091
24104
|
{
|
|
24092
24105
|
variant: "tertiary",
|
|
24093
24106
|
onClick: onClose,
|
|
24094
24107
|
__next40pxDefaultSize: true,
|
|
24095
|
-
children:
|
|
24108
|
+
children: cancelLabel
|
|
24096
24109
|
}
|
|
24097
24110
|
),
|
|
24098
|
-
/* @__PURE__ */
|
|
24111
|
+
/* @__PURE__ */ jsx106(
|
|
24099
24112
|
button_default,
|
|
24100
24113
|
{
|
|
24101
24114
|
variant: "primary",
|
|
24102
24115
|
onClick: onApply,
|
|
24103
24116
|
__next40pxDefaultSize: true,
|
|
24104
|
-
children:
|
|
24117
|
+
children: applyLabel
|
|
24105
24118
|
}
|
|
24106
24119
|
)
|
|
24107
24120
|
]
|
|
@@ -24127,8 +24140,8 @@ function PanelModal({
|
|
|
24127
24140
|
setIsOpen(false);
|
|
24128
24141
|
setTouched(true);
|
|
24129
24142
|
};
|
|
24130
|
-
return /* @__PURE__ */
|
|
24131
|
-
/* @__PURE__ */
|
|
24143
|
+
return /* @__PURE__ */ jsxs35(Fragment17, { children: [
|
|
24144
|
+
/* @__PURE__ */ jsx106(
|
|
24132
24145
|
SummaryButton,
|
|
24133
24146
|
{
|
|
24134
24147
|
data,
|
|
@@ -24142,7 +24155,7 @@ function PanelModal({
|
|
|
24142
24155
|
"aria-expanded": isOpen
|
|
24143
24156
|
}
|
|
24144
24157
|
),
|
|
24145
|
-
isOpen && /* @__PURE__ */
|
|
24158
|
+
isOpen && /* @__PURE__ */ jsx106(
|
|
24146
24159
|
ModalContent,
|
|
24147
24160
|
{
|
|
24148
24161
|
data,
|
|
@@ -24159,21 +24172,21 @@ var modal_default2 = PanelModal;
|
|
|
24159
24172
|
|
|
24160
24173
|
// src/components/dataform-layouts/panel/dropdown.tsx
|
|
24161
24174
|
import { __ as __60 } from "@wordpress/i18n";
|
|
24162
|
-
import { jsx as
|
|
24175
|
+
import { jsx as jsx107, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
24163
24176
|
function DropdownHeader({
|
|
24164
24177
|
title,
|
|
24165
24178
|
onClose
|
|
24166
24179
|
}) {
|
|
24167
|
-
return /* @__PURE__ */
|
|
24180
|
+
return /* @__PURE__ */ jsx107(
|
|
24168
24181
|
Stack,
|
|
24169
24182
|
{
|
|
24170
24183
|
direction: "column",
|
|
24171
24184
|
className: "dataforms-layouts-panel__dropdown-header",
|
|
24172
24185
|
gap: "lg",
|
|
24173
|
-
children: /* @__PURE__ */
|
|
24174
|
-
title && /* @__PURE__ */
|
|
24175
|
-
/* @__PURE__ */
|
|
24176
|
-
onClose && /* @__PURE__ */
|
|
24186
|
+
children: /* @__PURE__ */ jsxs36(Stack, { direction: "row", gap: "sm", align: "center", children: [
|
|
24187
|
+
title && /* @__PURE__ */ jsx107(component_default16, { level: 2, size: 13, children: title }),
|
|
24188
|
+
/* @__PURE__ */ jsx107(component_default6, { style: { flex: 1 } }),
|
|
24189
|
+
onClose && /* @__PURE__ */ jsx107(
|
|
24177
24190
|
button_default,
|
|
24178
24191
|
{
|
|
24179
24192
|
label: __60("Close"),
|
|
@@ -24192,7 +24205,7 @@ function DropdownContentWithValidation({
|
|
|
24192
24205
|
}) {
|
|
24193
24206
|
const ref = useRef(null);
|
|
24194
24207
|
useReportValidity(ref, touched);
|
|
24195
|
-
return /* @__PURE__ */
|
|
24208
|
+
return /* @__PURE__ */ jsx107("div", { ref, children });
|
|
24196
24209
|
}
|
|
24197
24210
|
function PanelDropdown({
|
|
24198
24211
|
data,
|
|
@@ -24241,12 +24254,12 @@ function PanelDropdown({
|
|
|
24241
24254
|
if (!fieldDefinition) {
|
|
24242
24255
|
return null;
|
|
24243
24256
|
}
|
|
24244
|
-
return /* @__PURE__ */
|
|
24257
|
+
return /* @__PURE__ */ jsx107(
|
|
24245
24258
|
"div",
|
|
24246
24259
|
{
|
|
24247
24260
|
ref: setPopoverAnchor,
|
|
24248
24261
|
className: "dataforms-layouts-panel__field-dropdown-anchor",
|
|
24249
|
-
children: /* @__PURE__ */
|
|
24262
|
+
children: /* @__PURE__ */ jsx107(
|
|
24250
24263
|
dropdown_default,
|
|
24251
24264
|
{
|
|
24252
24265
|
contentClassName: "dataforms-layouts-panel__field-dropdown",
|
|
@@ -24257,7 +24270,7 @@ function PanelDropdown({
|
|
|
24257
24270
|
setTouched(true);
|
|
24258
24271
|
}
|
|
24259
24272
|
},
|
|
24260
|
-
renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */
|
|
24273
|
+
renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ jsx107(
|
|
24261
24274
|
SummaryButton,
|
|
24262
24275
|
{
|
|
24263
24276
|
data,
|
|
@@ -24271,22 +24284,22 @@ function PanelDropdown({
|
|
|
24271
24284
|
"aria-expanded": isOpen
|
|
24272
24285
|
}
|
|
24273
24286
|
),
|
|
24274
|
-
renderContent: ({ onClose }) => /* @__PURE__ */
|
|
24275
|
-
/* @__PURE__ */
|
|
24287
|
+
renderContent: ({ onClose }) => /* @__PURE__ */ jsx107(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ jsxs36("div", { ref: dialogRef, ...dialogProps, children: [
|
|
24288
|
+
/* @__PURE__ */ jsx107(
|
|
24276
24289
|
DropdownHeader,
|
|
24277
24290
|
{
|
|
24278
24291
|
title: fieldLabel,
|
|
24279
24292
|
onClose
|
|
24280
24293
|
}
|
|
24281
24294
|
),
|
|
24282
|
-
/* @__PURE__ */
|
|
24295
|
+
/* @__PURE__ */ jsx107(
|
|
24283
24296
|
DataFormLayout,
|
|
24284
24297
|
{
|
|
24285
24298
|
data,
|
|
24286
24299
|
form,
|
|
24287
24300
|
onChange,
|
|
24288
24301
|
validity: formValidity,
|
|
24289
|
-
children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */
|
|
24302
|
+
children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ jsx107(
|
|
24290
24303
|
FieldLayout,
|
|
24291
24304
|
{
|
|
24292
24305
|
data,
|
|
@@ -24309,7 +24322,7 @@ function PanelDropdown({
|
|
|
24309
24322
|
var dropdown_default2 = PanelDropdown;
|
|
24310
24323
|
|
|
24311
24324
|
// src/components/dataform-layouts/panel/index.tsx
|
|
24312
|
-
import { jsx as
|
|
24325
|
+
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
24313
24326
|
function FormPanelField({
|
|
24314
24327
|
data,
|
|
24315
24328
|
field,
|
|
@@ -24317,8 +24330,8 @@ function FormPanelField({
|
|
|
24317
24330
|
validity
|
|
24318
24331
|
}) {
|
|
24319
24332
|
const layout = field.layout;
|
|
24320
|
-
if (layout.openAs === "modal") {
|
|
24321
|
-
return /* @__PURE__ */
|
|
24333
|
+
if (layout.openAs.type === "modal") {
|
|
24334
|
+
return /* @__PURE__ */ jsx108(
|
|
24322
24335
|
modal_default2,
|
|
24323
24336
|
{
|
|
24324
24337
|
data,
|
|
@@ -24328,7 +24341,7 @@ function FormPanelField({
|
|
|
24328
24341
|
}
|
|
24329
24342
|
);
|
|
24330
24343
|
}
|
|
24331
|
-
return /* @__PURE__ */
|
|
24344
|
+
return /* @__PURE__ */ jsx108(
|
|
24332
24345
|
dropdown_default2,
|
|
24333
24346
|
{
|
|
24334
24347
|
data,
|
|
@@ -24341,7 +24354,7 @@ function FormPanelField({
|
|
|
24341
24354
|
|
|
24342
24355
|
// src/components/dataform-layouts/validation-badge.tsx
|
|
24343
24356
|
import { sprintf as sprintf18, _n as _n4 } from "@wordpress/i18n";
|
|
24344
|
-
import { jsx as
|
|
24357
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
24345
24358
|
function countInvalidFields(validity) {
|
|
24346
24359
|
if (!validity) {
|
|
24347
24360
|
return 0;
|
|
@@ -24370,7 +24383,7 @@ function ValidationBadge({
|
|
|
24370
24383
|
if (invalidCount === 0) {
|
|
24371
24384
|
return null;
|
|
24372
24385
|
}
|
|
24373
|
-
return /* @__PURE__ */
|
|
24386
|
+
return /* @__PURE__ */ jsx109(Badge, { intent: "high", children: sprintf18(
|
|
24374
24387
|
/* translators: %d: Number of fields that need attention */
|
|
24375
24388
|
_n4(
|
|
24376
24389
|
"%d field needs attention",
|
|
@@ -24382,7 +24395,7 @@ function ValidationBadge({
|
|
|
24382
24395
|
}
|
|
24383
24396
|
|
|
24384
24397
|
// src/components/dataform-layouts/card/index.tsx
|
|
24385
|
-
import { Fragment as
|
|
24398
|
+
import { Fragment as Fragment18, jsx as jsx110, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
24386
24399
|
function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
|
|
24387
24400
|
if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
|
|
24388
24401
|
return false;
|
|
@@ -24452,7 +24465,7 @@ function FormCardField({
|
|
|
24452
24465
|
const visibleSummaryFields = summaryFields.filter(
|
|
24453
24466
|
(summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
|
|
24454
24467
|
);
|
|
24455
|
-
const validationBadge = touched && layout.isCollapsible ? /* @__PURE__ */
|
|
24468
|
+
const validationBadge = touched && layout.isCollapsible ? /* @__PURE__ */ jsx110(ValidationBadge, { validity }) : null;
|
|
24456
24469
|
const sizeCard = {
|
|
24457
24470
|
blockStart: "medium",
|
|
24458
24471
|
blockEnd: "medium",
|
|
@@ -24464,9 +24477,9 @@ function FormCardField({
|
|
|
24464
24477
|
let bodyContent;
|
|
24465
24478
|
if (field.children) {
|
|
24466
24479
|
withHeader = !!label && layout.withHeader;
|
|
24467
|
-
bodyContent = /* @__PURE__ */
|
|
24468
|
-
field.description && /* @__PURE__ */
|
|
24469
|
-
/* @__PURE__ */
|
|
24480
|
+
bodyContent = /* @__PURE__ */ jsxs37(Fragment18, { children: [
|
|
24481
|
+
field.description && /* @__PURE__ */ jsx110("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
|
|
24482
|
+
/* @__PURE__ */ jsx110(
|
|
24470
24483
|
DataFormLayout,
|
|
24471
24484
|
{
|
|
24472
24485
|
data,
|
|
@@ -24489,7 +24502,7 @@ function FormCardField({
|
|
|
24489
24502
|
}
|
|
24490
24503
|
label = fieldDefinition.label;
|
|
24491
24504
|
withHeader = !!label && layout.withHeader;
|
|
24492
|
-
bodyContent = /* @__PURE__ */
|
|
24505
|
+
bodyContent = /* @__PURE__ */ jsx110(
|
|
24493
24506
|
SingleFieldLayout,
|
|
24494
24507
|
{
|
|
24495
24508
|
data,
|
|
@@ -24507,8 +24520,8 @@ function FormCardField({
|
|
|
24507
24520
|
inlineStart: "medium",
|
|
24508
24521
|
inlineEnd: "medium"
|
|
24509
24522
|
};
|
|
24510
|
-
return /* @__PURE__ */
|
|
24511
|
-
withHeader && /* @__PURE__ */
|
|
24523
|
+
return /* @__PURE__ */ jsxs37(component_default18, { className: "dataforms-layouts-card__field", size: sizeCard, children: [
|
|
24524
|
+
withHeader && /* @__PURE__ */ jsxs37(
|
|
24512
24525
|
component_default21,
|
|
24513
24526
|
{
|
|
24514
24527
|
className: "dataforms-layouts-card__field-header",
|
|
@@ -24518,7 +24531,7 @@ function FormCardField({
|
|
|
24518
24531
|
},
|
|
24519
24532
|
isBorderless: true,
|
|
24520
24533
|
children: [
|
|
24521
|
-
/* @__PURE__ */
|
|
24534
|
+
/* @__PURE__ */ jsxs37(
|
|
24522
24535
|
"div",
|
|
24523
24536
|
{
|
|
24524
24537
|
style: {
|
|
@@ -24531,7 +24544,7 @@ function FormCardField({
|
|
|
24531
24544
|
alignItems: "center"
|
|
24532
24545
|
},
|
|
24533
24546
|
children: [
|
|
24534
|
-
/* @__PURE__ */
|
|
24547
|
+
/* @__PURE__ */ jsx110(
|
|
24535
24548
|
"span",
|
|
24536
24549
|
{
|
|
24537
24550
|
id: titleId,
|
|
@@ -24540,8 +24553,8 @@ function FormCardField({
|
|
|
24540
24553
|
}
|
|
24541
24554
|
),
|
|
24542
24555
|
validationBadge,
|
|
24543
|
-
visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */
|
|
24544
|
-
(summaryField) => /* @__PURE__ */
|
|
24556
|
+
visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ jsx110("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
|
|
24557
|
+
(summaryField) => /* @__PURE__ */ jsx110(
|
|
24545
24558
|
summaryField.render,
|
|
24546
24559
|
{
|
|
24547
24560
|
item: data,
|
|
@@ -24553,7 +24566,7 @@ function FormCardField({
|
|
|
24553
24566
|
]
|
|
24554
24567
|
}
|
|
24555
24568
|
),
|
|
24556
|
-
isCollapsible && /* @__PURE__ */
|
|
24569
|
+
isCollapsible && /* @__PURE__ */ jsx110(
|
|
24557
24570
|
button_default,
|
|
24558
24571
|
{
|
|
24559
24572
|
__next40pxDefaultSize: true,
|
|
@@ -24569,7 +24582,7 @@ function FormCardField({
|
|
|
24569
24582
|
),
|
|
24570
24583
|
(isOpen || !withHeader) && // If it doesn't have a header, keep it open.
|
|
24571
24584
|
// Otherwise, the card will not be visible.
|
|
24572
|
-
/* @__PURE__ */
|
|
24585
|
+
/* @__PURE__ */ jsx110(
|
|
24573
24586
|
component_default20,
|
|
24574
24587
|
{
|
|
24575
24588
|
id: bodyId,
|
|
@@ -24584,19 +24597,19 @@ function FormCardField({
|
|
|
24584
24597
|
}
|
|
24585
24598
|
|
|
24586
24599
|
// src/components/dataform-layouts/row/index.tsx
|
|
24587
|
-
import { Fragment as
|
|
24600
|
+
import { Fragment as Fragment19, jsx as jsx111, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
24588
24601
|
function Header3({ title }) {
|
|
24589
|
-
return /* @__PURE__ */
|
|
24602
|
+
return /* @__PURE__ */ jsx111(
|
|
24590
24603
|
Stack,
|
|
24591
24604
|
{
|
|
24592
24605
|
direction: "column",
|
|
24593
24606
|
className: "dataforms-layouts-row__header",
|
|
24594
24607
|
gap: "lg",
|
|
24595
|
-
children: /* @__PURE__ */
|
|
24608
|
+
children: /* @__PURE__ */ jsx111(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ jsx111(component_default16, { level: 2, size: 13, children: title }) })
|
|
24596
24609
|
}
|
|
24597
24610
|
);
|
|
24598
24611
|
}
|
|
24599
|
-
var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */
|
|
24612
|
+
var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ jsx111(Fragment19, { children });
|
|
24600
24613
|
function FormRowField({
|
|
24601
24614
|
data,
|
|
24602
24615
|
field,
|
|
@@ -24611,9 +24624,9 @@ function FormRowField({
|
|
|
24611
24624
|
layout: DEFAULT_LAYOUT,
|
|
24612
24625
|
fields: field.children
|
|
24613
24626
|
};
|
|
24614
|
-
return /* @__PURE__ */
|
|
24615
|
-
!hideLabelFromVision && field.label && /* @__PURE__ */
|
|
24616
|
-
/* @__PURE__ */
|
|
24627
|
+
return /* @__PURE__ */ jsxs38("div", { className: "dataforms-layouts-row__field", children: [
|
|
24628
|
+
!hideLabelFromVision && field.label && /* @__PURE__ */ jsx111(Header3, { title: field.label }),
|
|
24629
|
+
/* @__PURE__ */ jsx111(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ jsx111(
|
|
24617
24630
|
DataFormLayout,
|
|
24618
24631
|
{
|
|
24619
24632
|
data,
|
|
@@ -24621,12 +24634,12 @@ function FormRowField({
|
|
|
24621
24634
|
onChange,
|
|
24622
24635
|
validity: validity?.children,
|
|
24623
24636
|
as: EMPTY_WRAPPER,
|
|
24624
|
-
children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */
|
|
24637
|
+
children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ jsx111(
|
|
24625
24638
|
"div",
|
|
24626
24639
|
{
|
|
24627
24640
|
className: "dataforms-layouts-row__field-control",
|
|
24628
24641
|
style: layout.styles[childField.id],
|
|
24629
|
-
children: /* @__PURE__ */
|
|
24642
|
+
children: /* @__PURE__ */ jsx111(
|
|
24630
24643
|
FieldLayout,
|
|
24631
24644
|
{
|
|
24632
24645
|
data,
|
|
@@ -24648,7 +24661,7 @@ function FormRowField({
|
|
|
24648
24661
|
if (!RegularLayout) {
|
|
24649
24662
|
return null;
|
|
24650
24663
|
}
|
|
24651
|
-
return /* @__PURE__ */
|
|
24664
|
+
return /* @__PURE__ */ jsx111(Fragment19, { children: /* @__PURE__ */ jsx111("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ jsx111(
|
|
24652
24665
|
RegularLayout,
|
|
24653
24666
|
{
|
|
24654
24667
|
data,
|
|
@@ -24662,7 +24675,7 @@ function FormRowField({
|
|
|
24662
24675
|
|
|
24663
24676
|
// src/components/dataform-layouts/details/index.tsx
|
|
24664
24677
|
import { __ as __61 } from "@wordpress/i18n";
|
|
24665
|
-
import { jsx as
|
|
24678
|
+
import { jsx as jsx112, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
24666
24679
|
function FormDetailsField({
|
|
24667
24680
|
data,
|
|
24668
24681
|
field,
|
|
@@ -24709,17 +24722,17 @@ function FormDetailsField({
|
|
|
24709
24722
|
const summaryField = summaryFieldId ? fields.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0;
|
|
24710
24723
|
let summaryContent;
|
|
24711
24724
|
if (summaryField && summaryField.render) {
|
|
24712
|
-
summaryContent = /* @__PURE__ */
|
|
24725
|
+
summaryContent = /* @__PURE__ */ jsx112(summaryField.render, { item: data, field: summaryField });
|
|
24713
24726
|
} else {
|
|
24714
24727
|
summaryContent = field.label || __61("More details");
|
|
24715
24728
|
}
|
|
24716
|
-
return /* @__PURE__ */
|
|
24729
|
+
return /* @__PURE__ */ jsxs39(
|
|
24717
24730
|
"details",
|
|
24718
24731
|
{
|
|
24719
24732
|
ref: detailsRef,
|
|
24720
24733
|
className: "dataforms-layouts-details__details",
|
|
24721
24734
|
children: [
|
|
24722
|
-
/* @__PURE__ */
|
|
24735
|
+
/* @__PURE__ */ jsx112("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ jsxs39(
|
|
24723
24736
|
Stack,
|
|
24724
24737
|
{
|
|
24725
24738
|
direction: "row",
|
|
@@ -24728,17 +24741,17 @@ function FormDetailsField({
|
|
|
24728
24741
|
className: "dataforms-layouts-details__summary-content",
|
|
24729
24742
|
children: [
|
|
24730
24743
|
summaryContent,
|
|
24731
|
-
touched && /* @__PURE__ */
|
|
24744
|
+
touched && /* @__PURE__ */ jsx112(ValidationBadge, { validity })
|
|
24732
24745
|
]
|
|
24733
24746
|
}
|
|
24734
24747
|
) }),
|
|
24735
|
-
/* @__PURE__ */
|
|
24748
|
+
/* @__PURE__ */ jsx112(
|
|
24736
24749
|
"div",
|
|
24737
24750
|
{
|
|
24738
24751
|
ref: contentRef,
|
|
24739
24752
|
className: "dataforms-layouts-details__content",
|
|
24740
24753
|
onBlur: handleBlur,
|
|
24741
|
-
children: /* @__PURE__ */
|
|
24754
|
+
children: /* @__PURE__ */ jsx112(
|
|
24742
24755
|
DataFormLayout,
|
|
24743
24756
|
{
|
|
24744
24757
|
data,
|
|
@@ -24755,12 +24768,12 @@ function FormDetailsField({
|
|
|
24755
24768
|
}
|
|
24756
24769
|
|
|
24757
24770
|
// src/components/dataform-layouts/index.tsx
|
|
24758
|
-
import { jsx as
|
|
24771
|
+
import { jsx as jsx113 } from "react/jsx-runtime";
|
|
24759
24772
|
var FORM_FIELD_LAYOUTS = [
|
|
24760
24773
|
{
|
|
24761
24774
|
type: "regular",
|
|
24762
24775
|
component: FormRegularField,
|
|
24763
|
-
wrapper: ({ children }) => /* @__PURE__ */
|
|
24776
|
+
wrapper: ({ children }) => /* @__PURE__ */ jsx113(
|
|
24764
24777
|
Stack,
|
|
24765
24778
|
{
|
|
24766
24779
|
direction: "column",
|
|
@@ -24773,7 +24786,7 @@ var FORM_FIELD_LAYOUTS = [
|
|
|
24773
24786
|
{
|
|
24774
24787
|
type: "panel",
|
|
24775
24788
|
component: FormPanelField,
|
|
24776
|
-
wrapper: ({ children }) => /* @__PURE__ */
|
|
24789
|
+
wrapper: ({ children }) => /* @__PURE__ */ jsx113(
|
|
24777
24790
|
Stack,
|
|
24778
24791
|
{
|
|
24779
24792
|
direction: "column",
|
|
@@ -24786,7 +24799,7 @@ var FORM_FIELD_LAYOUTS = [
|
|
|
24786
24799
|
{
|
|
24787
24800
|
type: "card",
|
|
24788
24801
|
component: FormCardField,
|
|
24789
|
-
wrapper: ({ children }) => /* @__PURE__ */
|
|
24802
|
+
wrapper: ({ children }) => /* @__PURE__ */ jsx113(
|
|
24790
24803
|
Stack,
|
|
24791
24804
|
{
|
|
24792
24805
|
direction: "column",
|
|
@@ -24802,13 +24815,13 @@ var FORM_FIELD_LAYOUTS = [
|
|
|
24802
24815
|
wrapper: ({
|
|
24803
24816
|
children,
|
|
24804
24817
|
layout
|
|
24805
|
-
}) => /* @__PURE__ */
|
|
24818
|
+
}) => /* @__PURE__ */ jsx113(
|
|
24806
24819
|
Stack,
|
|
24807
24820
|
{
|
|
24808
24821
|
direction: "column",
|
|
24809
24822
|
className: "dataforms-layouts__wrapper",
|
|
24810
24823
|
gap: "lg",
|
|
24811
|
-
children: /* @__PURE__ */
|
|
24824
|
+
children: /* @__PURE__ */ jsx113("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ jsx113(
|
|
24812
24825
|
Stack,
|
|
24813
24826
|
{
|
|
24814
24827
|
direction: "row",
|
|
@@ -24830,8 +24843,8 @@ function getFormFieldLayout(type) {
|
|
|
24830
24843
|
}
|
|
24831
24844
|
|
|
24832
24845
|
// src/components/dataform-layouts/data-form-layout.tsx
|
|
24833
|
-
import { jsx as
|
|
24834
|
-
var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */
|
|
24846
|
+
import { jsx as jsx114 } from "react/jsx-runtime";
|
|
24847
|
+
var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ jsx114(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children });
|
|
24835
24848
|
function DataFormLayout({
|
|
24836
24849
|
data,
|
|
24837
24850
|
form,
|
|
@@ -24854,7 +24867,7 @@ function DataFormLayout({
|
|
|
24854
24867
|
);
|
|
24855
24868
|
}
|
|
24856
24869
|
const Wrapper4 = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER;
|
|
24857
|
-
return /* @__PURE__ */
|
|
24870
|
+
return /* @__PURE__ */ jsx114(Wrapper4, { layout: form.layout, children: form.fields.map((formField) => {
|
|
24858
24871
|
const FieldLayout = getFormFieldLayout(formField.layout.type)?.component;
|
|
24859
24872
|
if (!FieldLayout) {
|
|
24860
24873
|
return null;
|
|
@@ -24871,7 +24884,7 @@ function DataFormLayout({
|
|
|
24871
24884
|
markWhenOptional
|
|
24872
24885
|
);
|
|
24873
24886
|
}
|
|
24874
|
-
return /* @__PURE__ */
|
|
24887
|
+
return /* @__PURE__ */ jsx114(
|
|
24875
24888
|
FieldLayout,
|
|
24876
24889
|
{
|
|
24877
24890
|
data,
|
|
@@ -24886,7 +24899,7 @@ function DataFormLayout({
|
|
|
24886
24899
|
}
|
|
24887
24900
|
|
|
24888
24901
|
// src/dataform/index.tsx
|
|
24889
|
-
import { jsx as
|
|
24902
|
+
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
24890
24903
|
function DataForm({
|
|
24891
24904
|
data,
|
|
24892
24905
|
form,
|
|
@@ -24902,7 +24915,7 @@ function DataForm({
|
|
|
24902
24915
|
if (!form.fields) {
|
|
24903
24916
|
return null;
|
|
24904
24917
|
}
|
|
24905
|
-
return /* @__PURE__ */
|
|
24918
|
+
return /* @__PURE__ */ jsx115(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ jsx115(
|
|
24906
24919
|
DataFormLayout,
|
|
24907
24920
|
{
|
|
24908
24921
|
data,
|