uikit-react-public 0.14.21 → 0.17.4
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/README.md +4 -2
- package/dist/components/Accordion/Accordion.Heading.d.ts +4 -4
- package/dist/components/Accordion/Accordion.Panel.d.ts +2 -2
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.stories.d.ts +57 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +107 -1
- package/dist/components/Button/Button.d.ts +1 -0
- package/dist/components/Calendar/index.d.ts +1 -1
- package/dist/components/Datepicker/Datepicker.d.ts +1 -1
- package/dist/components/Datepicker/Datepicker.stories.d.ts +4 -3
- package/dist/components/Datepicker/Datepicker.types.d.ts +4 -5
- package/dist/components/Datepicker/subcomponents/CustomDatepicker.d.ts +4 -1
- package/dist/components/Datepicker/subcomponents/DatepickerInput.d.ts +15 -2
- package/dist/components/Datepicker/subcomponents/Panel.d.ts +1 -1
- package/dist/components/Datepicker/subcomponents/VisibleField.d.ts +6 -1
- package/dist/components/Datepicker/subcomponents/index.d.ts +0 -1
- package/dist/components/Datepicker/utils/index.d.ts +0 -1
- package/dist/components/Dialog/BaseDialog.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +4 -1
- package/dist/components/Header/Header.stories.d.ts +40 -0
- package/dist/components/Main/Main.d.ts +21 -0
- package/dist/components/Main/Main.stories.d.ts +15 -0
- package/dist/components/Main/index.d.ts +2 -0
- package/dist/components/NativeDatepicker/NativeDatepicker.d.ts +3 -0
- package/dist/components/NativeDatepicker/NativeDatepicker.stories.d.ts +36 -0
- package/dist/components/NativeDatepicker/NativeDatepicker.types.d.ts +10 -0
- package/dist/components/NativeDatepicker/index.d.ts +2 -0
- package/dist/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.d.ts +1 -1
- package/dist/components/NativeDatepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts +1 -0
- package/dist/components/NativeDatepicker/utils/index.d.ts +1 -0
- package/dist/components/Select/Select.stories.d.ts +154 -2
- package/dist/components/Select/Select.types.d.ts +51 -22
- package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -2
- package/dist/components/Select/subcomponents/FilterInput.d.ts +14 -0
- package/dist/components/Select/subcomponents/NativeSelect.d.ts +5 -1
- package/dist/components/Select/subcomponents/VisibleField.d.ts +3 -1
- package/dist/components/Select/subcomponents/index.d.ts +1 -0
- package/dist/components/WeekPicker/WeekPicker.d.ts +2 -2
- package/dist/components/WeekPicker/WeekPicker.stories.d.ts +41 -0
- package/dist/components/WeekPicker/WeekPicker.types.d.ts +16 -0
- package/dist/components/WeekPicker/index.d.ts +1 -0
- package/dist/components/WeekPicker/subcomponents/CustomDatepicker.d.ts +1 -1
- package/dist/components/index.d.ts +8 -0
- package/dist/hooks/useFocusTrap.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4366 -3768
- package/dist/utils/__tests__/announce.test.d.ts +1 -0
- package/dist/utils/announce.d.ts +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/lib/components/Accordion/Accordion.Heading.tsx +27 -8
- package/lib/components/Accordion/Accordion.Panel.tsx +11 -3
- package/lib/components/Accordion/Accordion.stories.tsx +139 -0
- package/lib/components/Accordion/Accordion.tsx +10 -8
- package/lib/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +7 -7
- package/lib/components/Accordion/index.ts +2 -0
- package/lib/components/Alert/Alert.stories.tsx +1 -1
- package/lib/components/Avatar/Avatar.mdx +117 -0
- package/lib/components/Avatar/Avatar.stories.tsx +110 -2
- package/lib/components/Blanket/Blanket.stories.tsx +1 -1
- package/lib/components/Button/Button.stories.tsx +1 -1
- package/lib/components/Button/Button.tsx +1 -0
- package/lib/components/Calendar/Calendar.stories.tsx +12 -32
- package/lib/components/Calendar/__tests__/Calendar.test.tsx +23 -15
- package/lib/components/Calendar/index.ts +1 -5
- package/lib/components/Calendar/subcomponents/AcademicWeeks.tsx +2 -1
- package/lib/components/Calendar/subcomponents/ColumnHeading.tsx +5 -1
- package/lib/components/Calendar/subcomponents/EventDot.tsx +2 -1
- package/lib/components/Calendar/subcomponents/index.ts +1 -1
- package/lib/components/Calendar/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.ts +43 -11
- package/lib/components/Calendar/utils/normaliseMonth/normaliseMonth.test.ts +5 -5
- package/lib/components/Datepicker/Datepicker.lld.md +108 -0
- package/lib/components/Datepicker/Datepicker.stories.tsx +44 -5
- package/lib/components/Datepicker/Datepicker.tsx +14 -36
- package/lib/components/Datepicker/Datepicker.types.ts +5 -14
- package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +150 -8
- package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +10 -4
- package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +39 -5
- package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +30 -17
- package/lib/components/Datepicker/subcomponents/Panel.tsx +6 -2
- package/lib/components/Datepicker/subcomponents/VisibleField.tsx +40 -3
- package/lib/components/Datepicker/subcomponents/index.ts +0 -1
- package/lib/components/Datepicker/utils/index.ts +0 -1
- package/lib/components/Dialog/BaseDialog.tsx +11 -0
- package/lib/components/Dialog/Dialog.tsx +8 -1
- package/lib/components/Dialog/DialogBody.tsx +5 -1
- package/lib/components/Dialog/DialogHeader.tsx +2 -1
- package/lib/components/Divider/Divider.stories.tsx +1 -1
- package/lib/components/Field/ErrorText.tsx +1 -0
- package/lib/components/Field/Field.stories.tsx +1 -1
- package/lib/components/Field/__tests__/Field.test.tsx +13 -0
- package/lib/components/FileInput/FileInput.stories.tsx +1 -1
- package/lib/components/Footer/Footer.stories.tsx +1 -1
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +3 -3
- package/lib/components/Header/Header.mdx +52 -0
- package/lib/components/Header/Header.stories.tsx +98 -0
- package/lib/components/Header/Header.tsx +51 -6
- package/lib/components/Header/__tests__/Header.test.tsx +17 -1
- package/lib/components/Heading/Heading.stories.tsx +1 -1
- package/lib/components/Icon/Icon.stories.tsx +1 -1
- package/lib/components/IconButton/IconButton.stories.tsx +1 -1
- package/lib/components/Input/Input.stories.tsx +1 -1
- package/lib/components/Label/Label.stories.tsx +1 -1
- package/lib/components/Main/Main.stories.tsx +36 -0
- package/lib/components/Main/Main.tsx +46 -0
- package/lib/components/Main/__tests__/Main.test.tsx +80 -0
- package/lib/components/Main/__tests__/__snapshots__/Main.test.tsx.snap +33 -0
- package/lib/components/Main/index.ts +2 -0
- package/lib/components/NativeDatepicker/NativeDatepicker.stories.tsx +100 -0
- package/lib/components/{Datepicker/subcomponents → NativeDatepicker}/NativeDatepicker.tsx +14 -15
- package/lib/components/NativeDatepicker/NativeDatepicker.types.ts +19 -0
- package/lib/components/NativeDatepicker/index.ts +2 -0
- package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.ts +1 -1
- package/lib/components/NativeDatepicker/utils/index.ts +1 -0
- package/lib/components/Pagination/PaginationControls.tsx +55 -12
- package/lib/components/Pagination/PaginationInfo.tsx +5 -1
- package/lib/components/Paragraph/Paragraph.stories.tsx +1 -1
- package/lib/components/Search/Search.stories.tsx +1 -1
- package/lib/components/Search/Search.tsx +4 -1
- package/lib/components/Search/__tests__/Search.test.tsx +19 -1
- package/lib/components/Select/Select.mdx +169 -0
- package/lib/components/Select/Select.stories.tsx +191 -43
- package/lib/components/Select/Select.tsx +36 -12
- package/lib/components/Select/Select.types.ts +66 -48
- package/lib/components/Select/__tests__/Select.test.tsx +448 -7
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +1 -1
- package/lib/components/Select/subcomponents/CustomOption.tsx +2 -1
- package/lib/components/Select/subcomponents/CustomSelect.tsx +303 -33
- package/lib/components/Select/subcomponents/FilterInput.tsx +80 -0
- package/lib/components/Select/subcomponents/NativeSelect.tsx +13 -1
- package/lib/components/Select/subcomponents/VisibleField.tsx +11 -3
- package/lib/components/Select/subcomponents/index.tsx +1 -0
- package/lib/components/Snackbar/Snackbar.stories.tsx +1 -1
- package/lib/components/Spinner/Spinner.stories.tsx +1 -1
- package/lib/components/Textarea/Textarea.stories.tsx +1 -1
- package/lib/components/Timepicker/Timepicker.tsx +4 -0
- package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +2 -2
- package/lib/components/Toggle/Toggle.stories.tsx +1 -1
- package/lib/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/lib/components/WeekPicker/WeekPicker.stories.tsx +147 -0
- package/lib/components/WeekPicker/WeekPicker.tsx +2 -2
- package/lib/components/WeekPicker/WeekPicker.types.ts +21 -0
- package/lib/components/WeekPicker/index.ts +1 -0
- package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +1 -1
- package/lib/components/common/Common.mdx +1 -1
- package/lib/components/index.ts +11 -2
- package/lib/hooks/useFocusTrap.ts +40 -4
- package/lib/index.ts +1 -0
- package/lib/utils/__tests__/announce.test.ts +121 -0
- package/lib/utils/announce.ts +134 -0
- package/lib/utils/index.ts +1 -0
- package/package.json +3 -6
- package/dist/components/Datepicker/subcomponents/NativeDatepicker.d.ts +0 -6
- package/lib/components/Accordion/Accordion.stories.tsx.NOT_READY +0 -93
- /package/dist/components/{Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts → Main/__tests__/Main.test.d.ts} +0 -0
- /package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.test.ts +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { default as React, HTMLAttributes
|
|
2
|
-
export declare const NAME = "ucl-accordion__heading";
|
|
3
|
-
interface AccordionHeadingProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
-
as?: keyof
|
|
1
|
+
import { default as React, HTMLAttributes } from 'react';
|
|
2
|
+
export declare const NAME = "ucl-uikit-accordion__heading";
|
|
3
|
+
export interface AccordionHeadingProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
as?: keyof HTMLElementTagNameMap;
|
|
5
5
|
testId?: string;
|
|
6
6
|
}
|
|
7
7
|
declare const AccordionHeading: React.FC<AccordionHeadingProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, HTMLAttributes } from 'react';
|
|
2
|
-
export declare const NAME = "ucl-accordion__panel";
|
|
3
|
-
interface AccordionPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
export declare const NAME = "ucl-uikit-accordion__panel";
|
|
3
|
+
export interface AccordionPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
testId?: string;
|
|
5
5
|
}
|
|
6
6
|
declare const AccordionPanel: React.FC<AccordionPanelProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React, HTMLAttributes } from 'react';
|
|
2
2
|
import { default as AccordionHeading } from './Accordion.Heading';
|
|
3
3
|
import { default as AccordionPanel } from './Accordion.Panel';
|
|
4
|
-
export declare const NAME = "ucl-accordion";
|
|
4
|
+
export declare const NAME = "ucl-uikit-accordion";
|
|
5
5
|
interface AccordionContextProps {
|
|
6
6
|
isOpen: boolean;
|
|
7
7
|
toggleAccordion: () => void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').FC<import('./Accordion').AccordionProps> & {
|
|
5
|
+
Heading: import('react').FC<import('./Accordion.Heading').AccordionHeadingProps>;
|
|
6
|
+
Panel: import('react').FC<import('./Accordion.Panel').AccordionPanelProps>;
|
|
7
|
+
};
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: string;
|
|
10
|
+
};
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: {
|
|
13
|
+
options: string[];
|
|
14
|
+
control: {
|
|
15
|
+
type: "select";
|
|
16
|
+
};
|
|
17
|
+
type: "string";
|
|
18
|
+
};
|
|
19
|
+
disabled: {
|
|
20
|
+
control: {
|
|
21
|
+
type: "boolean";
|
|
22
|
+
};
|
|
23
|
+
type: "boolean";
|
|
24
|
+
};
|
|
25
|
+
isOpen: {
|
|
26
|
+
control: {
|
|
27
|
+
type: "boolean";
|
|
28
|
+
};
|
|
29
|
+
type: "boolean";
|
|
30
|
+
};
|
|
31
|
+
testId: {
|
|
32
|
+
control: {
|
|
33
|
+
type: "text";
|
|
34
|
+
};
|
|
35
|
+
type: "string";
|
|
36
|
+
};
|
|
37
|
+
className: {
|
|
38
|
+
control: {
|
|
39
|
+
type: "text";
|
|
40
|
+
};
|
|
41
|
+
type: "string";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
args: {
|
|
45
|
+
isOpen: false;
|
|
46
|
+
disabled: false;
|
|
47
|
+
size: "medium";
|
|
48
|
+
};
|
|
49
|
+
tags: string[];
|
|
50
|
+
};
|
|
51
|
+
export default meta;
|
|
52
|
+
type Story = StoryObj<typeof meta>;
|
|
53
|
+
export declare const Default: Story;
|
|
54
|
+
export declare const Disabled: Story;
|
|
55
|
+
export declare const SmallSize: Story;
|
|
56
|
+
export declare const CustomHeadingElement: Story;
|
|
57
|
+
export declare const MultipleAccordions: Story;
|
|
@@ -1,7 +1,110 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { AvatarProps } from './Avatar';
|
|
3
|
+
type AvatarSize = NonNullable<AvatarProps['size']>;
|
|
2
4
|
declare const meta: {
|
|
3
5
|
title: string;
|
|
4
|
-
component: import('react').NamedExoticComponent<
|
|
6
|
+
component: import('react').NamedExoticComponent<AvatarProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
description: string;
|
|
13
|
+
options: string[];
|
|
14
|
+
control: {
|
|
15
|
+
type: "select";
|
|
16
|
+
};
|
|
17
|
+
table: {
|
|
18
|
+
type: {
|
|
19
|
+
summary: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
imageUrl: {
|
|
24
|
+
description: string;
|
|
25
|
+
control: {
|
|
26
|
+
type: "text";
|
|
27
|
+
};
|
|
28
|
+
table: {
|
|
29
|
+
type: {
|
|
30
|
+
summary: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
name: {
|
|
35
|
+
description: string;
|
|
36
|
+
control: {
|
|
37
|
+
type: "text";
|
|
38
|
+
};
|
|
39
|
+
table: {
|
|
40
|
+
type: {
|
|
41
|
+
summary: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
size: {
|
|
46
|
+
description: string;
|
|
47
|
+
options: AvatarSize[];
|
|
48
|
+
control: {
|
|
49
|
+
type: "inline-radio";
|
|
50
|
+
};
|
|
51
|
+
table: {
|
|
52
|
+
type: {
|
|
53
|
+
summary: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
disabled: {
|
|
58
|
+
description: string;
|
|
59
|
+
control: {
|
|
60
|
+
type: "boolean";
|
|
61
|
+
};
|
|
62
|
+
table: {
|
|
63
|
+
type: {
|
|
64
|
+
summary: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
testId: {
|
|
69
|
+
description: string;
|
|
70
|
+
control: {
|
|
71
|
+
type: "text";
|
|
72
|
+
};
|
|
73
|
+
table: {
|
|
74
|
+
type: {
|
|
75
|
+
summary: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
className: {
|
|
80
|
+
description: string;
|
|
81
|
+
control: {
|
|
82
|
+
type: "text";
|
|
83
|
+
};
|
|
84
|
+
table: {
|
|
85
|
+
type: {
|
|
86
|
+
summary: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
onClick: {
|
|
91
|
+
description: string;
|
|
92
|
+
action: string;
|
|
93
|
+
table: {
|
|
94
|
+
type: {
|
|
95
|
+
summary: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
args: {
|
|
101
|
+
variant: "image";
|
|
102
|
+
imageUrl: string;
|
|
103
|
+
name: string;
|
|
104
|
+
size: 56;
|
|
105
|
+
disabled: false;
|
|
106
|
+
};
|
|
107
|
+
tags: string[];
|
|
5
108
|
};
|
|
6
109
|
export default meta;
|
|
7
110
|
type Story = StoryObj<typeof meta>;
|
|
@@ -9,3 +112,6 @@ export declare const Default: Story;
|
|
|
9
112
|
export declare const Image: Story;
|
|
10
113
|
export declare const Initials: Story;
|
|
11
114
|
export declare const Icon: Story;
|
|
115
|
+
export declare const Sizes: Story;
|
|
116
|
+
export declare const Disabled: Story;
|
|
117
|
+
export declare const BrokenImageFallback: Story;
|
|
@@ -17,6 +17,7 @@ export interface ButtonBaseProps {
|
|
|
17
17
|
export type ButtonProps<C extends ElementType = 'button'> = {
|
|
18
18
|
as?: C;
|
|
19
19
|
ref?: PolymorphicRef<C>;
|
|
20
|
+
className?: string;
|
|
20
21
|
} & ButtonBaseProps & MarginProps & Omit<ComponentPropsWithRef<C>, keyof ButtonBaseProps | 'as'>;
|
|
21
22
|
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;
|
|
22
23
|
declare const MemoizedButton: typeof Button;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Calendar';
|
|
2
|
-
export type { CalendarProps, CalendarEvent, AcademicWeek
|
|
2
|
+
export type { CalendarProps, CalendarEvent, AcademicWeek } from './Calendar.types';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DatepickerProps } from './Datepicker.types';
|
|
2
|
-
declare const Datepicker: ({ value, onValueChange, minDate, maxDate, disabled, className,
|
|
2
|
+
declare const Datepicker: ({ value, onValueChange, minDate, maxDate, disabled, className, clearable, ...props }: DatepickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Datepicker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ value, onValueChange, minDate, maxDate, disabled, className,
|
|
4
|
+
component: ({ value, onValueChange, minDate, maxDate, disabled, className, clearable, ...props }: import('./Datepicker.types').DatepickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
parameters: {
|
|
6
6
|
layout: string;
|
|
7
7
|
};
|
|
@@ -26,7 +26,7 @@ declare const meta: {
|
|
|
26
26
|
type: "boolean";
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
clearable: {
|
|
30
30
|
control: {
|
|
31
31
|
type: "boolean";
|
|
32
32
|
};
|
|
@@ -42,7 +42,8 @@ declare const meta: {
|
|
|
42
42
|
export default meta;
|
|
43
43
|
type Story = StoryObj<typeof meta>;
|
|
44
44
|
export declare const Default: Story;
|
|
45
|
+
export declare const InAField: Story;
|
|
45
46
|
export declare const WithEvents: Story;
|
|
46
47
|
export declare const WithAcademicWeeks: Story;
|
|
47
48
|
export declare const MinMaxDates: Story;
|
|
48
|
-
export declare const
|
|
49
|
+
export declare const Clearable: Story;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLAttributes, RefObject } from 'react';
|
|
2
2
|
import { CalendarEvent, AcademicWeek } from '../Calendar';
|
|
3
|
+
import { InputProps } from './subcomponents/DatepickerInput';
|
|
3
4
|
export type DatepickerValue = Date | null;
|
|
4
5
|
interface BaseDatepickerProps {
|
|
5
6
|
value?: DatepickerValue;
|
|
@@ -11,13 +12,11 @@ interface BaseDatepickerProps {
|
|
|
11
12
|
academicWeeks?: AcademicWeek[];
|
|
12
13
|
testId?: string;
|
|
13
14
|
disabled?: boolean;
|
|
15
|
+
clearable?: boolean;
|
|
14
16
|
ref?: RefObject<HTMLDivElement>;
|
|
15
17
|
inputRef?: RefObject<HTMLInputElement>;
|
|
18
|
+
inputProps?: InputProps;
|
|
16
19
|
}
|
|
17
|
-
type NativeDatepickerAttributeProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'min' | 'max' | 'className' | 'disabled'>;
|
|
18
20
|
export interface DatepickerProps extends BaseDatepickerProps, HTMLAttributes<HTMLDivElement> {
|
|
19
|
-
native?: boolean;
|
|
20
|
-
nativeHTMLAttributes?: NativeDatepickerAttributeProps;
|
|
21
|
-
nativeRef?: RefObject<HTMLInputElement>;
|
|
22
21
|
}
|
|
23
22
|
export {};
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { DatepickerValue } from '../Datepicker.types';
|
|
2
2
|
import { CalendarEvent, AcademicWeek } from '../../Calendar';
|
|
3
|
+
import { InputProps } from './DatepickerInput';
|
|
3
4
|
interface CustomDatepickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
5
|
value?: DatepickerValue;
|
|
5
6
|
onValueChange?: (value: DatepickerValue, event?: React.SyntheticEvent) => void;
|
|
6
7
|
minDate?: string | null;
|
|
7
8
|
maxDate?: string | null;
|
|
8
9
|
disabled?: boolean;
|
|
10
|
+
clearable?: boolean;
|
|
9
11
|
events?: CalendarEvent[];
|
|
10
12
|
showAcademicWeeks?: boolean;
|
|
11
13
|
academicWeeks?: AcademicWeek[];
|
|
12
14
|
testId?: string;
|
|
13
15
|
ref?: React.RefObject<HTMLDivElement>;
|
|
14
16
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
17
|
+
inputProps?: InputProps;
|
|
15
18
|
}
|
|
16
|
-
declare const CustomDatepicker: ({ value, onValueChange, minDate, maxDate, disabled, events, showAcademicWeeks, academicWeeks, testId, className, ref, inputRef, ...props }: CustomDatepickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const CustomDatepicker: ({ value, onValueChange, minDate, maxDate, disabled, clearable, events, showAcademicWeeks, academicWeeks, testId, className, ref, inputRef, inputProps, ...props }: CustomDatepickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
20
|
export default CustomDatepicker;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* HTML attributes that consumers can pass to the underlying `<input>` via the
|
|
3
|
+
* `inputProps` prop on `<Datepicker>`.
|
|
4
|
+
*
|
|
5
|
+
* Controlled and internally-managed attributes are omitted to prevent conflicts.
|
|
6
|
+
*/
|
|
7
|
+
export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'onKeyDown' | 'onFocus' | 'disabled' | 'type'> & {
|
|
8
|
+
testId?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Internal props for `<DatepickerInput>`, combining consumer-facing
|
|
12
|
+
* input attributes with controlled props managed by `<VisibleField>`.
|
|
13
|
+
*/
|
|
14
|
+
interface DatepickerInputProps extends InputProps {
|
|
2
15
|
value: string;
|
|
3
16
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
4
17
|
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
@@ -6,5 +19,5 @@ interface DatepickerInputProps {
|
|
|
6
19
|
disabled: boolean;
|
|
7
20
|
ref: React.RefObject<HTMLInputElement | null>;
|
|
8
21
|
}
|
|
9
|
-
declare const DatepickerInput: ({
|
|
22
|
+
declare const DatepickerInput: ({ disabled, placeholder, inputMode, testId, className, ...props }: DatepickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
23
|
export default DatepickerInput;
|
|
@@ -2,5 +2,5 @@ interface PanelProps {
|
|
|
2
2
|
zIndex?: number;
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
-
declare const Panel: ({ zIndex, children }: PanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const Panel: ({ zIndex, children, }: PanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default Panel;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { InputProps } from './DatepickerInput';
|
|
2
3
|
interface VisibleFieldProps {
|
|
3
4
|
inputValue: string;
|
|
4
5
|
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
6
|
onInputKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
6
7
|
onInputFocus: () => void;
|
|
7
8
|
onButtonClick: () => void;
|
|
9
|
+
onClear: (event: React.SyntheticEvent) => void;
|
|
8
10
|
disabled: boolean;
|
|
11
|
+
clearable?: boolean;
|
|
12
|
+
hasValue?: boolean;
|
|
9
13
|
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
14
|
+
inputProps: InputProps;
|
|
10
15
|
}
|
|
11
|
-
declare const VisibleField: ({ inputValue, onInputChange, onInputKeyDown, onInputFocus, onButtonClick, disabled, inputRef, }: VisibleFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const VisibleField: ({ inputValue, onInputChange, onInputKeyDown, onInputFocus, onButtonClick, onClear, disabled, clearable, hasValue, inputRef, inputProps, }: VisibleFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
17
|
export default VisibleField;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as CustomDatepicker } from './CustomDatepicker';
|
|
2
|
-
export { default as NativeDatepicker } from './NativeDatepicker';
|
|
3
2
|
export { default as VisibleField } from './VisibleField';
|
|
4
3
|
export { default as DatepickerInput } from './DatepickerInput';
|
|
5
4
|
export { default as Panel } from './Panel';
|
|
@@ -15,7 +15,8 @@ export interface BaseDialogProps extends HTMLAttributes<HTMLDialogElement> {
|
|
|
15
15
|
finalFocusRef?: React.RefObject<HTMLElement>;
|
|
16
16
|
disableFocusTrap?: boolean;
|
|
17
17
|
restoreFocus?: boolean;
|
|
18
|
+
skipCloseOnInitialFocus?: boolean;
|
|
18
19
|
testId?: string;
|
|
19
20
|
}
|
|
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>;
|
|
21
|
+
declare const _default: React.MemoExoticComponent<({ open, size, modal, closeOnClickOutside, closeOnClickOutsideStopPropagation, nonModalCloseOnEscape, onClose, className, children, initialFocusRef, finalFocusRef, disableFocusTrap, restoreFocus, skipCloseOnInitialFocus, testId, ...props }: BaseDialogProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
21
22
|
export default _default;
|
|
@@ -4,6 +4,8 @@ import { default as DialogBody } from './DialogBody';
|
|
|
4
4
|
import { default as DialogFooter } from './DialogFooter';
|
|
5
5
|
export declare const NAME = "ucl-uikit-dialog";
|
|
6
6
|
interface DialogContextValue {
|
|
7
|
+
dialogHeaderId?: string;
|
|
8
|
+
dialogBodyId?: string;
|
|
7
9
|
onClose?: (ev: React.MouseEvent) => void;
|
|
8
10
|
onSecondaryAction?: () => void;
|
|
9
11
|
onAction?: () => void;
|
|
@@ -10,9 +10,12 @@ export interface HeaderProps extends HTMLAttributes<HTMLElement> {
|
|
|
10
10
|
titleAs?: React.ElementType<React.HTMLAttributes<HTMLElement>>;
|
|
11
11
|
titleClassName?: string;
|
|
12
12
|
titleProps?: Record<string, unknown>;
|
|
13
|
+
homeLinkHref?: string;
|
|
14
|
+
homeLinkProps?: Record<string, unknown>;
|
|
15
|
+
homeLinkAriaLabel?: string;
|
|
13
16
|
testId?: string;
|
|
14
17
|
}
|
|
15
|
-
declare const MemoAppHeader: import('react').MemoExoticComponent<({ title, fixed, titleAs, titleClassName, titleProps, testId, className, children, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
18
|
+
declare const MemoAppHeader: import('react').MemoExoticComponent<({ title, fixed, titleAs, titleClassName, titleProps, homeLinkHref, homeLinkProps, homeLinkAriaLabel, testId, className, children, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
16
19
|
export interface IHeaderSubComponents {
|
|
17
20
|
Menu: typeof HeaderMenu;
|
|
18
21
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import('react').NamedExoticComponent<import('./Header').HeaderProps> & {
|
|
5
|
+
readonly type: ({ title, fixed, titleAs, titleClassName, titleProps, homeLinkHref, homeLinkProps, homeLinkAriaLabel, testId, className, children, ...props }: import('./Header').HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
} & import('./Header').IHeaderSubComponents;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
argTypes: {
|
|
11
|
+
title: {
|
|
12
|
+
control: "text";
|
|
13
|
+
};
|
|
14
|
+
fixed: {
|
|
15
|
+
control: "boolean";
|
|
16
|
+
};
|
|
17
|
+
homeLinkHref: {
|
|
18
|
+
control: "text";
|
|
19
|
+
};
|
|
20
|
+
homeLinkAriaLabel: {
|
|
21
|
+
control: "text";
|
|
22
|
+
};
|
|
23
|
+
className: {
|
|
24
|
+
control: "text";
|
|
25
|
+
};
|
|
26
|
+
children: {
|
|
27
|
+
control: false;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
args: {
|
|
31
|
+
title: string;
|
|
32
|
+
};
|
|
33
|
+
tags: string[];
|
|
34
|
+
};
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
export declare const Default: Story;
|
|
38
|
+
export declare const Fixed: Story;
|
|
39
|
+
export declare const WithHomeLink: Story;
|
|
40
|
+
export declare const WithMenu: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MainProps extends React.HTMLAttributes<HTMLElement> {
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether to wrap children in a `<Layout>` component,
|
|
4
|
+
* to apply the grid layout from the UCL Design System.
|
|
5
|
+
*/
|
|
6
|
+
layout?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* ID for testing purposes.
|
|
9
|
+
* Added to the `data-testid` attribute of top-level `<main>` element.
|
|
10
|
+
* Default is `'ucl-uikit-main'`.
|
|
11
|
+
*/
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const NAME = "ucl-uikit-main";
|
|
15
|
+
/**
|
|
16
|
+
* Semantic wrapper around HTML `<main>` element
|
|
17
|
+
*
|
|
18
|
+
* Optionally wraps children in the UCL Design System `Layout` grid when `layout` is true
|
|
19
|
+
*/
|
|
20
|
+
declare const Main: ({ layout, testId, className, children, ...props }: MainProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default Main;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { default as Main } from './Main';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ layout, testId, className, children, ...props }: import('./Main').MainProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof Main>;
|
|
13
|
+
export declare const Default: Story;
|
|
14
|
+
export declare const WithLayout: Story;
|
|
15
|
+
export declare const WithChildren: Story;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NativeDatepickerProps } from './NativeDatepicker.types';
|
|
2
|
+
declare const NativeDatepicker: ({ value, onValueChange, minDate, maxDate, className, disabled, testId, ref, ...props }: NativeDatepickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default NativeDatepicker;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ value, onValueChange, minDate, maxDate, className, disabled, testId, ref, ...props }: import('./NativeDatepicker.types').NativeDatepickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
argTypes: {
|
|
9
|
+
value: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "date";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
minDate: {
|
|
15
|
+
control: {
|
|
16
|
+
type: "date";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
maxDate: {
|
|
20
|
+
control: {
|
|
21
|
+
type: "date";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
disabled: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "boolean";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
tags: string[];
|
|
31
|
+
};
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof meta>;
|
|
34
|
+
export declare const Default: Story;
|
|
35
|
+
export declare const Disabled: Story;
|
|
36
|
+
export declare const WithMinMaxDates: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InputHTMLAttributes, RefObject } from 'react';
|
|
2
|
+
export type DatepickerValue = Date | null;
|
|
3
|
+
export interface NativeDatepickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'min' | 'max'> {
|
|
4
|
+
value?: DatepickerValue;
|
|
5
|
+
onValueChange?: (value: DatepickerValue, event?: React.SyntheticEvent) => void;
|
|
6
|
+
minDate?: string | null;
|
|
7
|
+
maxDate?: string | null;
|
|
8
|
+
testId?: string;
|
|
9
|
+
ref?: RefObject<HTMLInputElement>;
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a Date object to a `YYYY-MM-DD` string based on the user's local timezone.
|
|
3
3
|
*
|
|
4
|
-
* Used for passing dates to <NativeDatepicker>
|
|
4
|
+
* Used for passing dates to <NativeDatepicker>
|
|
5
5
|
*
|
|
6
6
|
* This function uses the Swedish (`sv-SE`) locale with `toLocaleDateString`
|
|
7
7
|
* as it conveniently defaults to the ISO 8601 `YYYY-MM-DD` format, while respecting
|
package/dist/components/NativeDatepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as dateToLocaleISOString } from './dateToLocaleISOString/dateToLocaleISOString';
|