@webority/ui-react 0.2.0 → 0.4.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.
Files changed (64) hide show
  1. package/README.md +23 -0
  2. package/dist/types/components/ActionIcon.d.ts +27 -0
  3. package/dist/types/components/AppAccordion.d.ts +27 -0
  4. package/dist/types/components/AppAlert.d.ts +21 -0
  5. package/dist/types/components/AppAutocomplete.d.ts +48 -0
  6. package/dist/types/components/AppAvatar.d.ts +13 -0
  7. package/dist/types/components/AppBadge.d.ts +19 -0
  8. package/dist/types/components/AppButton.d.ts +13 -0
  9. package/dist/types/components/AppCallout.d.ts +19 -0
  10. package/dist/types/components/AppCard.d.ts +29 -0
  11. package/dist/types/components/AppCheckbox.d.ts +17 -0
  12. package/dist/types/components/AppChip.d.ts +37 -0
  13. package/dist/types/components/AppChoiceCard.d.ts +36 -0
  14. package/dist/types/components/AppChoiceChip.d.ts +24 -0
  15. package/dist/types/components/AppColorField.d.ts +35 -0
  16. package/dist/types/components/AppCompareTable.d.ts +32 -0
  17. package/dist/types/components/AppConfirmDialog.d.ts +27 -0
  18. package/dist/types/components/AppDataTable.d.ts +46 -0
  19. package/dist/types/components/AppDatePicker.d.ts +43 -0
  20. package/dist/types/components/AppDropdown.d.ts +11 -0
  21. package/dist/types/components/AppEmptyState.d.ts +31 -0
  22. package/dist/types/components/AppFileAttachment.d.ts +36 -0
  23. package/dist/types/components/AppFilePicker.d.ts +25 -0
  24. package/dist/types/components/AppInfoList.d.ts +24 -0
  25. package/dist/types/components/AppInfoTip.d.ts +4 -0
  26. package/dist/types/components/AppInput.d.ts +31 -0
  27. package/dist/types/components/AppKpiTile.d.ts +22 -0
  28. package/dist/types/components/AppLogoPicker.d.ts +31 -0
  29. package/dist/types/components/AppModal.d.ts +35 -0
  30. package/dist/types/components/AppMultiSelect.d.ts +38 -0
  31. package/dist/types/components/AppPageHeader.d.ts +22 -0
  32. package/dist/types/components/AppPhoneNumberInput.d.ts +13 -0
  33. package/dist/types/components/AppPricingCard.d.ts +38 -0
  34. package/dist/types/components/AppRadio.d.ts +17 -0
  35. package/dist/types/components/AppRepeater.d.ts +40 -0
  36. package/dist/types/components/AppResourceCard.d.ts +28 -0
  37. package/dist/types/components/AppSearch.d.ts +20 -0
  38. package/dist/types/components/AppSegmented.d.ts +35 -0
  39. package/dist/types/components/AppSelect.d.ts +19 -0
  40. package/dist/types/components/AppSelectMini.d.ts +11 -0
  41. package/dist/types/components/AppShell.d.ts +52 -0
  42. package/dist/types/components/AppSidebarMenu.d.ts +19 -0
  43. package/dist/types/components/AppSkeleton.d.ts +21 -0
  44. package/dist/types/components/AppSpinner.d.ts +17 -0
  45. package/dist/types/components/AppSplash.d.ts +25 -0
  46. package/dist/types/components/AppStatusBadge.d.ts +15 -0
  47. package/dist/types/components/AppStepper.d.ts +35 -0
  48. package/dist/types/components/AppSwitch.d.ts +17 -0
  49. package/dist/types/components/AppTableEmptyState.d.ts +15 -0
  50. package/dist/types/components/AppTablePagination.d.ts +25 -0
  51. package/dist/types/components/AppTabs.d.ts +30 -0
  52. package/dist/types/components/AppTextarea.d.ts +22 -0
  53. package/dist/types/components/AppTimeline.d.ts +26 -0
  54. package/dist/types/components/Icon.d.ts +7 -0
  55. package/dist/types/components/ModalIcons.d.ts +33 -0
  56. package/dist/types/components/RequiredMark.d.ts +7 -0
  57. package/dist/types/components/toast.d.ts +3 -0
  58. package/dist/types/index.d.ts +56 -0
  59. package/dist/types/lib/useListboxMenu.d.ts +46 -0
  60. package/dist/types/lib/usePagination.d.ts +11 -0
  61. package/dist/types/lib/usePopover.d.ts +7 -0
  62. package/dist/types/lib/useTableSort.d.ts +25 -0
  63. package/dist/ui-react.js +1287 -910
  64. package/package.json +13 -10
