@wordpress/components 30.6.1 → 30.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 (97) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/color-palette/styles.js +2 -12
  3. package/build/color-palette/styles.js.map +2 -2
  4. package/build/combobox-control/index.js +1 -2
  5. package/build/combobox-control/index.js.map +2 -2
  6. package/build/date-time/date/styles.js +9 -9
  7. package/build/date-time/date/styles.js.map +2 -2
  8. package/build/focal-point-picker/index.js +21 -10
  9. package/build/focal-point-picker/index.js.map +3 -3
  10. package/build/focal-point-picker/styles/focal-point-picker-style.js +20 -11
  11. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +2 -2
  12. package/build/palette-edit/styles.js +9 -9
  13. package/build/palette-edit/styles.js.map +2 -2
  14. package/build/popover/index.js +13 -2
  15. package/build/popover/index.js.map +2 -2
  16. package/build/tabs/styles.js +5 -5
  17. package/build/tabs/styles.js.map +1 -1
  18. package/build/tools-panel/styles.js +14 -22
  19. package/build/tools-panel/styles.js.map +2 -2
  20. package/build/utils/base-label.js +12 -12
  21. package/build/utils/base-label.js.map +3 -3
  22. package/build/utils/config-values.js +2 -0
  23. package/build/utils/config-values.js.map +2 -2
  24. package/build-module/color-palette/styles.js +2 -12
  25. package/build-module/color-palette/styles.js.map +2 -2
  26. package/build-module/combobox-control/index.js +1 -2
  27. package/build-module/combobox-control/index.js.map +2 -2
  28. package/build-module/date-time/date/styles.js +9 -9
  29. package/build-module/date-time/date/styles.js.map +2 -2
  30. package/build-module/focal-point-picker/index.js +23 -12
  31. package/build-module/focal-point-picker/index.js.map +2 -2
  32. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +20 -12
  33. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +2 -2
  34. package/build-module/palette-edit/styles.js +9 -9
  35. package/build-module/palette-edit/styles.js.map +2 -2
  36. package/build-module/popover/index.js +13 -2
  37. package/build-module/popover/index.js.map +2 -2
  38. package/build-module/tabs/styles.js +5 -5
  39. package/build-module/tabs/styles.js.map +1 -1
  40. package/build-module/tools-panel/styles.js +14 -22
  41. package/build-module/tools-panel/styles.js.map +2 -2
  42. package/build-module/utils/base-label.js +2 -12
  43. package/build-module/utils/base-label.js.map +2 -2
  44. package/build-module/utils/config-values.js +2 -0
  45. package/build-module/utils/config-values.js.map +2 -2
  46. package/build-style/style-rtl.css +10 -5
  47. package/build-style/style.css +10 -5
  48. package/build-types/card/card-body/component.d.ts.map +1 -1
  49. package/build-types/card/card-body/hook.d.ts.map +1 -1
  50. package/build-types/card/card-footer/component.d.ts +1 -3
  51. package/build-types/card/card-footer/component.d.ts.map +1 -1
  52. package/build-types/card/card-footer/hook.d.ts +6 -0
  53. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  54. package/build-types/card/card-header/component.d.ts +1 -1
  55. package/build-types/card/card-header/component.d.ts.map +1 -1
  56. package/build-types/card/card-header/hook.d.ts +7 -0
  57. package/build-types/card/card-header/hook.d.ts.map +1 -1
  58. package/build-types/card/card-media/hook.d.ts.map +1 -1
  59. package/build-types/card/types.d.ts +3 -8
  60. package/build-types/card/types.d.ts.map +1 -1
  61. package/build-types/color-palette/styles.d.ts.map +1 -1
  62. package/build-types/combobox-control/index.d.ts.map +1 -1
  63. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  64. package/build-types/date-time/date/styles.d.ts.map +1 -1
  65. package/build-types/focal-point-picker/index.d.ts +1 -1
  66. package/build-types/focal-point-picker/index.d.ts.map +1 -1
  67. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +253 -0
  68. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  69. package/build-types/popover/index.d.ts.map +1 -1
  70. package/build-types/utils/base-label.d.ts.map +1 -1
  71. package/build-types/utils/config-values.d.ts +1 -0
  72. package/package.json +20 -20
  73. package/src/button/style.scss +4 -1
  74. package/src/card/types.ts +3 -9
  75. package/src/color-palette/styles.ts +2 -1
  76. package/src/combobox-control/index.tsx +1 -4
  77. package/src/combobox-control/stories/index.story.tsx +0 -1
  78. package/src/combobox-control/test/index.tsx +20 -7
  79. package/src/date-time/date/styles.ts +1 -0
  80. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  81. package/src/dropdown-menu/style.scss +1 -0
  82. package/src/focal-point-picker/index.tsx +26 -16
  83. package/src/focal-point-picker/styles/focal-point-picker-style.ts +11 -1
  84. package/src/menu-group/style.scss +1 -1
  85. package/src/menu-item/style.scss +1 -0
  86. package/src/modal/style.scss +1 -1
  87. package/src/palette-edit/styles.ts +1 -1
  88. package/src/panel/style.scss +1 -1
  89. package/src/popover/index.tsx +23 -2
  90. package/src/tab-panel/style.scss +1 -1
  91. package/src/tabs/styles.ts +1 -1
  92. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
  93. package/src/tools-panel/styles.ts +2 -2
  94. package/src/utils/base-label.ts +6 -1
  95. package/src/utils/config-values.js +1 -0
  96. package/src/validated-form-controls/style.scss +1 -1
  97. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"focal-point-picker-style.d.ts","sourceRoot":"","sources":["../../../src/focal-point-picker/styles/focal-point-picker-style.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAG9D,eAAO,MAAM,YAAY;;SAOH,MAAQ,WAAU;yGAFvC,CAAC;AAEF,eAAO,MAAM,cAAc;;SAAL,MAAQ,WAAU;yGAmCvC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;SArCP,MAAQ,WAAU;yGA6CvC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;UAE7B,CAAC;AAsBF,eAAO,MAAM,cAAc;;;;0CAM1B,CAAC;AAEF,eAAO,MAAM,QAAQ;;SA/EC,MAAQ,WAAU;;kBA4FQ,OAAO;yGAEtD,CAAC;AAEF,eAAO,MAAM,QAAQ;;SAhGC,MAAQ,WAAU;yGAqGvC,CAAC;AAEF,eAAO,MAAM,SAAS;;SAvGA,MAAQ,WAAU;;;UA2GvC,CAAC;AAEF,eAAO,MAAM,SAAS;;SA7GA,MAAQ,WAAU;;;UAiHvC,CAAC"}
