@harpercollins/harpercollins-design-system 1.22.4 → 1.24.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.
Files changed (60) hide show
  1. package/dist/cjs/index.cjs +250 -399
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/types/src/components/data-display/Table/FilterChipsSection.d.ts +10 -0
  4. package/dist/cjs/types/src/components/data-display/Table/Table.d.ts +8 -18
  5. package/dist/cjs/types/src/components/data-display/Table/Table.filtering.stories.d.ts +8 -0
  6. package/dist/cjs/types/src/components/data-display/Table/Table.sorting.stories.d.ts +32 -0
  7. package/dist/cjs/types/src/components/data-display/Table/Table.stories.d.ts +8 -0
  8. package/dist/cjs/types/src/components/data-display/Table/Table.styles.d.ts +117 -0
  9. package/dist/cjs/types/src/components/data-display/Table/Table.types.d.ts +34 -0
  10. package/dist/cjs/types/src/components/data-display/Table/TableBody.d.ts +13 -0
  11. package/dist/cjs/types/src/components/data-display/Table/TableToolbar.d.ts +17 -0
  12. package/dist/cjs/types/src/components/data-display/Table/filters/FilterComponents.d.ts +61 -0
  13. package/dist/cjs/types/src/components/data-display/Table/filters/filterFunctions.d.ts +28 -0
  14. package/dist/cjs/types/src/components/data-display/Table/filters/index.d.ts +2 -0
  15. package/dist/cjs/types/src/components/data-display/Table/hooks/index.d.ts +3 -0
  16. package/dist/cjs/types/src/components/data-display/Table/hooks/useInfiniteScroll.d.ts +7 -0
  17. package/dist/cjs/types/src/components/data-display/Table/hooks/useStickyHeader.d.ts +14 -0
  18. package/dist/cjs/types/src/components/data-display/Table/hooks/useStickyScrollbar.d.ts +6 -0
  19. package/dist/cjs/types/src/components/data-display/Table/mockProducts.d.ts +24 -0
  20. package/dist/cjs/types/src/components/data-display/Tabs/Tabs.d.ts +39 -9
  21. package/dist/cjs/types/src/components/data-display/Tabs/Tabs.stories.d.ts +5 -3
  22. package/dist/cjs/types/src/components/data-display/Tabs/index.d.ts +3 -2
  23. package/dist/cjs/types/src/components/index.d.ts +3 -2
  24. package/dist/cjs/types/src/components/inputs/Autocomplete/AutocompleteOption.d.ts +3 -0
  25. package/dist/cjs/types/src/components/inputs/Button/Button.d.ts +2 -37
  26. package/dist/cjs/types/src/components/inputs/Button/Button.stories.d.ts +1 -14
  27. package/dist/cjs/types/src/components/inputs/Button/index.d.ts +1 -0
  28. package/dist/cjs/types/src/tests/mockProducts.d.ts +24 -0
  29. package/dist/esm/index.js +251 -400
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/types/src/components/data-display/Table/FilterChipsSection.d.ts +10 -0
  32. package/dist/esm/types/src/components/data-display/Table/Table.d.ts +8 -18
  33. package/dist/esm/types/src/components/data-display/Table/Table.filtering.stories.d.ts +8 -0
  34. package/dist/esm/types/src/components/data-display/Table/Table.sorting.stories.d.ts +32 -0
  35. package/dist/esm/types/src/components/data-display/Table/Table.stories.d.ts +8 -0
  36. package/dist/esm/types/src/components/data-display/Table/Table.styles.d.ts +117 -0
  37. package/dist/esm/types/src/components/data-display/Table/Table.types.d.ts +34 -0
  38. package/dist/esm/types/src/components/data-display/Table/TableBody.d.ts +13 -0
  39. package/dist/esm/types/src/components/data-display/Table/TableToolbar.d.ts +17 -0
  40. package/dist/esm/types/src/components/data-display/Table/filters/FilterComponents.d.ts +61 -0
  41. package/dist/esm/types/src/components/data-display/Table/filters/filterFunctions.d.ts +28 -0
  42. package/dist/esm/types/src/components/data-display/Table/filters/index.d.ts +2 -0
  43. package/dist/esm/types/src/components/data-display/Table/hooks/index.d.ts +3 -0
  44. package/dist/esm/types/src/components/data-display/Table/hooks/useInfiniteScroll.d.ts +7 -0
  45. package/dist/esm/types/src/components/data-display/Table/hooks/useStickyHeader.d.ts +14 -0
  46. package/dist/esm/types/src/components/data-display/Table/hooks/useStickyScrollbar.d.ts +6 -0
  47. package/dist/esm/types/src/components/data-display/Table/mockProducts.d.ts +24 -0
  48. package/dist/esm/types/src/components/data-display/Tabs/Tabs.d.ts +39 -9
  49. package/dist/esm/types/src/components/data-display/Tabs/Tabs.stories.d.ts +5 -3
  50. package/dist/esm/types/src/components/data-display/Tabs/index.d.ts +3 -2
  51. package/dist/esm/types/src/components/index.d.ts +3 -2
  52. package/dist/esm/types/src/components/inputs/Autocomplete/AutocompleteOption.d.ts +3 -0
  53. package/dist/esm/types/src/components/inputs/Button/Button.d.ts +2 -37
  54. package/dist/esm/types/src/components/inputs/Button/Button.stories.d.ts +1 -14
  55. package/dist/esm/types/src/components/inputs/Button/index.d.ts +1 -0
  56. package/dist/esm/types/src/tests/mockProducts.d.ts +24 -0
  57. package/dist/index.d.ts +74 -44
  58. package/package.json +13 -13
  59. package/dist/cjs/types/src/components/data-display/Tabs/Tabs.style.d.ts +0 -9
  60. package/dist/esm/types/src/components/data-display/Tabs/Tabs.style.d.ts +0 -9
