@hintoric/email 0.2.0 → 0.4.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.
Files changed (42) hide show
  1. package/README.md +3 -2
  2. package/dist/alertIcons.d.ts +29 -0
  3. package/dist/alertIcons.d.ts.map +1 -0
  4. package/dist/components/Alert.d.ts +66 -0
  5. package/dist/components/Alert.d.ts.map +1 -0
  6. package/dist/components/HintoricLogo.d.ts.map +1 -1
  7. package/dist/index.d.ts +7 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +713 -147
  10. package/dist/index.js.map +1 -1
  11. package/dist/styles.d.ts +2 -0
  12. package/dist/styles.d.ts.map +1 -1
  13. package/dist/templates/AuthCode/AuthCodeEmail.d.ts +14 -0
  14. package/dist/templates/AuthCode/AuthCodeEmail.d.ts.map +1 -0
  15. package/dist/templates/AuthCode/index.d.ts +4 -0
  16. package/dist/templates/AuthCode/index.d.ts.map +1 -0
  17. package/dist/templates/AuthCode/messages.d.ts +4 -0
  18. package/dist/templates/AuthCode/messages.d.ts.map +1 -0
  19. package/dist/templates/AuthCode/types.d.ts +58 -0
  20. package/dist/templates/AuthCode/types.d.ts.map +1 -0
  21. package/dist/templates/AuthLink/AuthLinkEmail.d.ts +13 -0
  22. package/dist/templates/AuthLink/AuthLinkEmail.d.ts.map +1 -0
  23. package/dist/templates/AuthLink/index.d.ts +4 -0
  24. package/dist/templates/AuthLink/index.d.ts.map +1 -0
  25. package/dist/templates/AuthLink/messages.d.ts +4 -0
  26. package/dist/templates/AuthLink/messages.d.ts.map +1 -0
  27. package/dist/templates/AuthLink/types.d.ts +53 -0
  28. package/dist/templates/AuthLink/types.d.ts.map +1 -0
  29. package/dist/templates/AuthNoAccount/AuthNoAccountEmail.d.ts +13 -0
  30. package/dist/templates/AuthNoAccount/AuthNoAccountEmail.d.ts.map +1 -0
  31. package/dist/templates/AuthNoAccount/index.d.ts +4 -0
  32. package/dist/templates/AuthNoAccount/index.d.ts.map +1 -0
  33. package/dist/templates/AuthNoAccount/messages.d.ts +4 -0
  34. package/dist/templates/AuthNoAccount/messages.d.ts.map +1 -0
  35. package/dist/templates/AuthNoAccount/types.d.ts +55 -0
  36. package/dist/templates/AuthNoAccount/types.d.ts.map +1 -0
  37. package/dist/templates/SecurityActivityAlert/messages.d.ts.map +1 -1
  38. package/dist/templates/SecurityActivityAlert/types.d.ts +8 -3
  39. package/dist/templates/SecurityActivityAlert/types.d.ts.map +1 -1
  40. package/dist/tokens.d.ts +1 -0
  41. package/dist/tokens.d.ts.map +1 -1
  42. package/package.json +2 -2
package/README.md CHANGED
@@ -15,12 +15,13 @@
15
15
  Mail clients understand neither Tailwind classes nor CSS variables, and run no JavaScript, so
16
16
  `@hintoric/ui`'s components can't be sent as they are. `@hintoric/email` has email counterparts of
17
17
  the most important ones — `Typography`, `Button`, `Link`, `Divider`,
18
- `Card`, `Avatar` and `Chip` — with the same `variant`, `color` and `size` props,
18
+ `Card`, `Avatar`, `Chip` and `Alert` — with the same `variant`, `color` and `size` props,
19
19
  rendered as tables and inline styles. A visual test suite compares every variant × colour of each
20
20
  against its web component in light and dark.
21
21
 
