@wordpress/components 28.0.0 → 28.1.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.
@@ -142,6 +142,8 @@ export const WithCustomLabel: StoryFn< typeof CheckboxControl > = ( {
142
142
  setChecked( v );
143
143
  onChange( v );
144
144
  } }
145
+ // Disable reason: For simplicity of the code snippet.
146
+ // eslint-disable-next-line no-restricted-syntax
145
147
  id="my-checkbox-with-custom-label"
146
148
  aria-describedby="my-custom-description"
147
149
  />
@@ -149,6 +151,7 @@ export const WithCustomLabel: StoryFn< typeof CheckboxControl > = ( {
149
151
  <label htmlFor="my-checkbox-with-custom-label">
150
152
  My custom label
151
153
  </label>
154
+ { /* eslint-disable-next-line no-restricted-syntax */ }
152
155
  <div id="my-custom-description" style={ { fontSize: 13 } }>
153
156
  A custom description.
154
157
  </div>
@@ -5,6 +5,8 @@
5
5
  @include break-small() {
6
6
  --checkbox-input-size: 20px;
7
7
  }
8
+
9
+ --checkbox-input-margin: #{$grid-unit-10};
8
10
  }
9
11
 
10
12
  .components-checkbox-control__label {
@@ -55,7 +57,7 @@
55
57
  .components-checkbox-control__input-container {
56
58
  position: relative;
57
59
  display: inline-block;
58
- margin-right: $grid-unit-15;
60
+ margin-right: var(--checkbox-input-margin);
59
61
  vertical-align: middle;
60
62
  width: var(--checkbox-input-size);
61
63
  aspect-ratio: 1;
@@ -84,5 +86,5 @@ svg.components-checkbox-control__indeterminate {
84
86
 
85
87
  .components-checkbox-control__help {
86
88
  display: inline-block;
87
- margin-inline-start: calc(var(--checkbox-input-size) + #{$grid-unit-15});
89
+ margin-inline-start: calc(var(--checkbox-input-size) + var(--checkbox-input-margin));
88
90
  }
@@ -68,6 +68,7 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = `
68
68
  color: #1e1e1e;
69
69
  line-height: 1.4;
70
70
  margin: 0;
71
+ text-wrap: balance;
71
72
  text-wrap: pretty;
72
73
  font-size: calc((13 / 13) * 13px);
73
74
  font-weight: normal;
@@ -347,6 +348,7 @@ exports[`DimensionControl rendering renders with defaults 1`] = `
347
348
  color: #1e1e1e;
348
349
  line-height: 1.4;
349
350
  margin: 0;
351
+ text-wrap: balance;
350
352
  text-wrap: pretty;
351
353
  font-size: calc((13 / 13) * 13px);
352
354
  font-weight: normal;
@@ -636,6 +638,7 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`]
636
638
  color: #1e1e1e;
637
639
  line-height: 1.4;
638
640
  margin: 0;
641
+ text-wrap: balance;
639
642
  text-wrap: pretty;
640
643
  font-size: calc((13 / 13) * 13px);
641
644
  font-weight: normal;
@@ -937,6 +940,7 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`]
937
940
  color: #1e1e1e;
938
941
  line-height: 1.4;
939
942
  margin: 0;
943
+ text-wrap: balance;
940
944
  text-wrap: pretty;
941
945
  font-size: calc((13 / 13) * 13px);
942
946
  font-weight: normal;
@@ -5,6 +5,7 @@ exports[`props should render correctly 1`] = `
5
5
  color: #1e1e1e;
6
6
  line-height: 1.4;
7
7
  margin: 0;
8
+ text-wrap: balance;
8
9
  text-wrap: pretty;
9
10
  color: #1e1e1e;
10
11
  font-size: calc(1.95 * 13px);
@@ -73,7 +73,7 @@ export function RadioControl(
73
73
  help={ help }
74
74
  className={ clsx( className, 'components-radio-control' ) }
75
75
  >
76
- <VStack spacing={ 1 }>
76
+ <VStack spacing={ 3 }>
77
77
  { options.map( ( option, index ) => (
78
78
  <div
79
79
  key={ `${ id }-${ index }` }
@@ -7,7 +7,7 @@
7
7
  @include radio-control;
8
8
 
9
9
  display: inline-flex;
10
- margin: 0 6px 0 0;
10
+ margin: 0 $grid-unit-10 0 0;
11
11
  padding: 0;
12
12
  appearance: none;
13
13
  cursor: pointer;
@@ -53,10 +53,12 @@ function useTrackElementOffset(
53
53
 
54
54
  function updateIndicator( element: HTMLElement ) {
55
55
  setIndicatorPosition( {
56
- left: element.offsetLeft,
57
- top: element.offsetTop,
58
- width: element.offsetWidth,
59
- height: element.offsetHeight,
56
+ // Workaround to prevent unwanted scrollbars, see:
57
+ // https://github.com/WordPress/gutenberg/pull/61979
58
+ left: Math.max( element.offsetLeft - 1, 0 ),
59
+ top: Math.max( element.offsetTop - 1, 0 ),
60
+ width: parseFloat( getComputedStyle( element ).width ),
61
+ height: parseFloat( getComputedStyle( element ).height ),
60
62
  } );
61
63
  updateCallbackRef.current?.();
62
64
  }
@@ -12,6 +12,7 @@ export const Text = css`
12
12
  color: ${ COLORS.gray[ 900 ] };
13
13
  line-height: ${ CONFIG.fontLineHeightBase };
14
14
  margin: 0;
15
+ text-wrap: balance; /* Fallback for Safari. */
15
16
  text-wrap: pretty;
16
17
  `;
17
18
 
@@ -22,6 +22,7 @@ exports[`Text should render highlighted words with highlightCaseSensitive 1`] =
22
22
  color: #1e1e1e;
23
23
  line-height: 1.4;
24
24
  margin: 0;
25
+ text-wrap: balance;
25
26
  text-wrap: pretty;
26
27
  font-size: calc((13 / 13) * 13px);
27
28
  font-weight: normal;
@@ -54,6 +55,7 @@ exports[`Text snapshot tests should render correctly 1`] = `
54
55
  color: #1e1e1e;
55
56
  line-height: 1.4;
56
57
  margin: 0;
58
+ text-wrap: balance;
57
59
  text-wrap: pretty;
58
60
  font-size: calc((13 / 13) * 13px);
59
61
  font-weight: normal;