@react-spectrum/s2 3.0.0-nightly-9421c1409-240922 → 3.0.0-nightly-5a0b4fabc-240924

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.
@@ -10,19 +10,18 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue, forwardRefType} from '@react-types/shared';
13
+ import {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';
14
14
  import {Button, ContextValue, DisclosureStateContext, Heading, Provider, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps, useLocale, useSlottedContext} from 'react-aria-components';
15
15
  import {CenterBaseline} from './CenterBaseline';
16
16
  import {centerPadding, focusRing, getAllowedOverrides, StyleProps, UnsafeStyles} from './style-utils' with { type: 'macro' };
17
17
  import Chevron from '../ui-icons/Chevron';
18
18
  import {filterDOMProps} from '@react-aria/utils';
19
- import React, {createContext, forwardRef, ReactElement, useContext} from 'react';
20
- import {size as sizeValue, style} from '../style/spectrum-theme' with { type: 'macro' };
19
+ import {lightDark, size as sizeValue, style} from '../style/spectrum-theme' with { type: 'macro' };
20
+ import React, {createContext, forwardRef, ReactNode, useContext} from 'react';
21
21
  import {useDOMRef} from '@react-spectrum/utils';
22
22
  import {useSpectrumContextProps} from './useSpectrumContextProps';
23
23
 
24
-
25
- export interface DisclosureProps extends RACDisclosureProps, StyleProps, DOMProps {
24
+ export interface DisclosureProps extends RACDisclosureProps, StyleProps {
26
25
  /**
27
26
  * The size of the disclosure.
28
27
  * @default "M"
@@ -36,7 +35,7 @@ export interface DisclosureProps extends RACDisclosureProps, StyleProps, DOMProp
36
35
  /** Whether the disclosure should be displayed with a quiet style. */
37
36
  isQuiet?: boolean,
38
37
  /** The contents of the disclosure, consisting of an DisclosureHeader and DisclosurePanel. */
39
- children: [ReactElement<DisclosureHeaderProps>, ReactElement<DisclosurePanelProps>]
38
+ children: ReactNode
40
39
  }
41
40
 
42
41
  export const DisclosureContext = createContext<ContextValue<Omit<DisclosureProps, 'children'>, DOMRefValue<HTMLDivElement>>>(null);
@@ -66,24 +65,19 @@ function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {
66
65
  let {
67
66
  size = 'M',
68
67
  density = 'regular',
69
- isQuiet, isDisabled
70
- } = props;
71
- let domRef = useDOMRef(ref);
72
- let {
68
+ isQuiet,
73
69
  UNSAFE_style,
74
- UNSAFE_className = '',
75
- ...otherProps
70
+ UNSAFE_className = ''
76
71
  } = props;
77
- const domProps = filterDOMProps(otherProps);
72
+ let domRef = useDOMRef(ref);
78
73
 
79
74
  return (
80
75
  <Provider
81
76
  values={[
82
- [DisclosureContext, {size, isQuiet, density, isDisabled}]
77
+ [DisclosureContext, {size, isQuiet, density}]
83
78
  ]}>
84
79
  <RACDisclosure
85
- {...domProps}
86
- isDisabled={isDisabled}
80
+ {...props}
87
81
  ref={domRef}
88
82
  style={UNSAFE_style}
89
83
  className={(UNSAFE_className ?? '') + disclosure({isQuiet}, props.styles)}>
@@ -96,7 +90,7 @@ function Disclosure(props: DisclosureProps, ref: DOMRef<HTMLDivElement>) {
96
90
  /**
97
91
  * A disclosure is a collapsible section of content. It is composed of a a header with a heading and trigger button, and a panel that contains the content.
98
92
  */
99
- let _Disclosure = /*#__PURE__*/ (forwardRef as forwardRefType)(Disclosure);
93
+ let _Disclosure = forwardRef(Disclosure);
100
94
  export {_Disclosure as Disclosure};
101
95
 
102
96
  export interface DisclosureHeaderProps extends UnsafeStyles, DOMProps {
@@ -105,6 +99,7 @@ export interface DisclosureHeaderProps extends UnsafeStyles, DOMProps {
105
99
  * @default 3
106
100
  */
107
101
  level?: number,
102
+ /** The contents of the disclosure header. */
108
103
  children: React.ReactNode
109
104
  }
110
105
 
@@ -171,18 +166,17 @@ const buttonStyles = style({
171
166
  width: 'full',
172
167
  backgroundColor: {
173
168
  default: 'transparent',
174
- isFocusVisible: 'transparent-black-100',
175
- isHovered: 'transparent-black-100'
169
+ isFocusVisible: lightDark('transparent-black-100', 'transparent-white-100'),
170
+ isHovered: lightDark('transparent-black-100', 'transparent-white-100'),
171
+ isPressed: lightDark('transparent-black-100', 'transparent-white-100')
176
172
  },
173
+ transition: 'default',
177
174
  borderWidth: 0,
178
175
  borderRadius: {
179
- // Only rounded for keyboard focus and quiet hover.
176
+ // Only rounded for keyboard focus and quiet.
180
177
  default: 'none',
181
178
  isFocusVisible: 'control',
182
- isQuiet: {
183
- isHovered: 'control',
184
- isFocusVisible: 'control'
185
- }
179
+ isQuiet: 'control'
186
180
  },
187
181
  textAlign: 'start',
188
182
  disableTapHighlight: true
@@ -193,8 +187,7 @@ const chevronStyles = style({
193
187
  isRTL: 180,
194
188
  isExpanded: 90
195
189
  },
196
- transitionDuration: '100ms',
197
- transitionProperty: 'rotate',
190
+ transition: 'default',
198
191
  '--iconPrimary': {
199
192
  type: 'fill',
200
193
  value: 'currentColor'
@@ -222,7 +215,7 @@ function DisclosureHeader(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivEleme
222
215
  ref={domRef}
223
216
  style={UNSAFE_style}
224
217
  className={(UNSAFE_className ?? '') + headingStyle}>
225
- <Button className={({isHovered, isFocused, isFocusVisible, isDisabled}) => buttonStyles({size, isHovered, isFocused, isFocusVisible, density, isQuiet, isDisabled})} slot="trigger">
218
+ <Button className={(renderProps) => buttonStyles({...renderProps, size, density, isQuiet})} slot="trigger">
226
219
  <CenterBaseline>
227
220
  <Chevron size={size} className={chevronStyles({isExpanded, isRTL})} aria-hidden="true" />
228
221
  </CenterBaseline>
@@ -235,7 +228,7 @@ function DisclosureHeader(props: DisclosureHeaderProps, ref: DOMRef<HTMLDivEleme
235
228
  /**
236
229
  * A header for a disclosure. Contains a heading and a trigger button to expand/collapse the panel.
237
230
  */
238
- let _DisclosureHeader = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosureHeader);
231
+ let _DisclosureHeader = forwardRef(DisclosureHeader);
239
232
  export {_DisclosureHeader as DisclosureHeader};
240
233
 
241
234
  export interface DisclosurePanelProps extends RACDisclosurePanelProps, UnsafeStyles, DOMProps, AriaLabelingProps {
@@ -286,6 +279,6 @@ function DisclosurePanel(props: DisclosurePanelProps, ref: DOMRef<HTMLDivElement
286
279
  /**
287
280
  * A disclosure panel is a collapsible section of content that is hidden until the disclosure is expanded.
288
281
  */
289
- let _DisclosurePanel = /*#__PURE__*/ (forwardRef as forwardRefType)(DisclosurePanel);
282
+ let _DisclosurePanel = forwardRef(DisclosurePanel);
290
283
  export {_DisclosurePanel as DisclosurePanel};
291
284