@apliteni/apliteni-ui 0.47.0 → 0.49.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/package.json +1 -1
- package/react/README.md +27 -1
- package/react/dist/index.css +13 -0
- package/react/dist/index.d.ts +25 -1
- package/react/dist/index.js +336 -207
- package/src/components/index.js +4 -2
- package/src/styles/callout.css +3 -0
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -28,7 +28,7 @@ import '@apliteni/apliteni-ui/react/css'; // React components' shell styles (mo
|
|
|
28
28
|
import { DataTable, Modal, Button } from '@apliteni/apliteni-ui/react';
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Components: `DataTable`, `Pagination`, `StatBand`, `Modal`, `Confirm`, `Drawer`, `CommandPalette`, `Dropdown`, `BackLink`, `Snippet`, `Tabs`, `Button`, `Badge`, `Card`, `Icon`.
|
|
31
|
+
Components: `DataTable`, `Pagination`, `StatBand`, `Modal`, `Confirm`, `Drawer`, `CommandPalette`, `Dropdown`, `BackLink`, `Snippet`, `Tabs`, `Button`, `Badge`, `Card`, `Callout`, `Icon`.
|
|
32
32
|
|
|
33
33
|
`Snippet` accepts `label`, `code`, `reveal`, and `copyLabel` props. It treats `code`
|
|
34
34
|
as plain text and copies it exactly as provided. After a successful clipboard write,
|
|
@@ -42,6 +42,15 @@ can try again or select the text manually.
|
|
|
42
42
|
Before a reveal snippet, explain that the secret is stored hashed and will not be
|
|
43
43
|
shown again, and ask the reader to copy it now. The page decides when to remove it.
|
|
44
44
|
|
|
45
|
+
`Callout` accepts `children`, optional `actions`, and an `icon` override. `neutral` is the default.
|
|
46
|
+
The other variants are `info`, `success`, `warn`, and `danger`. Only `danger` uses `role="alert"`.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<Callout variant="warn" actions={<Button size="sm">Review period</Button>}>
|
|
50
|
+
<b>Incomplete.</b> This period is still open.
|
|
51
|
+
</Callout>
|
|
52
|
+
```
|
|
53
|
+
|
|
45
54
|
`Button` accepts `size="xs" | "sm" | "md" | "lg"` (default `md`). Use `xs`
|
|
46
55
|
for a small inline control: `<Button size="xs" variant="ghost" icon="copy" iconOnly>Copy</Button>`.
|
|
47
56
|
Its glyph is 13px and its icon-only target is 24×24px; labelled xs buttons use
|
|
@@ -407,3 +416,20 @@ native control props. `SelectField` accepts option children.
|
|
|
407
416
|
`FileField` accepts one file from a picker or a drop and reports it through
|
|
408
417
|
`onFileChange`. Use `accept` and `hint` to describe allowed file types and size.
|
|
409
418
|
Your application must validate files before upload.
|
|
419
|
+
|
|
420
|
+
## Toast
|
|
421
|
+
|
|
422
|
+
Wrap your app in `Toast`, then call `useToast()` inside it to add a notice.
|
|
423
|
+
Pass `title`, optional `text`, and a `tone`: success (default), danger, warn, info,
|
|
424
|
+
or neutral. Notices disappear after five seconds, pausing while hovered or focused.
|
|
425
|
+
Danger notices are announced assertively; other tones are polite. An `action` with a `label` and
|
|
426
|
+
`onClick` stays until selected or dismissed. New notices appear at the bottom.
|
|
427
|
+
|
|
428
|
+
```tsx
|
|
429
|
+
function SaveButton() {
|
|
430
|
+
const push = useToast();
|
|
431
|
+
return <Button onClick={() => push({ title: 'Saved', text: 'Your changes were saved.' })}>Save</Button>;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
<Toast><SaveButton /></Toast>
|
|
435
|
+
```
|
package/react/dist/index.css
CHANGED
|
@@ -512,3 +512,16 @@
|
|
|
512
512
|
.ui-file.is-disabled .ui-file__input {
|
|
513
513
|
cursor: not-allowed;
|
|
514
514
|
}
|
|
515
|
+
|
|
516
|
+
/* src/Toast.css */
|
|
517
|
+
.rx-toast-stack {
|
|
518
|
+
position: fixed;
|
|
519
|
+
right: var(--space-4);
|
|
520
|
+
bottom: var(--space-4);
|
|
521
|
+
max-width: calc(100% - 2 * var(--space-4));
|
|
522
|
+
z-index: var(--z-toast);
|
|
523
|
+
pointer-events: none;
|
|
524
|
+
}
|
|
525
|
+
.rx-toast-stack > .ui-toast {
|
|
526
|
+
pointer-events: auto;
|
|
527
|
+
}
|
package/react/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,15 @@ declare function Card({ title, sub, level, children }: {
|
|
|
41
41
|
children?: ReactNode;
|
|
42
42
|
}): react.JSX.Element;
|
|
43
43
|
|
|
44
|
+
type CalloutVariant = 'neutral' | 'info' | 'success' | 'warn' | 'danger';
|
|
45
|
+
interface CalloutProps {
|
|
46
|
+
variant?: CalloutVariant;
|
|
47
|
+
icon?: string;
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
actions?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
declare function Callout({ variant, icon, children, actions }: CalloutProps): react.JSX.Element;
|
|
52
|
+
|
|
44
53
|
type StatTone = 'good' | 'bad' | 'neutral';
|
|
45
54
|
type StatVariant = 'band' | 'tiles' | 'open';
|
|
46
55
|
interface StatDelta {
|
|
@@ -526,7 +535,22 @@ type FileFieldProps = FieldMessage & Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
526
535
|
};
|
|
527
536
|
declare function FileField({ label, hint, error, required, disabled, onFileChange, className, ...props }: FileFieldProps): react.JSX.Element;
|
|
528
537
|
|
|
538
|
+
type ToastNotice = {
|
|
539
|
+
tone?: 'success' | 'danger' | 'warn' | 'info' | 'neutral';
|
|
540
|
+
title: string;
|
|
541
|
+
text?: string;
|
|
542
|
+
action?: {
|
|
543
|
+
label: string;
|
|
544
|
+
onClick: () => void;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
type ToastProps = {
|
|
548
|
+
children: ReactNode;
|
|
549
|
+
};
|
|
550
|
+
declare function useToast(): (notice: ToastNotice) => void;
|
|
551
|
+
declare function Toast({ children }: ToastProps): react.JSX.Element;
|
|
552
|
+
|
|
529
553
|
declare const PAGE_SIZES: readonly number[];
|
|
530
554
|
declare const DEFAULT_PAGE_SIZE: number;
|
|
531
555
|
|
|
532
|
-
export { BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonProps, Card, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, Confirm, type ConfirmProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, FileField, type FileFieldProps, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, RowIdentity, type RowIdentityProps, type SegmentOption, Segmented, type SegmentedProps, SelectField, type SelectFieldProps, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, Snippet, type SnippetProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, type TabItem, type TableSort, Tabs, type TabsProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Timeline, type TimelineEvent, type TimelineProps, sortTableRows };
|
|
556
|
+
export { BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonProps, Callout, type CalloutProps, type CalloutVariant, Card, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, Confirm, type ConfirmProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, FileField, type FileFieldProps, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, RowIdentity, type RowIdentityProps, type SegmentOption, Segmented, type SegmentedProps, SelectField, type SelectFieldProps, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, Snippet, type SnippetProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, type TabItem, type TableSort, Tabs, type TabsProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Timeline, type TimelineEvent, type TimelineProps, Toast, type ToastNotice, type ToastProps, sortTableRows, useToast };
|