Skip to content

Commit c74c5dd

Browse files
authored
chore: Ai components followup (#10162)
* export CenterBaseline * delete copied CenterBaseline * delete files * export centerbaseline * update exports * update components * cleanup types * fix format
1 parent 2157581 commit c74c5dd

17 files changed

Lines changed: 583 additions & 1074 deletions

packages/@react-spectrum/s2-ai/exports/MessageSource.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
export {
2-
MessageSource,
3-
MessageSourceContext,
4-
SourceList,
5-
SourceListItem,
6-
NumberBadge,
7-
NumberBadgeContext
8-
} from '../src/MessageSource';
1+
export {MessageSource, SourceList, SourceListItem, NumberBadge} from '../src/MessageSource';
92

103
export type {
114
MessageSourceProps,
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
export {
2-
MessageSuggestion,
3-
MessageSuggestionContext,
4-
MessageSuggestionList,
5-
MessageSuggestionListContext
6-
} from '../src/MessageSuggestion';
1+
export {MessageSuggestion, MessageSuggestionList} from '../src/MessageSuggestion';

packages/@react-spectrum/s2-ai/exports/ResponseStatus.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
export {
2-
ResponseStatus,
3-
ResponseStatusContext,
4-
ResponseStatusTitle,
5-
ResponseStatusPanel
6-
} from '../src/ResponseStatus';
1+
export {ResponseStatus, ResponseStatusTitle, ResponseStatusPanel} from '../src/ResponseStatus';
72

83
export type {
94
ResponseStatusProps,
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
export {Attachment, AttachmentList} from '../src/AttachmentList';
22
export {BasicHorizontalCard, HorizontalCard} from '../src/HorizontalCard';
33
export {MessageFeedback} from '../src/MessageFeedback';
4-
export {
5-
MessageSuggestion,
6-
MessageSuggestionContext,
7-
MessageSuggestionList,
8-
MessageSuggestionListContext
9-
} from '../src/MessageSuggestion';
4+
export {MessageSuggestion, MessageSuggestionList} from '../src/MessageSuggestion';
105
export {ResponseStatus, ResponseStatusPanel} from '../src/ResponseStatus';
116
export {UserMessage} from '../src/UserMessage';

packages/@react-spectrum/s2-ai/src/AttachmentList.tsx

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@ import {BasicHorizontalCard} from './HorizontalCard';
1616
import {Button} from 'react-aria-components/Button';
1717
import {CardProps} from '@react-spectrum/s2/Card';
1818
import Close from '@react-spectrum/s2/icons/Close';
19-
import {controlSize, getAllowedOverrides} from './style-utils-copy' with {type: 'macro'};
2019
import {forwardRef, useRef} from 'react';
2120
import {iconStyle} from '@react-spectrum/s2/style' with {type: 'macro'};
21+
import {mergeStyles} from '@react-spectrum/s2/mergeStyles';
2222
import {pressScale} from '@react-spectrum/s2/pressScale';
2323
import {Tag, TagGroup, TagList} from 'react-aria-components/TagGroup';
2424
import {useDOMRef} from './useDOMRef';
2525

26+
const controlSizeM = {
27+
default: 32,
28+
size: {
29+
XS: 20,
30+
S: 24,
31+
L: 40,
32+
XL: 48
33+
}
34+
} as const;
35+
2636
const hoverBackground = {
2737
default: 'gray-200',
2838
isStaticColor: 'transparent-overlay-200'
@@ -34,43 +44,40 @@ const styles = style<{
3444
isFocusVisible: boolean;
3545
isPressed: boolean;
3646
size: 'S' | 'M' | 'L' | 'XL';
37-
}>(
38-
{
39-
...focusRing(),
40-
display: 'flex',
41-
alignItems: 'center',
42-
justifyContent: 'center',
43-
size: controlSize(),
44-
flexShrink: 0,
45-
borderRadius: 'full',
46-
padding: 0,
47-
borderStyle: 'none',
48-
transition: 'default',
49-
backgroundColor: {
50-
default: 'gray-200',
51-
isHovered: hoverBackground,
52-
isFocusVisible: hoverBackground,
53-
isPressed: hoverBackground
54-
},
55-
'--iconPrimary': {
56-
type: 'color',
57-
value: {
58-
default: baseColor('neutral'),
59-
isDisabled: 'disabled',
60-
forcedColors: {
61-
default: 'ButtonText',
62-
isDisabled: 'GrayText'
63-
}
47+
}>({
48+
...focusRing(),
49+
display: 'flex',
50+
alignItems: 'center',
51+
justifyContent: 'center',
52+
size: controlSizeM,
53+
flexShrink: 0,
54+
borderRadius: 'full',
55+
padding: 0,
56+
borderStyle: 'none',
57+
transition: 'default',
58+
backgroundColor: {
59+
default: 'gray-200',
60+
isHovered: hoverBackground,
61+
isFocusVisible: hoverBackground,
62+
isPressed: hoverBackground
63+
},
64+
'--iconPrimary': {
65+
type: 'color',
66+
value: {
67+
default: baseColor('neutral'),
68+
isDisabled: 'disabled',
69+
forcedColors: {
70+
default: 'ButtonText',
71+
isDisabled: 'GrayText'
6472
}
65-
},
66-
outlineColor: {
67-
default: 'focus-ring',
68-
forcedColors: 'Highlight'
69-
},
70-
disableTapHighlight: true
73+
}
7174
},
72-
getAllowedOverrides()
73-
);
75+
outlineColor: {
76+
default: 'focus-ring',
77+
forcedColors: 'Highlight'
78+
},
79+
disableTapHighlight: true
80+
});
7481

7582
const closeIconStyle = ({size = 'M'}) => {
7683
if (size === 'S') return iconStyle({size: 'XS'});
@@ -88,21 +95,21 @@ const CloseButton = function CloseButton(props) {
8895
ref={ref}
8996
slot="remove"
9097
style={pressScale(ref, {})}
91-
className={renderProps => styles({...renderProps, size: props.size || 'M'}, props.styles)}>
98+
className={renderProps =>
99+
mergeStyles(styles({...renderProps, size: props.size || 'M'}), props.styles)
100+
}>
92101
<Close styles={closeIconStyle({size: props.size ?? 'M'})} />
93102
</Button>
94103
);
95104
};
96105

97-
let attachmentListStyles = style({}, getAllowedOverrides());
98-
99106
export const AttachmentList = forwardRef(function AttachmentList(
100107
props: any,
101108
ref: DOMRef<HTMLDivElement>
102109
) {
103110
let domRef = useDOMRef(ref);
104111
return (
105-
<TagGroup {...props} className={attachmentListStyles(props.styles)} ref={domRef}>
112+
<TagGroup {...props} className={props.styles} ref={domRef}>
106113
<TagList
107114
className={style({
108115
display: 'flex',

packages/@react-spectrum/s2-ai/src/CenterBaseline.tsx

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)