@harpercollins/harpercollins-design-system 1.22.4 → 1.23.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.
@@ -1,11 +1,41 @@
1
- export interface TabConfig {
2
- label: string;
3
- id: string;
4
- content: JSX.Element;
1
+ import JoyTab, { tabClasses } from "@mui/joy/Tab";
2
+ import TabList, { tabListClasses } from "@mui/joy/TabList";
3
+ import TabPanel, { tabPanelClasses } from "@mui/joy/TabPanel";
4
+ import type { TabsProps as JoyTabsProps } from "@mui/joy/Tabs";
5
+ import { SyntheticEvent } from "react";
6
+ export { JoyTab as Tab, tabClasses, TabList, tabListClasses, TabPanel, tabPanelClasses, };
7
+ interface TabsProps extends Omit<JoyTabsProps, "value" | "onChange" | "defaultValue"> {
8
+ /**
9
+ * The content of the tabs.
10
+ */
11
+ children: React.ReactNode;
12
+ /**
13
+ * The default value of the tabs.
14
+ */
15
+ defaultValue?: string | number;
16
+ /**
17
+ * The controlled value of the tabs.
18
+ */
19
+ value?: string | number;
20
+ /**
21
+ * Callback fired when the value changes.
22
+ * @param event
23
+ * @param value
24
+ * @returns void
25
+ */
26
+ onChange?: (event: SyntheticEvent | null, value: string | number | null) => void;
27
+ /**
28
+ * Whether to update the URL with the selected tab value.
29
+ */
30
+ updateUrl?: boolean;
31
+ /**
32
+ * The style of the tabs.
33
+ */
34
+ tabStyle?: "default" | "attached";
35
+ /**
36
+ * A key to use for storing the selected tab in localStorage.
37
+ */
38
+ storageKey?: string;
5
39
  }
6
- interface TabsProps {
7
- tabsConfig: TabConfig[];
8
- defaultId?: string;
9
- }
10
- declare function Tabs({ tabsConfig, defaultId }: TabsProps): import("react/jsx-runtime").JSX.Element;
40
+ export declare function Tabs({ children, defaultValue, value: controlledValue, onChange, updateUrl, sx, tabStyle, storageKey, ...restProps }: TabsProps): import("react/jsx-runtime").JSX.Element;
11
41
  export default Tabs;
@@ -1,6 +1,8 @@
1
1
  import { Meta, StoryObj } from "@storybook/react-vite";
2
- import Tabs from "./Tabs";
3
- declare const meta: Meta<typeof Tabs>;
2
+ import HCTabs from "./Tabs";
3
+ declare const meta: Meta<typeof HCTabs>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof Tabs>;
5
+ type Story = StoryObj<typeof HCTabs>;
6
6
  export declare const Default: Story;
7
+ export declare const AttachedTabs: Story;
8
+ export declare const NestedTabs: Story;
@@ -1,2 +1,3 @@
1
- import Tabs from "./Tabs";
2
- export default Tabs;
1
+ import HCTabs, { Tab, TabList, TabPanel, tabClasses, tabListClasses, tabPanelClasses } from "./Tabs";
2
+ export { Tab, TabList, TabPanel, tabClasses, tabListClasses, tabPanelClasses };
3
+ export default HCTabs;
@@ -17,7 +17,7 @@ import ReadMore from "./data-display/ReadMore";
17
17
  import RelativeTime from "./data-display/RelativeTime";
18
18
  import StatusIcon from "./data-display/StatusIcon";
19
19
  import Table from "./data-display/Table";
20
- import Tabs from "./data-display/Tabs";
20
+ import Tabs, { Tab, tabClasses, TabList, tabListClasses, TabPanel, tabPanelClasses } from "./data-display/Tabs";
21
21
  import TextBlock from "./data-display/TextBlock";
22
22
  import Tooltip from "./data-display/Tooltip";
23
23
  import Typography from "./data-display/Typography";
@@ -72,4 +72,4 @@ import CardContent from "./surfaces/Card/CardContent";
72
72
  import CardCover from "./surfaces/Card/CardCover";
73
73
  import CardOverflow from "./surfaces/Card/CardOverflow";
74
74
  import Sheet from "./surfaces/Sheet/Sheet";
75
- export { Accordion, AccordionDetails, AccordionGroup, AccordionLegacy, AccordionSummary, Alert, AppBar, Autocomplete, AutocompleteSelectMultiple, Avatar, Badge, Box, Breadcrumb, Button, Card, CardActions, CardContent, CardCover, CardOverflow, Checkbox, Chip, ChipIcon, CircularProgress, Container, DatePicker, DateTimeInput, Divider, Drawer, Dropdown, FormControl, FormLabel, FullPageErrorFallback, Grid, Heading, Icon, IconButton, Input, Layout, List, ListDivider, ListItem, ListItemButton, ListItemContent, ListItemDecorator, ListSubheader, LoadingSpinner, Logo, LogoMini, Menu, MenuButton, MenuHeading, MenuItem, Option, ProgressBar, ProgressCircle, RadioButton, RadioGroup, ReadMore, RelativeTime, Select, Sheet, Skeleton, Slider, StatusIcon, Switch, Table, Tabs, Textarea, TextBlock, TextField, ThemeProvider, ToastMessages, Tooltip, Typography, };
75
+ export { Accordion, AccordionDetails, AccordionGroup, AccordionLegacy, AccordionSummary, Alert, AppBar, Autocomplete, AutocompleteSelectMultiple, Avatar, Badge, Box, Breadcrumb, Button, Card, CardActions, CardContent, CardCover, CardOverflow, Checkbox, Chip, ChipIcon, CircularProgress, Container, DatePicker, DateTimeInput, Divider, Drawer, Dropdown, FormControl, FormLabel, FullPageErrorFallback, Grid, Heading, Icon, IconButton, Input, Layout, List, ListDivider, ListItem, ListItemButton, ListItemContent, ListItemDecorator, ListSubheader, LoadingSpinner, Logo, LogoMini, Menu, MenuButton, MenuHeading, MenuItem, Option, ProgressBar, ProgressCircle, RadioButton, RadioGroup, ReadMore, RelativeTime, Select, Sheet, Skeleton, Slider, StatusIcon, Switch, Tab, tabClasses, Table, TabList, tabListClasses, TabPanel, tabPanelClasses, Tabs, Textarea, TextBlock, TextField, ThemeProvider, ToastMessages, Tooltip, Typography, };
@@ -1,38 +1,3 @@
1
- import React from "react";
2
- interface LinkButtonInternalProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
3
- kind?: "primary" | "secondary" | "danger" | "basic" | "debug";
4
- size?: "normal" | "small";
5
- }
6
- export declare const LinkButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {
7
- kind?: LinkButtonInternalProps["kind"];
8
- size?: LinkButtonInternalProps["size"];
9
- }>> & string;
10
- export declare const HTMLButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
11
- kind?: LinkButtonInternalProps["kind"];
12
- size?: LinkButtonInternalProps["size"];
13
- $isSubmitting?: boolean;
14
- }>> & string;
15
- interface CommonButtonProps {
16
- kind?: "primary" | "secondary" | "danger" | "basic" | "debug";
17
- size?: "normal" | "small";
18
- disabled?: boolean;
19
- style?: React.CSSProperties;
20
- isSubmitting?: boolean;
21
- }
22
- interface LinkButtonProps extends CommonButtonProps, LinkButtonInternalProps {
23
- type: "link";
24
- href: string;
25
- as?: React.ElementType;
26
- }
27
- interface SubmitButtonProps extends CommonButtonProps {
28
- type: "submit";
29
- name?: string;
30
- value?: string;
31
- hideSpinner?: boolean;
32
- }
33
- interface ButtonProps extends CommonButtonProps {
34
- type: "button";
35
- onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
36
- }
37
- declare function Button({ children, ...props }: React.PropsWithChildren<LinkButtonProps | SubmitButtonProps | ButtonProps>): React.ReactElement;
1
+ import { ButtonProps } from "@mui/joy";
2
+ declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
38
3
  export default Button;
