plass-ui 1.8.0 → 1.8.1
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 +11 -0
- package/README.md +1 -1
- package/dist/components/accordion/PlAccordion.d.ts +2 -0
- package/dist/components/alert/PlAlert.d.ts +2 -0
- package/dist/components/badge/PlBadge.d.ts +2 -0
- package/dist/components/blockquote/PlBlockquote.d.ts +2 -0
- package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +2 -0
- package/dist/components/box/PlBox.d.ts +2 -0
- package/dist/components/button/PlButton.d.ts +2 -0
- package/dist/components/button-group/PlButtonGroup.d.ts +2 -0
- package/dist/components/card/PlCard.d.ts +2 -0
- package/dist/components/carousel/PlCarousel.d.ts +2 -0
- package/dist/components/chip/PlChip.d.ts +2 -0
- package/dist/components/collapsible/PlCollapsible.d.ts +2 -0
- package/dist/components/color-picker/PlColorPicker.d.ts +2 -0
- package/dist/components/combobox/PlCombobox.d.ts +2 -0
- package/dist/components/confirm/PlConfirmProvider.js +1 -1
- package/dist/components/data-table/PlDataTable.d.ts +2 -0
- package/dist/components/file-picker/PlFilePicker.d.ts +2 -0
- package/dist/components/hot-keys/PlHotKeys.d.ts +4 -0
- package/dist/components/list/PlList.d.ts +2 -0
- package/dist/components/number-field/PlNumberField.d.ts +2 -0
- package/dist/components/otp-field/PlOtpField.d.ts +2 -0
- package/dist/components/pagination/PlPagination.d.ts +2 -0
- package/dist/components/pill/PlPill.d.ts +2 -0
- package/dist/components/scroll-zone/PlScrollZone.d.ts +2 -0
- package/dist/components/segmented-button/PlSegmentedButton.d.ts +6 -1
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
- package/dist/components/select/PlSelect.d.ts +2 -0
- package/dist/components/sidebar/PlSidebarTrigger.d.ts +2 -0
- package/dist/components/table/PlTable.d.ts +2 -0
- package/dist/components/text-field/PlTextField.d.ts +2 -0
- package/dist/components/toast/PlToast.d.ts +2 -0
- package/dist/components/toolbar/PlToolbar.d.ts +2 -0
- package/dist/components/transfer/PlTransfer.d.ts +2 -0
- package/dist/internal/chart-frame.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +4 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
## vNext (2026--)
|
|
6
6
|
|
|
7
|
+
## 1.8.1 (2026-10-09)
|
|
8
|
+
|
|
9
|
+
### Breaking changes
|
|
10
|
+
|
|
11
|
+
- **`PlConfirmProvider` asks its questions in an alert dialog.** `confirm` and `alert` open a `role="alertdialog"` rather than a `role="dialog"`, which is what WAI-ARIA calls a dialog that breaks into what the reader was doing and waits for an answer, so a screen reader announces the question as an alert. Its name, description, focus and dismissal are as before. A test that finds the question by its role, `getByRole('dialog')`, finds it as `getByRole('alertdialog')` now.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **A full-width `PlSegmentedButton` whose labels together need more than its row no longer runs out of its groove.** Each segment kept the width its label needs, so three long labels in a narrow row laid out wider than the row and ran past the end of the groove. The segments now shrink in proportion to what each needs and their labels end in an ellipsis, as the Flutter set's do; a row that has room shares its width as before. In a full-width set a label is now held in a `<span>` of its own.
|
|
16
|
+
- **An editor shows each component's own `variant` default.** `PlassStyleProps` documented `variant` as `'solid'`, so that is what an editor showed on every component that takes it, while most of them default to `'glass'`, `PlTextField`, `PlSelect`, `PlCard` and `PlDataTable` among them, and `PlPagination`, `PlBlockquote`, `PlSidebarTrigger` and the charts default to `'ghost'`. Each component's props now say its own default, and the shared comment says the default is the component's.
|
|
17
|
+
|
|
7
18
|
## 1.8.0 (2026-10-07)
|
|
8
19
|
|
|
9
20
|
### Breaking changes
|
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ The list also names two exports that are not counted, because each shares a fold
|
|
|
134
134
|
|
|
135
135
|
### Feedback
|
|
136
136
|
|
|
137
|
-
`PlAlert` · `PlConfirmProvider` · `PlDrawer` · `PlEmpty` · `PlMeter` · `PlModal` · `PlOverlay` · `PlPopconfirm` · `PlPopover` · `PlProgressBox` · `PlProgressCircular` · `PlProgressLinear` · `PlSkeleton` · `
|
|
137
|
+
`PlAlert` · `PlConfirmProvider` · `PlDrawer` · `PlEmpty` · `PlMeter` · `PlModal` · `PlOverlay` · `PlPopconfirm` · `PlPopover` · `PlProgressBox` · `PlProgressCircular` · `PlProgressLinear` · `PlSkeleton` · `PlToastProvider` · `PlTooltip` · `PlTour`
|
|
138
138
|
|
|
139
139
|
### Inputs
|
|
140
140
|
|
|
@@ -8,6 +8,8 @@ import type { PlassElevation, PlassHeadingLevel, PlassStyleProps } from '../../t
|
|
|
8
8
|
*/
|
|
9
9
|
export type PlAccordionHeadingLevel = PlassHeadingLevel;
|
|
10
10
|
export interface PlAccordionProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
11
|
+
/** @default 'glass' */
|
|
12
|
+
variant?: PlassStyleProps['variant'];
|
|
11
13
|
/**
|
|
12
14
|
* Drop shadow depth. `0` is the default — an accordion is part of the page it
|
|
13
15
|
* is set into, not a panel floating over it.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlAlertProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title'> {
|
|
4
|
+
/** @default 'glass' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/**
|
|
5
7
|
* Drop shadow depth. `0` is the default — an alert belongs to the flow of the
|
|
6
8
|
* page it interrupts. The one that floats above it is a dialog.
|
|
@@ -6,6 +6,8 @@ import type { PlassCorner, PlassElevation, PlassStyleProps } from '../../types.j
|
|
|
6
6
|
*/
|
|
7
7
|
export type PlBadgeOverlap = 'square' | 'circle';
|
|
8
8
|
export interface PlBadgeProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'span'>, 'color' | 'content'> {
|
|
9
|
+
/** @default 'solid' */
|
|
10
|
+
variant?: PlassStyleProps['variant'];
|
|
9
11
|
/**
|
|
10
12
|
* What the badge says — usually a count, sometimes a word.
|
|
11
13
|
*
|
|
@@ -7,6 +7,8 @@ import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
|
7
7
|
* an event handler written against one works on the other.
|
|
8
8
|
*/
|
|
9
9
|
export interface PlBlockquoteProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'figure'>, 'color'> {
|
|
10
|
+
/** @default 'ghost' */
|
|
11
|
+
variant?: PlassStyleProps['variant'];
|
|
10
12
|
/**
|
|
11
13
|
* Drop shadow depth. `0` is the default — a quote is set *into* a page rather
|
|
12
14
|
* than floating over it, so it is raised even less often than a `PlCard`.
|
|
@@ -16,6 +16,8 @@ export type PlBottomNavigationValue = string | number;
|
|
|
16
16
|
*/
|
|
17
17
|
export type PlBottomNavigationLabels = 'all' | 'selected' | 'none';
|
|
18
18
|
export interface PlBottomNavigationProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'nav'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
19
|
+
/** @default 'glass' */
|
|
20
|
+
variant?: PlassStyleProps['variant'];
|
|
19
21
|
/** The destination the reader is on. Use with `onValueChange` for a controlled bar. */
|
|
20
22
|
value?: PlBottomNavigationValue | null;
|
|
21
23
|
/** Which starts current, for an uncontrolled bar. */
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
4
4
|
export interface PlBoxProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
5
|
+
/** @default 'glass' */
|
|
6
|
+
variant?: PlassStyleProps['variant'];
|
|
5
7
|
/**
|
|
6
8
|
* Drop shadow depth. `0` is the default and it is flat — the glass edge is
|
|
7
9
|
* what separates the box from the page. Raise it only for a surface that
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
4
4
|
export interface PlButtonProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'button'>, 'color'> {
|
|
5
|
+
/** @default 'solid' */
|
|
6
|
+
variant?: PlassStyleProps['variant'];
|
|
5
7
|
/**
|
|
6
8
|
* Drop shadow depth. `1` is the default, because a moulded key **rests on**
|
|
7
9
|
* the sheet rather than lying flush with it. Hover adds a level and pressing
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassOrientation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlButtonGroupProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
4
|
+
/** @default 'solid' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/**
|
|
5
7
|
* Which way the buttons run. A vertical group is a stacked menu of equal
|
|
6
8
|
* actions; a horizontal one is the default because that is what a toolbar is.
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
4
4
|
export interface PlCardProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title'> {
|
|
5
|
+
/** @default 'glass' */
|
|
6
|
+
variant?: PlassStyleProps['variant'];
|
|
5
7
|
/**
|
|
6
8
|
* Drop shadow depth. `1` is the default: a card is a sheet lying **on** the
|
|
7
9
|
* page wash rather than printed into it, and the small amount of grey under
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlCarouselProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
4
|
+
/** @default 'glass' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/**
|
|
5
7
|
* Drop shadow depth of the frame. `0` — the default — is flat.
|
|
6
8
|
* @default 0
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlChipProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
4
|
+
/** @default 'glass' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/**
|
|
5
7
|
* Drop shadow depth. `0` is the default — a chip is a token sitting *on*
|
|
6
8
|
* something else, so it is raised even less often than a `PlButton`.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlCollapsibleProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'onChange'> {
|
|
4
|
+
/** @default 'glass' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/**
|
|
5
7
|
* Drop shadow depth. `0` is the default — a fold is part of the page it is set
|
|
6
8
|
* into, not a panel floating over it.
|
|
@@ -22,6 +22,8 @@ export interface PlColorPickerLabels {
|
|
|
22
22
|
/** The English the picker uses for the parts nobody can read a name off. */
|
|
23
23
|
export declare const defaultColorPickerLabels: PlColorPickerLabels;
|
|
24
24
|
export interface PlColorPickerProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
25
|
+
/** @default 'glass' */
|
|
26
|
+
variant?: PlassStyleProps['variant'];
|
|
25
27
|
/**
|
|
26
28
|
* The four parts of a labelled field, as every other one names them: the
|
|
27
29
|
* `label`, the `control`, the `description` and the `error`. `className`
|
|
@@ -25,6 +25,8 @@ export interface PlComboboxOption {
|
|
|
25
25
|
/** One value, or an array of them, depending on `multiple`. */
|
|
26
26
|
type Selection<Multiple extends boolean | undefined> = Multiple extends true ? PlComboboxValue[] : PlComboboxValue | null;
|
|
27
27
|
export interface PlComboboxProps<Multiple extends boolean | undefined = false> extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'children'> {
|
|
28
|
+
/** @default 'glass' */
|
|
29
|
+
variant?: PlassStyleProps['variant'];
|
|
28
30
|
/** Classes on the parts a `className` does not reach. */
|
|
29
31
|
classNames?: PlassFieldClassNames;
|
|
30
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{PlButton as o}from"../button/PlButton.js";import{useLabels as t}from"../../internal/labels.js";import{lazyPart as l}from"../../internal/lazy.js";const c=/* @__PURE__ */l(()=>import("../modal/PlModal.js").then(e=>e.PlModal));function ConfirmModal({open:r,...o}){const[t,l]=n.useState(!1);return n.useLayoutEffect(()=>{l(!0)},[]),e(c,{open:!0===r&&t,...o})}const i=/* @__PURE__ */n.createContext(null);export function PlConfirmProvider({size:l,color:s,confirmLabel:u,cancelLabel:a,acknowledgeLabel:f,width:d,children:m}){const h=t(),[p,w]=n.useState(!1),[C,b]=n.useState(null),v=n.useRef(null),k=n.useRef([]),P=n.useRef(0),z=n.useRef(null),j=n.useCallback(e=>{const r=v.current;if(!r)return;r.resolve(e);const n=k.current.shift();if(n)return v.current=n,void b(n);v.current=null,w(!1)},[]),x=n.useCallback((e,r)=>new Promise(n=>{P.current+=1;const o={id:P.current,kind:e,options:r,resolve:n};v.current?k.current.push(o):(v.current=o,b(o),w(!0))}),[]),E=n.useMemo(()=>({confirm:e=>x("confirm",e),alert:e=>x("alert",e).then(()=>{})}),[x]);n.useEffect(()=>function whenIdle(e){if("function"==typeof window.requestIdleCallback){const r=window.requestIdleCallback(e,{timeout:2e3});return()=>window.cancelIdleCallback(r)}const r=window.setTimeout(e,500);return()=>window.clearTimeout(r)}(c.preload),[]);const L=n.useCallback(()=>{const e=[v.current,...k.current];v.current=null,k.current=[],e.forEach(e=>e?.resolve(!1)),w(!1),b(null)},[]);n.useEffect(()=>()=>{v.current?.resolve(!1),k.current.forEach(e=>e.resolve(!1)),v.current=null,k.current=[]},[]);const g=C?.options,y="alert"===C?.kind,M="confirm"===(g?.initialFocus??"cancel")||y,R=n.useRef(!1);n.useLayoutEffect(()=>{p&&R.current&&z.current?.focus(),R.current=p},[p,C]);const I=C?e(n.Suspense,{fallback:null,children:e(ConfirmModal,{open:p,onUnavailable:L,onOpenChange:e=>{e||j(!1)},showClose:!1,role:"alertdialog",initialFocus:z,size:g?.size??l,color:g?.color??s,width:g?.width??d,dismissible:g?.dismissible??!0,title:g?.title,description:g?.description,actions:r(n.Fragment,{children:[y?null:e(o,{ref:M?void 0:z,variant:"ghost",color:"secondary",size:g?.size??l,onClick:()=>j(!1),children:g?.cancelLabel??a??h.cancel}),e(o,{ref:M?z:void 0,color:g?.color??s,size:g?.size??l,onClick:()=>j(!0),children:g?.confirmLabel??(y?f??h.acknowledge:u??h.confirm)})]},C?.id),children:g?.children})}):null;return r(i.Provider,{value:E,children:[m,I]})}export function usePlConfirm(){const e=n.useContext(i);if(!e)throw new Error("[plass-ui] usePlConfirm was called outside a <PlConfirmProvider>.");return e}
|
|
@@ -91,6 +91,8 @@ export interface PlDataTableColumn<Row> {
|
|
|
91
91
|
unsearchable?: boolean;
|
|
92
92
|
}
|
|
93
93
|
export interface PlDataTableProps<Row> extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onSelect'> {
|
|
94
|
+
/** @default 'glass' */
|
|
95
|
+
variant?: PlassStyleProps['variant'];
|
|
94
96
|
/**
|
|
95
97
|
* Drop shadow depth. `0` is the default — a table is a grid set into the page
|
|
96
98
|
* rather than a panel floating over it.
|
|
@@ -16,6 +16,8 @@ export interface PlFileBatch {
|
|
|
16
16
|
source: 'drop' | 'dialog';
|
|
17
17
|
}
|
|
18
18
|
export interface PlFilePickerProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'title' | 'children'> {
|
|
19
|
+
/** @default 'glass' */
|
|
20
|
+
variant?: PlassStyleProps['variant'];
|
|
19
21
|
/**
|
|
20
22
|
* Drop shadow depth. `0` is the default — a dropzone is cut into the page
|
|
21
23
|
* rather than floating over it.
|
|
@@ -17,6 +17,8 @@ export interface PlHotKeysCluster {
|
|
|
17
17
|
right: string;
|
|
18
18
|
}
|
|
19
19
|
export interface PlHotKeysProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'span'>, 'color' | 'children'> {
|
|
20
|
+
/** @default 'glass' */
|
|
21
|
+
variant?: PlassStyleProps['variant'];
|
|
20
22
|
/**
|
|
21
23
|
* The keys, innermost punctuation and all.
|
|
22
24
|
*
|
|
@@ -54,6 +56,8 @@ export interface PlHotKeysProps extends PlassStyleProps, Omit<React.ComponentPro
|
|
|
54
56
|
elevation?: PlassElevation;
|
|
55
57
|
}
|
|
56
58
|
export interface PlKbdProps extends Pick<PlassStyleProps, 'variant' | 'size' | 'density'>, Omit<React.ComponentPropsWithoutRef<'kbd'>, 'color'> {
|
|
59
|
+
/** @default 'glass' */
|
|
60
|
+
variant?: PlassStyleProps['variant'];
|
|
57
61
|
children?: React.ReactNode;
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
4
4
|
export interface PlListProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'ul'>, 'color'> {
|
|
5
|
+
/** @default 'glass' */
|
|
6
|
+
variant?: PlassStyleProps['variant'];
|
|
5
7
|
/**
|
|
6
8
|
* Drop shadow depth. `0` is the default — a list is a sheet lying flat, not a
|
|
7
9
|
* key resting on one.
|
|
@@ -15,6 +15,8 @@ import type { PlassElevation, PlassFieldClassNames, PlassHotKeys, PlassFieldLabe
|
|
|
15
15
|
*/
|
|
16
16
|
export type PlNumberFieldSteppers = 'end' | 'split' | 'none';
|
|
17
17
|
export interface PlNumberFieldProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'children'> {
|
|
18
|
+
/** @default 'glass' */
|
|
19
|
+
variant?: PlassStyleProps['variant'];
|
|
18
20
|
/** Classes on the parts a `className` does not reach. */
|
|
19
21
|
classNames?: PlassFieldClassNames;
|
|
20
22
|
/**
|
|
@@ -9,6 +9,8 @@ import type { PlassElevation, PlassFieldClassNames, PlassHotKeys, PlassStyleProp
|
|
|
9
9
|
*/
|
|
10
10
|
export type PlOtpCharset = 'numeric' | 'alpha' | 'alphanumeric' | 'any';
|
|
11
11
|
export interface PlOtpFieldProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange' | 'children'> {
|
|
12
|
+
/** @default 'glass' */
|
|
13
|
+
variant?: PlassStyleProps['variant'];
|
|
12
14
|
/** Classes on the parts a `className` does not reach. */
|
|
13
15
|
classNames?: PlassFieldClassNames;
|
|
14
16
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlPaginationProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'nav'>, 'color' | 'onChange'> {
|
|
4
|
+
/** @default 'ghost' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/** How many pages there are. Fewer than two and the whole control renders nothing. */
|
|
5
7
|
count: number;
|
|
6
8
|
/** The current page, 1-based. Use with `onPageChange` for a controlled row. */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PlassElevation, PlassPosition, PlassStyleProps } from '../../types.js';
|
|
3
3
|
export interface PlPillProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onClick' | 'title'> {
|
|
4
|
+
/** @default 'solid' */
|
|
5
|
+
variant?: PlassStyleProps['variant'];
|
|
4
6
|
/**
|
|
5
7
|
* Drop shadow depth. `2` here, against the `0` almost everything else takes.
|
|
6
8
|
*
|
|
@@ -48,6 +48,8 @@ export type PlScrollZoneMode = 'item' | 'page' | 'hold';
|
|
|
48
48
|
*/
|
|
49
49
|
export type PlScrollZoneButtonPlacement = 'inline' | 'overlay';
|
|
50
50
|
export interface PlScrollZoneProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
51
|
+
/** @default 'glass' */
|
|
52
|
+
variant?: PlassStyleProps['variant'];
|
|
51
53
|
/**
|
|
52
54
|
* Which way the children run, and therefore which way the zone scrolls.
|
|
53
55
|
* @default 'horizontal'
|
|
@@ -33,7 +33,12 @@ export interface PlSegmentedButtonProps extends Omit<PlassStyleProps, 'variant'>
|
|
|
33
33
|
readOnly?: boolean;
|
|
34
34
|
/** Identifies the value when a form is submitted. */
|
|
35
35
|
name?: string;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The segments share the full width, an equal part each. A segment whose
|
|
38
|
+
* label needs more than its part keeps the width it needs, and the others
|
|
39
|
+
* share the rest. Labels that together need more than the row end in an
|
|
40
|
+
* ellipsis.
|
|
41
|
+
*/
|
|
37
42
|
fullWidth?: boolean;
|
|
38
43
|
children?: React.ReactNode;
|
|
39
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useCommitChange as s}from"../../internal/commit-change.js";import{controlNaming as
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useCommitChange as s}from"../../internal/commit-change.js";import{controlNaming as l,useDisabled as r}from"../../internal/form.js";import{glowPointerMove as n}from"../../internal/glow.js";import{useDefaults as o}from"../../internal/defaults.js";import{Radio as i}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{controlHeightClasses as c,controlSlots as u,controlTextClasses as p,focusRingInsetClasses as f,forcedCheckedTextClasses as h,forcedFieldEdgeClasses as m,forcedFillClasses as g,gapClasses as v,glassClasses as b,hasContent as y,iconClasses as x,paddingXClasses as w,transitionClasses as k}from"../../internal/styles.js";const j=/* @__PURE__ */a.createContext({variant:"glass",size:"md",density:"default",fullWidth:!1,overfull:!1,disabled:!1,readOnly:!1}),R={solid:`${b} bg-(--plass-glass-press) p-1 [box-shadow:var(--p-elev),var(--plass-well)] ${m}`,glass:`${b} border bg-(--plass-glass) p-1 [border-color:var(--plass-glass-line)] [box-shadow:var(--p-elev),var(--plass-well)]`,ghost:""},P={solid:"plass-fill data-[placed]:[--p-fill-on:1] [box-shadow:var(--plass-shadow-1),var(--p-lift)]",glass:`${b} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`,ghost:`${b} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`},S={solid:"data-[checked]:text-(--p-on-solid)",glass:"data-[checked]:text-(--p-accent)",ghost:"data-[checked]:text-(--p-accent)"};export const PlSegment=/* @__PURE__ */a.forwardRef(function PlSegment({value:s,startIcon:l,endIcon:o,disabled:d=!1,className:u,children:m,onPointerMove:g,...b},R){const{variant:P,size:A,density:C,fullWidth:$,overfull:N,disabled:W,readOnly:z}=a.useContext(j),O=r(d),B=!O&&!W&&!z;return t(i.Root,{ref:R,value:s,disabled:O,"data-segment":"",className:["relative z-10 inline-flex cursor-pointer items-center justify-center select-none","font-semibold whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",c[A],p[A],v[A],w[C][A],"rounded-full",k,x,B?"plass-glow":"","not-data-[checked]:[--p-glow:var(--p-soft)]","not-data-[checked]:[--p-flash:var(--p-soft-hover)]","text-(--plass-muted-fg) not-data-[checked]:not-data-[disabled]:not-data-[readonly]:hover:text-(--plass-fg)",S[P],h,f,"data-[disabled]:cursor-not-allowed",W?"":"data-[disabled]:opacity-50","data-[readonly]:cursor-default",$?N?"min-w-0 flex-[1_1_auto]":"flex-1 shrink-0":"shrink-0",u??""].filter(Boolean).join(" "),onPointerMove:n(B,g),...b,children:[y(l)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:l}):null,$?e("span",{"data-segment-label":"",className:"min-w-0 truncate",children:m}):m,y(o)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:o}):null]})});export const PlSegmentedButton=/* @__PURE__ */a.forwardRef(function PlSegmentedButton({variant:n="glass",size:i,color:c,density:p,elevation:f=0,value:h,defaultValue:m=null,onValueChange:v,disabled:b=!1,readOnly:y=!1,name:x,fullWidth:w=!1,className:S,style:A,children:C,"aria-label":$,"aria-labelledby":N,...W},z){const O=o(),B=r(b),F=i??O.size??"md",q=c??O.color??"primary",E=p??O.density??"default",[M,V]=a.useState(m),I=void 0!==h,L=I?h:M,_=a.useRef(null),G=a.useRef(null),[H,T]=a.useState(!1),D=a.useCallback(()=>{const e=_.current;if(!e||!w)return void T(!1);const t=getComputedStyle(e),a=e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);let s=0;e.querySelectorAll("[data-segment]").forEach(e=>{const t=e.querySelector("[data-segment-label]");s+=e.getBoundingClientRect().width+(t?Math.max(0,t.scrollWidth-t.clientWidth):0)}),T(s>a+1)},[w]),J=a.useRef(!1);a.useEffect(()=>{J.current=!0},[]);const K=a.useRef(0),Q=a.useCallback(e=>{G.current=e,e&&!J.current&&e.setAttribute("data-placed","")},[]),U=a.useCallback(e=>{const t=_.current,a=G.current;if(!t||!a)return;const s=t.querySelector("[data-segment][data-checked]");if(!s)return;const l=s.offsetLeft,r=s.offsetTop,n=s.offsetWidth,o=s.offsetHeight,i=!e||!a.hasAttribute("data-ready");i&&(cancelAnimationFrame(K.current),a.removeAttribute("data-ready")),a.style.setProperty("--p-seg-x",`${l}px`),a.style.setProperty("--p-seg-y",`${r}px`),a.style.setProperty("--p-seg-w",`${n}px`),a.style.setProperty("--p-seg-h",`${o}px`),a.setAttribute("data-placed",""),i&&(K.current=requestAnimationFrame(()=>{a.setAttribute("data-ready","")}))},[]);a.useEffect(()=>()=>cancelAnimationFrame(K.current),[]),s(_,[L,n,F,E,w],()=>{D(),U(!0)},G),a.useEffect(()=>{const e=_.current;if(!e)return;const t=new ResizeObserver(()=>{D(),U(!1)});return t.observe(e),()=>t.disconnect()},[D,U]);const X=a.useMemo(()=>({variant:n,size:F,density:E,fullWidth:w,overfull:H,disabled:B,readOnly:y}),[n,F,E,w,H,B,y]);return e(j.Provider,{value:X,children:t(d,{ref:e=>{_.current=e,"function"==typeof z?z(e):z&&(z.current=e)},value:L,onValueChange:e=>{const t=e??null;I||V(t),v?.(t)},disabled:B,readOnly:y,name:x,className:["relative inline-flex items-center rounded-full",R[n],k,y?"saturate-[0.55]":"",B?"opacity-50 saturate-[0.35]":"",w?"flex w-full":"",S??""].filter(Boolean).join(" "),style:{...u(q,f,n),...A},...l($,N),...W,children:[null!=L?e("span",{ref:Q,"aria-hidden":"true",className:["pointer-events-none absolute rounded-full","top-(--p-seg-y) left-(--p-seg-x) h-(--p-seg-h) w-(--p-seg-w)",P[n],g,"[transition-property:left,top,width,height]","[transition-timing-function:var(--plass-ease)]","[transition-duration:0ms] motion-safe:data-[ready]:[transition-duration:var(--plass-duration)]"].join(" ")}):null,C]})})});
|
|
@@ -19,6 +19,8 @@ export interface PlSelectOption {
|
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
}
|
|
21
21
|
export interface PlSelectProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'children'> {
|
|
22
|
+
/** @default 'glass' */
|
|
23
|
+
variant?: PlassStyleProps['variant'];
|
|
22
24
|
/** Classes on the parts a `className` does not reach. */
|
|
23
25
|
classNames?: PlassFieldClassNames;
|
|
24
26
|
/**
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { type PlIconButtonProps } from '../icon-button/PlIconButton.js';
|
|
3
3
|
import type { PlPageLayoutCollapse, PlassSidebarSide } from '../../internal/page-layout.js';
|
|
4
4
|
export interface PlSidebarTriggerProps extends Omit<PlIconButtonProps, 'icon' | 'label'> {
|
|
5
|
+
/** @default 'ghost' */
|
|
6
|
+
variant?: PlIconButtonProps['variant'];
|
|
5
7
|
/** Which of the layout's two sidebars it opens. @default 'start' */
|
|
6
8
|
side?: PlassSidebarSide;
|
|
7
9
|
/**
|
|
@@ -38,6 +38,8 @@ export interface PlTableColumn<Row> {
|
|
|
38
38
|
render?: (row: Row, index: number) => React.ReactNode;
|
|
39
39
|
}
|
|
40
40
|
export interface PlTableProps<Row> extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
41
|
+
/** @default 'glass' */
|
|
42
|
+
variant?: PlassStyleProps['variant'];
|
|
41
43
|
/**
|
|
42
44
|
* Drop shadow depth. `0` is the default — a table is a grid set into the page
|
|
43
45
|
* rather than a panel floating over it.
|
|
@@ -9,6 +9,8 @@ export type PlTextFieldResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
|
9
9
|
*/
|
|
10
10
|
type NativeControlProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'color' | 'size' | 'onChange' | 'children'>;
|
|
11
11
|
export interface PlTextFieldProps extends PlassStyleProps, NativeControlProps {
|
|
12
|
+
/** @default 'glass' */
|
|
13
|
+
variant?: PlassStyleProps['variant'];
|
|
12
14
|
/** Classes on the parts a `className` does not reach. */
|
|
13
15
|
classNames?: PlassFieldClassNames;
|
|
14
16
|
/**
|
|
@@ -61,6 +61,8 @@ export interface PlToastOptions extends PlToastData {
|
|
|
61
61
|
onRemove?: () => void;
|
|
62
62
|
}
|
|
63
63
|
export interface PlToastProviderProps extends Pick<PlassStyleProps, 'variant' | 'size' | 'density'> {
|
|
64
|
+
/** @default 'glass' */
|
|
65
|
+
variant?: PlassStyleProps['variant'];
|
|
64
66
|
/** The default colour family. A single toast overrides it in `add`. */
|
|
65
67
|
color?: PlassColor;
|
|
66
68
|
/** @default 'bottom-end' */
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import type { PlassElevation, PlassPosition, PlassStyleProps } from '../../types.js';
|
|
4
4
|
export interface PlToolbarProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
5
|
+
/** @default 'glass' */
|
|
6
|
+
variant?: PlassStyleProps['variant'];
|
|
5
7
|
/**
|
|
6
8
|
* Drop shadow depth. `0` — the default — is flat even when the bar is pinned:
|
|
7
9
|
* a shadow under a header is a way of saying "there is content beneath this",
|
|
@@ -10,6 +10,8 @@ export interface PlTransferItem {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export interface PlTransferProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
13
|
+
/** @default 'glass' */
|
|
14
|
+
variant?: PlassStyleProps['variant'];
|
|
13
15
|
/** Everything that can be on either side, in the order the lists show it. */
|
|
14
16
|
items: readonly PlTransferItem[];
|
|
15
17
|
/** What is on the trailing side. Use with `onValueChange` for a controlled pair. */
|
|
@@ -107,6 +107,8 @@ declare function givenHeight(height: number | string | undefined, ladder: number
|
|
|
107
107
|
*/
|
|
108
108
|
export declare const markTransitionClasses: string;
|
|
109
109
|
export interface ChartBaseProps extends Omit<PlBoxProps, 'children' | 'title'> {
|
|
110
|
+
/** @default 'ghost' */
|
|
111
|
+
variant?: PlBoxProps['variant'];
|
|
110
112
|
/**
|
|
111
113
|
* How tall the drawing is. A number is pixels; a string is any CSS length.
|
|
112
114
|
* Defaults to the `size` ladder.
|