material-plus-ui 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +28 -18
- package/dist/a2ui/catalog.d.ts +104 -0
- package/dist/a2ui/catalog.js +1 -0
- package/dist/a2ui/components/MPA2uiAudioPlayer.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiAudioPlayer.js +2 -0
- package/dist/a2ui/components/MPA2uiButton.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiButton.js +2 -0
- package/dist/a2ui/components/MPA2uiCard.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiCard.js +2 -0
- package/dist/a2ui/components/MPA2uiCheckBox.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiCheckBox.js +2 -0
- package/dist/a2ui/components/MPA2uiChoicePicker.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiChoicePicker.js +2 -0
- package/dist/a2ui/components/MPA2uiColumn.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiColumn.js +2 -0
- package/dist/a2ui/components/MPA2uiDateTimeInput.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiDateTimeInput.js +2 -0
- package/dist/a2ui/components/MPA2uiDivider.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiDivider.js +2 -0
- package/dist/a2ui/components/MPA2uiIcon.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiIcon.js +2 -0
- package/dist/a2ui/components/MPA2uiImage.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiImage.js +2 -0
- package/dist/a2ui/components/MPA2uiList.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiList.js +2 -0
- package/dist/a2ui/components/MPA2uiModal.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiModal.js +2 -0
- package/dist/a2ui/components/MPA2uiRow.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiRow.js +2 -0
- package/dist/a2ui/components/MPA2uiSlider.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiSlider.js +2 -0
- package/dist/a2ui/components/MPA2uiTabs.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiTabs.js +2 -0
- package/dist/a2ui/components/MPA2uiText.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiText.js +2 -0
- package/dist/a2ui/components/MPA2uiTextField.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiTextField.js +2 -0
- package/dist/a2ui/components/MPA2uiVideo.d.ts +1 -0
- package/dist/a2ui/components/MPA2uiVideo.js +2 -0
- package/dist/a2ui/extended/MPA2uiBarChart.d.ts +1 -0
- package/dist/a2ui/extended/MPA2uiBarChart.js +2 -0
- package/dist/a2ui/extended/MPA2uiDataTable.d.ts +1 -0
- package/dist/a2ui/extended/MPA2uiDataTable.js +2 -0
- package/dist/a2ui/extended/MPA2uiLineChart.d.ts +1 -0
- package/dist/a2ui/extended/MPA2uiLineChart.js +2 -0
- package/dist/a2ui/extended/MPA2uiPieChart.d.ts +1 -0
- package/dist/a2ui/extended/MPA2uiPieChart.js +2 -0
- package/dist/a2ui/extended/MPA2uiStatistic.d.ts +1 -0
- package/dist/a2ui/extended/MPA2uiStatistic.js +2 -0
- package/dist/a2ui/extended/api.d.ts +1436 -0
- package/dist/a2ui/extended/api.js +1 -0
- package/dist/a2ui/extended/chart.d.ts +26 -0
- package/dist/a2ui/extended/chart.js +1 -0
- package/dist/a2ui/index.d.ts +103 -0
- package/dist/a2ui/index.js +1 -0
- package/dist/a2ui/internal/children.d.ts +28 -0
- package/dist/a2ui/internal/children.js +1 -0
- package/dist/a2ui/internal/common.d.ts +113 -0
- package/dist/a2ui/internal/common.js +1 -0
- package/dist/a2ui/internal/icons.d.ts +3 -0
- package/dist/a2ui/internal/icons.js +1 -0
- package/dist/components/alert/MPAlert.d.ts +2 -2
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/anchor/MPAnchor.js +1 -1
- package/dist/components/animate-counter/MPAnimateCounter.js +1 -1
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +1 -1
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
- package/dist/components/app-logo/MPAppLogo.d.ts +16 -1
- package/dist/components/app-logo/MPAppLogo.js +1 -1
- package/dist/components/area-chart/MPAreaChart.d.ts +18 -3
- package/dist/components/area-chart/MPAreaChart.js +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.d.ts +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -1
- package/dist/components/avatar/MPAvatar.d.ts +1 -1
- package/dist/components/bar-chart/MPBarChart.d.ts +15 -5
- package/dist/components/bar-chart/MPBarChart.js +1 -1
- package/dist/components/blockquote/MPBlockquote.d.ts +9 -1
- package/dist/components/blockquote/MPBlockquote.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
- package/dist/components/box/MPBox.d.ts +1 -1
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +2 -2
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/confirm/MPConfirmProvider.js +1 -1
- package/dist/components/data-table/MPDataTable.d.ts +20 -1
- package/dist/components/data-table/MPDataTable.js +1 -1
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +1 -1
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
- package/dist/components/grid/MPGrid.d.ts +25 -8
- package/dist/components/grid/MPGrid.js +1 -1
- package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +12 -3
- package/dist/components/heatmap-chart/MPHeatmapChart.js +1 -1
- package/dist/components/hover-card/MPHoverCard.d.ts +1 -0
- package/dist/components/hover-card/MPHoverCard.js +1 -1
- package/dist/components/icon/MPIcon.js +1 -1
- package/dist/components/image/MPImage.d.ts +112 -4
- package/dist/components/image/MPImage.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/line-chart/MPLineChart.d.ts +20 -2
- package/dist/components/line-chart/MPLineChart.js +1 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +1 -1
- package/dist/components/menubar/MPMenubar.js +1 -1
- package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/pie-chart/MPPieChart.d.ts +23 -1
- package/dist/components/pie-chart/MPPieChart.js +1 -1
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popconfirm/MPPopconfirm.d.ts +2 -2
- package/dist/components/popover/MPPopover.d.ts +1 -0
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/portal/MPPortal.d.ts +1 -1
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.js +1 -1
- package/dist/components/scatter-chart/MPScatterChart.d.ts +5 -1
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/sparkline/MPSparkline.d.ts +14 -1
- package/dist/components/sparkline/MPSparkline.js +1 -1
- package/dist/components/statistic/MPStatistic.js +1 -1
- package/dist/components/stepper/MPStepper.js +1 -1
- package/dist/components/table/MPTable.d.ts +1 -1
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/timeline-chart/MPTimelineChart.d.ts +6 -2
- package/dist/components/toggle/MPToggle.js +1 -1
- package/dist/components/tooltip/MPTooltip.js +1 -1
- package/dist/components/tour/MPTour.js +1 -1
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/typography/MPTypography.d.ts +1 -1
- package/dist/constants/glyphs.d.ts +32 -32
- package/dist/constants/icons.d.ts +32 -32
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/ChartChrome.d.ts +63 -19
- package/dist/internal/ChartChrome.js +1 -1
- package/dist/internal/ChartFrame.d.ts +24 -4
- package/dist/internal/ChartFrame.js +1 -1
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/PopupArrow.d.ts +60 -0
- package/dist/internal/PopupArrow.js +2 -0
- package/dist/internal/SupportingText.js +1 -1
- package/dist/internal/chart.d.ts +91 -13
- package/dist/internal/chart.js +1 -1
- package/dist/internal/color-scheme.d.ts +0 -9
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/data-table.d.ts +35 -2
- package/dist/internal/data-table.js +1 -1
- package/dist/internal/date.d.ts +22 -18
- package/dist/internal/date.js +1 -1
- package/dist/internal/i18n.d.ts +14 -0
- package/dist/internal/intl.d.ts +64 -0
- package/dist/internal/intl.js +1 -0
- package/dist/internal/messages/chart.d.ts +1 -1
- package/dist/internal/messages/chart.js +1 -1
- package/dist/internal/messages/transfer.d.ts +1 -1
- package/dist/internal/messages/transfer.js +1 -1
- package/dist/internal/text.js +1 -1
- package/dist/internal/time-scale.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/alert.css +1 -1
- package/dist/styles/app-logo.css +1 -1
- package/dist/styles/area-chart.css +1 -1
- package/dist/styles/aspect-ratio.css +1 -1
- package/dist/styles/bar-chart.css +1 -1
- package/dist/styles/blockquote.css +1 -1
- package/dist/styles/bottom-navigation.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/chat-bubble.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chip.css +1 -1
- package/dist/styles/code-block.css +1 -1
- package/dist/styles/collapsible.css +1 -1
- package/dist/styles/color-picker.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/confirm.css +1 -1
- package/dist/styles/data-table.css +1 -1
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/date-time-picker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/file-picker.css +1 -1
- package/dist/styles/flex.css +1 -1
- package/dist/styles/floating-action-button.css +1 -1
- package/dist/styles/gauge-chart.css +1 -1
- package/dist/styles/grid.css +1 -1
- package/dist/styles/heatmap-chart.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/icon.css +1 -1
- package/dist/styles/image.css +1 -1
- package/dist/styles/line-chart.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -1
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-field.css +1 -1
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/pie-chart.css +1 -1
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +1 -1
- package/dist/styles/popover.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/scatter-chart.css +1 -1
- package/dist/styles/scroll-zone.css +1 -1
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/sidebar.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/sparkline.css +1 -1
- package/dist/styles/spoiler.css +1 -1
- package/dist/styles/statistic.css +1 -1
- package/dist/styles/stepper.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text-link.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/timeline-chart.css +1 -1
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/toggle.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/tour.css +1 -1
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/tree-select.css +1 -1
- package/dist/styles/tree-view.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1253 -55
- package/dist/types.d.ts +210 -3
- package/package.json +47 -26
- package/.fix.py +0 -92
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";import{DataBindingSchema as t,FunctionCallSchema as a,DynamicStringSchema as o}from"@a2ui/web_core/v0_9";const i=(o,i)=>e.union([e.array(o),t,a]).describe(i),r=e.enum(["primary","secondary","tertiary","error"]).describe("Which accent role this reads, out of the page's own colour scheme. Omit it to take the next slot of the chart palette, which is what keeps a set of series distinguishable."),s={accessibility:e.object({label:o.optional().describe("A short name used by assistive technologies."),description:o.optional().describe("Additional detail about the element.")}).strict().optional(),weight:e.number().describe("The relative weight of this component within a Row or Column, like CSS 'flex-grow'. Only meaningful as a direct child of one.").optional()},n=e.object({key:e.string().describe("The property this column reads from each row. Also the column's own id."),label:o.optional().describe("The column heading. Defaults to the key itself."),align:e.enum(["start","center","end"]).describe("Where the cell's contents sit. Use 'end' for a column of numbers.").optional(),sortable:e.boolean().describe("Whether the reader may sort by this column. Defaults to true.").optional(),searchable:e.boolean().describe("Whether the search box looks in this column. Defaults to true.").optional(),width:e.number().describe("The column's width in pixels. Omit to share the room.").optional()}).strict();export const DataTableApi={name:"DataTable",schema:e.object({...s,columns:e.array(n).min(1).describe("The columns, in the order they are drawn."),rows:i(e.record(e.any()),"The rows: an array of objects keyed by the columns above, or a path to one in the data model. Bind a path when the data arrives separately from the table."),rowKey:e.string().describe("The column key whose value identifies a row, used for selection. Defaults to the row's position, which is only stable while the rows are.").optional(),caption:o.optional().describe("A description of the table, read out before its contents. Use it to say what the rows are, since column headings rarely say that on their own."),searchable:e.boolean().describe("Puts a search box above the table. Defaults to false.").optional(),sortable:e.boolean().describe("Lets the reader sort by any sortable column. Defaults to true.").optional(),paged:e.boolean().describe("Splits the rows into pages. Worth it past about twenty rows.").optional(),pageSize:e.number().int().positive().describe("Rows per page. Defaults to 10.").optional(),selection:e.enum(["none","single","multiple"]).describe("Whether the reader may pick rows, and how many. 'multiple' draws a column of checkboxes and 'single' picks the row that is pressed. Bind 'selectedKeys' to read the choice back.").optional(),selectedKeys:e.union([e.array(e.string()),t]).describe("The keys of the selected rows. Bind this to a path to be told what the reader picked.").optional(),striped:e.boolean().describe("Shades alternate rows, which helps a wide table be read across.").optional()}).strict().describe("A table of rows and columns, with sorting, searching, paging and selection. Prefer this to a Row-and-Column layout whenever the data is tabular: it is announced as a table, it can be sorted, and it stays readable on a narrow screen.")};const h=e.object({name:e.string().describe("The name of this series, in the legend and the hover panel.").optional(),data:e.array(e.number().nullable()).describe("Its values, one per category, in category order. `null` is a gap, not a zero."),color:r.optional()}).strict(),l={...s,series:i(h,"The series, in the order their colours are handed out. A literal array, or a path to one in the data model."),categories:e.union([e.array(e.string()),t]).describe("The category axis' labels, one per value in each series.").optional(),label:o.optional().describe("What the chart is of, read out before it. A chart with no label is a picture assistive technology cannot describe."),xAxisLabel:o.optional().describe("A name for what the category axis counts."),yAxisLabel:o.optional().describe("A name for what the value axis measures."),height:e.number().describe("The plot height in pixels. Defaults to a size that suits the chart.").optional(),legend:e.boolean().describe("Whether to draw the legend. Defaults to on past one series.").optional()};export const BarChartApi={name:"BarChart",schema:e.object({...l,stacked:e.boolean().describe("Stacks the series into one bar per category instead of drawing them side by side.").optional(),horizontal:e.boolean().describe("Turns the bars sideways, which is what long category names need.").optional()}).strict().describe("A bar chart, for comparing a value across categories.")};export const LineChartApi={name:"LineChart",schema:e.object({...l,curve:e.enum(["linear","smooth","step"]).describe("How a line gets from one point to the next. 'step' is for a value that holds and then changes, such as a price.").optional(),markers:e.boolean().describe("Draws a dot at each point. Defaults to on while the points are few enough.").optional()}).strict().describe("A line chart, for a value that moves over a sequence — usually time.")};export const PieChartApi={name:"PieChart",schema:e.object({...s,data:i(e.number().nullable(),"One value per slice, in the order of `categories`. A literal array, or a path to one in the data model."),categories:e.union([e.array(e.string()),t]).describe("Each slice's name, in the legend and the hover panel.").optional(),shape:e.enum(["pie","donut","semi"]).describe("The shape it is drawn as. 'donut' leaves room in the middle.").optional(),label:o.optional().describe("What the chart is of, read out before it."),height:e.number().describe("The plot height in pixels.").optional(),legend:e.boolean().describe("Whether to draw the legend. Defaults to on.").optional()}).strict().describe("A pie or donut chart, for parts of one whole. Use it only when the parts add up to something — a bar chart is easier to read for anything else, and far easier past about six slices.")};export const StatisticApi={name:"Statistic",schema:e.object({...s,value:e.union([e.string(),e.number(),t,a]).describe("The figure itself. A number is formatted in the reader's locale; a string is drawn as it is."),label:o.optional().describe("What the figure is of, drawn above it."),previousValue:e.number().describe("What the figure was, which is what turns `delta` into a change.").optional(),delta:e.enum(["percent","absolute","both","none"]).describe("How the change from `previousValue` is written. Defaults to a percentage when there is a previous value.").optional(),betterWhen:e.enum(["up","down"]).describe("Which direction is good news, which decides the colour of the change. Set it on a figure where down is better, such as a cost or a bounce rate — the default assumes up.").optional(),unit:o.optional().describe("A unit after the figure, such as `ms` or `kg`."),prefix:o.optional().describe("A symbol before the figure, such as `$`."),period:o.optional().describe("What the change is measured over, such as `vs last week`."),caption:o.optional().describe("A line under the figure."),compact:e.boolean().describe("Whether a number of five digits or more is written short: 12.4K rather than 12,400. On by default, because that is what a headline figure wants; pass false for one that has to be read exactly.").optional(),align:e.enum(["start","center","end"]).describe("Where the block sits. Defaults to the start.").optional()}).strict().describe("One figure, with what it is and how it has changed. The component to reach for when the answer is a number — a chart of one point is not a chart.")};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the three charts share, and why any of it needs checking.
|
|
3
|
+
*
|
|
4
|
+
* **A bound list is not a validated list.** The SDK's binder checks a payload
|
|
5
|
+
* against the schema, and a `series` the agent wrote out literally is therefore
|
|
6
|
+
* known to be series-shaped. A `series` bound to a path is not: the schema
|
|
7
|
+
* approved the *binding*, and what comes back is whatever the data model holds at
|
|
8
|
+
* that moment — half-written by an earlier message, replaced by a later one, or
|
|
9
|
+
* simply not what the agent intended. A chart handed `{ data: 'later' }` where it
|
|
10
|
+
* expected numbers renders nothing and throws inside the scale.
|
|
11
|
+
*
|
|
12
|
+
* So the resolved value is read rather than trusted: a list becomes a list, a
|
|
13
|
+
* number stays a number, and anything else becomes a gap. What that buys is a
|
|
14
|
+
* chart that draws what arrived and keeps drawing as the rest of it does.
|
|
15
|
+
*/
|
|
16
|
+
import type { MPChartDatum, MPChartSeries } from '../../types.js';
|
|
17
|
+
/** A list of values, from whatever the binding resolved to. */
|
|
18
|
+
export declare const toData: (value: unknown) => MPChartDatum[];
|
|
19
|
+
/** The series, from whatever the binding resolved to. */
|
|
20
|
+
export declare const toSeries: (value: unknown) => MPChartSeries[];
|
|
21
|
+
/** The category labels, which are strings or nothing. */
|
|
22
|
+
export declare const toCategories: (value: unknown) => string[] | undefined;
|
|
23
|
+
/** An axis, only when there is something to name it. */
|
|
24
|
+
export declare const toAxis: (label?: string) => {
|
|
25
|
+
label: string;
|
|
26
|
+
} | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{asText as o}from"../internal/common.js";const r=o=>"number"==typeof o&&Number.isFinite(o)?o:null;export const toData=o=>Array.isArray(o)?o.map(r):[];export const toSeries=r=>Array.isArray(r)?r.map(r=>{const t=r??{};return{name:o(t.name),data:toData(t.data),color:o(t.color)}}):[];export const toCategories=r=>Array.isArray(r)?r.map(r=>o(r)??""):void 0;export const toAxis=o=>o?{label:o}:void 0;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2UI's basic catalog, drawn as Material Design 3.
|
|
3
|
+
*
|
|
4
|
+
* [A2UI](https://a2ui.org) is a protocol for an agent to describe an interface
|
|
5
|
+
* rather than write one: the agent sends JSON naming components from a *catalog*,
|
|
6
|
+
* and a renderer on the client draws them. The catalog is the contract — which
|
|
7
|
+
* components exist, what props each takes — and this module is an implementation
|
|
8
|
+
* of the protocol's own basic catalog, so an agent that already targets it gets
|
|
9
|
+
* Material Plus on the other end with nothing changed at its end.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { A2uiSurface } from '@a2ui/react/v0_9';
|
|
13
|
+
* import { MessageProcessor } from '@a2ui/web_core/v0_9';
|
|
14
|
+
* import { mpA2uiCatalog } from 'material-plus-ui/a2ui';
|
|
15
|
+
* import 'material-plus-ui/styles.css';
|
|
16
|
+
*
|
|
17
|
+
* const processor = new MessageProcessor([mpA2uiCatalog]);
|
|
18
|
+
*
|
|
19
|
+
* processor.processMessages(messagesFromTheAgent);
|
|
20
|
+
*
|
|
21
|
+
* const surfaces = Array.from(processor.model.surfacesMap.values());
|
|
22
|
+
*
|
|
23
|
+
* surfaces.map((surface) => <A2uiSurface key={surface.id} surface={surface} />);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ## The two packages this needs, and why they are optional
|
|
27
|
+
*
|
|
28
|
+
* `@a2ui/react` and `@a2ui/web_core` are **optional peer dependencies**: install
|
|
29
|
+
* them and this subpath works, leave them out and nothing else in the library
|
|
30
|
+
* notices. That is not tidiness. The protocol SDK brings Lit, signals, Zod, a
|
|
31
|
+
* date library and a Markdown parser with it, and the rest of this package
|
|
32
|
+
* promises two runtime dependencies — so the SDK stays behind an import that only
|
|
33
|
+
* a project rendering agent interfaces ever writes. Nothing in `src/` outside this
|
|
34
|
+
* directory imports either package, and this module is not in the main barrel.
|
|
35
|
+
*
|
|
36
|
+
* ## No stylesheet of its own
|
|
37
|
+
*
|
|
38
|
+
* Everything here draws with components from this library, which means the
|
|
39
|
+
* ordinary `material-plus-ui/styles.css` is all a surface needs, and the split
|
|
40
|
+
* per-component sheets keep working as they always did. That is also why nothing
|
|
41
|
+
* in this directory writes a utility class: a class used only here would be a rule
|
|
42
|
+
* in the whole stylesheet and in none of the split ones. Where a declaration is
|
|
43
|
+
* genuinely needed it is written inline, off the `--mp-sys-*` tokens, so a page
|
|
44
|
+
* that set `data-mp-shape` or a source colour reaches an agent's surface too.
|
|
45
|
+
*
|
|
46
|
+
* ## What the agent can and cannot do
|
|
47
|
+
*
|
|
48
|
+
* A surface is JSON from a language model, so the boundary matters:
|
|
49
|
+
*
|
|
50
|
+
* - **The catalog is the allowlist.** A component name that is not one of the
|
|
51
|
+
* eighteen does not resolve, and there is no path from a payload to a component
|
|
52
|
+
* of your own unless you registered it with `createMPA2uiCatalog`.
|
|
53
|
+
* - **Props are validated against the schemas** by the SDK's binder before they
|
|
54
|
+
* reach anything here, which is why these implementations do not re-check types.
|
|
55
|
+
* - **Text is text.** Markdown is rendered only when the application has
|
|
56
|
+
* configured a renderer through `@a2ui/react`'s Markdown context, whose contract
|
|
57
|
+
* requires it to sanitize; with none configured, an agent's string is drawn as
|
|
58
|
+
* the characters it contains. See `components/MPA2uiText.tsx`.
|
|
59
|
+
* - **URLs are the agent's.** `Image`, `Video` and `AudioPlayer` load what the
|
|
60
|
+
* payload names them, so a surface from an agent you do not control belongs
|
|
61
|
+
* behind a Content Security Policy that says where media may come from.
|
|
62
|
+
*
|
|
63
|
+
* ## Two catalogs, and where they stop
|
|
64
|
+
*
|
|
65
|
+
* `mpA2uiCatalog` is the eighteen, under the basic catalog's id. `mpA2uiExtendedCatalog`
|
|
66
|
+
* is those plus five of this library's own — a data table, a bar, line and pie
|
|
67
|
+
* chart, and a statistic — under an id of ours, because five components the basic
|
|
68
|
+
* vocabulary cannot express are a different contract and must not claim to be that
|
|
69
|
+
* one. Their schemas are `extended/api.ts` and are published, generated from those
|
|
70
|
+
* schemas, at the id itself.
|
|
71
|
+
*
|
|
72
|
+
* Twenty-three of a hundred and thirty, then. The rest — the command palette, the
|
|
73
|
+
* calendar, the tour, the animations — are not reachable from a payload, and a
|
|
74
|
+
* component only becomes reachable by being given a schema an agent can fill in
|
|
75
|
+
* from JSON alone. `createMPA2uiCatalog` is how a project adds its own.
|
|
76
|
+
*/
|
|
77
|
+
export { A2UI_BASIC_CATALOG_ID, MP_A2UI_CATALOG_ID, MP_A2UI_COMPONENTS, MP_A2UI_EXTENDED_COMPONENTS, createMPA2uiCatalog, mpA2uiCatalog, mpA2uiExtendedCatalog } from './catalog.js';
|
|
78
|
+
export { MPA2uiAudioPlayer } from './components/MPA2uiAudioPlayer.js';
|
|
79
|
+
export { MPA2uiButton } from './components/MPA2uiButton.js';
|
|
80
|
+
export { MPA2uiCard } from './components/MPA2uiCard.js';
|
|
81
|
+
export { MPA2uiCheckBox } from './components/MPA2uiCheckBox.js';
|
|
82
|
+
export { MPA2uiChoicePicker } from './components/MPA2uiChoicePicker.js';
|
|
83
|
+
export { MPA2uiColumn } from './components/MPA2uiColumn.js';
|
|
84
|
+
export { MPA2uiDateTimeInput } from './components/MPA2uiDateTimeInput.js';
|
|
85
|
+
export { MPA2uiDivider } from './components/MPA2uiDivider.js';
|
|
86
|
+
export { MPA2uiIcon } from './components/MPA2uiIcon.js';
|
|
87
|
+
export { MPA2uiImage } from './components/MPA2uiImage.js';
|
|
88
|
+
export { MPA2uiList } from './components/MPA2uiList.js';
|
|
89
|
+
export { MPA2uiModal } from './components/MPA2uiModal.js';
|
|
90
|
+
export { MPA2uiRow } from './components/MPA2uiRow.js';
|
|
91
|
+
export { MPA2uiSlider } from './components/MPA2uiSlider.js';
|
|
92
|
+
export { MPA2uiTabs } from './components/MPA2uiTabs.js';
|
|
93
|
+
export { MPA2uiText } from './components/MPA2uiText.js';
|
|
94
|
+
export { MPA2uiTextField } from './components/MPA2uiTextField.js';
|
|
95
|
+
export { MPA2uiVideo } from './components/MPA2uiVideo.js';
|
|
96
|
+
export { MPA2uiBarChart } from './extended/MPA2uiBarChart.js';
|
|
97
|
+
export { MPA2uiDataTable } from './extended/MPA2uiDataTable.js';
|
|
98
|
+
export { MPA2uiLineChart } from './extended/MPA2uiLineChart.js';
|
|
99
|
+
export { MPA2uiPieChart } from './extended/MPA2uiPieChart.js';
|
|
100
|
+
export { MPA2uiStatistic } from './extended/MPA2uiStatistic.js';
|
|
101
|
+
export { BarChartApi, DataTableApi, LineChartApi, PieChartApi, StatisticApi } from './extended/api.js';
|
|
102
|
+
export { A2UI_ICONS } from './internal/icons.js';
|
|
103
|
+
export type { MPA2uiAccessibility } from './internal/common.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{A2UI_BASIC_CATALOG_ID,MP_A2UI_CATALOG_ID,MP_A2UI_COMPONENTS,MP_A2UI_EXTENDED_COMPONENTS,createMPA2uiCatalog,mpA2uiCatalog,mpA2uiExtendedCatalog}from"./catalog.js";export{MPA2uiAudioPlayer}from"./components/MPA2uiAudioPlayer.js";export{MPA2uiButton}from"./components/MPA2uiButton.js";export{MPA2uiCard}from"./components/MPA2uiCard.js";export{MPA2uiCheckBox}from"./components/MPA2uiCheckBox.js";export{MPA2uiChoicePicker}from"./components/MPA2uiChoicePicker.js";export{MPA2uiColumn}from"./components/MPA2uiColumn.js";export{MPA2uiDateTimeInput}from"./components/MPA2uiDateTimeInput.js";export{MPA2uiDivider}from"./components/MPA2uiDivider.js";export{MPA2uiIcon}from"./components/MPA2uiIcon.js";export{MPA2uiImage}from"./components/MPA2uiImage.js";export{MPA2uiList}from"./components/MPA2uiList.js";export{MPA2uiModal}from"./components/MPA2uiModal.js";export{MPA2uiRow}from"./components/MPA2uiRow.js";export{MPA2uiSlider}from"./components/MPA2uiSlider.js";export{MPA2uiTabs}from"./components/MPA2uiTabs.js";export{MPA2uiText}from"./components/MPA2uiText.js";export{MPA2uiTextField}from"./components/MPA2uiTextField.js";export{MPA2uiVideo}from"./components/MPA2uiVideo.js";export{MPA2uiBarChart}from"./extended/MPA2uiBarChart.js";export{MPA2uiDataTable}from"./extended/MPA2uiDataTable.js";export{MPA2uiLineChart}from"./extended/MPA2uiLineChart.js";export{MPA2uiPieChart}from"./extended/MPA2uiPieChart.js";export{MPA2uiStatistic}from"./extended/MPA2uiStatistic.js";export{BarChartApi,DataTableApi,LineChartApi,PieChartApi,StatisticApi}from"./extended/api.js";export{A2UI_ICONS}from"./internal/icons.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `children` list, as nodes with keys.
|
|
3
|
+
*
|
|
4
|
+
* A2UI never nests components. A layout's `children` is a list of ids, and the
|
|
5
|
+
* renderer resolves each id against the surface — which is what `buildChild`
|
|
6
|
+
* does. The list arrives in one of two shapes, and both mean "these children, in
|
|
7
|
+
* this order":
|
|
8
|
+
*
|
|
9
|
+
* - a plain id, for a fixed child the agent wrote down;
|
|
10
|
+
* - an id with a `basePath`, for a child generated from a data list. The path is
|
|
11
|
+
* the row that child reads, so the same component definition draws once per
|
|
12
|
+
* row and each copy binds to its own.
|
|
13
|
+
*
|
|
14
|
+
* The key has to carry the path for the second shape. One template over five
|
|
15
|
+
* rows is five children of the same id, and keying on the id alone would make
|
|
16
|
+
* them one child that React re-mounts as the data moves.
|
|
17
|
+
*/
|
|
18
|
+
import type { ResolvedChildRef } from '@a2ui/web_core/v0_9';
|
|
19
|
+
import type * as React from 'react';
|
|
20
|
+
/** What a component implementation is handed to resolve an id with. */
|
|
21
|
+
export type MPA2uiBuildChild = (id: string, basePath?: string) => React.ReactNode;
|
|
22
|
+
/** One resolved child, ready to be placed. */
|
|
23
|
+
export interface MPA2uiChild {
|
|
24
|
+
key: string;
|
|
25
|
+
node: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/** The list a layout was given, resolved in order. */
|
|
28
|
+
export declare const childNodes: (children: readonly (string | ResolvedChildRef)[] | undefined, buildChild: MPA2uiBuildChild) => MPA2uiChild[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const childNodes=(e,a)=>Array.isArray(e)?e.map((e,d)=>"string"==typeof e?{key:`${e}-${d}`,node:a(e)}:{key:`${e.id}-${e.basePath}`,node:a(e.id,e.basePath)}):[];
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three things the protocol asks of every component here, and the
|
|
3
|
+
* conversions that follow from them.
|
|
4
|
+
*
|
|
5
|
+
* A2UI's props are not React props. They arrive from an agent as JSON, the
|
|
6
|
+
* renderer's binder resolves them — a data binding becomes the value it points
|
|
7
|
+
* at, an action becomes a closure — and what reaches a component is that
|
|
8
|
+
* resolved object. Two of its entries are on *every* component in the basic
|
|
9
|
+
* catalog and correspond to nothing a Material Plus component takes:
|
|
10
|
+
*
|
|
11
|
+
* - `weight` is a flex share, meaningful only inside a Row or a Column. It is a
|
|
12
|
+
* number in the payload and a `style` here, because no component in this
|
|
13
|
+
* library has a prop for how much of a parent's main axis it should claim —
|
|
14
|
+
* `MPFlex` distributes, and the claim belongs to the child.
|
|
15
|
+
* - `accessibility` carries a label and a description for assistive technology.
|
|
16
|
+
*
|
|
17
|
+
* The rest of this file is the vocabulary gap. A2UI writes `spaceBetween` where
|
|
18
|
+
* `MPFlex` writes `space-between`, and its date and time values are ISO 8601
|
|
19
|
+
* strings where every picker in this library works in `Date`.
|
|
20
|
+
*/
|
|
21
|
+
import type * as React from 'react';
|
|
22
|
+
import type { MPGridAlign, MPGridJustify } from '../../components/grid/MPGrid.js';
|
|
23
|
+
/**
|
|
24
|
+
* What an agent can say about a component to a screen reader.
|
|
25
|
+
*
|
|
26
|
+
* `unknown` rather than `string`, and that is the SDK's type rather than a
|
|
27
|
+
* looseness of ours. Its binder resolves a data binding wherever one appears,
|
|
28
|
+
* however deeply — so both of these are strings by the time a component runs —
|
|
29
|
+
* but the *type* it publishes only resolves the props at the top level. Anything
|
|
30
|
+
* one object further in keeps the `string | DataBinding | FunctionCall` union the
|
|
31
|
+
* schema declared, so what a component receives is wider than what it gets.
|
|
32
|
+
*
|
|
33
|
+
* `asText` is the one place that difference is handled.
|
|
34
|
+
*/
|
|
35
|
+
export interface MPA2uiAccessibility {
|
|
36
|
+
/** The accessible name. */
|
|
37
|
+
label?: unknown;
|
|
38
|
+
/** The longer form, for what the name cannot carry. */
|
|
39
|
+
description?: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A resolved dynamic value, as the string it is.
|
|
43
|
+
*
|
|
44
|
+
* For the nested props described above: a `title`, an option's `label`, the two
|
|
45
|
+
* `accessibility` entries. Anything that is not a string is dropped rather than
|
|
46
|
+
* coerced, because the alternative is `String({ path: 'user.name' })` — the words
|
|
47
|
+
* `[object Object]` drawn in an interface, which is worse than the missing label
|
|
48
|
+
* it would be standing in for.
|
|
49
|
+
*/
|
|
50
|
+
export declare const asText: (value: unknown) => string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* `weight` as the declaration a flex child needs.
|
|
53
|
+
*
|
|
54
|
+
* `minWidth` and `minHeight` go with it. A flex item's automatic minimum size is
|
|
55
|
+
* its content, so a weighted child holding a long word or a wide image refuses
|
|
56
|
+
* to shrink below it and the row overflows instead of dividing as asked.
|
|
57
|
+
*/
|
|
58
|
+
export declare const weightStyle: (weight?: number) => React.CSSProperties | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* `accessibility` as attributes an element takes.
|
|
61
|
+
*
|
|
62
|
+
* The description becomes `title` rather than `aria-description`, which is still
|
|
63
|
+
* a draft attribute no browser maps to anything. `title` is announced by every
|
|
64
|
+
* screen reader in use and shows as a tooltip besides, which is the closer
|
|
65
|
+
* reading of what an agent means by a description.
|
|
66
|
+
*
|
|
67
|
+
* Spread onto the element a component owns. It is *not* spread onto a labelled
|
|
68
|
+
* control — a text field, a checkbox, a slider — because those carry a `label`
|
|
69
|
+
* of their own from the payload, and an `aria-label` beside it replaces the
|
|
70
|
+
* label the reader can see with one they cannot.
|
|
71
|
+
*/
|
|
72
|
+
export declare const accessibilityAttributes: (accessibility?: MPA2uiAccessibility) => {
|
|
73
|
+
'aria-label': string | undefined;
|
|
74
|
+
title: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* A2UI's main-axis words, in `MPFlex`'s spelling.
|
|
78
|
+
*
|
|
79
|
+
* `stretch` has no main-axis meaning in flexbox and is dropped to `start`, the
|
|
80
|
+
* same reading a browser gives `justify-content: stretch` on a flex container.
|
|
81
|
+
* The cross axis is where stretching happens, and that is `align` below.
|
|
82
|
+
*/
|
|
83
|
+
export declare const FLEX_JUSTIFY: Record<string, MPGridJustify>;
|
|
84
|
+
/** A2UI's cross-axis words, which are `MPFlex`'s own. */
|
|
85
|
+
export declare const FLEX_ALIGN: Record<string, MPGridAlign>;
|
|
86
|
+
/**
|
|
87
|
+
* An ISO 8601 date, time, or date and time, as a local `Date`.
|
|
88
|
+
*
|
|
89
|
+
* Parsed by hand rather than handed to `new Date(value)`, because the two
|
|
90
|
+
* shapes an agent sends most are the two the constructor reads as UTC:
|
|
91
|
+
* `2026-03-01` is midnight in Greenwich, which is the 28th of February
|
|
92
|
+
* anywhere west of it, and a calendar that opens on the wrong day is the bug
|
|
93
|
+
* this avoids. A local `Date` is what the pickers here work in, so the value is
|
|
94
|
+
* read as the wall clock it plainly is.
|
|
95
|
+
*
|
|
96
|
+
* A value carrying its own offset — `...Z`, `...+09:00` — is unambiguous and
|
|
97
|
+
* goes to the constructor, which converts it to this machine's clock.
|
|
98
|
+
*/
|
|
99
|
+
export declare const parseIsoValue: (value?: string) => Date | null;
|
|
100
|
+
/**
|
|
101
|
+
* A `Date` as the ISO 8601 string the payload holds, in the precision that was
|
|
102
|
+
* asked for.
|
|
103
|
+
*
|
|
104
|
+
* Local parts, never `toISOString()`: that prints UTC, and a Seoul afternoon
|
|
105
|
+
* written back as the previous day's UTC evening would move the value every
|
|
106
|
+
* time the agent read it back. The shapes are the ones an HTML date, time and
|
|
107
|
+
* `datetime-local` input produce, which is what the protocol's own renderer
|
|
108
|
+
* writes and therefore what an agent is most likely to parse.
|
|
109
|
+
*/
|
|
110
|
+
export declare const formatIsoValue: (date: Date | null, { withDate, withTime }: {
|
|
111
|
+
withDate: boolean;
|
|
112
|
+
withTime: boolean;
|
|
113
|
+
}) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const asText=e=>"string"==typeof e?e:void 0;export const weightStyle=e=>{if("number"==typeof e)return{flex:String(e),minWidth:0,minHeight:0}};export const accessibilityAttributes=e=>({"aria-label":asText(e?.label),title:asText(e?.description)});export const FLEX_JUSTIFY={start:"start",center:"center",end:"end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"start"};export const FLEX_ALIGN={start:"start",center:"center",end:"end",stretch:"stretch"};const e=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/,t=/^(\d{2}):(\d{2})(?::(\d{2}(?:\.\d+)?))?$/;export const parseIsoValue=r=>{if(!r)return null;const n=t.exec(r);if(n){const e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate(),Number(n[1]),Number(n[2]),Number(n[3]??0))}if(/[Z+]|\d-\d{2}:\d{2}$/.test(r.slice(10))){const e=new Date(r);return Number.isNaN(e.getTime())?null:e}const s=e.exec(r);return s?new Date(Number(s[1]),Number(s[2])-1,Number(s[3]),Number(s[4]??0),Number(s[5]??0),Number(s[6]??0)):null};const r=e=>String(e).padStart(2,"0");export const formatIsoValue=(e,{withDate:t,withTime:n})=>{if(!e||Number.isNaN(e.getTime()))return"";const s=`${e.getFullYear()}-${r(e.getMonth()+1)}-${r(e.getDate())}`,a=`${r(e.getHours())}:${r(e.getMinutes())}`;return t&&n?`${s}T${a}`:n?a:s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ArrowLeft as e,ArrowRight as o,Bell as r,BellOff as a,Calendar as i,CalendarDays as t,Camera as n,Check as l,CircleAlert as s,CircleQuestionMark as c,CircleUser as f,CreditCard as p,Download as d,Ellipsis as m,EllipsisVertical as u,Eye as h,EyeOff as v,FastForward as w,Folder as O,Heart as k,HeartOff as y,House as g,Image as C,Info as F,Lock as b,LockOpen as x,Mail as H,MapPin as I,Menu as N,Paperclip as U,Pause as z,Pencil as A,Phone as B,Play as D,Plus as M,Printer as P,RefreshCw as S,Rewind as T,Search as V,Send as _,Settings as j,Share2 as q,ShoppingCart as E,SkipBack as G,SkipForward as J,Smartphone as K,Square as L,Star as Q,StarHalf as R,StarOff as W,Trash2 as X,TriangleAlert as Y,Upload as Z,User as $,Volume1 as ee,Volume2 as oe,VolumeOff as re,VolumeX as ae,X as ie}from"lucide-react";export const A2UI_ICONS={accountCircle:f,add:M,arrowBack:e,arrowForward:o,attachFile:U,calendarToday:t,call:B,camera:n,check:l,close:ie,delete:X,download:d,edit:A,event:i,error:s,fastForward:w,favorite:k,favoriteOff:y,folder:O,help:c,home:g,info:F,locationOn:I,lock:b,lockOpen:x,mail:H,menu:N,moreVert:u,moreHoriz:m,notificationsOff:a,notifications:r,pause:z,payment:p,person:$,phone:K,photo:C,play:D,print:P,refresh:S,rewind:T,search:V,send:_,settings:j,share:q,shoppingCart:E,skipNext:J,skipPrevious:G,star:Q,starHalf:R,starOff:W,stop:L,upload:Z,visibility:h,visibilityOff:v,volumeDown:ee,volumeMute:ae,volumeOff:re,volumeUp:oe,warning:Y};
|
|
@@ -32,7 +32,7 @@ export interface MPAlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>
|
|
|
32
32
|
*
|
|
33
33
|
* Four roles, not a severity ladder — there is no `info`, `success` or
|
|
34
34
|
* `warning` here, because [the specification's colour
|
|
35
|
-
* system](
|
|
35
|
+
* system](../../design/color) has no way to derive them and a library that
|
|
36
36
|
* invented three more families would be promising tokens the sheet cannot
|
|
37
37
|
* produce. `error` is the one severity Material does name, and the rest is an
|
|
38
38
|
* emphasis decision: `primary` for a notice, `secondary` or `tertiary` for one
|
|
@@ -118,7 +118,7 @@ export interface MPAlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>
|
|
|
118
118
|
* `transition="fade"` is the whole of what most callers want; the object form
|
|
119
119
|
* takes a duration, an edge to come from, or a scale to start at. Anything
|
|
120
120
|
* that has to run again — on scroll, on hover, under your own control — is an
|
|
121
|
-
* [MPAnimateFade](../
|
|
121
|
+
* [MPAnimateFade](../transitions/animate-fade) and its siblings.
|
|
122
122
|
*/
|
|
123
123
|
transition?: MPTransition;
|
|
124
124
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{MPIcon as r}from"../icon/MPIcon.js";import{CloseIcon as i,ErrorIcon as o,InfoIcon as a}from"../../constants/icons.js";import{accentSlots as l}from"../../internal/accent.js";import{transitionProps as s}from"../../internal/transition.js";import{useMPLocale as c,useMPMessages as m}from"../../internal/locale.js";import{ALERT as d}from"../../internal/messages/alert.js";import{inertProps as p}from"../../internal/inert.js";import{MPStateLayer as f}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,hasContent as x,PROSE_TEXT as v,SHEET_GAP as h,SHEET_TITLE as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{MPIcon as r}from"../icon/MPIcon.js";import{CloseIcon as i,ErrorIcon as o,InfoIcon as a}from"../../constants/icons.js";import{accentSlots as l}from"../../internal/accent.js";import{transitionProps as s}from"../../internal/transition.js";import{useMPLocale as c,useMPMessages as m}from"../../internal/locale.js";import{ALERT as d}from"../../internal/messages/alert.js";import{inertProps as p}from"../../internal/inert.js";import{MPStateLayer as f}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,hasContent as x,PROSE_TEXT as v,SHEET_GAP as h,SHEET_TITLE as b,STACK_GAP as j}from"../../internal/scale.js";import{sheetPad as y}from"../../internal/density.js";import{useMPColor as g,useMPDensity as N,useMPSize as w}from"../../internal/config.js";const _={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface",outlined:"border-mp-outline border bg-transparent text-mp-on-surface",text:"bg-transparent text-mp-on-surface"},z={filled:"",tonal:"",elevated:"text-(--_mp-accent)",outlined:"text-(--_mp-accent)",text:"text-(--_mp-accent)"},k={filled:"",tonal:"",elevated:"text-mp-on-surface-variant",outlined:"text-mp-on-surface-variant",text:"text-mp-on-surface-variant"},C={primary:"polite",secondary:"polite",tertiary:"polite",error:"assertive"},B={assertive:"alert",polite:"status",off:void 0};export const MPAlert=/*@__PURE__*/n.forwardRef(function({variant:L="tonal",color:R,size:S,density:E,title:M,icon:P,action:T,live:A,onClose:D,closeLabel:F,locale:I,transition:$,className:q,style:G,children:H,...J},K){const O=s($),Q=g(R),U=w(S),V=N(E),W=c(I),X=m(d,W),[Y,Z]=n.useState(!1),ee=n.useRef(null),te=n.useRef(null),ne=n.useCallback(()=>{const e=ee.current;ee.current=null,e&&D?.(e)},[D]);n.useLayoutEffect(()=>{const e=te.current;Y&&e&&0===parseFloat(getComputedStyle(e).transitionDuration)&&ne()},[Y,ne]);const re=z[L],ie=x(M),oe=void 0===P?e(r,{icon:"error"===Q?o:a,size:u[U]}):P,ae=t("div",{ref:K,role:B[A??C[Q]],"data-mp-size":U,"data-mp-variant":L,...p(Y),className:["mp-alert rounded-mp-md flex w-full items-start","box-border",y(U,V),h[U],v[U],_[L],O.className,q??""].filter(Boolean).join(" "),style:{...l(Q),...O.style,...G},...J,children:[x(oe)?e("span",{className:["flex h-[1lh] shrink-0 items-center",re].filter(Boolean).join(" "),children:oe}):null,t("div",{className:`flex min-w-0 flex-1 flex-col ${j[U]}`,children:[ie?e("div",{className:[b[U],re].filter(Boolean).join(" "),children:M}):null,x(H)?e("div",{className:ie?k[L]:void 0,children:H}):null]}),x(T)?e("div",{className:"flex h-[1lh] shrink-0 items-center",children:T}):null,D?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:t("button",{type:"button","aria-label":F??X.dismiss,disabled:Y,onClick:e=>{ee.current=e,Z(!0)},className:["group rounded-mp-full relative -m-1 flex size-8 cursor-pointer items-center","justify-center appearance-none border-0 bg-transparent p-0 text-inherit","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(f,{}),e(r,{icon:i,size:u[U]})]})}):null]});return D?e("div",{ref:te,className:["mp-alert__reveal grid transition-[grid-template-rows,opacity]","duration-(--mp-sys-motion-duration-short4)","ease-(--mp-sys-motion-easing-emphasized-accelerate)","motion-reduce:transition-none",Y?"grid-rows-[0fr] opacity-0":"grid-rows-[1fr]"].join(" "),onTransitionEnd:e=>{Y&&"grid-template-rows"===e.propertyName&&e.target===e.currentTarget&&ne()},children:e("div",{className:"min-h-0 "+(Y?"overflow-hidden":""),children:ae})}):ae});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{accentSlots as
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{accentSlots as t}from"../../internal/accent.js";import{useMPLocale as r,useMPMessages as o}from"../../internal/locale.js";import{ANCHOR as i}from"../../internal/messages/anchor.js";import{CONTROL_TEXT as l}from"../../internal/scale.js";import{useMPColor as s,useMPDensity as c,useMPSize as a}from"../../internal/config.js";const m={xs:"py-1",sm:"py-1",md:"py-1.5",lg:"py-2",xl:"py-2.5"},u={xs:["py-0.5","py-0.5","py-0.5"],sm:["py-0.5","py-0.5","py-0.5"],md:["py-1","py-0.5","py-0.5"],lg:["py-1.5","py-1","py-0.5"],xl:["py-2","py-1.5","py-1"]};function p(e,n){return 0===n?m[e]:u[e][-n-1]}const d={xs:8,sm:10,md:12,lg:14,xl:16};export const MPAnchor=/*@__PURE__*/n.forwardRef(function({items:m,activeHref:u,onActiveChange:f,offset:h=0,container:y,rail:g=!0,size:v,color:b,density:x,locale:w,label:j,className:B,style:E,...R},C){const _=a(v),A=s(b),H=c(x),N=o(i,r(w)),[z,L]=n.useState(null),T=void 0!==u,k=T?u:z,I=n.useRef(f);I.current=f;const F=n.useRef(m);F.current=m;const P=m.map(e=>e.href).join(" ");n.useEffect(()=>{if(T)return;const e=y?.current??window;let n=0,t=null;const r=()=>{n=0;const e=function(e,n,t){const r=(t?t.getBoundingClientRect().top:0)+n+1;let o=null;for(const n of e){const e=document.getElementById(n.href.replace(/^#/,""));e&&e.getBoundingClientRect().top<=r&&(o=n.href)}return(t?t.scrollTop+t.clientHeight>=t.scrollHeight-2:window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-2)&&e.length>0?e[e.length-1].href:o}(F.current,h,y?.current??null);e!==t&&(t=e,L(e),I.current?.(e))},o=()=>{0===n&&(n=requestAnimationFrame(r))};return r(),e.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o,{passive:!0}),()=>{0!==n&&cancelAnimationFrame(n),e.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[P,h,y,T]);const S=y?e=>{if(!e.defaultPrevented)return;const n=e.currentTarget.getAttribute("href"),t=y.current;if(!n?.startsWith("#")||!t)return;const r=document.getElementById(n.slice(1));if(!r)return;const o=t.scrollTop+(r.getBoundingClientRect().top-t.getBoundingClientRect().top)-h;t.scrollTo({top:o})}:void 0;return e("nav",{ref:C,"aria-label":j??N.label,"data-mp-size":_,className:["mp-anchor min-w-0",B??""].filter(Boolean).join(" "),style:{...t(A),...E},...R,children:e("ul",{className:["mp-anchor__list m-0 flex list-none flex-col p-0",g?"border-mp-outline-variant border-s":""].filter(Boolean).join(" "),children:m.map(n=>e("li",{className:g?"-ms-px":void 0,children:e("a",{href:n.href,onClick:S,"aria-current":k===n.href?"location":void 0,className:["mp-anchor__link block min-w-0 truncate no-underline","text-mp-on-surface-variant hover:text-mp-on-surface",l[_],p(_,H),"transition-[color,border-color] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none","aria-[current=location]:text-(--_mp-accent) aria-[current=location]:font-medium",g?"border-s border-transparent ps-3 aria-[current=location]:border-(--_mp-accent)":"","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:rounded-mp-xs focus-visible:outline-solid outline-none"].filter(Boolean).join(" "),style:{marginInlineStart:n.depth?n.depth*d[_]:void 0},children:n.label})},n.href))})})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{numberFormatter as a}from"../../internal/intl.js";import{useAnimateElement as r}from"../../internal/animate.js";import{VISUALLY_HIDDEN as i}from"../../internal/visually-hidden.js";export const MPAnimateCounter=/*@__PURE__*/n.forwardRef(function({value:s,from:o=0,options:m,locale:l,format:u,duration:c,delay:f=0,easing:p,paused:d,trigger:y="mount",play:g,once:h=!0,threshold:N=.2,timeline:j,range:A,className:F,style:v,...S},x){const C=r({effect:"count",effectClass:"mp-anim-count",duration:c,delay:f,easing:p,repeat:1,from:o,to:s,trigger:y,play:g,once:h,threshold:N,paused:d,infinite:!1,timeline:j,range:A}),b=u??(e=>a(l,m).format(e)),q=n.useRef(null),[w,P]=n.useState(o);return n.useEffect(()=>{const e=q.current;if(!e||"undefined"==typeof requestAnimationFrame)return;let t=0,n=!0;const a="view"===j&&CSS.supports("animation-timeline","view()"),r=()=>{if(!n)return;const i=e.getAnimations().filter(e=>"mp-anim-count"===e.animationName),o=i.every(e=>"finished"===e.playState);if(0===i.length||o&&!a)P(s);else{const t=Number.parseFloat(getComputedStyle(e).getPropertyValue("--mp-count"));Number.isFinite(t)&&P(t)}i.length>0&&(a||!o)&&(t=requestAnimationFrame(r))};return t=requestAnimationFrame(r),()=>{n=!1,cancelAnimationFrame(t)}},[C.style,C.props["data-mp-state"],j,s]),t("span",{ref:e=>{q.current=e,C.ref(e),"function"==typeof x?x(e):x&&(x.current=e)},className:[C.className,F].filter(Boolean).join(" "),style:{...C.style,...v},...C.props,...S,children:[e("span",{className:i,children:b(s)}),e("span",{"aria-hidden":"true",className:"tabular-nums",children:b(w)})]})});
|
|
@@ -38,7 +38,7 @@ export interface MPAnimateGrowProps extends MPAnimateProps, MPAnimateStaggerProp
|
|
|
38
38
|
* library can offer it: something opens out of the place it belongs to. A panel
|
|
39
39
|
* out of a toolbar, a card out of the row it sits in, a sheet out of the button
|
|
40
40
|
* that summoned it — `origin` is what anchors it to that place, and it is the
|
|
41
|
-
* whole difference between this and [MPAnimateZoom](../
|
|
41
|
+
* whole difference between this and [MPAnimateZoom](../transitions/animate-zoom).
|
|
42
42
|
*
|
|
43
43
|
* A Grow starts close to its final size, so the travel is short and the content
|
|
44
44
|
* inside is legible for most of the animation. A Zoom starts at less than half
|
|
@@ -48,6 +48,6 @@ export interface MPAnimateSlideProps extends MPAnimateProps, MPAnimateStaggerPro
|
|
|
48
48
|
* A slide moves the element and not the layout: this is a `translate`, so
|
|
49
49
|
* nothing on the page reflows while it runs. For a much shorter travel over a
|
|
50
50
|
* list of things, one after another, use
|
|
51
|
-
* [MPAnimateAppear](../
|
|
51
|
+
* [MPAnimateAppear](../transitions/animate-appear).
|
|
52
52
|
*/
|
|
53
53
|
export declare const MPAnimateSlide: React.ForwardRefExoticComponent<MPAnimateSlideProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -28,7 +28,7 @@ export interface MPAnimateZoomProps extends MPAnimateProps, MPAnimateStaggerProp
|
|
|
28
28
|
/**
|
|
29
29
|
* Content arriving from the middle of where it will end up.
|
|
30
30
|
*
|
|
31
|
-
* The same arithmetic as [MPAnimateGrow](../
|
|
31
|
+
* The same arithmetic as [MPAnimateGrow](../transitions/animate-grow) at more than
|
|
32
32
|
* twice the distance, and always about the centre — which is the whole
|
|
33
33
|
* difference. A grow unfolds *from* somewhere; a zoom comes at the reader.
|
|
34
34
|
*
|
|
@@ -36,7 +36,7 @@ export interface MPAnimateZoomProps extends MPAnimateProps, MPAnimateStaggerProp
|
|
|
36
36
|
* confirmation, a result, a number that has just landed. Use it once. An
|
|
37
37
|
* interruption that happens three times on one screen is a layout, and the
|
|
38
38
|
* effect that belongs to a set of things rather than to one is
|
|
39
|
-
* [MPAnimateAppear](../
|
|
39
|
+
* [MPAnimateAppear](../transitions/animate-appear).
|
|
40
40
|
*
|
|
41
41
|
* There is no `origin`, on purpose. A zoom anchored to a corner is a grow, and
|
|
42
42
|
* the library does not offer two spellings of one idea.
|
|
@@ -19,7 +19,7 @@ import type { MPColor, MPSize, MPVariant } from '../../types.js';
|
|
|
19
19
|
* that a fourth value would be one nobody could see.
|
|
20
20
|
*/
|
|
21
21
|
export type MPAppLogoShape = 'bare' | 'app' | 'circle';
|
|
22
|
-
export interface MPAppLogoProps extends Omit<React.ComponentPropsWithoutRef<'a'>, 'color' | 'href'> {
|
|
22
|
+
export interface MPAppLogoProps extends Omit<React.ComponentPropsWithoutRef<'a'>, 'color' | 'href' | 'target' | 'rel'> {
|
|
23
23
|
/**
|
|
24
24
|
* The artwork, as an image. Beaten by `children`, so a project that inlines
|
|
25
25
|
* its SVG and a project that links a PNG use the same component.
|
|
@@ -98,6 +98,21 @@ export interface MPAppLogoProps extends Omit<React.ComponentPropsWithoutRef<'a'>
|
|
|
98
98
|
* the same thing with one more element in it.
|
|
99
99
|
*/
|
|
100
100
|
href?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Where that link opens. `rel` follows on its own for `_blank` — see `rel`.
|
|
103
|
+
*
|
|
104
|
+
* A logo in a header is usually the way back to the front page and opens in
|
|
105
|
+
* place, so this is rarely set. The one case it is set for is the lockup that
|
|
106
|
+
* links to somebody else's site, which is also the case where the `rel`
|
|
107
|
+
* matters most.
|
|
108
|
+
*/
|
|
109
|
+
target?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Overrides the `rel` a `_blank` lockup would otherwise get, which is
|
|
112
|
+
* `noopener noreferrer`. Writing one **replaces** it rather than adding to it,
|
|
113
|
+
* so a logo that also needs `nofollow` spells all three out.
|
|
114
|
+
*/
|
|
115
|
+
rel?: string;
|
|
101
116
|
/** Anything else the `<img>` needs — `loading`, `decoding`, `crossOrigin`. */
|
|
102
117
|
imageProps?: Omit<React.ComponentPropsWithoutRef<'img'>, 'src' | 'srcSet' | 'alt'>;
|
|
103
118
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as a}from"../../internal/accent.js";import{
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as a}from"../../internal/accent.js";import{linkRel as o}from"../../internal/link.js";import{initialsOf as i}from"../../internal/initials.js";import{cssLength as l}from"../../internal/length.js";import{CONTROL_GAP as m,CONTROL_HEIGHT as s,CONTROL_SQUARE as c,hasContent as d}from"../../internal/scale.js";import{VISUALLY_HIDDEN as p}from"../../internal/visually-hidden.js";import{useMPColor as u,useMPSize as f}from"../../internal/config.js";const x={xs:"text-[0.75rem]",sm:"text-[0.875rem]",md:"text-[1.0625rem]",lg:"text-[1.375rem]",xl:"text-[1.625rem]"},g={xs:"text-[0.75rem]",sm:"text-[0.875rem]",md:"text-[1.0625rem]",lg:"text-[1.3125rem]",xl:"text-[1.5625rem]"},h={xs:"rounded-mp-xs",sm:"rounded-mp-sm",md:"rounded-mp-md",lg:"rounded-mp-md",xl:"rounded-mp-md"},v={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-(--_mp-accent)",outlined:"border-mp-outline border bg-transparent text-(--_mp-accent)",text:"text-mp-on-surface-variant bg-transparent"};export const MPAppLogo=/*@__PURE__*/n.forwardRef(function({src:w,srcSet:j,alt:b,name:_,initials:y,showName:N=!1,shape:k="bare",variant:B="filled",size:z,color:P,padded:S=!0,height:A,href:F,target:L,rel:M,imageProps:R,render:$,className:q,style:C,children:D,...E},G){const H=f(z),I=u(P),J="bare"!==k,K=d(D)?D:w?"image":null,O=J&&S,Q=null===K&&!J,T=N&&!Q&&d(_),U=b??_,V=y??(_?i(_):""),W="image"===K&&!T&&d(U),X=Q||W,Y=!X&&!T&&d(U),Z=l(A),ee=Z?{height:Z,width:J?Z:void 0}:null,te=e("span",{"aria-hidden":!X||void 0,className:["mp-app-logo__mark flex shrink-0 items-center justify-center overflow-hidden","font-semibold tracking-tight whitespace-nowrap",Z?"":s[H],J?[Z?"":c[H],"circle"===k?"rounded-mp-full":h[H],g[H],v[B]].filter(Boolean).join(" "):["text-mp-on-surface w-auto",x[H]].join(" "),"[&_svg]:w-auto [&_svg]:shrink-0",O?"[&_svg]:h-[72%] [&_svg]:max-w-[72%]":"[&_svg]:h-full [&_svg]:max-w-full"].filter(Boolean).join(" "),style:ee??void 0,children:"image"===K?e("img",{src:w,srcSet:j,alt:W?U??"":"",className:["w-auto object-contain",O?"h-[72%] max-w-[72%]":"h-full max-w-full"].join(" "),decoding:"async",...R}):K??(Q?_:V)});return r({render:$??e(F?"a":"span",{}),ref:G,props:{href:F,target:L,rel:o(L,M),"data-mp-size":H,"data-mp-variant":B,className:["mp-app-logo inline-flex max-w-full min-w-0 items-center align-middle","text-mp-on-surface no-underline select-none",m[H],F?"rounded-mp-xs cursor-pointer":"",F?"outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid outline-none":"",q??""].filter(Boolean).join(" "),style:{...a(I),...C},children:t(n.Fragment,{children:[te,T?e("span",{className:`mp-app-logo__name min-w-0 truncate font-semibold ${x[H]}`,children:_}):null,Y?e("span",{className:p,children:U}):null]}),...E}})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type CartesianChartProps } from '../../internal/ChartFrame.js';
|
|
3
|
-
import type { MPChartCurve, MPChartValueLabels } from '../../types.js';
|
|
3
|
+
import type { MPChartCurve, MPChartGaps, MPChartStack, MPChartValueLabels } from '../../types.js';
|
|
4
4
|
export interface MPAreaChartProps extends CartesianChartProps {
|
|
5
5
|
/**
|
|
6
6
|
* How the edge of the band gets from one point to the next.
|
|
@@ -15,9 +15,13 @@ export interface MPAreaChartProps extends CartesianChartProps {
|
|
|
15
15
|
* changes with it: unstacked areas are read against the axis one at a time,
|
|
16
16
|
* and a stack is read as a composition. Only the bottom band and the total
|
|
17
17
|
* are easy to read in a stack, which is the trade it makes.
|
|
18
|
+
*
|
|
19
|
+
* `'percent'` fills the plot, so the top edge is flat and what is left is the
|
|
20
|
+
* composition alone — the shape a share-of-traffic chart wants. A negative
|
|
21
|
+
* has no share of a whole and is left out of one.
|
|
18
22
|
* @default false
|
|
19
23
|
*/
|
|
20
|
-
stacked?:
|
|
24
|
+
stacked?: MPChartStack;
|
|
21
25
|
/**
|
|
22
26
|
* The dots on the joins. `auto` draws them on an unstacked chart with room
|
|
23
27
|
* for them and never on a stack, where a vertex belongs to a boundary rather
|
|
@@ -25,6 +29,17 @@ export interface MPAreaChartProps extends CartesianChartProps {
|
|
|
25
29
|
* @default 'auto'
|
|
26
30
|
*/
|
|
27
31
|
markers?: boolean | 'auto';
|
|
32
|
+
/**
|
|
33
|
+
* What the band does where a series has no value.
|
|
34
|
+
*
|
|
35
|
+
* `break` leaves a hole in the fill as well as in the edge, `connect` closes
|
|
36
|
+
* the fill across it and draws the joining edge dashed, and `zero` draws the
|
|
37
|
+
* missing reading at zero — which on a band standing on the axis pinches it
|
|
38
|
+
* shut. The hover panel and the table still report a gap as a gap in all
|
|
39
|
+
* three.
|
|
40
|
+
* @default 'break'
|
|
41
|
+
*/
|
|
42
|
+
gaps?: MPChartGaps;
|
|
28
43
|
/**
|
|
29
44
|
* Which values are written onto the top edge.
|
|
30
45
|
* @default 'none'
|
|
@@ -76,4 +91,4 @@ export interface MPAreaChartProps extends CartesianChartProps {
|
|
|
76
91
|
* from a series' place in the `series` array, so what changes is the height of
|
|
77
92
|
* the stack and never which band is which.
|
|
78
93
|
*/
|
|
79
|
-
export declare function MPAreaChart({ curve, stacked, markers, valueLabels, ...frame }: MPAreaChartProps): React.JSX.Element;
|
|
94
|
+
export declare function MPAreaChart({ curve, stacked, markers, gaps, valueLabels, ...frame }: MPAreaChartProps): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as
|
|
2
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{CartesianFrame as t}from"../../internal/ChartFrame.js";import{BRIDGE_DASH as n,LINE_WIDTH as r,MARKER_RADIUS as a,MARK_GAP as o,bandPath as s,bridgePath as u,linePath as i,withoutGaps as c}from"../../internal/chart.js";export function MPAreaChart({curve:h="linear",stacked:p=!1,markers:d="auto",gaps:m="break",valueLabels:f="none",...x}){return e(t,{...x,inset:!0,stacked:p,includeZero:!0,headroom:"none"===f?0:14,children:({plot:t,values:x,visible:v,colors:k,labelInk:y,point:b,zeroPx:g,size:j,hovered:M,activeIndex:z,format:L,share:w})=>{const A=r[j],W=a[j],_=x.reduce((e,l)=>Math.max(e,l.length),0),C=_>1?t.width/(_-1):t.width,I="auto"===d?!p&&C>=6*W:d,P=x.map(()=>({top:[],base:[]})),$="percent"===p?Array.from({length:_},(e,l)=>x.reduce((e,t,n)=>{const r=v[n]?t[l]?.value??0:0;return e+(r>0?r:0)},0)):null,D=(e,l)=>null===$?e:e>=0&&$[l]>0?e/$[l]:null;for(let e=0;e<_;e+=1){let l=0,t=0;x.forEach((n,r)=>{const a=n[e]?.value??null,s=null===a&&"zero"===m?0:a,u=null===s?null:D(s,e);if(!v[r]||null===u)return P[r].top.push(null),void P[r].base.push(null);if(!p){const l=b(e,u);return P[r].top.push(l),void P[r].base.push({x:l.x,y:g})}const i=u>=0?l:t,c=i+u;u>=0?l=c:t=c;const h=b(e,c),d=b(e,i);P[r].top.push(h),P[r].base.push({x:d.x,y:0===i?d.y:d.y-Math.sign(u||1)*o})})}return e("g",{className:"mp-area-chart__marks",children:x.map((r,a)=>{if(!v[a])return null;const{top:o,base:d}=P[a],x=k[a];return l("g",{opacity:null!==M&&M!==a?.25:1,children:[e("path",{d:"connect"===m?s(c(o),c(d),h):s(o,d,h),fill:x,fillOpacity:p?.85:.18,stroke:"none"}),e("path",{d:i(o,h),fill:"none",stroke:x,strokeWidth:A,strokeLinecap:"round",strokeLinejoin:"round"}),"connect"===m?e("path",{d:u(o),fill:"none",stroke:x,strokeWidth:A,strokeDasharray:`${A*n} ${A*n}`,strokeLinecap:"round"}):null,o.map((l,t)=>{if(!l)return null;const n=z===t;return I||n?e("circle",{cx:l.x,cy:l.y,r:n?W+1:W,fill:x,stroke:"var(--_mp-color-surface)",strokeWidth:2},t):null}),"none"===f?null:r.map((l,n)=>{const s=o[n];if(!s||null===l.value)return null;const u=r.filter(e=>null!==e.value),i=u.map(e=>e.value);if(!("all"===f||"last"===f&&l===u[u.length-1]||"extremes"===f&&(l.value===Math.min(...i)||l.value===Math.max(...i))))return null;const c=s.x>t.left+t.width-24?"end":s.x<t.left+24?"start":"middle";return e("text",{x:s.x,y:s.y-W-5,textAnchor:c,fill:y(a),fontSize:"xs"===j||"sm"===j?10:11,children:l.label??(null===$?L(l.value):w(D(l.value,n)??0))},n)})]},a)})})}})}
|
|
@@ -8,7 +8,7 @@ import type { MPSize } from '../../types.js';
|
|
|
8
8
|
* the same reason `MPSide` keeps `top`/`right`/`bottom`/`left`: inventing
|
|
9
9
|
* `fill-the-box` would only make a reader look up which CSS it maps to.
|
|
10
10
|
*/
|
|
11
|
-
export type MPAspectFit = 'cover' | 'contain' | 'fill' | 'none';
|
|
11
|
+
export type MPAspectFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
12
12
|
export interface MPAspectRatioProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
13
13
|
/**
|
|
14
14
|
* The proportion the box holds, written the way CSS writes it — a number
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import*as e from"react";import{useRender as o}from"@base-ui/react/use-render";import{useMPSize as i}from"../../internal/config.js";const
|
|
2
|
+
import*as e from"react";import{useRender as o}from"@base-ui/react/use-render";import{useMPSize as i}from"../../internal/config.js";const c={xs:"rounded-mp-xs",sm:"rounded-mp-sm",md:"rounded-mp-md",lg:"rounded-mp-md",xl:"rounded-mp-xl"},t=/*@__PURE__*/["[&>img]:size-full","[&>video]:size-full","[&>canvas]:size-full","[&>svg]:size-full","[&>iframe]:size-full","[&>picture]:size-full","[&>picture>img]:size-full"].join(" "),r={cover:"[&>img]:object-cover [&>video]:object-cover [&>picture>img]:object-cover",contain:"[&>img]:object-contain [&>video]:object-contain [&>picture>img]:object-contain",fill:"[&>img]:object-fill [&>video]:object-fill [&>picture>img]:object-fill",none:"[&>img]:object-none [&>video]:object-none [&>picture>img]:object-none","scale-down":"[&>img]:object-scale-down [&>video]:object-scale-down [&>picture>img]:object-scale-down"};export const MPAspectRatio=/*@__PURE__*/e.forwardRef(function({ratio:e=1,fit:n="cover",rounded:l=!1,size:s,render:d,className:m,style:a,children:u,...f},p){const j=i(s),b=["mp-aspect-ratio relative block w-full overflow-hidden",t,r[n],l?c[j]:"",m??""].filter(Boolean).join(" ");return o({render:d,ref:p,props:{"data-mp-size":j,className:b,style:{aspectRatio:e,...a},children:u,...f}})});
|
|
@@ -92,7 +92,7 @@ export interface MPAvatarProps extends Omit<React.ComponentPropsWithoutRef<'span
|
|
|
92
92
|
* `transition="fade"` is the whole of what most callers want; the object form
|
|
93
93
|
* takes a duration, an edge to come from, or a scale to start at. Anything
|
|
94
94
|
* that has to run again — on scroll, on hover, under your own control — is an
|
|
95
|
-
* [MPAnimateFade](../
|
|
95
|
+
* [MPAnimateFade](../transitions/animate-fade) and its siblings.
|
|
96
96
|
*/
|
|
97
97
|
transition?: MPTransition;
|
|
98
98
|
}
|