@ogcio/design-system-react 1.11.0 → 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 +4 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type AccordionItemProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
label: string;
|
|
5
|
+
defaultExpanded?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
dataTestid?: string;
|
|
8
|
+
iconStart?: boolean;
|
|
9
|
+
variant?: 'default' | 'small';
|
|
10
|
+
};
|
|
11
|
+
export declare const AccordionItem: ({ defaultExpanded, children, label, disabled, dataTestid, iconStart, variant, }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, Fragment as u, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useState as y, useRef as b } from "react";
|
|
4
|
+
import { c as h } from "../index-DNkhmzZp.js";
|
|
5
|
+
import { cn as r } from "../cn.js";
|
|
6
|
+
import { Icon as w } from "../icon/icon.js";
|
|
7
|
+
const I = h({
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "gi-px-2 gi-py-4 gi-text-md gi-font-bold",
|
|
11
|
+
small: "gi-py-2 gi-px-2 gi-text-sm gi-font-bold"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}), N = ({
|
|
15
|
+
defaultExpanded: c,
|
|
16
|
+
children: s,
|
|
17
|
+
label: t,
|
|
18
|
+
disabled: e,
|
|
19
|
+
dataTestid: l,
|
|
20
|
+
iconStart: m,
|
|
21
|
+
variant: n = "default"
|
|
22
|
+
}) => {
|
|
23
|
+
const [o, a] = y(c), g = b(null), p = `${t}-button`, f = `${t}-panel`;
|
|
24
|
+
return /* @__PURE__ */ d(u, { children: [
|
|
25
|
+
/* @__PURE__ */ i(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref: g,
|
|
29
|
+
"data-testid": l,
|
|
30
|
+
"data-disabled": !!e,
|
|
31
|
+
"data-icon-start": !!m,
|
|
32
|
+
onClick: () => !e && a(!o),
|
|
33
|
+
onKeyDown: (x) => {
|
|
34
|
+
x.key === "Enter" && !e && a(!o);
|
|
35
|
+
},
|
|
36
|
+
"aria-expanded": o,
|
|
37
|
+
tabIndex: 0,
|
|
38
|
+
className: "gi-accordion",
|
|
39
|
+
children: /* @__PURE__ */ d(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: r("gi-accordion-header", I({ variant: n })),
|
|
43
|
+
children: [
|
|
44
|
+
t,
|
|
45
|
+
" ",
|
|
46
|
+
/* @__PURE__ */ i(
|
|
47
|
+
w,
|
|
48
|
+
{
|
|
49
|
+
icon: o ? "keyboard_arrow_up" : "keyboard_arrow_down"
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ i(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
id: f,
|
|
61
|
+
role: "region",
|
|
62
|
+
"aria-labelledby": p,
|
|
63
|
+
className: r("gi-px-2 gi-pb-4 gi-pt-2 gi-font-normal", {
|
|
64
|
+
"gi-block": o,
|
|
65
|
+
"gi-hidden": !o,
|
|
66
|
+
"gi-text-md": n === "default",
|
|
67
|
+
"gi-text-sm": n === "small"
|
|
68
|
+
}),
|
|
69
|
+
children: s
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
N as AccordionItem
|
|
76
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { AccordionItem } from './accordion-item.js';
|
|
3
|
+
export type AccordionProps = {
|
|
4
|
+
children: ReactElement<typeof AccordionItem>[];
|
|
5
|
+
iconStart?: boolean;
|
|
6
|
+
dataTestid?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
variant?: 'default' | 'small';
|
|
9
|
+
};
|
|
10
|
+
export declare const Accordion: ({ children, iconStart, dataTestid, className, variant, }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Children as i, isValidElement as c, cloneElement as p } from "react";
|
|
3
|
+
import { cn as n } from "../cn.js";
|
|
4
|
+
const g = ({
|
|
5
|
+
children: r,
|
|
6
|
+
iconStart: t,
|
|
7
|
+
dataTestid: l,
|
|
8
|
+
className: a,
|
|
9
|
+
variant: s = "default"
|
|
10
|
+
}) => /* @__PURE__ */ o(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
"data-testid": l,
|
|
14
|
+
"data-icon-start": t,
|
|
15
|
+
role: "presentation",
|
|
16
|
+
className: n("gi-w-full", a),
|
|
17
|
+
children: i.map(r, (e, d) => {
|
|
18
|
+
const m = d === i.count(r) - 1;
|
|
19
|
+
return c(e) ? /* @__PURE__ */ o(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: n("gi-border-t", {
|
|
23
|
+
"gi-border-b": m
|
|
24
|
+
}),
|
|
25
|
+
children: p(
|
|
26
|
+
e,
|
|
27
|
+
{
|
|
28
|
+
variant: s,
|
|
29
|
+
iconStart: t
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
) : null;
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
export {
|
|
38
|
+
g as Accordion
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c as h, r as o, f as a } from "../test-utilities-BS7B3BF-.js";
|
|
3
|
+
import { AccordionItem as n } from "./accordion-item.js";
|
|
4
|
+
import { Accordion as r } from "./accordion.js";
|
|
5
|
+
describe("govieAccordion", () => {
|
|
6
|
+
afterEach(h), it("should render accordion with all items", () => {
|
|
7
|
+
const { getByText: t } = o(
|
|
8
|
+
/* @__PURE__ */ l(r, { children: [
|
|
9
|
+
/* @__PURE__ */ l(n, { label: "Label1", children: [
|
|
10
|
+
/* @__PURE__ */ e("h1", { children: "This is the content Heading 1" }),
|
|
11
|
+
/* @__PURE__ */ e("p", { children: "This is a content paragraph paragraph 1" })
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ l(n, { label: "Label2", children: [
|
|
14
|
+
/* @__PURE__ */ e("h1", { children: "This is the content Heading 2" }),
|
|
15
|
+
/* @__PURE__ */ e("p", { children: "This is a content paragraph paragraph 2" })
|
|
16
|
+
] })
|
|
17
|
+
] })
|
|
18
|
+
);
|
|
19
|
+
expect(t("Label1")).toBeInTheDocument(), expect(t("Label2")).toBeInTheDocument();
|
|
20
|
+
}), it("should toggle accordion item visibility when clicked", () => {
|
|
21
|
+
const { getByText: t, queryByText: i } = o(
|
|
22
|
+
/* @__PURE__ */ l(r, { children: [
|
|
23
|
+
/* @__PURE__ */ e(n, { label: "Label1", children: /* @__PURE__ */ e("p", { children: "This is the content for Label1" }) }),
|
|
24
|
+
/* @__PURE__ */ e(n, { label: "Label2", children: /* @__PURE__ */ e("p", { children: "This is the content for Label2" }) })
|
|
25
|
+
] })
|
|
26
|
+
), c = t("Label1");
|
|
27
|
+
expect(i("This is the content for Label1")).not.toBeVisible(), a.click(c), expect(i("This is the content for Label1")).toBeVisible(), a.click(c), expect(i("This is the content for Label1")).not.toBeVisible();
|
|
28
|
+
}), it("should not toggle disabled accordion item", () => {
|
|
29
|
+
const { getByText: t, queryByText: i } = o(
|
|
30
|
+
/* @__PURE__ */ l(r, { children: [
|
|
31
|
+
/* @__PURE__ */ e(n, { label: "Label1", disabled: !0, children: /* @__PURE__ */ e("p", { children: "This is the content for Label1" }) }),
|
|
32
|
+
/* @__PURE__ */ e(n, { label: "Label2", children: /* @__PURE__ */ e("p", { children: "This is the content for Label2" }) })
|
|
33
|
+
] })
|
|
34
|
+
), c = t("Label1");
|
|
35
|
+
expect(i("This is the content for Label1")).not.toBeVisible(), a.click(c), expect(i("This is the content for Label1")).not.toBeVisible();
|
|
36
|
+
}), it("should render accordion items with defaultExpanded set to true", () => {
|
|
37
|
+
const { getByText: t } = o(
|
|
38
|
+
/* @__PURE__ */ l(r, { children: [
|
|
39
|
+
/* @__PURE__ */ e(n, { label: "Label1", defaultExpanded: !0, children: /* @__PURE__ */ e("p", { children: "This is the content for Label1" }) }),
|
|
40
|
+
/* @__PURE__ */ e(n, { label: "Label2", children: /* @__PURE__ */ e("p", { children: "This is the content for Label2" }) })
|
|
41
|
+
] })
|
|
42
|
+
);
|
|
43
|
+
expect(t("This is the content for Label1")).toBeVisible();
|
|
44
|
+
}), it("should apply iconStart styling when iconStart is true", () => {
|
|
45
|
+
const { container: t } = o(
|
|
46
|
+
/* @__PURE__ */ l(r, { iconStart: !0, children: [
|
|
47
|
+
/* @__PURE__ */ e(n, { label: "Label1", children: /* @__PURE__ */ e("p", { children: "This is the content for Label1" }) }),
|
|
48
|
+
/* @__PURE__ */ e(n, { label: "Label2", children: /* @__PURE__ */ e("p", { children: "This is the content for Label2" }) })
|
|
49
|
+
] })
|
|
50
|
+
), i = t.querySelector(".gi-accordion"), c = i == null ? void 0 : i.getAttribute("data-icon-start");
|
|
51
|
+
expect(c).toBe("true");
|
|
52
|
+
}), it("should not apply iconStart styling when iconStart is false", () => {
|
|
53
|
+
const { container: t } = o(
|
|
54
|
+
/* @__PURE__ */ l(r, { children: [
|
|
55
|
+
/* @__PURE__ */ e(n, { label: "Label1", children: /* @__PURE__ */ e("p", { children: "This is the content for Label1" }) }),
|
|
56
|
+
/* @__PURE__ */ e(n, { label: "Label2", children: /* @__PURE__ */ e("p", { children: "This is the content for Label2" }) })
|
|
57
|
+
] })
|
|
58
|
+
), i = t.querySelector("div.gi-flex-row-reverse");
|
|
59
|
+
expect(i).not.toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
declare const alertVariants: import('tailwind-variants').TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
info: {
|
|
6
|
+
base: string;
|
|
7
|
+
baseDismissible: string;
|
|
8
|
+
};
|
|
9
|
+
danger: {
|
|
10
|
+
base: string;
|
|
11
|
+
baseDismissible: string;
|
|
12
|
+
};
|
|
13
|
+
success: {
|
|
14
|
+
base: string;
|
|
15
|
+
baseDismissible: string;
|
|
16
|
+
};
|
|
17
|
+
warning: {
|
|
18
|
+
base: string;
|
|
19
|
+
baseDismissible: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
base: string;
|
|
24
|
+
baseDismissible: string;
|
|
25
|
+
container: string;
|
|
26
|
+
heading: string;
|
|
27
|
+
dismiss: string;
|
|
28
|
+
}, undefined, TVConfig<V, EV>, {
|
|
29
|
+
variant: {
|
|
30
|
+
info: {
|
|
31
|
+
base: string;
|
|
32
|
+
baseDismissible: string;
|
|
33
|
+
};
|
|
34
|
+
danger: {
|
|
35
|
+
base: string;
|
|
36
|
+
baseDismissible: string;
|
|
37
|
+
};
|
|
38
|
+
success: {
|
|
39
|
+
base: string;
|
|
40
|
+
baseDismissible: string;
|
|
41
|
+
};
|
|
42
|
+
warning: {
|
|
43
|
+
base: string;
|
|
44
|
+
baseDismissible: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}, {
|
|
48
|
+
base: string;
|
|
49
|
+
baseDismissible: string;
|
|
50
|
+
container: string;
|
|
51
|
+
heading: string;
|
|
52
|
+
dismiss: string;
|
|
53
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
54
|
+
variant: {
|
|
55
|
+
info: {
|
|
56
|
+
base: string;
|
|
57
|
+
baseDismissible: string;
|
|
58
|
+
};
|
|
59
|
+
danger: {
|
|
60
|
+
base: string;
|
|
61
|
+
baseDismissible: string;
|
|
62
|
+
};
|
|
63
|
+
success: {
|
|
64
|
+
base: string;
|
|
65
|
+
baseDismissible: string;
|
|
66
|
+
};
|
|
67
|
+
warning: {
|
|
68
|
+
base: string;
|
|
69
|
+
baseDismissible: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
73
|
+
base: string;
|
|
74
|
+
baseDismissible: string;
|
|
75
|
+
container: string;
|
|
76
|
+
heading: string;
|
|
77
|
+
dismiss: string;
|
|
78
|
+
}, undefined, TVConfig<V, EV>, unknown, unknown, undefined>>;
|
|
79
|
+
type AlertProps = {
|
|
80
|
+
variant?: VariantProps<typeof alertVariants>['variant'];
|
|
81
|
+
title: string;
|
|
82
|
+
children?: ReactNode;
|
|
83
|
+
dismissible?: boolean;
|
|
84
|
+
dataTestid?: string;
|
|
85
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
86
|
+
};
|
|
87
|
+
declare function Alert({ title, children, variant, dismissible, onClose, dataTestid, }: AlertProps): import("react/jsx-runtime").JSX.Element | null;
|
|
88
|
+
export { Alert, alertVariants };
|
|
89
|
+
export type { AlertProps };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useState as D } from "react";
|
|
4
|
+
import { c as h } from "../index-DNkhmzZp.js";
|
|
5
|
+
import { cn as v } from "../cn.js";
|
|
6
|
+
import { translate as k } from "../i18n/utility.js";
|
|
7
|
+
import { Icon as w } from "../icon/icon.js";
|
|
8
|
+
import { IconButton as N } from "../icon-button/icon-button.js";
|
|
9
|
+
const V = h({
|
|
10
|
+
slots: {
|
|
11
|
+
base: "gi-alert-base",
|
|
12
|
+
baseDismissible: "gi-alert-base-dismissible",
|
|
13
|
+
container: "gi-alert-container",
|
|
14
|
+
heading: "gi-alert-title",
|
|
15
|
+
dismiss: "gi-alert-dismiss"
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
info: {
|
|
20
|
+
base: "gi-alert-info",
|
|
21
|
+
baseDismissible: "gi-alert-info"
|
|
22
|
+
},
|
|
23
|
+
danger: {
|
|
24
|
+
base: "gi-alert-danger",
|
|
25
|
+
baseDismissible: "gi-alert-danger"
|
|
26
|
+
},
|
|
27
|
+
success: {
|
|
28
|
+
base: "gi-alert-success",
|
|
29
|
+
baseDismissible: "gi-alert-success"
|
|
30
|
+
},
|
|
31
|
+
warning: {
|
|
32
|
+
base: "gi-alert-warning",
|
|
33
|
+
baseDismissible: "gi-alert-success"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: "info"
|
|
39
|
+
}
|
|
40
|
+
}), x = ({ variant: e }) => {
|
|
41
|
+
let s;
|
|
42
|
+
switch (e) {
|
|
43
|
+
case "warning": {
|
|
44
|
+
s = "warning";
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "success": {
|
|
48
|
+
s = "check_circle";
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case "danger": {
|
|
52
|
+
s = "error";
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
s = "info";
|
|
57
|
+
}
|
|
58
|
+
return s;
|
|
59
|
+
};
|
|
60
|
+
function _({
|
|
61
|
+
title: e,
|
|
62
|
+
children: s,
|
|
63
|
+
variant: i = "info",
|
|
64
|
+
dismissible: t,
|
|
65
|
+
onClose: a,
|
|
66
|
+
dataTestid: l
|
|
67
|
+
}) {
|
|
68
|
+
const [c, o] = D(!1), { base: m, heading: d, container: b, dismiss: g, baseDismissible: f } = V({
|
|
69
|
+
variant: i
|
|
70
|
+
}), u = t ? f : m;
|
|
71
|
+
return c ? null : /* @__PURE__ */ n(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: v(u(), "gi-not-prose"),
|
|
75
|
+
"data-testid": l,
|
|
76
|
+
role: "alert",
|
|
77
|
+
"aria-live": "assertive",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ r(
|
|
80
|
+
w,
|
|
81
|
+
{
|
|
82
|
+
icon: x({ variant: i }),
|
|
83
|
+
ariaHidden: !0,
|
|
84
|
+
className: "gi-alert-icon",
|
|
85
|
+
"data-variant": i
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ n("div", { className: b(), children: [
|
|
89
|
+
/* @__PURE__ */ r("p", { className: d(), children: e }),
|
|
90
|
+
s
|
|
91
|
+
] }),
|
|
92
|
+
t && /* @__PURE__ */ r(
|
|
93
|
+
N,
|
|
94
|
+
{
|
|
95
|
+
onClick: (p) => {
|
|
96
|
+
o(!0), a == null || a(p);
|
|
97
|
+
},
|
|
98
|
+
className: g(),
|
|
99
|
+
size: "small",
|
|
100
|
+
appearance: "dark",
|
|
101
|
+
variant: "flat",
|
|
102
|
+
icon: { icon: "close" },
|
|
103
|
+
"aria-label": k("alert.dismissAlert", {
|
|
104
|
+
defaultValue: "Dismiss alert"
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
_ as Alert,
|
|
114
|
+
V as alertVariants
|
|
115
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as r, t as l, r as o } from "../test-utilities-BS7B3BF-.js";
|
|
3
|
+
import { Alert as c } from "./alert.js";
|
|
4
|
+
const a = [
|
|
5
|
+
"info",
|
|
6
|
+
"success",
|
|
7
|
+
"warning",
|
|
8
|
+
"danger"
|
|
9
|
+
];
|
|
10
|
+
describe("Alert", () => {
|
|
11
|
+
afterEach(r);
|
|
12
|
+
const t = (e) => o(/* @__PURE__ */ i(c, { ...e }));
|
|
13
|
+
l(
|
|
14
|
+
Reflect.ownKeys(a),
|
|
15
|
+
(e) => t({
|
|
16
|
+
variant: e,
|
|
17
|
+
title: "Information",
|
|
18
|
+
children: "This is an info alert"
|
|
19
|
+
})
|
|
20
|
+
), it("should render alert with title and message", () => {
|
|
21
|
+
const e = t({
|
|
22
|
+
variant: "info",
|
|
23
|
+
title: "Information",
|
|
24
|
+
children: "This is an info alert",
|
|
25
|
+
dataTestid: "alert"
|
|
26
|
+
}), s = e.getByTestId("alert");
|
|
27
|
+
expect(s).toBeTruthy(), expect(e.getByText("Information")).toBeTruthy(), expect(e.getByText("This is an info alert")).toBeTruthy();
|
|
28
|
+
}), it("should render different variants", () => {
|
|
29
|
+
for (const e of a) {
|
|
30
|
+
const n = t({
|
|
31
|
+
variant: e,
|
|
32
|
+
title: `${e} alert`,
|
|
33
|
+
children: `This is a ${e} alert`,
|
|
34
|
+
dataTestid: "alert"
|
|
35
|
+
}).getByTestId("alert");
|
|
36
|
+
expect(n).toHaveClass(`gi-alert-${e}`), r();
|
|
37
|
+
}
|
|
38
|
+
}), it("should pass axe accessibility tests", async () => {
|
|
39
|
+
await t({
|
|
40
|
+
variant: "success",
|
|
41
|
+
title: "Accessible Alert",
|
|
42
|
+
children: "This alert should be accessible"
|
|
43
|
+
}).axe();
|
|
44
|
+
});
|
|
45
|
+
});
|