From 3aaa9b352456314eb9c4041318d59420f1df2efc Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Fri, 7 Feb 2025 12:04:49 -0600 Subject: [PATCH 1/5] feat(chart-provider): add component to wrap charts --- .changeset/cyan-lemons-kneel.md | 5 + .changeset/popular-plants-search.md | 6 + .codesandbox/ci.json | 1 + .../paste-codemods/tools/.cache/mappings.json | 2 + .../components/chart-provider/CHANGELOG.md | 0 .../chart-provider/__tests__/index.spec.tsx | 44 + .../components/chart-provider/build.js | 3 + .../components/chart-provider/package.json | 61 + .../chart-provider/src/ChartContext.tsx | 68 + .../chart-provider/src/ChartProvider.tsx | 81 + .../components/chart-provider/src/index.tsx | 3 + .../chart-provider/stories/BaseChart.tsx | 45 + .../chart-provider/stories/index.stories.tsx | 90 + .../components/chart-provider/tsconfig.json | 12 + .../components/chart-provider/type-docs.json | 1598 +++++++++++++++++ packages/paste-core/core-bundle/.gitignore | 1 + packages/paste-core/core-bundle/package.json | 1 + .../core-bundle/src/chart-provider.tsx | 1 + packages/paste-core/core-bundle/src/index.tsx | 1 + yarn.lock | 36 + 20 files changed, 2059 insertions(+) create mode 100644 .changeset/cyan-lemons-kneel.md create mode 100644 .changeset/popular-plants-search.md create mode 100644 packages/paste-core/components/chart-provider/CHANGELOG.md create mode 100644 packages/paste-core/components/chart-provider/__tests__/index.spec.tsx create mode 100644 packages/paste-core/components/chart-provider/build.js create mode 100644 packages/paste-core/components/chart-provider/package.json create mode 100644 packages/paste-core/components/chart-provider/src/ChartContext.tsx create mode 100644 packages/paste-core/components/chart-provider/src/ChartProvider.tsx create mode 100644 packages/paste-core/components/chart-provider/src/index.tsx create mode 100644 packages/paste-core/components/chart-provider/stories/BaseChart.tsx create mode 100644 packages/paste-core/components/chart-provider/stories/index.stories.tsx create mode 100644 packages/paste-core/components/chart-provider/tsconfig.json create mode 100644 packages/paste-core/components/chart-provider/type-docs.json create mode 100644 packages/paste-core/core-bundle/src/chart-provider.tsx diff --git a/.changeset/cyan-lemons-kneel.md b/.changeset/cyan-lemons-kneel.md new file mode 100644 index 0000000000..bbfeddefa1 --- /dev/null +++ b/.changeset/cyan-lemons-kneel.md @@ -0,0 +1,5 @@ +--- +"@twilio-paste/codemods": minor +--- + +[ChartProvider] added a new component that will wrap chart instances to control and share the state to child charting components diff --git a/.changeset/popular-plants-search.md b/.changeset/popular-plants-search.md new file mode 100644 index 0000000000..3cd6af1449 --- /dev/null +++ b/.changeset/popular-plants-search.md @@ -0,0 +1,6 @@ +--- +"@twilio-paste/chart-provider": major +"@twilio-paste/core": minor +--- + +[ChartProvider] added a new component that will wrap chart instances to control and share the state to child charting components diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index ecdb022b58..df81c33f3a 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -21,6 +21,7 @@ "/packages/paste-core/components/button-group", "/packages/paste-core/components/callout", "/packages/paste-core/components/card", + "/packages/paste-core/components/chart-provider", "/packages/paste-core/components/chat-composer", "/packages/paste-core/components/chat-log", "/packages/paste-core/components/checkbox", diff --git a/packages/paste-codemods/tools/.cache/mappings.json b/packages/paste-codemods/tools/.cache/mappings.json index 02e39e8b8b..0f08889e4c 100644 --- a/packages/paste-codemods/tools/.cache/mappings.json +++ b/packages/paste-codemods/tools/.cache/mappings.json @@ -48,6 +48,8 @@ "CalloutListItem": "@twilio-paste/core/callout", "CalloutText": "@twilio-paste/core/callout", "Card": "@twilio-paste/core/card", + "ChartContext": "@twilio-paste/core/chart-provider", + "ChartProvider": "@twilio-paste/core/chart-provider", "ChatComposer": "@twilio-paste/core/chat-composer", "ChatComposerActionGroup": "@twilio-paste/core/chat-composer", "ChatComposerAttachmentCard": "@twilio-paste/core/chat-composer", diff --git a/packages/paste-core/components/chart-provider/CHANGELOG.md b/packages/paste-core/components/chart-provider/CHANGELOG.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx b/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx new file mode 100644 index 0000000000..045dc78b67 --- /dev/null +++ b/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx @@ -0,0 +1,44 @@ +import { act, render } from "@testing-library/react"; +import { BoxProps } from "@twilio-paste/box"; +import * as React from "react"; + +import { ChartProvider } from "../src"; +import { UpdateChartTypeChangeOnRedraw } from "../stories/index.stories"; + +const TestChartProvider: React.FC> = ({ + element, + children, +}) => { + return ( + + {children} + + ); +}; + +describe("ChartProvider", () => { + it("should render", () => { + const { getByText, getByTestId } = render(test); + expect(getByText("test")).toBeDefined(); + expect(getByTestId("chart-provider").getAttribute("data-paste-element")).toEqual("CHART_PROVIDER"); + }); + + it("should update chart type when options change", async () => { + const { getByTestId } = render(); + + expect(getByTestId("chart-type-paragraph").textContent).toEqual("The chart type in the context is: line"); + + await act(async () => { + getByTestId("change-to-column-btn").click(); + }); + + expect(getByTestId("chart-type-paragraph").textContent).toEqual("The chart type in the context is: column"); + }); + + describe("Customization", () => { + it("should apply the element prop", () => { + const { getByTestId } = render(); + expect(getByTestId("chart-provider").getAttribute("data-paste-element")).toEqual("TEST_ELEMENT"); + }); + }); +}); diff --git a/packages/paste-core/components/chart-provider/build.js b/packages/paste-core/components/chart-provider/build.js new file mode 100644 index 0000000000..27dd98f98e --- /dev/null +++ b/packages/paste-core/components/chart-provider/build.js @@ -0,0 +1,3 @@ +const { build } = require("../../../../tools/build/esbuild"); + +build(require("./package.json")); diff --git a/packages/paste-core/components/chart-provider/package.json b/packages/paste-core/components/chart-provider/package.json new file mode 100644 index 0000000000..7a2df67a96 --- /dev/null +++ b/packages/paste-core/components/chart-provider/package.json @@ -0,0 +1,61 @@ +{ + "name": "@twilio-paste/chart-provider", + "version": "0.0.0", + "category": "data display", + "status": "beta", + "description": "A component used to wrap an individual chart to store and share state to child charting elements.", + "author": "Twilio Inc.", + "license": "MIT", + "main:dev": "src/index.tsx", + "main": "dist/index.js", + "module": "dist/index.es.js", + "types": "dist/index.d.ts", + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "files": [ + "dist" + ], + "scripts": { + "build": "yarn clean && NODE_ENV=production node build.js && tsc", + "build:js": "NODE_ENV=development node build.js", + "build:typedocs": "tsx ../../../../tools/build/generate-type-docs", + "clean": "rm -rf ./dist", + "tsc": "tsc" + }, + "peerDependencies": { + "@twilio-paste/animation-library": "^2.0.0", + "@twilio-paste/box": "^10.2.0", + "@twilio-paste/color-contrast-utils": "^5.0.0", + "@twilio-paste/customization": "^8.1.1", + "@twilio-paste/design-tokens": "^10.3.0", + "@twilio-paste/style-props": "^9.1.1", + "@twilio-paste/styling-library": "^3.0.0", + "@twilio-paste/theme": "^11.0.1", + "@twilio-paste/types": "^6.0.0", + "@types/react": "^16.8.6 || ^17.0.2 || ^18.0.27", + "@types/react-dom": "^16.8.6 || ^17.0.2 || ^18.0.10", + "highcharts": "^9.3.3", + "react": "^16.8.6 || ^17.0.2 || ^18.0.0", + "react-dom": "^16.8.6 || ^17.0.2 || ^18.0.0" + }, + "devDependencies": { + "@twilio-paste/animation-library": "^2.0.0", + "@twilio-paste/box": "^10.2.0", + "@twilio-paste/color-contrast-utils": "^5.0.0", + "@twilio-paste/customization": "^8.1.1", + "@twilio-paste/design-tokens": "^10.3.0", + "@twilio-paste/style-props": "^9.1.1", + "@twilio-paste/styling-library": "^3.0.0", + "@twilio-paste/theme": "^11.0.1", + "@twilio-paste/types": "^6.0.0", + "@types/react": "^18.0.27", + "@types/react-dom": "^18.0.10", + "highcharts": "^9.3.3", + "react": "^18.0.0", + "react-dom": "^18.0.0", + "tsx": "^4.0.0", + "typescript": "^4.9.4" + } +} diff --git a/packages/paste-core/components/chart-provider/src/ChartContext.tsx b/packages/paste-core/components/chart-provider/src/ChartContext.tsx new file mode 100644 index 0000000000..c99f422dc0 --- /dev/null +++ b/packages/paste-core/components/chart-provider/src/ChartContext.tsx @@ -0,0 +1,68 @@ +import * as Highcharts from "highcharts"; +import * as React from "react"; + +export interface ChartContextProps { + /** + * The function that will be called by the HighchartsReact callback to set the chart object in the context. + * + * @param {Function} chart - the chart object returned from the HighchartsReact callback + * @memberof ChartContextProps + */ + setChart: (chart: Highcharts.Chart) => void; + /** + * Used to the set the reference to the chart element once it is populated + * + * @param {HTMLElement} ref - React.MutableRefObject.current of base chart component + * @memberof ChartContextProps + */ + setChartRef: (ref: HTMLElement) => void; + /** + * The options that will be passed to the ReactHighcharts component. It will be enriched with tracking events that wil be used by + * other Paste components if using the ChartProvider. + * + * @type {Highcharts.Options} + * @memberof ChartContextProps + */ + options: Highcharts.Options; + /** + * The rendered chart returned from the HighchartsReact callback. Use this object to get the rendered properties of + * series and points when calculating poitioning of custom elements. It can also be used to interact + * with the chart in ways such as setting zoom levels and using chart.update to trigger changes. + * + * @type {Highcharts.Chart} + * @memberof ChartContextProps + */ + chart?: Highcharts.Chart; + + /** + * The current reference to the base chart component. Needed for positioning custom elements relative to points. + * + * @type {string} + * @memberof ChartContextProps + */ + chartRef?: HTMLElement; + /** + * The current chart type. Used to trigger rerenders of other components inside ChartProvider. + * + * @type {string} + * @memberof ChartContextProps + */ + chartType?: string; +} + +/** + * Setting the default values to log errors is an alternative to throwing runtime errors that still allow engineers + * to debug any potential issues. + */ + +export const ChartContext = React.createContext({ + options: {}, + setChart: () => { + // eslint-disable-next-line no-console + console.error("setChart not implemented. Is this component wrapped in the ChartProvider component?"); + }, + setChartRef: () => { + // eslint-disable-next-line no-console + console.error("setChartRef not implemented. Is this component wrapped in the ChartProvider component?"); + }, +}); diff --git a/packages/paste-core/components/chart-provider/src/ChartProvider.tsx b/packages/paste-core/components/chart-provider/src/ChartProvider.tsx new file mode 100644 index 0000000000..5faffd2f0e --- /dev/null +++ b/packages/paste-core/components/chart-provider/src/ChartProvider.tsx @@ -0,0 +1,81 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxProps } from "@twilio-paste/box"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as Highcharts from "highcharts"; +import * as React from "react"; + +import { ChartContext } from "./ChartContext"; + +interface BaseChartProviderProps extends HTMLPasteProps<"div"> { + children?: React.ReactNode; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * @default 'CHART_PROVIDER' + * @type {BoxProps['element']} + * @memberof ChartProviderProps + */ + element?: BoxProps["element"]; +} + +interface HighchartsOptions extends BaseChartProviderProps { + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * @default null + * @type {BoxProps['element']} + * @memberof ChartProviderProps + */ + highchartsOptions: Highcharts.Options; + pasteOptions?: never; +} + +export type ChartProviderProps = HighchartsOptions; + +const ChartProvider = React.forwardRef( + ({ element = "CHART_PROVIDER", children, highchartsOptions, ...props }, ref) => { + const [chart, setChart] = React.useState(); + const [chartRef, setChartRef] = React.useState(); + const [chartType, setChartType] = React.useState(""); + + const modifiedOptions: Highcharts.Options = Highcharts.merge(highchartsOptions, { + chart: { + events: { + /** + * Any events we want to fire on changes to charts should be handled here + * + * Keeping track of chart type is a good way to trigger rerenders of other components inside ChartProvider + * There is an issue with useEffects on the chart object change only because React only does shallow + * comparisons and considers them the same object. Picking a value that is garuanteed to change + * between renders/types will overcome this. + */ + + // eslint-disable-next-line object-shorthand + redraw: function (this) { + // eslint-disable-next-line react/no-this-in-sfc + setChartType(this.options?.chart?.type || ""); + }, + }, + }, + } as Highcharts.Options); + + return ( + + + {children} + + + ); + }, +); + +ChartProvider.displayName = "ChartProvider"; + +export { ChartProvider }; diff --git a/packages/paste-core/components/chart-provider/src/index.tsx b/packages/paste-core/components/chart-provider/src/index.tsx new file mode 100644 index 0000000000..5e619b2eb5 --- /dev/null +++ b/packages/paste-core/components/chart-provider/src/index.tsx @@ -0,0 +1,3 @@ +export { ChartProvider } from "./ChartProvider"; +export type { ChartProviderProps } from "./ChartProvider"; +export { ChartContext } from "./ChartContext"; diff --git a/packages/paste-core/components/chart-provider/stories/BaseChart.tsx b/packages/paste-core/components/chart-provider/stories/BaseChart.tsx new file mode 100644 index 0000000000..ea6a6856e5 --- /dev/null +++ b/packages/paste-core/components/chart-provider/stories/BaseChart.tsx @@ -0,0 +1,45 @@ +import { Box } from "@twilio-paste/box"; +import { usePasteHighchartsTheme } from "@twilio-paste/data-visualization-library"; +import * as Highcharts from "highcharts"; +import HighchartsReact from "highcharts-react-official"; +import * as React from "react"; + +import { ChartContext } from "../src"; + +const Chart: React.FC = () => { + const chartRef = React.useRef(null); + const { options, setChart, setChartRef } = React.useContext(ChartContext); + const [chartOptions, setChartOptions] = React.useState( + usePasteHighchartsTheme({ ...options, plotOptions: { series: { animation: false } } }), + ); + + React.useLayoutEffect(() => { + setChartOptions(Highcharts.merge(chartOptions, options)); + }, [options]); + + React.useEffect(() => { + if (chartRef.current) { + setChartRef(chartRef.current); + } + }, [chartRef.current]); + + const callback = (chart: Highcharts.Chart): void => { + if (chart?.series?.length > 0) { + setChart(chart); + } + }; + + return ( + + + + ); +}; + +export const BaseChart = React.memo(Chart); diff --git a/packages/paste-core/components/chart-provider/stories/index.stories.tsx b/packages/paste-core/components/chart-provider/stories/index.stories.tsx new file mode 100644 index 0000000000..046589798d --- /dev/null +++ b/packages/paste-core/components/chart-provider/stories/index.stories.tsx @@ -0,0 +1,90 @@ +import type { StoryFn } from "@storybook/react"; +import { Box } from "@twilio-paste/box"; +import { Button } from "@twilio-paste/button"; +import { Paragraph } from "@twilio-paste/paragraph"; +import { Theme } from "@twilio-paste/theme"; +import * as React from "react"; + +import { ChartContext, ChartProvider } from "../src"; +import { BaseChart } from "./BaseChart"; + +const lineSeries: Highcharts.SeriesLineOptions[] = [ + { + name: "Installation", + data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175], + type: "line", + }, + { + name: "Manufacturing", + data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434], + type: "line", + }, + { + name: "Sales & Distribution", + data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387], + type: "line", + }, + { + name: "Project Development", + data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227], + type: "line", + }, + { + name: "Other", + data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111], + type: "line", + }, +]; + +// eslint-disable-next-line import/no-default-export +export default { + title: "Components/ChartProvider", +}; + +export const Default: StoryFn = () => { + return ( + + + + ); +}; + +const PrintChartTypeFromHook: React.FC<{ onClick: () => void }> = ({ onClick }) => { + const { chartType } = React.useContext(ChartContext); + + return ( + + + + The chart type in the context is: {chartType} + + + ); +}; + +export const UpdateChartTypeChangeOnRedraw: StoryFn = () => { + const lineOptions: Highcharts.Options = { + chart: { + type: "line", + }, + series: lineSeries, + }; + const columnOptions: Highcharts.Options = { + chart: { + type: "column", + }, + series: lineSeries.map((s) => ({ ...s, type: "column" }) as Highcharts.SeriesColumnOptions), + }; + const [chartOptions, setChartOptions] = React.useState(lineOptions); + + return ( + + + setChartOptions(columnOptions)} /> + + + + ); +}; diff --git a/packages/paste-core/components/chart-provider/tsconfig.json b/packages/paste-core/components/chart-provider/tsconfig.json new file mode 100644 index 0000000000..b5daed7034 --- /dev/null +++ b/packages/paste-core/components/chart-provider/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "outDir": "dist/", + }, + "include": [ + "src/**/*", + ], + "exclude": [ + "node_modules" + ] +} diff --git a/packages/paste-core/components/chart-provider/type-docs.json b/packages/paste-core/components/chart-provider/type-docs.json new file mode 100644 index 0000000000..dcc28f2476 --- /dev/null +++ b/packages/paste-core/components/chart-provider/type-docs.json @@ -0,0 +1,1598 @@ +{ + "ChartProvider": { + "highchartsOptions": { + "type": "Options", + "defaultValue": "null", + "required": true, + "externalProp": false, + "description": "Overrides the default element name to apply unique styles with the Customization Provider" + }, + "about": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "accessKey": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "aria-activedescendant": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application." + }, + "aria-atomic": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute." + }, + "aria-autocomplete": { + "type": "\"list\" | \"none\" | \"inline\" | \"both\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made." + }, + "aria-busy": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user." + }, + "aria-checked": { + "type": "boolean | \"true\" | \"false\" | \"mixed\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"checked\" state of checkboxes, radio buttons, and other widgets." + }, + "aria-colcount": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the total number of columns in a table, grid, or treegrid." + }, + "aria-colindex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid." + }, + "aria-colspan": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid." + }, + "aria-controls": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) whose contents or presence are controlled by the current element." + }, + "aria-current": { + "type": "| boolean\n | \"time\"\n | \"true\"\n | \"false\"\n | \"page\"\n | \"step\"\n | \"location\"\n | \"date\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the element that represents the current item within a container or set of related elements." + }, + "aria-describedby": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) that describes the object." + }, + "aria-details": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element that provides a detailed, extended description for the object." + }, + "aria-disabled": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable." + }, + "aria-dropeffect": { + "type": "\"link\" | \"none\" | \"copy\" | \"execute\" | \"move\" | \"popup\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates what functions can be performed when a dragged object is released on the drop target." + }, + "aria-errormessage": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element that provides an error message for the object." + }, + "aria-expanded": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed." + }, + "aria-flowto": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,\nallows assistive technology to override the general default of reading in document source order." + }, + "aria-grabbed": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates an element's \"grabbed\" state in a drag-and-drop operation." + }, + "aria-haspopup": { + "type": "| boolean\n | \"dialog\"\n | \"menu\"\n | \"true\"\n | \"false\"\n | \"grid\"\n | \"listbox\"\n | \"tree\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element." + }, + "aria-hidden": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element is exposed to an accessibility API." + }, + "aria-invalid": { + "type": "boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the entered value does not conform to the format expected by the application." + }, + "aria-keyshortcuts": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element." + }, + "aria-label": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a string value that labels the current element." + }, + "aria-labelledby": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) that labels the current element." + }, + "aria-level": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the hierarchical level of an element within a structure." + }, + "aria-live": { + "type": "\"off\" | \"assertive\" | \"polite\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region." + }, + "aria-modal": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether an element is modal when displayed." + }, + "aria-multiline": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether a text box accepts multiple lines of input or only a single line." + }, + "aria-multiselectable": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the user may select more than one item from the current selectable descendants." + }, + "aria-orientation": { + "type": "\"horizontal\" | \"vertical\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous." + }, + "aria-owns": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship\nbetween DOM elements where the DOM hierarchy cannot be used to represent the relationship." + }, + "aria-placeholder": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.\nA hint could be a sample value or a brief description of the expected format." + }, + "aria-posinset": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM." + }, + "aria-pressed": { + "type": "boolean | \"true\" | \"false\" | \"mixed\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"pressed\" state of toggle buttons." + }, + "aria-readonly": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the element is not editable, but is otherwise operable." + }, + "aria-relevant": { + "type": "| \"text\"\n | \"additions\"\n | \"additions removals\"\n | \"additions text\"\n | \"all\"\n | \"removals\"\n | \"removals additions\"\n | \"removals text\"\n | \"text additions\"\n | \"text removals\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified." + }, + "aria-required": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that user input is required on the element before a form may be submitted." + }, + "aria-roledescription": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a human-readable, author-localized description for the role of an element." + }, + "aria-rowcount": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the total number of rows in a table, grid, or treegrid." + }, + "aria-rowindex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid." + }, + "aria-rowspan": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid." + }, + "aria-selected": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"selected\" state of various widgets." + }, + "aria-setsize": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM." + }, + "aria-sort": { + "type": "\"none\" | \"ascending\" | \"descending\" | \"other\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates if items in a table or grid are sorted in ascending or descending order." + }, + "aria-valuemax": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the maximum allowed value for a range widget." + }, + "aria-valuemin": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the minimum allowed value for a range widget." + }, + "aria-valuenow": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the current value for a range widget." + }, + "aria-valuetext": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the human readable text alternative of aria-valuenow for a range widget." + }, + "autoCapitalize": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "autoCorrect": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "autoSave": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "contentEditable": { + "type": "Booleanish | \"inherit\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "contextMenu": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "dangerouslySetInnerHTML": { + "type": "{ __html: string }", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "datatype": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "defaultChecked": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "defaultValue": { + "type": "string | number | readonly string[]", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "dir": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "draggable": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "element": { + "type": "string", + "defaultValue": "'CHART_PROVIDER'", + "required": false, + "externalProp": false, + "description": "Overrides the default element name to apply unique styles with the Customization Provider" + }, + "hidden": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "id": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "inlist": { + "type": "any", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "inputMode": { + "type": "| \"text\"\n | \"none\"\n | \"search\"\n | \"tel\"\n | \"url\"\n | \"email\"\n | \"numeric\"\n | \"decimal\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Hints at the type of data that might be entered by the user while editing the element or its contents" + }, + "is": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Specify that a standard HTML element should behave like a defined custom built-in element" + }, + "itemID": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemProp": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemRef": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemScope": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemType": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "key": { + "type": "Key", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "lang": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "nonce": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAbort": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAbortCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationEnd": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationEndCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationIteration": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationIterationCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationStart": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationStartCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAuxClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAuxClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBeforeInput": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBeforeInputCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBlur": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBlurCapture": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlay": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayThrough": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayThroughCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onChange": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onChangeCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionEnd": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionEndCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionStart": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionStartCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionUpdate": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionUpdateCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onContextMenu": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onContextMenuCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCopy": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCopyCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCut": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCutCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDoubleClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDoubleClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDrag": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnd": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEndCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnter": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnterCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragExit": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragExitCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragLeave": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragLeaveCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragOver": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragOverCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragStart": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragStartCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDrop": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDropCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDurationChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDurationChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEmptied": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEmptiedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEncrypted": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEncryptedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEnded": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEndedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onError": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onErrorCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onFocus": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onFocusCapture": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onGotPointerCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onGotPointerCaptureCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInput": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInputCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInvalid": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInvalidCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyDown": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyDownCapture": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyPress": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyPressCapture": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyUp": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyUpCapture": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoad": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedData": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedDataCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedMetadata": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedMetadataCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadStart": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadStartCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLostPointerCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLostPointerCaptureCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseDown": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseDownCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseEnter": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseLeave": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseMove": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseMoveCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOut": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOutCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOver": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOverCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseUp": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseUpCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPaste": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPasteCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPause": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPauseCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlay": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlayCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlaying": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlayingCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerCancel": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerCancelCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerDown": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerDownCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerEnter": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerEnterCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerLeave": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerLeaveCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerMove": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerMoveCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOut": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOutCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOver": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOverCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerUp": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerUpCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onProgress": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onProgressCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onRateChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onRateChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onReset": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onResetCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onResize": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onResizeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onScroll": { + "type": "UIEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onScrollCapture": { + "type": "UIEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeeked": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeekedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeeking": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeekingCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSelect": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSelectCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onStalled": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onStalledCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSubmit": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSubmitCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSuspend": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSuspendCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTimeUpdate": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTimeUpdateCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchCancel": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchCancelCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchEnd": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchEndCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchMove": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchMoveCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchStart": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchStartCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTransitionEnd": { + "type": "TransitionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTransitionEndCapture": { + "type": "TransitionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onVolumeChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onVolumeChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWaiting": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWaitingCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWheel": { + "type": "WheelEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWheelCapture": { + "type": "WheelEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "pasteOptions": { + "type": "never", + "defaultValue": null, + "required": false, + "externalProp": false + }, + "placeholder": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "prefix": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "property": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "radioGroup": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "resource": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "results": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "role": { + "type": "AriaRole", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "security": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "slot": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "spellCheck": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "suppressContentEditableWarning": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "suppressHydrationWarning": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "tabIndex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "title": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "translate": { + "type": "\"yes\" | \"no\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "typeof": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "unselectable": { + "type": "\"on\" | \"off\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "vocab": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + } + } +} diff --git a/packages/paste-core/core-bundle/.gitignore b/packages/paste-core/core-bundle/.gitignore index f1ff8df324..c69ec46196 100644 --- a/packages/paste-core/core-bundle/.gitignore +++ b/packages/paste-core/core-bundle/.gitignore @@ -17,6 +17,7 @@ /button-group /callout /card +/chart-provider /chat-composer /chat-log /checkbox diff --git a/packages/paste-core/core-bundle/package.json b/packages/paste-core/core-bundle/package.json index 1090827582..5d56d3c18c 100644 --- a/packages/paste-core/core-bundle/package.json +++ b/packages/paste-core/core-bundle/package.json @@ -88,6 +88,7 @@ "@twilio-paste/button-group": "^4.2.0", "@twilio-paste/callout": "^4.2.1", "@twilio-paste/card": "^9.1.0", + "@twilio-paste/chart-provider": "^0.0.0", "@twilio-paste/chat-composer": "^5.2.1", "@twilio-paste/chat-log": "^5.2.1", "@twilio-paste/checkbox": "^13.1.2", diff --git a/packages/paste-core/core-bundle/src/chart-provider.tsx b/packages/paste-core/core-bundle/src/chart-provider.tsx new file mode 100644 index 0000000000..f5f65cdfed --- /dev/null +++ b/packages/paste-core/core-bundle/src/chart-provider.tsx @@ -0,0 +1 @@ +export * from "@twilio-paste/chart-provider"; diff --git a/packages/paste-core/core-bundle/src/index.tsx b/packages/paste-core/core-bundle/src/index.tsx index 8605836651..3ed7c3ee02 100644 --- a/packages/paste-core/core-bundle/src/index.tsx +++ b/packages/paste-core/core-bundle/src/index.tsx @@ -14,6 +14,7 @@ export * from "@twilio-paste/button"; export * from "@twilio-paste/button-group"; export * from "@twilio-paste/callout"; export * from "@twilio-paste/card"; +export * from "@twilio-paste/chart-provider"; export * from "@twilio-paste/chat-composer"; export * from "@twilio-paste/chat-log"; export * from "@twilio-paste/checkbox"; diff --git a/yarn.lock b/yarn.lock index e6e52febbb..f4329ffa5b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11939,6 +11939,42 @@ __metadata: languageName: unknown linkType: soft +"@twilio-paste/chart-provider@workspace:packages/paste-core/components/chart-provider": + version: 0.0.0-use.local + resolution: "@twilio-paste/chart-provider@workspace:packages/paste-core/components/chart-provider" + dependencies: + "@twilio-paste/animation-library": ^2.0.0 + "@twilio-paste/box": ^10.2.0 + "@twilio-paste/color-contrast-utils": ^5.0.0 + "@twilio-paste/customization": ^8.1.1 + "@twilio-paste/design-tokens": ^10.3.0 + "@twilio-paste/style-props": ^9.1.1 + "@twilio-paste/styling-library": ^3.0.0 + "@twilio-paste/theme": ^11.0.1 + "@twilio-paste/types": ^6.0.0 + "@types/react": ^18.0.27 + "@types/react-dom": ^18.0.10 + react: ^18.0.0 + react-dom: ^18.0.0 + tsx: ^4.0.0 + typescript: ^4.9.4 + peerDependencies: + "@twilio-paste/animation-library": ^2.0.0 + "@twilio-paste/box": ^10.2.0 + "@twilio-paste/color-contrast-utils": ^5.0.0 + "@twilio-paste/customization": ^8.1.1 + "@twilio-paste/design-tokens": ^10.3.0 + "@twilio-paste/style-props": ^9.1.1 + "@twilio-paste/styling-library": ^3.0.0 + "@twilio-paste/theme": ^11.0.1 + "@twilio-paste/types": ^6.0.0 + "@types/react": ^16.8.6 || ^17.0.2 || ^18.0.27 + "@types/react-dom": ^16.8.6 || ^17.0.2 || ^18.0.10 + react: ^16.8.6 || ^17.0.2 || ^18.0.0 + react-dom: ^16.8.6 || ^17.0.2 || ^18.0.0 + languageName: unknown + linkType: soft + "@twilio-paste/chat-composer@^5.2.1, @twilio-paste/chat-composer@workspace:packages/paste-core/components/chat-composer": version: 0.0.0-use.local resolution: "@twilio-paste/chat-composer@workspace:packages/paste-core/components/chat-composer" From 6a90b9ce9661bd9402db54fb2bee755d536a906b Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Fri, 7 Feb 2025 12:08:11 -0600 Subject: [PATCH 2/5] fix(ci): yarn install error --- yarn.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index f4329ffa5b..dae9f6d6ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11939,7 +11939,7 @@ __metadata: languageName: unknown linkType: soft -"@twilio-paste/chart-provider@workspace:packages/paste-core/components/chart-provider": +"@twilio-paste/chart-provider@^0.0.0, @twilio-paste/chart-provider@workspace:packages/paste-core/components/chart-provider": version: 0.0.0-use.local resolution: "@twilio-paste/chart-provider@workspace:packages/paste-core/components/chart-provider" dependencies: @@ -11954,6 +11954,7 @@ __metadata: "@twilio-paste/types": ^6.0.0 "@types/react": ^18.0.27 "@types/react-dom": ^18.0.10 + highcharts: ^9.3.3 react: ^18.0.0 react-dom: ^18.0.0 tsx: ^4.0.0 @@ -11970,6 +11971,7 @@ __metadata: "@twilio-paste/types": ^6.0.0 "@types/react": ^16.8.6 || ^17.0.2 || ^18.0.27 "@types/react-dom": ^16.8.6 || ^17.0.2 || ^18.0.10 + highcharts: ^9.3.3 react: ^16.8.6 || ^17.0.2 || ^18.0.0 react-dom: ^16.8.6 || ^17.0.2 || ^18.0.0 languageName: unknown @@ -12384,6 +12386,7 @@ __metadata: "@twilio-paste/button-group": ^4.2.0 "@twilio-paste/callout": ^4.2.1 "@twilio-paste/card": ^9.1.0 + "@twilio-paste/chart-provider": ^0.0.0 "@twilio-paste/chat-composer": ^5.2.1 "@twilio-paste/chat-log": ^5.2.1 "@twilio-paste/checkbox": ^13.1.2 From d7ed5878ad356c772d375d153ece8b5040ba4465 Mon Sep 17 00:00:00 2001 From: krisantrobus <55083528+krisantrobus@users.noreply.github.com> Date: Wed, 12 Feb 2025 14:18:52 -0600 Subject: [PATCH 3/5] Update packages/paste-core/components/chart-provider/package.json Co-authored-by: Nora Krantz <75342690+nkrantz@users.noreply.github.com> --- packages/paste-core/components/chart-provider/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/paste-core/components/chart-provider/package.json b/packages/paste-core/components/chart-provider/package.json index 7a2df67a96..f37d1ae353 100644 --- a/packages/paste-core/components/chart-provider/package.json +++ b/packages/paste-core/components/chart-provider/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "category": "data display", "status": "beta", - "description": "A component used to wrap an individual chart to store and share state to child charting elements.", + "description": "Chart Provider is a data visualization component used to wrap an individual chart to store and share state to child charting elements.", "author": "Twilio Inc.", "license": "MIT", "main:dev": "src/index.tsx", From 59fe16f1c74f5a07b34f858bf4863a49e2b144d9 Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Wed, 12 Feb 2025 18:56:56 -0600 Subject: [PATCH 4/5] feat(chart-provider): remove chart type, not required at this stage --- .../chart-provider/__tests__/index.spec.tsx | 13 ------ .../chart-provider/src/ChartProvider.tsx | 25 +----------- .../chart-provider/stories/index.stories.tsx | 40 ------------------- 3 files changed, 1 insertion(+), 77 deletions(-) diff --git a/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx b/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx index 045dc78b67..f4864b7558 100644 --- a/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx +++ b/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx @@ -3,7 +3,6 @@ import { BoxProps } from "@twilio-paste/box"; import * as React from "react"; import { ChartProvider } from "../src"; -import { UpdateChartTypeChangeOnRedraw } from "../stories/index.stories"; const TestChartProvider: React.FC> = ({ element, @@ -23,18 +22,6 @@ describe("ChartProvider", () => { expect(getByTestId("chart-provider").getAttribute("data-paste-element")).toEqual("CHART_PROVIDER"); }); - it("should update chart type when options change", async () => { - const { getByTestId } = render(); - - expect(getByTestId("chart-type-paragraph").textContent).toEqual("The chart type in the context is: line"); - - await act(async () => { - getByTestId("change-to-column-btn").click(); - }); - - expect(getByTestId("chart-type-paragraph").textContent).toEqual("The chart type in the context is: column"); - }); - describe("Customization", () => { it("should apply the element prop", () => { const { getByTestId } = render(); diff --git a/packages/paste-core/components/chart-provider/src/ChartProvider.tsx b/packages/paste-core/components/chart-provider/src/ChartProvider.tsx index 5faffd2f0e..5404e29284 100644 --- a/packages/paste-core/components/chart-provider/src/ChartProvider.tsx +++ b/packages/paste-core/components/chart-provider/src/ChartProvider.tsx @@ -34,28 +34,6 @@ const ChartProvider = React.forwardRef( ({ element = "CHART_PROVIDER", children, highchartsOptions, ...props }, ref) => { const [chart, setChart] = React.useState(); const [chartRef, setChartRef] = React.useState(); - const [chartType, setChartType] = React.useState(""); - - const modifiedOptions: Highcharts.Options = Highcharts.merge(highchartsOptions, { - chart: { - events: { - /** - * Any events we want to fire on changes to charts should be handled here - * - * Keeping track of chart type is a good way to trigger rerenders of other components inside ChartProvider - * There is an issue with useEffects on the chart object change only because React only does shallow - * comparisons and considers them the same object. Picking a value that is garuanteed to change - * between renders/types will overcome this. - */ - - // eslint-disable-next-line object-shorthand - redraw: function (this) { - // eslint-disable-next-line react/no-this-in-sfc - setChartType(this.options?.chart?.type || ""); - }, - }, - }, - } as Highcharts.Options); return ( @@ -65,8 +43,7 @@ const ChartProvider = React.forwardRef( setChart, chartRef, setChartRef, - chartType, - options: modifiedOptions, + options: highchartsOptions, }} > {children} diff --git a/packages/paste-core/components/chart-provider/stories/index.stories.tsx b/packages/paste-core/components/chart-provider/stories/index.stories.tsx index 046589798d..4b5b98d64e 100644 --- a/packages/paste-core/components/chart-provider/stories/index.stories.tsx +++ b/packages/paste-core/components/chart-provider/stories/index.stories.tsx @@ -48,43 +48,3 @@ export const Default: StoryFn = () => { ); }; - -const PrintChartTypeFromHook: React.FC<{ onClick: () => void }> = ({ onClick }) => { - const { chartType } = React.useContext(ChartContext); - - return ( - - - - The chart type in the context is: {chartType} - - - ); -}; - -export const UpdateChartTypeChangeOnRedraw: StoryFn = () => { - const lineOptions: Highcharts.Options = { - chart: { - type: "line", - }, - series: lineSeries, - }; - const columnOptions: Highcharts.Options = { - chart: { - type: "column", - }, - series: lineSeries.map((s) => ({ ...s, type: "column" }) as Highcharts.SeriesColumnOptions), - }; - const [chartOptions, setChartOptions] = React.useState(lineOptions); - - return ( - - - setChartOptions(columnOptions)} /> - - - - ); -}; From d1ec0b54889748ff96663bdd5d718ee6b3638f3d Mon Sep 17 00:00:00 2001 From: Kristian Antrobus Date: Wed, 12 Feb 2025 19:06:30 -0600 Subject: [PATCH 5/5] chore(pr): cleanup unused import --- .../components/chart-provider/__tests__/index.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx b/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx index f4864b7558..2f79068014 100644 --- a/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx +++ b/packages/paste-core/components/chart-provider/__tests__/index.spec.tsx @@ -1,4 +1,4 @@ -import { act, render } from "@testing-library/react"; +import { render } from "@testing-library/react"; import { BoxProps } from "@twilio-paste/box"; import * as React from "react";