@wordpress/fields 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/actions/permanently-delete-post.js +104 -65
  4. package/build/actions/permanently-delete-post.js.map +1 -1
  5. package/build/components/create-template-part-modal/index.js +40 -35
  6. package/build/components/create-template-part-modal/index.js.map +1 -1
  7. package/build/fields/page-title/view.js +6 -2
  8. package/build/fields/page-title/view.js.map +1 -1
  9. package/build-module/actions/permanently-delete-post.js +105 -66
  10. package/build-module/actions/permanently-delete-post.js.map +1 -1
  11. package/build-module/components/create-template-part-modal/index.js +41 -36
  12. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  13. package/build-module/fields/page-title/view.js +6 -2
  14. package/build-module/fields/page-title/view.js.map +1 -1
  15. package/build-style/style-rtl.css +49 -43
  16. package/build-style/style.css +49 -43
  17. package/build-types/actions/permanently-delete-post.d.ts.map +1 -1
  18. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  19. package/build-types/fields/page-title/view.d.ts.map +1 -1
  20. package/package.json +25 -25
  21. package/src/actions/permanently-delete-post.tsx +157 -86
  22. package/src/components/create-template-part-modal/index.tsx +61 -45
  23. package/src/components/create-template-part-modal/style.scss +79 -54
  24. package/src/fields/page-title/view.tsx +5 -2
  25. package/src/style.scss +0 -1
  26. package/tsconfig.json +1 -4
  27. package/tsconfig.tsbuildinfo +1 -1
  28. package/src/fields/page-title/style.scss +0 -10
@@ -3,61 +3,86 @@
3
3
  }
4
4
 
