@graphty/compact-mantine 0.3.0 → 0.5.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,10 +1,14 @@
1
+ import { ActionIconProps } from '@mantine/core';
1
2
  import { default as default_2 } from 'react';
3
+ import { ForwardRefExoticComponent } from 'react';
2
4
  import { JSX } from 'react';
3
5
  import { MantineColorShade } from '@mantine/core';
4
6
  import { MantineColorsTuple } from '@mantine/core';
5
7
  import { MantineRadius } from '@mantine/core';
8
+ import { MantineTheme } from '@mantine/core';
6
9
  import { ReactNode } from 'react';
7
10
  import { ReactPortal } from 'react';
11
+ import { RefAttributes } from 'react';
8
12
  import { RefObject } from 'react';
9
13
  import { VariantColorsResolver } from '@mantine/core';
10
14
 
@@ -64,9 +68,23 @@ export declare interface CompactColorInputProps {
64
68
 
65
69
  /**
66
70
  * Color configuration for the compact theme.
71
+ * Includes all default Mantine colors plus custom dark palette.
67
72
  */
68
73
  export declare const compactColors: {
69
74
  dark: MantineColorsTuple;
75
+ gray: MantineColorsTuple;
76
+ red: MantineColorsTuple;
77
+ pink: MantineColorsTuple;
78
+ grape: MantineColorsTuple;
79
+ violet: MantineColorsTuple;
80
+ indigo: MantineColorsTuple;
81
+ blue: MantineColorsTuple;
82
+ cyan: MantineColorsTuple;
83
+ green: MantineColorsTuple;
84
+ lime: MantineColorsTuple;
85
+ yellow: MantineColorsTuple;
86
+ orange: MantineColorsTuple;
87
+ teal: MantineColorsTuple;
70
88
  };
71
89
 
72
90
  /**
@@ -81,49 +99,79 @@ export declare const compactColors: {
81
99
  export declare const compactDarkColors: MantineColorsTuple;
82
100
 
83
101
  /**
84
- * Mantine theme with "compact" size support for dense UIs.
102
+ * Full Mantine theme with compact sizing by default for dense UIs.
85
103
  *
86
- * Compact size specifications:
104
+ * This is a complete theme merged with DEFAULT_THEME, suitable for:
105
+ * - Direct use with MantineProvider
106
+ * - Merging with other themes using mergeMantineTheme()
107
+ *
108
+ * All components default to size="sm" automatically with compact styling:
87
109
  * - Input height: 24px
88
110
  * - Font size: 11px
89
111
  * - No borders
90
112
  * - Semantic color backgrounds
113
+ *
114
+ * Global token overrides:
115
+ * - fontSizes: Smaller font sizes (xs: 10px, sm: 11px, md: 13px, lg: 14px, xl: 16px)
116
+ * - spacing: Tighter spacing (xs: 4px, sm: 6px, md: 8px, lg: 12px, xl: 16px)
117
+ * - radius: Compact corner radii (xs: 2px, sm: 4px, md: 6px, lg: 8px, xl: 12px)
118
+ * @example
119
+ * ```tsx
120
+ * // Simple usage - direct with MantineProvider
121
+ * import { MantineProvider } from '@mantine/core';
122
+ * import { compactTheme } from '@graphty/compact-mantine';
123
+ *
124
+ * <MantineProvider theme={compactTheme}>
125
+ * <App />
126
+ * </MantineProvider>
127
+ * ```
91
128
  * @example
92
129
  * ```tsx
93
- * import { MantineProvider, TextInput } from '@mantine/core';
130
+ * // Extending the theme with mergeMantineTheme
131
+ * import { mergeMantineTheme, createTheme } from '@mantine/core';
94
132
  * import { compactTheme } from '@graphty/compact-mantine';
95
133
  *
96
- * function App() {
97
- * return (
98
- * <MantineProvider theme={compactTheme}>
99
- * <TextInput size="compact" label="Name" />
100
- * </MantineProvider>
101
- * );
102
- * }
134
+ * const myTheme = mergeMantineTheme(compactTheme, createTheme({
135
+ * primaryColor: 'teal',
136
+ * }));
137
+ *
138
+ * <MantineProvider theme={myTheme}>
139
+ * <App />
140
+ * </MantineProvider>
103
141
  * ```
104
142
  */
105
- export declare const compactTheme: {
106
- focusRing?: "auto" | "always" | "never" | undefined;
143
+ export declare const compactTheme: MantineTheme;
144
+
145
+ /**
146
+ * Partial theme override with compact sizing for dense UIs.
147
+ *
148
+ * This is the raw theme override created with createTheme().
149
+ * Use this if you need to merge with other theme overrides using mergeThemeOverrides().
150
+ *
151
+ * For most use cases, use `compactTheme` instead which is a full merged theme.
152
+ */
153
+ export declare const compactThemeOverride: {
154
+ focusRing?: "auto" | "never" | "always" | undefined;
107
155
  scale?: number | undefined;
108
156
  fontSmoothing?: boolean | undefined;
109
157
  white?: string | undefined;
110
158
  black?: string | undefined;
111
159
  colors?: {
112
160
  [x: string & {}]: MantineColorsTuple | undefined;
161
+ dark?: MantineColorsTuple | undefined;
162
+ gray?: MantineColorsTuple | undefined;
163
+ red?: MantineColorsTuple | undefined;
164
+ pink?: MantineColorsTuple | undefined;
165
+ grape?: MantineColorsTuple | undefined;
166
+ violet?: MantineColorsTuple | undefined;
167
+ indigo?: MantineColorsTuple | undefined;
113
168
  blue?: MantineColorsTuple | undefined;
114
169
  cyan?: MantineColorsTuple | undefined;
115
- gray?: MantineColorsTuple | undefined;
116
170
  green?: MantineColorsTuple | undefined;
117
- indigo?: MantineColorsTuple | undefined;
118
171
  lime?: MantineColorsTuple | undefined;
172
+ yellow?: MantineColorsTuple | undefined;
119
173
  orange?: MantineColorsTuple | undefined;
120
- pink?: MantineColorsTuple | undefined;
121
- red?: MantineColorsTuple | undefined;
122
174
  teal?: MantineColorsTuple | undefined;
123
- violet?: MantineColorsTuple | undefined;
124
- yellow?: MantineColorsTuple | undefined;
125
- dark?: MantineColorsTuple | undefined;
126
- grape?: MantineColorsTuple | undefined;
127
175
  } | undefined;
128
176
  primaryShade?: MantineColorShade | {
129
177
  light?: MantineColorShade | undefined;
@@ -251,9 +299,10 @@ export declare const compactTheme: {
251
299
  * @param root0.label - The label text for the group header
252
300
  * @param root0.actions - Optional action buttons to display in the header
253
301
  * @param root0.children - Child controls to render in the group
302
+ * @param root0.bleed - When true, separator line extends to parent container edges
254
303
  * @returns The control group component
255
304
  */
256
- export declare function ControlGroup({ label, actions, children }: ControlGroupProps): default_2.JSX.Element;
305
+ export declare function ControlGroup({ label, actions, children, bleed }: ControlGroupProps): default_2.JSX.Element;
257
306
 
258
307
  /**
259
308
  * Props for the ControlGroup component.
@@ -265,6 +314,12 @@ export declare interface ControlGroupProps {
265
314
  actions?: ReactNode;
266
315
  /** Group content */
267
316
  children: ReactNode;
317
+ /**
318
+ * When true, the separator line extends beyond the component boundaries
319
+ * to reach the edges of the parent container (useful inside Popouts with padding).
320
+ * Uses negative margins to counteract the parent's padding.
321
+ */
322
+ bleed?: boolean;
268
323
  }
269
324
 
270
325
  /**
@@ -342,38 +397,6 @@ export declare function createDefaultGradientStops(): ColorStop[];
342
397
  */
343
398
  export declare const DEFAULT_GRADIENT_STOP_COLOR = "#888888";
344
399
 
345
- /**
346
- * A checkbox toggle that shows/hides child controls.
347
- * Supports both controlled and uncontrolled modes.
348
- * Used for enabling/disabling effects like glow and outline.
349
- * Provides clean visual indent for child content.
350
- * @param root0 - Component props
351
- * @param root0.label - The label for the toggle checkbox
352
- * @param root0.checked - Whether the toggle is checked (controlled mode)
353
- * @param root0.defaultChecked - Default checked state for uncontrolled mode
354
- * @param root0.onChange - Called when the toggle state changes (optional for uncontrolled mode)
355
- * @param root0.children - Child controls to show when checked
356
- * @returns The effect toggle component
357
- */
358
- export declare function EffectToggle({ label, checked, defaultChecked, onChange, children, }: EffectToggleProps): default_2.JSX.Element;
359
-
360
- /**
361
- * Props for EffectToggle component.
362
- * Supports both controlled and uncontrolled modes via useUncontrolled pattern.
363
- */
364
- export declare interface EffectToggleProps {
365
- /** Checkbox label */
366
- label: string;
367
- /** Whether effect is enabled (controlled mode) */
368
- checked?: boolean;
369
- /** Default checked state for uncontrolled mode */
370
- defaultChecked?: boolean;
371
- /** Called when checked state changes (optional for uncontrolled mode) */
372
- onChange?: (checked: boolean) => void;
373
- /** Content shown when checked */
374
- children: ReactNode;
375
- }
376
-
377
400
  /**
378
401
  * Editor for gradient color stops with optional direction control.
379
402
  * Supports both controlled and uncontrolled modes.
@@ -468,6 +491,7 @@ export declare const Popout: typeof PopoutRoot & {
468
491
  Trigger: typeof PopoutTrigger;
469
492
  Panel: typeof PopoutPanel;
470
493
  Content: typeof PopoutContent;
494
+ Anchor: typeof PopoutAnchor;
471
495
  };
472
496
 
473
497
  /**
@@ -495,6 +519,72 @@ export declare const POPOUT_Z_INDEX_BASE = 1000;
495
519
  */
496
520
  declare type PopoutAlignment = "start" | "center" | "end";
497
521
 
522
+ /**
523
+ * Provides an anchor element for descendant Popout panels to align to.
524
+ *
525
+ * When a Popout.Panel is inside a PopoutAnchor and doesn't have an explicit
526
+ * `anchorRef` prop, it will automatically align to the anchor element.
527
+ *
528
+ * This is useful for sidebars, control panels, or any container where you
529
+ * want popouts to align to the container edge rather than just the trigger.
530
+ * @param props - Component props
531
+ * @param props.children - The container element (must accept a ref)
532
+ * @returns The PopoutAnchor component
533
+ * @example
534
+ * ```tsx
535
+ * <Popout.Anchor>
536
+ * <Box style={{ width: 240, borderLeft: '1px solid gray' }}>
537
+ * <Popout>
538
+ * <Popout.Trigger>
539
+ * <PopoutButton icon={<Settings />} aria-label="Settings" />
540
+ * </Popout.Trigger>
541
+ * <Popout.Panel width={280} header={{ variant: "title", title: "Settings" }}>
542
+ * <Popout.Content>Content aligns to sidebar edge</Popout.Content>
543
+ * </Popout.Panel>
544
+ * </Popout>
545
+ * </Box>
546
+ * </Popout.Anchor>
547
+ * ```
548
+ */
549
+ declare function PopoutAnchor({ children }: PopoutAnchorProps): JSX.Element;
550
+
551
+ /**
552
+ * Props for PopoutAnchor.
553
+ */
554
+ declare interface PopoutAnchorProps {
555
+ /** The container element to use as anchor. Must accept a ref. */
556
+ children: ReactNode;
557
+ }
558
+
559
+ /**
560
+ * A button component designed to be used as a Popout trigger.
561
+ * Automatically highlights when the associated popout is open.
562
+ * Features:
563
+ * - Uses `subtle` variant when popout is closed (dimmed appearance)
564
+ * - Uses `light` variant when popout is open (highlighted appearance)
565
+ * - Must be used within a Popout component (inside Popout.Trigger)
566
+ * @example
567
+ * ```tsx
568
+ * <Popout>
569
+ * <Popout.Trigger>
570
+ * <PopoutButton icon={<Settings size={12} />} aria-label="Open settings" />
571
+ * </Popout.Trigger>
572
+ * <Popout.Panel width={280} header={{ variant: "title", title: "Settings" }}>
573
+ * <Popout.Content>Content here</Popout.Content>
574
+ * </Popout.Panel>
575
+ * </Popout>
576
+ * ```
577
+ */
578
+ export declare const PopoutButton: ForwardRefExoticComponent<PopoutButtonProps & RefAttributes<HTMLButtonElement>>;
579
+
580
+ /**
581
+ * Props for the PopoutButton component.
582
+ */
583
+ declare interface PopoutButtonProps extends Omit<ActionIconProps, "variant" | "children"> {
584
+ /** The icon to display inside the button */
585
+ icon: ReactNode;
586
+ }
587
+
498
588
  /**
499
589
  * Container for popout panel content.
500
590
  * Provides consistent padding and styling for panel content.
@@ -910,6 +1000,38 @@ export declare const SWATCH_COLORS: readonly ["#5B8FF9", "#FF6B6B", "#61D095", "
910
1000
  */
911
1001
  export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#61D095FF", "#F7B731FF", "#9B59B6FF", "#5B8FF980", "#FF6B6B80", "#61D09580", "#F7B73180", "#9B59B680"];
912
1002
 
1003
+ /**
1004
+ * A checkbox toggle that shows/hides child controls.
1005
+ * Supports both controlled and uncontrolled modes.
1006
+ * Used for enabling/disabling optional features with nested configuration.
1007
+ * Provides clean visual indent for child content.
1008
+ * @param root0 - Component props
1009
+ * @param root0.label - The label for the toggle checkbox
1010
+ * @param root0.checked - Whether the toggle is checked (controlled mode)
1011
+ * @param root0.defaultChecked - Default checked state for uncontrolled mode
1012
+ * @param root0.onChange - Called when the toggle state changes (optional for uncontrolled mode)
1013
+ * @param root0.children - Child controls to show when checked
1014
+ * @returns The toggle with content component
1015
+ */
1016
+ export declare function ToggleWithContent({ label, checked, defaultChecked, onChange, children, }: ToggleWithContentProps): default_2.JSX.Element;
1017
+
1018
+ /**
1019
+ * Props for ToggleWithContent component.
1020
+ * Supports both controlled and uncontrolled modes via useUncontrolled pattern.
1021
+ */
1022
+ export declare interface ToggleWithContentProps {
1023
+ /** Checkbox label */
1024
+ label: string;
1025
+ /** Whether toggle is enabled (controlled mode) */
1026
+ checked?: boolean;
1027
+ /** Default checked state for uncontrolled mode */
1028
+ defaultChecked?: boolean;
1029
+ /** Called when checked state changes (optional for uncontrolled mode) */
1030
+ onChange?: (checked: boolean) => void;
1031
+ /** Content shown when checked */
1032
+ children: ReactNode;
1033
+ }
1034
+
913
1035
  /**
914
1036
  * Convert RGB hex and opacity to HEXA format.
915
1037
  * @param hex - Color in hex format (#RRGGBB)