@selfhelp/shared 1.10.0 → 1.11.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/CHANGELOG.md +19 -0
- package/dist/index.d.mts +131 -2
- package/dist/index.d.ts +131 -2
- package/package.json +1 -1
- package/src/types/__tests__/mobile-adapters.test.ts +80 -0
- package/src/types/index.ts +1 -0
- package/src/types/mobile-adapters.ts +144 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,25 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
9
9
|
|
|
10
10
|
This project follows semantic versioning.
|
|
11
11
|
|
|
12
|
+
## v1.11.0
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Mobile UI adapter contract is now a single public source
|
|
17
|
+
(`IMobileUiAdapters` + the `IMobile*Props` capability interfaces).** Mobile
|
|
18
|
+
rendering plan sections 8.3 / 9: both mobile tiers (the public app's
|
|
19
|
+
open-source adapters and the private `@selfhelp/mobile-pro-ui` overrides) now
|
|
20
|
+
consume one contract from `@selfhelp/shared` instead of each repo keeping a
|
|
21
|
+
hand-synced copy. The module is type-only (it imports `react` types and the
|
|
22
|
+
shared semantic scales `THeroUiSize`/`THeroUiButtonVariant`; it pulls in no
|
|
23
|
+
React Native runtime dependency), which is why it lives here rather than in a
|
|
24
|
+
separate contract package. The milestone-one capability set is
|
|
25
|
+
`MobileButton`, `MobileText`, `MobileContainer`, `MobileCard`, `MobileInput`,
|
|
26
|
+
`MobileTextarea`, `MobileSwitch`, `MobileCheckbox`, `MobileSelect`, and
|
|
27
|
+
`MobileModal`. Covered by a contract test (`src/types/__tests__`) that locks
|
|
28
|
+
the exact set; consumers enforce the shape at compile time
|
|
29
|
+
(`ossAdapters`/`proAdapters: IMobileUiAdapters`).
|
|
30
|
+
|
|
12
31
|
## v1.10.0
|
|
13
32
|
|
|
14
33
|
### Changed
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { T as TStyleName, j as IContentField } from './styles.registry-DkoT-FmN.mjs';
|
|
2
2
|
export { B as BASE_STYLE_REGISTRY, k as IAccordionItemStyle, l as IAccordionStyle, m as IActionIconStyle, n as IAlertStyle, o as IAspectRatioStyle, p as IAudioStyle, q as IAvatarStyle, r as IBackgroundImageStyle, s as IBadgeStyle, t as IBaseStyle, u as IBlockquoteStyle, v as IBoxStyle, w as IButtonStyle, x as ICardSegmentStyle, y as ICardStyle, z as ICarouselStyle, A as ICenterStyle, C as ICheckboxStyle, D as IChipStyle, E as ICodeStyle, F as IColorInputStyle, G as IColorPickerStyle, H as IComboboxStyle, J as IContainerStyle, K as IDataContainerStyle, L as IDatePickerStyle, M as IDividerStyle, N as IEntryListStyle, O as IEntryRecordDeleteStyle, P as IEntryRecordStyle, Q as IFieldsetStyle, R as IFigureStyle, U as IFileInputStyle, V as IFlexStyle, W as IFormLogStyle, X as IFormRecordStyle, Y as IFormStyle, Z as IGridColumnStyle, $ as IGridStyle, a0 as IGroupStyle, a1 as IHighlightStyle, a2 as IHtmlTagStyle, a3 as IImageStyle, a4 as IIndicatorStyle, a5 as IInputStyle, a6 as IKbdStyle, a7 as ILinkStyle, a8 as IListItemStyle, a9 as IListStyle, aa as ILoginStyle, ab as ILoopStyle, ac as IMissingStyle, ad as INoAccessStyle, ae as INotFoundStyle, af as INotificationStyle, ag as INumberInputStyle, ah as IPaperStyle, a as IPluginStyleRegistryEntry, ai as IProfileStyle, aj as IProgressRootStyle, ak as IProgressSectionStyle, al as IProgressStyle, am as IRadioStyle, an as IRangeSliderStyle, ao as IRatingStyle, ap as IRefContainerStyle, aq as IRegisterStyle, ar as IResetPasswordStyle, as as IRichTextEditorStyle, at as IScrollAreaStyle, au as ISegmentedControlStyle, av as ISelectStyle, aw as IShowUserInputEntry, ax as IShowUserInputStyle, ay as ISimpleGridStyle, az as ISliderStyle, aA as ISpaceStyle, aB as ISpoilerStyle, aC as IStackStyle, I as IStyleRegistryEntry, aD as IStyleWithSpacing, aE as ISwitchStyle, aF as ITabStyle, aG as ITabsStyle, aH as ITextInputStyle, aI as ITextStyle, aJ as ITextareaStyle, aK as IThemeIconStyle, aL as ITimelineItemStyle, aM as ITimelineStyle, aN as ITitleStyle, aO as ITwoFactorAuthStyle, aP as ITypographyStyle, aQ as IUnknownStyle, aR as IValidateStyle, aS as IVersionStyle, aT as IVideoStyle, S as STYLE_REGISTRY, c as TConcretePlatform, aU as TMantineAccordionChevronPosition, aV as TMantineAccordionDisableChevronRotation, aW as TMantineAccordionLoop, aX as TMantineAccordionMultiple, aY as TMantineBorder, aZ as TMantineCardShadow, a_ as TMantineCheckboxLabelPosition, a$ as TMantineCols, b0 as TMantineDividerVariant, b1 as TMantineGap, b2 as TMantineGridOffset, b3 as TMantineGridOrder, b4 as TMantineHeight, b5 as TMantineIconSize, b6 as TMantineImageFit, b7 as TMantineLineClamp, b8 as TMantineListCenter, b9 as TMantineListStyleType, ba as TMantineListType, bb as TMantineListWithPadding, bc as TMantinePaperShadow, bd as TMantineProgressTransition, be as TMantineScrollAreaSize, bf as TMantineScrollAreaType, bg as TMantineTextAlign, bh as TMantineTextDecoration, bi as TMantineTextFontStyle, bj as TMantineTextFontWeight, bk as TMantineTextInherit, bl as TMantineTextInputVariant, bm as TMantineTextSpan, bn as TMantineTextTransform, bo as TMantineTextTruncate, bp as TMantineTextVariant, bq as TMantineTextareaAutosize, br as TMantineTextareaResize, bs as TMantineTextareaVariant, bt as TMantineTimelineAlign, bu as TMantineTitleLineClamp, bv as TMantineTitleTextWrap, bw as TMantineTranslatable, bx as TMantineUseInputWrapper, by as TMantineWidth, bz as TStyle, b as TStylePlacement, d as TStylePlatform, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from './styles.registry-DkoT-FmN.mjs';
|
|
3
3
|
export { u as TMantineAccordionVariant, x as TMantineActionIconLoading, d as TMantineAlign, y as TMantineAllowNextClicks, z as TMantineAllowStepClick, A as TMantineAspectRatio, B as TMantineAutoContrast, q as TMantineAvatarVariant, p as TMantineBadgeVariant, C as TMantineBlock, D as TMantineCenterInline, E as TMantineChecked, F as TMantineChipChecked, G as TMantineChipMultiple, r as TMantineChipVariant, H as TMantineClampBehavior, I as TMantineCodeBlock, i as TMantineColor, J as TMantineColorFormat, K as TMantineColorInputSwatches, L as TMantineColorPickerSwatches, M as TMantineColorPickerSwatchesPerRow, N as TMantineCompact, O as TMantineContainerFluid, e as TMantineDirection, P as TMantineDisabled, m as TMantineFieldsetVariant, Q as TMantineFileAccept, R as TMantineFileInputMultiple, S as TMantineFluid, U as TMantineFullWidth, V as TMantineGridGrow, W as TMantineGridOverflow, g as TMantineGridSpan, X as TMantineGroupGrow, Y as TMantineGroupWrap, Z as TMantineGrow, _ as TMantineHighlight, s as TMantineIndicatorPosition, $ as TMantineInline, a0 as TMantineIsLink, c as TMantineJustify, a1 as TMantineKbdSize, a2 as TMantineLoading, a3 as TMantineMultiple, a4 as TMantineNotificationWithCloseButton, a5 as TMantineNumberInputDecimalScale, a6 as TMantineOpenInNewTab, h as TMantineOrientation, a7 as TMantineProcessing, T as TMantineRadius, a8 as TMantineRangeSliderMarks, a9 as TMantineRatingCount, aa as TMantineRatingFractions, ab as TMantineRatingReadonly, ac as TMantineReadonly, l as TMantineSize, ad as TMantineSpaceHorizontal, b as TMantineSpacing, n as TMantineSpoilerMaxHeight, ae as TMantineSwatches, af as TMantineTabDisabled, v as TMantineTabsVariant, t as TMantineThemeIconVariant, w as TMantineTimelineLineVariant, k as TMantineTitleOrder, ag as TMantineUseMantineStyle, o as TMantineVariant, ah as TMantineWithCloseButton, ai as TMantineWithIcon, f as TMantineWrap, j as TSharedRadius, a as TSharedSize } from './common-CJSHQL1E.mjs';
|
|
4
|
+
import { ReactNode, ComponentType } from 'react';
|
|
5
|
+
import { THeroUiButtonVariant, THeroUiSize } from './theme/index.mjs';
|
|
6
|
+
export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, FULL_RADIUS_PX, IHeroUiResolvedStyle, IMantineResolvedStyle, IReactNativeResolvedStyle, IReactNativeThemeScales, IResolvedVariant, ISharedStyleProps, ISpacingResolved, LINE_HEIGHT, RADIUS_PX, SPACING_PX, SPACING_TO_TAILWIND, TCanonicalColor, TCanonicalRadius, TCanonicalSpacing, THeroUiColor, TMantineMappedColor, TMantineMappedVariant, TSemanticIntent, TSemanticRadius, TSemanticSize, TSemanticSpacing, TSemanticState, colorToHex, mapIntentToHeroUiButtonVariant, mapIntentToHeroUiColor, mapIntentToMantine, mapRadiusToMantine, mapRadiusToPx, mapSizeToHeroUi, mapSizeToMantine, mapSpacingToPx, radiusToPx, resolveMantineVariant, resolveSharedStyle, resolveSharedStyleForMobile, resolveSharedStyleForWeb, resolveSharedStyleProps, sizeToFontPx, spacingToPx, toHeroUiSemanticProps, toMantineSemanticProps, toReactNativeSemanticStyle } from './theme/index.mjs';
|
|
4
7
|
export { TAnyStyleName, TPluginStyleImplMap, TStyleImplMap, getRegistryEntry, getRegistryEntryAny, getStylePlacement, getStylePlatforms, getStylePluginId, isKnownStyleName, isRegisteredStyleName, isStyleAllowedOnPage, isStylePlacementAllowed, isStyleSupportedOnPlatform, setToStylePlatform, stylePlatformToSet } from './registry/index.mjs';
|
|
5
|
-
export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, FULL_RADIUS_PX, IHeroUiResolvedStyle, IMantineResolvedStyle, IReactNativeResolvedStyle, IReactNativeThemeScales, IResolvedVariant, ISharedStyleProps, ISpacingResolved, LINE_HEIGHT, RADIUS_PX, SPACING_PX, SPACING_TO_TAILWIND, TCanonicalColor, TCanonicalRadius, TCanonicalSpacing, THeroUiButtonVariant, THeroUiColor, THeroUiSize, TMantineMappedColor, TMantineMappedVariant, TSemanticIntent, TSemanticRadius, TSemanticSize, TSemanticSpacing, TSemanticState, colorToHex, mapIntentToHeroUiButtonVariant, mapIntentToHeroUiColor, mapIntentToMantine, mapRadiusToMantine, mapRadiusToPx, mapSizeToHeroUi, mapSizeToMantine, mapSpacingToPx, radiusToPx, resolveMantineVariant, resolveSharedStyle, resolveSharedStyleForMobile, resolveSharedStyleForWeb, resolveSharedStyleProps, sizeToFontPx, spacingToPx, toHeroUiSemanticProps, toMantineSemanticProps, toReactNativeSemanticStyle } from './theme/index.mjs';
|
|
6
8
|
export { sharedTailwindExtend, sharedTailwindPreset } from './theme/tailwind.mjs';
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -1150,6 +1152,133 @@ interface SupportBundleMeta {
|
|
|
1150
1152
|
contents: string[];
|
|
1151
1153
|
}
|
|
1152
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* Mobile UI adapter contract — the SINGLE public source of the capability
|
|
1157
|
+
* shape both mobile tiers implement (mobile rendering plan, sections 8.3 / 9).
|
|
1158
|
+
*
|
|
1159
|
+
* The public mobile app renders CMS styles through these `Mobile*` capability
|
|
1160
|
+
* interfaces only, never directly against a UI library, so the build can swap
|
|
1161
|
+
* the implementation behind the `@selfhelp/mobile-pro-ui` specifier:
|
|
1162
|
+
* - OSS tier -> the public app's in-repo adapters on open `heroui-native` +
|
|
1163
|
+
* React Native primitives.
|
|
1164
|
+
* - Pro tier -> the private `@selfhelp/mobile-pro-ui` package built on paid
|
|
1165
|
+
* HeroUI Pro components.
|
|
1166
|
+
*
|
|
1167
|
+
* It lives here (not copied into each consumer) so the public app and the Pro
|
|
1168
|
+
* package consume ONE contract and cannot silently drift. This module is
|
|
1169
|
+
* type-only: it imports `react` types and the shared semantic scales, and
|
|
1170
|
+
* pulls in NO React Native runtime dependency, which is why it belongs in
|
|
1171
|
+
* `@selfhelp/shared` rather than a separate contract package (plan 8.3).
|
|
1172
|
+
*
|
|
1173
|
+
* Props are normalized + renderer-agnostic (driven by the shared semantic
|
|
1174
|
+
* mapper in this package), NOT raw library props, so both tiers share one
|
|
1175
|
+
* contract.
|
|
1176
|
+
*/
|
|
1177
|
+
|
|
1178
|
+
/** Props shared by every adapter (styling + accessibility passthrough). */
|
|
1179
|
+
interface IMobileAdapterBaseProps {
|
|
1180
|
+
/** Uniwind/Tailwind class string (from `css_mobile` + spacing). */
|
|
1181
|
+
className?: string;
|
|
1182
|
+
/** Accessibility label for assistive tech. */
|
|
1183
|
+
accessibilityLabel?: string;
|
|
1184
|
+
testID?: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface IMobileButtonProps extends IMobileAdapterBaseProps {
|
|
1187
|
+
label?: string;
|
|
1188
|
+
onPress?: () => void;
|
|
1189
|
+
variant?: THeroUiButtonVariant;
|
|
1190
|
+
size?: THeroUiSize;
|
|
1191
|
+
isDisabled?: boolean;
|
|
1192
|
+
isLoading?: boolean;
|
|
1193
|
+
isIconOnly?: boolean;
|
|
1194
|
+
fullWidth?: boolean;
|
|
1195
|
+
children?: ReactNode;
|
|
1196
|
+
}
|
|
1197
|
+
interface IMobileTextProps extends IMobileAdapterBaseProps {
|
|
1198
|
+
children?: ReactNode;
|
|
1199
|
+
/** Map to a heading level / emphasis; renderer decides exact styling. */
|
|
1200
|
+
emphasis?: 'title' | 'body' | 'muted';
|
|
1201
|
+
numberOfLines?: number;
|
|
1202
|
+
}
|
|
1203
|
+
interface IMobileContainerProps extends IMobileAdapterBaseProps {
|
|
1204
|
+
children?: ReactNode;
|
|
1205
|
+
fullWidth?: boolean;
|
|
1206
|
+
/** Resolved padding in px (from shared spacing). */
|
|
1207
|
+
paddingPx?: number;
|
|
1208
|
+
}
|
|
1209
|
+
interface IMobileCardProps extends IMobileAdapterBaseProps {
|
|
1210
|
+
children?: ReactNode;
|
|
1211
|
+
/** Resolved corner radius in px (from shared radius). */
|
|
1212
|
+
radiusPx?: number;
|
|
1213
|
+
}
|
|
1214
|
+
interface IMobileInputProps extends IMobileAdapterBaseProps {
|
|
1215
|
+
value?: string;
|
|
1216
|
+
onChangeText?: (next: string) => void;
|
|
1217
|
+
placeholder?: string;
|
|
1218
|
+
label?: string;
|
|
1219
|
+
isDisabled?: boolean;
|
|
1220
|
+
isInvalid?: boolean;
|
|
1221
|
+
isRequired?: boolean;
|
|
1222
|
+
secureTextEntry?: boolean;
|
|
1223
|
+
keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad';
|
|
1224
|
+
}
|
|
1225
|
+
interface IMobileTextareaProps extends IMobileAdapterBaseProps {
|
|
1226
|
+
value?: string;
|
|
1227
|
+
onChangeText?: (next: string) => void;
|
|
1228
|
+
placeholder?: string;
|
|
1229
|
+
label?: string;
|
|
1230
|
+
isDisabled?: boolean;
|
|
1231
|
+
isInvalid?: boolean;
|
|
1232
|
+
isRequired?: boolean;
|
|
1233
|
+
/** Minimum visible rows (maps to RN `numberOfLines`). */
|
|
1234
|
+
numberOfLines?: number;
|
|
1235
|
+
}
|
|
1236
|
+
interface IMobileSwitchProps extends IMobileAdapterBaseProps {
|
|
1237
|
+
isSelected?: boolean;
|
|
1238
|
+
onSelectedChange?: (next: boolean) => void;
|
|
1239
|
+
isDisabled?: boolean;
|
|
1240
|
+
label?: string;
|
|
1241
|
+
}
|
|
1242
|
+
interface IMobileCheckboxProps extends IMobileAdapterBaseProps {
|
|
1243
|
+
isSelected?: boolean;
|
|
1244
|
+
onSelectedChange?: (next: boolean) => void;
|
|
1245
|
+
isDisabled?: boolean;
|
|
1246
|
+
label?: string;
|
|
1247
|
+
}
|
|
1248
|
+
interface IMobileSelectOption {
|
|
1249
|
+
value: string;
|
|
1250
|
+
label: string;
|
|
1251
|
+
}
|
|
1252
|
+
interface IMobileSelectProps extends IMobileAdapterBaseProps {
|
|
1253
|
+
value?: string;
|
|
1254
|
+
onValueChange?: (next: string) => void;
|
|
1255
|
+
options: readonly IMobileSelectOption[];
|
|
1256
|
+
placeholder?: string;
|
|
1257
|
+
isDisabled?: boolean;
|
|
1258
|
+
}
|
|
1259
|
+
interface IMobileModalProps extends IMobileAdapterBaseProps {
|
|
1260
|
+
isOpen: boolean;
|
|
1261
|
+
onClose: () => void;
|
|
1262
|
+
title?: string;
|
|
1263
|
+
children?: ReactNode;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* The full adapter set every tier must provide. Both the public app's OSS
|
|
1267
|
+
* index and the private Pro package satisfy this exact shape.
|
|
1268
|
+
*/
|
|
1269
|
+
interface IMobileUiAdapters {
|
|
1270
|
+
MobileButton: ComponentType<IMobileButtonProps>;
|
|
1271
|
+
MobileText: ComponentType<IMobileTextProps>;
|
|
1272
|
+
MobileContainer: ComponentType<IMobileContainerProps>;
|
|
1273
|
+
MobileCard: ComponentType<IMobileCardProps>;
|
|
1274
|
+
MobileInput: ComponentType<IMobileInputProps>;
|
|
1275
|
+
MobileTextarea: ComponentType<IMobileTextareaProps>;
|
|
1276
|
+
MobileSwitch: ComponentType<IMobileSwitchProps>;
|
|
1277
|
+
MobileCheckbox: ComponentType<IMobileCheckboxProps>;
|
|
1278
|
+
MobileSelect: ComponentType<IMobileSelectProps>;
|
|
1279
|
+
MobileModal: ComponentType<IMobileModalProps>;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1153
1282
|
/**
|
|
1154
1283
|
* Frontend-only subset of /cms-api/v1/* endpoints. The web frontend keeps
|
|
1155
1284
|
* its admin endpoints local. The mobile app consumes only what's here.
|
|
@@ -1445,4 +1574,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
1445
1574
|
*/
|
|
1446
1575
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
1447
1576
|
|
|
1448
|
-
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
|
|
1577
|
+
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { T as TStyleName, j as IContentField } from './styles.registry-BV1iF7k-.js';
|
|
2
2
|
export { B as BASE_STYLE_REGISTRY, k as IAccordionItemStyle, l as IAccordionStyle, m as IActionIconStyle, n as IAlertStyle, o as IAspectRatioStyle, p as IAudioStyle, q as IAvatarStyle, r as IBackgroundImageStyle, s as IBadgeStyle, t as IBaseStyle, u as IBlockquoteStyle, v as IBoxStyle, w as IButtonStyle, x as ICardSegmentStyle, y as ICardStyle, z as ICarouselStyle, A as ICenterStyle, C as ICheckboxStyle, D as IChipStyle, E as ICodeStyle, F as IColorInputStyle, G as IColorPickerStyle, H as IComboboxStyle, J as IContainerStyle, K as IDataContainerStyle, L as IDatePickerStyle, M as IDividerStyle, N as IEntryListStyle, O as IEntryRecordDeleteStyle, P as IEntryRecordStyle, Q as IFieldsetStyle, R as IFigureStyle, U as IFileInputStyle, V as IFlexStyle, W as IFormLogStyle, X as IFormRecordStyle, Y as IFormStyle, Z as IGridColumnStyle, $ as IGridStyle, a0 as IGroupStyle, a1 as IHighlightStyle, a2 as IHtmlTagStyle, a3 as IImageStyle, a4 as IIndicatorStyle, a5 as IInputStyle, a6 as IKbdStyle, a7 as ILinkStyle, a8 as IListItemStyle, a9 as IListStyle, aa as ILoginStyle, ab as ILoopStyle, ac as IMissingStyle, ad as INoAccessStyle, ae as INotFoundStyle, af as INotificationStyle, ag as INumberInputStyle, ah as IPaperStyle, a as IPluginStyleRegistryEntry, ai as IProfileStyle, aj as IProgressRootStyle, ak as IProgressSectionStyle, al as IProgressStyle, am as IRadioStyle, an as IRangeSliderStyle, ao as IRatingStyle, ap as IRefContainerStyle, aq as IRegisterStyle, ar as IResetPasswordStyle, as as IRichTextEditorStyle, at as IScrollAreaStyle, au as ISegmentedControlStyle, av as ISelectStyle, aw as IShowUserInputEntry, ax as IShowUserInputStyle, ay as ISimpleGridStyle, az as ISliderStyle, aA as ISpaceStyle, aB as ISpoilerStyle, aC as IStackStyle, I as IStyleRegistryEntry, aD as IStyleWithSpacing, aE as ISwitchStyle, aF as ITabStyle, aG as ITabsStyle, aH as ITextInputStyle, aI as ITextStyle, aJ as ITextareaStyle, aK as IThemeIconStyle, aL as ITimelineItemStyle, aM as ITimelineStyle, aN as ITitleStyle, aO as ITwoFactorAuthStyle, aP as ITypographyStyle, aQ as IUnknownStyle, aR as IValidateStyle, aS as IVersionStyle, aT as IVideoStyle, S as STYLE_REGISTRY, c as TConcretePlatform, aU as TMantineAccordionChevronPosition, aV as TMantineAccordionDisableChevronRotation, aW as TMantineAccordionLoop, aX as TMantineAccordionMultiple, aY as TMantineBorder, aZ as TMantineCardShadow, a_ as TMantineCheckboxLabelPosition, a$ as TMantineCols, b0 as TMantineDividerVariant, b1 as TMantineGap, b2 as TMantineGridOffset, b3 as TMantineGridOrder, b4 as TMantineHeight, b5 as TMantineIconSize, b6 as TMantineImageFit, b7 as TMantineLineClamp, b8 as TMantineListCenter, b9 as TMantineListStyleType, ba as TMantineListType, bb as TMantineListWithPadding, bc as TMantinePaperShadow, bd as TMantineProgressTransition, be as TMantineScrollAreaSize, bf as TMantineScrollAreaType, bg as TMantineTextAlign, bh as TMantineTextDecoration, bi as TMantineTextFontStyle, bj as TMantineTextFontWeight, bk as TMantineTextInherit, bl as TMantineTextInputVariant, bm as TMantineTextSpan, bn as TMantineTextTransform, bo as TMantineTextTruncate, bp as TMantineTextVariant, bq as TMantineTextareaAutosize, br as TMantineTextareaResize, bs as TMantineTextareaVariant, bt as TMantineTimelineAlign, bu as TMantineTitleLineClamp, bv as TMantineTitleTextWrap, bw as TMantineTranslatable, bx as TMantineUseInputWrapper, by as TMantineWidth, bz as TStyle, b as TStylePlacement, d as TStylePlatform, e as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, f as _resetPluginStyleRegistry, g as extendStyleRegistry, h as getMergedStyleRegistry, i as getPluginStyleRegistry } from './styles.registry-BV1iF7k-.js';
|
|
3
3
|
export { u as TMantineAccordionVariant, x as TMantineActionIconLoading, d as TMantineAlign, y as TMantineAllowNextClicks, z as TMantineAllowStepClick, A as TMantineAspectRatio, B as TMantineAutoContrast, q as TMantineAvatarVariant, p as TMantineBadgeVariant, C as TMantineBlock, D as TMantineCenterInline, E as TMantineChecked, F as TMantineChipChecked, G as TMantineChipMultiple, r as TMantineChipVariant, H as TMantineClampBehavior, I as TMantineCodeBlock, i as TMantineColor, J as TMantineColorFormat, K as TMantineColorInputSwatches, L as TMantineColorPickerSwatches, M as TMantineColorPickerSwatchesPerRow, N as TMantineCompact, O as TMantineContainerFluid, e as TMantineDirection, P as TMantineDisabled, m as TMantineFieldsetVariant, Q as TMantineFileAccept, R as TMantineFileInputMultiple, S as TMantineFluid, U as TMantineFullWidth, V as TMantineGridGrow, W as TMantineGridOverflow, g as TMantineGridSpan, X as TMantineGroupGrow, Y as TMantineGroupWrap, Z as TMantineGrow, _ as TMantineHighlight, s as TMantineIndicatorPosition, $ as TMantineInline, a0 as TMantineIsLink, c as TMantineJustify, a1 as TMantineKbdSize, a2 as TMantineLoading, a3 as TMantineMultiple, a4 as TMantineNotificationWithCloseButton, a5 as TMantineNumberInputDecimalScale, a6 as TMantineOpenInNewTab, h as TMantineOrientation, a7 as TMantineProcessing, T as TMantineRadius, a8 as TMantineRangeSliderMarks, a9 as TMantineRatingCount, aa as TMantineRatingFractions, ab as TMantineRatingReadonly, ac as TMantineReadonly, l as TMantineSize, ad as TMantineSpaceHorizontal, b as TMantineSpacing, n as TMantineSpoilerMaxHeight, ae as TMantineSwatches, af as TMantineTabDisabled, v as TMantineTabsVariant, t as TMantineThemeIconVariant, w as TMantineTimelineLineVariant, k as TMantineTitleOrder, ag as TMantineUseMantineStyle, o as TMantineVariant, ah as TMantineWithCloseButton, ai as TMantineWithIcon, f as TMantineWrap, j as TSharedRadius, a as TSharedSize } from './common-CJSHQL1E.js';
|
|
4
|
+
import { ReactNode, ComponentType } from 'react';
|
|
5
|
+
import { THeroUiButtonVariant, THeroUiSize } from './theme/index.js';
|
|
6
|
+
export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, FULL_RADIUS_PX, IHeroUiResolvedStyle, IMantineResolvedStyle, IReactNativeResolvedStyle, IReactNativeThemeScales, IResolvedVariant, ISharedStyleProps, ISpacingResolved, LINE_HEIGHT, RADIUS_PX, SPACING_PX, SPACING_TO_TAILWIND, TCanonicalColor, TCanonicalRadius, TCanonicalSpacing, THeroUiColor, TMantineMappedColor, TMantineMappedVariant, TSemanticIntent, TSemanticRadius, TSemanticSize, TSemanticSpacing, TSemanticState, colorToHex, mapIntentToHeroUiButtonVariant, mapIntentToHeroUiColor, mapIntentToMantine, mapRadiusToMantine, mapRadiusToPx, mapSizeToHeroUi, mapSizeToMantine, mapSpacingToPx, radiusToPx, resolveMantineVariant, resolveSharedStyle, resolveSharedStyleForMobile, resolveSharedStyleForWeb, resolveSharedStyleProps, sizeToFontPx, spacingToPx, toHeroUiSemanticProps, toMantineSemanticProps, toReactNativeSemanticStyle } from './theme/index.js';
|
|
4
7
|
export { TAnyStyleName, TPluginStyleImplMap, TStyleImplMap, getRegistryEntry, getRegistryEntryAny, getStylePlacement, getStylePlatforms, getStylePluginId, isKnownStyleName, isRegisteredStyleName, isStyleAllowedOnPage, isStylePlacementAllowed, isStyleSupportedOnPlatform, setToStylePlatform, stylePlatformToSet } from './registry/index.js';
|
|
5
|
-
export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, FULL_RADIUS_PX, IHeroUiResolvedStyle, IMantineResolvedStyle, IReactNativeResolvedStyle, IReactNativeThemeScales, IResolvedVariant, ISharedStyleProps, ISpacingResolved, LINE_HEIGHT, RADIUS_PX, SPACING_PX, SPACING_TO_TAILWIND, TCanonicalColor, TCanonicalRadius, TCanonicalSpacing, THeroUiButtonVariant, THeroUiColor, THeroUiSize, TMantineMappedColor, TMantineMappedVariant, TSemanticIntent, TSemanticRadius, TSemanticSize, TSemanticSpacing, TSemanticState, colorToHex, mapIntentToHeroUiButtonVariant, mapIntentToHeroUiColor, mapIntentToMantine, mapRadiusToMantine, mapRadiusToPx, mapSizeToHeroUi, mapSizeToMantine, mapSpacingToPx, radiusToPx, resolveMantineVariant, resolveSharedStyle, resolveSharedStyleForMobile, resolveSharedStyleForWeb, resolveSharedStyleProps, sizeToFontPx, spacingToPx, toHeroUiSemanticProps, toMantineSemanticProps, toReactNativeSemanticStyle } from './theme/index.js';
|
|
6
8
|
export { sharedTailwindExtend, sharedTailwindPreset } from './theme/tailwind.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -1150,6 +1152,133 @@ interface SupportBundleMeta {
|
|
|
1150
1152
|
contents: string[];
|
|
1151
1153
|
}
|
|
1152
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* Mobile UI adapter contract — the SINGLE public source of the capability
|
|
1157
|
+
* shape both mobile tiers implement (mobile rendering plan, sections 8.3 / 9).
|
|
1158
|
+
*
|
|
1159
|
+
* The public mobile app renders CMS styles through these `Mobile*` capability
|
|
1160
|
+
* interfaces only, never directly against a UI library, so the build can swap
|
|
1161
|
+
* the implementation behind the `@selfhelp/mobile-pro-ui` specifier:
|
|
1162
|
+
* - OSS tier -> the public app's in-repo adapters on open `heroui-native` +
|
|
1163
|
+
* React Native primitives.
|
|
1164
|
+
* - Pro tier -> the private `@selfhelp/mobile-pro-ui` package built on paid
|
|
1165
|
+
* HeroUI Pro components.
|
|
1166
|
+
*
|
|
1167
|
+
* It lives here (not copied into each consumer) so the public app and the Pro
|
|
1168
|
+
* package consume ONE contract and cannot silently drift. This module is
|
|
1169
|
+
* type-only: it imports `react` types and the shared semantic scales, and
|
|
1170
|
+
* pulls in NO React Native runtime dependency, which is why it belongs in
|
|
1171
|
+
* `@selfhelp/shared` rather than a separate contract package (plan 8.3).
|
|
1172
|
+
*
|
|
1173
|
+
* Props are normalized + renderer-agnostic (driven by the shared semantic
|
|
1174
|
+
* mapper in this package), NOT raw library props, so both tiers share one
|
|
1175
|
+
* contract.
|
|
1176
|
+
*/
|
|
1177
|
+
|
|
1178
|
+
/** Props shared by every adapter (styling + accessibility passthrough). */
|
|
1179
|
+
interface IMobileAdapterBaseProps {
|
|
1180
|
+
/** Uniwind/Tailwind class string (from `css_mobile` + spacing). */
|
|
1181
|
+
className?: string;
|
|
1182
|
+
/** Accessibility label for assistive tech. */
|
|
1183
|
+
accessibilityLabel?: string;
|
|
1184
|
+
testID?: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface IMobileButtonProps extends IMobileAdapterBaseProps {
|
|
1187
|
+
label?: string;
|
|
1188
|
+
onPress?: () => void;
|
|
1189
|
+
variant?: THeroUiButtonVariant;
|
|
1190
|
+
size?: THeroUiSize;
|
|
1191
|
+
isDisabled?: boolean;
|
|
1192
|
+
isLoading?: boolean;
|
|
1193
|
+
isIconOnly?: boolean;
|
|
1194
|
+
fullWidth?: boolean;
|
|
1195
|
+
children?: ReactNode;
|
|
1196
|
+
}
|
|
1197
|
+
interface IMobileTextProps extends IMobileAdapterBaseProps {
|
|
1198
|
+
children?: ReactNode;
|
|
1199
|
+
/** Map to a heading level / emphasis; renderer decides exact styling. */
|
|
1200
|
+
emphasis?: 'title' | 'body' | 'muted';
|
|
1201
|
+
numberOfLines?: number;
|
|
1202
|
+
}
|
|
1203
|
+
interface IMobileContainerProps extends IMobileAdapterBaseProps {
|
|
1204
|
+
children?: ReactNode;
|
|
1205
|
+
fullWidth?: boolean;
|
|
1206
|
+
/** Resolved padding in px (from shared spacing). */
|
|
1207
|
+
paddingPx?: number;
|
|
1208
|
+
}
|
|
1209
|
+
interface IMobileCardProps extends IMobileAdapterBaseProps {
|
|
1210
|
+
children?: ReactNode;
|
|
1211
|
+
/** Resolved corner radius in px (from shared radius). */
|
|
1212
|
+
radiusPx?: number;
|
|
1213
|
+
}
|
|
1214
|
+
interface IMobileInputProps extends IMobileAdapterBaseProps {
|
|
1215
|
+
value?: string;
|
|
1216
|
+
onChangeText?: (next: string) => void;
|
|
1217
|
+
placeholder?: string;
|
|
1218
|
+
label?: string;
|
|
1219
|
+
isDisabled?: boolean;
|
|
1220
|
+
isInvalid?: boolean;
|
|
1221
|
+
isRequired?: boolean;
|
|
1222
|
+
secureTextEntry?: boolean;
|
|
1223
|
+
keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad';
|
|
1224
|
+
}
|
|
1225
|
+
interface IMobileTextareaProps extends IMobileAdapterBaseProps {
|
|
1226
|
+
value?: string;
|
|
1227
|
+
onChangeText?: (next: string) => void;
|
|
1228
|
+
placeholder?: string;
|
|
1229
|
+
label?: string;
|
|
1230
|
+
isDisabled?: boolean;
|
|
1231
|
+
isInvalid?: boolean;
|
|
1232
|
+
isRequired?: boolean;
|
|
1233
|
+
/** Minimum visible rows (maps to RN `numberOfLines`). */
|
|
1234
|
+
numberOfLines?: number;
|
|
1235
|
+
}
|
|
1236
|
+
interface IMobileSwitchProps extends IMobileAdapterBaseProps {
|
|
1237
|
+
isSelected?: boolean;
|
|
1238
|
+
onSelectedChange?: (next: boolean) => void;
|
|
1239
|
+
isDisabled?: boolean;
|
|
1240
|
+
label?: string;
|
|
1241
|
+
}
|
|
1242
|
+
interface IMobileCheckboxProps extends IMobileAdapterBaseProps {
|
|
1243
|
+
isSelected?: boolean;
|
|
1244
|
+
onSelectedChange?: (next: boolean) => void;
|
|
1245
|
+
isDisabled?: boolean;
|
|
1246
|
+
label?: string;
|
|
1247
|
+
}
|
|
1248
|
+
interface IMobileSelectOption {
|
|
1249
|
+
value: string;
|
|
1250
|
+
label: string;
|
|
1251
|
+
}
|
|
1252
|
+
interface IMobileSelectProps extends IMobileAdapterBaseProps {
|
|
1253
|
+
value?: string;
|
|
1254
|
+
onValueChange?: (next: string) => void;
|
|
1255
|
+
options: readonly IMobileSelectOption[];
|
|
1256
|
+
placeholder?: string;
|
|
1257
|
+
isDisabled?: boolean;
|
|
1258
|
+
}
|
|
1259
|
+
interface IMobileModalProps extends IMobileAdapterBaseProps {
|
|
1260
|
+
isOpen: boolean;
|
|
1261
|
+
onClose: () => void;
|
|
1262
|
+
title?: string;
|
|
1263
|
+
children?: ReactNode;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* The full adapter set every tier must provide. Both the public app's OSS
|
|
1267
|
+
* index and the private Pro package satisfy this exact shape.
|
|
1268
|
+
*/
|
|
1269
|
+
interface IMobileUiAdapters {
|
|
1270
|
+
MobileButton: ComponentType<IMobileButtonProps>;
|
|
1271
|
+
MobileText: ComponentType<IMobileTextProps>;
|
|
1272
|
+
MobileContainer: ComponentType<IMobileContainerProps>;
|
|
1273
|
+
MobileCard: ComponentType<IMobileCardProps>;
|
|
1274
|
+
MobileInput: ComponentType<IMobileInputProps>;
|
|
1275
|
+
MobileTextarea: ComponentType<IMobileTextareaProps>;
|
|
1276
|
+
MobileSwitch: ComponentType<IMobileSwitchProps>;
|
|
1277
|
+
MobileCheckbox: ComponentType<IMobileCheckboxProps>;
|
|
1278
|
+
MobileSelect: ComponentType<IMobileSelectProps>;
|
|
1279
|
+
MobileModal: ComponentType<IMobileModalProps>;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1153
1282
|
/**
|
|
1154
1283
|
* Frontend-only subset of /cms-api/v1/* endpoints. The web frontend keeps
|
|
1155
1284
|
* its admin endpoints local. The mobile app consumes only what's here.
|
|
@@ -1445,4 +1574,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
1445
1574
|
*/
|
|
1446
1575
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
1447
1576
|
|
|
1448
|
-
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
|
|
1577
|
+
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfhelp/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Mobile UI adapter contract test (mobile rendering plan, section 14 "Shared":
|
|
7
|
+
* "Mobile adapter contract type tests").
|
|
8
|
+
*
|
|
9
|
+
* The contract is the SINGLE public source both mobile tiers implement, so this
|
|
10
|
+
* locks the milestone-one capability set. A capability added or removed without
|
|
11
|
+
* a deliberate contract change (and matching OSS + Pro implementations) fails
|
|
12
|
+
* here. The shapes themselves are enforced at compile time by the consumers
|
|
13
|
+
* (`ossAdapters`/`proAdapters: IMobileUiAdapters` + the app `tsconfig.pro.json`).
|
|
14
|
+
*/
|
|
15
|
+
import { describe, expect, it } from 'vitest';
|
|
16
|
+
import type {
|
|
17
|
+
ComponentType,
|
|
18
|
+
} from 'react';
|
|
19
|
+
import type {
|
|
20
|
+
IMobileButtonProps,
|
|
21
|
+
IMobileCardProps,
|
|
22
|
+
IMobileCheckboxProps,
|
|
23
|
+
IMobileContainerProps,
|
|
24
|
+
IMobileInputProps,
|
|
25
|
+
IMobileModalProps,
|
|
26
|
+
IMobileSelectProps,
|
|
27
|
+
IMobileSwitchProps,
|
|
28
|
+
IMobileTextProps,
|
|
29
|
+
IMobileTextareaProps,
|
|
30
|
+
IMobileUiAdapters,
|
|
31
|
+
} from '../mobile-adapters';
|
|
32
|
+
|
|
33
|
+
/** The milestone-one capability set, as named keys. */
|
|
34
|
+
const CONTRACT_CAPABILITIES = [
|
|
35
|
+
'MobileButton',
|
|
36
|
+
'MobileText',
|
|
37
|
+
'MobileContainer',
|
|
38
|
+
'MobileCard',
|
|
39
|
+
'MobileInput',
|
|
40
|
+
'MobileTextarea',
|
|
41
|
+
'MobileSwitch',
|
|
42
|
+
'MobileCheckbox',
|
|
43
|
+
'MobileSelect',
|
|
44
|
+
'MobileModal',
|
|
45
|
+
] as const satisfies ReadonlyArray<keyof IMobileUiAdapters>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Compile-time exhaustiveness: every `IMobileUiAdapters` key must appear in the
|
|
49
|
+
* list above and vice versa. If a capability is added to the interface without
|
|
50
|
+
* being listed here (or removed), this assignment fails to type-check.
|
|
51
|
+
*/
|
|
52
|
+
type ContractKey = keyof IMobileUiAdapters;
|
|
53
|
+
type ListedKey = (typeof CONTRACT_CAPABILITIES)[number];
|
|
54
|
+
const _exhaustiveForward: ListedKey = '' as ContractKey;
|
|
55
|
+
const _exhaustiveBackward: ContractKey = '' as ListedKey;
|
|
56
|
+
void _exhaustiveForward;
|
|
57
|
+
void _exhaustiveBackward;
|
|
58
|
+
|
|
59
|
+
describe('mobile UI adapter contract', () => {
|
|
60
|
+
it('exposes exactly the milestone-one capability set', () => {
|
|
61
|
+
// A trivial component every capability key can hold; proves a complete
|
|
62
|
+
// implementation set is structurally assignable to the contract.
|
|
63
|
+
const stub: ComponentType<never> = () => null;
|
|
64
|
+
const adapters: IMobileUiAdapters = {
|
|
65
|
+
MobileButton: stub as ComponentType<IMobileButtonProps>,
|
|
66
|
+
MobileText: stub as ComponentType<IMobileTextProps>,
|
|
67
|
+
MobileContainer: stub as ComponentType<IMobileContainerProps>,
|
|
68
|
+
MobileCard: stub as ComponentType<IMobileCardProps>,
|
|
69
|
+
MobileInput: stub as ComponentType<IMobileInputProps>,
|
|
70
|
+
MobileTextarea: stub as ComponentType<IMobileTextareaProps>,
|
|
71
|
+
MobileSwitch: stub as ComponentType<IMobileSwitchProps>,
|
|
72
|
+
MobileCheckbox: stub as ComponentType<IMobileCheckboxProps>,
|
|
73
|
+
MobileSelect: stub as ComponentType<IMobileSelectProps>,
|
|
74
|
+
MobileModal: stub as ComponentType<IMobileModalProps>,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
expect(Object.keys(adapters).sort()).toEqual([...CONTRACT_CAPABILITIES].sort());
|
|
78
|
+
expect(CONTRACT_CAPABILITIES).toHaveLength(10);
|
|
79
|
+
});
|
|
80
|
+
});
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Mobile UI adapter contract — the SINGLE public source of the capability
|
|
7
|
+
* shape both mobile tiers implement (mobile rendering plan, sections 8.3 / 9).
|
|
8
|
+
*
|
|
9
|
+
* The public mobile app renders CMS styles through these `Mobile*` capability
|
|
10
|
+
* interfaces only, never directly against a UI library, so the build can swap
|
|
11
|
+
* the implementation behind the `@selfhelp/mobile-pro-ui` specifier:
|
|
12
|
+
* - OSS tier -> the public app's in-repo adapters on open `heroui-native` +
|
|
13
|
+
* React Native primitives.
|
|
14
|
+
* - Pro tier -> the private `@selfhelp/mobile-pro-ui` package built on paid
|
|
15
|
+
* HeroUI Pro components.
|
|
16
|
+
*
|
|
17
|
+
* It lives here (not copied into each consumer) so the public app and the Pro
|
|
18
|
+
* package consume ONE contract and cannot silently drift. This module is
|
|
19
|
+
* type-only: it imports `react` types and the shared semantic scales, and
|
|
20
|
+
* pulls in NO React Native runtime dependency, which is why it belongs in
|
|
21
|
+
* `@selfhelp/shared` rather than a separate contract package (plan 8.3).
|
|
22
|
+
*
|
|
23
|
+
* Props are normalized + renderer-agnostic (driven by the shared semantic
|
|
24
|
+
* mapper in this package), NOT raw library props, so both tiers share one
|
|
25
|
+
* contract.
|
|
26
|
+
*/
|
|
27
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
28
|
+
import type { THeroUiButtonVariant, THeroUiSize } from '../theme/semantic';
|
|
29
|
+
|
|
30
|
+
/** Props shared by every adapter (styling + accessibility passthrough). */
|
|
31
|
+
export interface IMobileAdapterBaseProps {
|
|
32
|
+
/** Uniwind/Tailwind class string (from `css_mobile` + spacing). */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Accessibility label for assistive tech. */
|
|
35
|
+
accessibilityLabel?: string;
|
|
36
|
+
testID?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface IMobileButtonProps extends IMobileAdapterBaseProps {
|
|
40
|
+
label?: string;
|
|
41
|
+
onPress?: () => void;
|
|
42
|
+
variant?: THeroUiButtonVariant;
|
|
43
|
+
size?: THeroUiSize;
|
|
44
|
+
isDisabled?: boolean;
|
|
45
|
+
isLoading?: boolean;
|
|
46
|
+
isIconOnly?: boolean;
|
|
47
|
+
fullWidth?: boolean;
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IMobileTextProps extends IMobileAdapterBaseProps {
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
/** Map to a heading level / emphasis; renderer decides exact styling. */
|
|
54
|
+
emphasis?: 'title' | 'body' | 'muted';
|
|
55
|
+
numberOfLines?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface IMobileContainerProps extends IMobileAdapterBaseProps {
|
|
59
|
+
children?: ReactNode;
|
|
60
|
+
fullWidth?: boolean;
|
|
61
|
+
/** Resolved padding in px (from shared spacing). */
|
|
62
|
+
paddingPx?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IMobileCardProps extends IMobileAdapterBaseProps {
|
|
66
|
+
children?: ReactNode;
|
|
67
|
+
/** Resolved corner radius in px (from shared radius). */
|
|
68
|
+
radiusPx?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface IMobileInputProps extends IMobileAdapterBaseProps {
|
|
72
|
+
value?: string;
|
|
73
|
+
onChangeText?: (next: string) => void;
|
|
74
|
+
placeholder?: string;
|
|
75
|
+
label?: string;
|
|
76
|
+
isDisabled?: boolean;
|
|
77
|
+
isInvalid?: boolean;
|
|
78
|
+
isRequired?: boolean;
|
|
79
|
+
secureTextEntry?: boolean;
|
|
80
|
+
keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface IMobileTextareaProps extends IMobileAdapterBaseProps {
|
|
84
|
+
value?: string;
|
|
85
|
+
onChangeText?: (next: string) => void;
|
|
86
|
+
placeholder?: string;
|
|
87
|
+
label?: string;
|
|
88
|
+
isDisabled?: boolean;
|
|
89
|
+
isInvalid?: boolean;
|
|
90
|
+
isRequired?: boolean;
|
|
91
|
+
/** Minimum visible rows (maps to RN `numberOfLines`). */
|
|
92
|
+
numberOfLines?: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface IMobileSwitchProps extends IMobileAdapterBaseProps {
|
|
96
|
+
isSelected?: boolean;
|
|
97
|
+
onSelectedChange?: (next: boolean) => void;
|
|
98
|
+
isDisabled?: boolean;
|
|
99
|
+
label?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface IMobileCheckboxProps extends IMobileAdapterBaseProps {
|
|
103
|
+
isSelected?: boolean;
|
|
104
|
+
onSelectedChange?: (next: boolean) => void;
|
|
105
|
+
isDisabled?: boolean;
|
|
106
|
+
label?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface IMobileSelectOption {
|
|
110
|
+
value: string;
|
|
111
|
+
label: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface IMobileSelectProps extends IMobileAdapterBaseProps {
|
|
115
|
+
value?: string;
|
|
116
|
+
onValueChange?: (next: string) => void;
|
|
117
|
+
options: readonly IMobileSelectOption[];
|
|
118
|
+
placeholder?: string;
|
|
119
|
+
isDisabled?: boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface IMobileModalProps extends IMobileAdapterBaseProps {
|
|
123
|
+
isOpen: boolean;
|
|
124
|
+
onClose: () => void;
|
|
125
|
+
title?: string;
|
|
126
|
+
children?: ReactNode;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The full adapter set every tier must provide. Both the public app's OSS
|
|
131
|
+
* index and the private Pro package satisfy this exact shape.
|
|
132
|
+
*/
|
|
133
|
+
export interface IMobileUiAdapters {
|
|
134
|
+
MobileButton: ComponentType<IMobileButtonProps>;
|
|
135
|
+
MobileText: ComponentType<IMobileTextProps>;
|
|
136
|
+
MobileContainer: ComponentType<IMobileContainerProps>;
|
|
137
|
+
MobileCard: ComponentType<IMobileCardProps>;
|
|
138
|
+
MobileInput: ComponentType<IMobileInputProps>;
|
|
139
|
+
MobileTextarea: ComponentType<IMobileTextareaProps>;
|
|
140
|
+
MobileSwitch: ComponentType<IMobileSwitchProps>;
|
|
141
|
+
MobileCheckbox: ComponentType<IMobileCheckboxProps>;
|
|
142
|
+
MobileSelect: ComponentType<IMobileSelectProps>;
|
|
143
|
+
MobileModal: ComponentType<IMobileModalProps>;
|
|
144
|
+
}
|