@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
|
+
"use client";
|
|
2
|
+
import { jsxs as b, jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import { useState as c, useId as h, useCallback as d, useEffect as v } from "react";
|
|
4
|
+
import { c as y } from "../index-DNkhmzZp.js";
|
|
5
|
+
const T = ["top", "bottom", "left", "right"], E = y({
|
|
6
|
+
base: "gi-tooltip",
|
|
7
|
+
variants: {
|
|
8
|
+
position: {
|
|
9
|
+
left: "gi-tooltip-left",
|
|
10
|
+
right: "gi-tooltip-right",
|
|
11
|
+
top: "gi-tooltip-top",
|
|
12
|
+
bottom: "gi-tooltip-bottom"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}), F = ({
|
|
16
|
+
text: o,
|
|
17
|
+
position: i = "top",
|
|
18
|
+
dataTestid: p,
|
|
19
|
+
children: u
|
|
20
|
+
}) => {
|
|
21
|
+
const [e, n] = c(!1), [f, a] = c(!1), l = h(), r = () => n(!0), t = d(() => {
|
|
22
|
+
n(!1), a(!1);
|
|
23
|
+
}, []), s = d(
|
|
24
|
+
(m) => {
|
|
25
|
+
m.key === "Escape" && t();
|
|
26
|
+
},
|
|
27
|
+
[t]
|
|
28
|
+
);
|
|
29
|
+
return v(() => (document.addEventListener("keydown", s), () => {
|
|
30
|
+
document.removeEventListener("keydown", s);
|
|
31
|
+
}), [s]), /* @__PURE__ */ b(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: "gi-tooltip-wrapper",
|
|
35
|
+
onMouseEnter: r,
|
|
36
|
+
onMouseLeave: () => {
|
|
37
|
+
f || t();
|
|
38
|
+
},
|
|
39
|
+
onFocus: () => {
|
|
40
|
+
a(!0), r();
|
|
41
|
+
},
|
|
42
|
+
onBlur: () => {
|
|
43
|
+
t();
|
|
44
|
+
},
|
|
45
|
+
"aria-describedby": e ? l : void 0,
|
|
46
|
+
"data-testid": p,
|
|
47
|
+
children: [
|
|
48
|
+
u,
|
|
49
|
+
e && /* @__PURE__ */ g(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
id: l,
|
|
53
|
+
role: "tooltip",
|
|
54
|
+
className: E({ position: i }),
|
|
55
|
+
"aria-hidden": !e,
|
|
56
|
+
"data-testid": `dti-tooltip-content-${i}`,
|
|
57
|
+
children: o.length > 100 ? o.slice(0, 100) + "..." : o
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
F as Tooltip,
|
|
66
|
+
T as positionVariants
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as r, t as s, f as l, r as c } from "../test-utilities-BS7B3BF-.js";
|
|
3
|
+
import { positionVariants as p, Tooltip as x } from "./tooltip.js";
|
|
4
|
+
describe("govieTooltip", () => {
|
|
5
|
+
afterEach(r);
|
|
6
|
+
const n = (t) => c(/* @__PURE__ */ o(x, { ...t, children: "Hover me" }));
|
|
7
|
+
s(
|
|
8
|
+
Reflect.ownKeys(p),
|
|
9
|
+
(t) => n({
|
|
10
|
+
text: "Tooltip Text",
|
|
11
|
+
position: t,
|
|
12
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
13
|
+
})
|
|
14
|
+
), it("should render the child component", () => {
|
|
15
|
+
const e = n({
|
|
16
|
+
text: "Tooltip Text",
|
|
17
|
+
position: "top",
|
|
18
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
19
|
+
}).getByText("Hover me");
|
|
20
|
+
expect(e).toBeTruthy();
|
|
21
|
+
}), it("should not show tooltip initially", () => {
|
|
22
|
+
const e = n({
|
|
23
|
+
text: "Tooltip Text",
|
|
24
|
+
position: "top",
|
|
25
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
26
|
+
}).queryByText("Tooltip Text");
|
|
27
|
+
expect(e).not.toBeInTheDocument();
|
|
28
|
+
}), it("should show tooltip on mouse enter", () => {
|
|
29
|
+
const t = n({
|
|
30
|
+
text: "Tooltip Text",
|
|
31
|
+
position: "top",
|
|
32
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
33
|
+
}), e = t.getByText("Hover me");
|
|
34
|
+
l.mouseEnter(e);
|
|
35
|
+
const i = t.getByText("Tooltip Text");
|
|
36
|
+
expect(i).toBeInTheDocument();
|
|
37
|
+
}), it("should hide tooltip on mouse leave", () => {
|
|
38
|
+
const t = n({
|
|
39
|
+
text: "Tooltip Text",
|
|
40
|
+
position: "top",
|
|
41
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
42
|
+
}), e = t.getByText("Hover me");
|
|
43
|
+
l.mouseEnter(e);
|
|
44
|
+
const i = t.getByText("Tooltip Text");
|
|
45
|
+
expect(i).toBeInTheDocument(), l.mouseLeave(e), expect(t.queryByText("Tooltip Text")).not.toBeInTheDocument();
|
|
46
|
+
}), it.each(["top", "bottom", "left", "right"])(
|
|
47
|
+
"should apply correct position class for %s position",
|
|
48
|
+
(t) => {
|
|
49
|
+
const e = n({
|
|
50
|
+
text: "Tooltip Text",
|
|
51
|
+
position: t,
|
|
52
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
53
|
+
});
|
|
54
|
+
l.mouseEnter(e.getByText("Hover me"));
|
|
55
|
+
const i = e.getByText("Tooltip Text");
|
|
56
|
+
expect(i).toHaveClass(`gi-tooltip-${t}`);
|
|
57
|
+
}
|
|
58
|
+
), it("should render tooltip with correct text", () => {
|
|
59
|
+
const t = "Test Tooltip Content", e = n({
|
|
60
|
+
text: t,
|
|
61
|
+
position: "top",
|
|
62
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
63
|
+
});
|
|
64
|
+
l.mouseEnter(e.getByText("Hover me"));
|
|
65
|
+
const i = e.getByText(t);
|
|
66
|
+
expect(i).toBeInTheDocument();
|
|
67
|
+
}), it("should render ellipis with long tooltip text", () => {
|
|
68
|
+
const e = n({
|
|
69
|
+
text: "Very long tooltip text. Very long tooltip text. Very long tooltip text. Very long tooltip text. Very long tooltip text.",
|
|
70
|
+
position: "top",
|
|
71
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
72
|
+
});
|
|
73
|
+
l.mouseEnter(e.getByText("Hover me"));
|
|
74
|
+
const i = e.getByText(
|
|
75
|
+
"Very long tooltip text. Very long tooltip text. Very long tooltip text. Very long tooltip text. Very..."
|
|
76
|
+
);
|
|
77
|
+
expect(i).toBeInTheDocument();
|
|
78
|
+
}), it("should pass axe accessibility tests", async () => {
|
|
79
|
+
await n({
|
|
80
|
+
text: "Accessibility Tooltip",
|
|
81
|
+
position: "top",
|
|
82
|
+
children: /* @__PURE__ */ o("button", { children: "Hover me" })
|
|
83
|
+
}).axe();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a safe for url string representation.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The string to be transformed
|
|
5
|
+
* @returns A string that can be used as slug
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare function slugify(value?: string): string | undefined;
|
|
9
|
+
export declare function generateRandomId(): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function l(r) {
|
|
2
|
+
if (!r)
|
|
3
|
+
return r;
|
|
4
|
+
let e = r.replaceAll(/^\s+|\s+$/g, "");
|
|
5
|
+
return e = e.toLowerCase(), e = e.replaceAll(/[^\d a-z-]/g, "").replaceAll(/\s+/g, "-").replaceAll(/-+/g, "-"), e;
|
|
6
|
+
}
|
|
7
|
+
function t() {
|
|
8
|
+
return Math.random().toString(36).slice(2, 11);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
t as generateRandomId,
|
|
12
|
+
l as slugify
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BreakpointType } from '../hooks/use-breakpoint.js';
|
|
2
|
+
type DisplayPage = number | -1 | -2;
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to generate an array of page numbers and ellipses for pagination.
|
|
5
|
+
*
|
|
6
|
+
* This function is used to generate a compact pagination display that includes page numbers and ellipsis placeholders
|
|
7
|
+
* based on the active page (`currentPage`), total number of pages (`totalPages`), and the screen size breakpoint.
|
|
8
|
+
* When the `breakpoint` is small (`SM` or `MD`), the function limits the displayed pages to a simplified view.
|
|
9
|
+
* When the breakpoint is larger, it displays a wider range of pages around the `currentPage`.
|
|
10
|
+
*
|
|
11
|
+
* @param {number} currentPage - The currently active page number in the pagination.
|
|
12
|
+
* @param {number} totalPages - The total number of pages in the pagination.
|
|
13
|
+
* @param {Breakpoint} breakpoint - The screen size breakpoint, which determines the range of displayed pages.
|
|
14
|
+
*
|
|
15
|
+
* @returns {DisplayPage[]} - An array representing pages to be displayed, where:
|
|
16
|
+
* - Positive numbers represent actual page numbers.
|
|
17
|
+
* - `-1` and `-2` are placeholders for ellipses ('...') indicating a range of hidden pages.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
* - For `currentPage = 3`, `totalPages = 100`, and `breakpoint = SM`, the output would be `[1, -1, 3, -2, 100]`.
|
|
21
|
+
* - For `currentPage = 3`, `totalPages = 3`, and `breakpoint = SM`, the output would be `[1, 2, 3]`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getDisplayPages: (currentPage: number, totalPages: number, breakpoint: BreakpointType) => DisplayPage[];
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Breakpoint as u } from "../hooks/use-breakpoint.js";
|
|
2
|
+
const x = (p, f, d) => {
|
|
3
|
+
if (d === u.Small || d === u.Medium) {
|
|
4
|
+
const i = [];
|
|
5
|
+
if (f <= 3) {
|
|
6
|
+
for (let s = 1; s <= f; s++)
|
|
7
|
+
i.push(s);
|
|
8
|
+
return i;
|
|
9
|
+
}
|
|
10
|
+
return i.push(1), p > 2 && i.push(-1), p > 1 && p < f && i.push(p), p < f - 1 && i.push(-2), f > 1 && i.push(f), i;
|
|
11
|
+
}
|
|
12
|
+
const h = [];
|
|
13
|
+
p > 3 && h.push(1), p > 4 && h.push(-1);
|
|
14
|
+
for (let i = p - 2; i <= p + 2; i++)
|
|
15
|
+
i >= 1 && i <= f && h.push(i);
|
|
16
|
+
return p < f - 3 && h.push(-2), p < f - 2 && h.push(f), h;
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
x as getDisplayPages
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Breakpoint as e } from "../hooks/use-breakpoint.js";
|
|
2
|
+
import { getDisplayPages as a } from "./utilities.js";
|
|
3
|
+
describe("getDisplayPages", () => {
|
|
4
|
+
it("should return all pages for small screens when totalPages is less than or equal to 3", () => {
|
|
5
|
+
expect(a(1, 3, e.Small)).toEqual([1, 2, 3]), expect(a(2, 3, e.Small)).toEqual([1, 2, 3]);
|
|
6
|
+
}), it("should return [1, -2, totalPages] when on first page for small screens and large totalPages", () => {
|
|
7
|
+
expect(a(1, 10, e.Small)).toEqual([1, -2, 10]);
|
|
8
|
+
}), it("should return [1, currentPage, -2, totalPages] when currentPage is near start for small screens", () => {
|
|
9
|
+
expect(a(2, 10, e.Small)).toEqual([1, 2, -2, 10]), expect(a(3, 100, e.Small)).toEqual([
|
|
10
|
+
1,
|
|
11
|
+
-1,
|
|
12
|
+
3,
|
|
13
|
+
-2,
|
|
14
|
+
100
|
|
15
|
+
]);
|
|
16
|
+
}), it("should return [1, -1, currentPage, -2, totalPages] when currentPage is in the middle for small screens", () => {
|
|
17
|
+
expect(a(5, 10, e.Small)).toEqual([
|
|
18
|
+
1,
|
|
19
|
+
-1,
|
|
20
|
+
5,
|
|
21
|
+
-2,
|
|
22
|
+
10
|
|
23
|
+
]), expect(a(7, 10, e.Small)).toEqual([
|
|
24
|
+
1,
|
|
25
|
+
-1,
|
|
26
|
+
7,
|
|
27
|
+
-2,
|
|
28
|
+
10
|
|
29
|
+
]);
|
|
30
|
+
}), it("should return [1, -1, totalPages-1, totalPages] when currentPage is near end for small screens", () => {
|
|
31
|
+
expect(a(9, 10, e.Small)).toEqual([1, -1, 9, 10]), expect(a(10, 10, e.Small)).toEqual([1, -1, 10]);
|
|
32
|
+
}), it("should return wider range of pages with ellipses for large screens", () => {
|
|
33
|
+
expect(a(5, 10, e.Large)).toEqual([
|
|
34
|
+
1,
|
|
35
|
+
-1,
|
|
36
|
+
3,
|
|
37
|
+
4,
|
|
38
|
+
5,
|
|
39
|
+
6,
|
|
40
|
+
7,
|
|
41
|
+
-2,
|
|
42
|
+
10
|
|
43
|
+
]), expect(a(1, 10, e.Large)).toEqual([1, 2, 3, -2, 10]), expect(a(10, 10, e.Large)).toEqual([
|
|
44
|
+
1,
|
|
45
|
+
-1,
|
|
46
|
+
8,
|
|
47
|
+
9,
|
|
48
|
+
10
|
|
49
|
+
]);
|
|
50
|
+
}), it("should handle edge case of currentPage being the only page", () => {
|
|
51
|
+
expect(a(1, 1, e.Small)).toEqual([1]), expect(a(1, 1, e.Large)).toEqual([1]);
|
|
52
|
+
}), it("should handle case where currentPage is at extreme start and end for larger screens", () => {
|
|
53
|
+
expect(a(1, 100, e.Large)).toEqual([
|
|
54
|
+
1,
|
|
55
|
+
2,
|
|
56
|
+
3,
|
|
57
|
+
-2,
|
|
58
|
+
100
|
|
59
|
+
]), expect(a(100, 100, e.Large)).toEqual([
|
|
60
|
+
1,
|
|
61
|
+
-1,
|
|
62
|
+
98,
|
|
63
|
+
99,
|
|
64
|
+
100
|
|
65
|
+
]);
|
|
66
|
+
}), it("should handle large number of pages with currentPage in the middle on large screens", () => {
|
|
67
|
+
expect(a(50, 100, e.Large)).toEqual([
|
|
68
|
+
1,
|
|
69
|
+
-1,
|
|
70
|
+
48,
|
|
71
|
+
49,
|
|
72
|
+
50,
|
|
73
|
+
51,
|
|
74
|
+
52,
|
|
75
|
+
-2,
|
|
76
|
+
100
|
|
77
|
+
]);
|
|
78
|
+
});
|
|
79
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogcio/design-system-react",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"description": "The GOV IE design system React components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"react-dom": "19.0.0",
|
|
53
53
|
"@ogcio/design-system-eslint-config": "1.2.5",
|
|
54
54
|
"@ogcio/design-system-prettier-config": "1.0.5",
|
|
55
|
-
"@ogcio/design-system-tailwind": "1.10.1",
|
|
56
55
|
"@ogcio/theme-doete": "1.0.0",
|
|
57
|
-
"@ogcio/
|
|
56
|
+
"@ogcio/design-system-tailwind": "1.10.2",
|
|
57
|
+
"@ogcio/theme-govie": "1.5.2"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"format": "prettier 'src/**/*.{ts,tsx}' --write",
|