@progressiveui/react 1.22.0 → 2.0.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/.storybook/WfpTheme.js +1 -1
  2. package/.storybook/main.ts +4 -4
  3. package/.storybook/preview.tsx +0 -25
  4. package/es/dist/components/Accordion/hooks/useAccordionItemEffect.d.ts +1 -1
  5. package/es/dist/components/Footer/Footer.d.ts +0 -8
  6. package/es/dist/components/Footer/index.d.ts +2 -2
  7. package/es/dist/components/Input/useInput.d.ts +4 -1
  8. package/es/dist/components/MainNavigation/index.d.ts +3 -4
  9. package/es/dist/hooks/useHeightTransition.d.ts +1 -1
  10. package/es/dist/index.d.ts +1 -1
  11. package/es/index.js +235 -1318
  12. package/lib/dist/components/Accordion/hooks/useAccordionItemEffect.d.ts +1 -1
  13. package/lib/dist/components/Footer/Footer.d.ts +0 -8
  14. package/lib/dist/components/Footer/index.d.ts +2 -2
  15. package/lib/dist/components/Input/useInput.d.ts +4 -1
  16. package/lib/dist/components/MainNavigation/index.d.ts +3 -4
  17. package/lib/dist/hooks/useHeightTransition.d.ts +1 -1
  18. package/lib/dist/index.d.ts +1 -1
  19. package/lib/index.js +260 -1355
  20. package/package.json +68 -78
  21. package/src/components/Accordion/hooks/useAccordion.ts +13 -9
  22. package/src/components/BannerNavigation/BannerNavigation.stories.tsx +0 -2
  23. package/src/components/Button/Button.stories.tsx +0 -16
  24. package/src/components/Button/Button.tsx +14 -11
  25. package/src/components/ContextMenu/ContextMenu.stories.tsx +0 -2
  26. package/src/components/Empty/Empty.stories.tsx +1 -2
  27. package/src/components/Footer/Footer.tsx +2 -42
  28. package/src/components/Footer/FooterExternal.tsx +0 -5
  29. package/src/components/Footer/index.ts +2 -2
  30. package/src/components/Hero/Hero.stories.tsx +0 -2
  31. package/src/components/Input/Input.tsx +1 -0
  32. package/src/components/Input/useInput.tsx +12 -9
  33. package/src/components/MainNavigation/MainNavigation.stories.tsx +1 -4
  34. package/src/components/MainNavigation/MainNavigation.tsx +1 -23
  35. package/src/components/MainNavigation/index.ts +3 -4
  36. package/src/components/Pagination/Pagination.stories.tsx +0 -2
  37. package/src/components/Search/Search.tsx +1 -1
  38. package/src/components/Text/Text.tsx +7 -4
  39. package/src/components/Toggle/Toggle.tsx +4 -4
  40. package/src/index.ts +0 -1
  41. package/umd/dist/components/Accordion/hooks/useAccordionItemEffect.d.ts +1 -1
  42. package/umd/dist/components/Footer/Footer.d.ts +0 -8
  43. package/umd/dist/components/Footer/index.d.ts +2 -2
  44. package/umd/dist/components/Input/useInput.d.ts +4 -1
  45. package/umd/dist/components/MainNavigation/index.d.ts +3 -4
  46. package/umd/dist/hooks/useHeightTransition.d.ts +1 -1
  47. package/umd/dist/index.d.ts +1 -1
  48. package/umd/index.js +235 -1318
  49. package/umd/index.min.js +1 -1
  50. package/src/components/MainNavigation/MainNavigationExternal.tsx +0 -338
@@ -7,10 +7,6 @@ import { ScreenSize } from "../../utils";
7
7
  import MainNavigationContext from "./MainNavigationContext";
8
8
  import MobileButtonDefault, { MobileButtonProps } from "./MobileButton";
9
9
  import { WrapperProps } from "../Wrapper/Wrapper";
10
- import {
11
- WfpLogoVerticalEn,
12
- WfpLogoStandardBlackEn,
13
- } from "@progressiveui/icons-react";
14
10
 
15
11
  /** The Main Navigation is a Horizontal Menu which consists of multiple clickable items placed at the top of the page. The navigation stays unchanged when browswing through the site and is present on every page. The currently selected item is usually highlighted. */
16
12
 
