@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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 khester
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.cts CHANGED
@@ -2,64 +2,16 @@ import { DialogSizePreset } from './core.cjs';
2
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.cjs';
3
3
  import { C as ColumnCount } from './columns-BlpFO5VD.cjs';
4
4
  export { c as clampSpan, g as gridTemplateForColumns } from './columns-BlpFO5VD.cjs';
5
- import { Breakpoint, ResponsiveValue } from './responsive.cjs';
6
- export { BREAKPOINTS, CARD_REFLOW_WIDTH, ResponsiveMode, StyleObject, fieldGridStyle, fieldRowStyle, resolveBreakpoint, resolveResponsiveValue, sectionStackingStyle } from './responsive.cjs';
5
+ import { Breakpoint } from './responsive.cjs';
6
+ export { BREAKPOINTS, CARD_REFLOW_WIDTH, ResponsiveMode, ResponsiveValue, StyleObject, fieldGridStyle, fieldRowStyle, resolveBreakpoint, resolveResponsiveValue, sectionStackingStyle } from './responsive.cjs';
7
7
  export { colors, layout, radius, spacing, typography } from '@dataverse-kit/design-tokens';
8
8
  import { Theme, ICommandBarItemProps } from '@fluentui/react';
9
- import * as React from 'react';
9
+ import { D as Density } from './useDensity-xEYt-GdJ.cjs';
10
+ 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-xEYt-GdJ.cjs';
10
11
  import React__default, { CSSProperties, ReactNode, RefObject, ReactElement } from 'react';
11
12
 
12
13
  declare function createDynamicsTheme(): Theme;
13
14
 
14
- type Density = 'comfortable' | 'compact';
15
- declare const densityScale: {
16
- readonly comfortable: 1;
17
- readonly compact: 0.75;
18
- };
19
- /** Scale a base spacing value (px) by the active density. */
20
- declare function scaleSpacing(value: number, density?: Density): number;
21
-
22
- interface ContainerSize {
23
- width: number;
24
- height: number;
25
- inlineSize: number;
26
- blockSize: number;
27
- }
28
- /** Observe an element's size via ResizeObserver. Pass a ref; returns {width,height,inlineSize,blockSize}. */
29
- declare function useContainerSize<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): ContainerSize;
30
-
31
- /**
32
- * Create-and-return a ref plus the observed width of the element it is attached to.
33
- * `const [ref, width] = useContainerWidth(); return <div ref={ref}>…</div>`.
34
- */
35
- declare function useContainerWidth<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, number];
36
-
37
- /**
38
- * Resolve the *container's* current breakpoint (not the viewport's) — the correctness
39
- * fix for a surface inside a PCF, where width comes from `context.allocatedWidth`.
40
- * Returns `[ref, breakpoint, width]`.
41
- */
42
- declare function useContainerBreakpoint<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, Breakpoint, number];
43
-
44
- /**
45
- * Resolve a responsive value against the *container's* current breakpoint.
46
- * `const [ref, cols] = useResponsiveValue({ xs: 1, md: 2, lg: 3 });`
47
- */
48
- declare function useResponsiveValue<T, E extends HTMLElement = HTMLDivElement>(value: ResponsiveValue<T>): [React.RefObject<E>, T | undefined];
49
-
50
- /** Viewport media-query match — the SSR-safe / no-ResizeObserver fallback to the container hooks. */
51
- declare function useMediaQuery(query: string): boolean;
52
-
53
- /**
54
- * Form-level spacing density. `FormSurface` provides it; `Section` (and any future
55
- * container) reads it via `useDensity()`, so a single `density` switch on the form
56
- * cascades to every section instead of being set per-section. Defaults to
57
- * `'comfortable'` (the Dynamics default) — `'compact'` scales spacing by 0.75.
58
- */
59
- declare const DensityContext: React.Context<Density>;
60
- /** Read the ambient spacing density (defaults to `'comfortable'` outside a provider). */
61
- declare const useDensity: () => Density;
62
-
63
15
  type SurfaceVariant = 'card' | 'flat' | 'placeholder';
