uikit-react-public 0.11.20 → 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/Calendar/Calendar.d.ts +3 -0
- package/dist/components/Calendar/Calendar.stories.d.ts +42 -0
- package/dist/components/Calendar/Calendar.types.d.ts +18 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/subcomponents/AcademicWeeks.d.ts +7 -0
- package/dist/components/Calendar/subcomponents/ColumnHeading.d.ts +7 -0
- package/dist/components/Calendar/subcomponents/Controls.d.ts +6 -0
- package/dist/components/{Datepicker/subcomponents/Day → Calendar/subcomponents}/Day.d.ts +3 -3
- package/dist/components/{Datepicker → Calendar}/subcomponents/EventDot.d.ts +2 -2
- package/dist/components/Calendar/subcomponents/Grid.d.ts +11 -0
- package/dist/components/Calendar/subcomponents/index.d.ts +7 -0
- package/dist/components/{Datepicker → Calendar}/utils/getAcademicWeekNumbers/getAcademicWeekNumbers.d.ts +1 -1
- package/dist/components/Calendar/utils/index.d.ts +4 -0
- package/dist/components/Calendar/utils/normaliseMonth/normaliseMonth.d.ts +9 -0
- package/dist/components/Calendar/utils/parseDateFromString/parseDateFromString.d.ts +9 -0
- package/dist/components/Calendar/utils/parseDateFromString/parseDateFromString.test.d.ts +1 -0
- 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 +3 -16
- package/dist/components/Datepicker/Datepicker.stories.d.ts +9 -3
- package/dist/components/Datepicker/Datepicker.types.d.ts +23 -7
- package/dist/components/Datepicker/index.d.ts +1 -2
- package/dist/components/Datepicker/subcomponents/CustomDatepicker.d.ts +17 -0
- package/dist/components/Datepicker/subcomponents/DatepickerInput.d.ts +10 -0
- package/dist/components/Datepicker/subcomponents/NativeDatepicker.d.ts +6 -0
- package/dist/components/Datepicker/subcomponents/Panel.d.ts +6 -0
- package/dist/components/Datepicker/subcomponents/VisibleField.d.ts +12 -0
- package/dist/components/Datepicker/subcomponents/index.d.ts +5 -7
- package/dist/components/Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.d.ts +17 -0
- package/dist/components/Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts +1 -0
- package/dist/components/Datepicker/utils/index.d.ts +2 -3
- package/dist/components/Datepicker/utils/parseInputValue/parseInputValue.d.ts +11 -0
- package/dist/components/Datepicker/utils/parseInputValue/parseInputValue.test.d.ts +1 -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/Footer/Footer.d.ts +1 -1
- 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/Menu.d.ts +2 -1
- package/dist/components/Menu/MenuContent.d.ts +2 -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 +13 -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 +6006 -4599
- 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/Calendar.stories.tsx +209 -0
- package/lib/components/Calendar/Calendar.tsx +121 -0
- package/lib/components/Calendar/Calendar.types.ts +21 -0
- package/lib/components/Calendar/__tests__/Calendar.test.tsx +71 -0
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +1218 -0
- package/lib/components/Calendar/index.ts +6 -0
- package/lib/components/{Datepicker → Calendar}/subcomponents/AcademicWeek.tsx +1 -1
- package/lib/components/{Datepicker → Calendar}/subcomponents/AcademicWeeks.tsx +9 -7
- package/lib/components/Calendar/subcomponents/ColumnHeading.tsx +40 -0
- package/lib/components/{Datepicker/subcomponents/MonthSelector/MonthSelector.tsx → Calendar/subcomponents/Controls.tsx} +17 -17
- package/lib/components/{Datepicker/subcomponents/Day → Calendar/subcomponents}/Day.stories.tsx +8 -8
- package/lib/components/{Datepicker/subcomponents/Day → Calendar/subcomponents}/Day.tsx +28 -16
- package/lib/components/{Datepicker → Calendar}/subcomponents/EventDot.tsx +3 -3
- package/lib/components/Calendar/subcomponents/Grid.tsx +116 -0
- package/lib/components/Calendar/subcomponents/index.ts +7 -0
- package/lib/components/{Datepicker → Calendar}/utils/getAcademicWeekNumbers/getAcademicWeekNumbers.test.ts +1 -1
- package/lib/components/{Datepicker → Calendar}/utils/getAcademicWeekNumbers/getAcademicWeekNumbers.ts +1 -1
- package/lib/components/{Datepicker → Calendar}/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.test.ts +29 -65
- package/lib/components/{Datepicker → Calendar}/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.ts +11 -43
- package/lib/components/Calendar/utils/index.ts +4 -0
- package/lib/components/Calendar/utils/normaliseMonth/normaliseMonth.test.ts +40 -0
- package/lib/components/Calendar/utils/normaliseMonth/normaliseMonth.ts +16 -0
- package/lib/components/Calendar/utils/parseDateFromString/parseDateFromString.test.ts +15 -0
- package/lib/components/Calendar/utils/parseDateFromString/parseDateFromString.ts +19 -0
- package/lib/components/CookieNotice/CookieNotice.tsx +114 -0
- package/lib/components/CookieNotice/index.ts +2 -0
- package/lib/components/Datepicker/Datepicker.stories.tsx +128 -64
- package/lib/components/Datepicker/Datepicker.tsx +34 -114
- package/lib/components/Datepicker/Datepicker.types.ts +38 -9
- package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +53 -112
- package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +92 -747
- package/lib/components/Datepicker/index.ts +1 -2
- package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +209 -0
- package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +74 -0
- package/lib/components/Datepicker/subcomponents/NativeDatepicker.tsx +70 -0
- package/lib/components/Datepicker/subcomponents/Panel.tsx +32 -0
- package/lib/components/Datepicker/subcomponents/VisibleField.tsx +104 -0
- package/lib/components/Datepicker/subcomponents/index.ts +5 -7
- package/lib/components/Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.ts +32 -0
- package/lib/components/Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.ts +23 -0
- package/lib/components/Datepicker/utils/index.ts +2 -3
- package/lib/components/Datepicker/utils/parseInputValue/parseInputValue.test.ts +110 -0
- package/lib/components/Datepicker/utils/parseInputValue/parseInputValue.ts +57 -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/Footer.tsx +3 -3
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +31 -31
- 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 +5 -2
- package/lib/components/Menu/MenuContent.tsx +9 -6
- 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 +20 -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 +2 -2
- package/dist/components/Datepicker/subcomponents/AcademicWeeks.d.ts +0 -7
- package/dist/components/Datepicker/subcomponents/CalendarGrid/CalendarGrid.d.ts +0 -8
- package/dist/components/Datepicker/subcomponents/CalendarGrid/index.d.ts +0 -1
- package/dist/components/Datepicker/subcomponents/CalendarMenu/CalendarMenu.d.ts +0 -12
- package/dist/components/Datepicker/subcomponents/CalendarMenu/index.d.ts +0 -1
- package/dist/components/Datepicker/subcomponents/ColumnHeadings/ColumnHeadings.d.ts +0 -2
- package/dist/components/Datepicker/subcomponents/ColumnHeadings/index.d.ts +0 -1
- package/dist/components/Datepicker/subcomponents/DateField/DateField.d.ts +0 -7
- package/dist/components/Datepicker/subcomponents/DateField/index.d.ts +0 -1
- package/dist/components/Datepicker/subcomponents/Day/index.d.ts +0 -1
- package/dist/components/Datepicker/subcomponents/MonthSelector/MonthSelector.d.ts +0 -6
- package/dist/components/Datepicker/subcomponents/MonthSelector/index.d.ts +0 -1
- package/dist/components/Datepicker/subcomponents/Native/Native.d.ts +0 -9
- package/dist/components/Datepicker/subcomponents/Native/index.d.ts +0 -1
- package/dist/components/Datepicker/utils/parseDateForDateField/parseDateForDateField.d.ts +0 -20
- package/lib/components/Datepicker/subcomponents/CalendarGrid/CalendarGrid.tsx +0 -54
- package/lib/components/Datepicker/subcomponents/CalendarGrid/index.ts +0 -1
- package/lib/components/Datepicker/subcomponents/CalendarMenu/CalendarMenu.tsx +0 -90
- package/lib/components/Datepicker/subcomponents/CalendarMenu/index.ts +0 -1
- package/lib/components/Datepicker/subcomponents/ColumnHeadings/ColumnHeadings.tsx +0 -35
- package/lib/components/Datepicker/subcomponents/ColumnHeadings/index.ts +0 -1
- package/lib/components/Datepicker/subcomponents/DateField/DateField.tsx +0 -155
- package/lib/components/Datepicker/subcomponents/DateField/__tests__/DateField.test.tsx +0 -191
- package/lib/components/Datepicker/subcomponents/DateField/index.ts +0 -1
- package/lib/components/Datepicker/subcomponents/Day/index.ts +0 -1
- package/lib/components/Datepicker/subcomponents/MonthSelector/index.ts +0 -1
- package/lib/components/Datepicker/subcomponents/Native/Native.tsx +0 -59
- package/lib/components/Datepicker/subcomponents/Native/index.ts +0 -1
- package/lib/components/Datepicker/utils/parseDateForDateField/parseDateForDateField.test.ts +0 -41
- package/lib/components/Datepicker/utils/parseDateForDateField/parseDateForDateField.ts +0 -48
- package/lib/components/Field/__tests__/__snapshots__/Field.test.tsx.snap +0 -300
- /package/dist/components/{Datepicker/subcomponents/DateField/__tests__/DateField.test.d.ts → Calendar/__tests__/Calendar.test.d.ts} +0 -0
- /package/dist/components/{Datepicker → Calendar}/subcomponents/AcademicWeek.d.ts +0 -0
- /package/dist/components/{Datepicker/subcomponents/Day → Calendar/subcomponents}/Day.stories.d.ts +0 -0
- /package/dist/components/{Datepicker → Calendar}/utils/getAcademicWeekNumbers/getAcademicWeekNumbers.test.d.ts +0 -0
- /package/dist/components/{Datepicker → Calendar}/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.d.ts +0 -0
- /package/dist/components/{Datepicker → Calendar}/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.test.d.ts +0 -0
- /package/dist/components/{Datepicker/utils/parseDateForDateField/parseDateForDateField.test.d.ts → Calendar/utils/normaliseMonth/normaliseMonth.test.d.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Heading > snapshot: custom test id 1`] = `
|
|
4
4
|
<h1
|
|
5
|
-
class="ucl-heading css-1bjykaw"
|
|
5
|
+
class="ucl-uikit-heading css-1bjykaw"
|
|
6
6
|
data-testid="custom-test-id"
|
|
7
7
|
>
|
|
8
8
|
This is a test
|
|
@@ -11,8 +11,8 @@ exports[`Heading > snapshot: custom test id 1`] = `
|
|
|
11
11
|
|
|
12
12
|
exports[`Heading > snapshot: level 1`] = `
|
|
13
13
|
<h1
|
|
14
|
-
class="ucl-heading css-1bjykaw"
|
|
15
|
-
data-testid="ucl-heading"
|
|
14
|
+
class="ucl-uikit-heading css-1bjykaw"
|
|
15
|
+
data-testid="ucl-uikit-heading"
|
|
16
16
|
>
|
|
17
17
|
Level 1
|
|
18
18
|
</h1>
|
|
@@ -20,8 +20,8 @@ exports[`Heading > snapshot: level 1`] = `
|
|
|
20
20
|
|
|
21
21
|
exports[`Heading > snapshot: minimal props 1`] = `
|
|
22
22
|
<h1
|
|
23
|
-
class="ucl-heading css-1bjykaw"
|
|
24
|
-
data-testid="ucl-heading"
|
|
23
|
+
class="ucl-uikit-heading css-1bjykaw"
|
|
24
|
+
data-testid="ucl-uikit-heading"
|
|
25
25
|
>
|
|
26
26
|
This is a test
|
|
27
27
|
</h1>
|
|
@@ -29,8 +29,8 @@ exports[`Heading > snapshot: minimal props 1`] = `
|
|
|
29
29
|
|
|
30
30
|
exports[`Heading > snapshot: no margins 1`] = `
|
|
31
31
|
<h1
|
|
32
|
-
class="ucl-heading css-x9klp3"
|
|
33
|
-
data-testid="ucl-heading"
|
|
32
|
+
class="ucl-uikit-heading css-x9klp3"
|
|
33
|
+
data-testid="ucl-uikit-heading"
|
|
34
34
|
>
|
|
35
35
|
No margins
|
|
36
36
|
</h1>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Label > snapshot: Only required prop (text) 1`] = `
|
|
4
4
|
<label
|
|
5
|
-
class="ucl-uikit-label css-
|
|
5
|
+
class="ucl-uikit-label css-116lyj5"
|
|
6
6
|
data-testid="ucl-uikit-label"
|
|
7
7
|
for=""
|
|
8
8
|
>
|
|
@@ -12,7 +12,7 @@ exports[`Label > snapshot: Only required prop (text) 1`] = `
|
|
|
12
12
|
|
|
13
13
|
exports[`Label > snapshot: className prop 1`] = `
|
|
14
14
|
<label
|
|
15
|
-
class="ucl-uikit-label test-class-name css-
|
|
15
|
+
class="ucl-uikit-label test-class-name css-116lyj5"
|
|
16
16
|
data-testid="ucl-uikit-label"
|
|
17
17
|
for=""
|
|
18
18
|
>
|
|
@@ -22,7 +22,7 @@ exports[`Label > snapshot: className prop 1`] = `
|
|
|
22
22
|
|
|
23
23
|
exports[`Label > snapshot: testId prop 1`] = `
|
|
24
24
|
<label
|
|
25
|
-
class="ucl-uikit-label css-
|
|
25
|
+
class="ucl-uikit-label css-116lyj5"
|
|
26
26
|
data-testid="test123"
|
|
27
27
|
for=""
|
|
28
28
|
>
|
|
@@ -32,7 +32,7 @@ exports[`Label > snapshot: testId prop 1`] = `
|
|
|
32
32
|
|
|
33
33
|
exports[`Label > snapshot: type prop with explicit block value 1`] = `
|
|
34
34
|
<label
|
|
35
|
-
class="ucl-uikit-label css-
|
|
35
|
+
class="ucl-uikit-label css-116lyj5"
|
|
36
36
|
data-testid="ucl-uikit-label"
|
|
37
37
|
for=""
|
|
38
38
|
>
|
|
@@ -42,7 +42,7 @@ exports[`Label > snapshot: type prop with explicit block value 1`] = `
|
|
|
42
42
|
|
|
43
43
|
exports[`Label > snapshot: type prop with inline value 1`] = `
|
|
44
44
|
<label
|
|
45
|
-
class="ucl-uikit-label css-
|
|
45
|
+
class="ucl-uikit-label css-11raiub"
|
|
46
46
|
data-testid="ucl-uikit-label"
|
|
47
47
|
for=""
|
|
48
48
|
>
|
|
@@ -52,7 +52,7 @@ exports[`Label > snapshot: type prop with inline value 1`] = `
|
|
|
52
52
|
|
|
53
53
|
exports[`Label > snapshot: with disabled prop 1`] = `
|
|
54
54
|
<label
|
|
55
|
-
class="ucl-uikit-label css-
|
|
55
|
+
class="ucl-uikit-label css-19nek55"
|
|
56
56
|
data-testid="ucl-uikit-label"
|
|
57
57
|
for=""
|
|
58
58
|
>
|
|
@@ -62,7 +62,7 @@ exports[`Label > snapshot: with disabled prop 1`] = `
|
|
|
62
62
|
|
|
63
63
|
exports[`Label > snapshot: with optional prop 1`] = `
|
|
64
64
|
<label
|
|
65
|
-
class="ucl-uikit-label css-
|
|
65
|
+
class="ucl-uikit-label css-116lyj5"
|
|
66
66
|
data-testid="ucl-uikit-label"
|
|
67
67
|
for=""
|
|
68
68
|
>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { AnchorHTMLAttributes, ElementType, forwardRef } from 'react';
|
|
2
|
+
import { css, cx } from '@emotion/css';
|
|
3
|
+
import useTheme from '../../theme/useTheme';
|
|
4
|
+
|
|
5
|
+
export interface BaseLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
|
+
component?: ElementType;
|
|
7
|
+
size?: 'small' | 'default';
|
|
8
|
+
noVisited?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
testId?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const NAME = 'ucl-uikit-base-link';
|
|
14
|
+
|
|
15
|
+
const BaseLink = forwardRef<HTMLAnchorElement, BaseLinkProps>(
|
|
16
|
+
(
|
|
17
|
+
{
|
|
18
|
+
testId = NAME,
|
|
19
|
+
className,
|
|
20
|
+
children,
|
|
21
|
+
size = 'default',
|
|
22
|
+
disabled = false,
|
|
23
|
+
component: Component = 'a',
|
|
24
|
+
...props
|
|
25
|
+
},
|
|
26
|
+
ref
|
|
27
|
+
) => {
|
|
28
|
+
const [theme] = useTheme();
|
|
29
|
+
|
|
30
|
+
const baseStyle = css`
|
|
31
|
+
font-family: ${theme.font.family.primary};
|
|
32
|
+
font-size: ${theme.font.size.f16};
|
|
33
|
+
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
outline: none;
|
|
36
|
+
box-shadow: ${theme.boxShadow.focus};
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const smallStyle = css`
|
|
41
|
+
font-size: ${theme.font.size.f14};
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const disabledStyle = css`
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
color: ${theme.color.link.disabled};
|
|
47
|
+
|
|
48
|
+
&:hover {
|
|
49
|
+
color: ${theme.color.link.disabled};
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const style = cx(
|
|
54
|
+
NAME,
|
|
55
|
+
baseStyle,
|
|
56
|
+
size === 'small' && smallStyle,
|
|
57
|
+
disabled && disabledStyle,
|
|
58
|
+
className
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Component
|
|
63
|
+
ref={ref}
|
|
64
|
+
className={style}
|
|
65
|
+
data-testid={testId}
|
|
66
|
+
disabled={disabled}
|
|
67
|
+
href={disabled ? undefined : props.href}
|
|
68
|
+
onClick={
|
|
69
|
+
disabled
|
|
70
|
+
? (ev: React.MouseEvent) => {
|
|
71
|
+
ev.preventDefault();
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
: props.onClick
|
|
75
|
+
}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</Component>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
export default BaseLink;
|
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
memo,
|
|
3
|
-
forwardRef,
|
|
4
|
-
AnchorHTMLAttributes,
|
|
5
|
-
ElementType,
|
|
6
|
-
ComponentPropsWithRef,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import { forwardRef } from 'react';
|
|
8
2
|
import { css, cx } from '@emotion/css';
|
|
9
|
-
import
|
|
3
|
+
import useTheme from '../../theme/useTheme';
|
|
4
|
+
import BaseLink, { BaseLinkProps } from './BaseLink';
|
|
10
5
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
export interface LinkBaseProps {
|
|
14
|
-
noVisited?: boolean;
|
|
15
|
-
testId?: string;
|
|
16
|
-
component?: ElementType;
|
|
6
|
+
export interface LinkProps extends BaseLinkProps {
|
|
7
|
+
variant?: 'primary' | 'secondary';
|
|
17
8
|
}
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
(C extends 'a'
|
|
21
|
-
? AnchorHTMLAttributes<HTMLAnchorElement>
|
|
22
|
-
: Omit<ComponentPropsWithRef<C>, keyof LinkBaseProps>);
|
|
23
|
-
|
|
24
|
-
export type Ref = HTMLAnchorElement;
|
|
10
|
+
const NAME = 'ucl-uikit-link';
|
|
25
11
|
|
|
26
|
-
const Link = forwardRef<
|
|
12
|
+
const Link = forwardRef<HTMLAnchorElement, LinkProps>(
|
|
27
13
|
(
|
|
28
14
|
{
|
|
29
15
|
noVisited = false,
|
|
16
|
+
variant = 'primary',
|
|
17
|
+
disabled = false,
|
|
30
18
|
testId = NAME,
|
|
31
19
|
className,
|
|
32
20
|
children,
|
|
33
|
-
component: Component = 'a',
|
|
34
21
|
...props
|
|
35
22
|
},
|
|
36
23
|
ref
|
|
@@ -38,15 +25,24 @@ const Link = forwardRef<Ref, LinkProps>(
|
|
|
38
25
|
const [theme] = useTheme();
|
|
39
26
|
|
|
40
27
|
const baseStyle = css`
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
text-decoration-skip-ink: none;
|
|
29
|
+
text-decoration-thickness: 10%;
|
|
30
|
+
text-underline-offset: 25%;
|
|
31
|
+
text-underline-position: from-font;
|
|
32
|
+
`;
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
const primaryStyle = css`
|
|
35
|
+
color: ${theme.color.link.default};
|
|
36
|
+
&:active {
|
|
45
37
|
color: ${theme.color.link.hover};
|
|
46
38
|
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const secondaryStyle = css`
|
|
42
|
+
color: ${theme.color.link.secondaryDefault};
|
|
47
43
|
|
|
48
44
|
&:active {
|
|
49
|
-
color: ${theme.color.link.
|
|
45
|
+
color: ${theme.color.link.secondaryHover};
|
|
50
46
|
}
|
|
51
47
|
`;
|
|
52
48
|
|
|
@@ -56,31 +52,75 @@ const Link = forwardRef<Ref, LinkProps>(
|
|
|
56
52
|
}
|
|
57
53
|
`;
|
|
58
54
|
|
|
59
|
-
const
|
|
55
|
+
const primaryNoVisitedStyle = css`
|
|
60
56
|
&:visited {
|
|
61
57
|
color: ${theme.color.link.default};
|
|
62
58
|
}
|
|
63
59
|
`;
|
|
64
60
|
|
|
61
|
+
const secondaryNoVisitedStyle = css`
|
|
62
|
+
&:visited {
|
|
63
|
+
color: ${theme.color.link.secondaryDefault};
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const primaryHoverStyle = css`
|
|
68
|
+
&:hover {
|
|
69
|
+
color: ${theme.color.link.hover};
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
const secondaryHoverStyle = css`
|
|
74
|
+
&:hover {
|
|
75
|
+
color: ${theme.color.link.secondaryHover};
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
const disabledStyle = css`
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
color: ${theme.color.link.disabled};
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
color: ${theme.color.link.disabled};
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
let variantStyle = undefined;
|
|
89
|
+
if (variant === 'primary') {
|
|
90
|
+
variantStyle = cx(
|
|
91
|
+
primaryStyle,
|
|
92
|
+
noVisited && !disabled && primaryNoVisitedStyle,
|
|
93
|
+
!disabled && primaryHoverStyle
|
|
94
|
+
);
|
|
95
|
+
} else if (variant === 'secondary') {
|
|
96
|
+
variantStyle = cx(
|
|
97
|
+
secondaryStyle,
|
|
98
|
+
noVisited && !disabled && secondaryNoVisitedStyle,
|
|
99
|
+
!disabled && secondaryHoverStyle
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
65
103
|
const style = cx(
|
|
66
104
|
NAME,
|
|
67
105
|
baseStyle,
|
|
68
|
-
|
|
69
|
-
noVisited &&
|
|
106
|
+
variantStyle,
|
|
107
|
+
!noVisited && !disabled && visitedStyle,
|
|
108
|
+
disabled && disabledStyle,
|
|
70
109
|
className
|
|
71
110
|
);
|
|
72
111
|
|
|
73
112
|
return (
|
|
74
|
-
<
|
|
113
|
+
<BaseLink
|
|
75
114
|
ref={ref}
|
|
76
115
|
className={style}
|
|
77
116
|
data-testid={testId}
|
|
117
|
+
disabled={disabled}
|
|
78
118
|
{...props}
|
|
79
119
|
>
|
|
80
120
|
{children}
|
|
81
|
-
</
|
|
121
|
+
</BaseLink>
|
|
82
122
|
);
|
|
83
123
|
}
|
|
84
124
|
);
|
|
85
125
|
|
|
86
|
-
export default
|
|
126
|
+
export default Link;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Link > snapshot: no props 1`] = `
|
|
4
4
|
<a
|
|
5
|
-
class="ucl-link css-
|
|
6
|
-
data-testid="ucl-link"
|
|
5
|
+
class="ucl-uikit-base-link ucl-uikit-link css-145ds9b"
|
|
6
|
+
data-testid="ucl-uikit-link"
|
|
7
7
|
>
|
|
8
8
|
test
|
|
9
9
|
</a>
|
|
@@ -11,7 +11,7 @@ exports[`Link > snapshot: no props 1`] = `
|
|
|
11
11
|
|
|
12
12
|
exports[`Link > snapshot: testId prop 1`] = `
|
|
13
13
|
<a
|
|
14
|
-
class="ucl-link css-
|
|
14
|
+
class="ucl-uikit-base-link ucl-uikit-link css-145ds9b"
|
|
15
15
|
data-testid="test123"
|
|
16
16
|
>
|
|
17
17
|
testidlink
|
|
@@ -12,9 +12,7 @@ describe('Link', () => {
|
|
|
12
12
|
<Link>test</Link>
|
|
13
13
|
</ThemeContextProvider>
|
|
14
14
|
);
|
|
15
|
-
expect(
|
|
16
|
-
renderResult.container.firstChild
|
|
17
|
-
).toMatchSnapshot();
|
|
15
|
+
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
18
16
|
});
|
|
19
17
|
|
|
20
18
|
test('snapshot: testId prop', () => {
|
|
@@ -23,9 +21,7 @@ describe('Link', () => {
|
|
|
23
21
|
<Link testId='test123'> testidlink </Link>
|
|
24
22
|
</ThemeContextProvider>
|
|
25
23
|
);
|
|
26
|
-
expect(
|
|
27
|
-
renderResult.container.firstChild
|
|
28
|
-
).toMatchSnapshot();
|
|
24
|
+
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
29
25
|
});
|
|
30
26
|
|
|
31
27
|
// // Interaction tests
|
|
@@ -36,7 +32,8 @@ describe('Link', () => {
|
|
|
36
32
|
<Link> testidlink </Link>
|
|
37
33
|
</ThemeContextProvider>
|
|
38
34
|
);
|
|
39
|
-
|
|
35
|
+
|
|
36
|
+
const link = screen.getByTestId('ucl-uikit-link');
|
|
40
37
|
expect(link).toBeDefined();
|
|
41
38
|
});
|
|
42
39
|
|
|
@@ -56,12 +53,8 @@ describe('Link', () => {
|
|
|
56
53
|
<Link href='/testlink'>linktext</Link>
|
|
57
54
|
</ThemeContextProvider>
|
|
58
55
|
);
|
|
59
|
-
const link = screen.getByRole(
|
|
60
|
-
'link'
|
|
61
|
-
) as HTMLAnchorElement;
|
|
56
|
+
const link = screen.getByRole('link') as HTMLAnchorElement;
|
|
62
57
|
expect(link.textContent).toBe('linktext');
|
|
63
|
-
expect(link.href).toBe(
|
|
64
|
-
'http://localhost:3000/testlink'
|
|
65
|
-
);
|
|
58
|
+
expect(link.href).toBe('http://localhost:3000/testlink');
|
|
66
59
|
});
|
|
67
60
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Link';
|
|
2
|
-
export type { LinkProps
|
|
2
|
+
export type { LinkProps } from './Link';
|
|
@@ -68,7 +68,9 @@ const MenuProvider = ({
|
|
|
68
68
|
if (!isOpen || !contentRef.current) return;
|
|
69
69
|
|
|
70
70
|
const focusableElements = Array.from(
|
|
71
|
-
contentRef.current.querySelectorAll(
|
|
71
|
+
contentRef.current.querySelectorAll(
|
|
72
|
+
'[role="menuitem"], [aria-label="Close menu"]'
|
|
73
|
+
)
|
|
72
74
|
).filter((el) => {
|
|
73
75
|
const element = el as HTMLElement;
|
|
74
76
|
return (
|
|
@@ -14,11 +14,13 @@ export interface MenuProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
14
14
|
title?: string;
|
|
15
15
|
menuId?: string;
|
|
16
16
|
testId?: string;
|
|
17
|
+
position?: 'left' | 'right';
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const Menu = ({
|
|
20
21
|
defaultOpen = false,
|
|
21
22
|
title,
|
|
23
|
+
position = 'right',
|
|
22
24
|
menuId = NAME,
|
|
23
25
|
testId = NAME,
|
|
24
26
|
children,
|
|
@@ -35,7 +37,7 @@ const Menu = ({
|
|
|
35
37
|
const style = cx(NAME, baseStyle, className);
|
|
36
38
|
|
|
37
39
|
return (
|
|
38
|
-
<
|
|
40
|
+
<nav
|
|
39
41
|
className={style}
|
|
40
42
|
data-testid={testId}
|
|
41
43
|
{...props}
|
|
@@ -45,11 +47,12 @@ const Menu = ({
|
|
|
45
47
|
<MenuContent
|
|
46
48
|
id={menuId}
|
|
47
49
|
title={title}
|
|
50
|
+
position={position}
|
|
48
51
|
>
|
|
49
52
|
{children}
|
|
50
53
|
</MenuContent>
|
|
51
54
|
</MenuProvider>
|
|
52
|
-
</
|
|
55
|
+
</nav>
|
|
53
56
|
);
|
|
54
57
|
};
|
|
55
58
|
|
|
@@ -9,14 +9,16 @@ import { useAppMenu } from './Menu.context';
|
|
|
9
9
|
|
|
10
10
|
export const NAME = 'ucl-uikit-menu__content';
|
|
11
11
|
|
|
12
|
-
export interface MenuContentProps extends HTMLAttributes<
|
|
12
|
+
export interface MenuContentProps extends HTMLAttributes<HTMLUListElement> {
|
|
13
13
|
title?: string;
|
|
14
14
|
testId?: string;
|
|
15
|
+
position?: 'left' | 'right';
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const MenuContent: React.FC<MenuContentProps> = ({
|
|
18
19
|
title,
|
|
19
20
|
testId = NAME,
|
|
21
|
+
position = 'right',
|
|
20
22
|
children,
|
|
21
23
|
className,
|
|
22
24
|
...props
|
|
@@ -34,7 +36,7 @@ const MenuContent: React.FC<MenuContentProps> = ({
|
|
|
34
36
|
const baseStyle = css`
|
|
35
37
|
display: none;
|
|
36
38
|
z-index: 100;
|
|
37
|
-
right: 0;
|
|
39
|
+
${position === 'left' ? 'left: 0;' : 'right: 0;'}
|
|
38
40
|
white-space: nowrap;
|
|
39
41
|
background-color: ${theme.color.neutral.white};
|
|
40
42
|
color: ${theme.color.text.primary};
|
|
@@ -89,7 +91,8 @@ const MenuContent: React.FC<MenuContentProps> = ({
|
|
|
89
91
|
list-style: none;
|
|
90
92
|
|
|
91
93
|
@media (min-width: ${theme.breakpoints.desktop}px) {
|
|
92
|
-
margin: 0 ${padding.p64}
|
|
94
|
+
margin: 0 ${padding.p64};
|
|
95
|
+
padding: 0;
|
|
93
96
|
}
|
|
94
97
|
`;
|
|
95
98
|
|
|
@@ -112,13 +115,13 @@ const MenuContent: React.FC<MenuContentProps> = ({
|
|
|
112
115
|
<header className={headerStyle}>
|
|
113
116
|
<h3 className={titleStyle}>{title}</h3>
|
|
114
117
|
<IconButton
|
|
115
|
-
role='menuitem'
|
|
116
118
|
onClick={toggleMenu}
|
|
119
|
+
aria-label='Close menu'
|
|
117
120
|
>
|
|
118
121
|
<Icon.X size={40} />
|
|
119
122
|
</IconButton>
|
|
120
123
|
</header>
|
|
121
|
-
<
|
|
124
|
+
<ul
|
|
122
125
|
role='menu'
|
|
123
126
|
aria-labelledby='app-menu-button'
|
|
124
127
|
className={bodyStyle}
|
|
@@ -127,7 +130,7 @@ const MenuContent: React.FC<MenuContentProps> = ({
|
|
|
127
130
|
{...props}
|
|
128
131
|
>
|
|
129
132
|
{children}
|
|
130
|
-
</
|
|
133
|
+
</ul>
|
|
131
134
|
</div>
|
|
132
135
|
);
|
|
133
136
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React, { LiHTMLAttributes, memo } from 'react';
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
import useTheme from '../../theme/useTheme';
|
|
4
|
+
import Icon from '../Icon/Icon';
|
|
4
5
|
|
|
5
6
|
export const NAME = 'ucl-uikit-menu__item';
|
|
6
7
|
|
|
7
8
|
export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
8
9
|
testId?: string;
|
|
9
10
|
icon?: React.ReactNode;
|
|
11
|
+
secondary?: boolean;
|
|
12
|
+
externalLink?: boolean;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
const MenuItem: React.FC<MenuItemProps> = ({
|
|
@@ -15,6 +18,8 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
15
18
|
children,
|
|
16
19
|
className,
|
|
17
20
|
onClick,
|
|
21
|
+
secondary,
|
|
22
|
+
externalLink,
|
|
18
23
|
...props
|
|
19
24
|
}) => {
|
|
20
25
|
const isClickable = !!onClick;
|
|
@@ -22,17 +27,21 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
22
27
|
|
|
23
28
|
const baseStyle = css`
|
|
24
29
|
height: 40px;
|
|
25
|
-
margin-bottom: ${theme.margin.
|
|
30
|
+
margin-bottom: ${theme.margin.m16};
|
|
26
31
|
display: flex;
|
|
27
32
|
align-items: center;
|
|
28
33
|
font-family: ${theme.font.family.primary};
|
|
29
34
|
font-size: ${theme.font.size.f16};
|
|
30
|
-
font-weight: ${
|
|
35
|
+
font-weight: ${secondary
|
|
36
|
+
? `${theme.font.weight.medium}`
|
|
37
|
+
: `${theme.font.weight.bold}`};
|
|
31
38
|
color: ${theme.color.text.secondary};
|
|
32
39
|
`;
|
|
33
40
|
|
|
34
41
|
const clickableMenuItemStyle = css`
|
|
35
|
-
color: ${
|
|
42
|
+
color: ${secondary
|
|
43
|
+
? `${theme.color.text.secondary}`
|
|
44
|
+
: `${theme.color.text.primary}`};
|
|
36
45
|
cursor: pointer;
|
|
37
46
|
&:hover {
|
|
38
47
|
background-color: ${theme.color.interaction.blue5};
|
|
@@ -77,6 +86,14 @@ const MenuItem: React.FC<MenuItemProps> = ({
|
|
|
77
86
|
{...props}
|
|
78
87
|
>
|
|
79
88
|
{content}
|
|
89
|
+
{externalLink && (
|
|
90
|
+
<Icon.ExternalLink
|
|
91
|
+
size={16}
|
|
92
|
+
className={css`
|
|
93
|
+
margin-left: 8px;
|
|
94
|
+
`}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
80
97
|
</li>
|
|
81
98
|
);
|
|
82
99
|
};
|
|
@@ -4,7 +4,7 @@ import { useTheme } from '../../theme';
|
|
|
4
4
|
|
|
5
5
|
export const NAME = 'ucl-uikit-menu__section';
|
|
6
6
|
|
|
7
|
-
export interface MenuSectionProps extends HTMLAttributes<
|
|
7
|
+
export interface MenuSectionProps extends HTMLAttributes<HTMLLIElement> {
|
|
8
8
|
testId?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -34,12 +34,13 @@ const MenuSection: React.FC<MenuSectionProps> = ({
|
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
|
-
<
|
|
37
|
+
<li
|
|
38
|
+
role='presentation'
|
|
38
39
|
className={style}
|
|
39
40
|
{...props}
|
|
40
41
|
>
|
|
41
42
|
<ul className={listStyle}>{children}</ul>
|
|
42
|
-
</
|
|
43
|
+
</li>
|
|
43
44
|
);
|
|
44
45
|
};
|
|
45
46
|
|
|
@@ -102,7 +102,7 @@ const PaginationControls = ({
|
|
|
102
102
|
return (
|
|
103
103
|
<nav
|
|
104
104
|
className={style}
|
|
105
|
-
aria-label=
|
|
105
|
+
aria-label={`Pagination, ${totalPages} pages total`}
|
|
106
106
|
data-testid={testId}
|
|
107
107
|
>
|
|
108
108
|
<ul className={listStyle}>
|
|
@@ -140,8 +140,6 @@ const PaginationControls = ({
|
|
|
140
140
|
variant='secondary'
|
|
141
141
|
aria-label={`Page ${page}, current page`}
|
|
142
142
|
aria-current='page'
|
|
143
|
-
aria-setsize={totalPages}
|
|
144
|
-
aria-posinset={page}
|
|
145
143
|
disabled
|
|
146
144
|
onClick={() => handlePageChange(page)}
|
|
147
145
|
>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Search from './Search';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Ready to use/Search',
|
|
6
|
+
component: Search,
|
|
7
|
+
parameters: { layout: 'padded' },
|
|
8
|
+
argTypes: {
|
|
9
|
+
placeholder: { control: { type: 'text' } },
|
|
10
|
+
disabled: { control: { type: 'boolean' } },
|
|
11
|
+
testId: { control: { type: 'text' } },
|
|
12
|
+
onSearch: { action: 'searched' },
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
} satisfies Meta<typeof Search>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
placeholder: 'Search...',
|
|
23
|
+
},
|
|
24
|
+
render: (args) => <Search {...args} />,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Disabled: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
placeholder: 'Search (disabled)',
|
|
30
|
+
disabled: true,
|
|
31
|
+
},
|
|
32
|
+
render: (args) => <Search {...args} />,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const WithPlaceholder: Story = {
|
|
36
|
+
name: 'With custom placeholder',
|
|
37
|
+
args: {
|
|
38
|
+
placeholder: 'Type to filter results',
|
|
39
|
+
},
|
|
40
|
+
render: (args) => <Search {...args} />,
|
|
41
|
+
};
|