@wordpress/components 30.6.1 → 30.7.1-next.36001005c.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 (103) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/build/color-palette/styles.js +2 -12
  3. package/build/color-palette/styles.js.map +2 -2
  4. package/build/custom-select-control-v2/custom-select.js +2 -2
  5. package/build/custom-select-control-v2/custom-select.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/font-size-picker/font-size-picker-select.js +19 -20
  9. package/build/font-size-picker/font-size-picker-select.js.map +3 -3
  10. package/build/font-size-picker/font-size-picker-toggle-group.js +3 -27
  11. package/build/font-size-picker/font-size-picker-toggle-group.js.map +2 -2
  12. package/build/font-size-picker/index.js +11 -23
  13. package/build/font-size-picker/index.js.map +2 -2
  14. package/build/font-size-picker/styles.js +13 -30
  15. package/build/font-size-picker/styles.js.map +3 -3
  16. package/build/font-size-picker/utils.js +0 -11
  17. package/build/font-size-picker/utils.js.map +2 -2
  18. package/build/palette-edit/styles.js +9 -9
  19. package/build/palette-edit/styles.js.map +2 -2
  20. package/build/popover/index.js +13 -2
  21. package/build/popover/index.js.map +2 -2
  22. package/build/tools-panel/styles.js +14 -22
  23. package/build/tools-panel/styles.js.map +2 -2
  24. package/build/utils/base-label.js +12 -12
  25. package/build/utils/base-label.js.map +3 -3
  26. package/build/utils/config-values.js +2 -0
  27. package/build/utils/config-values.js.map +2 -2
  28. package/build-module/color-palette/styles.js +2 -12
  29. package/build-module/color-palette/styles.js.map +2 -2
  30. package/build-module/custom-select-control-v2/custom-select.js +1 -1
  31. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  32. package/build-module/date-time/date/styles.js +9 -9
  33. package/build-module/date-time/date/styles.js.map +2 -2
  34. package/build-module/font-size-picker/font-size-picker-select.js +10 -21
  35. package/build-module/font-size-picker/font-size-picker-select.js.map +2 -2
  36. package/build-module/font-size-picker/font-size-picker-toggle-group.js +3 -27
  37. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +2 -2
  38. package/build-module/font-size-picker/index.js +11 -23
  39. package/build-module/font-size-picker/index.js.map +2 -2
  40. package/build-module/font-size-picker/styles.js +12 -28
  41. package/build-module/font-size-picker/styles.js.map +2 -2
  42. package/build-module/font-size-picker/utils.js +0 -10
  43. package/build-module/font-size-picker/utils.js.map +2 -2
  44. package/build-module/palette-edit/styles.js +9 -9
  45. package/build-module/palette-edit/styles.js.map +2 -2
  46. package/build-module/popover/index.js +13 -2
  47. package/build-module/popover/index.js.map +2 -2
  48. package/build-module/tools-panel/styles.js +14 -22
  49. package/build-module/tools-panel/styles.js.map +2 -2
  50. package/build-module/utils/base-label.js +2 -12
  51. package/build-module/utils/base-label.js.map +2 -2
  52. package/build-module/utils/config-values.js +2 -0
  53. package/build-module/utils/config-values.js.map +2 -2
  54. package/build-style/style-rtl.css +8 -4
  55. package/build-style/style.css +8 -4
  56. package/build-types/color-palette/styles.d.ts.map +1 -1
  57. package/build-types/date-time/date/styles.d.ts.map +1 -1
  58. package/build-types/font-size-picker/font-size-picker-select.d.ts +0 -3
  59. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  60. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  61. package/build-types/font-size-picker/index.d.ts.map +1 -1
  62. package/build-types/font-size-picker/styles.d.ts +0 -3
  63. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  64. package/build-types/font-size-picker/types.d.ts +4 -18
  65. package/build-types/font-size-picker/types.d.ts.map +1 -1
  66. package/build-types/font-size-picker/utils.d.ts +1 -10
  67. package/build-types/font-size-picker/utils.d.ts.map +1 -1
  68. package/build-types/popover/index.d.ts.map +1 -1
  69. package/build-types/utils/base-label.d.ts.map +1 -1
  70. package/build-types/utils/config-values.d.ts +1 -0
  71. package/package.json +20 -20
  72. package/src/badge/styles.scss +0 -1
  73. package/src/button/style.scss +4 -1
  74. package/src/color-palette/styles.ts +2 -1
  75. package/src/custom-select-control-v2/custom-select.tsx +1 -1
  76. package/src/date-time/date/styles.ts +1 -0
  77. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  78. package/src/dropdown-menu/style.scss +1 -0
  79. package/src/font-size-picker/README.md +0 -10
  80. package/src/font-size-picker/font-size-picker-select.tsx +11 -44
  81. package/src/font-size-picker/font-size-picker-toggle-group.tsx +4 -58
  82. package/src/font-size-picker/index.tsx +19 -44
  83. package/src/font-size-picker/styles.ts +0 -9
  84. package/src/font-size-picker/test/index.tsx +2 -460
  85. package/src/font-size-picker/types.ts +4 -24
  86. package/src/font-size-picker/utils.ts +1 -23
  87. package/src/menu-group/style.scss +1 -1
  88. package/src/menu-item/style.scss +1 -0
  89. package/src/palette-edit/styles.ts +1 -1
  90. package/src/panel/style.scss +1 -1
  91. package/src/popover/index.tsx +23 -2
  92. package/src/tab-panel/style.scss +1 -1
  93. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
  94. package/src/tools-panel/styles.ts +2 -2
  95. package/src/utils/base-label.ts +6 -1
  96. package/src/utils/config-values.js +1 -0
  97. package/tsconfig.tsbuildinfo +1 -1
  98. package/build-types/font-size-picker/test/font-size-picker-select.d.ts +0 -2
  99. package/build-types/font-size-picker/test/font-size-picker-select.d.ts.map +0 -1
  100. package/build-types/font-size-picker/test/font-size-picker-toggle-group.d.ts +0 -2
  101. package/build-types/font-size-picker/test/font-size-picker-toggle-group.d.ts.map +0 -1
  102. package/src/font-size-picker/test/font-size-picker-select.tsx +0 -221
  103. package/src/font-size-picker/test/font-size-picker-toggle-group.tsx +0 -275
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import type { FontSizePickerProps, FontSize } from './types';
4
+ import type { FontSizePickerProps } from './types';
5
5
 
6
6
  /**
7
7
  * Some themes use css vars for their font sizes, so until we
@@ -17,25 +17,3 @@ export function isSimpleCssValue(
17
17
  /^[\d\.]+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i;
18
18
  return sizeRegex.test( String( value ) );
19
19
  }
20
-
21
- /**
22
- * Generates hint text for a font size.
23
- * This function returns the hint provided by the consumer, if any.
24
- * If no hint is provided, it falls back to showing the size value for simple CSS values.
25
- *
26
- * @param fontSize The font size object to generate hint text for.
27
- * @return The hint text provided by the consumer, or the size value for simple CSS values, or undefined.
28
- */
29
- export function generateFontSizeHint( fontSize: FontSize ): string | undefined {
30
- // If the font size already has a hint, use it
31
- if ( fontSize.hint ) {
32
- return fontSize.hint;
33
- }
34
-
35
- // Fallback to showing the size value if it's a simple CSS value
36
- if ( isSimpleCssValue( fontSize.size ) ) {
37
- return String( fontSize.size );
38
- }
39
-
40
- return undefined;
41
- }
@@ -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"] {
@@ -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;
@@ -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 ) }`,