64
16
  type Alignment = 'left' | 'center' | 'right';
65
17
  interface SurfaceActionButton {
@@ -414,4 +366,4 @@ type ResolvedSurface = {
414
366
  /** Resolve a (duck-typed) form-runtime FormDefinition to the right surface + sizing props. */
415
367
  declare function fromFormDefinition(def: FormDefinitionLike): ResolvedSurface;
416
368
 
417
- export { ActionBar, type ActionBarProps, type Alignment, Breakpoint, type CalloutDirection, CalloutSurface, type CalloutSurfaceProps, ColumnCount, ColumnLayout, type ColumnLayoutProps, CommandSurface, type CommandSurfaceProps, type ContainerSize, DashboardSurface, type DashboardSurfaceProps, type Density, DensityContext, DialogSizePreset, FieldRow, type FieldRowProps, type FluentPanelType, Footer, type FooterProps, type FormDefinitionLike, FormDialogSurface, type FormDialogSurfaceProps, FormHeader, type FormHeaderProps, type FormSettingsLike, FormSurface, type FormSurfaceProps, MasterDetailSurface, type MasterDetailSurfaceProps, ModalSurface, type ModalSurfaceProps, PageSurface, type PageSurfaceProps, PanelSurface, type PanelSurfaceProps, PivotSurface, type PivotSurfaceProps, type ResolvedSurface, ResponsiveValue, Section, SectionCard, type SectionCardProps, SectionHeader, type SectionHeaderProps, type SectionProps, type SurfaceActionButton, type SurfaceFormType, type SurfaceTab, type SurfaceVariant, TooltipSurface, type TooltipSurfaceProps, TwoColumnLayout, type TwoColumnLayoutProps, createDynamicsTheme, densityScale, fromFormDefinition, scaleSpacing, useContainerBreakpoint, useContainerSize, useContainerWidth, useDensity, useMediaQuery, useResponsiveValue };
369
+ export { ActionBar, type ActionBarProps, type Alignment, Breakpoint, type CalloutDirection, CalloutSurface, type CalloutSurfaceProps, ColumnCount, ColumnLayout, type ColumnLayoutProps, CommandSurface, type CommandSurfaceProps, DashboardSurface, type DashboardSurfaceProps, Density, DialogSizePreset, FieldRow, type FieldRowProps, type FluentPanelType, Footer, type FooterProps, type FormDefinitionLike, FormDialogSurface, type FormDialogSurfaceProps, FormHeader, type FormHeaderProps, type FormSettingsLike, FormSurface, type FormSurfaceProps, MasterDetailSurface, type MasterDetailSurfaceProps, ModalSurface, type ModalSurfaceProps, PageSurface, type PageSurfaceProps, PanelSurface, type PanelSurfaceProps, PivotSurface, type PivotSurfaceProps, type ResolvedSurface, Section, SectionCard, type SectionCardProps, SectionHeader, type SectionHeaderProps, type SectionProps, type SurfaceActionButton, type SurfaceFormType, type SurfaceTab, type SurfaceVariant, TooltipSurface, type TooltipSurfaceProps, TwoColumnLayout, type TwoColumnLayoutProps, createDynamicsTheme, fromFormDefinition };
package/dist/index.d.ts CHANGED
@@ -2,64 +2,16 @@ import { DialogSizePreset } from './core.js';
2
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
3
  import { C as ColumnCount } from './columns-BlpFO5VD.js';
4
4
  export { c as clampSpan, g as gridTemplateForColumns } from './columns-BlpFO5VD.js';
5
- import { Breakpoint, ResponsiveValue } from './responsive.js';
6
- export { BREAKPOINTS, CARD_REFLOW_WIDTH, ResponsiveMode, StyleObject, fieldGridStyle, fieldRowStyle, resolveBreakpoint, resolveResponsiveValue, sectionStackingStyle } from './responsive.js';
5
+ import { Breakpoint } from './responsive.js';
6
+ export { BREAKPOINTS, CARD_REFLOW_WIDTH, ResponsiveMode, ResponsiveValue, StyleObject, fieldGridStyle, fieldRowStyle, resolveBreakpoint, resolveResponsiveValue, sectionStackingStyle } from './responsive.js';
7
7
  export { colors, layout, radius, spacing, typography } from '@dataverse-kit/design-tokens';
8
8
  import { Theme, ICommandBarItemProps } from '@fluentui/react';
9
- import * as React from 'react';
9
+ import { D as Density } from './useDensity-BePwtUzY.js';
10
+ 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';
10
11
  import React__default, { CSSProperties, ReactNode, RefObject, ReactElement } from 'react';
11
12
 
12
13
  declare function createDynamicsTheme(): Theme;
13
14
 
14
- type Density = 'comfortable' | 'compact';
15
- declare const densityScale: {
16
- readonly comfortable: 1;
17
- readonly compact: 0.75;
18
- };
19
- /** Scale a base spacing value (px) by the active density. */
20
- declare function scaleSpacing(value: number, density?: Density): number;
21
-
22
- interface ContainerSize {
23
- width: number;
24
- height: number;
25
- inlineSize: number;
26
- blockSize: number;
27
- }
28
- /** Observe an element's size via ResizeObserver. Pass a ref; returns {width,height,inlineSize,blockSize}. */
29
- declare function useContainerSize<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): ContainerSize;
30
-
31
- /**
32
- * Create-and-return a ref plus the observed width of the element it is attached to.
33
- * `const [ref, width] = useContainerWidth(); return <div ref={ref}>…</div>`.
34
- */
35
- declare function useContainerWidth<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, number];
36
-
37
- /**
38
- * Resolve the *container's* current breakpoint (not the viewport's) — the correctness
39
- * fix for a surface inside a PCF, where width comes from `context.allocatedWidth`.
40
- * Returns `[ref, breakpoint, width]`.
41
- */
42
- declare function useContainerBreakpoint<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, Breakpoint, number];
43
-
44
- /**
45
- * Resolve a responsive value against the *container's* current breakpoint.
46
- * `const [ref, cols] = useResponsiveValue({ xs: 1, md: 2, lg: 3 });`
47
- */
48
- declare function useResponsiveValue<T, E extends HTMLElement = HTMLDivElement>(value: ResponsiveValue<T>): [React.RefObject<E>, T | undefined];
49
-
50
- /** Viewport media-query match — the SSR-safe / no-ResizeObserver fallback to the container hooks. */
51
- declare function useMediaQuery(query: string): boolean;
52
-
53
- /**
54
- * Form-level spacing density. `FormSurface` provides it; `Section` (and any future
55
- * container) reads it via `useDensity()`, so a single `density` switch on the form
56
- * cascades to every section instead of being set per-section. Defaults to
57
- * `'comfortable'` (the Dynamics default) — `'compact'` scales spacing by 0.75.
58
- */
59
- declare const DensityContext: React.Context<Density>;
60
- /** Read the ambient spacing density (defaults to `'comfortable'` outside a provider). */
61
- declare const useDensity: () => Density;
62
-
63
15
  type SurfaceVariant = 'card' | 'flat' | 'placeholder';
