@cntrl-site/components 1.0.78 → 1.0.79-alpha.1

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.
@@ -1,3 +1,13 @@
1
1
  export type CommonComponentProps = {
2
2
  metadata?: Record<string, any>;
3
+ /**
4
+ * Editor-controlled visual state, matching a `statePanels` id when set.
5
+ * Omitted on the published site unless a wrapper needs to pin a state.
6
+ */
7
+ currentState?: string | null;
8
+ /**
9
+ * State panel ids that must not become the visual state.
10
+ * Derived from schema `availableWhen` and the current host context.
11
+ */
12
+ unavailableStates?: string[];
3
13
  };
@@ -1,8 +1,11 @@
1
1
  export { scalingValue } from './scalingValue';
2
2
  export { buildColorVars } from './buildColorVars';
3
+ export { getColorAlpha } from './getColorAlpha';
3
4
  export { getFormFieldValidationError, isValidEmailFormat, isValidPhoneFormat, } from './formFieldValidation';
4
5
  export type { ValidatableFormField } from './formFieldValidation';
5
6
  export { useScopedStyles } from './useScopedStyles';
6
7
  export type { ScopedStyles } from './useScopedStyles';
7
8
  export type { CommonComponentProps } from '../props';
8
9
  export { readTestimonialTextMeasure } from './readTestimonialTextMeasure';
10
+ export { getAvailableStatePanels, getUnavailableStates, isPanelAvailable, } from './panelAvailability';
11
+ export type { PanelAvailabilityContext } from './panelAvailability';
@@ -0,0 +1,13 @@
1
+ export type PanelAvailabilityContext = Record<string, string | undefined>;
2
+ type AvailabilityPanel = {
3
+ id: string;
4
+ availableWhen?: Record<string, string[]>;
5
+ };
6
+ type AvailabilitySchema = {
7
+ panels?: AvailabilityPanel[];
8
+ statePanels?: string[] | null;
9
+ };
10
+ export declare function isPanelAvailable(panel: AvailabilityPanel | undefined, context: PanelAvailabilityContext): boolean;
11
+ export declare function getAvailableStatePanels(schema: AvailabilitySchema | undefined, context: PanelAvailabilityContext): string[] | null;
12
+ export declare function getUnavailableStates(schema: AvailabilitySchema | undefined, context: PanelAvailabilityContext): string[];
13
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { type Breakpoint, type Component, type ComponentDefaultSize, type ComponentSize, isSchemaV1 } from './types/Component';
2
- export type { ComponentSchemaV1, SchemaProperty, PropertyScope, LayoutItem, LayoutRow, LayoutGroup, LayoutSwitcher, LayoutTab, SchemaSection, SchemaPanel, SchemaDisplay } from './types/SchemaV1';
2
+ export type { ComponentSchemaV1, SchemaProperty, PropertyScope, LayoutItem, LayoutRow, LayoutGroup, LayoutSwitcher, LayoutTab, SchemaSection, SchemaPanel, SchemaPanelAvailability, SchemaDisplay } from './types/SchemaV1';
3
3
  export { components } from './Components/components';
4
+ export { getAvailableStatePanels, getUnavailableStates, isPanelAvailable, } from './Components/utils/panelAvailability';
5
+ export type { PanelAvailabilityContext } from './Components/utils/panelAvailability';