Debian Codegraph @

node/@patternfly/patternfly/README.md

raw
1 # PatternFly
2
3 ## Contributing
4
5 We welcome contributions to PatternFly! Please read our [Contributing Guide](https://pf-core-staging.patternfly.org/contribution) to learn how to get started, submit issues, and contribute code to the project.
6
7 ## Install
8
9 - This assumes an environment is already set up for npm packages - if not, please use npm init following the steps at [https://docs.npmjs.com/getting-started/using-a-package.json](https://docs.npmjs.com/getting-started/using-a-package.json).
10 - run `npm install @patternfly/patternfly --save`
11
12 When you install PatternFly, the package includes:
13
14 - @patternfly/patternfly/patternfly-base.css - base styles. Global styles, reset/normalize styles, global variables. These styles are required for patternfly styles to work properly.
15 - @patternfly/patternfly/patternfly.css - this is patternfly-base.css, as well as all component and layout styles. Does not include utility styles.
16 - @patternfly/patternfly/patternfly-addons.css - all utility class styles. These do not come with patternfly.css, and must be imported manually.
17 - @patternfly/patternfly/utilities/[UtilityName]/[utility-name].css - individual utility class styles if you prefer only use one or two, and don't want to import all of them.
18 - @patternfly/patternfly/patternfly-charts.css - required if using dark theme with [PatternFly charts](https://www.patternfly.org/charts/about-charts).
19
20 Any of the files above are meant for use in consuming the library. The recommended consumption approach will vary from project to project.
21
22 ## Development
23
24 **PatternFly Development requires Node v20.18.3 or greater**
25
26 To setup the PatternFly development environment:
27
28 - clone the project
29 - ensure you have Node.js v20.18.3 or greater installed
30 - enable corepack: `corepack enable`
31 - run `yarn install` from the project root
32 - run `yarn start`
33 - open your browser to `http://localhost:8001`
34
35 After working on your contribution, check for [accessibility violations](#testing-for-accessibility).
36
37 ### Create components, layouts...
38
39 To create source file scaffolding for a new component, layout, utility, or demo, run the NPM script:
40
41 `node generate <CamelName>`
42
43 Below are the full options for this script:
44
45 ```sh
46 Options:
47 -f, --folder <folder> Source folder (components, demos, layouts, or utilities) (default: "components")
48 ```
49
50 #### Examples
51
52 To create a "Test component" component (`.pf-v6-c-test-component`), run:
53
54 `node generate TestComponent`
55
56 To create a "Test layout" layout (`.pf-l-test-layout`), run:
57
58 `node generate TestLayout -f layouts`
59
60 To create 3 new demos named "Test demo", "Test demo 2", and "Test demo 3", run:
61
62 `node generate TestDemo TestDemo2 TestDemo3 -f demos`
63
64
65 #### Update screenshots
66 When making visual changes to a full page example, new example preview screenshots must be generated. To update the screenshots:
67
68 - open a terminal and run `yarn build && yarn serve`
69 - in another terminal, run `yarn screenshots`
70
71 ## Guidelines for CSS development
72
73 - For issues created in Core that will affect a component in PF-React, a follow up issue must be created in PF-React once the Pull Request is merged. The issue should include the Core PR #, the Core Release, a link to the component in https://pf-core-staging.patternfly.org, and information detailing the change.
74 - If global variables are modified in Core, a React issue should be opened to address this.
75 - CSS developers should ensure that animation is well documented and communicated to the respective React developer.
76 - Once the component/enhancement is complete it should receive sign off from a visual designer who can then update the master sketch file with any changes.
77
78 ### Contribution guide
79 For information on how to contribute, refer to our [contribution guide](https://pf-core-staging.patternfly.org/contribution).
80
81 ### Development guidelines
82 For more information on using CSS, Sass, and handlebars, refer to our [development guidelines](https://pf-core-staging.patternfly.org/guidelines).
83
84 ### Custom icon guidelines
85 For more information on custom icons, refer to our [custom icon guidelines](https://pf-core-staging.patternfly.org/custom-icons).
86
87 ## Beta components
88
89 When creating a brand new component, it should be released as beta in order to get feedback.
90
91 ## Testing for accessibility
92
93 PatternFly uses [aXe: The Accessibility Engine](https://www.deque.com/axe/) to check for accessibility violations. Our goal is to meet WCAG 2.0 AA requirements, as noted in our [Accessibility guide](https://www.patternfly.org/accessibility/patternflys-accessibility).
94
95 ### How to perform an accessibility audit with aXe
96 aXe is available as either a browser extension or npm script.
97
98 To run the a11y audit locally:
99
100 - install the latest [chromedriver](http://chromedriver.chromium.org/downloads) and ensure its available on your system `$PATH`
101 - macOS users can simply `brew cask install chromedriver`
102 - open a terminal and run `yarn build && yarn serve`
103 - in another terminal, run `yarn a11y`
104
105 The tool is configured to return WCAG 2.0 AA violations for the full page renderings of all components, layouts, utilities, and demos. The tool will provide feedback about what the violation is and a link to documentation about how to address the violation.
106
107 The same tool is also available as a browser extension for [Chrome](https://chrome.google.com/webstore/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd) and [Firefox](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/).
108
109 ### Fixing violations
110
111 Ignore the violations that aren’t related to your contribution.
112
113 Fix violations related to your contribution.
114
115 If there are violations that are not obvious how to fix, then [create an issue](https://github.com/patternfly/patternfly/issues/new) with information about the violation that was found. For example, some violations might require further discussion before they can be addressed. And some violations may not be valid and require changes to the workspace or tooling to stop flagging the violation.
116
117 If you have any suggestions about ways that we can improve how we use this tool, please let us know by opening an issue.
118
119 ## FAQ
120
121 ### CSS Variables
122 [How do I use CSS variables to customize the library?](https://pf-core-staging.patternfly.org/guidelines#variables)
123
124 ### Browser support
125 PatternFly is supported on the latest two major versions of the following browsers:
126
127 - Chrome
128 - Firefox
129 - Safari
130 - Edge
131