plass-ui 1.2.0 → 1.3.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 +78 -0
- package/dist/components/accordion/PlAccordion.js +1 -1
- package/dist/components/alert/PlAlert.js +1 -1
- package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
- package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
- package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
- package/dist/components/avatar/PlAvatar.js +1 -1
- package/dist/components/avatar-group/PlAvatarGroup.js +1 -1
- package/dist/components/back-top/PlBackTop.d.ts +55 -0
- package/dist/components/back-top/PlBackTop.js +1 -0
- package/dist/components/back-top/index.d.ts +2 -0
- package/dist/components/back-top/index.js +1 -0
- package/dist/components/badge/PlBadge.js +1 -1
- package/dist/components/blockquote/PlBlockquote.js +1 -1
- package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -1
- package/dist/components/box/PlBox.js +1 -1
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
- package/dist/components/button/PlButton.js +1 -1
- package/dist/components/calendar/PlCalendar.d.ts +104 -0
- package/dist/components/calendar/PlCalendar.js +1 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/PlCard.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/collapsible/PlCollapsible.js +1 -1
- package/dist/components/color-picker/PlColorPicker.js +1 -1
- package/dist/components/combobox/PlCombobox.d.ts +11 -2
- 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/confirm/PlConfirmProvider.d.ts +100 -0
- package/dist/components/confirm/PlConfirmProvider.js +1 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- package/dist/components/container/PlContainer.js +1 -1
- package/dist/components/date-picker/PlDatePicker.d.ts +41 -2
- package/dist/components/date-picker/PlDatePicker.js +1 -1
- package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
- package/dist/components/divider/PlDivider.js +1 -1
- package/dist/components/drawer/PlDrawer.d.ts +1 -1
- package/dist/components/drawer/PlDrawer.js +1 -1
- package/dist/components/empty/PlEmpty.d.ts +47 -0
- package/dist/components/empty/PlEmpty.js +1 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/empty/index.js +1 -0
- package/dist/components/file-picker/PlFilePicker.js +1 -1
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
- package/dist/components/footer/PlFooter.js +1 -1
- package/dist/components/header/PlHeader.js +1 -1
- package/dist/components/highlight/PlHighlight.js +1 -1
- package/dist/components/hot-keys/PlHotKeys.js +1 -1
- package/dist/components/image/PlImage.d.ts +72 -0
- package/dist/components/image/PlImage.js +1 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/list/PlList.js +1 -1
- package/dist/components/menu/PlMenu.d.ts +2 -2
- package/dist/components/menu/PlMenu.js +1 -1
- package/dist/components/menubar/PlMenubar.js +1 -1
- package/dist/components/modal/PlModal.d.ts +1 -1
- package/dist/components/modal/PlModal.js +1 -1
- package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
- package/dist/components/number-field/PlNumberField.d.ts +11 -2
- package/dist/components/number-field/PlNumberField.js +1 -1
- package/dist/components/otp-field/PlOtpField.d.ts +10 -1
- package/dist/components/otp-field/PlOtpField.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.js +1 -1
- package/dist/components/pill/PlPill.js +1 -1
- package/dist/components/popconfirm/PlPopconfirm.d.ts +61 -0
- package/dist/components/popconfirm/PlPopconfirm.js +1 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/PlPopover.d.ts +1 -1
- package/dist/components/popover/PlPopover.js +1 -1
- package/dist/components/progress-box/PlProgressBox.js +1 -1
- package/dist/components/progress-circular/PlProgressCircular.js +1 -1
- package/dist/components/progress-linear/PlProgressLinear.js +1 -1
- package/dist/components/radio-group/PlRadioGroup.js +1 -1
- package/dist/components/rating/PlRating.js +1 -1
- package/dist/components/scroll-zone/PlScrollZone.js +1 -1
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
- package/dist/components/select/PlSelect.d.ts +10 -1
- package/dist/components/select/PlSelect.js +1 -1
- package/dist/components/sidebar/PlSidebar.js +1 -1
- package/dist/components/skeleton/PlSkeleton.js +1 -1
- package/dist/components/slider/PlSlider.js +1 -1
- package/dist/components/spoiler/PlSpoiler.js +1 -1
- package/dist/components/stat/PlStat.d.ts +66 -0
- package/dist/components/stat/PlStat.js +1 -0
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/index.js +1 -0
- package/dist/components/stepper/PlStepper.d.ts +86 -0
- package/dist/components/stepper/PlStepper.js +1 -0
- package/dist/components/stepper/index.d.ts +2 -0
- package/dist/components/stepper/index.js +1 -0
- package/dist/components/switch/PlSwitch.js +1 -1
- package/dist/components/tabs/PlTabs.js +1 -1
- package/dist/components/text-field/PlTextField.d.ts +10 -1
- package/dist/components/text-field/PlTextField.js +1 -1
- package/dist/components/time-picker/PlTimePicker.js +1 -1
- package/dist/components/timeline/PlTimeline.d.ts +5 -8
- package/dist/components/timeline/PlTimeline.js +1 -1
- 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/toolbar/PlToolbar.js +1 -1
- package/dist/components/tooltip/PlTooltip.d.ts +1 -1
- package/dist/components/tooltip/PlTooltip.js +1 -1
- package/dist/components/transfer/PlTransfer.js +1 -1
- package/dist/components/tree/PlTree.d.ts +67 -0
- package/dist/components/tree/PlTree.js +1 -0
- package/dist/components/tree/index.d.ts +2 -0
- package/dist/components/tree/index.js +1 -0
- package/dist/components/visually-hidden/PlVisuallyHidden.d.ts +46 -0
- package/dist/components/visually-hidden/PlVisuallyHidden.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/css/back-top.css +2 -0
- package/dist/css/calendar.css +2 -0
- package/dist/css/confirm.css +2 -0
- package/dist/css/empty.css +2 -0
- package/dist/css/image.css +2 -0
- package/dist/css/popconfirm.css +2 -0
- package/dist/css/stat.css +2 -0
- package/dist/css/stepper.css +2 -0
- package/dist/css/tree.css +2 -0
- package/dist/css/visually-hidden.css +2 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/usePlBreakpoint.d.ts +38 -0
- package/dist/hooks/usePlBreakpoint.js +1 -0
- package/dist/hooks/usePlColorScheme.d.ts +66 -0
- package/dist/hooks/usePlColorScheme.js +1 -0
- package/dist/hooks/usePlHotKeys.d.ts +81 -0
- package/dist/hooks/usePlHotKeys.js +1 -0
- package/dist/hooks/usePlMediaQuery.d.ts +22 -0
- package/dist/hooks/usePlMediaQuery.js +1 -0
- package/dist/hooks/usePlReducedMotion.d.ts +22 -0
- package/dist/hooks/usePlReducedMotion.js +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +0 -1
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.d.ts +25 -3
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/color-scheme.d.ts +23 -0
- package/dist/internal/color-scheme.js +1 -0
- package/dist/internal/date.d.ts +21 -0
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +69 -0
- package/dist/internal/defaults.js +1 -0
- package/dist/internal/direction.d.ts +4 -0
- package/dist/internal/direction.js +1 -0
- package/dist/internal/grid.d.ts +2 -0
- package/dist/internal/grid.js +1 -1
- package/dist/internal/keys.d.ts +93 -0
- package/dist/internal/keys.js +1 -0
- package/dist/internal/media.d.ts +26 -0
- package/dist/internal/media.js +1 -0
- package/dist/internal/page-layout.d.ts +6 -6
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/steps.d.ts +76 -0
- package/dist/internal/steps.js +1 -0
- package/dist/provider/PlColorSchemeScript.d.ts +40 -0
- package/dist/provider/PlColorSchemeScript.js +1 -0
- package/dist/provider/PlassProvider.d.ts +39 -0
- package/dist/provider/PlassProvider.js +1 -0
- package/dist/provider/index.d.ts +5 -0
- package/dist/provider/index.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +29 -1
- package/dist/tokens.css +29 -1
- package/dist/types.d.ts +17 -0
- package/package.json +17 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";const n=new Map;function listFor(e){if("undefined"==typeof window||!window.matchMedia)return null;let r=n.get(e);return r||(r=window.matchMedia(e),n.set(e,r)),r}function onServer(){return!1}export const reducedMotionQuery="(prefers-reduced-motion: reduce)";export function useMediaQuery(n){const r=e.useCallback(e=>{const r=null===n?null:listFor(n);return r?(r.addEventListener("change",e),()=>r.removeEventListener("change",e)):()=>{}},[n]),t=e.useCallback(()=>null!==n&&(listFor(n)?.matches??!1),[n]);return e.useSyncExternalStore(r,t,onServer)}export function usePrefersReducedMotion(){return useMediaQuery(reducedMotionQuery)}
|
|
@@ -114,12 +114,12 @@ export declare const expandedOnlyClasses: Record<PlPageLayoutCollapse, string>;
|
|
|
114
114
|
* Whether the window is currently narrower than the breakpoint a sidebar
|
|
115
115
|
* collapses at.
|
|
116
116
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
117
|
+
* The store behind it is `internal/media.ts`, and the one reason that matters
|
|
118
|
+
* here is its server snapshot: the server's answer has to be "not collapsed". A
|
|
119
|
+
* collapsed sidebar is a `PlDrawer`, a drawer is a portal, and a portal
|
|
120
|
+
* rendered into `document.body` on the server is not a thing — so the markup
|
|
121
|
+
* that ships is the column, and the classes above are what keep that column off
|
|
122
|
+
* a narrow screen until this hook can say otherwise.
|
|
123
123
|
*/
|
|
124
124
|
export declare function useCollapsed(breakpoint: PlPageLayoutCollapse): boolean;
|
|
125
125
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";export const PlPageLayoutContext=/* @__PURE__ */e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const PlassSidebarSideContext=/* @__PURE__ */e.createContext(null);const n={xs:null,sm:"(width < 40rem)",md:"(width < 48rem)",lg:"(width < 64rem)",xl:"(width < 80rem)"};export const collapsedOnlyClasses={none:"hidden",xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};export const expandedOnlyClasses={none:"",xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export function useCollapsed(
|
|
1
|
+
"use client";import*as e from"react";import{useMediaQuery as t}from"./media.js";export const PlPageLayoutContext=/* @__PURE__ */e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const PlassSidebarSideContext=/* @__PURE__ */e.createContext(null);const n={xs:null,sm:"(width < 40rem)",md:"(width < 48rem)",lg:"(width < 64rem)",xl:"(width < 80rem)"};export const collapsedOnlyClasses={none:"hidden",xs:"hidden",sm:"sm:hidden",md:"md:hidden",lg:"lg:hidden",xl:"xl:hidden"};export const expandedOnlyClasses={none:"",xs:"",sm:"max-sm:hidden",md:"max-md:hidden",lg:"max-lg:hidden",xl:"max-xl:hidden"};export function useCollapsed(e){return t("none"===e?null:n[e])}export function drawerSide(e){const t="undefined"!=typeof document&&"rtl"===getComputedStyle(document.documentElement).direction;return"start"===e?t?"right":"left":t?"left":"right"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rail a sequence is drawn on, shared by `PlTimeline` and `PlStepper`.
|
|
3
|
+
*
|
|
4
|
+
* The two components are not the same thing — a timeline **reports** a sequence
|
|
5
|
+
* that happened and a stepper **is** one the reader is moving through, which is
|
|
6
|
+
* why one is an `<ol>` of text and the other is an `<ol>` of buttons with a
|
|
7
|
+
* panel under it — but they are the same *drawing*, and a reader who has learned
|
|
8
|
+
* what a haloed bullet means on one must not find it meaning something else on
|
|
9
|
+
* the other.
|
|
10
|
+
*
|
|
11
|
+
* So the marks live here and the behaviour lives in the components. This is the
|
|
12
|
+
* arrangement `internal/button-group.ts` and `internal/progress.ts` already
|
|
13
|
+
* make, and it is here for the reason `internal/icons.tsx` gives: two copies of
|
|
14
|
+
* twelve lines are not expensive, they are two copies that drift.
|
|
15
|
+
*/
|
|
16
|
+
import type { PlassColor, PlassSize } from '../types.js';
|
|
17
|
+
/**
|
|
18
|
+
* How far along one step is.
|
|
19
|
+
*
|
|
20
|
+
* Three states rather than two, because "the one you are on" is not the same
|
|
21
|
+
* claim as "done", and a sequence that cannot say which step is current is a
|
|
22
|
+
* list. Each gets its own axis — a filled bullet, a filled bullet with a halo
|
|
23
|
+
* around it, an empty one — rather than three shades of the same thing.
|
|
24
|
+
*/
|
|
25
|
+
export type PlassStepStatus = 'complete' | 'current' | 'upcoming';
|
|
26
|
+
/** How the line between two steps is drawn. `none` leaves the gap open. */
|
|
27
|
+
export type PlassStepConnector = 'solid' | 'dashed' | 'dotted' | 'none';
|
|
28
|
+
/**
|
|
29
|
+
* The bullet.
|
|
30
|
+
*
|
|
31
|
+
* Its own ladder rather than a step off `controlHeightClasses`, for the reason
|
|
32
|
+
* `tickSizeClasses` has one: a bullet is not a control you can put a label
|
|
33
|
+
* inside. It is a mark beside one, sized against the title next to it — which is
|
|
34
|
+
* why the steps are close to the tick ladder and not to the control ladder.
|
|
35
|
+
*
|
|
36
|
+
* It is written as a custom property rather than as a class because the
|
|
37
|
+
* connector has to know it: the line is centred on the bullet, and centring is
|
|
38
|
+
* arithmetic on this number.
|
|
39
|
+
*/
|
|
40
|
+
export declare const bulletSizeValues: Record<PlassSize, string>;
|
|
41
|
+
/** Between the bullet column and the content beside it. */
|
|
42
|
+
export declare const bulletGapClasses: Record<PlassSize, string>;
|
|
43
|
+
/**
|
|
44
|
+
* The bullet at each of the three states.
|
|
45
|
+
*
|
|
46
|
+
* Every one of them is a different axis, never a different opacity: `complete`
|
|
47
|
+
* is the family's gradient, `current` is that gradient with a halo of the soft
|
|
48
|
+
* tint around it, and `upcoming` is a hairline ring on the page's own surface. A
|
|
49
|
+
* reader who cannot tell the colours apart still has a filled shape, a haloed
|
|
50
|
+
* shape and an empty one.
|
|
51
|
+
*
|
|
52
|
+
* There is no gloss line on the two filled ones, for the reason a filled
|
|
53
|
+
* `PlButton` has none — the gradient is the form. The `upcoming` ring is drawn
|
|
54
|
+
* in the neutral hairline rather than the sheet's white one, the same call a
|
|
55
|
+
* checkbox's edge makes: a bullet is small enough that its edge *is* the object,
|
|
56
|
+
* and white light on a translucent pane disappears on a light card.
|
|
57
|
+
*/
|
|
58
|
+
export declare const bulletStatusClasses: Record<PlassStepStatus, string>;
|
|
59
|
+
/**
|
|
60
|
+
* The line *after* a step, which is what makes it the step's own property: a
|
|
61
|
+
* connector is coloured by whether the step it leaves has been reached, not by
|
|
62
|
+
* where it arrives.
|
|
63
|
+
*/
|
|
64
|
+
export declare const connectorColorClasses: Record<PlassStepStatus, string>;
|
|
65
|
+
export declare const connectorStyleClasses: Record<PlassStepConnector, string>;
|
|
66
|
+
export declare const titleStatusClasses: Record<PlassStepStatus, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Which of the three a step is, from where the sequence has got to.
|
|
69
|
+
*
|
|
70
|
+
* `active` is an **index**, not a value, because neither a timeline nor a
|
|
71
|
+
* stepper has a selection: everything before it is `complete`, the step at it is
|
|
72
|
+
* `current`, everything after it is `upcoming`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function statusAt(index: number, active: number | null): PlassStepStatus;
|
|
75
|
+
/** The slot family a step draws in, so the two components dye a rail alike. */
|
|
76
|
+
export type StepFamily = PlassColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const bulletSizeValues={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const bulletGapClasses={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const bulletStatusClasses={complete:"[background-image:var(--p-fill)] text-(--p-on-solid)",current:"[background-image:var(--p-fill)] text-(--p-on-solid) [box-shadow:0_0_0_0.25rem_var(--p-soft)]",upcoming:"border-2 bg-(--plass-surface) text-(--plass-muted-fg) [border-color:var(--plass-border)]"};export const connectorColorClasses={complete:"[border-color:var(--p-line-hover)]",current:"[border-color:var(--plass-border)]",upcoming:"[border-color:var(--plass-border)]"};export const connectorStyleClasses={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""};export const titleStatusClasses={complete:"text-(--plass-fg)",current:"text-(--p-accent)",upcoming:"text-(--plass-muted-fg)"};export function statusAt(e,o){return null===o?"upcoming":e<o?"complete":e===o?"current":"upcoming"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type PlColorScheme } from '../internal/color-scheme.js';
|
|
2
|
+
export interface PlColorSchemeScriptProps {
|
|
3
|
+
/** Must match the hook's. @default 'plass-color-scheme' */
|
|
4
|
+
storageKey?: string;
|
|
5
|
+
/** What to apply when nothing has been stored. Must match the hook's. @default 'system' */
|
|
6
|
+
defaultScheme?: PlColorScheme;
|
|
7
|
+
/** The `nonce` a strict Content Security Policy requires on an inline script. */
|
|
8
|
+
nonce?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Paints the reader's chosen theme before the first frame.
|
|
12
|
+
*
|
|
13
|
+
* Put it in `<head>`, above everything. It reads the stored choice and writes
|
|
14
|
+
* it onto `<html>` **synchronously**, while the parser is still in the head and
|
|
15
|
+
* before any content has been laid out — which is the only moment at which the
|
|
16
|
+
* white flash can be prevented. React runs long after that, so a theme applied
|
|
17
|
+
* from an effect is applied one paint too late, and the reader has already seen
|
|
18
|
+
* the wrong one.
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // app/layout.tsx
|
|
22
|
+
* <html suppressHydrationWarning>
|
|
23
|
+
* <head>
|
|
24
|
+
* <PlColorSchemeScript />
|
|
25
|
+
* </head>
|
|
26
|
+
* <body>{children}</body>
|
|
27
|
+
* </html>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* `suppressHydrationWarning` on `<html>` is the other half, and it is not a
|
|
31
|
+
* workaround: the script's whole job is to change that element before React
|
|
32
|
+
* hydrates, so React finding an attribute the server did not send is the thing
|
|
33
|
+
* working rather than failing.
|
|
34
|
+
*
|
|
35
|
+
* It renders nothing but a `<script>`, calls no hook and reads no context, so it
|
|
36
|
+
* stays a server component — the one place in this library where that matters
|
|
37
|
+
* most, since a client component here would arrive with the bundle and be too
|
|
38
|
+
* late by definition.
|
|
39
|
+
*/
|
|
40
|
+
export declare function PlColorSchemeScript({ storageKey, defaultScheme, nonce }: PlColorSchemeScriptProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{DEFAULT_STORAGE_KEY as t}from"../internal/color-scheme.js";function inlineScript(e,t){return`(function(){try{var k=${JSON.stringify(e)},d=${JSON.stringify(t)};var s=localStorage.getItem(k);if(s!=="light"&&s!=="dark"&&s!=="system"){s=d}var e=document.documentElement;e.classList.remove("light","dark");if(s==="system"){delete e.dataset.theme}else{e.dataset.theme=s;e.classList.add(s)}}catch(_){}})()`}export function PlColorSchemeScript({storageKey:s=t,defaultScheme:r="system",nonce:n}){return e("script",{nonce:n,dangerouslySetInnerHTML:{__html:inlineScript(s,r)}})}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassDefaults } from '../internal/defaults.js';
|
|
3
|
+
export interface PlassProviderProps extends PlassDefaults {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The defaults every Plass component under it starts from.
|
|
8
|
+
*
|
|
9
|
+
* Optional, and the library is finished without it — this is not a theme file
|
|
10
|
+
* to fill in before the first screen looks like something. What it removes is
|
|
11
|
+
* transcription: an application whose controls are `sm` says so once instead of
|
|
12
|
+
* at every call site, and a Korean application names its locale once instead of
|
|
13
|
+
* on five pickers.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <PlassProvider size="sm" density="compact" locale="ko-KR">
|
|
17
|
+
* <App />
|
|
18
|
+
* </PlassProvider>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* **It sets `size`, `color`, `density` and the date vocabulary, and it
|
|
22
|
+
* deliberately does not set `variant` or `elevation`.** Those two name what a
|
|
23
|
+
* surface is *made of* and how far off the page it sits, and both are decided
|
|
24
|
+
* per component by the design language rather than per application: a button is
|
|
25
|
+
* `solid` and rests on the sheet, a field is cut into it. One value for all of
|
|
26
|
+
* them would not be a default, it would be a flattening. `internal/defaults.ts`
|
|
27
|
+
* has the long version.
|
|
28
|
+
*
|
|
29
|
+
* Providers **nest and merge**, so a section of a page can be compact inside an
|
|
30
|
+
* application that is not, and a component's own prop always wins over both.
|
|
31
|
+
*
|
|
32
|
+
* **It also carries the reading direction**, and that one is not a default the
|
|
33
|
+
* caller sets — it is read off the document. `dir="rtl"` turns the layout over
|
|
34
|
+
* on its own, but Base UI reads the direction from a React context, so without
|
|
35
|
+
* this the arrow keys, the composite navigation and the popup alignment would
|
|
36
|
+
* all still be running left to right under a right-to-left page. See
|
|
37
|
+
* `internal/direction.ts`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function PlassProvider({ size, color, density, locale, weekStartsOn, labels, direction, children }: PlassProviderProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{DirectionProvider as i}from"@base-ui/react/direction-provider";import{DefaultsContext as t}from"../internal/defaults.js";import{useDocumentDirection as o}from"../internal/direction.js";export function PlassProvider({size:n,color:s,density:l,locale:c,weekStartsOn:a,labels:d,direction:m,children:u}){const f=r.useContext(t),p=r.useMemo(()=>({size:n??f.size,color:s??f.color,density:l??f.density,locale:c??f.locale,weekStartsOn:a??f.weekStartsOn,labels:d??f.labels,direction:m??f.direction}),[n,s,l,c,a,d,m,f]),b=o();return e(i,{direction:p.direction??b,children:e(t.Provider,{value:p,children:u})})}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PlColorSchemeScript } from './PlColorSchemeScript.js';
|
|
2
|
+
export type { PlColorSchemeScriptProps } from './PlColorSchemeScript.js';
|
|
3
|
+
export { PlassProvider } from './PlassProvider.js';
|
|
4
|
+
export type { PlassProviderProps } from './PlassProvider.js';
|
|
5
|
+
export { useDefaults as usePlassDefaults, type PlassDefaults } from '../internal/defaults.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlColorSchemeScript}from"./PlColorSchemeScript.js";export{PlassProvider}from"./PlassProvider.js";export{useDefaults as usePlassDefaults}from"../internal/defaults.js";
|