64
16
  type Alignment = 'left' | 'center' | 'right';
65
17
  interface SurfaceActionButton {
@@ -414,4 +366,4 @@ type ResolvedSurface = {
414
366
  /** Resolve a (duck-typed) form-runtime FormDefinition to the right surface + sizing props. */
415
367
  declare function fromFormDefinition(def: FormDefinitionLike): ResolvedSurface;
416
368
 
417
- export { ActionBar, type ActionBarProps, type Alignment, Breakpoint, type CalloutDirection, CalloutSurface, type CalloutSurfaceProps, ColumnCount, ColumnLayout, type ColumnLayoutProps, CommandSurface, type CommandSurfaceProps, type ContainerSize, DashboardSurface, type DashboardSurfaceProps, type Density, DensityContext, DialogSizePreset, FieldRow, type FieldRowProps, type FluentPanelType, Footer, type FooterProps, type FormDefinitionLike, FormDialogSurface, type FormDialogSurfaceProps, FormHeader, type FormHeaderProps, type FormSettingsLike, FormSurface, type FormSurfaceProps, MasterDetailSurface, type MasterDetailSurfaceProps, ModalSurface, type ModalSurfaceProps, PageSurface, type PageSurfaceProps, PanelSurface, type PanelSurfaceProps, PivotSurface, type PivotSurfaceProps, type ResolvedSurface, ResponsiveValue, Section, SectionCard, type SectionCardProps, SectionHeader, type SectionHeaderProps, type SectionProps, type SurfaceActionButton, type SurfaceFormType, type SurfaceTab, type SurfaceVariant, TooltipSurface, type TooltipSurfaceProps, TwoColumnLayout, type TwoColumnLayoutProps, createDynamicsTheme, densityScale, fromFormDefinition, scaleSpacing, useContainerBreakpoint, useContainerSize, useContainerWidth, useDensity, useMediaQuery, useResponsiveValue };
369
+ export { ActionBar, type ActionBarProps, type Alignment, Breakpoint, type CalloutDirection, CalloutSurface, type CalloutSurfaceProps, ColumnCount, ColumnLayout, type ColumnLayoutProps, CommandSurface, type CommandSurfaceProps, DashboardSurface, type DashboardSurfaceProps, Density, DialogSizePreset, FieldRow, type FieldRowProps, type FluentPanelType, Footer, type FooterProps, type FormDefinitionLike, FormDialogSurface, type FormDialogSurfaceProps, FormHeader, type FormHeaderProps, type FormSettingsLike, FormSurface, type FormSurfaceProps, MasterDetailSurface, type MasterDetailSurfaceProps, ModalSurface, type ModalSurfaceProps, PageSurface, type PageSurfaceProps, PanelSurface, type PanelSurfaceProps, PivotSurface, type PivotSurfaceProps, type ResolvedSurface, Section, SectionCard, type SectionCardProps, SectionHeader, type SectionHeaderProps, type SectionProps, type SurfaceActionButton, type SurfaceFormType, type SurfaceTab, type SurfaceVariant, TooltipSurface, type TooltipSurfaceProps, TwoColumnLayout, type TwoColumnLayoutProps, createDynamicsTheme, fromFormDefinition };
@@ -0,0 +1,53 @@
1
+ import * as React from 'react';
2
+ import { Breakpoint, ResponsiveValue } from './responsive.js';
3
+
4
+ type Density = 'comfortable' | 'compact';
5
+ declare const densityScale: {
6
+ readonly comfortable: 1;
7
+ readonly compact: 0.75;
8
+ };
9
+ /** Scale a base spacing value (px) by the active density. */
10
+ declare function scaleSpacing(value: number, density?: Density): number;
11
+
12
+ interface ContainerSize {
13
+ width: number;
14
+ height: number;
15
+ inlineSize: number;
16
+ blockSize: number;
17
+ }
18
+ /** Observe an element's size via ResizeObserver. Pass a ref; returns {width,height,inlineSize,blockSize}. */
19
+ declare function useContainerSize<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): ContainerSize;
20
+
21
+ /**
22
+ * Create-and-return a ref plus the observed width of the element it is attached to.
23
+ * `const [ref, width] = useContainerWidth(); return <div ref={ref}>…</div>`.
24
+ */
25
+ declare function useContainerWidth<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, number];
26
+
27
+ /**
28
+ * Resolve the *container's* current breakpoint (not the viewport's) — the correctness
29
+ * fix for a surface inside a PCF, where width comes from `context.allocatedWidth`.
30
+ * Returns `[ref, breakpoint, width]`.
31
+ */
32
+ declare function useContainerBreakpoint<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, Breakpoint, number];
33
+
34
+ /**
35
+ * Resolve a responsive value against the *container's* current breakpoint.
36
+ * `const [ref, cols] = useResponsiveValue({ xs: 1, md: 2, lg: 3 });`
37
+ */
38
+ declare function useResponsiveValue<T, E extends HTMLElement = HTMLDivElement>(value: ResponsiveValue<T>): [React.RefObject<E>, T | undefined];
39
+
40
+ /** Viewport media-query match — the SSR-safe / no-ResizeObserver fallback to the container hooks. */
41
+ declare function useMediaQuery(query: string): boolean;
42
+
43
+ /**
44
+ * Form-level spacing density. `FormSurface` provides it; `Section` (and any future
45
+ * container) reads it via `useDensity()`, so a single `density` switch on the form
46
+ * cascades to every section instead of being set per-section. Defaults to
47
+ * `'comfortable'` (the Dynamics default) — `'compact'` scales spacing by 0.75.
48
+ */
49
+ declare const DensityContext: React.Context<Density>;
50
+ /** Read the ambient spacing density (defaults to `'comfortable'` outside a provider). */
51
+ declare const useDensity: () => Density;
52
+
53
+ export { type ContainerSize as C, type Density as D, useContainerWidth as a, useContainerBreakpoint as b, useResponsiveValue as c, densityScale as d, useMediaQuery as e, DensityContext as f, useDensity as g, scaleSpacing as s, useContainerSize as u };
@@ -0,0 +1,53 @@
1
+ import * as React from 'react';
2
+ import { Breakpoint, ResponsiveValue } from './responsive.cjs';
3
+
4
+ type Density = 'comfortable' | 'compact';
5
+ declare const densityScale: {
6
+ readonly comfortable: 1;
7
+ readonly compact: 0.75;
8
+ };
9
+ /** Scale a base spacing value (px) by the active density. */
10
+ declare function scaleSpacing(value: number, density?: Density): number;
11
+
12
+ interface ContainerSize {
13
+ width: number;
14
+ height: number;
15
+ inlineSize: number;
16
+ blockSize: number;
17
+ }
18
+ /** Observe an element's size via ResizeObserver. Pass a ref; returns {width,height,inlineSize,blockSize}. */
19
+ declare function useContainerSize<T extends HTMLElement = HTMLElement>(ref: React.RefObject<T>): ContainerSize;
20
+
21
+ /**
22
+ * Create-and-return a ref plus the observed width of the element it is attached to.
23
+ * `const [ref, width] = useContainerWidth(); return <div ref={ref}>…</div>`.
24
+ */
25
+ declare function useContainerWidth<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, number];
26
+
27
+ /**
28
+ * Resolve the *container's* current breakpoint (not the viewport's) — the correctness
29
+ * fix for a surface inside a PCF, where width comes from `context.allocatedWidth`.
30
+ * Returns `[ref, breakpoint, width]`.
31
+ */
32
+ declare function useContainerBreakpoint<T extends HTMLElement = HTMLDivElement>(): [React.RefObject<T>, Breakpoint, number];
33
+
34
+ /**
35
+ * Resolve a responsive value against the *container's* current breakpoint.
36
+ * `const [ref, cols] = useResponsiveValue({ xs: 1, md: 2, lg: 3 });`
37
+ */
38
+ declare function useResponsiveValue<T, E extends HTMLElement = HTMLDivElement>(value: ResponsiveValue<T>): [React.RefObject<E>, T | undefined];
39
+
40
+ /** Viewport media-query match — the SSR-safe / no-ResizeObserver fallback to the container hooks. */
41
+ declare function useMediaQuery(query: string): boolean;
42
+
43
+ /**
44
+ * Form-level spacing density. `FormSurface` provides it; `Section` (and any future
45
+ * container) reads it via `useDensity()`, so a single `density` switch on the form
46
+ * cascades to every section instead of being set per-section. Defaults to
47
+ * `'comfortable'` (the Dynamics default) — `'compact'` scales spacing by 0.75.
48
+ */
49
+ declare const DensityContext: React.Context<Density>;
50
+ /** Read the ambient spacing density (defaults to `'comfortable'` outside a provider). */
51
+ declare const useDensity: () => Density;
52
+
53
+ export { type ContainerSize as C, type Density as D, useContainerWidth as a, useContainerBreakpoint as b, useResponsiveValue as c, densityScale as d, useMediaQuery as e, DensityContext as f, useDensity as g, scaleSpacing as s, useContainerSize as u };