22
22
  It also ships `Layout` (a message framed like hintoric's auth screens), `renderEmail` and
23
- ready-made templates such as `SecurityActivityAlertEmail`.
23
+ ready-made templates such as `SecurityActivityAlertEmail`, `AuthCodeEmail` (the one-time
24
+ codes of Kratos' sign-in flows) and `AuthLinkEmail` (its link flows).
24
25
 
25
26
  ## Install
26
27
 
@@ -0,0 +1,29 @@
1
+ import { EmailColor, EmailScheme, EmailVariant } from './tokens';
2
+ /**
3
+ * The icon an Alert shows for its colour — the same as @hintoric/ui's
4
+ * `ALERT_ICON_FOR_COLOR`, which the parity tests compare it with.
5
+ */
6
+ export declare const EMAIL_ALERT_ICON_FOR_COLOR: {
7
+ readonly primary: "info";
8
+ readonly neutral: "info";
9
+ readonly danger: "report";
10
+ readonly success: "check-circle";
11
+ readonly warning: "warning";
12
+ };
13
+ export type EmailAlertIconName = (typeof EMAIL_ALERT_ICON_FOR_COLOR)[EmailColor];
14
+ export declare const EMAIL_ALERT_ICON_BASE = "https://cdn.hintoric.com/assets/email/alert";
15
+ export declare function emailAlertIconUrl(name: EmailAlertIconName, ink: string): string;
16
+ /** The icon for an alert of this variant and colour, in the scheme's ink. */
17
+ export declare function emailAlertIcon(scheme: EmailScheme, variant: EmailVariant, color: EmailColor): {
18
+ name: EmailAlertIconName;
19
+ ink: string;
20
+ url: string;
21
+ };
22
+ /** Every icon file an Alert can ask for — what has to be on the CDN. */
23
+ export declare function emailAlertIconFiles(): {
24
+ name: EmailAlertIconName;
25
+ ink: string;
26
+ file: string;
27
+ url: string;
28
+ }[];
29
+ //# sourceMappingURL=alertIcons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alertIcons.d.ts","sourceRoot":"","sources":["../src/alertIcons.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7H;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;CAMQ,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,UAAU,CAAC,CAAC;AAOjF,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AAEnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,GAAG;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAIpJ;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,IAAI;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAW5G"}
@@ -0,0 +1,66 @@
1
+ import { EmailColor, EmailVariant } from '../tokens';
2
+ import * as React from 'react';
3
+ /**
4
+ * alertVariants.ts: `gap-2/2.5/3.5`, `p-2/3/4`, `text-xs/sm/base` at a 1.5
5
+ * line-height; the icon is AlertIcon's 20px up to md and 24px at lg.
6
+ */
7
+ declare const SIZES: {
8
+ readonly sm: {
9
+ readonly gap: 8;
10
+ readonly padding: 8;
11
+ readonly fontSize: 12;
12
+ readonly icon: 20;
13
+ };
14
+ readonly md: {
15
+ readonly gap: 10;
16
+ readonly padding: 12;
17
+ readonly fontSize: 14;
18
+ readonly icon: 20;
19
+ };
20
+ readonly lg: {
21
+ readonly gap: 14;
22
+ readonly padding: 16;
23
+ readonly fontSize: 16;
24
+ readonly icon: 24;
25
+ };
26
+ };
27
+ export interface AlertProps {
28
+ variant?: EmailVariant;
29
+ color?: EmailColor;
30
+ size?: keyof typeof SIZES;
31
+ /**
32
+ * A box — normally an image icon — on the first line, before the text.
33
+ * Left out, the alert shows the icon for its colour, as the web Alert
34
+ * does; `null` shows none.
35
+ */
36
+ startDecorator?: React.ReactNode;
37
+ /** A box on the first line, after the text. */
38
+ endDecorator?: React.ReactNode;
39
+ style?: React.CSSProperties;
40
+ children: React.ReactNode;
41
+ }
42
+ /**
43
+ * Alert for email, defaulting to soft / neutral like the web Alert; outlined
44
+ * and plain fill with `surface`. A table like Card, since that is the only box
45
+ * Outlook pads reliably. Every cell sets the type itself: tables in quirks
46
+ * mode — a webmail that drops the doctype — don't inherit font size, weight
47
+ * or line height.
48
+ *
49
+ * Decorators get a cell each, as wide as they are, and sit centred in a cell
50
+ * one line high, so an icon lines up with the first line of the text as the
51
+ * web Alert's `min-h-[1lh] items-center` does. That cell has no line height
52
+ * of its own — a decorator is a box; text in it needs its own font-size.
53
+ */
54
+ export declare function Alert({ variant, color, size, startDecorator, endDecorator, style, children }: AlertProps): React.JSX.Element;
55
+ export interface AlertTitleProps {
56
+ style?: React.CSSProperties;
57
+ children: React.ReactNode;
58
+ }
59
+ /**
60
+ * AlertTitle.tsx: `text-base/6 font-semibold`, in the alert's colour. Body
61
+ * text under it keeps the alert's own size; give it `fontWeight: 400` for a
62
+ * regular weight, since the alert is medium.
63
+ */
64
+ export declare function AlertTitle({ style, children }: AlertTitleProps): React.JSX.Element;
65
+ export {};
66
+ //# sourceMappingURL=Alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/components/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAwD,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAErH;;;GAGG;AACH,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;CAID,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EAAE,OAAgB,EAAE,KAAiB,EAAE,IAAW,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,UAAU,qBA6DpI;AA+BD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,eAAe,qBAE9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"HintoricLogo.d.ts","sourceRoot":"","sources":["../../src/components/HintoricLogo.tsx"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,YAAY,gCAqB3B"}
1
+ {"version":3,"file":"HintoricLogo.d.ts","sourceRoot":"","sources":["../../src/components/HintoricLogo.tsx"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,wBAAgB,YAAY,gCAqB3B"}
package/dist/index.d.ts CHANGED
@@ -17,9 +17,16 @@ export { Card } from './components/Card';
17
17
  export type { CardProps } from './components/Card';
18
18
  export { Avatar } from './components/Avatar';
19
19
  export type { AvatarProps } from './components/Avatar';
20
+ export { Alert, AlertTitle } from './components/Alert';
21
+ export { EMAIL_ALERT_ICON_BASE, EMAIL_ALERT_ICON_FOR_COLOR, emailAlertIcon, emailAlertIconFiles, emailAlertIconUrl } from './alertIcons';
22
+ export type { EmailAlertIconName } from './alertIcons';
23
+ export type { AlertProps, AlertTitleProps } from './components/Alert';
20
24
  export { Chip } from './components/Chip';
21
25
  export type { ChipProps } from './components/Chip';
22
26
  export { HintoricLogo } from './components/HintoricLogo';
27
+ export * from './templates/AuthCode';
28
+ export * from './templates/AuthLink';
29
+ export * from './templates/AuthNoAccount';
23
30
  export * from './templates/SecurityActivityAlert';
24
31
  export * from './templates/WaitlistWelcome';
25
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY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