@ilo-org/react 0.2.1 → 0.4.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 (95) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/lib/cjs/{DailyMotion-2aa7f048.js → DailyMotion-5654fa6e.js} +1 -1
  4. package/lib/cjs/{Facebook-87e24af8.js → Facebook-1924e510.js} +1 -1
  5. package/lib/cjs/{FilePlayer-e1216cc8.js → FilePlayer-9c697e42.js} +1 -1
  6. package/lib/cjs/{Kaltura-a673a8e9.js → Kaltura-177bb003.js} +1 -1
  7. package/lib/cjs/{Mixcloud-f9575c31.js → Mixcloud-91a772a6.js} +1 -1
  8. package/lib/cjs/{Preview-468c3a7f.js → Preview-8e2afb6a.js} +1 -1
  9. package/lib/cjs/{SoundCloud-7c59f293.js → SoundCloud-089e0f30.js} +1 -1
  10. package/lib/cjs/{Streamable-83e516e5.js → Streamable-4ca5b9c7.js} +1 -1
  11. package/lib/cjs/{Twitch-fdfa1c77.js → Twitch-dbc5c387.js} +1 -1
  12. package/lib/cjs/{VideoPlayer-9ce35136.js → VideoPlayer-874a52b0.js} +21 -16
  13. package/lib/cjs/{Vidyard-096bba3c.js → Vidyard-371acdcb.js} +1 -1
  14. package/lib/cjs/{Vimeo-2cb7476f.js → Vimeo-4d2029a8.js} +1 -1
  15. package/lib/cjs/{Wistia-5e830ac8.js → Wistia-cd0799ad.js} +1 -1
  16. package/lib/cjs/{YouTube-25a1d9a0.js → YouTube-23b7ec9e.js} +1 -1
  17. package/lib/cjs/components/Card/Card.js +43 -0
  18. package/lib/cjs/components/Card/CardGroup.js +25 -0
  19. package/lib/cjs/components/Card/index.js +21 -0
  20. package/lib/cjs/components/LocalNav/LocalNav.js +5 -3
  21. package/lib/cjs/components/LocalNav/index.js +1 -0
  22. package/lib/cjs/components/Logo/Logo.js +153 -0
  23. package/lib/cjs/components/Logo/index.js +13 -0
  24. package/lib/cjs/components/Navigation/Navigation.js +48 -0
  25. package/lib/cjs/components/Navigation/index.js +20 -0
  26. package/lib/cjs/components/Video/Video.js +1 -1
  27. package/lib/cjs/components/Video/VideoPlayer.js +1 -1
  28. package/lib/cjs/components/Video/index.js +1 -1
  29. package/lib/cjs/components/index.js +9 -1
  30. package/lib/cjs/index.js +9 -1
  31. package/lib/esm/{DailyMotion-66b6eff2.js → DailyMotion-88f6c379.js} +1 -1
  32. package/lib/esm/{Facebook-dbd1003d.js → Facebook-3a284039.js} +1 -1
  33. package/lib/esm/{FilePlayer-617ed2ce.js → FilePlayer-dee1f94b.js} +1 -1
  34. package/lib/esm/{Kaltura-bbcec33d.js → Kaltura-c5d42c88.js} +1 -1
  35. package/lib/esm/{Mixcloud-a681ec69.js → Mixcloud-430ab42a.js} +1 -1
  36. package/lib/esm/{Preview-407cc648.js → Preview-7f57e055.js} +1 -1
  37. package/lib/esm/{SoundCloud-16e78ee5.js → SoundCloud-d1ab591e.js} +1 -1
  38. package/lib/esm/{Streamable-ecb225c1.js → Streamable-042d61d5.js} +1 -1
  39. package/lib/esm/{Twitch-8d1b6769.js → Twitch-2f45534f.js} +1 -1
  40. package/lib/esm/{VideoPlayer-62e0ce79.js → VideoPlayer-719076c4.js} +21 -16
  41. package/lib/esm/{Vidyard-57e2834a.js → Vidyard-4625527b.js} +1 -1
  42. package/lib/esm/{Vimeo-faa058a2.js → Vimeo-03b960e6.js} +1 -1
  43. package/lib/esm/{Wistia-24fb5120.js → Wistia-48f9c303.js} +1 -1
  44. package/lib/esm/{YouTube-01b3e51f.js → YouTube-5b29a3d9.js} +1 -1
  45. package/lib/esm/components/Card/Card.js +41 -0
  46. package/lib/esm/components/Card/CardGroup.js +23 -0
  47. package/lib/esm/components/Card/index.js +14 -0
  48. package/lib/esm/components/LocalNav/LocalNav.js +5 -3
  49. package/lib/esm/components/LocalNav/index.js +1 -0
  50. package/lib/esm/components/Logo/Logo.js +151 -0
  51. package/lib/esm/components/Logo/index.js +7 -0
  52. package/lib/esm/components/Navigation/Navigation.js +46 -0
  53. package/lib/esm/components/Navigation/index.js +14 -0
  54. package/lib/esm/components/Video/Video.js +1 -1
  55. package/lib/esm/components/Video/VideoPlayer.js +1 -1
  56. package/lib/esm/components/Video/index.js +1 -1
  57. package/lib/esm/components/index.js +6 -1
  58. package/lib/esm/index.js +6 -1
  59. package/lib/types/react/src/components/Card/Card.d.ts +4 -0
  60. package/lib/types/react/src/components/Card/Card.props.d.ts +110 -0
  61. package/lib/types/react/src/components/Card/CardGroup.d.ts +4 -0
  62. package/lib/types/react/src/components/Card/CardGroup.props.d.ts +16 -0
  63. package/lib/types/react/src/components/Card/index.d.ts +2 -0
  64. package/lib/types/react/src/components/LocalNav/LocalNav.props.d.ts +4 -7
  65. package/lib/types/react/src/components/Logo/Logo.d.ts +4 -0
  66. package/lib/types/react/src/components/Logo/Logo.props.d.ts +55 -0
  67. package/lib/types/react/src/components/Logo/index.d.ts +1 -0
  68. package/lib/types/react/src/components/Navigation/Navigation.d.ts +4 -0
  69. package/lib/types/react/src/components/Navigation/Navigation.props.d.ts +99 -0
  70. package/lib/types/react/src/components/Navigation/index.d.ts +1 -0
  71. package/lib/types/react/src/components/index.d.ts +2 -0
  72. package/lib/types/react/src/types/index.d.ts +6 -0
  73. package/package.json +18 -17
  74. package/public/favicon.ico +0 -0
  75. package/src/components/Accordion/Accordion.args.ts +1 -4
  76. package/src/components/Card/Card.args.ts +215 -0
  77. package/src/components/Card/Card.props.ts +142 -0
  78. package/src/components/Card/Card.tsx +183 -0
  79. package/src/components/Card/CardGroup.args.ts +945 -0
  80. package/src/components/Card/CardGroup.props.ts +19 -0
  81. package/src/components/Card/CardGroup.tsx +55 -0
  82. package/src/components/Card/index.ts +2 -0
  83. package/src/components/LocalNav/LocalNav.args.ts +6 -6
  84. package/src/components/LocalNav/LocalNav.props.ts +4 -8
  85. package/src/components/LocalNav/LocalNav.tsx +21 -15
  86. package/src/components/Logo/Logo.args.ts +45 -0
  87. package/src/components/Logo/Logo.props.ts +67 -0
  88. package/src/components/Logo/Logo.tsx +247 -0
  89. package/src/components/Logo/index.ts +1 -0
  90. package/src/components/Navigation/Navigation.args.ts +112 -0
  91. package/src/components/Navigation/Navigation.props.ts +120 -0
  92. package/src/components/Navigation/Navigation.tsx +246 -0
  93. package/src/components/Navigation/index.ts +1 -0
  94. package/src/components/index.ts +2 -0
  95. package/src/types/index.ts +14 -0
