@qiiqa/bob-ui-react-layout 0.2.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/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +13 -0
- package/dist/index.css +429 -0
- package/dist/index.d.mts +185 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +1238 -0
- package/dist/index.mjs +1190 -0
- package/package.json +38 -0
- package/src/components/BobForm.tsx +294 -0
- package/src/components/BobItem.tsx +141 -0
- package/src/components/BobPage.tsx +152 -0
- package/src/components/BobPanel.tsx +232 -0
- package/src/components/BobResponsiveness.tsx +81 -0
- package/src/components/BobTab.tsx +67 -0
- package/src/components/BobTabPage.tsx +28 -0
- package/src/components/BobTabStrip.tsx +40 -0
- package/src/components/GapDropZone.tsx +74 -0
- package/src/context/LayoutContext.tsx +353 -0
- package/src/css/bob-react-layout.css +523 -0
- package/src/index.ts +14 -0
- package/tsconfig.json +27 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface BobResponsivenessConfig {
|
|
4
|
+
small: {
|
|
5
|
+
page: number;
|
|
6
|
+
group: number;
|
|
7
|
+
};
|
|
8
|
+
medium: {
|
|
9
|
+
page: number;
|
|
10
|
+
group: number;
|
|
11
|
+
};
|
|
12
|
+
large: {
|
|
13
|
+
page: number;
|
|
14
|
+
group: number;
|
|
15
|
+
};
|
|
16
|
+
extraLarge: {
|
|
17
|
+
page: number;
|
|
18
|
+
group: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
declare const DEFAULT_RESPONSIVENESS_CONFIG: BobResponsivenessConfig;
|
|
22
|
+
type LayoutStateDictionary = Record<string, string[]>;
|
|
23
|
+
interface LayoutContextState {
|
|
24
|
+
designMode: boolean;
|
|
25
|
+
designTabs: boolean;
|
|
26
|
+
designGroups: boolean;
|
|
27
|
+
designFields: boolean;
|
|
28
|
+
layoutState: LayoutStateDictionary;
|
|
29
|
+
selectedItemIds: string[];
|
|
30
|
+
isDraggingActive: boolean;
|
|
31
|
+
dragOverId: string | null;
|
|
32
|
+
dragSide: 'left' | 'right' | 'top' | 'bottom' | null;
|
|
33
|
+
pageCols: number;
|
|
34
|
+
groupCols: number;
|
|
35
|
+
setLayoutState: React.Dispatch<React.SetStateAction<LayoutStateDictionary>>;
|
|
36
|
+
toggleItemSelection: (id: string, multi: boolean) => void;
|
|
37
|
+
clearItemSelection: () => void;
|
|
38
|
+
setDraggingActive: (active: boolean) => void;
|
|
39
|
+
setDragOverState: (id: string | null, side: 'left' | 'right' | 'top' | 'bottom' | null) => void;
|
|
40
|
+
loadLayoutState: (state: LayoutStateDictionary) => void;
|
|
41
|
+
reorderItemWithinContainer: (containerId: string, activeId: string, overId: string, fallbackItems?: string[], insertAfter?: boolean) => void;
|
|
42
|
+
moveItemBetweenContainers: (sourceContainerId: string, destContainerId: string, activeId: string, overId: string, fallbackItems?: string[], insertAfter?: boolean) => void;
|
|
43
|
+
setDesignMode: (mode: boolean) => void;
|
|
44
|
+
setDesignTabs: (mode: boolean) => void;
|
|
45
|
+
setDesignGroups: (mode: boolean) => void;
|
|
46
|
+
setDesignFields: (mode: boolean) => void;
|
|
47
|
+
setPageCols: (cols: number) => void;
|
|
48
|
+
setGroupCols: (cols: number) => void;
|
|
49
|
+
responsivenessConfig: BobResponsivenessConfig;
|
|
50
|
+
setResponsivenessConfig: (config: BobResponsivenessConfig) => void;
|
|
51
|
+
currentBreakpoint: string;
|
|
52
|
+
}
|
|
53
|
+
declare function useLayoutContext(): LayoutContextState;
|
|
54
|
+
declare const LayoutProvider: React.FC<{
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
initialDesignMode?: boolean;
|
|
57
|
+
initialDesignTabs?: boolean;
|
|
58
|
+
initialDesignGroups?: boolean;
|
|
59
|
+
initialDesignFields?: boolean;
|
|
60
|
+
initialLayoutState?: LayoutStateDictionary;
|
|
61
|
+
initialPageCols?: number;
|
|
62
|
+
initialGroupCols?: number;
|
|
63
|
+
initialResponsivenessConfig?: BobResponsivenessConfig;
|
|
64
|
+
onLayoutChange?: (state: LayoutStateDictionary) => void;
|
|
65
|
+
onPageColsChange?: (cols: number) => void;
|
|
66
|
+
onGroupColsChange?: (cols: number) => void;
|
|
67
|
+
onResponsivenessConfigChange?: (config: BobResponsivenessConfig) => void;
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
interface BobFormProps {
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
className?: string;
|
|
73
|
+
designMode?: boolean;
|
|
74
|
+
designTabs?: boolean;
|
|
75
|
+
designGroups?: boolean;
|
|
76
|
+
designFields?: boolean;
|
|
77
|
+
layoutState?: Record<string, string[]>;
|
|
78
|
+
pageCols?: number;
|
|
79
|
+
groupCols?: number;
|
|
80
|
+
initialResponsivenessConfig?: any;
|
|
81
|
+
onLayoutChange?: (state: any) => void;
|
|
82
|
+
onPageColsChange?: (cols: number) => void;
|
|
83
|
+
onGroupColsChange?: (cols: number) => void;
|
|
84
|
+
onResponsivenessConfigChange?: (config: any) => void;
|
|
85
|
+
}
|
|
86
|
+
declare const BobForm: React.FC<BobFormProps>;
|
|
87
|
+
|
|
88
|
+
interface BobTabStripProps {
|
|
89
|
+
id: string;
|
|
90
|
+
children?: ReactNode;
|
|
91
|
+
className?: string;
|
|
92
|
+
}
|
|
93
|
+
declare const BobTabStrip: React.FC<BobTabStripProps>;
|
|
94
|
+
|
|
95
|
+
interface BobTabProps {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string | ReactNode;
|
|
98
|
+
isActive?: boolean;
|
|
99
|
+
onClick?: (id: string) => void;
|
|
100
|
+
className?: string;
|
|
101
|
+
}
|
|
102
|
+
declare const BobTab: React.FC<BobTabProps>;
|
|
103
|
+
|
|
104
|
+
interface BobPageProps {
|
|
105
|
+
id: string;
|
|
106
|
+
children?: ReactNode;
|
|
107
|
+
columns?: number;
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
declare const BobPage: React.FC<BobPageProps>;
|
|
111
|
+
|
|
112
|
+
interface BobTabPageProps {
|
|
113
|
+
id?: string;
|
|
114
|
+
children?: ReactNode;
|
|
115
|
+
isActive?: boolean;
|
|
116
|
+
columns?: number;
|
|
117
|
+
className?: string;
|
|
118
|
+
pageClassName?: string;
|
|
119
|
+
}
|
|
120
|
+
declare const BobTabPage: React.FC<BobTabPageProps>;
|
|
121
|
+
|
|
122
|
+
interface BobPanelProps {
|
|
123
|
+
id: string;
|
|
124
|
+
children?: ReactNode;
|
|
125
|
+
colSpan?: number;
|
|
126
|
+
rowSpan?: number;
|
|
127
|
+
columns?: number;
|
|
128
|
+
className?: string;
|
|
129
|
+
caption?: string;
|
|
130
|
+
newline?: boolean;
|
|
131
|
+
onRowResize?: (delta: number) => void;
|
|
132
|
+
style?: React.CSSProperties;
|
|
133
|
+
}
|
|
134
|
+
declare const BobPanel: React.FC<BobPanelProps>;
|
|
135
|
+
|
|
136
|
+
interface BobItemProps {
|
|
137
|
+
id: string;
|
|
138
|
+
children?: ReactNode;
|
|
139
|
+
colSpan?: number;
|
|
140
|
+
rowSpan?: number;
|
|
141
|
+
className?: string;
|
|
142
|
+
expandVertical?: boolean;
|
|
143
|
+
caption?: string;
|
|
144
|
+
hideCaption?: boolean;
|
|
145
|
+
newline?: boolean;
|
|
146
|
+
onRowResize?: (delta: number) => void;
|
|
147
|
+
style?: React.CSSProperties;
|
|
148
|
+
horizontal?: boolean;
|
|
149
|
+
labelWidth?: string;
|
|
150
|
+
}
|
|
151
|
+
declare const BobItem: React.FC<BobItemProps>;
|
|
152
|
+
|
|
153
|
+
interface BobResponsivenessProps {
|
|
154
|
+
className?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* BobResponsiveness component acts as a UI for viewing the current breakpoint
|
|
158
|
+
* and modifying the global responsiveness configuration in LayoutContext.
|
|
159
|
+
*/
|
|
160
|
+
declare const BobResponsiveness: React.FC<BobResponsivenessProps>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* A GapDropZone represents the empty space between two BobItems (or before the first / after the last).
|
|
164
|
+
* It renders as a 20px invisible hit-target that highlights when dragged over
|
|
165
|
+
* and contains the +/- column span control for the *preceding* item.
|
|
166
|
+
*
|
|
167
|
+
* `containerId` – the BobPanel this gap belongs to
|
|
168
|
+
* `insertAfterItemId` – if set, the new item is inserted AFTER this id; if undefined, insert at START
|
|
169
|
+
* `colSpan` – current colSpan of the preceding item (for display)
|
|
170
|
+
* `onResize` – called with delta (+1 / -1)
|
|
171
|
+
* `position` – 'start' | 'between' | 'end'
|
|
172
|
+
*/
|
|
173
|
+
interface GapDropZoneProps {
|
|
174
|
+
id: string;
|
|
175
|
+
containerId: string;
|
|
176
|
+
insertAfterItemId?: string;
|
|
177
|
+
colSpan?: number;
|
|
178
|
+
newline?: boolean;
|
|
179
|
+
onResize?: (delta: number) => void;
|
|
180
|
+
onToggleNewline?: () => void;
|
|
181
|
+
position: 'start' | 'between' | 'end';
|
|
182
|
+
}
|
|
183
|
+
declare const GapDropZone: React.FC<GapDropZoneProps>;
|
|
184
|
+
|
|
185
|
+
export { BobForm, type BobFormProps, BobItem, type BobItemProps, BobPage, type BobPageProps, BobPanel, type BobPanelProps, BobResponsiveness, type BobResponsivenessConfig, type BobResponsivenessProps, BobTab, BobTabPage, type BobTabPageProps, type BobTabProps, BobTabStrip, type BobTabStripProps, DEFAULT_RESPONSIVENESS_CONFIG, GapDropZone, type GapDropZoneProps, type LayoutContextState, LayoutProvider, type LayoutStateDictionary, useLayoutContext };
|