@nubitio/ui 0.6.9 → 0.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.mts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1, { ButtonHTMLAttributes, FormHTMLAttributes, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactNode, SelectHTMLAttributes, TextareaHTMLAttributes } from "react";
1
+ import React, { ButtonHTMLAttributes, CSSProperties, FormHTMLAttributes, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactNode, RefObject, SelectHTMLAttributes, TextareaHTMLAttributes } from "react";
2
2
 
3
3
  //#region packages/ui/Avatar.d.ts
4
4
  type AvatarShape = 'circle' | 'square';
@@ -31,7 +31,7 @@ declare const Avatar: ({
31
31
  shape,
32
32
  alt,
33
33
  className
34
- }: AvatarProps) => React$1.JSX.Element;
34
+ }: AvatarProps) => React.JSX.Element;
35
35
  //#endregion
36
36
  //#region packages/ui/AppDialog.d.ts
37
37
  interface AppDialogProps {
@@ -39,8 +39,8 @@ interface AppDialogProps {
39
39
  open?: boolean;
40
40
  title: string;
41
41
  onClose: () => void;
42
- children: React$1.ReactNode;
43
- footer?: React$1.ReactNode;
42
+ children: React.ReactNode;
43
+ footer?: React.ReactNode;
44
44
  width?: number | string;
45
45
  maxWidth?: number | string;
46
46
  height?: number | string;
@@ -87,7 +87,7 @@ declare const AppDialog: ({
87
87
  bodyClassName,
88
88
  footerClassName,
89
89
  role
90
- }: AppDialogProps) => React$1.ReactPortal | null;
90
+ }: AppDialogProps) => React.ReactPortal | null;
91
91
  //#endregion
92
92
  //#region packages/ui/ConfirmDialog.d.ts
93
93
  interface ConfirmDialogProps {
@@ -128,7 +128,7 @@ declare const AppToolbar: ({
128
128
  icon,
129
129
  refreshLabel,
130
130
  children
131
- }: AppToolbarProps & React$1.PropsWithChildren) => React$1.JSX.Element;
131
+ }: AppToolbarProps & React.PropsWithChildren) => React.JSX.Element;
132
132
  //#endregion
133
133
  //#region packages/ui/Button.d.ts
134
134
  type ButtonVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'ghost';
@@ -180,7 +180,7 @@ declare const Card: ({
180
180
  variant,
181
181
  className,
182
182
  children
183
- }: React$1.PropsWithChildren<CardProps>) => React$1.JSX.Element;
183
+ }: React.PropsWithChildren<CardProps>) => React.JSX.Element;
184
184
  //#endregion
185
185
  //#region packages/ui/FormControls.d.ts
186
186
  interface FormFieldProps extends LabelHTMLAttributes<HTMLLabelElement> {
@@ -347,20 +347,20 @@ interface ThemeContextValue {
347
347
  switchTheme: () => void;
348
348
  isLoaded: boolean;
349
349
  }
350
- declare const ThemeContext: React$1.Context<ThemeContextValue | null>;
350
+ declare const ThemeContext: React.Context<ThemeContextValue | null>;
351
351
  declare function useTheme(): ThemeContextValue;
352
352
  interface ThemeProviderProps {
353
353
  storageKey?: string;
354
354
  themePrefix?: string;
355
355
  basePath?: string;
356
- children: React$1.ReactNode;
356
+ children: React.ReactNode;
357
357
  }
358
358
  declare const ThemeProvider: ({
359
359
  storageKey,
360
360
  themePrefix,
361
361
  basePath,
362
362
  children
363
- }: ThemeProviderProps) => React$1.JSX.Element;
363
+ }: ThemeProviderProps) => React.JSX.Element;
364
364
  //#endregion
365
365
  //#region packages/ui/theme/ThemeSwitcher.d.ts
366
366
  declare const labelByMode: {
@@ -373,7 +373,7 @@ interface ThemeSwitcherProps {
373
373
  }
374
374
  declare const ThemeSwitcher: ({
375
375
  labelByMode: overrides
376
- }?: ThemeSwitcherProps) => React$1.JSX.Element;
376
+ }?: ThemeSwitcherProps) => React.JSX.Element;
377
377
  //#endregion
378
378
  //#region packages/ui/theme/DensityProvider.d.ts
379
379
  type Density = 'normal' | 'compact';
@@ -381,13 +381,13 @@ interface DensityContextValue {
381
381
  density: Density;
382
382
  toggleDensity: () => void;
383
383
  }
