@wordpress/components 29.2.0 → 29.3.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 (29) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/border-box-control/border-box-control-linked-button/component.js +8 -15
  3. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  4. package/build/box-control/index.js +6 -0
  5. package/build/box-control/index.js.map +1 -1
  6. package/build/box-control/linked-button.js +7 -11
  7. package/build/box-control/linked-button.js.map +1 -1
  8. package/build/box-control/types.js.map +1 -1
  9. package/build-module/border-box-control/border-box-control-linked-button/component.js +8 -15
  10. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  11. package/build-module/box-control/index.js +6 -0
  12. package/build-module/box-control/index.js.map +1 -1
  13. package/build-module/box-control/linked-button.js +7 -11
  14. package/build-module/box-control/linked-button.js.map +1 -1
  15. package/build-module/box-control/types.js.map +1 -1
  16. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  17. package/build-types/box-control/index.d.ts.map +1 -1
  18. package/build-types/box-control/linked-button.d.ts.map +1 -1
  19. package/build-types/box-control/stories/index.story.d.ts +7 -2331
  20. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  21. package/build-types/box-control/types.d.ts +15 -3
  22. package/build-types/box-control/types.d.ts.map +1 -1
  23. package/package.json +19 -19
  24. package/src/border-box-control/border-box-control-linked-button/component.tsx +9 -14
  25. package/src/box-control/index.tsx +9 -0
  26. package/src/box-control/linked-button.tsx +8 -11
  27. package/src/box-control/test/index.tsx +9 -2
  28. package/src/box-control/types.ts +26 -11
  29. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/box-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAOtD;;GAEG;AAC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yHAAgC,CAAC;AAM5D,eAAO,MAAM,UAAU,yHAAgC,CAAC;AAMxD,eAAO,MAAM,aAAa,yHAAgC,CAAC;AAM3D,eAAO,MAAM,2BAA2B,yHAAgC,CAAC;AAOzE,eAAO,MAAM,kBAAkB,yHAAgC,CAAC"}
@@ -89,17 +89,29 @@ export type BoxControlProps = Pick<UnitControlProps, 'units'> & DeprecatedBoxCon
89
89
  * @default false
90
90
  */
91
91
  __next40pxDefaultSize?: boolean;