@@ -3,17 +3,4 @@ import Button from "./Button";
3
3
  declare const meta: Meta<typeof Button>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Button>;
6
- export declare const Primary: Story;
7
- export declare const Secondary: Story;
8
- export declare const Danger: Story;
9
- export declare const Basic: Story;
10
- export declare const Debug: Story;
11
- export declare const WithIcon: Story;
12
- export declare const ManualWidth: Story;
13
- export declare const Disabled: Story;
14
- export declare const SecondaryDisabled: Story;
15
- export declare const DangerDisabled: Story;
16
- export declare const DebugDisabled: Story;
17
- export declare const PrimarySubmitting: Story;
18
- export declare const SecondarySubmitting: Story;
19
- export declare const DangerSubmitting: Story;
6
+ export declare const Default: Story;
package/dist/index.d.ts CHANGED
@@ -1,15 +1,19 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _mui_joy from '@mui/joy';
3
- import { AvatarProps, BadgeProps, ChipProps, ColorPaletteProp, DividerProps, ListProps, TooltipProps as TooltipProps$1, TypographyProps, AlertProps, CircularProgressProps, SkeletonProps, AutocompleteProps as AutocompleteProps$1, CheckboxProps, InputProps, FormControlProps, FormLabelProps, RadioProps, SelectProps, SliderProps, SwitchProps, TextareaProps, ContainerProps, GridProps, DropdownProps, MenuProps, ListItem, DrawerProps, AccordionProps as AccordionProps$1, AccordionDetailsProps, AccordionGroupProps, AccordionSummaryProps, CardProps, SheetProps } from '@mui/joy';
3
+ import { AvatarProps, BadgeProps, ChipProps, ColorPaletteProp, DividerProps, ListProps, TooltipProps as TooltipProps$1, TypographyProps, AlertProps, CircularProgressProps, SkeletonProps, AutocompleteProps as AutocompleteProps$1, ButtonProps, CheckboxProps, InputProps, FormControlProps, FormLabelProps, RadioProps, SelectProps, SliderProps, SwitchProps, TextareaProps, ContainerProps, GridProps, DropdownProps, MenuProps, ListItem, DrawerProps, AccordionProps as AccordionProps$1, AccordionDetailsProps, AccordionGroupProps, AccordionSummaryProps, CardProps, SheetProps } from '@mui/joy';
4
4
  export { Box, CardActions, CardContent, CardCover, CardOverflow, IconButton, ListDivider, ListItem, ListItemButton, ListItemContent, ListItemDecorator, ListSubheader, MenuButton, Option, RadioGroup, TextField } from '@mui/joy';
