Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | /**
* @fds-uif/schema - Shared Type Definitions
*
* These types are used by both Foundation and System schemas.
*/
/**
* Structured pointer to a replacement artifact for a {@link Deprecated} entry.
*
* Each field defaults to "same as the deprecated artifact's context", so the
* simple cases stay short:
*
* - Option → another option of the same modifier:
* `{ value: 'xx-small' }`
* - Whole modifier → another modifier on the same component:
* `{ prop: 'compact' }`
* - Whole component → another component:
* `{ component: 'Notification' }`
* - Cross-component (e.g. Button modifier → PrimitiveIcon variant):
* `{ component: 'PrimitiveIcon', prop: 'variant', value: 'bare' }`
*
* At least one of {@link component}, {@link prop}, or {@link value} must be
* present when this object is set; the JSON schema rejects empty objects.
*/
export interface DeprecatedReplacement {
/**
* Name of the component the replacement lives in.
* Omit when the replacement is in the same component as the deprecated artifact.
*/
component?: string;
/**
* Name of the prop on that component (modifier name, variant name, etc.).
* Omit when the replacement is on the same prop as the deprecated artifact
* (e.g., another option of the same modifier).
*/
prop?: string;
/**
* Specific value of that prop (option `propValue`, variant `value`).
* Omit for whole-prop or whole-component replacements.
*/
value?: string;
}
/**
* Deprecation metadata for UIF artifacts (the UIF root, modifiers, options,
* variants, structure children, and states).
*
* `message` is required; the remaining fields are optional metadata that
* consumers (TS generators, runtime validation, sandbox UI, lints) use to
* shape behavior.
*
* `since` and `removeBy` are Salesforce / SLDS release numbers expressed as
* strings (e.g. `'262'`, `'264'`), matching the convention used by CSS hook
* deprecation comments. Salesforce releases increment by two per release
* (260, 262, 264, ...); the standard deprecation window of three releases
* is therefore a numeric gap of six.
*
* Note: there is no `'removed'` state. Once an artifact's `removeBy` release
* ships, the entry is deleted from the UIF in the same release branch.
*/
export interface Deprecated {
/** Human-readable explanation of why this is deprecated and what to do. */
message: string;
/**
* Optional escalation. Defaults to `'warning'`. Use `'error'` when
* migration is urgent (security, accessibility, known breakage) and you
* want to surface a louder signal.
*/
severity?: 'warning' | 'error';
/**
* Structured pointer to the replacement. Each field defaults to "same as
* the deprecated artifact's context", so simple cases stay short.
* At least one of `component`, `prop`, or `value` must be present when
* `replacement` is set; the schema rejects empty objects.
*/
replacement?: DeprecatedReplacement;
/** Salesforce / SLDS release in which the item was deprecated (e.g. `'262'`). */
since?: string;
/**
* Planned removal release (e.g. `'268'`). Convention is `since + 6` (the
* standard three-release window). Bump this value, and add
* {@link extensionReason}, when a removal is intentionally extended for a
* heavy-usage or high-impact artifact.
*/
removeBy?: string;
/**
* One-line justification recorded when {@link removeBy} is pushed beyond
* the standard three-release window. Surfaces in the per-release audit
* report so reviewers can see *why* an item is sitting in the deprecation
* window longer than usual (heavy usage, blocked migration, dependent
* product).
*/
extensionReason?: string;
/**
* URL to a migration guide, RFC, release notes, GitHub PR, or other
* documentation explaining the deprecation in more detail.
*/
url?: string;
}
/**
* Namespaced metadata for third-party tooling.
* Keys should use reverse domain notation (e.g., 'com.salesforce-ux').
* Each namespace value is an arbitrary object owned by that namespace.
*/
export type Extensions = Record<string, Record<string, unknown>>;
/**
* Slot definition for content injection points.
*/
export interface Slot {
/** Slot identifier ('default' for primary content) */
name: string;
/** Allowed component types (e.g., ['Tab'] for TabList slots) */
restrict?: string[];
/** If true, at least one child must be provided */
required?: boolean;
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
/**
* Attribute bound to a component prop.
*/
export interface BoundAttribute {
/** Name of the prop this attribute is bound to */
prop: string;
/** Whether this prop is required */
required?: boolean;
}
/**
* Attribute rendered conditionally based on state.
*/
export interface ConditionalAttribute {
/** Condition expression (e.g., state reference) */
when: string;
/** Value to render when condition is true */
value: string;
}
/**
* HTML attributes for a structural element.
*/
export interface Attributes {
/** Hardcoded attribute values. The `class` key accepts `string | string[]`. */
static?: Record<string, string | string[]>;
/** Attributes bound to component props */
bound?: Record<string, BoundAttribute>;
/** Conditionally rendered attributes */
conditional?: Record<string, ConditionalAttribute | ConditionalAttribute[]>;
}
/**
* Accessibility requirement definition.
*/
export interface AccessibilityRequirement {
/** Unique identifier for the requirement */
id: string;
/** Description of the requirement */
description: string;
}
/**
* Accessibility configuration for a component.
*/
export interface Accessibility {
/** ARIA role for the component's root element */
role?: string;
/** Required ARIA properties */
requiredProps?: string[];
/** Landmark region mappings */
landmarks?: Record<string, string>;
/** List of accessibility requirements */
requirements?: AccessibilityRequirement[];
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
/**
* Prop definition within a component reference interface.
*/
export interface ComponentRefProp {
/** Prop data type */
type: 'string' | 'boolean' | 'number' | 'object' | 'array';
/** Whether the prop is required */
required?: boolean;
/** Description of the prop */
description?: string;
/** Default value */
default?: unknown;
/** Allowed values for enum-like props */
enum?: string[];
}
/**
* Interface declaration for a composed component.
*
* Declares the props surface of a child component referenced by name
* (via `component:` on a child) without re-declaring its full UIF.
*/
export interface ComponentRef {
/** Description of how this component is used */
description?: string;
/** Props available on the composed component */
props: Record<string, ComponentRefProp>;
}
/**
* Prop-value equality condition for conditional rendering.
*
* The child renders only when the named prop equals the given value.
* Used to tie composed children to a specific prop setting
* (e.g. iconRight renders when iconPosition === 'right').
*/
export interface RenderWhenPropMatch {
/** Prop name to test */
prop: string;
/** Value the prop must equal for this child to render */
eq: string;
}
/**
* Conditional rendering expression.
*
* - `'slotFilled'` — render when the child's slot has content
* - `'propFilled'` — render when the child's bound prop is provided
* - `{ prop, eq }` — render when a parent prop equals a specific value
*/
export type RenderWhen = 'slotFilled' | 'propFilled' | RenderWhenPropMatch;
/**
* Base child element definition shared between foundation and system.
*/
export interface BaseChild {
/** Unique identifier for the child element */
name: string;
/** Allowed HTML elements */
restrict?: string[];
/** Description of this child */
description?: string;
/** Conditional rendering mode */
renderWhen?: RenderWhen;
/** Whether this child repeats (maps over array) */
repeats?: boolean;
/** Slot for injecting content */
slot?: Slot;
/** Deprecation metadata */
deprecated?: Deprecated;
}
/**
* Option within a grouped modifier.
*
* @example
* ```json
* { "propValue": "small", "value": "slds-button_small" }
* ```
*/
export interface ModifierOption {
/** The consumer-facing option value (used as prop value) */
propValue: string;
/** The attribute value to apply (e.g., CSS class) */
value: string;
/** Deprecation metadata */
deprecated?: Deprecated;
}
/**
* Configuration for how a composed component's props are wired.
*
* Mirrors {@link ResolvedComponentProps} — keys group props by binding style:
* - `static` — hardcoded values always applied
* - `bound` — props bound to parent props
* - `forwarded` — props passed through unchanged
* - `byVariant` — props determined by a parent variant
* - `restrict` — whitelist that narrows the child's interface
*/
export interface ComponentProps {
/** Hardcoded prop values, always applied */
static?: Record<string, unknown>;
/** Props bound to parent component props (child prop → parent prop) */
bound?: Record<string, string>;
/** Props passed through from parent unchanged */
forwarded?: string[];
/** Props determined by parent's variant value (variant → option → props) */
byVariant?: Record<string, Record<string, Record<string, unknown>>>;
/** Whitelist of allowed props (narrows the child's interface) */
restrict?: string[];
}
|