92
+ } & ({
92
93
  /**
93
94
  * Available presets to pick from.
94
95
  */
95
- presets?: Preset[];
96
+ presets?: never;
96
97
  /**
97
98
  * The key of the preset to apply.
98
99
  * If you provide a list of presets, you must provide a preset key to use.
99
100
  * The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
100
101
  */
101
- presetKey?: string;
102
- };
102
+ presetKey?: never;
103
+ } | {
104
+ /**
105
+ * Available presets to pick from.
106
+ */
107
+ presets: Preset[];
108
+ /**
109
+ * The key of the preset to apply.
110
+ * If you provide a list of presets, you must provide a preset key to use.
111
+ * The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
112
+ */
113
+ presetKey: string;
114
+ });
103
115
  export type BoxControlInputControlProps = UnitControlPassthroughProps & {
104
116
  onChange?: (nextValues: BoxControlValue) => void;
105
117
  onFocus?: (_event: React.FocusEvent<HTMLInputElement>, { side }: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/box-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,eAAe,GAAG;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,C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E,KAAK,CAAC,cAAc,CAAE,eAAe,CAAE,CAAE,CAAC;IAC5E,MAAM,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,KAAK,EAAE,eAAe,CAAE,OAAO,CAAE,CAAC;IAClC;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,eAAe,CAAE,OAAO,CAAE,CAAC;CACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "29.2.0",
3
+ "version": "29.3.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -44,23 +44,23 @@
44
44
  "@types/gradient-parser": "0.1.3",
45
45
  "@types/highlight-words-core": "1.2.1",
46
46
  "@use-gesture/react": "^10.3.1",
47
- "@wordpress/a11y": "^4.16.0",
48
- "@wordpress/compose": "^7.16.0",
49
- "@wordpress/date": "^5.16.0",
50
- "@wordpress/deprecated": "^4.16.0",
51
- "@wordpress/dom": "^4.16.0",
52
- "@wordpress/element": "^6.16.0",
53
- "@wordpress/escape-html": "^3.16.0",
54
- "@wordpress/hooks": "^4.16.0",
55
- "@wordpress/html-entities": "^4.16.0",
56
- "@wordpress/i18n": "^5.16.0",
57
- "@wordpress/icons": "^10.16.0",
58
- "@wordpress/is-shallow-equal": "^5.16.0",
59
- "@wordpress/keycodes": "^4.16.0",
60
- "@wordpress/primitives": "^4.16.0",
61
- "@wordpress/private-apis": "^1.16.0",
62
- "@wordpress/rich-text": "^7.16.0",
63
- "@wordpress/warning": "^3.16.0",
47
+ "@wordpress/a11y": "^4.17.0",
48
+ "@wordpress/compose": "^7.17.0",
49
+ "@wordpress/date": "^5.17.0",
50
+ "@wordpress/deprecated": "^4.17.0",
51
+ "@wordpress/dom": "^4.17.0",
52
+ "@wordpress/element": "^6.17.0",
53
+ "@wordpress/escape-html": "^3.17.0",
54
+ "@wordpress/hooks": "^4.17.0",
55
+ "@wordpress/html-entities": "^4.17.0",
56
+ "@wordpress/i18n": "^5.17.0",
57
+ "@wordpress/icons": "^10.17.0",
58
+ "@wordpress/is-shallow-equal": "^5.17.0",
59
+ "@wordpress/keycodes": "^4.17.0",
60
+ "@wordpress/primitives": "^4.17.0",
61
+ "@wordpress/private-apis": "^1.17.0",
62
+ "@wordpress/rich-text": "^7.17.0",
63
+ "@wordpress/warning": "^3.17.0",
64
64
  "change-case": "^4.1.2",
65
65
  "clsx": "^2.1.1",
66
66
  "colord": "^2.7.0",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "f48b9f56629e400891abb5ae491504de475237ff"
88
+ "gitHead": "68a831c3178197fe87db284d4b94e5743bfb6b6c"
89
89
  }
@@ -8,8 +8,6 @@ import { __ } from '@wordpress/i18n';
8
8
  * Internal dependencies
9
9
  */
10
10
  import Button from '../../button';
11
- import Tooltip from '../../tooltip';
12
- import { View } from '../../view';
13
11
  import type { WordPressComponentProps } from '../../context';
14
12
  import { contextConnect } from '../../context';
15
13
  import { useBorderBoxControlLinkedButton } from './hook';
@@ -25,18 +23,15 @@ const BorderBoxControlLinkedButton = (
25
23
  const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
26
24
 
27
25
  return (
28
- <Tooltip text={ label }>
29
- <View className={ className }>
30
- <Button
31
- { ...buttonProps }
32
- size="small"
33
- icon={ isLinked ? link : linkOff }
34
- iconSize={ 24 }
35
- aria-label={ label }
36
- ref={ forwardedRef }
37
- />
38
- </View>
39
- </Tooltip>
26
+ <Button
27
+ { ...buttonProps }
28
+ size="small"
29
+ icon={ isLinked ? link : linkOff }
30
+ iconSize={ 24 }
31
+ label={ label }
32
+ ref={ forwardedRef }
33
+ className={ className }
34
+ />
40
35
  );
41
36
  };
42
37
 
@@ -4,6 +4,7 @@
4
4
  import { useInstanceId } from '@wordpress/compose';
5
5
  import { useState } from '@wordpress/element';
6
6
  import { __ } from '@wordpress/i18n';
7
+ import warning from '@wordpress/warning';
7
8
 
8
9
  /**
9
10
  * Internal dependencies
@@ -166,6 +167,14 @@ function BoxControl( {
166
167
  } );
167
168
  const sidesToRender = getAllowedSides( sides );
168
169
 
170
+ if ( ( presets && ! presetKey ) || ( ! presets && presetKey ) ) {
171
+ const definedProp = presets ? 'presets' : 'presetKey';
172
+ const missingProp = presets ? 'presetKey' : 'presets';
173
+ warning(
174
+ `wp.components.BoxControl: the '${ missingProp }' prop is required when the '${ definedProp }' prop is defined.`
175
+ );
176
+ }
177
+
169
178
  return (
170
179
  <Grid
171
180
  id={ id }
@@ -8,7 +8,6 @@ import { __ } from '@wordpress/i18n';
8
8
  * Internal dependencies
9
9
  */
10
10
  import Button from '../button';
11
- import Tooltip from '../tooltip';
12
11
 
13
12
  export default function LinkedButton( {
14
13
  isLinked,
@@ -17,15 +16,13 @@ export default function LinkedButton( {
17
16
  const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
18
17
 
19
18
  return (
20
- <Tooltip text={ label }>
21
- <Button
22
- { ...props }
23
- className="component-box-control__linked-button"
24
- size="small"
25
- icon={ isLinked ? link : linkOff }
26
- iconSize={ 24 }
27
- aria-label={ label }
28
- />
29
- </Tooltip>
19
+ <Button
20
+ { ...props }
21
+ className="component-box-control__linked-button"
22
+ size="small"
23
+ icon={ isLinked ? link : linkOff }
24
+ iconSize={ 24 }
25
+ label={ label }
26
+ />
30
27
  );
31
28
  }
@@ -15,8 +15,15 @@ import { useState } from '@wordpress/element';
15
15
  import BoxControl from '..';
16
16
  import type { BoxControlProps, BoxControlValue } from '../types';
17
17
 
18
+ // Since `BoxControlProps` is a the result of type unions, we need to use
19
+ // a distributive version of the standard `Omit` utility.
20
+ // See https://stackoverflow.com/a/57103940
21
+ type DistributiveOmit< T, K extends keyof any > = T extends any
22
+ ? Omit< T, K >
23
+ : never;
24
+
18
25
  const ControlledBoxControl = (
19
- extraProps: Omit< BoxControlProps, 'onChange' >
26
+ extraProps: DistributiveOmit< BoxControlProps, 'onChange' >
20
27
  ) => {
21
28
  const [ state, setState ] = useState< BoxControlValue >();
22
29
 
@@ -33,7 +40,7 @@ const ControlledBoxControl = (
33
40
  const UncontrolledBoxControl = ( {
34
41
  onChange = () => {},
35
42
  ...props
36
- }: Omit< BoxControlProps, 'onChange' > & {
43
+ }: DistributiveOmit< BoxControlProps, 'onChange' > & {
37
44
  onChange?: BoxControlProps[ 'onChange' ];
38
45
  } ) => <BoxControl __next40pxDefaultSize onChange={ onChange } { ...props } />;
39
46
 
@@ -100,17 +100,32 @@ export type BoxControlProps = Pick< UnitControlProps, 'units' > &
100
100
  * @default false
101
101
  */
102
102
  __next40pxDefaultSize?: boolean;
103
- /**
104
- * Available presets to pick from.
105
- */
106
- presets?: Preset[];
107
- /**
108
- * The key of the preset to apply.
109
- * If you provide a list of presets, you must provide a preset key to use.
110
- * The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
111
- */
112
- presetKey?: string;
113
- };
103
+ } & (
104
+ | {
105
+ /**
106
+ * Available presets to pick from.
107
+ */
108
+ presets?: never;
109
+ /**
110
+ * The key of the preset to apply.
111
+ * If you provide a list of presets, you must provide a preset key to use.
112
+ * The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
113
+ */
114
+ presetKey?: never;
115
+ }
116
+ | {
117
+ /**
118
+ * Available presets to pick from.
119
+ */
120
+ presets: Preset[];
121
+ /**
122
+ * The key of the preset to apply.
123
+ * If you provide a list of presets, you must provide a preset key to use.
124
+ * The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
125
+ */
126
+ presetKey: string;
127
+ }
128
+ );
114
129
 
115
130
  export type BoxControlInputControlProps = UnitControlPassthroughProps & {
116
131
  onChange?: ( nextValues: BoxControlValue ) => void;