@dataverse-kit/surface-kit 0.2.0 → 0.3.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/v9.d.ts ADDED
@@ -0,0 +1,313 @@
1
+ import { DialogSizePreset } from './core.js';
2
+ export { CALLOUT_DEFAULT_WIDTH, DIALOG_SIZE_PX, MODAL_AUTOSIZE_MIN_WIDTH, PANEL_DEFAULT_WIDTH, PanelKind, calloutFormDefaults, calloutWidthPx, dialogHeightCss, dialogWidthCss, dialogWidthPx, panelCustomWidthPx, panelKindFromWidth } from './core.js';
3
+ export { C as ColumnCount, c as clampSpan, g as gridTemplateForColumns } from './columns-BlpFO5VD.js';
4
+ import { Breakpoint } from './responsive.js';
5
+ export { BREAKPOINTS, CARD_REFLOW_WIDTH, ResponsiveMode, ResponsiveValue, StyleObject, fieldGridStyle, fieldRowStyle, resolveBreakpoint, resolveResponsiveValue, sectionStackingStyle } from './responsive.js';
6
+ export { colors, layout, radius, spacing, typography } from '@dataverse-kit/design-tokens';
7
+ import { D as Density } from './useDensity-BePwtUzY.js';
8
+ export { C as ContainerSize, f as DensityContext, d as densityScale, s as scaleSpacing, b as useContainerBreakpoint, u as useContainerSize, a as useContainerWidth, g as useDensity, e as useMediaQuery, c as useResponsiveValue } from './useDensity-BePwtUzY.js';
9
+ import React__default, { ReactElement, CSSProperties, ReactNode, RefObject } from 'react';
10
+ import { BrandVariants, Theme } from '@fluentui/react-components';
11
+
12
+ type SurfaceVariant = 'card' | 'flat' | 'placeholder';
13
+ type Alignment = 'left' | 'center' | 'right';
14
+ /** A single command in a v9 command surface / section header (renders a `<ToolbarButton>`). */
15
+ interface SurfaceToolbarItem {
16
+ id: string;
17
+ label: string;
18
+ /** A rendered v9 icon element (e.g. `<Save20Regular />`). */
19
+ icon?: ReactElement;
20
+ /** `primary` uses the brand appearance; otherwise a subtle toolbar button. */
21
+ appearance?: 'primary' | 'subtle';
22
+ disabled?: boolean;
23
+ onClick?: () => void;
24
+ }
25
+ /** An action button in a v9 `ActionBar` / dialog footer. */
26
+ interface SurfaceActionButton {
27
+ id: string;
28
+ label: string;
29
+ /** A rendered v9 icon element (e.g. `<Dismiss20Regular />`). */
30
+ icon?: ReactElement;
31
+ /** Maps to a v9 `Button` appearance: primary → `primary`, default → `secondary`, subtle → `subtle`. */
32
+ appearance?: 'primary' | 'default' | 'subtle';
33
+ position?: 'left' | 'right';
34
+ disabled?: boolean;
35
+ hidden?: boolean;
36
+ onClick?: () => void;
37
+ }
38
+ /** v9 overlay position (a subset of the v9 `Popover`/`Tooltip` positioning shorthand). */
39
+ type SurfacePosition = 'above' | 'below' | 'before' | 'after';
40
+ type SurfaceAlign = 'start' | 'center' | 'end';
41
+ interface FormSurfaceProps {
42
+ /** Outer grid column count. Default 12. */
43
+ columns?: number;
44
+ /** Grid gap in px. Default 20. */
45
+ gap?: number;
46
+ /** Padding in px. Default 20. */
47
+ padding?: number;
48
+ /** Spacing density: `'compact'` scales gap + padding by 0.75 and cascades to child
49
+ * Sections via context. Default `'comfortable'` (byte-identical to no density). */
50
+ density?: Density;
51
+ /** Canvas background. Default the v9 neutral-2 background (Dynamics form canvas). */
52
+ background?: string;
53
+ /** Container width hint (e.g. a PCF `context.allocatedWidth`) — drives stacking off the container, not the viewport. */
54
+ containerWidth?: number;
55
+ /** Collapse children to full width below this breakpoint. Default `'sm'`. */
56
+ collapseBelow?: Breakpoint;
57
+ maxWidth?: number | string;
58
+ className?: string;
59
+ style?: CSSProperties;
60
+ children?: ReactNode;
61
+ }
62
+ interface PageSurfaceProps extends FormSurfaceProps {
63
+ /** Center the form and apply a comfortable max width. */
64
+ centered?: boolean;
65
+ }
66
+ interface SectionProps {
67
+ title?: string;
68
+ /** Span within the parent form grid. Default 12. */
69
+ columnSpan?: number;
70
+ columnStart?: number;
71
+ rowPosition?: number;
72
+ /** Internal field-grid column count. Default 12. */
73
+ internalColumns?: number;
74
+ /** Show a v9 `<Toolbar>` of `commandItems` in the section header. */
75
+ showCommandBar?: boolean;
76
+ commandItems?: SurfaceToolbarItem[];
77
+ statusText?: string;
78
+ notification?: ReactNode;
79
+ collapsible?: boolean;
80
+ /** Uncontrolled initial collapsed state. */
81
+ defaultCollapsed?: boolean;
82
+ /** Controlled collapsed state (pair with `onCollapsedChange`). */
83
+ collapsed?: boolean;
84
+ onCollapsedChange?: (collapsed: boolean) => void;
85
+ /** `card` (default), `flat` (no shadow), or `placeholder` (empty dashed spacer). */
86
+ variant?: SurfaceVariant;
87
+ /** Min height for the `placeholder` variant. */
88
+ minHeight?: number;
89
+ /** Spacing density override; defaults to the ambient `FormSurface` density (`useDensity`).
90
+ * `'compact'` scales the card padding + internal field gap by 0.75. */
91
+ density?: Density;
92
+ className?: string;
93
+ style?: CSSProperties;
94
+ children?: ReactNode;
95
+ }
96
+ interface SectionCardProps extends SectionProps {
97
+ /** Accent color of the top border (Dynamics blue). Default the v9 brand stroke. */
98
+ accentColor?: string;
99
+ /** Accent top-border width in px. Default 3. */
100
+ accentWidth?: number;
101
+ }
102
+ interface SectionHeaderProps {
103
+ title?: string;
104
+ statusText?: string;
105
+ showCommandBar?: boolean;
106
+ commandItems?: SurfaceToolbarItem[];
107
+ actions?: ReactNode;
108
+ collapsible?: boolean;
109
+ collapsed?: boolean;
110
+ onToggle?: () => void;
111
+ }
112
+ interface FormHeaderProps {
113
+ title?: ReactNode;
114
+ subtitle?: ReactNode;
115
+ status?: ReactNode;
116
+ titleColor?: string;
117
+ subtitleColor?: string;
118
+ /** Avatar/persona shown to the left of the title (e.g. a v9 `<Avatar>` / `<Persona>`). */
119
+ persona?: ReactNode;
120
+ /** Right side of the header (e.g. KPI header fields). */
121
+ actions?: ReactNode;
122
+ className?: string;
123
+ }
124
+ interface SurfaceTab {
125
+ id: string;
126
+ label: string;
127
+ content: ReactNode;
128
+ /** A rendered v9 icon element for the tab. */
129
+ icon?: ReactElement;
130
+ disabled?: boolean;
131
+ }
132
+ interface PivotSurfaceProps {
133
+ tabs: SurfaceTab[];
134
+ selectedId?: string;
135
+ defaultSelectedId?: string;
136
+ onTabChange?: (id: string) => void;
137
+ /** v9 `TabList` appearance. Default `'transparent'`. */
138
+ appearance?: 'transparent' | 'subtle';
139
+ /** v9 `TabList` size. Default `'medium'`. */
140
+ size?: 'small' | 'medium' | 'large';
141
+ className?: string;
142
+ }
143
+ interface CommandSurfaceProps {
144
+ items: SurfaceToolbarItem[];
145
+ /** Rendered behind a "more" overflow menu after the primary items. */
146
+ overflowItems?: SurfaceToolbarItem[];
147
+ /** Right-aligned items (e.g. a settings button). */
148
+ farItems?: SurfaceToolbarItem[];
149
+ /** v9 `Toolbar` size. Default `'small'`. */
150
+ size?: 'small' | 'medium' | 'large';
151
+ className?: string;
152
+ }
153
+ interface ActionBarProps {
154
+ buttons: SurfaceActionButton[];
155
+ /** Default `'right'`. */
156
+ alignment?: Alignment;
157
+ /** Stick to the bottom of the scroll container. Default true. */
158
+ sticky?: boolean;
159
+ className?: string;
160
+ }
161
+ interface FooterProps {
162
+ /** Default true. */
163
+ sticky?: boolean;
164
+ align?: Alignment;
165
+ className?: string;
166
+ children?: ReactNode;
167
+ }
168
+ /** Full form-dialog (Fluent v9 `Dialog`) with header/counter/close + sticky footer. */
169
+ interface FormDialogSurfaceProps {
170
+ isOpen: boolean;
171
+ onDismiss?: () => void;
172
+ title?: string;
173
+ subheader?: string;
174
+ /** Size preset (default `lg` = 1200). Explicit `width` wins. */
175
+ size?: DialogSizePreset;
176
+ width?: number;
177
+ height?: number;
178
+ /** `true` (default) is a modal dialog; `false` is non-modal. */
179
+ isBlocking?: boolean;
180
+ /** "X of Y" record counter in the header. */
181
+ recordCounter?: {
182
+ current: number;
183
+ total: number;
184
+ };
185
+ /** Footer content (e.g. an ActionBar). */
186
+ footer?: ReactNode;
187
+ className?: string;
188
+ children?: ReactNode;
189
+ }
190
+ /** Generic modal (Fluent v9 `Dialog`) — lighter than FormDialogSurface. */
191
+ interface ModalSurfaceProps {
192
+ isOpen: boolean;
193
+ onDismiss?: () => void;
194
+ title?: string;
195
+ size?: DialogSizePreset;
196
+ width?: number;
197
+ isBlocking?: boolean;
198
+ /** Auto width with a 1000px min (Track-and-Ship pattern) instead of a fixed preset. */
199
+ autoSize?: boolean;
200
+ footer?: ReactNode;
201
+ className?: string;
202
+ children?: ReactNode;
203
+ }
204
+ /** A Dynamics side panel (Fluent v9 `OverlayDrawer`). */
205
+ interface PanelSurfaceProps {
206
+ isOpen: boolean;
207
+ onDismiss?: () => void;
208
+ title?: string;
209
+ /** v9 Drawer size. Default derived from `width`: >500 → `medium`, else `small`. An explicit `width` renders a custom-width drawer. */
210
+ drawerSize?: 'small' | 'medium' | 'large' | 'full';
211
+ width?: number;
212
+ hasCloseButton?: boolean;
213
+ /** Dismiss on overlay click / Esc. Default true. */
214
+ isLightDismiss?: boolean;
215
+ /** Non-modal drawer (no blocking overlay). Default false. */
216
+ isNonModal?: boolean;
217
+ footer?: ReactNode;
218
+ children?: ReactNode;
219
+ }
220
+ /** A lightweight contextual callout (Fluent v9 `Popover`) anchored to a target. */
221
+ interface CalloutSurfaceProps {
222
+ /** Anchor — a selector string, an element, or a ref. */
223
+ target: string | Element | RefObject<Element> | null;
224
+ isOpen?: boolean;
225
+ onDismiss?: () => void;
226
+ width?: number;
227
+ /** v9 position relative to the target. Default `'below'`. */
228
+ position?: SurfacePosition;
229
+ /** v9 alignment along the position edge. Default `'start'`. */
230
+ align?: SurfaceAlign;
231
+ /** Show the pointing arrow. Default true. */
232
+ isBeakVisible?: boolean;
233
+ className?: string;
234
+ children?: ReactNode;
235
+ }
236
+ interface TooltipSurfaceProps {
237
+ /** Tooltip body — what the v9 `Tooltip` renders (string or element). */
238
+ content: string | ReactElement;
239
+ /** v9 position relative to the child. Default `'above'`. */
240
+ position?: SurfacePosition;
241
+ /** Delay before showing: `zero`→0ms, `medium`→250ms, `long`→500ms. Default `medium`. */
242
+ delay?: 'zero' | 'medium' | 'long';
243
+ /** Whether the tooltip labels or merely describes its child (v9 `relationship`). Default `'label'`. */
244
+ relationship?: 'label' | 'description';
245
+ children: ReactElement;
246
+ }
247
+
248
+ declare const dynamicsBrandRamp: BrandVariants;
249
+ /**
250
+ * Build a Fluent v9 `Theme` for the Dynamics surfaces. Defaults to the Dynamics-blue
251
+ * brand ramp; pass a custom `BrandVariants` (e.g. from your org's brand) to override.
252
+ * Wrap the app (or a `./v9` surface subtree) in `<FluentProvider theme={createDynamicsV9Theme()}>`.
253
+ */
254
+ declare function createDynamicsV9Theme(brand?: BrandVariants): Theme;
255
+ /** Dark-mode variant of the Dynamics v9 theme (same brand ramp). */
256
+ declare function createDynamicsV9DarkTheme(brand?: BrandVariants): Theme;
257
+ /** The default light Dynamics v9 theme (memoized module singleton). */
258
+ declare const dynamicsV9Theme: Theme;
259
+
260
+ /** The N-column form canvas that hosts Sections (Fluent UI v9). */
261
+ declare const FormSurface: React__default.FC<FormSurfaceProps>;
262
+
263
+ /** A full-page FormSurface (Fluent v9) — optionally centered with a comfortable max width. */
264
+ declare const PageSurface: React__default.FC<PageSurfaceProps>;
265
+
266
+ /** A Dynamics-CE form section (Fluent v9): positioned card with a header and an internal field grid. */
267
+ declare const Section: React__default.FC<SectionProps>;
268
+
269
+ /**
270
+ * A Section with the Dynamics blue accent top border (Fluent v9).
271
+ * The accent is an inline `borderTop` so it wins over the card variant's inline `border`
272
+ * (see Section: `style` is spread after the card chrome). Defaults to the v9 brand stroke.
273
+ */
274
+ declare const SectionCard: React__default.FC<SectionCardProps>;
275
+
276
+ /** Section header bar (Fluent v9): title + status (left), toolbar / actions (right), optional collapse toggle. */
277
+ declare const SectionHeader: React__default.FC<SectionHeaderProps>;
278
+
279
+ /** Dynamics form header (Fluent v9): persona + title/status (left), KPI/header fields (right). */
280
+ declare const FormHeader: React__default.FC<FormHeaderProps>;
281
+
282
+ /** Tabbed surface (Fluent v9 `TabList`). Controlled via `selectedId`/`onTabChange` or uncontrolled. */
283
+ declare const PivotSurface: React__default.FC<PivotSurfaceProps>;
284
+
285
+ /** A Dynamics-style command bar (Fluent v9 `Toolbar`), with an optional overflow menu + far items. */
286
+ declare const CommandSurface: React__default.FC<CommandSurfaceProps>;
287
+
288
+ /** A sticky footer bar of action buttons (Fluent v9), with optional left-aligned buttons. */
289
+ declare const ActionBar: React__default.FC<ActionBarProps>;
290
+
291
+ /** A sticky footer region (free-form children, Fluent v9) — e.g. for dialog/panel actions. */
292
+ declare const Footer: React__default.FC<FooterProps>;
293
+
294
+ /**
295
+ * Full Dynamics form-dialog (Fluent v9 `Dialog`). Default width 1200 (lg), height 95vh.
296
+ * `onDismiss` is the close affordance — when omitted, no close button renders. `isBlocking`
297
+ * maps to the dialog `modalType` (`modal` vs `non-modal`).
298
+ */
299
+ declare const FormDialogSurface: React__default.FC<FormDialogSurfaceProps>;
300
+
301
+ /** A generic modal (Fluent v9 `Dialog`) — title + content + optional footer; lighter than FormDialogSurface. */
302
+ declare const ModalSurface: React__default.FC<ModalSurfaceProps>;
303
+
304
+ /** A Dynamics side panel (Fluent v9 `OverlayDrawer`). */
305
+ declare const PanelSurface: React__default.FC<PanelSurfaceProps>;
306
+
307
+ /** A lightweight contextual callout (Fluent v9 `Popover`) anchored to a target. */
308
+ declare const CalloutSurface: React__default.FC<CalloutSurfaceProps>;
309
+
310
+ /** A tooltip wrapper (Fluent v9 `Tooltip`). */
311
+ declare const TooltipSurface: React__default.FC<TooltipSurfaceProps>;
312
+
313
+ export { ActionBar, type ActionBarProps, type Alignment, Breakpoint, CalloutSurface, type CalloutSurfaceProps, CommandSurface, type CommandSurfaceProps, Density, DialogSizePreset, Footer, type FooterProps, FormDialogSurface, type FormDialogSurfaceProps, FormHeader, type FormHeaderProps, FormSurface, type FormSurfaceProps, ModalSurface, type ModalSurfaceProps, PageSurface, type PageSurfaceProps, PanelSurface, type PanelSurfaceProps, PivotSurface, type PivotSurfaceProps, Section, SectionCard, type SectionCardProps, SectionHeader, type SectionHeaderProps, type SectionProps, type SurfaceActionButton, type SurfaceAlign, type SurfacePosition, type SurfaceTab, type SurfaceToolbarItem, type SurfaceVariant, TooltipSurface, type TooltipSurfaceProps, createDynamicsV9DarkTheme, createDynamicsV9Theme, dynamicsBrandRamp, dynamicsV9Theme };