@automattic/vip-design-system 1.3.2 → 1.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 (41) hide show
  1. package/.storybook/preview.tsx +3 -0
  2. package/README.md +17 -4
  3. package/build/system/Form/Radio.js +0 -2
  4. package/build/system/Link/Link.stories.d.ts +1 -1
  5. package/build/system/Link/Link.stories.js +2 -2
  6. package/build/system/Nav/Nav.d.ts +13 -0
  7. package/build/system/Nav/Nav.js +62 -0
  8. package/build/system/Nav/Nav.stories.d.ts +27 -0
  9. package/build/system/Nav/Nav.stories.js +85 -0
  10. package/build/system/Nav/Nav.test.d.ts +1 -0
  11. package/build/system/Nav/Nav.test.js +72 -0
  12. package/build/system/Nav/NavItem.d.ts +19 -0
  13. package/build/system/Nav/NavItem.js +148 -0
  14. package/build/system/Nav/index.d.ts +10 -0
  15. package/build/system/Nav/index.js +19 -0
  16. package/build/system/Notice/Notice.js +24 -10
  17. package/build/system/Notice/Notice.stories.d.ts +1 -0
  18. package/build/system/Notice/Notice.stories.js +34 -2
  19. package/build/system/Tabs/Tabs.stories.jsx +1 -1
  20. package/build/system/Wizard/Wizard.stories.js +1 -1
  21. package/build/system/index.d.ts +3 -1
  22. package/build/system/index.js +5 -2
  23. package/docs/ARCHITECTURE.md +88 -0
  24. package/docs/CONTRIBUTING.md +54 -0
  25. package/docs/RELEASING.md +70 -0
  26. package/docs/SETUP.md +68 -0
  27. package/docs/TESTING.md +63 -0
  28. package/package.json +2 -1
  29. package/src/system/Form/Radio.js +0 -2
  30. package/src/system/Link/Link.stories.tsx +1 -1
  31. package/src/system/Nav/Nav.stories.tsx +117 -0
  32. package/src/system/Nav/Nav.test.tsx +51 -0
  33. package/src/system/Nav/Nav.tsx +62 -0
  34. package/src/system/Nav/NavItem.tsx +152 -0
  35. package/src/system/Nav/index.tsx +18 -0
  36. package/src/system/Notice/Notice.stories.tsx +21 -3
  37. package/src/system/Notice/Notice.tsx +20 -13
  38. package/src/system/Tabs/Tabs.stories.jsx +1 -1
  39. package/src/system/Wizard/Wizard.stories.tsx +1 -1
  40. package/src/system/index.js +5 -2
  41. package/CONTRIBUTING.md +0 -138
@@ -6,6 +6,7 @@ var _react = _interopRequireDefault(require("react"));
6
6
  var _ = require("..");
7
7
  var _jsxRuntime = require("theme-ui/jsx-runtime");
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
+ /** @jsxImportSource theme-ui */
9
10
  /**
10
11
  * External dependencies
11
12
  */
