diff --git a/components/doc/common/docsectiontext.js b/components/doc/common/docsectiontext.js index fa88acf86b..1000377e5d 100644 --- a/components/doc/common/docsectiontext.js +++ b/components/doc/common/docsectiontext.js @@ -12,7 +12,7 @@ export function DocSectionText(props) { # - {props.children &&
{props.children}
} + {props.children &&{props.children}
} > ); } diff --git a/components/doc/rating/apidoc.js b/components/doc/rating/apidoc.js new file mode 100644 index 0000000000..c2cdae49c0 --- /dev/null +++ b/components/doc/rating/apidoc.js @@ -0,0 +1,234 @@ +import Link from 'next/link'; +import { CodeHighlight } from '../common/codehighlight'; +import { DevelopmentSection } from '../common/developmentsection'; +import { DocSectionText } from '../common/docsectiontext'; + +export function ApiDoc(props) { + return ( + <> +Any valid attribute is passed to the root element implicitly, extended properties are as follows;
+Name | +Type | +Default | +Description | +
---|---|---|---|
id | +string | +null | +Unique identifier of the element. | +
value | +number | +null | +Value of the rating. | +
disabled | +boolean | +false | +When present, it specifies that the element should be disabled. | +
readOnly | +boolean | +false | +When present, changing the value is not possible. | +
style | +object | +null | +Inline style of the component. | +
className | +string | +null | +ClassName of the component. | +
stars | +number | +5 | +Number of stars. | +
cancel | +boolean | +true | +When specified a cancel icon is displayed to allow removing the value. | +
cancelIcon | +string | +pi pi-ban | +ClassName of the cancel icon component. | +
cancelIconProps | +object | +null | +Properties of the cancel icon. | +
onIcon | +string | +pi pi-star-fill | +ClassName of the on icon component. | +
offIcon | +string | +pi pi-star | +ClassName of the off icon component. | +
onIconProps | +object | +null | +Properties of the on icon. | +
offIconProps | +object | +null | +Properties of the off icon. | +
tooltip | +any | +null | +Content of the tooltip. | +
tooltipOptions | +object | +null | +Configuration of the tooltip, refer to the tooltip documentation for more information. | +
Name | +Parameters | +Description | +
---|---|---|
onChange | +
+ event.originalEvent: Browser event + event.value: selected value + |
+ Callback to invoke on value change. | +
Following is the list of structural style classes
+Name | +Element | +
---|---|
p-rating | +Container element | +
p-rating-item | +Each item element | +
p-rating-item-active | +Selected item elements. | +
p-rating-cancel-item | +Cancel item element. | +
+ Rating component internally uses radio buttons that are only visible to screen readers. The value to read for item is retrieved from the locale API via star and stars of the aria{' '} + property. +
+ +Keyboard interaction is derived from the native browser handling of radio buttons in a group.
+Key | +Function | +
---|---|
+ tab + | +Moves focus to the star representing the value, if there is none then first star receives the focus. | +
+ + left arrow + up arrow + + | +Moves focus to the previous star, if there is none then last radio button receives the focus. | +
+ + right arrow + down arrow + + | +Moves focus to the next star, if there is none then first star receives the focus. | +
+ space + | +If the focused star does not represent the value, changes the value to the star value. | +
None.
+ > + ); +} diff --git a/components/doc/rating/basicdoc.js b/components/doc/rating/basicdoc.js new file mode 100644 index 0000000000..16361b874b --- /dev/null +++ b/components/doc/rating/basicdoc.js @@ -0,0 +1,52 @@ +import { useState } from 'react'; +import { Rating } from '../../lib/rating/Rating'; +import { DocSectionText } from '../common/docsectiontext'; +import { DocSectionCode } from '../common/docsectioncode'; + +export function BasicDoc(props) { + const [val, setVal] = useState(false); + + const code = { + basic: ` +Any valid attribute is passed to the root element implicitly, extended properties are as follows;
+Name | +Type | +Default | +Description | +
---|---|---|---|
id | +string | +null | +Unique identifier of the element. | +
onIcon | +string | +null | +Icon for the on state. | +
offIcon | +string | +null | +Icon for the off state. | +
onLabel | +string | +yes | +Label for the on state. | +
offLabel | +string | +no | +Label for the off state. | +
style | +string | +null | +Inline style of the element. | +
className | +string | +null | +Style class of the element. | +
checked | +boolean | +false | +Specifies the on/off state of the button. | +
tabIndex | +number | +0 | +Index of the element in tabbing order. | +
iconPos | +string | +left | +Position of the icon, valid values are "left" and "right". | +
tooltip | +any | +null | +Content of the tooltip. | +
tooltipOptions | +object | +null | +Configuration of the tooltip, refer to the tooltip documentation for more information. | +
Name | +Parameters | +Description | +
---|---|---|
onChange | +
+ event.originalEvent: Browser event + event.value: Value as the checked state. + |
+ Callback to invoke on value change. | +
onFocus | +event: Browser event | +Callback to invoke when autocomplete gets focus. | +
onBlur | +event: Browser event | +Callback to invoke when autocomplete loses focus. | +
+ Following is the list of structural style classes, for theming classes visit theming page. +
+Name | +Element | +
---|---|
p-togglebutton | +Container element | +
p-button-icon-left | +Icon element. | +
p-button-text | +Label element. | +
+ ToggleButton component uses an element with button role and updates aria-pressed state for screen readers. Value to describe the component can be defined with aria-labelledby or aria-label props, it is + highly suggested to use either of these props as the component changes the label displayed which will result in screen readers to read different labels when the component receives focus. To prevent this, always provide an aria + label that does not change related to state. +
+Key | +Function | +
---|---|
+ tab + | +Moves focus to the button. | +
+ space + | +Toggles the checked state. | +
None.
+ > + ); +} diff --git a/components/doc/togglebutton/basicdoc.js b/components/doc/togglebutton/basicdoc.js new file mode 100644 index 0000000000..56375cb710 --- /dev/null +++ b/components/doc/togglebutton/basicdoc.js @@ -0,0 +1,54 @@ +import { useState } from 'react'; +import { ToggleButton } from '../../lib/togglebutton/ToggleButton'; +import { DocSectionText } from '../common/docsectiontext'; +import { DocSectionCode } from '../common/docsectioncode'; + +export function BasicDemo(props) { + const [checked, setChecked] = useState(false); + + const code = { + basic: ` +