384
- declare const DensityContext: React$1.Context<DensityContextValue | null>;
384
+ declare const DensityContext: React.Context<DensityContextValue | null>;
385
385
  declare function useDensity(): DensityContextValue;
386
386
  declare const DensityProvider: ({
387
387
  children
388
388
  }: {
389
- children: React$1.ReactNode;
390
- }) => React$1.JSX.Element;
389
+ children: React.ReactNode;
390
+ }) => React.JSX.Element;
391
391
  //#endregion
392
392
  //#region packages/ui/theme/useAccentColor.d.ts
393
393
  interface AccentPreset {
@@ -407,12 +407,12 @@ interface SettingsPanelProps {
407
407
  }
408
408
  declare const SettingsPanel: ({
409
409
  onClose: _onClose
410
- }: SettingsPanelProps) => React$1.JSX.Element;
410
+ }: SettingsPanelProps) => React.JSX.Element;
411
411
  //#endregion
412
412
  //#region packages/ui/FeatureGate.d.ts
413
413
  interface FeatureGateProps {
414
414
  featureKey: string;
415
- children: React$1.ReactNode;
415
+ children: React.ReactNode;
416
416
  enabled?: boolean;
417
417
  behavior?: 'lock' | 'upgrade';
418
418
  planBadge?: string;
@@ -429,7 +429,7 @@ declare function FeatureGate({
429
429
  upgradeMessage,
430
430
  upgradeUrl,
431
431
  lockTooltip
432
- }: FeatureGateProps): React$1.JSX.Element;
432
+ }: FeatureGateProps): React.JSX.Element;
433
433
  //#endregion
434
434
  //#region packages/ui/Badge.d.ts
435
435
  type BadgeVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
@@ -539,7 +539,7 @@ declare const Chip: ({
539
539
  disabled,
540
540
  onClick,
541
541
  className
542
- }: ChipProps) => React$1.JSX.Element;
542
+ }: ChipProps) => React.JSX.Element;
543
543
  //#endregion
544
544
  //#region packages/ui/Toggle.d.ts
545
545
  interface ToggleProps {
@@ -547,7 +547,7 @@ interface ToggleProps {
547
547
  checked: boolean;
548
548
  onChange: (checked: boolean) => void;
549
549
  /** Optional label rendered in a flex row alongside the toggle */
550
- label?: React$1.ReactNode;
550
+ label?: React.ReactNode;
551
551
  /** Size variant */
552
552
  size?: 'sm' | 'md';
553
553
  disabled?: boolean;
@@ -570,7 +570,7 @@ declare const Toggle: ({
570
570
  disabled,
571
571
  "aria-label": ariaLabel,
572
572
  className
573
- }: ToggleProps) => React$1.JSX.Element;
573
+ }: ToggleProps) => React.JSX.Element;
574
574
  //#endregion
575
575
  //#region packages/ui/ContextMenu.d.ts
576
576
  interface ContextMenuItem {
@@ -615,7 +615,7 @@ declare const ContextMenu: ({
615
615
  triggerLabel,
616
616
  align,
617
617
  className
618
- }: ContextMenuProps) => React$1.JSX.Element | null;
618
+ }: ContextMenuProps) => React.JSX.Element | null;
619
619
  //#endregion
620
620
  //#region packages/ui/StatCard.d.ts
621
621
  interface StatCardProps {
@@ -644,7 +644,7 @@ declare const StatCard: ({
644
644
  isLoading,
645
645
  className,
646
646
  children
647
- }: StatCardProps) => React$1.JSX.Element;
647
+ }: StatCardProps) => React.JSX.Element;
648
648
  //#endregion
649
649
  //#region packages/ui/KpiMetricRow.d.ts
650
650
  type KpiMetricTone = 'default' | 'success' | 'warning' | 'danger';
