@wordpress/components 23.4.0 → 23.5.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 (105) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/autocomplete/autocompleter-ui.js +41 -17
  3. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  4. package/build/autocomplete/index.js +31 -33
  5. package/build/autocomplete/index.js.map +1 -1
  6. package/build/circular-option-picker/index.js +63 -14
  7. package/build/circular-option-picker/index.js.map +1 -1
  8. package/build/circular-option-picker/types.js +6 -0
  9. package/build/circular-option-picker/types.js.map +1 -0
  10. package/build/dropdown-menu/index.js +6 -2
  11. package/build/dropdown-menu/index.js.map +1 -1
  12. package/build/higher-order/with-constrained-tabbing/index.js +9 -0
  13. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  14. package/build/mobile/global-styles-context/utils.native.js +2 -1
  15. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  16. package/build/range-control/index.js +1 -0
  17. package/build/range-control/index.js.map +1 -1
  18. package/build/tools-panel/context.js +2 -0
  19. package/build/tools-panel/context.js.map +1 -1
  20. package/build/tools-panel/tools-panel/hook.js +18 -12
  21. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  22. package/build/tools-panel/tools-panel-item/hook.js +14 -2
  23. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  24. package/build/ui/context/context-system-provider.js +8 -4
  25. package/build/ui/context/context-system-provider.js.map +1 -1
  26. package/build-module/autocomplete/autocompleter-ui.js +40 -19
  27. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  28. package/build-module/autocomplete/index.js +30 -32
  29. package/build-module/autocomplete/index.js.map +1 -1
  30. package/build-module/circular-option-picker/index.js +59 -16
  31. package/build-module/circular-option-picker/index.js.map +1 -1
  32. package/build-module/circular-option-picker/types.js +2 -0
  33. package/build-module/circular-option-picker/types.js.map +1 -0
  34. package/build-module/dropdown-menu/index.js +6 -2
  35. package/build-module/dropdown-menu/index.js.map +1 -1
  36. package/build-module/higher-order/with-constrained-tabbing/index.js +9 -0
  37. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  38. package/build-module/mobile/global-styles-context/utils.native.js +2 -1
  39. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  40. package/build-module/range-control/index.js +1 -0
  41. package/build-module/range-control/index.js.map +1 -1
  42. package/build-module/tools-panel/context.js +2 -0
  43. package/build-module/tools-panel/context.js.map +1 -1
  44. package/build-module/tools-panel/tools-panel/hook.js +18 -12
  45. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  46. package/build-module/tools-panel/tools-panel-item/hook.js +14 -2
  47. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  48. package/build-module/ui/context/context-system-provider.js +7 -4
  49. package/build-module/ui/context/context-system-provider.js.map +1 -1
  50. package/build-style/style-rtl.css +1 -0
  51. package/build-style/style.css +1 -0
  52. package/build-types/circular-option-picker/index.d.ts +56 -7
  53. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  54. package/build-types/circular-option-picker/stories/index.d.ts +14 -0
  55. package/build-types/circular-option-picker/stories/index.d.ts.map +1 -0
  56. package/build-types/circular-option-picker/types.d.ts +49 -0
  57. package/build-types/circular-option-picker/types.d.ts.map +1 -0
  58. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  59. package/build-types/h-stack/stories/e2e/index.d.ts +9 -0
  60. package/build-types/h-stack/stories/e2e/index.d.ts.map +1 -0
  61. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +10 -1
  62. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  63. package/build-types/range-control/index.d.ts.map +1 -1
  64. package/build-types/tab-panel/stories/index.d.ts +1 -0
  65. package/build-types/tab-panel/stories/index.d.ts.map +1 -1
  66. package/build-types/tools-panel/context.d.ts.map +1 -1
  67. package/build-types/tools-panel/test/index.d.ts +2 -0
  68. package/build-types/tools-panel/test/index.d.ts.map +1 -0
  69. package/build-types/tools-panel/tools-panel/hook.d.ts +3 -1
  70. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  71. package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -1
  72. package/build-types/tools-panel/tools-panel-item/component.d.ts +1 -0
  73. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  74. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  75. package/build-types/tools-panel/types.d.ts +11 -9
  76. package/build-types/tools-panel/types.d.ts.map +1 -1
  77. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  78. package/build-types/v-stack/stories/e2e/index.d.ts +9 -0
  79. package/build-types/v-stack/stories/e2e/index.d.ts.map +1 -0
  80. package/package.json +23 -21
  81. package/src/autocomplete/autocompleter-ui.js +72 -34
  82. package/src/autocomplete/index.js +36 -36
  83. package/src/circular-option-picker/README.md +141 -0
  84. package/src/circular-option-picker/{index.js → index.tsx} +74 -14
  85. package/src/circular-option-picker/stories/index.tsx +134 -0
  86. package/src/circular-option-picker/types.ts +69 -0
  87. package/src/color-palette/test/__snapshots__/index.tsx.snap +1 -1
  88. package/src/dropdown-menu/index.js +6 -3
  89. package/src/h-stack/stories/e2e/index.tsx +36 -0
  90. package/src/higher-order/navigate-regions/style.scss +2 -1
  91. package/src/higher-order/with-constrained-tabbing/index.tsx +30 -0
  92. package/src/mobile/global-styles-context/utils.native.js +1 -0
  93. package/src/range-control/index.tsx +5 -1
  94. package/src/tab-panel/stories/index.tsx +41 -0
  95. package/src/tab-panel/test/index.tsx +794 -262
  96. package/src/tools-panel/context.ts +2 -0
  97. package/src/tools-panel/test/{index.js → index.tsx} +171 -61
  98. package/src/tools-panel/tools-panel/hook.ts +30 -11
  99. package/src/tools-panel/tools-panel-item/hook.ts +18 -2
  100. package/src/tools-panel/types.ts +12 -9
  101. package/src/tree-grid/test/__snapshots__/index.tsx.snap +1 -1
  102. package/src/ui/context/context-system-provider.js +7 -4
  103. package/src/v-stack/stories/e2e/index.tsx +36 -0
  104. package/tsconfig.tsbuildinfo +1 -1
  105. package/src/higher-order/with-constrained-tabbing/index.js +0 -22
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
+ import deepmerge from 'deepmerge';
4
5
  import fastDeepEqual from 'fast-deep-equal/es6';
