-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomponents.html
executable file
·322 lines (296 loc) · 18.4 KB
/
components.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!DOCTYPE html>
<html lang="en">
<head>
<title>Patternfly Web Components</title>
<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.ico">
<!-- Global CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/patternfly/3.18.1/css/patternfly.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/patternfly/3.18.1/css/patternfly-additions.min.css">
<link rel="stylesheet" href="//rawgit.com/patternfly-webcomponents/patternfly-webcomponents/master-dist/dist/css/patternfly-webcomponents.css">
<!-- Plugins CSS -->
<link rel="stylesheet" href="assets/plugins/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="assets/css/custom.css">
<link rel="stylesheet" href="assets/css/sidebar.css">
</head>
<body class="body-blue">
<header id="header">
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><img class="navbar-brand-icon" alt="brand" src="assets/images/logo-alt.svg"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Frameworks <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="angular.html">Angular</a></li>
<li><a href="angular2.html">Angular2</a></li>
<li><a href="react.html">React</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="components.html">Components<span class="sr-only">(current)</span></a></li>
<li><a href="https://github.com/patternfly-webcomponents/patternfly-webcomponents">Github</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</header>
<div class="doc-wrapper">
<div class="container">
<div id="doc-header" class="doc-header text-center">
<h1 class="doc-title">Web Components</h1>
</div>
<!--//doc-header-->
<div class="doc-body">
<div class="doc-content">
<div class="content-inner">
<!-- Overview -->
<section id="overview" class="doc-section">
<h2 class="section-title">Overview</h2>
<div class="section-block">
<p>Patternfly web components require <code>patternfly.css</code>, <code>patternfly-additions.css</code>, and
<code>patternfly-webcomponents.css</code>.
</p>
<pre class=" language-html"><code class=" language-html"><link rel="stylesheet" href="node_modules/patternfly/dist/css/patternfly.css">
<link rel="stylesheet" href="node_modules/patternfly/dist/css/patternfly-additions.css">
<link rel="stylesheet" href="node_modules/patternfly-webcomponents/dist/css/patternfly-webcomponents.css">
</code></pre>
<p>Components can be installed individually (using individual <code>*.js</code> files) or all at once (using
<code>patternfly.js</code>). You will also likely want to include the web component <a href="https://github.com/webcomponents/webcomponentsjs">polyfill</a> for better browser support.
</p>
<pre class=" language-html"><code class=" language-html"><script src="node_modules/webcomponents.js/webcomponents-lite.min.js"></script>
<script src="node_modules/patternfly-webcomponents/dist/js/patternfly.js"></script>
</code></pre>
</div>
<!--//section-block-->
</section>
<!--//doc-section-->
<!-- Alerts -->
<section id="alerts" class="doc-section">
<h2 class="section-title">Alerts</h2>
<div class="section-block">
<div class="docs-example">
<pf-alert type="success">Well done! You successfully read this important alert message. </pf-alert>
<pf-alert type="info">Heads up! This alert needs your attention, but it's not super important. </pf-alert>
<pf-alert type="warning" persistent="true">Warning! Better check yourself, you're not looking too good. </pf-alert>
<pf-alert type="danger" persistent="true" persistent-callback-fn="alert('Danger alert closed');">Danger! Something is really bad man.</pf-alert>
</div>
<pre class=" language-html"><code class=" language-html"><pf-alert type="success">Well done! You successfully read this important alert message.</pf-alert>
<pf-alert type="info">Heads up! This alert needs your attention, but it's not super important. </pf-alert>
<pf-alert type="warning" persistent="true">Warning! Better check yourself, you're not looking too good. </pf-alert>
<pf-alert type="danger" persistent="true" persistent-callback-fn="alert('Danger alert closed');">Danger! Something is really bad man.</pf-alert>
</code></pre>
</div>
<!--//section-block-->
</section>
<!--//doc-section-->
<!-- Charts -->
<section id="charts" class="doc-section">
<h2 class="section-title">Charts</h2>
<div id="utilization-bar" class="section-block">
<h3 class="block-title">Utilization Bar Chart</h3>
<p>The Utilization Bar Chart depicts the percentage utilization ratio between used and available.</p>
<div class="docs-example">
<label class="example-label-title">Default Layout</label>
<pf-utilization-bar-chart chart-title="RAM Usage" used="8" total="24" units="MB"></pf-utilization-bar-chart>
</div>
<pre class=" language-html"><code class=" language-html"><pf-utilization-bar-chart chart-title="RAM Usage" used="8" total="24" units="MB"></pf-utilization-bar-chart>
</code></pre>
<p>Thresholds can be set to indicate when warnings and errors have occurred.</p>
<div class="docs-example">
<label class="example-label-title">Thresholds</label>
<pf-utilization-bar-chart id="thresholdExample1" chart-title="RAM Usage" used="10" total="100" units="MB" threshold-warning="60"
threshold-error="85"></pf-utilization-bar-chart>
<div>Listening for Threshold Change Events: <span class="" id="thresholdChangedText"></span></div>
</div>
<pre class=" language-html"><code class=" language-html"><pf-utilization-bar-chart id="thresholdExample1" chart-title="RAM Usage" used="10" total="100" units="MB" threshold-warning="60" threshold-error="85"></pf-utilization-bar-chart>
<div>Listening for Threshold Change Events: <span class="" id="thresholdChangedText"></span></div>
</code></pre>
<pre class=" language-javascript"><code class=" language-javascript">const thresholdExample1 = document.querySelector('#thresholdExample1');
const thresholdChangedText = document.querySelector('#thresholdChangedText');
//increment the threshold
setInterval(() => {
incrementThreshold(thresholdExample1, 10);
}, 500);
function incrementThreshold(thresholdExample, increment) {
let newThreshold = parseInt(thresholdExample.getAttribute("used")) + increment;
const maxThreshold = parseInt(thresholdExample.getAttribute("total"));
if (newThreshold > maxThreshold) {
newThreshold = 5;
}
thresholdExample.setAttribute("used", newThreshold);
}
//pf-utilization-bar-chart fires 'thresholdSet' event when thresholds are met
thresholdExample1.addEventListener('thresholdSet', e => {
const threshold = e.detail.threshold;
let msg = threshold.substr(threshold.lastIndexOf('-') + 1);
if (msg === 'warning') {
msg = "Warning! You should look at this.";
thresholdChangedText.setAttribute("class", 'text-warning');
} else if (msg === 'danger') {
msg = "Danger!! Seriously, something's wrong!";
thresholdChangedText.setAttribute("class", 'text-danger');
} else if (msg === 'success') {
msg = "Whew...Everythings normal :-)";
thresholdChangedText.setAttribute("class", 'text-success');
}
thresholdChangedText.innerText = msg;
});
</code></pre>
<p>The inline layout displays a chart title and utilization titles inline.</p>
<div class="docs-example">
<label class="example-label-title">Inline Layout</label>
<pf-utilization-bar-chart id="thresholdExample2" chart-title="Disk I/O" layout="inline" used="450" total="500" units="I/Ops"
threshold-warning="60" threshold-error="85"></pf-utilization-bar-chart>
<pf-utilization-bar-chart id="thresholdExample3" chart-title="CPU Usage" layout="inline" used="350" total="500" units="MHz"
threshold-warning="60" threshold-error="85"></pf-utilization-bar-chart>
<pf-utilization-bar-chart id="thresholdExample4" chart-title="Memory" layout="inline" used="150" total="500" units="GB" threshold-warning="60"
threshold-error="85"></pf-utilization-bar-chart>
</div>
<pre class=" language-html"><code class=" language-html"><pf-utilization-bar-chart chart-title="Disk I/O" layout="inline" used="450" total="500" units="I/Ops" threshold-warning="60" threshold-error="85"></pf-utilization-bar-chart>
<pf-utilization-bar-chart chart-title="CPU Usage" layout="inline" used="350" total="500" units="MHz" threshold-warning="60" threshold-error="85"></pf-utilization-bar-chart>
<pf-utilization-bar-chart chart-title="Memory" layout="inline" used="150" total="500" units="GB" threshold-warning="60" threshold-error="85"></pf-utilization-bar-chart>
</code></pre>
</div>
<!--//section-block-->
</section>
<!--//doc-section-->
<!-- Tabs -->
<section id="tabs" class="doc-section">
<h2 class="section-title">Tabs</h2>
<div class="section-block">
<div class="docs-example">
<pf-tabs>
<pf-tab tabTitle="Cupcakes">
<p>Cupcake ipsum dolor. Sit amet topping. Jelly-o cake ice cream jujubes marshmallow cotton candy.</p>
</pf-tab>
<pf-tab tabTitle="Caramels">
<p>Candy caramels sweet roll macaroon pastry cupcake liquorice. Cookie I love topping I love cookie toffee
chocolate bar. Jelly-o sweet roll I love dessert powder.</p>
</pf-tab>
</pf-tabs>
</div>
<pre class=" language-html"><code class=" language-html"><pf-tabs>
<pf-tab tabTitle="Cupcakes">
<p>Cupcake ipsum dolor. Sit amet topping. Jelly-o cake ice cream jujubes marshmallow cotton candy.</p>
</pf-tab>
<pf-tab tabTitle="Caramels">
<p>Candy caramels sweet roll macaroon pastry cupcake liquorice. Cookie I love topping I love cookie toffee chocolate bar. Jelly-o sweet roll I love dessert powder.</p>
</pf-tab>
</pf-tabs>
</code></pre>
</div>
<!--//section-block-->
</section>
<!--//doc-section-->
<!-- Tooptils -->
<section id="tooltips" class="doc-section">
<h2 class="section-title">Tooltips</h2>
<div class="section-block">
<div class="docs-example">
<pf-tooltip id="tooltip-left" placement="left" target-selector="#btn-left">
Tooltip text on Left
</pf-tooltip>
<button id="btn-left" type="button" class="btn btn-primary btn-lg" aria-describedby="tooltip-left">Left</button>
<pf-tooltip id="tooltip-top" placement="top" target-selector="#btn-top">
Tooltip on top
</pf-tooltip>
<button id="btn-top" type="button" class="btn btn-default btn-lg" aria-describedby="tooltip-top">Top</button>
<pf-tooltip id="tooltip-bottom" placement="bottom" target-selector="#btn-bottom">
Tooltip on bottom
</pf-tooltip>
<button id="btn-bottom" type="button" class="btn btn-warning btn-lg" aria-describedby="tooltip-bottom">Bottom</button>
<pf-tooltip id="tooltip-right" placement="right" target-selector="#btn-right">
Tooltip on right
</pf-tooltip>
<button id="btn-right" type="button" class="btn btn-danger btn-lg" aria-describedby="tooltip-right">Right</button>
</div>
<pre class=" language-html"><code class=" language-html"><pf-tooltip id="tooltip-left" placement="left" target-selector="#btn-left">Tooltip text on Left</pf-tooltip>
<button id="btn-left" type="button" class="btn btn-primary btn-lg" aria-describedby="tooltip-left">Left</button>
<pf-tooltip id="tooltip-top" placement="top" target-selector="#btn-top">Tooltip on top</pf-tooltip>
<button id="btn-top" type="button" class="btn btn-default btn-lg" aria-describedby="tooltip-top">Top</button>
<pf-tooltip id="tooltip-bottom" placement="bottom" target-selector="#btn-bottom">Tooltip on bottom</pf-tooltip>
<button id="btn-bottom" type="button" class="btn btn-warning btn-lg" aria-describedby="tooltip-bottom">Bottom</button>
<pf-tooltip id="tooltip-right" placement="right" target-selector="#btn-right">Tooltip on right</pf-tooltip>
<button id="btn-right" type="button" class="btn btn-danger btn-lg" aria-describedby="tooltip-right">Right</button>
</code></pre>
</div>
<!--//section-block-->
</section>
<!--//doc-section-->
</div>
<!--//content-inner-->
</div>
<!--//doc-content-->
<div class="doc-sidebar">
<nav id="doc-nav">
<ul id="doc-menu" class="nav doc-menu hidden-xs" data-spy="affix">
<li><a class="scrollto" href="#overview">Overview</a></li>
<li><a class="scrollto" href="#alerts">Alerts</a></li>
<li>
<a class="scrollto" href="#charts">Charts</a>
<ul class="nav doc-sub-menu">
<li><a class="scrollto" href="#utilization-bar">Utilization Bar</a></li>
</ul>
<!--//nav-->
</li>
<li><a class="scrollto" href="#tabs">Tabs</a></li>
<li><a class="scrollto" href="#tooltips">Tooltips</a></li>
</ul>
<!--//doc-menu-->
</nav>
</div>
<!--//doc-sidebar-->
</div>
<!--//doc-body-->
</div>
<!--//container-->
</div>
<!--//doc-wrapper-->
<footer id="footer">
<div class="container">
<div class="row">
<div class="text-center col">
<p class="social">
<iframe src="https://ghbtns.com/github-btn.html?user=patternfly-webcomponents&repo=patternfly-webcomponents&type=star&count=true"
frameborder="0" scrolling="0" width="80" height="30px"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=patternfly-webcomponents&repo=patternfly-webcomponents&type=fork&count=true"
frameborder="0" scrolling="0" width="80" height="30px"></iframe>
</p>
</div>
</div>
</div>
</footer>
<!-- Main Javascript -->
<script src="assets/plugins/jquery-1.12.3.min.js"></script>
<script src="assets/js/prism.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-scrollTo/jquery.scrollTo.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/scripts.js"></script>
<!-- web components -->
<script src="//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.0.0/webcomponents-lite.js"></script>
<script src="//rawgit.com/webcomponents/custom-elements/master/src/native-shim.js"></script>
<script src="//rawgit.com/patternfly-webcomponents/patternfly-webcomponents/master-dist/dist/js/patternfly.js"></script>
</body>
</html>