@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,67 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Link as r } from "../link/link.js";
|
|
3
|
+
import { c as a, r as h } from "../test-utilities-BS7B3BF-.js";
|
|
4
|
+
import { List as p, ListTypeEnum as n } from "./list.js";
|
|
5
|
+
describe("govieList", () => {
|
|
6
|
+
afterEach(a);
|
|
7
|
+
const i = (t) => h(/* @__PURE__ */ c(p, { ...t, "data-testid": "govieList" }));
|
|
8
|
+
it("should render a list correctly with items", () => {
|
|
9
|
+
const t = ["Item 1", "Item 2", "Item 3", "Item 4"], s = i({
|
|
10
|
+
items: t
|
|
11
|
+
}), e = s.getByRole("list");
|
|
12
|
+
for (const o of t)
|
|
13
|
+
expect(s.getByText(o)).toBeInTheDocument();
|
|
14
|
+
expect(e).toBeInTheDocument();
|
|
15
|
+
}), it("should render a list of links correctly", () => {
|
|
16
|
+
const t = [/* @__PURE__ */ c(r, { href: "#", children: "Link 1" }), /* @__PURE__ */ c(r, { href: "#", children: "Link 2" })], s = i({
|
|
17
|
+
items: t
|
|
18
|
+
}), e = s.getByRole("list"), o = s.getAllByRole("link");
|
|
19
|
+
for (const l of o) {
|
|
20
|
+
const m = l.getAttribute("href");
|
|
21
|
+
expect(m).toEqual("#");
|
|
22
|
+
}
|
|
23
|
+
expect(o.length).toBe(t.length), expect(e).toBeInTheDocument();
|
|
24
|
+
}), it('should have correct className for default type "normal"', () => {
|
|
25
|
+
const e = i({
|
|
26
|
+
items: ["Item 1", "Item 2", "Item 3", "Item 4"]
|
|
27
|
+
}).getByTestId("govieList");
|
|
28
|
+
expect(e.classList.contains("gi-list")).toBe(!0);
|
|
29
|
+
}), it('should have correct className when type is "number"', () => {
|
|
30
|
+
const e = i({
|
|
31
|
+
items: ["Item 1", "Item 2", "Item 3", "Item 4"],
|
|
32
|
+
type: n.Number
|
|
33
|
+
}).getByTestId("govieList");
|
|
34
|
+
expect(e.classList.contains("gi-list-number")).toBe(!0);
|
|
35
|
+
}), it('should have correct className when type is "bullet"', () => {
|
|
36
|
+
const e = i({
|
|
37
|
+
items: ["Item 1", "Item 2", "Item 3", "Item 4"],
|
|
38
|
+
type: n.Bullet
|
|
39
|
+
}).getByTestId("govieList");
|
|
40
|
+
expect(e.classList.contains("gi-list-bullet")).toBe(!0);
|
|
41
|
+
}), it('should have correct className when type is "none"', () => {
|
|
42
|
+
const e = i({
|
|
43
|
+
items: ["Item 1", "Item 2", "Item 3", "Item 4"],
|
|
44
|
+
type: n.None
|
|
45
|
+
}).getByTestId("govieList");
|
|
46
|
+
expect(e.classList.contains("gi-list")).toBe(!0);
|
|
47
|
+
}), it('should have correct className when is "spaced"', () => {
|
|
48
|
+
const e = i({
|
|
49
|
+
items: ["Item 1", "Item 2", "Item 3", "Item 4"],
|
|
50
|
+
spaced: !0
|
|
51
|
+
}).getByTestId("govieList");
|
|
52
|
+
expect(e.classList.contains("gi-list-spaced")).toBe(!0);
|
|
53
|
+
}), it('should have correct "spaced" class combined with the "type" class', () => {
|
|
54
|
+
const e = i({
|
|
55
|
+
items: ["Item 1", "Item 2", "Item 3", "Item 4"],
|
|
56
|
+
spaced: !0,
|
|
57
|
+
type: n.Bullet
|
|
58
|
+
}).getByTestId("govieList");
|
|
59
|
+
expect(e.classList.contains("gi-list-spaced")).toBe(!0), expect(e.classList.contains("gi-list-bullet")).toBe(!0);
|
|
60
|
+
}), it("should pass axe accessibility tests", async () => {
|
|
61
|
+
await i({
|
|
62
|
+
items: [/* @__PURE__ */ c(r, { href: "#", children: "Link 1" }), /* @__PURE__ */ c(r, { href: "#", children: "Link 2" })],
|
|
63
|
+
spaced: !0,
|
|
64
|
+
type: n.Number
|
|
65
|
+
}).axe();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ListItemProps = {
|
|
2
|
+
label?: string;
|
|
3
|
+
action?: () => void;
|
|
4
|
+
href?: string;
|
|
5
|
+
external?: boolean;
|
|
6
|
+
bold?: boolean;
|
|
7
|
+
slot?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare function ListItem({ label, href, external, bold, slot }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { cn as n } from "../cn.js";
|
|
3
|
+
import s from "../primitives/anchor.js";
|
|
4
|
+
function f({ label: i, href: t, external: o, bold: e, slot: r }) {
|
|
5
|
+
return /* @__PURE__ */ m(
|
|
6
|
+
s,
|
|
7
|
+
{
|
|
8
|
+
"aria-label": i,
|
|
9
|
+
href: t,
|
|
10
|
+
className: n("gi-list-item", { "gi-font-bold": e }),
|
|
11
|
+
external: o,
|
|
12
|
+
asChild: !!r,
|
|
13
|
+
children: r || /* @__PURE__ */ m("span", { className: "gi-text-sm gi-ml-1", children: i })
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
f as ListItem
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as i, Fragment as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Button as o } from "../button/button.js";
|
|
3
|
+
import { ModalTitle as e, ModalBody as a, ModalFooter as n } from "./modal.js";
|
|
4
|
+
const c = /* @__PURE__ */ i(r, { children: [
|
|
5
|
+
/* @__PURE__ */ t(e, { children: "Modal Title" }),
|
|
6
|
+
/* @__PURE__ */ t(a, { children: /* @__PURE__ */ t("p", { className: "gi-paragraph-md", children: "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Aperiam molestias error accusantium non nobis excepturi doloremque dolorem possimus corrupti. Nostrum quisquam est voluptate! Iure suscipit, commodi cupiditate sit minima veritatis." }) }),
|
|
7
|
+
/* @__PURE__ */ t(n, { children: /* @__PURE__ */ t(o, { children: "Primary" }) })
|
|
8
|
+
] }), d = /* @__PURE__ */ t(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
"data-testid": "trigger-button-container",
|
|
12
|
+
className: "gi-btn gi-btn-primary gi-btn-regular",
|
|
13
|
+
children: "Open Modal"
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
export {
|
|
17
|
+
c as HtmlContent,
|
|
18
|
+
d as TriggerButton
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HeadingProps } from '../heading/heading.js';
|
|
3
|
+
import { ModalFooterProps, ModalProps, ModalWrapperProps } from './types.js';
|
|
4
|
+
export declare const ModalWrapper: ({ position, size, closeOnClick, closeOnOverlayClick, isOpen, onClose, closeButtonLabel, className, children, closeButtonSize, dataTestId, ...props }: ModalWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ModalTitle: ({ children, as, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const ModalBody: ({ children, className, }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const ModalFooter: ({ className, children, orientation, dataModalSize, }: ModalFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const Modal: ({ children, triggerButton, startsOpen, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as p, Fragment as T } from "react/jsx-runtime";
|
|
3
|
+
import { Children as x, cloneElement as f, isValidElement as k, useState as F } from "react";
|
|
4
|
+
import { Button as A } from "../button/button.js";
|
|
5
|
+
import { cn as s } from "../cn.js";
|
|
6
|
+
import { Heading as I } from "../heading/heading.js";
|
|
7
|
+
import { Icon as E } from "../icon/icon.js";
|
|
8
|
+
import { IconButton as R } from "../icon-button/icon-button.js";
|
|
9
|
+
const v = (e, a, t) => {
|
|
10
|
+
var i;
|
|
11
|
+
return k(t) ? t.type === e || ((i = t == null ? void 0 : t._owner) == null ? void 0 : i.name) === a : !1;
|
|
12
|
+
}, B = {
|
|
13
|
+
flat: 0,
|
|
14
|
+
secondary: 1,
|
|
15
|
+
primary: 2
|
|
16
|
+
}, O = ({
|
|
17
|
+
label: e,
|
|
18
|
+
size: a = "small",
|
|
19
|
+
...t
|
|
20
|
+
}) => {
|
|
21
|
+
let n = "sm";
|
|
22
|
+
return (a === "large" || a === "medium") && (n = "md"), e ? /* @__PURE__ */ r(
|
|
23
|
+
A,
|
|
24
|
+
{
|
|
25
|
+
onClick: t.onClick,
|
|
26
|
+
variant: "flat",
|
|
27
|
+
size: a,
|
|
28
|
+
appearance: "dark",
|
|
29
|
+
className: "gi-modal-icon",
|
|
30
|
+
"aria-label": e,
|
|
31
|
+
...t,
|
|
32
|
+
children: /* @__PURE__ */ p(T, { children: [
|
|
33
|
+
e,
|
|
34
|
+
/* @__PURE__ */ r(E, { icon: "close", size: n })
|
|
35
|
+
] })
|
|
36
|
+
}
|
|
37
|
+
) : /* @__PURE__ */ r(
|
|
38
|
+
R,
|
|
39
|
+
{
|
|
40
|
+
className: "gi-modal-icon",
|
|
41
|
+
icon: {
|
|
42
|
+
icon: "close"
|
|
43
|
+
},
|
|
44
|
+
"aria-label": "Close modal",
|
|
45
|
+
onClick: t.onClick,
|
|
46
|
+
variant: "flat",
|
|
47
|
+
size: a,
|
|
48
|
+
appearance: "dark",
|
|
49
|
+
...t
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}, V = ({
|
|
53
|
+
position: e = "center",
|
|
54
|
+
size: a = "lg",
|
|
55
|
+
closeOnClick: t = !0,
|
|
56
|
+
closeOnOverlayClick: n = !0,
|
|
57
|
+
isOpen: i,
|
|
58
|
+
onClose: c,
|
|
59
|
+
closeButtonLabel: d,
|
|
60
|
+
className: m,
|
|
61
|
+
children: o,
|
|
62
|
+
closeButtonSize: g,
|
|
63
|
+
dataTestId: u,
|
|
64
|
+
...y
|
|
65
|
+
}) => {
|
|
66
|
+
const h = x.toArray(o), C = h.find(
|
|
67
|
+
(l) => v(M, "ModalTitle", l)
|
|
68
|
+
), N = h.find(
|
|
69
|
+
(l) => v(_, "ModalFooter", l)
|
|
70
|
+
), b = C ? f(C, {
|
|
71
|
+
as: a === "sm" ? "h5" : "h4"
|
|
72
|
+
}) : null, j = h.map(
|
|
73
|
+
(l) => N ? f(l, {
|
|
74
|
+
dataModalSize: a
|
|
75
|
+
}) : l
|
|
76
|
+
).filter((l) => !v(M, "ModalTitle", l));
|
|
77
|
+
return /* @__PURE__ */ r(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
...y,
|
|
81
|
+
className: s("gi-modal", {
|
|
82
|
+
"gi-modal-open": i,
|
|
83
|
+
"gi-modal-close": !i
|
|
84
|
+
}),
|
|
85
|
+
"data-testid": u || "modal",
|
|
86
|
+
"data-element": "modal",
|
|
87
|
+
role: "dialog",
|
|
88
|
+
"aria-modal": "true",
|
|
89
|
+
"aria-describedby": "gi-modal-body",
|
|
90
|
+
onClick: (l) => {
|
|
91
|
+
l.target.dataset.element === "modal" && t && n && c();
|
|
92
|
+
},
|
|
93
|
+
children: /* @__PURE__ */ p(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
"data-testid": "modal-container",
|
|
97
|
+
"data-size": a,
|
|
98
|
+
"data-position": e,
|
|
99
|
+
className: s(
|
|
100
|
+
"gi-modal-container-control",
|
|
101
|
+
{
|
|
102
|
+
"gi-modal-container": !m,
|
|
103
|
+
"gi-modal-container-center": e === "center",
|
|
104
|
+
"gi-modal-container-left": e === "left",
|
|
105
|
+
"gi-modal-container-right": e === "right",
|
|
106
|
+
"gi-modal-container-bottom": e === "bottom"
|
|
107
|
+
},
|
|
108
|
+
m
|
|
109
|
+
),
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ p("div", { children: [
|
|
112
|
+
b,
|
|
113
|
+
t && /* @__PURE__ */ r(
|
|
114
|
+
O,
|
|
115
|
+
{
|
|
116
|
+
onClick: c,
|
|
117
|
+
label: d,
|
|
118
|
+
size: g
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ r(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: s({
|
|
126
|
+
"gi-pb-6": !N
|
|
127
|
+
}),
|
|
128
|
+
children: j
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}, M = ({ children: e, as: a = "h4", ...t }) => /* @__PURE__ */ r("div", { className: "gi-flex-1", id: "gi-modal-title", children: /* @__PURE__ */ r(I, { as: a, ...t, children: e }) }), J = ({
|
|
137
|
+
children: e,
|
|
138
|
+
className: a
|
|
139
|
+
}) => /* @__PURE__ */ r(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
id: "gi-modal-body",
|
|
143
|
+
className: s(
|
|
144
|
+
{
|
|
145
|
+
"gi-modal-body": !a
|
|
146
|
+
},
|
|
147
|
+
a
|
|
148
|
+
),
|
|
149
|
+
children: e
|
|
150
|
+
}
|
|
151
|
+
), _ = ({
|
|
152
|
+
className: e,
|
|
153
|
+
children: a,
|
|
154
|
+
orientation: t,
|
|
155
|
+
dataModalSize: n
|
|
156
|
+
}) => {
|
|
157
|
+
const d = (Array.isArray(a) ? a : [a]).filter(
|
|
158
|
+
(o) => k(o) && o.type === A
|
|
159
|
+
).sort((o, g) => {
|
|
160
|
+
const u = o.props.variant ?? "primary", y = g.props.variant ?? "primary";
|
|
161
|
+
return (B[u] || 0) - (B[y] || 0);
|
|
162
|
+
}), m = s({
|
|
163
|
+
"gi-justify-center sm:gi-justify-start": !t && n !== "sm",
|
|
164
|
+
"gi-justify-center": t === "vertical" || n === "sm",
|
|
165
|
+
"gi-justify-start": t === "horizontal"
|
|
166
|
+
});
|
|
167
|
+
return /* @__PURE__ */ r(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: s(e, {
|
|
171
|
+
"gi-pt-6": d.length === 0,
|
|
172
|
+
"gi-modal-footer": d.length
|
|
173
|
+
}),
|
|
174
|
+
children: d.length > 0 && /* @__PURE__ */ r(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
"data-orientation": t || "unset",
|
|
178
|
+
"data-modal-size": n,
|
|
179
|
+
children: d.map(
|
|
180
|
+
(o) => {
|
|
181
|
+
var g;
|
|
182
|
+
return f(o, {
|
|
183
|
+
className: s((g = o == null ? void 0 : o.props) == null ? void 0 : g.className, m)
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
) || null
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}, K = ({
|
|
192
|
+
children: e,
|
|
193
|
+
triggerButton: a,
|
|
194
|
+
startsOpen: t,
|
|
195
|
+
...n
|
|
196
|
+
}) => {
|
|
197
|
+
const [i, c] = F(!!t), d = () => c(!0), m = () => c(!1), o = f(a, {
|
|
198
|
+
"data-testid": "modal-trigger-button-container",
|
|
199
|
+
"aria-haspopup": "dialog",
|
|
200
|
+
onClick: d
|
|
201
|
+
});
|
|
202
|
+
return /* @__PURE__ */ p(T, { children: [
|
|
203
|
+
o,
|
|
204
|
+
/* @__PURE__ */ r(
|
|
205
|
+
V,
|
|
206
|
+
{
|
|
207
|
+
onClose: m,
|
|
208
|
+
position: "center",
|
|
209
|
+
isOpen: i,
|
|
210
|
+
...n,
|
|
211
|
+
children: e
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] });
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
K as Modal,
|
|
218
|
+
J as ModalBody,
|
|
219
|
+
_ as ModalFooter,
|
|
220
|
+
M as ModalTitle,
|
|
221
|
+
V as ModalWrapper
|
|
222
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as a, Fragment as m, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { act as d } from "react";
|
|
3
|
+
import { Button as i } from "../button/button.js";
|
|
4
|
+
import { c as u, w as c, r as B } from "../test-utilities-BS7B3BF-.js";
|
|
5
|
+
import { HtmlContent as s, TriggerButton as r } from "./modal.content.js";
|
|
6
|
+
import { Modal as p, ModalFooter as y } from "./modal.js";
|
|
7
|
+
describe("modal", () => {
|
|
8
|
+
afterEach(u);
|
|
9
|
+
const n = (t) => B(/* @__PURE__ */ a(p, { ...t }));
|
|
10
|
+
it("should render the modal on load if startsOpen is true", () => {
|
|
11
|
+
const t = n({
|
|
12
|
+
children: s,
|
|
13
|
+
triggerButton: r,
|
|
14
|
+
startsOpen: !0
|
|
15
|
+
}), o = t.getByTestId("modal"), e = t.getByTestId("modal-container");
|
|
16
|
+
expect(o.classList.contains("gi-modal-open")).toBe(!0), expect(e).toBeTruthy();
|
|
17
|
+
}), it("should open the modal on button trigger", async () => {
|
|
18
|
+
const t = n({
|
|
19
|
+
children: s,
|
|
20
|
+
triggerButton: r
|
|
21
|
+
});
|
|
22
|
+
t.getByTestId(
|
|
23
|
+
"modal-trigger-button-container"
|
|
24
|
+
).click(), await c(() => {
|
|
25
|
+
const e = t.getByTestId("modal");
|
|
26
|
+
expect(e.classList.contains("gi-modal-open")).toBe(!0);
|
|
27
|
+
});
|
|
28
|
+
}), it("should close the modal on icon click", async () => {
|
|
29
|
+
const t = n({
|
|
30
|
+
children: s,
|
|
31
|
+
triggerButton: r
|
|
32
|
+
}), o = t.getByTestId("modal"), e = t.getByTestId(
|
|
33
|
+
"modal-trigger-button-container"
|
|
34
|
+
);
|
|
35
|
+
expect(o.classList.contains("gi-modal-open")).toBe(!1), await d(async () => {
|
|
36
|
+
e.click();
|
|
37
|
+
}), await c(() => {
|
|
38
|
+
expect(o.classList.contains("gi-modal-open")).toBe(!0);
|
|
39
|
+
});
|
|
40
|
+
const l = t.getByTestId("modal-container").querySelector(".gi-modal-icon");
|
|
41
|
+
expect(l).toBeVisible(), await d(async () => {
|
|
42
|
+
l.click();
|
|
43
|
+
});
|
|
44
|
+
}), it("should close the modal on overlay click", async () => {
|
|
45
|
+
const t = n({
|
|
46
|
+
children: s,
|
|
47
|
+
triggerButton: r
|
|
48
|
+
});
|
|
49
|
+
t.getByTestId(
|
|
50
|
+
"modal-trigger-button-container"
|
|
51
|
+
).click(), await c(() => {
|
|
52
|
+
const e = t.getByTestId("modal");
|
|
53
|
+
expect(e.classList.contains("gi-modal-open")).toBe(!0), e.click();
|
|
54
|
+
}), await c(() => {
|
|
55
|
+
const e = t.getByTestId("modal");
|
|
56
|
+
expect(e.classList.contains("gi-modal-open")).toBe(!1);
|
|
57
|
+
});
|
|
58
|
+
}), it("should render modal footer buttons in correct order", async () => {
|
|
59
|
+
const t = n({
|
|
60
|
+
dataTestId: "modal-footer",
|
|
61
|
+
children: /* @__PURE__ */ a(m, { children: /* @__PURE__ */ g(y, { children: [
|
|
62
|
+
/* @__PURE__ */ a(i, { variant: "flat", children: "Help" }),
|
|
63
|
+
/* @__PURE__ */ a(i, { variant: "secondary", children: "Cancel" }),
|
|
64
|
+
/* @__PURE__ */ a(i, { variant: "primary", children: "Save" })
|
|
65
|
+
] }) }),
|
|
66
|
+
triggerButton: r,
|
|
67
|
+
startsOpen: !0
|
|
68
|
+
});
|
|
69
|
+
t.getByTestId(
|
|
70
|
+
"modal-trigger-button-container"
|
|
71
|
+
).click(), await c(() => {
|
|
72
|
+
const e = t.getByTestId("modal-footer").querySelectorAll("button");
|
|
73
|
+
expect(e).toHaveLength(4), expect(e[0].textContent).toBe("close"), expect(e[1].textContent).toBe("Help"), expect(e[2].textContent).toBe("Cancel"), expect(e[3].textContent).toBe("Save");
|
|
74
|
+
});
|
|
75
|
+
}), it("should pass axe accessibility tests", async () => {
|
|
76
|
+
await n({
|
|
77
|
+
children: s,
|
|
78
|
+
triggerButton: r
|
|
79
|
+
}).axe();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps, ButtonSize, ButtonVariant } from '../button/types.js';
|
|
3
|
+
import { IconButtonProps } from '../icon-button/icon-button.js';
|
|
4
|
+
import { ModalBody, ModalFooter, ModalTitle } from './modal.js';
|
|
5
|
+
export type ModalPositions = 'center' | 'left' | 'right' | 'bottom';
|
|
6
|
+
export type ModalFooterOrientation = 'vertical' | 'horizontal';
|
|
7
|
+
export type ModalChildren = Array<ReactElement<typeof ModalTitle | typeof ModalBody | typeof ModalFooter>> | ReactElement<typeof ModalTitle | typeof ModalBody | typeof ModalFooter>;
|
|
8
|
+
export type ModalWrapperProps = {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
position?: ModalPositions;
|
|
12
|
+
closeButtonSize?: ButtonSize;
|
|
13
|
+
} & Omit<ModalProps, 'triggerButton'>;
|
|
14
|
+
export type ModalSize = 'sm' | 'md' | 'lg';
|
|
15
|
+
export type ModalProps = React.AriaAttributes & {
|
|
16
|
+
className?: string;
|
|
17
|
+
closeButtonLabel?: string;
|
|
18
|
+
triggerButton: React.ReactElement;
|
|
19
|
+
children: ModalChildren;
|
|
20
|
+
startsOpen?: boolean;
|
|
21
|
+
closeOnClick?: boolean;
|
|
22
|
+
closeOnOverlayClick?: boolean;
|
|
23
|
+
dataTestId?: string;
|
|
24
|
+
size?: ModalSize;
|
|
25
|
+
};
|
|
26
|
+
export type ModalCloseButtonProps = {
|
|
27
|
+
label?: string;
|
|
28
|
+
} & Omit<IconButtonProps, 'className' | 'icon' | 'variant' | 'appearance'>;
|
|
29
|
+
export type ModalFooterButton = {
|
|
30
|
+
label: string;
|
|
31
|
+
variant: ButtonVariant;
|
|
32
|
+
} & ButtonProps;
|
|
33
|
+
export type ModalFooterProps = {
|
|
34
|
+
className?: string;
|
|
35
|
+
orientation?: ModalFooterOrientation;
|
|
36
|
+
dataTestId?: string;
|
|
37
|
+
dataModalSize?: ModalSize;
|
|
38
|
+
children: React.ReactElement<ButtonProps> | React.ReactElement<ButtonProps>[];
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import d, { useState as V, useEffect as T } from "react";
|
|
4
|
+
import { Button as c } from "../button/button.js";
|
|
5
|
+
import { useBreakpoint as _, Breakpoint as u } from "../hooks/use-breakpoint.js";
|
|
6
|
+
import { translate as t } from "../i18n/utility.js";
|
|
7
|
+
import { Icon as m } from "../icon/icon.js";
|
|
8
|
+
import { getDisplayPages as g } from "../utils/utilities.js";
|
|
9
|
+
const R = ({
|
|
10
|
+
currentPage: a,
|
|
11
|
+
totalPages: n,
|
|
12
|
+
onPageChange: l,
|
|
13
|
+
dataTestid: b
|
|
14
|
+
}) => {
|
|
15
|
+
if (n === 0)
|
|
16
|
+
return null;
|
|
17
|
+
const { breakpoint: r, width: f } = _(), [s, v] = V(!1);
|
|
18
|
+
T(() => {
|
|
19
|
+
v(!0);
|
|
20
|
+
}, []);
|
|
21
|
+
const x = s && r === u.ExtraSmall, o = s && f !== null && f < 639, h = () => (s && r ? g(a, n, r) : g(a, n, u.Large)).map(
|
|
22
|
+
(e, N) => e === -1 || e === -2 ? /* @__PURE__ */ i(d.Fragment, { children: /* @__PURE__ */ i(
|
|
23
|
+
m,
|
|
24
|
+
{
|
|
25
|
+
role: "presentation",
|
|
26
|
+
className: "gi-text-gray-700",
|
|
27
|
+
icon: "more_horiz"
|
|
28
|
+
}
|
|
29
|
+
) }, `ellipsis-${N}`) : /* @__PURE__ */ i(
|
|
30
|
+
c,
|
|
31
|
+
{
|
|
32
|
+
variant: e === a ? "primary" : "flat",
|
|
33
|
+
size: "large",
|
|
34
|
+
appearance: "dark",
|
|
35
|
+
onClick: () => l(e),
|
|
36
|
+
"aria-label": t("pagination.goToPage", {
|
|
37
|
+
page: e,
|
|
38
|
+
defaultValue: `Go to page ${e}`
|
|
39
|
+
}),
|
|
40
|
+
children: e
|
|
41
|
+
},
|
|
42
|
+
e
|
|
43
|
+
)
|
|
44
|
+
), k = () => /* @__PURE__ */ i("span", { className: "gi-text-md", "aria-live": "polite", children: /* @__PURE__ */ i("span", { className: "gi-font-bold", children: t("pagination.page", {
|
|
45
|
+
currentPage: a,
|
|
46
|
+
totalPages: n,
|
|
47
|
+
defaultValue: `Page ${a} of ${n}`
|
|
48
|
+
}) }) });
|
|
49
|
+
return /* @__PURE__ */ p(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: "gi-pagination",
|
|
53
|
+
role: "navigation",
|
|
54
|
+
"aria-label": t("pagination.page", {
|
|
55
|
+
currentPage: a,
|
|
56
|
+
totalPages: n,
|
|
57
|
+
defaultValue: `Page ${a} of ${n}`
|
|
58
|
+
}),
|
|
59
|
+
"data-testid": b,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ p(
|
|
62
|
+
c,
|
|
63
|
+
{
|
|
64
|
+
variant: "flat",
|
|
65
|
+
size: "large",
|
|
66
|
+
appearance: "dark",
|
|
67
|
+
disabled: a === 1,
|
|
68
|
+
onClick: () => l(a - 1),
|
|
69
|
+
"aria-label": t("pagination.goToPrevious", {
|
|
70
|
+
defaultValue: "Go to previous"
|
|
71
|
+
}),
|
|
72
|
+
className: o ? "gi-icon-btn-large" : "",
|
|
73
|
+
dataTestid: "govie-pagination-prev-btn",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ i(d.Fragment, { children: /* @__PURE__ */ i(m, { icon: "arrow_left_alt" }) }, "previous-btn-pagination"),
|
|
76
|
+
!o && t("pagination.previous", { defaultValue: "Previous" })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
x ? k() : h(),
|
|
81
|
+
/* @__PURE__ */ p(
|
|
82
|
+
c,
|
|
83
|
+
{
|
|
84
|
+
disabled: a === n,
|
|
85
|
+
variant: "flat",
|
|
86
|
+
size: "large",
|
|
87
|
+
appearance: "dark",
|
|
88
|
+
onClick: () => l(a + 1),
|
|
89
|
+
"aria-label": t("pagination.goToNext", { defaultValue: "Go to next" }),
|
|
90
|
+
className: o ? "gi-icon-btn-large" : "",
|
|
91
|
+
dataTestid: "govie-pagination-next-btn",
|
|
92
|
+
children: [
|
|
93
|
+
!o && t("pagination.next", { defaultValue: "Next" }),
|
|
94
|
+
/* @__PURE__ */ i(d.Fragment, { children: /* @__PURE__ */ i(m, { icon: "arrow_right_alt" }) }, "next-btn-pagination")
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
R as Pagination
|
|
104
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|