diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f3e36ffd..ce2015bb38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix teams theme `Status` and `Chat.Message` styles ([#747](https://github.com/stardust-ui/react/pull/747)) - Fix `Popup` - do not stop event propagation when pressing Esc on trigger element @sophieH29 ([#750](https://github.com/stardust-ui/react/pull/750)) - Fix alignment of `Layout`'s `main` area @kuzhelov ([#752](https://github.com/stardust-ui/react/pull/752)) +- Forwarding props for `createShorthand` calls if the value is a React element @mnajdova ([#759](https://github.com/stardust-ui/react/pull/759)) ### Features - Rename `Slot` component to `Box` and export it @Bugaa92 ([#713](https://github.com/stardust-ui/react/pull/713)) diff --git a/docs/src/examples/components/Chat/Types/ChatExample.shorthand.tsx b/docs/src/examples/components/Chat/Types/ChatExample.shorthand.tsx index 158c9f42fd..f8b70b4768 100644 --- a/docs/src/examples/components/Chat/Types/ChatExample.shorthand.tsx +++ b/docs/src/examples/components/Chat/Types/ChatExample.shorthand.tsx @@ -53,7 +53,7 @@ const items = [ key: 'message-id-5', }, { - message: , + children: , key: 'message-id-6', }, { diff --git a/docs/src/prototypes/chatPane/index.tsx b/docs/src/prototypes/chatPane/index.tsx index 886c0867b5..f53253754c 100644 --- a/docs/src/prototypes/chatPane/index.tsx +++ b/docs/src/prototypes/chatPane/index.tsx @@ -1,10 +1,12 @@ import * as React from 'react' -import { Provider } from '@stardust-ui/react' +import { Provider, Divider } from '@stardust-ui/react' import ChatPaneLayout from './chatPaneLayout' import { getChatMock } from './services' +import { pxToRem } from '../../../../src/lib' const chatMock = getChatMock({ msgCount: 40, userCount: 6 }) +const dividerSelector = `& .${Divider.className}` export default () => ( ( start: { display: 'block' }, end: { display: 'block' }, }, + ChatItem: { + root: { + [dividerSelector]: { + marginLeft: `-${pxToRem(40)}`, + marginRight: `-${pxToRem(40)}`, + }, + }, + }, }, }} > diff --git a/docs/src/views/ShorthandProps.tsx b/docs/src/views/ShorthandProps.tsx index 469bb5a2dd..c3b8dba4e1 100644 --- a/docs/src/views/ShorthandProps.tsx +++ b/docs/src/views/ShorthandProps.tsx @@ -86,14 +86,13 @@ const ShorthandProps = props => (
There is a very important caveat here, though: whenever React Element is directly used as a - shorthand value, it becomes client's responsibility to handle some aspects that Stardust was - originally responsible for (such as {code('styles')} or {code('accessibility')}). + shorthand value, all props that Stardust has created for the slot's Component will be spread + on the passed element. This means that provided element should be able to handle Stardust + props - while this requirement is satisfied for all Stardust components, you should be aware + of that when either HTML or any third-party elements are provided. {' '} - This is because, in contrast to other forms of shorthand values, Stardust-evaluated props - cannot be safely passed to the element which type is, generally, doesn't allow Stardust to - make any prior assumptions about. Due to this limitation, you should strive to use other - options for shorthand values whenever is possible - for instance, this is how previous example - can be rewritten: + Due to this limitation, you should strive to use other options for shorthand values whenever + is possible - for instance, this is how previous example can be rewritten:
{codeExample([`