@oaknational/oak-components 2.19.2 → 2.20.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/dist/types.d.ts CHANGED
@@ -5291,11 +5291,9 @@ type OakULProps = OakBoxProps & OakFlexProps & {
5291
5291
  * */
5292
5292
  declare const OakUL: styled_components.StyledComponent<"ul", styled_components.DefaultTheme, OakULProps, never>;
5293
5293
 
5294
- type UnstyledChevronAccordionProps = {
5294
+ type UnstyledChevronAccordionCommonProps = {
5295
5295
  /** The header of the accordion. */
5296
5296
  header: ReactNode;
5297
- /** Whether the accordion should be open initially. */
5298
- isInitiallyOpen?: boolean;
5299
5297
  /** The content of the accordion. */
5300
5298
  content: ReactNode;
5301
5299
  /** Optional subheader to display above the fold. */
@@ -5307,13 +5305,29 @@ type UnstyledChevronAccordionProps = {
5307
5305
  /** Aria label for the button when the accordion is closed. */
5308
5306
  ariaLabelClose?: string;
5309
5307
  } & FlexStyleProps & OakBoxProps & ColorStyleProps;
5308
+ type UnstyledChevronAccordionUncontrolledProps = {
5309
+ /** Whether the accordion should be open initially. Uncontrolled usage only. */
5310
+ isInitiallyOpen?: boolean;
5311
+ isOpen?: never;
5312
+ onOpenChange?: never;
5313
+ };
5314
+ type UnstyledChevronAccordionControlledProps = {
5315
+ isInitiallyOpen?: never;
5316
+ /** Controlled open state. Must be paired with `onOpenChange`. */
5317
+ isOpen: boolean;
5318
+ /** Called when the user toggles the accordion. Required when `isOpen` is provided. */
5319
+ onOpenChange: (open: boolean) => void;
5320
+ };
5321
+ type UnstyledChevronAccordionProps = UnstyledChevronAccordionCommonProps & (UnstyledChevronAccordionUncontrolledProps | UnstyledChevronAccordionControlledProps);
5310
5322
  /**
5311
5323
  * - UnstyledChevronAccordion has a chevron icon that rotates when the accordion is open.
5312
5324
  * - Unlike InternalChevronAccordion, it has no border effects for hover or focus states.
5313
5325
  * - Only the chevron is interactive so as to allow interactive elements to be placed in the header.
5314
5326
  * - The intention is for these to be added by consuming components as needed.
5327
+ * - Can be used as an uncontrolled component (via `isInitiallyOpen`) or as a
5328
+ * controlled component (via `isOpen` + `onOpenChange`).
5315
5329
  */
5316
- declare const UnstyledChevronAccordion: ({ isInitiallyOpen, ...props }: UnstyledChevronAccordionProps) => React__default.JSX.Element;
5330
+ declare const UnstyledChevronAccordion: (props: UnstyledChevronAccordionProps) => React__default.JSX.Element;
5317
5331
 
5318
5332
  /**
5319
5333
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oaknational/oak-components",
3
- "version": "2.19.2",
3
+ "version": "2.20.0",
4
4
  "licence": "MIT",
5
5
  "description": "Shared components for Oak applications",
6
6
  "main": "dist/cjs/index.js",