@ilo-org/react 0.12.0 → 0.14.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 (260) hide show
  1. package/.storybook/main.ts +41 -0
  2. package/.storybook/manager-head.html +92 -0
  3. package/.storybook/manager.ts +6 -0
  4. package/.storybook/preview-head.html +5 -0
  5. package/.storybook/preview.tsx +81 -0
  6. package/.storybook/styles.scss +25 -0
  7. package/.storybook/theme.ts +46 -0
  8. package/.turbo/turbo-build:lib.log +15 -0
  9. package/CHANGELOG.md +43 -0
  10. package/lib/cjs/components/Cards/CardGroup/CardGroup.js +41 -0
  11. package/lib/cjs/components/Cards/CardGroup/index.js +796 -0
  12. package/lib/cjs/components/Cards/DataCard/DataCard.js +27 -0
  13. package/lib/cjs/components/Cards/DataCard/index.js +73 -19
  14. package/lib/cjs/components/Cards/DetailCard/DetailCard.js +20 -0
  15. package/lib/cjs/components/Cards/DetailCard/index.js +17 -12
  16. package/lib/cjs/components/Cards/FactlistCard/FactListCard.js +22 -0
  17. package/lib/cjs/components/Cards/FactlistCard/index.js +16 -15
  18. package/lib/cjs/components/Cards/FeatureCard/FeatureCard.js +24 -0
  19. package/lib/cjs/components/Cards/FeatureCard/index.js +31 -16
  20. package/lib/cjs/components/Cards/MultilinkCard/MultiLinkCard.js +24 -0
  21. package/lib/cjs/components/Cards/MultilinkCard/index.js +35 -16
  22. package/lib/cjs/components/Cards/PromoCard/PromoCard.js +23 -0
  23. package/lib/cjs/components/Cards/PromoCard/index.js +18 -15
  24. package/lib/cjs/components/Cards/StatCard/StatCard.js +21 -0
  25. package/lib/cjs/components/Cards/StatCard/index.js +15 -13
  26. package/lib/cjs/components/Cards/TextCard/TextCard.js +23 -0
  27. package/lib/cjs/components/Cards/TextCard/index.js +22 -17
  28. package/lib/cjs/components/Footer/Footer.js +1 -1
  29. package/lib/cjs/components/List/List.js +9 -11
  30. package/lib/cjs/components/List/ListItem.js +4 -7
  31. package/lib/cjs/components/List/index.js +1 -2
  32. package/lib/cjs/components/Navigation/Navigation.js +3 -3
  33. package/lib/cjs/components/Pagination/Pagination.js +1 -1
  34. package/lib/cjs/components/index.js +10 -13
  35. package/lib/cjs/index.js +10 -13
  36. package/lib/esm/components/Cards/CardGroup/CardGroup.js +39 -0
  37. package/lib/esm/components/Cards/CardGroup/index.js +793 -0
  38. package/lib/esm/components/Cards/DataCard/DataCard.js +25 -0
  39. package/lib/esm/components/Cards/DataCard/index.js +72 -19
  40. package/lib/esm/components/Cards/DetailCard/DetailCard.js +18 -0
  41. package/lib/esm/components/Cards/DetailCard/index.js +16 -12
  42. package/lib/esm/components/Cards/FactlistCard/FactListCard.js +20 -0
  43. package/lib/esm/components/Cards/FactlistCard/index.js +15 -15
  44. package/lib/esm/components/Cards/FeatureCard/FeatureCard.js +22 -0
  45. package/lib/esm/components/Cards/FeatureCard/index.js +30 -16
  46. package/lib/esm/components/Cards/MultilinkCard/MultiLinkCard.js +22 -0
  47. package/lib/esm/components/Cards/MultilinkCard/index.js +34 -16
  48. package/lib/esm/components/Cards/PromoCard/PromoCard.js +21 -0
  49. package/lib/esm/components/Cards/PromoCard/index.js +17 -15
  50. package/lib/esm/components/Cards/StatCard/StatCard.js +19 -0
  51. package/lib/esm/components/Cards/StatCard/index.js +14 -13
  52. package/lib/esm/components/Cards/TextCard/TextCard.js +21 -0
  53. package/lib/esm/components/Cards/TextCard/index.js +21 -17
  54. package/lib/esm/components/Footer/Footer.js +1 -1
  55. package/lib/esm/components/List/List.js +10 -12
  56. package/lib/esm/components/List/ListItem.js +4 -7
  57. package/lib/esm/components/List/index.js +1 -2
  58. package/lib/esm/components/Navigation/Navigation.js +3 -3
  59. package/lib/esm/components/Pagination/Pagination.js +1 -1
  60. package/lib/esm/components/index.js +9 -11
  61. package/lib/esm/index.js +9 -11
  62. package/lib/types/react/src/components/Cards/CardGroup/CardGroup.args.d.ts +13 -0
  63. package/lib/types/react/src/components/Cards/CardGroup/CardGroup.props.d.ts +58 -0
  64. package/lib/types/react/src/components/Cards/CardGroup/index.d.ts +3 -0
  65. package/lib/types/react/src/components/Cards/DataCard/DataCard.args.d.ts +2 -0
  66. package/lib/types/react/src/components/Cards/DataCard/DataCard.d.ts +4 -0
  67. package/lib/types/react/src/components/Cards/DataCard/DataCard.props.d.ts +50 -0
  68. package/lib/types/react/src/components/Cards/DataCard/index.d.ts +3 -4
  69. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.args.d.ts +3 -0
  70. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.d.ts +4 -0
  71. package/lib/types/react/src/components/Cards/DetailCard/DetailCard.props.d.ts +35 -0
  72. package/lib/types/react/src/components/Cards/DetailCard/index.d.ts +3 -4
  73. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.args.d.ts +3 -0
  74. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.d.ts +4 -0
  75. package/lib/types/react/src/components/Cards/FactlistCard/FactListCard.props.d.ts +16 -0
  76. package/lib/types/react/src/components/Cards/FactlistCard/index.d.ts +3 -4
  77. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.args.d.ts +3 -0
  78. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.d.ts +4 -0
  79. package/lib/types/react/src/components/Cards/FeatureCard/FeatureCard.props.d.ts +31 -0
  80. package/lib/types/react/src/components/Cards/FeatureCard/index.d.ts +3 -4
  81. package/lib/types/react/src/components/Cards/MultilinkCard/MultiLinkCard.d.ts +4 -0
  82. package/lib/types/react/src/components/Cards/MultilinkCard/MultilinkCard.args.d.ts +2 -0
  83. package/lib/types/react/src/components/Cards/MultilinkCard/MultilinkCard.props.d.ts +25 -0
  84. package/lib/types/react/src/components/Cards/MultilinkCard/index.d.ts +3 -4
  85. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.args.d.ts +3 -0
  86. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.d.ts +4 -0
  87. package/lib/types/react/src/components/Cards/PromoCard/PromoCard.props.d.ts +30 -0
  88. package/lib/types/react/src/components/Cards/PromoCard/index.d.ts +3 -4
  89. package/lib/types/react/src/components/Cards/StatCard/StatCard.args.d.ts +3 -0
  90. package/lib/types/react/src/components/Cards/StatCard/StatCard.d.ts +4 -0
  91. package/lib/types/react/src/components/Cards/StatCard/StatCard.props.d.ts +18 -0
  92. package/lib/types/react/src/components/Cards/StatCard/index.d.ts +3 -4
  93. package/lib/types/react/src/components/Cards/TextCard/TextCard.args.d.ts +3 -0
  94. package/lib/types/react/src/components/Cards/TextCard/TextCard.d.ts +4 -0
  95. package/lib/types/react/src/components/Cards/TextCard/TextCard.props.d.ts +26 -0
  96. package/lib/types/react/src/components/Cards/TextCard/index.d.ts +3 -4
  97. package/lib/types/react/src/components/List/List.props.d.ts +2 -9
  98. package/lib/types/react/src/components/List/ListItem.props.d.ts +0 -6
  99. package/lib/types/react/src/components/index.d.ts +1 -1
  100. package/lib/types/react/src/types/index.d.ts +4 -2
  101. package/package.json +32 -12
  102. package/public/react.svg +8 -0
  103. package/rollup.config.mjs +2 -0
  104. package/src/__tests__/Accordion.test.tsx +16 -0
  105. package/src/__tests__/Button.test.tsx +60 -0
  106. package/src/__tests__/Callout.test.tsx +43 -0
  107. package/src/__tests__/ContextMenu.test.tsx +19 -0
  108. package/src/__tests__/Dropdown.test.tsx +38 -0
  109. package/src/__tests__/Heading.test.tsx +51 -0
  110. package/src/__tests__/Image.test.tsx +21 -0
  111. package/src/__tests__/LinkList.test.tsx +17 -0
  112. package/src/__tests__/List.test.tsx +25 -0
  113. package/src/__tests__/Loading.test.tsx +33 -0
  114. package/src/__tests__/Notification.test.tsx +39 -0
  115. package/src/__tests__/Pagination.test.tsx +58 -0
  116. package/src/__tests__/Profile.test.tsx +48 -0
  117. package/src/__tests__/ReadMore.test.tsx +43 -0
  118. package/src/__tests__/RichText.test.tsx +16 -0
  119. package/src/__tests__/SearchField.test.tsx +35 -0
  120. package/src/__tests__/TableOfContents.test.tsx +12 -0
  121. package/src/__tests__/Tag.test.tsx +10 -0
  122. package/src/components/Cards/{CardGroup.args.ts → CardGroup/CardGroup.args.ts} +299 -437
  123. package/src/components/Cards/CardGroup/CardGroup.props.ts +78 -0
  124. package/src/components/Cards/CardGroup/CardGroup.tsx +54 -0
  125. package/src/components/Cards/CardGroup/index.tsx +3 -0
  126. package/src/components/Cards/DataCard/DataCard.args.ts +69 -0
  127. package/src/components/Cards/DataCard/DataCard.props.ts +60 -0
  128. package/src/components/Cards/DataCard/DataCard.tsx +107 -0
  129. package/src/components/Cards/DataCard/index.tsx +3 -107
  130. package/src/components/Cards/DetailCard/DetailCard.args.ts +17 -0
  131. package/src/components/Cards/DetailCard/DetailCard.props.ts +43 -0
  132. package/src/components/Cards/DetailCard/DetailCard.tsx +62 -0
  133. package/src/components/Cards/DetailCard/index.tsx +3 -62
  134. package/src/components/Cards/FactlistCard/FactListCard.args.ts +14 -0
  135. package/src/components/Cards/FactlistCard/FactListCard.props.ts +19 -0
  136. package/src/components/Cards/FactlistCard/FactListCard.tsx +42 -0
  137. package/src/components/Cards/FactlistCard/index.tsx +3 -42
  138. package/src/components/Cards/FeatureCard/FeatureCard.args.ts +30 -0
  139. package/src/components/Cards/FeatureCard/FeatureCard.props.ts +38 -0
  140. package/src/components/Cards/FeatureCard/FeatureCard.tsx +69 -0
  141. package/src/components/Cards/FeatureCard/index.tsx +3 -69
  142. package/src/components/Cards/MultilinkCard/MultiLinkCard.tsx +76 -0
  143. package/src/components/Cards/MultilinkCard/MultilinkCard.args.ts +33 -0
  144. package/src/components/Cards/MultilinkCard/MultilinkCard.props.ts +30 -0
  145. package/src/components/Cards/MultilinkCard/index.tsx +3 -76
  146. package/src/components/Cards/PromoCard/PromoCard.args.ts +19 -0
  147. package/src/components/Cards/PromoCard/PromoCard.props.ts +36 -0
  148. package/src/components/Cards/PromoCard/PromoCard.tsx +60 -0
  149. package/src/components/Cards/PromoCard/index.tsx +3 -60
  150. package/src/components/Cards/StatCard/StatCard.args.ts +14 -0
  151. package/src/components/Cards/StatCard/StatCard.props.ts +21 -0
  152. package/src/components/Cards/StatCard/StatCard.tsx +36 -0
  153. package/src/components/Cards/StatCard/index.tsx +3 -36
  154. package/src/components/Cards/TextCard/TextCard.args.ts +21 -0
  155. package/src/components/Cards/TextCard/TextCard.props.ts +32 -0
  156. package/src/components/Cards/TextCard/TextCard.tsx +62 -0
  157. package/src/components/Cards/TextCard/index.tsx +3 -63
  158. package/src/components/Footer/Footer.args.ts +4 -16
  159. package/src/components/Footer/Footer.tsx +41 -37
  160. package/src/components/List/List.props.ts +2 -10
  161. package/src/components/List/List.tsx +17 -22
  162. package/src/components/List/ListItem.props.ts +0 -7
  163. package/src/components/List/ListItem.tsx +6 -11
  164. package/src/components/Navigation/Navigation.tsx +5 -5
  165. package/src/components/Pagination/Pagination.tsx +2 -1
  166. package/src/components/index.ts +1 -1
  167. package/src/setup.ts +6 -0
  168. package/src/stories/Accordion/Accordion.stories.tsx +145 -0
  169. package/src/stories/Breadcrumb/Breadcrumb.mdx +17 -0
  170. package/src/stories/Breadcrumb/Breadcrumb.stories.tsx +20 -0
  171. package/src/stories/Button/Button.mdx +94 -0
  172. package/src/stories/Button/Button.stories.tsx +68 -0
  173. package/src/stories/Callout/Callout.mdx +35 -0
  174. package/src/stories/Callout/Callout.stories.tsx +43 -0
  175. package/src/stories/Card/DataCard.stories.tsx +45 -0
  176. package/src/stories/Card/DetailCard.stories.tsx +41 -0
  177. package/src/stories/Card/FactlistCard.stories.tsx +48 -0
  178. package/src/stories/Card/FeatureCard.stories.tsx +56 -0
  179. package/src/stories/Card/MultilinkCard.stories.tsx +48 -0
  180. package/src/stories/Card/PromoCard.stories.tsx +48 -0
  181. package/src/stories/Card/StatCard.stories.tsx +45 -0
  182. package/src/stories/Card/TextCard.stories.tsx +45 -0
  183. package/src/stories/CardGroup/CardGroup.mdx +17 -0
  184. package/src/stories/CardGroup/CardGroup.stories.tsx +50 -0
  185. package/src/stories/Checkbox/Checkbox.stories.tsx +118 -0
  186. package/src/stories/ContextMenu/ContextMenu.stories.tsx +83 -0
  187. package/src/stories/DatePicker/DatePicker.stories.tsx +110 -0
  188. package/src/stories/Dropdown/Dropdown.stories.tsx +145 -0
  189. package/src/stories/Empty/Empty.stories.tsx +53 -0
  190. package/src/stories/Fieldset/Fieldset.stories.tsx +167 -0
  191. package/src/stories/FileUpload/FileUpload.stories.tsx +103 -0
  192. package/src/stories/Footer/Footer.mdx +17 -0
  193. package/src/stories/Footer/Footer.stories.tsx +15 -0
  194. package/src/stories/Form/Form.mdx +58 -0
  195. package/src/stories/Form/Form.stories.tsx +162 -0
  196. package/src/stories/GetStarted.mdx +57 -0
  197. package/src/stories/Heading/Heading.stories.tsx +193 -0
  198. package/src/stories/Hero/Hero.stories.tsx +68 -0
  199. package/src/stories/Image/Image.stories.tsx +50 -0
  200. package/src/stories/Link/Link.stories.tsx +81 -0
  201. package/src/stories/LinkList/LinkList.args.ts +190 -0
  202. package/src/stories/LinkList/LinkList.stories.tsx +60 -0
  203. package/src/stories/List/List.stories.tsx +167 -0
  204. package/src/stories/Loading/Loading.stories.tsx +97 -0
  205. package/src/stories/LocalNav/LocalNav.mdx +17 -0
  206. package/src/stories/LocalNav/LocalNav.stories.tsx +15 -0
  207. package/src/stories/Logo/Logo.stories.tsx +172 -0
  208. package/src/stories/LogoGrid/LogoGrid.stories.tsx +59 -0
  209. package/src/stories/Navigation/Navigation.mdx +17 -0
  210. package/src/stories/Navigation/Navigation.stories.tsx +15 -0
  211. package/src/stories/Notification/Notification.stories.tsx +187 -0
  212. package/src/stories/NumberPicker/NumberPicker.stories.tsx +69 -0
  213. package/src/stories/Pagination/Pagination.stories.tsx +86 -0
  214. package/src/stories/Profile/Profile.stories.tsx +64 -0
  215. package/src/stories/Radio/Radio.stories.tsx +232 -0
  216. package/src/stories/ReadMore/ReadMore.stories.tsx +59 -0
  217. package/src/stories/RichText/RichText.stories.tsx +63 -0
  218. package/src/stories/SearchField/SearchField.stories.tsx +91 -0
  219. package/src/stories/SocialMedia/SocialMedia.stories.tsx +60 -0
  220. package/src/stories/TableOfContents/TableOfContents.stories.tsx +55 -0
  221. package/src/stories/Tabs/Tabs.mdx +17 -0
  222. package/src/stories/Tabs/Tabs.stories.tsx +25 -0
  223. package/src/stories/Tag/Tag.stories.tsx +130 -0
  224. package/src/stories/TextInput/TextInput.stories.tsx +100 -0
  225. package/src/stories/Textarea/Textarea.stories.tsx +147 -0
  226. package/src/stories/Toggle/Toggle.stories.tsx +99 -0
  227. package/src/stories/Tooltip/Tooltip.stories.tsx +82 -0
  228. package/src/stories/Video/Video.stories.tsx +71 -0
  229. package/src/stories/Welcome.stories.mdx +37 -0
  230. package/src/stories/assets/code-brackets.svg +1 -0
  231. package/src/stories/assets/colors.svg +1 -0
  232. package/src/stories/assets/comments.svg +1 -0
  233. package/src/stories/assets/direction.svg +1 -0
  234. package/src/stories/assets/flow.svg +1 -0
  235. package/src/stories/assets/plugin.svg +1 -0
  236. package/src/stories/assets/repo.svg +1 -0
  237. package/src/stories/assets/stackalt.svg +1 -0
  238. package/src/stories/welcome.scss +133 -0
  239. package/src/types/index.ts +6 -2
  240. package/lib/cjs/ListCtx-14aa546f.js +0 -9
  241. package/lib/cjs/components/Cards/Card.js +0 -40
  242. package/lib/cjs/components/Cards/CardGroup.js +0 -33
  243. package/lib/cjs/components/Cards/index.js +0 -37
  244. package/lib/esm/ListCtx-da435fdf.js +0 -6
  245. package/lib/esm/components/Cards/Card.js +0 -38
  246. package/lib/esm/components/Cards/CardGroup.js +0 -31
  247. package/lib/esm/components/Cards/index.js +0 -22
  248. package/lib/types/react/src/components/Cards/Card.d.ts +0 -4
  249. package/lib/types/react/src/components/Cards/Card.props.d.ts +0 -307
  250. package/lib/types/react/src/components/Cards/CardGroup.props.d.ts +0 -16
  251. package/lib/types/react/src/components/Cards/index.d.ts +0 -11
  252. package/lib/types/react/src/components/List/ListCtx.d.ts +0 -4
  253. package/src/components/Cards/Card.args.ts +0 -220
  254. package/src/components/Cards/Card.props.ts +0 -382
  255. package/src/components/Cards/Card.tsx +0 -36
  256. package/src/components/Cards/CardGroup.props.ts +0 -19
  257. package/src/components/Cards/CardGroup.tsx +0 -54
  258. package/src/components/Cards/index.ts +0 -22
  259. package/src/components/List/ListCtx.ts +0 -7
  260. /package/lib/types/react/src/components/Cards/{CardGroup.d.ts → CardGroup/CardGroup.d.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { StatCardProps } from "./StatCard.props";
3
+ declare const StatCard: FC<StatCardProps>;
4
+ export default StatCard;
@@ -0,0 +1,18 @@
1
+ import { CardColor, CardSize } from "../../../types";
2
+ import { LinkProps } from "../../LinkList/LinkList.props";
3
+ export type StatCardProps = {
4
+ /**
5
+ * The title of the card
6
+ */
7
+ title: string;
8
+ color?: CardColor;
9
+ /**
10
+ * How big should the card be
11
+ */
12
+ size?: Omit<CardSize, "narrow" | "wide">;
13
+ /**
14
+ * Introductory text in the card
15
+ */
16
+ intro?: string;
17
+ source?: LinkProps;
18
+ };
@@ -1,4 +1,3 @@
1
- import { FC } from "react";
2
- import { StatCardProps } from "../Card.props";
3
- declare const StatCard: FC<StatCardProps>;
4
- export default StatCard;
1
+ export { default as StatCard } from "./StatCard";
2
+ export type { StatCardProps } from "./StatCard.props";
3
+ export { StatCardArgs } from "./StatCard.args";
@@ -0,0 +1,3 @@
1
+ import { TextCardProps } from ".";
2
+ export declare const TextCardArgs: TextCardProps;
3
+ export default TextCardArgs;
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { TextCardProps } from "./TextCard.props";
3
+ declare const TextCard: FC<TextCardProps>;
4
+ export default TextCard;
@@ -0,0 +1,26 @@
1
+ import { ThemeTypes, CardSize, EventDate } from "../../../types";
2
+ import { ProfileProps } from "../../Profile/Profile.props";
3
+ export type TextCardProps = {
4
+ /**
5
+ * A line of text that appears as a small heading above the title of the card
6
+ */
7
+ eyebrow?: string;
8
+ /**
9
+ * The title of the card
10
+ */
11
+ title: string;
12
+ /**
13
+ * Will render the card to appear on light or dark backgrounds
14
+ */
15
+ theme?: ThemeTypes;
16
+ /**
17
+ * How big should the card be
18
+ */
19
+ size?: Omit<CardSize, "standard">;
20
+ /**
21
+ * Specify the event Date, in both human and Unix format.
22
+ */
23
+ date?: EventDate;
24
+ profile: ProfileProps;
25
+ link?: string;
26
+ };
@@ -1,4 +1,3 @@
1
- import { FC } from "react";
2
- import { TextCardProps } from "../Card.props";
3
- declare const TextCard: FC<TextCardProps>;
4
- export default TextCard;
1
+ export { default as TextCard } from "./TextCard";
2
+ export type { TextCardProps } from "./TextCard.props";
3
+ export { TextCardArgs } from "./TextCard.args";
@@ -1,5 +1,4 @@
1
1
  import { ReactElement } from "react";
2
- import { HeadingLevel, ListAlignment, ListOrder } from "../../types";
3
2
  import { ListItemProps } from "./ListItem.props";
4
3
  export interface ListProps {
5
4
  /**
@@ -9,11 +8,11 @@ export interface ListProps {
9
8
  /**
10
9
  * Declare ordered, unordered or unstyled
11
10
  */
12
- ordered?: ListOrder;
11
+ ordered?: "unordered" | "ordered" | "unstyled";
13
12
  /**
14
13
  * Declare horizontal or default
15
14
  */
16
- alignment?: ListAlignment;
15
+ alignment?: "default" | "horizontal";
17
16
  /**
18
17
  * Specify an optional title
19
18
  */
@@ -23,9 +22,3 @@ export interface ListProps {
23
22
  */
24
23
  className?: string;
25
24
  }
26
- export interface ListContextProps {
27
- activeItems: string[];
28
- alignment?: ListAlignment;
29
- ordered?: ListOrder;
30
- headingLevel?: HeadingLevel;
31
- }
@@ -1,10 +1,4 @@
1
1
  import { ReactNode } from "react";
2
- export interface ListItemContextProps {
3
- /**
4
- * The list item's unique id.
5
- */
6
- id: string;
7
- }
8
2
  export interface ListItemProps {
9
3
  /**
10
4
  * Specify the id of the List item.
@@ -36,6 +36,6 @@ export { TableOfContents } from "./TableOfContents";
36
36
  export { Footer } from "./Footer";
37
37
  export { LocalNav } from "./LocalNav";
38
38
  export { Navigation } from "./Navigation";
39
- export { Card, CardGroup } from "./Cards";
39
+ export { CardGroup } from "./Cards/CardGroup";
40
40
  export { Breadcrumb } from "./Breadcrumb";
41
41
  export { Tabs } from "./Tabs";
@@ -16,8 +16,6 @@ export type TooltipThemes = "light" | "dark";
16
16
  export type TooltipIconThemes = "light" | "dark";
17
17
  export type TooltipAlignment = "top" | "right" | "bottom" | "left";
18
18
  export type TooltipPlacement = "negative" | "center" | "positive";
19
- export type ListAlignment = "default" | "horizontal";
20
- export type ListOrder = "unordered" | "ordered" | "unstyled";
21
19
  export type LoadingStatus = "idle" | "loading" | "loaded";
22
20
  export type LoadingSize = "small" | "large";
23
21
  export type NotificationPlacement = "dialog" | "inline";
@@ -31,6 +29,10 @@ export type CardSize = "wide" | "standard" | "narrow" | "fluid";
31
29
  export type CardCornerType = boolean;
32
30
  export type CardAlignment = "left" | "right";
33
31
  export type CardTypes = "stat" | "multilink" | "text" | "promo" | "feature" | "detail" | "factlist" | "data";
32
+ export type EventDate = {
33
+ unix?: string;
34
+ human?: string;
35
+ };
34
36
  export interface FormFieldProps<T> {
35
37
  /**
36
38
  * The input's onChange callback.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/react",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "React components for the ILO's Design System",
5
5
  "keywords": [
6
6
  "ui_patterns",
@@ -9,6 +9,27 @@
9
9
  "designsystem",
10
10
  "components"
11
11
  ],
12
+ "contributors": [
13
+ {
14
+ "name": "Justin Smith",
15
+ "email": "smithj@ilo.org",
16
+ "url": "https://github.com/justintemps"
17
+ },
18
+ {
19
+ "name": "Prabashwara Seneviratne",
20
+ "url": "https://www.bash.lk"
21
+ },
22
+ {
23
+ "name": "Shashika Boteju",
24
+ "email": "Shashikaboteju3@gmail.com",
25
+ "url": "https://github.com/Shashika6"
26
+ },
27
+ {
28
+ "name": "Giorgi Kapanadze",
29
+ "email": "doublegkapanadze@gmail.com",
30
+ "url": "https://github.com/ggkapanadze"
31
+ }
32
+ ],
12
33
  "homepage": "https://react.ui.ilo.org",
13
34
  "repository": {
14
35
  "type": "git",
@@ -48,7 +69,6 @@
48
69
  "license": "Apache-2.0",
49
70
  "main": "lib/cjs/index.js",
50
71
  "module": "lib/esm/index.js",
51
- "type": "module",
52
72
  "types": "lib/types/react/src/index.d.ts",
53
73
  "jest": {
54
74
  "moduleNameMapper": {
@@ -75,12 +95,12 @@
75
95
  "react-transition-group": "^4.4.1",
76
96
  "video.js": "^7.21.2",
77
97
  "videojs-youtube": "^3.0.1",
78
- "@ilo-org/brand-assets": "0.4.0",
79
- "@ilo-org/fonts": "0.1.2",
80
- "@ilo-org/styles": "0.14.2",
81
- "@ilo-org/icons-react": "0.0.21",
82
- "@ilo-org/themes": "0.7.2",
83
- "@ilo-org/utils": "0.0.11"
98
+ "@ilo-org/brand-assets": "0.5.0",
99
+ "@ilo-org/fonts": "0.2.0",
100
+ "@ilo-org/icons-react": "0.1.0",
101
+ "@ilo-org/styles": "0.16.0",
102
+ "@ilo-org/themes": "0.8.0",
103
+ "@ilo-org/utils": "0.1.0"
84
104
  },
85
105
  "devDependencies": {
86
106
  "@rollup/plugin-commonjs": "^23.0.2",
@@ -108,7 +128,7 @@
108
128
  "@types/node": "^17.0.45",
109
129
  "@types/react": "^17.0.11",
110
130
  "@types/react-dom": "^17.0.20",
111
- "@types/video.js": "7",
131
+ "@types/video.js": "7.3.57",
112
132
  "http-server": "^14.1.0",
113
133
  "identity-obj-proxy": "^3.0.0",
114
134
  "jest-environment-jsdom": "27.5.1",
@@ -133,9 +153,9 @@
133
153
  "ts-jest": "^29.1.1",
134
154
  "tslib": "^2.3.1",
135
155
  "vite": "^4.5.2",
136
- "@ilo-org/eslint-config": "0.1.0",
137
- "@ilo-org/prettier-config": "0.0.2",
138
- "@ilo-org/typescript-config": "0.0.1"
156
+ "@ilo-org/eslint-config": "0.2.0",
157
+ "@ilo-org/prettier-config": "0.1.0",
158
+ "@ilo-org/typescript-config": "0.1.0"
139
159
  },
140
160
  "peerDependencies": {
141
161
  "react": ">16",
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="-10.5 -9.45 21 18.9">
2
+ <circle r="2" fill="#61DBFB" />
3
+ <g stroke="#61DBFB">
4
+ <ellipse rx="10" ry="4.5" />
5
+ <ellipse rx="10" ry="4.5" transform="rotate(60)" />
6
+ <ellipse rx="10" ry="4.5" transform="rotate(120)" />
7
+ </g>
8
+ </svg>
package/rollup.config.mjs CHANGED
@@ -27,10 +27,12 @@ const config = {
27
27
  {
28
28
  dir: "lib/esm",
29
29
  format: "esm",
30
+ exports: "auto",
30
31
  },
31
32
  {
32
33
  dir: "lib/cjs",
33
34
  format: "cjs",
35
+ exports: "auto",
34
36
  },
35
37
  ],
36
38
  };
@@ -0,0 +1,16 @@
1
+ import { render, screen, fireEvent } from "@testing-library/react";
2
+ import { composeStories } from "@storybook/react";
3
+ import * as stories from "../stories/Accordion/Accordion.stories";
4
+
5
+ const { Default: AccordionLarge } = composeStories(stories);
6
+
7
+ describe("<Accordion>", () => {
8
+ it("Expect button to exist and aria expanded value to change on accordion button click.", () => {
9
+ render(<AccordionLarge />);
10
+ const buttonElement = screen.getAllByRole("button");
11
+ expect(buttonElement).not.toBeNull();
12
+ expect(buttonElement[0].getAttribute("aria-expanded")).toBe("true");
13
+ fireEvent.click(buttonElement[0]);
14
+ expect(buttonElement[0].getAttribute("aria-expanded")).toBe("false");
15
+ });
16
+ });
@@ -0,0 +1,60 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import { Button } from "../components/Button";
3
+ import buttonArgs from "../components/Button/Button.args";
4
+
5
+ describe("<Button>", () => {
6
+ it("Should render `button` with correct class name from type prop", () => {
7
+ render(<Button {...buttonArgs.primary} />);
8
+ const buttonElement = screen.getAllByRole("button");
9
+ expect(buttonElement).not.toBeNull();
10
+ expect(buttonElement[0].getAttribute("class")).toEqual(
11
+ expect.stringContaining(buttonArgs.primary.type as string)
12
+ );
13
+ });
14
+
15
+ it("Should render `button` with correct size class name from prop size", () => {
16
+ render(<Button {...buttonArgs.primary} />);
17
+ const buttonElement = screen.getAllByRole("button");
18
+ expect(buttonElement).not.toBeNull();
19
+ expect(buttonElement[0].getAttribute("class")).toContain(
20
+ buttonArgs.primary.size
21
+ );
22
+ });
23
+
24
+ it("Should render `button` with correct label from prop label", () => {
25
+ render(<Button {...buttonArgs.primary} />);
26
+ const buttonElement = screen.getAllByRole("button");
27
+ expect(buttonElement).not.toBeNull();
28
+ expect(buttonElement[0].textContent).toEqual(buttonArgs.primary.label);
29
+ });
30
+
31
+ it("Should render `button` as anchor, with the correct url", () => {
32
+ render(<Button {...buttonArgs.link} />);
33
+ const buttonElement = screen.getAllByRole("link");
34
+ expect(buttonElement).not.toBeNull();
35
+ expect(buttonElement[0]).toHaveAttribute("href", buttonArgs.link.url);
36
+ });
37
+
38
+ it("Should render `button` with disabled attribute", () => {
39
+ render(<Button {...buttonArgs.disabled} />);
40
+ const buttonElement = screen.getAllByRole("button");
41
+ expect(buttonElement).not.toBeNull();
42
+ expect(buttonElement[0]).toHaveAttribute("disabled", "");
43
+ });
44
+
45
+ it("Should render `button` as anchor with target attribute and rel attribute", () => {
46
+ render(<Button {...buttonArgs.link} />);
47
+ const buttonElement = screen.getAllByRole("link");
48
+ expect(buttonElement).not.toBeNull();
49
+ expect(buttonElement[0]).toHaveAttribute("target", buttonArgs.link.target);
50
+ expect(buttonElement[0]).toHaveAttribute("rel", "noopener noreferrer");
51
+ });
52
+
53
+ it('calls "callback" prop on button click', () => {
54
+ const onClick = jest.fn();
55
+ render(<Button {...buttonArgs.primary} callback={onClick} />);
56
+ const buttonElement = screen.getAllByRole("button");
57
+ fireEvent.click(buttonElement[0]);
58
+ expect(onClick).toHaveBeenCalled();
59
+ });
60
+ });
@@ -0,0 +1,43 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import userEvent from "@testing-library/user-event";
3
+ import { Callout } from "../components/Callout";
4
+ import calloutArgs from "../components/Callout/Callout.args";
5
+
6
+ // const { InfoCallout, ErrorCallout, SuccessCallout, WarningCallout } =
7
+ // composeStories(stories);
8
+
9
+ describe("<Callout>", () => {
10
+ it("Should render Callout headline with content.", () => {
11
+ const { container } = render(<Callout {...calloutArgs.baseArgs} />);
12
+ expect(container.children[0]).not.toBeNull();
13
+ const headlineElement = document.querySelector('[class*="--headline"]');
14
+ console.log(headlineElement);
15
+ expect(headlineElement?.textContent).toEqual(
16
+ calloutArgs.baseArgs.headline as string
17
+ );
18
+ });
19
+
20
+ it("Should render Callout copy with content.", () => {
21
+ const { container } = render(<Callout {...calloutArgs.baseArgs} />);
22
+ expect(container.children[0]).not.toBeNull();
23
+ const copyElement = document.querySelector('[class*="--copy"]');
24
+ expect(copyElement?.textContent).toEqual(calloutArgs.baseArgs.copy);
25
+ });
26
+
27
+ it("Should render `button` with correct label from prop toggleClosedLabel", () => {
28
+ render(<Callout {...calloutArgs.error} />);
29
+ const buttonElement = screen.getAllByRole("button");
30
+ expect(buttonElement).not.toBeNull();
31
+ expect(buttonElement[0].textContent).toEqual(
32
+ calloutArgs.error.toggleClosedLabel
33
+ );
34
+ });
35
+
36
+ it("Should open the callout on button click", () => {
37
+ const { container } = render(<Callout {...calloutArgs.error} />);
38
+ expect(container.children[0]).not.toBeNull();
39
+ userEvent.click(screen.getByRole("button"));
40
+ const calloutOpenElement = document.querySelector('[class*="--open"]');
41
+ expect(calloutOpenElement).not.toBeNull();
42
+ });
43
+ });
@@ -0,0 +1,19 @@
1
+ import { render } from "@testing-library/react";
2
+ import { ContextMenu } from "../components/ContextMenu";
3
+ import contextMenuArgs from "../components/ContextMenu/ContextMenu.args";
4
+
5
+ describe("<ContextMenu>", () => {
6
+ it("Should render `ul` with some items.", () => {
7
+ const { container } = render(<ContextMenu {...contextMenuArgs.basic} />);
8
+ expect(container).not.toBeNull();
9
+ });
10
+
11
+ it("Should render `ul` with `li`s with the `endsection` prop containing the class `endsection`", () => {
12
+ const { container } = render(
13
+ <ContextMenu {...contextMenuArgs.withsection} />
14
+ );
15
+ expect(container).not.toBeNull();
16
+ const endsectionElement = document.querySelector(".endsection");
17
+ expect(endsectionElement).not.toBeNull();
18
+ });
19
+ });
@@ -0,0 +1,38 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import { Dropdown } from "../components/Dropdown";
3
+ import dropdownArgs from "../components/Dropdown/Dropdown.args";
4
+
5
+ describe("<Dropdown>", () => {
6
+ it("Should render `Dropdown` with correct label from prop label", () => {
7
+ const { container } = render(<Dropdown {...dropdownArgs.basic} />);
8
+ expect(container.children[0]).not.toBeNull();
9
+ expect(container.querySelector("label")?.textContent).toEqual(
10
+ dropdownArgs.basic.label
11
+ );
12
+ });
13
+
14
+ it("should display the correct number of options", () => {
15
+ render(<Dropdown {...dropdownArgs.basic} />);
16
+ expect(screen.getAllByRole("option").length).toBe(
17
+ dropdownArgs?.basic?.options?.length
18
+ );
19
+ });
20
+
21
+ it("selects the correct option", () => {
22
+ render(<Dropdown {...dropdownArgs.basic} />);
23
+ fireEvent.change(screen.getByLabelText("Select a country" as string), {
24
+ target: { value: "CH" },
25
+ });
26
+ const chosenoption = document.querySelector('option[value="CH"]');
27
+ expect((chosenoption as HTMLOptionElement).selected).toBeTruthy();
28
+ });
29
+
30
+ it('calls "onChange" prop on button click', () => {
31
+ const handleChange = jest.fn();
32
+ render(<Dropdown {...dropdownArgs.basic} onChange={handleChange} />);
33
+ fireEvent.change(screen.getByLabelText("Select a country" as string), {
34
+ target: { value: "CH" },
35
+ });
36
+ expect(handleChange).toHaveBeenCalled();
37
+ });
38
+ });
@@ -0,0 +1,51 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import { composeStories } from "@storybook/react";
3
+ import headingArgs from "../components/Heading/Heading.args";
4
+ import * as stories from "../stories/Heading/Heading.stories";
5
+
6
+ const { Heading1, Heading2, Heading3, Heading4, Heading5, Heading6 } =
7
+ composeStories(stories);
8
+
9
+ describe("<Heading>", () => {
10
+ it("Should render `h1` with story text.", () => {
11
+ render(<Heading1 />);
12
+ const headingElement = screen.getByRole("heading", { level: 1 });
13
+ expect(headingElement).not.toBeNull();
14
+ expect(headingElement.textContent).toEqual(headingArgs.heading1.children);
15
+ });
16
+
17
+ it("Should render `h2` with story text.", () => {
18
+ render(<Heading2 />);
19
+ const headingElement = screen.getByRole("heading", { level: 2 });
20
+ expect(headingElement).not.toBeNull();
21
+ expect(headingElement.textContent).toEqual(headingArgs.heading2.children);
22
+ });
23
+
24
+ it("Should render `h3` with story text.", () => {
25
+ render(<Heading3 />);
26
+ const headingElement = screen.getByRole("heading", { level: 3 });
27
+ expect(headingElement).not.toBeNull();
28
+ expect(headingElement.textContent).toEqual(headingArgs.heading3.children);
29
+ });
30
+
31
+ it("Should render `h4` with story text.", () => {
32
+ render(<Heading4 />);
33
+ const headingElement = screen.getByRole("heading", { level: 4 });
34
+ expect(headingElement).not.toBeNull();
35
+ expect(headingElement.textContent).toEqual(headingArgs.heading4.children);
36
+ });
37
+
38
+ it("Should render `h5` with story text.", () => {
39
+ render(<Heading5 />);
40
+ const headingElement = screen.getByRole("heading", { level: 5 });
41
+ expect(headingElement).not.toBeNull();
42
+ expect(headingElement.textContent).toEqual(headingArgs.heading5.children);
43
+ });
44
+
45
+ it("Should render `h6` with story text.", () => {
46
+ render(<Heading6 />);
47
+ const headingElement = screen.getByRole("heading", { level: 6 });
48
+ expect(headingElement).not.toBeNull();
49
+ expect(headingElement.textContent).toEqual(headingArgs.heading6.children);
50
+ });
51
+ });
@@ -0,0 +1,21 @@
1
+ import { render } from "@testing-library/react";
2
+ import { Image } from "../components/Image";
3
+ import imageArgs from "../components/Image/Image.args";
4
+
5
+ describe("<Image>", () => {
6
+ it("Should render `img` with correct image src", () => {
7
+ const { container } = render(<Image {...imageArgs} />);
8
+ expect(container).not.toBeNull();
9
+ expect(container.querySelector("img")?.getAttribute("src")).toEqual(
10
+ imageArgs.url?.[0].src
11
+ );
12
+ });
13
+
14
+ it("Should render `img` with correct image alt", () => {
15
+ const { container } = render(<Image {...imageArgs} />);
16
+ expect(container).not.toBeNull();
17
+ expect(container.querySelector("img")?.getAttribute("alt")).toEqual(
18
+ imageArgs.alt
19
+ );
20
+ });
21
+ });
@@ -0,0 +1,17 @@
1
+ import { render } from "@testing-library/react";
2
+ import { LinkList } from "../components/LinkList";
3
+ import linkListArgs from "../components/LinkList/LinkList.args";
4
+
5
+ describe("<LinkList>", () => {
6
+ it("Should render `ul` with some items.", () => {
7
+ const { container } = render(<LinkList {...linkListArgs.basic} />);
8
+ expect(container).not.toBeNull();
9
+ });
10
+
11
+ it("Should render `ul` with `li`s with the `indented` prop containing the class `indented`", () => {
12
+ const { container } = render(<LinkList {...linkListArgs.withindented} />);
13
+ expect(container).not.toBeNull();
14
+ const indentedElement = document.querySelectorAll(".indented");
15
+ expect(indentedElement).not.toEqual([]);
16
+ });
17
+ });
@@ -0,0 +1,25 @@
1
+ import { render } from "@testing-library/react";
2
+ import { List } from "../components/List";
3
+ import listArgs from "../components/List/List.args";
4
+
5
+ describe("<List>", () => {
6
+ it("Should render `ol` with some items.", () => {
7
+ const { container } = render(<List {...listArgs.ordered} />);
8
+ expect(container).not.toBeNull();
9
+ });
10
+
11
+ it("Should render `ul` with some items.", () => {
12
+ const { container } = render(<List {...listArgs.unordered} />);
13
+ expect(container).not.toBeNull();
14
+ });
15
+
16
+ it("Should render `ul` horizontally with some items.", () => {
17
+ const { container } = render(<List {...listArgs.horizontal} />);
18
+ expect(container).not.toBeNull();
19
+ });
20
+
21
+ it("Should render `ul` unstyled with some items.", () => {
22
+ const { container } = render(<List {...listArgs.unstyled} />);
23
+ expect(container).not.toBeNull();
24
+ });
25
+ });
@@ -0,0 +1,33 @@
1
+ import { render } from "@testing-library/react";
2
+ import { Loading } from "../components/Loading";
3
+ import loadingArgs from "../components/Loading/Loading.args";
4
+
5
+ describe("<Loading>", () => {
6
+ it("Should render `Loading` with correct label from prop label", () => {
7
+ const { container } = render(<Loading {...loadingArgs.loadinglarge} />);
8
+ expect(container.children[0]).not.toBeNull();
9
+ const paragraphElement = document.querySelector(
10
+ 'p[class*="--copy"]'
11
+ ) as Element;
12
+ expect(paragraphElement).not.toBeNull();
13
+ expect(paragraphElement.textContent).toEqual(
14
+ loadingArgs.loadinglarge.message
15
+ );
16
+ });
17
+
18
+ it("Should render `Loading` with correct class derived from prop status", () => {
19
+ const { container } = render(<Loading {...loadingArgs.loadinglarge} />);
20
+ expect(container.children[0]).not.toBeNull();
21
+ expect(container.children[0].getAttribute("class")).toContain(
22
+ loadingArgs.loadinglarge.status
23
+ );
24
+ });
25
+
26
+ it("Should render `Loading` with correct class derived from prop size", () => {
27
+ const { container } = render(<Loading {...loadingArgs.loadinglarge} />);
28
+ expect(container.children[0]).not.toBeNull();
29
+ expect(container.children[0].getAttribute("class")).toContain(
30
+ loadingArgs.loadinglarge.size
31
+ );
32
+ });
33
+ });
@@ -0,0 +1,39 @@
1
+ import { render, screen } from "@testing-library/react";
2
+ import userEvent from "@testing-library/user-event";
3
+ import { Notification } from "../components/Notification";
4
+ import notificationArgs from "../components/Notification/Notification.args";
5
+
6
+ describe("<Notification>", () => {
7
+ it("Should render Notification headline with content.", () => {
8
+ const { container } = render(<Notification {...notificationArgs.hascta} />);
9
+ expect(container.children[0]).not.toBeNull();
10
+ const headlineElement = document.querySelector('[class*="--headline"]');
11
+ console.log(headlineElement);
12
+ expect(headlineElement?.textContent).toEqual(
13
+ notificationArgs?.hascta?.headline
14
+ );
15
+ });
16
+
17
+ it("Should render Notification copy with content.", () => {
18
+ const { container } = render(<Notification {...notificationArgs.hascta} />);
19
+ expect(container.children[0]).not.toBeNull();
20
+ const copyElement = document.querySelector('[class*="--copy"]');
21
+ expect(copyElement?.textContent).toEqual(notificationArgs?.hascta?.copy);
22
+ });
23
+
24
+ it("Should render `button` with correct label from prop closelabel", () => {
25
+ render(<Notification {...notificationArgs.hascta} />);
26
+ const buttonElement = screen.getAllByRole("button");
27
+ expect(buttonElement).not.toBeNull();
28
+ expect(buttonElement[0].textContent).toEqual(
29
+ notificationArgs?.hascta?.closelabel
30
+ );
31
+ });
32
+
33
+ it("Should delete the component on click of the button", () => {
34
+ const { container } = render(<Notification {...notificationArgs.hascta} />);
35
+ expect(container.children[0]).not.toBeNull();
36
+ userEvent.click(screen.getByRole("button"));
37
+ expect(container.children[0]).toBeUndefined();
38
+ });
39
+ });