@@ -80,13 +81,14 @@ var Default = exports.Default = function Default() {
80
81
  }), (0, _jsxRuntime.jsx)(_.Notice, {
81
82
  variant: "alert",
82
83
  sx: {
83
- mb: 4
84
+ mb: 2
84
85
  },
85
86
  title: "There are errors in your form",
86
87
  headingVariant: "h2",
87
88
  children: (0, _jsxRuntime.jsxs)("ul", {
88
89
  sx: {
89
- mb: 0
90
+ m: 0,
91
+ pl: 3
90
92
  },
91
93
  children: [(0, _jsxRuntime.jsx)("li", {
92
94
  children: (0, _jsxRuntime.jsx)(_.Link, {
@@ -105,6 +107,36 @@ var Default = exports.Default = function Default() {
105
107
  })
106
108
  })]
107
109
  })
110
+ }), (0, _jsxRuntime.jsx)(_.Notice, {
111
+ variant: "alert",
112
+ sx: {
113
+ mb: 2
114
+ },
115
+ children: (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
116
+ children: [(0, _jsxRuntime.jsx)(_.Heading, {
117
+ variant: 'h4',
118
+ sx: {
119
+ fontSize: 2
120
+ },
121
+ children: "Alternative way of printing errors"
122
+ }), (0, _jsxRuntime.jsxs)("ul", {
123
+ sx: {
124
+ m: 0,
125
+ pl: 3
126
+ },
127
+ children: [(0, _jsxRuntime.jsx)("li", {
128
+ children: (0, _jsxRuntime.jsx)(_.Link, {
129
+ href: "#name",
130
+ children: "Please enter your name."
131
+ })
132
+ }), (0, _jsxRuntime.jsx)("li", {
133
+ children: (0, _jsxRuntime.jsx)(_.Link, {
134
+ href: "#email",
135
+ children: "Please enter your email address."
136
+ })
137
+ })]
138
+ })]
139
+ })
108
140
  }), (0, _jsxRuntime.jsxs)(_.Notice, {
109
141
  variant: "alert",
110
142
  sx: {
@@ -11,7 +11,7 @@ import React from 'react';
11
11
  import { Tabs, TabsTrigger, TabsList, TabsContent, Text, Link, Button } from '..';
12
12
 
13
13
  export default {
14
- title: 'Tabs',
14
+ title: 'Navigation/Tabs',
15
15
  component: Tabs,
16
16
  };
17
17
 
@@ -14,7 +14,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
14
14
  * Internal dependencies
15
15
  */
16
16
  var _default = exports["default"] = {
17
- title: 'Wizard',
17
+ title: 'Navigation/Wizard',
18
18
  component: _.Wizard
19
19
  };
20
20
  var Default = exports.Default = function Default() {
@@ -39,6 +39,8 @@ import { Textarea } from './Form';
39
39
  import { Progress } from './Progress';
40
40
  import { Text } from './Text';
41
41
  import { Tabs } from './Tabs';
42
+ import { Nav } from './Nav';
43
+ import { NavItem } from './Nav';
42
44
  import { TabsTrigger } from './Tabs';
43
45
  import { TabsContent } from './Tabs';
44
46
  import { TabsList } from './Tabs';
@@ -48,4 +50,4 @@ import { Validation } from './Form';
48
50
  import { Wizard } from './Wizard';
49
51
  import { WizardStep } from './Wizard';
50
52
  import theme from './theme';
51
- export { Accordion, Avatar, Badge, Box, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, NewConfirmationDialog, Grid, Flex, Notice, OptionRow, Heading, Input, Label, Spinner, Table, TableRow, TableCell, Tooltip, Link, Radio, RadioBoxGroup, Textarea, Progress, Text, Tabs, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Validation, Wizard, WizardStep, WizardStepHorizontal, theme };
53
+ export { Accordion, Avatar, Badge, Box, Button, ButtonSubmit, ButtonVariant, Card, Checkbox, Code, Dialog, NewDialog, Form, Dropdown, DialogButton, DialogMenu, DialogMenuItem, DialogDivider, DialogContent, DialogTrigger, ConfirmationDialog, NewConfirmationDialog, Grid, Flex, Notice, OptionRow, Heading, Input, Label, Spinner, Table, TableRow, TableCell, Tooltip, Link, Radio, RadioBoxGroup, Textarea, Progress, Text, Tabs, Nav, NavItem, TabsTrigger, TabsContent, TabsList, Toggle, ToggleRow, Validation, Wizard, WizardStep, theme };
@@ -7,6 +7,8 @@ import { Box } from './Box';
7
7
  import { Button, ButtonSubmit, ButtonVariant } from './Button';
8
8
  import { Card } from './Card';
9
9
  import { Code } from './Code';
10
+ import { Nav, NavItem } from './Nav';
11
+
10
12
  import {
11
13
  Dialog,
12
14
  DialogButton,
@@ -48,7 +50,7 @@ import { OptionRow } from './OptionRow';
48
50
  import { Table, TableRow, TableCell } from './Table';
49
51
  import { Text } from './Text';
50
52
  import theme from './theme';
51
- import { Wizard, WizardStep, WizardStepHorizontal } from './Wizard';
53
+ import { Wizard, WizardStep } from './Wizard';
52
54
  import { Tabs, TabsList, TabsContent, TabsTrigger } from './Tabs';
53
55
 
54
56
  export {
@@ -93,6 +95,8 @@ export {
93
95
  Progress,
94
96
  Text,
95
97
  Tabs,
98
+ Nav,
99
+ NavItem,
96
100
  TabsTrigger,
97
101
  TabsContent,
98
102
  TabsList,
@@ -101,6 +105,5 @@ export {
101
105
  Validation,
102
106
  Wizard,
103
107
  WizardStep,
104
- WizardStepHorizontal,
105
108
  theme,
106
109
  };
@@ -0,0 +1,88 @@
1
+ # Architecture
2
+
3
+ ## Basic functionality
4
+
5
+ `vip-design-system` is a React component released in the NPM registry. It's a [public package](https://www.npmjs.com/package/@automattic/vip-design-system) that anyone can install.
6
+
7
+ ## Languages & coding standard
8
+
9
+ Both JavaScript and TypeScript are used to implement the software.
10
+
11
+ We require that the WPVIP defined coding style to be used, defined in [.eslintrc.js](https://github.com/Automattic/vip-design-system/blob/trunk/.eslintrc.js).
12
+
13
+ We also use [.prettierrc](https://github.com/Automattic/vip-design-system/blob/trunk/.prettierrc) to have a standard on coding formatting. It's recommended to set your Editor to apply "Format on Save".
14
+
15
+ [JEST](https://github.com/Automattic/vip-design-system/blob/readme-update/package.json#L16-L17) is the test-runnner used in this application.
16
+
17
+ ## Code structure
18
+
19
+ The code is structured in the following way:
20
+
21
+ - [.github/](https://github.com/Automattic/vip-design-system/tree/trunk/.github) — configuration and templates for GitHub actions.
22
+ - [.storybook/](https://github.com/Automattic/vip-design-system/tree/trunk/.storybook) — configuration files for Storybook
23
+ - [src/](https://github.com/Automattic/vip-design-system/tree/trunk/src) — Javascript and Typescript react component files + Theme configuration + Components tests (on each component folder).
24
+ - [test/](https://github.com/Automattic/vip-design-system/tree/trunk/test) — Test utilities, mocks or configuration for the test suite.
25
+ - [tokens/](https://github.com/Automattic/vip-design-system/tree/trunk/test) — VIP Design Sytem tokens exported using [Figma Studio](https://docs.tokens.studio/). This is the source of truth for the Design team tokens, variables, etc.
26
+
27
+ ### Components structure
28
+
29
+ Components lives under the `src/system/ComponentName` directory. Each component folder contains a similar set of files. Let's use the [Avatar](https://github.com/Automattic/vip-design-system/tree/trunk/src/system/Avatar) component as an example:
30
+
31
+ - **Avatar.stories.tsx**: This is the documentation file of the component. The `*.stories` is related to the Storybook story files.
32
+ - **Avatar.test.tsx**: This is the test file for this component. We run `jest` as a runner in this application.
33
+ - **Avatar.tsx**: This is the TypeScript component itself.
34
+ - **index.ts**: Some components has a index file to export different files. This is not recommended anymore.
35
+
36
+ ### Theme UI & Radix UI Primitives
37
+
38
+ Most of our components are based on [https://theme-ui.com/](https://theme-ui.com/) components. We try to write our own components as much as we can. Other components are based on [Radix UI Primitives](https://www.radix-ui.com/primitives) components. Radix usually has some solid and accessible components that we can use as a base.
39
+
40
+ ## Updating the Theme with VIP Design System Tokens
41
+
42
+ You need to update the tokens once the VIP Design System updates the core files. The Figma Studio plugin will push files into the [tokens/](https://github.com/Automattic/vip-design-system/tree/trunk/tokens) folder. Once these files are there, you can run the following:
43
+
44
+ ```bash
45
+ npm run theme-update
46
+ ```
47
+
48
+ to have an updated json theme under [src/system/theme/generated/](https://github.com/Automattic/vip-design-system/tree/trunk/src/system/theme/generated).
49
+
50
+ ### How the theming works
51
+
52
+ We use the VIP Design System Tokens as our base theme structure. All colors, spaces, types should come from a dynamic token system provided by the VIP Design team, currently using Figma as the design software. When the design system is updated by the Design team, they push files to the [tokens/](https://github.com/Automattic/vip-design-system/tree/trunk/tokens) directory.
53
+
54
+ By using the [Token Transformer](https://docs.tokens.studio/sync/github#7-how-to-use-tokens-stored-in-github-in-development) and a custom npm script, we parse this file getting only the VIP Dashboard theme we need for the react components. The light theme is called: `wpvip-product-core`, and the dark theme is called `wpvip-product-dark`.
55
+
56
+ Once the new file is updated, we need to generate a custom theme file in [src/system/theme/generated/valet-theme-light.json](https://github.com/Automattic/vip-design-system/blob/trunk/src/system/theme/generated/valet-theme-light.json). It will also generate a Dark theme version. This operation generates JSON files with the colors we need already filled in.
57
+
58
+ Once the theme is updated, the file [src/system/theme/index.js](https://github.com/Automattic/vip-design-system/blob/trunk/src/system/theme/index.js) reads the colors and apply to all components.
59
+
60
+ Use the section below to run the script and update the theme.
61
+
62
+ _Important:_ If you change the `generated/valet-theme-light.json` or the `generated/valet-theme-dark.json`, or changes will be overwritten once someone runs `npm run theme-update` again.
63
+
64
+ ### Update theme script
65
+
66
+ Run this command to update the VIP Valet Theme with the latest `tokens/**` files.
67
+
68
+ ```bash
69
+ npm run theme-update
70
+ ```
71
+
72
+ ## Feature flags
73
+
74
+ No feature flags are currently in use.
75
+
76
+ ## Database
77
+
78
+ This project has no database storage.
79
+
80
+ ## Dependencies
81
+
82
+ This is a standalone NPM package. Currently there's no API communication. All the code dependencies are listed in the [package.json](https://github.com/Automattic/vip-design-system/blob/trunk/package.json) file of this project.
83
+
84
+ Major dependencies of this project are:
85
+
86
+ - Storybook — Dev dependency for previewing our components and documentation
87
+ - Theme UI — Base theme and components structure
88
+ - Radix — React primitives components used to build some of our custom components
@@ -0,0 +1,54 @@
1
+ # Contributing
2
+
3
+ ## Pull requests & issues
4
+
5
+ We welcome any contributions to this project.
6
+
7
+ If you have a small bugfix and already have the code available, feel free to [create a pull request](https://github.com/Automattic/vip-design-system/compare). If you have a feature suggestion, please [create an issue](https://github.com/Automattic/vip-design-system/issues/new). Please follow the instructions provided. Please assign a priority to the issue/pull request according to the definitions found below.
8
+
9
+ Before writing a patch or a larger chunk of code, please ensure to study the [ARCHITECTURE.md](ARCHITECTURE.md) and [TESTING.md](TESTING.md) files. Ensure that all tests pass before asking for a review of your pull request.
10
+
11
+ ## Watching for changes
12
+
13
+ You can build it continuously so that every time you make a change, build files are automatically updated:
14
+
15
+ ```bash
16
+ npm run watch
17
+ ```
18
+
19
+ ## Troubleshooting
20
+
21
+ ### Dialog + Dropdown usage
22
+
23
+ If you are facing a Dialog overlaping a Dropdown content, add this CSS to your application:
24
+
25
+ ```css
26
+ div[data-radix-popper-content-wrapper][data-aria-hidden='true'] {
27
+ opacity: 0;
28
+ }
29
+ ```
30
+
31
+ ## Priorities
32
+
33
+ Each GitHub issue and pull request relating to this repository should have a priority label to make prioritizing easier. The definition of each priority is as follows:
34
+
35
+ - [Critical](https://github.com/Automattic/vip-design-system/labels/%5BPri%5D%20Critical): A bug currently affecting normal operation or a security problem that needs to be addressed urgently.
36
+ - [High](https://github.com/Automattic/vip-design-system/labels/%5BPri%5D%20High): An issue that is: a) relevant to current goals of the project, b) a bug that needs to addressed soon to maintain stability, or c) a feature often requested.
37
+ - [Normal](https://github.com/Automattic/vip-design-system/labels/%5BPri%5D%20Normal): Most issues belong here. These will include features less often requested, new lower priority features, documentation updates, etc.
38
+ - [Low](https://github.com/Automattic/vip-design-system/labels/%5BPri%5D%20Low): Features that are good to have belong here.
39
+
40
+ ## Type of change labels
41
+
42
+ Each GitHub issue and pull-request should have a type of change label associated with it. The definition of these are as follows:
43
+
44
+ - [In Progress](https://github.com/Automattic/vip-design-system/labels/%5BStatus%5D%20In%20Progress): You can either use a draft pull request or keep as in-progress with this label.
45
+ - [Needs Review](https://github.com/Automattic/vip-design-system/labels/%5BStatus%5D%20Needs%20Review): Marked as needs review from others.
46
+ - [Has Feedback](https://github.com/Automattic/vip-design-system/labels/%5BStatus%5D%20Has%20Feedback): If you left feedback to the Pull request, mark with this label.
47
+ - [Ready to Merge](https://github.com/Automattic/vip-design-system/labels/%5BStatus%5D%20Ready%20to%20Merge): Approved and ready to be merged.
48
+ - [Bug](https://github.com/Automattic/vip-design-system/labels/%5BType%5D%20Bug): Code change to fix a bug, or a bug report.
49
+ - [Stale](https://github.com/Automattic/vip-design-system/labels/%5BStatus%5D%20Stale): Marked as stale because it has been inactive for some period.
50
+ - [Documentation](https://github.com/Automattic/vip-design-system/labels/%5BType%5D%20Documentation): Pull request to update documentation.
51
+ - [Enhancement](https://github.com/Automattic/vip-design-system/labels/%5BType%5D%20enhancement): A general enhancement – new feature, better implementation, new tests and so forth.
52
+ - [Update dependency](https://github.com/Automattic/vip-design-system/labels/dependencies): Pull request to update one or more dependencies.
53
+ - [NPM version update](https://github.com/Automattic/vip-design-system/labels/%5B%20Type%20%5D%20NPM%20version%20update): The GitHub action bot adds this label to automated dev or package release pull requests.
54
+ - [Question](https://github.com/Automattic/vip-design-system/labels/%5BType%5D%20Question): Prefer using the GitHub issues for asking questions.
@@ -0,0 +1,70 @@
1
+ # Releasing
2
+
3
+ This package is published to [NPM](https://www.npmjs.com/package/@automattic/vip-design-system). The process to release to NPM should be started when all pull requests intended for publishing have been merged and the software has been fully tested for publication. You can release either using GitHub Actions or locally.
4
+
5
+ ## Versioning Guidelines
6
+
7
+ - `patch`: for non-breaking changes/bugfixes and small updates.
8
+ - `minor`: for some new features, bug fixes, and other non-breaking changes.
9
+ - `major`: for breaking changes.
10
+
11
+ ## Note on NPM token
12
+
13
+ Publishing via the GitHub Action requires that the `NPM_TOKEN` be set correctly in [GitHub Actions secrets](https://github.com/Automattic/vip-design-system/settings/secrets/actions). This should be an npm token generated for a bot user on [the npm @automattic org](https://www.npmjs.com/settings/automattic) that has publish access to this repo.
14
+
15
+ ## Release Methods
16
+
17
+ ### GitHub Actions (Preferred)
18
+
19
+ This is the preferred method for pushing out the latest release. The workflow runs a bunch of validations, generates a build, bump versions + tags, pushes out to npm, and bumps to the next dev version.
20
+
21
+ 1. Initiate the [release process here](https://github.com/Automattic/vip-design-system/actions/workflows/npm-prepare-release.yml).
22
+ 1. On the right-hand side, select "Run Workflow".
23
+ 1. Pick your preferred version bump.
24
+ 1. Click `Run Workflow`.
25
+ 1. Wait for a pull request to appear. The pull request will update the version number and shall be assigned to you.
26
+ 1. When ready, merge the pull request. This will lead to a new version to be [published on npmjs.com](https://www.npmjs.com/package/@automattic/vip-design-system).
27
+ 1. Another pull request will be created to bump to a development version, also assigned to you. Merge it to finish the process.
28
+
29
+ ### Local
30
+
31
+ Follow these steps to publish locally:
32
+
33
+ 1. Make sure you have NPM access to our @Automattic organization. Ask for #vip-platform-pâtisserie help in case you need it.
34
+ 2. Pull all the changes to your local `trunk` branch. Make sure you have the latest changes (`git pull`).
35
+ 3. We follow the [https://semver.org/](https://semver.org/) versioning. You should run the specific version you are trying to publish:
36
+
37
+ ```bash
38
+ npm version major|minor|patch
39
+ ```
40
+
41
+ 4. You should see a version bump in the [package.json](https://github.com/Automattic/vip-design-system/blob/trunk/package.json) file.
42
+ 5. Build the application:
43
+
44
+ ```bash
45
+ npm run build
46
+ ```
47
+
48
+ 6. Publish the application
49
+
50
+ ```bash
51
+ npm publish
52
+ ```
53
+
54
+ Note: You need to have two-factor enabled in your npm account. The publish command will request a two-factor code to complete the publishing process. You can also add `--otp=CODE` to the `npm publish` command if you already have the code.
55
+
56
+ 7. Push the tags to the repository and trunk updates.
57
+
58
+ ```bash
59
+ git push --tags
60
+ git push origin trunk
61
+ ```
62
+
63
+ 8. For major versions or breaking changes, it's recommended to [create a RELEASE](https://github.com/Automattic/vip-design-system/releases) with the published tag.
64
+
65
+ Ps: Add a `BREAKING CHANGES` section to the release. This will avoid folks trying to figure out why their code is not working on the VIP Dashboard or any other system.
66
+
67
+ ## In case of problems
68
+
69
+ If you released a broken version, ensure to inform in the GitHub release entry about the breaking change, and follow the instructions provided by NPM in: [Deprecating and undeprecating packages or package versions
70
+ ](https://docs.npmjs.com/deprecating-and-undeprecating-packages-or-package-versions).
package/docs/SETUP.md ADDED
@@ -0,0 +1,68 @@
1
+ # Setup
2
+
3
+ ## Language & requirements
4
+
5
+ - Implemented in JavaScript and TypeScript.
6
+ - Requirements are:
7
+ - Node, see version in [package.json](https://github.com/Automattic/vip-design-system/blob/trunk/package.json)
8
+ - A few NPM packages are needed, those are listed in the same file.
9
+ - The software is fairly lightweight, no special hardware requirements.
10
+ - Network access.
11
+
12
+ ## Installation & setup instructions
13
+
14
+ ### Fetching & installing
15
+
16
+ This will fetch the package and install all dependencies:
17
+
18
+ ```bash
19
+ git clone git@github.com:Automattic/vip-design-system.git && \
20
+ cd vip-design-system && npm install
21
+ ```
22
+
23
+ ### Building
24
+
25
+ This will build all TypeScript files so they can be executed:
26
+
27
+ ```bash
28
+ cd vip-design-system && \
29
+ npm run build
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ The best experience is to use Storybook preview for set up and development.
35
+
36
+ ### Starting up locally
37
+
38
+ Run:
39
+
40
+ ```bash
41
+ npm run dev
42
+ ```
43
+
44
+ You can then visit [http://localhost:60006/](http://localhost:60006/) to view.
45
+
46
+ ## Updating dependencies
47
+
48
+ Dependencies should be updated by merging [pull requests from dependabot](https://github.com/Automattic/vip-design-system/pulls/app%2Fdependabot). However, great care should be taken before merging as updating dependencies can cause errors with the `vip-design-system` components. There can also be effects to the [RELEASING](https://github.com/Automattic/vip-design-system/blob/trunk/docs/RELEASING.md) process. This can happen silently.
49
+
50
+ ### Before merging
51
+
52
+ Consider removing the dependency. Can the functionality needed from the dependency be implemented directly into `vip-design-system` or our own common libraries? If not, evaluate the following:
53
+
54
+ 1. If the dependency is one of the [development dependencies](https://github.com/Automattic/vip-design-system/blob/trunk/package.json) (`devDependencies`), and/or only used by one of those, the likelihood of customer-impacting failure is low.
55
+ 2. Is the package used in the [RELEASING](https://github.com/Automattic/vip-design-system/blob/trunk/docs/RELEASING.md) process? If it is, evaluate if any failure is likely to be silent. If that seems not to be the case, the risk of customer-impacting failure is low.
56
+ 3. Is the package used in one or more [components](https://github.com/Automattic/vip-design-system/blob/trunk/src/system)? If it is, evaluate if any failure is likely to be silent. Take a look at the [TESTING](https://github.com/Automattic/vip-design-system/blob/trunk/docs/RELEASING.md) strategies to ensure the update is good.
57
+
58
+ #### Low risk dependencies
59
+
60
+ If the risk of merging is low, you can go a head and merge without doing anything further (given that all tests succeed).
61
+
62
+ #### Higher risk dependencies
63
+
64
+ For higher risk dependencies, the jobs using the dependency [will have to be tested locally](https://github.com/Automattic/vip-design-system/blob/trunk/docs/TESTING.md#locally) and the results verified. You can [run it locally](https://github.com/Automattic/vip-design-system/blob/trunk/docs/SETUP.md#starting-up-locally) and verify that all affected components are working normally.
65
+
66
+ ### After merging
67
+
68
+ Test any [external Applications tests](https://github.com/Automattic/vip-design-system/blob/trunk/docs/TESTING.md#external-applications-tests) using the `vip-design-system` as a dependency, for example, [the VIP Dashboard](https://github.com/automattic/vip-dashboard).
@@ -0,0 +1,63 @@
1
+ # Testing
2
+
3
+ Testing is an integral part of creating new features and maintaining the software.
4
+
5
+ ## Automated testing
6
+
7
+ A [few actions](https://github.com/Automattic/vip-design-system/tree/trunk/.github/workflows) are automatically run via Github Actions when a pull request is created or updated.
8
+
9
+ ### Linting
10
+
11
+ We run the following checks:
12
+
13
+ - linting (`npm run lint`)
14
+ - format checking (`npm run format:check`)
15
+ - type checks (`npm run check-types`)
16
+
17
+ ### Dependency checks
18
+
19
+ We use the [dependaban action](https://github.com/Automattic/vip-actions/tree/trunk/dependaban) from [Automattic/vip-actions](https://github.com/Automattic/vip-actions/) to verify that no dependencies have install scripts.
20
+
21
+ ### Unit tests
22
+
23
+ The tests are located inside of of each component. For example: [src/system/Accordion/Accordion.test.tsx](https://github.com/Automattic/vip-design-system/tree/trunk/src/system/Accordion/Accordion.test.tsx).
24
+
25
+ We recommend you to write tests close to the component implementation.
26
+
27
+ #### Adding new unit tests
28
+
29
+ When creating a new component, please consider adding a new unit test. Please ensure that the file name of the test matches the file name of the job. Example: `Button.test.tsx`. Put the test in the same folder as the component.
30
+
31
+ ### Manual tests
32
+
33
+ We can test three ways:
34
+
35
+ **Storybook**
36
+
37
+ For components that include storybooks, we can run `npm run dev` to view the components in a sandbox-ed storybook environment.
38
+
39
+ **Pull Request Preview (Easy and recommended)**
40
+
41
+ Once you create a Pull request, a netlify bot will add a comment to your Pull Request with a preview link of the Storybook preview. This is helpful to share with other folks.
42
+
43
+ ### External Applications tests
44
+
45
+ **npm link (not reliable)**
46
+
47
+ 1. Run `npm link` in your checkout of this repo.
48
+ 2. Spin up a local copy of [the VIP Dashboard](https://github.com/automattic/vip-dashboard) and navigate to a page using the linked components from `@automattic/vip-design-system`
49
+
50
+ Note: it's super useful to run `npm run watch` in another process, so any changes will be almost immediately available / testable.
51
+
52
+ **Manual Github Commit (More work, but reliable)**
53
+
54
+ 1. Create your local changes and push to origin a new branch.
55
+ 2. In a local copy of the [the VIP Dashboard](https://github.com/automattic/vip-dashboard) edit the vip-design-system line inside of the `package.json` file. Change the line with this:
56
+
57
+ ```bash
58
+ "@automattic/vip-design-system": "github:automattic/vip-design-system#YOUR_PUSHED_COMMIT_HASH",
59
+ ```
60
+
61
+ 3. Run `npm install` in the vip-dashboard
62
+ 4. Run `npm run dev`
63
+ 5. You should have your changes available.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",
@@ -34,6 +34,7 @@
34
34
  "@radix-ui/react-checkbox": "^1.0.0",
35
35
  "@radix-ui/react-dialog": "^1.0.0",
36
36
  "@radix-ui/react-dropdown-menu": "^1.0.1-rc.6",
37
+ "@radix-ui/react-navigation-menu": "^1.1.4",
37
38
  "@radix-ui/react-switch": "^1.0.0",
38
39
  "@radix-ui/react-tabs": "^1.0.0",
39
40
  "@radix-ui/react-tooltip": "^1.0.0",
@@ -31,7 +31,6 @@ const inputStyle = {
31
31
  content: '""',
32
32
  border: '1px solid',
33
33
  borderColor: baseControlBorderStyle.borderColor,
34
- zIndex: 3,
35
34
  left: `${ -1 * radioPosition }px`,
36
35
  } ),
37
36
  '&:checked ~ label::after': {
@@ -54,7 +53,6 @@ const labelStyle = {
54
53
  top: 1,
55
54
  left: `${ -1 * radioPosition }px`,
56
55
  transition: 'all .3s ease-out',
57
- zIndex: 2,
58
56
  width: '16px',
59
57
  height: '16px',
60
58
  },
@@ -9,8 +9,8 @@ import type { StoryObj } from '@storybook/react';
9
9
  import { Link } from '..';
10
10
 
11
11
  export default {
12
+ title: 'Navigation/Link',
12
13
  component: Link,
13
- title: 'Link',
14
14
  };
15
15
 
16
16
  type Story = StoryObj< typeof Link >;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { StoryObj } from '@storybook/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Nav, NavItem } from '../../system';
10
+
11
+ export default {
12
+ title: 'Navigation/Nav',
13
+ component: Nav,
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: `
18
+ A navigation menu is a list of links used to navigate a website. It is usually placed in a prominent position at the top of a site, or anywhere that needs a linked-navigation.
19
+
20
+ ## Guidance
21
+
22
+ ### When to use the Nav component
23
+
24
+ - To link internal or external links in a menu format.
25
+ - To link to pages that are not part of the main navigation.
26
+
27
+ ### When to consider something else
28
+
29
+ - If you have content inside the same page that will not affect the page Route/URL, use [Tabs](/docs/tabs--docs) component instead.
30
+ - If you are planning to have buttons in your navigation, use another navigation solution, for example: [Dropdown](/docs/dropdown--docs) component instead.
31
+
32
+ ## Accessibility Considerations guidance
33
+
34
+ This component is based on the Radix Navigation Menu primitive, so it contains all the accessibility features from the primitive.
35
+
36
+ - Adheres to the [navigation role requirements.](https://www.w3.org/TR/wai-aria-1.2/#navigation)
37
+ - Keyboard Interactions: https://www.radix-ui.com/primitives/docs/components/navigation-menu#keyboard-interactions
38
+
39
+ ### Usability guidance
40
+
41
+ Pick one of the available variants: Primary or Tabs. You can use the components directly from the \`Nav\` component:
42
+
43
+ ~~~jsx filename="index.jsx"
44
+ import { Nav, NavItem } from '@automattic/components';
45
+
46
+ <Nav.Primary> or <Nav.Tab>
47
+ <NavItem.Primary> or <NavItem.Tab>
48
+ ~~~
49
+
50
+ ### Usage with Next.js framwork
51
+
52
+ ~~~jsx filename="index.jsx"
53
+ import Link from 'next/link';
54
+
55
+ <Nav.Primary label="Etc">
56
+ <NavItem.Primary
57
+ active
58
+ href="https://google.com"
59
+ asChild // This is important to pass the link styles to the child
60
+ >
61
+ <Link href={ \`/orgs/\${ id }/sso/configurations/\${ idP }/edit/\${ tab.path }\` }>
62
+ Your page name
63
+ </Link>
64
+ </NavItem.Primary>
65
+ </Nav.Primary>
66
+ ~~~
67
+
68
+ -------
69
+
70
+ ## Component Properties
71
+ `,
72
+ },
73
+ },
74
+ },
75
+ };
76
+
77
+ type Story = StoryObj< typeof Nav >;
78
+
79
+ export const Default: Story = {
80
+ render: () => (
81
+ <>
82
+ <p>
83
+ <strong>Variant: Primary</strong>
84
+ </p>
85
+ <Nav.Primary sx={ { mb: 4 } } label="Nav Primary">
86
+ <NavItem.Primary active href="#">
87
+ PHP
88
+ </NavItem.Primary>
89
+ <NavItem.Primary href="https://wordpress.com">WordPress</NavItem.Primary>
90
+ <NavItem.Primary href="htpps://newrelic.com/">New Relic</NavItem.Primary>
91
+ <NavItem.Primary disabled href="https://google.com/">
92
+ Not accessible
93
+ </NavItem.Primary>
94
+ </Nav.Primary>
95
+ </>
96
+ ),
97
+ };
98
+
99
+ export const Tab: Story = {
100
+ render: () => (
101
+ <>
102
+ <p>
103
+ <strong>Variant: Tab</strong>
104
+ </p>
105
+ <Nav.Tab sx={ { mb: 4 } } label="Nav Tab">
106
+ <NavItem.Tab active href="#">
107
+ PHP
108
+ </NavItem.Tab>
109
+ <NavItem.Tab href="https://wordpress.com">WordPress</NavItem.Tab>
110
+ <NavItem.Tab href="htpps://newrelic.com/">New Relic</NavItem.Tab>
111
+ <NavItem.Tab disabled href="https://google.com/">
112
+ Not accessible
113
+ </NavItem.Tab>
114
+ </Nav.Tab>
115
+ </>
116
+ ),
117
+ };