5
5
  import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
6
6
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
7
7
  import * as React$1 from 'react';
8
- import React__default, { ReactElement, PropsWithChildren } from 'react';
8
+ import React__default, { ReactElement, SyntheticEvent, PropsWithChildren } from 'react';
9
9
  import { Row, TableOptions } from '@tanstack/react-table';
10
+ import { TabsProps as TabsProps$1 } from '@mui/joy/Tabs';
10
11
  import ReactDatePicker, { ReactDatePickerProps } from 'react-datepicker';
11
12
  import * as styled_components_dist_types from 'styled-components/dist/types';
12
13
  import * as styled_components from 'styled-components';
14
+ export { default as Tab, tabClasses } from '@mui/joy/Tab';
15
+ export { default as TabList, tabListClasses } from '@mui/joy/TabList';
16
+ export { default as TabPanel, tabPanelClasses } from '@mui/joy/TabPanel';
13
17
 
14
18
  declare function Avatar(props: AvatarProps): react_jsx_runtime.JSX.Element;
15
19
 
@@ -115,16 +119,40 @@ interface TableProps {
115
119
  }
116
120
  declare function Table({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, selectedField, onSelectionChange, onHeaderSelectionChange, headerSelectionValue, allSelected, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, }: TableProps): react_jsx_runtime.JSX.Element;
