@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,3 +1,4 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ComponentPropsWithoutRef, PropsWithChildren, ReactNode } from 'react';
1
2
  import { LogoProps } from '../common/types.js';
2
3
  import { DrawerPosition } from '../drawer/drawer.js';
3
4
  import { IconId } from '../icon/icon.js';
@@ -67,17 +68,96 @@ export type SecondaryLink = {
67
68
  href?: undefined;
68
69
  label?: undefined;
69
70
  };
70
- export type HeaderProps = {
71
+ export type HeaderProps = ComponentPropsWithoutRef<'header'> & {
72
+ dataTestid?: string;
73
+ fullWidth?: boolean;
74
+ children?: ReactNode;
75
+ /**
76
+ * @deprecated Replaced by `variant` (new composable API).
77
+ * Use: `<Header variant="default" | "light">…</Header>`.
78
+ */
79
+ appearance?: HeaderAppearance;
80
+ /**
81
+ * @deprecated Use `<HeaderTitle>` child instead.
82
+ * Example: `<Header><HeaderTitle>My site</HeaderTitle></Header>`.
83
+ */
71
84
  title?: string;
85
+ /**
86
+ * @deprecated Use `<HeaderLogo>` + `<SomeLogo />` children.
87
+ * Example: `<Header><HeaderLogo><img src="..."/></HeaderLogo></Header>`.
88
+ */
72
89
  logo?: LogoProps;
90
+ /**
91
+ * @deprecated Mobile menu is now composed with `<HeaderPrimaryMenu>` and item buttons/links.
92
+ * Use: `<HeaderPrimaryMenu><HeaderMenuItemButton showItemMode="mobile-only" … /></HeaderPrimaryMenu>`.
93
+ */
73
94
  addDefaultMobileMenu?: boolean;
95
+ /**
96
+ * @deprecated Provide your own button/label via `<HeaderPrimaryMenu>` children.
97
+ * Use: `<HeaderMenuItemButton aria-label="Open menu">Menu</HeaderMenuItemButton>`.
98
+ */
74
99
  mobileMenuLabel?: string;
100
+ /**
101
+ * @deprecated Control visibility per item with `showItemMode`.
102
+ * Use: `<HeaderMenuItemButton showItemMode="desktop-only" />` (or `mobile-only`, `always`).
103
+ */
75
104
  showMenuLabel?: boolean;
105
+ /**
106
+ * @deprecated Replace with composable menu children.
107
+ * Use:
108
+ * `<HeaderPrimaryMenu>
109
+ * <HeaderMenuItemLink href="/departments">Departments</HeaderMenuItemLink>
110
+ * <HeaderMenuItemButton icon="search" …>Search</HeaderMenuItemButton>
111
+ * </HeaderPrimaryMenu>`
112
+ */
76
113
  items?: HeaderItem[];
114
+ /**
115
+ * @deprecated Replace with `<HeaderSecondaryMenu>` + `<HeaderMenuItemLink|Slot>`.
116
+ * Use:
117
+ * `<HeaderSecondaryMenu>
118
+ * <HeaderMenuItemLink href="/ga">Gaeilge</HeaderMenuItemLink>
119
+ * <HeaderMenuItemSlot><UserChip/></HeaderMenuItemSlot>
120
+ * </HeaderSecondaryMenu>`
121
+ */
77
122
  secondaryLinks?: SecondaryLink[];
78
- fullWidth?: boolean;
123
+ /**
124
+ * @deprecated The title’s responsive behavior is controlled by your child components and CSS.
125
+ * Use: media utilities (e.g., hide/show via classes) around `<HeaderTitle>`.
126
+ */
79
127
  showTitleOnMobile?: boolean;
80
- dataTestid?: string;
81
- appearance?: HeaderAppearance;
82
128
  };
129
+ export type HeaderNextProps = ComponentPropsWithoutRef<'header'> & {
130
+ children?: ReactNode;
131
+ variant?: HeaderVariant;
132
+ fullWidth?: boolean;
133
+ };
134
+ export type HeaderLogoProps = PropsWithChildren;
135
+ export type HeaderVariant = 'default' | 'light';
136
+ export type HeaderMenuItemLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
137
+ asChild?: boolean;
138
+ showItemMode?: HeaderItemMode;
139
+ icon?: IconId;
140
+ href?: string;
141
+ external?: boolean;
142
+ children: ReactNode;
143
+ };
144
+ export type HeaderMenuItemButtonProps = PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement> & {
145
+ className?: string;
146
+ asChild?: boolean;
147
+ showItemMode?: HeaderItemMode;
148
+ icon?: IconId;
149
+ }>;
150
+ export type HeaderPrimaryMenuProps = PropsWithChildren<ComponentPropsWithoutRef<'nav'>>;
151
+ export type HeaderMenuSectionContextProps = 'primary' | 'secondary';
152
+ export type HeaderSlotContainerProps = PropsWithChildren<{
153
+ variant: HeaderVariant;
154
+ className?: string;
155
+ } & ComponentPropsWithoutRef<'div'>>;
156
+ export type HeaderTitleProps = PropsWithChildren<{
157
+ className?: string;
158
+ } & ComponentPropsWithoutRef<'div'>>;
159
+ export type HeaderSecondaryMenuProps = PropsWithChildren<ComponentPropsWithoutRef<'nav'>>;
160
+ export type HeaderMenuItemSlotProps = PropsWithChildren<ComponentPropsWithoutRef<'div'> & {
161
+ children?: ReactNode;
162
+ }>;
83
163
  export {};