@@ -0,0 +1,10 @@
1
+ import { ColumnFiltersState, Table } from "@tanstack/react-table";
2
+ import React from "react";
3
+ interface FilterChipsSectionProps<TData = unknown> {
4
+ columnFilters: ColumnFiltersState;
5
+ table: Table<TData>;
6
+ }
7
+ declare const FilterChipsSection: <TData>(props: FilterChipsSectionProps<TData> & {
8
+ ref?: React.ForwardedRef<HTMLDivElement>;
9
+ }) => React.ReactElement;
10
+ export default FilterChipsSection;
@@ -1,20 +1,10 @@
1
- import { Row, TableOptions } from "@tanstack/react-table";
2
- interface TableProps {
3
- id: string;
4
- loading?: boolean;
5
- maxHeight?: boolean;
6
- wrapText?: boolean;
7
- rowRender?: (row: Row<any>, props: any) => JSX.Element;
8
- reactTableOptions: Partial<TableOptions<unknown>> & Pick<TableOptions<unknown>, "data" | "columns">;
9
- gridCheckboxes?: boolean;
10
- selectedField?: string;
11
- onSelectionChange?: (dataItem: any) => void;
12
- onHeaderSelectionChange?: (checked: boolean) => void;
13
- headerSelectionValue?: boolean;
14
- allSelected?: boolean;
15
- showStickyScrollbar?: boolean;
16
- enableStickyHeader?: boolean;
17
- stickyHeaderOffset?: number;
1
+ import { TableProps } from "./Table.types";
2
+ declare module "@tanstack/react-table" {
3
+ interface ColumnMeta<TData, TValue> {
4
+ filterType?: "text" | "number" | "date" | "select" | "multiselect";
5
+ filterOptions?: string[];
6
+ pinned?: "left" | "right";
7
+ }
18
8
  }
19
- declare function Table({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, selectedField, onSelectionChange, onHeaderSelectionChange, headerSelectionValue, allSelected, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, }: TableProps): import("react/jsx-runtime").JSX.Element;
9
+ declare function Table<TData = unknown>({ id, loading, maxHeight, wrapText, rowRender, reactTableOptions, gridCheckboxes, selectedField, onSelectionChange, onHeaderSelectionChange, headerSelectionValue, allSelected, showStickyScrollbar, enableStickyHeader, stickyHeaderOffset, infiniteScroll, toolbar, }: TableProps<TData>): import("react/jsx-runtime").JSX.Element;
20
10
  export default Table;
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
+ import Table from "./Table";
3
+ declare const meta: Meta<typeof Table>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Table>;
6
+ export declare const ClientSideFiltering: Story;
7
+ export declare const ServerSideFiltering: Story;
8
+ export declare const WithGlobalFilters: StoryObj<typeof Table>;
@@ -0,0 +1,32 @@
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
+ import Table from "./Table";
3
+ declare const meta: Meta<typeof Table>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Table>;
6
+ /**
7
+ * Client-Side Sorting
8
+ *
9
+ * This example demonstrates client-side sorting where all data is loaded
10
+ * and sorting happens in the browser using TanStack Table's getSortedRowModel.
11
+ *
12
+ * Features:
13
+ * - Click column headers to sort
14
+ * - First click: ascending
15
+ * - Second click: descending
16
+ * - Third click: clear sort
17
+ * - Sort indicators show current sort state
18
+ * - Multiple columns can be sorted (shift+click)
19
+ */
20
+ export declare const ClientSideSorting: Story;
21
+ /**
22
+ * Server-Side Sorting
23
+ *
24
+ * This example demonstrates server-side sorting where sorting is handled
25
+ * by the backend API. The table manages the sorting state and notifies
26
+ * the parent component when sorting changes.
27
+ *
28
+ */
29
+ export declare const ServerSideSorting: Story;
30
+ export declare const InitialSortState: Story;
31
+ export declare const DisabledSorting: Story;
32
+ export declare const MixedSortingConfiguration: Story;
@@ -7,3 +7,11 @@ export declare const Default: Story;
7
7
  export declare const MaxHeight: Story;
8
8
  export declare const WrapText: Story;
9
9
  export declare const DynamicStickyHeader: Story;
10
+ export declare const DynamicStickyHeaderWithOffset: Story;
11
+ export declare const StickyHorizontalScrollbar: Story;
12
+ export declare const NoData: Story;
13
+ /**
14
+ * Infinite scroll example
15
+ * Demonstrates loading more data as user scrolls to the bottom
16
+ */
17
+ export declare const InfiniteScroll: Story;
@@ -0,0 +1,117 @@
1
+ import { Box } from "@mui/joy";
2
+ export declare const TableWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
+ $maxHeight: boolean;
4
+ }>> & string;
5
+ export declare const SortButton: 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 HeaderContent: 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 LoadingOverlay: typeof Box;
8
+ export declare const getTableStyles: (columnSizeVars: Record<string, number>, totalTableWidth: number, wrapText: boolean, headerSticky: boolean) => {
9
+ tableLayout: string;
10
+ width: string;
11
+ minWidth: string;
12
+ "& thead": {
13
+ transition: string;
14
+ };
15
+ "& thead th": {
16
+ backgroundColor: string;
17
+ fontWeight: string;
18
+ fontSize: string;
19
+ verticalAlign: string;
20
+ position: string;
21
+ zIndex: number;
22
+ top: string | number;
23
+ };
24
+ "& td, & td>div, & td>a": {
25
+ whiteSpace: string;
26
+ overflow: string;
27
+ textOverflow: string;
28
+ verticalAlign: string;
29
+ };
30
+ "& th[data-pinned='right'], & td[data-pinned='right']": {
31
+ position: string;
32
+ right: number;
33
+ background: string;
34
+ boxShadow: string;
35
+ "&::before": {
36
+ content: string;
37
+ position: string;
38
+ top: number;
39
+ left: string;
40
+ width: string;
41
+ height: string;
42
+ background: string;
43
+ pointerEvents: string;
44
+ };
45
+ };
46
+ "& th[data-pinned='right']": {
47
+ background: string;
48
+ };
49
+ "& th[data-pinned='left'], & td[data-pinned='left']": {
50
+ position: string;
51
+ left: number;
52
+ background: string;
53
+ boxShadow: string;
54
+ "&::after": {
55
+ content: string;
56
+ position: string;
57
+ top: number;
58
+ right: string;
59
+ width: string;
60
+ height: string;
61
+ background: string;
62
+ pointerEvents: string;
63
+ };
64
+ };
65
+ "& th[data-pinned='left']": {
66
+ background: string;
67
+ zIndex: number;
68
+ };
69
+ "& .resizer": {
70
+ position: string;
71
+ right: number;
72
+ top: number;
73
+ height: string;
74
+ width: string;
75
+ background: string;
76
+ cursor: string;
77
+ userSelect: string;
78
+ touchAction: string;
79
+ zIndex: number;
80
+ "@media (hover: hover)": {
81
+ opacity: number;
82
+ };
83
+ };
84
+ "& .resizer.isResizing": {
85
+ background: string;
86
+ opacity: number;
87
+ };
88
+ "& *:hover > .resizer": {
89
+ "@media (hover: hover)": {
90
+ opacity: number;
91
+ };
92
+ };
93
+ "& th button": {
94
+ display: string;
95
+ alignItems: string;
96
+ flexWrap: string;
97
+ gap: string;
98
+ position: string;
99
+ border: string;
100
+ cursor: string;
101
+ padding: number;
102
+ textAlign: string;
103
+ fontWeight: string;
104
+ fontSize: string;
105
+ width: string;
106
+ whiteSpace: string;
107
+ height: string;
108
+ flex: number;
109
+ "& i.fade": {
110
+ opacity: number;
111
+ transition: string;
112
+ };
113
+ "&:hover i.fade": {
114
+ opacity: number;
115
+ };
116
+ };
117
+ };
@@ -0,0 +1,34 @@
1
+ import { Row, TableOptions } from "@tanstack/react-table";
2
+ import { TableToolbarOptions } from "./TableToolbar";
3
+ export declare enum SortDirection {
4
+ ASC = "asc",
5
+ DESC = "desc"
6
+ }
7
+ export interface InfiniteScrollOptions {
8
+ enabled: boolean;
9
+ hasNextPage?: boolean;
10
+ isFetchingNextPage?: boolean;
11
+ fetchNextPage?: () => Promise<unknown> | void;
12
+ loadingText?: string;
13
+ }
14
+ export interface TableProps<TData = unknown> {
15
+ id: string;
16
+ loading?: boolean;
17
+ maxHeight?: boolean;
18
+ wrapText?: boolean;
19
+ rowRender?: (row: Row<TData>, props: {
20
+ key: string;
21
+ }) => JSX.Element;
22
+ reactTableOptions: Partial<TableOptions<TData>> & Pick<TableOptions<TData>, "data" | "columns">;
23
+ gridCheckboxes?: boolean;
24
+ selectedField?: string;
25
+ onSelectionChange?: (dataItem: TData) => void;
26
+ onHeaderSelectionChange?: (checked: boolean) => void;
27
+ headerSelectionValue?: boolean;
28
+ allSelected?: boolean;
29
+ showStickyScrollbar?: boolean;
30
+ enableStickyHeader?: boolean;
31
+ stickyHeaderOffset?: number;
32
+ infiniteScroll?: InfiniteScrollOptions;
33
+ toolbar?: TableToolbarOptions;
34
+ }
@@ -0,0 +1,13 @@
1
+ import { ColumnDef, Row } from "@tanstack/react-table";
2
+ interface TableBodyProps<TData> {
3
+ rows: Row<TData>[];
4
+ columns: ColumnDef<TData, unknown>[];
5
+ rowRender?: (row: Row<TData>, props: {
6
+ key: string;
7
+ }) => JSX.Element;
8
+ loading: boolean;
9
+ tableId: string;
10
+ }
11
+ declare function TableBodyInner<TData>({ rows, columns, rowRender, loading, tableId, }: TableBodyProps<TData>): import("react/jsx-runtime").JSX.Element;
12
+ export declare const TableBody: typeof TableBodyInner;
13
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ColumnFiltersState, Table } from "@tanstack/react-table";
2
+ import React from "react";
3
+ export interface TableToolbarOptions {
4
+ enabled: boolean;
5
+ totalResults?: number;
6
+ customContent?: React.ReactNode;
7
+ showFilterChips?: boolean;
8
+ }
9
+ interface TableToolbarProps<TData = unknown> {
10
+ toolbar: TableToolbarOptions;
11
+ columnFilters: ColumnFiltersState;
12
+ table: Table<TData>;
13
+ }
14
+ declare const TableToolbar: <TData = unknown>(props: TableToolbarProps<TData> & {
15
+ ref?: React.ForwardedRef<HTMLDivElement>;
16
+ }) => React.ReactElement;
17
+ export default TableToolbar;
@@ -0,0 +1,61 @@
1
+ import { Column } from "@tanstack/react-table";
2
+ interface TextFilterProps<TData = unknown> {
3
+ column: Column<TData, unknown>;
4
+ onClose?: () => void;
5
+ }
6
+ /**
7
+ * Text filter component with search input
8
+ */
9
+ export declare function TextFilter<TData = unknown>({ column, onClose, }: TextFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
10
+ interface NumericFilterProps<TData = unknown> {
11
+ column: Column<TData, unknown>;
12
+ onClose?: () => void;
13
+ }
14
+ /**
15
+ * Numeric filter component with min/max inputs
16
+ */
17
+ export declare function NumericFilter<TData = unknown>({ column, onClose, }: NumericFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
18
+ interface DateFilterProps<TData = unknown> {
19
+ column: Column<TData, unknown>;
20
+ onClose?: () => void;
21
+ }
22
+ /**
23
+ * Date filter component with start/end date inputs
24
+ */
25
+ export declare function DateFilter<TData = unknown>({ column, onClose, }: DateFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
26
+ interface SelectFilterProps<TData = unknown> {
27
+ column: Column<TData, unknown>;
28
+ options: string[];
29
+ onClose?: () => void;
30
+ }
31
+ /**
32
+ * Select filter component with dropdown options
33
+ */
34
+ export declare function SelectFilter<TData = unknown>({ column, options, onClose, }: SelectFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
35
+ interface MultiSelectFilterProps<TData = unknown> {
36
+ column: Column<TData, unknown>;
37
+ options: string[];
38
+ onClose?: () => void;
39
+ }
40
+ /**
41
+ * Multi-select filter component with checkboxes
42
+ */
43
+ export declare function MultiSelectFilter<TData = unknown>({ column, options, onClose, }: MultiSelectFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
44
+ export declare const filterComponentMap: {
45
+ readonly text: typeof TextFilter;
46
+ readonly number: typeof NumericFilter;
47
+ readonly date: typeof DateFilter;
48
+ readonly select: typeof SelectFilter;
49
+ readonly multiselect: typeof MultiSelectFilter;
50
+ };
51
+ interface ColumnFilterProps<TData = unknown> {
52
+ column: Column<TData, unknown>;
53
+ filterType?: "text" | "number" | "date" | "select" | "multiselect";
54
+ filterOptions?: string[];
55
+ }
56
+ /**
57
+ * Main column filter component that renders the appropriate filter UI
58
+ * based on the filter type
59
+ */
60
+ export declare function ColumnFilter<TData = unknown>({ column, filterType, filterOptions, }: ColumnFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
61
+ export {};
@@ -0,0 +1,28 @@
1
+ import { FilterFn } from "@tanstack/react-table";
2
+ /**
3
+ * Filter function for text-based columns
4
+ * Performs case-insensitive substring matching
5
+ */
6
+ export declare const textFilter: FilterFn<unknown>;
7
+ /**
8
+ * Filter function for numeric columns with range support
9
+ * Supports min, max, or both
10
+ */
11
+ export declare const numericFilter: FilterFn<unknown>;
12
+ /**
13
+ * Filter function for date columns with range support
14
+ */
15
+ export declare const dateFilter: FilterFn<unknown>;
16
+ /**
17
+ * Filter function for select/dropdown columns
18
+ * Supports single or multiple values
19
+ */
20
+ export declare const selectFilter: FilterFn<unknown>;
21
+ /**
22
+ * Filter function for boolean columns
23
+ */
24
+ export declare const booleanFilter: FilterFn<unknown>;
25
+ /**
26
+ * Multi-select filter that checks if value is in the selected array
27
+ */
28
+ export declare const multiSelectFilter: FilterFn<unknown>;
@@ -0,0 +1,2 @@
1
+ export * from "./FilterComponents";
2
+ export * from "./filterFunctions";
@@ -0,0 +1,3 @@
1
+ export { useInfiniteScroll } from "./useInfiniteScroll";
2
+ export { useStickyHeader } from "./useStickyHeader";
3
+ export { useStickyScrollbar } from "./useStickyScrollbar";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { InfiniteScrollOptions } from "../Table.types";
3
+ /**
4
+ * Hook to manage infinite scroll behavior using IntersectionObserver
5
+ * Automatically fetches next page when sentinel element is visible
6
+ */
7
+ export declare function useInfiniteScroll(infiniteScroll: InfiniteScrollOptions | undefined, observerTargetRef: React.RefObject<HTMLDivElement>): void;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ interface UseStickyHeaderOptions {
3
+ enabled: boolean;
4
+ stickyHeaderOffset: number;
5
+ tableWrapperRef: React.RefObject<HTMLDivElement>;
6
+ theadRef: React.RefObject<HTMLTableSectionElement>;
7
+ toolbarRef: React.RefObject<HTMLDivElement>;
8
+ }
9
+ /**
10
+ * Hook to manage sticky header behavior with smooth transitions
11
+ * Handles scroll detection and header positioning with fade effects
12
+ */
13
+ export declare function useStickyHeader({ enabled, stickyHeaderOffset, tableWrapperRef, theadRef, toolbarRef, }: UseStickyHeaderOptions): boolean;
14
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ /**
3
+ * Hook to manage sticky horizontal scrollbar visibility
4
+ * Shows a sticky scrollbar at the bottom of the viewport when the native scrollbar is out of view
5
+ */
6
+ export declare function useStickyScrollbar(tableWrapperRef: React.RefObject<HTMLDivElement>): boolean;
@@ -0,0 +1,24 @@
1
+ export declare const STATUS_OPTIONS: string[];
2
+ export declare const READING_GROUP_OPTIONS: string[];
3
+ export interface MockProduct {
4
+ id: number;
5
+ title: string;
6
+ digital_isbn: string;
7
+ author: string;
8
+ publish_date: Date;
9
+ image_count: number;
10
+ reviewed_image_count: number;
11
+ creator: string;
12
+ created_at: Date;
13
+ detail_url: string;
14
+ update_url: string;
15
+ delete_url: string;
16
+ export_url: string;
17
+ reviewers: string;
18
+ reviewed_at: Date;
19
+ last_reviewed_by: string;
20
+ status: string;
21
+ reading_group: string;
22
+ }
23
+ export declare const mockProducts: MockProduct[];
24
+ export declare function generateProducts(num: number): MockProduct[];
@@ -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";
@@ -34,6 +34,7 @@ import Logo from "./global/Logo/Logo";
34
34
  import LogoMini from "./global/Logo/LogoMini";
35
35
  import ThemeProvider from "./global/ThemeProvider";
36
36
  import Autocomplete from "./inputs/Autocomplete";
37
+ import AutocompleteOption from "./inputs/Autocomplete/AutocompleteOption";
37
38
  import AutocompleteSelectMultiple from "./inputs/Autocomplete/AutocompleteSelectMultiple";
38
39
  import Button from "./inputs/Button";
39
40
  import Checkbox from "./inputs/Checkbox";
@@ -72,4 +73,4 @@ import CardContent from "./surfaces/Card/CardContent";
72
73
  import CardCover from "./surfaces/Card/CardCover";
73
74
  import CardOverflow from "./surfaces/Card/CardOverflow";
74
75
  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, };
76
+ export { Accordion, AccordionDetails, AccordionGroup, AccordionLegacy, AccordionSummary, Alert, AppBar, Autocomplete, AutocompleteOption, 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, };
@@ -0,0 +1,3 @@
1
+ import { AutocompleteOptionProps } from "@mui/joy";
2
+ declare function AutocompleteOption(props: AutocompleteOptionProps): import("react/jsx-runtime").JSX.Element;
3
+ export default AutocompleteOption;
@@ -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;
@@ -1,2 +1,3 @@
1
1
  import Button from "./Button";
2
+ export { ButtonGroup } from "@mui/joy";
2
3
  export default Button;
@@ -0,0 +1,24 @@
1
+ export declare const STATUS_OPTIONS: string[];
2
+ export declare const READING_GROUP_OPTIONS: string[];
3
+ export interface MockProduct {
4
+ id: number;
5
+ title: string;
6
+ digital_isbn: string;
7
+ author: string;
8
+ publish_date: Date;
9
+ image_count: number;
10
+ reviewed_image_count: number;
11
+ creator: string;
12
+ created_at: Date;
13
+ detail_url: string;
14
+ update_url: string;
15
+ delete_url: string;
16
+ export_url: string;
17
+ reviewers: string;
18
+ reviewed_at: Date;
19
+ last_reviewed_by: string;
20
+ status: string;
21
+ reading_group: string;
22
+ }
23
+ export declare const mockProducts: MockProduct[];
24
+ export declare function generateProducts(num: number): MockProduct[];