@@ -0,0 +1,120 @@
1
+ import { LinkProps, ContextMenuProps } from "../ContextMenu/ContextMenu.props";
2
+ import { SearchFieldProps } from "../SearchField/SearchField.props";
3
+
4
+ export interface NavigationProps {
5
+ /**
6
+ * Props for the logo of the Navigation
7
+ */
8
+ logo?: Required<string>;
9
+
10
+ /**
11
+ * Props for the mobile logo of the Navigation
12
+ */
13
+ mobilelogo?: Required<string>;
14
+
15
+ /**
16
+ * Props for the home url of the Navigation
17
+ */
18
+ siteurl?: Required<string>;
19
+
20
+ /**
21
+ * Specify the tagline for the Navigation
22
+ */
23
+ tagline?: Required<TaglineProps>;
24
+
25
+ /**
26
+ * Specify the primary items for the Navigation
27
+ */
28
+ primarynav?: Required<PrimaryNavProps>;
29
+
30
+ /**
31
+ * Specify the secondary items for the Navigation
32
+ */
33
+ subnav?: Required<SubNavProps>;
34
+
35
+ /**
36
+ * Specify the tagline for the Navigation
37
+ */
38
+ searchlabel?: string;
39
+
40
+ /**
41
+ * Specify the searchfield props for the Navigation
42
+ */
43
+ searchfield?: SearchFieldProps;
44
+
45
+ /**
46
+ * Specify the menu label for the Navigation
47
+ */
48
+ menulabel?: string;
49
+
50
+ /**
51
+ * Specify the menu close label for the Navigation
52
+ */
53
+ menucloselabel?: string;
54
+
55
+ /**
56
+ * Specify the language label for the Navigation
57
+ */
58
+ languagelabel?: string;
59
+
60
+ /**
61
+ * Specify the language context menu for the Navigation
62
+ */
63
+ languagecontextmenu?: ContextMenuProps;
64
+ }
65
+
66
+ interface PrimaryNavProps {
67
+ /**
68
+ * Specify the label for Navigation
69
+ */
70
+ navlabel?: Required<string>;
71
+
72
+ /**
73
+ * Specify the close label for mobile Navigation
74
+ */
75
+ mobilecloselabel?: Required<string>;
76
+
77
+ /**
78
+ * Specify the links
79
+ */
80
+ items?: Required<Array<LinkProps>>;
81
+ }
82
+
83
+ interface SubNavProps {
84
+ /**
85
+ * Specify the label for sub Navigation
86
+ */
87
+ navlabel?: Required<string>;
88
+
89
+ /**
90
+ * Specify the button label for sub Navigation
91
+ */
92
+ buttonlabel?: Required<string>;
93
+
94
+ /**
95
+ * Specify the close label for mobile sub Navigation
96
+ */
97
+ mobilecloselabel?: Required<string>;
98
+
99
+ /**
100
+ * Specify the back label for mobile sub Navigation
101
+ */
102
+ mobilebacklabel?: Required<string>;
103
+
104
+ /**
105
+ * Specify the subnav links
106
+ */
107
+ items?: Required<Array<LinkProps>>;
108
+ }
109
+
110
+ interface TaglineProps {
111
+ /**
112
+ * Specify the main tagline text
113
+ */
114
+ tag?: Required<string>;
115
+
116
+ /**
117
+ * Specify the small tagline text
118
+ */
119
+ small?: Required<string>;
120
+ }
@@ -0,0 +1,246 @@
1
+ import { FC, useState } from "react";
2
+ import useGlobalSettings from "../../hooks/useGlobalSettings";
3
+ import { ContextMenu } from "../ContextMenu";
4
+ import { SearchField } from "../SearchField";
5
+ import { NavigationProps } from "./Navigation.props";
6
+ import classnames from "classnames";
7
+
8
+ const Navigation: FC<NavigationProps> = ({
9
+ logo,
10
+ mobilelogo,
11
+ siteurl,
12
+ tagline,
13
+ primarynav,
14
+ subnav,
15
+ menulabel,
16
+ menucloselabel,
17
+ searchlabel,
18
+ searchfield,
19
+ languagelabel,
20
+ languagecontextmenu,
21
+ }) => {
22
+ const { prefix } = useGlobalSettings();
23
+
24
+ const [toggleMenuOpen, setMenuToggleOpen] = useState(false);
25
+ const [toggleSearchOpen, setSearchToggleOpen] = useState(false);
26
+ const [toggleSubnavOpen, setSubnavToggleOpen] = useState(false);
27
+ const [toggleLanguageOpen, setLanguageToggleOpen] = useState(false);
28
+
29
+ const baseClass = `${prefix}--header`;
30
+ const NavigationClasses = classnames(baseClass, {
31
+ [`${prefix}--mobile--open`]: toggleMenuOpen,
32
+ [`${prefix}--select--open`]: toggleLanguageOpen,
33
+ [`${prefix}--search--open`]: toggleSearchOpen,
34
+ [`${prefix}--subnav--open`]: toggleSubnavOpen,
35
+ });
36
+
37
+ const handleMenuToggle = () => {
38
+ setMenuToggleOpen(!toggleMenuOpen);
39
+ };
40
+
41
+ const handleLanguageToggle = () => {
42
+ setLanguageToggleOpen(!toggleLanguageOpen);
43
+ };
44
+
45
+ const handleSearchToggle = () => {
46
+ setSearchToggleOpen(!toggleSearchOpen);
47
+ };
48
+
49
+ const handleSubnavToggle = () => {
50
+ setSubnavToggleOpen(!toggleSubnavOpen);
51
+ };
52
+
53
+ return (
54
+ <header className={NavigationClasses}>
55
+ <div className={`${baseClass}--utility-bar`}>
56
+ <div className={`${prefix}--language-switcher`}>
57
+ <div className={`${prefix}--language-switcher--wrap`}>
58
+ <button
59
+ className={`${prefix}--language-switcher--button`}
60
+ type="button"
61
+ >
62
+ {languagelabel}
63
+ </button>
64
+ <ContextMenu links={languagecontextmenu?.links}></ContextMenu>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ <div className={`${baseClass}--logo-bar`}>
69
+ <div className={`${baseClass}--inner`}>
70
+ <a href={siteurl} className={`${baseClass}--logo-link`}>
71
+ <img className={`${baseClass}--logo`} src={logo} alt="ILO Logo" />
72
+ </a>
73
+ <p className={`${baseClass}--logo-tagline`}>
74
+ {tagline?.tag}
75
+ <span className={`${baseClass}--logo-tagline--small`}>
76
+ {tagline?.small}
77
+ </span>
78
+ </p>
79
+ <button className={`${baseClass}--menu`} onClick={handleMenuToggle}>
80
+ {menulabel}
81
+ </button>
82
+ </div>
83
+ </div>
84
+ <div className={`${baseClass}--navigation`}>
85
+ <div className={`${baseClass}--inner`}>
86
+ <div className={`${prefix}--mobile--nav`}>
87
+ <div className={`${prefix}--mobile--nav--logo`}>
88
+ <a href={siteurl} className={`${baseClass}--logo-link`}>
89
+ <img
90
+ className={`${baseClass}--logo`}
91
+ src={mobilelogo}
92
+ alt="ILO Logo"
93
+ />
94
+ </a>
95
+ <button
96
+ className={`${baseClass}--menu--close`}
97
+ onClick={handleMenuToggle}
98
+ >
99
+ {menucloselabel}
100
+ </button>
101
+ </div>
102
+ <div className={`${prefix}--mobile--nav--search`}>
103
+ <SearchField
104
+ input={searchfield?.input}
105
+ action={searchfield?.action}
106
+ ></SearchField>
107
+ </div>
108
+ <div className={`${prefix}--mobile--nav--language--switcher`}>
109
+ <button
110
+ className={`${prefix}--mobile--nav--language--switcher--button`}
111
+ onClick={handleLanguageToggle}
112
+ type="button"
113
+ >
114
+ {languagelabel}
115
+ </button>
116
+ </div>
117
+ <div className={`${prefix}--mobile--nav--language--select`}>
118
+ <div className={`${baseClass}--inner`}>
119
+ <div className={`${prefix}--mobile--subnav--menu`}>
120
+ <button
121
+ className={`${prefix}--mobile--subnav--back`}
122
+ onClick={handleLanguageToggle}
123
+ type="button"
124
+ >
125
+ {subnav?.mobilebacklabel}
126
+ </button>
127
+ <button
128
+ className={`${baseClass}--menu--close`}
129
+ onClick={handleMenuToggle}
130
+ >
131
+ {subnav?.mobilecloselabel}
132
+ </button>
133
+ <h6 className={`${prefix}--mobile--subnav--label`}>
134
+ {languagelabel}
135
+ </h6>
136
+ </div>
137
+ <ul className={`${prefix}--nav--set`}>
138
+ {languagecontextmenu?.links &&
139
+ languagecontextmenu.links.map((item, index) => (
140
+ <li className={`${prefix}--nav--items`} key={index}>
141
+ <a
142
+ href={item.url}
143
+ className={`${prefix}--nav--link ${prefix}--nav--language`}
144
+ >
145
+ {item.label}
146
+ </a>
147
+ </li>
148
+ ))}
149
+ </ul>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ <nav
154
+ className={`${prefix}--nav`}
155
+ aria-labelledby="primary-navigation"
156
+ >
157
+ <h2 className={`${prefix}--nav--label`} id="primary-navigation">
158
+ {primarynav?.navlabel}
159
+ </h2>
160
+ <ul className={`${prefix}--nav--set`}>
161
+ {primarynav?.items &&
162
+ primarynav.items.map((item, index) => (
163
+ <li className={`${prefix}--nav--items`} key={index}>
164
+ <a href={item.url} className={`${prefix}--nav--link`}>
165
+ {item.label}
166
+ </a>
167
+ </li>
168
+ ))}
169
+ {subnav && (
170
+ <li className={`${prefix}--nav--items`}>
171
+ <button
172
+ className={`${prefix}--nav--trigger`}
173
+ onClick={handleSubnavToggle}
174
+ >
175
+ {subnav.buttonlabel}
176
+ </button>
177
+ </li>
178
+ )}
179
+ </ul>
180
+ </nav>
181
+ <div className={`${prefix}--search`}>
182
+ <button
183
+ className={`${prefix}--search--button`}
184
+ type="button"
185
+ onClick={handleSearchToggle}
186
+ >
187
+ {searchlabel}
188
+ </button>
189
+ </div>
190
+ </div>
191
+ {subnav && (
192
+ <nav
193
+ className={`${prefix}--subnav`}
194
+ aria-labelledby="secondary-navigation"
195
+ >
196
+ <div className={`${prefix}--subnav--inner`}>
197
+ <div className={`${prefix}--mobile--subnav`}>
198
+ <div className={`${prefix}--mobile--subnav--menu`}>
199
+ <button
200
+ className={`${prefix}--mobile--subnav--back`}
201
+ onClick={handleSubnavToggle}
202
+ type="button"
203
+ >
204
+ {subnav.mobilebacklabel}
205
+ </button>
206
+ <button
207
+ className={`${prefix}--header--menu--close`}
208
+ onClick={handleMenuToggle}
209
+ >
210
+ {subnav.mobilecloselabel}
211
+ </button>
212
+ <h6 className={`${prefix}--mobile--subnav--label`}>
213
+ {subnav.buttonlabel}
214
+ </h6>
215
+ </div>
216
+ </div>
217
+ <h2 className={`${prefix}--nav--label`} id="secondary-navigation">
218
+ {subnav.navlabel}
219
+ </h2>
220
+ <ul className={`${prefix}--subnav--set`}>
221
+ {subnav?.items &&
222
+ subnav.items.map((item, index) => (
223
+ <li className={`${prefix}--subnav--items`} key={index}>
224
+ <a href={item.url} className={`${prefix}--subnav--link`}>
225
+ {item.label}
226
+ </a>
227
+ </li>
228
+ ))}
229
+ </ul>
230
+ </div>
231
+ </nav>
232
+ )}
233
+ <div className={`${prefix}--search-box`}>
234
+ <div className={`${prefix}--header--inner`}>
235
+ <SearchField
236
+ input={searchfield?.input}
237
+ action={searchfield?.action}
238
+ ></SearchField>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </header>
243
+ );
244
+ };
245
+
246
+ export default Navigation;
@@ -0,0 +1 @@
1
+ export { default as Navigation } from "./Navigation";
@@ -44,3 +44,5 @@ export { Profile } from "./Profile";
44
44
  export { TableOfContents } from "./TableOfContents";
