@progressiveui/react 1.22.1 → 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.
- package/.storybook/WfpTheme.js +1 -1
- package/.storybook/main.ts +4 -4
- package/.storybook/preview.tsx +0 -25
- package/es/dist/components/Accordion/hooks/useAccordionItemEffect.d.ts +1 -1
- package/es/dist/components/Footer/Footer.d.ts +0 -8
- package/es/dist/components/Footer/index.d.ts +2 -2
- package/es/dist/components/Input/useInput.d.ts +2 -0
- package/es/dist/components/MainNavigation/index.d.ts +3 -4
- package/es/dist/hooks/useHeightTransition.d.ts +1 -1
- package/es/dist/index.d.ts +1 -1
- package/es/index.js +231 -1316
- package/lib/dist/components/Accordion/hooks/useAccordionItemEffect.d.ts +1 -1
- package/lib/dist/components/Footer/Footer.d.ts +0 -8
- package/lib/dist/components/Footer/index.d.ts +2 -2
- package/lib/dist/components/Input/useInput.d.ts +2 -0
- package/lib/dist/components/MainNavigation/index.d.ts +3 -4
- package/lib/dist/hooks/useHeightTransition.d.ts +1 -1
- package/lib/dist/index.d.ts +1 -1
- package/lib/index.js +256 -1353
- package/package.json +68 -78
- package/src/components/Accordion/hooks/useAccordion.ts +13 -9
- package/src/components/BannerNavigation/BannerNavigation.stories.tsx +0 -2
- package/src/components/Button/Button.stories.tsx +0 -16
- package/src/components/Button/Button.tsx +14 -11
- package/src/components/ContextMenu/ContextMenu.stories.tsx +0 -2
- package/src/components/Empty/Empty.stories.tsx +1 -2
- package/src/components/Footer/Footer.tsx +2 -42
- package/src/components/Footer/index.ts +2 -2
- package/src/components/Hero/Hero.stories.tsx +0 -2
- package/src/components/MainNavigation/MainNavigation.stories.tsx +1 -4
- package/src/components/MainNavigation/MainNavigation.tsx +1 -23
- package/src/components/MainNavigation/index.ts +3 -4
- package/src/components/Pagination/Pagination.stories.tsx +0 -2
- package/src/components/Search/Search.tsx +1 -1
- package/src/components/Text/Text.tsx +7 -4
- package/src/components/Toggle/Toggle.tsx +4 -4
- package/src/index.ts +0 -1
- package/umd/dist/components/Accordion/hooks/useAccordionItemEffect.d.ts +1 -1
- package/umd/dist/components/Footer/Footer.d.ts +0 -8
- package/umd/dist/components/Footer/index.d.ts +2 -2
- package/umd/dist/components/Input/useInput.d.ts +2 -0
- package/umd/dist/components/MainNavigation/index.d.ts +3 -4
- package/umd/dist/hooks/useHeightTransition.d.ts +1 -1
- package/umd/dist/index.d.ts +1 -1
- package/umd/index.js +231 -1316
- package/umd/index.min.js +1 -1
- package/src/components/MainNavigation/MainNavigationExternal.tsx +0 -338
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progressiveui/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "WFP UI Kit",
|
|
5
5
|
"license": "Apache-2",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -45,126 +45,116 @@
|
|
|
45
45
|
"react-docgen.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"react": "^
|
|
49
|
-
"react-dom": "^
|
|
48
|
+
"react": "^19.1.0",
|
|
49
|
+
"react-dom": "^19.1.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@babel/preset-typescript": "^7.
|
|
52
|
+
"@babel/preset-typescript": "^7.27.0",
|
|
53
53
|
"@carbon/feature-flags": "^0.6.0",
|
|
54
|
-
"classnames": "2.
|
|
54
|
+
"classnames": "2.5.1",
|
|
55
55
|
"invariant": "^2.2.4",
|
|
56
56
|
"react-datepicker": "^4.6.0",
|
|
57
57
|
"react-frame-component": "^5.2.6",
|
|
58
|
-
"react-popper-tooltip": "^4.
|
|
59
|
-
"react-transition-state": "^2.1
|
|
58
|
+
"react-popper-tooltip": "^4.4.2",
|
|
59
|
+
"react-transition-state": "^2.3.1",
|
|
60
60
|
"warning": "^4.0.3",
|
|
61
|
-
"whatwg-fetch": "^3.6.
|
|
61
|
+
"whatwg-fetch": "^3.6.20",
|
|
62
62
|
"window-or-global": "^1.0.1",
|
|
63
|
-
"ws": "^8.
|
|
63
|
+
"ws": "^8.18.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
67
67
|
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
|
68
|
-
"@babel/traverse": "^7.
|
|
69
|
-
"@fontsource-variable/open-sans": "^5.
|
|
68
|
+
"@babel/traverse": "^7.27.0",
|
|
69
|
+
"@fontsource-variable/open-sans": "^5.2.5",
|
|
70
70
|
"@progressiveui/icons-react": "^10.38.0",
|
|
71
|
-
"@progressiveui/styles": "^
|
|
71
|
+
"@progressiveui/styles": "^11.0.0",
|
|
72
72
|
"@progressiveui/themes-core": "^0.4.0",
|
|
73
73
|
"@rollup/plugin-babel": "^6.0.4",
|
|
74
|
-
"@rollup/plugin-commonjs": "^
|
|
75
|
-
"@rollup/plugin-node-resolve": "^
|
|
76
|
-
"@rollup/plugin-replace": "^
|
|
77
|
-
"@rollup/plugin-
|
|
78
|
-
"@
|
|
79
|
-
"@storybook/addon-
|
|
80
|
-
"@storybook/addon-
|
|
81
|
-
"@storybook/
|
|
82
|
-
"@storybook/
|
|
83
|
-
"@storybook/
|
|
84
|
-
"@storybook/blocks": "^8.0.0-beta.4",
|
|
85
|
-
"@storybook/react": "^8.0.0-beta.4",
|
|
86
|
-
"@storybook/react-vite": "^8.0.0-beta.4",
|
|
74
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
75
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
76
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
77
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
78
|
+
"@storybook/addon-docs": "^8.6.12",
|
|
79
|
+
"@storybook/addon-essentials": "^8.6.12",
|
|
80
|
+
"@storybook/addon-links": "^8.6.12",
|
|
81
|
+
"@storybook/blocks": "^8.6.12",
|
|
82
|
+
"@storybook/react": "^8.6.12",
|
|
83
|
+
"@storybook/react-vite": "^8.6.12",
|
|
87
84
|
"@storybook/testing-library": "^0.2.2",
|
|
88
|
-
"@testing-library/jest-dom": "^6.
|
|
89
|
-
"@testing-library/react": "^
|
|
90
|
-
"@types/jest": "^29.5.
|
|
91
|
-
"@types/mdx": "^2.0.
|
|
92
|
-
"@types/mocha": "^10.0.
|
|
93
|
-
"@types/node": "^20.
|
|
94
|
-
"@types/react": "^
|
|
95
|
-
"@types/react-dom": "^
|
|
96
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
97
|
-
"@typescript-eslint/parser": "^
|
|
98
|
-
"
|
|
99
|
-
"all-contributors-cli": "^6.17.0",
|
|
100
|
-
"autoprefixer": "^9.8.6",
|
|
85
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
86
|
+
"@testing-library/react": "^16.3.0",
|
|
87
|
+
"@types/jest": "^29.5.14",
|
|
88
|
+
"@types/mdx": "^2.0.13",
|
|
89
|
+
"@types/mocha": "^10.0.10",
|
|
90
|
+
"@types/node": "^20.14.0",
|
|
91
|
+
"@types/react": "^19.1.0",
|
|
92
|
+
"@types/react-dom": "^19.1.2",
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
94
|
+
"@typescript-eslint/parser": "^8.29.1",
|
|
95
|
+
"autoprefixer": "^10.4.21",
|
|
101
96
|
"babel-eslint": "^10.1.0",
|
|
102
|
-
"babel-loader": "^
|
|
103
|
-
"babel-plugin-dev-expression": "^0.2.
|
|
97
|
+
"babel-loader": "^10.0.0",
|
|
98
|
+
"babel-plugin-dev-expression": "^0.2.3",
|
|
104
99
|
"babel-plugin-named-exports-order": "^0.0.2",
|
|
105
|
-
"browserslist-config-carbon": "^
|
|
106
|
-
"clean-webpack-plugin": "^
|
|
107
|
-
"css-loader": "^
|
|
100
|
+
"browserslist-config-carbon": "^11.2.0",
|
|
101
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
102
|
+
"css-loader": "^7.1.2",
|
|
108
103
|
"enzyme": "^3.11.0",
|
|
109
|
-
"enzyme-adapter-react-16": "^1.15.
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"gzip-size": "^5.1.1",
|
|
113
|
-
"handlebars": "^4.7.7",
|
|
114
|
-
"iframe-resizer": "^4.3.6",
|
|
104
|
+
"enzyme-adapter-react-16": "^1.15.8",
|
|
105
|
+
"eslint-plugin-storybook": "^0.12.0",
|
|
106
|
+
"handlebars": "^4.7.8",
|
|
115
107
|
"jest": "^29.7.0",
|
|
116
108
|
"jest-environment-jsdom": "^29.7.0",
|
|
117
|
-
"lodash.isequal": "^4.5.0",
|
|
118
|
-
"moment": "^2.27.0",
|
|
119
109
|
"object-assign": "^4.1.1",
|
|
120
|
-
"postcss": "^8.
|
|
121
|
-
"postcss-cli": "^
|
|
122
|
-
"postcss-custom-properties": "^
|
|
123
|
-
"postcss-loader": "
|
|
124
|
-
"prettier": "^
|
|
110
|
+
"postcss": "^8.5.3",
|
|
111
|
+
"postcss-cli": "^11.0.1",
|
|
112
|
+
"postcss-custom-properties": "^14.0.4",
|
|
113
|
+
"postcss-loader": "8.1.1",
|
|
114
|
+
"prettier": "^3.5.3",
|
|
125
115
|
"pretty": "^2.0.0",
|
|
126
|
-
"prismjs": "^1.
|
|
127
|
-
"promise": "^8.
|
|
116
|
+
"prismjs": "^1.30.0",
|
|
117
|
+
"promise": "^8.3.0",
|
|
128
118
|
"prop-types": "^15.8.1",
|
|
129
|
-
"raw-loader": "^4.0.
|
|
130
|
-
"react": "
|
|
119
|
+
"raw-loader": "^4.0.2",
|
|
120
|
+
"react": "19.1.0",
|
|
131
121
|
"react-dates": "^21.8.0",
|
|
132
|
-
"react-docgen": "^7.
|
|
122
|
+
"react-docgen": "^7.1.1",
|
|
133
123
|
"react-docgen-typescript": "^2.2.2",
|
|
134
|
-
"react-dom": "
|
|
135
|
-
"react-dropzone": "^
|
|
136
|
-
"react-final-form": "^6.5.
|
|
124
|
+
"react-dom": "19.1.0",
|
|
125
|
+
"react-dropzone": "^14.3.8",
|
|
126
|
+
"react-final-form": "^6.5.9",
|
|
137
127
|
"react-hook-form": "^7.20.5",
|
|
138
128
|
"react-markdown": "^9.0.0",
|
|
139
129
|
"react-popper": "^2.2.3",
|
|
140
130
|
"react-prism": "^4.3.2",
|
|
141
131
|
"react-redux": "^7.2.1",
|
|
142
|
-
"react-select": "^
|
|
143
|
-
"react-table": "7.
|
|
144
|
-
"recharts": "^2.
|
|
132
|
+
"react-select": "^5.10.1",
|
|
133
|
+
"react-table": "7.8.0",
|
|
134
|
+
"recharts": "^2.15.2",
|
|
145
135
|
"redux-form": "^8.3.10",
|
|
146
136
|
"requestanimationframe": "^0.0.23",
|
|
147
|
-
"rimraf": "^
|
|
137
|
+
"rimraf": "^6.0.1",
|
|
148
138
|
"rollup": "4.1.4",
|
|
149
139
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
150
140
|
"rollup-plugin-preserve-directives": "^0.2.0",
|
|
151
141
|
"rollup-plugin-string": "^3.0.0",
|
|
152
142
|
"rollup-plugin-strip-banner": "^3.0.0",
|
|
153
143
|
"rollup-plugin-terser": "^7.0.2",
|
|
154
|
-
"rollup-plugin-visualizer": "^5.
|
|
155
|
-
"sass": "^1.
|
|
156
|
-
"sass-loader": "
|
|
157
|
-
"storybook": "^8.
|
|
158
|
-
"style-loader": "^
|
|
159
|
-
"ts-jest": "^29.
|
|
160
|
-
"twig": "^1.
|
|
161
|
-
"typescript": "^
|
|
162
|
-
"vite": "^
|
|
144
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
145
|
+
"sass": "^1.86.3",
|
|
146
|
+
"sass-loader": "16.0.5",
|
|
147
|
+
"storybook": "^8.6.12",
|
|
148
|
+
"style-loader": "^4.0.0",
|
|
149
|
+
"ts-jest": "^29.3.1",
|
|
150
|
+
"twig": "^1.17.1",
|
|
151
|
+
"typescript": "^5.8.3",
|
|
152
|
+
"vite": "^6.2.5"
|
|
163
153
|
},
|
|
164
154
|
"repository": {
|
|
165
155
|
"type": "git",
|
|
166
156
|
"url": "https://github.com/wfp/ui.git"
|
|
167
157
|
},
|
|
168
158
|
"bundleSizeThreshold": 80000,
|
|
169
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "d5135d857e06dd46b8cfad1d77b35a61aed8ce50"
|
|
170
160
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { ACCORDION_ATTR, ACCORDION_BTN_ATTR } from '../utils/constants';
|
|
2
|
+
import { HTMLAttributes, KeyboardEvent } from "react";
|
|
3
|
+
import { ACCORDION_ATTR, ACCORDION_BTN_ATTR } from "../utils/constants";
|
|
5
4
|
|
|
6
5
|
const getAccordion = (node: Element) => {
|
|
7
6
|
do {
|
|
@@ -23,7 +22,7 @@ const moveFocus = (moveUp: boolean, e: KeyboardEvent<Element>) => {
|
|
|
23
22
|
return;
|
|
24
23
|
|
|
25
24
|
const nodes = e.currentTarget.querySelectorAll<HTMLElement>(
|
|
26
|
-
`[${ACCORDION_BTN_ATTR}]
|
|
25
|
+
`[${ACCORDION_BTN_ATTR}]`,
|
|
27
26
|
);
|
|
28
27
|
const { length } = nodes;
|
|
29
28
|
for (let i = 0; i < length; i++) {
|
|
@@ -40,13 +39,18 @@ const moveFocus = (moveUp: boolean, e: KeyboardEvent<Element>) => {
|
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
41
|
|
|
42
|
+
// Extend HTMLAttributes to allow our custom data attribute
|
|
43
|
+
interface AccordionHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
44
|
+
"data-accordion"?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
const useAccordion = () => {
|
|
44
|
-
const accordionProps:
|
|
45
|
-
|
|
46
|
-
onKeyDown: (e) =>
|
|
47
|
-
e.key ===
|
|
48
|
+
const accordionProps: AccordionHTMLAttributes<Element> = {
|
|
49
|
+
"data-accordion": "",
|
|
50
|
+
onKeyDown: (e: KeyboardEvent<Element>) =>
|
|
51
|
+
e.key === "ArrowUp"
|
|
48
52
|
? moveFocus(true, e)
|
|
49
|
-
: e.key ===
|
|
53
|
+
: e.key === "ArrowDown" && moveFocus(false, e),
|
|
50
54
|
};
|
|
51
55
|
return {
|
|
52
56
|
accordionProps,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { action } from "@storybook/addon-actions";
|
|
3
2
|
import { BannerNavigation, BannerNavigationItem } from "./BannerNavigation";
|
|
4
3
|
import { BannerNavigationWithContent } from "./BannerNavigationWithContent";
|
|
5
|
-
import Search from "../Search";
|
|
6
4
|
import Link from "../Link";
|
|
7
5
|
|
|
8
6
|
export default {
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import { buttonKinds } from "../../prop-types/types";
|
|
4
4
|
import { AddCircle } from "@progressiveui/icons-react";
|
|
5
|
-
import markdown from "./README.mdx";
|
|
6
5
|
import Button from "./Button";
|
|
7
6
|
|
|
8
7
|
const meta: Meta<typeof Button> = {
|
|
@@ -12,28 +11,13 @@ const meta: Meta<typeof Button> = {
|
|
|
12
11
|
parameters: {
|
|
13
12
|
componentSubtitle: "Component",
|
|
14
13
|
status: "released",
|
|
15
|
-
mdx: markdown,
|
|
16
14
|
// twig: buttonTwig,
|
|
17
15
|
},
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
// export default {
|
|
21
|
-
// title: "Components/UI Elements/Button",
|
|
22
|
-
// component: Button,
|
|
23
|
-
// markdown: "hello",
|
|
24
|
-
// parameters: {
|
|
25
|
-
// componentSubtitle: "Component",
|
|
26
|
-
// status: "released",
|
|
27
|
-
// mdx: markdown,
|
|
28
|
-
// // twig: buttonTwig,
|
|
29
|
-
// },
|
|
30
|
-
// };
|
|
31
|
-
|
|
32
18
|
export default meta;
|
|
33
19
|
type Story = StoryObj<typeof Button>;
|
|
34
20
|
|
|
35
|
-
//export const ButtonDefault = (args) => <Button {...args}>Default</Button>;
|
|
36
|
-
|
|
37
21
|
export const ButtonDefault: Story = {
|
|
38
22
|
render: (args) => <Button {...args} />,
|
|
39
23
|
args: {
|
|
@@ -18,7 +18,6 @@ interface ButtonBaseProps {
|
|
|
18
18
|
* Specify whether the Button should be a large variant
|
|
19
19
|
*/
|
|
20
20
|
large?: boolean;
|
|
21
|
-
|
|
22
21
|
/**
|
|
23
22
|
* Specify btnSolid to buttons on solid background to make it stand out
|
|
24
23
|
*/
|
|
@@ -31,7 +30,6 @@ interface ButtonBaseProps {
|
|
|
31
30
|
* Optionally specify an href for your Button to become an element
|
|
32
31
|
*/
|
|
33
32
|
href?: string;
|
|
34
|
-
//target?: string; // TODO: Remove " "
|
|
35
33
|
/**
|
|
36
34
|
* Specify an `icon` to include in the Button through an object representing the SVG data of the icon, similar to the `Icon` component @design
|
|
37
35
|
*/
|
|
@@ -40,7 +38,9 @@ interface ButtonBaseProps {
|
|
|
40
38
|
* Optionally specify an href for your Button to become an element @design
|
|
41
39
|
*/
|
|
42
40
|
iconReverse?: boolean;
|
|
43
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Icon description for accessibility
|
|
43
|
+
*/
|
|
44
44
|
iconDescription?: string;
|
|
45
45
|
/**
|
|
46
46
|
* Specify whether the Button should be disabled, or not
|
|
@@ -51,7 +51,6 @@ interface ButtonBaseProps {
|
|
|
51
51
|
*/
|
|
52
52
|
tabIndex?: number;
|
|
53
53
|
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>["target"];
|
|
54
|
-
// type?: 'button' | 'reset' | 'submit';
|
|
55
54
|
useFlexbox?: boolean;
|
|
56
55
|
id?: string;
|
|
57
56
|
}
|
|
@@ -69,8 +68,8 @@ type ConditionalProps<T> = T extends { href: string }
|
|
|
69
68
|
: ButtonButtonProps;
|
|
70
69
|
|
|
71
70
|
/**
|
|
72
|
-
* Buttons express what action will occur when the user clicks or touches it. Buttons are used to initialize an action, either in the background or foreground of an experience.
|
|
73
|
-
|
|
71
|
+
* Buttons express what action will occur when the user clicks or touches it. Buttons are used to initialize an action, either in the background or foreground of an experience.
|
|
72
|
+
*/
|
|
74
73
|
export type ButtonRef<T extends React.ElementType> =
|
|
75
74
|
React.ComponentPropsWithRef<T>["ref"];
|
|
76
75
|
|
|
@@ -78,8 +77,8 @@ export const Button = React.forwardRef(
|
|
|
78
77
|
<T extends { href?: string }>(
|
|
79
78
|
props: ConditionalProps<T>,
|
|
80
79
|
ref: React.Ref<
|
|
81
|
-
T extends { href: string } ?
|
|
82
|
-
|
|
80
|
+
T extends { href: string } ? HTMLAnchorElement : HTMLButtonElement
|
|
81
|
+
>,
|
|
83
82
|
) => {
|
|
84
83
|
const {
|
|
85
84
|
children,
|
|
@@ -92,6 +91,7 @@ export const Button = React.forwardRef(
|
|
|
92
91
|
iconReverse,
|
|
93
92
|
tabIndex,
|
|
94
93
|
useFlexbox,
|
|
94
|
+
// Set the default to "button"
|
|
95
95
|
type = "button",
|
|
96
96
|
icon,
|
|
97
97
|
iconDescription,
|
|
@@ -144,7 +144,9 @@ export const Button = React.forwardRef(
|
|
|
144
144
|
setCount(false);
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
const onClickAnimation = (
|
|
147
|
+
const onClickAnimation = (
|
|
148
|
+
e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>,
|
|
149
|
+
) => {
|
|
148
150
|
if (onClick) {
|
|
149
151
|
onClick(e);
|
|
150
152
|
}
|
|
@@ -183,7 +185,8 @@ export const Button = React.forwardRef(
|
|
|
183
185
|
{...buttonProps}
|
|
184
186
|
{...commonProps}
|
|
185
187
|
disabled={disabled}
|
|
186
|
-
type
|
|
188
|
+
// Cast the type prop to the allowed union
|
|
189
|
+
type={type as "button" | "reset" | "submit"}
|
|
187
190
|
onClick={onClickAnimation}
|
|
188
191
|
ref={ref as React.Ref<HTMLButtonElement>}
|
|
189
192
|
id={id}
|
|
@@ -193,7 +196,7 @@ export const Button = React.forwardRef(
|
|
|
193
196
|
{!iconReverse && buttonImage}
|
|
194
197
|
</button>
|
|
195
198
|
);
|
|
196
|
-
}
|
|
199
|
+
},
|
|
197
200
|
);
|
|
198
201
|
|
|
199
202
|
Button.displayName = "Button";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import markdown from "./README.mdx";
|
|
3
2
|
import { ContextMenu, ContextMenuGroup, ContextMenuItem } from "./ContextMenu";
|
|
4
3
|
import Link from "../Link";
|
|
5
4
|
|
|
@@ -9,7 +8,6 @@ export default {
|
|
|
9
8
|
parameters: {
|
|
10
9
|
componentSubtitle: "Component",
|
|
11
10
|
status: "released",
|
|
12
|
-
mdx: markdown,
|
|
13
11
|
},
|
|
14
12
|
};
|
|
15
13
|
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import markdown from "./README.mdx";
|
|
3
3
|
import Empty from "./Empty";
|
|
4
4
|
import Button from "../Button";
|
|
5
|
-
//import { IllustrationsMovingVanWithBackground } from '@wfp/pictograms-react';
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
title: "Components/UI Elements/Empty",
|
|
@@ -32,7 +31,7 @@ EmptyDefault.args = {
|
|
|
32
31
|
|
|
33
32
|
const emptysourcecode = `
|
|
34
33
|
import { Empty, Button } from "@progressiveui/react";
|
|
35
|
-
|
|
34
|
+
|
|
36
35
|
|
|
37
36
|
<Empty
|
|
38
37
|
button={<Button kind="accent">New entry</Button>}
|
|
@@ -3,10 +3,6 @@ import classNames from "classnames";
|
|
|
3
3
|
import Link from "../Link";
|
|
4
4
|
import Wrapper from "../Wrapper";
|
|
5
5
|
import { ScreenSize } from "../../utils";
|
|
6
|
-
import {
|
|
7
|
-
WfpLogoStandardBlackEn,
|
|
8
|
-
WfpLogoVerticalEn,
|
|
9
|
-
} from "@progressiveui/icons-react";
|
|
10
6
|
import useSettings from "../../hooks/useSettings";
|
|
11
7
|
|
|
12
8
|
/** A Footer is a section at the bottom of each page. It typically contains basic site information, copyright data or links to related pages. */
|
|
@@ -28,18 +24,11 @@ interface FooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
24
|
Optional WFP logo for mobile devices, can be used if the Logo should be provided by the CDN
|
|
29
25
|
*/
|
|
30
26
|
logo?: string | React.ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
Optional WFP logo for desktop devices, can be used if the Logo should be provided by the CDN
|
|
33
|
-
*/
|
|
34
|
-
logoExtended?: string | React.ReactNode;
|
|
35
27
|
/**
|
|
36
28
|
* Specify the max-width on desktop devices (same as \`Wrapper\` component)
|
|
37
29
|
*/
|
|
38
30
|
pageWidth?: ScreenSize;
|
|
39
|
-
|
|
40
|
-
Override the SDG icon
|
|
41
|
-
*/
|
|
42
|
-
sdgLogo?: React.ReactNode;
|
|
31
|
+
|
|
43
32
|
/**
|
|
44
33
|
The WFP logo, can be used if the SDG logo should be provided in a different way
|
|
45
34
|
*/
|
|
@@ -63,7 +52,6 @@ const Footer: React.FC<FooterProps> = ({
|
|
|
63
52
|
linkTextTwo,
|
|
64
53
|
linkHrefTwo,
|
|
65
54
|
logo,
|
|
66
|
-
logoExtended,
|
|
67
55
|
metaContent,
|
|
68
56
|
metaLinks,
|
|
69
57
|
secondary,
|
|
@@ -101,35 +89,7 @@ const Footer: React.FC<FooterProps> = ({
|
|
|
101
89
|
</div>
|
|
102
90
|
)}
|
|
103
91
|
<div className={`${prefix}--footer__cta`}>
|
|
104
|
-
{
|
|
105
|
-
<img
|
|
106
|
-
className={`${prefix}--footer__cta-logo`}
|
|
107
|
-
src={logoExtended}
|
|
108
|
-
alt="World Food Programme Logo"
|
|
109
|
-
/>
|
|
110
|
-
) : logoExtended ? (
|
|
111
|
-
logoExtended
|
|
112
|
-
) : (
|
|
113
|
-
<WfpLogoStandardBlackEn
|
|
114
|
-
className={`${prefix}--footer__cta-logo`}
|
|
115
|
-
alt="WFP"
|
|
116
|
-
/>
|
|
117
|
-
)}
|
|
118
|
-
|
|
119
|
-
{logo && typeof logo === "string" ? (
|
|
120
|
-
<img
|
|
121
|
-
className={`${prefix}--footer__cta-logo-small`}
|
|
122
|
-
src={logo}
|
|
123
|
-
alt="WFP Logo"
|
|
124
|
-
/>
|
|
125
|
-
) : logo ? (
|
|
126
|
-
logo
|
|
127
|
-
) : (
|
|
128
|
-
<WfpLogoVerticalEn
|
|
129
|
-
description="WFP"
|
|
130
|
-
className={`${prefix}--footer__cta-logo-small`}
|
|
131
|
-
/>
|
|
132
|
-
)}
|
|
92
|
+
{logo}
|
|
133
93
|
{secondary && (
|
|
134
94
|
<div className={`${prefix}--footer__secondary`}>{secondary}</div>
|
|
135
95
|
)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as Footer } from
|
|
2
|
-
export { FooterExternal, LinksColumn, FooterMetaLink } from
|
|
1
|
+
export { default as Footer } from "./Footer";
|
|
2
|
+
export { FooterExternal, LinksColumn, FooterMetaLink } from "./FooterExternal";
|
|
@@ -4,7 +4,6 @@ import markdown from "./README.mdx";
|
|
|
4
4
|
|
|
5
5
|
import { Hero, HeroExternal } from ".";
|
|
6
6
|
import Button from "../Button";
|
|
7
|
-
import { WfpHumEmergencyResponsePos } from "@wfp/pictograms-react";
|
|
8
7
|
//import heroTwig from './Hero.twig';
|
|
9
8
|
|
|
10
9
|
export default {
|
|
@@ -240,7 +239,6 @@ Emergencies.args = {
|
|
|
240
239
|
...Regular.args,
|
|
241
240
|
title: (
|
|
242
241
|
<>
|
|
243
|
-
<WfpHumEmergencyResponsePos fill="#FFF" style={{ marginRight: "1rem" }} />
|
|
244
242
|
<span>
|
|
245
243
|
Curabitur ullamcorper ultricies nisi. Proin magna.{" "}
|
|
246
244
|
<a>Etiam iaculis nunc ac metus</a>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
//import markdown from './README.mdx';
|
|
3
2
|
import { action } from "@storybook/addon-actions";
|
|
4
|
-
import { MainNavigation
|
|
3
|
+
import { MainNavigation } from ".";
|
|
5
4
|
import MainNavigationItem from "../MainNavigationItem";
|
|
6
5
|
|
|
7
6
|
import {
|
|
@@ -23,7 +22,6 @@ import User from "../User";
|
|
|
23
22
|
export default {
|
|
24
23
|
title: "Components/Navigation/MainNavigation",
|
|
25
24
|
component: MainNavigation,
|
|
26
|
-
subcomponents: { MainNavigationExternal },
|
|
27
25
|
parameters: {
|
|
28
26
|
componentSubtitle: "Component",
|
|
29
27
|
status: "released",
|
|
@@ -183,7 +181,6 @@ You can customize the content by using \`MainNavigation\`.
|
|
|
183
181
|
const sourcecode = (type) => {
|
|
184
182
|
return `import { Button,User, Search } from "@progressiveui/react";
|
|
185
183
|
import {
|
|
186
|
-
MainNavigationExternal,
|
|
187
184
|
MainNavigationItem,
|
|
188
185
|
SubNavigation,
|
|
189
186
|
SubNavigationHeader,
|
|
@@ -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
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
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
|
|
|
@@ -30,7 +30,9 @@ interface TextProps extends React.AllHTMLAttributes<HTMLDivElement> {
|
|
|
30
30
|
className?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const textLookup:
|
|
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:
|
|
65
|
-
|
|
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
|
};
|