uikit-react-public 0.11.24 → 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/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 +3 -1
- package/dist/components/Calendar/index.d.ts +1 -1
- package/dist/components/CookieNotice/CookieNotice.d.ts +16 -0
- package/dist/components/CookieNotice/index.d.ts +2 -0
- 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 +8 -2
- package/dist/components/Dialog/Dialog.d.ts +2 -0
- package/dist/components/FileInput/FileInput.d.ts +8 -0
- package/dist/components/FileInput/FileInput.stories.d.ts +16 -0
- package/dist/components/FileInput/index.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +7 -1
- package/dist/components/Header/Header.stories.d.ts +40 -0
- 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/Main/Main.d.ts +21 -0
- package/dist/components/Main/Main.stories.d.ts +15 -0
- package/dist/components/Main/__tests__/Main.test.d.ts +1 -0
- package/dist/components/Main/index.d.ts +2 -0
- 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/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/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 +157 -9
- package/dist/components/Select/Select.types.d.ts +66 -32
- package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -3
- 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/Panel.d.ts +1 -1
- package/dist/components/Select/subcomponents/VisibleField.d.ts +6 -4
- package/dist/components/Select/subcomponents/index.d.ts +1 -0
- 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/WeekPicker.stories.d.ts +41 -0
- package/dist/components/WeekPicker/WeekPicker.types.d.ts +16 -0
- package/dist/components/WeekPicker/index.d.ts +2 -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 +19 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useFocusTrap.d.ts +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6460 -4607
- package/dist/theme/defaultTheme.d.ts +7 -0
- package/dist/theme/useTheme.d.ts +14 -0
- package/dist/utils/__tests__/announce.test.d.ts +1 -0
- package/dist/utils/__tests__/capitalise.test.d.ts +1 -0
- package/dist/utils/announce.d.ts +6 -0
- package/dist/utils/capitalise.d.ts +2 -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/Alert/Alert.tsx +7 -1
- package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +4 -0
- package/lib/components/Avatar/Avatar.mdx +117 -0
- package/lib/components/Avatar/Avatar.stories.tsx +110 -2
- 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/Blanket/Blanket.stories.tsx +1 -1
- package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +4 -4
- package/lib/components/Button/Button.stories.tsx +1 -1
- package/lib/components/Button/Button.tsx +6 -2
- 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/Grid.tsx +0 -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/CookieNotice/CookieNotice.tsx +114 -0
- package/lib/components/CookieNotice/index.ts +2 -0
- 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 +55 -4
- 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 +161 -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/Footer.stories.tsx +1 -1
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +28 -28
- package/lib/components/Header/Header.mdx +52 -0
- package/lib/components/Header/Header.stories.tsx +98 -0
- package/lib/components/Header/Header.tsx +65 -3
- package/lib/components/Header/__tests__/Header.test.tsx +17 -1
- 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.stories.tsx +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/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/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/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/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/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 +56 -15
- package/lib/components/Pagination/PaginationInfo.tsx +5 -1
- package/lib/components/Paragraph/Paragraph.stories.tsx +1 -1
- package/lib/components/Search/Search.stories.tsx +41 -0
- package/lib/components/Search/Search.tsx +170 -0
- package/lib/components/Search/__tests__/Search.test.tsx +112 -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.mdx +169 -0
- package/lib/components/Select/Select.stories.tsx +198 -77
- package/lib/components/Select/Select.tsx +37 -13
- package/lib/components/Select/Select.types.ts +77 -54
- package/lib/components/Select/__tests__/Select.test.tsx +448 -7
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +3 -3
- package/lib/components/Select/subcomponents/CustomOption.tsx +24 -10
- package/lib/components/Select/subcomponents/CustomSelect.tsx +333 -52
- package/lib/components/Select/subcomponents/FilterInput.tsx +80 -0
- package/lib/components/Select/subcomponents/NativeSelect.tsx +13 -1
- package/lib/components/Select/subcomponents/Panel.tsx +4 -5
- package/lib/components/Select/subcomponents/VisibleField.tsx +36 -24
- 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/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/Textarea/Textarea.stories.tsx +1 -1
- package/lib/components/Timepicker/Timepicker.stories.tsx +43 -0
- package/lib/components/Timepicker/Timepicker.tsx +100 -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/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 +26 -0
- package/lib/components/WeekPicker/WeekPicker.types.ts +21 -0
- package/lib/components/WeekPicker/index.ts +2 -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/common/Common.mdx +1 -1
- package/lib/components/index.ts +28 -2
- package/lib/hooks/index.ts +2 -0
- package/lib/hooks/useFocusTrap.ts +159 -0
- package/lib/index.ts +2 -0
- package/lib/theme/defaultTheme.ts +7 -0
- package/lib/utils/__tests__/announce.test.ts +121 -0
- package/lib/utils/__tests__/capitalise.test.ts +40 -0
- package/lib/utils/announce.ts +134 -0
- package/lib/utils/capitalise.ts +4 -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/lib/components/Field/__tests__/__snapshots__/Field.test.tsx.snap +0 -300
- /package/dist/components/{Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts → FileInput/__tests__/FileInput.test.d.ts} +0 -0
- /package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.test.ts +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Input > snapshot: no props 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
class="ucl-uikit-fileinput css-r56yy"
|
|
6
|
+
>
|
|
7
|
+
<label
|
|
8
|
+
class="css-1lc9iag"
|
|
9
|
+
for="file-input-1"
|
|
10
|
+
>
|
|
11
|
+
<svg
|
|
12
|
+
class="ucl-uikit-icon css-148hpxb"
|
|
13
|
+
data-testid="ucl-uikit-icon"
|
|
14
|
+
fill="none"
|
|
15
|
+
height="24"
|
|
16
|
+
stroke="currentColor"
|
|
17
|
+
stroke-linecap="round"
|
|
18
|
+
stroke-linejoin="round"
|
|
19
|
+
stroke-width="2"
|
|
20
|
+
viewBox="0 0 24 24"
|
|
21
|
+
width="24"
|
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
>
|
|
24
|
+
<path
|
|
25
|
+
d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
|
|
26
|
+
/>
|
|
27
|
+
<polyline
|
|
28
|
+
points="17 8 12 3 7 8"
|
|
29
|
+
/>
|
|
30
|
+
<line
|
|
31
|
+
x1="12"
|
|
32
|
+
x2="12"
|
|
33
|
+
y1="3"
|
|
34
|
+
y2="15"
|
|
35
|
+
/>
|
|
36
|
+
</svg>
|
|
37
|
+
Upload File
|
|
38
|
+
</label>
|
|
39
|
+
<input
|
|
40
|
+
class="css-1w0w0g6"
|
|
41
|
+
data-testid="ucl-uikit-fileinput"
|
|
42
|
+
id="file-input-1"
|
|
43
|
+
type="file"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`Input > snapshot: value prop 1`] = `
|
|
49
|
+
<div
|
|
50
|
+
class="ucl-uikit-fileinput css-r56yy"
|
|
51
|
+
>
|
|
52
|
+
<label
|
|
53
|
+
class="css-1lc9iag"
|
|
54
|
+
for="file-input-1"
|
|
55
|
+
>
|
|
56
|
+
<svg
|
|
57
|
+
class="ucl-uikit-icon css-148hpxb"
|
|
58
|
+
data-testid="ucl-uikit-icon"
|
|
59
|
+
fill="none"
|
|
60
|
+
height="24"
|
|
61
|
+
stroke="currentColor"
|
|
62
|
+
stroke-linecap="round"
|
|
63
|
+
stroke-linejoin="round"
|
|
64
|
+
stroke-width="2"
|
|
65
|
+
viewBox="0 0 24 24"
|
|
66
|
+
width="24"
|
|
67
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
68
|
+
>
|
|
69
|
+
<path
|
|
70
|
+
d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
|
|
71
|
+
/>
|
|
72
|
+
<polyline
|
|
73
|
+
points="17 8 12 3 7 8"
|
|
74
|
+
/>
|
|
75
|
+
<line
|
|
76
|
+
x1="12"
|
|
77
|
+
x2="12"
|
|
78
|
+
y1="3"
|
|
79
|
+
y2="15"
|
|
80
|
+
/>
|
|
81
|
+
</svg>
|
|
82
|
+
Upload File/Image
|
|
83
|
+
</label>
|
|
84
|
+
<input
|
|
85
|
+
class="css-1w0w0g6"
|
|
86
|
+
data-testid="test123"
|
|
87
|
+
id="file-input-1"
|
|
88
|
+
type="file"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
`;
|
|
@@ -34,7 +34,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
34
34
|
>
|
|
35
35
|
<a
|
|
36
36
|
aria-label="Facebook"
|
|
37
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
37
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
38
38
|
data-testid="ucl-uikit-footer__social-link"
|
|
39
39
|
href="https://www.facebook.com/uclofficial/"
|
|
40
40
|
target="_blank"
|
|
@@ -60,7 +60,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
60
60
|
</a>
|
|
61
61
|
<a
|
|
62
62
|
aria-label="Flickr"
|
|
63
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
63
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
64
64
|
data-testid="ucl-uikit-footer__social-link"
|
|
65
65
|
href="https://www.flickr.com/groups/ucl/"
|
|
66
66
|
target="_blank"
|
|
@@ -89,7 +89,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
89
89
|
</a>
|
|
90
90
|
<a
|
|
91
91
|
aria-label="TikTok"
|
|
92
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
92
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
93
93
|
data-testid="ucl-uikit-footer__social-link"
|
|
94
94
|
href="https://www.tiktok.com/@uclofficial"
|
|
95
95
|
target="_blank"
|
|
@@ -115,7 +115,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
115
115
|
</a>
|
|
116
116
|
<a
|
|
117
117
|
aria-label="YouTube"
|
|
118
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
118
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
119
119
|
data-testid="ucl-uikit-footer__social-link"
|
|
120
120
|
href="https://www.youtube.com/ucltv"
|
|
121
121
|
target="_blank"
|
|
@@ -141,7 +141,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
141
141
|
</a>
|
|
142
142
|
<a
|
|
143
143
|
aria-label="SoundCloud"
|
|
144
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
144
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
145
145
|
data-testid="ucl-uikit-footer__social-link"
|
|
146
146
|
href="https://soundcloud.com/uclsound"
|
|
147
147
|
target="_blank"
|
|
@@ -169,7 +169,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
169
169
|
</a>
|
|
170
170
|
<a
|
|
171
171
|
aria-label="X social media platform"
|
|
172
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
172
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
173
173
|
data-testid="ucl-uikit-footer__social-link"
|
|
174
174
|
href="https://x.com/ucl"
|
|
175
175
|
target="_blank"
|
|
@@ -195,7 +195,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
195
195
|
</a>
|
|
196
196
|
<a
|
|
197
197
|
aria-label="Instagram"
|
|
198
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
198
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
199
199
|
data-testid="ucl-uikit-footer__social-link"
|
|
200
200
|
href="https://www.instagram.com/ucl/"
|
|
201
201
|
target="_blank"
|
|
@@ -247,7 +247,7 @@ exports[`Footer > snapshot: footer links provided 1`] = `
|
|
|
247
247
|
class="css-bq4k8p"
|
|
248
248
|
>
|
|
249
249
|
©
|
|
250
|
-
|
|
250
|
+
2026
|
|
251
251
|
UCL
|
|
252
252
|
</span>
|
|
253
253
|
</div>
|
|
@@ -316,14 +316,14 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
316
316
|
Category 1
|
|
317
317
|
</h3>
|
|
318
318
|
<a
|
|
319
|
-
class="ucl-link ucl-uikit-footer__nav-link css-
|
|
319
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__nav-link css-1v2y7lc"
|
|
320
320
|
data-testid="ucl-uikit-footer__nav-link"
|
|
321
321
|
href="#"
|
|
322
322
|
>
|
|
323
323
|
Item 1
|
|
324
324
|
</a>
|
|
325
325
|
<a
|
|
326
|
-
class="ucl-link ucl-uikit-footer__nav-link css-
|
|
326
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__nav-link css-1v2y7lc"
|
|
327
327
|
data-testid="ucl-uikit-footer__nav-link"
|
|
328
328
|
href="#"
|
|
329
329
|
>
|
|
@@ -340,14 +340,14 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
340
340
|
Category 2
|
|
341
341
|
</h3>
|
|
342
342
|
<a
|
|
343
|
-
class="ucl-link ucl-uikit-footer__nav-link css-
|
|
343
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__nav-link css-1v2y7lc"
|
|
344
344
|
data-testid="ucl-uikit-footer__nav-link"
|
|
345
345
|
href="#"
|
|
346
346
|
>
|
|
347
347
|
Item 1
|
|
348
348
|
</a>
|
|
349
349
|
<a
|
|
350
|
-
class="ucl-link ucl-uikit-footer__nav-link css-
|
|
350
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__nav-link css-1v2y7lc"
|
|
351
351
|
data-testid="ucl-uikit-footer__nav-link"
|
|
352
352
|
href="#"
|
|
353
353
|
>
|
|
@@ -378,7 +378,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
378
378
|
>
|
|
379
379
|
<a
|
|
380
380
|
aria-label="Facebook"
|
|
381
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
381
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
382
382
|
data-testid="ucl-uikit-footer__social-link"
|
|
383
383
|
href="https://www.facebook.com/uclofficial/"
|
|
384
384
|
target="_blank"
|
|
@@ -404,7 +404,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
404
404
|
</a>
|
|
405
405
|
<a
|
|
406
406
|
aria-label="Flickr"
|
|
407
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
407
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
408
408
|
data-testid="ucl-uikit-footer__social-link"
|
|
409
409
|
href="https://www.flickr.com/groups/ucl/"
|
|
410
410
|
target="_blank"
|
|
@@ -433,7 +433,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
433
433
|
</a>
|
|
434
434
|
<a
|
|
435
435
|
aria-label="TikTok"
|
|
436
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
436
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
437
437
|
data-testid="ucl-uikit-footer__social-link"
|
|
438
438
|
href="https://www.tiktok.com/@uclofficial"
|
|
439
439
|
target="_blank"
|
|
@@ -459,7 +459,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
459
459
|
</a>
|
|
460
460
|
<a
|
|
461
461
|
aria-label="YouTube"
|
|
462
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
462
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
463
463
|
data-testid="ucl-uikit-footer__social-link"
|
|
464
464
|
href="https://www.youtube.com/ucltv"
|
|
465
465
|
target="_blank"
|
|
@@ -485,7 +485,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
485
485
|
</a>
|
|
486
486
|
<a
|
|
487
487
|
aria-label="SoundCloud"
|
|
488
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
488
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
489
489
|
data-testid="ucl-uikit-footer__social-link"
|
|
490
490
|
href="https://soundcloud.com/uclsound"
|
|
491
491
|
target="_blank"
|
|
@@ -513,7 +513,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
513
513
|
</a>
|
|
514
514
|
<a
|
|
515
515
|
aria-label="X social media platform"
|
|
516
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
516
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
517
517
|
data-testid="ucl-uikit-footer__social-link"
|
|
518
518
|
href="https://x.com/ucl"
|
|
519
519
|
target="_blank"
|
|
@@ -539,7 +539,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
539
539
|
</a>
|
|
540
540
|
<a
|
|
541
541
|
aria-label="Instagram"
|
|
542
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
542
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
543
543
|
data-testid="ucl-uikit-footer__social-link"
|
|
544
544
|
href="https://www.instagram.com/ucl/"
|
|
545
545
|
target="_blank"
|
|
@@ -591,7 +591,7 @@ exports[`Footer > snapshot: nav links 1`] = `
|
|
|
591
591
|
class="css-bq4k8p"
|
|
592
592
|
>
|
|
593
593
|
©
|
|
594
|
-
|
|
594
|
+
2026
|
|
595
595
|
UCL
|
|
596
596
|
</span>
|
|
597
597
|
</div>
|
|
@@ -673,7 +673,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
673
673
|
>
|
|
674
674
|
<a
|
|
675
675
|
aria-label="Facebook"
|
|
676
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
676
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
677
677
|
data-testid="ucl-uikit-footer__social-link"
|
|
678
678
|
href="https://www.facebook.com/uclofficial/"
|
|
679
679
|
target="_blank"
|
|
@@ -699,7 +699,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
699
699
|
</a>
|
|
700
700
|
<a
|
|
701
701
|
aria-label="Flickr"
|
|
702
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
702
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
703
703
|
data-testid="ucl-uikit-footer__social-link"
|
|
704
704
|
href="https://www.flickr.com/groups/ucl/"
|
|
705
705
|
target="_blank"
|
|
@@ -728,7 +728,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
728
728
|
</a>
|
|
729
729
|
<a
|
|
730
730
|
aria-label="TikTok"
|
|
731
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
731
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
732
732
|
data-testid="ucl-uikit-footer__social-link"
|
|
733
733
|
href="https://www.tiktok.com/@uclofficial"
|
|
734
734
|
target="_blank"
|
|
@@ -754,7 +754,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
754
754
|
</a>
|
|
755
755
|
<a
|
|
756
756
|
aria-label="YouTube"
|
|
757
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
757
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
758
758
|
data-testid="ucl-uikit-footer__social-link"
|
|
759
759
|
href="https://www.youtube.com/ucltv"
|
|
760
760
|
target="_blank"
|
|
@@ -780,7 +780,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
780
780
|
</a>
|
|
781
781
|
<a
|
|
782
782
|
aria-label="SoundCloud"
|
|
783
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
783
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
784
784
|
data-testid="ucl-uikit-footer__social-link"
|
|
785
785
|
href="https://soundcloud.com/uclsound"
|
|
786
786
|
target="_blank"
|
|
@@ -808,7 +808,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
808
808
|
</a>
|
|
809
809
|
<a
|
|
810
810
|
aria-label="X social media platform"
|
|
811
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
811
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
812
812
|
data-testid="ucl-uikit-footer__social-link"
|
|
813
813
|
href="https://x.com/ucl"
|
|
814
814
|
target="_blank"
|
|
@@ -834,7 +834,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
834
834
|
</a>
|
|
835
835
|
<a
|
|
836
836
|
aria-label="Instagram"
|
|
837
|
-
class="ucl-link ucl-uikit-footer__social-link css-
|
|
837
|
+
class="ucl-uikit-base-link ucl-uikit-link ucl-uikit-footer__social-link css-1neoh67"
|
|
838
838
|
data-testid="ucl-uikit-footer__social-link"
|
|
839
839
|
href="https://www.instagram.com/ucl/"
|
|
840
840
|
target="_blank"
|
|
@@ -886,7 +886,7 @@ exports[`Footer > snapshot: no nav links 1`] = `
|
|
|
886
886
|
class="css-bq4k8p"
|
|
887
887
|
>
|
|
888
888
|
©
|
|
889
|
-
|
|
889
|
+
2026
|
|
890
890
|
UCL
|
|
891
891
|
</span>
|
|
892
892
|
</div>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as HeaderStories from "./Header.stories";
|
|
2
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from "@storybook/blocks";
|
|
3
|
+
|
|
4
|
+
export const usage = {
|
|
5
|
+
default: `<Header title='App Name' />`,
|
|
6
|
+
homeLink: `<Header title='App Name' homeLinkHref='/' homeLinkAriaLabel='Go to home' />`,
|
|
7
|
+
menu: `<Header title='App Name' homeLinkHref='/'>
|
|
8
|
+
<Header.Menu>
|
|
9
|
+
<Menu title='App Name'>
|
|
10
|
+
<Menu.Section>
|
|
11
|
+
<Menu.Item icon={<Icon.Home size={20} />}>Home Page</Menu.Item>
|
|
12
|
+
<Menu.Item icon={<Icon.Tool size={20} />}>Tools</Menu.Item>
|
|
13
|
+
</Menu.Section>
|
|
14
|
+
</Menu>
|
|
15
|
+
</Header.Menu>
|
|
16
|
+
</Header>`,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
<Meta of={HeaderStories} />
|
|
20
|
+
<Title />
|
|
21
|
+
<Subtitle>A simple header with optional menu and home link support.</Subtitle>
|
|
22
|
+
|
|
23
|
+
Use `<Header>` to display the UCL logo and app title at the top of a page. Pass
|
|
24
|
+
`homeLinkHref` to make the logo/title clickable, and wrap a menu in `<Header.Menu>`
|
|
25
|
+
to add a menu button on the right.
|
|
26
|
+
|
|
27
|
+
<Canvas source={{ code: usage.default }} />
|
|
28
|
+
|
|
29
|
+
## Home link
|
|
30
|
+
|
|
31
|
+
Add `homeLinkHref` (and optionally `homeLinkAriaLabel`) to make the logo/title act as a home link.
|
|
32
|
+
For client routing, pass your router link through `homeLinkProps` (e.g. `homeLinkProps={{ component: RouterLink }}`, with `import { Link as RouterLink } from 'react-router-dom'` or `'wouter'`).
|
|
33
|
+
|
|
34
|
+
<Canvas of={HeaderStories.WithHomeLink} source={{ code: usage.homeLink }} />
|
|
35
|
+
|
|
36
|
+
## Menu
|
|
37
|
+
|
|
38
|
+
Wrap a `Menu` inside `Header.Menu` to show a menu button on the right.
|
|
39
|
+
|
|
40
|
+
<Canvas of={HeaderStories.WithMenu} source={{ code: usage.menu }} />
|
|
41
|
+
|
|
42
|
+
## Fixed header
|
|
43
|
+
|
|
44
|
+
Use `fixed` to pin the header to the top of the viewport.
|
|
45
|
+
|
|
46
|
+
<Canvas of={HeaderStories.Fixed} />
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
Full props specification for `<Header>` is below.
|
|
50
|
+
<Canvas source={{ code: usage.default }} />
|
|
51
|
+
You can use the controls below to manipulate the `<Header>` component above.
|
|
52
|
+
<Controls />
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Header from './Header';
|
|
3
|
+
import Menu from '../Menu';
|
|
4
|
+
import Icon from '../Icon';
|
|
5
|
+
|
|
6
|
+
const storyWrapperStyle: React.CSSProperties = { minHeight: 400 };
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Components/Header',
|
|
10
|
+
component: Header,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'fullscreen',
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
title: { control: 'text' },
|
|
16
|
+
fixed: { control: 'boolean' },
|
|
17
|
+
homeLinkHref: { control: 'text' },
|
|
18
|
+
homeLinkAriaLabel: { control: 'text' },
|
|
19
|
+
className: { control: 'text' },
|
|
20
|
+
children: { control: false },
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
title: 'App Name',
|
|
24
|
+
},
|
|
25
|
+
tags: ['autodocs'],
|
|
26
|
+
} satisfies Meta<typeof Header>;
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
render: (args) => (
|
|
33
|
+
<div style={{ overflow: 'hidden' }}>
|
|
34
|
+
<Header {...args} />
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Fixed: Story = {
|
|
40
|
+
render: (args) => (
|
|
41
|
+
<div
|
|
42
|
+
style={{
|
|
43
|
+
height: '240px',
|
|
44
|
+
overflowY: 'auto',
|
|
45
|
+
position: 'relative',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<Header
|
|
49
|
+
{...args}
|
|
50
|
+
fixed
|
|
51
|
+
title='App Name'
|
|
52
|
+
/>
|
|
53
|
+
<div
|
|
54
|
+
style={{
|
|
55
|
+
paddingTop: '88px', // keep content below the fixed header
|
|
56
|
+
height: '600px',
|
|
57
|
+
margin: '0 16px',
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
Scroll inside this panel; the header should stay fixed to the top of the
|
|
61
|
+
viewport.
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const WithHomeLink: Story = {
|
|
68
|
+
name: 'With home link',
|
|
69
|
+
render: (args) => (
|
|
70
|
+
<div style={{ overflow: 'hidden' }}>
|
|
71
|
+
<Header {...args} />
|
|
72
|
+
</div>
|
|
73
|
+
),
|
|
74
|
+
args: {
|
|
75
|
+
homeLinkHref: '/',
|
|
76
|
+
homeLinkAriaLabel: 'Go to home',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const WithMenu: Story = {
|
|
81
|
+
render: (args) => (
|
|
82
|
+
<div style={storyWrapperStyle}>
|
|
83
|
+
<Header {...args}>
|
|
84
|
+
<Header.Menu>
|
|
85
|
+
<Menu title='App Name'>
|
|
86
|
+
<Menu.Section>
|
|
87
|
+
<Menu.Item icon={<Icon.Home size={20} />}>Home Page</Menu.Item>
|
|
88
|
+
<Menu.Item icon={<Icon.Tool size={20} />}>Tools</Menu.Item>
|
|
89
|
+
</Menu.Section>
|
|
90
|
+
<Menu.Section>
|
|
91
|
+
<Menu.Item icon={<Icon.Settings size={20} />}>Settings</Menu.Item>
|
|
92
|
+
</Menu.Section>
|
|
93
|
+
</Menu>
|
|
94
|
+
</Header.Menu>
|
|
95
|
+
</Header>
|
|
96
|
+
</div>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
@@ -3,6 +3,7 @@ import { css, cx } from '@emotion/css';
|
|
|
3
3
|
import { useTheme } from '../..';
|
|
4
4
|
import UclLogo from '../UclLogo/UclLogo';
|
|
5
5
|
import HeaderMenu from './HeaderMenu';
|
|
6
|
+
import Link from '../Link';
|
|
6
7
|
|
|
7
8
|
export const NAME = 'ucl-uikit-header';
|
|
8
9
|
export const HEADER_DESKTOP_HEIGHT_PX = 72;
|
|
@@ -12,12 +13,24 @@ export const DEFAULT_Z_INDEX = 3;
|
|
|
12
13
|
export interface HeaderProps extends HTMLAttributes<HTMLElement> {
|
|
13
14
|
title?: string;
|
|
14
15
|
fixed?: boolean;
|
|
16
|
+
titleAs?: React.ElementType<React.HTMLAttributes<HTMLElement>>;
|
|
17
|
+
titleClassName?: string;
|
|
18
|
+
titleProps?: Record<string, unknown>;
|
|
19
|
+
homeLinkHref?: string;
|
|
20
|
+
homeLinkProps?: Record<string, unknown>;
|
|
21
|
+
homeLinkAriaLabel?: string;
|
|
15
22
|
testId?: string;
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
const Header = ({
|
|
19
26
|
title,
|
|
20
27
|
fixed = false,
|
|
28
|
+
titleAs = 'div',
|
|
29
|
+
titleClassName,
|
|
30
|
+
titleProps,
|
|
31
|
+
homeLinkHref,
|
|
32
|
+
homeLinkProps,
|
|
33
|
+
homeLinkAriaLabel = 'Go to homepage',
|
|
21
34
|
testId = NAME,
|
|
22
35
|
className,
|
|
23
36
|
children,
|
|
@@ -68,7 +81,7 @@ const Header = ({
|
|
|
68
81
|
}
|
|
69
82
|
`;
|
|
70
83
|
|
|
71
|
-
const
|
|
84
|
+
const titleBaseStyle = css`
|
|
72
85
|
display: none;
|
|
73
86
|
margin: 0;
|
|
74
87
|
font-size: ${theme.font.size.f18};
|
|
@@ -80,14 +93,63 @@ const Header = ({
|
|
|
80
93
|
}
|
|
81
94
|
`;
|
|
82
95
|
|
|
96
|
+
const linkStyle = css`
|
|
97
|
+
color: inherit;
|
|
98
|
+
text-decoration: none;
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: 8px;
|
|
102
|
+
&:visited {
|
|
103
|
+
color: inherit;
|
|
104
|
+
}
|
|
105
|
+
&:hover {
|
|
106
|
+
color: inherit;
|
|
107
|
+
}
|
|
108
|
+
&:active {
|
|
109
|
+
color: inherit;
|
|
110
|
+
}
|
|
111
|
+
&:focus-visible {
|
|
112
|
+
outline: none;
|
|
113
|
+
box-shadow: ${theme.boxShadow.focus};
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
const titleStyle = cx(titleBaseStyle, titleClassName);
|
|
118
|
+
|
|
119
|
+
const TitleComponent = titleAs;
|
|
120
|
+
|
|
121
|
+
const headerContent = (
|
|
122
|
+
<>
|
|
123
|
+
<UclLogo className={uclLogoStyle} />
|
|
124
|
+
{title && (
|
|
125
|
+
<TitleComponent
|
|
126
|
+
className={titleStyle}
|
|
127
|
+
{...titleProps}
|
|
128
|
+
>
|
|
129
|
+
{title}
|
|
130
|
+
</TitleComponent>
|
|
131
|
+
)}
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
|
|
83
135
|
return (
|
|
84
136
|
<header
|
|
85
137
|
className={style}
|
|
86
138
|
data-testid={testId}
|
|
87
139
|
{...props}
|
|
88
140
|
>
|
|
89
|
-
|
|
90
|
-
|
|
141
|
+
{homeLinkHref ? (
|
|
142
|
+
<Link
|
|
143
|
+
href={homeLinkHref}
|
|
144
|
+
aria-label={homeLinkAriaLabel}
|
|
145
|
+
className={linkStyle}
|
|
146
|
+
{...homeLinkProps}
|
|
147
|
+
>
|
|
148
|
+
{headerContent}
|
|
149
|
+
</Link>
|
|
150
|
+
) : (
|
|
151
|
+
headerContent
|
|
152
|
+
)}
|
|
91
153
|
|
|
92
154
|
{children}
|
|
93
155
|
</header>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import Header from '../Header';
|
|
4
4
|
import { ThemeContextProvider } from '../../../theme/useTheme';
|
|
5
5
|
|
|
@@ -23,4 +23,20 @@ describe('Header', () => {
|
|
|
23
23
|
);
|
|
24
24
|
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
test('wraps logo/title in a home link when homeLinkHref is provided', () => {
|
|
28
|
+
render(
|
|
29
|
+
<ThemeContextProvider>
|
|
30
|
+
<Header
|
|
31
|
+
title='LIDS'
|
|
32
|
+
homeLinkHref='/'
|
|
33
|
+
homeLinkAriaLabel='Go home'
|
|
34
|
+
/>
|
|
35
|
+
</ThemeContextProvider>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const link = screen.getByLabelText('Go home');
|
|
39
|
+
expect(link).toBeInTheDocument();
|
|
40
|
+
expect(link.getAttribute('href')).toBe('/');
|
|
41
|
+
});
|
|
26
42
|
});
|