45
45
  export { Footer } from "./Footer";
46
46
  export { LocalNav } from "./LocalNav";
47
+ export { Navigation } from "./Navigation";
48
+ export { Card, CardGroup } from "./Card";
@@ -33,6 +33,7 @@ export type InputTypes =
33
33
  | "tel"
34
34
  | "text"
35
35
  | "url";
36
+ export type Language = "en" | "fr" | "es";
36
37
  export type LabelTypes = "default" | "actionable" | "light";
37
38
  export type LinkTypes = "light" | "dark" | "footer" | "button";
38
39
  export type LinkListThemes = "light" | "dark";
@@ -49,3 +50,16 @@ export type PositionTypes = "top" | "bottom" | "left" | "right";
49
50
  export type SizeTypes = "small" | "medium" | "large";
50
51
  export type TagTypes = "anchor" | "display" | "button";
51
52
  export type SocialTypes = "instagram" | "facebook" | "twitter" | "youtube";
53
+ export type CardColor = "turquoise" | "green" | "yellow" | "blue";
54
+ export type CardSize = "wide" | "standard" | "narrow";
55
+ export type CardCornerType = "cornercut" | "corner";
56
+ export type CardAlignment = "left" | "right";
57
+ export type CardTypes =
58
+ | "stat"
59
+ | "multilink"
60
+ | "graphic"
61
+ | "graphicpromo"
62
+ | "feature"
63
+ | "detail"
64
+ | "factlist"
65
+ | "data";