@@ -142,25 +138,7 @@ const MainNavigation = ({
142
138
  >
143
139
  Menu
144
140
  </MobileButton>
145
- <div className={`${prefix}--main-navigation__logo`}>
146
- {logoRibbon === "default" ? (
147
- <div className={`${prefix}--main-navigation__logo__default`}>
148
- <div
149
- className={`${prefix}--main-navigation__logo__default__ribbon`}
150
- >
151
- <WfpLogoVerticalEn description="WFP" />
152
- </div>
153
- {logo}
154
- </div>
155
- ) : logoRibbon === "offShelf" ? (
156
- <div className={`${prefix}--main-navigation__logo__offShelf`}>
157
- <WfpLogoStandardBlackEn description="WFP" />
158
- {logo}
159
- </div>
160
- ) : (
161
- logo
162
- )}
163
- </div>
141
+ <div className={`${prefix}--main-navigation__logo`}>{logo}</div>
164
142
  </div>
165
143
  <ul className={listClasses}>{children}</ul>
166
144
  </Wrapper>
@@ -1,4 +1,3 @@
1
- export { default as MainNavigation } from './MainNavigation';
2
- export { default as MainNavigationExternal } from './MainNavigationExternal';
3
- export { default as MainNavigationContext } from './MainNavigationContext';
4
- export { default as useMainNavigation } from './useMainNavigation';
1
+ export { default as MainNavigation } from "./MainNavigation";
2
+ export { default as MainNavigationContext } from "./MainNavigationContext";
3
+ export { default as useMainNavigation } from "./useMainNavigation";
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import markdown from "./README.mdx";
3
2
  import Pagination from ".";
4
3
 
5
4
  export default {
@@ -8,7 +7,6 @@ export default {
8
7
  parameters: {
9
8
  componentSubtitle: "Component",
10
9
  status: "released",
11
- mdx: markdown,
12
10
  },
13
11
  };
14
12
 
@@ -97,7 +97,7 @@ const Search: React.FC<SearchProps> = React.forwardRef((props, ref) => {
97
97
  }
98
98
  };
99
99
 
100
- const clearSearch = () => {
100
+ const clearSearch = (evt) => {
101
101
  setValue("");
102
102
  // setTimeout(() => {
103
103
  // console.log("value", value);
@@ -30,7 +30,9 @@ interface TextProps extends React.AllHTMLAttributes<HTMLDivElement> {
30
30
  className?: string;
31
31
  }
32
32
 
33
- export const textLookup: Record<TextKind, keyof JSX.IntrinsicElements> = {
33
+ export const textLookup: {
34
+ [key in NonNullable<TextProps["kind"]>]: React.ElementType;
35
+ } = {
34
36
  h1: "h1",
35
37
  h2: "h2",
36
38
  h3: "h3",
@@ -54,6 +56,7 @@ export const textLookup: Record<TextKind, keyof JSX.IntrinsicElements> = {
54
56
  */
55
57
 
56
58
  const Text: React.FC<TextProps> = ({
59
+ as,
57
60
  children,
58
61
  className,
59
62
  kind,
@@ -61,8 +64,8 @@ const Text: React.FC<TextProps> = ({
61
64
  spacingBottom,
62
65
  }) => {
63
66
  const { prefix } = useSettings();
64
- const TagName: keyof JSX.IntrinsicElements =
65
- kind && textLookup[kind] ? textLookup[kind] : "div";
67
+ const TagName: React.ElementType = kind ? textLookup[kind] : "div";
68
+
66
69
  const classes = classNames(
67
70
  {
68
71
  [`${prefix}--text`]: true,
@@ -71,7 +74,7 @@ const Text: React.FC<TextProps> = ({
71
74
  [`${prefix}--text__spacing-top-${spacingTop}`]: spacingTop,
72
75
  [`${prefix}--text__spacing-bottom-${spacingBottom}`]: spacingBottom,
73
76
  },
74
- className
77
+ className,
75
78
  );
76
79
  return React.createElement(TagName, { className: classes }, children);
77
80
  };
@@ -24,12 +24,12 @@ interface ToggleProps extends InputProps, React.ComponentPropsWithRef<"input"> {
24
24
  /**
25
25
  * Provide an optional hook that is called when the control is toggled
26
26
  */
27
- onToggle?: (
27
+ /* onToggleLegacy?: (
28
28
  value: boolean,
29
29
  htmlFor: string,
30
- event: React.ChangeEvent<HTMLInputElement>
30
+ event: React.ChangeEvent<HTMLInputElement>,
31
31
  ) => void;
32
- className?: string;
32
+ className?: string; */
33
33
  /**
34
34
  * Provide an id that unique represents the underlying `input`
35
35
  */
@@ -64,7 +64,7 @@ const Toggle: React.FC<ToggleProps> = React.forwardRef((props, ref) => {
64
64
  {
65
65
  [`${prefix}--form-item`]: true,
66
66
  },
67
- className
67
+ className,
68
68
  );
69
69
 
70
70
  // const checkedProps = {};
package/src/index.ts CHANGED
@@ -80,7 +80,6 @@ export { List, ListItem } from "./components/List";
80
80
  export {
81
81
  MainNavigation,
82
82
  MainNavigationContext,
83
- MainNavigationExternal,
84
83
  useMainNavigation,
85
84
  } from "./components/MainNavigation";
86
85
  export { default as MainNavigationItem } from "./components/MainNavigationItem";
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ItemStateOptions } from '../utils/constants';
3
3
  declare const useAccordionItemEffect: <E extends Element>({ itemKey, initialEntered, disabled, }?: ItemStateOptions) => {
4
- itemRef: import("react").RefObject<HTMLInputElement>;
4
+ itemRef: import("react").RefObject<HTMLInputElement | null>;
5
5
  state: Readonly<{
6
6
  status: import("react-transition-state").TransitionStatus;
7
7
  isMounted: boolean;
@@ -19,18 +19,10 @@ interface FooterProps extends React.HTMLAttributes<HTMLDivElement> {
19
19
  Optional WFP logo for mobile devices, can be used if the Logo should be provided by the CDN
20
20
  */
21
21
  logo?: string | React.ReactNode;
22
- /**
23
- Optional WFP logo for desktop devices, can be used if the Logo should be provided by the CDN
24
- */
25
- logoExtended?: string | React.ReactNode;
26
22
  /**
27
23
  * Specify the max-width on desktop devices (same as \`Wrapper\` component)
28
24
  */
29
25
  pageWidth?: ScreenSize;
30
- /**
31
- Override the SDG icon
32
- */
33
- sdgLogo?: React.ReactNode;
34
26
  /**
35
27
  The WFP logo, can be used if the SDG logo should be provided in a different way
36
28
  */
@@ -1,2 +1,2 @@
1
- export { default as Footer } from './Footer';
2
- export { FooterExternal, LinksColumn, FooterMetaLink } from './FooterExternal';
1
+ export { default as Footer } from "./Footer";
2
+ export { FooterExternal, LinksColumn, FooterMetaLink } from "./FooterExternal";
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  export interface UseInputProps {
3
3
  /**
4
4
  * Specify an optional className to be applied to the <input> node
@@ -111,6 +111,9 @@ export declare const useInput: ({ addonAfter, className, inputClassName, id, pla
111
111
  className: string;
112
112
  };
113
113
  wrapperProps: {
114
+ calculatedId: string | undefined;
115
+ id: string | undefined;
116
+ name: string | undefined;
114
117
  className: string | undefined;
115
118
  addonAfter: React.ReactNode;
116
119
  labelText: React.ReactNode;
@@ -1,4 +1,3 @@
1
- export { default as MainNavigation } from './MainNavigation';
2
- export { default as MainNavigationExternal } from './MainNavigationExternal';
3
- export { default as MainNavigationContext } from './MainNavigationContext';
4
- export { default as useMainNavigation } from './useMainNavigation';
1
+ export { default as MainNavigation } from "./MainNavigation";
2
+ export { default as MainNavigationContext } from "./MainNavigationContext";
3
+ export { default as useMainNavigation } from "./useMainNavigation";
@@ -1,4 +1,4 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { TransitionState } from "react-transition-state";
3
- declare const useHeightTransition: <E extends Element>({ status, isResolved, }: TransitionState) => readonly [CSSProperties, import("react").RefObject<HTMLInputElement>];
3
+ declare const useHeightTransition: <E extends Element>({ status, isResolved, }: TransitionState) => readonly [CSSProperties, import("react").RefObject<HTMLInputElement | null>];
4
4
  export { useHeightTransition };
@@ -27,7 +27,7 @@ export { default as Loading } from "./components/Loading";
27
27
  export { default as Input, useInput, Label, InlineErrorMessage, Helper, AddonBefore, AddonAfter, } from "./components/Input";
28
28
  export { default as InlineLoading } from "./components/InlineLoading";
29
29
  export { List, ListItem } from "./components/List";
30
- export { MainNavigation, MainNavigationContext, MainNavigationExternal, useMainNavigation, } from "./components/MainNavigation";
30
+ export { MainNavigation, MainNavigationContext, useMainNavigation, } from "./components/MainNavigation";
31
31
  export { default as MainNavigationItem } from "./components/MainNavigationItem";
32
32
  export { SubNavigation, SubNavigationHeader, SubNavigationTitle, SubNavigationLink, SubNavigationFilter, SubNavigationContent, SubNavigationList, SubNavigationGroup, SubNavigationItem, } from "./components/SubNavigation";
33
33
  export { default as mdxComponents } from "./components/MdxComponents";