@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.
- package/CHANGELOG.md +10 -2
- package/build/color-palette/styles.js +2 -12
- package/build/color-palette/styles.js.map +2 -2
- package/build/custom-select-control-v2/custom-select.js +2 -2
- package/build/custom-select-control-v2/custom-select.js.map +2 -2
- package/build/date-time/date/styles.js +9 -9
- package/build/date-time/date/styles.js.map +2 -2
- package/build/font-size-picker/font-size-picker-select.js +19 -20
- package/build/font-size-picker/font-size-picker-select.js.map +3 -3
- package/build/font-size-picker/font-size-picker-toggle-group.js +3 -27
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +2 -2
- package/build/font-size-picker/index.js +11 -23
- package/build/font-size-picker/index.js.map +2 -2
- package/build/font-size-picker/styles.js +13 -30
- package/build/font-size-picker/styles.js.map +3 -3
- package/build/font-size-picker/utils.js +0 -11
- package/build/font-size-picker/utils.js.map +2 -2
- package/build/palette-edit/styles.js +9 -9
- package/build/palette-edit/styles.js.map +2 -2
- package/build/popover/index.js +13 -2
- package/build/popover/index.js.map +2 -2
- package/build/tools-panel/styles.js +14 -22
- package/build/tools-panel/styles.js.map +2 -2
- package/build/utils/base-label.js +12 -12
- package/build/utils/base-label.js.map +3 -3
- package/build/utils/config-values.js +2 -0
- package/build/utils/config-values.js.map +2 -2
- package/build-module/color-palette/styles.js +2 -12
- package/build-module/color-palette/styles.js.map +2 -2
- package/build-module/custom-select-control-v2/custom-select.js +1 -1
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/date-time/date/styles.js +9 -9
- package/build-module/date-time/date/styles.js.map +2 -2
- package/build-module/font-size-picker/font-size-picker-select.js +10 -21
- package/build-module/font-size-picker/font-size-picker-select.js.map +2 -2
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +3 -27
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +2 -2
- package/build-module/font-size-picker/index.js +11 -23
- package/build-module/font-size-picker/index.js.map +2 -2
- package/build-module/font-size-picker/styles.js +12 -28
- package/build-module/font-size-picker/styles.js.map +2 -2
- package/build-module/font-size-picker/utils.js +0 -10
- package/build-module/font-size-picker/utils.js.map +2 -2
- package/build-module/palette-edit/styles.js +9 -9
- package/build-module/palette-edit/styles.js.map +2 -2
- package/build-module/popover/index.js +13 -2
- package/build-module/popover/index.js.map +2 -2
- package/build-module/tools-panel/styles.js +14 -22
- package/build-module/tools-panel/styles.js.map +2 -2
- package/build-module/utils/base-label.js +2 -12
- package/build-module/utils/base-label.js.map +2 -2
- package/build-module/utils/config-values.js +2 -0
- package/build-module/utils/config-values.js.map +2 -2
- package/build-style/style-rtl.css +8 -4
- package/build-style/style.css +8 -4
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-select.d.ts +0 -3
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +0 -3
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/font-size-picker/types.d.ts +4 -18
- package/build-types/font-size-picker/types.d.ts.map +1 -1
- package/build-types/font-size-picker/utils.d.ts +1 -10
- package/build-types/font-size-picker/utils.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/utils/base-label.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +1 -0
- package/package.json +20 -20
- package/src/badge/styles.scss +0 -1
- package/src/button/style.scss +4 -1
- package/src/color-palette/styles.ts +2 -1
- package/src/custom-select-control-v2/custom-select.tsx +1 -1
- package/src/date-time/date/styles.ts +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
- package/src/dropdown-menu/style.scss +1 -0
- package/src/font-size-picker/README.md +0 -10
- package/src/font-size-picker/font-size-picker-select.tsx +11 -44
- package/src/font-size-picker/font-size-picker-toggle-group.tsx +4 -58
- package/src/font-size-picker/index.tsx +19 -44
- package/src/font-size-picker/styles.ts +0 -9
- package/src/font-size-picker/test/index.tsx +2 -460
- package/src/font-size-picker/types.ts +4 -24
- package/src/font-size-picker/utils.ts +1 -23
- package/src/menu-group/style.scss +1 -1
- package/src/menu-item/style.scss +1 -0
- package/src/palette-edit/styles.ts +1 -1
- package/src/panel/style.scss +1 -1
- package/src/popover/index.tsx +23 -2
- package/src/tab-panel/style.scss +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
- package/src/tools-panel/styles.ts +2 -2
- package/src/utils/base-label.ts +6 -1
- package/src/utils/config-values.js +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build-types/font-size-picker/test/font-size-picker-select.d.ts +0 -2
- package/build-types/font-size-picker/test/font-size-picker-select.d.ts.map +0 -1
- package/build-types/font-size-picker/test/font-size-picker-toggle-group.d.ts +0 -2
- package/build-types/font-size-picker/test/font-size-picker-toggle-group.d.ts.map +0 -1
- package/src/font-size-picker/test/font-size-picker-select.tsx +0 -221
- 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
|
|
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
|
-
}
|
package/src/menu-item/style.scss
CHANGED
|
@@ -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:
|
|
55
|
+
font-weight: ${ CONFIG.fontWeightMedium };
|
|
56
56
|
&&& {
|
|
57
57
|
font-size: 11px;
|
|
58
58
|
margin-bottom: 0;
|
package/src/panel/style.scss
CHANGED
package/src/popover/index.tsx
CHANGED
|
@@ -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'
|
|
272
|
-
|
|
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
|
};
|
package/src/tab-panel/style.scss
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
153
|
+
font-weight: ${ CONFIG.fontWeightMedium };
|
|
154
154
|
line-height: 1.4;
|
|
155
155
|
${ rtl( { marginLeft: space( 3 ) } ) }
|
|
156
156
|
text-transform: uppercase;
|
package/src/utils/base-label.ts
CHANGED
|
@@ -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:
|
|
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 ) }`,
|