react-ecosphere 0.0.0-stage → 1.1.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/CHANGELOG.md +28 -0
- package/LICENSE +21 -0
- package/README.md +126 -2
- package/dist/components/actions/EcoButton.d.ts +34 -0
- package/dist/components/actions/EcoIconButton.d.ts +43 -0
- package/dist/components/actions/EcoLink.d.ts +20 -0
- package/dist/components/actions/EcoSplitButton.d.ts +28 -0
- package/dist/components/actions/index.d.ts +8 -0
- package/dist/components/charts/ChartFrame.d.ts +33 -0
- package/dist/components/charts/EcoAreaChart.d.ts +38 -0
- package/dist/components/charts/EcoBarChart.d.ts +65 -0
- package/dist/components/charts/EcoBarList.d.ts +33 -0
- package/dist/components/charts/EcoChartTooltip.d.ts +28 -0
- package/dist/components/charts/EcoDivergingBarChart.d.ts +33 -0
- package/dist/components/charts/EcoDonutChart.d.ts +27 -0
- package/dist/components/charts/EcoLineChart.d.ts +35 -0
- package/dist/components/charts/EcoPieChart.d.ts +26 -0
- package/dist/components/charts/EcoRadarChart.d.ts +31 -0
- package/dist/components/charts/EcoStepLineChart.d.ts +31 -0
- package/dist/components/charts/index.d.ts +21 -0
- package/dist/components/charts/types.d.ts +99 -0
- package/dist/components/charts/useChart.d.ts +19 -0
- package/dist/components/charts/utils.d.ts +113 -0
- package/dist/components/data/EcoChecklist.d.ts +16 -0
- package/dist/components/data/EcoDataTable.d.ts +98 -0
- package/dist/components/data/EcoFindings.d.ts +15 -0
- package/dist/components/data/EcoKpi.d.ts +26 -0
- package/dist/components/data/EcoLeaderRow.d.ts +28 -0
- package/dist/components/data/EcoListRow.d.ts +51 -0
- package/dist/components/data/EcoListRows.d.ts +6 -0
- package/dist/components/data/EcoQuestionItem.d.ts +25 -0
- package/dist/components/data/EcoRowGroup.d.ts +29 -0
- package/dist/components/data/EcoRowItem.d.ts +31 -0
- package/dist/components/data/EcoSourceRow.d.ts +21 -0
- package/dist/components/data/EcoStat.d.ts +22 -0
- package/dist/components/data/EcoTable.d.ts +97 -0
- package/dist/components/data/EcoTaskRow.d.ts +37 -0
- package/dist/components/data/EcoTaskRows.d.ts +7 -0
- package/dist/components/data/EcoTimeline.d.ts +23 -0
- package/dist/components/data/EcoTreeTable.d.ts +43 -0
- package/dist/components/data/EcoTreeView.d.ts +46 -0
- package/dist/components/data/EcoTreeViewNode.d.ts +14 -0
- package/dist/components/data/EcoValueChange.d.ts +18 -0
- package/dist/components/data/index.d.ts +39 -0
- package/dist/components/data/treeContext.d.ts +17 -0
- package/dist/components/data/types.d.ts +175 -0
- package/dist/components/display/EcoAvatar.d.ts +19 -0
- package/dist/components/display/EcoBadge.d.ts +20 -0
- package/dist/components/display/EcoEmptyState.d.ts +28 -0
- package/dist/components/display/EcoKeyValue.d.ts +24 -0
- package/dist/components/display/EcoMeter.d.ts +21 -0
- package/dist/components/display/EcoPlaceholder.d.ts +19 -0
- package/dist/components/display/EcoPlanCard.d.ts +32 -0
- package/dist/components/display/EcoScore.d.ts +14 -0
- package/dist/components/display/EcoSkeleton.d.ts +32 -0
- package/dist/components/display/EcoTag.d.ts +8 -0
- package/dist/components/display/EcoTags.d.ts +9 -0
- package/dist/components/display/index.d.ts +23 -0
- package/dist/components/display/types.d.ts +17 -0
- package/dist/components/feedback/EcoComposeModal.d.ts +80 -0
- package/dist/components/feedback/EcoConfirmHost.d.ts +9 -0
- package/dist/components/feedback/EcoDialog.d.ts +58 -0
- package/dist/components/feedback/EcoDrawer.d.ts +41 -0
- package/dist/components/feedback/EcoMenu.d.ts +76 -0
- package/dist/components/feedback/EcoNotice.d.ts +38 -0
- package/dist/components/feedback/EcoNotifications.d.ts +52 -0
- package/dist/components/feedback/EcoSpinner.d.ts +29 -0
- package/dist/components/feedback/EcoToast.d.ts +35 -0
- package/dist/components/feedback/EcoToaster.d.ts +9 -0
- package/dist/components/feedback/EcoTooltip.d.ts +26 -0
- package/dist/components/feedback/index.d.ts +25 -0
- package/dist/components/feedback/types.d.ts +94 -0
- package/dist/components/feedback/useConfirm.d.ts +43 -0
- package/dist/components/feedback/useToast.d.ts +38 -0
- package/dist/components/forms/EcoCheckbox.d.ts +28 -0
- package/dist/components/forms/EcoCheckboxGroup.d.ts +27 -0
- package/dist/components/forms/EcoChoicePills.d.ts +27 -0
- package/dist/components/forms/EcoComposer.d.ts +45 -0
- package/dist/components/forms/EcoCycleSelect.d.ts +24 -0
- package/dist/components/forms/EcoDatePicker.d.ts +42 -0
- package/dist/components/forms/EcoEmailField.d.ts +13 -0
- package/dist/components/forms/EcoField.d.ts +34 -0
- package/dist/components/forms/EcoFieldGrid.d.ts +9 -0
- package/dist/components/forms/EcoFileUpload.d.ts +48 -0
- package/dist/components/forms/EcoNumberField.d.ts +27 -0
- package/dist/components/forms/EcoOtpField.d.ts +37 -0
- package/dist/components/forms/EcoPhoneField.d.ts +38 -0
- package/dist/components/forms/EcoSearchField.d.ts +36 -0
- package/dist/components/forms/EcoSegmented.d.ts +23 -0
- package/dist/components/forms/EcoSelect.d.ts +82 -0
- package/dist/components/forms/EcoSelectButton.d.ts +43 -0
- package/dist/components/forms/EcoSwitch.d.ts +34 -0
- package/dist/components/forms/EcoTextField.d.ts +32 -0
- package/dist/components/forms/EcoTextarea.d.ts +20 -0
- package/dist/components/forms/EcoTimePicker.d.ts +39 -0
- package/dist/components/forms/index.d.ts +43 -0
- package/dist/components/forms/types.d.ts +47 -0
- package/dist/components/general/EcoAuroraBackground.d.ts +13 -0
- package/dist/components/general/EcoIcon.d.ts +13 -0
- package/dist/components/general/index.d.ts +4 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/layout/EcoAppShell.d.ts +46 -0
- package/dist/components/layout/EcoCard.d.ts +29 -0
- package/dist/components/layout/EcoDivider.d.ts +18 -0
- package/dist/components/layout/EcoHero.d.ts +40 -0
- package/dist/components/layout/EcoHeroPanelRow.d.ts +18 -0
- package/dist/components/layout/EcoMasthead.d.ts +31 -0
- package/dist/components/layout/EcoNavItem.d.ts +40 -0
- package/dist/components/layout/EcoNavSection.d.ts +11 -0
- package/dist/components/layout/EcoPageGrid.d.ts +13 -0
- package/dist/components/layout/EcoPageHeader.d.ts +20 -0
- package/dist/components/layout/EcoSection.d.ts +17 -0
- package/dist/components/layout/EcoThread.d.ts +66 -0
- package/dist/components/layout/EcoTimetable.d.ts +32 -0
- package/dist/components/layout/index.d.ts +27 -0
- package/dist/components/layout/types.d.ts +81 -0
- package/dist/components/navigation/EcoDisclosure.d.ts +29 -0
- package/dist/components/navigation/EcoDisclosureGroup.d.ts +14 -0
- package/dist/components/navigation/EcoFilterChips.d.ts +23 -0
- package/dist/components/navigation/EcoPagination.d.ts +40 -0
- package/dist/components/navigation/EcoProgressSteps.d.ts +24 -0
- package/dist/components/navigation/EcoTabs.d.ts +33 -0
- package/dist/components/navigation/disclosure.d.ts +9 -0
- package/dist/components/navigation/index.d.ts +13 -0
- package/dist/components/navigation/types.d.ts +66 -0
- package/dist/ecosphere.css +5789 -0
- package/dist/fonts/GoogleSans.woff2 +0 -0
- package/dist/fonts/fraunces-latin-ext-opsz-normal.woff2 +0 -0
- package/dist/fonts/fraunces-latin-opsz-normal.woff2 +0 -0
- package/dist/fonts/fraunces-vietnamese-opsz-normal.woff2 +0 -0
- package/dist/fonts/remixicon.woff2 +0 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useEcoId.d.ts +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/internal/Portal.d.ts +8 -0
- package/dist/internal/attrs.d.ts +5 -0
- package/dist/internal/cx.d.ts +4 -0
- package/dist/internal/data-slot.d.ts +16 -0
- package/dist/internal/feedback-node.d.ts +8 -0
- package/dist/internal/feedback-value.d.ts +10 -0
- package/dist/internal/forms-hooks.d.ts +14 -0
- package/dist/internal/forms-popover.d.ts +11 -0
- package/dist/internal/layout-watch.d.ts +6 -0
- package/dist/internal/overlay.d.ts +28 -0
- package/dist/internal/useControllableState.d.ts +8 -0
- package/dist/internal/useIsClient.d.ts +5 -0
- package/dist/react-ecosphere.cjs +1 -0
- package/dist/react-ecosphere.js +8710 -0
- package/dist/tokens.json +690 -0
- package/dist/types.d.ts +15 -0
- package/package.json +66 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { IconName } from '../../types';
|
|
3
|
+
export interface EcoEmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "children"> {
|
|
4
|
+
/** RemixIcon name in the round well. */
|
|
5
|
+
icon?: IconName;
|
|
6
|
+
/** Headline. Pass a node for the one `em` that carries the accent: `<>Nothing here <em>yet</em>.</>`. */
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
/** The help line; `children` override it. */
|
|
9
|
+
text?: string;
|
|
10
|
+
/** Primary action label. The `action` node overrides the button. */
|
|
11
|
+
actionLabel?: string;
|
|
12
|
+
actionIcon?: IconName;
|
|
13
|
+
/** Heading level for the headline. */
|
|
14
|
+
as?: "h2" | "h3" | "h4";
|
|
15
|
+
/** Replaces the primary button (inside `tries`). */
|
|
16
|
+
action?: ReactNode;
|
|
17
|
+
/** The primary button was pressed. */
|
|
18
|
+
onAction?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* EmptyState — icon, display headline, one line of help, one primary. Two jobs need different
|
|
23
|
+
* copy and a different button: a list empty because nothing exists yet, and a list a filter
|
|
24
|
+
* emptied. One `em` in the headline carries the accent (pass `title` as a node for it). The help
|
|
25
|
+
* line says what will fill the space or what to change — never "No data available". Inside a
|
|
26
|
+
* card or section use one `body-sm` line instead; a full empty state there is out of proportion.
|
|
27
|
+
*/
|
|
28
|
+
export declare function EcoEmptyState({ icon, title, text, actionLabel, actionIcon, as: As, action, onAction, className, children, ...rest }: EcoEmptyStateProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { KeyValueItem } from './types';
|
|
3
|
+
export interface EcoKeyValueProps extends Omit<HTMLAttributes<HTMLDListElement>, "title" | "children"> {
|
|
4
|
+
/** The facts, already formatted. `children` (raw `dt`/`dd`) override them. */
|
|
5
|
+
items?: KeyValueItem[];
|
|
6
|
+
/** Facts grid (`kv--grid`). */
|
|
7
|
+
grid?: boolean;
|
|
8
|
+
/** Section heading (`kv__h`) above the list. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Heading level for `title`. */
|
|
11
|
+
as?: "h2" | "h3" | "h4";
|
|
12
|
+
/** Screen-reader words for an empty value. */
|
|
13
|
+
emptyText?: string;
|
|
14
|
+
/** Raw `dt`/`dd` pairs, in place of `items`. */
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* KeyValue — a real `<dl>` for the facts of one record: term muted, value primary. Plain `kv`
|
|
19
|
+
* for up to about six facts; `grid` (`kv--grid`) for a full record, term over value in columns.
|
|
20
|
+
* Empty values show a muted dash with "Not recorded" for screen readers — never a blank `dd`.
|
|
21
|
+
* Booleans read "Yes" or "No". Keep it to facts that are read, not edited.
|
|
22
|
+
* `className` and other attributes land on the `dl`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function EcoKeyValue({ items, grid, title, as: As, emptyText, className, children, ...rest }: EcoKeyValueProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { MeterForm, MeterState } from './types';
|
|
3
|
+
export interface EcoMeterProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
4
|
+
/** Proportion, 0–100. */
|
|
5
|
+
value: number;
|
|
6
|
+
form?: MeterForm;
|
|
7
|
+
state?: MeterState;
|
|
8
|
+
/** Ring caption below the figure ("Attendance"). */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Show the figure beside a bar. Off only when the figure is printed elsewhere in the row. */
|
|
11
|
+
showValue?: boolean;
|
|
12
|
+
/** Replaces the figure. */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Meter — one proportion, as a 6px bar (one column of many: a table cell, beside a label, down a
|
|
17
|
+
* list) or a 92px ring (a single figure leading a card). Always paired with its figure. `state`
|
|
18
|
+
* colours the fill by state, not by value: use it only where high and low genuinely mean good
|
|
19
|
+
* and bad.
|
|
20
|
+
*/
|
|
21
|
+
export declare function EcoMeter({ value, form, state, label, showValue, className, style, children, ...rest }: EcoMeterProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface EcoPlaceholderProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
3
|
+
/** CSS width (e.g. "120px"). Omit to size it from the layout. */
|
|
4
|
+
width?: string;
|
|
5
|
+
/** CSS height. */
|
|
6
|
+
height?: string;
|
|
7
|
+
/** CSS border radius, e.g. "var(--r-md)". */
|
|
8
|
+
radius?: string;
|
|
9
|
+
/** Render the `scan` viewport with this caption ("Scanned sheet · page 2 of 4"). */
|
|
10
|
+
caption?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Placeholder — the `ph` hatch for space that is empty (a book spine, an image slot), and with
|
|
15
|
+
* `caption` the `scan` viewport a scanned page sits in, captioned on an ink plate. A hatch reads
|
|
16
|
+
* as "nothing is here"; use `EcoSkeleton` for "something is loading". Put the page and question
|
|
17
|
+
* in the caption so a marker knows which sheet a cropped answer came from.
|
|
18
|
+
*/
|
|
19
|
+
export declare function EcoPlaceholder({ width, height, radius, caption, className, style, children, ...rest }: EcoPlaceholderProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
export interface EcoPlanCardProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "children"> {
|
|
3
|
+
/** Tier name ("Foundation"). */
|
|
4
|
+
eyebrow?: string;
|
|
5
|
+
/** The promise ("Practice that marks itself"). */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Price figure ("₹499"). */
|
|
8
|
+
price: string;
|
|
9
|
+
/** Period beside the price ("/ month"). */
|
|
10
|
+
period?: string;
|
|
11
|
+
/**
|
|
12
|
+
* What is included. An array of strings renders one checked `li` per entry; any other node
|
|
13
|
+
* (your own `<li>` elements) replaces the list items.
|
|
14
|
+
*/
|
|
15
|
+
features?: string[] | ReactNode;
|
|
16
|
+
/** Button label. The `action` node overrides the button. */
|
|
17
|
+
actionLabel?: string;
|
|
18
|
+
/** The recommended plan (`plan--pick`, primary button). */
|
|
19
|
+
picked?: boolean;
|
|
20
|
+
/** Replaces the button (inside `plan__f`). */
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
/** The plan's button was pressed. */
|
|
23
|
+
onChoose?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* PlanCard — a price card: eyebrow (what it is filed under), a promise as the title (what is
|
|
27
|
+
* being bought), the price with its period, what is included, and one action. `picked` marks the
|
|
28
|
+
* recommended plan with the selection ring and makes its button the one primary in the set —
|
|
29
|
+
* exactly one of each. Lead every list after the first with "Everything in <previous>".
|
|
30
|
+
* Lay several out in a `cg cg--3` grid; `plan__f` keeps the buttons on one baseline.
|
|
31
|
+
*/
|
|
32
|
+
export declare function EcoPlanCard({ eyebrow, title, price, period, features, actionLabel, picked, action, onChoose, className, ...rest }: EcoPlanCardProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ScoreLevel } from './types';
|
|
3
|
+
export interface EcoScoreProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
4
|
+
/** Step on the scale: 1 is the best match, 6 the weakest. */
|
|
5
|
+
level: ScoreLevel;
|
|
6
|
+
/** The figure. A number is shown as a percentage; `children` override it. */
|
|
7
|
+
value?: number | string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Score — a match-score pill on the six-step scale, `sc1` (best) to `sc6`. Its figure always
|
|
12
|
+
* travels with the colour, so the state survives for anyone who cannot separate the hues.
|
|
13
|
+
*/
|
|
14
|
+
export declare function EcoScore({ level, value, className, children, ...rest }: EcoScoreProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SkeletonLayout, SkeletonShape } from './types';
|
|
3
|
+
export interface EcoSkeletonProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
4
|
+
shape?: SkeletonShape;
|
|
5
|
+
/** Rows (`row`), lines (`lines`) or bars (`bar`) to draw. */
|
|
6
|
+
count?: number;
|
|
7
|
+
/** CSS width of a `bar` or `circle`. */
|
|
8
|
+
width?: string;
|
|
9
|
+
/** CSS height of a `bar` or `circle`. */
|
|
10
|
+
height?: string;
|
|
11
|
+
/** On a filled ground (`skel--onfill`). */
|
|
12
|
+
onfill?: boolean;
|
|
13
|
+
/** What is loading ("Loading invoices…"). Wraps the shapes in a `loading` status region. */
|
|
14
|
+
label?: string;
|
|
15
|
+
layout?: SkeletonLayout;
|
|
16
|
+
/** In a `block` layout, lead with a 24px heading bar about 35% wide. */
|
|
17
|
+
heading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Skeleton — loading placeholders shaped like the content they stand in for: rows for a list,
|
|
21
|
+
* bars for a table, a block for a chart. A grey box reads as "something is loading"; use
|
|
22
|
+
* `EcoPlaceholder` (a hatch) for space that is simply empty.
|
|
23
|
+
*
|
|
24
|
+
* Give it a `label` to make it the loading region itself (`loading`, `role="status"`):
|
|
25
|
+
* `layout="block"` for a view or panel (with a hidden status line), `"inline"` inside a card or
|
|
26
|
+
* drawer section (with a visible `body-sm` line), `"line"` for one form field's options.
|
|
27
|
+
* Set `aria-busy="true"` on the region whose content is being replaced.
|
|
28
|
+
*
|
|
29
|
+
* `className`, `style` and other attributes land on the status region, so only when `label` is
|
|
30
|
+
* set: an unlabelled skeleton is just its shapes, with no wrapper element.
|
|
31
|
+
*/
|
|
32
|
+
export declare function EcoSkeleton({ shape, count, width, height, onfill, label, layout, heading, className, ...rest }: EcoSkeletonProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface EcoTagProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
3
|
+
/** Text label; `children` override it. */
|
|
4
|
+
label?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Tag — one pill in a tag cloud (`tag`), e.g. a shared group or school. Sits inside `EcoTags`. */
|
|
8
|
+
export declare function EcoTag({ label, className, children, ...rest }: EcoTagProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface EcoTagsProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
+
/** Tag labels; `children` override them. */
|
|
4
|
+
items?: string[];
|
|
5
|
+
/** `EcoTag` children, in place of `items`. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Tags — a wrapping tag cloud (`tags`), e.g. "what you have in common". Pass `items` or `EcoTag` children. */
|
|
9
|
+
export declare function EcoTags({ items, className, children, ...rest }: EcoTagsProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { EcoBadge } from './EcoBadge';
|
|
2
|
+
export type { EcoBadgeProps } from './EcoBadge';
|
|
3
|
+
export { EcoAvatar } from './EcoAvatar';
|
|
4
|
+
export type { EcoAvatarProps } from './EcoAvatar';
|
|
5
|
+
export { EcoScore } from './EcoScore';
|
|
6
|
+
export type { EcoScoreProps } from './EcoScore';
|
|
7
|
+
export { EcoTag } from './EcoTag';
|
|
8
|
+
export type { EcoTagProps } from './EcoTag';
|
|
9
|
+
export { EcoTags } from './EcoTags';
|
|
10
|
+
export type { EcoTagsProps } from './EcoTags';
|
|
11
|
+
export { EcoSkeleton } from './EcoSkeleton';
|
|
12
|
+
export type { EcoSkeletonProps } from './EcoSkeleton';
|
|
13
|
+
export { EcoEmptyState } from './EcoEmptyState';
|
|
14
|
+
export type { EcoEmptyStateProps } from './EcoEmptyState';
|
|
15
|
+
export { EcoPlaceholder } from './EcoPlaceholder';
|
|
16
|
+
export type { EcoPlaceholderProps } from './EcoPlaceholder';
|
|
17
|
+
export { EcoMeter } from './EcoMeter';
|
|
18
|
+
export type { EcoMeterProps } from './EcoMeter';
|
|
19
|
+
export { EcoKeyValue } from './EcoKeyValue';
|
|
20
|
+
export type { EcoKeyValueProps } from './EcoKeyValue';
|
|
21
|
+
export { EcoPlanCard } from './EcoPlanCard';
|
|
22
|
+
export type { EcoPlanCardProps } from './EcoPlanCard';
|
|
23
|
+
export type * from './types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Types for the display components (Badge, Avatar, Score, Skeleton, Meter, KeyValue…). */
|
|
2
|
+
export type AvatarSize = "xs" | "sm" | "md" | "lg";
|
|
3
|
+
/** Score step: 1 is the best match, 6 the weakest (`sc1`…`sc6`). */
|
|
4
|
+
export type ScoreLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
export type SkeletonShape = "bar" | "circle" | "row" | "lines";
|
|
6
|
+
/** How a labelled skeleton is framed: a whole region, inside a card/section, or one form line. */
|
|
7
|
+
export type SkeletonLayout = "block" | "inline" | "line";
|
|
8
|
+
export type MeterForm = "bar" | "ring";
|
|
9
|
+
/** Colours the fill by state, not by value. Omit it for the neutral accent fill. */
|
|
10
|
+
export type MeterState = "ok" | "warn" | "bad";
|
|
11
|
+
/** One fact in a key–value list. `null`/`undefined`/`""` renders the muted "Not recorded" dash. */
|
|
12
|
+
export interface KeyValueItem {
|
|
13
|
+
term: string;
|
|
14
|
+
value?: string | number | boolean | null;
|
|
15
|
+
/** Tabular figures (`num`) for numbers and identifiers. */
|
|
16
|
+
num?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EcoComposeFormat } from './types';
|
|
3
|
+
/** What `onSend` receives: the draft's fields. */
|
|
4
|
+
export interface EcoComposeMessage {
|
|
5
|
+
to: string;
|
|
6
|
+
cc: string;
|
|
7
|
+
bcc: string;
|
|
8
|
+
subject: string;
|
|
9
|
+
body: string;
|
|
10
|
+
}
|
|
11
|
+
export interface EcoComposeModalProps {
|
|
12
|
+
title?: string;
|
|
13
|
+
toPlaceholder?: string;
|
|
14
|
+
subjectPlaceholder?: string;
|
|
15
|
+
bodyPlaceholder?: string;
|
|
16
|
+
sendLabel?: string;
|
|
17
|
+
/** Show the schedule-send chevron beside Send (calls `onSchedule`). */
|
|
18
|
+
schedulable?: boolean;
|
|
19
|
+
/** Scheduled time shown in the footer (`cwhen`), e.g. "Tomorrow, 09:00". */
|
|
20
|
+
when?: string;
|
|
21
|
+
/** Allow sending even when To or the message is empty. */
|
|
22
|
+
sendEnabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The send is running: Send shows a spinner (`aria-busy`, clicks ignored), the schedule
|
|
25
|
+
* chevron is held, and ×, Discard and Escape do nothing. Close the window yourself when it
|
|
26
|
+
* succeeds; clear the flag on failure so the draft stays and the user can retry.
|
|
27
|
+
*/
|
|
28
|
+
sendLoading?: boolean;
|
|
29
|
+
/** Close on a scrim click (default false: a draft is not thrown away by a stray click). */
|
|
30
|
+
dismissible?: boolean;
|
|
31
|
+
/** Whether the window is open (controlled; v-model:open). */
|
|
32
|
+
open?: boolean;
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
35
|
+
/** The To field (controlled; v-model:to). */
|
|
36
|
+
to?: string;
|
|
37
|
+
defaultTo?: string;
|
|
38
|
+
onToChange?: (to: string) => void;
|
|
39
|
+
/** The Cc field (controlled; v-model:cc). */
|
|
40
|
+
cc?: string;
|
|
41
|
+
defaultCc?: string;
|
|
42
|
+
onCcChange?: (cc: string) => void;
|
|
43
|
+
/** The Bcc field (controlled; v-model:bcc). */
|
|
44
|
+
bcc?: string;
|
|
45
|
+
defaultBcc?: string;
|
|
46
|
+
onBccChange?: (bcc: string) => void;
|
|
47
|
+
/** The Subject field (controlled; v-model:subject). */
|
|
48
|
+
subject?: string;
|
|
49
|
+
defaultSubject?: string;
|
|
50
|
+
onSubjectChange?: (subject: string) => void;
|
|
51
|
+
/** The message (controlled; v-model:body). */
|
|
52
|
+
body?: string;
|
|
53
|
+
defaultBody?: string;
|
|
54
|
+
onBodyChange?: (body: string) => void;
|
|
55
|
+
/** Send was pressed with a sendable draft. */
|
|
56
|
+
onSend?: (message: EcoComposeMessage) => void;
|
|
57
|
+
/** The schedule chevron was pressed. */
|
|
58
|
+
onSchedule?: () => void;
|
|
59
|
+
/** The attach button was pressed. */
|
|
60
|
+
onAttach?: () => void;
|
|
61
|
+
/** Discard was pressed (the window then closes). */
|
|
62
|
+
onDiscard?: () => void;
|
|
63
|
+
/** A formatting-bar button was pressed. */
|
|
64
|
+
onFormat?: (kind: EcoComposeFormat) => void;
|
|
65
|
+
/** Closed by any route. */
|
|
66
|
+
onClose?: () => void;
|
|
67
|
+
/** Replaces the To input, e.g. with a recipient picker (the `#to` slot). */
|
|
68
|
+
toField?: ReactNode;
|
|
69
|
+
/** Record context in the `crail` side panel (the `#rail` slot; adds `has-rail`). */
|
|
70
|
+
rail?: ReactNode;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* ComposeModal — the centred new-message window for long-form composition: To (with Cc and
|
|
74
|
+
* Bcc on demand), Subject, the message, a formatting bar, and a footer with Send (and an
|
|
75
|
+
* optional schedule split), attach and discard. Put record context in `rail`.
|
|
76
|
+
* Use Dialog for short decisions and Drawer for a record read beside the list.
|
|
77
|
+
* While the message goes out, set `sendLoading`: Send shows its spinner and the window stays
|
|
78
|
+
* open (×, Discard and Escape do nothing) until you close it or clear the flag.
|
|
79
|
+
*/
|
|
80
|
+
export declare function EcoComposeModal({ title, toPlaceholder, subjectPlaceholder, bodyPlaceholder, sendLabel, schedulable, when, sendEnabled, sendLoading, dismissible, open: openProp, defaultOpen, onOpenChange, to: toProp, defaultTo, onToChange, cc: ccProp, defaultCc, onCcChange, bcc: bccProp, defaultBcc, onBccChange, subject: subjectProp, defaultSubject, onSubjectChange, body: bodyProp, defaultBody, onBodyChange, onSend, onSchedule, onAttach, onDiscard, onFormat, onClose, toField, rail, }: EcoComposeModalProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** `EcoConfirmHost` takes no props: it renders what `useConfirm()` asks. */
|
|
2
|
+
export type EcoConfirmHostProps = Record<string, never>;
|
|
3
|
+
/**
|
|
4
|
+
* ConfirmHost — shows what `useConfirm()` asks, one question at a time, as an `EcoDialog` with no
|
|
5
|
+
* body: the title asks, the subtitle says what happens (for a deletion, what is lost), and the
|
|
6
|
+
* commit button names the consequence. Mount it once near the root of the app, beside `EcoToaster`.
|
|
7
|
+
* Use it for yes-or-no decisions only; a decision that needs input is an `EcoDialog` of its own.
|
|
8
|
+
*/
|
|
9
|
+
export declare function EcoConfirmHost(): import('react').JSX.Element | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** What `renderFooter` receives: the dialog's own close and cancel routes. */
|
|
3
|
+
export interface EcoDialogFooterScope {
|
|
4
|
+
/** Close the dialog (calls `onClose`). Held while `confirmLoading`. */
|
|
5
|
+
close: () => void;
|
|
6
|
+
/** Call `onCancel`, then close. Held while `confirmLoading`. */
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface EcoDialogProps {
|
|
10
|
+
/** The title (`dlg__t`); it labels the dialog. Text, or a node. */
|
|
11
|
+
title: ReactNode;
|
|
12
|
+
/** One line of what the dialog is for (`dlg__s`). For a destructive dialog: what is lost. */
|
|
13
|
+
subtitle?: ReactNode;
|
|
14
|
+
/** The commit button becomes `btn--danger`. */
|
|
15
|
+
danger?: boolean;
|
|
16
|
+
/** 720px panel for a two-column form (`dlg--wide`). */
|
|
17
|
+
wide?: boolean;
|
|
18
|
+
/** Commit button label. Omit to render no default footer buttons. */
|
|
19
|
+
confirmLabel?: string;
|
|
20
|
+
cancelLabel?: string;
|
|
21
|
+
confirmDisabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The commit is running: the commit button shows `loading` (spinner, `aria-busy`, clicks
|
|
24
|
+
* ignored), Cancel and × are disabled, and Escape and the scrim do nothing. Set `open` to
|
|
25
|
+
* false yourself when it succeeds; clear the flag on failure so the user can retry or cancel.
|
|
26
|
+
*/
|
|
27
|
+
confirmLoading?: boolean;
|
|
28
|
+
/** Left-hand footer note (`dlg__n`), e.g. "* Required". Without it the footer uses `dlg__f--end`. */
|
|
29
|
+
note?: ReactNode;
|
|
30
|
+
/** Close on a scrim click (default true). */
|
|
31
|
+
dismissible?: boolean;
|
|
32
|
+
closeLabel?: string;
|
|
33
|
+
/** Whether the dialog is open (controlled; v-model:open). */
|
|
34
|
+
open?: boolean;
|
|
35
|
+
/** Initial open state when uncontrolled. */
|
|
36
|
+
defaultOpen?: boolean;
|
|
37
|
+
/** The open state changed (Escape, ×, the scrim, Cancel). */
|
|
38
|
+
onOpenChange?: (open: boolean) => void;
|
|
39
|
+
/** The commit button was pressed. */
|
|
40
|
+
onConfirm?: () => void;
|
|
41
|
+
/** Cancel was pressed. */
|
|
42
|
+
onCancel?: () => void;
|
|
43
|
+
/** Closed by any route. */
|
|
44
|
+
onClose?: () => void;
|
|
45
|
+
/** The body (`dlg__body`). */
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
/** Replaces the footer's buttons (the `#footer` slot). */
|
|
48
|
+
renderFooter?: (scope: EcoDialogFooterScope) => ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Dialog — the centred modal: a title with one line of what it is for, a scrolling body,
|
|
52
|
+
* and a footer whose last button commits. Name the consequence on the commit button
|
|
53
|
+
* ("Add destination", "Delete destination"), never "OK". A destructive dialog puts
|
|
54
|
+
* `btn--danger` in that position and its subtitle says what is lost.
|
|
55
|
+
* While the commit runs, set `confirmLoading`: the commit button shows its spinner and the dialog
|
|
56
|
+
* stays put (Cancel, ×, Escape and the scrim do nothing) until you close it or clear the flag.
|
|
57
|
+
*/
|
|
58
|
+
export declare function EcoDialog({ title, subtitle, danger, wide, confirmLabel, cancelLabel, confirmDisabled, confirmLoading, note, dismissible, closeLabel, open: openProp, defaultOpen, onOpenChange, onConfirm, onCancel, onClose, children, renderFooter, }: EcoDialogProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** What a function child of `EcoDrawer` receives. */
|
|
3
|
+
export interface EcoDrawerScope {
|
|
4
|
+
/** Close the drawer (calls `onClose`). */
|
|
5
|
+
close: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface EcoDrawerProps {
|
|
8
|
+
/** The title (`drawer__t`); it labels the dialog. Text, or a node. */
|
|
9
|
+
title: ReactNode;
|
|
10
|
+
/** Short figure beside the title (`note`), e.g. "6 people". */
|
|
11
|
+
note?: ReactNode;
|
|
12
|
+
/** Close on a scrim click (default true). */
|
|
13
|
+
dismissible?: boolean;
|
|
14
|
+
closeLabel?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Panel width: a number of px or any CSS length (`"40rem"`). Set through `--drawer-w`, so it
|
|
17
|
+
* never exceeds the viewport and screens below 1024px still get the full-width drawer.
|
|
18
|
+
* Default `min(64vw, 900px)`.
|
|
19
|
+
*/
|
|
20
|
+
width?: number | string;
|
|
21
|
+
/** Whether the drawer is open (controlled; v-model:open). */
|
|
22
|
+
open?: boolean;
|
|
23
|
+
/** Initial open state when uncontrolled. */
|
|
24
|
+
defaultOpen?: boolean;
|
|
25
|
+
/** The open state changed (Escape, ×, the scrim). */
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
/** Closed by any route. */
|
|
28
|
+
onClose?: () => void;
|
|
29
|
+
/** Extra head controls before the × button (the `#actions` slot). */
|
|
30
|
+
actions?: ReactNode;
|
|
31
|
+
/** The body (`drawer__body`), or a function of `{ close }`. */
|
|
32
|
+
children?: ReactNode | ((scope: EcoDrawerScope) => ReactNode);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drawer — a right-side panel for a record or a queue you read beside the list rather than
|
|
36
|
+
* instead of it ("Reminders due"). Modal: Escape and the scrim close it, focus stays inside
|
|
37
|
+
* while it is open and returns to the control that opened it. Leave `width` unset unless the
|
|
38
|
+
* content has a natural width (a short form is narrower, a record with a wide table wider);
|
|
39
|
+
* below 1024px the drawer spans the screen whatever `width` says.
|
|
40
|
+
*/
|
|
41
|
+
export declare function EcoDrawer({ title, note, dismissible, closeLabel, width, open: openProp, defaultOpen, onOpenChange, onClose, actions, children, }: EcoDrawerProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { HTMLAttributes, KeyboardEvent, ReactNode } from 'react';
|
|
2
|
+
import { EcoMenuItem } from './types';
|
|
3
|
+
type MenuValue = string | number;
|
|
4
|
+
/** Props to spread on your trigger button (`{...attrs}`). */
|
|
5
|
+
export interface EcoMenuTriggerAttrs {
|
|
6
|
+
id: string;
|
|
7
|
+
"aria-haspopup": "menu";
|
|
8
|
+
"aria-expanded": "true" | "false";
|
|
9
|
+
"aria-controls": string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
/** What `renderTrigger` receives. */
|
|
14
|
+
export interface EcoMenuTriggerScope {
|
|
15
|
+
attrs: EcoMenuTriggerAttrs;
|
|
16
|
+
open: boolean;
|
|
17
|
+
toggle: () => void;
|
|
18
|
+
}
|
|
19
|
+
/** What a function child and `renderFoot` receive. */
|
|
20
|
+
export interface EcoMenuScope {
|
|
21
|
+
/** Close the menu; focus returns to the trigger unless `restore` is false. */
|
|
22
|
+
close: (restore?: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
/** The methods on an `EcoMenu` ref. */
|
|
25
|
+
export interface EcoMenuHandle {
|
|
26
|
+
/** Open, and move focus to the first (or last) entry, or nowhere. */
|
|
27
|
+
show: (focus?: "first" | "last" | "none") => void;
|
|
28
|
+
/** Close; focus returns to the trigger unless `restore` is false. */
|
|
29
|
+
close: (restore?: boolean) => void;
|
|
30
|
+
toggle: () => void;
|
|
31
|
+
}
|
|
32
|
+
export interface EcoMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "defaultChecked" | "children"> {
|
|
33
|
+
/** Entries; or use `children` for hand-written `menu__opt` buttons. */
|
|
34
|
+
items?: EcoMenuItem[];
|
|
35
|
+
/** Align to the trigger's right edge (`menu--right`). */
|
|
36
|
+
align?: "left" | "right";
|
|
37
|
+
/** 320px wide (`menu--wide`). */
|
|
38
|
+
wide?: boolean;
|
|
39
|
+
/** Long checklist that scrolls under a fixed `menu__foot` (`menu--scroll`). */
|
|
40
|
+
scroll?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Uppercase caption at the top: a label renders `menu__head`; any other node replaces it (the
|
|
43
|
+
* `#head` slot, e.g. a `menu__who` block).
|
|
44
|
+
*/
|
|
45
|
+
head?: ReactNode;
|
|
46
|
+
/** Accessible name when the trigger does not label the menu. */
|
|
47
|
+
label?: string;
|
|
48
|
+
/** Whether the menu is open (controlled; v-model:open). */
|
|
49
|
+
open?: boolean;
|
|
50
|
+
defaultOpen?: boolean;
|
|
51
|
+
onOpenChange?: (open: boolean) => void;
|
|
52
|
+
/** Values of the checked `checkbox` entries (controlled; v-model:checked). */
|
|
53
|
+
checked?: MenuValue[];
|
|
54
|
+
defaultChecked?: MenuValue[];
|
|
55
|
+
onCheckedChange?: (checked: MenuValue[]) => void;
|
|
56
|
+
/** Value of the chosen `radio` entry (controlled; v-model:selected). */
|
|
57
|
+
selected?: MenuValue;
|
|
58
|
+
defaultSelected?: MenuValue;
|
|
59
|
+
onSelectedChange?: (selected: MenuValue | undefined) => void;
|
|
60
|
+
/** An entry was chosen. */
|
|
61
|
+
onSelect?: (item: EcoMenuItem) => void;
|
|
62
|
+
/** The control that opens the menu (the `#trigger` slot): spread `attrs` on it. */
|
|
63
|
+
renderTrigger?: (scope: EcoMenuTriggerScope) => ReactNode;
|
|
64
|
+
/** `menu__foot` content (split layout unless `scroll`). */
|
|
65
|
+
renderFoot?: (scope: EcoMenuScope) => ReactNode;
|
|
66
|
+
/** Hand-written entries after `items`, or a function of `{ close }`. */
|
|
67
|
+
children?: ReactNode | ((scope: EcoMenuScope) => ReactNode);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Menu — a popup list anchored to the control that opened it: actions, a checklist,
|
|
71
|
+
* a single choice with a tick, or a long checklist that scrolls under a fixed footer.
|
|
72
|
+
* Actions close the menu; checklist entries toggle without closing. A menu is never the
|
|
73
|
+
* only way to reach something the page needs often.
|
|
74
|
+
*/
|
|
75
|
+
export declare const EcoMenu: import('react').ForwardRefExoticComponent<EcoMenuProps & import('react').RefAttributes<EcoMenuHandle>>;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { IconName } from '../../types';
|
|
3
|
+
import { EcoNoticeTone } from './types';
|
|
4
|
+
export interface EcoNoticeProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "children"> {
|
|
5
|
+
/** The fact, set in bold ("You have used all 20 requests on your plan today."). */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** What it means; `children` override it. */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Status colour of the stripe, icon and action link. `warning` is the original look. */
|
|
10
|
+
tone?: EcoNoticeTone;
|
|
11
|
+
/** Leading icon; defaults to the tone's (`information-line`, `checkbox-circle-line`, `close-circle-line`). */
|
|
12
|
+
icon?: IconName;
|
|
13
|
+
/**
|
|
14
|
+
* The action: a label renders the action link (calls `onAction`); any other node replaces the
|
|
15
|
+
* link (the `#action` slot).
|
|
16
|
+
*/
|
|
17
|
+
action?: ReactNode;
|
|
18
|
+
/** Adds a small × button that calls `onDismiss`; the parent removes the notice. */
|
|
19
|
+
dismissible?: boolean;
|
|
20
|
+
/** Accessible name of the × button. */
|
|
21
|
+
dismissLabel?: string;
|
|
22
|
+
/** The action link was pressed. */
|
|
23
|
+
onAction?: () => void;
|
|
24
|
+
/** The × was pressed. */
|
|
25
|
+
onDismiss?: () => void;
|
|
26
|
+
/** Replaces `text` (the default slot). */
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Notice — an inline plan or limit notice: an icon, a bold fact then what it means, and at most
|
|
31
|
+
* one action link. The row aligns to the top so the icon sits with the first line; the action
|
|
32
|
+
* centres itself. Vertical spacing is the parent's job (no outer margin). `tone` colours the
|
|
33
|
+
* stripe, icon and action: `warning` (the default) for limits, `info` for neutral news,
|
|
34
|
+
* `success` for something done, `danger` for something that failed or cannot be undone. Let the
|
|
35
|
+
* words carry the meaning too; never rely on the colour alone. `dismissible` adds a × that only
|
|
36
|
+
* calls `onDismiss`: the parent removes the notice and remembers that it did.
|
|
37
|
+
*/
|
|
38
|
+
export declare function EcoNotice({ title, text, tone, icon, action, dismissible, dismissLabel, onAction, onDismiss, children, className, ...rest }: EcoNoticeProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { EcoNotification, EcoNotificationTab } from './types';
|
|
3
|
+
/** Props to spread on your own trigger (`{...attrs}`). */
|
|
4
|
+
export interface EcoNotificationsTriggerAttrs {
|
|
5
|
+
"aria-haspopup": "dialog";
|
|
6
|
+
"aria-expanded": "true" | "false";
|
|
7
|
+
"aria-controls": string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** What `renderTrigger` receives. */
|
|
11
|
+
export interface EcoNotificationsTriggerScope {
|
|
12
|
+
attrs: EcoNotificationsTriggerAttrs;
|
|
13
|
+
open: boolean;
|
|
14
|
+
toggle: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface EcoNotificationsProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "onSelect" | "children"> {
|
|
17
|
+
items: EcoNotification[];
|
|
18
|
+
/** One tab per category. Use the key `all` for the grouped overview. Omit for no tab row. */
|
|
19
|
+
tabs?: EcoNotificationTab[];
|
|
20
|
+
title?: string;
|
|
21
|
+
markAllLabel?: string;
|
|
22
|
+
/** Footer link label (calls `onViewAll`). Empty string hides the footer. */
|
|
23
|
+
viewAllLabel?: string;
|
|
24
|
+
/** Accessible name of the bell button. */
|
|
25
|
+
bellLabel?: string;
|
|
26
|
+
/** Whether the popover is open (controlled; v-model:open). */
|
|
27
|
+
open?: boolean;
|
|
28
|
+
defaultOpen?: boolean;
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
30
|
+
/** Key of the selected tab (controlled; v-model:tab). */
|
|
31
|
+
tab?: string;
|
|
32
|
+
defaultTab?: string;
|
|
33
|
+
onTabChange?: (tab: string) => void;
|
|
34
|
+
/** A row was clicked. */
|
|
35
|
+
onSelect?: (item: EcoNotification) => void;
|
|
36
|
+
/** "Mark all as read" was pressed. */
|
|
37
|
+
onMarkAll?: () => void;
|
|
38
|
+
/** The footer link was pressed. */
|
|
39
|
+
onViewAll?: () => void;
|
|
40
|
+
/** Replaces the bell icon button (the `#trigger` slot): spread `attrs` on it. */
|
|
41
|
+
renderTrigger?: (scope: EcoNotificationsTriggerScope) => ReactNode;
|
|
42
|
+
/** Content for a tab with no rows (the `#empty` slot). */
|
|
43
|
+
renderEmpty?: (scope: {
|
|
44
|
+
tab: string;
|
|
45
|
+
}) => ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Notifications — the popover under the bell: a heading with "Mark all as read", a tab per
|
|
49
|
+
* category, rows (`nrow`) grouped under section labels, and a footer link to the full list.
|
|
50
|
+
* Opens from its own bell icon button (or `renderTrigger`), closes on Escape and outside click.
|
|
51
|
+
*/
|
|
52
|
+
export declare function EcoNotifications({ items, tabs, title, markAllLabel, viewAllLabel, bellLabel, open: openProp, defaultOpen, onOpenChange, tab: tabProp, defaultTab, onTabChange, onSelect, onMarkAll, onViewAll, renderTrigger, renderEmpty, className, style, onKeyDown, ...rest }: EcoNotificationsProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface EcoSpinnerProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
3
|
+
/** Ring size: `sm` (16px, inline with text), `md` (24px), `lg` (36px, a whole panel). */
|
|
4
|
+
size?: "sm" | "md" | "lg";
|
|
5
|
+
/**
|
|
6
|
+
* Accessible name, rendered in a visually hidden `sr` span inside the `role="status"` element.
|
|
7
|
+
* Pass `""` only when the spinner sits inside a control that is already marked busy
|
|
8
|
+
* (`aria-busy`): it then renders decoratively (`aria-hidden`, no status role).
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Visible line under the ring that says what is happening. */
|
|
12
|
+
caption?: string;
|
|
13
|
+
/** Show the ring (and, when wrapping content, the mask). Default true. */
|
|
14
|
+
spinning?: boolean;
|
|
15
|
+
/** Content to wrap: it stays in place, dimmed under a mask, `aria-busy` and inert while spinning. */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Spinner — a ring that says work is in flight: a save, a refresh, a region being recomputed.
|
|
20
|
+
* It is honest for a second or two; for a page or section that is loading its data for the
|
|
21
|
+
* first time, use `EcoSkeleton` instead (shaped like the content, so nothing jumps).
|
|
22
|
+
*
|
|
23
|
+
* Alone it is a `role="status"` region named by `label` (visually hidden), with an optional
|
|
24
|
+
* visible `caption` under the ring. With children it wraps them: the content stays in place,
|
|
25
|
+
* dimmed under a mask with the ring centred, `aria-busy` and inert while `spinning`. Keep the
|
|
26
|
+
* control that started the work outside the wrapper, or it loses focus when the region goes inert.
|
|
27
|
+
* For a busy button use the button's own `loading`, not a spinner beside it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function EcoSpinner({ size, label, caption, spinning, children, className, ...rest }: EcoSpinnerProps): import('react').JSX.Element | null;
|