@oaknational/oak-components 2.2.4 → 2.3.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
@@ -3563,12 +3563,28 @@ type OakLinkComponent = <C extends React__default.ElementType = "a">(props: Poly
3563
3563
  */
3564
3564
  declare const OakSecondaryLink: OakLinkComponent;
3565
3565
 
3566
+ type Tab<T> = {
3567
+ label: T;
3568
+ } & ({
3569
+ type: "button";
3570
+ } | {
3571
+ type: "link";
3572
+ href: string;
3573
+ });
3566
3574
  type OakTabsProps<T extends string> = {
3567
3575
  sizeVariant: ResponsiveValues<"default" | "compact">;
3568
3576
  colorVariant: "black" | "white";
3569
- tabs: Array<T>;
3577
+ /**
3578
+ * A list of the tabs to be rendered.
3579
+ * Accepts a `label` and a `type` property for each tab. If the type is `link` then a `href` is required.
3580
+ */
3581
+ tabs: Array<Tab<T>>;
3570
3582
  activeTab: T;
3571
- onTabClick: (tab: T) => void;
3583
+ /**
3584
+ * Optional callback fn for the tab buttons.
3585
+ *
3586
+ */
3587
+ onTabClick?: (tab: T, event: Event) => void;
3572
3588
  };
3573
3589
  declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React__default.JSX.Element;
3574
3590
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oaknational/oak-components",
3
- "version": "2.2.4",
3
+ "version": "2.3.0",
4
4
  "licence": "MIT",
5
5
  "description": "Shared components for Oak applications",
6
6
  "main": "dist/cjs/index.js",