@ogcio/design-system-react 1.11.1 → 1.11.2
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/accordion/accordion-item.d.ts +11 -0
- package/dist/accordion/accordion-item.js +76 -0
- package/dist/accordion/accordion.d.ts +10 -0
- package/dist/accordion/accordion.js +39 -0
- package/dist/accordion/accordion.test.d.ts +1 -0
- package/dist/accordion/accordion.test.js +61 -0
- package/dist/alert/alert.d.ts +89 -0
- package/dist/alert/alert.js +115 -0
- package/dist/alert/alert.test.d.ts +1 -0
- package/dist/alert/alert.test.js +45 -0
- package/dist/assets/logos/gov-of-ireland/harp-gold-text-green.d.ts +2 -0
- package/dist/assets/logos/gov-of-ireland/harp-gold-text-green.js +322 -0
- package/dist/assets/logos/gov-of-ireland/harp-white.d.ts +2 -0
- package/dist/assets/logos/gov-of-ireland/harp-white.js +322 -0
- package/dist/assets/logos/harp/harp-white.d.ts +2 -0
- package/dist/assets/logos/harp/harp-white.js +60 -0
- package/dist/autocomplete/autocomplete.d.ts +4 -0
- package/dist/autocomplete/autocomplete.js +252 -0
- package/dist/autocomplete/types.d.ts +61 -0
- package/dist/autocomplete/types.js +13 -0
- package/dist/blockquote/blockquote.d.ts +3 -0
- package/dist/blockquote/blockquote.js +7 -0
- package/dist/blockquote/blockquote.test.d.ts +1 -0
- package/dist/blockquote/blockquote.test.js +21 -0
- package/dist/breadcrumbs/breadcrumbs.d.ts +5 -0
- package/dist/breadcrumbs/breadcrumbs.js +38 -0
- package/dist/breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/breadcrumbs/breadcrumbs.test.js +43 -0
- package/dist/breadcrumbs/types.d.ts +17 -0
- package/dist/breadcrumbs/types.js +1 -0
- package/dist/button/button.d.ts +9 -0
- package/dist/button/button.js +38 -0
- package/dist/button/button.test.d.ts +1 -0
- package/dist/button/button.test.js +78 -0
- package/dist/button/helpers.d.ts +13 -0
- package/dist/button/helpers.js +39 -0
- package/dist/button/types.d.ts +13 -0
- package/dist/button/types.js +4 -0
- package/dist/button-group/button-group.d.ts +21 -0
- package/dist/button-group/button-group.js +85 -0
- package/dist/button-group/button-group.test.d.ts +1 -0
- package/dist/button-group/button-group.test.js +2982 -0
- package/dist/card/card-legacy.d.ts +5 -0
- package/dist/card/card-legacy.js +68 -0
- package/dist/card/card-next.d.ts +13 -0
- package/dist/card/card-next.js +84 -0
- package/dist/card/card.d.ts +2 -0
- package/dist/card/card.js +26 -0
- package/dist/card/card.test.d.ts +1 -0
- package/dist/card/card.test.js +130 -0
- package/dist/card/types.d.ts +92 -0
- package/dist/card/types.js +1 -0
- package/dist/checkbox/checkbox-group.d.ts +4 -0
- package/dist/checkbox/checkbox-group.js +7 -0
- package/dist/checkbox/checkbox.d.ts +4 -0
- package/dist/checkbox/checkbox.js +7 -0
- package/dist/checkbox/types.d.ts +14 -0
- package/dist/checkbox/types.js +5 -0
- package/dist/chip/chip.d.ts +9 -0
- package/dist/chip/chip.js +37 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +19 -0
- package/dist/combo-box/combo-box.content.d.ts +12 -0
- package/dist/combo-box/combo-box.content.js +685 -0
- package/dist/combo-box/combo-box.d.ts +2 -0
- package/dist/combo-box/combo-box.js +17 -0
- package/dist/combo-box/dropdown-item.d.ts +2 -0
- package/dist/combo-box/dropdown-item.js +154 -0
- package/dist/combo-box/dropdown-item.test.d.ts +1 -0
- package/dist/combo-box/dropdown-item.test.js +88 -0
- package/dist/combo-box/types.d.ts +18 -0
- package/dist/combo-box/types.js +1 -0
- package/dist/common/types.d.ts +7 -0
- package/dist/common/types.js +1 -0
- package/dist/container/container.d.ts +16 -0
- package/dist/container/container.js +37 -0
- package/dist/container/container.test.d.ts +1 -0
- package/dist/container/container.test.js +28 -0
- package/dist/cookie-banner/cookie-banner.content.d.ts +3 -0
- package/dist/cookie-banner/cookie-banner.content.js +21 -0
- package/dist/cookie-banner/cookie-banner.d.ts +12 -0
- package/dist/cookie-banner/cookie-banner.js +31 -0
- package/dist/cookie-banner/cookie-banner.test.d.ts +1 -0
- package/dist/cookie-banner/cookie-banner.test.js +20 -0
- package/dist/details/details.d.ts +4 -0
- package/dist/details/details.js +55 -0
- package/dist/details/details.test.d.ts +1 -0
- package/dist/details/details.test.js +50 -0
- package/dist/drawer/drawer.content.d.ts +3 -0
- package/dist/drawer/drawer.content.js +68 -0
- package/dist/drawer/drawer.d.ts +26 -0
- package/dist/drawer/drawer.js +48 -0
- package/dist/drawer/drawer.test.d.ts +1 -0
- package/dist/drawer/drawer.test.js +69 -0
- package/dist/error-text/error-text.d.ts +7 -0
- package/dist/error-text/error-text.js +40 -0
- package/dist/error-text/error-text.test.d.ts +1 -0
- package/dist/error-text/error-text.test.js +30 -0
- package/dist/error-text/types.d.ts +8 -0
- package/dist/error-text/types.js +1 -0
- package/dist/file-upload/file-upload.d.ts +9 -0
- package/dist/file-upload/file-upload.js +6 -0
- package/dist/footer/footer.d.ts +11 -0
- package/dist/footer/footer.js +108 -0
- package/dist/footer/footer.test.d.ts +1 -0
- package/dist/footer/footer.test.js +42 -0
- package/dist/forms/form-field-with-tag/form-field-with-tag.d.ts +24 -0
- package/dist/forms/form-field-with-tag/form-field-with-tag.js +50 -0
- package/dist/forms/form-field.d.ts +11 -0
- package/dist/forms/form-field.js +41 -0
- package/dist/forms/form.d.ts +4 -0
- package/dist/forms/form.js +5 -0
- package/dist/header/components/header-menu.d.ts +13 -0
- package/dist/header/components/header-menu.js +126 -0
- package/dist/header/components/header-search.d.ts +7 -0
- package/dist/header/components/header-search.js +59 -0
- package/dist/header/components/header-slot.d.ts +12 -0
- package/dist/header/components/header-slot.js +129 -0
- package/dist/header/header.d.ts +2 -0
- package/dist/header/header.js +201 -0
- package/dist/header/header.test.d.ts +1 -0
- package/dist/header/header.test.js +95 -0
- package/dist/header/helper.d.ts +2 -0
- package/dist/header/helper.js +79 -0
- package/dist/header/types.d.ts +76 -0
- package/dist/header/types.js +1 -0
- package/dist/heading/heading.d.ts +82 -0
- package/dist/heading/heading.js +50 -0
- package/dist/hint-text/hint-text.d.ts +7 -0
- package/dist/hint-text/hint-text.js +30 -0
- package/dist/hint-text/hint-text.test.d.ts +1 -0
- package/dist/hint-text/hint-text.test.js +31 -0
- package/dist/hint-text/types.d.ts +7 -0
- package/dist/hint-text/types.js +1 -0
- package/dist/hooks/use-breakpoint.d.ts +12 -0
- package/dist/hooks/use-breakpoint.js +24 -0
- package/dist/hooks/use-dom-id.d.ts +1 -0
- package/dist/hooks/use-dom-id.js +8 -0
- package/dist/i18n/config.d.ts +7 -0
- package/dist/i18n/config.js +13 -0
- package/dist/i18n/utility.d.ts +1 -0
- package/dist/i18n/utility.js +5 -0
- package/dist/i18next-DxWa09nx.js +1395 -0
- package/dist/icon/icon.d.ts +15 -0
- package/dist/icon/icon.js +173 -0
- package/dist/icon/icon.test.d.ts +1 -0
- package/dist/icon/icon.test.js +53 -0
- package/dist/icon/icons.d.ts +2 -0
- package/dist/icon/icons.js +144 -0
- package/dist/icon/svg.d.ts +7 -0
- package/dist/icon/svg.js +22 -0
- package/dist/icon/svgs/bluesky.d.ts +5 -0
- package/dist/icon/svgs/bluesky.js +24 -0
- package/dist/icon/svgs/facebook.d.ts +5 -0
- package/dist/icon/svgs/facebook.js +24 -0
- package/dist/icon/svgs/instagram.d.ts +5 -0
- package/dist/icon/svgs/instagram.js +24 -0
- package/dist/icon/svgs/linkedin.d.ts +5 -0
- package/dist/icon/svgs/linkedin.js +24 -0
- package/dist/icon/svgs/placeholder.d.ts +5 -0
- package/dist/icon/svgs/placeholder.js +30 -0
- package/dist/icon/svgs/threads.d.ts +5 -0
- package/dist/icon/svgs/threads.js +24 -0
- package/dist/icon/svgs/tiktok.d.ts +5 -0
- package/dist/icon/svgs/tiktok.js +24 -0
- package/dist/icon/svgs/x.d.ts +5 -0
- package/dist/icon/svgs/x.js +24 -0
- package/dist/icon/svgs/youtube.d.ts +5 -0
- package/dist/icon/svgs/youtube.js +29 -0
- package/dist/icon-button/icon-button.d.ts +10 -0
- package/dist/icon-button/icon-button.js +43 -0
- package/dist/icon-button/icon-button.test.d.ts +1 -0
- package/dist/icon-button/icon-button.test.js +56 -0
- package/dist/index-DNkhmzZp.js +2419 -0
- package/dist/index-ntYL1VRC.js +64 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +190 -0
- package/dist/input-checkbox/input-checkbox.d.ts +3 -0
- package/dist/input-checkbox/input-checkbox.js +51 -0
- package/dist/input-checkbox/types.d.ts +12 -0
- package/dist/input-checkbox/types.js +8 -0
- package/dist/input-checkbox-group/input-checkbox-group.d.ts +2 -0
- package/dist/input-checkbox-group/input-checkbox-group.js +24 -0
- package/dist/input-checkbox-group/types.d.ts +7 -0
- package/dist/input-checkbox-group/types.js +1 -0
- package/dist/input-file/input-file.d.ts +2 -0
- package/dist/input-file/input-file.js +20 -0
- package/dist/input-file/types.d.ts +1 -0
- package/dist/input-file/types.js +1 -0
- package/dist/input-password/input-password.d.ts +2 -0
- package/dist/input-password/input-password.js +30 -0
- package/dist/input-password/input-password.test.d.ts +1 -0
- package/dist/input-password/input-password.test.js +16 -0
- package/dist/input-password/types.d.ts +2 -0
- package/dist/input-password/types.js +1 -0
- package/dist/input-radio/input-radio.d.ts +3 -0
- package/dist/input-radio/input-radio.js +68 -0
- package/dist/input-radio/types.d.ts +14 -0
- package/dist/input-radio/types.js +8 -0
- package/dist/input-radio-group/input-radio-group.d.ts +3 -0
- package/dist/input-radio-group/input-radio-group.js +28 -0
- package/dist/input-radio-group/types.d.ts +5 -0
- package/dist/input-radio-group/types.js +1 -0
- package/dist/input-text/input-text.d.ts +19 -0
- package/dist/input-text/input-text.js +140 -0
- package/dist/input-text/type.d.ts +27 -0
- package/dist/input-text/type.js +1 -0
- package/dist/label/label.d.ts +11 -0
- package/dist/label/label.js +27 -0
- package/dist/label/label.test.d.ts +1 -0
- package/dist/label/label.test.js +49 -0
- package/dist/label/types.d.ts +7 -0
- package/dist/label/types.js +1 -0
- package/dist/link/link.d.ts +47 -0
- package/dist/link/link.js +104 -0
- package/dist/link/link.test.d.ts +1 -0
- package/dist/link/link.test.js +66 -0
- package/dist/list/list.d.ts +13 -0
- package/dist/list/list.js +44 -0
- package/dist/list/list.test.d.ts +1 -0
- package/dist/list/list.test.js +67 -0
- package/dist/list-item/list-item.d.ts +9 -0
- package/dist/list-item/list-item.js +19 -0
- package/dist/modal/modal.content.d.ts +2 -0
- package/dist/modal/modal.content.js +19 -0
- package/dist/modal/modal.d.ts +11 -0
- package/dist/modal/modal.js +222 -0
- package/dist/modal/modal.test.d.ts +1 -0
- package/dist/modal/modal.test.js +81 -0
- package/dist/modal/types.d.ts +39 -0
- package/dist/modal/types.js +1 -0
- package/dist/pagination/pagination.d.ts +8 -0
- package/dist/pagination/pagination.js +104 -0
- package/dist/pagination/pagination.test.d.ts +1 -0
- package/dist/pagination/pagination.test.js +95 -0
- package/dist/paragraph/paragraph.d.ts +17 -0
- package/dist/paragraph/paragraph.js +60 -0
- package/dist/paragraph/paragraph.test.d.ts +1 -0
- package/dist/paragraph/paragraph.test.js +63 -0
- package/dist/phase-banner/phase-banner.d.ts +5 -0
- package/dist/phase-banner/phase-banner.js +10 -0
- package/dist/phase-banner/phase-banner.test.d.ts +1 -0
- package/dist/phase-banner/phase-banner.test.js +27 -0
- package/dist/popover/popover.d.ts +2 -0
- package/dist/popover/popover.js +946 -0
- package/dist/popover/types.d.ts +10 -0
- package/dist/popover/types.js +1 -0
- package/dist/primitives/anchor.d.ts +7 -0
- package/dist/primitives/anchor.js +14 -0
- package/dist/primitives/anchor.test.d.ts +1 -0
- package/dist/primitives/anchor.test.js +39 -0
- package/dist/primitives/input.d.ts +3 -0
- package/dist/primitives/input.js +9 -0
- package/dist/progress-bar/progress-bar.d.ts +7 -0
- package/dist/progress-bar/progress-bar.js +40 -0
- package/dist/progress-bar/progress-bar.test.d.ts +1 -0
- package/dist/progress-bar/progress-bar.test.js +34 -0
- package/dist/progress-stepper/progress-stepper.d.ts +5 -0
- package/dist/progress-stepper/progress-stepper.js +198 -0
- package/dist/progress-stepper/progress-stepper.test.d.ts +1 -0
- package/dist/progress-stepper/progress-stepper.test.js +117 -0
- package/dist/progress-stepper/types.d.ts +49 -0
- package/dist/progress-stepper/types.js +7 -0
- package/dist/radio/radio-group.d.ts +4 -0
- package/dist/radio/radio-group.js +7 -0
- package/dist/radio/radio.d.ts +4 -0
- package/dist/radio/radio.js +7 -0
- package/dist/radio/types.d.ts +14 -0
- package/dist/radio/types.js +5 -0
- package/dist/score-select/score-select.d.ts +3 -0
- package/dist/score-select/score-select.js +124 -0
- package/dist/score-select/type.d.ts +14 -0
- package/dist/score-select/type.js +1 -0
- package/dist/section-break/section-break.d.ts +7 -0
- package/dist/section-break/section-break.js +38 -0
- package/dist/section-break/section-break.test.d.ts +1 -0
- package/dist/section-break/section-break.test.js +36 -0
- package/dist/select/select-menu.d.ts +7 -0
- package/dist/select/select-menu.js +141 -0
- package/dist/select/select-native.d.ts +5 -0
- package/dist/select/select-native.js +27 -0
- package/dist/select/select-next.d.ts +5 -0
- package/dist/select/select-next.js +162 -0
- package/dist/select/select.d.ts +5 -0
- package/dist/select/select.js +10 -0
- package/dist/select/types.d.ts +62 -0
- package/dist/select/types.js +1 -0
- package/dist/side-nav/side-nav.d.ts +6 -0
- package/dist/side-nav/side-nav.js +171 -0
- package/dist/side-nav/types.d.ts +18 -0
- package/dist/side-nav/types.js +1 -0
- package/dist/spinner/spinner.d.ts +35 -0
- package/dist/spinner/spinner.js +84 -0
- package/dist/spinner/spinner.test.d.ts +1 -0
- package/dist/spinner/spinner.test.js +11 -0
- package/dist/stack/stack.d.ts +3 -0
- package/dist/stack/stack.js +186 -0
- package/dist/stack/stack.test.d.ts +1 -0
- package/dist/stack/stack.test.js +44 -0
- package/dist/stack/types.d.ts +32 -0
- package/dist/stack/types.js +1 -0
- package/dist/styles.css +3 -0
- package/dist/summary-list/summary-list.d.ts +14 -0
- package/dist/summary-list/summary-list.js +46 -0
- package/dist/summary-list/summary-list.test.d.ts +1 -0
- package/dist/summary-list/summary-list.test.js +56 -0
- package/dist/summary-list/types.d.ts +20 -0
- package/dist/summary-list/types.js +1 -0
- package/dist/table/caption.d.ts +5 -0
- package/dist/table/caption.js +15 -0
- package/dist/table/column-group.d.ts +2 -0
- package/dist/table/column-group.js +10 -0
- package/dist/table/column.d.ts +2 -0
- package/dist/table/column.js +10 -0
- package/dist/table/table-body.d.ts +2 -0
- package/dist/table/table-body.js +10 -0
- package/dist/table/table-content.d.ts +1 -0
- package/dist/table/table-content.js +26 -0
- package/dist/table/table-data.d.ts +8 -0
- package/dist/table/table-data.js +35 -0
- package/dist/table/table-foot.d.ts +2 -0
- package/dist/table/table-foot.js +10 -0
- package/dist/table/table-head.d.ts +2 -0
- package/dist/table/table-head.js +10 -0
- package/dist/table/table-header.d.ts +8 -0
- package/dist/table/table-header.js +35 -0
- package/dist/table/table-row.d.ts +2 -0
- package/dist/table/table-row.js +10 -0
- package/dist/table/table.d.ts +25 -0
- package/dist/table/table.js +33 -0
- package/dist/table/table.test.d.ts +1 -0
- package/dist/table/table.test.js +18 -0
- package/dist/tabs/tab-item.d.ts +17 -0
- package/dist/tabs/tab-item.js +42 -0
- package/dist/tabs/tab-list.d.ts +5 -0
- package/dist/tabs/tab-list.js +62 -0
- package/dist/tabs/tab-panel.d.ts +7 -0
- package/dist/tabs/tab-panel.js +22 -0
- package/dist/tabs/tabs-content.d.ts +1 -0
- package/dist/tabs/tabs-content.js +17 -0
- package/dist/tabs/tabs.d.ts +7 -0
- package/dist/tabs/tabs.js +24 -0
- package/dist/tabs/tabs.test.d.ts +1 -0
- package/dist/tabs/tabs.test.js +44 -0
- package/dist/tag/tag.d.ts +19 -0
- package/dist/tag/tag.js +27 -0
- package/dist/tag/tag.test.d.ts +1 -0
- package/dist/tag/tag.test.js +40 -0
- package/dist/test-utilities-BS7B3BF-.js +34112 -0
- package/dist/test-utilities.d.ts +8 -0
- package/dist/test-utilities.js +87 -0
- package/dist/text-input/text-input.d.ts +23 -0
- package/dist/text-input/text-input.js +7 -0
- package/dist/textarea/textarea.d.ts +13 -0
- package/dist/textarea/textarea.js +98 -0
- package/dist/toast/ds-toast.d.ts +82 -0
- package/dist/toast/ds-toast.js +116 -0
- package/dist/toast/toast.d.ts +6 -0
- package/dist/toast/toast.js +125 -0
- package/dist/toast/toast.test.d.ts +1 -0
- package/dist/toast/toast.test.js +44 -0
- package/dist/toast/types.d.ts +24 -0
- package/dist/toast/types.js +1 -0
- package/dist/tooltip/tooltip.d.ts +10 -0
- package/dist/tooltip/tooltip.js +67 -0
- package/dist/tooltip/tooltip.test.d.ts +1 -0
- package/dist/tooltip/tooltip.test.js +85 -0
- package/dist/utilities.d.ts +9 -0
- package/dist/utilities.js +13 -0
- package/dist/utils/utilities.d.ts +24 -0
- package/dist/utils/utilities.js +20 -0
- package/dist/utils/utilities.test.d.ts +1 -0
- package/dist/utils/utilities.test.js +79 -0
- package/package.json +3 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useBreakpoint as l, Breakpoint as a } from "../hooks/use-breakpoint.js";
|
|
3
|
+
import { c as p, f as d, r as h } from "../test-utilities-BS7B3BF-.js";
|
|
4
|
+
import { Pagination as x } from "./pagination.js";
|
|
5
|
+
vi.mock("../hooks/use-breakpoint.js", async () => ({
|
|
6
|
+
...await vi.importActual("../hooks/use-breakpoint.js"),
|
|
7
|
+
useBreakpoint: vi.fn()
|
|
8
|
+
}));
|
|
9
|
+
vi.mock("i18next", async (n) => {
|
|
10
|
+
const e = await n(), t = {
|
|
11
|
+
"pagination.previous": () => "Previous",
|
|
12
|
+
"pagination.next": () => "Next",
|
|
13
|
+
"pagination.page": (o) => `Page ${o == null ? void 0 : o.currentPage} of ${o == null ? void 0 : o.totalPages}`,
|
|
14
|
+
"pagination.goToPage": (o) => `Go to page ${o == null ? void 0 : o.page}`,
|
|
15
|
+
"pagination.goToPrevious": () => "Go to previous",
|
|
16
|
+
"pagination.goToNext": () => "Go to next"
|
|
17
|
+
}, i = (o, u) => {
|
|
18
|
+
var r;
|
|
19
|
+
return ((r = t[o]) == null ? void 0 : r.call(t, u)) || o;
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
...e,
|
|
23
|
+
default: {
|
|
24
|
+
...e.default,
|
|
25
|
+
isInitialized: !0,
|
|
26
|
+
t: i
|
|
27
|
+
},
|
|
28
|
+
t: i
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const c = vi.mocked(l), s = {
|
|
32
|
+
currentPage: 5,
|
|
33
|
+
totalPages: 10,
|
|
34
|
+
onPageChange: vi.fn()
|
|
35
|
+
};
|
|
36
|
+
describe("Pagination", () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
c.mockReturnValue({
|
|
39
|
+
breakpoint: a.Large,
|
|
40
|
+
width: 1024
|
|
41
|
+
});
|
|
42
|
+
}), afterEach(() => {
|
|
43
|
+
p(), vi.restoreAllMocks();
|
|
44
|
+
});
|
|
45
|
+
const n = (e) => h(/* @__PURE__ */ g(x, { ...e }));
|
|
46
|
+
it("should render the previous and next buttons", () => {
|
|
47
|
+
const e = n(s), t = e.getByText("Previous"), i = e.getByText("Next");
|
|
48
|
+
expect(t).toBeInTheDocument(), expect(i).toBeInTheDocument();
|
|
49
|
+
}), it("should not render pagination when totalPages is 0", () => {
|
|
50
|
+
const e = { ...s, totalPages: 0 }, i = n(e).container.firstChild;
|
|
51
|
+
expect(i).toBeNull();
|
|
52
|
+
}), it("should render pagination buttons and page numbers when not on XS breakpoint", () => {
|
|
53
|
+
c.mockReturnValue({
|
|
54
|
+
breakpoint: a.ExtraSmall,
|
|
55
|
+
width: 480
|
|
56
|
+
});
|
|
57
|
+
const e = n(s), t = e.getAllByRole("button");
|
|
58
|
+
expect(t.length).toBeGreaterThan(0), expect(e.getByText("Page 5 of 10")).toBeInTheDocument();
|
|
59
|
+
}), it("should render page number buttons correctly on large breakpoints", () => {
|
|
60
|
+
c.mockReturnValue({
|
|
61
|
+
breakpoint: a.Large,
|
|
62
|
+
width: 1024
|
|
63
|
+
});
|
|
64
|
+
const e = n(s);
|
|
65
|
+
for (const t of [1, 3, 4, 5, 6, 7, 10])
|
|
66
|
+
expect(e.getByText(t)).toBeInTheDocument();
|
|
67
|
+
}), it("should hide pagination buttons on XS breakpoint", () => {
|
|
68
|
+
c.mockReturnValue({
|
|
69
|
+
breakpoint: a.ExtraSmall,
|
|
70
|
+
width: 400
|
|
71
|
+
});
|
|
72
|
+
const e = n(s), t = e.queryAllByRole("button");
|
|
73
|
+
expect(t.length).toBe(2), expect(e.getByText("Page 5 of 10")).toBeInTheDocument();
|
|
74
|
+
}), it("should call onPageChange when a page button is clicked", () => {
|
|
75
|
+
c.mockReturnValue({
|
|
76
|
+
breakpoint: a.Large,
|
|
77
|
+
width: 1024
|
|
78
|
+
});
|
|
79
|
+
const t = n(s).getByText("3");
|
|
80
|
+
d.click(t), expect(s.onPageChange).toHaveBeenCalledWith(3);
|
|
81
|
+
}), it("should disable previous button on the first page", () => {
|
|
82
|
+
const e = { ...s, currentPage: 1 }, i = n(e).getByText("Previous");
|
|
83
|
+
expect(i).toBeDisabled();
|
|
84
|
+
}), it("should disable next button on the last page", () => {
|
|
85
|
+
const e = { ...s, currentPage: 10 }, i = n(e).getByText("Next");
|
|
86
|
+
expect(i).toBeDisabled();
|
|
87
|
+
}), it("should render ellipses correctly for page ranges", () => {
|
|
88
|
+
const i = n(s).getAllByTestId("govie-icon").find(
|
|
89
|
+
(o) => o.textContent === "more_horiz"
|
|
90
|
+
);
|
|
91
|
+
expect(i).toBeInTheDocument();
|
|
92
|
+
}), it("should pass accessibility tests", async () => {
|
|
93
|
+
await n(s).axe();
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ParagraphAs = 'p' | 'span';
|
|
2
|
+
export type ParagraphSize = 'lg' | 'md' | 'sm';
|
|
3
|
+
export type ParagraphAlign = 'start' | 'center' | 'end' | 'justify';
|
|
4
|
+
export type ParagraphWhitespace = 'normal' | 'pre' | 'pre-wrap' | 'break-spaces';
|
|
5
|
+
export type ParagraphProps = {
|
|
6
|
+
as?: ParagraphAs;
|
|
7
|
+
size?: ParagraphSize;
|
|
8
|
+
align?: ParagraphAlign;
|
|
9
|
+
whitespace?: ParagraphWhitespace;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
className?: string;
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
dataTestid?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function Paragraph({ as: As, size, align, whitespace, children, style, className, id, ariaLabel, dataTestid, }: ParagraphProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
function w({
|
|
3
|
+
as: e = "p",
|
|
4
|
+
size: a = "md",
|
|
5
|
+
align: r = "start",
|
|
6
|
+
whitespace: t = "normal",
|
|
7
|
+
children: s,
|
|
8
|
+
style: i,
|
|
9
|
+
className: p,
|
|
10
|
+
id: n,
|
|
11
|
+
ariaLabel: c,
|
|
12
|
+
dataTestid: g
|
|
13
|
+
}) {
|
|
14
|
+
const u = (() => {
|
|
15
|
+
switch (a) {
|
|
16
|
+
case "lg":
|
|
17
|
+
return e === "p" ? "gi-paragraph-lg" : "gi-span-lg";
|
|
18
|
+
case "sm":
|
|
19
|
+
return e === "p" ? "gi-paragraph-sm" : "gi-span-sm";
|
|
20
|
+
default:
|
|
21
|
+
return e === "p" ? "gi-paragraph-md" : "gi-span-md";
|
|
22
|
+
}
|
|
23
|
+
})(), l = (() => {
|
|
24
|
+
switch (r) {
|
|
25
|
+
case "center":
|
|
26
|
+
return "gi-text-center";
|
|
27
|
+
case "end":
|
|
28
|
+
return "gi-text-end";
|
|
29
|
+
case "justify":
|
|
30
|
+
return "gi-text-justify";
|
|
31
|
+
default:
|
|
32
|
+
return "gi-text-start";
|
|
33
|
+
}
|
|
34
|
+
})(), h = (() => {
|
|
35
|
+
switch (t) {
|
|
36
|
+
case "pre":
|
|
37
|
+
return "gi-whitespace-pre";
|
|
38
|
+
case "pre-wrap":
|
|
39
|
+
return "gi-whitespace-pre-wrap";
|
|
40
|
+
case "break-spaces":
|
|
41
|
+
return "gi-whitespace-break-spaces";
|
|
42
|
+
default:
|
|
43
|
+
return "gi-whitespace-normal";
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
return /* @__PURE__ */ m(
|
|
47
|
+
e,
|
|
48
|
+
{
|
|
49
|
+
className: `${u} ${l} ${h} ${p || ""}`,
|
|
50
|
+
"aria-label": c,
|
|
51
|
+
style: i,
|
|
52
|
+
id: n,
|
|
53
|
+
"data-testid": g,
|
|
54
|
+
children: s
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
w as Paragraph
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as n, r } from "../test-utilities-BS7B3BF-.js";
|
|
3
|
+
import { Paragraph as c } from "./paragraph.js";
|
|
4
|
+
describe("govieParagraph", () => {
|
|
5
|
+
afterEach(n);
|
|
6
|
+
const s = (t) => r(/* @__PURE__ */ a(c, { ...t }));
|
|
7
|
+
it('should render a paragraph with the correct content when props.as is "p"', () => {
|
|
8
|
+
const e = s({
|
|
9
|
+
as: "p",
|
|
10
|
+
children: "This is a paragraph",
|
|
11
|
+
size: "md"
|
|
12
|
+
}).getByText("This is a paragraph");
|
|
13
|
+
expect(e).toBeTruthy(), expect(e.tagName).toBe("P");
|
|
14
|
+
}), it('should render a span with the correct content when props.as is "span"', () => {
|
|
15
|
+
const e = s({
|
|
16
|
+
as: "span",
|
|
17
|
+
children: "This is a span",
|
|
18
|
+
size: "lg"
|
|
19
|
+
}).getByText("This is a span");
|
|
20
|
+
expect(e).toBeTruthy(), expect(e.tagName).toBe("SPAN");
|
|
21
|
+
}), it('should have correct text size classes for "lg"', () => {
|
|
22
|
+
const e = s({
|
|
23
|
+
as: "p",
|
|
24
|
+
children: "Large text",
|
|
25
|
+
size: "lg"
|
|
26
|
+
}).getByText("Large text");
|
|
27
|
+
expect(e.classList.contains("gi-paragraph-lg")).toBe(!0);
|
|
28
|
+
}), it('should have correct text size classes for "md"', () => {
|
|
29
|
+
const e = s({
|
|
30
|
+
as: "span",
|
|
31
|
+
children: "Medium text",
|
|
32
|
+
size: "md"
|
|
33
|
+
}).getByText("Medium text");
|
|
34
|
+
expect(e.classList.contains("gi-span-md")).toBe(!0);
|
|
35
|
+
}), it('should have correct text size classes for "sm"', () => {
|
|
36
|
+
const e = s({
|
|
37
|
+
as: "p",
|
|
38
|
+
children: "Small text",
|
|
39
|
+
size: "sm"
|
|
40
|
+
}).getByText("Small text");
|
|
41
|
+
expect(e.classList.contains("gi-paragraph-sm")).toBe(!0);
|
|
42
|
+
}), it("should have aligned end", () => {
|
|
43
|
+
const e = s({
|
|
44
|
+
as: "p",
|
|
45
|
+
children: "Small text",
|
|
46
|
+
align: "end"
|
|
47
|
+
}).getByText("Small text");
|
|
48
|
+
expect(e.classList.contains("gi-text-end")).toBe(!0);
|
|
49
|
+
}), it("should safely render HTML content", () => {
|
|
50
|
+
const e = s({
|
|
51
|
+
as: "p",
|
|
52
|
+
children: /* @__PURE__ */ a("a", { href: "#", children: "Anchor tag" }),
|
|
53
|
+
size: "sm"
|
|
54
|
+
}).getByText("Anchor tag");
|
|
55
|
+
expect(e).toBeTruthy(), expect(e.innerHTML).toContain("Anchor tag");
|
|
56
|
+
}), it("should pass axe accessibility tests", async () => {
|
|
57
|
+
await s({
|
|
58
|
+
as: "p",
|
|
59
|
+
children: "Accessible paragraph",
|
|
60
|
+
size: "md"
|
|
61
|
+
}).axe();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function i({ level: a, children: n }) {
|
|
3
|
+
return /* @__PURE__ */ r("div", { "data-testid": "phase-banner", className: "gi-phase-banner-container", children: [
|
|
4
|
+
/* @__PURE__ */ e("div", { className: "gi-phase-banner", children: a }),
|
|
5
|
+
/* @__PURE__ */ e("div", { children: n })
|
|
6
|
+
] });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
i as PhaseBanner
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { c, r as h } from "../test-utilities-BS7B3BF-.js";
|
|
3
|
+
import { PhaseBanner as i } from "./phase-banner.js";
|
|
4
|
+
describe("goviePhaseBanner", () => {
|
|
5
|
+
afterEach(c);
|
|
6
|
+
const a = (s) => h(/* @__PURE__ */ r(i, { ...s }));
|
|
7
|
+
it("should render a phase-banner with alpha level", () => {
|
|
8
|
+
var t, n;
|
|
9
|
+
const e = a({
|
|
10
|
+
children: "This is a phase-banner",
|
|
11
|
+
level: "alpha"
|
|
12
|
+
}).getByTestId("phase-banner");
|
|
13
|
+
expect(e).toBeTruthy(), expect((n = (t = e.firstElementChild) == null ? void 0 : t.textContent) == null ? void 0 : n.trim()).toBe("alpha");
|
|
14
|
+
}), it('should render a span with the correct content when props.as is "span"', () => {
|
|
15
|
+
var t, n;
|
|
16
|
+
const e = a({
|
|
17
|
+
children: "This is a span",
|
|
18
|
+
level: "beta"
|
|
19
|
+
}).getByTestId("phase-banner");
|
|
20
|
+
expect(e).toBeTruthy(), expect((n = (t = e.firstElementChild) == null ? void 0 : t.textContent) == null ? void 0 : n.trim()).toBe("beta");
|
|
21
|
+
}), it("should pass axe accessibility tests", async () => {
|
|
22
|
+
await a({
|
|
23
|
+
children: "Accessible phase-banner",
|
|
24
|
+
level: "alpha"
|
|
25
|
+
}).axe();
|
|
26
|
+
});
|
|
27
|
+
});
|