plass-ui 1.3.0 → 1.4.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/CHANGELOG.md +590 -0
- package/README.md +1 -1
- package/dist/components/alert/PlAlert.js +1 -1
- package/dist/components/anchor/PlAnchor.d.ts +72 -0
- package/dist/components/anchor/PlAnchor.js +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/PlAnimateAppear.d.ts +10 -0
- package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
- package/dist/components/animate-blink/PlAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
- package/dist/components/animate-counter/PlAnimateCounter.d.ts +83 -0
- package/dist/components/animate-counter/PlAnimateCounter.js +1 -0
- package/dist/components/animate-counter/index.d.ts +2 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/PlAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/PlAnimateFade.js +1 -1
- package/dist/components/animate-float/PlAnimateFloat.d.ts +51 -0
- package/dist/components/animate-float/PlAnimateFloat.js +1 -0
- package/dist/components/animate-float/index.d.ts +2 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/PlAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
- package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
- package/dist/components/animate-reveal/PlAnimateReveal.js +1 -0
- package/dist/components/animate-reveal/index.d.ts +2 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/PlAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
- package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
- package/dist/components/animate-scramble/PlAnimateScramble.js +1 -0
- package/dist/components/animate-scramble/index.d.ts +2 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/PlAnimateShake.d.ts +57 -0
- package/dist/components/animate-shake/PlAnimateShake.js +1 -0
- package/dist/components/animate-shake/index.d.ts +2 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/PlAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
- package/dist/components/animate-split/PlAnimateSplit.d.ts +54 -0
- package/dist/components/animate-split/PlAnimateSplit.js +1 -0
- package/dist/components/animate-split/index.d.ts +2 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
- package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
- package/dist/components/app-logo/PlAppLogo.js +1 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/PlAreaChart.d.ts +54 -0
- package/dist/components/area-chart/PlAreaChart.js +1 -0
- package/dist/components/area-chart/index.d.ts +2 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/avatar/PlAvatar.js +1 -1
- package/dist/components/back-top/PlBackTop.js +1 -1
- package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
- package/dist/components/bar-chart/PlBarChart.js +1 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
- package/dist/components/button-group/PlButtonGroup.js +1 -1
- package/dist/components/carousel/PlCarousel.js +1 -1
- package/dist/components/chat-bubble/PlChatBubble.js +1 -1
- package/dist/components/checkbox/PlCheckbox.js +1 -1
- package/dist/components/chip/PlChip.js +1 -1
- package/dist/components/code-block/PlCodeBlock.d.ts +175 -0
- package/dist/components/code-block/PlCodeBlock.js +1 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/combobox/PlCombobox.d.ts +1 -1
- package/dist/components/combobox/PlCombobox.js +1 -1
- package/dist/components/command-palette/PlCommandPalette.d.ts +1 -1
- package/dist/components/command-palette/PlCommandPalette.js +1 -1
- package/dist/components/container/PlContainer.d.ts +22 -6
- package/dist/components/container/PlContainer.js +1 -1
- package/dist/components/data-list/PlDataList.d.ts +74 -0
- package/dist/components/data-list/PlDataList.js +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/PlDataTable.d.ts +202 -0
- package/dist/components/data-table/PlDataTable.js +1 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/drawer/PlDrawer.d.ts +1 -1
- package/dist/components/drawer/PlDrawer.js +1 -1
- package/dist/components/flex/PlFlex.d.ts +83 -0
- package/dist/components/flex/PlFlex.js +1 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
- package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
- package/dist/components/floating-action-button/index.d.ts +2 -0
- package/dist/components/floating-action-button/index.js +1 -0
- package/dist/components/footer/PlFooter.d.ts +4 -3
- package/dist/components/footer/PlFooter.js +1 -1
- package/dist/components/gallery/PlGallery.d.ts +154 -0
- package/dist/components/gallery/PlGallery.js +1 -0
- package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
- package/dist/components/gallery/PlGalleryViewer.js +1 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +1 -0
- package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
- package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/PlGrid.js +1 -1
- package/dist/components/grid/PlGridItem.js +1 -1
- package/dist/components/header/PlHeader.d.ts +4 -3
- package/dist/components/header/PlHeader.js +1 -1
- package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
- package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/hover-card/PlHoverCard.d.ts +94 -0
- package/dist/components/hover-card/PlHoverCard.js +1 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
- package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
- package/dist/components/how-to-steps/index.d.ts +2 -0
- package/dist/components/how-to-steps/index.js +1 -0
- package/dist/components/image/PlImage.js +1 -1
- package/dist/components/line-chart/PlLineChart.d.ts +74 -0
- package/dist/components/line-chart/PlLineChart.js +1 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/meter/PlMeter.d.ts +83 -0
- package/dist/components/meter/PlMeter.js +1 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/PlMockup.d.ts +146 -0
- package/dist/components/mockup/PlMockup.js +1 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/modal/PlModal.d.ts +1 -1
- package/dist/components/modal/PlModal.js +1 -1
- package/dist/components/number-field/PlNumberField.d.ts +1 -1
- package/dist/components/number-field/PlNumberField.js +1 -1
- package/dist/components/overlay/PlOverlay.d.ts +1 -1
- package/dist/components/overlay/PlOverlay.js +1 -1
- package/dist/components/page-layout/PlPageLayout.js +1 -1
- package/dist/components/pagination/PlPagination.js +1 -1
- package/dist/components/panes/PlPanes.d.ts +2 -2
- package/dist/components/panes/PlPanes.js +1 -1
- package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
- package/dist/components/pie-chart/PlPieChart.js +1 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/popconfirm/PlPopconfirm.d.ts +1 -1
- package/dist/components/popconfirm/PlPopconfirm.js +1 -1
- package/dist/components/popover/PlPopover.d.ts +1 -1
- package/dist/components/popover/PlPopover.js +1 -1
- package/dist/components/portal/PlPortal.d.ts +78 -0
- package/dist/components/portal/PlPortal.js +1 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/radio-group/PlRadioGroup.js +1 -1
- package/dist/components/rating/PlRating.js +1 -1
- package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
- package/dist/components/scatter-chart/PlScatterChart.js +1 -0
- package/dist/components/scatter-chart/index.d.ts +2 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/scroll-area/PlScrollArea.d.ts +98 -0
- package/dist/components/scroll-area/PlScrollArea.js +1 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/PlScrollZone.d.ts +9 -5
- package/dist/components/scroll-zone/PlScrollZone.js +1 -1
- package/dist/components/select/PlSelect.js +1 -1
- package/dist/components/show/PlShow.d.ts +60 -0
- package/dist/components/show/PlShow.js +1 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/PlSidebar.js +1 -1
- package/dist/components/slider/PlSlider.js +1 -1
- package/dist/components/sparkline/PlSparkline.d.ts +68 -0
- package/dist/components/sparkline/PlSparkline.js +1 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/PlSpoiler.d.ts +8 -0
- package/dist/components/spoiler/PlSpoiler.js +1 -1
- package/dist/components/stack/PlStack.d.ts +114 -0
- package/dist/components/stack/PlStack.js +1 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/stepper/PlStepper.d.ts +2 -2
- package/dist/components/stepper/PlStepper.js +1 -1
- package/dist/components/table/PlTable.js +1 -1
- package/dist/components/tabs/PlTabs.d.ts +2 -2
- package/dist/components/tabs/PlTabs.js +1 -1
- package/dist/components/text-link/PlTextLink.js +1 -1
- package/dist/components/timeline/PlTimeline.d.ts +2 -2
- package/dist/components/timeline/PlTimeline.js +1 -1
- package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
- package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toast/PlToast.d.ts +1 -1
- package/dist/components/toast/PlToast.js +1 -1
- package/dist/components/toggle/PlToggle.js +1 -1
- package/dist/components/toggle/PlToggleGroup.js +1 -1
- package/dist/components/tour/PlTour.d.ts +134 -0
- package/dist/components/tour/PlTour.js +1 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/PlTransfer.js +1 -1
- package/dist/components/tree/PlTree.js +1 -1
- package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
- package/dist/components/tree-select/PlTreeSelect.js +1 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
- package/dist/components/window-pane/PlWindowPane.js +1 -0
- package/dist/components/window-pane/index.d.ts +2 -0
- package/dist/components/window-pane/index.js +1 -0
- package/dist/css/anchor.css +2 -0
- package/dist/css/animate-counter.css +2 -0
- package/dist/css/animate-float.css +2 -0
- package/dist/css/animate-reveal.css +2 -0
- package/dist/css/animate-scramble.css +2 -0
- package/dist/css/animate-shake.css +2 -0
- package/dist/css/animate-split.css +2 -0
- package/dist/css/app-logo.css +2 -0
- package/dist/css/area-chart.css +2 -0
- package/dist/css/bar-chart.css +2 -0
- package/dist/css/code-block.css +2 -0
- package/dist/css/data-list.css +2 -0
- package/dist/css/data-table.css +2 -0
- package/dist/css/flex.css +2 -0
- package/dist/css/floating-action-button.css +2 -0
- package/dist/css/gallery.css +2 -0
- package/dist/css/gauge-chart.css +2 -0
- package/dist/css/heatmap-chart.css +2 -0
- package/dist/css/hover-card.css +2 -0
- package/dist/css/how-to-steps.css +2 -0
- package/dist/css/line-chart.css +2 -0
- package/dist/css/meter.css +2 -0
- package/dist/css/mockup.css +2 -0
- package/dist/css/pie-chart.css +2 -0
- package/dist/css/portal.css +2 -0
- package/dist/css/scatter-chart.css +2 -0
- package/dist/css/scroll-area.css +2 -0
- package/dist/css/show.css +2 -0
- package/dist/css/sparkline.css +2 -0
- package/dist/css/stack.css +2 -0
- package/dist/css/timeline-chart.css +2 -0
- package/dist/css/tour.css +2 -0
- package/dist/css/tree-select.css +2 -0
- package/dist/css/window-pane.css +2 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/usePlBreakpoint.d.ts +3 -0
- package/dist/hooks/usePlBreakpoint.js +1 -1
- package/dist/hooks/usePlDisclosure.d.ts +44 -0
- package/dist/hooks/usePlDisclosure.js +1 -0
- package/dist/hooks/usePlElementSize.d.ts +31 -0
- package/dist/hooks/usePlElementSize.js +1 -0
- package/dist/hooks/usePlOnScreen.d.ts +50 -0
- package/dist/hooks/usePlOnScreen.js +1 -0
- package/dist/index.d.ts +34 -1
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +91 -5
- package/dist/internal/animate.js +1 -1
- package/dist/internal/breakpoints.d.ts +31 -0
- package/dist/internal/breakpoints.js +1 -0
- package/dist/internal/button-group.d.ts +29 -2
- package/dist/internal/button-group.js +2 -2
- package/dist/internal/calendar.d.ts +11 -36
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +458 -0
- package/dist/internal/chart-frame.js +1 -0
- package/dist/internal/chart-line.d.ts +44 -0
- package/dist/internal/chart-line.js +1 -0
- package/dist/internal/chart.d.ts +473 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/data-table.d.ts +69 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/defaults.d.ts +8 -3
- package/dist/internal/drag.d.ts +49 -0
- package/dist/internal/drag.js +1 -0
- package/dist/internal/format.d.ts +2 -0
- package/dist/internal/format.js +1 -1
- package/dist/internal/gallery.d.ts +34 -0
- package/dist/internal/gallery.js +1 -0
- package/dist/internal/grid.d.ts +6 -27
- package/dist/internal/grid.js +1 -1
- package/dist/internal/highlight.d.ts +98 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/icons.d.ts +10 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/labels.d.ts +138 -0
- package/dist/internal/labels.js +1 -0
- package/dist/internal/mockup.d.ts +193 -0
- package/dist/internal/mockup.js +1 -0
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/progress.d.ts +6 -0
- package/dist/internal/responsive.d.ts +108 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scramble.d.ts +31 -0
- package/dist/internal/scramble.js +1 -0
- package/dist/internal/styles.d.ts +15 -0
- package/dist/internal/styles.js +1 -1
- package/dist/internal/table.d.ts +86 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/threshold.d.ts +19 -0
- package/dist/internal/threshold.js +1 -0
- package/dist/internal/tour.d.ts +42 -0
- package/dist/internal/tour.js +1 -0
- package/dist/internal/window.d.ts +201 -0
- package/dist/internal/window.js +1 -0
- package/dist/locales/de.d.ts +3 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.d.ts +3 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +3 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/index.d.ts +33 -0
- package/dist/locales/index.js +1 -0
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +3 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/zh-Hans.d.ts +3 -0
- package/dist/locales/zh-Hans.js +1 -0
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1104 -19
- package/dist/tokens.css +1104 -19
- package/dist/types.d.ts +381 -2
- package/package.json +14 -4
- package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
- package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/css/avatar-group.css +0 -2
- package/dist/internal/avatar-group.d.ts +0 -25
- package/dist/internal/avatar-group.js +0 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { type PlassStepConnector, type PlassStepStatus } from '../../internal/steps.js';
|
|
4
|
+
import type { PlassColor, PlassDensity, PlassSize } from '../../types.js';
|
|
5
|
+
/** How far along one step is. The same three a `PlStepper` and a `PlTimeline` draw. */
|
|
6
|
+
export type PlHowToStepStatus = PlassStepStatus;
|
|
7
|
+
/** How the line between two steps is drawn. `none` leaves the gap open. */
|
|
8
|
+
export type PlHowToStepsConnector = PlassStepConnector;
|
|
9
|
+
export interface PlHowToStepsProps extends Omit<React.ComponentPropsWithoutRef<'ol'>, 'color'> {
|
|
10
|
+
/**
|
|
11
|
+
* Which step is being worked on now, as an index.
|
|
12
|
+
*
|
|
13
|
+
* Optional, and left out for the ordinary case: a set of instructions is
|
|
14
|
+
* something a reader works through at their own pace, and a guide that
|
|
15
|
+
* claimed to know where they had got to would be guessing. Pass it for a
|
|
16
|
+
* guide that genuinely knows — a setup wizard reporting what it has already
|
|
17
|
+
* done for them.
|
|
18
|
+
*/
|
|
19
|
+
active?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Numbers the steps.
|
|
22
|
+
*
|
|
23
|
+
* On by default, because that is what instructions are: "do this, then this"
|
|
24
|
+
* is an order and the number is how a reader finds their place again after
|
|
25
|
+
* looking away. Turn it off for a set of things to do in any order, which is
|
|
26
|
+
* a checklist rather than a how-to.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
numbered?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The line between one step and the next.
|
|
32
|
+
* @default 'solid'
|
|
33
|
+
*/
|
|
34
|
+
connector?: PlHowToStepsConnector;
|
|
35
|
+
/** @default 'md' */
|
|
36
|
+
size?: PlassSize;
|
|
37
|
+
/** @default 'primary' */
|
|
38
|
+
color?: PlassColor;
|
|
39
|
+
/** The space between steps. Never the type scale, never the bullet. */
|
|
40
|
+
density?: PlassDensity;
|
|
41
|
+
/** Renders something other than an `<ol>` — Base UI's own escape hatch. */
|
|
42
|
+
render?: useRender.RenderProp;
|
|
43
|
+
/** The `PlHowToStep`s. */
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
export interface PlHowToStepProps extends Omit<React.ComponentPropsWithoutRef<'li'>, 'title'> {
|
|
47
|
+
/** What the step is. The line the reader scans for. */
|
|
48
|
+
title?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* A glyph in place of the number. The step keeps its place in the order
|
|
51
|
+
* either way — what changes is only what is drawn in the disc.
|
|
52
|
+
*/
|
|
53
|
+
icon?: React.ReactNode;
|
|
54
|
+
/** Overrides what the guide worked out from `active`. */
|
|
55
|
+
status?: PlHowToStepStatus;
|
|
56
|
+
/** What to do. */
|
|
57
|
+
children?: React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Instructions, numbered, with what to do under each one.
|
|
61
|
+
*
|
|
62
|
+
* Three components put things in order and they answer different questions.
|
|
63
|
+
* A [PlStepper](../navigation/stepper) and a [PlTimeline](../display/timeline)
|
|
64
|
+
* both say **where you are** — one in a process the reader is moving through
|
|
65
|
+
* now, the other in a sequence that has already happened. This one says **what
|
|
66
|
+
* to do**, and that is the difference the shape follows from: every step's body
|
|
67
|
+
* is open at once, because somebody following instructions reads ahead, goes
|
|
68
|
+
* back a step, and works at their own pace.
|
|
69
|
+
*
|
|
70
|
+
* Which is also why `active` is optional here and not on the other two. A guide
|
|
71
|
+
* that claimed to know how far a reader had got would be guessing. Pass it only
|
|
72
|
+
* for the guide that genuinely knows.
|
|
73
|
+
*
|
|
74
|
+
* It is a real `<ol>` of `<li>`s, and the numbers a reader sees are the same
|
|
75
|
+
* ones the list carries. A screen reader announces "list, five items, item
|
|
76
|
+
* two" on its own — the position a heading per step would only approximate —
|
|
77
|
+
* which is what a reader who has looked away and come back is asking for.
|
|
78
|
+
*/
|
|
79
|
+
export declare const PlHowToSteps: React.ForwardRefExoticComponent<PlHowToStepsProps & React.RefAttributes<HTMLOListElement>>;
|
|
80
|
+
/**
|
|
81
|
+
* One instruction.
|
|
82
|
+
*
|
|
83
|
+
* The number is the guide's, not the step's: a step never takes an index, and
|
|
84
|
+
* the list numbers its children as it walks them — so inserting one in the
|
|
85
|
+
* middle renumbers the rest without anything being edited.
|
|
86
|
+
*/
|
|
87
|
+
export declare const PlHowToStep: React.ForwardRefExoticComponent<PlHowToStepProps & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{useDefaults as s}from"../../internal/defaults.js";import{bulletGapClasses as n,bulletSizeValues as o,bulletStatusClasses as a,connectorColorClasses as i,connectorStyleClasses as c,statusAt as d,titleStatusClasses as m}from"../../internal/steps.js";import{cx as p,hasContent as u,iconClasses as f,sheetBodyClasses as x,sheetTitleClasses as h,surfaceSlots as g}from"../../internal/styles.js";const v=/* @__PURE__ */r.createContext(null),w=/* @__PURE__ */r.createContext({index:0,last:!1}),y={default:{xs:"gap-4",sm:"gap-5",md:"gap-6",lg:"gap-7",xl:"gap-8"},compact:{xs:"gap-2.5",sm:"gap-3",md:"gap-4",lg:"gap-4",xl:"gap-5"}};export const PlHowToSteps=/* @__PURE__ */r.forwardRef(function PlHowToSteps({active:t,numbered:n=!0,connector:o="solid",size:a,color:i,density:c,render:d,className:m,style:u,children:f,...h},N){const b=s(),P=a??b.size??"md",j=i??b.color??"primary",H=c??b.density??"default",S=r.Children.toArray(f).filter(r.isValidElement),T=r.useMemo(()=>({size:P,density:H,color:j,active:t??null,numbered:n,connector:o}),[P,H,j,t,n,o]);return e(v.Provider,{value:T,children:l({render:d??e("ol",{}),ref:N,props:{className:p("m-0 flex list-none flex-col p-0",y[H][P],x[P],m),style:{...g(j,0),...u},children:S.map((t,r)=>e(w.Provider,{value:{index:r,last:r===S.length-1},children:t},t.key??r)),...h}})})});export const PlHowToStep=/* @__PURE__ */r.forwardRef(function PlHowToStep({title:l,icon:s,status:x,className:y,children:N,...b},P){const j=r.useContext(v),{index:H,last:S}=r.useContext(w);if(!j)throw new Error("PlHowToStep has to be inside a PlHowToSteps.");const{size:T,color:C,active:z,numbered:k,connector:E}=j,R=x??d(H,z),A=o[T];return t("li",{ref:P,"aria-current":"current"===R?"step":void 0,className:p("relative flex",n[T],y),style:g(C,0),...b,children:[t("div",{className:"flex flex-col items-center self-stretch",children:[e("span",{"aria-hidden":"true",className:p("flex shrink-0 items-center justify-center rounded-full font-semibold","text-[0.7em] leading-none",f,a[R]),style:{width:A,height:A},children:u(s)?s:k?H+1:null}),S||"none"===E?null:e("span",{"aria-hidden":"true",className:p("mt-1 w-0 flex-1 border-s-2",c[E],i[R])})]}),t("div",{className:"min-w-0 flex-1 pb-0.5",children:[u(l)?e("div",{className:p("font-semibold",h[T],m[R]),children:l}):null,u(N)?e("div",{className:p(u(l)?"mt-1":"","text-(--plass-muted-fg)"),children:N}):null]})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlHowToStep,PlHowToSteps}from"./PlHowToSteps.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as o,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{useDefaults as s}from"../../internal/defaults.js";import{
|
|
1
|
+
"use client";import{jsx as e,Fragment as o,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{useDefaults as s}from"../../internal/defaults.js";import{useLabels as t}from"../../internal/labels.js";import{PlOverlay as r}from"../overlay/PlOverlay.js";import{PlSkeleton as n}from"../skeleton/PlSkeleton.js";import{cx as i,focusRingClasses as c,radiusClasses as m,transitionClasses as d}from"../../internal/styles.js";const p={cover:"object-cover",contain:"object-contain",fill:"object-fill",none:"object-none"};export const PlImage=/* @__PURE__ */l.forwardRef(function PlImage({alt:f,src:u,ratio:b,fit:h="cover",rounded:g=!1,size:j,color:v,placeholder:y,fallback:x,preview:w=!1,previewLabel:N,onStatusChange:k,className:z,style:C,loading:P="lazy",...S},L){const E=s(),I=t(),O=N??I.preview,R=j??E.size??"md",$=v??E.color??"primary",[F,q]=l.useState("loading"),[A,B]=l.useState(!1);l.useEffect(()=>{q("loading")},[u]);const settle=e=>{q(e),k?.(e)},D=g?m[R]:"",G=e("img",{ref:L,src:u,alt:f,loading:P,onLoad:()=>settle("loaded"),onError:()=>settle("error"),className:i("block size-full",p[h],d,"loaded"===F?"opacity-100":"opacity-0","error"===F?"hidden":""),...S}),H=a(o,{children:[G,"loading"===F?e("span",{className:"absolute inset-0",children:void 0===y?e(n,{shape:"rect",color:$,size:R,width:"100%",height:"100%",className:D}):y}):null,"error"===F?e("span",{className:"absolute inset-0 flex items-center justify-center bg-(--plass-glass-press) p-3 text-center text-[0.8125rem] text-(--plass-muted-fg)",children:x??f}):null]}),J=i("relative block overflow-hidden",D,z),K={aspectRatio:b,...C};return w?a(o,{children:[e("button",{type:"button","aria-label":f?`${f} — ${O.toLowerCase()}`:O,onClick:()=>B(!0),disabled:"loaded"!==F,className:i(J,"cursor-zoom-in p-0",c),style:K,children:H}),e(r,{open:A,onOpenChange:B,tone:"glass",dismissible:!0,color:$,label:O,children:e("img",{src:u,alt:f,className:"max-h-[85vh] max-w-[90vw] object-contain"})})]}):e("span",{className:J,style:K,children:H})});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type CartesianChartProps } from '../../internal/chart-frame.js';
|
|
3
|
+
import { type ChartMarkers } from '../../internal/chart-line.js';
|
|
4
|
+
import type { PlassChartCurve, PlassChartValueLabels } from '../../types.js';
|
|
5
|
+
export interface PlLineChartProps extends CartesianChartProps {
|
|
6
|
+
/**
|
|
7
|
+
* How the line gets from one point to the next.
|
|
8
|
+
*
|
|
9
|
+
* - `linear` — straight segments. The default, and the only one that claims
|
|
10
|
+
* nothing the data did not say.
|
|
11
|
+
* - `smooth` — a monotone cubic. Curved, but it will not dip below a value
|
|
12
|
+
* that both of its neighbours are above; a plain spline would.
|
|
13
|
+
* - `step` — held at each value until the next one. What a rate, a tier or a
|
|
14
|
+
* setting actually did between two readings, rather than a diagonal
|
|
15
|
+
* pretending it drifted.
|
|
16
|
+
* @default 'linear'
|
|
17
|
+
*/
|
|
18
|
+
curve?: PlassChartCurve;
|
|
19
|
+
/**
|
|
20
|
+
* Dots on the points.
|
|
21
|
+
*
|
|
22
|
+
* `auto` — the default — draws them while there are few enough points for a
|
|
23
|
+
* dot to mean something, and stops at fourteen. Whatever this says, the point
|
|
24
|
+
* under the pointer always gets one: that is what tells the reader which
|
|
25
|
+
* column the tooltip is about.
|
|
26
|
+
* @default 'auto'
|
|
27
|
+
*/
|
|
28
|
+
markers?: ChartMarkers;
|
|
29
|
+
/**
|
|
30
|
+
* Fades the line from a paler step of its own hue at the start to the full
|
|
31
|
+
* colour at the end, so the recent end of a long series is the loud one.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
gradient?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Draws the line straight through a `null` instead of breaking at it.
|
|
37
|
+
*
|
|
38
|
+
* Off, and it should stay off unless the gap is an artefact of how the data
|
|
39
|
+
* was collected. A bridged gap is a number the chart made up.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
connectNulls?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Which values are written on the line. `last` is the one to reach for — it
|
|
45
|
+
* names where each series ended up, which is the question a line chart is
|
|
46
|
+
* usually being asked.
|
|
47
|
+
* @default 'none'
|
|
48
|
+
*/
|
|
49
|
+
valueLabels?: PlassChartValueLabels;
|
|
50
|
+
/**
|
|
51
|
+
* Stacks the series, each line riding on the total of the ones below it.
|
|
52
|
+
*
|
|
53
|
+
* Rare on a line chart and worth thinking twice about: the reader can follow
|
|
54
|
+
* the bottom series and the top total, and nothing in between. An
|
|
55
|
+
* [`PlAreaChart`](./area-chart) is the shape that makes stacking legible.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
stacked?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A value against time, or against anything else with an order to it.
|
|
62
|
+
*
|
|
63
|
+
* The line is the mark that says *change*: it claims the space between two
|
|
64
|
+
* points is a journey rather than two separate facts, which is true of a
|
|
65
|
+
* temperature and false of four product categories. Reach for a
|
|
66
|
+
* [`PlBarChart`](./bar-chart) when the categories could be shuffled without losing
|
|
67
|
+
* anything.
|
|
68
|
+
*
|
|
69
|
+
* Everything around the line — the axes, the grid, the crosshair, the legend,
|
|
70
|
+
* the tooltip and the table a screen reader gets instead of the picture — comes
|
|
71
|
+
* from the shared frame, which is what makes a PlLineChart and a PlBarChart on one
|
|
72
|
+
* dashboard read as one drawing rather than two.
|
|
73
|
+
*/
|
|
74
|
+
export declare function PlLineChart({ curve, markers, gradient, connectNulls, valueLabels, stacked, ...props }: PlLineChartProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{CartesianChart as t}from"../../internal/chart-frame.js";import{LineSeries as n}from"../../internal/chart-line.js";export function PlLineChart({curve:a="linear",markers:c="auto",gradient:i=!1,connectNulls:o=!1,valueLabels:l="none",stacked:s=!1,...m}){const u=r.useId().replace(/:/g,"");return e(t,{...m,stacked:s,inset:!0,includeZero:!1,headroom:"none"===l?0:10,children:r=>e(n,{context:r,curve:a,filled:!1,stacked:s,markers:c,valueLabels:l,connectNulls:o,gradient:i,idPrefix:u})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlLineChart}from"./PlLineChart.js";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassColor, PlassSize, PlassThreshold } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Where a band starts, and what the bar is made of from there up.
|
|
5
|
+
*
|
|
6
|
+
* The library's own `PlassThreshold` under the name this component shipped it
|
|
7
|
+
* as. A gauge reads the same bands, so the shape moved to `src/types.ts` and
|
|
8
|
+
* this stayed as the name a caller already imports.
|
|
9
|
+
*/
|
|
10
|
+
export type PlMeterThreshold = PlassThreshold;
|
|
11
|
+
export interface PlMeterProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
12
|
+
/**
|
|
13
|
+
* How much there is.
|
|
14
|
+
*
|
|
15
|
+
* **Required, and that is the whole difference from a `PlProgressLinear`.** A
|
|
16
|
+
* meter reports a quantity that is already known — disk used, seats taken,
|
|
17
|
+
* how full a battery is — so there is no indeterminate case for it to have a
|
|
18
|
+
* default for. A bar with nothing to report is not a meter; it is a bar that
|
|
19
|
+
* should not have been drawn yet.
|
|
20
|
+
*/
|
|
21
|
+
value: number;
|
|
22
|
+
/** @default 0 */
|
|
23
|
+
min?: number;
|
|
24
|
+
/** @default 100 */
|
|
25
|
+
max?: number;
|
|
26
|
+
/** A name for what is being measured. Read out with the value. */
|
|
27
|
+
label?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Shows the value as text beside the bar. A percentage of the range unless
|
|
30
|
+
* `format` says otherwise.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
showValue?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* How the value is written when it is shown — `Intl.NumberFormat` options, so
|
|
36
|
+
* bytes, currencies and plain counts all work. Without it the value is a
|
|
37
|
+
* percentage of `min`…`max`, which is the only formatting that holds for a
|
|
38
|
+
* range nobody described.
|
|
39
|
+
*/
|
|
40
|
+
format?: Intl.NumberFormatOptions;
|
|
41
|
+
/**
|
|
42
|
+
* Bands that change the bar's family as the value climbs.
|
|
43
|
+
*
|
|
44
|
+
* The band with the highest `from` at or below the value wins, and `color` is
|
|
45
|
+
* what the bar is made of below all of them. Order does not matter; the list
|
|
46
|
+
* is read, not walked.
|
|
47
|
+
*
|
|
48
|
+
* This is the prop a meter exists for: a quota bar that is `primary` at a
|
|
49
|
+
* third full, `warning` at three quarters and `danger` at ninety percent
|
|
50
|
+
* says something a fixed colour cannot. The number is still written out by
|
|
51
|
+
* `showValue`, because a band is a second way of saying it and never the
|
|
52
|
+
* only one.
|
|
53
|
+
*/
|
|
54
|
+
thresholds?: readonly PlMeterThreshold[];
|
|
55
|
+
/** Thickness of the groove. Nothing else on a meter has a size. */
|
|
56
|
+
size?: PlassSize;
|
|
57
|
+
/** The family the bar takes where no threshold applies. @default 'primary' */
|
|
58
|
+
color?: PlassColor;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A quantity inside a range, drawn as a bar.
|
|
62
|
+
*
|
|
63
|
+
* It looks like a [PlProgressLinear](./progress-linear) and it is not one, and
|
|
64
|
+
* the difference is worth stating because it decides which to reach for.
|
|
65
|
+
* **Progress is something advancing; a meter is something already known.** Disk
|
|
66
|
+
* used, seats taken, a password's strength, how full a battery is — none of
|
|
67
|
+
* them is going anywhere on its own, and none of them has an indeterminate
|
|
68
|
+
* state. So `value` is required here, there is no sweep, and the role a screen
|
|
69
|
+
* reader is given is `meter` rather than `progressbar`.
|
|
70
|
+
*
|
|
71
|
+
* `thresholds` is the prop it exists for. A quota bar that turns amber at three
|
|
72
|
+
* quarters and red at ninety percent says something a fixed colour cannot, and
|
|
73
|
+
* the colour is derived from the value rather than chosen by the caller at the
|
|
74
|
+
* moment they happened to be looking.
|
|
75
|
+
*
|
|
76
|
+
* Base UI owns the semantics — the role, the range attributes, `aria-valuetext`
|
|
77
|
+
* and the formatting — and it computes the fill width too, so what is left here
|
|
78
|
+
* is the material: the groove is `--plass-track` and the fill is the family's
|
|
79
|
+
* gradient, both the same as a progress bar's. One material, two meanings. The
|
|
80
|
+
* fill travels on `width` because a gradient cannot be transitioned and a
|
|
81
|
+
* length can.
|
|
82
|
+
*/
|
|
83
|
+
export declare const PlMeter: React.ForwardRefExoticComponent<PlMeterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as r from"react";import{Meter as a}from"@base-ui/react/meter";import{useDefaults as s}from"../../internal/defaults.js";import{barThicknessClasses as t,fillTransitionClasses as o,progressSlots as i,trackClasses as m}from"../../internal/progress.js";import{cx as n,metaTextClasses as c,stackGapClasses as f}from"../../internal/styles.js";import{bandColor as u}from"../../internal/threshold.js";export const PlMeter=/* @__PURE__ */r.forwardRef(function PlMeter({value:r,min:d=0,max:p=100,label:h,showValue:x=!1,format:j,thresholds:b,size:w,color:N,className:g,style:v,...y},k){const z=s(),M=w??z.size??"md",P=N??z.color??"primary";return l(a.Root,{ref:k,value:r,min:d,max:p,format:j,locale:z.locale,className:n("flex w-full flex-col",f[M],g),style:{...i(u(r,P,b)),...v},...y,children:[h||x?l("div",{className:n("flex items-baseline gap-2",h?"justify-between":"justify-end",c[M]),children:[h?e(a.Label,{className:"min-w-0 truncate text-(--plass-fg)",children:h}):null,x?e(a.Value,{className:"shrink-0 tabular-nums text-(--plass-muted-fg)"}):null]}):null,e(a.Track,{className:n("relative w-full overflow-hidden rounded-full",m,t[M]),children:e(a.Indicator,{className:n("rounded-full [background-image:var(--p-fill)]",o)})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlMeter}from"./PlMeter.js";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlMockupBezel, PlMockupDevice, PlMockupFinish, PlMockupHardware, PlMockupNotch, PlMockupOrientation, PlMockupOs, PlMockupResolution } from '../../internal/mockup.js';
|
|
4
|
+
import type { PlassColor, PlassElevation, PlassSize } from '../../types.js';
|
|
5
|
+
export type { PlMockupBezel, PlMockupDevice, PlMockupFinish, PlMockupHardware, PlMockupNotch, PlMockupOrientation, PlMockupOs, PlMockupResolution } from '../../internal/mockup.js';
|
|
6
|
+
export interface PlMockupProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
7
|
+
/**
|
|
8
|
+
* Which machine this is a picture of. The one prop with no default: a mockup
|
|
9
|
+
* that has not said what it is a mockup of has not said anything.
|
|
10
|
+
*/
|
|
11
|
+
device: PlMockupDevice;
|
|
12
|
+
/**
|
|
13
|
+
* The system whose chrome is drawn on the screen. A desktop runs `macos`,
|
|
14
|
+
* `windows` or `linux`; a tablet runs `ipados` or `android`; a phone runs `ios`
|
|
15
|
+
* or `android`. Anything else falls back to the device's own default —
|
|
16
|
+
* `macos`, `ipados` and `ios` respectively.
|
|
17
|
+
*/
|
|
18
|
+
os?: PlMockupOs;
|
|
19
|
+
/**
|
|
20
|
+
* What holds a desktop screen up: a stand under it, or a keyboard in front of
|
|
21
|
+
* it. Ignored on a tablet and a phone, which hold themselves up.
|
|
22
|
+
* @default 'monitor'
|
|
23
|
+
*/
|
|
24
|
+
hardware?: PlMockupHardware;
|
|
25
|
+
/**
|
|
26
|
+
* How big the device is, on a five-step ladder of real resolutions per device
|
|
27
|
+
* — from a 320-wide phone to a 430-wide one, from a 1024-wide desktop to a
|
|
28
|
+
* 1920-wide one.
|
|
29
|
+
*
|
|
30
|
+
* As on Box, `size` here does not set a height or a type scale. What it sets
|
|
31
|
+
* is the resolution of the screen, which is the only thing about a device
|
|
32
|
+
* there is to scale. `resolution` overrides it outright.
|
|
33
|
+
* @default 'md'
|
|
34
|
+
*/
|
|
35
|
+
size?: PlassSize;
|
|
36
|
+
/**
|
|
37
|
+
* The screen's logical resolution in CSS pixels, when none of the five steps
|
|
38
|
+
* is the machine you mean. This is the viewport the content is laid out
|
|
39
|
+
* against, not the panel's physical pixel count.
|
|
40
|
+
*/
|
|
41
|
+
resolution?: PlMockupResolution;
|
|
42
|
+
/**
|
|
43
|
+
* Which way a handheld is held. Landscape turns the screen, the bezel and the
|
|
44
|
+
* cut-out together. Ignored on a desktop, whose stand does not turn with it.
|
|
45
|
+
* @default 'portrait'
|
|
46
|
+
*/
|
|
47
|
+
orientation?: PlMockupOrientation;
|
|
48
|
+
/**
|
|
49
|
+
* How much hardware there is around the screen. `none` is not a thinner
|
|
50
|
+
* bezel — it is no hardware at all, leaving the screen on its own with its
|
|
51
|
+
* corners cut, which is what a mockup that only wants the viewport asks for.
|
|
52
|
+
* `thick` is an older device: narrow sides, a forehead and a chin.
|
|
53
|
+
* @default 'standard'
|
|
54
|
+
*/
|
|
55
|
+
bezel?: PlMockupBezel;
|
|
56
|
+
/**
|
|
57
|
+
* What the hardware is made of. Fixed colours rather than theme tokens — a
|
|
58
|
+
* graphite phone stays graphite on a page switched to dark.
|
|
59
|
+
* @default 'graphite'
|
|
60
|
+
*/
|
|
61
|
+
finish?: PlMockupFinish;
|
|
62
|
+
/**
|
|
63
|
+
* The camera cut-out. Hardware rather than chrome, so it is drawn whether or
|
|
64
|
+
* not `systemUi` is on. Defaults to what the device would have: a dynamic
|
|
65
|
+
* island on an iOS phone, a punch hole on an Android one, nothing anywhere
|
|
66
|
+
* else.
|
|
67
|
+
*/
|
|
68
|
+
notch?: PlMockupNotch;
|
|
69
|
+
/**
|
|
70
|
+
* Draws the system's own bars — a status bar and a home indicator, a menu bar
|
|
71
|
+
* and a dock, a taskbar. Each one takes its own space rather than covering the
|
|
72
|
+
* content, so turning it off gives the screen back to `children` rather than
|
|
73
|
+
* uncovering anything.
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
systemUi?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether content taller than the screen scrolls. Off, it is clipped, which is
|
|
79
|
+
* what a still picture of a device wants.
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
scroll?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* What is behind the content: any CSS `background` value — a colour, a
|
|
85
|
+
* gradient, a `url()`.
|
|
86
|
+
* @default the page's own surface colour
|
|
87
|
+
*/
|
|
88
|
+
wallpaper?: string;
|
|
89
|
+
/**
|
|
90
|
+
* The clock in the status bar or the taskbar, and the only text the chrome
|
|
91
|
+
* draws. A string rather than a `Date`, because a mockup's clock is a prop of
|
|
92
|
+
* the picture and reading the real one would differ between the server that
|
|
93
|
+
* renders the page and the browser that hydrates it.
|
|
94
|
+
* @default '9:41'
|
|
95
|
+
*/
|
|
96
|
+
time?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The rendered width of the whole device on the page — a number in pixels or
|
|
99
|
+
* any CSS length. The device is laid out at its own resolution and then scaled
|
|
100
|
+
* to whatever this comes to, so the content inside is genuinely a screen's
|
|
101
|
+
* worth rather than a page's worth shrunk.
|
|
102
|
+
* @default '100%'
|
|
103
|
+
*/
|
|
104
|
+
width?: number | string;
|
|
105
|
+
/**
|
|
106
|
+
* The rendered height. Given on its own it decides the size and the width
|
|
107
|
+
* follows the device's proportion, which is what a mockup in a row of fixed
|
|
108
|
+
* height wants.
|
|
109
|
+
*/
|
|
110
|
+
height?: number | string;
|
|
111
|
+
/** Reaches the accent in the chrome — a dock's first icon, a taskbar's. */
|
|
112
|
+
color?: PlassColor;
|
|
113
|
+
/**
|
|
114
|
+
* How far off the page the device sits. Drawn as a silhouette rather than a
|
|
115
|
+
* box, so the shadow follows a lid on a neck on a foot, and it does not shrink
|
|
116
|
+
* with the device.
|
|
117
|
+
* @default 0
|
|
118
|
+
*/
|
|
119
|
+
elevation?: PlassElevation;
|
|
120
|
+
/** Renders something other than a `<div>`: `render={<figure />}`. */
|
|
121
|
+
render?: useRender.RenderProp;
|
|
122
|
+
/** What is on the screen. */
|
|
123
|
+
children?: React.ReactNode;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A device with a screen you can put anything on: a phone, a tablet, a monitor
|
|
127
|
+
* or a laptop, with the system's own bars drawn on it.
|
|
128
|
+
*
|
|
129
|
+
* The screen is a viewport at the device's own resolution — a `md` phone is 390
|
|
130
|
+
* by 844 CSS pixels — and the whole device is then scaled once to whatever room
|
|
131
|
+
* it has been given. So the content inside is laid out against a screen rather
|
|
132
|
+
* than against the page: a 390-pixel column wraps where it would wrap on a
|
|
133
|
+
* phone, and the mockup can be 200 pixels wide on the page without the content
|
|
134
|
+
* knowing.
|
|
135
|
+
*
|
|
136
|
+
* That scale is a `transform`, and it is the one place in the library where one
|
|
137
|
+
* is used. The rule it is an exception to is about controls, where a scale
|
|
138
|
+
* resamples a label under the pointer that is pressing it. Nothing here is
|
|
139
|
+
* pressed and the scale never changes on an interaction: it is set once from the
|
|
140
|
+
* space available, which is the only way to draw a 1440-pixel desktop in a
|
|
141
|
+
* paragraph's width at all.
|
|
142
|
+
*
|
|
143
|
+
* The screen is also a container (`plass-screen`), so content inside can answer
|
|
144
|
+
* to the device's width with a container query rather than to the window's.
|
|
145
|
+
*/
|
|
146
|
+
export declare const PlMockup: React.ForwardRefExoticComponent<PlMockupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import*as r from"react";import{useRender as a}from"@base-ui/react/use-render";import{PlMockupCutout as s,defaultNotch as l,elevationFilters as o,finishSlots as h,mockupChrome as d,mockupMetrics as n,resolveOs as c,shellClasses as u}from"../../internal/mockup.js";import{cx as p,surfaceSlots as m}from"../../internal/styles.js";import{usePlElementSize as f}from"../../hooks/usePlElementSize.js";import{useDefaults as g}from"../../internal/defaults.js";export const PlMockup=/* @__PURE__ */r.forwardRef(function PlMockup(v,w){const{device:b,os:x,hardware:y="monitor",size:k,resolution:N,orientation:z="portrait",bezel:R="standard",finish:$="graphite",notch:j,systemUi:M=!0,scroll:P=!1,wallpaper:H,time:W="9:41",width:S,height:B,color:C,elevation:E=0,render:F,className:I,style:T,children:U,...q}=v,A=g(),D=k??A.size??"md",G=C??A.color??"primary",J=c(b,x),K=j??l(b,J),L="desktop"!==b&&"landscape"===z,O=n({device:b,size:D,resolution:N,orientation:z,bezel:R,hardware:y}),{screen:Q,frame:V,body:X,stand:Y,base:Z}=O,_=r.useRef(null),ee=f(_),te=null===ee||ee.width<=0||ee.height<=0?null:Math.min(ee.width/V.width,ee.height/V.height),ie=r.useCallback(e=>{_.current=e,"function"==typeof w?w(e):w&&(w.current=e)},[w]),re=M?d({os:J,notch:K,landscape:L,time:W}):{},ae="none"===R,se=t("div",{className:"plass-mockup-screen relative flex flex-col overflow-hidden",style:{width:Q.width,height:Q.height,borderRadius:O.screenRadius,background:H??"var(--plass-surface)",boxShadow:ae?void 0:"inset 0 0 0 1px var(--p-shell-shade)"},children:[re.top?.node,t("div",{className:"flex min-h-0 flex-1",children:[re.start?.node,e("div",{className:"min-w-0 flex-1 "+(P?"overflow-auto":"overflow-hidden"),style:{containerType:"size",containerName:"plass-screen"},children:U})]}),re.bottom?.node,e(s,{notch:K,screen:Q,landscape:L})]}),le=p("plass-mockup relative block",I??"");return a({render:F,ref:ie,props:{className:le,style:{...m(G,E),...h[$],width:S??(void 0===B?"100%":"auto"),height:B??"auto",aspectRatio:`${V.width} / ${V.height}`,filter:o[E],...T},children:e("div",{className:"absolute inset-0 flex items-center justify-center",style:{visibility:null===te?"hidden":void 0},children:t("div",{className:"flex shrink-0 flex-col items-center",style:{width:V.width,height:V.height,transform:`scale(${te??1})`},children:[e("div",{className:ae?"":u,style:{width:X.width,height:X.height,borderRadius:O.frameRadius,paddingBlock:`${O.bezel.top}px ${O.bezel.bottom}px`,paddingInline:O.bezel.x},children:se}),Y?t(i,{children:[e("div",{"aria-hidden":"true",style:{width:Y.neckWidth,height:Y.neckHeight,background:"var(--p-shell-shade)",clipPath:"polygon(16% 0, 84% 0, 100% 100%, 0 100%)"}}),e("div",{"aria-hidden":"true",className:u,style:{width:Y.footWidth,height:Y.footHeight,borderRadius:Y.footHeight/2}})]}):null,Z?e("div",{"aria-hidden":"true",className:`relative ${u}`,style:{width:Z.width,height:Z.height,borderRadius:`0 0 ${Math.round(.55*Z.height)}px ${Math.round(.55*Z.height)}px`,clipPath:"polygon(0 0, 100% 0, 98.5% 100%, 1.5% 100%)"},children:e("div",{className:"absolute inset-x-0 top-0 mx-auto",style:{width:Z.lipWidth,height:Math.round(.34*Z.height),borderRadius:`0 0 ${Math.round(.2*Z.height)}px ${Math.round(.2*Z.height)}px`,background:"var(--p-shell-shade)"}})}):null]})}),...q}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlMockup}from"./PlMockup.js";
|
|
@@ -111,4 +111,4 @@ export declare const PlModalClose: React.ForwardRefExoticComponent<Omit<import("
|
|
|
111
111
|
* the header and the actions stay put while only the body scrolls, which is why
|
|
112
112
|
* `dividers` matters more here than on a PlCard.
|
|
113
113
|
*/
|
|
114
|
-
export declare function PlModal({ size: sizeProp, color: colorProp, density: densityProp, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel, width, fullWidth, fullScreen, modal, dismissible, className, classNames, style, children, ...props }: PlModalProps): React.JSX.Element;
|
|
114
|
+
export declare function PlModal({ size: sizeProp, color: colorProp, density: densityProp, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel: closeLabelProp, width, fullWidth, fullScreen, modal, dismissible, className, classNames, style, children, ...props }: PlModalProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useDefaults as l}from"../../internal/defaults.js";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useDefaults as l}from"../../internal/defaults.js";import{useLabels as a}from"../../internal/labels.js";import{Dialog as o}from"@base-ui/react/dialog";import{CloseIcon as i}from"../../internal/icons.js";import{cx as r,focusRingClasses as t,glassClasses as n,hasContent as d,metaTextClasses as c,radiusClasses as p,sheetBodyClasses as m,sheetHeaderGapClasses as f,sheetLineClasses as u,sheetPaddingXClasses as x,sheetPaddingYClasses as h,sheetSectionGapClasses as g,sheetTitleClasses as v,surfaceSlots as y}from"../../internal/styles.js";const b={xs:"max-w-80",sm:"max-w-96",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"},w=/* @__PURE__ */[n,"relative flex w-full flex-col overflow-hidden","border text-(--plass-fg) bg-(--plass-glass-press)","[border-color:var(--plass-glass-line)]","[box-shadow:var(--plass-shadow-4),var(--plass-gloss-glass)]","[outline:none]","[transition:opacity_var(--plass-duration-slow)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),j=/* @__PURE__ */["fixed inset-0 z-(--plass-z-portal) bg-(--plass-scrim)","[backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]","[transition:opacity_var(--plass-duration-slow)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export const PlModalClose=o.Close;export function PlModal({size:n,color:N,density:k,open:$,defaultOpen:_,onOpenChange:z,trigger:C,title:P,description:B,actions:O,dividers:D=!1,showClose:M=!0,closeLabel:T,width:W,fullWidth:L=!0,fullScreen:R=!1,modal:S=!0,dismissible:V=!0,className:q,classNames:A,style:E,children:F,...G}){const H=l(),I=a(),J=T??I.close,K=n??H.size??"md",Q=N??H.color??"primary",U=k??H.density??"default",X=x[U][K],Y=h[U][K],Z=D?`${X} ${Y}`:X,ee=d(P)||d(B),se=d(O);return s(o.Root,{open:$,defaultOpen:_,modal:S,disablePointerDismissal:!V,onOpenChange:(e,s)=>{V||e||"escape-key"!==s.reason?z?.(e):s.cancel()},children:[C?e(o.Trigger,{render:C}):null,s(o.Portal,{children:[e(o.Backdrop,{className:r("plass-portal",j,A?.backdrop)}),e(o.Viewport,{className:["plass-portal fixed inset-0 z-(--plass-z-portal) flex justify-center",R?"items-stretch":"items-center p-4"].join(" "),children:s(o.Popup,{className:[w,m[K],R?"h-full max-w-none rounded-none":`max-h-full ${p[K]} ${void 0===W?b[K]:""}`,R||L?"":"w-auto",D?"":`${Y} ${g[K]}`,q??""].filter(Boolean).join(" "),style:{...y(Q,3),...void 0===W?null:{maxWidth:"number"==typeof W?`${W}px`:W},...E},...G,children:[ee||M?s("div",{className:`flex shrink-0 items-start gap-3 ${Z}`,children:[s("div",{className:`flex min-w-0 flex-1 flex-col ${f[K]}`,children:[d(P)?e(o.Title,{className:`m-0 font-semibold ${v[K]}`,children:P}):null,d(B)?e(o.Description,{className:`m-0 text-(--plass-muted-fg) ${c[K]}`,children:B}):null]}),M?e(o.Close,{"aria-label":J,className:["flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--plass-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--plass-duration)_var(--plass-ease),color_var(--plass-duration)_var(--plass-ease)]","hover:bg-(--p-soft) hover:text-(--plass-fg)",t].join(" "),children:e(i,{})}):null]}):null,d(F)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",Z,D&&(ee||M)?u:"",D?"":"-my-1 py-1"].filter(Boolean).join(" "),children:F}):null,se?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",Z,D?u:""].filter(Boolean).join(" "),children:O}):null]})})]})]})}
|
|
@@ -141,4 +141,4 @@ export interface PlNumberFieldProps extends PlassStyleProps, Omit<React.Componen
|
|
|
141
141
|
* clamping, the press-and-hold repeat on the steppers, and the hidden input that
|
|
142
142
|
* submits with a form.
|
|
143
143
|
*/
|
|
144
|
-
export declare function PlNumberField({ variant, size: sizeProp, color: colorProp, density: densityProp, elevation, value, defaultValue, onValueChange, onValueCommitted, min, max, step, largeStep, smallStep, snapOnStep, allowWheelScrub, format, locale: localeProp, steppers, incrementLabel, decrementLabel, label, description, error, invalid, startIcon, endIcon, fullWidth, disabled, readOnly, required, name, placeholder, id, className, hotKeys, classNames, style, ...props }: PlNumberFieldProps): React.JSX.Element;
|
|
144
|
+
export declare function PlNumberField({ variant, size: sizeProp, color: colorProp, density: densityProp, elevation, value, defaultValue, onValueChange, onValueCommitted, min, max, step, largeStep, smallStep, snapOnStep, allowWheelScrub, format, locale: localeProp, steppers, incrementLabel: incrementLabelProp, decrementLabel: decrementLabelProp, label, description, error, invalid, startIcon, endIcon, fullWidth, disabled, readOnly, required, name, placeholder, id, className, hotKeys, classNames, style, ...props }: PlNumberFieldProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useDefaults as a}from"../../internal/defaults.js";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useDefaults as a}from"../../internal/defaults.js";import{useLabels as t}from"../../internal/labels.js";import{NumberField as s}from"@base-ui/react/number-field";import{Field as n}from"@base-ui/react/field";import{MinusIcon as r,PlusIcon as i}from"../../internal/icons.js";import{hotKeyHandler as o}from"../../internal/keys.js";import{controlHeightClasses as c,controlTextLeadingClasses as d,cx as m,disabledClasses as p,fieldReadOnlyClasses as u,fieldRestClasses as f,focusRingClasses as h,focusWithinRingClasses as b,gapClasses as x,hasContent as g,iconClasses as v,metaTextClasses as N,paddingXClasses as y,radiusClasses as j,stackGapClasses as w,surfaceSlots as k,transitionClasses as S}from"../../internal/styles.js";const _=/* @__PURE__ */["group relative flex w-full cursor-text items-center","[-webkit-tap-highlight-color:transparent]",S,"focus-within:[transition-duration:0ms]",b,v].join(" "),V=/* @__PURE__ */["inline-flex size-[1.7em] shrink-0 cursor-pointer items-center justify-center","rounded-(--plass-radius-xs) text-(--plass-muted-fg) select-none","[&_svg]:size-[0.9em] [&_svg]:shrink-0","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]","[transition:background-color_var(--plass-duration)_var(--plass-ease),color_var(--plass-duration)_var(--plass-ease),opacity_var(--plass-duration)_var(--plass-ease)]","active:[transition-duration:0ms]","hover:bg-(--p-soft) hover:text-(--p-accent)","active:bg-(--p-soft-press)",h,"disabled:cursor-not-allowed disabled:bg-transparent disabled:opacity-40"].join(" ");export function PlNumberField({variant:h="glass",size:b,color:v,density:S,elevation:z=0,value:C,defaultValue:I,onValueChange:O,onValueCommitted:B,min:D,max:L,step:W,largeStep:q,smallStep:F,snapOnStep:K,allowWheelScrub:R=!1,format:E,locale:G,steppers:P="end",incrementLabel:$,decrementLabel:A,label:H,description:J,error:M,invalid:Q,startIcon:T,endIcon:U,fullWidth:X=!1,disabled:Y=!1,readOnly:Z=!1,required:ee=!1,name:le,placeholder:ae,id:te,className:se,hotKeys:ne,classNames:re,style:ie,...oe}){const ce=a(),de=t(),me=$??de.increase,pe=A??de.decrease,ue=G??ce.locale,fe=b??ce.size??"md",he=v??ce.color??"primary",be=S??ce.density??"default",xe=g(M),ge=Q??xe,ve=ge?"danger":he,Ne=y[be][fe],ye={end:`${Ne} pe-1`,split:"px-1",none:Ne},je=e(s.Decrement,{"aria-label":pe,className:V,children:e(r,{})}),we=e(s.Increment,{"aria-label":me,className:V,children:e(i,{})}),ke="none"!==P&&!Z;return l(n.Root,{disabled:Y,invalid:ge,className:["flex-col align-top",w[fe],X?"flex w-full":"inline-flex",se??""].filter(Boolean).join(" "),style:{...k(ve,z),...ie},...oe,children:[H?e(n.Label,{className:m(N[fe],"font-medium text-(--plass-fg)",Y?"opacity-50":"",re?.label),children:H}):null,e(s.Root,{id:te,name:le,className:"contents",value:C,defaultValue:I,onValueChange:e=>O?.(e),onValueCommitted:e=>B?.(e),min:D,max:L,step:W,largeStep:q,smallStep:F,snapOnStep:K,allowWheelScrub:R,format:E,locale:ue,disabled:Y,readOnly:Z,required:ee,children:l(s.Group,{className:[_,c[fe],d[fe],j[fe],x[fe],ke?ye[P]:Ne,Y?p[h]:Z?u[h]:f[h],re?.control].filter(Boolean).join(" "),children:[ke&&"split"===P?je:null,T?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)",children:T}):null,e(s.Input,{placeholder:ae,onKeyDown:o(ne,void 0),className:["min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit","[outline:none]","tabular-nums","split"===P&&ke?"text-center":"","placeholder:text-(--plass-muted-fg)","caret-(--p-accent) selection:bg-(--p-soft-press)","disabled:cursor-not-allowed"].filter(Boolean).join(" ")}),U?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)",children:U}):null,ke&&"end"===P?l("span",{className:"flex shrink-0 items-center gap-0.5",children:[je,we]}):null,ke&&"split"===P?we:null]})}),J?e(n.Description,{className:m(N[fe],"text-(--plass-muted-fg)",re?.description),children:J}):null,e(n.Error,xe?{match:!0,className:m(N[fe],"text-(--p-accent)",re?.error),children:M}:{className:m(N[fe],"text-(--p-accent)",re?.error)})]})}
|
|
@@ -95,4 +95,4 @@ export interface PlOverlayProps extends Omit<React.ComponentPropsWithoutRef<'div
|
|
|
95
95
|
* held inside, the page behind going inert, and focus returning to wherever it
|
|
96
96
|
* came from when the overlay closes.
|
|
97
97
|
*/
|
|
98
|
-
export declare function PlOverlay({ open, defaultOpen, onOpenChange, tone, dismissible, modal, align, size: sizeProp, color: colorProp, label, className, classNames, style, children, ...props }: PlOverlayProps): React.JSX.Element;
|
|
98
|
+
export declare function PlOverlay({ open, defaultOpen, onOpenChange, tone, dismissible, modal, align, size: sizeProp, color: colorProp, label: labelProp, className, classNames, style, children, ...props }: PlOverlayProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useDefaults as s}from"../../internal/defaults.js";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useDefaults as s}from"../../internal/defaults.js";import{useLabels as l}from"../../internal/labels.js";import{Dialog as r}from"@base-ui/react/dialog";import{cx as t,surfaceSlots as i}from"../../internal/styles.js";const o={scrim:"bg-(--plass-scrim) [backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]",glass:/* @__PURE__ */["[background-color:color-mix(in_oklab,var(--plass-scrim)_45%,transparent)]","[backdrop-filter:var(--plass-blur)] [-webkit-backdrop-filter:var(--plass-blur)]"].join(" "),solid:"bg-(--plass-surface)",clear:""},n={start:"items-start",center:"items-center",end:"items-end"},p={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8",xl:"p-10"},c=/* @__PURE__ */["[transition:opacity_var(--plass-duration-slow)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export function PlOverlay({open:m,defaultOpen:d,onOpenChange:f,tone:b="scrim",dismissible:u=!1,modal:x=!0,align:y="center",size:g,color:j,label:k,className:h,classNames:v,style:z,children:w,...N}){const O=s(),P=l(),_=k??P.overlay,B=g??O.size??"md",C=j??O.color??"primary";return e(r.Root,{open:m,defaultOpen:d,modal:x,disablePointerDismissal:!u,onOpenChange:(e,a)=>{u||e||"escape-key"!==a.reason?f?.(e):a.cancel()},children:a(r.Portal,{children:[e(r.Backdrop,{className:t("plass-portal fixed inset-0 z-(--plass-z-portal)",c,o[b],v?.backdrop)}),e(r.Viewport,{className:["plass-portal fixed inset-0 z-(--plass-z-portal) flex justify-center",n[y],p[B]].join(" "),children:e(r.Popup,{"aria-label":_,className:["flex max-h-full max-w-full flex-col items-center justify-center","[outline:none]",c,h??""].filter(Boolean).join(" "),style:{...i(C,0),...z},...N,children:w})})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as o from"react";import{useDefaults as t}from"../../internal/defaults.js";import{PlPageLayoutContext as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as o from"react";import{useDefaults as t}from"../../internal/defaults.js";import{useLabels as n}from"../../internal/labels.js";import{PlPageLayoutContext as r,PlassSidebarSideContext as s}from"../../internal/page-layout.js";import{controlSlots as a,cx as i,hasContent as u,toLength as c}from"../../internal/styles.js";const f=["header","footer"];export const PlPageLayout=/* @__PURE__ */o.forwardRef(function PlPageLayout({header:d,footer:p,sidebar:m,endSidebar:h,headerSpan:v="full",footerSpan:x="full",scroll:y="page",height:b="viewport",collapseBelow:g="md",sidebarOpen:w,defaultSidebarOpen:P=!1,onSidebarOpenChange:k,endSidebarOpen:S,defaultEndSidebarOpen:C=!1,onEndSidebarOpenChange:O,skipLink:j=!0,skipLabel:N,mainId:$="main",mainProps:R,color:z,className:L,style:E,children:B,...H},M){const _=t(),I=n(),T=N??I.skipToContent,q=z??_.color??"primary",[A,D]=o.useState(P),[F,G]=o.useState(C),J=o.useMemo(()=>({start:w??A,end:S??F}),[w,A,S,F]),K=o.useCallback((e,l)=>{if("start"===e)return void 0===w&&D(l),void k?.(l);void 0===S&&G(l),O?.(l)},[w,S,k,O]),Q=o.useRef(null),U=o.useCallback(e=>{Q.current=e,"function"==typeof M?M(e):M&&(M.current=e)},[M]),V=o.useRef({header:null,footer:null}),W=o.useRef(null),X=o.useCallback(()=>{const e=Q.current;if(e)for(const l of f){const o=V.current[l],t="header"===l?v:x;if(!o){e.style.setProperty(`--p-layout-${l}`,"0px"),e.style.setProperty(`--p-layout-${l}-inset`,"0px");continue}const n=getComputedStyle(o).position,r=`${o.offsetHeight}px`,s="sticky"===n||"fixed"===n;e.style.setProperty(`--p-layout-${l}`,s&&"full"===t?r:"0px"),e.style.setProperty(`--p-layout-${l}-inset`,"fixed"===n?r:"0px")}},[v,x]),Y=o.useCallback(()=>{const e=W.current;if(e){e.disconnect();for(const l of f){const o=V.current[l];o&&e.observe(o)}}X()},[X]);o.useEffect(()=>(W.current=new ResizeObserver(()=>X()),Y(),()=>{W.current?.disconnect(),W.current=null}),[X,Y]);const Z=o.useCallback((e,l)=>{V.current[e]=l,Y()},[Y]),ee=o.useMemo(()=>({present:!0,register:Z,collapseBelow:g,open:J,setOpen:K,scroll:y}),[Z,g,J,K,y]),le="content"===y,oe=c("viewport"===b||"auto"===b?void 0:b),te=void 0!==oe?"":"auto"===b?le?"h-full":"min-h-full":le?"h-dvh":"min-h-dvh",ne=u(d)?d:null,re=u(p)?p:null;return e(r.Provider,{value:ee,children:l("div",{ref:U,className:i("relative flex w-full flex-col",le?"overflow-hidden":"",te,"full"===v?"[padding-top:var(--p-layout-header-inset,0px)]":"","full"===x?"[padding-bottom:var(--p-layout-footer-inset,0px)]":"",L),style:void 0===oe?E:{...le?{height:oe}:{minHeight:oe},...E},...H,children:[j?e("a",{href:`#${$}`,className:i("absolute start-3 top-3 z-40 size-px overflow-hidden whitespace-nowrap","[clip-path:inset(50%)] focus:size-auto focus:overflow-visible focus:[clip-path:none]","focus:rounded-(--plass-radius-md) focus:[background-image:var(--p-fill)]","focus:px-4 focus:py-2 focus:font-medium focus:text-(--p-on-solid) focus:no-underline","focus:[box-shadow:var(--p-elev),var(--p-lift)]","focus:[outline:2px_solid_var(--p-ring)] focus:[outline-offset:0px]"),style:a(q,2,"solid"),children:T}):null,"full"===v?ne:null,l("div",{className:i("flex w-full flex-1",le?"min-h-0":""),children:[u(m)?e(s.Provider,{value:"start",children:m}):null,l("div",{className:i("flex min-w-0 flex-1 flex-col",le?"min-h-0":"","content"===v?"[padding-top:var(--p-layout-header-inset,0px)]":"","content"===x?"[padding-bottom:var(--p-layout-footer-inset,0px)]":""),children:["content"===v?ne:null,e("main",{...R,id:$,className:i("min-w-0 flex-1",le?"min-h-0 overflow-y-auto":"",R?.className),children:B}),"content"===x?re:null]}),u(h)?e(s.Provider,{value:"end",children:h}):null]}),"full"===x?re:null]})})});
|