@twentyfirstmedia/elements 0.6.0 → 0.7.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.
@@ -2982,6 +2982,328 @@ export interface QrCodeProps extends BaseProps {
2982
2982
  label?: string;
2983
2983
  }
2984
2984
 
2985
+ /* ── Life: wellbeing, health, goals, AI insights, consent ── */
2986
+ export interface Habit {
2987
+ id: string;
2988
+ label: string;
2989
+ icon?: IconName;
2990
+ tint?: Tint;
2991
+ /** One entry per day, oldest first, today last: true done, false missed, null no data. */
2992
+ days: (boolean | null)[];
2993
+ /** Days in a row (shown as "12-day streak"). */
2994
+ streak?: number;
2995
+ /** A short target, e.g. "8 glasses" or "3× a week". */
2996
+ goal?: string;
2997
+ }
2998
+ export interface HabitTrackerProps extends BaseProps {
2999
+ habits: Habit[];
3000
+ /** Labels of the day columns, oldest first (default: weekday initials ending today). */
3001
+ dayLabels?: string[];
3002
+ /** Today's box of a habit was toggled. */
3003
+ onToggle?: (id: string, done: boolean) => void;
3004
+ /** Accessible name of the list (default "Habits"). */
3005
+ label?: string;
3006
+ }
3007
+ export type MoodLevel = 1 | 2 | 3 | 4 | 5;
3008
+ export interface MoodPickerProps extends BaseProps {
3009
+ value?: MoodLevel | null;
3010
+ defaultValue?: MoodLevel | null;
3011
+ onChange?: (mood: MoodLevel) => void;
3012
+ /** The question (default "How are you feeling?"). */
3013
+ label?: ReactNode;
3014
+ /** Words for the five levels, lowest first (default Awful, Low, Okay, Good, Great). */
3015
+ levels?: [string, string, string, string, string];
3016
+ /** Only the faces; the words stay as accessible names. */
3017
+ compact?: boolean;
3018
+ }
3019
+ export interface VitalTileProps extends BaseProps {
3020
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3021
+ surface?: Surface;
3022
+ label: string;
3023
+ value: number;
3024
+ unit?: string;
3025
+ icon?: IconName;
3026
+ /** The healthy range [low, high]; the tile says whether the value is below, in or above it. */
3027
+ normal?: [number, number];
3028
+ /** The whole scale of the band [min, max] (default: the normal range with room on both sides). */
3029
+ scale?: [number, number];
3030
+ /** Recent values, oldest first, drawn as a sparkline. */
3031
+ trend?: number[];
3032
+ /** Under the value: when it was measured, the source … */
3033
+ caption?: ReactNode;
3034
+ /** Digits after the decimal point (default 0). */
3035
+ digits?: number;
3036
+ }
3037
+ export interface ActivityRing {
3038
+ label: string;
3039
+ value: number;
3040
+ goal: number;
3041
+ unit?: string;
3042
+ tint?: Tint;
3043
+ }
3044
+ export interface ActivityRingsProps extends BaseProps {
3045
+ /** Outer ring first. */
3046
+ rings: ActivityRing[];
3047
+ /** Diameter of the rings (default 132). */
3048
+ size?: number;
3049
+ /** Hide the legend beside the rings. */
3050
+ legend?: boolean;
3051
+ /** Accessible name (default "Activity"). */
3052
+ label?: string;
3053
+ }
3054
+ export type SleepStage = "awake" | "rem" | "light" | "deep";
3055
+ export interface SleepSegment {
3056
+ stage: SleepStage;
3057
+ start: Date | string | number;
3058
+ end: Date | string | number;
3059
+ }
3060
+ export interface SleepChartProps extends BaseProps {
3061
+ /** The night in order, from falling asleep to getting up. */
3062
+ segments: SleepSegment[];
3063
+ /** Accessible name (default "Sleep stages"). */
3064
+ label?: string;
3065
+ /** Hide the totals per stage under the chart. */
3066
+ summary?: boolean;
3067
+ }
3068
+ export interface MedicationItem {
3069
+ id: string;
3070
+ name: string;
3071
+ dose?: string;
3072
+ /** When, as shown ("08:00", "With breakfast"). */
3073
+ time: string;
3074
+ /** Set by the app, which knows the clock: default "taken" when `taken`, else "due". */
3075
+ status?: "taken" | "due" | "missed" | "upcoming";
3076
+ taken?: boolean;
3077
+ note?: string;
3078
+ icon?: IconName;
3079
+ }
3080
+ export interface MedicationListProps extends BaseProps {
3081
+ items: MedicationItem[];
3082
+ /** "Mark as taken" was pressed. */
3083
+ onTake?: (id: string) => void;
3084
+ /** Accessible name (default "Medication"). */
3085
+ label?: string;
3086
+ }
3087
+ export interface JournalEntryProps extends BaseProps {
3088
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3089
+ surface?: Surface;
3090
+ date: Date | string | number;
3091
+ title?: string;
3092
+ mood?: MoodLevel;
3093
+ tags?: string[];
3094
+ children?: ReactNode;
3095
+ /** Buttons at the end (edit, share …). */
3096
+ actions?: ReactNode;
3097
+ }
3098
+ export interface GoalCardProps extends BaseProps {
3099
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3100
+ surface?: Surface;
3101
+ title: string;
3102
+ value: number;
3103
+ target: number;
3104
+ /** How to show value and target (default number). */
3105
+ format?: "number" | "money" | "percent";
3106
+ /** Unit after numbers ("km", "books"). */
3107
+ unit?: string;
3108
+ currency?: string;
3109
+ due?: Date | string | number;
3110
+ icon?: IconName;
3111
+ tint?: Tint;
3112
+ milestones?: { label: string; done?: boolean }[];
3113
+ /** A note under the progress ("€250 a month keeps you on track"). */
3114
+ note?: ReactNode;
3115
+ }
3116
+ export interface InsightCardProps extends BaseProps {
3117
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3118
+ surface?: Surface;
3119
+ title: string;
3120
+ children?: ReactNode;
3121
+ icon?: IconName;
3122
+ tone?: "info" | "success" | "warning" | "highlight";
3123
+ /** Above the title: area and time ("Money · 2 h ago"). */
3124
+ meta?: ReactNode;
3125
+ /** Where the insight comes from, as chips (like chat sources). */
3126
+ sources?: Source[];
3127
+ /** Why the assistant shows it; folded away behind "Why am I seeing this?". */
3128
+ why?: ReactNode;
3129
+ onAccept?: () => void;
3130
+ acceptLabel?: string;
3131
+ onSnooze?: () => void;
3132
+ onDismiss?: () => void;
3133
+ }
3134
+ export interface ConsentScope {
3135
+ id: string;
3136
+ label: string;
3137
+ description?: string;
3138
+ granted: boolean;
3139
+ /** Needed for the connection to work at all: shown, not switchable. */
3140
+ required?: boolean;
3141
+ }
3142
+ export interface ConsentConnector {
3143
+ id: string;
3144
+ name: string;
3145
+ icon?: IconName;
3146
+ /** A logo instead of the icon. */
3147
+ logo?: ReactNode;
3148
+ /** What the assistant uses it for. */
3149
+ purpose?: ReactNode;
3150
+ scopes: ConsentScope[];
3151
+ lastUsed?: Date | string | number;
3152
+ }
3153
+ export interface ConsentListProps extends BaseProps {
3154
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3155
+ surface?: Surface;
3156
+ connectors: ConsentConnector[];
3157
+ onScopeChange?: (connectorId: string, scopeId: string, granted: boolean) => void;
3158
+ onRevoke?: (connectorId: string) => void;
3159
+ /** Accessible name (default "Data access"). */
3160
+ label?: string;
3161
+ }
3162
+
3163
+ /* ── Life: money, insurance, deadlines, documents ── */
3164
+ export interface BudgetCategory {
3165
+ id: string;
3166
+ label: string;
3167
+ icon?: IconName;
3168
+ tint?: Tint;
3169
+ spent: number;
3170
+ limit: number;
3171
+ }
3172
+ export interface BudgetListProps extends BaseProps {
3173
+ categories: BudgetCategory[];
3174
+ currency?: string;
3175
+ /** A category was picked (to show its transactions). */
3176
+ onSelect?: (id: string) => void;
3177
+ /** Accessible name (default "Budgets"). */
3178
+ label?: string;
3179
+ }
3180
+ export interface Subscription {
3181
+ id: string;
3182
+ name: string;
3183
+ icon?: IconName;
3184
+ /** A logo instead of the icon. */
3185
+ logo?: ReactNode;
3186
+ amount: number;
3187
+ period: "week" | "month" | "year";
3188
+ /** Next charge. */
3189
+ next?: Date | string | number;
3190
+ status?: "active" | "trial" | "cancelled";
3191
+ category?: string;
3192
+ }
3193
+ export interface SubscriptionListProps extends BaseProps {
3194
+ items: Subscription[];
3195
+ currency?: string;
3196
+ /** "Manage" on a subscription (cancel, change plan …). */
3197
+ onManage?: (id: string) => void;
3198
+ /** Hide the monthly and yearly totals. */
3199
+ totals?: boolean;
3200
+ /** Accessible name (default "Subscriptions"). */
3201
+ label?: string;
3202
+ }
3203
+ export interface NetWorthCardProps extends BaseProps {
3204
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3205
+ surface?: Surface;
3206
+ assets: { label: string; value: number; icon?: IconName }[];
3207
+ liabilities?: { label: string; value: number; icon?: IconName }[];
3208
+ /** Net worth over time, oldest first. */
3209
+ history?: number[];
3210
+ /** Change over `changeLabel` (e.g. +1,240 "since October"). */
3211
+ change?: number;
3212
+ changeLabel?: string;
3213
+ currency?: string;
3214
+ title?: string;
3215
+ }
3216
+ export interface DeadlineItem {
3217
+ id: string;
3218
+ title: string;
3219
+ /** What kind: "Contract", "ID card", "Tax" … */
3220
+ kind?: string;
3221
+ icon?: IconName;
3222
+ date: Date | string | number;
3223
+ amount?: number;
3224
+ done?: boolean;
3225
+ note?: string;
3226
+ }
3227
+ export interface DeadlineListProps extends BaseProps {
3228
+ items: DeadlineItem[];
3229
+ /** The day to count from (default: now). Set it for server rendering and stable output. */
3230
+ today?: Date | string | number;
3231
+ /** Days ahead that count as soon (default 14). */
3232
+ soon?: number;
3233
+ currency?: string;
3234
+ onDone?: (id: string) => void;
3235
+ /** Accessible name (default "Deadlines"). */
3236
+ label?: string;
3237
+ }
3238
+ export interface PolicyCardProps extends BaseProps {
3239
+ /** `"glass"`: translucent glass over a backdrop (`Ambient`, a photo, a map); `"solid"` opts out inside a glass `UIProvider`. */
3240
+ surface?: Surface;
3241
+ /** The kind of insurance: "Household contents", "Liability" … */
3242
+ type: string;
3243
+ insurer: string;
3244
+ icon?: IconName;
3245
+ tint?: Tint;
3246
+ policyNumber?: string;
3247
+ /** Show only the last four characters of the policy number. */
3248
+ maskNumber?: boolean;
3249
+ /** Sum insured: a number (money) or text ("unlimited"). */
3250
+ coverage?: number | ReactNode;
3251
+ premium?: { amount: number; period: "month" | "quarter" | "year" };
3252
+ deductible?: number;
3253
+ renews?: Date | string | number;
3254
+ status?: "active" | "pending" | "expiring" | "lapsed";
3255
+ currency?: string;
3256
+ /** Buttons at the foot (documents, report a claim …). */
3257
+ actions?: ReactNode;
3258
+ }
3259
+ export interface CoverageRow {
3260
+ id: string;
3261
+ risk: string;
3262
+ status: "covered" | "partial" | "none";
3263
+ note?: ReactNode;
3264
+ /** Which policy covers it. */
3265
+ policy?: string;
3266
+ }
3267
+ export interface CoverageMatrixProps extends BaseProps {
3268
+ rows: CoverageRow[];
3269
+ /** Accessible name and caption (default "Coverage"). */
3270
+ label?: string;
3271
+ }
3272
+ export interface ClaimStep {
3273
+ label: string;
3274
+ date?: Date | string | number;
3275
+ state: "done" | "current" | "todo" | "failed";
3276
+ note?: ReactNode;
3277
+ }
3278
+ export interface ClaimTimelineProps extends BaseProps {
3279
+ title: string;
3280
+ /** Reference and insurer under the title. */
3281
+ meta?: ReactNode;
3282
+ amount?: number;
3283
+ currency?: string;
3284
+ steps: ClaimStep[];
3285
+ }
3286
+ export interface LifeDocument {
3287
+ id: string;
3288
+ title: string;
3289
+ category?: string;
3290
+ icon?: IconName;
3291
+ holder?: string;
3292
+ expires?: Date | string | number;
3293
+ /** "PDF · 240 KB" */
3294
+ meta?: string;
3295
+ }
3296
+ export interface DocumentListProps extends BaseProps {
3297
+ documents: LifeDocument[];
3298
+ /** The day to count expiry from (default: now). */
3299
+ today?: Date | string | number;
3300
+ /** Days ahead that count as expiring soon (default 60). */
3301
+ soon?: number;
3302
+ onOpen?: (id: string) => void;
3303
+ /** Accessible name (default "Documents"). */
3304
+ label?: string;
3305
+ }
3306
+
2985
3307
  export interface IconProps {
2986
3308
  name: IconName;
2987
3309
  /** Pixel size (default 16; 14 in chips and badges, 20 in navigation). */
@@ -3045,6 +3367,42 @@ export type TfTwoFactorSetupElement = TfElement<TwoFactorSetupProps>;
3045
3367
  export type TfColorFieldElement = TfElement<ColorFieldProps>;
3046
3368
  /** `<tf-qr-code>`: A QR code drawn as SVG and encoded on the device, so the text (a sign-in secret, an invite link) never goes to a service. */
3047
3369
  export type TfQrCodeElement = TfElement<QrCodeProps>;
3370
+ /** `<tf-habit-tracker>`: Habits with their last days as a row of marks: done, missed or no entry, today's mark a toggle. */
3371
+ export type TfHabitTrackerElement = TfElement<HabitTrackerProps>;
3372
+ /** `<tf-mood-picker>`: A five-step mood scale with faces and words, as a radio group. */
3373
+ export type TfMoodPickerElement = TfElement<MoodPickerProps>;
3374
+ /** `<tf-vital-tile>`: One health value with its healthy range: the value, a band with the normal zone and a marker, a status in words (in range, below, above) and an optional trend. */
3375
+ export type TfVitalTileElement = TfElement<VitalTileProps>;
3376
+ /** `<tf-activity-rings>`: Concentric progress rings for daily goals (move, exercise, stand, steps, water) with a legend. */
3377
+ export type TfActivityRingsElement = TfElement<ActivityRingsProps>;
3378
+ /** `<tf-sleep-chart>`: A night as sleep stages over time, one lane per stage (awake, REM, light, deep), with the time asleep and the time per stage. */
3379
+ export type TfSleepChartElement = TfElement<SleepChartProps>;
3380
+ /** `<tf-medication-list>`: Today's doses in order, each with its time, name, dose, a status in words and a "taken" button. */
3381
+ export type TfMedicationListElement = TfElement<MedicationListProps>;
3382
+ /** `<tf-journal-entry>`: A journal or diary entry: the date, the mood of the day, a title, the text and tags, with room for actions such as edit or share. */
3383
+ export type TfJournalEntryElement = TfElement<JournalEntryProps>;
3384
+ /** `<tf-goal-card>`: A goal with its progress toward a target, a due date, milestones and a note. */
3385
+ export type TfGoalCardElement = TfElement<GoalCardProps>;
3386
+ /** `<tf-insight-card>`: Something the assistant noticed: what, where it comes from, why it is shown and what to do. */
3387
+ export type TfInsightCardElement = TfElement<InsightCardProps>;
3388
+ /** `<tf-consent-list>`: What each connected source lets the assistant read or do: one card per source with its purpose, last use and a switch per scope, plus "Revoke access". */
3389
+ export type TfConsentListElement = TfElement<ConsentListProps>;
3390
+ /** `<tf-budget-list>`: Spending per category against its limit: spent and limit, a bar, and what is left or over in words. */
3391
+ export type TfBudgetListElement = TfElement<BudgetListProps>;
3392
+ /** `<tf-subscription-list>`: Recurring payments with their next charge, trial and cancelled states, and what they cost together a month and a year. */
3393
+ export type TfSubscriptionListElement = TfElement<SubscriptionListProps>;
3394
+ /** `<tf-net-worth-card>`: What you own minus what you owe: the total, its change and trend, and the assets and liabilities behind it. */
3395
+ export type TfNetWorthCardElement = TfElement<NetWorthCardProps>;
3396
+ /** `<tf-deadline-list>`: Bills, renewals, notice periods and expiring documents in date order, each with "Today", "In 12 days" or "Overdue by 3 days" in words. */
3397
+ export type TfDeadlineListElement = TfElement<DeadlineListProps>;
3398
+ /** `<tf-policy-card>`: One insurance policy: type and insurer, sum insured, premium, deductible, policy number, renewal date and status (active, pending, expiring, lapsed), with room for actions. */
3399
+ export type TfPolicyCardElement = TfElement<PolicyCardProps>;
3400
+ /** `<tf-coverage-matrix>`: Life risks and whether a policy covers them: covered, partly or not covered, with the policy and a note, and a count of each above the table. */
3401
+ export type TfCoverageMatrixElement = TfElement<CoverageMatrixProps>;
3402
+ /** `<tf-claim-timeline>`: An insurance claim from report to payout: steps that are done, current, still to come or failed, with dates and notes, and the amount claimed. */
3403
+ export type TfClaimTimelineElement = TfElement<ClaimTimelineProps>;
3404
+ /** `<tf-document-list>`: Important papers (IDs, contracts, policies, certificates) with category, holder and expiry: "Expired", "Expires in 19 days" or "Valid until May 2031". */
3405
+ export type TfDocumentListElement = TfElement<DocumentListProps>;
3048
3406
  /** `<tf-agent-card>`: One agent at a glance (AgentCard) and everything about it beside a chat (AgentDetails). */
3049
3407
  export type TfAgentCardElement = TfElement<AgentCardProps>;
3050
3408
  /** `<tf-agent-details>`: The AgentDetails component as a custom element. */
@@ -3459,6 +3817,24 @@ declare global {
3459
3817
  "tf-two-factor-setup": TfTwoFactorSetupElement;
3460
3818
  "tf-color-field": TfColorFieldElement;
3461
3819
  "tf-qr-code": TfQrCodeElement;
3820
+ "tf-habit-tracker": TfHabitTrackerElement;
3821
+ "tf-mood-picker": TfMoodPickerElement;
3822
+ "tf-vital-tile": TfVitalTileElement;
3823
+ "tf-activity-rings": TfActivityRingsElement;
3824
+ "tf-sleep-chart": TfSleepChartElement;
3825
+ "tf-medication-list": TfMedicationListElement;
3826
+ "tf-journal-entry": TfJournalEntryElement;
3827
+ "tf-goal-card": TfGoalCardElement;
3828
+ "tf-insight-card": TfInsightCardElement;
3829
+ "tf-consent-list": TfConsentListElement;
3830
+ "tf-budget-list": TfBudgetListElement;
3831
+ "tf-subscription-list": TfSubscriptionListElement;
3832
+ "tf-net-worth-card": TfNetWorthCardElement;
3833
+ "tf-deadline-list": TfDeadlineListElement;
3834
+ "tf-policy-card": TfPolicyCardElement;
3835
+ "tf-coverage-matrix": TfCoverageMatrixElement;
3836
+ "tf-claim-timeline": TfClaimTimelineElement;
3837
+ "tf-document-list": TfDocumentListElement;
3462
3838
  "tf-agent-card": TfAgentCardElement;
3463
3839
  "tf-agent-details": TfAgentDetailsElement;
3464
3840
  "tf-chat-list": TfChatListElement;