strata-react 0.1.16 → 1.0.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.
Files changed (43) hide show
  1. package/README.md +14 -11
  2. package/dist/components/async-button.d.ts +15 -3
  3. package/dist/components/button.d.ts +17 -7
  4. package/dist/components/checkbox.d.ts +3 -3
  5. package/dist/components/commands.d.ts +104 -0
  6. package/dist/components/composition.d.ts +1 -1
  7. package/dist/components/data-table.d.ts +16 -3
  8. package/dist/components/data-view.d.ts +12 -1
  9. package/dist/components/dialog.d.ts +45 -0
  10. package/dist/components/field.d.ts +3 -1
  11. package/dist/components/infinite-list.d.ts +35 -2
  12. package/dist/components/job-status.d.ts +36 -0
  13. package/dist/components/popover.d.ts +20 -0
  14. package/dist/components/selection.d.ts +1 -1
  15. package/dist/components/switch.d.ts +14 -0
  16. package/dist/components/thumbnail.d.ts +17 -7
  17. package/dist/components/toggle.d.ts +43 -0
  18. package/dist/components/toolbar.d.ts +15 -0
  19. package/dist/components/tooltip.d.ts +19 -0
  20. package/dist/index.d.ts +17 -7
  21. package/dist/index.js +1380 -355
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/chords.d.ts +20 -0
  24. package/dist/lib/errors.d.ts +28 -4
  25. package/dist/lib/format.d.ts +57 -6
  26. package/dist/lib/overlay.d.ts +1 -0
  27. package/dist/lib/utils.d.ts +1 -1
  28. package/dist/query/index.d.ts +13 -4
  29. package/dist/query/job.d.ts +22 -0
  30. package/dist/{query-BlPgaCBG.js → query-BVh4zv7Y.js} +146 -41
  31. package/dist/query-BVh4zv7Y.js.map +1 -0
  32. package/dist/{run-N6Juz-kN.js → run-DFf1BBA3.js} +13 -3
  33. package/dist/run-DFf1BBA3.js.map +1 -0
  34. package/dist/strata.css +17 -0
  35. package/dist/testing/buttons.d.ts +7 -0
  36. package/dist/testing/index.d.ts +1 -0
  37. package/dist/testing.js +31 -2
  38. package/dist/testing.js.map +1 -1
  39. package/dist/visual-cli.js +1 -1
  40. package/dist/visual.js +1 -1
  41. package/package.json +8 -7
  42. package/dist/query-BlPgaCBG.js.map +0 -1
  43. package/dist/run-N6Juz-kN.js.map +0 -1
