material-plus-ui 1.8.0 → 1.10.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/README.md +10 -6
- 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/accordion/MPAccordion.d.ts +13 -0
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/alert/MPAlert.d.ts +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-headline/MPAnimateHeadline.d.ts +8 -0
- package/dist/components/animate-headline/MPAnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
- package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -1
- package/dist/components/animate-scramble/MPAnimateScramble.d.ts +8 -0
- package/dist/components/animate-scramble/MPAnimateScramble.js +1 -1
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +1 -1
- package/dist/components/animate-split/MPAnimateSplit.d.ts +8 -0
- package/dist/components/animate-split/MPAnimateSplit.js +1 -1
- package/dist/components/animate-typing/MPAnimateTyping.d.ts +10 -2
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
- package/dist/components/app-logo/MPAppLogo.d.ts +6 -1
- package/dist/components/area-chart/MPAreaChart.d.ts +18 -3
- package/dist/components/area-chart/MPAreaChart.js +1 -1
- package/dist/components/avatar/MPAvatar.d.ts +17 -1
- package/dist/components/avatar/MPAvatar.js +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 +1 -1
- package/dist/components/box/MPBox.d.ts +1 -1
- package/dist/components/breadcrumb/MPBreadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb/MPBreadcrumb.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 +1 -1
- package/dist/components/code-block/MPCodeBlock.js +1 -1
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.js +1 -1
- package/dist/components/config/MPConfigProvider.d.ts +17 -1
- package/dist/components/config/MPConfigProvider.js +1 -1
- package/dist/components/confirm/MPConfirmProvider.js +1 -1
- package/dist/components/data-table/MPDataTable.d.ts +0 -34
- package/dist/components/data-table/MPDataTable.js +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +13 -1
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +1 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/form/MPForm.d.ts +3 -0
- package/dist/components/form/MPForm.js +1 -1
- package/dist/components/gauge-chart/MPGaugeChart.js +1 -1
- package/dist/components/header/MPHeader.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/image/MPImage.d.ts +5 -0
- package/dist/components/image/MPImage.js +1 -1
- package/dist/components/line-chart/MPLineChart.d.ts +20 -2
- package/dist/components/line-chart/MPLineChart.js +1 -1
- package/dist/components/locale/MPLocaleProvider.d.ts +15 -30
- package/dist/components/locale/MPLocaleProvider.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +9 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/meter/MPMeter.d.ts +5 -0
- package/dist/components/meter/MPMeter.js +1 -1
- package/dist/components/mockup/MPMockup.js +1 -1
- package/dist/components/navigation-menu/MPNavigationMenu.d.ts +27 -1
- package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.d.ts +2 -1
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/otp-field/MPOtpField.js +1 -1
- package/dist/components/page-layout/MPPageLayout.js +1 -1
- package/dist/components/pagination/MPPagination.d.ts +8 -0
- package/dist/components/pagination/MPPagination.js +1 -1
- package/dist/components/panes/MPPanes.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/progress-box/MPProgressBox.js +1 -1
- package/dist/components/progress-circular/MPProgressCircular.js +1 -1
- package/dist/components/progress-linear/MPProgressLinear.js +1 -1
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/scatter-chart/MPScatterChart.d.ts +5 -1
- package/dist/components/scatter-chart/MPScatterChart.js +1 -1
- package/dist/components/sidebar/MPSidebar.d.ts +11 -0
- package/dist/components/sidebar/MPSidebar.js +1 -1
- package/dist/components/slider/MPSlider.d.ts +5 -0
- package/dist/components/slider/MPSlider.js +1 -1
- package/dist/components/snackbar/MPSnackbar.js +1 -1
- package/dist/components/sparkline/MPSparkline.d.ts +14 -1
- package/dist/components/sparkline/MPSparkline.js +1 -1
- package/dist/components/switch/MPSwitch.js +1 -1
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/timeline-chart/MPTimelineChart.d.ts +6 -2
- package/dist/components/timeline-chart/MPTimelineChart.js +1 -1
- package/dist/components/tour/MPTour.js +1 -1
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/tree-select/MPTreeSelect.js +1 -1
- package/dist/components/tree-view/MPTreeView.d.ts +8 -0
- package/dist/components/tree-view/MPTreeView.js +1 -1
- package/dist/components/typography/MPTypography.d.ts +1 -1
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/mpColorSchemeScript.d.ts +46 -0
- package/dist/hooks/mpColorSchemeScript.js +1 -0
- package/dist/hooks/useMPColorScheme.d.ts +2 -47
- package/dist/hooks/useMPColorScheme.js +1 -1
- package/dist/hooks/useMPMediaQuery.js +1 -1
- package/dist/hooks/useMPOnScreen.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/ChartChrome.d.ts +73 -14
- 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.d.ts +9 -1
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/RenderedLink.d.ts +20 -0
- package/dist/internal/RenderedLink.js +2 -0
- package/dist/internal/SupportingText.js +1 -1
- package/dist/internal/animate.d.ts +4 -0
- package/dist/internal/animate.js +1 -1
- package/dist/internal/box-size.d.ts +22 -0
- package/dist/internal/box-size.js +2 -0
- package/dist/internal/chart.d.ts +111 -13
- package/dist/internal/chart.js +1 -1
- package/dist/internal/color-scheme-keys.d.ts +13 -0
- package/dist/internal/color-scheme-keys.js +1 -0
- package/dist/internal/color-scheme.d.ts +11 -2
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/config.d.ts +2 -0
- package/dist/internal/date.d.ts +2 -8
- package/dist/internal/date.js +1 -1
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +4 -53
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/intersection.d.ts +50 -0
- package/dist/internal/intersection.js +2 -0
- package/dist/internal/intl.d.ts +22 -21
- package/dist/internal/intl.js +1 -1
- package/dist/internal/keys.d.ts +0 -9
- package/dist/internal/keys.js +1 -1
- package/dist/internal/layout-effect.d.ts +7 -0
- package/dist/internal/layout-effect.js +2 -0
- package/dist/internal/locale.d.ts +10 -2
- package/dist/internal/media.d.ts +1 -0
- package/dist/internal/media.js +1 -0
- package/dist/internal/messages/chart.d.ts +1 -1
- package/dist/internal/messages/chart.js +1 -1
- package/dist/internal/occurrence.d.ts +18 -0
- package/dist/internal/occurrence.js +1 -0
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/progress.d.ts +5 -0
- package/dist/internal/ref.d.ts +9 -0
- package/dist/internal/ref.js +1 -0
- package/dist/internal/remember.d.ts +36 -0
- package/dist/internal/remember.js +1 -0
- package/dist/internal/surface.d.ts +7 -1
- package/dist/internal/surface.js +1 -1
- package/dist/internal/text.d.ts +10 -4
- package/dist/internal/text.js +1 -1
- package/dist/internal/window-class.d.ts +8 -0
- package/dist/internal/window-class.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/animate-appear.css +1 -1
- package/dist/styles/animate-blink.css +1 -1
- package/dist/styles/animate-counter.css +1 -1
- package/dist/styles/animate-fade.css +1 -1
- package/dist/styles/animate-float.css +1 -1
- package/dist/styles/animate-grow.css +1 -1
- package/dist/styles/animate-headline.css +1 -1
- package/dist/styles/animate-lighting.css +1 -1
- package/dist/styles/animate-marquee.css +1 -1
- package/dist/styles/animate-reveal.css +1 -1
- package/dist/styles/animate-rotate.css +1 -1
- package/dist/styles/animate-scramble.css +1 -1
- package/dist/styles/animate-shake.css +1 -1
- package/dist/styles/animate-slide.css +1 -1
- package/dist/styles/animate-split.css +1 -1
- package/dist/styles/animate-typing.css +1 -1
- package/dist/styles/animate-zoom.css +1 -1
- package/dist/styles/area-chart.css +1 -1
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/bar-chart.css +1 -1
- package/dist/styles/blockquote.css +1 -1
- package/dist/styles/box.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chip.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/command-palette.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/empty.css +1 -1
- package/dist/styles/floating-bottom-navigation.css +1 -1
- package/dist/styles/footer.css +1 -1
- package/dist/styles/gauge-chart.css +1 -1
- package/dist/styles/header.css +1 -1
- package/dist/styles/heatmap-chart.css +1 -1
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/hover-card.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/meter.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/overlay.css +1 -1
- package/dist/styles/page-layout.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/progress-box.css +1 -1
- package/dist/styles/progress-circular.css +1 -1
- package/dist/styles/progress-linear.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/scatter-chart.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/sidebar.css +1 -1
- package/dist/styles/slider.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/stack.css +1 -1
- package/dist/styles/statistic.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/timeline-chart.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/toolbar.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/typography.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +116 -4
- package/dist/types.d.ts +208 -1
- package/package.json +25 -4
|
@@ -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};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { MPDensity, MPSize, MPElevation, MPVariant } from '../../types.js';
|
|
3
|
+
/** The heading level each section's title is written at. */
|
|
4
|
+
export type MPAccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
5
|
export interface MPAccordionProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
4
6
|
/**
|
|
5
7
|
* Whether more than one section may be open at once.
|
|
@@ -68,6 +70,17 @@ export interface MPAccordionProps extends Omit<React.ComponentPropsWithoutRef<'d
|
|
|
68
70
|
* @default false
|
|
69
71
|
*/
|
|
70
72
|
keepMounted?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The heading level each section's title is written at.
|
|
75
|
+
*
|
|
76
|
+
* Each title is a heading, because a section of a page is what it names, and
|
|
77
|
+
* the level is the page's to decide: an accordion of questions under an `h2`
|
|
78
|
+
* is a run of `h3`s, and the same accordion under an `h3` is a run of `h4`s.
|
|
79
|
+
* A level that skips one breaks the outline a screen reader navigates by and a
|
|
80
|
+
* search engine reads the page's structure from.
|
|
81
|
+
* @default 3
|
|
82
|
+
*/
|
|
83
|
+
headingLevel?: MPAccordionHeadingLevel;
|
|
71
84
|
/** The `MPAccordionItem`s. */
|
|
72
85
|
children?: React.ReactNode;
|
|
73
86
|
}
|
|
@@ -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{Accordion as i}from"@base-ui/react/accordion";import{MPIcon as a}from"../icon/MPIcon.js";import{ChevronDownIcon as r}from"../../constants/icons.js";import{MPStateLayer as o}from"../../internal/StateLayer.js";import{CONTROL_GAP as s,CONTROL_ICON as l,hasContent as d,META_TEXT as c,PROSE_TEXT as m,SHEET_TITLE as u}from"../../internal/scale.js";import{sheetPadX as p,sheetPadY as f}from"../../internal/density.js";import{containerSurface as h}from"../../internal/elevation.js";import{useMPDensity as v,useMPSize as x}from"../../internal/config.js";const b=/*@__PURE__*/n.createContext({size:"md",density:0,dividers:!0}),g=/*@__PURE__*/["h-(--accordion-panel-height) overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none","data-starting-style:h-0 data-ending-style:h-0"].join(" ");const
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Accordion as i}from"@base-ui/react/accordion";import{MPIcon as a}from"../icon/MPIcon.js";import{ChevronDownIcon as r}from"../../constants/icons.js";import{MPStateLayer as o}from"../../internal/StateLayer.js";import{CONTROL_GAP as s,CONTROL_ICON as l,hasContent as d,META_TEXT as c,PROSE_TEXT as m,SHEET_TITLE as u}from"../../internal/scale.js";import{sheetPadX as p,sheetPadY as f}from"../../internal/density.js";import{containerSurface as h}from"../../internal/elevation.js";import{useMPDensity as v,useMPSize as x}from"../../internal/config.js";const b=/*@__PURE__*/n.createContext({size:"md",density:0,dividers:!0,headingLevel:3}),g={1:e("h1",{}),2:e("h2",{}),3:e("h3",{}),4:e("h4",{}),5:e("h5",{}),6:e("h6",{})},j=/*@__PURE__*/["h-(--accordion-panel-height) overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none","data-starting-style:h-0 data-ending-style:h-0"].join(" ");const N={xs:"pb-2.5",sm:"pb-3",md:"pb-4",lg:"pb-5",xl:"pb-6"};export const MPAccordion=/*@__PURE__*/n.forwardRef(function({multiple:t=!1,value:a,defaultValue:r,onValueChange:o,dividers:s=!0,disabled:l=!1,variant:d="outlined",elevation:c,size:m,density:u,hiddenUntilFound:p=!1,keepMounted:f=!1,headingLevel:g=3,className:j,children:N,...y},w){const _=x(m),k=v(u),z=n.useMemo(()=>({size:_,density:k,dividers:s,headingLevel:g}),[_,k,s,g]);return e(b.Provider,{value:z,children:e(i.Root,{ref:w,multiple:t,value:a,defaultValue:r,onValueChange:e=>o?.(e),disabled:l,hiddenUntilFound:p,keepMounted:f,"data-mp-size":_,"data-mp-variant":d,className:["mp-accordion rounded-mp-md flex w-full flex-col",h(d,c),"text-mp-on-surface",s?"overflow-hidden [&>div+div]:border-mp-outline-variant [&>div+div]:border-t":"p-1",j??""].filter(Boolean).join(" "),...y,children:N})})});export const MPAccordionItem=/*@__PURE__*/n.forwardRef(function({value:h,title:v,subtitle:x,startIcon:y,action:w,disabled:_=!1,className:k,children:z,...C},M){const{size:A,density:L,dividers:P,headingLevel:B}=n.useContext(b),I=p(A,L),R=f(A,L),V=n.useRef(null),[F,S]=n.useState(!1),$=n.useCallback(e=>{var t;V.current=e,e&&S(e.hasAttribute("data-open")&&!((t=e).hasAttribute("data-starting-style")&&parseFloat(getComputedStyle(t).transitionDuration)>0))},[]);return t(i.Item,{ref:M,value:h,disabled:_,className:["mp-accordion__item flex flex-col",k??""].filter(Boolean).join(" "),...C,children:[t(i.Header,{render:g[B]??g[3],className:"m-0 flex w-full items-center font-[inherit]",children:[t(i.Trigger,{className:["group relative flex min-w-0 flex-1 cursor-pointer items-center text-start","appearance-none border-0 bg-transparent font-[inherit] text-inherit",I,R,s[A],P?"":"rounded-mp-sm","outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].filter(Boolean).join(" "),children:[e(o,{}),d(y)?e("span",{className:"text-mp-on-surface-variant flex h-[1lh] shrink-0 items-center",children:y}):null,t("span",{className:"mp-accordion__text flex min-w-0 flex-1 flex-col",children:[d(v)?e("span",{className:`mp-accordion__title truncate ${u[A]}`,children:v}):null,d(x)?e("span",{className:`mp-accordion__subtitle text-mp-on-surface-variant truncate ${c}`,children:x}):null]}),e("span",{className:["text-mp-on-surface-variant flex h-[1lh] shrink-0 items-center","transition-[rotate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none","group-data-panel-open:rotate-180"].join(" "),children:e(a,{icon:r,size:l[A]})})]}),d(w)?e("span",{className:`flex shrink-0 items-center ${I}`,children:w}):null]}),e(i.Panel,{ref:$,className:[j,F?"data-open:overflow-visible":""].filter(Boolean).join(" "),onTransitionEnd:e=>{e.target===V.current&&"height"===e.propertyName&&S(V.current.hasAttribute("data-open"))},children:e("div",{className:["min-w-0",m[A],"text-mp-on-surface-variant",I,N[A]].join(" "),children:z})})]})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MPAccordion, MPAccordionItem } from './MPAccordion.js';
|
|
2
|
-
export type { MPAccordionItemProps, MPAccordionProps } from './MPAccordion.js';
|
|
2
|
+
export type { MPAccordionHeadingLevel, MPAccordionItemProps, MPAccordionProps } from './MPAccordion.js';
|
|
@@ -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{numberFormatter as a}from"../../internal/intl.js";import{useAnimateElement as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{watchIntersection as r}from"../../internal/intersection.js";import{numberFormatter as a}from"../../internal/intl.js";import{useMPLocale as i}from"../../internal/locale.js";import{useAnimateElement as s}from"../../internal/animate.js";import{VISUALLY_HIDDEN as o}from"../../internal/visually-hidden.js";export const MPAnimateCounter=/*@__PURE__*/n.forwardRef(function({value:l,from:m=0,options:u,locale:c,format:f,duration:p,delay:d=0,easing:y,paused:g,trigger:h="mount",play:j,once:N=!0,threshold:v=.2,timeline:A,range:F,className:S,style:b,...q},x){const C=s({effect:"count",effectClass:"mp-anim-count",duration:p,delay:d,easing:y,repeat:1,from:m,to:l,trigger:h,play:j,once:N,threshold:v,paused:g,infinite:!1,timeline:A,range:F}),w=i(c),I=f??(e=>a(w,u).format(e)),O=n.useRef(null),[P,R]=n.useState(m),B=JSON.stringify(C.style),E=C.props["data-mp-state"],J=C.run;return n.useEffect(()=>{const e=O.current;if(!e||"undefined"==typeof requestAnimationFrame)return;let t=0,n=!0;const a="view"===A&&CSS.supports("animation-timeline","view()");let i=!0;const s=()=>{if(t=0,!n)return;const r=e.getAnimations().filter(e=>"mp-anim-count"===e.animationName),o=r.every(e=>"finished"===e.playState),m=r.length>0&&r.every(e=>"paused"===e.playState);if(0===r.length||o&&!a)R(l);else{const t=Number.parseFloat(getComputedStyle(e).getPropertyValue("--mp-count"));Number.isFinite(t)&&R(t)}r.length>0&&!m&&(a?i:!o)&&(t=requestAnimationFrame(s))};t=requestAnimationFrame(s);const o=a&&"undefined"!=typeof IntersectionObserver?r(e,e=>{i=e.isIntersecting,0===t&&(t=requestAnimationFrame(s))}):null;return()=>{n=!1,cancelAnimationFrame(t),o?.()}},[B,E,J,A,l]),t("span",{ref:e=>{O.current=e,C.ref(e),"function"==typeof x?x(e):x&&(x.current=e)},className:[C.className,S].filter(Boolean).join(" "),style:{...C.style,...b},...C.props,...q,children:[e("span",{className:o,children:I(l)}),e("span",{"aria-hidden":"true",className:"tabular-nums",children:I(P)})]})});
|
|
@@ -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
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
3
|
import type { MPAnimateProps } from '../../types.js';
|
|
3
4
|
export interface MPAnimateHeadlineProps extends Omit<MPAnimateProps, 'alternate'>, React.ComponentPropsWithoutRef<'div'> {
|
|
4
5
|
/**
|
|
@@ -34,6 +35,13 @@ export interface MPAnimateHeadlineProps extends Omit<MPAnimateProps, 'alternate'
|
|
|
34
35
|
rise?: number | string;
|
|
35
36
|
/** The lines, in the order they should be read. */
|
|
36
37
|
children?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Renders something other than a `<div>` — a `<span>` to sit inside a
|
|
40
|
+
* paragraph, where a `<div>` would end the paragraph in the server's markup
|
|
41
|
+
* and leave the browser's tree disagreeing with React's. Base UI's own escape
|
|
42
|
+
* hatch, as on `MPAnimateFade`.
|
|
43
|
+
*/
|
|
44
|
+
render?: useRender.RenderProp;
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
39
47
|
* One line replacing the one above it, on a timer.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import*as
|
|
2
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import*as n from"react";import{useRender as r}from"@base-ui/react/use-render";import{easingValue as a,isInfinite as i,lengthValue as s,useAnimationRun as o,usePrefersReducedMotion as l}from"../../internal/animate.js";export const MPAnimateHeadline=/*@__PURE__*/n.forwardRef(function({duration:m,delay:u=0,easing:c,repeat:d="infinite",paused:f,trigger:p="mount",play:h,once:g=!0,threshold:v=.2,interval:x=2600,index:y,defaultIndex:j=0,onIndexChange:E,loop:N=!0,rise:T="100%",render:_,className:C,style:M,children:R,...b},k){const A=o({trigger:p,play:h,once:g,threshold:v,paused:f,infinite:i(d)}),B=l(),I=n.Children.toArray(R),S=I.length,[w,F]=n.useState(j),H=Math.min(y??w,Math.max(S-1,0)),[P,V]=n.useState(null),$=n.useRef(H);n.useEffect(()=>{$.current!==H&&(V($.current),$.current=H)},[H]);const q=m??500;n.useEffect(()=>{if(null===P)return;const e=setTimeout(()=>V(null),q);return()=>clearTimeout(e)},[P,q]);const z=n.useCallback(()=>{const e=H+1;if(e>=S){if(!N)return;return void 0===y&&F(0),void E?.(0)}void 0===y&&F(e),E?.(e)},[H,S,N,y,E]),D=n.useRef(!1);return n.useEffect(()=>{if(void 0!==y||S<2||"running"!==A.state)return;if(!N&&H===S-1)return;const e=setTimeout(()=>{D.current=!0,z()},x+(D.current?0:u));return()=>clearTimeout(e)},[y,S,A.state,x,u,z,N,H]),r({render:_,ref:[k,A.ref],props:{className:["mp-headline",C??""].filter(Boolean).join(" "),style:{...void 0===m?{}:{"--_mp-anim-duration":`${m}ms`},"--_mp-anim-rise":s(T),...c?{"--_mp-anim-ease":a(c)}:{},"--_mp-anim-state":A.state,...M},"data-mp-animation":"headline","data-mp-state":A.state,...A.handlers,...b,children:e(t,{children:I.map((t,r)=>{const a=r===H?"active":r!==P||B?void 0:"leaving";if(!n.isValidElement(t))return e("span",{className:"mp-headline-item","data-mp-state":a,children:t},r);const i=t.props;return n.cloneElement(t,{key:r,className:["mp-headline-item",i.className].filter(Boolean).join(" "),"data-mp-state":a})})})}})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as
|
|
2
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as n}from"../../internal/accent.js";import{isInfinite as a,repeatValue as t,useAnimationRun as i}from"../../internal/animate.js";import{useMPColor as m,useMPSize as o}from"../../internal/config.js";import{useOffscreenPause as s}from"../../internal/intersection.js";const l={xs:"rounded-mp-xs",sm:"rounded-mp-sm",md:"rounded-mp-md",lg:"rounded-mp-lg",xl:"rounded-mp-xl"};export const MPAnimateLighting=/*@__PURE__*/e.forwardRef(function({duration:e=3e3,delay:p=0,repeat:d="infinite",alternate:c,paused:g,trigger:u="mount",play:f,once:h=!0,threshold:_=.2,color:x,size:y,spread:j=3,arc:w=50,blur:$=4,reverse:b=!1,render:v,className:z,style:N,children:A,...B},L){const M=m(x),P=o(y),R=i({trigger:u,play:f,once:h,threshold:_,paused:g,infinite:a(d)}),k=s(a(d));return r({render:v,ref:[L,R.ref,k],props:{...B,"data-mp-size":P,className:["mp-anim-lighting",l[P],z].filter(Boolean).join(" "),style:{...n(M),"--_mp-anim-duration":`${e}ms`,"--_mp-anim-delay":`${p}ms`,"--_mp-anim-repeat":t(d),"--_mp-anim-direction":b?c?"alternate-reverse":"reverse":c?"alternate":"normal","--_mp-anim-state":R.state,"--_mp-anim-glow-width":`${j}px`,"--_mp-anim-glow-arc":`${w}deg`,"--_mp-anim-glow-blur":`${$}px`,...N},...R.handlers,"data-mp-animation":"lighting","data-mp-state":R.state,children:A}})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{easingValue as t,isInfinite as a,lengthValue as n,repeatValue as i,useAnimationRun as o}from"../../internal/animate.js";import{inertProps as s}from"../../internal/inert.js";export const MPAnimateMarquee=/*@__PURE__*/r.forwardRef(function({duration:m,delay:p=0,easing:l,repeat:u="infinite",alternate:c,paused:d,trigger:f="mount",play:h,once:v=!0,threshold:g=.2,orientation:y="horizontal",reverse:_=!1,speed:j=60,gap:q="2rem",copies:R=2,pauseOnHover:b=!0,className:x,style:M,children:w,...z},N){const O=o({trigger:f,play:h,once:v,threshold:g,paused:d,infinite:a(u)}),A=r.useRef(null),G=r.useRef(null),[H,S]=r.useState(0),$="vertical"===y;r.useEffect(()=>{const e=A.current,r=G.current;if(!e||!r)return;const t=()=>{const t=getComputedStyle(e),a=parseFloat($?t.rowGap:t.columnGap)||0,n=$?r.offsetHeight:r.offsetWidth;S(n+a)};if(t(),"undefined"==typeof ResizeObserver)return;const a=new ResizeObserver(t);return a.observe(r),a.observe(e),()=>a.disconnect()},[$,
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{easingValue as t,isInfinite as a,lengthValue as n,repeatValue as i,useAnimationRun as o}from"../../internal/animate.js";import{inertProps as s}from"../../internal/inert.js";export const MPAnimateMarquee=/*@__PURE__*/r.forwardRef(function({duration:m,delay:p=0,easing:l,repeat:u="infinite",alternate:c,paused:d,trigger:f="mount",play:h,once:v=!0,threshold:g=.2,orientation:y="horizontal",reverse:_=!1,speed:j=60,gap:q="2rem",copies:R=2,pauseOnHover:b=!0,className:x,style:M,children:w,...z},N){const O=o({trigger:f,play:h,once:v,threshold:g,paused:d,infinite:a(u)}),A=r.useRef(null),G=r.useRef(null),[H,S]=r.useState(0),$="vertical"===y;r.useEffect(()=>{const e=A.current,r=G.current;if(!e||!r)return;const t=()=>{const t=getComputedStyle(e),a=parseFloat($?t.rowGap:t.columnGap)||0,n=$?r.offsetHeight:r.offsetWidth;S(n+a)};if(t(),"undefined"==typeof ResizeObserver)return;const a=new ResizeObserver(t);return a.observe(r),a.observe(e),()=>a.disconnect()},[$,q]);const k=m??(H>0?H/j*1e3:12e3);return e("div",{ref:e=>{A.current=e,O.ref(e),"function"==typeof N?N(e):N&&(N.current=e)},className:["mp-marquee",$?"mp-marquee-vertical":"",x??""].filter(Boolean).join(" "),style:{"--_mp-anim-gap":n(q),...l?{"--_mp-anim-ease":t(l)}:{},"--_mp-anim-duration":`${Math.round(k)}ms`,"--_mp-anim-delay":`${p}ms`,"--_mp-anim-repeat":i(u),"--_mp-anim-direction":_?c?"alternate-reverse":"reverse":c?"alternate":"normal","--_mp-anim-state":O.state,...M},"data-mp-animation":"marquee","data-mp-state":O.state,"data-mp-pause-on-hover":b?"":void 0,...O.handlers,...z,children:Array.from({length:Math.max(1,R)},(r,t)=>(r=>e("div",{ref:0===r?G:void 0,className:"mp-marquee-track","aria-hidden":0===r?void 0:"true",...s(0!==r),children:w},r))(t))})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
3
|
import type { MPAnimateProps } from '../../types.js';
|
|
3
4
|
export interface MPAnimateScrambleProps extends Omit<MPAnimateProps, 'alternate' | 'easing'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
4
5
|
/** The text, when it is easier to pass than to nest. Overrides `children`. */
|
|
@@ -27,6 +28,13 @@ export interface MPAnimateScrambleProps extends Omit<MPAnimateProps, 'alternate'
|
|
|
27
28
|
locale?: string;
|
|
28
29
|
/** The text to settle. Only text is settled — see below. */
|
|
29
30
|
children?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Renders something other than a `<div>` — a `<span>` to sit inside a
|
|
33
|
+
* paragraph, where a `<div>` would end the paragraph in the server's markup
|
|
34
|
+
* and leave the browser's tree disagreeing with React's. Base UI's own escape
|
|
35
|
+
* hatch, as on `MPAnimateFade`.
|
|
36
|
+
*/
|
|
37
|
+
render?: useRender.RenderProp;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Text settling out of noise.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{useRender as n}from"@base-ui/react/use-render";import{isInfinite as s,useAnimationRun as i,usePrefersReducedMotion as o}from"../../internal/animate.js";import{graphemesOf as m,textOf as l}from"../../internal/text.js";import{VISUALLY_HIDDEN as c}from"../../internal/visually-hidden.js";export const MPAnimateScramble=/*@__PURE__*/a.forwardRef(function({text:d,duration:u=1200,spread:p=.4,tick:h=50,characters:f="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&@$?!",locale:g,delay:x=0,repeat:M=1,paused:j,trigger:y="mount",play:b,once:A=!0,threshold:F=.2,render:N,className:v,style:w,children:S,...q},E){const P=o(),R=i({trigger:y,play:b,once:A,threshold:F,paused:j,infinite:s(M)}),k=d??l(S),B=a.useMemo(()=>m(k,g),[k,g]),[C,D]=a.useState(0),G="running"===R.state&&!P;a.useEffect(()=>{if(P)return void D(1);if(!G)return void D(0);let e=0,t=0;const r=a=>{0===t&&(t=a);const n=a-t-x,s=u>0?Math.min(1,Math.max(0,n/u)):1;D(s),s<1&&(e=requestAnimationFrame(r))};return e=requestAnimationFrame(r),()=>cancelAnimationFrame(e)},[G,P,u,x,R.started]);const H=P?k:B.map((e,t)=>(e=>{const t=B.length>1?e/(B.length-1):0;return C>=t*p+(1-p)})(t)?e:(e=>{const t=(2654435761*e+40503*Math.floor(C*u/Math.max(1,h)))%f.length;return f[Math.abs(t)]??f[0]})(t)).join("");return n({render:N,ref:[E,R.ref],props:{className:v,style:w,"data-mp-animation":"scramble","data-mp-state":R.state,...R.handlers,...q,children:r(t,{children:[e("span",{className:c,children:k}),e("span",{"aria-hidden":"true",className:"tabular-nums whitespace-pre-wrap",children:H})]})}})});
|
|
@@ -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>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
3
|
import type { MPAnimateProps, MPAnimateTimelineProps, MPSide } from '../../types.js';
|
|
3
4
|
/** What a line is cut into before it is animated. */
|
|
4
5
|
export type MPAnimateSplitBy = 'word' | 'character';
|
|
@@ -52,5 +53,12 @@ export interface MPAnimateSplitProps extends MPAnimateProps, MPAnimateTimelinePr
|
|
|
52
53
|
locale?: string;
|
|
53
54
|
/** The text to split. Only text is split — see below. */
|
|
54
55
|
children?: React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Renders something other than a `<div>` — a `<span>` to sit inside a
|
|
58
|
+
* paragraph, where a `<div>` would end the paragraph in the server's markup
|
|
59
|
+
* and leave the browser's tree disagreeing with React's. Base UI's own escape
|
|
60
|
+
* hatch, as on `MPAnimateFade`.
|
|
61
|
+
*/
|
|
62
|
+
render?: useRender.RenderProp;
|
|
55
63
|
}
|
|
56
64
|
export declare const MPAnimateSplit: React.ForwardRefExoticComponent<MPAnimateSplitProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as
|
|
2
|
+
import{jsx as e,Fragment as a,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{useRender as n}from"@base-ui/react/use-render";import{ANIMATION_CLASS as i,ANIM_BASE as s,animationSlots as l,isInfinite as m,slideOffsets as o,useAnimationRun as d}from"../../internal/animate.js";import{graphemesOf as p,textOf as c,wordsOf as u}from"../../internal/text.js";import{VISUALLY_HIDDEN as f}from"../../internal/visually-hidden.js";export const MPAnimateSplit=/*@__PURE__*/r.forwardRef(function({text:r,by:h="word",duration:y,delay:g=0,easing:x,repeat:j=1,alternate:b,paused:N,trigger:w="mount",play:_,once:v=!0,threshold:$=.2,timeline:k,range:S,stagger:A=40,durationStep:F=0,reverse:M=!1,from:O="bottom",distance:P="0.5rem",fade:R=!0,locale:q,render:z,className:B,style:C,children:D,...E},G){const H=d({trigger:w,play:_,once:v,threshold:$,paused:N,infinite:m(j)}),I="view"===k?N?"paused":"running":H.state,J=r??c(D),{x:K,y:L}=o(O,P),Q=u(J,q),T="character"===h?Q.map(e=>p(e,q)):Q.map(e=>[e]),U=`${s} ${i.slide} inline-block`,V=T.reduce((e,a)=>e+a.length,0);let W=-1;const X={effect:"slide",duration:y,delay:g,easing:x,repeat:j,alternate:b,timeline:k,range:S,x:K,y:L,opacity:R?0:1};return n({render:z,ref:[G,H.ref],props:{className:B,style:{"--_mp-anim-state":I,...C},"data-mp-animation":"split","data-mp-state":I,...H.handlers,...E,children:t(a,{children:[e("span",{className:f,children:J}),e("span",{"aria-hidden":"true",style:l(X),children:T.map((a,t)=>e("span",{className:"inline-block whitespace-pre",children:a.map((a,t)=>{W+=1;const r=M?V-1-W:W;return e("span",{className:U,style:{"--_mp-anim-delay":`${g+r*A}ms`,...0===F?null:{"--_mp-anim-duration":l({...X,durationOffset:r*F})["--_mp-anim-duration"]}},children:a},t)})},t))})]})}})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
3
|
import type { MPAnimateProps } from '../../types.js';
|
|
3
4
|
export interface MPAnimateTypingProps extends Omit<MPAnimateProps, 'alternate' | 'easing'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
4
5
|
/** The text, when it is easier to pass than to nest. Overrides `children`. */
|
|
@@ -37,6 +38,13 @@ export interface MPAnimateTypingProps extends Omit<MPAnimateProps, 'alternate' |
|
|
|
37
38
|
caretChar?: React.ReactNode;
|
|
38
39
|
/** The text to type. Only text is typed — see below. */
|
|
39
40
|
children?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Renders something other than a `<div>` — a `<span>` to sit inside a
|
|
43
|
+
* paragraph, where a `<div>` would end the paragraph in the server's markup
|
|
44
|
+
* and leave the browser's tree disagreeing with React's. Base UI's own escape
|
|
45
|
+
* hatch, as on `MPAnimateFade`.
|
|
46
|
+
*/
|
|
47
|
+
render?: useRender.RenderProp;
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Text appearing one character at a time.
|
|
@@ -53,7 +61,7 @@ export interface MPAnimateTypingProps extends Omit<MPAnimateProps, 'alternate' |
|
|
|
53
61
|
* a line that is being replaced rather than rewritten.
|
|
54
62
|
*
|
|
55
63
|
* Only **text** is typed. Pass a string, or strings; an element among the
|
|
56
|
-
* children
|
|
57
|
-
*
|
|
64
|
+
* children gives its text and drops its markup, because there is no honest way
|
|
65
|
+
* to reveal half of a link.
|
|
58
66
|
*/
|
|
59
67
|
export declare const MPAnimateTyping: React.ForwardRefExoticComponent<MPAnimateTypingProps & React.RefAttributes<HTMLDivElement>>;
|