@patternfly/react-docs 7.6.0-prerelease.8 → 7.6.0-prerelease.9
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/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/package.json +12 -11
- package/patternfly-docs/generated/components/about-modal/react.js +0 -149
- package/patternfly-docs/generated/components/accordion/react.js +0 -262
- package/patternfly-docs/generated/components/action-list/react.js +0 -144
- package/patternfly-docs/generated/components/alert/react-demos.js +0 -56
- package/patternfly-docs/generated/components/alert/react.js +0 -1433
- package/patternfly-docs/generated/components/avatar/react.js +0 -166
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +0 -60
- package/patternfly-docs/generated/components/back-to-top/react.js +0 -77
- package/patternfly-docs/generated/components/backdrop/react.js +0 -64
- package/patternfly-docs/generated/components/background-image/react.js +0 -62
- package/patternfly-docs/generated/components/badge/react.js +0 -97
- package/patternfly-docs/generated/components/banner/react-demos.js +0 -57
- package/patternfly-docs/generated/components/banner/react.js +0 -148
- package/patternfly-docs/generated/components/brand/react.js +0 -142
- package/patternfly-docs/generated/components/breadcrumb/react.js +0 -206
- package/patternfly-docs/generated/components/button/react-demos.js +0 -57
- package/patternfly-docs/generated/components/button/react.js +0 -826
- package/patternfly-docs/generated/components/card/react-demos.js +0 -201
- package/patternfly-docs/generated/components/card/react.js +0 -1015
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +0 -1350
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +0 -1334
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +0 -1282
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +0 -848
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +0 -192
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +0 -426
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +0 -804
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +0 -3230
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +0 -1178
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +0 -525
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +0 -3382
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +0 -377
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +0 -2475
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +0 -538
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +0 -1551
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +0 -4115
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +0 -955
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +0 -1173
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +0 -1166
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +0 -413
- package/patternfly-docs/generated/components/chip/react-deprecated.js +0 -323
- package/patternfly-docs/generated/components/clipboard-copy/react.js +0 -373
- package/patternfly-docs/generated/components/code-block/react.js +0 -148
- package/patternfly-docs/generated/components/code-editor/react.js +0 -659
- package/patternfly-docs/generated/components/compass/react-demos.js +0 -147
- package/patternfly-docs/generated/components/compass/react.js +0 -440
- package/patternfly-docs/generated/components/content/react.js +0 -248
- package/patternfly-docs/generated/components/data-list/react-demos.js +0 -90
- package/patternfly-docs/generated/components/data-list/react.js +0 -709
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +0 -283
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +0 -64
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +0 -83
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +0 -395
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +0 -241
- package/patternfly-docs/generated/components/description-list/react-demos.js +0 -58
- package/patternfly-docs/generated/components/description-list/react.js +0 -743
- package/patternfly-docs/generated/components/divider/react.js +0 -126
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +0 -351
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +0 -184
- package/patternfly-docs/generated/components/drag-and-drop/react.js +0 -137
- package/patternfly-docs/generated/components/drawer/react.js +0 -598
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +0 -772
- package/patternfly-docs/generated/components/dual-list-selector/react.js +0 -594
- package/patternfly-docs/generated/components/empty-state/react.js +0 -199
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +0 -65
- package/patternfly-docs/generated/components/expandable-section/react.js +0 -408
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +0 -52
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +0 -398
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +0 -749
- package/patternfly-docs/generated/components/forms/checkbox/react.js +0 -222
- package/patternfly-docs/generated/components/forms/form/react.js +0 -1106
- package/patternfly-docs/generated/components/forms/form-select/react.js +0 -208
- package/patternfly-docs/generated/components/forms/radio/react.js +0 -212
- package/patternfly-docs/generated/components/forms/text-area/react.js +0 -160
- package/patternfly-docs/generated/components/forms/text-input/react.js +0 -216
- package/patternfly-docs/generated/components/helper-text/react-demos.js +0 -180
- package/patternfly-docs/generated/components/helper-text/react.js +0 -164
- package/patternfly-docs/generated/components/hero/react.js +0 -88
- package/patternfly-docs/generated/components/hint/react.js +0 -169
- package/patternfly-docs/generated/components/icon/react.js +0 -215
- package/patternfly-docs/generated/components/input-group/react.js +0 -182
- package/patternfly-docs/generated/components/jump-links/react-demos.js +0 -154
- package/patternfly-docs/generated/components/jump-links/react.js +0 -212
- package/patternfly-docs/generated/components/label/react-demos.js +0 -57
- package/patternfly-docs/generated/components/label/react.js +0 -417
- package/patternfly-docs/generated/components/list/react.js +0 -175
- package/patternfly-docs/generated/components/login-page/react.js +0 -587
- package/patternfly-docs/generated/components/masthead/react-demos.js +0 -79
- package/patternfly-docs/generated/components/masthead/react.js +0 -291
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +0 -769
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +0 -665
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +0 -187
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +0 -163
- package/patternfly-docs/generated/components/menus/dropdown/react.js +0 -998
- package/patternfly-docs/generated/components/menus/menu/react.js +0 -1540
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +0 -747
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +0 -508
- package/patternfly-docs/generated/components/menus/select/react-templates.js +0 -257
- package/patternfly-docs/generated/components/menus/select/react.js +0 -998
- package/patternfly-docs/generated/components/modal/react-deprecated.js +0 -554
- package/patternfly-docs/generated/components/modal/react.js +0 -597
- package/patternfly-docs/generated/components/navigation/react-demos.js +0 -356
- package/patternfly-docs/generated/components/navigation/react.js +0 -409
- package/patternfly-docs/generated/components/notification-badge/react.js +0 -196
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +0 -107
- package/patternfly-docs/generated/components/notification-drawer/react.js +0 -394
- package/patternfly-docs/generated/components/number-input/react.js +0 -210
- package/patternfly-docs/generated/components/overflow-menu/react.js +0 -274
- package/patternfly-docs/generated/components/page/react-demos.js +0 -149
- package/patternfly-docs/generated/components/page/react.js +0 -1352
- package/patternfly-docs/generated/components/pagination/react.js +0 -492
- package/patternfly-docs/generated/components/panel/react.js +0 -236
- package/patternfly-docs/generated/components/popover/react.js +0 -390
- package/patternfly-docs/generated/components/progress/react-demos.js +0 -59
- package/patternfly-docs/generated/components/progress/react.js +0 -283
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +0 -45
- package/patternfly-docs/generated/components/progress-stepper/react.js +0 -219
- package/patternfly-docs/generated/components/search-input/react-demos.js +0 -113
- package/patternfly-docs/generated/components/search-input/react.js +0 -263
- package/patternfly-docs/generated/components/sidebar/react.js +0 -236
- package/patternfly-docs/generated/components/simple-list/react.js +0 -200
- package/patternfly-docs/generated/components/skeleton/react-demos.js +0 -44
- package/patternfly-docs/generated/components/skeleton/react.js +0 -122
- package/patternfly-docs/generated/components/skip-to-content/react.js +0 -73
- package/patternfly-docs/generated/components/slider/react.js +0 -309
- package/patternfly-docs/generated/components/spinner/react.js +0 -111
- package/patternfly-docs/generated/components/switch/react.js +0 -163
- package/patternfly-docs/generated/components/table/react-demos.js +0 -355
- package/patternfly-docs/generated/components/table/react-deprecated.js +0 -1350
- package/patternfly-docs/generated/components/table/react.js +0 -3241
- package/patternfly-docs/generated/components/tabs/react-demos.js +0 -108
- package/patternfly-docs/generated/components/tabs/react.js +0 -1359
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +0 -152
- package/patternfly-docs/generated/components/text-input-group/react.js +0 -278
- package/patternfly-docs/generated/components/tile/react-deprecated.js +0 -242
- package/patternfly-docs/generated/components/timestamp/react.js +0 -283
- package/patternfly-docs/generated/components/title/react.js +0 -94
- package/patternfly-docs/generated/components/toggle-group/react.js +0 -299
- package/patternfly-docs/generated/components/toolbar/react-demos.js +0 -66
- package/patternfly-docs/generated/components/toolbar/react.js +0 -932
- package/patternfly-docs/generated/components/tooltip/react.js +0 -241
- package/patternfly-docs/generated/components/tree-view/react.js +0 -429
- package/patternfly-docs/generated/components/truncate/react.js +0 -211
- package/patternfly-docs/generated/components/wizard/react-demos.js +0 -87
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +0 -788
- package/patternfly-docs/generated/components/wizard/react.js +0 -986
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +0 -285
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +0 -70
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +0 -506
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +0 -94
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +0 -272
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +0 -87
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +0 -124
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +0 -112
- package/patternfly-docs/generated/index.js +0 -1769
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +0 -78
- package/patternfly-docs/generated/patterns/filters/react-demos.js +0 -141
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +0 -51
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +0 -61
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +0 -124
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +0 -81
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
|
-
import srcImportbasic from './react/basic.png';
|
|
5
|
-
const pageData = {
|
|
6
|
-
"id": "Skip to content",
|
|
7
|
-
"section": "components",
|
|
8
|
-
"subsection": "",
|
|
9
|
-
"deprecated": false,
|
|
10
|
-
"template": false,
|
|
11
|
-
"beta": false,
|
|
12
|
-
"demo": false,
|
|
13
|
-
"newImplementationLink": false,
|
|
14
|
-
"source": "react",
|
|
15
|
-
"tabName": null,
|
|
16
|
-
"slug": "/components/skip-to-content/react",
|
|
17
|
-
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/SkipToContent/examples/SkipToContent.md",
|
|
18
|
-
"relPath": "packages/react-core/src/components/SkipToContent/examples/SkipToContent.md",
|
|
19
|
-
"propComponents": [
|
|
20
|
-
{
|
|
21
|
-
"name": "SkipToContent",
|
|
22
|
-
"description": "",
|
|
23
|
-
"props": [
|
|
24
|
-
{
|
|
25
|
-
"name": "children",
|
|
26
|
-
"type": "React.ReactNode",
|
|
27
|
-
"description": "Content to display within the skip to content component, typically a string.",
|
|
28
|
-
"defaultValue": "null"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"name": "className",
|
|
32
|
-
"type": "string",
|
|
33
|
-
"description": "Additional styles to apply to the skip to content component.",
|
|
34
|
-
"defaultValue": "''"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "href",
|
|
38
|
-
"type": "string",
|
|
39
|
-
"description": "The skip to content link.",
|
|
40
|
-
"required": true
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"cssPrefix": [
|
|
46
|
-
"pf-v6-c-skip-to-content"
|
|
47
|
-
],
|
|
48
|
-
"fullscreenExamples": [
|
|
49
|
-
"Basic"
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
pageData.liveContext = {
|
|
53
|
-
Fragment
|
|
54
|
-
};
|
|
55
|
-
pageData.examples = {
|
|
56
|
-
'Basic': props =>
|
|
57
|
-
<Example {...pageData} {...props} thumbnail={srcImportbasic} {...{"code":"import { Fragment } from 'react';\nimport { Content, SkipToContent } from '@patternfly/react-core';\n\nexport const SkipToContentBasic: React.FunctionComponent = () => {\n const mainContentId = 'main-content';\n const handleClick = (e) => {\n e.preventDefault();\n const mainContentElement = document.getElementById(mainContentId);\n if (mainContentElement) {\n mainContentElement.focus();\n mainContentElement.scrollIntoView();\n }\n };\n\n return (\n <Fragment>\n <SkipToContent onClick={handleClick} href={`#${mainContentId}`}>\n Skip to content\n </SkipToContent>\n <p>Press tab to skip to content at the bottom of the page.</p>\n <div style={{ height: '2000px' }}></div>\n <div tabIndex={-1} id={mainContentId}>\n <Content>\n <h1>Main content</h1>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan, metus ultrices eleifend gravida,\n nulla nunc varius lectus, nec rutrum justo nibh eu lectus. Ut vulputate semper dui. Fusce erat odio,\n sollicitudin vel erat vel, interdum mattis neque. Sub works as well!\n </p>\n <h2>Second level</h2>\n <p>\n Curabitur accumsan turpis pharetra\n <strong>augue tincidunt</strong> blandit. Quisque condimentum maximus mi, sit amet commodo arcu rutrum id.\n Proin pretium urna vel cursus venenatis. Suspendisse potenti. Etiam mattis sem rhoncus lacus dapibus\n facilisis. Donec at dignissim dui. Ut et neque nisl.\n </p>\n <ul>\n <li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>\n <li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>\n <li>\n Aliquam nec felis in sapien venenatis viverra fermentum nec lectus.\n <ul>\n <li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>\n <li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>\n <li>\n Ut venenatis, nisl scelerisque.\n <ol>\n <li>Donec blandit a lorem id convallis.</li>\n <li>Cras gravida arcu at diam gravida gravida.</li>\n <li>Integer in volutpat libero.</li>\n </ol>\n </li>\n </ul>\n </li>\n <li>Ut non enim metus.</li>\n </ul>\n <h3>Third level</h3>\n <p>\n Quisque ante lacus, malesuada ac auctor vitae, congue\n <a href=\"#\">non ante</a>. Phasellus lacus ex, semper ac tortor nec, fringilla condimentum orci. Fusce eu\n rutrum tellus.\n </p>\n <ol>\n <li>Donec blandit a lorem id convallis.</li>\n <li>Cras gravida arcu at diam gravida gravida.</li>\n <li>Integer in volutpat libero.</li>\n <li>Donec a diam tellus.</li>\n <li>\n Etiam auctor nisl et.\n <ul>\n <li>Donec blandit a lorem id convallis.</li>\n <li>Cras gravida arcu at diam gravida gravida.</li>\n <li>\n Integer in volutpat libero.\n <ol>\n <li>Donec blandit a lorem id convallis.</li>\n <li>Cras gravida arcu at diam gravida gravida.</li>\n </ol>\n </li>\n </ul>\n </li>\n <li>Aenean nec tortor orci.</li>\n <li>Quisque aliquam cursus urna, non bibendum massa viverra eget.</li>\n <li>Vivamus maximus ultricies pulvinar.</li>\n </ol>\n <blockquote>\n Ut venenatis, nisl scelerisque sollicitudin fermentum, quam libero hendrerit ipsum, ut blandit est tellus\n sit amet turpis.\n </blockquote>\n <p>\n Quisque at semper enim, eu hendrerit odio. Etiam auctor nisl et\n <em>justo sodales</em> elementum. Maecenas ultrices lacus quis neque consectetur, et lobortis nisi molestie.\n </p>\n <hr />\n <p>\n Sed sagittis enim ac tortor maximus rutrum. Nulla facilisi. Donec mattis vulputate risus in luctus. Maecenas\n vestibulum interdum commodo.\n </p>\n <dl>\n <dt>Web</dt>\n <dd>The part of the internet that contains websites and web pages</dd>\n <dt>HTML</dt>\n <dd>A markup language for creating web pages</dd>\n <dt>CSS</dt>\n <dd>A technology to make HTML look better</dd>\n </dl>\n <p>\n Suspendisse egestas sapien non felis placerat elementum. Morbi tortor nisl, suscipit sed mi sit amet, mollis\n malesuada nulla. Nulla facilisi. Nullam ac erat ante.\n </p>\n <h4>Fourth level</h4>\n <p>\n Nulla efficitur eleifend nisi, sit amet bibendum sapien fringilla ac. Mauris euismod metus a tellus laoreet,\n at elementum ex efficitur.\n </p>\n <p>\n Maecenas eleifend sollicitudin dui, faucibus sollicitudin augue cursus non. Ut finibus eleifend arcu ut\n vehicula. Mauris eu est maximus est porta condimentum in eu justo. Nulla id iaculis sapien.\n </p>\n <small>Sometimes you need small text to display things like date created</small>\n <p>\n Phasellus porttitor enim id metus volutpat ultricies. Ut nisi nunc, blandit sed dapibus at, vestibulum in\n felis. Etiam iaculis lorem ac nibh bibendum rhoncus. Nam interdum efficitur ligula sit amet ullamcorper.\n Etiam tristique, leo vitae porta faucibus, mi lacus laoreet metus, at cursus leo est vel tellus. Sed ac\n posuere est. Nunc ultricies nunc neque, vitae ultricies ex sodales quis. Aliquam eu nibh in libero accumsan\n pulvinar. Nullam nec nisl placerat, pretium metus vel, euismod ipsum. Proin tempor cursus nisl vel\n condimentum. Nam pharetra varius metus non pellentesque.\n </p>\n <h5>Fifth level</h5>\n <p>\n Aliquam sagittis rhoncus vulputate. Cras non luctus sem, sed tincidunt ligula. Vestibulum at nunc elit.\n Praesent aliquet ligula mi, in luctus elit volutpat porta. Phasellus molestie diam vel nisi sodales, a\n eleifend augue laoreet. Sed nec eleifend justo. Nam et sollicitudin odio.\n </p>\n <h6>Sixth level</h6>\n <p>\n Cras in nibh lacinia, venenatis nisi et, auctor urna. Donec pulvinar lacus sed diam dignissim, ut eleifend\n eros accumsan. Phasellus non tortor eros. Ut sed rutrum lacus. Etiam purus nunc, scelerisque quis enim\n vitae, malesuada ultrices turpis. Nunc vitae maximus purus, nec consectetur dui. Suspendisse euismod, elit\n vel rutrum commodo, ipsum tortor maximus dui, sed varius sapien odio vitae est. Etiam at cursus metus.\n </p>\n </Content>\n </div>\n </Fragment>\n );\n};\n","title":"Basic","lang":"ts","isFullscreen":true,"className":""}}>
|
|
58
|
-
|
|
59
|
-
</Example>
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const Component = () => (
|
|
63
|
-
<React.Fragment>
|
|
64
|
-
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
65
|
-
{`Examples`}
|
|
66
|
-
</AutoLinkHeader>
|
|
67
|
-
{React.createElement(pageData.examples["Basic"])}
|
|
68
|
-
</React.Fragment>
|
|
69
|
-
);
|
|
70
|
-
Component.displayName = 'ComponentsSkipToContentReactDocs';
|
|
71
|
-
Component.pageData = pageData;
|
|
72
|
-
|
|
73
|
-
export default Component;
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { Slider, Button, Content, ContentVariants } from '@patternfly/react-core';
|
|
5
|
-
import MinusIcon from '@patternfly/react-icons/dist/esm/icons/minus-icon';
|
|
6
|
-
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
|
|
7
|
-
import LockIcon from '@patternfly/react-icons/dist/esm/icons/lock-icon';
|
|
8
|
-
import LockOpenIcon from '@patternfly/react-icons/dist/esm/icons/lock-open-icon';
|
|
9
|
-
const pageData = {
|
|
10
|
-
"id": "Slider",
|
|
11
|
-
"section": "components",
|
|
12
|
-
"subsection": "",
|
|
13
|
-
"deprecated": false,
|
|
14
|
-
"template": false,
|
|
15
|
-
"beta": false,
|
|
16
|
-
"demo": false,
|
|
17
|
-
"newImplementationLink": false,
|
|
18
|
-
"source": "react",
|
|
19
|
-
"tabName": null,
|
|
20
|
-
"slug": "/components/slider/react",
|
|
21
|
-
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Slider/examples/Slider.md",
|
|
22
|
-
"relPath": "packages/react-core/src/components/Slider/examples/Slider.md",
|
|
23
|
-
"propComponents": [
|
|
24
|
-
{
|
|
25
|
-
"name": "Slider",
|
|
26
|
-
"description": "The main slider component.",
|
|
27
|
-
"props": [
|
|
28
|
-
{
|
|
29
|
-
"name": "areCustomStepsContinuous",
|
|
30
|
-
"type": "boolean",
|
|
31
|
-
"description": "Flag indicating if the slider is discrete for custom steps. This will cause the slider\nto snap to the closest value.",
|
|
32
|
-
"defaultValue": "false"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "aria-describedby",
|
|
36
|
-
"type": "string",
|
|
37
|
-
"description": "One or more id's to use for the slider thumb's accessible description."
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "aria-labelledby",
|
|
41
|
-
"type": "string",
|
|
42
|
-
"description": "One or more id's to use for the slider thumb's accessible label."
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"name": "className",
|
|
46
|
-
"type": "string",
|
|
47
|
-
"description": "Additional classes added to the slider."
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "customSteps",
|
|
51
|
-
"type": "SliderStepObject[]",
|
|
52
|
-
"description": "Array of custom slider step objects (value and label of each step) for the slider."
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"name": "endActions",
|
|
56
|
-
"type": "React.ReactNode",
|
|
57
|
-
"description": "Actions placed at the end of the slider."
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"name": "hasTooltipOverThumb",
|
|
61
|
-
"type": "boolean",
|
|
62
|
-
"description": "",
|
|
63
|
-
"defaultValue": "false"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"name": "inputAriaLabel",
|
|
67
|
-
"type": "string",
|
|
68
|
-
"description": "Accessible label for the input field.",
|
|
69
|
-
"defaultValue": "'Slider value input'"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"name": "inputLabel",
|
|
73
|
-
"type": "string | number",
|
|
74
|
-
"description": "Text label that is place after the input field."
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"name": "inputPosition",
|
|
78
|
-
"type": "'aboveThumb' | 'right' | 'end'",
|
|
79
|
-
"description": "Position of the input. Note \"right\" is deprecated. Use \"end\" instead",
|
|
80
|
-
"defaultValue": "'end'"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"name": "inputValue",
|
|
84
|
-
"type": "number",
|
|
85
|
-
"description": "Value displayed in the input field.",
|
|
86
|
-
"defaultValue": "0"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"name": "isDisabled",
|
|
90
|
-
"type": "boolean",
|
|
91
|
-
"description": "Adds disabled styling, and disables the slider and the input component if present.",
|
|
92
|
-
"defaultValue": "false"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"name": "isInputVisible",
|
|
96
|
-
"type": "boolean",
|
|
97
|
-
"description": "Flag to show value input field.",
|
|
98
|
-
"defaultValue": "false"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"name": "leftActions",
|
|
102
|
-
"type": "React.ReactNode",
|
|
103
|
-
"description": "Use startActions instead. Actions placed at the start of the slider.",
|
|
104
|
-
"deprecated": true
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"name": "max",
|
|
108
|
-
"type": "number",
|
|
109
|
-
"description": "The maximum permitted value.",
|
|
110
|
-
"defaultValue": "100"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"name": "min",
|
|
114
|
-
"type": "number",
|
|
115
|
-
"description": "The minimum permitted value.",
|
|
116
|
-
"defaultValue": "0"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"name": "onChange",
|
|
120
|
-
"type": "(\n event: SliderOnChangeEvent,\n value: number,\n inputValue?: number,\n setLocalInputValue?: React.Dispatch<React.SetStateAction<number>>\n) => void",
|
|
121
|
-
"description": "Value change callback. This is called when the slider value changes."
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"name": "rightActions",
|
|
125
|
-
"type": "React.ReactNode",
|
|
126
|
-
"description": "Use endActions instead. Actions placed to the right of the slider.",
|
|
127
|
-
"deprecated": true
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "showBoundaries",
|
|
131
|
-
"type": "boolean",
|
|
132
|
-
"description": "Flag to indicate if boundaries should be shown for slider that does not have custom steps.",
|
|
133
|
-
"defaultValue": "true"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"name": "showTicks",
|
|
137
|
-
"type": "boolean",
|
|
138
|
-
"description": "Flag to indicate if ticks should be shown for slider that does not have custom steps.",
|
|
139
|
-
"defaultValue": "false"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"name": "startActions",
|
|
143
|
-
"type": "React.ReactNode",
|
|
144
|
-
"description": "Actions placed at the start of the slider."
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"name": "step",
|
|
148
|
-
"type": "number",
|
|
149
|
-
"description": "The step interval.",
|
|
150
|
-
"defaultValue": "1"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
"name": "thumbAriaLabel",
|
|
154
|
-
"type": "string",
|
|
155
|
-
"description": "",
|
|
156
|
-
"defaultValue": "'Value'"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"name": "value",
|
|
160
|
-
"type": "number",
|
|
161
|
-
"description": "Current value of the slider.",
|
|
162
|
-
"defaultValue": "0"
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"name": "SliderStepObject",
|
|
168
|
-
"description": "Properties for creating custom steps in a slider. These properties should be passed in as\nan object within an array to the slider component's customSteps property.",
|
|
169
|
-
"props": [
|
|
170
|
-
{
|
|
171
|
-
"name": "isLabelHidden",
|
|
172
|
-
"type": "boolean",
|
|
173
|
-
"description": "Flag to hide the label."
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"name": "label",
|
|
177
|
-
"type": "string",
|
|
178
|
-
"description": "The display label for the step value. This is also used for the aria-valuetext attribute.",
|
|
179
|
-
"required": true
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"name": "value",
|
|
183
|
-
"type": "number",
|
|
184
|
-
"description": "Value of the step. This value is a percentage of the slider where the tick is drawn.",
|
|
185
|
-
"required": true
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
],
|
|
190
|
-
"cssPrefix": [
|
|
191
|
-
"pf-v6-c-slider"
|
|
192
|
-
],
|
|
193
|
-
"examples": [
|
|
194
|
-
"Discrete",
|
|
195
|
-
"Continuous",
|
|
196
|
-
"Value input",
|
|
197
|
-
"Thumb value input",
|
|
198
|
-
"Actions",
|
|
199
|
-
"Disabled"
|
|
200
|
-
]
|
|
201
|
-
};
|
|
202
|
-
pageData.liveContext = {
|
|
203
|
-
useState,
|
|
204
|
-
Slider,
|
|
205
|
-
Button,
|
|
206
|
-
Content,
|
|
207
|
-
ContentVariants,
|
|
208
|
-
MinusIcon,
|
|
209
|
-
PlusIcon,
|
|
210
|
-
LockIcon,
|
|
211
|
-
LockOpenIcon
|
|
212
|
-
};
|
|
213
|
-
pageData.examples = {
|
|
214
|
-
'Discrete': props =>
|
|
215
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Slider, SliderOnChangeEvent, Content } from '@patternfly/react-core';\n\nexport const SliderDiscrete: React.FunctionComponent = () => {\n const initialValues = {\n value1: 50,\n value2: 50,\n value3: 25,\n value4: 50,\n value5: 50,\n value6: 3,\n value7: 25\n };\n\n const [numValue, setNumValue] = useState(initialValues);\n\n const handleChange = (value: number, name: string) => {\n setNumValue({ ...numValue, [name]: value });\n };\n\n const steps = [\n { value: 0, label: '0' },\n { value: 12.5, label: '1', isLabelHidden: true },\n { value: 25, label: '2' },\n { value: 37.5, label: '3', isLabelHidden: true },\n { value: 50, label: '4' },\n { value: 62.5, label: '5', isLabelHidden: true },\n { value: 75, label: '6' },\n { value: 87.5, label: '7', isLabelHidden: true },\n { value: 100, label: '8' }\n ];\n\n const stepsDiscreteWithMax = [\n { value: 0, label: 'A' },\n { value: 1, label: 'B' },\n { value: 2, label: 'C' },\n { value: 3, label: 'D' },\n { value: 4, label: 'E' },\n { value: 5, label: 'F' }\n ];\n\n const stepsDiscreteNoLinearWithMaxMin = [\n { value: 12, label: '12' },\n { value: 15, label: '15' },\n { value: 25, label: '25' },\n { value: 54, label: '54' },\n { value: 67, label: '67' },\n { value: 86, label: '86' }\n ];\n\n return (\n <>\n <Content component=\"h3\">Slider value is: {numValue.value1}</Content>\n <Slider\n value={initialValues.value1}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value1')}\n customSteps={steps}\n />\n <br />\n <Content component=\"h3\">Slider value is: {numValue.value2}</Content>\n <Content component=\"small\">(min = 0, max = 200, step = 50) </Content>\n <Slider\n value={initialValues.value2}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value2')}\n max={200}\n step={50}\n showTicks\n />\n <br />\n <Content component=\"h3\">Slider value is: {Math.floor(numValue.value3)}</Content>\n <Content component=\"small\">(min = -25, max = 75, step = 10, boundaries not shown) </Content>\n <Slider\n value={initialValues.value3}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value3')}\n min={-25}\n max={75}\n step={10}\n showTicks\n showBoundaries={false}\n />\n <br />\n <Content component=\"h3\">Slider value is: {Math.floor(numValue.value4)}</Content>\n <Content component=\"small\">(min = -25, max = 75, step = 10, boundaries shown) </Content>\n <Slider\n value={initialValues.value4}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value4')}\n min={-25}\n max={75}\n step={10}\n showTicks\n />\n <br />\n <Content component=\"h3\">Slider value is: {Math.floor(numValue.value5)}</Content>\n <Content component=\"small\">(min = -25, max = 75, step = 10, boundaries shown, ticks not shown) </Content>\n <Slider\n value={initialValues.value5}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value5')}\n min={-25}\n max={75}\n step={10}\n />\n <br />\n <Content component=\"h3\">Slider value is: {Math.floor(numValue.value6)}</Content>\n <Content component=\"small\">(max = 5, custom steps) </Content>\n <Slider\n value={initialValues.value6}\n showTicks\n max={5}\n customSteps={stepsDiscreteWithMax}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value6')}\n />\n <br />\n <Content component=\"h3\">Slider value is: {Math.floor(numValue.value7)}</Content>\n <Content component=\"small\">(min = 12, max = 86, custom steps with non linear data) </Content>\n <Slider\n value={initialValues.value7}\n showTicks\n customSteps={stepsDiscreteNoLinearWithMaxMin}\n onChange={(_event: SliderOnChangeEvent, value: number) => handleChange(value, 'value7')}\n min={12}\n max={86}\n />\n <br />\n </>\n );\n};\n","title":"Discrete","lang":"ts","className":""}}>
|
|
216
|
-
|
|
217
|
-
</Example>,
|
|
218
|
-
'Continuous': props =>
|
|
219
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Checkbox, Slider, SliderOnChangeEvent, Content } from '@patternfly/react-core';\n\nexport const SliderContinuous: React.FunctionComponent = () => {\n const [hasTooltipOverThumb, setHasTooltipOverThumb] = useState(false);\n const [value, setValue] = useState(50);\n const [valueCustom, setValueCustom] = useState(50);\n\n return (\n <>\n <Checkbox\n id=\"thumb-has-tooltip\"\n label=\"hasTooltipOverThumb\"\n isChecked={hasTooltipOverThumb}\n onChange={(_event: React.FormEvent<HTMLInputElement>, checked: boolean) => setHasTooltipOverThumb(checked)}\n style={{ marginBottom: 20 }}\n />\n <Content component=\"h3\">Slider Value is: {value}</Content>\n <Slider\n hasTooltipOverThumb={hasTooltipOverThumb}\n value={value}\n onChange={(_event: SliderOnChangeEvent, value: number) => setValue(value)}\n />\n <br />\n <Content component=\"h3\">Slider value is: {valueCustom}</Content>\n <Slider\n onChange={(_event: SliderOnChangeEvent, value: number) => setValueCustom(value)}\n value={valueCustom}\n areCustomStepsContinuous\n hasTooltipOverThumb={hasTooltipOverThumb}\n customSteps={[\n { value: 0, label: '0%' },\n { value: 100, label: '100%' }\n ]}\n />\n </>\n );\n};\n","title":"Continuous","lang":"ts","className":""}}>
|
|
220
|
-
|
|
221
|
-
</Example>,
|
|
222
|
-
'Value input': props =>
|
|
223
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Slider, SliderOnChangeEvent } from '@patternfly/react-core';\n\nexport const SliderValueInput: React.FunctionComponent = () => {\n const [valueDiscrete, setValueDiscrete] = useState(62.5);\n const [inputValueDiscrete, setInputValueDiscrete] = useState(5);\n const [valuePercent, setValuePercent] = useState(50);\n const [inputValuePercent, setInputValuePercent] = useState(50);\n const [valueContinuous, setValueContinuous] = useState(50);\n const [inputValueContinuous, setInputValueContinuous] = useState(50);\n\n const stepsDiscrete = [\n { value: 0, label: '0' },\n { value: 12.5, label: '1', isLabelHidden: true },\n { value: 25, label: '2' },\n { value: 37.5, label: '3', isLabelHidden: true },\n { value: 50, label: '4' },\n { value: 62.5, label: '5', isLabelHidden: true },\n { value: 75, label: '6' },\n { value: 87.5, label: '7', isLabelHidden: true },\n { value: 100, label: '8' }\n ];\n const stepsPercent = [\n { value: 0, label: '0%' },\n { value: 25, label: '25%', isLabelHidden: true },\n { value: 50, label: '50%' },\n { value: 75, label: '75%', isLabelHidden: true },\n { value: 100, label: '100%' }\n ];\n\n const onChangeDiscrete = (\n _event: SliderOnChangeEvent,\n value: number,\n inputValue: number,\n setLocalInputValue: React.Dispatch<React.SetStateAction<number>>\n ) => {\n let newValue;\n let newInputValue;\n\n if (inputValue === undefined) {\n const step = stepsDiscrete.find((step) => step.value === value);\n newInputValue = step ? step.label : 0;\n newInputValue = Number(newInputValue);\n newValue = value;\n } else {\n const maxValue = Number(stepsDiscrete[stepsDiscrete.length - 1].label);\n if (inputValue > maxValue) {\n newValue = Number(stepsDiscrete[stepsDiscrete.length - 1].value);\n newInputValue = maxValue;\n setLocalInputValue(maxValue);\n } else {\n const minValue = Number(stepsDiscrete[0].label);\n if (inputValue < minValue) {\n newValue = Number(stepsDiscrete[0].value);\n newInputValue = minValue;\n setLocalInputValue(minValue);\n } else {\n const stepIndex = stepsDiscrete.findIndex((step) => Number(step.label) >= inputValue);\n if (Number(stepsDiscrete[stepIndex].label) === inputValue) {\n newValue = stepsDiscrete[stepIndex].value;\n newInputValue = inputValue;\n } else {\n const midpoint = (Number(stepsDiscrete[stepIndex].label) + Number(stepsDiscrete[stepIndex - 1].label)) / 2;\n if (midpoint > inputValue) {\n newValue = stepsDiscrete[stepIndex - 1].value;\n newInputValue = Number(stepsDiscrete[stepIndex - 1].label);\n } else {\n newValue = stepsDiscrete[stepIndex].value;\n newInputValue = Number(stepsDiscrete[stepIndex].label);\n }\n }\n }\n }\n }\n\n setInputValueDiscrete(newInputValue);\n setValueDiscrete(newValue);\n };\n\n const onChangePercent = (\n _event: SliderOnChangeEvent,\n value: number,\n inputValue: number,\n setLocalInputValue: React.Dispatch<React.SetStateAction<number>>\n ) => {\n let newValue;\n let newInputValue;\n\n if (inputValue === undefined) {\n const step = stepsPercent.find((step) => step.value === value);\n newInputValue = step ? step.label.slice(0, -1) : 0;\n newInputValue = Number(newInputValue);\n newValue = value;\n } else {\n const maxValue = Number(stepsPercent[stepsPercent.length - 1].label.slice(0, -1));\n if (inputValue > maxValue) {\n newValue = Number(stepsPercent[stepsPercent.length - 1].value);\n newInputValue = maxValue;\n setLocalInputValue(maxValue);\n } else {\n const minValue = Number(stepsPercent[0].label.slice(0, -1));\n if (inputValue < minValue) {\n newValue = minValue;\n setLocalInputValue(minValue);\n } else {\n const stepIndex = stepsPercent.findIndex((step) => Number(step.label.slice(0, -1)) >= inputValue);\n if (Number(stepsPercent[stepIndex].label.slice(0, -1)) === inputValue) {\n newValue = stepsPercent[stepIndex].value;\n newInputValue = inputValue;\n } else {\n const midpoint =\n (Number(stepsPercent[stepIndex].label.slice(0, -1)) +\n Number(stepsPercent[stepIndex - 1].label.slice(0, -1))) /\n 2;\n if (midpoint > inputValue) {\n newValue = stepsPercent[stepIndex - 1].value;\n newInputValue = Number(stepsPercent[stepIndex - 1].label.slice(0, -1));\n } else {\n newValue = stepsPercent[stepIndex].value;\n newInputValue = Number(stepsPercent[stepIndex].label.slice(0, -1));\n }\n }\n }\n }\n }\n\n setInputValuePercent(newInputValue);\n setValuePercent(newValue);\n };\n\n const onChangeContinuous = (\n _event: SliderOnChangeEvent,\n value: number,\n inputValue: number,\n setLocalInputValue: React.Dispatch<React.SetStateAction<number>>\n ) => {\n let newValue;\n if (inputValue === undefined) {\n newValue = Math.floor(value);\n } else {\n if (inputValue > 100) {\n newValue = 100;\n setLocalInputValue(100);\n } else if (inputValue < 0) {\n newValue = 0;\n setLocalInputValue(0);\n } else {\n newValue = Math.floor(inputValue);\n }\n }\n setInputValueContinuous(newValue);\n setValueContinuous(newValue);\n };\n\n return (\n <>\n <Slider\n value={valueDiscrete}\n isInputVisible\n inputValue={inputValueDiscrete}\n customSteps={stepsDiscrete}\n onChange={onChangeDiscrete}\n />\n <br />\n <Slider\n value={valuePercent}\n isInputVisible\n inputValue={inputValuePercent}\n inputLabel=\"%\"\n onChange={onChangePercent}\n customSteps={stepsPercent}\n />\n <br />\n <Slider\n value={valueContinuous}\n isInputVisible\n inputValue={inputValueContinuous}\n inputLabel=\"%\"\n onChange={onChangeContinuous}\n />\n </>\n );\n};\n","title":"Value input","lang":"ts","className":""}}>
|
|
224
|
-
|
|
225
|
-
</Example>,
|
|
226
|
-
'Thumb value input': props =>
|
|
227
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Slider, SliderOnChangeEvent } from '@patternfly/react-core';\n\nexport const SliderThumbValueInput: React.FunctionComponent = () => {\n const [value, setValue] = useState(50);\n const [inputValue, setInputValue] = useState(50);\n\n const onChange = (\n _event: SliderOnChangeEvent,\n value: number,\n inputValue: number,\n setLocalInputValue: React.Dispatch<React.SetStateAction<number>>\n ) => {\n let newValue;\n if (inputValue === undefined) {\n newValue = Number(value);\n } else {\n if (inputValue > 100) {\n newValue = 100;\n setLocalInputValue(100);\n } else if (inputValue < 0) {\n newValue = 0;\n setLocalInputValue(0);\n } else {\n newValue = Math.floor(inputValue);\n }\n }\n setValue(newValue);\n setInputValue(newValue);\n };\n\n return (\n <Slider\n value={value}\n isInputVisible\n inputValue={inputValue}\n inputLabel=\"%\"\n inputPosition=\"aboveThumb\"\n onChange={onChange}\n />\n );\n};\n","title":"Thumb value input","lang":"ts","className":""}}>
|
|
228
|
-
|
|
229
|
-
</Example>,
|
|
230
|
-
'Actions': props =>
|
|
231
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Slider, SliderOnChangeEvent, Button, Content } from '@patternfly/react-core';\nimport MinusIcon from '@patternfly/react-icons/dist/esm/icons/minus-icon';\nimport PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';\nimport LockIcon from '@patternfly/react-icons/dist/esm/icons/lock-icon';\nimport LockOpenIcon from '@patternfly/react-icons/dist/esm/icons/lock-open-icon';\n\nexport const SliderActions: React.FunctionComponent = () => {\n const [value1, setValue1] = useState(50);\n const [value2, setValue2] = useState(50);\n const [inputValue, setInputValue] = useState(50);\n const [isDisabled, setIsDisabled] = useState(false);\n\n const onChange1 = (_event: SliderOnChangeEvent, value: number) => {\n setValue1(Math.floor(Number(value)));\n };\n\n const onChange2 = (\n _event: SliderOnChangeEvent,\n value: number,\n inputValue: number,\n setLocalInputValue: React.Dispatch<React.SetStateAction<number>>\n ) => {\n let newValue;\n if (inputValue === undefined) {\n newValue = Math.floor(Number(value));\n } else {\n if (inputValue > 100) {\n newValue = 100;\n setLocalInputValue(100);\n } else if (inputValue < 0) {\n newValue = 0;\n setLocalInputValue(0);\n } else {\n newValue = Math.floor(inputValue);\n }\n }\n setValue2(newValue);\n setInputValue(newValue);\n };\n\n const onMinusClick = () => {\n const newValue = value1 - 1;\n if (newValue >= 0) {\n setValue1(newValue);\n }\n };\n\n const onPlusClick = () => {\n const newValue = value1 + 1;\n if (newValue <= 100) {\n setValue1(newValue);\n }\n };\n\n const buildAction = (isDisabled: boolean) => (\n <Button\n variant=\"plain\"\n aria-label={isDisabled ? 'Lock' : 'Unlock'}\n onClick={() => setIsDisabled(!isDisabled)}\n icon={isDisabled ? <LockIcon /> : <LockOpenIcon />}\n />\n );\n\n return (\n <>\n <Content component=\"h3\">Slider value is: {value1}</Content>\n <Slider\n value={value1}\n onChange={onChange1}\n startActions={<Button variant=\"plain\" aria-label=\"Minus\" onClick={onMinusClick} icon={<MinusIcon />} />}\n endActions={<Button variant=\"plain\" aria-label=\"Plus\" onClick={onPlusClick} icon={<PlusIcon />} />}\n />\n <br />\n <br />\n <Slider\n value={value2}\n inputValue={inputValue}\n onChange={onChange2}\n inputLabel=\"%\"\n isInputVisible\n isDisabled={isDisabled}\n endActions={buildAction(isDisabled)}\n />\n </>\n );\n};\n","title":"Actions","lang":"ts","className":""}}>
|
|
232
|
-
|
|
233
|
-
</Example>,
|
|
234
|
-
'Disabled': props =>
|
|
235
|
-
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Slider, SliderOnChangeEvent, Content } from '@patternfly/react-core';\n\nexport const SliderDisabled: React.FunctionComponent = () => {\n const [value, setValue] = useState(50);\n const steps = [\n { value: 0, label: '0' },\n { value: 12.5, label: '1', isLabelHidden: true },\n { value: 25, label: '2' },\n { value: 37.5, label: '3', isLabelHidden: true },\n { value: 50, label: '4' },\n { value: 62.5, label: '5', isLabelHidden: true },\n { value: 75, label: '6' },\n { value: 87.5, label: '7', isLabelHidden: true },\n { value: 100, label: '8' }\n ];\n\n const displayValue = () => {\n const step = steps.find((step) => step.value === value);\n return step ? step.label : 0;\n };\n\n return (\n <>\n <Content component=\"h3\">Slider value is: {displayValue()}</Content>\n <Slider\n isDisabled\n value={value}\n onChange={(_event: SliderOnChangeEvent, value: number) => setValue(value)}\n customSteps={steps}\n />\n </>\n );\n};\n","title":"Disabled","lang":"ts","className":""}}>
|
|
236
|
-
|
|
237
|
-
</Example>
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const Component = () => (
|
|
241
|
-
<React.Fragment>
|
|
242
|
-
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
243
|
-
{`Examples`}
|
|
244
|
-
</AutoLinkHeader>
|
|
245
|
-
{React.createElement(pageData.examples["Discrete"])}
|
|
246
|
-
{React.createElement(pageData.examples["Continuous"])}
|
|
247
|
-
{React.createElement(pageData.examples["Value input"])}
|
|
248
|
-
{React.createElement(pageData.examples["Thumb value input"])}
|
|
249
|
-
{React.createElement(pageData.examples["Actions"])}
|
|
250
|
-
{React.createElement(pageData.examples["Disabled"])}
|
|
251
|
-
<AutoLinkHeader {...{"id":"types","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
252
|
-
{`Types`}
|
|
253
|
-
</AutoLinkHeader>
|
|
254
|
-
<AutoLinkHeader {...{"id":"slideronchangeevent","headingLevel":"h3","className":"ws-title ws-h3"}}>
|
|
255
|
-
{`SliderOnChangeEvent`}
|
|
256
|
-
</AutoLinkHeader>
|
|
257
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
258
|
-
{`The slider's `}
|
|
259
|
-
<code {...{"className":"ws-code "}}>
|
|
260
|
-
{`onChange`}
|
|
261
|
-
</code>
|
|
262
|
-
{` prop accepts an `}
|
|
263
|
-
<code {...{"className":"ws-code "}}>
|
|
264
|
-
{`event`}
|
|
265
|
-
</code>
|
|
266
|
-
{` parameter of the following types:`}
|
|
267
|
-
</p>
|
|
268
|
-
<ul {...{"className":"pf-v6-c-content--ul pf-m-editorial ws-ul "}}>
|
|
269
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
270
|
-
<code {...{"className":"ws-code "}}>
|
|
271
|
-
{`React.MouseEvent`}
|
|
272
|
-
</code>
|
|
273
|
-
</li>
|
|
274
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
275
|
-
<code {...{"className":"ws-code "}}>
|
|
276
|
-
{`React.KeyboardEvent`}
|
|
277
|
-
</code>
|
|
278
|
-
</li>
|
|
279
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
280
|
-
<code {...{"className":"ws-code "}}>
|
|
281
|
-
{`React.FormEvent<HTMLInputElement>`}
|
|
282
|
-
</code>
|
|
283
|
-
</li>
|
|
284
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
285
|
-
<code {...{"className":"ws-code "}}>
|
|
286
|
-
{`React.TouchEvent`}
|
|
287
|
-
</code>
|
|
288
|
-
</li>
|
|
289
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
290
|
-
<code {...{"className":"ws-code "}}>
|
|
291
|
-
{`React.FocusEvent<HTMLInputElement>`}
|
|
292
|
-
</code>
|
|
293
|
-
</li>
|
|
294
|
-
</ul>
|
|
295
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
296
|
-
{`The `}
|
|
297
|
-
<code {...{"className":"ws-code "}}>
|
|
298
|
-
{`SliderOnChangeEvent`}
|
|
299
|
-
</code>
|
|
300
|
-
{` type is a union of the above event types, and can be imported and used in your code like in the following code snippet:`}
|
|
301
|
-
</p>
|
|
302
|
-
<Example {...{"code":"import { Slider, SliderOnChangeEvent } from '@patternfly/react-core';\n\n<Slider onChange={(event: SliderOnChangeEvent) => {}} />","lang":"noLive","className":""}}>
|
|
303
|
-
</Example>
|
|
304
|
-
</React.Fragment>
|
|
305
|
-
);
|
|
306
|
-
Component.displayName = 'ComponentsSliderReactDocs';
|
|
307
|
-
Component.pageData = pageData;
|
|
308
|
-
|
|
309
|
-
export default Component;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
|
-
const pageData = {
|
|
5
|
-
"id": "Spinner",
|
|
6
|
-
"section": "components",
|
|
7
|
-
"subsection": "",
|
|
8
|
-
"deprecated": false,
|
|
9
|
-
"template": false,
|
|
10
|
-
"beta": false,
|
|
11
|
-
"demo": false,
|
|
12
|
-
"newImplementationLink": false,
|
|
13
|
-
"source": "react",
|
|
14
|
-
"tabName": null,
|
|
15
|
-
"slug": "/components/spinner/react",
|
|
16
|
-
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Spinner/examples/Spinner.md",
|
|
17
|
-
"relPath": "packages/react-core/src/components/Spinner/examples/Spinner.md",
|
|
18
|
-
"propComponents": [
|
|
19
|
-
{
|
|
20
|
-
"name": "Spinner",
|
|
21
|
-
"description": "",
|
|
22
|
-
"props": [
|
|
23
|
-
{
|
|
24
|
-
"name": "aria-label",
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "Accessible label to describe what is loading"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "aria-labelledBy",
|
|
30
|
-
"type": "string",
|
|
31
|
-
"description": "Id of element which describes what is being loaded"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "aria-valuetext",
|
|
35
|
-
"type": "string",
|
|
36
|
-
"description": "Text describing that current loading status or progress",
|
|
37
|
-
"defaultValue": "'Loading...'"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "className",
|
|
41
|
-
"type": "string",
|
|
42
|
-
"description": "Additional classes added to the Spinner.",
|
|
43
|
-
"defaultValue": "''"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"name": "diameter",
|
|
47
|
-
"type": "string",
|
|
48
|
-
"description": "Diameter of spinner set as CSS variable"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": "isInline",
|
|
52
|
-
"type": "boolean",
|
|
53
|
-
"description": "Indicates the spinner is inline and the size should inherit the text font size. This will override the size prop.",
|
|
54
|
-
"defaultValue": "false"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"name": "size",
|
|
58
|
-
"type": "'sm' | 'md' | 'lg' | 'xl'",
|
|
59
|
-
"description": "Size variant of progress.",
|
|
60
|
-
"defaultValue": "'xl'"
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"cssPrefix": [
|
|
66
|
-
"pf-v6-c-spinner"
|
|
67
|
-
],
|
|
68
|
-
"examples": [
|
|
69
|
-
"Basic",
|
|
70
|
-
"Size variations",
|
|
71
|
-
"Custom size",
|
|
72
|
-
"Inline size"
|
|
73
|
-
]
|
|
74
|
-
};
|
|
75
|
-
pageData.liveContext = {
|
|
76
|
-
Fragment
|
|
77
|
-
};
|
|
78
|
-
pageData.examples = {
|
|
79
|
-
'Basic': props =>
|
|
80
|
-
<Example {...pageData} {...props} {...{"code":"import { Spinner } from '@patternfly/react-core';\n\nexport const SpinnerBasic: React.FunctionComponent = () => <Spinner aria-label=\"Contents of the basic example\" />;\n","title":"Basic","lang":"ts","className":""}}>
|
|
81
|
-
|
|
82
|
-
</Example>,
|
|
83
|
-
'Size variations': props =>
|
|
84
|
-
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { Spinner } from '@patternfly/react-core';\n\nexport const SpinnerSizeVariations: React.FunctionComponent = () => (\n <Fragment>\n <Spinner size=\"sm\" aria-label=\"Contents of the small example\" />\n <Spinner size=\"md\" aria-label=\"Contents of the medium example\" />\n <Spinner size=\"lg\" aria-label=\"Contents of the large example\" />\n <Spinner size=\"xl\" aria-label=\"Contents of the extra large example\" />\n </Fragment>\n);\n","title":"Size variations","lang":"ts","className":""}}>
|
|
85
|
-
|
|
86
|
-
</Example>,
|
|
87
|
-
'Custom size': props =>
|
|
88
|
-
<Example {...pageData} {...props} {...{"code":"import { Spinner } from '@patternfly/react-core';\n\nexport const SpinnerCustomSize: React.FunctionComponent = () => (\n <Spinner diameter=\"80px\" aria-label=\"Contents of the custom size example\" />\n);\n","title":"Custom size","lang":"ts","className":""}}>
|
|
89
|
-
|
|
90
|
-
</Example>,
|
|
91
|
-
'Inline size': props =>
|
|
92
|
-
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { Spinner, Content } from '@patternfly/react-core';\n\nexport const SpinnerInline: React.FunctionComponent = () => (\n <Fragment>\n <Content>\n <h1>\n Heading\n <Spinner isInline aria-label=\"Spinner in a heading\" />\n </h1>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit Sed hendrerit nisi in cursus maximus.</p>\n <h2>\n Second level\n <Spinner isInline aria-label=\"spinner in a subheading\" />\n </h2>\n <p>\n Curabitur accumsan turpis pharetra blandit. Quisque condimentum maximus mi,{' '}\n <Spinner isInline aria-label=\"Spinner in a paragraph\" /> sit amet commodo arcu rutrum id. Proin pretium urna vel\n cursus venenatis. Suspendisse potenti.\n </p>\n <small>\n Sometimes you need small text\n <Spinner isInline aria-label=\"Spinner in a small element\" />\n </small>\n </Content>\n </Fragment>\n);\n","title":"Inline size","lang":"ts","className":""}}>
|
|
93
|
-
|
|
94
|
-
</Example>
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const Component = () => (
|
|
98
|
-
<React.Fragment>
|
|
99
|
-
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
100
|
-
{`Examples`}
|
|
101
|
-
</AutoLinkHeader>
|
|
102
|
-
{React.createElement(pageData.examples["Basic"])}
|
|
103
|
-
{React.createElement(pageData.examples["Size variations"])}
|
|
104
|
-
{React.createElement(pageData.examples["Custom size"])}
|
|
105
|
-
{React.createElement(pageData.examples["Inline size"])}
|
|
106
|
-
</React.Fragment>
|
|
107
|
-
);
|
|
108
|
-
Component.displayName = 'ComponentsSpinnerReactDocs';
|
|
109
|
-
Component.pageData = pageData;
|
|
110
|
-
|
|
111
|
-
export default Component;
|