diff --git a/.gitignore b/.gitignore index 8792496601..9259819eda 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ tsconfig.tsbuildinfo # misc .DS_Store *.pem +*.code-workspace # debug npm-debug.log* diff --git a/components/doc/accordion/theming/tailwinddoc.js b/components/doc/accordion/theming/tailwinddoc.js index 1f92bc501a..10ab21f4ad 100644 --- a/components/doc/accordion/theming/tailwinddoc.js +++ b/components/doc/accordion/theming/tailwinddoc.js @@ -34,7 +34,7 @@ const Tailwind = { 'dark:bg-gray-900 dark:border-blue-900/40 dark:text-white/80 dark:hover:bg-gray-800/80 dark:focus:shadow-[inset_0_0_0_0.2rem_rgba(147,197,253,0.5)]', // Dark mode 'hover:border-gray-300 hover:bg-gray-200 hover:text-gray-800', // Hover 'focus:outline-none focus:outline-offset-0 focus:shadow-[inset_0_0_0_0.2rem_rgba(191,219,254,1)]', // Focus - { 'rounded-br-md rounded-bl-md': !context.active, 'rounded-br-0 rounded-bl-0 text-gray-800': context.active } // Condition + { 'rounded-br-md rounded-bl-md': !context.selected, 'rounded-br-0 rounded-bl-0 text-gray-800': context.selected } // Condition ) }), headerIcon: 'inline-block mr-2', diff --git a/components/doc/badge/severitydoc.js b/components/doc/badge/severitydoc.js index ad2426f161..65a31bf598 100644 --- a/components/doc/badge/severitydoc.js +++ b/components/doc/badge/severitydoc.js @@ -10,6 +10,8 @@ export function SeverityDoc(props) { + + `, javascript: ` import React from 'react'; @@ -23,6 +25,8 @@ export default function SeverityDemo() { + + ); } @@ -39,6 +43,8 @@ export default function SeverityDemo() { + + ); } @@ -58,6 +64,8 @@ export default function SeverityDemo() { + + diff --git a/components/doc/common/apidoc/index.json b/components/doc/common/apidoc/index.json index 727c56b467..ba46d26d26 100644 --- a/components/doc/common/apidoc/index.json +++ b/components/doc/common/apidoc/index.json @@ -1875,6 +1875,125 @@ "type": "string[]", "description": "['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']" }, + { + "name": "chooseYear", + "optional": true, + "readonly": false, + "type": "string", + "description": "Choose Year" + }, + { + "name": "chooseMonth", + "optional": true, + "readonly": false, + "type": "string", + "description": "Choose Month" + }, + { + "name": "chooseDate", + "optional": true, + "readonly": false, + "type": "string", + "description": "Choose Date" + }, + { + "name": "prevDecade", + "optional": true, + "readonly": false, + "type": "string", + "description": "Previous Decade" + }, + { + "name": "nextDecade", + "optional": true, + "readonly": false, + "type": "string", + "description": "Next Decade" + }, + { + "name": "prevYear", + "optional": true, + "readonly": false, + "type": "string", + "description": "Previous Year" + }, + { + "name": "nextYear", + "optional": true, + "readonly": false, + "type": "string", + "description": "Next Year" + }, + { + "name": "prevMonth", + "optional": true, + "readonly": false, + "type": "string", + "description": "Previous Month" + }, + { + "name": "nextMonth", + "optional": true, + "readonly": false, + "type": "string", + "description": "Next Month" + }, + { + "name": "prevHour", + "optional": true, + "readonly": false, + "type": "string", + "description": "Previous Hour" + }, + { + "name": "nextHour", + "optional": true, + "readonly": false, + "type": "string", + "description": "Next Hour" + }, + { + "name": "prevMinute", + "optional": true, + "readonly": false, + "type": "string", + "description": "Previous Minute" + }, + { + "name": "nextMinute", + "optional": true, + "readonly": false, + "type": "string", + "description": "Next Minute" + }, + { + "name": "prevSecond", + "optional": true, + "readonly": false, + "type": "string", + "description": "Previous Second" + }, + { + "name": "nextSecond", + "optional": true, + "readonly": false, + "type": "string", + "description": "Next Second" + }, + { + "name": "am", + "optional": true, + "readonly": false, + "type": "string", + "description": "AM" + }, + { + "name": "pm", + "optional": true, + "readonly": false, + "type": "string", + "description": "PM" + }, { "name": "today", "optional": true, @@ -1957,7 +2076,7 @@ "optional": true, "readonly": false, "type": "Object", - "description": "True" + "description": "ARIA labels" } ], "callbacks": [] @@ -3638,6 +3757,14 @@ "default": "", "description": "Inline style of the input field." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -5930,6 +6057,14 @@ "default": "", "description": "Inline style of the input field." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keepInvalid", "optional": true, @@ -7449,6 +7584,13 @@ "type": "IconType", "description": "Icon to show in each of the decrement buttons." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "disabled", "optional": true, @@ -8950,6 +9092,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -9972,6 +10122,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "name", "optional": true, @@ -10086,19 +10244,6 @@ "returnType": "void", "description": "Callback to invoke on value change" }, - { - "name": "onClick", - "parameters": [ - { - "name": "event", - "optional": false, - "type": "CheckboxClickEvent", - "description": "Custom click event" - } - ], - "returnType": "void", - "description": "Callback to invoke on value change. Mark the event with preventDefault to prevent the option from changing." - }, { "name": "onContextMenu", "parameters": [ @@ -10161,36 +10306,6 @@ "type": "FormTarget" } ] - }, - "CheckboxClickEvent": { - "description": "Custom click event.", - "relatedProp": "onClick", - "props": [ - { - "name": "originalEvent", - "optional": true, - "readonly": false, - "type": "SyntheticEvent" - }, - { - "name": "value", - "optional": false, - "readonly": false, - "type": "any" - }, - { - "name": "checked", - "optional": true, - "readonly": false, - "type": "boolean" - }, - { - "name": "target", - "optional": false, - "readonly": false, - "type": "FormTarget" - } - ] } } }, @@ -10207,12 +10322,6 @@ "readonly": false, "type": "CheckboxProps" }, - { - "name": "state", - "optional": false, - "readonly": false, - "type": "CheckboxState" - }, { "name": "context", "optional": false, @@ -10240,6 +10349,13 @@ "type": "CheckboxPassThroughType>", "description": "Uses to pass attributes to the input's DOM element." }, + { + "name": "box", + "optional": true, + "readonly": false, + "type": "CheckboxPassThroughType>", + "description": "Used to pass attributes to the box's DOM element." + }, { "name": "icon", "optional": true, @@ -10254,20 +10370,6 @@ "type": "TooltipPassThroughOptions", "description": "Uses to pass attributes tooltip's DOM element." }, - { - "name": "hiddenInputWrapper", - "optional": true, - "readonly": false, - "type": "CheckboxPassThroughType>", - "description": "Uses to pass attributes to the hidden input wrapper's DOM element." - }, - { - "name": "hiddenInput", - "optional": true, - "readonly": false, - "type": "CheckboxPassThroughType>", - "description": "Uses to pass attributes to the hidden input's DOM element." - }, { "name": "hooks", "optional": true, @@ -10298,20 +10400,6 @@ } ], "callbacks": [] - }, - "CheckboxState": { - "description": "Defines current inline state in Checkbox component.", - "relatedProp": "", - "props": [ - { - "name": "focused", - "optional": false, - "readonly": false, - "type": "boolean", - "description": "Current focus state as a boolean." - } - ], - "callbacks": [] } } }, @@ -10682,6 +10770,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -22714,6 +22810,22 @@ "default": "false", "description": "When present, it specifies that the component should automatically get focus on load." }, + { + "name": "autoOptionFocus", + "optional": true, + "readonly": false, + "type": "false", + "default": "false", + "description": "Whether to focus on the first visible or selected element." + }, + { + "name": "checkmark", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "Whether the selected option will be shown with a check mark." + }, { "name": "children", "optional": true, @@ -22867,6 +22979,14 @@ "default": "", "description": "Reference of the focusable input element." }, + { + "name": "highlightOnSelect", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "true", + "description": "Whether the selected option will be add highlight class." + }, { "name": "id", "optional": true, @@ -22891,6 +23011,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -23059,6 +23187,14 @@ "default": "200px", "description": "Height of the viewport in pixels, a scrollbar is defined if height of list exceeds this value." }, + { + "name": "selectOnFocus", + "optional": true, + "readonly": false, + "type": "false", + "default": "false", + "description": "When enabled, the focused tab is activated." + }, { "name": "showClear", "optional": true, @@ -23439,6 +23575,13 @@ "type": "DropdownPassThroughType>", "description": "Uses to pass attributes to the item group's DOM element." }, + { + "name": "itemGroupLabel", + "optional": true, + "readonly": false, + "type": "DropdownPassThroughType>", + "description": "Used to pass attributes to the item group label's DOM element." + }, { "name": "item", "optional": true, @@ -23446,6 +23589,27 @@ "type": "DropdownPassThroughType>", "description": "Uses to pass attributes to the item's DOM element." }, + { + "name": "itemLabel", + "optional": true, + "readonly": false, + "type": "DropdownPassThroughType>", + "description": "Used to pass attributes to the item label's DOM element." + }, + { + "name": "checkIcon", + "optional": true, + "readonly": false, + "type": "DropdownPassThroughType>", + "description": "Used to pass attributes to the check icon's DOM element." + }, + { + "name": "blankIcon", + "optional": true, + "readonly": false, + "type": "DropdownPassThroughType>", + "description": "Used to pass attributes to the bank icon's DOM element." + }, { "name": "emptyMessage", "optional": true, @@ -29627,6 +29791,14 @@ "default": "false", "description": "When present, it specifies that the element value cannot be altered." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -30048,6 +30220,14 @@ "default": "", "description": "Inline style of the input field." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "locale", "optional": true, @@ -30329,19 +30509,6 @@ "returnType": "void", "description": "Callback to invoke when the key pressed down." }, - { - "name": "onKeyUp", - "parameters": [ - { - "name": "event", - "optional": false, - "type": "KeyboardEvent", - "description": "Browser event" - } - ], - "returnType": "void", - "description": "Callback to invoke when the key released." - }, { "name": "onValueChange", "parameters": [ @@ -30623,6 +30790,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "name", "optional": true, @@ -30790,12 +30965,6 @@ "optional": false, "readonly": false, "type": "InputSwitchProps" - }, - { - "name": "state", - "optional": false, - "readonly": false, - "type": "InputSwitchState" } ], "callbacks": [] @@ -30819,18 +30988,11 @@ "description": "Uses to pass attributes to the slider's DOM element." }, { - "name": "hiddenInputWrapper", - "optional": true, - "readonly": false, - "type": "InputSwitchPassThroughType>", - "description": "Uses to pass attributes to the hidden input wrapper's DOM element." - }, - { - "name": "hiddenInput", + "name": "input", "optional": true, "readonly": false, "type": "InputSwitchPassThroughType>", - "description": "Uses to pass attributes to the hidden input's DOM element." + "description": "Uses to pass attributes to the input's DOM element." }, { "name": "tooltip", @@ -30848,20 +31010,6 @@ } ], "callbacks": [] - }, - "InputSwitchState": { - "description": "Defines current inline state in InputSwitch component.", - "relatedProp": "", - "props": [ - { - "name": "focused", - "optional": false, - "readonly": false, - "type": "boolean", - "description": "Current focus state as a boolean." - } - ], - "callbacks": [] } } }, @@ -30893,6 +31041,14 @@ "default": "", "description": "Used to get the child elements of the component." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -31102,6 +31258,14 @@ "default": "", "description": "Used to get the child elements of the component." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -31595,6 +31759,14 @@ "default": "", "description": "Establishes relationships between the component and label(s) where its value should be one or more element IDs." }, + { + "name": "autoOptionFocus", + "optional": true, + "readonly": false, + "type": "false", + "default": "false", + "description": "Whether to focus on the first visible or selected element." + }, { "name": "children", "optional": true, @@ -31699,6 +31871,14 @@ "default": "", "description": "When specified, filter displays with this value." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -31811,6 +31991,14 @@ "default": "", "description": "Used to configure passthrough(pt) options of the component." }, + { + "name": "selectOnFocus", + "optional": true, + "readonly": false, + "type": "false", + "default": "false", + "description": "When enabled, the focused tab is activated." + }, { "name": "tooltip", "optional": true, @@ -34151,7 +34339,7 @@ "name": "severity", "optional": true, "readonly": false, - "type": "\"error\" | \"success\" | \"info\" | \"warn\"", + "type": "\"error\" | \"success\" | \"secondary\" | \"info\" | \"warn\" | \"contrast\"", "default": "", "description": "Severity level of the message." }, @@ -34469,7 +34657,7 @@ "name": "severity", "optional": true, "readonly": false, - "type": "\"error\" | \"success\" | \"info\" | \"warn\"", + "type": "\"error\" | \"success\" | \"secondary\" | \"info\" | \"warn\" | \"contrast\"", "description": "Severity of the message." }, { @@ -34566,6 +34754,286 @@ } } }, + "metergroup": { + "description": "MeterGroup displays scalar measurements within a known range.\n\n[Live Demo](https://www.primereact.org/metergroup/)", + "components": { + "MeterGroup": { + "description": "MeterGroup is an extension to standard input element with theming and keyfiltering.", + "methods": { + "description": "Defines methods that can be accessed by the component's reference.", + "values": [] + }, + "props": { + "description": "Defines valid properties in MeterGroup component. In addition to these, all properties of HTMLDivElement can be used in this component.", + "values": [ + { + "name": "className", + "optional": true, + "readonly": false, + "type": "string", + "default": "", + "description": "Additional CSS classes to apply to the MeterGroup." + }, + { + "name": "end", + "optional": true, + "readonly": false, + "type": "Function", + "default": "" + }, + { + "name": "labelList", + "optional": true, + "readonly": false, + "type": "Function", + "default": "" + }, + { + "name": "labelOrientation", + "optional": true, + "readonly": false, + "type": "\"horizontal\" | \"vertical\"", + "default": "'horizontal'", + "description": "The orientation of the label. Can be either 'horizontal' or 'vertical'." + }, + { + "name": "labelPosition", + "optional": true, + "readonly": false, + "type": "\"end\" | \"start\"", + "default": "'end'", + "description": "The position of the label. Can be either 'start' or 'end'." + }, + { + "name": "max", + "optional": true, + "readonly": false, + "type": "number", + "default": "100", + "description": "The maximum value for the MeterGroup." + }, + { + "name": "meter", + "optional": true, + "readonly": false, + "type": "Function", + "default": "" + }, + { + "name": "min", + "optional": true, + "readonly": false, + "type": "number", + "default": "0", + "description": "The minimum value for the MeterGroup." + }, + { + "name": "orientation", + "optional": true, + "readonly": false, + "type": "\"horizontal\" | \"vertical\"", + "default": "'horizontal'", + "description": "The orientation of the MeterGroup. Can be either 'horizontal' or 'vertical'." + }, + { + "name": "pt", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughOptions", + "default": "", + "description": "Uses to pass attributes to DOM elements inside the component." + }, + { + "name": "ptOptions", + "optional": true, + "readonly": false, + "type": "PassThroughOptions", + "default": "", + "description": "Used to configure passthrough(pt) options of the component." + }, + { + "name": "start", + "optional": true, + "readonly": false, + "type": "Function", + "default": "" + }, + { + "name": "values", + "optional": true, + "readonly": false, + "type": "MeterGroupValue[]", + "default": "", + "description": "An array of values to be represented by the MeterGroup." + } + ] + }, + "callbacks": { + "description": "Defines callbacks that determine the behavior of the component based on a given condition or report the actions that the component takes.", + "values": [] + } + } + }, + "interfaces": { + "description": "Defines the custom interfaces used by the module.", + "values": { + "MeterGroupContext": { + "description": "Defines current options in MeterGroup component.", + "relatedProp": "", + "props": [ + { + "name": "disabled", + "optional": false, + "readonly": false, + "type": "boolean", + "description": "Current disabled state of the component as a boolean." + } + ], + "callbacks": [] + }, + "MeterGroupPassThroughMethodOptions": { + "description": "Custom passthrough(pt) option method.", + "relatedProp": "", + "props": [ + { + "name": "props", + "optional": false, + "readonly": false, + "type": "MeterGroupProps" + }, + { + "name": "context", + "optional": false, + "readonly": false, + "type": "MeterGroupContext" + } + ], + "callbacks": [] + }, + "MeterGroupPassThroughOptions": { + "description": "Custom passthrough(pt) options.", + "relatedProp": "pt", + "props": [ + { + "name": "root", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the root's DOM element." + }, + { + "name": "labellist", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the label list's DOM element." + }, + { + "name": "labellistitem", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the label list item's DOM element." + }, + { + "name": "labellisttype", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the label list type's DOM element." + }, + { + "name": "label", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the label's DOM element." + }, + { + "name": "metercontainer", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the meter container's DOM element." + }, + { + "name": "meter", + "optional": true, + "readonly": false, + "type": "MeterGroupPassThroughType>", + "description": "Used to pass attributes to the meter's DOM element." + } + ], + "callbacks": [] + }, + "MeterGroupValue": { + "relatedProp": "", + "props": [ + { + "name": "value", + "optional": true, + "readonly": false, + "type": "number" + }, + { + "name": "label", + "optional": true, + "readonly": false, + "type": "string | HTMLElement" + }, + { + "name": "color", + "optional": true, + "readonly": false, + "type": "string" + }, + { + "name": "[key: string]", + "optional": false, + "readonly": false, + "type": "any" + } + ], + "callbacks": [] + }, + "CustomRenderProps": { + "relatedProp": "", + "props": [ + { + "name": "totaLPercent", + "optional": false, + "readonly": false, + "type": "number" + }, + { + "name": "percentages", + "optional": false, + "readonly": false, + "type": "number[]" + }, + { + "name": "values", + "optional": false, + "readonly": false, + "type": "MeterGroupValue[]" + } + ], + "callbacks": [] + } + } + }, + "types": { + "description": "Defines the custom types used by the module.", + "values": { + "MeterGroupPassThroughType": { + "values": "PassThroughType" + }, + "MeterGroupPassThroughTransitionType": { + "values": "ReactCSSTransitionProps | Function | undefined" + } + } + } + }, "multiselect": { "description": "MultiSelect is used to select multiple items from a collection.\n\n[Live Demo](https://www.primereact.org/multiselect/)", "components": { @@ -34631,6 +35099,14 @@ "default": "", "description": "Establishes relationships between the component and label(s) where its value should be one or more element IDs." }, + { + "name": "autoOptionFocus", + "optional": true, + "readonly": false, + "type": "false", + "default": "false", + "description": "Whether to focus on the first visible or selected element." + }, { "name": "checkboxIcon", "optional": true, @@ -34831,6 +35307,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemCheckboxIcon", "optional": true, @@ -34855,6 +35339,22 @@ "default": "", "description": "Function that gets the option and returns the content for it." }, + { + "name": "loading", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "Displays a loader to indicate data load is in progress." + }, + { + "name": "loadingIcon", + "optional": true, + "readonly": false, + "type": "IconType", + "default": "", + "description": "The icon to show while indicating data load is in progress." + }, { "name": "maxSelectedLabels", "optional": true, @@ -35055,6 +35555,14 @@ "default": "", "description": "Number of maximum options that can be selected." }, + { + "name": "selectOnFocus", + "optional": true, + "readonly": false, + "type": "false", + "default": "false", + "description": "When enabled, the focused tab is activated." + }, { "name": "showClear", "optional": true, @@ -36324,6 +36832,14 @@ "default": "", "description": "Establishes relationships between the component and label(s) where its value should be one or more element IDs." }, + { + "name": "autoOptionFocus", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "true", + "description": "Whether to focus on the first visible or selected element." + }, { "name": "breakpoint", "optional": true, @@ -40222,6 +40738,13 @@ "type": "PasswordPassThroughType | SVGProps>", "description": "Uses to pass attributes to the show icon's DOM element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "panel", "optional": true, @@ -40362,6 +40885,14 @@ "props": { "description": "Defines valid properties in PickList component.", "values": [ + { + "name": "autoOptionFocus", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "true", + "description": "Whether to focus on the first visible or selected element." + }, { "name": "breakpoint", "optional": true, @@ -41657,7 +42188,7 @@ "readonly": false, "type": "boolean", "default": "false", - "description": "When present, it specifies that the element value cannot be altered." + "description": "When present, it specifies that the component should be disabled." }, { "name": "inputId", @@ -41675,6 +42206,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "name", "optional": true, @@ -41699,6 +42238,14 @@ "default": "", "description": "Used to configure passthrough(pt) options of the component." }, + { + "name": "readonly", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "", + "description": "When present, it specifies that an input field is read-only." + }, { "name": "required", "optional": true, @@ -41756,19 +42303,6 @@ ], "returnType": "void", "description": "Callback to invoke on value change" - }, - { - "name": "onClick", - "parameters": [ - { - "name": "event", - "optional": false, - "type": "RadioButtonClickEvent", - "description": "Custom click event." - } - ], - "returnType": "void", - "description": "Callback to invoke on click. Mark the event with preventDefault to prevent the option from changing." } ] } @@ -41806,36 +42340,6 @@ "type": "FormTarget" } ] - }, - "RadioButtonClickEvent": { - "description": "Custom click event.", - "relatedProp": "onClick", - "props": [ - { - "name": "originalEvent", - "optional": true, - "readonly": false, - "type": "SyntheticEvent" - }, - { - "name": "value", - "optional": false, - "readonly": false, - "type": "any" - }, - { - "name": "checked", - "optional": true, - "readonly": false, - "type": "boolean" - }, - { - "name": "target", - "optional": false, - "readonly": false, - "type": "FormTarget" - } - ] } } }, @@ -41851,12 +42355,6 @@ "optional": false, "readonly": false, "type": "RadioButtonProps" - }, - { - "name": "state", - "optional": false, - "readonly": false, - "type": "RadioButtonState" } ], "callbacks": [] @@ -41872,13 +42370,6 @@ "type": "RadioButtonPassThroughType>", "description": "Uses to pass attributes to the root's DOM element." }, - { - "name": "input", - "optional": true, - "readonly": false, - "type": "RadioButtonPassThroughType>", - "description": "Uses to pass attributes to the input's DOM element." - }, { "name": "icon", "optional": true, @@ -41887,18 +42378,18 @@ "description": "Uses to pass attributes to the icon's DOM element." }, { - "name": "hiddenInputWrapper", + "name": "input", "optional": true, "readonly": false, "type": "RadioButtonPassThroughType>", - "description": "Uses to pass attributes to the hidden accessible DOM element wrapper." + "description": "Uses to pass attributes to the input's DOM element." }, { - "name": "hiddenInput", + "name": "box", "optional": true, "readonly": false, - "type": "RadioButtonPassThroughType>", - "description": "Uses to pass attributes to the hidden accessible DOM element." + "type": "CheckboxPassThroughType>", + "description": "Used to pass attributes to the box's DOM element." }, { "name": "tooltip", @@ -41916,20 +42407,6 @@ } ], "callbacks": [] - }, - "RadioButtonState": { - "description": "Defines current inline state in RadioButton component.", - "relatedProp": "", - "props": [ - { - "name": "focused", - "optional": false, - "readonly": false, - "type": "boolean", - "description": "Current focused state as a boolean." - } - ], - "callbacks": [] } } }, @@ -42854,6 +43331,14 @@ "default": "false", "description": "When present, it specifies that the element should be disabled." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "multiple", "optional": true, @@ -43419,6 +43904,13 @@ "type": "SidebarPassThroughType>", "description": "Uses to pass attributes to the close button's DOM element." }, + { + "name": "icons", + "optional": true, + "readonly": false, + "type": "SidebarPassThroughType>", + "description": "Uses to pass attributes to the custom icons content's DOM element." + }, { "name": "closeIcon", "optional": true, @@ -43433,13 +43925,6 @@ "type": "SidebarPassThroughType>", "description": "Uses to pass attributes to the content's DOM element." }, - { - "name": "icons", - "optional": true, - "readonly": false, - "type": "SidebarPassThroughType>", - "description": "Uses to pass attributes to the custom icons content's DOM element." - }, { "name": "mask", "optional": true, @@ -45026,9 +45511,9 @@ "name": "severity", "optional": true, "readonly": false, - "type": "\"success\" | \"warning\" | \"secondary\" | \"info\" | \"danger\"", + "type": "\"success\" | \"warning\" | \"secondary\" | \"info\" | \"danger\" | \"contrast\"", "default": "", - "description": "Defines the style of the button, valid values are \"secondary\", \"success\", \"info\", \"warning\", \"danger\"." + "description": "Defines the style of the button, valid values are \"secondary\", \"success\", \"info\", \"warning\", \"danger\", \"contrast\"." }, { "name": "size", @@ -45360,14 +45845,6 @@ "default": "", "description": "Size of the element relative to 100%." }, - { - "name": "step", - "optional": true, - "readonly": false, - "type": "number", - "default": "5", - "description": "Step factor to increment/decrement the size of the panels while pressing the arrow keys." - }, { "name": "style", "optional": true, @@ -45455,6 +45932,14 @@ "default": "session", "description": "Defines where a stateful splitter keeps its state, valid values are \"session\" for sessionStorage and \"local\" for localStorage." }, + { + "name": "step", + "optional": true, + "readonly": false, + "type": "number", + "default": "5", + "description": "Step factor to increment/decrement the size of the panels while pressing the arrow keys." + }, { "name": "unstyled", "optional": true, @@ -45901,6 +46386,15 @@ "readonly": false, "type": "string", "default": "", + "description": "Style class to add when item begins to get displayed.", + "deprecated": "since 10.5.2 Use 'enterFromClassName' option instead." + }, + { + "name": "enterFromClassName", + "optional": true, + "readonly": false, + "type": "string", + "default": "", "description": "Style class to add when item begins to get displayed." }, { @@ -45933,6 +46427,15 @@ "readonly": false, "type": "string", "default": "", + "description": "Style class to add when item begins to get hidden.", + "deprecated": "since 10.5.2 Use 'leaveFromClassName' option instead." + }, + { + "name": "leaveFromClassName", + "optional": true, + "readonly": false, + "type": "string", + "default": "", "description": "Style class to add when item begins to get hidden." }, { @@ -48297,7 +48800,7 @@ "name": "severity", "optional": true, "readonly": false, - "type": "\"error\" | \"success\" | \"info\" | \"warn\"", + "type": "\"error\" | \"success\" | \"secondary\" | \"info\" | \"warn\" | \"contrast\"", "description": "Severity level of the message." }, { @@ -48596,6 +49099,14 @@ "default": "", "description": "Used to get the child elements of the component." }, + { + "name": "disabled", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the element should be disabled." + }, { "name": "iconPos", "optional": true, @@ -48604,6 +49115,14 @@ "default": "left", "description": "Position of the icon, valid values are \"left\" and \"right\"." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "offIcon", "optional": true, @@ -48652,6 +49171,14 @@ "default": "", "description": "Used to configure passthrough(pt) options of the component." }, + { + "name": "readonly", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "", + "description": "When present, it specifies that an input field is read-only." + }, { "name": "tooltip", "optional": true, @@ -48810,6 +49337,20 @@ "readonly": false, "type": "ComponentHooks", "description": "Used to manage all lifecycle hooks" + }, + { + "name": "input", + "optional": true, + "readonly": false, + "type": "ToggleButtonPassThroughType>", + "description": "Uses to pass attributes to the input's DOM element." + }, + { + "name": "box", + "optional": true, + "readonly": false, + "type": "CheckboxPassThroughType>", + "description": "Used to pass attributes to the box's DOM element." } ], "callbacks": [] @@ -49060,7 +49601,7 @@ "parameters": [ { "name": "target", - "type": "undefined | string | string[] | HTMLElement | RefObject", + "type": "string | string[] | HTMLElement | RefObject", "description": "Target element or if undefined will use current target." } ], @@ -49084,7 +49625,7 @@ "parameters": [ { "name": "target", - "type": "undefined | string | string[] | HTMLElement | RefObject", + "type": "string | string[] | HTMLElement | RefObject", "description": "Target element or if undefined will use current target." } ], @@ -49096,7 +49637,7 @@ "parameters": [ { "name": "target", - "type": "undefined | string | string[] | HTMLElement | RefObject", + "type": "string | string[] | HTMLElement | RefObject", "description": "Target element or if undefined will use current target." } ], @@ -49308,6 +49849,14 @@ "default": "", "description": "Target element on global tooltip option." }, + { + "name": "unstyled", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When enabled, it removes component related styles in the core." + }, { "name": "updateDelay", "optional": true, @@ -49697,6 +50246,14 @@ "type": "PassThroughOptions", "default": "", "description": "Used to configure passthrough(pt) options of the component." + }, + { + "name": "unstyled", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When enabled, it removes component related styles in the core." } ] }, @@ -51481,6 +52038,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "metaKeySelection", "optional": true, @@ -54095,6 +54660,14 @@ "default": "false", "description": "When present, it specifies that the element value cannot be altered." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "pt", "optional": true, @@ -54228,12 +54801,6 @@ "optional": false, "readonly": false, "type": "TriStateCheckboxProps" - }, - { - "name": "state", - "optional": false, - "readonly": false, - "type": "TriStateCheckboxState" } ], "callbacks": [] @@ -54250,11 +54817,18 @@ "description": "Uses to pass attributes to the root's DOM element." }, { - "name": "checkbox", + "name": "input", "optional": true, "readonly": false, - "type": "TriStateCheckboxPassThroughType>", - "description": "Uses to pass attributes to the checkbox box's DOM element." + "type": "CheckboxPassThroughType>", + "description": "Uses to pass attributes to the input's DOM element." + }, + { + "name": "box", + "optional": true, + "readonly": false, + "type": "CheckboxPassThroughType>", + "description": "Used to pass attributes to the box's DOM element." }, { "name": "tooltip", @@ -54293,20 +54867,6 @@ } ], "callbacks": [] - }, - "TriStateCheckboxState": { - "description": "Defines current inline state in TriStateCheckbox component.", - "relatedProp": "", - "props": [ - { - "name": "focused", - "optional": false, - "readonly": false, - "type": "boolean", - "description": "Focused state as a boolean." - } - ], - "callbacks": [] } } }, @@ -54435,7 +54995,7 @@ "returnType": "void" } ], - "extendedBy": "AutoCompleteChangeEvent,CheckboxChangeEvent,CheckboxClickEvent,ChipsChangeEvent,ColorPickerChangeEvent,DropdownChangeEvent,InputMaskChangeEvent,InputNumberValueChangeEvent,RadioButtonChangeEvent,RadioButtonClickEvent,RatingChangeEvent,SelectButtonChangeEvent,TreeSelectChangeEvent,TriStateCheckboxChangeEvent" + "extendedBy": "AutoCompleteChangeEvent,CheckboxChangeEvent,ChipsChangeEvent,ColorPickerChangeEvent,DropdownChangeEvent,InputMaskChangeEvent,InputNumberValueChangeEvent,RadioButtonChangeEvent,RatingChangeEvent,SelectButtonChangeEvent,TreeSelectChangeEvent,TriStateCheckboxChangeEvent" }, "FormBooleanEvent": { "relatedProp": "", diff --git a/components/doc/common/docapitable.js b/components/doc/common/docapitable.js index d32edf3eab..3bbe9754c9 100644 --- a/components/doc/common/docapitable.js +++ b/components/doc/common/docapitable.js @@ -116,13 +116,13 @@ const DocApiTable = (props) => { ); }) ) : k === 'default' ? ( -
+
{ObjectUtils.isEmpty(v) ? 'null' : createContent(v, k === 'name', d['deprecated'])}
) : k === 'type' ? ( {createContent(v, k === 'name', d['deprecated'])} ) : k === 'returnType' ? ( -
+
{createContent(v, k === 'name', d['deprecated'])}
) : k === 'description' || k === 'values' ? ( diff --git a/components/doc/datatable/scroll/frozencolumnsdoc.js b/components/doc/datatable/scroll/frozencolumnsdoc.js index 99482b6a25..83edd47f84 100644 --- a/components/doc/datatable/scroll/frozencolumnsdoc.js +++ b/components/doc/datatable/scroll/frozencolumnsdoc.js @@ -164,7 +164,7 @@ export default function FrozenColumnsDemo() { <>

- A column can be fixed during horizontal scrolling by enablng the frozen property. The location is defined with the alignFrozen that can be left or right. + A column can be fixed during horizontal scrolling by enabling the frozen property. The location is defined with the alignFrozen that can be left or right.

diff --git a/components/doc/dialog/theming/styleddoc.js b/components/doc/dialog/theming/styleddoc.js index 379242eb0e..a505b64293 100644 --- a/components/doc/dialog/theming/styleddoc.js +++ b/components/doc/dialog/theming/styleddoc.js @@ -20,7 +20,7 @@ export function StyledDoc(props) { Container element. - p-dialog-titlebar + p-dialog-header Container of header. @@ -28,13 +28,17 @@ export function StyledDoc(props) { Header element. - p-dialog-titlebar-icon + p-dialog-header-icons Icon container inside header. - p-dialog-titlebar-close + p-dialog-header-close Close icon element. + + p-dialog-header-maximize + Maximize icon element. + p-dialog-content Content element diff --git a/components/doc/dropdown/checkmarkdoc.js b/components/doc/dropdown/checkmarkdoc.js new file mode 100644 index 0000000000..0543626b24 --- /dev/null +++ b/components/doc/dropdown/checkmarkdoc.js @@ -0,0 +1,83 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { Dropdown } from '@/components/lib/dropdown/Dropdown'; +import { useState } from 'react'; + +export function CheckmarkDoc(props) { + const [selectedCity, setSelectedCity] = useState(null); + const cities = [ + { name: 'New York', code: 'NY' }, + { name: 'Rome', code: 'RM' }, + { name: 'London', code: 'LDN' }, + { name: 'Istanbul', code: 'IST' }, + { name: 'Paris', code: 'PRS' } + ]; + + const code = { + basic: ` + setSelectedCity(e.value)} options={cities} optionLabel="name" + placeholder="Select a City" className="w-full md:w-14rem" checkmark={true} highlightOnSelect={false} /> + `, + javascript: ` +import React, { useState } from "react"; +import { Dropdown } from 'primereact/dropdown'; + +export default function CheckmarkDemo() { + const [selectedCity, setSelectedCity] = useState(null); + const cities = [ + { name: 'New York', code: 'NY' }, + { name: 'Rome', code: 'RM' }, + { name: 'London', code: 'LDN' }, + { name: 'Istanbul', code: 'IST' }, + { name: 'Paris', code: 'PRS' } + ]; + + return ( +
+ setSelectedCity(e.value)} options={cities} optionLabel="name" + placeholder="Select a City" className="w-full md:w-14rem" checkmark={true} highlightOnSelect={false} /> +
+ ) +} + `, + typescript: ` +import React, { useState } from "react"; +import { Dropdown, DropdownChangeEvent } from 'primereact/dropdown'; + +interface City { + name: string; + code: string; +} + +export default function CheckmarkDemo() { + const [selectedCity, setSelectedCity] = useState(null); + const cities: City[] = [ + { name: 'New York', code: 'NY' }, + { name: 'Rome', code: 'RM' }, + { name: 'London', code: 'LDN' }, + { name: 'Istanbul', code: 'IST' }, + { name: 'Paris', code: 'PRS' } + ]; + + return ( +
+ setSelectedCity(e.value)} options={cities} optionLabel="name" + placeholder="Select a City" className="w-full md:w-14rem" checkmark={true} highlightOnSelect={false} /> +
+ ) +} + ` + }; + + return ( + <> + +

An alternative way to highlight the selected option is displaying a checkmark instead.

+
+
+ setSelectedCity(e.value)} options={cities} optionLabel="name" placeholder="Select a City" className="w-full md:w-14rem" checkmark={true} highlightOnSelect={false} /> +
+ + + ); +} diff --git a/components/doc/menu/theming/tailwinddoc.js b/components/doc/menu/theming/tailwinddoc.js index fb852ed014..f4184d8ffb 100644 --- a/components/doc/menu/theming/tailwinddoc.js +++ b/components/doc/menu/theming/tailwinddoc.js @@ -23,18 +23,21 @@ const Tailwind = { menu: { className: classNames('m-0 p-0 list-none', 'outline-none') }, - content: ({ context }) => ({ + content: ({ state }) => ({ className: classNames( 'text-gray-700 dark:text-white/80 transition-shadow duration-200 rounded-none', 'hover:text-gray-700 dark:hover:text-white/80 hover:bg-gray-200 dark:hover:bg-gray-800/80', // Hover { - 'bg-gray-300 text-gray-700 dark:text-white/80 dark:bg-gray-800/90': context.focused + 'bg-gray-300 text-gray-700 dark:text-white/80 dark:bg-gray-800/90': state.focused } ) }), action: { className: classNames('text-gray-700 dark:text-white/80 py-3 px-5 select-none', 'cursor-pointer flex items-center no-underline overflow-hidden relative') }, + menuitem: { + className: classNames('hover:bg-gray-200') + }, icon: 'text-gray-600 dark:text-white/70 mr-2', submenuheader: { className: classNames('m-0 p-3 text-gray-700 dark:text-white/80 bg-white dark:bg-gray-900 font-bold rounded-tl-none rounded-tr-none') diff --git a/components/doc/message/severitydoc.js b/components/doc/message/severitydoc.js index 37a41d9107..3816c16252 100644 --- a/components/doc/message/severitydoc.js +++ b/components/doc/message/severitydoc.js @@ -9,6 +9,8 @@ export function SeverityDoc(props) { + + `, javascript: ` import React from 'react'; @@ -21,6 +23,8 @@ export default function SeverityDemo() { + +
) } @@ -36,6 +40,8 @@ export default function SeverityDemo() { + +
) } @@ -54,6 +60,8 @@ export default function SeverityDemo() { + + diff --git a/components/doc/message/theming/tailwinddoc.js b/components/doc/message/theming/tailwinddoc.js index e1858a7a65..857e575ab2 100644 --- a/components/doc/message/theming/tailwinddoc.js +++ b/components/doc/message/theming/tailwinddoc.js @@ -33,6 +33,8 @@ export default function UnstyledDemo() { + + ) } diff --git a/components/doc/messages/severitydoc.js b/components/doc/messages/severitydoc.js index 8e1fdc8cee..019043d374 100644 --- a/components/doc/messages/severitydoc.js +++ b/components/doc/messages/severitydoc.js @@ -14,7 +14,9 @@ export function SeverityDoc(props) { { sticky: true, severity: 'info', summary: 'Info', detail: 'Message Content', closable: false }, { sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content', closable: false }, { sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content', closable: false }, - { sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false } + { sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false }, + { sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content', closable: false }, + { sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content', closable: false } ]); } }); @@ -26,6 +28,8 @@ msgs.current.show([ {sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content', closable: false}, {sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content', closable: false}, {sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false} + {sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content', closable: false} + {sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content', closable: false} ]); `, javascript: ` @@ -44,6 +48,8 @@ export default function SeverityDemo() { { sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content', closable: false }, { sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content', closable: false }, { sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content', closable: false } + { sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content', closable: false } + { sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content', closable: false } ]); } }); @@ -68,6 +74,8 @@ export default function SeverityDemo() { {sticky: true, severity: 'success', summary: 'Success', detail: 'Message Content'}, {sticky: true, severity: 'warn', summary: 'Warning', detail: 'Message Content'}, {sticky: true, severity: 'error', summary: 'Error', detail: 'Message Content'} + {sticky: true, severity: 'secondary', summary: 'Secondary', detail: 'Message Content'} + {sticky: true, severity: 'contrast', summary: 'Contrast', detail: 'Message Content'} ]); }); diff --git a/components/doc/metergroup/accessibilitydoc.js b/components/doc/metergroup/accessibilitydoc.js new file mode 100644 index 0000000000..6c1478a1e2 --- /dev/null +++ b/components/doc/metergroup/accessibilitydoc.js @@ -0,0 +1,26 @@ +import { DevelopmentSection } from '@/components/doc/common/developmentsection'; +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import Link from 'next/link'; + +export function AccessibilityDoc() { + const code = { + basic: ` +Options + + + + ` + }; + + return ( + +

Screen Reader

+

+ MeterGroup component uses meter role in addition to the aria-valuemin, aria-valuemax and aria-valuenow attributes. Value to describe the component can be defined using aria-labelledby prop. +

+

Keyboard Support

+

Component does not include any interactive elements.

+
+ ); +} diff --git a/components/doc/metergroup/basicdoc.js b/components/doc/metergroup/basicdoc.js new file mode 100644 index 0000000000..c6052ad59a --- /dev/null +++ b/components/doc/metergroup/basicdoc.js @@ -0,0 +1,55 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; + +export function BasicDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function BasicDemo() { + const values = [{ label: 'Space used', value: 15 }]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function BasicDemo() { + const values = [{ label: 'Space used', value: 15 }]; + + return ( +
+ +
+ ) +} + ` + }; + + const values = [{ label: 'Space used', value: 15 }]; + + return ( + <> + +

+ MeterGroup requires a value as the data to display where each item in the collection should be a type of MeterItem. +

+
+
+ +
+ + + ); +} diff --git a/components/doc/metergroup/icondoc.js b/components/doc/metergroup/icondoc.js new file mode 100644 index 0000000000..6c854c3698 --- /dev/null +++ b/components/doc/metergroup/icondoc.js @@ -0,0 +1,68 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; + +export function IconDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function IconDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16, icon: 'pi pi-table' }, + { label: 'Messages', color: '#fbbf24', value: 8, icon: 'pi pi-inbox' }, + { label: 'Media', color: '#60a5fa', value: 24, icon: 'pi pi-image' }, + { label: 'System', color: '#c084fc', value: 10, icon: 'pi pi-cog' } + ]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function IconDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16, icon: 'pi pi-table' }, + { label: 'Messages', color: '#fbbf24', value: 8, icon: 'pi pi-inbox' }, + { label: 'Media', color: '#60a5fa', value: 24, icon: 'pi pi-image' }, + { label: 'System', color: '#c084fc', value: 10, icon: 'pi pi-cog' } + ]; + + return ( +
+ +
+ ) +} + ` + }; + + const values = [ + { label: 'Apps', color: '#34d399', value: 16, icon: 'pi pi-table' }, + { label: 'Messages', color: '#fbbf24', value: 8, icon: 'pi pi-inbox' }, + { label: 'Media', color: '#60a5fa', value: 24, icon: 'pi pi-image' }, + { label: 'System', color: '#c084fc', value: 10, icon: 'pi pi-cog' } + ]; + + return ( + <> + +

Icons can be displayed next to the labels instead of the default marker.

+
+
+ +
+ + + ); +} diff --git a/components/doc/metergroup/importdoc.js b/components/doc/metergroup/importdoc.js new file mode 100644 index 0000000000..56bae31fe2 --- /dev/null +++ b/components/doc/metergroup/importdoc.js @@ -0,0 +1,17 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; + +export function ImportDoc(props) { + const code = { + basic: ` +import { MeterGroup } from 'primereact/metergroup'; + ` + }; + + return ( + <> + + + + ); +} diff --git a/components/doc/metergroup/labeldoc.js b/components/doc/metergroup/labeldoc.js new file mode 100644 index 0000000000..74897fb8da --- /dev/null +++ b/components/doc/metergroup/labeldoc.js @@ -0,0 +1,71 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; + +export function LabelDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function LabelDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function LabelDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( +
+ +
+ ) +} + ` + }; + + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( + <> + +

+ The position of the labels relative to the meters is defined using the labelPosition property. The default orientation of the labels is horizontal, and the vertical alternative is available through the{' '} + labelOrientation option. +

+
+
+ +
+ + + ); +} diff --git a/components/doc/metergroup/minmaxdoc.js b/components/doc/metergroup/minmaxdoc.js new file mode 100644 index 0000000000..8bb78ce7e1 --- /dev/null +++ b/components/doc/metergroup/minmaxdoc.js @@ -0,0 +1,70 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; + +export function MinMaxDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function MinMaxDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function MinMaxDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( +
+ +
+ ) +} + ` + }; + + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( + <> + +

+ Boundaries are configured with the min and max values whose defaults are 0 and 100 respectively. +

+
+
+ +
+ + + ); +} diff --git a/components/doc/metergroup/multipledoc.js b/components/doc/metergroup/multipledoc.js new file mode 100644 index 0000000000..580a13540a --- /dev/null +++ b/components/doc/metergroup/multipledoc.js @@ -0,0 +1,68 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; + +export function MultipleDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function MultipleDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function MultipleDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( +
+ +
+ ) +} + ` + }; + + const values = [ + { label: 'Apps', color: '#34d399', value: 16 }, + { label: 'Messages', color: '#fbbf24', value: 8 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 10 } + ]; + + return ( + <> + +

Adding more items to the array displays the meters in a group.

+
+
+ +
+ + + ); +} diff --git a/components/doc/metergroup/pt/ptdoc.js b/components/doc/metergroup/pt/ptdoc.js new file mode 100644 index 0000000000..69c8a26d96 --- /dev/null +++ b/components/doc/metergroup/pt/ptdoc.js @@ -0,0 +1,454 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { Menubar } from '@/components/lib/menubar/Menubar'; + +export function PTDoc(props) { + const items = [ + { + label: 'File', + icon: 'pi pi-fw pi-file', + items: [ + { + label: 'New', + icon: 'pi pi-fw pi-plus', + items: [ + { + label: 'Bookmark', + icon: 'pi pi-fw pi-bookmark' + }, + { + label: 'Video', + icon: 'pi pi-fw pi-video' + } + ] + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-trash' + }, + { + separator: true + }, + { + label: 'Export', + icon: 'pi pi-fw pi-external-link' + } + ] + }, + { + label: 'Edit', + icon: 'pi pi-fw pi-pencil', + items: [ + { + label: 'Left', + icon: 'pi pi-fw pi-align-left' + }, + { + label: 'Right', + icon: 'pi pi-fw pi-align-right' + }, + { + label: 'Center', + icon: 'pi pi-fw pi-align-center' + }, + { + label: 'Justify', + icon: 'pi pi-fw pi-align-justify' + } + ] + }, + { + label: 'Users', + icon: 'pi pi-fw pi-user', + items: [ + { + label: 'New', + icon: 'pi pi-fw pi-user-plus' + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-user-minus' + }, + { + label: 'Search', + icon: 'pi pi-fw pi-users', + items: [ + { + label: 'Filter', + icon: 'pi pi-fw pi-filter', + items: [ + { + label: 'Print', + icon: 'pi pi-fw pi-print' + } + ] + }, + { + icon: 'pi pi-fw pi-bars', + label: 'List' + } + ] + } + ] + }, + { + label: 'Events', + icon: 'pi pi-fw pi-calendar', + items: [ + { + label: 'Edit', + icon: 'pi pi-fw pi-pencil', + items: [ + { + label: 'Save', + icon: 'pi pi-fw pi-calendar-plus' + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-calendar-minus' + } + ] + }, + { + label: 'Archive', + icon: 'pi pi-fw pi-calendar-times', + items: [ + { + label: 'Remove', + icon: 'pi pi-fw pi-calendar-minus' + } + ] + } + ] + }, + { + label: 'Quit', + icon: 'pi pi-fw pi-power-off' + } + ]; + + const code = { + basic: ` + ({ + className: context.active ? 'bg-primary-200 border-round-sm' : undefined + }) + }} +/> +`, + javascript: ` +import React from 'react'; +import { Menubar } from 'primereact/menubar'; + +export default function PTDemo() { + const items = [ + { + label: 'File', + icon: 'pi pi-fw pi-file', + items: [ + { + label: 'New', + icon: 'pi pi-fw pi-plus', + items: [ + { + label: 'Bookmark', + icon: 'pi pi-fw pi-bookmark' + }, + { + label: 'Video', + icon: 'pi pi-fw pi-video' + }, + + ] + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-trash' + }, + { + separator: true + }, + { + label: 'Export', + icon: 'pi pi-fw pi-external-link' + } + ] + }, + { + label: 'Edit', + icon: 'pi pi-fw pi-pencil', + items: [ + { + label: 'Left', + icon: 'pi pi-fw pi-align-left' + }, + { + label: 'Right', + icon: 'pi pi-fw pi-align-right' + }, + { + label: 'Center', + icon: 'pi pi-fw pi-align-center' + }, + { + label: 'Justify', + icon: 'pi pi-fw pi-align-justify' + }, + + ] + }, + { + label: 'Users', + icon: 'pi pi-fw pi-user', + items: [ + { + label: 'New', + icon: 'pi pi-fw pi-user-plus', + + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-user-minus', + + }, + { + label: 'Search', + icon: 'pi pi-fw pi-users', + items: [ + { + label: 'Filter', + icon: 'pi pi-fw pi-filter', + items: [ + { + label: 'Print', + icon: 'pi pi-fw pi-print' + } + ] + }, + { + icon: 'pi pi-fw pi-bars', + label: 'List' + } + ] + } + ] + }, + { + label: 'Events', + icon: 'pi pi-fw pi-calendar', + items: [ + { + label: 'Edit', + icon: 'pi pi-fw pi-pencil', + items: [ + { + label: 'Save', + icon: 'pi pi-fw pi-calendar-plus' + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-calendar-minus' + } + ] + }, + { + label: 'Archive', + icon: 'pi pi-fw pi-calendar-times', + items: [ + { + label: 'Remove', + icon: 'pi pi-fw pi-calendar-minus' + } + ] + } + ] + }, + { + label: 'Quit', + icon: 'pi pi-fw pi-power-off' + } + ]; + + return ( +
+ ({ + className: context.active ? 'bg-primary-200 border-round-sm' : undefined + }) + }} + /> +
+ ) +} + `, + typescript: ` +import React from 'react'; +import { Menubar } from 'primereact/menubar'; +import { MenuItem } from 'primereact/menuitem'; + +export default function PTDemo() { + const items: MenuItem[] = [ + { + label: 'File', + icon: 'pi pi-fw pi-file', + items: [ + { + label: 'New', + icon: 'pi pi-fw pi-plus', + items: [ + { + label: 'Bookmark', + icon: 'pi pi-fw pi-bookmark' + }, + { + label: 'Video', + icon: 'pi pi-fw pi-video' + }, + + ] + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-trash' + }, + { + separator: true + }, + { + label: 'Export', + icon: 'pi pi-fw pi-external-link' + } + ] + }, + { + label: 'Edit', + icon: 'pi pi-fw pi-pencil', + items: [ + { + label: 'Left', + icon: 'pi pi-fw pi-align-left' + }, + { + label: 'Right', + icon: 'pi pi-fw pi-align-right' + }, + { + label: 'Center', + icon: 'pi pi-fw pi-align-center' + }, + { + label: 'Justify', + icon: 'pi pi-fw pi-align-justify' + }, + + ] + }, + { + label: 'Users', + icon: 'pi pi-fw pi-user', + items: [ + { + label: 'New', + icon: 'pi pi-fw pi-user-plus', + + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-user-minus', + + }, + { + label: 'Search', + icon: 'pi pi-fw pi-users', + items: [ + { + label: 'Filter', + icon: 'pi pi-fw pi-filter', + items: [ + { + label: 'Print', + icon: 'pi pi-fw pi-print' + } + ] + }, + { + icon: 'pi pi-fw pi-bars', + label: 'List' + } + ] + } + ] + }, + { + label: 'Events', + icon: 'pi pi-fw pi-calendar', + items: [ + { + label: 'Edit', + icon: 'pi pi-fw pi-pencil', + items: [ + { + label: 'Save', + icon: 'pi pi-fw pi-calendar-plus' + }, + { + label: 'Delete', + icon: 'pi pi-fw pi-calendar-minus' + } + ] + }, + { + label: 'Archive', + icon: 'pi pi-fw pi-calendar-times', + items: [ + { + label: 'Remove', + icon: 'pi pi-fw pi-calendar-minus' + } + ] + } + ] + }, + { + label: 'Quit', + icon: 'pi pi-fw pi-power-off' + } + ]; + + return ( +
+ ({ + className: context.active ? 'bg-primary-200 border-round-sm' : undefined + }) + }} + /> +
+ ) +} + ` + }; + + return ( + <> + +
+ ({ + className: context.active ? 'bg-primary-200 border-round-sm' : undefined + }) + }} + /> +
+ + + ); +} diff --git a/components/doc/metergroup/pt/wireframe.js b/components/doc/metergroup/pt/wireframe.js new file mode 100644 index 0000000000..2bfcccfa8c --- /dev/null +++ b/components/doc/metergroup/pt/wireframe.js @@ -0,0 +1,12 @@ +import { DocSectionText } from '@/components/doc/common/docsectiontext'; + +export const Wireframe = (props) => { + return ( + <> + +
+ metergroup +
+ + ); +}; diff --git a/components/doc/metergroup/templatedoc.js b/components/doc/metergroup/templatedoc.js new file mode 100644 index 0000000000..2680477e05 --- /dev/null +++ b/components/doc/metergroup/templatedoc.js @@ -0,0 +1,226 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; +import { Button } from '@/components/lib/button/Button'; +import { Card } from '@/components/lib/card/Card'; + +export function TemplateDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function TemplateDemo() { + const meter = (props, attr) => ; + + const labelList = ({ values }) => ( +
+ {values.map((item, index) => ( + +
+
+ {item.label} + {item.value}% +
+ + + +
+
+ ))} +
+ ); + + const start = ({ totalPercent }) => ( +
+ Storage + + {totalPercent}% + + 1TB +
+ ); + + const end = ( +
+
+ ); + + const values = [ + { label: 'Apps', color1: '#34d399', color2: '#fbbf24', value: 25, icon: 'pi pi-table' }, + { label: 'Messages', color1: '#fbbf24', color2: '#60a5fa', value: 15, icon: 'pi pi-inbox' }, + { label: 'Media', color1: '#60a5fa', color2: '#c084fc', value: 20, icon: 'pi pi-image' }, + { label: 'System', color1: '#c084fc', color2: '#c084fc', value: 10, icon: 'pi pi-cog', meterTemplate: meter } + ]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function TemplateDemo() { + const meter = (props: any, attr: any) => ( + + ); + + const start = ({ totalPercent }: {totalPercent: number}) => ( +
+ Storage + + {totalPercent}% + + 1TB +
+ ); + + const end = ( +
+
+ ); + + const labelList = ({ values }: {values: any[]}) => ( +
+ {values.map((item, index) => ( + +
+
+ {item.label} + {item.value}% +
+ + + +
+
+ ))} +
+ ); + + const values = [ + { + label: 'Apps', + color1: '#34d399', + color2: '#fbbf24', + value: 25, + icon: 'pi pi-table', + }, + { + label: 'Messages', + color1: '#fbbf24', + color2: '#60a5fa', + value: 15, + icon: 'pi pi-inbox', + }, + { + label: 'Media', + color1: '#60a5fa', + color2: '#c084fc', + value: 20, + icon: 'pi pi-image', + }, + { + label: 'System', + color1: '#c084fc', + color2: '#c084fc', + value: 10, + icon: 'pi pi-cog', + meterTemplate: meter, + }, + ]; + + return ( +
+ +
+ ) +} + ` + }; + + const meter = (props, attr) => ; + + const labelList = ({ values }) => ( +
+ {values.map((item, index) => ( + +
+
+ {item.label} + {item.value}% +
+ + + +
+
+ ))} +
+ ); + + const start = ({ totalPercent }) => ( +
+ Storage + + {totalPercent}% + + 1TB +
+ ); + + const end = ( +
+
+ ); + + const values = [ + { label: 'Apps', color1: '#34d399', color2: '#fbbf24', value: 25, icon: 'pi pi-table' }, + { label: 'Messages', color1: '#fbbf24', color2: '#60a5fa', value: 15, icon: 'pi pi-inbox' }, + { label: 'Media', color1: '#60a5fa', color2: '#c084fc', value: 20, icon: 'pi pi-image' }, + { label: 'System', color1: '#c084fc', color2: '#c084fc', value: 10, icon: 'pi pi-cog', meterTemplate: meter } + ]; + + return ( + <> + +

+ MeterGroup requires a value as the data to display where each item in the collection should be a type of MeterItem. +

+
+
+ +
+ + + ); +} diff --git a/components/doc/metergroup/theming/styleddoc.js b/components/doc/metergroup/theming/styleddoc.js new file mode 100644 index 0000000000..8d1a458f7f --- /dev/null +++ b/components/doc/metergroup/theming/styleddoc.js @@ -0,0 +1,76 @@ +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import Link from 'next/link'; + +export function StyledDoc() { + return ( + <> + +

List of class names used in the styled mode.

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameElement
p-metergroupContainer element.
p-metergroup-horizontalContainer element when orientation mode is horizontal.
p-metergroup-verticalContainer element when orientation mode is vertical.
p-metergroup-meter-containerContainer of the meters.
p-metergroup-meterContent of a meter.
p-metergroup-label-listContainer element of the list of labels.
p-metergroup-label-list-startContainer element when label position is start.
p-metergroup-label-list-endContainer element when label position is end.
p-metergroup-label-list-horizontalContainer element when label orientation is horizontal.
p-metergroup-label-list-verticalContainer element when label orientation is vertical.
p-metergroup-label-list-itemContainer element of a list item.
p-metergroup-label-list-typeContainer element of a list type.
p-metergroup-labelContent of a label.
+
+ + ); +} diff --git a/components/doc/metergroup/verticaldoc.js b/components/doc/metergroup/verticaldoc.js new file mode 100644 index 0000000000..13c2578acc --- /dev/null +++ b/components/doc/metergroup/verticaldoc.js @@ -0,0 +1,70 @@ +import { DocSectionCode } from '@/components/doc/common/docsectioncode'; +import { DocSectionText } from '@/components/doc/common/docsectiontext'; +import { MeterGroup } from '@/components/lib/metergroup/MeterGroup'; + +export function VerticalDoc(props) { + const code = { + basic: ` + + `, + javascript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function VerticalDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 24 }, + { label: 'Messages', color: '#fbbf24', value: 16 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 12 } + ]; + + return ( +
+ +
+ ) +} + `, + typescript: ` +import React, { useEffect, useRef } from 'react'; +import { MeterGroup } from 'primereact/metergroup'; + +export default function VerticalDemo() { + const values = [ + { label: 'Apps', color: '#34d399', value: 24 }, + { label: 'Messages', color: '#fbbf24', value: 16 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 12 } + ]; + + return ( +
+ +
+ ) +} + ` + }; + + const values = [ + { label: 'Apps', color: '#34d399', value: 24 }, + { label: 'Messages', color: '#fbbf24', value: 16 }, + { label: 'Media', color: '#60a5fa', value: 24 }, + { label: 'System', color: '#c084fc', value: 12 } + ]; + + return ( + <> + +

+ MeterGroup requires a value as the data to display where each item in the collection should be a type of MeterItem. +

+
+
+ +
+ + + ); +} diff --git a/components/doc/organizationchart/basicdoc.js b/components/doc/organizationchart/basicdoc.js index 88c93c3b4b..086050c441 100644 --- a/components/doc/organizationchart/basicdoc.js +++ b/components/doc/organizationchart/basicdoc.js @@ -92,7 +92,7 @@ import { OrganizationChart } from 'primereact/organizationchart'; import { TreeNode } from 'primereact/treenode'; export default function BasicDoc() { - const [data] = useState([ + const [data] = useState([ { label: 'Argentina', expanded: true, diff --git a/components/doc/organizationchart/pt/ptdoc.js b/components/doc/organizationchart/pt/ptdoc.js index f6cd6ce570..3d13edc645 100644 --- a/components/doc/organizationchart/pt/ptdoc.js +++ b/components/doc/organizationchart/pt/ptdoc.js @@ -115,7 +115,7 @@ import { TreeNode } from 'primereact/treenode'; export default function PTDemo() { const [selection, setSelection] = useState([]); - const [data] = useState([ + const [data] = useState([ { label: 'Argentina', expanded: true, diff --git a/components/doc/organizationchart/templatedoc.js b/components/doc/organizationchart/templatedoc.js index 08b3b25b97..a13e629aa7 100644 --- a/components/doc/organizationchart/templatedoc.js +++ b/components/doc/organizationchart/templatedoc.js @@ -124,7 +124,7 @@ import { OrganizationChart } from 'primereact/organizationchart'; import { TreeNode } from 'primereact/treenode'; export default function TemplateDemo() { - const [data] = useState([ + const [data] = useState([ { label: 'Argentina', expanded: true, diff --git a/components/doc/panel/theming/styleddoc.js b/components/doc/panel/theming/styleddoc.js index e889852744..9cf0b7e263 100644 --- a/components/doc/panel/theming/styleddoc.js +++ b/components/doc/panel/theming/styleddoc.js @@ -20,7 +20,7 @@ export function StyledDoc(props) { Container element. - p-panel-titlebar + p-panel-header Header section. @@ -28,7 +28,7 @@ export function StyledDoc(props) { Title text of panel. - p-panel-titlebar-toggler + p-panel-toggler Toggle icon. diff --git a/components/doc/sidebar/headlessdoc.js b/components/doc/sidebar/headlessdoc.js index 56d6d9b367..70a7522f80 100644 --- a/components/doc/sidebar/headlessdoc.js +++ b/components/doc/sidebar/headlessdoc.js @@ -1,11 +1,11 @@ import { DocSectionCode } from '@/components/doc/common/docsectioncode'; import { DocSectionText } from '@/components/doc/common/docsectiontext'; -import { Button } from '@/components/lib/button/Button'; -import { Sidebar } from '@/components/lib/sidebar/Sidebar'; import { Avatar } from '@/components/lib/avatar/Avatar'; +import { Button } from '@/components/lib/button/Button'; import { Ripple } from '@/components/lib/ripple/Ripple'; -import { useState, useRef } from 'react'; +import { Sidebar } from '@/components/lib/sidebar/Sidebar'; import { StyleClass } from '@/components/lib/styleclass/StyleClass'; +import { useRef, useState } from 'react'; export function HeadlessDoc(props) { const [visible, setVisible] = useState(false); @@ -207,7 +207,6 @@ export default function HeadlessDemo() { const btnRef2 = useRef(null); const btnRef3 = useRef(null); const btnRef4 = useRef(null); - const [visible, setVisible] = useState(false); return (
diff --git a/components/doc/splitbutton/outlineddoc.js b/components/doc/splitbutton/outlineddoc.js index cce4906ba0..0945e31d34 100644 --- a/components/doc/splitbutton/outlineddoc.js +++ b/components/doc/splitbutton/outlineddoc.js @@ -53,6 +53,7 @@ export function OutlinedDoc(props) { + `, javascript: ` import React, { useRef } from 'react'; @@ -108,6 +109,7 @@ export default function OutlinedDemo() { +
) } @@ -167,6 +169,7 @@ export default function OutlinedDemo() { + ) } @@ -187,6 +190,7 @@ export default function OutlinedDemo() { + diff --git a/components/doc/splitbutton/raiseddoc.js b/components/doc/splitbutton/raiseddoc.js index f94d8efc63..b8ae8bc513 100644 --- a/components/doc/splitbutton/raiseddoc.js +++ b/components/doc/splitbutton/raiseddoc.js @@ -53,6 +53,7 @@ export function RaisedDoc(props) { + `, javascript: ` import React, { useRef } from 'react'; @@ -108,6 +109,7 @@ export default function RaisedDemo() { + ) } @@ -167,6 +169,7 @@ export default function RaisedDemo() { + ) } @@ -187,6 +190,7 @@ export default function RaisedDemo() { + diff --git a/components/doc/splitbutton/roundeddoc.js b/components/doc/splitbutton/roundeddoc.js index fd7dc2310f..5cf4d48ba0 100644 --- a/components/doc/splitbutton/roundeddoc.js +++ b/components/doc/splitbutton/roundeddoc.js @@ -53,6 +53,7 @@ export function RoundedDoc(props) { + `, javascript: ` import React, { useRef } from 'react'; @@ -108,6 +109,7 @@ export default function RoundedDemo() { + ) } @@ -167,6 +169,7 @@ export default function RoundedDemo() { + ) } @@ -187,6 +190,7 @@ export default function RoundedDemo() { + diff --git a/components/doc/splitbutton/severitydoc.js b/components/doc/splitbutton/severitydoc.js index ccbecab98b..379863e402 100644 --- a/components/doc/splitbutton/severitydoc.js +++ b/components/doc/splitbutton/severitydoc.js @@ -53,6 +53,7 @@ export function SeverityDoc(props) { + `, javascript: ` import React, { useRef } from 'react'; @@ -108,6 +109,7 @@ export default function SeverityDemo() { + ) } @@ -167,6 +169,7 @@ export default function SeverityDemo() { + ) } @@ -187,6 +190,7 @@ export default function SeverityDemo() { + diff --git a/components/doc/splitbutton/templatedoc.js b/components/doc/splitbutton/templatedoc.js index 45c25ed11f..8cb1a13bba 100644 --- a/components/doc/splitbutton/templatedoc.js +++ b/components/doc/splitbutton/templatedoc.js @@ -42,7 +42,7 @@ export function TemplateDoc(props) { const code = { basic: ` -Prime React
} icon="pi pi-prime" model={items} /> +Prime React
} icon="pi pi-prime" model={items} severity="contrast" /> `, javascript: ` import React, { useRef } from 'react'; @@ -87,7 +87,7 @@ export default function TemplateDemo() { return (
- Prime React} icon="pi pi-prime" model={items} /> + Prime React} icon="pi pi-prime" model={items} severity="contrast" />
) } @@ -136,7 +136,7 @@ export default function TemplateDemo() { return (
- Prime React} icon="pi pi-prime" model={items} /> + Prime React} icon="pi pi-prime" model={items} severity="contrast" />
) } @@ -152,7 +152,7 @@ export default function TemplateDemo() {
- Prime React} icon="pi pi-prime" model={items} /> + Prime React} icon="pi pi-prime" model={items} severity="contrast" />
diff --git a/components/doc/splitbutton/theming/tailwinddoc.js b/components/doc/splitbutton/theming/tailwinddoc.js index 2b2cee543c..7b21d973b8 100644 --- a/components/doc/splitbutton/theming/tailwinddoc.js +++ b/components/doc/splitbutton/theming/tailwinddoc.js @@ -95,6 +95,7 @@ export default function UnstyledDemo() { + ) } diff --git a/components/doc/tag/pilldoc.js b/components/doc/tag/pilldoc.js index 141a6f1cac..bd6d8d746f 100644 --- a/components/doc/tag/pilldoc.js +++ b/components/doc/tag/pilldoc.js @@ -10,6 +10,8 @@ export function PillDoc(props) { + + `, javascript: ` import React from 'react'; @@ -23,6 +25,8 @@ export default function PillDemo() { + + ); } @@ -39,6 +43,8 @@ export default function PillDemo() { + + ); } @@ -58,6 +64,8 @@ export default function PillDemo() { + + diff --git a/components/doc/tag/severitydoc.js b/components/doc/tag/severitydoc.js index 878ca663c4..e9583334c3 100644 --- a/components/doc/tag/severitydoc.js +++ b/components/doc/tag/severitydoc.js @@ -10,6 +10,8 @@ export function SeverityDoc(props) { + + `, javascript: ` import React from 'react'; @@ -23,6 +25,8 @@ export default function SeverityDemo() { + + ); } @@ -39,6 +43,8 @@ export default function SeverityDemo() { + + ); } @@ -58,6 +64,8 @@ export default function SeverityDemo() { + + diff --git a/components/doc/timeline/templatedoc.js b/components/doc/timeline/templatedoc.js index da73415bcc..963e4d95fa 100644 --- a/components/doc/timeline/templatedoc.js +++ b/components/doc/timeline/templatedoc.js @@ -95,7 +95,7 @@ interface TimelineEvent { } export default function TemplateDemo() { - const events: TimelineEvent = [ + const events: TimelineEvent[] = [ { status: 'Ordered', date: '15/10/2020 10:30', icon: 'pi pi-shopping-cart', color: '#9C27B0', image: 'game-controller.jpg' }, { status: 'Processing', date: '15/10/2020 14:00', icon: 'pi pi-cog', color: '#673AB7' }, { status: 'Shipped', date: '15/10/2020 16:15', icon: 'pi pi-shopping-cart', color: '#FF9800' }, @@ -113,7 +113,7 @@ export default function TemplateDemo() { const customizedContent = (item: TimelineEvent) => { return ( - { item.image && {item.name}} + { item.image && {item.image}}

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!

diff --git a/components/doc/toast/severitydoc.js b/components/doc/toast/severitydoc.js index db8dd67e02..fbabdaebe7 100644 --- a/components/doc/toast/severitydoc.js +++ b/components/doc/toast/severitydoc.js @@ -23,13 +23,23 @@ export function SeverityDoc(props) { toast.current.show({ severity: 'error', summary: 'Error', detail: 'Message Content', life: 3000 }); }; + const showSecondary = () => { + toast.current.show({ severity: 'secondary', summary: 'Secondary', detail: 'Message Content', life: 3000 }); + }; + + const showContrast = () => { + toast.current.show({ severity: 'contrast', summary: 'Contrast', detail: 'Message Content', life: 3000 }); + }; + const code = { basic: ` - + state is: {state} + + + ); + } + + function BasicDemo1({ state }) { + const [text, setText] = useState(''); + + const ref = useRef(); + + return ( +
+ + { + // eslint-disable-next-line no-console + console.log(`Editor. state is:${state}`); + setText(e.htmlValue); + }} + onLoad={(q) => { + q.setText('hi'); + }} + /> +
+ ); + } + + const { getByTestId } = render(); + + fireEvent.click(getByTestId('update-state')); + expect(getByTestId('state').textContent).toBe('2'); + + await waitFor(() => { + expect(consoleSpy).toHaveBeenCalledWith('Editor. state is:2'); + }); + + fireEvent.click(getByTestId('update-state')); + fireEvent.click(getByTestId('update-editor')); + expect(getByTestId('state').textContent).toBe('3'); + await waitFor(() => { + expect(consoleSpy).toHaveBeenCalledWith('Editor. state is:3'); + }); + consoleSpy.mockRestore(); + }); +}); diff --git a/components/lib/hooks/useDisplayOrder.js b/components/lib/hooks/useDisplayOrder.js index fea25bf418..40efe6b8c4 100644 --- a/components/lib/hooks/useDisplayOrder.js +++ b/components/lib/hooks/useDisplayOrder.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import { UniqueComponentId } from '../utils/Utils'; +import { ObjectUtils, UniqueComponentId } from '../utils/Utils'; const groupToDisplayedElements = {}; @@ -22,7 +22,7 @@ export const useDisplayOrder = (group, isVisible = true) => { // Reduce array length, by removing undefined elements at the end of array: const lastIndex = groupToDisplayedElements[group].length - 1; - const lastOrder = groupToDisplayedElements[group].findLastIndex((el) => el !== undefined); + const lastOrder = ObjectUtils.findLastIndex(groupToDisplayedElements[group], (el) => el !== undefined); if (lastOrder !== lastIndex) groupToDisplayedElements[group].splice(lastOrder + 1); diff --git a/components/lib/hooks/useOverlayListener.js b/components/lib/hooks/useOverlayListener.js index 4649b6464b..c749a2960b 100644 --- a/components/lib/hooks/useOverlayListener.js +++ b/components/lib/hooks/useOverlayListener.js @@ -6,7 +6,7 @@ import { useOverlayScrollListener } from './useOverlayScrollListener'; import { useResizeListener } from './useResizeListener'; import { useUnmountEffect } from './useUnmountEffect'; -export const useOverlayListener = ({ target, overlay, listener, when = true }) => { +export const useOverlayListener = ({ target, overlay, listener, when = true, type = 'click' }) => { const targetRef = React.useRef(null); const overlayRef = React.useRef(null); @@ -18,7 +18,7 @@ export const useOverlayListener = ({ target, overlay, listener, when = true }) = */ const [bindDocumentClickListener, unbindDocumentClickListener] = useEventListener({ target: 'window', - type: 'click', + type: type, listener: (event) => { listener && listener(event, { type: 'outside', valid: event.which !== 3 && isOutsideClicked(event) }); } diff --git a/components/lib/hooks/useStyle.js b/components/lib/hooks/useStyle.js index 1b4a89313d..ee36e30012 100644 --- a/components/lib/hooks/useStyle.js +++ b/components/lib/hooks/useStyle.js @@ -12,6 +12,25 @@ export const useStyle = (css, options = {}) => { const defaultDocument = DomHandler.isClient() ? window.document : undefined; const { document = defaultDocument, manual = false, name = `style_${++_id}`, id = undefined, media = undefined } = options; + const getCurrentStyleRef = (styleContainer) => { + const existingStyle = styleContainer.querySelector(`style[data-primereact-style-id="${name}"]`); + + if (existingStyle) { + return existingStyle; + } + + if (id !== undefined) { + const existingElement = document.getElementById(id); + + if (existingElement) { + return existingElement; + } + } + + // finally if not found create the new style + return document.createElement('style'); + }; + const update = (newCSS) => { isLoaded && css !== newCSS && (styleRef.current.textContent = newCSS); }; @@ -21,16 +40,16 @@ export const useStyle = (css, options = {}) => { const styleContainer = context?.styleContainer || document.head; - styleRef.current = styleContainer.querySelector(`style[data-primereact-style-id="${name}"]`) || document.getElementById(id) || document.createElement('style'); + styleRef.current = getCurrentStyleRef(styleContainer); if (!styleRef.current.isConnected) { styleRef.current.type = 'text/css'; - id && (styleRef.current.id = id); - media && (styleRef.current.media = media); + if (id) styleRef.current.id = id; + if (media) styleRef.current.media = media; DomHandler.addNonce(styleRef.current, (context && context.nonce) || PrimeReact.nonce); styleContainer.appendChild(styleRef.current); - name && styleRef.current.setAttribute('data-primereact-style-id', name); + if (name) styleRef.current.setAttribute('data-primereact-style-id', name); } styleRef.current.textContent = css; diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 3bd88f7796..8ea484a107 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -322,6 +322,12 @@ export const InputNumber = React.memo( return; } + if (event.shiftKey || event.altKey) { + isSpecialChar.current = true; + + return; + } + if (props.onKeyDown) { props.onKeyDown(event); @@ -333,21 +339,11 @@ export const InputNumber = React.memo( lastValue.current = event.target.value; - if (event.shiftKey || event.altKey) { - isSpecialChar.current = true; - - return; - } - let selectionStart = event.target.selectionStart; let selectionEnd = event.target.selectionEnd; let inputValue = event.target.value; let newValueStr = null; - if (event.altKey) { - event.preventDefault(); - } - switch (event.code) { //up case 'ArrowUp': @@ -379,6 +375,7 @@ export const InputNumber = React.memo( //enter and tab case 'Tab': + case 'NumpadEnter': case 'Enter': newValueStr = validateValue(parseValue(inputValue)); inputRef.current.value = formatValue(newValueStr); @@ -494,37 +491,17 @@ export const InputNumber = React.memo( break; default: - break; - } - }; - - const onInputKeyUp = (event) => { - if (props.disabled || props.readOnly) { - return; - } - - if (props.onKeyUp) { - props.onKeyUp(event); - - // do not continue if the user defined event wants to prevent - if (event.defaultPrevented) { - return; - } - } - - const code = event.which || event.keyCode; + event.preventDefault(); - if (code !== 13) { - // to submit a form - event.preventDefault(); - } + let char = event.key; + const _isDecimalSign = isDecimalSign(char); + const _isMinusSign = isMinusSign(char); - const char = String.fromCharCode(code); - const _isDecimalSign = isDecimalSign(char); - const _isMinusSign = isMinusSign(char); + if (((event.code.startsWith('Digit') || event.code.startsWith('Numpad')) && Number(char) >= 0 && Number(char) <= 9) || _isMinusSign || _isDecimalSign) { + insert(event, char, { isDecimalSign: _isDecimalSign, isMinusSign: _isMinusSign }); + } - if ((48 <= code && code <= 57) || _isMinusSign || _isDecimalSign) { - insert(event, char, { isDecimalSign: _isDecimalSign, isMinusSign: _isMinusSign }); + break; } }; @@ -1137,7 +1114,6 @@ export const InputNumber = React.memo( name={props.name} autoFocus={props.autoFocus} onKeyDown={onInputKeyDown} - onKeyPress={onInputKeyUp} onInput={onInput} onClick={onInputClick} onPointerDown={onInputPointerDown} diff --git a/components/lib/inputnumber/InputNumberBase.js b/components/lib/inputnumber/InputNumberBase.js index b2d50d3b28..b452ee20b5 100644 --- a/components/lib/inputnumber/InputNumberBase.js +++ b/components/lib/inputnumber/InputNumberBase.js @@ -8,7 +8,8 @@ const classes = { 'p-inputwrapper-focus': focusedState, 'p-inputnumber-buttons-stacked': stacked, 'p-inputnumber-buttons-horizontal': horizontal, - 'p-inputnumber-buttons-vertical': vertical + 'p-inputnumber-buttons-vertical': vertical, + 'p-invalid': props.invalid }), buttonGroup: 'p-inputnumber-button-group', incrementButton: ({ props }) => @@ -151,6 +152,7 @@ export const InputNumberBase = ComponentBase.extend({ inputMode: null, inputRef: null, inputStyle: null, + invalid: false, locale: undefined, localeMatcher: undefined, max: null, diff --git a/components/lib/inputnumber/inputnumber.d.ts b/components/lib/inputnumber/inputnumber.d.ts index ef19e8b7a8..4d6bff60a4 100644 --- a/components/lib/inputnumber/inputnumber.d.ts +++ b/components/lib/inputnumber/inputnumber.d.ts @@ -228,6 +228,11 @@ export interface InputNumberProps extends Omit} event - Browser event */ onKeyDown?(event: React.KeyboardEvent): void; - /** - * Callback to invoke when the key released. - * @param {React.KeyboardEvent} event - Browser event - */ - onKeyUp?(event: React.KeyboardEvent): void; /** * Used to get the child elements of the component. * @readonly diff --git a/components/lib/inputswitch/InputSwitch.js b/components/lib/inputswitch/InputSwitch.js index b3a08239f6..fcc02ecc53 100644 --- a/components/lib/inputswitch/InputSwitch.js +++ b/components/lib/inputswitch/InputSwitch.js @@ -11,12 +11,8 @@ export const InputSwitch = React.memo( const mergeProps = useMergeProps(); const context = React.useContext(PrimeReactContext); const props = InputSwitchBase.getProps(inProps, context); - const [focusedState, setFocusedState] = React.useState(false); const { ptm, cx, isUnstyled } = InputSwitchBase.setMetaData({ - props, - state: { - focused: focusedState - } + props }); useHandleStyle(InputSwitchBase.css.styles, isUnstyled, { name: 'inputswitch' }); @@ -24,18 +20,7 @@ export const InputSwitch = React.memo( const inputRef = React.useRef(props.inputRef); const checked = props.checked === props.trueValue; - const onClick = (event) => { - if (props.disabled) { - return; - } - - toggle(event); - DomHandler.focus(inputRef.current); - - event.preventDefault(); - }; - - const toggle = (event) => { + const onChange = (event) => { if (props.onChange) { const value = checked ? props.falseValue : props.trueValue; @@ -58,13 +43,11 @@ export const InputSwitch = React.memo( }; const onFocus = (event) => { - setFocusedState(true); - props.onFocus && props.onFocus(event); + props?.onFocus?.(event); }; const onBlur = (event) => { - setFocusedState(false); - props.onBlur && props.onBlur(event); + props?.onBlur?.(event); }; React.useImperativeHandle(ref, () => ({ @@ -90,9 +73,8 @@ export const InputSwitch = React.memo( const rootProps = mergeProps( { - className: classNames(props.className, cx('root', { focusedState, checked })), + className: classNames(props.className, cx('root', { checked })), style: props.style, - onClick, role: 'checkbox', 'aria-checked': checked, 'data-p-highlight': checked, @@ -101,29 +83,24 @@ export const InputSwitch = React.memo( otherProps, ptm('root') ); - const hiddenInputWrapperProps = mergeProps( - { - className: 'p-hidden-accessible' - }, - ptm('hiddenInputWrapper') - ); - const hiddenInputProps = mergeProps( + const inputProps = mergeProps( { type: 'checkbox', id: props.inputId, name: props.name, checked: checked, - onChange: toggle, + onChange: onChange, onFocus: onFocus, onBlur: onBlur, disabled: props.disabled, role: 'switch', tabIndex: props.tabIndex, 'aria-checked': checked, + className: cx('input'), ...ariaProps }, - ptm('hiddenInput') + ptm('input') ); const sliderProps = mergeProps( @@ -136,9 +113,7 @@ export const InputSwitch = React.memo( return ( <>
-
- -
+
{hasTooltip && } diff --git a/components/lib/inputswitch/InputSwitchBase.js b/components/lib/inputswitch/InputSwitchBase.js index 8227022d8b..5432f9660a 100644 --- a/components/lib/inputswitch/InputSwitchBase.js +++ b/components/lib/inputswitch/InputSwitchBase.js @@ -2,40 +2,16 @@ import { ComponentBase } from '../componentbase/ComponentBase'; import { classNames } from '../utils/Utils'; const classes = { - root: ({ props, focusedState, checked }) => + root: ({ props, checked }) => classNames('p-inputswitch p-component', { - 'p-inputswitch-checked': checked, + 'p-highlight': checked, 'p-disabled': props.disabled, - 'p-focus': focusedState + 'p-invalid': props.invalid }), + input: 'p-inputswitch-input', slider: 'p-inputswitch-slider' }; -const styles = ` -@layer primereact { - .p-inputswitch { - position: relative; - display: inline-block; - } - - .p-inputswitch-slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - border: 1px solid transparent; - } - - .p-inputswitch-slider:before { - position: absolute; - content: ""; - top: 50%; - } -} -`; - export const InputSwitchBase = ComponentBase.extend({ defaultProps: { __TYPE: 'InputSwitch', @@ -47,6 +23,7 @@ export const InputSwitchBase = ComponentBase.extend({ id: null, inputId: null, inputRef: null, + invalid: false, name: null, onBlur: null, onChange: null, @@ -59,7 +36,6 @@ export const InputSwitchBase = ComponentBase.extend({ children: undefined }, css: { - classes, - styles + classes } }); diff --git a/components/lib/inputswitch/inputswitch.d.ts b/components/lib/inputswitch/inputswitch.d.ts index a0d7a0cd44..95c1aadd2a 100644 --- a/components/lib/inputswitch/inputswitch.d.ts +++ b/components/lib/inputswitch/inputswitch.d.ts @@ -8,12 +8,12 @@ * */ import * as React from 'react'; +import { ComponentHooks } from '../componentbase/componentbase'; +import { PassThroughOptions } from '../passthrough'; import { TooltipPassThroughOptions } from '../tooltip/tooltip'; import { TooltipOptions } from '../tooltip/tooltipoptions'; import { FormBooleanEvent } from '../ts-helpers'; import { PassThroughType } from '../utils/utils'; -import { PassThroughOptions } from '../passthrough'; -import { ComponentHooks } from '../componentbase/componentbase'; export declare type InputSwitchPassThroughType = PassThroughType; @@ -22,7 +22,6 @@ export declare type InputSwitchPassThroughType = PassThroughType>; /** - * Uses to pass attributes to the hidden input wrapper's DOM element. + * Uses to pass attributes to the input's DOM element. */ - hiddenInputWrapper?: InputSwitchPassThroughType>; - /** - * Uses to pass attributes to the hidden input's DOM element. - */ - hiddenInput?: InputSwitchPassThroughType>; + input?: InputSwitchPassThroughType>; /** * Uses to pass attributes tooltip's DOM element. * @type {TooltipPassThroughOptions} @@ -58,17 +53,6 @@ export interface InputSwitchPassThroughOptions { hooks?: ComponentHooks; } -/** - * Defines current inline state in InputSwitch component. - */ -export interface InputSwitchState { - /** - * Current focus state as a boolean. - * @defaultValue false - */ - focused: boolean; -} - /** * Custom change event. * @see {@link InputSwitchProps.onChange} @@ -130,6 +114,11 @@ export interface InputSwitchProps extends Omit diff --git a/components/lib/inputtext/inputtext.d.ts b/components/lib/inputtext/inputtext.d.ts index 2ee1a3f403..31cfe8468e 100644 --- a/components/lib/inputtext/inputtext.d.ts +++ b/components/lib/inputtext/inputtext.d.ts @@ -75,6 +75,11 @@ export interface InputTextProps extends Omit + root: ({ props: { severity } }) => classNames('p-inline-message p-component', { - 'p-inline-message-info': props.severity === 'info', - 'p-inline-message-warn': props.severity === 'warn', - 'p-inline-message-error': props.severity === 'error', - 'p-inline-message-success': props.severity === 'success', - 'p-inline-message-icon-only': !props.text + [`p-inline-message-${severity}`]: severity }), icon: 'p-inline-message-icon', text: 'p-inline-message-text' diff --git a/components/lib/message/__snapshots__/Message.spec.js.snap b/components/lib/message/__snapshots__/Message.spec.js.snap index 6f9dde63aa..ca5737fe60 100644 --- a/components/lib/message/__snapshots__/Message.spec.js.snap +++ b/components/lib/message/__snapshots__/Message.spec.js.snap @@ -5,7 +5,7 @@ exports[`Message content 1`] = `