uikit-react-public 0.11.24 → 0.14.21
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/components/Badge/Badge.d.ts +6 -0
- package/dist/components/Badge/Badge.stories.d.ts +15 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/CookieNotice/CookieNotice.d.ts +16 -0
- package/dist/components/CookieNotice/index.d.ts +2 -0
- package/dist/components/Dialog/BaseDialog.d.ts +7 -2
- package/dist/components/FileInput/FileInput.d.ts +8 -0
- package/dist/components/FileInput/FileInput.stories.d.ts +16 -0
- package/dist/components/FileInput/__tests__/FileInput.test.d.ts +1 -0
- package/dist/components/FileInput/index.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +4 -1
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/Link/BaseLink.d.ts +10 -0
- package/dist/components/Link/Link.d.ts +5 -10
- package/dist/components/Link/Link.stories.d.ts +1 -1
- package/dist/components/Link/index.d.ts +1 -1
- package/dist/components/Menu/MenuContent.d.ts +1 -1
- package/dist/components/Menu/MenuItem.d.ts +2 -0
- package/dist/components/Menu/MenuSection.d.ts +1 -1
- package/dist/components/Search/Search.d.ts +16 -0
- package/dist/components/Search/Search.stories.d.ts +34 -0
- package/dist/components/Search/__tests__/Search.test.d.ts +1 -0
- package/dist/components/Search/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.stories.d.ts +3 -7
- package/dist/components/Select/Select.types.d.ts +19 -14
- package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +1 -2
- package/dist/components/Select/subcomponents/Panel.d.ts +1 -1
- package/dist/components/Select/subcomponents/VisibleField.d.ts +4 -4
- package/dist/components/StandaloneLink/StandaloneLink.d.ts +12 -0
- package/dist/components/StandaloneLink/StandaloneLink.stories.d.ts +13 -0
- package/dist/components/StandaloneLink/__tests__/StandaloneLink.test.d.ts +1 -0
- package/dist/components/StandaloneLink/index.d.ts +2 -0
- package/dist/components/Table/Table.d.ts +10 -8
- package/dist/components/Table/Table.stories.d.ts +21 -0
- package/dist/components/Table/Table.types.d.ts +11 -0
- package/dist/components/Table/__tests__/Table.test.d.ts +1 -0
- package/dist/components/Table/index.d.ts +2 -1
- package/dist/components/Table/subcomponents/Body.d.ts +4 -0
- package/dist/components/Table/subcomponents/Cell/Cell.d.ts +12 -0
- package/dist/components/Table/subcomponents/Cell/Cell.stories.d.ts +313 -0
- package/dist/components/Table/subcomponents/Cell/CellContent.d.ts +10 -0
- package/dist/components/Table/subcomponents/Cell/__tests__/Cell.test.d.ts +1 -0
- package/dist/components/Table/subcomponents/Head.d.ts +4 -0
- package/dist/components/Table/subcomponents/HeadCell/HeadCell.d.ts +13 -0
- package/dist/components/Table/subcomponents/HeadCell/HeadCell.stories.d.ts +312 -0
- package/dist/components/Table/subcomponents/HeadCell/HeadCellContent.d.ts +10 -0
- package/dist/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.d.ts +1 -0
- package/dist/components/Table/subcomponents/Row.d.ts +5 -0
- package/dist/components/Table/subcomponents/SortIcon.d.ts +7 -0
- package/dist/components/Table/subcomponents/index.d.ts +10 -0
- package/dist/components/Tabs/Tab.d.ts +1 -1
- package/dist/components/Tabs/TabContext.d.ts +1 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -1
- package/dist/components/Tabs/Tabs.stories.d.ts +3 -0
- package/dist/components/Timepicker/Timepicker.d.ts +10 -0
- package/dist/components/Timepicker/Timepicker.stories.d.ts +7 -0
- package/dist/components/Timepicker/__tests__/Timepicker.test.d.ts +1 -0
- package/dist/components/Timepicker/index.d.ts +2 -0
- package/dist/components/Timepicker/utils/convertDateToTimeString.d.ts +2 -0
- package/dist/components/Timepicker/utils/convertDateToTimeString.test.d.ts +1 -0
- package/dist/components/Timepicker/utils/index.d.ts +1 -0
- package/dist/components/WeekPicker/WeekPicker.d.ts +3 -0
- package/dist/components/WeekPicker/index.d.ts +1 -0
- package/dist/components/WeekPicker/subcomponents/CustomDatepicker.d.ts +17 -0
- package/dist/components/WeekPicker/subcomponents/DatepickerInput.d.ts +13 -0
- package/dist/components/WeekPicker/subcomponents/VisibleField.d.ts +15 -0
- package/dist/components/WeekPicker/subcomponents/index.d.ts +3 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useFocusTrap.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5703 -4448
- package/dist/theme/defaultTheme.d.ts +7 -0
- package/dist/theme/useTheme.d.ts +14 -0
- package/dist/utils/__tests__/capitalise.test.d.ts +1 -0
- package/dist/utils/capitalise.d.ts +2 -0
- package/lib/components/Alert/Alert.tsx +7 -1
- package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +4 -0
- package/lib/components/Badge/Badge.stories.tsx +19 -0
- package/lib/components/Badge/Badge.tsx +48 -0
- package/lib/components/Badge/index.ts +2 -0
- package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +4 -4
- package/lib/components/Button/Button.tsx +5 -2
- package/lib/components/Calendar/subcomponents/Grid.tsx +0 -1
- package/lib/components/CookieNotice/CookieNotice.tsx +114 -0
- package/lib/components/CookieNotice/index.ts +2 -0
- package/lib/components/Dialog/BaseDialog.tsx +44 -4
- package/lib/components/Field/__tests__/Field.test.tsx +148 -148
- package/lib/components/FileInput/FileInput.stories.tsx +70 -0
- package/lib/components/FileInput/FileInput.tsx +68 -0
- package/lib/components/FileInput/__tests__/FileInput.test.tsx +99 -0
- package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +91 -0
- package/lib/components/FileInput/index.ts +2 -0
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +25 -25
- package/lib/components/Header/Header.tsx +19 -2
- package/lib/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +4 -4
- package/lib/components/Heading/Documentation.mdx +1 -1
- package/lib/components/Heading/Heading.tsx +1 -1
- package/lib/components/Heading/__tests__/Heading.test.tsx +7 -19
- package/lib/components/Heading/__tests__/__snapshots__/Heading.test.tsx.snap +7 -7
- package/lib/components/Label/Label.tsx +0 -2
- package/lib/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +7 -7
- package/lib/components/Link/BaseLink.tsx +84 -0
- package/lib/components/Link/Link.tsx +72 -32
- package/lib/components/Link/__tests__/__snapshots__/link.test.tsx.snap +3 -3
- package/lib/components/Link/__tests__/link.test.tsx +6 -13
- package/lib/components/Link/index.ts +1 -1
- package/lib/components/Menu/Menu.context.tsx +3 -1
- package/lib/components/Menu/Menu.tsx +2 -2
- package/lib/components/Menu/MenuContent.tsx +5 -5
- package/lib/components/Menu/MenuItem.tsx +20 -3
- package/lib/components/Menu/MenuSection.tsx +4 -3
- package/lib/components/Pagination/PaginationControls.tsx +1 -3
- package/lib/components/Search/Search.stories.tsx +41 -0
- package/lib/components/Search/Search.tsx +167 -0
- package/lib/components/Search/__tests__/Search.test.tsx +94 -0
- package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +179 -0
- package/lib/components/Search/index.ts +2 -0
- package/lib/components/Select/Select.stories.tsx +8 -35
- package/lib/components/Select/Select.tsx +2 -2
- package/lib/components/Select/Select.types.ts +20 -15
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +3 -3
- package/lib/components/Select/subcomponents/CustomOption.tsx +22 -9
- package/lib/components/Select/subcomponents/CustomSelect.tsx +31 -20
- package/lib/components/Select/subcomponents/Panel.tsx +4 -5
- package/lib/components/Select/subcomponents/VisibleField.tsx +26 -22
- package/lib/components/StandaloneLink/StandaloneLink.stories.tsx +32 -0
- package/lib/components/StandaloneLink/StandaloneLink.tsx +183 -0
- package/lib/components/StandaloneLink/__tests__/StandaloneLink.test.tsx +57 -0
- package/lib/components/StandaloneLink/__tests__/__snapshots__/StandaloneLink.test.tsx.snap +19 -0
- package/lib/components/StandaloneLink/index.ts +2 -0
- package/lib/components/Table/Table.stories.tsx +337 -0
- package/lib/components/Table/Table.tsx +42 -67
- package/lib/components/Table/Table.types.ts +14 -0
- package/lib/components/Table/__tests__/Table.test.tsx +121 -0
- package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +210 -0
- package/lib/components/Table/index.ts +8 -1
- package/lib/components/Table/subcomponents/Body.tsx +18 -0
- package/lib/components/Table/subcomponents/Cell/Cell.stories.tsx +151 -0
- package/lib/components/Table/subcomponents/Cell/Cell.tsx +72 -0
- package/lib/components/Table/subcomponents/Cell/CellContent.tsx +91 -0
- package/lib/components/Table/subcomponents/Cell/__tests__/Cell.test.tsx +115 -0
- package/lib/components/Table/subcomponents/Cell/__tests__/__snapshots__/Cell.test.tsx.snap +107 -0
- package/lib/components/Table/subcomponents/Head.tsx +34 -0
- package/lib/components/Table/subcomponents/HeadCell/HeadCell.stories.tsx +85 -0
- package/lib/components/Table/subcomponents/HeadCell/HeadCell.tsx +99 -0
- package/lib/components/Table/subcomponents/HeadCell/HeadCellContent.tsx +61 -0
- package/lib/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.tsx +137 -0
- package/lib/components/Table/subcomponents/HeadCell/__tests__/__snapshots__/HeadCell.test.tsx.snap +110 -0
- package/lib/components/Table/subcomponents/Row.tsx +49 -0
- package/lib/components/Table/subcomponents/SortIcon.tsx +63 -0
- package/lib/components/Table/subcomponents/index.ts +14 -0
- package/lib/components/Tabs/Tab.tsx +3 -3
- package/lib/components/Tabs/TabContext.tsx +1 -0
- package/lib/components/Tabs/Tabs.stories.tsx +9 -3
- package/lib/components/Tabs/Tabs.tsx +10 -32
- package/lib/components/Tabs/__tests__/Tabs.test.tsx +10 -4
- package/lib/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +32 -32
- package/lib/components/Timepicker/Timepicker.stories.tsx +43 -0
- package/lib/components/Timepicker/Timepicker.tsx +96 -0
- package/lib/components/Timepicker/__tests__/Timepicker.test.tsx +55 -0
- package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +19 -0
- package/lib/components/Timepicker/index.tsx +2 -0
- package/lib/components/Timepicker/utils/convertDateToTimeString.test.ts +54 -0
- package/lib/components/Timepicker/utils/convertDateToTimeString.ts +10 -0
- package/lib/components/Timepicker/utils/index.ts +1 -0
- package/lib/components/WeekPicker/WeekPicker.tsx +26 -0
- package/lib/components/WeekPicker/index.ts +1 -0
- package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +298 -0
- package/lib/components/WeekPicker/subcomponents/DatepickerInput.tsx +111 -0
- package/lib/components/WeekPicker/subcomponents/VisibleField.tsx +126 -0
- package/lib/components/WeekPicker/subcomponents/index.ts +3 -0
- package/lib/components/index.ts +17 -0
- package/lib/hooks/index.ts +2 -0
- package/lib/hooks/useFocusTrap.ts +123 -0
- package/lib/index.ts +1 -0
- package/lib/theme/defaultTheme.ts +7 -0
- package/lib/utils/__tests__/capitalise.test.ts +40 -0
- package/lib/utils/capitalise.ts +4 -0
- package/package.json +1 -1
- package/lib/components/Field/__tests__/__snapshots__/Field.test.tsx.snap +0 -300
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ testId, className, children, ...props }: import('./Badge').BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
args: {
|
|
9
|
+
children: string;
|
|
10
|
+
};
|
|
11
|
+
tags: string[];
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Default: Story;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactElement, ElementType, ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { MarginProps } from '../common/marginsStyle';
|
|
2
3
|
export declare const NAME = "ucl-uikit-button";
|
|
3
4
|
type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
|
|
4
5
|
export interface ButtonBaseProps {
|
|
@@ -16,7 +17,7 @@ export interface ButtonBaseProps {
|
|
|
16
17
|
export type ButtonProps<C extends ElementType = 'button'> = {
|
|
17
18
|
as?: C;
|
|
18
19
|
ref?: PolymorphicRef<C>;
|
|
19
|
-
} & ButtonBaseProps & Omit<ComponentPropsWithRef<C>, keyof ButtonBaseProps | 'as'>;
|
|
20
|
+
} & ButtonBaseProps & MarginProps & Omit<ComponentPropsWithRef<C>, keyof ButtonBaseProps | 'as'>;
|
|
20
21
|
declare const Button: <C extends ElementType = "button">({ as, variant, destructive, size, disabled, icon, iconPosition, tooltip, loading, fullWidth, testId, ref, children, className, ...props }: ButtonProps<C>) => import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
declare const MemoizedButton: typeof Button;
|
|
22
23
|
export default MemoizedButton;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { MarginProps } from '../common/marginsStyle';
|
|
3
|
+
export declare const NAME = "ucl-uikit-cookie-notice";
|
|
4
|
+
export declare const DEFAULT_POLICY_HREF = "https://www.ucl.ac.uk/legal-services/privacy/cookie-policy";
|
|
5
|
+
export declare const DEFAULT_TEXT = "We use necessary cookies to manage your session and essential site functions. We also use Google Analytics cookies to understand how our site is used. You can accept or reject non-essential cookies.";
|
|
6
|
+
export interface CookieNoticeBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
policyHref?: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
onAccept?: () => void;
|
|
10
|
+
onReject?: () => void;
|
|
11
|
+
trapFocus?: boolean;
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
14
|
+
export type CookieNoticeProps = CookieNoticeBaseProps & MarginProps;
|
|
15
|
+
declare const CookieNotice: ({ policyHref, text, onAccept, onReject, trapFocus, testId, className, ...props }: CookieNoticeProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default CookieNotice;
|
|
@@ -9,8 +9,13 @@ export interface BaseDialogProps extends HTMLAttributes<HTMLDialogElement> {
|
|
|
9
9
|
modal?: boolean;
|
|
10
10
|
closeOnClickOutside?: boolean;
|
|
11
11
|
closeOnClickOutsideStopPropagation?: boolean;
|
|
12
|
-
|
|
12
|
+
nonModalCloseOnEscape?: boolean;
|
|
13
|
+
onClose?: (ev: React.MouseEvent | KeyboardEvent) => void;
|
|
14
|
+
initialFocusRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
finalFocusRef?: React.RefObject<HTMLElement>;
|
|
16
|
+
disableFocusTrap?: boolean;
|
|
17
|
+
restoreFocus?: boolean;
|
|
13
18
|
testId?: string;
|
|
14
19
|
}
|
|
15
|
-
declare const _default: React.MemoExoticComponent<({ open, size, modal, closeOnClickOutside, closeOnClickOutsideStopPropagation,
|
|
20
|
+
declare const _default: React.MemoExoticComponent<({ open, size, modal, closeOnClickOutside, closeOnClickOutsideStopPropagation, nonModalCloseOnEscape, onClose, className, children, initialFocusRef, finalFocusRef, disableFocusTrap, restoreFocus, testId, ...props }: BaseDialogProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
16
21
|
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
export declare const NAME = "ucl-uikit-fileinput";
|
|
3
|
+
export interface FileInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
testId?: string;
|
|
5
|
+
labelId?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const FileInput: ({ testId, children, labelId, ...props }: FileInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default FileInput;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ testId, children, labelId, ...props }: import('./FileInput').FileInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const Default: Story;
|
|
13
|
+
export declare const WithCustomClass: Story;
|
|
14
|
+
export declare const MultipleFiles: Story;
|
|
15
|
+
export declare const NoChildren: Story;
|
|
16
|
+
export declare const WithDecorator: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,9 +7,12 @@ export declare const DEFAULT_Z_INDEX = 3;
|
|
|
7
7
|
export interface HeaderProps extends HTMLAttributes<HTMLElement> {
|
|
8
8
|
title?: string;
|
|
9
9
|
fixed?: boolean;
|
|
10
|
+
titleAs?: React.ElementType<React.HTMLAttributes<HTMLElement>>;
|
|
11
|
+
titleClassName?: string;
|
|
12
|
+
titleProps?: Record<string, unknown>;
|
|
10
13
|
testId?: string;
|
|
11
14
|
}
|
|
12
|
-
declare const MemoAppHeader: import('react').MemoExoticComponent<({ title, fixed, testId, className, children, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
15
|
+
declare const MemoAppHeader: import('react').MemoExoticComponent<({ title, fixed, titleAs, titleClassName, titleProps, testId, className, children, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
13
16
|
export interface IHeaderSubComponents {
|
|
14
17
|
Menu: typeof HeaderMenu;
|
|
15
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
import { MarginProps } from '../common/marginsStyle';
|
|
3
|
-
export declare const NAME = "ucl-heading";
|
|
3
|
+
export declare const NAME = "ucl-uikit-heading";
|
|
4
4
|
export interface HeadingBaseProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
5
5
|
level?: 1 | 2 | 3 | 4;
|
|
6
6
|
margins?: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React, AnchorHTMLAttributes, ElementType } from 'react';
|
|
2
|
+
export interface BaseLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
|
+
component?: ElementType;
|
|
4
|
+
size?: 'small' | 'default';
|
|
5
|
+
noVisited?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const BaseLink: React.ForwardRefExoticComponent<BaseLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
10
|
+
export default BaseLink;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
noVisited?: boolean;
|
|
5
|
-
testId?: string;
|
|
6
|
-
component?: ElementType;
|
|
1
|
+
import { BaseLinkProps } from './BaseLink';
|
|
2
|
+
export interface LinkProps extends BaseLinkProps {
|
|
3
|
+
variant?: 'primary' | 'secondary';
|
|
7
4
|
}
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
declare const _default: import('react').NamedExoticComponent<LinkBaseProps & AnchorHTMLAttributes<HTMLAnchorElement> & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
11
|
-
export default _default;
|
|
5
|
+
declare const Link: import('react').ForwardRefExoticComponent<LinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
6
|
+
export default Link;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: import('react').
|
|
4
|
+
component: import('react').ForwardRefExoticComponent<import('./Link').LinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
5
5
|
args: {
|
|
6
6
|
children: string;
|
|
7
7
|
href: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Link';
|
|
2
|
-
export type { LinkProps
|
|
2
|
+
export type { LinkProps } from './Link';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, HTMLAttributes } from 'react';
|
|
2
2
|
export declare const NAME = "ucl-uikit-menu__content";
|
|
3
|
-
export interface MenuContentProps extends HTMLAttributes<
|
|
3
|
+
export interface MenuContentProps extends HTMLAttributes<HTMLUListElement> {
|
|
4
4
|
title?: string;
|
|
5
5
|
testId?: string;
|
|
6
6
|
position?: 'left' | 'right';
|
|
@@ -3,6 +3,8 @@ export declare const NAME = "ucl-uikit-menu__item";
|
|
|
3
3
|
export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
4
4
|
testId?: string;
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
|
+
secondary?: boolean;
|
|
7
|
+
externalLink?: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare const _default: React.NamedExoticComponent<MenuItemProps>;
|
|
8
10
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, HTMLAttributes } from 'react';
|
|
2
2
|
export declare const NAME = "ucl-uikit-menu__section";
|
|
3
|
-
export interface MenuSectionProps extends HTMLAttributes<
|
|
3
|
+
export interface MenuSectionProps extends HTMLAttributes<HTMLLIElement> {
|
|
4
4
|
testId?: string;
|
|
5
5
|
}
|
|
6
6
|
declare const MenuSection: React.FC<MenuSectionProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { InputProps, IconButtonProps } from '../..';
|
|
3
|
+
import { MarginProps } from '../common/marginsStyle';
|
|
4
|
+
export interface SearchBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
onSearch?: (searchTerms: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
inputProps?: InputProps;
|
|
9
|
+
clearButtonProps?: IconButtonProps;
|
|
10
|
+
submitButtonProps?: IconButtonProps;
|
|
11
|
+
testId?: string;
|
|
12
|
+
}
|
|
13
|
+
export type SearchProps = SearchBaseProps & MarginProps;
|
|
14
|
+
export declare const NAME = "ucl-uikit-search";
|
|
15
|
+
declare const Search: ({ placeholder, testId, onSearch, disabled, m, mv, mh, mt, mb, ml, mr, noMargins, inputProps, clearButtonProps, submitButtonProps, className, ...props }: SearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default Search;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ placeholder, testId, onSearch, disabled, m, mv, mh, mt, mb, ml, mr, noMargins, inputProps, clearButtonProps, submitButtonProps, className, ...props }: import('./Search').SearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
argTypes: {
|
|
9
|
+
placeholder: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
control: {
|
|
16
|
+
type: "boolean";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
testId: {
|
|
20
|
+
control: {
|
|
21
|
+
type: "text";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
onSearch: {
|
|
25
|
+
action: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
tags: string[];
|
|
29
|
+
};
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
export declare const Default: Story;
|
|
33
|
+
export declare const Disabled: Story;
|
|
34
|
+
export declare const WithPlaceholder: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SelectProps } from './Select.types';
|
|
2
|
-
declare const Select: (props: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const Select: <T extends string | number = string>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Select;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: (props: import('./Select.types').SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: <T extends string | number = string>(props: import('./Select.types').SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
argTypes: {
|
|
6
6
|
value: {
|
|
7
7
|
control: {
|
|
@@ -28,12 +28,9 @@ declare const meta: {
|
|
|
28
28
|
type: "text";
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
lineBreak: {
|
|
32
32
|
control: {
|
|
33
|
-
type: "
|
|
34
|
-
min: number;
|
|
35
|
-
max: number;
|
|
36
|
-
step: number;
|
|
33
|
+
type: "boolean";
|
|
37
34
|
};
|
|
38
35
|
};
|
|
39
36
|
};
|
|
@@ -50,7 +47,6 @@ export default meta;
|
|
|
50
47
|
type Story = StoryObj<typeof meta>;
|
|
51
48
|
export declare const Default: Story;
|
|
52
49
|
export declare const Native: Story;
|
|
53
|
-
export declare const OptionsWithIcons: Story;
|
|
54
50
|
export declare const Disabled: Story;
|
|
55
51
|
export declare const WithPlaceholder: Story;
|
|
56
52
|
export declare const SingleLongOption: Story;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Maps to a native <option> element in <NativeSelect>
|
|
4
4
|
* or a <CustomOption> in <CustomSelect>
|
|
5
5
|
*/
|
|
6
|
-
export type OptionData = {
|
|
6
|
+
export type OptionData<T> = {
|
|
7
7
|
/**
|
|
8
8
|
* Display text shown to the user
|
|
9
9
|
*/
|
|
@@ -12,22 +12,24 @@ export type OptionData = {
|
|
|
12
12
|
* Data-friendly value that is returned when the option is selected
|
|
13
13
|
* We assume this will be submitted to a server or used in some other way
|
|
14
14
|
*/
|
|
15
|
-
value:
|
|
15
|
+
value: T;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* Only used by <CustomOption>
|
|
19
|
-
* Takes in an actual <Icon> component
|
|
17
|
+
* Apply additional props to a select option component.
|
|
20
18
|
*/
|
|
19
|
+
optionProps?: Record<string, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
Deprecated
|
|
22
|
+
*/
|
|
21
23
|
icon?: React.ReactNode;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* Top level props that <Select> accepts when implemented
|
|
25
27
|
*/
|
|
26
|
-
interface BaseSelectProps {
|
|
28
|
+
interface BaseSelectProps<T = string> {
|
|
27
29
|
/**
|
|
28
30
|
* An array of option data, to be rendered either natively or custom
|
|
29
31
|
*/
|
|
30
|
-
options: OptionData[];
|
|
32
|
+
options: OptionData<T>[];
|
|
31
33
|
/**
|
|
32
34
|
* Placeholder text shown when no option is selected
|
|
33
35
|
* Displayed in visible field of custom implementation
|
|
@@ -53,11 +55,13 @@ interface BaseSelectProps {
|
|
|
53
55
|
* Internal props for the custom implementation, with <div> as root element
|
|
54
56
|
* onChange already exists on <div>. We override it.
|
|
55
57
|
*/
|
|
56
|
-
export type CustomSelectProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & BaseSelectProps & {
|
|
58
|
+
export type CustomSelectProps<T> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & BaseSelectProps<T> & {
|
|
57
59
|
native?: false;
|
|
58
|
-
value?:
|
|
60
|
+
value?: T;
|
|
59
61
|
disabled?: boolean;
|
|
60
|
-
|
|
62
|
+
lineBreak?: boolean;
|
|
63
|
+
panelClassName?: string;
|
|
64
|
+
onValueChange?: (value: T, ev: React.UIEvent) => void;
|
|
61
65
|
ref?: React.RefObject<HTMLDivElement | null>;
|
|
62
66
|
};
|
|
63
67
|
/**
|
|
@@ -68,15 +72,16 @@ export type NativeSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> &
|
|
|
68
72
|
native: true;
|
|
69
73
|
ref?: React.RefObject<HTMLSelectElement | null>;
|
|
70
74
|
};
|
|
71
|
-
export type SelectProps = NativeSelectProps | CustomSelectProps
|
|
75
|
+
export type SelectProps<T> = NativeSelectProps | CustomSelectProps<T>;
|
|
72
76
|
/**
|
|
73
77
|
* Each option as displayed in the Panel of <CustomSelect>
|
|
74
78
|
* Roughly equivalent to a custom version of <option>
|
|
75
79
|
*/
|
|
76
|
-
export interface CustomOptionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
77
|
-
value:
|
|
80
|
+
export interface CustomOptionProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
81
|
+
value: T;
|
|
78
82
|
testId?: string;
|
|
79
83
|
isSelected?: boolean;
|
|
80
|
-
onSelect: (event: React.MouseEvent, value:
|
|
84
|
+
onSelect: (event: React.MouseEvent, value: T) => void;
|
|
85
|
+
lineBreak?: boolean;
|
|
81
86
|
}
|
|
82
87
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CustomOptionProps } from '../Select.types';
|
|
2
|
-
declare const CustomOption: ({ value, isSelected, onSelect, testId, className, children, ...props }: CustomOptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const CustomOption: <T extends string | number>({ value, isSelected, onSelect, lineBreak, testId, className, children, ...props }: CustomOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default CustomOption;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { CustomSelectProps } from '../Select.types';
|
|
2
|
-
|
|
3
|
-
declare const CustomSelect: ({ value, options, onValueChange, disabled, placeholder, width, testId, className, ref, ...props }: CustomSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const CustomSelect: <T extends string | number>({ value, options, onValueChange, disabled, placeholder, lineBreak, width, testId, className, panelClassName, ref, ...props }: CustomSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export default CustomSelect;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OptionData } from '../Select.types';
|
|
2
|
-
interface VisibleFieldProps {
|
|
2
|
+
interface VisibleFieldProps<T> {
|
|
3
3
|
isOpen?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
-
selectedOption: OptionData | null | undefined;
|
|
5
|
+
selectedOption: OptionData<T> | null | undefined;
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const VisibleField: <T extends string | number>({ selectedOption, isOpen, placeholder, disabled, }: VisibleFieldProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default VisibleField;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { IconProps } from '../Icon';
|
|
3
|
+
import { BaseLinkProps } from '../Link/BaseLink';
|
|
4
|
+
import { MarginProps } from '../common/marginsStyle';
|
|
5
|
+
export interface StandaloneLinkBaseProps extends BaseLinkProps {
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
7
|
+
icon?: ReactElement<IconProps>;
|
|
8
|
+
iconPosition?: 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
export type StandaloneLinkProps = StandaloneLinkBaseProps & MarginProps;
|
|
11
|
+
declare const StandaloneLink: import('react').ForwardRefExoticComponent<StandaloneLinkBaseProps & MarginProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
12
|
+
export default StandaloneLink;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').ForwardRefExoticComponent<import('./StandaloneLink').StandaloneLinkBaseProps & import('../common/marginsStyle').MarginProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
5
|
+
args: {
|
|
6
|
+
children: string;
|
|
7
|
+
href: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const Default: Story;
|
|
13
|
+
export declare const NewTab: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { TableProps } from './Table.types';
|
|
2
|
+
declare const Table: {
|
|
3
|
+
({ testId, className, children, ref, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Head: ({ className, children, ...props }: import('./subcomponents').TableHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
HeadCell: ({ variant, accessor, sort, onSortChange, showSortIcon, checked, onCheck, testId, className, children, ...props }: import('./subcomponents').TableHeadCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Body: ({ className, children, ...props }: import('./subcomponents').TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Row: ({ selected, className, children, ...props }: import('./subcomponents').TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Cell: ({ variant, icon, onCheck, checked, onButtonClick, testId, className, children, ...props }: import('./subcomponents').TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export default Table;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: {
|
|
5
|
+
({ testId, className, children, ref, ...props }: import('./Table.types').TableProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Head: ({ className, children, ...props }: import('./subcomponents').TableHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
HeadCell: ({ variant, accessor, sort, onSortChange, showSortIcon, checked, onCheck, testId, className, children, ...props }: import('./subcomponents').TableHeadCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Body: ({ className, children, ...props }: import('./subcomponents').TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Row: ({ selected, className, children, ...props }: import('./subcomponents').TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Cell: ({ variant, icon, onCheck, checked, onButtonClick, testId, className, children, ...props }: import('./subcomponents').TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: string;
|
|
14
|
+
};
|
|
15
|
+
tags: string[];
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
export declare const Simple: Story;
|
|
20
|
+
export declare const CellVariants: Story;
|
|
21
|
+
export declare const WithHeaderCellCheckbox: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ColumnVariant = 'default' | 'numeric' | 'checkbox' | 'button';
|
|
2
|
+
export type SortOrder = 'asc' | 'desc' | null;
|
|
3
|
+
export type SortPattern = {
|
|
4
|
+
accessor: string | null;
|
|
5
|
+
order: SortOrder;
|
|
6
|
+
};
|
|
7
|
+
export interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
|
|
8
|
+
testId?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
ref?: React.Ref<HTMLTableElement>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnVariant } from '../../Table.types';
|
|
2
|
+
export interface TableCellProps extends React.HTMLAttributes<HTMLTableCellElement> {
|
|
3
|
+
variant?: ColumnVariant;
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
onCheck?: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
onButtonClick?: (event: React.UIEvent) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
testId?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const Cell: ({ variant, icon, onCheck, checked, onButtonClick, testId, className, children, ...props }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default Cell;
|