baseline-kit 2.0.1 → 3.0.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/README.md +258 -102
- package/dist/README.md +258 -102
- package/dist/baseline-kit.css +151 -0
- package/dist/components/Baseline/Baseline.d.ts +4 -5
- package/dist/components/Box/Box.d.ts +16 -5
- package/dist/components/Config/Config.d.ts +60 -17
- package/dist/components/Config/defaults.d.ts +2 -2
- package/dist/components/Config/index.d.ts +1 -1
- package/dist/components/Guide/Guide.d.ts +21 -12
- package/dist/components/Guide/index.d.ts +0 -6
- package/dist/components/Guide/types.d.ts +1 -1
- package/dist/components/Layout/Layout.d.ts +10 -6
- package/dist/components/Padder/Padder.d.ts +13 -7
- package/dist/components/Spacer/Spacer.d.ts +40 -11
- package/dist/components/Stack/Stack.d.ts +15 -8
- package/dist/components/index.d.ts +4 -3
- package/dist/components/styles/index.d.ts +11 -0
- package/dist/components/types.d.ts +3 -3
- package/dist/hooks/useBaseline.d.ts +13 -18
- package/dist/hooks/useConfig.d.ts +3 -8
- package/dist/hooks/useDebug.d.ts +1 -6
- package/dist/hooks/useGuide.d.ts +2 -7
- package/dist/hooks/useIsClient.d.ts +6 -0
- package/dist/hooks/useVirtual.d.ts +0 -5
- package/dist/index.cjs +1 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -3
- package/dist/index.mjs +1557 -1542
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.ts +6 -0
- package/dist/theme/dark.css +67 -0
- package/dist/theme/default.css +82 -0
- package/dist/theme/tokens.css +82 -0
- package/dist/theme.css +142 -0
- package/dist/theme.d.ts +6 -0
- package/dist/utils/convert.d.ts +0 -22
- package/dist/utils/grid.d.ts +22 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/math.d.ts +20 -36
- package/dist/utils/merge.d.ts +54 -5
- package/dist/utils/normalize.d.ts +0 -35
- package/dist/utils/parse.d.ts +0 -34
- package/dist/utils/snapping.d.ts +0 -5
- package/dist/utils/ssr.d.ts +26 -0
- package/dist/utils/timing.d.ts +0 -5
- package/package.json +81 -39
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Box Component
|
|
3
|
-
* @description A fundamental layout container with baseline grid alignment
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
2
|
+
import { ComponentsProps } from '../types';
|
|
7
3
|
/**
|
|
8
4
|
* Determines how the Box component aligns to the baseline grid.
|
|
9
5
|
*
|
|
@@ -13,6 +9,19 @@ import * as React from 'react';
|
|
|
13
9
|
* - `clamp`: Both height and spacing values snap to base unit multiples
|
|
14
10
|
*/
|
|
15
11
|
export type SnappingMode = 'none' | 'height' | 'clamp';
|
|
12
|
+
export type BoxProps = {
|
|
13
|
+
/** Number of columns to span in a grid layout */
|
|
14
|
+
colSpan?: number;
|
|
15
|
+
/** Number of rows to span in a grid layout */
|
|
16
|
+
rowSpan?: number;
|
|
17
|
+
/** Shorthand for equal column and row span. Takes precedence over individual spans */
|
|
18
|
+
span?: number;
|
|
19
|
+
/** Controls baseline grid alignment behavior */
|
|
20
|
+
snapping?: SnappingMode;
|
|
21
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
22
|
+
ssrMode?: boolean;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
} & ComponentsProps;
|
|
16
25
|
/**
|
|
17
26
|
* A foundational container component that ensures consistent spacing and baseline alignment.
|
|
18
27
|
*
|
|
@@ -52,6 +61,8 @@ export declare const Box: React.NamedExoticComponent<{
|
|
|
52
61
|
span?: number;
|
|
53
62
|
/** Controls baseline grid alignment behavior */
|
|
54
63
|
snapping?: SnappingMode;
|
|
64
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
65
|
+
ssrMode?: boolean;
|
|
55
66
|
children?: React.ReactNode;
|
|
56
67
|
} & {
|
|
57
68
|
debugging?: import("..").DebuggingMode;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Config Component
|
|
3
|
-
* @description Theme and configuration provider for baseline-kit components
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
7
|
-
import { BaselineVariant } from '
|
|
2
|
+
import { BaselineVariant } from '@/components';
|
|
8
3
|
import type { GuideVariant, Variant } from '../types';
|
|
9
4
|
/**
|
|
10
5
|
* Controls component debugging visibility and behavior.
|
|
@@ -25,7 +20,7 @@ type Colors = {
|
|
|
25
20
|
text: string;
|
|
26
21
|
};
|
|
27
22
|
/** Complete configuration schema for baseline-kit. */
|
|
28
|
-
export type
|
|
23
|
+
export type ConfigSchema = {
|
|
29
24
|
/** Base unit for spacing calculations */
|
|
30
25
|
base: number;
|
|
31
26
|
/** Guide component configuration */
|
|
@@ -67,28 +62,76 @@ export type Config = {
|
|
|
67
62
|
debugging: DebuggingMode;
|
|
68
63
|
};
|
|
69
64
|
};
|
|
70
|
-
export declare const useDefaultConfig: () =>
|
|
65
|
+
export declare const useDefaultConfig: () => ConfigSchema;
|
|
71
66
|
type ConfigProps = {
|
|
72
67
|
children: React.ReactNode;
|
|
73
68
|
/** Base unit for spacing calculations */
|
|
74
69
|
base?: number;
|
|
75
70
|
/** Baseline component overrides */
|
|
76
|
-
baseline?: Partial<
|
|
71
|
+
baseline?: Partial<ConfigSchema['baseline']>;
|
|
77
72
|
/** Flex component overrides */
|
|
78
|
-
stack?: Partial<
|
|
73
|
+
stack?: Partial<ConfigSchema['stack']>;
|
|
79
74
|
/** Layout component overrides */
|
|
80
|
-
layout?: Partial<
|
|
75
|
+
layout?: Partial<ConfigSchema['layout']>;
|
|
76
|
+
/** Guide component overrides */
|
|
77
|
+
guide?: Partial<ConfigSchema['guide']>;
|
|
78
|
+
/** Spacer component overrides */
|
|
79
|
+
spacer?: Partial<ConfigSchema['spacer']>;
|
|
80
|
+
/** Box component overrides */
|
|
81
|
+
box?: Partial<ConfigSchema['box']>;
|
|
82
|
+
/** Padder component overrides */
|
|
83
|
+
padder?: Partial<ConfigSchema['padder']>;
|
|
84
|
+
};
|
|
85
|
+
/** Parameters for creating CSS variables */
|
|
86
|
+
type CSSVariablesParams = {
|
|
87
|
+
/** Base unit for spacing calculations */
|
|
88
|
+
base: number;
|
|
89
|
+
/** Baseline component configuration */
|
|
90
|
+
baseline: ConfigSchema['baseline'];
|
|
91
|
+
/** Guide component configuration */
|
|
92
|
+
guide: ConfigSchema['guide'];
|
|
93
|
+
/** Stack component configuration */
|
|
94
|
+
stack: ConfigSchema['stack'];
|
|
95
|
+
/** Spacer component configuration */
|
|
96
|
+
spacer: ConfigSchema['spacer'];
|
|
97
|
+
/** Layout component configuration */
|
|
98
|
+
layout: ConfigSchema['layout'];
|
|
99
|
+
/** Box component configuration */
|
|
100
|
+
box: ConfigSchema['box'];
|
|
101
|
+
/** Padder component configuration */
|
|
102
|
+
padder: ConfigSchema['padder'];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Creates CSS variables from the configuration object.
|
|
106
|
+
* These variables are used throughout the component library.
|
|
107
|
+
*/
|
|
108
|
+
export declare const createCSSVariables: (params: CSSVariablesParams) => Record<string, string>;
|
|
109
|
+
/** Parameters for merging configuration */
|
|
110
|
+
type MergeConfigParams = {
|
|
111
|
+
/** Parent configuration to extend */
|
|
112
|
+
parentConfig: ConfigSchema;
|
|
113
|
+
/** Base unit override */
|
|
114
|
+
base?: number;
|
|
115
|
+
/** Baseline component overrides */
|
|
116
|
+
baseline?: Partial<ConfigSchema['baseline']>;
|
|
81
117
|
/** Guide component overrides */
|
|
82
|
-
guide?: Partial<
|
|
118
|
+
guide?: Partial<ConfigSchema['guide']>;
|
|
83
119
|
/** Spacer component overrides */
|
|
84
|
-
spacer?: Partial<
|
|
120
|
+
spacer?: Partial<ConfigSchema['spacer']>;
|
|
85
121
|
/** Box component overrides */
|
|
86
|
-
box?: Partial<
|
|
122
|
+
box?: Partial<ConfigSchema['box']>;
|
|
123
|
+
/** Stack component overrides */
|
|
124
|
+
stack?: Partial<ConfigSchema['stack']>;
|
|
125
|
+
/** Layout component overrides */
|
|
126
|
+
layout?: Partial<ConfigSchema['layout']>;
|
|
87
127
|
/** Padder component overrides */
|
|
88
|
-
padder?: Partial<
|
|
128
|
+
padder?: Partial<ConfigSchema['padder']>;
|
|
89
129
|
};
|
|
90
|
-
/**
|
|
91
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Merges parent config with overrides.
|
|
132
|
+
* Creates a new config object without mutating the parent.
|
|
133
|
+
*/
|
|
134
|
+
export declare const mergeConfig: (params: MergeConfigParams) => ConfigSchema;
|
|
92
135
|
/**
|
|
93
136
|
* Configuration provider for baseline-kit components.
|
|
94
137
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description Default theme and configuration values for baseline-kit
|
|
4
4
|
* @module baseline-kit/components/Config
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { ConfigSchema } from './Config';
|
|
7
7
|
/**
|
|
8
8
|
* Default configuration for baseline-kit.
|
|
9
9
|
*
|
|
@@ -22,4 +22,4 @@ import type { Config } from './Config';
|
|
|
22
22
|
* The configuration is marked as const to ensure type safety
|
|
23
23
|
* and prevent accidental modifications.
|
|
24
24
|
*/
|
|
25
|
-
export declare const DEFAULT_CONFIG:
|
|
25
|
+
export declare const DEFAULT_CONFIG: ConfigSchema;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Guide Component
|
|
3
|
-
* @description Visual grid overlay component for alignment and debugging
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
2
|
+
import { ComponentsProps } from '@components';
|
|
7
3
|
import { AutoConfig, FixedConfig, LineConfig, PatternConfig } from './types';
|
|
8
|
-
import type {
|
|
4
|
+
import type { GuideVariant } from '../types';
|
|
9
5
|
/** Merged configuration types that support various grid layout strategies */
|
|
10
6
|
export type GuideConfig = PatternConfig | AutoConfig | FixedConfig | LineConfig;
|
|
11
7
|
export type GuideProps = {
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/** Controls horizontal alignment of columns within the container */
|
|
9
|
+
align?: React.CSSProperties['justifyContent'];
|
|
10
|
+
/** Visual style of the guide */
|
|
11
|
+
variant?: GuideVariant;
|
|
12
|
+
/** Number of columns (for fixed/auto variants) */
|
|
13
|
+
columns?: number | readonly (string | number | undefined | 'auto')[];
|
|
14
|
+
/** Column width (for fixed variant) */
|
|
15
|
+
columnWidth?: React.CSSProperties['width'];
|
|
16
|
+
/** Maximum width of the guide */
|
|
17
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
18
|
+
/** Color override for guide lines */
|
|
19
|
+
color?: React.CSSProperties['color'];
|
|
20
|
+
/** Content to render inside the guide */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
/** Gap between columns */
|
|
23
|
+
gap?: number;
|
|
24
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
25
|
+
ssrMode?: boolean;
|
|
26
|
+
} & ComponentsProps & Omit<GuideConfig, 'columns' | 'columnWidth' | 'gap'>;
|
|
18
27
|
/**
|
|
19
28
|
* A developer tool component that provides visual grid overlays for alignment.
|
|
20
29
|
*
|
|
@@ -2,11 +2,5 @@
|
|
|
2
2
|
* @file Guide Component Entry (components/Guide/index.ts)
|
|
3
3
|
* @description Visual grid overlay system for alignment
|
|
4
4
|
* @module baseline-kit/components/Guide
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Provides visual grid overlays for layout alignment with
|
|
8
|
-
* multiple grid strategies and validation.
|
|
9
5
|
*/
|
|
10
6
|
export * from './Guide';
|
|
11
|
-
export * from './types';
|
|
12
|
-
export * from './validation';
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Layout Component
|
|
3
|
-
* @description Grid-based layout component with baseline alignment
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
7
|
-
import type { Gaps
|
|
2
|
+
import type { Gaps } from '@components';
|
|
3
|
+
import { Spacer } from '../Spacer';
|
|
8
4
|
import { ComponentsProps, Variant } from '../types';
|
|
5
|
+
type IndicatorNode = NonNullable<React.ComponentProps<typeof Spacer>['indicatorNode']>;
|
|
9
6
|
export type LayoutProps = {
|
|
10
7
|
/**
|
|
11
8
|
* Grid column definition. Supports:
|
|
@@ -28,6 +25,12 @@ export type LayoutProps = {
|
|
|
28
25
|
indicatorNode?: IndicatorNode;
|
|
29
26
|
/** Visual style in debug mode */
|
|
30
27
|
variant?: Variant;
|
|
28
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
29
|
+
ssrMode?: boolean;
|
|
30
|
+
/** Container width (defaults to "auto") */
|
|
31
|
+
width?: React.CSSProperties['width'];
|
|
32
|
+
/** Container height (defaults to "auto") */
|
|
33
|
+
height?: React.CSSProperties['height'];
|
|
31
34
|
children?: React.ReactNode;
|
|
32
35
|
} & ComponentsProps & Gaps;
|
|
33
36
|
/**
|
|
@@ -67,3 +70,4 @@ export type LayoutProps = {
|
|
|
67
70
|
* ```
|
|
68
71
|
*/
|
|
69
72
|
export declare const Layout: React.NamedExoticComponent<LayoutProps>;
|
|
73
|
+
export {};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Padder Component
|
|
3
|
-
* @description Low-level padding management with visual debugging
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
2
|
+
import { ComponentsProps } from '../types';
|
|
7
3
|
import { IndicatorNode } from '../Spacer';
|
|
4
|
+
import { DebuggingMode } from '@/components';
|
|
5
|
+
export type PadderProps = {
|
|
6
|
+
/** Render function for custom measurement indicators */
|
|
7
|
+
indicatorNode?: IndicatorNode;
|
|
8
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
9
|
+
ssrMode?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
} & ComponentsProps;
|
|
8
12
|
/**
|
|
9
13
|
* A foundational component that manages consistent padding with visual debugging.
|
|
10
14
|
*
|
|
@@ -51,11 +55,13 @@ import { IndicatorNode } from '../Spacer';
|
|
|
51
55
|
export declare const Padder: React.NamedExoticComponent<{
|
|
52
56
|
/** Render function for custom measurement indicators */
|
|
53
57
|
indicatorNode?: IndicatorNode;
|
|
58
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
59
|
+
ssrMode?: boolean;
|
|
54
60
|
children?: React.ReactNode;
|
|
55
61
|
} & {
|
|
56
|
-
debugging?:
|
|
62
|
+
debugging?: DebuggingMode;
|
|
57
63
|
className?: string;
|
|
58
64
|
style?: React.CSSProperties;
|
|
59
65
|
height?: React.CSSProperties["height"];
|
|
60
66
|
width?: React.CSSProperties["width"];
|
|
61
|
-
} & import("
|
|
67
|
+
} & import("@/components").SpacingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,19 +1,48 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Spacer Component
|
|
3
|
-
* @description Flexible spacing element with measurement indicators
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
7
2
|
import { ComponentsProps, Variant } from '../types';
|
|
8
|
-
export type IndicatorNode = (value: number,
|
|
3
|
+
export type IndicatorNode = (value: number, type: 'width' | 'height') => React.ReactNode;
|
|
9
4
|
export type SpacerProps = {
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
5
|
+
/** Explicit width (takes precedence over block) */
|
|
6
|
+
width?: React.CSSProperties['width'];
|
|
7
|
+
/** Explicit height (takes precedence over block) */
|
|
8
|
+
height?: React.CSSProperties['height'];
|
|
9
|
+
/** Visual style in debug mode */
|
|
13
10
|
variant?: Variant;
|
|
11
|
+
/** Color to use for debug visuals (overrides theme) */
|
|
12
|
+
color?: string;
|
|
14
13
|
/** Base unit for measurements (defaults to theme value) */
|
|
15
14
|
base?: number;
|
|
16
|
-
/**
|
|
17
|
-
|
|
15
|
+
/** Custom content to render (for debugging info) */
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/** Custom indicator node rendering function */
|
|
18
|
+
indicatorNode?: IndicatorNode;
|
|
19
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
20
|
+
ssrMode?: boolean;
|
|
18
21
|
} & ComponentsProps;
|
|
22
|
+
/**
|
|
23
|
+
* Creates empty space for implementing margins, gaps, and spacing.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* - Flexible sizing: Set width and height directly
|
|
27
|
+
* - Normalized values: All inputs convert to base unit multiples
|
|
28
|
+
* - Debug visuals: Shows spacing measurements with theming
|
|
29
|
+
* - Automatic: Empty in production, visible in debug mode
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Fixed size spacer
|
|
34
|
+
* <Spacer width={32} height={16} />
|
|
35
|
+
*
|
|
36
|
+
* // Percentage-based spacer with debug hints
|
|
37
|
+
* <Spacer
|
|
38
|
+
* width="50%"
|
|
39
|
+
* height={32}
|
|
40
|
+
* debugging="visible"
|
|
41
|
+
* variant="line"
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* // Full-width spacer
|
|
45
|
+
* <Spacer height={64} />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
19
48
|
export declare const Spacer: React.NamedExoticComponent<SpacerProps>;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Stack Component
|
|
3
|
-
* @description Flex container with baseline grid alignment
|
|
4
|
-
* @module components
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
7
|
-
import type { Gaps
|
|
2
|
+
import type { Gaps } from '@components';
|
|
3
|
+
import { IndicatorNode } from '../Spacer';
|
|
8
4
|
import { ComponentsProps, Variant } from '../types';
|
|
5
|
+
declare const DIRECTION_AXIS: Record<string, React.CSSProperties['flexDirection']>;
|
|
6
|
+
export type CSSPropertiesDirectionalAxis = keyof typeof DIRECTION_AXIS;
|
|
9
7
|
export type StackProps = {
|
|
10
8
|
/** Main axis orientation */
|
|
11
|
-
direction?: '
|
|
9
|
+
direction?: React.CSSProperties['flexDirection'] & CSSPropertiesDirectionalAxis;
|
|
12
10
|
/** Distribution of space on main axis */
|
|
13
11
|
justify?: React.CSSProperties['justifyContent'];
|
|
14
12
|
/** Alignment on cross axis */
|
|
@@ -21,8 +19,16 @@ export type StackProps = {
|
|
|
21
19
|
indicatorNode?: IndicatorNode;
|
|
22
20
|
/** Visual style in debug mode */
|
|
23
21
|
variant?: Variant;
|
|
22
|
+
/** Gap between items in base units */
|
|
23
|
+
gap?: Gaps;
|
|
24
|
+
/** Row gap when using different values for rows and columns */
|
|
25
|
+
rowGap?: Gaps;
|
|
26
|
+
/** Column gap when using different values for rows and columns */
|
|
27
|
+
columnGap?: Gaps;
|
|
28
|
+
/** Flag to enable SSR-compatible mode (simplified initial render) */
|
|
29
|
+
ssrMode?: boolean;
|
|
24
30
|
children?: React.ReactNode;
|
|
25
|
-
} & ComponentsProps
|
|
31
|
+
} & ComponentsProps;
|
|
26
32
|
/**
|
|
27
33
|
* A flexible container component aligning children to the baseline grid.
|
|
28
34
|
*
|
|
@@ -75,3 +81,4 @@ export type StackProps = {
|
|
|
75
81
|
* ```
|
|
76
82
|
*/
|
|
77
83
|
export declare const Stack: React.NamedExoticComponent<StackProps>;
|
|
84
|
+
export {};
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* @description Main entry point for baseline-kit components
|
|
4
4
|
* @module baseline-kit/components
|
|
5
5
|
*/
|
|
6
|
-
import './styles/
|
|
6
|
+
import './styles/core.css';
|
|
7
|
+
import './styles/theme.css';
|
|
7
8
|
export * from './Layout';
|
|
8
9
|
export * from './Box';
|
|
9
10
|
export * from './Stack';
|
|
10
|
-
export * from './Guide';
|
|
11
|
-
export * from './Baseline';
|
|
12
11
|
export * from './Spacer';
|
|
13
12
|
export * from './Padder';
|
|
13
|
+
export * from './Guide';
|
|
14
|
+
export * from './Baseline';
|
|
14
15
|
export * from './Config';
|
|
15
16
|
export * from './types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Baseline Kit Styles System
|
|
3
|
+
*
|
|
4
|
+
* This file exports all core styles needed for the component library.
|
|
5
|
+
* The import order is important:
|
|
6
|
+
* 1. core.css - Contains reset.css, base.css, and component styles
|
|
7
|
+
* 2. theme.css - Contains color variables and theming
|
|
8
|
+
*/
|
|
9
|
+
import './core.css';
|
|
10
|
+
import './theme.css';
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DebuggingMode } from '
|
|
2
|
+
import { DebuggingMode } from './Config/Config';
|
|
3
3
|
/**
|
|
4
4
|
* Defines spacing as either a single value, start/end pair, or object with explicit edges.
|
|
5
5
|
* Used for block and inline spacing across components.
|
|
@@ -68,10 +68,10 @@ export type GuideColumnValue = string | number | undefined | 'auto';
|
|
|
68
68
|
export type GuideColumnsPattern = readonly GuideColumnValue[];
|
|
69
69
|
/** Valid grid alignment values. */
|
|
70
70
|
export declare const GRID_ALIGNMENTS: readonly ["start", "center", "end"];
|
|
71
|
-
export type GridAlignment = typeof GRID_ALIGNMENTS[number];
|
|
71
|
+
export type GridAlignment = (typeof GRID_ALIGNMENTS)[number];
|
|
72
72
|
/** Valid component variants affecting visual style. */
|
|
73
73
|
export declare const PADD_VARIANTS: readonly ["line", "flat"];
|
|
74
|
-
export type PaddedVariant = typeof PADD_VARIANTS[number];
|
|
74
|
+
export type PaddedVariant = (typeof PADD_VARIANTS)[number];
|
|
75
75
|
/**
|
|
76
76
|
* Common props shared across library components.
|
|
77
77
|
* Provides consistent sizing, spacing, styling, and debugging options.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import type { SnappingMode, Padding } from '@components';
|
|
3
3
|
export interface BaselineOptions {
|
|
4
4
|
base?: number;
|
|
@@ -34,22 +34,17 @@ export interface BaselineResult {
|
|
|
34
34
|
* @param options Configuration options for alignment behavior
|
|
35
35
|
* @returns Object with adjusted padding, alignment status, and height
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* <div
|
|
49
|
-
* ref={ref}
|
|
50
|
-
* style={{
|
|
51
|
-
* paddingTop: padding.top,
|
|
52
|
-
* paddingBottom: padding.bottom,
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* export function MyComponent() {
|
|
40
|
+
* const ref = useRef<HTMLDivElement>(null)
|
|
41
|
+
* const { padding } = useBaseline(ref, {
|
|
42
|
+
* base: 8,
|
|
43
|
+
* snapping: 'height',
|
|
44
|
+
* spacing: {
|
|
45
|
+
* top: 16,
|
|
46
|
+
* bottom: 16
|
|
47
|
+
* }
|
|
53
48
|
* }}
|
|
54
49
|
* >
|
|
55
50
|
* Content
|
|
@@ -57,4 +52,4 @@ export interface BaselineResult {
|
|
|
57
52
|
* )
|
|
58
53
|
* }
|
|
59
54
|
*/
|
|
60
|
-
export declare function useBaseline(ref: RefObject<HTMLElement | null>, { base, snapping, spacing, warnOnMisalignment, }?: BaselineOptions): BaselineResult;
|
|
55
|
+
export declare function useBaseline(ref: React.RefObject<HTMLElement | null>, { base, snapping, spacing, warnOnMisalignment, }?: BaselineOptions): BaselineResult;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* @file useConfig Hook
|
|
3
|
-
* @description Manages component-specific theme configuration
|
|
4
|
-
* @module hooks
|
|
5
|
-
*/
|
|
6
|
-
import { Config } from '@components';
|
|
1
|
+
import { ConfigSchema } from '@components';
|
|
7
2
|
/** Type helper that merges base configuration with component-specific settings. */
|
|
8
|
-
export type ComponentConfig<K extends keyof
|
|
3
|
+
export type ComponentConfig<K extends keyof ConfigSchema> = ConfigSchema[K] & {
|
|
9
4
|
/** Base unit for spacing calculations */
|
|
10
5
|
base: number;
|
|
11
6
|
};
|
|
@@ -43,4 +38,4 @@ export type ComponentConfig<K extends keyof Config> = Config[K] & {
|
|
|
43
38
|
* }
|
|
44
39
|
* ```
|
|
45
40
|
*/
|
|
46
|
-
export declare function useConfig<K extends keyof
|
|
41
|
+
export declare function useConfig<K extends keyof ConfigSchema>(component: K): ComponentConfig<K>;
|
package/dist/hooks/useDebug.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @file useDebug Hook
|
|
3
|
-
* @description Manages component debugging state
|
|
4
|
-
* @module hooks
|
|
5
|
-
*/
|
|
6
|
-
import { DebuggingMode } from '@components';
|
|
1
|
+
import { DebuggingMode } from '../components/Config/Config';
|
|
7
2
|
interface DebugResult {
|
|
8
3
|
/** Whether debug visuals should be shown */
|
|
9
4
|
isShown: boolean;
|
package/dist/hooks/useGuide.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @file useGuide Hook
|
|
3
|
-
* @description Manages grid layout calculations for guide overlays
|
|
4
|
-
* @module hooks
|
|
5
|
-
*/
|
|
6
|
-
import { RefObject } from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
7
2
|
import { GuideConfig } from '@components';
|
|
8
3
|
export interface GuideResult {
|
|
9
4
|
/** CSS grid template string */
|
|
@@ -63,4 +58,4 @@ export interface GuideResult {
|
|
|
63
58
|
* }
|
|
64
59
|
* ```
|
|
65
60
|
*/
|
|
66
|
-
export declare function useGuide(ref: RefObject<HTMLElement | null>, config: GuideConfig): GuideResult;
|
|
61
|
+
export declare function useGuide(ref: React.RefObject<HTMLElement | null>, config: GuideConfig): GuideResult;
|