@wordpress/dataviews 8.0.1-next.e256d081a.0 → 9.0.1-next.6870dfe5b.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 +24 -1
- package/README.md +96 -1
- package/build/components/dataform-context/index.js +1 -0
- package/build/components/dataform-context/index.js.map +1 -1
- package/build/components/dataviews/index.js +11 -1
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews-context/index.js +1 -0
- package/build/components/dataviews-context/index.js.map +1 -1
- package/build/components/dataviews-layout/index.js +2 -1
- package/build/components/dataviews-layout/index.js.map +1 -1
- package/build/components/dataviews-picker/footer.js +145 -0
- package/build/components/dataviews-picker/footer.js.map +1 -0
- package/build/components/dataviews-picker/index.js +201 -0
- package/build/components/dataviews-picker/index.js.map +1 -0
- package/build/components/dataviews-selection-checkbox/index.js +4 -2
- package/build/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build/components/dataviews-view-config/index.js +1 -0
- package/build/components/dataviews-view-config/index.js.map +1 -1
- package/build/constants.js +4 -1
- package/build/constants.js.map +1 -1
- package/build/dataform-controls/checkbox.js +23 -2
- package/build/dataform-controls/checkbox.js.map +1 -1
- package/build/dataform-controls/color.js +128 -0
- package/build/dataform-controls/color.js.map +1 -0
- package/build/dataform-controls/email.js +10 -45
- package/build/dataform-controls/email.js.map +1 -1
- package/build/dataform-controls/index.js +8 -2
- package/build/dataform-controls/index.js.map +1 -1
- package/build/dataform-controls/telephone.js +34 -0
- package/build/dataform-controls/telephone.js.map +1 -0
- package/build/dataform-controls/text.js +7 -48
- package/build/dataform-controls/text.js.map +1 -1
- package/build/dataform-controls/{boolean.js → toggle.js} +6 -4
- package/build/dataform-controls/toggle.js.map +1 -0
- package/build/dataform-controls/url.js +34 -0
- package/build/dataform-controls/url.js.map +1 -0
- package/build/dataform-controls/utils/validated-text.js +76 -0
- package/build/dataform-controls/utils/validated-text.js.map +1 -0
- package/build/dataforms-layouts/card/index.js +6 -7
- package/build/dataforms-layouts/card/index.js.map +1 -1
- package/build/dataforms-layouts/data-form-layout.js +16 -4
- package/build/dataforms-layouts/data-form-layout.js.map +1 -1
- package/build/dataforms-layouts/index.js +31 -1
- package/build/dataforms-layouts/index.js.map +1 -1
- package/build/dataforms-layouts/row/index.js +113 -0
- package/build/dataforms-layouts/row/index.js.map +1 -0
- package/build/dataviews-layouts/grid/index.js +16 -11
- package/build/dataviews-layouts/grid/index.js.map +1 -1
- package/build/dataviews-layouts/index.js +9 -1
- package/build/dataviews-layouts/index.js.map +1 -1
- package/build/dataviews-layouts/picker-grid/index.js +357 -0
- package/build/dataviews-layouts/picker-grid/index.js.map +1 -0
- package/build/dataviews-layouts/utils/grid-items.js +37 -0
- package/build/dataviews-layouts/utils/grid-items.js.map +1 -0
- package/build/dataviews-layouts/utils/preview-size-picker.js +81 -0
- package/build/dataviews-layouts/utils/preview-size-picker.js.map +1 -0
- package/build/field-types/boolean.js +1 -1
- package/build/field-types/boolean.js.map +1 -1
- package/build/field-types/color.js +113 -0
- package/build/field-types/color.js.map +1 -0
- package/build/field-types/index.js +12 -0
- package/build/field-types/index.js.map +1 -1
- package/build/field-types/telephone.js +57 -0
- package/build/field-types/telephone.js.map +1 -0
- package/build/field-types/url.js +57 -0
- package/build/field-types/url.js.map +1 -0
- package/build/normalize-form-fields.js +6 -0
- package/build/normalize-form-fields.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build/validation.js +1 -1
- package/build/validation.js.map +1 -1
- package/build-module/components/dataform-context/index.js +1 -0
- package/build-module/components/dataform-context/index.js.map +1 -1
- package/build-module/components/dataviews/index.js +11 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews-context/index.js +1 -0
- package/build-module/components/dataviews-context/index.js.map +1 -1
- package/build-module/components/dataviews-layout/index.js +2 -1
- package/build-module/components/dataviews-layout/index.js.map +1 -1
- package/build-module/components/dataviews-picker/footer.js +136 -0
- package/build-module/components/dataviews-picker/footer.js.map +1 -0
- package/build-module/components/dataviews-picker/index.js +191 -0
- package/build-module/components/dataviews-picker/index.js.map +1 -0
- package/build-module/components/dataviews-selection-checkbox/index.js +4 -2
- package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build-module/components/dataviews-view-config/index.js +1 -0
- package/build-module/components/dataviews-view-config/index.js.map +1 -1
- package/build-module/constants.js +3 -0
- package/build-module/constants.js.map +1 -1
- package/build-module/dataform-controls/checkbox.js +25 -3
- package/build-module/dataform-controls/checkbox.js.map +1 -1
- package/build-module/dataform-controls/color.js +122 -0
- package/build-module/dataform-controls/color.js.map +1 -0
- package/build-module/dataform-controls/email.js +9 -45
- package/build-module/dataform-controls/email.js.map +1 -1
- package/build-module/dataform-controls/index.js +8 -2
- package/build-module/dataform-controls/index.js.map +1 -1
- package/build-module/dataform-controls/telephone.js +27 -0
- package/build-module/dataform-controls/telephone.js.map +1 -0
- package/build-module/dataform-controls/text.js +6 -48
- package/build-module/dataform-controls/text.js.map +1 -1
- package/build-module/dataform-controls/{boolean.js → toggle.js} +5 -3
- package/build-module/dataform-controls/toggle.js.map +1 -0
- package/build-module/dataform-controls/url.js +27 -0
- package/build-module/dataform-controls/url.js.map +1 -0
- package/build-module/dataform-controls/utils/validated-text.js +70 -0
- package/build-module/dataform-controls/utils/validated-text.js.map +1 -0
- package/build-module/dataforms-layouts/card/index.js +6 -7
- package/build-module/dataforms-layouts/card/index.js.map +1 -1
- package/build-module/dataforms-layouts/data-form-layout.js +14 -4
- package/build-module/dataforms-layouts/data-form-layout.js.map +1 -1
- package/build-module/dataforms-layouts/index.js +32 -1
- package/build-module/dataforms-layouts/index.js.map +1 -1
- package/build-module/dataforms-layouts/row/index.js +106 -0
- package/build-module/dataforms-layouts/row/index.js.map +1 -0
- package/build-module/dataviews-layouts/grid/index.js +16 -11
- package/build-module/dataviews-layouts/grid/index.js.map +1 -1
- package/build-module/dataviews-layouts/index.js +10 -2
- package/build-module/dataviews-layouts/index.js.map +1 -1
- package/build-module/dataviews-layouts/picker-grid/index.js +348 -0
- package/build-module/dataviews-layouts/picker-grid/index.js.map +1 -0
- package/build-module/dataviews-layouts/utils/grid-items.js +29 -0
- package/build-module/dataviews-layouts/utils/grid-items.js.map +1 -0
- package/build-module/dataviews-layouts/utils/preview-size-picker.js +73 -0
- package/build-module/dataviews-layouts/utils/preview-size-picker.js.map +1 -0
- package/build-module/field-types/boolean.js +1 -1
- package/build-module/field-types/boolean.js.map +1 -1
- package/build-module/field-types/color.js +107 -0
- package/build-module/field-types/color.js.map +1 -0
- package/build-module/field-types/index.js +12 -0
- package/build-module/field-types/index.js.map +1 -1
- package/build-module/field-types/telephone.js +51 -0
- package/build-module/field-types/telephone.js.map +1 -0
- package/build-module/field-types/url.js +51 -0
- package/build-module/field-types/url.js.map +1 -0
- package/build-module/normalize-form-fields.js +6 -0
- package/build-module/normalize-form-fields.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-module/validation.js +1 -1
- package/build-module/validation.js.map +1 -1
- package/build-style/style-rtl.css +252 -12
- package/build-style/style.css +252 -12
- package/build-types/components/dataform/stories/index.story.d.ts +19 -4
- package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
- package/build-types/components/dataform-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews/index.d.ts +1 -1
- package/build-types/components/dataviews/index.d.ts.map +1 -1
- package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
- 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-layout/index.d.ts.map +1 -1
- package/build-types/components/dataviews-picker/footer.d.ts +4 -0
- package/build-types/components/dataviews-picker/footer.d.ts.map +1 -0
- package/build-types/components/dataviews-picker/index.d.ts +55 -0
- package/build-types/components/dataviews-picker/index.d.ts.map +1 -0
- package/build-types/components/dataviews-picker/stories/index.story.d.ts +42 -0
- package/build-types/components/dataviews-picker/stories/index.story.d.ts.map +1 -0
- package/build-types/components/dataviews-selection-checkbox/index.d.ts +2 -1
- package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/constants.d.ts +1 -0
- package/build-types/constants.d.ts.map +1 -1
- package/build-types/dataform-controls/checkbox.d.ts.map +1 -1
- package/build-types/dataform-controls/color.d.ts +6 -0
- package/build-types/dataform-controls/color.d.ts.map +1 -0
- package/build-types/dataform-controls/email.d.ts.map +1 -1
- package/build-types/dataform-controls/index.d.ts.map +1 -1
- package/build-types/dataform-controls/telephone.d.ts +6 -0
- package/build-types/dataform-controls/telephone.d.ts.map +1 -0
- package/build-types/dataform-controls/text.d.ts.map +1 -1
- package/build-types/dataform-controls/toggle.d.ts +6 -0
- package/build-types/dataform-controls/toggle.d.ts.map +1 -0
- package/build-types/dataform-controls/url.d.ts +6 -0
- package/build-types/dataform-controls/url.d.ts.map +1 -0
- package/build-types/dataform-controls/utils/validated-text.d.ts +16 -0
- package/build-types/dataform-controls/utils/validated-text.d.ts.map +1 -0
- package/build-types/dataforms-layouts/card/index.d.ts +0 -3
- package/build-types/dataforms-layouts/card/index.d.ts.map +1 -1
- package/build-types/dataforms-layouts/data-form-layout.d.ts +4 -1
- package/build-types/dataforms-layouts/data-form-layout.d.ts.map +1 -1
- package/build-types/dataforms-layouts/index.d.ts +10 -0
- package/build-types/dataforms-layouts/index.d.ts.map +1 -1
- package/build-types/dataforms-layouts/row/index.d.ts +6 -0
- package/build-types/dataforms-layouts/row/index.d.ts.map +1 -0
- package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/index.d.ts +12 -1
- package/build-types/dataviews-layouts/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/picker-grid/index.d.ts +4 -0
- package/build-types/dataviews-layouts/picker-grid/index.d.ts.map +1 -0
- package/build-types/dataviews-layouts/utils/grid-items.d.ts +5 -0
- package/build-types/dataviews-layouts/utils/grid-items.d.ts.map +1 -0
- package/build-types/dataviews-layouts/utils/preview-size-picker.d.ts +2 -0
- package/build-types/dataviews-layouts/utils/preview-size-picker.d.ts.map +1 -0
- package/build-types/field-types/color.d.ts +20 -0
- package/build-types/field-types/color.d.ts.map +1 -0
- package/build-types/field-types/index.d.ts.map +1 -1
- package/build-types/field-types/stories/index.story.d.ts +81 -0
- package/build-types/field-types/stories/index.story.d.ts.map +1 -0
- package/build-types/field-types/telephone.d.ts +20 -0
- package/build-types/field-types/telephone.d.ts.map +1 -0
- package/build-types/field-types/url.d.ts +20 -0
- package/build-types/field-types/url.d.ts.map +1 -0
- package/build-types/normalize-form-fields.d.ts.map +1 -1
- package/build-types/test/dataviews-picker.d.ts +2 -0
- package/build-types/test/dataviews-picker.d.ts.map +1 -0
- package/build-types/types.d.ts +36 -5
- package/build-types/types.d.ts.map +1 -1
- package/build-types/validation.d.ts.map +1 -1
- package/build-wp/index.js +5061 -4013
- package/package.json +16 -15
- package/src/components/dataform/stories/index.story.tsx +333 -11
- package/src/components/dataform-context/index.tsx +1 -0
- package/src/components/dataviews/index.tsx +25 -1
- package/src/components/dataviews/stories/fixtures.tsx +1 -1
- package/src/components/dataviews/stories/index.story.tsx +14 -0
- package/src/components/dataviews/style.scss +4 -2
- package/src/components/dataviews-context/index.ts +3 -0
- package/src/components/dataviews-layout/index.tsx +4 -2
- package/src/components/dataviews-picker/footer.tsx +207 -0
- package/src/components/dataviews-picker/index.tsx +284 -0
- package/src/components/dataviews-picker/stories/index.story.tsx +251 -0
- package/src/components/dataviews-picker/style.scss +10 -0
- package/src/components/dataviews-selection-checkbox/index.tsx +3 -0
- package/src/components/dataviews-view-config/index.tsx +1 -0
- package/src/constants.ts +3 -0
- package/src/dataform-controls/checkbox.tsx +33 -3
- package/src/dataform-controls/color.tsx +139 -0
- package/src/dataform-controls/email.tsx +10 -52
- package/src/dataform-controls/index.tsx +8 -2
- package/src/dataform-controls/telephone.tsx +30 -0
- package/src/dataform-controls/text.tsx +2 -57
- package/src/dataform-controls/{boolean.tsx → toggle.tsx} +3 -2
- package/src/dataform-controls/url.tsx +30 -0
- package/src/dataform-controls/utils/validated-text.tsx +96 -0
- package/src/dataforms-layouts/card/index.tsx +5 -4
- package/src/dataforms-layouts/card/style.scss +7 -0
- package/src/dataforms-layouts/data-form-layout.tsx +15 -3
- package/src/dataforms-layouts/index.tsx +35 -0
- package/src/dataforms-layouts/row/index.tsx +115 -0
- package/src/dataforms-layouts/row/style.scss +3 -0
- package/src/dataviews-layouts/grid/index.tsx +38 -33
- package/src/dataviews-layouts/grid/style.scss +42 -20
- package/src/dataviews-layouts/index.ts +16 -2
- package/src/dataviews-layouts/picker-grid/index.tsx +490 -0
- package/src/dataviews-layouts/picker-grid/style.scss +171 -0
- package/src/dataviews-layouts/utils/grid-items.scss +21 -0
- package/src/dataviews-layouts/utils/grid-items.tsx +35 -0
- package/src/dataviews-layouts/utils/preview-size-picker.tsx +87 -0
- package/src/field-types/boolean.tsx +1 -1
- package/src/field-types/color.tsx +115 -0
- package/src/field-types/index.tsx +15 -0
- package/src/field-types/stories/index.story.tsx +719 -0
- package/src/field-types/telephone.tsx +71 -0
- package/src/field-types/url.tsx +71 -0
- package/src/normalize-form-fields.ts +6 -0
- package/src/style.scss +4 -0
- package/src/test/dataform.tsx +2 -2
- package/src/test/dataviews-picker.tsx +478 -0
- package/src/test/dataviews.tsx +86 -0
- package/src/types.ts +56 -4
- package/src/validation.ts +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataform-controls/boolean.js.map +0 -1
- package/build-module/dataform-controls/boolean.js.map +0 -1
- package/build-types/components/stories/index.story.d.ts +0 -63
- package/build-types/components/stories/index.story.d.ts.map +0 -1
- package/build-types/dataform-controls/boolean.d.ts +0 -6
- package/build-types/dataform-controls/boolean.d.ts.map +0 -1
- package/src/components/stories/index.story.tsx +0 -372
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_lockUnlock","_jsxRuntime","ValidatedToggleControl","unlock","privateApis","Boolean","field","onChange","data","hideLabelFromVision","id","getValue","label","customValidity","setCustomValidity","useState","undefined","jsx","required","isValid","onValidate","newValue","message","custom","type","hidden","__nextHasNoMarginBottom","checked","item"],"sources":["@wordpress/dataviews/src/dataform-controls/boolean.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../types';\nimport { unlock } from '../lock-unlock';\n\nconst { ValidatedToggleControl } = unlock( privateApis );\n\nexport default function Boolean< Item >( {\n\tfield,\n\tonChange,\n\tdata,\n\thideLabelFromVision,\n}: DataFormControlProps< Item > ) {\n\tconst { id, getValue, label } = field;\n\tconst [ customValidity, setCustomValidity ] =\n\t\tuseState<\n\t\t\tReact.ComponentProps<\n\t\t\t\ttypeof ValidatedToggleControl\n\t\t\t>[ 'customValidity' ]\n\t\t>( undefined );\n\n\treturn (\n\t\t<ValidatedToggleControl\n\t\t\trequired={ !! field.isValid.required }\n\t\t\tonValidate={ ( newValue: any ) => {\n\t\t\t\tconst message = field.isValid?.custom?.(\n\t\t\t\t\t{\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\t[ id ]: newValue,\n\t\t\t\t\t},\n\t\t\t\t\tfield\n\t\t\t\t);\n\n\t\t\t\tif ( message ) {\n\t\t\t\t\tsetCustomValidity( {\n\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetCustomValidity( undefined );\n\t\t\t} }\n\t\t\tcustomValidity={ customValidity }\n\t\t\thidden={ hideLabelFromVision }\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ label }\n\t\t\tchecked={ getValue( { item: data } ) }\n\t\t\tonChange={ () =>\n\t\t\t\tonChange( { [ id ]: ! getValue( { item: data } ) } )\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAG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E,CAAE;EACnD,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","useState","unlock","jsx","_jsx","ValidatedToggleControl","Boolean","field","onChange","data","hideLabelFromVision","id","getValue","label","customValidity","setCustomValidity","undefined","required","isValid","onValidate","newValue","message","custom","type","hidden","__nextHasNoMarginBottom","checked","item"],"sources":["@wordpress/dataviews/src/dataform-controls/boolean.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../types';\nimport { unlock } from '../lock-unlock';\n\nconst { ValidatedToggleControl } = unlock( privateApis );\n\nexport default function Boolean< Item >( {\n\tfield,\n\tonChange,\n\tdata,\n\thideLabelFromVision,\n}: DataFormControlProps< Item > ) {\n\tconst { id, getValue, label } = field;\n\tconst [ customValidity, setCustomValidity ] =\n\t\tuseState<\n\t\t\tReact.ComponentProps<\n\t\t\t\ttypeof ValidatedToggleControl\n\t\t\t>[ 'customValidity' ]\n\t\t>( undefined );\n\n\treturn (\n\t\t<ValidatedToggleControl\n\t\t\trequired={ !! field.isValid.required }\n\t\t\tonValidate={ ( newValue: any ) => {\n\t\t\t\tconst message = field.isValid?.custom?.(\n\t\t\t\t\t{\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\t[ id ]: newValue,\n\t\t\t\t\t},\n\t\t\t\t\tfield\n\t\t\t\t);\n\n\t\t\t\tif ( message ) {\n\t\t\t\t\tsetCustomValidity( {\n\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetCustomValidity( undefined );\n\t\t\t} }\n\t\t\tcustomValidity={ customValidity }\n\t\t\thidden={ hideLabelFromVision }\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ label }\n\t\t\tchecked={ get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AE;MAAE,CAAEG,EAAE,GAAI,CAAEC,QAAQ,CAAE;QAAEe,IAAI,EAAElB;MAAK,CAAE;IAAE,CAAE;EACnD,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import DataForm from '../dataform/index';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
readonly title: "DataViews/FieldTypes";
|
|
4
|
-
readonly component: typeof DataForm;
|
|
5
|
-
readonly argTypes: {
|
|
6
|
-
readonly type: {
|
|
7
|
-
readonly control: {
|
|
8
|
-
readonly type: "select";
|
|
9
|
-
};
|
|
10
|
-
readonly description: "Chooses the default layout of each field. \"regular\" is the default layout.";
|
|
11
|
-
readonly options: readonly ["default", "regular", "panel"];
|
|
12
|
-
};
|
|
13
|
-
readonly labelPosition: {
|
|
14
|
-
readonly control: {
|
|
15
|
-
readonly type: "select";
|
|
16
|
-
};
|
|
17
|
-
readonly description: "Chooses the label position of the layout.";
|
|
18
|
-
readonly options: readonly ["default", "top", "side", "none"];
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export default meta;
|
|
23
|
-
export declare const All: ({ type, labelPosition, }: {
|
|
24
|
-
type: "default" | "regular" | "panel";
|
|
25
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
26
|
-
}) => import("react").JSX.Element;
|
|
27
|
-
export declare const Text: ({ type, labelPosition, }: {
|
|
28
|
-
type: "default" | "regular" | "panel";
|
|
29
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
30
|
-
}) => import("react").JSX.Element;
|
|
31
|
-
export declare const Integer: ({ type, labelPosition, }: {
|
|
32
|
-
type: "default" | "regular" | "panel";
|
|
33
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
34
|
-
}) => import("react").JSX.Element;
|
|
35
|
-
export declare const Boolean: ({ type, labelPosition, }: {
|
|
36
|
-
type: "default" | "regular" | "panel";
|
|
37
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
38
|
-
}) => import("react").JSX.Element;
|
|
39
|
-
export declare const DateTime: ({ type, labelPosition, }: {
|
|
40
|
-
type: "default" | "regular" | "panel";
|
|
41
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
42
|
-
}) => import("react").JSX.Element;
|
|
43
|
-
export declare const Date: ({ type, labelPosition, }: {
|
|
44
|
-
type: "default" | "regular" | "panel";
|
|
45
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
46
|
-
}) => import("react").JSX.Element;
|
|
47
|
-
export declare const Email: ({ type, labelPosition, }: {
|
|
48
|
-
type: "default" | "regular" | "panel";
|
|
49
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
50
|
-
}) => import("react").JSX.Element;
|
|
51
|
-
export declare const Media: ({ type, labelPosition, }: {
|
|
52
|
-
type: "default" | "regular" | "panel";
|
|
53
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
54
|
-
}) => import("react").JSX.Element;
|
|
55
|
-
export declare const Array: ({ type, labelPosition, }: {
|
|
56
|
-
type: "default" | "regular" | "panel";
|
|
57
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
58
|
-
}) => import("react").JSX.Element;
|
|
59
|
-
export declare const NoType: ({ type, labelPosition, }: {
|
|
60
|
-
type: "default" | "regular" | "panel";
|
|
61
|
-
labelPosition: "default" | "top" | "side" | "none";
|
|
62
|
-
}) => import("react").JSX.Element;
|
|
63
|
-
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/components/stories/index.story.tsx"],"names":[],"mappings":"AAaA,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAUzC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAgBA,CAAC;AACX,eAAe,IAAI,CAAC;AA6HpB,eAAO,MAAM,GAAG,6BAGb;IACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtC,aAAa,EAAE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AM,CAAC;CACnD,gCAaA,CAAC;AAEF,eAAO,MAAM,KAAK,6BAGf;IACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtC,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CACnD,gCAaA,CAAC;AAEF,eAAO,MAAM,MAAM,6BAGhB;IACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtC,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CACnD,gCAaA,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { DataFormControlProps } from '../types';
|
|
5
|
-
export default function Boolean<Item>({ field, onChange, data, hideLabelFromVision, }: DataFormControlProps<Item>): import("react").JSX.Element;
|
|
6
|
-
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/boolean.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,IAAI,EAAI,EACxC,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,mBAAmB,GACnB,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BAyC9B"}
|
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalHStack as HStack,
|
|
7
|
-
__experimentalVStack as VStack,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import DataViews from '../dataviews/index';
|
|
14
|
-
import DataForm from '../dataform/index';
|
|
15
|
-
import {
|
|
16
|
-
actions,
|
|
17
|
-
data,
|
|
18
|
-
fields,
|
|
19
|
-
type SpaceObject,
|
|
20
|
-
} from '../dataviews/stories/fixtures';
|
|
21
|
-
import { filterSortAndPaginate } from '../../filter-and-sort-data-view';
|
|
22
|
-
import type { View, Form, Field } from '../../types';
|
|
23
|
-
|
|
24
|
-
const meta = {
|
|
25
|
-
title: 'DataViews/FieldTypes',
|
|
26
|
-
component: DataForm,
|
|
27
|
-
argTypes: {
|
|
28
|
-
type: {
|
|
29
|
-
control: { type: 'select' },
|
|
30
|
-
description:
|
|
31
|
-
'Chooses the default layout of each field. "regular" is the default layout.',
|
|
32
|
-
options: [ 'default', 'regular', 'panel' ],
|
|
33
|
-
},
|
|
34
|
-
labelPosition: {
|
|
35
|
-
control: { type: 'select' },
|
|
36
|
-
description: 'Chooses the label position of the layout.',
|
|
37
|
-
options: [ 'default', 'top', 'side', 'none' ],
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
} as const;
|
|
41
|
-
export default meta;
|
|
42
|
-
|
|
43
|
-
const defaultLayouts = {
|
|
44
|
-
table: {},
|
|
45
|
-
grid: {},
|
|
46
|
-
list: {},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
interface FieldTypeStoryProps {
|
|
50
|
-
fields: Field< SpaceObject >[];
|
|
51
|
-
titleField?: string;
|
|
52
|
-
descriptionField?: string;
|
|
53
|
-
mediaField?: string;
|
|
54
|
-
type?: 'default' | 'regular' | 'panel';
|
|
55
|
-
labelPosition?: 'default' | 'top' | 'side' | 'none';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const FieldTypeStory = ( {
|
|
59
|
-
fields: storyFields,
|
|
60
|
-
titleField,
|
|
61
|
-
descriptionField,
|
|
62
|
-
mediaField,
|
|
63
|
-
type = 'default',
|
|
64
|
-
labelPosition = 'default',
|
|
65
|
-
}: FieldTypeStoryProps ) => {
|
|
66
|
-
const form = useMemo(
|
|
67
|
-
() => ( {
|
|
68
|
-
type,
|
|
69
|
-
labelPosition,
|
|
70
|
-
fields: storyFields.map( ( field ) => field.id ),
|
|
71
|
-
} ),
|
|
72
|
-
[ type, labelPosition, storyFields ]
|
|
73
|
-
) as Form;
|
|
74
|
-
|
|
75
|
-
const [ view, setView ] = useState< View >( {
|
|
76
|
-
type: 'table' as const,
|
|
77
|
-
search: '',
|
|
78
|
-
page: 1,
|
|
79
|
-
perPage: 10,
|
|
80
|
-
layout: {},
|
|
81
|
-
filters: [],
|
|
82
|
-
titleField,
|
|
83
|
-
descriptionField,
|
|
84
|
-
mediaField,
|
|
85
|
-
fields: storyFields
|
|
86
|
-
.filter(
|
|
87
|
-
( field ) =>
|
|
88
|
-
! [ titleField, descriptionField, mediaField ].includes(
|
|
89
|
-
field.id
|
|
90
|
-
)
|
|
91
|
-
)
|
|
92
|
-
.map( ( field ) => field.id ),
|
|
93
|
-
} );
|
|
94
|
-
|
|
95
|
-
const [ selectedIds, setSelectedIds ] = useState< number[] >( [] );
|
|
96
|
-
const [ modifiedData, setModifiedData ] = useState< SpaceObject[] >( data );
|
|
97
|
-
|
|
98
|
-
const { data: shownData, paginationInfo } = useMemo( () => {
|
|
99
|
-
return filterSortAndPaginate( modifiedData, view, storyFields );
|
|
100
|
-
}, [ modifiedData, view, storyFields ] );
|
|
101
|
-
|
|
102
|
-
const selectedItem =
|
|
103
|
-
( selectedIds.length === 1 &&
|
|
104
|
-
shownData.find( ( item ) => item.id === selectedIds[ 0 ] ) ) ||
|
|
105
|
-
null;
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<HStack alignment="stretch">
|
|
109
|
-
<div style={ { flex: 2 } }>
|
|
110
|
-
<DataViews
|
|
111
|
-
getItemId={ ( item ) => item.id.toString() }
|
|
112
|
-
data={ shownData }
|
|
113
|
-
paginationInfo={ paginationInfo }
|
|
114
|
-
view={ view }
|
|
115
|
-
fields={ storyFields }
|
|
116
|
-
onChangeView={ setView }
|
|
117
|
-
actions={ actions }
|
|
118
|
-
defaultLayouts={ defaultLayouts }
|
|
119
|
-
selection={ selectedIds.map( ( id ) => id.toString() ) }
|
|
120
|
-
onChangeSelection={ ( newSelection ) =>
|
|
121
|
-
setSelectedIds(
|
|
122
|
-
newSelection.map( ( id ) => parseInt( id, 10 ) )
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
// eslint-disable-next-line no-alert
|
|
126
|
-
onClickItem={ ( item ) => alert( 'clicked ' + item.title ) }
|
|
127
|
-
/>
|
|
128
|
-
</div>
|
|
129
|
-
{ selectedItem ? (
|
|
130
|
-
<VStack alignment="top">
|
|
131
|
-
<DataForm
|
|
132
|
-
data={ selectedItem }
|
|
133
|
-
form={ form }
|
|
134
|
-
fields={ storyFields }
|
|
135
|
-
onChange={ ( updatedValues ) => {
|
|
136
|
-
const updatedItem = {
|
|
137
|
-
...selectedItem,
|
|
138
|
-
...updatedValues,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
setModifiedData(
|
|
142
|
-
modifiedData.map( ( item ) =>
|
|
143
|
-
item.id === selectedItem.id
|
|
144
|
-
? updatedItem
|
|
145
|
-
: item
|
|
146
|
-
)
|
|
147
|
-
);
|
|
148
|
-
} }
|
|
149
|
-
/>
|
|
150
|
-
</VStack>
|
|
151
|
-
) : (
|
|
152
|
-
<VStack alignment="center">
|
|
153
|
-
<span
|
|
154
|
-
style={ {
|
|
155
|
-
color: '#888',
|
|
156
|
-
} }
|
|
157
|
-
>
|
|
158
|
-
Please, select a single item.
|
|
159
|
-
</span>
|
|
160
|
-
</VStack>
|
|
161
|
-
) }
|
|
162
|
-
</HStack>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export const All = ( {
|
|
167
|
-
type,
|
|
168
|
-
labelPosition,
|
|
169
|
-
}: {
|
|
170
|
-
type: 'default' | 'regular' | 'panel';
|
|
171
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
172
|
-
} ) => {
|
|
173
|
-
return (
|
|
174
|
-
<FieldTypeStory
|
|
175
|
-
fields={ fields }
|
|
176
|
-
titleField="title"
|
|
177
|
-
descriptionField="description"
|
|
178
|
-
mediaField="image"
|
|
179
|
-
type={ type }
|
|
180
|
-
labelPosition={ labelPosition }
|
|
181
|
-
/>
|
|
182
|
-
);
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export const Text = ( {
|
|
186
|
-
type,
|
|
187
|
-
labelPosition,
|
|
188
|
-
}: {
|
|
189
|
-
type: 'default' | 'regular' | 'panel';
|
|
190
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
191
|
-
} ) => {
|
|
192
|
-
const textFields = useMemo(
|
|
193
|
-
() => fields.filter( ( field ) => field.type === 'text' ),
|
|
194
|
-
[]
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<FieldTypeStory
|
|
199
|
-
fields={ textFields }
|
|
200
|
-
type={ type }
|
|
201
|
-
labelPosition={ labelPosition }
|
|
202
|
-
/>
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export const Integer = ( {
|
|
207
|
-
type,
|
|
208
|
-
labelPosition,
|
|
209
|
-
}: {
|
|
210
|
-
type: 'default' | 'regular' | 'panel';
|
|
211
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
212
|
-
} ) => {
|
|
213
|
-
const integerFields = useMemo(
|
|
214
|
-
() => fields.filter( ( field ) => field.type === 'integer' ),
|
|
215
|
-
[]
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
return (
|
|
219
|
-
<FieldTypeStory
|
|
220
|
-
fields={ integerFields }
|
|
221
|
-
type={ type }
|
|
222
|
-
labelPosition={ labelPosition }
|
|
223
|
-
/>
|
|
224
|
-
);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
export const Boolean = ( {
|
|
228
|
-
type,
|
|
229
|
-
labelPosition,
|
|
230
|
-
}: {
|
|
231
|
-
type: 'default' | 'regular' | 'panel';
|
|
232
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
233
|
-
} ) => {
|
|
234
|
-
const booleanFields = useMemo(
|
|
235
|
-
() => fields.filter( ( field ) => field.type === 'boolean' ),
|
|
236
|
-
[]
|
|
237
|
-
);
|
|
238
|
-
|
|
239
|
-
return (
|
|
240
|
-
<FieldTypeStory
|
|
241
|
-
fields={ booleanFields }
|
|
242
|
-
type={ type }
|
|
243
|
-
labelPosition={ labelPosition }
|
|
244
|
-
/>
|
|
245
|
-
);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export const DateTime = ( {
|
|
249
|
-
type,
|
|
250
|
-
labelPosition,
|
|
251
|
-
}: {
|
|
252
|
-
type: 'default' | 'regular' | 'panel';
|
|
253
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
254
|
-
} ) => {
|
|
255
|
-
const dateTimeFields = useMemo(
|
|
256
|
-
() => fields.filter( ( field ) => field.type === 'datetime' ),
|
|
257
|
-
[]
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
return (
|
|
261
|
-
<FieldTypeStory
|
|
262
|
-
fields={ dateTimeFields }
|
|
263
|
-
type={ type }
|
|
264
|
-
labelPosition={ labelPosition }
|
|
265
|
-
/>
|
|
266
|
-
);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export const Date = ( {
|
|
270
|
-
type,
|
|
271
|
-
labelPosition,
|
|
272
|
-
}: {
|
|
273
|
-
type: 'default' | 'regular' | 'panel';
|
|
274
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
275
|
-
} ) => {
|
|
276
|
-
const dateFields = useMemo(
|
|
277
|
-
() => fields.filter( ( field ) => field.type === 'date' ),
|
|
278
|
-
[]
|
|
279
|
-
);
|
|
280
|
-
|
|
281
|
-
return (
|
|
282
|
-
<FieldTypeStory
|
|
283
|
-
fields={ dateFields }
|
|
284
|
-
type={ type }
|
|
285
|
-
labelPosition={ labelPosition }
|
|
286
|
-
/>
|
|
287
|
-
);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
export const Email = ( {
|
|
291
|
-
type,
|
|
292
|
-
labelPosition,
|
|
293
|
-
}: {
|
|
294
|
-
type: 'default' | 'regular' | 'panel';
|
|
295
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
296
|
-
} ) => {
|
|
297
|
-
const emailFields = useMemo(
|
|
298
|
-
() => fields.filter( ( field ) => field.type === 'email' ),
|
|
299
|
-
[]
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
return (
|
|
303
|
-
<FieldTypeStory
|
|
304
|
-
fields={ emailFields }
|
|
305
|
-
type={ type }
|
|
306
|
-
labelPosition={ labelPosition }
|
|
307
|
-
/>
|
|
308
|
-
);
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
export const Media = ( {
|
|
312
|
-
type,
|
|
313
|
-
labelPosition,
|
|
314
|
-
}: {
|
|
315
|
-
type: 'default' | 'regular' | 'panel';
|
|
316
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
317
|
-
} ) => {
|
|
318
|
-
const mediaFields = useMemo(
|
|
319
|
-
() => fields.filter( ( field ) => field.type === 'media' ),
|
|
320
|
-
[]
|
|
321
|
-
);
|
|
322
|
-
|
|
323
|
-
return (
|
|
324
|
-
<FieldTypeStory
|
|
325
|
-
fields={ mediaFields }
|
|
326
|
-
type={ type }
|
|
327
|
-
labelPosition={ labelPosition }
|
|
328
|
-
/>
|
|
329
|
-
);
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
export const Array = ( {
|
|
333
|
-
type,
|
|
334
|
-
labelPosition,
|
|
335
|
-
}: {
|
|
336
|
-
type: 'default' | 'regular' | 'panel';
|
|
337
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
338
|
-
} ) => {
|
|
339
|
-
const arrayTextFields = useMemo(
|
|
340
|
-
() => fields.filter( ( field ) => field.type === 'array' ),
|
|
341
|
-
[]
|
|
342
|
-
);
|
|
343
|
-
|
|
344
|
-
return (
|
|
345
|
-
<FieldTypeStory
|
|
346
|
-
fields={ arrayTextFields }
|
|
347
|
-
type={ type }
|
|
348
|
-
labelPosition={ labelPosition }
|
|
349
|
-
/>
|
|
350
|
-
);
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
export const NoType = ( {
|
|
354
|
-
type,
|
|
355
|
-
labelPosition,
|
|
356
|
-
}: {
|
|
357
|
-
type: 'default' | 'regular' | 'panel';
|
|
358
|
-
labelPosition: 'default' | 'top' | 'side' | 'none';
|
|
359
|
-
} ) => {
|
|
360
|
-
const noTypeFields = useMemo(
|
|
361
|
-
() => fields.filter( ( field ) => field.type === undefined ),
|
|
362
|
-
[]
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
return (
|
|
366
|
-
<FieldTypeStory
|
|
367
|
-
fields={ noTypeFields }
|
|
368
|
-
type={ type }
|
|
369
|
-
labelPosition={ labelPosition }
|
|
370
|
-
/>
|
|
371
|
-
);
|
|
372
|
-
};
|