altitude-design 0.1.0 → 0.2.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/README.md +18 -3
- package/dist/altitude.css +28 -1
- package/dist/altitude.iife.js +5 -3
- package/dist/altitude.no-fonts.css +1659 -0
- package/dist/fonts.css +1 -0
- package/dist/index.cjs +205 -70
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +205 -70
- package/dist/index.js.map +4 -4
- package/dist/types/command.d.ts +5 -1
- package/dist/types/core.d.ts +23 -2
- package/dist/types/empty.d.ts +24 -0
- package/dist/types/index.d.ts +9 -1
- package/package.json +11 -1
package/dist/types/command.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export interface CommandPaletteProps {
|
|
|
38
38
|
empty?: React.ReactNode | ((query: string) => React.ReactNode);
|
|
39
39
|
/** The letter that opens and closes the palette with ⌘ (macOS) or Ctrl. Default 'k'; false for none. */
|
|
40
40
|
shortcut?: string | false;
|
|
41
|
+
/** The query, controlled. The palette never clears it on opening: the caller owns it, e.g. a persistent field handing over what was typed. */
|
|
42
|
+
query?: string;
|
|
43
|
+
/** What the query is each time the palette opens, uncontrolled. Default ''. */
|
|
44
|
+
defaultQuery?: string;
|
|
41
45
|
onQueryChange?: (query: string) => void;
|
|
42
46
|
/** Close once an item is chosen. Default true. */
|
|
43
47
|
closeOnSelect?: boolean;
|
|
@@ -56,4 +60,4 @@ export declare function commandScore(text: string, query: string): number;
|
|
|
56
60
|
* as it does for Dialog. The query field is an opening built like Input; one highlight glides between results;
|
|
57
61
|
* when results change, surviving rows travel to their new places and new ones rise in, a few at a time.
|
|
58
62
|
*/
|
|
59
|
-
export declare function CommandPalette({ items, open, defaultOpen, onOpenChange, onSelect, placeholder, filter, empty, shortcut, onQueryChange, closeOnSelect, hints, className, ...rest }: CommandPaletteProps): React.JSX.Element | null;
|
|
63
|
+
export declare function CommandPalette({ items, open, defaultOpen, onOpenChange, onSelect, placeholder, filter, empty, shortcut, query: queryProp, defaultQuery, onQueryChange, closeOnSelect, hints, className, ...rest }: CommandPaletteProps): React.JSX.Element | null;
|
package/dist/types/core.d.ts
CHANGED
|
@@ -43,14 +43,35 @@ export declare const contrast: (a: string, b: string) => number;
|
|
|
43
43
|
* every surface passed) and `accent-soft` (a tint of the ground).
|
|
44
44
|
*/
|
|
45
45
|
export declare function deriveAccent(accent: string, surfaces: string[]): React.CSSProperties;
|
|
46
|
-
|
|
46
|
+
declare const SURFACES: readonly ["surface-trench", "surface-well", "surface-ground", "surface-raised", "surface-lifted", "surface-floating", "surface-overlay", "surface-modal"];
|
|
47
|
+
export type SchemeColorToken = typeof SURFACES[number] | 'ink' | 'ink-muted' | 'ink-faint' | 'line' | 'line-control' | 'accent' | 'on-accent' | 'accent-ink' | 'accent-soft' | 'positive' | 'positive-soft' | 'caution' | 'caution-soft' | 'critical' | 'critical-soft' | 'on-critical' | 'presence-1' | 'presence-2' | 'presence-3' | 'on-presence' | 'scrim';
|
|
48
|
+
export type SchemeShadowToken = 'trench' | 'well' | 'elev-0' | 'elev-1' | 'elev-2' | 'elev-3' | 'elev-4' | 'elev-5' | 'lip-top' | 'lip-bottom';
|
|
49
|
+
/**
|
|
50
|
+
* Check a scheme against the invariants every scheme keeps: the surfaces climb in lightness (trench < well < ground
|
|
51
|
+
* < raised ≤ … ≤ modal) and text, control edges and presence colours hold their contrast on every surface. Pass the
|
|
52
|
+
* colour tokens by name (without `--`), or an element to read them from. Returns one sentence per problem; [] passes.
|
|
53
|
+
* Only hex values can be measured; any other value of a checked token is reported.
|
|
54
|
+
*/
|
|
55
|
+
export declare function checkScheme(colors: Partial<Record<SchemeColorToken, string>> | Element): string[];
|
|
56
|
+
export interface CustomScheme {
|
|
57
|
+
/** Stamped as data-scheme on the provider's root. */
|
|
58
|
+
name: string;
|
|
59
|
+
/** The built-in scheme your tokens are laid over: any token you leave out comes from it, and so does light or dark
|
|
60
|
+
* handling (casts, rims, walls). Use nightfall or alpine for a dark scheme. Default 'daylight'. */
|
|
61
|
+
base?: BuiltInScheme;
|
|
62
|
+
/** Colour and shadow tokens by name, without `--`. */
|
|
63
|
+
tokens: Partial<Record<SchemeColorToken | SchemeShadowToken, string>>;
|
|
64
|
+
}
|
|
65
|
+
export type BuiltInScheme = 'daylight' | 'nightfall' | 'mesa' | 'alpine';
|
|
66
|
+
/** A built-in scheme, the name of your own [data-theme="…"] block, or a CustomScheme. */
|
|
67
|
+
export type Scheme = BuiltInScheme | (string & {});
|
|
47
68
|
type Ctx = {
|
|
48
69
|
host: HTMLElement | null;
|
|
49
70
|
pushLayer: () => () => void;
|
|
50
71
|
};
|
|
51
72
|
export declare const useAltitude: () => Ctx | null;
|
|
52
73
|
export interface AltitudeProviderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
53
|
-
scheme?: Scheme;
|
|
74
|
+
scheme?: Scheme | CustomScheme;
|
|
54
75
|
accent?: string;
|
|
55
76
|
motion?: 'system' | 'full' | 'reduced';
|
|
56
77
|
/** 'more' renders elevation as hard, high-contrast slabs (offset = height). 'system' follows prefers-contrast. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface EmptyStateProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
|
|
3
|
+
/** A line icon, drawn in ink-muted: 24px, or 18px at size sm. */
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
/** What is empty, as a statement: "No gift ideas yet". It names the region. */
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
/** Why it's empty, or what will appear here. Linked as the region's description. */
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
/** The one obvious next step: usually a primary Button. */
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
/** A quieter alternative beside it: usually a ghost Button or a link. */
|
|
12
|
+
secondary?: React.ReactNode;
|
|
13
|
+
/** md fills a page or a panel; sm fits a widget or a list. Default 'md'. */
|
|
14
|
+
size?: 'sm' | 'md';
|
|
15
|
+
/** The title's heading level. Default 3. */
|
|
16
|
+
headingLevel?: 2 | 3 | 4;
|
|
17
|
+
/** Say it politely when it appears, for an empty that follows a change (a filter, a search). true says the title, if it's text; a string says that. */
|
|
18
|
+
announce?: boolean | string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An opening the first record will fill. Nothing here yet is a well cut into the page (not a raised card, not an
|
|
22
|
+
* alert), with a dashed rim, a title that names what's empty and one next action standing in it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function EmptyState({ icon, title, description, action, secondary, size, headingLevel, announce, className, children, ...rest }: EmptyStateProps): React.JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* altitude-design: a React component library where height is the interface.
|
|
3
|
+
* Docs and live previews: https://richlaconte.github.io/altitude/
|
|
4
|
+
* Bugs, feature requests and new components: https://github.com/richlaconte/altitude/issues/new/choose
|
|
5
|
+
* Agents: you may file issues too; see https://github.com/richlaconte/altitude/blob/main/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export { AltitudeProvider, useAltitude, useDepth, useApproach, riseDelay, Layer, Surface, Kbd, Icons, Spinner, deriveAccent, contrast, checkScheme, usePresence } from './core';
|
|
8
|
+
export type { Scheme, BuiltInScheme, CustomScheme, SchemeColorToken, SchemeShadowToken } from './core';
|
|
2
9
|
export { Button, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Input, Textarea, Field, Checkbox, RadioGroup, Radio, Switch, Tabs, TabsList, TabsTrigger, TabsContent, Slider, Progress, Badge, Avatar, AvatarGroup, Skeleton, Alert, AlertStack, Accordion, HoldButton, ScrollArea, DropZone, SortableList, } from './controls';
|
|
3
10
|
export { Pile } from './pile';
|
|
4
11
|
export { Tooltip, HoverCard, Popover, DropdownMenu, Dialog, Toaster, toast } from './overlays';
|
|
@@ -7,4 +14,5 @@ export { Sheet, SheetHeader, SheetTitle, SheetDescription, SheetFooter } from '.
|
|
|
7
14
|
export { CommandPalette, commandScore } from './command';
|
|
8
15
|
export { Select, SelectItem, Combobox } from './select';
|
|
9
16
|
export { Stepper } from './stepper';
|
|
17
|
+
export { EmptyState } from './empty';
|
|
10
18
|
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption, DataTable, Board, BoardColumn, BoardCard } from './collections';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "altitude-design",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A React component library where height is the interface: the ground is the record.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
"ui"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
+
"homepage": "https://richlaconte.github.io/altitude/",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/richlaconte/altitude.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/richlaconte/altitude/issues/new/choose"
|
|
20
|
+
},
|
|
13
21
|
"type": "module",
|
|
14
22
|
"main": "./dist/index.cjs",
|
|
15
23
|
"module": "./dist/index.js",
|
|
@@ -21,6 +29,8 @@
|
|
|
21
29
|
"require": "./dist/index.cjs"
|
|
22
30
|
},
|
|
23
31
|
"./altitude.css": "./dist/altitude.css",
|
|
32
|
+
"./altitude.no-fonts.css": "./dist/altitude.no-fonts.css",
|
|
33
|
+
"./fonts.css": "./dist/fonts.css",
|
|
24
34
|
"./tokens.css": "./dist/tokens.css",
|
|
25
35
|
"./tokens.json": "./dist/tokens.json",
|
|
26
36
|
"./altitude.iife.js": "./dist/altitude.iife.js",
|