@apliteni/apliteni-ui 0.59.0 → 0.61.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 +34 -5
- package/react/dist/index.css +4 -0
- package/react/dist/index.d.ts +40 -4
- package/react/dist/index.js +272 -224
- package/src/styles/input.css +14 -0
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -7,9 +7,10 @@ This directory is a **private workspace**, not a package. It builds to `react/di
|
|
|
7
7
|
and ships as the `@apliteni/apliteni-ui/react` subpath of the kit — one package, one
|
|
8
8
|
version, one pin. There is no `@apliteni/apliteni-ui-react` on npm.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
Use React components for new React screens. The vanilla factories are deprecated
|
|
11
|
+
and scheduled for removal under #429. This version still ships them, working as
|
|
12
|
+
before: keep existing vanilla surfaces on them, and move a surface to React when
|
|
13
|
+
you next change it.
|
|
13
14
|
|
|
14
15
|
## Install (as a consumer)
|
|
15
16
|
|
|
@@ -28,7 +29,19 @@ import '@apliteni/apliteni-ui/react/css'; // React components' shell styles (mo
|
|
|
28
29
|
import { DataTable, Modal, Button } from '@apliteni/apliteni-ui/react';
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
Components: `EmptyState`, `DataTable`, `Pagination`, `StatBand`, `Modal`, `Confirm`, `Drawer`, `CommandPalette`, `Dropdown`, `BackLink`, `Tooltip`, `Snippet`, `Tabs`, `Button`, `Badge`, `Card`, `Callout`, `Icon`.
|
|
32
|
+
Components: `EmptyState`, `DataTable`, `Pagination`, `StatBand`, `Modal`, `Confirm`, `Drawer`, `CommandPalette`, `Dropdown`, `BackLink`, `Tooltip`, `Snippet`, `Tabs`, `Button`, `Badge`, `Pill`, `StatusDot`, `Card`, `Callout`, `Icon`.
|
|
33
|
+
|
|
34
|
+
`Pill` renders metadata with the existing pill spacing. Omit `variant` for neutral
|
|
35
|
+
metadata or use `live` or `soon`. Its children accept React content.
|
|
36
|
+
`StatusDot` takes `live` (default `false`). Place it beside visible status text;
|
|
37
|
+
it is decorative by default. Use `aria-label` or `aria-labelledby` to expose a
|
|
38
|
+
meaningful dot as a named image. Neither component announces changes automatically.
|
|
39
|
+
Both forward a span ref and native span attributes, including `className`.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<Pill variant="soon">Coming soon</Pill>
|
|
43
|
+
<span><StatusDot live /> API online</span>
|
|
44
|
+
```
|
|
32
45
|
|
|
33
46
|
`Snippet` accepts `label`, `code`, `reveal`, and `copyLabel` props. It treats `code`
|
|
34
47
|
as plain text and copies it exactly as provided. After a successful clipboard write,
|
|
@@ -420,7 +433,10 @@ Import both the kit CSS and React CSS. The Privileged story shows Undo adding a
|
|
|
420
433
|
|
|
421
434
|
`TextField`, `TextArea`, `SelectField`, and `FileField` pair a label with a native
|
|
422
435
|
control. Each creates its own IDs and links hints or errors automatically. Use
|
|
423
|
-
native control props. `SelectField` accepts option children.
|
|
436
|
+
native control props. `SelectField` accepts option children. `TextField` takes
|
|
437
|
+
text, number, email, password and search, forwards its ref to the input, and
|
|
438
|
+
places a decorative kit glyph with `icon` — the same glyph names `Button` and
|
|
439
|
+
`Dropdown` take. Number fields can combine a glyph with a `unit`.
|
|
424
440
|
|
|
425
441
|
```tsx
|
|
426
442
|
<TextField label="Weight" type="number" unit="kg" required />
|
|
@@ -434,6 +450,19 @@ native control props. `SelectField` accepts option children.
|
|
|
434
450
|
`onFileChange`. Use `accept` and `hint` to describe allowed file types and size.
|
|
435
451
|
Your application must validate files before upload.
|
|
436
452
|
|
|
453
|
+
Use `Field` when an existing labelled control needs the kit frame. Spread its
|
|
454
|
+
render-prop attributes onto one labelable control, and apply the existing control
|
|
455
|
+
class and invalid styling as appropriate:
|
|
456
|
+
|
|
457
|
+
```tsx
|
|
458
|
+
<Field label="Due date" hint="Use the delivery date." required>
|
|
459
|
+
{control => <input {...control} className="ui-input" type="date" />}
|
|
460
|
+
</Field>
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
The frame supplies a stable ID, required state, and linked hint/error messages.
|
|
464
|
+
An optional `id` lets the caller choose the control ID; it must be unique.
|
|
465
|
+
|
|
437
466
|
## Toast
|
|
438
467
|
|
|
439
468
|
Wrap your app in `Toast`, then call `useToast()` inside it to add a notice.
|
package/react/dist/index.css
CHANGED
package/react/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, ButtonHTMLAttributes, RefObject, MouseEvent, ElementType, ComponentPropsWithoutRef, InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { ReactNode, ButtonHTMLAttributes, HTMLAttributes, RefObject, MouseEvent, ElementType, ComponentPropsWithoutRef, InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
declare function Icon({ name }: {
|
|
5
5
|
name: string;
|
|
@@ -37,6 +37,20 @@ declare function Badge({ variant, children }: {
|
|
|
37
37
|
children: ReactNode;
|
|
38
38
|
}): react.JSX.Element;
|
|
39
39
|
|
|
40
|
+
type PillProps = HTMLAttributes<HTMLSpanElement> & {
|
|
41
|
+
variant?: 'live' | 'soon';
|
|
42
|
+
};
|
|
43
|
+
declare const Pill: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
|
|
44
|
+
variant?: "live" | "soon";
|
|
45
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
46
|
+
|
|
47
|
+
type StatusDotProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
|
|
48
|
+
live?: boolean;
|
|
49
|
+
};
|
|
50
|
+
declare const StatusDot: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
51
|
+
live?: boolean;
|
|
52
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
53
|
+
|
|
40
54
|
type Level = 2 | 3 | 4 | 5 | 6;
|
|
41
55
|
declare function Card({ title, sub, level, children }: {
|
|
42
56
|
title?: ReactNode;
|
|
@@ -532,11 +546,33 @@ type FieldMessage = {
|
|
|
532
546
|
error?: string;
|
|
533
547
|
};
|
|
534
548
|
type Wiring = 'id' | 'aria-describedby' | 'aria-invalid';
|
|
549
|
+
type FieldControlProps = {
|
|
550
|
+
id: string;
|
|
551
|
+
'aria-describedby'?: string;
|
|
552
|
+
'aria-invalid'?: true;
|
|
553
|
+
required?: boolean;
|
|
554
|
+
};
|
|
555
|
+
type FieldProps = FieldMessage & {
|
|
556
|
+
id?: string;
|
|
557
|
+
required?: boolean;
|
|
558
|
+
children: (control: FieldControlProps) => ReactNode;
|
|
559
|
+
};
|
|
560
|
+
/** Spread the supplied attributes onto one labelable control. */
|
|
561
|
+
declare function Field({ id: suppliedId, label, hint, error, required, children }: FieldProps): react.JSX.Element;
|
|
535
562
|
type TextFieldProps = FieldMessage & Omit<InputHTMLAttributes<HTMLInputElement>, Wiring | 'type'> & {
|
|
536
|
-
type?: 'text' | 'number' | 'email';
|
|
563
|
+
type?: 'text' | 'number' | 'email' | 'password' | 'search';
|
|
537
564
|
unit?: string;
|
|
565
|
+
/** Kit glyph name, as Button, Dropdown and vanilla input() take it. Decorative;
|
|
566
|
+
the label supplies the control's name. */
|
|
567
|
+
icon?: string;
|
|
538
568
|
};
|
|
539
|
-
declare
|
|
569
|
+
declare const TextField: react.ForwardRefExoticComponent<FieldMessage & Omit<InputHTMLAttributes<HTMLInputElement>, "type" | Wiring> & {
|
|
570
|
+
type?: "text" | "number" | "email" | "password" | "search";
|
|
571
|
+
unit?: string;
|
|
572
|
+
/** Kit glyph name, as Button, Dropdown and vanilla input() take it. Decorative;
|
|
573
|
+
the label supplies the control's name. */
|
|
574
|
+
icon?: string;
|
|
575
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
540
576
|
type TextAreaProps = FieldMessage & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, Wiring>;
|
|
541
577
|
declare function TextArea({ label, hint, error, required, className, ...props }: TextAreaProps): react.JSX.Element;
|
|
542
578
|
type SelectFieldProps = FieldMessage & Omit<SelectHTMLAttributes<HTMLSelectElement>, Wiring>;
|
|
@@ -626,4 +662,4 @@ declare function Tooltip({ text, children }: TooltipProps): react.JSX.Element;
|
|
|
626
662
|
declare const PAGE_SIZES: readonly number[];
|
|
627
663
|
declare const DEFAULT_PAGE_SIZE: number;
|
|
628
664
|
|
|
629
|
-
export { AppShell, type AppShellProps, type AppShellSection, 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, EmptyState, type EmptyStateProps, type EmptyStateVariant, 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, THEME_INIT_SCRIPT, type TabItem, type TableSort, Tabs, type TabsProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemeToggle, type ThemeToggleProps, Timeline, type TimelineEvent, type TimelineEventKind, type TimelineProps, Toast, type ToastNotice, type ToastProps, Tooltip, type TooltipProps, sortTableRows, useToast };
|
|
665
|
+
export { AppShell, type AppShellProps, type AppShellSection, 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, EmptyState, type EmptyStateProps, type EmptyStateVariant, Field, type FieldControlProps, type FieldProps, 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, Pill, type PillProps, 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, StatusDot, type StatusDotProps, THEME_INIT_SCRIPT, type TabItem, type TableSort, Tabs, type TabsProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemeToggle, type ThemeToggleProps, Timeline, type TimelineEvent, type TimelineEventKind, type TimelineProps, Toast, type ToastNotice, type ToastProps, Tooltip, type TooltipProps, sortTableRows, useToast };
|