rich-react-component 0.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/LICENSE +21 -0
- package/README.md +118 -0
- package/dist/base/Accordion.d.ts +17 -0
- package/dist/base/Alert.d.ts +15 -0
- package/dist/base/AutoComplete.d.ts +20 -0
- package/dist/base/Avatar.d.ts +8 -0
- package/dist/base/Badge.d.ts +9 -0
- package/dist/base/Breadcrumb.d.ts +10 -0
- package/dist/base/Button.d.ts +13 -0
- package/dist/base/Card.d.ts +9 -0
- package/dist/base/CheckBox.d.ts +17 -0
- package/dist/base/Col.d.ts +12 -0
- package/dist/base/ComboBox.d.ts +17 -0
- package/dist/base/Confirm.d.ts +25 -0
- package/dist/base/Container.d.ts +7 -0
- package/dist/base/DataGrid.d.ts +43 -0
- package/dist/base/DatePicker.d.ts +23 -0
- package/dist/base/DateTimePicker.d.ts +17 -0
- package/dist/base/Divider.d.ts +8 -0
- package/dist/base/FileInput.d.ts +19 -0
- package/dist/base/FormField.d.ts +12 -0
- package/dist/base/Icon.d.ts +15 -0
- package/dist/base/Input.d.ts +30 -0
- package/dist/base/Menu.d.ts +21 -0
- package/dist/base/Modal.d.ts +19 -0
- package/dist/base/MultiSelect.d.ts +25 -0
- package/dist/base/Navbar.d.ts +16 -0
- package/dist/base/NumberInput.d.ts +17 -0
- package/dist/base/PageHeader.d.ts +12 -0
- package/dist/base/Pagination.d.ts +15 -0
- package/dist/base/PasswordInput.d.ts +10 -0
- package/dist/base/Popover.d.ts +10 -0
- package/dist/base/ProgressBar.d.ts +10 -0
- package/dist/base/RadioButton.d.ts +18 -0
- package/dist/base/RadioGroup.d.ts +14 -0
- package/dist/base/Rating.d.ts +9 -0
- package/dist/base/Row.d.ts +6 -0
- package/dist/base/Select.d.ts +24 -0
- package/dist/base/Sidebar.d.ts +31 -0
- package/dist/base/Skeleton.d.ts +8 -0
- package/dist/base/Slider.d.ts +10 -0
- package/dist/base/Spinner.d.ts +7 -0
- package/dist/base/Stack.d.ts +12 -0
- package/dist/base/Stepper.d.ts +12 -0
- package/dist/base/Switch.d.ts +16 -0
- package/dist/base/Tabs.d.ts +16 -0
- package/dist/base/Tag.d.ts +14 -0
- package/dist/base/TextArea.d.ts +11 -0
- package/dist/base/TimePicker.d.ts +20 -0
- package/dist/base/Toast.d.ts +27 -0
- package/dist/base/Tooltip.d.ts +21 -0
- package/dist/base/index.d.ts +56 -0
- package/dist/base/shared/BooleanFieldControl.d.ts +22 -0
- package/dist/base/shared/FieldShell.d.ts +22 -0
- package/dist/base/shared/Label.d.ts +9 -0
- package/dist/base/shared/Popup.d.ts +25 -0
- package/dist/base/shared/ValidationMessage.d.ts +11 -0
- package/dist/base/shared/classNames.d.ts +1 -0
- package/dist/base/shared/fieldTypes.d.ts +26 -0
- package/dist/base/shared/index.d.ts +9 -0
- package/dist/base/shared/useControllableState.d.ts +16 -0
- package/dist/base/shared/useEscapeKey.d.ts +2 -0
- package/dist/base/shared/useListNavigation.d.ts +18 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +2092 -0
- package/dist/index.js.map +1 -0
- package/dist/remote/RemoteAutoComplete.d.ts +22 -0
- package/dist/remote/RemoteComboBox.d.ts +21 -0
- package/dist/remote/RemoteDataGrid.d.ts +24 -0
- package/dist/remote/RemoteMultiSelect.d.ts +13 -0
- package/dist/remote/RemoteSelect.d.ts +17 -0
- package/dist/remote/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/remote/hooks/useRemoteData.d.ts +31 -0
- package/dist/remote/http/HttpClient.d.ts +31 -0
- package/dist/remote/index.d.ts +9 -0
- package/dist/remote/mapping.d.ts +8 -0
- package/dist/smart/SmartAction.d.ts +14 -0
- package/dist/smart/SmartActions.d.ts +14 -0
- package/dist/smart/SmartField.d.ts +18 -0
- package/dist/smart/SmartForm.d.ts +19 -0
- package/dist/smart/actionRegistry.d.ts +11 -0
- package/dist/smart/componentRegistry.d.ts +24 -0
- package/dist/smart/dataSourceRegistry.d.ts +17 -0
- package/dist/smart/index.d.ts +26 -0
- package/dist/smart/resolvers/comboBoxResolver.d.ts +10 -0
- package/dist/smart/resolvers/dataGridResolver.d.ts +11 -0
- package/dist/smart/resolvers/datePickerResolver.d.ts +3 -0
- package/dist/smart/resolvers/index.d.ts +13 -0
- package/dist/smart/resolvers/inputResolver.d.ts +8 -0
- package/dist/smart/runtime.d.ts +26 -0
- package/dist/smart/types.d.ts +114 -0
- package/dist/smart/useSmartAction.d.ts +36 -0
- package/dist/smart/useSmartDependencies.d.ts +13 -0
- package/dist/smart/useSmartField.d.ts +47 -0
- package/package.json +68 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
currentPage: number;
|
|
3
|
+
pageSize: number;
|
|
4
|
+
totalItems: number;
|
|
5
|
+
onPageChange: (page: number) => void;
|
|
6
|
+
/** How many numbered page buttons to show on each side of the current page. */
|
|
7
|
+
siblingCount?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* UI-only, like DataGrid's other UI concerns — no API calls (doc section
|
|
12
|
+
* 19). This is what lets it be reused by DataGrid (and later
|
|
13
|
+
* RemoteDataGrid/SmartDataGrid) regardless of where the rows came from.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Pagination({ currentPage, pageSize, totalItems, onPageChange, siblingCount, className }: PaginationProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InputProps } from './Input';
|
|
2
|
+
export interface PasswordInputProps extends Omit<InputProps, "type" | "endAdornment" | "inputProps"> {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Reuses Input entirely (controlled/uncontrolled logic, FieldShell,
|
|
6
|
+
* markup) via Input's `endAdornment`/`inputProps` extension points instead
|
|
7
|
+
* of building an independent text field (doc section 4). No password
|
|
8
|
+
* strength infrastructure — just visibility toggling.
|
|
9
|
+
*/
|
|
10
|
+
export declare function PasswordInput(props: PasswordInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PopoverProps {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
placement?: "top" | "bottom";
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Click-triggered variant of Tooltip — same Popup-reuse rationale (see Tooltip.tsx). */
|
|
10
|
+
export declare function Popover({ title, content, children, placement, className }: PopoverProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BadgeVariant } from './Badge';
|
|
2
|
+
export interface ProgressBarProps {
|
|
3
|
+
/** 0-100. Values outside that range are clamped. */
|
|
4
|
+
value: number;
|
|
5
|
+
variant?: BadgeVariant;
|
|
6
|
+
/** Show the percentage as text inside the bar. */
|
|
7
|
+
label?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function ProgressBar({ value, variant, label, className }: ProgressBarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface RadioButtonProps<TValue extends string | number = string> {
|
|
2
|
+
id?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
value: TValue;
|
|
5
|
+
label?: string;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
onChange?: (value: TValue) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A single radio input. Always controlled by `checked` — a lone HTML radio
|
|
13
|
+
* doesn't have meaningful independent uncontrolled state the way a
|
|
14
|
+
* checkbox does (mutual exclusivity requires a group), so it's normally
|
|
15
|
+
* composed by RadioGroup, which owns the actual controlled/uncontrolled
|
|
16
|
+
* value. Usable standalone by a consumer who wants to manage state itself.
|
|
17
|
+
*/
|
|
18
|
+
export declare function RadioButton<TValue extends string | number = string>({ id, name, value, label, checked, disabled, className, onChange, }: RadioButtonProps<TValue>): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldIdentity, FieldPresentation, FieldState, SelectOption } from './shared/fieldTypes';
|
|
2
|
+
export interface RadioGroupProps<TValue extends string | number = string> extends FieldIdentity, FieldState, FieldPresentation {
|
|
3
|
+
options: SelectOption<TValue>[];
|
|
4
|
+
value?: TValue | null;
|
|
5
|
+
defaultValue?: TValue | null;
|
|
6
|
+
onChange?: (value: TValue) => void;
|
|
7
|
+
inline?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Composes RadioButton rather than reproducing radio rendering (doc
|
|
11
|
+
* section 7) — this is the component that actually owns the group's
|
|
12
|
+
* controlled/uncontrolled value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function RadioGroup<TValue extends string | number = string>({ options, value, defaultValue, onChange, inline, id, name, disabled, required, className, label, helpText, error, }: RadioGroupProps<TValue>): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface RatingProps {
|
|
2
|
+
value?: number;
|
|
3
|
+
defaultValue?: number;
|
|
4
|
+
onChange?: (value: number) => void;
|
|
5
|
+
max?: number;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Rating({ value, defaultValue, onChange, max, disabled, className }: RatingProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FieldIdentity, FieldPresentation, FieldState, SelectOption } from './shared/fieldTypes';
|
|
2
|
+
export interface SelectProps<TValue extends string | number = string> extends FieldIdentity, FieldState, FieldPresentation {
|
|
3
|
+
options: SelectOption<TValue>[];
|
|
4
|
+
value?: TValue | null;
|
|
5
|
+
defaultValue?: TValue | null;
|
|
6
|
+
onChange?: (value: TValue | null) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Presentational-only loading flag, same convention as ComboBox/
|
|
9
|
+
* AutoComplete/MultiSelect's `loading` prop — Select has no idea *why*
|
|
10
|
+
* it's loading (doc section 8). Disables the control and shows a
|
|
11
|
+
* "Loading…" placeholder option; set by RemoteSelect.
|
|
12
|
+
*/
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Not remote-aware (doc section 5). Deliberately a native `<select>` rather
|
|
17
|
+
* than reusing ComboBox's Popup/keyboard-list UI — their UI semantics
|
|
18
|
+
* genuinely differ (native select already has full built-in keyboard/
|
|
19
|
+
* screen-reader support, so reusing Popup here would be a *regression*, not
|
|
20
|
+
* a simplification). The two DO share the same typed option abstraction
|
|
21
|
+
* (`SelectOption`) and the same FieldShell/useControllableState — that's
|
|
22
|
+
* the "smallest appropriate abstraction" the doc asks for.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Select<TValue extends string | number = string>({ options, value, defaultValue, onChange, placeholder, loading, id, name, disabled, readOnly, required, className, label, helpText, error, }: SelectProps<TValue>): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SidebarLeafItem {
|
|
3
|
+
key: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
href?: string;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SidebarGroup {
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
items: SidebarLeafItem[];
|
|
15
|
+
defaultOpen?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type SidebarSection = SidebarLeafItem | SidebarGroup;
|
|
18
|
+
export interface SidebarProps {
|
|
19
|
+
sections: SidebarSection[];
|
|
20
|
+
header?: ReactNode;
|
|
21
|
+
footer?: ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Persistent vertical navigation. Leaf entries render as plain nav links;
|
|
26
|
+
* grouped/collapsible sections reuse Accordion (doc section 20 — no second
|
|
27
|
+
* independent collapse implementation) instead of reimplementing open/close
|
|
28
|
+
* state. Active-state comes from the `active` flag the caller passes in —
|
|
29
|
+
* routing/URL matching is the consuming app's job (doc section 22).
|
|
30
|
+
*/
|
|
31
|
+
export declare function Sidebar({ sections, header, footer, className }: SidebarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SkeletonProps {
|
|
2
|
+
width?: string | number;
|
|
3
|
+
height?: string | number;
|
|
4
|
+
circle?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Uses Bootstrap's built-in `placeholder`/`placeholder-glow` classes rather than inventing a new loading-shimmer animation. */
|
|
8
|
+
export declare function Skeleton({ width, height, circle, className }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldIdentity, FieldPresentation, FieldState } from './shared/fieldTypes';
|
|
2
|
+
export interface SliderProps extends FieldIdentity, FieldState, FieldPresentation {
|
|
3
|
+
value?: number;
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
onChange?: (value: number) => void;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
step?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function Slider({ value, defaultValue, onChange, min, max, step, id, name, disabled, required, className, label, helpText, error, }: SliderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface StackProps {
|
|
3
|
+
direction?: "row" | "column";
|
|
4
|
+
gap?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
5
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
6
|
+
justify?: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
7
|
+
wrap?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** Thin wrapper over Bootstrap's flex utilities — replaces repeated `d-flex gap-2` one-offs with one typed contract. */
|
|
12
|
+
export declare function Stack({ direction, gap, align, justify, wrap, className, children }: StackProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface StepItem {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StepperProps {
|
|
7
|
+
steps: StepItem[];
|
|
8
|
+
/** Index of the current step (0-based). Presentation only — no built-in next/back logic, that's app-level. */
|
|
9
|
+
currentStep: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function Stepper({ steps, currentStep, className }: StepperProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldIdentity, FieldState } from './shared/fieldTypes';
|
|
2
|
+
export interface SwitchProps extends FieldIdentity, FieldState {
|
|
3
|
+
className?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
helpText?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
defaultChecked?: boolean;
|
|
9
|
+
onChange?: (checked: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Same controlled/uncontrolled boolean behavior as CheckBox, reused via
|
|
13
|
+
* BooleanFieldControl — only the wrapper class (`form-switch`) and
|
|
14
|
+
* `role="switch"` differ (doc section 8).
|
|
15
|
+
*/
|
|
16
|
+
export declare function Switch(props: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TabItem {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface TabsProps {
|
|
9
|
+
items: TabItem[];
|
|
10
|
+
activeKey?: string;
|
|
11
|
+
defaultActiveKey?: string;
|
|
12
|
+
onChange?: (key: string) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Tab definitions (`items`) are kept separate from rendering, per doc section 16. */
|
|
16
|
+
export declare function Tabs({ items, activeKey, defaultActiveKey, onChange, className }: TabsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BadgeVariant } from './Badge';
|
|
3
|
+
export interface TagProps {
|
|
4
|
+
variant?: BadgeVariant;
|
|
5
|
+
onRemove?: () => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reuses Badge's variant type (same visual vocabulary) — the difference
|
|
11
|
+
* from Badge is purely behavioral: Tag is removable/interactive, Badge is
|
|
12
|
+
* static.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Tag({ variant, onRemove, className, children }: TagProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FocusEventHandler } from 'react';
|
|
2
|
+
import { FieldIdentity, FieldPresentation, FieldState } from './shared/fieldTypes';
|
|
3
|
+
export interface TextAreaProps extends FieldIdentity, FieldState, FieldPresentation {
|
|
4
|
+
value?: string;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
8
|
+
rows?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function TextArea(props: TextAreaProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FieldIdentity, FieldPresentation, FieldState } from './shared/fieldTypes';
|
|
2
|
+
export interface TimePickerProps extends FieldIdentity, FieldState, FieldPresentation {
|
|
3
|
+
value?: Date | null;
|
|
4
|
+
defaultValue?: Date | null;
|
|
5
|
+
onChange?: (value: Date | null) => void;
|
|
6
|
+
/** Native `<input type="time">` step, in seconds. */
|
|
7
|
+
step?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Value strategy (doc section 12): TimePicker uses `Date`, same as
|
|
11
|
+
* DatePicker/DateTimePicker, for a coherent family — but only the
|
|
12
|
+
* hours/minutes are meaningful; the date part is normalized to the epoch so
|
|
13
|
+
* consumers can't accidentally depend on it. This is what lets
|
|
14
|
+
* DateTimePicker combine a DatePicker date-part with a TimePicker
|
|
15
|
+
* time-part into one `Date` without any string/format juggling.
|
|
16
|
+
*/
|
|
17
|
+
export declare function toTimeInputValue(date: Date | null | undefined): string;
|
|
18
|
+
export declare function fromTimeInputValue(raw: string): Date | null;
|
|
19
|
+
/** Composes Input, same pattern as DatePicker/NumberInput (doc section 19). */
|
|
20
|
+
export declare function TimePicker({ value, defaultValue, onChange, step, ...rest }: TimePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AlertVariant } from './Alert';
|
|
3
|
+
export interface ToastOptions {
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
/** Auto-dismiss delay in ms. Pass 0 to require manual dismissal via the Alert's close button. */
|
|
6
|
+
duration?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastApi {
|
|
9
|
+
show: (message: ReactNode, options?: ToastOptions) => number;
|
|
10
|
+
dismiss: (id: number) => void;
|
|
11
|
+
success: (message: ReactNode, options?: Omit<ToastOptions, "variant">) => number;
|
|
12
|
+
error: (message: ReactNode, options?: Omit<ToastOptions, "variant">) => number;
|
|
13
|
+
info: (message: ReactNode, options?: Omit<ToastOptions, "variant">) => number;
|
|
14
|
+
warning: (message: ReactNode, options?: Omit<ToastOptions, "variant">) => number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Global toast notifications. Reuses Alert's variant styling and dismiss
|
|
18
|
+
* button (doc section 20: capability layers must not duplicate an existing
|
|
19
|
+
* implementation) for the actual message presentation — this module only
|
|
20
|
+
* owns the queue/timing/positioning concerns Alert's own doc comment
|
|
21
|
+
* deliberately left out of Alert itself.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ToastProvider({ children }: {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/** Throws outside ToastProvider — same fail-fast contract as other context-backed hooks in this library. */
|
|
27
|
+
export declare function useToast(): ToastApi;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TooltipProps {
|
|
3
|
+
content: ReactNode;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
placement?: "top" | "bottom";
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reuses the existing Popup primitive (open/close, escape-to-close, outside
|
|
10
|
+
* click, cleanup — all already implemented and tested) with Bootstrap's
|
|
11
|
+
* real tooltip CSS classes for visual fidelity.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately NOT wired to Bootstrap's own JS Tooltip plugin: that plugin
|
|
14
|
+
* needs `@popperjs/core` (the plain `bootstrap` package doesn't bundle it —
|
|
15
|
+
* only its non-ESM `bootstrap.bundle.js` does), so wiring it up would mean
|
|
16
|
+
* either adding a new dependency or a fragile UMD-inside-an-ESM-library
|
|
17
|
+
* dynamic import. Reusing our own already-tested Popup is the more
|
|
18
|
+
* conservative choice here, not less (doc section 18: "do NOT introduce
|
|
19
|
+
* another positioning library unless actually necessary").
|
|
20
|
+
*/
|
|
21
|
+
export declare function Tooltip({ content, children, placement, className }: TooltipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export * from './Input';
|
|
2
|
+
export * from './TextArea';
|
|
3
|
+
export * from './NumberInput';
|
|
4
|
+
export * from './PasswordInput';
|
|
5
|
+
export * from './FileInput';
|
|
6
|
+
export * from './CheckBox';
|
|
7
|
+
export * from './Switch';
|
|
8
|
+
export * from './RadioButton';
|
|
9
|
+
export * from './RadioGroup';
|
|
10
|
+
export * from './Select';
|
|
11
|
+
export * from './MultiSelect';
|
|
12
|
+
export * from './DatePicker';
|
|
13
|
+
export * from './TimePicker';
|
|
14
|
+
export * from './DateTimePicker';
|
|
15
|
+
export * from './ComboBox';
|
|
16
|
+
export * from './AutoComplete';
|
|
17
|
+
export * from './FormField';
|
|
18
|
+
export * from './Modal';
|
|
19
|
+
export * from './DataGrid';
|
|
20
|
+
export * from './Pagination';
|
|
21
|
+
export * from './Button';
|
|
22
|
+
export * from './Spinner';
|
|
23
|
+
export * from './Alert';
|
|
24
|
+
export * from './Toast';
|
|
25
|
+
export * from './Confirm';
|
|
26
|
+
export * from './Badge';
|
|
27
|
+
export * from './Tabs';
|
|
28
|
+
export * from './Accordion';
|
|
29
|
+
export * from './Tooltip';
|
|
30
|
+
export * from './Popover';
|
|
31
|
+
export * from './Card';
|
|
32
|
+
export * from './Divider';
|
|
33
|
+
export * from './Stack';
|
|
34
|
+
export * from './Container';
|
|
35
|
+
export * from './Row';
|
|
36
|
+
export * from './Col';
|
|
37
|
+
export * from './Breadcrumb';
|
|
38
|
+
export * from './Menu';
|
|
39
|
+
export * from './Stepper';
|
|
40
|
+
export * from './Avatar';
|
|
41
|
+
export * from './Tag';
|
|
42
|
+
export * from './Skeleton';
|
|
43
|
+
export * from './Slider';
|
|
44
|
+
export * from './Rating';
|
|
45
|
+
export * from './ProgressBar';
|
|
46
|
+
export * from './Icon';
|
|
47
|
+
export * from './Navbar';
|
|
48
|
+
export * from './Sidebar';
|
|
49
|
+
export * from './PageHeader';
|
|
50
|
+
export { Popup } from './shared/Popup';
|
|
51
|
+
export type { PopupProps } from './shared/Popup';
|
|
52
|
+
export { Label } from './shared/Label';
|
|
53
|
+
export type { LabelProps } from './shared/Label';
|
|
54
|
+
export { ValidationMessage } from './shared/ValidationMessage';
|
|
55
|
+
export type { ValidationMessageProps } from './shared/ValidationMessage';
|
|
56
|
+
export type { FieldIdentity, FieldPresentation, FieldState, SelectOption } from './shared/fieldTypes';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldIdentity } from './fieldTypes';
|
|
2
|
+
export interface BooleanFieldControlProps extends FieldIdentity {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
wrapperClassName: string;
|
|
7
|
+
role?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
helpText?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
checked: boolean;
|
|
12
|
+
onChange: (checked: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Internal-only shared rendering for CheckBox and Switch: their public APIs
|
|
16
|
+
* are genuinely identical (checked/defaultChecked/onChange/label/error/
|
|
17
|
+
* helpText) and their markup differs only by wrapper class + `role` (doc
|
|
18
|
+
* section 8: "reuse if semantically correct, but don't couple them through
|
|
19
|
+
* an abstraction that makes either public API worse" — this doesn't, since
|
|
20
|
+
* both components keep their own separate, unchanged public props).
|
|
21
|
+
*/
|
|
22
|
+
export declare function BooleanFieldControl({ id, name, disabled, required, wrapperClassName, role, label, helpText, error, checked, onChange, className, }: BooleanFieldControlProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface FieldShellProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
error?: string;
|
|
7
|
+
helpText?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shared label / help-text / validation-message presentation wrapper reused
|
|
13
|
+
* by every Base field that has that shape (Input, TextArea, NumberInput,
|
|
14
|
+
* DatePicker, TimePicker, ComboBox, AutoComplete, Select, MultiSelect,
|
|
15
|
+
* RadioGroup, DateTimePicker). CheckBox/Switch and DataGrid have a
|
|
16
|
+
* genuinely different layout and intentionally don't use this (they reuse
|
|
17
|
+
* ValidationMessage directly instead — see BooleanFieldControl).
|
|
18
|
+
*
|
|
19
|
+
* Bootstrap conventions (`form-label`, `invalid-feedback`, `form-text`) are
|
|
20
|
+
* used directly rather than reinventing a styling layer (doc section 15).
|
|
21
|
+
*/
|
|
22
|
+
export declare function FieldShell({ id, label, required, error, helpText, className, children }: FieldShellProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface LabelProps {
|
|
3
|
+
htmlFor?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Extracted out of FieldShell so it's independently usable (doc "Form Infrastructure" section). */
|
|
9
|
+
export declare function Label({ htmlFor, required, className, children }: LabelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
export interface PopupProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
anchorRef: RefObject<HTMLElement>;
|
|
6
|
+
className?: string;
|
|
7
|
+
/** ARIA role of the floating panel — callers set this (e.g. "listbox" for ComboBox, none for Tooltip/Popover). */
|
|
8
|
+
role?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Anchored floating panel: open/close, escape-to-close, outside-click
|
|
13
|
+
* dismissal, cleanup. Reused by ComboBox/AutoComplete/MultiSelect (as a
|
|
14
|
+
* dropdown listbox) and by Tooltip/Popover (as a hover/click overlay) — so
|
|
15
|
+
* it only forces Bootstrap's universal `show` visibility class; the
|
|
16
|
+
* dropdown-specific (`dropdown-menu`) vs. tooltip/popover-specific
|
|
17
|
+
* (`tooltip`, `popover`) presentation classes are each caller's own
|
|
18
|
+
* responsibility via `className`.
|
|
19
|
+
*
|
|
20
|
+
* Known limitation (documented, not silently ignored): positioning is plain
|
|
21
|
+
* CSS (`position: relative` on the anchor's wrapper), no portal/collision
|
|
22
|
+
* detection yet. A portal-based strategy can be layered in later without
|
|
23
|
+
* changing this component's public API.
|
|
24
|
+
*/
|
|
25
|
+
export declare function Popup({ open, onClose, anchorRef, className, role, children }: PopupProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ValidationMessageProps {
|
|
2
|
+
error?: string;
|
|
3
|
+
helpText?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Presentation only — owns no validation rules (doc section 10). Extracted
|
|
8
|
+
* out of FieldShell so CheckBox/Switch (which don't use FieldShell's
|
|
9
|
+
* `form-label` layout) can still reuse the identical error/help rendering.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ValidationMessage({ error, helpText, className }: ValidationMessageProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cx(...values: Array<string | false | null | undefined>): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small, semantic prop contracts shared only where a genuine relationship
|
|
3
|
+
* exists between fields. Deliberately NOT a single "MassiveUniversalComponentProps"
|
|
4
|
+
* — components compose the subset that applies to them (see doc section 13).
|
|
5
|
+
*/
|
|
6
|
+
export interface FieldIdentity {
|
|
7
|
+
id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FieldState {
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface FieldPresentation {
|
|
16
|
+
className?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
helpText?: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SelectOption<TValue = string | number> {
|
|
23
|
+
value: TValue;
|
|
24
|
+
label: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './classNames';
|
|
2
|
+
export * from './fieldTypes';
|
|
3
|
+
export * from './useControllableState';
|
|
4
|
+
export * from './useEscapeKey';
|
|
5
|
+
export * from './useListNavigation';
|
|
6
|
+
export * from './Label';
|
|
7
|
+
export * from './ValidationMessage';
|
|
8
|
+
export * from './FieldShell';
|
|
9
|
+
export * from './Popup';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ControllableStateOptions<T> {
|
|
2
|
+
/** When defined, the component is controlled: this value always wins. */
|
|
3
|
+
value?: T;
|
|
4
|
+
defaultValue: T;
|
|
5
|
+
onChange?: (value: T) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Single shared implementation of the library's controlled/uncontrolled policy
|
|
9
|
+
* (doc section 14). Every Base form field composes this instead of
|
|
10
|
+
* reimplementing its own controlled/uncontrolled logic.
|
|
11
|
+
*
|
|
12
|
+
* Policy: presence of `value !== undefined` on first render decides the mode
|
|
13
|
+
* for the component's lifetime. Switching modes afterwards is a programmer
|
|
14
|
+
* error and is flagged in development, mirroring React's own <input> warning.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useControllableState<T>({ value, defaultValue, onChange, }: ControllableStateOptions<T>): [T, (next: T) => void];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
export interface UseListNavigationOptions {
|
|
3
|
+
itemCount: number;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onSelect: (index: number) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface UseListNavigationResult {
|
|
9
|
+
activeIndex: number;
|
|
10
|
+
setActiveIndex: (index: number) => void;
|
|
11
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Headless keyboard-navigation behavior shared by ComboBox and AutoComplete
|
|
15
|
+
* (doc section 19 — "shared behavior" reuse for the list-selection concern
|
|
16
|
+
* that both components genuinely have in common).
|
|
17
|
+
*/
|
|
18
|
+
export declare function useListNavigation({ itemCount, isOpen, onSelect, onClose, }: UseListNavigationOptions): UseListNavigationResult;
|