altitude-design 0.2.1 → 0.3.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 +41 -6
- package/dist/adapters/codemirror.cjs +88 -0
- package/dist/adapters/codemirror.cjs.map +7 -0
- package/dist/adapters/codemirror.js +67 -0
- package/dist/adapters/codemirror.js.map +7 -0
- package/dist/adapters/react-flow.css +102 -0
- package/dist/adapters/tiptap.css +71 -0
- package/dist/altitude.css +3121 -244
- package/dist/altitude.iife.js +33 -5
- package/dist/altitude.no-fonts.css +3121 -244
- package/dist/chart-themes.cjs +195 -0
- package/dist/chart-themes.cjs.map +7 -0
- package/dist/chart-themes.js +165 -0
- package/dist/chart-themes.js.map +7 -0
- package/dist/cli/altitude.mjs +134 -0
- package/dist/guidance/README.md +32 -0
- package/dist/guidance/agent-setup.md +22 -0
- package/dist/guidance/app-skeleton.md +17 -0
- package/dist/guidance/evidence.json +95 -0
- package/dist/guidance/index.json +493 -0
- package/dist/guidance/llms.txt +20 -0
- package/dist/guidance/manifest.json +92 -0
- package/dist/guidance/pattern.schema.json +181 -0
- package/dist/guidance/patterns/agent-action.json +77 -0
- package/dist/guidance/patterns/agent-action.md +39 -0
- package/dist/guidance/patterns/assistant-conversation.json +77 -0
- package/dist/guidance/patterns/assistant-conversation.md +50 -0
- package/dist/guidance/patterns/async-collection.json +71 -0
- package/dist/guidance/patterns/async-collection.md +29 -0
- package/dist/guidance/patterns/audit-log.json +75 -0
- package/dist/guidance/patterns/audit-log.md +27 -0
- package/dist/guidance/patterns/auth.json +86 -0
- package/dist/guidance/patterns/auth.md +29 -0
- package/dist/guidance/patterns/billing.json +80 -0
- package/dist/guidance/patterns/billing.md +29 -0
- package/dist/guidance/patterns/consequential-action.json +76 -0
- package/dist/guidance/patterns/consequential-action.md +27 -0
- package/dist/guidance/patterns/developer-settings.json +79 -0
- package/dist/guidance/patterns/developer-settings.md +29 -0
- package/dist/guidance/patterns/edit-record.json +74 -0
- package/dist/guidance/patterns/edit-record.md +51 -0
- package/dist/guidance/patterns/import.json +77 -0
- package/dist/guidance/patterns/import.md +31 -0
- package/dist/guidance/patterns/members.json +77 -0
- package/dist/guidance/patterns/members.md +27 -0
- package/dist/guidance/patterns/onboarding.json +78 -0
- package/dist/guidance/patterns/onboarding.md +31 -0
- package/dist/guidance/patterns/review-submit.json +72 -0
- package/dist/guidance/patterns/review-submit.md +27 -0
- package/dist/guidance/patterns/screen-layout.json +79 -0
- package/dist/guidance/patterns/screen-layout.md +40 -0
- package/dist/guidance/patterns/settings.json +78 -0
- package/dist/guidance/patterns/settings.md +32 -0
- package/dist/guidance/patterns/sync.json +77 -0
- package/dist/guidance/patterns/sync.md +31 -0
- package/dist/guidance/principles.md +23 -0
- package/dist/guidance/references/build/checks/agent-action-pattern.mjs +57 -0
- package/dist/guidance/references/build/checks/agent-setup.mjs +78 -0
- package/dist/guidance/references/build/checks/assistant-conversation-pattern.mjs +49 -0
- package/dist/guidance/references/build/checks/audit-log-pattern.mjs +63 -0
- package/dist/guidance/references/build/checks/auth-pattern.mjs +67 -0
- package/dist/guidance/references/build/checks/billing-pattern.mjs +63 -0
- package/dist/guidance/references/build/checks/developer-settings-pattern.mjs +76 -0
- package/dist/guidance/references/build/checks/guidance.mjs +71 -0
- package/dist/guidance/references/build/checks/import-pattern.mjs +69 -0
- package/dist/guidance/references/build/checks/members-pattern.mjs +71 -0
- package/dist/guidance/references/build/checks/onboarding-pattern.mjs +54 -0
- package/dist/guidance/references/build/checks/pattern-types.mjs +13 -0
- package/dist/guidance/references/build/checks/pattern-workflows.mjs +226 -0
- package/dist/guidance/references/build/checks/primary-scope.mjs +49 -0
- package/dist/guidance/references/build/checks/render-tells.mjs +72 -0
- package/dist/guidance/references/build/checks/screen-layout-pattern.mjs +111 -0
- package/dist/guidance/references/build/checks/semantics.mjs +72 -0
- package/dist/guidance/references/build/checks/settings-pattern.mjs +73 -0
- package/dist/guidance/references/build/checks/sync-pattern.mjs +62 -0
- package/dist/guidance/references/build/checks/tells-lint.mjs +164 -0
- package/dist/guidance/references/build/fixtures/pattern-workflows.tsx +83 -0
- package/dist/guidance/references/build/fixtures/patterns/agent-action.jsx +60 -0
- package/dist/guidance/references/build/fixtures/patterns/app-skeleton.jsx +94 -0
- package/dist/guidance/references/build/fixtures/patterns/assistant-conversation.jsx +79 -0
- package/dist/guidance/references/build/fixtures/patterns/audit-log.jsx +81 -0
- package/dist/guidance/references/build/fixtures/patterns/auth.jsx +150 -0
- package/dist/guidance/references/build/fixtures/patterns/billing.jsx +96 -0
- package/dist/guidance/references/build/fixtures/patterns/developer-settings.jsx +95 -0
- package/dist/guidance/references/build/fixtures/patterns/import.jsx +102 -0
- package/dist/guidance/references/build/fixtures/patterns/members.jsx +106 -0
- package/dist/guidance/references/build/fixtures/patterns/onboarding.jsx +70 -0
- package/dist/guidance/references/build/fixtures/patterns/screen-layout-decision.jsx +74 -0
- package/dist/guidance/references/build/fixtures/patterns/screen-layout-editor.jsx +56 -0
- package/dist/guidance/references/build/fixtures/patterns/screen-layout-report.jsx +42 -0
- package/dist/guidance/references/build/fixtures/patterns/settings.jsx +73 -0
- package/dist/guidance/references/build/fixtures/patterns/sync.jsx +78 -0
- package/dist/guidance/references/project/components/src/pattern-async-collection.tsx +57 -0
- package/dist/guidance/references/project/components/src/pattern-consequential-action.tsx +77 -0
- package/dist/guidance/references/project/components/src/pattern-edit-record.tsx +127 -0
- package/dist/guidance/references/project/components/src/pattern-review-submit.tsx +47 -0
- package/dist/guidance/references/project/components/src/settings.tsx +79 -0
- package/dist/guidance/references/scripts/build-framework-fixture.mjs +20 -0
- package/dist/guidance/rules.json +653 -0
- package/dist/guidance/visual/Elevation.md +194 -0
- package/dist/guidance/visual/Fundamentals.md +83 -0
- package/dist/guidance/visual/Research.md +1620 -0
- package/dist/index.cjs +18792 -1925
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +18792 -1925
- package/dist/index.js.map +4 -4
- package/dist/tokens.css +84 -84
- package/dist/tokens.json +301 -128
- package/dist/types/adapter-codemirror.d.ts +13 -0
- package/dist/types/agent-fleet.d.ts +166 -0
- package/dist/types/ai-label.d.ts +30 -0
- package/dist/types/app-shell.d.ts +83 -0
- package/dist/types/area-chart.d.ts +80 -0
- package/dist/types/artifact.d.ts +65 -0
- package/dist/types/bar-chart.d.ts +83 -0
- package/dist/types/bar-list.d.ts +35 -0
- package/dist/types/breadcrumb.d.ts +62 -0
- package/dist/types/chart-brush.d.ts +35 -0
- package/dist/types/chart-themes.d.ts +229 -0
- package/dist/types/chart.d.ts +570 -0
- package/dist/types/checklist.d.ts +71 -0
- package/dist/types/code-block.d.ts +32 -0
- package/dist/types/collections.d.ts +111 -4
- package/dist/types/color-picker.d.ts +38 -0
- package/dist/types/command.d.ts +6 -3
- package/dist/types/comment-thread.d.ts +48 -0
- package/dist/types/confirmation.d.ts +60 -0
- package/dist/types/context-menu.d.ts +17 -0
- package/dist/types/controls.d.ts +100 -17
- package/dist/types/conversation.d.ts +130 -0
- package/dist/types/copy-button.d.ts +19 -0
- package/dist/types/core.d.ts +139 -10
- package/dist/types/data-grid.d.ts +76 -0
- package/dist/types/date-picker.d.ts +96 -0
- package/dist/types/diff-view.d.ts +54 -0
- package/dist/types/dot-plot.d.ts +54 -0
- package/dist/types/edit-region.d.ts +121 -0
- package/dist/types/feature-gate.d.ts +22 -0
- package/dist/types/filter-bar.d.ts +65 -0
- package/dist/types/formatted-number.d.ts +38 -0
- package/dist/types/heatmap.d.ts +64 -0
- package/dist/types/in-place.d.ts +24 -0
- package/dist/types/index.d.ts +158 -15
- package/dist/types/inline-citation.d.ts +35 -0
- package/dist/types/inline-edit.d.ts +71 -0
- package/dist/types/input-otp.d.ts +37 -0
- package/dist/types/item-group.d.ts +104 -0
- package/dist/types/line-chart.d.ts +116 -0
- package/dist/types/link.d.ts +11 -0
- package/dist/types/markdown.d.ts +88 -0
- package/dist/types/meter.d.ts +43 -0
- package/dist/types/modal-state.d.ts +62 -0
- package/dist/types/nav.d.ts +8 -1
- package/dist/types/notifications.d.ts +42 -0
- package/dist/types/number-input.d.ts +30 -0
- package/dist/types/overlays.d.ts +51 -17
- package/dist/types/page-header.d.ts +27 -0
- package/dist/types/pagination.d.ts +29 -0
- package/dist/types/palette.d.ts +64 -0
- package/dist/types/password-input.d.ts +22 -0
- package/dist/types/pattern-assistant-conversation.d.ts +55 -0
- package/dist/types/pattern-async-collection.d.ts +34 -0
- package/dist/types/pattern-consequential-action.d.ts +53 -0
- package/dist/types/pattern-edit-record.d.ts +72 -0
- package/dist/types/pattern-review-submit.d.ts +43 -0
- package/dist/types/permission-matrix.d.ts +34 -0
- package/dist/types/plan-picker.d.ts +40 -0
- package/dist/types/prompt-input.d.ts +106 -0
- package/dist/types/property-list.d.ts +67 -0
- package/dist/types/question.d.ts +64 -0
- package/dist/types/relative-time.d.ts +21 -0
- package/dist/types/removal-receipt.d.ts +1180 -0
- package/dist/types/resizable.d.ts +48 -0
- package/dist/types/roving.d.ts +44 -0
- package/dist/types/save-bar.d.ts +38 -0
- package/dist/types/saved-views.d.ts +72 -0
- package/dist/types/scatter-chart.d.ts +60 -0
- package/dist/types/schedule.d.ts +80 -0
- package/dist/types/secret-field.d.ts +33 -0
- package/dist/types/select.d.ts +44 -2
- package/dist/types/separator.d.ts +11 -0
- package/dist/types/settings.d.ts +39 -0
- package/dist/types/sheet.d.ts +1 -1
- package/dist/types/sparkline.d.ts +46 -0
- package/dist/types/split-button.d.ts +21 -0
- package/dist/types/stat.d.ts +54 -0
- package/dist/types/stepper.d.ts +6 -3
- package/dist/types/suggestions.d.ts +29 -0
- package/dist/types/suspense.d.ts +12 -1
- package/dist/types/sync-indicator.d.ts +24 -0
- package/dist/types/tag-input.d.ts +65 -0
- package/dist/types/terminal.d.ts +33 -0
- package/dist/types/thread-list.d.ts +58 -0
- package/dist/types/time-input.d.ts +33 -0
- package/dist/types/timeline.d.ts +38 -0
- package/dist/types/toggle.d.ts +46 -0
- package/dist/types/toolbar.d.ts +34 -0
- package/dist/types/tour.d.ts +23 -0
- package/dist/types/trace.d.ts +65 -0
- package/dist/types/tree.d.ts +71 -0
- package/dist/types-cjs/adapter-codemirror.d.cts +13 -0
- package/dist/types-cjs/agent-fleet.d.cts +166 -0
- package/dist/types-cjs/ai-label.d.cts +30 -0
- package/dist/types-cjs/app-shell.d.cts +83 -0
- package/dist/types-cjs/area-chart.d.cts +80 -0
- package/dist/types-cjs/artifact.d.cts +65 -0
- package/dist/types-cjs/bar-chart.d.cts +83 -0
- package/dist/types-cjs/bar-list.d.cts +35 -0
- package/dist/types-cjs/breadcrumb.d.cts +62 -0
- package/dist/types-cjs/chart-brush.d.cts +35 -0
- package/dist/types-cjs/chart-themes.d.cts +229 -0
- package/dist/types-cjs/chart.d.cts +570 -0
- package/dist/types-cjs/checklist.d.cts +71 -0
- package/dist/types-cjs/code-block.d.cts +32 -0
- package/dist/types-cjs/collections.d.cts +246 -0
- package/dist/types-cjs/color-picker.d.cts +38 -0
- package/dist/types-cjs/command.d.cts +66 -0
- package/dist/types-cjs/comment-thread.d.cts +48 -0
- package/dist/types-cjs/confirmation.d.cts +60 -0
- package/dist/types-cjs/context-menu.d.cts +17 -0
- package/dist/types-cjs/controls.d.cts +360 -0
- package/dist/types-cjs/conversation.d.cts +130 -0
- package/dist/types-cjs/copy-button.d.cts +19 -0
- package/dist/types-cjs/core.d.cts +256 -0
- package/dist/types-cjs/data-grid.d.cts +76 -0
- package/dist/types-cjs/date-picker.d.cts +96 -0
- package/dist/types-cjs/diff-view.d.cts +54 -0
- package/dist/types-cjs/dot-plot.d.cts +54 -0
- package/dist/types-cjs/edit-region.d.cts +121 -0
- package/dist/types-cjs/empty.d.cts +24 -0
- package/dist/types-cjs/feature-gate.d.cts +22 -0
- package/dist/types-cjs/filter-bar.d.cts +65 -0
- package/dist/types-cjs/formatted-number.d.cts +38 -0
- package/dist/types-cjs/heatmap.d.cts +64 -0
- package/dist/types-cjs/in-place.d.cts +24 -0
- package/dist/types-cjs/index.d.cts +154 -0
- package/dist/types-cjs/inline-citation.d.cts +35 -0
- package/dist/types-cjs/inline-edit.d.cts +71 -0
- package/dist/types-cjs/input-otp.d.cts +37 -0
- package/dist/types-cjs/item-group.d.cts +104 -0
- package/dist/types-cjs/line-chart.d.cts +116 -0
- package/dist/types-cjs/link.d.cts +11 -0
- package/dist/types-cjs/markdown.d.cts +88 -0
- package/dist/types-cjs/meter.d.cts +43 -0
- package/dist/types-cjs/modal-state.d.cts +62 -0
- package/dist/types-cjs/nav.d.cts +25 -0
- package/dist/types-cjs/notifications.d.cts +42 -0
- package/dist/types-cjs/number-input.d.cts +30 -0
- package/dist/types-cjs/overlays.d.cts +170 -0
- package/dist/types-cjs/page-header.d.cts +27 -0
- package/dist/types-cjs/pagination.d.cts +29 -0
- package/dist/types-cjs/palette.d.cts +64 -0
- package/dist/types-cjs/password-input.d.cts +22 -0
- package/dist/types-cjs/pattern-assistant-conversation.d.cts +55 -0
- package/dist/types-cjs/pattern-async-collection.d.cts +34 -0
- package/dist/types-cjs/pattern-consequential-action.d.cts +53 -0
- package/dist/types-cjs/pattern-edit-record.d.cts +72 -0
- package/dist/types-cjs/pattern-review-submit.d.cts +43 -0
- package/dist/types-cjs/permission-matrix.d.cts +34 -0
- package/dist/types-cjs/pile.d.cts +27 -0
- package/dist/types-cjs/plan-picker.d.cts +40 -0
- package/dist/types-cjs/prompt-input.d.cts +106 -0
- package/dist/types-cjs/property-list.d.cts +67 -0
- package/dist/types-cjs/question.d.cts +64 -0
- package/dist/types-cjs/relative-time.d.cts +21 -0
- package/dist/types-cjs/removal-receipt.d.cts +1180 -0
- package/dist/types-cjs/resizable.d.cts +48 -0
- package/dist/types-cjs/roving.d.cts +44 -0
- package/dist/types-cjs/save-bar.d.cts +38 -0
- package/dist/types-cjs/saved-views.d.cts +72 -0
- package/dist/types-cjs/scatter-chart.d.cts +60 -0
- package/dist/types-cjs/schedule.d.cts +80 -0
- package/dist/types-cjs/secret-field.d.cts +33 -0
- package/dist/types-cjs/select.d.cts +109 -0
- package/dist/types-cjs/separator.d.cts +11 -0
- package/dist/types-cjs/settings.d.cts +39 -0
- package/dist/types-cjs/sheet.d.cts +27 -0
- package/dist/types-cjs/sparkline.d.cts +46 -0
- package/dist/types-cjs/split-button.d.cts +21 -0
- package/dist/types-cjs/stat.d.cts +54 -0
- package/dist/types-cjs/stepper.d.cts +26 -0
- package/dist/types-cjs/suggestions.d.cts +29 -0
- package/dist/types-cjs/suspense.d.cts +85 -0
- package/dist/types-cjs/sync-indicator.d.cts +24 -0
- package/dist/types-cjs/tag-input.d.cts +65 -0
- package/dist/types-cjs/terminal.d.cts +33 -0
- package/dist/types-cjs/thread-list.d.cts +58 -0
- package/dist/types-cjs/time-input.d.cts +33 -0
- package/dist/types-cjs/timeline.d.cts +38 -0
- package/dist/types-cjs/toggle.d.cts +46 -0
- package/dist/types-cjs/toolbar.d.cts +34 -0
- package/dist/types-cjs/tour.d.cts +23 -0
- package/dist/types-cjs/trace.d.cts +65 -0
- package/dist/types-cjs/tree.d.cts +71 -0
- package/package.json +89 -9
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface InputOTPProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'pattern' | 'children'> {
|
|
3
|
+
/** How many characters the code has. */
|
|
4
|
+
maxLength: number;
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: (code: string) => void;
|
|
8
|
+
/** Called when the last character lands, and again whenever a full code changes. */
|
|
9
|
+
onComplete?: (code: string) => void;
|
|
10
|
+
/** Which characters it takes. Default 'digits'. Anything else typed or pasted is dropped. */
|
|
11
|
+
pattern?: 'digits' | 'alphanumeric' | RegExp;
|
|
12
|
+
/** Show • instead of the characters. */
|
|
13
|
+
mask?: boolean;
|
|
14
|
+
invalid?: boolean;
|
|
15
|
+
/** The code is being checked: aria-busy, and nothing more can be typed. */
|
|
16
|
+
verifying?: boolean;
|
|
17
|
+
/** InputOTPGroup, InputOTPSlot and InputOTPSeparator. Default: one group of maxLength slots. */
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A one-time code as a row of openings that fill. One real input (inputmode numeric, autocomplete one-time-code) drives
|
|
23
|
+
* the slots, so autofill, paste and screen readers see one field; each slot is a well whose floor rises flush as its
|
|
24
|
+
* character lands, and a rejected code drops the whole row to a trench.
|
|
25
|
+
*/
|
|
26
|
+
export declare const InputOTP: React.ForwardRefExoticComponent<InputOTPProps & React.RefAttributes<HTMLInputElement>>;
|
|
27
|
+
/** Slots that sit together, parted from the next group by an InputOTPSeparator. */
|
|
28
|
+
export declare function InputOTPGroup({ className, ...rest }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
29
|
+
/** One character's opening: a well whose floor rises flush when its character lands. */
|
|
30
|
+
export declare function InputOTPSlot({ index, className }: {
|
|
31
|
+
index: number;
|
|
32
|
+
className?: string;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
/** A decorative dash between groups. */
|
|
35
|
+
export declare function InputOTPSeparator({ className }: {
|
|
36
|
+
className?: string;
|
|
37
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { EditRegionBinder, EditRegionSaveResult } from './edit-region.js';
|
|
3
|
+
export type ItemGroupResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
export type ItemGroupCreateResult<T> = {
|
|
10
|
+
ok: true;
|
|
11
|
+
value: T;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
error: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* How removal is recovered. There's no default: say whether the application can reverse it (immediate, with Undo)
|
|
18
|
+
* or needs confirmation first. A danger button doesn't imply irreversibility. A recoverable removal leaves a
|
|
19
|
+
* RemovalReceipt with Undo in the slat's place for dur-linger, then closes the gap and offers Undo in a toast (render
|
|
20
|
+
* a Toaster); a confirmed one glides the slat shut.
|
|
21
|
+
*/
|
|
22
|
+
export type ItemGroupRemoval<T> = {
|
|
23
|
+
kind: 'recoverable';
|
|
24
|
+
undo: (item: T) => void | Promise<unknown>;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'confirm';
|
|
27
|
+
title: (item: T) => string;
|
|
28
|
+
description?: (item: T) => React.ReactNode;
|
|
29
|
+
confirmLabel?: string;
|
|
30
|
+
};
|
|
31
|
+
/** What renderItem gets. Spread editProps and removeProps onto visible Buttons: they carry the name, the handler and focus repair. */
|
|
32
|
+
export interface ItemActionsApi {
|
|
33
|
+
edit: () => void;
|
|
34
|
+
remove: () => void;
|
|
35
|
+
editProps: {
|
|
36
|
+
onClick: () => void;
|
|
37
|
+
'aria-label': string;
|
|
38
|
+
'data-action': 'edit';
|
|
39
|
+
};
|
|
40
|
+
removeProps: {
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
'aria-label': string;
|
|
43
|
+
'data-action': 'remove';
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface ItemGroupProps<T extends Record<string, unknown>> {
|
|
47
|
+
'aria-label'?: string;
|
|
48
|
+
'aria-labelledby'?: string;
|
|
49
|
+
items: T[];
|
|
50
|
+
getKey: (item: T) => string;
|
|
51
|
+
/** Names actions (“Edit Production webhook”) and announcements. */
|
|
52
|
+
getLabel: (item: T) => string;
|
|
53
|
+
/** One slat. `edit` and `remove` open the editor and remove the item, with focus and recovery handled. */
|
|
54
|
+
renderItem: (item: T, actions: ItemActionsApi) => React.ReactNode;
|
|
55
|
+
/** The in-place editor's fields (EditRegion's draft binder). */
|
|
56
|
+
renderEditor?: (field: EditRegionBinder<T>, item: T | null) => React.ReactNode;
|
|
57
|
+
/** Save an edited item: the EditRegion contract. */
|
|
58
|
+
onSave?: (draft: T, context: {
|
|
59
|
+
previousValue: T;
|
|
60
|
+
changed: (keyof T)[];
|
|
61
|
+
}) => EditRegionSaveResult<T> | Promise<EditRegionSaveResult<T>>;
|
|
62
|
+
/** Publish a saved item's canonical record (a synchronous setter, no network). */
|
|
63
|
+
onItemChange?: (canonical: T) => void;
|
|
64
|
+
/** The draft for a new item. With onCreate, shows the add slat. */
|
|
65
|
+
newItem?: () => T;
|
|
66
|
+
/** Resolve after `items` includes the new item. */
|
|
67
|
+
onCreate?: (draft: T) => ItemGroupCreateResult<T> | Promise<ItemGroupCreateResult<T>>;
|
|
68
|
+
/** Default “Add item”. */
|
|
69
|
+
addLabel?: string;
|
|
70
|
+
/** Shows grips: Space to pick up, arrows to move, Space to drop. Resolve after `items` is in the new order. */
|
|
71
|
+
onReorder?: (next: T[]) => void | ItemGroupResult | Promise<void | ItemGroupResult>;
|
|
72
|
+
/** Resolve after `items` no longer includes it. */
|
|
73
|
+
onRemove?: (item: T) => void | ItemGroupResult | Promise<void | ItemGroupResult>;
|
|
74
|
+
removal?: ItemGroupRemoval<T>;
|
|
75
|
+
/** Shown when there are no items (an EmptyState). */
|
|
76
|
+
empty?: React.ReactNode;
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A list of slats changed in the list itself. Slats are the record, flush on the ground with line dividers. One slat
|
|
81
|
+
* at a time lifts into its editor (EditRegion), its neighbours flush and readable; the add slat is an opening; a slat
|
|
82
|
+
* picked up to reorder floats at level 3 over its slot. Removal follows the application's stated policy.
|
|
83
|
+
*/
|
|
84
|
+
export declare function ItemGroup<T extends Record<string, unknown>>({ items, getKey, getLabel, renderItem, renderEditor, onSave, onItemChange, newItem, onCreate, addLabel, onReorder, onRemove, removal, empty, className, ...aria }: ItemGroupProps<T>): React.JSX.Element;
|
|
85
|
+
export declare function Item({ className, ...rest }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
86
|
+
export declare function ItemMedia({ variant, className, ...rest }: React.HTMLAttributes<HTMLDivElement> & {
|
|
87
|
+
variant?: 'icon' | 'image' | 'avatar';
|
|
88
|
+
}): React.JSX.Element;
|
|
89
|
+
export declare function ItemContent({ className, ...rest }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
90
|
+
export declare function ItemTitle({ className, ...rest }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
91
|
+
/** The item's secondary line. `truncate` clamps it to that many lines (true: one), so a long one never pushes the row. */
|
|
92
|
+
export declare function ItemDescription({ className, truncate, style, ...rest }: React.HTMLAttributes<HTMLParagraphElement> & {
|
|
93
|
+
truncate?: boolean | number;
|
|
94
|
+
}): React.JSX.Element;
|
|
95
|
+
/** Visible actions (not hover-only). Give the item's Edit and Remove buttons data-action="edit" and "remove" for focus repair. */
|
|
96
|
+
/**
|
|
97
|
+
* Visible actions (not hover-only). Give the item's Edit and Remove buttons data-action="edit" and "remove" for focus
|
|
98
|
+
* repair. `narrow` (#267): 'below' (default) moves them to their own row under the content when the group is narrow
|
|
99
|
+
* (under 480px), so they never squeeze the title; 'inline' keeps them beside it.
|
|
100
|
+
*/
|
|
101
|
+
export declare function ItemActions({ className, narrow, ...rest }: React.HTMLAttributes<HTMLDivElement> & {
|
|
102
|
+
narrow?: 'below' | 'inline';
|
|
103
|
+
}): React.JSX.Element;
|
|
104
|
+
export declare function ItemSeparator({ className, ...rest }: React.HTMLAttributes<HTMLHRElement>): React.JSX.Element;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartCompare, type ChartConfig, type ChartDatum, type ChartInfo, type ChartStatus } from './chart.js';
|
|
3
|
+
export interface LineChartProps {
|
|
4
|
+
/** The records, in x order: one per time or value of x. */
|
|
5
|
+
data: ChartDatum[] | null | undefined | PromiseLike<ChartDatum[] | null>;
|
|
6
|
+
/** The key of each record's x: an ISO date, a timestamp or a number. */
|
|
7
|
+
x: string;
|
|
8
|
+
/** 'linear' joins points with straight lines; 'monotone' curves through them without overshooting. Default 'linear'. */
|
|
9
|
+
curve?: 'linear' | 'monotone';
|
|
10
|
+
/** Formats values (the axis, the readout, the names and the summary) of series that have no format of their own. */
|
|
11
|
+
y?: {
|
|
12
|
+
format?: (value: number) => string;
|
|
13
|
+
};
|
|
14
|
+
/** Name each line at its end. Default: on for up to four series, and always under forced colours and in print. */
|
|
15
|
+
endLabels?: boolean;
|
|
16
|
+
/** The crosshair and readout. Default true. */
|
|
17
|
+
tooltip?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Which records aren't yet the record: 'partial' for a period still being counted, 'projected' for a forecast. The
|
|
20
|
+
* line is dashed from the last settled point on, its points hollow, and each says "So far" or "Projected".
|
|
21
|
+
*/
|
|
22
|
+
status?: (d: ChartDatum) => ChartStatus | undefined;
|
|
23
|
+
/** The rule where the record ends: its word (default "Today"), or false for none. */
|
|
24
|
+
boundary?: string | false;
|
|
25
|
+
/**
|
|
26
|
+
* An uncertainty band around a series, from each record's `low` to its `high`: a flat, low-opacity fill of the
|
|
27
|
+
* series colour, never error bars and never a gradient. `label` names it in the readout (default "Range").
|
|
28
|
+
*/
|
|
29
|
+
band?: {
|
|
30
|
+
low: string;
|
|
31
|
+
high: string;
|
|
32
|
+
series?: string;
|
|
33
|
+
label?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Read each value against the record before (#189): `{ data: lastWeek, label: 'Last week' }` for records matched by
|
|
37
|
+
* position, or `{ key: 'lastWeek', label: 'Last week' }` for a field on the same record. The earlier period is a
|
|
38
|
+
* 1.5px solid ink-muted trace under the compared series (`series`, default the first), named at its end.
|
|
39
|
+
*/
|
|
40
|
+
compare?: ChartCompare;
|
|
41
|
+
/**
|
|
42
|
+
* Let people pin a reading to the plot (#190): with the readout open, a click (or P on the keyboard path, or a tap
|
|
43
|
+
* while the touch readout is open) sets it down as a plate. true allows two, which compare in words; a number allows
|
|
44
|
+
* that many. Escape removes the last.
|
|
45
|
+
*/
|
|
46
|
+
pinnable?: boolean | number;
|
|
47
|
+
/** The pinned readings' x values, controlled (to keep them in the URL, say); and when they change. */
|
|
48
|
+
pins?: Array<string | number>;
|
|
49
|
+
onPinsChange?: (pins: Array<string | number>) => void;
|
|
50
|
+
/**
|
|
51
|
+
* What the chart is about (#188): these series keep their colours and the rest are drawn in data-context, their
|
|
52
|
+
* labels in ink-muted. The author's statement of importance, not a reader's filter (that's relevance).
|
|
53
|
+
*/
|
|
54
|
+
focus?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Filter in place: which records match. The line recedes to 35% around its misses (each record owns its stretch of
|
|
57
|
+
* x), keeping its place and colour; the frame says how many match. Nothing is removed.
|
|
58
|
+
*/
|
|
59
|
+
relevance?: (d: ChartDatum) => 'match' | 'miss' | undefined;
|
|
60
|
+
/** With relevance: fit the axis to the matches. Default false: the axis holds, so positions survive. */
|
|
61
|
+
rescale?: boolean;
|
|
62
|
+
/** The selected record's x value, for marks you can select. The others recede; the frame says "Filtered to …". */
|
|
63
|
+
selected?: unknown;
|
|
64
|
+
/** Makes marks selectable: called with the chosen record, or null when the selection clears (Escape, Clear, or choosing it again). */
|
|
65
|
+
onSelect?: (d: ChartDatum | null) => void;
|
|
66
|
+
/** Makes marks open a level down, inside a Drilldown: return the id of the current node's child this record opens. */
|
|
67
|
+
drill?: (d: ChartDatum) => string | null | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Show only the latest stretch of x: `{ minutes: 15 }` (or `hours`, `days`) of time, or the last `points` records.
|
|
70
|
+
* In a `live` container, when the window moves on, x glides one step and the marks ride along with it.
|
|
71
|
+
*/
|
|
72
|
+
window?: ChartWindow;
|
|
73
|
+
/** Called with the new { start, end } when a ChartBrush moves the window. Without `window`, the brush keeps its own. */
|
|
74
|
+
onWindowChange?: (window: {
|
|
75
|
+
start: string | number;
|
|
76
|
+
end: string | number;
|
|
77
|
+
}) => void;
|
|
78
|
+
/** A ChartTooltip, to change what the readout shows. */
|
|
79
|
+
/**
|
|
80
|
+
* 'banked' (#194): the plot takes the proportions that bank the lines' segments to 45° on average, so slopes read
|
|
81
|
+
* accurately, between 1 and 4 for the data area; the width is the card's. Use a fixed aspect in a grid of equal cards.
|
|
82
|
+
*/
|
|
83
|
+
aspect?: 'banked';
|
|
84
|
+
children?: React.ReactNode;
|
|
85
|
+
/** What the plot says when there's no data: an EmptyState at widget size. */
|
|
86
|
+
empty?: import('./chart.js').ChartEmpty;
|
|
87
|
+
}
|
|
88
|
+
export interface ChartWindow {
|
|
89
|
+
minutes?: number;
|
|
90
|
+
hours?: number;
|
|
91
|
+
days?: number;
|
|
92
|
+
points?: number;
|
|
93
|
+
/** A fixed stretch of x, both ends included (a DateRange fits): what a ChartBrush sets. null leaves that end open. */
|
|
94
|
+
start?: string | number | null;
|
|
95
|
+
end?: string | number | null;
|
|
96
|
+
}
|
|
97
|
+
/** The records inside a sliding window, and the x domain the window spans. */
|
|
98
|
+
export declare function windowed(data: ChartDatum[], x: string, w: ChartWindow | undefined): {
|
|
99
|
+
rows: ChartDatum[];
|
|
100
|
+
domain?: [number, number];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* A path through points, broken wherever a value is missing: a null is a gap (nothing was recorded), never bridged.
|
|
104
|
+
* 'monotone' is a cubic through the points whose tangents never overshoot them (Fritsch–Carlson), so a curve never
|
|
105
|
+
* invents a peak or a dip the data doesn't have.
|
|
106
|
+
*/
|
|
107
|
+
export declare function linePath(points: Array<[number, number] | null>, curve?: 'linear' | 'monotone'): string;
|
|
108
|
+
/**
|
|
109
|
+
* Change over time for one to four series. Lines are the record: 2px strokes in their series' colours, round joins,
|
|
110
|
+
* no fill, no glow. A missing value breaks the line. The last point carries a marker and each line is named at its
|
|
111
|
+
* end, so the legend is the lines themselves.
|
|
112
|
+
*/
|
|
113
|
+
export declare function LineChart({ curve, endLabels, band, compare }: LineChartProps): React.JSX.Element;
|
|
114
|
+
export declare namespace LineChart {
|
|
115
|
+
var chartInfo: (props: Record<string, unknown>, config: ChartConfig) => ChartInfo;
|
|
116
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
|
+
/** Leaves the app: opens in a new tab (rel="noopener noreferrer"), with an icon and "(opens in a new tab)" for screen readers. */
|
|
4
|
+
external?: boolean;
|
|
5
|
+
/** Styles your own link element (a router's Link) instead of rendering an <a>. Pass exactly one element. */
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
/** Mark links already followed: their underline turns ink-muted. Off by default; use it in long lists of documents. */
|
|
8
|
+
visited?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Navigation in accent-ink with an underline. A link is text in the record, so it never lifts: hover thickens the underline. */
|
|
11
|
+
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CitationSource } from './inline-citation.js';
|
|
3
|
+
/** The elements a caller can replace. `pre` gets the fenced code's parts rather than children. */
|
|
4
|
+
export interface MarkdownComponents {
|
|
5
|
+
a?: React.ComponentType<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
6
|
+
img?: React.ComponentType<React.ImgHTMLAttributes<HTMLImageElement>>;
|
|
7
|
+
code?: React.ComponentType<React.HTMLAttributes<HTMLElement>>;
|
|
8
|
+
pre?: React.ComponentType<{
|
|
9
|
+
code: string;
|
|
10
|
+
language?: string;
|
|
11
|
+
streaming?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
table?: React.ComponentType<React.TableHTMLAttributes<HTMLTableElement>>;
|
|
14
|
+
blockquote?: React.ComponentType<React.BlockquoteHTMLAttributes<HTMLQuoteElement>>;
|
|
15
|
+
}
|
|
16
|
+
export interface MarkdownProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
17
|
+
/** The Markdown source: CommonMark, plus GFM tables, task lists, strikethrough and bare links. */
|
|
18
|
+
children: string;
|
|
19
|
+
/**
|
|
20
|
+
* The answer is still arriving: unfinished constructs render as unfinished, never as raw text. An open fence is a
|
|
21
|
+
* streaming CodeBlock, a table shows nothing until its delimiter row arrives and never a half-received row, and an
|
|
22
|
+
* unclosed `**`, backtick or link shows its text without the markers.
|
|
23
|
+
*/
|
|
24
|
+
streaming?: boolean;
|
|
25
|
+
/** Sources for `[n]` markers, which render as InlineCitation (1-based). */
|
|
26
|
+
citations?: CitationSource[];
|
|
27
|
+
/** Passed to InlineCitation, as in Sources. */
|
|
28
|
+
idPrefix?: string;
|
|
29
|
+
/** Passed to every CodeBlock. */
|
|
30
|
+
syntax?: (code: string, language?: string) => React.ReactNode;
|
|
31
|
+
/** The element level of a `#` heading. Default 3, so an answer's headings sit under the conversation's. */
|
|
32
|
+
headingLevel?: number;
|
|
33
|
+
/** Replace the element used for a kind of node, e.g. `{ a: RouterLink }`. */
|
|
34
|
+
components?: MarkdownComponents;
|
|
35
|
+
/** Render raw HTML blocks from the source. Default false: they show as text. Only for sources you trust. */
|
|
36
|
+
allowHtml?: boolean;
|
|
37
|
+
/** Rewrite or refuse (undefined) a link or image URL. Default: refuses javascript:, vbscript:, file: and data: (except images). */
|
|
38
|
+
transformUrl?: (url: string, kind: 'link' | 'image') => string | undefined;
|
|
39
|
+
}
|
|
40
|
+
type Align = 'left' | 'center' | 'right' | undefined;
|
|
41
|
+
type Block = {
|
|
42
|
+
t: 'p';
|
|
43
|
+
text: string;
|
|
44
|
+
} | {
|
|
45
|
+
t: 'h';
|
|
46
|
+
depth: number;
|
|
47
|
+
text: string;
|
|
48
|
+
} | {
|
|
49
|
+
t: 'hr';
|
|
50
|
+
} | {
|
|
51
|
+
t: 'code';
|
|
52
|
+
lang?: string;
|
|
53
|
+
code: string;
|
|
54
|
+
open: boolean;
|
|
55
|
+
} | {
|
|
56
|
+
t: 'quote';
|
|
57
|
+
children: Block[];
|
|
58
|
+
} | {
|
|
59
|
+
t: 'list';
|
|
60
|
+
ordered: boolean;
|
|
61
|
+
start: number;
|
|
62
|
+
tight: boolean;
|
|
63
|
+
items: {
|
|
64
|
+
task?: boolean;
|
|
65
|
+
children: Block[];
|
|
66
|
+
}[];
|
|
67
|
+
} | {
|
|
68
|
+
t: 'table';
|
|
69
|
+
align: Align[];
|
|
70
|
+
head: string[];
|
|
71
|
+
rows: string[][];
|
|
72
|
+
} | {
|
|
73
|
+
t: 'html';
|
|
74
|
+
html: string;
|
|
75
|
+
};
|
|
76
|
+
export declare function safeUrl(url: string, kind: 'link' | 'image'): string | undefined;
|
|
77
|
+
/** Parses Markdown into blocks; exported for tests and adapters. */
|
|
78
|
+
export declare function parseMarkdown(source: string, { streaming, allowHtml }?: {
|
|
79
|
+
streaming?: boolean | undefined;
|
|
80
|
+
allowHtml?: boolean | undefined;
|
|
81
|
+
}): Block[];
|
|
82
|
+
/**
|
|
83
|
+
* An answer's Markdown, set as Altitude prose: the record's typography, adding no height. Code is CodeBlock, links are
|
|
84
|
+
* Link, `[n]` markers are InlineCitation, tables use Table's flush rows, images rise from an imprint. While
|
|
85
|
+
* `streaming`, unfinished constructs render as unfinished rather than as raw text.
|
|
86
|
+
*/
|
|
87
|
+
export declare const Markdown: React.ForwardRefExoticComponent<MarkdownProps & React.RefAttributes<HTMLDivElement>>;
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ChartSlot } from './chart.js';
|
|
3
|
+
export interface MeterSegment {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
/** The segment's colour slot. Default: its place in the list (data-1, data-2, …; a seventh and later are data-other). */
|
|
8
|
+
color?: ChartSlot;
|
|
9
|
+
}
|
|
10
|
+
export interface MeterProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
11
|
+
/** What's being measured: "Storage". It names the meter. */
|
|
12
|
+
label: React.ReactNode;
|
|
13
|
+
/** The reading. Undefined while your data loads: until it lands the track is an imprint. Ignored when `segments` is set (their sum is the reading). */
|
|
14
|
+
value?: number;
|
|
15
|
+
/** Default 0. */
|
|
16
|
+
min?: number;
|
|
17
|
+
/** Default 100. A reading above it is over the limit. */
|
|
18
|
+
max?: number;
|
|
19
|
+
/** From here the reading is near its limit: the fill turns caution and the meter says "Near limit". */
|
|
20
|
+
high?: number;
|
|
21
|
+
/** From here the reading is critical: the fill turns critical and the meter says "Over limit". Default: anything above `max`. */
|
|
22
|
+
critical?: number;
|
|
23
|
+
/** Parts of the whole (storage by type): flat data-* fills parted by 2px, with a legend of their values. */
|
|
24
|
+
segments?: MeterSegment[];
|
|
25
|
+
/** Formats readings: "62 GB". Default: Intl.NumberFormat. */
|
|
26
|
+
format?: (value: number) => string;
|
|
27
|
+
/** The words for each state. Default "Near limit" and "Over limit". */
|
|
28
|
+
states?: {
|
|
29
|
+
high?: string;
|
|
30
|
+
critical?: string;
|
|
31
|
+
};
|
|
32
|
+
/** Hide the "62 GB of 100 GB" text beside the label (it's still announced). */
|
|
33
|
+
hideValue?: boolean;
|
|
34
|
+
locale?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Where a reading sits in a known range: storage of a quota, seats of a plan, CPU. A reading is the record, so the
|
|
38
|
+
* meter lies on the ground: a flush track with the reading drawn as flat ink across it (unlike Progress, whose fill
|
|
39
|
+
* rises out of a trench because a task under way is live). Thresholds are 1px notches at the track's rim; past them
|
|
40
|
+
* the fill turns caution or critical and the state is said in words, with a lamp that relights when it changes.
|
|
41
|
+
* Segments show parts of a whole, the honest replacement for a donut.
|
|
42
|
+
*/
|
|
43
|
+
export declare function Meter(props: MeterProps): React.JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ModalProvider {
|
|
3
|
+
stage: HTMLElement | null;
|
|
4
|
+
parent: ModalProvider | null;
|
|
5
|
+
recede: boolean;
|
|
6
|
+
owners: Set<ModalOwner>;
|
|
7
|
+
legacy: Set<symbol>;
|
|
8
|
+
}
|
|
9
|
+
export declare const AltitudeContext: React.Context<{
|
|
10
|
+
host: HTMLElement | null;
|
|
11
|
+
provider: ModalProvider;
|
|
12
|
+
} | null>;
|
|
13
|
+
export declare const useAltitudeContext: () => {
|
|
14
|
+
host: HTMLElement | null;
|
|
15
|
+
provider: ModalProvider;
|
|
16
|
+
} | null;
|
|
17
|
+
export interface ModalOwner {
|
|
18
|
+
panel: HTMLElement;
|
|
19
|
+
root: HTMLElement;
|
|
20
|
+
provider: ModalProvider | null;
|
|
21
|
+
open: boolean;
|
|
22
|
+
modal: boolean;
|
|
23
|
+
summit: boolean;
|
|
24
|
+
background: 'recede' | 'stationary';
|
|
25
|
+
invoker: HTMLElement | null;
|
|
26
|
+
autoFocus: boolean;
|
|
27
|
+
restoreFocus: boolean;
|
|
28
|
+
focusSelector: string;
|
|
29
|
+
returnFocus?: () => HTMLElement | null;
|
|
30
|
+
retired: boolean;
|
|
31
|
+
lastFocus?: HTMLElement | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function focusable(el: HTMLElement | null, doc?: Document): el is HTMLElement;
|
|
34
|
+
export declare function tabbables(panel: HTMLElement): HTMLElement[];
|
|
35
|
+
declare class ModalDocument {
|
|
36
|
+
readonly doc: Document;
|
|
37
|
+
owners: ModalOwner[];
|
|
38
|
+
active: ModalOwner | null;
|
|
39
|
+
inert: Map<HTMLElement, string | null>;
|
|
40
|
+
stages: Set<HTMLElement>;
|
|
41
|
+
legacyProviders: Set<ModalProvider>;
|
|
42
|
+
listeners: Set<() => void>;
|
|
43
|
+
observer: MutationObserver | null;
|
|
44
|
+
overflow: {
|
|
45
|
+
value: string;
|
|
46
|
+
priority: string;
|
|
47
|
+
} | null;
|
|
48
|
+
live: HTMLElement | null;
|
|
49
|
+
said: Set<number>;
|
|
50
|
+
constructor(doc: Document);
|
|
51
|
+
vote(provider: ModalProvider): () => void;
|
|
52
|
+
releaseProvider(provider: ModalProvider): void;
|
|
53
|
+
notify: () => void;
|
|
54
|
+
guard: (event: FocusEvent) => void;
|
|
55
|
+
subscribe: (fn: () => void) => () => void;
|
|
56
|
+
add(owner: ModalOwner): boolean;
|
|
57
|
+
remove(owner: ModalOwner): void;
|
|
58
|
+
reconcile(initial?: boolean): void;
|
|
59
|
+
announce(id: number, message: string): void;
|
|
60
|
+
}
|
|
61
|
+
export declare function modalDocument(doc: Document): ModalDocument;
|
|
62
|
+
export {};
|
package/dist/types/nav.d.ts
CHANGED
|
@@ -3,10 +3,17 @@ export interface DrillNode {
|
|
|
3
3
|
id: string;
|
|
4
4
|
title: React.ReactNode;
|
|
5
5
|
description?: React.ReactNode;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* What the node shows. Without it, a node with children lists them. With both, the content shows and opens its
|
|
8
|
+
* children itself, as a chart does with `drill` (useDrilldown().open).
|
|
9
|
+
*/
|
|
7
10
|
content?: React.ReactNode;
|
|
8
11
|
children?: DrillNode[];
|
|
9
12
|
}
|
|
13
|
+
/** Inside a Drilldown's content: open one of the current node's children by id, as its rows do. False if there's none. */
|
|
14
|
+
export declare function useDrilldown(): {
|
|
15
|
+
open: (id: string) => boolean;
|
|
16
|
+
} | null;
|
|
10
17
|
export interface DrilldownProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
18
|
root: DrillNode;
|
|
12
19
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface NotificationEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
body?: React.ReactNode;
|
|
6
|
+
createdAt: Date | string | number;
|
|
7
|
+
read: boolean;
|
|
8
|
+
/** Where it leads. The item is a link, and opening it marks it read. */
|
|
9
|
+
href?: string;
|
|
10
|
+
/** Things to do about it ("Approve"), as Buttons. */
|
|
11
|
+
actions?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface NotificationListProps {
|
|
14
|
+
items: NotificationEntry[];
|
|
15
|
+
onMarkRead?: (ids: string[]) => void;
|
|
16
|
+
onMarkAllRead?: () => void;
|
|
17
|
+
preferencesHref?: string;
|
|
18
|
+
/** 'day' (default) puts a heading before each day. */
|
|
19
|
+
groupBy?: 'day' | 'none';
|
|
20
|
+
locale?: string;
|
|
21
|
+
/** Called when an item that links is opened. */
|
|
22
|
+
onOpen?: (item: NotificationEntry) => void;
|
|
23
|
+
/** Ids that arrived while the list wasn't showing (NotificationCenter passes them), to arrive with the afterglow. */
|
|
24
|
+
fresh?: Set<string>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The list itself, for a page or a panel. It's a record of what happened, so it lies on the ground. Unread is a mark,
|
|
28
|
+
* not a height: a dot, weight 600 and "Unread" in its name. A new notification arrives lifted and settles, as anything
|
|
29
|
+
* new does.
|
|
30
|
+
*/
|
|
31
|
+
export declare function NotificationList({ items, onMarkRead, onMarkAllRead, preferencesHref, groupBy, locale, onOpen, fresh: given }: NotificationListProps): React.JSX.Element;
|
|
32
|
+
export interface NotificationCenterProps extends NotificationListProps {
|
|
33
|
+
/** Below this width the panel is a bottom Sheet. Default 640. */
|
|
34
|
+
mobileBreakpoint?: number;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A bell with a count that opens the list. The bell is live (a ghost button), the count floats (only a count wants
|
|
39
|
+
* you), the panel floats at level 3 (a Sheet at level 4 on narrow screens), and the list in it lies on the ground.
|
|
40
|
+
* New notifications are announced, batched, whether or not the panel is open.
|
|
41
|
+
*/
|
|
42
|
+
export declare function NotificationCenter({ mobileBreakpoint, className, ...list }: NotificationCenterProps): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** Reads what was typed in the locale's own way: "1.000,5" is 1000.5 in German. Returns null for nothing, NaN for nonsense. */
|
|
3
|
+
export declare function parseNumber(text: string, locale?: string): number | null;
|
|
4
|
+
export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'size' | 'type' | 'min' | 'max' | 'step'> {
|
|
5
|
+
value?: number | null;
|
|
6
|
+
defaultValue?: number | null;
|
|
7
|
+
/** Called with the parsed value when it's committed (on blur, Enter, a step or a stepper), or null when cleared. */
|
|
8
|
+
onValueChange?: (value: number | null) => void;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Default 1. Shift+arrow, PageUp and PageDown move ten steps. */
|
|
12
|
+
step?: number;
|
|
13
|
+
/** Intl.NumberFormat options: `{ style: 'unit', unit: 'day' }`, `{ style: 'currency', currency: 'EUR' }`, `{ style: 'percent' }` (the value is a fraction). The unit is shown beside the number and spoken with it. */
|
|
14
|
+
format?: Intl.NumberFormatOptions;
|
|
15
|
+
/** Default: the browser's. Parsing follows it: "1.000,5" in de-DE. */
|
|
16
|
+
locale?: string;
|
|
17
|
+
invalid?: boolean;
|
|
18
|
+
size?: 'sm' | 'md';
|
|
19
|
+
/** The scroll wheel steps the value while the field is focused. Default false. */
|
|
20
|
+
wheel?: boolean;
|
|
21
|
+
/** The steppers' names. Default "Increase" and "Decrease". Say what: "Increase seats". */
|
|
22
|
+
incrementLabel?: string;
|
|
23
|
+
decrementLabel?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A number field: an opening that fills, with two small raised steppers in its end cap (push up, fill down). It reads
|
|
27
|
+
* what's typed in the locale's own way, clamps to min and max when committed, and is a spinbutton with its unit in
|
|
28
|
+
* aria-valuetext. The steppers aren't tab stops: the arrow keys step.
|
|
29
|
+
*/
|
|
30
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|