1
+ {"version":3,"file":"focal-point-picker-style.d.ts","sourceRoot":"","sources":["../../../src/focal-point-picker/styles/focal-point-picker-style.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAG9D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAOrB,CAAC;AAEF,eAAO,MAAM,YAAY;;SALX,MAAO,WAAW;yGAU/B,CAAC;AAEF,eAAO,MAAM,cAAc;;SAZb,MAAO,WAAW;yGA+C/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;SAjDf,MAAO,WAAW;yGAyD/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;UAE7B,CAAC;AAsBF,eAAO,MAAM,cAAc;;;;0CAM1B,CAAC;AAEF,eAAO,MAAM,QAAQ;;SA3FP,MAAO,WAAW;;kBAwGgB,OAAO;yGAEtD,CAAC;AAEF,eAAO,MAAM,QAAQ;;SA5GP,MAAO,WAAW;yGAiH/B,CAAC;AAEF,eAAO,MAAM,SAAS;;SAnHR,MAAO,WAAW;;;UAuH/B,CAAC;AAEF,eAAO,MAAM,SAAS;;SAzHR,MAAO,WAAW;;;UA6H/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.tsx"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACX,YAAY,EAGZ,gBAAgB,EAChB,MAAM,SAAS,CAAC;AAIjB;;;;GAIG;AACH,eAAO,MAAM,SAAS,YAAY,CAAC;AAuanC,eAAO,MAAM,WAAW,6GAWvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO;IAGlB;;OAEG;;;;IAIH;;;;OAIG;;;;CAKJ,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.tsx"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACX,YAAY,EAGZ,gBAAgB,EAChB,MAAM,SAAS,CAAC;AAIjB;;;;GAIG;AACH,eAAO,MAAM,SAAS,YAAY,CAAC;AA4bnC,eAAO,MAAM,WAAW,6GAWvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO;IAGlB;;OAEG;;;;IAIH;;;;OAIG;;;;CAKJ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-label.d.ts","sourceRoot":"","sources":["../../src/utils/base-label.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,2CAK/B,CAAC"}
1
+ {"version":3,"file":"base-label.d.ts","sourceRoot":"","sources":["../../src/utils/base-label.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,mBAAmB,2CAK/B,CAAC"}
@@ -37,6 +37,7 @@ declare const _default: {
37
37
  fontSizeXSmall: string;
38
38
  fontLineHeightBase: string;
39
39
  fontWeight: string;
40
+ fontWeightMedium: string;
40
41
  fontWeightHeading: string;
41
42
  gridBase: string;
42
43
  cardPaddingXSmall: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "30.6.1",
3
+ "version": "30.7.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -54,24 +54,24 @@
54
54
  "@types/gradient-parser": "1.1.0",
55
55
  "@types/highlight-words-core": "1.2.1",
56
56
  "@use-gesture/react": "^10.3.1",
57
- "@wordpress/a11y": "^4.33.1",
58
- "@wordpress/base-styles": "^6.9.1",
59
- "@wordpress/compose": "^7.33.1",
60
- "@wordpress/date": "^5.33.1",
61
- "@wordpress/deprecated": "^4.33.1",
62
- "@wordpress/dom": "^4.33.1",
63
- "@wordpress/element": "^6.33.1",
64
- "@wordpress/escape-html": "^3.33.1",
65
- "@wordpress/hooks": "^4.33.1",
66
- "@wordpress/html-entities": "^4.33.1",
67
- "@wordpress/i18n": "^6.6.1",
68
- "@wordpress/icons": "^11.0.1",
69
- "@wordpress/is-shallow-equal": "^5.33.1",
70
- "@wordpress/keycodes": "^4.33.1",
71
- "@wordpress/primitives": "^4.33.1",
72
- "@wordpress/private-apis": "^1.33.1",
73
- "@wordpress/rich-text": "^7.33.1",
74
- "@wordpress/warning": "^3.33.1",
57
+ "@wordpress/a11y": "^4.34.0",
58
+ "@wordpress/base-styles": "^6.10.0",
59
+ "@wordpress/compose": "^7.34.0",
60
+ "@wordpress/date": "^5.34.0",
61
+ "@wordpress/deprecated": "^4.34.0",
62
+ "@wordpress/dom": "^4.34.0",
63
+ "@wordpress/element": "^6.34.0",
64
+ "@wordpress/escape-html": "^3.34.0",
65
+ "@wordpress/hooks": "^4.34.0",
66
+ "@wordpress/html-entities": "^4.34.0",
67
+ "@wordpress/i18n": "^6.7.0",
68
+ "@wordpress/icons": "^11.1.0",
69
+ "@wordpress/is-shallow-equal": "^5.34.0",
70
+ "@wordpress/keycodes": "^4.34.0",
71
+ "@wordpress/primitives": "^4.34.0",
72
+ "@wordpress/private-apis": "^1.34.0",
73
+ "@wordpress/rich-text": "^7.34.0",
74
+ "@wordpress/warning": "^3.34.0",
75
75
  "change-case": "^4.1.2",
76
76
  "clsx": "^2.1.1",
77
77
  "colord": "^2.7.0",
@@ -97,5 +97,5 @@
97
97
  "publishConfig": {
98
98
  "access": "public"
99
99
  },
100
- "gitHead": "5f84bafdec1bed05247c1080c12f6a237951b862"
100
+ "gitHead": "ceebff807958d2e8fc755b5a20473939c78b4d1d"
101
101
  }
@@ -15,13 +15,14 @@
15
15
  text-decoration: none;
16
16
  font-family: inherit;
17
17
  font-size: $default-font-size;
18
+ font-weight: $font-weight-medium;
18
19
  margin: 0;
19
20
  border: 0;
20
21
  cursor: pointer;
21
22
  -webkit-appearance: none;
22
23
  background: none;
23
24
 
24
- @media not (prefers-reduced-motion) {
25
+ @media not ( prefers-reduced-motion ) {
25
26
  transition: box-shadow 0.1s linear;
26
27
  }
27
28
 
@@ -251,6 +252,7 @@
251
252
  background: none;
252
253
  outline: none;
253
254
  text-align: left;
255
+ font-weight: $font-weight-regular;
254
256
  color: $components-color-accent;
255
257
  text-decoration: underline;
256
258
 
@@ -385,6 +387,7 @@
385
387
  svg {
386
388
  fill: currentColor;
387
389
  outline: none;
390
+ flex-shrink: 0;
388
391
 
389
392
  // Optimize for high contrast modes.
390
393
  // See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
package/src/card/types.ts CHANGED
@@ -1,12 +1,8 @@
1
- /**
2
- * External dependencies
3
- */
4
- import type { CSSProperties } from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
9
4
  import type { SurfaceProps } from '../surface/types';
5
+ import type { FlexProps } from '../flex/types';
10
6
 
11
7
  type DeprecatedSizeOptions = 'extraSmall';
12
8
  export type SizeOptions = 'xSmall' | 'small' | 'medium' | 'large';
@@ -90,8 +86,6 @@ type MarginalSubComponentProps = BaseSubComponentProps & {
90
86
  isBorderless?: boolean;
91
87
  };
92
88
 
93
- export type HeaderProps = MarginalSubComponentProps;
89
+ export type HeaderProps = MarginalSubComponentProps & Partial< FlexProps >;
94
90
 
95
- export type FooterProps = MarginalSubComponentProps & {
96
- justify?: CSSProperties[ 'justifyContent' ];
97
- };
91
+ export type FooterProps = MarginalSubComponentProps & Partial< FlexProps >;
@@ -7,11 +7,12 @@ import styled from '@emotion/styled';
7
7
  * Internal dependencies
8
8
  */
9
9
  import { Heading } from '../heading';
10
+ import { CONFIG } from '../utils';
10
11
 
11
12
  export const ColorHeading = styled( Heading )`
12
13
  text-transform: uppercase;
13
14
  line-height: 24px;
14
- font-weight: 500;
15
+ font-weight: ${ CONFIG.fontWeightMedium };
15
16
  &&& {
16
17
  font-size: 11px;
17
18
  margin-bottom: 0;
@@ -365,13 +365,10 @@ function ComboboxControl( props: ComboboxControlProps ) {
365
365
  />
366
366
  </FlexBlock>
367
367
  { isLoading && <Spinner /> }
368
- { allowReset && (
368
+ { allowReset && Boolean( value ) && ! isExpanded && (
369
369
  <Button
370
370
  size="small"
371
371
  icon={ closeSmall }
372
- // Disable reason: Focus returns to input field when reset is clicked.
373
- // eslint-disable-next-line no-restricted-syntax
374
- disabled={ ! value }
375
372
  onClick={ handleOnReset }
376
373
  onKeyDown={ handleResetStopPropagation }
377
374
  label={ __( 'Reset' ) }
@@ -79,7 +79,6 @@ export const Default = Template.bind( {} );
79
79
  Default.args = {
80
80
  __next40pxDefaultSize: true,
81
81
  __nextHasNoMarginBottom: true,
82
- allowReset: false,
83
82
  label: 'Select a country',
84
83
  options: countryOptions,
85
84
  };
@@ -356,7 +356,7 @@ describe.each( [
356
356
  expect( input ).toHaveValue( targetOption.label );
357
357
  } );
358
358
 
359
- it( 'should render with Reset button disabled', () => {
359
+ it( 'should not render Reset button when no value is set', () => {
360
360
  render(
361
361
  <Component
362
362
  options={ timezones }
@@ -365,10 +365,23 @@ describe.each( [
365
365
  />
366
366
  );
367
367
 
368
- const resetButton = screen.getByRole( 'button', { name: 'Reset' } );
368
+ const resetButton = screen.queryByRole( 'button', { name: 'Reset' } );
369
+
370
+ expect( resetButton ).not.toBeInTheDocument();
371
+ } );
372
+
373
+ it( 'should not render Reset button when allowReset is false', () => {
374
+ render(
375
+ <Component
376
+ options={ timezones }
377
+ label={ defaultLabelText }
378
+ allowReset={ false }
379
+ />
380
+ );
381
+
382
+ const resetButton = screen.queryByRole( 'button', { name: 'Reset' } );
369
383
 
370
- expect( resetButton ).toBeVisible();
371
- expect( resetButton ).toBeDisabled();
384
+ expect( resetButton ).not.toBeInTheDocument();
372
385
  } );
373
386
 
374
387
  it( 'should reset input when clicking the Reset button', async () => {
@@ -400,8 +413,8 @@ describe.each( [
400
413
 
401
414
  await user.click( resetButton );
402
415
 
416
+ expect( resetButton ).not.toBeInTheDocument();
403
417
  expect( input ).toHaveValue( '' );
404
- expect( resetButton ).toBeDisabled();
405
418
  expect( input ).toHaveFocus();
406
419
  } );
407
420
 
@@ -439,8 +452,8 @@ describe.each( [
439
452
  // Pressing Enter/Return resets the input.
440
453
  await user.keyboard( '{Enter}' );
441
454
 
455
+ expect( resetButton ).not.toBeInTheDocument();
442
456
  expect( input ).toHaveValue( '' );
443
- expect( resetButton ).toBeDisabled();
444
457
  expect( input ).toHaveFocus();
445
458
  } );
446
459
 
@@ -478,8 +491,8 @@ describe.each( [
478
491
  // Pressing Spacebar resets the input.
479
492
  await user.keyboard( '[Space]' );
480
493
 
494
+ expect( resetButton ).not.toBeInTheDocument();
481
495
  expect( input ).toHaveValue( '' );
482
- expect( resetButton ).toBeDisabled();
483
496
  expect( input ).toHaveFocus();
484
497
  } );
485
498
  } );
@@ -79,6 +79,7 @@ export const DayButton = styled( Button, {
79
79
  border-radius: ${ CONFIG.radiusRound };
80
80
  height: ${ space( 7 ) };
81
81
  width: ${ space( 7 ) };
82
+ font-weight: 400;
82
83
 
83
84
  ${ ( props ) =>
84
85
  props.isSelected &&
@@ -74,7 +74,7 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = `
74
74
 
75
75
  .emotion-12.emotion-12.emotion-12 {
76
76
  font-size: 11px;
77
- font-weight: 500;
77
+ font-weight: 499;
78
78
  line-height: 1.4;
79
79
  text-transform: uppercase;
80
80
  box-sizing: border-box;
@@ -356,7 +356,7 @@ exports[`DimensionControl rendering renders with defaults 1`] = `
356
356
 
357
357
  .emotion-12.emotion-12.emotion-12 {
358
358
  font-size: 11px;
359
- font-weight: 500;
359
+ font-weight: 499;
360
360
  line-height: 1.4;
361
361
  text-transform: uppercase;
362
362
  box-sizing: border-box;
@@ -648,7 +648,7 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`]
648
648
 
649
649
  .emotion-12.emotion-12.emotion-12 {
650
650
  font-size: 11px;
651
- font-weight: 500;
651
+ font-weight: 499;
652
652
  line-height: 1.4;
653
653
  text-transform: uppercase;
654
654
  box-sizing: border-box;
@@ -952,7 +952,7 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`]
952
952
 
953
953
  .emotion-12.emotion-12.emotion-12 {
954
954
  font-size: 11px;
955
- font-weight: 500;
955
+ font-weight: 499;
956
956
  line-height: 1.4;
957
957
  text-transform: uppercase;
958
958
  box-sizing: border-box;
@@ -18,6 +18,7 @@
18
18
  outline: none;
19
19
  cursor: pointer;
20
20
  white-space: nowrap;
21
+ font-weight: $font-weight-regular;
21
22
 
22
23
  &.has-separator {
23
24
  margin-top: 6px;
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import clsx from 'clsx';
5
+ import type { KeyboardEventHandler } from 'react';
5
6
 
6
7
  /**
7
8
  * WordPress dependencies
@@ -10,19 +11,19 @@ import { __ } from '@wordpress/i18n';
10
11
  import { useEffect, useRef, useState } from '@wordpress/element';
11
12
  import {
12
13
  __experimentalUseDragging as useDragging,
13
- useInstanceId,
14
14
  useIsomorphicLayoutEffect,
15
15
  } from '@wordpress/compose';
16
+ import deprecated from '@wordpress/deprecated';
16
17
 
17
18
  /**
18
19
  * Internal dependencies
19
20
  */
20
- import BaseControl from '../base-control';
21
21
  import Controls from './controls';
22
22
  import FocalPoint from './focal-point';
23
23
  import Grid from './grid';
24
24
  import Media from './media';
25
25
  import {
26
+ Container,
26
27
  MediaWrapper,
27
28
  MediaContainer,
28
29
  } from './styles/focal-point-picker-style';
@@ -33,7 +34,11 @@ import type {
33
34
  FocalPoint as FocalPointType,
34
35
  FocalPointPickerProps,
35
36
  } from './types';
36
- import type { KeyboardEventHandler } from 'react';
37
+ import {
38
+ StyledLabel,
39
+ StyledHelp,
40
+ } from '../base-control/styles/base-control-styles';
41
+ import { VisuallyHidden } from '../visually-hidden';
37
42
 
38
43
  const GRID_OVERLAY_TIMEOUT = 600;
39
44
 
@@ -88,6 +93,7 @@ export function FocalPointPicker( {
88
93
  autoPlay = true,
89
94
  className,
90
95
  help,
96
+ hideLabelFromVision,
91
97
  label,
92
98
  onChange,
93
99
  onDrag,
@@ -104,6 +110,14 @@ export function FocalPointPicker( {
104
110
  const [ point, setPoint ] = useState( valueProp );
105
111
  const [ showGridOverlay, setShowGridOverlay ] = useState( false );
106
112
 
113
+ if ( ! __nextHasNoMarginBottom ) {
114
+ deprecated( 'Bottom margin styles for wp.components.FocalPointPicker', {
115
+ since: '6.7',
116
+ version: '7.0',
117
+ hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',
118
+ } );
119
+ }
120
+
107
121
  const { startDrag, endDrag, isDragging } = useDragging( {
108
122
  onDragStart: ( event ) => {
109
123
  dragAreaRef.current?.focus();
@@ -233,9 +247,7 @@ export function FocalPointPicker( {
233
247
  };
234
248
 
235
249
  const classes = clsx( 'components-focal-point-picker-control', className );
236
-
237
- const instanceId = useInstanceId( FocalPointPicker );
238
- const id = `inspector-focal-point-picker-control-${ instanceId }`;
250
+ const Label = hideLabelFromVision ? VisuallyHidden : StyledLabel;
239
251
 
240
252
  useUpdateEffect( () => {
241
253
  setShowGridOverlay( true );
@@ -247,15 +259,8 @@ export function FocalPointPicker( {
247
259
  }, [ x, y ] );
248
260
 
249
261
  return (
250
- <BaseControl
251
- { ...restProps }
252
- __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
253
- __associatedWPComponentName="FocalPointPicker"
254
- label={ label }
255
- id={ id }
256
- help={ help }
257
- className={ classes }
258
- >
262
+ <Container { ...restProps } as="fieldset" className={ classes }>
263
+ { !! label && <Label as="legend">{ label }</Label> }
259
264
  <MediaWrapper className="components-focal-point-picker-wrapper">
260
265
  <MediaContainer
261
266
  className="components-focal-point-picker"
@@ -291,7 +296,12 @@ export function FocalPointPicker( {
291
296
  onChange?.( getFinalValue( value ) );
292
297
  } }
293
298
  />
294
- </BaseControl>
299
+ { !! help && (
300
+ <StyledHelp __nextHasNoMarginBottom={ __nextHasNoMarginBottom }>
301
+ { help }
302
+ </StyledHelp>
303
+ ) }
304
+ </Container>
295
305
  );
296
306
  }
297
307
 
@@ -9,10 +9,20 @@ import styled from '@emotion/styled';
9
9
  */
10
10
  import { Flex } from '../../flex';
11
11
  import UnitControl from '../../unit-control';
12
- import { COLORS, CONFIG } from '../../utils';
12
+ import { View } from '../../view';
13
+ import { COLORS, CONFIG, boxSizingReset, font } from '../../utils';
13
14
  import type { FocalPointPickerControlsProps } from '../types';
14
15
  import { INITIAL_BOUNDS } from '../utils';
15
16
 
17
+ export const Container = styled( View )`
18
+ border: 0;
19
+ padding: 0;
20
+ margin: 0;
21
+ font-family: ${ font( 'default.fontFamily' ) };
22
+ font-size: ${ font( 'default.fontSize' ) };
23
+ ${ boxSizingReset }
24
+ `;
25
+
16
26
  export const MediaWrapper = styled.div`
17
27
  background-color: transparent;
18
28
  display: flex;
@@ -23,6 +23,6 @@
23
23
  color: $gray-700;
24
24
  text-transform: uppercase;
25
25
  font-size: 11px;
26
- font-weight: 500;
26
+ font-weight: $font-weight-medium;
27
27
  white-space: nowrap;
28
28
  }
@@ -6,6 +6,7 @@
6
6
  .components-menu-item__button,
7
7
  .components-menu-item__button.components-button {
8
8
  width: 100%;
9
+ font-weight: $font-weight-regular;
9
10
 
10
11
  &[role="menuitemradio"],
11
12
  &[role="menuitemcheckbox"] {
@@ -151,7 +151,7 @@
151
151
  left: 0;
152
152
 
153
153
  .components-modal__header-heading {
154
- font-size: 1.2rem;
154
+ font-size: $font-size-x-large;
155
155
  font-weight: 600;
156
156
  }
157
157
 
@@ -52,7 +52,7 @@ export const NameContainer = styled.div`
52
52
  export const PaletteHeading = styled( Heading )`
53
53
  text-transform: uppercase;
54
54
  line-height: ${ space( 6 ) };
55
- font-weight: 500;
55
+ font-weight: ${ CONFIG.fontWeightMedium };
56
56
  &&& {
57
57
  font-size: 11px;
58
58
  margin-bottom: 0;
@@ -89,7 +89,7 @@
89
89
  padding: $grid-unit-20 $grid-unit-60 $grid-unit-20 $grid-unit-20;
90
90
  outline: none;
91
91
  width: 100%;
92
- font-weight: 500;
92
+ font-weight: $font-weight-medium;
93
93
  text-align: left;
94
94
  color: $gray-900;
95
95
  border: none;
@@ -268,9 +268,30 @@ const UnforwardedPopover = (
268
268
  onDialogClose = ( type: string | undefined, event: SyntheticEvent ) => {
269
269
  // Ideally the popover should have just a single onClose prop and
270
270
  // not three props that potentially do the same thing.
271
- if ( type === 'focus-outside' && onFocusOutside ) {
272
- onFocusOutside( event );
271
+ if ( type === 'focus-outside' ) {
272
+ // Check if this blur event is actually relevant to this popover
273
+ const blurTarget = event?.target as Element;
274
+ const referenceElement = refs.reference.current;
275
+ const floatingElement = refs.floating.current;
276
+
277
+ // Check if blur is from this popover's reference element or its floating content
278
+ const isBlurFromThisPopover =
279
+ ( referenceElement &&
280
+ 'contains' in referenceElement &&
281
+ referenceElement.contains( blurTarget ) ) ||
282
+ floatingElement?.contains( blurTarget );
283
+ // Only proceed if the blur is actually from this popover
284
+ if ( ! isBlurFromThisPopover ) {
285
+ return;
286
+ }
287
+ // Call onFocusOutside if defined or call onClose.
288
+ if ( onFocusOutside ) {
289
+ onFocusOutside( event );
290
+ } else if ( onClose ) {
291
+ onClose();
292
+ }
273
293
  } else if ( onClose ) {
294
+ // onClose should be called for other event types if it exists.
274
295
  onClose();
275
296
  }
276
297
  };
@@ -21,7 +21,7 @@
21
21
  cursor: pointer;
22
22
  padding: 3px $grid-unit-20; // Use padding to offset the is-active border, this benefits Windows High Contrast mode
23
23
  margin-left: 0;
24
- font-weight: 500;
24
+ font-weight: $font-weight-regular;
25
25
 
26
26
  &:focus:not(:disabled) {
27
27
  position: relative;
@@ -58,7 +58,7 @@ export const StyledTabList = styled( Ariakit.TabList )`
58
58
  when scaling in the transform, see: https://stackoverflow.com/a/52159123 */
59
59
  --antialiasing-factor: 100;
60
60
  &[aria-orientation='horizontal'] {
61
- --fade-width: 4rem;
61
+ --fade-width: 64px;
62
62
  --fade-gradient-base: transparent 0%, black var( --fade-width );
63
63
  --fade-gradient-composed: var( --fade-gradient-base ), black 60%,
64
64
  transparent 50%;
@@ -26,7 +26,7 @@ exports[`ToggleGroupControl controlled should render correctly with icons 1`] =
26
26
 
27
27
  .emotion-6 {
28
28
  font-size: 11px;
29
- font-weight: 500;
29
+ font-weight: 499;
30
30
  line-height: 1.4;
31
31
  text-transform: uppercase;
32
32
  display: block;
@@ -391,7 +391,7 @@ exports[`ToggleGroupControl controlled should render correctly with text options
391
391
 
392
392
  .emotion-6 {
393
393
  font-size: 11px;
394
- font-weight: 500;
394
+ font-weight: 499;
395
395
  line-height: 1.4;
396
396
  text-transform: uppercase;
397
397
  display: block;
@@ -660,7 +660,7 @@ exports[`ToggleGroupControl uncontrolled should render correctly with icons 1`]
660
660
 
661
661
  .emotion-6 {
662
662
  font-size: 11px;
663
- font-weight: 500;
663
+ font-weight: 499;
664
664
  line-height: 1.4;
665
665
  text-transform: uppercase;
666
666
  display: block;
@@ -1019,7 +1019,7 @@ exports[`ToggleGroupControl uncontrolled should render correctly with text optio
1019
1019
 
1020
1020
  .emotion-6 {
1021
1021
  font-size: 11px;
1022
- font-weight: 500;
1022
+ font-weight: 499;
1023
1023
  line-height: 1.4;
1024
1024
  text-transform: uppercase;
1025
1025
  display: block;
@@ -86,7 +86,7 @@ export const ToolsPanelHeader = css`
86
86
 
87
87
  export const ToolsPanelHeading = css`
88
88
  font-size: inherit;
89
- font-weight: 500;
89
+ font-weight: ${ CONFIG.fontWeightMedium };
90
90
  line-height: normal;
91
91
 
92
92
  /* Required to meet specificity requirements to ensure zero margin */
@@ -150,7 +150,7 @@ export const DropdownMenu = css`
150
150
  export const ResetLabel = styled.span`
151
151
  color: ${ COLORS.theme.accentDarker10 };
152
152
  font-size: 11px;
153
- font-weight: 500;
153
+ font-weight: ${ CONFIG.fontWeightMedium };
154
154
  line-height: 1.4;
155
155
  ${ rtl( { marginLeft: space( 3 ) } ) }
156
156
  text-transform: uppercase;
@@ -3,11 +3,16 @@
3
3
  */
4
4
  import { css } from '@emotion/react';
5
5
 
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import CONFIG from './config-values.js';
10
+
6
11
  // This is a very low-level mixin which you shouldn't have to use directly.
7
12
  // Try to use BaseControl's StyledLabel or BaseControl.VisualLabel if you can.
8
13
  export const baseLabelTypography = css`
9
14
  font-size: 11px;
10
- font-weight: 500;
15
+ font-weight: ${ CONFIG.fontWeightMedium };
11
16
  line-height: 1.4;
12
17
  text-transform: uppercase;
13
18
  `;
@@ -51,6 +51,7 @@ export default Object.assign( {}, CONTROL_PROPS, {
51
51
  fontSizeXSmall: 'calc(0.75 * 13px)',
52
52
  fontLineHeightBase: '1.4',
53
53
  fontWeight: 'normal',
54
+ fontWeightMedium: '499', // ensures fallback to 400 (instead of 600)
54
55
  fontWeightHeading: '600',
55
56
  gridBase: '4px',
56
57
  cardPaddingXSmall: `${ space( 2 ) }`,
@@ -61,7 +61,7 @@
61
61
  gap: 4px;
62
62
  margin: 8px 0 0;
63
63
  font-family: $font-family-body;
64
- font-size: 0.75rem;
64
+ font-size: $font-size-small;
65
65
  line-height: 16px; // matches the icon size
66
66
  color: $components-color-gray-700;
67
67
  animation: