hisd3-ui-kit 4.4.1 → 4.7.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ThemeConfig, MenuProps, TableProps, TabsProps, ButtonProps, InputProps } from 'antd';
2
- import React, { ReactNode } from 'react';
2
+ import React, { ReactNode, ComponentType } from 'react';
3
3
  import * as styled_components_dist_types from 'styled-components/dist/types';
4
4
  import * as styled_components from 'styled-components';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -71,6 +71,14 @@ interface HISD3ThemeOptions {
71
71
  overrides?: ThemeConfig;
72
72
  }
73
73
  declare const resolvePrimary: (primary?: HISD3Preset | string) => string;
74
+ /**
75
+ * Mix a hex color with black: amount 0 → color, 1 → black.
76
+ *
77
+ * Used for table backgrounds. A fixed column is `position: sticky`, so the rest
78
+ * of the row scrolls underneath it and its cells must be opaque — every Table
79
+ * background token has to be a solid blend, never an alpha overlay.
80
+ */
81
+ declare const shade: (hex: string, amount: number) => string;
74
82
  /** Mix a hex color with white: amount 0 → color, 1 → white. */
75
83
  declare const tint: (hex: string, amount: number) => string;
76
84
  /**
@@ -1041,13 +1049,66 @@ declare const HISD3Button: React.FC<HISD3ButtonProps>;
1041
1049
  type HISD3InputProps = InputProps;
1042
1050
  /** Plain text input with the HISD3 2px border. */
1043
1051
  declare const HISD3Input: React.FC<HISD3InputProps>;
1044
- interface HISD3SearchInputProps extends InputProps {
1045
- /** 48px tall instead of the 72px hero search. */
1052
+ interface HISD3SearchInputProps extends Omit<InputProps, "size"> {
1053
+ /**
1054
+ * "small" 32px, "middle" 40px (default, matches buttons), "large" 56px for a
1055
+ * standalone hero search.
1056
+ */
1057
+ size?: "small" | "middle" | "large";
1058
+ /** @deprecated use `size` — kept so existing call sites keep working. */
1046
1059
  compact?: boolean;
1047
1060
  }
1048
1061
  /** Grey filled search field with leading icon (the page-level search bar). */
1049
1062
  declare const HISD3SearchInput: React.FC<HISD3SearchInputProps>;
1050
1063
 
1064
+ /**
1065
+ * Open a drawer or modal from anywhere, without the page holding its state.
1066
+ *
1067
+ * const showRecord = useDialog(RecordEventDrawer);
1068
+ * showRecord({ fundYear, balances }, (batchId) => { if (batchId) refetch(); });
1069
+ *
1070
+ * The page no longer owns `const [open, setOpen] = useState(false)` for every
1071
+ * drawer it can show, nor renders each one inline with `open={…}`; it calls a
1072
+ * function with the props and, optionally, what to do with the result. The
1073
+ * component gets two extra props — `open` and `hide(result)` — and hands its
1074
+ * result back through `hide`, which is what reaches the second argument.
1075
+ *
1076
+ * Same shape as the `useModal`-based `UseDrawer` used in the other HISD3 apps,
1077
+ * implemented here without `react-modal-hook`: that library predates React 18,
1078
+ * and this is forty lines. Two differences worth knowing:
1079
+ *
1080
+ * - `open` is passed so antd can animate the close. `hide` sets it false,
1081
+ * fires the callback at once, and unmounts after the animation.
1082
+ * - Props are captured when `show` is called. A drawer whose parent used to
1083
+ * feed it live state (`saving`) owns that state itself now.
1084
+ *
1085
+ * Dialogs render under `DialogProvider`. Put it inside whatever providers a
1086
+ * dialog may need — the account and Apollo providers, and `HISD3Provider` for
1087
+ * the theme — so a drawer may use every hook a page may.
1088
+ */
1089
+ /** What every dialog component receives on top of its own props. */
1090
+ type DialogProps<R = void> = {
1091
+ /** True while shown; false during the close animation. Pass to antd's `open`. */
1092
+ open: boolean;
1093
+ /** Close, handing a result to whoever opened the dialog. */
1094
+ hide: (result?: R) => void;
1095
+ };
1096
+ /** The result type a component's `hide` carries. */
1097
+ type DialogResult<P> = P extends {
1098
+ hide: (result?: infer R) => void;
1099
+ } ? R : void;
1100
+ /** A component's own props, without the two the hook supplies. */
1101
+ type DialogOwnProps<P> = Omit<P, keyof DialogProps>;
1102
+ /** Where every open dialog renders. Once, near the root of the app. */
1103
+ declare function DialogProvider({ children }: {
1104
+ children: ReactNode;
1105
+ }): react_jsx_runtime.JSX.Element;
1106
+ /**
1107
+ * A function that shows `Component` with the given props. Its second argument
1108
+ * receives whatever the component passes to `hide`.
1109
+ */
1110
+ declare function useDialog<P extends DialogProps<DialogResult<P>>>(Component: ComponentType<P>): (props: DialogOwnProps<P>, onClose?: (result?: DialogResult<P>) => void) => void;
1111
+
1051
1112
  /** Shared layout metrics so the sidebar brand block and page top bar line up. */
1052
1113
  declare const HISD3_LAYOUT: {
1053
1114
  readonly siderWidth: 260;
@@ -1058,5 +1119,5 @@ declare const HISD3_LAYOUT: {
1058
1119
  readonly pageGutter: 28;
1059
1120
  };
1060
1121
 
1061
- export { AppAnimateGroups, AppAnimates, AppMotionAnimate, AuthType, Fonts, FooterType, HISD3AvatarMenu, HISD3Button, HISD3HeaderActions, HISD3Input, HISD3LoginPage, HISD3NotificationButton, HISD3PageBody, HISD3PageHeader, HISD3Provider, HISD3SearchInput, HISD3Sidebar, HISD3Table, HISD3Tabs, HISD3Tag, HISD3_BORDER_PRESETS, HISD3_COLORS, HISD3_FONT_FAMILY, HISD3_FONT_WEIGHT_BODY, HISD3_FONT_WEIGHT_HEADING, HISD3_LAYOUT, HISD3_LOGO_SRC, HISD3_NEUTRALS, HISD3_PRESETS, HeaderIconButton, HeaderType, LayoutDirection, LayoutType, MenuStyle, MessageType, NavStyle, RoutePermittedRole, RouteTransition, ThemeMode, ThemeStyle, ThemeStyleRadius, UserMenu, borderVarsCss, createHisd3Theme, getInitials, hisd3AntdTheme, hisd3VarsCss, resolvePrimary, tint, useInsideHISD3Provider };
1062
- export type { HISD3AvatarMenuProps, HISD3Borders, HISD3BreadcrumbItem, HISD3ButtonProps, HISD3ButtonVariant, HISD3HeaderActionsProps, HISD3InputProps, HISD3LoginPageProps, HISD3LoginValues, HISD3MenuItem, HISD3Notification, HISD3NotificationButtonProps, HISD3PageHeaderProps, HISD3Preset, HISD3ProviderProps, HISD3SearchInputProps, HISD3SidebarProps, HISD3TabItem, HISD3TablePagination, HISD3TableProps, HISD3TabsProps, HISD3TagProps, HISD3TagTone, HISD3TagVariant, HISD3ThemeOptions, IUserEmployee, StyledTheme, UserMenuProps };
1122
+ export { AppAnimateGroups, AppAnimates, AppMotionAnimate, AuthType, DialogProvider, Fonts, FooterType, HISD3AvatarMenu, HISD3Button, HISD3HeaderActions, HISD3Input, HISD3LoginPage, HISD3NotificationButton, HISD3PageBody, HISD3PageHeader, HISD3Provider, HISD3SearchInput, HISD3Sidebar, HISD3Table, HISD3Tabs, HISD3Tag, HISD3_BORDER_PRESETS, HISD3_COLORS, HISD3_FONT_FAMILY, HISD3_FONT_WEIGHT_BODY, HISD3_FONT_WEIGHT_HEADING, HISD3_LAYOUT, HISD3_LOGO_SRC, HISD3_NEUTRALS, HISD3_PRESETS, HeaderIconButton, HeaderType, LayoutDirection, LayoutType, MenuStyle, MessageType, NavStyle, RoutePermittedRole, RouteTransition, ThemeMode, ThemeStyle, ThemeStyleRadius, UserMenu, borderVarsCss, createHisd3Theme, getInitials, hisd3AntdTheme, hisd3VarsCss, resolvePrimary, shade, tint, useDialog, useInsideHISD3Provider };
1123
+ export type { DialogOwnProps, DialogProps, DialogResult, HISD3AvatarMenuProps, HISD3Borders, HISD3BreadcrumbItem, HISD3ButtonProps, HISD3ButtonVariant, HISD3HeaderActionsProps, HISD3InputProps, HISD3LoginPageProps, HISD3LoginValues, HISD3MenuItem, HISD3Notification, HISD3NotificationButtonProps, HISD3PageHeaderProps, HISD3Preset, HISD3ProviderProps, HISD3SearchInputProps, HISD3SidebarProps, HISD3TabItem, HISD3TablePagination, HISD3TableProps, HISD3TabsProps, HISD3TagProps, HISD3TagTone, HISD3TagVariant, HISD3ThemeOptions, IUserEmployee, LoginSide, LoginVariant, StyledTheme, UserMenuProps };