117
121
 
118
- interface TabConfig {
119
- label: string;
120
- id: string;
121
- content: JSX.Element;
122
- }
123
- interface TabsProps {
124
- tabsConfig: TabConfig[];
125
- defaultId?: string;
126
- }
127
- declare function Tabs({ tabsConfig, defaultId }: TabsProps): react_jsx_runtime.JSX.Element;
122
+ interface TabsProps extends Omit<TabsProps$1, "value" | "onChange" | "defaultValue"> {
123
+ /**
124
+ * The content of the tabs.
125
+ */
126
+ children: React.ReactNode;
127
+ /**
128
+ * The default value of the tabs.
129
+ */
130
+ defaultValue?: string | number;
131
+ /**
132
+ * The controlled value of the tabs.
133
+ */
134
+ value?: string | number;
135
+ /**
136
+ * Callback fired when the value changes.
137
+ * @param event
138
+ * @param value
139
+ * @returns void
140
+ */
141
+ onChange?: (event: SyntheticEvent | null, value: string | number | null) => void;
142
+ /**
143
+ * Whether to update the URL with the selected tab value.
144
+ */
145
+ updateUrl?: boolean;
146
+ /**
147
+ * The style of the tabs.
148
+ */
149
+ tabStyle?: "default" | "attached";
150
+ /**
151
+ * A key to use for storing the selected tab in localStorage.
152
+ */
153
+ storageKey?: string;
154
+ }
155
+ declare function Tabs({ children, defaultValue, value: controlledValue, onChange, updateUrl, sx, tabStyle, storageKey, ...restProps }: TabsProps): react_jsx_runtime.JSX.Element;
128
156
 
129
157
  interface TextBlockProps {
130
158
  label?: string;
@@ -260,33 +288,7 @@ interface AutocompleteSelectMultipleProps<T extends BaseOption> extends Autocomp
260
288
  }
261
289
  declare function AutocompleteSelectMultiple<T extends BaseOption>({ defaultValue, id, name, inline, onChange, SelectedOption, helpText, ...props }: AutocompleteSelectMultipleProps<T>): ReactElement;
262
290
 
263
- interface LinkButtonInternalProps extends React__default.AnchorHTMLAttributes<HTMLAnchorElement> {
264
- kind?: "primary" | "secondary" | "danger" | "basic" | "debug";
265
- size?: "normal" | "small";
266
- }
267
- interface CommonButtonProps {
268
- kind?: "primary" | "secondary" | "danger" | "basic" | "debug";
269
- size?: "normal" | "small";
270
- disabled?: boolean;
271
- style?: React__default.CSSProperties;
272
- isSubmitting?: boolean;
273
- }
274
- interface LinkButtonProps extends CommonButtonProps, LinkButtonInternalProps {
275
- type: "link";
276
- href: string;
277
- as?: React__default.ElementType;
278
- }
279
- interface SubmitButtonProps extends CommonButtonProps {
280
- type: "submit";
281
- name?: string;
282
- value?: string;
283
- hideSpinner?: boolean;
284
- }
285
- interface ButtonProps extends CommonButtonProps {
286
- type: "button";
287
- onClick: (e: React__default.MouseEvent<HTMLButtonElement>) => void;
288
- }
289
- declare function Button({ children, ...props }: React__default.PropsWithChildren<LinkButtonProps | SubmitButtonProps | ButtonProps>): React__default.ReactElement;
291
+ declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
290
292
 
291
293
  declare function Checkbox(props: CheckboxProps): react_jsx_runtime.JSX.Element;
