@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.
- package/CHANGELOG.md +15 -0
- package/build/autocomplete/autocompleter-ui.js +41 -17
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js +31 -33
- package/build/autocomplete/index.js.map +1 -1
- package/build/circular-option-picker/index.js +63 -14
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/circular-option-picker/types.js +6 -0
- package/build/circular-option-picker/types.js.map +1 -0
- package/build/dropdown-menu/index.js +6 -2
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/higher-order/with-constrained-tabbing/index.js +9 -0
- package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +2 -1
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/range-control/index.js +1 -0
- package/build/range-control/index.js.map +1 -1
- package/build/tools-panel/context.js +2 -0
- package/build/tools-panel/context.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +18 -12
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +14 -2
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/ui/context/context-system-provider.js +8 -4
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +40 -19
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js +30 -32
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/circular-option-picker/index.js +59 -16
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/circular-option-picker/types.js +2 -0
- package/build-module/circular-option-picker/types.js.map +1 -0
- package/build-module/dropdown-menu/index.js +6 -2
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/higher-order/with-constrained-tabbing/index.js +9 -0
- package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +2 -1
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/range-control/index.js +1 -0
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/tools-panel/context.js +2 -0
- package/build-module/tools-panel/context.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +18 -12
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +14 -2
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +7 -4
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/build-types/circular-option-picker/index.d.ts +56 -7
- package/build-types/circular-option-picker/index.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.d.ts +14 -0
- package/build-types/circular-option-picker/stories/index.d.ts.map +1 -0
- package/build-types/circular-option-picker/types.d.ts +49 -0
- package/build-types/circular-option-picker/types.d.ts.map +1 -0
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/h-stack/stories/e2e/index.d.ts +9 -0
- package/build-types/h-stack/stories/e2e/index.d.ts.map +1 -0
- package/build-types/higher-order/with-constrained-tabbing/index.d.ts +10 -1
- package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.d.ts +1 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -1
- package/build-types/tools-panel/context.d.ts.map +1 -1
- package/build-types/tools-panel/test/index.d.ts +2 -0
- package/build-types/tools-panel/test/index.d.ts.map +1 -0
- package/build-types/tools-panel/tools-panel/hook.d.ts +3 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -1
- package/build-types/tools-panel/tools-panel-item/component.d.ts +1 -0
- package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +11 -9
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
- package/build-types/v-stack/stories/e2e/index.d.ts +9 -0
- package/build-types/v-stack/stories/e2e/index.d.ts.map +1 -0
- package/package.json +23 -21
- package/src/autocomplete/autocompleter-ui.js +72 -34
- package/src/autocomplete/index.js +36 -36
- package/src/circular-option-picker/README.md +141 -0
- package/src/circular-option-picker/{index.js → index.tsx} +74 -14
- package/src/circular-option-picker/stories/index.tsx +134 -0
- package/src/circular-option-picker/types.ts +69 -0
- package/src/color-palette/test/__snapshots__/index.tsx.snap +1 -1
- package/src/dropdown-menu/index.js +6 -3
- package/src/h-stack/stories/e2e/index.tsx +36 -0
- package/src/higher-order/navigate-regions/style.scss +2 -1
- package/src/higher-order/with-constrained-tabbing/index.tsx +30 -0
- package/src/mobile/global-styles-context/utils.native.js +1 -0
- package/src/range-control/index.tsx +5 -1
- package/src/tab-panel/stories/index.tsx +41 -0
- package/src/tab-panel/test/index.tsx +794 -262
- package/src/tools-panel/context.ts +2 -0
- package/src/tools-panel/test/{index.js → index.tsx} +171 -61
- package/src/tools-panel/tools-panel/hook.ts +30 -11
- package/src/tools-panel/tools-panel-item/hook.ts +18 -2
- package/src/tools-panel/types.ts +12 -9
- package/src/tree-grid/test/__snapshots__/index.tsx.snap +1 -1
- package/src/ui/context/context-system-provider.js +7 -4
- package/src/v-stack/stories/e2e/index.tsx +36 -0
- package/tsconfig.tsbuildinfo +1 -1
- 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 {
|
|
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 `
|
|
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 `
|
|
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
|
|
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
|
+
};
|