@@ -0,0 +1,43 @@
1
+ import { IconComponent } from '../lib/icon';
2
+ import * as React from "react";
3
+ declare const sizes: {
4
+ readonly default: "h-(--control-h)";
5
+ readonly sm: "h-(--control-h-sm)";
6
+ };
7
+ type Size = keyof typeof sizes;
8
+ /** Props for `Toggle`. */
9
+ export type ToggleProps = {
10
+ /** The name, always. Shown as the text unless `icon` is given with `iconOnly`, then it is the accessible name and the tooltip. */
11
+ label: string;
12
+ icon?: IconComponent;
13
+ /** Show only the icon; `label` stays the name and tooltip. */
14
+ iconOnly?: boolean;
15
+ pressed?: boolean;
16
+ defaultPressed?: boolean;
17
+ onChange?: (pressed: boolean) => void;
18
+ disabled?: boolean;
19
+ size?: Size;
20
+ className?: string;
21
+ };
22
+ /** A button that is pressed or not (`aria-pressed`). Chosen reads as an ink border on a tint, never as the filled primary. */
23
+ export declare function Toggle({ label, icon, iconOnly, pressed, defaultPressed, onChange, disabled, size, className }: ToggleProps): React.JSX.Element;
24
+ /** One option of a `ToggleGroup`. */
25
+ export type ToggleOption = {
26
+ value: string;
27
+ label: string;
28
+ icon?: IconComponent;
29
+ iconOnly?: boolean;
30
+ };
31
+ /** Props for `ToggleGroup`. */
32
+ export type ToggleGroupProps = {
33
+ /** Names the group for screen readers: "Preview quality". Required. */
34
+ label: string;
35
+ options: readonly ToggleOption[];
36
+ value: string;
37
+ onChange: (value: string) => void;
38
+ size?: Size;
39
+ className?: string;
40
+ };
41
+ /** A single-choice set of toggle buttons for 2 to 7 short options that switch a view. One is always chosen; arrow keys move between them. */
42
+ export declare function ToggleGroup({ label, options, value, onChange, size, className }: ToggleGroupProps): React.JSX.Element;
43
+ export {};
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ /** Props for `Toolbar`. */
3
+ export type ToolbarProps = {
4
+ /** Names the toolbar for screen readers: "Preview options". Required. */
5
+ label: string;
6
+ orientation?: "horizontal" | "vertical";
7
+ children: React.ReactNode;
8
+ className?: string;
9
+ };
10
+ /** A group of controls with one tab stop and arrow-key movement (the WAI-ARIA toolbar pattern). Needs a `label`. */
11
+ export declare function Toolbar({ label, orientation, children, className }: ToolbarProps): React.JSX.Element;
12
+ /** A hairline between groups of controls inside a `Toolbar`. */
13
+ export declare function ToolbarSeparator({ className }: {
14
+ className?: string;
15
+ }): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ /** Props for `Tooltip`. */
3
+ export type TooltipProps = {
4
+ /** The words: a control's name or one sentence about it. Not interactive. */
5
+ label: React.ReactNode;
6
+ /** A shortcut or other aside shown after the label, muted ("Ctrl+Z"). */
7
+ hint?: React.ReactNode;
8
+ /** The element that gets the tip. It must be a React Aria pressable or focusable (a Strata `Button` is). */
9
+ children: React.ReactElement;
10
+ /** Which side of the trigger it prefers; it flips when there is no room. Default `top`. */
11
+ side?: "top" | "right" | "bottom" | "left";
12
+ /** Milliseconds before it opens on hover. Focus opens it at once. Default 500. */
13
+ delay?: number;
14
+ /** A controlled open state, for a story or test that needs it shown. */
15
+ open?: boolean;
16
+ className?: string;
17
+ };
18
+ /** A hover-and-focus tooltip for a control, portalled above everything. Words only; not the only home of information. */
19
+ export declare function Tooltip({ label, hint, children, side, delay, open, className }: TooltipProps): React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -6,25 +6,35 @@
6
6
  * @module strata-react
7
7
  */
8
8
  export { cn, typeSteps } from './lib/utils';
9
- export { createFormat, format, NBSP, toDate, type ByteUnit, type DateFormatter, type DateInput, type Format, type FormatOptions, type NumberFormatter } from './lib/format';
9
+ export { createFormat, format, NBSP, MISSING, toDate, type ByteUnit, type CountOptions, type DateFormatter, type DateInput, type Format, type FormatOptions, type NumberFormatter, } from './lib/format';
10
+ export { useInView, type InViewOptions } from './lib/in-view';
10
11
  export type { IconComponent } from './lib/icon';
11
12
  export { Button, IconButton, RowAction, buttonVariants, type ButtonProps, type IconButtonProps, type RowActionProps, } from './components/button';
13
+ export { Menu, ContextMenu, CommandMenu, CommandLegend, useCommands, commandShortcut, labelOf, type Command, type MenuEntry, type MenuProps, type ContextMenuProps, type CommandMenuProps, type CommandsOptions, } from './components/commands';
14
+ export { formatChord, matchesChord, parseChord, isReservedChord, detectPlatform, type Platform } from './lib/chords';
15
+ export { Toolbar, ToolbarSeparator, type ToolbarProps } from './components/toolbar';
16
+ export { Toggle, ToggleGroup, type ToggleProps, type ToggleGroupProps, type ToggleOption } from './components/toggle';
17
+ export { Switch, type SwitchProps } from './components/switch';
18
+ export { Dialog, AlertDialog, type DialogProps, type AlertDialogProps } from './components/dialog';
19
+ export { Popover, type PopoverProps } from './components/popover';
20
+ export { Tooltip, type TooltipProps } from './components/tooltip';
12
21
  export { Checkbox, type CheckboxProps, type CheckboxGesture } from './components/checkbox';