@@ -818,7 +818,7 @@ declare function HubPanel({
818
818
  //#region packages/ui/CollapsibleSection.d.ts
819
819
  interface CollapsibleSectionProps {
820
820
  /** Section heading text. */
821
- label: React$1.ReactNode;
821
+ label: React.ReactNode;
822
822
  /** Optional Phosphor icon class string, e.g. "ph ph-chat-circle". */
823
823
  icon?: string;
824
824
  /** Controlled open state. */
@@ -826,12 +826,12 @@ interface CollapsibleSectionProps {
826
826
  /** Called when the header trigger is clicked. */
827
827
  onToggle: () => void;
828
828
  /** Body content — always mounted, hidden via CSS when collapsed. */
829
- children: React$1.ReactNode;
829
+ children: React.ReactNode;
830
830
  /**
831
831
  * Optional trailing slot rendered to the right of the label.
832
832
  * Useful for a clear button or indicator badge.
833
833
  */
834
- trailing?: React$1.ReactNode;
834
+ trailing?: React.ReactNode;
835
835
  className?: string;
836
836
  /** Additional class applied to the body container. */
837
837
  bodyClassName?: string;
@@ -856,7 +856,7 @@ declare const CollapsibleSection: ({
856
856
  className,
857
857
  bodyClassName,
858
858
  "data-testid": testId
859
- }: CollapsibleSectionProps) => React$1.JSX.Element;
859
+ }: CollapsibleSectionProps) => React.JSX.Element;
860
860
  //#endregion
861
861
  //#region packages/ui/DatePicker.d.ts
862
862
  interface DatePickerProps {
@@ -877,9 +877,9 @@ interface DatePickerProps {
877
877
  className?: string;
878
878
  ariaLabel?: string;
879
879
  onChange?: (value: string) => void;
880
- onBlur?: React$1.FocusEventHandler<HTMLElement>;
880
+ onBlur?: React.FocusEventHandler<HTMLElement>;
881
881
  }
882
- declare const DatePicker: React$1.ForwardRefExoticComponent<DatePickerProps & React$1.RefAttributes<HTMLInputElement>>;
882
+ declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
883
883
  //#endregion
884
884
  //#region packages/ui/DateRangePicker.d.ts
885
885
  interface DateRangePickerProps {
@@ -896,7 +896,7 @@ interface DateRangePickerProps {
896
896
  className?: string;
897
897
  ariaLabel?: string;
898
898
  onChange?: (startValue: string, endValue: string) => void;
899
- onBlur?: React$1.FocusEventHandler<HTMLElement>;
899
+ onBlur?: React.FocusEventHandler<HTMLElement>;
900
900
  }
901
901
  declare function DateRangePicker({
902
902
  startValue,
@@ -913,7 +913,7 @@ declare function DateRangePicker({
913
913
  ariaLabel,
914
914
  onChange,
915
915
  onBlur
916
- }: DateRangePickerProps): React$1.JSX.Element;
916
+ }: DateRangePickerProps): React.JSX.Element;
917
917
  //#endregion
918
918
  //#region packages/ui/Popover.d.ts
919
919
  type PopoverAlign = 'start' | 'end';
@@ -925,14 +925,14 @@ interface PopoverProps {
925
925
  trigger: (props: {
926
926
  open: boolean;
927
927
  toggle: () => void;
928
- }) => React$1.ReactNode;
928
+ }) => React.ReactNode;
929
929
  /**
930
930
  * Render prop for the panel content.
931
931
  * `close` is a callback to close the popover.
932
932
  */
933
933
  panel: (props: {
934
934
  close: () => void;
935
- }) => React$1.ReactNode;
935
+ }) => React.ReactNode;
936
936
  /**
937
937
  * Horizontal alignment of the panel relative to the container.
938
938
  * - 'end' (default): right-aligns the panel (panel right = container right)
@@ -949,21 +949,42 @@ declare const Popover: ({
949
949
  align,
950
950
  ariaLabel,
951
951
  className
952
- }: PopoverProps) => React$1.JSX.Element;
952
+ }: PopoverProps) => React.JSX.Element;
953
953
  //#endregion
954
954
  //#region packages/ui/useFloatingPanel.d.ts
955
- interface UseFloatingPanelOptions {
956
- /** Called when the panel is closed by click-outside or Escape. */
955
+ interface UseFloatingPanelOptions<C extends HTMLElement = HTMLDivElement> {
956
+ /** Called whenever the panel closes (dismiss, Escape or programmatic). */
957
957
  onClose?: () => void;
958
+ /** Called on every open/close transition. */
959
+ onOpenChange?: (open: boolean) => void;
960
+ /** Event used for outside-click dismissal. */
961
+ dismissEvent?: 'pointerdown' | 'mousedown';
962
+ /** Called after Escape closes the panel (e.g. preventDefault + focus return). */
963
+ onEscape?: (event: KeyboardEvent) => void;
964
+ /**
965
+ * Anchored mode: compute the panel's fixed-position style from the current
966
+ * layout. Runs before paint on open and again on scroll/resize while open.
967
+ * Return null to keep the previous style (e.g. anchor not measurable yet).
968
+ */
969
+ computeStyle?: (container: C | null) => CSSProperties | null;
970
+ /** Close when the container scrolls fully out of the viewport (anchored mode). */
971
+ closeOnViewportExit?: boolean;
958
972
  }
959
- interface UseFloatingPanelResult {
973
+ interface UseFloatingPanelResult<C extends HTMLElement = HTMLDivElement, P extends HTMLElement = HTMLDivElement> {
960
974
  open: boolean;
961
975
  setOpen: (open: boolean) => void;
976
+ /** Closes when open; computes the anchored style and opens otherwise. */
962
977
  toggle: () => void;
963
- /** Attach this ref to the element that contains both trigger and panel. */
964
- containerRef: React.RefObject<HTMLDivElement | null>;
965
- }
966
- declare function useFloatingPanel(options?: UseFloatingPanelOptions): UseFloatingPanelResult;
978
+ /** Computes the anchored style (when configured) and opens. */
979
+ openPanel: () => void;
980
+ /** Attach to the element containing the trigger (and in-flow panels). */
981
+ containerRef: RefObject<C | null>;
982
+ /** Attach to a portalled panel so outside-click treats it as inside. */
983
+ panelRef: RefObject<P | null>;
984
+ /** Current anchored style; starts hidden until first computed. */
985
+ panelStyle: CSSProperties;
986
+ }
987
+ declare function useFloatingPanel<C extends HTMLElement = HTMLDivElement, P extends HTMLElement = HTMLDivElement>(options?: UseFloatingPanelOptions<C>): UseFloatingPanelResult<C, P>;
967
988
  //#endregion
968
989
  //#region packages/ui/Drawer.d.ts
969
990
  type DrawerSide = 'right' | 'left';
@@ -973,7 +994,7 @@ interface DrawerProps {
973
994
  /** Called on Escape, scrim click, or the built-in close button. */
974
995
  onClose: () => void;
975
996
  /** Optional title rendered in the header. */
976
- title?: React$1.ReactNode;
997
+ title?: React.ReactNode;
977
998
  /** Width of the panel. Accepts any CSS value or a number (px). */
978
999
  width?: number | string;
979
1000
  /** Which side the drawer slides in from. Default: right. */
@@ -985,9 +1006,9 @@ interface DrawerProps {
985
1006
  */
986
1007
  scrim?: 'subtle' | 'overlay';
987
1008
  /** Content rendered inside the scrollable body. */
988
- children: React$1.ReactNode;
1009
+ children: React.ReactNode;
989
1010
  /** Optional sticky footer (e.g. action buttons). */
990
- footer?: React$1.ReactNode;
1011
+ footer?: React.ReactNode;
991
1012
  /** Accessible label for the close button. Defaults to UiStrings `close`. */
992
1013
  closeLabel?: string;
993
1014
  /** Accessible label for the backdrop scrim. Defaults to UiStrings `closePanel`. */
@@ -997,7 +1018,7 @@ interface DrawerProps {
997
1018
  /** aria-label for the dialog when no title is provided. */
998
1019
  'aria-label'?: string;
999
1020
  }
1000
- declare const Drawer: React$1.FC<DrawerProps>;
1021
+ declare const Drawer: React.FC<DrawerProps>;
1001
1022
  //#endregion
1002
1023
  //#region packages/ui/Timeline.d.ts
1003
1024
  type TimelineVariant = 'stepper' | 'log';
@@ -1040,7 +1061,7 @@ declare function TimelineItem({
1040
1061
  tone,
1041
1062
  children,
1042
1063
  className
1043
- }: TimelineItemProps): React$1.JSX.Element;
1064
+ }: TimelineItemProps): React.JSX.Element;
1044
1065
  declare function Timeline({
1045
1066
  variant,
1046
1067
  orientation,
@@ -1049,7 +1070,7 @@ declare function Timeline({
1049
1070
  children,
1050
1071
  className,
1051
1072
  'aria-label': ariaLabel
1052
- }: TimelineProps): React$1.JSX.Element;
1073
+ }: TimelineProps): React.JSX.Element;
1053
1074
  //#endregion
1054
1075
  //#region packages/ui/UiStrings.d.ts
1055
1076
  /**
@@ -1115,9 +1136,9 @@ declare const ES_UI_STRINGS: UiStrings;
1115
1136
  interface UiStringsProviderProps {
1116
1137
  /** Full or partial string set; missing keys fall back to English. */
1117
1138
  strings: Partial<UiStrings>;
1118
- children: React$1.ReactNode;
1139
+ children: React.ReactNode;
1119
1140
  }
1120
- declare const UiStringsProvider: React$1.FC<UiStringsProviderProps>;
1141
+ declare const UiStringsProvider: React.FC<UiStringsProviderProps>;
1121
1142
  declare const useUiStrings: () => UiStrings;
1122
1143
  //#endregion
1123
1144
  //#region packages/ui/layoutUtils.d.ts