@wordpress/dataviews 12.0.1-next.v.202602091733.0 → 12.0.1
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 +39 -1
- package/README.md +3 -1
- package/build/components/dataform-controls/color.cjs +19 -30
- package/build/components/dataform-controls/color.cjs.map +3 -3
- package/build/components/dataform-controls/date.cjs.map +1 -1
- package/build/components/dataform-controls/datetime.cjs +12 -21
- package/build/components/dataform-controls/datetime.cjs.map +2 -2
- package/build/components/dataform-layouts/card/index.cjs +112 -164
- package/build/components/dataform-layouts/card/index.cjs.map +3 -3
- package/build/components/dataform-layouts/index.cjs +1 -1
- package/build/components/dataform-layouts/index.cjs.map +1 -1
- package/build/components/dataform-layouts/normalize-form.cjs +2 -1
- package/build/components/dataform-layouts/normalize-form.cjs.map +2 -2
- package/build/components/dataform-layouts/panel/dropdown.cjs +79 -65
- package/build/components/dataform-layouts/panel/dropdown.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/index.cjs +13 -177
- package/build/components/dataform-layouts/panel/index.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/modal.cjs +12 -9
- package/build/components/dataform-layouts/panel/modal.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/summary-button.cjs +125 -56
- package/build/components/dataform-layouts/panel/summary-button.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/utils/get-first-validation-error.cjs +59 -0
- package/build/components/dataform-layouts/panel/utils/get-first-validation-error.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/get-label-classname.cjs +45 -0
- package/build/components/dataform-layouts/panel/utils/get-label-classname.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs +36 -0
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/use-field-from-form-field.cjs +77 -0
- package/build/components/dataform-layouts/panel/utils/use-field-from-form-field.cjs.map +7 -0
- package/build/components/dataviews-bulk-actions/index.cjs +2 -2
- package/build/components/dataviews-bulk-actions/index.cjs.map +2 -2
- package/build/components/dataviews-context/index.cjs +1 -0
- package/build/components/dataviews-context/index.cjs.map +2 -2
- package/build/components/dataviews-filters/filter.cjs.map +1 -1
- package/build/components/dataviews-filters/search-widget.cjs +25 -11
- package/build/components/dataviews-filters/search-widget.cjs.map +2 -2
- package/build/components/dataviews-filters/toggle.cjs +6 -2
- package/build/components/dataviews-filters/toggle.cjs.map +2 -2
- package/build/components/dataviews-footer/index.cjs +28 -12
- package/build/components/dataviews-footer/index.cjs.map +3 -3
- package/build/components/dataviews-item-actions/index.cjs +0 -1
- package/build/components/dataviews-item-actions/index.cjs.map +2 -2
- package/build/components/dataviews-layout/index.cjs +12 -0
- package/build/components/dataviews-layout/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/activity/index.cjs +41 -26
- package/build/components/dataviews-layouts/activity/index.cjs.map +3 -3
- package/build/components/dataviews-layouts/grid/composite-grid.cjs +2 -0
- package/build/components/dataviews-layouts/grid/composite-grid.cjs.map +2 -2
- package/build/components/dataviews-layouts/grid/index.cjs +19 -14
- package/build/components/dataviews-layouts/grid/index.cjs.map +3 -3
- package/build/components/dataviews-layouts/list/index.cjs +13 -9
- package/build/components/dataviews-layouts/list/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/picker-table/index.cjs +1 -1
- package/build/components/dataviews-layouts/picker-table/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/index.cjs +40 -19
- package/build/components/dataviews-layouts/table/index.cjs.map +2 -2
- package/build/dataviews/index.cjs +9 -2
- package/build/dataviews/index.cjs.map +3 -3
- package/build/dataviews-picker/index.cjs +1 -0
- package/build/dataviews-picker/index.cjs.map +2 -2
- package/build/hooks/use-data.cjs +46 -0
- package/build/hooks/use-data.cjs.map +7 -0
- package/build/hooks/use-delayed-loading.cjs +47 -0
- package/build/hooks/use-delayed-loading.cjs.map +7 -0
- package/build/types/dataform.cjs.map +1 -1
- package/build-module/components/dataform-controls/color.mjs +24 -31
- package/build-module/components/dataform-controls/color.mjs.map +2 -2
- package/build-module/components/dataform-controls/date.mjs.map +1 -1
- package/build-module/components/dataform-controls/datetime.mjs +13 -22
- package/build-module/components/dataform-controls/datetime.mjs.map +2 -2
- package/build-module/components/dataform-layouts/card/index.mjs +113 -161
- package/build-module/components/dataform-layouts/card/index.mjs.map +3 -3
- package/build-module/components/dataform-layouts/index.mjs +1 -1
- package/build-module/components/dataform-layouts/index.mjs.map +1 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs +2 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/dropdown.mjs +81 -67
- package/build-module/components/dataform-layouts/panel/dropdown.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/index.mjs +14 -178
- package/build-module/components/dataform-layouts/panel/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/modal.mjs +12 -9
- package/build-module/components/dataform-layouts/panel/modal.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/summary-button.mjs +117 -58
- package/build-module/components/dataform-layouts/panel/summary-button.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs +38 -0
- package/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs +14 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs +15 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs +46 -0
- package/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs.map +7 -0
- package/build-module/components/dataviews-bulk-actions/index.mjs +2 -2
- package/build-module/components/dataviews-bulk-actions/index.mjs.map +2 -2
- package/build-module/components/dataviews-context/index.mjs +1 -0
- package/build-module/components/dataviews-context/index.mjs.map +2 -2
- package/build-module/components/dataviews-filters/filter.mjs.map +1 -1
- package/build-module/components/dataviews-filters/search-widget.mjs +25 -11
- package/build-module/components/dataviews-filters/search-widget.mjs.map +2 -2
- package/build-module/components/dataviews-filters/toggle.mjs +6 -2
- package/build-module/components/dataviews-filters/toggle.mjs.map +2 -2
- package/build-module/components/dataviews-footer/index.mjs +28 -12
- package/build-module/components/dataviews-footer/index.mjs.map +2 -2
- package/build-module/components/dataviews-item-actions/index.mjs +0 -1
- package/build-module/components/dataviews-item-actions/index.mjs.map +2 -2
- package/build-module/components/dataviews-layout/index.mjs +12 -0
- package/build-module/components/dataviews-layout/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/activity/index.mjs +41 -26
- package/build-module/components/dataviews-layouts/activity/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs +2 -0
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/index.mjs +19 -14
- package/build-module/components/dataviews-layouts/grid/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/list/index.mjs +13 -9
- package/build-module/components/dataviews-layouts/list/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/picker-table/index.mjs +1 -1
- package/build-module/components/dataviews-layouts/picker-table/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/index.mjs +40 -19
- package/build-module/components/dataviews-layouts/table/index.mjs.map +2 -2
- package/build-module/dataviews/index.mjs +9 -2
- package/build-module/dataviews/index.mjs.map +2 -2
- package/build-module/dataviews-picker/index.mjs +1 -0
- package/build-module/dataviews-picker/index.mjs.map +2 -2
- package/build-module/hooks/use-data.mjs +25 -0
- package/build-module/hooks/use-data.mjs.map +7 -0
- package/build-module/hooks/use-delayed-loading.mjs +22 -0
- package/build-module/hooks/use-delayed-loading.mjs.map +7 -0
- package/build-style/style-rtl.css +190 -31
- package/build-style/style.css +190 -31
- package/build-types/components/dataform-controls/color.d.ts.map +1 -1
- package/build-types/components/dataform-controls/datetime.d.ts.map +1 -1
- package/build-types/components/dataform-controls/utils/use-disabled-date-matchers.d.ts +16 -0
- package/build-types/components/dataform-controls/utils/use-disabled-date-matchers.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/card/index.d.ts +1 -10
- package/build-types/components/dataform-layouts/card/index.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/dropdown.d.ts +2 -13
- package/build-types/components/dataform-layouts/panel/dropdown.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/index.d.ts +1 -1
- package/build-types/components/dataform-layouts/panel/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/modal.d.ts +2 -11
- package/build-types/components/dataform-layouts/panel/modal.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts +6 -5
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/utils/get-first-validation-error.d.ts +4 -0
- package/build-types/components/dataform-layouts/panel/utils/get-first-validation-error.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-classname.d.ts +4 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-classname.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts +3 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/use-field-from-form-field.d.ts +23 -0
- package/build-types/components/dataform-layouts/panel/utils/use-field-from-form-field.d.ts.map +1 -0
- package/build-types/components/dataviews-context/index.d.ts +1 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/toggle.d.ts.map +1 -1
- package/build-types/components/dataviews-footer/index.d.ts +1 -1
- package/build-types/components/dataviews-footer/index.d.ts.map +1 -1
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layout/index.d.ts +1 -1
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/activity/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/grid/composite-grid.d.ts +2 -1
- package/build-types/components/dataviews-layouts/grid/composite-grid.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/grid/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/picker-activity/index.d.ts +3 -0
- package/build-types/components/dataviews-layouts/picker-activity/index.d.ts.map +1 -0
- 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/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/components/dataviews-layouts/utils/use-infinite-scroll.d.ts +22 -0
- package/build-types/components/dataviews-layouts/utils/use-infinite-scroll.d.ts.map +1 -0
- package/build-types/dataform/stories/index.story.d.ts +9 -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.map +1 -1
- package/build-types/dataviews/stories/fixtures.d.ts +1 -0
- package/build-types/dataviews/stories/fixtures.d.ts.map +1 -1
- package/build-types/dataviews/stories/free-composition.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-table.d.ts.map +1 -1
- package/build-types/dataviews/stories/minimal-ui.d.ts.map +1 -1
- package/build-types/dataviews/stories/with-card.d.ts.map +1 -1
- package/build-types/dataviews-picker/index.d.ts.map +1 -1
- package/build-types/field-types/utils/is-valid-date-boundary.d.ts +7 -0
- package/build-types/field-types/utils/is-valid-date-boundary.d.ts.map +1 -0
- package/build-types/hooks/test/use-data.d.ts +2 -0
- package/build-types/hooks/test/use-data.d.ts.map +1 -0
- package/build-types/hooks/use-data.d.ts +12 -0
- package/build-types/hooks/use-data.d.ts.map +1 -0
- package/build-types/hooks/use-delayed-loading.d.ts +4 -0
- package/build-types/hooks/use-delayed-loading.d.ts.map +1 -0
- package/build-types/hooks/use-infinite-scroll.d.ts +21 -0
- package/build-types/hooks/use-infinite-scroll.d.ts.map +1 -0
- package/build-types/hooks/use-selected-items.d.ts +19 -0
- package/build-types/hooks/use-selected-items.d.ts.map +1 -0
- package/build-types/types/dataform.d.ts +3 -0
- package/build-types/types/dataform.d.ts.map +1 -1
- package/build-wp/index.js +2898 -2198
- package/package.json +21 -21
- package/src/components/dataform-controls/color.tsx +29 -36
- package/src/components/dataform-controls/date.tsx +2 -2
- package/src/components/dataform-controls/datetime.tsx +19 -34
- package/src/components/dataform-controls/style.scss +4 -0
- package/src/components/dataform-layouts/card/index.tsx +118 -185
- package/src/components/dataform-layouts/index.tsx +1 -1
- package/src/components/dataform-layouts/normalize-form.ts +1 -0
- package/src/components/dataform-layouts/panel/dropdown.tsx +95 -96
- package/src/components/dataform-layouts/panel/index.tsx +10 -245
- package/src/components/dataform-layouts/panel/modal.tsx +16 -20
- package/src/components/dataform-layouts/panel/style.scss +110 -27
- package/src/components/dataform-layouts/panel/summary-button.tsx +140 -62
- package/src/components/dataform-layouts/panel/utils/get-first-validation-error.ts +47 -0
- package/src/components/dataform-layouts/panel/utils/get-label-classname.ts +18 -0
- package/src/components/dataform-layouts/panel/utils/get-label-content.tsx +24 -0
- package/src/components/dataform-layouts/panel/utils/use-field-from-form-field.ts +78 -0
- package/src/components/dataform-layouts/regular/style.scss +7 -0
- package/src/components/dataform-layouts/test/normalize-form.ts +5 -0
- package/src/components/dataviews-bulk-actions/index.tsx +2 -2
- package/src/components/dataviews-context/index.ts +2 -0
- package/src/components/dataviews-filters/filter.tsx +1 -1
- package/src/components/dataviews-filters/search-widget.tsx +10 -2
- package/src/components/dataviews-filters/style.scss +8 -0
- package/src/components/dataviews-filters/toggle.tsx +10 -3
- package/src/components/dataviews-footer/index.tsx +39 -12
- package/src/components/dataviews-footer/style.scss +6 -1
- package/src/components/dataviews-item-actions/index.tsx +0 -3
- package/src/components/dataviews-item-actions/style.scss +7 -0
- package/src/components/dataviews-layout/index.tsx +24 -0
- package/src/components/dataviews-layouts/activity/index.tsx +29 -22
- package/src/components/dataviews-layouts/activity/style.scss +5 -0
- package/src/components/dataviews-layouts/grid/composite-grid.tsx +5 -1
- package/src/components/dataviews-layouts/grid/index.tsx +19 -22
- package/src/components/dataviews-layouts/grid/style.scss +5 -0
- package/src/components/dataviews-layouts/list/index.tsx +18 -18
- package/src/components/dataviews-layouts/list/style.scss +5 -0
- package/src/components/dataviews-layouts/picker-table/index.tsx +1 -1
- package/src/components/dataviews-layouts/table/index.tsx +48 -22
- package/src/components/dataviews-layouts/table/style.scss +8 -2
- package/src/dataform/stories/index.story.tsx +5 -0
- package/src/dataform/stories/layout-panel.tsx +19 -2
- package/src/dataform/test/dataform.tsx +2 -2
- package/src/dataviews/index.tsx +11 -3
- package/src/dataviews/stories/empty.tsx +1 -7
- package/src/dataviews/stories/fixtures.tsx +89 -0
- package/src/dataviews/stories/free-composition.tsx +0 -5
- package/src/dataviews/stories/layout-table.tsx +1 -7
- package/src/dataviews/stories/minimal-ui.tsx +0 -5
- package/src/dataviews/stories/with-card.tsx +1 -7
- package/src/dataviews/style.scss +25 -0
- package/src/dataviews-picker/index.tsx +2 -1
- package/src/hooks/use-data.ts +45 -0
- package/src/hooks/use-delayed-loading.ts +21 -0
- package/src/types/dataform.ts +4 -0
|
@@ -30,12 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// packages/dataviews/src/components/dataform-layouts/card/index.tsx
|
|
31
31
|
var card_exports = {};
|
|
32
32
|
__export(card_exports, {
|
|
33
|
-
default: () => FormCardField
|
|
34
|
-
useCardHeader: () => useCardHeader
|
|
33
|
+
default: () => FormCardField
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(card_exports);
|
|
37
36
|
var import_components = require("@wordpress/components");
|
|
37
|
+
var import_compose = require("@wordpress/compose");
|
|
38
38
|
var import_element = require("@wordpress/element");
|
|
39
|
+
var import_i18n = require("@wordpress/i18n");
|
|
39
40
|
var import_icons = require("@wordpress/icons");
|
|
40
41
|
var import__ = require("../index.cjs");
|
|
41
42
|
var import_dataform_context = __toESM(require("../../dataform-context/index.cjs"));
|
|
@@ -45,87 +46,6 @@ var import_get_summary_fields = require("../get-summary-fields.cjs");
|
|
|
45
46
|
var import_use_report_validity = __toESM(require("../../../hooks/use-report-validity.cjs"));
|
|
46
47
|
var import_validation_badge = __toESM(require("../validation-badge.cjs"));
|
|
47
48
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
|
-
var NonCollapsibleCardHeader = ({
|
|
49
|
-
children,
|
|
50
|
-
...props
|
|
51
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.CardHeader, { isBorderless: true, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
-
"div",
|
|
53
|
-
{
|
|
54
|
-
style: {
|
|
55
|
-
height: "40px",
|
|
56
|
-
// This is to match the chevron's __next40pxDefaultSize
|
|
57
|
-
width: "100%",
|
|
58
|
-
display: "flex",
|
|
59
|
-
justifyContent: "space-between",
|
|
60
|
-
alignItems: "center"
|
|
61
|
-
},
|
|
62
|
-
children
|
|
63
|
-
}
|
|
64
|
-
) });
|
|
65
|
-
function useCardHeader(layout) {
|
|
66
|
-
const { isOpened, isCollapsible } = layout;
|
|
67
|
-
const [isOpen, setIsOpen] = (0, import_element.useState)(isOpened);
|
|
68
|
-
const [touched, setTouched] = (0, import_element.useState)(false);
|
|
69
|
-
(0, import_element.useEffect)(() => {
|
|
70
|
-
setIsOpen(isOpened);
|
|
71
|
-
}, [isOpened]);
|
|
72
|
-
const toggle = (0, import_element.useCallback)(() => {
|
|
73
|
-
if (isOpen) {
|
|
74
|
-
setTouched(true);
|
|
75
|
-
}
|
|
76
|
-
setIsOpen((prev) => !prev);
|
|
77
|
-
}, [isOpen]);
|
|
78
|
-
const CollapsibleCardHeader = (0, import_element.useCallback)(
|
|
79
|
-
({
|
|
80
|
-
children,
|
|
81
|
-
...props
|
|
82
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
83
|
-
import_components.CardHeader,
|
|
84
|
-
{
|
|
85
|
-
...props,
|
|
86
|
-
onClick: toggle,
|
|
87
|
-
style: {
|
|
88
|
-
cursor: "pointer",
|
|
89
|
-
...props.style
|
|
90
|
-
},
|
|
91
|
-
isBorderless: true,
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
-
"div",
|
|
95
|
-
{
|
|
96
|
-
style: {
|
|
97
|
-
width: "100%",
|
|
98
|
-
display: "flex",
|
|
99
|
-
justifyContent: "space-between",
|
|
100
|
-
alignItems: "center"
|
|
101
|
-
},
|
|
102
|
-
children
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
-
import_components.Button,
|
|
107
|
-
{
|
|
108
|
-
__next40pxDefaultSize: true,
|
|
109
|
-
variant: "tertiary",
|
|
110
|
-
icon: isOpen ? import_icons.chevronUp : import_icons.chevronDown,
|
|
111
|
-
"aria-expanded": isOpen,
|
|
112
|
-
"aria-label": isOpen ? "Collapse" : "Expand"
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
[toggle, isOpen]
|
|
119
|
-
);
|
|
120
|
-
const effectiveIsOpen = isCollapsible ? isOpen : true;
|
|
121
|
-
const CardHeaderComponent = isCollapsible ? CollapsibleCardHeader : NonCollapsibleCardHeader;
|
|
122
|
-
return {
|
|
123
|
-
isOpen: effectiveIsOpen,
|
|
124
|
-
CardHeader: CardHeaderComponent,
|
|
125
|
-
touched,
|
|
126
|
-
setTouched
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
49
|
function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
|
|
130
50
|
if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
|
|
131
51
|
return false;
|
|
@@ -162,6 +82,10 @@ function FormCardField({
|
|
|
162
82
|
const { fields } = (0, import_element.useContext)(import_dataform_context.default);
|
|
163
83
|
const layout = field.layout;
|
|
164
84
|
const cardBodyRef = (0, import_element.useRef)(null);
|
|
85
|
+
const bodyId = (0, import_compose.useInstanceId)(
|
|
86
|
+
FormCardField,
|
|
87
|
+
"dataforms-layouts-card-card-body"
|
|
88
|
+
);
|
|
165
89
|
const form = (0, import_element.useMemo)(
|
|
166
90
|
() => ({
|
|
167
91
|
layout: import_normalize_form.DEFAULT_LAYOUT,
|
|
@@ -169,7 +93,21 @@ function FormCardField({
|
|
|
169
93
|
}),
|
|
170
94
|
[field]
|
|
171
95
|
);
|
|
172
|
-
const {
|
|
96
|
+
const { isOpened, isCollapsible } = layout;
|
|
97
|
+
const [internalIsOpen, setIsOpen] = (0, import_element.useState)(isOpened);
|
|
98
|
+
const [touched, setTouched] = (0, import_element.useState)(false);
|
|
99
|
+
(0, import_element.useEffect)(() => {
|
|
100
|
+
setIsOpen(isOpened);
|
|
101
|
+
}, [isOpened]);
|
|
102
|
+
const toggle = (0, import_element.useCallback)(() => {
|
|
103
|
+
setIsOpen((prev) => {
|
|
104
|
+
if (prev) {
|
|
105
|
+
setTouched(true);
|
|
106
|
+
}
|
|
107
|
+
return !prev;
|
|
108
|
+
});
|
|
109
|
+
}, []);
|
|
110
|
+
const isOpen = isCollapsible ? internalIsOpen : true;
|
|
173
111
|
const handleBlur = (0, import_element.useCallback)(() => {
|
|
174
112
|
setTouched(true);
|
|
175
113
|
}, [setTouched]);
|
|
@@ -185,65 +123,48 @@ function FormCardField({
|
|
|
185
123
|
inlineStart: "medium",
|
|
186
124
|
inlineEnd: "medium"
|
|
187
125
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
withHeader2 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardHeader, { className: "dataforms-layouts-card__field-header", children: [
|
|
198
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: field.label }),
|
|
199
|
-
validationBadge,
|
|
200
|
-
visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
|
|
201
|
-
(summaryField) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
-
summaryField.render,
|
|
203
|
-
{
|
|
204
|
-
item: data,
|
|
205
|
-
field: summaryField
|
|
206
|
-
},
|
|
207
|
-
summaryField.id
|
|
208
|
-
)
|
|
209
|
-
) })
|
|
210
|
-
] }),
|
|
211
|
-
(isOpen || !withHeader2) && // If it doesn't have a header, keep it open.
|
|
212
|
-
// Otherwise, the card will not be visible.
|
|
213
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
214
|
-
import_components.CardBody,
|
|
126
|
+
let label = field.label;
|
|
127
|
+
let withHeader;
|
|
128
|
+
let bodyContent;
|
|
129
|
+
if (field.children) {
|
|
130
|
+
withHeader = !!label && layout.withHeader;
|
|
131
|
+
bodyContent = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
132
|
+
field.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
import_data_form_layout.DataFormLayout,
|
|
215
135
|
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
children: [
|
|
221
|
-
field.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
|
|
222
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
223
|
-
import_data_form_layout.DataFormLayout,
|
|
224
|
-
{
|
|
225
|
-
data,
|
|
226
|
-
form,
|
|
227
|
-
onChange,
|
|
228
|
-
validity: validity?.children
|
|
229
|
-
}
|
|
230
|
-
)
|
|
231
|
-
]
|
|
136
|
+
data,
|
|
137
|
+
form,
|
|
138
|
+
onChange,
|
|
139
|
+
validity: validity?.children
|
|
232
140
|
}
|
|
233
141
|
)
|
|
234
142
|
] });
|
|
143
|
+
} else {
|
|
144
|
+
const fieldDefinition = fields.find(
|
|
145
|
+
(fieldDef) => fieldDef.id === field.id
|
|
146
|
+
);
|
|
147
|
+
if (!fieldDefinition || !fieldDefinition.Edit) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const SingleFieldLayout = (0, import__.getFormFieldLayout)("regular")?.component;
|
|
151
|
+
if (!SingleFieldLayout) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
label = fieldDefinition.label;
|
|
155
|
+
withHeader = !!label && layout.withHeader;
|
|
156
|
+
bodyContent = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
SingleFieldLayout,
|
|
158
|
+
{
|
|
159
|
+
data,
|
|
160
|
+
field,
|
|
161
|
+
onChange,
|
|
162
|
+
hideLabelFromVision: hideLabelFromVision || withHeader,
|
|
163
|
+
markWhenOptional,
|
|
164
|
+
validity
|
|
165
|
+
}
|
|
166
|
+
);
|
|
235
167
|
}
|
|
236
|
-
const fieldDefinition = fields.find(
|
|
237
|
-
(fieldDef) => fieldDef.id === field.id
|
|
238
|
-
);
|
|
239
|
-
if (!fieldDefinition || !fieldDefinition.Edit) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
const RegularLayout = (0, import__.getFormFieldLayout)("regular")?.component;
|
|
243
|
-
if (!RegularLayout) {
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
const withHeader = !!fieldDefinition.label && layout.withHeader;
|
|
247
168
|
const sizeCardBody = {
|
|
248
169
|
blockStart: withHeader ? "none" : "medium",
|
|
249
170
|
blockEnd: "medium",
|
|
@@ -251,44 +172,71 @@ function FormCardField({
|
|
|
251
172
|
inlineEnd: "medium"
|
|
252
173
|
};
|
|
253
174
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.Card, { className: "dataforms-layouts-card__field", size: sizeCard, children: [
|
|
254
|
-
withHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
{
|
|
260
|
-
|
|
261
|
-
field: summaryField
|
|
175
|
+
withHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
176
|
+
import_components.CardHeader,
|
|
177
|
+
{
|
|
178
|
+
className: "dataforms-layouts-card__field-header",
|
|
179
|
+
onClick: isCollapsible ? toggle : void 0,
|
|
180
|
+
style: {
|
|
181
|
+
cursor: isCollapsible ? "pointer" : void 0
|
|
262
182
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
183
|
+
isBorderless: true,
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
style: {
|
|
189
|
+
// Match the expand/collapse button's height to avoid layout
|
|
190
|
+
// differences when that button is not displayed.
|
|
191
|
+
height: isCollapsible ? void 0 : "40px",
|
|
192
|
+
width: "100%",
|
|
193
|
+
display: "flex",
|
|
194
|
+
justifyContent: "space-between",
|
|
195
|
+
alignItems: "center"
|
|
196
|
+
},
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: label }),
|
|
199
|
+
validationBadge,
|
|
200
|
+
visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
|
|
201
|
+
(summaryField) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
+
summaryField.render,
|
|
203
|
+
{
|
|
204
|
+
item: data,
|
|
205
|
+
field: summaryField
|
|
206
|
+
},
|
|
207
|
+
summaryField.id
|
|
208
|
+
)
|
|
209
|
+
) })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
isCollapsible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
214
|
+
import_components.Button,
|
|
215
|
+
{
|
|
216
|
+
__next40pxDefaultSize: true,
|
|
217
|
+
variant: "tertiary",
|
|
218
|
+
icon: isOpen ? import_icons.chevronUp : import_icons.chevronDown,
|
|
219
|
+
"aria-expanded": isOpen,
|
|
220
|
+
"aria-controls": bodyId,
|
|
221
|
+
"aria-label": isOpen ? (0, import_i18n.__)("Collapse") : (0, import_i18n.__)("Expand")
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
),
|
|
266
227
|
(isOpen || !withHeader) && // If it doesn't have a header, keep it open.
|
|
267
228
|
// Otherwise, the card will not be visible.
|
|
268
229
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
269
230
|
import_components.CardBody,
|
|
270
231
|
{
|
|
232
|
+
id: bodyId,
|
|
271
233
|
size: sizeCardBody,
|
|
272
234
|
className: "dataforms-layouts-card__field-control",
|
|
273
235
|
ref: cardBodyRef,
|
|
274
236
|
onBlur: handleBlur,
|
|
275
|
-
children:
|
|
276
|
-
RegularLayout,
|
|
277
|
-
{
|
|
278
|
-
data,
|
|
279
|
-
field,
|
|
280
|
-
onChange,
|
|
281
|
-
hideLabelFromVision: hideLabelFromVision || withHeader,
|
|
282
|
-
markWhenOptional,
|
|
283
|
-
validity
|
|
284
|
-
}
|
|
285
|
-
)
|
|
237
|
+
children: bodyContent
|
|
286
238
|
}
|
|
287
239
|
)
|
|
288
240
|
] });
|
|
289
241
|
}
|
|
290
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
291
|
-
0 && (module.exports = {
|
|
292
|
-
useCardHeader
|
|
293
|
-
});
|
|
294
242
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/dataform-layouts/card/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCard,\n\tCardBody,\n\tCardHeader as OriginalCardHeader,\n} from '@wordpress/components';\nimport {\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getFormFieldLayout } from '..';\nimport DataFormContext from '../../dataform-context';\nimport type {\n\tFieldLayoutProps,\n\tNormalizedCardLayout,\n\tNormalizedField,\n\tNormalizedForm,\n\tNormalizedLayout,\n} from '../../../types';\nimport { DataFormLayout } from '../data-form-layout';\nimport { DEFAULT_LAYOUT } from '../normalize-form';\nimport { getSummaryFields } from '../get-summary-fields';\nimport useReportValidity from '../../../hooks/use-report-validity';\nimport ValidationBadge from '../validation-badge';\n\nconst NonCollapsibleCardHeader = ( {\n\tchildren,\n\t...props\n}: {\n\tchildren: React.ReactNode;\n} ) => (\n\t<OriginalCardHeader isBorderless { ...props }>\n\t\t<div\n\t\t\tstyle={ {\n\t\t\t\theight: '40px', // This is to match the chevron's __next40pxDefaultSize\n\t\t\t\twidth: '100%',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\talignItems: 'center',\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</div>\n\t</OriginalCardHeader>\n);\n\nexport function useCardHeader( layout: NormalizedCardLayout ) {\n\tconst { isOpened, isCollapsible } = layout;\n\tconst [ isOpen, setIsOpen ] = useState( isOpened );\n\tconst [ touched, setTouched ] = useState( false );\n\n\t// Sync internal state when the isOpened prop changes.\n\t// This is unlikely to happen in production, but it helps with storybook controls.\n\tuseEffect( () => {\n\t\tsetIsOpen( isOpened );\n\t}, [ isOpened ] );\n\n\tconst toggle = useCallback( () => {\n\t\t// Mark as touched when collapsing (going from open to closed)\n\t\tif ( isOpen ) {\n\t\t\tsetTouched( true );\n\t\t}\n\t\tsetIsOpen( ( prev ) => ! prev );\n\t}, [ isOpen ] );\n\n\tconst CollapsibleCardHeader = useCallback(\n\t\t( {\n\t\t\tchildren,\n\t\t\t...props\n\t\t}: {\n\t\t\tchildren: React.ReactNode;\n\t\t\t[ key: string ]: any;\n\t\t} ) => (\n\t\t\t<OriginalCardHeader\n\t\t\t\t{ ...props }\n\t\t\t\tonClick={ toggle }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t...props.style,\n\t\t\t\t} }\n\t\t\t\tisBorderless\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\ticon={ isOpen ? chevronUp : chevronDown }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-label={ isOpen ? 'Collapse' : 'Expand' }\n\t\t\t\t/>\n\t\t\t</OriginalCardHeader>\n\t\t),\n\t\t[ toggle, isOpen ]\n\t);\n\n\tconst effectiveIsOpen = isCollapsible ? isOpen : true;\n\tconst CardHeaderComponent = isCollapsible\n\t\t? CollapsibleCardHeader\n\t\t: NonCollapsibleCardHeader;\n\n\treturn {\n\t\tisOpen: effectiveIsOpen,\n\t\tCardHeader: CardHeaderComponent,\n\t\ttouched,\n\t\tsetTouched,\n\t};\n}\n\nfunction isSummaryFieldVisible< Item >(\n\tsummaryField: NormalizedField< Item >,\n\tsummaryConfig: NormalizedCardLayout[ 'summary' ],\n\tisOpen: boolean\n) {\n\t// If no summary config, dont't show any fields\n\tif (\n\t\t! summaryConfig ||\n\t\t( Array.isArray( summaryConfig ) && summaryConfig.length === 0 )\n\t) {\n\t\treturn false;\n\t}\n\n\t// Convert to array for consistent handling\n\tconst summaryConfigArray = Array.isArray( summaryConfig )\n\t\t? summaryConfig\n\t\t: [ summaryConfig ];\n\n\t// Find the config for this specific field\n\tconst fieldConfig = summaryConfigArray.find( ( config ) => {\n\t\tif ( typeof config === 'string' ) {\n\t\t\treturn config === summaryField.id;\n\t\t}\n\t\tif ( typeof config === 'object' && 'id' in config ) {\n\t\t\treturn config.id === summaryField.id;\n\t\t}\n\t\treturn false;\n\t} );\n\n\t// If field is not in summary config, don't show it\n\tif ( ! fieldConfig ) {\n\t\treturn false;\n\t}\n\n\t// If it's a string, always show it\n\tif ( typeof fieldConfig === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// If it has visibility rules, respect them\n\tif ( typeof fieldConfig === 'object' && 'visibility' in fieldConfig ) {\n\t\treturn (\n\t\t\tfieldConfig.visibility === 'always' ||\n\t\t\t( fieldConfig.visibility === 'when-collapsed' && ! isOpen )\n\t\t);\n\t}\n\n\t// Default to always show\n\treturn true;\n}\n\nexport default function FormCardField< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: FieldLayoutProps< Item > ) {\n\tconst { fields } = useContext( DataFormContext );\n\tconst layout = field.layout as NormalizedCardLayout;\n\tconst cardBodyRef = useRef< HTMLDivElement >( null );\n\n\tconst form: NormalizedForm = useMemo(\n\t\t() => ( {\n\t\t\tlayout: DEFAULT_LAYOUT as NormalizedLayout,\n\t\t\tfields: field.children ?? [],\n\t\t} ),\n\t\t[ field ]\n\t);\n\n\tconst { isOpen, CardHeader, touched, setTouched } = useCardHeader( layout );\n\n\t// Mark the card as touched when any field inside it is blurred.\n\t// This aligns with how validated controls show errors on blur.\n\tconst handleBlur = useCallback( () => {\n\t\tsetTouched( true );\n\t}, [ setTouched ] );\n\n\t// When the card is expanded after being touched (collapsed with errors),\n\t// trigger reportValidity to show field-level errors.\n\tuseReportValidity( cardBodyRef, isOpen && touched );\n\n\tconst summaryFields = getSummaryFields< Item >( layout.summary, fields );\n\n\tconst visibleSummaryFields = summaryFields.filter( ( summaryField ) =>\n\t\tisSummaryFieldVisible( summaryField, layout.summary, isOpen )\n\t);\n\n\tconst validationBadge =\n\t\ttouched && layout.isCollapsible ? (\n\t\t\t<ValidationBadge validity={ validity } />\n\t\t) : null;\n\n\tconst sizeCard = {\n\t\tblockStart: 'medium' as const,\n\t\tblockEnd: 'medium' as const,\n\t\tinlineStart: 'medium' as const,\n\t\tinlineEnd: 'medium' as const,\n\t};\n\n\tif ( !! field.children ) {\n\t\tconst withHeader = !! field.label && layout.withHeader;\n\n\t\tconst sizeCardBody = {\n\t\t\tblockStart: withHeader\n\t\t\t\t? ( 'none' as const )\n\t\t\t\t: ( 'medium' as const ),\n\t\t\tblockEnd: 'medium' as const,\n\t\t\tinlineStart: 'medium' as const,\n\t\t\tinlineEnd: 'medium' as const,\n\t\t};\n\n\t\treturn (\n\t\t\t<Card className=\"dataforms-layouts-card__field\" size={ sizeCard }>\n\t\t\t\t{ withHeader && (\n\t\t\t\t\t<CardHeader className=\"dataforms-layouts-card__field-header\">\n\t\t\t\t\t\t<span className=\"dataforms-layouts-card__field-header-label\">\n\t\t\t\t\t\t\t{ field.label }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ validationBadge }\n\t\t\t\t\t\t{ visibleSummaryFields.length > 0 &&\n\t\t\t\t\t\t\tlayout.withHeader && (\n\t\t\t\t\t\t\t\t<div className=\"dataforms-layouts-card__field-summary\">\n\t\t\t\t\t\t\t\t\t{ visibleSummaryFields.map(\n\t\t\t\t\t\t\t\t\t\t( summaryField ) => (\n\t\t\t\t\t\t\t\t\t\t\t<summaryField.render\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ summaryField.id }\n\t\t\t\t\t\t\t\t\t\t\t\titem={ data }\n\t\t\t\t\t\t\t\t\t\t\t\tfield={ summaryField }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</CardHeader>\n\t\t\t\t) }\n\t\t\t\t{ ( isOpen || ! withHeader ) && (\n\t\t\t\t\t// If it doesn't have a header, keep it open.\n\t\t\t\t\t// Otherwise, the card will not be visible.\n\t\t\t\t\t<CardBody\n\t\t\t\t\t\tsize={ sizeCardBody }\n\t\t\t\t\t\tclassName=\"dataforms-layouts-card__field-control\"\n\t\t\t\t\t\tref={ cardBodyRef }\n\t\t\t\t\t\tonBlur={ handleBlur }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ field.description && (\n\t\t\t\t\t\t\t<div className=\"dataforms-layouts-card__field-description\">\n\t\t\t\t\t\t\t\t{ field.description }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<DataFormLayout\n\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tvalidity={ validity?.children }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</CardBody>\n\t\t\t\t) }\n\t\t\t</Card>\n\t\t);\n\t}\n\n\tconst fieldDefinition = fields.find(\n\t\t( fieldDef ) => fieldDef.id === field.id\n\t);\n\n\tif ( ! fieldDefinition || ! fieldDefinition.Edit ) {\n\t\treturn null;\n\t}\n\n\tconst RegularLayout = getFormFieldLayout( 'regular' )?.component;\n\tif ( ! RegularLayout ) {\n\t\treturn null;\n\t}\n\tconst withHeader = !! fieldDefinition.label && layout.withHeader;\n\n\tconst sizeCardBody = {\n\t\tblockStart: withHeader ? ( 'none' as const ) : ( 'medium' as const ),\n\t\tblockEnd: 'medium' as const,\n\t\tinlineStart: 'medium' as const,\n\t\tinlineEnd: 'medium' as const,\n\t};\n\n\treturn (\n\t\t<Card className=\"dataforms-layouts-card__field\" size={ sizeCard }>\n\t\t\t{ withHeader && (\n\t\t\t\t<CardHeader className=\"dataforms-layouts-card__field-header\">\n\t\t\t\t\t<span className=\"dataforms-layouts-card__field-header-label\">\n\t\t\t\t\t\t{ fieldDefinition.label }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ validationBadge }\n\t\t\t\t\t{ visibleSummaryFields.length > 0 && layout.withHeader && (\n\t\t\t\t\t\t<div className=\"dataforms-layouts-card__field-summary\">\n\t\t\t\t\t\t\t{ visibleSummaryFields.map( ( summaryField ) => (\n\t\t\t\t\t\t\t\t<summaryField.render\n\t\t\t\t\t\t\t\t\tkey={ summaryField.id }\n\t\t\t\t\t\t\t\t\titem={ data }\n\t\t\t\t\t\t\t\t\tfield={ summaryField }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</CardHeader>\n\t\t\t) }\n\t\t\t{ ( isOpen || ! withHeader ) && (\n\t\t\t\t// If it doesn't have a header, keep it open.\n\t\t\t\t// Otherwise, the card will not be visible.\n\t\t\t\t<CardBody\n\t\t\t\t\tsize={ sizeCardBody }\n\t\t\t\t\tclassName=\"dataforms-layouts-card__field-control\"\n\t\t\t\t\tref={ cardBodyRef }\n\t\t\t\t\tonBlur={ handleBlur }\n\t\t\t\t>\n\t\t\t\t\t<RegularLayout\n\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\tfield={ field }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\thideLabelFromVision={\n\t\t\t\t\t\t\thideLabelFromVision || withHeader\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\t\t\tvalidity={ validity }\n\t\t\t\t\t/>\n\t\t\t\t</CardBody>\n\t\t\t) }\n\t\t</Card>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCard,\n\tCardBody,\n\tCardHeader as OriginalCardHeader,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getFormFieldLayout } from '..';\nimport DataFormContext from '../../dataform-context';\nimport type {\n\tFieldLayoutProps,\n\tNormalizedCardLayout,\n\tNormalizedField,\n\tNormalizedForm,\n\tNormalizedLayout,\n} from '../../../types';\nimport { DataFormLayout } from '../data-form-layout';\nimport { DEFAULT_LAYOUT } from '../normalize-form';\nimport { getSummaryFields } from '../get-summary-fields';\nimport useReportValidity from '../../../hooks/use-report-validity';\nimport ValidationBadge from '../validation-badge';\n\nfunction isSummaryFieldVisible< Item >(\n\tsummaryField: NormalizedField< Item >,\n\tsummaryConfig: NormalizedCardLayout[ 'summary' ],\n\tisOpen: boolean\n) {\n\t// If no summary config, dont't show any fields\n\tif (\n\t\t! summaryConfig ||\n\t\t( Array.isArray( summaryConfig ) && summaryConfig.length === 0 )\n\t) {\n\t\treturn false;\n\t}\n\n\t// Convert to array for consistent handling\n\tconst summaryConfigArray = Array.isArray( summaryConfig )\n\t\t? summaryConfig\n\t\t: [ summaryConfig ];\n\n\t// Find the config for this specific field\n\tconst fieldConfig = summaryConfigArray.find( ( config ) => {\n\t\tif ( typeof config === 'string' ) {\n\t\t\treturn config === summaryField.id;\n\t\t}\n\t\tif ( typeof config === 'object' && 'id' in config ) {\n\t\t\treturn config.id === summaryField.id;\n\t\t}\n\t\treturn false;\n\t} );\n\n\t// If field is not in summary config, don't show it\n\tif ( ! fieldConfig ) {\n\t\treturn false;\n\t}\n\n\t// If it's a string, always show it\n\tif ( typeof fieldConfig === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// If it has visibility rules, respect them\n\tif ( typeof fieldConfig === 'object' && 'visibility' in fieldConfig ) {\n\t\treturn (\n\t\t\tfieldConfig.visibility === 'always' ||\n\t\t\t( fieldConfig.visibility === 'when-collapsed' && ! isOpen )\n\t\t);\n\t}\n\n\t// Default to always show\n\treturn true;\n}\n\nexport default function FormCardField< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: FieldLayoutProps< Item > ) {\n\tconst { fields } = useContext( DataFormContext );\n\tconst layout = field.layout as NormalizedCardLayout;\n\tconst cardBodyRef = useRef< HTMLDivElement >( null );\n\tconst bodyId = useInstanceId(\n\t\tFormCardField,\n\t\t'dataforms-layouts-card-card-body'\n\t);\n\n\tconst form: NormalizedForm = useMemo(\n\t\t() => ( {\n\t\t\tlayout: DEFAULT_LAYOUT as NormalizedLayout,\n\t\t\tfields: field.children ?? [],\n\t\t} ),\n\t\t[ field ]\n\t);\n\n\tconst { isOpened, isCollapsible } = layout;\n\tconst [ internalIsOpen, setIsOpen ] = useState( isOpened );\n\tconst [ touched, setTouched ] = useState( false );\n\n\t// Sync internal state when the isOpened prop changes.\n\t// This is unlikely to happen in production, but it helps with storybook controls.\n\tuseEffect( () => {\n\t\tsetIsOpen( isOpened );\n\t}, [ isOpened ] );\n\n\tconst toggle = useCallback( () => {\n\t\tsetIsOpen( ( prev ) => {\n\t\t\t// Mark as touched when collapsing (going from open to closed)\n\t\t\tif ( prev ) {\n\t\t\t\tsetTouched( true );\n\t\t\t}\n\t\t\treturn ! prev;\n\t\t} );\n\t}, [] );\n\n\tconst isOpen = isCollapsible ? internalIsOpen : true;\n\n\t// Mark the card as touched when any field inside it is blurred.\n\t// This aligns with how validated controls show errors on blur.\n\tconst handleBlur = useCallback( () => {\n\t\tsetTouched( true );\n\t}, [ setTouched ] );\n\n\t// When the card is expanded after being touched (collapsed with errors),\n\t// trigger reportValidity to show field-level errors.\n\tuseReportValidity( cardBodyRef, isOpen && touched );\n\n\tconst summaryFields = getSummaryFields< Item >( layout.summary, fields );\n\n\tconst visibleSummaryFields = summaryFields.filter( ( summaryField ) =>\n\t\tisSummaryFieldVisible( summaryField, layout.summary, isOpen )\n\t);\n\n\tconst validationBadge =\n\t\ttouched && layout.isCollapsible ? (\n\t\t\t<ValidationBadge validity={ validity } />\n\t\t) : null;\n\n\tconst sizeCard = {\n\t\tblockStart: 'medium' as const,\n\t\tblockEnd: 'medium' as const,\n\t\tinlineStart: 'medium' as const,\n\t\tinlineEnd: 'medium' as const,\n\t};\n\n\tlet label = field.label;\n\tlet withHeader: boolean;\n\tlet bodyContent: React.ReactNode;\n\n\tif ( field.children ) {\n\t\twithHeader = !! label && layout.withHeader;\n\t\tbodyContent = (\n\t\t\t<>\n\t\t\t\t{ field.description && (\n\t\t\t\t\t<div className=\"dataforms-layouts-card__field-description\">\n\t\t\t\t\t\t{ field.description }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<DataFormLayout\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tvalidity={ validity?.children }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t} else {\n\t\tconst fieldDefinition = fields.find(\n\t\t\t( fieldDef ) => fieldDef.id === field.id\n\t\t);\n\n\t\tif ( ! fieldDefinition || ! fieldDefinition.Edit ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst SingleFieldLayout = getFormFieldLayout( 'regular' )?.component;\n\t\tif ( ! SingleFieldLayout ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlabel = fieldDefinition.label;\n\t\twithHeader = !! label && layout.withHeader;\n\t\tbodyContent = (\n\t\t\t<SingleFieldLayout\n\t\t\t\tdata={ data }\n\t\t\t\tfield={ field }\n\t\t\t\tonChange={ onChange }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision || withHeader }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tvalidity={ validity }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst sizeCardBody = {\n\t\tblockStart: withHeader ? ( 'none' as const ) : ( 'medium' as const ),\n\t\tblockEnd: 'medium' as const,\n\t\tinlineStart: 'medium' as const,\n\t\tinlineEnd: 'medium' as const,\n\t};\n\n\treturn (\n\t\t<Card className=\"dataforms-layouts-card__field\" size={ sizeCard }>\n\t\t\t{ withHeader && (\n\t\t\t\t<OriginalCardHeader\n\t\t\t\t\tclassName=\"dataforms-layouts-card__field-header\"\n\t\t\t\t\tonClick={ isCollapsible ? toggle : undefined }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tcursor: isCollapsible ? 'pointer' : undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tisBorderless\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t// Match the expand/collapse button's height to avoid layout\n\t\t\t\t\t\t\t// differences when that button is not displayed.\n\t\t\t\t\t\t\theight: isCollapsible ? undefined : '40px',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"dataforms-layouts-card__field-header-label\">\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ validationBadge }\n\t\t\t\t\t\t{ visibleSummaryFields.length > 0 &&\n\t\t\t\t\t\t\tlayout.withHeader && (\n\t\t\t\t\t\t\t\t<div className=\"dataforms-layouts-card__field-summary\">\n\t\t\t\t\t\t\t\t\t{ visibleSummaryFields.map(\n\t\t\t\t\t\t\t\t\t\t( summaryField ) => (\n\t\t\t\t\t\t\t\t\t\t\t<summaryField.render\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ summaryField.id }\n\t\t\t\t\t\t\t\t\t\t\t\titem={ data }\n\t\t\t\t\t\t\t\t\t\t\t\tfield={ summaryField }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ isCollapsible && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\ticon={ isOpen ? chevronUp : chevronDown }\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-controls={ bodyId }\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\tisOpen ? __( 'Collapse' ) : __( 'Expand' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</OriginalCardHeader>\n\t\t\t) }\n\t\t\t{ ( isOpen || ! withHeader ) && (\n\t\t\t\t// If it doesn't have a header, keep it open.\n\t\t\t\t// Otherwise, the card will not be visible.\n\t\t\t\t<CardBody\n\t\t\t\t\tid={ bodyId }\n\t\t\t\t\tsize={ sizeCardBody }\n\t\t\t\t\tclassName=\"dataforms-layouts-card__field-control\"\n\t\t\t\t\tref={ cardBodyRef }\n\t\t\t\t\tonBlur={ handleBlur }\n\t\t\t\t>\n\t\t\t\t\t{ bodyContent }\n\t\t\t\t</CardBody>\n\t\t\t) }\n\t\t</Card>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["DataFormContext", "useReportValidity", "ValidationBadge", "OriginalCardHeader"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-layouts/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport type { NormalizedLayout, NormalizedRowLayout } from '../../types';\nimport FormRegularField from './regular';\nimport FormPanelField from './panel';\nimport FormCardField from './card';\nimport FormRowField from './row';\nimport FormDetailsField from './details';\n\nconst FORM_FIELD_LAYOUTS = [\n\t{\n\t\ttype: 'regular',\n\t\tcomponent: FormRegularField,\n\t\twrapper: ( { children }: { children: React.ReactNode } ) => (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tclassName=\"dataforms-layouts__wrapper\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Stack>\n\t\t),\n\t},\n\t{\n\t\ttype: 'panel',\n\t\tcomponent: FormPanelField,\n\t\twrapper: ( { children }: { children: React.ReactNode } ) => (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tclassName=\"dataforms-layouts__wrapper\"\n\t\t\t\tgap=\"
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport type { NormalizedLayout, NormalizedRowLayout } from '../../types';\nimport FormRegularField from './regular';\nimport FormPanelField from './panel';\nimport FormCardField from './card';\nimport FormRowField from './row';\nimport FormDetailsField from './details';\n\nconst FORM_FIELD_LAYOUTS = [\n\t{\n\t\ttype: 'regular',\n\t\tcomponent: FormRegularField,\n\t\twrapper: ( { children }: { children: React.ReactNode } ) => (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tclassName=\"dataforms-layouts__wrapper\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Stack>\n\t\t),\n\t},\n\t{\n\t\ttype: 'panel',\n\t\tcomponent: FormPanelField,\n\t\twrapper: ( { children }: { children: React.ReactNode } ) => (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tclassName=\"dataforms-layouts__wrapper\"\n\t\t\t\tgap=\"md\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Stack>\n\t\t),\n\t},\n\t{\n\t\ttype: 'card',\n\t\tcomponent: FormCardField,\n\t\twrapper: ( { children }: { children: React.ReactNode } ) => (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tclassName=\"dataforms-layouts__wrapper\"\n\t\t\t\tgap=\"xl\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Stack>\n\t\t),\n\t},\n\t{\n\t\ttype: 'row',\n\t\tcomponent: FormRowField,\n\t\twrapper: ( {\n\t\t\tchildren,\n\t\t\tlayout,\n\t\t}: {\n\t\t\tchildren: React.ReactNode;\n\t\t\tlayout: NormalizedLayout;\n\t\t} ) => (\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tclassName=\"dataforms-layouts__wrapper\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t<div className=\"dataforms-layouts-row__field\">\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\t\talign={ ( layout as NormalizedRowLayout ).alignment }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t),\n\t},\n\t{\n\t\ttype: 'details',\n\t\tcomponent: FormDetailsField,\n\t},\n];\n\nexport function getFormFieldLayout( type: string ) {\n\treturn FORM_FIELD_LAYOUTS.find( ( layout ) => layout.type === type );\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAAsB;AAMtB,qBAA6B;AAC7B,mBAA2B;AAC3B,kBAA0B;AAC1B,iBAAyB;AACzB,qBAA6B;AAO1B;AALH,IAAM,qBAAqB;AAAA,EAC1B;AAAA,IACC,MAAM;AAAA,IACN,WAAW,eAAAA;AAAA,IACX,SAAS,CAAE,EAAE,SAAS,MACrB;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,WAAU;AAAA,QACV,KAAI;AAAA,QAEF;AAAA;AAAA,IACH;AAAA,EAEF;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAW,aAAAC;AAAA,IACX,SAAS,CAAE,EAAE,SAAS,MACrB;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,WAAU;AAAA,QACV,KAAI;AAAA,QAEF;AAAA;AAAA,IACH;AAAA,EAEF;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAW,YAAAC;AAAA,IACX,SAAS,CAAE,EAAE,SAAS,MACrB;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,WAAU;AAAA,QACV,KAAI;AAAA,QAEF;AAAA;AAAA,IACH;AAAA,EAEF;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAW,WAAAC;AAAA,IACX,SAAS,CAAE;AAAA,MACV;AAAA,MACA;AAAA,IACD,MAIC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,WAAU;AAAA,QACV,KAAI;AAAA,QAEJ,sDAAC,SAAI,WAAU,gCACd;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,KAAI;AAAA,YACJ,OAAU,OAAgC;AAAA,YAExC;AAAA;AAAA,QACH,GACD;AAAA;AAAA,IACD;AAAA,EAEF;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAW,eAAAC;AAAA,EACZ;AACD;AAEO,SAAS,mBAAoB,MAAe;AAClD,SAAO,mBAAmB,KAAM,CAAE,WAAY,OAAO,SAAS,IAAK;AACpE;",
|
|
6
6
|
"names": ["FormRegularField", "FormPanelField", "FormCardField", "FormRowField", "FormDetailsField"]
|
|
7
7
|
}
|
|
@@ -53,7 +53,8 @@ function normalizeLayout(layout) {
|
|
|
53
53
|
type: "panel",
|
|
54
54
|
labelPosition: layout?.labelPosition ?? "side",
|
|
55
55
|
openAs: layout?.openAs ?? "dropdown",
|
|
56
|
-
summary: normalizedSummary
|
|
56
|
+
summary: normalizedSummary,
|
|
57
|
+
editVisibility: layout?.editVisibility ?? "on-hover"
|
|
57
58
|
};
|
|
58
59
|
} else if (layout?.type === "card") {
|
|
59
60
|
if (layout.withHeader === false) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-layouts/normalize-form.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tForm,\n\tLayout,\n\tNormalizedForm,\n\tNormalizedFormField,\n\tNormalizedLayout,\n\tNormalizedRegularLayout,\n\tNormalizedPanelLayout,\n\tNormalizedCardLayout,\n\tNormalizedRowLayout,\n\tNormalizedDetailsLayout,\n\tNormalizedCardSummaryField,\n\tCardSummaryField,\n} from '../../types';\n\nexport const DEFAULT_LAYOUT: NormalizedLayout = {\n\ttype: 'regular',\n\tlabelPosition: 'top',\n} as NormalizedRegularLayout;\n\nconst normalizeCardSummaryField = (\n\tsum: CardSummaryField\n): NormalizedCardSummaryField => {\n\tif ( typeof sum === 'string' ) {\n\t\treturn [ { id: sum, visibility: 'when-collapsed' } ];\n\t}\n\treturn sum.map( ( item ) => {\n\t\tif ( typeof item === 'string' ) {\n\t\t\treturn { id: item, visibility: 'when-collapsed' };\n\t\t}\n\t\treturn { id: item.id, visibility: item.visibility };\n\t} );\n};\n\n/**\n * Normalizes a layout configuration based on its type.\n *\n * @param layout The layout object to normalize.\n * @return The normalized layout object.\n */\nfunction normalizeLayout( layout?: Layout ): NormalizedLayout {\n\tlet normalizedLayout = DEFAULT_LAYOUT;\n\n\tif ( layout?.type === 'regular' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'regular',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'top',\n\t\t} satisfies NormalizedRegularLayout;\n\t} else if ( layout?.type === 'panel' ) {\n\t\tconst summary = layout.summary ?? [];\n\t\tconst normalizedSummary = Array.isArray( summary )\n\t\t\t? summary\n\t\t\t: [ summary ];\n\n\t\tnormalizedLayout = {\n\t\t\ttype: 'panel',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'side',\n\t\t\topenAs: layout?.openAs ?? 'dropdown',\n\t\t\tsummary: normalizedSummary,\n\t\t} satisfies NormalizedPanelLayout;\n\t} else if ( layout?.type === 'card' ) {\n\t\tif ( layout.withHeader === false ) {\n\t\t\t// Don't let isOpened be false if withHeader is false.\n\t\t\t// Otherwise, the card will not be visible.\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: false,\n\t\t\t\tisOpened: true,\n\t\t\t\tsummary: [],\n\t\t\t\tisCollapsible: false,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t} else {\n\t\t\tconst summary = layout.summary ?? [];\n\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: true,\n\t\t\t\tisOpened:\n\t\t\t\t\ttypeof layout.isOpened === 'boolean'\n\t\t\t\t\t\t? layout.isOpened\n\t\t\t\t\t\t: true,\n\t\t\t\tsummary: normalizeCardSummaryField( summary ),\n\t\t\t\tisCollapsible:\n\t\t\t\t\tlayout.isCollapsible === undefined\n\t\t\t\t\t\t? true\n\t\t\t\t\t\t: layout.isCollapsible,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t}\n\t} else if ( layout?.type === 'row' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'row',\n\t\t\talignment: layout?.alignment ?? 'center',\n\t\t\tstyles: layout?.styles ?? {},\n\t\t} satisfies NormalizedRowLayout;\n\t} else if ( layout?.type === 'details' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'details',\n\t\t\tsummary: layout?.summary ?? '',\n\t\t} satisfies NormalizedDetailsLayout;\n\t}\n\n\treturn normalizedLayout;\n}\n\nfunction normalizeForm( form: Form ): NormalizedForm {\n\tconst normalizedFormLayout = normalizeLayout( form?.layout );\n\n\tconst normalizedFields: NormalizedFormField[] = ( form.fields ?? [] ).map(\n\t\t( field ) => {\n\t\t\tif ( typeof field === 'string' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: field,\n\t\t\t\t\tlayout: normalizedFormLayout,\n\t\t\t\t} satisfies NormalizedFormField;\n\t\t\t}\n\n\t\t\tconst fieldLayout = field.layout\n\t\t\t\t? normalizeLayout( field.layout )\n\t\t\t\t: normalizedFormLayout;\n\n\t\t\treturn {\n\t\t\t\tid: field.id,\n\t\t\t\tlayout: fieldLayout,\n\t\t\t\t...( !! field.label && { label: field.label } ),\n\t\t\t\t...( !! field.description && {\n\t\t\t\t\tdescription: field.description,\n\t\t\t\t} ),\n\t\t\t\t...( 'children' in field &&\n\t\t\t\t\tArray.isArray( field.children ) && {\n\t\t\t\t\t\tchildren: normalizeForm( {\n\t\t\t\t\t\t\tfields: field.children,\n\t\t\t\t\t\t\tlayout: DEFAULT_LAYOUT,\n\t\t\t\t\t\t} ).fields,\n\t\t\t\t\t} ),\n\t\t\t} satisfies NormalizedFormField;\n\t\t}\n\t);\n\n\treturn {\n\t\tlayout: normalizedFormLayout,\n\t\tfields: normalizedFields,\n\t};\n}\n\nexport default normalizeForm;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,IAAM,iBAAmC;AAAA,EAC/C,MAAM;AAAA,EACN,eAAe;AAChB;AAEA,IAAM,4BAA4B,CACjC,QACgC;AAChC,MAAK,OAAO,QAAQ,UAAW;AAC9B,WAAO,CAAE,EAAE,IAAI,KAAK,YAAY,iBAAiB,CAAE;AAAA,EACpD;AACA,SAAO,IAAI,IAAK,CAAE,SAAU;AAC3B,QAAK,OAAO,SAAS,UAAW;AAC/B,aAAO,EAAE,IAAI,MAAM,YAAY,iBAAiB;AAAA,IACjD;AACA,WAAO,EAAE,IAAI,KAAK,IAAI,YAAY,KAAK,WAAW;AAAA,EACnD,CAAE;AACH;AAQA,SAAS,gBAAiB,QAAoC;AAC7D,MAAI,mBAAmB;AAEvB,MAAK,QAAQ,SAAS,WAAY;AACjC,uBAAmB;AAAA,MAClB,MAAM;AAAA,MACN,eAAe,QAAQ,iBAAiB;AAAA,IACzC;AAAA,EACD,WAAY,QAAQ,SAAS,SAAU;AACtC,UAAM,UAAU,OAAO,WAAW,CAAC;AACnC,UAAM,oBAAoB,MAAM,QAAS,OAAQ,IAC9C,UACA,CAAE,OAAQ;AAEb,uBAAmB;AAAA,MAClB,MAAM;AAAA,MACN,eAAe,QAAQ,iBAAiB;AAAA,MACxC,QAAQ,QAAQ,UAAU;AAAA,MAC1B,SAAS;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tForm,\n\tLayout,\n\tNormalizedForm,\n\tNormalizedFormField,\n\tNormalizedLayout,\n\tNormalizedRegularLayout,\n\tNormalizedPanelLayout,\n\tNormalizedCardLayout,\n\tNormalizedRowLayout,\n\tNormalizedDetailsLayout,\n\tNormalizedCardSummaryField,\n\tCardSummaryField,\n} from '../../types';\n\nexport const DEFAULT_LAYOUT: NormalizedLayout = {\n\ttype: 'regular',\n\tlabelPosition: 'top',\n} as NormalizedRegularLayout;\n\nconst normalizeCardSummaryField = (\n\tsum: CardSummaryField\n): NormalizedCardSummaryField => {\n\tif ( typeof sum === 'string' ) {\n\t\treturn [ { id: sum, visibility: 'when-collapsed' } ];\n\t}\n\treturn sum.map( ( item ) => {\n\t\tif ( typeof item === 'string' ) {\n\t\t\treturn { id: item, visibility: 'when-collapsed' };\n\t\t}\n\t\treturn { id: item.id, visibility: item.visibility };\n\t} );\n};\n\n/**\n * Normalizes a layout configuration based on its type.\n *\n * @param layout The layout object to normalize.\n * @return The normalized layout object.\n */\nfunction normalizeLayout( layout?: Layout ): NormalizedLayout {\n\tlet normalizedLayout = DEFAULT_LAYOUT;\n\n\tif ( layout?.type === 'regular' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'regular',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'top',\n\t\t} satisfies NormalizedRegularLayout;\n\t} else if ( layout?.type === 'panel' ) {\n\t\tconst summary = layout.summary ?? [];\n\t\tconst normalizedSummary = Array.isArray( summary )\n\t\t\t? summary\n\t\t\t: [ summary ];\n\n\t\tnormalizedLayout = {\n\t\t\ttype: 'panel',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'side',\n\t\t\topenAs: layout?.openAs ?? 'dropdown',\n\t\t\tsummary: normalizedSummary,\n\t\t\teditVisibility: layout?.editVisibility ?? 'on-hover',\n\t\t} satisfies NormalizedPanelLayout;\n\t} else if ( layout?.type === 'card' ) {\n\t\tif ( layout.withHeader === false ) {\n\t\t\t// Don't let isOpened be false if withHeader is false.\n\t\t\t// Otherwise, the card will not be visible.\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: false,\n\t\t\t\tisOpened: true,\n\t\t\t\tsummary: [],\n\t\t\t\tisCollapsible: false,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t} else {\n\t\t\tconst summary = layout.summary ?? [];\n\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: true,\n\t\t\t\tisOpened:\n\t\t\t\t\ttypeof layout.isOpened === 'boolean'\n\t\t\t\t\t\t? layout.isOpened\n\t\t\t\t\t\t: true,\n\t\t\t\tsummary: normalizeCardSummaryField( summary ),\n\t\t\t\tisCollapsible:\n\t\t\t\t\tlayout.isCollapsible === undefined\n\t\t\t\t\t\t? true\n\t\t\t\t\t\t: layout.isCollapsible,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t}\n\t} else if ( layout?.type === 'row' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'row',\n\t\t\talignment: layout?.alignment ?? 'center',\n\t\t\tstyles: layout?.styles ?? {},\n\t\t} satisfies NormalizedRowLayout;\n\t} else if ( layout?.type === 'details' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'details',\n\t\t\tsummary: layout?.summary ?? '',\n\t\t} satisfies NormalizedDetailsLayout;\n\t}\n\n\treturn normalizedLayout;\n}\n\nfunction normalizeForm( form: Form ): NormalizedForm {\n\tconst normalizedFormLayout = normalizeLayout( form?.layout );\n\n\tconst normalizedFields: NormalizedFormField[] = ( form.fields ?? [] ).map(\n\t\t( field ) => {\n\t\t\tif ( typeof field === 'string' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: field,\n\t\t\t\t\tlayout: normalizedFormLayout,\n\t\t\t\t} satisfies NormalizedFormField;\n\t\t\t}\n\n\t\t\tconst fieldLayout = field.layout\n\t\t\t\t? normalizeLayout( field.layout )\n\t\t\t\t: normalizedFormLayout;\n\n\t\t\treturn {\n\t\t\t\tid: field.id,\n\t\t\t\tlayout: fieldLayout,\n\t\t\t\t...( !! field.label && { label: field.label } ),\n\t\t\t\t...( !! field.description && {\n\t\t\t\t\tdescription: field.description,\n\t\t\t\t} ),\n\t\t\t\t...( 'children' in field &&\n\t\t\t\t\tArray.isArray( field.children ) && {\n\t\t\t\t\t\tchildren: normalizeForm( {\n\t\t\t\t\t\t\tfields: field.children,\n\t\t\t\t\t\t\tlayout: DEFAULT_LAYOUT,\n\t\t\t\t\t\t} ).fields,\n\t\t\t\t\t} ),\n\t\t\t} satisfies NormalizedFormField;\n\t\t}\n\t);\n\n\treturn {\n\t\tlayout: normalizedFormLayout,\n\t\tfields: normalizedFields,\n\t};\n}\n\nexport default normalizeForm;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|