@@ -35,7 +35,7 @@ export declare const headerToolItemVariants: import('tailwind-variants').TVRetur
35
35
  default: string;
36
36
  light: string;
37
37
  };
38
- }, undefined, "gi-header-tool-item ", TVConfig<V, EV>, {
38
+ }, undefined, "gi-header-tool-item", TVConfig<V, EV>, {
39
39
  appearance: {
40
40
  default: string;
41
41
  light: string;
@@ -45,7 +45,7 @@ export declare const headerToolItemVariants: import('tailwind-variants').TVRetur
45
45
  default: string;
46
46
  light: string;
47
47
  };
48
- }, undefined, "gi-header-tool-item ", TVConfig<V, EV>, unknown, unknown, undefined>>;
48
+ }, undefined, "gi-header-tool-item", TVConfig<V, EV>, unknown, unknown, undefined>>;
49
49
  export declare const headerSecondaryLinksVariants: import('tailwind-variants').TVReturnType<{
50
50
  appearance: {
51
51
  default: string;
@@ -16,7 +16,7 @@ const e = {
16
16
  appearance: r
17
17
  }
18
18
  }), s = a({
19
- base: "gi-header-tool-item ",
19
+ base: "gi-header-tool-item",
20
20
  variants: {
21
21
  appearance: {
22
22
  default: `${e.default} gi-header-tool-item-default`,
@@ -0,0 +1,15 @@
1
+ export declare const ACTIONS: {
2
+ readonly OPEN: "open";
3
+ readonly CLOSE: "close";
4
+ readonly TOGGLE: "toggle";
5
+ readonly OPEN_ALL: "openAll";
6
+ readonly CLOSE_ALL: "closeAll";
7
+ };
8
+ export declare const useToggleMap: (initialState: any) => readonly [any, {
9
+ open: (key: string) => void;
10
+ close: (key: string) => void;
11
+ toggle: (key: string) => void;
12
+ openAll: () => void;
13
+ closeAll: () => void;
14
+ isOpen: (key: string) => boolean;
15
+ }];
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import "@ogcio/design-system-react/browser-check";
3
+ import { useReducer as u, useMemo as E } from "react";
4
+ const t = {
5
+ OPEN: "open",
6
+ CLOSE: "close",
7
+ TOGGLE: "toggle",
8
+ OPEN_ALL: "openAll",
9
+ CLOSE_ALL: "closeAll"
10
+ }, O = (s, L) => {
11
+ const l = { ...s }, n = Object.keys(s);
12
+ for (const o of n)
13
+ l[o] = L;
14
+ return l;
15
+ }, C = (s) => {
16
+ const L = {
17
+ [t.OPEN]: (e, r) => ({ ...e, [r.key]: !0 }),
18
+ [t.CLOSE]: (e, r) => ({ ...e, [r.key]: !1 }),
19
+ [t.TOGGLE]: (e, r) => ({ ...e, [r.key]: !e[r.key] }),
20
+ [t.OPEN_ALL]: (e) => O(e, !0),
21
+ [t.CLOSE_ALL]: (e) => O(e, !1)
22
+ }, l = (e, r) => (L[r.type] ?? ((p) => p))(e, r), [n, o] = u(l, s), c = E(() => ({
23
+ open: (e) => {
24
+ o({ type: t.OPEN, key: e });
25
+ },
26
+ close: (e) => {
27
+ o({ type: t.CLOSE, key: e });
28
+ },
29
+ toggle: (e) => {
30
+ o({ type: t.TOGGLE, key: e });
31
+ },
32
+ openAll: () => {
33
+ o({ type: t.OPEN_ALL });
34
+ },
35
+ closeAll: () => {
36
+ o({ type: t.CLOSE_ALL });
37
+ },
38
+ isOpen: (e) => !!(n != null && n[e])
39
+ }), [n]);
40
+ return [n, c];
41
+ };
42
+ export {
43
+ t as ACTIONS,
44
+ C as useToggleMap
45
+ };
@@ -1,2 +1,2 @@
1
- export declare const iconIds: readonly ["accessibility_new", "add_circle", "apps", "arrow_back", "arrow_downward", "arrow_drop_down", "arrow_drop_up", "arrow_forward", "arrow_left_alt", "arrow_outward", "arrow_right_alt", "arrow_upward", "attach_file", "block", "call", "cancel", "candlestick_chart", "chat_bubble", "check", "check_circle", "chevron_left", "chevron_right", "child_care", "close", "content_copy", "credit_card", "delete", "directions_car", "do_not_disturb_on", "download", "edit", "error", "event", "filter_list", "health_and_safety", "home", "info", "keyboard_arrow_down", "keyboard_arrow_up", "location_on", "login", "logout", "mail", "menu", "mic", "more_horiz", "more_vert", "open_in_new", "person", "person_cancel", "person_check", "refresh", "search", "send", "settings", "sort", "space_dashboard", "sync", "swap_vert", "thumb_down", "thumb_up", "unfold_more", "upload", "visibility", "visibility_off", "warning", "work", "social_bluesky", "social_facebook", "social_instagram", "social_linkedin", "social_threads", "social_tiktok", "social_x", "social_youtube", "placeholder", "first_page", "last_page"];
2
- export declare const Icons: ("accessibility_new" | "add_circle" | "apps" | "arrow_back" | "arrow_downward" | "arrow_drop_down" | "arrow_drop_up" | "arrow_forward" | "arrow_left_alt" | "arrow_outward" | "arrow_right_alt" | "arrow_upward" | "attach_file" | "block" | "call" | "cancel" | "candlestick_chart" | "chat_bubble" | "check" | "check_circle" | "chevron_left" | "chevron_right" | "child_care" | "close" | "content_copy" | "credit_card" | "delete" | "directions_car" | "do_not_disturb_on" | "download" | "edit" | "error" | "event" | "filter_list" | "health_and_safety" | "home" | "info" | "keyboard_arrow_down" | "keyboard_arrow_up" | "location_on" | "login" | "logout" | "mail" | "menu" | "mic" | "more_horiz" | "more_vert" | "open_in_new" | "person" | "person_cancel" | "person_check" | "refresh" | "search" | "send" | "settings" | "sort" | "space_dashboard" | "sync" | "swap_vert" | "thumb_down" | "thumb_up" | "unfold_more" | "upload" | "visibility" | "visibility_off" | "warning" | "work" | "social_bluesky" | "social_facebook" | "social_instagram" | "social_linkedin" | "social_threads" | "social_tiktok" | "social_x" | "social_youtube" | "placeholder" | "first_page" | "last_page")[];
1
+ export declare const iconIds: readonly ["accessibility_new", "add_circle", "apps", "arrow_back", "arrow_downward", "arrow_drop_down", "arrow_drop_up", "arrow_forward", "arrow_left_alt", "arrow_outward", "arrow_right_alt", "arrow_upward", "attach_file", "block", "call", "cancel", "candlestick_chart", "chat_bubble", "check", "check_circle", "chevron_left", "chevron_right", "child_care", "close", "content_copy", "credit_card", "delete", "directions_car", "do_not_disturb_on", "download", "edit", "error", "event", "filter_list", "health_and_safety", "home", "info", "keyboard_arrow_down", "keyboard_arrow_up", "link", "location_on", "login", "logout", "mail", "menu", "mic", "more_horiz", "more_vert", "open_in_new", "person", "person_cancel", "person_check", "refresh", "search", "send", "settings", "sort", "space_dashboard", "sync", "swap_vert", "thumb_down", "thumb_up", "unfold_more", "upload", "visibility", "visibility_off", "warning", "work", "social_bluesky", "social_facebook", "social_instagram", "social_linkedin", "social_threads", "social_tiktok", "social_x", "social_youtube", "placeholder", "first_page", "last_page"];
2
+ export declare const Icons: ("accessibility_new" | "add_circle" | "apps" | "arrow_back" | "arrow_downward" | "arrow_drop_down" | "arrow_drop_up" | "arrow_forward" | "arrow_left_alt" | "arrow_outward" | "arrow_right_alt" | "arrow_upward" | "attach_file" | "block" | "call" | "cancel" | "candlestick_chart" | "chat_bubble" | "check" | "check_circle" | "chevron_left" | "chevron_right" | "child_care" | "close" | "content_copy" | "credit_card" | "delete" | "directions_car" | "do_not_disturb_on" | "download" | "edit" | "error" | "event" | "filter_list" | "health_and_safety" | "home" | "info" | "keyboard_arrow_down" | "keyboard_arrow_up" | "link" | "location_on" | "login" | "logout" | "mail" | "menu" | "mic" | "more_horiz" | "more_vert" | "open_in_new" | "person" | "person_cancel" | "person_check" | "refresh" | "search" | "send" | "settings" | "sort" | "space_dashboard" | "sync" | "swap_vert" | "thumb_down" | "thumb_up" | "unfold_more" | "upload" | "visibility" | "visibility_off" | "warning" | "work" | "social_bluesky" | "social_facebook" | "social_instagram" | "social_linkedin" | "social_threads" | "social_tiktok" | "social_x" | "social_youtube" | "placeholder" | "first_page" | "last_page")[];
@@ -76,6 +76,8 @@ const o = [
76
76
  // Keyboard arrow down
77
77
  "keyboard_arrow_up",
78
78
  // Keyboard arrow up
79
+ "link",
80
+ // Link
79
81
  "location_on",
80
82
  // Location on
81
83
  "login",
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export type { FormFieldProps } from './forms/form-field/types.js';
34
34
  export { Form } from './forms/form.js';
35
35
  export { HeaderSearch, type HeaderSearchProps, } from './header/components/header-search.js';
36
36
  export { Header } from './header/header.js';
37
+ export * from './header/header-next/index.js';
37
38
  export type { HeaderItem, HeaderProps } from './header/types.js';
38
39
  export { Heading, type HeadingProps } from './heading/heading.js';
39
40
  export type { HintTextProps } from './hint-text/types.js';
@@ -109,3 +110,4 @@ export type { ToastHorizontalPosition, ToastPosition, ToastProps, ToastVariant,
109
110
  export { Tooltip, type TooltipProps } from './tooltip/tooltip.js';
110
111
  export { EditableTableCell } from './data-table/editable-table-cell.js';
111
112
  export type { EditorTableCellConfig, EditorTableCellProps, } from './data-table/types.js';
113
+ export { useToggleMap } from './hooks/use-toggle-map.js';