292
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpercollins/harpercollins-design-system",
3
- "version": "1.22.4",
3
+ "version": "1.23.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@ssh.dev.azure.com:v3/HarperCollinsUK/HCDesignSystem/HCDesignSystem"
@@ -46,7 +46,7 @@
46
46
  "@fortawesome/react-fontawesome": "^0.2.2",
47
47
  "@mui/joy": "^5.0.0-beta.48",
48
48
  "@popperjs/core": "^2.11.8",
49
- "@storybook/react-vite": "^9.1.7",
49
+ "@storybook/react-vite": "^10.0.8",
50
50
  "@svgr/rollup": "^8.1.0",
51
51
  "@tanstack/react-table": "^8.15.0",
52
52
  "@tanstack/react-virtual": "^3.13.12",
@@ -66,7 +66,7 @@
66
66
  "vitest": "^3.2.4"
67
67
  },
68
68
  "devDependencies": {
69
- "@chromatic-com/storybook": "^4.1.1",
69
+ "@chromatic-com/storybook": "^4.1.3",
70
70
  "@playwright/test": "^1.55.0",
71
71
  "@rollup/plugin-babel": "^6.0.3",
72
72
  "@rollup/plugin-commonjs": "^24.1.0",
@@ -74,13 +74,13 @@
74
74
  "@rollup/plugin-terser": "^0.4.3",
75
75
  "@rollup/plugin-typescript": "^11.1.6",
76
76
  "@rollup/plugin-url": "^8.0.2",
77
- "@storybook/addon-a11y": "^9.1.7",
78
- "@storybook/addon-coverage": "^2.0.0",
79
- "@storybook/addon-docs": "^9.1.7",
80
- "@storybook/addon-links": "^9.1.7",
81
- "@storybook/addon-onboarding": "^9.1.7",
82
- "@storybook/addon-themes": "^9.1.7",
83
- "@storybook/addon-vitest": "^9.1.7",
77
+ "@storybook/addon-a11y": "^10.0.8",
78
+ "@storybook/addon-coverage": "^3.0.0",
79
+ "@storybook/addon-docs": "^10.0.8",
80
+ "@storybook/addon-links": "^10.0.8",
81
+ "@storybook/addon-onboarding": "^10.0.8",
82
+ "@storybook/addon-themes": "^10.0.8",
83
+ "@storybook/addon-vitest": "^10.0.8",
84
84
  "@types/jest": "^29.5.12",
85
85
  "@types/node": "^20.12.3",
86
86
  "@types/react": "^18.3.9",
@@ -101,12 +101,12 @@
101
101
  "eslint-plugin-react": "^7.34.1",
102
102
  "eslint-plugin-react-hooks": "^4.6.0",
103
103
  "eslint-plugin-react-refresh": "^0.4.6",
104
- "eslint-plugin-storybook": "^9.1.7",
104
+ "eslint-plugin-storybook": "^10.0.8",
105
105
  "happy-dom": "^14.3.8",
106
106
  "playwright": "^1.55.0",
107
107
  "prettier": "^3.2.5",
108
108
  "react-syntax-highlighter": "^15.5.0",
109
- "storybook": "^9.1.7",
109
+ "storybook": "^10.0.8",
110
110
  "tslib": "^2.6.2",
111
111
  "typescript": "^5.4.3",
112
112
  "vite": "^7.1.7"
@@ -1,9 +0,0 @@
1
- export declare const Tab: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const TabMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const TabMenuItems: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export declare const TabMenuItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
5
- export declare const TabNav: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
6
- export declare const TabPanelWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
- export declare const TabPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
8
- $show: boolean;
9
- }>> & string;
@@ -1,9 +0,0 @@
1
- export declare const Tab: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const TabMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const TabMenuItems: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export declare const TabMenuItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
5
- export declare const TabNav: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
6
- export declare const TabPanelWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
- export declare const TabPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
8
- $show: boolean;
9
- }>> & string;