5
- import { merge } from 'lodash';
6
+ import { isPlainObject } from 'is-plain-object';
6
7
 
7
8
  /**
8
9
  * WordPress dependencies
@@ -54,7 +55,7 @@ function useContextSystemBridge( { value } ) {
54
55
  // `parentContext` will always be memoized (i.e., the result of this hook itself)
55
56
  // or the default value from when the `ComponentsContext` was originally
56
57
  // initialized (which will never change, it's a static variable)
57
- // so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless
58
+ // so this memoization will prevent `deepmerge()` from rerunning unless
58
59
  // the references to `value` change OR the `parentContext` has an actual material change
59
60
  // (because again, it's guaranteed to be memoized or a static reference to the empty object
60
61
  // so we know that the only changes for `parentContext` are material ones... i.e., why we
@@ -62,10 +63,12 @@ function useContextSystemBridge( { value } ) {
62
63
  // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
63
64
  // correctly warning when the `value` isn't being properly memoized. All of that to say
64
65
  // that this should be super safe to assume that `useMemo` will only run on actual
65
- // changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!
66
+ // changes to the two dependencies, therefore saving us calls to `deepmerge()`!
66
67
  const config = useMemo( () => {
67
68
  // Deep clone `parentContext` to avoid mutating it later.
68
- return merge( JSON.parse( JSON.stringify( parentContext ) ), value );
69
+ return deepmerge( parentContext ?? {}, value ?? {}, {
70
+ isMergeableObject: isPlainObject,
71
+ } );
69
72
  }, [ parentContext, value ] );
70
73
 
71
74
  return config;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentStory, ComponentMeta } from '@storybook/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { View } from '../../../view';
10
+ import { VStack } from '../..';
11
+
12
+ const meta: ComponentMeta< typeof VStack > = {
13
+ component: VStack,
14
+ title: 'Components (Experimental)/VStack',
15
+ };
16
+ export default meta;
17
+
18
+ const Template: ComponentStory< typeof VStack > = ( props ) => {
19
+ return (
20
+ <VStack
21
+ { ...props }
22
+ style={ { background: '#eee', minHeight: '3rem' } }
23
+ >
24
+ { [ 'One', 'Two', 'Three', 'Four', 'Five' ].map( ( text ) => (
25
+ <View key={ text } style={ { background: '#b9f9ff' } }>
26
+ { text }
27
+ </View>
28
+ ) ) }
29
+ </VStack>
30
+ );
31
+ };
32
+
33
+ export const Default: ComponentStory< typeof VStack > = Template.bind( {} );
34
+ Default.args = {
35
+ spacing: 3,
36
+ };