@ogcio/design-system-react 1.19.0 → 1.20.0

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.
Files changed (50) hide show
  1. package/dist/forms/form-field/form-field.js +58 -60
  2. package/dist/header/components/header-menu.d.ts +1 -2
  3. package/dist/header/header-legacy.d.ts +2 -0
  4. package/dist/header/header-legacy.js +223 -0
  5. package/dist/header/header-next/components/header-logo.d.ts +2 -0
  6. package/dist/header/header-next/components/header-logo.js +19 -0
  7. package/dist/header/header-next/components/header-title.d.ts +2 -0
  8. package/dist/header/header-next/components/header-title.js +29 -0
  9. package/dist/header/header-next/components/menu/components/header-menu-item-button.d.ts +2 -0
  10. package/dist/header/header-next/components/menu/components/header-menu-item-button.js +42 -0
  11. package/dist/header/header-next/components/menu/components/header-menu-item-link.d.ts +8 -0
  12. package/dist/header/header-next/components/menu/components/header-menu-item-link.js +72 -0
  13. package/dist/header/header-next/components/menu/components/header-menu-item-separator.d.ts +3 -0
  14. package/dist/header/header-next/components/menu/components/header-menu-item-separator.js +34 -0
  15. package/dist/header/header-next/components/menu/components/header-menu-item-slot.d.ts +5 -0
  16. package/dist/header/header-next/components/menu/components/header-menu-item-slot.js +42 -0
  17. package/dist/header/header-next/components/menu/header-menu-context.d.ts +7 -0
  18. package/dist/header/header-next/components/menu/header-menu-context.js +23 -0
  19. package/dist/header/header-next/components/menu/header-primary-menu.d.ts +3 -0
  20. package/dist/header/header-next/components/menu/header-primary-menu.js +63 -0
  21. package/dist/header/header-next/components/menu/header-secondary-menu.d.ts +3 -0
  22. package/dist/header/header-next/components/menu/header-secondary-menu.js +52 -0
  23. package/dist/header/header-next/header-context.d.ts +13 -0
  24. package/dist/header/header-next/header-context.js +31 -0
  25. package/dist/header/header-next/header-next.d.ts +7 -0
  26. package/dist/header/header-next/header-next.js +75 -0
  27. package/dist/header/header-next/index.d.ts +11 -0
  28. package/dist/header/header-next/index.js +27 -0
  29. package/dist/header/header.d.ts +2 -2
  30. package/dist/header/header.js +17 -219
  31. package/dist/header/types.d.ts +84 -4
  32. package/dist/header/variants.d.ts +2 -2
  33. package/dist/header/variants.js +1 -1
  34. package/dist/hooks/use-toggle-map.d.ts +15 -0
  35. package/dist/hooks/use-toggle-map.js +45 -0
  36. package/dist/icon/icons.d.ts +2 -2
  37. package/dist/icon/icons.js +2 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +205 -178
  40. package/dist/input-checkbox/input-checkbox.d.ts +1 -1
  41. package/dist/input-checkbox/input-checkbox.js +65 -48
  42. package/dist/input-radio/input-radio.d.ts +1 -1
  43. package/dist/input-radio/input-radio.js +51 -44
  44. package/dist/list-item/list-item.d.ts +3 -2
  45. package/dist/list-item/list-item.js +15 -6
  46. package/dist/modal/types.d.ts +5 -3
  47. package/dist/styles.css +2 -2
  48. package/dist/utils/utilities.d.ts +3 -0
  49. package/dist/utils/utilities.js +34 -25
  50. package/package.json +2 -2
@@ -1,74 +1,72 @@
1
1
  "use client";
2
2
  import "@ogcio/design-system-react/browser-check";
3
- import { jsx as t, jsxs as a } from "react/jsx-runtime";
4
- import { S as g } from "../../index-2sRBqKFV.js";
5
- import { createContext as x, useContext as v, Children as L, isValidElement as C } from "react";
6
- import { cn as d } from "../../cn.js";
7
- import { ErrorText as E } from "../../error-text/error-text.js";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ import { S as p } from "../../index-2sRBqKFV.js";
5
+ import { createContext as x, useContext as v, Children as L } from "react";
6
+ import { cn as m } from "../../cn.js";
7
+ import { ErrorText as C } from "../../error-text/error-text.js";
8
8
  import { HintText as N } from "../../hint-text/hint-text.js";