@@ -0,0 +1,35 @@
1
+ /**
2
+ * A wizard progress indicator — which stage of a multi-step flow the user is on,
3
+ * what is behind them, what is ahead. Two variants of the same component:
4
+ *
5
+ * `variant="steps"` compact — a numbered circle above its label, a line behind.
6
+ * For inside a form card.
7
+ * `variant="journey"` wide — a large dot beside a "STEP 2" index and a title.
8
+ * For a page masthead above the whole flow.
9
+ *
10
+ * A completed step shows a tick, not its number: the number says "which", the tick
11
+ * says "done", and a finished step only needs the latter.
12
+ *
13
+ * A step with `href` becomes a link back to that stage — only give one to a step
14
+ * the user may actually revisit.
15
+ *
16
+ * @param {object} props
17
+ * @param {{ key?: string, label: string, status?: 'done'|'active'|'pending', href?: string }[]} props.steps
18
+ * @param {'steps'|'journey'} [props.variant='steps']
19
+ * @param {string} [props.label='Progress'] Accessible name for the list.
20
+ * @param {import('react').ElementType} [props.linkComponent] Router link for a revisitable
21
+ * step; it receives `to` instead of `href`.
22
+ * @param {string} [props.className]
23
+ */
24
+ export default function AppStepper({ steps, variant, label, linkComponent: Link, className, }: {
25
+ steps: {
26
+ key?: string;
27
+ label: string;
28
+ status?: 'done' | 'active' | 'pending';
29
+ href?: string;
30
+ }[];
31
+ variant?: 'steps' | 'journey';
32
+ label?: string;
33
+ linkComponent?: import('react').ElementType;
34
+ className?: string;
35
+ }): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared toggle switch — `.form-check .form-switch`, matching the Razor
3
+ * <app-switch> exactly.
4
+ *
5
+ * `label` renders a real, associated <label>. It used to be passed as
6
+ * `aria-label` only, so the switch had no visible text at all and the two
7
+ * surfaces looked nothing alike.
8
+ *
9
+ * @param {object} props
10
+ * @param {import('react').ReactNode} [props.label]
11
+ * @param {string} [props.id]
12
+ * @param {string} [props.name]
13
+ * @param {string} [props.className]
14
+ * @param {import('react').Ref} [ref]
15
+ */
16
+ declare const AppSwitch: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
17
+ export default AppSwitch;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Empty ledger body for AppDataTable.
3
+ *
4
+ * @param {object} props
5
+ * @param {string} props.icon
6
+ * @param {import('react').ReactNode} props.title
7
+ * @param {import('react').ReactNode} [props.text]
8
+ * @param {import('react').ReactNode} [props.action]
9
+ */
10
+ export default function AppTableEmptyState({ icon, title, text, action }: {
11
+ icon: string;
12
+ title: import('react').ReactNode;
13
+ text?: import('react').ReactNode;
14
+ action?: import('react').ReactNode;
15
+ }): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Pagination footer under a .table. Pair with usePagination.
3
+ *
4
+ * @param {object} props
5
+ * @param {number} props.page
6
+ * @param {number} props.pageCount
7
+ * @param {number} props.pageSize
8
+ * @param {number} props.total
9
+ * @param {number} props.firstRow
10
+ * @param {number} props.lastRow
11
+ * @param {(page: number) => void} props.onPageChange
12
+ * @param {(size: number) => void} props.onPageSizeChange
13
+ * @param {number[]} [props.pageSizes]
14
+ */
15
+ export default function AppTablePagination({ page, pageCount, pageSize, total, firstRow, lastRow, onPageChange, onPageSizeChange, pageSizes, }: {
16
+ page: number;
17
+ pageCount: number;
18
+ pageSize: number;
19
+ total: number;
20
+ firstRow: number;
21
+ lastRow: number;
22
+ onPageChange: (page: number) => void;
23
+ onPageSizeChange: (size: number) => void;
24
+ pageSizes?: number[];
25
+ }): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared tab strip (.app-tabs). Keyboard: Arrow / Home / End.
3
+ *
4
+ * React drives the strip as a controlled component (`value` + `onChange`, panels
5
+ * are the caller's); Razor's <app-tabs> additionally renders Bootstrap panels
6
+ * from its children. The strip markup is the same on both, so they look alike.
7
+ *
8
+ * @param {object} props
9
+ * @param {{ key: string, label: import('react').ReactNode, count?: number, tone?: string, icon?: import('react').ReactNode, danger?: boolean }[]} props.tabs
10
+ * @param {string} props.value
11
+ * @param {(key: string) => void} props.onChange
12
+ * @param {"underline"|"pills"} [props.variant="underline"]
13
+ * @param {string} [props.ariaLabel]
14
+ * @param {string} [props.className]
15
+ */
16
+ export default function AppTabs({ tabs, value, onChange, variant, ariaLabel, className, }: {
17
+ tabs: {
18
+ key: string;
19
+ label: import('react').ReactNode;
20
+ count?: number;
21
+ tone?: string;
22
+ icon?: import('react').ReactNode;
23
+ danger?: boolean;
24
+ }[];
25
+ value: string;
26
+ onChange: (key: string) => void;
27
+ variant?: "underline" | "pills";
28
+ ariaLabel?: string;
29
+ className?: string;
30
+ }): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The shared multi-line field — the textarea counterpart to AppInput. Wraps react-bootstrap
3
+ * Form.Group / Form.Label / Form.Control (as="textarea"), keeping the `.field`/`.label`/
4
+ * `.textarea` classes so the look is unchanged. Forwards `ref` for react-hook-form and
5
+ * controlled use alike.
6
+ *
7
+ * @param {object} props
8
+ * @param {import('react').ReactNode} [props.label]
9
+ * @param {boolean} [props.required=false]
10
+ * @param {string} [props.error]
11
+ * @param {string} [props.hint]
12
+ * @param {import('react').ReactNode} [props.help] Info-tip content node (decoupled from any glossary).
13
+ * @param {string} [props.helpLabel="More information"] aria-label for the info-tip button.
14
+ * @param {string} [props.id]
15
+ * @param {string} [props.name]
16
+ * @param {number} [props.rows=4]
17
+ * @param {string} [props.className]
18
+ * @param {string} [props.fieldClassName]
19
+ * @param {import('react').Ref<HTMLTextAreaElement>} [ref]
20
+ */
21
+ declare const AppTextarea: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
22
+ export default AppTextarea;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A chronological activity feed — an audit trail, a sign-off history, a status log.
3
+ * Each entry is a toned dot on a vertical rail, with a title, a timestamp, an
4
+ * actor, and an optional free-text note.
5
+ *
6
+ * The rail is drawn on the list, not per item, so it cannot break into segments
7
+ * when an entry wraps to two lines.
8
+ *
9
+ * @param {object} props
10
+ * @param {{ key?: string, icon?: string, tone?: 'neutral'|'success'|'warning'|'danger'|'info',
11
+ * title: import('react').ReactNode, at?: string, by?: string, note?: string }[]} props.items
12
+ * Newest first — a reader scanning an audit trail expects the latest event at the top.
13
+ * @param {string} [props.className]
14
+ */
15
+ export default function AppTimeline({ items, className }: {
16
+ items: {
17
+ key?: string;
18
+ icon?: string;
19
+ tone?: 'neutral' | 'success' | 'warning' | 'danger' | 'info';
20
+ title: import('react').ReactNode;
21
+ at?: string;
22
+ by?: string;
23
+ note?: string;
24
+ }[];
25
+ className?: string;
26
+ }): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export default function Icon({ name, size, className, color, style }: {
2
+ className: any;
3
+ color: any;
4
+ name: any;
5
+ size?: number;
6
+ style: any;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import '@webority/ui-elements';
2
+ export declare const SuccessIcon: ({ size }: {
3
+ size?: number;
4
+ }) => import("react").JSX.Element;
5
+ export declare const ErrorIcon: ({ size }: {
6
+ size?: number;
7
+ }) => import("react").JSX.Element;
8
+ export declare const WarningIcon: ({ size }: {
9
+ size?: number;
10
+ }) => import("react").JSX.Element;
11
+ export declare const InfoIcon: ({ size }: {
12
+ size?: number;
13
+ }) => import("react").JSX.Element;
14
+ export declare const DeleteIcon: ({ size }: {
15
+ size?: number;
16
+ }) => import("react").JSX.Element;
17
+ export declare const MODAL_ICONS: {
18
+ success: ({ size }: {
19
+ size?: number;
20
+ }) => import("react").JSX.Element;
21
+ error: ({ size }: {
22
+ size?: number;
23
+ }) => import("react").JSX.Element;
24
+ warning: ({ size }: {
25
+ size?: number;
26
+ }) => import("react").JSX.Element;
27
+ info: ({ size }: {
28
+ size?: number;
29
+ }) => import("react").JSX.Element;
30
+ delete: ({ size }: {
31
+ size?: number;
32
+ }) => import("react").JSX.Element;
33
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Required-field asterisk shared by form primitives.
3
+ * Colour comes from `.required` (theme `--wui-danger`) — never inline hex.
4
+ *
5
+ * @returns {import('react').JSX.Element}
6
+ */
7
+ export default function RequiredMark(): import('react').JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function toast(msg: any, variant?: string): void;
2
+ /** Error toast — red. De-duped by message so the same backend error shows once, not stacked. */
3
+ export declare function errorToast(msg: any): void;
@@ -0,0 +1,56 @@
1
+ export { default as ActionIcon } from './components/ActionIcon.jsx';
2
+ export { default as AppAccordion } from './components/AppAccordion.jsx';
3
+ export { default as AppAlert } from './components/AppAlert.jsx';
4
+ export { default as AppAutocomplete } from './components/AppAutocomplete.jsx';
5
+ export { default as AppAvatar } from './components/AppAvatar.jsx';
6
+ export { default as AppBadge } from './components/AppBadge.jsx';
7
+ export { default as AppButton } from './components/AppButton.jsx';
8
+ export { default as AppCallout } from './components/AppCallout.jsx';
9
+ export { default as AppCard } from './components/AppCard.jsx';
10
+ export { default as AppCheckbox } from './components/AppCheckbox.jsx';
11
+ export { default as AppChip } from './components/AppChip.jsx';
12
+ export { default as AppChoiceCard } from './components/AppChoiceCard.jsx';
13
+ export { default as AppChoiceChip } from './components/AppChoiceChip.jsx';
14
+ export { default as AppColorField } from './components/AppColorField.jsx';
15
+ export { default as AppCompareTable } from './components/AppCompareTable.jsx';
16
+ export { default as AppConfirmDialog } from './components/AppConfirmDialog.jsx';
17
+ export { default as AppDataTable } from './components/AppDataTable.jsx';
18
+ export { default as AppDatePicker } from './components/AppDatePicker.jsx';
19
+ export { default as AppDropdown } from './components/AppDropdown.jsx';
20
+ export { default as AppEmptyState } from './components/AppEmptyState.jsx';
21
+ export { default as AppFileAttachment } from './components/AppFileAttachment.jsx';
22
+ export { default as AppFilePicker } from './components/AppFilePicker.jsx';
23
+ export { default as AppInfoList } from './components/AppInfoList.jsx';
24
+ export { default as AppInfoTip } from './components/AppInfoTip.jsx';
25
+ export { default as AppInput } from './components/AppInput.jsx';
26
+ export { default as AppKpiTile } from './components/AppKpiTile.jsx';
27
+ export { default as AppLogoPicker } from './components/AppLogoPicker.jsx';
28
+ export { default as AppModal } from './components/AppModal.jsx';
29
+ export { default as AppMultiSelect } from './components/AppMultiSelect.jsx';
30
+ export { default as AppPageHeader } from './components/AppPageHeader.jsx';
31
+ export { default as AppPhoneNumberInput } from './components/AppPhoneNumberInput.jsx';
32
+ export { default as AppPricingCard } from './components/AppPricingCard.jsx';
33
+ export { default as AppRadio } from './components/AppRadio.jsx';
34
+ export { default as AppRepeater } from './components/AppRepeater.jsx';
35
+ export { default as AppResourceCard } from './components/AppResourceCard.jsx';
36
+ export { default as AppSearch } from './components/AppSearch.jsx';
37
+ export { default as AppSegmented } from './components/AppSegmented.jsx';
38
+ export { default as AppSelect } from './components/AppSelect.jsx';
39
+ export { default as AppSelectMini } from './components/AppSelectMini.jsx';
40
+ export { default as AppShell } from './components/AppShell.jsx';
41
+ export { default as AppSidebarMenu } from './components/AppSidebarMenu.jsx';
42
+ export { AppSkeletonRows, default as AppSkeleton } from './components/AppSkeleton.jsx';
43
+ export { default as AppSpinner } from './components/AppSpinner.jsx';
44
+ export { default as AppSplash } from './components/AppSplash.jsx';
45
+ export { default as AppStatusBadge } from './components/AppStatusBadge.jsx';
46
+ export { default as AppStepper } from './components/AppStepper.jsx';
47
+ export { default as AppSwitch } from './components/AppSwitch.jsx';
48
+ export { default as AppTableEmptyState } from './components/AppTableEmptyState.jsx';
49
+ export { default as AppTablePagination } from './components/AppTablePagination.jsx';
50
+ export { default as AppTabs } from './components/AppTabs.jsx';
51
+ export { default as AppTextarea } from './components/AppTextarea.jsx';
52
+ export { default as AppTimeline } from './components/AppTimeline.jsx';
53
+ export { default as Icon } from './components/Icon.jsx';
54
+ export { MODAL_ICONS } from './components/ModalIcons.jsx';
55
+ export { default as RequiredMark } from './components/RequiredMark.jsx';
56
+ export { errorToast, toast } from './components/toast.js';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shared portalled-listbox engine for AppSelect and AppSelectMini.
3
+ *
4
+ * Owns: open state (via usePopover), highlight, keyboard (Arrow/Home/End/Enter/Escape),
5
+ * outside-click / scroll / resize dismiss, fixed positioning under the trigger.
6
+ * Shells own chrome, option labels, and optional search field.
7
+ *
8
+ * @param {object} opts
9
+ * @param {unknown[]} opts.items Options currently shown (already filtered if searchable).
10
+ * @param {unknown} opts.value Controlled selected value.
11
+ * @param {(item: unknown, value: unknown) => boolean} opts.isSelected
12
+ * @param {(item: unknown) => void} opts.onPick Called with the chosen item; shell maps to value.
13
+ * @param {boolean} [opts.disabled]
14
+ * @param {"match-width"|"mini"} [opts.position] match-width = full field width; mini = toolbar align.
15
+ * @param {"left"|"right"} [opts.menuAlign] mini only.
16
+ * @param {() => void} [opts.onOpened] After open (e.g. focus search input).
17
+ * @param {(e: KeyboardEvent) => boolean} [opts.shouldIgnoreSpace] Return true to type space in search.
18
+ */
19
+ export default function useListboxMenu({ items, value, isSelected, onPick, disabled, position, menuAlign, onOpened, shouldIgnoreSpace, }: {
20
+ items: unknown[];
21
+ value: unknown;
22
+ isSelected: (item: unknown, value: unknown) => boolean;
23
+ onPick: (item: unknown) => void;
24
+ disabled?: boolean;
25
+ position?: "match-width" | "mini";
26
+ menuAlign?: "left" | "right";
27
+ onOpened?: () => void;
28
+ shouldIgnoreSpace?: (e: KeyboardEvent) => boolean;
29
+ }): {
30
+ open: boolean | import("react").Dispatch<import("react").SetStateAction<boolean>>;
31
+ setOpen: boolean | import("react").Dispatch<import("react").SetStateAction<boolean>>;
32
+ pos: any;
33
+ hasPos: boolean;
34
+ highlight: number;
35
+ setHighlight: import("react").Dispatch<import("react").SetStateAction<number>>;
36
+ rootRef: import("react").RefObject<any>;
37
+ menuRef: import("react").RefObject<any>;
38
+ triggerRef: import("react").RefObject<any>;
39
+ listId: string;
40
+ activeId: string;
41
+ close: (restoreFocus?: boolean) => void;
42
+ selectAt: (index: any) => void;
43
+ onListKeyDown: (e: any) => void;
44
+ onTriggerKeyDown: (e: any) => void;
45
+ toggle: () => void;
46
+ };
@@ -0,0 +1,11 @@
1
+ export declare function usePagination(items: any, initialPageSize?: number): {
2
+ page: number;
3
+ setPage: import("react").Dispatch<import("react").SetStateAction<number>>;
4
+ pageSize: number;
5
+ setPageSize: (n: any) => void;
6
+ pageCount: number;
7
+ pageRows: any;
8
+ total: any;
9
+ firstRow: number;
10
+ lastRow: number;
11
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Coordinated open/close state for a floating popover. Behaves like useState(false)
3
+ * but, whenever it opens, closes every other popover using this hook. Returns
4
+ * `[open, setOpen]` with the same (stable-setter) API as useState so call sites stay
5
+ * unchanged.
6
+ */
7
+ export default function usePopover(): (boolean | import("react").Dispatch<import("react").SetStateAction<boolean>>)[];
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Shared client-side table sort. Every ledger screen had its own identical
3
+ * `toggleSort` + comparator + `useMemo(sorted)`; this is that logic, once.
4
+ *
5
+ * `accessors` maps a column key to a value getter (defaults to `row[key]`) for
6
+ * columns whose sort value differs from the field name (e.g. "dates" → startDate).
7
+ * Pass a module-level constant so its identity is stable across renders.
8
+ *
9
+ * Numeric pairs compare numerically; everything else by locale string.
10
+ */
11
+ export declare function useTableSort(rows: any, { defaultSort, accessors }?: {
12
+ accessors?: {};
13
+ defaultSort?: {
14
+ key: any;
15
+ dir: string;
16
+ };
17
+ }): {
18
+ sort: {
19
+ key: any;
20
+ dir: string;
21
+ };
22
+ toggleSort: (key: any) => void;
23
+ sorted: any;
24
+ };
25
+ export default useTableSort;