13
- export { AsyncButton, useAsyncAction, type Phase, type AsyncLabels, type AsyncAction, type AsyncActionOptions } from './components/async-button';
22
+ export { AsyncButton, useAsyncAction, type Phase, type AsyncLabels, type AsyncAction, type AsyncActionOptions, type FieldErrors, } from './components/async-button';
14
23
  export { Field, Input, Textarea, NativeSelect, ChoiceGroup, type FieldProps, type Choice } from './components/field';
15
24
  export { Status, type Tone } from './components/status';
16
25
  export { Metric, MetricStrip, type MetricProps } from './components/metric';
17
26
  export { Meter, crossedThreshold, type MeterProps, type MeterThreshold } from './components/meter';
18
27
  export { CompositionBar, type CompositionBarProps, type CompositionPart } from './components/composition';
19
28
  export { LinkCard, LinkCardList, type LinkCardProps } from './components/link-card';
20
- export { DataView, EmptyState, Skeleton, StaleNotice, type Load, type Stale } from './components/data-view';
29
+ export { DataView, EmptyState, LoadError, Skeleton, StaleNotice, type Load, type LoadFailure, type Stale } from './components/data-view';
30
+ export { JobStatus, type JobStatusProps, type JobFailure, type JobWords } from './components/job-status';
21
31
  export { Thumbnail, ThumbnailSkeleton, type ThumbnailProps, type AspectRatio } from './components/thumbnail';
22
- export { DataTable, TableSkeleton, parseSort, serialiseSort, type Column, type Sort, type DataTableProps, type RowSelection, type RowExpansion, } from './components/data-table';
32
+ export { DataTable, TableSkeleton, parseSort, serialiseSort, type CellValue, type Column, type Sort, type DataTableProps, type RowSelection, type RowExpansion, } from './components/data-table';
23
33
  export { Disclosure, useExpanded, type DisclosureProps, type DisclosureOpenProps, type Expanded, type ExpandedOptions } from './components/disclosure';
24
34
  export { BulkBar, useSelection, type InitialSelection } from './components/selection';
25
35
  export { SelectableGrid, type SelectableGridProps, type TileAspect, type TileSize, } from './components/selectable-grid';
26
36
  export { VirtualList } from './components/virtual-list';
27
- export { InfiniteList, type InfiniteListProps } from './components/infinite-list';
37
+ export { InfiniteList, LoadMore, type InfiniteListProps, type LoadMoreProps } from './components/infinite-list';
28
38
  export { LineChart, type LineChartProps, type Point } from './components/line-chart';
29
39
  export { PageHeader } from './components/page-header';
30
40
  export { UndoBar, useUndoable, type PendingRemoval, type FailedRemoval, type Undoable, type UndoableOptions, } from './components/undo';
@@ -34,5 +44,5 @@ export { Tabs, type TabItem } from './components/tabs';
34
44
  export { useHotkeys, KeysLegend, isTypingTarget, type Shortcut } from './components/hotkeys';
35
45
  export { useActiveItem, ActiveList, type ActiveItem } from './components/active-list';
36
46
  export { ThemeProvider, useColorScheme, useSystemColorScheme, ColorSchemeChoice, colorSchemeScript, COLOR_SCHEME_STORAGE_KEY, type ColorScheme, type ColorSchemePreference, type ColorSchemeLabels, type ColorSchemeState, } from './components/theme';
37
- export { StrataQueryProvider, createQueryClient, toLoad, staleOf, useLoad, useInfiniteLoad, fetchJson, HttpError, describeHttpError, type DescribeError, type InfiniteLoad, type InfiniteLoadOptions, type More, } from './query';
38
- export { describeActionError } from './lib/errors';
47
+ export { StrataQueryProvider, createQueryClient, toLoad, staleOf, useLoad, useInfiniteLoad, useJob, fetchJson, HttpError, describeHttpError, readErrorBody, type DescribeError, type ErrorBody, type FetchJsonOptions, type InfiniteLoad, type InfiniteLoadOptions, type Job, type JobOptions, type More, } from './query';
48
+ export { describeActionError, fieldErrorsOf } from './lib/errors';