5
5
  .fields-create-template-part-modal__area-radio-group {
6
- width: 100%;
7
- border: $border-width solid $gray-700;
6
+ border: $border-width solid $gray-600;
8
7
  border-radius: $radius-small;
8
+ }
9
+
10
+ .fields-create-template-part-modal__area-radio-wrapper {
11
+ position: relative;
12
+ padding: $grid-unit-15;
13
+
14
+ display: grid;
15
+ align-items: center;
16
+ grid-template-columns: min-content 1fr min-content;
17
+ grid-gap: $grid-unit-05 $grid-unit-10;
18
+
19
+ color: $gray-900;
20
+
21
+ & + & {
22
+ border-top: $border-width solid $gray-600;
23
+ }
24
+
25
+ input[type="radio"] {
26
+ position: absolute;
27
+ opacity: 0;
28
+ }
29
+
30
+ &:has(input[type="radio"]:checked) {
31
+ // This is needed to make sure that the focus ring always renders on top
32
+ // of the sibling radio "wrapper"'s borders.
33
+ z-index: 1;
34
+ }
35
+
36
+ &:has(input[type="radio"]:not(:checked)):hover {
37
+ color: var(--wp-admin-theme-color);
38
+ }
39
+
40
+ // Pass-through pointer events, so that the corresponding radio input
41
+ // gets checked when clicking on the underlying label
42
+ > *:not(.fields-create-template-part-modal__area-radio-label) {
43
+ pointer-events: none;
44
+ }
45
+ }
46
+
47
+ .fields-create-template-part-modal__area-radio-label {
48
+ // Capture pointer clicks for the whole radio wrapper
49
+ &::before {
50
+ content: "";
51
+ position: absolute;
52
+ inset: 0;
53
+ }
54
+
55
+ input[type="radio"]:not(:checked) ~ &::before {
56
+ cursor: pointer;
57
+ }
58
+
59
+ input[type="radio"]:focus-visible ~ &::before {
60
+ outline: 4px solid transparent;
61
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
62
+ }
63
+ }
64
+
65
+ .fields-create-template-part-modal__area-radio-icon,
66
+ .fields-create-template-part-modal__area-radio-checkmark {
67
+ fill: currentColor;
68
+ }
69
+
70
+ .fields-create-template-part-modal__area-radio-checkmark {
71
+ input[type="radio"]:not(:checked) ~ & {
72
+ opacity: 0;
73
+ }
74
+ }
75
+
76
+ .fields-create-template-part-modal__area-radio-description {
77
+ grid-column: 2 / 3;
78
+ margin: 0;
79
+
80
+ color: $gray-700;
81
+ font-size: $helptext-font-size;
82
+ line-height: normal;
83
+ text-wrap: pretty;
9
84
 
10
- .components-button.fields-create-template-part-modal__area-radio {
11
- display: block;
12
- width: 100%;
13
- height: 100%;
14
- text-align: left;
15
- padding: $grid-unit-15;
16
-
17
- &,
18
- &.is-secondary:hover,
19
- &.is-primary:hover {
20
- margin: 0;
21
- background-color: inherit;
22
- border-bottom: $border-width solid $gray-700;
23
- border-radius: 0;
24
-
25
- &:not(:focus) {
26
- box-shadow: none;
27
- }
28
-
29
- &:focus {
30
- border-bottom: $border-width solid $white;
31
- }
32
-
33
- &:last-of-type {
34
- border-bottom: none;
35
- }
36
- }
37
-
38
- &:not(:hover),
39
- &[aria-checked="true"] {
40
- color: $gray-900;
41
- cursor: auto;
42
-
43
- .fields-create-template-part-modal__option-label div {
44
- color: $gray-600;
45
- }
46
- }
47
-
48
- .fields-create-template-part-modal__option-label {
49
- padding-top: $grid-unit-05;
50
- white-space: normal;
51
-
52
- div {
53
- padding-top: $grid-unit-05;
54
- font-size: $helptext-font-size;
55
- }
56
- }
57
-
58
- .fields-create-template-part-modal__checkbox {
59
- margin-left: auto;
60
- min-width: $grid-unit-30;
61
- }
85
+ input[type="radio"]:not(:checked):hover ~ & {
86
+ color: inherit;
62
87
  }
63
88
  }
@@ -5,12 +5,15 @@ import { __ } from '@wordpress/i18n';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
7
  import type { Settings } from '@wordpress/core-data';
8
+ import { privateApis as componentsPrivateApis } from '@wordpress/components';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
12
13
  import type { CommonPost } from '../../types';
13
14
  import { BaseTitleView } from '../title/view';
15
+ import { unlock } from '../../lock-unlock';
16
+ const { Badge } = unlock( componentsPrivateApis );
14
17
 
15
18
  export default function PageTitleView( { item }: { item: CommonPost } ) {
16
19
  const { frontPageId, postsPageId } = useSelect( ( select ) => {
@@ -27,11 +30,11 @@ export default function PageTitleView( { item }: { item: CommonPost } ) {
27
30
  return (
28
31
  <BaseTitleView item={ item } className="fields-field__page-title">
29
32
  { [ frontPageId, postsPageId ].includes( item.id as number ) && (
30
- <span className="fields-field__page-title__badge">
33
+ <Badge>
31
34
  { item.id === frontPageId
32
35
  ? __( 'Homepage' )
33
36
  : __( 'Posts Page' ) }
34
- </span>
37
+ </Badge>
35
38
  ) }
36
39
  </BaseTitleView>
37
40
  );
package/src/style.scss CHANGED
@@ -3,5 +3,4 @@
3
3
  @import "./fields/featured-image/style.scss";
4
4
  @import "./fields/template/style.scss";
5
5
  @import "./fields/title/style.scss";
6
- @import "./fields/page-title/style.scss";
7
6
  @import "./fields/pattern-title/style.scss";
package/tsconfig.json CHANGED
@@ -2,8 +2,6 @@
2
2
  "$schema": "https://json.schemastore.org/tsconfig.json",
3
3
  "extends": "../../tsconfig.base.json",
4
4
  "compilerOptions": {
5
- "rootDir": "src",
6
- "declarationDir": "build-types",
7
5
  "checkJs": false
8
6
  },
9
7
  "references": [
@@ -29,6 +27,5 @@
29
27
  { "path": "../url" },
30
28
  { "path": "../block-editor" },
31
29
  { "path": "../warning" }
32
- ],
33
- "include": [ "src" ]
30
+ ]
34
31
  }