9
- import { Label as H } from "../../label/label.js";
9
+ import { Label as E } from "../../label/label.js";
10
+ import { getSpecialComponentType as d, isSpecialComponent as H } from "../../utils/utilities.js";
10
11
  const c = x(null);
11
12
  function s(e) {
12
13
  v(c) || console.error(`[${e}] must be used within a <FormField>.`);
13
14
  }
14
- function m(e) {
15
- var r, i;
16
- return C(e) && (((r = e.type) == null ? void 0 : r.componentType) || ((i = e.props) == null ? void 0 : i.__type)) || null;
17
- }
18
- function P(e) {
19
- return ["FormFieldLabel", "FormFieldHint", "FormFieldError"].includes(
20
- m(e) ?? ""
21
- );
22
- }
23
- const B = (e) => ["error", "hint", "label"].some((l) => l in e) ? (console.warn(
15
+ const I = (e) => ["error", "hint", "label"].some((r) => r in e) ? (console.warn(
24
16
  "[FormField] Using legacy props. Please migrate to the new composable API."
25
- ), /* @__PURE__ */ t(c.Provider, { value: !0, children: /* @__PURE__ */ a(p, { ...e, children: [
26
- e.label && /* @__PURE__ */ t(F, { ...e.label }),
27
- e.hint && /* @__PURE__ */ t(u, { ...e.hint }),
28
- e.error && /* @__PURE__ */ t(f, { ...e.error }),
17
+ ), /* @__PURE__ */ i(c.Provider, { value: !0, children: /* @__PURE__ */ a(h, { ...e, children: [
18
+ e.label && /* @__PURE__ */ i(F, { ...e.label }),
19
+ e.hint && /* @__PURE__ */ i(f, { ...e.hint }),
20
+ e.error && /* @__PURE__ */ i(b, { ...e.error }),
29
21
  e.children
30
- ] }) })) : /* @__PURE__ */ t(c.Provider, { value: !0, children: /* @__PURE__ */ t(p, { ...e, children: e.children }) }), p = ({
22
+ ] }) })) : /* @__PURE__ */ i(c.Provider, { value: !0, children: /* @__PURE__ */ i(h, { ...e, children: e.children }) }), h = ({
31
23
  children: e,
32
- className: r,
33
- ...i
24
+ className: l,
25
+ ...o
34
26
  }) => {
35
- const l = L.toArray(e), n = l.find(
36
- (o) => m(o) === "FormFieldLabel"
37
- ), y = l.find(
38
- (o) => m(o) === "FormFieldHint"
39
- ), b = l.find(
40
- (o) => m(o) === "FormFieldError"
41
- ), h = l.filter((o) => !P(o));
27
+ const r = L.toArray(e), n = r.find(
28
+ (t) => d(t) === "FormFieldLabel"
29
+ ), y = r.find(
30
+ (t) => d(t) === "FormFieldHint"
31
+ ), u = r.find(
32
+ (t) => d(t) === "FormFieldError"
33
+ ), g = r.filter(
34
+ (t) => !H(t, [
35
+ "FormFieldLabel",
36
+ "FormFieldHint",
37
+ "FormFieldError"
38
+ ])
39
+ );
42
40
  return /* @__PURE__ */ a(
43
41
  "fieldset",
44
42
  {
45
- className: d({ "gi-error-state": !!b }, r),
46
- ...i,
43
+ className: m({ "gi-error-state": !!u }, l),
44
+ ...o,
47
45
  children: [
48
46
  /* @__PURE__ */ a("div", { className: "gi-pb-3 gi-flex gi-flex-col gi-gap-1", children: [
49
47
  /* @__PURE__ */ a("div", { children: [
50
48
  n,
51
49
  y
52
50
  ] }),
53
- b
51
+ u
54
52
  ] }),
55
- /* @__PURE__ */ t(g, { children: h })
53
+ /* @__PURE__ */ i(p, { children: g })
56
54
  ]
57
55
  }
58
56
  );
59
57
  }, F = ({
60
58
  children: e,
61
- text: r,
62
- size: i,
63
- htmlFor: l,
59
+ text: l,
60
+ size: o,
61
+ htmlFor: r,
64
62
  className: n
65
- }) => (s("FormFieldLabel"), /* @__PURE__ */ t(
66
- H,
63
+ }) => (s("FormFieldLabel"), /* @__PURE__ */ i(
64
+ E,
67
65
  {
68
- text: r,
69
- size: i,
70
- htmlFor: l,
71
- className: d("gi-font-bold", n),
66
+ text: l,
67
+ size: o,
68
+ htmlFor: r,
69
+ className: m("gi-font-bold", n),
72
70
  children: e
73
71
  }
74
72
  ));
@@ -78,38 +76,38 @@ Object.defineProperty(F, "componentType", {
78
76
  enumerable: !1
79
77
  });
80
78
  F.displayName = "FormFieldLabel";
81
- const u = ({ children: e, text: r, size: i, className: l }) => (s("FormFieldHint"), /* @__PURE__ */ t(N, { text: r, size: i, className: d("gi-mb-1", l), children: e }));
82
- Object.defineProperty(u, "componentType", {
79
+ const f = ({ children: e, text: l, size: o, className: r }) => (s("FormFieldHint"), /* @__PURE__ */ i(N, { text: l, size: o, className: m("gi-mb-1", r), children: e }));
80
+ Object.defineProperty(f, "componentType", {
83
81
  value: "FormFieldHint",
84
82
  writable: !1,
85
83
  enumerable: !1
86
84
  });
87
- u.displayName = "FormFieldHint";
88
- const f = ({
85
+ f.displayName = "FormFieldHint";
86
+ const b = ({
89
87
  children: e,
90
- text: r,
91
- size: i,
92
- className: l,
88
+ text: l,
89
+ size: o,
90
+ className: r,
93
91
  ...n
94
- }) => (s("FormFieldError"), /* @__PURE__ */ t(
95
- E,
92
+ }) => (s("FormFieldError"), /* @__PURE__ */ i(
93
+ C,
96
94
  {
97
- text: r,
98
- size: i,
99
- className: d("gi-mb-1", l),
95
+ text: l,
96
+ size: o,
97
+ className: m("gi-mb-1", r),
100
98
  ...n,
101
99
  children: e
102
100
  }
103
101
  ));
104
- Object.defineProperty(f, "componentType", {
102
+ Object.defineProperty(b, "componentType", {
105
103
  value: "FormFieldError",
106
104
  writable: !1,
107
105
  enumerable: !1
108
106
  });
109
- f.displayName = "FormFieldError";
107
+ b.displayName = "FormFieldError";
110
108
  export {
111
- B as FormField,
112
- f as FormFieldError,
113
- u as FormFieldHint,
109
+ I as FormField,
110
+ b as FormFieldError,
111
+ f as FormFieldHint,
114
112
  F as FormFieldLabel
115
113
  };
@@ -1,6 +1,6 @@
1
1
  import { HeaderProps } from '../types.js';
2
2
  export type MobileHeaderMenuProps = Pick<HeaderProps, 'items' | 'secondaryLinks'>;
3
- type MenuItemAccordionProps = {
3
+ export type MenuItemAccordionProps = {
4
4
  index: number;
5
5
  item: {
6
6
  label?: string;
@@ -9,4 +9,3 @@ type MenuItemAccordionProps = {
9
9
  };
10
10
  export declare const MenuItemAccordion: ({ index, item }: MenuItemAccordionProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export declare const MobileHeaderMenuItems: ({ items, secondaryLinks, }: MobileHeaderMenuProps) => import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -0,0 +1,2 @@
1
+ import { HeaderProps } from './types.js';
2
+ export declare function HeaderLegacy({ title, items, logo, secondaryLinks, fullWidth, addDefaultMobileMenu, mobileMenuLabel, showMenuLabel, showTitleOnMobile, dataTestid, appearance, ...props }: HeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,223 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
4
+ import { useEffect as T, useMemo as I, createElement as x } from "react";
5
+ import { renderToStaticMarkup as v } from "react-dom/server";
6
+ import L from "../assets/logos/gov-of-ireland/harp-black.js";
7
+ import D from "../assets/logos/gov-of-ireland/harp-white.js";
8
+ import C from "../assets/logos/harp/harp-black.js";
9
+ import A from "../assets/logos/harp/harp-white.js";
10
+ import { cn as k } from "../cn.js";
11
+ import { Container as p } from "../container/container.js";
12
+ import { translate as h } from "../i18n/utility.js";
13
+ import { Icon as j } from "../icon/icon.js";
14
+ import u from "../primitives/anchor.js";
15
+ import { MobileHeaderMenuItems as E } from "./components/header-menu.js";
16
+ import { SlotContainer as G, SlotItemAction as B } from "./components/header-slot.js";
17
+ import { attachEventsToItemActionTriggers as F } from "./helper.js";
18
+ import { headerVariants as O, headerMenuVariants as P, headerLogoVariants as U, headerTitleVariants as W, headerSecondaryLinksVariants as q, headerDividerVariants as z, headerToolItemVariants as y, headerSecondaryLinkItemVariants as J, headerSecondaryLinkSlotItemVariants as K } from "./variants.js";
19
+ function S({ logo: r, appearance: n = "default" }) {
20
+ const t = {
21
+ harp: {
22
+ default: /* @__PURE__ */ e(A, {}),
23
+ light: /* @__PURE__ */ e(C, {})
24
+ },
25
+ withText: {
26
+ default: /* @__PURE__ */ e(D, {}),
27
+ light: /* @__PURE__ */ e(L, {})
28
+ }
29
+ }, o = `data:image/svg+xml;base64,${btoa(v(t.harp[n]))}`, g = `data:image/svg+xml;base64,${btoa(
30
+ v(t.withText[n])
31
+ )}`;
32
+ return /* @__PURE__ */ c("picture", { children: [
33
+ /* @__PURE__ */ e(
34
+ "source",
35
+ {
36
+ srcSet: (r == null ? void 0 : r.imageLarge) || g,
37
+ media: "(min-width: 640px)"
38
+ }
39
+ ),
40
+ /* @__PURE__ */ e(
41
+ "img",
42
+ {
43
+ className: "gi-h-10 sm:gi-h-14",
44
+ src: (r == null ? void 0 : r.imageSmall) || o,
45
+ alt: (r == null ? void 0 : r.alt) || h("logo.govieLogo", { defaultValue: "Gov.ie logo" })
46
+ }
47
+ )
48
+ ] });
49
+ }
50
+ const Q = (r, n, t) => [{
51
+ label: r,
52
+ icon: "menu",
53
+ itemType: "slot",
54
+ component: /* @__PURE__ */ e(E, { items: n, secondaryLinks: t }),
55
+ slotAppearance: "drawer",
56
+ showItemMode: "mobile-only"
57
+ }, ...n], R = ({
58
+ href: r,
59
+ label: n,
60
+ slot: t,
61
+ index: l,
62
+ appearance: o = "default"
63
+ }) => /* @__PURE__ */ e("li", { children: r ? /* @__PURE__ */ e(
64
+ u,
65
+ {
66
+ "aria-label": n,
67
+ "data-testid": `secondary-link-desktop-${l}`,
68
+ href: r,
69
+ className: J({ appearance: o }),
70
+ children: n
71
+ }
72
+ ) : /* @__PURE__ */ e(
73
+ "div",
74
+ {
75
+ className: K({ appearance: o }),
76
+ "data-appearance": o,
77
+ children: t
78
+ }
79
+ ) }), X = ({ links: r, appearance: n }) => /* @__PURE__ */ e("ul", { children: r == null ? void 0 : r.map((t, l) => /* @__PURE__ */ x(
80
+ R,
81
+ {
82
+ ...t,
83
+ index: l,
84
+ key: `secondary-${t.label}-${l}`,
85
+ appearance: n
86
+ }
87
+ )) });
88
+ function ge({
89
+ title: r,
90
+ items: n,
91
+ logo: t,
92
+ secondaryLinks: l,
93
+ fullWidth: o = !1,
94
+ addDefaultMobileMenu: f,
95
+ mobileMenuLabel: g,
96
+ showMenuLabel: N = !0,
97
+ showTitleOnMobile: M,
98
+ dataTestid: V,
99
+ appearance: i = "default",
100
+ ...$
101
+ }) {
102
+ T(() => {
103
+ F();
104
+ }, []);
105
+ const w = ({
106
+ item: a,
107
+ index: s
108
+ }) => {
109
+ switch (a.itemType) {
110
+ case "slot":
111
+ return /* @__PURE__ */ e(B, { index: s, item: a, appearance: i });
112
+ case "link":
113
+ return /* @__PURE__ */ c(
114
+ u,
115
+ {
116
+ className: y({ appearance: i }),
117
+ href: a.href,
118
+ onClick: a.onClick,
119
+ "aria-label": a.label || `link ${s}`,
120
+ "data-testid": `item-link-${s}`,
121
+ external: a.external,
122
+ children: [
123
+ a.label && a.label,
124
+ a.icon && /* @__PURE__ */ e(j, { icon: a.icon })
125
+ ]
126
+ }
127
+ );
128
+ case "custom-link":
129
+ return /* @__PURE__ */ e(u, { asChild: !0, className: y({ appearance: i }), children: a.component });
130
+ default:
131
+ return /* @__PURE__ */ e("div", { className: z({ appearance: i }) });
132
+ }
133
+ }, H = N ? g || h("header.menu", { defaultValue: "Menu" }) : "", d = I(() => {
134
+ const a = n || [];
135
+ return f ? Q(H, a, l || []) : a;
136
+ }, [f]);
137
+ return /* @__PURE__ */ c(
138
+ "header",
139
+ {
140
+ id: "GovieHeader",
141
+ "aria-label": h("header.siteHeader", { defaultValue: "Site Header" }),
142
+ className: O({ appearance: i }),
143
+ "data-testid": V,
144
+ ...$,
145
+ children: [
146
+ /* @__PURE__ */ e(
147
+ p,
148
+ {
149
+ id: "HeaderContainer",
150
+ className: "gi-order-2",
151
+ fullWidth: o,
152
+ children: /* @__PURE__ */ c("div", { className: P({ appearance: i }), children: [
153
+ /* @__PURE__ */ c("div", { className: U({ appearance: i }), children: [
154
+ (t == null ? void 0 : t.href) && /* @__PURE__ */ e(
155
+ u,
156
+ {
157
+ href: t.href,
158
+ "aria-label": h("header.goToHomePage", {
159
+ defaultValue: "Go to Home Page"
160
+ }),
161
+ "data-testid": "logo-link",
162
+ external: t.external,
163
+ children: S({ logo: t, appearance: i })
164
+ }
165
+ ),
166
+ !(t != null && t.href) && S({ logo: t, appearance: i })
167
+ ] }),
168
+ /* @__PURE__ */ e(
169
+ "div",
170
+ {
171
+ className: k(W({ appearance: i }), {
172
+ "gi-hidden": !M
173
+ }),
174
+ children: r
175
+ }
176
+ ),
177
+ /* @__PURE__ */ e("div", { className: "gi-flex gi-items-center gi-gap-2 md:gi-gap-4 gi-flex-none", children: d == null ? void 0 : d.map((a, s) => {
178
+ const { label: b, showItemMode: m = "desktop-only" } = a;
179
+ return /* @__PURE__ */ e(
180
+ "div",
181
+ {
182
+ "aria-label": a.ariaLabel,
183
+ "data-testid": `header-item-${s}`,
184
+ className: k({
185
+ "gi-block": m === "always",
186
+ "gi-block lg:gi-hidden": m === "mobile-only",
187
+ "gi-hidden lg:gi-block": m === "desktop-only"
188
+ }),
189
+ children: /* @__PURE__ */ e(w, { item: a, index: s })
190
+ },
191
+ `item-${b}-${s}`
192
+ );
193
+ }) })
194
+ ] })
195
+ }
196
+ ),
197
+ l && /* @__PURE__ */ e("div", { className: q({ appearance: i }), children: /* @__PURE__ */ e(
198
+ p,
199
+ {
200
+ className: "gi-flex gi-justify-end gi-items-center",
201
+ fullWidth: o,
202
+ children: l && /* @__PURE__ */ e(X, { links: l, appearance: i })
203
+ }
204
+ ) }),
205
+ d == null ? void 0 : d.map(({ itemType: a, component: s, slotAppearance: b }, m) => {
206
+ if (a === "slot")
207
+ return s && b !== "drawer" ? /* @__PURE__ */ e(
208
+ G,
209
+ {
210
+ slot: s,
211
+ index: m,
212
+ appearance: i
213
+ },
214
+ `slot-container-${m}`
215
+ ) : null;
216
+ })
217
+ ]
218
+ }
219
+ );
220
+ }
221
+ export {
222
+ ge as HeaderLegacy
223
+ };
@@ -0,0 +1,2 @@
1
+ import { HeaderLogoProps } from '../../types.js';
2
+ export declare const HeaderLogo: ({ children }: HeaderLogoProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsx as o } from "react/jsx-runtime";
4
+ import { headerLogoVariants as a } from "../../variants.js";
5
+ import { useHeaderContext as t } from "../header-context.js";
6
+ const i = ({ children: r }) => {
7
+ const e = t();
8
+ if (!e)
9
+ throw new Error("HeaderLogo must be used within a Header");
10
+ return /* @__PURE__ */ o("div", { className: a({ appearance: e == null ? void 0 : e.variant }), children: r });
11
+ };
12
+ Object.defineProperty(i, "componentType", {
13
+ value: "HeaderLogo",
14
+ writable: !1,
15
+ enumerable: !1
16
+ });
17
+ export {
18
+ i as HeaderLogo
19
+ };
@@ -0,0 +1,2 @@
1
+ import { HeaderTitleProps } from '../../types.js';
2
+ export declare const HeaderTitle: ({ children, className }: HeaderTitleProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsx as a } from "react/jsx-runtime";
4
+ import { cn as o } from "../../../cn.js";
5
+ import { headerTitleVariants as i } from "../../variants.js";
6
+ import { useHeaderContext as n } from "../header-context.js";
7
+ const m = ({ children: r, className: t }) => {
8
+ const e = n();
9
+ if (!e)
10
+ throw new Error("HeaderTitle must be used within a Header");
11
+ return /* @__PURE__ */ a(
12
+ "div",
13
+ {
14
+ className: o(
15
+ t,
16
+ i({ appearance: e.variant })
17
+ ),
18
+ children: r
19
+ }
20
+ );
21
+ };
22
+ Object.defineProperty(m, "componentType", {
23
+ value: "HeaderTitle",
24
+ writable: !1,
25
+ enumerable: !1
26
+ });
27
+ export {
28
+ m as HeaderTitle
29
+ };
@@ -0,0 +1,2 @@
1
+ import { HeaderMenuItemButtonProps } from '../../../../types.js';
2
+ export declare const HeaderMenuItemButton: ({ asChild, children, className, ...props }: HeaderMenuItemButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsx as n, Fragment as s, jsxs as u } from "react/jsx-runtime";
4
+ import { a as c } from "../../../../../index-2sRBqKFV.js";
5
+ import { cn as p } from "../../../../../cn.js";
6
+ import { Icon as d } from "../../../../../icon/icon.js";
7
+ import { Button as f } from "../../../../../primitives/button.js";
8
+ import { headerToolItemVariants as l } from "../../../../variants.js";
9
+ import { useHeaderContext as H } from "../../../header-context.js";
10
+ import { useHeaderMenuSection as M } from "../header-menu-context.js";
11
+ const h = ({ showItemMode: t, children: r, icon: e, ...o }) => /* @__PURE__ */ n(s, { children: /* @__PURE__ */ u(f, { "data-item-mode": t, ...o, children: [
12
+ r,
13
+ e && /* @__PURE__ */ n(d, { icon: e, ariaHidden: !0 })
14
+ ] }) }), x = ({
15
+ asChild: t,
16
+ children: r,
17
+ className: e,
18
+ ...o
19
+ }) => {
20
+ const a = M(), m = H();
21
+ if (!a || a === "secondary")
22
+ throw new Error(
23
+ "HeaderMenuItemButton must be used within a HeaderPrimaryMenu"
24
+ );
25
+ const i = m.variant;
26
+ return /* @__PURE__ */ n(
27
+ t ? c : h,
28
+ {
29
+ className: p(l({ appearance: i }), e),
30
+ ...o,
31
+ children: r
32
+ }
33
+ );
34
+ };
35
+ Object.defineProperty(x, "componentType", {
36
+ value: "HeaderMenuItemButton",
37
+ writable: !1,
38
+ enumerable: !1
39
+ });
40
+ export {
41
+ x as HeaderMenuItemButton
42
+ };
@@ -0,0 +1,8 @@
1
+ export declare const HeaderMenuItemLink: import('react').ForwardRefExoticComponent<import('react').AnchorHTMLAttributes<HTMLAnchorElement> & {
2
+ asChild?: boolean;
3
+ showItemMode?: import('../../../../types.js').HeaderItemMode;
4
+ icon?: import('../../../../../icon/icon.js').IconId;
5
+ href?: string;
6
+ external?: boolean;
7
+ children: import('react').ReactNode;
8
+ } & import('react').RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsx as n, jsxs as H } from "react/jsx-runtime";
4
+ import { a as M } from "../../../../../index-2sRBqKFV.js";
5
+ import { forwardRef as I } from "react";
6
+ import { cn as k } from "../../../../../cn.js";
7
+ import { Icon as w } from "../../../../../icon/icon.js";
8
+ import b from "../../../../../primitives/anchor.js";
9
+ import { headerSecondaryLinkItemVariants as x, headerToolItemVariants as L } from "../../../../variants.js";
10
+ import { useHeaderContext as g } from "../../../header-context.js";
11
+ import { useHeaderMenuSection as S } from "../header-menu-context.js";
12
+ const j = ({ icon: e, children: r, showItemMode: o, ...t }) => /* @__PURE__ */ H(b, { ...t, "data-item-mode": o, children: [
13
+ r,
14
+ e ? /* @__PURE__ */ n(w, { icon: e, "aria-hidden": "true" }) : null
15
+ ] }), f = I(
16
+ ({ asChild: e, href: r, external: o, children: t, className: m, target: h, rel: a, ...c }, s) => {
17
+ const y = g(), d = S();
18
+ if (!d)
19
+ throw new Error(
20
+ "HeaderMenuItemLink must be used within a HeaderSecondaryMenu or HeaderPrimaryMenu"
21
+ );
22
+ const u = y.variant, p = e ? M : j, i = h ?? (o ? "_blank" : void 0), l = e ? {} : {
23
+ href: r,
24
+ target: i,
25
+ rel: a
26
+ };
27
+ switch (d) {
28
+ case "primary":
29
+ return /* @__PURE__ */ n(
30
+ p,
31
+ {
32
+ ref: s,
33
+ rel: a,
34
+ href: r,
35
+ target: i,
36
+ className: k(L({ appearance: u }), m),
37
+ ...l,
38
+ ...c,
39
+ children: t
40
+ }
41
+ );
42
+ case "secondary":
43
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
44
+ p,
45
+ {
46
+ ref: s,
47
+ rel: a,
48
+ href: r,
49
+ target: i,
50
+ className: x({
51
+ appearance: u,
52
+ className: m
53
+ }),
54
+ ...l,
55
+ ...c,
56
+ children: t
57
+ }
58
+ ) });
59
+ default:
60
+ return null;
61
+ }
62
+ }
63
+ );
64
+ f.displayName = "HeaderMenuItemLink";
65
+ Object.defineProperty(f, "componentType", {
66
+ value: "HeaderMenuItemLink",
67
+ writable: !1,
68
+ enumerable: !1
69
+ });
70
+ export {
71
+ f as HeaderMenuItemLink
72
+ };
@@ -0,0 +1,3 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export type HeaderMenuItemSeparatorProps = ComponentPropsWithoutRef<'div'>;
3
+ export declare const HeaderMenuItemSeparator: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { jsx as i } from "react/jsx-runtime";
4
+ import { forwardRef as p } from "react";
5
+ import { cn as s } from "../../../../../cn.js";
6
+ import { headerDividerVariants as d } from "../../../../variants.js";
7
+ import { useHeaderContext as c } from "../../../header-context.js";
8
+ import { useHeaderMenuSection as u } from "../header-menu-context.js";
9
+ const r = p(({ className: a, ...t }, o) => {
10
+ const n = c(), e = u();
11
+ if (!e || e === "secondary")
12
+ throw new Error(
13
+ "HeaderMenuItemSeparator must be used within a HeaderPrimaryMenu"
14
+ );
15
+ const m = n.variant;
16
+ return /* @__PURE__ */ i(
17
+ "div",
18
+ {
19
+ ref: o,
20
+ role: "separator",
21
+ className: s(d({ appearance: m }), a),
22
+ ...t
23
+ }
24
+ );
25
+ });
26
+ r.displayName = "HeaderMenuItemSeparator";
27
+ Object.defineProperty(r, "componentType", {
28
+ value: "HeaderMenuItemSeparator",
29
+ writable: !1,
30
+ enumerable: !1
31
+ });
32
+ export {
33
+ r as HeaderMenuItemSeparator
34
+ };
@@ -0,0 +1,5 @@
1
+ export declare const HeaderMenuItemSlot: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
2
+ children?: import('react').ReactNode;
3
+ } & {
4
+ children?: import('react').ReactNode | undefined;
5
+ } & import('react').RefAttributes<HTMLDivElement>>;