@cboxdk/cbox-ui 0.13.0 → 0.14.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/README.md +3 -3
- package/dist/index.d.ts +24 -13
- package/dist/index.js +284 -264
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/controls.css +43 -25
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
Button,
|
|
82
82
|
Field,
|
|
83
83
|
Input,
|
|
84
|
-
|
|
84
|
+
Sheet,
|
|
85
85
|
} from '@cboxdk/cbox-ui';
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -113,7 +113,7 @@ Match id's existing patterns — see id/resources/js/pages/* for examples.
|
|
|
113
113
|
| `KeyValue` / `KeyValueList` | Definition-list style "label → value" for detail panels. |
|
|
114
114
|
| `Heading` | Section heading without the panel chrome. |
|
|
115
115
|
|
|
116
|
-
### Form controls and the
|
|
116
|
+
### Form controls and the sheet
|
|
117
117
|
|
|
118
118
|
Plain CSS in `tokens/controls.css` (`cbx-ui-*` classes in `@layer components`), which the
|
|
119
119
|
`@cboxdk/cbox-ui/tokens` import already brings; `@cboxdk/cbox-ui/controls.css` alone is there for
|
|
@@ -130,7 +130,7 @@ below 768px so iOS does not zoom. The few words the components say themselves ("
|
|
|
130
130
|
| `Checkbox` | A native checkbox drawn on the tokens with its label (and an optional `hint`) beside it. `checked` may be `'indeterminate'`. 16px box, 24px target. |
|
|
131
131
|
| `RadioGroup` | A labelled group of native radios: arrow keys move, Tab enters at the checked one. Options take a `hint` and `disabled`; `labelHidden` keeps the question for screen readers only. |
|
|
132
132
|
| `Switch` | An immediate on/off (`role="switch"`). Named by its `Field`, or `aria-label`. A setting that waits for Save is a `Checkbox`. |
|
|
133
|
-
| `
|
|
133
|
+
| `Sheet` / `SheetClose` / `useSheetClose` | A modal sheet portalled to `<body>`, never a centred modal: a panel sliding in from the right from 768px (`size` sm / md / lg: 26, 30 or 44rem wide), a bottom sheet on a phone that drags down to close. `title`, `description`, `footer`. Focus moves in (to `autoFocus` / `data-autofocus`, else the first field, else Close, never a footer action), Tab stays inside, the page behind is `inert` and does not scroll, Escape / Close / the scrim close it (`dismissible={false}` keeps the scrim from closing it), and focus goes back to the opener. `SheetClose` is a Button that closes the sheet it is in. `Dialog` / `DialogClose` / `useDialogClose` are deprecated aliases that render the same sheet. |
|
|
134
134
|
| `Spinner` | The indeterminate progress ring. Silent by default; `label` makes it a live status. |
|
|
135
135
|
|
|
136
136
|
### Charts
|
package/dist/index.d.ts
CHANGED
|
@@ -1522,28 +1522,29 @@ type CheckboxProps = {
|
|
|
1522
1522
|
*/
|
|
1523
1523
|
declare function Checkbox({ checked, onCheckedChange, label, hint, disabled, required, name, value, id: statedId, className }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
1524
1524
|
|
|
1525
|
-
type
|
|
1526
|
-
type
|
|
1525
|
+
type SheetSize = 'sm' | 'md' | 'lg';
|
|
1526
|
+
type SheetProps = {
|
|
1527
1527
|
open: boolean;
|
|
1528
1528
|
onOpenChange: (open: boolean) => void;
|
|
1529
1529
|
title: ReactNode;
|
|
1530
|
-
/** One sentence on what the
|
|
1530
|
+
/** One sentence on what the sheet is for. Read out with the title when it opens. */
|
|
1531
1531
|
description?: ReactNode;
|
|
1532
1532
|
/** The buttons, right-aligned in a footer that stays in view. Cancel first, the action last. */
|
|
1533
1533
|
footer?: ReactNode;
|
|
1534
|
-
/**
|
|
1535
|
-
size?:
|
|
1536
|
-
/** Clicking the scrim
|
|
1534
|
+
/** The panel's width on a wide screen: 26rem, 30rem (default) or 44rem. A phone's sheet is full width. */
|
|
1535
|
+
size?: SheetSize;
|
|
1536
|
+
/** Clicking the scrim (or dragging the phone's sheet down) closes it (default). Off for a form that would lose typed work. */
|
|
1537
1537
|
dismissible?: boolean;
|
|
1538
1538
|
className?: string;
|
|
1539
1539
|
children?: ReactNode;
|
|
1540
1540
|
};
|
|
1541
|
-
/** Closes the
|
|
1542
|
-
declare function
|
|
1543
|
-
/** A Button that closes the
|
|
1544
|
-
declare function
|
|
1541
|
+
/** Closes the sheet it is inside (for a footer button that should not need the caller's state). */
|
|
1542
|
+
declare function useSheetClose(): () => void;
|
|
1543
|
+
/** A Button that closes the sheet it is inside, then runs its own `onClick`. Defaults to `ghost`. */
|
|
1544
|
+
declare function SheetClose({ onClick, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
1545
1545
|
/**
|
|
1546
|
-
* A modal
|
|
1546
|
+
* A modal sheet: a panel sliding in from the right on a wide screen, a bottom sheet on a phone that
|
|
1547
|
+
* drags down to close. Cbox never centres a modal over the page; forms and confirmations open here.
|
|
1547
1548
|
*
|
|
1548
1549
|
* - Focus moves in on open: to an element marked `autoFocus` or `data-autofocus`, else the first
|
|
1549
1550
|
* field in the body, else the close button (never a destructive footer action).
|
|
@@ -1556,7 +1557,17 @@ declare function DialogClose({ onClick, ...props }: ButtonProps): react_jsx_runt
|
|
|
1556
1557
|
*
|
|
1557
1558
|
* The close button's name ("Close") goes through the host's translator.
|
|
1558
1559
|
*/
|
|
1559
|
-
declare function
|
|
1560
|
+
declare function Sheet({ open, onOpenChange, title, description, footer, size, dismissible, className, children }: SheetProps): react.ReactPortal | null;
|
|
1561
|
+
/** @deprecated Use `Sheet`; a Dialog is a Sheet (Cbox never centres a modal). */
|
|
1562
|
+
declare const Dialog: typeof Sheet;
|
|
1563
|
+
/** @deprecated Use `SheetClose`. */
|
|
1564
|
+
declare const DialogClose: typeof SheetClose;
|
|
1565
|
+
/** @deprecated Use `useSheetClose`. */
|
|
1566
|
+
declare const useDialogClose: typeof useSheetClose;
|
|
1567
|
+
/** @deprecated Use `SheetProps`. */
|
|
1568
|
+
type DialogProps = SheetProps;
|
|
1569
|
+
/** @deprecated Use `SheetSize`. */
|
|
1570
|
+
type DialogSize = SheetSize;
|
|
1560
1571
|
|
|
1561
1572
|
type FieldControlProps = Partial<{
|
|
1562
1573
|
id: string;
|
|
@@ -1920,4 +1931,4 @@ declare function Sparkline({ values, color, width, height }: {
|
|
|
1920
1931
|
height?: number;
|
|
1921
1932
|
}): react_jsx_runtime.JSX.Element | null;
|
|
1922
1933
|
|
|
1923
|
-
export { APP_HUES, AppContent, type AppKey, AppShell, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, CboxAppIcon, type CboxAppIconProps, type CboxAppKey, type CboxAppLink, CboxBrand, type CboxBrandProps, type CboxIdContextValue, CboxIdProvider, CboxKnownApp, CboxLocalizationProvider, type CboxNotificationPreviewItem, type CboxNotificationsState, type CboxOrganization, CboxServiceMark, type CboxServiceMarkProps, CboxShell, type CboxShellProps, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, Checkbox, type CheckboxProps, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextItem, type ContextLevel, type ContextTone, CreateField, CreateForm, CreateRefField, CreateSubmit, DataPanel, Dialog, DialogClose, type DialogProps, type DialogSize, EmptyState, Field, type FieldControlProps, type FieldProps, Heading, type HelpArticle, type HelpState, type HelpStore, type InboxState, type InferUrlState, Input, type InputProps, KeyValue, KeyValueList, type ListPage, type NavArea, type NavPage, PageHeader, type PageIntent, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, type PaletteAction, type PaletteRecord, PanelBody, RadioGroup, type RadioGroupProps, type RadioOption, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SHELL_ICONS, SectionHeader, type Shell, type ShellAccount, type Link as ShellActionLink, type ShellApp, type ShellBanner, type ShellCatalogState, type ShellCreatable, type ShellCreate, type ShellCreateForm, type ShellCreated, type ShellHelp, type ShellHelpArticle, type ShellIcon, type ShellLinkComponent, type ShellNavigate, type ShellNotifications, type ShellOption, type ShellPreferenceChange, type ShellPreferences, type ShellRecordSearch, type ShellRenderCreate, type ShellTheme, Sparkline, Spinner, type SpinnerProps, StatTile, StatusPill, type SupportUpdate, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, Switch, type SwitchBody, type SwitchProps, Textarea, type TextareaProps, type Transport, type UrlField, type UrlSchema, applyTheme, buildUrlSearch, buttonClassName, cn, contextTrail, createHelpStore, defineUrlSchema, environmentFor, groupItems, hueFor, initialsOf, interpolate, isLive, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, quickEnvironments, settingsHref, switchBody, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useDialogClose, useFieldControl, useKnownAppCatalog, useShellCreate, useShellHelp, useShellPageTitle, withQuery };
|
|
1934
|
+
export { APP_HUES, AppContent, type AppKey, AppShell, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, CboxAppIcon, type CboxAppIconProps, type CboxAppKey, type CboxAppLink, CboxBrand, type CboxBrandProps, type CboxIdContextValue, CboxIdProvider, CboxKnownApp, CboxLocalizationProvider, type CboxNotificationPreviewItem, type CboxNotificationsState, type CboxOrganization, CboxServiceMark, type CboxServiceMarkProps, CboxShell, type CboxShellProps, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, Checkbox, type CheckboxProps, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextItem, type ContextLevel, type ContextTone, CreateField, CreateForm, CreateRefField, CreateSubmit, DataPanel, Dialog, DialogClose, type DialogProps, type DialogSize, EmptyState, Field, type FieldControlProps, type FieldProps, Heading, type HelpArticle, type HelpState, type HelpStore, type InboxState, type InferUrlState, Input, type InputProps, KeyValue, KeyValueList, type ListPage, type NavArea, type NavPage, PageHeader, type PageIntent, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, type PaletteAction, type PaletteRecord, PanelBody, RadioGroup, type RadioGroupProps, type RadioOption, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SHELL_ICONS, SectionHeader, Sheet, SheetClose, type SheetProps, type SheetSize, type Shell, type ShellAccount, type Link as ShellActionLink, type ShellApp, type ShellBanner, type ShellCatalogState, type ShellCreatable, type ShellCreate, type ShellCreateForm, type ShellCreated, type ShellHelp, type ShellHelpArticle, type ShellIcon, type ShellLinkComponent, type ShellNavigate, type ShellNotifications, type ShellOption, type ShellPreferenceChange, type ShellPreferences, type ShellRecordSearch, type ShellRenderCreate, type ShellTheme, Sparkline, Spinner, type SpinnerProps, StatTile, StatusPill, type SupportUpdate, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, Switch, type SwitchBody, type SwitchProps, Textarea, type TextareaProps, type Transport, type UrlField, type UrlSchema, applyTheme, buildUrlSearch, buttonClassName, cn, contextTrail, createHelpStore, defineUrlSchema, environmentFor, groupItems, hueFor, initialsOf, interpolate, isLive, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, quickEnvironments, settingsHref, switchBody, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useDialogClose, useFieldControl, useKnownAppCatalog, useSheetClose, useShellCreate, useShellHelp, useShellPageTitle, withQuery };
|