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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useEcoId } from './useEcoId';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable, SSR-safe id for label/for, aria-controls and SVG gradient ids. React's own ids carry
|
|
3
|
+
* `:` or `«»`, which break `url(#…)` references and selectors, so only letters, digits, `_` and
|
|
4
|
+
* `-` are kept (still unique within the root).
|
|
5
|
+
*/
|
|
6
|
+
export declare function useEcoId(prefix?: string): string;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* vue-ecosphere's `<Teleport to="body">`: renders `children` into `document.body`, on the client
|
|
4
|
+
* only. On the server (and during hydration) it renders nothing, as a teleport does.
|
|
5
|
+
*/
|
|
6
|
+
export declare function Portal({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** A class list the way Vue's `:class` takes one: strings, arrays, and objects keyed by truthiness. */
|
|
2
|
+
export type ClassValue = string | number | false | null | undefined | Record<string, unknown> | ClassValue[];
|
|
3
|
+
/** Joins class names in order, skipping falsy entries. `cx("btn", { "btn--sm": sm }, className)`. */
|
|
4
|
+
export declare function cx(...values: ClassValue[]): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EcoDataBadge } from '../components/data/types';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a slot-like prop has content, the way vue-ecosphere tests `$slots.foo`: a slot that is
|
|
5
|
+
* passed but renders nothing falls back to the default content, so `undefined`, `null`, `false`
|
|
6
|
+
* and `""` count as absent here.
|
|
7
|
+
*/
|
|
8
|
+
export declare function has(node: ReactNode): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A status badge from data, as the data rows render it: `badge badge--<tone>` (default `neutral`)
|
|
11
|
+
* with the leading `badge__dot` when `dot` is true.
|
|
12
|
+
*/
|
|
13
|
+
export declare function DataBadge({ badge, dot }: {
|
|
14
|
+
badge: EcoDataBadge;
|
|
15
|
+
dot: boolean;
|
|
16
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Whether a node renders anything: Vue's `prop || $slots.name` (empty string, null, false do not). */
|
|
3
|
+
export declare function hasNode(node: ReactNode): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a prop that doubles as a slot holds plain text (the prop: rendered inside the default
|
|
6
|
+
* markup) rather than a node (the slot: rendered in place of that markup).
|
|
7
|
+
*/
|
|
8
|
+
export declare function isText(node: ReactNode): node is string | number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue's `v-model` on a text field, for React: the field's `value` *property* follows the model and
|
|
3
|
+
* `onChange` reports edits, but no `value` attribute is written (React's controlled inputs write
|
|
4
|
+
* one, Vue's do not), so the DOM stays identical to vue-ecosphere's.
|
|
5
|
+
*
|
|
6
|
+
* Use as a callback ref: `<input ref={valueRef(text)} onChange={(e) => setText(e.target.value)} />`.
|
|
7
|
+
* It runs on every commit and only assigns when the value differs, so the caret stays put while
|
|
8
|
+
* typing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function valueRef(value: string): (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* vue's `nextTick(cb)`: runs `cb` after the component's next commit, once the DOM shows the state
|
|
4
|
+
* set alongside it (e.g. focus a list that the same handler opened). Forces that commit if nothing
|
|
5
|
+
* else would.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useNextTick(): (cb: () => void) => void;
|
|
8
|
+
/**
|
|
9
|
+
* vue's `watch(source, cb)` (not immediate): calls `cb(value, previous)` after a commit in which
|
|
10
|
+
* `value` differs (Object.is) from the last one seen. Safe under StrictMode's double effects.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useOnChange<T>(value: T, cb: (value: T, previous: T) => void): void;
|
|
13
|
+
/** Whether a prop-or-slot node renders anything, the way Vue tests `label || $slots.label`. */
|
|
14
|
+
export declare function filled(node: ReactNode): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `root` wraps both the trigger and the panel; `trigger` gets focus back on close.
|
|
4
|
+
* While `open`, a mousedown outside `root` closes the popover (returning focus to the trigger unless
|
|
5
|
+
* the press lands on something that takes focus itself).
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePopover(open: boolean, setOpen: (open: boolean) => void, root: RefObject<HTMLElement | null>, trigger: RefObject<HTMLElement | null>): {
|
|
8
|
+
close: (returnFocus?: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
/** Scroll an element into view inside its scrolling list, if the platform supports it. */
|
|
11
|
+
export declare function scrollIntoList(el: Element | null | undefined): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue's `watch(source, cb)` for React: runs `cb(value, previous)` in an effect after a render in
|
|
3
|
+
* which `value` changed (by `Object.is`), never on mount. Used where vue-ecosphere reacts to a
|
|
4
|
+
* change only (AppShell's drawer, Thread's scroll, Disclosure's group, Pagination's jump field).
|
|
5
|
+
*/
|
|
6
|
+
export declare function useWatch<T>(value: T, cb: (value: T, previous: T) => void): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/** Matches the stylesheet's `--dur-state` (340ms): how long a closing overlay stays mounted. */
|
|
3
|
+
export declare const STATE_MS = 340;
|
|
4
|
+
export declare function focusables(root: HTMLElement): HTMLElement[];
|
|
5
|
+
/** Run on the next frame (falls back to a timeout where rAF is missing, e.g. some test DOMs). */
|
|
6
|
+
export declare function nextFrame(cb: () => void): void;
|
|
7
|
+
export interface ModalOverlayOptions {
|
|
8
|
+
/** Called on Escape (and by the caller on scrim clicks). */
|
|
9
|
+
onEscape: () => void;
|
|
10
|
+
/** Selector of elements to skip when choosing the first focus target (e.g. the × button). */
|
|
11
|
+
skipInitial?: string;
|
|
12
|
+
lockScroll?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Mount/animate/trap lifecycle for a modal panel.
|
|
16
|
+
* `rendered` keeps the DOM alive through the exit transition; `shown` drives the `is-open` class.
|
|
17
|
+
* Opening remembers the focused element, traps Tab inside `panel`, focuses `[autofocus]` (or the
|
|
18
|
+
* first focusable that does not match `skipInitial`, or the panel), and locks body scroll.
|
|
19
|
+
* Closing restores focus and unmounts after STATE_MS.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useModalOverlay(open: boolean, panel: RefObject<HTMLElement | null>, opts: ModalOverlayOptions): {
|
|
22
|
+
rendered: boolean;
|
|
23
|
+
shown: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** Close a popover when a pointer goes down outside `root`. Active only while `open` is true. */
|
|
26
|
+
export declare function useOutsideClick(open: boolean, root: RefObject<HTMLElement | null>, onOutside: () => void): void;
|
|
27
|
+
/** Arrow / Home / End movement between the enabled items of a list. Returns true when handled. */
|
|
28
|
+
export declare function moveFocus(items: HTMLElement[], key: string): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vue-ecosphere's `defineModel` (a v-model that also works unbound), for React.
|
|
3
|
+
*
|
|
4
|
+
* Controlled while `value !== undefined`; otherwise the component keeps its own state, seeded
|
|
5
|
+
* from `defaultValue`. The setter skips unchanged values (as Vue does), updates the internal state
|
|
6
|
+
* when uncontrolled, and always reports through `onChange`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useControllableState<T>(value: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (next: T | ((prev: T) => T)) => void];
|